From e42154ddd6a37168ebf2bd87ad6c6f7e60ddf478 Mon Sep 17 00:00:00 2001 From: Braden Keith Date: Wed, 9 Jan 2019 17:20:39 -0500 Subject: [PATCH] WIP --- .gitignore | 1 + README.md | 158 + composer.json | 35 + composer.lock | 4776 +++ config/multitenancy.php | 52 + ...2018_11_20_010634_create_tenants_table.php | 55 + phpunit.xml | 26 + src/Contracts/Tenant.php | 26 + src/Exceptions/TenantDoesNotExist.php | 13 + src/Exceptions/UnauthorizedException.php | 24 + src/Middlewares/TenantMiddleware.php | 38 + src/Models/Tenant.php | 50 + src/Multitenancy.php | 121 + src/MultitenancyFacade.php | 13 + src/MultitenancyServiceProvider.php | 44 + src/Traits/BelongsToTenant.php | 31 + src/Traits/HasTenants.php | 11 + tests/Databases/MigrateDatabaseTest.php | 38 + tests/Feature/BelongsToTenantTest.php | 91 + tests/Feature/MiddlewareTest.php | 87 + tests/Feature/TenantTest.php | 24 + tests/Product.php | 13 + tests/Stubs/Controllers/ProductController.php | 36 + tests/TestCase.php | 111 + tests/User.php | 22 + vendor/autoload.php | 7 + vendor/bin/phpunit | 1 + vendor/bin/var-dump-server | 1 + .../phpunit-result-printer/.styleci.yml | 6 + .../phpunit-result-printer/.travis.yml | 21 + .../phpunit-result-printer/LICENSE | 20 + .../phpunit-result-printer/README.md | 47 + .../phpunit-result-printer/composer.json | 31 + .../phpunit-printer.yml | 4 + .../phpunit-result-printer/phpunit.ci.xml | 18 + .../phpunit-result-printer/phpunit.xml | 24 + .../phpunit-result-printer/src/Colors.php | 189 + .../Exception/InvalidArgumentException.php | 7 + .../phpunit-result-printer/src/Printer.php | 313 + vendor/composer/ClassLoader.php | 445 + vendor/composer/LICENSE | 21 + vendor/composer/autoload_classmap.php | 620 + vendor/composer/autoload_files.php | 31 + vendor/composer/autoload_namespaces.php | 13 + vendor/composer/autoload_psr4.php | 62 + vendor/composer/autoload_real.php | 70 + vendor/composer/autoload_static.php | 1017 + vendor/composer/installed.json | 4925 +++ vendor/doctrine/inflector/LICENSE | 19 + vendor/doctrine/inflector/README.md | 6 + vendor/doctrine/inflector/composer.json | 32 + .../Doctrine/Common/Inflector/Inflector.php | 490 + vendor/doctrine/instantiator/CONTRIBUTING.md | 35 + vendor/doctrine/instantiator/LICENSE | 19 + vendor/doctrine/instantiator/README.md | 40 + vendor/doctrine/instantiator/composer.json | 45 + .../Exception/ExceptionInterface.php | 29 + .../Exception/InvalidArgumentException.php | 52 + .../Exception/UnexpectedValueException.php | 66 + .../Doctrine/Instantiator/Instantiator.php | 216 + .../Instantiator/InstantiatorInterface.php | 37 + vendor/doctrine/lexer/LICENSE | 19 + vendor/doctrine/lexer/README.md | 5 + vendor/doctrine/lexer/composer.json | 24 + .../Doctrine/Common/Lexer/AbstractLexer.php | 327 + .../cron-expression/.editorconfig | 16 + .../cron-expression/CHANGELOG.md | 66 + vendor/dragonmantank/cron-expression/LICENSE | 19 + .../dragonmantank/cron-expression/README.md | 73 + .../cron-expression/composer.json | 35 + .../src/Cron/AbstractField.php | 278 + .../src/Cron/CronExpression.php | 411 + .../src/Cron/DayOfMonthField.php | 131 + .../src/Cron/DayOfWeekField.php | 170 + .../cron-expression/src/Cron/FieldFactory.php | 54 + .../src/Cron/FieldInterface.php | 40 + .../cron-expression/src/Cron/HoursField.php | 69 + .../cron-expression/src/Cron/MinutesField.php | 60 + .../cron-expression/src/Cron/MonthField.php | 38 + .../tests/Cron/AbstractFieldTest.php | 139 + .../tests/Cron/CronExpressionTest.php | 560 + .../tests/Cron/DayOfMonthFieldTest.php | 64 + .../tests/Cron/DayOfWeekFieldTest.php | 129 + .../tests/Cron/FieldFactoryTest.php | 42 + .../tests/Cron/HoursFieldTest.php | 77 + .../tests/Cron/MinutesFieldTest.php | 51 + .../tests/Cron/MonthFieldTest.php | 81 + .../EmailValidator/EmailLexer.php | 221 + .../EmailValidator/EmailParser.php | 104 + .../EmailValidator/EmailValidator.php | 67 + .../Exception/AtextAfterCFWS.php | 9 + .../EmailValidator/Exception/CRLFAtTheEnd.php | 9 + .../EmailValidator/Exception/CRLFX2.php | 9 + .../EmailValidator/Exception/CRNoLF.php | 9 + .../Exception/CharNotAllowed.php | 9 + .../Exception/CommaInDomain.php | 9 + .../Exception/ConsecutiveAt.php | 9 + .../Exception/ConsecutiveDot.php | 9 + .../Exception/DomainHyphened.php | 9 + .../EmailValidator/Exception/DotAtEnd.php | 9 + .../EmailValidator/Exception/DotAtStart.php | 9 + .../EmailValidator/Exception/ExpectingAT.php | 9 + .../Exception/ExpectingATEXT.php | 9 + .../Exception/ExpectingCTEXT.php | 9 + .../Exception/ExpectingDTEXT.php | 9 + .../Exception/ExpectingDomainLiteralClose.php | 9 + .../Exception/ExpectingQPair.php | 9 + .../EmailValidator/Exception/InvalidEmail.php | 14 + .../EmailValidator/Exception/NoDNSRecord.php | 11 + .../EmailValidator/Exception/NoDomainPart.php | 9 + .../EmailValidator/Exception/NoLocalPart.php | 9 + .../Exception/UnclosedComment.php | 9 + .../Exception/UnclosedQuotedString.php | 9 + .../Exception/UnopenedComment.php | 9 + .../EmailValidator/Parser/DomainPart.php | 368 + .../EmailValidator/Parser/LocalPart.php | 138 + .../EmailValidator/Parser/Parser.php | 215 + .../Validation/DNSCheckValidation.php | 72 + .../Validation/EmailValidation.php | 34 + .../Validation/Error/RFCWarnings.php | 11 + .../Validation/Error/SpoofEmail.php | 11 + .../Exception/EmptyValidationList.php | 13 + .../Validation/MultipleErrors.php | 26 + .../Validation/MultipleValidationWithAnd.php | 111 + .../Validation/NoRFCWarningsValidation.php | 41 + .../Validation/RFCValidation.php | 49 + .../Validation/SpoofCheckValidation.php | 45 + .../EmailValidator/Warning/AddressLiteral.php | 14 + .../EmailValidator/Warning/CFWSNearAt.php | 13 + .../EmailValidator/Warning/CFWSWithFWS.php | 13 + .../EmailValidator/Warning/Comment.php | 13 + .../Warning/DeprecatedComment.php | 13 + .../EmailValidator/Warning/DomainLiteral.php | 14 + .../EmailValidator/Warning/DomainTooLong.php | 14 + .../EmailValidator/Warning/EmailTooLong.php | 15 + .../EmailValidator/Warning/IPV6BadChar.php | 14 + .../EmailValidator/Warning/IPV6ColonEnd.php | 14 + .../EmailValidator/Warning/IPV6ColonStart.php | 14 + .../EmailValidator/Warning/IPV6Deprecated.php | 14 + .../Warning/IPV6DoubleColon.php | 14 + .../EmailValidator/Warning/IPV6GroupCount.php | 14 + .../EmailValidator/Warning/IPV6MaxGroups.php | 14 + .../EmailValidator/Warning/LabelTooLong.php | 14 + .../EmailValidator/Warning/LocalTooLong.php | 15 + .../EmailValidator/Warning/NoDNSMXRecord.php | 14 + .../EmailValidator/Warning/ObsoleteDTEXT.php | 14 + .../EmailValidator/Warning/QuotedPart.php | 13 + .../EmailValidator/Warning/QuotedString.php | 13 + .../EmailValidator/Warning/TLD.php | 13 + .../EmailValidator/Warning/Warning.php | 30 + vendor/egulias/email-validator/LICENSE | 19 + vendor/egulias/email-validator/README.md | 82 + vendor/egulias/email-validator/composer.json | 44 + .../egulias/email-validator/phpunit.xml.dist | 26 + vendor/erusev/parsedown/LICENSE.txt | 20 + vendor/erusev/parsedown/Parsedown.php | 1679 + vendor/erusev/parsedown/README.md | 86 + vendor/erusev/parsedown/composer.json | 33 + vendor/fzaninotto/faker/.gitignore | 2 + vendor/fzaninotto/faker/.travis.yml | 25 + vendor/fzaninotto/faker/CHANGELOG.md | 641 + vendor/fzaninotto/faker/CONTRIBUTING.md | 22 + vendor/fzaninotto/faker/LICENSE | 22 + vendor/fzaninotto/faker/Makefile | 10 + vendor/fzaninotto/faker/composer.json | 35 + vendor/fzaninotto/faker/phpunit.xml.dist | 12 + vendor/fzaninotto/faker/readme.md | 1707 ++ .../faker/src/Faker/Calculator/Iban.php | 73 + .../faker/src/Faker/Calculator/Inn.php | 34 + .../faker/src/Faker/Calculator/Luhn.php | 75 + .../faker/src/Faker/Calculator/TCNo.php | 52 + .../faker/src/Faker/DefaultGenerator.php | 38 + .../fzaninotto/faker/src/Faker/Documentor.php | 66 + vendor/fzaninotto/faker/src/Faker/Factory.php | 61 + .../fzaninotto/faker/src/Faker/Generator.php | 281 + .../faker/src/Faker/Guesser/Name.php | 156 + .../Faker/ORM/CakePHP/ColumnTypeGuesser.php | 67 + .../src/Faker/ORM/CakePHP/EntityPopulator.php | 166 + .../faker/src/Faker/ORM/CakePHP/Populator.php | 109 + .../Faker/ORM/Doctrine/ColumnTypeGuesser.php | 75 + .../Faker/ORM/Doctrine/EntityPopulator.php | 251 + .../src/Faker/ORM/Doctrine/Populator.php | 82 + .../Faker/ORM/Mandango/ColumnTypeGuesser.php | 49 + .../Faker/ORM/Mandango/EntityPopulator.php | 122 + .../src/Faker/ORM/Mandango/Populator.php | 65 + .../Faker/ORM/Propel/ColumnTypeGuesser.php | 107 + .../src/Faker/ORM/Propel/EntityPopulator.php | 191 + .../faker/src/Faker/ORM/Propel/Populator.php | 89 + .../Faker/ORM/Propel2/ColumnTypeGuesser.php | 107 + .../src/Faker/ORM/Propel2/EntityPopulator.php | 192 + .../faker/src/Faker/ORM/Propel2/Populator.php | 92 + .../src/Faker/ORM/Spot/ColumnTypeGuesser.php | 77 + .../src/Faker/ORM/Spot/EntityPopulator.php | 222 + .../faker/src/Faker/ORM/Spot/Populator.php | 88 + .../faker/src/Faker/Provider/Address.php | 139 + .../faker/src/Faker/Provider/Barcode.php | 114 + .../faker/src/Faker/Provider/Base.php | 612 + .../faker/src/Faker/Provider/Biased.php | 64 + .../faker/src/Faker/Provider/Color.php | 116 + .../faker/src/Faker/Provider/Company.php | 44 + .../faker/src/Faker/Provider/DateTime.php | 340 + .../faker/src/Faker/Provider/File.php | 606 + .../faker/src/Faker/Provider/HtmlLorem.php | 277 + .../faker/src/Faker/Provider/Image.php | 105 + .../faker/src/Faker/Provider/Internet.php | 362 + .../faker/src/Faker/Provider/Lorem.php | 203 + .../src/Faker/Provider/Miscellaneous.php | 323 + .../faker/src/Faker/Provider/Payment.php | 286 + .../faker/src/Faker/Provider/Person.php | 126 + .../faker/src/Faker/Provider/PhoneNumber.php | 43 + .../faker/src/Faker/Provider/Text.php | 141 + .../faker/src/Faker/Provider/UserAgent.php | 165 + .../faker/src/Faker/Provider/Uuid.php | 57 + .../src/Faker/Provider/ar_JO/Address.php | 152 + .../src/Faker/Provider/ar_JO/Company.php | 63 + .../src/Faker/Provider/ar_JO/Internet.php | 55 + .../faker/src/Faker/Provider/ar_JO/Person.php | 108 + .../faker/src/Faker/Provider/ar_JO/Text.php | 271 + .../src/Faker/Provider/ar_SA/Address.php | 146 + .../faker/src/Faker/Provider/ar_SA/Color.php | 81 + .../src/Faker/Provider/ar_SA/Company.php | 74 + .../src/Faker/Provider/ar_SA/Internet.php | 55 + .../src/Faker/Provider/ar_SA/Payment.php | 19 + .../faker/src/Faker/Provider/ar_SA/Person.php | 118 + .../faker/src/Faker/Provider/ar_SA/Text.php | 271 + .../src/Faker/Provider/at_AT/Payment.php | 44 + .../src/Faker/Provider/bg_BG/Internet.php | 9 + .../src/Faker/Provider/bg_BG/Payment.php | 43 + .../faker/src/Faker/Provider/bg_BG/Person.php | 114 + .../src/Faker/Provider/bg_BG/PhoneNumber.php | 20 + .../src/Faker/Provider/bn_BD/Address.php | 310 + .../src/Faker/Provider/bn_BD/Company.php | 28 + .../faker/src/Faker/Provider/bn_BD/Person.php | 36 + .../src/Faker/Provider/bn_BD/PhoneNumber.php | 14 + .../faker/src/Faker/Provider/bn_BD/Utils.php | 14 + .../src/Faker/Provider/cs_CZ/Address.php | 149 + .../src/Faker/Provider/cs_CZ/Company.php | 120 + .../src/Faker/Provider/cs_CZ/DateTime.php | 61 + .../src/Faker/Provider/cs_CZ/Internet.php | 9 + .../src/Faker/Provider/cs_CZ/Payment.php | 19 + .../faker/src/Faker/Provider/cs_CZ/Person.php | 533 + .../src/Faker/Provider/cs_CZ/PhoneNumber.php | 14 + .../faker/src/Faker/Provider/cs_CZ/Text.php | 7185 +++++ .../src/Faker/Provider/da_DK/Address.php | 287 + .../src/Faker/Provider/da_DK/Company.php | 70 + .../src/Faker/Provider/da_DK/Internet.php | 30 + .../src/Faker/Provider/da_DK/Payment.php | 19 + .../faker/src/Faker/Provider/da_DK/Person.php | 195 + .../src/Faker/Provider/da_DK/PhoneNumber.php | 21 + .../src/Faker/Provider/de_AT/Address.php | 116 + .../src/Faker/Provider/de_AT/Company.php | 13 + .../src/Faker/Provider/de_AT/Internet.php | 9 + .../src/Faker/Provider/de_AT/Payment.php | 19 + .../faker/src/Faker/Provider/de_AT/Person.php | 120 + .../src/Faker/Provider/de_AT/PhoneNumber.php | 19 + .../faker/src/Faker/Provider/de_AT/Text.php | 7 + .../src/Faker/Provider/de_CH/Address.php | 185 + .../src/Faker/Provider/de_CH/Company.php | 15 + .../src/Faker/Provider/de_CH/Internet.php | 17 + .../src/Faker/Provider/de_CH/Payment.php | 19 + .../faker/src/Faker/Provider/de_CH/Person.php | 89 + .../src/Faker/Provider/de_CH/PhoneNumber.php | 43 + .../faker/src/Faker/Provider/de_CH/Text.php | 2036 ++ .../src/Faker/Provider/de_DE/Address.php | 125 + .../src/Faker/Provider/de_DE/Company.php | 15 + .../src/Faker/Provider/de_DE/Internet.php | 26 + .../src/Faker/Provider/de_DE/Payment.php | 56 + .../faker/src/Faker/Provider/de_DE/Person.php | 129 + .../src/Faker/Provider/de_DE/PhoneNumber.php | 20 + .../faker/src/Faker/Provider/de_DE/Text.php | 2036 ++ .../src/Faker/Provider/el_CY/Address.php | 55 + .../src/Faker/Provider/el_CY/Company.php | 18 + .../src/Faker/Provider/el_CY/Internet.php | 9 + .../src/Faker/Provider/el_CY/Payment.php | 49 + .../faker/src/Faker/Provider/el_CY/Person.php | 97 + .../src/Faker/Provider/el_CY/PhoneNumber.php | 32 + .../src/Faker/Provider/el_GR/Address.php | 61 + .../src/Faker/Provider/el_GR/Company.php | 84 + .../src/Faker/Provider/el_GR/Payment.php | 19 + .../faker/src/Faker/Provider/el_GR/Person.php | 178 + .../src/Faker/Provider/el_GR/PhoneNumber.php | 85 + .../faker/src/Faker/Provider/el_GR/Text.php | 2581 ++ .../src/Faker/Provider/en_AU/Address.php | 110 + .../src/Faker/Provider/en_AU/Internet.php | 9 + .../src/Faker/Provider/en_AU/PhoneNumber.php | 56 + .../src/Faker/Provider/en_CA/Address.php | 64 + .../src/Faker/Provider/en_CA/PhoneNumber.php | 18 + .../src/Faker/Provider/en_GB/Address.php | 143 + .../src/Faker/Provider/en_GB/Internet.php | 9 + .../src/Faker/Provider/en_GB/Payment.php | 19 + .../faker/src/Faker/Provider/en_GB/Person.php | 93 + .../src/Faker/Provider/en_GB/PhoneNumber.php | 43 + .../src/Faker/Provider/en_HK/Address.php | 240 + .../src/Faker/Provider/en_HK/Internet.php | 14 + .../src/Faker/Provider/en_HK/PhoneNumber.php | 38 + .../src/Faker/Provider/en_IN/Address.php | 182 + .../src/Faker/Provider/en_IN/Internet.php | 9 + .../faker/src/Faker/Provider/en_IN/Person.php | 127 + .../src/Faker/Provider/en_IN/PhoneNumber.php | 35 + .../src/Faker/Provider/en_NG/Address.php | 98 + .../src/Faker/Provider/en_NG/Internet.php | 8 + .../faker/src/Faker/Provider/en_NG/Person.php | 91 + .../src/Faker/Provider/en_NG/PhoneNumber.php | 133 + .../src/Faker/Provider/en_NZ/Address.php | 78 + .../src/Faker/Provider/en_NZ/Internet.php | 16 + .../src/Faker/Provider/en_NZ/PhoneNumber.php | 93 + .../src/Faker/Provider/en_PH/Address.php | 417 + .../src/Faker/Provider/en_PH/PhoneNumber.php | 58 + .../src/Faker/Provider/en_SG/Address.php | 126 + .../src/Faker/Provider/en_SG/PhoneNumber.php | 110 + .../src/Faker/Provider/en_UG/Address.php | 101 + .../src/Faker/Provider/en_UG/Internet.php | 9 + .../faker/src/Faker/Provider/en_UG/Person.php | 132 + .../src/Faker/Provider/en_UG/PhoneNumber.php | 17 + .../src/Faker/Provider/en_US/Address.php | 97 + .../src/Faker/Provider/en_US/Company.php | 116 + .../src/Faker/Provider/en_US/Payment.php | 38 + .../faker/src/Faker/Provider/en_US/Person.php | 131 + .../src/Faker/Provider/en_US/PhoneNumber.php | 108 + .../faker/src/Faker/Provider/en_US/Text.php | 3720 +++ .../src/Faker/Provider/en_ZA/Address.php | 70 + .../src/Faker/Provider/en_ZA/Company.php | 29 + .../src/Faker/Provider/en_ZA/Internet.php | 18 + .../faker/src/Faker/Provider/en_ZA/Person.php | 178 + .../src/Faker/Provider/en_ZA/PhoneNumber.php | 100 + .../src/Faker/Provider/es_AR/Address.php | 68 + .../src/Faker/Provider/es_AR/Company.php | 66 + .../faker/src/Faker/Provider/es_AR/Person.php | 90 + .../src/Faker/Provider/es_AR/PhoneNumber.php | 42 + .../src/Faker/Provider/es_ES/Address.php | 101 + .../src/Faker/Provider/es_ES/Company.php | 80 + .../src/Faker/Provider/es_ES/Internet.php | 9 + .../src/Faker/Provider/es_ES/Payment.php | 39 + .../faker/src/Faker/Provider/es_ES/Person.php | 100 + .../src/Faker/Provider/es_ES/PhoneNumber.php | 29 + .../faker/src/Faker/Provider/es_ES/Text.php | 687 + .../src/Faker/Provider/es_PE/Address.php | 65 + .../src/Faker/Provider/es_PE/Company.php | 66 + .../faker/src/Faker/Provider/es_PE/Person.php | 106 + .../src/Faker/Provider/es_PE/PhoneNumber.php | 17 + .../src/Faker/Provider/es_VE/Address.php | 72 + .../src/Faker/Provider/es_VE/Company.php | 40 + .../src/Faker/Provider/es_VE/Internet.php | 9 + .../faker/src/Faker/Provider/es_VE/Person.php | 167 + .../src/Faker/Provider/es_VE/PhoneNumber.php | 29 + .../src/Faker/Provider/fa_IR/Address.php | 100 + .../src/Faker/Provider/fa_IR/Company.php | 57 + .../src/Faker/Provider/fa_IR/Internet.php | 102 + .../faker/src/Faker/Provider/fa_IR/Person.php | 137 + .../src/Faker/Provider/fa_IR/PhoneNumber.php | 46 + .../faker/src/Faker/Provider/fa_IR/Text.php | 546 + .../src/Faker/Provider/fi_FI/Address.php | 85 + .../src/Faker/Provider/fi_FI/Company.php | 64 + .../src/Faker/Provider/fi_FI/Internet.php | 9 + .../src/Faker/Provider/fi_FI/Payment.php | 19 + .../faker/src/Faker/Provider/fi_FI/Person.php | 145 + .../src/Faker/Provider/fi_FI/PhoneNumber.php | 99 + .../src/Faker/Provider/fr_BE/Address.php | 72 + .../src/Faker/Provider/fr_BE/Company.php | 13 + .../src/Faker/Provider/fr_BE/Internet.php | 9 + .../src/Faker/Provider/fr_BE/Payment.php | 39 + .../faker/src/Faker/Provider/fr_BE/Person.php | 49 + .../src/Faker/Provider/fr_BE/PhoneNumber.php | 20 + .../src/Faker/Provider/fr_CA/Address.php | 125 + .../src/Faker/Provider/fr_CA/Company.php | 7 + .../faker/src/Faker/Provider/fr_CA/Person.php | 82 + .../src/Faker/Provider/fr_CH/Address.php | 140 + .../src/Faker/Provider/fr_CH/Company.php | 15 + .../src/Faker/Provider/fr_CH/Internet.php | 9 + .../src/Faker/Provider/fr_CH/Payment.php | 19 + .../faker/src/Faker/Provider/fr_CH/Person.php | 90 + .../src/Faker/Provider/fr_CH/PhoneNumber.php | 43 + .../faker/src/Faker/Provider/fr_CH/Text.php | 8 + .../src/Faker/Provider/fr_FR/Address.php | 147 + .../src/Faker/Provider/fr_FR/Company.php | 476 + .../src/Faker/Provider/fr_FR/Internet.php | 9 + .../src/Faker/Provider/fr_FR/Payment.php | 44 + .../faker/src/Faker/Provider/fr_FR/Person.php | 129 + .../src/Faker/Provider/fr_FR/PhoneNumber.php | 141 + .../faker/src/Faker/Provider/fr_FR/Text.php | 15531 ++++++++++ .../src/Faker/Provider/he_IL/Address.php | 122 + .../src/Faker/Provider/he_IL/Company.php | 14 + .../src/Faker/Provider/he_IL/Payment.php | 19 + .../faker/src/Faker/Provider/he_IL/Person.php | 132 + .../src/Faker/Provider/he_IL/PhoneNumber.php | 14 + .../src/Faker/Provider/hr_HR/Address.php | 69 + .../src/Faker/Provider/hr_HR/Company.php | 25 + .../src/Faker/Provider/hr_HR/Payment.php | 19 + .../faker/src/Faker/Provider/hr_HR/Person.php | 27 + .../src/Faker/Provider/hr_HR/PhoneNumber.php | 14 + .../src/Faker/Provider/hu_HU/Address.php | 149 + .../src/Faker/Provider/hu_HU/Company.php | 13 + .../src/Faker/Provider/hu_HU/Payment.php | 19 + .../faker/src/Faker/Provider/hu_HU/Person.php | 91 + .../src/Faker/Provider/hu_HU/PhoneNumber.php | 14 + .../faker/src/Faker/Provider/hu_HU/Text.php | 3407 +++ .../src/Faker/Provider/hy_AM/Address.php | 132 + .../faker/src/Faker/Provider/hy_AM/Color.php | 12 + .../src/Faker/Provider/hy_AM/Company.php | 54 + .../src/Faker/Provider/hy_AM/Internet.php | 9 + .../faker/src/Faker/Provider/hy_AM/Person.php | 112 + .../src/Faker/Provider/hy_AM/PhoneNumber.php | 40 + .../src/Faker/Provider/id_ID/Address.php | 316 + .../src/Faker/Provider/id_ID/Company.php | 43 + .../src/Faker/Provider/id_ID/Internet.php | 25 + .../faker/src/Faker/Provider/id_ID/Person.php | 293 + .../src/Faker/Provider/id_ID/PhoneNumber.php | 55 + .../src/Faker/Provider/is_IS/Address.php | 178 + .../src/Faker/Provider/is_IS/Company.php | 53 + .../src/Faker/Provider/is_IS/Internet.php | 23 + .../src/Faker/Provider/is_IS/Payment.php | 19 + .../faker/src/Faker/Provider/is_IS/Person.php | 140 + .../src/Faker/Provider/is_IS/PhoneNumber.php | 20 + .../src/Faker/Provider/it_CH/Address.php | 139 + .../src/Faker/Provider/it_CH/Company.php | 15 + .../src/Faker/Provider/it_CH/Internet.php | 9 + .../src/Faker/Provider/it_CH/Payment.php | 19 + .../faker/src/Faker/Provider/it_CH/Person.php | 88 + .../src/Faker/Provider/it_CH/PhoneNumber.php | 43 + .../faker/src/Faker/Provider/it_CH/Text.php | 8 + .../src/Faker/Provider/it_IT/Address.php | 97 + .../src/Faker/Provider/it_IT/Company.php | 78 + .../src/Faker/Provider/it_IT/Internet.php | 9 + .../src/Faker/Provider/it_IT/Payment.php | 19 + .../faker/src/Faker/Provider/it_IT/Person.php | 98 + .../src/Faker/Provider/it_IT/PhoneNumber.php | 21 + .../faker/src/Faker/Provider/it_IT/Text.php | 1994 ++ .../src/Faker/Provider/ja_JP/Address.php | 137 + .../src/Faker/Provider/ja_JP/Company.php | 17 + .../src/Faker/Provider/ja_JP/Internet.php | 93 + .../faker/src/Faker/Provider/ja_JP/Person.php | 141 + .../src/Faker/Provider/ja_JP/PhoneNumber.php | 19 + .../faker/src/Faker/Provider/ja_JP/Text.php | 635 + .../src/Faker/Provider/ka_GE/Address.php | 140 + .../faker/src/Faker/Provider/ka_GE/Color.php | 16 + .../src/Faker/Provider/ka_GE/Company.php | 55 + .../src/Faker/Provider/ka_GE/DateTime.php | 42 + .../src/Faker/Provider/ka_GE/Internet.php | 15 + .../src/Faker/Provider/ka_GE/Payment.php | 53 + .../faker/src/Faker/Provider/ka_GE/Person.php | 63 + .../src/Faker/Provider/ka_GE/PhoneNumber.php | 14 + .../faker/src/Faker/Provider/ka_GE/Text.php | 1000 + .../src/Faker/Provider/kk_KZ/Address.php | 105 + .../faker/src/Faker/Provider/kk_KZ/Color.php | 12 + .../src/Faker/Provider/kk_KZ/Company.php | 72 + .../src/Faker/Provider/kk_KZ/Internet.php | 9 + .../src/Faker/Provider/kk_KZ/Payment.php | 33 + .../faker/src/Faker/Provider/kk_KZ/Person.php | 257 + .../src/Faker/Provider/kk_KZ/PhoneNumber.php | 16 + .../faker/src/Faker/Provider/kk_KZ/Text.php | 490 + .../src/Faker/Provider/ko_KR/Address.php | 96 + .../src/Faker/Provider/ko_KR/Company.php | 31 + .../src/Faker/Provider/ko_KR/Internet.php | 86 + .../faker/src/Faker/Provider/ko_KR/Person.php | 55 + .../src/Faker/Provider/ko_KR/PhoneNumber.php | 42 + .../faker/src/Faker/Provider/ko_KR/Text.php | 1723 ++ .../src/Faker/Provider/lt_LT/Address.php | 131 + .../src/Faker/Provider/lt_LT/Company.php | 15 + .../src/Faker/Provider/lt_LT/Internet.php | 18 + .../src/Faker/Provider/lt_LT/Payment.php | 19 + .../faker/src/Faker/Provider/lt_LT/Person.php | 350 + .../src/Faker/Provider/lt_LT/PhoneNumber.php | 17 + .../src/Faker/Provider/lv_LV/Address.php | 117 + .../faker/src/Faker/Provider/lv_LV/Color.php | 19 + .../src/Faker/Provider/lv_LV/Internet.php | 9 + .../src/Faker/Provider/lv_LV/Payment.php | 19 + .../faker/src/Faker/Provider/lv_LV/Person.php | 128 + .../src/Faker/Provider/lv_LV/PhoneNumber.php | 15 + .../src/Faker/Provider/me_ME/Address.php | 119 + .../src/Faker/Provider/me_ME/Company.php | 49 + .../src/Faker/Provider/me_ME/Payment.php | 19 + .../faker/src/Faker/Provider/me_ME/Person.php | 102 + .../src/Faker/Provider/me_ME/PhoneNumber.php | 15 + .../faker/src/Faker/Provider/mn_MN/Person.php | 100 + .../src/Faker/Provider/mn_MN/PhoneNumber.php | 13 + .../src/Faker/Provider/ms_MY/Address.php | 708 + .../src/Faker/Provider/ms_MY/Company.php | 105 + .../Faker/Provider/ms_MY/Miscellaneous.php | 169 + .../src/Faker/Provider/ms_MY/Payment.php | 244 + .../faker/src/Faker/Provider/ms_MY/Person.php | 813 + .../src/Faker/Provider/ms_MY/PhoneNumber.php | 217 + .../src/Faker/Provider/nb_NO/Address.php | 195 + .../src/Faker/Provider/nb_NO/Company.php | 55 + .../src/Faker/Provider/nb_NO/Payment.php | 19 + .../faker/src/Faker/Provider/nb_NO/Person.php | 326 + .../src/Faker/Provider/nb_NO/PhoneNumber.php | 22 + .../src/Faker/Provider/ne_NP/Address.php | 129 + .../src/Faker/Provider/ne_NP/Internet.php | 32 + .../faker/src/Faker/Provider/ne_NP/Person.php | 121 + .../src/Faker/Provider/ne_NP/PhoneNumber.php | 19 + .../src/Faker/Provider/nl_BE/Address.php | 124 + .../src/Faker/Provider/nl_BE/Company.php | 13 + .../src/Faker/Provider/nl_BE/Internet.php | 9 + .../src/Faker/Provider/nl_BE/Payment.php | 39 + .../faker/src/Faker/Provider/nl_BE/Person.php | 106 + .../src/Faker/Provider/nl_BE/PhoneNumber.php | 20 + .../faker/src/Faker/Provider/nl_BE/Text.php | 25347 ++++++++++++++++ .../src/Faker/Provider/nl_NL/Address.php | 153 + .../faker/src/Faker/Provider/nl_NL/Color.php | 36 + .../src/Faker/Provider/nl_NL/Company.php | 39 + .../src/Faker/Provider/nl_NL/Internet.php | 9 + .../src/Faker/Provider/nl_NL/Payment.php | 19 + .../faker/src/Faker/Provider/nl_NL/Person.php | 350 + .../src/Faker/Provider/nl_NL/PhoneNumber.php | 39 + .../faker/src/Faker/Provider/nl_NL/Text.php | 3932 +++ .../src/Faker/Provider/pl_PL/Address.php | 210 + .../src/Faker/Provider/pl_PL/Company.php | 80 + .../src/Faker/Provider/pl_PL/Internet.php | 9 + .../src/Faker/Provider/pl_PL/Payment.php | 115 + .../faker/src/Faker/Provider/pl_PL/Person.php | 227 + .../src/Faker/Provider/pl_PL/PhoneNumber.php | 18 + .../faker/src/Faker/Provider/pl_PL/Text.php | 2866 ++ .../src/Faker/Provider/pt_BR/Address.php | 154 + .../src/Faker/Provider/pt_BR/Company.php | 33 + .../src/Faker/Provider/pt_BR/Internet.php | 9 + .../src/Faker/Provider/pt_BR/Payment.php | 72 + .../faker/src/Faker/Provider/pt_BR/Person.php | 133 + .../src/Faker/Provider/pt_BR/PhoneNumber.php | 137 + .../src/Faker/Provider/pt_BR/check_digit.php | 35 + .../src/Faker/Provider/pt_PT/Address.php | 124 + .../src/Faker/Provider/pt_PT/Payment.php | 19 + .../faker/src/Faker/Provider/pt_PT/Person.php | 146 + .../src/Faker/Provider/pt_PT/PhoneNumber.php | 50 + .../src/Faker/Provider/ro_MD/Address.php | 148 + .../src/Faker/Provider/ro_MD/Payment.php | 19 + .../faker/src/Faker/Provider/ro_MD/Person.php | 90 + .../src/Faker/Provider/ro_MD/PhoneNumber.php | 33 + .../faker/src/Faker/Provider/ro_MD/Text.php | 2463 ++ .../src/Faker/Provider/ro_RO/Address.php | 176 + .../src/Faker/Provider/ro_RO/Payment.php | 19 + .../faker/src/Faker/Provider/ro_RO/Person.php | 238 + .../src/Faker/Provider/ro_RO/PhoneNumber.php | 67 + .../faker/src/Faker/Provider/ro_RO/Text.php | 154 + .../src/Faker/Provider/ru_RU/Address.php | 139 + .../faker/src/Faker/Provider/ru_RU/Color.php | 23 + .../src/Faker/Provider/ru_RU/Company.php | 94 + .../src/Faker/Provider/ru_RU/Internet.php | 9 + .../src/Faker/Provider/ru_RU/Payment.php | 811 + .../faker/src/Faker/Provider/ru_RU/Person.php | 157 + .../src/Faker/Provider/ru_RU/PhoneNumber.php | 14 + .../faker/src/Faker/Provider/ru_RU/Text.php | 4550 +++ .../src/Faker/Provider/sk_SK/Address.php | 344 + .../src/Faker/Provider/sk_SK/Company.php | 64 + .../src/Faker/Provider/sk_SK/Internet.php | 9 + .../src/Faker/Provider/sk_SK/Payment.php | 19 + .../faker/src/Faker/Provider/sk_SK/Person.php | 168 + .../src/Faker/Provider/sk_SK/PhoneNumber.php | 15 + .../src/Faker/Provider/sl_SI/Address.php | 107 + .../src/Faker/Provider/sl_SI/Company.php | 14 + .../src/Faker/Provider/sl_SI/Internet.php | 11 + .../src/Faker/Provider/sl_SI/Payment.php | 19 + .../faker/src/Faker/Provider/sl_SI/Person.php | 149 + .../src/Faker/Provider/sl_SI/PhoneNumber.php | 18 + .../src/Faker/Provider/sr_Cyrl_RS/Address.php | 58 + .../src/Faker/Provider/sr_Cyrl_RS/Payment.php | 19 + .../src/Faker/Provider/sr_Cyrl_RS/Person.php | 242 + .../src/Faker/Provider/sr_Latn_RS/Address.php | 58 + .../src/Faker/Provider/sr_Latn_RS/Payment.php | 19 + .../src/Faker/Provider/sr_Latn_RS/Person.php | 213 + .../src/Faker/Provider/sr_RS/Address.php | 58 + .../src/Faker/Provider/sr_RS/Payment.php | 19 + .../faker/src/Faker/Provider/sr_RS/Person.php | 145 + .../src/Faker/Provider/sv_SE/Address.php | 150 + .../src/Faker/Provider/sv_SE/Company.php | 26 + .../src/Faker/Provider/sv_SE/Payment.php | 19 + .../faker/src/Faker/Provider/sv_SE/Person.php | 143 + .../src/Faker/Provider/sv_SE/PhoneNumber.php | 37 + .../src/Faker/Provider/th_TH/Address.php | 101 + .../faker/src/Faker/Provider/th_TH/Color.php | 16 + .../src/Faker/Provider/th_TH/Company.php | 32 + .../src/Faker/Provider/th_TH/Internet.php | 8 + .../src/Faker/Provider/th_TH/Payment.php | 43 + .../src/Faker/Provider/th_TH/PhoneNumber.php | 37 + .../src/Faker/Provider/tr_TR/Address.php | 93 + .../faker/src/Faker/Provider/tr_TR/Color.php | 58 + .../src/Faker/Provider/tr_TR/Company.php | 99 + .../src/Faker/Provider/tr_TR/DateTime.php | 46 + .../src/Faker/Provider/tr_TR/Internet.php | 9 + .../src/Faker/Provider/tr_TR/Payment.php | 19 + .../faker/src/Faker/Provider/tr_TR/Person.php | 112 + .../src/Faker/Provider/tr_TR/PhoneNumber.php | 33 + .../src/Faker/Provider/uk_UA/Address.php | 362 + .../faker/src/Faker/Provider/uk_UA/Color.php | 23 + .../src/Faker/Provider/uk_UA/Company.php | 74 + .../src/Faker/Provider/uk_UA/Internet.php | 9 + .../src/Faker/Provider/uk_UA/Payment.php | 41 + .../faker/src/Faker/Provider/uk_UA/Person.php | 99 + .../src/Faker/Provider/uk_UA/PhoneNumber.php | 51 + .../faker/src/Faker/Provider/uk_UA/Text.php | 4511 +++ .../src/Faker/Provider/vi_VN/Address.php | 170 + .../faker/src/Faker/Provider/vi_VN/Color.php | 36 + .../src/Faker/Provider/vi_VN/Internet.php | 8 + .../faker/src/Faker/Provider/vi_VN/Person.php | 184 + .../src/Faker/Provider/vi_VN/PhoneNumber.php | 61 + .../src/Faker/Provider/zh_CN/Address.php | 149 + .../faker/src/Faker/Provider/zh_CN/Color.php | 66 + .../src/Faker/Provider/zh_CN/Company.php | 234 + .../src/Faker/Provider/zh_CN/DateTime.php | 46 + .../src/Faker/Provider/zh_CN/Internet.php | 24 + .../src/Faker/Provider/zh_CN/Payment.php | 41 + .../faker/src/Faker/Provider/zh_CN/Person.php | 79 + .../src/Faker/Provider/zh_CN/PhoneNumber.php | 23 + .../src/Faker/Provider/zh_TW/Address.php | 419 + .../faker/src/Faker/Provider/zh_TW/Color.php | 66 + .../src/Faker/Provider/zh_TW/Company.php | 265 + .../src/Faker/Provider/zh_TW/DateTime.php | 46 + .../src/Faker/Provider/zh_TW/Internet.php | 16 + .../src/Faker/Provider/zh_TW/Payment.php | 11 + .../faker/src/Faker/Provider/zh_TW/Person.php | 201 + .../src/Faker/Provider/zh_TW/PhoneNumber.php | 19 + .../faker/src/Faker/Provider/zh_TW/Text.php | 898 + .../faker/src/Faker/UniqueGenerator.php | 58 + .../faker/src/Faker/ValidGenerator.php | 65 + vendor/fzaninotto/faker/src/autoload.php | 26 + .../faker/test/Faker/Calculator/IbanTest.php | 306 + .../faker/test/Faker/Calculator/InnTest.php | 51 + .../faker/test/Faker/Calculator/LuhnTest.php | 72 + .../faker/test/Faker/Calculator/TCNoTest.php | 54 + .../faker/test/Faker/DefaultGeneratorTest.php | 28 + .../faker/test/Faker/GeneratorTest.php | 148 + .../faker/test/Faker/Provider/AddressTest.php | 47 + .../faker/test/Faker/Provider/BarcodeTest.php | 46 + .../faker/test/Faker/Provider/BaseTest.php | 572 + .../faker/test/Faker/Provider/BiasedTest.php | 74 + .../faker/test/Faker/Provider/ColorTest.php | 54 + .../faker/test/Faker/Provider/CompanyTest.php | 31 + .../test/Faker/Provider/DateTimeTest.php | 282 + .../test/Faker/Provider/HtmlLoremTest.php | 30 + .../faker/test/Faker/Provider/ImageTest.php | 76 + .../test/Faker/Provider/InternetTest.php | 167 + .../test/Faker/Provider/LocalizationTest.php | 27 + .../faker/test/Faker/Provider/LoremTest.php | 109 + .../test/Faker/Provider/MiscellaneousTest.php | 59 + .../faker/test/Faker/Provider/PaymentTest.php | 209 + .../faker/test/Faker/Provider/PersonTest.php | 87 + .../test/Faker/Provider/PhoneNumberTest.php | 36 + .../Faker/Provider/ProviderOverrideTest.php | 194 + .../faker/test/Faker/Provider/TextTest.php | 55 + .../test/Faker/Provider/UserAgentTest.php | 39 + .../faker/test/Faker/Provider/UuidTest.php | 32 + .../Faker/Provider/ar_JO/InternetTest.php | 33 + .../Faker/Provider/ar_SA/InternetTest.php | 33 + .../test/Faker/Provider/at_AT/PaymentTest.php | 31 + .../test/Faker/Provider/bg_BG/PaymentTest.php | 31 + .../test/Faker/Provider/bn_BD/PersonTest.php | 30 + .../test/Faker/Provider/cs_CZ/PersonTest.php | 47 + .../Faker/Provider/da_DK/InternetTest.php | 33 + .../Faker/Provider/de_AT/InternetTest.php | 33 + .../Faker/Provider/de_AT/PhoneNumberTest.php | 29 + .../test/Faker/Provider/de_CH/AddressTest.php | 70 + .../Faker/Provider/de_CH/InternetTest.php | 36 + .../Faker/Provider/de_CH/PhoneNumberTest.php | 33 + .../Faker/Provider/de_DE/InternetTest.php | 33 + .../test/Faker/Provider/el_GR/TextTest.php | 57 + .../test/Faker/Provider/en_AU/AddressTest.php | 49 + .../test/Faker/Provider/en_CA/AddressTest.php | 69 + .../test/Faker/Provider/en_GB/AddressTest.php | 36 + .../test/Faker/Provider/en_IN/AddressTest.php | 57 + .../test/Faker/Provider/en_NG/AddressTest.php | 57 + .../Faker/Provider/en_NG/InternetTest.php | 33 + .../test/Faker/Provider/en_NG/PersonTest.php | 30 + .../Faker/Provider/en_NG/PhoneNumberTest.php | 26 + .../Faker/Provider/en_NZ/PhoneNumberTest.php | 36 + .../test/Faker/Provider/en_PH/AddressTest.php | 50 + .../test/Faker/Provider/en_SG/AddressTest.php | 27 + .../Faker/Provider/en_SG/PhoneNumberTest.php | 46 + .../test/Faker/Provider/en_UG/AddressTest.php | 53 + .../test/Faker/Provider/en_US/CompanyTest.php | 33 + .../test/Faker/Provider/en_US/PaymentTest.php | 85 + .../test/Faker/Provider/en_US/PersonTest.php | 48 + .../Faker/Provider/en_US/PhoneNumberTest.php | 85 + .../test/Faker/Provider/en_ZA/CompanyTest.php | 27 + .../Faker/Provider/en_ZA/InternetTest.php | 33 + .../test/Faker/Provider/en_ZA/PersonTest.php | 69 + .../Faker/Provider/en_ZA/PhoneNumberTest.php | 66 + .../test/Faker/Provider/es_ES/PaymentTest.php | 61 + .../test/Faker/Provider/es_ES/PersonTest.php | 46 + .../test/Faker/Provider/es_ES/TextTest.php | 27 + .../test/Faker/Provider/es_PE/PersonTest.php | 29 + .../test/Faker/Provider/es_VE/CompanyTest.php | 43 + .../test/Faker/Provider/es_VE/PersonTest.php | 43 + .../Faker/Provider/fi_FI/InternetTest.php | 33 + .../test/Faker/Provider/fi_FI/PersonTest.php | 82 + .../test/Faker/Provider/fr_BE/PaymentTest.php | 30 + .../test/Faker/Provider/fr_CH/AddressTest.php | 70 + .../Faker/Provider/fr_CH/InternetTest.php | 36 + .../Faker/Provider/fr_CH/PhoneNumberTest.php | 33 + .../test/Faker/Provider/fr_FR/AddressTest.php | 33 + .../test/Faker/Provider/fr_FR/CompanyTest.php | 75 + .../test/Faker/Provider/fr_FR/PaymentTest.php | 49 + .../test/Faker/Provider/fr_FR/PersonTest.php | 37 + .../Faker/Provider/fr_FR/PhoneNumberTest.php | 57 + .../test/Faker/Provider/fr_FR/TextTest.php | 57 + .../test/Faker/Provider/id_ID/PersonTest.php | 41 + .../test/Faker/Provider/it_CH/AddressTest.php | 70 + .../Faker/Provider/it_CH/InternetTest.php | 36 + .../Faker/Provider/it_CH/PhoneNumberTest.php | 33 + .../test/Faker/Provider/it_IT/CompanyTest.php | 24 + .../test/Faker/Provider/it_IT/PersonTest.php | 24 + .../Faker/Provider/ja_JP/InternetTest.php | 28 + .../test/Faker/Provider/ja_JP/PersonTest.php | 55 + .../Faker/Provider/ja_JP/PhoneNumberTest.php | 22 + .../test/Faker/Provider/ka_GE/TextTest.php | 57 + .../test/Faker/Provider/kk_KZ/CompanyTest.php | 32 + .../test/Faker/Provider/kk_KZ/PersonTest.php | 30 + .../test/Faker/Provider/kk_KZ/TextTest.php | 57 + .../test/Faker/Provider/ko_KR/TextTest.php | 57 + .../test/Faker/Provider/mn_MN/PersonTest.php | 28 + .../test/Faker/Provider/ms_MY/PersonTest.php | 50 + .../test/Faker/Provider/nl_BE/PaymentTest.php | 30 + .../test/Faker/Provider/nl_BE/PersonTest.php | 54 + .../test/Faker/Provider/nl_NL/CompanyTest.php | 35 + .../test/Faker/Provider/nl_NL/PersonTest.php | 33 + .../test/Faker/Provider/pl_PL/AddressTest.php | 32 + .../test/Faker/Provider/pl_PL/PersonTest.php | 101 + .../test/Faker/Provider/pt_BR/CompanyTest.php | 26 + .../test/Faker/Provider/pt_BR/PersonTest.php | 34 + .../test/Faker/Provider/pt_PT/AddressTest.php | 40 + .../test/Faker/Provider/pt_PT/PersonTest.php | 53 + .../Faker/Provider/pt_PT/PhoneNumberTest.php | 26 + .../test/Faker/Provider/ro_RO/PersonTest.php | 252 + .../Faker/Provider/ro_RO/PhoneNumberTest.php | 32 + .../test/Faker/Provider/ru_RU/CompanyTest.php | 37 + .../test/Faker/Provider/ru_RU/TextTest.php | 57 + .../test/Faker/Provider/sv_SE/PersonTest.php | 61 + .../test/Faker/Provider/tr_TR/CompanyTest.php | 28 + .../test/Faker/Provider/tr_TR/PaymentTest.php | 29 + .../test/Faker/Provider/tr_TR/PersonTest.php | 34 + .../Faker/Provider/tr_TR/PhoneNumberTest.php | 34 + .../test/Faker/Provider/uk_UA/AddressTest.php | 81 + .../test/Faker/Provider/uk_UA/PersonTest.php | 57 + .../Faker/Provider/uk_UA/PhoneNumberTest.php | 36 + .../test/Faker/Provider/zh_TW/CompanyTest.php | 27 + .../test/Faker/Provider/zh_TW/PersonTest.php | 45 + .../test/Faker/Provider/zh_TW/TextTest.php | 79 + vendor/fzaninotto/faker/test/documentor.php | 16 + vendor/fzaninotto/faker/test/test.php | 38 + vendor/guzzlehttp/guzzle/CHANGELOG.md | 1287 + vendor/guzzlehttp/guzzle/LICENSE | 19 + vendor/guzzlehttp/guzzle/README.md | 91 + vendor/guzzlehttp/guzzle/UPGRADING.md | 1203 + vendor/guzzlehttp/guzzle/composer.json | 44 + vendor/guzzlehttp/guzzle/src/Client.php | 422 + .../guzzlehttp/guzzle/src/ClientInterface.php | 84 + .../guzzle/src/Cookie/CookieJar.php | 314 + .../guzzle/src/Cookie/CookieJarInterface.php | 84 + .../guzzle/src/Cookie/FileCookieJar.php | 90 + .../guzzle/src/Cookie/SessionCookieJar.php | 71 + .../guzzle/src/Cookie/SetCookie.php | 403 + .../src/Exception/BadResponseException.php | 27 + .../guzzle/src/Exception/ClientException.php | 7 + .../guzzle/src/Exception/ConnectException.php | 37 + .../guzzle/src/Exception/GuzzleException.php | 13 + .../guzzle/src/Exception/RequestException.php | 217 + .../guzzle/src/Exception/SeekException.php | 27 + .../guzzle/src/Exception/ServerException.php | 7 + .../Exception/TooManyRedirectsException.php | 4 + .../src/Exception/TransferException.php | 4 + .../guzzle/src/Handler/CurlFactory.php | 565 + .../src/Handler/CurlFactoryInterface.php | 27 + .../guzzle/src/Handler/CurlHandler.php | 45 + .../guzzle/src/Handler/CurlMultiHandler.php | 199 + .../guzzle/src/Handler/EasyHandle.php | 92 + .../guzzle/src/Handler/MockHandler.php | 189 + .../guzzlehttp/guzzle/src/Handler/Proxy.php | 55 + .../guzzle/src/Handler/StreamHandler.php | 532 + vendor/guzzlehttp/guzzle/src/HandlerStack.php | 273 + .../guzzle/src/MessageFormatter.php | 180 + vendor/guzzlehttp/guzzle/src/Middleware.php | 255 + vendor/guzzlehttp/guzzle/src/Pool.php | 123 + .../guzzle/src/PrepareBodyMiddleware.php | 106 + .../guzzle/src/RedirectMiddleware.php | 237 + .../guzzlehttp/guzzle/src/RequestOptions.php | 255 + .../guzzlehttp/guzzle/src/RetryMiddleware.php | 112 + .../guzzlehttp/guzzle/src/TransferStats.php | 126 + vendor/guzzlehttp/guzzle/src/UriTemplate.php | 237 + vendor/guzzlehttp/guzzle/src/functions.php | 333 + .../guzzle/src/functions_include.php | 6 + vendor/guzzlehttp/promises/CHANGELOG.md | 65 + vendor/guzzlehttp/promises/LICENSE | 19 + vendor/guzzlehttp/promises/Makefile | 13 + vendor/guzzlehttp/promises/README.md | 504 + vendor/guzzlehttp/promises/composer.json | 34 + .../promises/src/AggregateException.php | 16 + .../promises/src/CancellationException.php | 9 + vendor/guzzlehttp/promises/src/Coroutine.php | 151 + .../guzzlehttp/promises/src/EachPromise.php | 229 + .../promises/src/FulfilledPromise.php | 82 + vendor/guzzlehttp/promises/src/Promise.php | 280 + .../promises/src/PromiseInterface.php | 93 + .../promises/src/PromisorInterface.php | 15 + .../promises/src/RejectedPromise.php | 87 + .../promises/src/RejectionException.php | 47 + vendor/guzzlehttp/promises/src/TaskQueue.php | 66 + .../promises/src/TaskQueueInterface.php | 25 + vendor/guzzlehttp/promises/src/functions.php | 457 + .../promises/src/functions_include.php | 6 + vendor/guzzlehttp/psr7/.editorconfig | 9 + vendor/guzzlehttp/psr7/CHANGELOG.md | 225 + vendor/guzzlehttp/psr7/LICENSE | 19 + vendor/guzzlehttp/psr7/README.md | 745 + vendor/guzzlehttp/psr7/composer.json | 45 + vendor/guzzlehttp/psr7/src/AppendStream.php | 241 + vendor/guzzlehttp/psr7/src/BufferStream.php | 137 + vendor/guzzlehttp/psr7/src/CachingStream.php | 138 + vendor/guzzlehttp/psr7/src/DroppingStream.php | 42 + vendor/guzzlehttp/psr7/src/FnStream.php | 158 + vendor/guzzlehttp/psr7/src/InflateStream.php | 52 + vendor/guzzlehttp/psr7/src/LazyOpenStream.php | 39 + vendor/guzzlehttp/psr7/src/LimitStream.php | 155 + vendor/guzzlehttp/psr7/src/MessageTrait.php | 183 + .../guzzlehttp/psr7/src/MultipartStream.php | 153 + vendor/guzzlehttp/psr7/src/NoSeekStream.php | 22 + vendor/guzzlehttp/psr7/src/PumpStream.php | 165 + vendor/guzzlehttp/psr7/src/Request.php | 142 + vendor/guzzlehttp/psr7/src/Response.php | 136 + vendor/guzzlehttp/psr7/src/Rfc7230.php | 18 + vendor/guzzlehttp/psr7/src/ServerRequest.php | 376 + vendor/guzzlehttp/psr7/src/Stream.php | 270 + .../psr7/src/StreamDecoratorTrait.php | 149 + vendor/guzzlehttp/psr7/src/StreamWrapper.php | 161 + vendor/guzzlehttp/psr7/src/UploadedFile.php | 316 + vendor/guzzlehttp/psr7/src/Uri.php | 738 + vendor/guzzlehttp/psr7/src/UriNormalizer.php | 216 + vendor/guzzlehttp/psr7/src/UriResolver.php | 219 + vendor/guzzlehttp/psr7/src/functions.php | 898 + .../guzzlehttp/psr7/src/functions_include.php | 6 + vendor/hamcrest/hamcrest-php/.coveralls.yml | 1 + vendor/hamcrest/hamcrest-php/.gitignore | 1 + vendor/hamcrest/hamcrest-php/.gush.yml | 7 + vendor/hamcrest/hamcrest-php/.travis.yml | 24 + vendor/hamcrest/hamcrest-php/CHANGES.txt | 167 + vendor/hamcrest/hamcrest-php/LICENSE.txt | 27 + vendor/hamcrest/hamcrest-php/README.md | 53 + vendor/hamcrest/hamcrest-php/TODO.txt | 22 + vendor/hamcrest/hamcrest-php/composer.json | 38 + vendor/hamcrest/hamcrest-php/composer.lock | 1493 + .../hamcrest-php/generator/FactoryCall.php | 41 + .../hamcrest-php/generator/FactoryClass.php | 72 + .../hamcrest-php/generator/FactoryFile.php | 122 + .../generator/FactoryGenerator.php | 115 + .../hamcrest-php/generator/FactoryMethod.php | 231 + .../generator/FactoryParameter.php | 69 + .../generator/GlobalFunctionFile.php | 42 + .../generator/StaticMethodFile.php | 38 + .../generator/parts/file_header.txt | 7 + .../generator/parts/functions_footer.txt | 0 .../generator/parts/functions_header.txt | 24 + .../generator/parts/functions_imports.txt | 0 .../generator/parts/matchers_footer.txt | 1 + .../generator/parts/matchers_header.txt | 7 + .../generator/parts/matchers_imports.txt | 2 + .../hamcrest/hamcrest-php/generator/run.php | 37 + .../hamcrest-php/hamcrest/Hamcrest.php | 805 + .../hamcrest/Hamcrest/Arrays/IsArray.php | 118 + .../Hamcrest/Arrays/IsArrayContaining.php | 63 + .../Arrays/IsArrayContainingInAnyOrder.php | 59 + .../Arrays/IsArrayContainingInOrder.php | 57 + .../Hamcrest/Arrays/IsArrayContainingKey.php | 75 + .../Arrays/IsArrayContainingKeyValuePair.php | 80 + .../Hamcrest/Arrays/IsArrayWithSize.php | 73 + .../hamcrest/Hamcrest/Arrays/MatchingOnce.php | 69 + .../Hamcrest/Arrays/SeriesMatchingOnce.php | 75 + .../hamcrest/Hamcrest/AssertionError.php | 10 + .../hamcrest/Hamcrest/BaseDescription.php | 132 + .../hamcrest/Hamcrest/BaseMatcher.php | 25 + .../Collection/IsEmptyTraversable.php | 71 + .../Collection/IsTraversableWithSize.php | 47 + .../hamcrest/Hamcrest/Core/AllOf.php | 59 + .../hamcrest/Hamcrest/Core/AnyOf.php | 58 + .../Hamcrest/Core/CombinableMatcher.php | 78 + .../hamcrest/Hamcrest/Core/DescribedAs.php | 68 + .../hamcrest/Hamcrest/Core/Every.php | 56 + .../hamcrest/Hamcrest/Core/HasToString.php | 56 + .../hamcrest/Hamcrest/Core/Is.php | 57 + .../hamcrest/Hamcrest/Core/IsAnything.php | 45 + .../Hamcrest/Core/IsCollectionContaining.php | 93 + .../hamcrest/Hamcrest/Core/IsEqual.php | 44 + .../hamcrest/Hamcrest/Core/IsIdentical.php | 38 + .../hamcrest/Hamcrest/Core/IsInstanceOf.php | 67 + .../hamcrest/Hamcrest/Core/IsNot.php | 44 + .../hamcrest/Hamcrest/Core/IsNull.php | 56 + .../hamcrest/Hamcrest/Core/IsSame.php | 51 + .../hamcrest/Hamcrest/Core/IsTypeOf.php | 71 + .../hamcrest/Hamcrest/Core/Set.php | 95 + .../Hamcrest/Core/ShortcutCombination.php | 43 + .../hamcrest/Hamcrest/Description.php | 70 + .../hamcrest/Hamcrest/DiagnosingMatcher.php | 25 + .../hamcrest/Hamcrest/FeatureMatcher.php | 67 + .../Hamcrest/Internal/SelfDescribingValue.php | 27 + .../hamcrest/Hamcrest/Matcher.php | 50 + .../hamcrest/Hamcrest/MatcherAssert.php | 118 + .../hamcrest/Hamcrest/Matchers.php | 713 + .../hamcrest/Hamcrest/NullDescription.php | 43 + .../hamcrest/Hamcrest/Number/IsCloseTo.php | 67 + .../Hamcrest/Number/OrderingComparison.php | 132 + .../hamcrest/Hamcrest/SelfDescribing.php | 23 + .../hamcrest/Hamcrest/StringDescription.php | 57 + .../hamcrest/Hamcrest/Text/IsEmptyString.php | 85 + .../Hamcrest/Text/IsEqualIgnoringCase.php | 52 + .../Text/IsEqualIgnoringWhiteSpace.php | 66 + .../hamcrest/Hamcrest/Text/MatchesPattern.php | 40 + .../hamcrest/Hamcrest/Text/StringContains.php | 45 + .../Text/StringContainsIgnoringCase.php | 40 + .../Hamcrest/Text/StringContainsInOrder.php | 66 + .../hamcrest/Hamcrest/Text/StringEndsWith.php | 40 + .../Hamcrest/Text/StringStartsWith.php | 40 + .../Hamcrest/Text/SubstringMatcher.php | 45 + .../hamcrest/Hamcrest/Type/IsArray.php | 32 + .../hamcrest/Hamcrest/Type/IsBoolean.php | 32 + .../hamcrest/Hamcrest/Type/IsCallable.php | 37 + .../hamcrest/Hamcrest/Type/IsDouble.php | 34 + .../hamcrest/Hamcrest/Type/IsInteger.php | 32 + .../hamcrest/Hamcrest/Type/IsNumeric.php | 54 + .../hamcrest/Hamcrest/Type/IsObject.php | 32 + .../hamcrest/Hamcrest/Type/IsResource.php | 32 + .../hamcrest/Hamcrest/Type/IsScalar.php | 34 + .../hamcrest/Hamcrest/Type/IsString.php | 32 + .../Hamcrest/TypeSafeDiagnosingMatcher.php | 29 + .../hamcrest/Hamcrest/TypeSafeMatcher.php | 107 + .../hamcrest-php/hamcrest/Hamcrest/Util.php | 76 + .../hamcrest/Hamcrest/Xml/HasXPath.php | 195 + .../tests/Hamcrest/AbstractMatcherTest.php | 66 + .../Array/IsArrayContainingInAnyOrderTest.php | 54 + .../Array/IsArrayContainingInOrderTest.php | 44 + .../Array/IsArrayContainingKeyTest.php | 62 + .../IsArrayContainingKeyValuePairTest.php | 36 + .../Hamcrest/Array/IsArrayContainingTest.php | 50 + .../tests/Hamcrest/Array/IsArrayTest.php | 89 + .../Hamcrest/Array/IsArrayWithSizeTest.php | 37 + .../tests/Hamcrest/BaseMatcherTest.php | 23 + .../Collection/IsEmptyTraversableTest.php | 77 + .../Collection/IsTraversableWithSizeTest.php | 57 + .../tests/Hamcrest/Core/AllOfTest.php | 56 + .../tests/Hamcrest/Core/AnyOfTest.php | 79 + .../Hamcrest/Core/CombinableMatcherTest.php | 59 + .../tests/Hamcrest/Core/DescribedAsTest.php | 36 + .../tests/Hamcrest/Core/EveryTest.php | 30 + .../tests/Hamcrest/Core/HasToStringTest.php | 108 + .../tests/Hamcrest/Core/IsAnythingTest.php | 29 + .../Core/IsCollectionContainingTest.php | 91 + .../tests/Hamcrest/Core/IsEqualTest.php | 102 + .../tests/Hamcrest/Core/IsIdenticalTest.php | 30 + .../tests/Hamcrest/Core/IsInstanceOfTest.php | 51 + .../tests/Hamcrest/Core/IsNotTest.php | 31 + .../tests/Hamcrest/Core/IsNullTest.php | 20 + .../tests/Hamcrest/Core/IsSameTest.php | 30 + .../tests/Hamcrest/Core/IsTest.php | 33 + .../tests/Hamcrest/Core/IsTypeOfTest.php | 45 + .../tests/Hamcrest/Core/SampleBaseClass.php | 18 + .../tests/Hamcrest/Core/SampleSubClass.php | 6 + .../tests/Hamcrest/Core/SetTest.php | 116 + .../tests/Hamcrest/FeatureMatcherTest.php | 73 + .../tests/Hamcrest/MatcherAssertTest.php | 190 + .../tests/Hamcrest/Number/IsCloseToTest.php | 27 + .../Number/OrderingComparisonTest.php | 41 + .../tests/Hamcrest/StringDescriptionTest.php | 160 + .../tests/Hamcrest/Text/IsEmptyStringTest.php | 86 + .../Hamcrest/Text/IsEqualIgnoringCaseTest.php | 40 + .../Text/IsEqualIgnoringWhiteSpaceTest.php | 51 + .../Hamcrest/Text/MatchesPatternTest.php | 30 + .../Text/StringContainsIgnoringCaseTest.php | 80 + .../Text/StringContainsInOrderTest.php | 42 + .../Hamcrest/Text/StringContainsTest.php | 86 + .../Hamcrest/Text/StringEndsWithTest.php | 62 + .../Hamcrest/Text/StringStartsWithTest.php | 62 + .../tests/Hamcrest/Type/IsArrayTest.php | 35 + .../tests/Hamcrest/Type/IsBooleanTest.php | 35 + .../tests/Hamcrest/Type/IsCallableTest.php | 103 + .../tests/Hamcrest/Type/IsDoubleTest.php | 35 + .../tests/Hamcrest/Type/IsIntegerTest.php | 36 + .../tests/Hamcrest/Type/IsNumericTest.php | 53 + .../tests/Hamcrest/Type/IsObjectTest.php | 34 + .../tests/Hamcrest/Type/IsResourceTest.php | 34 + .../tests/Hamcrest/Type/IsScalarTest.php | 39 + .../tests/Hamcrest/Type/IsStringTest.php | 35 + .../hamcrest-php/tests/Hamcrest/UtilTest.php | 80 + .../tests/Hamcrest/Xml/HasXPathTest.php | 198 + .../hamcrest/hamcrest-php/tests/bootstrap.php | 11 + .../hamcrest-php/tests/phpunit.xml.dist | 22 + vendor/hassankhan/config/.scrutinizer.yml | 35 + vendor/hassankhan/config/CHANGELOG.md | 133 + vendor/hassankhan/config/CONTRIBUTING.md | 32 + vendor/hassankhan/config/LICENSE.md | 8 + vendor/hassankhan/config/composer.json | 36 + .../hassankhan/config/src/AbstractConfig.php | 265 + vendor/hassankhan/config/src/Config.php | 177 + .../hassankhan/config/src/ConfigInterface.php | 55 + .../hassankhan/config/src/ErrorException.php | 7 + vendor/hassankhan/config/src/Exception.php | 7 + .../src/Exception/EmptyDirectoryException.php | 9 + .../src/Exception/FileNotFoundException.php | 9 + .../config/src/Exception/ParseException.php | 20 + .../Exception/UnsupportedFormatException.php | 9 + .../src/FileParser/AbstractFileParser.php | 35 + .../src/FileParser/FileParserInterface.php | 31 + .../hassankhan/config/src/FileParser/Ini.php | 43 + .../hassankhan/config/src/FileParser/Json.php | 52 + .../hassankhan/config/src/FileParser/Php.php | 61 + .../hassankhan/config/src/FileParser/Xml.php | 55 + .../hassankhan/config/src/FileParser/Yaml.php | 49 + vendor/laravel/framework/LICENSE.md | 21 + vendor/laravel/framework/README.md | 45 + vendor/laravel/framework/composer.json | 143 + .../Auth/Access/AuthorizationException.php | 10 + .../src/Illuminate/Auth/Access/Gate.php | 676 + .../Auth/Access/HandlesAuthorization.php | 30 + .../src/Illuminate/Auth/Access/Response.php | 44 + .../src/Illuminate/Auth/AuthManager.php | 294 + .../Illuminate/Auth/AuthServiceProvider.php | 90 + .../src/Illuminate/Auth/Authenticatable.php | 78 + .../Auth/AuthenticationException.php | 58 + .../Auth/Console/AuthMakeCommand.php | 120 + .../Auth/Console/ClearResetsCommand.php | 34 + .../make/controllers/HomeController.stub | 28 + .../Auth/Console/stubs/make/routes.stub | 4 + .../Console/stubs/make/views/auth/login.stub | 73 + .../make/views/auth/passwords/email.stub | 47 + .../make/views/auth/passwords/reset.stub | 65 + .../stubs/make/views/auth/register.stub | 77 + .../Console/stubs/make/views/auth/verify.stub | 24 + .../Auth/Console/stubs/make/views/home.stub | 23 + .../Console/stubs/make/views/layouts/app.stub | 80 + .../Illuminate/Auth/CreatesUserProviders.php | 94 + .../Illuminate/Auth/DatabaseUserProvider.php | 159 + .../Illuminate/Auth/EloquentUserProvider.php | 202 + .../src/Illuminate/Auth/Events/Attempting.php | 42 + .../Illuminate/Auth/Events/Authenticated.php | 37 + .../src/Illuminate/Auth/Events/Failed.php | 42 + .../src/Illuminate/Auth/Events/Lockout.php | 26 + .../src/Illuminate/Auth/Events/Login.php | 46 + .../src/Illuminate/Auth/Events/Logout.php | 37 + .../Illuminate/Auth/Events/PasswordReset.php | 28 + .../src/Illuminate/Auth/Events/Registered.php | 28 + .../src/Illuminate/Auth/Events/Verified.php | 28 + .../src/Illuminate/Auth/GenericUser.php | 134 + .../src/Illuminate/Auth/GuardHelpers.php | 118 + .../SendEmailVerificationNotification.php | 22 + .../Auth/Middleware/Authenticate.php | 82 + .../Middleware/AuthenticateWithBasicAuth.php | 41 + .../Illuminate/Auth/Middleware/Authorize.php | 88 + .../Auth/Middleware/EnsureEmailIsVerified.php | 30 + .../src/Illuminate/Auth/MustVerifyEmail.php | 38 + .../Auth/Notifications/ResetPassword.php | 76 + .../Auth/Notifications/VerifyEmail.php | 76 + .../Auth/Passwords/CanResetPassword.php | 29 + .../Passwords/DatabaseTokenRepository.php | 204 + .../Auth/Passwords/PasswordBroker.php | 242 + .../Auth/Passwords/PasswordBrokerManager.php | 147 + .../PasswordResetServiceProvider.php | 51 + .../Passwords/TokenRepositoryInterface.php | 40 + .../src/Illuminate/Auth/Recaller.php | 88 + .../src/Illuminate/Auth/RequestGuard.php | 87 + .../src/Illuminate/Auth/SessionGuard.php | 783 + .../src/Illuminate/Auth/TokenGuard.php | 135 + .../src/Illuminate/Auth/composer.json | 42 + .../Broadcasting/BroadcastController.php | 21 + .../Broadcasting/BroadcastEvent.php | 111 + .../Broadcasting/BroadcastException.php | 10 + .../Broadcasting/BroadcastManager.php | 321 + .../Broadcasting/BroadcastServiceProvider.php | 51 + .../Broadcasting/Broadcasters/Broadcaster.php | 263 + .../Broadcasters/LogBroadcaster.php | 54 + .../Broadcasters/NullBroadcaster.php | 30 + .../Broadcasters/PusherBroadcaster.php | 131 + .../Broadcasters/RedisBroadcaster.php | 104 + .../src/Illuminate/Broadcasting/Channel.php | 34 + .../Broadcasting/InteractsWithSockets.php | 39 + .../Broadcasting/PendingBroadcast.php | 59 + .../Broadcasting/PresenceChannel.php | 17 + .../Broadcasting/PrivateChannel.php | 17 + .../src/Illuminate/Broadcasting/composer.json | 41 + .../src/Illuminate/Bus/BusServiceProvider.php | 54 + .../src/Illuminate/Bus/Dispatcher.php | 212 + .../src/Illuminate/Bus/Queueable.php | 150 + .../src/Illuminate/Bus/composer.json | 36 + .../src/Illuminate/Cache/ApcStore.php | 132 + .../src/Illuminate/Cache/ApcWrapper.php | 92 + .../src/Illuminate/Cache/ArrayStore.php | 115 + .../src/Illuminate/Cache/CacheManager.php | 325 + .../Illuminate/Cache/CacheServiceProvider.php | 47 + .../Cache/Console/CacheTableCommand.php | 81 + .../Illuminate/Cache/Console/ClearCommand.php | 145 + .../Cache/Console/ForgetCommand.php | 57 + .../Illuminate/Cache/Console/stubs/cache.stub | 32 + .../src/Illuminate/Cache/DatabaseStore.php | 292 + .../Illuminate/Cache/Events/CacheEvent.php | 46 + .../src/Illuminate/Cache/Events/CacheHit.php | 28 + .../Illuminate/Cache/Events/CacheMissed.php | 8 + .../Illuminate/Cache/Events/KeyForgotten.php | 8 + .../Illuminate/Cache/Events/KeyWritten.php | 37 + .../src/Illuminate/Cache/FileStore.php | 262 + .../framework/src/Illuminate/Cache/Lock.php | 102 + .../Illuminate/Cache/MemcachedConnector.php | 87 + .../src/Illuminate/Cache/MemcachedLock.php | 50 + .../src/Illuminate/Cache/MemcachedStore.php | 274 + .../src/Illuminate/Cache/NullStore.php | 108 + .../src/Illuminate/Cache/RateLimiter.php | 133 + .../src/Illuminate/Cache/RedisLock.php | 54 + .../src/Illuminate/Cache/RedisStore.php | 289 + .../src/Illuminate/Cache/RedisTaggedCache.php | 194 + .../src/Illuminate/Cache/Repository.php | 599 + .../Cache/RetrievesMultipleKeys.php | 39 + .../framework/src/Illuminate/Cache/TagSet.php | 110 + .../src/Illuminate/Cache/TaggableStore.php | 17 + .../src/Illuminate/Cache/TaggedCache.php | 97 + .../src/Illuminate/Cache/composer.json | 40 + .../src/Illuminate/Config/Repository.php | 179 + .../src/Illuminate/Config/composer.json | 35 + .../src/Illuminate/Console/Application.php | 296 + .../src/Illuminate/Console/Command.php | 604 + .../Illuminate/Console/ConfirmableTrait.php | 54 + .../Console/DetectsApplicationNamespace.php | 18 + .../Console/Events/ArtisanStarting.php | 24 + .../Console/Events/CommandFinished.php | 54 + .../Console/Events/CommandStarting.php | 45 + .../Illuminate/Console/GeneratorCommand.php | 253 + .../src/Illuminate/Console/OutputStyle.php | 71 + .../src/Illuminate/Console/Parser.php | 148 + .../Console/Scheduling/CacheEventMutex.php | 81 + .../Scheduling/CacheSchedulingMutex.php | 75 + .../Console/Scheduling/CallbackEvent.php | 166 + .../Console/Scheduling/CommandBuilder.php | 71 + .../Illuminate/Console/Scheduling/Event.php | 745 + .../Console/Scheduling/EventMutex.php | 30 + .../Console/Scheduling/ManagesFrequencies.php | 411 + .../Console/Scheduling/Schedule.php | 199 + .../Scheduling/ScheduleFinishCommand.php | 61 + .../Console/Scheduling/ScheduleRunCommand.php | 115 + .../Console/Scheduling/SchedulingMutex.php | 26 + .../src/Illuminate/Console/composer.json | 41 + .../src/Illuminate/Container/BoundMethod.php | 178 + .../src/Illuminate/Container/Container.php | 1272 + .../Container/ContextualBindingBuilder.php | 69 + .../Container/EntryNotFoundException.php | 11 + .../src/Illuminate/Container/composer.json | 36 + .../Contracts/Auth/Access/Authorizable.php | 15 + .../Illuminate/Contracts/Auth/Access/Gate.php | 129 + .../Contracts/Auth/Authenticatable.php | 49 + .../Contracts/Auth/CanResetPassword.php | 21 + .../src/Illuminate/Contracts/Auth/Factory.php | 22 + .../src/Illuminate/Contracts/Auth/Guard.php | 50 + .../Contracts/Auth/MustVerifyEmail.php | 27 + .../Contracts/Auth/PasswordBroker.php | 76 + .../Contracts/Auth/PasswordBrokerFactory.php | 14 + .../Contracts/Auth/StatefulGuard.php | 63 + .../Contracts/Auth/SupportsBasicAuth.php | 24 + .../Contracts/Auth/UserProvider.php | 49 + .../Contracts/Broadcasting/Broadcaster.php | 33 + .../Contracts/Broadcasting/Factory.php | 14 + .../Broadcasting/ShouldBroadcast.php | 13 + .../Broadcasting/ShouldBroadcastNow.php | 8 + .../Illuminate/Contracts/Bus/Dispatcher.php | 55 + .../Contracts/Bus/QueueingDispatcher.php | 14 + .../Illuminate/Contracts/Cache/Factory.php | 14 + .../src/Illuminate/Contracts/Cache/Lock.php | 30 + .../Contracts/Cache/LockProvider.php | 15 + .../Contracts/Cache/LockTimeoutException.php | 10 + .../Illuminate/Contracts/Cache/Repository.php | 125 + .../src/Illuminate/Contracts/Cache/Store.php | 92 + .../Contracts/Config/Repository.php | 57 + .../Contracts/Console/Application.php | 23 + .../Illuminate/Contracts/Console/Kernel.php | 48 + .../Container/BindingResolutionException.php | 11 + .../Contracts/Container/Container.php | 153 + .../Container/ContextualBindingBuilder.php | 22 + .../Illuminate/Contracts/Cookie/Factory.php | 47 + .../Contracts/Cookie/QueueingFactory.php | 28 + .../Contracts/Database/ModelIdentifier.php | 53 + .../Contracts/Debug/ExceptionHandler.php | 34 + .../Contracts/Encryption/DecryptException.php | 10 + .../Contracts/Encryption/EncryptException.php | 10 + .../Contracts/Encryption/Encrypter.php | 24 + .../Contracts/Events/Dispatcher.php | 82 + .../Illuminate/Contracts/Filesystem/Cloud.php | 14 + .../Contracts/Filesystem/Factory.php | 14 + .../Filesystem/FileExistsException.php | 10 + .../Filesystem/FileNotFoundException.php | 10 + .../Contracts/Filesystem/Filesystem.php | 198 + .../Contracts/Foundation/Application.php | 112 + .../Illuminate/Contracts/Hashing/Hasher.php | 42 + .../src/Illuminate/Contracts/Http/Kernel.php | 37 + .../Illuminate/Contracts/Mail/MailQueue.php | 25 + .../Illuminate/Contracts/Mail/Mailable.php | 33 + .../src/Illuminate/Contracts/Mail/Mailer.php | 48 + .../Contracts/Notifications/Dispatcher.php | 24 + .../Contracts/Notifications/Factory.php | 32 + .../Pagination/LengthAwarePaginator.php | 29 + .../Contracts/Pagination/Paginator.php | 117 + .../src/Illuminate/Contracts/Pipeline/Hub.php | 15 + .../Contracts/Pipeline/Pipeline.php | 40 + .../Queue/EntityNotFoundException.php | 22 + .../Contracts/Queue/EntityResolver.php | 15 + .../Illuminate/Contracts/Queue/Factory.php | 14 + .../src/Illuminate/Contracts/Queue/Job.php | 129 + .../Illuminate/Contracts/Queue/Monitor.php | 30 + .../src/Illuminate/Contracts/Queue/Queue.php | 99 + .../Contracts/Queue/QueueableCollection.php | 34 + .../Contracts/Queue/QueueableEntity.php | 27 + .../Contracts/Queue/ShouldQueue.php | 8 + .../Illuminate/Contracts/Redis/Connection.php | 35 + .../Illuminate/Contracts/Redis/Factory.php | 14 + .../Redis/LimiterTimeoutException.php | 10 + .../Contracts/Routing/BindingRegistrar.php | 23 + .../Contracts/Routing/Registrar.php | 105 + .../Contracts/Routing/ResponseFactory.php | 146 + .../Contracts/Routing/UrlGenerator.php | 71 + .../Contracts/Routing/UrlRoutable.php | 28 + .../Illuminate/Contracts/Session/Session.php | 165 + .../Contracts/Support/Arrayable.php | 13 + .../Illuminate/Contracts/Support/Htmlable.php | 13 + .../Illuminate/Contracts/Support/Jsonable.php | 14 + .../Contracts/Support/MessageBag.php | 107 + .../Contracts/Support/MessageProvider.php | 13 + .../Contracts/Support/Renderable.php | 13 + .../Contracts/Support/Responsable.php | 14 + .../Translation/HasLocalePreference.php | 13 + .../Contracts/Translation/Loader.php | 40 + .../Contracts/Translation/Translator.php | 42 + .../Contracts/Validation/Factory.php | 46 + .../Contracts/Validation/ImplicitRule.php | 8 + .../Illuminate/Contracts/Validation/Rule.php | 22 + .../Validation/ValidatesWhenResolved.php | 13 + .../Contracts/Validation/Validator.php | 54 + .../src/Illuminate/Contracts/View/Engine.php | 15 + .../src/Illuminate/Contracts/View/Factory.php | 79 + .../src/Illuminate/Contracts/View/View.php | 24 + .../src/Illuminate/Contracts/composer.json | 35 + .../src/Illuminate/Cookie/CookieJar.php | 194 + .../Cookie/CookieServiceProvider.php | 24 + .../Middleware/AddQueuedCookiesToResponse.php | 45 + .../Cookie/Middleware/EncryptCookies.php | 183 + .../src/Illuminate/Cookie/composer.json | 37 + .../Illuminate/Database/Capsule/Manager.php | 201 + .../Database/Concerns/BuildsQueries.php | 161 + .../Database/Concerns/ManagesTransactions.php | 242 + .../src/Illuminate/Database/Connection.php | 1263 + .../Database/ConnectionInterface.php | 162 + .../Database/ConnectionResolver.php | 92 + .../Database/ConnectionResolverInterface.php | 29 + .../Database/Connectors/ConnectionFactory.php | 285 + .../Database/Connectors/Connector.php | 139 + .../Connectors/ConnectorInterface.php | 14 + .../Database/Connectors/MySqlConnector.php | 185 + .../Database/Connectors/PostgresConnector.php | 176 + .../Database/Connectors/SQLiteConnector.php | 39 + .../Connectors/SqlServerConnector.php | 185 + .../Console/Factories/FactoryMakeCommand.php | 84 + .../Console/Factories/stubs/factory.stub | 9 + .../Console/Migrations/BaseCommand.php | 51 + .../Console/Migrations/FreshCommand.php | 139 + .../Console/Migrations/InstallCommand.php | 70 + .../Console/Migrations/MigrateCommand.php | 97 + .../Console/Migrations/MigrateMakeCommand.php | 140 + .../Console/Migrations/RefreshCommand.php | 159 + .../Console/Migrations/ResetCommand.php | 91 + .../Console/Migrations/RollbackCommand.php | 89 + .../Console/Migrations/StatusCommand.php | 113 + .../Console/Migrations/TableGuesser.php | 37 + .../Database/Console/Seeds/SeedCommand.php | 108 + .../Console/Seeds/SeederMakeCommand.php | 96 + .../Database/Console/Seeds/stubs/seeder.stub | 16 + .../Illuminate/Database/DatabaseManager.php | 329 + .../Database/DatabaseServiceProvider.php | 99 + .../Illuminate/Database/DetectsDeadlocks.php | 32 + .../Database/DetectsLostConnections.php | 42 + .../Illuminate/Database/Eloquent/Builder.php | 1363 + .../Database/Eloquent/Collection.php | 582 + .../Eloquent/Concerns/GuardsAttributes.php | 193 + .../Eloquent/Concerns/HasAttributes.php | 1238 + .../Database/Eloquent/Concerns/HasEvents.php | 354 + .../Eloquent/Concerns/HasGlobalScopes.php | 71 + .../Eloquent/Concerns/HasRelationships.php | 771 + .../Eloquent/Concerns/HasTimestamps.php | 126 + .../Eloquent/Concerns/HidesAttributes.php | 126 + .../Concerns/QueriesRelationships.php | 327 + .../Illuminate/Database/Eloquent/Factory.php | 326 + .../Database/Eloquent/FactoryBuilder.php | 448 + .../Eloquent/JsonEncodingException.php | 35 + .../Eloquent/MassAssignmentException.php | 10 + .../Illuminate/Database/Eloquent/Model.php | 1642 + .../Eloquent/ModelNotFoundException.php | 66 + .../Database/Eloquent/QueueEntityResolver.php | 29 + .../Eloquent/RelationNotFoundException.php | 41 + .../Database/Eloquent/Relations/BelongsTo.php | 361 + .../Eloquent/Relations/BelongsToMany.php | 1083 + .../Eloquent/Relations/Concerns/AsPivot.php | 295 + .../Concerns/InteractsWithPivotTable.php | 565 + .../Concerns/SupportsDefaultModels.php | 63 + .../Database/Eloquent/Relations/HasMany.php | 47 + .../Eloquent/Relations/HasManyThrough.php | 635 + .../Database/Eloquent/Relations/HasOne.php | 64 + .../Eloquent/Relations/HasOneOrMany.php | 435 + .../Database/Eloquent/Relations/MorphMany.php | 47 + .../Database/Eloquent/Relations/MorphOne.php | 64 + .../Eloquent/Relations/MorphOneOrMany.php | 127 + .../Eloquent/Relations/MorphPivot.php | 150 + .../Database/Eloquent/Relations/MorphTo.php | 298 + .../Eloquent/Relations/MorphToMany.php | 194 + .../Database/Eloquent/Relations/Pivot.php | 18 + .../Database/Eloquent/Relations/Relation.php | 404 + .../Illuminate/Database/Eloquent/Scope.php | 15 + .../Database/Eloquent/SoftDeletes.php | 171 + .../Database/Eloquent/SoftDeletingScope.php | 131 + .../Database/Events/ConnectionEvent.php | 32 + .../Database/Events/QueryExecuted.php | 59 + .../Database/Events/StatementPrepared.php | 33 + .../Database/Events/TransactionBeginning.php | 8 + .../Database/Events/TransactionCommitted.php | 8 + .../Database/Events/TransactionRolledBack.php | 8 + .../src/Illuminate/Database/Grammar.php | 223 + .../Database/MigrationServiceProvider.php | 87 + .../DatabaseMigrationRepository.php | 212 + .../Database/Migrations/Migration.php | 30 + .../Database/Migrations/MigrationCreator.php | 204 + .../MigrationRepositoryInterface.php | 81 + .../Database/Migrations/Migrator.php | 594 + .../Database/Migrations/stubs/blank.stub | 28 + .../Database/Migrations/stubs/create.stub | 31 + .../Database/Migrations/stubs/update.stub | 32 + .../Illuminate/Database/MySqlConnection.php | 84 + .../Database/PostgresConnection.php | 66 + .../src/Illuminate/Database/Query/Builder.php | 2956 ++ .../Illuminate/Database/Query/Expression.php | 44 + .../Database/Query/Grammars/Grammar.php | 1128 + .../Database/Query/Grammars/MySqlGrammar.php | 331 + .../Query/Grammars/PostgresGrammar.php | 401 + .../Database/Query/Grammars/SQLiteGrammar.php | 312 + .../Query/Grammars/SqlServerGrammar.php | 515 + .../Illuminate/Database/Query/JoinClause.php | 110 + .../Database/Query/JsonExpression.php | 51 + .../Query/Processors/MySqlProcessor.php | 19 + .../Query/Processors/PostgresProcessor.php | 41 + .../Database/Query/Processors/Processor.php | 49 + .../Query/Processors/SQLiteProcessor.php | 19 + .../Query/Processors/SqlServerProcessor.php | 70 + .../Illuminate/Database/QueryException.php | 78 + .../src/Illuminate/Database/README.md | 69 + .../Illuminate/Database/SQLiteConnection.php | 100 + .../Illuminate/Database/Schema/Blueprint.php | 1372 + .../Illuminate/Database/Schema/Builder.php | 320 + .../Database/Schema/ColumnDefinition.php | 31 + .../Database/Schema/Grammars/ChangeColumn.php | 211 + .../Database/Schema/Grammars/Grammar.php | 272 + .../Database/Schema/Grammars/MySqlGrammar.php | 1018 + .../Schema/Grammars/PostgresGrammar.php | 900 + .../Database/Schema/Grammars/RenameColumn.php | 69 + .../Schema/Grammars/SQLiteGrammar.php | 860 + .../Schema/Grammars/SqlServerGrammar.php | 804 + .../Database/Schema/MySqlBuilder.php | 114 + .../Database/Schema/PostgresBuilder.php | 141 + .../Database/Schema/SQLiteBuilder.php | 52 + .../Database/Schema/SqlServerBuilder.php | 20 + .../src/Illuminate/Database/Seeder.php | 125 + .../Database/SqlServerConnection.php | 113 + .../src/Illuminate/Database/composer.json | 45 + .../src/Illuminate/Encryption/Encrypter.php | 251 + .../Encryption/EncryptionServiceProvider.php | 50 + .../src/Illuminate/Encryption/composer.json | 37 + .../Illuminate/Events/CallQueuedListener.php | 160 + .../src/Illuminate/Events/Dispatcher.php | 573 + .../Events/EventServiceProvider.php | 23 + .../src/Illuminate/Events/composer.json | 36 + .../src/Illuminate/Filesystem/Cache.php | 77 + .../src/Illuminate/Filesystem/Filesystem.php | 609 + .../Filesystem/FilesystemAdapter.php | 718 + .../Filesystem/FilesystemManager.php | 401 + .../Filesystem/FilesystemServiceProvider.php | 82 + .../src/Illuminate/Filesystem/composer.json | 43 + .../src/Illuminate/Foundation/AliasLoader.php | 243 + .../src/Illuminate/Foundation/Application.php | 1167 + .../Foundation/Auth/Access/Authorizable.php | 44 + .../Auth/Access/AuthorizesRequests.php | 126 + .../Foundation/Auth/AuthenticatesUsers.php | 184 + .../Foundation/Auth/RedirectsUsers.php | 20 + .../Foundation/Auth/RegistersUsers.php | 62 + .../Foundation/Auth/ResetsPasswords.php | 162 + .../Auth/SendsPasswordResetEmails.php | 88 + .../Foundation/Auth/ThrottlesLogins.php | 121 + .../src/Illuminate/Foundation/Auth/User.php | 20 + .../Foundation/Auth/VerifiesEmails.php | 62 + .../Foundation/Bootstrap/BootProviders.php | 19 + .../Foundation/Bootstrap/HandleExceptions.php | 161 + .../Bootstrap/LoadConfiguration.php | 116 + .../Bootstrap/LoadEnvironmentVariables.php | 79 + .../Foundation/Bootstrap/RegisterFacades.php | 29 + .../Bootstrap/RegisterProviders.php | 19 + .../Bootstrap/SetRequestForConsole.php | 35 + .../Foundation/Bus/Dispatchable.php | 39 + .../Foundation/Bus/DispatchesJobs.php | 30 + .../Foundation/Bus/PendingChain.php | 45 + .../Foundation/Bus/PendingDispatch.php | 114 + .../Illuminate/Foundation/ComposerScripts.php | 65 + .../Foundation/Console/AppNameCommand.php | 296 + .../Foundation/Console/ChannelMakeCommand.php | 65 + .../Console/ClearCompiledCommand.php | 40 + .../Foundation/Console/ClosureCommand.php | 71 + .../Foundation/Console/ConfigCacheCommand.php | 90 + .../Foundation/Console/ConfigClearCommand.php | 55 + .../Foundation/Console/ConsoleMakeCommand.php | 90 + .../Foundation/Console/DownCommand.php | 69 + .../Foundation/Console/EnvironmentCommand.php | 32 + .../Console/EventGenerateCommand.php | 78 + .../Foundation/Console/EventMakeCommand.php | 61 + .../Console/ExceptionMakeCommand.php | 84 + .../Foundation/Console/JobMakeCommand.php | 65 + .../Illuminate/Foundation/Console/Kernel.php | 367 + .../Foundation/Console/KeyGenerateCommand.php | 111 + .../Console/ListenerMakeCommand.php | 112 + .../Foundation/Console/MailMakeCommand.php | 116 + .../Foundation/Console/ModelMakeCommand.php | 162 + .../Console/NotificationMakeCommand.php | 116 + .../Console/ObserverMakeCommand.php | 113 + .../Console/OptimizeClearCommand.php | 38 + .../Foundation/Console/OptimizeCommand.php | 35 + .../Console/PackageDiscoverCommand.php | 40 + .../Foundation/Console/PolicyMakeCommand.php | 144 + .../Foundation/Console/PresetCommand.php | 96 + .../Foundation/Console/Presets/Bootstrap.php | 44 + .../Foundation/Console/Presets/None.php | 60 + .../Foundation/Console/Presets/Preset.php | 65 + .../Foundation/Console/Presets/React.php | 76 + .../Foundation/Console/Presets/Vue.php | 76 + .../Presets/bootstrap-stubs/_variables.scss | 20 + .../Console/Presets/bootstrap-stubs/app.scss | 14 + .../Console/Presets/none-stubs/app.js | 8 + .../Console/Presets/none-stubs/bootstrap.js | 43 + .../Console/Presets/react-stubs/Example.js | 26 + .../Console/Presets/react-stubs/app.js | 16 + .../Presets/react-stubs/webpack.mix.js | 15 + .../Presets/vue-stubs/ExampleComponent.vue | 23 + .../Console/Presets/vue-stubs/app.js | 22 + .../Console/Presets/vue-stubs/webpack.mix.js | 15 + .../Console/ProviderMakeCommand.php | 50 + .../Foundation/Console/QueuedCommand.php | 42 + .../Foundation/Console/RequestMakeCommand.php | 50 + .../Console/ResourceMakeCommand.php | 91 + .../Foundation/Console/RouteCacheCommand.php | 109 + .../Foundation/Console/RouteClearCommand.php | 55 + .../Foundation/Console/RouteListCommand.php | 192 + .../Foundation/Console/RuleMakeCommand.php | 50 + .../Foundation/Console/ServeCommand.php | 92 + .../Foundation/Console/StorageLinkCommand.php | 40 + .../Foundation/Console/TestMakeCommand.php | 82 + .../Foundation/Console/UpCommand.php | 34 + .../Console/VendorPublishCommand.php | 275 + .../Foundation/Console/ViewCacheCommand.php | 85 + .../Foundation/Console/ViewClearCommand.php | 66 + .../Foundation/Console/stubs/channel.stub | 29 + .../Foundation/Console/stubs/console.stub | 42 + .../Console/stubs/event-handler-queued.stub | 33 + .../Console/stubs/event-handler.stub | 31 + .../Foundation/Console/stubs/event.stub | 36 + .../stubs/exception-render-report.stub | 29 + .../Console/stubs/exception-render.stub | 19 + .../Console/stubs/exception-report.stub | 18 + .../Foundation/Console/stubs/exception.stub | 10 + .../Foundation/Console/stubs/job-queued.stub | 34 + .../Foundation/Console/stubs/job.stub | 31 + .../Console/stubs/listener-duck.stub | 30 + .../Console/stubs/listener-queued-duck.stub | 32 + .../Console/stubs/listener-queued.stub | 33 + .../Foundation/Console/stubs/listener.stub | 31 + .../Foundation/Console/stubs/mail.stub | 33 + .../Console/stubs/markdown-mail.stub | 33 + .../Console/stubs/markdown-notification.stub | 58 + .../Foundation/Console/stubs/markdown.stub | 12 + .../Foundation/Console/stubs/model.stub | 10 + .../Console/stubs/notification.stub | 61 + .../Console/stubs/observer.plain.stub | 8 + .../Foundation/Console/stubs/observer.stub | 63 + .../Foundation/Console/stubs/pivot.model.stub | 10 + .../Console/stubs/policy.plain.stub | 21 + .../Foundation/Console/stubs/policy.stub | 83 + .../Foundation/Console/stubs/provider.stub | 28 + .../Foundation/Console/stubs/request.stub | 30 + .../Console/stubs/resource-collection.stub | 19 + .../Foundation/Console/stubs/resource.stub | 19 + .../Foundation/Console/stubs/routes.stub | 16 + .../Foundation/Console/stubs/rule.stub | 40 + .../Foundation/Console/stubs/test.stub | 20 + .../Foundation/Console/stubs/unit-test.stub | 20 + .../Foundation/EnvironmentDetector.php | 69 + .../Foundation/Events/Dispatchable.php | 26 + .../Foundation/Events/LocaleUpdated.php | 24 + .../Foundation/Exceptions/Handler.php | 482 + .../Foundation/Exceptions/WhoopsHandler.php | 86 + .../Foundation/Exceptions/views/401.blade.php | 11 + .../Foundation/Exceptions/views/403.blade.php | 11 + .../Foundation/Exceptions/views/404.blade.php | 11 + .../Foundation/Exceptions/views/419.blade.php | 11 + .../Foundation/Exceptions/views/429.blade.php | 11 + .../Foundation/Exceptions/views/500.blade.php | 11 + .../Foundation/Exceptions/views/503.blade.php | 11 + .../views/illustrated-layout.blade.php | 486 + .../Exceptions/views/layout.blade.php | 57 + .../Foundation/Http/Events/RequestHandled.php | 33 + .../Exceptions/MaintenanceModeException.php | 54 + .../Foundation/Http/FormRequest.php | 245 + .../src/Illuminate/Foundation/Http/Kernel.php | 348 + .../Middleware/CheckForMaintenanceMode.php | 85 + .../Middleware/ConvertEmptyStringsToNull.php | 18 + .../Http/Middleware/TransformsRequest.php | 102 + .../Http/Middleware/TrimStrings.php | 31 + .../Http/Middleware/ValidatePostSize.php | 55 + .../Http/Middleware/VerifyCsrfToken.php | 199 + .../src/Illuminate/Foundation/Inspiring.php | 38 + .../Illuminate/Foundation/PackageManifest.php | 175 + .../Foundation/ProviderRepository.php | 210 + .../Providers/ArtisanServiceProvider.php | 1023 + .../Providers/ComposerServiceProvider.php | 38 + .../ConsoleSupportServiceProvider.php | 27 + .../Providers/FormRequestServiceProvider.php | 39 + .../Providers/FoundationServiceProvider.php | 68 + .../Support/Providers/AuthServiceProvider.php | 46 + .../Providers/EventServiceProvider.php | 59 + .../Providers/RouteServiceProvider.php | 104 + .../Concerns/InteractsWithAuthentication.php | 151 + .../Testing/Concerns/InteractsWithConsole.php | 71 + .../Concerns/InteractsWithContainer.php | 59 + .../Concerns/InteractsWithDatabase.php | 99 + .../InteractsWithExceptionHandling.php | 136 + .../Testing/Concerns/InteractsWithRedis.php | 112 + .../Testing/Concerns/InteractsWithSession.php | 64 + .../Testing/Concerns/MakesHttpRequests.php | 460 + .../Concerns/MocksApplicationServices.php | 283 + .../Testing/Constraints/HasInDatabase.php | 103 + .../Testing/Constraints/SeeInOrder.php | 88 + .../Constraints/SoftDeletedInDatabase.php | 103 + .../Foundation/Testing/DatabaseMigrations.php | 26 + .../Testing/DatabaseTransactions.php | 40 + .../Foundation/Testing/HttpException.php | 10 + .../Foundation/Testing/PendingCommand.php | 220 + .../Foundation/Testing/RefreshDatabase.php | 117 + .../Testing/RefreshDatabaseState.php | 13 + .../Foundation/Testing/TestCase.php | 200 + .../Foundation/Testing/TestResponse.php | 1059 + .../Foundation/Testing/WithFaker.php | 47 + .../Foundation/Testing/WithoutEvents.php | 22 + .../Foundation/Testing/WithoutMiddleware.php | 22 + .../Validation/ValidatesRequests.php | 83 + .../src/Illuminate/Foundation/helpers.php | 1013 + .../Illuminate/Foundation/stubs/facade.stub | 21 + .../src/Illuminate/Hashing/AbstractHasher.php | 34 + .../src/Illuminate/Hashing/Argon2IdHasher.php | 39 + .../src/Illuminate/Hashing/ArgonHasher.php | 190 + .../src/Illuminate/Hashing/BcryptHasher.php | 114 + .../src/Illuminate/Hashing/HashManager.php | 97 + .../Hashing/HashServiceProvider.php | 41 + .../src/Illuminate/Hashing/composer.json | 35 + .../Concerns/InteractsWithContentTypes.php | 171 + .../Http/Concerns/InteractsWithFlashData.php | 64 + .../Http/Concerns/InteractsWithInput.php | 396 + .../Http/Exceptions/HttpResponseException.php | 37 + .../Http/Exceptions/PostTooLargeException.php | 23 + .../Exceptions/ThrottleRequestsException.php | 23 + .../framework/src/Illuminate/Http/File.php | 10 + .../src/Illuminate/Http/FileHelpers.php | 66 + .../src/Illuminate/Http/JsonResponse.php | 121 + .../CheckResponseForModifications.php | 27 + .../Illuminate/Http/Middleware/FrameGuard.php | 24 + .../Http/Middleware/SetCacheHeaders.php | 55 + .../src/Illuminate/Http/RedirectResponse.php | 236 + .../framework/src/Illuminate/Http/Request.php | 686 + .../Http/Resources/CollectsResources.php | 59 + .../ConditionallyLoadsAttributes.php | 219 + .../Http/Resources/DelegatesToResource.php | 134 + .../Json/AnonymousResourceCollection.php | 27 + .../Http/Resources/Json/JsonResource.php | 209 + .../Json/PaginatedResourceResponse.php | 82 + .../Http/Resources/Json/Resource.php | 8 + .../Resources/Json/ResourceCollection.php | 74 + .../Http/Resources/Json/ResourceResponse.php | 120 + .../Illuminate/Http/Resources/MergeValue.php | 26 + .../Http/Resources/MissingValue.php | 16 + .../Http/Resources/PotentiallyMissing.php | 13 + .../src/Illuminate/Http/Response.php | 81 + .../src/Illuminate/Http/ResponseTrait.php | 141 + .../src/Illuminate/Http/Testing/File.php | 115 + .../Illuminate/Http/Testing/FileFactory.php | 65 + .../src/Illuminate/Http/Testing/MimeType.php | 827 + .../src/Illuminate/Http/UploadedFile.php | 138 + .../src/Illuminate/Http/composer.json | 37 + .../Illuminate/Log/Events/MessageLogged.php | 42 + .../src/Illuminate/Log/LogManager.php | 578 + .../src/Illuminate/Log/LogServiceProvider.php | 20 + .../framework/src/Illuminate/Log/Logger.php | 275 + .../Illuminate/Log/ParsesLogConfiguration.php | 66 + .../src/Illuminate/Log/composer.json | 36 + .../Illuminate/Mail/Events/MessageSending.php | 33 + .../Illuminate/Mail/Events/MessageSent.php | 33 + .../Illuminate/Mail/MailServiceProvider.php | 152 + .../src/Illuminate/Mail/Mailable.php | 845 + .../framework/src/Illuminate/Mail/Mailer.php | 584 + .../src/Illuminate/Mail/Markdown.php | 160 + .../framework/src/Illuminate/Mail/Message.php | 329 + .../src/Illuminate/Mail/PendingMail.php | 180 + .../Illuminate/Mail/SendQueuedMailable.php | 87 + .../Mail/Transport/ArrayTransport.php | 58 + .../Mail/Transport/LogTransport.php | 59 + .../Mail/Transport/MailgunTransport.php | 173 + .../Mail/Transport/MandrillTransport.php | 105 + .../Mail/Transport/SesTransport.php | 82 + .../Mail/Transport/SparkPostTransport.php | 169 + .../Illuminate/Mail/Transport/Transport.php | 108 + .../src/Illuminate/Mail/TransportManager.php | 215 + .../src/Illuminate/Mail/composer.json | 44 + .../resources/views/html/button.blade.php | 19 + .../resources/views/html/footer.blade.php | 11 + .../resources/views/html/header.blade.php | 7 + .../resources/views/html/layout.blade.php | 54 + .../resources/views/html/message.blade.php | 27 + .../Mail/resources/views/html/panel.blade.php | 13 + .../resources/views/html/promotion.blade.php | 7 + .../views/html/promotion/button.blade.php | 13 + .../resources/views/html/subcopy.blade.php | 7 + .../Mail/resources/views/html/table.blade.php | 3 + .../resources/views/html/themes/default.css | 290 + .../resources/views/markdown/button.blade.php | 1 + .../resources/views/markdown/footer.blade.php | 1 + .../resources/views/markdown/header.blade.php | 1 + .../resources/views/markdown/layout.blade.php | 9 + .../views/markdown/message.blade.php | 27 + .../resources/views/markdown/panel.blade.php | 1 + .../views/markdown/promotion.blade.php | 1 + .../views/markdown/promotion/button.blade.php | 1 + .../views/markdown/subcopy.blade.php | 1 + .../resources/views/markdown/table.blade.php | 1 + .../src/Illuminate/Notifications/Action.php | 33 + .../Notifications/AnonymousNotifiable.php | 72 + .../Notifications/ChannelManager.php | 162 + .../Channels/BroadcastChannel.php | 75 + .../Channels/DatabaseChannel.php | 63 + .../Notifications/Channels/MailChannel.php | 228 + .../Console/NotificationTableCommand.php | 81 + .../Console/stubs/notifications.stub | 35 + .../Notifications/DatabaseNotification.php | 102 + .../DatabaseNotificationCollection.php | 32 + .../Events/BroadcastNotificationCreated.php | 106 + .../Events/NotificationFailed.php | 56 + .../Events/NotificationSending.php | 47 + .../Notifications/Events/NotificationSent.php | 56 + .../HasDatabaseNotifications.php | 36 + .../Messages/BroadcastMessage.php | 41 + .../Messages/DatabaseMessage.php | 24 + .../Notifications/Messages/MailMessage.php | 274 + .../Notifications/Messages/SimpleMessage.php | 224 + .../Illuminate/Notifications/Notifiable.php | 8 + .../Illuminate/Notifications/Notification.php | 47 + .../Notifications/NotificationSender.php | 216 + .../NotificationServiceProvider.php | 46 + .../Notifications/RoutesNotifications.php | 55 + .../Notifications/SendQueuedNotifications.php | 109 + .../Illuminate/Notifications/composer.json | 46 + .../resources/views/email.blade.php | 62 + .../Pagination/AbstractPaginator.php | 642 + .../Pagination/LengthAwarePaginator.php | 199 + .../Pagination/PaginationServiceProvider.php | 50 + .../src/Illuminate/Pagination/Paginator.php | 177 + .../src/Illuminate/Pagination/UrlWindow.php | 218 + .../src/Illuminate/Pagination/composer.json | 35 + .../resources/views/bootstrap-4.blade.php | 44 + .../resources/views/default.blade.php | 44 + .../resources/views/semantic-ui.blade.php | 36 + .../views/simple-bootstrap-4.blade.php | 25 + .../resources/views/simple-default.blade.php | 17 + .../framework/src/Illuminate/Pipeline/Hub.php | 74 + .../src/Illuminate/Pipeline/Pipeline.php | 193 + .../Pipeline/PipelineServiceProvider.php | 40 + .../src/Illuminate/Pipeline/composer.json | 35 + .../src/Illuminate/Queue/BeanstalkdQueue.php | 163 + .../Illuminate/Queue/CallQueuedClosure.php | 62 + .../Illuminate/Queue/CallQueuedHandler.php | 152 + .../src/Illuminate/Queue/Capsule/Manager.php | 187 + .../Queue/Connectors/BeanstalkdConnector.php | 40 + .../Queue/Connectors/ConnectorInterface.php | 14 + .../Queue/Connectors/DatabaseConnector.php | 43 + .../Queue/Connectors/NullConnector.php | 19 + .../Queue/Connectors/RedisConnector.php | 52 + .../Queue/Connectors/SqsConnector.php | 46 + .../Queue/Connectors/SyncConnector.php | 19 + .../Queue/Console/FailedTableCommand.php | 102 + .../Queue/Console/FlushFailedCommand.php | 34 + .../Queue/Console/ForgetFailedCommand.php | 36 + .../Queue/Console/ListFailedCommand.php | 118 + .../Queue/Console/ListenCommand.php | 114 + .../Queue/Console/RestartCommand.php | 37 + .../Illuminate/Queue/Console/RetryCommand.php | 93 + .../Illuminate/Queue/Console/TableCommand.php | 102 + .../Illuminate/Queue/Console/WorkCommand.php | 216 + .../Queue/Console/stubs/failed_jobs.stub | 35 + .../Illuminate/Queue/Console/stubs/jobs.stub | 36 + .../src/Illuminate/Queue/DatabaseQueue.php | 327 + .../Queue/Events/JobExceptionOccurred.php | 42 + .../src/Illuminate/Queue/Events/JobFailed.php | 42 + .../Illuminate/Queue/Events/JobProcessed.php | 33 + .../Illuminate/Queue/Events/JobProcessing.php | 33 + .../src/Illuminate/Queue/Events/Looping.php | 33 + .../Queue/Events/WorkerStopping.php | 24 + .../Failed/DatabaseFailedJobProvider.php | 117 + .../Failed/FailedJobProviderInterface.php | 47 + .../Queue/Failed/NullFailedJobProvider.php | 62 + .../src/Illuminate/Queue/FailingJob.php | 50 + .../Illuminate/Queue/InteractsWithQueue.php | 76 + .../Queue/InvalidPayloadException.php | 19 + .../Illuminate/Queue/Jobs/BeanstalkdJob.php | 135 + .../src/Illuminate/Queue/Jobs/DatabaseJob.php | 100 + .../Queue/Jobs/DatabaseJobRecord.php | 63 + .../src/Illuminate/Queue/Jobs/Job.php | 278 + .../src/Illuminate/Queue/Jobs/JobName.php | 35 + .../src/Illuminate/Queue/Jobs/RedisJob.php | 139 + .../src/Illuminate/Queue/Jobs/SqsJob.php | 124 + .../src/Illuminate/Queue/Jobs/SyncJob.php | 91 + .../src/Illuminate/Queue/Listener.php | 230 + .../src/Illuminate/Queue/ListenerOptions.php | 32 + .../src/Illuminate/Queue/LuaScripts.php | 103 + .../Queue/ManuallyFailedException.php | 10 + .../Queue/MaxAttemptsExceededException.php | 10 + .../src/Illuminate/Queue/NullQueue.php | 70 + .../framework/src/Illuminate/Queue/Queue.php | 260 + .../src/Illuminate/Queue/QueueManager.php | 270 + .../Illuminate/Queue/QueueServiceProvider.php | 243 + .../framework/src/Illuminate/Queue/README.md | 34 + .../src/Illuminate/Queue/RedisQueue.php | 324 + .../Illuminate/Queue/SerializableClosure.php | 40 + .../SerializesAndRestoresModelIdentifiers.php | 99 + .../src/Illuminate/Queue/SerializesModels.php | 62 + .../src/Illuminate/Queue/SqsQueue.php | 155 + .../src/Illuminate/Queue/SyncQueue.php | 161 + .../framework/src/Illuminate/Queue/Worker.php | 628 + .../src/Illuminate/Queue/WorkerOptions.php | 78 + .../src/Illuminate/Queue/composer.json | 49 + .../Redis/Connections/Connection.php | 216 + .../Connections/PhpRedisClusterConnection.php | 8 + .../Redis/Connections/PhpRedisConnection.php | 436 + .../Connections/PredisClusterConnection.php | 8 + .../Redis/Connections/PredisConnection.php | 46 + .../Redis/Connectors/PhpRedisConnector.php | 129 + .../Redis/Connectors/PredisConnector.php | 44 + .../Redis/Events/CommandExecuted.php | 59 + .../Redis/Limiters/ConcurrencyLimiter.php | 140 + .../Limiters/ConcurrencyLimiterBuilder.php | 122 + .../Redis/Limiters/DurationLimiter.php | 148 + .../Redis/Limiters/DurationLimiterBuilder.php | 122 + .../src/Illuminate/Redis/RedisManager.php | 197 + .../Illuminate/Redis/RedisServiceProvider.php | 44 + .../src/Illuminate/Redis/composer.json | 36 + .../Routing/Console/ControllerMakeCommand.php | 186 + .../Routing/Console/MiddlewareMakeCommand.php | 50 + .../Routing/Console/stubs/controller.api.stub | 64 + .../Console/stubs/controller.invokable.stub | 20 + .../Console/stubs/controller.model.api.stub | 65 + .../Console/stubs/controller.model.stub | 86 + .../Console/stubs/controller.nested.api.stub | 71 + .../Console/stubs/controller.nested.stub | 94 + .../Console/stubs/controller.plain.stub | 11 + .../Routing/Console/stubs/controller.stub | 85 + .../Routing/Console/stubs/middleware.stub | 20 + .../Contracts/ControllerDispatcher.php | 27 + .../src/Illuminate/Routing/Controller.php | 72 + .../Routing/ControllerDispatcher.php | 81 + .../Routing/ControllerMiddlewareOptions.php | 50 + .../Routing/Events/RouteMatched.php | 33 + .../Exceptions/InvalidSignatureException.php | 18 + .../Exceptions/UrlGenerationException.php | 19 + .../Routing/ImplicitRouteBinding.php | 60 + .../Routing/Matching/HostValidator.php | 25 + .../Routing/Matching/MethodValidator.php | 21 + .../Routing/Matching/SchemeValidator.php | 27 + .../Routing/Matching/UriValidator.php | 23 + .../Routing/Matching/ValidatorInterface.php | 18 + .../Routing/Middleware/SubstituteBindings.php | 43 + .../Routing/Middleware/ThrottleRequests.php | 197 + .../Middleware/ThrottleRequestsWithRedis.php | 120 + .../Routing/Middleware/ValidateSignature.php | 27 + .../Routing/MiddlewareNameResolver.php | 85 + .../Routing/PendingResourceRegistration.php | 181 + .../src/Illuminate/Routing/Pipeline.php | 91 + .../Illuminate/Routing/RedirectController.php | 21 + .../src/Illuminate/Routing/Redirector.php | 232 + .../Illuminate/Routing/ResourceRegistrar.php | 450 + .../Illuminate/Routing/ResponseFactory.php | 262 + .../src/Illuminate/Routing/Route.php | 898 + .../src/Illuminate/Routing/RouteAction.php | 94 + .../src/Illuminate/Routing/RouteBinding.php | 82 + .../Illuminate/Routing/RouteCollection.php | 351 + .../src/Illuminate/Routing/RouteCompiler.php | 54 + .../Routing/RouteDependencyResolverTrait.php | 111 + .../src/Illuminate/Routing/RouteGroup.php | 95 + .../Routing/RouteParameterBinder.php | 120 + .../src/Illuminate/Routing/RouteRegistrar.php | 200 + .../Routing/RouteSignatureParameters.php | 45 + .../Illuminate/Routing/RouteUrlGenerator.php | 314 + .../src/Illuminate/Routing/Router.php | 1275 + .../Routing/RoutingServiceProvider.php | 167 + .../Illuminate/Routing/SortedMiddleware.php | 84 + .../src/Illuminate/Routing/UrlGenerator.php | 731 + .../src/Illuminate/Routing/ViewController.php | 39 + .../src/Illuminate/Routing/composer.json | 47 + .../Session/CacheBasedSessionHandler.php | 94 + .../Session/Console/SessionTableCommand.php | 81 + .../Session/Console/stubs/database.stub | 35 + .../Session/CookieSessionHandler.php | 121 + .../Session/DatabaseSessionHandler.php | 294 + .../src/Illuminate/Session/EncryptedStore.php | 69 + .../Session/ExistenceAwareInterface.php | 14 + .../Illuminate/Session/FileSessionHandler.php | 113 + .../Middleware/AuthenticateSession.php | 96 + .../Session/Middleware/StartSession.php | 242 + .../Illuminate/Session/NullSessionHandler.php | 56 + .../src/Illuminate/Session/SessionManager.php | 215 + .../Session/SessionServiceProvider.php | 50 + .../src/Illuminate/Session/Store.php | 661 + .../Session/TokenMismatchException.php | 10 + .../src/Illuminate/Session/composer.json | 41 + .../Support/AggregateServiceProvider.php | 52 + .../framework/src/Illuminate/Support/Arr.php | 634 + .../src/Illuminate/Support/Carbon.php | 10 + .../src/Illuminate/Support/Collection.php | 2001 ++ .../src/Illuminate/Support/Composer.php | 99 + .../src/Illuminate/Support/Facades/App.php | 31 + .../Illuminate/Support/Facades/Artisan.php | 27 + .../src/Illuminate/Support/Facades/Auth.php | 54 + .../src/Illuminate/Support/Facades/Blade.php | 36 + .../Illuminate/Support/Facades/Broadcast.php | 25 + .../src/Illuminate/Support/Facades/Bus.php | 39 + .../src/Illuminate/Support/Facades/Cache.php | 36 + .../src/Illuminate/Support/Facades/Config.php | 26 + .../src/Illuminate/Support/Facades/Cookie.php | 46 + .../src/Illuminate/Support/Facades/Crypt.php | 22 + .../src/Illuminate/Support/Facades/DB.php | 41 + .../src/Illuminate/Support/Facades/Event.php | 65 + .../src/Illuminate/Support/Facades/Facade.php | 239 + .../src/Illuminate/Support/Facades/File.php | 55 + .../src/Illuminate/Support/Facades/Gate.php | 35 + .../src/Illuminate/Support/Facades/Hash.php | 24 + .../src/Illuminate/Support/Facades/Input.php | 72 + .../src/Illuminate/Support/Facades/Lang.php | 25 + .../src/Illuminate/Support/Facades/Log.php | 31 + .../src/Illuminate/Support/Facades/Mail.php | 50 + .../Support/Facades/Notification.php | 52 + .../Illuminate/Support/Facades/Password.php | 59 + .../src/Illuminate/Support/Facades/Queue.php | 43 + .../Illuminate/Support/Facades/Redirect.php | 32 + .../src/Illuminate/Support/Facades/Redis.php | 22 + .../Illuminate/Support/Facades/Request.php | 58 + .../Illuminate/Support/Facades/Response.php | 34 + .../src/Illuminate/Support/Facades/Route.php | 49 + .../src/Illuminate/Support/Facades/Schema.php | 36 + .../Illuminate/Support/Facades/Session.php | 43 + .../Illuminate/Support/Facades/Storage.php | 56 + .../src/Illuminate/Support/Facades/URL.php | 33 + .../Illuminate/Support/Facades/Validator.php | 24 + .../src/Illuminate/Support/Facades/View.php | 28 + .../src/Illuminate/Support/Fluent.php | 192 + .../Support/HigherOrderCollectionProxy.php | 63 + .../Support/HigherOrderTapProxy.php | 38 + .../src/Illuminate/Support/HtmlString.php | 46 + .../Illuminate/Support/InteractsWithTime.php | 64 + .../src/Illuminate/Support/Manager.php | 148 + .../src/Illuminate/Support/MessageBag.php | 396 + .../Support/NamespacedItemResolver.php | 102 + .../src/Illuminate/Support/Optional.php | 130 + .../src/Illuminate/Support/Pluralizer.php | 119 + .../src/Illuminate/Support/ProcessUtils.php | 69 + .../Illuminate/Support/ServiceProvider.php | 300 + .../framework/src/Illuminate/Support/Str.php | 718 + .../Support/Testing/Fakes/BusFake.php | 165 + .../Support/Testing/Fakes/EventFake.php | 272 + .../Support/Testing/Fakes/MailFake.php | 336 + .../Testing/Fakes/NotificationFake.php | 246 + .../Support/Testing/Fakes/PendingMailFake.php | 53 + .../Support/Testing/Fakes/QueueFake.php | 350 + .../Support/Traits/CapsuleManagerTrait.php | 69 + .../Support/Traits/ForwardsCalls.php | 54 + .../Illuminate/Support/Traits/Localizable.php | 34 + .../Illuminate/Support/Traits/Macroable.php | 113 + .../src/Illuminate/Support/ViewErrorBag.php | 130 + .../src/Illuminate/Support/composer.json | 50 + .../src/Illuminate/Support/helpers.php | 1166 + .../Illuminate/Translation/ArrayLoader.php | 85 + .../src/Illuminate/Translation/FileLoader.php | 187 + .../Translation/MessageSelector.php | 412 + .../TranslationServiceProvider.php | 62 + .../src/Illuminate/Translation/Translator.php | 490 + .../src/Illuminate/Translation/composer.json | 36 + .../Validation/ClosureValidationRule.php | 70 + .../Validation/Concerns/FormatsMessages.php | 384 + .../Concerns/ReplacesAttributes.php | 490 + .../Concerns/ValidatesAttributes.php | 1738 ++ .../Validation/DatabasePresenceVerifier.php | 138 + .../src/Illuminate/Validation/Factory.php | 283 + .../Validation/PresenceVerifierInterface.php | 30 + .../src/Illuminate/Validation/Rule.php | 87 + .../Validation/Rules/DatabaseRule.php | 172 + .../Validation/Rules/Dimensions.php | 131 + .../Illuminate/Validation/Rules/Exists.php | 22 + .../src/Illuminate/Validation/Rules/In.php | 45 + .../src/Illuminate/Validation/Rules/NotIn.php | 43 + .../Validation/Rules/RequiredIf.php | 38 + .../Illuminate/Validation/Rules/Unique.php | 74 + .../Validation/UnauthorizedException.php | 10 + .../Validation/ValidatesWhenResolvedTrait.php | 88 + .../Illuminate/Validation/ValidationData.php | 113 + .../Validation/ValidationException.php | 138 + .../Validation/ValidationRuleParser.php | 277 + .../Validation/ValidationServiceProvider.php | 72 + .../src/Illuminate/Validation/Validator.php | 1191 + .../src/Illuminate/Validation/composer.json | 41 + .../View/Compilers/BladeCompiler.php | 519 + .../Illuminate/View/Compilers/Compiler.php | 74 + .../View/Compilers/CompilerInterface.php | 30 + .../Concerns/CompilesAuthorizations.php | 102 + .../Compilers/Concerns/CompilesComments.php | 19 + .../Compilers/Concerns/CompilesComponents.php | 48 + .../Concerns/CompilesConditionals.php | 230 + .../View/Compilers/Concerns/CompilesEchos.php | 94 + .../Compilers/Concerns/CompilesHelpers.php | 49 + .../Compilers/Concerns/CompilesIncludes.php | 69 + .../Compilers/Concerns/CompilesInjections.php | 23 + .../View/Compilers/Concerns/CompilesJson.php | 30 + .../Compilers/Concerns/CompilesLayouts.php | 116 + .../View/Compilers/Concerns/CompilesLoops.php | 180 + .../Compilers/Concerns/CompilesRawPhp.php | 32 + .../Compilers/Concerns/CompilesStacks.php | 59 + .../Concerns/CompilesTranslations.php | 44 + .../View/Concerns/ManagesComponents.php | 128 + .../View/Concerns/ManagesEvents.php | 192 + .../View/Concerns/ManagesLayouts.php | 220 + .../Illuminate/View/Concerns/ManagesLoops.php | 90 + .../View/Concerns/ManagesStacks.php | 179 + .../View/Concerns/ManagesTranslations.php | 38 + .../View/Engines/CompilerEngine.php | 102 + .../src/Illuminate/View/Engines/Engine.php | 23 + .../View/Engines/EngineResolver.php | 60 + .../Illuminate/View/Engines/FileEngine.php | 20 + .../src/Illuminate/View/Engines/PhpEngine.php | 70 + .../framework/src/Illuminate/View/Factory.php | 567 + .../src/Illuminate/View/FileViewFinder.php | 298 + .../Middleware/ShareErrorsFromSession.php | 51 + .../framework/src/Illuminate/View/View.php | 429 + .../Illuminate/View/ViewFinderInterface.php | 71 + .../src/Illuminate/View/ViewName.php | 25 + .../Illuminate/View/ViewServiceProvider.php | 149 + .../src/Illuminate/View/composer.json | 39 + .../nexmo-notification-channel/LICENSE.txt | 21 + .../nexmo-notification-channel/composer.json | 46 + .../nexmo-notification-channel/readme.md | 0 .../src/Channels/NexmoSmsChannel.php | 64 + .../src/Messages/NexmoMessage.php | 76 + .../src/NexmoChannelServiceProvider.php | 29 + .../slack-notification-channel/LICENSE.txt | 21 + .../slack-notification-channel/composer.json | 46 + .../slack-notification-channel/readme.md | 0 .../src/Channels/SlackWebhookChannel.php | 122 + .../src/Messages/SlackAttachment.php | 348 + .../src/Messages/SlackAttachmentField.php | 79 + .../src/Messages/SlackMessage.php | 273 + .../src/SlackChannelServiceProvider.php | 22 + vendor/lcobucci/jwt/.gitignore | 2 + vendor/lcobucci/jwt/.scrutinizer.yml | 56 + vendor/lcobucci/jwt/.travis.yml | 22 + vendor/lcobucci/jwt/LICENSE | 27 + vendor/lcobucci/jwt/README.md | 149 + vendor/lcobucci/jwt/composer.json | 52 + vendor/lcobucci/jwt/composer.lock | 1898 ++ vendor/lcobucci/jwt/phpunit.xml.dist | 33 + vendor/lcobucci/jwt/src/Builder.php | 277 + vendor/lcobucci/jwt/src/Claim.php | 40 + vendor/lcobucci/jwt/src/Claim/Basic.php | 73 + vendor/lcobucci/jwt/src/Claim/EqualsTo.php | 32 + vendor/lcobucci/jwt/src/Claim/Factory.php | 116 + .../jwt/src/Claim/GreaterOrEqualsTo.php | 32 + .../jwt/src/Claim/LesserOrEqualsTo.php | 32 + vendor/lcobucci/jwt/src/Claim/Validatable.php | 28 + vendor/lcobucci/jwt/src/Parser.php | 157 + vendor/lcobucci/jwt/src/Parsing/Decoder.php | 56 + vendor/lcobucci/jwt/src/Parsing/Encoder.php | 51 + vendor/lcobucci/jwt/src/Signature.php | 59 + vendor/lcobucci/jwt/src/Signer.php | 59 + vendor/lcobucci/jwt/src/Signer/BaseSigner.php | 83 + vendor/lcobucci/jwt/src/Signer/Ecdsa.php | 153 + .../jwt/src/Signer/Ecdsa/KeyParser.php | 104 + .../lcobucci/jwt/src/Signer/Ecdsa/Sha256.php | 43 + .../lcobucci/jwt/src/Signer/Ecdsa/Sha384.php | 43 + .../lcobucci/jwt/src/Signer/Ecdsa/Sha512.php | 43 + vendor/lcobucci/jwt/src/Signer/Hmac.php | 75 + .../lcobucci/jwt/src/Signer/Hmac/Sha256.php | 35 + .../lcobucci/jwt/src/Signer/Hmac/Sha384.php | 35 + .../lcobucci/jwt/src/Signer/Hmac/Sha512.php | 35 + vendor/lcobucci/jwt/src/Signer/Key.php | 92 + vendor/lcobucci/jwt/src/Signer/Keychain.php | 44 + vendor/lcobucci/jwt/src/Signer/Rsa.php | 80 + vendor/lcobucci/jwt/src/Signer/Rsa/Sha256.php | 35 + vendor/lcobucci/jwt/src/Signer/Rsa/Sha384.php | 35 + vendor/lcobucci/jwt/src/Signer/Rsa/Sha512.php | 35 + vendor/lcobucci/jwt/src/Token.php | 284 + vendor/lcobucci/jwt/src/ValidationData.php | 120 + .../jwt/test/functional/EcdsaTokenTest.php | 320 + .../jwt/test/functional/HmacTokenTest.php | 186 + vendor/lcobucci/jwt/test/functional/Keys.php | 53 + .../jwt/test/functional/RsaTokenTest.php | 272 + .../jwt/test/functional/UnsignedTokenTest.php | 137 + .../jwt/test/functional/ecdsa/private.key | 5 + .../jwt/test/functional/ecdsa/private2.key | 8 + .../jwt/test/functional/ecdsa/public1.key | 4 + .../jwt/test/functional/ecdsa/public2.key | 4 + .../jwt/test/functional/ecdsa/public3.key | 4 + .../test/functional/rsa/encrypted-private.key | 30 + .../test/functional/rsa/encrypted-public.key | 9 + .../jwt/test/functional/rsa/private.key | 28 + .../jwt/test/functional/rsa/public.key | 9 + vendor/lcobucci/jwt/test/unit/BuilderTest.php | 699 + .../jwt/test/unit/Claim/BasicTest.php | 84 + .../jwt/test/unit/Claim/EqualsToTest.php | 80 + .../jwt/test/unit/Claim/FactoryTest.php | 168 + .../test/unit/Claim/GreaterOrEqualsToTest.php | 103 + .../test/unit/Claim/LesserOrEqualsToTest.php | 103 + vendor/lcobucci/jwt/test/unit/ParserTest.php | 244 + .../jwt/test/unit/Parsing/DecoderTest.php | 56 + .../jwt/test/unit/Parsing/EncoderTest.php | 53 + .../lcobucci/jwt/test/unit/SignatureTest.php | 73 + .../jwt/test/unit/Signer/BaseSignerTest.php | 128 + .../test/unit/Signer/Ecdsa/KeyParserTest.php | 178 + .../jwt/test/unit/Signer/Ecdsa/Sha256Test.php | 60 + .../jwt/test/unit/Signer/Ecdsa/Sha384Test.php | 60 + .../jwt/test/unit/Signer/Ecdsa/Sha512Test.php | 60 + .../jwt/test/unit/Signer/EcdsaTest.php | 173 + .../jwt/test/unit/Signer/Hmac/Sha256Test.php | 39 + .../jwt/test/unit/Signer/Hmac/Sha384Test.php | 39 + .../jwt/test/unit/Signer/Hmac/Sha512Test.php | 39 + .../jwt/test/unit/Signer/HmacTest.php | 134 + .../lcobucci/jwt/test/unit/Signer/KeyTest.php | 119 + .../jwt/test/unit/Signer/KeychainTest.php | 49 + .../jwt/test/unit/Signer/Rsa/Sha256Test.php | 39 + .../jwt/test/unit/Signer/Rsa/Sha384Test.php | 39 + .../jwt/test/unit/Signer/Rsa/Sha512Test.php | 39 + vendor/lcobucci/jwt/test/unit/TokenTest.php | 502 + .../jwt/test/unit/ValidationDataTest.php | 224 + vendor/league/flysystem/LICENSE | 19 + vendor/league/flysystem/composer.json | 64 + vendor/league/flysystem/deprecations.md | 19 + .../flysystem/src/Adapter/AbstractAdapter.php | 71 + .../src/Adapter/AbstractFtpAdapter.php | 623 + .../src/Adapter/CanOverwriteFiles.php | 10 + vendor/league/flysystem/src/Adapter/Ftp.php | 568 + vendor/league/flysystem/src/Adapter/Ftpd.php | 40 + vendor/league/flysystem/src/Adapter/Local.php | 517 + .../flysystem/src/Adapter/NullAdapter.php | 144 + .../Polyfill/NotSupportingVisibilityTrait.php | 33 + .../Adapter/Polyfill/StreamedCopyTrait.php | 49 + .../Adapter/Polyfill/StreamedReadingTrait.php | 44 + .../src/Adapter/Polyfill/StreamedTrait.php | 9 + .../Adapter/Polyfill/StreamedWritingTrait.php | 60 + .../flysystem/src/Adapter/SynologyFtp.php | 8 + .../league/flysystem/src/AdapterInterface.php | 118 + vendor/league/flysystem/src/Config.php | 107 + .../league/flysystem/src/ConfigAwareTrait.php | 49 + vendor/league/flysystem/src/Directory.php | 31 + vendor/league/flysystem/src/Exception.php | 8 + vendor/league/flysystem/src/File.php | 205 + .../flysystem/src/FileExistsException.php | 37 + .../flysystem/src/FileNotFoundException.php | 37 + vendor/league/flysystem/src/Filesystem.php | 407 + .../flysystem/src/FilesystemInterface.php | 284 + .../src/FilesystemNotFoundException.php | 12 + vendor/league/flysystem/src/Handler.php | 137 + vendor/league/flysystem/src/MountManager.php | 648 + .../flysystem/src/NotSupportedException.php | 37 + .../flysystem/src/Plugin/AbstractPlugin.php | 24 + .../league/flysystem/src/Plugin/EmptyDir.php | 34 + .../flysystem/src/Plugin/ForcedCopy.php | 44 + .../flysystem/src/Plugin/ForcedRename.php | 44 + .../flysystem/src/Plugin/GetWithMetadata.php | 51 + .../league/flysystem/src/Plugin/ListFiles.php | 35 + .../league/flysystem/src/Plugin/ListPaths.php | 36 + .../league/flysystem/src/Plugin/ListWith.php | 60 + .../flysystem/src/Plugin/PluggableTrait.php | 97 + .../src/Plugin/PluginNotFoundException.php | 10 + .../league/flysystem/src/PluginInterface.php | 20 + vendor/league/flysystem/src/ReadInterface.php | 88 + .../flysystem/src/RootViolationException.php | 10 + vendor/league/flysystem/src/SafeStorage.php | 39 + .../flysystem/src/UnreadableFileException.php | 18 + vendor/league/flysystem/src/Util.php | 348 + .../src/Util/ContentListingFormatter.php | 116 + vendor/league/flysystem/src/Util/MimeType.php | 228 + .../flysystem/src/Util/StreamHasher.php | 36 + vendor/mockery/mockery/.gitignore | 15 + vendor/mockery/mockery/.php_cs | 30 + vendor/mockery/mockery/.phpstorm.meta.php | 11 + vendor/mockery/mockery/.scrutinizer.yml | 24 + vendor/mockery/mockery/.styleci.yml | 7 + vendor/mockery/mockery/.travis.yml | 106 + vendor/mockery/mockery/CHANGELOG.md | 106 + vendor/mockery/mockery/CONTRIBUTING.md | 88 + vendor/mockery/mockery/LICENSE | 27 + vendor/mockery/mockery/Makefile | 52 + vendor/mockery/mockery/README.md | 299 + vendor/mockery/mockery/composer.json | 56 + .../mockery/mockery/docker/php56/Dockerfile | 14 + vendor/mockery/mockery/docs/.gitignore | 1 + vendor/mockery/mockery/docs/Makefile | 177 + vendor/mockery/mockery/docs/README.md | 4 + vendor/mockery/mockery/docs/conf.py | 267 + .../docs/cookbook/big_parent_class.rst | 52 + .../mockery/docs/cookbook/class_constants.rst | 183 + .../docs/cookbook/default_expectations.rst | 17 + .../docs/cookbook/detecting_mock_objects.rst | 13 + .../mockery/mockery/docs/cookbook/index.rst | 15 + .../mockery/mockery/docs/cookbook/map.rst.inc | 7 + .../mockery/docs/cookbook/mockery_on.rst | 85 + .../cookbook/mocking_hard_dependencies.rst | 99 + .../cookbook/not_calling_the_constructor.rst | 63 + .../mockery/docs/getting_started/index.rst | 12 + .../docs/getting_started/installation.rst | 43 + .../mockery/docs/getting_started/map.rst.inc | 4 + .../docs/getting_started/quick_reference.rst | 200 + .../docs/getting_started/simple_example.rst | 70 + .../docs/getting_started/upgrading.rst | 82 + vendor/mockery/mockery/docs/index.rst | 76 + .../mockery/docs/mockery/configuration.rst | 77 + .../mockery/docs/mockery/exceptions.rst | 65 + .../mockery/mockery/docs/mockery/gotchas.rst | 48 + vendor/mockery/mockery/docs/mockery/index.rst | 12 + .../mockery/mockery/docs/mockery/map.rst.inc | 4 + .../docs/mockery/reserved_method_names.rst | 20 + .../alternative_should_receive_syntax.rst | 91 + .../docs/reference/argument_validation.rst | 317 + .../docs/reference/creating_test_doubles.rst | 419 + .../mockery/docs/reference/demeter_chains.rst | 38 + .../mockery/docs/reference/expectations.rst | 465 + .../docs/reference/final_methods_classes.rst | 28 + .../mockery/mockery/docs/reference/index.rst | 22 + .../docs/reference/instance_mocking.rst | 22 + .../mockery/docs/reference/magic_methods.rst | 16 + .../mockery/docs/reference/map.rst.inc | 14 + .../mockery/docs/reference/partial_mocks.rst | 108 + .../pass_by_reference_behaviours.rst | 130 + .../docs/reference/phpunit_integration.rst | 151 + .../docs/reference/protected_methods.rst | 26 + .../docs/reference/public_properties.rst | 20 + .../reference/public_static_properties.rst | 15 + .../mockery/mockery/docs/reference/spies.rst | 154 + vendor/mockery/mockery/library/Mockery.php | 950 + .../Phpunit/Legacy/TestListenerForV5.php | 47 + .../Phpunit/Legacy/TestListenerForV6.php | 51 + .../Phpunit/Legacy/TestListenerForV7.php | 55 + .../Phpunit/Legacy/TestListenerTrait.php | 90 + .../Phpunit/MockeryPHPUnitIntegration.php | 88 + .../Adapter/Phpunit/MockeryTestCase.php | 26 + .../Mockery/Adapter/Phpunit/TestListener.php | 35 + .../library/Mockery/ClosureWrapper.php | 42 + .../library/Mockery/CompositeExpectation.php | 154 + .../mockery/library/Mockery/Configuration.php | 190 + .../mockery/library/Mockery/Container.php | 539 + .../Mockery/CountValidator/AtLeast.php | 62 + .../library/Mockery/CountValidator/AtMost.php | 51 + .../CountValidator/CountValidatorAbstract.php | 69 + .../library/Mockery/CountValidator/Exact.php | 54 + .../Mockery/CountValidator/Exception.php | 25 + .../mockery/library/Mockery/Exception.php | 25 + .../Exception/BadMethodCallException.php | 23 + .../Exception/InvalidArgumentException.php | 25 + .../Exception/InvalidCountException.php | 102 + .../Exception/InvalidOrderException.php | 83 + .../NoMatchingExpectationException.php | 70 + .../Mockery/Exception/RuntimeException.php | 25 + .../mockery/library/Mockery/Expectation.php | 872 + .../library/Mockery/ExpectationDirector.php | 218 + .../library/Mockery/ExpectationInterface.php | 46 + .../Mockery/ExpectsHigherOrderMessage.php | 38 + .../Mockery/Generator/CachingGenerator.php | 45 + .../Mockery/Generator/DefinedTargetClass.php | 108 + .../library/Mockery/Generator/Generator.php | 27 + .../library/Mockery/Generator/Method.php | 76 + .../Mockery/Generator/MockConfiguration.php | 579 + .../Generator/MockConfigurationBuilder.php | 176 + .../Mockery/Generator/MockDefinition.php | 51 + .../library/Mockery/Generator/Parameter.php | 110 + .../Pass/CallTypeHintPass.php | 47 + .../StringManipulation/Pass/ClassNamePass.php | 49 + .../StringManipulation/Pass/ClassPass.php | 52 + .../StringManipulation/Pass/ConstantsPass.php | 33 + .../Pass/InstanceMockPass.php | 83 + .../StringManipulation/Pass/InterfacePass.php | 48 + .../Pass/MagicMethodTypeHintsPass.php | 208 + .../Pass/MethodDefinitionPass.php | 175 + .../StringManipulation/Pass/Pass.php | 28 + .../RemoveBuiltinMethodsThatAreFinalPass.php | 53 + .../Pass/RemoveDestructorPass.php | 45 + ...lizeForInternalSerializableClassesPass.php | 58 + .../StringManipulation/Pass/TraitPass.php | 47 + .../Generator/StringManipulationGenerator.php | 87 + .../Generator/TargetClassInterface.php | 107 + .../Generator/UndefinedTargetClass.php | 89 + .../library/Mockery/HigherOrderMessage.php | 49 + .../mockery/library/Mockery/Instantiator.php | 209 + .../library/Mockery/Loader/EvalLoader.php | 36 + .../mockery/library/Mockery/Loader/Loader.php | 28 + .../library/Mockery/Loader/RequireLoader.php | 46 + .../Mockery/Matcher/AndAnyOtherArgs.php | 45 + .../mockery/library/Mockery/Matcher/Any.php | 45 + .../library/Mockery/Matcher/AnyArgs.php | 40 + .../mockery/library/Mockery/Matcher/AnyOf.php | 46 + .../Mockery/Matcher/ArgumentListMatcher.php | 25 + .../library/Mockery/Matcher/Closure.php | 47 + .../library/Mockery/Matcher/Contains.php | 64 + .../library/Mockery/Matcher/Ducktype.php | 53 + .../library/Mockery/Matcher/HasKey.php | 45 + .../library/Mockery/Matcher/HasValue.php | 46 + .../Mockery/Matcher/MatcherAbstract.php | 58 + .../Mockery/Matcher/MultiArgumentClosure.php | 49 + .../library/Mockery/Matcher/MustBe.php | 52 + .../library/Mockery/Matcher/NoArgs.php | 40 + .../mockery/library/Mockery/Matcher/Not.php | 46 + .../library/Mockery/Matcher/NotAnyOf.php | 51 + .../Mockery/Matcher/PHPUnitConstraint.php | 76 + .../library/Mockery/Matcher/Pattern.php | 45 + .../library/Mockery/Matcher/Subset.php | 92 + .../mockery/library/Mockery/Matcher/Type.php | 52 + .../mockery/library/Mockery/MethodCall.php | 43 + .../mockery/mockery/library/Mockery/Mock.php | 935 + .../mockery/library/Mockery/MockInterface.php | 252 + .../library/Mockery/ReceivedMethodCalls.php | 48 + .../mockery/library/Mockery/Undefined.php | 46 + .../library/Mockery/VerificationDirector.php | 107 + .../Mockery/VerificationExpectation.php | 35 + vendor/mockery/mockery/library/helpers.php | 66 + vendor/mockery/mockery/phpunit.xml.dist | 36 + vendor/mockery/mockery/tests/Bootstrap.php | 66 + .../Phpunit/MockeryPHPUnitIntegrationTest.php | 63 + .../Adapter/Phpunit/TestListenerTest.php | 103 + .../mockery/tests/Mockery/AdhocTest.php | 119 + .../tests/Mockery/AllowsExpectsSyntaxTest.php | 111 + .../mockery/tests/Mockery/CallableSpyTest.php | 199 + .../mockery/tests/Mockery/ContainerTest.php | 1825 ++ .../tests/Mockery/DemeterChainTest.php | 204 + .../Mockery/DummyClasses/DemeterChain.php | 54 + .../tests/Mockery/DummyClasses/Namespaced.php | 35 + .../mockery/tests/Mockery/ExpectationTest.php | 2251 ++ .../Fixtures/ClassWithAllLowerCaseMethod.php | 30 + .../Mockery/Fixtures/ClassWithConstants.php | 29 + .../Mockery/Fixtures/EmptyTestCaseV5.php | 30 + .../Mockery/Fixtures/EmptyTestCaseV6.php | 33 + .../Mockery/Fixtures/EmptyTestCaseV7.php | 33 + .../Fixtures/MethodWithHHVMReturnType.php | 57 + .../Fixtures/MethodWithIterableTypeHints.php | 29 + .../Fixtures/MethodWithNullableReturnType.php | 67 + .../MethodWithNullableTypedParameter.php | 37 + .../MethodWithParametersWithDefaultValues.php | 33 + .../Fixtures/MethodWithVoidReturnType.php | 29 + .../Fixtures/SemiReservedWordsAsMethods.php | 71 + .../Generator/DefinedTargetClassTest.php | 45 + .../MockConfigurationBuilderTest.php | 85 + .../Generator/MockConfigurationTest.php | 218 + .../Pass/CallTypeHintPassTest.php | 59 + .../Pass/ClassNamePassTest.php | 78 + .../Pass/ConstantsPassTest.php | 52 + .../Pass/InstanceMockPassTest.php | 45 + .../Pass/InterfacePassTest.php | 66 + .../tests/Mockery/GlobalHelpersTest.php | 63 + .../tests/Mockery/HamcrestExpectationTest.php | 62 + .../tests/Mockery/Loader/EvalLoaderTest.php | 35 + .../tests/Mockery/Loader/LoaderTestCase.php | 47 + .../Mockery/Loader/RequireLoaderTest.php | 35 + .../Mockery/Matcher/PHPUnitConstraintTest.php | 95 + .../tests/Mockery/Matcher/SubsetTest.php | 97 + .../Mockery/MockClassWithFinalWakeupTest.php | 94 + .../MockClassWithMethodOverloadingTest.php | 43 + .../MockClassWithUnknownTypeHintTest.php | 43 + .../mockery/tests/Mockery/MockTest.php | 219 + ...anMockClassesWithSemiReservedWordsTest.php | 28 + ...MockMultipleInterfacesWhichOverlapTest.php | 65 + .../MockingAllLowerCasedMethodsTest.php | 43 + .../Mockery/MockingClassConstantsTest.php | 43 + .../tests/Mockery/MockingHHVMMethodsTest.php | 107 + ...ockingMethodsWithIterableTypeHintsTest.php | 39 + ...ckingMethodsWithNullableParametersTest.php | 52 + .../Mockery/MockingNullableMethodsTest.php | 217 + .../Mockery/MockingProtectedMethodsTest.php | 133 + .../Mockery/MockingVariadicArgumentsTest.php | 45 + .../tests/Mockery/MockingVoidMethodsTest.php | 53 + .../mockery/tests/Mockery/NamedMockTest.php | 86 + .../mockery/mockery/tests/Mockery/SpyTest.php | 152 + .../mockery/tests/Mockery/Stubs/Animal.php | 29 + .../mockery/tests/Mockery/Stubs/Habitat.php | 26 + .../mockery/tests/Mockery/TraitsTest.php | 72 + .../Mockery/WithFormatterExpectationTest.php | 123 + .../mockery/tests/Mockery/_files/file.txt | 0 .../PHP56/MockingOldStyleConstructorTest.php | 44 + .../Pass/MagicMethodTypeHintsPassTest.php | 392 + .../MockingParameterAndReturnTypesTest.php | 177 + .../tests/PHP72/Php72LanguageFeaturesTest.php | 45 + vendor/monolog/monolog/.php_cs | 59 + vendor/monolog/monolog/CHANGELOG.md | 370 + vendor/monolog/monolog/LICENSE | 19 + vendor/monolog/monolog/README.md | 94 + vendor/monolog/monolog/composer.json | 66 + vendor/monolog/monolog/doc/01-usage.md | 231 + .../doc/02-handlers-formatters-processors.md | 158 + vendor/monolog/monolog/doc/03-utilities.md | 15 + vendor/monolog/monolog/doc/04-extending.md | 76 + vendor/monolog/monolog/doc/sockets.md | 39 + vendor/monolog/monolog/phpunit.xml.dist | 19 + .../monolog/src/Monolog/ErrorHandler.php | 239 + .../Monolog/Formatter/ChromePHPFormatter.php | 78 + .../Monolog/Formatter/ElasticaFormatter.php | 89 + .../Monolog/Formatter/FlowdockFormatter.php | 116 + .../Monolog/Formatter/FluentdFormatter.php | 86 + .../Monolog/Formatter/FormatterInterface.php | 36 + .../Formatter/GelfMessageFormatter.php | 138 + .../src/Monolog/Formatter/HtmlFormatter.php | 141 + .../src/Monolog/Formatter/JsonFormatter.php | 214 + .../src/Monolog/Formatter/LineFormatter.php | 181 + .../src/Monolog/Formatter/LogglyFormatter.php | 47 + .../Monolog/Formatter/LogstashFormatter.php | 166 + .../Monolog/Formatter/MongoDBFormatter.php | 107 + .../Monolog/Formatter/NormalizerFormatter.php | 314 + .../src/Monolog/Formatter/ScalarFormatter.php | 48 + .../Monolog/Formatter/WildfireFormatter.php | 113 + .../src/Monolog/Handler/AbstractHandler.php | 196 + .../Handler/AbstractProcessingHandler.php | 68 + .../Monolog/Handler/AbstractSyslogHandler.php | 101 + .../src/Monolog/Handler/AmqpHandler.php | 148 + .../Monolog/Handler/BrowserConsoleHandler.php | 240 + .../src/Monolog/Handler/BufferHandler.php | 129 + .../src/Monolog/Handler/ChromePHPHandler.php | 211 + .../src/Monolog/Handler/CouchDBHandler.php | 72 + .../src/Monolog/Handler/CubeHandler.php | 151 + .../monolog/src/Monolog/Handler/Curl/Util.php | 57 + .../Monolog/Handler/DeduplicationHandler.php | 169 + .../Handler/DoctrineCouchDBHandler.php | 45 + .../src/Monolog/Handler/DynamoDbHandler.php | 107 + .../Monolog/Handler/ElasticSearchHandler.php | 128 + .../src/Monolog/Handler/ErrorLogHandler.php | 82 + .../src/Monolog/Handler/FilterHandler.php | 140 + .../ActivationStrategyInterface.php | 28 + .../ChannelLevelActivationStrategy.php | 59 + .../ErrorLevelActivationStrategy.php | 34 + .../Monolog/Handler/FingersCrossedHandler.php | 177 + .../src/Monolog/Handler/FirePHPHandler.php | 195 + .../src/Monolog/Handler/FleepHookHandler.php | 126 + .../src/Monolog/Handler/FlowdockHandler.php | 127 + .../src/Monolog/Handler/GelfHandler.php | 65 + .../src/Monolog/Handler/GroupHandler.php | 116 + .../src/Monolog/Handler/HandlerInterface.php | 90 + .../src/Monolog/Handler/HandlerWrapper.php | 116 + .../src/Monolog/Handler/HipChatHandler.php | 365 + .../src/Monolog/Handler/IFTTTHandler.php | 69 + .../src/Monolog/Handler/InsightOpsHandler.php | 62 + .../src/Monolog/Handler/LogEntriesHandler.php | 55 + .../src/Monolog/Handler/LogglyHandler.php | 102 + .../src/Monolog/Handler/MailHandler.php | 67 + .../src/Monolog/Handler/MandrillHandler.php | 68 + .../Handler/MissingExtensionException.php | 21 + .../src/Monolog/Handler/MongoDBHandler.php | 59 + .../Monolog/Handler/NativeMailerHandler.php | 185 + .../src/Monolog/Handler/NewRelicHandler.php | 204 + .../src/Monolog/Handler/NullHandler.php | 45 + .../src/Monolog/Handler/PHPConsoleHandler.php | 242 + .../src/Monolog/Handler/PsrHandler.php | 56 + .../src/Monolog/Handler/PushoverHandler.php | 185 + .../src/Monolog/Handler/RavenHandler.php | 232 + .../src/Monolog/Handler/RedisHandler.php | 97 + .../src/Monolog/Handler/RollbarHandler.php | 144 + .../Monolog/Handler/RotatingFileHandler.php | 190 + .../src/Monolog/Handler/SamplingHandler.php | 82 + .../src/Monolog/Handler/Slack/SlackRecord.php | 294 + .../src/Monolog/Handler/SlackHandler.php | 220 + .../Monolog/Handler/SlackWebhookHandler.php | 120 + .../src/Monolog/Handler/SlackbotHandler.php | 80 + .../src/Monolog/Handler/SocketHandler.php | 385 + .../src/Monolog/Handler/StreamHandler.php | 176 + .../Monolog/Handler/SwiftMailerHandler.php | 111 + .../src/Monolog/Handler/SyslogHandler.php | 67 + .../Monolog/Handler/SyslogUdp/UdpSocket.php | 56 + .../src/Monolog/Handler/SyslogUdpHandler.php | 103 + .../src/Monolog/Handler/TestHandler.php | 164 + .../Handler/WhatFailureGroupHandler.php | 71 + .../Monolog/Handler/ZendMonitorHandler.php | 95 + vendor/monolog/monolog/src/Monolog/Logger.php | 791 + .../src/Monolog/Processor/GitProcessor.php | 64 + .../Processor/IntrospectionProcessor.php | 112 + .../Processor/MemoryPeakUsageProcessor.php | 35 + .../src/Monolog/Processor/MemoryProcessor.php | 63 + .../Processor/MemoryUsageProcessor.php | 35 + .../Monolog/Processor/MercurialProcessor.php | 63 + .../Monolog/Processor/ProcessIdProcessor.php | 31 + .../Monolog/Processor/ProcessorInterface.php | 25 + .../Processor/PsrLogMessageProcessor.php | 50 + .../src/Monolog/Processor/TagProcessor.php | 44 + .../src/Monolog/Processor/UidProcessor.php | 59 + .../src/Monolog/Processor/WebProcessor.php | 113 + .../monolog/monolog/src/Monolog/Registry.php | 134 + .../src/Monolog/ResettableInterface.php | 31 + .../monolog/src/Monolog/SignalHandler.php | 115 + vendor/monolog/monolog/src/Monolog/Utils.php | 25 + .../tests/Monolog/ErrorHandlerTest.php | 31 + .../Formatter/ChromePHPFormatterTest.php | 158 + .../Formatter/ElasticaFormatterTest.php | 79 + .../Formatter/FlowdockFormatterTest.php | 55 + .../Formatter/FluentdFormatterTest.php | 62 + .../Formatter/GelfMessageFormatterTest.php | 258 + .../Monolog/Formatter/JsonFormatterTest.php | 219 + .../Monolog/Formatter/LineFormatterTest.php | 222 + .../Monolog/Formatter/LogglyFormatterTest.php | 40 + .../Formatter/LogstashFormatterTest.php | 333 + .../Formatter/MongoDBFormatterTest.php | 262 + .../Formatter/NormalizerFormatterTest.php | 481 + .../Monolog/Formatter/ScalarFormatterTest.php | 110 + .../Formatter/WildfireFormatterTest.php | 142 + .../Monolog/Handler/AbstractHandlerTest.php | 115 + .../Handler/AbstractProcessingHandlerTest.php | 80 + .../tests/Monolog/Handler/AmqpHandlerTest.php | 136 + .../Handler/BrowserConsoleHandlerTest.php | 130 + .../Monolog/Handler/BufferHandlerTest.php | 158 + .../Monolog/Handler/ChromePHPHandlerTest.php | 156 + .../Monolog/Handler/CouchDBHandlerTest.php | 31 + .../Handler/DeduplicationHandlerTest.php | 165 + .../Handler/DoctrineCouchDBHandlerTest.php | 52 + .../Monolog/Handler/DynamoDbHandlerTest.php | 82 + .../Handler/ElasticSearchHandlerTest.php | 239 + .../Monolog/Handler/ErrorLogHandlerTest.php | 66 + .../Monolog/Handler/FilterHandlerTest.php | 170 + .../Handler/FingersCrossedHandlerTest.php | 279 + .../Monolog/Handler/FirePHPHandlerTest.php | 96 + .../tests/Monolog/Handler/Fixtures/.gitkeep | 0 .../Monolog/Handler/FleepHookHandlerTest.php | 85 + .../Monolog/Handler/FlowdockHandlerTest.php | 88 + .../Monolog/Handler/GelfHandlerLegacyTest.php | 95 + .../tests/Monolog/Handler/GelfHandlerTest.php | 117 + .../Handler/GelfMockMessagePublisher.php | 25 + .../Monolog/Handler/GroupHandlerTest.php | 112 + .../Monolog/Handler/HandlerWrapperTest.php | 130 + .../Monolog/Handler/HipChatHandlerTest.php | 279 + .../Monolog/Handler/InsightOpsHandlerTest.php | 80 + .../Monolog/Handler/LogEntriesHandlerTest.php | 84 + .../tests/Monolog/Handler/MailHandlerTest.php | 75 + .../tests/Monolog/Handler/MockRavenClient.php | 27 + .../Monolog/Handler/MongoDBHandlerTest.php | 65 + .../Handler/NativeMailerHandlerTest.php | 111 + .../Monolog/Handler/NewRelicHandlerTest.php | 200 + .../tests/Monolog/Handler/NullHandlerTest.php | 33 + .../Monolog/Handler/PHPConsoleHandlerTest.php | 273 + .../tests/Monolog/Handler/PsrHandlerTest.php | 50 + .../Monolog/Handler/PushoverHandlerTest.php | 141 + .../Monolog/Handler/RavenHandlerTest.php | 255 + .../Monolog/Handler/RedisHandlerTest.php | 127 + .../Monolog/Handler/RollbarHandlerTest.php | 84 + .../Handler/RotatingFileHandlerTest.php | 245 + .../Monolog/Handler/SamplingHandlerTest.php | 33 + .../Monolog/Handler/Slack/SlackRecordTest.php | 395 + .../Monolog/Handler/SlackHandlerTest.php | 155 + .../Handler/SlackWebhookHandlerTest.php | 107 + .../Monolog/Handler/SlackbotHandlerTest.php | 47 + .../Monolog/Handler/SocketHandlerTest.php | 335 + .../Monolog/Handler/StreamHandlerTest.php | 184 + .../Handler/SwiftMailerHandlerTest.php | 113 + .../Monolog/Handler/SyslogHandlerTest.php | 44 + .../Monolog/Handler/SyslogUdpHandlerTest.php | 76 + .../tests/Monolog/Handler/TestHandlerTest.php | 116 + .../tests/Monolog/Handler/UdpSocketTest.php | 64 + .../Handler/WhatFailureGroupHandlerTest.php | 144 + .../Handler/ZendMonitorHandlerTest.php | 69 + .../monolog/tests/Monolog/LoggerTest.php | 690 + .../Monolog/Processor/GitProcessorTest.php | 29 + .../Processor/IntrospectionProcessorTest.php | 123 + .../MemoryPeakUsageProcessorTest.php | 42 + .../Processor/MemoryUsageProcessorTest.php | 42 + .../Processor/MercurialProcessorTest.php | 41 + .../Processor/ProcessIdProcessorTest.php | 30 + .../Processor/PsrLogMessageProcessorTest.php | 43 + .../Monolog/Processor/TagProcessorTest.php | 49 + .../Monolog/Processor/UidProcessorTest.php | 33 + .../Monolog/Processor/WebProcessorTest.php | 113 + .../tests/Monolog/PsrLogCompatTest.php | 47 + .../monolog/tests/Monolog/RegistryTest.php | 153 + .../tests/Monolog/SignalHandlerTest.php | 287 + .../monolog/tests/Monolog/TestCase.php | 58 + vendor/myclabs/deep-copy/.gitattributes | 7 + vendor/myclabs/deep-copy/.gitignore | 3 + vendor/myclabs/deep-copy/.scrutinizer.yml | 4 + vendor/myclabs/deep-copy/.travis.yml | 40 + vendor/myclabs/deep-copy/LICENSE | 20 + vendor/myclabs/deep-copy/README.md | 376 + vendor/myclabs/deep-copy/composer.json | 38 + vendor/myclabs/deep-copy/doc/clone.png | Bin 0 -> 12380 bytes vendor/myclabs/deep-copy/doc/deep-clone.png | Bin 0 -> 14009 bytes vendor/myclabs/deep-copy/doc/deep-copy.png | Bin 0 -> 10895 bytes vendor/myclabs/deep-copy/doc/graph.png | Bin 0 -> 6436 bytes vendor/myclabs/deep-copy/fixtures/f001/A.php | 20 + vendor/myclabs/deep-copy/fixtures/f001/B.php | 20 + vendor/myclabs/deep-copy/fixtures/f002/A.php | 33 + .../myclabs/deep-copy/fixtures/f003/Foo.php | 26 + .../fixtures/f004/UnclonableItem.php | 13 + .../myclabs/deep-copy/fixtures/f005/Foo.php | 13 + vendor/myclabs/deep-copy/fixtures/f006/A.php | 26 + vendor/myclabs/deep-copy/fixtures/f006/B.php | 26 + .../fixtures/f007/FooDateInterval.php | 15 + .../fixtures/f007/FooDateTimeZone.php | 15 + vendor/myclabs/deep-copy/fixtures/f008/A.php | 18 + vendor/myclabs/deep-copy/fixtures/f008/B.php | 7 + .../deep-copy/src/DeepCopy/DeepCopy.php | 281 + .../src/DeepCopy/Exception/CloneException.php | 9 + .../DeepCopy/Exception/PropertyException.php | 9 + .../Doctrine/DoctrineCollectionFilter.php | 33 + .../DoctrineEmptyCollectionFilter.php | 28 + .../Filter/Doctrine/DoctrineProxyFilter.php | 22 + .../deep-copy/src/DeepCopy/Filter/Filter.php | 18 + .../src/DeepCopy/Filter/KeepFilter.php | 16 + .../src/DeepCopy/Filter/ReplaceFilter.php | 39 + .../src/DeepCopy/Filter/SetNullFilter.php | 24 + .../Matcher/Doctrine/DoctrineProxyMatcher.php | 22 + .../src/DeepCopy/Matcher/Matcher.php | 14 + .../src/DeepCopy/Matcher/PropertyMatcher.php | 39 + .../DeepCopy/Matcher/PropertyNameMatcher.php | 32 + .../DeepCopy/Matcher/PropertyTypeMatcher.php | 46 + .../DeepCopy/Reflection/ReflectionHelper.php | 78 + .../TypeFilter/Date/DateIntervalFilter.php | 33 + .../src/DeepCopy/TypeFilter/ReplaceFilter.php | 30 + .../DeepCopy/TypeFilter/ShallowCopyFilter.php | 17 + .../TypeFilter/Spl/SplDoublyLinkedList.php | 10 + .../Spl/SplDoublyLinkedListFilter.php | 51 + .../src/DeepCopy/TypeFilter/TypeFilter.php | 13 + .../src/DeepCopy/TypeMatcher/TypeMatcher.php | 29 + .../deep-copy/src/DeepCopy/deep_copy.php | 20 + vendor/nesbot/carbon/LICENSE | 19 + vendor/nesbot/carbon/composer.json | 63 + vendor/nesbot/carbon/readme.md | 94 + vendor/nesbot/carbon/src/Carbon/Carbon.php | 4942 +++ .../carbon/src/Carbon/CarbonInterval.php | 1155 + .../nesbot/carbon/src/Carbon/CarbonPeriod.php | 1445 + .../Exceptions/InvalidDateException.php | 67 + vendor/nesbot/carbon/src/Carbon/Lang/af.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/ar.php | 31 + .../carbon/src/Carbon/Lang/ar_Shakl.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/az.php | 40 + vendor/nesbot/carbon/src/Carbon/Lang/bg.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/bn.php | 38 + .../nesbot/carbon/src/Carbon/Lang/bs_BA.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/ca.php | 40 + vendor/nesbot/carbon/src/Carbon/Lang/cs.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/cy.php | 29 + vendor/nesbot/carbon/src/Carbon/Lang/da.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/de.php | 46 + .../nesbot/carbon/src/Carbon/Lang/dv_MV.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/el.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/en.php | 40 + vendor/nesbot/carbon/src/Carbon/Lang/eo.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/es.php | 36 + vendor/nesbot/carbon/src/Carbon/Lang/et.php | 38 + vendor/nesbot/carbon/src/Carbon/Lang/eu.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/fa.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/fi.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/fo.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/fr.php | 40 + vendor/nesbot/carbon/src/Carbon/Lang/gl.php | 24 + vendor/nesbot/carbon/src/Carbon/Lang/gu.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/he.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/hi.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/hr.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/hu.php | 52 + vendor/nesbot/carbon/src/Carbon/Lang/hy.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/id.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/is.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/it.php | 36 + vendor/nesbot/carbon/src/Carbon/Lang/ja.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/ka.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/kk.php | 29 + vendor/nesbot/carbon/src/Carbon/Lang/km.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/ko.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/lt.php | 38 + vendor/nesbot/carbon/src/Carbon/Lang/lv.php | 47 + vendor/nesbot/carbon/src/Carbon/Lang/mk.php | 24 + vendor/nesbot/carbon/src/Carbon/Lang/mn.php | 62 + vendor/nesbot/carbon/src/Carbon/Lang/ms.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/my.php | 37 + vendor/nesbot/carbon/src/Carbon/Lang/ne.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/nl.php | 36 + vendor/nesbot/carbon/src/Carbon/Lang/no.php | 36 + vendor/nesbot/carbon/src/Carbon/Lang/oc.php | 44 + vendor/nesbot/carbon/src/Carbon/Lang/pl.php | 36 + vendor/nesbot/carbon/src/Carbon/Lang/ps.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/pt.php | 31 + .../nesbot/carbon/src/Carbon/Lang/pt_BR.php | 40 + vendor/nesbot/carbon/src/Carbon/Lang/ro.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/ru.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/sh.php | 35 + vendor/nesbot/carbon/src/Carbon/Lang/sk.php | 38 + vendor/nesbot/carbon/src/Carbon/Lang/sl.php | 43 + vendor/nesbot/carbon/src/Carbon/Lang/sq.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/sr.php | 37 + .../nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php | 43 + .../carbon/src/Carbon/Lang/sr_Cyrl_ME.php | 43 + .../carbon/src/Carbon/Lang/sr_Latn_ME.php | 43 + .../nesbot/carbon/src/Carbon/Lang/sr_ME.php | 12 + vendor/nesbot/carbon/src/Carbon/Lang/sv.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/sw.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/th.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/tr.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/uk.php | 40 + vendor/nesbot/carbon/src/Carbon/Lang/ur.php | 24 + vendor/nesbot/carbon/src/Carbon/Lang/uz.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/vi.php | 31 + vendor/nesbot/carbon/src/Carbon/Lang/zh.php | 31 + .../nesbot/carbon/src/Carbon/Lang/zh_TW.php | 31 + .../src/Carbon/Laravel/ServiceProvider.php | 37 + .../nesbot/carbon/src/Carbon/Translator.php | 143 + vendor/nesbot/carbon/src/JsonSerializable.php | 18 + vendor/nexmo/client/LICENSE.txt | 15 + vendor/nexmo/client/composer.json | 41 + .../nexmo/client/examples/fetch_recording.php | 12 + vendor/nexmo/client/examples/send.php | 72 + vendor/nexmo/client/phpcs.xml | 5 + vendor/nexmo/client/src/Account/Balance.php | 59 + vendor/nexmo/client/src/Account/Client.php | 228 + .../nexmo/client/src/Account/PrefixPrice.php | 13 + vendor/nexmo/client/src/Account/Price.php | 144 + vendor/nexmo/client/src/Account/Secret.php | 56 + .../client/src/Account/SecretCollection.php | 51 + vendor/nexmo/client/src/Account/SmsPrice.php | 7 + .../nexmo/client/src/Account/VoicePrice.php | 7 + vendor/nexmo/client/src/ApiErrorHandler.php | 39 + .../client/src/Application/Application.php | 121 + .../src/Application/ApplicationInterface.php | 16 + .../nexmo/client/src/Application/Client.php | 207 + .../nexmo/client/src/Application/Filter.php | 39 + .../client/src/Application/VoiceConfig.php | 34 + .../nexmo/client/src/Application/Webhook.php | 46 + vendor/nexmo/client/src/Call/Call.php | 301 + vendor/nexmo/client/src/Call/Collection.php | 203 + vendor/nexmo/client/src/Call/Dtmf.php | 139 + vendor/nexmo/client/src/Call/Earmuff.php | 20 + vendor/nexmo/client/src/Call/Endpoint.php | 87 + vendor/nexmo/client/src/Call/Event.php | 53 + vendor/nexmo/client/src/Call/Filter.php | 81 + vendor/nexmo/client/src/Call/Hangup.php | 21 + vendor/nexmo/client/src/Call/Mute.php | 20 + vendor/nexmo/client/src/Call/Stream.php | 127 + vendor/nexmo/client/src/Call/Talk.php | 162 + vendor/nexmo/client/src/Call/Transfer.php | 35 + vendor/nexmo/client/src/Call/Unearmuff.php | 20 + vendor/nexmo/client/src/Call/Unmute.php | 20 + vendor/nexmo/client/src/Call/Webhook.php | 55 + vendor/nexmo/client/src/Client.php | 510 + .../client/src/Client/Callback/Callback.php | 57 + .../src/Client/Callback/CallbackInterface.php | 14 + .../src/Client/ClientAwareInterface.php | 16 + .../client/src/Client/ClientAwareTrait.php | 33 + .../Credentials/AbstractCredentials.php | 53 + .../client/src/Client/Credentials/Basic.php | 28 + .../src/Client/Credentials/Container.php | 69 + .../Credentials/CredentialsInterface.php | 14 + .../client/src/Client/Credentials/Keypair.php | 82 + .../client/src/Client/Credentials/OAuth.php | 26 + .../Client/Credentials/SignatureSecret.php | 25 + .../client/src/Client/Exception/Exception.php | 14 + .../client/src/Client/Exception/Request.php | 16 + .../client/src/Client/Exception/Server.php | 16 + .../client/src/Client/Exception/Transport.php | 14 + .../src/Client/Exception/Validation.php | 24 + .../src/Client/Factory/FactoryInterface.php | 30 + .../client/src/Client/Factory/MapFactory.php | 68 + .../src/Client/Request/AbstractRequest.php | 22 + .../src/Client/Request/RequestInterface.php | 21 + .../Client/Request/WrapResponseInterface.php | 20 + .../src/Client/Response/AbstractResponse.php | 30 + .../client/src/Client/Response/Error.php | 45 + .../client/src/Client/Response/Response.php | 30 + .../src/Client/Response/ResponseInterface.php | 17 + vendor/nexmo/client/src/Client/Signature.php | 136 + .../client/src/Conversations/Collection.php | 178 + .../client/src/Conversations/Conversation.php | 182 + vendor/nexmo/client/src/Conversion/Client.php | 63 + .../client/src/Entity/ArrayAccessTrait.php | 16 + .../src/Entity/CollectionAwareInterface.php | 23 + .../src/Entity/CollectionAwareTrait.php | 31 + .../client/src/Entity/CollectionInterface.php | 30 + .../client/src/Entity/CollectionTrait.php | 250 + .../nexmo/client/src/Entity/EmptyFilter.php | 18 + .../client/src/Entity/EntityInterface.php | 26 + .../client/src/Entity/FilterInterface.php | 15 + .../client/src/Entity/HasEntityTrait.php | 24 + .../client/src/Entity/JsonResponseTrait.php | 39 + .../src/Entity/JsonSerializableInterface.php | 14 + .../src/Entity/JsonSerializableTrait.php | 45 + .../Entity/JsonUnserializableInterface.php | 22 + .../src/Entity/NoRequestResponseTrait.php | 37 + vendor/nexmo/client/src/Entity/Psr7Trait.php | 53 + .../client/src/Entity/RequestArrayTrait.php | 74 + vendor/nexmo/client/src/Insights/Advanced.php | 15 + .../client/src/Insights/AdvancedCnam.php | 7 + vendor/nexmo/client/src/Insights/Basic.php | 102 + vendor/nexmo/client/src/Insights/Client.php | 118 + .../nexmo/client/src/Insights/CnamTrait.php | 25 + vendor/nexmo/client/src/Insights/Standard.php | 25 + .../client/src/Insights/StandardCnam.php | 7 + .../client/src/InvalidResponseException.php | 7 + .../nexmo/client/src/Message/AutoDetect.php | 38 + vendor/nexmo/client/src/Message/Binary.php | 55 + .../client/src/Message/Callback/Receipt.php | 139 + vendor/nexmo/client/src/Message/Client.php | 324 + .../client/src/Message/CollectionTrait.php | 12 + .../client/src/Message/EncodingDetector.php | 53 + .../client/src/Message/InboundMessage.php | 237 + vendor/nexmo/client/src/Message/Message.php | 375 + .../client/src/Message/MessageInterface.php | 14 + vendor/nexmo/client/src/Message/Query.php | 18 + .../src/Message/Response/Collection.php | 125 + .../client/src/Message/Response/Message.php | 121 + vendor/nexmo/client/src/Message/Text.php | 37 + vendor/nexmo/client/src/Message/Unicode.php | 46 + vendor/nexmo/client/src/Message/Vcal.php | 46 + vendor/nexmo/client/src/Message/Vcard.php | 46 + vendor/nexmo/client/src/Message/Wap.php | 64 + vendor/nexmo/client/src/Network.php | 97 + .../client/src/Network/Number/Callback.php | 94 + .../client/src/Network/Number/Request.php | 61 + .../client/src/Network/Number/Response.php | 100 + vendor/nexmo/client/src/Numbers/Client.php | 290 + vendor/nexmo/client/src/Numbers/Number.php | 191 + vendor/nexmo/client/src/Redact/Client.php | 78 + vendor/nexmo/client/src/Response.php | 121 + vendor/nexmo/client/src/Response/Message.php | 72 + vendor/nexmo/client/src/User/Collection.php | 194 + vendor/nexmo/client/src/User/User.php | 138 + vendor/nexmo/client/src/Verify/Check.php | 48 + vendor/nexmo/client/src/Verify/Client.php | 231 + .../nexmo/client/src/Verify/Verification.php | 596 + .../src/Verify/VerificationInterface.php | 22 + vendor/nexmo/client/src/Voice/Call/Call.php | 82 + .../nexmo/client/src/Voice/Call/Inbound.php | 15 + .../client/src/Voice/Message/Callback.php | 86 + .../client/src/Voice/Message/Message.php | 73 + vendor/opis/closure/CHANGELOG.md | 157 + vendor/opis/closure/LICENSE | 20 + vendor/opis/closure/NOTICE | 9 + vendor/opis/closure/README.md | 98 + vendor/opis/closure/autoload.php | 39 + vendor/opis/closure/composer.json | 40 + vendor/opis/closure/functions.php | 38 + vendor/opis/closure/src/Analyzer.php | 59 + vendor/opis/closure/src/ClosureContext.php | 33 + vendor/opis/closure/src/ClosureScope.php | 25 + vendor/opis/closure/src/ClosureStream.php | 91 + vendor/opis/closure/src/ISecurityProvider.php | 25 + vendor/opis/closure/src/ReflectionClosure.php | 860 + vendor/opis/closure/src/SecurityException.php | 18 + vendor/opis/closure/src/SecurityProvider.php | 42 + vendor/opis/closure/src/SelfReference.php | 30 + .../opis/closure/src/SerializableClosure.php | 622 + vendor/orchestra/testbench-core/composer.json | 53 + .../orchestra/testbench-core/create-sqlite-db | 8 + .../testbench-core/laravel/app/.gitkeep | 0 .../laravel/bootstrap/cache/.gitignore | 2 + .../testbench-core/laravel/composer.json | 30 + .../testbench-core/laravel/config/app.php | 216 + .../testbench-core/laravel/config/auth.php | 106 + .../laravel/config/broadcasting.php | 58 + .../testbench-core/laravel/config/cache.php | 96 + .../laravel/config/database.php | 137 + .../laravel/config/filesystems.php | 69 + .../testbench-core/laravel/config/hashing.php | 52 + .../testbench-core/laravel/config/logging.php | 92 + .../testbench-core/laravel/config/mail.php | 136 + .../testbench-core/laravel/config/queue.php | 86 + .../laravel/config/services.php | 43 + .../testbench-core/laravel/config/session.php | 199 + .../testbench-core/laravel/config/view.php | 36 + .../laravel/database/.gitignore | 1 + .../laravel/database/database.sqlite.example | 0 .../laravel/database/factories/.gitkeep | 0 .../laravel/database/migrations/.gitkeep | 0 .../2014_10_12_000000_create_users_table.php | 36 + ...12_100000_create_password_resets_table.php | 32 + .../testbench-core/laravel/public/.gitignore | 0 .../laravel/resources/lang/en/auth.php | 19 + .../laravel/resources/lang/en/pagination.php | 19 + .../laravel/resources/lang/en/passwords.php | 22 + .../laravel/resources/lang/en/validation.php | 149 + .../resources/views/errors/503.blade.php | 43 + .../laravel/resources/views/welcome.blade.php | 39 + .../laravel/storage/app/.gitignore | 0 .../laravel/storage/framework/.gitignore | 2 + .../storage/framework/cache/.gitignore | 3 + .../laravel/storage/framework/data/.gitignore | 2 + .../storage/framework/sessions/.gitignore | 2 + .../storage/framework/testing/.gitignore | 2 + .../storage/framework/views/.gitignore | 2 + .../laravel/storage/logs/.gitignore | 2 + .../testbench-core/laravel/vendor/.gitignore | 2 + .../src/Bootstrap/LoadConfiguration.php | 64 + .../src/Concerns/CreatesApplication.php | 333 + .../testbench-core/src/Concerns/Testing.php | 193 + .../src/Concerns/WithFactories.php | 35 + .../src/Concerns/WithLaravelMigrations.php | 33 + .../src/Concerns/WithLoadMigrationsFrom.php | 33 + .../testbench-core/src/Console/Kernel.php | 36 + .../testbench-core/src/Contracts/Laravel.php | 139 + .../testbench-core/src/Contracts/TestCase.php | 61 + .../src/Database/MigrateProcessor.php | 76 + .../testbench-core/src/Exceptions/Handler.php | 55 + .../testbench-core/src/Http/Kernel.php | 85 + .../src/Http/Middleware/Authenticate.php | 22 + .../Middleware/RedirectIfAuthenticated.php | 27 + .../src/Http/Middleware/TrimStrings.php | 18 + .../src/Http/Middleware/TrustProxies.php | 24 + .../src/Http/Middleware/VerifyCsrfToken.php | 24 + .../orchestra/testbench-core/src/TestCase.php | 87 + .../src/Traits/CreatesApplication.php | 14 + vendor/orchestra/testbench/CHANGELOG-3.7.md | 69 + vendor/orchestra/testbench/composer.json | 35 + vendor/paragonie/random_compat/LICENSE | 22 + vendor/paragonie/random_compat/build-phar.sh | 5 + vendor/paragonie/random_compat/composer.json | 34 + .../dist/random_compat.phar.pubkey | 5 + .../dist/random_compat.phar.pubkey.asc | 11 + vendor/paragonie/random_compat/lib/random.php | 32 + .../random_compat/other/build_phar.php | 57 + .../random_compat/psalm-autoload.php | 9 + vendor/paragonie/random_compat/psalm.xml | 19 + vendor/phar-io/manifest/.gitignore | 7 + vendor/phar-io/manifest/.php_cs | 67 + vendor/phar-io/manifest/.travis.yml | 33 + vendor/phar-io/manifest/LICENSE | 31 + vendor/phar-io/manifest/README.md | 30 + vendor/phar-io/manifest/build.xml | 50 + vendor/phar-io/manifest/composer.json | 42 + vendor/phar-io/manifest/composer.lock | 69 + .../phar-io/manifest/examples/example-01.php | 23 + vendor/phar-io/manifest/phive.xml | 4 + vendor/phar-io/manifest/phpunit.xml | 20 + .../manifest/src/ManifestDocumentMapper.php | 193 + .../phar-io/manifest/src/ManifestLoader.php | 66 + .../manifest/src/ManifestSerializer.php | 163 + .../manifest/src/exceptions/Exception.php | 14 + .../InvalidApplicationNameException.php | 16 + .../src/exceptions/InvalidEmailException.php | 14 + .../src/exceptions/InvalidUrlException.php | 14 + .../exceptions/ManifestDocumentException.php | 6 + .../ManifestDocumentMapperException.php | 6 + .../exceptions/ManifestElementException.php | 6 + .../exceptions/ManifestLoaderException.php | 6 + .../manifest/src/values/Application.php | 20 + .../manifest/src/values/ApplicationName.php | 65 + vendor/phar-io/manifest/src/values/Author.php | 57 + .../manifest/src/values/AuthorCollection.php | 43 + .../src/values/AuthorCollectionIterator.php | 56 + .../manifest/src/values/BundledComponent.php | 48 + .../src/values/BundledComponentCollection.php | 43 + .../BundledComponentCollectionIterator.php | 56 + .../src/values/CopyrightInformation.php | 42 + vendor/phar-io/manifest/src/values/Email.php | 47 + .../phar-io/manifest/src/values/Extension.php | 75 + .../phar-io/manifest/src/values/Library.php | 20 + .../phar-io/manifest/src/values/License.php | 42 + .../phar-io/manifest/src/values/Manifest.php | 138 + .../src/values/PhpExtensionRequirement.php | 32 + .../src/values/PhpVersionRequirement.php | 31 + .../manifest/src/values/Requirement.php | 14 + .../src/values/RequirementCollection.php | 43 + .../values/RequirementCollectionIterator.php | 56 + vendor/phar-io/manifest/src/values/Type.php | 60 + vendor/phar-io/manifest/src/values/Url.php | 47 + .../manifest/src/xml/AuthorElement.php | 21 + .../src/xml/AuthorElementCollection.php | 19 + .../manifest/src/xml/BundlesElement.php | 19 + .../manifest/src/xml/ComponentElement.php | 21 + .../src/xml/ComponentElementCollection.php | 19 + .../manifest/src/xml/ContainsElement.php | 31 + .../manifest/src/xml/CopyrightElement.php | 25 + .../manifest/src/xml/ElementCollection.php | 58 + .../phar-io/manifest/src/xml/ExtElement.php | 17 + .../manifest/src/xml/ExtElementCollection.php | 20 + .../manifest/src/xml/ExtensionElement.php | 21 + .../manifest/src/xml/LicenseElement.php | 21 + .../manifest/src/xml/ManifestDocument.php | 118 + .../xml/ManifestDocumentLoadingException.php | 48 + .../manifest/src/xml/ManifestElement.php | 100 + .../phar-io/manifest/src/xml/PhpElement.php | 27 + .../manifest/src/xml/RequiresElement.php | 19 + .../tests/ManifestDocumentMapperTest.php | 110 + .../manifest/tests/ManifestLoaderTest.php | 83 + .../manifest/tests/ManifestSerializerTest.php | 114 + .../manifest/tests/_fixture/custom.xml | 10 + .../_fixture/extension-invalidcompatible.xml | 13 + .../manifest/tests/_fixture/extension.xml | 13 + .../tests/_fixture/invalidversion.xml | 11 + .../_fixture/invalidversionconstraint.xml | 11 + .../manifest/tests/_fixture/library.xml | 11 + .../manifest/tests/_fixture/manifest.xml | 11 + .../manifest/tests/_fixture/phpunit-5.6.5.xml | 46 + .../phar-io/manifest/tests/_fixture/test.phar | Bin 0 -> 7165 bytes .../ManifestDocumentLoadingExceptionTest.php | 19 + .../tests/values/ApplicationNameTest.php | 57 + .../manifest/tests/values/ApplicationTest.php | 44 + .../tests/values/AuthorCollectionTest.php | 62 + .../manifest/tests/values/AuthorTest.php | 45 + .../values/BundledComponentCollectionTest.php | 63 + .../tests/values/BundledComponentTest.php | 42 + .../tests/values/CopyrightInformationTest.php | 62 + .../manifest/tests/values/EmailTest.php | 35 + .../manifest/tests/values/ExtensionTest.php | 109 + .../manifest/tests/values/LibraryTest.php | 44 + .../manifest/tests/values/LicenseTest.php | 41 + .../manifest/tests/values/ManifestTest.php | 187 + .../values/PhpExtensionRequirementTest.php | 26 + .../values/PhpVersionRequirementTest.php | 38 + .../values/RequirementCollectionTest.php | 63 + .../phar-io/manifest/tests/values/UrlTest.php | 35 + .../tests/xml/AuthorElementCollectionTest.php | 18 + .../manifest/tests/xml/AuthorElementTest.php | 25 + .../manifest/tests/xml/BundlesElementTest.php | 41 + .../xml/ComponentElementCollectionTest.php | 18 + .../tests/xml/ComponentElementTest.php | 25 + .../tests/xml/ContainsElementTest.php | 63 + .../tests/xml/CopyrightElementTest.php | 52 + .../tests/xml/ExtElementCollectionTest.php | 19 + .../manifest/tests/xml/ExtElementTest.php | 21 + .../tests/xml/ExtensionElementTest.php | 25 + .../manifest/tests/xml/LicenseElementTest.php | 25 + .../tests/xml/ManifestDocumentTest.php | 110 + .../manifest/tests/xml/PhpElementTest.php | 48 + .../tests/xml/RequiresElementTest.php | 37 + vendor/phar-io/version/.gitignore | 7 + vendor/phar-io/version/.php_cs | 67 + vendor/phar-io/version/.travis.yml | 33 + vendor/phar-io/version/CHANGELOG.md | 44 + vendor/phar-io/version/LICENSE | 31 + vendor/phar-io/version/README.md | 61 + vendor/phar-io/version/build.xml | 41 + vendor/phar-io/version/composer.json | 34 + vendor/phar-io/version/phive.xml | 5 + vendor/phar-io/version/phpunit.xml | 19 + .../phar-io/version/src/PreReleaseSuffix.php | 95 + vendor/phar-io/version/src/Version.php | 175 + .../version/src/VersionConstraintParser.php | 122 + .../version/src/VersionConstraintValue.php | 123 + vendor/phar-io/version/src/VersionNumber.php | 41 + .../constraints/AbstractVersionConstraint.php | 32 + .../constraints/AndVersionConstraintGroup.php | 43 + .../src/constraints/AnyVersionConstraint.php | 29 + .../constraints/ExactVersionConstraint.php | 22 + .../GreaterThanOrEqualToVersionConstraint.php | 38 + .../constraints/OrVersionConstraintGroup.php | 43 + ...SpecificMajorAndMinorVersionConstraint.php | 48 + .../SpecificMajorVersionConstraint.php | 37 + .../src/constraints/VersionConstraint.php | 26 + .../version/src/exceptions/Exception.php | 14 + .../InvalidPreReleaseSuffixException.php | 7 + .../exceptions/InvalidVersionException.php | 6 + .../UnsupportedVersionConstraintException.php | 14 + .../VersionConstraintParserTest.php | 146 + .../Unit/AbstractVersionConstraintTest.php | 25 + .../Unit/AndVersionConstraintGroupTest.php | 52 + .../tests/Unit/AnyVersionConstraintTest.php | 41 + .../tests/Unit/ExactVersionConstraintTest.php | 58 + ...aterThanOrEqualToVersionConstraintTest.php | 47 + .../Unit/OrVersionConstraintGroupTest.php | 65 + .../tests/Unit/PreReleaseSuffixTest.php | 46 + ...ificMajorAndMinorVersionConstraintTest.php | 45 + .../SpecificMajorVersionConstraintTest.php | 44 + .../version/tests/Unit/VersionTest.php | 113 + vendor/php-http/guzzle6-adapter/CHANGELOG.md | 66 + vendor/php-http/guzzle6-adapter/LICENSE | 20 + vendor/php-http/guzzle6-adapter/README.md | 59 + vendor/php-http/guzzle6-adapter/composer.json | 49 + vendor/php-http/guzzle6-adapter/puli.json | 16 + .../php-http/guzzle6-adapter/src/Client.php | 84 + .../php-http/guzzle6-adapter/src/Promise.php | 140 + vendor/php-http/httplug/CHANGELOG.md | 72 + vendor/php-http/httplug/LICENSE | 20 + vendor/php-http/httplug/README.md | 57 + vendor/php-http/httplug/composer.json | 40 + vendor/php-http/httplug/puli.json | 12 + vendor/php-http/httplug/src/Exception.php | 12 + .../httplug/src/Exception/HttpException.php | 74 + .../src/Exception/NetworkException.php | 14 + .../src/Exception/RequestException.php | 43 + .../src/Exception/TransferException.php | 14 + .../php-http/httplug/src/HttpAsyncClient.php | 27 + vendor/php-http/httplug/src/HttpClient.php | 28 + .../src/Promise/HttpFulfilledPromise.php | 57 + .../src/Promise/HttpRejectedPromise.php | 56 + vendor/php-http/promise/CHANGELOG.md | 35 + vendor/php-http/promise/LICENSE | 19 + vendor/php-http/promise/README.md | 49 + vendor/php-http/promise/composer.json | 35 + .../php-http/promise/src/FulfilledPromise.php | 58 + vendor/php-http/promise/src/Promise.php | 69 + .../php-http/promise/src/RejectedPromise.php | 58 + .../reflection-common/.travis.yml | 35 + .../phpdocumentor/reflection-common/LICENSE | 22 + .../phpdocumentor/reflection-common/README.md | 2 + .../reflection-common/composer.json | 29 + .../reflection-common/src/Element.php | 32 + .../reflection-common/src/File.php | 40 + .../reflection-common/src/Fqsen.php | 82 + .../reflection-common/src/Location.php | 57 + .../reflection-common/src/Project.php | 25 + .../reflection-common/src/ProjectFactory.php | 27 + .../reflection-docblock/.coveralls.yml | 3 + .../phpdocumentor/reflection-docblock/LICENSE | 21 + .../reflection-docblock/README.md | 67 + .../reflection-docblock/composer.json | 34 + .../easy-coding-standard.neon | 31 + .../reflection-docblock/src/DocBlock.php | 236 + .../src/DocBlock/Description.php | 114 + .../src/DocBlock/DescriptionFactory.php | 191 + .../src/DocBlock/ExampleFinder.php | 170 + .../src/DocBlock/Serializer.php | 155 + .../src/DocBlock/StandardTagFactory.php | 319 + .../reflection-docblock/src/DocBlock/Tag.php | 26 + .../src/DocBlock/TagFactory.php | 93 + .../src/DocBlock/Tags/Author.php | 100 + .../src/DocBlock/Tags/BaseTag.php | 52 + .../src/DocBlock/Tags/Covers.php | 83 + .../src/DocBlock/Tags/Deprecated.php | 97 + .../src/DocBlock/Tags/Example.php | 176 + .../DocBlock/Tags/Factory/StaticMethod.php | 18 + .../src/DocBlock/Tags/Factory/Strategy.php | 18 + .../src/DocBlock/Tags/Formatter.php | 27 + .../Tags/Formatter/AlignFormatter.php | 47 + .../Tags/Formatter/PassthroughFormatter.php | 31 + .../src/DocBlock/Tags/Generic.php | 91 + .../src/DocBlock/Tags/Link.php | 77 + .../src/DocBlock/Tags/Method.php | 242 + .../src/DocBlock/Tags/Param.php | 141 + .../src/DocBlock/Tags/Property.php | 118 + .../src/DocBlock/Tags/PropertyRead.php | 118 + .../src/DocBlock/Tags/PropertyWrite.php | 118 + .../src/DocBlock/Tags/Reference/Fqsen.php | 42 + .../src/DocBlock/Tags/Reference/Reference.php | 21 + .../src/DocBlock/Tags/Reference/Url.php | 40 + .../src/DocBlock/Tags/Return_.php | 72 + .../src/DocBlock/Tags/See.php | 88 + .../src/DocBlock/Tags/Since.php | 94 + .../src/DocBlock/Tags/Source.php | 97 + .../src/DocBlock/Tags/Throws.php | 72 + .../src/DocBlock/Tags/Uses.php | 83 + .../src/DocBlock/Tags/Var_.php | 118 + .../src/DocBlock/Tags/Version.php | 94 + .../src/DocBlockFactory.php | 277 + .../src/DocBlockFactoryInterface.php | 23 + vendor/phpdocumentor/type-resolver/LICENSE | 21 + vendor/phpdocumentor/type-resolver/README.md | 182 + .../phpdocumentor/type-resolver/composer.json | 27 + .../type-resolver/src/FqsenResolver.php | 77 + .../phpdocumentor/type-resolver/src/Type.php | 18 + .../type-resolver/src/TypeResolver.php | 298 + .../type-resolver/src/Types/Array_.php | 86 + .../type-resolver/src/Types/Boolean.php | 31 + .../type-resolver/src/Types/Callable_.php | 31 + .../type-resolver/src/Types/Compound.php | 93 + .../type-resolver/src/Types/Context.php | 84 + .../src/Types/ContextFactory.php | 210 + .../type-resolver/src/Types/Float_.php | 31 + .../type-resolver/src/Types/Integer.php | 28 + .../type-resolver/src/Types/Iterable_.php | 31 + .../type-resolver/src/Types/Mixed_.php | 31 + .../type-resolver/src/Types/Null_.php | 31 + .../type-resolver/src/Types/Nullable.php | 56 + .../type-resolver/src/Types/Object_.php | 71 + .../type-resolver/src/Types/Parent_.php | 33 + .../type-resolver/src/Types/Resource_.php | 31 + .../type-resolver/src/Types/Scalar.php | 31 + .../type-resolver/src/Types/Self_.php | 33 + .../type-resolver/src/Types/Static_.php | 38 + .../type-resolver/src/Types/String_.php | 31 + .../type-resolver/src/Types/This.php | 34 + .../type-resolver/src/Types/Void_.php | 34 + vendor/phpspec/prophecy/CHANGES.md | 213 + vendor/phpspec/prophecy/LICENSE | 23 + vendor/phpspec/prophecy/README.md | 391 + vendor/phpspec/prophecy/composer.json | 50 + .../prophecy/src/Prophecy/Argument.php | 212 + .../Prophecy/Argument/ArgumentsWildcard.php | 101 + .../Prophecy/Argument/Token/AnyValueToken.php | 52 + .../Argument/Token/AnyValuesToken.php | 52 + .../Argument/Token/ApproximateValueToken.php | 55 + .../Argument/Token/ArrayCountToken.php | 86 + .../Argument/Token/ArrayEntryToken.php | 143 + .../Argument/Token/ArrayEveryEntryToken.php | 82 + .../Prophecy/Argument/Token/CallbackToken.php | 75 + .../Argument/Token/ExactValueToken.php | 116 + .../Argument/Token/IdenticalValueToken.php | 74 + .../Argument/Token/LogicalAndToken.php | 80 + .../Argument/Token/LogicalNotToken.php | 73 + .../Argument/Token/ObjectStateToken.php | 104 + .../Argument/Token/StringContainsToken.php | 67 + .../Argument/Token/TokenInterface.php | 43 + .../src/Prophecy/Argument/Token/TypeToken.php | 76 + .../prophecy/src/Prophecy/Call/Call.php | 162 + .../prophecy/src/Prophecy/Call/CallCenter.php | 229 + .../Prophecy/Comparator/ClosureComparator.php | 42 + .../src/Prophecy/Comparator/Factory.php | 47 + .../Comparator/ProphecyComparator.php | 28 + .../src/Prophecy/Doubler/CachedDoubler.php | 68 + .../ClassPatch/ClassPatchInterface.php | 48 + .../ClassPatch/DisableConstructorPatch.php | 72 + .../Doubler/ClassPatch/HhvmExceptionPatch.php | 63 + .../Doubler/ClassPatch/KeywordPatch.php | 140 + .../Doubler/ClassPatch/MagicCallPatch.php | 94 + .../ClassPatch/ProphecySubjectPatch.php | 104 + .../ReflectionClassNewInstancePatch.php | 57 + .../Doubler/ClassPatch/SplFileInfoPatch.php | 123 + .../Doubler/ClassPatch/ThrowablePatch.php | 95 + .../Doubler/ClassPatch/TraversablePatch.php | 83 + .../src/Prophecy/Doubler/DoubleInterface.php | 22 + .../prophecy/src/Prophecy/Doubler/Doubler.php | 146 + .../Doubler/Generator/ClassCodeGenerator.php | 129 + .../Doubler/Generator/ClassCreator.php | 67 + .../Doubler/Generator/ClassMirror.php | 260 + .../Doubler/Generator/Node/ArgumentNode.php | 102 + .../Doubler/Generator/Node/ClassNode.php | 169 + .../Doubler/Generator/Node/MethodNode.php | 198 + .../Doubler/Generator/ReflectionInterface.php | 22 + .../Doubler/Generator/TypeHintReference.php | 46 + .../src/Prophecy/Doubler/LazyDouble.php | 127 + .../src/Prophecy/Doubler/NameGenerator.php | 52 + .../Call/UnexpectedCallException.php | 40 + .../Doubler/ClassCreatorException.php | 31 + .../Doubler/ClassMirrorException.php | 31 + .../Doubler/ClassNotFoundException.php | 33 + .../Exception/Doubler/DoubleException.php | 18 + .../Exception/Doubler/DoublerException.php | 18 + .../Doubler/InterfaceNotFoundException.php | 20 + .../Doubler/MethodNotExtendableException.php | 41 + .../Doubler/MethodNotFoundException.php | 60 + .../Doubler/ReturnByReferenceException.php | 41 + .../src/Prophecy/Exception/Exception.php | 26 + .../Exception/InvalidArgumentException.php | 16 + .../Prediction/AggregateException.php | 51 + .../Prediction/FailedPredictionException.php | 24 + .../Exception/Prediction/NoCallsException.php | 18 + .../Prediction/PredictionException.php | 18 + .../UnexpectedCallsCountException.php | 31 + .../Prediction/UnexpectedCallsException.php | 32 + .../Prophecy/MethodProphecyException.php | 34 + .../Prophecy/ObjectProphecyException.php | 34 + .../Exception/Prophecy/ProphecyException.php | 18 + .../ClassAndInterfaceTagRetriever.php | 69 + .../PhpDocumentor/ClassTagRetriever.php | 52 + .../PhpDocumentor/LegacyClassTagRetriever.php | 35 + .../MethodTagRetrieverInterface.php | 30 + .../Prophecy/Prediction/CallPrediction.php | 86 + .../Prediction/CallTimesPrediction.php | 107 + .../Prediction/CallbackPrediction.php | 65 + .../Prophecy/Prediction/NoCallsPrediction.php | 68 + .../Prediction/PredictionInterface.php | 37 + .../src/Prophecy/Promise/CallbackPromise.php | 66 + .../src/Prophecy/Promise/PromiseInterface.php | 35 + .../Promise/ReturnArgumentPromise.php | 61 + .../src/Prophecy/Promise/ReturnPromise.php | 55 + .../src/Prophecy/Promise/ThrowPromise.php | 99 + .../src/Prophecy/Prophecy/MethodProphecy.php | 488 + .../src/Prophecy/Prophecy/ObjectProphecy.php | 281 + .../Prophecy/Prophecy/ProphecyInterface.php | 27 + .../Prophecy/ProphecySubjectInterface.php | 34 + .../src/Prophecy/Prophecy/Revealer.php | 44 + .../Prophecy/Prophecy/RevealerInterface.php | 29 + .../phpspec/prophecy/src/Prophecy/Prophet.php | 135 + .../prophecy/src/Prophecy/Util/ExportUtil.php | 212 + .../prophecy/src/Prophecy/Util/StringUtil.php | 99 + .../phpunit/php-code-coverage/.gitattributes | 1 + .../php-code-coverage/.github/CONTRIBUTING.md | 1 + .../.github/ISSUE_TEMPLATE.md | 18 + .../php-code-coverage/.github/stale.yml | 44 + vendor/phpunit/php-code-coverage/.gitignore | 7 + vendor/phpunit/php-code-coverage/.php_cs.dist | 189 + vendor/phpunit/php-code-coverage/.travis.yml | 40 + .../php-code-coverage/ChangeLog-6.1.md | 41 + vendor/phpunit/php-code-coverage/LICENSE | 33 + vendor/phpunit/php-code-coverage/README.md | 40 + vendor/phpunit/php-code-coverage/build.xml | 19 + .../phpunit/php-code-coverage/composer.json | 55 + vendor/phpunit/php-code-coverage/phpunit.xml | 21 + .../php-code-coverage/src/CodeCoverage.php | 1008 + .../php-code-coverage/src/Driver/Driver.php | 47 + .../php-code-coverage/src/Driver/PHPDBG.php | 96 + .../php-code-coverage/src/Driver/Xdebug.php | 112 + .../CoveredCodeNotExecutedException.php | 17 + .../src/Exception/Exception.php | 17 + .../Exception/InvalidArgumentException.php | 36 + .../MissingCoversAnnotationException.php | 17 + .../src/Exception/RuntimeException.php | 14 + .../UnintentionallyCoveredCodeException.php | 44 + .../phpunit/php-code-coverage/src/Filter.php | 164 + .../src/Node/AbstractNode.php | 328 + .../php-code-coverage/src/Node/Builder.php | 225 + .../php-code-coverage/src/Node/Directory.php | 427 + .../php-code-coverage/src/Node/File.php | 611 + .../php-code-coverage/src/Node/Iterator.php | 89 + .../php-code-coverage/src/Report/Clover.php | 258 + .../php-code-coverage/src/Report/Crap4j.php | 165 + .../src/Report/Html/Facade.php | 167 + .../src/Report/Html/Renderer.php | 270 + .../src/Report/Html/Renderer/Dashboard.php | 281 + .../src/Report/Html/Renderer/Directory.php | 98 + .../src/Report/Html/Renderer/File.php | 529 + .../Renderer/Template/coverage_bar.html.dist | 5 + .../Renderer/Template/css/bootstrap.min.css | 7 + .../Html/Renderer/Template/css/custom.css | 0 .../Html/Renderer/Template/css/nv.d3.min.css | 1 + .../Html/Renderer/Template/css/octicons.css | 5 + .../Html/Renderer/Template/css/style.css | 122 + .../Renderer/Template/dashboard.html.dist | 281 + .../Renderer/Template/directory.html.dist | 60 + .../Template/directory_item.html.dist | 13 + .../Html/Renderer/Template/file.html.dist | 72 + .../Renderer/Template/file_item.html.dist | 14 + .../Renderer/Template/icons/file-code.svg | 1 + .../Template/icons/file-directory.svg | 1 + .../Renderer/Template/js/bootstrap.min.js | 7 + .../Html/Renderer/Template/js/d3.min.js | 5 + .../Report/Html/Renderer/Template/js/file.js | 61 + .../Html/Renderer/Template/js/jquery.min.js | 2 + .../Html/Renderer/Template/js/nv.d3.min.js | 8 + .../Html/Renderer/Template/js/popper.min.js | 5 + .../Renderer/Template/method_item.html.dist | 11 + .../php-code-coverage/src/Report/PHP.php | 64 + .../php-code-coverage/src/Report/Text.php | 283 + .../src/Report/Xml/BuildInformation.php | 76 + .../src/Report/Xml/Coverage.php | 69 + .../src/Report/Xml/Directory.php | 14 + .../src/Report/Xml/Facade.php | 287 + .../php-code-coverage/src/Report/Xml/File.php | 81 + .../src/Report/Xml/Method.php | 56 + .../php-code-coverage/src/Report/Xml/Node.php | 87 + .../src/Report/Xml/Project.php | 85 + .../src/Report/Xml/Report.php | 92 + .../src/Report/Xml/Source.php | 38 + .../src/Report/Xml/Tests.php | 46 + .../src/Report/Xml/Totals.php | 140 + .../php-code-coverage/src/Report/Xml/Unit.php | 95 + vendor/phpunit/php-code-coverage/src/Util.php | 40 + .../phpunit/php-code-coverage/src/Version.php | 30 + .../php-code-coverage/tests/TestCase.php | 400 + .../tests/_files/BankAccount-clover.xml | 26 + .../tests/_files/BankAccount-crap4j.xml | 59 + .../tests/_files/BankAccount-text.txt | 12 + .../tests/_files/BankAccount.php | 33 + .../tests/_files/BankAccountTest.php | 68 + .../_files/CoverageClassExtendedTest.php | 14 + .../tests/_files/CoverageClassTest.php | 14 + .../CoverageFunctionParenthesesTest.php | 13 + ...erageFunctionParenthesesWhitespaceTest.php | 13 + .../tests/_files/CoverageFunctionTest.php | 13 + .../CoverageMethodOneLineAnnotationTest.php | 12 + .../_files/CoverageMethodParenthesesTest.php | 14 + ...overageMethodParenthesesWhitespaceTest.php | 14 + .../tests/_files/CoverageMethodTest.php | 14 + .../tests/_files/CoverageNoneTest.php | 11 + .../tests/_files/CoverageNotPrivateTest.php | 14 + .../tests/_files/CoverageNotProtectedTest.php | 14 + .../tests/_files/CoverageNotPublicTest.php | 14 + .../tests/_files/CoverageNothingTest.php | 15 + .../tests/_files/CoveragePrivateTest.php | 14 + .../tests/_files/CoverageProtectedTest.php | 14 + .../tests/_files/CoveragePublicTest.php | 14 + .../CoverageTwoDefaultClassAnnotations.php | 17 + .../tests/_files/CoveredClass.php | 36 + .../tests/_files/CoveredFunction.php | 4 + .../php-code-coverage/tests/_files/Crash.php | 2 + .../NamespaceCoverageClassExtendedTest.php | 14 + .../_files/NamespaceCoverageClassTest.php | 14 + ...NamespaceCoverageCoversClassPublicTest.php | 17 + .../NamespaceCoverageCoversClassTest.php | 22 + .../_files/NamespaceCoverageMethodTest.php | 14 + .../NamespaceCoverageNotPrivateTest.php | 14 + .../NamespaceCoverageNotProtectedTest.php | 14 + .../_files/NamespaceCoverageNotPublicTest.php | 14 + .../_files/NamespaceCoveragePrivateTest.php | 14 + .../_files/NamespaceCoverageProtectedTest.php | 14 + .../_files/NamespaceCoveragePublicTest.php | 14 + .../tests/_files/NamespaceCoveredClass.php | 38 + .../_files/NotExistingCoveredElementTest.php | 26 + .../BankAccount.php.html | 249 + .../CoverageForBankAccount/dashboard.html | 287 + .../HTML/CoverageForBankAccount/index.html | 118 + .../dashboard.html | 285 + .../index.html | 118 + ...with_class_and_anonymous_function.php.html | 172 + .../dashboard.html | 283 + .../index.html | 108 + .../source_with_ignore.php.html | 196 + .../BankAccount.php.xml | 262 + .../XML/CoverageForBankAccount/index.xml | 33 + .../index.xml | 30 + ..._with_class_and_anonymous_function.php.xml | 161 + .../CoverageForFileWithIgnoredLines/index.xml | 30 + .../source_with_ignore.php.xml | 187 + .../class-with-anonymous-function-clover.xml | 21 + .../class-with-anonymous-function-crap4j.xml | 26 + .../class-with-anonymous-function-text.txt | 12 + .../tests/_files/ignored-lines-clover.xml | 17 + .../tests/_files/ignored-lines-crap4j.xml | 37 + .../tests/_files/ignored-lines-text.txt | 10 + ...urce_with_class_and_anonymous_function.php | 19 + .../tests/_files/source_with_ignore.php | 37 + .../tests/_files/source_with_namespace.php | 20 + .../source_with_oneline_annotations.php | 36 + .../tests/_files/source_without_ignore.php | 4 + .../tests/_files/source_without_namespace.php | 18 + .../php-code-coverage/tests/bootstrap.php | 8 + .../tests/tests/BuilderTest.php | 250 + .../tests/tests/CloverTest.php | 49 + .../tests/tests/CodeCoverageTest.php | 499 + .../tests/tests/Crap4jTest.php | 49 + .../tests/tests/FilterTest.php | 198 + .../tests/tests/HTMLTest.php | 103 + .../tests/tests/TextTest.php | 49 + .../tests/tests/UtilTest.php | 29 + .../php-code-coverage/tests/tests/XmlTest.php | 98 + .../phpunit/php-file-iterator/.gitattributes | 1 + .../php-file-iterator/.github/stale.yml | 40 + vendor/phpunit/php-file-iterator/.gitignore | 5 + vendor/phpunit/php-file-iterator/.php_cs.dist | 168 + vendor/phpunit/php-file-iterator/.travis.yml | 32 + vendor/phpunit/php-file-iterator/ChangeLog.md | 70 + vendor/phpunit/php-file-iterator/LICENSE | 33 + vendor/phpunit/php-file-iterator/README.md | 14 + .../phpunit/php-file-iterator/composer.json | 37 + vendor/phpunit/php-file-iterator/phpunit.xml | 21 + .../phpunit/php-file-iterator/src/Facade.php | 112 + .../phpunit/php-file-iterator/src/Factory.php | 83 + .../php-file-iterator/src/Iterator.php | 112 + .../php-file-iterator/tests/FactoryTest.php | 50 + .../phpunit/php-text-template/.gitattributes | 1 + vendor/phpunit/php-text-template/.gitignore | 5 + vendor/phpunit/php-text-template/LICENSE | 33 + vendor/phpunit/php-text-template/README.md | 14 + .../phpunit/php-text-template/composer.json | 29 + .../php-text-template/src/Template.php | 135 + vendor/phpunit/php-timer/.gitattributes | 1 + vendor/phpunit/php-timer/.gitignore | 5 + vendor/phpunit/php-timer/.php_cs.dist | 148 + vendor/phpunit/php-timer/.travis.yml | 24 + vendor/phpunit/php-timer/ChangeLog.md | 15 + vendor/phpunit/php-timer/LICENSE | 33 + vendor/phpunit/php-timer/README.md | 49 + vendor/phpunit/php-timer/build.xml | 20 + vendor/phpunit/php-timer/composer.json | 42 + vendor/phpunit/php-timer/phpunit.xml | 19 + vendor/phpunit/php-timer/src/Exception.php | 15 + .../php-timer/src/RuntimeException.php | 15 + vendor/phpunit/php-timer/src/Timer.php | 81 + vendor/phpunit/php-timer/tests/TimerTest.php | 121 + .../phpunit/php-token-stream/.gitattributes | 1 + .../php-token-stream/.github/stale.yml | 40 + vendor/phpunit/php-token-stream/.gitignore | 3 + vendor/phpunit/php-token-stream/.travis.yml | 26 + vendor/phpunit/php-token-stream/ChangeLog.md | 36 + vendor/phpunit/php-token-stream/LICENSE | 33 + vendor/phpunit/php-token-stream/README.md | 14 + vendor/phpunit/php-token-stream/build.xml | 21 + vendor/phpunit/php-token-stream/composer.json | 39 + vendor/phpunit/php-token-stream/phpunit.xml | 17 + vendor/phpunit/php-token-stream/src/Token.php | 1352 + .../php-token-stream/src/Token/Stream.php | 607 + .../src/Token/Stream/CachingFactory.php | 46 + .../tests/Token/ClassTest.php | 169 + .../tests/Token/ClosureTest.php | 78 + .../tests/Token/FunctionTest.php | 141 + .../tests/Token/IncludeTest.php | 65 + .../tests/Token/InterfaceTest.php | 195 + .../tests/Token/NamespaceTest.php | 69 + .../_fixture/classExtendsNamespacedClass.php | 10 + .../tests/_fixture/classInNamespace.php | 6 + .../tests/_fixture/classInScopedNamespace.php | 9 + .../_fixture/classUsesNamespacedFunction.php | 8 + .../class_with_method_named_empty.php | 7 + ...h_method_that_declares_anonymous_class.php | 15 + ..._method_that_declares_anonymous_class2.php | 16 + ...ltiple_anonymous_classes_and_functions.php | 26 + .../tests/_fixture/closure.php | 7 + .../tests/_fixture/issue19.php | 3 + .../tests/_fixture/issue30.php | 8 + ...tipleNamespacesWithOneClassUsingBraces.php | 12 + ...espacesWithOneClassUsingNonBraceSyntax.php | 14 + .../_fixture/php-code-coverage-issue-424.php | 13 + .../tests/_fixture/source.php | 42 + .../tests/_fixture/source2.php | 6 + .../tests/_fixture/source3.php | 14 + .../tests/_fixture/source4.php | 30 + .../tests/_fixture/source5.php | 5 + .../php-token-stream/tests/bootstrap.php | 15 + vendor/phpunit/phpunit/.editorconfig | 11 + vendor/phpunit/phpunit/.gitattributes | 4 + .../phpunit/.github/CODE_OF_CONDUCT.md | 28 + .../phpunit/phpunit/.github/CONTRIBUTING.md | 68 + .../phpunit/phpunit/.github/ISSUE_TEMPLATE.md | 15 + vendor/phpunit/phpunit/.github/stale.yml | 47 + vendor/phpunit/phpunit/.gitignore | 20 + vendor/phpunit/phpunit/.phan/config.php | 7 + vendor/phpunit/phpunit/.php_cs.dist | 198 + vendor/phpunit/phpunit/.travis.yml | 61 + vendor/phpunit/phpunit/ChangeLog-6.5.md | 108 + vendor/phpunit/phpunit/ChangeLog-7.5.md | 38 + vendor/phpunit/phpunit/LICENSE | 33 + vendor/phpunit/phpunit/README.md | 40 + vendor/phpunit/phpunit/appveyor.yml | 59 + vendor/phpunit/phpunit/build.xml | 428 + vendor/phpunit/phpunit/composer.json | 90 + vendor/phpunit/phpunit/phive.xml | 7 + vendor/phpunit/phpunit/phpunit | 61 + vendor/phpunit/phpunit/phpunit.xml | 30 + vendor/phpunit/phpunit/phpunit.xsd | 307 + vendor/phpunit/phpunit/src/Exception.php | 17 + .../phpunit/phpunit/src/Framework/Assert.php | 2889 ++ .../src/Framework/Assert/Functions.php | 1666 + .../src/Framework/AssertionFailedError.php | 24 + .../src/Framework/CodeCoverageException.php | 14 + .../src/Framework/Constraint/ArrayHasKey.php | 81 + .../src/Framework/Constraint/ArraySubset.php | 131 + .../src/Framework/Constraint/Attribute.php | 79 + .../src/Framework/Constraint/Callback.php | 47 + .../Constraint/ClassHasAttribute.php | 80 + .../Constraint/ClassHasStaticAttribute.php | 51 + .../src/Framework/Constraint/Composite.php | 70 + .../src/Framework/Constraint/Constraint.php | 148 + .../src/Framework/Constraint/Count.php | 119 + .../Framework/Constraint/DirectoryExists.php | 53 + .../src/Framework/Constraint/Exception.php | 82 + .../Framework/Constraint/ExceptionCode.php | 63 + .../Framework/Constraint/ExceptionMessage.php | 73 + .../ExceptionMessageRegularExpression.php | 71 + .../src/Framework/Constraint/FileExists.php | 53 + .../src/Framework/Constraint/GreaterThan.php | 53 + .../src/Framework/Constraint/IsAnything.php | 55 + .../src/Framework/Constraint/IsEmpty.php | 61 + .../src/Framework/Constraint/IsEqual.php | 150 + .../src/Framework/Constraint/IsFalse.php | 35 + .../src/Framework/Constraint/IsFinite.php | 35 + .../src/Framework/Constraint/IsIdentical.php | 144 + .../src/Framework/Constraint/IsInfinite.php | 35 + .../src/Framework/Constraint/IsInstanceOf.php | 91 + .../src/Framework/Constraint/IsJson.php | 73 + .../src/Framework/Constraint/IsNan.php | 35 + .../src/Framework/Constraint/IsNull.php | 35 + .../src/Framework/Constraint/IsReadable.php | 53 + .../src/Framework/Constraint/IsTrue.php | 35 + .../src/Framework/Constraint/IsType.php | 152 + .../src/Framework/Constraint/IsWritable.php | 53 + .../src/Framework/Constraint/JsonMatches.php | 111 + .../JsonMatchesErrorMessageProvider.php | 62 + .../src/Framework/Constraint/LessThan.php | 53 + .../src/Framework/Constraint/LogicalAnd.php | 123 + .../src/Framework/Constraint/LogicalNot.php | 171 + .../src/Framework/Constraint/LogicalOr.php | 120 + .../src/Framework/Constraint/LogicalXor.php | 125 + .../Constraint/ObjectHasAttribute.php | 34 + .../Constraint/RegularExpression.php | 56 + .../src/Framework/Constraint/SameSize.php | 18 + .../Framework/Constraint/StringContains.php | 76 + .../Framework/Constraint/StringEndsWith.php | 48 + .../StringMatchesFormatDescription.php | 103 + .../Framework/Constraint/StringStartsWith.php | 48 + .../Constraint/TraversableContains.php | 116 + .../Constraint/TraversableContainsOnly.php | 93 + .../CoveredCodeNotExecutedException.php | 14 + .../src/Framework/DataProviderTestSuite.php | 40 + .../src/Framework/Error/Deprecated.php | 15 + .../phpunit/src/Framework/Error/Error.php | 26 + .../phpunit/src/Framework/Error/Notice.php | 15 + .../phpunit/src/Framework/Error/Warning.php | 15 + .../phpunit/src/Framework/Exception.php | 78 + .../src/Framework/ExceptionWrapper.php | 118 + .../Framework/ExpectationFailedException.php | 39 + .../phpunit/src/Framework/IncompleteTest.php | 18 + .../src/Framework/IncompleteTestCase.php | 76 + .../src/Framework/IncompleteTestError.php | 14 + .../InvalidCoversTargetException.php | 14 + .../MissingCoversAnnotationException.php | 14 + .../Framework/MockObject/Builder/Identity.php | 30 + .../MockObject/Builder/InvocationMocker.php | 277 + .../Framework/MockObject/Builder/Match.php | 26 + .../MockObject/Builder/MethodNameMatch.php | 26 + .../MockObject/Builder/NamespaceMatch.php | 37 + .../MockObject/Builder/ParametersMatch.php | 50 + .../src/Framework/MockObject/Builder/Stub.php | 26 + .../Exception/BadMethodCallException.php | 14 + .../MockObject/Exception/Exception.php | 17 + .../MockObject/Exception/RuntimeException.php | 14 + .../ForwardCompatibility/MockObject.php | 16 + .../src/Framework/MockObject/Generator.php | 973 + .../MockObject/Generator/deprecation.tpl.dist | 2 + .../Generator/mocked_class.tpl.dist | 46 + .../Generator/mocked_class_method.tpl.dist | 8 + .../Generator/mocked_clone.tpl.dist | 4 + .../Generator/mocked_method.tpl.dist | 22 + .../Generator/mocked_method_void.tpl.dist | 20 + .../Generator/mocked_static_method.tpl.dist | 5 + .../Generator/proxied_method.tpl.dist | 22 + .../Generator/proxied_method_void.tpl.dist | 22 + .../MockObject/Generator/trait_class.tpl.dist | 4 + .../Generator/unmocked_clone.tpl.dist | 5 + .../MockObject/Generator/wsdl_class.tpl.dist | 7 + .../MockObject/Generator/wsdl_method.tpl.dist | 4 + .../MockObject/Invocation/Invocation.php | 31 + .../Invocation/ObjectInvocation.php | 40 + .../Invocation/StaticInvocation.php | 258 + .../Framework/MockObject/InvocationMocker.php | 186 + .../src/Framework/MockObject/Invokable.php | 38 + .../src/Framework/MockObject/Matcher.php | 309 + .../MockObject/Matcher/AnyInvokedCount.php | 26 + .../MockObject/Matcher/AnyParameters.php | 31 + .../Matcher/ConsecutiveParameters.php | 126 + .../MockObject/Matcher/DeferredError.php | 40 + .../MockObject/Matcher/Invocation.php | 47 + .../MockObject/Matcher/InvokedAtIndex.php | 81 + .../Matcher/InvokedAtLeastCount.php | 55 + .../MockObject/Matcher/InvokedAtLeastOnce.php | 43 + .../MockObject/Matcher/InvokedAtMostCount.php | 55 + .../MockObject/Matcher/InvokedCount.php | 106 + .../MockObject/Matcher/InvokedRecorder.php | 63 + .../MockObject/Matcher/MethodName.php | 68 + .../MockObject/Matcher/Parameters.php | 158 + .../Matcher/StatelessInvocation.php | 50 + .../src/Framework/MockObject/MockBuilder.php | 408 + .../src/Framework/MockObject/MockMethod.php | 354 + .../Framework/MockObject/MockMethodSet.php | 36 + .../src/Framework/MockObject/MockObject.php | 57 + .../phpunit/src/Framework/MockObject/Stub.php | 29 + .../MockObject/Stub/ConsecutiveCalls.php | 56 + .../Framework/MockObject/Stub/Exception.php | 42 + .../MockObject/Stub/MatcherCollection.php | 26 + .../MockObject/Stub/ReturnArgument.php | 41 + .../MockObject/Stub/ReturnCallback.php | 52 + .../MockObject/Stub/ReturnReference.php | 45 + .../Framework/MockObject/Stub/ReturnSelf.php | 38 + .../Framework/MockObject/Stub/ReturnStub.php | 45 + .../MockObject/Stub/ReturnValueMap.php | 51 + .../src/Framework/MockObject/Verifiable.php | 26 + .../phpunit/src/Framework/OutputError.php | 14 + .../phpunit/src/Framework/RiskyTest.php | 14 + .../phpunit/src/Framework/RiskyTestError.php | 14 + .../phpunit/src/Framework/SelfDescribing.php | 21 + .../phpunit/src/Framework/SkippedTest.php | 14 + .../phpunit/src/Framework/SkippedTestCase.php | 76 + .../src/Framework/SkippedTestError.php | 14 + .../src/Framework/SkippedTestSuiteError.php | 14 + .../phpunit/src/Framework/SyntheticError.php | 61 + vendor/phpunit/phpunit/src/Framework/Test.php | 23 + .../phpunit/src/Framework/TestCase.php | 2120 ++ .../phpunit/src/Framework/TestFailure.php | 154 + .../phpunit/src/Framework/TestListener.php | 66 + .../TestListenerDefaultImplementation.php | 53 + .../phpunit/src/Framework/TestResult.php | 1118 + .../phpunit/src/Framework/TestSuite.php | 943 + .../src/Framework/TestSuiteIterator.php | 91 + .../UnintentionallyCoveredCodeError.php | 18 + .../phpunit/phpunit/src/Framework/Warning.php | 24 + .../phpunit/src/Framework/WarningTestCase.php | 71 + .../phpunit/src/Runner/BaseTestRunner.php | 145 + .../phpunit/phpunit/src/Runner/Exception.php | 14 + .../Filter/ExcludeGroupFilterIterator.php | 18 + .../phpunit/src/Runner/Filter/Factory.php | 51 + .../src/Runner/Filter/GroupFilterIterator.php | 51 + .../Filter/IncludeGroupFilterIterator.php | 18 + .../src/Runner/Filter/NameFilterIterator.php | 122 + .../Runner/Hook/AfterIncompleteTestHook.php | 15 + .../src/Runner/Hook/AfterLastTestHook.php | 15 + .../src/Runner/Hook/AfterRiskyTestHook.php | 15 + .../src/Runner/Hook/AfterSkippedTestHook.php | 15 + .../Runner/Hook/AfterSuccessfulTestHook.php | 15 + .../src/Runner/Hook/AfterTestErrorHook.php | 15 + .../src/Runner/Hook/AfterTestFailureHook.php | 15 + .../phpunit/src/Runner/Hook/AfterTestHook.php | 21 + .../src/Runner/Hook/AfterTestWarningHook.php | 15 + .../src/Runner/Hook/BeforeFirstTestHook.php | 15 + .../src/Runner/Hook/BeforeTestHook.php | 15 + .../phpunit/phpunit/src/Runner/Hook/Hook.php | 14 + .../phpunit/src/Runner/Hook/TestHook.php | 14 + .../src/Runner/Hook/TestListenerAdapter.php | 137 + .../phpunit/src/Runner/PhptTestCase.php | 590 + .../src/Runner/ResultCacheExtension.php | 104 + .../src/Runner/StandardTestSuiteLoader.php | 112 + .../phpunit/src/Runner/TestSuiteLoader.php | 22 + .../phpunit/src/Runner/TestSuiteSorter.php | 357 + vendor/phpunit/phpunit/src/Runner/Version.php | 64 + vendor/phpunit/phpunit/src/TextUI/Command.php | 1374 + .../phpunit/src/TextUI/ResultPrinter.php | 596 + .../phpunit/phpunit/src/TextUI/TestRunner.php | 1305 + vendor/phpunit/phpunit/src/Util/Blacklist.php | 127 + .../phpunit/src/Util/Configuration.php | 1331 + .../src/Util/ConfigurationGenerator.php | 60 + .../phpunit/phpunit/src/Util/ErrorHandler.php | 106 + .../phpunit/phpunit/src/Util/FileLoader.php | 68 + .../phpunit/phpunit/src/Util/Filesystem.php | 30 + vendor/phpunit/phpunit/src/Util/Filter.php | 83 + vendor/phpunit/phpunit/src/Util/Getopt.php | 183 + .../phpunit/phpunit/src/Util/GlobalState.php | 172 + .../src/Util/InvalidArgumentHelper.php | 35 + vendor/phpunit/phpunit/src/Util/Json.php | 83 + vendor/phpunit/phpunit/src/Util/Log/JUnit.php | 432 + .../phpunit/phpunit/src/Util/Log/TeamCity.php | 391 + .../phpunit/src/Util/NullTestResultCache.php | 31 + .../src/Util/PHP/AbstractPhpProcess.php | 368 + .../src/Util/PHP/DefaultPhpProcess.php | 218 + .../Util/PHP/Template/PhptTestCase.tpl.dist | 40 + .../Util/PHP/Template/TestCaseClass.tpl.dist | 108 + .../Util/PHP/Template/TestCaseMethod.tpl.dist | 110 + .../src/Util/PHP/WindowsPhpProcess.php | 46 + .../phpunit/src/Util/PHP/eval-stdin.php | 10 + vendor/phpunit/phpunit/src/Util/Printer.php | 140 + .../phpunit/src/Util/RegularExpression.php | 27 + vendor/phpunit/phpunit/src/Util/Test.php | 1121 + .../src/Util/TestDox/CliTestDoxPrinter.php | 429 + .../src/Util/TestDox/HtmlResultPrinter.php | 131 + .../src/Util/TestDox/NamePrettifier.php | 193 + .../src/Util/TestDox/ResultPrinter.php | 339 + .../phpunit/src/Util/TestDox/TestResult.php | 155 + .../src/Util/TestDox/TextResultPrinter.php | 47 + .../src/Util/TestDox/XmlResultPrinter.php | 205 + .../phpunit/src/Util/TestResultCache.php | 195 + .../src/Util/TestResultCacheInterface.php | 21 + .../phpunit/src/Util/TextTestListRenderer.php | 43 + vendor/phpunit/phpunit/src/Util/Type.php | 36 + .../src/Util/XdebugFilterScriptGenerator.php | 65 + vendor/phpunit/phpunit/src/Util/Xml.php | 282 + .../phpunit/src/Util/XmlTestListRenderer.php | 81 + vendor/phpunit/phpunit/tests/_files/3194.php | 42 + .../tests/_files/AbstractMockTestClass.php | 18 + .../phpunit/tests/_files/AbstractTest.php | 18 + .../phpunit/tests/_files/AbstractTrait.php | 23 + .../phpunit/tests/_files/AnInterface.php | 13 + .../_files/AnInterfaceWithReturnType.php | 13 + .../phpunit/tests/_files/AnotherInterface.php | 13 + .../phpunit/tests/_files/ArrayAccessible.php | 47 + .../phpunit/tests/_files/AssertionExample.php | 16 + .../tests/_files/AssertionExampleTest.php | 20 + .../phpunit/phpunit/tests/_files/Author.php | 25 + .../phpunit/tests/_files/BankAccount.php | 80 + .../phpunit/tests/_files/BankAccountTest.php | 93 + .../tests/_files/BankAccountTest.test.php | 86 + .../phpunit/tests/_files/BankAccountTest2.php | 56 + vendor/phpunit/phpunit/tests/_files/Bar.php | 16 + .../tests/_files/BeforeAndAfterTest.php | 47 + .../_files/BeforeClassAndAfterClassTest.php | 47 + .../BeforeClassWithOnlyDataProviderTest.php | 48 + vendor/phpunit/phpunit/tests/_files/Book.php | 18 + .../phpunit/tests/_files/Calculator.php | 22 + .../ChangeCurrentWorkingDirectoryTest.php | 19 + .../ClassThatImplementsSerializable.php | 23 + .../ClassWithAllPossibleReturnTypes.php | 64 + .../_files/ClassWithNonPublicAttributes.php | 47 + .../ClassWithScalarTypeDeclarations.php | 15 + .../tests/_files/ClassWithSelfTypeHint.php | 15 + .../tests/_files/ClassWithStaticMethod.php | 15 + .../tests/_files/ClassWithToString.php | 20 + .../ClassWithVariadicArgumentMethod.php | 20 + .../tests/_files/ClonedDependencyTest.php | 67 + .../phpunit/tests/_files/ConcreteTest.my.php | 16 + .../phpunit/tests/_files/ConcreteTest.php | 16 + .../phpunit/tests/_files/CountConstraint.php | 45 + .../_files/CoverageClassExtendedTest.php | 22 + .../tests/_files/CoverageClassTest.php | 22 + ...verageCoversOverridesCoversNothingTest.php | 25 + .../CoverageFunctionParenthesesTest.php | 21 + ...erageFunctionParenthesesWhitespaceTest.php | 21 + .../tests/_files/CoverageFunctionTest.php | 21 + .../CoverageMethodOneLineAnnotationTest.php | 20 + .../_files/CoverageMethodParenthesesTest.php | 22 + ...overageMethodParenthesesWhitespaceTest.php | 22 + .../tests/_files/CoverageMethodTest.php | 22 + .../_files/CoverageNamespacedFunctionTest.php | 21 + .../phpunit/tests/_files/CoverageNoneTest.php | 19 + .../tests/_files/CoverageNotPrivateTest.php | 22 + .../tests/_files/CoverageNotProtectedTest.php | 22 + .../tests/_files/CoverageNotPublicTest.php | 22 + .../tests/_files/CoverageNothingTest.php | 23 + .../tests/_files/CoveragePrivateTest.php | 22 + .../tests/_files/CoverageProtectedTest.php | 22 + .../tests/_files/CoveragePublicTest.php | 22 + .../CoverageTwoDefaultClassAnnotations.php | 25 + .../phpunit/tests/_files/CoveredClass.php | 44 + .../phpunit/tests/_files/CoveredFunction.php | 12 + .../phpunit/tests/_files/CustomPrinter.php | 14 + .../tests/_files/DataProviderDebugTest.php | 58 + .../_files/DataProviderDependencyTest.php | 33 + .../tests/_files/DataProviderFilterTest.php | 49 + .../_files/DataProviderIncompleteTest.php | 47 + .../DataProviderIssue2833/FirstTest.php | 30 + .../DataProviderIssue2833/SecondTest.php | 22 + .../_files/DataProviderIssue2859/phpunit.xml | 10 + .../another/TestWithDataProviderTest.php | 28 + .../DataProviderIssue2922/FirstTest.php | 31 + .../DataProviderIssue2922/SecondTest.php | 21 + .../tests/_files/DataProviderSkippedTest.php | 47 + .../phpunit/tests/_files/DataProviderTest.php | 31 + .../tests/_files/DataProviderTestDoxTest.php | 83 + .../_files/DataproviderExecutionOrderTest.php | 48 + ...roviderExecutionOrderTest_result_cache.txt | 1 + .../tests/_files/DependencyFailureTest.php | 42 + .../tests/_files/DependencySuccessTest.php | 34 + .../tests/_files/DependencyTestSuite.php | 23 + .../tests/_files/DoNoAssertionTestCase.php | 17 + ...mAssertionsButPerformingAssertionsTest.php | 22 + .../phpunit/tests/_files/DoubleTestCase.php | 39 + .../phpunit/tests/_files/DummyBarTest.php | 18 + .../phpunit/tests/_files/DummyException.php | 12 + .../phpunit/tests/_files/DummyFooTest.php | 18 + .../tests/_files/EmptyTestCaseTest.php | 14 + .../phpunit/tests/_files/ExampleTrait.php | 16 + .../ExceptionInAssertPostConditionsTest.php | 50 + .../ExceptionInAssertPreConditionsTest.php | 50 + .../tests/_files/ExceptionInSetUpTest.php | 50 + .../tests/_files/ExceptionInTearDownTest.php | 50 + .../phpunit/tests/_files/ExceptionInTest.php | 50 + .../ExceptionInTestDetectedInTeardown.php | 29 + .../tests/_files/ExceptionNamespaceTest.php | 45 + .../tests/_files/ExceptionStackTest.php | 34 + .../phpunit/tests/_files/ExceptionTest.php | 149 + .../tests/_files/ExceptionWithThrowable.php | 12 + .../phpunit/phpunit/tests/_files/Failure.php | 18 + .../phpunit/tests/_files/FailureTest.php | 85 + .../phpunit/tests/_files/FalsyConstraint.php | 26 + .../phpunit/tests/_files/FatalTest.php | 22 + vendor/phpunit/phpunit/tests/_files/Foo.php | 16 + .../phpunit/tests/_files/FunctionCallback.php | 17 + .../phpunit/tests/_files/Go ogle-Sea.rch.wsdl | 198 + .../phpunit/tests/_files/GoogleSearch.wsdl | 198 + .../tests/_files/IgnoreCodeCoverageClass.php | 25 + .../_files/IgnoreCodeCoverageClassTest.php | 25 + .../phpunit/tests/_files/IncompleteTest.php | 18 + .../tests/_files/Inheritance/InheritanceA.php | 14 + .../tests/_files/Inheritance/InheritanceB.php | 17 + .../tests/_files/InheritedTestCase.php | 15 + .../phpunit/phpunit/tests/_files/IniTest.php | 18 + .../InterfaceWithSemiReservedMethodName.php | 13 + .../_files/InterfaceWithStaticMethod.php | 13 + .../phpunit/tests/_files/IsolationTest.php | 23 + .../tests/_files/JsonData/arrayObject.json | 1 + .../tests/_files/JsonData/simpleObject.json | 1 + .../phpunit/tests/_files/MethodCallback.php | 29 + .../_files/MethodCallbackByReference.php | 21 + .../phpunit/tests/_files/MockRunner.php | 17 + .../tests/_files/MockTestInterface.php | 15 + .../phpunit/phpunit/tests/_files/Mockable.php | 37 + .../tests/_files/MultiDependencyTest.php | 50 + .../MultiDependencyTest_result_cache.txt | 1 + .../tests/_files/MultipleDataProviderTest.php | 89 + .../phpunit/tests/_files/MyCommand.php | 24 + .../phpunit/tests/_files/MyTestListener.php | 121 + .../phpunit/tests/_files/NamedConstraint.php | 37 + .../NamespaceCoverageClassExtendedTest.php | 22 + .../_files/NamespaceCoverageClassTest.php | 22 + ...NamespaceCoverageCoversClassPublicTest.php | 25 + .../NamespaceCoverageCoversClassTest.php | 30 + .../_files/NamespaceCoverageMethodTest.php | 22 + .../NamespaceCoverageNotPrivateTest.php | 22 + .../NamespaceCoverageNotProtectedTest.php | 22 + .../_files/NamespaceCoverageNotPublicTest.php | 22 + .../_files/NamespaceCoveragePrivateTest.php | 22 + .../_files/NamespaceCoverageProtectedTest.php | 22 + .../_files/NamespaceCoveragePublicTest.php | 22 + .../tests/_files/NamespaceCoveredClass.php | 46 + .../tests/_files/NamespaceCoveredFunction.php | 15 + .../tests/_files/NoArgTestCaseTest.php | 17 + .../phpunit/tests/_files/NoTestCaseClass.php | 12 + .../phpunit/tests/_files/NoTestCases.php | 17 + .../phpunit/tests/_files/NonStatic.php | 15 + .../_files/NotExistingCoveredElementTest.php | 34 + .../tests/_files/NotPublicTestCase.php | 21 + .../tests/_files/NotSelfDescribingTest.php | 29 + .../phpunit/tests/_files/NotVoidTestCase.php | 14 + .../phpunit/tests/_files/NothingTest.php | 17 + .../phpunit/tests/_files/OneTestCase.php | 21 + .../phpunit/tests/_files/OutputTestCase.php | 37 + .../phpunit/tests/_files/OverrideTestCase.php | 15 + .../_files/ParseTestMethodAnnotationsMock.php | 24 + .../tests/_files/PartialMockTestClass.php | 26 + .../RequirementsClassBeforeClassHookTest.php | 21 + .../_files/RequirementsClassDocBlockTest.php | 30 + .../phpunit/tests/_files/RequirementsTest.php | 457 + .../phpunit/tests/_files/RouterTest.php | 34 + .../tests/_files/SampleArrayAccess.php | 42 + .../phpunit/tests/_files/SampleClass.php | 24 + .../phpunit/tests/_files/Singleton.php | 30 + .../phpunit/tests/_files/SingletonClass.php | 35 + .../phpunit/tests/_files/SomeClass.php | 19 + .../phpunit/tests/_files/StackTest.php | 34 + .../tests/_files/StaticMockTestClass.php | 20 + .../phpunit/tests/_files/StatusTest.php | 50 + .../tests/_files/StopOnErrorTestSuite.php | 29 + .../tests/_files/StopOnWarningTestSuite.php | 23 + .../tests/_files/StopsOnWarningTest.php | 17 + .../phpunit/tests/_files/StringableClass.php | 16 + .../phpunit/phpunit/tests/_files/Struct.php | 18 + .../phpunit/phpunit/tests/_files/Success.php | 18 + .../tests/_files/TemplateMethodsTest.php | 62 + .../tests/_files/TestAutoreferenced.php | 20 + .../phpunit/tests/_files/TestDoxGroupTest.php | 29 + .../tests/_files/TestGeneratorMaker.php | 18 + .../phpunit/tests/_files/TestIncomplete.php | 18 + .../phpunit/tests/_files/TestIterator.php | 45 + .../phpunit/tests/_files/TestIterator2.php | 43 + .../tests/_files/TestIteratorAggregate.php | 23 + .../tests/_files/TestIteratorAggregate2.php | 24 + .../phpunit/tests/_files/TestRisky.php | 18 + .../phpunit/tests/_files/TestSkipped.php | 18 + .../phpunit/tests/_files/TestTestError.php | 18 + .../phpunit/tests/_files/TestWarning.php | 19 + .../phpunit/tests/_files/TestWithTest.php | 34 + .../_files/TestableCliTestDoxPrinter.php | 25 + .../tests/_files/ThrowExceptionTestCase.php | 18 + .../tests/_files/ThrowNoExceptionTestCase.php | 17 + .../_files/TraversableMockTestInterface.php | 12 + .../phpunit/tests/_files/TruthyConstraint.php | 26 + .../VariousIterableDataProviderTest.php | 47 + .../phpunit/phpunit/tests/_files/WasRun.php | 20 + .../tests/_files/WrapperIteratorAggregate.php | 29 + vendor/phpunit/phpunit/tests/_files/bar.xml | 1 + .../_files/configuration.colors.empty.xml | 1 + .../_files/configuration.colors.false.xml | 1 + .../_files/configuration.colors.invalid.xml | 1 + .../_files/configuration.colors.true.xml | 1 + .../_files/configuration.columns.default.xml | 1 + .../_files/configuration.custom-printer.xml | 2 + .../_files/configuration.defaulttestsuite.xml | 10 + .../_files/configuration.one-file-suite.xml | 7 + .../tests/_files/configuration.suites.xml | 6 + .../phpunit/tests/_files/configuration.xml | 162 + .../tests/_files/configuration_empty.xml | 49 + .../configuration_execution_order_options.xml | 9 + .../_files/configuration_stop_on_defect.xml | 2 + .../_files/configuration_stop_on_error.xml | 2 + .../configuration_stop_on_incomplete.xml | 2 + .../_files/configuration_stop_on_warning.xml | 2 + .../tests/_files/configuration_whitelist.xml | 15 + .../tests/_files/configuration_xinclude.xml | 84 + .../tests/_files/expectedFileFormat.txt | 1 + vendor/phpunit/phpunit/tests/_files/foo.xml | 1 + .../tests/_files/phpt-for-coverage.phpt | 8 + .../phpunit/tests/_files/phpt-xfail.phpt | 11 + .../phpunit-example-extension/phpunit.xml | 10 + .../tests/OneTest.php | 21 + .../phpunit-example-extension-3.0.3.phar | Bin 0 -> 7698 bytes ...uctureAttributesAreSameButValuesAreNot.xml | 10 + .../tests/_files/structureExpected.xml | 10 + .../tests/_files/structureIgnoreTextNodes.xml | 13 + .../_files/structureIsSameButDataIsNot.xml | 10 + .../structureWrongNumberOfAttributes.xml | 10 + .../_files/structureWrongNumberOfNodes.xml | 9 + vendor/phpunit/phpunit/tests/bootstrap.php | 56 + .../tests/end-to-end/_files/Extension.php | 93 + .../tests/end-to-end/_files/HookTest.php | 52 + .../tests/end-to-end/_files/NullPrinter.php | 19 + .../end-to-end/_files/expect_external.txt | 1 + .../phpunit/tests/end-to-end/_files/hooks.xml | 14 + .../end-to-end/_files/phpt-env.expected.txt | 1 + .../tests/end-to-end/_files/phpt_external.php | 10 + .../tests/end-to-end/abstract-test-class.phpt | 24 + .../phpunit/tests/end-to-end/assertion.phpt | 38 + .../tests/end-to-end/cache-result.phpt | 29 + .../end-to-end/code-coverage-ignore.phpt | 36 + .../tests/end-to-end/code-coverage-phpt.phpt | 43 + .../tests/end-to-end/colors-always.phpt | 18 + .../tests/end-to-end/concrete-test-class.phpt | 18 + .../end-to-end/custom-printer-debug.phpt | 26 + .../end-to-end/custom-printer-verbose.phpt | 31 + .../tests/end-to-end/dataprovider-debug.phpt | 33 + .../end-to-end/dataprovider-issue-2833.phpt | 17 + .../end-to-end/dataprovider-issue-2859.phpt | 17 + .../end-to-end/dataprovider-issue-2922.phpt | 18 + .../dataprovider-log-xml-isolation.phpt | 46 + .../end-to-end/dataprovider-log-xml.phpt | 45 + .../end-to-end/dataprovider-testdox.phpt | 34 + .../phpunit/tests/end-to-end/debug.phpt | 25 + .../tests/end-to-end/default-isolation.phpt | 19 + .../phpunit/tests/end-to-end/default.phpt | 18 + .../defaulttestsuite-using-testsuite.phpt | 21 + .../tests/end-to-end/defaulttestsuite.phpt | 19 + .../defects-first-order-via-cli.phpt | 37 + .../tests/end-to-end/dependencies-clone.phpt | 22 + .../end-to-end/dependencies-isolation.phpt | 42 + .../tests/end-to-end/dependencies.phpt | 41 + .../end-to-end/dependencies2-isolation.phpt | 19 + .../tests/end-to-end/dependencies2.phpt | 18 + .../end-to-end/dependencies3-isolation.phpt | 19 + .../tests/end-to-end/dependencies3.phpt | 19 + .../disable-code-coverage-ignore.phpt | 40 + .../tests/end-to-end/dump-xdebug-filter.phpt | 32 + .../tests/end-to-end/empty-testcase.phpt | 25 + .../tests/end-to-end/exception-stack.phpt | 64 + .../end-to-end/exclude-group-isolation.phpt | 21 + .../tests/end-to-end/exclude-group.phpt | 20 + .../execution-order-options-via-config.phpt | 30 + .../tests/end-to-end/failure-isolation.phpt | 140 + .../end-to-end/failure-reverse-list.phpt | 140 + .../phpunit/tests/end-to-end/failure.phpt | 139 + .../tests/end-to-end/fatal-isolation.phpt | 24 + .../end-to-end/filter-class-isolation.phpt | 21 + .../tests/end-to-end/filter-class.phpt | 20 + ...ider-by-classname-and-range-isolation.phpt | 21 + ...r-dataprovider-by-classname-and-range.phpt | 20 + ...lter-dataprovider-by-number-isolation.phpt | 21 + .../filter-dataprovider-by-number.phpt | 20 + ...-dataprovider-by-only-range-isolation.phpt | 21 + .../filter-dataprovider-by-only-range.phpt | 20 + ...dataprovider-by-only-regexp-isolation.phpt | 21 + .../filter-dataprovider-by-only-regexp.phpt | 20 + ...dataprovider-by-only-string-isolation.phpt | 21 + .../filter-dataprovider-by-only-string.phpt | 20 + ...ilter-dataprovider-by-range-isolation.phpt | 21 + .../filter-dataprovider-by-range.phpt | 20 + ...lter-dataprovider-by-regexp-isolation.phpt | 21 + .../filter-dataprovider-by-regexp.phpt | 20 + ...lter-dataprovider-by-string-isolation.phpt | 21 + .../filter-dataprovider-by-string.phpt | 20 + .../filter-method-case-insensitive.phpt | 20 + ...ilter-method-case-sensitive-no-result.phpt | 20 + .../end-to-end/filter-method-isolation.phpt | 21 + .../tests/end-to-end/filter-method.phpt | 20 + .../tests/end-to-end/filter-no-results.phpt | 20 + .../end-to-end/forward-compatibility.phpt | 18 + .../tests/end-to-end/group-isolation.phpt | 21 + .../phpunit/tests/end-to-end/group.phpt | 20 + .../phpunit/tests/end-to-end/help.phpt | 113 + .../phpunit/tests/end-to-end/help2.phpt | 114 + .../phpunit/tests/end-to-end/hooks.phpt | 38 + .../tests/end-to-end/ini-isolation.phpt | 21 + .../phpunit/tests/end-to-end/list-groups.phpt | 18 + .../phpunit/tests/end-to-end/list-suites.phpt | 16 + .../end-to-end/list-tests-dataprovider.phpt | 19 + .../list-tests-xml-dataprovider.phpt | 31 + .../tests/end-to-end/log-junit-phpt.phpt | 28 + .../phpunit/tests/end-to-end/log-junit.phpt | 91 + .../tests/end-to-end/log-teamcity-phpt.phpt | 25 + .../tests/end-to-end/log-teamcity.phpt | 38 + .../mock-objects/generator/232.phpt | 135 + .../3154_namespaced_constant_resolving.phpt | 119 + .../mock-objects/generator/397.phpt | 105 + .../generator/abstract_class.phpt | 154 + .../mock-objects/generator/class.phpt | 132 + .../generator/class_call_parent_clone.phpt | 84 + .../class_call_parent_constructor.phpt | 83 + .../class_dont_call_parent_clone.phpt | 83 + .../class_dont_call_parent_constructor.phpt | 83 + ...ing_interface_call_parent_constructor.phpt | 88 + ...nterface_dont_call_parent_constructor.phpt | 88 + .../generator/class_nonexistent_method.phpt | 106 + .../mock-objects/generator/class_partial.phpt | 110 + .../class_with_deprecated_method.phpt | 112 + .../generator/class_with_final_method.phpt | 84 + .../class_with_method_named_method.phpt | 98 + ...ullable_typehinted_variadic_arguments.phpt | 106 + ...od_with_typehinted_variadic_arguments.phpt | 106 + ...s_with_method_with_variadic_arguments.phpt | 106 + .../constant_as_parameter_default_value.phpt | 106 + .../mock-objects/generator/interface.phpt | 104 + .../invocation_object_clone_object.phpt | 133 + .../generator/namespaced_class.phpt | 134 + .../namespaced_class_call_parent_clone.phpt | 86 + ...espaced_class_call_parent_constructor.phpt | 85 + ...mespaced_class_dont_call_parent_clone.phpt | 85 + ...ed_class_dont_call_parent_constructor.phpt | 85 + ...ing_interface_call_parent_constructor.phpt | 90 + ...nterface_dont_call_parent_constructor.phpt | 90 + .../generator/namespaced_class_partial.phpt | 112 + .../generator/namespaced_interface.phpt | 106 + .../generator/nonexistent_class.phpt | 81 + .../nonexistent_class_with_namespace.phpt | 89 + ...ith_namespace_starting_with_separator.phpt | 89 + .../generator/nullable_types.phpt | 106 + .../mock-objects/generator/proxy.phpt | 128 + .../return_type_declarations_closure.phpt | 104 + .../return_type_declarations_final.phpt | 111 + .../return_type_declarations_generator.phpt | 104 + .../return_type_declarations_nullable.phpt | 104 + ...eturn_type_declarations_object_method.phpt | 107 + .../return_type_declarations_parent.phpt | 110 + .../return_type_declarations_self.phpt | 104 + ...eturn_type_declarations_static_method.phpt | 90 + .../return_type_declarations_void.phpt | 102 + .../generator/scalar_type_declarations.phpt | 106 + .../mock-objects/generator/wsdl_class.phpt | 37 + .../generator/wsdl_class_namespace.phpt | 38 + .../generator/wsdl_class_partial.phpt | 30 + .../mock-method/call_original.phpt | 45 + .../call_original_with_argument.phpt | 45 + .../call_original_with_argument_variadic.phpt | 45 + .../call_original_with_return_type_void.phpt | 45 + .../mock-method/clone_method_arguments.phpt | 45 + .../deprecated_with_description.phpt | 50 + .../deprecated_without_description.phpt | 50 + .../mock-method/private_method.phpt | 45 + .../mock-method/protected_method.phpt | 45 + .../mock-method/return_by_reference.phpt | 45 + .../return_by_reference_with_return_type.phpt | 45 + .../mock-objects/mock-method/return_type.phpt | 45 + .../mock-method/return_type_parent.phpt | 49 + .../mock-method/return_type_self.phpt | 45 + .../mock-method/static_method.phpt | 28 + .../static_method_with_return_type.phpt | 28 + .../mock-method/with_argument.phpt | 45 + .../mock-method/with_argument_default.phpt | 45 + .../with_argument_default_constant.phpt | 47 + .../with_argument_default_null.phpt | 45 + .../mock-method/with_argument_nullable.phpt | 45 + .../mock-method/with_argument_reference.phpt | 45 + .../with_argument_typed_array.phpt | 45 + .../with_argument_typed_callable.phpt | 45 + .../with_argument_typed_class.phpt | 45 + .../with_argument_typed_scalar.phpt | 45 + .../mock-method/with_argument_typed_self.phpt | 45 + .../with_argument_typed_unkown_class.phpt | 45 + .../with_argument_typed_variadic.phpt | 45 + .../mock-method/with_argument_variadic.phpt | 45 + .../mock-method/with_arguments.phpt | 45 + .../phpunit/tests/end-to-end/mycommand.phpt | 24 + .../end-to-end/options-after-arguments.phpt | 18 + .../order-by-default-invalid-via-cli.phpt | 19 + .../tests/end-to-end/output-isolation.phpt | 20 + .../end-to-end/phar-extension-suppressed.phpt | 12 + .../tests/end-to-end/phar-extension.phpt | 21 + .../phpunit/tests/end-to-end/phpt-args.phpt | 12 + .../phpunit/tests/end-to-end/phpt-env.phpt | 12 + .../tests/end-to-end/phpt-external.phpt | 6 + .../phpunit/tests/end-to-end/phpt-stderr.phpt | 8 + .../phpunit/tests/end-to-end/phpt-stdin.phpt | 11 + .../phpunit/tests/end-to-end/phpt-xfail.phpt | 18 + .../end-to-end/regression/GitHub/1149.phpt | 20 + .../regression/GitHub/1149/Issue1149Test.php | 28 + .../end-to-end/regression/GitHub/1216.phpt | 25 + .../regression/GitHub/1216/Issue1216Test.php | 18 + .../regression/GitHub/1216/bootstrap1216.php | 10 + .../regression/GitHub/1216/phpunit1216.xml | 8 + .../end-to-end/regression/GitHub/1265.phpt | 21 + .../regression/GitHub/1265/Issue1265Test.php | 18 + .../regression/GitHub/1265/phpunit1265.xml | 2 + .../end-to-end/regression/GitHub/1330.phpt | 24 + .../regression/GitHub/1330/Issue1330Test.php | 18 + .../regression/GitHub/1330/phpunit1330.xml | 5 + .../end-to-end/regression/GitHub/1335.phpt | 19 + .../regression/GitHub/1335/Issue1335Test.php | 77 + .../regression/GitHub/1335/bootstrap1335.php | 21 + .../end-to-end/regression/GitHub/1337.phpt | 19 + .../regression/GitHub/1337/Issue1337Test.php | 29 + .../end-to-end/regression/GitHub/1348.phpt | 33 + .../regression/GitHub/1348/Issue1348Test.php | 24 + .../end-to-end/regression/GitHub/1351.phpt | 46 + .../GitHub/1351/ChildProcessClass1351.php | 12 + .../regression/GitHub/1351/Issue1351Test.php | 59 + .../end-to-end/regression/GitHub/1374.phpt | 19 + .../regression/GitHub/1374/Issue1374Test.php | 31 + .../end-to-end/regression/GitHub/1437.phpt | 26 + .../regression/GitHub/1437/Issue1437Test.php | 19 + .../end-to-end/regression/GitHub/1468.phpt | 20 + .../regression/GitHub/1468/Issue1468Test.php | 21 + .../end-to-end/regression/GitHub/1471.phpt | 26 + .../regression/GitHub/1471/Issue1471Test.php | 22 + .../end-to-end/regression/GitHub/1472.phpt | 18 + .../regression/GitHub/1472/Issue1472Test.php | 31 + .../end-to-end/regression/GitHub/1570.phpt | 27 + .../regression/GitHub/1570/Issue1570Test.php | 18 + ...it-options-via-config-without-invoker.phpt | 33 + .../GitHub/2085-without-invoker.phpt | 34 + .../end-to-end/regression/GitHub/2085.phpt | 38 + .../regression/GitHub/2085/Issue2085Test.php | 20 + ...nfiguration_enforce_time_limit_options.xml | 2 + .../regression/GitHub/2137-filter.phpt | 28 + .../regression/GitHub/2137-no_filter.phpt | 30 + .../regression/GitHub/2137/Issue2137Test.php | 43 + .../end-to-end/regression/GitHub/2145.phpt | 27 + .../regression/GitHub/2145/Issue2145Test.php | 24 + .../end-to-end/regression/GitHub/2158.phpt | 19 + .../regression/GitHub/2158/Issue2158Test.php | 33 + .../regression/GitHub/2158/constant.inc | 5 + .../end-to-end/regression/GitHub/2366.phpt | 19 + .../regression/GitHub/2366/Issue2366Test.php | 41 + .../end-to-end/regression/GitHub/2380.phpt | 19 + .../regression/GitHub/2380/Issue2380Test.php | 29 + .../end-to-end/regression/GitHub/2382.phpt | 19 + .../regression/GitHub/2382/Issue2382Test.php | 30 + .../end-to-end/regression/GitHub/2435.phpt | 20 + .../regression/GitHub/2435/Issue2435Test.php | 16 + .../end-to-end/regression/GitHub/244.phpt | 32 + .../regression/GitHub/244/Issue244Test.php | 65 + .../regression/GitHub/2448-existing-test.phpt | 21 + .../GitHub/2448-not-existing-test.phpt | 13 + .../regression/GitHub/2448/.gitignore | 2 + .../regression/GitHub/2448/Test.php | 16 + ...-separate-class-preserve-no-bootstrap.phpt | 35 + .../GitHub/2591-separate-class-preserve.phpt | 21 + ...nction-no-preserve-no-bootstrap-php73.phpt | 37 + ...ction-no-preserve-no-bootstrap-xdebug.phpt | 39 + ...ate-function-no-preserve-no-bootstrap.phpt | 37 + .../2591-separate-function-no-preserve.phpt | 20 + .../2591-separate-function-preserve.phpt | 20 + .../GitHub/2591/SeparateClassPreserveTest.php | 35 + .../2591/SeparateFunctionNoPreserveTest.php | 28 + .../2591/SeparateFunctionPreserveTest.php | 28 + .../GitHub/2591/bootstrapNoBootstrap.php | 15 + .../GitHub/2591/bootstrapWithBootstrap.php | 12 + .../2591/bootstrapWithBootstrapNoGlobal.php | 11 + .../2724-diff-pid-from-master-process.phpt | 22 + ...SeparateClassRunMethodInNewProcessTest.php | 53 + .../2725-separate-class-before-after-pid.phpt | 18 + .../GitHub/2725/BeforeAfterClassPidTest.php | 50 + .../end-to-end/regression/GitHub/2731.phpt | 26 + .../regression/GitHub/2731/Issue2731Test.php | 19 + .../end-to-end/regression/GitHub/2811.phpt | 20 + .../regression/GitHub/2811/Issue2811Test.php | 18 + .../end-to-end/regression/GitHub/2830.phpt | 20 + .../regression/GitHub/2830/Issue2830Test.php | 27 + .../end-to-end/regression/GitHub/2972.phpt | 18 + .../GitHub/2972/issue-2972-test.phpt | 10 + .../2972/unconventiallyNamedIssue2972Test.php | 20 + .../regression/GitHub/3093/Issue3093Test.php | 30 + .../GitHub/3093/issue-3093-test.phpt | 19 + .../regression/GitHub/3107/Issue3107Test.php | 25 + .../GitHub/3107/issue-3107-test.phpt | 27 + .../regression/GitHub/3156/Issue3156Test.php | 41 + .../end-to-end/regression/GitHub/322.phpt | 27 + .../regression/GitHub/322/Issue322Test.php | 29 + .../regression/GitHub/322/phpunit322.xml | 11 + .../GitHub/3364/issue-3364-test.phpt | 58 + .../tests/Issue3364SetupBeforeClassTest.php | 30 + .../GitHub/3364/tests/Issue3364SetupTest.php | 30 + .../end-to-end/regression/GitHub/3379.phpt | 20 + .../regression/GitHub/3379/Issue3379Test.php | 28 + .../GitHub/3379/Issue3379TestListener.php | 26 + .../regression/GitHub/3379/phpunit.xml | 13 + .../GitHub/3380/issue-3380-test.phpt | 63 + .../GitHub/3396/issue-3396-test.phpt | 55 + .../end-to-end/regression/GitHub/433.phpt | 31 + .../regression/GitHub/433/Issue433Test.php | 31 + .../end-to-end/regression/GitHub/445.phpt | 32 + .../regression/GitHub/445/Issue445Test.php | 31 + .../end-to-end/regression/GitHub/498.phpt | 29 + .../regression/GitHub/498/Issue498Test.php | 53 + .../end-to-end/regression/GitHub/503.phpt | 35 + .../regression/GitHub/503/Issue503Test.php | 21 + .../end-to-end/regression/GitHub/581.phpt | 40 + .../regression/GitHub/581/Issue581Test.php | 21 + .../end-to-end/regression/GitHub/74.phpt | 28 + .../regression/GitHub/74/Issue74Test.php | 20 + .../regression/GitHub/74/NewException.php | 12 + .../end-to-end/regression/GitHub/765.phpt | 26 + .../regression/GitHub/765/Issue765Test.php | 32 + .../end-to-end/regression/GitHub/797.phpt | 22 + .../regression/GitHub/797/Issue797Test.php | 20 + .../regression/GitHub/797/bootstrap797.php | 13 + .../end-to-end/regression/GitHub/863.phpt | 24 + .../end-to-end/regression/GitHub/873.phpt | 21 + .../regression/GitHub/873/Issue873Test.php | 16 + .../end-to-end/regression/Trac/1021.phpt | 19 + .../regression/Trac/1021/Issue1021Test.php | 34 + .../tests/end-to-end/regression/Trac/523.phpt | 19 + .../regression/Trac/523/Issue523Test.php | 23 + .../tests/end-to-end/regression/Trac/578.phpt | 37 + .../regression/Trac/578/Issue578Test.php | 30 + .../tests/end-to-end/regression/Trac/684.phpt | 25 + .../regression/Trac/684/Issue684Test.php | 14 + .../tests/end-to-end/regression/Trac/783.phpt | 21 + .../regression/Trac/783/ChildSuite.php | 26 + .../regression/Trac/783/OneTest.php | 21 + .../regression/Trac/783/ParentSuite.php | 23 + .../regression/Trac/783/TwoTest.php | 21 + .../phpunit/tests/end-to-end/repeat.phpt | 20 + ...ated-with-does-not-perform-assertions.phpt | 24 + .../report-useless-tests-incomplete.phpt | 19 + .../report-useless-tests-isolation.phpt | 27 + .../end-to-end/report-useless-tests.phpt | 26 + .../end-to-end/stop-on-defect-via-cli.phpt | 25 + .../end-to-end/stop-on-defect-via-config.phpt | 25 + .../end-to-end/stop-on-error-via-cli.phpt | 27 + .../end-to-end/stop-on-error-via-config.phpt | 27 + .../stop-on-incomplete-via-cli.phpt | 20 + .../stop-on-incomplete-via-config.phpt | 20 + .../end-to-end/stop-on-warning-via-cli.phpt | 25 + .../stop-on-warning-via-config.phpt | 26 + .../end-to-end/teamcity-inner-exceptions.phpt | 39 + .../phpunit/tests/end-to-end/teamcity.phpt | 37 + ...mized-seed-with-dependency-resolution.phpt | 37 + ...randomized-with-dependency-resolution.phpt | 25 + ...r-reversed-with-dependency-resolution.phpt | 35 + ...eversed-without-dependency-resolution.phpt | 44 + .../end-to-end/test-suffix-multiple.phpt | 19 + .../tests/end-to-end/test-suffix-single.phpt | 19 + .../testdox-dataprovider-placeholder.phpt | 20 + .../end-to-end/testdox-exclude-group.phpt | 25 + .../tests/end-to-end/testdox-group.phpt | 25 + .../tests/end-to-end/testdox-html.phpt | 57 + .../tests/end-to-end/testdox-text.phpt | 25 + .../tests/end-to-end/testdox-verbose.phpt | 25 + .../phpunit/tests/end-to-end/testdox-xml.phpt | 64 + .../phpunit/tests/end-to-end/testdox.phpt | 22 + vendor/phpunit/phpunit/tests/fail/fail.phpt | 5 + .../tests/unit/Framework/AssertTest.php | 3288 ++ .../Framework/Constraint/ArrayHasKeyTest.php | 64 + .../Framework/Constraint/ArraySubsetTest.php | 86 + .../Framework/Constraint/AttributeTest.php | 80 + .../Framework/Constraint/CallbackTest.php | 65 + .../Constraint/ClassHasAttributeTest.php | 70 + .../ClassHasStaticAttributeTest.php | 66 + .../Constraint/ConstraintTestCase.php | 54 + .../unit/Framework/Constraint/CountTest.php | 145 + .../Constraint/DirectoryExistsTest.php | 66 + .../Constraint/ExceptionMessageRegExpTest.php | 55 + .../Constraint/ExceptionMessageTest.php | 51 + .../Framework/Constraint/FileExistsTest.php | 65 + .../Framework/Constraint/GreaterThanTest.php | 66 + .../unit/Framework/Constraint/IsEmptyTest.php | 67 + .../unit/Framework/Constraint/IsEqualTest.php | 321 + .../Framework/Constraint/IsIdenticalTest.php | 197 + .../Framework/Constraint/IsInstanceOfTest.php | 41 + .../unit/Framework/Constraint/IsJsonTest.php | 34 + .../unit/Framework/Constraint/IsNullTest.php | 66 + .../Framework/Constraint/IsReadableTest.php | 42 + .../unit/Framework/Constraint/IsTypeTest.php | 111 + .../Framework/Constraint/IsWritableTest.php | 42 + .../JsonMatchesErrorMessageProviderTest.php | 87 + .../Framework/Constraint/JsonMatchesTest.php | 94 + .../Framework/Constraint/LessThanTest.php | 66 + .../Framework/Constraint/LogicalAndTest.php | 237 + .../Framework/Constraint/LogicalOrTest.php | 232 + .../Framework/Constraint/LogicalXorTest.php | 44 + .../Constraint/ObjectHasAttributeTest.php | 66 + .../Constraint/RegularExpressionTest.php | 66 + .../Framework/Constraint/SameSizeTest.php | 62 + .../Constraint/StringContainsTest.php | 96 + .../Constraint/StringEndsWithTest.php | 87 + .../StringMatchesFormatDescriptionTest.php | 278 + .../Constraint/StringStartsWithTest.php | 88 + .../Constraint/TraversableContainsTest.php | 170 + .../tests/unit/Framework/ConstraintTest.php | 1492 + .../unit/Framework/ExceptionWrapperTest.php | 55 + .../Builder/InvocationMockerTest.php | 89 + .../Framework/MockObject/GeneratorTest.php | 245 + .../Invocation/ObjectInvocationTest.php | 120 + .../Invocation/StaticInvocationTest.php | 114 + .../Matcher/ConsecutiveParametersTest.php | 68 + .../Framework/MockObject/MockBuilderTest.php | 129 + .../Framework/MockObject/MockMethodTest.php | 55 + .../Framework/MockObject/MockObjectTest.php | 1128 + .../Framework/MockObject/ProxyObjectTest.php | 41 + .../tests/unit/Framework/TestCaseTest.php | 766 + .../tests/unit/Framework/TestFailureTest.php | 141 + .../unit/Framework/TestImplementorTest.php | 25 + .../tests/unit/Framework/TestListenerTest.php | 60 + .../tests/unit/Framework/TestResultTest.php | 86 + .../tests/unit/Framework/TestSuiteTest.php | 225 + .../Runner/Filter/NameFilterIteratorTest.php | 38 + .../tests/unit/Runner/PhptTestCaseTest.php | 330 + .../unit/Runner/ResultCacheExtensionTest.php | 139 + .../tests/unit/Runner/TestSuiteSorterTest.php | 608 + .../tests/unit/TextUI/TestRunnerTest.php | 49 + .../unit/Util/ConfigurationGeneratorTest.php | 51 + .../tests/unit/Util/ConfigurationTest.php | 614 + .../phpunit/tests/unit/Util/GetoptTest.php | 214 + .../tests/unit/Util/GlobalStateTest.php | 35 + .../phpunit/tests/unit/Util/JsonTest.php | 78 + .../unit/Util/NullTestResultCacheTest.php | 28 + .../unit/Util/PHP/AbstractPhpProcessTest.php | 119 + .../tests/unit/Util/RegularExpressionTest.php | 56 + .../Util/TestDox/CliTestDoxPrinterTest.php | 209 + .../unit/Util/TestDox/NamePrettifierTest.php | 172 + .../tests/unit/Util/TestResultCacheTest.php | 95 + .../phpunit/tests/unit/Util/TestTest.php | 1044 + .../Util/XDebugFilterScriptGeneratorTest.php | 46 + .../phpunit/tests/unit/Util/XmlTest.php | 119 + .../_files/expectedXDebugFilterScript.txt | 14 + vendor/psr/container/.gitignore | 3 + vendor/psr/container/LICENSE | 21 + vendor/psr/container/README.md | 5 + vendor/psr/container/composer.json | 27 + .../src/ContainerExceptionInterface.php | 13 + .../psr/container/src/ContainerInterface.php | 37 + .../src/NotFoundExceptionInterface.php | 13 + vendor/psr/http-message/CHANGELOG.md | 36 + vendor/psr/http-message/LICENSE | 19 + vendor/psr/http-message/README.md | 13 + vendor/psr/http-message/composer.json | 26 + .../psr/http-message/src/MessageInterface.php | 187 + .../psr/http-message/src/RequestInterface.php | 129 + .../http-message/src/ResponseInterface.php | 68 + .../src/ServerRequestInterface.php | 261 + .../psr/http-message/src/StreamInterface.php | 158 + .../src/UploadedFileInterface.php | 123 + vendor/psr/http-message/src/UriInterface.php | 323 + vendor/psr/log/.gitignore | 1 + vendor/psr/log/LICENSE | 19 + vendor/psr/log/Psr/Log/AbstractLogger.php | 128 + .../log/Psr/Log/InvalidArgumentException.php | 7 + vendor/psr/log/Psr/Log/LogLevel.php | 18 + .../psr/log/Psr/Log/LoggerAwareInterface.php | 18 + vendor/psr/log/Psr/Log/LoggerAwareTrait.php | 26 + vendor/psr/log/Psr/Log/LoggerInterface.php | 123 + vendor/psr/log/Psr/Log/LoggerTrait.php | 140 + vendor/psr/log/Psr/Log/NullLogger.php | 28 + .../log/Psr/Log/Test/LoggerInterfaceTest.php | 144 + vendor/psr/log/Psr/Log/Test/TestLogger.php | 146 + vendor/psr/log/README.md | 52 + vendor/psr/log/composer.json | 26 + vendor/psr/simple-cache/.editorconfig | 12 + vendor/psr/simple-cache/LICENSE.md | 21 + vendor/psr/simple-cache/README.md | 8 + vendor/psr/simple-cache/composer.json | 25 + .../psr/simple-cache/src/CacheException.php | 10 + .../psr/simple-cache/src/CacheInterface.php | 114 + .../src/InvalidArgumentException.php | 13 + vendor/ralouphie/getallheaders/.gitignore | 5 + vendor/ralouphie/getallheaders/.travis.yml | 18 + vendor/ralouphie/getallheaders/LICENSE | 21 + vendor/ralouphie/getallheaders/README.md | 19 + vendor/ralouphie/getallheaders/composer.json | 21 + vendor/ralouphie/getallheaders/phpunit.xml | 22 + .../getallheaders/src/getallheaders.php | 46 + .../getallheaders/tests/GetAllHeadersTest.php | 121 + vendor/ramsey/uuid/CHANGELOG.md | 376 + vendor/ramsey/uuid/CODE_OF_CONDUCT.md | 74 + vendor/ramsey/uuid/CONTRIBUTING.md | 75 + vendor/ramsey/uuid/LICENSE | 19 + vendor/ramsey/uuid/README.md | 159 + vendor/ramsey/uuid/composer.json | 80 + vendor/ramsey/uuid/src/BinaryUtils.php | 43 + .../uuid/src/Builder/DefaultUuidBuilder.php | 54 + .../uuid/src/Builder/DegradedUuidBuilder.php | 53 + .../uuid/src/Builder/UuidBuilderInterface.php | 34 + .../ramsey/uuid/src/Codec/CodecInterface.php | 58 + .../ramsey/uuid/src/Codec/GuidStringCodec.php | 102 + .../uuid/src/Codec/OrderedTimeCodec.php | 68 + vendor/ramsey/uuid/src/Codec/StringCodec.php | 170 + .../src/Codec/TimestampFirstCombCodec.php | 107 + .../uuid/src/Codec/TimestampLastCombCodec.php | 23 + .../Converter/Number/BigNumberConverter.php | 54 + .../Number/DegradedNumberConverter.php | 58 + .../Converter/NumberConverterInterface.php | 46 + .../Converter/Time/BigNumberTimeConverter.php | 58 + .../Converter/Time/DegradedTimeConverter.php | 42 + .../src/Converter/Time/PhpTimeConverter.php | 47 + .../src/Converter/TimeConverterInterface.php | 35 + vendor/ramsey/uuid/src/DegradedUuid.php | 114 + .../Exception/InvalidUuidStringException.php | 22 + .../UnsatisfiedDependencyException.php | 23 + .../UnsupportedOperationException.php | 22 + vendor/ramsey/uuid/src/FeatureSet.php | 333 + .../uuid/src/Generator/CombGenerator.php | 88 + .../src/Generator/DefaultTimeGenerator.php | 138 + .../uuid/src/Generator/MtRandGenerator.php | 41 + .../uuid/src/Generator/OpenSslGenerator.php | 38 + .../src/Generator/PeclUuidRandomGenerator.php | 37 + .../src/Generator/PeclUuidTimeGenerator.php | 38 + .../src/Generator/RandomBytesGenerator.php | 37 + .../src/Generator/RandomGeneratorFactory.php | 31 + .../Generator/RandomGeneratorInterface.php | 33 + .../uuid/src/Generator/RandomLibAdapter.php | 62 + .../src/Generator/SodiumRandomGenerator.php | 36 + .../src/Generator/TimeGeneratorFactory.php | 72 + .../src/Generator/TimeGeneratorInterface.php | 39 + .../Provider/Node/FallbackNodeProvider.php | 58 + .../src/Provider/Node/RandomNodeProvider.php | 42 + .../src/Provider/Node/SystemNodeProvider.php | 125 + .../src/Provider/NodeProviderInterface.php | 30 + .../src/Provider/Time/FixedTimeProvider.php | 76 + .../src/Provider/Time/SystemTimeProvider.php | 33 + .../src/Provider/TimeProviderInterface.php | 29 + vendor/ramsey/uuid/src/Uuid.php | 740 + vendor/ramsey/uuid/src/UuidFactory.php | 314 + .../ramsey/uuid/src/UuidFactoryInterface.php | 103 + vendor/ramsey/uuid/src/UuidInterface.php | 270 + .../code-unit-reverse-lookup/.gitignore | 4 + .../code-unit-reverse-lookup/.php_cs | 67 + .../code-unit-reverse-lookup/.travis.yml | 25 + .../code-unit-reverse-lookup/ChangeLog.md | 10 + .../code-unit-reverse-lookup/LICENSE | 33 + .../code-unit-reverse-lookup/README.md | 14 + .../code-unit-reverse-lookup/build.xml | 22 + .../code-unit-reverse-lookup/composer.json | 28 + .../code-unit-reverse-lookup/phpunit.xml | 21 + .../code-unit-reverse-lookup/src/Wizard.php | 111 + .../tests/WizardTest.php | 45 + vendor/sebastian/comparator/.github/stale.yml | 40 + vendor/sebastian/comparator/.gitignore | 4 + vendor/sebastian/comparator/.php_cs.dist | 189 + vendor/sebastian/comparator/.travis.yml | 33 + vendor/sebastian/comparator/ChangeLog.md | 59 + vendor/sebastian/comparator/LICENSE | 33 + vendor/sebastian/comparator/README.md | 37 + vendor/sebastian/comparator/build.xml | 21 + vendor/sebastian/comparator/composer.json | 54 + vendor/sebastian/comparator/phpunit.xml | 21 + .../comparator/src/ArrayComparator.php | 130 + .../sebastian/comparator/src/Comparator.php | 61 + .../comparator/src/ComparisonFailure.php | 128 + .../comparator/src/DOMNodeComparator.php | 86 + .../comparator/src/DateTimeComparator.php | 86 + .../comparator/src/DoubleComparator.php | 56 + .../comparator/src/ExceptionComparator.php | 52 + vendor/sebastian/comparator/src/Factory.php | 138 + .../comparator/src/MockObjectComparator.php | 47 + .../comparator/src/NumericComparator.php | 68 + .../comparator/src/ObjectComparator.php | 106 + .../comparator/src/ResourceComparator.php | 52 + .../comparator/src/ScalarComparator.php | 91 + .../src/SplObjectStorageComparator.php | 69 + .../comparator/src/TypeComparator.php | 59 + .../comparator/tests/ArrayComparatorTest.php | 161 + .../tests/ComparisonFailureTest.php | 59 + .../tests/DOMNodeComparatorTest.php | 180 + .../tests/DateTimeComparatorTest.php | 213 + .../comparator/tests/DoubleComparatorTest.php | 135 + .../tests/ExceptionComparatorTest.php | 136 + .../comparator/tests/FactoryTest.php | 117 + .../tests/MockObjectComparatorTest.php | 168 + .../tests/NumericComparatorTest.php | 123 + .../comparator/tests/ObjectComparatorTest.php | 150 + .../tests/ResourceComparatorTest.php | 122 + .../comparator/tests/ScalarComparatorTest.php | 164 + .../tests/SplObjectStorageComparatorTest.php | 145 + .../comparator/tests/TypeComparatorTest.php | 107 + .../comparator/tests/_fixture/Author.php | 26 + .../comparator/tests/_fixture/Book.php | 19 + .../tests/_fixture/ClassWithToString.php | 18 + .../comparator/tests/_fixture/SampleClass.php | 29 + .../comparator/tests/_fixture/Struct.php | 23 + .../comparator/tests/_fixture/TestClass.php | 14 + .../tests/_fixture/TestClassComparator.php | 14 + vendor/sebastian/diff/.github/stale.yml | 40 + vendor/sebastian/diff/.gitignore | 5 + vendor/sebastian/diff/.php_cs.dist | 168 + vendor/sebastian/diff/.travis.yml | 25 + vendor/sebastian/diff/ChangeLog.md | 46 + vendor/sebastian/diff/LICENSE | 33 + vendor/sebastian/diff/README.md | 195 + vendor/sebastian/diff/build.xml | 22 + vendor/sebastian/diff/composer.json | 39 + vendor/sebastian/diff/phpunit.xml | 21 + vendor/sebastian/diff/src/Chunk.php | 78 + vendor/sebastian/diff/src/Diff.php | 67 + vendor/sebastian/diff/src/Differ.php | 330 + .../src/Exception/ConfigurationException.php | 40 + .../diff/src/Exception/Exception.php | 15 + .../Exception/InvalidArgumentException.php | 15 + vendor/sebastian/diff/src/Line.php | 44 + .../LongestCommonSubsequenceCalculator.php | 24 + ...ientLongestCommonSubsequenceCalculator.php | 81 + .../src/Output/AbstractChunkOutputBuilder.php | 56 + .../diff/src/Output/DiffOnlyOutputBuilder.php | 68 + .../src/Output/DiffOutputBuilderInterface.php | 20 + .../Output/StrictUnifiedDiffOutputBuilder.php | 318 + .../src/Output/UnifiedDiffOutputBuilder.php | 264 + vendor/sebastian/diff/src/Parser.php | 106 + ...ientLongestCommonSubsequenceCalculator.php | 66 + vendor/sebastian/diff/tests/ChunkTest.php | 68 + vendor/sebastian/diff/tests/DiffTest.php | 55 + vendor/sebastian/diff/tests/DifferTest.php | 462 + .../Exception/ConfigurationExceptionTest.php | 41 + .../InvalidArgumentExceptionTest.php | 33 + vendor/sebastian/diff/tests/LineTest.php | 44 + .../tests/LongestCommonSubsequenceTest.php | 201 + .../MemoryEfficientImplementationTest.php | 22 + .../Output/AbstractChunkOutputBuilderTest.php | 152 + .../Output/DiffOnlyOutputBuilderTest.php | 76 + ...nifiedDiffOutputBuilderIntegrationTest.php | 299 + ...nifiedDiffOutputBuilderIntegrationTest.php | 163 + ...ctUnifiedDiffOutputBuilderDataProvider.php | 189 + .../StrictUnifiedDiffOutputBuilderTest.php | 684 + .../UnifiedDiffOutputBuilderDataProvider.php | 396 + .../Output/UnifiedDiffOutputBuilderTest.php | 90 + vendor/sebastian/diff/tests/ParserTest.php | 175 + .../tests/TimeEfficientImplementationTest.php | 22 + .../sebastian/diff/tests/Utils/FileUtils.php | 31 + .../tests/Utils/UnifiedDiffAssertTrait.php | 277 + .../UnifiedDiffAssertTraitIntegrationTest.php | 129 + .../Utils/UnifiedDiffAssertTraitTest.php | 434 + .../diff/tests/fixtures/.editorconfig | 1 + .../1_a.txt | 1 + .../1_b.txt | 0 .../2_a.txt | 35 + .../2_b.txt | 18 + .../diff/tests/fixtures/out/.editorconfig | 1 + .../diff/tests/fixtures/out/.gitignore | 2 + .../sebastian/diff/tests/fixtures/patch.txt | 9 + .../sebastian/diff/tests/fixtures/patch2.txt | 21 + .../diff/tests/fixtures/serialized_diff.bin | Bin 0 -> 4143 bytes .../sebastian/environment/.github/stale.yml | 40 + vendor/sebastian/environment/.gitignore | 5 + vendor/sebastian/environment/.php_cs.dist | 199 + vendor/sebastian/environment/.travis.yml | 25 + vendor/sebastian/environment/ChangeLog.md | 69 + vendor/sebastian/environment/LICENSE | 33 + vendor/sebastian/environment/README.md | 17 + vendor/sebastian/environment/build.xml | 19 + vendor/sebastian/environment/composer.json | 34 + vendor/sebastian/environment/phpunit.xml | 20 + vendor/sebastian/environment/src/Console.php | 160 + .../environment/src/OperatingSystem.php | 48 + vendor/sebastian/environment/src/Runtime.php | 184 + .../environment/tests/ConsoleTest.php | 64 + .../environment/tests/OperatingSystemTest.php | 36 + .../environment/tests/RuntimeTest.php | 109 + vendor/sebastian/exporter/.gitignore | 4 + vendor/sebastian/exporter/.php_cs | 77 + vendor/sebastian/exporter/.travis.yml | 26 + vendor/sebastian/exporter/LICENSE | 33 + vendor/sebastian/exporter/README.md | 172 + vendor/sebastian/exporter/build.xml | 21 + vendor/sebastian/exporter/composer.json | 48 + vendor/sebastian/exporter/phpunit.xml | 19 + vendor/sebastian/exporter/src/Exporter.php | 312 + .../sebastian/exporter/tests/ExporterTest.php | 361 + vendor/sebastian/global-state/.gitignore | 4 + vendor/sebastian/global-state/.php_cs | 79 + vendor/sebastian/global-state/.travis.yml | 26 + vendor/sebastian/global-state/LICENSE | 33 + vendor/sebastian/global-state/README.md | 16 + vendor/sebastian/global-state/build.xml | 22 + vendor/sebastian/global-state/composer.json | 40 + vendor/sebastian/global-state/phpunit.xml | 24 + .../sebastian/global-state/src/Blacklist.php | 123 + .../global-state/src/CodeExporter.php | 94 + .../sebastian/global-state/src/Restorer.php | 137 + .../sebastian/global-state/src/Snapshot.php | 368 + .../global-state/src/exceptions/Exception.php | 17 + .../src/exceptions/RuntimeException.php | 17 + .../global-state/tests/BlacklistTest.php | 120 + .../global-state/tests/CodeExporterTest.php | 38 + .../global-state/tests/RestorerTest.php | 105 + .../global-state/tests/SnapshotTest.php | 116 + .../tests/_fixture/BlacklistedChildClass.php | 17 + .../tests/_fixture/BlacklistedClass.php | 18 + .../tests/_fixture/BlacklistedImplementor.php | 18 + .../tests/_fixture/BlacklistedInterface.php | 17 + .../tests/_fixture/SnapshotClass.php | 37 + .../tests/_fixture/SnapshotDomDocument.php | 19 + .../tests/_fixture/SnapshotFunctions.php | 17 + .../tests/_fixture/SnapshotTrait.php | 17 + vendor/sebastian/object-enumerator/.gitignore | 8 + vendor/sebastian/object-enumerator/.php_cs | 67 + .../sebastian/object-enumerator/.travis.yml | 26 + .../sebastian/object-enumerator/ChangeLog.md | 53 + vendor/sebastian/object-enumerator/LICENSE | 33 + vendor/sebastian/object-enumerator/README.md | 14 + vendor/sebastian/object-enumerator/build.xml | 22 + .../sebastian/object-enumerator/composer.json | 35 + .../sebastian/object-enumerator/phpunit.xml | 20 + .../object-enumerator/src/Enumerator.php | 85 + .../object-enumerator/src/Exception.php | 15 + .../src/InvalidArgumentException.php | 15 + .../tests/EnumeratorTest.php | 139 + .../tests/_fixture/ExceptionThrower.php | 28 + vendor/sebastian/object-reflector/.gitignore | 4 + vendor/sebastian/object-reflector/.php_cs | 79 + vendor/sebastian/object-reflector/.travis.yml | 26 + .../sebastian/object-reflector/ChangeLog.md | 20 + vendor/sebastian/object-reflector/LICENSE | 33 + vendor/sebastian/object-reflector/README.md | 14 + vendor/sebastian/object-reflector/build.xml | 22 + .../sebastian/object-reflector/composer.json | 33 + vendor/sebastian/object-reflector/phpunit.xml | 19 + .../object-reflector/src/Exception.php | 17 + .../src/InvalidArgumentException.php | 17 + .../object-reflector/src/ObjectReflector.php | 51 + .../tests/ObjectReflectorTest.php | 70 + .../tests/_fixture/ChildClass.php | 25 + .../ClassWithIntegerAttributeName.php | 22 + .../tests/_fixture/ParentClass.php | 20 + vendor/sebastian/recursion-context/.gitignore | 3 + .../sebastian/recursion-context/.travis.yml | 23 + vendor/sebastian/recursion-context/LICENSE | 33 + vendor/sebastian/recursion-context/README.md | 14 + vendor/sebastian/recursion-context/build.xml | 21 + .../sebastian/recursion-context/composer.json | 36 + .../sebastian/recursion-context/phpunit.xml | 19 + .../recursion-context/src/Context.php | 167 + .../recursion-context/src/Exception.php | 17 + .../src/InvalidArgumentException.php | 17 + .../recursion-context/tests/ContextTest.php | 142 + .../resource-operations/.github/stale.yml | 40 + .../sebastian/resource-operations/.gitignore | 5 + .../resource-operations/.php_cs.dist | 191 + .../resource-operations/ChangeLog.md | 26 + vendor/sebastian/resource-operations/LICENSE | 33 + .../sebastian/resource-operations/README.md | 14 + .../sebastian/resource-operations/build.xml | 38 + .../resource-operations/build/generate.php | 65 + .../resource-operations/composer.json | 33 + .../src/ResourceOperations.php | 2232 ++ .../tests/ResourceOperationsTest.php | 26 + vendor/sebastian/version/.gitattributes | 1 + vendor/sebastian/version/.gitignore | 1 + vendor/sebastian/version/.php_cs | 66 + vendor/sebastian/version/LICENSE | 33 + vendor/sebastian/version/README.md | 43 + vendor/sebastian/version/composer.json | 29 + vendor/sebastian/version/src/Version.php | 109 + vendor/spatie/laravel-permission/CHANGELOG.md | 379 + .../spatie/laravel-permission/CONTRIBUTING.md | 32 + vendor/spatie/laravel-permission/LICENSE.md | 21 + vendor/spatie/laravel-permission/README.md | 987 + .../spatie/laravel-permission/composer.json | 59 + .../laravel-permission/config/permission.php | 127 + .../create_permission_tables.php.stub | 102 + .../src/Commands/CacheReset.php | 20 + .../src/Commands/CreatePermission.php | 27 + .../src/Commands/CreateRole.php | 47 + .../src/Contracts/Permission.php | 49 + .../laravel-permission/src/Contracts/Role.php | 58 + .../src/Exceptions/GuardDoesNotMatch.php | 14 + .../Exceptions/PermissionAlreadyExists.php | 13 + .../src/Exceptions/PermissionDoesNotExist.php | 18 + .../src/Exceptions/RoleAlreadyExists.php | 13 + .../src/Exceptions/RoleDoesNotExist.php | 18 + .../src/Exceptions/UnauthorizedException.php | 72 + .../spatie/laravel-permission/src/Guard.php | 51 + .../src/Middlewares/PermissionMiddleware.php | 28 + .../src/Middlewares/RoleMiddleware.php | 27 + .../RoleOrPermissionMiddleware.php | 27 + .../src/Models/Permission.php | 145 + .../laravel-permission/src/Models/Role.php | 156 + .../src/PermissionRegistrar.php | 189 + .../src/PermissionServiceProvider.php | 166 + .../src/Traits/HasPermissions.php | 526 + .../src/Traits/HasRoles.php | 293 + .../src/Traits/RefreshesPermissionCache.php | 19 + .../spatie/laravel-permission/src/helpers.php | 23 + vendor/swiftmailer/swiftmailer/.gitattributes | 9 + .../swiftmailer/.github/ISSUE_TEMPLATE.md | 19 + .../.github/PULL_REQUEST_TEMPLATE.md | 14 + vendor/swiftmailer/swiftmailer/.gitignore | 8 + vendor/swiftmailer/swiftmailer/.php_cs.dist | 16 + vendor/swiftmailer/swiftmailer/.travis.yml | 25 + vendor/swiftmailer/swiftmailer/CHANGES | 332 + vendor/swiftmailer/swiftmailer/LICENSE | 19 + vendor/swiftmailer/swiftmailer/README | 15 + vendor/swiftmailer/swiftmailer/composer.json | 40 + .../swiftmailer/swiftmailer/doc/headers.rst | 621 + vendor/swiftmailer/swiftmailer/doc/index.rst | 12 + .../swiftmailer/doc/introduction.rst | 61 + .../swiftmailer/swiftmailer/doc/japanese.rst | 19 + .../swiftmailer/swiftmailer/doc/messages.rst | 950 + .../swiftmailer/swiftmailer/doc/plugins.rst | 337 + .../swiftmailer/swiftmailer/doc/sending.rst | 453 + .../swiftmailer/lib/classes/Swift.php | 78 + .../lib/classes/Swift/AddressEncoder.php | 25 + .../AddressEncoder/IdnAddressEncoder.php | 69 + .../AddressEncoder/Utf8AddressEncoder.php | 36 + .../classes/Swift/AddressEncoderException.php | 32 + .../lib/classes/Swift/Attachment.php | 54 + .../AbstractFilterableInputStream.php | 176 + .../Swift/ByteStream/ArrayByteStream.php | 178 + .../Swift/ByteStream/FileByteStream.php | 216 + .../ByteStream/TemporaryFileByteStream.php | 42 + .../lib/classes/Swift/CharacterReader.php | 67 + .../GenericFixedWidthReader.php | 97 + .../Swift/CharacterReader/UsAsciiReader.php | 84 + .../Swift/CharacterReader/Utf8Reader.php | 176 + .../classes/Swift/CharacterReaderFactory.php | 26 + .../SimpleCharacterReaderFactory.php | 124 + .../lib/classes/Swift/CharacterStream.php | 89 + .../CharacterStream/ArrayCharacterStream.php | 291 + .../CharacterStream/NgCharacterStream.php | 262 + .../lib/classes/Swift/ConfigurableSpool.php | 63 + .../lib/classes/Swift/DependencyContainer.php | 391 + .../lib/classes/Swift/DependencyException.php | 27 + .../lib/classes/Swift/EmbeddedFile.php | 53 + .../swiftmailer/lib/classes/Swift/Encoder.php | 28 + .../classes/Swift/Encoder/Base64Encoder.php | 58 + .../lib/classes/Swift/Encoder/QpEncoder.php | 300 + .../classes/Swift/Encoder/Rfc2231Encoder.php | 90 + .../lib/classes/Swift/Events/CommandEvent.php | 64 + .../classes/Swift/Events/CommandListener.php | 24 + .../lib/classes/Swift/Events/Event.php | 38 + .../classes/Swift/Events/EventDispatcher.php | 83 + .../classes/Swift/Events/EventListener.php | 18 + .../lib/classes/Swift/Events/EventObject.php | 61 + .../classes/Swift/Events/ResponseEvent.php | 64 + .../classes/Swift/Events/ResponseListener.php | 24 + .../lib/classes/Swift/Events/SendEvent.php | 126 + .../lib/classes/Swift/Events/SendListener.php | 31 + .../Swift/Events/SimpleEventDispatcher.php | 143 + .../Swift/Events/TransportChangeEvent.php | 27 + .../Swift/Events/TransportChangeListener.php | 45 + .../Swift/Events/TransportExceptionEvent.php | 43 + .../Events/TransportExceptionListener.php | 24 + .../lib/classes/Swift/FailoverTransport.php | 33 + .../lib/classes/Swift/FileSpool.php | 208 + .../lib/classes/Swift/FileStream.php | 24 + .../lib/classes/Swift/Filterable.php | 32 + .../lib/classes/Swift/IdGenerator.php | 22 + .../swiftmailer/lib/classes/Swift/Image.php | 43 + .../lib/classes/Swift/InputByteStream.php | 75 + .../lib/classes/Swift/IoException.php | 28 + .../lib/classes/Swift/KeyCache.php | 105 + .../classes/Swift/KeyCache/ArrayKeyCache.php | 203 + .../classes/Swift/KeyCache/DiskKeyCache.php | 295 + .../Swift/KeyCache/KeyCacheInputStream.php | 51 + .../classes/Swift/KeyCache/NullKeyCache.php | 113 + .../KeyCache/SimpleKeyCacheInputStream.php | 123 + .../classes/Swift/LoadBalancedTransport.php | 33 + .../swiftmailer/lib/classes/Swift/Mailer.php | 98 + .../Swift/Mailer/ArrayRecipientIterator.php | 53 + .../Swift/Mailer/RecipientIterator.php | 32 + .../lib/classes/Swift/MemorySpool.php | 110 + .../swiftmailer/lib/classes/Swift/Message.php | 279 + .../lib/classes/Swift/Mime/Attachment.php | 144 + .../classes/Swift/Mime/CharsetObserver.php | 24 + .../lib/classes/Swift/Mime/ContentEncoder.php | 34 + .../ContentEncoder/Base64ContentEncoder.php | 101 + .../ContentEncoder/NativeQpContentEncoder.php | 123 + .../ContentEncoder/NullContentEncoder.php | 79 + .../ContentEncoder/PlainContentEncoder.php | 164 + .../Mime/ContentEncoder/QpContentEncoder.php | 134 + .../ContentEncoder/QpContentEncoderProxy.php | 96 + .../Mime/ContentEncoder/RawContentEncoder.php | 65 + .../lib/classes/Swift/Mime/EmbeddedFile.php | 41 + .../classes/Swift/Mime/EncodingObserver.php | 24 + .../lib/classes/Swift/Mime/Header.php | 93 + .../lib/classes/Swift/Mime/HeaderEncoder.php | 24 + .../HeaderEncoder/Base64HeaderEncoder.php | 55 + .../Mime/HeaderEncoder/QpHeaderEncoder.php | 65 + .../Swift/Mime/Headers/AbstractHeader.php | 476 + .../classes/Swift/Mime/Headers/DateHeader.php | 113 + .../Mime/Headers/IdentificationHeader.php | 186 + .../Swift/Mime/Headers/MailboxHeader.php | 360 + .../Swift/Mime/Headers/OpenDKIMHeader.php | 135 + .../Mime/Headers/ParameterizedHeader.php | 255 + .../classes/Swift/Mime/Headers/PathHeader.php | 155 + .../Swift/Mime/Headers/UnstructuredHeader.php | 109 + .../lib/classes/Swift/Mime/IdGenerator.php | 54 + .../lib/classes/Swift/Mime/MimePart.php | 208 + .../Swift/Mime/SimpleHeaderFactory.php | 195 + .../classes/Swift/Mime/SimpleHeaderSet.php | 399 + .../lib/classes/Swift/Mime/SimpleMessage.php | 642 + .../classes/Swift/Mime/SimpleMimeEntity.php | 820 + .../lib/classes/Swift/MimePart.php | 45 + .../lib/classes/Swift/NullTransport.php | 26 + .../lib/classes/Swift/OutputByteStream.php | 46 + .../classes/Swift/Plugins/AntiFloodPlugin.php | 137 + .../Swift/Plugins/BandwidthMonitorPlugin.php | 154 + .../Swift/Plugins/Decorator/Replacements.php | 31 + .../classes/Swift/Plugins/DecoratorPlugin.php | 200 + .../Swift/Plugins/ImpersonatePlugin.php | 65 + .../lib/classes/Swift/Plugins/Logger.php | 36 + .../classes/Swift/Plugins/LoggerPlugin.php | 126 + .../Swift/Plugins/Loggers/ArrayLogger.php | 72 + .../Swift/Plugins/Loggers/EchoLogger.php | 58 + .../classes/Swift/Plugins/MessageLogger.php | 70 + .../Swift/Plugins/Pop/Pop3Connection.php | 31 + .../Swift/Plugins/Pop/Pop3Exception.php | 27 + .../Swift/Plugins/PopBeforeSmtpPlugin.php | 254 + .../Swift/Plugins/RedirectingPlugin.php | 201 + .../lib/classes/Swift/Plugins/Reporter.php | 32 + .../classes/Swift/Plugins/ReporterPlugin.php | 57 + .../Swift/Plugins/Reporters/HitReporter.php | 58 + .../Swift/Plugins/Reporters/HtmlReporter.php | 38 + .../lib/classes/Swift/Plugins/Sleeper.php | 24 + .../classes/Swift/Plugins/ThrottlerPlugin.php | 196 + .../lib/classes/Swift/Plugins/Timer.php | 24 + .../lib/classes/Swift/Preferences.php | 100 + .../Swift/ReplacementFilterFactory.php | 27 + .../classes/Swift/RfcComplianceException.php | 27 + .../lib/classes/Swift/SendmailTransport.php | 33 + .../swiftmailer/lib/classes/Swift/Signer.php | 19 + .../lib/classes/Swift/Signers/BodySigner.php | 33 + .../lib/classes/Swift/Signers/DKIMSigner.php | 682 + .../classes/Swift/Signers/DomainKeySigner.php | 504 + .../classes/Swift/Signers/HeaderSigner.php | 65 + .../classes/Swift/Signers/OpenDKIMSigner.php | 183 + .../lib/classes/Swift/Signers/SMimeSigner.php | 542 + .../lib/classes/Swift/SmtpTransport.php | 42 + .../swiftmailer/lib/classes/Swift/Spool.php | 53 + .../lib/classes/Swift/SpoolTransport.php | 33 + .../lib/classes/Swift/StreamFilter.php | 35 + .../ByteArrayReplacementFilter.php | 166 + .../StreamFilters/StringReplacementFilter.php | 70 + .../StringReplacementFilterFactory.php | 45 + .../lib/classes/Swift/SwiftException.php | 28 + .../lib/classes/Swift/Transport.php | 79 + .../Swift/Transport/AbstractSmtpTransport.php | 543 + .../Esmtp/Auth/CramMd5Authenticator.php | 75 + .../Esmtp/Auth/LoginAuthenticator.php | 45 + .../Esmtp/Auth/NTLMAuthenticator.php | 681 + .../Esmtp/Auth/PlainAuthenticator.php | 44 + .../Esmtp/Auth/XOAuth2Authenticator.php | 64 + .../Swift/Transport/Esmtp/AuthHandler.php | 268 + .../Swift/Transport/Esmtp/Authenticator.php | 37 + .../Transport/Esmtp/EightBitMimeHandler.php | 113 + .../Swift/Transport/Esmtp/SmtpUtf8Handler.php | 107 + .../classes/Swift/Transport/EsmtpHandler.php | 86 + .../Swift/Transport/EsmtpTransport.php | 446 + .../Swift/Transport/FailoverTransport.php | 105 + .../lib/classes/Swift/Transport/IoBuffer.php | 67 + .../Swift/Transport/LoadBalancedTransport.php | 194 + .../classes/Swift/Transport/NullTransport.php | 98 + .../Swift/Transport/SendmailTransport.php | 158 + .../lib/classes/Swift/Transport/SmtpAgent.php | 36 + .../Swift/Transport/SpoolTransport.php | 120 + .../classes/Swift/Transport/StreamBuffer.php | 326 + .../lib/classes/Swift/TransportException.php | 28 + .../lib/dependency_maps/cache_deps.php | 23 + .../lib/dependency_maps/message_deps.php | 9 + .../lib/dependency_maps/mime_deps.php | 134 + .../lib/dependency_maps/transport_deps.php | 97 + .../swiftmailer/lib/mime_types.php | 1007 + .../swiftmailer/lib/preferences.php | 19 + .../swiftmailer/lib/swift_required.php | 22 + .../lib/swiftmailer_generate_mimes_config.php | 182 + .../swiftmailer/swiftmailer/phpunit.xml.dist | 38 + .../tests/IdenticalBinaryConstraint.php | 62 + .../swiftmailer/tests/StreamCollector.php | 11 + .../tests/SwiftMailerSmokeTestCase.php | 46 + .../swiftmailer/tests/SwiftMailerTestCase.php | 38 + .../_samples/charsets/iso-2022-jp/one.txt | 11 + .../_samples/charsets/iso-8859-1/one.txt | 19 + .../tests/_samples/charsets/utf-8/one.txt | 22 + .../tests/_samples/charsets/utf-8/three.txt | 45 + .../tests/_samples/charsets/utf-8/two.txt | 3 + .../tests/_samples/dkim/dkim.test.priv | 15 + .../tests/_samples/dkim/dkim.test.pub | 6 + .../swiftmailer/tests/_samples/files/data.txt | 1 + .../tests/_samples/files/swiftmailer.png | Bin 0 -> 3194 bytes .../tests/_samples/files/textfile.zip | Bin 0 -> 202 bytes .../swiftmailer/tests/_samples/smime/CA.srl | 1 + .../swiftmailer/tests/_samples/smime/ca.crt | 21 + .../swiftmailer/tests/_samples/smime/ca.key | 27 + .../tests/_samples/smime/create-cert.sh | 40 + .../tests/_samples/smime/encrypt.crt | 19 + .../tests/_samples/smime/encrypt.key | 27 + .../tests/_samples/smime/encrypt2.crt | 19 + .../tests/_samples/smime/encrypt2.key | 27 + .../tests/_samples/smime/intermediate.crt | 19 + .../tests/_samples/smime/intermediate.key | 27 + .../swiftmailer/tests/_samples/smime/sign.crt | 19 + .../swiftmailer/tests/_samples/smime/sign.key | 27 + .../tests/_samples/smime/sign2.crt | 19 + .../tests/_samples/smime/sign2.key | 27 + .../tests/acceptance.conf.php.default | 37 + .../Swift/AttachmentAcceptanceTest.php | 12 + .../FileByteStreamAcceptanceTest.php | 162 + ...leCharacterReaderFactoryAcceptanceTest.php | 179 + .../DependencyContainerAcceptanceTest.php | 22 + .../Swift/EmbeddedFileAcceptanceTest.php | 12 + .../Encoder/Base64EncoderAcceptanceTest.php | 45 + .../Swift/Encoder/QpEncoderAcceptanceTest.php | 54 + .../Encoder/Rfc2231EncoderAcceptanceTest.php | 50 + .../KeyCache/ArrayKeyCacheAcceptanceTest.php | 173 + .../KeyCache/DiskKeyCacheAcceptanceTest.php | 173 + .../Swift/MessageAcceptanceTest.php | 55 + .../Swift/Mime/AttachmentAcceptanceTest.php | 126 + .../Base64ContentEncoderAcceptanceTest.php | 56 + .../NativeQpContentEncoderAcceptanceTest.php | 88 + .../PlainContentEncoderAcceptanceTest.php | 88 + .../QpContentEncoderAcceptanceTest.php | 160 + .../Swift/Mime/EmbeddedFileAcceptanceTest.php | 139 + .../Base64HeaderEncoderAcceptanceTest.php | 32 + .../Swift/Mime/MimePartAcceptanceTest.php | 130 + .../Mime/SimpleMessageAcceptanceTest.php | 1250 + .../Swift/MimePartAcceptanceTest.php | 15 + .../AbstractStreamBufferAcceptanceTest.php | 131 + .../BasicSocketAcceptanceTest.php | 33 + .../StreamBuffer/ProcessAcceptanceTest.php | 26 + .../StreamBuffer/SocketTimeoutTest.php | 65 + .../StreamBuffer/SslSocketAcceptanceTest.php | 40 + .../StreamBuffer/TlsSocketAcceptanceTest.php | 39 + .../swiftmailer/tests/bootstrap.php | 21 + .../tests/bug/Swift/Bug111Test.php | 42 + .../tests/bug/Swift/Bug118Test.php | 20 + .../tests/bug/Swift/Bug206Test.php | 40 + .../tests/bug/Swift/Bug274Test.php | 25 + .../swiftmailer/tests/bug/Swift/Bug34Test.php | 75 + .../swiftmailer/tests/bug/Swift/Bug35Test.php | 73 + .../swiftmailer/tests/bug/Swift/Bug38Test.php | 192 + .../tests/bug/Swift/Bug518Test.php | 38 + .../swiftmailer/tests/bug/Swift/Bug51Test.php | 110 + .../tests/bug/Swift/Bug534Test.php | 38 + .../tests/bug/Swift/Bug650Test.php | 38 + .../swiftmailer/tests/bug/Swift/Bug71Test.php | 20 + .../swiftmailer/tests/bug/Swift/Bug76Test.php | 71 + ...FileByteStreamConsecutiveReadCallsTest.php | 18 + .../tests/fixtures/MimeEntityFixture.php | 67 + .../swiftmailer/tests/smoke.conf.php.default | 63 + .../smoke/Swift/Smoke/AttachmentSmokeTest.php | 33 + .../smoke/Swift/Smoke/BasicSmokeTest.php | 23 + .../Smoke/HtmlWithAttachmentSmokeTest.php | 31 + .../Swift/Smoke/InternationalSmokeTest.php | 40 + .../Swift/ByteStream/ArrayByteStreamTest.php | 202 + .../GenericFixedWidthReaderTest.php | 43 + .../CharacterReader/UsAsciiReaderTest.php | 52 + .../Swift/CharacterReader/Utf8ReaderTest.php | 65 + .../ArrayCharacterStreamTest.php | 358 + .../unit/Swift/DependencyContainerTest.php | 191 + .../unit/Swift/Encoder/Base64EncoderTest.php | 173 + .../unit/Swift/Encoder/QpEncoderTest.php | 400 + .../unit/Swift/Encoder/Rfc2231EncoderTest.php | 141 + .../unit/Swift/Events/CommandEventTest.php | 34 + .../unit/Swift/Events/EventObjectTest.php | 32 + .../unit/Swift/Events/ResponseEventTest.php | 38 + .../tests/unit/Swift/Events/SendEventTest.php | 96 + .../Events/SimpleEventDispatcherTest.php | 142 + .../Swift/Events/TransportChangeEventTest.php | 30 + .../Events/TransportExceptionEventTest.php | 41 + .../unit/Swift/KeyCache/ArrayKeyCacheTest.php | 240 + .../SimpleKeyCacheInputStreamTest.php | 73 + .../Mailer/ArrayRecipientIteratorTest.php | 42 + .../tests/unit/Swift/MailerTest.php | 145 + .../tests/unit/Swift/MessageTest.php | 133 + .../Swift/Mime/AbstractMimeEntityTest.php | 1092 + .../tests/unit/Swift/Mime/AttachmentTest.php | 321 + .../Base64ContentEncoderTest.php | 323 + .../PlainContentEncoderTest.php | 171 + .../ContentEncoder/QpContentEncoderTest.php | 516 + .../unit/Swift/Mime/EmbeddedFileTest.php | 59 + .../HeaderEncoder/Base64HeaderEncoderTest.php | 13 + .../HeaderEncoder/QpHeaderEncoderTest.php | 221 + .../Swift/Mime/Headers/DateHeaderTest.php | 90 + .../Mime/Headers/IdentificationHeaderTest.php | 192 + .../Swift/Mime/Headers/MailboxHeaderTest.php | 367 + .../Mime/Headers/ParameterizedHeaderTest.php | 396 + .../Swift/Mime/Headers/PathHeaderTest.php | 95 + .../Mime/Headers/UnstructuredHeaderTest.php | 353 + .../tests/unit/Swift/Mime/IdGeneratorTest.php | 32 + .../tests/unit/Swift/Mime/MimePartTest.php | 234 + .../Swift/Mime/SimpleHeaderFactoryTest.php | 169 + .../unit/Swift/Mime/SimpleHeaderSetTest.php | 734 + .../unit/Swift/Mime/SimpleMessageTest.php | 837 + .../unit/Swift/Mime/SimpleMimeEntityTest.php | 12 + .../Swift/Plugins/AntiFloodPluginTest.php | 93 + .../Plugins/BandwidthMonitorPluginTest.php | 128 + .../Swift/Plugins/DecoratorPluginTest.php | 284 + .../unit/Swift/Plugins/LoggerPluginTest.php | 188 + .../Swift/Plugins/Loggers/ArrayLoggerTest.php | 65 + .../Swift/Plugins/Loggers/EchoLoggerTest.php | 24 + .../Swift/Plugins/PopBeforeSmtpPluginTest.php | 101 + .../Swift/Plugins/RedirectingPluginTest.php | 183 + .../unit/Swift/Plugins/ReporterPluginTest.php | 86 + .../Plugins/Reporters/HitReporterTest.php | 64 + .../Plugins/Reporters/HtmlReporterTest.php | 54 + .../Swift/Plugins/ThrottlerPluginTest.php | 102 + .../unit/Swift/Signers/DKIMSignerTest.php | 220 + .../unit/Swift/Signers/OpenDKIMSignerTest.php | 45 + .../unit/Swift/Signers/SMimeSignerTest.php | 653 + .../ByteArrayReplacementFilterTest.php | 129 + .../StringReplacementFilterFactoryTest.php | 36 + .../StringReplacementFilterTest.php | 59 + .../AbstractSmtpEventSupportTest.php | 558 + .../unit/Swift/Transport/AbstractSmtpTest.php | 1400 + .../Esmtp/Auth/CramMd5AuthenticatorTest.php | 65 + .../Esmtp/Auth/LoginAuthenticatorTest.php | 65 + .../Esmtp/Auth/NTLMAuthenticatorTest.php | 204 + .../Esmtp/Auth/PlainAuthenticatorTest.php | 68 + .../Swift/Transport/Esmtp/AuthHandlerTest.php | 165 + .../EsmtpTransport/ExtensionSupportTest.php | 561 + .../Swift/Transport/EsmtpTransportTest.php | 651 + .../Swift/Transport/FailoverTransportTest.php | 600 + .../Transport/LoadBalancedTransportTest.php | 838 + .../Swift/Transport/SendmailTransportTest.php | 150 + .../unit/Swift/Transport/StreamBufferTest.php | 43 + vendor/symfony/console/.gitignore | 3 + vendor/symfony/console/Application.php | 1166 + vendor/symfony/console/CHANGELOG.md | 140 + vendor/symfony/console/Command/Command.php | 653 + .../symfony/console/Command/HelpCommand.php | 81 + .../symfony/console/Command/ListCommand.php | 90 + .../symfony/console/Command/LockableTrait.php | 71 + .../CommandLoader/CommandLoaderInterface.php | 37 + .../CommandLoader/ContainerCommandLoader.php | 55 + .../CommandLoader/FactoryCommandLoader.php | 62 + vendor/symfony/console/ConsoleEvents.php | 47 + .../AddConsoleCommandPass.php | 98 + .../Descriptor/ApplicationDescription.php | 144 + .../symfony/console/Descriptor/Descriptor.php | 107 + .../Descriptor/DescriptorInterface.php | 31 + .../console/Descriptor/JsonDescriptor.php | 168 + .../console/Descriptor/MarkdownDescriptor.php | 182 + .../console/Descriptor/TextDescriptor.php | 342 + .../console/Descriptor/XmlDescriptor.php | 245 + .../console/Event/ConsoleCommandEvent.php | 60 + .../console/Event/ConsoleErrorEvent.php | 58 + vendor/symfony/console/Event/ConsoleEvent.php | 67 + .../console/Event/ConsoleTerminateEvent.php | 53 + .../console/EventListener/ErrorListener.php | 91 + .../Exception/CommandNotFoundException.php | 43 + .../console/Exception/ExceptionInterface.php | 21 + .../Exception/InvalidArgumentException.php | 19 + .../Exception/InvalidOptionException.php | 21 + .../console/Exception/LogicException.php | 19 + .../Exception/NamespaceNotFoundException.php | 21 + .../console/Exception/RuntimeException.php | 19 + .../console/Formatter/OutputFormatter.php | 277 + .../Formatter/OutputFormatterInterface.php | 71 + .../Formatter/OutputFormatterStyle.php | 203 + .../OutputFormatterStyleInterface.php | 62 + .../Formatter/OutputFormatterStyleStack.php | 110 + .../WrappableOutputFormatterInterface.php | 25 + .../console/Helper/DebugFormatterHelper.php | 127 + .../console/Helper/DescriptorHelper.php | 94 + .../console/Helper/FormatterHelper.php | 106 + vendor/symfony/console/Helper/Helper.php | 138 + .../console/Helper/HelperInterface.php | 39 + vendor/symfony/console/Helper/HelperSet.php | 108 + .../console/Helper/InputAwareHelper.php | 33 + .../symfony/console/Helper/ProcessHelper.php | 156 + vendor/symfony/console/Helper/ProgressBar.php | 530 + .../console/Helper/ProgressIndicator.php | 269 + .../symfony/console/Helper/QuestionHelper.php | 434 + .../console/Helper/SymfonyQuestionHelper.php | 96 + vendor/symfony/console/Helper/Table.php | 808 + vendor/symfony/console/Helper/TableCell.php | 68 + vendor/symfony/console/Helper/TableRows.php | 32 + .../symfony/console/Helper/TableSeparator.php | 25 + vendor/symfony/console/Helper/TableStyle.php | 458 + vendor/symfony/console/Input/ArgvInput.php | 346 + vendor/symfony/console/Input/ArrayInput.php | 206 + vendor/symfony/console/Input/Input.php | 203 + .../symfony/console/Input/InputArgument.php | 129 + .../console/Input/InputAwareInterface.php | 26 + .../symfony/console/Input/InputDefinition.php | 402 + .../symfony/console/Input/InputInterface.php | 163 + vendor/symfony/console/Input/InputOption.php | 208 + .../Input/StreamableInputInterface.php | 37 + vendor/symfony/console/Input/StringInput.php | 72 + vendor/symfony/console/LICENSE | 19 + .../symfony/console/Logger/ConsoleLogger.php | 124 + .../symfony/console/Output/BufferedOutput.php | 45 + .../symfony/console/Output/ConsoleOutput.php | 161 + .../console/Output/ConsoleOutputInterface.php | 32 + .../console/Output/ConsoleSectionOutput.php | 141 + vendor/symfony/console/Output/NullOutput.php | 123 + vendor/symfony/console/Output/Output.php | 177 + .../console/Output/OutputInterface.php | 114 + .../symfony/console/Output/StreamOutput.php | 124 + .../console/Question/ChoiceQuestion.php | 184 + .../console/Question/ConfirmationQuestion.php | 59 + vendor/symfony/console/Question/Question.php | 246 + vendor/symfony/console/README.md | 20 + .../console/Resources/bin/hiddeninput.exe | Bin 0 -> 9216 bytes vendor/symfony/console/Style/OutputStyle.php | 155 + .../symfony/console/Style/StyleInterface.php | 154 + vendor/symfony/console/Style/SymfonyStyle.php | 438 + vendor/symfony/console/Terminal.php | 137 + .../console/Tester/ApplicationTester.php | 77 + .../symfony/console/Tester/CommandTester.php | 79 + vendor/symfony/console/Tester/TesterTrait.php | 170 + .../symfony/console/Tests/ApplicationTest.php | 1791 ++ .../console/Tests/Command/CommandTest.php | 428 + .../console/Tests/Command/HelpCommandTest.php | 71 + .../console/Tests/Command/ListCommandTest.php | 113 + .../Tests/Command/LockableTraitTest.php | 67 + .../ContainerCommandLoaderTest.php | 61 + .../FactoryCommandLoaderTest.php | 60 + .../AddConsoleCommandPassTest.php | 258 + .../Descriptor/AbstractDescriptorTest.php | 107 + .../Tests/Descriptor/JsonDescriptorTest.php | 35 + .../Descriptor/MarkdownDescriptorTest.php | 45 + .../Tests/Descriptor/ObjectsProvider.php | 82 + .../Tests/Descriptor/TextDescriptorTest.php | 53 + .../Tests/Descriptor/XmlDescriptorTest.php | 27 + .../Tests/EventListener/ErrorListenerTest.php | 156 + .../console/Tests/Fixtures/BarBucCommand.php | 11 + .../Tests/Fixtures/DescriptorApplication1.php | 18 + .../Tests/Fixtures/DescriptorApplication2.php | 26 + .../DescriptorApplicationMbString.php | 24 + .../Tests/Fixtures/DescriptorCommand1.php | 27 + .../Tests/Fixtures/DescriptorCommand2.php | 32 + .../Tests/Fixtures/DescriptorCommand3.php | 27 + .../Tests/Fixtures/DescriptorCommand4.php | 25 + .../Fixtures/DescriptorCommandMbString.php | 32 + .../console/Tests/Fixtures/DummyOutput.php | 36 + .../console/Tests/Fixtures/Foo1Command.php | 26 + .../console/Tests/Fixtures/Foo2Command.php | 21 + .../console/Tests/Fixtures/Foo3Command.php | 29 + .../console/Tests/Fixtures/Foo4Command.php | 11 + .../console/Tests/Fixtures/Foo5Command.php | 10 + .../console/Tests/Fixtures/Foo6Command.php | 11 + .../console/Tests/Fixtures/FooCommand.php | 33 + .../Tests/Fixtures/FooLock2Command.php | 28 + .../console/Tests/Fixtures/FooLockCommand.php | 27 + .../console/Tests/Fixtures/FooOptCommand.php | 36 + .../Fixtures/FooSameCaseLowercaseCommand.php | 11 + .../Fixtures/FooSameCaseUppercaseCommand.php | 11 + .../Fixtures/FooSubnamespaced1Command.php | 26 + .../Fixtures/FooSubnamespaced2Command.php | 26 + .../Tests/Fixtures/FooWithoutAliasCommand.php | 21 + .../console/Tests/Fixtures/FoobarCommand.php | 25 + .../Style/SymfonyStyle/command/command_0.php | 11 + .../Style/SymfonyStyle/command/command_1.php | 13 + .../Style/SymfonyStyle/command/command_10.php | 17 + .../Style/SymfonyStyle/command/command_11.php | 12 + .../Style/SymfonyStyle/command/command_12.php | 13 + .../Style/SymfonyStyle/command/command_13.php | 14 + .../Style/SymfonyStyle/command/command_14.php | 17 + .../Style/SymfonyStyle/command/command_15.php | 14 + .../Style/SymfonyStyle/command/command_16.php | 15 + .../Style/SymfonyStyle/command/command_17.php | 13 + .../Style/SymfonyStyle/command/command_2.php | 16 + .../Style/SymfonyStyle/command/command_3.php | 12 + .../Style/SymfonyStyle/command/command_4.php | 34 + .../command/command_4_with_iterators.php | 34 + .../Style/SymfonyStyle/command/command_5.php | 37 + .../Style/SymfonyStyle/command/command_6.php | 16 + .../Style/SymfonyStyle/command/command_7.php | 15 + .../Style/SymfonyStyle/command/command_8.php | 26 + .../Style/SymfonyStyle/command/command_9.php | 11 + .../command/interactive_command_1.php | 19 + .../output/interactive_output_1.txt | 7 + .../Style/SymfonyStyle/output/output_0.txt | 3 + .../Style/SymfonyStyle/output/output_1.txt | 9 + .../Style/SymfonyStyle/output/output_10.txt | 7 + .../Style/SymfonyStyle/output/output_11.txt | 4 + .../Style/SymfonyStyle/output/output_12.txt | 6 + .../Style/SymfonyStyle/output/output_13.txt | 7 + .../Style/SymfonyStyle/output/output_14.txt | 6 + .../Style/SymfonyStyle/output/output_15.txt | 7 + .../Style/SymfonyStyle/output/output_16.txt | 8 + .../Style/SymfonyStyle/output/output_17.txt | 7 + .../Style/SymfonyStyle/output/output_2.txt | 13 + .../Style/SymfonyStyle/output/output_3.txt | 7 + .../Style/SymfonyStyle/output/output_4.txt | 32 + .../output/output_4_with_iterators.txt | 32 + .../Style/SymfonyStyle/output/output_5.txt | 18 + .../Style/SymfonyStyle/output/output_6.txt | 6 + .../Style/SymfonyStyle/output/output_7.txt | 5 + .../Style/SymfonyStyle/output/output_8.txt | 9 + .../Style/SymfonyStyle/output/output_9.txt | 5 + .../console/Tests/Fixtures/TestCommand.php | 28 + .../console/Tests/Fixtures/TestTiti.php | 21 + .../console/Tests/Fixtures/TestToto.php | 22 + .../console/Tests/Fixtures/application_1.json | 156 + .../console/Tests/Fixtures/application_1.md | 172 + .../console/Tests/Fixtures/application_1.txt | 17 + .../console/Tests/Fixtures/application_1.xml | 104 + .../console/Tests/Fixtures/application_2.json | 509 + .../console/Tests/Fixtures/application_2.md | 431 + .../console/Tests/Fixtures/application_2.txt | 21 + .../console/Tests/Fixtures/application_2.xml | 254 + .../application_filtered_namespace.txt | 16 + .../Tests/Fixtures/application_gethelp.txt | 1 + .../Tests/Fixtures/application_mbstring.md | 269 + .../Tests/Fixtures/application_mbstring.txt | 19 + .../Fixtures/application_renderexception1.txt | 5 + .../Fixtures/application_renderexception2.txt | 7 + .../Fixtures/application_renderexception3.txt | 18 + .../application_renderexception3decorated.txt | 18 + .../Fixtures/application_renderexception4.txt | 6 + ...plication_renderexception_doublewidth1.txt | 8 + ..._renderexception_doublewidth1decorated.txt | 8 + ...plication_renderexception_doublewidth2.txt | 9 + ...plication_renderexception_escapeslines.txt | 9 + ...application_renderexception_linebreaks.txt | 11 + .../Tests/Fixtures/application_run1.txt | 17 + .../Tests/Fixtures/application_run2.txt | 29 + .../Tests/Fixtures/application_run3.txt | 29 + .../Tests/Fixtures/application_run4.txt | 1 + .../console/Tests/Fixtures/command_1.json | 15 + .../console/Tests/Fixtures/command_1.md | 12 + .../console/Tests/Fixtures/command_1.txt | 10 + .../console/Tests/Fixtures/command_1.xml | 12 + .../console/Tests/Fixtures/command_2.json | 33 + .../console/Tests/Fixtures/command_2.md | 29 + .../console/Tests/Fixtures/command_2.txt | 16 + .../console/Tests/Fixtures/command_2.xml | 21 + .../Tests/Fixtures/command_mbstring.md | 29 + .../Tests/Fixtures/command_mbstring.txt | 16 + .../Tests/Fixtures/input_argument_1.json | 7 + .../Tests/Fixtures/input_argument_1.md | 5 + .../Tests/Fixtures/input_argument_1.txt | 1 + .../Tests/Fixtures/input_argument_1.xml | 5 + .../Tests/Fixtures/input_argument_2.json | 7 + .../Tests/Fixtures/input_argument_2.md | 7 + .../Tests/Fixtures/input_argument_2.txt | 1 + .../Tests/Fixtures/input_argument_2.xml | 5 + .../Tests/Fixtures/input_argument_3.json | 7 + .../Tests/Fixtures/input_argument_3.md | 7 + .../Tests/Fixtures/input_argument_3.txt | 1 + .../Tests/Fixtures/input_argument_3.xml | 7 + .../Tests/Fixtures/input_argument_4.json | 7 + .../Tests/Fixtures/input_argument_4.md | 8 + .../Tests/Fixtures/input_argument_4.txt | 2 + .../Tests/Fixtures/input_argument_4.xml | 6 + ...input_argument_with_default_inf_value.json | 7 + .../input_argument_with_default_inf_value.md | 7 + .../input_argument_with_default_inf_value.txt | 1 + .../input_argument_with_default_inf_value.xml | 7 + .../Fixtures/input_argument_with_style.json | 7 + .../Fixtures/input_argument_with_style.md | 7 + .../Fixtures/input_argument_with_style.txt | 1 + .../Fixtures/input_argument_with_style.xml | 7 + .../Tests/Fixtures/input_definition_1.json | 4 + .../Tests/Fixtures/input_definition_1.md | 0 .../Tests/Fixtures/input_definition_1.txt | 0 .../Tests/Fixtures/input_definition_1.xml | 5 + .../Tests/Fixtures/input_definition_2.json | 12 + .../Tests/Fixtures/input_definition_2.md | 7 + .../Tests/Fixtures/input_definition_2.txt | 2 + .../Tests/Fixtures/input_definition_2.xml | 10 + .../Tests/Fixtures/input_definition_3.json | 14 + .../Tests/Fixtures/input_definition_3.md | 8 + .../Tests/Fixtures/input_definition_3.txt | 2 + .../Tests/Fixtures/input_definition_3.xml | 9 + .../Tests/Fixtures/input_definition_4.json | 22 + .../Tests/Fixtures/input_definition_4.md | 16 + .../Tests/Fixtures/input_definition_4.txt | 5 + .../Tests/Fixtures/input_definition_4.xml | 14 + .../Tests/Fixtures/input_option_1.json | 9 + .../console/Tests/Fixtures/input_option_1.md | 6 + .../console/Tests/Fixtures/input_option_1.txt | 1 + .../console/Tests/Fixtures/input_option_1.xml | 4 + .../Tests/Fixtures/input_option_2.json | 9 + .../console/Tests/Fixtures/input_option_2.md | 8 + .../console/Tests/Fixtures/input_option_2.txt | 1 + .../console/Tests/Fixtures/input_option_2.xml | 7 + .../Tests/Fixtures/input_option_3.json | 9 + .../console/Tests/Fixtures/input_option_3.md | 8 + .../console/Tests/Fixtures/input_option_3.txt | 1 + .../console/Tests/Fixtures/input_option_3.xml | 5 + .../Tests/Fixtures/input_option_4.json | 9 + .../console/Tests/Fixtures/input_option_4.md | 8 + .../console/Tests/Fixtures/input_option_4.txt | 1 + .../console/Tests/Fixtures/input_option_4.xml | 5 + .../Tests/Fixtures/input_option_5.json | 9 + .../console/Tests/Fixtures/input_option_5.md | 9 + .../console/Tests/Fixtures/input_option_5.txt | 2 + .../console/Tests/Fixtures/input_option_5.xml | 6 + .../Tests/Fixtures/input_option_6.json | 9 + .../console/Tests/Fixtures/input_option_6.md | 8 + .../console/Tests/Fixtures/input_option_6.txt | 1 + .../console/Tests/Fixtures/input_option_6.xml | 5 + .../input_option_with_default_inf_value.json | 9 + .../input_option_with_default_inf_value.md | 8 + .../input_option_with_default_inf_value.txt | 1 + .../input_option_with_default_inf_value.xml | 7 + .../Fixtures/input_option_with_style.json | 9 + .../Tests/Fixtures/input_option_with_style.md | 8 + .../Fixtures/input_option_with_style.txt | 1 + .../Fixtures/input_option_with_style.xml | 7 + .../input_option_with_style_array.json | 12 + .../Fixtures/input_option_with_style_array.md | 8 + .../input_option_with_style_array.txt | 1 + .../input_option_with_style_array.xml | 8 + .../OutputFormatterStyleStackTest.php | 71 + .../Formatter/OutputFormatterStyleTest.php | 100 + .../Tests/Formatter/OutputFormatterTest.php | 352 + .../Helper/AbstractQuestionHelperTest.php | 34 + .../Tests/Helper/FormatterHelperTest.php | 129 + .../console/Tests/Helper/HelperSetTest.php | 127 + .../console/Tests/Helper/HelperTest.php | 55 + .../Tests/Helper/ProcessHelperTest.php | 133 + .../console/Tests/Helper/ProgressBarTest.php | 899 + .../Tests/Helper/ProgressIndicatorTest.php | 183 + .../Tests/Helper/QuestionHelperTest.php | 665 + .../Helper/SymfonyQuestionHelperTest.php | 168 + .../console/Tests/Helper/TableStyleTest.php | 28 + .../console/Tests/Helper/TableTest.php | 1127 + .../console/Tests/Input/ArgvInputTest.php | 458 + .../console/Tests/Input/ArrayInputTest.php | 177 + .../console/Tests/Input/InputArgumentTest.php | 103 + .../Tests/Input/InputDefinitionTest.php | 407 + .../console/Tests/Input/InputOptionTest.php | 196 + .../symfony/console/Tests/Input/InputTest.php | 149 + .../console/Tests/Input/StringInputTest.php | 87 + .../Tests/Logger/ConsoleLoggerTest.php | 215 + .../Tests/Output/ConsoleOutputTest.php | 42 + .../Tests/Output/ConsoleSectionOutputTest.php | 163 + .../console/Tests/Output/NullOutputTest.php | 88 + .../console/Tests/Output/OutputTest.php | 189 + .../console/Tests/Output/StreamOutputTest.php | 61 + .../console/Tests/Style/SymfonyStyleTest.php | 116 + vendor/symfony/console/Tests/TerminalTest.php | 44 + .../Tests/Tester/ApplicationTesterTest.php | 113 + .../Tests/Tester/CommandTesterTest.php | 182 + vendor/symfony/console/composer.json | 53 + vendor/symfony/console/phpunit.xml.dist | 41 + vendor/symfony/contracts/.gitignore | 3 + vendor/symfony/contracts/CHANGELOG.md | 12 + .../contracts/Cache/CacheInterface.php | 57 + vendor/symfony/contracts/Cache/CacheTrait.php | 71 + .../contracts/Cache/CallbackInterface.php | 30 + .../symfony/contracts/Cache/ItemInterface.php | 60 + .../Cache/TagAwareCacheInterface.php | 38 + vendor/symfony/contracts/LICENSE | 19 + vendor/symfony/contracts/README.md | 70 + .../contracts/Service/ResetInterface.php | 30 + .../contracts/Service/ServiceLocatorTrait.php | 97 + .../Service/ServiceSubscriberInterface.php | 53 + .../Service/ServiceSubscriberTrait.php | 61 + .../contracts/Tests/Cache/CacheTraitTest.php | 165 + .../Tests/Service/ServiceLocatorTest.php | 94 + .../Service/ServiceSubscriberTraitTest.php | 65 + .../Tests/Translation/TranslatorTest.php | 353 + .../Translation/LocaleAwareInterface.php | 31 + .../Translation/TranslatorInterface.php | 65 + .../contracts/Translation/TranslatorTrait.php | 255 + vendor/symfony/contracts/composer.json | 44 + vendor/symfony/contracts/phpunit.xml.dist | 31 + vendor/symfony/css-selector/.gitignore | 3 + vendor/symfony/css-selector/CHANGELOG.md | 13 + .../css-selector/CssSelectorConverter.php | 65 + .../Exception/ExceptionInterface.php | 24 + .../Exception/ExpressionErrorException.php | 24 + .../Exception/InternalErrorException.php | 24 + .../css-selector/Exception/ParseException.php | 24 + .../Exception/SyntaxErrorException.php | 73 + vendor/symfony/css-selector/LICENSE | 19 + .../css-selector/Node/AbstractNode.php | 42 + .../css-selector/Node/AttributeNode.php | 85 + .../symfony/css-selector/Node/ClassNode.php | 60 + .../Node/CombinedSelectorNode.php | 69 + .../symfony/css-selector/Node/ElementNode.php | 72 + .../css-selector/Node/FunctionNode.php | 81 + vendor/symfony/css-selector/Node/HashNode.php | 60 + .../css-selector/Node/NegationNode.php | 66 + .../css-selector/Node/NodeInterface.php | 31 + .../symfony/css-selector/Node/PseudoNode.php | 60 + .../css-selector/Node/SelectorNode.php | 60 + .../symfony/css-selector/Node/Specificity.php | 75 + .../Parser/Handler/CommentHandler.php | 48 + .../Parser/Handler/HandlerInterface.php | 33 + .../Parser/Handler/HashHandler.php | 58 + .../Parser/Handler/IdentifierHandler.php | 58 + .../Parser/Handler/NumberHandler.php | 54 + .../Parser/Handler/StringHandler.php | 77 + .../Parser/Handler/WhitespaceHandler.php | 46 + vendor/symfony/css-selector/Parser/Parser.php | 353 + .../css-selector/Parser/ParserInterface.php | 34 + vendor/symfony/css-selector/Parser/Reader.php | 86 + .../Parser/Shortcut/ClassParser.php | 51 + .../Parser/Shortcut/ElementParser.php | 47 + .../Parser/Shortcut/EmptyStringParser.php | 46 + .../Parser/Shortcut/HashParser.php | 51 + vendor/symfony/css-selector/Parser/Token.php | 111 + .../css-selector/Parser/TokenStream.php | 175 + .../Parser/Tokenizer/Tokenizer.php | 75 + .../Parser/Tokenizer/TokenizerEscaping.php | 63 + .../Parser/Tokenizer/TokenizerPatterns.php | 89 + vendor/symfony/css-selector/README.md | 20 + .../Tests/CssSelectorConverterTest.php | 76 + .../Tests/Node/AbstractNodeTest.php | 34 + .../Tests/Node/AttributeNodeTest.php | 37 + .../css-selector/Tests/Node/ClassNodeTest.php | 33 + .../Tests/Node/CombinedSelectorNodeTest.php | 35 + .../Tests/Node/ElementNodeTest.php | 35 + .../Tests/Node/FunctionNodeTest.php | 47 + .../css-selector/Tests/Node/HashNodeTest.php | 33 + .../Tests/Node/NegationNodeTest.php | 33 + .../Tests/Node/PseudoNodeTest.php | 32 + .../Tests/Node/SelectorNodeTest.php | 34 + .../Tests/Node/SpecificityTest.php | 63 + .../Parser/Handler/AbstractHandlerTest.php | 70 + .../Parser/Handler/CommentHandlerTest.php | 55 + .../Tests/Parser/Handler/HashHandlerTest.php | 49 + .../Parser/Handler/IdentifierHandlerTest.php | 49 + .../Parser/Handler/NumberHandlerTest.php | 50 + .../Parser/Handler/StringHandlerTest.php | 50 + .../Parser/Handler/WhitespaceHandlerTest.php | 44 + .../css-selector/Tests/Parser/ParserTest.php | 250 + .../css-selector/Tests/Parser/ReaderTest.php | 102 + .../Tests/Parser/Shortcut/ClassParserTest.php | 45 + .../Parser/Shortcut/ElementParserTest.php | 44 + .../Parser/Shortcut/EmptyStringParserTest.php | 36 + .../Tests/Parser/Shortcut/HashParserTest.php | 45 + .../Tests/Parser/TokenStreamTest.php | 96 + .../Tests/XPath/Fixtures/ids.html | 48 + .../Tests/XPath/Fixtures/lang.xml | 11 + .../Tests/XPath/Fixtures/shakespear.html | 308 + .../Tests/XPath/TranslatorTest.php | 327 + .../XPath/Extension/AbstractExtension.php | 65 + .../Extension/AttributeMatchingExtension.php | 119 + .../XPath/Extension/CombinationExtension.php | 83 + .../XPath/Extension/ExtensionInterface.php | 69 + .../XPath/Extension/FunctionExtension.php | 171 + .../XPath/Extension/HtmlExtension.php | 213 + .../XPath/Extension/NodeExtension.php | 197 + .../XPath/Extension/PseudoClassExtension.php | 148 + .../symfony/css-selector/XPath/Translator.php | 224 + .../XPath/TranslatorInterface.php | 37 + .../symfony/css-selector/XPath/XPathExpr.php | 102 + vendor/symfony/css-selector/composer.json | 37 + vendor/symfony/css-selector/phpunit.xml.dist | 31 + vendor/symfony/debug/.gitignore | 3 + vendor/symfony/debug/BufferingLogger.php | 37 + vendor/symfony/debug/CHANGELOG.md | 70 + vendor/symfony/debug/Debug.php | 60 + vendor/symfony/debug/DebugClassLoader.php | 471 + vendor/symfony/debug/ErrorHandler.php | 699 + .../Exception/ClassNotFoundException.php | 36 + .../debug/Exception/FatalErrorException.php | 77 + .../debug/Exception/FatalThrowableError.php | 51 + .../debug/Exception/FlattenException.php | 327 + .../debug/Exception/OutOfMemoryException.php | 21 + .../debug/Exception/SilencedErrorContext.php | 67 + .../Exception/UndefinedFunctionException.php | 36 + .../Exception/UndefinedMethodException.php | 36 + vendor/symfony/debug/ExceptionHandler.php | 441 + .../ClassNotFoundFatalErrorHandler.php | 189 + .../FatalErrorHandlerInterface.php | 32 + .../UndefinedFunctionFatalErrorHandler.php | 84 + .../UndefinedMethodFatalErrorHandler.php | 66 + vendor/symfony/debug/LICENSE | 19 + vendor/symfony/debug/README.md | 13 + .../debug/Tests/DebugClassLoaderTest.php | 364 + .../symfony/debug/Tests/ErrorHandlerTest.php | 504 + .../Tests/Exception/FlattenExceptionTest.php | 353 + .../debug/Tests/ExceptionHandlerTest.php | 133 + .../ClassNotFoundFatalErrorHandlerTest.php | 176 + ...UndefinedFunctionFatalErrorHandlerTest.php | 81 + .../UndefinedMethodFatalErrorHandlerTest.php | 76 + .../debug/Tests/Fixtures/AnnotatedClass.php | 13 + .../debug/Tests/Fixtures/ClassAlias.php | 3 + .../Fixtures/ClassWithAnnotatedParameters.php | 34 + .../debug/Tests/Fixtures/DeprecatedClass.php | 12 + .../Tests/Fixtures/DeprecatedInterface.php | 12 + .../Tests/Fixtures/ExtendedFinalMethod.php | 19 + .../debug/Tests/Fixtures/FinalClass.php | 10 + .../debug/Tests/Fixtures/FinalMethod.php | 24 + .../Tests/Fixtures/FinalMethod2Trait.php | 10 + .../InterfaceWithAnnotatedParameters.php | 14 + .../debug/Tests/Fixtures/InternalClass.php | 15 + .../Tests/Fixtures/InternalInterface.php | 10 + .../debug/Tests/Fixtures/InternalTrait.php | 10 + .../debug/Tests/Fixtures/InternalTrait2.php | 23 + .../Tests/Fixtures/NonDeprecatedInterface.php | 7 + .../debug/Tests/Fixtures/PEARClass.php | 5 + .../SubClassWithAnnotatedParameters.php | 24 + .../symfony/debug/Tests/Fixtures/Throwing.php | 3 + .../debug/Tests/Fixtures/ToStringThrower.php | 24 + .../Fixtures/TraitWithAnnotatedParameters.php | 13 + .../Fixtures/TraitWithInternalMethod.php | 13 + .../debug/Tests/Fixtures/casemismatch.php | 7 + .../debug/Tests/Fixtures/notPsr0Bis.php | 7 + .../Tests/Fixtures/psr4/Psr4CaseMismatch.php | 7 + .../debug/Tests/Fixtures/reallyNotPsr0.php | 7 + .../debug/Tests/Fixtures2/RequiredTwice.php | 7 + vendor/symfony/debug/Tests/HeaderMock.php | 38 + .../debug/Tests/MockExceptionHandler.php | 24 + .../debug/Tests/phpt/debug_class_loader.phpt | 27 + .../Tests/phpt/decorate_exception_hander.phpt | 47 + .../debug/Tests/phpt/exception_rethrown.phpt | 35 + .../phpt/fatal_with_nested_handlers.phpt | 42 + vendor/symfony/debug/composer.json | 40 + vendor/symfony/debug/phpunit.xml.dist | 33 + vendor/symfony/event-dispatcher/.gitignore | 3 + vendor/symfony/event-dispatcher/CHANGELOG.md | 55 + .../Debug/TraceableEventDispatcher.php | 341 + .../TraceableEventDispatcherInterface.php | 37 + .../Debug/WrappedListener.php | 121 + .../RegisterListenersPass.php | 136 + vendor/symfony/event-dispatcher/Event.php | 58 + .../event-dispatcher/EventDispatcher.php | 236 + .../EventDispatcherInterface.php | 93 + .../EventSubscriberInterface.php | 46 + .../symfony/event-dispatcher/GenericEvent.php | 175 + .../ImmutableEventDispatcher.php | 91 + vendor/symfony/event-dispatcher/LICENSE | 19 + vendor/symfony/event-dispatcher/README.md | 15 + .../Tests/AbstractEventDispatcherTest.php | 442 + .../Debug/TraceableEventDispatcherTest.php | 293 + .../Tests/Debug/WrappedListenerTest.php | 64 + .../RegisterListenersPassTest.php | 206 + .../Tests/EventDispatcherTest.php | 22 + .../event-dispatcher/Tests/EventTest.php | 55 + .../Tests/GenericEventTest.php | 136 + .../Tests/ImmutableEventDispatcherTest.php | 106 + vendor/symfony/event-dispatcher/composer.json | 48 + .../symfony/event-dispatcher/phpunit.xml.dist | 31 + vendor/symfony/finder/.gitignore | 3 + vendor/symfony/finder/CHANGELOG.md | 69 + .../symfony/finder/Comparator/Comparator.php | 98 + .../finder/Comparator/DateComparator.php | 51 + .../finder/Comparator/NumberComparator.php | 79 + .../Exception/AccessDeniedException.php | 19 + vendor/symfony/finder/Finder.php | 780 + vendor/symfony/finder/Glob.php | 116 + .../finder/Iterator/CustomFilterIterator.php | 61 + .../Iterator/DateRangeFilterIterator.php | 58 + .../Iterator/DepthRangeFilterIterator.php | 45 + .../ExcludeDirectoryFilterIterator.php | 84 + .../Iterator/FileTypeFilterIterator.php | 53 + .../Iterator/FilecontentFilterIterator.php | 58 + .../Iterator/FilenameFilterIterator.php | 47 + .../Iterator/MultiplePcreFilterIterator.php | 112 + .../finder/Iterator/PathFilterIterator.php | 56 + .../Iterator/RecursiveDirectoryIterator.php | 140 + .../Iterator/SizeRangeFilterIterator.php | 57 + .../finder/Iterator/SortableIterator.php | 98 + vendor/symfony/finder/LICENSE | 19 + vendor/symfony/finder/README.md | 14 + vendor/symfony/finder/SplFileInfo.php | 78 + .../Tests/Comparator/ComparatorTest.php | 65 + .../Tests/Comparator/DateComparatorTest.php | 64 + .../Tests/Comparator/NumberComparatorTest.php | 108 + vendor/symfony/finder/Tests/FinderTest.php | 1280 + vendor/symfony/finder/Tests/Fixtures/.dot/a | 0 .../finder/Tests/Fixtures/.dot/b/c.neon | 0 .../finder/Tests/Fixtures/.dot/b/d.neon | 0 .../finder/Tests/Fixtures/A/B/C/abc.dat | 0 .../symfony/finder/Tests/Fixtures/A/B/ab.dat | 0 vendor/symfony/finder/Tests/Fixtures/A/a.dat | 0 .../Tests/Fixtures/copy/A/B/C/abc.dat.copy | 0 .../Tests/Fixtures/copy/A/B/ab.dat.copy | 0 .../finder/Tests/Fixtures/copy/A/a.dat.copy | 0 .../symfony/finder/Tests/Fixtures/dolor.txt | 2 + .../symfony/finder/Tests/Fixtures/ipsum.txt | 2 + .../symfony/finder/Tests/Fixtures/lorem.txt | 2 + vendor/symfony/finder/Tests/Fixtures/one/.dot | 1 + vendor/symfony/finder/Tests/Fixtures/one/a | 0 .../finder/Tests/Fixtures/one/b/c.neon | 0 .../finder/Tests/Fixtures/one/b/d.neon | 0 .../Fixtures/r+e.gex[c]a(r)s/dir/bar.dat | 0 .../finder/Tests/Fixtures/with space/foo.txt | 0 vendor/symfony/finder/Tests/GlobTest.php | 95 + .../Iterator/CustomFilterIteratorTest.php | 46 + .../Iterator/DateRangeFilterIteratorTest.php | 92 + .../Iterator/DepthRangeFilterIteratorTest.php | 103 + .../ExcludeDirectoryFilterIteratorTest.php | 107 + .../Iterator/FileTypeFilterIteratorTest.php | 82 + .../FilecontentFilterIteratorTest.php | 86 + .../Iterator/FilenameFilterIteratorTest.php | 54 + .../finder/Tests/Iterator/Iterator.php | 55 + .../Tests/Iterator/IteratorTestCase.php | 100 + .../Tests/Iterator/MockFileListIterator.php | 21 + .../finder/Tests/Iterator/MockSplFileInfo.php | 132 + .../MultiplePcreFilterIteratorTest.php | 71 + .../Tests/Iterator/PathFilterIteratorTest.php | 82 + .../Tests/Iterator/RealIteratorTestCase.php | 128 + .../RecursiveDirectoryIteratorTest.php | 59 + .../Iterator/SizeRangeFilterIteratorTest.php | 70 + .../Tests/Iterator/SortableIteratorTest.php | 262 + vendor/symfony/finder/composer.json | 33 + vendor/symfony/finder/phpunit.xml.dist | 30 + vendor/symfony/http-foundation/.gitignore | 3 + .../symfony/http-foundation/AcceptHeader.php | 173 + .../http-foundation/AcceptHeaderItem.php | 191 + .../symfony/http-foundation/ApacheRequest.php | 43 + .../http-foundation/BinaryFileResponse.php | 354 + vendor/symfony/http-foundation/CHANGELOG.md | 211 + vendor/symfony/http-foundation/Cookie.php | 297 + .../Exception/ConflictingHeadersException.php | 21 + .../Exception/RequestExceptionInterface.php | 21 + .../SuspiciousOperationException.php | 20 + .../ExpressionRequestMatcher.php | 47 + .../File/Exception/AccessDeniedException.php | 28 + .../Exception/CannotWriteFileException.php | 21 + .../File/Exception/ExtensionFileException.php | 21 + .../File/Exception/FileException.php | 21 + .../File/Exception/FileNotFoundException.php | 28 + .../File/Exception/FormSizeFileException.php | 21 + .../File/Exception/IniSizeFileException.php | 21 + .../File/Exception/NoFileException.php | 21 + .../File/Exception/NoTmpDirFileException.php | 21 + .../File/Exception/PartialFileException.php | 21 + .../Exception/UnexpectedTypeException.php | 20 + .../File/Exception/UploadException.php | 21 + vendor/symfony/http-foundation/File/File.php | 138 + .../File/MimeType/ExtensionGuesser.php | 94 + .../MimeType/ExtensionGuesserInterface.php | 27 + .../MimeType/FileBinaryMimeTypeGuesser.php | 99 + .../File/MimeType/FileinfoMimeTypeGuesser.php | 69 + .../MimeType/MimeTypeExtensionGuesser.php | 808 + .../File/MimeType/MimeTypeGuesser.php | 133 + .../MimeType/MimeTypeGuesserInterface.php | 35 + .../symfony/http-foundation/File/Stream.php | 28 + .../http-foundation/File/UploadedFile.php | 300 + vendor/symfony/http-foundation/FileBag.php | 144 + vendor/symfony/http-foundation/HeaderBag.php | 315 + .../symfony/http-foundation/HeaderUtils.php | 225 + vendor/symfony/http-foundation/IpUtils.php | 156 + .../symfony/http-foundation/JsonResponse.php | 204 + vendor/symfony/http-foundation/LICENSE | 19 + .../symfony/http-foundation/ParameterBag.php | 234 + vendor/symfony/http-foundation/README.md | 14 + .../http-foundation/RedirectResponse.php | 109 + vendor/symfony/http-foundation/Request.php | 2028 ++ .../http-foundation/RequestMatcher.php | 198 + .../RequestMatcherInterface.php | 27 + .../symfony/http-foundation/RequestStack.php | 103 + vendor/symfony/http-foundation/Response.php | 1241 + .../http-foundation/ResponseHeaderBag.php | 299 + vendor/symfony/http-foundation/ServerBag.php | 102 + .../Session/Attribute/AttributeBag.php | 148 + .../Attribute/AttributeBagInterface.php | 72 + .../Attribute/NamespacedAttributeBag.php | 159 + .../Session/Flash/AutoExpireFlashBag.php | 161 + .../Session/Flash/FlashBag.php | 152 + .../Session/Flash/FlashBagInterface.php | 93 + .../http-foundation/Session/Session.php | 280 + .../Session/SessionBagInterface.php | 46 + .../Session/SessionBagProxy.php | 89 + .../Session/SessionInterface.php | 180 + .../http-foundation/Session/SessionUtils.php | 59 + .../Handler/AbstractSessionHandler.php | 140 + .../Handler/MemcachedSessionHandler.php | 122 + .../Handler/MigratingSessionHandler.php | 124 + .../Storage/Handler/MongoDbSessionHandler.php | 193 + .../Handler/NativeFileSessionHandler.php | 55 + .../Storage/Handler/NullSessionHandler.php | 76 + .../Storage/Handler/PdoSessionHandler.php | 904 + .../Storage/Handler/RedisSessionHandler.php | 114 + .../Storage/Handler/StrictSessionHandler.php | 103 + .../Session/Storage/MetadataBag.php | 168 + .../Storage/MockArraySessionStorage.php | 252 + .../Storage/MockFileSessionStorage.php | 152 + .../Session/Storage/NativeSessionStorage.php | 459 + .../Storage/PhpBridgeSessionStorage.php | 59 + .../Session/Storage/Proxy/AbstractProxy.php | 122 + .../Storage/Proxy/SessionHandlerProxy.php | 101 + .../Storage/SessionStorageInterface.php | 137 + .../http-foundation/StreamedResponse.php | 146 + .../Tests/AcceptHeaderItemTest.php | 113 + .../Tests/AcceptHeaderTest.php | 130 + .../Tests/ApacheRequestTest.php | 93 + .../Tests/BinaryFileResponseTest.php | 366 + .../http-foundation/Tests/CookieTest.php | 253 + .../Tests/ExpressionRequestMatcherTest.php | 69 + .../http-foundation/Tests/File/FakeFile.php | 45 + .../http-foundation/Tests/File/FileTest.php | 180 + .../Tests/File/Fixtures/.unknownextension | 1 + .../Tests/File/Fixtures/directory/.empty | 0 .../Tests/File/Fixtures/other-file.example | 0 .../http-foundation/Tests/File/Fixtures/test | Bin 0 -> 35 bytes .../Tests/File/Fixtures/test.gif | Bin 0 -> 35 bytes .../Tests/File/MimeType/MimeTypeTest.php | 90 + .../Tests/File/UploadedFileTest.php | 346 + .../http-foundation/Tests/FileBagTest.php | 178 + .../Fixtures/response-functional/common.inc | 43 + .../cookie_max_age.expected | 11 + .../response-functional/cookie_max_age.php | 10 + .../cookie_raw_urlencode.expected | 10 + .../cookie_raw_urlencode.php | 12 + .../cookie_samesite_lax.expected | 9 + .../cookie_samesite_lax.php | 8 + .../cookie_samesite_strict.expected | 9 + .../cookie_samesite_strict.php | 8 + .../cookie_urlencode.expected | 10 + .../response-functional/cookie_urlencode.php | 12 + .../invalid_cookie_name.expected | 6 + .../invalid_cookie_name.php | 11 + .../http-foundation/Tests/HeaderBagTest.php | 205 + .../http-foundation/Tests/HeaderUtilsTest.php | 134 + .../http-foundation/Tests/IpUtilsTest.php | 104 + .../Tests/JsonResponseTest.php | 257 + .../Tests/ParameterBagTest.php | 194 + .../Tests/RedirectResponseTest.php | 97 + .../Tests/RequestMatcherTest.php | 166 + .../Tests/RequestStackTest.php | 70 + .../http-foundation/Tests/RequestTest.php | 2273 ++ .../Tests/ResponseFunctionalTest.php | 58 + .../Tests/ResponseHeaderBagTest.php | 308 + .../http-foundation/Tests/ResponseTest.php | 1064 + .../Tests/ResponseTestCase.php | 89 + .../http-foundation/Tests/ServerBagTest.php | 170 + .../Session/Attribute/AttributeBagTest.php | 186 + .../Attribute/NamespacedAttributeBagTest.php | 204 + .../Session/Flash/AutoExpireFlashBagTest.php | 161 + .../Tests/Session/Flash/FlashBagTest.php | 157 + .../Tests/Session/SessionTest.php | 263 + .../AbstractRedisSessionHandlerTestCase.php | 145 + .../Handler/AbstractSessionHandlerTest.php | 58 + .../Storage/Handler/Fixtures/common.inc | 151 + .../Handler/Fixtures/empty_destroys.expected | 17 + .../Handler/Fixtures/empty_destroys.php | 8 + .../Handler/Fixtures/read_only.expected | 14 + .../Storage/Handler/Fixtures/read_only.php | 8 + .../Handler/Fixtures/regenerate.expected | 24 + .../Storage/Handler/Fixtures/regenerate.php | 10 + .../Storage/Handler/Fixtures/storage.expected | 20 + .../Storage/Handler/Fixtures/storage.php | 24 + .../Handler/Fixtures/with_cookie.expected | 15 + .../Storage/Handler/Fixtures/with_cookie.php | 8 + .../Fixtures/with_cookie_and_session.expected | 24 + .../Fixtures/with_cookie_and_session.php | 13 + .../Handler/Fixtures/with_samesite.expected | 16 + .../Handler/Fixtures/with_samesite.php | 13 + .../with_samesite_and_migration.expected | 23 + .../Fixtures/with_samesite_and_migration.php | 15 + .../Handler/MemcachedSessionHandlerTest.php | 135 + .../Handler/MigratingSessionHandlerTest.php | 186 + .../Handler/MongoDbSessionHandlerTest.php | 209 + .../Handler/NativeFileSessionHandlerTest.php | 76 + .../Handler/NullSessionHandlerTest.php | 59 + .../Storage/Handler/PdoSessionHandlerTest.php | 404 + .../PredisClusterSessionHandlerTest.php | 22 + .../Handler/PredisSessionHandlerTest.php | 22 + .../Handler/RedisArraySessionHandlerTest.php | 20 + .../RedisClusterSessionHandlerTest.php | 31 + .../Handler/RedisSessionHandlerTest.php | 23 + .../Handler/StrictSessionHandlerTest.php | 189 + .../Tests/Session/Storage/MetadataBagTest.php | 139 + .../Storage/MockArraySessionStorageTest.php | 131 + .../Storage/MockFileSessionStorageTest.php | 127 + .../Storage/NativeSessionStorageTest.php | 298 + .../Storage/PhpBridgeSessionStorageTest.php | 95 + .../Storage/Proxy/AbstractProxyTest.php | 113 + .../Storage/Proxy/SessionHandlerProxyTest.php | 157 + .../Tests/StreamedResponseTest.php | 144 + .../Tests/schema/http-status-codes.rng | 31 + .../Tests/schema/iana-registry.rng | 198 + vendor/symfony/http-foundation/composer.json | 38 + .../symfony/http-foundation/phpunit.xml.dist | 31 + vendor/symfony/http-kernel/.gitignore | 5 + vendor/symfony/http-kernel/Bundle/Bundle.php | 170 + .../http-kernel/Bundle/BundleInterface.php | 71 + vendor/symfony/http-kernel/CHANGELOG.md | 193 + .../CacheClearer/CacheClearerInterface.php | 27 + .../CacheClearer/ChainCacheClearer.php | 39 + .../CacheClearer/Psr6CacheClearer.php | 58 + .../http-kernel/CacheWarmer/CacheWarmer.php | 32 + .../CacheWarmer/CacheWarmerAggregate.php | 121 + .../CacheWarmer/CacheWarmerInterface.php | 32 + .../CacheWarmer/WarmableInterface.php | 27 + vendor/symfony/http-kernel/Client.php | 204 + .../http-kernel/Config/FileLocator.php | 54 + .../Controller/ArgumentResolver.php | 94 + .../ArgumentResolver/DefaultValueResolver.php | 40 + .../RequestAttributeValueResolver.php | 40 + .../ArgumentResolver/RequestValueResolver.php | 40 + .../ArgumentResolver/ServiceValueResolver.php | 93 + .../ArgumentResolver/SessionValueResolver.php | 50 + .../TraceableValueResolver.php | 62 + .../VariadicValueResolver.php | 48 + .../Controller/ArgumentResolverInterface.php | 35 + .../ArgumentValueResolverInterface.php | 43 + .../ContainerControllerResolver.php | 74 + .../Controller/ControllerReference.php | 44 + .../Controller/ControllerResolver.php | 206 + .../ControllerResolverInterface.php | 41 + .../Controller/TraceableArgumentResolver.php | 44 + .../TraceableControllerResolver.php | 44 + .../ControllerMetadata/ArgumentMetadata.php | 107 + .../ArgumentMetadataFactory.php | 71 + .../ArgumentMetadataFactoryInterface.php | 27 + .../DataCollector/AjaxDataCollector.php | 38 + .../DataCollector/ConfigDataCollector.php | 348 + .../DataCollector/DataCollector.php | 93 + .../DataCollector/DataCollectorInterface.php | 36 + .../DataCollector/DumpDataCollector.php | 261 + .../DataCollector/EventDataCollector.php | 149 + .../DataCollector/ExceptionDataCollector.php | 112 + .../LateDataCollectorInterface.php | 25 + .../DataCollector/LoggerDataCollector.php | 279 + .../DataCollector/MemoryDataCollector.php | 120 + .../DataCollector/RequestDataCollector.php | 446 + .../DataCollector/RouterDataCollector.php | 108 + .../DataCollector/TimeDataCollector.php | 149 + .../http-kernel/Debug/FileLinkFormatter.php | 105 + .../Debug/TraceableEventDispatcher.php | 82 + .../AddAnnotatedClassesToCachePass.php | 145 + .../ConfigurableExtension.php | 42 + .../ControllerArgumentValueResolverPass.php | 64 + .../DependencyInjection/Extension.php | 44 + .../FragmentRendererPass.php | 63 + .../LazyLoadingFragmentHandler.php | 47 + .../DependencyInjection/LoggerPass.php | 41 + .../MergeExtensionConfigurationPass.php | 41 + ...RegisterControllerArgumentLocatorsPass.php | 189 + ...oveEmptyControllerArgumentLocatorsPass.php | 70 + .../ResettableServicePass.php | 66 + .../DependencyInjection/ServicesResetter.php | 41 + .../Event/FilterControllerArgumentsEvent.php | 52 + .../Event/FilterControllerEvent.php | 53 + .../http-kernel/Event/FilterResponseEvent.php | 55 + .../http-kernel/Event/FinishRequestEvent.php | 21 + .../http-kernel/Event/GetResponseEvent.php | 58 + .../GetResponseForControllerResultEvent.php | 61 + .../Event/GetResponseForExceptionEvent.php | 90 + .../symfony/http-kernel/Event/KernelEvent.php | 82 + .../http-kernel/Event/PostResponseEvent.php | 46 + .../EventListener/AbstractSessionListener.php | 148 + .../AbstractTestSessionListener.php | 113 + .../AddRequestFormatsListener.php | 50 + .../EventListener/DebugHandlersListener.php | 156 + .../EventListener/DumpListener.php | 63 + .../EventListener/ExceptionListener.php | 164 + .../EventListener/FragmentListener.php | 99 + .../EventListener/LocaleListener.php | 83 + .../EventListener/ProfilerListener.php | 128 + .../EventListener/ResponseListener.php | 56 + .../EventListener/RouterListener.php | 178 + .../EventListener/SaveSessionListener.php | 46 + .../EventListener/SessionListener.php | 50 + .../StreamedResponseListener.php | 49 + .../EventListener/SurrogateListener.php | 65 + .../EventListener/TestSessionListener.php | 41 + .../EventListener/TranslatorListener.php | 76 + .../EventListener/ValidateRequestListener.php | 53 + .../Exception/AccessDeniedHttpException.php | 30 + .../Exception/BadRequestHttpException.php | 29 + .../Exception/ConflictHttpException.php | 29 + ...ntrollerDoesNotReturnResponseException.php | 78 + .../Exception/GoneHttpException.php | 29 + .../http-kernel/Exception/HttpException.php | 51 + .../Exception/HttpExceptionInterface.php | 34 + .../Exception/LengthRequiredHttpException.php | 29 + .../MethodNotAllowedHttpException.php | 32 + .../Exception/NotAcceptableHttpException.php | 29 + .../Exception/NotFoundHttpException.php | 29 + .../PreconditionFailedHttpException.php | 29 + .../PreconditionRequiredHttpException.php | 31 + .../ServiceUnavailableHttpException.php | 34 + .../TooManyRequestsHttpException.php | 36 + .../Exception/UnauthorizedHttpException.php | 32 + .../UnprocessableEntityHttpException.php | 29 + .../UnsupportedMediaTypeHttpException.php | 29 + .../AbstractSurrogateFragmentRenderer.php | 110 + .../Fragment/EsiFragmentRenderer.php | 28 + .../http-kernel/Fragment/FragmentHandler.php | 112 + .../Fragment/FragmentRendererInterface.php | 42 + .../Fragment/HIncludeFragmentRenderer.php | 160 + .../Fragment/InlineFragmentRenderer.php | 145 + .../Fragment/RoutableFragmentRenderer.php | 90 + .../Fragment/SsiFragmentRenderer.php | 28 + .../HttpCache/AbstractSurrogate.php | 134 + vendor/symfony/http-kernel/HttpCache/Esi.php | 115 + .../http-kernel/HttpCache/HttpCache.php | 684 + .../HttpCache/ResponseCacheStrategy.php | 96 + .../ResponseCacheStrategyInterface.php | 37 + vendor/symfony/http-kernel/HttpCache/Ssi.php | 98 + .../symfony/http-kernel/HttpCache/Store.php | 489 + .../http-kernel/HttpCache/StoreInterface.php | 83 + .../HttpCache/SubRequestHandler.php | 91 + .../HttpCache/SurrogateInterface.php | 92 + vendor/symfony/http-kernel/HttpKernel.php | 297 + .../http-kernel/HttpKernelInterface.php | 43 + vendor/symfony/http-kernel/Kernel.php | 844 + vendor/symfony/http-kernel/KernelEvents.php | 103 + .../symfony/http-kernel/KernelInterface.php | 167 + vendor/symfony/http-kernel/LICENSE | 19 + .../http-kernel/Log/DebugLoggerInterface.php | 49 + vendor/symfony/http-kernel/Log/Logger.php | 104 + .../Profiler/FileProfilerStorage.php | 290 + .../symfony/http-kernel/Profiler/Profile.php | 295 + .../symfony/http-kernel/Profiler/Profiler.php | 259 + .../Profiler/ProfilerStorageInterface.php | 65 + vendor/symfony/http-kernel/README.md | 16 + .../http-kernel/RebootableInterface.php | 30 + .../http-kernel/Resources/welcome.html.php | 84 + .../http-kernel/TerminableInterface.php | 32 + .../http-kernel/Tests/Bundle/BundleTest.php | 69 + .../CacheClearer/ChainCacheClearerTest.php | 46 + .../CacheClearer/Psr6CacheClearerTest.php | 48 + .../CacheWarmer/CacheWarmerAggregateTest.php | 79 + .../Tests/CacheWarmer/CacheWarmerTest.php | 68 + .../symfony/http-kernel/Tests/ClientTest.php | 182 + .../Tests/Config/FileLocatorTest.php | 48 + .../ServiceValueResolverTest.php | 158 + .../TraceableValueResolverTest.php | 76 + .../Tests/Controller/ArgumentResolverTest.php | 338 + .../ContainerControllerResolverTest.php | 237 + .../Controller/ControllerResolverTest.php | 259 + .../ArgumentMetadataFactoryTest.php | 139 + .../ArgumentMetadataTest.php | 46 + .../Tests/DataCollector/Compiler.log | 4 + .../DataCollector/ConfigDataCollectorTest.php | 76 + .../Tests/DataCollector/DataCollectorTest.php | 38 + .../DataCollector/DumpDataCollectorTest.php | 157 + .../ExceptionDataCollectorTest.php | 59 + .../DataCollector/LoggerDataCollectorTest.php | 188 + .../DataCollector/MemoryDataCollectorTest.php | 59 + .../RequestDataCollectorTest.php | 336 + .../DataCollector/TimeDataCollectorTest.php | 55 + .../Tests/Debug/FileLinkFormatterTest.php | 66 + .../Debug/TraceableEventDispatcherTest.php | 121 + .../AddAnnotatedClassesToCachePassTest.php | 99 + ...ontrollerArgumentValueResolverPassTest.php | 131 + .../FragmentRendererPassTest.php | 71 + .../LazyLoadingFragmentHandlerTest.php | 41 + .../DependencyInjection/LoggerPassTest.php | 56 + .../MergeExtensionConfigurationPassTest.php | 50 + ...sterControllerArgumentLocatorsPassTest.php | 439 + ...mptyControllerArgumentLocatorsPassTest.php | 109 + .../ResettableServicePassTest.php | 78 + .../ServicesResetterTest.php | 42 + .../FilterControllerArgumentsEventTest.php | 17 + .../GetResponseForExceptionEventTest.php | 27 + .../AddRequestFormatsListenerTest.php | 84 + .../DebugHandlersListenerTest.php | 155 + .../Tests/EventListener/DumpListenerTest.php | 81 + .../EventListener/ExceptionListenerTest.php | 201 + .../EventListener/FragmentListenerTest.php | 122 + .../EventListener/LocaleListenerTest.php | 102 + .../EventListener/ProfilerListenerTest.php | 71 + .../EventListener/ResponseListenerTest.php | 95 + .../EventListener/RouterListenerTest.php | 221 + .../EventListener/SaveSessionListenerTest.php | 52 + .../EventListener/SessionListenerTest.php | 163 + .../EventListener/SurrogateListenerTest.php | 67 + .../EventListener/TestSessionListenerTest.php | 221 + .../EventListener/TranslatorListenerTest.php | 119 + .../ValidateRequestListenerTest.php | 48 + .../AccessDeniedHttpExceptionTest.php | 13 + .../Exception/BadRequestHttpExceptionTest.php | 13 + .../Exception/ConflictHttpExceptionTest.php | 13 + .../Tests/Exception/GoneHttpExceptionTest.php | 13 + .../Tests/Exception/HttpExceptionTest.php | 53 + .../LengthRequiredHttpExceptionTest.php | 13 + .../MethodNotAllowedHttpExceptionTest.php | 37 + .../NotAcceptableHttpExceptionTest.php | 13 + .../Exception/NotFoundHttpExceptionTest.php | 13 + .../PreconditionFailedHttpExceptionTest.php | 13 + .../PreconditionRequiredHttpExceptionTest.php | 13 + .../ServiceUnavailableHttpExceptionTest.php | 42 + .../TooManyRequestsHttpExceptionTest.php | 42 + .../UnauthorizedHttpExceptionTest.php | 37 + .../UnprocessableEntityHttpExceptionTest.php | 13 + .../UnsupportedMediaTypeHttpExceptionTest.php | 13 + .../Fixtures/BaseBundle/Resources/foo.txt | 0 .../Fixtures/BaseBundle/Resources/hide.txt | 0 .../Fixtures/Bundle1Bundle/Resources/foo.txt | 0 .../Tests/Fixtures/Bundle1Bundle/bar.txt | 0 .../Tests/Fixtures/Bundle1Bundle/foo.txt | 0 .../Tests/Fixtures/Bundle2Bundle/foo.txt | 0 .../Fixtures/ChildBundle/Resources/foo.txt | 0 .../Fixtures/ChildBundle/Resources/hide.txt | 0 .../Tests/Fixtures/ClearableService.php | 13 + .../Controller/BasicTypesController.php | 19 + .../Fixtures/Controller/ExtendingRequest.php | 18 + .../Fixtures/Controller/ExtendingSession.php | 18 + .../Controller/NullableController.php | 19 + .../Controller/VariadicController.php | 19 + .../DataCollector/CloneVarDataCollector.php | 46 + .../ExtensionAbsentBundle.php | 18 + .../ExtensionLoadedExtension.php | 22 + .../ExtensionLoadedBundle.php | 18 + .../ExtensionNotValidExtension.php | 20 + .../ExtensionNotValidBundle.php | 18 + .../Command/BarCommand.php | 17 + .../Command/FooCommand.php | 22 + .../ExtensionPresentExtension.php | 22 + .../ExtensionPresentBundle.php | 18 + .../Tests/Fixtures/KernelForOverrideName.php | 28 + .../Tests/Fixtures/KernelForTest.php | 47 + .../Tests/Fixtures/KernelWithoutBundles.php | 38 + .../Tests/Fixtures/ResettableService.php | 13 + .../Fixtures/Resources/BaseBundle/hide.txt | 0 .../Fixtures/Resources/Bundle1Bundle/foo.txt | 0 .../Fixtures/Resources/ChildBundle/foo.txt | 0 .../Fixtures/Resources/FooBundle/foo.txt | 0 .../http-kernel/Tests/Fixtures/TestClient.php | 31 + .../Tests/Fixtures/TestEventDispatcher.php | 36 + .../Fragment/EsiFragmentRendererTest.php | 106 + .../Tests/Fragment/FragmentHandlerTest.php | 99 + .../Fragment/HIncludeFragmentRendererTest.php | 102 + .../Fragment/InlineFragmentRendererTest.php | 276 + .../Fragment/RoutableFragmentRendererTest.php | 94 + .../Fragment/SsiFragmentRendererTest.php | 97 + .../http-kernel/Tests/HttpCache/EsiTest.php | 248 + .../Tests/HttpCache/HttpCacheTest.php | 1525 + .../Tests/HttpCache/HttpCacheTestCase.php | 185 + .../HttpCache/ResponseCacheStrategyTest.php | 240 + .../http-kernel/Tests/HttpCache/SsiTest.php | 215 + .../http-kernel/Tests/HttpCache/StoreTest.php | 301 + .../Tests/HttpCache/SubRequestHandlerTest.php | 153 + .../Tests/HttpCache/TestHttpKernel.php | 102 + .../HttpCache/TestMultipleHttpKernel.php | 81 + .../http-kernel/Tests/HttpKernelTest.php | 396 + .../symfony/http-kernel/Tests/KernelTest.php | 758 + .../http-kernel/Tests/Log/LoggerTest.php | 212 + vendor/symfony/http-kernel/Tests/Logger.php | 88 + .../Profiler/FileProfilerStorageTest.php | 350 + .../Tests/Profiler/ProfilerTest.php | 105 + .../http-kernel/Tests/TestHttpKernel.php | 42 + .../http-kernel/Tests/UriSignerTest.php | 64 + vendor/symfony/http-kernel/UriSigner.php | 106 + vendor/symfony/http-kernel/composer.json | 73 + vendor/symfony/http-kernel/phpunit.xml.dist | 40 + vendor/symfony/polyfill-ctype/Ctype.php | 227 + vendor/symfony/polyfill-ctype/LICENSE | 19 + vendor/symfony/polyfill-ctype/README.md | 12 + vendor/symfony/polyfill-ctype/bootstrap.php | 26 + vendor/symfony/polyfill-ctype/composer.json | 34 + vendor/symfony/polyfill-mbstring/LICENSE | 19 + vendor/symfony/polyfill-mbstring/Mbstring.php | 800 + vendor/symfony/polyfill-mbstring/README.md | 13 + .../Resources/unidata/lowerCase.php | 1096 + .../Resources/unidata/titleCaseRegexp.php | 5 + .../Resources/unidata/upperCase.php | 1104 + .../symfony/polyfill-mbstring/bootstrap.php | 58 + .../symfony/polyfill-mbstring/composer.json | 34 + vendor/symfony/polyfill-php72/LICENSE | 19 + vendor/symfony/polyfill-php72/Php72.php | 216 + vendor/symfony/polyfill-php72/README.md | 27 + vendor/symfony/polyfill-php72/bootstrap.php | 36 + vendor/symfony/polyfill-php72/composer.json | 31 + vendor/symfony/process/.gitignore | 3 + vendor/symfony/process/CHANGELOG.md | 90 + .../process/Exception/ExceptionInterface.php | 21 + .../Exception/InvalidArgumentException.php | 21 + .../process/Exception/LogicException.php | 21 + .../Exception/ProcessFailedException.php | 54 + .../Exception/ProcessSignaledException.php | 41 + .../Exception/ProcessTimedOutException.php | 69 + .../process/Exception/RuntimeException.php | 21 + vendor/symfony/process/ExecutableFinder.php | 88 + vendor/symfony/process/InputStream.php | 90 + vendor/symfony/process/LICENSE | 19 + .../symfony/process/PhpExecutableFinder.php | 101 + vendor/symfony/process/PhpProcess.php | 76 + .../symfony/process/Pipes/AbstractPipes.php | 178 + .../symfony/process/Pipes/PipesInterface.php | 67 + vendor/symfony/process/Pipes/UnixPipes.php | 153 + vendor/symfony/process/Pipes/WindowsPipes.php | 191 + vendor/symfony/process/Process.php | 1652 + vendor/symfony/process/ProcessUtils.php | 69 + vendor/symfony/process/README.md | 13 + .../process/Tests/ExecutableFinderTest.php | 163 + .../Tests/KillableProcessWithOutput.php | 26 + .../process/Tests/NonStopableProcess.php | 47 + .../process/Tests/PhpExecutableFinderTest.php | 49 + .../symfony/process/Tests/PhpProcessTest.php | 48 + .../PipeStdinInStdoutStdErrStreamSelect.php | 72 + .../Tests/ProcessFailedExceptionTest.php | 137 + vendor/symfony/process/Tests/ProcessTest.php | 1533 + .../symfony/process/Tests/SignalListener.php | 21 + vendor/symfony/process/composer.json | 33 + vendor/symfony/process/phpunit.xml.dist | 30 + vendor/symfony/routing/.gitignore | 3 + vendor/symfony/routing/Annotation/Route.php | 164 + vendor/symfony/routing/CHANGELOG.md | 239 + vendor/symfony/routing/CompiledRoute.php | 165 + .../RoutingResolverPass.php | 49 + .../routing/Exception/ExceptionInterface.php | 21 + .../Exception/InvalidParameterException.php | 21 + .../Exception/MethodNotAllowedException.php | 41 + .../MissingMandatoryParametersException.php | 22 + .../Exception/NoConfigurationException.php | 21 + .../Exception/ResourceNotFoundException.php | 23 + .../Exception/RouteNotFoundException.php | 21 + .../ConfigurableRequirementsInterface.php | 55 + .../Generator/Dumper/GeneratorDumper.php | 37 + .../Dumper/GeneratorDumperInterface.php | 39 + .../Generator/Dumper/PhpGeneratorDumper.php | 136 + .../routing/Generator/UrlGenerator.php | 335 + .../Generator/UrlGeneratorInterface.php | 86 + vendor/symfony/routing/LICENSE | 19 + .../routing/Loader/AnnotationClassLoader.php | 335 + .../Loader/AnnotationDirectoryLoader.php | 93 + .../routing/Loader/AnnotationFileLoader.php | 141 + .../symfony/routing/Loader/ClosureLoader.php | 46 + .../Configurator/CollectionConfigurator.php | 95 + .../Configurator/ImportConfigurator.php | 93 + .../Loader/Configurator/RouteConfigurator.php | 34 + .../Configurator/RoutingConfigurator.php | 62 + .../Loader/Configurator/Traits/AddTrait.php | 90 + .../Loader/Configurator/Traits/RouteTrait.php | 127 + .../ServiceRouterLoader.php | 40 + .../routing/Loader/DirectoryLoader.php | 58 + .../symfony/routing/Loader/GlobFileLoader.php | 47 + .../routing/Loader/ObjectRouteLoader.php | 100 + .../symfony/routing/Loader/PhpFileLoader.php | 75 + .../symfony/routing/Loader/XmlFileLoader.php | 425 + .../symfony/routing/Loader/YamlFileLoader.php | 268 + .../Loader/schema/routing/routing-1.0.xsd | 162 + .../routing/Matcher/Dumper/MatcherDumper.php | 37 + .../Matcher/Dumper/MatcherDumperInterface.php | 39 + .../Matcher/Dumper/PhpMatcherDumper.php | 489 + .../Matcher/Dumper/PhpMatcherTrait.php | 181 + .../Matcher/Dumper/StaticPrefixCollection.php | 202 + .../Matcher/RedirectableUrlMatcher.php | 64 + .../RedirectableUrlMatcherInterface.php | 31 + .../Matcher/RequestMatcherInterface.php | 39 + .../routing/Matcher/TraceableUrlMatcher.php | 141 + vendor/symfony/routing/Matcher/UrlMatcher.php | 307 + .../routing/Matcher/UrlMatcherInterface.php | 41 + vendor/symfony/routing/README.md | 13 + vendor/symfony/routing/RequestContext.php | 326 + .../routing/RequestContextAwareInterface.php | 27 + vendor/symfony/routing/Route.php | 571 + vendor/symfony/routing/RouteCollection.php | 297 + .../routing/RouteCollectionBuilder.php | 376 + vendor/symfony/routing/RouteCompiler.php | 329 + .../routing/RouteCompilerInterface.php | 30 + vendor/symfony/routing/Router.php | 388 + vendor/symfony/routing/RouterInterface.php | 32 + .../routing/Tests/Annotation/RouteTest.php | 59 + .../routing/Tests/CompiledRouteTest.php | 27 + .../RoutingResolverPassTest.php | 36 + .../AnnotatedClasses/AbstractClass.php | 16 + .../Fixtures/AnnotatedClasses/BarClass.php | 19 + .../Fixtures/AnnotatedClasses/BazClass.php | 19 + .../Fixtures/AnnotatedClasses/FooClass.php | 16 + .../Fixtures/AnnotatedClasses/FooTrait.php | 13 + .../AbstractClassController.php | 7 + .../ActionPathController.php | 15 + .../DefaultValueController.php | 15 + .../ExplicitLocalizedActionPathController.php | 15 + .../InvokableController.php | 15 + .../InvokableLocalizedController.php | 15 + .../LocalizedActionPathController.php | 15 + .../LocalizedMethodActionControllers.php | 25 + ...calizedPrefixLocalizedActionController.php | 18 + ...zedPrefixMissingLocaleActionController.php | 18 + ...efixMissingRouteLocaleActionController.php | 18 + .../LocalizedPrefixWithRouteWithoutLocale.php | 18 + .../MethodActionControllers.php | 25 + .../MissingRouteNameController.php | 15 + .../NothingButNameController.php | 15 + ...PrefixedActionLocalizedRouteController.php | 18 + .../PrefixedActionPathController.php | 18 + ...ementsWithoutPlaceholderNameController.php | 27 + .../RouteWithPrefixController.php | 18 + .../Tests/Fixtures/CustomCompiledRoute.php | 18 + .../Tests/Fixtures/CustomRouteCompiler.php | 26 + .../Tests/Fixtures/CustomXmlFileLoader.php | 26 + .../AnonymousClassInTrait.php | 24 + .../OtherAnnotatedClasses/NoStartTagClass.php | 3 + .../OtherAnnotatedClasses/VariadicClass.php | 19 + .../Tests/Fixtures/RedirectableUrlMatcher.php | 30 + .../routing/Tests/Fixtures/annotated.php | 0 .../routing/Tests/Fixtures/bad_format.yml | 3 + vendor/symfony/routing/Tests/Fixtures/bar.xml | 0 .../controller/import__controller.xml | 10 + .../controller/import__controller.yml | 4 + .../Fixtures/controller/import_controller.xml | 8 + .../Fixtures/controller/import_controller.yml | 3 + .../controller/import_override_defaults.xml | 10 + .../controller/import_override_defaults.yml | 5 + .../Fixtures/controller/override_defaults.xml | 10 + .../Fixtures/controller/override_defaults.yml | 5 + .../Tests/Fixtures/controller/routing.xml | 14 + .../Tests/Fixtures/controller/routing.yml | 11 + .../Fixtures/directory/recurse/routes1.yml | 2 + .../Fixtures/directory/recurse/routes2.yml | 2 + .../Tests/Fixtures/directory/routes3.yml | 2 + .../Fixtures/directory_import/import.yml | 3 + .../Tests/Fixtures/dumper/url_matcher0.php | 18 + .../Tests/Fixtures/dumper/url_matcher1.php | 113 + .../Tests/Fixtures/dumper/url_matcher10.php | 2776 ++ .../Tests/Fixtures/dumper/url_matcher11.php | 66 + .../Tests/Fixtures/dumper/url_matcher12.php | 46 + .../Tests/Fixtures/dumper/url_matcher13.php | 34 + .../Tests/Fixtures/dumper/url_matcher2.php | 115 + .../Tests/Fixtures/dumper/url_matcher3.php | 35 + .../Tests/Fixtures/dumper/url_matcher4.php | 28 + .../Tests/Fixtures/dumper/url_matcher5.php | 42 + .../Tests/Fixtures/dumper/url_matcher6.php | 54 + .../Tests/Fixtures/dumper/url_matcher7.php | 54 + .../Tests/Fixtures/dumper/url_matcher8.php | 34 + .../Tests/Fixtures/dumper/url_matcher9.php | 26 + .../symfony/routing/Tests/Fixtures/empty.yml | 0 .../routing/Tests/Fixtures/file_resource.yml | 0 vendor/symfony/routing/Tests/Fixtures/foo.xml | 0 .../symfony/routing/Tests/Fixtures/foo1.xml | 0 .../routing/Tests/Fixtures/glob/bar.xml | 8 + .../routing/Tests/Fixtures/glob/bar.yml | 4 + .../routing/Tests/Fixtures/glob/baz.xml | 8 + .../routing/Tests/Fixtures/glob/baz.yml | 4 + .../Tests/Fixtures/glob/import_multiple.xml | 8 + .../Tests/Fixtures/glob/import_multiple.yml | 2 + .../Tests/Fixtures/glob/import_single.xml | 8 + .../Tests/Fixtures/glob/import_single.yml | 2 + .../routing/Tests/Fixtures/glob/php_dsl.php | 7 + .../Tests/Fixtures/glob/php_dsl_bar.php | 12 + .../Tests/Fixtures/glob/php_dsl_baz.php | 12 + .../import_with_name_prefix/routing.xml | 10 + .../import_with_name_prefix/routing.yml | 7 + .../import_with_no_trailing_slash/routing.xml | 10 + .../import_with_no_trailing_slash/routing.yml | 10 + .../routing/Tests/Fixtures/incomplete.yml | 2 + .../routing/Tests/Fixtures/list_defaults.xml | 20 + .../Tests/Fixtures/list_in_list_defaults.xml | 22 + .../Tests/Fixtures/list_in_map_defaults.xml | 22 + .../Tests/Fixtures/list_null_values.xml | 22 + .../routing/Tests/Fixtures/localized.xml | 13 + ...imported-with-locale-but-not-localized.xml | 9 + ...imported-with-locale-but-not-localized.yml | 4 + .../localized/imported-with-locale.xml | 11 + .../localized/imported-with-locale.yml | 6 + .../importer-with-controller-default.yml | 5 + ...ith-locale-imports-non-localized-route.xml | 10 + ...ith-locale-imports-non-localized-route.yml | 6 + .../localized/importer-with-locale.xml | 10 + .../localized/importer-with-locale.yml | 6 + .../localized/importing-localized-route.yml | 3 + .../Fixtures/localized/localized-route.yml | 9 + .../localized/missing-locale-in-importer.yml | 5 + .../Fixtures/localized/not-localized.yml | 4 + .../officially_formatted_locales.yml | 7 + .../route-without-path-or-locales.yml | 3 + .../routing/Tests/Fixtures/map_defaults.xml | 20 + .../Tests/Fixtures/map_in_list_defaults.xml | 22 + .../Tests/Fixtures/map_in_map_defaults.xml | 22 + .../Tests/Fixtures/map_null_values.xml | 22 + .../routing/Tests/Fixtures/missing_id.xml | 8 + .../routing/Tests/Fixtures/missing_path.xml | 8 + .../Tests/Fixtures/namespaceprefix.xml | 16 + .../Fixtures/nonesense_resource_plus_path.yml | 3 + .../nonesense_type_without_resource.yml | 3 + .../routing/Tests/Fixtures/nonvalid.xml | 10 + .../routing/Tests/Fixtures/nonvalid.yml | 1 + .../routing/Tests/Fixtures/nonvalid2.yml | 1 + .../routing/Tests/Fixtures/nonvalidkeys.yml | 3 + .../routing/Tests/Fixtures/nonvalidnode.xml | 8 + .../routing/Tests/Fixtures/nonvalidroute.xml | 12 + .../routing/Tests/Fixtures/null_values.xml | 12 + .../routing/Tests/Fixtures/php_dsl.php | 29 + .../routing/Tests/Fixtures/php_dsl_i18n.php | 17 + .../routing/Tests/Fixtures/php_dsl_sub.php | 15 + .../Tests/Fixtures/php_dsl_sub_i18n.php | 11 + .../Tests/Fixtures/php_dsl_sub_root.php | 10 + .../routing/Tests/Fixtures/php_object_dsl.php | 32 + .../requirements_without_placeholder_name.yml | 4 + .../Tests/Fixtures/scalar_defaults.xml | 33 + .../Tests/Fixtures/special_route_name.yml | 2 + .../routing/Tests/Fixtures/validpattern.php | 18 + .../routing/Tests/Fixtures/validpattern.xml | 15 + .../routing/Tests/Fixtures/validpattern.yml | 13 + .../routing/Tests/Fixtures/validresource.php | 18 + .../routing/Tests/Fixtures/validresource.xml | 13 + .../routing/Tests/Fixtures/validresource.yml | 8 + .../Fixtures/with_define_path_variable.php | 5 + .../routing/Tests/Fixtures/withdoctype.xml | 3 + .../Dumper/PhpGeneratorDumperTest.php | 256 + .../Tests/Generator/UrlGeneratorTest.php | 724 + .../Loader/AbstractAnnotationLoaderTest.php | 33 + .../Loader/AnnotationClassLoaderTest.php | 285 + .../Loader/AnnotationDirectoryLoaderTest.php | 109 + .../Tests/Loader/AnnotationFileLoaderTest.php | 85 + .../Tests/Loader/ClosureLoaderTest.php | 49 + .../Tests/Loader/DirectoryLoaderTest.php | 74 + .../routing/Tests/Loader/FileLocatorStub.php | 17 + .../Tests/Loader/GlobFileLoaderTest.php | 45 + .../Tests/Loader/ObjectRouteLoaderTest.php | 148 + .../Tests/Loader/PhpFileLoaderTest.php | 169 + .../Tests/Loader/XmlFileLoaderTest.php | 444 + .../Tests/Loader/YamlFileLoaderTest.php | 317 + .../DumpedRedirectableUrlMatcherTest.php | 43 + .../Tests/Matcher/DumpedUrlMatcherTest.php | 30 + .../Matcher/Dumper/PhpMatcherDumperTest.php | 510 + .../Dumper/StaticPrefixCollectionTest.php | 177 + .../Matcher/RedirectableUrlMatcherTest.php | 194 + .../Tests/Matcher/TraceableUrlMatcherTest.php | 122 + .../routing/Tests/Matcher/UrlMatcherTest.php | 743 + .../routing/Tests/RequestContextTest.php | 160 + .../Tests/RouteCollectionBuilderTest.php | 364 + .../routing/Tests/RouteCollectionTest.php | 333 + .../routing/Tests/RouteCompilerTest.php | 408 + vendor/symfony/routing/Tests/RouteTest.php | 274 + vendor/symfony/routing/Tests/RouterTest.php | 163 + vendor/symfony/routing/composer.json | 55 + vendor/symfony/routing/phpunit.xml.dist | 30 + vendor/symfony/translation/.gitignore | 3 + vendor/symfony/translation/CHANGELOG.md | 120 + .../Catalogue/AbstractOperation.php | 157 + .../translation/Catalogue/MergeOperation.php | 58 + .../Catalogue/OperationInterface.php | 77 + .../translation/Catalogue/TargetOperation.php | 72 + .../translation/Command/XliffLintCommand.php | 274 + .../TranslationDataCollector.php | 170 + .../translation/DataCollectorTranslator.php | 177 + .../TranslationDumperPass.php | 44 + .../TranslationExtractorPass.php | 49 + .../DependencyInjection/TranslatorPass.php | 79 + .../translation/Dumper/CsvFileDumper.php | 63 + .../translation/Dumper/DumperInterface.php | 31 + .../symfony/translation/Dumper/FileDumper.php | 132 + .../translation/Dumper/IcuResFileDumper.php | 106 + .../translation/Dumper/IniFileDumper.php | 45 + .../translation/Dumper/JsonFileDumper.php | 40 + .../translation/Dumper/MoFileDumper.php | 82 + .../translation/Dumper/PhpFileDumper.php | 38 + .../translation/Dumper/PoFileDumper.php | 61 + .../translation/Dumper/QtFileDumper.php | 50 + .../translation/Dumper/XliffFileDumper.php | 205 + .../translation/Dumper/YamlFileDumper.php | 62 + .../Exception/ExceptionInterface.php | 21 + .../Exception/InvalidArgumentException.php | 21 + .../Exception/InvalidResourceException.php | 21 + .../translation/Exception/LogicException.php | 21 + .../Exception/NotFoundResourceException.php | 21 + .../Exception/RuntimeException.php | 21 + .../Extractor/AbstractFileExtractor.php | 80 + .../translation/Extractor/ChainExtractor.php | 60 + .../Extractor/ExtractorInterface.php | 38 + .../translation/Extractor/PhpExtractor.php | 256 + .../Extractor/PhpStringTokenParser.php | 142 + .../ChoiceMessageFormatterInterface.php | 32 + .../translation/Formatter/IntlFormatter.php | 55 + .../Formatter/IntlFormatterInterface.php | 27 + .../Formatter/MessageFormatter.php | 79 + .../Formatter/MessageFormatterInterface.php | 30 + .../translation/IdentityTranslator.php | 61 + vendor/symfony/translation/Interval.php | 112 + vendor/symfony/translation/LICENSE | 19 + .../translation/Loader/ArrayLoader.php | 66 + .../translation/Loader/CsvFileLoader.php | 65 + .../symfony/translation/Loader/FileLoader.php | 65 + .../translation/Loader/IcuDatFileLoader.php | 61 + .../translation/Loader/IcuResFileLoader.php | 91 + .../translation/Loader/IniFileLoader.php | 28 + .../translation/Loader/JsonFileLoader.php | 64 + .../translation/Loader/LoaderInterface.php | 38 + .../translation/Loader/MoFileLoader.php | 145 + .../translation/Loader/PhpFileLoader.php | 28 + .../translation/Loader/PoFileLoader.php | 148 + .../translation/Loader/QtFileLoader.php | 77 + .../translation/Loader/XliffFileLoader.php | 199 + .../translation/Loader/YamlFileLoader.php | 50 + .../symfony/translation/LoggingTranslator.php | 151 + .../symfony/translation/MessageCatalogue.php | 301 + .../translation/MessageCatalogueInterface.php | 138 + .../symfony/translation/MessageSelector.php | 98 + .../translation/MetadataAwareInterface.php | 54 + .../translation/PluralizationRules.php | 218 + vendor/symfony/translation/README.md | 13 + .../translation/Reader/TranslationReader.php | 63 + .../Reader/TranslationReaderInterface.php | 30 + .../translation/Resources/data/parents.json | 136 + .../schemas/xliff-core-1.2-strict.xsd | 2223 ++ .../Resources/schemas/xliff-core-2.0.xsd | 411 + .../translation/Resources/schemas/xml.xsd | 309 + .../Tests/Catalogue/AbstractOperationTest.php | 74 + .../Tests/Catalogue/MergeOperationTest.php | 97 + .../Tests/Catalogue/TargetOperationTest.php | 96 + .../Tests/Command/XliffLintCommandTest.php | 207 + .../TranslationDataCollectorTest.php | 150 + .../Tests/DataCollectorTranslatorTest.php | 116 + .../TranslationDumperPassTest.php | 48 + .../TranslationExtractorPassTest.php | 66 + .../TranslationPassTest.php | 57 + .../Tests/Dumper/CsvFileDumperTest.php | 30 + .../Tests/Dumper/FileDumperTest.php | 90 + .../Tests/Dumper/IcuResFileDumperTest.php | 29 + .../Tests/Dumper/IniFileDumperTest.php | 29 + .../Tests/Dumper/JsonFileDumperTest.php | 39 + .../Tests/Dumper/MoFileDumperTest.php | 29 + .../Tests/Dumper/PhpFileDumperTest.php | 29 + .../Tests/Dumper/PoFileDumperTest.php | 29 + .../Tests/Dumper/QtFileDumperTest.php | 29 + .../Tests/Dumper/XliffFileDumperTest.php | 115 + .../Tests/Dumper/YamlFileDumperTest.php | 47 + .../Tests/Extractor/PhpExtractorTest.php | 95 + .../Tests/Formatter/IntlFormatterTest.php | 96 + .../Tests/Formatter/MessageFormatterTest.php | 83 + .../Tests/IdentityTranslatorTest.php | 23 + .../translation/Tests/IntervalTest.php | 52 + .../Tests/Loader/CsvFileLoaderTest.php | 61 + .../Tests/Loader/IcuDatFileLoaderTest.php | 64 + .../Tests/Loader/IcuResFileLoaderTest.php | 51 + .../Tests/Loader/IniFileLoaderTest.php | 51 + .../Tests/Loader/JsonFileLoaderTest.php | 62 + .../Tests/Loader/LocalizedTestCase.php | 24 + .../Tests/Loader/MoFileLoaderTest.php | 72 + .../Tests/Loader/PhpFileLoaderTest.php | 50 + .../Tests/Loader/PoFileLoaderTest.php | 109 + .../Tests/Loader/QtFileLoaderTest.php | 75 + .../Tests/Loader/XliffFileLoaderTest.php | 260 + .../Tests/Loader/YamlFileLoaderTest.php | 71 + .../Tests/LoggingTranslatorTest.php | 68 + .../Tests/MessageCatalogueTest.php | 243 + .../translation/Tests/MessageSelectorTest.php | 140 + .../Tests/PluralizationRulesTest.php | 124 + .../translation/Tests/TranslatorCacheTest.php | 318 + .../translation/Tests/TranslatorTest.php | 612 + .../Tests/Util/ArrayConverterTest.php | 74 + .../Tests/Writer/TranslationWriterTest.php | 69 + .../Tests/fixtures/empty-translation.mo | Bin 0 -> 49 bytes .../Tests/fixtures/empty-translation.po | 3 + .../translation/Tests/fixtures/empty.csv | 0 .../translation/Tests/fixtures/empty.ini | 0 .../translation/Tests/fixtures/empty.json | 0 .../translation/Tests/fixtures/empty.mo | 0 .../translation/Tests/fixtures/empty.po | 0 .../translation/Tests/fixtures/empty.xlf | 0 .../translation/Tests/fixtures/empty.yml | 0 .../translation/Tests/fixtures/encoding.xlf | 16 + .../Tests/fixtures/escaped-id-plurals.po | 10 + .../translation/Tests/fixtures/escaped-id.po | 8 + .../fixtures/extractor/resource.format.engine | 0 .../this.is.a.template.format.engine | 0 .../fixtures/extractor/translation.html.php | 49 + .../Tests/fixtures/fuzzy-translations.po | 10 + .../Tests/fixtures/invalid-xml-resources.xlf | 23 + .../translation/Tests/fixtures/malformed.json | 3 + .../translation/Tests/fixtures/messages.yml | 3 + .../Tests/fixtures/messages_linear.yml | 2 + .../translation/Tests/fixtures/non-valid.xlf | 11 + .../translation/Tests/fixtures/non-valid.yml | 1 + .../translation/Tests/fixtures/plurals.mo | Bin 0 -> 74 bytes .../translation/Tests/fixtures/plurals.po | 5 + .../translation/Tests/fixtures/resname.xlf | 22 + .../resourcebundle/corrupted/resources.dat | 1 + .../Tests/fixtures/resourcebundle/dat/en.res | Bin 0 -> 120 bytes .../Tests/fixtures/resourcebundle/dat/en.txt | 3 + .../Tests/fixtures/resourcebundle/dat/fr.res | Bin 0 -> 124 bytes .../Tests/fixtures/resourcebundle/dat/fr.txt | 3 + .../resourcebundle/dat/packagelist.txt | 2 + .../fixtures/resourcebundle/dat/resources.dat | Bin 0 -> 352 bytes .../Tests/fixtures/resourcebundle/res/en.res | Bin 0 -> 84 bytes .../Tests/fixtures/resources-2.0-clean.xlf | 23 + .../resources-2.0-multi-segment-unit.xlf | 17 + .../Tests/fixtures/resources-2.0.xlf | 25 + .../Tests/fixtures/resources-clean.xlf | 25 + .../Tests/fixtures/resources-notes-meta.xlf | 26 + .../fixtures/resources-target-attributes.xlf | 14 + .../Tests/fixtures/resources-tool-info.xlf | 14 + .../translation/Tests/fixtures/resources.csv | 4 + .../Tests/fixtures/resources.dump.json | 1 + .../translation/Tests/fixtures/resources.ini | 1 + .../translation/Tests/fixtures/resources.json | 3 + .../translation/Tests/fixtures/resources.mo | Bin 0 -> 52 bytes .../translation/Tests/fixtures/resources.php | 5 + .../translation/Tests/fixtures/resources.po | 8 + .../translation/Tests/fixtures/resources.ts | 10 + .../translation/Tests/fixtures/resources.xlf | 23 + .../translation/Tests/fixtures/resources.yml | 1 + .../translation/Tests/fixtures/valid.csv | 4 + .../Tests/fixtures/with-attributes.xlf | 21 + .../Tests/fixtures/withdoctype.xlf | 12 + .../translation/Tests/fixtures/withnote.xlf | 22 + vendor/symfony/translation/Translator.php | 507 + .../translation/TranslatorBagInterface.php | 33 + .../translation/TranslatorInterface.php | 70 + .../translation/Util/ArrayConverter.php | 99 + .../symfony/translation/Util/XliffUtils.php | 163 + .../translation/Writer/TranslationWriter.php | 90 + .../Writer/TranslationWriterInterface.php | 34 + vendor/symfony/translation/composer.json | 57 + vendor/symfony/translation/phpunit.xml.dist | 30 + vendor/symfony/var-dumper/.gitignore | 3 + vendor/symfony/var-dumper/CHANGELOG.md | 37 + .../symfony/var-dumper/Caster/AmqpCaster.php | 210 + vendor/symfony/var-dumper/Caster/ArgsStub.php | 80 + vendor/symfony/var-dumper/Caster/Caster.php | 157 + .../symfony/var-dumper/Caster/ClassStub.php | 106 + .../symfony/var-dumper/Caster/ConstStub.php | 33 + .../var-dumper/Caster/CutArrayStub.php | 30 + vendor/symfony/var-dumper/Caster/CutStub.php | 59 + .../symfony/var-dumper/Caster/DOMCaster.php | 302 + .../symfony/var-dumper/Caster/DateCaster.php | 122 + .../var-dumper/Caster/DoctrineCaster.php | 60 + vendor/symfony/var-dumper/Caster/EnumStub.php | 30 + .../var-dumper/Caster/ExceptionCaster.php | 357 + .../symfony/var-dumper/Caster/FrameStub.php | 30 + .../symfony/var-dumper/Caster/GmpCaster.php | 30 + .../symfony/var-dumper/Caster/IntlCaster.php | 171 + vendor/symfony/var-dumper/Caster/LinkStub.php | 108 + .../var-dumper/Caster/MemcachedCaster.php | 79 + .../symfony/var-dumper/Caster/PdoCaster.php | 120 + .../symfony/var-dumper/Caster/PgSqlCaster.php | 154 + .../var-dumper/Caster/ProxyManagerCaster.php | 31 + .../symfony/var-dumper/Caster/RedisCaster.php | 150 + .../var-dumper/Caster/ReflectionCaster.php | 378 + .../var-dumper/Caster/ResourceCaster.php | 72 + .../symfony/var-dumper/Caster/SplCaster.php | 213 + .../symfony/var-dumper/Caster/StubCaster.php | 82 + .../var-dumper/Caster/SymfonyCaster.php | 43 + .../symfony/var-dumper/Caster/TraceStub.php | 36 + .../var-dumper/Caster/XmlReaderCaster.php | 77 + .../var-dumper/Caster/XmlResourceCaster.php | 61 + .../var-dumper/Cloner/AbstractCloner.php | 340 + .../var-dumper/Cloner/ClonerInterface.php | 27 + vendor/symfony/var-dumper/Cloner/Cursor.php | 43 + vendor/symfony/var-dumper/Cloner/Data.php | 423 + .../var-dumper/Cloner/DumperInterface.php | 60 + vendor/symfony/var-dumper/Cloner/Stub.php | 57 + .../symfony/var-dumper/Cloner/VarCloner.php | 293 + .../Command/Descriptor/CliDescriptor.php | 81 + .../Descriptor/DumpDescriptorInterface.php | 23 + .../Command/Descriptor/HtmlDescriptor.php | 119 + .../var-dumper/Command/ServerDumpCommand.php | 99 + .../var-dumper/Dumper/AbstractDumper.php | 211 + .../symfony/var-dumper/Dumper/CliDumper.php | 597 + .../ContextProvider/CliContextProvider.php | 32 + .../ContextProviderInterface.php | 25 + .../RequestContextProvider.php | 49 + .../ContextProvider/SourceContextProvider.php | 126 + .../var-dumper/Dumper/DataDumperInterface.php | 24 + .../symfony/var-dumper/Dumper/HtmlDumper.php | 954 + .../var-dumper/Dumper/ServerDumper.php | 53 + .../Exception/ThrowingCasterException.php | 26 + vendor/symfony/var-dumper/LICENSE | 19 + vendor/symfony/var-dumper/README.md | 15 + .../var-dumper/Resources/bin/var-dump-server | 63 + .../Resources/css/htmlDescriptor.css | 130 + .../var-dumper/Resources/functions/dump.php | 43 + .../var-dumper/Resources/js/htmlDescriptor.js | 10 + .../symfony/var-dumper/Server/Connection.php | 97 + .../symfony/var-dumper/Server/DumpServer.php | 107 + .../var-dumper/Test/VarDumperTestTrait.php | 57 + .../var-dumper/Tests/Caster/CasterTest.php | 178 + .../Tests/Caster/DateCasterTest.php | 390 + .../Tests/Caster/ExceptionCasterTest.php | 247 + .../var-dumper/Tests/Caster/GmpCasterTest.php | 48 + .../Tests/Caster/IntlCasterTest.php | 299 + .../Tests/Caster/MemcachedCasterTest.php | 93 + .../var-dumper/Tests/Caster/PdoCasterTest.php | 64 + .../Tests/Caster/RedisCasterTest.php | 70 + .../Tests/Caster/ReflectionCasterTest.php | 254 + .../var-dumper/Tests/Caster/SplCasterTest.php | 207 + .../Tests/Caster/StubCasterTest.php | 213 + .../Tests/Caster/XmlReaderCasterTest.php | 248 + .../var-dumper/Tests/Cloner/DataTest.php | 115 + .../var-dumper/Tests/Cloner/VarClonerTest.php | 437 + .../var-dumper/Tests/Dumper/CliDumperTest.php | 541 + .../var-dumper/Tests/Dumper/FunctionsTest.php | 57 + .../Tests/Dumper/HtmlDumperTest.php | 170 + .../Tests/Dumper/ServerDumperTest.php | 95 + .../Tests/Fixtures/FooInterface.php | 11 + .../Tests/Fixtures/GeneratorDemo.php | 21 + .../Tests/Fixtures/NotLoadableClass.php | 7 + .../var-dumper/Tests/Fixtures/Twig.php | 38 + .../var-dumper/Tests/Fixtures/dumb-var.php | 40 + .../var-dumper/Tests/Fixtures/dump_server.php | 38 + .../var-dumper/Tests/Fixtures/xml_reader.xml | 10 + .../Tests/Server/ConnectionTest.php | 88 + .../Tests/Test/VarDumperTestTraitTest.php | 46 + vendor/symfony/var-dumper/VarDumper.php | 54 + vendor/symfony/var-dumper/composer.json | 53 + vendor/symfony/var-dumper/phpunit.xml.dist | 33 + vendor/symfony/yaml/.gitignore | 3 + vendor/symfony/yaml/CHANGELOG.md | 184 + vendor/symfony/yaml/Command/LintCommand.php | 253 + vendor/symfony/yaml/Dumper.php | 97 + vendor/symfony/yaml/Escaper.php | 101 + .../symfony/yaml/Exception/DumpException.php | 21 + .../yaml/Exception/ExceptionInterface.php | 21 + .../symfony/yaml/Exception/ParseException.php | 139 + .../yaml/Exception/RuntimeException.php | 21 + vendor/symfony/yaml/Inline.php | 744 + vendor/symfony/yaml/LICENSE | 19 + vendor/symfony/yaml/Parser.php | 1061 + vendor/symfony/yaml/README.md | 13 + vendor/symfony/yaml/Tag/TaggedValue.php | 38 + .../yaml/Tests/Command/LintCommandTest.php | 151 + vendor/symfony/yaml/Tests/DumperTest.php | 429 + .../yaml/Tests/Fixtures/YtsAnchorAlias.yml | 31 + .../yaml/Tests/Fixtures/YtsBasicTests.yml | 202 + .../yaml/Tests/Fixtures/YtsBlockMapping.yml | 51 + .../Tests/Fixtures/YtsDocumentSeparator.yml | 85 + .../yaml/Tests/Fixtures/YtsErrorTests.yml | 25 + .../Tests/Fixtures/YtsFlowCollections.yml | 60 + .../yaml/Tests/Fixtures/YtsFoldedScalars.yml | 176 + .../Tests/Fixtures/YtsNullsAndEmpties.yml | 45 + .../Fixtures/YtsSpecificationExamples.yml | 1662 + .../yaml/Tests/Fixtures/YtsTypeTransfers.yml | 224 + vendor/symfony/yaml/Tests/Fixtures/arrow.gif | Bin 0 -> 185 bytes .../Tests/Fixtures/booleanMappingKeys.yml | 11 + .../yaml/Tests/Fixtures/embededPhp.yml | 1 + .../yaml/Tests/Fixtures/escapedCharacters.yml | 155 + vendor/symfony/yaml/Tests/Fixtures/index.yml | 18 + .../multiple_lines_as_literal_block.yml | 14 + ...eral_block_leading_space_in_first_line.yml | 4 + .../yaml/Tests/Fixtures/nonStringKeys.yml | 3 + .../yaml/Tests/Fixtures/not_readable.yml | 18 + .../yaml/Tests/Fixtures/nullMappingKey.yml | 9 + .../Tests/Fixtures/numericMappingKeys.yml | 23 + .../yaml/Tests/Fixtures/sfComments.yml | 76 + .../symfony/yaml/Tests/Fixtures/sfCompact.yml | 159 + .../yaml/Tests/Fixtures/sfMergeKey.yml | 61 + .../symfony/yaml/Tests/Fixtures/sfObjects.yml | 11 + .../symfony/yaml/Tests/Fixtures/sfQuotes.yml | 33 + .../symfony/yaml/Tests/Fixtures/sfTests.yml | 140 + .../Tests/Fixtures/unindentedCollections.yml | 82 + vendor/symfony/yaml/Tests/InlineTest.php | 760 + .../symfony/yaml/Tests/ParseExceptionTest.php | 34 + vendor/symfony/yaml/Tests/ParserTest.php | 2108 ++ vendor/symfony/yaml/Tests/YamlTest.php | 44 + vendor/symfony/yaml/Unescaper.php | 138 + vendor/symfony/yaml/Yaml.php | 101 + vendor/symfony/yaml/composer.json | 43 + vendor/symfony/yaml/phpunit.xml.dist | 30 + vendor/theseer/tokenizer/.gitignore | 7 + vendor/theseer/tokenizer/.php_cs | 67 + vendor/theseer/tokenizer/.travis.yml | 33 + vendor/theseer/tokenizer/LICENSE | 30 + vendor/theseer/tokenizer/README.md | 49 + vendor/theseer/tokenizer/build.xml | 41 + vendor/theseer/tokenizer/composer.json | 27 + vendor/theseer/tokenizer/phive.xml | 5 + vendor/theseer/tokenizer/phpunit.xml | 25 + vendor/theseer/tokenizer/src/Exception.php | 6 + vendor/theseer/tokenizer/src/NamespaceUri.php | 28 + .../tokenizer/src/NamespaceUriException.php | 6 + vendor/theseer/tokenizer/src/Token.php | 55 + .../theseer/tokenizer/src/TokenCollection.php | 128 + .../src/TokenCollectionException.php | 6 + vendor/theseer/tokenizer/src/Tokenizer.php | 82 + .../theseer/tokenizer/src/XMLSerializer.php | 94 + .../tokenizer/tests/NamespaceUriTest.php | 29 + .../tokenizer/tests/TokenCollectionTest.php | 72 + vendor/theseer/tokenizer/tests/TokenTest.php | 31 + .../theseer/tokenizer/tests/TokenizerTest.php | 21 + .../tokenizer/tests/XMLSerializerTest.php | 43 + .../tokenizer/tests/_files/customns.xml | 177 + .../theseer/tokenizer/tests/_files/test.php | 25 + .../tokenizer/tests/_files/test.php.tokens | Bin 0 -> 29474 bytes .../tokenizer/tests/_files/test.php.xml | 177 + .../css-to-inline-styles/LICENSE.md | 23 + .../css-to-inline-styles/composer.json | 31 + .../css-to-inline-styles/phpunit.xml.dist | 18 + .../src/Css/Processor.php | 68 + .../src/Css/Property/Processor.php | 122 + .../src/Css/Property/Property.php | 90 + .../src/Css/Rule/Processor.php | 155 + .../src/Css/Rule/Rule.php | 84 + .../src/CssToInlineStyles.php | 235 + vendor/vlucas/phpdotenv/LICENSE.txt | 32 + vendor/vlucas/phpdotenv/composer.json | 29 + vendor/vlucas/phpdotenv/src/Dotenv.php | 130 + .../src/Exception/ExceptionInterface.php | 11 + .../Exception/InvalidCallbackException.php | 13 + .../src/Exception/InvalidFileException.php | 13 + .../src/Exception/InvalidPathException.php | 13 + .../src/Exception/ValidationException.php | 13 + vendor/vlucas/phpdotenv/src/Loader.php | 418 + vendor/vlucas/phpdotenv/src/Validator.php | 149 + vendor/vyuldashev/nova-permission/README.md | 84 + .../vyuldashev/nova-permission/composer.json | 31 + .../resources/lang/ar/navigation.php | 5 + .../resources/lang/ar/permissions.php | 8 + .../resources/lang/ar/resources.php | 8 + .../resources/lang/ar/roles.php | 8 + .../resources/lang/de/navigation.php | 5 + .../resources/lang/de/permissions.php | 8 + .../resources/lang/de/resources.php | 8 + .../resources/lang/de/roles.php | 8 + .../resources/lang/en/navigation.php | 5 + .../resources/lang/en/permissions.php | 9 + .../resources/lang/en/resources.php | 8 + .../resources/lang/en/roles.php | 8 + .../resources/lang/es/navigation.php | 5 + .../resources/lang/es/permissions.php | 9 + .../resources/lang/es/resources.php | 8 + .../resources/lang/es/roles.php | 8 + .../resources/lang/pt-BR/navigation.php | 5 + .../resources/lang/pt-BR/permissions.php | 9 + .../resources/lang/pt-BR/resources.php | 8 + .../resources/lang/pt-BR/roles.php | 8 + .../resources/views/navigation.blade.php | 41 + .../src/ForgetCachedPermissions.php | 37 + .../src/NovaPermissionTool.php | 49 + .../nova-permission/src/Permission.php | 146 + .../nova-permission/src/PermissionPolicy.php | 47 + .../vyuldashev/nova-permission/src/Role.php | 140 + .../nova-permission/src/RolePolicy.php | 47 + .../src/ToolServiceProvider.php | 61 + vendor/webmozart/assert/CHANGELOG.md | 76 + vendor/webmozart/assert/LICENSE | 20 + vendor/webmozart/assert/README.md | 258 + vendor/webmozart/assert/composer.json | 39 + vendor/webmozart/assert/src/Assert.php | 1187 + .../zend-diactoros/.coveralls.yml | 2 + .../zendframework/zend-diactoros/CHANGELOG.md | 1287 + .../zendframework/zend-diactoros/CONDUCT.md | 43 + .../zend-diactoros/CONTRIBUTING.md | 228 + .../zendframework/zend-diactoros/LICENSE.md | 12 + vendor/zendframework/zend-diactoros/README.md | 34 + .../zend-diactoros/composer.json | 74 + .../zend-diactoros/composer.lock | 1695 ++ .../zendframework/zend-diactoros/mkdocs.yml | 16 + .../zend-diactoros/src/AbstractSerializer.php | 160 + .../zend-diactoros/src/CallbackStream.php | 185 + .../Exception/DeprecatedMethodException.php | 19 + .../src/Exception/ExceptionInterface.php | 17 + .../zend-diactoros/src/HeaderSecurity.php | 177 + .../zend-diactoros/src/MessageTrait.php | 413 + .../zend-diactoros/src/PhpInputStream.php | 91 + .../zend-diactoros/src/RelativeStream.php | 180 + .../zend-diactoros/src/Request.php | 73 + .../src/Request/ArraySerializer.php | 87 + .../zend-diactoros/src/Request/Serializer.php | 154 + .../zend-diactoros/src/RequestTrait.php | 324 + .../zend-diactoros/src/Response.php | 198 + .../src/Response/ArraySerializer.php | 86 + .../src/Response/EmitterInterface.php | 34 + .../src/Response/EmptyResponse.php | 42 + .../src/Response/HtmlResponse.php | 80 + .../src/Response/InjectContentTypeTrait.php | 37 + .../src/Response/JsonResponse.php | 198 + .../src/Response/RedirectResponse.php | 52 + .../src/Response/SapiEmitter.php | 46 + .../src/Response/SapiEmitterTrait.php | 112 + .../src/Response/SapiStreamEmitter.php | 134 + .../src/Response/Serializer.php | 111 + .../src/Response/TextResponse.php | 80 + .../src/Response/XmlResponse.php | 80 + .../zend-diactoros/src/Server.php | 185 + .../zend-diactoros/src/ServerRequest.php | 291 + .../src/ServerRequestFactory.php | 240 + .../zend-diactoros/src/Stream.php | 359 + .../zend-diactoros/src/UploadedFile.php | 283 + .../zendframework/zend-diactoros/src/Uri.php | 706 + .../src/functions/create_uploaded_file.php | 40 + .../functions/marshal_headers_from_sapi.php | 50 + .../functions/marshal_method_from_sapi.php | 19 + .../marshal_protocol_version_from_sapi.php | 36 + .../src/functions/marshal_uri_from_sapi.php | 212 + .../src/functions/normalize_server.php | 51 + .../functions/normalize_uploaded_files.php | 129 + .../src/functions/parse_cookie_header.php | 41 + 6685 files changed, 769395 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 config/multitenancy.php create mode 100644 migrations/2018_11_20_010634_create_tenants_table.php create mode 100644 phpunit.xml create mode 100644 src/Contracts/Tenant.php create mode 100644 src/Exceptions/TenantDoesNotExist.php create mode 100644 src/Exceptions/UnauthorizedException.php create mode 100644 src/Middlewares/TenantMiddleware.php create mode 100644 src/Models/Tenant.php create mode 100644 src/Multitenancy.php create mode 100644 src/MultitenancyFacade.php create mode 100644 src/MultitenancyServiceProvider.php create mode 100644 src/Traits/BelongsToTenant.php create mode 100644 src/Traits/HasTenants.php create mode 100644 tests/Databases/MigrateDatabaseTest.php create mode 100644 tests/Feature/BelongsToTenantTest.php create mode 100644 tests/Feature/MiddlewareTest.php create mode 100644 tests/Feature/TenantTest.php create mode 100644 tests/Product.php create mode 100644 tests/Stubs/Controllers/ProductController.php create mode 100644 tests/TestCase.php create mode 100644 tests/User.php create mode 100644 vendor/autoload.php create mode 120000 vendor/bin/phpunit create mode 120000 vendor/bin/var-dump-server create mode 100644 vendor/codedungeon/phpunit-result-printer/.styleci.yml create mode 100644 vendor/codedungeon/phpunit-result-printer/.travis.yml create mode 100755 vendor/codedungeon/phpunit-result-printer/LICENSE create mode 100755 vendor/codedungeon/phpunit-result-printer/README.md create mode 100755 vendor/codedungeon/phpunit-result-printer/composer.json create mode 100644 vendor/codedungeon/phpunit-result-printer/phpunit-printer.yml create mode 100644 vendor/codedungeon/phpunit-result-printer/phpunit.ci.xml create mode 100755 vendor/codedungeon/phpunit-result-printer/phpunit.xml create mode 100644 vendor/codedungeon/phpunit-result-printer/src/Colors.php create mode 100755 vendor/codedungeon/phpunit-result-printer/src/Exception/InvalidArgumentException.php create mode 100755 vendor/codedungeon/phpunit-result-printer/src/Printer.php create mode 100644 vendor/composer/ClassLoader.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/doctrine/inflector/LICENSE create mode 100644 vendor/doctrine/inflector/README.md create mode 100644 vendor/doctrine/inflector/composer.json create mode 100644 vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php create mode 100644 vendor/doctrine/instantiator/CONTRIBUTING.md create mode 100644 vendor/doctrine/instantiator/LICENSE create mode 100644 vendor/doctrine/instantiator/README.md create mode 100644 vendor/doctrine/instantiator/composer.json create mode 100644 vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php create mode 100644 vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/InvalidArgumentException.php create mode 100644 vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php create mode 100644 vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php create mode 100644 vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php create mode 100644 vendor/doctrine/lexer/LICENSE create mode 100644 vendor/doctrine/lexer/README.md create mode 100644 vendor/doctrine/lexer/composer.json create mode 100644 vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php create mode 100644 vendor/dragonmantank/cron-expression/.editorconfig create mode 100644 vendor/dragonmantank/cron-expression/CHANGELOG.md create mode 100644 vendor/dragonmantank/cron-expression/LICENSE create mode 100644 vendor/dragonmantank/cron-expression/README.md create mode 100644 vendor/dragonmantank/cron-expression/composer.json create mode 100644 vendor/dragonmantank/cron-expression/src/Cron/AbstractField.php create mode 100644 vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php create mode 100644 vendor/dragonmantank/cron-expression/src/Cron/DayOfMonthField.php create mode 100644 vendor/dragonmantank/cron-expression/src/Cron/DayOfWeekField.php create mode 100644 vendor/dragonmantank/cron-expression/src/Cron/FieldFactory.php create mode 100644 vendor/dragonmantank/cron-expression/src/Cron/FieldInterface.php create mode 100644 vendor/dragonmantank/cron-expression/src/Cron/HoursField.php create mode 100644 vendor/dragonmantank/cron-expression/src/Cron/MinutesField.php create mode 100644 vendor/dragonmantank/cron-expression/src/Cron/MonthField.php create mode 100644 vendor/dragonmantank/cron-expression/tests/Cron/AbstractFieldTest.php create mode 100644 vendor/dragonmantank/cron-expression/tests/Cron/CronExpressionTest.php create mode 100644 vendor/dragonmantank/cron-expression/tests/Cron/DayOfMonthFieldTest.php create mode 100644 vendor/dragonmantank/cron-expression/tests/Cron/DayOfWeekFieldTest.php create mode 100644 vendor/dragonmantank/cron-expression/tests/Cron/FieldFactoryTest.php create mode 100644 vendor/dragonmantank/cron-expression/tests/Cron/HoursFieldTest.php create mode 100644 vendor/dragonmantank/cron-expression/tests/Cron/MinutesFieldTest.php create mode 100644 vendor/dragonmantank/cron-expression/tests/Cron/MonthFieldTest.php create mode 100644 vendor/egulias/email-validator/EmailValidator/EmailLexer.php create mode 100644 vendor/egulias/email-validator/EmailValidator/EmailParser.php create mode 100644 vendor/egulias/email-validator/EmailValidator/EmailValidator.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/AtextAfterCFWS.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/CRLFAtTheEnd.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/CRLFX2.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/CRNoLF.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/CharNotAllowed.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/CommaInDomain.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/ConsecutiveAt.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/ConsecutiveDot.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/DomainHyphened.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/DotAtEnd.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/DotAtStart.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/ExpectingAT.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/ExpectingATEXT.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/ExpectingCTEXT.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/ExpectingDTEXT.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/ExpectingDomainLiteralClose.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/ExpectingQPair.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/InvalidEmail.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/NoDNSRecord.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/NoDomainPart.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/NoLocalPart.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/UnclosedComment.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/UnclosedQuotedString.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Exception/UnopenedComment.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Parser/DomainPart.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Parser/LocalPart.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Parser/Parser.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Validation/EmailValidation.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Validation/Error/RFCWarnings.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Validation/Error/SpoofEmail.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Validation/Exception/EmptyValidationList.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Validation/MultipleErrors.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Validation/RFCValidation.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/AddressLiteral.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/CFWSNearAt.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/CFWSWithFWS.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/Comment.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/DeprecatedComment.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/DomainLiteral.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/DomainTooLong.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/EmailTooLong.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/IPV6BadChar.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonEnd.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonStart.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/IPV6Deprecated.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/IPV6DoubleColon.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/IPV6GroupCount.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/IPV6MaxGroups.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/LabelTooLong.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/LocalTooLong.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/NoDNSMXRecord.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/ObsoleteDTEXT.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/QuotedPart.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/QuotedString.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/TLD.php create mode 100644 vendor/egulias/email-validator/EmailValidator/Warning/Warning.php create mode 100644 vendor/egulias/email-validator/LICENSE create mode 100644 vendor/egulias/email-validator/README.md create mode 100644 vendor/egulias/email-validator/composer.json create mode 100644 vendor/egulias/email-validator/phpunit.xml.dist create mode 100644 vendor/erusev/parsedown/LICENSE.txt create mode 100644 vendor/erusev/parsedown/Parsedown.php create mode 100644 vendor/erusev/parsedown/README.md create mode 100644 vendor/erusev/parsedown/composer.json create mode 100644 vendor/fzaninotto/faker/.gitignore create mode 100644 vendor/fzaninotto/faker/.travis.yml create mode 100644 vendor/fzaninotto/faker/CHANGELOG.md create mode 100644 vendor/fzaninotto/faker/CONTRIBUTING.md create mode 100644 vendor/fzaninotto/faker/LICENSE create mode 100644 vendor/fzaninotto/faker/Makefile create mode 100644 vendor/fzaninotto/faker/composer.json create mode 100644 vendor/fzaninotto/faker/phpunit.xml.dist create mode 100644 vendor/fzaninotto/faker/readme.md create mode 100644 vendor/fzaninotto/faker/src/Faker/Calculator/Iban.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Calculator/Inn.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Calculator/Luhn.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Calculator/TCNo.php create mode 100644 vendor/fzaninotto/faker/src/Faker/DefaultGenerator.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Documentor.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Factory.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Generator.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Guesser/Name.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/ColumnTypeGuesser.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/EntityPopulator.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/Populator.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/EntityPopulator.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/Populator.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/Mandango/ColumnTypeGuesser.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/Mandango/EntityPopulator.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/Mandango/Populator.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/Propel/ColumnTypeGuesser.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/Propel/EntityPopulator.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/Propel/Populator.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/Propel2/ColumnTypeGuesser.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/Propel2/EntityPopulator.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/Propel2/Populator.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/Spot/ColumnTypeGuesser.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/Spot/EntityPopulator.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ORM/Spot/Populator.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/Barcode.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/Base.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/Biased.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/Color.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/DateTime.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/File.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/HtmlLorem.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/Image.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/Lorem.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/Miscellaneous.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/UserAgent.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/Uuid.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ar_SA/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ar_SA/Color.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ar_SA/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ar_SA/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ar_SA/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ar_SA/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ar_SA/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/at_AT/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/bg_BG/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/bg_BG/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/bg_BG/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/bg_BG/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/bn_BD/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/bn_BD/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/bn_BD/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/bn_BD/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/bn_BD/Utils.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/DateTime.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/da_DK/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_AT/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_AT/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_AT/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_AT/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_AT/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_AT/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_AT/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_CH/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_CH/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_CH/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_CH/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_CH/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_CH/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_CH/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_DE/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_DE/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_DE/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_DE/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_DE/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_DE/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/de_DE/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/el_CY/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/el_CY/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/el_CY/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/el_CY/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/el_CY/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/el_CY/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/el_GR/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/el_GR/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/el_GR/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/el_GR/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/el_GR/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/el_GR/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_AU/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_AU/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_AU/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_CA/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_CA/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_GB/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_GB/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_GB/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_GB/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_GB/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_HK/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_HK/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_HK/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_IN/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_IN/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_IN/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_IN/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_NG/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_NG/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_NG/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_NG/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_NZ/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_NZ/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_NZ/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_PH/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_PH/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_SG/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_SG/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_UG/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_UG/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_UG/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_UG/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_US/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_US/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_US/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_US/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_US/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_US/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_AR/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_AR/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_AR/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_AR/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_ES/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_ES/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_ES/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_ES/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_ES/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_ES/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_ES/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_PE/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_PE/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_PE/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_PE/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_VE/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_VE/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_VE/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_VE/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/es_VE/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_BE/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_BE/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_BE/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_BE/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_BE/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_BE/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_CA/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_CA/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_CA/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_CH/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_CH/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_CH/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_CH/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_CH/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_CH/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_CH/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/he_IL/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/he_IL/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/he_IL/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/he_IL/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/he_IL/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hr_HR/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hr_HR/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hr_HR/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hr_HR/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hr_HR/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hu_HU/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hu_HU/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hu_HU/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hu_HU/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hu_HU/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hu_HU/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hy_AM/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hy_AM/Color.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hy_AM/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hy_AM/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hy_AM/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/hy_AM/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/id_ID/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/is_IS/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/it_CH/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/it_IT/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/it_IT/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/it_IT/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/it_IT/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/it_IT/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/it_IT/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/it_IT/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/Color.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/DateTime.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/Color.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/Color.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/me_ME/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/me_ME/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/me_ME/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/me_ME/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/me_ME/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/mn_MN/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/mn_MN/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Miscellaneous.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ne_NP/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ne_NP/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ne_NP/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ne_NP/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nl_BE/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nl_BE/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nl_BE/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nl_BE/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nl_BE/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nl_BE/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nl_BE/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nl_NL/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nl_NL/Color.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nl_NL/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nl_NL/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nl_NL/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nl_NL/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nl_NL/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/nl_NL/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/check_digit.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ro_MD/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ro_MD/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ro_MD/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ro_MD/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ro_MD/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Color.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sk_SK/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sk_SK/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sk_SK/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sk_SK/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sk_SK/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sk_SK/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sl_SI/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sl_SI/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sl_SI/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sl_SI/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sl_SI/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sl_SI/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sr_Cyrl_RS/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sr_Cyrl_RS/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sr_Cyrl_RS/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sr_Latn_RS/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sr_Latn_RS/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sr_Latn_RS/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sr_RS/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sr_RS/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sr_RS/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sv_SE/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sv_SE/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sv_SE/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sv_SE/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/sv_SE/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/th_TH/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/th_TH/Color.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/th_TH/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/th_TH/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/th_TH/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/th_TH/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/tr_TR/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/tr_TR/Color.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/tr_TR/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/tr_TR/DateTime.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/tr_TR/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/tr_TR/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/tr_TR/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/tr_TR/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Color.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/Color.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Color.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/DateTime.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Address.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Color.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Company.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/DateTime.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Internet.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Payment.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Person.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/PhoneNumber.php create mode 100644 vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Text.php create mode 100644 vendor/fzaninotto/faker/src/Faker/UniqueGenerator.php create mode 100644 vendor/fzaninotto/faker/src/Faker/ValidGenerator.php create mode 100644 vendor/fzaninotto/faker/src/autoload.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Calculator/IbanTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Calculator/InnTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Calculator/LuhnTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Calculator/TCNoTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/DefaultGeneratorTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/GeneratorTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/BarcodeTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/BaseTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/BiasedTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/ColorTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/CompanyTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/DateTimeTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/HtmlLoremTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/ImageTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/InternetTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/LocalizationTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/LoremTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/MiscellaneousTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/PaymentTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/ProviderOverrideTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/TextTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/UserAgentTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/UuidTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/ar_JO/InternetTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/ar_SA/InternetTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/at_AT/PaymentTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/bg_BG/PaymentTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/bn_BD/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/cs_CZ/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/da_DK/InternetTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/de_AT/InternetTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/de_AT/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/de_CH/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/de_CH/InternetTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/de_CH/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/de_DE/InternetTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/el_GR/TextTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_AU/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_CA/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_GB/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_IN/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_NG/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_NG/InternetTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_NG/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_NG/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_NZ/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_PH/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_SG/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_SG/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_UG/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_US/CompanyTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_US/PaymentTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_US/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_US/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/CompanyTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/InternetTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/es_ES/PaymentTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/es_ES/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/es_ES/TextTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/es_PE/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/es_VE/CompanyTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/es_VE/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/fi_FI/InternetTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/fi_FI/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/fr_BE/PaymentTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/InternetTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/CompanyTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PaymentTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/TextTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/id_ID/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/it_CH/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/it_CH/InternetTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/it_CH/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/it_IT/CompanyTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/it_IT/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/InternetTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/ka_GE/TextTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/CompanyTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/TextTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/ko_KR/TextTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/mn_MN/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/ms_MY/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/nl_BE/PaymentTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/nl_BE/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/nl_NL/CompanyTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/nl_NL/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/pl_PL/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/pl_PL/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/pt_BR/CompanyTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/pt_BR/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/ro_RO/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/ro_RO/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/ru_RU/CompanyTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/ru_RU/TextTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/sv_SE/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/CompanyTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PaymentTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/AddressTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/PhoneNumberTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/CompanyTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/PersonTest.php create mode 100644 vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/TextTest.php create mode 100644 vendor/fzaninotto/faker/test/documentor.php create mode 100644 vendor/fzaninotto/faker/test/test.php create mode 100644 vendor/guzzlehttp/guzzle/CHANGELOG.md create mode 100644 vendor/guzzlehttp/guzzle/LICENSE create mode 100644 vendor/guzzlehttp/guzzle/README.md create mode 100644 vendor/guzzlehttp/guzzle/UPGRADING.md create mode 100644 vendor/guzzlehttp/guzzle/composer.json create mode 100644 vendor/guzzlehttp/guzzle/src/Client.php create mode 100644 vendor/guzzlehttp/guzzle/src/ClientInterface.php create mode 100644 vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php create mode 100644 vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php create mode 100644 vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php create mode 100644 vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php create mode 100644 vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/ClientException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/RequestException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/SeekException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/ServerException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/TransferException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/Proxy.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php create mode 100644 vendor/guzzlehttp/guzzle/src/HandlerStack.php create mode 100644 vendor/guzzlehttp/guzzle/src/MessageFormatter.php create mode 100644 vendor/guzzlehttp/guzzle/src/Middleware.php create mode 100644 vendor/guzzlehttp/guzzle/src/Pool.php create mode 100644 vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php create mode 100644 vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php create mode 100644 vendor/guzzlehttp/guzzle/src/RequestOptions.php create mode 100644 vendor/guzzlehttp/guzzle/src/RetryMiddleware.php create mode 100644 vendor/guzzlehttp/guzzle/src/TransferStats.php create mode 100644 vendor/guzzlehttp/guzzle/src/UriTemplate.php create mode 100644 vendor/guzzlehttp/guzzle/src/functions.php create mode 100644 vendor/guzzlehttp/guzzle/src/functions_include.php create mode 100644 vendor/guzzlehttp/promises/CHANGELOG.md create mode 100644 vendor/guzzlehttp/promises/LICENSE create mode 100644 vendor/guzzlehttp/promises/Makefile create mode 100644 vendor/guzzlehttp/promises/README.md create mode 100644 vendor/guzzlehttp/promises/composer.json create mode 100644 vendor/guzzlehttp/promises/src/AggregateException.php create mode 100644 vendor/guzzlehttp/promises/src/CancellationException.php create mode 100644 vendor/guzzlehttp/promises/src/Coroutine.php create mode 100644 vendor/guzzlehttp/promises/src/EachPromise.php create mode 100644 vendor/guzzlehttp/promises/src/FulfilledPromise.php create mode 100644 vendor/guzzlehttp/promises/src/Promise.php create mode 100644 vendor/guzzlehttp/promises/src/PromiseInterface.php create mode 100644 vendor/guzzlehttp/promises/src/PromisorInterface.php create mode 100644 vendor/guzzlehttp/promises/src/RejectedPromise.php create mode 100644 vendor/guzzlehttp/promises/src/RejectionException.php create mode 100644 vendor/guzzlehttp/promises/src/TaskQueue.php create mode 100644 vendor/guzzlehttp/promises/src/TaskQueueInterface.php create mode 100644 vendor/guzzlehttp/promises/src/functions.php create mode 100644 vendor/guzzlehttp/promises/src/functions_include.php create mode 100644 vendor/guzzlehttp/psr7/.editorconfig create mode 100644 vendor/guzzlehttp/psr7/CHANGELOG.md create mode 100644 vendor/guzzlehttp/psr7/LICENSE create mode 100644 vendor/guzzlehttp/psr7/README.md create mode 100644 vendor/guzzlehttp/psr7/composer.json create mode 100644 vendor/guzzlehttp/psr7/src/AppendStream.php create mode 100644 vendor/guzzlehttp/psr7/src/BufferStream.php create mode 100644 vendor/guzzlehttp/psr7/src/CachingStream.php create mode 100644 vendor/guzzlehttp/psr7/src/DroppingStream.php create mode 100644 vendor/guzzlehttp/psr7/src/FnStream.php create mode 100644 vendor/guzzlehttp/psr7/src/InflateStream.php create mode 100644 vendor/guzzlehttp/psr7/src/LazyOpenStream.php create mode 100644 vendor/guzzlehttp/psr7/src/LimitStream.php create mode 100644 vendor/guzzlehttp/psr7/src/MessageTrait.php create mode 100644 vendor/guzzlehttp/psr7/src/MultipartStream.php create mode 100644 vendor/guzzlehttp/psr7/src/NoSeekStream.php create mode 100644 vendor/guzzlehttp/psr7/src/PumpStream.php create mode 100644 vendor/guzzlehttp/psr7/src/Request.php create mode 100644 vendor/guzzlehttp/psr7/src/Response.php create mode 100644 vendor/guzzlehttp/psr7/src/Rfc7230.php create mode 100644 vendor/guzzlehttp/psr7/src/ServerRequest.php create mode 100644 vendor/guzzlehttp/psr7/src/Stream.php create mode 100644 vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php create mode 100644 vendor/guzzlehttp/psr7/src/StreamWrapper.php create mode 100644 vendor/guzzlehttp/psr7/src/UploadedFile.php create mode 100644 vendor/guzzlehttp/psr7/src/Uri.php create mode 100644 vendor/guzzlehttp/psr7/src/UriNormalizer.php create mode 100644 vendor/guzzlehttp/psr7/src/UriResolver.php create mode 100644 vendor/guzzlehttp/psr7/src/functions.php create mode 100644 vendor/guzzlehttp/psr7/src/functions_include.php create mode 100644 vendor/hamcrest/hamcrest-php/.coveralls.yml create mode 100644 vendor/hamcrest/hamcrest-php/.gitignore create mode 100644 vendor/hamcrest/hamcrest-php/.gush.yml create mode 100644 vendor/hamcrest/hamcrest-php/.travis.yml create mode 100644 vendor/hamcrest/hamcrest-php/CHANGES.txt create mode 100644 vendor/hamcrest/hamcrest-php/LICENSE.txt create mode 100644 vendor/hamcrest/hamcrest-php/README.md create mode 100644 vendor/hamcrest/hamcrest-php/TODO.txt create mode 100644 vendor/hamcrest/hamcrest-php/composer.json create mode 100644 vendor/hamcrest/hamcrest-php/composer.lock create mode 100644 vendor/hamcrest/hamcrest-php/generator/FactoryCall.php create mode 100644 vendor/hamcrest/hamcrest-php/generator/FactoryClass.php create mode 100644 vendor/hamcrest/hamcrest-php/generator/FactoryFile.php create mode 100644 vendor/hamcrest/hamcrest-php/generator/FactoryGenerator.php create mode 100644 vendor/hamcrest/hamcrest-php/generator/FactoryMethod.php create mode 100644 vendor/hamcrest/hamcrest-php/generator/FactoryParameter.php create mode 100644 vendor/hamcrest/hamcrest-php/generator/GlobalFunctionFile.php create mode 100644 vendor/hamcrest/hamcrest-php/generator/StaticMethodFile.php create mode 100644 vendor/hamcrest/hamcrest-php/generator/parts/file_header.txt create mode 100644 vendor/hamcrest/hamcrest-php/generator/parts/functions_footer.txt create mode 100644 vendor/hamcrest/hamcrest-php/generator/parts/functions_header.txt create mode 100644 vendor/hamcrest/hamcrest-php/generator/parts/functions_imports.txt create mode 100644 vendor/hamcrest/hamcrest-php/generator/parts/matchers_footer.txt create mode 100644 vendor/hamcrest/hamcrest-php/generator/parts/matchers_header.txt create mode 100644 vendor/hamcrest/hamcrest-php/generator/parts/matchers_imports.txt create mode 100644 vendor/hamcrest/hamcrest-php/generator/run.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArray.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContaining.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInOrder.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKey.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKeyValuePair.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayWithSize.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/MatchingOnce.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/AssertionError.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseDescription.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseMatcher.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsEmptyTraversable.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsTraversableWithSize.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AllOf.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AnyOf.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/CombinableMatcher.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/DescribedAs.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Every.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/HasToString.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Is.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsAnything.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsCollectionContaining.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsEqual.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsIdentical.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsInstanceOf.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNot.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNull.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsSame.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsTypeOf.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Set.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/ShortcutCombination.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Description.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/DiagnosingMatcher.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/FeatureMatcher.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Internal/SelfDescribingValue.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matcher.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/MatcherAssert.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matchers.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/NullDescription.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/IsCloseTo.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/OrderingComparison.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/SelfDescribing.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/StringDescription.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEmptyString.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/MatchesPattern.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContains.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsInOrder.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringEndsWith.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringStartsWith.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/SubstringMatcher.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsArray.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsBoolean.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsCallable.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsDouble.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsInteger.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsNumeric.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsObject.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsResource.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsScalar.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsString.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeDiagnosingMatcher.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeMatcher.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Util.php create mode 100644 vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml/HasXPath.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/AbstractMatcherTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingInAnyOrderTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingInOrderTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingKeyTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingKeyValuePairTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayWithSizeTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/BaseMatcherTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Collection/IsEmptyTraversableTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Collection/IsTraversableWithSizeTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AllOfTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AnyOfTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/CombinableMatcherTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/DescribedAsTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/EveryTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/HasToStringTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsAnythingTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsCollectionContainingTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsEqualTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsIdenticalTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsInstanceOfTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsNotTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsNullTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsSameTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsTypeOfTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/SampleBaseClass.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/SampleSubClass.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/SetTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/FeatureMatcherTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/MatcherAssertTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Number/IsCloseToTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Number/OrderingComparisonTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/StringDescriptionTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEmptyStringTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEqualIgnoringCaseTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/MatchesPatternTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsInOrderTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringEndsWithTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringStartsWithTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsArrayTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsBooleanTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsCallableTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsDoubleTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsIntegerTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsNumericTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsObjectTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsResourceTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsScalarTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsStringTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/UtilTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/Hamcrest/Xml/HasXPathTest.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/bootstrap.php create mode 100644 vendor/hamcrest/hamcrest-php/tests/phpunit.xml.dist create mode 100644 vendor/hassankhan/config/.scrutinizer.yml create mode 100644 vendor/hassankhan/config/CHANGELOG.md create mode 100644 vendor/hassankhan/config/CONTRIBUTING.md create mode 100644 vendor/hassankhan/config/LICENSE.md create mode 100644 vendor/hassankhan/config/composer.json create mode 100644 vendor/hassankhan/config/src/AbstractConfig.php create mode 100644 vendor/hassankhan/config/src/Config.php create mode 100644 vendor/hassankhan/config/src/ConfigInterface.php create mode 100644 vendor/hassankhan/config/src/ErrorException.php create mode 100644 vendor/hassankhan/config/src/Exception.php create mode 100644 vendor/hassankhan/config/src/Exception/EmptyDirectoryException.php create mode 100644 vendor/hassankhan/config/src/Exception/FileNotFoundException.php create mode 100644 vendor/hassankhan/config/src/Exception/ParseException.php create mode 100644 vendor/hassankhan/config/src/Exception/UnsupportedFormatException.php create mode 100644 vendor/hassankhan/config/src/FileParser/AbstractFileParser.php create mode 100644 vendor/hassankhan/config/src/FileParser/FileParserInterface.php create mode 100644 vendor/hassankhan/config/src/FileParser/Ini.php create mode 100644 vendor/hassankhan/config/src/FileParser/Json.php create mode 100644 vendor/hassankhan/config/src/FileParser/Php.php create mode 100644 vendor/hassankhan/config/src/FileParser/Xml.php create mode 100644 vendor/hassankhan/config/src/FileParser/Yaml.php create mode 100644 vendor/laravel/framework/LICENSE.md create mode 100644 vendor/laravel/framework/README.md create mode 100644 vendor/laravel/framework/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Access/AuthorizationException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Access/Response.php create mode 100755 vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php create mode 100755 vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Authenticatable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/AuthenticationException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Console/AuthMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Console/ClearResetsCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/controllers/HomeController.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/routes.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/login.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/passwords/email.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/passwords/reset.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/register.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/verify.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/home.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/layouts/app.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/CreatesUserProviders.php create mode 100755 vendor/laravel/framework/src/Illuminate/Auth/DatabaseUserProvider.php create mode 100755 vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Events/Attempting.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Events/Authenticated.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Events/Failed.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Events/Lockout.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Events/Login.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Events/Logout.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Events/PasswordReset.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Events/Registered.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Events/Verified.php create mode 100755 vendor/laravel/framework/src/Illuminate/Auth/GenericUser.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/GuardHelpers.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Listeners/SendEmailVerificationNotification.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authorize.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/MustVerifyEmail.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Notifications/ResetPassword.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Notifications/VerifyEmail.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Passwords/CanResetPassword.php create mode 100755 vendor/laravel/framework/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php create mode 100755 vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBroker.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php create mode 100755 vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php create mode 100755 vendor/laravel/framework/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/Recaller.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/RequestGuard.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/TokenGuard.php create mode 100644 vendor/laravel/framework/src/Illuminate/Auth/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastController.php create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/NullBroadcaster.php create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/Channel.php create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/InteractsWithSockets.php create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/PendingBroadcast.php create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/PresenceChannel.php create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/PrivateChannel.php create mode 100644 vendor/laravel/framework/src/Illuminate/Broadcasting/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Bus/BusServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php create mode 100644 vendor/laravel/framework/src/Illuminate/Bus/Queueable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Bus/composer.json create mode 100755 vendor/laravel/framework/src/Illuminate/Cache/ApcStore.php create mode 100755 vendor/laravel/framework/src/Illuminate/Cache/ApcWrapper.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/ArrayStore.php create mode 100755 vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php create mode 100755 vendor/laravel/framework/src/Illuminate/Cache/CacheServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/Console/CacheTableCommand.php create mode 100755 vendor/laravel/framework/src/Illuminate/Cache/Console/ClearCommand.php create mode 100755 vendor/laravel/framework/src/Illuminate/Cache/Console/ForgetCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/Console/stubs/cache.stub create mode 100755 vendor/laravel/framework/src/Illuminate/Cache/DatabaseStore.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/Events/CacheEvent.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/Events/CacheHit.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/Events/CacheMissed.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/Events/KeyForgotten.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/Events/KeyWritten.php create mode 100755 vendor/laravel/framework/src/Illuminate/Cache/FileStore.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/Lock.php create mode 100755 vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/MemcachedLock.php create mode 100755 vendor/laravel/framework/src/Illuminate/Cache/MemcachedStore.php create mode 100755 vendor/laravel/framework/src/Illuminate/Cache/NullStore.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/RateLimiter.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/RedisLock.php create mode 100755 vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php create mode 100755 vendor/laravel/framework/src/Illuminate/Cache/Repository.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/RetrievesMultipleKeys.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/TagSet.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/TaggableStore.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cache/TaggedCache.php create mode 100755 vendor/laravel/framework/src/Illuminate/Cache/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Config/Repository.php create mode 100755 vendor/laravel/framework/src/Illuminate/Config/composer.json create mode 100755 vendor/laravel/framework/src/Illuminate/Console/Application.php create mode 100755 vendor/laravel/framework/src/Illuminate/Console/Command.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/DetectsApplicationNamespace.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/Events/ArtisanStarting.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/Events/CommandFinished.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/Events/CommandStarting.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/GeneratorCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/OutputStyle.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/Parser.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/Scheduling/CacheEventMutex.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/Scheduling/CommandBuilder.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/Scheduling/EventMutex.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/Scheduling/ManagesFrequencies.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/Scheduling/Schedule.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Console/Scheduling/SchedulingMutex.php create mode 100755 vendor/laravel/framework/src/Illuminate/Console/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php create mode 100755 vendor/laravel/framework/src/Illuminate/Container/Container.php create mode 100644 vendor/laravel/framework/src/Illuminate/Container/ContextualBindingBuilder.php create mode 100644 vendor/laravel/framework/src/Illuminate/Container/EntryNotFoundException.php create mode 100755 vendor/laravel/framework/src/Illuminate/Container/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Auth/Access/Authorizable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Auth/Access/Gate.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Auth/Authenticatable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Auth/CanResetPassword.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Auth/Factory.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Auth/Guard.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Auth/MustVerifyEmail.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Auth/PasswordBroker.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Auth/PasswordBrokerFactory.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Auth/StatefulGuard.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Auth/SupportsBasicAuth.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Auth/UserProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Broadcasting/Broadcaster.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Broadcasting/Factory.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Broadcasting/ShouldBroadcast.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Broadcasting/ShouldBroadcastNow.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Bus/Dispatcher.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Bus/QueueingDispatcher.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Cache/Factory.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Cache/Lock.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Cache/LockProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Cache/LockTimeoutException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Cache/Repository.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Cache/Store.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Config/Repository.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Console/Application.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Console/Kernel.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Container/BindingResolutionException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Container/Container.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Container/ContextualBindingBuilder.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Cookie/Factory.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Cookie/QueueingFactory.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Database/ModelIdentifier.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Debug/ExceptionHandler.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Encryption/DecryptException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Encryption/EncryptException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Encryption/Encrypter.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Events/Dispatcher.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Filesystem/Cloud.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Filesystem/Factory.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Filesystem/FileExistsException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Filesystem/FileNotFoundException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Filesystem/Filesystem.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Foundation/Application.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Hashing/Hasher.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Http/Kernel.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Mail/MailQueue.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Mail/Mailable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Mail/Mailer.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Notifications/Dispatcher.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Notifications/Factory.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Pagination/LengthAwarePaginator.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Pagination/Paginator.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Pipeline/Hub.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Pipeline/Pipeline.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Queue/EntityNotFoundException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Queue/EntityResolver.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Queue/Factory.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Queue/Job.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Queue/Monitor.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Queue/Queue.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Queue/QueueableCollection.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Queue/QueueableEntity.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Queue/ShouldQueue.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Redis/Connection.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Redis/Factory.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Redis/LimiterTimeoutException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Routing/BindingRegistrar.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Routing/Registrar.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Routing/ResponseFactory.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Routing/UrlGenerator.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Routing/UrlRoutable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Session/Session.php create mode 100755 vendor/laravel/framework/src/Illuminate/Contracts/Support/Arrayable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Support/Htmlable.php create mode 100755 vendor/laravel/framework/src/Illuminate/Contracts/Support/Jsonable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Support/MessageBag.php create mode 100755 vendor/laravel/framework/src/Illuminate/Contracts/Support/MessageProvider.php create mode 100755 vendor/laravel/framework/src/Illuminate/Contracts/Support/Renderable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Support/Responsable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Translation/HasLocalePreference.php create mode 100755 vendor/laravel/framework/src/Illuminate/Contracts/Translation/Loader.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Translation/Translator.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Validation/Factory.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Validation/ImplicitRule.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Validation/Rule.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Validation/ValidatesWhenResolved.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/Validation/Validator.php create mode 100755 vendor/laravel/framework/src/Illuminate/Contracts/View/Engine.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/View/Factory.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/View/View.php create mode 100644 vendor/laravel/framework/src/Illuminate/Contracts/composer.json create mode 100755 vendor/laravel/framework/src/Illuminate/Cookie/CookieJar.php create mode 100755 vendor/laravel/framework/src/Illuminate/Cookie/CookieServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php create mode 100644 vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php create mode 100755 vendor/laravel/framework/src/Illuminate/Cookie/composer.json create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Connection.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/ConnectionInterface.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/ConnectionResolver.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/ConnectionResolverInterface.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectorInterface.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Connectors/PostgresConnector.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Connectors/SQLiteConnector.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Connectors/SqlServerConnector.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Console/Factories/FactoryMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Console/Factories/stubs/factory.stub create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/BaseCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/FreshCommand.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/InstallCommand.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RefreshCommand.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RollbackCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/StatusCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/TableGuesser.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/stubs/seeder.stub create mode 100755 vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/DetectsDeadlocks.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/JsonEncodingException.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Eloquent/MassAssignmentException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Eloquent/ModelNotFoundException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/QueueEntityResolver.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Eloquent/RelationNotFoundException.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/SupportsDefaultModels.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasMany.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOne.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphMany.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOne.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphTo.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Pivot.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Relation.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Scope.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletes.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Events/ConnectionEvent.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Events/QueryExecuted.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Events/StatementPrepared.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Events/TransactionBeginning.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Events/TransactionCommitted.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Events/TransactionRolledBack.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Grammar.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Migrations/Migration.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationCreator.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/blank.stub create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/create.stub create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/update.stub create mode 100755 vendor/laravel/framework/src/Illuminate/Database/MySqlConnection.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/PostgresConnection.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Query/Expression.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Query/JoinClause.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Query/JsonExpression.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Query/Processors/MySqlProcessor.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Query/Processors/PostgresProcessor.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/QueryException.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/README.md create mode 100755 vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Schema/ColumnDefinition.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/RenameColumn.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Schema/PostgresBuilder.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Schema/SQLiteBuilder.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/Schema/SqlServerBuilder.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/Seeder.php create mode 100755 vendor/laravel/framework/src/Illuminate/Database/SqlServerConnection.php create mode 100644 vendor/laravel/framework/src/Illuminate/Database/composer.json create mode 100755 vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php create mode 100755 vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Encryption/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Events/CallQueuedListener.php create mode 100755 vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php create mode 100755 vendor/laravel/framework/src/Illuminate/Events/EventServiceProvider.php create mode 100755 vendor/laravel/framework/src/Illuminate/Events/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Filesystem/Cache.php create mode 100644 vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php create mode 100644 vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php create mode 100644 vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php create mode 100644 vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Filesystem/composer.json create mode 100755 vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php create mode 100755 vendor/laravel/framework/src/Illuminate/Foundation/Application.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/Authorizable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUsers.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Auth/SendsPasswordResetEmails.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Auth/ThrottlesLogins.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Auth/User.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Auth/VerifiesEmails.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesJobs.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingChain.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingDispatch.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/AppNameCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/ChannelMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/ClosureCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigClearCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/DownCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/EnvironmentCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/EventGenerateCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/EventMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/ExceptionMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/JobMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/ListenerMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/MailMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/ModelMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/NotificationMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/ObserverMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeClearCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/PolicyMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/PresetCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Bootstrap.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/None.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Preset.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/React.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Vue.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/_variables.scss create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/app.scss create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/app.js create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/bootstrap.js create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/Example.js create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/app.js create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/webpack.mix.js create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/ExampleComponent.vue create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/app.js create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/webpack.mix.js create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/ProviderMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/QueuedCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/ResourceMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteCacheCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteClearCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/RuleMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/TestMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/UpCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewCacheCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewClearCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/channel.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/console.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/event-handler-queued.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/event-handler.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/event.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/exception-render-report.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/exception-render.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/exception-report.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/exception.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/job-queued.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/job.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/listener-duck.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/listener-queued-duck.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/listener-queued.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/listener.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/mail.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown-mail.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown-notification.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/model.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/notification.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/observer.plain.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/observer.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/pivot.model.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/policy.plain.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/policy.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/provider.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/request.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/resource-collection.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/resource.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/routes.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/rule.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/test.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/unit-test.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Events/Dispatchable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Events/LocaleUpdated.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/WhoopsHandler.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/401.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/403.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/404.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/419.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/429.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/500.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/503.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/illustrated-layout.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/layout.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Http/Events/RequestHandled.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Http/Exceptions/MaintenanceModeException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Inspiring.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php create mode 100755 vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php create mode 100755 vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php create mode 100755 vendor/laravel/framework/src/Illuminate/Foundation/Providers/ComposerServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithAuthentication.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithRedis.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithSession.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/HasInDatabase.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/SeeInOrder.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/SoftDeletedInDatabase.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseMigrations.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseTransactions.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/HttpException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/PendingCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabaseState.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithFaker.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutEvents.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutMiddleware.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/helpers.php create mode 100644 vendor/laravel/framework/src/Illuminate/Foundation/stubs/facade.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Hashing/AbstractHasher.php create mode 100644 vendor/laravel/framework/src/Illuminate/Hashing/Argon2IdHasher.php create mode 100644 vendor/laravel/framework/src/Illuminate/Hashing/ArgonHasher.php create mode 100755 vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php create mode 100644 vendor/laravel/framework/src/Illuminate/Hashing/HashManager.php create mode 100755 vendor/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php create mode 100755 vendor/laravel/framework/src/Illuminate/Hashing/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithFlashData.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithInput.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Exceptions/HttpResponseException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Exceptions/PostTooLargeException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Exceptions/ThrottleRequestsException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/File.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/FileHelpers.php create mode 100755 vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Middleware/CheckResponseForModifications.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Middleware/SetCacheHeaders.php create mode 100755 vendor/laravel/framework/src/Illuminate/Http/RedirectResponse.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Request.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Resources/CollectsResources.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Resources/DelegatesToResource.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Resources/Json/AnonymousResourceCollection.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Resources/Json/JsonResource.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Resources/Json/PaginatedResourceResponse.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Resources/Json/Resource.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Resources/Json/ResourceCollection.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Resources/Json/ResourceResponse.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Resources/MergeValue.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Resources/MissingValue.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Resources/PotentiallyMissing.php create mode 100755 vendor/laravel/framework/src/Illuminate/Http/Response.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Testing/File.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Testing/FileFactory.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/Testing/MimeType.php create mode 100644 vendor/laravel/framework/src/Illuminate/Http/UploadedFile.php create mode 100755 vendor/laravel/framework/src/Illuminate/Http/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Log/Events/MessageLogged.php create mode 100644 vendor/laravel/framework/src/Illuminate/Log/LogManager.php create mode 100644 vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php create mode 100755 vendor/laravel/framework/src/Illuminate/Log/Logger.php create mode 100644 vendor/laravel/framework/src/Illuminate/Log/ParsesLogConfiguration.php create mode 100755 vendor/laravel/framework/src/Illuminate/Log/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSending.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSent.php create mode 100755 vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/Mailable.php create mode 100755 vendor/laravel/framework/src/Illuminate/Mail/Mailer.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/Markdown.php create mode 100755 vendor/laravel/framework/src/Illuminate/Mail/Message.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/SendQueuedMailable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/Transport/ArrayTransport.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/Transport/SparkPostTransport.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/Transport/Transport.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php create mode 100755 vendor/laravel/framework/src/Illuminate/Mail/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/button.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/footer.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/header.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/layout.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/message.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/panel.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion/button.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/subcopy.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/table.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/themes/default.css create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/button.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/footer.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/header.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/layout.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/message.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/panel.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/promotion.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/promotion/button.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/subcopy.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/table.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Action.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/AnonymousNotifiable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Channels/BroadcastChannel.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Channels/DatabaseChannel.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Console/NotificationTableCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Console/stubs/notifications.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/DatabaseNotification.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/DatabaseNotificationCollection.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Events/BroadcastNotificationCreated.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationFailed.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationSending.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationSent.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/HasDatabaseNotifications.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Messages/BroadcastMessage.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Messages/DatabaseMessage.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Messages/MailMessage.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Messages/SimpleMessage.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Notifiable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/Notification.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/NotificationServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/RoutesNotifications.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Notifications/resources/views/email.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php create mode 100644 vendor/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php create mode 100755 vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php create mode 100644 vendor/laravel/framework/src/Illuminate/Pagination/UrlWindow.php create mode 100755 vendor/laravel/framework/src/Illuminate/Pagination/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Pagination/resources/views/default.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Pagination/resources/views/semantic-ui.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Pagination/resources/views/simple-bootstrap-4.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Pagination/resources/views/simple-default.blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Pipeline/Hub.php create mode 100644 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php create mode 100644 vendor/laravel/framework/src/Illuminate/Pipeline/PipelineServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Pipeline/composer.json create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/CallQueuedClosure.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Capsule/Manager.php create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/Connectors/ConnectorInterface.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Connectors/DatabaseConnector.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Connectors/NullConnector.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Connectors/RedisConnector.php create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/Connectors/SyncConnector.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Console/FailedTableCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Console/FlushFailedCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Console/ForgetFailedCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Console/ListFailedCommand.php create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/Console/ListenCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Console/RestartCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Console/RetryCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Console/TableCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/failed_jobs.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/jobs.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Events/JobExceptionOccurred.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Events/JobFailed.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Events/JobProcessed.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Events/JobProcessing.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Events/Looping.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Events/WorkerStopping.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Failed/NullFailedJobProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/FailingJob.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/InteractsWithQueue.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/InvalidPayloadException.php create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/Jobs/BeanstalkdJob.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJob.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJobRecord.php create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Jobs/JobName.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Jobs/RedisJob.php create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/Jobs/SqsJob.php create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/Jobs/SyncJob.php create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/Listener.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/ListenerOptions.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/LuaScripts.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/ManuallyFailedException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/MaxAttemptsExceededException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/NullQueue.php create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/Queue.php create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/QueueServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/README.md create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/SerializableClosure.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/SqsQueue.php create mode 100755 vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/Worker.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/WorkerOptions.php create mode 100644 vendor/laravel/framework/src/Illuminate/Queue/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php create mode 100644 vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisClusterConnection.php create mode 100644 vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisConnection.php create mode 100644 vendor/laravel/framework/src/Illuminate/Redis/Connections/PredisClusterConnection.php create mode 100644 vendor/laravel/framework/src/Illuminate/Redis/Connections/PredisConnection.php create mode 100644 vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php create mode 100644 vendor/laravel/framework/src/Illuminate/Redis/Connectors/PredisConnector.php create mode 100644 vendor/laravel/framework/src/Illuminate/Redis/Events/CommandExecuted.php create mode 100644 vendor/laravel/framework/src/Illuminate/Redis/Limiters/ConcurrencyLimiter.php create mode 100644 vendor/laravel/framework/src/Illuminate/Redis/Limiters/ConcurrencyLimiterBuilder.php create mode 100644 vendor/laravel/framework/src/Illuminate/Redis/Limiters/DurationLimiter.php create mode 100644 vendor/laravel/framework/src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php create mode 100644 vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php create mode 100755 vendor/laravel/framework/src/Illuminate/Redis/RedisServiceProvider.php create mode 100755 vendor/laravel/framework/src/Illuminate/Redis/composer.json create mode 100755 vendor/laravel/framework/src/Illuminate/Routing/Console/ControllerMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Console/stubs/controller.api.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Console/stubs/controller.invokable.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Console/stubs/controller.model.api.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Console/stubs/controller.model.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Console/stubs/controller.nested.api.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Console/stubs/controller.nested.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Console/stubs/controller.plain.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Console/stubs/controller.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Console/stubs/middleware.stub create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Contracts/ControllerDispatcher.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Controller.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/ControllerMiddlewareOptions.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Events/RouteMatched.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Exceptions/InvalidSignatureException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Exceptions/UrlGenerationException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/ImplicitRouteBinding.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Middleware/ValidateSignature.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/MiddlewareNameResolver.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/PendingResourceRegistration.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/RedirectController.php create mode 100755 vendor/laravel/framework/src/Illuminate/Routing/Redirector.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/ResourceRegistrar.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php create mode 100755 vendor/laravel/framework/src/Illuminate/Routing/Route.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/RouteAction.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/RouteBinding.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/RouteCompiler.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/RouteGroup.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/RouteParameterBinder.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/RouteRegistrar.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/RouteUrlGenerator.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/Router.php create mode 100755 vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/SortedMiddleware.php create mode 100755 vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/ViewController.php create mode 100644 vendor/laravel/framework/src/Illuminate/Routing/composer.json create mode 100755 vendor/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php create mode 100644 vendor/laravel/framework/src/Illuminate/Session/Console/SessionTableCommand.php create mode 100755 vendor/laravel/framework/src/Illuminate/Session/Console/stubs/database.stub create mode 100755 vendor/laravel/framework/src/Illuminate/Session/CookieSessionHandler.php create mode 100644 vendor/laravel/framework/src/Illuminate/Session/DatabaseSessionHandler.php create mode 100644 vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php create mode 100644 vendor/laravel/framework/src/Illuminate/Session/ExistenceAwareInterface.php create mode 100644 vendor/laravel/framework/src/Illuminate/Session/FileSessionHandler.php create mode 100644 vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php create mode 100644 vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php create mode 100644 vendor/laravel/framework/src/Illuminate/Session/NullSessionHandler.php create mode 100755 vendor/laravel/framework/src/Illuminate/Session/SessionManager.php create mode 100755 vendor/laravel/framework/src/Illuminate/Session/SessionServiceProvider.php create mode 100755 vendor/laravel/framework/src/Illuminate/Session/Store.php create mode 100755 vendor/laravel/framework/src/Illuminate/Session/TokenMismatchException.php create mode 100755 vendor/laravel/framework/src/Illuminate/Session/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Support/AggregateServiceProvider.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Arr.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Carbon.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Collection.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Composer.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/App.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Artisan.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Auth.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Blade.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Facades/Broadcast.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Facades/Bus.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Cache.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Config.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Cookie.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Crypt.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/DB.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Event.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/File.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Facades/Gate.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Hash.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Input.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Lang.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Log.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Mail.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Facades/Notification.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Password.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Queue.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Redirect.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Redis.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Request.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Response.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Route.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Schema.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Session.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Facades/Storage.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/URL.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/Validator.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Facades/View.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Fluent.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/HigherOrderTapProxy.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/HtmlString.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/InteractsWithTime.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Manager.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/MessageBag.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Optional.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/Pluralizer.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/ProcessUtils.php create mode 100755 vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Str.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/BusFake.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/EventFake.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/MailFake.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/NotificationFake.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/QueueFake.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Traits/CapsuleManagerTrait.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/ViewErrorBag.php create mode 100644 vendor/laravel/framework/src/Illuminate/Support/composer.json create mode 100755 vendor/laravel/framework/src/Illuminate/Support/helpers.php create mode 100644 vendor/laravel/framework/src/Illuminate/Translation/ArrayLoader.php create mode 100755 vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php create mode 100755 vendor/laravel/framework/src/Illuminate/Translation/MessageSelector.php create mode 100755 vendor/laravel/framework/src/Illuminate/Translation/TranslationServiceProvider.php create mode 100755 vendor/laravel/framework/src/Illuminate/Translation/Translator.php create mode 100755 vendor/laravel/framework/src/Illuminate/Translation/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/ClosureValidationRule.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/Concerns/FormatsMessages.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/Concerns/ReplacesAttributes.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php create mode 100755 vendor/laravel/framework/src/Illuminate/Validation/DatabasePresenceVerifier.php create mode 100755 vendor/laravel/framework/src/Illuminate/Validation/Factory.php create mode 100755 vendor/laravel/framework/src/Illuminate/Validation/PresenceVerifierInterface.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/Rule.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/Rules/DatabaseRule.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/Rules/Dimensions.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/Rules/Exists.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/Rules/In.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/Rules/NotIn.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/Rules/RequiredIf.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/Rules/Unique.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/UnauthorizedException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/ValidationData.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/ValidationException.php create mode 100644 vendor/laravel/framework/src/Illuminate/Validation/ValidationRuleParser.php create mode 100755 vendor/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php create mode 100755 vendor/laravel/framework/src/Illuminate/Validation/Validator.php create mode 100755 vendor/laravel/framework/src/Illuminate/Validation/composer.json create mode 100644 vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php create mode 100755 vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php create mode 100755 vendor/laravel/framework/src/Illuminate/View/Compilers/CompilerInterface.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesAuthorizations.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesComments.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesEchos.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesHelpers.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesIncludes.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesInjections.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesJson.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLoops.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesRawPhp.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesStacks.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesTranslations.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesComponents.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesEvents.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLayouts.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLoops.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesStacks.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesTranslations.php create mode 100755 vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php create mode 100755 vendor/laravel/framework/src/Illuminate/View/Engines/Engine.php create mode 100755 vendor/laravel/framework/src/Illuminate/View/Engines/EngineResolver.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Engines/FileEngine.php create mode 100755 vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php create mode 100755 vendor/laravel/framework/src/Illuminate/View/Factory.php create mode 100755 vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php create mode 100755 vendor/laravel/framework/src/Illuminate/View/View.php create mode 100755 vendor/laravel/framework/src/Illuminate/View/ViewFinderInterface.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/ViewName.php create mode 100755 vendor/laravel/framework/src/Illuminate/View/ViewServiceProvider.php create mode 100644 vendor/laravel/framework/src/Illuminate/View/composer.json create mode 100644 vendor/laravel/nexmo-notification-channel/LICENSE.txt create mode 100644 vendor/laravel/nexmo-notification-channel/composer.json create mode 100644 vendor/laravel/nexmo-notification-channel/readme.md create mode 100644 vendor/laravel/nexmo-notification-channel/src/Channels/NexmoSmsChannel.php create mode 100644 vendor/laravel/nexmo-notification-channel/src/Messages/NexmoMessage.php create mode 100644 vendor/laravel/nexmo-notification-channel/src/NexmoChannelServiceProvider.php create mode 100644 vendor/laravel/slack-notification-channel/LICENSE.txt create mode 100644 vendor/laravel/slack-notification-channel/composer.json create mode 100644 vendor/laravel/slack-notification-channel/readme.md create mode 100644 vendor/laravel/slack-notification-channel/src/Channels/SlackWebhookChannel.php create mode 100644 vendor/laravel/slack-notification-channel/src/Messages/SlackAttachment.php create mode 100644 vendor/laravel/slack-notification-channel/src/Messages/SlackAttachmentField.php create mode 100644 vendor/laravel/slack-notification-channel/src/Messages/SlackMessage.php create mode 100644 vendor/laravel/slack-notification-channel/src/SlackChannelServiceProvider.php create mode 100644 vendor/lcobucci/jwt/.gitignore create mode 100644 vendor/lcobucci/jwt/.scrutinizer.yml create mode 100644 vendor/lcobucci/jwt/.travis.yml create mode 100644 vendor/lcobucci/jwt/LICENSE create mode 100644 vendor/lcobucci/jwt/README.md create mode 100644 vendor/lcobucci/jwt/composer.json create mode 100644 vendor/lcobucci/jwt/composer.lock create mode 100644 vendor/lcobucci/jwt/phpunit.xml.dist create mode 100644 vendor/lcobucci/jwt/src/Builder.php create mode 100644 vendor/lcobucci/jwt/src/Claim.php create mode 100644 vendor/lcobucci/jwt/src/Claim/Basic.php create mode 100644 vendor/lcobucci/jwt/src/Claim/EqualsTo.php create mode 100644 vendor/lcobucci/jwt/src/Claim/Factory.php create mode 100644 vendor/lcobucci/jwt/src/Claim/GreaterOrEqualsTo.php create mode 100644 vendor/lcobucci/jwt/src/Claim/LesserOrEqualsTo.php create mode 100644 vendor/lcobucci/jwt/src/Claim/Validatable.php create mode 100644 vendor/lcobucci/jwt/src/Parser.php create mode 100644 vendor/lcobucci/jwt/src/Parsing/Decoder.php create mode 100644 vendor/lcobucci/jwt/src/Parsing/Encoder.php create mode 100644 vendor/lcobucci/jwt/src/Signature.php create mode 100644 vendor/lcobucci/jwt/src/Signer.php create mode 100644 vendor/lcobucci/jwt/src/Signer/BaseSigner.php create mode 100644 vendor/lcobucci/jwt/src/Signer/Ecdsa.php create mode 100644 vendor/lcobucci/jwt/src/Signer/Ecdsa/KeyParser.php create mode 100644 vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha256.php create mode 100644 vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha384.php create mode 100644 vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha512.php create mode 100644 vendor/lcobucci/jwt/src/Signer/Hmac.php create mode 100644 vendor/lcobucci/jwt/src/Signer/Hmac/Sha256.php create mode 100644 vendor/lcobucci/jwt/src/Signer/Hmac/Sha384.php create mode 100644 vendor/lcobucci/jwt/src/Signer/Hmac/Sha512.php create mode 100644 vendor/lcobucci/jwt/src/Signer/Key.php create mode 100644 vendor/lcobucci/jwt/src/Signer/Keychain.php create mode 100644 vendor/lcobucci/jwt/src/Signer/Rsa.php create mode 100644 vendor/lcobucci/jwt/src/Signer/Rsa/Sha256.php create mode 100644 vendor/lcobucci/jwt/src/Signer/Rsa/Sha384.php create mode 100644 vendor/lcobucci/jwt/src/Signer/Rsa/Sha512.php create mode 100644 vendor/lcobucci/jwt/src/Token.php create mode 100644 vendor/lcobucci/jwt/src/ValidationData.php create mode 100644 vendor/lcobucci/jwt/test/functional/EcdsaTokenTest.php create mode 100644 vendor/lcobucci/jwt/test/functional/HmacTokenTest.php create mode 100644 vendor/lcobucci/jwt/test/functional/Keys.php create mode 100644 vendor/lcobucci/jwt/test/functional/RsaTokenTest.php create mode 100644 vendor/lcobucci/jwt/test/functional/UnsignedTokenTest.php create mode 100644 vendor/lcobucci/jwt/test/functional/ecdsa/private.key create mode 100644 vendor/lcobucci/jwt/test/functional/ecdsa/private2.key create mode 100644 vendor/lcobucci/jwt/test/functional/ecdsa/public1.key create mode 100644 vendor/lcobucci/jwt/test/functional/ecdsa/public2.key create mode 100644 vendor/lcobucci/jwt/test/functional/ecdsa/public3.key create mode 100644 vendor/lcobucci/jwt/test/functional/rsa/encrypted-private.key create mode 100644 vendor/lcobucci/jwt/test/functional/rsa/encrypted-public.key create mode 100644 vendor/lcobucci/jwt/test/functional/rsa/private.key create mode 100644 vendor/lcobucci/jwt/test/functional/rsa/public.key create mode 100644 vendor/lcobucci/jwt/test/unit/BuilderTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/Claim/BasicTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/Claim/EqualsToTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/Claim/FactoryTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/Claim/GreaterOrEqualsToTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/Claim/LesserOrEqualsToTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/ParserTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/Parsing/DecoderTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/Parsing/EncoderTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/SignatureTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/Signer/BaseSignerTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/KeyParserTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha256Test.php create mode 100644 vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha384Test.php create mode 100644 vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha512Test.php create mode 100644 vendor/lcobucci/jwt/test/unit/Signer/EcdsaTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha256Test.php create mode 100644 vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha384Test.php create mode 100644 vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha512Test.php create mode 100644 vendor/lcobucci/jwt/test/unit/Signer/HmacTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/Signer/KeyTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/Signer/KeychainTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha256Test.php create mode 100644 vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha384Test.php create mode 100644 vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha512Test.php create mode 100644 vendor/lcobucci/jwt/test/unit/TokenTest.php create mode 100644 vendor/lcobucci/jwt/test/unit/ValidationDataTest.php create mode 100644 vendor/league/flysystem/LICENSE create mode 100644 vendor/league/flysystem/composer.json create mode 100644 vendor/league/flysystem/deprecations.md create mode 100644 vendor/league/flysystem/src/Adapter/AbstractAdapter.php create mode 100644 vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php create mode 100644 vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php create mode 100644 vendor/league/flysystem/src/Adapter/Ftp.php create mode 100644 vendor/league/flysystem/src/Adapter/Ftpd.php create mode 100644 vendor/league/flysystem/src/Adapter/Local.php create mode 100644 vendor/league/flysystem/src/Adapter/NullAdapter.php create mode 100644 vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php create mode 100644 vendor/league/flysystem/src/Adapter/Polyfill/StreamedCopyTrait.php create mode 100644 vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php create mode 100644 vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php create mode 100644 vendor/league/flysystem/src/Adapter/Polyfill/StreamedWritingTrait.php create mode 100644 vendor/league/flysystem/src/Adapter/SynologyFtp.php create mode 100644 vendor/league/flysystem/src/AdapterInterface.php create mode 100644 vendor/league/flysystem/src/Config.php create mode 100644 vendor/league/flysystem/src/ConfigAwareTrait.php create mode 100644 vendor/league/flysystem/src/Directory.php create mode 100644 vendor/league/flysystem/src/Exception.php create mode 100644 vendor/league/flysystem/src/File.php create mode 100644 vendor/league/flysystem/src/FileExistsException.php create mode 100644 vendor/league/flysystem/src/FileNotFoundException.php create mode 100644 vendor/league/flysystem/src/Filesystem.php create mode 100644 vendor/league/flysystem/src/FilesystemInterface.php create mode 100644 vendor/league/flysystem/src/FilesystemNotFoundException.php create mode 100644 vendor/league/flysystem/src/Handler.php create mode 100644 vendor/league/flysystem/src/MountManager.php create mode 100644 vendor/league/flysystem/src/NotSupportedException.php create mode 100644 vendor/league/flysystem/src/Plugin/AbstractPlugin.php create mode 100644 vendor/league/flysystem/src/Plugin/EmptyDir.php create mode 100644 vendor/league/flysystem/src/Plugin/ForcedCopy.php create mode 100644 vendor/league/flysystem/src/Plugin/ForcedRename.php create mode 100644 vendor/league/flysystem/src/Plugin/GetWithMetadata.php create mode 100644 vendor/league/flysystem/src/Plugin/ListFiles.php create mode 100644 vendor/league/flysystem/src/Plugin/ListPaths.php create mode 100644 vendor/league/flysystem/src/Plugin/ListWith.php create mode 100644 vendor/league/flysystem/src/Plugin/PluggableTrait.php create mode 100644 vendor/league/flysystem/src/Plugin/PluginNotFoundException.php create mode 100644 vendor/league/flysystem/src/PluginInterface.php create mode 100644 vendor/league/flysystem/src/ReadInterface.php create mode 100644 vendor/league/flysystem/src/RootViolationException.php create mode 100644 vendor/league/flysystem/src/SafeStorage.php create mode 100644 vendor/league/flysystem/src/UnreadableFileException.php create mode 100644 vendor/league/flysystem/src/Util.php create mode 100644 vendor/league/flysystem/src/Util/ContentListingFormatter.php create mode 100644 vendor/league/flysystem/src/Util/MimeType.php create mode 100644 vendor/league/flysystem/src/Util/StreamHasher.php create mode 100644 vendor/mockery/mockery/.gitignore create mode 100644 vendor/mockery/mockery/.php_cs create mode 100644 vendor/mockery/mockery/.phpstorm.meta.php create mode 100644 vendor/mockery/mockery/.scrutinizer.yml create mode 100644 vendor/mockery/mockery/.styleci.yml create mode 100644 vendor/mockery/mockery/.travis.yml create mode 100644 vendor/mockery/mockery/CHANGELOG.md create mode 100644 vendor/mockery/mockery/CONTRIBUTING.md create mode 100644 vendor/mockery/mockery/LICENSE create mode 100644 vendor/mockery/mockery/Makefile create mode 100644 vendor/mockery/mockery/README.md create mode 100644 vendor/mockery/mockery/composer.json create mode 100644 vendor/mockery/mockery/docker/php56/Dockerfile create mode 100644 vendor/mockery/mockery/docs/.gitignore create mode 100644 vendor/mockery/mockery/docs/Makefile create mode 100644 vendor/mockery/mockery/docs/README.md create mode 100644 vendor/mockery/mockery/docs/conf.py create mode 100644 vendor/mockery/mockery/docs/cookbook/big_parent_class.rst create mode 100644 vendor/mockery/mockery/docs/cookbook/class_constants.rst create mode 100644 vendor/mockery/mockery/docs/cookbook/default_expectations.rst create mode 100644 vendor/mockery/mockery/docs/cookbook/detecting_mock_objects.rst create mode 100644 vendor/mockery/mockery/docs/cookbook/index.rst create mode 100644 vendor/mockery/mockery/docs/cookbook/map.rst.inc create mode 100644 vendor/mockery/mockery/docs/cookbook/mockery_on.rst create mode 100644 vendor/mockery/mockery/docs/cookbook/mocking_hard_dependencies.rst create mode 100644 vendor/mockery/mockery/docs/cookbook/not_calling_the_constructor.rst create mode 100644 vendor/mockery/mockery/docs/getting_started/index.rst create mode 100644 vendor/mockery/mockery/docs/getting_started/installation.rst create mode 100644 vendor/mockery/mockery/docs/getting_started/map.rst.inc create mode 100644 vendor/mockery/mockery/docs/getting_started/quick_reference.rst create mode 100644 vendor/mockery/mockery/docs/getting_started/simple_example.rst create mode 100644 vendor/mockery/mockery/docs/getting_started/upgrading.rst create mode 100644 vendor/mockery/mockery/docs/index.rst create mode 100644 vendor/mockery/mockery/docs/mockery/configuration.rst create mode 100644 vendor/mockery/mockery/docs/mockery/exceptions.rst create mode 100644 vendor/mockery/mockery/docs/mockery/gotchas.rst create mode 100644 vendor/mockery/mockery/docs/mockery/index.rst create mode 100644 vendor/mockery/mockery/docs/mockery/map.rst.inc create mode 100644 vendor/mockery/mockery/docs/mockery/reserved_method_names.rst create mode 100644 vendor/mockery/mockery/docs/reference/alternative_should_receive_syntax.rst create mode 100644 vendor/mockery/mockery/docs/reference/argument_validation.rst create mode 100644 vendor/mockery/mockery/docs/reference/creating_test_doubles.rst create mode 100644 vendor/mockery/mockery/docs/reference/demeter_chains.rst create mode 100644 vendor/mockery/mockery/docs/reference/expectations.rst create mode 100644 vendor/mockery/mockery/docs/reference/final_methods_classes.rst create mode 100644 vendor/mockery/mockery/docs/reference/index.rst create mode 100644 vendor/mockery/mockery/docs/reference/instance_mocking.rst create mode 100644 vendor/mockery/mockery/docs/reference/magic_methods.rst create mode 100644 vendor/mockery/mockery/docs/reference/map.rst.inc create mode 100644 vendor/mockery/mockery/docs/reference/partial_mocks.rst create mode 100644 vendor/mockery/mockery/docs/reference/pass_by_reference_behaviours.rst create mode 100644 vendor/mockery/mockery/docs/reference/phpunit_integration.rst create mode 100644 vendor/mockery/mockery/docs/reference/protected_methods.rst create mode 100644 vendor/mockery/mockery/docs/reference/public_properties.rst create mode 100644 vendor/mockery/mockery/docs/reference/public_static_properties.rst create mode 100644 vendor/mockery/mockery/docs/reference/spies.rst create mode 100644 vendor/mockery/mockery/library/Mockery.php create mode 100644 vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV5.php create mode 100644 vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV6.php create mode 100644 vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV7.php create mode 100644 vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerTrait.php create mode 100644 vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegration.php create mode 100644 vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCase.php create mode 100644 vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php create mode 100644 vendor/mockery/mockery/library/Mockery/ClosureWrapper.php create mode 100644 vendor/mockery/mockery/library/Mockery/CompositeExpectation.php create mode 100644 vendor/mockery/mockery/library/Mockery/Configuration.php create mode 100644 vendor/mockery/mockery/library/Mockery/Container.php create mode 100644 vendor/mockery/mockery/library/Mockery/CountValidator/AtLeast.php create mode 100644 vendor/mockery/mockery/library/Mockery/CountValidator/AtMost.php create mode 100644 vendor/mockery/mockery/library/Mockery/CountValidator/CountValidatorAbstract.php create mode 100644 vendor/mockery/mockery/library/Mockery/CountValidator/Exact.php create mode 100644 vendor/mockery/mockery/library/Mockery/CountValidator/Exception.php create mode 100644 vendor/mockery/mockery/library/Mockery/Exception.php create mode 100644 vendor/mockery/mockery/library/Mockery/Exception/BadMethodCallException.php create mode 100644 vendor/mockery/mockery/library/Mockery/Exception/InvalidArgumentException.php create mode 100644 vendor/mockery/mockery/library/Mockery/Exception/InvalidCountException.php create mode 100644 vendor/mockery/mockery/library/Mockery/Exception/InvalidOrderException.php create mode 100644 vendor/mockery/mockery/library/Mockery/Exception/NoMatchingExpectationException.php create mode 100644 vendor/mockery/mockery/library/Mockery/Exception/RuntimeException.php create mode 100644 vendor/mockery/mockery/library/Mockery/Expectation.php create mode 100644 vendor/mockery/mockery/library/Mockery/ExpectationDirector.php create mode 100644 vendor/mockery/mockery/library/Mockery/ExpectationInterface.php create mode 100644 vendor/mockery/mockery/library/Mockery/ExpectsHigherOrderMessage.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/CachingGenerator.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/DefinedTargetClass.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/Generator.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/Method.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/MockConfiguration.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/MockConfigurationBuilder.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/MockDefinition.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/Parameter.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/CallTypeHintPass.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ClassNamePass.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ClassPass.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ConstantsPass.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/InstanceMockPass.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/InterfacePass.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/MagicMethodTypeHintsPass.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/MethodDefinitionPass.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/Pass.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/RemoveBuiltinMethodsThatAreFinalPass.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/RemoveDestructorPass.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/RemoveUnserializeForInternalSerializableClassesPass.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/TraitPass.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/StringManipulationGenerator.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/TargetClassInterface.php create mode 100644 vendor/mockery/mockery/library/Mockery/Generator/UndefinedTargetClass.php create mode 100644 vendor/mockery/mockery/library/Mockery/HigherOrderMessage.php create mode 100644 vendor/mockery/mockery/library/Mockery/Instantiator.php create mode 100644 vendor/mockery/mockery/library/Mockery/Loader/EvalLoader.php create mode 100644 vendor/mockery/mockery/library/Mockery/Loader/Loader.php create mode 100644 vendor/mockery/mockery/library/Mockery/Loader/RequireLoader.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/AndAnyOtherArgs.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/Any.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/AnyArgs.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/AnyOf.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/ArgumentListMatcher.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/Closure.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/Contains.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/Ducktype.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/HasKey.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/HasValue.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/MatcherAbstract.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/MultiArgumentClosure.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/MustBe.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/NoArgs.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/Not.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/NotAnyOf.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/PHPUnitConstraint.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/Pattern.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/Subset.php create mode 100644 vendor/mockery/mockery/library/Mockery/Matcher/Type.php create mode 100644 vendor/mockery/mockery/library/Mockery/MethodCall.php create mode 100644 vendor/mockery/mockery/library/Mockery/Mock.php create mode 100644 vendor/mockery/mockery/library/Mockery/MockInterface.php create mode 100644 vendor/mockery/mockery/library/Mockery/ReceivedMethodCalls.php create mode 100644 vendor/mockery/mockery/library/Mockery/Undefined.php create mode 100644 vendor/mockery/mockery/library/Mockery/VerificationDirector.php create mode 100644 vendor/mockery/mockery/library/Mockery/VerificationExpectation.php create mode 100644 vendor/mockery/mockery/library/helpers.php create mode 100644 vendor/mockery/mockery/phpunit.xml.dist create mode 100644 vendor/mockery/mockery/tests/Bootstrap.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegrationTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Adapter/Phpunit/TestListenerTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/AdhocTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/AllowsExpectsSyntaxTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/CallableSpyTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/ContainerTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/DemeterChainTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/DummyClasses/DemeterChain.php create mode 100644 vendor/mockery/mockery/tests/Mockery/DummyClasses/Namespaced.php create mode 100644 vendor/mockery/mockery/tests/Mockery/ExpectationTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Fixtures/ClassWithAllLowerCaseMethod.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Fixtures/ClassWithConstants.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Fixtures/EmptyTestCaseV5.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Fixtures/EmptyTestCaseV6.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Fixtures/EmptyTestCaseV7.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Fixtures/MethodWithHHVMReturnType.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Fixtures/MethodWithIterableTypeHints.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Fixtures/MethodWithNullableReturnType.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Fixtures/MethodWithNullableTypedParameter.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Fixtures/MethodWithParametersWithDefaultValues.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Fixtures/MethodWithVoidReturnType.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Fixtures/SemiReservedWordsAsMethods.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Generator/DefinedTargetClassTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Generator/MockConfigurationBuilderTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Generator/MockConfigurationTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/CallTypeHintPassTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/ClassNamePassTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/ConstantsPassTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/InstanceMockPassTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/InterfacePassTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/GlobalHelpersTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/HamcrestExpectationTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Loader/EvalLoaderTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Loader/LoaderTestCase.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Loader/RequireLoaderTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Matcher/PHPUnitConstraintTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Matcher/SubsetTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/MockClassWithFinalWakeupTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/MockClassWithMethodOverloadingTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/MockClassWithUnknownTypeHintTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/MockTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/MockeryCanMockClassesWithSemiReservedWordsTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/MockeryCanMockMultipleInterfacesWhichOverlapTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/MockingAllLowerCasedMethodsTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/MockingClassConstantsTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/MockingHHVMMethodsTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/MockingMethodsWithIterableTypeHintsTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/MockingMethodsWithNullableParametersTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/MockingNullableMethodsTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/MockingProtectedMethodsTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/MockingVariadicArgumentsTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/MockingVoidMethodsTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/NamedMockTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/SpyTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Stubs/Animal.php create mode 100644 vendor/mockery/mockery/tests/Mockery/Stubs/Habitat.php create mode 100644 vendor/mockery/mockery/tests/Mockery/TraitsTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/WithFormatterExpectationTest.php create mode 100644 vendor/mockery/mockery/tests/Mockery/_files/file.txt create mode 100644 vendor/mockery/mockery/tests/PHP56/MockingOldStyleConstructorTest.php create mode 100644 vendor/mockery/mockery/tests/PHP70/Generator/StringManipulation/Pass/MagicMethodTypeHintsPassTest.php create mode 100644 vendor/mockery/mockery/tests/PHP70/MockingParameterAndReturnTypesTest.php create mode 100644 vendor/mockery/mockery/tests/PHP72/Php72LanguageFeaturesTest.php create mode 100644 vendor/monolog/monolog/.php_cs create mode 100644 vendor/monolog/monolog/CHANGELOG.md create mode 100644 vendor/monolog/monolog/LICENSE create mode 100644 vendor/monolog/monolog/README.md create mode 100644 vendor/monolog/monolog/composer.json create mode 100644 vendor/monolog/monolog/doc/01-usage.md create mode 100644 vendor/monolog/monolog/doc/02-handlers-formatters-processors.md create mode 100644 vendor/monolog/monolog/doc/03-utilities.md create mode 100644 vendor/monolog/monolog/doc/04-extending.md create mode 100644 vendor/monolog/monolog/doc/sockets.md create mode 100644 vendor/monolog/monolog/phpunit.xml.dist create mode 100644 vendor/monolog/monolog/src/Monolog/ErrorHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php create mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php create mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php create mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php create mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php create mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php create mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php create mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php create mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php create mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php create mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php create mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php create mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php create mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php create mode 100644 vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php create mode 100755 vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Logger.php create mode 100644 vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php create mode 100644 vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php create mode 100644 vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php create mode 100644 vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php create mode 100644 vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php create mode 100644 vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php create mode 100644 vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php create mode 100644 vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php create mode 100644 vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php create mode 100644 vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php create mode 100644 vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php create mode 100644 vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php create mode 100644 vendor/monolog/monolog/src/Monolog/Registry.php create mode 100644 vendor/monolog/monolog/src/Monolog/ResettableInterface.php create mode 100644 vendor/monolog/monolog/src/Monolog/SignalHandler.php create mode 100644 vendor/monolog/monolog/src/Monolog/Utils.php create mode 100644 vendor/monolog/monolog/tests/Monolog/ErrorHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/FlowdockFormatterTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/FluentdFormatterTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/LogglyFormatterTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Formatter/WildfireFormatterTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/AbstractHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/BrowserConsoleHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/BufferHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/CouchDBHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/DeduplicationHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/DoctrineCouchDBHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/Fixtures/.gitkeep create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/HandlerWrapperTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/InsightOpsHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/RollbarHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SamplingHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SlackWebhookHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SlackbotHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SyslogHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/UdpSocketTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/WhatFailureGroupHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/LoggerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/PsrLogCompatTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/RegistryTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/SignalHandlerTest.php create mode 100644 vendor/monolog/monolog/tests/Monolog/TestCase.php create mode 100755 vendor/myclabs/deep-copy/.gitattributes create mode 100755 vendor/myclabs/deep-copy/.gitignore create mode 100644 vendor/myclabs/deep-copy/.scrutinizer.yml create mode 100755 vendor/myclabs/deep-copy/.travis.yml create mode 100644 vendor/myclabs/deep-copy/LICENSE create mode 100644 vendor/myclabs/deep-copy/README.md create mode 100644 vendor/myclabs/deep-copy/composer.json create mode 100644 vendor/myclabs/deep-copy/doc/clone.png create mode 100644 vendor/myclabs/deep-copy/doc/deep-clone.png create mode 100644 vendor/myclabs/deep-copy/doc/deep-copy.png create mode 100644 vendor/myclabs/deep-copy/doc/graph.png create mode 100644 vendor/myclabs/deep-copy/fixtures/f001/A.php create mode 100644 vendor/myclabs/deep-copy/fixtures/f001/B.php create mode 100644 vendor/myclabs/deep-copy/fixtures/f002/A.php create mode 100644 vendor/myclabs/deep-copy/fixtures/f003/Foo.php create mode 100644 vendor/myclabs/deep-copy/fixtures/f004/UnclonableItem.php create mode 100644 vendor/myclabs/deep-copy/fixtures/f005/Foo.php create mode 100644 vendor/myclabs/deep-copy/fixtures/f006/A.php create mode 100644 vendor/myclabs/deep-copy/fixtures/f006/B.php create mode 100644 vendor/myclabs/deep-copy/fixtures/f007/FooDateInterval.php create mode 100644 vendor/myclabs/deep-copy/fixtures/f007/FooDateTimeZone.php create mode 100644 vendor/myclabs/deep-copy/fixtures/f008/A.php create mode 100644 vendor/myclabs/deep-copy/fixtures/f008/B.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/DeepCopy.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/Exception/CloneException.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/Exception/PropertyException.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineCollectionFilter.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/Filter/Filter.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/Filter/KeepFilter.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/Filter/ReplaceFilter.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/Filter/SetNullFilter.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Matcher.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyMatcher.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyNameMatcher.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyTypeMatcher.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/Reflection/ReflectionHelper.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Date/DateIntervalFilter.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ReplaceFilter.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ShallowCopyFilter.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Spl/SplDoublyLinkedList.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Spl/SplDoublyLinkedListFilter.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/TypeFilter.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/TypeMatcher/TypeMatcher.php create mode 100644 vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php create mode 100644 vendor/nesbot/carbon/LICENSE create mode 100644 vendor/nesbot/carbon/composer.json create mode 100644 vendor/nesbot/carbon/readme.md create mode 100644 vendor/nesbot/carbon/src/Carbon/Carbon.php create mode 100644 vendor/nesbot/carbon/src/Carbon/CarbonInterval.php create mode 100644 vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/af.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/ar.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/ar_Shakl.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/az.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/bg.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/bn.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/ca.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/cs.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/cy.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/da.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/de.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/dv_MV.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/el.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/en.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/eo.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/es.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/et.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/eu.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/fa.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/fi.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/fo.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/fr.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/gl.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/gu.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/he.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/hi.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/hr.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/hu.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/hy.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/id.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/is.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/it.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/ja.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/ka.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/kk.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/km.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/ko.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/lt.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/lv.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/mk.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/mn.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/ms.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/my.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/ne.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/nl.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/no.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/oc.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/pl.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/ps.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/pt.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/ro.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/ru.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/sh.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/sk.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/sl.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/sq.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/sr.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/sv.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/sw.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/th.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/tr.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/uk.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/ur.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/uz.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/vi.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/zh.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php create mode 100644 vendor/nesbot/carbon/src/Carbon/Translator.php create mode 100644 vendor/nesbot/carbon/src/JsonSerializable.php create mode 100644 vendor/nexmo/client/LICENSE.txt create mode 100644 vendor/nexmo/client/composer.json create mode 100644 vendor/nexmo/client/examples/fetch_recording.php create mode 100644 vendor/nexmo/client/examples/send.php create mode 100644 vendor/nexmo/client/phpcs.xml create mode 100644 vendor/nexmo/client/src/Account/Balance.php create mode 100644 vendor/nexmo/client/src/Account/Client.php create mode 100644 vendor/nexmo/client/src/Account/PrefixPrice.php create mode 100644 vendor/nexmo/client/src/Account/Price.php create mode 100644 vendor/nexmo/client/src/Account/Secret.php create mode 100644 vendor/nexmo/client/src/Account/SecretCollection.php create mode 100644 vendor/nexmo/client/src/Account/SmsPrice.php create mode 100644 vendor/nexmo/client/src/Account/VoicePrice.php create mode 100644 vendor/nexmo/client/src/ApiErrorHandler.php create mode 100644 vendor/nexmo/client/src/Application/Application.php create mode 100644 vendor/nexmo/client/src/Application/ApplicationInterface.php create mode 100644 vendor/nexmo/client/src/Application/Client.php create mode 100644 vendor/nexmo/client/src/Application/Filter.php create mode 100644 vendor/nexmo/client/src/Application/VoiceConfig.php create mode 100644 vendor/nexmo/client/src/Application/Webhook.php create mode 100644 vendor/nexmo/client/src/Call/Call.php create mode 100644 vendor/nexmo/client/src/Call/Collection.php create mode 100644 vendor/nexmo/client/src/Call/Dtmf.php create mode 100644 vendor/nexmo/client/src/Call/Earmuff.php create mode 100644 vendor/nexmo/client/src/Call/Endpoint.php create mode 100644 vendor/nexmo/client/src/Call/Event.php create mode 100644 vendor/nexmo/client/src/Call/Filter.php create mode 100644 vendor/nexmo/client/src/Call/Hangup.php create mode 100644 vendor/nexmo/client/src/Call/Mute.php create mode 100644 vendor/nexmo/client/src/Call/Stream.php create mode 100644 vendor/nexmo/client/src/Call/Talk.php create mode 100644 vendor/nexmo/client/src/Call/Transfer.php create mode 100644 vendor/nexmo/client/src/Call/Unearmuff.php create mode 100644 vendor/nexmo/client/src/Call/Unmute.php create mode 100644 vendor/nexmo/client/src/Call/Webhook.php create mode 100644 vendor/nexmo/client/src/Client.php create mode 100644 vendor/nexmo/client/src/Client/Callback/Callback.php create mode 100644 vendor/nexmo/client/src/Client/Callback/CallbackInterface.php create mode 100644 vendor/nexmo/client/src/Client/ClientAwareInterface.php create mode 100644 vendor/nexmo/client/src/Client/ClientAwareTrait.php create mode 100644 vendor/nexmo/client/src/Client/Credentials/AbstractCredentials.php create mode 100644 vendor/nexmo/client/src/Client/Credentials/Basic.php create mode 100644 vendor/nexmo/client/src/Client/Credentials/Container.php create mode 100644 vendor/nexmo/client/src/Client/Credentials/CredentialsInterface.php create mode 100644 vendor/nexmo/client/src/Client/Credentials/Keypair.php create mode 100644 vendor/nexmo/client/src/Client/Credentials/OAuth.php create mode 100644 vendor/nexmo/client/src/Client/Credentials/SignatureSecret.php create mode 100644 vendor/nexmo/client/src/Client/Exception/Exception.php create mode 100644 vendor/nexmo/client/src/Client/Exception/Request.php create mode 100644 vendor/nexmo/client/src/Client/Exception/Server.php create mode 100644 vendor/nexmo/client/src/Client/Exception/Transport.php create mode 100644 vendor/nexmo/client/src/Client/Exception/Validation.php create mode 100644 vendor/nexmo/client/src/Client/Factory/FactoryInterface.php create mode 100644 vendor/nexmo/client/src/Client/Factory/MapFactory.php create mode 100644 vendor/nexmo/client/src/Client/Request/AbstractRequest.php create mode 100644 vendor/nexmo/client/src/Client/Request/RequestInterface.php create mode 100644 vendor/nexmo/client/src/Client/Request/WrapResponseInterface.php create mode 100644 vendor/nexmo/client/src/Client/Response/AbstractResponse.php create mode 100644 vendor/nexmo/client/src/Client/Response/Error.php create mode 100644 vendor/nexmo/client/src/Client/Response/Response.php create mode 100644 vendor/nexmo/client/src/Client/Response/ResponseInterface.php create mode 100644 vendor/nexmo/client/src/Client/Signature.php create mode 100644 vendor/nexmo/client/src/Conversations/Collection.php create mode 100644 vendor/nexmo/client/src/Conversations/Conversation.php create mode 100644 vendor/nexmo/client/src/Conversion/Client.php create mode 100644 vendor/nexmo/client/src/Entity/ArrayAccessTrait.php create mode 100644 vendor/nexmo/client/src/Entity/CollectionAwareInterface.php create mode 100644 vendor/nexmo/client/src/Entity/CollectionAwareTrait.php create mode 100644 vendor/nexmo/client/src/Entity/CollectionInterface.php create mode 100644 vendor/nexmo/client/src/Entity/CollectionTrait.php create mode 100644 vendor/nexmo/client/src/Entity/EmptyFilter.php create mode 100644 vendor/nexmo/client/src/Entity/EntityInterface.php create mode 100644 vendor/nexmo/client/src/Entity/FilterInterface.php create mode 100644 vendor/nexmo/client/src/Entity/HasEntityTrait.php create mode 100644 vendor/nexmo/client/src/Entity/JsonResponseTrait.php create mode 100644 vendor/nexmo/client/src/Entity/JsonSerializableInterface.php create mode 100644 vendor/nexmo/client/src/Entity/JsonSerializableTrait.php create mode 100644 vendor/nexmo/client/src/Entity/JsonUnserializableInterface.php create mode 100644 vendor/nexmo/client/src/Entity/NoRequestResponseTrait.php create mode 100644 vendor/nexmo/client/src/Entity/Psr7Trait.php create mode 100644 vendor/nexmo/client/src/Entity/RequestArrayTrait.php create mode 100644 vendor/nexmo/client/src/Insights/Advanced.php create mode 100644 vendor/nexmo/client/src/Insights/AdvancedCnam.php create mode 100644 vendor/nexmo/client/src/Insights/Basic.php create mode 100644 vendor/nexmo/client/src/Insights/Client.php create mode 100644 vendor/nexmo/client/src/Insights/CnamTrait.php create mode 100644 vendor/nexmo/client/src/Insights/Standard.php create mode 100644 vendor/nexmo/client/src/Insights/StandardCnam.php create mode 100644 vendor/nexmo/client/src/InvalidResponseException.php create mode 100644 vendor/nexmo/client/src/Message/AutoDetect.php create mode 100644 vendor/nexmo/client/src/Message/Binary.php create mode 100644 vendor/nexmo/client/src/Message/Callback/Receipt.php create mode 100644 vendor/nexmo/client/src/Message/Client.php create mode 100644 vendor/nexmo/client/src/Message/CollectionTrait.php create mode 100644 vendor/nexmo/client/src/Message/EncodingDetector.php create mode 100644 vendor/nexmo/client/src/Message/InboundMessage.php create mode 100644 vendor/nexmo/client/src/Message/Message.php create mode 100644 vendor/nexmo/client/src/Message/MessageInterface.php create mode 100644 vendor/nexmo/client/src/Message/Query.php create mode 100644 vendor/nexmo/client/src/Message/Response/Collection.php create mode 100644 vendor/nexmo/client/src/Message/Response/Message.php create mode 100644 vendor/nexmo/client/src/Message/Text.php create mode 100644 vendor/nexmo/client/src/Message/Unicode.php create mode 100644 vendor/nexmo/client/src/Message/Vcal.php create mode 100644 vendor/nexmo/client/src/Message/Vcard.php create mode 100644 vendor/nexmo/client/src/Message/Wap.php create mode 100644 vendor/nexmo/client/src/Network.php create mode 100644 vendor/nexmo/client/src/Network/Number/Callback.php create mode 100644 vendor/nexmo/client/src/Network/Number/Request.php create mode 100644 vendor/nexmo/client/src/Network/Number/Response.php create mode 100644 vendor/nexmo/client/src/Numbers/Client.php create mode 100644 vendor/nexmo/client/src/Numbers/Number.php create mode 100644 vendor/nexmo/client/src/Redact/Client.php create mode 100644 vendor/nexmo/client/src/Response.php create mode 100644 vendor/nexmo/client/src/Response/Message.php create mode 100644 vendor/nexmo/client/src/User/Collection.php create mode 100644 vendor/nexmo/client/src/User/User.php create mode 100644 vendor/nexmo/client/src/Verify/Check.php create mode 100644 vendor/nexmo/client/src/Verify/Client.php create mode 100644 vendor/nexmo/client/src/Verify/Verification.php create mode 100644 vendor/nexmo/client/src/Verify/VerificationInterface.php create mode 100644 vendor/nexmo/client/src/Voice/Call/Call.php create mode 100644 vendor/nexmo/client/src/Voice/Call/Inbound.php create mode 100644 vendor/nexmo/client/src/Voice/Message/Callback.php create mode 100644 vendor/nexmo/client/src/Voice/Message/Message.php create mode 100644 vendor/opis/closure/CHANGELOG.md create mode 100644 vendor/opis/closure/LICENSE create mode 100644 vendor/opis/closure/NOTICE create mode 100644 vendor/opis/closure/README.md create mode 100644 vendor/opis/closure/autoload.php create mode 100644 vendor/opis/closure/composer.json create mode 100644 vendor/opis/closure/functions.php create mode 100644 vendor/opis/closure/src/Analyzer.php create mode 100644 vendor/opis/closure/src/ClosureContext.php create mode 100644 vendor/opis/closure/src/ClosureScope.php create mode 100644 vendor/opis/closure/src/ClosureStream.php create mode 100644 vendor/opis/closure/src/ISecurityProvider.php create mode 100644 vendor/opis/closure/src/ReflectionClosure.php create mode 100644 vendor/opis/closure/src/SecurityException.php create mode 100644 vendor/opis/closure/src/SecurityProvider.php create mode 100644 vendor/opis/closure/src/SelfReference.php create mode 100644 vendor/opis/closure/src/SerializableClosure.php create mode 100644 vendor/orchestra/testbench-core/composer.json create mode 100755 vendor/orchestra/testbench-core/create-sqlite-db create mode 100644 vendor/orchestra/testbench-core/laravel/app/.gitkeep create mode 100644 vendor/orchestra/testbench-core/laravel/bootstrap/cache/.gitignore create mode 100644 vendor/orchestra/testbench-core/laravel/composer.json create mode 100644 vendor/orchestra/testbench-core/laravel/config/app.php create mode 100644 vendor/orchestra/testbench-core/laravel/config/auth.php create mode 100644 vendor/orchestra/testbench-core/laravel/config/broadcasting.php create mode 100644 vendor/orchestra/testbench-core/laravel/config/cache.php create mode 100644 vendor/orchestra/testbench-core/laravel/config/database.php create mode 100644 vendor/orchestra/testbench-core/laravel/config/filesystems.php create mode 100644 vendor/orchestra/testbench-core/laravel/config/hashing.php create mode 100644 vendor/orchestra/testbench-core/laravel/config/logging.php create mode 100644 vendor/orchestra/testbench-core/laravel/config/mail.php create mode 100644 vendor/orchestra/testbench-core/laravel/config/queue.php create mode 100644 vendor/orchestra/testbench-core/laravel/config/services.php create mode 100644 vendor/orchestra/testbench-core/laravel/config/session.php create mode 100644 vendor/orchestra/testbench-core/laravel/config/view.php create mode 100644 vendor/orchestra/testbench-core/laravel/database/.gitignore create mode 100644 vendor/orchestra/testbench-core/laravel/database/database.sqlite.example create mode 100644 vendor/orchestra/testbench-core/laravel/database/factories/.gitkeep create mode 100644 vendor/orchestra/testbench-core/laravel/database/migrations/.gitkeep create mode 100644 vendor/orchestra/testbench-core/laravel/migrations/2014_10_12_000000_create_users_table.php create mode 100644 vendor/orchestra/testbench-core/laravel/migrations/2014_10_12_100000_create_password_resets_table.php create mode 100644 vendor/orchestra/testbench-core/laravel/public/.gitignore create mode 100644 vendor/orchestra/testbench-core/laravel/resources/lang/en/auth.php create mode 100644 vendor/orchestra/testbench-core/laravel/resources/lang/en/pagination.php create mode 100644 vendor/orchestra/testbench-core/laravel/resources/lang/en/passwords.php create mode 100644 vendor/orchestra/testbench-core/laravel/resources/lang/en/validation.php create mode 100644 vendor/orchestra/testbench-core/laravel/resources/views/errors/503.blade.php create mode 100644 vendor/orchestra/testbench-core/laravel/resources/views/welcome.blade.php create mode 100644 vendor/orchestra/testbench-core/laravel/storage/app/.gitignore create mode 100644 vendor/orchestra/testbench-core/laravel/storage/framework/.gitignore create mode 100644 vendor/orchestra/testbench-core/laravel/storage/framework/cache/.gitignore create mode 100644 vendor/orchestra/testbench-core/laravel/storage/framework/data/.gitignore create mode 100644 vendor/orchestra/testbench-core/laravel/storage/framework/sessions/.gitignore create mode 100644 vendor/orchestra/testbench-core/laravel/storage/framework/testing/.gitignore create mode 100644 vendor/orchestra/testbench-core/laravel/storage/framework/views/.gitignore create mode 100644 vendor/orchestra/testbench-core/laravel/storage/logs/.gitignore create mode 100644 vendor/orchestra/testbench-core/laravel/vendor/.gitignore create mode 100644 vendor/orchestra/testbench-core/src/Bootstrap/LoadConfiguration.php create mode 100644 vendor/orchestra/testbench-core/src/Concerns/CreatesApplication.php create mode 100644 vendor/orchestra/testbench-core/src/Concerns/Testing.php create mode 100644 vendor/orchestra/testbench-core/src/Concerns/WithFactories.php create mode 100644 vendor/orchestra/testbench-core/src/Concerns/WithLaravelMigrations.php create mode 100644 vendor/orchestra/testbench-core/src/Concerns/WithLoadMigrationsFrom.php create mode 100644 vendor/orchestra/testbench-core/src/Console/Kernel.php create mode 100644 vendor/orchestra/testbench-core/src/Contracts/Laravel.php create mode 100644 vendor/orchestra/testbench-core/src/Contracts/TestCase.php create mode 100644 vendor/orchestra/testbench-core/src/Database/MigrateProcessor.php create mode 100644 vendor/orchestra/testbench-core/src/Exceptions/Handler.php create mode 100644 vendor/orchestra/testbench-core/src/Http/Kernel.php create mode 100644 vendor/orchestra/testbench-core/src/Http/Middleware/Authenticate.php create mode 100644 vendor/orchestra/testbench-core/src/Http/Middleware/RedirectIfAuthenticated.php create mode 100644 vendor/orchestra/testbench-core/src/Http/Middleware/TrimStrings.php create mode 100644 vendor/orchestra/testbench-core/src/Http/Middleware/TrustProxies.php create mode 100644 vendor/orchestra/testbench-core/src/Http/Middleware/VerifyCsrfToken.php create mode 100644 vendor/orchestra/testbench-core/src/TestCase.php create mode 100644 vendor/orchestra/testbench-core/src/Traits/CreatesApplication.php create mode 100644 vendor/orchestra/testbench/CHANGELOG-3.7.md create mode 100644 vendor/orchestra/testbench/composer.json create mode 100644 vendor/paragonie/random_compat/LICENSE create mode 100755 vendor/paragonie/random_compat/build-phar.sh create mode 100644 vendor/paragonie/random_compat/composer.json create mode 100644 vendor/paragonie/random_compat/dist/random_compat.phar.pubkey create mode 100644 vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc create mode 100644 vendor/paragonie/random_compat/lib/random.php create mode 100644 vendor/paragonie/random_compat/other/build_phar.php create mode 100644 vendor/paragonie/random_compat/psalm-autoload.php create mode 100644 vendor/paragonie/random_compat/psalm.xml create mode 100644 vendor/phar-io/manifest/.gitignore create mode 100644 vendor/phar-io/manifest/.php_cs create mode 100644 vendor/phar-io/manifest/.travis.yml create mode 100644 vendor/phar-io/manifest/LICENSE create mode 100644 vendor/phar-io/manifest/README.md create mode 100644 vendor/phar-io/manifest/build.xml create mode 100644 vendor/phar-io/manifest/composer.json create mode 100644 vendor/phar-io/manifest/composer.lock create mode 100644 vendor/phar-io/manifest/examples/example-01.php create mode 100644 vendor/phar-io/manifest/phive.xml create mode 100644 vendor/phar-io/manifest/phpunit.xml create mode 100644 vendor/phar-io/manifest/src/ManifestDocumentMapper.php create mode 100644 vendor/phar-io/manifest/src/ManifestLoader.php create mode 100644 vendor/phar-io/manifest/src/ManifestSerializer.php create mode 100644 vendor/phar-io/manifest/src/exceptions/Exception.php create mode 100644 vendor/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php create mode 100644 vendor/phar-io/manifest/src/exceptions/InvalidEmailException.php create mode 100644 vendor/phar-io/manifest/src/exceptions/InvalidUrlException.php create mode 100644 vendor/phar-io/manifest/src/exceptions/ManifestDocumentException.php create mode 100644 vendor/phar-io/manifest/src/exceptions/ManifestDocumentMapperException.php create mode 100644 vendor/phar-io/manifest/src/exceptions/ManifestElementException.php create mode 100644 vendor/phar-io/manifest/src/exceptions/ManifestLoaderException.php create mode 100644 vendor/phar-io/manifest/src/values/Application.php create mode 100644 vendor/phar-io/manifest/src/values/ApplicationName.php create mode 100644 vendor/phar-io/manifest/src/values/Author.php create mode 100644 vendor/phar-io/manifest/src/values/AuthorCollection.php create mode 100644 vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php create mode 100644 vendor/phar-io/manifest/src/values/BundledComponent.php create mode 100644 vendor/phar-io/manifest/src/values/BundledComponentCollection.php create mode 100644 vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php create mode 100644 vendor/phar-io/manifest/src/values/CopyrightInformation.php create mode 100644 vendor/phar-io/manifest/src/values/Email.php create mode 100644 vendor/phar-io/manifest/src/values/Extension.php create mode 100644 vendor/phar-io/manifest/src/values/Library.php create mode 100644 vendor/phar-io/manifest/src/values/License.php create mode 100644 vendor/phar-io/manifest/src/values/Manifest.php create mode 100644 vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php create mode 100644 vendor/phar-io/manifest/src/values/PhpVersionRequirement.php create mode 100644 vendor/phar-io/manifest/src/values/Requirement.php create mode 100644 vendor/phar-io/manifest/src/values/RequirementCollection.php create mode 100644 vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php create mode 100644 vendor/phar-io/manifest/src/values/Type.php create mode 100644 vendor/phar-io/manifest/src/values/Url.php create mode 100644 vendor/phar-io/manifest/src/xml/AuthorElement.php create mode 100644 vendor/phar-io/manifest/src/xml/AuthorElementCollection.php create mode 100644 vendor/phar-io/manifest/src/xml/BundlesElement.php create mode 100644 vendor/phar-io/manifest/src/xml/ComponentElement.php create mode 100644 vendor/phar-io/manifest/src/xml/ComponentElementCollection.php create mode 100644 vendor/phar-io/manifest/src/xml/ContainsElement.php create mode 100644 vendor/phar-io/manifest/src/xml/CopyrightElement.php create mode 100644 vendor/phar-io/manifest/src/xml/ElementCollection.php create mode 100644 vendor/phar-io/manifest/src/xml/ExtElement.php create mode 100644 vendor/phar-io/manifest/src/xml/ExtElementCollection.php create mode 100644 vendor/phar-io/manifest/src/xml/ExtensionElement.php create mode 100644 vendor/phar-io/manifest/src/xml/LicenseElement.php create mode 100644 vendor/phar-io/manifest/src/xml/ManifestDocument.php create mode 100644 vendor/phar-io/manifest/src/xml/ManifestDocumentLoadingException.php create mode 100644 vendor/phar-io/manifest/src/xml/ManifestElement.php create mode 100644 vendor/phar-io/manifest/src/xml/PhpElement.php create mode 100644 vendor/phar-io/manifest/src/xml/RequiresElement.php create mode 100644 vendor/phar-io/manifest/tests/ManifestDocumentMapperTest.php create mode 100644 vendor/phar-io/manifest/tests/ManifestLoaderTest.php create mode 100644 vendor/phar-io/manifest/tests/ManifestSerializerTest.php create mode 100644 vendor/phar-io/manifest/tests/_fixture/custom.xml create mode 100644 vendor/phar-io/manifest/tests/_fixture/extension-invalidcompatible.xml create mode 100644 vendor/phar-io/manifest/tests/_fixture/extension.xml create mode 100644 vendor/phar-io/manifest/tests/_fixture/invalidversion.xml create mode 100644 vendor/phar-io/manifest/tests/_fixture/invalidversionconstraint.xml create mode 100644 vendor/phar-io/manifest/tests/_fixture/library.xml create mode 100644 vendor/phar-io/manifest/tests/_fixture/manifest.xml create mode 100644 vendor/phar-io/manifest/tests/_fixture/phpunit-5.6.5.xml create mode 100644 vendor/phar-io/manifest/tests/_fixture/test.phar create mode 100644 vendor/phar-io/manifest/tests/exceptions/ManifestDocumentLoadingExceptionTest.php create mode 100644 vendor/phar-io/manifest/tests/values/ApplicationNameTest.php create mode 100644 vendor/phar-io/manifest/tests/values/ApplicationTest.php create mode 100644 vendor/phar-io/manifest/tests/values/AuthorCollectionTest.php create mode 100644 vendor/phar-io/manifest/tests/values/AuthorTest.php create mode 100644 vendor/phar-io/manifest/tests/values/BundledComponentCollectionTest.php create mode 100644 vendor/phar-io/manifest/tests/values/BundledComponentTest.php create mode 100644 vendor/phar-io/manifest/tests/values/CopyrightInformationTest.php create mode 100644 vendor/phar-io/manifest/tests/values/EmailTest.php create mode 100644 vendor/phar-io/manifest/tests/values/ExtensionTest.php create mode 100644 vendor/phar-io/manifest/tests/values/LibraryTest.php create mode 100644 vendor/phar-io/manifest/tests/values/LicenseTest.php create mode 100644 vendor/phar-io/manifest/tests/values/ManifestTest.php create mode 100644 vendor/phar-io/manifest/tests/values/PhpExtensionRequirementTest.php create mode 100644 vendor/phar-io/manifest/tests/values/PhpVersionRequirementTest.php create mode 100644 vendor/phar-io/manifest/tests/values/RequirementCollectionTest.php create mode 100644 vendor/phar-io/manifest/tests/values/UrlTest.php create mode 100644 vendor/phar-io/manifest/tests/xml/AuthorElementCollectionTest.php create mode 100644 vendor/phar-io/manifest/tests/xml/AuthorElementTest.php create mode 100644 vendor/phar-io/manifest/tests/xml/BundlesElementTest.php create mode 100644 vendor/phar-io/manifest/tests/xml/ComponentElementCollectionTest.php create mode 100644 vendor/phar-io/manifest/tests/xml/ComponentElementTest.php create mode 100644 vendor/phar-io/manifest/tests/xml/ContainsElementTest.php create mode 100644 vendor/phar-io/manifest/tests/xml/CopyrightElementTest.php create mode 100644 vendor/phar-io/manifest/tests/xml/ExtElementCollectionTest.php create mode 100644 vendor/phar-io/manifest/tests/xml/ExtElementTest.php create mode 100644 vendor/phar-io/manifest/tests/xml/ExtensionElementTest.php create mode 100644 vendor/phar-io/manifest/tests/xml/LicenseElementTest.php create mode 100644 vendor/phar-io/manifest/tests/xml/ManifestDocumentTest.php create mode 100644 vendor/phar-io/manifest/tests/xml/PhpElementTest.php create mode 100644 vendor/phar-io/manifest/tests/xml/RequiresElementTest.php create mode 100644 vendor/phar-io/version/.gitignore create mode 100644 vendor/phar-io/version/.php_cs create mode 100644 vendor/phar-io/version/.travis.yml create mode 100644 vendor/phar-io/version/CHANGELOG.md create mode 100644 vendor/phar-io/version/LICENSE create mode 100644 vendor/phar-io/version/README.md create mode 100644 vendor/phar-io/version/build.xml create mode 100644 vendor/phar-io/version/composer.json create mode 100644 vendor/phar-io/version/phive.xml create mode 100644 vendor/phar-io/version/phpunit.xml create mode 100644 vendor/phar-io/version/src/PreReleaseSuffix.php create mode 100644 vendor/phar-io/version/src/Version.php create mode 100644 vendor/phar-io/version/src/VersionConstraintParser.php create mode 100644 vendor/phar-io/version/src/VersionConstraintValue.php create mode 100644 vendor/phar-io/version/src/VersionNumber.php create mode 100644 vendor/phar-io/version/src/constraints/AbstractVersionConstraint.php create mode 100644 vendor/phar-io/version/src/constraints/AndVersionConstraintGroup.php create mode 100644 vendor/phar-io/version/src/constraints/AnyVersionConstraint.php create mode 100644 vendor/phar-io/version/src/constraints/ExactVersionConstraint.php create mode 100644 vendor/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php create mode 100644 vendor/phar-io/version/src/constraints/OrVersionConstraintGroup.php create mode 100644 vendor/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php create mode 100644 vendor/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php create mode 100644 vendor/phar-io/version/src/constraints/VersionConstraint.php create mode 100644 vendor/phar-io/version/src/exceptions/Exception.php create mode 100644 vendor/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php create mode 100644 vendor/phar-io/version/src/exceptions/InvalidVersionException.php create mode 100644 vendor/phar-io/version/src/exceptions/UnsupportedVersionConstraintException.php create mode 100644 vendor/phar-io/version/tests/Integration/VersionConstraintParserTest.php create mode 100644 vendor/phar-io/version/tests/Unit/AbstractVersionConstraintTest.php create mode 100644 vendor/phar-io/version/tests/Unit/AndVersionConstraintGroupTest.php create mode 100644 vendor/phar-io/version/tests/Unit/AnyVersionConstraintTest.php create mode 100644 vendor/phar-io/version/tests/Unit/ExactVersionConstraintTest.php create mode 100644 vendor/phar-io/version/tests/Unit/GreaterThanOrEqualToVersionConstraintTest.php create mode 100644 vendor/phar-io/version/tests/Unit/OrVersionConstraintGroupTest.php create mode 100644 vendor/phar-io/version/tests/Unit/PreReleaseSuffixTest.php create mode 100644 vendor/phar-io/version/tests/Unit/SpecificMajorAndMinorVersionConstraintTest.php create mode 100644 vendor/phar-io/version/tests/Unit/SpecificMajorVersionConstraintTest.php create mode 100644 vendor/phar-io/version/tests/Unit/VersionTest.php create mode 100644 vendor/php-http/guzzle6-adapter/CHANGELOG.md create mode 100644 vendor/php-http/guzzle6-adapter/LICENSE create mode 100644 vendor/php-http/guzzle6-adapter/README.md create mode 100644 vendor/php-http/guzzle6-adapter/composer.json create mode 100644 vendor/php-http/guzzle6-adapter/puli.json create mode 100644 vendor/php-http/guzzle6-adapter/src/Client.php create mode 100644 vendor/php-http/guzzle6-adapter/src/Promise.php create mode 100644 vendor/php-http/httplug/CHANGELOG.md create mode 100644 vendor/php-http/httplug/LICENSE create mode 100644 vendor/php-http/httplug/README.md create mode 100644 vendor/php-http/httplug/composer.json create mode 100644 vendor/php-http/httplug/puli.json create mode 100644 vendor/php-http/httplug/src/Exception.php create mode 100644 vendor/php-http/httplug/src/Exception/HttpException.php create mode 100644 vendor/php-http/httplug/src/Exception/NetworkException.php create mode 100644 vendor/php-http/httplug/src/Exception/RequestException.php create mode 100644 vendor/php-http/httplug/src/Exception/TransferException.php create mode 100644 vendor/php-http/httplug/src/HttpAsyncClient.php create mode 100644 vendor/php-http/httplug/src/HttpClient.php create mode 100644 vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php create mode 100644 vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php create mode 100644 vendor/php-http/promise/CHANGELOG.md create mode 100644 vendor/php-http/promise/LICENSE create mode 100644 vendor/php-http/promise/README.md create mode 100644 vendor/php-http/promise/composer.json create mode 100644 vendor/php-http/promise/src/FulfilledPromise.php create mode 100644 vendor/php-http/promise/src/Promise.php create mode 100644 vendor/php-http/promise/src/RejectedPromise.php create mode 100644 vendor/phpdocumentor/reflection-common/.travis.yml create mode 100644 vendor/phpdocumentor/reflection-common/LICENSE create mode 100644 vendor/phpdocumentor/reflection-common/README.md create mode 100644 vendor/phpdocumentor/reflection-common/composer.json create mode 100644 vendor/phpdocumentor/reflection-common/src/Element.php create mode 100644 vendor/phpdocumentor/reflection-common/src/File.php create mode 100644 vendor/phpdocumentor/reflection-common/src/Fqsen.php create mode 100644 vendor/phpdocumentor/reflection-common/src/Location.php create mode 100644 vendor/phpdocumentor/reflection-common/src/Project.php create mode 100644 vendor/phpdocumentor/reflection-common/src/ProjectFactory.php create mode 100644 vendor/phpdocumentor/reflection-docblock/.coveralls.yml create mode 100644 vendor/phpdocumentor/reflection-docblock/LICENSE create mode 100644 vendor/phpdocumentor/reflection-docblock/README.md create mode 100644 vendor/phpdocumentor/reflection-docblock/composer.json create mode 100644 vendor/phpdocumentor/reflection-docblock/easy-coding-standard.neon create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Description.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/DescriptionFactory.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/ExampleFinder.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Serializer.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/StandardTagFactory.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tag.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/TagFactory.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Author.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/BaseTag.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Covers.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Deprecated.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Example.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/StaticMethod.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/Strategy.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/AlignFormatter.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/PassthroughFormatter.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Generic.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Link.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Method.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Param.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Property.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyRead.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyWrite.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Fqsen.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Reference.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Url.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Return_.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/See.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Since.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Source.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Throws.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Uses.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Var_.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Version.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlockFactory.php create mode 100644 vendor/phpdocumentor/reflection-docblock/src/DocBlockFactoryInterface.php create mode 100644 vendor/phpdocumentor/type-resolver/LICENSE create mode 100644 vendor/phpdocumentor/type-resolver/README.md create mode 100644 vendor/phpdocumentor/type-resolver/composer.json create mode 100644 vendor/phpdocumentor/type-resolver/src/FqsenResolver.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Type.php create mode 100644 vendor/phpdocumentor/type-resolver/src/TypeResolver.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Array_.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Boolean.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Callable_.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Compound.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Context.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/ContextFactory.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Float_.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Integer.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Iterable_.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Mixed_.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Null_.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Nullable.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Object_.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Parent_.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Resource_.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Scalar.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Self_.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Static_.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/String_.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/This.php create mode 100644 vendor/phpdocumentor/type-resolver/src/Types/Void_.php create mode 100644 vendor/phpspec/prophecy/CHANGES.md create mode 100644 vendor/phpspec/prophecy/LICENSE create mode 100644 vendor/phpspec/prophecy/README.md create mode 100644 vendor/phpspec/prophecy/composer.json create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/ArgumentsWildcard.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValueToken.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValuesToken.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ApproximateValueToken.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayCountToken.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEntryToken.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEveryEntryToken.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/CallbackToken.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ExactValueToken.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/IdenticalValueToken.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalAndToken.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalNotToken.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ObjectStateToken.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/StringContainsToken.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/TokenInterface.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/TypeToken.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Call/Call.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Call/CallCenter.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Comparator/ClosureComparator.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Comparator/Factory.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Comparator/ProphecyComparator.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/CachedDoubler.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ClassPatchInterface.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/DisableConstructorPatch.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/HhvmExceptionPatch.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/KeywordPatch.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ProphecySubjectPatch.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatch.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/SplFileInfoPatch.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ThrowablePatch.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/TraversablePatch.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/DoubleInterface.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/Doubler.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCodeGenerator.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassMirror.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ArgumentNode.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ClassNode.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/MethodNode.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ReflectionInterface.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/TypeHintReference.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/LazyDouble.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Doubler/NameGenerator.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Call/UnexpectedCallException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassCreatorException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassMirrorException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassNotFoundException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/DoubleException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/DoublerException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/InterfaceNotFoundException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotExtendableException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotFoundException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ReturnByReferenceException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Exception.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/InvalidArgumentException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/AggregateException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/FailedPredictionException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/NoCallsException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/PredictionException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/UnexpectedCallsCountException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/UnexpectedCallsException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/MethodProphecyException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ObjectProphecyException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ProphecyException.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/ClassTagRetriever.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Prediction/CallPrediction.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Prediction/CallTimesPrediction.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Prediction/CallbackPrediction.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Prediction/NoCallsPrediction.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Prediction/PredictionInterface.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Promise/CallbackPromise.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Promise/PromiseInterface.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Promise/ReturnArgumentPromise.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Promise/ReturnPromise.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Promise/ThrowPromise.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Prophecy/ObjectProphecy.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Prophecy/ProphecyInterface.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Prophecy/ProphecySubjectInterface.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Prophecy/Revealer.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Prophecy/RevealerInterface.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Prophet.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Util/ExportUtil.php create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Util/StringUtil.php create mode 100644 vendor/phpunit/php-code-coverage/.gitattributes create mode 100644 vendor/phpunit/php-code-coverage/.github/CONTRIBUTING.md create mode 100644 vendor/phpunit/php-code-coverage/.github/ISSUE_TEMPLATE.md create mode 100644 vendor/phpunit/php-code-coverage/.github/stale.yml create mode 100644 vendor/phpunit/php-code-coverage/.gitignore create mode 100644 vendor/phpunit/php-code-coverage/.php_cs.dist create mode 100644 vendor/phpunit/php-code-coverage/.travis.yml create mode 100644 vendor/phpunit/php-code-coverage/ChangeLog-6.1.md create mode 100644 vendor/phpunit/php-code-coverage/LICENSE create mode 100644 vendor/phpunit/php-code-coverage/README.md create mode 100644 vendor/phpunit/php-code-coverage/build.xml create mode 100644 vendor/phpunit/php-code-coverage/composer.json create mode 100644 vendor/phpunit/php-code-coverage/phpunit.xml create mode 100644 vendor/phpunit/php-code-coverage/src/CodeCoverage.php create mode 100644 vendor/phpunit/php-code-coverage/src/Driver/Driver.php create mode 100644 vendor/phpunit/php-code-coverage/src/Driver/PHPDBG.php create mode 100644 vendor/phpunit/php-code-coverage/src/Driver/Xdebug.php create mode 100644 vendor/phpunit/php-code-coverage/src/Exception/CoveredCodeNotExecutedException.php create mode 100644 vendor/phpunit/php-code-coverage/src/Exception/Exception.php create mode 100644 vendor/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php create mode 100644 vendor/phpunit/php-code-coverage/src/Exception/MissingCoversAnnotationException.php create mode 100644 vendor/phpunit/php-code-coverage/src/Exception/RuntimeException.php create mode 100644 vendor/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php create mode 100644 vendor/phpunit/php-code-coverage/src/Filter.php create mode 100644 vendor/phpunit/php-code-coverage/src/Node/AbstractNode.php create mode 100644 vendor/phpunit/php-code-coverage/src/Node/Builder.php create mode 100644 vendor/phpunit/php-code-coverage/src/Node/Directory.php create mode 100644 vendor/phpunit/php-code-coverage/src/Node/File.php create mode 100644 vendor/phpunit/php-code-coverage/src/Node/Iterator.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Clover.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Crap4j.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Facade.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/coverage_bar.html.dist create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/bootstrap.min.css create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/custom.css create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/nv.d3.min.css create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/octicons.css create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/style.css create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/dashboard.html.dist create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/directory.html.dist create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/directory_item.html.dist create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/file.html.dist create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/file_item.html.dist create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/icons/file-code.svg create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/icons/file-directory.svg create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/bootstrap.min.js create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/d3.min.js create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/file.js create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/jquery.min.js create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/nv.d3.min.js create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/popper.min.js create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/method_item.html.dist create mode 100644 vendor/phpunit/php-code-coverage/src/Report/PHP.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Text.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Xml/BuildInformation.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Xml/Coverage.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Xml/Directory.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Xml/Facade.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Xml/File.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Xml/Method.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Xml/Node.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Xml/Project.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Xml/Report.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Xml/Source.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Xml/Tests.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Xml/Totals.php create mode 100644 vendor/phpunit/php-code-coverage/src/Report/Xml/Unit.php create mode 100644 vendor/phpunit/php-code-coverage/src/Util.php create mode 100644 vendor/phpunit/php-code-coverage/src/Version.php create mode 100644 vendor/phpunit/php-code-coverage/tests/TestCase.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/BankAccount-clover.xml create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/BankAccount-crap4j.xml create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/BankAccount-text.txt create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/BankAccount.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/BankAccountTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageClassExtendedTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageClassTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageFunctionParenthesesTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageFunctionParenthesesWhitespaceTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageFunctionTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageMethodOneLineAnnotationTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageMethodParenthesesTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageMethodParenthesesWhitespaceTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageMethodTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageNoneTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageNotPrivateTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageNotProtectedTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageNotPublicTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageNothingTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoveragePrivateTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageProtectedTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoveragePublicTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoverageTwoDefaultClassAnnotations.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoveredClass.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/CoveredFunction.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Crash.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/NamespaceCoverageClassExtendedTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/NamespaceCoverageClassTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/NamespaceCoverageCoversClassPublicTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/NamespaceCoverageCoversClassTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/NamespaceCoverageMethodTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/NamespaceCoverageNotPrivateTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/NamespaceCoverageNotProtectedTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/NamespaceCoverageNotPublicTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/NamespaceCoveragePrivateTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/NamespaceCoverageProtectedTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/NamespaceCoveragePublicTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/NamespaceCoveredClass.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/NotExistingCoveredElementTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForBankAccount/BankAccount.php.html create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForBankAccount/dashboard.html create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForBankAccount/index.html create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/dashboard.html create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/index.html create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.html create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/dashboard.html create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/index.html create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForBankAccount/BankAccount.php.xml create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForBankAccount/index.xml create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/index.xml create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.xml create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/index.xml create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/source_with_ignore.php.xml create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/class-with-anonymous-function-clover.xml create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/class-with-anonymous-function-crap4j.xml create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/class-with-anonymous-function-text.txt create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/ignored-lines-clover.xml create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/ignored-lines-crap4j.xml create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/ignored-lines-text.txt create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/source_with_class_and_anonymous_function.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/source_with_ignore.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/source_with_namespace.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/source_with_oneline_annotations.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/source_without_ignore.php create mode 100644 vendor/phpunit/php-code-coverage/tests/_files/source_without_namespace.php create mode 100644 vendor/phpunit/php-code-coverage/tests/bootstrap.php create mode 100644 vendor/phpunit/php-code-coverage/tests/tests/BuilderTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/tests/CloverTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/tests/CodeCoverageTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/tests/Crap4jTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/tests/FilterTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/tests/HTMLTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/tests/TextTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/tests/UtilTest.php create mode 100644 vendor/phpunit/php-code-coverage/tests/tests/XmlTest.php create mode 100644 vendor/phpunit/php-file-iterator/.gitattributes create mode 100644 vendor/phpunit/php-file-iterator/.github/stale.yml create mode 100644 vendor/phpunit/php-file-iterator/.gitignore create mode 100644 vendor/phpunit/php-file-iterator/.php_cs.dist create mode 100644 vendor/phpunit/php-file-iterator/.travis.yml create mode 100644 vendor/phpunit/php-file-iterator/ChangeLog.md create mode 100644 vendor/phpunit/php-file-iterator/LICENSE create mode 100644 vendor/phpunit/php-file-iterator/README.md create mode 100644 vendor/phpunit/php-file-iterator/composer.json create mode 100644 vendor/phpunit/php-file-iterator/phpunit.xml create mode 100644 vendor/phpunit/php-file-iterator/src/Facade.php create mode 100644 vendor/phpunit/php-file-iterator/src/Factory.php create mode 100644 vendor/phpunit/php-file-iterator/src/Iterator.php create mode 100644 vendor/phpunit/php-file-iterator/tests/FactoryTest.php create mode 100644 vendor/phpunit/php-text-template/.gitattributes create mode 100644 vendor/phpunit/php-text-template/.gitignore create mode 100644 vendor/phpunit/php-text-template/LICENSE create mode 100644 vendor/phpunit/php-text-template/README.md create mode 100644 vendor/phpunit/php-text-template/composer.json create mode 100644 vendor/phpunit/php-text-template/src/Template.php create mode 100644 vendor/phpunit/php-timer/.gitattributes create mode 100644 vendor/phpunit/php-timer/.gitignore create mode 100644 vendor/phpunit/php-timer/.php_cs.dist create mode 100644 vendor/phpunit/php-timer/.travis.yml create mode 100644 vendor/phpunit/php-timer/ChangeLog.md create mode 100644 vendor/phpunit/php-timer/LICENSE create mode 100644 vendor/phpunit/php-timer/README.md create mode 100644 vendor/phpunit/php-timer/build.xml create mode 100644 vendor/phpunit/php-timer/composer.json create mode 100644 vendor/phpunit/php-timer/phpunit.xml create mode 100644 vendor/phpunit/php-timer/src/Exception.php create mode 100644 vendor/phpunit/php-timer/src/RuntimeException.php create mode 100644 vendor/phpunit/php-timer/src/Timer.php create mode 100644 vendor/phpunit/php-timer/tests/TimerTest.php create mode 100644 vendor/phpunit/php-token-stream/.gitattributes create mode 100644 vendor/phpunit/php-token-stream/.github/stale.yml create mode 100644 vendor/phpunit/php-token-stream/.gitignore create mode 100644 vendor/phpunit/php-token-stream/.travis.yml create mode 100644 vendor/phpunit/php-token-stream/ChangeLog.md create mode 100644 vendor/phpunit/php-token-stream/LICENSE create mode 100644 vendor/phpunit/php-token-stream/README.md create mode 100644 vendor/phpunit/php-token-stream/build.xml create mode 100644 vendor/phpunit/php-token-stream/composer.json create mode 100644 vendor/phpunit/php-token-stream/phpunit.xml create mode 100644 vendor/phpunit/php-token-stream/src/Token.php create mode 100644 vendor/phpunit/php-token-stream/src/Token/Stream.php create mode 100644 vendor/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php create mode 100644 vendor/phpunit/php-token-stream/tests/Token/ClassTest.php create mode 100644 vendor/phpunit/php-token-stream/tests/Token/ClosureTest.php create mode 100644 vendor/phpunit/php-token-stream/tests/Token/FunctionTest.php create mode 100644 vendor/phpunit/php-token-stream/tests/Token/IncludeTest.php create mode 100644 vendor/phpunit/php-token-stream/tests/Token/InterfaceTest.php create mode 100644 vendor/phpunit/php-token-stream/tests/Token/NamespaceTest.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/classExtendsNamespacedClass.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/classInNamespace.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/classInScopedNamespace.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/classUsesNamespacedFunction.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_named_empty.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_that_declares_anonymous_class.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_that_declares_anonymous_class2.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/class_with_multiple_anonymous_classes_and_functions.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/closure.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/issue19.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/issue30.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/multipleNamespacesWithOneClassUsingBraces.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/multipleNamespacesWithOneClassUsingNonBraceSyntax.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/php-code-coverage-issue-424.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/source.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/source2.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/source3.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/source4.php create mode 100644 vendor/phpunit/php-token-stream/tests/_fixture/source5.php create mode 100644 vendor/phpunit/php-token-stream/tests/bootstrap.php create mode 100644 vendor/phpunit/phpunit/.editorconfig create mode 100644 vendor/phpunit/phpunit/.gitattributes create mode 100644 vendor/phpunit/phpunit/.github/CODE_OF_CONDUCT.md create mode 100644 vendor/phpunit/phpunit/.github/CONTRIBUTING.md create mode 100644 vendor/phpunit/phpunit/.github/ISSUE_TEMPLATE.md create mode 100644 vendor/phpunit/phpunit/.github/stale.yml create mode 100644 vendor/phpunit/phpunit/.gitignore create mode 100644 vendor/phpunit/phpunit/.phan/config.php create mode 100644 vendor/phpunit/phpunit/.php_cs.dist create mode 100644 vendor/phpunit/phpunit/.travis.yml create mode 100644 vendor/phpunit/phpunit/ChangeLog-6.5.md create mode 100644 vendor/phpunit/phpunit/ChangeLog-7.5.md create mode 100644 vendor/phpunit/phpunit/LICENSE create mode 100644 vendor/phpunit/phpunit/README.md create mode 100644 vendor/phpunit/phpunit/appveyor.yml create mode 100644 vendor/phpunit/phpunit/build.xml create mode 100644 vendor/phpunit/phpunit/composer.json create mode 100644 vendor/phpunit/phpunit/phive.xml create mode 100755 vendor/phpunit/phpunit/phpunit create mode 100644 vendor/phpunit/phpunit/phpunit.xml create mode 100644 vendor/phpunit/phpunit/phpunit.xsd create mode 100644 vendor/phpunit/phpunit/src/Exception.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Assert.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Assert/Functions.php create mode 100644 vendor/phpunit/phpunit/src/Framework/AssertionFailedError.php create mode 100644 vendor/phpunit/phpunit/src/Framework/CodeCoverageException.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/ArrayHasKey.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/ArraySubset.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/Attribute.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/Callback.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasAttribute.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasStaticAttribute.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/Composite.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/Count.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/DirectoryExists.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/Exception.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/ExceptionCode.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/ExceptionMessage.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/ExceptionMessageRegularExpression.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/FileExists.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/GreaterThan.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/IsAnything.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/IsEmpty.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/IsEqual.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/IsFalse.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/IsFinite.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/IsIdentical.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/IsInfinite.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/IsInstanceOf.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/IsJson.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/IsNan.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/IsNull.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/IsReadable.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/IsTrue.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/IsType.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/IsWritable.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/JsonMatches.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/JsonMatchesErrorMessageProvider.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/LessThan.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/LogicalAnd.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/LogicalNot.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/LogicalOr.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/LogicalXor.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/ObjectHasAttribute.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/RegularExpression.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/SameSize.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/StringContains.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/StringEndsWith.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/StringMatchesFormatDescription.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/StringStartsWith.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/TraversableContains.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Constraint/TraversableContainsOnly.php create mode 100644 vendor/phpunit/phpunit/src/Framework/CoveredCodeNotExecutedException.php create mode 100644 vendor/phpunit/phpunit/src/Framework/DataProviderTestSuite.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Error/Deprecated.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Error/Error.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Error/Notice.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Error/Warning.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Exception.php create mode 100644 vendor/phpunit/phpunit/src/Framework/ExceptionWrapper.php create mode 100644 vendor/phpunit/phpunit/src/Framework/ExpectationFailedException.php create mode 100644 vendor/phpunit/phpunit/src/Framework/IncompleteTest.php create mode 100644 vendor/phpunit/phpunit/src/Framework/IncompleteTestCase.php create mode 100644 vendor/phpunit/phpunit/src/Framework/IncompleteTestError.php create mode 100644 vendor/phpunit/phpunit/src/Framework/InvalidCoversTargetException.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MissingCoversAnnotationException.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Identity.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationMocker.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Match.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Builder/MethodNameMatch.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Builder/NamespaceMatch.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Stub.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Exception/BadMethodCallException.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Exception/Exception.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Exception/RuntimeException.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/ForwardCompatibility/MockObject.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Generator/deprecation.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_class.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_class_method.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_clone.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method_void.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_static_method.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method_void.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Generator/trait_class.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Generator/unmocked_clone.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_class.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_method.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Invocation/Invocation.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Invocation/ObjectInvocation.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Invocation/StaticInvocation.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/InvocationMocker.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Invokable.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Matcher.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/AnyInvokedCount.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/AnyParameters.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/ConsecutiveParameters.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/DeferredError.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/Invocation.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtIndex.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtLeastCount.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtLeastOnce.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtMostCount.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedCount.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedRecorder.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/MethodName.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/Parameters.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/StatelessInvocation.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/MockMethodSet.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/MockObject.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Stub.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ConsecutiveCalls.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Stub/Exception.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Stub/MatcherCollection.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnArgument.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnCallback.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnReference.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnSelf.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnStub.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnValueMap.php create mode 100644 vendor/phpunit/phpunit/src/Framework/MockObject/Verifiable.php create mode 100644 vendor/phpunit/phpunit/src/Framework/OutputError.php create mode 100644 vendor/phpunit/phpunit/src/Framework/RiskyTest.php create mode 100644 vendor/phpunit/phpunit/src/Framework/RiskyTestError.php create mode 100644 vendor/phpunit/phpunit/src/Framework/SelfDescribing.php create mode 100644 vendor/phpunit/phpunit/src/Framework/SkippedTest.php create mode 100644 vendor/phpunit/phpunit/src/Framework/SkippedTestCase.php create mode 100644 vendor/phpunit/phpunit/src/Framework/SkippedTestError.php create mode 100644 vendor/phpunit/phpunit/src/Framework/SkippedTestSuiteError.php create mode 100644 vendor/phpunit/phpunit/src/Framework/SyntheticError.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Test.php create mode 100644 vendor/phpunit/phpunit/src/Framework/TestCase.php create mode 100644 vendor/phpunit/phpunit/src/Framework/TestFailure.php create mode 100644 vendor/phpunit/phpunit/src/Framework/TestListener.php create mode 100644 vendor/phpunit/phpunit/src/Framework/TestListenerDefaultImplementation.php create mode 100644 vendor/phpunit/phpunit/src/Framework/TestResult.php create mode 100644 vendor/phpunit/phpunit/src/Framework/TestSuite.php create mode 100644 vendor/phpunit/phpunit/src/Framework/TestSuiteIterator.php create mode 100644 vendor/phpunit/phpunit/src/Framework/UnintentionallyCoveredCodeError.php create mode 100644 vendor/phpunit/phpunit/src/Framework/Warning.php create mode 100644 vendor/phpunit/phpunit/src/Framework/WarningTestCase.php create mode 100644 vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Exception.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Filter/ExcludeGroupFilterIterator.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Filter/Factory.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Filter/GroupFilterIterator.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Filter/IncludeGroupFilterIterator.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Filter/NameFilterIterator.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Hook/AfterIncompleteTestHook.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Hook/AfterLastTestHook.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Hook/AfterRiskyTestHook.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Hook/AfterSkippedTestHook.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Hook/AfterSuccessfulTestHook.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Hook/AfterTestErrorHook.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Hook/AfterTestFailureHook.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Hook/AfterTestHook.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Hook/AfterTestWarningHook.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Hook/BeforeFirstTestHook.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Hook/BeforeTestHook.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Hook/Hook.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Hook/TestHook.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Hook/TestListenerAdapter.php create mode 100644 vendor/phpunit/phpunit/src/Runner/PhptTestCase.php create mode 100644 vendor/phpunit/phpunit/src/Runner/ResultCacheExtension.php create mode 100644 vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php create mode 100644 vendor/phpunit/phpunit/src/Runner/TestSuiteLoader.php create mode 100644 vendor/phpunit/phpunit/src/Runner/TestSuiteSorter.php create mode 100644 vendor/phpunit/phpunit/src/Runner/Version.php create mode 100644 vendor/phpunit/phpunit/src/TextUI/Command.php create mode 100644 vendor/phpunit/phpunit/src/TextUI/ResultPrinter.php create mode 100644 vendor/phpunit/phpunit/src/TextUI/TestRunner.php create mode 100644 vendor/phpunit/phpunit/src/Util/Blacklist.php create mode 100644 vendor/phpunit/phpunit/src/Util/Configuration.php create mode 100644 vendor/phpunit/phpunit/src/Util/ConfigurationGenerator.php create mode 100644 vendor/phpunit/phpunit/src/Util/ErrorHandler.php create mode 100644 vendor/phpunit/phpunit/src/Util/FileLoader.php create mode 100644 vendor/phpunit/phpunit/src/Util/Filesystem.php create mode 100644 vendor/phpunit/phpunit/src/Util/Filter.php create mode 100644 vendor/phpunit/phpunit/src/Util/Getopt.php create mode 100644 vendor/phpunit/phpunit/src/Util/GlobalState.php create mode 100644 vendor/phpunit/phpunit/src/Util/InvalidArgumentHelper.php create mode 100644 vendor/phpunit/phpunit/src/Util/Json.php create mode 100644 vendor/phpunit/phpunit/src/Util/Log/JUnit.php create mode 100644 vendor/phpunit/phpunit/src/Util/Log/TeamCity.php create mode 100644 vendor/phpunit/phpunit/src/Util/NullTestResultCache.php create mode 100644 vendor/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php create mode 100644 vendor/phpunit/phpunit/src/Util/PHP/DefaultPhpProcess.php create mode 100644 vendor/phpunit/phpunit/src/Util/PHP/Template/PhptTestCase.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseClass.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseMethod.tpl.dist create mode 100644 vendor/phpunit/phpunit/src/Util/PHP/WindowsPhpProcess.php create mode 100644 vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php create mode 100644 vendor/phpunit/phpunit/src/Util/Printer.php create mode 100644 vendor/phpunit/phpunit/src/Util/RegularExpression.php create mode 100644 vendor/phpunit/phpunit/src/Util/Test.php create mode 100644 vendor/phpunit/phpunit/src/Util/TestDox/CliTestDoxPrinter.php create mode 100644 vendor/phpunit/phpunit/src/Util/TestDox/HtmlResultPrinter.php create mode 100644 vendor/phpunit/phpunit/src/Util/TestDox/NamePrettifier.php create mode 100644 vendor/phpunit/phpunit/src/Util/TestDox/ResultPrinter.php create mode 100644 vendor/phpunit/phpunit/src/Util/TestDox/TestResult.php create mode 100644 vendor/phpunit/phpunit/src/Util/TestDox/TextResultPrinter.php create mode 100644 vendor/phpunit/phpunit/src/Util/TestDox/XmlResultPrinter.php create mode 100644 vendor/phpunit/phpunit/src/Util/TestResultCache.php create mode 100644 vendor/phpunit/phpunit/src/Util/TestResultCacheInterface.php create mode 100644 vendor/phpunit/phpunit/src/Util/TextTestListRenderer.php create mode 100644 vendor/phpunit/phpunit/src/Util/Type.php create mode 100644 vendor/phpunit/phpunit/src/Util/XdebugFilterScriptGenerator.php create mode 100644 vendor/phpunit/phpunit/src/Util/Xml.php create mode 100644 vendor/phpunit/phpunit/src/Util/XmlTestListRenderer.php create mode 100644 vendor/phpunit/phpunit/tests/_files/3194.php create mode 100644 vendor/phpunit/phpunit/tests/_files/AbstractMockTestClass.php create mode 100644 vendor/phpunit/phpunit/tests/_files/AbstractTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/AbstractTrait.php create mode 100644 vendor/phpunit/phpunit/tests/_files/AnInterface.php create mode 100644 vendor/phpunit/phpunit/tests/_files/AnInterfaceWithReturnType.php create mode 100644 vendor/phpunit/phpunit/tests/_files/AnotherInterface.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ArrayAccessible.php create mode 100644 vendor/phpunit/phpunit/tests/_files/AssertionExample.php create mode 100644 vendor/phpunit/phpunit/tests/_files/AssertionExampleTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/Author.php create mode 100644 vendor/phpunit/phpunit/tests/_files/BankAccount.php create mode 100644 vendor/phpunit/phpunit/tests/_files/BankAccountTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/BankAccountTest.test.php create mode 100644 vendor/phpunit/phpunit/tests/_files/BankAccountTest2.php create mode 100644 vendor/phpunit/phpunit/tests/_files/Bar.php create mode 100644 vendor/phpunit/phpunit/tests/_files/BeforeAndAfterTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/BeforeClassAndAfterClassTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/BeforeClassWithOnlyDataProviderTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/Book.php create mode 100644 vendor/phpunit/phpunit/tests/_files/Calculator.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ChangeCurrentWorkingDirectoryTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ClassThatImplementsSerializable.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ClassWithAllPossibleReturnTypes.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ClassWithNonPublicAttributes.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ClassWithScalarTypeDeclarations.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ClassWithSelfTypeHint.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ClassWithStaticMethod.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ClassWithToString.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ClassWithVariadicArgumentMethod.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ClonedDependencyTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ConcreteTest.my.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ConcreteTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CountConstraint.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageClassExtendedTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageClassTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageCoversOverridesCoversNothingTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageFunctionParenthesesTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageFunctionParenthesesWhitespaceTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageFunctionTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageMethodOneLineAnnotationTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageMethodParenthesesTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageMethodParenthesesWhitespaceTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageMethodTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageNamespacedFunctionTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageNoneTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageNotPrivateTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageNotProtectedTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageNotPublicTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageNothingTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoveragePrivateTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageProtectedTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoveragePublicTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoverageTwoDefaultClassAnnotations.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoveredClass.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CoveredFunction.php create mode 100644 vendor/phpunit/phpunit/tests/_files/CustomPrinter.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DataProviderDebugTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DataProviderDependencyTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DataProviderFilterTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DataProviderIncompleteTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DataProviderIssue2833/FirstTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DataProviderIssue2833/SecondTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DataProviderIssue2859/phpunit.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/DataProviderIssue2859/tests/another/TestWithDataProviderTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DataProviderIssue2922/FirstTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DataProviderIssue2922/SecondTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DataProviderSkippedTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DataProviderTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DataProviderTestDoxTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DataproviderExecutionOrderTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DataproviderExecutionOrderTest_result_cache.txt create mode 100644 vendor/phpunit/phpunit/tests/_files/DependencyFailureTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DependencySuccessTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DependencyTestSuite.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DoNoAssertionTestCase.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DoesNotPerformAssertionsButPerformingAssertionsTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DoubleTestCase.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DummyBarTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DummyException.php create mode 100644 vendor/phpunit/phpunit/tests/_files/DummyFooTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/EmptyTestCaseTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ExampleTrait.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ExceptionInAssertPostConditionsTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ExceptionInAssertPreConditionsTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ExceptionInSetUpTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ExceptionInTearDownTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ExceptionInTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ExceptionInTestDetectedInTeardown.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ExceptionNamespaceTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ExceptionStackTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ExceptionTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ExceptionWithThrowable.php create mode 100644 vendor/phpunit/phpunit/tests/_files/Failure.php create mode 100644 vendor/phpunit/phpunit/tests/_files/FailureTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/FalsyConstraint.php create mode 100644 vendor/phpunit/phpunit/tests/_files/FatalTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/Foo.php create mode 100644 vendor/phpunit/phpunit/tests/_files/FunctionCallback.php create mode 100644 vendor/phpunit/phpunit/tests/_files/Go ogle-Sea.rch.wsdl create mode 100644 vendor/phpunit/phpunit/tests/_files/GoogleSearch.wsdl create mode 100644 vendor/phpunit/phpunit/tests/_files/IgnoreCodeCoverageClass.php create mode 100644 vendor/phpunit/phpunit/tests/_files/IgnoreCodeCoverageClassTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/IncompleteTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/Inheritance/InheritanceA.php create mode 100644 vendor/phpunit/phpunit/tests/_files/Inheritance/InheritanceB.php create mode 100644 vendor/phpunit/phpunit/tests/_files/InheritedTestCase.php create mode 100644 vendor/phpunit/phpunit/tests/_files/IniTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/InterfaceWithSemiReservedMethodName.php create mode 100644 vendor/phpunit/phpunit/tests/_files/InterfaceWithStaticMethod.php create mode 100644 vendor/phpunit/phpunit/tests/_files/IsolationTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/JsonData/arrayObject.json create mode 100644 vendor/phpunit/phpunit/tests/_files/JsonData/simpleObject.json create mode 100644 vendor/phpunit/phpunit/tests/_files/MethodCallback.php create mode 100644 vendor/phpunit/phpunit/tests/_files/MethodCallbackByReference.php create mode 100644 vendor/phpunit/phpunit/tests/_files/MockRunner.php create mode 100644 vendor/phpunit/phpunit/tests/_files/MockTestInterface.php create mode 100644 vendor/phpunit/phpunit/tests/_files/Mockable.php create mode 100644 vendor/phpunit/phpunit/tests/_files/MultiDependencyTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/MultiDependencyTest_result_cache.txt create mode 100644 vendor/phpunit/phpunit/tests/_files/MultipleDataProviderTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/MyCommand.php create mode 100644 vendor/phpunit/phpunit/tests/_files/MyTestListener.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NamedConstraint.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NamespaceCoverageClassExtendedTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NamespaceCoverageClassTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NamespaceCoverageCoversClassPublicTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NamespaceCoverageCoversClassTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NamespaceCoverageMethodTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NamespaceCoverageNotPrivateTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NamespaceCoverageNotProtectedTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NamespaceCoverageNotPublicTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NamespaceCoveragePrivateTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NamespaceCoverageProtectedTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NamespaceCoveragePublicTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NamespaceCoveredClass.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NamespaceCoveredFunction.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NoArgTestCaseTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NoTestCaseClass.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NoTestCases.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NonStatic.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NotExistingCoveredElementTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NotPublicTestCase.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NotSelfDescribingTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NotVoidTestCase.php create mode 100644 vendor/phpunit/phpunit/tests/_files/NothingTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/OneTestCase.php create mode 100644 vendor/phpunit/phpunit/tests/_files/OutputTestCase.php create mode 100644 vendor/phpunit/phpunit/tests/_files/OverrideTestCase.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ParseTestMethodAnnotationsMock.php create mode 100644 vendor/phpunit/phpunit/tests/_files/PartialMockTestClass.php create mode 100644 vendor/phpunit/phpunit/tests/_files/RequirementsClassBeforeClassHookTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/RequirementsClassDocBlockTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/RequirementsTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/RouterTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/SampleArrayAccess.php create mode 100644 vendor/phpunit/phpunit/tests/_files/SampleClass.php create mode 100644 vendor/phpunit/phpunit/tests/_files/Singleton.php create mode 100644 vendor/phpunit/phpunit/tests/_files/SingletonClass.php create mode 100644 vendor/phpunit/phpunit/tests/_files/SomeClass.php create mode 100644 vendor/phpunit/phpunit/tests/_files/StackTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/StaticMockTestClass.php create mode 100644 vendor/phpunit/phpunit/tests/_files/StatusTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/StopOnErrorTestSuite.php create mode 100644 vendor/phpunit/phpunit/tests/_files/StopOnWarningTestSuite.php create mode 100644 vendor/phpunit/phpunit/tests/_files/StopsOnWarningTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/StringableClass.php create mode 100644 vendor/phpunit/phpunit/tests/_files/Struct.php create mode 100644 vendor/phpunit/phpunit/tests/_files/Success.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TemplateMethodsTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TestAutoreferenced.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TestDoxGroupTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TestGeneratorMaker.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TestIncomplete.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TestIterator.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TestIterator2.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TestIteratorAggregate.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TestIteratorAggregate2.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TestRisky.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TestSkipped.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TestTestError.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TestWarning.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TestWithTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TestableCliTestDoxPrinter.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ThrowExceptionTestCase.php create mode 100644 vendor/phpunit/phpunit/tests/_files/ThrowNoExceptionTestCase.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TraversableMockTestInterface.php create mode 100644 vendor/phpunit/phpunit/tests/_files/TruthyConstraint.php create mode 100644 vendor/phpunit/phpunit/tests/_files/VariousIterableDataProviderTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/WasRun.php create mode 100644 vendor/phpunit/phpunit/tests/_files/WrapperIteratorAggregate.php create mode 100644 vendor/phpunit/phpunit/tests/_files/bar.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration.colors.empty.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration.colors.false.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration.colors.invalid.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration.colors.true.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration.columns.default.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration.custom-printer.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration.defaulttestsuite.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration.one-file-suite.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration.suites.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration_empty.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration_execution_order_options.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration_stop_on_defect.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration_stop_on_error.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration_stop_on_incomplete.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration_stop_on_warning.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration_whitelist.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/configuration_xinclude.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/expectedFileFormat.txt create mode 100644 vendor/phpunit/phpunit/tests/_files/foo.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/phpt-for-coverage.phpt create mode 100644 vendor/phpunit/phpunit/tests/_files/phpt-xfail.phpt create mode 100644 vendor/phpunit/phpunit/tests/_files/phpunit-example-extension/phpunit.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/phpunit-example-extension/tests/OneTest.php create mode 100644 vendor/phpunit/phpunit/tests/_files/phpunit-example-extension/tools/phpunit.d/phpunit-example-extension-3.0.3.phar create mode 100644 vendor/phpunit/phpunit/tests/_files/structureAttributesAreSameButValuesAreNot.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/structureExpected.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/structureIgnoreTextNodes.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/structureIsSameButDataIsNot.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/structureWrongNumberOfAttributes.xml create mode 100644 vendor/phpunit/phpunit/tests/_files/structureWrongNumberOfNodes.xml create mode 100644 vendor/phpunit/phpunit/tests/bootstrap.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/_files/Extension.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/_files/HookTest.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/_files/NullPrinter.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/_files/expect_external.txt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/_files/hooks.xml create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/_files/phpt-env.expected.txt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/_files/phpt_external.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/abstract-test-class.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/assertion.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/cache-result.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/code-coverage-ignore.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/code-coverage-phpt.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/colors-always.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/concrete-test-class.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/custom-printer-debug.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/custom-printer-verbose.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/dataprovider-debug.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/dataprovider-issue-2833.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/dataprovider-issue-2859.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/dataprovider-issue-2922.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/dataprovider-log-xml-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/dataprovider-log-xml.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/dataprovider-testdox.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/debug.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/default-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/default.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/defaulttestsuite-using-testsuite.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/defaulttestsuite.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/defects-first-order-via-cli.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/dependencies-clone.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/dependencies-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/dependencies.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/dependencies2-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/dependencies2.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/dependencies3-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/dependencies3.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/disable-code-coverage-ignore.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/dump-xdebug-filter.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/empty-testcase.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/exception-stack.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/exclude-group-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/exclude-group.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/execution-order-options-via-config.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/failure-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/failure-reverse-list.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/failure.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/fatal-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-class-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-class.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-classname-and-range-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-classname-and-range.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-number-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-number.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-only-range-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-only-range.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-only-regexp-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-only-regexp.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-only-string-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-only-string.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-range-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-range.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-regexp-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-regexp.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-string-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-dataprovider-by-string.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-method-case-insensitive.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-method-case-sensitive-no-result.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-method-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-method.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/filter-no-results.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/forward-compatibility.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/group-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/group.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/help.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/help2.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/hooks.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/ini-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/list-groups.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/list-suites.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/list-tests-dataprovider.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/list-tests-xml-dataprovider.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/log-junit-phpt.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/log-junit.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/log-teamcity-phpt.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/log-teamcity.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/232.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/3154_namespaced_constant_resolving.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/397.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/abstract_class.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/class.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/class_call_parent_clone.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/class_call_parent_constructor.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/class_dont_call_parent_clone.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/class_dont_call_parent_constructor.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/class_implementing_interface_call_parent_constructor.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/class_implementing_interface_dont_call_parent_constructor.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/class_nonexistent_method.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/class_partial.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/class_with_deprecated_method.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/class_with_final_method.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/class_with_method_named_method.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/class_with_method_with_nullable_typehinted_variadic_arguments.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/class_with_method_with_typehinted_variadic_arguments.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/class_with_method_with_variadic_arguments.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/constant_as_parameter_default_value.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/interface.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/invocation_object_clone_object.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/namespaced_class.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/namespaced_class_call_parent_clone.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/namespaced_class_call_parent_constructor.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/namespaced_class_dont_call_parent_clone.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/namespaced_class_dont_call_parent_constructor.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/namespaced_class_implementing_interface_call_parent_constructor.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/namespaced_class_implementing_interface_dont_call_parent_constructor.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/namespaced_class_partial.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/namespaced_interface.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/nonexistent_class.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/nonexistent_class_with_namespace.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/nonexistent_class_with_namespace_starting_with_separator.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/nullable_types.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/proxy.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/return_type_declarations_closure.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/return_type_declarations_final.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/return_type_declarations_generator.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/return_type_declarations_nullable.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/return_type_declarations_object_method.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/return_type_declarations_parent.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/return_type_declarations_self.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/return_type_declarations_static_method.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/return_type_declarations_void.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/scalar_type_declarations.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/wsdl_class.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/wsdl_class_namespace.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/generator/wsdl_class_partial.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/call_original.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/call_original_with_argument.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/call_original_with_argument_variadic.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/call_original_with_return_type_void.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/clone_method_arguments.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/deprecated_with_description.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/deprecated_without_description.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/private_method.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/protected_method.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/return_by_reference.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/return_by_reference_with_return_type.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/return_type.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/return_type_parent.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/return_type_self.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/static_method.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/static_method_with_return_type.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/with_argument.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/with_argument_default.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/with_argument_default_constant.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/with_argument_default_null.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/with_argument_nullable.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/with_argument_reference.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/with_argument_typed_array.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/with_argument_typed_callable.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/with_argument_typed_class.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/with_argument_typed_scalar.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/with_argument_typed_self.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/with_argument_typed_unkown_class.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/with_argument_typed_variadic.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/with_argument_variadic.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mock-objects/mock-method/with_arguments.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/mycommand.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/options-after-arguments.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/order-by-default-invalid-via-cli.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/output-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/phar-extension-suppressed.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/phar-extension.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/phpt-args.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/phpt-env.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/phpt-external.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/phpt-stderr.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/phpt-stdin.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/phpt-xfail.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1149.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1149/Issue1149Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1216.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1216/Issue1216Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1216/bootstrap1216.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1216/phpunit1216.xml create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1265.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1265/Issue1265Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1265/phpunit1265.xml create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1330.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1330/Issue1330Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1330/phpunit1330.xml create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1335.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1335/Issue1335Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1335/bootstrap1335.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1337.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1337/Issue1337Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1348.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1348/Issue1348Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1351.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1351/ChildProcessClass1351.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1351/Issue1351Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1374.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1374/Issue1374Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1437.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1437/Issue1437Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1468.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1468/Issue1468Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1471.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1471/Issue1471Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1472.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1472/Issue1472Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1570.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/1570/Issue1570Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2085-enforce-time-limit-options-via-config-without-invoker.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2085-without-invoker.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2085.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2085/Issue2085Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2085/configuration_enforce_time_limit_options.xml create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2137-filter.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2137-no_filter.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2137/Issue2137Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2145.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2145/Issue2145Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2158.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2158/Issue2158Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2158/constant.inc create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2366.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2366/Issue2366Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2380.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2380/Issue2380Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2382.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2382/Issue2382Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2435.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2435/Issue2435Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/244.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/244/Issue244Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2448-existing-test.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2448-not-existing-test.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2448/.gitignore create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2448/Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2591-separate-class-preserve-no-bootstrap.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2591-separate-class-preserve.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2591-separate-function-no-preserve-no-bootstrap-php73.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2591-separate-function-no-preserve-no-bootstrap-xdebug.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2591-separate-function-no-preserve-no-bootstrap.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2591-separate-function-no-preserve.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2591-separate-function-preserve.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2591/SeparateClassPreserveTest.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2591/SeparateFunctionNoPreserveTest.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2591/SeparateFunctionPreserveTest.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2591/bootstrapNoBootstrap.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2591/bootstrapWithBootstrap.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2591/bootstrapWithBootstrapNoGlobal.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2724-diff-pid-from-master-process.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2724/SeparateClassRunMethodInNewProcessTest.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2725-separate-class-before-after-pid.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2725/BeforeAfterClassPidTest.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2731.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2731/Issue2731Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2811.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2811/Issue2811Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2830.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2830/Issue2830Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2972.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2972/issue-2972-test.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/2972/unconventiallyNamedIssue2972Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3093/Issue3093Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3093/issue-3093-test.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3107/Issue3107Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3107/issue-3107-test.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3156/Issue3156Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/322.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/322/Issue322Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/322/phpunit322.xml create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3364/issue-3364-test.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3364/tests/Issue3364SetupBeforeClassTest.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3364/tests/Issue3364SetupTest.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3379.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3379/Issue3379Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3379/Issue3379TestListener.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3379/phpunit.xml create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3380/issue-3380-test.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3396/issue-3396-test.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/433.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/433/Issue433Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/445.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/445/Issue445Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/498.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/498/Issue498Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/503.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/503/Issue503Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/581.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/581/Issue581Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/74.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/74/Issue74Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/74/NewException.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/765.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/765/Issue765Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/797.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/797/Issue797Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/797/bootstrap797.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/863.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/873.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/873/Issue873Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/Trac/1021.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/Trac/1021/Issue1021Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/Trac/523.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/Trac/523/Issue523Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/Trac/578.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/Trac/578/Issue578Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/Trac/684.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/Trac/684/Issue684Test.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/Trac/783.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/Trac/783/ChildSuite.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/Trac/783/OneTest.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/Trac/783/ParentSuite.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/regression/Trac/783/TwoTest.php create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/repeat.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/report-tests-performing-assertions-when-annotated-with-does-not-perform-assertions.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/report-useless-tests-incomplete.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/report-useless-tests-isolation.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/report-useless-tests.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/stop-on-defect-via-cli.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/stop-on-defect-via-config.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/stop-on-error-via-cli.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/stop-on-error-via-config.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/stop-on-incomplete-via-cli.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/stop-on-incomplete-via-config.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/stop-on-warning-via-cli.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/stop-on-warning-via-config.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/teamcity-inner-exceptions.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/teamcity.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/test-order-randomized-seed-with-dependency-resolution.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/test-order-randomized-with-dependency-resolution.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/test-order-reversed-with-dependency-resolution.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/test-order-reversed-without-dependency-resolution.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/test-suffix-multiple.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/test-suffix-single.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/testdox-dataprovider-placeholder.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/testdox-exclude-group.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/testdox-group.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/testdox-html.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/testdox-text.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/testdox-verbose.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/testdox-xml.phpt create mode 100644 vendor/phpunit/phpunit/tests/end-to-end/testdox.phpt create mode 100644 vendor/phpunit/phpunit/tests/fail/fail.phpt create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/AssertTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/ArrayHasKeyTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/ArraySubsetTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/AttributeTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/CallbackTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/ClassHasAttributeTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/ClassHasStaticAttributeTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/ConstraintTestCase.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/CountTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/DirectoryExistsTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/ExceptionMessageRegExpTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/ExceptionMessageTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/FileExistsTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/GreaterThanTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/IsEmptyTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/IsEqualTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/IsIdenticalTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/IsInstanceOfTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/IsJsonTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/IsNullTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/IsReadableTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/IsTypeTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/IsWritableTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/JsonMatchesErrorMessageProviderTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/JsonMatchesTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/LessThanTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/LogicalAndTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/LogicalOrTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/LogicalXorTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/ObjectHasAttributeTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/RegularExpressionTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/SameSizeTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/StringContainsTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/StringEndsWithTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/StringMatchesFormatDescriptionTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/StringStartsWithTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/Constraint/TraversableContainsTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/ConstraintTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/ExceptionWrapperTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/MockObject/Builder/InvocationMockerTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/MockObject/GeneratorTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/MockObject/Invocation/ObjectInvocationTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/MockObject/Invocation/StaticInvocationTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/MockObject/Matcher/ConsecutiveParametersTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/MockObject/MockBuilderTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/MockObject/MockMethodTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/MockObject/MockObjectTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/MockObject/ProxyObjectTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/TestCaseTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/TestFailureTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/TestImplementorTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/TestListenerTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/TestResultTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Framework/TestSuiteTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Runner/Filter/NameFilterIteratorTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Runner/PhptTestCaseTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Runner/ResultCacheExtensionTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Runner/TestSuiteSorterTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/TextUI/TestRunnerTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Util/ConfigurationGeneratorTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Util/ConfigurationTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Util/GetoptTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Util/GlobalStateTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Util/JsonTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Util/NullTestResultCacheTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Util/PHP/AbstractPhpProcessTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Util/RegularExpressionTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Util/TestDox/CliTestDoxPrinterTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Util/TestDox/NamePrettifierTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Util/TestResultCacheTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Util/TestTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Util/XDebugFilterScriptGeneratorTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Util/XmlTest.php create mode 100644 vendor/phpunit/phpunit/tests/unit/Util/_files/expectedXDebugFilterScript.txt create mode 100644 vendor/psr/container/.gitignore create mode 100644 vendor/psr/container/LICENSE create mode 100644 vendor/psr/container/README.md create mode 100644 vendor/psr/container/composer.json create mode 100644 vendor/psr/container/src/ContainerExceptionInterface.php create mode 100644 vendor/psr/container/src/ContainerInterface.php create mode 100644 vendor/psr/container/src/NotFoundExceptionInterface.php create mode 100644 vendor/psr/http-message/CHANGELOG.md create mode 100644 vendor/psr/http-message/LICENSE create mode 100644 vendor/psr/http-message/README.md create mode 100644 vendor/psr/http-message/composer.json create mode 100644 vendor/psr/http-message/src/MessageInterface.php create mode 100644 vendor/psr/http-message/src/RequestInterface.php create mode 100644 vendor/psr/http-message/src/ResponseInterface.php create mode 100644 vendor/psr/http-message/src/ServerRequestInterface.php create mode 100644 vendor/psr/http-message/src/StreamInterface.php create mode 100644 vendor/psr/http-message/src/UploadedFileInterface.php create mode 100644 vendor/psr/http-message/src/UriInterface.php create mode 100644 vendor/psr/log/.gitignore create mode 100644 vendor/psr/log/LICENSE create mode 100644 vendor/psr/log/Psr/Log/AbstractLogger.php create mode 100644 vendor/psr/log/Psr/Log/InvalidArgumentException.php create mode 100644 vendor/psr/log/Psr/Log/LogLevel.php create mode 100644 vendor/psr/log/Psr/Log/LoggerAwareInterface.php create mode 100644 vendor/psr/log/Psr/Log/LoggerAwareTrait.php create mode 100644 vendor/psr/log/Psr/Log/LoggerInterface.php create mode 100644 vendor/psr/log/Psr/Log/LoggerTrait.php create mode 100644 vendor/psr/log/Psr/Log/NullLogger.php create mode 100644 vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php create mode 100644 vendor/psr/log/Psr/Log/Test/TestLogger.php create mode 100644 vendor/psr/log/README.md create mode 100644 vendor/psr/log/composer.json create mode 100644 vendor/psr/simple-cache/.editorconfig create mode 100644 vendor/psr/simple-cache/LICENSE.md create mode 100644 vendor/psr/simple-cache/README.md create mode 100644 vendor/psr/simple-cache/composer.json create mode 100644 vendor/psr/simple-cache/src/CacheException.php create mode 100644 vendor/psr/simple-cache/src/CacheInterface.php create mode 100644 vendor/psr/simple-cache/src/InvalidArgumentException.php create mode 100644 vendor/ralouphie/getallheaders/.gitignore create mode 100644 vendor/ralouphie/getallheaders/.travis.yml create mode 100644 vendor/ralouphie/getallheaders/LICENSE create mode 100644 vendor/ralouphie/getallheaders/README.md create mode 100644 vendor/ralouphie/getallheaders/composer.json create mode 100644 vendor/ralouphie/getallheaders/phpunit.xml create mode 100644 vendor/ralouphie/getallheaders/src/getallheaders.php create mode 100644 vendor/ralouphie/getallheaders/tests/GetAllHeadersTest.php create mode 100644 vendor/ramsey/uuid/CHANGELOG.md create mode 100644 vendor/ramsey/uuid/CODE_OF_CONDUCT.md create mode 100644 vendor/ramsey/uuid/CONTRIBUTING.md create mode 100644 vendor/ramsey/uuid/LICENSE create mode 100644 vendor/ramsey/uuid/README.md create mode 100644 vendor/ramsey/uuid/composer.json create mode 100644 vendor/ramsey/uuid/src/BinaryUtils.php create mode 100644 vendor/ramsey/uuid/src/Builder/DefaultUuidBuilder.php create mode 100644 vendor/ramsey/uuid/src/Builder/DegradedUuidBuilder.php create mode 100644 vendor/ramsey/uuid/src/Builder/UuidBuilderInterface.php create mode 100644 vendor/ramsey/uuid/src/Codec/CodecInterface.php create mode 100644 vendor/ramsey/uuid/src/Codec/GuidStringCodec.php create mode 100644 vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php create mode 100644 vendor/ramsey/uuid/src/Codec/StringCodec.php create mode 100644 vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php create mode 100644 vendor/ramsey/uuid/src/Codec/TimestampLastCombCodec.php create mode 100644 vendor/ramsey/uuid/src/Converter/Number/BigNumberConverter.php create mode 100644 vendor/ramsey/uuid/src/Converter/Number/DegradedNumberConverter.php create mode 100644 vendor/ramsey/uuid/src/Converter/NumberConverterInterface.php create mode 100644 vendor/ramsey/uuid/src/Converter/Time/BigNumberTimeConverter.php create mode 100644 vendor/ramsey/uuid/src/Converter/Time/DegradedTimeConverter.php create mode 100644 vendor/ramsey/uuid/src/Converter/Time/PhpTimeConverter.php create mode 100644 vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php create mode 100644 vendor/ramsey/uuid/src/DegradedUuid.php create mode 100644 vendor/ramsey/uuid/src/Exception/InvalidUuidStringException.php create mode 100644 vendor/ramsey/uuid/src/Exception/UnsatisfiedDependencyException.php create mode 100644 vendor/ramsey/uuid/src/Exception/UnsupportedOperationException.php create mode 100644 vendor/ramsey/uuid/src/FeatureSet.php create mode 100644 vendor/ramsey/uuid/src/Generator/CombGenerator.php create mode 100644 vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php create mode 100644 vendor/ramsey/uuid/src/Generator/MtRandGenerator.php create mode 100644 vendor/ramsey/uuid/src/Generator/OpenSslGenerator.php create mode 100644 vendor/ramsey/uuid/src/Generator/PeclUuidRandomGenerator.php create mode 100644 vendor/ramsey/uuid/src/Generator/PeclUuidTimeGenerator.php create mode 100644 vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php create mode 100644 vendor/ramsey/uuid/src/Generator/RandomGeneratorFactory.php create mode 100644 vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php create mode 100644 vendor/ramsey/uuid/src/Generator/RandomLibAdapter.php create mode 100644 vendor/ramsey/uuid/src/Generator/SodiumRandomGenerator.php create mode 100644 vendor/ramsey/uuid/src/Generator/TimeGeneratorFactory.php create mode 100644 vendor/ramsey/uuid/src/Generator/TimeGeneratorInterface.php create mode 100644 vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php create mode 100644 vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php create mode 100644 vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php create mode 100644 vendor/ramsey/uuid/src/Provider/NodeProviderInterface.php create mode 100644 vendor/ramsey/uuid/src/Provider/Time/FixedTimeProvider.php create mode 100644 vendor/ramsey/uuid/src/Provider/Time/SystemTimeProvider.php create mode 100644 vendor/ramsey/uuid/src/Provider/TimeProviderInterface.php create mode 100644 vendor/ramsey/uuid/src/Uuid.php create mode 100644 vendor/ramsey/uuid/src/UuidFactory.php create mode 100644 vendor/ramsey/uuid/src/UuidFactoryInterface.php create mode 100644 vendor/ramsey/uuid/src/UuidInterface.php create mode 100644 vendor/sebastian/code-unit-reverse-lookup/.gitignore create mode 100644 vendor/sebastian/code-unit-reverse-lookup/.php_cs create mode 100644 vendor/sebastian/code-unit-reverse-lookup/.travis.yml create mode 100644 vendor/sebastian/code-unit-reverse-lookup/ChangeLog.md create mode 100644 vendor/sebastian/code-unit-reverse-lookup/LICENSE create mode 100644 vendor/sebastian/code-unit-reverse-lookup/README.md create mode 100644 vendor/sebastian/code-unit-reverse-lookup/build.xml create mode 100644 vendor/sebastian/code-unit-reverse-lookup/composer.json create mode 100644 vendor/sebastian/code-unit-reverse-lookup/phpunit.xml create mode 100644 vendor/sebastian/code-unit-reverse-lookup/src/Wizard.php create mode 100644 vendor/sebastian/code-unit-reverse-lookup/tests/WizardTest.php create mode 100644 vendor/sebastian/comparator/.github/stale.yml create mode 100644 vendor/sebastian/comparator/.gitignore create mode 100644 vendor/sebastian/comparator/.php_cs.dist create mode 100644 vendor/sebastian/comparator/.travis.yml create mode 100644 vendor/sebastian/comparator/ChangeLog.md create mode 100644 vendor/sebastian/comparator/LICENSE create mode 100644 vendor/sebastian/comparator/README.md create mode 100644 vendor/sebastian/comparator/build.xml create mode 100644 vendor/sebastian/comparator/composer.json create mode 100644 vendor/sebastian/comparator/phpunit.xml create mode 100644 vendor/sebastian/comparator/src/ArrayComparator.php create mode 100644 vendor/sebastian/comparator/src/Comparator.php create mode 100644 vendor/sebastian/comparator/src/ComparisonFailure.php create mode 100644 vendor/sebastian/comparator/src/DOMNodeComparator.php create mode 100644 vendor/sebastian/comparator/src/DateTimeComparator.php create mode 100644 vendor/sebastian/comparator/src/DoubleComparator.php create mode 100644 vendor/sebastian/comparator/src/ExceptionComparator.php create mode 100644 vendor/sebastian/comparator/src/Factory.php create mode 100644 vendor/sebastian/comparator/src/MockObjectComparator.php create mode 100644 vendor/sebastian/comparator/src/NumericComparator.php create mode 100644 vendor/sebastian/comparator/src/ObjectComparator.php create mode 100644 vendor/sebastian/comparator/src/ResourceComparator.php create mode 100644 vendor/sebastian/comparator/src/ScalarComparator.php create mode 100644 vendor/sebastian/comparator/src/SplObjectStorageComparator.php create mode 100644 vendor/sebastian/comparator/src/TypeComparator.php create mode 100644 vendor/sebastian/comparator/tests/ArrayComparatorTest.php create mode 100644 vendor/sebastian/comparator/tests/ComparisonFailureTest.php create mode 100644 vendor/sebastian/comparator/tests/DOMNodeComparatorTest.php create mode 100644 vendor/sebastian/comparator/tests/DateTimeComparatorTest.php create mode 100644 vendor/sebastian/comparator/tests/DoubleComparatorTest.php create mode 100644 vendor/sebastian/comparator/tests/ExceptionComparatorTest.php create mode 100644 vendor/sebastian/comparator/tests/FactoryTest.php create mode 100644 vendor/sebastian/comparator/tests/MockObjectComparatorTest.php create mode 100644 vendor/sebastian/comparator/tests/NumericComparatorTest.php create mode 100644 vendor/sebastian/comparator/tests/ObjectComparatorTest.php create mode 100644 vendor/sebastian/comparator/tests/ResourceComparatorTest.php create mode 100644 vendor/sebastian/comparator/tests/ScalarComparatorTest.php create mode 100644 vendor/sebastian/comparator/tests/SplObjectStorageComparatorTest.php create mode 100644 vendor/sebastian/comparator/tests/TypeComparatorTest.php create mode 100644 vendor/sebastian/comparator/tests/_fixture/Author.php create mode 100644 vendor/sebastian/comparator/tests/_fixture/Book.php create mode 100644 vendor/sebastian/comparator/tests/_fixture/ClassWithToString.php create mode 100644 vendor/sebastian/comparator/tests/_fixture/SampleClass.php create mode 100644 vendor/sebastian/comparator/tests/_fixture/Struct.php create mode 100644 vendor/sebastian/comparator/tests/_fixture/TestClass.php create mode 100644 vendor/sebastian/comparator/tests/_fixture/TestClassComparator.php create mode 100644 vendor/sebastian/diff/.github/stale.yml create mode 100644 vendor/sebastian/diff/.gitignore create mode 100644 vendor/sebastian/diff/.php_cs.dist create mode 100644 vendor/sebastian/diff/.travis.yml create mode 100644 vendor/sebastian/diff/ChangeLog.md create mode 100644 vendor/sebastian/diff/LICENSE create mode 100644 vendor/sebastian/diff/README.md create mode 100644 vendor/sebastian/diff/build.xml create mode 100644 vendor/sebastian/diff/composer.json create mode 100644 vendor/sebastian/diff/phpunit.xml create mode 100644 vendor/sebastian/diff/src/Chunk.php create mode 100644 vendor/sebastian/diff/src/Diff.php create mode 100644 vendor/sebastian/diff/src/Differ.php create mode 100644 vendor/sebastian/diff/src/Exception/ConfigurationException.php create mode 100644 vendor/sebastian/diff/src/Exception/Exception.php create mode 100644 vendor/sebastian/diff/src/Exception/InvalidArgumentException.php create mode 100644 vendor/sebastian/diff/src/Line.php create mode 100644 vendor/sebastian/diff/src/LongestCommonSubsequenceCalculator.php create mode 100644 vendor/sebastian/diff/src/MemoryEfficientLongestCommonSubsequenceCalculator.php create mode 100644 vendor/sebastian/diff/src/Output/AbstractChunkOutputBuilder.php create mode 100644 vendor/sebastian/diff/src/Output/DiffOnlyOutputBuilder.php create mode 100644 vendor/sebastian/diff/src/Output/DiffOutputBuilderInterface.php create mode 100644 vendor/sebastian/diff/src/Output/StrictUnifiedDiffOutputBuilder.php create mode 100644 vendor/sebastian/diff/src/Output/UnifiedDiffOutputBuilder.php create mode 100644 vendor/sebastian/diff/src/Parser.php create mode 100644 vendor/sebastian/diff/src/TimeEfficientLongestCommonSubsequenceCalculator.php create mode 100644 vendor/sebastian/diff/tests/ChunkTest.php create mode 100644 vendor/sebastian/diff/tests/DiffTest.php create mode 100644 vendor/sebastian/diff/tests/DifferTest.php create mode 100644 vendor/sebastian/diff/tests/Exception/ConfigurationExceptionTest.php create mode 100644 vendor/sebastian/diff/tests/Exception/InvalidArgumentExceptionTest.php create mode 100644 vendor/sebastian/diff/tests/LineTest.php create mode 100644 vendor/sebastian/diff/tests/LongestCommonSubsequenceTest.php create mode 100644 vendor/sebastian/diff/tests/MemoryEfficientImplementationTest.php create mode 100644 vendor/sebastian/diff/tests/Output/AbstractChunkOutputBuilderTest.php create mode 100644 vendor/sebastian/diff/tests/Output/DiffOnlyOutputBuilderTest.php create mode 100644 vendor/sebastian/diff/tests/Output/Integration/StrictUnifiedDiffOutputBuilderIntegrationTest.php create mode 100644 vendor/sebastian/diff/tests/Output/Integration/UnifiedDiffOutputBuilderIntegrationTest.php create mode 100644 vendor/sebastian/diff/tests/Output/StrictUnifiedDiffOutputBuilderDataProvider.php create mode 100644 vendor/sebastian/diff/tests/Output/StrictUnifiedDiffOutputBuilderTest.php create mode 100644 vendor/sebastian/diff/tests/Output/UnifiedDiffOutputBuilderDataProvider.php create mode 100644 vendor/sebastian/diff/tests/Output/UnifiedDiffOutputBuilderTest.php create mode 100644 vendor/sebastian/diff/tests/ParserTest.php create mode 100644 vendor/sebastian/diff/tests/TimeEfficientImplementationTest.php create mode 100644 vendor/sebastian/diff/tests/Utils/FileUtils.php create mode 100644 vendor/sebastian/diff/tests/Utils/UnifiedDiffAssertTrait.php create mode 100644 vendor/sebastian/diff/tests/Utils/UnifiedDiffAssertTraitIntegrationTest.php create mode 100644 vendor/sebastian/diff/tests/Utils/UnifiedDiffAssertTraitTest.php create mode 100644 vendor/sebastian/diff/tests/fixtures/.editorconfig create mode 100644 vendor/sebastian/diff/tests/fixtures/UnifiedDiffAssertTraitIntegrationTest/1_a.txt create mode 100644 vendor/sebastian/diff/tests/fixtures/UnifiedDiffAssertTraitIntegrationTest/1_b.txt create mode 100644 vendor/sebastian/diff/tests/fixtures/UnifiedDiffAssertTraitIntegrationTest/2_a.txt create mode 100644 vendor/sebastian/diff/tests/fixtures/UnifiedDiffAssertTraitIntegrationTest/2_b.txt create mode 100644 vendor/sebastian/diff/tests/fixtures/out/.editorconfig create mode 100644 vendor/sebastian/diff/tests/fixtures/out/.gitignore create mode 100644 vendor/sebastian/diff/tests/fixtures/patch.txt create mode 100644 vendor/sebastian/diff/tests/fixtures/patch2.txt create mode 100644 vendor/sebastian/diff/tests/fixtures/serialized_diff.bin create mode 100644 vendor/sebastian/environment/.github/stale.yml create mode 100644 vendor/sebastian/environment/.gitignore create mode 100644 vendor/sebastian/environment/.php_cs.dist create mode 100644 vendor/sebastian/environment/.travis.yml create mode 100644 vendor/sebastian/environment/ChangeLog.md create mode 100644 vendor/sebastian/environment/LICENSE create mode 100644 vendor/sebastian/environment/README.md create mode 100644 vendor/sebastian/environment/build.xml create mode 100644 vendor/sebastian/environment/composer.json create mode 100644 vendor/sebastian/environment/phpunit.xml create mode 100644 vendor/sebastian/environment/src/Console.php create mode 100644 vendor/sebastian/environment/src/OperatingSystem.php create mode 100644 vendor/sebastian/environment/src/Runtime.php create mode 100644 vendor/sebastian/environment/tests/ConsoleTest.php create mode 100644 vendor/sebastian/environment/tests/OperatingSystemTest.php create mode 100644 vendor/sebastian/environment/tests/RuntimeTest.php create mode 100644 vendor/sebastian/exporter/.gitignore create mode 100644 vendor/sebastian/exporter/.php_cs create mode 100644 vendor/sebastian/exporter/.travis.yml create mode 100644 vendor/sebastian/exporter/LICENSE create mode 100644 vendor/sebastian/exporter/README.md create mode 100644 vendor/sebastian/exporter/build.xml create mode 100644 vendor/sebastian/exporter/composer.json create mode 100644 vendor/sebastian/exporter/phpunit.xml create mode 100644 vendor/sebastian/exporter/src/Exporter.php create mode 100644 vendor/sebastian/exporter/tests/ExporterTest.php create mode 100644 vendor/sebastian/global-state/.gitignore create mode 100644 vendor/sebastian/global-state/.php_cs create mode 100644 vendor/sebastian/global-state/.travis.yml create mode 100644 vendor/sebastian/global-state/LICENSE create mode 100644 vendor/sebastian/global-state/README.md create mode 100644 vendor/sebastian/global-state/build.xml create mode 100644 vendor/sebastian/global-state/composer.json create mode 100644 vendor/sebastian/global-state/phpunit.xml create mode 100644 vendor/sebastian/global-state/src/Blacklist.php create mode 100644 vendor/sebastian/global-state/src/CodeExporter.php create mode 100644 vendor/sebastian/global-state/src/Restorer.php create mode 100644 vendor/sebastian/global-state/src/Snapshot.php create mode 100644 vendor/sebastian/global-state/src/exceptions/Exception.php create mode 100644 vendor/sebastian/global-state/src/exceptions/RuntimeException.php create mode 100644 vendor/sebastian/global-state/tests/BlacklistTest.php create mode 100644 vendor/sebastian/global-state/tests/CodeExporterTest.php create mode 100644 vendor/sebastian/global-state/tests/RestorerTest.php create mode 100644 vendor/sebastian/global-state/tests/SnapshotTest.php create mode 100644 vendor/sebastian/global-state/tests/_fixture/BlacklistedChildClass.php create mode 100644 vendor/sebastian/global-state/tests/_fixture/BlacklistedClass.php create mode 100644 vendor/sebastian/global-state/tests/_fixture/BlacklistedImplementor.php create mode 100644 vendor/sebastian/global-state/tests/_fixture/BlacklistedInterface.php create mode 100644 vendor/sebastian/global-state/tests/_fixture/SnapshotClass.php create mode 100644 vendor/sebastian/global-state/tests/_fixture/SnapshotDomDocument.php create mode 100644 vendor/sebastian/global-state/tests/_fixture/SnapshotFunctions.php create mode 100644 vendor/sebastian/global-state/tests/_fixture/SnapshotTrait.php create mode 100644 vendor/sebastian/object-enumerator/.gitignore create mode 100644 vendor/sebastian/object-enumerator/.php_cs create mode 100644 vendor/sebastian/object-enumerator/.travis.yml create mode 100644 vendor/sebastian/object-enumerator/ChangeLog.md create mode 100644 vendor/sebastian/object-enumerator/LICENSE create mode 100644 vendor/sebastian/object-enumerator/README.md create mode 100644 vendor/sebastian/object-enumerator/build.xml create mode 100644 vendor/sebastian/object-enumerator/composer.json create mode 100644 vendor/sebastian/object-enumerator/phpunit.xml create mode 100644 vendor/sebastian/object-enumerator/src/Enumerator.php create mode 100644 vendor/sebastian/object-enumerator/src/Exception.php create mode 100644 vendor/sebastian/object-enumerator/src/InvalidArgumentException.php create mode 100644 vendor/sebastian/object-enumerator/tests/EnumeratorTest.php create mode 100644 vendor/sebastian/object-enumerator/tests/_fixture/ExceptionThrower.php create mode 100644 vendor/sebastian/object-reflector/.gitignore create mode 100644 vendor/sebastian/object-reflector/.php_cs create mode 100644 vendor/sebastian/object-reflector/.travis.yml create mode 100644 vendor/sebastian/object-reflector/ChangeLog.md create mode 100644 vendor/sebastian/object-reflector/LICENSE create mode 100644 vendor/sebastian/object-reflector/README.md create mode 100644 vendor/sebastian/object-reflector/build.xml create mode 100644 vendor/sebastian/object-reflector/composer.json create mode 100644 vendor/sebastian/object-reflector/phpunit.xml create mode 100644 vendor/sebastian/object-reflector/src/Exception.php create mode 100644 vendor/sebastian/object-reflector/src/InvalidArgumentException.php create mode 100644 vendor/sebastian/object-reflector/src/ObjectReflector.php create mode 100644 vendor/sebastian/object-reflector/tests/ObjectReflectorTest.php create mode 100644 vendor/sebastian/object-reflector/tests/_fixture/ChildClass.php create mode 100644 vendor/sebastian/object-reflector/tests/_fixture/ClassWithIntegerAttributeName.php create mode 100644 vendor/sebastian/object-reflector/tests/_fixture/ParentClass.php create mode 100644 vendor/sebastian/recursion-context/.gitignore create mode 100644 vendor/sebastian/recursion-context/.travis.yml create mode 100644 vendor/sebastian/recursion-context/LICENSE create mode 100644 vendor/sebastian/recursion-context/README.md create mode 100644 vendor/sebastian/recursion-context/build.xml create mode 100644 vendor/sebastian/recursion-context/composer.json create mode 100644 vendor/sebastian/recursion-context/phpunit.xml create mode 100644 vendor/sebastian/recursion-context/src/Context.php create mode 100644 vendor/sebastian/recursion-context/src/Exception.php create mode 100644 vendor/sebastian/recursion-context/src/InvalidArgumentException.php create mode 100644 vendor/sebastian/recursion-context/tests/ContextTest.php create mode 100644 vendor/sebastian/resource-operations/.github/stale.yml create mode 100644 vendor/sebastian/resource-operations/.gitignore create mode 100644 vendor/sebastian/resource-operations/.php_cs.dist create mode 100644 vendor/sebastian/resource-operations/ChangeLog.md create mode 100644 vendor/sebastian/resource-operations/LICENSE create mode 100644 vendor/sebastian/resource-operations/README.md create mode 100644 vendor/sebastian/resource-operations/build.xml create mode 100755 vendor/sebastian/resource-operations/build/generate.php create mode 100644 vendor/sebastian/resource-operations/composer.json create mode 100644 vendor/sebastian/resource-operations/src/ResourceOperations.php create mode 100644 vendor/sebastian/resource-operations/tests/ResourceOperationsTest.php create mode 100644 vendor/sebastian/version/.gitattributes create mode 100644 vendor/sebastian/version/.gitignore create mode 100644 vendor/sebastian/version/.php_cs create mode 100644 vendor/sebastian/version/LICENSE create mode 100644 vendor/sebastian/version/README.md create mode 100644 vendor/sebastian/version/composer.json create mode 100644 vendor/sebastian/version/src/Version.php create mode 100644 vendor/spatie/laravel-permission/CHANGELOG.md create mode 100644 vendor/spatie/laravel-permission/CONTRIBUTING.md create mode 100644 vendor/spatie/laravel-permission/LICENSE.md create mode 100644 vendor/spatie/laravel-permission/README.md create mode 100644 vendor/spatie/laravel-permission/composer.json create mode 100644 vendor/spatie/laravel-permission/config/permission.php create mode 100644 vendor/spatie/laravel-permission/database/migrations/create_permission_tables.php.stub create mode 100644 vendor/spatie/laravel-permission/src/Commands/CacheReset.php create mode 100644 vendor/spatie/laravel-permission/src/Commands/CreatePermission.php create mode 100644 vendor/spatie/laravel-permission/src/Commands/CreateRole.php create mode 100644 vendor/spatie/laravel-permission/src/Contracts/Permission.php create mode 100644 vendor/spatie/laravel-permission/src/Contracts/Role.php create mode 100644 vendor/spatie/laravel-permission/src/Exceptions/GuardDoesNotMatch.php create mode 100644 vendor/spatie/laravel-permission/src/Exceptions/PermissionAlreadyExists.php create mode 100644 vendor/spatie/laravel-permission/src/Exceptions/PermissionDoesNotExist.php create mode 100644 vendor/spatie/laravel-permission/src/Exceptions/RoleAlreadyExists.php create mode 100644 vendor/spatie/laravel-permission/src/Exceptions/RoleDoesNotExist.php create mode 100644 vendor/spatie/laravel-permission/src/Exceptions/UnauthorizedException.php create mode 100644 vendor/spatie/laravel-permission/src/Guard.php create mode 100644 vendor/spatie/laravel-permission/src/Middlewares/PermissionMiddleware.php create mode 100644 vendor/spatie/laravel-permission/src/Middlewares/RoleMiddleware.php create mode 100644 vendor/spatie/laravel-permission/src/Middlewares/RoleOrPermissionMiddleware.php create mode 100644 vendor/spatie/laravel-permission/src/Models/Permission.php create mode 100644 vendor/spatie/laravel-permission/src/Models/Role.php create mode 100644 vendor/spatie/laravel-permission/src/PermissionRegistrar.php create mode 100644 vendor/spatie/laravel-permission/src/PermissionServiceProvider.php create mode 100644 vendor/spatie/laravel-permission/src/Traits/HasPermissions.php create mode 100644 vendor/spatie/laravel-permission/src/Traits/HasRoles.php create mode 100644 vendor/spatie/laravel-permission/src/Traits/RefreshesPermissionCache.php create mode 100644 vendor/spatie/laravel-permission/src/helpers.php create mode 100644 vendor/swiftmailer/swiftmailer/.gitattributes create mode 100644 vendor/swiftmailer/swiftmailer/.github/ISSUE_TEMPLATE.md create mode 100644 vendor/swiftmailer/swiftmailer/.github/PULL_REQUEST_TEMPLATE.md create mode 100644 vendor/swiftmailer/swiftmailer/.gitignore create mode 100644 vendor/swiftmailer/swiftmailer/.php_cs.dist create mode 100644 vendor/swiftmailer/swiftmailer/.travis.yml create mode 100644 vendor/swiftmailer/swiftmailer/CHANGES create mode 100644 vendor/swiftmailer/swiftmailer/LICENSE create mode 100644 vendor/swiftmailer/swiftmailer/README create mode 100644 vendor/swiftmailer/swiftmailer/composer.json create mode 100644 vendor/swiftmailer/swiftmailer/doc/headers.rst create mode 100644 vendor/swiftmailer/swiftmailer/doc/index.rst create mode 100644 vendor/swiftmailer/swiftmailer/doc/introduction.rst create mode 100644 vendor/swiftmailer/swiftmailer/doc/japanese.rst create mode 100644 vendor/swiftmailer/swiftmailer/doc/messages.rst create mode 100644 vendor/swiftmailer/swiftmailer/doc/plugins.rst create mode 100644 vendor/swiftmailer/swiftmailer/doc/sending.rst create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder/IdnAddressEncoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder/Utf8AddressEncoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoderException.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Attachment.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/TemporaryFileByteStream.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/UsAsciiReader.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReaderFactory.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/ConfigurableSpool.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyException.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/EmbeddedFile.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/Base64Encoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/Rfc2231Encoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/CommandEvent.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/CommandListener.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/Event.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/EventListener.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/EventObject.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/ResponseListener.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SendEvent.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SendListener.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/TransportChangeEvent.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/FailoverTransport.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileSpool.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileStream.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Filterable.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/IdGenerator.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Image.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/InputByteStream.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/IoException.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/ArrayKeyCache.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/KeyCacheInputStream.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/NullKeyCache.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer/ArrayRecipientIterator.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer/RecipientIterator.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/MemorySpool.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Attachment.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/CharsetObserver.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NullContentEncoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/EmbeddedFile.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/EncodingObserver.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Header.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/UnstructuredHeader.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/IdGenerator.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/NullTransport.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/OutputByteStream.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/AntiFloodPlugin.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Decorator/Replacements.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Logger.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Loggers/ArrayLogger.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Loggers/EchoLogger.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Pop/Pop3Connection.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Pop/Pop3Exception.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/RedirectingPlugin.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporter.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HitReporter.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Sleeper.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Timer.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/ReplacementFilterFactory.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/RfcComplianceException.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signer.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/BodySigner.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Spool.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/SpoolTransport.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilter.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilterFactory.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/SwiftException.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/XOAuth2Authenticator.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Authenticator.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/EightBitMimeHandler.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/SmtpUtf8Handler.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpHandler.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/IoBuffer.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/LoadBalancedTransport.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/NullTransport.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SmtpAgent.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/classes/Swift/TransportException.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/dependency_maps/cache_deps.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/dependency_maps/message_deps.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/dependency_maps/transport_deps.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/mime_types.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/preferences.php create mode 100644 vendor/swiftmailer/swiftmailer/lib/swift_required.php create mode 100755 vendor/swiftmailer/swiftmailer/lib/swiftmailer_generate_mimes_config.php create mode 100644 vendor/swiftmailer/swiftmailer/phpunit.xml.dist create mode 100644 vendor/swiftmailer/swiftmailer/tests/IdenticalBinaryConstraint.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/StreamCollector.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/SwiftMailerSmokeTestCase.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/SwiftMailerTestCase.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/charsets/iso-2022-jp/one.txt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/charsets/iso-8859-1/one.txt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/charsets/utf-8/one.txt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/charsets/utf-8/three.txt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/charsets/utf-8/two.txt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/dkim/dkim.test.priv create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/dkim/dkim.test.pub create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/files/data.txt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/files/swiftmailer.png create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/files/textfile.zip create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/smime/CA.srl create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/smime/ca.crt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/smime/ca.key create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/smime/create-cert.sh create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/smime/encrypt.crt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/smime/encrypt.key create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/smime/encrypt2.crt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/smime/encrypt2.key create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/smime/intermediate.crt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/smime/intermediate.key create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/smime/sign.crt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/smime/sign.key create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/smime/sign2.crt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/smime/sign2.key create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance.conf.php.default create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/AttachmentAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EmbeddedFileAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MimePartAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bootstrap.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug111Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug274Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug518Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug534Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug650Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/BugFileByteStreamConsecutiveReadCallsTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/fixtures/MimeEntityFixture.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/smoke.conf.php.default create mode 100644 vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/AttachmentSmokeTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/BasicSmokeTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/GenericFixedWidthReaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Rfc2231EncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mailer/ArrayRecipientIteratorTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/MessageTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/Base64HeaderEncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/DateHeaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/IdentificationHeaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/MailboxHeaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/PathHeaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/UnstructuredHeaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/IdGeneratorTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/ArrayLoggerTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/EchoLoggerTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/DKIMSignerTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/OpenDKIMSignerTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/SMimeSignerTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/NTLMAuthenticatorTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransportTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/FailoverTransportTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/SendmailTransportTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/StreamBufferTest.php create mode 100644 vendor/symfony/console/.gitignore create mode 100644 vendor/symfony/console/Application.php create mode 100644 vendor/symfony/console/CHANGELOG.md create mode 100644 vendor/symfony/console/Command/Command.php create mode 100644 vendor/symfony/console/Command/HelpCommand.php create mode 100644 vendor/symfony/console/Command/ListCommand.php create mode 100644 vendor/symfony/console/Command/LockableTrait.php create mode 100644 vendor/symfony/console/CommandLoader/CommandLoaderInterface.php create mode 100644 vendor/symfony/console/CommandLoader/ContainerCommandLoader.php create mode 100644 vendor/symfony/console/CommandLoader/FactoryCommandLoader.php create mode 100644 vendor/symfony/console/ConsoleEvents.php create mode 100644 vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php create mode 100644 vendor/symfony/console/Descriptor/ApplicationDescription.php create mode 100644 vendor/symfony/console/Descriptor/Descriptor.php create mode 100644 vendor/symfony/console/Descriptor/DescriptorInterface.php create mode 100644 vendor/symfony/console/Descriptor/JsonDescriptor.php create mode 100644 vendor/symfony/console/Descriptor/MarkdownDescriptor.php create mode 100644 vendor/symfony/console/Descriptor/TextDescriptor.php create mode 100644 vendor/symfony/console/Descriptor/XmlDescriptor.php create mode 100644 vendor/symfony/console/Event/ConsoleCommandEvent.php create mode 100644 vendor/symfony/console/Event/ConsoleErrorEvent.php create mode 100644 vendor/symfony/console/Event/ConsoleEvent.php create mode 100644 vendor/symfony/console/Event/ConsoleTerminateEvent.php create mode 100644 vendor/symfony/console/EventListener/ErrorListener.php create mode 100644 vendor/symfony/console/Exception/CommandNotFoundException.php create mode 100644 vendor/symfony/console/Exception/ExceptionInterface.php create mode 100644 vendor/symfony/console/Exception/InvalidArgumentException.php create mode 100644 vendor/symfony/console/Exception/InvalidOptionException.php create mode 100644 vendor/symfony/console/Exception/LogicException.php create mode 100644 vendor/symfony/console/Exception/NamespaceNotFoundException.php create mode 100644 vendor/symfony/console/Exception/RuntimeException.php create mode 100644 vendor/symfony/console/Formatter/OutputFormatter.php create mode 100644 vendor/symfony/console/Formatter/OutputFormatterInterface.php create mode 100644 vendor/symfony/console/Formatter/OutputFormatterStyle.php create mode 100644 vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php create mode 100644 vendor/symfony/console/Formatter/OutputFormatterStyleStack.php create mode 100644 vendor/symfony/console/Formatter/WrappableOutputFormatterInterface.php create mode 100644 vendor/symfony/console/Helper/DebugFormatterHelper.php create mode 100644 vendor/symfony/console/Helper/DescriptorHelper.php create mode 100644 vendor/symfony/console/Helper/FormatterHelper.php create mode 100644 vendor/symfony/console/Helper/Helper.php create mode 100644 vendor/symfony/console/Helper/HelperInterface.php create mode 100644 vendor/symfony/console/Helper/HelperSet.php create mode 100644 vendor/symfony/console/Helper/InputAwareHelper.php create mode 100644 vendor/symfony/console/Helper/ProcessHelper.php create mode 100644 vendor/symfony/console/Helper/ProgressBar.php create mode 100644 vendor/symfony/console/Helper/ProgressIndicator.php create mode 100644 vendor/symfony/console/Helper/QuestionHelper.php create mode 100644 vendor/symfony/console/Helper/SymfonyQuestionHelper.php create mode 100644 vendor/symfony/console/Helper/Table.php create mode 100644 vendor/symfony/console/Helper/TableCell.php create mode 100644 vendor/symfony/console/Helper/TableRows.php create mode 100644 vendor/symfony/console/Helper/TableSeparator.php create mode 100644 vendor/symfony/console/Helper/TableStyle.php create mode 100644 vendor/symfony/console/Input/ArgvInput.php create mode 100644 vendor/symfony/console/Input/ArrayInput.php create mode 100644 vendor/symfony/console/Input/Input.php create mode 100644 vendor/symfony/console/Input/InputArgument.php create mode 100644 vendor/symfony/console/Input/InputAwareInterface.php create mode 100644 vendor/symfony/console/Input/InputDefinition.php create mode 100644 vendor/symfony/console/Input/InputInterface.php create mode 100644 vendor/symfony/console/Input/InputOption.php create mode 100644 vendor/symfony/console/Input/StreamableInputInterface.php create mode 100644 vendor/symfony/console/Input/StringInput.php create mode 100644 vendor/symfony/console/LICENSE create mode 100644 vendor/symfony/console/Logger/ConsoleLogger.php create mode 100644 vendor/symfony/console/Output/BufferedOutput.php create mode 100644 vendor/symfony/console/Output/ConsoleOutput.php create mode 100644 vendor/symfony/console/Output/ConsoleOutputInterface.php create mode 100644 vendor/symfony/console/Output/ConsoleSectionOutput.php create mode 100644 vendor/symfony/console/Output/NullOutput.php create mode 100644 vendor/symfony/console/Output/Output.php create mode 100644 vendor/symfony/console/Output/OutputInterface.php create mode 100644 vendor/symfony/console/Output/StreamOutput.php create mode 100644 vendor/symfony/console/Question/ChoiceQuestion.php create mode 100644 vendor/symfony/console/Question/ConfirmationQuestion.php create mode 100644 vendor/symfony/console/Question/Question.php create mode 100644 vendor/symfony/console/README.md create mode 100644 vendor/symfony/console/Resources/bin/hiddeninput.exe create mode 100644 vendor/symfony/console/Style/OutputStyle.php create mode 100644 vendor/symfony/console/Style/StyleInterface.php create mode 100644 vendor/symfony/console/Style/SymfonyStyle.php create mode 100644 vendor/symfony/console/Terminal.php create mode 100644 vendor/symfony/console/Tester/ApplicationTester.php create mode 100644 vendor/symfony/console/Tester/CommandTester.php create mode 100644 vendor/symfony/console/Tester/TesterTrait.php create mode 100644 vendor/symfony/console/Tests/ApplicationTest.php create mode 100644 vendor/symfony/console/Tests/Command/CommandTest.php create mode 100644 vendor/symfony/console/Tests/Command/HelpCommandTest.php create mode 100644 vendor/symfony/console/Tests/Command/ListCommandTest.php create mode 100644 vendor/symfony/console/Tests/Command/LockableTraitTest.php create mode 100644 vendor/symfony/console/Tests/CommandLoader/ContainerCommandLoaderTest.php create mode 100644 vendor/symfony/console/Tests/CommandLoader/FactoryCommandLoaderTest.php create mode 100644 vendor/symfony/console/Tests/DependencyInjection/AddConsoleCommandPassTest.php create mode 100644 vendor/symfony/console/Tests/Descriptor/AbstractDescriptorTest.php create mode 100644 vendor/symfony/console/Tests/Descriptor/JsonDescriptorTest.php create mode 100644 vendor/symfony/console/Tests/Descriptor/MarkdownDescriptorTest.php create mode 100644 vendor/symfony/console/Tests/Descriptor/ObjectsProvider.php create mode 100644 vendor/symfony/console/Tests/Descriptor/TextDescriptorTest.php create mode 100644 vendor/symfony/console/Tests/Descriptor/XmlDescriptorTest.php create mode 100644 vendor/symfony/console/Tests/EventListener/ErrorListenerTest.php create mode 100644 vendor/symfony/console/Tests/Fixtures/BarBucCommand.php create mode 100644 vendor/symfony/console/Tests/Fixtures/DescriptorApplication1.php create mode 100644 vendor/symfony/console/Tests/Fixtures/DescriptorApplication2.php create mode 100644 vendor/symfony/console/Tests/Fixtures/DescriptorApplicationMbString.php create mode 100644 vendor/symfony/console/Tests/Fixtures/DescriptorCommand1.php create mode 100644 vendor/symfony/console/Tests/Fixtures/DescriptorCommand2.php create mode 100644 vendor/symfony/console/Tests/Fixtures/DescriptorCommand3.php create mode 100644 vendor/symfony/console/Tests/Fixtures/DescriptorCommand4.php create mode 100644 vendor/symfony/console/Tests/Fixtures/DescriptorCommandMbString.php create mode 100644 vendor/symfony/console/Tests/Fixtures/DummyOutput.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Foo1Command.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Foo2Command.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Foo3Command.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Foo4Command.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Foo5Command.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Foo6Command.php create mode 100644 vendor/symfony/console/Tests/Fixtures/FooCommand.php create mode 100644 vendor/symfony/console/Tests/Fixtures/FooLock2Command.php create mode 100644 vendor/symfony/console/Tests/Fixtures/FooLockCommand.php create mode 100644 vendor/symfony/console/Tests/Fixtures/FooOptCommand.php create mode 100644 vendor/symfony/console/Tests/Fixtures/FooSameCaseLowercaseCommand.php create mode 100644 vendor/symfony/console/Tests/Fixtures/FooSameCaseUppercaseCommand.php create mode 100644 vendor/symfony/console/Tests/Fixtures/FooSubnamespaced1Command.php create mode 100644 vendor/symfony/console/Tests/Fixtures/FooSubnamespaced2Command.php create mode 100644 vendor/symfony/console/Tests/Fixtures/FooWithoutAliasCommand.php create mode 100644 vendor/symfony/console/Tests/Fixtures/FoobarCommand.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_0.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_1.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_10.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_11.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_12.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_13.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_14.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_15.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_16.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_17.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_2.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_3.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_4.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_4_with_iterators.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_5.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_6.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_7.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_8.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/command_9.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/command/interactive_command_1.php create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/interactive_output_1.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_0.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_1.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_10.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_11.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_12.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_13.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_14.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_15.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_16.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_17.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_2.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_3.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_4.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_4_with_iterators.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_5.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_6.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_7.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_8.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/Style/SymfonyStyle/output/output_9.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/TestCommand.php create mode 100644 vendor/symfony/console/Tests/Fixtures/TestTiti.php create mode 100644 vendor/symfony/console/Tests/Fixtures/TestToto.php create mode 100644 vendor/symfony/console/Tests/Fixtures/application_1.json create mode 100644 vendor/symfony/console/Tests/Fixtures/application_1.md create mode 100644 vendor/symfony/console/Tests/Fixtures/application_1.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_1.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/application_2.json create mode 100644 vendor/symfony/console/Tests/Fixtures/application_2.md create mode 100644 vendor/symfony/console/Tests/Fixtures/application_2.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_2.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/application_filtered_namespace.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_gethelp.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_mbstring.md create mode 100644 vendor/symfony/console/Tests/Fixtures/application_mbstring.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_renderexception1.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_renderexception2.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_renderexception3.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_renderexception3decorated.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_renderexception4.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_renderexception_doublewidth1.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_renderexception_doublewidth1decorated.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_renderexception_doublewidth2.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_renderexception_escapeslines.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_renderexception_linebreaks.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_run1.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_run2.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_run3.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/application_run4.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/command_1.json create mode 100644 vendor/symfony/console/Tests/Fixtures/command_1.md create mode 100644 vendor/symfony/console/Tests/Fixtures/command_1.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/command_1.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/command_2.json create mode 100644 vendor/symfony/console/Tests/Fixtures/command_2.md create mode 100644 vendor/symfony/console/Tests/Fixtures/command_2.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/command_2.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/command_mbstring.md create mode 100644 vendor/symfony/console/Tests/Fixtures/command_mbstring.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_1.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_1.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_1.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_1.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_2.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_2.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_2.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_2.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_3.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_3.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_3.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_3.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_4.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_4.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_4.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_4.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_with_default_inf_value.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_with_style.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_with_style.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_with_style.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_argument_with_style.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_1.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_1.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_1.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_1.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_2.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_2.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_2.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_2.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_3.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_3.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_3.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_3.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_4.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_4.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_4.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_definition_4.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_1.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_1.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_1.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_1.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_2.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_2.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_2.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_2.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_3.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_3.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_3.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_3.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_4.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_4.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_4.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_4.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_5.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_5.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_5.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_5.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_6.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_6.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_6.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_6.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_with_default_inf_value.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_with_style.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_with_style.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_with_style.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_with_style.xml create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.json create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.md create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.txt create mode 100644 vendor/symfony/console/Tests/Fixtures/input_option_with_style_array.xml create mode 100644 vendor/symfony/console/Tests/Formatter/OutputFormatterStyleStackTest.php create mode 100644 vendor/symfony/console/Tests/Formatter/OutputFormatterStyleTest.php create mode 100644 vendor/symfony/console/Tests/Formatter/OutputFormatterTest.php create mode 100644 vendor/symfony/console/Tests/Helper/AbstractQuestionHelperTest.php create mode 100644 vendor/symfony/console/Tests/Helper/FormatterHelperTest.php create mode 100644 vendor/symfony/console/Tests/Helper/HelperSetTest.php create mode 100644 vendor/symfony/console/Tests/Helper/HelperTest.php create mode 100644 vendor/symfony/console/Tests/Helper/ProcessHelperTest.php create mode 100644 vendor/symfony/console/Tests/Helper/ProgressBarTest.php create mode 100644 vendor/symfony/console/Tests/Helper/ProgressIndicatorTest.php create mode 100644 vendor/symfony/console/Tests/Helper/QuestionHelperTest.php create mode 100644 vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php create mode 100644 vendor/symfony/console/Tests/Helper/TableStyleTest.php create mode 100644 vendor/symfony/console/Tests/Helper/TableTest.php create mode 100644 vendor/symfony/console/Tests/Input/ArgvInputTest.php create mode 100644 vendor/symfony/console/Tests/Input/ArrayInputTest.php create mode 100644 vendor/symfony/console/Tests/Input/InputArgumentTest.php create mode 100644 vendor/symfony/console/Tests/Input/InputDefinitionTest.php create mode 100644 vendor/symfony/console/Tests/Input/InputOptionTest.php create mode 100644 vendor/symfony/console/Tests/Input/InputTest.php create mode 100644 vendor/symfony/console/Tests/Input/StringInputTest.php create mode 100644 vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php create mode 100644 vendor/symfony/console/Tests/Output/ConsoleOutputTest.php create mode 100644 vendor/symfony/console/Tests/Output/ConsoleSectionOutputTest.php create mode 100644 vendor/symfony/console/Tests/Output/NullOutputTest.php create mode 100644 vendor/symfony/console/Tests/Output/OutputTest.php create mode 100644 vendor/symfony/console/Tests/Output/StreamOutputTest.php create mode 100644 vendor/symfony/console/Tests/Style/SymfonyStyleTest.php create mode 100644 vendor/symfony/console/Tests/TerminalTest.php create mode 100644 vendor/symfony/console/Tests/Tester/ApplicationTesterTest.php create mode 100644 vendor/symfony/console/Tests/Tester/CommandTesterTest.php create mode 100644 vendor/symfony/console/composer.json create mode 100644 vendor/symfony/console/phpunit.xml.dist create mode 100644 vendor/symfony/contracts/.gitignore create mode 100644 vendor/symfony/contracts/CHANGELOG.md create mode 100644 vendor/symfony/contracts/Cache/CacheInterface.php create mode 100644 vendor/symfony/contracts/Cache/CacheTrait.php create mode 100644 vendor/symfony/contracts/Cache/CallbackInterface.php create mode 100644 vendor/symfony/contracts/Cache/ItemInterface.php create mode 100644 vendor/symfony/contracts/Cache/TagAwareCacheInterface.php create mode 100644 vendor/symfony/contracts/LICENSE create mode 100644 vendor/symfony/contracts/README.md create mode 100644 vendor/symfony/contracts/Service/ResetInterface.php create mode 100644 vendor/symfony/contracts/Service/ServiceLocatorTrait.php create mode 100644 vendor/symfony/contracts/Service/ServiceSubscriberInterface.php create mode 100644 vendor/symfony/contracts/Service/ServiceSubscriberTrait.php create mode 100644 vendor/symfony/contracts/Tests/Cache/CacheTraitTest.php create mode 100644 vendor/symfony/contracts/Tests/Service/ServiceLocatorTest.php create mode 100644 vendor/symfony/contracts/Tests/Service/ServiceSubscriberTraitTest.php create mode 100644 vendor/symfony/contracts/Tests/Translation/TranslatorTest.php create mode 100644 vendor/symfony/contracts/Translation/LocaleAwareInterface.php create mode 100644 vendor/symfony/contracts/Translation/TranslatorInterface.php create mode 100644 vendor/symfony/contracts/Translation/TranslatorTrait.php create mode 100644 vendor/symfony/contracts/composer.json create mode 100644 vendor/symfony/contracts/phpunit.xml.dist create mode 100644 vendor/symfony/css-selector/.gitignore create mode 100644 vendor/symfony/css-selector/CHANGELOG.md create mode 100644 vendor/symfony/css-selector/CssSelectorConverter.php create mode 100644 vendor/symfony/css-selector/Exception/ExceptionInterface.php create mode 100644 vendor/symfony/css-selector/Exception/ExpressionErrorException.php create mode 100644 vendor/symfony/css-selector/Exception/InternalErrorException.php create mode 100644 vendor/symfony/css-selector/Exception/ParseException.php create mode 100644 vendor/symfony/css-selector/Exception/SyntaxErrorException.php create mode 100644 vendor/symfony/css-selector/LICENSE create mode 100644 vendor/symfony/css-selector/Node/AbstractNode.php create mode 100644 vendor/symfony/css-selector/Node/AttributeNode.php create mode 100644 vendor/symfony/css-selector/Node/ClassNode.php create mode 100644 vendor/symfony/css-selector/Node/CombinedSelectorNode.php create mode 100644 vendor/symfony/css-selector/Node/ElementNode.php create mode 100644 vendor/symfony/css-selector/Node/FunctionNode.php create mode 100644 vendor/symfony/css-selector/Node/HashNode.php create mode 100644 vendor/symfony/css-selector/Node/NegationNode.php create mode 100644 vendor/symfony/css-selector/Node/NodeInterface.php create mode 100644 vendor/symfony/css-selector/Node/PseudoNode.php create mode 100644 vendor/symfony/css-selector/Node/SelectorNode.php create mode 100644 vendor/symfony/css-selector/Node/Specificity.php create mode 100644 vendor/symfony/css-selector/Parser/Handler/CommentHandler.php create mode 100644 vendor/symfony/css-selector/Parser/Handler/HandlerInterface.php create mode 100644 vendor/symfony/css-selector/Parser/Handler/HashHandler.php create mode 100644 vendor/symfony/css-selector/Parser/Handler/IdentifierHandler.php create mode 100644 vendor/symfony/css-selector/Parser/Handler/NumberHandler.php create mode 100644 vendor/symfony/css-selector/Parser/Handler/StringHandler.php create mode 100644 vendor/symfony/css-selector/Parser/Handler/WhitespaceHandler.php create mode 100644 vendor/symfony/css-selector/Parser/Parser.php create mode 100644 vendor/symfony/css-selector/Parser/ParserInterface.php create mode 100644 vendor/symfony/css-selector/Parser/Reader.php create mode 100644 vendor/symfony/css-selector/Parser/Shortcut/ClassParser.php create mode 100644 vendor/symfony/css-selector/Parser/Shortcut/ElementParser.php create mode 100644 vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php create mode 100644 vendor/symfony/css-selector/Parser/Shortcut/HashParser.php create mode 100644 vendor/symfony/css-selector/Parser/Token.php create mode 100644 vendor/symfony/css-selector/Parser/TokenStream.php create mode 100644 vendor/symfony/css-selector/Parser/Tokenizer/Tokenizer.php create mode 100644 vendor/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php create mode 100644 vendor/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php create mode 100644 vendor/symfony/css-selector/README.md create mode 100644 vendor/symfony/css-selector/Tests/CssSelectorConverterTest.php create mode 100644 vendor/symfony/css-selector/Tests/Node/AbstractNodeTest.php create mode 100644 vendor/symfony/css-selector/Tests/Node/AttributeNodeTest.php create mode 100644 vendor/symfony/css-selector/Tests/Node/ClassNodeTest.php create mode 100644 vendor/symfony/css-selector/Tests/Node/CombinedSelectorNodeTest.php create mode 100644 vendor/symfony/css-selector/Tests/Node/ElementNodeTest.php create mode 100644 vendor/symfony/css-selector/Tests/Node/FunctionNodeTest.php create mode 100644 vendor/symfony/css-selector/Tests/Node/HashNodeTest.php create mode 100644 vendor/symfony/css-selector/Tests/Node/NegationNodeTest.php create mode 100644 vendor/symfony/css-selector/Tests/Node/PseudoNodeTest.php create mode 100644 vendor/symfony/css-selector/Tests/Node/SelectorNodeTest.php create mode 100644 vendor/symfony/css-selector/Tests/Node/SpecificityTest.php create mode 100644 vendor/symfony/css-selector/Tests/Parser/Handler/AbstractHandlerTest.php create mode 100644 vendor/symfony/css-selector/Tests/Parser/Handler/CommentHandlerTest.php create mode 100644 vendor/symfony/css-selector/Tests/Parser/Handler/HashHandlerTest.php create mode 100644 vendor/symfony/css-selector/Tests/Parser/Handler/IdentifierHandlerTest.php create mode 100644 vendor/symfony/css-selector/Tests/Parser/Handler/NumberHandlerTest.php create mode 100644 vendor/symfony/css-selector/Tests/Parser/Handler/StringHandlerTest.php create mode 100644 vendor/symfony/css-selector/Tests/Parser/Handler/WhitespaceHandlerTest.php create mode 100644 vendor/symfony/css-selector/Tests/Parser/ParserTest.php create mode 100644 vendor/symfony/css-selector/Tests/Parser/ReaderTest.php create mode 100644 vendor/symfony/css-selector/Tests/Parser/Shortcut/ClassParserTest.php create mode 100644 vendor/symfony/css-selector/Tests/Parser/Shortcut/ElementParserTest.php create mode 100644 vendor/symfony/css-selector/Tests/Parser/Shortcut/EmptyStringParserTest.php create mode 100644 vendor/symfony/css-selector/Tests/Parser/Shortcut/HashParserTest.php create mode 100644 vendor/symfony/css-selector/Tests/Parser/TokenStreamTest.php create mode 100644 vendor/symfony/css-selector/Tests/XPath/Fixtures/ids.html create mode 100644 vendor/symfony/css-selector/Tests/XPath/Fixtures/lang.xml create mode 100644 vendor/symfony/css-selector/Tests/XPath/Fixtures/shakespear.html create mode 100644 vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php create mode 100644 vendor/symfony/css-selector/XPath/Extension/AbstractExtension.php create mode 100644 vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php create mode 100644 vendor/symfony/css-selector/XPath/Extension/CombinationExtension.php create mode 100644 vendor/symfony/css-selector/XPath/Extension/ExtensionInterface.php create mode 100644 vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php create mode 100644 vendor/symfony/css-selector/XPath/Extension/HtmlExtension.php create mode 100644 vendor/symfony/css-selector/XPath/Extension/NodeExtension.php create mode 100644 vendor/symfony/css-selector/XPath/Extension/PseudoClassExtension.php create mode 100644 vendor/symfony/css-selector/XPath/Translator.php create mode 100644 vendor/symfony/css-selector/XPath/TranslatorInterface.php create mode 100644 vendor/symfony/css-selector/XPath/XPathExpr.php create mode 100644 vendor/symfony/css-selector/composer.json create mode 100644 vendor/symfony/css-selector/phpunit.xml.dist create mode 100644 vendor/symfony/debug/.gitignore create mode 100644 vendor/symfony/debug/BufferingLogger.php create mode 100644 vendor/symfony/debug/CHANGELOG.md create mode 100644 vendor/symfony/debug/Debug.php create mode 100644 vendor/symfony/debug/DebugClassLoader.php create mode 100644 vendor/symfony/debug/ErrorHandler.php create mode 100644 vendor/symfony/debug/Exception/ClassNotFoundException.php create mode 100644 vendor/symfony/debug/Exception/FatalErrorException.php create mode 100644 vendor/symfony/debug/Exception/FatalThrowableError.php create mode 100644 vendor/symfony/debug/Exception/FlattenException.php create mode 100644 vendor/symfony/debug/Exception/OutOfMemoryException.php create mode 100644 vendor/symfony/debug/Exception/SilencedErrorContext.php create mode 100644 vendor/symfony/debug/Exception/UndefinedFunctionException.php create mode 100644 vendor/symfony/debug/Exception/UndefinedMethodException.php create mode 100644 vendor/symfony/debug/ExceptionHandler.php create mode 100644 vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php create mode 100644 vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php create mode 100644 vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php create mode 100644 vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php create mode 100644 vendor/symfony/debug/LICENSE create mode 100644 vendor/symfony/debug/README.md create mode 100644 vendor/symfony/debug/Tests/DebugClassLoaderTest.php create mode 100644 vendor/symfony/debug/Tests/ErrorHandlerTest.php create mode 100644 vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php create mode 100644 vendor/symfony/debug/Tests/ExceptionHandlerTest.php create mode 100644 vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php create mode 100644 vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php create mode 100644 vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/AnnotatedClass.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/ClassAlias.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/ClassWithAnnotatedParameters.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/DeprecatedClass.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/DeprecatedInterface.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/ExtendedFinalMethod.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/FinalClass.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/FinalMethod.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/FinalMethod2Trait.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/InterfaceWithAnnotatedParameters.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/InternalClass.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/InternalInterface.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/InternalTrait.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/InternalTrait2.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/NonDeprecatedInterface.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/PEARClass.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/SubClassWithAnnotatedParameters.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/Throwing.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/ToStringThrower.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/TraitWithAnnotatedParameters.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/TraitWithInternalMethod.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/casemismatch.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/notPsr0Bis.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/psr4/Psr4CaseMismatch.php create mode 100644 vendor/symfony/debug/Tests/Fixtures/reallyNotPsr0.php create mode 100644 vendor/symfony/debug/Tests/Fixtures2/RequiredTwice.php create mode 100644 vendor/symfony/debug/Tests/HeaderMock.php create mode 100644 vendor/symfony/debug/Tests/MockExceptionHandler.php create mode 100644 vendor/symfony/debug/Tests/phpt/debug_class_loader.phpt create mode 100644 vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt create mode 100644 vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt create mode 100644 vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt create mode 100644 vendor/symfony/debug/composer.json create mode 100644 vendor/symfony/debug/phpunit.xml.dist create mode 100644 vendor/symfony/event-dispatcher/.gitignore create mode 100644 vendor/symfony/event-dispatcher/CHANGELOG.md create mode 100644 vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php create mode 100644 vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php create mode 100644 vendor/symfony/event-dispatcher/Debug/WrappedListener.php create mode 100644 vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php create mode 100644 vendor/symfony/event-dispatcher/Event.php create mode 100644 vendor/symfony/event-dispatcher/EventDispatcher.php create mode 100644 vendor/symfony/event-dispatcher/EventDispatcherInterface.php create mode 100644 vendor/symfony/event-dispatcher/EventSubscriberInterface.php create mode 100644 vendor/symfony/event-dispatcher/GenericEvent.php create mode 100644 vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php create mode 100644 vendor/symfony/event-dispatcher/LICENSE create mode 100644 vendor/symfony/event-dispatcher/README.md create mode 100644 vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php create mode 100644 vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php create mode 100644 vendor/symfony/event-dispatcher/Tests/Debug/WrappedListenerTest.php create mode 100644 vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php create mode 100644 vendor/symfony/event-dispatcher/Tests/EventDispatcherTest.php create mode 100644 vendor/symfony/event-dispatcher/Tests/EventTest.php create mode 100644 vendor/symfony/event-dispatcher/Tests/GenericEventTest.php create mode 100644 vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php create mode 100644 vendor/symfony/event-dispatcher/composer.json create mode 100644 vendor/symfony/event-dispatcher/phpunit.xml.dist create mode 100644 vendor/symfony/finder/.gitignore create mode 100644 vendor/symfony/finder/CHANGELOG.md create mode 100644 vendor/symfony/finder/Comparator/Comparator.php create mode 100644 vendor/symfony/finder/Comparator/DateComparator.php create mode 100644 vendor/symfony/finder/Comparator/NumberComparator.php create mode 100644 vendor/symfony/finder/Exception/AccessDeniedException.php create mode 100644 vendor/symfony/finder/Finder.php create mode 100644 vendor/symfony/finder/Glob.php create mode 100644 vendor/symfony/finder/Iterator/CustomFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/DateRangeFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/FileTypeFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/FilecontentFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/FilenameFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/PathFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php create mode 100644 vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/SortableIterator.php create mode 100644 vendor/symfony/finder/LICENSE create mode 100644 vendor/symfony/finder/README.md create mode 100644 vendor/symfony/finder/SplFileInfo.php create mode 100644 vendor/symfony/finder/Tests/Comparator/ComparatorTest.php create mode 100644 vendor/symfony/finder/Tests/Comparator/DateComparatorTest.php create mode 100644 vendor/symfony/finder/Tests/Comparator/NumberComparatorTest.php create mode 100644 vendor/symfony/finder/Tests/FinderTest.php create mode 100644 vendor/symfony/finder/Tests/Fixtures/.dot/a create mode 100644 vendor/symfony/finder/Tests/Fixtures/.dot/b/c.neon create mode 100644 vendor/symfony/finder/Tests/Fixtures/.dot/b/d.neon create mode 100644 vendor/symfony/finder/Tests/Fixtures/A/B/C/abc.dat create mode 100644 vendor/symfony/finder/Tests/Fixtures/A/B/ab.dat create mode 100644 vendor/symfony/finder/Tests/Fixtures/A/a.dat create mode 100644 vendor/symfony/finder/Tests/Fixtures/copy/A/B/C/abc.dat.copy create mode 100644 vendor/symfony/finder/Tests/Fixtures/copy/A/B/ab.dat.copy create mode 100644 vendor/symfony/finder/Tests/Fixtures/copy/A/a.dat.copy create mode 100644 vendor/symfony/finder/Tests/Fixtures/dolor.txt create mode 100644 vendor/symfony/finder/Tests/Fixtures/ipsum.txt create mode 100644 vendor/symfony/finder/Tests/Fixtures/lorem.txt create mode 100644 vendor/symfony/finder/Tests/Fixtures/one/.dot create mode 100644 vendor/symfony/finder/Tests/Fixtures/one/a create mode 100644 vendor/symfony/finder/Tests/Fixtures/one/b/c.neon create mode 100644 vendor/symfony/finder/Tests/Fixtures/one/b/d.neon create mode 100644 vendor/symfony/finder/Tests/Fixtures/r+e.gex[c]a(r)s/dir/bar.dat create mode 100644 vendor/symfony/finder/Tests/Fixtures/with space/foo.txt create mode 100644 vendor/symfony/finder/Tests/GlobTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/CustomFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/DepthRangeFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/FileTypeFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/FilecontentFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/Iterator.php create mode 100644 vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php create mode 100644 vendor/symfony/finder/Tests/Iterator/MockFileListIterator.php create mode 100644 vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php create mode 100644 vendor/symfony/finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php create mode 100644 vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php create mode 100644 vendor/symfony/finder/composer.json create mode 100644 vendor/symfony/finder/phpunit.xml.dist create mode 100644 vendor/symfony/http-foundation/.gitignore create mode 100644 vendor/symfony/http-foundation/AcceptHeader.php create mode 100644 vendor/symfony/http-foundation/AcceptHeaderItem.php create mode 100644 vendor/symfony/http-foundation/ApacheRequest.php create mode 100644 vendor/symfony/http-foundation/BinaryFileResponse.php create mode 100644 vendor/symfony/http-foundation/CHANGELOG.md create mode 100644 vendor/symfony/http-foundation/Cookie.php create mode 100644 vendor/symfony/http-foundation/Exception/ConflictingHeadersException.php create mode 100644 vendor/symfony/http-foundation/Exception/RequestExceptionInterface.php create mode 100644 vendor/symfony/http-foundation/Exception/SuspiciousOperationException.php create mode 100644 vendor/symfony/http-foundation/ExpressionRequestMatcher.php create mode 100644 vendor/symfony/http-foundation/File/Exception/AccessDeniedException.php create mode 100644 vendor/symfony/http-foundation/File/Exception/CannotWriteFileException.php create mode 100644 vendor/symfony/http-foundation/File/Exception/ExtensionFileException.php create mode 100644 vendor/symfony/http-foundation/File/Exception/FileException.php create mode 100644 vendor/symfony/http-foundation/File/Exception/FileNotFoundException.php create mode 100644 vendor/symfony/http-foundation/File/Exception/FormSizeFileException.php create mode 100644 vendor/symfony/http-foundation/File/Exception/IniSizeFileException.php create mode 100644 vendor/symfony/http-foundation/File/Exception/NoFileException.php create mode 100644 vendor/symfony/http-foundation/File/Exception/NoTmpDirFileException.php create mode 100644 vendor/symfony/http-foundation/File/Exception/PartialFileException.php create mode 100644 vendor/symfony/http-foundation/File/Exception/UnexpectedTypeException.php create mode 100644 vendor/symfony/http-foundation/File/Exception/UploadException.php create mode 100644 vendor/symfony/http-foundation/File/File.php create mode 100644 vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php create mode 100644 vendor/symfony/http-foundation/File/MimeType/ExtensionGuesserInterface.php create mode 100644 vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php create mode 100644 vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php create mode 100644 vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php create mode 100644 vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php create mode 100644 vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php create mode 100644 vendor/symfony/http-foundation/File/Stream.php create mode 100644 vendor/symfony/http-foundation/File/UploadedFile.php create mode 100644 vendor/symfony/http-foundation/FileBag.php create mode 100644 vendor/symfony/http-foundation/HeaderBag.php create mode 100644 vendor/symfony/http-foundation/HeaderUtils.php create mode 100644 vendor/symfony/http-foundation/IpUtils.php create mode 100644 vendor/symfony/http-foundation/JsonResponse.php create mode 100644 vendor/symfony/http-foundation/LICENSE create mode 100644 vendor/symfony/http-foundation/ParameterBag.php create mode 100644 vendor/symfony/http-foundation/README.md create mode 100644 vendor/symfony/http-foundation/RedirectResponse.php create mode 100644 vendor/symfony/http-foundation/Request.php create mode 100644 vendor/symfony/http-foundation/RequestMatcher.php create mode 100644 vendor/symfony/http-foundation/RequestMatcherInterface.php create mode 100644 vendor/symfony/http-foundation/RequestStack.php create mode 100644 vendor/symfony/http-foundation/Response.php create mode 100644 vendor/symfony/http-foundation/ResponseHeaderBag.php create mode 100644 vendor/symfony/http-foundation/ServerBag.php create mode 100644 vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php create mode 100644 vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php create mode 100644 vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php create mode 100644 vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php create mode 100644 vendor/symfony/http-foundation/Session/Flash/FlashBag.php create mode 100644 vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php create mode 100644 vendor/symfony/http-foundation/Session/Session.php create mode 100644 vendor/symfony/http-foundation/Session/SessionBagInterface.php create mode 100644 vendor/symfony/http-foundation/Session/SessionBagProxy.php create mode 100644 vendor/symfony/http-foundation/Session/SessionInterface.php create mode 100644 vendor/symfony/http-foundation/Session/SessionUtils.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/MigratingSessionHandler.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/RedisSessionHandler.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/MetadataBag.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php create mode 100644 vendor/symfony/http-foundation/StreamedResponse.php create mode 100644 vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php create mode 100644 vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php create mode 100644 vendor/symfony/http-foundation/Tests/ApacheRequestTest.php create mode 100644 vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php create mode 100644 vendor/symfony/http-foundation/Tests/CookieTest.php create mode 100644 vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php create mode 100644 vendor/symfony/http-foundation/Tests/File/FakeFile.php create mode 100644 vendor/symfony/http-foundation/Tests/File/FileTest.php create mode 100644 vendor/symfony/http-foundation/Tests/File/Fixtures/.unknownextension create mode 100644 vendor/symfony/http-foundation/Tests/File/Fixtures/directory/.empty create mode 100644 vendor/symfony/http-foundation/Tests/File/Fixtures/other-file.example create mode 100644 vendor/symfony/http-foundation/Tests/File/Fixtures/test create mode 100644 vendor/symfony/http-foundation/Tests/File/Fixtures/test.gif create mode 100644 vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php create mode 100644 vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php create mode 100644 vendor/symfony/http-foundation/Tests/FileBagTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Fixtures/response-functional/common.inc create mode 100644 vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_max_age.expected create mode 100644 vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_max_age.php create mode 100644 vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_raw_urlencode.expected create mode 100644 vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_raw_urlencode.php create mode 100644 vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_lax.expected create mode 100644 vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_lax.php create mode 100644 vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_strict.expected create mode 100644 vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_strict.php create mode 100644 vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.expected create mode 100644 vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.php create mode 100644 vendor/symfony/http-foundation/Tests/Fixtures/response-functional/invalid_cookie_name.expected create mode 100644 vendor/symfony/http-foundation/Tests/Fixtures/response-functional/invalid_cookie_name.php create mode 100644 vendor/symfony/http-foundation/Tests/HeaderBagTest.php create mode 100644 vendor/symfony/http-foundation/Tests/HeaderUtilsTest.php create mode 100644 vendor/symfony/http-foundation/Tests/IpUtilsTest.php create mode 100644 vendor/symfony/http-foundation/Tests/JsonResponseTest.php create mode 100644 vendor/symfony/http-foundation/Tests/ParameterBagTest.php create mode 100644 vendor/symfony/http-foundation/Tests/RedirectResponseTest.php create mode 100644 vendor/symfony/http-foundation/Tests/RequestMatcherTest.php create mode 100644 vendor/symfony/http-foundation/Tests/RequestStackTest.php create mode 100644 vendor/symfony/http-foundation/Tests/RequestTest.php create mode 100644 vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php create mode 100644 vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php create mode 100644 vendor/symfony/http-foundation/Tests/ResponseTest.php create mode 100644 vendor/symfony/http-foundation/Tests/ResponseTestCase.php create mode 100644 vendor/symfony/http-foundation/Tests/ServerBagTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/SessionTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/common.inc create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.expected create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/empty_destroys.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.expected create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/read_only.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.expected create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/regenerate.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.expected create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/storage.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.expected create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.expected create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_cookie_and_session.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.expected create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.expected create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisClusterSessionHandlerTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisSessionHandlerTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/RedisArraySessionHandlerTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/RedisClusterSessionHandlerTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/RedisSessionHandlerTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php create mode 100644 vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php create mode 100644 vendor/symfony/http-foundation/Tests/StreamedResponseTest.php create mode 100644 vendor/symfony/http-foundation/Tests/schema/http-status-codes.rng create mode 100644 vendor/symfony/http-foundation/Tests/schema/iana-registry.rng create mode 100644 vendor/symfony/http-foundation/composer.json create mode 100644 vendor/symfony/http-foundation/phpunit.xml.dist create mode 100644 vendor/symfony/http-kernel/.gitignore create mode 100644 vendor/symfony/http-kernel/Bundle/Bundle.php create mode 100644 vendor/symfony/http-kernel/Bundle/BundleInterface.php create mode 100644 vendor/symfony/http-kernel/CHANGELOG.md create mode 100644 vendor/symfony/http-kernel/CacheClearer/CacheClearerInterface.php create mode 100644 vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php create mode 100644 vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php create mode 100644 vendor/symfony/http-kernel/CacheWarmer/CacheWarmer.php create mode 100644 vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php create mode 100644 vendor/symfony/http-kernel/CacheWarmer/CacheWarmerInterface.php create mode 100644 vendor/symfony/http-kernel/CacheWarmer/WarmableInterface.php create mode 100644 vendor/symfony/http-kernel/Client.php create mode 100644 vendor/symfony/http-kernel/Config/FileLocator.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/DefaultValueResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/RequestValueResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/SessionValueResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/TraceableValueResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/VariadicValueResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolverInterface.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentValueResolverInterface.php create mode 100644 vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ControllerReference.php create mode 100644 vendor/symfony/http-kernel/Controller/ControllerResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php create mode 100644 vendor/symfony/http-kernel/Controller/TraceableArgumentResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php create mode 100644 vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadata.php create mode 100644 vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php create mode 100644 vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactoryInterface.php create mode 100644 vendor/symfony/http-kernel/DataCollector/AjaxDataCollector.php create mode 100644 vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php create mode 100644 vendor/symfony/http-kernel/DataCollector/DataCollector.php create mode 100644 vendor/symfony/http-kernel/DataCollector/DataCollectorInterface.php create mode 100644 vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php create mode 100644 vendor/symfony/http-kernel/DataCollector/EventDataCollector.php create mode 100644 vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php create mode 100644 vendor/symfony/http-kernel/DataCollector/LateDataCollectorInterface.php create mode 100644 vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php create mode 100644 vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php create mode 100644 vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php create mode 100644 vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php create mode 100644 vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php create mode 100644 vendor/symfony/http-kernel/Debug/FileLinkFormatter.php create mode 100644 vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/Extension.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/LoggerPass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/ServicesResetter.php create mode 100644 vendor/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php create mode 100644 vendor/symfony/http-kernel/Event/FilterControllerEvent.php create mode 100644 vendor/symfony/http-kernel/Event/FilterResponseEvent.php create mode 100644 vendor/symfony/http-kernel/Event/FinishRequestEvent.php create mode 100644 vendor/symfony/http-kernel/Event/GetResponseEvent.php create mode 100644 vendor/symfony/http-kernel/Event/GetResponseForControllerResultEvent.php create mode 100644 vendor/symfony/http-kernel/Event/GetResponseForExceptionEvent.php create mode 100644 vendor/symfony/http-kernel/Event/KernelEvent.php create mode 100644 vendor/symfony/http-kernel/Event/PostResponseEvent.php create mode 100644 vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/DumpListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/ExceptionListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/FragmentListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/LocaleListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/ProfilerListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/ResponseListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/RouterListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/SaveSessionListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/SessionListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/SurrogateListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/TestSessionListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/TranslatorListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php create mode 100644 vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php create mode 100644 vendor/symfony/http-kernel/Exception/BadRequestHttpException.php create mode 100644 vendor/symfony/http-kernel/Exception/ConflictHttpException.php create mode 100644 vendor/symfony/http-kernel/Exception/ControllerDoesNotReturnResponseException.php create mode 100644 vendor/symfony/http-kernel/Exception/GoneHttpException.php create mode 100644 vendor/symfony/http-kernel/Exception/HttpException.php create mode 100644 vendor/symfony/http-kernel/Exception/HttpExceptionInterface.php create mode 100644 vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php create mode 100644 vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php create mode 100644 vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php create mode 100644 vendor/symfony/http-kernel/Exception/NotFoundHttpException.php create mode 100644 vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php create mode 100644 vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php create mode 100644 vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php create mode 100644 vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php create mode 100644 vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php create mode 100644 vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php create mode 100644 vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php create mode 100644 vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php create mode 100644 vendor/symfony/http-kernel/Fragment/EsiFragmentRenderer.php create mode 100644 vendor/symfony/http-kernel/Fragment/FragmentHandler.php create mode 100644 vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php create mode 100644 vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php create mode 100644 vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php create mode 100644 vendor/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php create mode 100644 vendor/symfony/http-kernel/Fragment/SsiFragmentRenderer.php create mode 100644 vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php create mode 100644 vendor/symfony/http-kernel/HttpCache/Esi.php create mode 100644 vendor/symfony/http-kernel/HttpCache/HttpCache.php create mode 100644 vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php create mode 100644 vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php create mode 100644 vendor/symfony/http-kernel/HttpCache/Ssi.php create mode 100644 vendor/symfony/http-kernel/HttpCache/Store.php create mode 100644 vendor/symfony/http-kernel/HttpCache/StoreInterface.php create mode 100644 vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php create mode 100644 vendor/symfony/http-kernel/HttpCache/SurrogateInterface.php create mode 100644 vendor/symfony/http-kernel/HttpKernel.php create mode 100644 vendor/symfony/http-kernel/HttpKernelInterface.php create mode 100644 vendor/symfony/http-kernel/Kernel.php create mode 100644 vendor/symfony/http-kernel/KernelEvents.php create mode 100644 vendor/symfony/http-kernel/KernelInterface.php create mode 100644 vendor/symfony/http-kernel/LICENSE create mode 100644 vendor/symfony/http-kernel/Log/DebugLoggerInterface.php create mode 100644 vendor/symfony/http-kernel/Log/Logger.php create mode 100644 vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php create mode 100644 vendor/symfony/http-kernel/Profiler/Profile.php create mode 100644 vendor/symfony/http-kernel/Profiler/Profiler.php create mode 100644 vendor/symfony/http-kernel/Profiler/ProfilerStorageInterface.php create mode 100644 vendor/symfony/http-kernel/README.md create mode 100644 vendor/symfony/http-kernel/RebootableInterface.php create mode 100644 vendor/symfony/http-kernel/Resources/welcome.html.php create mode 100644 vendor/symfony/http-kernel/TerminableInterface.php create mode 100644 vendor/symfony/http-kernel/Tests/Bundle/BundleTest.php create mode 100644 vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php create mode 100644 vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/ClientTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Config/FileLocatorTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/TraceableValueResolverTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php create mode 100644 vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php create mode 100644 vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/Compiler.log create mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/DataCollectorTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/ExceptionDataCollectorTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DataCollector/TimeDataCollectorTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Debug/FileLinkFormatterTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/ControllerArgumentValueResolverPassTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/LoggerPassTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/ResettableServicePassTest.php create mode 100644 vendor/symfony/http-kernel/Tests/DependencyInjection/ServicesResetterTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Event/GetResponseForExceptionEventTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/DumpListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/SaveSessionListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/TranslatorListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/AccessDeniedHttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/BadRequestHttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/ConflictHttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/GoneHttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/LengthRequiredHttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/NotAcceptableHttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/NotFoundHttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/PreconditionFailedHttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/PreconditionRequiredHttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/BaseBundle/Resources/foo.txt create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/BaseBundle/Resources/hide.txt create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Bundle1Bundle/Resources/foo.txt create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Bundle1Bundle/bar.txt create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Bundle1Bundle/foo.txt create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Bundle2Bundle/foo.txt create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ChildBundle/Resources/foo.txt create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ChildBundle/Resources/hide.txt create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ClearableService.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Controller/BasicTypesController.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Controller/ExtendingRequest.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Controller/ExtendingSession.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Controller/NullableController.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Controller/VariadicController.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionAbsentBundle/ExtensionAbsentBundle.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionLoadedBundle/DependencyInjection/ExtensionLoadedExtension.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionNotValidBundle/DependencyInjection/ExtensionNotValidExtension.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionNotValidBundle/ExtensionNotValidBundle.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/Command/FooCommand.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/DependencyInjection/ExtensionPresentExtension.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ExtensionPresentBundle/ExtensionPresentBundle.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/KernelForOverrideName.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/KernelWithoutBundles.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/ResettableService.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Resources/BaseBundle/hide.txt create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Resources/Bundle1Bundle/foo.txt create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Resources/ChildBundle/foo.txt create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/Resources/FooBundle/foo.txt create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/TestClient.php create mode 100644 vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php create mode 100644 vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Fragment/RoutableFragmentRendererTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php create mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php create mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php create mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php create mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/ResponseCacheStrategyTest.php create mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php create mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php create mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/SubRequestHandlerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php create mode 100644 vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php create mode 100644 vendor/symfony/http-kernel/Tests/HttpKernelTest.php create mode 100644 vendor/symfony/http-kernel/Tests/KernelTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Log/LoggerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Logger.php create mode 100644 vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php create mode 100644 vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php create mode 100644 vendor/symfony/http-kernel/Tests/TestHttpKernel.php create mode 100644 vendor/symfony/http-kernel/Tests/UriSignerTest.php create mode 100644 vendor/symfony/http-kernel/UriSigner.php create mode 100644 vendor/symfony/http-kernel/composer.json create mode 100644 vendor/symfony/http-kernel/phpunit.xml.dist create mode 100644 vendor/symfony/polyfill-ctype/Ctype.php create mode 100644 vendor/symfony/polyfill-ctype/LICENSE create mode 100644 vendor/symfony/polyfill-ctype/README.md create mode 100644 vendor/symfony/polyfill-ctype/bootstrap.php create mode 100644 vendor/symfony/polyfill-ctype/composer.json create mode 100644 vendor/symfony/polyfill-mbstring/LICENSE create mode 100644 vendor/symfony/polyfill-mbstring/Mbstring.php create mode 100644 vendor/symfony/polyfill-mbstring/README.md create mode 100644 vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php create mode 100644 vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php create mode 100644 vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php create mode 100644 vendor/symfony/polyfill-mbstring/bootstrap.php create mode 100644 vendor/symfony/polyfill-mbstring/composer.json create mode 100644 vendor/symfony/polyfill-php72/LICENSE create mode 100644 vendor/symfony/polyfill-php72/Php72.php create mode 100644 vendor/symfony/polyfill-php72/README.md create mode 100644 vendor/symfony/polyfill-php72/bootstrap.php create mode 100644 vendor/symfony/polyfill-php72/composer.json create mode 100644 vendor/symfony/process/.gitignore create mode 100644 vendor/symfony/process/CHANGELOG.md create mode 100644 vendor/symfony/process/Exception/ExceptionInterface.php create mode 100644 vendor/symfony/process/Exception/InvalidArgumentException.php create mode 100644 vendor/symfony/process/Exception/LogicException.php create mode 100644 vendor/symfony/process/Exception/ProcessFailedException.php create mode 100644 vendor/symfony/process/Exception/ProcessSignaledException.php create mode 100644 vendor/symfony/process/Exception/ProcessTimedOutException.php create mode 100644 vendor/symfony/process/Exception/RuntimeException.php create mode 100644 vendor/symfony/process/ExecutableFinder.php create mode 100644 vendor/symfony/process/InputStream.php create mode 100644 vendor/symfony/process/LICENSE create mode 100644 vendor/symfony/process/PhpExecutableFinder.php create mode 100644 vendor/symfony/process/PhpProcess.php create mode 100644 vendor/symfony/process/Pipes/AbstractPipes.php create mode 100644 vendor/symfony/process/Pipes/PipesInterface.php create mode 100644 vendor/symfony/process/Pipes/UnixPipes.php create mode 100644 vendor/symfony/process/Pipes/WindowsPipes.php create mode 100644 vendor/symfony/process/Process.php create mode 100644 vendor/symfony/process/ProcessUtils.php create mode 100644 vendor/symfony/process/README.md create mode 100644 vendor/symfony/process/Tests/ExecutableFinderTest.php create mode 100644 vendor/symfony/process/Tests/KillableProcessWithOutput.php create mode 100644 vendor/symfony/process/Tests/NonStopableProcess.php create mode 100644 vendor/symfony/process/Tests/PhpExecutableFinderTest.php create mode 100644 vendor/symfony/process/Tests/PhpProcessTest.php create mode 100644 vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php create mode 100644 vendor/symfony/process/Tests/ProcessFailedExceptionTest.php create mode 100644 vendor/symfony/process/Tests/ProcessTest.php create mode 100644 vendor/symfony/process/Tests/SignalListener.php create mode 100644 vendor/symfony/process/composer.json create mode 100644 vendor/symfony/process/phpunit.xml.dist create mode 100644 vendor/symfony/routing/.gitignore create mode 100644 vendor/symfony/routing/Annotation/Route.php create mode 100644 vendor/symfony/routing/CHANGELOG.md create mode 100644 vendor/symfony/routing/CompiledRoute.php create mode 100644 vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php create mode 100644 vendor/symfony/routing/Exception/ExceptionInterface.php create mode 100644 vendor/symfony/routing/Exception/InvalidParameterException.php create mode 100644 vendor/symfony/routing/Exception/MethodNotAllowedException.php create mode 100644 vendor/symfony/routing/Exception/MissingMandatoryParametersException.php create mode 100644 vendor/symfony/routing/Exception/NoConfigurationException.php create mode 100644 vendor/symfony/routing/Exception/ResourceNotFoundException.php create mode 100644 vendor/symfony/routing/Exception/RouteNotFoundException.php create mode 100644 vendor/symfony/routing/Generator/ConfigurableRequirementsInterface.php create mode 100644 vendor/symfony/routing/Generator/Dumper/GeneratorDumper.php create mode 100644 vendor/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php create mode 100644 vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php create mode 100644 vendor/symfony/routing/Generator/UrlGenerator.php create mode 100644 vendor/symfony/routing/Generator/UrlGeneratorInterface.php create mode 100644 vendor/symfony/routing/LICENSE create mode 100644 vendor/symfony/routing/Loader/AnnotationClassLoader.php create mode 100644 vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php create mode 100644 vendor/symfony/routing/Loader/AnnotationFileLoader.php create mode 100644 vendor/symfony/routing/Loader/ClosureLoader.php create mode 100644 vendor/symfony/routing/Loader/Configurator/CollectionConfigurator.php create mode 100644 vendor/symfony/routing/Loader/Configurator/ImportConfigurator.php create mode 100644 vendor/symfony/routing/Loader/Configurator/RouteConfigurator.php create mode 100644 vendor/symfony/routing/Loader/Configurator/RoutingConfigurator.php create mode 100644 vendor/symfony/routing/Loader/Configurator/Traits/AddTrait.php create mode 100644 vendor/symfony/routing/Loader/Configurator/Traits/RouteTrait.php create mode 100644 vendor/symfony/routing/Loader/DependencyInjection/ServiceRouterLoader.php create mode 100644 vendor/symfony/routing/Loader/DirectoryLoader.php create mode 100644 vendor/symfony/routing/Loader/GlobFileLoader.php create mode 100644 vendor/symfony/routing/Loader/ObjectRouteLoader.php create mode 100644 vendor/symfony/routing/Loader/PhpFileLoader.php create mode 100644 vendor/symfony/routing/Loader/XmlFileLoader.php create mode 100644 vendor/symfony/routing/Loader/YamlFileLoader.php create mode 100644 vendor/symfony/routing/Loader/schema/routing/routing-1.0.xsd create mode 100644 vendor/symfony/routing/Matcher/Dumper/MatcherDumper.php create mode 100644 vendor/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php create mode 100644 vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php create mode 100644 vendor/symfony/routing/Matcher/Dumper/PhpMatcherTrait.php create mode 100644 vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php create mode 100644 vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php create mode 100644 vendor/symfony/routing/Matcher/RedirectableUrlMatcherInterface.php create mode 100644 vendor/symfony/routing/Matcher/RequestMatcherInterface.php create mode 100644 vendor/symfony/routing/Matcher/TraceableUrlMatcher.php create mode 100644 vendor/symfony/routing/Matcher/UrlMatcher.php create mode 100644 vendor/symfony/routing/Matcher/UrlMatcherInterface.php create mode 100644 vendor/symfony/routing/README.md create mode 100644 vendor/symfony/routing/RequestContext.php create mode 100644 vendor/symfony/routing/RequestContextAwareInterface.php create mode 100644 vendor/symfony/routing/Route.php create mode 100644 vendor/symfony/routing/RouteCollection.php create mode 100644 vendor/symfony/routing/RouteCollectionBuilder.php create mode 100644 vendor/symfony/routing/RouteCompiler.php create mode 100644 vendor/symfony/routing/RouteCompilerInterface.php create mode 100644 vendor/symfony/routing/Router.php create mode 100644 vendor/symfony/routing/RouterInterface.php create mode 100644 vendor/symfony/routing/Tests/Annotation/RouteTest.php create mode 100644 vendor/symfony/routing/Tests/CompiledRouteTest.php create mode 100644 vendor/symfony/routing/Tests/DependencyInjection/RoutingResolverPassTest.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/AbstractClass.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/BarClass.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/BazClass.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/FooClass.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/AbstractClassController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/ActionPathController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/DefaultValueController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/ExplicitLocalizedActionPathController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/InvokableController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/InvokableLocalizedController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/LocalizedActionPathController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/LocalizedMethodActionControllers.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/LocalizedPrefixLocalizedActionController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/LocalizedPrefixMissingLocaleActionController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/LocalizedPrefixMissingRouteLocaleActionController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/LocalizedPrefixWithRouteWithoutLocale.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/MethodActionControllers.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/MissingRouteNameController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/NothingButNameController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/PrefixedActionLocalizedRouteController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/PrefixedActionPathController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/RequirementsWithoutPlaceholderNameController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/AnnotationFixtures/RouteWithPrefixController.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/CustomCompiledRoute.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/CustomRouteCompiler.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/CustomXmlFileLoader.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/AnonymousClassInTrait.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/NoStartTagClass.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/VariadicClass.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/annotated.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/bad_format.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/bar.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/import__controller.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/import__controller.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/import_controller.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/import_controller.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/import_override_defaults.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/import_override_defaults.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/override_defaults.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/override_defaults.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/routing.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/controller/routing.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes1.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes2.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/directory/routes3.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/directory_import/import.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher0.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher10.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher11.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher12.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher13.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher8.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher9.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/empty.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/file_resource.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/foo.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/foo1.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/glob/bar.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/glob/bar.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/glob/baz.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/glob/baz.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/glob/import_multiple.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/glob/import_multiple.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/glob/import_single.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/glob/import_single.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/glob/php_dsl.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_bar.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_baz.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/import_with_name_prefix/routing.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/import_with_name_prefix/routing.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/import_with_no_trailing_slash/routing.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/import_with_no_trailing_slash/routing.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/incomplete.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/list_defaults.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/list_in_list_defaults.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/list_in_map_defaults.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/list_null_values.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized/imported-with-locale-but-not-localized.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized/imported-with-locale-but-not-localized.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized/imported-with-locale.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized/imported-with-locale.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized/importer-with-controller-default.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized/importer-with-locale-imports-non-localized-route.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized/importer-with-locale-imports-non-localized-route.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized/importer-with-locale.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized/importer-with-locale.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized/importing-localized-route.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized/localized-route.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized/missing-locale-in-importer.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized/not-localized.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized/officially_formatted_locales.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/localized/route-without-path-or-locales.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/map_defaults.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/map_in_list_defaults.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/map_in_map_defaults.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/map_null_values.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/missing_id.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/missing_path.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/namespaceprefix.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/nonesense_resource_plus_path.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/nonesense_type_without_resource.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/nonvalid.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/nonvalid.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/nonvalid2.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/nonvalidkeys.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/nonvalidnode.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/nonvalidroute.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/null_values.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/php_dsl.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/php_dsl_i18n.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/php_dsl_sub.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/php_dsl_sub_i18n.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/php_dsl_sub_root.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/php_object_dsl.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/requirements_without_placeholder_name.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/scalar_defaults.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/special_route_name.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/validpattern.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/validpattern.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/validpattern.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/validresource.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/validresource.xml create mode 100644 vendor/symfony/routing/Tests/Fixtures/validresource.yml create mode 100644 vendor/symfony/routing/Tests/Fixtures/with_define_path_variable.php create mode 100644 vendor/symfony/routing/Tests/Fixtures/withdoctype.xml create mode 100644 vendor/symfony/routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php create mode 100644 vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php create mode 100644 vendor/symfony/routing/Tests/Loader/AbstractAnnotationLoaderTest.php create mode 100644 vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php create mode 100644 vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php create mode 100644 vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php create mode 100644 vendor/symfony/routing/Tests/Loader/ClosureLoaderTest.php create mode 100644 vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php create mode 100644 vendor/symfony/routing/Tests/Loader/FileLocatorStub.php create mode 100644 vendor/symfony/routing/Tests/Loader/GlobFileLoaderTest.php create mode 100644 vendor/symfony/routing/Tests/Loader/ObjectRouteLoaderTest.php create mode 100644 vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php create mode 100644 vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php create mode 100644 vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php create mode 100644 vendor/symfony/routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php create mode 100644 vendor/symfony/routing/Tests/Matcher/DumpedUrlMatcherTest.php create mode 100644 vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php create mode 100644 vendor/symfony/routing/Tests/Matcher/Dumper/StaticPrefixCollectionTest.php create mode 100644 vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php create mode 100644 vendor/symfony/routing/Tests/Matcher/TraceableUrlMatcherTest.php create mode 100644 vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php create mode 100644 vendor/symfony/routing/Tests/RequestContextTest.php create mode 100644 vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php create mode 100644 vendor/symfony/routing/Tests/RouteCollectionTest.php create mode 100644 vendor/symfony/routing/Tests/RouteCompilerTest.php create mode 100644 vendor/symfony/routing/Tests/RouteTest.php create mode 100644 vendor/symfony/routing/Tests/RouterTest.php create mode 100644 vendor/symfony/routing/composer.json create mode 100644 vendor/symfony/routing/phpunit.xml.dist create mode 100644 vendor/symfony/translation/.gitignore create mode 100644 vendor/symfony/translation/CHANGELOG.md create mode 100644 vendor/symfony/translation/Catalogue/AbstractOperation.php create mode 100644 vendor/symfony/translation/Catalogue/MergeOperation.php create mode 100644 vendor/symfony/translation/Catalogue/OperationInterface.php create mode 100644 vendor/symfony/translation/Catalogue/TargetOperation.php create mode 100644 vendor/symfony/translation/Command/XliffLintCommand.php create mode 100755 vendor/symfony/translation/DataCollector/TranslationDataCollector.php create mode 100644 vendor/symfony/translation/DataCollectorTranslator.php create mode 100644 vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php create mode 100644 vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php create mode 100644 vendor/symfony/translation/DependencyInjection/TranslatorPass.php create mode 100644 vendor/symfony/translation/Dumper/CsvFileDumper.php create mode 100644 vendor/symfony/translation/Dumper/DumperInterface.php create mode 100644 vendor/symfony/translation/Dumper/FileDumper.php create mode 100644 vendor/symfony/translation/Dumper/IcuResFileDumper.php create mode 100644 vendor/symfony/translation/Dumper/IniFileDumper.php create mode 100644 vendor/symfony/translation/Dumper/JsonFileDumper.php create mode 100644 vendor/symfony/translation/Dumper/MoFileDumper.php create mode 100644 vendor/symfony/translation/Dumper/PhpFileDumper.php create mode 100644 vendor/symfony/translation/Dumper/PoFileDumper.php create mode 100644 vendor/symfony/translation/Dumper/QtFileDumper.php create mode 100644 vendor/symfony/translation/Dumper/XliffFileDumper.php create mode 100644 vendor/symfony/translation/Dumper/YamlFileDumper.php create mode 100644 vendor/symfony/translation/Exception/ExceptionInterface.php create mode 100644 vendor/symfony/translation/Exception/InvalidArgumentException.php create mode 100644 vendor/symfony/translation/Exception/InvalidResourceException.php create mode 100644 vendor/symfony/translation/Exception/LogicException.php create mode 100644 vendor/symfony/translation/Exception/NotFoundResourceException.php create mode 100644 vendor/symfony/translation/Exception/RuntimeException.php create mode 100644 vendor/symfony/translation/Extractor/AbstractFileExtractor.php create mode 100644 vendor/symfony/translation/Extractor/ChainExtractor.php create mode 100644 vendor/symfony/translation/Extractor/ExtractorInterface.php create mode 100644 vendor/symfony/translation/Extractor/PhpExtractor.php create mode 100644 vendor/symfony/translation/Extractor/PhpStringTokenParser.php create mode 100644 vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php create mode 100644 vendor/symfony/translation/Formatter/IntlFormatter.php create mode 100644 vendor/symfony/translation/Formatter/IntlFormatterInterface.php create mode 100644 vendor/symfony/translation/Formatter/MessageFormatter.php create mode 100644 vendor/symfony/translation/Formatter/MessageFormatterInterface.php create mode 100644 vendor/symfony/translation/IdentityTranslator.php create mode 100644 vendor/symfony/translation/Interval.php create mode 100644 vendor/symfony/translation/LICENSE create mode 100644 vendor/symfony/translation/Loader/ArrayLoader.php create mode 100644 vendor/symfony/translation/Loader/CsvFileLoader.php create mode 100644 vendor/symfony/translation/Loader/FileLoader.php create mode 100644 vendor/symfony/translation/Loader/IcuDatFileLoader.php create mode 100644 vendor/symfony/translation/Loader/IcuResFileLoader.php create mode 100644 vendor/symfony/translation/Loader/IniFileLoader.php create mode 100644 vendor/symfony/translation/Loader/JsonFileLoader.php create mode 100644 vendor/symfony/translation/Loader/LoaderInterface.php create mode 100644 vendor/symfony/translation/Loader/MoFileLoader.php create mode 100644 vendor/symfony/translation/Loader/PhpFileLoader.php create mode 100644 vendor/symfony/translation/Loader/PoFileLoader.php create mode 100644 vendor/symfony/translation/Loader/QtFileLoader.php create mode 100644 vendor/symfony/translation/Loader/XliffFileLoader.php create mode 100644 vendor/symfony/translation/Loader/YamlFileLoader.php create mode 100644 vendor/symfony/translation/LoggingTranslator.php create mode 100644 vendor/symfony/translation/MessageCatalogue.php create mode 100644 vendor/symfony/translation/MessageCatalogueInterface.php create mode 100644 vendor/symfony/translation/MessageSelector.php create mode 100644 vendor/symfony/translation/MetadataAwareInterface.php create mode 100644 vendor/symfony/translation/PluralizationRules.php create mode 100644 vendor/symfony/translation/README.md create mode 100644 vendor/symfony/translation/Reader/TranslationReader.php create mode 100644 vendor/symfony/translation/Reader/TranslationReaderInterface.php create mode 100644 vendor/symfony/translation/Resources/data/parents.json create mode 100644 vendor/symfony/translation/Resources/schemas/xliff-core-1.2-strict.xsd create mode 100644 vendor/symfony/translation/Resources/schemas/xliff-core-2.0.xsd create mode 100644 vendor/symfony/translation/Resources/schemas/xml.xsd create mode 100644 vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php create mode 100644 vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php create mode 100644 vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php create mode 100644 vendor/symfony/translation/Tests/Command/XliffLintCommandTest.php create mode 100644 vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php create mode 100644 vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php create mode 100644 vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php create mode 100644 vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php create mode 100644 vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php create mode 100644 vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php create mode 100644 vendor/symfony/translation/Tests/Dumper/FileDumperTest.php create mode 100644 vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php create mode 100644 vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php create mode 100644 vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php create mode 100644 vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php create mode 100644 vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php create mode 100644 vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php create mode 100644 vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php create mode 100644 vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php create mode 100644 vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php create mode 100644 vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php create mode 100644 vendor/symfony/translation/Tests/Formatter/IntlFormatterTest.php create mode 100644 vendor/symfony/translation/Tests/Formatter/MessageFormatterTest.php create mode 100644 vendor/symfony/translation/Tests/IdentityTranslatorTest.php create mode 100644 vendor/symfony/translation/Tests/IntervalTest.php create mode 100644 vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php create mode 100644 vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php create mode 100644 vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php create mode 100644 vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php create mode 100644 vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php create mode 100644 vendor/symfony/translation/Tests/Loader/LocalizedTestCase.php create mode 100644 vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php create mode 100644 vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php create mode 100644 vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php create mode 100644 vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php create mode 100644 vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php create mode 100644 vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php create mode 100644 vendor/symfony/translation/Tests/LoggingTranslatorTest.php create mode 100644 vendor/symfony/translation/Tests/MessageCatalogueTest.php create mode 100644 vendor/symfony/translation/Tests/MessageSelectorTest.php create mode 100644 vendor/symfony/translation/Tests/PluralizationRulesTest.php create mode 100644 vendor/symfony/translation/Tests/TranslatorCacheTest.php create mode 100644 vendor/symfony/translation/Tests/TranslatorTest.php create mode 100644 vendor/symfony/translation/Tests/Util/ArrayConverterTest.php create mode 100644 vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php create mode 100644 vendor/symfony/translation/Tests/fixtures/empty-translation.mo create mode 100644 vendor/symfony/translation/Tests/fixtures/empty-translation.po create mode 100644 vendor/symfony/translation/Tests/fixtures/empty.csv create mode 100644 vendor/symfony/translation/Tests/fixtures/empty.ini create mode 100644 vendor/symfony/translation/Tests/fixtures/empty.json create mode 100644 vendor/symfony/translation/Tests/fixtures/empty.mo create mode 100644 vendor/symfony/translation/Tests/fixtures/empty.po create mode 100644 vendor/symfony/translation/Tests/fixtures/empty.xlf create mode 100644 vendor/symfony/translation/Tests/fixtures/empty.yml create mode 100644 vendor/symfony/translation/Tests/fixtures/encoding.xlf create mode 100644 vendor/symfony/translation/Tests/fixtures/escaped-id-plurals.po create mode 100644 vendor/symfony/translation/Tests/fixtures/escaped-id.po create mode 100644 vendor/symfony/translation/Tests/fixtures/extractor/resource.format.engine create mode 100644 vendor/symfony/translation/Tests/fixtures/extractor/this.is.a.template.format.engine create mode 100644 vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php create mode 100644 vendor/symfony/translation/Tests/fixtures/fuzzy-translations.po create mode 100644 vendor/symfony/translation/Tests/fixtures/invalid-xml-resources.xlf create mode 100644 vendor/symfony/translation/Tests/fixtures/malformed.json create mode 100644 vendor/symfony/translation/Tests/fixtures/messages.yml create mode 100644 vendor/symfony/translation/Tests/fixtures/messages_linear.yml create mode 100644 vendor/symfony/translation/Tests/fixtures/non-valid.xlf create mode 100644 vendor/symfony/translation/Tests/fixtures/non-valid.yml create mode 100644 vendor/symfony/translation/Tests/fixtures/plurals.mo create mode 100644 vendor/symfony/translation/Tests/fixtures/plurals.po create mode 100644 vendor/symfony/translation/Tests/fixtures/resname.xlf create mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/corrupted/resources.dat create mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/en.res create mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/en.txt create mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/fr.res create mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/fr.txt create mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/packagelist.txt create mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/dat/resources.dat create mode 100644 vendor/symfony/translation/Tests/fixtures/resourcebundle/res/en.res create mode 100644 vendor/symfony/translation/Tests/fixtures/resources-2.0-clean.xlf create mode 100644 vendor/symfony/translation/Tests/fixtures/resources-2.0-multi-segment-unit.xlf create mode 100644 vendor/symfony/translation/Tests/fixtures/resources-2.0.xlf create mode 100644 vendor/symfony/translation/Tests/fixtures/resources-clean.xlf create mode 100644 vendor/symfony/translation/Tests/fixtures/resources-notes-meta.xlf create mode 100644 vendor/symfony/translation/Tests/fixtures/resources-target-attributes.xlf create mode 100644 vendor/symfony/translation/Tests/fixtures/resources-tool-info.xlf create mode 100644 vendor/symfony/translation/Tests/fixtures/resources.csv create mode 100644 vendor/symfony/translation/Tests/fixtures/resources.dump.json create mode 100644 vendor/symfony/translation/Tests/fixtures/resources.ini create mode 100644 vendor/symfony/translation/Tests/fixtures/resources.json create mode 100644 vendor/symfony/translation/Tests/fixtures/resources.mo create mode 100644 vendor/symfony/translation/Tests/fixtures/resources.php create mode 100644 vendor/symfony/translation/Tests/fixtures/resources.po create mode 100644 vendor/symfony/translation/Tests/fixtures/resources.ts create mode 100644 vendor/symfony/translation/Tests/fixtures/resources.xlf create mode 100644 vendor/symfony/translation/Tests/fixtures/resources.yml create mode 100644 vendor/symfony/translation/Tests/fixtures/valid.csv create mode 100644 vendor/symfony/translation/Tests/fixtures/with-attributes.xlf create mode 100644 vendor/symfony/translation/Tests/fixtures/withdoctype.xlf create mode 100644 vendor/symfony/translation/Tests/fixtures/withnote.xlf create mode 100644 vendor/symfony/translation/Translator.php create mode 100644 vendor/symfony/translation/TranslatorBagInterface.php create mode 100644 vendor/symfony/translation/TranslatorInterface.php create mode 100644 vendor/symfony/translation/Util/ArrayConverter.php create mode 100644 vendor/symfony/translation/Util/XliffUtils.php create mode 100644 vendor/symfony/translation/Writer/TranslationWriter.php create mode 100644 vendor/symfony/translation/Writer/TranslationWriterInterface.php create mode 100644 vendor/symfony/translation/composer.json create mode 100644 vendor/symfony/translation/phpunit.xml.dist create mode 100644 vendor/symfony/var-dumper/.gitignore create mode 100644 vendor/symfony/var-dumper/CHANGELOG.md create mode 100644 vendor/symfony/var-dumper/Caster/AmqpCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/ArgsStub.php create mode 100644 vendor/symfony/var-dumper/Caster/Caster.php create mode 100644 vendor/symfony/var-dumper/Caster/ClassStub.php create mode 100644 vendor/symfony/var-dumper/Caster/ConstStub.php create mode 100644 vendor/symfony/var-dumper/Caster/CutArrayStub.php create mode 100644 vendor/symfony/var-dumper/Caster/CutStub.php create mode 100644 vendor/symfony/var-dumper/Caster/DOMCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/DateCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/DoctrineCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/EnumStub.php create mode 100644 vendor/symfony/var-dumper/Caster/ExceptionCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/FrameStub.php create mode 100644 vendor/symfony/var-dumper/Caster/GmpCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/IntlCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/LinkStub.php create mode 100644 vendor/symfony/var-dumper/Caster/MemcachedCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/PdoCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/PgSqlCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/ProxyManagerCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/RedisCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/ReflectionCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/ResourceCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/SplCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/StubCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/SymfonyCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/TraceStub.php create mode 100644 vendor/symfony/var-dumper/Caster/XmlReaderCaster.php create mode 100644 vendor/symfony/var-dumper/Caster/XmlResourceCaster.php create mode 100644 vendor/symfony/var-dumper/Cloner/AbstractCloner.php create mode 100644 vendor/symfony/var-dumper/Cloner/ClonerInterface.php create mode 100644 vendor/symfony/var-dumper/Cloner/Cursor.php create mode 100644 vendor/symfony/var-dumper/Cloner/Data.php create mode 100644 vendor/symfony/var-dumper/Cloner/DumperInterface.php create mode 100644 vendor/symfony/var-dumper/Cloner/Stub.php create mode 100644 vendor/symfony/var-dumper/Cloner/VarCloner.php create mode 100644 vendor/symfony/var-dumper/Command/Descriptor/CliDescriptor.php create mode 100644 vendor/symfony/var-dumper/Command/Descriptor/DumpDescriptorInterface.php create mode 100644 vendor/symfony/var-dumper/Command/Descriptor/HtmlDescriptor.php create mode 100644 vendor/symfony/var-dumper/Command/ServerDumpCommand.php create mode 100644 vendor/symfony/var-dumper/Dumper/AbstractDumper.php create mode 100644 vendor/symfony/var-dumper/Dumper/CliDumper.php create mode 100644 vendor/symfony/var-dumper/Dumper/ContextProvider/CliContextProvider.php create mode 100644 vendor/symfony/var-dumper/Dumper/ContextProvider/ContextProviderInterface.php create mode 100644 vendor/symfony/var-dumper/Dumper/ContextProvider/RequestContextProvider.php create mode 100644 vendor/symfony/var-dumper/Dumper/ContextProvider/SourceContextProvider.php create mode 100644 vendor/symfony/var-dumper/Dumper/DataDumperInterface.php create mode 100644 vendor/symfony/var-dumper/Dumper/HtmlDumper.php create mode 100644 vendor/symfony/var-dumper/Dumper/ServerDumper.php create mode 100644 vendor/symfony/var-dumper/Exception/ThrowingCasterException.php create mode 100644 vendor/symfony/var-dumper/LICENSE create mode 100644 vendor/symfony/var-dumper/README.md create mode 100755 vendor/symfony/var-dumper/Resources/bin/var-dump-server create mode 100644 vendor/symfony/var-dumper/Resources/css/htmlDescriptor.css create mode 100644 vendor/symfony/var-dumper/Resources/functions/dump.php create mode 100644 vendor/symfony/var-dumper/Resources/js/htmlDescriptor.js create mode 100644 vendor/symfony/var-dumper/Server/Connection.php create mode 100644 vendor/symfony/var-dumper/Server/DumpServer.php create mode 100644 vendor/symfony/var-dumper/Test/VarDumperTestTrait.php create mode 100644 vendor/symfony/var-dumper/Tests/Caster/CasterTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Caster/DateCasterTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Caster/GmpCasterTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Caster/IntlCasterTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Caster/MemcachedCasterTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Caster/PdoCasterTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Caster/SplCasterTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Caster/StubCasterTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Caster/XmlReaderCasterTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Cloner/DataTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Cloner/VarClonerTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Dumper/CliDumperTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Dumper/FunctionsTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Dumper/HtmlDumperTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Dumper/ServerDumperTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Fixtures/FooInterface.php create mode 100644 vendor/symfony/var-dumper/Tests/Fixtures/GeneratorDemo.php create mode 100644 vendor/symfony/var-dumper/Tests/Fixtures/NotLoadableClass.php create mode 100644 vendor/symfony/var-dumper/Tests/Fixtures/Twig.php create mode 100644 vendor/symfony/var-dumper/Tests/Fixtures/dumb-var.php create mode 100644 vendor/symfony/var-dumper/Tests/Fixtures/dump_server.php create mode 100644 vendor/symfony/var-dumper/Tests/Fixtures/xml_reader.xml create mode 100644 vendor/symfony/var-dumper/Tests/Server/ConnectionTest.php create mode 100644 vendor/symfony/var-dumper/Tests/Test/VarDumperTestTraitTest.php create mode 100644 vendor/symfony/var-dumper/VarDumper.php create mode 100644 vendor/symfony/var-dumper/composer.json create mode 100644 vendor/symfony/var-dumper/phpunit.xml.dist create mode 100644 vendor/symfony/yaml/.gitignore create mode 100644 vendor/symfony/yaml/CHANGELOG.md create mode 100644 vendor/symfony/yaml/Command/LintCommand.php create mode 100644 vendor/symfony/yaml/Dumper.php create mode 100644 vendor/symfony/yaml/Escaper.php create mode 100644 vendor/symfony/yaml/Exception/DumpException.php create mode 100644 vendor/symfony/yaml/Exception/ExceptionInterface.php create mode 100644 vendor/symfony/yaml/Exception/ParseException.php create mode 100644 vendor/symfony/yaml/Exception/RuntimeException.php create mode 100644 vendor/symfony/yaml/Inline.php create mode 100644 vendor/symfony/yaml/LICENSE create mode 100644 vendor/symfony/yaml/Parser.php create mode 100644 vendor/symfony/yaml/README.md create mode 100644 vendor/symfony/yaml/Tag/TaggedValue.php create mode 100644 vendor/symfony/yaml/Tests/Command/LintCommandTest.php create mode 100644 vendor/symfony/yaml/Tests/DumperTest.php create mode 100644 vendor/symfony/yaml/Tests/Fixtures/YtsAnchorAlias.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/YtsBasicTests.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/YtsBlockMapping.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/YtsDocumentSeparator.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/YtsErrorTests.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/YtsFlowCollections.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/YtsFoldedScalars.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/YtsNullsAndEmpties.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/YtsSpecificationExamples.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/YtsTypeTransfers.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/arrow.gif create mode 100644 vendor/symfony/yaml/Tests/Fixtures/booleanMappingKeys.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/embededPhp.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/escapedCharacters.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/index.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/multiple_lines_as_literal_block.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/multiple_lines_as_literal_block_leading_space_in_first_line.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/nonStringKeys.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/not_readable.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/nullMappingKey.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/numericMappingKeys.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/sfComments.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/sfCompact.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/sfMergeKey.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/sfObjects.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/sfQuotes.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/sfTests.yml create mode 100644 vendor/symfony/yaml/Tests/Fixtures/unindentedCollections.yml create mode 100644 vendor/symfony/yaml/Tests/InlineTest.php create mode 100644 vendor/symfony/yaml/Tests/ParseExceptionTest.php create mode 100644 vendor/symfony/yaml/Tests/ParserTest.php create mode 100644 vendor/symfony/yaml/Tests/YamlTest.php create mode 100644 vendor/symfony/yaml/Unescaper.php create mode 100644 vendor/symfony/yaml/Yaml.php create mode 100644 vendor/symfony/yaml/composer.json create mode 100644 vendor/symfony/yaml/phpunit.xml.dist create mode 100644 vendor/theseer/tokenizer/.gitignore create mode 100644 vendor/theseer/tokenizer/.php_cs create mode 100644 vendor/theseer/tokenizer/.travis.yml create mode 100644 vendor/theseer/tokenizer/LICENSE create mode 100644 vendor/theseer/tokenizer/README.md create mode 100644 vendor/theseer/tokenizer/build.xml create mode 100644 vendor/theseer/tokenizer/composer.json create mode 100644 vendor/theseer/tokenizer/phive.xml create mode 100644 vendor/theseer/tokenizer/phpunit.xml create mode 100644 vendor/theseer/tokenizer/src/Exception.php create mode 100644 vendor/theseer/tokenizer/src/NamespaceUri.php create mode 100644 vendor/theseer/tokenizer/src/NamespaceUriException.php create mode 100644 vendor/theseer/tokenizer/src/Token.php create mode 100644 vendor/theseer/tokenizer/src/TokenCollection.php create mode 100644 vendor/theseer/tokenizer/src/TokenCollectionException.php create mode 100644 vendor/theseer/tokenizer/src/Tokenizer.php create mode 100644 vendor/theseer/tokenizer/src/XMLSerializer.php create mode 100644 vendor/theseer/tokenizer/tests/NamespaceUriTest.php create mode 100644 vendor/theseer/tokenizer/tests/TokenCollectionTest.php create mode 100644 vendor/theseer/tokenizer/tests/TokenTest.php create mode 100644 vendor/theseer/tokenizer/tests/TokenizerTest.php create mode 100644 vendor/theseer/tokenizer/tests/XMLSerializerTest.php create mode 100644 vendor/theseer/tokenizer/tests/_files/customns.xml create mode 100644 vendor/theseer/tokenizer/tests/_files/test.php create mode 100644 vendor/theseer/tokenizer/tests/_files/test.php.tokens create mode 100644 vendor/theseer/tokenizer/tests/_files/test.php.xml create mode 100644 vendor/tijsverkoyen/css-to-inline-styles/LICENSE.md create mode 100644 vendor/tijsverkoyen/css-to-inline-styles/composer.json create mode 100644 vendor/tijsverkoyen/css-to-inline-styles/phpunit.xml.dist create mode 100644 vendor/tijsverkoyen/css-to-inline-styles/src/Css/Processor.php create mode 100644 vendor/tijsverkoyen/css-to-inline-styles/src/Css/Property/Processor.php create mode 100644 vendor/tijsverkoyen/css-to-inline-styles/src/Css/Property/Property.php create mode 100644 vendor/tijsverkoyen/css-to-inline-styles/src/Css/Rule/Processor.php create mode 100644 vendor/tijsverkoyen/css-to-inline-styles/src/Css/Rule/Rule.php create mode 100644 vendor/tijsverkoyen/css-to-inline-styles/src/CssToInlineStyles.php create mode 100644 vendor/vlucas/phpdotenv/LICENSE.txt create mode 100644 vendor/vlucas/phpdotenv/composer.json create mode 100644 vendor/vlucas/phpdotenv/src/Dotenv.php create mode 100644 vendor/vlucas/phpdotenv/src/Exception/ExceptionInterface.php create mode 100644 vendor/vlucas/phpdotenv/src/Exception/InvalidCallbackException.php create mode 100644 vendor/vlucas/phpdotenv/src/Exception/InvalidFileException.php create mode 100644 vendor/vlucas/phpdotenv/src/Exception/InvalidPathException.php create mode 100644 vendor/vlucas/phpdotenv/src/Exception/ValidationException.php create mode 100644 vendor/vlucas/phpdotenv/src/Loader.php create mode 100644 vendor/vlucas/phpdotenv/src/Validator.php create mode 100644 vendor/vyuldashev/nova-permission/README.md create mode 100644 vendor/vyuldashev/nova-permission/composer.json create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/ar/navigation.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/ar/permissions.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/ar/resources.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/ar/roles.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/de/navigation.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/de/permissions.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/de/resources.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/de/roles.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/en/navigation.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/en/permissions.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/en/resources.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/en/roles.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/es/navigation.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/es/permissions.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/es/resources.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/es/roles.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/pt-BR/navigation.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/pt-BR/permissions.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/pt-BR/resources.php create mode 100644 vendor/vyuldashev/nova-permission/resources/lang/pt-BR/roles.php create mode 100644 vendor/vyuldashev/nova-permission/resources/views/navigation.blade.php create mode 100644 vendor/vyuldashev/nova-permission/src/ForgetCachedPermissions.php create mode 100644 vendor/vyuldashev/nova-permission/src/NovaPermissionTool.php create mode 100644 vendor/vyuldashev/nova-permission/src/Permission.php create mode 100644 vendor/vyuldashev/nova-permission/src/PermissionPolicy.php create mode 100644 vendor/vyuldashev/nova-permission/src/Role.php create mode 100644 vendor/vyuldashev/nova-permission/src/RolePolicy.php create mode 100644 vendor/vyuldashev/nova-permission/src/ToolServiceProvider.php create mode 100644 vendor/webmozart/assert/CHANGELOG.md create mode 100644 vendor/webmozart/assert/LICENSE create mode 100644 vendor/webmozart/assert/README.md create mode 100644 vendor/webmozart/assert/composer.json create mode 100644 vendor/webmozart/assert/src/Assert.php create mode 100644 vendor/zendframework/zend-diactoros/.coveralls.yml create mode 100644 vendor/zendframework/zend-diactoros/CHANGELOG.md create mode 100644 vendor/zendframework/zend-diactoros/CONDUCT.md create mode 100644 vendor/zendframework/zend-diactoros/CONTRIBUTING.md create mode 100644 vendor/zendframework/zend-diactoros/LICENSE.md create mode 100644 vendor/zendframework/zend-diactoros/README.md create mode 100644 vendor/zendframework/zend-diactoros/composer.json create mode 100644 vendor/zendframework/zend-diactoros/composer.lock create mode 100644 vendor/zendframework/zend-diactoros/mkdocs.yml create mode 100644 vendor/zendframework/zend-diactoros/src/AbstractSerializer.php create mode 100644 vendor/zendframework/zend-diactoros/src/CallbackStream.php create mode 100644 vendor/zendframework/zend-diactoros/src/Exception/DeprecatedMethodException.php create mode 100644 vendor/zendframework/zend-diactoros/src/Exception/ExceptionInterface.php create mode 100644 vendor/zendframework/zend-diactoros/src/HeaderSecurity.php create mode 100644 vendor/zendframework/zend-diactoros/src/MessageTrait.php create mode 100644 vendor/zendframework/zend-diactoros/src/PhpInputStream.php create mode 100644 vendor/zendframework/zend-diactoros/src/RelativeStream.php create mode 100644 vendor/zendframework/zend-diactoros/src/Request.php create mode 100644 vendor/zendframework/zend-diactoros/src/Request/ArraySerializer.php create mode 100644 vendor/zendframework/zend-diactoros/src/Request/Serializer.php create mode 100644 vendor/zendframework/zend-diactoros/src/RequestTrait.php create mode 100644 vendor/zendframework/zend-diactoros/src/Response.php create mode 100644 vendor/zendframework/zend-diactoros/src/Response/ArraySerializer.php create mode 100644 vendor/zendframework/zend-diactoros/src/Response/EmitterInterface.php create mode 100644 vendor/zendframework/zend-diactoros/src/Response/EmptyResponse.php create mode 100644 vendor/zendframework/zend-diactoros/src/Response/HtmlResponse.php create mode 100644 vendor/zendframework/zend-diactoros/src/Response/InjectContentTypeTrait.php create mode 100644 vendor/zendframework/zend-diactoros/src/Response/JsonResponse.php create mode 100644 vendor/zendframework/zend-diactoros/src/Response/RedirectResponse.php create mode 100644 vendor/zendframework/zend-diactoros/src/Response/SapiEmitter.php create mode 100644 vendor/zendframework/zend-diactoros/src/Response/SapiEmitterTrait.php create mode 100644 vendor/zendframework/zend-diactoros/src/Response/SapiStreamEmitter.php create mode 100644 vendor/zendframework/zend-diactoros/src/Response/Serializer.php create mode 100644 vendor/zendframework/zend-diactoros/src/Response/TextResponse.php create mode 100644 vendor/zendframework/zend-diactoros/src/Response/XmlResponse.php create mode 100644 vendor/zendframework/zend-diactoros/src/Server.php create mode 100644 vendor/zendframework/zend-diactoros/src/ServerRequest.php create mode 100644 vendor/zendframework/zend-diactoros/src/ServerRequestFactory.php create mode 100644 vendor/zendframework/zend-diactoros/src/Stream.php create mode 100644 vendor/zendframework/zend-diactoros/src/UploadedFile.php create mode 100644 vendor/zendframework/zend-diactoros/src/Uri.php create mode 100644 vendor/zendframework/zend-diactoros/src/functions/create_uploaded_file.php create mode 100644 vendor/zendframework/zend-diactoros/src/functions/marshal_headers_from_sapi.php create mode 100644 vendor/zendframework/zend-diactoros/src/functions/marshal_method_from_sapi.php create mode 100644 vendor/zendframework/zend-diactoros/src/functions/marshal_protocol_version_from_sapi.php create mode 100644 vendor/zendframework/zend-diactoros/src/functions/marshal_uri_from_sapi.php create mode 100644 vendor/zendframework/zend-diactoros/src/functions/normalize_server.php create mode 100644 vendor/zendframework/zend-diactoros/src/functions/normalize_uploaded_files.php create mode 100644 vendor/zendframework/zend-diactoros/src/functions/parse_cookie_header.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/README.md b/README.md new file mode 100644 index 0000000..c7b3dc0 --- /dev/null +++ b/README.md @@ -0,0 +1,158 @@ +# Multitenancy Package + +This package is meant to be a quick and easy way to add multitenancy to your Laravel application. It simply creates models and relationships for Tenants and Users. Users can be a part of many Tenants. Tenants can have many users. The package identifies the incoming traffic by subdomain, and finds a corresponding tenant in the Tenant table. If none are found or the user is not associated with a particular subdomain, the user is met with a 403 error. + +The `admin` subdomain is reserved for the package. It is used to automatically remove all scopes from users with a `Super Administrator` role. + +To scope a resource to the currently accessed subdomain, you simply need to add a [single trait](#tenant-assignment-for-other-models) to the model and add a [foreign key relationship](#console-commands) to the model's table. + +Any resources saved while accessing a scoped subdomain will automatically be saved against the tenant assigned that subdomain. + +* [Installation](#installation) +* [Usage](#usage) + * [Middleware](#middleware) + * [Tenant Assignment for Other Models](#tenant-assignment-for-other-models) + * [Assigning Super Administrator Role](#assigning-super-administrator-role) + * [Console Commands](#console-commands) +* [Managing with Nova](#managing-with-nova) + + +## Installation + +You can install the package via composer: + +``` bash +composer require romegadigital/multitenancy +``` + +In Laravel 5.5 the service provider will automatically get registered. In older versions of the framework just add the service provider in `config/app.php` file: + +```php +'providers' => [ + // ... + RomegaDigital\Multitenancy\MultitenancyServiceProvider::class, +]; +``` + +Then run migrations + +```bash +php artisan migrate +``` + +You can publish the config file with: + +```bash +php artisan vendor:publish --provider="RomegaDigital\Multitenancy\MultitenancyServiceProvider" --tag="config" +``` + +## Usage + +First, add the `RomegaDigital\Multitenancy\Traits\HasTenants` trait to your `User` model(s): + +```php +use Illuminate\Foundation\Auth\User as Authenticatable; +use RomegaDigital\Multitenancy\Traits\HasTenants; + +class User extends Authenticatable +{ + use HasTenants; + + // ... +} +``` + +The package relies on Eloquent, so you may access the User's tenants using `User::tenants()->get()`. + +Inversely, you may access the Tenant's users with `Tenant::users()->get()`. + +Tenants require a name to identify the tenant and and a subdomain that is associated with that user. + +`tenant1.example.com` + +`tenant2.example.com` + +They would be added to the database like so: + +```php +Tenant::createMany([ + [ + 'name' => 'An Identifying Name', + 'domain' => 'tenant1' + ], + [ + 'name' => 'A Second Customer', + 'domain' => 'tenant2' + ] +]); +``` + +You can then attach users to the tenant: + +```php +Tenant::first()->save(factory(User::class)->create()); +``` + +### Middleware + +This package comes with `TenantMiddleware` middleware. You can add it inside your `app/Http/Kernel.php` file. + +```php +protected $routeMiddleware = [ + // ... + 'tenant' => \RomegaDigital\Multitenancy\Middlewares\TenantMiddleware::class, +]; +``` + +Then you can bring multitenancy to your routes using middleware rules: + +```php +Route::group(['middleware' => ['tenant']], function () { + // ... +}); +``` + +### Tenant Assignment for Other Models + +Models can automatically inherit scoping of the current tenant by adding a trait and migration to a model. This would allow users to access `tenant1.example.com` and return only the data to `tenant1`. + +For example, say you wanted Tenants to manage their own `Product`. In your `Product` model, simply add the `BelongsToTenant` trait. Then run the [provided console command](#console-commands) to add the necessary relationship column to your existing `products` table. + +```php +use Illuminate\Database\Eloquent\Model; +use RomegaDigital\Multitenancy\Traits\BelongsToTenant; + +class Product extends Model +{ + use BelongsToTenant; + + // ... +} +``` + +If the user is assigned `Super Administrator` access, they will be able to access your `admin` subdomain and the tenant scope will not register. This allows you to manage all the data across all the instances without needing individual access to each Tenant's account. + +### Assigning Super Administrator Role + +In order to access the `admin.example.com` subdomain, a user will need the `Super Administrator` role. This package relies on [Spatie's Laravel Permission](https://github.com/spatie/laravel-permission) package and is automatically included as a dependency when installing this package. We also provide a `Super Administrator` role on migration. See their documentation on how to add users to the appropriate role. + +You will also need to create the admin subdomain in your Tenant table. + +```php +Tenant::create([ + 'name' => 'Admin Portal', + 'domain' => 'admin' +]); +``` + +### Console Commands + +You can generate a migration to add tenancy to an existing model's table using + +```bash +php artisan multitenancy:migrate --table=products +``` + +## Managing with Nova + +Checkout the [Nova Package](#) created to manage the resources utilized in this package. diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..102d62c --- /dev/null +++ b/composer.json @@ -0,0 +1,35 @@ +{ + "name": "romegadigital/multitenancy", + "description": "Adds domain based multitenancy to Laravel applications.", + "authors": [ + { + "name": "Braden Keith", + "email": "bkeith@romegadigital.com" + } + ], + "autoload": { + "psr-4": { + "RomegaDigital\\Multitenancy\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "RomegaDigital\\Multitenancy\\Tests\\": "tests/" + } + }, + "require": { + "vyuldashev/nova-permission": "^1.0" + }, + "extra": { + "laravel": { + "providers": [ + "RomegaDigital\\Multitenancy\\MultitenancyServiceProvider" + ] + } + }, + "require-dev": { + "phpunit/phpunit": "^7.5", + "orchestra/testbench": "^3.7", + "codedungeon/phpunit-result-printer": "^0.6.0" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..10541ef --- /dev/null +++ b/composer.lock @@ -0,0 +1,4776 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "a09d532582040978d0d5e4ecb8fed852", + "packages": [ + { + "name": "doctrine/inflector", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "5527a48b7313d15261292c149e55e26eae771b0a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a", + "reference": "5527a48b7313d15261292c149e55e26eae771b0a", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string" + ], + "time": "2018-01-09T20:05:19+00:00" + }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09T13:34:57+00:00" + }, + { + "name": "dragonmantank/cron-expression", + "version": "v2.2.0", + "source": { + "type": "git", + "url": "https://github.com/dragonmantank/cron-expression.git", + "reference": "92a2c3768d50e21a1f26a53cb795ce72806266c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/92a2c3768d50e21a1f26a53cb795ce72806266c5", + "reference": "92a2c3768d50e21a1f26a53cb795ce72806266c5", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Cron\\": "src/Cron/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Chris Tankersley", + "email": "chris@ctankersley.com", + "homepage": "https://github.com/dragonmantank" + } + ], + "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due", + "keywords": [ + "cron", + "schedule" + ], + "time": "2018-06-06T03:12:17+00:00" + }, + { + "name": "egulias/email-validator", + "version": "2.1.7", + "source": { + "type": "git", + "url": "https://github.com/egulias/EmailValidator.git", + "reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/709f21f92707308cdf8f9bcfa1af4cb26586521e", + "reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^1.0.1", + "php": ">= 5.5" + }, + "require-dev": { + "dominicsayers/isemail": "dev-master", + "phpunit/phpunit": "^4.8.35||^5.7||^6.0", + "satooshi/php-coveralls": "^1.0.1" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Egulias\\EmailValidator\\": "EmailValidator" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eduardo Gulias Davis" + } + ], + "description": "A library for validating emails against several RFCs", + "homepage": "https://github.com/egulias/EmailValidator", + "keywords": [ + "email", + "emailvalidation", + "emailvalidator", + "validation", + "validator" + ], + "time": "2018-12-04T22:38:24+00:00" + }, + { + "name": "erusev/parsedown", + "version": "1.7.1", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown.git", + "reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/92e9c27ba0e74b8b028b111d1b6f956a15c01fc1", + "reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, + "type": "library", + "autoload": { + "psr-0": { + "Parsedown": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "Parser for Markdown.", + "homepage": "http://parsedown.org", + "keywords": [ + "markdown", + "parser" + ], + "time": "2018-03-08T01:11:30+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.3.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.3-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2018-04-22T15:46:56+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.5.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "9f83dded91781a01c63574e387eaa769be769115" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/9f83dded91781a01c63574e387eaa769be769115", + "reference": "9f83dded91781a01c63574e387eaa769be769115", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2018-12-04T20:46:45+00:00" + }, + { + "name": "laravel/framework", + "version": "v5.7.19", + "source": { + "type": "git", + "url": "https://github.com/laravel/framework.git", + "reference": "5c1d1ec7e8563ea31826fd5eb3f6791acf01160c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/framework/zipball/5c1d1ec7e8563ea31826fd5eb3f6791acf01160c", + "reference": "5c1d1ec7e8563ea31826fd5eb3f6791acf01160c", + "shasum": "" + }, + "require": { + "doctrine/inflector": "^1.1", + "dragonmantank/cron-expression": "^2.0", + "erusev/parsedown": "^1.7", + "ext-mbstring": "*", + "ext-openssl": "*", + "laravel/nexmo-notification-channel": "^1.0", + "laravel/slack-notification-channel": "^1.0", + "league/flysystem": "^1.0.8", + "monolog/monolog": "^1.12", + "nesbot/carbon": "^1.26.3", + "opis/closure": "^3.1", + "php": "^7.1.3", + "psr/container": "^1.0", + "psr/simple-cache": "^1.0", + "ramsey/uuid": "^3.7", + "swiftmailer/swiftmailer": "^6.0", + "symfony/console": "^4.1", + "symfony/debug": "^4.1", + "symfony/finder": "^4.1", + "symfony/http-foundation": "^4.1", + "symfony/http-kernel": "^4.1", + "symfony/process": "^4.1", + "symfony/routing": "^4.1", + "symfony/var-dumper": "^4.1", + "tijsverkoyen/css-to-inline-styles": "^2.2.1", + "vlucas/phpdotenv": "^2.2" + }, + "conflict": { + "tightenco/collect": "<5.5.33" + }, + "replace": { + "illuminate/auth": "self.version", + "illuminate/broadcasting": "self.version", + "illuminate/bus": "self.version", + "illuminate/cache": "self.version", + "illuminate/config": "self.version", + "illuminate/console": "self.version", + "illuminate/container": "self.version", + "illuminate/contracts": "self.version", + "illuminate/cookie": "self.version", + "illuminate/database": "self.version", + "illuminate/encryption": "self.version", + "illuminate/events": "self.version", + "illuminate/filesystem": "self.version", + "illuminate/hashing": "self.version", + "illuminate/http": "self.version", + "illuminate/log": "self.version", + "illuminate/mail": "self.version", + "illuminate/notifications": "self.version", + "illuminate/pagination": "self.version", + "illuminate/pipeline": "self.version", + "illuminate/queue": "self.version", + "illuminate/redis": "self.version", + "illuminate/routing": "self.version", + "illuminate/session": "self.version", + "illuminate/support": "self.version", + "illuminate/translation": "self.version", + "illuminate/validation": "self.version", + "illuminate/view": "self.version" + }, + "require-dev": { + "aws/aws-sdk-php": "^3.0", + "doctrine/dbal": "^2.6", + "filp/whoops": "^2.1.4", + "guzzlehttp/guzzle": "^6.3", + "league/flysystem-cached-adapter": "^1.0", + "mockery/mockery": "^1.0", + "moontoast/math": "^1.1", + "orchestra/testbench-core": "3.7.*", + "pda/pheanstalk": "^3.0", + "phpunit/phpunit": "^7.0", + "predis/predis": "^1.1.1", + "symfony/css-selector": "^4.1", + "symfony/dom-crawler": "^4.1", + "true/punycode": "^2.1" + }, + "suggest": { + "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (^3.0).", + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "ext-pcntl": "Required to use all features of the queue worker.", + "ext-posix": "Required to use all features of the queue worker.", + "filp/whoops": "Required for friendly error pages in development (^2.1.4).", + "fzaninotto/faker": "Required to use the eloquent factory builder (^1.4).", + "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (^6.0).", + "laravel/tinker": "Required to use the tinker console command (^1.0).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", + "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", + "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (^1.0).", + "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", + "moontoast/math": "Required to use ordered UUIDs (^1.1).", + "nexmo/client": "Required to use the Nexmo transport (^1.0).", + "pda/pheanstalk": "Required to use the beanstalk queue driver (^3.0).", + "predis/predis": "Required to use the redis cache and queue drivers (^1.0).", + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^3.0).", + "symfony/css-selector": "Required to use some of the crawler integration testing tools (^4.1).", + "symfony/dom-crawler": "Required to use most of the crawler integration testing tools (^4.1).", + "symfony/psr-http-message-bridge": "Required to psr7 bridging features (^1.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "autoload": { + "files": [ + "src/Illuminate/Foundation/helpers.php", + "src/Illuminate/Support/helpers.php" + ], + "psr-4": { + "Illuminate\\": "src/Illuminate/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Laravel Framework.", + "homepage": "https://laravel.com", + "keywords": [ + "framework", + "laravel" + ], + "time": "2018-12-18T14:00:38+00:00" + }, + { + "name": "laravel/nexmo-notification-channel", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/laravel/nexmo-notification-channel.git", + "reference": "03edd42a55b306ff980c9950899d5a2b03260d48" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/nexmo-notification-channel/zipball/03edd42a55b306ff980c9950899d5a2b03260d48", + "reference": "03edd42a55b306ff980c9950899d5a2b03260d48", + "shasum": "" + }, + "require": { + "nexmo/client": "^1.0", + "php": "^7.1.3" + }, + "require-dev": { + "illuminate/notifications": "~5.7", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + }, + "laravel": { + "providers": [ + "Illuminate\\Notifications\\NexmoChannelServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Notifications\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Nexmo Notification Channel for laravel.", + "keywords": [ + "laravel", + "nexmo", + "notifications" + ], + "time": "2018-12-04T12:57:08+00:00" + }, + { + "name": "laravel/slack-notification-channel", + "version": "v1.0.3", + "source": { + "type": "git", + "url": "https://github.com/laravel/slack-notification-channel.git", + "reference": "6e164293b754a95f246faf50ab2bbea3e4923cc9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/slack-notification-channel/zipball/6e164293b754a95f246faf50ab2bbea3e4923cc9", + "reference": "6e164293b754a95f246faf50ab2bbea3e4923cc9", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.0", + "php": "^7.1.3" + }, + "require-dev": { + "illuminate/notifications": "~5.7", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + }, + "laravel": { + "providers": [ + "Illuminate\\Notifications\\SlackChannelServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Notifications\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Slack Notification Channel for laravel.", + "keywords": [ + "laravel", + "notifications", + "slack" + ], + "time": "2018-12-12T13:12:06+00:00" + }, + { + "name": "lcobucci/jwt", + "version": "3.2.5", + "source": { + "type": "git", + "url": "https://github.com/lcobucci/jwt.git", + "reference": "82be04b4753f8b7693b62852b7eab30f97524f9b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/82be04b4753f8b7693b62852b7eab30f97524f9b", + "reference": "82be04b4753f8b7693b62852b7eab30f97524f9b", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "php": ">=5.5" + }, + "require-dev": { + "mdanter/ecc": "~0.3.1", + "mikey179/vfsstream": "~1.5", + "phpmd/phpmd": "~2.2", + "phpunit/php-invoker": "~1.1", + "phpunit/phpunit": "~4.5", + "squizlabs/php_codesniffer": "~2.3" + }, + "suggest": { + "mdanter/ecc": "Required to use Elliptic Curves based algorithms." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Lcobucci\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Luís Otávio Cobucci Oblonczyk", + "email": "lcobucci@gmail.com", + "role": "developer" + } + ], + "description": "A simple library to work with JSON Web Token and JSON Web Signature", + "keywords": [ + "JWS", + "jwt" + ], + "time": "2018-11-11T12:22:26+00:00" + }, + { + "name": "league/flysystem", + "version": "1.0.49", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "a63cc83d8a931b271be45148fa39ba7156782ffd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a63cc83d8a931b271be45148fa39ba7156782ffd", + "reference": "a63cc83d8a931b271be45148fa39ba7156782ffd", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": ">=5.5.9" + }, + "conflict": { + "league/flysystem-sftp": "<1.0.6" + }, + "require-dev": { + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7.10" + }, + "suggest": { + "ext-fileinfo": "Required for MimeType", + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", + "league/flysystem-webdav": "Allows you to use WebDAV storage", + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "description": "Filesystem abstraction: Many filesystems, one API.", + "keywords": [ + "Cloud Files", + "WebDAV", + "abstraction", + "aws", + "cloud", + "copy.com", + "dropbox", + "file systems", + "files", + "filesystem", + "filesystems", + "ftp", + "rackspace", + "remote", + "s3", + "sftp", + "storage" + ], + "time": "2018-11-23T23:41:29+00:00" + }, + { + "name": "monolog/monolog", + "version": "1.24.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "^5.3|^6.0" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2018-11-05T09:00:11+00:00" + }, + { + "name": "nesbot/carbon", + "version": "1.36.1", + "source": { + "type": "git", + "url": "https://github.com/briannesbitt/Carbon.git", + "reference": "63da8cdf89d7a5efe43aabc794365f6e7b7b8983" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/63da8cdf89d7a5efe43aabc794365f6e7b7b8983", + "reference": "63da8cdf89d7a5efe43aabc794365f6e7b7b8983", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/translation": "~2.6 || ~3.0 || ~4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7" + }, + "suggest": { + "friendsofphp/php-cs-fixer": "Needed for the `composer phpcs` command. Allow to automatically fix code style.", + "phpstan/phpstan": "Needed for the `composer phpstan` command. Allow to detect potential errors." + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "http://nesbot.com" + } + ], + "description": "A simple API extension for DateTime.", + "homepage": "http://carbon.nesbot.com", + "keywords": [ + "date", + "datetime", + "time" + ], + "time": "2018-11-22T18:23:02+00:00" + }, + { + "name": "nexmo/client", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/Nexmo/nexmo-php.git", + "reference": "01809cc1e17a5af275913c49bb5d444eb6cc06d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Nexmo/nexmo-php/zipball/01809cc1e17a5af275913c49bb5d444eb6cc06d4", + "reference": "01809cc1e17a5af275913c49bb5d444eb6cc06d4", + "shasum": "" + }, + "require": { + "lcobucci/jwt": "^3.2", + "php": ">=5.6", + "php-http/client-implementation": "^1.0", + "php-http/guzzle6-adapter": "^1.0", + "zendframework/zend-diactoros": "^1.3" + }, + "require-dev": { + "estahn/phpunit-json-assertions": "^1.0.0", + "php-http/mock-client": "^0.3.0", + "phpunit/phpunit": "^5.7", + "squizlabs/php_codesniffer": "^3.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Nexmo\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tim Lytle", + "email": "tim@nexmo.com", + "homepage": "http://twitter.com/tjlytle", + "role": "Developer" + } + ], + "description": "PHP Client for using Nexmo's API.", + "time": "2018-12-17T10:47:50+00:00" + }, + { + "name": "opis/closure", + "version": "3.1.2", + "source": { + "type": "git", + "url": "https://github.com/opis/closure.git", + "reference": "de00c69a2328d3ee5baa71fc584dc643222a574c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opis/closure/zipball/de00c69a2328d3ee5baa71fc584dc643222a574c", + "reference": "de00c69a2328d3ee5baa71fc584dc643222a574c", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0" + }, + "require-dev": { + "jeremeamia/superclosure": "^2.0", + "phpunit/phpunit": "^4.0|^5.0|^6.0|^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Opis\\Closure\\": "src/" + }, + "files": [ + "functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marius Sarca", + "email": "marius.sarca@gmail.com" + }, + { + "name": "Sorin Sarca", + "email": "sarca_sorin@hotmail.com" + } + ], + "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", + "homepage": "https://opis.io/closure", + "keywords": [ + "anonymous functions", + "closure", + "function", + "serializable", + "serialization", + "serialize" + ], + "time": "2018-12-16T21:48:23+00:00" + }, + { + "name": "paragonie/random_compat", + "version": "v9.99.99", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "shasum": "" + }, + "require": { + "php": "^7" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "polyfill", + "pseudorandom", + "random" + ], + "time": "2018-07-02T15:55:56+00:00" + }, + { + "name": "php-http/guzzle6-adapter", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/php-http/guzzle6-adapter.git", + "reference": "a56941f9dc6110409cfcddc91546ee97039277ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/guzzle6-adapter/zipball/a56941f9dc6110409cfcddc91546ee97039277ab", + "reference": "a56941f9dc6110409cfcddc91546ee97039277ab", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.0", + "php": ">=5.5.0", + "php-http/httplug": "^1.0" + }, + "provide": { + "php-http/async-client-implementation": "1.0", + "php-http/client-implementation": "1.0" + }, + "require-dev": { + "ext-curl": "*", + "php-http/adapter-integration-tests": "^0.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "Http\\Adapter\\Guzzle6\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + }, + { + "name": "David de Boer", + "email": "david@ddeboer.nl" + } + ], + "description": "Guzzle 6 HTTP Adapter", + "homepage": "http://httplug.io", + "keywords": [ + "Guzzle", + "http" + ], + "time": "2016-05-10T06:13:32+00:00" + }, + { + "name": "php-http/httplug", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/httplug.git", + "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/httplug/zipball/1c6381726c18579c4ca2ef1ec1498fdae8bdf018", + "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "php-http/promise": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "henrikbjorn/phpspec-code-coverage": "^1.0", + "phpspec/phpspec": "^2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eric GELOEN", + "email": "geloen.eric@gmail.com" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "HTTPlug, the HTTP client abstraction for PHP", + "homepage": "http://httplug.io", + "keywords": [ + "client", + "http" + ], + "time": "2016-08-31T08:30:17+00:00" + }, + { + "name": "php-http/promise", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/promise.git", + "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/promise/zipball/dc494cdc9d7160b9a09bd5573272195242ce7980", + "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980", + "shasum": "" + }, + "require-dev": { + "henrikbjorn/phpspec-code-coverage": "^1.0", + "phpspec/phpspec": "^2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Http\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + }, + { + "name": "Joel Wurtz", + "email": "joel.wurtz@gmail.com" + } + ], + "description": "Promise used for asynchronous HTTP requests", + "homepage": "http://httplug.io", + "keywords": [ + "promise" + ], + "time": "2016-01-26T13:27:02+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "psr/log", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2018-11-20T15:27:04+00:00" + }, + { + "name": "psr/simple-cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "time": "2017-10-23T01:57:42+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "~3.7.0", + "satooshi/php-coveralls": ">=1.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2016-02-11T07:05:27+00:00" + }, + { + "name": "ramsey/uuid", + "version": "3.8.0", + "source": { + "type": "git", + "url": "https://github.com/ramsey/uuid.git", + "reference": "d09ea80159c1929d75b3f9c60504d613aeb4a1e3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/d09ea80159c1929d75b3f9c60504d613aeb4a1e3", + "reference": "d09ea80159c1929d75b3f9c60504d613aeb4a1e3", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "^1.0|^2.0|9.99.99", + "php": "^5.4 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "replace": { + "rhumsaa/uuid": "self.version" + }, + "require-dev": { + "codeception/aspect-mock": "^1.0 | ~2.0.0", + "doctrine/annotations": "~1.2.0", + "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ~2.1.0", + "ircmaxell/random-lib": "^1.1", + "jakub-onderka/php-parallel-lint": "^0.9.0", + "mockery/mockery": "^0.9.9", + "moontoast/math": "^1.1", + "php-mock/php-mock-phpunit": "^0.3|^1.1", + "phpunit/phpunit": "^4.7|^5.0|^6.5", + "squizlabs/php_codesniffer": "^2.3" + }, + "suggest": { + "ext-ctype": "Provides support for PHP Ctype functions", + "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", + "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", + "ircmaxell/random-lib": "Provides RandomLib for use with the RandomLibAdapter", + "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).", + "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid", + "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Ramsey\\Uuid\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marijn Huizendveld", + "email": "marijn.huizendveld@gmail.com" + }, + { + "name": "Thibaud Fabre", + "email": "thibaud@aztech.io" + }, + { + "name": "Ben Ramsey", + "email": "ben@benramsey.com", + "homepage": "https://benramsey.com" + } + ], + "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", + "homepage": "https://github.com/ramsey/uuid", + "keywords": [ + "guid", + "identifier", + "uuid" + ], + "time": "2018-07-19T23:38:55+00:00" + }, + { + "name": "spatie/laravel-permission", + "version": "2.29.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-permission.git", + "reference": "7f308806ca051fca42685e4a97a282139a6a7982" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-permission/zipball/7f308806ca051fca42685e4a97a282139a6a7982", + "reference": "7f308806ca051fca42685e4a97a282139a6a7982", + "shasum": "" + }, + "require": { + "illuminate/auth": "~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0", + "illuminate/container": "~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0", + "illuminate/contracts": "~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0", + "illuminate/database": "~5.4.0|~5.5.0|~5.6.0|~5.7.0", + "php": ">=7.0" + }, + "require-dev": { + "orchestra/testbench": "~3.4.2|~3.5.0|~3.6.0|~3.7.0", + "phpunit/phpunit": "^5.7|6.2|^7.0", + "predis/predis": "^1.1" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Spatie\\Permission\\PermissionServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Spatie\\Permission\\": "src" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "Permission handling for Laravel 5.4 and up", + "homepage": "https://github.com/spatie/laravel-permission", + "keywords": [ + "acl", + "laravel", + "permission", + "security", + "spatie" + ], + "time": "2018-12-16T00:49:22+00:00" + }, + { + "name": "swiftmailer/swiftmailer", + "version": "v6.1.3", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8ddcb66ac10c392d3beb54829eef8ac1438595f4", + "reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4", + "shasum": "" + }, + "require": { + "egulias/email-validator": "~2.0", + "php": ">=7.0.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.1", + "symfony/phpunit-bridge": "~3.3@dev" + }, + "suggest": { + "ext-intl": "Needed to support internationalized email addresses", + "true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + }, + "autoload": { + "files": [ + "lib/swift_required.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Corbyn" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "https://swiftmailer.symfony.com", + "keywords": [ + "email", + "mail", + "mailer" + ], + "time": "2018-09-11T07:12:52+00:00" + }, + { + "name": "symfony/console", + "version": "v4.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "4dff24e5d01e713818805c1862d2e3f901ee7dd0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/4dff24e5d01e713818805c1862d2e3f901ee7dd0", + "reference": "4dff24e5d01e713818805c1862d2e3f901ee7dd0", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/contracts": "^1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0" + }, + "suggest": { + "psr/log-implementation": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2018-11-27T07:40:44+00:00" + }, + { + "name": "symfony/contracts", + "version": "v1.0.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/contracts.git", + "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf", + "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "require-dev": { + "psr/cache": "^1.0", + "psr/container": "^1.0" + }, + "suggest": { + "psr/cache": "When using the Cache contracts", + "psr/container": "When using the Service contracts", + "symfony/cache-contracts-implementation": "", + "symfony/service-contracts-implementation": "", + "symfony/translation-contracts-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\": "" + }, + "exclude-from-classmap": [ + "**/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A set of abstractions extracted out of the Symfony components", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2018-12-05T08:06:11+00:00" + }, + { + "name": "symfony/css-selector", + "version": "v4.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "aa9fa526ba1b2ec087ffdfb32753803d999fcfcd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/aa9fa526ba1b2ec087ffdfb32753803d999fcfcd", + "reference": "aa9fa526ba1b2ec087ffdfb32753803d999fcfcd", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com", + "time": "2018-11-11T19:52:12+00:00" + }, + { + "name": "symfony/debug", + "version": "v4.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "e0a2b92ee0b5b934f973d90c2f58e18af109d276" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/e0a2b92ee0b5b934f973d90c2f58e18af109d276", + "reference": "e0a2b92ee0b5b934f973d90c2f58e18af109d276", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": "<3.4" + }, + "require-dev": { + "symfony/http-kernel": "~3.4|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2018-11-28T18:24:18+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v4.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "921f49c3158a276d27c0d770a5a347a3b718b328" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/921f49c3158a276d27c0d770a5a347a3b718b328", + "reference": "921f49c3158a276d27c0d770a5a347a3b718b328", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/contracts": "^1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/stopwatch": "~3.4|~4.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2018-12-01T08:52:38+00:00" + }, + { + "name": "symfony/finder", + "version": "v4.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "e53d477d7b5c4982d0e1bfd2298dbee63d01441d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/e53d477d7b5c4982d0e1bfd2298dbee63d01441d", + "reference": "e53d477d7b5c4982d0e1bfd2298dbee63d01441d", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2018-11-11T19:52:12+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v4.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "1b31f3017fadd8cb05cf2c8aebdbf3b12a943851" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/1b31f3017fadd8cb05cf2c8aebdbf3b12a943851", + "reference": "1b31f3017fadd8cb05cf2c8aebdbf3b12a943851", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "predis/predis": "~1.0", + "symfony/expression-language": "~3.4|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com", + "time": "2018-11-26T10:55:26+00:00" + }, + { + "name": "symfony/http-kernel", + "version": "v4.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "b39ceffc0388232c309cbde3a7c3685f2ec0a624" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/b39ceffc0388232c309cbde3a7c3685f2ec0a624", + "reference": "b39ceffc0388232c309cbde3a7c3685f2ec0a624", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "psr/log": "~1.0", + "symfony/contracts": "^1.0.2", + "symfony/debug": "~3.4|~4.0", + "symfony/event-dispatcher": "~4.1", + "symfony/http-foundation": "^4.1.1", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/config": "<3.4", + "symfony/dependency-injection": "<4.2", + "symfony/translation": "<4.2", + "symfony/var-dumper": "<4.1.1", + "twig/twig": "<1.34|<2.4,>=2" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/cache": "~1.0", + "symfony/browser-kit": "~3.4|~4.0", + "symfony/config": "~3.4|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/css-selector": "~3.4|~4.0", + "symfony/dependency-injection": "^4.2", + "symfony/dom-crawler": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/finder": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0", + "symfony/routing": "~3.4|~4.0", + "symfony/stopwatch": "~3.4|~4.0", + "symfony/templating": "~3.4|~4.0", + "symfony/translation": "~4.2", + "symfony/var-dumper": "^4.1.1" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "", + "symfony/var-dumper": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpKernel Component", + "homepage": "https://symfony.com", + "time": "2018-12-06T17:39:52+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2018-08-06T14:22:27+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2018-09-21T13:07:52+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9050816e2ca34a8e916c3a0ae8b9c2fccf68b631", + "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2018-09-21T13:07:52+00:00" + }, + { + "name": "symfony/process", + "version": "v4.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "2b341009ccec76837a7f46f59641b431e4d4c2b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/2b341009ccec76837a7f46f59641b431e4d4c2b0", + "reference": "2b341009ccec76837a7f46f59641b431e4d4c2b0", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2018-11-20T16:22:05+00:00" + }, + { + "name": "symfony/routing", + "version": "v4.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "649460207e77da6c545326c7f53618d23ad2c866" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/649460207e77da6c545326c7f53618d23ad2c866", + "reference": "649460207e77da6c545326c7f53618d23ad2c866", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "conflict": { + "symfony/config": "<4.2", + "symfony/dependency-injection": "<3.4", + "symfony/yaml": "<3.4" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "psr/log": "~1.0", + "symfony/config": "~4.2", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/http-foundation": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/dependency-injection": "For loading routes from a service", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Routing Component", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "time": "2018-12-03T22:08:12+00:00" + }, + { + "name": "symfony/translation", + "version": "v4.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "c0e2191e9bed845946ab3d99767513b56ca7dcd6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/c0e2191e9bed845946ab3d99767513b56ca7dcd6", + "reference": "c0e2191e9bed845946ab3d99767513b56ca7dcd6", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/contracts": "^1.0.2", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/config": "<3.4", + "symfony/dependency-injection": "<3.4", + "symfony/yaml": "<3.4" + }, + "provide": { + "symfony/translation-contracts-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/intl": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "psr/log-implementation": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Translation Component", + "homepage": "https://symfony.com", + "time": "2018-12-06T10:45:32+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v4.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "db61258540350725f4beb6b84006e32398acd120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/db61258540350725f4beb6b84006e32398acd120", + "reference": "db61258540350725f4beb6b84006e32398acd120", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php72": "~1.5" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/console": "<3.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/process": "~3.4|~4.0", + "twig/twig": "~1.34|~2.4" + }, + "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony mechanism for exploring and dumping PHP variables", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "time": "2018-11-25T12:50:42+00:00" + }, + { + "name": "tijsverkoyen/css-to-inline-styles", + "version": "2.2.1", + "source": { + "type": "git", + "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", + "reference": "0ed4a2ea4e0902dac0489e6436ebcd5bbcae9757" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/0ed4a2ea4e0902dac0489e6436ebcd5bbcae9757", + "reference": "0ed4a2ea4e0902dac0489e6436ebcd5bbcae9757", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "symfony/css-selector": "^2.7 || ^3.0 || ^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "TijsVerkoyen\\CssToInlineStyles\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Tijs Verkoyen", + "email": "css_to_inline_styles@verkoyen.eu", + "role": "Developer" + } + ], + "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", + "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", + "time": "2017-11-27T11:13:29+00:00" + }, + { + "name": "vlucas/phpdotenv", + "version": "v2.5.1", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e", + "reference": "8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "http://www.vancelucas.com" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "time": "2018-07-29T20:33:41+00:00" + }, + { + "name": "vyuldashev/nova-permission", + "version": "v1.4.7", + "source": { + "type": "git", + "url": "https://github.com/vyuldashev/nova-permission.git", + "reference": "bd910a1e5908fc0ccac588da91c0ec63a94b2ab7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vyuldashev/nova-permission/zipball/bd910a1e5908fc0ccac588da91c0ec63a94b2ab7", + "reference": "bd910a1e5908fc0ccac588da91c0ec63a94b2ab7", + "shasum": "" + }, + "require": { + "php": "^7.1", + "spatie/laravel-permission": "^2.16" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Vyuldashev\\NovaPermission\\ToolServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Vyuldashev\\NovaPermission\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A Laravel Nova tool for Spatie's Permission library.", + "keywords": [ + "laravel", + "nova", + "spatie-permission" + ], + "time": "2018-12-27T13:01:00+00:00" + }, + { + "name": "zendframework/zend-diactoros", + "version": "1.8.6", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-diactoros.git", + "reference": "20da13beba0dde8fb648be3cc19765732790f46e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/20da13beba0dde8fb648be3cc19765732790f46e", + "reference": "20da13beba0dde8fb648be3cc19765732790f46e", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "psr/http-message": "^1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-dom": "*", + "ext-libxml": "*", + "php-http/psr7-integration-tests": "dev-master", + "phpunit/phpunit": "^5.7.16 || ^6.0.8 || ^7.2.7", + "zendframework/zend-coding-standard": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev", + "dev-develop": "1.9.x-dev", + "dev-release-2.0": "2.0.x-dev" + } + }, + "autoload": { + "files": [ + "src/functions/create_uploaded_file.php", + "src/functions/marshal_headers_from_sapi.php", + "src/functions/marshal_method_from_sapi.php", + "src/functions/marshal_protocol_version_from_sapi.php", + "src/functions/marshal_uri_from_sapi.php", + "src/functions/normalize_server.php", + "src/functions/normalize_uploaded_files.php", + "src/functions/parse_cookie_header.php" + ], + "psr-4": { + "Zend\\Diactoros\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "description": "PSR HTTP Message implementations", + "homepage": "https://github.com/zendframework/zend-diactoros", + "keywords": [ + "http", + "psr", + "psr-7" + ], + "time": "2018-09-05T19:29:37+00:00" + } + ], + "packages-dev": [ + { + "name": "codedungeon/phpunit-result-printer", + "version": "0.6.1", + "source": { + "type": "git", + "url": "https://github.com/mikeerickson/phpunit-pretty-result-printer.git", + "reference": "e4cbf937b422bd2ce5ff9929e77592eb8188dbe6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mikeerickson/phpunit-pretty-result-printer/zipball/e4cbf937b422bd2ce5ff9929e77592eb8188dbe6", + "reference": "e4cbf937b422bd2ce5ff9929e77592eb8188dbe6", + "shasum": "" + }, + "require": { + "hassankhan/config": "^0.10.0", + "php": "^7.1", + "symfony/yaml": "^2.7|^3.0|^4.0" + }, + "require-dev": { + "phpunit/phpunit": ">=5.2", + "spatie/phpunit-watcher": "^1.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Codedungeon\\PHPUnitPrettyResultPrinter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike Erickson", + "email": "codedungeon@gmail.com" + } + ], + "description": "PHPUnit Pretty Result Printer", + "keywords": [ + "composer", + "package", + "phpunit", + "printer", + "result-printer" + ], + "time": "2018-03-02T23:02:03+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2017-07-22T11:58:36+00:00" + }, + { + "name": "fzaninotto/faker", + "version": "v1.8.0", + "source": { + "type": "git", + "url": "https://github.com/fzaninotto/Faker.git", + "reference": "f72816b43e74063c8b10357394b6bba8cb1c10de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/f72816b43e74063c8b10357394b6bba8cb1c10de", + "reference": "f72816b43e74063c8b10357394b6bba8cb1c10de", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "ext-intl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7", + "squizlabs/php_codesniffer": "^1.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "time": "2018-07-12T10:23:15+00:00" + }, + { + "name": "hamcrest/hamcrest-php", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/776503d3a8e85d4f9a1148614f95b7a608b046ad", + "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad", + "shasum": "" + }, + "require": { + "php": "^5.3|^7.0" + }, + "replace": { + "cordoval/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "kodova/hamcrest-php": "*" + }, + "require-dev": { + "phpunit/php-file-iterator": "1.3.3", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "hamcrest" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD" + ], + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": [ + "test" + ], + "time": "2016-01-20T08:20:44+00:00" + }, + { + "name": "hassankhan/config", + "version": "0.10.0", + "source": { + "type": "git", + "url": "https://github.com/hassankhan/config.git", + "reference": "06ac500348af033f1a2e44dc357ca86282626d4a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hassankhan/config/zipball/06ac500348af033f1a2e44dc357ca86282626d4a", + "reference": "06ac500348af033f1a2e44dc357ca86282626d4a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "scrutinizer/ocular": "~1.1", + "squizlabs/php_codesniffer": "~2.2" + }, + "suggest": { + "symfony/yaml": "~2.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Noodlehaus\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Hassan Khan", + "homepage": "http://hassankhan.me/", + "role": "Developer" + } + ], + "description": "Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files", + "homepage": "http://hassankhan.me/config/", + "keywords": [ + "config", + "configuration", + "ini", + "json", + "microphp", + "unframework", + "xml", + "yaml", + "yml" + ], + "time": "2016-02-11T16:21:17+00:00" + }, + { + "name": "mockery/mockery", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/mockery/mockery.git", + "reference": "100633629bf76d57430b86b7098cd6beb996a35a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mockery/mockery/zipball/100633629bf76d57430b86b7098cd6beb996a35a", + "reference": "100633629bf76d57430b86b7098cd6beb996a35a", + "shasum": "" + }, + "require": { + "hamcrest/hamcrest-php": "~2.0", + "lib-pcre": ">=7.0", + "php": ">=5.6.0" + }, + "require-dev": { + "phpunit/phpunit": "~5.7.10|~6.5|~7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Mockery": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + }, + { + "name": "Dave Marshall", + "email": "dave.marshall@atstsolutions.co.uk", + "homepage": "http://davedevelopment.co.uk" + } + ], + "description": "Mockery is a simple yet flexible PHP mock object framework", + "homepage": "https://github.com/mockery/mockery", + "keywords": [ + "BDD", + "TDD", + "library", + "mock", + "mock objects", + "mockery", + "stub", + "test", + "test double", + "testing" + ], + "time": "2018-10-02T21:52:37+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2018-06-11T23:09:50+00:00" + }, + { + "name": "orchestra/testbench", + "version": "v3.7.6", + "source": { + "type": "git", + "url": "https://github.com/orchestral/testbench.git", + "reference": "57c9dc9271e60421b8402f477c44589156fb67b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/orchestral/testbench/zipball/57c9dc9271e60421b8402f477c44589156fb67b6", + "reference": "57c9dc9271e60421b8402f477c44589156fb67b6", + "shasum": "" + }, + "require": { + "laravel/framework": "~5.7.14", + "mockery/mockery": "^1.0", + "orchestra/testbench-core": "~3.7.7", + "php": ">=7.1", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.7-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mior Muhammad Zaki", + "email": "crynobone@gmail.com", + "homepage": "https://github.com/crynobone" + } + ], + "description": "Laravel Testing Helper for Packages Development", + "homepage": "http://orchestraplatform.com/docs/latest/components/testbench/", + "keywords": [ + "BDD", + "TDD", + "laravel", + "orchestra-platform", + "orchestral", + "testing" + ], + "time": "2018-12-04T01:01:32+00:00" + }, + { + "name": "orchestra/testbench-core", + "version": "v3.7.7", + "source": { + "type": "git", + "url": "https://github.com/orchestral/testbench-core.git", + "reference": "b5c97f3f3ae488c9e92196c2a7fcf3def9d23e36" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/b5c97f3f3ae488c9e92196c2a7fcf3def9d23e36", + "reference": "b5c97f3f3ae488c9e92196c2a7fcf3def9d23e36", + "shasum": "" + }, + "require": { + "fzaninotto/faker": "^1.4", + "php": ">=7.1" + }, + "require-dev": { + "laravel/framework": "~5.7.14", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "laravel/framework": "Required for testing (~5.7.14).", + "mockery/mockery": "Allow to use Mockery for testing (^1.0).", + "orchestra/testbench-browser-kit": "Allow to use legacy Laravel BrowserKit for testing (~3.7).", + "orchestra/testbench-dusk": "Allow to use Laravel Dusk for testing (~3.7).", + "phpunit/phpunit": "Allow to use PHPUnit for testing (^7.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.7-dev" + } + }, + "autoload": { + "psr-4": { + "Orchestra\\Testbench\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mior Muhammad Zaki", + "email": "crynobone@gmail.com", + "homepage": "https://github.com/crynobone" + } + ], + "description": "Testing Helper for Laravel Development", + "homepage": "http://orchestraplatform.com/docs/latest/components/testbench/", + "keywords": [ + "BDD", + "TDD", + "laravel", + "orchestra-platform", + "orchestral", + "testing" + ], + "time": "2018-12-04T00:47:44+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2017-09-11T18:02:19+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "shasum": "" + }, + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-11-30T07:14:17+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2017-07-14T14:27:02+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2018-08-05T17:53:17+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "6.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1 || ^4.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-xdebug": "^2.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2018-10-31T16:06:48+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "050bedf145a257b1ff02746c31894800e5122946" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2018-09-13T20:33:42+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b8454ea6958c3dee38453d3bd571e023108c91f", + "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2018-02-01T13:07:23+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c99e3be9d3e85f60646f152f9002d46ed7770d18", + "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2018-10-30T05:52:18+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "7.5.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "c23d78776ad415d5506e0679723cb461d71f488f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c23d78776ad415d5506e0679723cb461d71f488f", + "reference": "c23d78776ad415d5506e0679723cb461d71f488f", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.0", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpunit/phpunit-mock-objects": "*" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2018-12-12T07:20:32+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "shasum": "" + }, + "require": { + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-07-12T15:12:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "366541b989927187c4ca70490a35615d3fef2dce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/366541b989927187c4ca70490a35615d3fef2dce", + "reference": "366541b989927187c4ca70490a35615d3fef2dce", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "time": "2018-06-10T07:54:39+00:00" + }, + { + "name": "sebastian/environment", + "version": "4.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "febd209a219cea7b56ad799b30ebbea34b71eb8f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/febd209a219cea7b56ad799b30ebbea34b71eb8f", + "reference": "febd209a219cea7b56ad799b30ebbea34b71eb8f", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2018-11-25T09:31:21+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2017-04-03T13:19:02+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2018-10-04T04:07:39+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "symfony/yaml", + "version": "v4.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "c41175c801e3edfda90f32e292619d10c27103d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/c41175c801e3edfda90f32e292619d10c27103d7", + "reference": "c41175c801e3edfda90f32e292619d10c27103d7", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2018-11-11T19:52:12+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2017-04-07T12:08:54+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2018-12-25T11:19:39+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/config/multitenancy.php b/config/multitenancy.php new file mode 100644 index 0000000..13c6272 --- /dev/null +++ b/config/multitenancy.php @@ -0,0 +1,52 @@ + \App\User::class, + + /* + |-------------------------------------------------------------------------- + | Tenant Model + |-------------------------------------------------------------------------- + | + | This is the model you are using for Tenants that will be attached to the + | User instance. It would be recommended to extend the Tenant model as + | defined in the package, but if you replace it, be sure to implement + | the RomegaDigital\Multitenancy\Contracts\Tenant contract. + */ + + 'tenant_model' => \RomegaDigital\Multitenancy\Models\Tenant::class, + + 'table_names' => [ + + /* + * We need to know which table to setup foreign relationships on. + */ + + 'users' => 'users', + + /* + * If overwriting `tenant_model`, you may also wish to define a new table + */ + + 'tenants' => 'tenants', + + /* + * Define the relationship table for the belongsToMany relationship + */ + + 'tenant_user' => 'tenant_user', + + ], + +]; \ No newline at end of file diff --git a/migrations/2018_11_20_010634_create_tenants_table.php b/migrations/2018_11_20_010634_create_tenants_table.php new file mode 100644 index 0000000..785149f --- /dev/null +++ b/migrations/2018_11_20_010634_create_tenants_table.php @@ -0,0 +1,55 @@ +increments('id'); + $table->string('name')->unique(); + $table->string('domain')->unique(); + $table->timestamps(); + }); + + Schema::create($tableNames['tenant_user'], function (Blueprint $table) use ($tableNames) { + $table->increments('id'); + + $table->unsignedInteger('tenant_id'); + $table->foreign('tenant_id') + ->references('id') + ->on($tableNames['tenants']) + ->onDelete('cascade'); + + $table->unsignedInteger('user_id'); + $table->foreign('user_id') + ->references('id') + ->on($tableNames['users']) + ->onDelete('cascade'); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $tableNames = config('multitenancy.table_names'); + Schema::dropIfExists($tableNames['tenants']); + Schema::dropIfExists($tableNames['tenant_user']); + } +} diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..9bc4713 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,26 @@ + + + + + tests + + + + + src/ + + + + + + diff --git a/src/Contracts/Tenant.php b/src/Contracts/Tenant.php new file mode 100644 index 0000000..b8e569b --- /dev/null +++ b/src/Contracts/Tenant.php @@ -0,0 +1,26 @@ +guest()) { + throw UnauthorizedException::notLoggedIn(); + } + + $domain = app('multitenancy')->getCurrentSubDomain(); + $tenant = app('multitenancy')->getTenantClass()::findByDomain($domain); + + if($tenant && $tenant->users->contains(app('auth')->user()->id)) { + + app('multitenancy')->setTenant($tenant)->applyTenantScopeToDeferredModels(); + + return $next($request); + } + + throw UnauthorizedException::forDomain($tenant->domain); + } +} \ No newline at end of file diff --git a/src/Models/Tenant.php b/src/Models/Tenant.php new file mode 100644 index 0000000..a250b21 --- /dev/null +++ b/src/Models/Tenant.php @@ -0,0 +1,50 @@ +setTable(config('multitenancy.table_names.tenants')); + } + + + public function users(): BelongsToMany + { + return $this->belongsToMany(config('multitenancy.user_model')); + } + + /** + * Find a permission by its domain + * + * @param string $domain + * + * @throws \RomegaDigital\Multitenancy\Exceptions\TenantDoesNotExist + * + * @return \RomegaDigital\Multitenancy\Contracts\Tenant + */ + public static function findByDomain(string $domain): TenantContract + { + $tenant = static::where(['domain' => $domain])->first(); + + if (! $tenant) { + throw TenantDoesNotExist::forDomain($domain); + } + + return $tenant; + } + +} diff --git a/src/Multitenancy.php b/src/Multitenancy.php new file mode 100644 index 0000000..98b30bb --- /dev/null +++ b/src/Multitenancy.php @@ -0,0 +1,121 @@ +tenantClass = config('multitenancy.tenant_model'); + $this->deferredModels = collect(); + } + + /** + * Sets the Tenant to a Tenant Model + */ + public function setTenant(Tenant $tenant) + { + $this->tenant = $tenant; + return $this; + } + + /** + * Applies applicable tenant scopes to model or if not booted yet + * store for deferment. + */ + public function applyTenantScope(Model $model) + { + if (is_null($this->tenant)) { + $this->deferredModels->push($model); + return; + } + + if($this->tenant->domain == 'admin') { + return; + } + + $model->addGlobalScope('tenant', function (Builder $builder) { + $builder->where('tenant_id', '=', $this->tenant->id); + }); + } + + /** + * Applies applicable tenant id to model on create + */ + public function newModel(Model $model) + { + if (is_null($this->tenant)) { + $this->deferredModels->push($model); + return; + } + + if (!isset($model->tenant_id)) { + $model->setAttribute('tenant_id', $this->tenant->id); + } + } + + /** + * Applies applicable tenant scope to deferred model booted + * before tenants setup. + */ + public function applyTenantScopeToDeferredModels() + { + $this->deferredModels->each(function ($model) { + $this->applyTenantScope($model); + }); + + $this->deferredModels = collect(); + } + + /** + * Get an instance of the tenant class. + * + * @return \RomegaDigital\Multitenancy\Contracts\Tenant + */ + public function getTenantClass(): Tenant + { + return app($this->tenantClass); + } + + /** + * Parses the request to pull out the first element separated + * by `.` in the $_SERVER['HTTP_HOST']. + * + * ex: + * test.domain.com returns test + * test2.test.domain.com returns test2 + */ + public function getCurrentSubDomain() : string + { + $currentDomain = app('request')->getHost(); + + // Get rid of the TLD and root domain + // ex: masterdomain.test.example.com returns + // [ masterdomain, test ] + $subdomains = explode('.', $currentDomain,-2); + + // Combine multiple level of domains into 1 string + // ex: back to masterdomain.text + $subdomain = implode($subdomains,'.'); + + return $subdomain; + } + + +} \ No newline at end of file diff --git a/src/MultitenancyFacade.php b/src/MultitenancyFacade.php new file mode 100644 index 0000000..a81c8e8 --- /dev/null +++ b/src/MultitenancyFacade.php @@ -0,0 +1,13 @@ +loadMigrationsFrom(realpath(__DIR__.'/../migrations')); + + $this->publishes([ + __DIR__.'/../config/multitenancy.php' => config_path('multitenancy.php'), + ], 'config'); + + $this->registerModelBindings(); + + $this->app->singleton(Multitenancy::class, function () { + return new Multitenancy(); + }); + + $this->app->alias(Multitenancy::class, 'multitenancy'); + } + + /** + * Register the application services. + * + * @return void + */ + public function register() + { + $this->mergeConfigFrom( + __DIR__.'/../config/multitenancy.php', + 'multitenancy' + ); + } + + protected function registerModelBindings() + { + $this->app->bind(TenantContract::class, $this->app->config['multitenancy.tenant_model']); + } +} diff --git a/src/Traits/BelongsToTenant.php b/src/Traits/BelongsToTenant.php new file mode 100644 index 0000000..fe580ae --- /dev/null +++ b/src/Traits/BelongsToTenant.php @@ -0,0 +1,31 @@ +applyTenantScope(new static()); + + static::creating(function ($model) { + static::$multitenancy->newModel($model); + }); + } + + /** + * Define the relationship ownership to the Tenant model + * + * @return Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function tenant() + { + return $this->belongsTo(config('multitenancy.tenant_model')); + } +} \ No newline at end of file diff --git a/src/Traits/HasTenants.php b/src/Traits/HasTenants.php new file mode 100644 index 0000000..dab43d0 --- /dev/null +++ b/src/Traits/HasTenants.php @@ -0,0 +1,11 @@ +belongsToMany(config('multitenancy.tenant_model')); + } +} \ No newline at end of file diff --git a/tests/Databases/MigrateDatabaseTest.php b/tests/Databases/MigrateDatabaseTest.php new file mode 100644 index 0000000..c5f9783 --- /dev/null +++ b/tests/Databases/MigrateDatabaseTest.php @@ -0,0 +1,38 @@ +assertEquals([ + 'id', + 'name', + 'domain', + 'created_at', + 'updated_at', + ], $columns); + + $columns = \Schema::getColumnListing('tenant_user'); + $this->assertEquals([ + 'id', + 'tenant_id', + 'user_id', + 'created_at', + 'updated_at', + ], $columns); + } +} diff --git a/tests/Feature/BelongsToTenantTest.php b/tests/Feature/BelongsToTenantTest.php new file mode 100644 index 0000000..925f0a4 --- /dev/null +++ b/tests/Feature/BelongsToTenantTest.php @@ -0,0 +1,91 @@ +resource('products', 'RomegaDigital\Multitenancy\Tests\Stubs\Controllers\ProductController'); + } + + /** + * Turn the given URI into a fully qualified URL. + * + * @param string $uri + * @return string + */ + protected function prepareUrlForRequest($uri) + { + $uri = "http://{$this->testTenant->domain}.localhost.com/{$uri}"; + + return trim($uri, '/'); + } + + /** @test */ + public function it_adds_current_tenant_id_to_model_on_create() + { + $this->actingAs($this->testUser); + $this->testTenant->users()->save($this->testUser); + + $response = $this->post('products', [ + 'name' => 'Another Tenants Product', + ]); + $response->assertStatus(201); + $this->assertEquals(Product::first()->tenant_id, $this->testTenant->id); + } + + /** @test */ + public function it_only_retrieves_records_scoped_to_current_subdomain() + { + $this->actingAs($this->testUser); + $this->testTenant->users()->save($this->testUser); + + Product::create([ + 'name' => 'Another Tenants Product', + 'tenant_id' => Tenant::create([ + 'name' => 'Another Tenant', + 'domain' => 'anotherdomain' + ])->id + ]); + + $response = $this->get('products'); + $response->assertStatus(200); + $this->assertEquals(Product::where('tenant_id', $this->testTenant->id)->get(), $response->getContent()); + } + + /** @test **/ + public function it_retrieves_all_records_when_accessing_via_admin_subdomain() + { + $this->actingAs($this->testUser); + $this->testAdminTenant->users()->save($this->testUser); + $this->testTenant->domain = $this->testAdminTenant->domain; + + Product::create([ + 'name' => 'Another Tenants Product', + 'tenant_id' => Tenant::create([ + 'name' => 'Another Tenant', + 'domain' => 'anotherdomain' + ])->id + ]); + + $response = $this->get('products'); + $response->assertStatus(200); + $this->assertEquals(Product::withoutGlobalScopes()->get(), $response->getContent()); + } +} \ No newline at end of file diff --git a/tests/Feature/MiddlewareTest.php b/tests/Feature/MiddlewareTest.php new file mode 100644 index 0000000..5503cea --- /dev/null +++ b/tests/Feature/MiddlewareTest.php @@ -0,0 +1,87 @@ +tenantMiddleware = new TenantMiddleware($this->app); + } + + protected function buildRequest($domain) + { + app('request')->headers->set('HOST',$domain.'.example.com'); + return $this->tenantMiddleware->handle(app('request'), function () { + return (new Response())->setContent(''); + }); + + } + + /** @test */ + public function it_throws_error_if_domain_not_found() + { + $this->actingAs($this->testUser); + + try{ + $this->buildRequest('testdomain'); + $this->fail("Expected exception not thrown"); + }catch(TenantDoesNotExist $e){ //Not catching a generic Exception or the fail function is also catched + $this->assertEquals("There is no tenant at domain `testdomain`.", $e->getMessage()); + } + } + + /** @test **/ + public function it_throws_error_if_user_is_not_part_of_tenant() + { + $this->actingAs($this->testUser); + + try{ + $this->buildRequest($this->testTenant->domain); + $this->fail("Expected exception not thrown"); + }catch(UnauthorizedException $e){ //Not catching a generic Exception or the fail function is also catched + $this->assertEquals(403, $e->getStatusCode()); + $this->assertEquals("The authenticated user does not have access to domain `{$this->testTenant->domain}`.", $e->getMessage()); + } + } + + /** @test **/ + public function it_throws_error_if_user_is_not_logged_in() + { + try{ + $this->buildRequest($this->testTenant->domain); + $this->fail("Expected exception not thrown"); + }catch(UnauthorizedException $e){ //Not catching a generic Exception or the fail function is also catched + $this->assertEquals(403, $e->getStatusCode()); + $this->assertEquals("User is not logged in.", $e->getMessage()); + } + } + + /** @test **/ + public function it_allows_users_who_are_associated_with_a_valid_domain() + { + $this->actingAs($this->testUser); + + $this->testTenant->users()->sync($this->testUser); + + $this->assertEquals( + $this->buildRequest($this->testTenant->domain)->getStatusCode(), + 200); + } + + +} \ No newline at end of file diff --git a/tests/Feature/TenantTest.php b/tests/Feature/TenantTest.php new file mode 100644 index 0000000..26e735f --- /dev/null +++ b/tests/Feature/TenantTest.php @@ -0,0 +1,24 @@ +expectException(TenantDoesNotExist::class); + app(Tenant::class)->findByDomain('nonexistentdomain'); + } + + /** @test */ + public function it_is_retrievable_by_domain() + { + $permission_by_domain = app(Tenant::class)->findByDomain($this->testTenant->domain); + $this->assertEquals($this->testTenant->id, $permission_by_domain->id); + } +} \ No newline at end of file diff --git a/tests/Product.php b/tests/Product.php new file mode 100644 index 0000000..dc04751 --- /dev/null +++ b/tests/Product.php @@ -0,0 +1,13 @@ +middleware([ + function ($request, Closure $next) { + $route = app('router')->getCurrentRoute(); + Assert::assertSame(ProductController::class, get_class($route->getController())); + return $next($request); + }, + TenantMiddleware::class + ]); + } + public function index() + { + return Product::all(); + } + + public function store(Request $request) + { + return Product::create([ + 'name' => $request->name + ]); + } + +} \ No newline at end of file diff --git a/tests/TestCase.php b/tests/TestCase.php new file mode 100644 index 0000000..abc43b8 --- /dev/null +++ b/tests/TestCase.php @@ -0,0 +1,111 @@ +set('multitenancy.user_model', '\RomegaDigital\Multitenancy\Tests\User'); + } + + /** + * Load package service provider + * @param \Illuminate\Foundation\Application $app + * + * @return array + */ + protected function getPackageProviders($app) + { + return [ + MultitenancyServiceProvider::class, + // PermissionServiceProvider::class + ]; + } + + /** + * Load package alias + * @param \Illuminate\Foundation\Application $app + * @return array + */ + protected function getPackageAliases($app) + { + return [ + 'Multitenancy' => MultitenancyFacade::class, + ]; + } + + + public function setUp() + { + parent::setUp(); + $this->setUpDatabase($this->app); + + $this->testUser = User::first(); + $this->testTenant = app(Tenant::class)->find(1); + $this->testAdminTenant = app(Tenant::class)->find(2); + $this->testProduct = Product::first(); + } + + + /** + * Set up the database. + * + * @param \Illuminate\Foundation\Application $app + */ + protected function setUpDatabase($app) + { + $this->artisan('migrate', ['--database' => 'testing']); + + $app[Tenant::class]->create([ + 'name' => 'Tenant Name', + 'domain' => 'masterdomain' + ]); + $app[Tenant::class]->create([ + 'name' => 'Admin', + 'domain' => 'admin' + ]); + + $app['db']->connection()->getSchemaBuilder()->create('users', function (Blueprint $table) { + $table->increments('id'); + $table->string('email'); + $table->softDeletes(); + }); + User::create(['email' => 'test@user.com']); + + $app['db']->connection()->getSchemaBuilder()->create('products', function (Blueprint $table) { + $table->increments('id'); + $table->string('name'); + $table->unsignedInteger('tenant_id'); + $table->foreign('tenant_id') + ->references('id') + ->on('tenants') + ->onDelete('cascade'); + $table->softDeletes(); + }); + Product::create([ + 'name' => 'Product 1', + 'tenant_id' => '1' + ]); + + } + +} diff --git a/tests/User.php b/tests/User.php new file mode 100644 index 0000000..97462ee --- /dev/null +++ b/tests/User.php @@ -0,0 +1,22 @@ + + + // .... + + ``` + +Or from Command-Line: + + ```bash + phpunit --printer=Codedungeon\\PHPUnitPrettyResultPrinter\\Printer + ``` + +### License + +Copyright © 2017-2018 Mike Erickson +Released under the MIT license + +### Credits + +phpunit-result-printer written by Mike Erickson + +E-Mail: [codedungeon@gmail.com](mailto:codedungeon@gmail.com) + +Twitter: [@codedungeon](http://twitter.com/codedungeon) + +Website: [https://github.com/mikeerickson](https://github.com/mikeerickson) + +### Screenshot + +![Screenshot](https://github.com/mikeerickson/phpunit-pretty-result-printer/blob/master/sample.png) diff --git a/vendor/codedungeon/phpunit-result-printer/composer.json b/vendor/codedungeon/phpunit-result-printer/composer.json new file mode 100755 index 0000000..02eee04 --- /dev/null +++ b/vendor/codedungeon/phpunit-result-printer/composer.json @@ -0,0 +1,31 @@ +{ + "name": "codedungeon/phpunit-result-printer", + "version": "0.6.1", + "description": "PHPUnit Pretty Result Printer", + "keywords": ["phpunit", "printer", "result-printer", "composer", "package"], + "license": "MIT", + "authors": [{ + "name": "Mike Erickson", + "email": "codedungeon@gmail.com" + }], + "type": "library", + "require": { + "php": "^7.1", + "hassankhan/config": "^0.10.0", + "symfony/yaml": "^2.7|^3.0|^4.0" + }, + "require-dev": { + "phpunit/phpunit": ">=5.2", + "spatie/phpunit-watcher": "^1.3" + }, + "autoload": { + "psr-4": { + "Codedungeon\\PHPUnitPrettyResultPrinter\\": "src/" + } + }, + "scripts": { + "test": "vendor/bin/phpunit --colors=always", + "test-ci": "vendor/bin/phpunit -c phpunit.ci.xml", + "watch-tickets": "vendor/bin/phpunit-watcher watch --testsuite Tickets < /dev/tty" + } +} diff --git a/vendor/codedungeon/phpunit-result-printer/phpunit-printer.yml b/vendor/codedungeon/phpunit-result-printer/phpunit-printer.yml new file mode 100644 index 0000000..a242100 --- /dev/null +++ b/vendor/codedungeon/phpunit-result-printer/phpunit-printer.yml @@ -0,0 +1,4 @@ +options: + cd-printer-hide-class: false + cd-printer-simple-output: false + cd-printer-show-config: false diff --git a/vendor/codedungeon/phpunit-result-printer/phpunit.ci.xml b/vendor/codedungeon/phpunit-result-printer/phpunit.ci.xml new file mode 100644 index 0000000..559cef3 --- /dev/null +++ b/vendor/codedungeon/phpunit-result-printer/phpunit.ci.xml @@ -0,0 +1,18 @@ + + + + + tests + + + tickets + + + diff --git a/vendor/codedungeon/phpunit-result-printer/phpunit.xml b/vendor/codedungeon/phpunit-result-printer/phpunit.xml new file mode 100755 index 0000000..99c0a91 --- /dev/null +++ b/vendor/codedungeon/phpunit-result-printer/phpunit.xml @@ -0,0 +1,24 @@ + + + + + tests + + + tickets + + + diff --git a/vendor/codedungeon/phpunit-result-printer/src/Colors.php b/vendor/codedungeon/phpunit-result-printer/src/Colors.php new file mode 100644 index 0000000..ea8ab46 --- /dev/null +++ b/vendor/codedungeon/phpunit-result-printer/src/Colors.php @@ -0,0 +1,189 @@ +className = get_class($test); + parent::startTest($test); + } + } +} + +// use this entrypoint for PHPUnit 6.x and 7.x +if (class_exists('\PHPUnit\TextUI\ResultPrinter')) { + class _ResultPrinter extends \PHPUnit\TextUI\ResultPrinter + { + public function startTest(\PHPUnit\Framework\Test $test): void + { + $this->className = get_class($test); + parent::startTest($test); + } + } +} + +/** + * Class Printer. + * + * @license MIT + */ +class Printer extends _ResultPrinter +{ + /** + * @var string + */ + public $className = ''; + + /** + * @var string + */ + private $lastClassName = ''; + + /** + * @var int + */ + private $maxClassNameLength = 50; + + /** + * @var int + */ + private $maxNumberOfColumns; + + /** + * @var + */ + private $hideClassName; + + /** + * @var + */ + private $simpleOutput; + + /** + * @var Config + */ + private $configuration; + + /** + * @var string + */ + private $configFileName; + + private $printerOptions; + + /** + * {@inheritdoc} + */ + public function __construct($out = null, $verbose = false, $colors = self::COLOR_DEFAULT, $debug = false, $numberOfColumns = 80) + { + parent::__construct($out, $verbose, $colors, $debug, $numberOfColumns); + + $this->configFileName = $this->getConfigurationFile('phpunit-printer.yml'); + $this->colorsTool = new Colors(); + $this->configuration = new Config($this->configFileName); + + $this->maxNumberOfColumns = $this->getWidth(); + $this->maxClassNameLength = min((int) ($this->maxNumberOfColumns / 2), $this->maxClassNameLength); + + // setup module options + $this->printerOptions = $this->configuration->all(); + $this->hideClassName = $this->configuration->get('options.cd-printer-hide-class'); + $this->simpleOutput = $this->configuration->get('options.cd-printer-simple-output'); + $this->showConfig = $this->configuration->get('options.cd-printer-show-config'); + + if ($this->showConfig) { + echo PHP_EOL; + echo $this->colorsTool->yellow() . 'PHPUnit Printer Configuration: '. PHP_EOL; + echo $this->colorsTool->cyan() . $this->configFileName; + echo $this->colorsTool->reset(); + echo PHP_EOL.PHP_EOL; + } + } + + /** + * @return string + */ + public function packageName() + { + return 'PHPUnit Pretty Result Printer'; + } + + /** + * {@inheritdoc} + */ + protected function writeProgress($progress): void + { + if (!$this->debug) { + $this->printClassName(); + } + + $this->printTestCaseStatus('', $progress); + } + + /** + * {@inheritdoc} + */ + protected function writeProgressWithColor($color, $buffer): void + { + if (!$this->debug) { + $this->printClassName(); + } + + $this->printTestCaseStatus($color, $buffer); + } + + /** + * @param string $color + * @param string $buffer Result of the Test Case => . F S I R + */ + private function printTestCaseStatus($color, $buffer) + { + if ($this->column >= $this->maxNumberOfColumns) { + $this->writeNewLine(); + $padding = $this->maxClassNameLength; + $this->column = $padding; + echo str_pad(' ', $padding); + } + + switch (strtoupper($buffer)) { + case '.': + $color = 'fg-green,bold'; + $buffer = mb_convert_encoding("\x27\x13", 'UTF-8', 'UTF-16BE'); + $buffer .= (!$this->debug) ? '' : ' Passed'; + break; + case 'S': + $color = 'fg-yellow,bold'; + $buffer = ($this->simpleOutput) ? 'S' : mb_convert_encoding("\x27\xA6", 'UTF-8', 'UTF-16BE'); + $buffer .= (!$this->debug) ? '' : ' Skipped'; + break; + case 'I': + $color = 'fg-blue,bold'; + $buffer = ($this->simpleOutput) ? 'I' : 'ℹ'; + $buffer .= (!$this->debug) ? '' : ' Incomplete'; + break; + case 'F': + $color = 'fg-red,bold'; + $buffer = mb_convert_encoding("\x27\x16", 'UTF-8', 'UTF-16BE'); + $buffer .= (!$this->debug) ? '' : ' Fail'; + break; + case 'E': + $color = 'fg-red,bold'; + $buffer = ($this->simpleOutput) ? 'E' : '⚈'; + $buffer .= (!$this->debug) ? '' : ' Error'; + break; + } + + $buffer .= ' '; + echo parent::formatWithColor($color, $buffer); + if ($this->debug) { + $this->writeNewLine(); + } + $this->column = $this->column + 2; + } + + /** + * Prints the Class Name if it has changed. + */ + protected function printClassName() + { + if ($this->hideClassName) { + return; + } + if ($this->lastClassName === $this->className) { + return; + } + + echo PHP_EOL; + $className = $this->formatClassName($this->className); + ($this->colorsTool) ? $this->writeWithColor('fg-cyan,bold', $className, false) : $this->write($className); + $this->column = strlen($className) + 1; + $this->lastClassName = $this->className; + } + + /** + * @param string $className + * + * @return string + */ + private function formatClassName($className) + { + $prefix = ' ==> '; + $ellipsis = '...'; + $suffix = ' '; + $formattedClassName = $prefix . $className . $suffix; + + if (\strlen($formattedClassName) <= $this->maxClassNameLength) { + return $this->fillWithWhitespace($formattedClassName); + } + + // maxLength of class, minus leading (...) and trailing space + $maxLength = $this->maxClassNameLength - \strlen($prefix . $ellipsis . $suffix); + + // substring class name, providing space for ellipsis and one space at end + // this result should be combined to equal $this->maxClassNameLength + return $prefix . $ellipsis . substr($className, (\strlen($className) - $maxLength), $maxLength) . $suffix; + } + + /** + * @param string $className + * + * @return string; + */ + private function fillWithWhitespace($className) + { + return str_pad($className, $this->maxClassNameLength); + } + + /** + * @param string $configFileName + * + * @return string + */ + public function getConfigurationFile($configFileName = 'phpunit-printer.yml') + { + $defaultConfigFilename = $this->getPackageRoot() . DIRECTORY_SEPARATOR . $configFileName; + + $configPath = getcwd(); + $filename = ''; + + $continue = true; + while (!file_exists($filename) && $continue): + if ($this->isWindows()) { + // WINDOWS SPECIFIC CODE GOES HERE + } else { + $filename = $configPath . DIRECTORY_SEPARATOR . $configFileName; + if ($configPath === '/') { + $filename = $defaultConfigFilename; + $continue = false; + } + $configPath = \dirname($configPath); + } + + endwhile; + + return $filename; + } + + /** + * @return bool + */ + private function isWindows() + { + return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; + } + + /** + * @return string | returns package root + */ + private function getPackageRoot() + { + return \dirname(__FILE__, 2); + } + + /** + * Gets the terminal width. + * + * @return int + */ + private function getWidth() + { + $width = 0; + + exec('stty size 2>/dev/null', $out, $exit); + + // 'stty size' output example: 36 120 + if (\count($out) > 0) { + $width = (int) explode(' ', array_pop($out))[1]; + } + + // handle CircleCI case (probably the same with TravisCI as well) + if ($width === 0) { + $width = 96; + } + + return $width; + } +} diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php new file mode 100644 index 0000000..2c72175 --- /dev/null +++ b/vendor/composer/ClassLoader.php @@ -0,0 +1,445 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + private $classMapAuthoritative = false; + private $missingClasses = array(); + private $apcuPrefix; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath.'\\'; + if (isset($this->prefixDirsPsr4[$search])) { + foreach ($this->prefixDirsPsr4[$search] as $dir) { + $length = $this->prefixLengthsPsr4[$first][$search]; + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE new file mode 100644 index 0000000..f27399a --- /dev/null +++ b/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..f462c5c --- /dev/null +++ b/vendor/composer/autoload_classmap.php @@ -0,0 +1,620 @@ + $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArray.php', + 'Hamcrest\\Arrays\\IsArrayContaining' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContaining.php', + 'Hamcrest\\Arrays\\IsArrayContainingInAnyOrder' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php', + 'Hamcrest\\Arrays\\IsArrayContainingInOrder' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInOrder.php', + 'Hamcrest\\Arrays\\IsArrayContainingKey' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKey.php', + 'Hamcrest\\Arrays\\IsArrayContainingKeyValuePair' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKeyValuePair.php', + 'Hamcrest\\Arrays\\IsArrayWithSize' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayWithSize.php', + 'Hamcrest\\Arrays\\MatchingOnce' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/MatchingOnce.php', + 'Hamcrest\\Arrays\\SeriesMatchingOnce' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php', + 'Hamcrest\\AssertionError' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/AssertionError.php', + 'Hamcrest\\BaseDescription' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseDescription.php', + 'Hamcrest\\BaseMatcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseMatcher.php', + 'Hamcrest\\Collection\\IsEmptyTraversable' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsEmptyTraversable.php', + 'Hamcrest\\Collection\\IsTraversableWithSize' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsTraversableWithSize.php', + 'Hamcrest\\Core\\AllOf' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AllOf.php', + 'Hamcrest\\Core\\AnyOf' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AnyOf.php', + 'Hamcrest\\Core\\CombinableMatcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/CombinableMatcher.php', + 'Hamcrest\\Core\\DescribedAs' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/DescribedAs.php', + 'Hamcrest\\Core\\Every' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Every.php', + 'Hamcrest\\Core\\HasToString' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/HasToString.php', + 'Hamcrest\\Core\\Is' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Is.php', + 'Hamcrest\\Core\\IsAnything' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsAnything.php', + 'Hamcrest\\Core\\IsCollectionContaining' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsCollectionContaining.php', + 'Hamcrest\\Core\\IsEqual' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsEqual.php', + 'Hamcrest\\Core\\IsIdentical' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsIdentical.php', + 'Hamcrest\\Core\\IsInstanceOf' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsInstanceOf.php', + 'Hamcrest\\Core\\IsNot' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNot.php', + 'Hamcrest\\Core\\IsNull' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNull.php', + 'Hamcrest\\Core\\IsSame' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsSame.php', + 'Hamcrest\\Core\\IsTypeOf' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsTypeOf.php', + 'Hamcrest\\Core\\Set' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Set.php', + 'Hamcrest\\Core\\ShortcutCombination' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/ShortcutCombination.php', + 'Hamcrest\\Description' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Description.php', + 'Hamcrest\\DiagnosingMatcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/DiagnosingMatcher.php', + 'Hamcrest\\FeatureMatcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/FeatureMatcher.php', + 'Hamcrest\\Internal\\SelfDescribingValue' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Internal/SelfDescribingValue.php', + 'Hamcrest\\Matcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matcher.php', + 'Hamcrest\\MatcherAssert' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/MatcherAssert.php', + 'Hamcrest\\Matchers' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matchers.php', + 'Hamcrest\\NullDescription' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/NullDescription.php', + 'Hamcrest\\Number\\IsCloseTo' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/IsCloseTo.php', + 'Hamcrest\\Number\\OrderingComparison' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/OrderingComparison.php', + 'Hamcrest\\SelfDescribing' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/SelfDescribing.php', + 'Hamcrest\\StringDescription' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/StringDescription.php', + 'Hamcrest\\Text\\IsEmptyString' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEmptyString.php', + 'Hamcrest\\Text\\IsEqualIgnoringCase' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php', + 'Hamcrest\\Text\\IsEqualIgnoringWhiteSpace' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php', + 'Hamcrest\\Text\\MatchesPattern' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/MatchesPattern.php', + 'Hamcrest\\Text\\StringContains' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContains.php', + 'Hamcrest\\Text\\StringContainsIgnoringCase' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php', + 'Hamcrest\\Text\\StringContainsInOrder' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsInOrder.php', + 'Hamcrest\\Text\\StringEndsWith' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringEndsWith.php', + 'Hamcrest\\Text\\StringStartsWith' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringStartsWith.php', + 'Hamcrest\\Text\\SubstringMatcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/SubstringMatcher.php', + 'Hamcrest\\TypeSafeDiagnosingMatcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeDiagnosingMatcher.php', + 'Hamcrest\\TypeSafeMatcher' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeMatcher.php', + 'Hamcrest\\Type\\IsArray' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsArray.php', + 'Hamcrest\\Type\\IsBoolean' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsBoolean.php', + 'Hamcrest\\Type\\IsCallable' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsCallable.php', + 'Hamcrest\\Type\\IsDouble' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsDouble.php', + 'Hamcrest\\Type\\IsInteger' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsInteger.php', + 'Hamcrest\\Type\\IsNumeric' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsNumeric.php', + 'Hamcrest\\Type\\IsObject' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsObject.php', + 'Hamcrest\\Type\\IsResource' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsResource.php', + 'Hamcrest\\Type\\IsScalar' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsScalar.php', + 'Hamcrest\\Type\\IsString' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsString.php', + 'Hamcrest\\Util' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Util.php', + 'Hamcrest\\Xml\\HasXPath' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml/HasXPath.php', + 'PHPUnit\\Exception' => $vendorDir . '/phpunit/phpunit/src/Exception.php', + 'PHPUnit\\Framework\\Assert' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert.php', + 'PHPUnit\\Framework\\AssertionFailedError' => $vendorDir . '/phpunit/phpunit/src/Framework/AssertionFailedError.php', + 'PHPUnit\\Framework\\CodeCoverageException' => $vendorDir . '/phpunit/phpunit/src/Framework/CodeCoverageException.php', + 'PHPUnit\\Framework\\Constraint\\ArrayHasKey' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ArrayHasKey.php', + 'PHPUnit\\Framework\\Constraint\\ArraySubset' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ArraySubset.php', + 'PHPUnit\\Framework\\Constraint\\Attribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Attribute.php', + 'PHPUnit\\Framework\\Constraint\\Callback' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Callback.php', + 'PHPUnit\\Framework\\Constraint\\ClassHasAttribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ClassHasAttribute.php', + 'PHPUnit\\Framework\\Constraint\\ClassHasStaticAttribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ClassHasStaticAttribute.php', + 'PHPUnit\\Framework\\Constraint\\Composite' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Composite.php', + 'PHPUnit\\Framework\\Constraint\\Constraint' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Constraint.php', + 'PHPUnit\\Framework\\Constraint\\Count' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Count.php', + 'PHPUnit\\Framework\\Constraint\\DirectoryExists' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/DirectoryExists.php', + 'PHPUnit\\Framework\\Constraint\\Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/Exception.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionCode' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ExceptionCode.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessage' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ExceptionMessage.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessageRegularExpression' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ExceptionMessageRegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\FileExists' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/FileExists.php', + 'PHPUnit\\Framework\\Constraint\\GreaterThan' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/GreaterThan.php', + 'PHPUnit\\Framework\\Constraint\\IsAnything' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsAnything.php', + 'PHPUnit\\Framework\\Constraint\\IsEmpty' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsEmpty.php', + 'PHPUnit\\Framework\\Constraint\\IsEqual' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsEqual.php', + 'PHPUnit\\Framework\\Constraint\\IsFalse' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsFalse.php', + 'PHPUnit\\Framework\\Constraint\\IsFinite' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsFinite.php', + 'PHPUnit\\Framework\\Constraint\\IsIdentical' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsIdentical.php', + 'PHPUnit\\Framework\\Constraint\\IsInfinite' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsInfinite.php', + 'PHPUnit\\Framework\\Constraint\\IsInstanceOf' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsInstanceOf.php', + 'PHPUnit\\Framework\\Constraint\\IsJson' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsJson.php', + 'PHPUnit\\Framework\\Constraint\\IsNan' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsNan.php', + 'PHPUnit\\Framework\\Constraint\\IsNull' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsNull.php', + 'PHPUnit\\Framework\\Constraint\\IsReadable' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsReadable.php', + 'PHPUnit\\Framework\\Constraint\\IsTrue' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsTrue.php', + 'PHPUnit\\Framework\\Constraint\\IsType' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsType.php', + 'PHPUnit\\Framework\\Constraint\\IsWritable' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/IsWritable.php', + 'PHPUnit\\Framework\\Constraint\\JsonMatches' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/JsonMatches.php', + 'PHPUnit\\Framework\\Constraint\\JsonMatchesErrorMessageProvider' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/JsonMatchesErrorMessageProvider.php', + 'PHPUnit\\Framework\\Constraint\\LessThan' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LessThan.php', + 'PHPUnit\\Framework\\Constraint\\LogicalAnd' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LogicalAnd.php', + 'PHPUnit\\Framework\\Constraint\\LogicalNot' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LogicalNot.php', + 'PHPUnit\\Framework\\Constraint\\LogicalOr' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LogicalOr.php', + 'PHPUnit\\Framework\\Constraint\\LogicalXor' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/LogicalXor.php', + 'PHPUnit\\Framework\\Constraint\\ObjectHasAttribute' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/ObjectHasAttribute.php', + 'PHPUnit\\Framework\\Constraint\\RegularExpression' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/RegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\SameSize' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/SameSize.php', + 'PHPUnit\\Framework\\Constraint\\StringContains' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringContains.php', + 'PHPUnit\\Framework\\Constraint\\StringEndsWith' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringEndsWith.php', + 'PHPUnit\\Framework\\Constraint\\StringMatchesFormatDescription' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringMatchesFormatDescription.php', + 'PHPUnit\\Framework\\Constraint\\StringStartsWith' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/StringStartsWith.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContains' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/TraversableContains.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsOnly' => $vendorDir . '/phpunit/phpunit/src/Framework/Constraint/TraversableContainsOnly.php', + 'PHPUnit\\Framework\\CoveredCodeNotExecutedException' => $vendorDir . '/phpunit/phpunit/src/Framework/CoveredCodeNotExecutedException.php', + 'PHPUnit\\Framework\\DataProviderTestSuite' => $vendorDir . '/phpunit/phpunit/src/Framework/DataProviderTestSuite.php', + 'PHPUnit\\Framework\\Error\\Deprecated' => $vendorDir . '/phpunit/phpunit/src/Framework/Error/Deprecated.php', + 'PHPUnit\\Framework\\Error\\Error' => $vendorDir . '/phpunit/phpunit/src/Framework/Error/Error.php', + 'PHPUnit\\Framework\\Error\\Notice' => $vendorDir . '/phpunit/phpunit/src/Framework/Error/Notice.php', + 'PHPUnit\\Framework\\Error\\Warning' => $vendorDir . '/phpunit/phpunit/src/Framework/Error/Warning.php', + 'PHPUnit\\Framework\\Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception.php', + 'PHPUnit\\Framework\\ExceptionWrapper' => $vendorDir . '/phpunit/phpunit/src/Framework/ExceptionWrapper.php', + 'PHPUnit\\Framework\\ExpectationFailedException' => $vendorDir . '/phpunit/phpunit/src/Framework/ExpectationFailedException.php', + 'PHPUnit\\Framework\\IncompleteTest' => $vendorDir . '/phpunit/phpunit/src/Framework/IncompleteTest.php', + 'PHPUnit\\Framework\\IncompleteTestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/IncompleteTestCase.php', + 'PHPUnit\\Framework\\IncompleteTestError' => $vendorDir . '/phpunit/phpunit/src/Framework/IncompleteTestError.php', + 'PHPUnit\\Framework\\InvalidCoversTargetException' => $vendorDir . '/phpunit/phpunit/src/Framework/InvalidCoversTargetException.php', + 'PHPUnit\\Framework\\MissingCoversAnnotationException' => $vendorDir . '/phpunit/phpunit/src/Framework/MissingCoversAnnotationException.php', + 'PHPUnit\\Framework\\MockObject\\BadMethodCallException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/BadMethodCallException.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Identity' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Builder/Identity.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\InvocationMocker' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationMocker.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Match' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Builder/Match.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\MethodNameMatch' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Builder/MethodNameMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\NamespaceMatch' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Builder/NamespaceMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\ParametersMatch' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Stub' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Builder/Stub.php', + 'PHPUnit\\Framework\\MockObject\\Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Generator' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Generator.php', + 'PHPUnit\\Framework\\MockObject\\Invocation' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Invocation/Invocation.php', + 'PHPUnit\\Framework\\MockObject\\InvocationMocker' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/InvocationMocker.php', + 'PHPUnit\\Framework\\MockObject\\Invocation\\ObjectInvocation' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Invocation/ObjectInvocation.php', + 'PHPUnit\\Framework\\MockObject\\Invocation\\StaticInvocation' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Invocation/StaticInvocation.php', + 'PHPUnit\\Framework\\MockObject\\Invokable' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Invokable.php', + 'PHPUnit\\Framework\\MockObject\\Matcher' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\AnyInvokedCount' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher/AnyInvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\AnyParameters' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher/AnyParameters.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\ConsecutiveParameters' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher/ConsecutiveParameters.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\DeferredError' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher/DeferredError.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\Invocation' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher/Invocation.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtIndex' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtIndex.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtLeastCount' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtLeastCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtLeastOnce' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtLeastOnce.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtMostCount' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtMostCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedCount' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedRecorder' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedRecorder.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\MethodName' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher/MethodName.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\Parameters' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher/Parameters.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\StatelessInvocation' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Matcher/StatelessInvocation.php', + 'PHPUnit\\Framework\\MockObject\\MockBuilder' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php', + 'PHPUnit\\Framework\\MockObject\\MockMethod' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/MockMethod.php', + 'PHPUnit\\Framework\\MockObject\\MockMethodSet' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/MockMethodSet.php', + 'PHPUnit\\Framework\\MockObject\\MockObject' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/ForwardCompatibility/MockObject.php', + 'PHPUnit\\Framework\\MockObject\\RuntimeException' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Exception/RuntimeException.php', + 'PHPUnit\\Framework\\MockObject\\Stub' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ConsecutiveCalls' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/ConsecutiveCalls.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\Exception' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\MatcherCollection' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/MatcherCollection.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnArgument' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnArgument.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnCallback' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnCallback.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnReference' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnReference.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnSelf' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnSelf.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnStub' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnStub.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnValueMap' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnValueMap.php', + 'PHPUnit\\Framework\\MockObject\\Verifiable' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Verifiable.php', + 'PHPUnit\\Framework\\OutputError' => $vendorDir . '/phpunit/phpunit/src/Framework/OutputError.php', + 'PHPUnit\\Framework\\RiskyTest' => $vendorDir . '/phpunit/phpunit/src/Framework/RiskyTest.php', + 'PHPUnit\\Framework\\RiskyTestError' => $vendorDir . '/phpunit/phpunit/src/Framework/RiskyTestError.php', + 'PHPUnit\\Framework\\SelfDescribing' => $vendorDir . '/phpunit/phpunit/src/Framework/SelfDescribing.php', + 'PHPUnit\\Framework\\SkippedTest' => $vendorDir . '/phpunit/phpunit/src/Framework/SkippedTest.php', + 'PHPUnit\\Framework\\SkippedTestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/SkippedTestCase.php', + 'PHPUnit\\Framework\\SkippedTestError' => $vendorDir . '/phpunit/phpunit/src/Framework/SkippedTestError.php', + 'PHPUnit\\Framework\\SkippedTestSuiteError' => $vendorDir . '/phpunit/phpunit/src/Framework/SkippedTestSuiteError.php', + 'PHPUnit\\Framework\\SyntheticError' => $vendorDir . '/phpunit/phpunit/src/Framework/SyntheticError.php', + 'PHPUnit\\Framework\\Test' => $vendorDir . '/phpunit/phpunit/src/Framework/Test.php', + 'PHPUnit\\Framework\\TestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/TestCase.php', + 'PHPUnit\\Framework\\TestFailure' => $vendorDir . '/phpunit/phpunit/src/Framework/TestFailure.php', + 'PHPUnit\\Framework\\TestListener' => $vendorDir . '/phpunit/phpunit/src/Framework/TestListener.php', + 'PHPUnit\\Framework\\TestListenerDefaultImplementation' => $vendorDir . '/phpunit/phpunit/src/Framework/TestListenerDefaultImplementation.php', + 'PHPUnit\\Framework\\TestResult' => $vendorDir . '/phpunit/phpunit/src/Framework/TestResult.php', + 'PHPUnit\\Framework\\TestSuite' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSuite.php', + 'PHPUnit\\Framework\\TestSuiteIterator' => $vendorDir . '/phpunit/phpunit/src/Framework/TestSuiteIterator.php', + 'PHPUnit\\Framework\\UnintentionallyCoveredCodeError' => $vendorDir . '/phpunit/phpunit/src/Framework/UnintentionallyCoveredCodeError.php', + 'PHPUnit\\Framework\\Warning' => $vendorDir . '/phpunit/phpunit/src/Framework/Warning.php', + 'PHPUnit\\Framework\\WarningTestCase' => $vendorDir . '/phpunit/phpunit/src/Framework/WarningTestCase.php', + 'PHPUnit\\Runner\\AfterIncompleteTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterIncompleteTestHook.php', + 'PHPUnit\\Runner\\AfterLastTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterLastTestHook.php', + 'PHPUnit\\Runner\\AfterRiskyTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterRiskyTestHook.php', + 'PHPUnit\\Runner\\AfterSkippedTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterSkippedTestHook.php', + 'PHPUnit\\Runner\\AfterSuccessfulTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterSuccessfulTestHook.php', + 'PHPUnit\\Runner\\AfterTestErrorHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterTestErrorHook.php', + 'PHPUnit\\Runner\\AfterTestFailureHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterTestFailureHook.php', + 'PHPUnit\\Runner\\AfterTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterTestHook.php', + 'PHPUnit\\Runner\\AfterTestWarningHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/AfterTestWarningHook.php', + 'PHPUnit\\Runner\\BaseTestRunner' => $vendorDir . '/phpunit/phpunit/src/Runner/BaseTestRunner.php', + 'PHPUnit\\Runner\\BeforeFirstTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/BeforeFirstTestHook.php', + 'PHPUnit\\Runner\\BeforeTestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/BeforeTestHook.php', + 'PHPUnit\\Runner\\Exception' => $vendorDir . '/phpunit/phpunit/src/Runner/Exception.php', + 'PHPUnit\\Runner\\Filter\\ExcludeGroupFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/ExcludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\Factory' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/Factory.php', + 'PHPUnit\\Runner\\Filter\\GroupFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/GroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\IncludeGroupFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/IncludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\NameFilterIterator' => $vendorDir . '/phpunit/phpunit/src/Runner/Filter/NameFilterIterator.php', + 'PHPUnit\\Runner\\Hook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/Hook.php', + 'PHPUnit\\Runner\\NullTestResultCache' => $vendorDir . '/phpunit/phpunit/src/Util/NullTestResultCache.php', + 'PHPUnit\\Runner\\PhptTestCase' => $vendorDir . '/phpunit/phpunit/src/Runner/PhptTestCase.php', + 'PHPUnit\\Runner\\ResultCacheExtension' => $vendorDir . '/phpunit/phpunit/src/Runner/ResultCacheExtension.php', + 'PHPUnit\\Runner\\StandardTestSuiteLoader' => $vendorDir . '/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php', + 'PHPUnit\\Runner\\TestHook' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/TestHook.php', + 'PHPUnit\\Runner\\TestListenerAdapter' => $vendorDir . '/phpunit/phpunit/src/Runner/Hook/TestListenerAdapter.php', + 'PHPUnit\\Runner\\TestResultCache' => $vendorDir . '/phpunit/phpunit/src/Util/TestResultCache.php', + 'PHPUnit\\Runner\\TestResultCacheInterface' => $vendorDir . '/phpunit/phpunit/src/Util/TestResultCacheInterface.php', + 'PHPUnit\\Runner\\TestSuiteLoader' => $vendorDir . '/phpunit/phpunit/src/Runner/TestSuiteLoader.php', + 'PHPUnit\\Runner\\TestSuiteSorter' => $vendorDir . '/phpunit/phpunit/src/Runner/TestSuiteSorter.php', + 'PHPUnit\\Runner\\Version' => $vendorDir . '/phpunit/phpunit/src/Runner/Version.php', + 'PHPUnit\\TextUI\\Command' => $vendorDir . '/phpunit/phpunit/src/TextUI/Command.php', + 'PHPUnit\\TextUI\\ResultPrinter' => $vendorDir . '/phpunit/phpunit/src/TextUI/ResultPrinter.php', + 'PHPUnit\\TextUI\\TestRunner' => $vendorDir . '/phpunit/phpunit/src/TextUI/TestRunner.php', + 'PHPUnit\\Util\\Blacklist' => $vendorDir . '/phpunit/phpunit/src/Util/Blacklist.php', + 'PHPUnit\\Util\\Configuration' => $vendorDir . '/phpunit/phpunit/src/Util/Configuration.php', + 'PHPUnit\\Util\\ConfigurationGenerator' => $vendorDir . '/phpunit/phpunit/src/Util/ConfigurationGenerator.php', + 'PHPUnit\\Util\\ErrorHandler' => $vendorDir . '/phpunit/phpunit/src/Util/ErrorHandler.php', + 'PHPUnit\\Util\\FileLoader' => $vendorDir . '/phpunit/phpunit/src/Util/FileLoader.php', + 'PHPUnit\\Util\\Filesystem' => $vendorDir . '/phpunit/phpunit/src/Util/Filesystem.php', + 'PHPUnit\\Util\\Filter' => $vendorDir . '/phpunit/phpunit/src/Util/Filter.php', + 'PHPUnit\\Util\\Getopt' => $vendorDir . '/phpunit/phpunit/src/Util/Getopt.php', + 'PHPUnit\\Util\\GlobalState' => $vendorDir . '/phpunit/phpunit/src/Util/GlobalState.php', + 'PHPUnit\\Util\\InvalidArgumentHelper' => $vendorDir . '/phpunit/phpunit/src/Util/InvalidArgumentHelper.php', + 'PHPUnit\\Util\\Json' => $vendorDir . '/phpunit/phpunit/src/Util/Json.php', + 'PHPUnit\\Util\\Log\\JUnit' => $vendorDir . '/phpunit/phpunit/src/Util/Log/JUnit.php', + 'PHPUnit\\Util\\Log\\TeamCity' => $vendorDir . '/phpunit/phpunit/src/Util/Log/TeamCity.php', + 'PHPUnit\\Util\\PHP\\AbstractPhpProcess' => $vendorDir . '/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php', + 'PHPUnit\\Util\\PHP\\DefaultPhpProcess' => $vendorDir . '/phpunit/phpunit/src/Util/PHP/DefaultPhpProcess.php', + 'PHPUnit\\Util\\PHP\\WindowsPhpProcess' => $vendorDir . '/phpunit/phpunit/src/Util/PHP/WindowsPhpProcess.php', + 'PHPUnit\\Util\\Printer' => $vendorDir . '/phpunit/phpunit/src/Util/Printer.php', + 'PHPUnit\\Util\\RegularExpression' => $vendorDir . '/phpunit/phpunit/src/Util/RegularExpression.php', + 'PHPUnit\\Util\\Test' => $vendorDir . '/phpunit/phpunit/src/Util/Test.php', + 'PHPUnit\\Util\\TestDox\\CliTestDoxPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/CliTestDoxPrinter.php', + 'PHPUnit\\Util\\TestDox\\HtmlResultPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/HtmlResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\NamePrettifier' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/NamePrettifier.php', + 'PHPUnit\\Util\\TestDox\\ResultPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/ResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\TestResult' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/TestResult.php', + 'PHPUnit\\Util\\TestDox\\TextResultPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/TextResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\XmlResultPrinter' => $vendorDir . '/phpunit/phpunit/src/Util/TestDox/XmlResultPrinter.php', + 'PHPUnit\\Util\\TextTestListRenderer' => $vendorDir . '/phpunit/phpunit/src/Util/TextTestListRenderer.php', + 'PHPUnit\\Util\\Type' => $vendorDir . '/phpunit/phpunit/src/Util/Type.php', + 'PHPUnit\\Util\\XdebugFilterScriptGenerator' => $vendorDir . '/phpunit/phpunit/src/Util/XdebugFilterScriptGenerator.php', + 'PHPUnit\\Util\\Xml' => $vendorDir . '/phpunit/phpunit/src/Util/Xml.php', + 'PHPUnit\\Util\\XmlTestListRenderer' => $vendorDir . '/phpunit/phpunit/src/Util/XmlTestListRenderer.php', + 'PHPUnit_Framework_MockObject_MockObject' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/MockObject.php', + 'PHP_Token' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_TokenWithScope' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_TokenWithScopeAndVisibility' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ABSTRACT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AMPERSAND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AND_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ARRAY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ARRAY_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BACKTICK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BAD_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BOOLEAN_AND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BOOLEAN_OR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BOOL_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BREAK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CALLABLE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CARET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CASE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CATCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLASS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLASS_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLASS_NAME_CONSTANT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLONE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_BRACKET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_TAG' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COALESCE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COMMA' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COMMENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONCAT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONSTANT_ENCAPSED_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONTINUE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CURLY_OPEN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DEC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DECLARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DEFAULT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DIR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DIV' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DIV_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DNUMBER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOC_COMMENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOLLAR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOLLAR_OPEN_CURLY_BRACES' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_ARROW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_COLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_QUOTES' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ECHO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ELLIPSIS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ELSE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ELSEIF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EMPTY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENCAPSED_AND_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDDECLARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDFOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDFOREACH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDIF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDSWITCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDWHILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_END_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EVAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EXCLAMATION_MARK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EXIT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EXTENDS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FINAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FINALLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FOREACH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FUNCTION' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FUNC_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_GLOBAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_GOTO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_GT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_HALT_COMPILER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IMPLEMENTS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INCLUDE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INCLUDE_ONCE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INLINE_HTML' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INSTANCEOF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INSTEADOF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INTERFACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INT_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ISSET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_GREATER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_NOT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_NOT_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_SMALLER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_Includes' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LINE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LIST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LNUMBER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LOGICAL_AND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LOGICAL_OR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LOGICAL_XOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_METHOD_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MINUS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MINUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MOD_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MULT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MUL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NAMESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NEW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NS_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NS_SEPARATOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NUM_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OBJECT_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OBJECT_OPERATOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_BRACKET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_TAG' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_TAG_WITH_ECHO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PAAMAYIM_NEKUDOTAYIM' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PERCENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PIPE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PLUS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PLUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_POW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_POW_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PRINT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PRIVATE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PROTECTED' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PUBLIC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_QUESTION_MARK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_REQUIRE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_REQUIRE_ONCE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_RETURN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SEMICOLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SPACESHIP' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_START_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STATIC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STRING_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STRING_VARNAME' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SWITCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_Stream' => $vendorDir . '/phpunit/php-token-stream/src/Token/Stream.php', + 'PHP_Token_Stream_CachingFactory' => $vendorDir . '/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php', + 'PHP_Token_THROW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TILDE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TRAIT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TRAIT_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TRY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_UNSET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_UNSET_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_USE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_USE_FUNCTION' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_VAR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_VARIABLE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_WHILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XOR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_YIELD' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_YIELD_FROM' => $vendorDir . '/phpunit/php-token-stream/src/Token.php', + 'PharIo\\Manifest\\Application' => $vendorDir . '/phar-io/manifest/src/values/Application.php', + 'PharIo\\Manifest\\ApplicationName' => $vendorDir . '/phar-io/manifest/src/values/ApplicationName.php', + 'PharIo\\Manifest\\Author' => $vendorDir . '/phar-io/manifest/src/values/Author.php', + 'PharIo\\Manifest\\AuthorCollection' => $vendorDir . '/phar-io/manifest/src/values/AuthorCollection.php', + 'PharIo\\Manifest\\AuthorCollectionIterator' => $vendorDir . '/phar-io/manifest/src/values/AuthorCollectionIterator.php', + 'PharIo\\Manifest\\AuthorElement' => $vendorDir . '/phar-io/manifest/src/xml/AuthorElement.php', + 'PharIo\\Manifest\\AuthorElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/AuthorElementCollection.php', + 'PharIo\\Manifest\\BundledComponent' => $vendorDir . '/phar-io/manifest/src/values/BundledComponent.php', + 'PharIo\\Manifest\\BundledComponentCollection' => $vendorDir . '/phar-io/manifest/src/values/BundledComponentCollection.php', + 'PharIo\\Manifest\\BundledComponentCollectionIterator' => $vendorDir . '/phar-io/manifest/src/values/BundledComponentCollectionIterator.php', + 'PharIo\\Manifest\\BundlesElement' => $vendorDir . '/phar-io/manifest/src/xml/BundlesElement.php', + 'PharIo\\Manifest\\ComponentElement' => $vendorDir . '/phar-io/manifest/src/xml/ComponentElement.php', + 'PharIo\\Manifest\\ComponentElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/ComponentElementCollection.php', + 'PharIo\\Manifest\\ContainsElement' => $vendorDir . '/phar-io/manifest/src/xml/ContainsElement.php', + 'PharIo\\Manifest\\CopyrightElement' => $vendorDir . '/phar-io/manifest/src/xml/CopyrightElement.php', + 'PharIo\\Manifest\\CopyrightInformation' => $vendorDir . '/phar-io/manifest/src/values/CopyrightInformation.php', + 'PharIo\\Manifest\\ElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/ElementCollection.php', + 'PharIo\\Manifest\\Email' => $vendorDir . '/phar-io/manifest/src/values/Email.php', + 'PharIo\\Manifest\\Exception' => $vendorDir . '/phar-io/manifest/src/exceptions/Exception.php', + 'PharIo\\Manifest\\ExtElement' => $vendorDir . '/phar-io/manifest/src/xml/ExtElement.php', + 'PharIo\\Manifest\\ExtElementCollection' => $vendorDir . '/phar-io/manifest/src/xml/ExtElementCollection.php', + 'PharIo\\Manifest\\Extension' => $vendorDir . '/phar-io/manifest/src/values/Extension.php', + 'PharIo\\Manifest\\ExtensionElement' => $vendorDir . '/phar-io/manifest/src/xml/ExtensionElement.php', + 'PharIo\\Manifest\\InvalidApplicationNameException' => $vendorDir . '/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php', + 'PharIo\\Manifest\\InvalidEmailException' => $vendorDir . '/phar-io/manifest/src/exceptions/InvalidEmailException.php', + 'PharIo\\Manifest\\InvalidUrlException' => $vendorDir . '/phar-io/manifest/src/exceptions/InvalidUrlException.php', + 'PharIo\\Manifest\\Library' => $vendorDir . '/phar-io/manifest/src/values/Library.php', + 'PharIo\\Manifest\\License' => $vendorDir . '/phar-io/manifest/src/values/License.php', + 'PharIo\\Manifest\\LicenseElement' => $vendorDir . '/phar-io/manifest/src/xml/LicenseElement.php', + 'PharIo\\Manifest\\Manifest' => $vendorDir . '/phar-io/manifest/src/values/Manifest.php', + 'PharIo\\Manifest\\ManifestDocument' => $vendorDir . '/phar-io/manifest/src/xml/ManifestDocument.php', + 'PharIo\\Manifest\\ManifestDocumentException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestDocumentException.php', + 'PharIo\\Manifest\\ManifestDocumentLoadingException' => $vendorDir . '/phar-io/manifest/src/xml/ManifestDocumentLoadingException.php', + 'PharIo\\Manifest\\ManifestDocumentMapper' => $vendorDir . '/phar-io/manifest/src/ManifestDocumentMapper.php', + 'PharIo\\Manifest\\ManifestDocumentMapperException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestDocumentMapperException.php', + 'PharIo\\Manifest\\ManifestElement' => $vendorDir . '/phar-io/manifest/src/xml/ManifestElement.php', + 'PharIo\\Manifest\\ManifestElementException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestElementException.php', + 'PharIo\\Manifest\\ManifestLoader' => $vendorDir . '/phar-io/manifest/src/ManifestLoader.php', + 'PharIo\\Manifest\\ManifestLoaderException' => $vendorDir . '/phar-io/manifest/src/exceptions/ManifestLoaderException.php', + 'PharIo\\Manifest\\ManifestSerializer' => $vendorDir . '/phar-io/manifest/src/ManifestSerializer.php', + 'PharIo\\Manifest\\PhpElement' => $vendorDir . '/phar-io/manifest/src/xml/PhpElement.php', + 'PharIo\\Manifest\\PhpExtensionRequirement' => $vendorDir . '/phar-io/manifest/src/values/PhpExtensionRequirement.php', + 'PharIo\\Manifest\\PhpVersionRequirement' => $vendorDir . '/phar-io/manifest/src/values/PhpVersionRequirement.php', + 'PharIo\\Manifest\\Requirement' => $vendorDir . '/phar-io/manifest/src/values/Requirement.php', + 'PharIo\\Manifest\\RequirementCollection' => $vendorDir . '/phar-io/manifest/src/values/RequirementCollection.php', + 'PharIo\\Manifest\\RequirementCollectionIterator' => $vendorDir . '/phar-io/manifest/src/values/RequirementCollectionIterator.php', + 'PharIo\\Manifest\\RequiresElement' => $vendorDir . '/phar-io/manifest/src/xml/RequiresElement.php', + 'PharIo\\Manifest\\Type' => $vendorDir . '/phar-io/manifest/src/values/Type.php', + 'PharIo\\Manifest\\Url' => $vendorDir . '/phar-io/manifest/src/values/Url.php', + 'PharIo\\Version\\AbstractVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/AbstractVersionConstraint.php', + 'PharIo\\Version\\AndVersionConstraintGroup' => $vendorDir . '/phar-io/version/src/constraints/AndVersionConstraintGroup.php', + 'PharIo\\Version\\AnyVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/AnyVersionConstraint.php', + 'PharIo\\Version\\ExactVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/ExactVersionConstraint.php', + 'PharIo\\Version\\Exception' => $vendorDir . '/phar-io/version/src/exceptions/Exception.php', + 'PharIo\\Version\\GreaterThanOrEqualToVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php', + 'PharIo\\Version\\InvalidPreReleaseSuffixException' => $vendorDir . '/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php', + 'PharIo\\Version\\InvalidVersionException' => $vendorDir . '/phar-io/version/src/exceptions/InvalidVersionException.php', + 'PharIo\\Version\\OrVersionConstraintGroup' => $vendorDir . '/phar-io/version/src/constraints/OrVersionConstraintGroup.php', + 'PharIo\\Version\\PreReleaseSuffix' => $vendorDir . '/phar-io/version/src/PreReleaseSuffix.php', + 'PharIo\\Version\\SpecificMajorAndMinorVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php', + 'PharIo\\Version\\SpecificMajorVersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php', + 'PharIo\\Version\\UnsupportedVersionConstraintException' => $vendorDir . '/phar-io/version/src/exceptions/UnsupportedVersionConstraintException.php', + 'PharIo\\Version\\Version' => $vendorDir . '/phar-io/version/src/Version.php', + 'PharIo\\Version\\VersionConstraint' => $vendorDir . '/phar-io/version/src/constraints/VersionConstraint.php', + 'PharIo\\Version\\VersionConstraintParser' => $vendorDir . '/phar-io/version/src/VersionConstraintParser.php', + 'PharIo\\Version\\VersionConstraintValue' => $vendorDir . '/phar-io/version/src/VersionConstraintValue.php', + 'PharIo\\Version\\VersionNumber' => $vendorDir . '/phar-io/version/src/VersionNumber.php', + 'SebastianBergmann\\CodeCoverage\\CodeCoverage' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage.php', + 'SebastianBergmann\\CodeCoverage\\CoveredCodeNotExecutedException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/CoveredCodeNotExecutedException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Driver' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/Driver.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\PHPDBG' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/PHPDBG.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Xdebug' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/Xdebug.php', + 'SebastianBergmann\\CodeCoverage\\Exception' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/Exception.php', + 'SebastianBergmann\\CodeCoverage\\Filter' => $vendorDir . '/phpunit/php-code-coverage/src/Filter.php', + 'SebastianBergmann\\CodeCoverage\\InvalidArgumentException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\CodeCoverage\\MissingCoversAnnotationException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/MissingCoversAnnotationException.php', + 'SebastianBergmann\\CodeCoverage\\Node\\AbstractNode' => $vendorDir . '/phpunit/php-code-coverage/src/Node/AbstractNode.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Builder' => $vendorDir . '/phpunit/php-code-coverage/src/Node/Builder.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Directory' => $vendorDir . '/phpunit/php-code-coverage/src/Node/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Node\\File' => $vendorDir . '/phpunit/php-code-coverage/src/Node/File.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Iterator' => $vendorDir . '/phpunit/php-code-coverage/src/Node/Iterator.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Clover' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Clover.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Crap4j' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Crap4j.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Dashboard' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Directory' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Facade' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\File' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Renderer' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer.php', + 'SebastianBergmann\\CodeCoverage\\Report\\PHP' => $vendorDir . '/phpunit/php-code-coverage/src/Report/PHP.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Text' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Text.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\BuildInformation' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/BuildInformation.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Coverage' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Coverage.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Directory' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Facade' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\File' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Method' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Method.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Node' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Node.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Project' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Project.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Report' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Report.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Source' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Source.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Tests' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Tests.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Totals' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Totals.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Unit' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Unit.php', + 'SebastianBergmann\\CodeCoverage\\RuntimeException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/RuntimeException.php', + 'SebastianBergmann\\CodeCoverage\\UnintentionallyCoveredCodeException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php', + 'SebastianBergmann\\CodeCoverage\\Util' => $vendorDir . '/phpunit/php-code-coverage/src/Util.php', + 'SebastianBergmann\\CodeCoverage\\Version' => $vendorDir . '/phpunit/php-code-coverage/src/Version.php', + 'SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => $vendorDir . '/sebastian/code-unit-reverse-lookup/src/Wizard.php', + 'SebastianBergmann\\Comparator\\ArrayComparator' => $vendorDir . '/sebastian/comparator/src/ArrayComparator.php', + 'SebastianBergmann\\Comparator\\Comparator' => $vendorDir . '/sebastian/comparator/src/Comparator.php', + 'SebastianBergmann\\Comparator\\ComparisonFailure' => $vendorDir . '/sebastian/comparator/src/ComparisonFailure.php', + 'SebastianBergmann\\Comparator\\DOMNodeComparator' => $vendorDir . '/sebastian/comparator/src/DOMNodeComparator.php', + 'SebastianBergmann\\Comparator\\DateTimeComparator' => $vendorDir . '/sebastian/comparator/src/DateTimeComparator.php', + 'SebastianBergmann\\Comparator\\DoubleComparator' => $vendorDir . '/sebastian/comparator/src/DoubleComparator.php', + 'SebastianBergmann\\Comparator\\ExceptionComparator' => $vendorDir . '/sebastian/comparator/src/ExceptionComparator.php', + 'SebastianBergmann\\Comparator\\Factory' => $vendorDir . '/sebastian/comparator/src/Factory.php', + 'SebastianBergmann\\Comparator\\MockObjectComparator' => $vendorDir . '/sebastian/comparator/src/MockObjectComparator.php', + 'SebastianBergmann\\Comparator\\NumericComparator' => $vendorDir . '/sebastian/comparator/src/NumericComparator.php', + 'SebastianBergmann\\Comparator\\ObjectComparator' => $vendorDir . '/sebastian/comparator/src/ObjectComparator.php', + 'SebastianBergmann\\Comparator\\ResourceComparator' => $vendorDir . '/sebastian/comparator/src/ResourceComparator.php', + 'SebastianBergmann\\Comparator\\ScalarComparator' => $vendorDir . '/sebastian/comparator/src/ScalarComparator.php', + 'SebastianBergmann\\Comparator\\SplObjectStorageComparator' => $vendorDir . '/sebastian/comparator/src/SplObjectStorageComparator.php', + 'SebastianBergmann\\Comparator\\TypeComparator' => $vendorDir . '/sebastian/comparator/src/TypeComparator.php', + 'SebastianBergmann\\Diff\\Chunk' => $vendorDir . '/sebastian/diff/src/Chunk.php', + 'SebastianBergmann\\Diff\\ConfigurationException' => $vendorDir . '/sebastian/diff/src/Exception/ConfigurationException.php', + 'SebastianBergmann\\Diff\\Diff' => $vendorDir . '/sebastian/diff/src/Diff.php', + 'SebastianBergmann\\Diff\\Differ' => $vendorDir . '/sebastian/diff/src/Differ.php', + 'SebastianBergmann\\Diff\\Exception' => $vendorDir . '/sebastian/diff/src/Exception/Exception.php', + 'SebastianBergmann\\Diff\\InvalidArgumentException' => $vendorDir . '/sebastian/diff/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\Diff\\Line' => $vendorDir . '/sebastian/diff/src/Line.php', + 'SebastianBergmann\\Diff\\LongestCommonSubsequenceCalculator' => $vendorDir . '/sebastian/diff/src/LongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\MemoryEfficientLongestCommonSubsequenceCalculator' => $vendorDir . '/sebastian/diff/src/MemoryEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\Output\\AbstractChunkOutputBuilder' => $vendorDir . '/sebastian/diff/src/Output/AbstractChunkOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOnlyOutputBuilder' => $vendorDir . '/sebastian/diff/src/Output/DiffOnlyOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOutputBuilderInterface' => $vendorDir . '/sebastian/diff/src/Output/DiffOutputBuilderInterface.php', + 'SebastianBergmann\\Diff\\Output\\StrictUnifiedDiffOutputBuilder' => $vendorDir . '/sebastian/diff/src/Output/StrictUnifiedDiffOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\UnifiedDiffOutputBuilder' => $vendorDir . '/sebastian/diff/src/Output/UnifiedDiffOutputBuilder.php', + 'SebastianBergmann\\Diff\\Parser' => $vendorDir . '/sebastian/diff/src/Parser.php', + 'SebastianBergmann\\Diff\\TimeEfficientLongestCommonSubsequenceCalculator' => $vendorDir . '/sebastian/diff/src/TimeEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Environment\\Console' => $vendorDir . '/sebastian/environment/src/Console.php', + 'SebastianBergmann\\Environment\\OperatingSystem' => $vendorDir . '/sebastian/environment/src/OperatingSystem.php', + 'SebastianBergmann\\Environment\\Runtime' => $vendorDir . '/sebastian/environment/src/Runtime.php', + 'SebastianBergmann\\Exporter\\Exporter' => $vendorDir . '/sebastian/exporter/src/Exporter.php', + 'SebastianBergmann\\FileIterator\\Facade' => $vendorDir . '/phpunit/php-file-iterator/src/Facade.php', + 'SebastianBergmann\\FileIterator\\Factory' => $vendorDir . '/phpunit/php-file-iterator/src/Factory.php', + 'SebastianBergmann\\FileIterator\\Iterator' => $vendorDir . '/phpunit/php-file-iterator/src/Iterator.php', + 'SebastianBergmann\\GlobalState\\Blacklist' => $vendorDir . '/sebastian/global-state/src/Blacklist.php', + 'SebastianBergmann\\GlobalState\\CodeExporter' => $vendorDir . '/sebastian/global-state/src/CodeExporter.php', + 'SebastianBergmann\\GlobalState\\Exception' => $vendorDir . '/sebastian/global-state/src/exceptions/Exception.php', + 'SebastianBergmann\\GlobalState\\Restorer' => $vendorDir . '/sebastian/global-state/src/Restorer.php', + 'SebastianBergmann\\GlobalState\\RuntimeException' => $vendorDir . '/sebastian/global-state/src/exceptions/RuntimeException.php', + 'SebastianBergmann\\GlobalState\\Snapshot' => $vendorDir . '/sebastian/global-state/src/Snapshot.php', + 'SebastianBergmann\\ObjectEnumerator\\Enumerator' => $vendorDir . '/sebastian/object-enumerator/src/Enumerator.php', + 'SebastianBergmann\\ObjectEnumerator\\Exception' => $vendorDir . '/sebastian/object-enumerator/src/Exception.php', + 'SebastianBergmann\\ObjectEnumerator\\InvalidArgumentException' => $vendorDir . '/sebastian/object-enumerator/src/InvalidArgumentException.php', + 'SebastianBergmann\\ObjectReflector\\Exception' => $vendorDir . '/sebastian/object-reflector/src/Exception.php', + 'SebastianBergmann\\ObjectReflector\\InvalidArgumentException' => $vendorDir . '/sebastian/object-reflector/src/InvalidArgumentException.php', + 'SebastianBergmann\\ObjectReflector\\ObjectReflector' => $vendorDir . '/sebastian/object-reflector/src/ObjectReflector.php', + 'SebastianBergmann\\RecursionContext\\Context' => $vendorDir . '/sebastian/recursion-context/src/Context.php', + 'SebastianBergmann\\RecursionContext\\Exception' => $vendorDir . '/sebastian/recursion-context/src/Exception.php', + 'SebastianBergmann\\RecursionContext\\InvalidArgumentException' => $vendorDir . '/sebastian/recursion-context/src/InvalidArgumentException.php', + 'SebastianBergmann\\ResourceOperations\\ResourceOperations' => $vendorDir . '/sebastian/resource-operations/src/ResourceOperations.php', + 'SebastianBergmann\\Timer\\Exception' => $vendorDir . '/phpunit/php-timer/src/Exception.php', + 'SebastianBergmann\\Timer\\RuntimeException' => $vendorDir . '/phpunit/php-timer/src/RuntimeException.php', + 'SebastianBergmann\\Timer\\Timer' => $vendorDir . '/phpunit/php-timer/src/Timer.php', + 'SebastianBergmann\\Version' => $vendorDir . '/sebastian/version/src/Version.php', + 'Text_Template' => $vendorDir . '/phpunit/php-text-template/src/Template.php', + 'TheSeer\\Tokenizer\\Exception' => $vendorDir . '/theseer/tokenizer/src/Exception.php', + 'TheSeer\\Tokenizer\\NamespaceUri' => $vendorDir . '/theseer/tokenizer/src/NamespaceUri.php', + 'TheSeer\\Tokenizer\\NamespaceUriException' => $vendorDir . '/theseer/tokenizer/src/NamespaceUriException.php', + 'TheSeer\\Tokenizer\\Token' => $vendorDir . '/theseer/tokenizer/src/Token.php', + 'TheSeer\\Tokenizer\\TokenCollection' => $vendorDir . '/theseer/tokenizer/src/TokenCollection.php', + 'TheSeer\\Tokenizer\\TokenCollectionException' => $vendorDir . '/theseer/tokenizer/src/TokenCollectionException.php', + 'TheSeer\\Tokenizer\\Tokenizer' => $vendorDir . '/theseer/tokenizer/src/Tokenizer.php', + 'TheSeer\\Tokenizer\\XMLSerializer' => $vendorDir . '/theseer/tokenizer/src/XMLSerializer.php', +); diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php new file mode 100644 index 0000000..f9bb7a1 --- /dev/null +++ b/vendor/composer/autoload_files.php @@ -0,0 +1,31 @@ + $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', + '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', + '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', + 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', + 'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php', + '25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php', + '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', + '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', + '2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php', + 'cf97c57bfe0f23854afd2f3818abb7a0' => $vendorDir . '/zendframework/zend-diactoros/src/functions/create_uploaded_file.php', + '9bf37a3d0dad93e29cb4e1b1bfab04e9' => $vendorDir . '/zendframework/zend-diactoros/src/functions/marshal_headers_from_sapi.php', + 'ce70dccb4bcc2efc6e94d2ee526e6972' => $vendorDir . '/zendframework/zend-diactoros/src/functions/marshal_method_from_sapi.php', + 'f86420df471f14d568bfcb71e271b523' => $vendorDir . '/zendframework/zend-diactoros/src/functions/marshal_protocol_version_from_sapi.php', + 'b87481e008a3700344428ae089e7f9e5' => $vendorDir . '/zendframework/zend-diactoros/src/functions/marshal_uri_from_sapi.php', + '0b0974a5566a1077e4f2e111341112c1' => $vendorDir . '/zendframework/zend-diactoros/src/functions/normalize_server.php', + '1ca3bc274755662169f9629d5412a1da' => $vendorDir . '/zendframework/zend-diactoros/src/functions/normalize_uploaded_files.php', + '40360c0b9b437e69bcbb7f1349ce029e' => $vendorDir . '/zendframework/zend-diactoros/src/functions/parse_cookie_header.php', + '538ca81a9a966a6716601ecf48f4eaef' => $vendorDir . '/opis/closure/functions.php', + 'f0906e6318348a765ffb6eb24e0d0938' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/helpers.php', + '58571171fd5812e6e447dce228f52f4d' => $vendorDir . '/laravel/framework/src/Illuminate/Support/helpers.php', + '6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', + '377b22b161c09ed6e5152de788ca020a' => $vendorDir . '/spatie/laravel-permission/src/helpers.php', +); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php new file mode 100644 index 0000000..3655142 --- /dev/null +++ b/vendor/composer/autoload_namespaces.php @@ -0,0 +1,13 @@ + array($vendorDir . '/phpspec/prophecy/src'), + 'Parsedown' => array($vendorDir . '/erusev/parsedown'), + 'Mockery' => array($vendorDir . '/mockery/mockery/library'), + 'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib'), +); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php new file mode 100644 index 0000000..722e956 --- /dev/null +++ b/vendor/composer/autoload_psr4.php @@ -0,0 +1,62 @@ + array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/type-resolver/src', $vendorDir . '/phpdocumentor/reflection-docblock/src'), + 'Zend\\Diactoros\\' => array($vendorDir . '/zendframework/zend-diactoros/src'), + 'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'), + 'Vyuldashev\\NovaPermission\\' => array($vendorDir . '/vyuldashev/nova-permission/src'), + 'TijsVerkoyen\\CssToInlineStyles\\' => array($vendorDir . '/tijsverkoyen/css-to-inline-styles/src'), + 'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'), + 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), + 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), + 'Symfony\\Contracts\\' => array($vendorDir . '/symfony/contracts'), + 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), + 'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'), + 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), + 'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'), + 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'), + 'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'), + 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), + 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'), + 'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'), + 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'), + 'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'), + 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'), + 'Spatie\\Permission\\' => array($vendorDir . '/spatie/laravel-permission/src'), + 'RomegaDigital\\Multitenancy\\Tests\\' => array($baseDir . '/tests'), + 'RomegaDigital\\Multitenancy\\' => array($baseDir . '/src'), + 'Ramsey\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'), + 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), + 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), + 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), + 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), + 'Orchestra\\Testbench\\' => array($vendorDir . '/orchestra/testbench-core/src'), + 'Opis\\Closure\\' => array($vendorDir . '/opis/closure/src'), + 'Noodlehaus\\' => array($vendorDir . '/hassankhan/config/src'), + 'Nexmo\\' => array($vendorDir . '/nexmo/client/src'), + 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), + 'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'), + 'Lcobucci\\JWT\\' => array($vendorDir . '/lcobucci/jwt/src'), + 'Illuminate\\Notifications\\' => array($vendorDir . '/laravel/slack-notification-channel/src', $vendorDir . '/laravel/nexmo-notification-channel/src'), + 'Illuminate\\' => array($vendorDir . '/laravel/framework/src/Illuminate'), + 'Http\\Promise\\' => array($vendorDir . '/php-http/promise/src'), + 'Http\\Client\\' => array($vendorDir . '/php-http/httplug/src'), + 'Http\\Adapter\\Guzzle6\\' => array($vendorDir . '/php-http/guzzle6-adapter/src'), + 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), + 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), + 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), + 'Faker\\' => array($vendorDir . '/fzaninotto/faker/src/Faker'), + 'Egulias\\EmailValidator\\' => array($vendorDir . '/egulias/email-validator/EmailValidator'), + 'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'), + 'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'), + 'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Common/Inflector'), + 'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'), + 'Cron\\' => array($vendorDir . '/dragonmantank/cron-expression/src/Cron'), + 'Codedungeon\\PHPUnitPrettyResultPrinter\\' => array($vendorDir . '/codedungeon/phpunit-result-printer/src'), + '' => array($vendorDir . '/nesbot/carbon/src'), +); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php new file mode 100644 index 0000000..ff005d1 --- /dev/null +++ b/vendor/composer/autoload_real.php @@ -0,0 +1,70 @@ += 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require_once __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInitc2a3a9d6d115ed496617aaf7880d58ed::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->register(true); + + if ($useStaticLoader) { + $includeFiles = Composer\Autoload\ComposerStaticInitc2a3a9d6d115ed496617aaf7880d58ed::$files; + } else { + $includeFiles = require __DIR__ . '/autoload_files.php'; + } + foreach ($includeFiles as $fileIdentifier => $file) { + composerRequirec2a3a9d6d115ed496617aaf7880d58ed($fileIdentifier, $file); + } + + return $loader; + } +} + +function composerRequirec2a3a9d6d115ed496617aaf7880d58ed($fileIdentifier, $file) +{ + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + require $file; + + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + } +} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php new file mode 100644 index 0000000..637fac7 --- /dev/null +++ b/vendor/composer/autoload_static.php @@ -0,0 +1,1017 @@ + __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', + '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', + '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', + 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', + 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php', + '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php', + '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', + '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', + '2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php', + 'cf97c57bfe0f23854afd2f3818abb7a0' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/create_uploaded_file.php', + '9bf37a3d0dad93e29cb4e1b1bfab04e9' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/marshal_headers_from_sapi.php', + 'ce70dccb4bcc2efc6e94d2ee526e6972' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/marshal_method_from_sapi.php', + 'f86420df471f14d568bfcb71e271b523' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/marshal_protocol_version_from_sapi.php', + 'b87481e008a3700344428ae089e7f9e5' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/marshal_uri_from_sapi.php', + '0b0974a5566a1077e4f2e111341112c1' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/normalize_server.php', + '1ca3bc274755662169f9629d5412a1da' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/normalize_uploaded_files.php', + '40360c0b9b437e69bcbb7f1349ce029e' => __DIR__ . '/..' . '/zendframework/zend-diactoros/src/functions/parse_cookie_header.php', + '538ca81a9a966a6716601ecf48f4eaef' => __DIR__ . '/..' . '/opis/closure/functions.php', + 'f0906e6318348a765ffb6eb24e0d0938' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/helpers.php', + '58571171fd5812e6e447dce228f52f4d' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/helpers.php', + '6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', + '377b22b161c09ed6e5152de788ca020a' => __DIR__ . '/..' . '/spatie/laravel-permission/src/helpers.php', + ); + + public static $prefixLengthsPsr4 = array ( + 'p' => + array ( + 'phpDocumentor\\Reflection\\' => 25, + ), + 'Z' => + array ( + 'Zend\\Diactoros\\' => 15, + ), + 'W' => + array ( + 'Webmozart\\Assert\\' => 17, + ), + 'V' => + array ( + 'Vyuldashev\\NovaPermission\\' => 26, + ), + 'T' => + array ( + 'TijsVerkoyen\\CssToInlineStyles\\' => 31, + ), + 'S' => + array ( + 'Symfony\\Polyfill\\Php72\\' => 23, + 'Symfony\\Polyfill\\Mbstring\\' => 26, + 'Symfony\\Polyfill\\Ctype\\' => 23, + 'Symfony\\Contracts\\' => 18, + 'Symfony\\Component\\Yaml\\' => 23, + 'Symfony\\Component\\VarDumper\\' => 28, + 'Symfony\\Component\\Translation\\' => 30, + 'Symfony\\Component\\Routing\\' => 26, + 'Symfony\\Component\\Process\\' => 26, + 'Symfony\\Component\\HttpKernel\\' => 29, + 'Symfony\\Component\\HttpFoundation\\' => 33, + 'Symfony\\Component\\Finder\\' => 25, + 'Symfony\\Component\\EventDispatcher\\' => 34, + 'Symfony\\Component\\Debug\\' => 24, + 'Symfony\\Component\\CssSelector\\' => 30, + 'Symfony\\Component\\Console\\' => 26, + 'Spatie\\Permission\\' => 18, + ), + 'R' => + array ( + 'RomegaDigital\\Multitenancy\\Tests\\' => 33, + 'RomegaDigital\\Multitenancy\\' => 27, + 'Ramsey\\Uuid\\' => 12, + ), + 'P' => + array ( + 'Psr\\SimpleCache\\' => 16, + 'Psr\\Log\\' => 8, + 'Psr\\Http\\Message\\' => 17, + 'Psr\\Container\\' => 14, + ), + 'O' => + array ( + 'Orchestra\\Testbench\\' => 20, + 'Opis\\Closure\\' => 13, + ), + 'N' => + array ( + 'Noodlehaus\\' => 11, + 'Nexmo\\' => 6, + ), + 'M' => + array ( + 'Monolog\\' => 8, + ), + 'L' => + array ( + 'League\\Flysystem\\' => 17, + 'Lcobucci\\JWT\\' => 13, + ), + 'I' => + array ( + 'Illuminate\\Notifications\\' => 25, + 'Illuminate\\' => 11, + ), + 'H' => + array ( + 'Http\\Promise\\' => 13, + 'Http\\Client\\' => 12, + 'Http\\Adapter\\Guzzle6\\' => 21, + ), + 'G' => + array ( + 'GuzzleHttp\\Psr7\\' => 16, + 'GuzzleHttp\\Promise\\' => 19, + 'GuzzleHttp\\' => 11, + ), + 'F' => + array ( + 'Faker\\' => 6, + ), + 'E' => + array ( + 'Egulias\\EmailValidator\\' => 23, + ), + 'D' => + array ( + 'Dotenv\\' => 7, + 'Doctrine\\Instantiator\\' => 22, + 'Doctrine\\Common\\Inflector\\' => 26, + 'DeepCopy\\' => 9, + ), + 'C' => + array ( + 'Cron\\' => 5, + 'Codedungeon\\PHPUnitPrettyResultPrinter\\' => 39, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'phpDocumentor\\Reflection\\' => + array ( + 0 => __DIR__ . '/..' . '/phpdocumentor/reflection-common/src', + 1 => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src', + 2 => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src', + ), + 'Zend\\Diactoros\\' => + array ( + 0 => __DIR__ . '/..' . '/zendframework/zend-diactoros/src', + ), + 'Webmozart\\Assert\\' => + array ( + 0 => __DIR__ . '/..' . '/webmozart/assert/src', + ), + 'Vyuldashev\\NovaPermission\\' => + array ( + 0 => __DIR__ . '/..' . '/vyuldashev/nova-permission/src', + ), + 'TijsVerkoyen\\CssToInlineStyles\\' => + array ( + 0 => __DIR__ . '/..' . '/tijsverkoyen/css-to-inline-styles/src', + ), + 'Symfony\\Polyfill\\Php72\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php72', + ), + 'Symfony\\Polyfill\\Mbstring\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', + ), + 'Symfony\\Polyfill\\Ctype\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', + ), + 'Symfony\\Contracts\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/contracts', + ), + 'Symfony\\Component\\Yaml\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/yaml', + ), + 'Symfony\\Component\\VarDumper\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/var-dumper', + ), + 'Symfony\\Component\\Translation\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/translation', + ), + 'Symfony\\Component\\Routing\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/routing', + ), + 'Symfony\\Component\\Process\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/process', + ), + 'Symfony\\Component\\HttpKernel\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/http-kernel', + ), + 'Symfony\\Component\\HttpFoundation\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/http-foundation', + ), + 'Symfony\\Component\\Finder\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/finder', + ), + 'Symfony\\Component\\EventDispatcher\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/event-dispatcher', + ), + 'Symfony\\Component\\Debug\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/debug', + ), + 'Symfony\\Component\\CssSelector\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/css-selector', + ), + 'Symfony\\Component\\Console\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/console', + ), + 'Spatie\\Permission\\' => + array ( + 0 => __DIR__ . '/..' . '/spatie/laravel-permission/src', + ), + 'RomegaDigital\\Multitenancy\\Tests\\' => + array ( + 0 => __DIR__ . '/../..' . '/tests', + ), + 'RomegaDigital\\Multitenancy\\' => + array ( + 0 => __DIR__ . '/../..' . '/src', + ), + 'Ramsey\\Uuid\\' => + array ( + 0 => __DIR__ . '/..' . '/ramsey/uuid/src', + ), + 'Psr\\SimpleCache\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/simple-cache/src', + ), + 'Psr\\Log\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', + ), + 'Psr\\Http\\Message\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/http-message/src', + ), + 'Psr\\Container\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/container/src', + ), + 'Orchestra\\Testbench\\' => + array ( + 0 => __DIR__ . '/..' . '/orchestra/testbench-core/src', + ), + 'Opis\\Closure\\' => + array ( + 0 => __DIR__ . '/..' . '/opis/closure/src', + ), + 'Noodlehaus\\' => + array ( + 0 => __DIR__ . '/..' . '/hassankhan/config/src', + ), + 'Nexmo\\' => + array ( + 0 => __DIR__ . '/..' . '/nexmo/client/src', + ), + 'Monolog\\' => + array ( + 0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog', + ), + 'League\\Flysystem\\' => + array ( + 0 => __DIR__ . '/..' . '/league/flysystem/src', + ), + 'Lcobucci\\JWT\\' => + array ( + 0 => __DIR__ . '/..' . '/lcobucci/jwt/src', + ), + 'Illuminate\\Notifications\\' => + array ( + 0 => __DIR__ . '/..' . '/laravel/slack-notification-channel/src', + 1 => __DIR__ . '/..' . '/laravel/nexmo-notification-channel/src', + ), + 'Illuminate\\' => + array ( + 0 => __DIR__ . '/..' . '/laravel/framework/src/Illuminate', + ), + 'Http\\Promise\\' => + array ( + 0 => __DIR__ . '/..' . '/php-http/promise/src', + ), + 'Http\\Client\\' => + array ( + 0 => __DIR__ . '/..' . '/php-http/httplug/src', + ), + 'Http\\Adapter\\Guzzle6\\' => + array ( + 0 => __DIR__ . '/..' . '/php-http/guzzle6-adapter/src', + ), + 'GuzzleHttp\\Psr7\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', + ), + 'GuzzleHttp\\Promise\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/promises/src', + ), + 'GuzzleHttp\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src', + ), + 'Faker\\' => + array ( + 0 => __DIR__ . '/..' . '/fzaninotto/faker/src/Faker', + ), + 'Egulias\\EmailValidator\\' => + array ( + 0 => __DIR__ . '/..' . '/egulias/email-validator/EmailValidator', + ), + 'Dotenv\\' => + array ( + 0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src', + ), + 'Doctrine\\Instantiator\\' => + array ( + 0 => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator', + ), + 'Doctrine\\Common\\Inflector\\' => + array ( + 0 => __DIR__ . '/..' . '/doctrine/inflector/lib/Doctrine/Common/Inflector', + ), + 'DeepCopy\\' => + array ( + 0 => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy', + ), + 'Cron\\' => + array ( + 0 => __DIR__ . '/..' . '/dragonmantank/cron-expression/src/Cron', + ), + 'Codedungeon\\PHPUnitPrettyResultPrinter\\' => + array ( + 0 => __DIR__ . '/..' . '/codedungeon/phpunit-result-printer/src', + ), + ); + + public static $fallbackDirsPsr4 = array ( + 0 => __DIR__ . '/..' . '/nesbot/carbon/src', + ); + + public static $prefixesPsr0 = array ( + 'P' => + array ( + 'Prophecy\\' => + array ( + 0 => __DIR__ . '/..' . '/phpspec/prophecy/src', + ), + 'Parsedown' => + array ( + 0 => __DIR__ . '/..' . '/erusev/parsedown', + ), + ), + 'M' => + array ( + 'Mockery' => + array ( + 0 => __DIR__ . '/..' . '/mockery/mockery/library', + ), + ), + 'D' => + array ( + 'Doctrine\\Common\\Lexer\\' => + array ( + 0 => __DIR__ . '/..' . '/doctrine/lexer/lib', + ), + ), + ); + + public static $classMap = array ( + 'Hamcrest\\Arrays\\IsArray' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArray.php', + 'Hamcrest\\Arrays\\IsArrayContaining' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContaining.php', + 'Hamcrest\\Arrays\\IsArrayContainingInAnyOrder' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php', + 'Hamcrest\\Arrays\\IsArrayContainingInOrder' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInOrder.php', + 'Hamcrest\\Arrays\\IsArrayContainingKey' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKey.php', + 'Hamcrest\\Arrays\\IsArrayContainingKeyValuePair' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKeyValuePair.php', + 'Hamcrest\\Arrays\\IsArrayWithSize' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayWithSize.php', + 'Hamcrest\\Arrays\\MatchingOnce' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/MatchingOnce.php', + 'Hamcrest\\Arrays\\SeriesMatchingOnce' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php', + 'Hamcrest\\AssertionError' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/AssertionError.php', + 'Hamcrest\\BaseDescription' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseDescription.php', + 'Hamcrest\\BaseMatcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseMatcher.php', + 'Hamcrest\\Collection\\IsEmptyTraversable' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsEmptyTraversable.php', + 'Hamcrest\\Collection\\IsTraversableWithSize' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsTraversableWithSize.php', + 'Hamcrest\\Core\\AllOf' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AllOf.php', + 'Hamcrest\\Core\\AnyOf' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AnyOf.php', + 'Hamcrest\\Core\\CombinableMatcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/CombinableMatcher.php', + 'Hamcrest\\Core\\DescribedAs' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/DescribedAs.php', + 'Hamcrest\\Core\\Every' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Every.php', + 'Hamcrest\\Core\\HasToString' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/HasToString.php', + 'Hamcrest\\Core\\Is' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Is.php', + 'Hamcrest\\Core\\IsAnything' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsAnything.php', + 'Hamcrest\\Core\\IsCollectionContaining' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsCollectionContaining.php', + 'Hamcrest\\Core\\IsEqual' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsEqual.php', + 'Hamcrest\\Core\\IsIdentical' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsIdentical.php', + 'Hamcrest\\Core\\IsInstanceOf' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsInstanceOf.php', + 'Hamcrest\\Core\\IsNot' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNot.php', + 'Hamcrest\\Core\\IsNull' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNull.php', + 'Hamcrest\\Core\\IsSame' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsSame.php', + 'Hamcrest\\Core\\IsTypeOf' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsTypeOf.php', + 'Hamcrest\\Core\\Set' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Set.php', + 'Hamcrest\\Core\\ShortcutCombination' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/ShortcutCombination.php', + 'Hamcrest\\Description' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Description.php', + 'Hamcrest\\DiagnosingMatcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/DiagnosingMatcher.php', + 'Hamcrest\\FeatureMatcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/FeatureMatcher.php', + 'Hamcrest\\Internal\\SelfDescribingValue' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Internal/SelfDescribingValue.php', + 'Hamcrest\\Matcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matcher.php', + 'Hamcrest\\MatcherAssert' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/MatcherAssert.php', + 'Hamcrest\\Matchers' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matchers.php', + 'Hamcrest\\NullDescription' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/NullDescription.php', + 'Hamcrest\\Number\\IsCloseTo' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/IsCloseTo.php', + 'Hamcrest\\Number\\OrderingComparison' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/OrderingComparison.php', + 'Hamcrest\\SelfDescribing' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/SelfDescribing.php', + 'Hamcrest\\StringDescription' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/StringDescription.php', + 'Hamcrest\\Text\\IsEmptyString' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEmptyString.php', + 'Hamcrest\\Text\\IsEqualIgnoringCase' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php', + 'Hamcrest\\Text\\IsEqualIgnoringWhiteSpace' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php', + 'Hamcrest\\Text\\MatchesPattern' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/MatchesPattern.php', + 'Hamcrest\\Text\\StringContains' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContains.php', + 'Hamcrest\\Text\\StringContainsIgnoringCase' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php', + 'Hamcrest\\Text\\StringContainsInOrder' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsInOrder.php', + 'Hamcrest\\Text\\StringEndsWith' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringEndsWith.php', + 'Hamcrest\\Text\\StringStartsWith' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringStartsWith.php', + 'Hamcrest\\Text\\SubstringMatcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/SubstringMatcher.php', + 'Hamcrest\\TypeSafeDiagnosingMatcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeDiagnosingMatcher.php', + 'Hamcrest\\TypeSafeMatcher' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeMatcher.php', + 'Hamcrest\\Type\\IsArray' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsArray.php', + 'Hamcrest\\Type\\IsBoolean' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsBoolean.php', + 'Hamcrest\\Type\\IsCallable' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsCallable.php', + 'Hamcrest\\Type\\IsDouble' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsDouble.php', + 'Hamcrest\\Type\\IsInteger' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsInteger.php', + 'Hamcrest\\Type\\IsNumeric' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsNumeric.php', + 'Hamcrest\\Type\\IsObject' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsObject.php', + 'Hamcrest\\Type\\IsResource' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsResource.php', + 'Hamcrest\\Type\\IsScalar' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsScalar.php', + 'Hamcrest\\Type\\IsString' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsString.php', + 'Hamcrest\\Util' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Util.php', + 'Hamcrest\\Xml\\HasXPath' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml/HasXPath.php', + 'PHPUnit\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Exception.php', + 'PHPUnit\\Framework\\Assert' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Assert.php', + 'PHPUnit\\Framework\\AssertionFailedError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/AssertionFailedError.php', + 'PHPUnit\\Framework\\CodeCoverageException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/CodeCoverageException.php', + 'PHPUnit\\Framework\\Constraint\\ArrayHasKey' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ArrayHasKey.php', + 'PHPUnit\\Framework\\Constraint\\ArraySubset' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ArraySubset.php', + 'PHPUnit\\Framework\\Constraint\\Attribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Attribute.php', + 'PHPUnit\\Framework\\Constraint\\Callback' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Callback.php', + 'PHPUnit\\Framework\\Constraint\\ClassHasAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ClassHasAttribute.php', + 'PHPUnit\\Framework\\Constraint\\ClassHasStaticAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ClassHasStaticAttribute.php', + 'PHPUnit\\Framework\\Constraint\\Composite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Composite.php', + 'PHPUnit\\Framework\\Constraint\\Constraint' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Constraint.php', + 'PHPUnit\\Framework\\Constraint\\Count' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Count.php', + 'PHPUnit\\Framework\\Constraint\\DirectoryExists' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/DirectoryExists.php', + 'PHPUnit\\Framework\\Constraint\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/Exception.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionCode' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ExceptionCode.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessage' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ExceptionMessage.php', + 'PHPUnit\\Framework\\Constraint\\ExceptionMessageRegularExpression' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ExceptionMessageRegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\FileExists' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/FileExists.php', + 'PHPUnit\\Framework\\Constraint\\GreaterThan' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/GreaterThan.php', + 'PHPUnit\\Framework\\Constraint\\IsAnything' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsAnything.php', + 'PHPUnit\\Framework\\Constraint\\IsEmpty' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsEmpty.php', + 'PHPUnit\\Framework\\Constraint\\IsEqual' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsEqual.php', + 'PHPUnit\\Framework\\Constraint\\IsFalse' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsFalse.php', + 'PHPUnit\\Framework\\Constraint\\IsFinite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsFinite.php', + 'PHPUnit\\Framework\\Constraint\\IsIdentical' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsIdentical.php', + 'PHPUnit\\Framework\\Constraint\\IsInfinite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsInfinite.php', + 'PHPUnit\\Framework\\Constraint\\IsInstanceOf' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsInstanceOf.php', + 'PHPUnit\\Framework\\Constraint\\IsJson' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsJson.php', + 'PHPUnit\\Framework\\Constraint\\IsNan' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsNan.php', + 'PHPUnit\\Framework\\Constraint\\IsNull' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsNull.php', + 'PHPUnit\\Framework\\Constraint\\IsReadable' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsReadable.php', + 'PHPUnit\\Framework\\Constraint\\IsTrue' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsTrue.php', + 'PHPUnit\\Framework\\Constraint\\IsType' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsType.php', + 'PHPUnit\\Framework\\Constraint\\IsWritable' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/IsWritable.php', + 'PHPUnit\\Framework\\Constraint\\JsonMatches' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/JsonMatches.php', + 'PHPUnit\\Framework\\Constraint\\JsonMatchesErrorMessageProvider' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/JsonMatchesErrorMessageProvider.php', + 'PHPUnit\\Framework\\Constraint\\LessThan' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/LessThan.php', + 'PHPUnit\\Framework\\Constraint\\LogicalAnd' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/LogicalAnd.php', + 'PHPUnit\\Framework\\Constraint\\LogicalNot' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/LogicalNot.php', + 'PHPUnit\\Framework\\Constraint\\LogicalOr' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/LogicalOr.php', + 'PHPUnit\\Framework\\Constraint\\LogicalXor' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/LogicalXor.php', + 'PHPUnit\\Framework\\Constraint\\ObjectHasAttribute' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/ObjectHasAttribute.php', + 'PHPUnit\\Framework\\Constraint\\RegularExpression' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/RegularExpression.php', + 'PHPUnit\\Framework\\Constraint\\SameSize' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/SameSize.php', + 'PHPUnit\\Framework\\Constraint\\StringContains' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/StringContains.php', + 'PHPUnit\\Framework\\Constraint\\StringEndsWith' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/StringEndsWith.php', + 'PHPUnit\\Framework\\Constraint\\StringMatchesFormatDescription' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/StringMatchesFormatDescription.php', + 'PHPUnit\\Framework\\Constraint\\StringStartsWith' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/StringStartsWith.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContains' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/TraversableContains.php', + 'PHPUnit\\Framework\\Constraint\\TraversableContainsOnly' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Constraint/TraversableContainsOnly.php', + 'PHPUnit\\Framework\\CoveredCodeNotExecutedException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/CoveredCodeNotExecutedException.php', + 'PHPUnit\\Framework\\DataProviderTestSuite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/DataProviderTestSuite.php', + 'PHPUnit\\Framework\\Error\\Deprecated' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Error/Deprecated.php', + 'PHPUnit\\Framework\\Error\\Error' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Error/Error.php', + 'PHPUnit\\Framework\\Error\\Notice' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Error/Notice.php', + 'PHPUnit\\Framework\\Error\\Warning' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Error/Warning.php', + 'PHPUnit\\Framework\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception.php', + 'PHPUnit\\Framework\\ExceptionWrapper' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/ExceptionWrapper.php', + 'PHPUnit\\Framework\\ExpectationFailedException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/ExpectationFailedException.php', + 'PHPUnit\\Framework\\IncompleteTest' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/IncompleteTest.php', + 'PHPUnit\\Framework\\IncompleteTestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/IncompleteTestCase.php', + 'PHPUnit\\Framework\\IncompleteTestError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/IncompleteTestError.php', + 'PHPUnit\\Framework\\InvalidCoversTargetException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/InvalidCoversTargetException.php', + 'PHPUnit\\Framework\\MissingCoversAnnotationException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MissingCoversAnnotationException.php', + 'PHPUnit\\Framework\\MockObject\\BadMethodCallException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/BadMethodCallException.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Identity' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Builder/Identity.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\InvocationMocker' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationMocker.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Match' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Builder/Match.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\MethodNameMatch' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Builder/MethodNameMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\NamespaceMatch' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Builder/NamespaceMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\ParametersMatch' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php', + 'PHPUnit\\Framework\\MockObject\\Builder\\Stub' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Builder/Stub.php', + 'PHPUnit\\Framework\\MockObject\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Generator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Generator.php', + 'PHPUnit\\Framework\\MockObject\\Invocation' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Invocation/Invocation.php', + 'PHPUnit\\Framework\\MockObject\\InvocationMocker' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/InvocationMocker.php', + 'PHPUnit\\Framework\\MockObject\\Invocation\\ObjectInvocation' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Invocation/ObjectInvocation.php', + 'PHPUnit\\Framework\\MockObject\\Invocation\\StaticInvocation' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Invocation/StaticInvocation.php', + 'PHPUnit\\Framework\\MockObject\\Invokable' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Invokable.php', + 'PHPUnit\\Framework\\MockObject\\Matcher' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\AnyInvokedCount' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher/AnyInvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\AnyParameters' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher/AnyParameters.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\ConsecutiveParameters' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher/ConsecutiveParameters.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\DeferredError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher/DeferredError.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\Invocation' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher/Invocation.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtIndex' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtIndex.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtLeastCount' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtLeastCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtLeastOnce' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtLeastOnce.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedAtMostCount' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtMostCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedCount' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedCount.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\InvokedRecorder' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedRecorder.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\MethodName' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher/MethodName.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\Parameters' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher/Parameters.php', + 'PHPUnit\\Framework\\MockObject\\Matcher\\StatelessInvocation' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Matcher/StatelessInvocation.php', + 'PHPUnit\\Framework\\MockObject\\MockBuilder' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php', + 'PHPUnit\\Framework\\MockObject\\MockMethod' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/MockMethod.php', + 'PHPUnit\\Framework\\MockObject\\MockMethodSet' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/MockMethodSet.php', + 'PHPUnit\\Framework\\MockObject\\MockObject' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/ForwardCompatibility/MockObject.php', + 'PHPUnit\\Framework\\MockObject\\RuntimeException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Exception/RuntimeException.php', + 'PHPUnit\\Framework\\MockObject\\Stub' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ConsecutiveCalls' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/ConsecutiveCalls.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/Exception.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\MatcherCollection' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/MatcherCollection.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnArgument' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnArgument.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnCallback' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnCallback.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnReference' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnReference.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnSelf' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnSelf.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnStub' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnStub.php', + 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnValueMap' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnValueMap.php', + 'PHPUnit\\Framework\\MockObject\\Verifiable' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Verifiable.php', + 'PHPUnit\\Framework\\OutputError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/OutputError.php', + 'PHPUnit\\Framework\\RiskyTest' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/RiskyTest.php', + 'PHPUnit\\Framework\\RiskyTestError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/RiskyTestError.php', + 'PHPUnit\\Framework\\SelfDescribing' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SelfDescribing.php', + 'PHPUnit\\Framework\\SkippedTest' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SkippedTest.php', + 'PHPUnit\\Framework\\SkippedTestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SkippedTestCase.php', + 'PHPUnit\\Framework\\SkippedTestError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SkippedTestError.php', + 'PHPUnit\\Framework\\SkippedTestSuiteError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SkippedTestSuiteError.php', + 'PHPUnit\\Framework\\SyntheticError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SyntheticError.php', + 'PHPUnit\\Framework\\Test' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Test.php', + 'PHPUnit\\Framework\\TestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestCase.php', + 'PHPUnit\\Framework\\TestFailure' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestFailure.php', + 'PHPUnit\\Framework\\TestListener' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestListener.php', + 'PHPUnit\\Framework\\TestListenerDefaultImplementation' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestListenerDefaultImplementation.php', + 'PHPUnit\\Framework\\TestResult' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestResult.php', + 'PHPUnit\\Framework\\TestSuite' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestSuite.php', + 'PHPUnit\\Framework\\TestSuiteIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/TestSuiteIterator.php', + 'PHPUnit\\Framework\\UnintentionallyCoveredCodeError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/UnintentionallyCoveredCodeError.php', + 'PHPUnit\\Framework\\Warning' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Warning.php', + 'PHPUnit\\Framework\\WarningTestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/WarningTestCase.php', + 'PHPUnit\\Runner\\AfterIncompleteTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterIncompleteTestHook.php', + 'PHPUnit\\Runner\\AfterLastTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterLastTestHook.php', + 'PHPUnit\\Runner\\AfterRiskyTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterRiskyTestHook.php', + 'PHPUnit\\Runner\\AfterSkippedTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterSkippedTestHook.php', + 'PHPUnit\\Runner\\AfterSuccessfulTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterSuccessfulTestHook.php', + 'PHPUnit\\Runner\\AfterTestErrorHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterTestErrorHook.php', + 'PHPUnit\\Runner\\AfterTestFailureHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterTestFailureHook.php', + 'PHPUnit\\Runner\\AfterTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterTestHook.php', + 'PHPUnit\\Runner\\AfterTestWarningHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/AfterTestWarningHook.php', + 'PHPUnit\\Runner\\BaseTestRunner' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/BaseTestRunner.php', + 'PHPUnit\\Runner\\BeforeFirstTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/BeforeFirstTestHook.php', + 'PHPUnit\\Runner\\BeforeTestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/BeforeTestHook.php', + 'PHPUnit\\Runner\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Exception.php', + 'PHPUnit\\Runner\\Filter\\ExcludeGroupFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/ExcludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\Factory' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/Factory.php', + 'PHPUnit\\Runner\\Filter\\GroupFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/GroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\IncludeGroupFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/IncludeGroupFilterIterator.php', + 'PHPUnit\\Runner\\Filter\\NameFilterIterator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Filter/NameFilterIterator.php', + 'PHPUnit\\Runner\\Hook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/Hook.php', + 'PHPUnit\\Runner\\NullTestResultCache' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/NullTestResultCache.php', + 'PHPUnit\\Runner\\PhptTestCase' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/PhptTestCase.php', + 'PHPUnit\\Runner\\ResultCacheExtension' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/ResultCacheExtension.php', + 'PHPUnit\\Runner\\StandardTestSuiteLoader' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php', + 'PHPUnit\\Runner\\TestHook' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/TestHook.php', + 'PHPUnit\\Runner\\TestListenerAdapter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Hook/TestListenerAdapter.php', + 'PHPUnit\\Runner\\TestResultCache' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestResultCache.php', + 'PHPUnit\\Runner\\TestResultCacheInterface' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestResultCacheInterface.php', + 'PHPUnit\\Runner\\TestSuiteLoader' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestSuiteLoader.php', + 'PHPUnit\\Runner\\TestSuiteSorter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/TestSuiteSorter.php', + 'PHPUnit\\Runner\\Version' => __DIR__ . '/..' . '/phpunit/phpunit/src/Runner/Version.php', + 'PHPUnit\\TextUI\\Command' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/Command.php', + 'PHPUnit\\TextUI\\ResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/ResultPrinter.php', + 'PHPUnit\\TextUI\\TestRunner' => __DIR__ . '/..' . '/phpunit/phpunit/src/TextUI/TestRunner.php', + 'PHPUnit\\Util\\Blacklist' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Blacklist.php', + 'PHPUnit\\Util\\Configuration' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Configuration.php', + 'PHPUnit\\Util\\ConfigurationGenerator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/ConfigurationGenerator.php', + 'PHPUnit\\Util\\ErrorHandler' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/ErrorHandler.php', + 'PHPUnit\\Util\\FileLoader' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/FileLoader.php', + 'PHPUnit\\Util\\Filesystem' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Filesystem.php', + 'PHPUnit\\Util\\Filter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Filter.php', + 'PHPUnit\\Util\\Getopt' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Getopt.php', + 'PHPUnit\\Util\\GlobalState' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/GlobalState.php', + 'PHPUnit\\Util\\InvalidArgumentHelper' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/InvalidArgumentHelper.php', + 'PHPUnit\\Util\\Json' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Json.php', + 'PHPUnit\\Util\\Log\\JUnit' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Log/JUnit.php', + 'PHPUnit\\Util\\Log\\TeamCity' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Log/TeamCity.php', + 'PHPUnit\\Util\\PHP\\AbstractPhpProcess' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php', + 'PHPUnit\\Util\\PHP\\DefaultPhpProcess' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/PHP/DefaultPhpProcess.php', + 'PHPUnit\\Util\\PHP\\WindowsPhpProcess' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/PHP/WindowsPhpProcess.php', + 'PHPUnit\\Util\\Printer' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Printer.php', + 'PHPUnit\\Util\\RegularExpression' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/RegularExpression.php', + 'PHPUnit\\Util\\Test' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Test.php', + 'PHPUnit\\Util\\TestDox\\CliTestDoxPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/CliTestDoxPrinter.php', + 'PHPUnit\\Util\\TestDox\\HtmlResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/HtmlResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\NamePrettifier' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/NamePrettifier.php', + 'PHPUnit\\Util\\TestDox\\ResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/ResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\TestResult' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/TestResult.php', + 'PHPUnit\\Util\\TestDox\\TextResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/TextResultPrinter.php', + 'PHPUnit\\Util\\TestDox\\XmlResultPrinter' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TestDox/XmlResultPrinter.php', + 'PHPUnit\\Util\\TextTestListRenderer' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/TextTestListRenderer.php', + 'PHPUnit\\Util\\Type' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Type.php', + 'PHPUnit\\Util\\XdebugFilterScriptGenerator' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/XdebugFilterScriptGenerator.php', + 'PHPUnit\\Util\\Xml' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/Xml.php', + 'PHPUnit\\Util\\XmlTestListRenderer' => __DIR__ . '/..' . '/phpunit/phpunit/src/Util/XmlTestListRenderer.php', + 'PHPUnit_Framework_MockObject_MockObject' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/MockObject.php', + 'PHP_Token' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_TokenWithScope' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_TokenWithScopeAndVisibility' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ABSTRACT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AMPERSAND' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AND_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ARRAY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ARRAY_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_AT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BACKTICK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BAD_CHARACTER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BOOLEAN_AND' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BOOLEAN_OR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BOOL_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_BREAK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CALLABLE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CARET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CASE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CATCH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CHARACTER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLASS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLASS_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLASS_NAME_CONSTANT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLONE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_BRACKET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_CURLY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_SQUARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CLOSE_TAG' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COALESCE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COLON' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COMMA' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_COMMENT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONCAT_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONSTANT_ENCAPSED_STRING' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CONTINUE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_CURLY_OPEN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DEC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DECLARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DEFAULT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DIR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DIV' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DIV_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DNUMBER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOC_COMMENT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOLLAR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOLLAR_OPEN_CURLY_BRACES' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_ARROW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_COLON' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_DOUBLE_QUOTES' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ECHO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ELLIPSIS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ELSE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ELSEIF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EMPTY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENCAPSED_AND_WHITESPACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDDECLARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDFOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDFOREACH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDIF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDSWITCH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ENDWHILE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_END_HEREDOC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EVAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EXCLAMATION_MARK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EXIT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_EXTENDS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FILE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FINAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FINALLY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FOREACH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FUNCTION' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_FUNC_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_GLOBAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_GOTO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_GT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_HALT_COMPILER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IMPLEMENTS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INCLUDE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INCLUDE_ONCE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INLINE_HTML' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INSTANCEOF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INSTEADOF' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INTERFACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_INT_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_ISSET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_GREATER_OR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_IDENTICAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_NOT_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_NOT_IDENTICAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_IS_SMALLER_OR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_Includes' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LINE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LIST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LNUMBER' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LOGICAL_AND' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LOGICAL_OR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LOGICAL_XOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_LT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_METHOD_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MINUS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MINUS_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MOD_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MULT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_MUL_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NAMESPACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NEW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NS_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NS_SEPARATOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_NUM_STRING' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OBJECT_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OBJECT_OPERATOR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_BRACKET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_CURLY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_SQUARE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_TAG' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OPEN_TAG_WITH_ECHO' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_OR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PAAMAYIM_NEKUDOTAYIM' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PERCENT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PIPE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PLUS' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PLUS_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_POW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_POW_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PRINT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PRIVATE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PROTECTED' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_PUBLIC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_QUESTION_MARK' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_REQUIRE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_REQUIRE_ONCE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_RETURN' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SEMICOLON' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SL_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SPACESHIP' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_START_HEREDOC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STATIC' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STRING' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STRING_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_STRING_VARNAME' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_SWITCH' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_Stream' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token/Stream.php', + 'PHP_Token_Stream_CachingFactory' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php', + 'PHP_Token_THROW' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TILDE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TRAIT' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TRAIT_C' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_TRY' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_UNSET' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_UNSET_CAST' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_USE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_USE_FUNCTION' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_VAR' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_VARIABLE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_WHILE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_WHITESPACE' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_XOR_EQUAL' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_YIELD' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PHP_Token_YIELD_FROM' => __DIR__ . '/..' . '/phpunit/php-token-stream/src/Token.php', + 'PharIo\\Manifest\\Application' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Application.php', + 'PharIo\\Manifest\\ApplicationName' => __DIR__ . '/..' . '/phar-io/manifest/src/values/ApplicationName.php', + 'PharIo\\Manifest\\Author' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Author.php', + 'PharIo\\Manifest\\AuthorCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/values/AuthorCollection.php', + 'PharIo\\Manifest\\AuthorCollectionIterator' => __DIR__ . '/..' . '/phar-io/manifest/src/values/AuthorCollectionIterator.php', + 'PharIo\\Manifest\\AuthorElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/AuthorElement.php', + 'PharIo\\Manifest\\AuthorElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/AuthorElementCollection.php', + 'PharIo\\Manifest\\BundledComponent' => __DIR__ . '/..' . '/phar-io/manifest/src/values/BundledComponent.php', + 'PharIo\\Manifest\\BundledComponentCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/values/BundledComponentCollection.php', + 'PharIo\\Manifest\\BundledComponentCollectionIterator' => __DIR__ . '/..' . '/phar-io/manifest/src/values/BundledComponentCollectionIterator.php', + 'PharIo\\Manifest\\BundlesElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/BundlesElement.php', + 'PharIo\\Manifest\\ComponentElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ComponentElement.php', + 'PharIo\\Manifest\\ComponentElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ComponentElementCollection.php', + 'PharIo\\Manifest\\ContainsElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ContainsElement.php', + 'PharIo\\Manifest\\CopyrightElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/CopyrightElement.php', + 'PharIo\\Manifest\\CopyrightInformation' => __DIR__ . '/..' . '/phar-io/manifest/src/values/CopyrightInformation.php', + 'PharIo\\Manifest\\ElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ElementCollection.php', + 'PharIo\\Manifest\\Email' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Email.php', + 'PharIo\\Manifest\\Exception' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/Exception.php', + 'PharIo\\Manifest\\ExtElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ExtElement.php', + 'PharIo\\Manifest\\ExtElementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ExtElementCollection.php', + 'PharIo\\Manifest\\Extension' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Extension.php', + 'PharIo\\Manifest\\ExtensionElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ExtensionElement.php', + 'PharIo\\Manifest\\InvalidApplicationNameException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php', + 'PharIo\\Manifest\\InvalidEmailException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/InvalidEmailException.php', + 'PharIo\\Manifest\\InvalidUrlException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/InvalidUrlException.php', + 'PharIo\\Manifest\\Library' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Library.php', + 'PharIo\\Manifest\\License' => __DIR__ . '/..' . '/phar-io/manifest/src/values/License.php', + 'PharIo\\Manifest\\LicenseElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/LicenseElement.php', + 'PharIo\\Manifest\\Manifest' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Manifest.php', + 'PharIo\\Manifest\\ManifestDocument' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ManifestDocument.php', + 'PharIo\\Manifest\\ManifestDocumentException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestDocumentException.php', + 'PharIo\\Manifest\\ManifestDocumentLoadingException' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ManifestDocumentLoadingException.php', + 'PharIo\\Manifest\\ManifestDocumentMapper' => __DIR__ . '/..' . '/phar-io/manifest/src/ManifestDocumentMapper.php', + 'PharIo\\Manifest\\ManifestDocumentMapperException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestDocumentMapperException.php', + 'PharIo\\Manifest\\ManifestElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/ManifestElement.php', + 'PharIo\\Manifest\\ManifestElementException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestElementException.php', + 'PharIo\\Manifest\\ManifestLoader' => __DIR__ . '/..' . '/phar-io/manifest/src/ManifestLoader.php', + 'PharIo\\Manifest\\ManifestLoaderException' => __DIR__ . '/..' . '/phar-io/manifest/src/exceptions/ManifestLoaderException.php', + 'PharIo\\Manifest\\ManifestSerializer' => __DIR__ . '/..' . '/phar-io/manifest/src/ManifestSerializer.php', + 'PharIo\\Manifest\\PhpElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/PhpElement.php', + 'PharIo\\Manifest\\PhpExtensionRequirement' => __DIR__ . '/..' . '/phar-io/manifest/src/values/PhpExtensionRequirement.php', + 'PharIo\\Manifest\\PhpVersionRequirement' => __DIR__ . '/..' . '/phar-io/manifest/src/values/PhpVersionRequirement.php', + 'PharIo\\Manifest\\Requirement' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Requirement.php', + 'PharIo\\Manifest\\RequirementCollection' => __DIR__ . '/..' . '/phar-io/manifest/src/values/RequirementCollection.php', + 'PharIo\\Manifest\\RequirementCollectionIterator' => __DIR__ . '/..' . '/phar-io/manifest/src/values/RequirementCollectionIterator.php', + 'PharIo\\Manifest\\RequiresElement' => __DIR__ . '/..' . '/phar-io/manifest/src/xml/RequiresElement.php', + 'PharIo\\Manifest\\Type' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Type.php', + 'PharIo\\Manifest\\Url' => __DIR__ . '/..' . '/phar-io/manifest/src/values/Url.php', + 'PharIo\\Version\\AbstractVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/AbstractVersionConstraint.php', + 'PharIo\\Version\\AndVersionConstraintGroup' => __DIR__ . '/..' . '/phar-io/version/src/constraints/AndVersionConstraintGroup.php', + 'PharIo\\Version\\AnyVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/AnyVersionConstraint.php', + 'PharIo\\Version\\ExactVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/ExactVersionConstraint.php', + 'PharIo\\Version\\Exception' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/Exception.php', + 'PharIo\\Version\\GreaterThanOrEqualToVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php', + 'PharIo\\Version\\InvalidPreReleaseSuffixException' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php', + 'PharIo\\Version\\InvalidVersionException' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/InvalidVersionException.php', + 'PharIo\\Version\\OrVersionConstraintGroup' => __DIR__ . '/..' . '/phar-io/version/src/constraints/OrVersionConstraintGroup.php', + 'PharIo\\Version\\PreReleaseSuffix' => __DIR__ . '/..' . '/phar-io/version/src/PreReleaseSuffix.php', + 'PharIo\\Version\\SpecificMajorAndMinorVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php', + 'PharIo\\Version\\SpecificMajorVersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php', + 'PharIo\\Version\\UnsupportedVersionConstraintException' => __DIR__ . '/..' . '/phar-io/version/src/exceptions/UnsupportedVersionConstraintException.php', + 'PharIo\\Version\\Version' => __DIR__ . '/..' . '/phar-io/version/src/Version.php', + 'PharIo\\Version\\VersionConstraint' => __DIR__ . '/..' . '/phar-io/version/src/constraints/VersionConstraint.php', + 'PharIo\\Version\\VersionConstraintParser' => __DIR__ . '/..' . '/phar-io/version/src/VersionConstraintParser.php', + 'PharIo\\Version\\VersionConstraintValue' => __DIR__ . '/..' . '/phar-io/version/src/VersionConstraintValue.php', + 'PharIo\\Version\\VersionNumber' => __DIR__ . '/..' . '/phar-io/version/src/VersionNumber.php', + 'SebastianBergmann\\CodeCoverage\\CodeCoverage' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/CodeCoverage.php', + 'SebastianBergmann\\CodeCoverage\\CoveredCodeNotExecutedException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/CoveredCodeNotExecutedException.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Driver' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/Driver.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\PHPDBG' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/PHPDBG.php', + 'SebastianBergmann\\CodeCoverage\\Driver\\Xdebug' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/Xdebug.php', + 'SebastianBergmann\\CodeCoverage\\Exception' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/Exception.php', + 'SebastianBergmann\\CodeCoverage\\Filter' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Filter.php', + 'SebastianBergmann\\CodeCoverage\\InvalidArgumentException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\CodeCoverage\\MissingCoversAnnotationException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/MissingCoversAnnotationException.php', + 'SebastianBergmann\\CodeCoverage\\Node\\AbstractNode' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/AbstractNode.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Builder' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/Builder.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Directory' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Node\\File' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/File.php', + 'SebastianBergmann\\CodeCoverage\\Node\\Iterator' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/Iterator.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Clover' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Clover.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Crap4j' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Crap4j.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Dashboard' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Directory' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Facade' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\File' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Html\\Renderer' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer.php', + 'SebastianBergmann\\CodeCoverage\\Report\\PHP' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/PHP.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Text' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Text.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\BuildInformation' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/BuildInformation.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Coverage' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Coverage.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Directory' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Directory.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Facade' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Facade.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\File' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/File.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Method' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Method.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Node' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Node.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Project' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Project.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Report' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Report.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Source' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Source.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Tests' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Tests.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Totals' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Totals.php', + 'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Unit' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Unit.php', + 'SebastianBergmann\\CodeCoverage\\RuntimeException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/RuntimeException.php', + 'SebastianBergmann\\CodeCoverage\\UnintentionallyCoveredCodeException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php', + 'SebastianBergmann\\CodeCoverage\\Util' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Util.php', + 'SebastianBergmann\\CodeCoverage\\Version' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Version.php', + 'SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => __DIR__ . '/..' . '/sebastian/code-unit-reverse-lookup/src/Wizard.php', + 'SebastianBergmann\\Comparator\\ArrayComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ArrayComparator.php', + 'SebastianBergmann\\Comparator\\Comparator' => __DIR__ . '/..' . '/sebastian/comparator/src/Comparator.php', + 'SebastianBergmann\\Comparator\\ComparisonFailure' => __DIR__ . '/..' . '/sebastian/comparator/src/ComparisonFailure.php', + 'SebastianBergmann\\Comparator\\DOMNodeComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/DOMNodeComparator.php', + 'SebastianBergmann\\Comparator\\DateTimeComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/DateTimeComparator.php', + 'SebastianBergmann\\Comparator\\DoubleComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/DoubleComparator.php', + 'SebastianBergmann\\Comparator\\ExceptionComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ExceptionComparator.php', + 'SebastianBergmann\\Comparator\\Factory' => __DIR__ . '/..' . '/sebastian/comparator/src/Factory.php', + 'SebastianBergmann\\Comparator\\MockObjectComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/MockObjectComparator.php', + 'SebastianBergmann\\Comparator\\NumericComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/NumericComparator.php', + 'SebastianBergmann\\Comparator\\ObjectComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ObjectComparator.php', + 'SebastianBergmann\\Comparator\\ResourceComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ResourceComparator.php', + 'SebastianBergmann\\Comparator\\ScalarComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/ScalarComparator.php', + 'SebastianBergmann\\Comparator\\SplObjectStorageComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/SplObjectStorageComparator.php', + 'SebastianBergmann\\Comparator\\TypeComparator' => __DIR__ . '/..' . '/sebastian/comparator/src/TypeComparator.php', + 'SebastianBergmann\\Diff\\Chunk' => __DIR__ . '/..' . '/sebastian/diff/src/Chunk.php', + 'SebastianBergmann\\Diff\\ConfigurationException' => __DIR__ . '/..' . '/sebastian/diff/src/Exception/ConfigurationException.php', + 'SebastianBergmann\\Diff\\Diff' => __DIR__ . '/..' . '/sebastian/diff/src/Diff.php', + 'SebastianBergmann\\Diff\\Differ' => __DIR__ . '/..' . '/sebastian/diff/src/Differ.php', + 'SebastianBergmann\\Diff\\Exception' => __DIR__ . '/..' . '/sebastian/diff/src/Exception/Exception.php', + 'SebastianBergmann\\Diff\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/diff/src/Exception/InvalidArgumentException.php', + 'SebastianBergmann\\Diff\\Line' => __DIR__ . '/..' . '/sebastian/diff/src/Line.php', + 'SebastianBergmann\\Diff\\LongestCommonSubsequenceCalculator' => __DIR__ . '/..' . '/sebastian/diff/src/LongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\MemoryEfficientLongestCommonSubsequenceCalculator' => __DIR__ . '/..' . '/sebastian/diff/src/MemoryEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Diff\\Output\\AbstractChunkOutputBuilder' => __DIR__ . '/..' . '/sebastian/diff/src/Output/AbstractChunkOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOnlyOutputBuilder' => __DIR__ . '/..' . '/sebastian/diff/src/Output/DiffOnlyOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\DiffOutputBuilderInterface' => __DIR__ . '/..' . '/sebastian/diff/src/Output/DiffOutputBuilderInterface.php', + 'SebastianBergmann\\Diff\\Output\\StrictUnifiedDiffOutputBuilder' => __DIR__ . '/..' . '/sebastian/diff/src/Output/StrictUnifiedDiffOutputBuilder.php', + 'SebastianBergmann\\Diff\\Output\\UnifiedDiffOutputBuilder' => __DIR__ . '/..' . '/sebastian/diff/src/Output/UnifiedDiffOutputBuilder.php', + 'SebastianBergmann\\Diff\\Parser' => __DIR__ . '/..' . '/sebastian/diff/src/Parser.php', + 'SebastianBergmann\\Diff\\TimeEfficientLongestCommonSubsequenceCalculator' => __DIR__ . '/..' . '/sebastian/diff/src/TimeEfficientLongestCommonSubsequenceCalculator.php', + 'SebastianBergmann\\Environment\\Console' => __DIR__ . '/..' . '/sebastian/environment/src/Console.php', + 'SebastianBergmann\\Environment\\OperatingSystem' => __DIR__ . '/..' . '/sebastian/environment/src/OperatingSystem.php', + 'SebastianBergmann\\Environment\\Runtime' => __DIR__ . '/..' . '/sebastian/environment/src/Runtime.php', + 'SebastianBergmann\\Exporter\\Exporter' => __DIR__ . '/..' . '/sebastian/exporter/src/Exporter.php', + 'SebastianBergmann\\FileIterator\\Facade' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Facade.php', + 'SebastianBergmann\\FileIterator\\Factory' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Factory.php', + 'SebastianBergmann\\FileIterator\\Iterator' => __DIR__ . '/..' . '/phpunit/php-file-iterator/src/Iterator.php', + 'SebastianBergmann\\GlobalState\\Blacklist' => __DIR__ . '/..' . '/sebastian/global-state/src/Blacklist.php', + 'SebastianBergmann\\GlobalState\\CodeExporter' => __DIR__ . '/..' . '/sebastian/global-state/src/CodeExporter.php', + 'SebastianBergmann\\GlobalState\\Exception' => __DIR__ . '/..' . '/sebastian/global-state/src/exceptions/Exception.php', + 'SebastianBergmann\\GlobalState\\Restorer' => __DIR__ . '/..' . '/sebastian/global-state/src/Restorer.php', + 'SebastianBergmann\\GlobalState\\RuntimeException' => __DIR__ . '/..' . '/sebastian/global-state/src/exceptions/RuntimeException.php', + 'SebastianBergmann\\GlobalState\\Snapshot' => __DIR__ . '/..' . '/sebastian/global-state/src/Snapshot.php', + 'SebastianBergmann\\ObjectEnumerator\\Enumerator' => __DIR__ . '/..' . '/sebastian/object-enumerator/src/Enumerator.php', + 'SebastianBergmann\\ObjectEnumerator\\Exception' => __DIR__ . '/..' . '/sebastian/object-enumerator/src/Exception.php', + 'SebastianBergmann\\ObjectEnumerator\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/object-enumerator/src/InvalidArgumentException.php', + 'SebastianBergmann\\ObjectReflector\\Exception' => __DIR__ . '/..' . '/sebastian/object-reflector/src/Exception.php', + 'SebastianBergmann\\ObjectReflector\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/object-reflector/src/InvalidArgumentException.php', + 'SebastianBergmann\\ObjectReflector\\ObjectReflector' => __DIR__ . '/..' . '/sebastian/object-reflector/src/ObjectReflector.php', + 'SebastianBergmann\\RecursionContext\\Context' => __DIR__ . '/..' . '/sebastian/recursion-context/src/Context.php', + 'SebastianBergmann\\RecursionContext\\Exception' => __DIR__ . '/..' . '/sebastian/recursion-context/src/Exception.php', + 'SebastianBergmann\\RecursionContext\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/recursion-context/src/InvalidArgumentException.php', + 'SebastianBergmann\\ResourceOperations\\ResourceOperations' => __DIR__ . '/..' . '/sebastian/resource-operations/src/ResourceOperations.php', + 'SebastianBergmann\\Timer\\Exception' => __DIR__ . '/..' . '/phpunit/php-timer/src/Exception.php', + 'SebastianBergmann\\Timer\\RuntimeException' => __DIR__ . '/..' . '/phpunit/php-timer/src/RuntimeException.php', + 'SebastianBergmann\\Timer\\Timer' => __DIR__ . '/..' . '/phpunit/php-timer/src/Timer.php', + 'SebastianBergmann\\Version' => __DIR__ . '/..' . '/sebastian/version/src/Version.php', + 'Text_Template' => __DIR__ . '/..' . '/phpunit/php-text-template/src/Template.php', + 'TheSeer\\Tokenizer\\Exception' => __DIR__ . '/..' . '/theseer/tokenizer/src/Exception.php', + 'TheSeer\\Tokenizer\\NamespaceUri' => __DIR__ . '/..' . '/theseer/tokenizer/src/NamespaceUri.php', + 'TheSeer\\Tokenizer\\NamespaceUriException' => __DIR__ . '/..' . '/theseer/tokenizer/src/NamespaceUriException.php', + 'TheSeer\\Tokenizer\\Token' => __DIR__ . '/..' . '/theseer/tokenizer/src/Token.php', + 'TheSeer\\Tokenizer\\TokenCollection' => __DIR__ . '/..' . '/theseer/tokenizer/src/TokenCollection.php', + 'TheSeer\\Tokenizer\\TokenCollectionException' => __DIR__ . '/..' . '/theseer/tokenizer/src/TokenCollectionException.php', + 'TheSeer\\Tokenizer\\Tokenizer' => __DIR__ . '/..' . '/theseer/tokenizer/src/Tokenizer.php', + 'TheSeer\\Tokenizer\\XMLSerializer' => __DIR__ . '/..' . '/theseer/tokenizer/src/XMLSerializer.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInitc2a3a9d6d115ed496617aaf7880d58ed::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitc2a3a9d6d115ed496617aaf7880d58ed::$prefixDirsPsr4; + $loader->fallbackDirsPsr4 = ComposerStaticInitc2a3a9d6d115ed496617aaf7880d58ed::$fallbackDirsPsr4; + $loader->prefixesPsr0 = ComposerStaticInitc2a3a9d6d115ed496617aaf7880d58ed::$prefixesPsr0; + $loader->classMap = ComposerStaticInitc2a3a9d6d115ed496617aaf7880d58ed::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json new file mode 100644 index 0000000..e18b795 --- /dev/null +++ b/vendor/composer/installed.json @@ -0,0 +1,4925 @@ +[ + { + "name": "sebastian/version", + "version": "2.0.1", + "version_normalized": "2.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "time": "2016-10-03T07:35:21+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.1", + "version_normalized": "2.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "time": "2018-10-04T04:07:39+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "version_normalized": "3.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "time": "2017-03-03T06:23:57+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "version_normalized": "1.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "time": "2017-03-29T09:07:27+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "version_normalized": "3.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "time": "2017-08-03T12:35:26+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "time": "2017-04-27T15:39:26+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ] + }, + { + "name": "sebastian/exporter", + "version": "3.1.0", + "version_normalized": "3.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "time": "2017-04-03T13:19:02+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ] + }, + { + "name": "sebastian/environment", + "version": "4.0.1", + "version_normalized": "4.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "febd209a219cea7b56ad799b30ebbea34b71eb8f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/febd209a219cea7b56ad799b30ebbea34b71eb8f", + "reference": "febd209a219cea7b56ad799b30ebbea34b71eb8f", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.4" + }, + "time": "2018-11-25T09:31:21+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ] + }, + { + "name": "sebastian/diff", + "version": "3.0.1", + "version_normalized": "3.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "366541b989927187c4ca70490a35615d3fef2dce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/366541b989927187c4ca70490a35615d3fef2dce", + "reference": "366541b989927187c4ca70490a35615d3fef2dce", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "time": "2018-06-10T07:54:39+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ] + }, + { + "name": "sebastian/comparator", + "version": "3.0.2", + "version_normalized": "3.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "shasum": "" + }, + "require": { + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "time": "2018-07-12T15:12:46+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ] + }, + { + "name": "phpunit/php-timer", + "version": "2.0.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b8454ea6958c3dee38453d3bd571e023108c91f", + "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "time": "2018-02-01T13:07:23+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ] + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "version_normalized": "1.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "time": "2015-06-21T13:50:34+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ] + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.2", + "version_normalized": "2.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "050bedf145a257b1ff02746c31894800e5122946" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "time": "2018-09-13T20:33:42+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ] + }, + { + "name": "theseer/tokenizer", + "version": "1.1.0", + "version_normalized": "1.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "time": "2017-04-07T12:08:54+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "time": "2017-03-04T06:30:41+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.0.1", + "version_normalized": "3.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c99e3be9d3e85f60646f152f9002d46ed7770d18", + "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "time": "2018-10-30T05:52:18+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ] + }, + { + "name": "phpunit/php-code-coverage", + "version": "6.1.4", + "version_normalized": "6.1.4.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1 || ^4.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-xdebug": "^2.6.0" + }, + "time": "2018-10-31T16:06:48+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ] + }, + { + "name": "doctrine/instantiator", + "version": "1.1.0", + "version_normalized": "1.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" + }, + "time": "2017-07-22T11:58:36+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ] + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.10.0", + "version_normalized": "1.10.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "time": "2018-08-06T14:22:27+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ] + }, + { + "name": "webmozart/assert", + "version": "1.4.0", + "version_normalized": "1.4.0.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "time": "2018-12-25T11:19:39+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ] + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "time": "2017-09-11T18:02:19+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ] + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "version_normalized": "0.4.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "time": "2017-07-14T14:27:02+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ] + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.0", + "version_normalized": "4.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "shasum": "" + }, + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" + }, + "time": "2017-11-30T07:14:17+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock." + }, + { + "name": "phpspec/prophecy", + "version": "1.8.0", + "version_normalized": "1.8.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + "time": "2018-08-05T17:53:17+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ] + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "version_normalized": "2.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "time": "2018-07-08T19:19:57+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "version_normalized": "1.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "time": "2018-07-08T19:23:20+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)" + }, + { + "name": "myclabs/deep-copy", + "version": "1.8.1", + "version_normalized": "1.8.1.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "time": "2018-06-11T23:09:50+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ] + }, + { + "name": "phpunit/phpunit", + "version": "7.5.1", + "version_normalized": "7.5.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "c23d78776ad415d5506e0679723cb461d71f488f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c23d78776ad415d5506e0679723cb461d71f488f", + "reference": "c23d78776ad415d5506e0679723cb461d71f488f", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.0", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpunit/phpunit-mock-objects": "*" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "time": "2018-12-12T07:20:32+00:00", + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.5-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ] + }, + { + "name": "fzaninotto/faker", + "version": "v1.8.0", + "version_normalized": "1.8.0.0", + "source": { + "type": "git", + "url": "https://github.com/fzaninotto/Faker.git", + "reference": "f72816b43e74063c8b10357394b6bba8cb1c10de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/f72816b43e74063c8b10357394b6bba8cb1c10de", + "reference": "f72816b43e74063c8b10357394b6bba8cb1c10de", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "ext-intl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7", + "squizlabs/php_codesniffer": "^1.5" + }, + "time": "2018-07-12T10:23:15+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ] + }, + { + "name": "orchestra/testbench-core", + "version": "v3.7.7", + "version_normalized": "3.7.7.0", + "source": { + "type": "git", + "url": "https://github.com/orchestral/testbench-core.git", + "reference": "b5c97f3f3ae488c9e92196c2a7fcf3def9d23e36" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/b5c97f3f3ae488c9e92196c2a7fcf3def9d23e36", + "reference": "b5c97f3f3ae488c9e92196c2a7fcf3def9d23e36", + "shasum": "" + }, + "require": { + "fzaninotto/faker": "^1.4", + "php": ">=7.1" + }, + "require-dev": { + "laravel/framework": "~5.7.14", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "laravel/framework": "Required for testing (~5.7.14).", + "mockery/mockery": "Allow to use Mockery for testing (^1.0).", + "orchestra/testbench-browser-kit": "Allow to use legacy Laravel BrowserKit for testing (~3.7).", + "orchestra/testbench-dusk": "Allow to use Laravel Dusk for testing (~3.7).", + "phpunit/phpunit": "Allow to use PHPUnit for testing (^7.0)." + }, + "time": "2018-12-04T00:47:44+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.7-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Orchestra\\Testbench\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mior Muhammad Zaki", + "email": "crynobone@gmail.com", + "homepage": "https://github.com/crynobone" + } + ], + "description": "Testing Helper for Laravel Development", + "homepage": "http://orchestraplatform.com/docs/latest/components/testbench/", + "keywords": [ + "BDD", + "TDD", + "laravel", + "orchestra-platform", + "orchestral", + "testing" + ] + }, + { + "name": "hamcrest/hamcrest-php", + "version": "v2.0.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/776503d3a8e85d4f9a1148614f95b7a608b046ad", + "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad", + "shasum": "" + }, + "require": { + "php": "^5.3|^7.0" + }, + "replace": { + "cordoval/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "kodova/hamcrest-php": "*" + }, + "require-dev": { + "phpunit/php-file-iterator": "1.3.3", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "^1.0" + }, + "time": "2016-01-20T08:20:44+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "hamcrest" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD" + ], + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": [ + "test" + ] + }, + { + "name": "mockery/mockery", + "version": "1.2.0", + "version_normalized": "1.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/mockery/mockery.git", + "reference": "100633629bf76d57430b86b7098cd6beb996a35a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mockery/mockery/zipball/100633629bf76d57430b86b7098cd6beb996a35a", + "reference": "100633629bf76d57430b86b7098cd6beb996a35a", + "shasum": "" + }, + "require": { + "hamcrest/hamcrest-php": "~2.0", + "lib-pcre": ">=7.0", + "php": ">=5.6.0" + }, + "require-dev": { + "phpunit/phpunit": "~5.7.10|~6.5|~7.0" + }, + "time": "2018-10-02T21:52:37+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Mockery": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + }, + { + "name": "Dave Marshall", + "email": "dave.marshall@atstsolutions.co.uk", + "homepage": "http://davedevelopment.co.uk" + } + ], + "description": "Mockery is a simple yet flexible PHP mock object framework", + "homepage": "https://github.com/mockery/mockery", + "keywords": [ + "BDD", + "TDD", + "library", + "mock", + "mock objects", + "mockery", + "stub", + "test", + "test double", + "testing" + ] + }, + { + "name": "vlucas/phpdotenv", + "version": "v2.5.1", + "version_normalized": "2.5.1.0", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e", + "reference": "8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.0" + }, + "time": "2018-07-29T20:33:41+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "http://www.vancelucas.com" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ] + }, + { + "name": "symfony/css-selector", + "version": "v4.2.1", + "version_normalized": "4.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "aa9fa526ba1b2ec087ffdfb32753803d999fcfcd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/aa9fa526ba1b2ec087ffdfb32753803d999fcfcd", + "reference": "aa9fa526ba1b2ec087ffdfb32753803d999fcfcd", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "time": "2018-11-11T19:52:12+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com" + }, + { + "name": "tijsverkoyen/css-to-inline-styles", + "version": "2.2.1", + "version_normalized": "2.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", + "reference": "0ed4a2ea4e0902dac0489e6436ebcd5bbcae9757" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/0ed4a2ea4e0902dac0489e6436ebcd5bbcae9757", + "reference": "0ed4a2ea4e0902dac0489e6436ebcd5bbcae9757", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "symfony/css-selector": "^2.7 || ^3.0 || ^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "time": "2017-11-27T11:13:29+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "TijsVerkoyen\\CssToInlineStyles\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Tijs Verkoyen", + "email": "css_to_inline_styles@verkoyen.eu", + "role": "Developer" + } + ], + "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", + "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.10.0", + "version_normalized": "1.10.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9050816e2ca34a8e916c3a0ae8b9c2fccf68b631", + "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "time": "2018-09-21T13:07:52+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ] + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.10.0", + "version_normalized": "1.10.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "time": "2018-09-21T13:07:52+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ] + }, + { + "name": "symfony/var-dumper", + "version": "v4.2.1", + "version_normalized": "4.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "db61258540350725f4beb6b84006e32398acd120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/db61258540350725f4beb6b84006e32398acd120", + "reference": "db61258540350725f4beb6b84006e32398acd120", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php72": "~1.5" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/console": "<3.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/process": "~3.4|~4.0", + "twig/twig": "~1.34|~2.4" + }, + "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" + }, + "time": "2018-11-25T12:50:42+00:00", + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony mechanism for exploring and dumping PHP variables", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ] + }, + { + "name": "symfony/routing", + "version": "v4.2.1", + "version_normalized": "4.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "649460207e77da6c545326c7f53618d23ad2c866" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/649460207e77da6c545326c7f53618d23ad2c866", + "reference": "649460207e77da6c545326c7f53618d23ad2c866", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "conflict": { + "symfony/config": "<4.2", + "symfony/dependency-injection": "<3.4", + "symfony/yaml": "<3.4" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "psr/log": "~1.0", + "symfony/config": "~4.2", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/http-foundation": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/dependency-injection": "For loading routes from a service", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "time": "2018-12-03T22:08:12+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Routing Component", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ] + }, + { + "name": "symfony/process", + "version": "v4.2.1", + "version_normalized": "4.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "2b341009ccec76837a7f46f59641b431e4d4c2b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/2b341009ccec76837a7f46f59641b431e4d4c2b0", + "reference": "2b341009ccec76837a7f46f59641b431e4d4c2b0", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "time": "2018-11-20T16:22:05+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com" + }, + { + "name": "symfony/http-foundation", + "version": "v4.2.1", + "version_normalized": "4.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "1b31f3017fadd8cb05cf2c8aebdbf3b12a943851" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/1b31f3017fadd8cb05cf2c8aebdbf3b12a943851", + "reference": "1b31f3017fadd8cb05cf2c8aebdbf3b12a943851", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "predis/predis": "~1.0", + "symfony/expression-language": "~3.4|~4.0" + }, + "time": "2018-11-26T10:55:26+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com" + }, + { + "name": "symfony/contracts", + "version": "v1.0.2", + "version_normalized": "1.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/contracts.git", + "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf", + "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "require-dev": { + "psr/cache": "^1.0", + "psr/container": "^1.0" + }, + "suggest": { + "psr/cache": "When using the Cache contracts", + "psr/container": "When using the Service contracts", + "symfony/cache-contracts-implementation": "", + "symfony/service-contracts-implementation": "", + "symfony/translation-contracts-implementation": "" + }, + "time": "2018-12-05T08:06:11+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Contracts\\": "" + }, + "exclude-from-classmap": [ + "**/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A set of abstractions extracted out of the Symfony components", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ] + }, + { + "name": "symfony/event-dispatcher", + "version": "v4.2.1", + "version_normalized": "4.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "921f49c3158a276d27c0d770a5a347a3b718b328" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/921f49c3158a276d27c0d770a5a347a3b718b328", + "reference": "921f49c3158a276d27c0d770a5a347a3b718b328", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/contracts": "^1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/stopwatch": "~3.4|~4.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "time": "2018-12-01T08:52:38+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com" + }, + { + "name": "psr/log", + "version": "1.1.0", + "version_normalized": "1.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2018-11-20T15:27:04+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ] + }, + { + "name": "symfony/debug", + "version": "v4.2.1", + "version_normalized": "4.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "e0a2b92ee0b5b934f973d90c2f58e18af109d276" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/e0a2b92ee0b5b934f973d90c2f58e18af109d276", + "reference": "e0a2b92ee0b5b934f973d90c2f58e18af109d276", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": "<3.4" + }, + "require-dev": { + "symfony/http-kernel": "~3.4|~4.0" + }, + "time": "2018-11-28T18:24:18+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com" + }, + { + "name": "symfony/http-kernel", + "version": "v4.2.1", + "version_normalized": "4.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "b39ceffc0388232c309cbde3a7c3685f2ec0a624" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/b39ceffc0388232c309cbde3a7c3685f2ec0a624", + "reference": "b39ceffc0388232c309cbde3a7c3685f2ec0a624", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "psr/log": "~1.0", + "symfony/contracts": "^1.0.2", + "symfony/debug": "~3.4|~4.0", + "symfony/event-dispatcher": "~4.1", + "symfony/http-foundation": "^4.1.1", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/config": "<3.4", + "symfony/dependency-injection": "<4.2", + "symfony/translation": "<4.2", + "symfony/var-dumper": "<4.1.1", + "twig/twig": "<1.34|<2.4,>=2" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/cache": "~1.0", + "symfony/browser-kit": "~3.4|~4.0", + "symfony/config": "~3.4|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/css-selector": "~3.4|~4.0", + "symfony/dependency-injection": "^4.2", + "symfony/dom-crawler": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/finder": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0", + "symfony/routing": "~3.4|~4.0", + "symfony/stopwatch": "~3.4|~4.0", + "symfony/templating": "~3.4|~4.0", + "symfony/translation": "~4.2", + "symfony/var-dumper": "^4.1.1" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "", + "symfony/var-dumper": "" + }, + "time": "2018-12-06T17:39:52+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpKernel Component", + "homepage": "https://symfony.com" + }, + { + "name": "symfony/finder", + "version": "v4.2.1", + "version_normalized": "4.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "e53d477d7b5c4982d0e1bfd2298dbee63d01441d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/e53d477d7b5c4982d0e1bfd2298dbee63d01441d", + "reference": "e53d477d7b5c4982d0e1bfd2298dbee63d01441d", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "time": "2018-11-11T19:52:12+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com" + }, + { + "name": "symfony/console", + "version": "v4.2.1", + "version_normalized": "4.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "4dff24e5d01e713818805c1862d2e3f901ee7dd0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/4dff24e5d01e713818805c1862d2e3f901ee7dd0", + "reference": "4dff24e5d01e713818805c1862d2e3f901ee7dd0", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/contracts": "^1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0" + }, + "suggest": { + "psr/log-implementation": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "time": "2018-11-27T07:40:44+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com" + }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "time": "2014-09-09T13:34:57+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ] + }, + { + "name": "egulias/email-validator", + "version": "2.1.7", + "version_normalized": "2.1.7.0", + "source": { + "type": "git", + "url": "https://github.com/egulias/EmailValidator.git", + "reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/709f21f92707308cdf8f9bcfa1af4cb26586521e", + "reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^1.0.1", + "php": ">= 5.5" + }, + "require-dev": { + "dominicsayers/isemail": "dev-master", + "phpunit/phpunit": "^4.8.35||^5.7||^6.0", + "satooshi/php-coveralls": "^1.0.1" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" + }, + "time": "2018-12-04T22:38:24+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Egulias\\EmailValidator\\": "EmailValidator" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eduardo Gulias Davis" + } + ], + "description": "A library for validating emails against several RFCs", + "homepage": "https://github.com/egulias/EmailValidator", + "keywords": [ + "email", + "emailvalidation", + "emailvalidator", + "validation", + "validator" + ] + }, + { + "name": "swiftmailer/swiftmailer", + "version": "v6.1.3", + "version_normalized": "6.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8ddcb66ac10c392d3beb54829eef8ac1438595f4", + "reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4", + "shasum": "" + }, + "require": { + "egulias/email-validator": "~2.0", + "php": ">=7.0.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.1", + "symfony/phpunit-bridge": "~3.3@dev" + }, + "suggest": { + "ext-intl": "Needed to support internationalized email addresses", + "true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed" + }, + "time": "2018-09-11T07:12:52+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "lib/swift_required.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Corbyn" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "https://swiftmailer.symfony.com", + "keywords": [ + "email", + "mail", + "mailer" + ] + }, + { + "name": "paragonie/random_compat", + "version": "v9.99.99", + "version_normalized": "9.99.99.0", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "shasum": "" + }, + "require": { + "php": "^7" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "time": "2018-07-02T15:55:56+00:00", + "type": "library", + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "polyfill", + "pseudorandom", + "random" + ] + }, + { + "name": "ramsey/uuid", + "version": "3.8.0", + "version_normalized": "3.8.0.0", + "source": { + "type": "git", + "url": "https://github.com/ramsey/uuid.git", + "reference": "d09ea80159c1929d75b3f9c60504d613aeb4a1e3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/d09ea80159c1929d75b3f9c60504d613aeb4a1e3", + "reference": "d09ea80159c1929d75b3f9c60504d613aeb4a1e3", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "^1.0|^2.0|9.99.99", + "php": "^5.4 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "replace": { + "rhumsaa/uuid": "self.version" + }, + "require-dev": { + "codeception/aspect-mock": "^1.0 | ~2.0.0", + "doctrine/annotations": "~1.2.0", + "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ~2.1.0", + "ircmaxell/random-lib": "^1.1", + "jakub-onderka/php-parallel-lint": "^0.9.0", + "mockery/mockery": "^0.9.9", + "moontoast/math": "^1.1", + "php-mock/php-mock-phpunit": "^0.3|^1.1", + "phpunit/phpunit": "^4.7|^5.0|^6.5", + "squizlabs/php_codesniffer": "^2.3" + }, + "suggest": { + "ext-ctype": "Provides support for PHP Ctype functions", + "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", + "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", + "ircmaxell/random-lib": "Provides RandomLib for use with the RandomLibAdapter", + "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).", + "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid", + "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." + }, + "time": "2018-07-19T23:38:55+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Ramsey\\Uuid\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marijn Huizendveld", + "email": "marijn.huizendveld@gmail.com" + }, + { + "name": "Thibaud Fabre", + "email": "thibaud@aztech.io" + }, + { + "name": "Ben Ramsey", + "email": "ben@benramsey.com", + "homepage": "https://benramsey.com" + } + ], + "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", + "homepage": "https://github.com/ramsey/uuid", + "keywords": [ + "guid", + "identifier", + "uuid" + ] + }, + { + "name": "psr/simple-cache", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2017-10-23T01:57:42+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ] + }, + { + "name": "psr/container", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2017-02-14T16:28:37+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ] + }, + { + "name": "opis/closure", + "version": "3.1.2", + "version_normalized": "3.1.2.0", + "source": { + "type": "git", + "url": "https://github.com/opis/closure.git", + "reference": "de00c69a2328d3ee5baa71fc584dc643222a574c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opis/closure/zipball/de00c69a2328d3ee5baa71fc584dc643222a574c", + "reference": "de00c69a2328d3ee5baa71fc584dc643222a574c", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0" + }, + "require-dev": { + "jeremeamia/superclosure": "^2.0", + "phpunit/phpunit": "^4.0|^5.0|^6.0|^7.0" + }, + "time": "2018-12-16T21:48:23+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Opis\\Closure\\": "src/" + }, + "files": [ + "functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marius Sarca", + "email": "marius.sarca@gmail.com" + }, + { + "name": "Sorin Sarca", + "email": "sarca_sorin@hotmail.com" + } + ], + "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", + "homepage": "https://opis.io/closure", + "keywords": [ + "anonymous functions", + "closure", + "function", + "serializable", + "serialization", + "serialize" + ] + }, + { + "name": "symfony/translation", + "version": "v4.2.1", + "version_normalized": "4.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "c0e2191e9bed845946ab3d99767513b56ca7dcd6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/c0e2191e9bed845946ab3d99767513b56ca7dcd6", + "reference": "c0e2191e9bed845946ab3d99767513b56ca7dcd6", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/contracts": "^1.0.2", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/config": "<3.4", + "symfony/dependency-injection": "<3.4", + "symfony/yaml": "<3.4" + }, + "provide": { + "symfony/translation-contracts-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/intl": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "psr/log-implementation": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "time": "2018-12-06T10:45:32+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Translation Component", + "homepage": "https://symfony.com" + }, + { + "name": "nesbot/carbon", + "version": "1.36.1", + "version_normalized": "1.36.1.0", + "source": { + "type": "git", + "url": "https://github.com/briannesbitt/Carbon.git", + "reference": "63da8cdf89d7a5efe43aabc794365f6e7b7b8983" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/63da8cdf89d7a5efe43aabc794365f6e7b7b8983", + "reference": "63da8cdf89d7a5efe43aabc794365f6e7b7b8983", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/translation": "~2.6 || ~3.0 || ~4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7" + }, + "suggest": { + "friendsofphp/php-cs-fixer": "Needed for the `composer phpcs` command. Allow to automatically fix code style.", + "phpstan/phpstan": "Needed for the `composer phpstan` command. Allow to detect potential errors." + }, + "time": "2018-11-22T18:23:02+00:00", + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "http://nesbot.com" + } + ], + "description": "A simple API extension for DateTime.", + "homepage": "http://carbon.nesbot.com", + "keywords": [ + "date", + "datetime", + "time" + ] + }, + { + "name": "monolog/monolog", + "version": "1.24.0", + "version_normalized": "1.24.0.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "^5.3|^6.0" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "time": "2018-11-05T09:00:11+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ] + }, + { + "name": "league/flysystem", + "version": "1.0.49", + "version_normalized": "1.0.49.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "a63cc83d8a931b271be45148fa39ba7156782ffd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a63cc83d8a931b271be45148fa39ba7156782ffd", + "reference": "a63cc83d8a931b271be45148fa39ba7156782ffd", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": ">=5.5.9" + }, + "conflict": { + "league/flysystem-sftp": "<1.0.6" + }, + "require-dev": { + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7.10" + }, + "suggest": { + "ext-fileinfo": "Required for MimeType", + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", + "league/flysystem-webdav": "Allows you to use WebDAV storage", + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" + }, + "time": "2018-11-23T23:41:29+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "description": "Filesystem abstraction: Many filesystems, one API.", + "keywords": [ + "Cloud Files", + "WebDAV", + "abstraction", + "aws", + "cloud", + "copy.com", + "dropbox", + "file systems", + "files", + "filesystem", + "filesystems", + "ftp", + "rackspace", + "remote", + "s3", + "sftp", + "storage" + ] + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "version_normalized": "1.3.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "time": "2016-12-20T10:07:11+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ] + }, + { + "name": "ralouphie/getallheaders", + "version": "2.0.5", + "version_normalized": "2.0.5.0", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "~3.7.0", + "satooshi/php-coveralls": ">=1.0" + }, + "time": "2016-02-11T07:05:27+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders." + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2016-08-06T14:39:51+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ] + }, + { + "name": "guzzlehttp/psr7", + "version": "1.5.2", + "version_normalized": "1.5.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "9f83dded91781a01c63574e387eaa769be769115" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/9f83dded91781a01c63574e387eaa769be769115", + "reference": "9f83dded91781a01c63574e387eaa769be769115", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "time": "2018-12-04T20:46:45+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ] + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.3.3", + "version_normalized": "6.3.3.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "time": "2018-04-22T15:46:56+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.3-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ] + }, + { + "name": "laravel/slack-notification-channel", + "version": "v1.0.3", + "version_normalized": "1.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/laravel/slack-notification-channel.git", + "reference": "6e164293b754a95f246faf50ab2bbea3e4923cc9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/slack-notification-channel/zipball/6e164293b754a95f246faf50ab2bbea3e4923cc9", + "reference": "6e164293b754a95f246faf50ab2bbea3e4923cc9", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.0", + "php": "^7.1.3" + }, + "require-dev": { + "illuminate/notifications": "~5.7", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^7.0" + }, + "time": "2018-12-12T13:12:06+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + }, + "laravel": { + "providers": [ + "Illuminate\\Notifications\\SlackChannelServiceProvider" + ] + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Illuminate\\Notifications\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Slack Notification Channel for laravel.", + "keywords": [ + "laravel", + "notifications", + "slack" + ] + }, + { + "name": "erusev/parsedown", + "version": "1.7.1", + "version_normalized": "1.7.1.0", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown.git", + "reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/92e9c27ba0e74b8b028b111d1b6f956a15c01fc1", + "reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, + "time": "2018-03-08T01:11:30+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Parsedown": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "Parser for Markdown.", + "homepage": "http://parsedown.org", + "keywords": [ + "markdown", + "parser" + ] + }, + { + "name": "dragonmantank/cron-expression", + "version": "v2.2.0", + "version_normalized": "2.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/dragonmantank/cron-expression.git", + "reference": "92a2c3768d50e21a1f26a53cb795ce72806266c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/92a2c3768d50e21a1f26a53cb795ce72806266c5", + "reference": "92a2c3768d50e21a1f26a53cb795ce72806266c5", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.4" + }, + "time": "2018-06-06T03:12:17+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Cron\\": "src/Cron/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Chris Tankersley", + "email": "chris@ctankersley.com", + "homepage": "https://github.com/dragonmantank" + } + ], + "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due", + "keywords": [ + "cron", + "schedule" + ] + }, + { + "name": "doctrine/inflector", + "version": "v1.3.0", + "version_normalized": "1.3.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "5527a48b7313d15261292c149e55e26eae771b0a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a", + "reference": "5527a48b7313d15261292c149e55e26eae771b0a", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.2" + }, + "time": "2018-01-09T20:05:19+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string" + ] + }, + { + "name": "laravel/framework", + "version": "v5.7.19", + "version_normalized": "5.7.19.0", + "source": { + "type": "git", + "url": "https://github.com/laravel/framework.git", + "reference": "5c1d1ec7e8563ea31826fd5eb3f6791acf01160c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/framework/zipball/5c1d1ec7e8563ea31826fd5eb3f6791acf01160c", + "reference": "5c1d1ec7e8563ea31826fd5eb3f6791acf01160c", + "shasum": "" + }, + "require": { + "doctrine/inflector": "^1.1", + "dragonmantank/cron-expression": "^2.0", + "erusev/parsedown": "^1.7", + "ext-mbstring": "*", + "ext-openssl": "*", + "laravel/nexmo-notification-channel": "^1.0", + "laravel/slack-notification-channel": "^1.0", + "league/flysystem": "^1.0.8", + "monolog/monolog": "^1.12", + "nesbot/carbon": "^1.26.3", + "opis/closure": "^3.1", + "php": "^7.1.3", + "psr/container": "^1.0", + "psr/simple-cache": "^1.0", + "ramsey/uuid": "^3.7", + "swiftmailer/swiftmailer": "^6.0", + "symfony/console": "^4.1", + "symfony/debug": "^4.1", + "symfony/finder": "^4.1", + "symfony/http-foundation": "^4.1", + "symfony/http-kernel": "^4.1", + "symfony/process": "^4.1", + "symfony/routing": "^4.1", + "symfony/var-dumper": "^4.1", + "tijsverkoyen/css-to-inline-styles": "^2.2.1", + "vlucas/phpdotenv": "^2.2" + }, + "conflict": { + "tightenco/collect": "<5.5.33" + }, + "replace": { + "illuminate/auth": "self.version", + "illuminate/broadcasting": "self.version", + "illuminate/bus": "self.version", + "illuminate/cache": "self.version", + "illuminate/config": "self.version", + "illuminate/console": "self.version", + "illuminate/container": "self.version", + "illuminate/contracts": "self.version", + "illuminate/cookie": "self.version", + "illuminate/database": "self.version", + "illuminate/encryption": "self.version", + "illuminate/events": "self.version", + "illuminate/filesystem": "self.version", + "illuminate/hashing": "self.version", + "illuminate/http": "self.version", + "illuminate/log": "self.version", + "illuminate/mail": "self.version", + "illuminate/notifications": "self.version", + "illuminate/pagination": "self.version", + "illuminate/pipeline": "self.version", + "illuminate/queue": "self.version", + "illuminate/redis": "self.version", + "illuminate/routing": "self.version", + "illuminate/session": "self.version", + "illuminate/support": "self.version", + "illuminate/translation": "self.version", + "illuminate/validation": "self.version", + "illuminate/view": "self.version" + }, + "require-dev": { + "aws/aws-sdk-php": "^3.0", + "doctrine/dbal": "^2.6", + "filp/whoops": "^2.1.4", + "guzzlehttp/guzzle": "^6.3", + "league/flysystem-cached-adapter": "^1.0", + "mockery/mockery": "^1.0", + "moontoast/math": "^1.1", + "orchestra/testbench-core": "3.7.*", + "pda/pheanstalk": "^3.0", + "phpunit/phpunit": "^7.0", + "predis/predis": "^1.1.1", + "symfony/css-selector": "^4.1", + "symfony/dom-crawler": "^4.1", + "true/punycode": "^2.1" + }, + "suggest": { + "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (^3.0).", + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "ext-pcntl": "Required to use all features of the queue worker.", + "ext-posix": "Required to use all features of the queue worker.", + "filp/whoops": "Required for friendly error pages in development (^2.1.4).", + "fzaninotto/faker": "Required to use the eloquent factory builder (^1.4).", + "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (^6.0).", + "laravel/tinker": "Required to use the tinker console command (^1.0).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", + "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", + "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (^1.0).", + "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", + "moontoast/math": "Required to use ordered UUIDs (^1.1).", + "nexmo/client": "Required to use the Nexmo transport (^1.0).", + "pda/pheanstalk": "Required to use the beanstalk queue driver (^3.0).", + "predis/predis": "Required to use the redis cache and queue drivers (^1.0).", + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^3.0).", + "symfony/css-selector": "Required to use some of the crawler integration testing tools (^4.1).", + "symfony/dom-crawler": "Required to use most of the crawler integration testing tools (^4.1).", + "symfony/psr-http-message-bridge": "Required to psr7 bridging features (^1.0)." + }, + "time": "2018-12-18T14:00:38+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/Illuminate/Foundation/helpers.php", + "src/Illuminate/Support/helpers.php" + ], + "psr-4": { + "Illuminate\\": "src/Illuminate/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Laravel Framework.", + "homepage": "https://laravel.com", + "keywords": [ + "framework", + "laravel" + ] + }, + { + "name": "lcobucci/jwt", + "version": "3.2.5", + "version_normalized": "3.2.5.0", + "source": { + "type": "git", + "url": "https://github.com/lcobucci/jwt.git", + "reference": "82be04b4753f8b7693b62852b7eab30f97524f9b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/82be04b4753f8b7693b62852b7eab30f97524f9b", + "reference": "82be04b4753f8b7693b62852b7eab30f97524f9b", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "php": ">=5.5" + }, + "require-dev": { + "mdanter/ecc": "~0.3.1", + "mikey179/vfsstream": "~1.5", + "phpmd/phpmd": "~2.2", + "phpunit/php-invoker": "~1.1", + "phpunit/phpunit": "~4.5", + "squizlabs/php_codesniffer": "~2.3" + }, + "suggest": { + "mdanter/ecc": "Required to use Elliptic Curves based algorithms." + }, + "time": "2018-11-11T12:22:26+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Lcobucci\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Luís Otávio Cobucci Oblonczyk", + "email": "lcobucci@gmail.com", + "role": "developer" + } + ], + "description": "A simple library to work with JSON Web Token and JSON Web Signature", + "keywords": [ + "JWS", + "jwt" + ] + }, + { + "name": "php-http/promise", + "version": "v1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/promise.git", + "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/promise/zipball/dc494cdc9d7160b9a09bd5573272195242ce7980", + "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980", + "shasum": "" + }, + "require-dev": { + "henrikbjorn/phpspec-code-coverage": "^1.0", + "phpspec/phpspec": "^2.4" + }, + "time": "2016-01-26T13:27:02+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Http\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + }, + { + "name": "Joel Wurtz", + "email": "joel.wurtz@gmail.com" + } + ], + "description": "Promise used for asynchronous HTTP requests", + "homepage": "http://httplug.io", + "keywords": [ + "promise" + ] + }, + { + "name": "php-http/httplug", + "version": "v1.1.0", + "version_normalized": "1.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/httplug.git", + "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/httplug/zipball/1c6381726c18579c4ca2ef1ec1498fdae8bdf018", + "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "php-http/promise": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "henrikbjorn/phpspec-code-coverage": "^1.0", + "phpspec/phpspec": "^2.4" + }, + "time": "2016-08-31T08:30:17+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eric GELOEN", + "email": "geloen.eric@gmail.com" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "HTTPlug, the HTTP client abstraction for PHP", + "homepage": "http://httplug.io", + "keywords": [ + "client", + "http" + ] + }, + { + "name": "php-http/guzzle6-adapter", + "version": "v1.1.1", + "version_normalized": "1.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/guzzle6-adapter.git", + "reference": "a56941f9dc6110409cfcddc91546ee97039277ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/guzzle6-adapter/zipball/a56941f9dc6110409cfcddc91546ee97039277ab", + "reference": "a56941f9dc6110409cfcddc91546ee97039277ab", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.0", + "php": ">=5.5.0", + "php-http/httplug": "^1.0" + }, + "provide": { + "php-http/async-client-implementation": "1.0", + "php-http/client-implementation": "1.0" + }, + "require-dev": { + "ext-curl": "*", + "php-http/adapter-integration-tests": "^0.4" + }, + "time": "2016-05-10T06:13:32+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Http\\Adapter\\Guzzle6\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + }, + { + "name": "David de Boer", + "email": "david@ddeboer.nl" + } + ], + "description": "Guzzle 6 HTTP Adapter", + "homepage": "http://httplug.io", + "keywords": [ + "Guzzle", + "http" + ] + }, + { + "name": "zendframework/zend-diactoros", + "version": "1.8.6", + "version_normalized": "1.8.6.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-diactoros.git", + "reference": "20da13beba0dde8fb648be3cc19765732790f46e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/20da13beba0dde8fb648be3cc19765732790f46e", + "reference": "20da13beba0dde8fb648be3cc19765732790f46e", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "psr/http-message": "^1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-dom": "*", + "ext-libxml": "*", + "php-http/psr7-integration-tests": "dev-master", + "phpunit/phpunit": "^5.7.16 || ^6.0.8 || ^7.2.7", + "zendframework/zend-coding-standard": "~1.0" + }, + "time": "2018-09-05T19:29:37+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev", + "dev-develop": "1.9.x-dev", + "dev-release-2.0": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions/create_uploaded_file.php", + "src/functions/marshal_headers_from_sapi.php", + "src/functions/marshal_method_from_sapi.php", + "src/functions/marshal_protocol_version_from_sapi.php", + "src/functions/marshal_uri_from_sapi.php", + "src/functions/normalize_server.php", + "src/functions/normalize_uploaded_files.php", + "src/functions/parse_cookie_header.php" + ], + "psr-4": { + "Zend\\Diactoros\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "description": "PSR HTTP Message implementations", + "homepage": "https://github.com/zendframework/zend-diactoros", + "keywords": [ + "http", + "psr", + "psr-7" + ] + }, + { + "name": "nexmo/client", + "version": "1.6.0", + "version_normalized": "1.6.0.0", + "source": { + "type": "git", + "url": "https://github.com/Nexmo/nexmo-php.git", + "reference": "01809cc1e17a5af275913c49bb5d444eb6cc06d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Nexmo/nexmo-php/zipball/01809cc1e17a5af275913c49bb5d444eb6cc06d4", + "reference": "01809cc1e17a5af275913c49bb5d444eb6cc06d4", + "shasum": "" + }, + "require": { + "lcobucci/jwt": "^3.2", + "php": ">=5.6", + "php-http/client-implementation": "^1.0", + "php-http/guzzle6-adapter": "^1.0", + "zendframework/zend-diactoros": "^1.3" + }, + "require-dev": { + "estahn/phpunit-json-assertions": "^1.0.0", + "php-http/mock-client": "^0.3.0", + "phpunit/phpunit": "^5.7", + "squizlabs/php_codesniffer": "^3.1" + }, + "time": "2018-12-17T10:47:50+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Nexmo\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tim Lytle", + "email": "tim@nexmo.com", + "homepage": "http://twitter.com/tjlytle", + "role": "Developer" + } + ], + "description": "PHP Client for using Nexmo's API." + }, + { + "name": "laravel/nexmo-notification-channel", + "version": "v1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/laravel/nexmo-notification-channel.git", + "reference": "03edd42a55b306ff980c9950899d5a2b03260d48" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/nexmo-notification-channel/zipball/03edd42a55b306ff980c9950899d5a2b03260d48", + "reference": "03edd42a55b306ff980c9950899d5a2b03260d48", + "shasum": "" + }, + "require": { + "nexmo/client": "^1.0", + "php": "^7.1.3" + }, + "require-dev": { + "illuminate/notifications": "~5.7", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^7.0" + }, + "time": "2018-12-04T12:57:08+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + }, + "laravel": { + "providers": [ + "Illuminate\\Notifications\\NexmoChannelServiceProvider" + ] + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Illuminate\\Notifications\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Nexmo Notification Channel for laravel.", + "keywords": [ + "laravel", + "nexmo", + "notifications" + ] + }, + { + "name": "orchestra/testbench", + "version": "v3.7.6", + "version_normalized": "3.7.6.0", + "source": { + "type": "git", + "url": "https://github.com/orchestral/testbench.git", + "reference": "57c9dc9271e60421b8402f477c44589156fb67b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/orchestral/testbench/zipball/57c9dc9271e60421b8402f477c44589156fb67b6", + "reference": "57c9dc9271e60421b8402f477c44589156fb67b6", + "shasum": "" + }, + "require": { + "laravel/framework": "~5.7.14", + "mockery/mockery": "^1.0", + "orchestra/testbench-core": "~3.7.7", + "php": ">=7.1", + "phpunit/phpunit": "^7.0" + }, + "time": "2018-12-04T01:01:32+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.7-dev" + } + }, + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mior Muhammad Zaki", + "email": "crynobone@gmail.com", + "homepage": "https://github.com/crynobone" + } + ], + "description": "Laravel Testing Helper for Packages Development", + "homepage": "http://orchestraplatform.com/docs/latest/components/testbench/", + "keywords": [ + "BDD", + "TDD", + "laravel", + "orchestra-platform", + "orchestral", + "testing" + ] + }, + { + "name": "symfony/yaml", + "version": "v4.2.1", + "version_normalized": "4.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "c41175c801e3edfda90f32e292619d10c27103d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/c41175c801e3edfda90f32e292619d10c27103d7", + "reference": "c41175c801e3edfda90f32e292619d10c27103d7", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "time": "2018-11-11T19:52:12+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com" + }, + { + "name": "hassankhan/config", + "version": "0.10.0", + "version_normalized": "0.10.0.0", + "source": { + "type": "git", + "url": "https://github.com/hassankhan/config.git", + "reference": "06ac500348af033f1a2e44dc357ca86282626d4a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hassankhan/config/zipball/06ac500348af033f1a2e44dc357ca86282626d4a", + "reference": "06ac500348af033f1a2e44dc357ca86282626d4a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "scrutinizer/ocular": "~1.1", + "squizlabs/php_codesniffer": "~2.2" + }, + "suggest": { + "symfony/yaml": "~2.5" + }, + "time": "2016-02-11T16:21:17+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Noodlehaus\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Hassan Khan", + "homepage": "http://hassankhan.me/", + "role": "Developer" + } + ], + "description": "Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files", + "homepage": "http://hassankhan.me/config/", + "keywords": [ + "config", + "configuration", + "ini", + "json", + "microphp", + "unframework", + "xml", + "yaml", + "yml" + ] + }, + { + "name": "codedungeon/phpunit-result-printer", + "version": "0.6.1", + "version_normalized": "0.6.1.0", + "source": { + "type": "git", + "url": "https://github.com/mikeerickson/phpunit-pretty-result-printer.git", + "reference": "e4cbf937b422bd2ce5ff9929e77592eb8188dbe6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mikeerickson/phpunit-pretty-result-printer/zipball/e4cbf937b422bd2ce5ff9929e77592eb8188dbe6", + "reference": "e4cbf937b422bd2ce5ff9929e77592eb8188dbe6", + "shasum": "" + }, + "require": { + "hassankhan/config": "^0.10.0", + "php": "^7.1", + "symfony/yaml": "^2.7|^3.0|^4.0" + }, + "require-dev": { + "phpunit/phpunit": ">=5.2", + "spatie/phpunit-watcher": "^1.3" + }, + "time": "2018-03-02T23:02:03+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Codedungeon\\PHPUnitPrettyResultPrinter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike Erickson", + "email": "codedungeon@gmail.com" + } + ], + "description": "PHPUnit Pretty Result Printer", + "keywords": [ + "composer", + "package", + "phpunit", + "printer", + "result-printer" + ] + }, + { + "name": "spatie/laravel-permission", + "version": "2.29.0", + "version_normalized": "2.29.0.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-permission.git", + "reference": "7f308806ca051fca42685e4a97a282139a6a7982" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-permission/zipball/7f308806ca051fca42685e4a97a282139a6a7982", + "reference": "7f308806ca051fca42685e4a97a282139a6a7982", + "shasum": "" + }, + "require": { + "illuminate/auth": "~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0", + "illuminate/container": "~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0", + "illuminate/contracts": "~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0", + "illuminate/database": "~5.4.0|~5.5.0|~5.6.0|~5.7.0", + "php": ">=7.0" + }, + "require-dev": { + "orchestra/testbench": "~3.4.2|~3.5.0|~3.6.0|~3.7.0", + "phpunit/phpunit": "^5.7|6.2|^7.0", + "predis/predis": "^1.1" + }, + "time": "2018-12-16T00:49:22+00:00", + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Spatie\\Permission\\PermissionServiceProvider" + ] + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Spatie\\Permission\\": "src" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "Permission handling for Laravel 5.4 and up", + "homepage": "https://github.com/spatie/laravel-permission", + "keywords": [ + "acl", + "laravel", + "permission", + "security", + "spatie" + ] + }, + { + "name": "vyuldashev/nova-permission", + "version": "v1.4.7", + "version_normalized": "1.4.7.0", + "source": { + "type": "git", + "url": "https://github.com/vyuldashev/nova-permission.git", + "reference": "bd910a1e5908fc0ccac588da91c0ec63a94b2ab7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vyuldashev/nova-permission/zipball/bd910a1e5908fc0ccac588da91c0ec63a94b2ab7", + "reference": "bd910a1e5908fc0ccac588da91c0ec63a94b2ab7", + "shasum": "" + }, + "require": { + "php": "^7.1", + "spatie/laravel-permission": "^2.16" + }, + "time": "2018-12-27T13:01:00+00:00", + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Vyuldashev\\NovaPermission\\ToolServiceProvider" + ] + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Vyuldashev\\NovaPermission\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A Laravel Nova tool for Spatie's Permission library.", + "keywords": [ + "laravel", + "nova", + "spatie-permission" + ] + } +] diff --git a/vendor/doctrine/inflector/LICENSE b/vendor/doctrine/inflector/LICENSE new file mode 100644 index 0000000..8c38cc1 --- /dev/null +++ b/vendor/doctrine/inflector/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2006-2015 Doctrine Project + +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/doctrine/inflector/README.md b/vendor/doctrine/inflector/README.md new file mode 100644 index 0000000..acb55a0 --- /dev/null +++ b/vendor/doctrine/inflector/README.md @@ -0,0 +1,6 @@ +# Doctrine Inflector + +Doctrine Inflector is a small library that can perform string manipulations +with regard to upper-/lowercase and singular/plural forms of words. + +[![Build Status](https://travis-ci.org/doctrine/inflector.svg?branch=master)](https://travis-ci.org/doctrine/inflector) diff --git a/vendor/doctrine/inflector/composer.json b/vendor/doctrine/inflector/composer.json new file mode 100644 index 0000000..2189ff1 --- /dev/null +++ b/vendor/doctrine/inflector/composer.json @@ -0,0 +1,32 @@ +{ + "name": "doctrine/inflector", + "type": "library", + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "keywords": ["string", "inflection", "singularize", "pluralize"], + "homepage": "http://www.doctrine-project.org", + "license": "MIT", + "authors": [ + {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, + {"name": "Roman Borschel", "email": "roman@code-factory.org"}, + {"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"}, + {"name": "Jonathan Wage", "email": "jonwage@gmail.com"}, + {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} + ], + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.2" + }, + "autoload": { + "psr-4": { "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" } + }, + "autoload-dev": { + "psr-4": { "Doctrine\\Tests\\Common\\Inflector\\": "tests/Doctrine/Tests/Common/Inflector" } + }, + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + } +} diff --git a/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php b/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php new file mode 100644 index 0000000..f9067a0 --- /dev/null +++ b/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php @@ -0,0 +1,490 @@ +. + */ + +namespace Doctrine\Common\Inflector; + +/** + * Doctrine inflector has static methods for inflecting text. + * + * The methods in these classes are from several different sources collected + * across several different php projects and several different authors. The + * original author names and emails are not known. + * + * Pluralize & Singularize implementation are borrowed from CakePHP with some modifications. + * + * @link www.doctrine-project.org + * @since 1.0 + * @author Konsta Vesterinen + * @author Jonathan H. Wage + */ +class Inflector +{ + /** + * Plural inflector rules. + * + * @var string[][] + */ + private static $plural = array( + 'rules' => array( + '/(s)tatus$/i' => '\1\2tatuses', + '/(quiz)$/i' => '\1zes', + '/^(ox)$/i' => '\1\2en', + '/([m|l])ouse$/i' => '\1ice', + '/(matr|vert|ind)(ix|ex)$/i' => '\1ices', + '/(x|ch|ss|sh)$/i' => '\1es', + '/([^aeiouy]|qu)y$/i' => '\1ies', + '/(hive|gulf)$/i' => '\1s', + '/(?:([^f])fe|([lr])f)$/i' => '\1\2ves', + '/sis$/i' => 'ses', + '/([ti])um$/i' => '\1a', + '/(c)riterion$/i' => '\1riteria', + '/(p)erson$/i' => '\1eople', + '/(m)an$/i' => '\1en', + '/(c)hild$/i' => '\1hildren', + '/(f)oot$/i' => '\1eet', + '/(buffal|her|potat|tomat|volcan)o$/i' => '\1\2oes', + '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i' => '\1i', + '/us$/i' => 'uses', + '/(alias)$/i' => '\1es', + '/(analys|ax|cris|test|thes)is$/i' => '\1es', + '/s$/' => 's', + '/^$/' => '', + '/$/' => 's', + ), + 'uninflected' => array( + '.*[nrlm]ese', + '.*deer', + '.*fish', + '.*measles', + '.*ois', + '.*pox', + '.*sheep', + 'people', + 'cookie', + 'police', + ), + 'irregular' => array( + 'atlas' => 'atlases', + 'axe' => 'axes', + 'beef' => 'beefs', + 'brother' => 'brothers', + 'cafe' => 'cafes', + 'chateau' => 'chateaux', + 'niveau' => 'niveaux', + 'child' => 'children', + 'cookie' => 'cookies', + 'corpus' => 'corpuses', + 'cow' => 'cows', + 'criterion' => 'criteria', + 'curriculum' => 'curricula', + 'demo' => 'demos', + 'domino' => 'dominoes', + 'echo' => 'echoes', + 'foot' => 'feet', + 'fungus' => 'fungi', + 'ganglion' => 'ganglions', + 'genie' => 'genies', + 'genus' => 'genera', + 'goose' => 'geese', + 'graffito' => 'graffiti', + 'hippopotamus' => 'hippopotami', + 'hoof' => 'hoofs', + 'human' => 'humans', + 'iris' => 'irises', + 'larva' => 'larvae', + 'leaf' => 'leaves', + 'loaf' => 'loaves', + 'man' => 'men', + 'medium' => 'media', + 'memorandum' => 'memoranda', + 'money' => 'monies', + 'mongoose' => 'mongooses', + 'motto' => 'mottoes', + 'move' => 'moves', + 'mythos' => 'mythoi', + 'niche' => 'niches', + 'nucleus' => 'nuclei', + 'numen' => 'numina', + 'occiput' => 'occiputs', + 'octopus' => 'octopuses', + 'opus' => 'opuses', + 'ox' => 'oxen', + 'passerby' => 'passersby', + 'penis' => 'penises', + 'person' => 'people', + 'plateau' => 'plateaux', + 'runner-up' => 'runners-up', + 'sex' => 'sexes', + 'soliloquy' => 'soliloquies', + 'son-in-law' => 'sons-in-law', + 'syllabus' => 'syllabi', + 'testis' => 'testes', + 'thief' => 'thieves', + 'tooth' => 'teeth', + 'tornado' => 'tornadoes', + 'trilby' => 'trilbys', + 'turf' => 'turfs', + 'valve' => 'valves', + 'volcano' => 'volcanoes', + ) + ); + + /** + * Singular inflector rules. + * + * @var string[][] + */ + private static $singular = array( + 'rules' => array( + '/(s)tatuses$/i' => '\1\2tatus', + '/^(.*)(menu)s$/i' => '\1\2', + '/(quiz)zes$/i' => '\\1', + '/(matr)ices$/i' => '\1ix', + '/(vert|ind)ices$/i' => '\1ex', + '/^(ox)en/i' => '\1', + '/(alias)(es)*$/i' => '\1', + '/(buffal|her|potat|tomat|volcan)oes$/i' => '\1o', + '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us', + '/([ftw]ax)es/i' => '\1', + '/(analys|ax|cris|test|thes)es$/i' => '\1is', + '/(shoe|slave)s$/i' => '\1', + '/(o)es$/i' => '\1', + '/ouses$/' => 'ouse', + '/([^a])uses$/' => '\1us', + '/([m|l])ice$/i' => '\1ouse', + '/(x|ch|ss|sh)es$/i' => '\1', + '/(m)ovies$/i' => '\1\2ovie', + '/(s)eries$/i' => '\1\2eries', + '/([^aeiouy]|qu)ies$/i' => '\1y', + '/([lr])ves$/i' => '\1f', + '/(tive)s$/i' => '\1', + '/(hive)s$/i' => '\1', + '/(drive)s$/i' => '\1', + '/(dive)s$/i' => '\1', + '/(olive)s$/i' => '\1', + '/([^fo])ves$/i' => '\1fe', + '/(^analy)ses$/i' => '\1sis', + '/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis', + '/(c)riteria$/i' => '\1riterion', + '/([ti])a$/i' => '\1um', + '/(p)eople$/i' => '\1\2erson', + '/(m)en$/i' => '\1an', + '/(c)hildren$/i' => '\1\2hild', + '/(f)eet$/i' => '\1oot', + '/(n)ews$/i' => '\1\2ews', + '/eaus$/' => 'eau', + '/^(.*us)$/' => '\\1', + '/s$/i' => '', + ), + 'uninflected' => array( + '.*[nrlm]ese', + '.*deer', + '.*fish', + '.*measles', + '.*ois', + '.*pox', + '.*sheep', + '.*ss', + 'data', + 'police', + 'pants', + 'clothes', + ), + 'irregular' => array( + 'abuses' => 'abuse', + 'avalanches' => 'avalanche', + 'caches' => 'cache', + 'criteria' => 'criterion', + 'curves' => 'curve', + 'emphases' => 'emphasis', + 'foes' => 'foe', + 'geese' => 'goose', + 'graves' => 'grave', + 'hoaxes' => 'hoax', + 'media' => 'medium', + 'neuroses' => 'neurosis', + 'waves' => 'wave', + 'oases' => 'oasis', + 'valves' => 'valve', + ) + ); + + /** + * Words that should not be inflected. + * + * @var array + */ + private static $uninflected = array( + '.*?media', 'Amoyese', 'audio', 'bison', 'Borghese', 'bream', 'breeches', + 'britches', 'buffalo', 'cantus', 'carp', 'chassis', 'clippers', 'cod', 'coitus', 'compensation', 'Congoese', + 'contretemps', 'coreopsis', 'corps', 'data', 'debris', 'deer', 'diabetes', 'djinn', 'education', 'eland', + 'elk', 'emoji', 'equipment', 'evidence', 'Faroese', 'feedback', 'fish', 'flounder', 'Foochowese', + 'Furniture', 'furniture', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'gold', + 'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings', 'jackanapes', 'jedi', + 'Kiplingese', 'knowledge', 'Kongoese', 'love', 'Lucchese', 'Luggage', 'mackerel', 'Maltese', 'metadata', + 'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese', 'nutrition', 'offspring', + 'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'plankton', 'pliers', 'pokemon', 'police', 'Portuguese', + 'proceedings', 'rabies', 'rain', 'rhinoceros', 'rice', 'salmon', 'Sarawakese', 'scissors', 'sea[- ]bass', + 'series', 'Shavese', 'shears', 'sheep', 'siemens', 'species', 'staff', 'swine', 'traffic', + 'trousers', 'trout', 'tuna', 'us', 'Vermontese', 'Wenchowese', 'wheat', 'whiting', 'wildebeest', 'Yengeese' + ); + + /** + * Method cache array. + * + * @var array + */ + private static $cache = array(); + + /** + * The initial state of Inflector so reset() works. + * + * @var array + */ + private static $initialState = array(); + + /** + * Converts a word into the format for a Doctrine table name. Converts 'ModelName' to 'model_name'. + */ + public static function tableize(string $word) : string + { + return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $word)); + } + + /** + * Converts a word into the format for a Doctrine class name. Converts 'table_name' to 'TableName'. + */ + public static function classify(string $word) : string + { + return str_replace([' ', '_', '-'], '', ucwords($word, ' _-')); + } + + /** + * Camelizes a word. This uses the classify() method and turns the first character to lowercase. + */ + public static function camelize(string $word) : string + { + return lcfirst(self::classify($word)); + } + + /** + * Uppercases words with configurable delimeters between words. + * + * Takes a string and capitalizes all of the words, like PHP's built-in + * ucwords function. This extends that behavior, however, by allowing the + * word delimeters to be configured, rather than only separating on + * whitespace. + * + * Here is an example: + * + * + * + * + * @param string $string The string to operate on. + * @param string $delimiters A list of word separators. + * + * @return string The string with all delimeter-separated words capitalized. + */ + public static function ucwords(string $string, string $delimiters = " \n\t\r\0\x0B-") : string + { + return ucwords($string, $delimiters); + } + + /** + * Clears Inflectors inflected value caches, and resets the inflection + * rules to the initial values. + */ + public static function reset() : void + { + if (empty(self::$initialState)) { + self::$initialState = get_class_vars('Inflector'); + + return; + } + + foreach (self::$initialState as $key => $val) { + if ($key !== 'initialState') { + self::${$key} = $val; + } + } + } + + /** + * Adds custom inflection $rules, of either 'plural' or 'singular' $type. + * + * ### Usage: + * + * {{{ + * Inflector::rules('plural', array('/^(inflect)or$/i' => '\1ables')); + * Inflector::rules('plural', array( + * 'rules' => array('/^(inflect)ors$/i' => '\1ables'), + * 'uninflected' => array('dontinflectme'), + * 'irregular' => array('red' => 'redlings') + * )); + * }}} + * + * @param string $type The type of inflection, either 'plural' or 'singular' + * @param array|iterable $rules An array of rules to be added. + * @param boolean $reset If true, will unset default inflections for all + * new rules that are being defined in $rules. + * + * @return void + */ + public static function rules(string $type, iterable $rules, bool $reset = false) : void + { + foreach ($rules as $rule => $pattern) { + if ( ! is_array($pattern)) { + continue; + } + + if ($reset) { + self::${$type}[$rule] = $pattern; + } else { + self::${$type}[$rule] = ($rule === 'uninflected') + ? array_merge($pattern, self::${$type}[$rule]) + : $pattern + self::${$type}[$rule]; + } + + unset($rules[$rule], self::${$type}['cache' . ucfirst($rule)]); + + if (isset(self::${$type}['merged'][$rule])) { + unset(self::${$type}['merged'][$rule]); + } + + if ($type === 'plural') { + self::$cache['pluralize'] = self::$cache['tableize'] = array(); + } elseif ($type === 'singular') { + self::$cache['singularize'] = array(); + } + } + + self::${$type}['rules'] = $rules + self::${$type}['rules']; + } + + /** + * Returns a word in plural form. + * + * @param string $word The word in singular form. + * + * @return string The word in plural form. + */ + public static function pluralize(string $word) : string + { + if (isset(self::$cache['pluralize'][$word])) { + return self::$cache['pluralize'][$word]; + } + + if (!isset(self::$plural['merged']['irregular'])) { + self::$plural['merged']['irregular'] = self::$plural['irregular']; + } + + if (!isset(self::$plural['merged']['uninflected'])) { + self::$plural['merged']['uninflected'] = array_merge(self::$plural['uninflected'], self::$uninflected); + } + + if (!isset(self::$plural['cacheUninflected']) || !isset(self::$plural['cacheIrregular'])) { + self::$plural['cacheUninflected'] = '(?:' . implode('|', self::$plural['merged']['uninflected']) . ')'; + self::$plural['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$plural['merged']['irregular'])) . ')'; + } + + if (preg_match('/(.*)\\b(' . self::$plural['cacheIrregular'] . ')$/i', $word, $regs)) { + self::$cache['pluralize'][$word] = $regs[1] . $word[0] . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1); + + return self::$cache['pluralize'][$word]; + } + + if (preg_match('/^(' . self::$plural['cacheUninflected'] . ')$/i', $word, $regs)) { + self::$cache['pluralize'][$word] = $word; + + return $word; + } + + foreach (self::$plural['rules'] as $rule => $replacement) { + if (preg_match($rule, $word)) { + self::$cache['pluralize'][$word] = preg_replace($rule, $replacement, $word); + + return self::$cache['pluralize'][$word]; + } + } + } + + /** + * Returns a word in singular form. + * + * @param string $word The word in plural form. + * + * @return string The word in singular form. + */ + public static function singularize(string $word) : string + { + if (isset(self::$cache['singularize'][$word])) { + return self::$cache['singularize'][$word]; + } + + if (!isset(self::$singular['merged']['uninflected'])) { + self::$singular['merged']['uninflected'] = array_merge( + self::$singular['uninflected'], + self::$uninflected + ); + } + + if (!isset(self::$singular['merged']['irregular'])) { + self::$singular['merged']['irregular'] = array_merge( + self::$singular['irregular'], + array_flip(self::$plural['irregular']) + ); + } + + if (!isset(self::$singular['cacheUninflected']) || !isset(self::$singular['cacheIrregular'])) { + self::$singular['cacheUninflected'] = '(?:' . implode('|', self::$singular['merged']['uninflected']) . ')'; + self::$singular['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$singular['merged']['irregular'])) . ')'; + } + + if (preg_match('/(.*)\\b(' . self::$singular['cacheIrregular'] . ')$/i', $word, $regs)) { + self::$cache['singularize'][$word] = $regs[1] . $word[0] . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1); + + return self::$cache['singularize'][$word]; + } + + if (preg_match('/^(' . self::$singular['cacheUninflected'] . ')$/i', $word, $regs)) { + self::$cache['singularize'][$word] = $word; + + return $word; + } + + foreach (self::$singular['rules'] as $rule => $replacement) { + if (preg_match($rule, $word)) { + self::$cache['singularize'][$word] = preg_replace($rule, $replacement, $word); + + return self::$cache['singularize'][$word]; + } + } + + self::$cache['singularize'][$word] = $word; + + return $word; + } +} diff --git a/vendor/doctrine/instantiator/CONTRIBUTING.md b/vendor/doctrine/instantiator/CONTRIBUTING.md new file mode 100644 index 0000000..75b84b2 --- /dev/null +++ b/vendor/doctrine/instantiator/CONTRIBUTING.md @@ -0,0 +1,35 @@ +# Contributing + + * Coding standard for the project is [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) + * The project will follow strict [object calisthenics](http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php) + * Any contribution must provide tests for additional introduced conditions + * Any un-confirmed issue needs a failing test case before being accepted + * Pull requests must be sent from a new hotfix/feature branch, not from `master`. + +## Installation + +To install the project and run the tests, you need to clone it first: + +```sh +$ git clone git://github.com/doctrine/instantiator.git +``` + +You will then need to run a composer installation: + +```sh +$ cd Instantiator +$ curl -s https://getcomposer.org/installer | php +$ php composer.phar update +``` + +## Testing + +The PHPUnit version to be used is the one installed as a dev- dependency via composer: + +```sh +$ ./vendor/bin/phpunit +``` + +Accepted coverage for new contributions is 80%. Any contribution not satisfying this requirement +won't be merged. + diff --git a/vendor/doctrine/instantiator/LICENSE b/vendor/doctrine/instantiator/LICENSE new file mode 100644 index 0000000..4d983d1 --- /dev/null +++ b/vendor/doctrine/instantiator/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 Doctrine Project + +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/doctrine/instantiator/README.md b/vendor/doctrine/instantiator/README.md new file mode 100644 index 0000000..b66064b --- /dev/null +++ b/vendor/doctrine/instantiator/README.md @@ -0,0 +1,40 @@ +# Instantiator + +This library provides a way of avoiding usage of constructors when instantiating PHP classes. + +[![Build Status](https://travis-ci.org/doctrine/instantiator.svg?branch=master)](https://travis-ci.org/doctrine/instantiator) +[![Code Coverage](https://scrutinizer-ci.com/g/doctrine/instantiator/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/doctrine/instantiator/?branch=master) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/doctrine/instantiator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/doctrine/instantiator/?branch=master) +[![Dependency Status](https://www.versioneye.com/package/php--doctrine--instantiator/badge.svg)](https://www.versioneye.com/package/php--doctrine--instantiator) +[![HHVM Status](http://hhvm.h4cc.de/badge/doctrine/instantiator.png)](http://hhvm.h4cc.de/package/doctrine/instantiator) + +[![Latest Stable Version](https://poser.pugx.org/doctrine/instantiator/v/stable.png)](https://packagist.org/packages/doctrine/instantiator) +[![Latest Unstable Version](https://poser.pugx.org/doctrine/instantiator/v/unstable.png)](https://packagist.org/packages/doctrine/instantiator) + +## Installation + +The suggested installation method is via [composer](https://getcomposer.org/): + +```sh +php composer.phar require "doctrine/instantiator:~1.0.3" +``` + +## Usage + +The instantiator is able to create new instances of any class without using the constructor or any API of the class +itself: + +```php +$instantiator = new \Doctrine\Instantiator\Instantiator(); + +$instance = $instantiator->instantiate(\My\ClassName\Here::class); +``` + +## Contributing + +Please read the [CONTRIBUTING.md](CONTRIBUTING.md) contents if you wish to help out! + +## Credits + +This library was migrated from [ocramius/instantiator](https://github.com/Ocramius/Instantiator), which +has been donated to the doctrine organization, and which is now deprecated in favour of this package. diff --git a/vendor/doctrine/instantiator/composer.json b/vendor/doctrine/instantiator/composer.json new file mode 100644 index 0000000..403ee8e --- /dev/null +++ b/vendor/doctrine/instantiator/composer.json @@ -0,0 +1,45 @@ +{ + "name": "doctrine/instantiator", + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "type": "library", + "license": "MIT", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "instantiate", + "constructor" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "require": { + "php": "^7.1" + }, + "require-dev": { + "ext-phar": "*", + "ext-pdo": "*", + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2", + "athletic/athletic": "~0.1.8" + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "autoload-dev": { + "psr-0": { + "DoctrineTest\\InstantiatorPerformance\\": "tests", + "DoctrineTest\\InstantiatorTest\\": "tests", + "DoctrineTest\\InstantiatorTestAsset\\": "tests" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + } +} diff --git a/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php new file mode 100644 index 0000000..3065375 --- /dev/null +++ b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php @@ -0,0 +1,29 @@ +. + */ + +namespace Doctrine\Instantiator\Exception; + +/** + * Base exception marker interface for the instantiator component + * + * @author Marco Pivetta + */ +interface ExceptionInterface +{ +} diff --git a/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/InvalidArgumentException.php b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..cb57aa8 --- /dev/null +++ b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/InvalidArgumentException.php @@ -0,0 +1,52 @@ +. + */ + +namespace Doctrine\Instantiator\Exception; + +use InvalidArgumentException as BaseInvalidArgumentException; +use ReflectionClass; + +/** + * Exception for invalid arguments provided to the instantiator + * + * @author Marco Pivetta + */ +class InvalidArgumentException extends BaseInvalidArgumentException implements ExceptionInterface +{ + public static function fromNonExistingClass(string $className) : self + { + if (interface_exists($className)) { + return new self(sprintf('The provided type "%s" is an interface, and can not be instantiated', $className)); + } + + if (PHP_VERSION_ID >= 50400 && trait_exists($className)) { + return new self(sprintf('The provided type "%s" is a trait, and can not be instantiated', $className)); + } + + return new self(sprintf('The provided class "%s" does not exist', $className)); + } + + public static function fromAbstractClass(ReflectionClass $reflectionClass) : self + { + return new self(sprintf( + 'The provided class "%s" is abstract, and can not be instantiated', + $reflectionClass->getName() + )); + } +} diff --git a/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php new file mode 100644 index 0000000..2b704b9 --- /dev/null +++ b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/UnexpectedValueException.php @@ -0,0 +1,66 @@ +. + */ + +namespace Doctrine\Instantiator\Exception; + +use Exception; +use ReflectionClass; +use UnexpectedValueException as BaseUnexpectedValueException; + +/** + * Exception for given parameters causing invalid/unexpected state on instantiation + * + * @author Marco Pivetta + */ +class UnexpectedValueException extends BaseUnexpectedValueException implements ExceptionInterface +{ + public static function fromSerializationTriggeredException( + ReflectionClass $reflectionClass, + Exception $exception + ) : self { + return new self( + sprintf( + 'An exception was raised while trying to instantiate an instance of "%s" via un-serialization', + $reflectionClass->getName() + ), + 0, + $exception + ); + } + + public static function fromUncleanUnSerialization( + ReflectionClass $reflectionClass, + string $errorString, + int $errorCode, + string $errorFile, + int $errorLine + ) : self { + return new self( + sprintf( + 'Could not produce an instance of "%s" via un-serialization, since an error was triggered ' + . 'in file "%s" at line "%d"', + $reflectionClass->getName(), + $errorFile, + $errorLine + ), + 0, + new Exception($errorString, $errorCode) + ); + } +} diff --git a/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php new file mode 100644 index 0000000..69fe65d --- /dev/null +++ b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php @@ -0,0 +1,216 @@ +. + */ + +namespace Doctrine\Instantiator; + +use Doctrine\Instantiator\Exception\InvalidArgumentException; +use Doctrine\Instantiator\Exception\UnexpectedValueException; +use Exception; +use ReflectionClass; + +/** + * {@inheritDoc} + * + * @author Marco Pivetta + */ +final class Instantiator implements InstantiatorInterface +{ + /** + * Markers used internally by PHP to define whether {@see \unserialize} should invoke + * the method {@see \Serializable::unserialize()} when dealing with classes implementing + * the {@see \Serializable} interface. + */ + const SERIALIZATION_FORMAT_USE_UNSERIALIZER = 'C'; + const SERIALIZATION_FORMAT_AVOID_UNSERIALIZER = 'O'; + + /** + * @var \callable[] used to instantiate specific classes, indexed by class name + */ + private static $cachedInstantiators = []; + + /** + * @var object[] of objects that can directly be cloned, indexed by class name + */ + private static $cachedCloneables = []; + + /** + * {@inheritDoc} + */ + public function instantiate($className) + { + if (isset(self::$cachedCloneables[$className])) { + return clone self::$cachedCloneables[$className]; + } + + if (isset(self::$cachedInstantiators[$className])) { + $factory = self::$cachedInstantiators[$className]; + + return $factory(); + } + + return $this->buildAndCacheFromFactory($className); + } + + /** + * Builds the requested object and caches it in static properties for performance + * + * @return object + */ + private function buildAndCacheFromFactory(string $className) + { + $factory = self::$cachedInstantiators[$className] = $this->buildFactory($className); + $instance = $factory(); + + if ($this->isSafeToClone(new ReflectionClass($instance))) { + self::$cachedCloneables[$className] = clone $instance; + } + + return $instance; + } + + /** + * Builds a callable capable of instantiating the given $className without + * invoking its constructor. + * + * @throws InvalidArgumentException + * @throws UnexpectedValueException + * @throws \ReflectionException + */ + private function buildFactory(string $className) : callable + { + $reflectionClass = $this->getReflectionClass($className); + + if ($this->isInstantiableViaReflection($reflectionClass)) { + return [$reflectionClass, 'newInstanceWithoutConstructor']; + } + + $serializedString = sprintf( + '%s:%d:"%s":0:{}', + self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER, + strlen($className), + $className + ); + + $this->checkIfUnSerializationIsSupported($reflectionClass, $serializedString); + + return function () use ($serializedString) { + return unserialize($serializedString); + }; + } + + /** + * @param string $className + * + * @return ReflectionClass + * + * @throws InvalidArgumentException + * @throws \ReflectionException + */ + private function getReflectionClass($className) : ReflectionClass + { + if (! class_exists($className)) { + throw InvalidArgumentException::fromNonExistingClass($className); + } + + $reflection = new ReflectionClass($className); + + if ($reflection->isAbstract()) { + throw InvalidArgumentException::fromAbstractClass($reflection); + } + + return $reflection; + } + + /** + * @param ReflectionClass $reflectionClass + * @param string $serializedString + * + * @throws UnexpectedValueException + * + * @return void + */ + private function checkIfUnSerializationIsSupported(ReflectionClass $reflectionClass, $serializedString) : void + { + set_error_handler(function ($code, $message, $file, $line) use ($reflectionClass, & $error) : void { + $error = UnexpectedValueException::fromUncleanUnSerialization( + $reflectionClass, + $message, + $code, + $file, + $line + ); + }); + + $this->attemptInstantiationViaUnSerialization($reflectionClass, $serializedString); + + restore_error_handler(); + + if ($error) { + throw $error; + } + } + + /** + * @param ReflectionClass $reflectionClass + * @param string $serializedString + * + * @throws UnexpectedValueException + * + * @return void + */ + private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, $serializedString) : void + { + try { + unserialize($serializedString); + } catch (Exception $exception) { + restore_error_handler(); + + throw UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $exception); + } + } + + private function isInstantiableViaReflection(ReflectionClass $reflectionClass) : bool + { + return ! ($this->hasInternalAncestors($reflectionClass) && $reflectionClass->isFinal()); + } + + /** + * Verifies whether the given class is to be considered internal + */ + private function hasInternalAncestors(ReflectionClass $reflectionClass) : bool + { + do { + if ($reflectionClass->isInternal()) { + return true; + } + } while ($reflectionClass = $reflectionClass->getParentClass()); + + return false; + } + + /** + * Checks if a class is cloneable + * + * Classes implementing `__clone` cannot be safely cloned, as that may cause side-effects. + */ + private function isSafeToClone(ReflectionClass $reflection) : bool + { + return $reflection->isCloneable() && ! $reflection->hasMethod('__clone'); + } +} diff --git a/vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php new file mode 100644 index 0000000..b665bea --- /dev/null +++ b/vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php @@ -0,0 +1,37 @@ +. + */ + +namespace Doctrine\Instantiator; + +/** + * Instantiator provides utility methods to build objects without invoking their constructors + * + * @author Marco Pivetta + */ +interface InstantiatorInterface +{ + /** + * @param string $className + * + * @return object + * + * @throws \Doctrine\Instantiator\Exception\ExceptionInterface + */ + public function instantiate($className); +} diff --git a/vendor/doctrine/lexer/LICENSE b/vendor/doctrine/lexer/LICENSE new file mode 100644 index 0000000..5e781fc --- /dev/null +++ b/vendor/doctrine/lexer/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2006-2013 Doctrine Project + +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/doctrine/lexer/README.md b/vendor/doctrine/lexer/README.md new file mode 100644 index 0000000..66f4430 --- /dev/null +++ b/vendor/doctrine/lexer/README.md @@ -0,0 +1,5 @@ +# Doctrine Lexer + +Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers. + +This lexer is used in Doctrine Annotations and in Doctrine ORM (DQL). diff --git a/vendor/doctrine/lexer/composer.json b/vendor/doctrine/lexer/composer.json new file mode 100644 index 0000000..8cd694c --- /dev/null +++ b/vendor/doctrine/lexer/composer.json @@ -0,0 +1,24 @@ +{ + "name": "doctrine/lexer", + "type": "library", + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "keywords": ["lexer", "parser"], + "homepage": "http://www.doctrine-project.org", + "license": "MIT", + "authors": [ + {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, + {"name": "Roman Borschel", "email": "roman@code-factory.org"}, + {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} + ], + "require": { + "php": ">=5.3.2" + }, + "autoload": { + "psr-0": { "Doctrine\\Common\\Lexer\\": "lib/" } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php b/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php new file mode 100644 index 0000000..399a552 --- /dev/null +++ b/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php @@ -0,0 +1,327 @@ +. + */ + +namespace Doctrine\Common\Lexer; + +/** + * Base class for writing simple lexers, i.e. for creating small DSLs. + * + * @since 2.0 + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + */ +abstract class AbstractLexer +{ + /** + * Lexer original input string. + * + * @var string + */ + private $input; + + /** + * Array of scanned tokens. + * + * Each token is an associative array containing three items: + * - 'value' : the string value of the token in the input string + * - 'type' : the type of the token (identifier, numeric, string, input + * parameter, none) + * - 'position' : the position of the token in the input string + * + * @var array + */ + private $tokens = array(); + + /** + * Current lexer position in input string. + * + * @var integer + */ + private $position = 0; + + /** + * Current peek of current lexer position. + * + * @var integer + */ + private $peek = 0; + + /** + * The next token in the input. + * + * @var array + */ + public $lookahead; + + /** + * The last matched/seen token. + * + * @var array + */ + public $token; + + /** + * Sets the input data to be tokenized. + * + * The Lexer is immediately reset and the new input tokenized. + * Any unprocessed tokens from any previous input are lost. + * + * @param string $input The input to be tokenized. + * + * @return void + */ + public function setInput($input) + { + $this->input = $input; + $this->tokens = array(); + + $this->reset(); + $this->scan($input); + } + + /** + * Resets the lexer. + * + * @return void + */ + public function reset() + { + $this->lookahead = null; + $this->token = null; + $this->peek = 0; + $this->position = 0; + } + + /** + * Resets the peek pointer to 0. + * + * @return void + */ + public function resetPeek() + { + $this->peek = 0; + } + + /** + * Resets the lexer position on the input to the given position. + * + * @param integer $position Position to place the lexical scanner. + * + * @return void + */ + public function resetPosition($position = 0) + { + $this->position = $position; + } + + /** + * Retrieve the original lexer's input until a given position. + * + * @param integer $position + * + * @return string + */ + public function getInputUntilPosition($position) + { + return substr($this->input, 0, $position); + } + + /** + * Checks whether a given token matches the current lookahead. + * + * @param integer|string $token + * + * @return boolean + */ + public function isNextToken($token) + { + return null !== $this->lookahead && $this->lookahead['type'] === $token; + } + + /** + * Checks whether any of the given tokens matches the current lookahead. + * + * @param array $tokens + * + * @return boolean + */ + public function isNextTokenAny(array $tokens) + { + return null !== $this->lookahead && in_array($this->lookahead['type'], $tokens, true); + } + + /** + * Moves to the next token in the input string. + * + * @return boolean + */ + public function moveNext() + { + $this->peek = 0; + $this->token = $this->lookahead; + $this->lookahead = (isset($this->tokens[$this->position])) + ? $this->tokens[$this->position++] : null; + + return $this->lookahead !== null; + } + + /** + * Tells the lexer to skip input tokens until it sees a token with the given value. + * + * @param string $type The token type to skip until. + * + * @return void + */ + public function skipUntil($type) + { + while ($this->lookahead !== null && $this->lookahead['type'] !== $type) { + $this->moveNext(); + } + } + + /** + * Checks if given value is identical to the given token. + * + * @param mixed $value + * @param integer $token + * + * @return boolean + */ + public function isA($value, $token) + { + return $this->getType($value) === $token; + } + + /** + * Moves the lookahead token forward. + * + * @return array|null The next token or NULL if there are no more tokens ahead. + */ + public function peek() + { + if (isset($this->tokens[$this->position + $this->peek])) { + return $this->tokens[$this->position + $this->peek++]; + } else { + return null; + } + } + + /** + * Peeks at the next token, returns it and immediately resets the peek. + * + * @return array|null The next token or NULL if there are no more tokens ahead. + */ + public function glimpse() + { + $peek = $this->peek(); + $this->peek = 0; + return $peek; + } + + /** + * Scans the input string for tokens. + * + * @param string $input A query string. + * + * @return void + */ + protected function scan($input) + { + static $regex; + + if ( ! isset($regex)) { + $regex = sprintf( + '/(%s)|%s/%s', + implode(')|(', $this->getCatchablePatterns()), + implode('|', $this->getNonCatchablePatterns()), + $this->getModifiers() + ); + } + + $flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE; + $matches = preg_split($regex, $input, -1, $flags); + + foreach ($matches as $match) { + // Must remain before 'value' assignment since it can change content + $type = $this->getType($match[0]); + + $this->tokens[] = array( + 'value' => $match[0], + 'type' => $type, + 'position' => $match[1], + ); + } + } + + /** + * Gets the literal for a given token. + * + * @param integer $token + * + * @return string + */ + public function getLiteral($token) + { + $className = get_class($this); + $reflClass = new \ReflectionClass($className); + $constants = $reflClass->getConstants(); + + foreach ($constants as $name => $value) { + if ($value === $token) { + return $className . '::' . $name; + } + } + + return $token; + } + + /** + * Regex modifiers + * + * @return string + */ + protected function getModifiers() + { + return 'i'; + } + + /** + * Lexical catchable patterns. + * + * @return array + */ + abstract protected function getCatchablePatterns(); + + /** + * Lexical non-catchable patterns. + * + * @return array + */ + abstract protected function getNonCatchablePatterns(); + + /** + * Retrieve token type. Also processes the token value if necessary. + * + * @param string $value + * + * @return integer + */ + abstract protected function getType(&$value); +} diff --git a/vendor/dragonmantank/cron-expression/.editorconfig b/vendor/dragonmantank/cron-expression/.editorconfig new file mode 100644 index 0000000..1492202 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/.editorconfig @@ -0,0 +1,16 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.yml] +indent_style = space +indent_size = 2 diff --git a/vendor/dragonmantank/cron-expression/CHANGELOG.md b/vendor/dragonmantank/cron-expression/CHANGELOG.md new file mode 100644 index 0000000..8cb3a08 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/CHANGELOG.md @@ -0,0 +1,66 @@ +# Change Log + +## [2.2.0] - 2018-06-05 +### Added +- Added support for steps larger than field ranges (#6) +## Changed +- N/A +### Fixed +- Fixed validation for numbers with leading 0s (#12) + +## [2.1.0] - 2018-04-06 +### Added +- N/A +### Changed +- Upgraded to PHPUnit 6 (#2) +### Fixed +- Refactored timezones to deal with some inconsistent behavior (#3) +- Allow ranges and lists in same expression (#5) +- Fixed regression where literals were not converted to their numerical counterpart (#) + +## [2.0.0] - 2017-10-12 +### Added +- N/A + +### Changed +- Dropped support for PHP 5.x +- Dropped support for the YEAR field, as it was not part of the cron standard + +### Fixed +- Reworked validation for all the field types +- Stepping should now work for 1-indexed fields like Month (#153) + +## [1.2.0] - 2017-01-22 +### Added +- Added IDE, CodeSniffer, and StyleCI.IO support + +### Changed +- Switched to PSR-4 Autoloading + +### Fixed +- 0 step expressions are handled better +- Fixed `DayOfMonth` validation to be more strict +- Typos + +## [1.1.0] - 2016-01-26 +### Added +- Support for non-hourly offset timezones +- Checks for valid expressions + +### Changed +- Max Iterations no longer hardcoded for `getRunDate()` +- Supports DateTimeImmutable for newer PHP verions + +### Fixed +- Fixed looping bug for PHP 7 when determining the last specified weekday of a month + +## [1.0.3] - 2013-11-23 +### Added +- Now supports expressions with any number of extra spaces, tabs, or newlines + +### Changed +- Using static instead of self in `CronExpression::factory` + +### Fixed +- Fixes issue [#28](https://github.com/mtdowling/cron-expression/issues/28) where PHP increments of ranges were failing due to PHP casting hyphens to 0 +- Only set default timezone if the given $currentTime is not a DateTime instance ([#34](https://github.com/mtdowling/cron-expression/issues/34)) diff --git a/vendor/dragonmantank/cron-expression/LICENSE b/vendor/dragonmantank/cron-expression/LICENSE new file mode 100644 index 0000000..3e38bbc --- /dev/null +++ b/vendor/dragonmantank/cron-expression/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2011 Michael Dowling , 2016 Chris Tankersley , and contributors + +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/dragonmantank/cron-expression/README.md b/vendor/dragonmantank/cron-expression/README.md new file mode 100644 index 0000000..67992c7 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/README.md @@ -0,0 +1,73 @@ +PHP Cron Expression Parser +========================== + +[![Latest Stable Version](https://poser.pugx.org/dragonmantank/cron-expression/v/stable.png)](https://packagist.org/packages/dragonmantank/cron-expression) [![Total Downloads](https://poser.pugx.org/dragonmantank/cron-expression/downloads.png)](https://packagist.org/packages/dragonmantank/cron-expression) [![Build Status](https://secure.travis-ci.org/dragonmantank/cron-expression.png)](http://travis-ci.org/dragonmantank/cron-expression) + +The PHP cron expression parser can parse a CRON expression, determine if it is +due to run, calculate the next run date of the expression, and calculate the previous +run date of the expression. You can calculate dates far into the future or past by +skipping n number of matching dates. + +The parser can handle increments of ranges (e.g. */12, 2-59/3), intervals (e.g. 0-9), +lists (e.g. 1,2,3), W to find the nearest weekday for a given day of the month, L to +find the last day of the month, L to find the last given weekday of a month, and hash +(#) to find the nth weekday of a given month. + +More information about this fork can be found in the blog post [here](http://ctankersley.com/2017/10/12/cron-expression-update/). tl;dr - v2.0.0 is a major breaking change, and @dragonmantank can better take care of the project in a separate fork. + +Installing +========== + +Add the dependency to your project: + +```bash +composer require dragonmantank/cron-expression +``` + +Usage +===== +```php +isDue(); +echo $cron->getNextRunDate()->format('Y-m-d H:i:s'); +echo $cron->getPreviousRunDate()->format('Y-m-d H:i:s'); + +// Works with complex expressions +$cron = Cron\CronExpression::factory('3-59/15 6-12 */15 1 2-5'); +echo $cron->getNextRunDate()->format('Y-m-d H:i:s'); + +// Calculate a run date two iterations into the future +$cron = Cron\CronExpression::factory('@daily'); +echo $cron->getNextRunDate(null, 2)->format('Y-m-d H:i:s'); + +// Calculate a run date relative to a specific time +$cron = Cron\CronExpression::factory('@monthly'); +echo $cron->getNextRunDate('2010-01-12 00:00:00')->format('Y-m-d H:i:s'); +``` + +CRON Expressions +================ + +A CRON expression is a string representing the schedule for a particular command to execute. The parts of a CRON schedule are as follows: + + * * * * * + - - - - - + | | | | | + | | | | | + | | | | +----- day of week (0 - 7) (Sunday=0 or 7) + | | | +---------- month (1 - 12) + | | +--------------- day of month (1 - 31) + | +-------------------- hour (0 - 23) + +------------------------- min (0 - 59) + +Requirements +============ + +- PHP 7.0+ +- PHPUnit is required to run the unit tests +- Composer is required to run the unit tests diff --git a/vendor/dragonmantank/cron-expression/composer.json b/vendor/dragonmantank/cron-expression/composer.json new file mode 100644 index 0000000..d9997ea --- /dev/null +++ b/vendor/dragonmantank/cron-expression/composer.json @@ -0,0 +1,35 @@ +{ + "name": "dragonmantank/cron-expression", + "type": "library", + "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due", + "keywords": ["cron", "schedule"], + "license": "MIT", + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Chris Tankersley", + "email": "chris@ctankersley.com", + "homepage": "https://github.com/dragonmantank" + } + ], + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.4" + }, + "autoload": { + "psr-4": { + "Cron\\": "src/Cron/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/Cron/" + } + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/AbstractField.php b/vendor/dragonmantank/cron-expression/src/Cron/AbstractField.php new file mode 100644 index 0000000..262ab63 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/AbstractField.php @@ -0,0 +1,278 @@ +fullRange = range($this->rangeStart, $this->rangeEnd); + } + + /** + * Check to see if a field is satisfied by a value + * + * @param string $dateValue Date value to check + * @param string $value Value to test + * + * @return bool + */ + public function isSatisfied($dateValue, $value) + { + if ($this->isIncrementsOfRanges($value)) { + return $this->isInIncrementsOfRanges($dateValue, $value); + } elseif ($this->isRange($value)) { + return $this->isInRange($dateValue, $value); + } + + return $value == '*' || $dateValue == $value; + } + + /** + * Check if a value is a range + * + * @param string $value Value to test + * + * @return bool + */ + public function isRange($value) + { + return strpos($value, '-') !== false; + } + + /** + * Check if a value is an increments of ranges + * + * @param string $value Value to test + * + * @return bool + */ + public function isIncrementsOfRanges($value) + { + return strpos($value, '/') !== false; + } + + /** + * Test if a value is within a range + * + * @param string $dateValue Set date value + * @param string $value Value to test + * + * @return bool + */ + public function isInRange($dateValue, $value) + { + $parts = array_map(function($value) { + $value = trim($value); + $value = $this->convertLiterals($value); + return $value; + }, + explode('-', $value, 2) + ); + + + return $dateValue >= $parts[0] && $dateValue <= $parts[1]; + } + + /** + * Test if a value is within an increments of ranges (offset[-to]/step size) + * + * @param string $dateValue Set date value + * @param string $value Value to test + * + * @return bool + */ + public function isInIncrementsOfRanges($dateValue, $value) + { + $chunks = array_map('trim', explode('/', $value, 2)); + $range = $chunks[0]; + $step = isset($chunks[1]) ? $chunks[1] : 0; + + // No step or 0 steps aren't cool + if (is_null($step) || '0' === $step || 0 === $step) { + return false; + } + + // Expand the * to a full range + if ('*' == $range) { + $range = $this->rangeStart . '-' . $this->rangeEnd; + } + + // Generate the requested small range + $rangeChunks = explode('-', $range, 2); + $rangeStart = $rangeChunks[0]; + $rangeEnd = isset($rangeChunks[1]) ? $rangeChunks[1] : $rangeStart; + + if ($rangeStart < $this->rangeStart || $rangeStart > $this->rangeEnd || $rangeStart > $rangeEnd) { + throw new \OutOfRangeException('Invalid range start requested'); + } + + if ($rangeEnd < $this->rangeStart || $rangeEnd > $this->rangeEnd || $rangeEnd < $rangeStart) { + throw new \OutOfRangeException('Invalid range end requested'); + } + + // Steps larger than the range need to wrap around and be handled slightly differently than smaller steps + if ($step >= $this->rangeEnd) { + $thisRange = [$this->fullRange[$step % count($this->fullRange)]]; + } else { + $thisRange = range($rangeStart, $rangeEnd, $step); + } + + return in_array($dateValue, $thisRange); + } + + /** + * Returns a range of values for the given cron expression + * + * @param string $expression The expression to evaluate + * @param int $max Maximum offset for range + * + * @return array + */ + public function getRangeForExpression($expression, $max) + { + $values = array(); + $expression = $this->convertLiterals($expression); + + if (strpos($expression, ',') !== false) { + $ranges = explode(',', $expression); + $values = []; + foreach ($ranges as $range) { + $expanded = $this->getRangeForExpression($range, $this->rangeEnd); + $values = array_merge($values, $expanded); + } + return $values; + } + + if ($this->isRange($expression) || $this->isIncrementsOfRanges($expression)) { + if (!$this->isIncrementsOfRanges($expression)) { + list ($offset, $to) = explode('-', $expression); + $offset = $this->convertLiterals($offset); + $to = $this->convertLiterals($to); + $stepSize = 1; + } + else { + $range = array_map('trim', explode('/', $expression, 2)); + $stepSize = isset($range[1]) ? $range[1] : 0; + $range = $range[0]; + $range = explode('-', $range, 2); + $offset = $range[0]; + $to = isset($range[1]) ? $range[1] : $max; + } + $offset = $offset == '*' ? $this->rangeStart : $offset; + if ($stepSize >= $this->rangeEnd) { + $values = [$this->fullRange[$stepSize % count($this->fullRange)]]; + } else { + for ($i = $offset; $i <= $to; $i += $stepSize) { + $values[] = (int)$i; + } + } + sort($values); + } + else { + $values = array($expression); + } + + return $values; + } + + protected function convertLiterals($value) + { + if (count($this->literals)) { + $key = array_search($value, $this->literals); + if ($key !== false) { + return $key; + } + } + + return $value; + } + + /** + * Checks to see if a value is valid for the field + * + * @param string $value + * @return bool + */ + public function validate($value) + { + $value = $this->convertLiterals($value); + + // All fields allow * as a valid value + if ('*' === $value) { + return true; + } + + if (strpos($value, '/') !== false) { + list($range, $step) = explode('/', $value); + return $this->validate($range) && filter_var($step, FILTER_VALIDATE_INT); + } + + // Validate each chunk of a list individually + if (strpos($value, ',') !== false) { + foreach (explode(',', $value) as $listItem) { + if (!$this->validate($listItem)) { + return false; + } + } + return true; + } + + if (strpos($value, '-') !== false) { + if (substr_count($value, '-') > 1) { + return false; + } + + $chunks = explode('-', $value); + $chunks[0] = $this->convertLiterals($chunks[0]); + $chunks[1] = $this->convertLiterals($chunks[1]); + + if ('*' == $chunks[0] || '*' == $chunks[1]) { + return false; + } + + return $this->validate($chunks[0]) && $this->validate($chunks[1]); + } + + if (!is_numeric($value)) { + return false; + } + + if (is_float($value) || strpos($value, '.') !== false) { + return false; + } + + // We should have a numeric by now, so coerce this into an integer + $value = (int) $value; + + return in_array($value, $this->fullRange, true); + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php b/vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php new file mode 100644 index 0000000..b7ba7da --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php @@ -0,0 +1,411 @@ + '0 0 1 1 *', + '@annually' => '0 0 1 1 *', + '@monthly' => '0 0 1 * *', + '@weekly' => '0 0 * * 0', + '@daily' => '0 0 * * *', + '@hourly' => '0 * * * *' + ); + + if (isset($mappings[$expression])) { + $expression = $mappings[$expression]; + } + + return new static($expression, $fieldFactory ?: new FieldFactory()); + } + + /** + * Validate a CronExpression. + * + * @param string $expression The CRON expression to validate. + * + * @return bool True if a valid CRON expression was passed. False if not. + * @see \Cron\CronExpression::factory + */ + public static function isValidExpression($expression) + { + try { + self::factory($expression); + } catch (InvalidArgumentException $e) { + return false; + } + + return true; + } + + /** + * Parse a CRON expression + * + * @param string $expression CRON expression (e.g. '8 * * * *') + * @param FieldFactory $fieldFactory Factory to create cron fields + */ + public function __construct($expression, FieldFactory $fieldFactory) + { + $this->fieldFactory = $fieldFactory; + $this->setExpression($expression); + } + + /** + * Set or change the CRON expression + * + * @param string $value CRON expression (e.g. 8 * * * *) + * + * @return CronExpression + * @throws \InvalidArgumentException if not a valid CRON expression + */ + public function setExpression($value) + { + $this->cronParts = preg_split('/\s/', $value, -1, PREG_SPLIT_NO_EMPTY); + if (count($this->cronParts) < 5) { + throw new InvalidArgumentException( + $value . ' is not a valid CRON expression' + ); + } + + foreach ($this->cronParts as $position => $part) { + $this->setPart($position, $part); + } + + return $this; + } + + /** + * Set part of the CRON expression + * + * @param int $position The position of the CRON expression to set + * @param string $value The value to set + * + * @return CronExpression + * @throws \InvalidArgumentException if the value is not valid for the part + */ + public function setPart($position, $value) + { + if (!$this->fieldFactory->getField($position)->validate($value)) { + throw new InvalidArgumentException( + 'Invalid CRON field value ' . $value . ' at position ' . $position + ); + } + + $this->cronParts[$position] = $value; + + return $this; + } + + /** + * Set max iteration count for searching next run dates + * + * @param int $maxIterationCount Max iteration count when searching for next run date + * + * @return CronExpression + */ + public function setMaxIterationCount($maxIterationCount) + { + $this->maxIterationCount = $maxIterationCount; + + return $this; + } + + /** + * Get a next run date relative to the current date or a specific date + * + * @param string|\DateTime $currentTime Relative calculation date + * @param int $nth Number of matches to skip before returning a + * matching next run date. 0, the default, will return the current + * date and time if the next run date falls on the current date and + * time. Setting this value to 1 will skip the first match and go to + * the second match. Setting this value to 2 will skip the first 2 + * matches and so on. + * @param bool $allowCurrentDate Set to TRUE to return the current date if + * it matches the cron expression. + * @param null|string $timeZone TimeZone to use instead of the system default + * + * @return \DateTime + * @throws \RuntimeException on too many iterations + */ + public function getNextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false, $timeZone = null) + { + return $this->getRunDate($currentTime, $nth, false, $allowCurrentDate, $timeZone); + } + + /** + * Get a previous run date relative to the current date or a specific date + * + * @param string|\DateTime $currentTime Relative calculation date + * @param int $nth Number of matches to skip before returning + * @param bool $allowCurrentDate Set to TRUE to return the + * current date if it matches the cron expression + * @param null|string $timeZone TimeZone to use instead of the system default + * + * @return \DateTime + * @throws \RuntimeException on too many iterations + * @see \Cron\CronExpression::getNextRunDate + */ + public function getPreviousRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false, $timeZone = null) + { + return $this->getRunDate($currentTime, $nth, true, $allowCurrentDate, $timeZone); + } + + /** + * Get multiple run dates starting at the current date or a specific date + * + * @param int $total Set the total number of dates to calculate + * @param string|\DateTime $currentTime Relative calculation date + * @param bool $invert Set to TRUE to retrieve previous dates + * @param bool $allowCurrentDate Set to TRUE to return the + * current date if it matches the cron expression + * @param null|string $timeZone TimeZone to use instead of the system default + * + * @return array Returns an array of run dates + */ + public function getMultipleRunDates($total, $currentTime = 'now', $invert = false, $allowCurrentDate = false, $timeZone = null) + { + $matches = array(); + for ($i = 0; $i < max(0, $total); $i++) { + try { + $matches[] = $this->getRunDate($currentTime, $i, $invert, $allowCurrentDate, $timeZone); + } catch (RuntimeException $e) { + break; + } + } + + return $matches; + } + + /** + * Get all or part of the CRON expression + * + * @param string $part Specify the part to retrieve or NULL to get the full + * cron schedule string. + * + * @return string|null Returns the CRON expression, a part of the + * CRON expression, or NULL if the part was specified but not found + */ + public function getExpression($part = null) + { + if (null === $part) { + return implode(' ', $this->cronParts); + } elseif (array_key_exists($part, $this->cronParts)) { + return $this->cronParts[$part]; + } + + return null; + } + + /** + * Helper method to output the full expression. + * + * @return string Full CRON expression + */ + public function __toString() + { + return $this->getExpression(); + } + + /** + * Determine if the cron is due to run based on the current date or a + * specific date. This method assumes that the current number of + * seconds are irrelevant, and should be called once per minute. + * + * @param string|\DateTime $currentTime Relative calculation date + * @param null|string $timeZone TimeZone to use instead of the system default + * + * @return bool Returns TRUE if the cron is due to run or FALSE if not + */ + public function isDue($currentTime = 'now', $timeZone = null) + { + $timeZone = $this->determineTimeZone($currentTime, $timeZone); + + if ('now' === $currentTime) { + $currentTime = new DateTime(); + } elseif ($currentTime instanceof DateTime) { + // + } elseif ($currentTime instanceof DateTimeImmutable) { + $currentTime = DateTime::createFromFormat('U', $currentTime->format('U')); + } else { + $currentTime = new DateTime($currentTime); + } + $currentTime->setTimeZone(new DateTimeZone($timeZone)); + + // drop the seconds to 0 + $currentTime = DateTime::createFromFormat('Y-m-d H:i', $currentTime->format('Y-m-d H:i')); + + try { + return $this->getNextRunDate($currentTime, 0, true)->getTimestamp() === $currentTime->getTimestamp(); + } catch (Exception $e) { + return false; + } + } + + /** + * Get the next or previous run date of the expression relative to a date + * + * @param string|\DateTime $currentTime Relative calculation date + * @param int $nth Number of matches to skip before returning + * @param bool $invert Set to TRUE to go backwards in time + * @param bool $allowCurrentDate Set to TRUE to return the + * current date if it matches the cron expression + * @param string|null $timeZone TimeZone to use instead of the system default + * + * @return \DateTime + * @throws \RuntimeException on too many iterations + */ + protected function getRunDate($currentTime = null, $nth = 0, $invert = false, $allowCurrentDate = false, $timeZone = null) + { + $timeZone = $this->determineTimeZone($currentTime, $timeZone); + + if ($currentTime instanceof DateTime) { + $currentDate = clone $currentTime; + } elseif ($currentTime instanceof DateTimeImmutable) { + $currentDate = DateTime::createFromFormat('U', $currentTime->format('U')); + } else { + $currentDate = new DateTime($currentTime ?: 'now'); + } + + $currentDate->setTimeZone(new DateTimeZone($timeZone)); + $currentDate->setTime($currentDate->format('H'), $currentDate->format('i'), 0); + $nextRun = clone $currentDate; + $nth = (int) $nth; + + // We don't have to satisfy * or null fields + $parts = array(); + $fields = array(); + foreach (self::$order as $position) { + $part = $this->getExpression($position); + if (null === $part || '*' === $part) { + continue; + } + $parts[$position] = $part; + $fields[$position] = $this->fieldFactory->getField($position); + } + + // Set a hard limit to bail on an impossible date + for ($i = 0; $i < $this->maxIterationCount; $i++) { + + foreach ($parts as $position => $part) { + $satisfied = false; + // Get the field object used to validate this part + $field = $fields[$position]; + // Check if this is singular or a list + if (strpos($part, ',') === false) { + $satisfied = $field->isSatisfiedBy($nextRun, $part); + } else { + foreach (array_map('trim', explode(',', $part)) as $listPart) { + if ($field->isSatisfiedBy($nextRun, $listPart)) { + $satisfied = true; + break; + } + } + } + + // If the field is not satisfied, then start over + if (!$satisfied) { + $field->increment($nextRun, $invert, $part); + continue 2; + } + } + + // Skip this match if needed + if ((!$allowCurrentDate && $nextRun == $currentDate) || --$nth > -1) { + $this->fieldFactory->getField(0)->increment($nextRun, $invert, isset($parts[0]) ? $parts[0] : null); + continue; + } + + return $nextRun; + } + + // @codeCoverageIgnoreStart + throw new RuntimeException('Impossible CRON expression'); + // @codeCoverageIgnoreEnd + } + + /** + * Workout what timeZone should be used. + * + * @param string|\DateTime $currentTime Relative calculation date + * @param string|null $timeZone TimeZone to use instead of the system default + * + * @return string + */ + protected function determineTimeZone($currentTime, $timeZone) + { + if (! is_null($timeZone)) { + return $timeZone; + } + + if ($currentTime instanceOf Datetime) { + return $currentTime->getTimeZone()->getName(); + } + + return date_default_timezone_get(); + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/DayOfMonthField.php b/vendor/dragonmantank/cron-expression/src/Cron/DayOfMonthField.php new file mode 100644 index 0000000..abf5969 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/DayOfMonthField.php @@ -0,0 +1,131 @@ + + */ +class DayOfMonthField extends AbstractField +{ + protected $rangeStart = 1; + protected $rangeEnd = 31; + + /** + * Get the nearest day of the week for a given day in a month + * + * @param int $currentYear Current year + * @param int $currentMonth Current month + * @param int $targetDay Target day of the month + * + * @return \DateTime Returns the nearest date + */ + private static function getNearestWeekday($currentYear, $currentMonth, $targetDay) + { + $tday = str_pad($targetDay, 2, '0', STR_PAD_LEFT); + $target = DateTime::createFromFormat('Y-m-d', "$currentYear-$currentMonth-$tday"); + $currentWeekday = (int) $target->format('N'); + + if ($currentWeekday < 6) { + return $target; + } + + $lastDayOfMonth = $target->format('t'); + + foreach (array(-1, 1, -2, 2) as $i) { + $adjusted = $targetDay + $i; + if ($adjusted > 0 && $adjusted <= $lastDayOfMonth) { + $target->setDate($currentYear, $currentMonth, $adjusted); + if ($target->format('N') < 6 && $target->format('m') == $currentMonth) { + return $target; + } + } + } + } + + public function isSatisfiedBy(DateTime $date, $value) + { + // ? states that the field value is to be skipped + if ($value == '?') { + return true; + } + + $fieldValue = $date->format('d'); + + // Check to see if this is the last day of the month + if ($value == 'L') { + return $fieldValue == $date->format('t'); + } + + // Check to see if this is the nearest weekday to a particular value + if (strpos($value, 'W')) { + // Parse the target day + $targetDay = substr($value, 0, strpos($value, 'W')); + // Find out if the current day is the nearest day of the week + return $date->format('j') == self::getNearestWeekday( + $date->format('Y'), + $date->format('m'), + $targetDay + )->format('j'); + } + + return $this->isSatisfied($date->format('d'), $value); + } + + public function increment(DateTime $date, $invert = false) + { + if ($invert) { + $date->modify('previous day'); + $date->setTime(23, 59); + } else { + $date->modify('next day'); + $date->setTime(0, 0); + } + + return $this; + } + + /** + * @inheritDoc + */ + public function validate($value) + { + $basicChecks = parent::validate($value); + + // Validate that a list don't have W or L + if (strpos($value, ',') !== false && (strpos($value, 'W') !== false || strpos($value, 'L') !== false)) { + return false; + } + + if (!$basicChecks) { + + if ($value === 'L') { + return true; + } + + if (preg_match('/^(.*)W$/', $value, $matches)) { + return $this->validate($matches[1]); + } + + return false; + } + + return $basicChecks; + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/DayOfWeekField.php b/vendor/dragonmantank/cron-expression/src/Cron/DayOfWeekField.php new file mode 100644 index 0000000..e178013 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/DayOfWeekField.php @@ -0,0 +1,170 @@ + 'MON', 2 => 'TUE', 3 => 'WED', 4 => 'THU', 5 => 'FRI', 6 => 'SAT', 7 => 'SUN']; + + public function __construct() + { + $this->nthRange = range(1, 5); + parent::__construct(); + } + + public function isSatisfiedBy(DateTime $date, $value) + { + if ($value == '?') { + return true; + } + + // Convert text day of the week values to integers + $value = $this->convertLiterals($value); + + $currentYear = $date->format('Y'); + $currentMonth = $date->format('m'); + $lastDayOfMonth = $date->format('t'); + + // Find out if this is the last specific weekday of the month + if (strpos($value, 'L')) { + $weekday = str_replace('7', '0', substr($value, 0, strpos($value, 'L'))); + $tdate = clone $date; + $tdate->setDate($currentYear, $currentMonth, $lastDayOfMonth); + while ($tdate->format('w') != $weekday) { + $tdateClone = new DateTime(); + $tdate = $tdateClone + ->setTimezone($tdate->getTimezone()) + ->setDate($currentYear, $currentMonth, --$lastDayOfMonth); + } + + return $date->format('j') == $lastDayOfMonth; + } + + // Handle # hash tokens + if (strpos($value, '#')) { + list($weekday, $nth) = explode('#', $value); + + if (!is_numeric($nth)) { + throw new InvalidArgumentException("Hashed weekdays must be numeric, {$nth} given"); + } else { + $nth = (int) $nth; + } + + // 0 and 7 are both Sunday, however 7 matches date('N') format ISO-8601 + if ($weekday === '0') { + $weekday = 7; + } + + $weekday = $this->convertLiterals($weekday); + + // Validate the hash fields + if ($weekday < 0 || $weekday > 7) { + throw new InvalidArgumentException("Weekday must be a value between 0 and 7. {$weekday} given"); + } + + if (!in_array($nth, $this->nthRange)) { + throw new InvalidArgumentException("There are never more than 5 or less than 1 of a given weekday in a month, {$nth} given"); + } + + // The current weekday must match the targeted weekday to proceed + if ($date->format('N') != $weekday) { + return false; + } + + $tdate = clone $date; + $tdate->setDate($currentYear, $currentMonth, 1); + $dayCount = 0; + $currentDay = 1; + while ($currentDay < $lastDayOfMonth + 1) { + if ($tdate->format('N') == $weekday) { + if (++$dayCount >= $nth) { + break; + } + } + $tdate->setDate($currentYear, $currentMonth, ++$currentDay); + } + + return $date->format('j') == $currentDay; + } + + // Handle day of the week values + if (strpos($value, '-')) { + $parts = explode('-', $value); + if ($parts[0] == '7') { + $parts[0] = '0'; + } elseif ($parts[1] == '0') { + $parts[1] = '7'; + } + $value = implode('-', $parts); + } + + // Test to see which Sunday to use -- 0 == 7 == Sunday + $format = in_array(7, str_split($value)) ? 'N' : 'w'; + $fieldValue = $date->format($format); + + return $this->isSatisfied($fieldValue, $value); + } + + public function increment(DateTime $date, $invert = false) + { + if ($invert) { + $date->modify('-1 day'); + $date->setTime(23, 59, 0); + } else { + $date->modify('+1 day'); + $date->setTime(0, 0, 0); + } + + return $this; + } + + /** + * @inheritDoc + */ + public function validate($value) + { + $basicChecks = parent::validate($value); + + if (!$basicChecks) { + // Handle the # value + if (strpos($value, '#') !== false) { + $chunks = explode('#', $value); + $chunks[0] = $this->convertLiterals($chunks[0]); + + if (parent::validate($chunks[0]) && is_numeric($chunks[1]) && in_array($chunks[1], $this->nthRange)) { + return true; + } + } + + if (preg_match('/^(.*)L$/', $value, $matches)) { + return $this->validate($matches[1]); + } + + return false; + } + + return $basicChecks; + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/FieldFactory.php b/vendor/dragonmantank/cron-expression/src/Cron/FieldFactory.php new file mode 100644 index 0000000..fd27352 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/FieldFactory.php @@ -0,0 +1,54 @@ +fields[$position])) { + switch ($position) { + case 0: + $this->fields[$position] = new MinutesField(); + break; + case 1: + $this->fields[$position] = new HoursField(); + break; + case 2: + $this->fields[$position] = new DayOfMonthField(); + break; + case 3: + $this->fields[$position] = new MonthField(); + break; + case 4: + $this->fields[$position] = new DayOfWeekField(); + break; + default: + throw new InvalidArgumentException( + $position . ' is not a valid position' + ); + } + } + + return $this->fields[$position]; + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/FieldInterface.php b/vendor/dragonmantank/cron-expression/src/Cron/FieldInterface.php new file mode 100644 index 0000000..be37b93 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/FieldInterface.php @@ -0,0 +1,40 @@ +isSatisfied($date->format('H'), $value); + } + + public function increment(DateTime $date, $invert = false, $parts = null) + { + // Change timezone to UTC temporarily. This will + // allow us to go back or forwards and hour even + // if DST will be changed between the hours. + if (is_null($parts) || $parts == '*') { + $timezone = $date->getTimezone(); + $date->setTimezone(new DateTimeZone('UTC')); + if ($invert) { + $date->modify('-1 hour'); + } else { + $date->modify('+1 hour'); + } + $date->setTimezone($timezone); + + $date->setTime($date->format('H'), $invert ? 59 : 0); + return $this; + } + + $parts = strpos($parts, ',') !== false ? explode(',', $parts) : array($parts); + $hours = array(); + foreach ($parts as $part) { + $hours = array_merge($hours, $this->getRangeForExpression($part, 23)); + } + + $current_hour = $date->format('H'); + $position = $invert ? count($hours) - 1 : 0; + if (count($hours) > 1) { + for ($i = 0; $i < count($hours) - 1; $i++) { + if ((!$invert && $current_hour >= $hours[$i] && $current_hour < $hours[$i + 1]) || + ($invert && $current_hour > $hours[$i] && $current_hour <= $hours[$i + 1])) { + $position = $invert ? $i : $i + 1; + break; + } + } + } + + $hour = $hours[$position]; + if ((!$invert && $date->format('H') >= $hour) || ($invert && $date->format('H') <= $hour)) { + $date->modify(($invert ? '-' : '+') . '1 day'); + $date->setTime($invert ? 23 : 0, $invert ? 59 : 0); + } + else { + $date->setTime($hour, $invert ? 59 : 0); + } + + return $this; + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/MinutesField.php b/vendor/dragonmantank/cron-expression/src/Cron/MinutesField.php new file mode 100644 index 0000000..59bb386 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/MinutesField.php @@ -0,0 +1,60 @@ +isSatisfied($date->format('i'), $value); + } + + public function increment(DateTime $date, $invert = false, $parts = null) + { + if (is_null($parts)) { + if ($invert) { + $date->modify('-1 minute'); + } else { + $date->modify('+1 minute'); + } + return $this; + } + + $parts = strpos($parts, ',') !== false ? explode(',', $parts) : array($parts); + $minutes = array(); + foreach ($parts as $part) { + $minutes = array_merge($minutes, $this->getRangeForExpression($part, 59)); + } + + $current_minute = $date->format('i'); + $position = $invert ? count($minutes) - 1 : 0; + if (count($minutes) > 1) { + for ($i = 0; $i < count($minutes) - 1; $i++) { + if ((!$invert && $current_minute >= $minutes[$i] && $current_minute < $minutes[$i + 1]) || + ($invert && $current_minute > $minutes[$i] && $current_minute <= $minutes[$i + 1])) { + $position = $invert ? $i : $i + 1; + break; + } + } + } + + if ((!$invert && $current_minute >= $minutes[$position]) || ($invert && $current_minute <= $minutes[$position])) { + $date->modify(($invert ? '-' : '+') . '1 hour'); + $date->setTime($date->format('H'), $invert ? 59 : 0); + } + else { + $date->setTime($date->format('H'), $minutes[$position]); + } + + return $this; + } +} diff --git a/vendor/dragonmantank/cron-expression/src/Cron/MonthField.php b/vendor/dragonmantank/cron-expression/src/Cron/MonthField.php new file mode 100644 index 0000000..79fdf3c --- /dev/null +++ b/vendor/dragonmantank/cron-expression/src/Cron/MonthField.php @@ -0,0 +1,38 @@ + 'JAN', 2 => 'FEB', 3 => 'MAR', 4 => 'APR', 5 => 'MAY', 6 => 'JUN', 7 => 'JUL', + 8 => 'AUG', 9 => 'SEP', 10 => 'OCT', 11 => 'NOV', 12 => 'DEC']; + + public function isSatisfiedBy(DateTime $date, $value) + { + $value = $this->convertLiterals($value); + + return $this->isSatisfied($date->format('m'), $value); + } + + public function increment(DateTime $date, $invert = false) + { + if ($invert) { + $date->modify('last day of previous month'); + $date->setTime(23, 59); + } else { + $date->modify('first day of next month'); + $date->setTime(0, 0); + } + + return $this; + } + + +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/AbstractFieldTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/AbstractFieldTest.php new file mode 100644 index 0000000..3811439 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/AbstractFieldTest.php @@ -0,0 +1,139 @@ + + */ +class AbstractFieldTest extends TestCase +{ + /** + * @covers \Cron\AbstractField::isRange + */ + public function testTestsIfRange() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->isRange('1-2')); + $this->assertFalse($f->isRange('2')); + } + + /** + * @covers \Cron\AbstractField::isIncrementsOfRanges + */ + public function testTestsIfIncrementsOfRanges() + { + $f = new DayOfWeekField(); + $this->assertFalse($f->isIncrementsOfRanges('1-2')); + $this->assertTrue($f->isIncrementsOfRanges('1/2')); + $this->assertTrue($f->isIncrementsOfRanges('*/2')); + $this->assertTrue($f->isIncrementsOfRanges('3-12/2')); + } + + /** + * @covers \Cron\AbstractField::isInRange + */ + public function testTestsIfInRange() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->isInRange('1', '1-2')); + $this->assertTrue($f->isInRange('2', '1-2')); + $this->assertTrue($f->isInRange('5', '4-12')); + $this->assertFalse($f->isInRange('3', '4-12')); + $this->assertFalse($f->isInRange('13', '4-12')); + } + + /** + * @covers \Cron\AbstractField::isInIncrementsOfRanges + */ + public function testTestsIfInIncrementsOfRangesOnZeroStartRange() + { + $f = new MinutesField(); + $this->assertTrue($f->isInIncrementsOfRanges('3', '3-59/2')); + $this->assertTrue($f->isInIncrementsOfRanges('13', '3-59/2')); + $this->assertTrue($f->isInIncrementsOfRanges('15', '3-59/2')); + $this->assertTrue($f->isInIncrementsOfRanges('14', '*/2')); + $this->assertFalse($f->isInIncrementsOfRanges('2', '3-59/13')); + $this->assertFalse($f->isInIncrementsOfRanges('14', '*/13')); + $this->assertFalse($f->isInIncrementsOfRanges('14', '3-59/2')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '2-59')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '2')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '*')); + $this->assertFalse($f->isInIncrementsOfRanges('0', '*/0')); + $this->assertFalse($f->isInIncrementsOfRanges('1', '*/0')); + + $this->assertTrue($f->isInIncrementsOfRanges('4', '4/1')); + $this->assertFalse($f->isInIncrementsOfRanges('14', '4/1')); + $this->assertFalse($f->isInIncrementsOfRanges('34', '4/1')); + } + + /** + * @covers \Cron\AbstractField::isInIncrementsOfRanges + */ + public function testTestsIfInIncrementsOfRangesOnOneStartRange() + { + $f = new MonthField(); + $this->assertTrue($f->isInIncrementsOfRanges('3', '3-12/2')); + $this->assertFalse($f->isInIncrementsOfRanges('13', '3-12/2')); + $this->assertFalse($f->isInIncrementsOfRanges('15', '3-12/2')); + $this->assertTrue($f->isInIncrementsOfRanges('3', '*/2')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '*/3')); + $this->assertTrue($f->isInIncrementsOfRanges('7', '*/3')); + $this->assertFalse($f->isInIncrementsOfRanges('14', '3-12/2')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '2-12')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '2')); + $this->assertFalse($f->isInIncrementsOfRanges('3', '*')); + $this->assertFalse($f->isInIncrementsOfRanges('0', '*/0')); + $this->assertFalse($f->isInIncrementsOfRanges('1', '*/0')); + + $this->assertTrue($f->isInIncrementsOfRanges('4', '4/1')); + $this->assertFalse($f->isInIncrementsOfRanges('14', '4/1')); + $this->assertFalse($f->isInIncrementsOfRanges('34', '4/1')); + } + + /** + * @covers \Cron\AbstractField::isSatisfied + */ + public function testTestsIfSatisfied() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->isSatisfied('12', '3-13')); + $this->assertFalse($f->isSatisfied('15', '3-7/2')); + $this->assertTrue($f->isSatisfied('12', '*')); + $this->assertTrue($f->isSatisfied('12', '12')); + $this->assertFalse($f->isSatisfied('12', '3-11')); + $this->assertFalse($f->isSatisfied('12', '3-7/2')); + $this->assertFalse($f->isSatisfied('12', '11')); + } + + /** + * Allows ranges and lists to coexist in the same expression + * + * @see https://github.com/dragonmantank/cron-expression/issues/5 + */ + public function testAllowRangesAndLists() + { + $expression = '5-7,11-13'; + $f = new HoursField(); + $this->assertTrue($f->validate($expression)); + } + + /** + * Makes sure that various types of ranges expand out properly + * + * @see https://github.com/dragonmantank/cron-expression/issues/5 + */ + public function testGetRangeForExpressionExpandsCorrectly() + { + $f = new HoursField(); + $this->assertSame([5, 6, 7, 11, 12, 13], $f->getRangeForExpression('5-7,11-13', 23)); + $this->assertSame(['5', '6', '7', '11', '12', '13'], $f->getRangeForExpression('5,6,7,11,12,13', 23)); + $this->assertSame([0, 6, 12, 18], $f->getRangeForExpression('*/6', 23)); + $this->assertSame([5, 11], $f->getRangeForExpression('5-13/6', 23)); + } +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/CronExpressionTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/CronExpressionTest.php new file mode 100644 index 0000000..5d46644 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/CronExpressionTest.php @@ -0,0 +1,560 @@ + + */ +class CronExpressionTest extends TestCase +{ + /** + * @covers \Cron\CronExpression::factory + */ + public function testFactoryRecognizesTemplates() + { + $this->assertSame('0 0 1 1 *', CronExpression::factory('@annually')->getExpression()); + $this->assertSame('0 0 1 1 *', CronExpression::factory('@yearly')->getExpression()); + $this->assertSame('0 0 * * 0', CronExpression::factory('@weekly')->getExpression()); + } + + /** + * @covers \Cron\CronExpression::__construct + * @covers \Cron\CronExpression::getExpression + * @covers \Cron\CronExpression::__toString + */ + public function testParsesCronSchedule() + { + // '2010-09-10 12:00:00' + $cron = CronExpression::factory('1 2-4 * 4,5,6 */3'); + $this->assertSame('1', $cron->getExpression(CronExpression::MINUTE)); + $this->assertSame('2-4', $cron->getExpression(CronExpression::HOUR)); + $this->assertSame('*', $cron->getExpression(CronExpression::DAY)); + $this->assertSame('4,5,6', $cron->getExpression(CronExpression::MONTH)); + $this->assertSame('*/3', $cron->getExpression(CronExpression::WEEKDAY)); + $this->assertSame('1 2-4 * 4,5,6 */3', $cron->getExpression()); + $this->assertSame('1 2-4 * 4,5,6 */3', (string) $cron); + $this->assertNull($cron->getExpression('foo')); + } + + /** + * @covers \Cron\CronExpression::__construct + * @covers \Cron\CronExpression::getExpression + * @covers \Cron\CronExpression::__toString + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Invalid CRON field value A at position 0 + */ + public function testParsesCronScheduleThrowsAnException() + { + CronExpression::factory('A 1 2 3 4'); + } + + /** + * @covers \Cron\CronExpression::__construct + * @covers \Cron\CronExpression::getExpression + * @dataProvider scheduleWithDifferentSeparatorsProvider + */ + public function testParsesCronScheduleWithAnySpaceCharsAsSeparators($schedule, array $expected) + { + $cron = CronExpression::factory($schedule); + $this->assertSame($expected[0], $cron->getExpression(CronExpression::MINUTE)); + $this->assertSame($expected[1], $cron->getExpression(CronExpression::HOUR)); + $this->assertSame($expected[2], $cron->getExpression(CronExpression::DAY)); + $this->assertSame($expected[3], $cron->getExpression(CronExpression::MONTH)); + $this->assertSame($expected[4], $cron->getExpression(CronExpression::WEEKDAY)); + } + + /** + * Data provider for testParsesCronScheduleWithAnySpaceCharsAsSeparators + * + * @return array + */ + public static function scheduleWithDifferentSeparatorsProvider() + { + return array( + array("*\t*\t*\t*\t*\t", array('*', '*', '*', '*', '*', '*')), + array("* * * * * ", array('*', '*', '*', '*', '*', '*')), + array("* \t * \t * \t * \t * \t", array('*', '*', '*', '*', '*', '*')), + array("*\t \t*\t \t*\t \t*\t \t*\t \t", array('*', '*', '*', '*', '*', '*')), + ); + } + + /** + * @covers \Cron\CronExpression::__construct + * @covers \Cron\CronExpression::setExpression + * @covers \Cron\CronExpression::setPart + * @expectedException InvalidArgumentException + */ + public function testInvalidCronsWillFail() + { + // Only four values + $cron = CronExpression::factory('* * * 1'); + } + + /** + * @covers \Cron\CronExpression::setPart + * @expectedException InvalidArgumentException + */ + public function testInvalidPartsWillFail() + { + // Only four values + $cron = CronExpression::factory('* * * * *'); + $cron->setPart(1, 'abc'); + } + + /** + * Data provider for cron schedule + * + * @return array + */ + public function scheduleProvider() + { + return array( + array('*/2 */2 * * *', '2015-08-10 21:47:27', '2015-08-10 22:00:00', false), + array('* * * * *', '2015-08-10 21:50:37', '2015-08-10 21:50:00', true), + array('* 20,21,22 * * *', '2015-08-10 21:50:00', '2015-08-10 21:50:00', true), + // Handles CSV values + array('* 20,22 * * *', '2015-08-10 21:50:00', '2015-08-10 22:00:00', false), + // CSV values can be complex + array('7-9 * */9 * *', '2015-08-10 22:02:33', '2015-08-10 22:07:00', false), + // 15th minute, of the second hour, every 15 days, in January, every Friday + array('1 * * * 7', '2015-08-10 21:47:27', '2015-08-16 00:01:00', false), + // Test with exact times + array('47 21 * * *', strtotime('2015-08-10 21:47:30'), '2015-08-10 21:47:00', true), + // Test Day of the week (issue #1) + // According cron implementation, 0|7 = sunday, 1 => monday, etc + array('* * * * 0', strtotime('2011-06-15 23:09:00'), '2011-06-19 00:00:00', false), + array('* * * * 7', strtotime('2011-06-15 23:09:00'), '2011-06-19 00:00:00', false), + array('* * * * 1', strtotime('2011-06-15 23:09:00'), '2011-06-20 00:00:00', false), + // Should return the sunday date as 7 equals 0 + array('0 0 * * MON,SUN', strtotime('2011-06-15 23:09:00'), '2011-06-19 00:00:00', false), + array('0 0 * * 1,7', strtotime('2011-06-15 23:09:00'), '2011-06-19 00:00:00', false), + array('0 0 * * 0-4', strtotime('2011-06-15 23:09:00'), '2011-06-16 00:00:00', false), + array('0 0 * * 7-4', strtotime('2011-06-15 23:09:00'), '2011-06-16 00:00:00', false), + array('0 0 * * 4-7', strtotime('2011-06-15 23:09:00'), '2011-06-16 00:00:00', false), + array('0 0 * * 7-3', strtotime('2011-06-15 23:09:00'), '2011-06-19 00:00:00', false), + array('0 0 * * 3-7', strtotime('2011-06-15 23:09:00'), '2011-06-16 00:00:00', false), + array('0 0 * * 3-7', strtotime('2011-06-18 23:09:00'), '2011-06-19 00:00:00', false), + // Test lists of values and ranges (Abhoryo) + array('0 0 * * 2-7', strtotime('2011-06-20 23:09:00'), '2011-06-21 00:00:00', false), + array('0 0 * * 2-7', strtotime('2011-06-18 23:09:00'), '2011-06-19 00:00:00', false), + array('0 0 * * 4-7', strtotime('2011-07-19 00:00:00'), '2011-07-21 00:00:00', false), + // Test increments of ranges + array('0-12/4 * * * *', strtotime('2011-06-20 12:04:00'), '2011-06-20 12:04:00', true), + array('4-59/2 * * * *', strtotime('2011-06-20 12:04:00'), '2011-06-20 12:04:00', true), + array('4-59/2 * * * *', strtotime('2011-06-20 12:06:00'), '2011-06-20 12:06:00', true), + array('4-59/3 * * * *', strtotime('2011-06-20 12:06:00'), '2011-06-20 12:07:00', false), + // Test Day of the Week and the Day of the Month (issue #1) + array('0 0 1 1 0', strtotime('2011-06-15 23:09:00'), '2012-01-01 00:00:00', false), + array('0 0 1 JAN 0', strtotime('2011-06-15 23:09:00'), '2012-01-01 00:00:00', false), + array('0 0 1 * 0', strtotime('2011-06-15 23:09:00'), '2012-01-01 00:00:00', false), + // Test the W day of the week modifier for day of the month field + array('0 0 2W * *', strtotime('2011-07-01 00:00:00'), '2011-07-01 00:00:00', true), + array('0 0 1W * *', strtotime('2011-05-01 00:00:00'), '2011-05-02 00:00:00', false), + array('0 0 1W * *', strtotime('2011-07-01 00:00:00'), '2011-07-01 00:00:00', true), + array('0 0 3W * *', strtotime('2011-07-01 00:00:00'), '2011-07-04 00:00:00', false), + array('0 0 16W * *', strtotime('2011-07-01 00:00:00'), '2011-07-15 00:00:00', false), + array('0 0 28W * *', strtotime('2011-07-01 00:00:00'), '2011-07-28 00:00:00', false), + array('0 0 30W * *', strtotime('2011-07-01 00:00:00'), '2011-07-29 00:00:00', false), + array('0 0 31W * *', strtotime('2011-07-01 00:00:00'), '2011-07-29 00:00:00', false), + // Test the last weekday of a month + array('* * * * 5L', strtotime('2011-07-01 00:00:00'), '2011-07-29 00:00:00', false), + array('* * * * 6L', strtotime('2011-07-01 00:00:00'), '2011-07-30 00:00:00', false), + array('* * * * 7L', strtotime('2011-07-01 00:00:00'), '2011-07-31 00:00:00', false), + array('* * * * 1L', strtotime('2011-07-24 00:00:00'), '2011-07-25 00:00:00', false), + array('* * * 1 5L', strtotime('2011-12-25 00:00:00'), '2012-01-27 00:00:00', false), + // Test the hash symbol for the nth weekday of a given month + array('* * * * 5#2', strtotime('2011-07-01 00:00:00'), '2011-07-08 00:00:00', false), + array('* * * * 5#1', strtotime('2011-07-01 00:00:00'), '2011-07-01 00:00:00', true), + array('* * * * 3#4', strtotime('2011-07-01 00:00:00'), '2011-07-27 00:00:00', false), + + // Issue #7, documented example failed + ['3-59/15 6-12 */15 1 2-5', strtotime('2017-01-08 00:00:00'), '2017-01-31 06:03:00', false], + + // https://github.com/laravel/framework/commit/07d160ac3cc9764d5b429734ffce4fa311385403 + ['* * * * MON-FRI', strtotime('2017-01-08 00:00:00'), strtotime('2017-01-09 00:00:00'), false], + ['* * * * TUE', strtotime('2017-01-08 00:00:00'), strtotime('2017-01-10 00:00:00'), false], + ); + } + + /** + * @covers \Cron\CronExpression::isDue + * @covers \Cron\CronExpression::getNextRunDate + * @covers \Cron\DayOfMonthField + * @covers \Cron\DayOfWeekField + * @covers \Cron\MinutesField + * @covers \Cron\HoursField + * @covers \Cron\MonthField + * @covers \Cron\CronExpression::getRunDate + * @dataProvider scheduleProvider + */ + public function testDeterminesIfCronIsDue($schedule, $relativeTime, $nextRun, $isDue) + { + $relativeTimeString = is_int($relativeTime) ? date('Y-m-d H:i:s', $relativeTime) : $relativeTime; + + // Test next run date + $cron = CronExpression::factory($schedule); + if (is_string($relativeTime)) { + $relativeTime = new DateTime($relativeTime); + } elseif (is_int($relativeTime)) { + $relativeTime = date('Y-m-d H:i:s', $relativeTime); + } + + if (is_string($nextRun)) { + $nextRunDate = new DateTime($nextRun); + } elseif (is_int($nextRun)) { + $nextRunDate = new DateTime(); + $nextRunDate->setTimestamp($nextRun); + } + $this->assertSame($isDue, $cron->isDue($relativeTime)); + $next = $cron->getNextRunDate($relativeTime, 0, true); + + $this->assertEquals($nextRunDate, $next); + } + + /** + * @covers \Cron\CronExpression::isDue + */ + public function testIsDueHandlesDifferentDates() + { + $cron = CronExpression::factory('* * * * *'); + $this->assertTrue($cron->isDue()); + $this->assertTrue($cron->isDue('now')); + $this->assertTrue($cron->isDue(new DateTime('now'))); + $this->assertTrue($cron->isDue(date('Y-m-d H:i'))); + } + + /** + * @covers \Cron\CronExpression::isDue + */ + public function testIsDueHandlesDifferentDefaultTimezones() + { + $originalTimezone = date_default_timezone_get(); + $cron = CronExpression::factory('0 15 * * 3'); //Wednesday at 15:00 + $date = '2014-01-01 15:00'; //Wednesday + + date_default_timezone_set('UTC'); + $this->assertTrue($cron->isDue(new DateTime($date), 'UTC')); + $this->assertFalse($cron->isDue(new DateTime($date), 'Europe/Amsterdam')); + $this->assertFalse($cron->isDue(new DateTime($date), 'Asia/Tokyo')); + + date_default_timezone_set('Europe/Amsterdam'); + $this->assertFalse($cron->isDue(new DateTime($date), 'UTC')); + $this->assertTrue($cron->isDue(new DateTime($date), 'Europe/Amsterdam')); + $this->assertFalse($cron->isDue(new DateTime($date), 'Asia/Tokyo')); + + date_default_timezone_set('Asia/Tokyo'); + $this->assertFalse($cron->isDue(new DateTime($date), 'UTC')); + $this->assertFalse($cron->isDue(new DateTime($date), 'Europe/Amsterdam')); + $this->assertTrue($cron->isDue(new DateTime($date), 'Asia/Tokyo')); + + date_default_timezone_set($originalTimezone); + } + + /** + * @covers \Cron\CronExpression::isDue + */ + public function testIsDueHandlesDifferentSuppliedTimezones() + { + $cron = CronExpression::factory('0 15 * * 3'); //Wednesday at 15:00 + $date = '2014-01-01 15:00'; //Wednesday + + $this->assertTrue($cron->isDue(new DateTime($date, new DateTimeZone('UTC')), 'UTC')); + $this->assertFalse($cron->isDue(new DateTime($date, new DateTimeZone('UTC')), 'Europe/Amsterdam')); + $this->assertFalse($cron->isDue(new DateTime($date, new DateTimeZone('UTC')), 'Asia/Tokyo')); + + $this->assertFalse($cron->isDue(new DateTime($date, new DateTimeZone('Europe/Amsterdam')), 'UTC')); + $this->assertTrue($cron->isDue(new DateTime($date, new DateTimeZone('Europe/Amsterdam')), 'Europe/Amsterdam')); + $this->assertFalse($cron->isDue(new DateTime($date, new DateTimeZone('Europe/Amsterdam')), 'Asia/Tokyo')); + + $this->assertFalse($cron->isDue(new DateTime($date, new DateTimeZone('Asia/Tokyo')), 'UTC')); + $this->assertFalse($cron->isDue(new DateTime($date, new DateTimeZone('Asia/Tokyo')), 'Europe/Amsterdam')); + $this->assertTrue($cron->isDue(new DateTime($date, new DateTimeZone('Asia/Tokyo')), 'Asia/Tokyo')); + } + + /** + * @covers Cron\CronExpression::isDue + */ + public function testIsDueHandlesDifferentTimezonesAsArgument() + { + $cron = CronExpression::factory('0 15 * * 3'); //Wednesday at 15:00 + $date = '2014-01-01 15:00'; //Wednesday + $utc = new \DateTimeZone('UTC'); + $amsterdam = new \DateTimeZone('Europe/Amsterdam'); + $tokyo = new \DateTimeZone('Asia/Tokyo'); + $this->assertTrue($cron->isDue(new DateTime($date, $utc), 'UTC')); + $this->assertFalse($cron->isDue(new DateTime($date, $amsterdam), 'UTC')); + $this->assertFalse($cron->isDue(new DateTime($date, $tokyo), 'UTC')); + $this->assertFalse($cron->isDue(new DateTime($date, $utc), 'Europe/Amsterdam')); + $this->assertTrue($cron->isDue(new DateTime($date, $amsterdam), 'Europe/Amsterdam')); + $this->assertFalse($cron->isDue(new DateTime($date, $tokyo), 'Europe/Amsterdam')); + $this->assertFalse($cron->isDue(new DateTime($date, $utc), 'Asia/Tokyo')); + $this->assertFalse($cron->isDue(new DateTime($date, $amsterdam), 'Asia/Tokyo')); + $this->assertTrue($cron->isDue(new DateTime($date, $tokyo), 'Asia/Tokyo')); + } + + /** + * @covers Cron\CronExpression::isDue + */ + public function testRecognisesTimezonesAsPartOfDateTime() + { + $cron = CronExpression::factory("0 7 * * *"); + $tzCron = "America/New_York"; + $tzServer = new \DateTimeZone("Europe/London"); + + $dtCurrent = \DateTime::createFromFormat("!Y-m-d H:i:s", "2017-10-17 10:00:00", $tzServer); + $dtPrev = $cron->getPreviousRunDate($dtCurrent, 0, true, $tzCron); + $this->assertEquals('1508151600 : 2017-10-16T07:00:00-04:00 : America/New_York', $dtPrev->format("U \: c \: e")); + + $dtCurrent = \DateTimeImmutable::createFromFormat("!Y-m-d H:i:s", "2017-10-17 10:00:00", $tzServer); + $dtPrev = $cron->getPreviousRunDate($dtCurrent, 0, true, $tzCron); + $this->assertEquals('1508151600 : 2017-10-16T07:00:00-04:00 : America/New_York', $dtPrev->format("U \: c \: e")); + + $dtCurrent = \DateTimeImmutable::createFromFormat("!Y-m-d H:i:s", "2017-10-17 10:00:00", $tzServer); + $dtPrev = $cron->getPreviousRunDate($dtCurrent->format("c"), 0, true, $tzCron); + $this->assertEquals('1508151600 : 2017-10-16T07:00:00-04:00 : America/New_York', $dtPrev->format("U \: c \: e")); + + $dtCurrent = \DateTimeImmutable::createFromFormat("!Y-m-d H:i:s", "2017-10-17 10:00:00", $tzServer); + $dtPrev = $cron->getPreviousRunDate($dtCurrent->format("\@U"), 0, true, $tzCron); + $this->assertEquals('1508151600 : 2017-10-16T07:00:00-04:00 : America/New_York', $dtPrev->format("U \: c \: e")); + + } + + + /** + * @covers \Cron\CronExpression::getPreviousRunDate + */ + public function testCanGetPreviousRunDates() + { + $cron = CronExpression::factory('* * * * *'); + $next = $cron->getNextRunDate('now'); + $two = $cron->getNextRunDate('now', 1); + $this->assertEquals($next, $cron->getPreviousRunDate($two)); + + $cron = CronExpression::factory('* */2 * * *'); + $next = $cron->getNextRunDate('now'); + $two = $cron->getNextRunDate('now', 1); + $this->assertEquals($next, $cron->getPreviousRunDate($two)); + + $cron = CronExpression::factory('* * * */2 *'); + $next = $cron->getNextRunDate('now'); + $two = $cron->getNextRunDate('now', 1); + $this->assertEquals($next, $cron->getPreviousRunDate($two)); + } + + /** + * @covers \Cron\CronExpression::getMultipleRunDates + */ + public function testProvidesMultipleRunDates() + { + $cron = CronExpression::factory('*/2 * * * *'); + $this->assertEquals(array( + new DateTime('2008-11-09 00:00:00'), + new DateTime('2008-11-09 00:02:00'), + new DateTime('2008-11-09 00:04:00'), + new DateTime('2008-11-09 00:06:00') + ), $cron->getMultipleRunDates(4, '2008-11-09 00:00:00', false, true)); + } + + /** + * @covers \Cron\CronExpression::getMultipleRunDates + * @covers \Cron\CronExpression::setMaxIterationCount + */ + public function testProvidesMultipleRunDatesForTheFarFuture() { + // Fails with the default 1000 iteration limit + $cron = CronExpression::factory('0 0 12 1 *'); + $cron->setMaxIterationCount(2000); + $this->assertEquals(array( + new DateTime('2016-01-12 00:00:00'), + new DateTime('2017-01-12 00:00:00'), + new DateTime('2018-01-12 00:00:00'), + new DateTime('2019-01-12 00:00:00'), + new DateTime('2020-01-12 00:00:00'), + new DateTime('2021-01-12 00:00:00'), + new DateTime('2022-01-12 00:00:00'), + new DateTime('2023-01-12 00:00:00'), + new DateTime('2024-01-12 00:00:00'), + ), $cron->getMultipleRunDates(9, '2015-04-28 00:00:00', false, true)); + } + + /** + * @covers \Cron\CronExpression + */ + public function testCanIterateOverNextRuns() + { + $cron = CronExpression::factory('@weekly'); + $nextRun = $cron->getNextRunDate("2008-11-09 08:00:00"); + $this->assertEquals($nextRun, new DateTime("2008-11-16 00:00:00")); + + // true is cast to 1 + $nextRun = $cron->getNextRunDate("2008-11-09 00:00:00", true, true); + $this->assertEquals($nextRun, new DateTime("2008-11-16 00:00:00")); + + // You can iterate over them + $nextRun = $cron->getNextRunDate($cron->getNextRunDate("2008-11-09 00:00:00", 1, true), 1, true); + $this->assertEquals($nextRun, new DateTime("2008-11-23 00:00:00")); + + // You can skip more than one + $nextRun = $cron->getNextRunDate("2008-11-09 00:00:00", 2, true); + $this->assertEquals($nextRun, new DateTime("2008-11-23 00:00:00")); + $nextRun = $cron->getNextRunDate("2008-11-09 00:00:00", 3, true); + $this->assertEquals($nextRun, new DateTime("2008-11-30 00:00:00")); + } + + /** + * @covers \Cron\CronExpression::getRunDate + */ + public function testSkipsCurrentDateByDefault() + { + $cron = CronExpression::factory('* * * * *'); + $current = new DateTime('now'); + $next = $cron->getNextRunDate($current); + $nextPrev = $cron->getPreviousRunDate($next); + $this->assertSame($current->format('Y-m-d H:i:00'), $nextPrev->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\CronExpression::getRunDate + * @ticket 7 + */ + public function testStripsForSeconds() + { + $cron = CronExpression::factory('* * * * *'); + $current = new DateTime('2011-09-27 10:10:54'); + $this->assertSame('2011-09-27 10:11:00', $cron->getNextRunDate($current)->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\CronExpression::getRunDate + */ + public function testFixesPhpBugInDateIntervalMonth() + { + $cron = CronExpression::factory('0 0 27 JAN *'); + $this->assertSame('2011-01-27 00:00:00', $cron->getPreviousRunDate('2011-08-22 00:00:00')->format('Y-m-d H:i:s')); + } + + public function testIssue29() + { + $cron = CronExpression::factory('@weekly'); + $this->assertSame( + '2013-03-10 00:00:00', + $cron->getPreviousRunDate('2013-03-17 00:00:00')->format('Y-m-d H:i:s') + ); + } + + /** + * @see https://github.com/mtdowling/cron-expression/issues/20 + */ + public function testIssue20() { + $e = CronExpression::factory('* * * * MON#1'); + $this->assertTrue($e->isDue(new DateTime('2014-04-07 00:00:00'))); + $this->assertFalse($e->isDue(new DateTime('2014-04-14 00:00:00'))); + $this->assertFalse($e->isDue(new DateTime('2014-04-21 00:00:00'))); + + $e = CronExpression::factory('* * * * SAT#2'); + $this->assertFalse($e->isDue(new DateTime('2014-04-05 00:00:00'))); + $this->assertTrue($e->isDue(new DateTime('2014-04-12 00:00:00'))); + $this->assertFalse($e->isDue(new DateTime('2014-04-19 00:00:00'))); + + $e = CronExpression::factory('* * * * SUN#3'); + $this->assertFalse($e->isDue(new DateTime('2014-04-13 00:00:00'))); + $this->assertTrue($e->isDue(new DateTime('2014-04-20 00:00:00'))); + $this->assertFalse($e->isDue(new DateTime('2014-04-27 00:00:00'))); + } + + /** + * @covers \Cron\CronExpression::getRunDate + */ + public function testKeepOriginalTime() + { + $now = new \DateTime; + $strNow = $now->format(DateTime::ISO8601); + $cron = CronExpression::factory('0 0 * * *'); + $cron->getPreviousRunDate($now); + $this->assertSame($strNow, $now->format(DateTime::ISO8601)); + } + + /** + * @covers \Cron\CronExpression::__construct + * @covers \Cron\CronExpression::factory + * @covers \Cron\CronExpression::isValidExpression + * @covers \Cron\CronExpression::setExpression + * @covers \Cron\CronExpression::setPart + */ + public function testValidationWorks() + { + // Invalid. Only four values + $this->assertFalse(CronExpression::isValidExpression('* * * 1')); + // Valid + $this->assertTrue(CronExpression::isValidExpression('* * * * 1')); + + // Issue #156, 13 is an invalid month + $this->assertFalse(CronExpression::isValidExpression("* * * 13 * ")); + + // Issue #155, 90 is an invalid second + $this->assertFalse(CronExpression::isValidExpression('90 * * * *')); + + // Issue #154, 24 is an invalid hour + $this->assertFalse(CronExpression::isValidExpression("0 24 1 12 0")); + + // Issue #125, this is just all sorts of wrong + $this->assertFalse(CronExpression::isValidExpression('990 14 * * mon-fri0345345')); + + // see https://github.com/dragonmantank/cron-expression/issues/5 + $this->assertTrue(CronExpression::isValidExpression('2,17,35,47 5-7,11-13 * * *')); + } + + /** + * Makes sure that 00 is considered a valid value for 0-based fields + * cronie allows numbers with a leading 0, so adding support for this as well + * + * @see https://github.com/dragonmantank/cron-expression/issues/12 + */ + public function testDoubleZeroIsValid() + { + $this->assertTrue(CronExpression::isValidExpression('00 * * * *')); + $this->assertTrue(CronExpression::isValidExpression('01 * * * *')); + $this->assertTrue(CronExpression::isValidExpression('* 00 * * *')); + $this->assertTrue(CronExpression::isValidExpression('* 01 * * *')); + + $e = CronExpression::factory('00 * * * *'); + $this->assertTrue($e->isDue(new DateTime('2014-04-07 00:00:00'))); + $e = CronExpression::factory('01 * * * *'); + $this->assertTrue($e->isDue(new DateTime('2014-04-07 00:01:00'))); + + $e = CronExpression::factory('* 00 * * *'); + $this->assertTrue($e->isDue(new DateTime('2014-04-07 00:00:00'))); + $e = CronExpression::factory('* 01 * * *'); + $this->assertTrue($e->isDue(new DateTime('2014-04-07 01:00:00'))); + } + + + /** + * Ranges with large steps should "wrap around" to the appropriate value + * cronie allows for steps that are larger than the range of a field, with it wrapping around like a ring buffer. We + * should do the same. + * + * @see https://github.com/dragonmantank/cron-expression/issues/6 + */ + public function testRangesWrapAroundWithLargeSteps() + { + $f = new MonthField(); + $this->assertTrue($f->validate('*/123')); + $this->assertSame([4], $f->getRangeForExpression('*/123', 12)); + + $e = CronExpression::factory('* * * */123 *'); + $this->assertTrue($e->isDue(new DateTime('2014-04-07 00:00:00'))); + + $nextRunDate = $e->getNextRunDate(new DateTime('2014-04-07 00:00:00')); + $this->assertSame('2014-04-07 00:01:00', $nextRunDate->format('Y-m-d H:i:s')); + + $nextRunDate = $e->getNextRunDate(new DateTime('2014-05-07 00:00:00')); + $this->assertSame('2015-04-01 00:00:00', $nextRunDate->format('Y-m-d H:i:s')); + } +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/DayOfMonthFieldTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/DayOfMonthFieldTest.php new file mode 100644 index 0000000..0dae4ed --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/DayOfMonthFieldTest.php @@ -0,0 +1,64 @@ + + */ +class DayOfMonthFieldTest extends TestCase +{ + /** + * @covers \Cron\DayOfMonthField::validate + */ + public function testValidatesField() + { + $f = new DayOfMonthField(); + $this->assertTrue($f->validate('1')); + $this->assertTrue($f->validate('*')); + $this->assertTrue($f->validate('L')); + $this->assertTrue($f->validate('5W')); + $this->assertTrue($f->validate('01')); + $this->assertFalse($f->validate('5W,L')); + $this->assertFalse($f->validate('1.')); + } + + /** + * @covers \Cron\DayOfMonthField::isSatisfiedBy + */ + public function testChecksIfSatisfied() + { + $f = new DayOfMonthField(); + $this->assertTrue($f->isSatisfiedBy(new DateTime(), '?')); + } + + /** + * @covers \Cron\DayOfMonthField::increment + */ + public function testIncrementsDate() + { + $d = new DateTime('2011-03-15 11:15:00'); + $f = new DayOfMonthField(); + $f->increment($d); + $this->assertSame('2011-03-16 00:00:00', $d->format('Y-m-d H:i:s')); + + $d = new DateTime('2011-03-15 11:15:00'); + $f->increment($d, true); + $this->assertSame('2011-03-14 23:59:00', $d->format('Y-m-d H:i:s')); + } + + /** + * Day of the month cannot accept a 0 value, it must be between 1 and 31 + * See Github issue #120 + * + * @since 2017-01-22 + */ + public function testDoesNotAccept0Date() + { + $f = new DayOfMonthField(); + $this->assertFalse($f->validate(0)); + } +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/DayOfWeekFieldTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/DayOfWeekFieldTest.php new file mode 100644 index 0000000..d27c34d --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/DayOfWeekFieldTest.php @@ -0,0 +1,129 @@ + + */ +class DayOfWeekFieldTest extends TestCase +{ + /** + * @covers \Cron\DayOfWeekField::validate + */ + public function testValidatesField() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->validate('1')); + $this->assertTrue($f->validate('01')); + $this->assertTrue($f->validate('00')); + $this->assertTrue($f->validate('*')); + $this->assertFalse($f->validate('*/3,1,1-12')); + $this->assertTrue($f->validate('SUN-2')); + $this->assertFalse($f->validate('1.')); + } + + /** + * @covers \Cron\DayOfWeekField::isSatisfiedBy + */ + public function testChecksIfSatisfied() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->isSatisfiedBy(new DateTime(), '?')); + } + + /** + * @covers \Cron\DayOfWeekField::increment + */ + public function testIncrementsDate() + { + $d = new DateTime('2011-03-15 11:15:00'); + $f = new DayOfWeekField(); + $f->increment($d); + $this->assertSame('2011-03-16 00:00:00', $d->format('Y-m-d H:i:s')); + + $d = new DateTime('2011-03-15 11:15:00'); + $f->increment($d, true); + $this->assertSame('2011-03-14 23:59:00', $d->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\DayOfWeekField::isSatisfiedBy + * @expectedException InvalidArgumentException + * @expectedExceptionMessage Weekday must be a value between 0 and 7. 12 given + */ + public function testValidatesHashValueWeekday() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->isSatisfiedBy(new DateTime(), '12#1')); + } + + /** + * @covers \Cron\DayOfWeekField::isSatisfiedBy + * @expectedException InvalidArgumentException + * @expectedExceptionMessage There are never more than 5 or less than 1 of a given weekday in a month + */ + public function testValidatesHashValueNth() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->isSatisfiedBy(new DateTime(), '3#6')); + } + + /** + * @covers \Cron\DayOfWeekField::validate + */ + public function testValidateWeekendHash() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->validate('MON#1')); + $this->assertTrue($f->validate('TUE#2')); + $this->assertTrue($f->validate('WED#3')); + $this->assertTrue($f->validate('THU#4')); + $this->assertTrue($f->validate('FRI#5')); + $this->assertTrue($f->validate('SAT#1')); + $this->assertTrue($f->validate('SUN#3')); + $this->assertTrue($f->validate('MON#1,MON#3')); + } + + /** + * @covers \Cron\DayOfWeekField::isSatisfiedBy + */ + public function testHandlesZeroAndSevenDayOfTheWeekValues() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->isSatisfiedBy(new DateTime('2011-09-04 00:00:00'), '0-2')); + $this->assertTrue($f->isSatisfiedBy(new DateTime('2011-09-04 00:00:00'), '6-0')); + + $this->assertTrue($f->isSatisfiedBy(new DateTime('2014-04-20 00:00:00'), 'SUN')); + $this->assertTrue($f->isSatisfiedBy(new DateTime('2014-04-20 00:00:00'), 'SUN#3')); + $this->assertTrue($f->isSatisfiedBy(new DateTime('2014-04-20 00:00:00'), '0#3')); + $this->assertTrue($f->isSatisfiedBy(new DateTime('2014-04-20 00:00:00'), '7#3')); + } + + /** + * @see https://github.com/mtdowling/cron-expression/issues/47 + */ + public function testIssue47() { + $f = new DayOfWeekField(); + $this->assertFalse($f->validate('mon,')); + $this->assertFalse($f->validate('mon-')); + $this->assertFalse($f->validate('*/2,')); + $this->assertFalse($f->validate('-mon')); + $this->assertFalse($f->validate(',1')); + $this->assertFalse($f->validate('*-')); + $this->assertFalse($f->validate(',-')); + } + + /** + * @see https://github.com/laravel/framework/commit/07d160ac3cc9764d5b429734ffce4fa311385403 + */ + public function testLiteralsExpandProperly() + { + $f = new DayOfWeekField(); + $this->assertTrue($f->validate('MON-FRI')); + $this->assertSame([1,2,3,4,5], $f->getRangeForExpression('MON-FRI', 7)); + } +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/FieldFactoryTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/FieldFactoryTest.php new file mode 100644 index 0000000..a6e66b0 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/FieldFactoryTest.php @@ -0,0 +1,42 @@ + + */ +class FieldFactoryTest extends TestCase +{ + /** + * @covers \Cron\FieldFactory::getField + */ + public function testRetrievesFieldInstances() + { + $mappings = array( + 0 => 'Cron\MinutesField', + 1 => 'Cron\HoursField', + 2 => 'Cron\DayOfMonthField', + 3 => 'Cron\MonthField', + 4 => 'Cron\DayOfWeekField', + ); + + $f = new FieldFactory(); + + foreach ($mappings as $position => $class) { + $this->assertSame($class, get_class($f->getField($position))); + } + } + + /** + * @covers \Cron\FieldFactory::getField + * @expectedException InvalidArgumentException + */ + public function testValidatesFieldPosition() + { + $f = new FieldFactory(); + $f->getField(-1); + } +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/HoursFieldTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/HoursFieldTest.php new file mode 100644 index 0000000..e936d11 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/HoursFieldTest.php @@ -0,0 +1,77 @@ + + */ +class HoursFieldTest extends TestCase +{ + /** + * @covers \Cron\HoursField::validate + */ + public function testValidatesField() + { + $f = new HoursField(); + $this->assertTrue($f->validate('1')); + $this->assertTrue($f->validate('00')); + $this->assertTrue($f->validate('01')); + $this->assertTrue($f->validate('*')); + $this->assertFalse($f->validate('*/3,1,1-12')); + } + + /** + * @covers \Cron\HoursField::increment + */ + public function testIncrementsDate() + { + $d = new DateTime('2011-03-15 11:15:00'); + $f = new HoursField(); + $f->increment($d); + $this->assertSame('2011-03-15 12:00:00', $d->format('Y-m-d H:i:s')); + + $d->setTime(11, 15, 0); + $f->increment($d, true); + $this->assertSame('2011-03-15 10:59:00', $d->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\HoursField::increment + */ + public function testIncrementsDateWithThirtyMinuteOffsetTimezone() + { + $tz = date_default_timezone_get(); + date_default_timezone_set('America/St_Johns'); + $d = new DateTime('2011-03-15 11:15:00'); + $f = new HoursField(); + $f->increment($d); + $this->assertSame('2011-03-15 12:00:00', $d->format('Y-m-d H:i:s')); + + $d->setTime(11, 15, 0); + $f->increment($d, true); + $this->assertSame('2011-03-15 10:59:00', $d->format('Y-m-d H:i:s')); + date_default_timezone_set($tz); + } + + /** + * @covers \Cron\HoursField::increment + */ + public function testIncrementDateWithFifteenMinuteOffsetTimezone() + { + $tz = date_default_timezone_get(); + date_default_timezone_set('Asia/Kathmandu'); + $d = new DateTime('2011-03-15 11:15:00'); + $f = new HoursField(); + $f->increment($d); + $this->assertSame('2011-03-15 12:00:00', $d->format('Y-m-d H:i:s')); + + $d->setTime(11, 15, 0); + $f->increment($d, true); + $this->assertSame('2011-03-15 10:59:00', $d->format('Y-m-d H:i:s')); + date_default_timezone_set($tz); + } +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/MinutesFieldTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/MinutesFieldTest.php new file mode 100644 index 0000000..b91bffa --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/MinutesFieldTest.php @@ -0,0 +1,51 @@ + + */ +class MinutesFieldTest extends TestCase +{ + /** + * @covers \Cron\MinutesField::validate + */ + public function testValidatesField() + { + $f = new MinutesField(); + $this->assertTrue($f->validate('1')); + $this->assertTrue($f->validate('*')); + $this->assertFalse($f->validate('*/3,1,1-12')); + } + + /** + * @covers \Cron\MinutesField::increment + */ + public function testIncrementsDate() + { + $d = new DateTime('2011-03-15 11:15:00'); + $f = new MinutesField(); + $f->increment($d); + $this->assertSame('2011-03-15 11:16:00', $d->format('Y-m-d H:i:s')); + $f->increment($d, true); + $this->assertSame('2011-03-15 11:15:00', $d->format('Y-m-d H:i:s')); + } + + /** + * Various bad syntaxes that are reported to work, but shouldn't. + * + * @author Chris Tankersley + * @since 2017-08-18 + */ + public function testBadSyntaxesShouldNotValidate() + { + $f = new MinutesField(); + $this->assertFalse($f->validate('*-1')); + $this->assertFalse($f->validate('1-2-3')); + $this->assertFalse($f->validate('-1')); + } +} diff --git a/vendor/dragonmantank/cron-expression/tests/Cron/MonthFieldTest.php b/vendor/dragonmantank/cron-expression/tests/Cron/MonthFieldTest.php new file mode 100644 index 0000000..83f0f16 --- /dev/null +++ b/vendor/dragonmantank/cron-expression/tests/Cron/MonthFieldTest.php @@ -0,0 +1,81 @@ + + */ +class MonthFieldTest extends TestCase +{ + /** + * @covers \Cron\MonthField::validate + */ + public function testValidatesField() + { + $f = new MonthField(); + $this->assertTrue($f->validate('12')); + $this->assertTrue($f->validate('*')); + $this->assertFalse($f->validate('*/10,2,1-12')); + $this->assertFalse($f->validate('1.fix-regexp')); + } + + /** + * @covers \Cron\MonthField::increment + */ + public function testIncrementsDate() + { + $d = new DateTime('2011-03-15 11:15:00'); + $f = new MonthField(); + $f->increment($d); + $this->assertSame('2011-04-01 00:00:00', $d->format('Y-m-d H:i:s')); + + $d = new DateTime('2011-03-15 11:15:00'); + $f->increment($d, true); + $this->assertSame('2011-02-28 23:59:00', $d->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\MonthField::increment + */ + public function testIncrementsDateWithThirtyMinuteTimezone() + { + $tz = date_default_timezone_get(); + date_default_timezone_set('America/St_Johns'); + $d = new DateTime('2011-03-31 11:59:59'); + $f = new MonthField(); + $f->increment($d); + $this->assertSame('2011-04-01 00:00:00', $d->format('Y-m-d H:i:s')); + + $d = new DateTime('2011-03-15 11:15:00'); + $f->increment($d, true); + $this->assertSame('2011-02-28 23:59:00', $d->format('Y-m-d H:i:s')); + date_default_timezone_set($tz); + } + + + /** + * @covers \Cron\MonthField::increment + */ + public function testIncrementsYearAsNeeded() + { + $f = new MonthField(); + $d = new DateTime('2011-12-15 00:00:00'); + $f->increment($d); + $this->assertSame('2012-01-01 00:00:00', $d->format('Y-m-d H:i:s')); + } + + /** + * @covers \Cron\MonthField::increment + */ + public function testDecrementsYearAsNeeded() + { + $f = new MonthField(); + $d = new DateTime('2011-01-15 00:00:00'); + $f->increment($d, true); + $this->assertSame('2010-12-31 23:59:00', $d->format('Y-m-d H:i:s')); + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/EmailLexer.php b/vendor/egulias/email-validator/EmailValidator/EmailLexer.php new file mode 100644 index 0000000..882c968 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/EmailLexer.php @@ -0,0 +1,221 @@ + self::S_OPENPARENTHESIS, + ')' => self::S_CLOSEPARENTHESIS, + '<' => self::S_LOWERTHAN, + '>' => self::S_GREATERTHAN, + '[' => self::S_OPENBRACKET, + ']' => self::S_CLOSEBRACKET, + ':' => self::S_COLON, + ';' => self::S_SEMICOLON, + '@' => self::S_AT, + '\\' => self::S_BACKSLASH, + '/' => self::S_SLASH, + ',' => self::S_COMMA, + '.' => self::S_DOT, + '"' => self::S_DQUOTE, + '-' => self::S_HYPHEN, + '::' => self::S_DOUBLECOLON, + ' ' => self::S_SP, + "\t" => self::S_HTAB, + "\r" => self::S_CR, + "\n" => self::S_LF, + "\r\n" => self::CRLF, + 'IPv6' => self::S_IPV6TAG, + '{' => self::S_OPENQBRACKET, + '}' => self::S_CLOSEQBRACKET, + '' => self::S_EMPTY, + '\0' => self::C_NUL, + ); + + protected $hasInvalidTokens = false; + + protected $previous; + + public function reset() + { + $this->hasInvalidTokens = false; + parent::reset(); + } + + public function hasInvalidTokens() + { + return $this->hasInvalidTokens; + } + + /** + * @param $type + * @throws \UnexpectedValueException + * @return boolean + */ + public function find($type) + { + $search = clone $this; + $search->skipUntil($type); + + if (!$search->lookahead) { + throw new \UnexpectedValueException($type . ' not found'); + } + return true; + } + + /** + * getPrevious + * + * @return array token + */ + public function getPrevious() + { + return $this->previous; + } + + /** + * moveNext + * + * @return boolean + */ + public function moveNext() + { + $this->previous = $this->token; + + return parent::moveNext(); + } + + /** + * Lexical catchable patterns. + * + * @return string[] + */ + protected function getCatchablePatterns() + { + return array( + '[a-zA-Z_]+[46]?', //ASCII and domain literal + '[^\x00-\x7F]', //UTF-8 + '[0-9]+', + '\r\n', + '::', + '\s+?', + '.', + ); + } + + /** + * Lexical non-catchable patterns. + * + * @return string[] + */ + protected function getNonCatchablePatterns() + { + return array('[\xA0-\xff]+'); + } + + /** + * Retrieve token type. Also processes the token value if necessary. + * + * @param string $value + * @throws \InvalidArgumentException + * @return integer + */ + protected function getType(&$value) + { + if ($this->isNullType($value)) { + return self::C_NUL; + } + + if ($this->isValid($value)) { + return $this->charValue[$value]; + } + + if ($this->isUTF8Invalid($value)) { + $this->hasInvalidTokens = true; + return self::INVALID; + } + + return self::GENERIC; + } + + protected function isValid($value) + { + if (isset($this->charValue[$value])) { + return true; + } + + return false; + } + + /** + * @param $value + * @return bool + */ + protected function isNullType($value) + { + if ($value === "\0") { + return true; + } + + return false; + } + + /** + * @param $value + * @return bool + */ + protected function isUTF8Invalid($value) + { + if (preg_match('/\p{Cc}+/u', $value)) { + return true; + } + + return false; + } + + protected function getModifiers() + { + return 'iu'; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/EmailParser.php b/vendor/egulias/email-validator/EmailValidator/EmailParser.php new file mode 100644 index 0000000..d0627d8 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/EmailParser.php @@ -0,0 +1,104 @@ + + */ +class EmailParser +{ + const EMAIL_MAX_LENGTH = 254; + + protected $warnings; + protected $domainPart = ''; + protected $localPart = ''; + protected $lexer; + protected $localPartParser; + protected $domainPartParser; + + public function __construct(EmailLexer $lexer) + { + $this->lexer = $lexer; + $this->localPartParser = new LocalPart($this->lexer); + $this->domainPartParser = new DomainPart($this->lexer); + $this->warnings = new \SplObjectStorage(); + } + + /** + * @param $str + * @return array + */ + public function parse($str) + { + $this->lexer->setInput($str); + + if (!$this->hasAtToken()) { + throw new NoLocalPart(); + } + + + $this->localPartParser->parse($str); + $this->domainPartParser->parse($str); + + $this->setParts($str); + + if ($this->lexer->hasInvalidTokens()) { + throw new ExpectingATEXT(); + } + + return array('local' => $this->localPart, 'domain' => $this->domainPart); + } + + public function getWarnings() + { + $localPartWarnings = $this->localPartParser->getWarnings(); + $domainPartWarnings = $this->domainPartParser->getWarnings(); + $this->warnings = array_merge($localPartWarnings, $domainPartWarnings); + + $this->addLongEmailWarning($this->localPart, $this->domainPart); + + return $this->warnings; + } + + public function getParsedDomainPart() + { + return $this->domainPart; + } + + protected function setParts($email) + { + $parts = explode('@', $email); + $this->domainPart = $this->domainPartParser->getDomainPart(); + $this->localPart = $parts[0]; + } + + protected function hasAtToken() + { + $this->lexer->moveNext(); + $this->lexer->moveNext(); + if ($this->lexer->token['type'] === EmailLexer::S_AT) { + return false; + } + + return true; + } + + /** + * @param string $localPart + * @param string $parsedDomainPart + */ + protected function addLongEmailWarning($localPart, $parsedDomainPart) + { + if (strlen($localPart . '@' . $parsedDomainPart) > self::EMAIL_MAX_LENGTH) { + $this->warnings[EmailTooLong::CODE] = new EmailTooLong(); + } + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/EmailValidator.php b/vendor/egulias/email-validator/EmailValidator/EmailValidator.php new file mode 100644 index 0000000..44b4b93 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/EmailValidator.php @@ -0,0 +1,67 @@ +lexer = new EmailLexer(); + } + + /** + * @param $email + * @param EmailValidation $emailValidation + * @return bool + */ + public function isValid($email, EmailValidation $emailValidation) + { + $isValid = $emailValidation->isValid($email, $this->lexer); + $this->warnings = $emailValidation->getWarnings(); + $this->error = $emailValidation->getError(); + + return $isValid; + } + + /** + * @return boolean + */ + public function hasWarnings() + { + return !empty($this->warnings); + } + + /** + * @return array + */ + public function getWarnings() + { + return $this->warnings; + } + + /** + * @return InvalidEmail + */ + public function getError() + { + return $this->error; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/AtextAfterCFWS.php b/vendor/egulias/email-validator/EmailValidator/Exception/AtextAfterCFWS.php new file mode 100644 index 0000000..97f41a2 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Exception/AtextAfterCFWS.php @@ -0,0 +1,9 @@ +lexer->moveNext(); + + if ($this->lexer->token['type'] === EmailLexer::S_DOT) { + throw new DotAtStart(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_EMPTY) { + throw new NoDomainPart(); + } + if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN) { + throw new DomainHyphened(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) { + $this->warnings[DeprecatedComment::CODE] = new DeprecatedComment(); + $this->parseDomainComments(); + } + + $domain = $this->doParseDomainPart(); + + $prev = $this->lexer->getPrevious(); + $length = strlen($domain); + + if ($prev['type'] === EmailLexer::S_DOT) { + throw new DotAtEnd(); + } + if ($prev['type'] === EmailLexer::S_HYPHEN) { + throw new DomainHyphened(); + } + if ($length > self::DOMAIN_MAX_LENGTH) { + $this->warnings[DomainTooLong::CODE] = new DomainTooLong(); + } + if ($prev['type'] === EmailLexer::S_CR) { + throw new CRLFAtTheEnd(); + } + $this->domainPart = $domain; + } + + public function getDomainPart() + { + return $this->domainPart; + } + + public function checkIPV6Tag($addressLiteral, $maxGroups = 8) + { + $prev = $this->lexer->getPrevious(); + if ($prev['type'] === EmailLexer::S_COLON) { + $this->warnings[IPV6ColonEnd::CODE] = new IPV6ColonEnd(); + } + + $IPv6 = substr($addressLiteral, 5); + //Daniel Marschall's new IPv6 testing strategy + $matchesIP = explode(':', $IPv6); + $groupCount = count($matchesIP); + $colons = strpos($IPv6, '::'); + + if (count(preg_grep('/^[0-9A-Fa-f]{0,4}$/', $matchesIP, PREG_GREP_INVERT)) !== 0) { + $this->warnings[IPV6BadChar::CODE] = new IPV6BadChar(); + } + + if ($colons === false) { + // We need exactly the right number of groups + if ($groupCount !== $maxGroups) { + $this->warnings[IPV6GroupCount::CODE] = new IPV6GroupCount(); + } + return; + } + + if ($colons !== strrpos($IPv6, '::')) { + $this->warnings[IPV6DoubleColon::CODE] = new IPV6DoubleColon(); + return; + } + + if ($colons === 0 || $colons === (strlen($IPv6) - 2)) { + // RFC 4291 allows :: at the start or end of an address + //with 7 other groups in addition + ++$maxGroups; + } + + if ($groupCount > $maxGroups) { + $this->warnings[IPV6MaxGroups::CODE] = new IPV6MaxGroups(); + } elseif ($groupCount === $maxGroups) { + $this->warnings[IPV6Deprecated::CODE] = new IPV6Deprecated(); + } + } + + protected function doParseDomainPart() + { + $domain = ''; + $openedParenthesis = 0; + do { + $prev = $this->lexer->getPrevious(); + + $this->checkNotAllowedChars($this->lexer->token); + + if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) { + $this->parseComments(); + $openedParenthesis += $this->getOpenedParenthesis(); + $this->lexer->moveNext(); + $tmpPrev = $this->lexer->getPrevious(); + if ($tmpPrev['type'] === EmailLexer::S_CLOSEPARENTHESIS) { + $openedParenthesis--; + } + } + if ($this->lexer->token['type'] === EmailLexer::S_CLOSEPARENTHESIS) { + if ($openedParenthesis === 0) { + throw new UnopenedComment(); + } else { + $openedParenthesis--; + } + } + + $this->checkConsecutiveDots(); + $this->checkDomainPartExceptions($prev); + + if ($this->hasBrackets()) { + $this->parseDomainLiteral(); + } + + $this->checkLabelLength($prev); + + if ($this->isFWS()) { + $this->parseFWS(); + } + + $domain .= $this->lexer->token['value']; + $this->lexer->moveNext(); + } while ($this->lexer->token); + + return $domain; + } + + private function checkNotAllowedChars($token) + { + $notAllowed = [EmailLexer::S_BACKSLASH => true, EmailLexer::S_SLASH=> true]; + if (isset($notAllowed[$token['type']])) { + throw new CharNotAllowed(); + } + } + + protected function parseDomainLiteral() + { + if ($this->lexer->isNextToken(EmailLexer::S_COLON)) { + $this->warnings[IPV6ColonStart::CODE] = new IPV6ColonStart(); + } + if ($this->lexer->isNextToken(EmailLexer::S_IPV6TAG)) { + $lexer = clone $this->lexer; + $lexer->moveNext(); + if ($lexer->isNextToken(EmailLexer::S_DOUBLECOLON)) { + $this->warnings[IPV6ColonStart::CODE] = new IPV6ColonStart(); + } + } + + return $this->doParseDomainLiteral(); + } + + protected function doParseDomainLiteral() + { + $IPv6TAG = false; + $addressLiteral = ''; + do { + if ($this->lexer->token['type'] === EmailLexer::C_NUL) { + throw new ExpectingDTEXT(); + } + + if ($this->lexer->token['type'] === EmailLexer::INVALID || + $this->lexer->token['type'] === EmailLexer::C_DEL || + $this->lexer->token['type'] === EmailLexer::S_LF + ) { + $this->warnings[ObsoleteDTEXT::CODE] = new ObsoleteDTEXT(); + } + + if ($this->lexer->isNextTokenAny(array(EmailLexer::S_OPENQBRACKET, EmailLexer::S_OPENBRACKET))) { + throw new ExpectingDTEXT(); + } + + if ($this->lexer->isNextTokenAny( + array(EmailLexer::S_HTAB, EmailLexer::S_SP, $this->lexer->token['type'] === EmailLexer::CRLF) + )) { + $this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS(); + $this->parseFWS(); + } + + if ($this->lexer->isNextToken(EmailLexer::S_CR)) { + throw new CRNoLF(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH) { + $this->warnings[ObsoleteDTEXT::CODE] = new ObsoleteDTEXT(); + $addressLiteral .= $this->lexer->token['value']; + $this->lexer->moveNext(); + $this->validateQuotedPair(); + } + if ($this->lexer->token['type'] === EmailLexer::S_IPV6TAG) { + $IPv6TAG = true; + } + if ($this->lexer->token['type'] === EmailLexer::S_CLOSEQBRACKET) { + break; + } + + $addressLiteral .= $this->lexer->token['value']; + + } while ($this->lexer->moveNext()); + + $addressLiteral = str_replace('[', '', $addressLiteral); + $addressLiteral = $this->checkIPV4Tag($addressLiteral); + + if (false === $addressLiteral) { + return $addressLiteral; + } + + if (!$IPv6TAG) { + $this->warnings[DomainLiteral::CODE] = new DomainLiteral(); + return $addressLiteral; + } + + $this->warnings[AddressLiteral::CODE] = new AddressLiteral(); + + $this->checkIPV6Tag($addressLiteral); + + return $addressLiteral; + } + + protected function checkIPV4Tag($addressLiteral) + { + $matchesIP = array(); + + // Extract IPv4 part from the end of the address-literal (if there is one) + if (preg_match( + '/\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/', + $addressLiteral, + $matchesIP + ) > 0 + ) { + $index = strrpos($addressLiteral, $matchesIP[0]); + if ($index === 0) { + $this->warnings[AddressLiteral::CODE] = new AddressLiteral(); + return false; + } + // Convert IPv4 part to IPv6 format for further testing + $addressLiteral = substr($addressLiteral, 0, $index) . '0:0'; + } + + return $addressLiteral; + } + + protected function checkDomainPartExceptions($prev) + { + $invalidDomainTokens = array( + EmailLexer::S_DQUOTE => true, + EmailLexer::S_SEMICOLON => true, + EmailLexer::S_GREATERTHAN => true, + EmailLexer::S_LOWERTHAN => true, + ); + + if (isset($invalidDomainTokens[$this->lexer->token['type']])) { + throw new ExpectingATEXT(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_COMMA) { + throw new CommaInDomain(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_AT) { + throw new ConsecutiveAt(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_OPENQBRACKET && $prev['type'] !== EmailLexer::S_AT) { + throw new ExpectingATEXT(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN && $this->lexer->isNextToken(EmailLexer::S_DOT)) { + throw new DomainHyphened(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH + && $this->lexer->isNextToken(EmailLexer::GENERIC)) { + throw new ExpectingATEXT(); + } + } + + protected function hasBrackets() + { + if ($this->lexer->token['type'] !== EmailLexer::S_OPENBRACKET) { + return false; + } + + try { + $this->lexer->find(EmailLexer::S_CLOSEBRACKET); + } catch (\RuntimeException $e) { + throw new ExpectingDomainLiteralClose(); + } + + return true; + } + + protected function checkLabelLength($prev) + { + if ($this->lexer->token['type'] === EmailLexer::S_DOT && + $prev['type'] === EmailLexer::GENERIC && + strlen($prev['value']) > 63 + ) { + $this->warnings[LabelTooLong::CODE] = new LabelTooLong(); + } + } + + protected function parseDomainComments() + { + $this->isUnclosedComment(); + while (!$this->lexer->isNextToken(EmailLexer::S_CLOSEPARENTHESIS)) { + $this->warnEscaping(); + $this->lexer->moveNext(); + } + + $this->lexer->moveNext(); + if ($this->lexer->isNextToken(EmailLexer::S_DOT)) { + throw new ExpectingATEXT(); + } + } + + protected function addTLDWarnings() + { + if ($this->warnings[DomainLiteral::CODE]) { + $this->warnings[TLD::CODE] = new TLD(); + } + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Parser/LocalPart.php b/vendor/egulias/email-validator/EmailValidator/Parser/LocalPart.php new file mode 100644 index 0000000..8ab16ab --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Parser/LocalPart.php @@ -0,0 +1,138 @@ +lexer->token['type'] !== EmailLexer::S_AT && $this->lexer->token) { + if ($this->lexer->token['type'] === EmailLexer::S_DOT && !$this->lexer->getPrevious()) { + throw new DotAtStart(); + } + + $closingQuote = $this->checkDQUOTE($closingQuote); + if ($closingQuote && $parseDQuote) { + $parseDQuote = $this->parseDoubleQuote(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) { + $this->parseComments(); + $openedParenthesis += $this->getOpenedParenthesis(); + } + if ($this->lexer->token['type'] === EmailLexer::S_CLOSEPARENTHESIS) { + if ($openedParenthesis === 0) { + throw new UnopenedComment(); + } else { + $openedParenthesis--; + } + } + + $this->checkConsecutiveDots(); + + if ($this->lexer->token['type'] === EmailLexer::S_DOT && + $this->lexer->isNextToken(EmailLexer::S_AT) + ) { + throw new DotAtEnd(); + } + + $this->warnEscaping(); + $this->isInvalidToken($this->lexer->token, $closingQuote); + + if ($this->isFWS()) { + $this->parseFWS(); + } + + $this->lexer->moveNext(); + } + + $prev = $this->lexer->getPrevious(); + if (strlen($prev['value']) > LocalTooLong::LOCAL_PART_LENGTH) { + $this->warnings[LocalTooLong::CODE] = new LocalTooLong(); + } + } + + protected function parseDoubleQuote() + { + $parseAgain = true; + $special = array( + EmailLexer::S_CR => true, + EmailLexer::S_HTAB => true, + EmailLexer::S_LF => true + ); + + $invalid = array( + EmailLexer::C_NUL => true, + EmailLexer::S_HTAB => true, + EmailLexer::S_CR => true, + EmailLexer::S_LF => true + ); + $setSpecialsWarning = true; + + $this->lexer->moveNext(); + + while ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE && $this->lexer->token) { + $parseAgain = false; + if (isset($special[$this->lexer->token['type']]) && $setSpecialsWarning) { + $this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS(); + $setSpecialsWarning = false; + } + if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH && $this->lexer->isNextToken(EmailLexer::S_DQUOTE)) { + $this->lexer->moveNext(); + } + + $this->lexer->moveNext(); + + if (!$this->escaped() && isset($invalid[$this->lexer->token['type']])) { + throw new ExpectingATEXT(); + } + } + + $prev = $this->lexer->getPrevious(); + + if ($prev['type'] === EmailLexer::S_BACKSLASH) { + if (!$this->checkDQUOTE(false)) { + throw new UnclosedQuotedString(); + } + } + + if (!$this->lexer->isNextToken(EmailLexer::S_AT) && $prev['type'] !== EmailLexer::S_BACKSLASH) { + throw new ExpectingAT(); + } + + return $parseAgain; + } + + protected function isInvalidToken($token, $closingQuote) + { + $forbidden = array( + EmailLexer::S_COMMA, + EmailLexer::S_CLOSEBRACKET, + EmailLexer::S_OPENBRACKET, + EmailLexer::S_GREATERTHAN, + EmailLexer::S_LOWERTHAN, + EmailLexer::S_COLON, + EmailLexer::S_SEMICOLON, + EmailLexer::INVALID + ); + + if (in_array($token['type'], $forbidden) && !$closingQuote) { + throw new ExpectingATEXT(); + } + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Parser/Parser.php b/vendor/egulias/email-validator/EmailValidator/Parser/Parser.php new file mode 100644 index 0000000..e5042e1 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Parser/Parser.php @@ -0,0 +1,215 @@ +lexer = $lexer; + } + + public function getWarnings() + { + return $this->warnings; + } + + abstract public function parse($str); + + /** @return int */ + public function getOpenedParenthesis() + { + return $this->openedParenthesis; + } + + /** + * validateQuotedPair + */ + protected function validateQuotedPair() + { + if (!($this->lexer->token['type'] === EmailLexer::INVALID + || $this->lexer->token['type'] === EmailLexer::C_DEL)) { + throw new ExpectedQPair(); + } + + $this->warnings[QuotedPart::CODE] = + new QuotedPart($this->lexer->getPrevious()['type'], $this->lexer->token['type']); + } + + protected function parseComments() + { + $this->openedParenthesis = 1; + $this->isUnclosedComment(); + $this->warnings[Comment::CODE] = new Comment(); + while (!$this->lexer->isNextToken(EmailLexer::S_CLOSEPARENTHESIS)) { + if ($this->lexer->isNextToken(EmailLexer::S_OPENPARENTHESIS)) { + $this->openedParenthesis++; + } + $this->warnEscaping(); + $this->lexer->moveNext(); + } + + $this->lexer->moveNext(); + if ($this->lexer->isNextTokenAny(array(EmailLexer::GENERIC, EmailLexer::S_EMPTY))) { + throw new ExpectingATEXT(); + } + + if ($this->lexer->isNextToken(EmailLexer::S_AT)) { + $this->warnings[CFWSNearAt::CODE] = new CFWSNearAt(); + } + } + + protected function isUnclosedComment() + { + try { + $this->lexer->find(EmailLexer::S_CLOSEPARENTHESIS); + return true; + } catch (\RuntimeException $e) { + throw new UnclosedComment(); + } + } + + protected function parseFWS() + { + $previous = $this->lexer->getPrevious(); + + $this->checkCRLFInFWS(); + + if ($this->lexer->token['type'] === EmailLexer::S_CR) { + throw new CRNoLF(); + } + + if ($this->lexer->isNextToken(EmailLexer::GENERIC) && $previous['type'] !== EmailLexer::S_AT) { + throw new AtextAfterCFWS(); + } + + if ($this->lexer->token['type'] === EmailLexer::S_LF || $this->lexer->token['type'] === EmailLexer::C_NUL) { + throw new ExpectingCTEXT(); + } + + if ($this->lexer->isNextToken(EmailLexer::S_AT) || $previous['type'] === EmailLexer::S_AT) { + $this->warnings[CFWSNearAt::CODE] = new CFWSNearAt(); + } else { + $this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS(); + } + } + + protected function checkConsecutiveDots() + { + if ($this->lexer->token['type'] === EmailLexer::S_DOT && $this->lexer->isNextToken(EmailLexer::S_DOT)) { + throw new ConsecutiveDot(); + } + } + + protected function isFWS() + { + if ($this->escaped()) { + return false; + } + + if ($this->lexer->token['type'] === EmailLexer::S_SP || + $this->lexer->token['type'] === EmailLexer::S_HTAB || + $this->lexer->token['type'] === EmailLexer::S_CR || + $this->lexer->token['type'] === EmailLexer::S_LF || + $this->lexer->token['type'] === EmailLexer::CRLF + ) { + return true; + } + + return false; + } + + protected function escaped() + { + $previous = $this->lexer->getPrevious(); + + if ($previous['type'] === EmailLexer::S_BACKSLASH + && + $this->lexer->token['type'] !== EmailLexer::GENERIC + ) { + return true; + } + + return false; + } + + protected function warnEscaping() + { + if ($this->lexer->token['type'] !== EmailLexer::S_BACKSLASH) { + return false; + } + + if ($this->lexer->isNextToken(EmailLexer::GENERIC)) { + throw new ExpectingATEXT(); + } + + if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB, EmailLexer::C_DEL))) { + return false; + } + + $this->warnings[QuotedPart::CODE] = + new QuotedPart($this->lexer->getPrevious()['type'], $this->lexer->token['type']); + return true; + + } + + protected function checkDQUOTE($hasClosingQuote) + { + if ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE) { + return $hasClosingQuote; + } + if ($hasClosingQuote) { + return $hasClosingQuote; + } + $previous = $this->lexer->getPrevious(); + if ($this->lexer->isNextToken(EmailLexer::GENERIC) && $previous['type'] === EmailLexer::GENERIC) { + throw new ExpectingATEXT(); + } + + try { + $this->lexer->find(EmailLexer::S_DQUOTE); + $hasClosingQuote = true; + } catch (\Exception $e) { + throw new UnclosedQuotedString(); + } + $this->warnings[QuotedString::CODE] = new QuotedString($previous['value'], $this->lexer->token['value']); + + return $hasClosingQuote; + } + + protected function checkCRLFInFWS() + { + if ($this->lexer->token['type'] !== EmailLexer::CRLF) { + return; + } + + if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB))) { + throw new CRLFX2(); + } + + if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB))) { + throw new CRLFAtTheEnd(); + } + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php b/vendor/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php new file mode 100644 index 0000000..e5c3e5d --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php @@ -0,0 +1,72 @@ +checkDNS($host); + } + + public function getError() + { + return $this->error; + } + + public function getWarnings() + { + return $this->warnings; + } + + protected function checkDNS($host) + { + $variant = INTL_IDNA_VARIANT_2003; + if ( defined('INTL_IDNA_VARIANT_UTS46') ) { + $variant = INTL_IDNA_VARIANT_UTS46; + } + $host = rtrim(idn_to_ascii($host, IDNA_DEFAULT, $variant), '.') . '.'; + + $Aresult = true; + $MXresult = checkdnsrr($host, 'MX'); + + if (!$MXresult) { + $this->warnings[NoDNSMXRecord::CODE] = new NoDNSMXRecord(); + $Aresult = checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA'); + if (!$Aresult) { + $this->error = new NoDNSRecord(); + } + } + return $MXresult || $Aresult; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/EmailValidation.php b/vendor/egulias/email-validator/EmailValidator/Validation/EmailValidation.php new file mode 100644 index 0000000..d5a015b --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Validation/EmailValidation.php @@ -0,0 +1,34 @@ +errors = $errors; + parent::__construct(); + } + + public function getErrors() + { + return $this->errors; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php b/vendor/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php new file mode 100644 index 0000000..ce161ac --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php @@ -0,0 +1,111 @@ +validations = $validations; + $this->mode = $mode; + } + + /** + * {@inheritdoc} + */ + public function isValid($email, EmailLexer $emailLexer) + { + $result = true; + $errors = []; + foreach ($this->validations as $validation) { + $emailLexer->reset(); + $validationResult = $validation->isValid($email, $emailLexer); + $result = $result && $validationResult; + $this->warnings = array_merge($this->warnings, $validation->getWarnings()); + $errors = $this->addNewError($validation->getError(), $errors); + + if ($this->shouldStop($result)) { + break; + } + } + + if (!empty($errors)) { + $this->error = new MultipleErrors($errors); + } + + return $result; + } + + private function addNewError($possibleError, array $errors) + { + if (null !== $possibleError) { + $errors[] = $possibleError; + } + + return $errors; + } + + private function shouldStop($result) + { + return !$result && $this->mode === self::STOP_ON_ERROR; + } + + /** + * {@inheritdoc} + */ + public function getError() + { + return $this->error; + } + + /** + * {@inheritdoc} + */ + public function getWarnings() + { + return $this->warnings; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php b/vendor/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php new file mode 100644 index 0000000..e4bf0cc --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php @@ -0,0 +1,41 @@ +getWarnings())) { + return true; + } + + $this->error = new RFCWarnings(); + + return false; + } + + /** + * {@inheritdoc} + */ + public function getError() + { + return $this->error ?: parent::getError(); + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/RFCValidation.php b/vendor/egulias/email-validator/EmailValidator/Validation/RFCValidation.php new file mode 100644 index 0000000..c4ffe35 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Validation/RFCValidation.php @@ -0,0 +1,49 @@ +parser = new EmailParser($emailLexer); + try { + $this->parser->parse((string)$email); + } catch (InvalidEmail $invalid) { + $this->error = $invalid; + return false; + } + + $this->warnings = $this->parser->getWarnings(); + return true; + } + + public function getError() + { + return $this->error; + } + + public function getWarnings() + { + return $this->warnings; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php b/vendor/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php new file mode 100644 index 0000000..4721f0d --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php @@ -0,0 +1,45 @@ +setChecks(Spoofchecker::SINGLE_SCRIPT); + + if ($checker->isSuspicious($email)) { + $this->error = new SpoofEmail(); + } + + return $this->error === null; + } + + public function getError() + { + return $this->error; + } + + public function getWarnings() + { + return []; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/AddressLiteral.php b/vendor/egulias/email-validator/EmailValidator/Warning/AddressLiteral.php new file mode 100644 index 0000000..77e70f7 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/AddressLiteral.php @@ -0,0 +1,14 @@ +message = 'Address literal in domain part'; + $this->rfcNumber = 5321; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/CFWSNearAt.php b/vendor/egulias/email-validator/EmailValidator/Warning/CFWSNearAt.php new file mode 100644 index 0000000..be43bbe --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/CFWSNearAt.php @@ -0,0 +1,13 @@ +message = "Deprecated folding white space near @"; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/CFWSWithFWS.php b/vendor/egulias/email-validator/EmailValidator/Warning/CFWSWithFWS.php new file mode 100644 index 0000000..dea3450 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/CFWSWithFWS.php @@ -0,0 +1,13 @@ +message = 'Folding whites space followed by folding white space'; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/Comment.php b/vendor/egulias/email-validator/EmailValidator/Warning/Comment.php new file mode 100644 index 0000000..704c290 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/Comment.php @@ -0,0 +1,13 @@ +message = "Comments found in this email"; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/DeprecatedComment.php b/vendor/egulias/email-validator/EmailValidator/Warning/DeprecatedComment.php new file mode 100644 index 0000000..ad43bd7 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/DeprecatedComment.php @@ -0,0 +1,13 @@ +message = 'Deprecated comments'; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/DomainLiteral.php b/vendor/egulias/email-validator/EmailValidator/Warning/DomainLiteral.php new file mode 100644 index 0000000..6f36b5e --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/DomainLiteral.php @@ -0,0 +1,14 @@ +message = 'Domain Literal'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/DomainTooLong.php b/vendor/egulias/email-validator/EmailValidator/Warning/DomainTooLong.php new file mode 100644 index 0000000..61ff17a --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/DomainTooLong.php @@ -0,0 +1,14 @@ +message = 'Domain is too long, exceeds 255 chars'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/EmailTooLong.php b/vendor/egulias/email-validator/EmailValidator/Warning/EmailTooLong.php new file mode 100644 index 0000000..497309d --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/EmailTooLong.php @@ -0,0 +1,15 @@ +message = 'Email is too long, exceeds ' . EmailParser::EMAIL_MAX_LENGTH; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6BadChar.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6BadChar.php new file mode 100644 index 0000000..ba2fcc0 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6BadChar.php @@ -0,0 +1,14 @@ +message = 'Bad char in IPV6 domain literal'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonEnd.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonEnd.php new file mode 100644 index 0000000..41afa78 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonEnd.php @@ -0,0 +1,14 @@ +message = ':: found at the end of the domain literal'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonStart.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonStart.php new file mode 100644 index 0000000..1bf754e --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonStart.php @@ -0,0 +1,14 @@ +message = ':: found at the start of the domain literal'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6Deprecated.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6Deprecated.php new file mode 100644 index 0000000..d752caa --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6Deprecated.php @@ -0,0 +1,14 @@ +message = 'Deprecated form of IPV6'; + $this->rfcNumber = 5321; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6DoubleColon.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6DoubleColon.php new file mode 100644 index 0000000..4f82394 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6DoubleColon.php @@ -0,0 +1,14 @@ +message = 'Double colon found after IPV6 tag'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6GroupCount.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6GroupCount.php new file mode 100644 index 0000000..a59d317 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6GroupCount.php @@ -0,0 +1,14 @@ +message = 'Group count is not IPV6 valid'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6MaxGroups.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6MaxGroups.php new file mode 100644 index 0000000..936274c --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6MaxGroups.php @@ -0,0 +1,14 @@ +message = 'Reached the maximum number of IPV6 groups allowed'; + $this->rfcNumber = 5321; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/LabelTooLong.php b/vendor/egulias/email-validator/EmailValidator/Warning/LabelTooLong.php new file mode 100644 index 0000000..daf07f4 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/LabelTooLong.php @@ -0,0 +1,14 @@ +message = 'Label too long'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/LocalTooLong.php b/vendor/egulias/email-validator/EmailValidator/Warning/LocalTooLong.php new file mode 100644 index 0000000..0d08d8b --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/LocalTooLong.php @@ -0,0 +1,15 @@ +message = 'Local part is too long, exceeds 64 chars (octets)'; + $this->rfcNumber = 5322; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/NoDNSMXRecord.php b/vendor/egulias/email-validator/EmailValidator/Warning/NoDNSMXRecord.php new file mode 100644 index 0000000..b3c21a1 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/NoDNSMXRecord.php @@ -0,0 +1,14 @@ +message = 'No MX DSN record was found for this email'; + $this->rfcNumber = 5321; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/ObsoleteDTEXT.php b/vendor/egulias/email-validator/EmailValidator/Warning/ObsoleteDTEXT.php new file mode 100644 index 0000000..10f19e3 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/ObsoleteDTEXT.php @@ -0,0 +1,14 @@ +rfcNumber = 5322; + $this->message = 'Obsolete DTEXT in domain literal'; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/QuotedPart.php b/vendor/egulias/email-validator/EmailValidator/Warning/QuotedPart.php new file mode 100644 index 0000000..7be9e6a --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/QuotedPart.php @@ -0,0 +1,13 @@ +message = "Deprecated Quoted String found between $prevToken and $postToken"; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/QuotedString.php b/vendor/egulias/email-validator/EmailValidator/Warning/QuotedString.php new file mode 100644 index 0000000..e9d56e1 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/QuotedString.php @@ -0,0 +1,13 @@ +message = "Quoted String found between $prevToken and $postToken"; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/TLD.php b/vendor/egulias/email-validator/EmailValidator/Warning/TLD.php new file mode 100644 index 0000000..2338b9f --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/TLD.php @@ -0,0 +1,13 @@ +message = "RFC5321, TLD"; + } +} diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/Warning.php b/vendor/egulias/email-validator/EmailValidator/Warning/Warning.php new file mode 100644 index 0000000..ec6a365 --- /dev/null +++ b/vendor/egulias/email-validator/EmailValidator/Warning/Warning.php @@ -0,0 +1,30 @@ +message; + } + + public function code() + { + return self::CODE; + } + + public function RFCNumber() + { + return $this->rfcNumber; + } + + public function __toString() + { + return $this->message() . " rfc: " . $this->rfcNumber . "interal code: " . static::CODE; + } +} diff --git a/vendor/egulias/email-validator/LICENSE b/vendor/egulias/email-validator/LICENSE new file mode 100644 index 0000000..c34d2c1 --- /dev/null +++ b/vendor/egulias/email-validator/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013-2016 Eduardo Gulias Davis + +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/egulias/email-validator/README.md b/vendor/egulias/email-validator/README.md new file mode 100644 index 0000000..008669c --- /dev/null +++ b/vendor/egulias/email-validator/README.md @@ -0,0 +1,82 @@ +# EmailValidator +[![Build Status](https://travis-ci.org/egulias/EmailValidator.png?branch=master)](https://travis-ci.org/egulias/EmailValidator) [![Coverage Status](https://coveralls.io/repos/egulias/EmailValidator/badge.png?branch=master)](https://coveralls.io/r/egulias/EmailValidator?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/egulias/EmailValidator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/egulias/EmailValidator/?branch=master) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/22ba6692-9c02-42e5-a65d-1c5696bfffc6/small.png)](https://insight.sensiolabs.com/projects/22ba6692-9c02-42e5-a65d-1c5696bfffc6) +============================= +## Suported RFCs ## +This library aims to support: + +RFC 5321, 5322, 6530, 6531, 6532. + +## Requirements ## + + * [Composer](https://getcomposer.org) is required for installation + * [Spoofchecking](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/SpoofCheckValidation.php) and [DNSCheckValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/DNSCheckValidation.php) validation requires that your PHP system has the [PHP Internationalization Libraries](https://php.net/manual/en/book.intl.php) (also known as PHP Intl) + +## Installation ## + +Run the command below to install via Composer + +```shell +composer require egulias/email-validator "~2.1" +``` + +## Getting Started ## +`EmailValidator`requires you to decide which (or combination of them) validation/s strategy/ies you'd like to follow for each [validation](#available-validations). + +A basic example with the RFC validation +```php +isValid("example@example.com", new RFCValidation()); //true +``` + + +### Available validations ### + +1. [RFCValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/RFCValidation.php) +2. [NoRFCWarningsValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/NoRFCWarningsValidation.php) +3. [DNSCheckValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/DNSCheckValidation.php) +4. [SpoofCheckValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/SpoofCheckValidation.php) +5. [MultipleValidationWithAnd](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/MultipleValidationWithAnd.php) +6. [Your own validation](#how-to-extend) + +`MultipleValidationWithAnd` + +It is a validation that operates over other validations performing a logical and (&&) over the result of each validation. + +```php +isValid("example@example.com", $multipleValidations); //true +``` + +### How to extend ### + +It's easy! You just need to implement [EmailValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/EmailValidation.php) and you can use your own validation. + + +## Other Contributors ## +(You can find current contributors [here](https://github.com/egulias/EmailValidator/graphs/contributors)) + +As this is a port from another library and work, here are other people related to the previous one: + +* Ricard Clau [@ricardclau](https://github.com/ricardclau): Performance against PHP built-in filter_var +* Josepf Bielawski [@stloyd](https://github.com/stloyd): For its first re-work of Dominic's lib +* Dominic Sayers [@dominicsayers](https://github.com/dominicsayers): The original isemail function + +## License ## +Released under the MIT License attached with this code. + diff --git a/vendor/egulias/email-validator/composer.json b/vendor/egulias/email-validator/composer.json new file mode 100644 index 0000000..5423e9f --- /dev/null +++ b/vendor/egulias/email-validator/composer.json @@ -0,0 +1,44 @@ +{ + "name": "egulias/email-validator", + "description": "A library for validating emails against several RFCs", + "homepage": "https://github.com/egulias/EmailValidator", + "type": "Library", + "keywords": ["email", "validation", "validator", "emailvalidation", "emailvalidator"], + "license": "MIT", + "authors": [ + {"name": "Eduardo Gulias Davis"} + ], + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "repositories": [ + { + "type": "git", + "url": "https://github.com/dominicsayers/isemail" + } + ], + "require": { + "php": ">= 5.5", + "doctrine/lexer": "^1.0.1" + }, + "require-dev" : { + "satooshi/php-coveralls": "^1.0.1", + "phpunit/phpunit": "^4.8.35||^5.7||^6.0", + "dominicsayers/isemail": "dev-master" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" + }, + "autoload": { + "psr-4": { + "Egulias\\EmailValidator\\": "EmailValidator" + } + }, + "autoload-dev": { + "psr-4": { + "Egulias\\Tests\\": "test" + } + } +} diff --git a/vendor/egulias/email-validator/phpunit.xml.dist b/vendor/egulias/email-validator/phpunit.xml.dist new file mode 100644 index 0000000..b0812f9 --- /dev/null +++ b/vendor/egulias/email-validator/phpunit.xml.dist @@ -0,0 +1,26 @@ + + + + + + ./Tests/EmailValidator + ./vendor/ + + + + + + ./vendor + + + diff --git a/vendor/erusev/parsedown/LICENSE.txt b/vendor/erusev/parsedown/LICENSE.txt new file mode 100644 index 0000000..8e7c764 --- /dev/null +++ b/vendor/erusev/parsedown/LICENSE.txt @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013-2018 Emanuil Rusev, erusev.com + +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/erusev/parsedown/Parsedown.php b/vendor/erusev/parsedown/Parsedown.php new file mode 100644 index 0000000..87d612a --- /dev/null +++ b/vendor/erusev/parsedown/Parsedown.php @@ -0,0 +1,1679 @@ +DefinitionData = array(); + + # standardize line breaks + $text = str_replace(array("\r\n", "\r"), "\n", $text); + + # remove surrounding line breaks + $text = trim($text, "\n"); + + # split text into lines + $lines = explode("\n", $text); + + # iterate through lines to identify blocks + $markup = $this->lines($lines); + + # trim line breaks + $markup = trim($markup, "\n"); + + return $markup; + } + + # + # Setters + # + + function setBreaksEnabled($breaksEnabled) + { + $this->breaksEnabled = $breaksEnabled; + + return $this; + } + + protected $breaksEnabled; + + function setMarkupEscaped($markupEscaped) + { + $this->markupEscaped = $markupEscaped; + + return $this; + } + + protected $markupEscaped; + + function setUrlsLinked($urlsLinked) + { + $this->urlsLinked = $urlsLinked; + + return $this; + } + + protected $urlsLinked = true; + + function setSafeMode($safeMode) + { + $this->safeMode = (bool) $safeMode; + + return $this; + } + + protected $safeMode; + + protected $safeLinksWhitelist = array( + 'http://', + 'https://', + 'ftp://', + 'ftps://', + 'mailto:', + 'data:image/png;base64,', + 'data:image/gif;base64,', + 'data:image/jpeg;base64,', + 'irc:', + 'ircs:', + 'git:', + 'ssh:', + 'news:', + 'steam:', + ); + + # + # Lines + # + + protected $BlockTypes = array( + '#' => array('Header'), + '*' => array('Rule', 'List'), + '+' => array('List'), + '-' => array('SetextHeader', 'Table', 'Rule', 'List'), + '0' => array('List'), + '1' => array('List'), + '2' => array('List'), + '3' => array('List'), + '4' => array('List'), + '5' => array('List'), + '6' => array('List'), + '7' => array('List'), + '8' => array('List'), + '9' => array('List'), + ':' => array('Table'), + '<' => array('Comment', 'Markup'), + '=' => array('SetextHeader'), + '>' => array('Quote'), + '[' => array('Reference'), + '_' => array('Rule'), + '`' => array('FencedCode'), + '|' => array('Table'), + '~' => array('FencedCode'), + ); + + # ~ + + protected $unmarkedBlockTypes = array( + 'Code', + ); + + # + # Blocks + # + + protected function lines(array $lines) + { + $CurrentBlock = null; + + foreach ($lines as $line) + { + if (chop($line) === '') + { + if (isset($CurrentBlock)) + { + $CurrentBlock['interrupted'] = true; + } + + continue; + } + + if (strpos($line, "\t") !== false) + { + $parts = explode("\t", $line); + + $line = $parts[0]; + + unset($parts[0]); + + foreach ($parts as $part) + { + $shortage = 4 - mb_strlen($line, 'utf-8') % 4; + + $line .= str_repeat(' ', $shortage); + $line .= $part; + } + } + + $indent = 0; + + while (isset($line[$indent]) and $line[$indent] === ' ') + { + $indent ++; + } + + $text = $indent > 0 ? substr($line, $indent) : $line; + + # ~ + + $Line = array('body' => $line, 'indent' => $indent, 'text' => $text); + + # ~ + + if (isset($CurrentBlock['continuable'])) + { + $Block = $this->{'block'.$CurrentBlock['type'].'Continue'}($Line, $CurrentBlock); + + if (isset($Block)) + { + $CurrentBlock = $Block; + + continue; + } + else + { + if ($this->isBlockCompletable($CurrentBlock['type'])) + { + $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock); + } + } + } + + # ~ + + $marker = $text[0]; + + # ~ + + $blockTypes = $this->unmarkedBlockTypes; + + if (isset($this->BlockTypes[$marker])) + { + foreach ($this->BlockTypes[$marker] as $blockType) + { + $blockTypes []= $blockType; + } + } + + # + # ~ + + foreach ($blockTypes as $blockType) + { + $Block = $this->{'block'.$blockType}($Line, $CurrentBlock); + + if (isset($Block)) + { + $Block['type'] = $blockType; + + if ( ! isset($Block['identified'])) + { + $Blocks []= $CurrentBlock; + + $Block['identified'] = true; + } + + if ($this->isBlockContinuable($blockType)) + { + $Block['continuable'] = true; + } + + $CurrentBlock = $Block; + + continue 2; + } + } + + # ~ + + if (isset($CurrentBlock) and ! isset($CurrentBlock['type']) and ! isset($CurrentBlock['interrupted'])) + { + $CurrentBlock['element']['text'] .= "\n".$text; + } + else + { + $Blocks []= $CurrentBlock; + + $CurrentBlock = $this->paragraph($Line); + + $CurrentBlock['identified'] = true; + } + } + + # ~ + + if (isset($CurrentBlock['continuable']) and $this->isBlockCompletable($CurrentBlock['type'])) + { + $CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock); + } + + # ~ + + $Blocks []= $CurrentBlock; + + unset($Blocks[0]); + + # ~ + + $markup = ''; + + foreach ($Blocks as $Block) + { + if (isset($Block['hidden'])) + { + continue; + } + + $markup .= "\n"; + $markup .= isset($Block['markup']) ? $Block['markup'] : $this->element($Block['element']); + } + + $markup .= "\n"; + + # ~ + + return $markup; + } + + protected function isBlockContinuable($Type) + { + return method_exists($this, 'block'.$Type.'Continue'); + } + + protected function isBlockCompletable($Type) + { + return method_exists($this, 'block'.$Type.'Complete'); + } + + # + # Code + + protected function blockCode($Line, $Block = null) + { + if (isset($Block) and ! isset($Block['type']) and ! isset($Block['interrupted'])) + { + return; + } + + if ($Line['indent'] >= 4) + { + $text = substr($Line['body'], 4); + + $Block = array( + 'element' => array( + 'name' => 'pre', + 'handler' => 'element', + 'text' => array( + 'name' => 'code', + 'text' => $text, + ), + ), + ); + + return $Block; + } + } + + protected function blockCodeContinue($Line, $Block) + { + if ($Line['indent'] >= 4) + { + if (isset($Block['interrupted'])) + { + $Block['element']['text']['text'] .= "\n"; + + unset($Block['interrupted']); + } + + $Block['element']['text']['text'] .= "\n"; + + $text = substr($Line['body'], 4); + + $Block['element']['text']['text'] .= $text; + + return $Block; + } + } + + protected function blockCodeComplete($Block) + { + $text = $Block['element']['text']['text']; + + $Block['element']['text']['text'] = $text; + + return $Block; + } + + # + # Comment + + protected function blockComment($Line) + { + if ($this->markupEscaped or $this->safeMode) + { + return; + } + + if (isset($Line['text'][3]) and $Line['text'][3] === '-' and $Line['text'][2] === '-' and $Line['text'][1] === '!') + { + $Block = array( + 'markup' => $Line['body'], + ); + + if (preg_match('/-->$/', $Line['text'])) + { + $Block['closed'] = true; + } + + return $Block; + } + } + + protected function blockCommentContinue($Line, array $Block) + { + if (isset($Block['closed'])) + { + return; + } + + $Block['markup'] .= "\n" . $Line['body']; + + if (preg_match('/-->$/', $Line['text'])) + { + $Block['closed'] = true; + } + + return $Block; + } + + # + # Fenced Code + + protected function blockFencedCode($Line) + { + if (preg_match('/^['.$Line['text'][0].']{3,}[ ]*([^`]+)?[ ]*$/', $Line['text'], $matches)) + { + $Element = array( + 'name' => 'code', + 'text' => '', + ); + + if (isset($matches[1])) + { + $class = 'language-'.$matches[1]; + + $Element['attributes'] = array( + 'class' => $class, + ); + } + + $Block = array( + 'char' => $Line['text'][0], + 'element' => array( + 'name' => 'pre', + 'handler' => 'element', + 'text' => $Element, + ), + ); + + return $Block; + } + } + + protected function blockFencedCodeContinue($Line, $Block) + { + if (isset($Block['complete'])) + { + return; + } + + if (isset($Block['interrupted'])) + { + $Block['element']['text']['text'] .= "\n"; + + unset($Block['interrupted']); + } + + if (preg_match('/^'.$Block['char'].'{3,}[ ]*$/', $Line['text'])) + { + $Block['element']['text']['text'] = substr($Block['element']['text']['text'], 1); + + $Block['complete'] = true; + + return $Block; + } + + $Block['element']['text']['text'] .= "\n".$Line['body']; + + return $Block; + } + + protected function blockFencedCodeComplete($Block) + { + $text = $Block['element']['text']['text']; + + $Block['element']['text']['text'] = $text; + + return $Block; + } + + # + # Header + + protected function blockHeader($Line) + { + if (isset($Line['text'][1])) + { + $level = 1; + + while (isset($Line['text'][$level]) and $Line['text'][$level] === '#') + { + $level ++; + } + + if ($level > 6) + { + return; + } + + $text = trim($Line['text'], '# '); + + $Block = array( + 'element' => array( + 'name' => 'h' . min(6, $level), + 'text' => $text, + 'handler' => 'line', + ), + ); + + return $Block; + } + } + + # + # List + + protected function blockList($Line) + { + list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]+[.]'); + + if (preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches)) + { + $Block = array( + 'indent' => $Line['indent'], + 'pattern' => $pattern, + 'element' => array( + 'name' => $name, + 'handler' => 'elements', + ), + ); + + if($name === 'ol') + { + $listStart = stristr($matches[0], '.', true); + + if($listStart !== '1') + { + $Block['element']['attributes'] = array('start' => $listStart); + } + } + + $Block['li'] = array( + 'name' => 'li', + 'handler' => 'li', + 'text' => array( + $matches[2], + ), + ); + + $Block['element']['text'] []= & $Block['li']; + + return $Block; + } + } + + protected function blockListContinue($Line, array $Block) + { + if ($Block['indent'] === $Line['indent'] and preg_match('/^'.$Block['pattern'].'(?:[ ]+(.*)|$)/', $Line['text'], $matches)) + { + if (isset($Block['interrupted'])) + { + $Block['li']['text'] []= ''; + + $Block['loose'] = true; + + unset($Block['interrupted']); + } + + unset($Block['li']); + + $text = isset($matches[1]) ? $matches[1] : ''; + + $Block['li'] = array( + 'name' => 'li', + 'handler' => 'li', + 'text' => array( + $text, + ), + ); + + $Block['element']['text'] []= & $Block['li']; + + return $Block; + } + + if ($Line['text'][0] === '[' and $this->blockReference($Line)) + { + return $Block; + } + + if ( ! isset($Block['interrupted'])) + { + $text = preg_replace('/^[ ]{0,4}/', '', $Line['body']); + + $Block['li']['text'] []= $text; + + return $Block; + } + + if ($Line['indent'] > 0) + { + $Block['li']['text'] []= ''; + + $text = preg_replace('/^[ ]{0,4}/', '', $Line['body']); + + $Block['li']['text'] []= $text; + + unset($Block['interrupted']); + + return $Block; + } + } + + protected function blockListComplete(array $Block) + { + if (isset($Block['loose'])) + { + foreach ($Block['element']['text'] as &$li) + { + if (end($li['text']) !== '') + { + $li['text'] []= ''; + } + } + } + + return $Block; + } + + # + # Quote + + protected function blockQuote($Line) + { + if (preg_match('/^>[ ]?(.*)/', $Line['text'], $matches)) + { + $Block = array( + 'element' => array( + 'name' => 'blockquote', + 'handler' => 'lines', + 'text' => (array) $matches[1], + ), + ); + + return $Block; + } + } + + protected function blockQuoteContinue($Line, array $Block) + { + if ($Line['text'][0] === '>' and preg_match('/^>[ ]?(.*)/', $Line['text'], $matches)) + { + if (isset($Block['interrupted'])) + { + $Block['element']['text'] []= ''; + + unset($Block['interrupted']); + } + + $Block['element']['text'] []= $matches[1]; + + return $Block; + } + + if ( ! isset($Block['interrupted'])) + { + $Block['element']['text'] []= $Line['text']; + + return $Block; + } + } + + # + # Rule + + protected function blockRule($Line) + { + if (preg_match('/^(['.$Line['text'][0].'])([ ]*\1){2,}[ ]*$/', $Line['text'])) + { + $Block = array( + 'element' => array( + 'name' => 'hr' + ), + ); + + return $Block; + } + } + + # + # Setext + + protected function blockSetextHeader($Line, array $Block = null) + { + if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) + { + return; + } + + if (chop($Line['text'], $Line['text'][0]) === '') + { + $Block['element']['name'] = $Line['text'][0] === '=' ? 'h1' : 'h2'; + + return $Block; + } + } + + # + # Markup + + protected function blockMarkup($Line) + { + if ($this->markupEscaped or $this->safeMode) + { + return; + } + + if (preg_match('/^<(\w[\w-]*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches)) + { + $element = strtolower($matches[1]); + + if (in_array($element, $this->textLevelElements)) + { + return; + } + + $Block = array( + 'name' => $matches[1], + 'depth' => 0, + 'markup' => $Line['text'], + ); + + $length = strlen($matches[0]); + + $remainder = substr($Line['text'], $length); + + if (trim($remainder) === '') + { + if (isset($matches[2]) or in_array($matches[1], $this->voidElements)) + { + $Block['closed'] = true; + + $Block['void'] = true; + } + } + else + { + if (isset($matches[2]) or in_array($matches[1], $this->voidElements)) + { + return; + } + + if (preg_match('/<\/'.$matches[1].'>[ ]*$/i', $remainder)) + { + $Block['closed'] = true; + } + } + + return $Block; + } + } + + protected function blockMarkupContinue($Line, array $Block) + { + if (isset($Block['closed'])) + { + return; + } + + if (preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) # open + { + $Block['depth'] ++; + } + + if (preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) # close + { + if ($Block['depth'] > 0) + { + $Block['depth'] --; + } + else + { + $Block['closed'] = true; + } + } + + if (isset($Block['interrupted'])) + { + $Block['markup'] .= "\n"; + + unset($Block['interrupted']); + } + + $Block['markup'] .= "\n".$Line['body']; + + return $Block; + } + + # + # Reference + + protected function blockReference($Line) + { + if (preg_match('/^\[(.+?)\]:[ ]*?(?:[ ]+["\'(](.+)["\')])?[ ]*$/', $Line['text'], $matches)) + { + $id = strtolower($matches[1]); + + $Data = array( + 'url' => $matches[2], + 'title' => null, + ); + + if (isset($matches[3])) + { + $Data['title'] = $matches[3]; + } + + $this->DefinitionData['Reference'][$id] = $Data; + + $Block = array( + 'hidden' => true, + ); + + return $Block; + } + } + + # + # Table + + protected function blockTable($Line, array $Block = null) + { + if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) + { + return; + } + + if (strpos($Block['element']['text'], '|') !== false and chop($Line['text'], ' -:|') === '') + { + $alignments = array(); + + $divider = $Line['text']; + + $divider = trim($divider); + $divider = trim($divider, '|'); + + $dividerCells = explode('|', $divider); + + foreach ($dividerCells as $dividerCell) + { + $dividerCell = trim($dividerCell); + + if ($dividerCell === '') + { + continue; + } + + $alignment = null; + + if ($dividerCell[0] === ':') + { + $alignment = 'left'; + } + + if (substr($dividerCell, - 1) === ':') + { + $alignment = $alignment === 'left' ? 'center' : 'right'; + } + + $alignments []= $alignment; + } + + # ~ + + $HeaderElements = array(); + + $header = $Block['element']['text']; + + $header = trim($header); + $header = trim($header, '|'); + + $headerCells = explode('|', $header); + + foreach ($headerCells as $index => $headerCell) + { + $headerCell = trim($headerCell); + + $HeaderElement = array( + 'name' => 'th', + 'text' => $headerCell, + 'handler' => 'line', + ); + + if (isset($alignments[$index])) + { + $alignment = $alignments[$index]; + + $HeaderElement['attributes'] = array( + 'style' => 'text-align: '.$alignment.';', + ); + } + + $HeaderElements []= $HeaderElement; + } + + # ~ + + $Block = array( + 'alignments' => $alignments, + 'identified' => true, + 'element' => array( + 'name' => 'table', + 'handler' => 'elements', + ), + ); + + $Block['element']['text'] []= array( + 'name' => 'thead', + 'handler' => 'elements', + ); + + $Block['element']['text'] []= array( + 'name' => 'tbody', + 'handler' => 'elements', + 'text' => array(), + ); + + $Block['element']['text'][0]['text'] []= array( + 'name' => 'tr', + 'handler' => 'elements', + 'text' => $HeaderElements, + ); + + return $Block; + } + } + + protected function blockTableContinue($Line, array $Block) + { + if (isset($Block['interrupted'])) + { + return; + } + + if ($Line['text'][0] === '|' or strpos($Line['text'], '|')) + { + $Elements = array(); + + $row = $Line['text']; + + $row = trim($row); + $row = trim($row, '|'); + + preg_match_all('/(?:(\\\\[|])|[^|`]|`[^`]+`|`)+/', $row, $matches); + + foreach ($matches[0] as $index => $cell) + { + $cell = trim($cell); + + $Element = array( + 'name' => 'td', + 'handler' => 'line', + 'text' => $cell, + ); + + if (isset($Block['alignments'][$index])) + { + $Element['attributes'] = array( + 'style' => 'text-align: '.$Block['alignments'][$index].';', + ); + } + + $Elements []= $Element; + } + + $Element = array( + 'name' => 'tr', + 'handler' => 'elements', + 'text' => $Elements, + ); + + $Block['element']['text'][1]['text'] []= $Element; + + return $Block; + } + } + + # + # ~ + # + + protected function paragraph($Line) + { + $Block = array( + 'element' => array( + 'name' => 'p', + 'text' => $Line['text'], + 'handler' => 'line', + ), + ); + + return $Block; + } + + # + # Inline Elements + # + + protected $InlineTypes = array( + '"' => array('SpecialCharacter'), + '!' => array('Image'), + '&' => array('SpecialCharacter'), + '*' => array('Emphasis'), + ':' => array('Url'), + '<' => array('UrlTag', 'EmailTag', 'Markup', 'SpecialCharacter'), + '>' => array('SpecialCharacter'), + '[' => array('Link'), + '_' => array('Emphasis'), + '`' => array('Code'), + '~' => array('Strikethrough'), + '\\' => array('EscapeSequence'), + ); + + # ~ + + protected $inlineMarkerList = '!"*_&[:<>`~\\'; + + # + # ~ + # + + public function line($text, $nonNestables=array()) + { + $markup = ''; + + # $excerpt is based on the first occurrence of a marker + + while ($excerpt = strpbrk($text, $this->inlineMarkerList)) + { + $marker = $excerpt[0]; + + $markerPosition = strpos($text, $marker); + + $Excerpt = array('text' => $excerpt, 'context' => $text); + + foreach ($this->InlineTypes[$marker] as $inlineType) + { + # check to see if the current inline type is nestable in the current context + + if ( ! empty($nonNestables) and in_array($inlineType, $nonNestables)) + { + continue; + } + + $Inline = $this->{'inline'.$inlineType}($Excerpt); + + if ( ! isset($Inline)) + { + continue; + } + + # makes sure that the inline belongs to "our" marker + + if (isset($Inline['position']) and $Inline['position'] > $markerPosition) + { + continue; + } + + # sets a default inline position + + if ( ! isset($Inline['position'])) + { + $Inline['position'] = $markerPosition; + } + + # cause the new element to 'inherit' our non nestables + + foreach ($nonNestables as $non_nestable) + { + $Inline['element']['nonNestables'][] = $non_nestable; + } + + # the text that comes before the inline + $unmarkedText = substr($text, 0, $Inline['position']); + + # compile the unmarked text + $markup .= $this->unmarkedText($unmarkedText); + + # compile the inline + $markup .= isset($Inline['markup']) ? $Inline['markup'] : $this->element($Inline['element']); + + # remove the examined text + $text = substr($text, $Inline['position'] + $Inline['extent']); + + continue 2; + } + + # the marker does not belong to an inline + + $unmarkedText = substr($text, 0, $markerPosition + 1); + + $markup .= $this->unmarkedText($unmarkedText); + + $text = substr($text, $markerPosition + 1); + } + + $markup .= $this->unmarkedText($text); + + return $markup; + } + + # + # ~ + # + + protected function inlineCode($Excerpt) + { + $marker = $Excerpt['text'][0]; + + if (preg_match('/^('.$marker.'+)[ ]*(.+?)[ ]*(? strlen($matches[0]), + 'element' => array( + 'name' => 'code', + 'text' => $text, + ), + ); + } + } + + protected function inlineEmailTag($Excerpt) + { + if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<((mailto:)?\S+?@\S+?)>/i', $Excerpt['text'], $matches)) + { + $url = $matches[1]; + + if ( ! isset($matches[2])) + { + $url = 'mailto:' . $url; + } + + return array( + 'extent' => strlen($matches[0]), + 'element' => array( + 'name' => 'a', + 'text' => $matches[1], + 'attributes' => array( + 'href' => $url, + ), + ), + ); + } + } + + protected function inlineEmphasis($Excerpt) + { + if ( ! isset($Excerpt['text'][1])) + { + return; + } + + $marker = $Excerpt['text'][0]; + + if ($Excerpt['text'][1] === $marker and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) + { + $emphasis = 'strong'; + } + elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) + { + $emphasis = 'em'; + } + else + { + return; + } + + return array( + 'extent' => strlen($matches[0]), + 'element' => array( + 'name' => $emphasis, + 'handler' => 'line', + 'text' => $matches[1], + ), + ); + } + + protected function inlineEscapeSequence($Excerpt) + { + if (isset($Excerpt['text'][1]) and in_array($Excerpt['text'][1], $this->specialCharacters)) + { + return array( + 'markup' => $Excerpt['text'][1], + 'extent' => 2, + ); + } + } + + protected function inlineImage($Excerpt) + { + if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[') + { + return; + } + + $Excerpt['text']= substr($Excerpt['text'], 1); + + $Link = $this->inlineLink($Excerpt); + + if ($Link === null) + { + return; + } + + $Inline = array( + 'extent' => $Link['extent'] + 1, + 'element' => array( + 'name' => 'img', + 'attributes' => array( + 'src' => $Link['element']['attributes']['href'], + 'alt' => $Link['element']['text'], + ), + ), + ); + + $Inline['element']['attributes'] += $Link['element']['attributes']; + + unset($Inline['element']['attributes']['href']); + + return $Inline; + } + + protected function inlineLink($Excerpt) + { + $Element = array( + 'name' => 'a', + 'handler' => 'line', + 'nonNestables' => array('Url', 'Link'), + 'text' => null, + 'attributes' => array( + 'href' => null, + 'title' => null, + ), + ); + + $extent = 0; + + $remainder = $Excerpt['text']; + + if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches)) + { + $Element['text'] = $matches[1]; + + $extent += strlen($matches[0]); + + $remainder = substr($remainder, $extent); + } + else + { + return; + } + + if (preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*"|\'[^\']*\'))?\s*[)]/', $remainder, $matches)) + { + $Element['attributes']['href'] = $matches[1]; + + if (isset($matches[2])) + { + $Element['attributes']['title'] = substr($matches[2], 1, - 1); + } + + $extent += strlen($matches[0]); + } + else + { + if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches)) + { + $definition = strlen($matches[1]) ? $matches[1] : $Element['text']; + $definition = strtolower($definition); + + $extent += strlen($matches[0]); + } + else + { + $definition = strtolower($Element['text']); + } + + if ( ! isset($this->DefinitionData['Reference'][$definition])) + { + return; + } + + $Definition = $this->DefinitionData['Reference'][$definition]; + + $Element['attributes']['href'] = $Definition['url']; + $Element['attributes']['title'] = $Definition['title']; + } + + return array( + 'extent' => $extent, + 'element' => $Element, + ); + } + + protected function inlineMarkup($Excerpt) + { + if ($this->markupEscaped or $this->safeMode or strpos($Excerpt['text'], '>') === false) + { + return; + } + + if ($Excerpt['text'][1] === '/' and preg_match('/^<\/\w[\w-]*[ ]*>/s', $Excerpt['text'], $matches)) + { + return array( + 'markup' => $matches[0], + 'extent' => strlen($matches[0]), + ); + } + + if ($Excerpt['text'][1] === '!' and preg_match('/^/s', $Excerpt['text'], $matches)) + { + return array( + 'markup' => $matches[0], + 'extent' => strlen($matches[0]), + ); + } + + if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\w[\w-]*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $Excerpt['text'], $matches)) + { + return array( + 'markup' => $matches[0], + 'extent' => strlen($matches[0]), + ); + } + } + + protected function inlineSpecialCharacter($Excerpt) + { + if ($Excerpt['text'][0] === '&' and ! preg_match('/^&#?\w+;/', $Excerpt['text'])) + { + return array( + 'markup' => '&', + 'extent' => 1, + ); + } + + $SpecialCharacter = array('>' => 'gt', '<' => 'lt', '"' => 'quot'); + + if (isset($SpecialCharacter[$Excerpt['text'][0]])) + { + return array( + 'markup' => '&'.$SpecialCharacter[$Excerpt['text'][0]].';', + 'extent' => 1, + ); + } + } + + protected function inlineStrikethrough($Excerpt) + { + if ( ! isset($Excerpt['text'][1])) + { + return; + } + + if ($Excerpt['text'][1] === '~' and preg_match('/^~~(?=\S)(.+?)(?<=\S)~~/', $Excerpt['text'], $matches)) + { + return array( + 'extent' => strlen($matches[0]), + 'element' => array( + 'name' => 'del', + 'text' => $matches[1], + 'handler' => 'line', + ), + ); + } + } + + protected function inlineUrl($Excerpt) + { + if ($this->urlsLinked !== true or ! isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/') + { + return; + } + + if (preg_match('/\bhttps?:[\/]{2}[^\s<]+\b\/*/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE)) + { + $url = $matches[0][0]; + + $Inline = array( + 'extent' => strlen($matches[0][0]), + 'position' => $matches[0][1], + 'element' => array( + 'name' => 'a', + 'text' => $url, + 'attributes' => array( + 'href' => $url, + ), + ), + ); + + return $Inline; + } + } + + protected function inlineUrlTag($Excerpt) + { + if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<(\w+:\/{2}[^ >]+)>/i', $Excerpt['text'], $matches)) + { + $url = $matches[1]; + + return array( + 'extent' => strlen($matches[0]), + 'element' => array( + 'name' => 'a', + 'text' => $url, + 'attributes' => array( + 'href' => $url, + ), + ), + ); + } + } + + # ~ + + protected function unmarkedText($text) + { + if ($this->breaksEnabled) + { + $text = preg_replace('/[ ]*\n/', "
\n", $text); + } + else + { + $text = preg_replace('/(?:[ ][ ]+|[ ]*\\\\)\n/', "
\n", $text); + $text = str_replace(" \n", "\n", $text); + } + + return $text; + } + + # + # Handlers + # + + protected function element(array $Element) + { + if ($this->safeMode) + { + $Element = $this->sanitiseElement($Element); + } + + $markup = '<'.$Element['name']; + + if (isset($Element['attributes'])) + { + foreach ($Element['attributes'] as $name => $value) + { + if ($value === null) + { + continue; + } + + $markup .= ' '.$name.'="'.self::escape($value).'"'; + } + } + + if (isset($Element['text'])) + { + $markup .= '>'; + + if (!isset($Element['nonNestables'])) + { + $Element['nonNestables'] = array(); + } + + if (isset($Element['handler'])) + { + $markup .= $this->{$Element['handler']}($Element['text'], $Element['nonNestables']); + } + else + { + $markup .= self::escape($Element['text'], true); + } + + $markup .= ''; + } + else + { + $markup .= ' />'; + } + + return $markup; + } + + protected function elements(array $Elements) + { + $markup = ''; + + foreach ($Elements as $Element) + { + $markup .= "\n" . $this->element($Element); + } + + $markup .= "\n"; + + return $markup; + } + + # ~ + + protected function li($lines) + { + $markup = $this->lines($lines); + + $trimmedMarkup = trim($markup); + + if ( ! in_array('', $lines) and substr($trimmedMarkup, 0, 3) === '

') + { + $markup = $trimmedMarkup; + $markup = substr($markup, 3); + + $position = strpos($markup, "

"); + + $markup = substr_replace($markup, '', $position, 4); + } + + return $markup; + } + + # + # Deprecated Methods + # + + function parse($text) + { + $markup = $this->text($text); + + return $markup; + } + + protected function sanitiseElement(array $Element) + { + static $goodAttribute = '/^[a-zA-Z0-9][a-zA-Z0-9-_]*+$/'; + static $safeUrlNameToAtt = array( + 'a' => 'href', + 'img' => 'src', + ); + + if (isset($safeUrlNameToAtt[$Element['name']])) + { + $Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]); + } + + if ( ! empty($Element['attributes'])) + { + foreach ($Element['attributes'] as $att => $val) + { + # filter out badly parsed attribute + if ( ! preg_match($goodAttribute, $att)) + { + unset($Element['attributes'][$att]); + } + # dump onevent attribute + elseif (self::striAtStart($att, 'on')) + { + unset($Element['attributes'][$att]); + } + } + } + + return $Element; + } + + protected function filterUnsafeUrlInAttribute(array $Element, $attribute) + { + foreach ($this->safeLinksWhitelist as $scheme) + { + if (self::striAtStart($Element['attributes'][$attribute], $scheme)) + { + return $Element; + } + } + + $Element['attributes'][$attribute] = str_replace(':', '%3A', $Element['attributes'][$attribute]); + + return $Element; + } + + # + # Static Methods + # + + protected static function escape($text, $allowQuotes = false) + { + return htmlspecialchars($text, $allowQuotes ? ENT_NOQUOTES : ENT_QUOTES, 'UTF-8'); + } + + protected static function striAtStart($string, $needle) + { + $len = strlen($needle); + + if ($len > strlen($string)) + { + return false; + } + else + { + return strtolower(substr($string, 0, $len)) === strtolower($needle); + } + } + + static function instance($name = 'default') + { + if (isset(self::$instances[$name])) + { + return self::$instances[$name]; + } + + $instance = new static(); + + self::$instances[$name] = $instance; + + return $instance; + } + + private static $instances = array(); + + # + # Fields + # + + protected $DefinitionData; + + # + # Read-Only + + protected $specialCharacters = array( + '\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '>', '#', '+', '-', '.', '!', '|', + ); + + protected $StrongRegex = array( + '*' => '/^[*]{2}((?:\\\\\*|[^*]|[*][^*]*[*])+?)[*]{2}(?![*])/s', + '_' => '/^__((?:\\\\_|[^_]|_[^_]*_)+?)__(?!_)/us', + ); + + protected $EmRegex = array( + '*' => '/^[*]((?:\\\\\*|[^*]|[*][*][^*]+?[*][*])+?)[*](?![*])/s', + '_' => '/^_((?:\\\\_|[^_]|__[^_]*__)+?)_(?!_)\b/us', + ); + + protected $regexHtmlAttribute = '[a-zA-Z_:][\w:.-]*(?:\s*=\s*(?:[^"\'=<>`\s]+|"[^"]*"|\'[^\']*\'))?'; + + protected $voidElements = array( + 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', + ); + + protected $textLevelElements = array( + 'a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont', + 'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing', + 'i', 'rp', 'del', 'code', 'strike', 'marquee', + 'q', 'rt', 'ins', 'font', 'strong', + 's', 'tt', 'kbd', 'mark', + 'u', 'xm', 'sub', 'nobr', + 'sup', 'ruby', + 'var', 'span', + 'wbr', 'time', + ); +} diff --git a/vendor/erusev/parsedown/README.md b/vendor/erusev/parsedown/README.md new file mode 100644 index 0000000..b5d9ed2 --- /dev/null +++ b/vendor/erusev/parsedown/README.md @@ -0,0 +1,86 @@ +> I also make [Caret](https://caret.io?ref=parsedown) - a Markdown editor for Mac and PC. + +## Parsedown + +[![Build Status](https://img.shields.io/travis/erusev/parsedown/master.svg?style=flat-square)](https://travis-ci.org/erusev/parsedown) + + +Better Markdown Parser in PHP + +[Demo](http://parsedown.org/demo) | +[Benchmarks](http://parsedown.org/speed) | +[Tests](http://parsedown.org/tests/) | +[Documentation](https://github.com/erusev/parsedown/wiki/) + +### Features + +* One File +* No Dependencies +* Super Fast +* Extensible +* [GitHub flavored](https://help.github.com/articles/github-flavored-markdown) +* Tested in 5.3 to 7.1 and in HHVM +* [Markdown Extra extension](https://github.com/erusev/parsedown-extra) + +### Installation + +Include `Parsedown.php` or install [the composer package](https://packagist.org/packages/erusev/parsedown). + +### Example + +``` php +$Parsedown = new Parsedown(); + +echo $Parsedown->text('Hello _Parsedown_!'); # prints:

Hello Parsedown!

+``` + +More examples in [the wiki](https://github.com/erusev/parsedown/wiki/) and in [this video tutorial](http://youtu.be/wYZBY8DEikI). + +### Security + +Parsedown is capable of escaping user-input within the HTML that it generates. Additionally Parsedown will apply sanitisation to additional scripting vectors (such as scripting link destinations) that are introduced by the markdown syntax itself. + +To tell Parsedown that it is processing untrusted user-input, use the following: +```php +$parsedown = new Parsedown; +$parsedown->setSafeMode(true); +``` + +If instead, you wish to allow HTML within untrusted user-input, but still want output to be free from XSS it is recommended that you make use of a HTML sanitiser that allows HTML tags to be whitelisted, like [HTML Purifier](http://htmlpurifier.org/). + +In both cases you should strongly consider employing defence-in-depth measures, like [deploying a Content-Security-Policy](https://scotthelme.co.uk/content-security-policy-an-introduction/) (a browser security feature) so that your page is likely to be safe even if an attacker finds a vulnerability in one of the first lines of defence above. + +#### Security of Parsedown Extensions + +Safe mode does not necessarily yield safe results when using extensions to Parsedown. Extensions should be evaluated on their own to determine their specific safety against XSS. + +### Escaping HTML +> âš ï¸Â Â **WARNING:** This method isn't safe from XSS! + +If you wish to escape HTML **in trusted input**, you can use the following: +```php +$parsedown = new Parsedown; +$parsedown->setMarkupEscaped(true); +``` + +Beware that this still allows users to insert unsafe scripting vectors, such as links like `[xss](javascript:alert%281%29)`. + +### Questions + +**How does Parsedown work?** + +It tries to read Markdown like a human. First, it looks at the lines. It’s interested in how the lines start. This helps it recognise blocks. It knows, for example, that if a line starts with a `-` then perhaps it belongs to a list. Once it recognises the blocks, it continues to the content. As it reads, it watches out for special characters. This helps it recognise inline elements (or inlines). + +We call this approach "line based". We believe that Parsedown is the first Markdown parser to use it. Since the release of Parsedown, other developers have used the same approach to develop other Markdown parsers in PHP and in other languages. + +**Is it compliant with CommonMark?** + +It passes most of the CommonMark tests. Most of the tests that don't pass deal with cases that are quite uncommon. Still, as CommonMark matures, compliance should improve. + +**Who uses it?** + +[Laravel Framework](https://laravel.com/), [Bolt CMS](http://bolt.cm/), [Grav CMS](http://getgrav.org/), [Herbie CMS](http://www.getherbie.org/), [Kirby CMS](http://getkirby.com/), [October CMS](http://octobercms.com/), [Pico CMS](http://picocms.org), [Statamic CMS](http://www.statamic.com/), [phpDocumentor](http://www.phpdoc.org/), [RaspberryPi.org](http://www.raspberrypi.org/), [Symfony demo](https://github.com/symfony/symfony-demo) and [more](https://packagist.org/packages/erusev/parsedown/dependents). + +**How can I help?** + +Use it, star it, share it and if you feel generous, [donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=528P3NZQMP8N2). diff --git a/vendor/erusev/parsedown/composer.json b/vendor/erusev/parsedown/composer.json new file mode 100644 index 0000000..f8b40f8 --- /dev/null +++ b/vendor/erusev/parsedown/composer.json @@ -0,0 +1,33 @@ +{ + "name": "erusev/parsedown", + "description": "Parser for Markdown.", + "keywords": ["markdown", "parser"], + "homepage": "http://parsedown.org", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "require": { + "php": ">=5.3.0", + "ext-mbstring": "*" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, + "autoload": { + "psr-0": {"Parsedown": ""} + }, + "autoload-dev": { + "psr-0": { + "TestParsedown": "test/", + "ParsedownTest": "test/", + "CommonMarkTest": "test/", + "CommonMarkTestWeak": "test/" + } + } +} diff --git a/vendor/fzaninotto/faker/.gitignore b/vendor/fzaninotto/faker/.gitignore new file mode 100644 index 0000000..7579f74 --- /dev/null +++ b/vendor/fzaninotto/faker/.gitignore @@ -0,0 +1,2 @@ +vendor +composer.lock diff --git a/vendor/fzaninotto/faker/.travis.yml b/vendor/fzaninotto/faker/.travis.yml new file mode 100644 index 0000000..a719ba8 --- /dev/null +++ b/vendor/fzaninotto/faker/.travis.yml @@ -0,0 +1,25 @@ +language: php + +dist: precise + +php: + - 5.3 + - 5.4 + - 5.5 + - 5.6 + - 7.0 + - 7.1 + - 7.2 + - nightly + +sudo: false + +cache: + directories: + - $HOME/.composer/cache + +before_script: + - travis_retry composer self-update + - travis_retry composer install --no-interaction --prefer-dist + +script: make sniff test diff --git a/vendor/fzaninotto/faker/CHANGELOG.md b/vendor/fzaninotto/faker/CHANGELOG.md new file mode 100644 index 0000000..df218b0 --- /dev/null +++ b/vendor/fzaninotto/faker/CHANGELOG.md @@ -0,0 +1,641 @@ +CHANGELOG +========= + +2018-07-12, v1.8.0 +------------------ + +- Typo in readme [\#1521](https://github.com/fzaninotto/Faker/pull/1521) ([jmhobbs](https://github.com/jmhobbs)) +- Replaced Hilll with Hill [\#1516](https://github.com/fzaninotto/Faker/pull/1516) ([MarkVaughn](https://github.com/MarkVaughn)) +- \[it\_IT\] Improve vat ID generated using official rules [\#1508](https://github.com/fzaninotto/Faker/pull/1508) ([mavimo](https://github.com/mavimo)) +- \[hu\_HU\] Address: Fix unnecessary new line in string [\#1507](https://github.com/fzaninotto/Faker/pull/1507) ([ntomka](https://github.com/ntomka)) +- add phone numer format [\#1506](https://github.com/fzaninotto/Faker/pull/1506) ([Enosh-Yu](https://github.com/Enosh-Yu)) +- Fix typo in fr\_CA Provider [\#1505](https://github.com/fzaninotto/Faker/pull/1505) ([ultreson](https://github.com/ultreson)) +- Add fake-car provider link [\#1497](https://github.com/fzaninotto/Faker/pull/1497) ([pelmered](https://github.com/pelmered)) +- create `passthrough` function [\#1493](https://github.com/fzaninotto/Faker/pull/1493) ([browner12](https://github.com/browner12)) +- update Polish bank list [\#1482](https://github.com/fzaninotto/Faker/pull/1482) ([IonBazan](https://github.com/IonBazan)) +- Update the parameters to check if the setter is callable [\#1470](https://github.com/fzaninotto/Faker/pull/1470) ([rossmitchell](https://github.com/rossmitchell)) +- Push the max date far into the future so the test can pass [\#1469](https://github.com/fzaninotto/Faker/pull/1469) ([rossmitchell](https://github.com/rossmitchell)) +- Update Address.php [\#1465](https://github.com/fzaninotto/Faker/pull/1465) ([Saibamen](https://github.com/Saibamen)) +- Turkish identity number for tr\_TR [\#1462](https://github.com/fzaninotto/Faker/pull/1462) ([aykutaras](https://github.com/aykutaras)) +- Fixing rare iin with 13-digits. [\#1450](https://github.com/fzaninotto/Faker/pull/1450) ([vadimonus](https://github.com/vadimonus)) +- Fix Polish PESEL faker [\#1449](https://github.com/fzaninotto/Faker/pull/1449) ([Dartui](https://github.com/Dartui)) +- Adds valid 08 number formats for fr\_FR [\#1439](https://github.com/fzaninotto/Faker/pull/1439) ([ppelgrims](https://github.com/ppelgrims)) +- Add YouTube provider link [\#1422](https://github.com/fzaninotto/Faker/pull/1422) ([aalaap](https://github.com/aalaap)) +- Update PHPDoc of the DateTime provider. [\#1419](https://github.com/fzaninotto/Faker/pull/1419) ([tomzx](https://github.com/tomzx)) +- Normalize name of variable [\#1412](https://github.com/fzaninotto/Faker/pull/1412) ([eaglewu](https://github.com/eaglewu)) +- Added "blockchain" to en-us company provider catchPhrase method [\#1411](https://github.com/fzaninotto/Faker/pull/1411) ([samoldenburg](https://github.com/samoldenburg)) +- Fix for Spot2 ORM EntityPopulator [\#1408](https://github.com/fzaninotto/Faker/pull/1408) ([michal-borek](https://github.com/michal-borek)) +- TH color name [\#1404](https://github.com/fzaninotto/Faker/pull/1404) ([Naruedom](https://github.com/Naruedom)) +- added Malaysia \[ms\_MY\] locale [\#1403](https://github.com/fzaninotto/Faker/pull/1403) ([kenfai](https://github.com/kenfai)) +- Implementation of the function that generates Brazilian area codes fixed. [\#1401](https://github.com/fzaninotto/Faker/pull/1401) ([jackmiras](https://github.com/jackmiras)) +- VISA retired the 13 digit PAN moved to new cardParams [\#1400](https://github.com/fzaninotto/Faker/pull/1400) ([hppycoder](https://github.com/hppycoder)) +- Remove unused variable inside closure [\#1395](https://github.com/fzaninotto/Faker/pull/1395) ([carusogabriel](https://github.com/carusogabriel)) +- .nz domain updates [\#1393](https://github.com/fzaninotto/Faker/pull/1393) ([xurizaemon](https://github.com/xurizaemon)) +- Add licenceCode method in the to es\_ES person provider [\#1392](https://github.com/fzaninotto/Faker/pull/1392) ([ffiguereo](https://github.com/ffiguereo)) +- allow `randomElements` to accept a Traversable object [\#1389](https://github.com/fzaninotto/Faker/pull/1389) ([browner12](https://github.com/browner12)) +- Doc: rg remove formatting [\#1387](https://github.com/fzaninotto/Faker/pull/1387) ([emtudo](https://github.com/emtudo)) +- Add numbers with start 4 [\#1386](https://github.com/fzaninotto/Faker/pull/1386) ([emtudo](https://github.com/emtudo)) +- update th\_TH mobile number format [\#1385](https://github.com/fzaninotto/Faker/pull/1385) ([earthpyy](https://github.com/earthpyy)) +- Translate country names for lv\_LV provider. [\#1383](https://github.com/fzaninotto/Faker/pull/1383) ([ronaldsgailis](https://github.com/ronaldsgailis)) +- Clean elses [\#1382](https://github.com/fzaninotto/Faker/pull/1382) ([carusogabriel](https://github.com/carusogabriel)) +- French vat formatter [\#1381](https://github.com/fzaninotto/Faker/pull/1381) ([ppelgrims](https://github.com/ppelgrims)) +- Replaces rtrim with preg\_replace [\#1380](https://github.com/fzaninotto/Faker/pull/1380) ([ppelgrims](https://github.com/ppelgrims)) +- Refactoring tests [\#1375](https://github.com/fzaninotto/Faker/pull/1375) ([carusogabriel](https://github.com/carusogabriel)) +- Added link in readme to provider FakerRestaurant [\#1374](https://github.com/fzaninotto/Faker/pull/1374) ([jzonta](https://github.com/jzonta)) +- Remove obsolete currency codes [\#1373](https://github.com/fzaninotto/Faker/pull/1373) ([tpraxl](https://github.com/tpraxl)) +- \[ru\_RU\] Updated countries and added source link [\#1372](https://github.com/fzaninotto/Faker/pull/1372) ([ilyahoilik](https://github.com/ilyahoilik)) +- Test against PHP 7.2 [\#1371](https://github.com/fzaninotto/Faker/pull/1371) ([carusogabriel](https://github.com/carusogabriel)) +- Feature: nl\_BE text provider [\#1370](https://github.com/fzaninotto/Faker/pull/1370) ([rauwebieten](https://github.com/rauwebieten)) +- default value for Payment::iban\(\) country code [\#1369](https://github.com/fzaninotto/Faker/pull/1369) ([madmanmax](https://github.com/madmanmax)) +- skip test failing on bigendian [\#1365](https://github.com/fzaninotto/Faker/pull/1365) ([remicollet](https://github.com/remicollet)) +- Update Person.php [\#1364](https://github.com/fzaninotto/Faker/pull/1364) ([majamusan](https://github.com/majamusan)) +- Prevent errors on private methods [\#1363](https://github.com/fzaninotto/Faker/pull/1363) ([petecoop](https://github.com/petecoop)) +- adds rijksregisternummer [\#1361](https://github.com/fzaninotto/Faker/pull/1361) ([ppelgrims](https://github.com/ppelgrims)) +- Add secondary address to fr\_FR provider [\#1356](https://github.com/fzaninotto/Faker/pull/1356) ([nicodmf](https://github.com/nicodmf)) +- Add company provider for tr\_TR [\#1355](https://github.com/fzaninotto/Faker/pull/1355) ([yuks](https://github.com/yuks)) +- nb\_NO provider updates [\#1350](https://github.com/fzaninotto/Faker/pull/1350) ([alexqhj](https://github.com/alexqhj)) +- only test available date range on 32-bit [\#1348](https://github.com/fzaninotto/Faker/pull/1348) ([remicollet](https://github.com/remicollet)) +- Bump PHPUnit version for namespace compatibility [\#1345](https://github.com/fzaninotto/Faker/pull/1345) ([carusogabriel](https://github.com/carusogabriel)) +- Use PSR-1 for PHPUnit TestCase [\#1344](https://github.com/fzaninotto/Faker/pull/1344) ([carusogabriel](https://github.com/carusogabriel)) +- Fix FR\_fr 07 prefix mobile number generation [\#1343](https://github.com/fzaninotto/Faker/pull/1343) ([svanpoeck](https://github.com/svanpoeck)) +- Update Text.php [\#1339](https://github.com/fzaninotto/Faker/pull/1339) ([gulaandrij](https://github.com/gulaandrij)) +- Add two new company type in the Swiss Provider [\#1336](https://github.com/fzaninotto/Faker/pull/1336) ([pvullioud](https://github.com/pvullioud)) +- Change symbol 'minus' with code 226 to 'minus' with code 45 [\#1333](https://github.com/fzaninotto/Faker/pull/1333) ([Negasus](https://github.com/Negasus)) +- \[sl\_SI\] Created provider for Company [\#1331](https://github.com/fzaninotto/Faker/pull/1331) ([alesvaupotic](https://github.com/alesvaupotic)) +- Update city name [\#1328](https://github.com/fzaninotto/Faker/pull/1328) ([s9801077](https://github.com/s9801077)) +- Fix \#1305 realText in some cases breaks last character [\#1326](https://github.com/fzaninotto/Faker/pull/1326) ([iamraccoon](https://github.com/iamraccoon)) +- Real Dutch postal codes [\#1323](https://github.com/fzaninotto/Faker/pull/1323) ([ametad](https://github.com/ametad)) +- Added male and female titles for the en\_ZA locale [\#1321](https://github.com/fzaninotto/Faker/pull/1321) ([ViGouRCanberra](https://github.com/ViGouRCanberra)) +- Add German Email Providers [\#1320](https://github.com/fzaninotto/Faker/pull/1320) ([Stoffo](https://github.com/Stoffo)) +- Fix "Resource temporarily unavailable" [\#1319](https://github.com/fzaninotto/Faker/pull/1319) ([eberkund](https://github.com/eberkund)) +- Introduced the ability to specify a default timezone... [\#1316](https://github.com/fzaninotto/Faker/pull/1316) ([telkins](https://github.com/telkins)) +- South African licence codes [\#1315](https://github.com/fzaninotto/Faker/pull/1315) ([royalmitten](https://github.com/royalmitten)) +- Fix with incorrect name city. [\#1309](https://github.com/fzaninotto/Faker/pull/1309) ([zzenmate](https://github.com/zzenmate)) +- Fixed type-o in readme under section about Language specific formatters [\#1302](https://github.com/fzaninotto/Faker/pull/1302) ([espenkn](https://github.com/espenkn)) +- Update Person.php [\#1298](https://github.com/fzaninotto/Faker/pull/1298) ([yappkahowe](https://github.com/yappkahowe)) +- Allow children classes to access self::$suffix [\#1296](https://github.com/fzaninotto/Faker/pull/1296) ([greg0ire](https://github.com/greg0ire)) +- Fix with namespace payment provider for uk\_UA [\#1293](https://github.com/fzaninotto/Faker/pull/1293) ([zzenmate](https://github.com/zzenmate)) +- Update zh\_TW text provider [\#1292](https://github.com/fzaninotto/Faker/pull/1292) ([s9801077](https://github.com/s9801077)) +- Fix CURL status code in ImageTest.php [\#1290](https://github.com/fzaninotto/Faker/pull/1290) ([Sanfra1407](https://github.com/Sanfra1407)) +- Tax Id for companies and new formats for es\_VE [\#1287](https://github.com/fzaninotto/Faker/pull/1287) ([DIOHz0r](https://github.com/DIOHz0r)) +- Added idNumber for nl\_NL [\#1283](https://github.com/fzaninotto/Faker/pull/1283) ([artorozenga](https://github.com/artorozenga)) +- Feature/en us company ein [\#1273](https://github.com/fzaninotto/Faker/pull/1273) ([zachflower](https://github.com/zachflower)) + +2017-08-15, v1.7.0 +------------------ + +- Added more Ukrainian banks [\#1271](https://github.com/fzaninotto/Faker/pull/1271) ([iamraccoon](https://github.com/iamraccoon)) +- Hotfix/failing unit tests [\#1269](https://github.com/fzaninotto/Faker/pull/1269) ([zachflower](https://github.com/zachflower)) +- Lock Travis-CI environment to Ubuntu Precise [\#1268](https://github.com/fzaninotto/Faker/pull/1268) ([zachflower](https://github.com/zachflower)) +- Added Ukrainian job title [\#1267](https://github.com/fzaninotto/Faker/pull/1267) ([iamraccoon](https://github.com/iamraccoon)) +- Add compliant en\_US SSN generator [\#1266](https://github.com/fzaninotto/Faker/pull/1266) ([zachflower](https://github.com/zachflower)) +- Added more Ukrainian streets and removed irrelevant names. Added more Ukrainian mobile formats [\#1265](https://github.com/fzaninotto/Faker/pull/1265) ([iamraccoon](https://github.com/iamraccoon)) +- Add Internet Format for ja\_JP. [\#1260](https://github.com/fzaninotto/Faker/pull/1260) ([itigoppo](https://github.com/itigoppo)) +- rectify ISO 4217 codes [\#1258](https://github.com/fzaninotto/Faker/pull/1258) ([eidng8](https://github.com/eidng8)) +- Corrected of grammar of Ukrainian middlenames and test added [\#1257](https://github.com/fzaninotto/Faker/pull/1257) ([vladbuk](https://github.com/vladbuk)) +- Update ISO 4217 active codes [\#1251](https://github.com/fzaninotto/Faker/pull/1251) ([eidng8](https://github.com/eidng8)) +- Update Composer File [\#1248](https://github.com/fzaninotto/Faker/pull/1248) ([vinkla](https://github.com/vinkla)) +- Set capitals to false [\#1243](https://github.com/fzaninotto/Faker/pull/1243) ([Stichoza](https://github.com/Stichoza)) +- Use static instead of self [\#1242](https://github.com/fzaninotto/Faker/pull/1242) ([Stichoza](https://github.com/Stichoza)) +- Add VAT french format [\#1241](https://github.com/fzaninotto/Faker/pull/1241) ([baptistedonaux](https://github.com/baptistedonaux)) +- Add swedish job titles [\#1234](https://github.com/fzaninotto/Faker/pull/1234) ([vinkla](https://github.com/vinkla)) +- Name Simo shouldn't have comma in it [\#1230](https://github.com/fzaninotto/Faker/pull/1230) ([simoheinonen](https://github.com/simoheinonen)) +- Fix: Add method annotation for ValidGenerator [\#1223](https://github.com/fzaninotto/Faker/pull/1223) ([localheinz](https://github.com/localheinz)) +- Add real text for es\_ES [\#1220](https://github.com/fzaninotto/Faker/pull/1220) ([driade](https://github.com/driade)) +- Fix spelling errors [\#1218](https://github.com/fzaninotto/Faker/pull/1218) ([driade](https://github.com/driade)) +- Fix spelling errors [\#1217](https://github.com/fzaninotto/Faker/pull/1217) ([driade](https://github.com/driade)) +- Fixes typo [\#1212](https://github.com/fzaninotto/Faker/pull/1212) ([skullboner](https://github.com/skullboner)) +- Add Person::middleName for ru\_RU provider [\#1209](https://github.com/fzaninotto/Faker/pull/1209) ([JustBlackBird](https://github.com/JustBlackBird)) +- Fix creditCardDetails type hint [\#1208](https://github.com/fzaninotto/Faker/pull/1208) ([jejung](https://github.com/jejung)) +- Expand dictionaries for ru\_RU locale [\#1206](https://github.com/fzaninotto/Faker/pull/1206) ([pwsdotru](https://github.com/pwsdotru)) +- Fix ng\_NG to en\_NG [\#1205](https://github.com/fzaninotto/Faker/pull/1205) ([raphaeldealmeida](https://github.com/raphaeldealmeida)) +- Add INN and KPP support for ru\_RU locale [\#1204](https://github.com/fzaninotto/Faker/pull/1204) ([pwsdotru](https://github.com/pwsdotru)) +- Remove break line on pt\_PT Address format [\#1203](https://github.com/fzaninotto/Faker/pull/1203) ([raphaeldealmeida](https://github.com/raphaeldealmeida)) +- Fix syntax of phpdoc boolean property [\#1198](https://github.com/fzaninotto/Faker/pull/1198) ([pavelkovar](https://github.com/pavelkovar)) +- add en\_HK provider [\#1196](https://github.com/fzaninotto/Faker/pull/1196) ([miklcct](https://github.com/miklcct)) +- use secure https [\#1186](https://github.com/fzaninotto/Faker/pull/1186) ([jpuck](https://github.com/jpuck)) +- Add PhoneNumberFormat for ja\_JP. [\#1185](https://github.com/fzaninotto/Faker/pull/1185) ([itigoppo](https://github.com/itigoppo)) +- Fix: Add class-level method annotations for DateTime provider [\#1183](https://github.com/fzaninotto/Faker/pull/1183) ([localheinz](https://github.com/localheinz)) +- Add ar\_SA Color Provider [\#1182](https://github.com/fzaninotto/Faker/pull/1182) ([alhoqbani](https://github.com/alhoqbani)) +- Added uk\_UA Payment provider with bank name generator [\#1181](https://github.com/fzaninotto/Faker/pull/1181) ([spaghettimaster](https://github.com/spaghettimaster)) +- Typos [\#1177](https://github.com/fzaninotto/Faker/pull/1177) ([ankitpokhrel](https://github.com/ankitpokhrel)) +- Fix XML document example [\#1176](https://github.com/fzaninotto/Faker/pull/1176) ([ankitpokhrel](https://github.com/ankitpokhrel)) +- Added Emoji to Miscellaneous [\#1175](https://github.com/fzaninotto/Faker/pull/1175) ([thomasfdm](https://github.com/thomasfdm)) +- Typos and doc block fixes [\#1170](https://github.com/fzaninotto/Faker/pull/1170) ([ankitpokhrel](https://github.com/ankitpokhrel)) +- Rewrote deprecated `each\(\)` usage [\#1168](https://github.com/fzaninotto/Faker/pull/1168) ([hboomsma](https://github.com/hboomsma)) +- Refactor text method to remove duplication [\#1163](https://github.com/fzaninotto/Faker/pull/1163) ([ankitpokhrel](https://github.com/ankitpokhrel)) +- Generate valid individual identification numbers kk\_KZ [\#1161](https://github.com/fzaninotto/Faker/pull/1161) ([YerlenZhubangaliyev](https://github.com/YerlenZhubangaliyev)) +- Added Address and Company \[fa\_IR\] [\#1160](https://github.com/fzaninotto/Faker/pull/1160) ([thisissorna](https://github.com/thisissorna)) +- Add Peruvian DNI generator [\#1158](https://github.com/fzaninotto/Faker/pull/1158) ([jgwong](https://github.com/jgwong)) +- Removed double semicolon [\#1154](https://github.com/fzaninotto/Faker/pull/1154) ([pjona](https://github.com/pjona)) +- Add prefixes for nl\_NL [\#1151](https://github.com/fzaninotto/Faker/pull/1151) ([hyperized](https://github.com/hyperized)) +- Separated male and female names for sr\_RS locale. [\#1144](https://github.com/fzaninotto/Faker/pull/1144) ([bogdanpet](https://github.com/bogdanpet)) +- Add personal ID, VAT for zh\_TW [\#1135](https://github.com/fzaninotto/Faker/pull/1135) ([Dagolin](https://github.com/Dagolin)) +- Updating ninth digit on whole country [\#1132](https://github.com/fzaninotto/Faker/pull/1132) ([gpressutto5](https://github.com/gpressutto5)) +- Indian states added to en\_IN locale [\#1131](https://github.com/fzaninotto/Faker/pull/1131) ([jiveshsg](https://github.com/jiveshsg)) +- Add Text provider for ro\_MD [\#1129](https://github.com/fzaninotto/Faker/pull/1129) ([wecerny](https://github.com/wecerny)) +- Add strict to randomNumber example [\#1124](https://github.com/fzaninotto/Faker/pull/1124) ([leepownall](https://github.com/leepownall)) +- Say Eloquent is supported [\#1123](https://github.com/fzaninotto/Faker/pull/1123) ([guidocella](https://github.com/guidocella)) +- Link Eloquent Populator [\#1120](https://github.com/fzaninotto/Faker/pull/1120) ([guidocella](https://github.com/guidocella)) +- Removed dead code from Luhn.php [\#1118](https://github.com/fzaninotto/Faker/pull/1118) ([Newman101](https://github.com/Newman101)) +- Improve Internet::transliterate performance [\#1112](https://github.com/fzaninotto/Faker/pull/1112) ([dunglas](https://github.com/dunglas)) +- fix typo [\#1109](https://github.com/fzaninotto/Faker/pull/1109) ([johannesnagl](https://github.com/johannesnagl)) +- \[cs\_CZ\] Fixed Czech phone numbers [\#1108](https://github.com/fzaninotto/Faker/pull/1108) ([tomasbedrich](https://github.com/tomasbedrich)) +- Update MasterCard BIN Range [\#1103](https://github.com/fzaninotto/Faker/pull/1103) ([andysnell](https://github.com/andysnell)) +- Add biggest german cities [\#1102](https://github.com/fzaninotto/Faker/pull/1102) ([Konafets](https://github.com/Konafets)) +- Change postal code format for ko\_KR [\#1094](https://github.com/fzaninotto/Faker/pull/1094) ([coozplz](https://github.com/coozplz)) +- Introduced the ability to specify the timezone for dateTimeThis\*\(\) methods [\#1090](https://github.com/fzaninotto/Faker/pull/1090) ([telkins](https://github.com/telkins)) +- Fixed Issue \#1086 [\#1088](https://github.com/fzaninotto/Faker/pull/1088) ([Newman101](https://github.com/Newman101)) +- \[ja\_JP\]kana of Japanese name by gender. [\#1087](https://github.com/fzaninotto/Faker/pull/1087) ([itigoppo](https://github.com/itigoppo)) +- Fix unused code [\#1083](https://github.com/fzaninotto/Faker/pull/1083) ([borgogelli](https://github.com/borgogelli)) +- Amended permissions for en\_GB AddressTest.php [\#1071](https://github.com/fzaninotto/Faker/pull/1071) ([Newman101](https://github.com/Newman101)) +- Ensure unique IDs in randomHtml [\#1068](https://github.com/fzaninotto/Faker/pull/1068) ([vlakoff](https://github.com/vlakoff)) +- Updated \[de\_DE\] city names [\#1067](https://github.com/fzaninotto/Faker/pull/1067) ([plxx](https://github.com/plxx)) +- Update method signature in Generator phpdoc [\#1066](https://github.com/fzaninotto/Faker/pull/1066) ([vlakoff](https://github.com/vlakoff)) +- Add Thai providers [\#1065](https://github.com/fzaninotto/Faker/pull/1065) ([tuwannu](https://github.com/tuwannu)) +- \(Minor\) Fixed the default locale stated in the readme [\#1064](https://github.com/fzaninotto/Faker/pull/1064) ([taylankasap](https://github.com/taylankasap)) +- \[nl\_NL\] Make person provider behave more realistically [\#1061](https://github.com/fzaninotto/Faker/pull/1061) ([curry684](https://github.com/curry684)) +- Add allowDuplicates option to randomElements\(\) [\#1060](https://github.com/fzaninotto/Faker/pull/1060) ([vlakoff](https://github.com/vlakoff)) +- Docblocks: Add some missing @method tags [\#1059](https://github.com/fzaninotto/Faker/pull/1059) ([Kurre](https://github.com/Kurre)) +- \[fi\_FI\] Improve phone number generator [\#1054](https://github.com/fzaninotto/Faker/pull/1054) ([Kurre](https://github.com/Kurre)) +- Add personalIdentityNumber\(\) to fi\_FI/Person.php [\#1053](https://github.com/fzaninotto/Faker/pull/1053) ([oittaa](https://github.com/oittaa)) +- Issue \#1041 [\#1052](https://github.com/fzaninotto/Faker/pull/1052) ([daleattree](https://github.com/daleattree)) +- Update Text.php [\#1051](https://github.com/fzaninotto/Faker/pull/1051) ([gulaandrij](https://github.com/gulaandrij)) +- Fix French phone numbers with 07 prefix [\#1046](https://github.com/fzaninotto/Faker/pull/1046) ([fzaninotto](https://github.com/fzaninotto)) +- \[Generator.php\] mt\_rand\(\) changed in PHP 7.1 [\#1045](https://github.com/fzaninotto/Faker/pull/1045) ([oittaa](https://github.com/oittaa)) +- Add 'FI' to Payment Provider [\#1044](https://github.com/fzaninotto/Faker/pull/1044) ([oittaa](https://github.com/oittaa)) +- Added id number generator to Person Provider for the en\_ZA locale [\#1039](https://github.com/fzaninotto/Faker/pull/1039) ([smithandre](https://github.com/smithandre)) +- \[Feature\] Add nigerian provider [\#1030](https://github.com/fzaninotto/Faker/pull/1030) ([elchroy](https://github.com/elchroy)) +- \[pl\_PL\] Handle state. [\#1029](https://github.com/fzaninotto/Faker/pull/1029) ([piotrooo](https://github.com/piotrooo)) +- Fixed polish text - change '--' into '-'. [\#1027](https://github.com/fzaninotto/Faker/pull/1027) ([piotrooo](https://github.com/piotrooo)) +- Update Text.php [\#1025](https://github.com/fzaninotto/Faker/pull/1025) ([gulaandrij](https://github.com/gulaandrij)) +- Adding Nationalized Citizens to DNI in Person.php [\#1021](https://github.com/fzaninotto/Faker/pull/1021) ([celisflen-bers](https://github.com/celisflen-bers)) +- Add nik to indonesia [\#1019](https://github.com/fzaninotto/Faker/pull/1019) ([Nuffic](https://github.com/Nuffic)) +- fix mb\_substr missing parameter error when generating japanese string with realText method [\#1018](https://github.com/fzaninotto/Faker/pull/1018) ([horan-geeker](https://github.com/horan-geeker)) +- IBAN Formatters for New Locales [\#1015](https://github.com/fzaninotto/Faker/pull/1015) ([okj579](https://github.com/okj579)) +- German Bank Names [\#1014](https://github.com/fzaninotto/Faker/pull/1014) ([okj579](https://github.com/okj579)) +- Adding countries for pl\_PL provider [\#1009](https://github.com/fzaninotto/Faker/pull/1009) ([mertcanesen](https://github.com/mertcanesen)) +- Adding Pattern Lab plugin to list of 3rd party libraries [\#1008](https://github.com/fzaninotto/Faker/pull/1008) ([EvanLovely](https://github.com/EvanLovely)) +- Korea top 100 lastName [\#1006](https://github.com/fzaninotto/Faker/pull/1006) ([tael](https://github.com/tael)) +- Use real Belgian postcodes instead of random number [\#1004](https://github.com/fzaninotto/Faker/pull/1004) ([toonevdb](https://github.com/toonevdb)) +- Add bankAccountNumber implementations [\#1000](https://github.com/fzaninotto/Faker/pull/1000) ([akramfares](https://github.com/akramfares)) +- Generates a random NIR number \(fr\_FR\) [\#997](https://github.com/fzaninotto/Faker/pull/997) ([Ultim4T0m](https://github.com/Ultim4T0m)) +- \#989 Fix country typo [\#996](https://github.com/fzaninotto/Faker/pull/996) ([adriantombu](https://github.com/adriantombu)) +- adding back CNP [\#988](https://github.com/fzaninotto/Faker/pull/988) ([the-noob](https://github.com/the-noob)) +- Fix phpunit tests fail on 64-bit systems \#982 [\#983](https://github.com/fzaninotto/Faker/pull/983) ([Powerhead13](https://github.com/Powerhead13)) +- Remove trailing dot in username if any [\#975](https://github.com/fzaninotto/Faker/pull/975) ([vlakoff](https://github.com/vlakoff)) +- HTML Lorem [\#971](https://github.com/fzaninotto/Faker/pull/971) ([rudkjobing](https://github.com/rudkjobing)) +- Fix a mixup between male and female last names in Icelandic. [\#970](https://github.com/fzaninotto/Faker/pull/970) ([arthur-olafsson](https://github.com/arthur-olafsson)) +- Remove duplicate [\#969](https://github.com/fzaninotto/Faker/pull/969) ([mijgame](https://github.com/mijgame)) +- fix \[zh\_CN\]PhoneNumber illegal operator prefix [\#966](https://github.com/fzaninotto/Faker/pull/966) ([zhwei](https://github.com/zhwei)) +- es\_ES: Generate VAT Number [\#964](https://github.com/fzaninotto/Faker/pull/964) ([miguelgf](https://github.com/miguelgf)) +- Update Image.php [\#963](https://github.com/fzaninotto/Faker/pull/963) ([gulaandrij](https://github.com/gulaandrij)) +- Remove cnp formatter from RO\_ro locale \(fails tests\) [\#962](https://github.com/fzaninotto/Faker/pull/962) ([fzaninotto](https://github.com/fzaninotto)) +- Adding valid en\_GB postcodes [\#961](https://github.com/fzaninotto/Faker/pull/961) ([the-noob](https://github.com/the-noob)) +- Adding Text for ro\_RO [\#959](https://github.com/fzaninotto/Faker/pull/959) ([the-noob](https://github.com/the-noob)) +- Minor: Fixed trailing space in DateTime provider [\#956](https://github.com/fzaninotto/Faker/pull/956) ([tifabien](https://github.com/tifabien)) +- Remove 'Stripper' from en\_US job titles [\#954](https://github.com/fzaninotto/Faker/pull/954) ([amcsi](https://github.com/amcsi)) +- fix 32bits issue [\#953](https://github.com/fzaninotto/Faker/pull/953) ([remicollet](https://github.com/remicollet)) +- Fix EAN8 checkSum generator [\#951](https://github.com/fzaninotto/Faker/pull/951) ([MatthieuMota](https://github.com/MatthieuMota)) +- Fixed description and the use of early undocumented parameters. [\#949](https://github.com/fzaninotto/Faker/pull/949) ([andrey-helldar](https://github.com/andrey-helldar)) +- Pushing new mobile prefixes in philippines [\#944](https://github.com/fzaninotto/Faker/pull/944) ([napoleon101392](https://github.com/napoleon101392)) +- Update Company.php [\#943](https://github.com/fzaninotto/Faker/pull/943) ([thiagotalma](https://github.com/thiagotalma)) +- Fix to Issue \#935 - German Locale [\#936](https://github.com/fzaninotto/Faker/pull/936) ([Newman101](https://github.com/Newman101)) +- el\_CY Locale [\#930](https://github.com/fzaninotto/Faker/pull/930) ([softius](https://github.com/softius)) +- Add phpdoc method dateTimeInInterval in Generator.php [\#926](https://github.com/fzaninotto/Faker/pull/926) ([KeithYeh](https://github.com/KeithYeh)) +- Harmonize fr\_\*\Company [\#918](https://github.com/fzaninotto/Faker/pull/918) ([Max13](https://github.com/Max13)) +- Fix: fix invalid parameter of mb\_substr\(\) [\#917](https://github.com/fzaninotto/Faker/pull/917) ([tkawaji](https://github.com/tkawaji)) +- kk\_KZ Company/person identification numbers unit tests [\#916](https://github.com/fzaninotto/Faker/pull/916) ([YerlenZhubangaliyev](https://github.com/YerlenZhubangaliyev)) +- ka\_GE: overall improvements to ka\_GE locale [\#913](https://github.com/fzaninotto/Faker/pull/913) ([hertzg](https://github.com/hertzg)) +- Fix: Do not pick a random float less than minimum [\#909](https://github.com/fzaninotto/Faker/pull/909) ([localheinz](https://github.com/localheinz)) +- Fix: Prefer dependencies installed from dist [\#908](https://github.com/fzaninotto/Faker/pull/908) ([localheinz](https://github.com/localheinz)) +- Add a building number with letter to German speaking locales. [\#903](https://github.com/fzaninotto/Faker/pull/903) ([markuspoerschke](https://github.com/markuspoerschke)) +- \[RFR\] Remove parts of the hu\_HU address formatters [\#902](https://github.com/fzaninotto/Faker/pull/902) ([fzaninotto](https://github.com/fzaninotto)) +- use Luhn to calculate ar\_SA id numbers. [\#875](https://github.com/fzaninotto/Faker/pull/875) ([FooBarQuaxx](https://github.com/FooBarQuaxx)) +- Fix Doctrine ODM Support [\#489](https://github.com/fzaninotto/Faker/pull/489) ([cbourgois](https://github.com/cbourgois)) + + +2016-04-29, v1.6.0 +------------------ + +- Remove parts of the Hungarian (hu\_HU) address formatters [\#902](https://github.com/fzaninotto/Faker/pull/902) ([fzaninotto](https://github.com/fzaninotto)) +- Renamed norwegian (nb\_NO) locale [\#901](https://github.com/fzaninotto/Faker/pull/901) ([fzaninotto](https://github.com/fzaninotto)) +- Improveed German (de\_DE) titles [\#897](https://github.com/fzaninotto/Faker/pull/897) ([christianbartels](https://github.com/christianbartels)) +- Added VAT formatter to nl\_BE and fr\_BE providers [\#896](https://github.com/fzaninotto/Faker/pull/896) ([anvanza](https://github.com/anvanza)) +- Fixed provider namespace for Lithuanian (lt\_LT) [\#894](https://github.com/fzaninotto/Faker/pull/894) ([sanis](https://github.com/sanis)) +- Removed unnecessary (and incompatible) license from Russian and Ukrainian (uk\_UA & ru\_RU) Text providers [\#892](https://github.com/fzaninotto/Faker/pull/892) ([Newman101](https://github.com/Newman101)) +- Improved `languageCode` formatted to include all ISO-639-1 standard codes [\#889](https://github.com/fzaninotto/Faker/pull/889) ([andrewnicols](https://github.com/andrewnicols)) +- Improved Hungarian provider [\#883](https://github.com/fzaninotto/Faker/pull/883) ([balping](https://github.com/balping)) +- Fixed typo in Austrian Person provider [\#880](https://github.com/fzaninotto/Faker/pull/880) ([xelan](https://github.com/xelan)) +- Added Chines (zh\_CN) `catchPhrase` formatter [\#878](https://github.com/fzaninotto/Faker/pull/878) ([z-song](https://github.com/z-song)) +- Added mention of Brazilian (pt\_BR) providers in readme [\#877](https://github.com/fzaninotto/Faker/pull/877) ([iget-master](https://github.com/iget-master)) +- Updated composer `require` section to allow PHP 7 in safer way [\#874](https://github.com/fzaninotto/Faker/pull/874) ([TomasVotruba](https://github.com/TomasVotruba)) +- Added Greek (el\_GR) `mobilePhoneNumber` and `tollFreeNumber` formatters [\#869](https://github.com/fzaninotto/Faker/pull/869) ([sebdesign](https://github.com/sebdesign)) +- Added Lorempixel check for `ImageTest.php` to avoid test fails when the service is offline [\#866](https://github.com/fzaninotto/Faker/pull/866) ([Newman101](https://github.com/Newman101)) +- Added Chinese (zh\_CN) Providers [\#864](https://github.com/fzaninotto/Faker/pull/864) ([z-song](https://github.com/z-song)) +- Added unit tests for Canadian (en\_CA) provider [\#862](https://github.com/fzaninotto/Faker/pull/862) ([Newman101](https://github.com/Newman101)) +- Added Dutch BTW \(vat\) Number [\#861](https://github.com/fzaninotto/Faker/pull/861) ([LauLaman](https://github.com/LauLaman)) +- Improved Australian (en\_AU) provider [\#858](https://github.com/fzaninotto/Faker/pull/858) ([Newman101](https://github.com/Newman101)) +- Added Propel2 ORM support [\#852](https://github.com/fzaninotto/Faker/pull/852) ([iTechDhaval](https://github.com/iTechDhaval)) +- Added en\_IN unit test for `Address.php` [\#849](https://github.com/fzaninotto/Faker/pull/849) ([Newman101](https://github.com/Newman101)) +- Updated docs to clarify that `randomElements` does not repeat input elements [\#848](https://github.com/fzaninotto/Faker/pull/848) ([sustmi](https://github.com/sustmi)) +- Optimized Taiwanese (zh\_TW) `realText` provider [\#844](https://github.com/fzaninotto/Faker/pull/844) ([Newman101](https://github.com/Newman101)) +- Added more Iranian (fa\_IR) TLDs [\#843](https://github.com/fzaninotto/Faker/pull/843) ([VagrantStory](https://github.com/VagrantStory)) +- Added Hebrew (he\_IL) `country` formatter [\#841](https://github.com/fzaninotto/Faker/pull/841) ([yonirom](https://github.com/yonirom)) +- Documented `boolean` formatter [\#840](https://github.com/fzaninotto/Faker/pull/840) ([danieliancu](https://github.com/danieliancu)) +- Fixed modifiers anchor readme [\#838](https://github.com/fzaninotto/Faker/pull/838) ([danieliancu](https://github.com/danieliancu)) +- Added Dutch (nl\_NL) real text provider [\#837](https://github.com/fzaninotto/Faker/pull/837) ([endroid](https://github.com/endroid)) +- Added `valid` modifier [\#836](https://github.com/fzaninotto/Faker/pull/836) ([fzaninotto](https://github.com/fzaninotto)) +- Added Iranian (fa\_IR) `PhoneNumber` provider [\#833](https://github.com/fzaninotto/Faker/pull/833) ([ghost](https://github.com/ghost)) +- Add Brazilian (pt\_BR) `region` and `regionAbbr` formatters [\#828](https://github.com/fzaninotto/Faker/pull/828) ([francinaldo](https://github.com/francinaldo)) +- Improved Austrian (de\_AT) names, states, and realtext [\#826](https://github.com/fzaninotto/Faker/pull/826) ([Findus23](https://github.com/Findus23)) +- Improved German (de\_DE) names [\#825](https://github.com/fzaninotto/Faker/pull/825) ([Findus23](https://github.com/Findus23)) +- Improved Latvian (lv\_LV) first names [\#823](https://github.com/fzaninotto/Faker/pull/823) ([veisis](https://github.com/veisis)) +- Improved Latvian (lv\_LV) `phoneNumber` formatter [\#822](https://github.com/fzaninotto/Faker/pull/822) ([veisis](https://github.com/veisis)) +- Updated phpDoc link to IBAN format reference in `Payment` provider [\#821](https://github.com/fzaninotto/Faker/pull/821) ([god107](https://github.com/god107)) +- Updated Sport ORM populator to populate values for numeric fields [\#820](https://github.com/fzaninotto/Faker/pull/820) ([urisavka](https://github.com/urisavka)) +- Updated Chinese (zh\_CN) operators' phone number prefix. [\#819](https://github.com/fzaninotto/Faker/pull/819) ([vistart](https://github.com/vistart)) +- Optimized Spot ORM `EntityPopulator` [\#817](https://github.com/fzaninotto/Faker/pull/817) ([Newman101](https://github.com/Newman101)) +- Added Korean (ko\_KR) `realText` formatter [\#815](https://github.com/fzaninotto/Faker/pull/815) ([jdssem](https://github.com/jdssem)) +- Updated `imageUrl` formatter phpDoc [\#814](https://github.com/fzaninotto/Faker/pull/814) ([jonwurtzler](https://github.com/jonwurtzler)) +- Optimized Taiwanese (zh\_TW) text provider [\#809](https://github.com/fzaninotto/Faker/pull/809) ([BePsvPT](https://github.com/BePsvPT)) +- Added strict comparison to Czech (cs\_CS) `birthNumber` formatter [\#807](https://github.com/fzaninotto/Faker/pull/807) ([Newman101](https://github.com/Newman101)) +- Added Greek (el\_GR) `realText` formatter [\#805](https://github.com/fzaninotto/Faker/pull/805) ([hootlex](https://github.com/hootlex)) +- Added Simplified Chinese \(zh\_CN\) `state` and `stateAbbr` formatters [\#804](https://github.com/fzaninotto/Faker/pull/804) ([zhanghuanchong](https://github.com/zhanghuanchong)) +- Update `Image` provider to allow generation of grayscale images [\#801](https://github.com/fzaninotto/Faker/pull/801) ([neutralrockets](https://github.com/neutralrockets)) +- Fixed Taiwanese (zh_TW) incorrect `mb_substr()` arguments [\#799](https://github.com/fzaninotto/Faker/pull/799) ([BePsvPT](https://github.com/BePsvPT)) +- Added Spot ORM populator [\#796](https://github.com/fzaninotto/Faker/pull/796) ([urisavka](https://github.com/urisavka)) +- Added Italian (it\_IT) `vatId` and `taxId` formatters [\#790](https://github.com/fzaninotto/Faker/pull/790) ([brainrepo](https://github.com/brainrepo)) +- Added some fixes to Armenian (hy\_AM) locale [\#788](https://github.com/fzaninotto/Faker/pull/788) ([mhamlet](https://github.com/mhamlet)) +- Removed duplicate entries in `toAscii()` transliteration table, used in `Internet` provider [\#787](https://github.com/fzaninotto/Faker/pull/787) ([vlakoff](https://github.com/vlakoff)) +- Added Indian (en\_IN) providers [\#785](https://github.com/fzaninotto/Faker/pull/785) ([kartiksomani](https://github.com/kartiksomani)) +- Removed duplicate country names in various locales, removed non-random country arrays [\#784](https://github.com/fzaninotto/Faker/pull/784) ([fzaninotto](https://github.com/fzaninotto)) +- Improved Swiss (de\_CH) phone numbers [\#782](https://github.com/fzaninotto/Faker/pull/782) ([z38](https://github.com/z38)) +- Added Swiss (de\_CH) names [\#781](https://github.com/fzaninotto/Faker/pull/781) ([z38](https://github.com/z38)) +- Make capitalization of first word optional in Text Provider [\#778](https://github.com/fzaninotto/Faker/pull/778) ([LagunaJavier](https://github.com/LagunaJavier)) +- Added Georgian (ka\_GE) providers [\#777](https://github.com/fzaninotto/Faker/pull/777) ([akalongman](https://github.com/akalongman)) +- Fix CakePHP populator [\#776](https://github.com/fzaninotto/Faker/pull/776) ([daniel-mueller](https://github.com/daniel-mueller)) +- Added unit tests for `Address` provider in many locales [\#775](https://github.com/fzaninotto/Faker/pull/775) [\#773](https://github.com/fzaninotto/Faker/pull/773) [\#772](https://github.com/fzaninotto/Faker/pull/772) [\#767](https://github.com/fzaninotto/Faker/pull/767) [\#765](https://github.com/fzaninotto/Faker/pull/765) [\#764](https://github.com/fzaninotto/Faker/pull/764) [\#758](https://github.com/fzaninotto/Faker/pull/758) [\#756](https://github.com/fzaninotto/Faker/pull/756) [\#747](https://github.com/fzaninotto/Faker/pull/747) [\#741](https://github.com/fzaninotto/Faker/pull/741) ([Newman101](https://github.com/Newman101)) +- Added `dbi` formatter to Spanish (es\_ES) Person provider [\#763](https://github.com/fzaninotto/Faker/pull/763) ([mikk150](https://github.com/mikk150)) +- Added South Africa (en\_ZA) locale [\#761](https://github.com/fzaninotto/Faker/pull/761) ([smithandre](https://github.com/smithandre)) [\#760](https://github.com/fzaninotto/Faker/pull/760) ([smithandre](https://github.com/smithandre)) [\#759](https://github.com/fzaninotto/Faker/pull/759) ([smithandre](https://github.com/smithandre)) +- Added E.164 phone number generator [\#753](https://github.com/fzaninotto/Faker/pull/753) ([daleattree](https://github.com/daleattree)) +- Fixed serialization issue in `unique` modifier [\#749](https://github.com/fzaninotto/Faker/pull/749) ([EmanueleMinotto](https://github.com/EmanueleMinotto)) +- Added Switzerland (de\_CH, fr\_CH, it\_CH) providers [\#739](https://github.com/fzaninotto/Faker/pull/739) ([r3h6](https://github.com/r3h6)) +- Added PHPDocs, removed unused variable [\#738](https://github.com/fzaninotto/Faker/pull/738) ([daniel-mueller](https://github.com/daniel-mueller)) +- Fixed building numbers to have non-zero first bumber [\#737](https://github.com/fzaninotto/Faker/pull/737) ([jmauerhan](https://github.com/jmauerhan)) +- Updated ninth digit for Brazilian cell phone numbers [\#734](https://github.com/fzaninotto/Faker/pull/734) ([igorsantos07](https://github.com/igorsantos07)) +- Simplified Factory code [\#732](https://github.com/fzaninotto/Faker/pull/732) ([vlakoff](https://github.com/vlakoff)) +- Added mention of [images-generator](https://github.com/bruceheller/images-generator) in readme [\#731](https://github.com/fzaninotto/Faker/pull/731) ([bruceheller](https://github.com/bruceheller)) +- Optimize Internet::toAscii\(\) by using a static cache and translitteration [\#730](https://github.com/fzaninotto/Faker/pull/730) [\#729](https://github.com/fzaninotto/Faker/pull/729) +[\#725](https://github.com/fzaninotto/Faker/pull/725) [\#724](https://github.com/fzaninotto/Faker/pull/724) ([vlakoff](https://github.com/vlakoff)) +- Added more English (en\_GB) Phone Number formats [\#721](https://github.com/fzaninotto/Faker/pull/721) ([nickwebcouk](https://github.com/nickwebcouk)) +- Cleaned up `use` statements across the code [\#719](https://github.com/fzaninotto/Faker/pull/719) ([pomaxa](https://github.com/pomaxa)) +- Fixed CackePHP populator [\#718](https://github.com/fzaninotto/Faker/pull/718) ([sdustinh](https://github.com/sdustinh)) +- Cleaned up various phpmd notices [\#715](https://github.com/fzaninotto/Faker/pull/715) ([pomaxa](https://github.com/pomaxa)) +- Added `Color` provider to Latvian (lv_LV) locale [\#714](https://github.com/fzaninotto/Faker/pull/714) ([pomaxa](https://github.com/pomaxa)) +- Fixed bad randomization in Doctrine populator [\#713](https://github.com/fzaninotto/Faker/pull/713) ([pomaxa](https://github.com/pomaxa)) +- Added Mongolian (mn\_MN) providers [\#709](https://github.com/fzaninotto/Faker/pull/709) ([selmonal](https://github.com/selmonal)) +- Improved Australian (en\_AU) `postcode` formatter [\#703](https://github.com/fzaninotto/Faker/pull/703) ([xfxf](https://github.com/xfxf)) +- Added support for asterisks in `bothify` and `optimize` [\#701](https://github.com/fzaninotto/Faker/pull/701) ([nineinchnick](https://github.com/nineinchnick)) +- Fixed important distinction between ORM and database framework in README’s reference to an external Faker provider for POMM that I have never even tested. Anyway, POMM is highly recommended if you are a Postgres fan, or if you want to please Grégoire and help him finish his lifelong project of listening to music on a hi-fi audio equipment he built from his own hands [\#696](https://github.com/fzaninotto/Faker/pull/696) ([chanmix51](https://github.com/chanmix51)) +- Fixed example `text()` output in README [\#694](https://github.com/fzaninotto/Faker/pull/694) ([vlakoff](https://github.com/vlakoff)) +- Added mention of CakePHP 2.x Seeder Plugin to readme [\#691](https://github.com/fzaninotto/Faker/pull/691) ([ravage84](https://github.com/ravage84)) +- Fixed invalid email bug for Korean (ko\_KR) [\#690](https://github.com/fzaninotto/Faker/pull/690) ([pearlc](https://github.com/pearlc)) +- Removed an invalid Dutch (nl\_NL) lastname that breaks email generator [\#689](https://github.com/fzaninotto/Faker/pull/689) ([SpaceK33z](https://github.com/SpaceK33z)) +- Updated `numberBetween()` to be order agnostic [\#683](https://github.com/fzaninotto/Faker/pull/683) ([xfxf](https://github.com/xfxf)) +- Added several English (en\_US) bank-related formatters [\#682](https://github.com/fzaninotto/Faker/pull/682) ([okj579](https://github.com/okj579)) +- Fixed `ipv4` formatter to avoid generating special purpose addresses [\#681](https://github.com/fzaninotto/Faker/pull/681) ([ravage84](https://github.com/ravage84)) +- Moved `intl` extension to `require-dev` in `composer.json` file [\#680](https://github.com/fzaninotto/Faker/pull/680) ([jaschweder](https://github.com/jaschweder)) +- Added more Turkish (tr\_TR) phones number formats [\#678](https://github.com/fzaninotto/Faker/pull/678) ([Quanthir](https://github.com/Quanthir)) +- Fixed primary Key warning in CakePHP ORM populator [\#677](https://github.com/fzaninotto/Faker/pull/677) ([davidyell](https://github.com/davidyell)) +- Added time zone support for provider methods returning DateTime instance [\#675](https://github.com/fzaninotto/Faker/pull/675) ([bishopb](https://github.com/bishopb)) +- Removed trailing spaces from some Argentinian (es\_AR) female first names [\#674](https://github.com/fzaninotto/Faker/pull/674) ([ivanmirson](https://github.com/ivanmirson)) +- Added Lithuanian (lt\_LT) locale [\#673](https://github.com/fzaninotto/Faker/pull/673) ([ekateiva](https://github.com/ekateiva)) +- Added mention of Alice to readme [\#665](https://github.com/fzaninotto/Faker/pull/665) ([Seldaek](https://github.com/Seldaek)) +- Fixed namespace in tests [\#663](https://github.com/fzaninotto/Faker/pull/663) ([localheinz](https://github.com/localheinz)) +- Fixed trailing spaces in `Color` provider [\#662](https://github.com/fzaninotto/Faker/pull/662) ([apsylone](https://github.com/apsylone)) +- Removed duplicate country names in Russian (ru\_RU) `Address` provider [\#659](https://github.com/fzaninotto/Faker/pull/659) ([nurolopher](https://github.com/nurolopher)) +- Added `rgba` formatter to `Color` provider [\#653](https://github.com/fzaninotto/Faker/pull/653) ([apsylone](https://github.com/apsylone)) +- Fixed bad randomization in CakePHP populator [\#648](https://github.com/fzaninotto/Faker/pull/648) ([jadb](https://github.com/jadb)) +- Updated phpunit configuration to better use colors [\#643](https://github.com/fzaninotto/Faker/pull/643) ([localheinz](https://github.com/localheinz)) +- Updated `makefile` to install dev dependencies by default [\#642](https://github.com/fzaninotto/Faker/pull/642) ([localheinz](https://github.com/localheinz)) +- Updated Travis configuration to cache dependencies between builds [\#641](https://github.com/fzaninotto/Faker/pull/641) ([localheinz](https://github.com/localheinz)) +- Added SVG badge to readme for displaying Travis build status [\#640](https://github.com/fzaninotto/Faker/pull/640) ([localheinz](https://github.com/localheinz)) +- Added Croatian (hr\_HR) locale [\#638](https://github.com/fzaninotto/Faker/pull/638) ([toniperic](https://github.com/toniperic)) +- Updated `dateTimeBetween` PHPDoc [\#635](https://github.com/fzaninotto/Faker/pull/635) ([theofidry](https://github.com/theofidry)) +- Add mention of Symfony2 bundles in readme [\#634](https://github.com/fzaninotto/Faker/pull/634) ([theofidry](https://github.com/theofidry)) +- Added Hebrew (he\_IL) locale [\#633](https://github.com/fzaninotto/Faker/pull/633) ([yonirom](https://github.com/yonirom)) +- Updated `seed` to accept non-integer seeds [\#632](https://github.com/fzaninotto/Faker/pull/632) ([theofidry](https://github.com/theofidry)) +- Added DocBlock to `Factory::create()` [\#631](https://github.com/fzaninotto/Faker/pull/631) ([tonynelson19](https://github.com/tonynelson19)) +- Added `jobTitle` generator [\#630](https://github.com/fzaninotto/Faker/pull/630) ([gregoryduckworth](https://github.com/gregoryduckworth)) +- Updated Chinese (zh\_CN) `Person` provider to generate more correct names [\#628](https://github.com/fzaninotto/Faker/pull/628) ([phoenixgao](https://github.com/phoenixgao)) +- Updated Brazilian (pt\_BR) `cellphone` formatter to make it more flexible [\#623](https://github.com/fzaninotto/Faker/pull/623) ([igorsantos07](https://github.com/igorsantos07)) +- Add Arabic for Saudi Arabia (ar\_SA) locale [\#618](https://github.com/fzaninotto/Faker/pull/618) ([ibrasho](https://github.com/ibrasho)) +- Updated en\_US phone numbers [\#615](https://github.com/fzaninotto/Faker/pull/615) ([okj579](https://github.com/okj579)) +- Fixed typos in variable names and exceptions [\#614](https://github.com/fzaninotto/Faker/pull/614) ([pborreli](https://github.com/pborreli)) +- Added a table of contents to the readme file. [\#613](https://github.com/fzaninotto/Faker/pull/613) ([camilopayan](https://github.com/camilopayan)) +- Added Brazilian (es_BR) credit card formatters [\#608](https://github.com/fzaninotto/Faker/pull/608) ([igorsantos07](https://github.com/igorsantos07)) +- Updated `iban` formatter to be cross-locale [\#607](https://github.com/fzaninotto/Faker/pull/607) ([okj579](https://github.com/okj579)) +- Improved ORM name guesser logic [\#606](https://github.com/fzaninotto/Faker/pull/606) ([watermanio](https://github.com/watermanio)) +- Fixed doc typo [\#605](https://github.com/fzaninotto/Faker/pull/605) ([igorsantos07](https://github.com/igorsantos07)) +- Removed executable bits [\#593](https://github.com/fzaninotto/Faker/pull/593) ([siwinski](https://github.com/siwinski)) +- Fixed `iban` generator [\#590](https://github.com/fzaninotto/Faker/pull/590) ([okj579](https://github.com/okj579)) +- Added Philippines (en\_PH) `mobileNumber` formatter [\#589](https://github.com/fzaninotto/Faker/pull/589) ([lozadaOmr](https://github.com/lozadaOmr)) +- Added support for min / max params in `latitude` and `longitude` formatters [\#570](https://github.com/fzaninotto/Faker/pull/570) ([actuallymab](https://github.com/actuallymab)) +- Added Czech (cs_CZ) `birthNumber` formatter [\#535](https://github.com/fzaninotto/Faker/pull/535) ([tomasbedrich](https://github.com/tomasbedrich)) +- Added `dateTimeInInterval` formatter [\#526](https://github.com/fzaninotto/Faker/pull/526) ([nicodmf](https://github.com/nicodmf)) +- Updated `optional` and `boolean` apis to be more consistent [\#513](https://github.com/fzaninotto/Faker/pull/513) ([EmanueleMinotto](https://github.com/EmanueleMinotto)) +- Added Greek (el\_GR) `Address` provider [\#504](https://github.com/fzaninotto/Faker/pull/504) ([drakakisgeo](https://github.com/drakakisgeo)) + +2015-05-29, v1.5.0 +------------------ + +* Added ability to print custom text on the images fetched by the Image provider [\#583](https://github.com/fzaninotto/Faker/pull/583) ([fzaninotto](https://github.com/fzaninotto)) +* Fixed typos in Peruvian (es\_PE) Person provider [\#581](https://github.com/fzaninotto/Faker/pull/581) [\#580](https://github.com/fzaninotto/Faker/pull/580) ([ysramirez](https://github.com/ysramirez)) +* Added instructions for installing with composer to readme.md [\#572](https://github.com/fzaninotto/Faker/pull/572) ([totophe](https://github.com/totophe)) +* Added Kazakh (kk\_KZ) locale [\#569](https://github.com/fzaninotto/Faker/pull/569) ([YerlenZhubangaliyev](https://github.com/YerlenZhubangaliyev)) +* Added Korean (ko\_KR) locale [\#566](https://github.com/fzaninotto/Faker/pull/566) ([pearlc](https://github.com/pearlc)) +* Fixed file provider to ignore unreadable and special files [\#565](https://github.com/fzaninotto/Faker/pull/565) ([svrnm](https://github.com/svrnm)) +* Fixed Dutch (nl\_NL) Address and Person providers [\#560](https://github.com/fzaninotto/Faker/pull/560) ([killerog](https://github.com/killerog)) +* Fixed Dutch (nl\_NL) Person provider [\#559](https://github.com/fzaninotto/Faker/pull/559) ([pauledenburg](https://github.com/pauledenburg)) +* Added Russian (ru\_RU) Bank names provider [\#553](https://github.com/fzaninotto/Faker/pull/553) ([wizardjedi](https://github.com/wizardjedi)) +* Added mobile phone function in French (fr\_FR) provider [\#552](https://github.com/fzaninotto/Faker/pull/552) ([kletellier](https://github.com/kletellier)) +* Added phpdoc for new magic methods in Generator to help IntelliSense completion [\#550](https://github.com/fzaninotto/Faker/pull/550) ([stof](https://github.com/stof)) +* Fixed File provider bug 'The first argument to copy() function cannot be a directory' [\#547](https://github.com/fzaninotto/Faker/pull/547) ([svrnm](https://github.com/svrnm)) +* Added new Brazilian (pt\_BR) Providers [\#545](https://github.com/fzaninotto/Faker/pull/545) ([igorsantos07](https://github.com/igorsantos07)) +* Fixed ability to seed the generator [\#543](https://github.com/fzaninotto/Faker/pull/543) ([schmengler](https://github.com/schmengler)) +* Added streetAddress formatter to Russian (ru\_RU) provider [\#542](https://github.com/fzaninotto/Faker/pull/542) ([ZAYEC77](https://github.com/ZAYEC77)) +* Fixed Internet provider warning "Could not create transliterator"* [\#541](https://github.com/fzaninotto/Faker/pull/541) ([fonsecas72](https://github.com/fonsecas72)) +* Fixed Spanish for Argentina (es\_AR) Address provider [\#540](https://github.com/fzaninotto/Faker/pull/540) ([ivanmirson](https://github.com/ivanmirson)) +* Fixed region names in French for Belgium (fr\_BE) address provider [\#536](https://github.com/fzaninotto/Faker/pull/536) ([miclf](https://github.com/miclf)) +* Fixed broken Doctrine2 link in README [\#534](https://github.com/fzaninotto/Faker/pull/534) ([JonathanKryza](https://github.com/JonathanKryza)) +* Added link to faker-context Behat extension in readme [\#532](https://github.com/fzaninotto/Faker/pull/532) ([denheck](https://github.com/denheck)) +* Added PHP 7.0 nightly to Travis build targets [\#525](https://github.com/fzaninotto/Faker/pull/525) ([TomasVotruba](https://github.com/TomasVotruba)) +* Added Dutch (nl\_NL) color names [\#523](https://github.com/fzaninotto/Faker/pull/523) ([belendel](https://github.com/belendel)) +* Fixed Chinese (zh\_CN) Address provider (remove Taipei) [\#522](https://github.com/fzaninotto/Faker/pull/522) ([asika32764](https://github.com/asika32764)) +* Fixed phonenumber formats in Dutch (nl\_NL) PhoneNumber provider [\#521](https://github.com/fzaninotto/Faker/pull/521) ([SpaceK33z](https://github.com/SpaceK33z)) +* Fixed Russian (ru\_RU) Address provider [\#518](https://github.com/fzaninotto/Faker/pull/518) ([glagola](https://github.com/glagola)) +* Added Italian (it\_IT) Text provider [\#517](https://github.com/fzaninotto/Faker/pull/517) ([endelwar](https://github.com/endelwar)) +* Added Norwegian (no\_NO) locale [\#515](https://github.com/fzaninotto/Faker/pull/515) ([phaza](https://github.com/phaza)) +* Added VAT number to Bulgarian (bg\_BG) Payment provider [\#512](https://github.com/fzaninotto/Faker/pull/512) ([ronanguilloux](https://github.com/ronanguilloux)) +* Fixed UserAgent provider outdated user agents [\#511](https://github.com/fzaninotto/Faker/pull/511) ([ajbdev](https://github.com/ajbdev)) +* Fixed `image()` formatter to make it work with temp dir of any (decent) OS [\#507](https://github.com/fzaninotto/Faker/pull/507) ([ronanguilloux](https://github.com/ronanguilloux)) +* Added Persian (fa\_IR) locale [\#500](https://github.com/fzaninotto/Faker/pull/500) ([zoli](https://github.com/zoli)) +* Added Currency Code formatter [\#497](https://github.com/fzaninotto/Faker/pull/497) ([stelgenhof](https://github.com/stelgenhof)) +* Added VAT number to Belgium (be_BE) Payment provider [\#495](https://github.com/fzaninotto/Faker/pull/495) ([ronanguilloux](https://github.com/ronanguilloux)) +* Fixed `imageUrl` formatter bug where it would always return the same image [\#494](https://github.com/fzaninotto/Faker/pull/494) ([fzaninotto](https://github.com/fzaninotto)) +* Added more Indonesian (id\_ID) providers [\#493](https://github.com/fzaninotto/Faker/pull/493) ([deerawan](https://github.com/deerawan)) +* Added Indonesian (id\_ID) locale [\#492](https://github.com/fzaninotto/Faker/pull/492) ([stoutZero](https://github.com/stoutZero)) +* Fixed unique generator performance [\#491](https://github.com/fzaninotto/Faker/pull/491) ([ikwattro](https://github.com/ikwattro)) +* Added transliterator to `email` and `username` [\#490](https://github.com/fzaninotto/Faker/pull/490) ([fzaninotto](https://github.com/fzaninotto)) +* Added Hungarian (hu\_HU) Text provider [\#486](https://github.com/fzaninotto/Faker/pull/486) ([lintaba](https://github.com/lintaba)) +* Fixed CakePHP Entity Popolator (some cases where no entities prev. inserted) [\#483](https://github.com/fzaninotto/Faker/pull/483) ([jadb](https://github.com/jadb)) +* Added Color and DateTime Turkish (tr\_TR) Providers [\#481](https://github.com/fzaninotto/Faker/pull/481) ([behramcelen](https://github.com/behramcelen)) +* Added Latvian (lv\_LV) `personalIdentityNumber` formatter [\#472](https://github.com/fzaninotto/Faker/pull/472) ([MatissJanis](https://github.com/MatissJanis)) +* Added VAT number to Austrian (at_AT) Payment provider [\#470](https://github.com/fzaninotto/Faker/pull/470) ([ronanguilloux](https://github.com/ronanguilloux)) +* Fixed missing @return phpDoc in Payment provider [\#469](https://github.com/fzaninotto/Faker/pull/469) ([ronanguilloux](https://github.com/ronanguilloux)) +* Added SWIFT/BIC payment type formatter to the Payment provider [\#465](https://github.com/fzaninotto/Faker/pull/465) ([ronanguilloux](https://github.com/ronanguilloux)) +* Fixed small typo in Base provider exception [\#460](https://github.com/fzaninotto/Faker/pull/460) ([miclf](https://github.com/miclf)) +* Added Georgian (ka\_Ge) locale [\#457](https://github.com/fzaninotto/Faker/pull/457) ([lperto](https://github.com/lperto)) +* Added PSR-4 Autoloading [\#455](https://github.com/fzaninotto/Faker/pull/455) ([GrahamCampbell](https://github.com/GrahamCampbell)) +* Added Uganda (en_UG) locale [\#454](https://github.com/fzaninotto/Faker/pull/454) ([tharoldD](https://github.com/tharoldD)) +* Added `regexify` formatter, generating a random string based on a regular expression [\#453](https://github.com/fzaninotto/Faker/pull/453) ([fzaninotto](https://github.com/fzaninotto)) +* Added shuffle formatter, to shuffle an array or a string [\#452](https://github.com/fzaninotto/Faker/pull/452) ([fzaninotto](https://github.com/fzaninotto)) +* Added ISBN-10 & ISBN-13 codes formatters to Barcode provider [\#451](https://github.com/fzaninotto/Faker/pull/451) ([gietos](https://github.com/gietos)) +* Fixed Russian (ru\_RU) middle names (different for different genders) [\#450](https://github.com/fzaninotto/Faker/pull/450) ([gietos](https://github.com/gietos)) +* Fixed Ukranian (uk\_UA) Person provider [\#448](https://github.com/fzaninotto/Faker/pull/448) ([aivus](https://github.com/aivus)) +* Added Vietnamese (vi\_VN) locale [\#447](https://github.com/fzaninotto/Faker/pull/447) ([huy95](https://github.com/huy95)) +* Added type hint to the Documentor constructor [\#446](https://github.com/fzaninotto/Faker/pull/446) ([JeroenDeDauw](https://github.com/JeroenDeDauw)) +* Fixed Russian (ru\_RU) Person provider (joined names) [\#445](https://github.com/fzaninotto/Faker/pull/445) ([aivus](https://github.com/aivus)) +* Added English (en\_GB) `mobileNumber` methods [\#438](https://github.com/fzaninotto/Faker/pull/438) ([daveblake](https://github.com/daveblake)) +* Added Traditional Chinese (zh\_TW) Realtext provider [\#434](https://github.com/fzaninotto/Faker/pull/434) ([tzhuan](https://github.com/tzhuan)) +* Fixed first name in Spanish for Argentina (es\_AR) Person provider [\#433](https://github.com/fzaninotto/Faker/pull/433) ([fzaninotto](https://github.com/fzaninotto)) +* Fixed Canadian (en_CA) state abbreviation for Nunavut [\#430](https://github.com/fzaninotto/Faker/pull/430) ([julien-c](https://github.com/julien-c)) +* Added CakePHP ORM entity populator [\#428](https://github.com/fzaninotto/Faker/pull/428) ([jadb](https://github.com/jadb)) +* Added Traditional Chinese (zh\_TW) locale [\#427](https://github.com/fzaninotto/Faker/pull/427) ([tzhuan](https://github.com/tzhuan)) +* Fixed typo in Doctrine Populator phpDoc [\#425](https://github.com/fzaninotto/Faker/pull/425) ([ihsanudin](https://github.com/ihsanudin)) +* Added Chinese (zh_CN) Internet provider [\#424](https://github.com/fzaninotto/Faker/pull/424) ([Lisso-Me](https://github.com/Lisso-Me)) +* Added Country ISO 3166-1 alpha-3 code to the Miscellaneous provider[\#422](https://github.com/fzaninotto/Faker/pull/422) ([gido](https://github.com/gido)) +* Added English (en\_GB) Person provider [\#421](https://github.com/fzaninotto/Faker/pull/421) ([AlexCutts](https://github.com/AlexCutts)) +* Added missing tests for the Color Provider [\#420](https://github.com/fzaninotto/Faker/pull/420) ([bessl](https://github.com/bessl)) +* Added Nepali (ne\_NP) locale [\#419](https://github.com/fzaninotto/Faker/pull/419) ([ankitpokhrel](https://github.com/ankitpokhrel)) +* Fixed latitude and longitude formatters bug (numeric value out of range for 32bits) [\#416](https://github.com/fzaninotto/Faker/pull/416) ([fzaninotto](https://github.com/fzaninotto)) +* Added a dedicated calculator Luhn calculator service [\#414](https://github.com/fzaninotto/Faker/pull/414) ([fzaninotto](https://github.com/fzaninotto)) +* Fixed Russian (ru_RU) Person provider (removed lowercase duplications) [\#413](https://github.com/fzaninotto/Faker/pull/413) ([Ragazzo](https://github.com/Ragazzo)) +* Fixed barcode formatter (improved speed, added tests) [\#412](https://github.com/fzaninotto/Faker/pull/412) ([fzaninotto](https://github.com/fzaninotto)) +* Added ipv4 and barcode formatters tests [\#410](https://github.com/fzaninotto/Faker/pull/410) ([bessl](https://github.com/bessl)) +* Fixed typos in various comments blocks [\#409](https://github.com/fzaninotto/Faker/pull/409) ([bessl](https://github.com/bessl)) +* Fixed InternetTest (replaced regex with PHP filter) [\#406](https://github.com/fzaninotto/Faker/pull/406) ([bessl](https://github.com/bessl)) +* Added password formatter to the Internet provider[\#402](https://github.com/fzaninotto/Faker/pull/402) ([fzaninotto](https://github.com/fzaninotto)) +* Added Company and Internet Austrian (de\_AT) Providers [\#400](https://github.com/fzaninotto/Faker/pull/400) ([bessl](https://github.com/bessl)) +* Added third-party libraries section in README [\#399](https://github.com/fzaninotto/Faker/pull/399) ([fzaninotto](https://github.com/fzaninotto)) +* Added Spanish for Venezuela (es\_VE) locale [\#398](https://github.com/fzaninotto/Faker/pull/398) ([DIOHz0r](https://github.com/DIOHz0r)) +* Added PhoneNumber Autrian (de\_AT) Provider, and missing test for the 'locale' method. [\#395](https://github.com/fzaninotto/Faker/pull/395) ([bessl](https://github.com/bessl)) +* Removed wrongly localized Lorem provider [\#394](https://github.com/fzaninotto/Faker/pull/394) ([fzaninotto](https://github.com/fzaninotto)) +* Fixed Miscellaneous provider (made the `locale` formatter static) [\#390](https://github.com/fzaninotto/Faker/pull/390) ([bessl](https://github.com/bessl)) +* Added a unit test file for the Miscellaneous Provider [\#389](https://github.com/fzaninotto/Faker/pull/389) ([bessl](https://github.com/bessl)) +* Added warning in README about using `rand()`` and the seed functions [\#386](https://github.com/fzaninotto/Faker/pull/386) ([paulvalla](https://github.com/paulvalla)) +* Fixed French (fr\_FR) Person provider (Uppercased a first name) [\#385](https://github.com/fzaninotto/Faker/pull/385) ([netcarver](https://github.com/netcarver)) +* Added Russian (ru\_RU) and Ukrainian (uk\_UA) Text providers [\#383](https://github.com/fzaninotto/Faker/pull/383) ([terion-name](https://github.com/terion-name)) +* Added more street prefixes to French (fr\_FR) Address provider [\#381](https://github.com/fzaninotto/Faker/pull/381) ([ronanguilloux](https://github.com/ronanguilloux)) +* Added PHP 5.6 to CI targets [\#378](https://github.com/fzaninotto/Faker/pull/378) ([GrahamCampbell](https://github.com/GrahamCampbell)) +* Fixed spaces remaining at the end of liine in various files [\#377](https://github.com/fzaninotto/Faker/pull/377) ([GrahamCampbell](https://github.com/GrahamCampbell)) +* Fixed UserAgent provider (added space before processor on linux platform) [\#374](https://github.com/fzaninotto/Faker/pull/374) ([TomK](https://github.com/TomK)) +* Added Company generator for Russian (ru\_RU) locale [\#371](https://github.com/fzaninotto/Faker/pull/371) ([kix](https://github.com/kix)) +* Fixed Russian (ru\_RU) Color provider (uppercase letters) [\#370](https://github.com/fzaninotto/Faker/pull/370) ([semanser](https://github.com/semanser)) +* Added more Polish (pl\_PL) phone numbers [\#369](https://github.com/fzaninotto/Faker/pull/369) ([piotrantosik](https://github.com/piotrantosik)) +* Fixed Ruby Faker link in readme [\#368](https://github.com/fzaninotto/Faker/pull/368) ([philsturgeon](https://github.com/philsturgeon)) +* Added more Japanese (ja\_JP) names in Person provider [\#366](https://github.com/fzaninotto/Faker/pull/366) ([kumamidori](https://github.com/kumamidori)) +* Added Slovenian (sl\_SL) locale [\#363](https://github.com/fzaninotto/Faker/pull/363) ([alesf](https://github.com/alesf)) +* Fixed German (de\_DE) Person provider (first names) [\#362](https://github.com/fzaninotto/Faker/pull/362) ([mikehaertl](https://github.com/mikehaertl)) +* Fixed Ukrainian (uk\_UA) Person providr (there is no such letter "Ñ‹" in Ukrainian) [\#359](https://github.com/fzaninotto/Faker/pull/359) ([nazar-pc](https://github.com/nazar-pc)) +* Fixed Chinese (zh\_CN) PhoneNumber provider (the length of mobile phone number is 11) [\#358](https://github.com/fzaninotto/Faker/pull/358) ([byan](https://github.com/byan)) +* Added Arabic (ar_\JO) Locale [\#357](https://github.com/fzaninotto/Faker/pull/357) ([zrashwani](https://github.com/zrashwani)) +* Fixed Czech (cs\_CZ) Person provider (missing lowercase in last name) [\#355](https://github.com/fzaninotto/Faker/pull/355) ([halaxa](https://github.com/halaxa)) +* Fixed French for Belgium (fr\_BE) Address Provider (doubled city names) [\#354](https://github.com/fzaninotto/Faker/pull/354) ([miclf](https://github.com/miclf)) +* Added Biased Integer Provider [\#332](https://github.com/fzaninotto/Faker/pull/332) ([TimWolla](https://github.com/TimWolla)) +* Added Swedish (sv\_SE) locale [\#316](https://github.com/fzaninotto/Faker/pull/316) ([ulrikjohansson](https://github.com/ulrikjohansson)) +* Added English for New Zealand (en\_NZ) locale [\#283](https://github.com/fzaninotto/Faker/pull/283) ([JasonMortonNZ](https://github.com/JasonMortonNZ)) +* Added mention of external Provider for cron expressions to readme[\#498](https://github.com/fzaninotto/Faker/pull/498) ([swekaj](https://github.com/swekaj)) + +2014-06-04, v1.4.0 +------------------ + +* Fixed typo in Slovak person names (cinan) +* Added tests for uk_UA providers (serge-kuharev) +* Fixed numerify() performance by making it 30% faster (fzaninotto) +* Added strict option to randomNumber to force number of digits (fzaninotto) +* Fixed randomNumber usage duplicating numberBetween (fzaninotto) +* Fixed address provider for latvian language (MatissJA) +* Added Czech Republic (cs_CZ) address, company, datetime and text providers (Mikulas) +* Fixed da_DK Person provider data containing an 'unnamed' person (tolnem) +* Added slug provider (fzaninotto) +* Fixed IDE insights for new local IP and MAC address providers (hugofonseca) +* Added firstname gender method to all Person providers (csanquer) +* Fixed tr_TR email service, city name, person, and phone number formats (ogunkarakus) +* Fixed US_en state list (fzaninotto) +* Fixed en_US address provider so state abbr are ISO 3166 codes (Garbee) +* Added local IP and MAC address providers (kielabokkie) +* Fixed typo in century list affecting the century provider (fzaninotto) +* Added default value to optional modifier (joshuajabbour) +* Fixed Portuguese phonenumbers have 9 digits (hugofonseca) +* Added fileCopy to File provider to simulate file upload (stefanosala) +* Added pt_PT providers (hugofonseca) +* Fixed dead code in text provider (hugofonseca) +* Fixed IDE insights for magic properties (hugofonseca) +* Added tin (NIF) generator for pt_PT provider (hugofonseca) +* Fixed numberBetween max default value handling (fzaninotto) +* Added pt_PT phone number provider (hugofonseca) +* Fixed PSR-2 standards and add make task to force it on Travis (terite) +* Added new ro_RO Personal Numerical Code (CNP) and phone number providers (avataru) +* Fixed Internet provider for sk_SK locale (cinan) +* Fixed typo in en_ZA Internet provider (bjorntheart) +* Fixed phpdoc for DateTime magic methods (stof) +* Added doc about seeding with maximum timestamp using dateTime formatters (fzaninotto) +* Added Maximum Timestamp option to get always same unix timestamp when using a fixed seed (csanquer) +* Added Montenegrian (me_ME) providers (ognjenm) +* Added ean barcode provider (nineinchnick) +* Added fullPath parameter to Image provider (stefanosala) +* Added more Polish company formats (nineinchnick) +* Added Polish realText provider (nineinchnick) +* Fixed remaining non-seedable random generators (terite) +* Added randomElements provider (terite) +* Added French realText provider (fzaninotto) +* Fixed realText provider bootstrap slowness (fzaninotto) +* Added realText provider for English and German, based on Markov Chains Generator (TimWolla) +* Fixed address format in nl_NL provider (doenietzomoeilijk) +* Fixed potentially offensive word from last name list (joshuajabbour) +* Fixed reamde documentation about the optional modifier (cryode) +* Fixed Image provider and documentor routine (fzaninotto) +* Fixed IDE insights for methods (PedroTroller) +* Fixed missing data in en_US Address provider (Garbee) +* Added Bengali (bn_BD) providers (masnun) +* Fixed warning on test file when short tags are on (bateller) +* Fixed Doctrine populator undefined index warning (dbojdo) +* Added French Canadian (fr_CA) Address and Person providers (marcaube) +* Fixed typo in NullGenerator (mhanson01) +* Fixed Doctrine populator issue with one-to-one nullable relationship (jpetitcolas) +* Added Canadian English (en_CA) address and phone number providers (cviebrock) +* Fixed duplicated Payment example in readme (Garbee) +* Fixed Polish (pl_PL) Person provider data (czogori) +* Added Hungarian (hu_HU) providers (sagikazarmark) +* Added 'kana' (ja_JP) name formatters (kzykhys) +* Added allow_failure for hhvm to travis-ci and test against php 5.5 (toin0u) + +2013-12-16, v1.3.0 +------------------ + +* Fixed state generator in Australian (en_AU) provider (sebklaus) +* Fixed IDE insights for locale specific providers (ulrikjohansson) +* Added English (South Africa) (en_ZA) person, address, Internet and phone number providers (dmfaux) +* Fixed integer values overflowing on signed INTEGER columns on Doctrine populator (Thinkscape) +* Fixed spelling error in French (fr_FR) address provider (leihog) +* Added improvements based on SensioLabsInsights analysis +* Fixed Italian (it_IT) email provider (garak) +* Added Spanish (es_ES) Internet provider (eusonlito) +* Added English Philippines (en_PH) address provider (kamote) +* Added Brazilian (pt_BR) email provider data (KennedyTedesco) +* Fixed UK country code (pgscandeias) +* Added Peruvian (es_PE) person, address, phone number, and company providers (cslucano) +* Added Ukrainian (uk_UA) color provider (ruden) +* Fixed Ukrainian (uk_UA) namespace and email translitteration (ruden) +* Added Romanian (Moldova) (ro_MD) person, address, and phone number providers (AlexanderC) +* Added IBAN generator for every currently known locale that uses it (nineinchnick) +* Added Image generation powered by LoremPixel (weotch) +* Fixed missing timezone with dateTimeBetween (baldurrensch) +* Fixed call to undefined method cardType in Payment (WMeldon) +* Added Romanian (ro_RO) address and person providers (calina-c) +* Fixed Doctrine populator to use ObjectManager instead of EntityManagerInterface (mgiustiniani) +* Fixed docblock for Provider\Base::unique() (pschultz) +* Added Payment providers (creditCardType, creditCardNumber, creditCardExpirationDate, creditCardExpirationDateString) (pomaxa) +* Added unique() modifier +* Added IDE insights to allow better intellisense/phpStorm autocompletion (thallisphp) +* Added Polish (pl_PL) address provider, personal identity number and pesel number generator (nineinchnick) +* Added Turkish (tr_TR) address provider, and improved internet provider (hasandz) +* Fixed Propel column number guesser to use signed range of values (gunnarlium) +* Added Greek (el_GR) person, address, and phone number providers (georgeharito) +* Added Austrian (en_AU) address, Internet, and phone number providers (rcuddy) +* Fixed phpDoc in Doctrine Entity populator (rogamoore) +* Added French (fr_FR) phone number formats (vchabot) +* Added optional() modifier (weotch) +* Fixed typo in the Person provider documentation (jtreminio) +* Fixed Russian (ru_RU) person format (alexshadow007) +* Added Japanese (ja_JP) person, address, Internet, phone number, and company providers (kumamidori) +* Added color providers, driver license and passport number formats for the ru_RU locale (pomaxa) +* Added Latvian (lv_LV) person, address, Internet, and phone number providers (pomaxa) +* Added Brazilian (pt_BR) Internet provider (vjnrv) +* Added more Czech (cs_CZ) lastnames (petrkle) +* Added Chinese Simplified (zh_CN) person, address, Internet, and phone number providers (tlikai) +* Fixed Typos (pborelli) +* Added Color provider with hexColor, rgbColor, rgbColorAsArray, rgbCssColor, safeColorName, and colorName formatters (lsv) +* Added support for associative arrays in `randomElement` (aRn0D) + + +2013-06-09, v1.2.0 +------------------ + +* Added new provider for fr_BE locale (jflefebvre) +* Updated locale provider to use a static locale list (spawn-guy) +* Fixed invalid UTF-8 sequence in domain provider with the Bulgarian provider (Dynom) +* Fixed the nl_NL Person provider (Dynom) +* Removed all requires and added the autoload definition to composer (Dynom) +* Fixed encoding problems in nl_NL Address provider (Dynom) +* Added icelandic provider (is_IS) (birkir) +* Added en_CA address and phone numbers (cviebrock) +* Updated safeEmail provider to be really safe (TimWolla) +* Documented alternative randomNumber usage (Seldaek) +* Added basic file provider (anroots) +* Fixed use of fourth argument on Doctrine addEntity (ecentinela) +* Added nl_BE provider (wimvds) +* Added Random Float provider (csanquer) +* Fixed bug in Faker\ORM\Doctrine\Populator (mmf-amarcos) +* Updated ru_RU provider (rmrevin) +* Added safe email domain provider (csanquer) +* Fixed latitude provider (rumpl) +* Fixed unpredictability of fake data generated by Faker\Provider\Base::numberBetween() (goatherd) +* Added uuid provider (goatherd) +* Added possibility to call methods on Doctrine entities, possibility to generate unique id (nenadalm) +* Fixed prefixes typos in 'pl_PL' Person provider (krymen) +* Added more fake data to the Ukraininan providers (lysenkobv) +* Added more fake data to the Italian providers (EmanueleMinotto) +* Fixed spaces appearing in generated emails (alchy58) +* Added Armenian (hy_AM) provider (artash) +* Added Generation of valid SIREN & SIRET codes to French providers (alexsegura) +* Added Dutch (nl_NL) provider (WouterJ) +* Fixed missing typehint in Base::__construct() (benja-M-1) +* Fixed typo in README (benja-M-1) +* Added Ukrainian (ua_UA) provider (rsvasilyev) +* Added Turkish (tr_TR) Provider (faridmovsumov) +* Fixed executable bit in some PHP files (siwinski) +* Added Brazilian Portuguese (pt_BR) provider (oliveiraev) +* Added Spanish (es_ES) provider (ivannis) +* Fixed Doctrine populator to allow for the population of entity data that has associations to other entities (afishnamedsquish) +* Added Danish (da_DK) providers (toin0u) +* Cleaned up whitespaces (toin0u) +* Fixed utf-8 bug with lowercase generators (toin0u) +* Fixed composer.json (Seldaek) +* Fixed bug in Doctrine EntityPopulator (beberlei) +* Added Finnish (fi_FI) provider (drodil) + +2012-10-29, v1.1.0 +------------------ + +* Updated text provider to return paragraphs as a string instead of array. Great for populating markdown textarea fields (Seldaek) +* Updated dateTimeBetween to accept DateTime instances (Seldaek) +* Added random number generator between a and b, simply like rand() (Seldaek) +* Fixed spaces in generated emails (blaugueux) +* Fixed Person provider in Russian locale (Isamashii) +* Added new UserAgent provider (blaugueux) +* Added locale generator to Miscellaneous provider (blaugueux) +* Added timezone generator to DateTime provider (blaugueux) +* Added new generators to French Address providers (departments, regions) (geoffrey-brier) +* Added new generators to French Company provider (catch phrase, SIREN, and SIRET numbers) (geoffrey-brier) +* Added state generator to German Address provider (Powerhamster) +* Added Slovak provider (bazo) +* Added latitude and longitude formatters to Address provider (fixe) +* Added Serbian provider (umpirsky) + +2012-07-10, v1.0.0 +----------------- + +* Initial Version diff --git a/vendor/fzaninotto/faker/CONTRIBUTING.md b/vendor/fzaninotto/faker/CONTRIBUTING.md new file mode 100644 index 0000000..804bf79 --- /dev/null +++ b/vendor/fzaninotto/faker/CONTRIBUTING.md @@ -0,0 +1,22 @@ +Contributing +============ + +If you've written a new formatter, adapted Faker to a new locale, or fixed a bug, your contribution is welcome! + +Before proposing a pull request, check the following: + +* Your code should follow the [PSR-2 coding standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). Run `make sniff` to check that the coding standards are followed, and use [php-cs-fixer](https://github.com/fabpot/PHP-CS-Fixer) to fix inconsistencies. +* Unit tests should still pass after your patch. Run the tests on your dev server (with `make test`) or check the continuous integration status for your pull request. +* As much as possible, add unit tests for your code +* Never use `rand()` in your providers. Faker uses the Mersenne Twister Randomizer, so use `mt_rand()` or any of the base generators (`randomNumber`, `randomElement`, etc.) instead. +* If you add new providers (or new locales) and that they embed a lot of data for random generation (e.g. first names in a new language), please add a `@link` to the reference you used for this list (example [in the ru_RU locale](https://github.com/fzaninotto/Faker/blob/master/src/Faker/Provider/ru_RU/Person.php#L13)). This will ease future updates of the list and debates about the most relevant data for this provider. +* If you add long list of random data, please split the list into several lines. This makes diffs easier to read, and facilitates core review. +* If you add new formatters, please include documentation for it in the README. Don't forget to add a line about new formatters in the `@property` or `@method` phpDoc entries in [Generator.php](https://github.com/fzaninotto/Faker/blob/master/src/Faker/Generator.php#L6-L118) to help IDEs auto-complete your formatters. +* If your new formatters are specific to a certain locale, document them in the [Language-specific formatters](https://github.com/fzaninotto/Faker#language-specific-formatters) list instead. +* Avoid changing existing sets of data. Some developers use Faker with seeding for unit tests ; changing the data makes their tests fail. +* Speed is important in all Faker usages. Make sure your code is optimized to generate thousands of fake items in no time, without consuming too much memory or CPU. +* If you commit a new feature, be prepared to help maintaining it. Watch the project on GitHub, and please comment on issues or PRs regarding the feature you contributed. + +Once your code is merged, it is available for free to everybody under the MIT License. Publishing your Pull Request on the Faker GitHub repository means that you agree with this license for your contribution. + +Thank you for your contribution! Faker wouldn't be so great without you. diff --git a/vendor/fzaninotto/faker/LICENSE b/vendor/fzaninotto/faker/LICENSE new file mode 100644 index 0000000..99ed007 --- /dev/null +++ b/vendor/fzaninotto/faker/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2011 François Zaninotto +Portions Copyright (c) 2008 Caius Durling +Portions Copyright (c) 2008 Adam Royle +Portions Copyright (c) 2008 Fiona Burrows + +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/fzaninotto/faker/Makefile b/vendor/fzaninotto/faker/Makefile new file mode 100644 index 0000000..ccfde5c --- /dev/null +++ b/vendor/fzaninotto/faker/Makefile @@ -0,0 +1,10 @@ +vendor/autoload.php: + composer install --no-interaction --prefer-dist + +.PHONY: sniff +sniff: vendor/autoload.php + vendor/bin/phpcs --standard=PSR2 src -n + +.PHONY: test +test: vendor/autoload.php + vendor/bin/phpunit --verbose diff --git a/vendor/fzaninotto/faker/composer.json b/vendor/fzaninotto/faker/composer.json new file mode 100644 index 0000000..e52016e --- /dev/null +++ b/vendor/fzaninotto/faker/composer.json @@ -0,0 +1,35 @@ +{ + "name": "fzaninotto/faker", + "type": "library", + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": ["faker", "fixtures", "data"], + "license": "MIT", + "authors": [ + { + "name": "François Zaninotto" + } + ], + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7", + "squizlabs/php_codesniffer": "^1.5", + "ext-intl": "*" + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "autoload-dev": { + "psr-4": { + "Faker\\Test\\": "test/Faker/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + } +} diff --git a/vendor/fzaninotto/faker/phpunit.xml.dist b/vendor/fzaninotto/faker/phpunit.xml.dist new file mode 100644 index 0000000..4ffa17f --- /dev/null +++ b/vendor/fzaninotto/faker/phpunit.xml.dist @@ -0,0 +1,12 @@ + + + + + + ./test/Faker/ + + + diff --git a/vendor/fzaninotto/faker/readme.md b/vendor/fzaninotto/faker/readme.md new file mode 100644 index 0000000..c375490 --- /dev/null +++ b/vendor/fzaninotto/faker/readme.md @@ -0,0 +1,1707 @@ +# Faker + +Faker is a PHP library that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to stress test it, or anonymize data taken from a production service, Faker is for you. + +Faker is heavily inspired by Perl's [Data::Faker](http://search.cpan.org/~jasonk/Data-Faker-0.07/), and by ruby's [Faker](https://rubygems.org/gems/faker). + +Faker requires PHP >= 5.3.3. + +[![Monthly Downloads](https://poser.pugx.org/fzaninotto/faker/d/monthly.png)](https://packagist.org/packages/fzaninotto/faker) [![Build Status](https://travis-ci.org/fzaninotto/Faker.svg?branch=master)](https://travis-ci.org/fzaninotto/Faker) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/eceb78a9-38d4-4ad5-8b6b-b52f323e3549/mini.png)](https://insight.sensiolabs.com/projects/eceb78a9-38d4-4ad5-8b6b-b52f323e3549) + +# Table of Contents + +- [Installation](#installation) +- [Basic Usage](#basic-usage) +- [Formatters](#formatters) + - [Base](#fakerproviderbase) + - [Lorem Ipsum Text](#fakerproviderlorem) + - [Person](#fakerprovideren_usperson) + - [Address](#fakerprovideren_usaddress) + - [Phone Number](#fakerprovideren_usphonenumber) + - [Company](#fakerprovideren_uscompany) + - [Real Text](#fakerprovideren_ustext) + - [Date and Time](#fakerproviderdatetime) + - [Internet](#fakerproviderinternet) + - [User Agent](#fakerprovideruseragent) + - [Payment](#fakerproviderpayment) + - [Color](#fakerprovidercolor) + - [File](#fakerproviderfile) + - [Image](#fakerproviderimage) + - [Uuid](#fakerprovideruuid) + - [Barcode](#fakerproviderbarcode) + - [Miscellaneous](#fakerprovidermiscellaneous) + - [Biased](#fakerproviderbiased) + - [Html Lorem](#fakerproviderhtmllorem) +- [Modifiers](#modifiers) +- [Localization](#localization) +- [Populating Entities Using an ORM or an ODM](#populating-entities-using-an-orm-or-an-odm) +- [Seeding the Generator](#seeding-the-generator) +- [Faker Internals: Understanding Providers](#faker-internals-understanding-providers) +- [Real Life Usage](#real-life-usage) +- [Language specific formatters](#language-specific-formatters) +- [Third-Party Libraries Extending/Based On Faker](#third-party-libraries-extendingbased-on-faker) +- [License](#license) + + +## Installation + +```sh +composer require fzaninotto/faker +``` + +## Basic Usage + +Use `Faker\Factory::create()` to create and initialize a faker generator, which can generate data by accessing properties named after the type of data you want. + +```php +name; + // 'Lucy Cechtelar'; +echo $faker->address; + // "426 Jordy Lodge + // Cartwrightshire, SC 88120-6700" +echo $faker->text; + // Dolores sit sint laboriosam dolorem culpa et autem. Beatae nam sunt fugit + // et sit et mollitia sed. + // Fuga deserunt tempora facere magni omnis. Omnis quia temporibus laudantium + // sit minima sint. +``` + +Even if this example shows a property access, each call to `$faker->name` yields a different (random) result. This is because Faker uses `__get()` magic, and forwards `Faker\Generator->$property` calls to `Faker\Generator->format($property)`. + +```php +name, "\n"; +} + // Adaline Reichel + // Dr. Santa Prosacco DVM + // Noemy Vandervort V + // Lexi O'Conner + // Gracie Weber + // Roscoe Johns + // Emmett Lebsack + // Keegan Thiel + // Wellington Koelpin II + // Ms. Karley Kiehn V +``` + +**Tip**: For a quick generation of fake data, you can also use Faker as a command line tool thanks to [faker-cli](https://github.com/bit3/faker-cli). + +## Formatters + +Each of the generator properties (like `name`, `address`, and `lorem`) are called "formatters". A faker generator has many of them, packaged in "providers". Here is a list of the bundled formatters in the default locale. + +### `Faker\Provider\Base` + + randomDigit // 7 + randomDigitNotNull // 5 + randomNumber($nbDigits = NULL, $strict = false) // 79907610 + randomFloat($nbMaxDecimals = NULL, $min = 0, $max = NULL) // 48.8932 + numberBetween($min = 1000, $max = 9000) // 8567 + randomLetter // 'b' + // returns randomly ordered subsequence of a provided array + randomElements($array = array ('a','b','c'), $count = 1) // array('c') + randomElement($array = array ('a','b','c')) // 'b' + shuffle('hello, world') // 'rlo,h eoldlw' + shuffle(array(1, 2, 3)) // array(2, 1, 3) + numerify('Hello ###') // 'Hello 609' + lexify('Hello ???') // 'Hello wgt' + bothify('Hello ##??') // 'Hello 42jz' + asciify('Hello ***') // 'Hello R6+' + regexify('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}'); // sm0@y8k96a.ej + +### `Faker\Provider\Lorem` + + word // 'aut' + words($nb = 3, $asText = false) // array('porro', 'sed', 'magni') + sentence($nbWords = 6, $variableNbWords = true) // 'Sit vitae voluptas sint non voluptates.' + sentences($nb = 3, $asText = false) // array('Optio quos qui illo error.', 'Laborum vero a officia id corporis.', 'Saepe provident esse hic eligendi.') + paragraph($nbSentences = 3, $variableNbSentences = true) // 'Ut ab voluptas sed a nam. Sint autem inventore aut officia aut aut blanditiis. Ducimus eos odit amet et est ut eum.' + paragraphs($nb = 3, $asText = false) // array('Quidem ut sunt et quidem est accusamus aut. Fuga est placeat rerum ut. Enim ex eveniet facere sunt.', 'Aut nam et eum architecto fugit repellendus illo. Qui ex esse veritatis.', 'Possimus omnis aut incidunt sunt. Asperiores incidunt iure sequi cum culpa rem. Rerum exercitationem est rem.') + text($maxNbChars = 200) // 'Fuga totam reiciendis qui architecto fugiat nemo. Consequatur recusandae qui cupiditate eos quod.' + +### `Faker\Provider\en_US\Person` + + title($gender = null|'male'|'female') // 'Ms.' + titleMale // 'Mr.' + titleFemale // 'Ms.' + suffix // 'Jr.' + name($gender = null|'male'|'female') // 'Dr. Zane Stroman' + firstName($gender = null|'male'|'female') // 'Maynard' + firstNameMale // 'Maynard' + firstNameFemale // 'Rachel' + lastName // 'Zulauf' + +### `Faker\Provider\en_US\Address` + + cityPrefix // 'Lake' + secondaryAddress // 'Suite 961' + state // 'NewMexico' + stateAbbr // 'OH' + citySuffix // 'borough' + streetSuffix // 'Keys' + buildingNumber // '484' + city // 'West Judge' + streetName // 'Keegan Trail' + streetAddress // '439 Karley Loaf Suite 897' + postcode // '17916' + address // '8888 Cummings Vista Apt. 101, Susanbury, NY 95473' + country // 'Falkland Islands (Malvinas)' + latitude($min = -90, $max = 90) // 77.147489 + longitude($min = -180, $max = 180) // 86.211205 + +### `Faker\Provider\en_US\PhoneNumber` + + phoneNumber // '201-886-0269 x3767' + tollFreePhoneNumber // '(888) 937-7238' + e164PhoneNumber // '+27113456789' + +### `Faker\Provider\en_US\Company` + + catchPhrase // 'Monitored regional contingency' + bs // 'e-enable robust architectures' + company // 'Bogan-Treutel' + companySuffix // 'and Sons' + jobTitle // 'Cashier' + +### `Faker\Provider\en_US\Text` + + realText($maxNbChars = 200, $indexSize = 2) // "And yet I wish you could manage it?) 'And what are they made of?' Alice asked in a shrill, passionate voice. 'Would YOU like cats if you were never even spoke to Time!' 'Perhaps not,' Alice replied." + +### `Faker\Provider\DateTime` + + unixTime($max = 'now') // 58781813 + dateTime($max = 'now', $timezone = null) // DateTime('2008-04-25 08:37:17', 'UTC') + dateTimeAD($max = 'now', $timezone = null) // DateTime('1800-04-29 20:38:49', 'Europe/Paris') + iso8601($max = 'now') // '1978-12-09T10:10:29+0000' + date($format = 'Y-m-d', $max = 'now') // '1979-06-09' + time($format = 'H:i:s', $max = 'now') // '20:49:42' + dateTimeBetween($startDate = '-30 years', $endDate = 'now', $timezone = null) // DateTime('2003-03-15 02:00:49', 'Africa/Lagos') + dateTimeInInterval($startDate = '-30 years', $interval = '+ 5 days', $timezone = null) // DateTime('2003-03-15 02:00:49', 'Antartica/Vostok') + dateTimeThisCentury($max = 'now', $timezone = null) // DateTime('1915-05-30 19:28:21', 'UTC') + dateTimeThisDecade($max = 'now', $timezone = null) // DateTime('2007-05-29 22:30:48', 'Europe/Paris') + dateTimeThisYear($max = 'now', $timezone = null) // DateTime('2011-02-27 20:52:14', 'Africa/Lagos') + dateTimeThisMonth($max = 'now', $timezone = null) // DateTime('2011-10-23 13:46:23', 'Antarctica/Vostok') + amPm($max = 'now') // 'pm' + dayOfMonth($max = 'now') // '04' + dayOfWeek($max = 'now') // 'Friday' + month($max = 'now') // '06' + monthName($max = 'now') // 'January' + year($max = 'now') // '1993' + century // 'VI' + timezone // 'Europe/Paris' + +Methods accepting a `$timezone` argument default to `date_default_timezone_get()`. You can pass a custom timezone string to each method, or define a custom timezone for all time methods at once using `$faker::setDefaultTimezone($timezone)`. + +### `Faker\Provider\Internet` + + email // 'tkshlerin@collins.com' + safeEmail // 'king.alford@example.org' + freeEmail // 'bradley72@gmail.com' + companyEmail // 'russel.durward@mcdermott.org' + freeEmailDomain // 'yahoo.com' + safeEmailDomain // 'example.org' + userName // 'wade55' + password // 'k&|X+a45*2[' + domainName // 'wolffdeckow.net' + domainWord // 'feeney' + tld // 'biz' + url // 'http://www.skilesdonnelly.biz/aut-accusantium-ut-architecto-sit-et.html' + slug // 'aut-repellat-commodi-vel-itaque-nihil-id-saepe-nostrum' + ipv4 // '109.133.32.252' + localIpv4 // '10.242.58.8' + ipv6 // '8e65:933d:22ee:a232:f1c1:2741:1f10:117c' + macAddress // '43:85:B7:08:10:CA' + +### `Faker\Provider\UserAgent` + + userAgent // 'Mozilla/5.0 (Windows CE) AppleWebKit/5350 (KHTML, like Gecko) Chrome/13.0.888.0 Safari/5350' + chrome // 'Mozilla/5.0 (Macintosh; PPC Mac OS X 10_6_5) AppleWebKit/5312 (KHTML, like Gecko) Chrome/14.0.894.0 Safari/5312' + firefox // 'Mozilla/5.0 (X11; Linuxi686; rv:7.0) Gecko/20101231 Firefox/3.6' + safari // 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_7_1 rv:3.0; en-US) AppleWebKit/534.11.3 (KHTML, like Gecko) Version/4.0 Safari/534.11.3' + opera // 'Opera/8.25 (Windows NT 5.1; en-US) Presto/2.9.188 Version/10.00' + internetExplorer // 'Mozilla/5.0 (compatible; MSIE 7.0; Windows 98; Win 9x 4.90; Trident/3.0)' + +### `Faker\Provider\Payment` + + creditCardType // 'MasterCard' + creditCardNumber // '4485480221084675' + creditCardExpirationDate // 04/13 + creditCardExpirationDateString // '04/13' + creditCardDetails // array('MasterCard', '4485480221084675', 'Aleksander Nowak', '04/13') + // Generates a random IBAN. Set $countryCode to null for a random country + iban($countryCode) // 'IT31A8497112740YZ575DJ28BP4' + swiftBicNumber // 'RZTIAT22263' + +### `Faker\Provider\Color` + + hexcolor // '#fa3cc2' + rgbcolor // '0,255,122' + rgbColorAsArray // array(0,255,122) + rgbCssColor // 'rgb(0,255,122)' + safeColorName // 'fuchsia' + colorName // 'Gainsbor' + +### `Faker\Provider\File` + + fileExtension // 'avi' + mimeType // 'video/x-msvideo' + // Copy a random file from the source to the target directory and returns the fullpath or filename + file($sourceDir = '/tmp', $targetDir = '/tmp') // '/path/to/targetDir/13b73edae8443990be1aa8f1a483bc27.jpg' + file($sourceDir, $targetDir, false) // '13b73edae8443990be1aa8f1a483bc27.jpg' + +### `Faker\Provider\Image` + + // Image generation provided by LoremPixel (http://lorempixel.com/) + imageUrl($width = 640, $height = 480) // 'http://lorempixel.com/640/480/' + imageUrl($width, $height, 'cats') // 'http://lorempixel.com/800/600/cats/' + imageUrl($width, $height, 'cats', true, 'Faker') // 'http://lorempixel.com/800/400/cats/Faker' + imageUrl($width, $height, 'cats', true, 'Faker', true) // 'http://lorempixel.com/grey/800/400/cats/Faker/' Monochrome image + image($dir = '/tmp', $width = 640, $height = 480) // '/tmp/13b73edae8443990be1aa8f1a483bc27.jpg' + image($dir, $width, $height, 'cats') // 'tmp/13b73edae8443990be1aa8f1a483bc27.jpg' it's a cat! + image($dir, $width, $height, 'cats', false) // '13b73edae8443990be1aa8f1a483bc27.jpg' it's a filename without path + image($dir, $width, $height, 'cats', true, false) // it's a no randomize images (default: `true`) + image($dir, $width, $height, 'cats', true, true, 'Faker') // 'tmp/13b73edae8443990be1aa8f1a483bc27.jpg' it's a cat with 'Faker' text. Default, `null`. + +### `Faker\Provider\Uuid` + + uuid // '7e57d004-2b97-0e7a-b45f-5387367791cd' + +### `Faker\Provider\Barcode` + + ean13 // '4006381333931' + ean8 // '73513537' + isbn13 // '9790404436093' + isbn10 // '4881416324' + +### `Faker\Provider\Miscellaneous` + + boolean // false + boolean($chanceOfGettingTrue = 50) // true + md5 // 'de99a620c50f2990e87144735cd357e7' + sha1 // 'f08e7f04ca1a413807ebc47551a40a20a0b4de5c' + sha256 // '0061e4c60dac5c1d82db0135a42e00c89ae3a333e7c26485321f24348c7e98a5' + locale // en_UK + countryCode // UK + languageCode // en + currencyCode // EUR + emoji // 😠+ +### `Faker\Provider\Biased` + + // get a random number between 10 and 20, + // with more chances to be close to 20 + biasedNumberBetween($min = 10, $max = 20, $function = 'sqrt') + +### `Faker\Provider\HtmlLorem` + + //Generate HTML document which is no more than 2 levels deep, and no more than 3 elements wide at any level. + randomHtml(2,3) // Aut illo dolorem et accusantium eum.
Id aut saepe non mollitia voluptas voluptas.Non consequatur.Incidunt est.Aut voluptatem.Officia voluptas rerum quo.Asperiores similique.
Sapiente dolorum dolorem sint laboriosam commodi qui.Commodi nihil nesciunt eveniet quo repudiandae.Voluptates explicabo numquam distinctio necessitatibus repellat.Provident ut doloremque nam eum modi aspernatur.Iusto inventore.
Animi nihil ratione id mollitia libero ipsa quia tempore.Velit est officia et aut tenetur dolorem sed mollitia expedita.Modi modi repudiandae pariatur voluptas rerum ea incidunt non molestiae eligendi eos deleniti.Exercitationem voluptatibus dolor est iste quod molestiae.Quia reiciendis.
Inventore impedit exercitationem voluptatibus rerum cupiditate.Qui.Aliquam.Autem nihil aut et.Dolor ut quia error.
Enim facilis iusto earum et minus rerum assumenda quis quia.Reprehenderit ut sapiente occaecati voluptatum dolor voluptatem vitae qui velit.Quod fugiat non.Sunt nobis totam mollitia sed nesciunt est deleniti cumque.Repudiandae quo.
Modi dicta libero quisquam doloremque qui autem.Voluptatem aliquid saepe laudantium facere eos sunt dolor.Est eos quis laboriosam officia expedita repellendus quia natus.Et neque delectus quod fugit enim repudiandae qui.Fugit soluta sit facilis facere repellat culpa magni voluptatem maiores tempora.
Enim dolores doloremque.Assumenda voluptatem eum perferendis exercitationem.Quasi in fugit deserunt ea perferendis sunt nemo consequatur dolorum soluta.Maxime repellat qui numquam voluptatem est modi.Alias rerum rerum hic hic eveniet.
Tempore voluptatem.Eaque.Et sit quas fugit iusto.Nemo nihil rerum dignissimos et esse.Repudiandae ipsum numquam.
Nemo sunt quia.Sint tempore est neque ducimus harum sed.Dicta placeat atque libero nihil.Et qui aperiam temporibus facilis eum.Ut dolores qui enim et maiores nesciunt.
Dolorum totam sint debitis saepe laborum.Quidem corrupti ea.Cum voluptas quod.Possimus consequatur quasi dolorem ut et.Et velit non hic labore repudiandae quis.
+ +## Modifiers + +Faker provides three special providers, `unique()`, `optional()`, and `valid()`, to be called before any provider. + +```php +// unique() forces providers to return unique values +$values = array(); +for ($i=0; $i < 10; $i++) { + // get a random digit, but always a new one, to avoid duplicates + $values []= $faker->unique()->randomDigit; +} +print_r($values); // [4, 1, 8, 5, 0, 2, 6, 9, 7, 3] + +// providers with a limited range will throw an exception when no new unique value can be generated +$values = array(); +try { + for ($i=0; $i < 10; $i++) { + $values []= $faker->unique()->randomDigitNotNull; + } +} catch (\OverflowException $e) { + echo "There are only 9 unique digits not null, Faker can't generate 10 of them!"; +} + +// you can reset the unique modifier for all providers by passing true as first argument +$faker->unique($reset = true)->randomDigitNotNull; // will not throw OverflowException since unique() was reset +// tip: unique() keeps one array of values per provider + +// optional() sometimes bypasses the provider to return a default value instead (which defaults to NULL) +$values = array(); +for ($i=0; $i < 10; $i++) { + // get a random digit, but also null sometimes + $values []= $faker->optional()->randomDigit; +} +print_r($values); // [1, 4, null, 9, 5, null, null, 4, 6, null] + +// optional() accepts a weight argument to specify the probability of receiving the default value. +// 0 will always return the default value; 1 will always return the provider. Default weight is 0.5 (50% chance). +$faker->optional($weight = 0.1)->randomDigit; // 90% chance of NULL +$faker->optional($weight = 0.9)->randomDigit; // 10% chance of NULL + +// optional() accepts a default argument to specify the default value to return. +// Defaults to NULL. +$faker->optional($weight = 0.5, $default = false)->randomDigit; // 50% chance of FALSE +$faker->optional($weight = 0.9, $default = 'abc')->word; // 10% chance of 'abc' + +// valid() only accepts valid values according to the passed validator functions +$values = array(); +$evenValidator = function($digit) { + return $digit % 2 === 0; +}; +for ($i=0; $i < 10; $i++) { + $values []= $faker->valid($evenValidator)->randomDigit; +} +print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6] + +// just like unique(), valid() throws an overflow exception when it can't generate a valid value +$values = array(); +try { + $faker->valid($evenValidator)->randomElement(1, 3, 5, 7, 9); +} catch (\OverflowException $e) { + echo "Can't pick an even number in that set!"; +} +``` + +If you would like to use a modifier with a value not generated by Faker, use the `passthrough()` method. `passthrough()` simply returns whatever value it was given. + +```php +$faker->optional()->passthrough(mt_rand(5, 15)); +``` + +## Localization + +`Faker\Factory` can take a locale as an argument, to return localized data. If no localized provider is found, the factory fallbacks to the default locale (en_US). + +```php +name, "\n"; +} + // Luce du Coulon + // Auguste Dupont + // Roger Le Voisin + // Alexandre Lacroix + // Jacques Humbert-Roy + // Thérèse Guillet-Andre + // Gilles Gros-Bodin + // Amélie Pires + // Marcel Laporte + // Geneviève Marchal +``` + +You can check available Faker locales in the source code, [under the `Provider` directory](https://github.com/fzaninotto/Faker/tree/master/src/Faker/Provider). The localization of Faker is an ongoing process, for which we need your help. Don't hesitate to create localized providers to your own locale and submit a PR! + +## Populating Entities Using an ORM or an ODM + +Faker provides adapters for Object-Relational and Object-Document Mappers (currently, [Propel](http://www.propelorm.org), [Doctrine2](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/), [CakePHP](http://cakephp.org), [Spot2](https://github.com/vlucas/spot2), [Mandango](https://github.com/mandango/mandango) and [Eloquent](https://laravel.com/docs/master/eloquent) are supported). These adapters ease the population of databases through the Entity classes provided by an ORM library (or the population of document stores using Document classes provided by an ODM library). + +To populate entities, create a new populator class (using a generator instance as parameter), then list the class and number of all the entities that must be generated. To launch the actual data population, call the `execute()` method. + +Here is an example showing how to populate 5 `Author` and 10 `Book` objects: + +```php +addEntity('Author', 5); +$populator->addEntity('Book', 10); +$insertedPKs = $populator->execute(); +``` + +The populator uses name and column type guessers to populate each column with relevant data. For instance, Faker populates a column named `first_name` using the `firstName` formatter, and a column with a `TIMESTAMP` type using the `dateTime` formatter. The resulting entities are therefore coherent. If Faker misinterprets a column name, you can still specify a custom closure to be used for populating a particular column, using the third argument to `addEntity()`: + +```php +addEntity('Book', 5, array( + 'ISBN' => function() use ($generator) { return $generator->ean13(); } +)); +``` + +In this example, Faker will guess a formatter for all columns except `ISBN`, for which the given anonymous function will be used. + +**Tip**: To ignore some columns, specify `null` for the column names in the third argument of `addEntity()`. This is usually necessary for columns added by a behavior: + +```php +addEntity('Book', 5, array( + 'CreatedAt' => null, + 'UpdatedAt' => null, +)); +``` + +Of course, Faker does not populate autoincremented primary keys. In addition, `Faker\ORM\Propel\Populator::execute()` returns the list of inserted PKs, indexed by class: + +```php + (34, 35, 36, 37, 38), +// 'Book' => (456, 457, 458, 459, 470, 471, 472, 473, 474, 475) +// ) +``` + +In the previous example, the `Book` and `Author` models share a relationship. Since `Author` entities are populated first, Faker is smart enough to relate the populated `Book` entities to one of the populated `Author` entities. + +Lastly, if you want to execute an arbitrary function on an entity before insertion, use the fourth argument of the `addEntity()` method: + +```php +addEntity('Book', 5, array(), array( + function($book) { $book->publish(); }, +)); +``` + +## Seeding the Generator + +You may want to get always the same generated data - for instance when using Faker for unit testing purposes. The generator offers a `seed()` method, which seeds the random number generator. Calling the same script twice with the same seed produces the same results. + +```php +seed(1234); + +echo $faker->name; // 'Jess Mraz I'; +``` + +> **Tip**: DateTime formatters won't reproduce the same fake data if you don't fix the `$max` value: +> +> ```php +> // even when seeded, this line will return different results because $max varies +> $faker->dateTime(); // equivalent to $faker->dateTime($max = 'now') +> // make sure you fix the $max parameter +> $faker->dateTime('2014-02-25 08:37:17'); // will return always the same date when seeded +> ``` +> +> **Tip**: Formatters won't reproduce the same fake data if you use the `rand()` php function. Use `$faker` or `mt_rand()` instead: +> +> ```php +> // bad +> $faker->realText(rand(10,20)); +> // good +> $faker->realText($faker->numberBetween(10,20)); +> ``` + + + +## Faker Internals: Understanding Providers + +A `Faker\Generator` alone can't do much generation. It needs `Faker\Provider` objects to delegate the data generation to them. `Faker\Factory::create()` actually creates a `Faker\Generator` bundled with the default providers. Here is what happens under the hood: + +```php +addProvider(new Faker\Provider\en_US\Person($faker)); +$faker->addProvider(new Faker\Provider\en_US\Address($faker)); +$faker->addProvider(new Faker\Provider\en_US\PhoneNumber($faker)); +$faker->addProvider(new Faker\Provider\en_US\Company($faker)); +$faker->addProvider(new Faker\Provider\Lorem($faker)); +$faker->addProvider(new Faker\Provider\Internet($faker)); +```` + +Whenever you try to access a property on the `$faker` object, the generator looks for a method with the same name in all the providers attached to it. For instance, calling `$faker->name` triggers a call to `Faker\Provider\Person::name()`. And since Faker starts with the last provider, you can easily override existing formatters: just add a provider containing methods named after the formatters you want to override. + +That means that you can easily add your own providers to a `Faker\Generator` instance. A provider is usually a class extending `\Faker\Provider\Base`. This parent class allows you to use methods like `lexify()` or `randomNumber()`; it also gives you access to formatters of other providers, through the protected `$generator` property. The new formatters are the public methods of the provider class. + +Here is an example provider for populating Book data: + +```php +generator->sentence($nbWords); + return substr($sentence, 0, strlen($sentence) - 1); + } + + public function ISBN() + { + return $this->generator->ean13(); + } +} +``` + +To register this provider, just add a new instance of `\Faker\Provider\Book` to an existing generator: + +```php +addProvider(new \Faker\Provider\Book($faker)); +``` + +Now you can use the two new formatters like any other Faker formatter: + +```php +setTitle($faker->title); +$book->setISBN($faker->ISBN); +$book->setSummary($faker->text); +$book->setPrice($faker->randomNumber(2)); +``` + +**Tip**: A provider can also be a Plain Old PHP Object. In that case, all the public methods of the provider become available to the generator. + +## Real Life Usage + +The following script generates a valid XML document: + +```php + + + + + + +boolean(25)): ?> + + +
+ streetAddress ?> + city ?> + postcode ?> + state ?> +
+ +boolean(33)): ?> + bs ?> + +boolean(33)): ?> + + + +boolean(15)): ?> +
+text(400) ?> +]]> +
+ +
+ +
+``` + +Running this script produces a document looking like: + +```xml + + + + +
+ 182 Harrison Cove + North Lloyd + 45577 + Alabama +
+ + orchestrate compelling web-readiness + +
+ +
+
+ + +
+ 90111 Hegmann Inlet + South Geovanymouth + 69961-9311 + Colorado +
+ + +
+ + +
+ 9791 Nona Corner + Harberhaven + 74062-8191 + RhodeIsland +
+ + +
+ + +
+ 11161 Schultz Via + Feilstad + 98019 + NewJersey +
+ + + +
+ +
+
+ + +
+ 6106 Nader Village Suite 753 + McLaughlinstad + 43189-8621 + Missouri +
+ + expedite viral synergies + + +
+ + +
+ 7546 Kuvalis Plaza + South Wilfrid + 77069 + Georgia +
+ + +
+ + + +
+ 478 Daisha Landing Apt. 510 + West Lizethhaven + 30566-5362 + WestVirginia +
+ + orchestrate dynamic networks + + +
+ +
+
+ + +
+ 1251 Koelpin Mission + North Revastad + 81620 + Maryland +
+ + +
+ + +
+ 6396 Langworth Hills Apt. 446 + New Carlos + 89399-0268 + Wyoming +
+ + + +
+ + + +
+ 2246 Kreiger Station Apt. 291 + Kaydenmouth + 11397-1072 + Wyoming +
+ + grow sticky portals + +
+ +
+
+
+``` + +## Language specific formatters + +### `Faker\Provider\ar_SA\Person` + +```php +idNumber; // ID number +echo $faker->nationalIdNumber // Citizen ID number +echo $faker->foreignerIdNumber // Foreigner ID number +echo $faker->companyIdNumber // Company ID number +``` + +### `Faker\Provider\ar_SA\Payment` + +```php +bankAccountNumber // "SA0218IBYZVZJSEC8536V4XC" +``` + +### `Faker\Provider\at_AT\Payment` + +```php +vat; // "AT U12345678" - Austrian Value Added Tax number +echo $faker->vat(false); // "ATU12345678" - unspaced Austrian Value Added Tax number +``` + +### `Faker\Provider\bg_BG\Payment` + +```php +vat; // "BG 0123456789" - Bulgarian Value Added Tax number +echo $faker->vat(false); // "BG0123456789" - unspaced Bulgarian Value Added Tax number +``` + +### `Faker\Provider\cs_CZ\Address` + +```php +region; // "Liberecký kraj" +``` + +### `Faker\Provider\cs_CZ\Company` + +```php +ico; // "69663963" +``` + +### `Faker\Provider\cs_CZ\DateTime` + +```php +monthNameGenitive; // "prosince" +echo $faker->formattedDate; // "12. listopadu 2015" +``` + +### `Faker\Provider\cs_CZ\Person` + +```php +birthNumber; // "7304243452" +``` + +### `Faker\Provider\da_DK\Person` + +```php +cpr; // "051280-2387" +``` + +### `Faker\Provider\da_DK\Address` + +```php +kommune; // "Frederiksberg" + +// Generates a random region name +echo $faker->region; // "Region Sjælland" +``` + +### `Faker\Provider\da_DK\Company` + +```php +cvr; // "32458723" + +// Generates a random P number +echo $faker->p; // "5398237590" +``` + +### `Faker\Provider\de_DE\Payment` + +```php +bankAccountNumber; // "DE41849025553661169313" +echo $faker->bank; // "Volksbank Stuttgart" + +``` + +### `Faker\Provider\en_HK\Address` + +```php +town; // "Yuen Long" + +// Generates a fake village name based on the words commonly found in Hong Kong +echo $faker->village; // "O Tau" + +// Generates a fake estate name based on the words commonly found in Hong Kong +echo $faker->estate; // "Ching Lai Court" + +``` + +### `Faker\Provider\en_HK\Phone` + +```php +mobileNumber; // "92150087" + +// Generates a Hong Kong landline number (starting with 2 or 3) +echo $faker->landlineNumber; // "32750132" + +// Generates a Hong Kong fax number (starting with 7) +echo $faker->faxNumber; // "71937729" + +``` + +### `Faker\Provider\en_NG\Address` + +```php +region; // 'Katsina' +``` + +### `Faker\Provider\en_NG\Person` + +```php +name; // 'Oluwunmi Mayowa' +``` + +### `Faker\Provider\en_NZ\Phone` + +```php +cellNumber; // "021 123 4567" + +// Generates a toll free number +echo $faker->tollFreeNumber; // "0800 123 456" + +// Area Code +echo $faker->areaCode; // "03" +``` + +### `Faker\Provider\en_US\Company` + +```php +ein; // '12-3456789' +``` + +### `Faker\Provider\en_US\Payment` + +```php +bankAccountNumber; // '51915734310' +echo $faker->bankRoutingNumber; // '212240302' +``` + +### `Faker\Provider\en_US\Person` + +```php +ssn; // '123-45-6789' +``` + +### `Faker\Provider\en_ZA\Company` + +```php +companyNumber; // 1999/789634/01 +``` + +### `Faker\Provider\en_ZA\Person` + +```php +idNumber; // 6606192211041 + +// Generates a random valid licence code +echo $faker->licenceCode; // EB +``` + +### `Faker\Provider\en_ZA\PhoneNumber` + +```php +tollFreeNumber; // 0800 555 5555 + +// Generates a mobile phone number +echo $faker->mobileNumber; // 082 123 5555 +``` + +### `Faker\Provider\es_ES\Person` + +```php +dni; // '77446565E' + +// Generates a random valid licence code +echo $faker->licenceCode; // B +``` + +### `Faker\Provider\es_ES\Payment` + +```php +vat; // "A35864370" +``` + +### `Faker\Provider\es_PE\Person` + +```php +dni; // '83367512' +``` + +### `Faker\Provider\fa_IR\Address` + +```php +building; // "ساختمان Ø¢Ùتاب" + +// Returns a random city name +echo $faker->city // "استان زنجان" +``` + +### `Faker\Provider\fa_IR\Company` + +```php +contract; // "رسمی" +``` + +### `Faker\Provider\fi_FI\Payment` + +```php +bankAccountNumber; // "FI8350799879879616" +``` + +### `Faker\Provider\fi_FI\Person` + +```php +personalIdentityNumber() // '170974-007J' + +//Since the numbers are different for male and female persons, optionally you can specify gender. +echo $faker->personalIdentityNumber(\DateTime::createFromFormat('Y-m-d', '2015-12-14'), 'female') // '141215A520B' +``` + +### `Faker\Provider\fr_BE\Payment` + +```php +vat; // "BE 0123456789" - Belgian Value Added Tax number +echo $faker->vat(false); // "BE0123456789" - unspaced Belgian Value Added Tax number +``` + +### `Faker\Provider\es_VE\Person` + +```php +nationalId; // 'V11223344' +``` + +### `Faker\Provider\es_VE\Company` + +```php +taxpayerIdentificationNumber; // 'J1234567891' +``` + +### `Faker\Provider\fr_FR\Address` + +```php +departmentName; // "Haut-Rhin" + +// Generates a random department number +echo $faker->departmentNumber; // "2B" + +// Generates a random department info (department number => department name) +$faker->department; // array('18' => 'Cher'); + +// Generates a random region +echo $faker->region; // "Saint-Pierre-et-Miquelon" + +// Generates a random appartement,stair +echo $faker->secondaryAddress; // "Bat. 961" +``` + +### `Faker\Provider\fr_FR\Company` + +```php +siren; // 082 250 104 + +// Generates a random SIRET number +echo $faker->siret; // 347 355 708 00224 +``` + +### `Faker\Provider\fr_FR\Payment` + +```php +vat; // FR 12 123 456 789 +``` + +### `Faker\Provider\fr_FR\Person` + +```php +nir; // 1 88 07 35 127 571 - 19 +``` + +### `Faker\Provider\fr_FR\PhoneNumber` + +```php +phoneNumber; // +33 (0)1 67 97 01 31 +echo $faker->mobileNumber; // +33 6 21 12 72 84 +echo $faker->serviceNumber // 08 98 04 84 46 +``` + + +### `Faker\Provider\he_IL\Payment` + +```php +bankAccountNumber // "IL392237392219429527697" +``` + +### `Faker\Provider\hr_HR\Payment` + +```php +bankAccountNumber // "HR3789114847226078672" +``` + +### `Faker\Provider\hu_HU\Payment` + +```php +bankAccountNumber; // "HU09904437680048220079300783" +``` + +### `Faker\Provider\id_ID\Person` + +```php +nik(); // "8522246001570940" +``` + +### `Faker\Provider\it_IT\Company` + +```php +vatId(); // "IT98746784967" +``` + +### `Faker\Provider\it_IT\Person` + +```php +taxId(); // "DIXDPZ44E08F367A" +``` + +### `Faker\Provider\ja_JP\Person` + +```php +kanaName($gender = null|'male'|'female') // "アオタ ミノル" + +// Generates a 'kana' first name +echo $faker->firstKanaName($gender = null|'male'|'female') // "ヒデキ" + +// Generates a 'kana' first name on the male +echo $faker->firstKanaNameMale // "ヒデキ" + +// Generates a 'kana' first name on the female +echo $faker->firstKanaNameFemale // "マアヤ" + +// Generates a 'kana' last name +echo $faker->lastKanaName; // "ナカジマ" +``` + +### `Faker\Provider\ka_GE\Payment` + +```php +bankAccountNumber; // "GE33ZV9773853617253389" +``` + +### `Faker\Provider\kk_KZ\Company` + +```php +businessIdentificationNumber; // "150140000019" +``` + +### `Faker\Provider\kk_KZ\Payment` + +```php +bank; // "Қазкоммерцбанк" + +// Generates a random bank account number +echo $faker->bankAccountNumber; // "KZ1076321LO4H6X41I37" +``` + +### `Faker\Provider\kk_KZ\Person` + +```php +individualIdentificationNumber; // "780322300455" + +// Generates an individual identification number based on his/her birth date +echo $faker->individualIdentificationNumber(new \DateTime('1999-03-01')); // "990301300455" +``` + +### `Faker\Provider\ko_KR\Address` + +```php +metropolitanCity; // "서울특별시" + +// Generates a borough +echo $faker->borough; // "강남구" +``` + +### `Faker\Provider\ko_KR\PhoneNumber` + +```php +localAreaPhoneNumber; // "02-1234-4567" + +// Generates a cell phone number +echo $faker->cellPhoneNumber; // "010-9876-5432" +``` + +### `Faker\Provider\lt_LT\Payment` + +```php +bankAccountNumber // "LT300848876740317118" +``` + +### `Faker\Provider\lv_LV\Person` + +```php +personalIdentityNumber; // "140190-12301" +``` + +### `Faker\Provider\ms_MY\Address` + +```php +township; // "Taman Bahagia" + +// Generates a random Malaysian town address with matching postcode and state +echo $faker->townState; // "55100 Bukit Bintang, Kuala Lumpur" +``` + +### `Faker\Provider\ms_MY\Miscellaneous` + +```php +jpjNumberPlate; // "WPL 5169" +``` + +### `Faker\Provider\ms_MY\Payment` + +```php +bank; // "Maybank" + +// Generates a random Malaysian bank account number (10-16 digits) +echo $faker->bankAccountNumber; // "1234567890123456" + +// Generates a random Malaysian insurance company +echo $faker->insurance; // "AIA Malaysia" + +// Generates a random Malaysian bank SWIFT Code +echo $faker->swiftCode; // "MBBEMYKLXXX" +``` + +### `Faker\Provider\ms_MY\Person` + +```php +myKadNumber($gender = null|'male'|'female', $hyphen = null|true|false); // "710703471796" +``` + +### `Faker\Provider\ms_MY\PhoneNumber` + +```php +mobileNumber($countryCodePrefix = null|true|false, $formatting = null|true|false); // "+6012-705 3767" + +// Generates a random Malaysian landline number +echo $faker->fixedLineNumber($countryCodePrefix = null|true|false, $formatting = null|true|false); // "03-7112 0455" + +// Generates a random Malaysian voip number +echo $faker->voipNumber($countryCodePrefix = null|true|false, $formatting = null|true|false); // "015-458 7099" +``` + +### `Faker\Provider\ne_NP\Address` + +```php +district; + +//Generates a Nepali city name +echo $faker->cityName; +``` + +### `Faker\Provider\nl_BE\Payment` + +```php +vat; // "BE 0123456789" - Belgian Value Added Tax number +echo $faker->vat(false); // "BE0123456789" - unspaced Belgian Value Added Tax number +``` + +### `Faker\Provider\nl_BE\Person` + +```php +rrn(); // "83051711784" - Belgian Rijksregisternummer +echo $faker->rrn('female'); // "50032089858" - Belgian Rijksregisternummer for a female +``` + +### `Faker\Provider\nl_NL\Company` + +```php +vat; // "NL123456789B01" - Dutch Value Added Tax number +echo $faker->btw; // "NL123456789B01" - Dutch Value Added Tax number (alias) +``` + +### `Faker\Provider\nl_NL\Person` + +```php +idNumber; // "111222333" - Dutch Personal identification number (BSN) +``` + +### `Faker\Provider\nb_NO\Payment` + +```php +bankAccountNumber; // "NO3246764709816" +``` + +### `Faker\Provider\pl_PL\Person` + +```php +pesel; // "40061451555" +// Generates a random personal identity card number +echo $faker->personalIdentityNumber; // "AKX383360" +// Generates a random taxpayer identification number (NIP) +echo $faker->taxpayerIdentificationNumber; // '8211575109' +``` + +### `Faker\Provider\pl_PL\Company` + +```php +regon; // "714676680" +// Generates a random local REGON number +echo $faker->regonLocal; // "15346111382836" +``` + +### `Faker\Provider\pl_PL\Payment` + +```php +bank; // "Narodowy Bank Polski" +// Generates a random bank account number +echo $faker->bankAccountNumber; // "PL14968907563953822118075816" +``` + +### `Faker\Provider\pt_PT\Person` + +```php +taxpayerIdentificationNumber; // '165249277' +``` + +### `Faker\Provider\pt_BR\Address` + +```php +region; // 'Nordeste' + +// Generates a random region abbreviation +echo $faker->regionAbbr; // 'NE' +``` + +### `Faker\Provider\pt_BR\PhoneNumber` + +```php +areaCode; // 21 +echo $faker->cellphone; // 9432-5656 +echo $faker->landline; // 2654-3445 +echo $faker->phone; // random landline, 8-digit or 9-digit cellphone number + +// Using the phone functions with a false argument returns unformatted numbers +echo $faker->cellphone(false); // 74336667 + +// cellphone() has a special second argument to add the 9th digit. Ignored if generated a Radio number +echo $faker->cellphone(true, true); // 98983-3945 or 7343-1290 + +// Using the "Number" suffix adds area code to the phone +echo $faker->cellphoneNumber; // (11) 98309-2935 +echo $faker->landlineNumber(false); // 3522835934 +echo $faker->phoneNumber; // formatted, random landline or cellphone (obeying the 9th digit rule) +echo $faker->phoneNumberCleared; // not formatted, random landline or cellphone (obeying the 9th digit rule) +``` + +### `Faker\Provider\pt_BR\Person` + +```php +name; // 'Sr. Luis Adriano Sepúlveda Filho' + +// Valid document generators have a boolean argument to remove formatting +echo $faker->cpf; // '145.343.345-76' +echo $faker->cpf(false); // '45623467866' +echo $faker->rg; // '84.405.736-3' +echo $faker->rg(false); // '844057363' +``` + +### `Faker\Provider\pt_BR\Company` + +```php +cnpj; // '23.663.478/0001-24' +echo $faker->cnpj(false); // '23663478000124' +``` + +### `Faker\Provider\ro_MD\Payment` + +```php +bankAccountNumber; // "MD83BQW1CKMUW34HBESDP3A8" +``` + +### `Faker\Provider\ro_RO\Payment` + +```php +bankAccountNumber; // "RO55WRJE3OE8X3YQI7J26U1E" +``` + +### `Faker\Provider\ro_RO\Person` + +```php +prefixMale; // "ing." +// Generates a random female name prefix/title +echo $faker->prefixFemale; // "d-na." +// Generates a random male first name +echo $faker->firstNameMale; // "Adrian" +// Generates a random female first name +echo $faker->firstNameFemale; // "Miruna" + + +// Generates a random Personal Numerical Code (CNP) +echo $faker->cnp; // "2800523081231" +// Valid option values: +// $gender: null (random), male, female +// $dateOfBirth (1800+): null (random), Y-m-d, Y-m (random day), Y (random month and day) +// i.e. '1981-06-16', '2015-03', '1900' +// $county: 2 letter ISO 3166-2:RO county codes and B1, B2, B3, B4, B5, B6 for Bucharest's 6 sectors +// $isResident true/false flag if the person resides in Romania +echo $faker->cnp($gender = null, $dateOfBirth = null, $county = null, $isResident = true); + +``` + +### `Faker\Provider\ro_RO\PhoneNumber` + +```php +tollFreePhoneNumber; // "0800123456" +// Generates a random premium-rate phone number +echo $faker->premiumRatePhoneNumber; // "0900123456" +``` + +### `Faker\Provider\ru_RU\Payment` + +```php +bank; // "ОТП Банк" + +//Generate a Russian Tax Payment Number for Company +echo $faker->inn; // 7813540735 + +//Generate a Russian Tax Code for Company +echo $faker->kpp; // 781301001 +``` + +### `Faker\Provider\sv_SE\Payment` + +```php +bankAccountNumber; // "SE5018548608468284909192" +``` + +### `Faker\Provider\sv_SE\Person` + +```php +personalIdentityNumber() // '950910-0799' + +//Since the numbers are different for male and female persons, optionally you can specify gender. +echo $faker->personalIdentityNumber('female') // '950910-0781' +``` +### `Faker\Provider\tr_TR\Person` + +```php +tcNo // '55300634882' + +``` + + +### `Faker\Provider\zh_CN\Payment` + +```php +bank; // '中国建设银行' +``` + +### `Faker\Provider\uk_UA\Payment` + +```php +bank; // "Ощадбанк" +``` + +### `Faker\Provider\zh_TW\Person` + +```php +personalIdentityNumber; // A223456789 +``` + +### `Faker\Provider\zh_TW\Company` + +```php +VAT; //23456789 +``` + + +## Third-Party Libraries Extending/Based On Faker + +* Symfony2 bundles: + * [BazingaFakerBundle](https://github.com/willdurand/BazingaFakerBundle): Put the awesome Faker library into the Symfony2 DIC and populate your database with fake data. + * [AliceBundle](https://github.com/hautelook/AliceBundle), [AliceFixturesBundle](https://github.com/h4cc/AliceFixturesBundle): Bundles for using [Alice](https://packagist.org/packages/nelmio/alice) and Faker with data fixtures. Able to use Doctrine ORM as well as Doctrine MongoDB ODM. +* [FakerServiceProvider](https://github.com/EmanueleMinotto/FakerServiceProvider): Faker Service Provider for Silex +* [faker-cli](https://github.com/bit3/faker-cli): Command Line Tool for the Faker PHP library +* [Factory Muffin](https://github.com/thephpleague/factory-muffin): enable the rapid creation of objects (PHP port of factory-girl) +* [CompanyNameGenerator](https://github.com/fzaninotto/CompanyNameGenerator): Generate names for English tech companies with class +* [PlaceholdItProvider](https://github.com/EmanueleMinotto/PlaceholdItProvider): Generate images using placehold.it +* [datalea](https://github.com/spyrit/datalea) A highly customizable random test data generator web app +* [newage-ipsum](https://github.com/frequenc1/newage-ipsum): A new aged ipsum provider for the faker library inspired by http://sebpearce.com/bullshit/ +* [xml-faker](https://github.com/prewk/xml-faker): Create fake XML with Faker +* [faker-context](https://github.com/denheck/faker-context): Behat context using Faker to generate testdata +* [CronExpressionGenerator](https://github.com/swekaj/CronExpressionGenerator): Faker provider for generating random, valid cron expressions. +* [pragmafabrik/Pomm2Faker](https://github.com/pragmafabrik/Pomm2Faker): Faker client for Pomm database framework (PostgreSQL) +* [nelmio/alice](https://packagist.org/packages/nelmio/alice): Fixtures/object generator with a yaml DSL that can use Faker as data generator. +* [CakePHP 2.x Fake Seeder Plugin](https://github.com/ravage84/cakephp-fake-seeder) A CakePHP 2.x shell to seed your database with fake and/or fixed data. +* [images-generator](https://github.com/bruceheller/images-generator): An image generator provider using GD for placeholder type pictures +* [pattern-lab/plugin-php-faker](https://github.com/pattern-lab/plugin-php-faker): Pattern Lab is a Styleguide, Component Library, and Prototyping tool. This creates unique content each time Pattern Lab is generated. +* [guidocella/eloquent-populator](https://github.com/guidocella/eloquent-populator): Adapter for Laravel's Eloquent ORM. +* [tamperdata/exiges](https://github.com/tamperdata/exiges): Faker provider for generating random temperatures +* [jzonta/FakerRestaurant](https://github.com/jzonta/FakerRestaurant): Faker for Food and Beverage names generate +* [aalaap/faker-youtube](https://github.com/aalaap/faker-youtube): Faker for YouTube URLs in various formats +* [pelmered/fake-car](https://github.com/pelmered/fake-car): Faker for cars and car data + +## License + +Faker is released under the MIT Licence. See the bundled LICENSE file for details. diff --git a/vendor/fzaninotto/faker/src/Faker/Calculator/Iban.php b/vendor/fzaninotto/faker/src/Faker/Calculator/Iban.php new file mode 100644 index 0000000..8a58231 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Calculator/Iban.php @@ -0,0 +1,73 @@ + 2, 2 => 4, 3 => 10, 4 => 3, 5 => 5, 6 => 9, 7 => 4, 8 => 6, 9 => 8); + $sum = 0; + for ($i = 1; $i <= 9; $i++) { + $sum += intval(substr($inn, $i-1, 1)) * $multipliers[$i]; + } + return strval(($sum % 11) % 10); + } + + /** + * Checks whether an INN has a valid checksum + * + * @param string $inn + * @return boolean + */ + public static function isValid($inn) + { + return self::checksum(substr($inn, 0, -1)) === substr($inn, -1, 1); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Calculator/Luhn.php b/vendor/fzaninotto/faker/src/Faker/Calculator/Luhn.php new file mode 100644 index 0000000..c37c6c1 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Calculator/Luhn.php @@ -0,0 +1,75 @@ += 0; $i -= 2) { + $sum += $number{$i}; + } + for ($i = $length - 2; $i >= 0; $i -= 2) { + $sum += array_sum(str_split($number{$i} * 2)); + } + + return $sum % 10; + } + + /** + * @param $partialNumber + * @return string + */ + public static function computeCheckDigit($partialNumber) + { + $checkDigit = self::checksum($partialNumber . '0'); + if ($checkDigit === 0) { + return 0; + } + + return (string) (10 - $checkDigit); + } + + /** + * Checks whether a number (partial number + check digit) is Luhn compliant + * + * @param string $number + * @return bool + */ + public static function isValid($number) + { + return self::checksum($number) === 0; + } + + /** + * Generate a Luhn compliant number. + * + * @param string $partialValue + * + * @return string + */ + public static function generateLuhnNumber($partialValue) + { + if (!preg_match('/^\d+$/', $partialValue)) { + throw new InvalidArgumentException('Argument should be an integer.'); + } + return $partialValue . Luhn::computeCheckDigit($partialValue); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Calculator/TCNo.php b/vendor/fzaninotto/faker/src/Faker/Calculator/TCNo.php new file mode 100644 index 0000000..392d455 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Calculator/TCNo.php @@ -0,0 +1,52 @@ + $digit) { + if ($index % 2 == 0) { + $evenSum += $digit; + } else { + $oddSum += $digit; + } + } + + $tenthDigit = (7 * $evenSum - $oddSum) % 10; + $eleventhDigit = ($evenSum + $oddSum + $tenthDigit) % 10; + + return $tenthDigit . $eleventhDigit; + } + + /** + * Checks whether an TCNo has a valid checksum + * + * @param string $tcNo + * @return boolean + */ + public static function isValid($tcNo) + { + return self::checksum(substr($tcNo, 0, -2)) === substr($tcNo, -2, 2); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/DefaultGenerator.php b/vendor/fzaninotto/faker/src/Faker/DefaultGenerator.php new file mode 100644 index 0000000..eafd2ec --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/DefaultGenerator.php @@ -0,0 +1,38 @@ +optional(). + */ +class DefaultGenerator +{ + protected $default; + + public function __construct($default = null) + { + $this->default = $default; + } + + /** + * @param string $attribute + * + * @return mixed + */ + public function __get($attribute) + { + return $this->default; + } + + /** + * @param string $method + * @param array $attributes + * + * @return mixed + */ + public function __call($method, $attributes) + { + return $this->default; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Documentor.php b/vendor/fzaninotto/faker/src/Faker/Documentor.php new file mode 100644 index 0000000..e42bdf4 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Documentor.php @@ -0,0 +1,66 @@ +generator = $generator; + } + + /** + * @return array + */ + public function getFormatters() + { + $formatters = array(); + $providers = array_reverse($this->generator->getProviders()); + $providers[]= new Provider\Base($this->generator); + foreach ($providers as $provider) { + $providerClass = get_class($provider); + $formatters[$providerClass] = array(); + $refl = new \ReflectionObject($provider); + foreach ($refl->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflmethod) { + if ($reflmethod->getDeclaringClass()->getName() == 'Faker\Provider\Base' && $providerClass != 'Faker\Provider\Base') { + continue; + } + $methodName = $reflmethod->name; + if ($reflmethod->isConstructor()) { + continue; + } + $parameters = array(); + foreach ($reflmethod->getParameters() as $reflparameter) { + $parameter = '$'. $reflparameter->getName(); + if ($reflparameter->isDefaultValueAvailable()) { + $parameter .= ' = ' . var_export($reflparameter->getDefaultValue(), true); + } + $parameters []= $parameter; + } + $parameters = $parameters ? '('. join(', ', $parameters) . ')' : ''; + try { + $example = $this->generator->format($methodName); + } catch (\InvalidArgumentException $e) { + $example = ''; + } + if (is_array($example)) { + $example = "array('". join("', '", $example) . "')"; + } elseif ($example instanceof \DateTime) { + $example = "DateTime('" . $example->format('Y-m-d H:i:s') . "')"; + } elseif ($example instanceof Generator || $example instanceof UniqueGenerator) { // modifier + $example = ''; + } else { + $example = var_export($example, true); + } + $formatters[$providerClass][$methodName . $parameters] = $example; + } + } + + return $formatters; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Factory.php b/vendor/fzaninotto/faker/src/Faker/Factory.php new file mode 100644 index 0000000..1d68781 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Factory.php @@ -0,0 +1,61 @@ +addProvider(new $providerClassName($generator)); + } + + return $generator; + } + + /** + * @param string $provider + * @param string $locale + * @return string + */ + protected static function getProviderClassname($provider, $locale = '') + { + if ($providerClass = self::findProviderClassname($provider, $locale)) { + return $providerClass; + } + // fallback to default locale + if ($providerClass = self::findProviderClassname($provider, static::DEFAULT_LOCALE)) { + return $providerClass; + } + // fallback to no locale + if ($providerClass = self::findProviderClassname($provider)) { + return $providerClass; + } + throw new \InvalidArgumentException(sprintf('Unable to find provider "%s" with locale "%s"', $provider, $locale)); + } + + /** + * @param string $provider + * @param string $locale + * @return string + */ + protected static function findProviderClassname($provider, $locale = '') + { + $providerClass = 'Faker\\' . ($locale ? sprintf('Provider\%s\%s', $locale, $provider) : sprintf('Provider\%s', $provider)); + if (class_exists($providerClass, true)) { + return $providerClass; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Generator.php b/vendor/fzaninotto/faker/src/Faker/Generator.php new file mode 100644 index 0000000..0a4e050 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Generator.php @@ -0,0 +1,281 @@ +providers, $provider); + } + + public function getProviders() + { + return $this->providers; + } + + public function seed($seed = null) + { + if ($seed === null) { + mt_srand(); + } else { + if (PHP_VERSION_ID < 70100) { + mt_srand((int) $seed); + } else { + mt_srand((int) $seed, MT_RAND_PHP); + } + } + } + + public function format($formatter, $arguments = array()) + { + return call_user_func_array($this->getFormatter($formatter), $arguments); + } + + /** + * @param string $formatter + * + * @return Callable + */ + public function getFormatter($formatter) + { + if (isset($this->formatters[$formatter])) { + return $this->formatters[$formatter]; + } + foreach ($this->providers as $provider) { + if (method_exists($provider, $formatter)) { + $this->formatters[$formatter] = array($provider, $formatter); + + return $this->formatters[$formatter]; + } + } + throw new \InvalidArgumentException(sprintf('Unknown formatter "%s"', $formatter)); + } + + /** + * Replaces tokens ('{{ tokenName }}') with the result from the token method call + * + * @param string $string String that needs to bet parsed + * @return string + */ + public function parse($string) + { + return preg_replace_callback('/\{\{\s?(\w+)\s?\}\}/u', array($this, 'callFormatWithMatches'), $string); + } + + protected function callFormatWithMatches($matches) + { + return $this->format($matches[1]); + } + + /** + * @param string $attribute + * + * @return mixed + */ + public function __get($attribute) + { + return $this->format($attribute); + } + + /** + * @param string $method + * @param array $attributes + * + * @return mixed + */ + public function __call($method, $attributes) + { + return $this->format($method, $attributes); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Guesser/Name.php b/vendor/fzaninotto/faker/src/Faker/Guesser/Name.php new file mode 100644 index 0000000..0b303db --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Guesser/Name.php @@ -0,0 +1,156 @@ +generator = $generator; + } + + /** + * @param string $name + * @param int|null $size Length of field, if known + * @return callable + */ + public function guessFormat($name, $size = null) + { + $name = Base::toLower($name); + $generator = $this->generator; + if (preg_match('/^is[_A-Z]/', $name)) { + return function () use ($generator) { + return $generator->boolean; + }; + } + if (preg_match('/(_a|A)t$/', $name)) { + return function () use ($generator) { + return $generator->dateTime; + }; + } + switch (str_replace('_', '', $name)) { + case 'firstname': + return function () use ($generator) { + return $generator->firstName; + }; + case 'lastname': + return function () use ($generator) { + return $generator->lastName; + }; + case 'username': + case 'login': + return function () use ($generator) { + return $generator->userName; + }; + case 'email': + case 'emailaddress': + return function () use ($generator) { + return $generator->email; + }; + case 'phonenumber': + case 'phone': + case 'telephone': + case 'telnumber': + return function () use ($generator) { + return $generator->phoneNumber; + }; + case 'address': + return function () use ($generator) { + return $generator->address; + }; + case 'city': + case 'town': + return function () use ($generator) { + return $generator->city; + }; + case 'streetaddress': + return function () use ($generator) { + return $generator->streetAddress; + }; + case 'postcode': + case 'zipcode': + return function () use ($generator) { + return $generator->postcode; + }; + case 'state': + return function () use ($generator) { + return $generator->state; + }; + case 'county': + if ($this->generator->locale == 'en_US') { + return function () use ($generator) { + return sprintf('%s County', $generator->city); + }; + } + + return function () use ($generator) { + return $generator->state; + }; + case 'country': + switch ($size) { + case 2: + return function () use ($generator) { + return $generator->countryCode; + }; + case 3: + return function () use ($generator) { + return $generator->countryISOAlpha3; + }; + case 5: + case 6: + return function () use ($generator) { + return $generator->locale; + }; + default: + return function () use ($generator) { + return $generator->country; + }; + } + break; + case 'locale': + return function () use ($generator) { + return $generator->locale; + }; + case 'currency': + case 'currencycode': + return function () use ($generator) { + return $generator->currencyCode; + }; + case 'url': + case 'website': + return function () use ($generator) { + return $generator->url; + }; + case 'company': + case 'companyname': + case 'employer': + return function () use ($generator) { + return $generator->company; + }; + case 'title': + if ($size !== null && $size <= 10) { + return function () use ($generator) { + return $generator->title; + }; + } + + return function () use ($generator) { + return $generator->sentence; + }; + case 'body': + case 'summary': + case 'article': + case 'description': + return function () use ($generator) { + return $generator->text; + }; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/ColumnTypeGuesser.php b/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/ColumnTypeGuesser.php new file mode 100644 index 0000000..0b871ed --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/ColumnTypeGuesser.php @@ -0,0 +1,67 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat($column, $table) + { + $generator = $this->generator; + $schema = $table->schema(); + + switch ($schema->columnType($column)) { + case 'boolean': + return function () use ($generator) { + return $generator->boolean; + }; + case 'integer': + return function () { + return mt_rand(0, intval('2147483647')); + }; + case 'biginteger': + return function () { + return mt_rand(0, intval('9223372036854775807')); + }; + case 'decimal': + case 'float': + return function () use ($generator) { + return $generator->randomFloat(); + }; + case 'uuid': + return function () use ($generator) { + return $generator->uuid(); + }; + case 'string': + $columnData = $schema->column($column); + $length = $columnData['length']; + return function () use ($generator, $length) { + return $generator->text($length); + }; + case 'text': + return function () use ($generator) { + return $generator->text(); + }; + case 'date': + case 'datetime': + case 'timestamp': + case 'time': + return function () use ($generator) { + return $generator->datetime(); + }; + + case 'binary': + default: + return null; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/EntityPopulator.php b/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/EntityPopulator.php new file mode 100644 index 0000000..2ec312a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/EntityPopulator.php @@ -0,0 +1,166 @@ +class = $class; + } + + /** + * @param string $name + */ + public function __get($name) + { + return $this->{$name}; + } + + /** + * @param string $name + */ + public function __set($name, $value) + { + $this->{$name} = $value; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + public function mergeModifiersWith($modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @return array + */ + public function guessColumnFormatters($populator) + { + $formatters = []; + $class = $this->class; + $table = $this->getTable($class); + $schema = $table->schema(); + $pk = $schema->primaryKey(); + $guessers = $populator->getGuessers() + ['ColumnTypeGuesser' => new ColumnTypeGuesser($populator->getGenerator())]; + $isForeignKey = function ($column) use ($table) { + foreach ($table->associations()->type('BelongsTo') as $assoc) { + if ($column == $assoc->foreignKey()) { + return true; + } + } + return false; + }; + + + foreach ($schema->columns() as $column) { + if ($column == $pk[0] || $isForeignKey($column)) { + continue; + } + + foreach ($guessers as $guesser) { + if ($formatter = $guesser->guessFormat($column, $table)) { + $formatters[$column] = $formatter; + break; + } + } + } + + return $formatters; + } + + /** + * @return array + */ + public function guessModifiers() + { + $modifiers = []; + $table = $this->getTable($this->class); + + $belongsTo = $table->associations()->type('BelongsTo'); + foreach ($belongsTo as $assoc) { + $modifiers['belongsTo' . $assoc->name()] = function ($data, $insertedEntities) use ($assoc) { + $table = $assoc->target(); + $foreignModel = $table->alias(); + + $foreignKeys = []; + if (!empty($insertedEntities[$foreignModel])) { + $foreignKeys = $insertedEntities[$foreignModel]; + } else { + $foreignKeys = $table->find('all') + ->select(['id']) + ->map(function ($row) { + return $row->id; + }) + ->toArray(); + } + + if (empty($foreignKeys)) { + throw new \Exception(sprintf('%s belongsTo %s, which seems empty at this point.', $this->getTable($this->class)->table(), $assoc->table())); + } + + $foreignKey = $foreignKeys[array_rand($foreignKeys)]; + $data[$assoc->foreignKey()] = $foreignKey; + return $data; + }; + } + + // TODO check if TreeBehavior attached to modify lft/rgt cols + + return $modifiers; + } + + /** + * @param array $options + */ + public function execute($class, $insertedEntities, $options = []) + { + $table = $this->getTable($class); + $entity = $table->newEntity(); + + foreach ($this->columnFormatters as $column => $format) { + if (!is_null($format)) { + $entity->{$column} = is_callable($format) ? $format($insertedEntities, $table) : $format; + } + } + + foreach ($this->modifiers as $modifier) { + $entity = $modifier($entity, $insertedEntities); + } + + if (!$entity = $table->save($entity, $options)) { + throw new \RuntimeException("Failed saving $class record"); + } + + $pk = $table->primaryKey(); + if (is_string($pk)) { + return $entity->{$pk}; + } + + return $entity->{$pk[0]}; + } + + public function setConnection($name) + { + $this->connectionName = $name; + } + + protected function getTable($class) + { + $options = []; + if (!empty($this->connectionName)) { + $options['connection'] = $this->connectionName; + } + return TableRegistry::get($class, $options); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/Populator.php b/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/Populator.php new file mode 100644 index 0000000..eda30a8 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/Populator.php @@ -0,0 +1,109 @@ +generator = $generator; + } + + /** + * @return \Faker\Generator + */ + public function getGenerator() + { + return $this->generator; + } + + /** + * @return array + */ + public function getGuessers() + { + return $this->guessers; + } + + /** + * @return $this + */ + public function removeGuesser($name) + { + if ($this->guessers[$name]) { + unset($this->guessers[$name]); + } + return $this; + } + + /** + * @return $this + * @throws \Exception + */ + public function addGuesser($class) + { + if (!is_object($class)) { + $class = new $class($this->generator); + } + + if (!method_exists($class, 'guessFormat')) { + throw new \Exception('Missing required custom guesser method: ' . get_class($class) . '::guessFormat()'); + } + + $this->guessers[get_class($class)] = $class; + return $this; + } + + /** + * @param array $customColumnFormatters + * @param array $customModifiers + * @return $this + */ + public function addEntity($entity, $number, $customColumnFormatters = [], $customModifiers = []) + { + if (!$entity instanceof EntityPopulator) { + $entity = new EntityPopulator($entity); + } + + $entity->columnFormatters = $entity->guessColumnFormatters($this); + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + + $entity->modifiers = $entity->guessModifiers($this); + if ($customModifiers) { + $entity->mergeModifiersWith($customModifiers); + } + + $class = $entity->class; + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + return $this; + } + + /** + * @param array $options + * @return array + */ + public function execute($options = []) + { + $insertedEntities = []; + + foreach ($this->quantities as $class => $number) { + for ($i = 0; $i < $number; $i++) { + $insertedEntities[$class][] = $this->entities[$class]->execute($class, $insertedEntities, $options); + } + } + + return $insertedEntities; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php b/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php new file mode 100644 index 0000000..824f8c0 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php @@ -0,0 +1,75 @@ +generator = $generator; + } + + /** + * @param ClassMetadata $class + * @return \Closure|null + */ + public function guessFormat($fieldName, ClassMetadata $class) + { + $generator = $this->generator; + $type = $class->getTypeOfField($fieldName); + switch ($type) { + case 'boolean': + return function () use ($generator) { + return $generator->boolean; + }; + case 'decimal': + $size = isset($class->fieldMappings[$fieldName]['precision']) ? $class->fieldMappings[$fieldName]['precision'] : 2; + + return function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + case 'smallint': + return function () { + return mt_rand(0, 65535); + }; + case 'integer': + return function () { + return mt_rand(0, intval('2147483647')); + }; + case 'bigint': + return function () { + return mt_rand(0, intval('18446744073709551615')); + }; + case 'float': + return function () { + return mt_rand(0, intval('4294967295'))/mt_rand(1, intval('4294967295')); + }; + case 'string': + $size = isset($class->fieldMappings[$fieldName]['length']) ? $class->fieldMappings[$fieldName]['length'] : 255; + + return function () use ($generator, $size) { + return $generator->text($size); + }; + case 'text': + return function () use ($generator) { + return $generator->text; + }; + case 'datetime': + case 'date': + case 'time': + return function () use ($generator) { + return $generator->datetime; + }; + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/EntityPopulator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/EntityPopulator.php new file mode 100644 index 0000000..bc703e5 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/EntityPopulator.php @@ -0,0 +1,251 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class->getName(); + } + + /** + * @param $columnFormatters + */ + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @param array $modifiers + */ + public function setModifiers(array $modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + /** + * @param array $modifiers + */ + public function mergeModifiersWith(array $modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @param \Faker\Generator $generator + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator) + { + $formatters = array(); + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new ColumnTypeGuesser($generator); + foreach ($this->class->getFieldNames() as $fieldName) { + if ($this->class->isIdentifier($fieldName) || !$this->class->hasField($fieldName)) { + continue; + } + + $size = isset($this->class->fieldMappings[$fieldName]['length']) ? $this->class->fieldMappings[$fieldName]['length'] : null; + if ($formatter = $nameGuesser->guessFormat($fieldName, $size)) { + $formatters[$fieldName] = $formatter; + continue; + } + if ($formatter = $columnTypeGuesser->guessFormat($fieldName, $this->class)) { + $formatters[$fieldName] = $formatter; + continue; + } + } + + foreach ($this->class->getAssociationNames() as $assocName) { + if ($this->class->isCollectionValuedAssociation($assocName)) { + continue; + } + + $relatedClass = $this->class->getAssociationTargetClass($assocName); + + $unique = $optional = false; + if ($this->class instanceof \Doctrine\ORM\Mapping\ClassMetadata) { + $mappings = $this->class->getAssociationMappings(); + foreach ($mappings as $mapping) { + if ($mapping['targetEntity'] == $relatedClass) { + if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadata::ONE_TO_ONE) { + $unique = true; + $optional = isset($mapping['joinColumns'][0]['nullable']) ? $mapping['joinColumns'][0]['nullable'] : false; + break; + } + } + } + } elseif ($this->class instanceof \Doctrine\ODM\MongoDB\Mapping\ClassMetadata) { + $mappings = $this->class->associationMappings; + foreach ($mappings as $mapping) { + if ($mapping['targetDocument'] == $relatedClass) { + if ($mapping['type'] == \Doctrine\ODM\MongoDB\Mapping\ClassMetadata::ONE && $mapping['association'] == \Doctrine\ODM\MongoDB\Mapping\ClassMetadata::REFERENCE_ONE) { + $unique = true; + $optional = isset($mapping['nullable']) ? $mapping['nullable'] : false; + break; + } + } + } + } + + $index = 0; + $formatters[$assocName] = function ($inserted) use ($relatedClass, &$index, $unique, $optional) { + + if (isset($inserted[$relatedClass])) { + if ($unique) { + $related = null; + if (isset($inserted[$relatedClass][$index]) || !$optional) { + $related = $inserted[$relatedClass][$index]; + } + + $index++; + + return $related; + } + + return $inserted[$relatedClass][mt_rand(0, count($inserted[$relatedClass]) - 1)]; + } + + return null; + }; + } + + return $formatters; + } + + /** + * Insert one new record using the Entity class. + * @param ObjectManager $manager + * @param bool $generateId + * @return EntityPopulator + */ + public function execute(ObjectManager $manager, $insertedEntities, $generateId = false) + { + $obj = $this->class->newInstance(); + + $this->fillColumns($obj, $insertedEntities); + $this->callMethods($obj, $insertedEntities); + + if ($generateId) { + $idsName = $this->class->getIdentifier(); + foreach ($idsName as $idName) { + $id = $this->generateId($obj, $idName, $manager); + $this->class->reflFields[$idName]->setValue($obj, $id); + } + } + + $manager->persist($obj); + + return $obj; + } + + private function fillColumns($obj, $insertedEntities) + { + foreach ($this->columnFormatters as $field => $format) { + if (null !== $format) { + // Add some extended debugging information to any errors thrown by the formatter + try { + $value = is_callable($format) ? $format($insertedEntities, $obj) : $format; + } catch (\InvalidArgumentException $ex) { + throw new \InvalidArgumentException(sprintf( + "Failed to generate a value for %s::%s: %s", + get_class($obj), + $field, + $ex->getMessage() + )); + } + // Try a standard setter if it's available, otherwise fall back on reflection + $setter = sprintf("set%s", ucfirst($field)); + if (is_callable(array($obj, $setter))) { + $obj->$setter($value); + } else { + $this->class->reflFields[$field]->setValue($obj, $value); + } + } + } + } + + private function callMethods($obj, $insertedEntities) + { + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + } + + /** + * @param ObjectManager $manager + * @return int|null + */ + private function generateId($obj, $column, ObjectManager $manager) + { + /* @var $repository \Doctrine\Common\Persistence\ObjectRepository */ + $repository = $manager->getRepository(get_class($obj)); + $result = $repository->createQueryBuilder('e') + ->select(sprintf('e.%s', $column)) + ->getQuery() + ->execute(); + $ids = array_map('current', $result->toArray()); + + $id = null; + do { + $id = mt_rand(); + } while (in_array($id, $ids)); + + return $id; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/Populator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/Populator.php new file mode 100644 index 0000000..d4fe897 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/Populator.php @@ -0,0 +1,82 @@ +generator = $generator; + $this->manager = $manager; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Doctrine classname, or a \Faker\ORM\Doctrine\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = array(), $customModifiers = array(), $generateId = false) + { + if (!$entity instanceof \Faker\ORM\Doctrine\EntityPopulator) { + if (null === $this->manager) { + throw new \InvalidArgumentException("No entity manager passed to Doctrine Populator."); + } + $entity = new \Faker\ORM\Doctrine\EntityPopulator($this->manager->getClassMetadata($entity)); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->mergeModifiersWith($customModifiers); + $this->generateId[$entity->getClass()] = $generateId; + + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @param null|EntityManager $entityManager A Doctrine connection object + * + * @return array A list of the inserted PKs + */ + public function execute($entityManager = null) + { + if (null === $entityManager) { + $entityManager = $this->manager; + } + if (null === $entityManager) { + throw new \InvalidArgumentException("No entity manager passed to Doctrine Populator."); + } + + $insertedEntities = array(); + foreach ($this->quantities as $class => $number) { + $generateId = $this->generateId[$class]; + for ($i=0; $i < $number; $i++) { + $insertedEntities[$class][]= $this->entities[$class]->execute($entityManager, $insertedEntities, $generateId); + } + $entityManager->flush(); + } + + return $insertedEntities; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/ColumnTypeGuesser.php b/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/ColumnTypeGuesser.php new file mode 100644 index 0000000..d318b0a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/ColumnTypeGuesser.php @@ -0,0 +1,49 @@ +generator = $generator; + } + + /** + * @return \Closure|null + */ + public function guessFormat($field) + { + $generator = $this->generator; + switch ($field['type']) { + case 'boolean': + return function () use ($generator) { + return $generator->boolean; + }; + case 'integer': + return function () { + return mt_rand(0, intval('4294967295')); + }; + case 'float': + return function () { + return mt_rand(0, intval('4294967295'))/mt_rand(1, intval('4294967295')); + }; + case 'string': + return function () use ($generator) { + return $generator->text(255); + }; + case 'date': + return function () use ($generator) { + return $generator->datetime; + }; + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/EntityPopulator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/EntityPopulator.php new file mode 100644 index 0000000..667f5be --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/EntityPopulator.php @@ -0,0 +1,122 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class; + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @param \Faker\Generator $generator + * @param Mandango $mandango + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator, Mandango $mandango) + { + $formatters = array(); + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new \Faker\ORM\Mandango\ColumnTypeGuesser($generator); + + $metadata = $mandango->getMetadata($this->class); + + // fields + foreach ($metadata['fields'] as $fieldName => $field) { + if ($formatter = $nameGuesser->guessFormat($fieldName)) { + $formatters[$fieldName] = $formatter; + continue; + } + if ($formatter = $columnTypeGuesser->guessFormat($field)) { + $formatters[$fieldName] = $formatter; + continue; + } + } + + // references + foreach (array_merge($metadata['referencesOne'], $metadata['referencesMany']) as $referenceName => $reference) { + if (!isset($reference['class'])) { + continue; + } + $referenceClass = $reference['class']; + + $formatters[$referenceName] = function ($insertedEntities) use ($referenceClass) { + if (isset($insertedEntities[$referenceClass])) { + return Base::randomElement($insertedEntities[$referenceClass]); + } + }; + } + + return $formatters; + } + + /** + * Insert one new record using the Entity class. + * @param Mandango $mandango + */ + public function execute(Mandango $mandango, $insertedEntities) + { + $metadata = $mandango->getMetadata($this->class); + + $obj = $mandango->create($this->class); + foreach ($this->columnFormatters as $column => $format) { + if (null !== $format) { + $value = is_callable($format) ? $format($insertedEntities, $obj) : $format; + + if (isset($metadata['fields'][$column]) || + isset($metadata['referencesOne'][$column])) { + $obj->set($column, $value); + } + + if (isset($metadata['referencesMany'][$column])) { + $adder = 'add'.ucfirst($column); + $obj->$adder($value); + } + } + } + $mandango->persist($obj); + + return $obj; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/Populator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/Populator.php new file mode 100644 index 0000000..26736dc --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Mandango/Populator.php @@ -0,0 +1,65 @@ +generator = $generator; + $this->mandango = $mandango; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = array()) + { + if (!$entity instanceof \Faker\ORM\Mandango\EntityPopulator) { + $entity = new \Faker\ORM\Mandango\EntityPopulator($entity); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator, $this->mandango)); + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @return array A list of the inserted entities. + */ + public function execute() + { + $insertedEntities = array(); + foreach ($this->quantities as $class => $number) { + for ($i=0; $i < $number; $i++) { + $insertedEntities[$class][]= $this->entities[$class]->execute($this->mandango, $insertedEntities); + } + } + $this->mandango->flush(); + + return $insertedEntities; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Propel/ColumnTypeGuesser.php b/vendor/fzaninotto/faker/src/Faker/ORM/Propel/ColumnTypeGuesser.php new file mode 100644 index 0000000..1df7049 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Propel/ColumnTypeGuesser.php @@ -0,0 +1,107 @@ +generator = $generator; + } + + /** + * @param ColumnMap $column + * @return \Closure|null + */ + public function guessFormat(ColumnMap $column) + { + $generator = $this->generator; + if ($column->isTemporal()) { + if ($column->isEpochTemporal()) { + return function () use ($generator) { + return $generator->dateTime; + }; + } + + return function () use ($generator) { + return $generator->dateTimeAD; + }; + } + $type = $column->getType(); + switch ($type) { + case PropelColumnTypes::BOOLEAN: + case PropelColumnTypes::BOOLEAN_EMU: + return function () use ($generator) { + return $generator->boolean; + }; + case PropelColumnTypes::NUMERIC: + case PropelColumnTypes::DECIMAL: + $size = $column->getSize(); + + return function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + case PropelColumnTypes::TINYINT: + return function () { + return mt_rand(0, 127); + }; + case PropelColumnTypes::SMALLINT: + return function () { + return mt_rand(0, 32767); + }; + case PropelColumnTypes::INTEGER: + return function () { + return mt_rand(0, intval('2147483647')); + }; + case PropelColumnTypes::BIGINT: + return function () { + return mt_rand(0, intval('9223372036854775807')); + }; + case PropelColumnTypes::FLOAT: + return function () { + return mt_rand(0, intval('2147483647'))/mt_rand(1, intval('2147483647')); + }; + case PropelColumnTypes::DOUBLE: + case PropelColumnTypes::REAL: + return function () { + return mt_rand(0, intval('9223372036854775807'))/mt_rand(1, intval('9223372036854775807')); + }; + case PropelColumnTypes::CHAR: + case PropelColumnTypes::VARCHAR: + case PropelColumnTypes::BINARY: + case PropelColumnTypes::VARBINARY: + $size = $column->getSize(); + + return function () use ($generator, $size) { + return $generator->text($size); + }; + case PropelColumnTypes::LONGVARCHAR: + case PropelColumnTypes::LONGVARBINARY: + case PropelColumnTypes::CLOB: + case PropelColumnTypes::CLOB_EMU: + case PropelColumnTypes::BLOB: + return function () use ($generator) { + return $generator->text; + }; + case PropelColumnTypes::ENUM: + $valueSet = $column->getValueSet(); + + return function () use ($generator, $valueSet) { + return $generator->randomElement($valueSet); + }; + case PropelColumnTypes::OBJECT: + case PropelColumnTypes::PHP_ARRAY: + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Propel/EntityPopulator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Propel/EntityPopulator.php new file mode 100644 index 0000000..1976a40 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Propel/EntityPopulator.php @@ -0,0 +1,191 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class; + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @param \Faker\Generator $generator + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator) + { + $formatters = array(); + $class = $this->class; + $peerClass = $class::PEER; + $tableMap = $peerClass::getTableMap(); + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new \Faker\ORM\Propel\ColumnTypeGuesser($generator); + foreach ($tableMap->getColumns() as $columnMap) { + // skip behavior columns, handled by modifiers + if ($this->isColumnBehavior($columnMap)) { + continue; + } + if ($columnMap->isForeignKey()) { + $relatedClass = $columnMap->getRelation()->getForeignTable()->getClassname(); + $formatters[$columnMap->getPhpName()] = function ($inserted) use ($relatedClass) { + return isset($inserted[$relatedClass]) ? $inserted[$relatedClass][mt_rand(0, count($inserted[$relatedClass]) - 1)] : null; + }; + continue; + } + if ($columnMap->isPrimaryKey()) { + continue; + } + if ($formatter = $nameGuesser->guessFormat($columnMap->getPhpName(), $columnMap->getSize())) { + $formatters[$columnMap->getPhpName()] = $formatter; + continue; + } + if ($formatter = $columnTypeGuesser->guessFormat($columnMap)) { + $formatters[$columnMap->getPhpName()] = $formatter; + continue; + } + } + + return $formatters; + } + + /** + * @param ColumnMap $columnMap + * @return bool + */ + protected function isColumnBehavior(ColumnMap $columnMap) + { + foreach ($columnMap->getTable()->getBehaviors() as $name => $params) { + $columnName = Base::toLower($columnMap->getName()); + switch ($name) { + case 'nested_set': + $columnNames = array($params['left_column'], $params['right_column'], $params['level_column']); + if (in_array($columnName, $columnNames)) { + return true; + } + break; + case 'timestampable': + $columnNames = array($params['create_column'], $params['update_column']); + if (in_array($columnName, $columnNames)) { + return true; + } + break; + } + } + + return false; + } + + public function setModifiers($modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + public function mergeModifiersWith($modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @param \Faker\Generator $generator + * @return array + */ + public function guessModifiers(\Faker\Generator $generator) + { + $modifiers = array(); + $class = $this->class; + $peerClass = $class::PEER; + $tableMap = $peerClass::getTableMap(); + foreach ($tableMap->getBehaviors() as $name => $params) { + switch ($name) { + case 'nested_set': + $modifiers['nested_set'] = function ($obj, $inserted) use ($class, $generator) { + if (isset($inserted[$class])) { + $queryClass = $class . 'Query'; + $parent = $queryClass::create()->findPk($generator->randomElement($inserted[$class])); + $obj->insertAsLastChildOf($parent); + } else { + $obj->makeRoot(); + } + }; + break; + case 'sortable': + $modifiers['sortable'] = function ($obj, $inserted) use ($class) { + $maxRank = isset($inserted[$class]) ? count($inserted[$class]) : 0; + $obj->insertAtRank(mt_rand(1, $maxRank + 1)); + }; + break; + } + } + + return $modifiers; + } + + /** + * Insert one new record using the Entity class. + */ + public function execute($con, $insertedEntities) + { + $obj = new $this->class(); + foreach ($this->getColumnFormatters() as $column => $format) { + if (null !== $format) { + $obj->setByName($column, is_callable($format) ? $format($insertedEntities, $obj) : $format); + } + } + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + $obj->save($con); + + return $obj->getPrimaryKey(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Propel/Populator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Propel/Populator.php new file mode 100644 index 0000000..4285727 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Propel/Populator.php @@ -0,0 +1,89 @@ +generator = $generator; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = array(), $customModifiers = array()) + { + if (!$entity instanceof \Faker\ORM\Propel\EntityPopulator) { + $entity = new \Faker\ORM\Propel\EntityPopulator($entity); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->setModifiers($entity->guessModifiers($this->generator)); + if ($customModifiers) { + $entity->mergeModifiersWith($customModifiers); + } + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @param PropelPDO $con A Propel connection object + * + * @return array A list of the inserted PKs + */ + public function execute($con = null) + { + if (null === $con) { + $con = $this->getConnection(); + } + $isInstancePoolingEnabled = \Propel::isInstancePoolingEnabled(); + \Propel::disableInstancePooling(); + $insertedEntities = array(); + $con->beginTransaction(); + foreach ($this->quantities as $class => $number) { + for ($i=0; $i < $number; $i++) { + $insertedEntities[$class][]= $this->entities[$class]->execute($con, $insertedEntities); + } + } + $con->commit(); + if ($isInstancePoolingEnabled) { + \Propel::enableInstancePooling(); + } + + return $insertedEntities; + } + + protected function getConnection() + { + // use the first connection available + $class = key($this->entities); + + if (!$class) { + throw new \RuntimeException('No class found from entities. Did you add entities to the Populator ?'); + } + + $peer = $class::PEER; + + return \Propel::getConnection($peer::DATABASE_NAME, \Propel::CONNECTION_WRITE); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/ColumnTypeGuesser.php b/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/ColumnTypeGuesser.php new file mode 100644 index 0000000..024965a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/ColumnTypeGuesser.php @@ -0,0 +1,107 @@ +generator = $generator; + } + + /** + * @param ColumnMap $column + * @return \Closure|null + */ + public function guessFormat(ColumnMap $column) + { + $generator = $this->generator; + if ($column->isTemporal()) { + if ($column->getType() == PropelTypes::BU_DATE || $column->getType() == PropelTypes::BU_TIMESTAMP) { + return function () use ($generator) { + return $generator->dateTime; + }; + } + + return function () use ($generator) { + return $generator->dateTimeAD; + }; + } + $type = $column->getType(); + switch ($type) { + case PropelTypes::BOOLEAN: + case PropelTypes::BOOLEAN_EMU: + return function () use ($generator) { + return $generator->boolean; + }; + case PropelTypes::NUMERIC: + case PropelTypes::DECIMAL: + $size = $column->getSize(); + + return function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + case PropelTypes::TINYINT: + return function () { + return mt_rand(0, 127); + }; + case PropelTypes::SMALLINT: + return function () { + return mt_rand(0, 32767); + }; + case PropelTypes::INTEGER: + return function () { + return mt_rand(0, intval('2147483647')); + }; + case PropelTypes::BIGINT: + return function () { + return mt_rand(0, intval('9223372036854775807')); + }; + case PropelTypes::FLOAT: + return function () { + return mt_rand(0, intval('2147483647'))/mt_rand(1, intval('2147483647')); + }; + case PropelTypes::DOUBLE: + case PropelTypes::REAL: + return function () { + return mt_rand(0, intval('9223372036854775807'))/mt_rand(1, intval('9223372036854775807')); + }; + case PropelTypes::CHAR: + case PropelTypes::VARCHAR: + case PropelTypes::BINARY: + case PropelTypes::VARBINARY: + $size = $column->getSize(); + + return function () use ($generator, $size) { + return $generator->text($size); + }; + case PropelTypes::LONGVARCHAR: + case PropelTypes::LONGVARBINARY: + case PropelTypes::CLOB: + case PropelTypes::CLOB_EMU: + case PropelTypes::BLOB: + return function () use ($generator) { + return $generator->text; + }; + case PropelTypes::ENUM: + $valueSet = $column->getValueSet(); + + return function () use ($generator, $valueSet) { + return $generator->randomElement($valueSet); + }; + case PropelTypes::OBJECT: + case PropelTypes::PHP_ARRAY: + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/EntityPopulator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/EntityPopulator.php new file mode 100644 index 0000000..df5b671 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/EntityPopulator.php @@ -0,0 +1,192 @@ +class = $class; + } + + /** + * @return string + */ + public function getClass() + { + return $this->class; + } + + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @param \Faker\Generator $generator + * @return array + */ + public function guessColumnFormatters(\Faker\Generator $generator) + { + $formatters = array(); + $class = $this->class; + $peerClass = $class::TABLE_MAP; + $tableMap = $peerClass::getTableMap(); + $nameGuesser = new \Faker\Guesser\Name($generator); + $columnTypeGuesser = new \Faker\ORM\Propel2\ColumnTypeGuesser($generator); + foreach ($tableMap->getColumns() as $columnMap) { + // skip behavior columns, handled by modifiers + if ($this->isColumnBehavior($columnMap)) { + continue; + } + if ($columnMap->isForeignKey()) { + $relatedClass = $columnMap->getRelation()->getForeignTable()->getClassname(); + $formatters[$columnMap->getPhpName()] = function ($inserted) use ($relatedClass) { + $relatedClass = trim($relatedClass, "\\"); + return isset($inserted[$relatedClass]) ? $inserted[$relatedClass][mt_rand(0, count($inserted[$relatedClass]) - 1)] : null; + }; + continue; + } + if ($columnMap->isPrimaryKey()) { + continue; + } + if ($formatter = $nameGuesser->guessFormat($columnMap->getPhpName(), $columnMap->getSize())) { + $formatters[$columnMap->getPhpName()] = $formatter; + continue; + } + if ($formatter = $columnTypeGuesser->guessFormat($columnMap)) { + $formatters[$columnMap->getPhpName()] = $formatter; + continue; + } + } + + return $formatters; + } + + /** + * @param ColumnMap $columnMap + * @return bool + */ + protected function isColumnBehavior(ColumnMap $columnMap) + { + foreach ($columnMap->getTable()->getBehaviors() as $name => $params) { + $columnName = Base::toLower($columnMap->getName()); + switch ($name) { + case 'nested_set': + $columnNames = array($params['left_column'], $params['right_column'], $params['level_column']); + if (in_array($columnName, $columnNames)) { + return true; + } + break; + case 'timestampable': + $columnNames = array($params['create_column'], $params['update_column']); + if (in_array($columnName, $columnNames)) { + return true; + } + break; + } + } + + return false; + } + + public function setModifiers($modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + public function mergeModifiersWith($modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @param \Faker\Generator $generator + * @return array + */ + public function guessModifiers(\Faker\Generator $generator) + { + $modifiers = array(); + $class = $this->class; + $peerClass = $class::TABLE_MAP; + $tableMap = $peerClass::getTableMap(); + foreach ($tableMap->getBehaviors() as $name => $params) { + switch ($name) { + case 'nested_set': + $modifiers['nested_set'] = function ($obj, $inserted) use ($class, $generator) { + if (isset($inserted[$class])) { + $queryClass = $class . 'Query'; + $parent = $queryClass::create()->findPk($generator->randomElement($inserted[$class])); + $obj->insertAsLastChildOf($parent); + } else { + $obj->makeRoot(); + } + }; + break; + case 'sortable': + $modifiers['sortable'] = function ($obj, $inserted) use ($class) { + $maxRank = isset($inserted[$class]) ? count($inserted[$class]) : 0; + $obj->insertAtRank(mt_rand(1, $maxRank + 1)); + }; + break; + } + } + + return $modifiers; + } + + /** + * Insert one new record using the Entity class. + */ + public function execute($con, $insertedEntities) + { + $obj = new $this->class(); + foreach ($this->getColumnFormatters() as $column => $format) { + if (null !== $format) { + $obj->setByName($column, is_callable($format) ? $format($insertedEntities, $obj) : $format); + } + } + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + $obj->save($con); + + return $obj->getPrimaryKey(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/Populator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/Populator.php new file mode 100644 index 0000000..c0efe3b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Propel2/Populator.php @@ -0,0 +1,92 @@ +generator = $generator; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param mixed $entity A Propel ActiveRecord classname, or a \Faker\ORM\Propel2\EntityPopulator instance + * @param int $number The number of entities to populate + */ + public function addEntity($entity, $number, $customColumnFormatters = array(), $customModifiers = array()) + { + if (!$entity instanceof \Faker\ORM\Propel2\EntityPopulator) { + $entity = new \Faker\ORM\Propel2\EntityPopulator($entity); + } + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->setModifiers($entity->guessModifiers($this->generator)); + if ($customModifiers) { + $entity->mergeModifiersWith($customModifiers); + } + $class = $entity->getClass(); + $this->entities[$class] = $entity; + $this->quantities[$class] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @param PropelPDO $con A Propel connection object + * + * @return array A list of the inserted PKs + */ + public function execute($con = null) + { + if (null === $con) { + $con = $this->getConnection(); + } + $isInstancePoolingEnabled = Propel::isInstancePoolingEnabled(); + Propel::disableInstancePooling(); + $insertedEntities = array(); + $con->beginTransaction(); + foreach ($this->quantities as $class => $number) { + for ($i=0; $i < $number; $i++) { + $insertedEntities[$class][]= $this->entities[$class]->execute($con, $insertedEntities); + } + } + $con->commit(); + if ($isInstancePoolingEnabled) { + Propel::enableInstancePooling(); + } + + return $insertedEntities; + } + + protected function getConnection() + { + // use the first connection available + $class = key($this->entities); + + if (!$class) { + throw new \RuntimeException('No class found from entities. Did you add entities to the Populator ?'); + } + + $peer = $class::TABLE_MAP; + + return Propel::getConnection($peer::DATABASE_NAME, ServiceContainerInterface::CONNECTION_WRITE); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Spot/ColumnTypeGuesser.php b/vendor/fzaninotto/faker/src/Faker/ORM/Spot/ColumnTypeGuesser.php new file mode 100644 index 0000000..716a9f2 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Spot/ColumnTypeGuesser.php @@ -0,0 +1,77 @@ +generator = $generator; + } + + /** + * @param array $field + * @return \Closure|null + */ + public function guessFormat(array $field) + { + $generator = $this->generator; + $type = $field['type']; + switch ($type) { + case 'boolean': + return function () use ($generator) { + return $generator->boolean; + }; + case 'decimal': + $size = isset($field['precision']) ? $field['precision'] : 2; + + return function () use ($generator, $size) { + return $generator->randomNumber($size + 2) / 100; + }; + case 'smallint': + return function () use ($generator) { + return $generator->numberBetween(0, 65535); + }; + case 'integer': + return function () use ($generator) { + return $generator->numberBetween(0, intval('2147483647')); + }; + case 'bigint': + return function () use ($generator) { + return $generator->numberBetween(0, intval('18446744073709551615')); + }; + case 'float': + return function () use ($generator) { + return $generator->randomFloat(null, 0, intval('4294967295')); + }; + case 'string': + $size = isset($field['length']) ? $field['length'] : 255; + + return function () use ($generator, $size) { + return $generator->text($size); + }; + case 'text': + return function () use ($generator) { + return $generator->text; + }; + case 'datetime': + case 'date': + case 'time': + return function () use ($generator) { + return $generator->datetime; + }; + default: + // no smart way to guess what the user expects here + return null; + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Spot/EntityPopulator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Spot/EntityPopulator.php new file mode 100644 index 0000000..ba5bddb --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Spot/EntityPopulator.php @@ -0,0 +1,222 @@ +mapper = $mapper; + $this->locator = $locator; + $this->useExistingData = $useExistingData; + } + + /** + * @return string + */ + public function getMapper() + { + return $this->mapper; + } + + /** + * @param $columnFormatters + */ + public function setColumnFormatters($columnFormatters) + { + $this->columnFormatters = $columnFormatters; + } + + /** + * @return array + */ + public function getColumnFormatters() + { + return $this->columnFormatters; + } + + /** + * @param $columnFormatters + */ + public function mergeColumnFormattersWith($columnFormatters) + { + $this->columnFormatters = array_merge($this->columnFormatters, $columnFormatters); + } + + /** + * @param array $modifiers + */ + public function setModifiers(array $modifiers) + { + $this->modifiers = $modifiers; + } + + /** + * @return array + */ + public function getModifiers() + { + return $this->modifiers; + } + + /** + * @param array $modifiers + */ + public function mergeModifiersWith(array $modifiers) + { + $this->modifiers = array_merge($this->modifiers, $modifiers); + } + + /** + * @param Generator $generator + * @return array + */ + public function guessColumnFormatters(Generator $generator) + { + $formatters = array(); + $nameGuesser = new Name($generator); + $columnTypeGuesser = new ColumnTypeGuesser($generator); + $fields = $this->mapper->fields(); + foreach ($fields as $fieldName => $field) { + if ($field['primary'] === true) { + continue; + } + if ($formatter = $nameGuesser->guessFormat($fieldName)) { + $formatters[$fieldName] = $formatter; + continue; + } + if ($formatter = $columnTypeGuesser->guessFormat($field)) { + $formatters[$fieldName] = $formatter; + continue; + } + } + $entityName = $this->mapper->entity(); + $entity = $this->mapper->build([]); + $relations = $entityName::relations($this->mapper, $entity); + foreach ($relations as $relation) { + // We don't need any other relation here. + if ($relation instanceof BelongsTo) { + + $fieldName = $relation->localKey(); + $entityName = $relation->entityName(); + $field = $fields[$fieldName]; + $required = $field['required']; + + $locator = $this->locator; + + $formatters[$fieldName] = function ($inserted) use ($required, $entityName, $locator) { + if (!empty($inserted[$entityName])) { + return $inserted[$entityName][mt_rand(0, count($inserted[$entityName]) - 1)]->get('id'); + } + + if ($required && $this->useExistingData) { + // We did not add anything like this, but it's required, + // So let's find something existing in DB. + $mapper = $locator->mapper($entityName); + $records = $mapper->all()->limit(self::RELATED_FETCH_COUNT)->toArray(); + if (empty($records)) { + return null; + } + $id = $records[mt_rand(0, count($records) - 1)]['id']; + + return $id; + } + + return null; + }; + + } + } + + return $formatters; + } + + /** + * Insert one new record using the Entity class. + * + * @param $insertedEntities + * @return string + */ + public function execute($insertedEntities) + { + $obj = $this->mapper->build([]); + + $this->fillColumns($obj, $insertedEntities); + $this->callMethods($obj, $insertedEntities); + + $this->mapper->insert($obj); + + + return $obj; + } + + /** + * @param $obj + * @param $insertedEntities + */ + private function fillColumns($obj, $insertedEntities) + { + foreach ($this->columnFormatters as $field => $format) { + if (null !== $format) { + $value = is_callable($format) ? $format($insertedEntities, $obj) : $format; + $obj->set($field, $value); + } + } + } + + /** + * @param $obj + * @param $insertedEntities + */ + private function callMethods($obj, $insertedEntities) + { + foreach ($this->getModifiers() as $modifier) { + $modifier($obj, $insertedEntities); + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ORM/Spot/Populator.php b/vendor/fzaninotto/faker/src/Faker/ORM/Spot/Populator.php new file mode 100644 index 0000000..c834b04 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ORM/Spot/Populator.php @@ -0,0 +1,88 @@ +generator = $generator; + $this->locator = $locator; + } + + /** + * Add an order for the generation of $number records for $entity. + * + * @param $entityName string Name of Entity object to generate + * @param $number int The number of entities to populate + * @param $customColumnFormatters array + * @param $customModifiers array + * @param $useExistingData bool Should we use existing rows (e.g. roles) to populate relations? + */ + public function addEntity( + $entityName, + $number, + $customColumnFormatters = array(), + $customModifiers = array(), + $useExistingData = false + ) { + $mapper = $this->locator->mapper($entityName); + if (null === $mapper) { + throw new \InvalidArgumentException("No mapper can be found for entity " . $entityName); + } + $entity = new EntityPopulator($mapper, $this->locator, $useExistingData); + + $entity->setColumnFormatters($entity->guessColumnFormatters($this->generator)); + if ($customColumnFormatters) { + $entity->mergeColumnFormattersWith($customColumnFormatters); + } + $entity->mergeModifiersWith($customModifiers); + + $this->entities[$entityName] = $entity; + $this->quantities[$entityName] = $number; + } + + /** + * Populate the database using all the Entity classes previously added. + * + * @param Locator $locator A Spot locator + * + * @return array A list of the inserted PKs + */ + public function execute($locator = null) + { + if (null === $locator) { + $locator = $this->locator; + } + if (null === $locator) { + throw new \InvalidArgumentException("No entity manager passed to Spot Populator."); + } + + $insertedEntities = array(); + foreach ($this->quantities as $entityName => $number) { + for ($i = 0; $i < $number; $i++) { + $insertedEntities[$entityName][] = $this->entities[$entityName]->execute( + $insertedEntities + ); + } + } + + return $insertedEntities; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/Address.php new file mode 100644 index 0000000..24f538a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Address.php @@ -0,0 +1,139 @@ +generator->parse($format); + } + + /** + * @example 'Crist Parks' + */ + public function streetName() + { + $format = static::randomElement(static::$streetNameFormats); + + return $this->generator->parse($format); + } + + /** + * @example '791 Crist Parks' + */ + public function streetAddress() + { + $format = static::randomElement(static::$streetAddressFormats); + + return $this->generator->parse($format); + } + + /** + * @example 86039-9874 + */ + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + /** + * @example '791 Crist Parks, Sashabury, IL 86039-9874' + */ + public function address() + { + $format = static::randomElement(static::$addressFormats); + + return $this->generator->parse($format); + } + + /** + * @example 'Japan' + */ + public static function country() + { + return static::randomElement(static::$country); + } + + /** + * @example '77.147489' + * @param float|int $min + * @param float|int $max + * @return float Uses signed degrees format (returns a float number between -90 and 90) + */ + public static function latitude($min = -90, $max = 90) + { + return static::randomFloat(6, $min, $max); + } + + /** + * @example '86.211205' + * @param float|int $min + * @param float|int $max + * @return float Uses signed degrees format (returns a float number between -180 and 180) + */ + public static function longitude($min = -180, $max = 180) + { + return static::randomFloat(6, $min, $max); + } + + /** + * @example array('77.147489', '86.211205') + * @return array | latitude, longitude + */ + public static function localCoordinates() + { + return array( + 'latitude' => static::latitude(), + 'longitude' => static::longitude() + ); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Barcode.php b/vendor/fzaninotto/faker/src/Faker/Provider/Barcode.php new file mode 100644 index 0000000..05759a3 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Barcode.php @@ -0,0 +1,114 @@ + $digit) { + $sums += $digit * $sequence[$n % 2]; + } + return (10 - $sums % 10) % 10; + } + + /** + * ISBN-10 check digit + * @link http://en.wikipedia.org/wiki/International_Standard_Book_Number#ISBN-10_check_digits + * + * @param string $input ISBN without check-digit + * @throws \LengthException When wrong input length passed + * + * @return integer Check digit + */ + protected static function isbnChecksum($input) + { + // We're calculating check digit for ISBN-10 + // so, the length of the input should be 9 + $length = 9; + + if (strlen($input) !== $length) { + throw new \LengthException(sprintf('Input length should be equal to %d', $length)); + } + + $digits = str_split($input); + array_walk( + $digits, + function (&$digit, $position) { + $digit = (10 - $position) * $digit; + } + ); + $result = (11 - array_sum($digits) % 11) % 11; + + // 10 is replaced by X + return ($result < 10)?$result:'X'; + } + + /** + * Get a random EAN13 barcode. + * @return string + * @example '4006381333931' + */ + public function ean13() + { + return $this->ean(13); + } + + /** + * Get a random EAN8 barcode. + * @return string + * @example '73513537' + */ + public function ean8() + { + return $this->ean(8); + } + + /** + * Get a random ISBN-10 code + * @link http://en.wikipedia.org/wiki/International_Standard_Book_Number + * + * @return string + * @example '4881416324' + */ + public function isbn10() + { + $code = static::numerify(str_repeat('#', 9)); + + return $code . static::isbnChecksum($code); + } + + /** + * Get a random ISBN-13 code + * @link http://en.wikipedia.org/wiki/International_Standard_Book_Number + * + * @return string + * @example '9790404436093' + */ + public function isbn13() + { + $code = '97' . static::numberBetween(8, 9) . static::numerify(str_repeat('#', 9)); + + return $code . static::eanChecksum($code); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Base.php b/vendor/fzaninotto/faker/src/Faker/Provider/Base.php new file mode 100644 index 0000000..fa321ee --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Base.php @@ -0,0 +1,612 @@ +generator = $generator; + } + + /** + * Returns a random number between 0 and 9 + * + * @return integer + */ + public static function randomDigit() + { + return mt_rand(0, 9); + } + + /** + * Returns a random number between 1 and 9 + * + * @return integer + */ + public static function randomDigitNotNull() + { + return mt_rand(1, 9); + } + + /** + * Generates a random digit, which cannot be $except + * + * @param int $except + * @return int + */ + public static function randomDigitNot($except) + { + $result = self::numberBetween(0, 8); + if ($result >= $except) { + $result++; + } + return $result; + } + + /** + * Returns a random integer with 0 to $nbDigits digits. + * + * The maximum value returned is mt_getrandmax() + * + * @param integer $nbDigits Defaults to a random number between 1 and 9 + * @param boolean $strict Whether the returned number should have exactly $nbDigits + * @example 79907610 + * + * @return integer + */ + public static function randomNumber($nbDigits = null, $strict = false) + { + if (!is_bool($strict)) { + throw new \InvalidArgumentException('randomNumber() generates numbers of fixed width. To generate numbers between two boundaries, use numberBetween() instead.'); + } + if (null === $nbDigits) { + $nbDigits = static::randomDigitNotNull(); + } + $max = pow(10, $nbDigits) - 1; + if ($max > mt_getrandmax()) { + throw new \InvalidArgumentException('randomNumber() can only generate numbers up to mt_getrandmax()'); + } + if ($strict) { + return mt_rand(pow(10, $nbDigits - 1), $max); + } + + return mt_rand(0, $max); + } + + /** + * Return a random float number + * + * @param int $nbMaxDecimals + * @param int|float $min + * @param int|float $max + * @example 48.8932 + * + * @return float + */ + public static function randomFloat($nbMaxDecimals = null, $min = 0, $max = null) + { + if (null === $nbMaxDecimals) { + $nbMaxDecimals = static::randomDigit(); + } + + if (null === $max) { + $max = static::randomNumber(); + if ($min > $max) { + $max = $min; + } + } + + if ($min > $max) { + $tmp = $min; + $min = $max; + $max = $tmp; + } + + return round($min + mt_rand() / mt_getrandmax() * ($max - $min), $nbMaxDecimals); + } + + /** + * Returns a random number between $int1 and $int2 (any order) + * + * @param integer $int1 default to 0 + * @param integer $int2 defaults to 32 bit max integer, ie 2147483647 + * @example 79907610 + * + * @return integer + */ + public static function numberBetween($int1 = 0, $int2 = 2147483647) + { + $min = $int1 < $int2 ? $int1 : $int2; + $max = $int1 < $int2 ? $int2 : $int1; + return mt_rand($min, $max); + } + + /** + * Returns the passed value + * + * @param mixed $value + * + * @return mixed + */ + public static function passthrough($value) + { + return $value; + } + + /** + * Returns a random letter from a to z + * + * @return string + */ + public static function randomLetter() + { + return chr(mt_rand(97, 122)); + } + + /** + * Returns a random ASCII character (excluding accents and special chars) + */ + public static function randomAscii() + { + return chr(mt_rand(33, 126)); + } + + /** + * Returns randomly ordered subsequence of $count elements from a provided array + * + * @param array $array Array to take elements from. Defaults to a-f + * @param integer $count Number of elements to take. + * @param boolean $allowDuplicates Allow elements to be picked several times. Defaults to false + * @throws \LengthException When requesting more elements than provided + * + * @return array New array with $count elements from $array + */ + public static function randomElements($array = array('a', 'b', 'c'), $count = 1, $allowDuplicates = false) + { + $traversables = array(); + + if ($array instanceof \Traversable) { + foreach ($array as $element) { + $traversables[] = $element; + } + } + + $arr = count($traversables) ? $traversables : $array; + + $allKeys = array_keys($arr); + $numKeys = count($allKeys); + + if (!$allowDuplicates && $numKeys < $count) { + throw new \LengthException(sprintf('Cannot get %d elements, only %d in array', $count, $numKeys)); + } + + $highKey = $numKeys - 1; + $keys = $elements = array(); + $numElements = 0; + + while ($numElements < $count) { + $num = mt_rand(0, $highKey); + + if (!$allowDuplicates) { + if (isset($keys[$num])) { + continue; + } + $keys[$num] = true; + } + + $elements[] = $arr[$allKeys[$num]]; + $numElements++; + } + + return $elements; + } + + /** + * Returns a random element from a passed array + * + * @param array $array + * @return mixed + */ + public static function randomElement($array = array('a', 'b', 'c')) + { + if (!$array || ($array instanceof \Traversable && !count($array))) { + return null; + } + $elements = static::randomElements($array, 1); + + return $elements[0]; + } + + /** + * Returns a random key from a passed associative array + * + * @param array $array + * @return int|string|null + */ + public static function randomKey($array = array()) + { + if (!$array) { + return null; + } + $keys = array_keys($array); + $key = $keys[mt_rand(0, count($keys) - 1)]; + + return $key; + } + + /** + * Returns a shuffled version of the argument. + * + * This function accepts either an array, or a string. + * + * @example $faker->shuffle([1, 2, 3]); // [2, 1, 3] + * @example $faker->shuffle('hello, world'); // 'rlo,h eold!lw' + * + * @see shuffleArray() + * @see shuffleString() + * + * @param array|string $arg The set to shuffle + * @return array|string The shuffled set + */ + public static function shuffle($arg = '') + { + if (is_array($arg)) { + return static::shuffleArray($arg); + } + if (is_string($arg)) { + return static::shuffleString($arg); + } + throw new \InvalidArgumentException('shuffle() only supports strings or arrays'); + } + + /** + * Returns a shuffled version of the array. + * + * This function does not mutate the original array. It uses the + * Fisher–Yates algorithm, which is unbiased, together with a Mersenne + * twister random generator. This function is therefore more random than + * PHP's shuffle() function, and it is seedable. + * + * @link http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle + * + * @example $faker->shuffleArray([1, 2, 3]); // [2, 1, 3] + * + * @param array $array The set to shuffle + * @return array The shuffled set + */ + public static function shuffleArray($array = array()) + { + $shuffledArray = array(); + $i = 0; + reset($array); + foreach ($array as $key => $value) { + if ($i == 0) { + $j = 0; + } else { + $j = mt_rand(0, $i); + } + if ($j == $i) { + $shuffledArray[]= $value; + } else { + $shuffledArray[]= $shuffledArray[$j]; + $shuffledArray[$j] = $value; + } + $i++; + } + return $shuffledArray; + } + + /** + * Returns a shuffled version of the string. + * + * This function does not mutate the original string. It uses the + * Fisher–Yates algorithm, which is unbiased, together with a Mersenne + * twister random generator. This function is therefore more random than + * PHP's shuffle() function, and it is seedable. Additionally, it is + * UTF8 safe if the mb extension is available. + * + * @link http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle + * + * @example $faker->shuffleString('hello, world'); // 'rlo,h eold!lw' + * + * @param string $string The set to shuffle + * @param string $encoding The string encoding (defaults to UTF-8) + * @return string The shuffled set + */ + public static function shuffleString($string = '', $encoding = 'UTF-8') + { + if (function_exists('mb_strlen')) { + // UTF8-safe str_split() + $array = array(); + $strlen = mb_strlen($string, $encoding); + for ($i = 0; $i < $strlen; $i++) { + $array []= mb_substr($string, $i, 1, $encoding); + } + } else { + $array = str_split($string, 1); + } + return implode('', static::shuffleArray($array)); + } + + private static function replaceWildcard($string, $wildcard = '#', $callback = 'static::randomDigit') + { + if (($pos = strpos($string, $wildcard)) === false) { + return $string; + } + for ($i = $pos, $last = strrpos($string, $wildcard, $pos) + 1; $i < $last; $i++) { + if ($string[$i] === $wildcard) { + $string[$i] = call_user_func($callback); + } + } + return $string; + } + + /** + * Replaces all hash sign ('#') occurrences with a random number + * Replaces all percentage sign ('%') occurrences with a not null number + * + * @param string $string String that needs to bet parsed + * @return string + */ + public static function numerify($string = '###') + { + // instead of using randomDigit() several times, which is slow, + // count the number of hashes and generate once a large number + $toReplace = array(); + if (($pos = strpos($string, '#')) !== false) { + for ($i = $pos, $last = strrpos($string, '#', $pos) + 1; $i < $last; $i++) { + if ($string[$i] === '#') { + $toReplace[] = $i; + } + } + } + if ($nbReplacements = count($toReplace)) { + $maxAtOnce = strlen((string) mt_getrandmax()) - 1; + $numbers = ''; + $i = 0; + while ($i < $nbReplacements) { + $size = min($nbReplacements - $i, $maxAtOnce); + $numbers .= str_pad(static::randomNumber($size), $size, '0', STR_PAD_LEFT); + $i += $size; + } + for ($i = 0; $i < $nbReplacements; $i++) { + $string[$toReplace[$i]] = $numbers[$i]; + } + } + $string = self::replaceWildcard($string, '%', 'static::randomDigitNotNull'); + + return $string; + } + + /** + * Replaces all question mark ('?') occurrences with a random letter + * + * @param string $string String that needs to bet parsed + * @return string + */ + public static function lexify($string = '????') + { + return self::replaceWildcard($string, '?', 'static::randomLetter'); + } + + /** + * Replaces hash signs ('#') and question marks ('?') with random numbers and letters + * An asterisk ('*') is replaced with either a random number or a random letter + * + * @param string $string String that needs to bet parsed + * @return string + */ + public static function bothify($string = '## ??') + { + $string = self::replaceWildcard($string, '*', function () { + return mt_rand(0, 1) ? '#' : '?'; + }); + return static::lexify(static::numerify($string)); + } + + /** + * Replaces * signs with random numbers and letters and special characters + * + * @example $faker->asciify(''********'); // "s5'G!uC3" + * + * @param string $string String that needs to bet parsed + * @return string + */ + public static function asciify($string = '****') + { + return preg_replace_callback('/\*/u', 'static::randomAscii', $string); + } + + /** + * Transforms a basic regular expression into a random string satisfying the expression. + * + * @example $faker->regexify('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}'); // sm0@y8k96a.ej + * + * Regex delimiters '/.../' and begin/end markers '^...$' are ignored. + * + * Only supports a small subset of the regex syntax. For instance, + * unicode, negated classes, unbounded ranges, subpatterns, back references, + * assertions, recursive patterns, and comments are not supported. Escaping + * support is extremely fragile. + * + * This method is also VERY slow. Use it only when no other formatter + * can generate the fake data you want. For instance, prefer calling + * `$faker->email` rather than `regexify` with the previous regular + * expression. + * + * Also note than `bothify` can probably do most of what this method does, + * but much faster. For instance, for a dummy email generation, try + * `$faker->bothify('?????????@???.???')`. + * + * @see https://github.com/icomefromthenet/ReverseRegex for a more robust implementation + * + * @param string $regex A regular expression (delimiters are optional) + * @return string + */ + public static function regexify($regex = '') + { + // ditch the anchors + $regex = preg_replace('/^\/?\^?/', '', $regex); + $regex = preg_replace('/\$?\/?$/', '', $regex); + // All {2} become {2,2} + $regex = preg_replace('/\{(\d+)\}/', '{\1,\1}', $regex); + // Single-letter quantifiers (?, *, +) become bracket quantifiers ({0,1}, {0,rand}, {1, rand}) + $regex = preg_replace('/(? 0 && $weight < 1 && mt_rand() / mt_getrandmax() <= $weight) { + return $this->generator; + } + + // new system with percentage + if (is_int($weight) && mt_rand(1, 100) <= $weight) { + return $this->generator; + } + + return new DefaultGenerator($default); + } + + /** + * Chainable method for making any formatter unique. + * + * + * // will never return twice the same value + * $faker->unique()->randomElement(array(1, 2, 3)); + * + * + * @param boolean $reset If set to true, resets the list of existing values + * @param integer $maxRetries Maximum number of retries to find a unique value, + * After which an OverflowException is thrown. + * @throws \OverflowException When no unique value can be found by iterating $maxRetries times + * + * @return UniqueGenerator A proxy class returning only non-existing values + */ + public function unique($reset = false, $maxRetries = 10000) + { + if ($reset || !$this->unique) { + $this->unique = new UniqueGenerator($this->generator, $maxRetries); + } + + return $this->unique; + } + + /** + * Chainable method for forcing any formatter to return only valid values. + * + * The value validity is determined by a function passed as first argument. + * + * + * $values = array(); + * $evenValidator = function ($digit) { + * return $digit % 2 === 0; + * }; + * for ($i=0; $i < 10; $i++) { + * $values []= $faker->valid($evenValidator)->randomDigit; + * } + * print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6] + * + * + * @param Closure $validator A function returning true for valid values + * @param integer $maxRetries Maximum number of retries to find a unique value, + * After which an OverflowException is thrown. + * @throws \OverflowException When no valid value can be found by iterating $maxRetries times + * + * @return ValidGenerator A proxy class returning only valid values + */ + public function valid($validator = null, $maxRetries = 10000) + { + return new ValidGenerator($this->generator, $validator, $maxRetries); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Biased.php b/vendor/fzaninotto/faker/src/Faker/Provider/Biased.php new file mode 100644 index 0000000..b9e3f08 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Biased.php @@ -0,0 +1,64 @@ +generator->parse($format); + } + + /** + * @example 'Ltd' + */ + public static function companySuffix() + { + return static::randomElement(static::$companySuffix); + } + + /** + * @example 'Job' + */ + public function jobTitle() + { + $format = static::randomElement(static::$jobTitleFormat); + + return $this->generator->parse($format); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/DateTime.php b/vendor/fzaninotto/faker/src/Faker/Provider/DateTime.php new file mode 100644 index 0000000..fb0f474 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/DateTime.php @@ -0,0 +1,340 @@ +getTimestamp(); + } + + return strtotime(empty($max) ? 'now' : $max); + } + + /** + * Get a timestamp between January 1, 1970 and now + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return int + * + * @example 1061306726 + */ + public static function unixTime($max = 'now') + { + return mt_rand(0, static::getMaxTimestamp($max)); + } + + /** + * Get a datetime object for a date between January 1, 1970 and now + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example DateTime('2005-08-16 20:39:21') + * @return \DateTime + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + */ + public static function dateTime($max = 'now', $timezone = null) + { + return static::setTimezone( + new \DateTime('@' . static::unixTime($max)), + $timezone + ); + } + + /** + * Get a datetime object for a date between January 1, 001 and now + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example DateTime('1265-03-22 21:15:52') + * @return \DateTime + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + */ + public static function dateTimeAD($max = 'now', $timezone = null) + { + $min = (PHP_INT_SIZE>4 ? -62135597361 : -PHP_INT_MAX); + return static::setTimezone( + new \DateTime('@' . mt_rand($min, static::getMaxTimestamp($max))), + $timezone + ); + } + + /** + * get a date string formatted with ISO8601 + * + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example '2003-10-21T16:05:52+0000' + */ + public static function iso8601($max = 'now') + { + return static::date(\DateTime::ISO8601, $max); + } + + /** + * Get a date string between January 1, 1970 and now + * + * @param string $format + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example '2008-11-27' + */ + public static function date($format = 'Y-m-d', $max = 'now') + { + return static::dateTime($max)->format($format); + } + + /** + * Get a time string (24h format by default) + * + * @param string $format + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example '15:02:34' + */ + public static function time($format = 'H:i:s', $max = 'now') + { + return static::dateTime($max)->format($format); + } + + /** + * Get a DateTime object based on a random date between two given dates. + * Accepts date strings that can be recognized by strtotime(). + * + * @param \DateTime|string $startDate Defaults to 30 years ago + * @param \DateTime|string $endDate Defaults to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example DateTime('1999-02-02 11:42:52') + * @return \DateTime + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + */ + public static function dateTimeBetween($startDate = '-30 years', $endDate = 'now', $timezone = null) + { + $startTimestamp = $startDate instanceof \DateTime ? $startDate->getTimestamp() : strtotime($startDate); + $endTimestamp = static::getMaxTimestamp($endDate); + + if ($startTimestamp > $endTimestamp) { + throw new \InvalidArgumentException('Start date must be anterior to end date.'); + } + + $timestamp = mt_rand($startTimestamp, $endTimestamp); + + return static::setTimezone( + new \DateTime('@' . $timestamp), + $timezone + ); + } + + /** + * Get a DateTime object based on a random date between one given date and + * an interval + * Accepts date string that can be recognized by strtotime(). + * + * @param string $date Defaults to 30 years ago + * @param string $interval Defaults to 5 days after + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example dateTimeInInterval('1999-02-02 11:42:52', '+ 5 days') + * @return \DateTime + * @see http://php.net/manual/en/timezones.php + * @see http://php.net/manual/en/function.date-default-timezone-get.php + */ + public static function dateTimeInInterval($date = '-30 years', $interval = '+5 days', $timezone = null) + { + $intervalObject = \DateInterval::createFromDateString($interval); + $datetime = $date instanceof \DateTime ? $date : new \DateTime($date); + $otherDatetime = clone $datetime; + $otherDatetime->add($intervalObject); + + $begin = $datetime > $otherDatetime ? $otherDatetime : $datetime; + $end = $datetime===$begin ? $otherDatetime : $datetime; + + return static::dateTimeBetween( + $begin, + $end, + $timezone + ); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example DateTime('1964-04-04 11:02:02') + * @return \DateTime + */ + public static function dateTimeThisCentury($max = 'now', $timezone = null) + { + return static::dateTimeBetween('-100 year', $max, $timezone); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example DateTime('2010-03-10 05:18:58') + * @return \DateTime + */ + public static function dateTimeThisDecade($max = 'now', $timezone = null) + { + return static::dateTimeBetween('-10 year', $max, $timezone); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example DateTime('2011-09-19 09:24:37') + * @return \DateTime + */ + public static function dateTimeThisYear($max = 'now', $timezone = null) + { + return static::dateTimeBetween('-1 year', $max, $timezone); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @param string|null $timezone time zone in which the date time should be set, default to DateTime::$defaultTimezone, if set, otherwise the result of `date_default_timezone_get` + * @example DateTime('2011-10-05 12:51:46') + * @return \DateTime + */ + public static function dateTimeThisMonth($max = 'now', $timezone = null) + { + return static::dateTimeBetween('-1 month', $max, $timezone); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example 'am' + */ + public static function amPm($max = 'now') + { + return static::dateTime($max)->format('a'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example '22' + */ + public static function dayOfMonth($max = 'now') + { + return static::dateTime($max)->format('d'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example 'Tuesday' + */ + public static function dayOfWeek($max = 'now') + { + return static::dateTime($max)->format('l'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example '7' + */ + public static function month($max = 'now') + { + return static::dateTime($max)->format('m'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example 'September' + */ + public static function monthName($max = 'now') + { + return static::dateTime($max)->format('F'); + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example '1673' + */ + public static function year($max = 'now') + { + return static::dateTime($max)->format('Y'); + } + + /** + * @return string + * @example 'XVII' + */ + public static function century() + { + return static::randomElement(static::$century); + } + + /** + * @return string + * @example 'Europe/Paris' + */ + public static function timezone() + { + return static::randomElement(\DateTimeZone::listIdentifiers()); + } + + /** + * Internal method to set the time zone on a DateTime. + * + * @param \DateTime $dt + * @param string|null $timezone + * + * @return \DateTime + */ + private static function setTimezone(\DateTime $dt, $timezone) + { + return $dt->setTimezone(new \DateTimeZone(static::resolveTimezone($timezone))); + } + + /** + * Sets default time zone. + * + * @param string $timezone + * + * @return void + */ + public static function setDefaultTimezone($timezone = null) + { + static::$defaultTimezone = $timezone; + } + + /** + * Gets default time zone. + * + * @return string|null + */ + public static function getDefaultTimezone() + { + return static::$defaultTimezone; + } + + /** + * @param string|null $timezone + * @return null|string + */ + private static function resolveTimezone($timezone) + { + return ((null === $timezone) ? ((null === static::$defaultTimezone) ? date_default_timezone_get() : static::$defaultTimezone) : $timezone); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/File.php b/vendor/fzaninotto/faker/src/Faker/Provider/File.php new file mode 100644 index 0000000..ba01594 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/File.php @@ -0,0 +1,606 @@ + file extension(s) + * @link http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types + */ + protected static $mimeTypes = array( + 'application/atom+xml' => 'atom', + 'application/ecmascript' => 'ecma', + 'application/emma+xml' => 'emma', + 'application/epub+zip' => 'epub', + 'application/java-archive' => 'jar', + 'application/java-vm' => 'class', + 'application/javascript' => 'js', + 'application/json' => 'json', + 'application/jsonml+json' => 'jsonml', + 'application/lost+xml' => 'lostxml', + 'application/mathml+xml' => 'mathml', + 'application/mets+xml' => 'mets', + 'application/mods+xml' => 'mods', + 'application/mp4' => 'mp4s', + 'application/msword' => array('doc', 'dot'), + 'application/octet-stream' => array( + 'bin', + 'dms', + 'lrf', + 'mar', + 'so', + 'dist', + 'distz', + 'pkg', + 'bpk', + 'dump', + 'elc', + 'deploy' + ), + 'application/ogg' => 'ogx', + 'application/omdoc+xml' => 'omdoc', + 'application/pdf' => 'pdf', + 'application/pgp-encrypted' => 'pgp', + 'application/pgp-signature' => array('asc', 'sig'), + 'application/pkix-pkipath' => 'pkipath', + 'application/pkixcmp' => 'pki', + 'application/pls+xml' => 'pls', + 'application/postscript' => array('ai', 'eps', 'ps'), + 'application/pskc+xml' => 'pskcxml', + 'application/rdf+xml' => 'rdf', + 'application/reginfo+xml' => 'rif', + 'application/rss+xml' => 'rss', + 'application/rtf' => 'rtf', + 'application/sbml+xml' => 'sbml', + 'application/vnd.adobe.air-application-installer-package+zip' => 'air', + 'application/vnd.adobe.xdp+xml' => 'xdp', + 'application/vnd.adobe.xfdf' => 'xfdf', + 'application/vnd.ahead.space' => 'ahead', + 'application/vnd.dart' => 'dart', + 'application/vnd.data-vision.rdz' => 'rdz', + 'application/vnd.dece.data' => array('uvf', 'uvvf', 'uvd', 'uvvd'), + 'application/vnd.dece.ttml+xml' => array('uvt', 'uvvt'), + 'application/vnd.dece.unspecified' => array('uvx', 'uvvx'), + 'application/vnd.dece.zip' => array('uvz', 'uvvz'), + 'application/vnd.denovo.fcselayout-link' => 'fe_launch', + 'application/vnd.dna' => 'dna', + 'application/vnd.dolby.mlp' => 'mlp', + 'application/vnd.dpgraph' => 'dpg', + 'application/vnd.dreamfactory' => 'dfac', + 'application/vnd.ds-keypoint' => 'kpxx', + 'application/vnd.dvb.ait' => 'ait', + 'application/vnd.dvb.service' => 'svc', + 'application/vnd.dynageo' => 'geo', + 'application/vnd.ecowin.chart' => 'mag', + 'application/vnd.enliven' => 'nml', + 'application/vnd.epson.esf' => 'esf', + 'application/vnd.epson.msf' => 'msf', + 'application/vnd.epson.quickanime' => 'qam', + 'application/vnd.epson.salt' => 'slt', + 'application/vnd.epson.ssf' => 'ssf', + 'application/vnd.ezpix-album' => 'ez2', + 'application/vnd.ezpix-package' => 'ez3', + 'application/vnd.fdf' => 'fdf', + 'application/vnd.fdsn.mseed' => 'mseed', + 'application/vnd.fdsn.seed' => array('seed', 'dataless'), + 'application/vnd.flographit' => 'gph', + 'application/vnd.fluxtime.clip' => 'ftc', + 'application/vnd.hal+xml' => 'hal', + 'application/vnd.hydrostatix.sof-data' => 'sfd-hdstx', + 'application/vnd.ibm.minipay' => 'mpy', + 'application/vnd.ibm.secure-container' => 'sc', + 'application/vnd.iccprofile' => array('icc', 'icm'), + 'application/vnd.igloader' => 'igl', + 'application/vnd.immervision-ivp' => 'ivp', + 'application/vnd.kde.karbon' => 'karbon', + 'application/vnd.kde.kchart' => 'chrt', + 'application/vnd.kde.kformula' => 'kfo', + 'application/vnd.kde.kivio' => 'flw', + 'application/vnd.kde.kontour' => 'kon', + 'application/vnd.kde.kpresenter' => array('kpr', 'kpt'), + 'application/vnd.kde.kspread' => 'ksp', + 'application/vnd.kde.kword' => array('kwd', 'kwt'), + 'application/vnd.kenameaapp' => 'htke', + 'application/vnd.kidspiration' => 'kia', + 'application/vnd.kinar' => array('kne', 'knp'), + 'application/vnd.koan' => array('skp', 'skd', 'skt', 'skm'), + 'application/vnd.kodak-descriptor' => 'sse', + 'application/vnd.las.las+xml' => 'lasxml', + 'application/vnd.llamagraphics.life-balance.desktop' => 'lbd', + 'application/vnd.llamagraphics.life-balance.exchange+xml' => 'lbe', + 'application/vnd.lotus-1-2-3' => '123', + 'application/vnd.lotus-approach' => 'apr', + 'application/vnd.lotus-freelance' => 'pre', + 'application/vnd.lotus-notes' => 'nsf', + 'application/vnd.lotus-organizer' => 'org', + 'application/vnd.lotus-screencam' => 'scm', + 'application/vnd.mozilla.xul+xml' => 'xul', + 'application/vnd.ms-artgalry' => 'cil', + 'application/vnd.ms-cab-compressed' => 'cab', + 'application/vnd.ms-excel' => array( + 'xls', + 'xlm', + 'xla', + 'xlc', + 'xlt', + 'xlw' + ), + 'application/vnd.ms-excel.addin.macroenabled.12' => 'xlam', + 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => 'xlsb', + 'application/vnd.ms-excel.sheet.macroenabled.12' => 'xlsm', + 'application/vnd.ms-excel.template.macroenabled.12' => 'xltm', + 'application/vnd.ms-fontobject' => 'eot', + 'application/vnd.ms-htmlhelp' => 'chm', + 'application/vnd.ms-ims' => 'ims', + 'application/vnd.ms-lrm' => 'lrm', + 'application/vnd.ms-officetheme' => 'thmx', + 'application/vnd.ms-pki.seccat' => 'cat', + 'application/vnd.ms-pki.stl' => 'stl', + 'application/vnd.ms-powerpoint' => array('ppt', 'pps', 'pot'), + 'application/vnd.ms-powerpoint.addin.macroenabled.12' => 'ppam', + 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => 'pptm', + 'application/vnd.ms-powerpoint.slide.macroenabled.12' => 'sldm', + 'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => 'ppsm', + 'application/vnd.ms-powerpoint.template.macroenabled.12' => 'potm', + 'application/vnd.ms-project' => array('mpp', 'mpt'), + 'application/vnd.ms-word.document.macroenabled.12' => 'docm', + 'application/vnd.ms-word.template.macroenabled.12' => 'dotm', + 'application/vnd.ms-works' => array('wps', 'wks', 'wcm', 'wdb'), + 'application/vnd.ms-wpl' => 'wpl', + 'application/vnd.ms-xpsdocument' => 'xps', + 'application/vnd.mseq' => 'mseq', + 'application/vnd.musician' => 'mus', + 'application/vnd.oasis.opendocument.chart' => 'odc', + 'application/vnd.oasis.opendocument.chart-template' => 'otc', + 'application/vnd.oasis.opendocument.database' => 'odb', + 'application/vnd.oasis.opendocument.formula' => 'odf', + 'application/vnd.oasis.opendocument.formula-template' => 'odft', + 'application/vnd.oasis.opendocument.graphics' => 'odg', + 'application/vnd.oasis.opendocument.graphics-template' => 'otg', + 'application/vnd.oasis.opendocument.image' => 'odi', + 'application/vnd.oasis.opendocument.image-template' => 'oti', + 'application/vnd.oasis.opendocument.presentation' => 'odp', + 'application/vnd.oasis.opendocument.presentation-template' => 'otp', + 'application/vnd.oasis.opendocument.spreadsheet' => 'ods', + 'application/vnd.oasis.opendocument.spreadsheet-template' => 'ots', + 'application/vnd.oasis.opendocument.text' => 'odt', + 'application/vnd.oasis.opendocument.text-master' => 'odm', + 'application/vnd.oasis.opendocument.text-template' => 'ott', + 'application/vnd.oasis.opendocument.text-web' => 'oth', + 'application/vnd.olpc-sugar' => 'xo', + 'application/vnd.oma.dd2+xml' => 'dd2', + 'application/vnd.openofficeorg.extension' => 'oxt', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx', + 'application/vnd.openxmlformats-officedocument.presentationml.slide' => 'sldx', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'ppsx', + 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'potx', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'xltx', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'dotx', + 'application/vnd.pvi.ptid1' => 'ptid', + 'application/vnd.quark.quarkxpress' => array( + 'qxd', + 'qxt', + 'qwd', + 'qwt', + 'qxl', + 'qxb' + ), + 'application/vnd.realvnc.bed' => 'bed', + 'application/vnd.recordare.musicxml' => 'mxl', + 'application/vnd.recordare.musicxml+xml' => 'musicxml', + 'application/vnd.rig.cryptonote' => 'cryptonote', + 'application/vnd.rim.cod' => 'cod', + 'application/vnd.rn-realmedia' => 'rm', + 'application/vnd.rn-realmedia-vbr' => 'rmvb', + 'application/vnd.route66.link66+xml' => 'link66', + 'application/vnd.sailingtracker.track' => 'st', + 'application/vnd.seemail' => 'see', + 'application/vnd.sema' => 'sema', + 'application/vnd.semd' => 'semd', + 'application/vnd.semf' => 'semf', + 'application/vnd.shana.informed.formdata' => 'ifm', + 'application/vnd.shana.informed.formtemplate' => 'itp', + 'application/vnd.shana.informed.interchange' => 'iif', + 'application/vnd.shana.informed.package' => 'ipk', + 'application/vnd.simtech-mindmapper' => array('twd', 'twds'), + 'application/vnd.smaf' => 'mmf', + 'application/vnd.stepmania.stepchart' => 'sm', + 'application/vnd.sun.xml.calc' => 'sxc', + 'application/vnd.sun.xml.calc.template' => 'stc', + 'application/vnd.sun.xml.draw' => 'sxd', + 'application/vnd.sun.xml.draw.template' => 'std', + 'application/vnd.sun.xml.impress' => 'sxi', + 'application/vnd.sun.xml.impress.template' => 'sti', + 'application/vnd.sun.xml.math' => 'sxm', + 'application/vnd.sun.xml.writer' => 'sxw', + 'application/vnd.sun.xml.writer.global' => 'sxg', + 'application/vnd.sun.xml.writer.template' => 'stw', + 'application/vnd.sus-calendar' => array('sus', 'susp'), + 'application/vnd.svd' => 'svd', + 'application/vnd.symbian.install' => array('sis', 'sisx'), + 'application/vnd.syncml+xml' => 'xsm', + 'application/vnd.syncml.dm+wbxml' => 'bdm', + 'application/vnd.syncml.dm+xml' => 'xdm', + 'application/vnd.tao.intent-module-archive' => 'tao', + 'application/vnd.tcpdump.pcap' => array('pcap', 'cap', 'dmp'), + 'application/vnd.tmobile-livetv' => 'tmo', + 'application/vnd.trid.tpt' => 'tpt', + 'application/vnd.triscape.mxs' => 'mxs', + 'application/vnd.trueapp' => 'tra', + 'application/vnd.ufdl' => array('ufd', 'ufdl'), + 'application/vnd.uiq.theme' => 'utz', + 'application/vnd.umajin' => 'umj', + 'application/vnd.unity' => 'unityweb', + 'application/vnd.uoml+xml' => 'uoml', + 'application/vnd.vcx' => 'vcx', + 'application/vnd.visio' => array('vsd', 'vst', 'vss', 'vsw'), + 'application/vnd.visionary' => 'vis', + 'application/vnd.vsf' => 'vsf', + 'application/vnd.wap.wbxml' => 'wbxml', + 'application/vnd.wap.wmlc' => 'wmlc', + 'application/vnd.wap.wmlscriptc' => 'wmlsc', + 'application/vnd.webturbo' => 'wtb', + 'application/vnd.wolfram.player' => 'nbp', + 'application/vnd.wordperfect' => 'wpd', + 'application/vnd.wqd' => 'wqd', + 'application/vnd.wt.stf' => 'stf', + 'application/vnd.xara' => 'xar', + 'application/vnd.xfdl' => 'xfdl', + 'application/voicexml+xml' => 'vxml', + 'application/widget' => 'wgt', + 'application/winhlp' => 'hlp', + 'application/wsdl+xml' => 'wsdl', + 'application/wspolicy+xml' => 'wspolicy', + 'application/x-7z-compressed' => '7z', + 'application/x-bittorrent' => 'torrent', + 'application/x-blorb' => array('blb', 'blorb'), + 'application/x-bzip' => 'bz', + 'application/x-cdlink' => 'vcd', + 'application/x-cfs-compressed' => 'cfs', + 'application/x-chat' => 'chat', + 'application/x-chess-pgn' => 'pgn', + 'application/x-conference' => 'nsc', + 'application/x-cpio' => 'cpio', + 'application/x-csh' => 'csh', + 'application/x-debian-package' => array('deb', 'udeb'), + 'application/x-dgc-compressed' => 'dgc', + 'application/x-director' => array( + 'dir', + 'dcr', + 'dxr', + 'cst', + 'cct', + 'cxt', + 'w3d', + 'fgd', + 'swa' + ), + 'application/x-font-ttf' => array('ttf', 'ttc'), + 'application/x-font-type1' => array('pfa', 'pfb', 'pfm', 'afm'), + 'application/x-font-woff' => 'woff', + 'application/x-freearc' => 'arc', + 'application/x-futuresplash' => 'spl', + 'application/x-gca-compressed' => 'gca', + 'application/x-glulx' => 'ulx', + 'application/x-gnumeric' => 'gnumeric', + 'application/x-gramps-xml' => 'gramps', + 'application/x-gtar' => 'gtar', + 'application/x-hdf' => 'hdf', + 'application/x-install-instructions' => 'install', + 'application/x-iso9660-image' => 'iso', + 'application/x-java-jnlp-file' => 'jnlp', + 'application/x-latex' => 'latex', + 'application/x-lzh-compressed' => array('lzh', 'lha'), + 'application/x-mie' => 'mie', + 'application/x-mobipocket-ebook' => array('prc', 'mobi'), + 'application/x-ms-application' => 'application', + 'application/x-ms-shortcut' => 'lnk', + 'application/x-ms-wmd' => 'wmd', + 'application/x-ms-wmz' => 'wmz', + 'application/x-ms-xbap' => 'xbap', + 'application/x-msaccess' => 'mdb', + 'application/x-msbinder' => 'obd', + 'application/x-mscardfile' => 'crd', + 'application/x-msclip' => 'clp', + 'application/x-msdownload' => array('exe', 'dll', 'com', 'bat', 'msi'), + 'application/x-msmediaview' => array( + 'mvb', + 'm13', + 'm14' + ), + 'application/x-msmetafile' => array('wmf', 'wmz', 'emf', 'emz'), + 'application/x-rar-compressed' => 'rar', + 'application/x-research-info-systems' => 'ris', + 'application/x-sh' => 'sh', + 'application/x-shar' => 'shar', + 'application/x-shockwave-flash' => 'swf', + 'application/x-silverlight-app' => 'xap', + 'application/x-sql' => 'sql', + 'application/x-stuffit' => 'sit', + 'application/x-stuffitx' => 'sitx', + 'application/x-subrip' => 'srt', + 'application/x-sv4cpio' => 'sv4cpio', + 'application/x-sv4crc' => 'sv4crc', + 'application/x-t3vm-image' => 't3', + 'application/x-tads' => 'gam', + 'application/x-tar' => 'tar', + 'application/x-tcl' => 'tcl', + 'application/x-tex' => 'tex', + 'application/x-tex-tfm' => 'tfm', + 'application/x-texinfo' => array('texinfo', 'texi'), + 'application/x-tgif' => 'obj', + 'application/x-ustar' => 'ustar', + 'application/x-wais-source' => 'src', + 'application/x-x509-ca-cert' => array('der', 'crt'), + 'application/x-xfig' => 'fig', + 'application/x-xliff+xml' => 'xlf', + 'application/x-xpinstall' => 'xpi', + 'application/x-xz' => 'xz', + 'application/x-zmachine' => 'z1', + 'application/xaml+xml' => 'xaml', + 'application/xcap-diff+xml' => 'xdf', + 'application/xenc+xml' => 'xenc', + 'application/xhtml+xml' => array('xhtml', 'xht'), + 'application/xml' => array('xml', 'xsl'), + 'application/xml-dtd' => 'dtd', + 'application/xop+xml' => 'xop', + 'application/xproc+xml' => 'xpl', + 'application/xslt+xml' => 'xslt', + 'application/xspf+xml' => 'xspf', + 'application/xv+xml' => array('mxml', 'xhvml', 'xvml', 'xvm'), + 'application/yang' => 'yang', + 'application/yin+xml' => 'yin', + 'application/zip' => 'zip', + 'audio/adpcm' => 'adp', + 'audio/basic' => array('au', 'snd'), + 'audio/midi' => array('mid', 'midi', 'kar', 'rmi'), + 'audio/mp4' => 'mp4a', + 'audio/mpeg' => array( + 'mpga', + 'mp2', + 'mp2a', + 'mp3', + 'm2a', + 'm3a' + ), + 'audio/ogg' => array('oga', 'ogg', 'spx'), + 'audio/vnd.dece.audio' => array('uva', 'uvva'), + 'audio/vnd.rip' => 'rip', + 'audio/webm' => 'weba', + 'audio/x-aac' => 'aac', + 'audio/x-aiff' => array('aif', 'aiff', 'aifc'), + 'audio/x-caf' => 'caf', + 'audio/x-flac' => 'flac', + 'audio/x-matroska' => 'mka', + 'audio/x-mpegurl' => 'm3u', + 'audio/x-ms-wax' => 'wax', + 'audio/x-ms-wma' => 'wma', + 'audio/x-pn-realaudio' => array('ram', 'ra'), + 'audio/x-pn-realaudio-plugin' => 'rmp', + 'audio/x-wav' => 'wav', + 'audio/xm' => 'xm', + 'image/bmp' => 'bmp', + 'image/cgm' => 'cgm', + 'image/g3fax' => 'g3', + 'image/gif' => 'gif', + 'image/ief' => 'ief', + 'image/jpeg' => array('jpeg', 'jpg', 'jpe'), + 'image/ktx' => 'ktx', + 'image/png' => 'png', + 'image/prs.btif' => 'btif', + 'image/sgi' => 'sgi', + 'image/svg+xml' => array('svg', 'svgz'), + 'image/tiff' => array('tiff', 'tif'), + 'image/vnd.adobe.photoshop' => 'psd', + 'image/vnd.dece.graphic' => array('uvi', 'uvvi', 'uvg', 'uvvg'), + 'image/vnd.dvb.subtitle' => 'sub', + 'image/vnd.djvu' => array('djvu', 'djv'), + 'image/vnd.dwg' => 'dwg', + 'image/vnd.dxf' => 'dxf', + 'image/vnd.fastbidsheet' => 'fbs', + 'image/vnd.fpx' => 'fpx', + 'image/vnd.fst' => 'fst', + 'image/vnd.fujixerox.edmics-mmr' => 'mmr', + 'image/vnd.fujixerox.edmics-rlc' => 'rlc', + 'image/vnd.ms-modi' => 'mdi', + 'image/vnd.ms-photo' => 'wdp', + 'image/vnd.net-fpx' => 'npx', + 'image/vnd.wap.wbmp' => 'wbmp', + 'image/vnd.xiff' => 'xif', + 'image/webp' => 'webp', + 'image/x-3ds' => '3ds', + 'image/x-cmu-raster' => 'ras', + 'image/x-cmx' => 'cmx', + 'image/x-freehand' => array('fh', 'fhc', 'fh4', 'fh5', 'fh7'), + 'image/x-icon' => 'ico', + 'image/x-mrsid-image' => 'sid', + 'image/x-pcx' => 'pcx', + 'image/x-pict' => array('pic', 'pct'), + 'image/x-portable-anymap' => 'pnm', + 'image/x-portable-bitmap' => 'pbm', + 'image/x-portable-graymap' => 'pgm', + 'image/x-portable-pixmap' => 'ppm', + 'image/x-rgb' => 'rgb', + 'image/x-tga' => 'tga', + 'image/x-xbitmap' => 'xbm', + 'image/x-xpixmap' => 'xpm', + 'image/x-xwindowdump' => 'xwd', + 'message/rfc822' => array('eml', 'mime'), + 'model/iges' => array('igs', 'iges'), + 'model/mesh' => array('msh', 'mesh', 'silo'), + 'model/vnd.collada+xml' => 'dae', + 'model/vnd.dwf' => 'dwf', + 'model/vnd.gdl' => 'gdl', + 'model/vnd.gtw' => 'gtw', + 'model/vnd.mts' => 'mts', + 'model/vnd.vtu' => 'vtu', + 'model/vrml' => array('wrl', 'vrml'), + 'model/x3d+binary' => 'x3db', + 'model/x3d+vrml' => 'x3dv', + 'model/x3d+xml' => 'x3d', + 'text/cache-manifest' => 'appcache', + 'text/calendar' => array('ics', 'ifb'), + 'text/css' => 'css', + 'text/csv' => 'csv', + 'text/html' => array('html', 'htm'), + 'text/n3' => 'n3', + 'text/plain' => array( + 'txt', + 'text', + 'conf', + 'def', + 'list', + 'log', + 'in' + ), + 'text/prs.lines.tag' => 'dsc', + 'text/richtext' => 'rtx', + 'text/sgml' => array('sgml', 'sgm'), + 'text/tab-separated-values' => 'tsv', + 'text/troff' => array( + 't', + 'tr', + 'roff', + 'man', + 'me', + 'ms' + ), + 'text/turtle' => 'ttl', + 'text/uri-list' => array('uri', 'uris', 'urls'), + 'text/vcard' => 'vcard', + 'text/vnd.curl' => 'curl', + 'text/vnd.curl.dcurl' => 'dcurl', + 'text/vnd.curl.scurl' => 'scurl', + 'text/vnd.curl.mcurl' => 'mcurl', + 'text/vnd.dvb.subtitle' => 'sub', + 'text/vnd.fly' => 'fly', + 'text/vnd.fmi.flexstor' => 'flx', + 'text/vnd.graphviz' => 'gv', + 'text/vnd.in3d.3dml' => '3dml', + 'text/vnd.in3d.spot' => 'spot', + 'text/vnd.sun.j2me.app-descriptor' => 'jad', + 'text/vnd.wap.wml' => 'wml', + 'text/vnd.wap.wmlscript' => 'wmls', + 'text/x-asm' => array('s', 'asm'), + 'text/x-fortran' => array('f', 'for', 'f77', 'f90'), + 'text/x-java-source' => 'java', + 'text/x-opml' => 'opml', + 'text/x-pascal' => array('p', 'pas'), + 'text/x-nfo' => 'nfo', + 'text/x-setext' => 'etx', + 'text/x-sfv' => 'sfv', + 'text/x-uuencode' => 'uu', + 'text/x-vcalendar' => 'vcs', + 'text/x-vcard' => 'vcf', + 'video/3gpp' => '3gp', + 'video/3gpp2' => '3g2', + 'video/h261' => 'h261', + 'video/h263' => 'h263', + 'video/h264' => 'h264', + 'video/jpeg' => 'jpgv', + 'video/jpm' => array('jpm', 'jpgm'), + 'video/mj2' => 'mj2', + 'video/mp4' => 'mp4', + 'video/mpeg' => array('mpeg', 'mpg', 'mpe', 'm1v', 'm2v'), + 'video/ogg' => 'ogv', + 'video/quicktime' => array('qt', 'mov'), + 'video/vnd.dece.hd' => array('uvh', 'uvvh'), + 'video/vnd.dece.mobile' => array('uvm', 'uvvm'), + 'video/vnd.dece.pd' => array('uvp', 'uvvp'), + 'video/vnd.dece.sd' => array('uvs', 'uvvs'), + 'video/vnd.dece.video' => array('uvv', 'uvvv'), + 'video/vnd.dvb.file' => 'dvb', + 'video/vnd.fvt' => 'fvt', + 'video/vnd.mpegurl' => array('mxu', 'm4u'), + 'video/vnd.ms-playready.media.pyv' => 'pyv', + 'video/vnd.uvvu.mp4' => array('uvu', 'uvvu'), + 'video/vnd.vivo' => 'viv', + 'video/webm' => 'webm', + 'video/x-f4v' => 'f4v', + 'video/x-fli' => 'fli', + 'video/x-flv' => 'flv', + 'video/x-m4v' => 'm4v', + 'video/x-matroska' => array('mkv', 'mk3d', 'mks'), + 'video/x-mng' => 'mng', + 'video/x-ms-asf' => array('asf', 'asx'), + 'video/x-ms-vob' => 'vob', + 'video/x-ms-wm' => 'wm', + 'video/x-ms-wmv' => 'wmv', + 'video/x-ms-wmx' => 'wmx', + 'video/x-ms-wvx' => 'wvx', + 'video/x-msvideo' => 'avi', + 'video/x-sgi-movie' => 'movie', + ); + + /** + * Get a random MIME type + * + * @return string + * @example 'video/avi' + */ + public static function mimeType() + { + return static::randomElement(array_keys(static::$mimeTypes)); + } + + /** + * Get a random file extension (without a dot) + * + * @example avi + * @return string + */ + public static function fileExtension() + { + $random_extension = static::randomElement(array_values(static::$mimeTypes)); + + return is_array($random_extension) ? static::randomElement($random_extension) : $random_extension; + } + + /** + * Copy a random file from the source directory to the target directory and returns the filename/fullpath + * + * @param string $sourceDirectory The directory to look for random file taking + * @param string $targetDirectory + * @param boolean $fullPath Whether to have the full path or just the filename + * @return string + */ + public static function file($sourceDirectory = '/tmp', $targetDirectory = '/tmp', $fullPath = true) + { + if (!is_dir($sourceDirectory)) { + throw new \InvalidArgumentException(sprintf('Source directory %s does not exist or is not a directory.', $sourceDirectory)); + } + + if (!is_dir($targetDirectory)) { + throw new \InvalidArgumentException(sprintf('Target directory %s does not exist or is not a directory.', $targetDirectory)); + } + + if ($sourceDirectory == $targetDirectory) { + throw new \InvalidArgumentException('Source and target directories must differ.'); + } + + // Drop . and .. and reset array keys + $files = array_filter(array_values(array_diff(scandir($sourceDirectory), array('.', '..'))), function ($file) use ($sourceDirectory) { + return is_file($sourceDirectory . DIRECTORY_SEPARATOR . $file) && is_readable($sourceDirectory . DIRECTORY_SEPARATOR . $file); + }); + + if (empty($files)) { + throw new \InvalidArgumentException(sprintf('Source directory %s is empty.', $sourceDirectory)); + } + + $sourceFullPath = $sourceDirectory . DIRECTORY_SEPARATOR . static::randomElement($files); + + $destinationFile = Uuid::uuid() . '.' . pathinfo($sourceFullPath, PATHINFO_EXTENSION); + $destinationFullPath = $targetDirectory . DIRECTORY_SEPARATOR . $destinationFile; + + if (false === copy($sourceFullPath, $destinationFullPath)) { + return false; + } + + return $fullPath ? $destinationFullPath : $destinationFile; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/HtmlLorem.php b/vendor/fzaninotto/faker/src/Faker/Provider/HtmlLorem.php new file mode 100644 index 0000000..b4b2ec1 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/HtmlLorem.php @@ -0,0 +1,277 @@ +addProvider(new Lorem($generator)); + $generator->addProvider(new Internet($generator)); + } + + /** + * @param integer $maxDepth + * @param integer $maxWidth + * + * @return string + */ + public function randomHtml($maxDepth = 4, $maxWidth = 4) + { + $document = new \DOMDocument(); + $this->idGenerator = new UniqueGenerator($this->generator); + + $head = $document->createElement("head"); + $this->addRandomTitle($head); + + $body = $document->createElement("body"); + $this->addLoginForm($body); + $this->addRandomSubTree($body, $maxDepth, $maxWidth); + + $html = $document->createElement("html"); + $html->appendChild($head); + $html->appendChild($body); + + $document->appendChild($html); + return $document->saveHTML(); + } + + private function addRandomSubTree(\DOMElement $root, $maxDepth, $maxWidth) + { + $maxDepth--; + if ($maxDepth <= 0) { + return $root; + } + + $siblings = mt_rand(1, $maxWidth); + for ($i = 0; $i < $siblings; $i++) { + if ($maxDepth == 1) { + $this->addRandomLeaf($root); + } else { + $sibling = $root->ownerDocument->createElement("div"); + $root->appendChild($sibling); + $this->addRandomAttribute($sibling); + $this->addRandomSubTree($sibling, mt_rand(0, $maxDepth), $maxWidth); + } + }; + return $root; + } + + private function addRandomLeaf(\DOMElement $node) + { + $rand = mt_rand(1, 10); + switch($rand){ + case 1: + $this->addRandomP($node); + break; + case 2: + $this->addRandomA($node); + break; + case 3: + $this->addRandomSpan($node); + break; + case 4: + $this->addRandomUL($node); + break; + case 5: + $this->addRandomH($node); + break; + case 6: + $this->addRandomB($node); + break; + case 7: + $this->addRandomI($node); + break; + case 8: + $this->addRandomTable($node); + break; + default: + $this->addRandomText($node); + break; + } + } + + private function addRandomAttribute(\DOMElement $node) + { + $rand = mt_rand(1, 2); + switch ($rand) { + case 1: + $node->setAttribute("class", $this->generator->word); + break; + case 2: + $node->setAttribute("id", (string)$this->idGenerator->randomNumber(5)); + break; + } + } + + private function addRandomP(\DOMElement $element, $maxLength = 10) + { + + $node = $element->ownerDocument->createElement(static::P_TAG); + $node->textContent = $this->generator->sentence(mt_rand(1, $maxLength)); + $element->appendChild($node); + } + + private function addRandomText(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength))); + $element->appendChild($text); + } + + private function addRandomA(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::A_TAG); + $node->setAttribute("href", $this->generator->safeEmailDomain); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomTitle(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::TITLE_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomH(\DOMElement $element, $maxLength = 10) + { + $h = static::H_TAG . (string)mt_rand(1, 3); + $text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength))); + $node = $element->ownerDocument->createElement($h); + $node->appendChild($text); + $element->appendChild($node); + + } + + private function addRandomB(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::B_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomI(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::I_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addRandomSpan(\DOMElement $element, $maxLength = 10) + { + $text = $element->ownerDocument->createTextNode($this->generator->sentence(mt_rand(1, $maxLength))); + $node = $element->ownerDocument->createElement(static::SPAN_TAG); + $node->appendChild($text); + $element->appendChild($node); + } + + private function addLoginForm(\DOMElement $element) + { + + $textInput = $element->ownerDocument->createElement(static::INPUT_TAG); + $textInput->setAttribute("type", "text"); + $textInput->setAttribute("id", "username"); + + $textLabel = $element->ownerDocument->createElement(static::LABEL_TAG); + $textLabel->setAttribute("for", "username"); + $textLabel->textContent = $this->generator->word; + + $passwordInput = $element->ownerDocument->createElement(static::INPUT_TAG); + $passwordInput->setAttribute("type", "password"); + $passwordInput->setAttribute("id", "password"); + + $passwordLabel = $element->ownerDocument->createElement(static::LABEL_TAG); + $passwordLabel->setAttribute("for", "password"); + $passwordLabel->textContent = $this->generator->word; + + $submit = $element->ownerDocument->createElement(static::INPUT_TAG); + $submit->setAttribute("type", "submit"); + $submit->setAttribute("value", $this->generator->word); + + $submit = $element->ownerDocument->createElement(static::FORM_TAG); + $submit->setAttribute("action", $this->generator->safeEmailDomain); + $submit->setAttribute("method", "POST"); + $submit->appendChild($textLabel); + $submit->appendChild($textInput); + $submit->appendChild($passwordLabel); + $submit->appendChild($passwordInput); + $element->appendChild($submit); + } + + private function addRandomTable(\DOMElement $element, $maxRows = 10, $maxCols = 6, $maxTitle = 4, $maxLength = 10) + { + $rows = mt_rand(1, $maxRows); + $cols = mt_rand(1, $maxCols); + + $table = $element->ownerDocument->createElement(static::TABLE_TAG); + $thead = $element->ownerDocument->createElement(static::THEAD_TAG); + $tbody = $element->ownerDocument->createElement(static::TBODY_TAG); + + $table->appendChild($thead); + $table->appendChild($tbody); + + $tr = $element->ownerDocument->createElement(static::TR_TAG); + $thead->appendChild($tr); + for ($i = 0; $i < $cols; $i++) { + $th = $element->ownerDocument->createElement(static::TH_TAG); + $th->textContent = $this->generator->sentence(mt_rand(1, $maxTitle)); + $tr->appendChild($th); + } + for ($i = 0; $i < $rows; $i++) { + $tr = $element->ownerDocument->createElement(static::TR_TAG); + $tbody->appendChild($tr); + for ($j = 0; $j < $cols; $j++) { + $th = $element->ownerDocument->createElement(static::TD_TAG); + $th->textContent = $this->generator->sentence(mt_rand(1, $maxLength)); + $tr->appendChild($th); + } + } + $element->appendChild($table); + } + + private function addRandomUL(\DOMElement $element, $maxItems = 11, $maxLength = 4) + { + $num = mt_rand(1, $maxItems); + $ul = $element->ownerDocument->createElement(static::UL_TAG); + for ($i = 0; $i < $num; $i++) { + $li = $element->ownerDocument->createElement(static::LI_TAG); + $li->textContent = $this->generator->sentence(mt_rand(1, $maxLength)); + $ul->appendChild($li); + } + $element->appendChild($ul); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Image.php b/vendor/fzaninotto/faker/src/Faker/Provider/Image.php new file mode 100644 index 0000000..0458ceb --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Image.php @@ -0,0 +1,105 @@ +generator->parse($format); + } + + /** + * @example 'jdoe@example.com' + */ + final public function safeEmail() + { + return preg_replace('/\s/u', '', $this->userName() . '@' . static::safeEmailDomain()); + } + + /** + * @example 'jdoe@gmail.com' + */ + public function freeEmail() + { + return preg_replace('/\s/u', '', $this->userName() . '@' . static::freeEmailDomain()); + } + + /** + * @example 'jdoe@dawson.com' + */ + public function companyEmail() + { + return preg_replace('/\s/u', '', $this->userName() . '@' . $this->domainName()); + } + + /** + * @example 'gmail.com' + */ + public static function freeEmailDomain() + { + return static::randomElement(static::$freeEmailDomain); + } + + /** + * @example 'example.org' + */ + final public static function safeEmailDomain() + { + $domains = array( + 'example.com', + 'example.org', + 'example.net' + ); + + return static::randomElement($domains); + } + /** + * @example 'jdoe' + */ + public function userName() + { + $format = static::randomElement(static::$userNameFormats); + $username = static::bothify($this->generator->parse($format)); + + $username = strtolower(static::transliterate($username)); + + // check if transliterate() didn't support the language and removed all letters + if (trim($username, '._') === '') { + throw new \Exception('userName failed with the selected locale. Try a different locale or activate the "intl" PHP extension.'); + } + + // clean possible trailing dots from first/last names + $username = str_replace('..', '.', $username); + $username = rtrim($username, '.'); + + return $username; + } + /** + * @example 'fY4èHdZv68' + */ + public function password($minLength = 6, $maxLength = 20) + { + $pattern = str_repeat('*', $this->numberBetween($minLength, $maxLength)); + + return $this->asciify($pattern); + } + + /** + * @example 'tiramisu.com' + */ + public function domainName() + { + return $this->domainWord() . '.' . $this->tld(); + } + + /** + * @example 'faber' + */ + public function domainWord() + { + $lastName = $this->generator->format('lastName'); + + $lastName = strtolower(static::transliterate($lastName)); + + // check if transliterate() didn't support the language and removed all letters + if (trim($lastName, '._') === '') { + throw new \Exception('domainWord failed with the selected locale. Try a different locale or activate the "intl" PHP extension.'); + } + + // clean possible trailing dot from last name + $lastName = rtrim($lastName, '.'); + + return $lastName; + } + + /** + * @example 'com' + */ + public function tld() + { + return static::randomElement(static::$tld); + } + + /** + * @example 'http://www.runolfsdottir.com/' + */ + public function url() + { + $format = static::randomElement(static::$urlFormats); + + return $this->generator->parse($format); + } + + /** + * @example 'aut-repellat-commodi-vel-itaque-nihil-id-saepe-nostrum' + */ + public function slug($nbWords = 6, $variableNbWords = true) + { + if ($nbWords <= 0) { + return ''; + } + if ($variableNbWords) { + $nbWords = (int) ($nbWords * mt_rand(60, 140) / 100) + 1; + } + $words = $this->generator->words($nbWords); + + return join($words, '-'); + } + + /** + * @example '237.149.115.38' + */ + public function ipv4() + { + return long2ip(mt_rand(0, 1) == 0 ? mt_rand(-2147483648, -2) : mt_rand(16777216, 2147483647)); + } + + /** + * @example '35cd:186d:3e23:2986:ef9f:5b41:42a4:e6f1' + */ + public function ipv6() + { + $res = array(); + for ($i=0; $i < 8; $i++) { + $res []= dechex(mt_rand(0, "65535")); + } + + return join(':', $res); + } + + /** + * @example '10.1.1.17' + */ + public static function localIpv4() + { + if (static::numberBetween(0, 1) === 0) { + // 10.x.x.x range + return long2ip(static::numberBetween(ip2long("10.0.0.0"), ip2long("10.255.255.255"))); + } + + // 192.168.x.x range + return long2ip(static::numberBetween(ip2long("192.168.0.0"), ip2long("192.168.255.255"))); + } + + /** + * @example '32:F1:39:2F:D6:18' + */ + public static function macAddress() + { + for ($i=0; $i<6; $i++) { + $mac[] = sprintf('%02X', static::numberBetween(0, 0xff)); + } + $mac = implode(':', $mac); + + return $mac; + } + + protected static function transliterate($string) + { + if (0 === preg_match('/[^A-Za-z0-9_.]/', $string)) { + return $string; + } + + $transId = 'Any-Latin; Latin-ASCII; NFD; [:Nonspacing Mark:] Remove; NFC;'; + if (class_exists('Transliterator') && $transliterator = \Transliterator::create($transId)) { + $transString = $transliterator->transliterate($string); + } else { + $transString = static::toAscii($string); + } + + return preg_replace('/[^A-Za-z0-9_.]/u', '', $transString); + } + + protected static function toAscii($string) + { + static $arrayFrom, $arrayTo; + + if (empty($arrayFrom)) { + $transliterationTable = array( + 'IJ'=>'I', 'Ö'=>'O', 'Å’'=>'O', 'Ãœ'=>'U', 'ä'=>'a', 'æ'=>'a', + 'ij'=>'i', 'ö'=>'o', 'Å“'=>'o', 'ü'=>'u', 'ß'=>'s', 'Å¿'=>'s', + 'À'=>'A', 'Ã'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Ã…'=>'A', + 'Æ'=>'A', 'Ä€'=>'A', 'Ä„'=>'A', 'Ä‚'=>'A', 'Ç'=>'C', 'Ć'=>'C', + 'ÄŒ'=>'C', 'Ĉ'=>'C', 'ÄŠ'=>'C', 'ÄŽ'=>'D', 'Ä'=>'D', 'È'=>'E', + 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ä’'=>'E', 'Ę'=>'E', 'Äš'=>'E', + 'Ä”'=>'E', 'Ä–'=>'E', 'Äœ'=>'G', 'Äž'=>'G', 'Ä '=>'G', 'Ä¢'=>'G', + 'Ĥ'=>'H', 'Ħ'=>'H', 'ÃŒ'=>'I', 'Ã'=>'I', 'ÃŽ'=>'I', 'Ã'=>'I', + 'Ī'=>'I', 'Ĩ'=>'I', 'Ĭ'=>'I', 'Ä®'=>'I', 'Ä°'=>'I', 'Ä´'=>'J', + 'Ķ'=>'K', 'Ľ'=>'K', 'Ĺ'=>'K', 'Ä»'=>'K', 'Ä¿'=>'K', 'Å'=>'L', + 'Ñ'=>'N', 'Ń'=>'N', 'Ň'=>'N', 'Å…'=>'N', 'ÅŠ'=>'N', 'Ã’'=>'O', + 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ø'=>'O', 'ÅŒ'=>'O', 'Å'=>'O', + 'ÅŽ'=>'O', 'Å”'=>'R', 'Ř'=>'R', 'Å–'=>'R', 'Åš'=>'S', 'Åž'=>'S', + 'Åœ'=>'S', 'Ș'=>'S', 'Å '=>'S', 'Ť'=>'T', 'Å¢'=>'T', 'Ŧ'=>'T', + 'Èš'=>'T', 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ū'=>'U', 'Å®'=>'U', + 'Å°'=>'U', 'Ŭ'=>'U', 'Ũ'=>'U', 'Ų'=>'U', 'Å´'=>'W', 'Ŷ'=>'Y', + 'Ÿ'=>'Y', 'Ã'=>'Y', 'Ź'=>'Z', 'Å»'=>'Z', 'Ž'=>'Z', 'à'=>'a', + 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'Ä'=>'a', 'Ä…'=>'a', 'ă'=>'a', + 'Ã¥'=>'a', 'ç'=>'c', 'ć'=>'c', 'Ä'=>'c', 'ĉ'=>'c', 'Ä‹'=>'c', + 'Ä'=>'d', 'Ä‘'=>'d', 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', + 'Ä“'=>'e', 'Ä™'=>'e', 'Ä›'=>'e', 'Ä•'=>'e', 'Ä—'=>'e', 'Æ’'=>'f', + 'Ä'=>'g', 'ÄŸ'=>'g', 'Ä¡'=>'g', 'Ä£'=>'g', 'Ä¥'=>'h', 'ħ'=>'h', + 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i', 'Ä«'=>'i', 'Ä©'=>'i', + 'Ä­'=>'i', 'į'=>'i', 'ı'=>'i', 'ĵ'=>'j', 'Ä·'=>'k', 'ĸ'=>'k', + 'Å‚'=>'l', 'ľ'=>'l', 'ĺ'=>'l', 'ļ'=>'l', 'Å€'=>'l', 'ñ'=>'n', + 'Å„'=>'n', 'ň'=>'n', 'ņ'=>'n', 'ʼn'=>'n', 'Å‹'=>'n', 'ò'=>'o', + 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ø'=>'o', 'Å'=>'o', 'Å‘'=>'o', + 'Å'=>'o', 'Å•'=>'r', 'Å™'=>'r', 'Å—'=>'r', 'Å›'=>'s', 'Å¡'=>'s', + 'Å¥'=>'t', 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'Å«'=>'u', 'ů'=>'u', + 'ű'=>'u', 'Å­'=>'u', 'Å©'=>'u', 'ų'=>'u', 'ŵ'=>'w', 'ÿ'=>'y', + 'ý'=>'y', 'Å·'=>'y', 'ż'=>'z', 'ź'=>'z', 'ž'=>'z', 'Α'=>'A', + 'Ά'=>'A', 'Ἀ'=>'A', 'Ἁ'=>'A', 'Ἂ'=>'A', 'Ἃ'=>'A', 'Ἄ'=>'A', + 'á¼'=>'A', 'Ἆ'=>'A', 'á¼'=>'A', 'ᾈ'=>'A', 'ᾉ'=>'A', 'ᾊ'=>'A', + 'ᾋ'=>'A', 'ᾌ'=>'A', 'á¾'=>'A', 'ᾎ'=>'A', 'á¾'=>'A', 'Ᾰ'=>'A', + 'á¾¹'=>'A', 'Ὰ'=>'A', 'á¾¼'=>'A', 'Î’'=>'B', 'Γ'=>'G', 'Δ'=>'D', + 'Ε'=>'E', 'Έ'=>'E', 'Ἐ'=>'E', 'á¼™'=>'E', 'Ἒ'=>'E', 'á¼›'=>'E', + 'Ἔ'=>'E', 'á¼'=>'E', 'Ὲ'=>'E', 'Ζ'=>'Z', 'Η'=>'I', 'Ή'=>'I', + 'Ἠ'=>'I', 'Ἡ'=>'I', 'Ἢ'=>'I', 'Ἣ'=>'I', 'Ἤ'=>'I', 'á¼­'=>'I', + 'á¼®'=>'I', 'Ἧ'=>'I', 'ᾘ'=>'I', 'á¾™'=>'I', 'ᾚ'=>'I', 'á¾›'=>'I', + 'ᾜ'=>'I', 'á¾'=>'I', 'ᾞ'=>'I', 'ᾟ'=>'I', 'á¿Š'=>'I', 'á¿Œ'=>'I', + 'Θ'=>'T', 'Ι'=>'I', 'Ί'=>'I', 'Ϊ'=>'I', 'Ἰ'=>'I', 'á¼¹'=>'I', + 'Ἲ'=>'I', 'á¼»'=>'I', 'á¼¼'=>'I', 'á¼½'=>'I', 'á¼¾'=>'I', 'Ἷ'=>'I', + 'Ῐ'=>'I', 'á¿™'=>'I', 'á¿š'=>'I', 'Κ'=>'K', 'Λ'=>'L', 'Îœ'=>'M', + 'Î'=>'N', 'Ξ'=>'K', 'Ο'=>'O', 'ÎŒ'=>'O', 'Ὀ'=>'O', 'Ὁ'=>'O', + 'Ὂ'=>'O', 'Ὃ'=>'O', 'Ὄ'=>'O', 'á½'=>'O', 'Ὸ'=>'O', 'Π'=>'P', + 'Ρ'=>'R', 'Ῥ'=>'R', 'Σ'=>'S', 'Τ'=>'T', 'Î¥'=>'Y', 'ÎŽ'=>'Y', + 'Ϋ'=>'Y', 'á½™'=>'Y', 'á½›'=>'Y', 'á½'=>'Y', 'Ὗ'=>'Y', 'Ῠ'=>'Y', + 'á¿©'=>'Y', 'Ὺ'=>'Y', 'Φ'=>'F', 'Χ'=>'X', 'Ψ'=>'P', 'Ω'=>'O', + 'Î'=>'O', 'Ὠ'=>'O', 'Ὡ'=>'O', 'Ὢ'=>'O', 'Ὣ'=>'O', 'Ὤ'=>'O', + 'á½­'=>'O', 'á½®'=>'O', 'Ὧ'=>'O', 'ᾨ'=>'O', 'ᾩ'=>'O', 'ᾪ'=>'O', + 'ᾫ'=>'O', 'ᾬ'=>'O', 'á¾­'=>'O', 'á¾®'=>'O', 'ᾯ'=>'O', 'Ὼ'=>'O', + 'ῼ'=>'O', 'α'=>'a', 'ά'=>'a', 'á¼€'=>'a', 'á¼'=>'a', 'ἂ'=>'a', + 'ἃ'=>'a', 'ἄ'=>'a', 'á¼…'=>'a', 'ἆ'=>'a', 'ἇ'=>'a', 'á¾€'=>'a', + 'á¾'=>'a', 'ᾂ'=>'a', 'ᾃ'=>'a', 'ᾄ'=>'a', 'á¾…'=>'a', 'ᾆ'=>'a', + 'ᾇ'=>'a', 'á½°'=>'a', 'á¾°'=>'a', 'á¾±'=>'a', 'á¾²'=>'a', 'á¾³'=>'a', + 'á¾´'=>'a', 'ᾶ'=>'a', 'á¾·'=>'a', 'β'=>'b', 'γ'=>'g', 'δ'=>'d', + 'ε'=>'e', 'έ'=>'e', 'á¼'=>'e', 'ἑ'=>'e', 'á¼’'=>'e', 'ἓ'=>'e', + 'á¼”'=>'e', 'ἕ'=>'e', 'á½²'=>'e', 'ζ'=>'z', 'η'=>'i', 'ή'=>'i', + 'á¼ '=>'i', 'ἡ'=>'i', 'á¼¢'=>'i', 'á¼£'=>'i', 'ἤ'=>'i', 'á¼¥'=>'i', + 'ἦ'=>'i', 'ἧ'=>'i', 'á¾'=>'i', 'ᾑ'=>'i', 'á¾’'=>'i', 'ᾓ'=>'i', + 'á¾”'=>'i', 'ᾕ'=>'i', 'á¾–'=>'i', 'á¾—'=>'i', 'á½´'=>'i', 'á¿‚'=>'i', + 'ῃ'=>'i', 'á¿„'=>'i', 'ῆ'=>'i', 'ῇ'=>'i', 'θ'=>'t', 'ι'=>'i', + 'ί'=>'i', 'ÏŠ'=>'i', 'Î'=>'i', 'á¼°'=>'i', 'á¼±'=>'i', 'á¼²'=>'i', + 'á¼³'=>'i', 'á¼´'=>'i', 'á¼µ'=>'i', 'ἶ'=>'i', 'á¼·'=>'i', 'ὶ'=>'i', + 'á¿'=>'i', 'á¿‘'=>'i', 'á¿’'=>'i', 'á¿–'=>'i', 'á¿—'=>'i', 'κ'=>'k', + 'λ'=>'l', 'μ'=>'m', 'ν'=>'n', 'ξ'=>'k', 'ο'=>'o', 'ÏŒ'=>'o', + 'á½€'=>'o', 'á½'=>'o', 'ὂ'=>'o', 'ὃ'=>'o', 'ὄ'=>'o', 'á½…'=>'o', + 'ὸ'=>'o', 'Ï€'=>'p', 'Ï'=>'r', 'ῤ'=>'r', 'á¿¥'=>'r', 'σ'=>'s', + 'Ï‚'=>'s', 'Ï„'=>'t', 'Ï…'=>'y', 'Ï'=>'y', 'Ï‹'=>'y', 'ΰ'=>'y', + 'á½'=>'y', 'ὑ'=>'y', 'á½’'=>'y', 'ὓ'=>'y', 'á½”'=>'y', 'ὕ'=>'y', + 'á½–'=>'y', 'á½—'=>'y', 'ὺ'=>'y', 'á¿ '=>'y', 'á¿¡'=>'y', 'á¿¢'=>'y', + 'ῦ'=>'y', 'ῧ'=>'y', 'φ'=>'f', 'χ'=>'x', 'ψ'=>'p', 'ω'=>'o', + 'ÏŽ'=>'o', 'á½ '=>'o', 'ὡ'=>'o', 'á½¢'=>'o', 'á½£'=>'o', 'ὤ'=>'o', + 'á½¥'=>'o', 'ὦ'=>'o', 'ὧ'=>'o', 'á¾ '=>'o', 'ᾡ'=>'o', 'á¾¢'=>'o', + 'á¾£'=>'o', 'ᾤ'=>'o', 'á¾¥'=>'o', 'ᾦ'=>'o', 'ᾧ'=>'o', 'á½¼'=>'o', + 'ῲ'=>'o', 'ῳ'=>'o', 'á¿´'=>'o', 'ῶ'=>'o', 'á¿·'=>'o', 'Ð'=>'A', + 'Б'=>'B', 'Ð’'=>'V', 'Г'=>'G', 'Д'=>'D', 'Е'=>'E', 'Ð'=>'E', + 'Ж'=>'Z', 'З'=>'Z', 'И'=>'I', 'Й'=>'I', 'К'=>'K', 'Л'=>'L', + 'Ðœ'=>'M', 'Ð'=>'N', 'О'=>'O', 'П'=>'P', 'Р'=>'R', 'С'=>'S', + 'Т'=>'T', 'У'=>'U', 'Ф'=>'F', 'Ð¥'=>'K', 'Ц'=>'T', 'Ч'=>'C', + 'Ш'=>'S', 'Щ'=>'S', 'Ы'=>'Y', 'Э'=>'E', 'Ю'=>'Y', 'Я'=>'Y', + 'а'=>'A', 'б'=>'B', 'в'=>'V', 'г'=>'G', 'д'=>'D', 'е'=>'E', + 'Ñ‘'=>'E', 'ж'=>'Z', 'з'=>'Z', 'и'=>'I', 'й'=>'I', 'к'=>'K', + 'л'=>'L', 'м'=>'M', 'н'=>'N', 'о'=>'O', 'п'=>'P', 'Ñ€'=>'R', + 'Ñ'=>'S', 'Ñ‚'=>'T', 'у'=>'U', 'Ñ„'=>'F', 'Ñ…'=>'K', 'ц'=>'T', + 'ч'=>'C', 'ш'=>'S', 'щ'=>'S', 'Ñ‹'=>'Y', 'Ñ'=>'E', 'ÑŽ'=>'Y', + 'Ñ'=>'Y', 'ð'=>'d', 'Ã'=>'D', 'þ'=>'t', 'Þ'=>'T', 'áƒ'=>'a', + 'ბ'=>'b', 'გ'=>'g', 'დ'=>'d', 'ე'=>'e', 'ვ'=>'v', 'ზ'=>'z', + 'თ'=>'t', 'ი'=>'i', 'კ'=>'k', 'ლ'=>'l', 'მ'=>'m', 'ნ'=>'n', + 'áƒ'=>'o', 'პ'=>'p', 'ჟ'=>'z', 'რ'=>'r', 'ს'=>'s', 'ტ'=>'t', + 'უ'=>'u', 'ფ'=>'p', 'ქ'=>'k', 'ღ'=>'g', 'ყ'=>'q', 'შ'=>'s', + 'ჩ'=>'c', 'ც'=>'t', 'ძ'=>'d', 'წ'=>'t', 'ჭ'=>'c', 'ხ'=>'k', + 'ჯ'=>'j', 'ჰ'=>'h', 'Å£'=>'t', 'ʼ'=>"'", '̧'=>'', 'ḩ'=>'h', + '‘'=>"'", '’'=>"'", 'ừ'=>'u', '/'=>'', 'ế'=>'e', 'ả'=>'a', + 'ị'=>'i', 'ậ'=>'a', 'ệ'=>'e', 'ỉ'=>'i', 'ồ'=>'o', 'á»'=>'e', + 'Æ¡'=>'o', 'ạ'=>'a', 'ẵ'=>'a', 'Æ°'=>'u', 'ằ'=>'a', 'ầ'=>'a', + 'ḑ'=>'d', 'Ḩ'=>'H', 'á¸'=>'D', 'È™'=>'s', 'È›'=>'t', 'á»™'=>'o', + 'ắ'=>'a', 'ÅŸ'=>'s', "'"=>'', 'Õ¸Ö‚'=>'u', 'Õ¡'=>'a', 'Õ¢'=>'b', + 'Õ£'=>'g', 'Õ¤'=>'d', 'Õ¥'=>'e', 'Õ¦'=>'z', 'Õ§'=>'e', 'Õ¨'=>'y', + 'Õ©'=>'t', 'Õª'=>'zh', 'Õ«'=>'i', 'Õ¬'=>'l', 'Õ­'=>'kh', 'Õ®'=>'ts', + 'Õ¯'=>'k', 'Õ°'=>'h', 'Õ±'=>'dz', 'Õ²'=>'gh', 'Õ³'=>'ch', 'Õ´'=>'m', + 'Õµ'=>'y', 'Õ¶'=>'n', 'Õ·'=>'sh', 'Õ¸'=>'o', 'Õ¹'=>'ch', 'Õº'=>'p', + 'Õ»'=>'j', 'Õ¼'=>'r', 'Õ½'=>'s', 'Õ¾'=>'v', 'Õ¿'=>'t', 'Ö€'=>'r', + 'Ö'=>'ts', 'Öƒ'=>'p', 'Ö„'=>'q', 'Ö‡'=>'ev', 'Ö…'=>'o', 'Ö†'=>'f', + ); + $arrayFrom = array_keys($transliterationTable); + $arrayTo = array_values($transliterationTable); + } + + return str_replace($arrayFrom, $arrayTo, $string); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Lorem.php b/vendor/fzaninotto/faker/src/Faker/Provider/Lorem.php new file mode 100644 index 0000000..6356ebf --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Lorem.php @@ -0,0 +1,203 @@ + array( + "4539###########", + "4556###########", + "4916###########", + "4532###########", + "4929###########", + "40240071#######", + "4485###########", + "4716###########", + "4##############" + ), + 'Visa Retired' => array( + "4539########", + "4556########", + "4916########", + "4532########", + "4929########", + "40240071####", + "4485########", + "4716########", + "4###########", + ), + 'MasterCard' => array( + "2221###########", + "23#############", + "24#############", + "25#############", + "26#############", + "2720###########", + "51#############", + "52#############", + "53#############", + "54#############", + "55#############" + ), + 'American Express' => array( + "34############", + "37############" + ), + 'Discover Card' => array( + "6011###########" + ), + ); + + /** + * @var array list of IBAN formats, source: @link https://www.swift.com/standards/data-standards/iban + */ + protected static $ibanFormats = array( + 'AD' => array(array('n', 4), array('n', 4), array('c', 12)), + 'AE' => array(array('n', 3), array('n', 16)), + 'AL' => array(array('n', 8), array('c', 16)), + 'AT' => array(array('n', 5), array('n', 11)), + 'AZ' => array(array('a', 4), array('c', 20)), + 'BA' => array(array('n', 3), array('n', 3), array('n', 8), array('n', 2)), + 'BE' => array(array('n', 3), array('n', 7), array('n', 2)), + 'BG' => array(array('a', 4), array('n', 4), array('n', 2), array('c', 8)), + 'BH' => array(array('a', 4), array('c', 14)), + 'BR' => array(array('n', 8), array('n', 5), array('n', 10), array('a', 1), array('c', 1)), + 'CH' => array(array('n', 5), array('c', 12)), + 'CR' => array(array('n', 3), array('n', 14)), + 'CY' => array(array('n', 3), array('n', 5), array('c', 16)), + 'CZ' => array(array('n', 4), array('n', 6), array('n', 10)), + 'DE' => array(array('n', 8), array('n', 10)), + 'DK' => array(array('n', 4), array('n', 9), array('n', 1)), + 'DO' => array(array('c', 4), array('n', 20)), + 'EE' => array(array('n', 2), array('n', 2), array('n', 11), array('n', 1)), + 'ES' => array(array('n', 4), array('n', 4), array('n', 1), array('n', 1), array('n', 10)), + 'FI' => array(array('n', 6), array('n', 7), array('n', 1)), + 'FR' => array(array('n', 5), array('n', 5), array('c', 11), array('n', 2)), + 'GB' => array(array('a', 4), array('n', 6), array('n', 8)), + 'GE' => array(array('a', 2), array('n', 16)), + 'GI' => array(array('a', 4), array('c', 15)), + 'GR' => array(array('n', 3), array('n', 4), array('c', 16)), + 'GT' => array(array('c', 4), array('c', 20)), + 'HR' => array(array('n', 7), array('n', 10)), + 'HU' => array(array('n', 3), array('n', 4), array('n', 1), array('n', 15), array('n', 1)), + 'IE' => array(array('a', 4), array('n', 6), array('n', 8)), + 'IL' => array(array('n', 3), array('n', 3), array('n', 13)), + 'IS' => array(array('n', 4), array('n', 2), array('n', 6), array('n', 10)), + 'IT' => array(array('a', 1), array('n', 5), array('n', 5), array('c', 12)), + 'KW' => array(array('a', 4), array('n', 22)), + 'KZ' => array(array('n', 3), array('c', 13)), + 'LB' => array(array('n', 4), array('c', 20)), + 'LI' => array(array('n', 5), array('c', 12)), + 'LT' => array(array('n', 5), array('n', 11)), + 'LU' => array(array('n', 3), array('c', 13)), + 'LV' => array(array('a', 4), array('c', 13)), + 'MC' => array(array('n', 5), array('n', 5), array('c', 11), array('n', 2)), + 'MD' => array(array('c', 2), array('c', 18)), + 'ME' => array(array('n', 3), array('n', 13), array('n', 2)), + 'MK' => array(array('n', 3), array('c', 10), array('n', 2)), + 'MR' => array(array('n', 5), array('n', 5), array('n', 11), array('n', 2)), + 'MT' => array(array('a', 4), array('n', 5), array('c', 18)), + 'MU' => array(array('a', 4), array('n', 2), array('n', 2), array('n', 12), array('n', 3), array('a', 3)), + 'NL' => array(array('a', 4), array('n', 10)), + 'NO' => array(array('n', 4), array('n', 6), array('n', 1)), + 'PK' => array(array('a', 4), array('c', 16)), + 'PL' => array(array('n', 8), array('n', 16)), + 'PS' => array(array('a', 4), array('c', 21)), + 'PT' => array(array('n', 4), array('n', 4), array('n', 11), array('n', 2)), + 'RO' => array(array('a', 4), array('c', 16)), + 'RS' => array(array('n', 3), array('n', 13), array('n', 2)), + 'SA' => array(array('n', 2), array('c', 18)), + 'SE' => array(array('n', 3), array('n', 16), array('n', 1)), + 'SI' => array(array('n', 5), array('n', 8), array('n', 2)), + 'SK' => array(array('n', 4), array('n', 6), array('n', 10)), + 'SM' => array(array('a', 1), array('n', 5), array('n', 5), array('c', 12)), + 'TN' => array(array('n', 2), array('n', 3), array('n', 13), array('n', 2)), + 'TR' => array(array('n', 5), array('n', 1), array('c', 16)), + 'VG' => array(array('a', 4), array('n', 16)), + ); + + /** + * @return string Returns a credit card vendor name + * + * @example 'MasterCard' + */ + public static function creditCardType() + { + return static::randomElement(static::$cardVendors); + } + + /** + * Returns the String of a credit card number. + * + * @param string $type Supporting any of 'Visa', 'MasterCard', 'American Express', and 'Discover' + * @param boolean $formatted Set to true if the output string should contain one separator every 4 digits + * @param string $separator Separator string for formatting card number. Defaults to dash (-). + * @return string + * + * @example '4485480221084675' + */ + public static function creditCardNumber($type = null, $formatted = false, $separator = '-') + { + if (is_null($type)) { + $type = static::creditCardType(); + } + $mask = static::randomElement(static::$cardParams[$type]); + + $number = static::numerify($mask); + $number .= Luhn::computeCheckDigit($number); + + if ($formatted) { + $p1 = substr($number, 0, 4); + $p2 = substr($number, 4, 4); + $p3 = substr($number, 8, 4); + $p4 = substr($number, 12); + $number = $p1 . $separator . $p2 . $separator . $p3 . $separator . $p4; + } + + return $number; + } + + /** + * @param boolean $valid True (by default) to get a valid expiration date, false to get a maybe valid date + * @return \DateTime + * @example 04/13 + */ + public function creditCardExpirationDate($valid = true) + { + if ($valid) { + return $this->generator->dateTimeBetween('now', '36 months'); + } + + return $this->generator->dateTimeBetween('-36 months', '36 months'); + } + + /** + * @param boolean $valid True (by default) to get a valid expiration date, false to get a maybe valid date + * @param string $expirationDateFormat + * @return string + * @example '04/13' + */ + public function creditCardExpirationDateString($valid = true, $expirationDateFormat = null) + { + return $this->creditCardExpirationDate($valid)->format(is_null($expirationDateFormat) ? static::$expirationDateFormat : $expirationDateFormat); + } + + /** + * @param boolean $valid True (by default) to get a valid expiration date, false to get a maybe valid date + * @return array + */ + public function creditCardDetails($valid = true) + { + $type = static::creditCardType(); + + return array( + 'type' => $type, + 'number' => static::creditCardNumber($type), + 'name' => $this->generator->name(), + 'expirationDate' => $this->creditCardExpirationDateString($valid) + ); + } + + /** + * International Bank Account Number (IBAN) + * + * @link http://en.wikipedia.org/wiki/International_Bank_Account_Number + * @param string $countryCode ISO 3166-1 alpha-2 country code + * @param string $prefix for generating bank account number of a specific bank + * @param integer $length total length without country code and 2 check digits + * @return string + */ + public static function iban($countryCode = null, $prefix = '', $length = null) + { + $countryCode = is_null($countryCode) ? self::randomKey(self::$ibanFormats) : strtoupper($countryCode); + + $format = !isset(static::$ibanFormats[$countryCode]) ? null : static::$ibanFormats[$countryCode]; + if ($length === null) { + if ($format === null) { + $length = 24; + } else { + $length = 0; + foreach ($format as $part) { + list($class, $groupCount) = $part; + $length += $groupCount; + } + } + } + if ($format === null) { + $format = array(array('n', $length)); + } + + $expandedFormat = ''; + foreach ($format as $item) { + list($class, $length) = $item; + $expandedFormat .= str_repeat($class, $length); + } + + $result = $prefix; + $expandedFormat = substr($expandedFormat, strlen($result)); + foreach (str_split($expandedFormat) as $class) { + switch ($class) { + default: + case 'c': + $result .= mt_rand(0, 100) <= 50 ? static::randomDigit() : strtoupper(static::randomLetter()); + break; + case 'a': + $result .= strtoupper(static::randomLetter()); + break; + case 'n': + $result .= static::randomDigit(); + break; + } + } + + $checksum = Iban::checksum($countryCode . '00' . $result); + + return $countryCode . $checksum . $result; + } + + /** + * Return the String of a SWIFT/BIC number + * + * @example 'RZTIAT22263' + * @link http://en.wikipedia.org/wiki/ISO_9362 + * @return string Swift/Bic number + */ + public static function swiftBicNumber() + { + return self::regexify("^([A-Z]){4}([A-Z]){2}([0-9A-Z]){2}([0-9A-Z]{3})?$"); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/Person.php new file mode 100644 index 0000000..9d875b6 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Person.php @@ -0,0 +1,126 @@ +generator->parse($format); + } + + /** + * @param string|null $gender 'male', 'female' or null for any + * @return string + * @example 'John' + */ + public function firstName($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::firstNameMale(); + } elseif ($gender === static::GENDER_FEMALE) { + return static::firstNameFemale(); + } + + return $this->generator->parse(static::randomElement(static::$firstNameFormat)); + } + + public static function firstNameMale() + { + return static::randomElement(static::$firstNameMale); + } + + public static function firstNameFemale() + { + return static::randomElement(static::$firstNameFemale); + } + + /** + * @example 'Doe' + * @return string + */ + public function lastName() + { + return static::randomElement(static::$lastName); + } + + /** + * @example 'Mrs.' + * @param string|null $gender 'male', 'female' or null for any + * @return string + */ + public function title($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::titleMale(); + } elseif ($gender === static::GENDER_FEMALE) { + return static::titleFemale(); + } + + return $this->generator->parse(static::randomElement(static::$titleFormat)); + } + + /** + * @example 'Mr.' + */ + public static function titleMale() + { + return static::randomElement(static::$titleMale); + } + + /** + * @example 'Mrs.' + */ + public static function titleFemale() + { + return static::randomElement(static::$titleFemale); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/PhoneNumber.php new file mode 100644 index 0000000..d9d1f6b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/PhoneNumber.php @@ -0,0 +1,43 @@ +generator->parse(static::randomElement(static::$formats))); + } + + /** + * @example +27113456789 + * @return string + */ + public function e164PhoneNumber() + { + $formats = array('+%############'); + return static::numerify($this->generator->parse(static::randomElement($formats))); + } + + /** + * International Mobile Equipment Identity (IMEI) + * + * @link http://en.wikipedia.org/wiki/International_Mobile_Station_Equipment_Identity + * @link http://imei-number.com/imei-validation-check/ + * @example '720084494799532' + * @return int $imei + */ + public function imei() + { + $imei = (string) static::numerify('##############'); + $imei .= Luhn::computeCheckDigit($imei); + return $imei; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/Text.php b/vendor/fzaninotto/faker/src/Faker/Provider/Text.php new file mode 100644 index 0000000..db8c800 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/Text.php @@ -0,0 +1,141 @@ + 5) { + throw new \InvalidArgumentException('indexSize must be at most 5'); + } + + $words = $this->getConsecutiveWords($indexSize); + $result = array(); + $resultLength = 0; + // take a random starting point + $next = static::randomKey($words); + while ($resultLength < $maxNbChars && isset($words[$next])) { + // fetch a random word to append + $word = static::randomElement($words[$next]); + + // calculate next index + $currentWords = static::explode($next); + $currentWords[] = $word; + array_shift($currentWords); + $next = static::implode($currentWords); + + // ensure text starts with an uppercase letter + if ($resultLength == 0 && !static::validStart($word)) { + continue; + } + + // append the element + $result[] = $word; + $resultLength += static::strlen($word) + static::$separatorLen; + } + + // remove the element that caused the text to overflow + array_pop($result); + + // build result + $result = static::implode($result); + + return static::appendEnd($result); + } + + protected function getConsecutiveWords($indexSize) + { + if (!isset($this->consecutiveWords[$indexSize])) { + $parts = $this->getExplodedText(); + $words = array(); + $index = array(); + for ($i = 0; $i < $indexSize; $i++) { + $index[] = array_shift($parts); + } + + for ($i = 0, $count = count($parts); $i < $count; $i++) { + $stringIndex = static::implode($index); + if (!isset($words[$stringIndex])) { + $words[$stringIndex] = array(); + } + $word = $parts[$i]; + $words[$stringIndex][] = $word; + array_shift($index); + $index[] = $word; + } + // cache look up words for performance + $this->consecutiveWords[$indexSize] = $words; + } + + return $this->consecutiveWords[$indexSize]; + } + + protected function getExplodedText() + { + if ($this->explodedText === null) { + $this->explodedText = static::explode(preg_replace('/\s+/u', ' ', static::$baseText)); + } + + return $this->explodedText; + } + + protected static function explode($text) + { + return explode(static::$separator, $text); + } + + protected static function implode($words) + { + return implode(static::$separator, $words); + } + + protected static function strlen($text) + { + return function_exists('mb_strlen') ? mb_strlen($text, 'UTF-8') : strlen($text); + } + + protected static function validStart($word) + { + $isValid = true; + if (static::$textStartsWithUppercase) { + $isValid = preg_match('/^\p{Lu}/u', $word); + } + return $isValid; + } + + protected static function appendEnd($text) + { + return preg_replace("/([ ,-:;\x{2013}\x{2014}]+$)/us", '', $text).'.'; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/UserAgent.php b/vendor/fzaninotto/faker/src/Faker/Provider/UserAgent.php new file mode 100644 index 0000000..d659f4b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/UserAgent.php @@ -0,0 +1,165 @@ +> 8) | (($tLo & 0xff000000) >> 24); + $tMi = (($tMi & 0x00ff) << 8) | (($tMi & 0xff00) >> 8); + $tHi = (($tHi & 0x00ff) << 8) | (($tHi & 0xff00) >> 8); + } + + // apply version number + $tHi &= 0x0fff; + $tHi |= (3 << 12); + + // cast to string + $uuid = sprintf( + '%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x', + $tLo, + $tMi, + $tHi, + $csHi, + $csLo, + $byte[10], + $byte[11], + $byte[12], + $byte[13], + $byte[14], + $byte[15] + ); + + return $uuid; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Address.php new file mode 100644 index 0000000..6f4f258 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Address.php @@ -0,0 +1,152 @@ +generator->parse($format)); + } + + /** + * @example 'wewebit.jo' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Person.php new file mode 100644 index 0000000..7fcadb3 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ar_JO/Person.php @@ -0,0 +1,108 @@ +generator->parse($format)); + } + + /** + * @example 'wewebit.jo' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ar_SA/Payment.php b/vendor/fzaninotto/faker/src/Faker/Provider/ar_SA/Payment.php new file mode 100644 index 0000000..d69b5d6 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ar_SA/Payment.php @@ -0,0 +1,19 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/bg_BG/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/bg_BG/PhoneNumber.php new file mode 100644 index 0000000..e5ec042 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/bg_BG/PhoneNumber.php @@ -0,0 +1,20 @@ +generator->parse($format)); + } + + /** + * Generates valid czech IÄŒO + * + * @see http://phpfashion.com/jak-overit-platne-ic-a-rodne-cislo + * @return string + */ + public function ico() + { + $ico = static::numerify('#######'); + $split = str_split($ico); + $prod = 0; + foreach (array(8, 7, 6, 5, 4, 3, 2) as $i => $p) { + $prod += $p * $split[$i]; + } + $mod = $prod % 11; + if ($mod === 0 || $mod === 10) { + return "{$ico}1"; + } elseif ($mod === 1) { + return "{$ico}0"; + } + + return $ico . (11 - $mod); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/DateTime.php b/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/DateTime.php new file mode 100644 index 0000000..4bd1508 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/DateTime.php @@ -0,0 +1,61 @@ +format('w')]; + } + + /** + * @param \DateTime|int|string $max maximum timestamp used as random end limit, default to "now" + * @return string + * @example '2' + */ + public static function dayOfMonth($max = 'now') + { + return static::dateTime($max)->format('j'); + } + + /** + * Full date with inflected month + * @return string + * @example '16. listopadu 2003' + */ + public function formattedDate() + { + $format = static::randomElement(static::$formattedDateFormat); + + return $this->generator->parse($format); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/Internet.php new file mode 100644 index 0000000..d0d993d --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/Internet.php @@ -0,0 +1,9 @@ +generator->boolean() ? static::GENDER_MALE : static::GENDER_FEMALE; + } + + $startTimestamp = strtotime("-${maxAge} year"); + $endTimestamp = strtotime("-${minAge} year"); + $randTimestamp = static::numberBetween($startTimestamp, $endTimestamp); + + $year = intval(date('Y', $randTimestamp)); + $month = intval(date('n', $randTimestamp)); + $day = intval(date('j', $randTimestamp)); + $suffix = static::numberBetween(0, 999); + + // women has +50 to month + if ($gender == static::GENDER_FEMALE) { + $month += 50; + } + // from year 2004 everyone has +20 to month when birth numbers in one day are exhausted + if ($year >= 2004 && $this->generator->boolean(10)) { + $month += 20; + } + + $birthNumber = sprintf('%02d%02d%02d%03d', $year % 100, $month, $day, $suffix); + + // from year 1954 birth number includes CRC + if ($year >= 1954) { + $crc = intval($birthNumber, 10) % 11; + if ($crc == 10) { + $crc = 0; + } + $birthNumber .= sprintf('%d', $crc); + } + + // add slash + if ($this->generator->boolean($slashProbability)) { + $birthNumber = substr($birthNumber, 0, 6) . '/' . substr($birthNumber, 6); + } + + return $birthNumber; + } + + public static function birthNumberMale() + { + return static::birthNumber(static::GENDER_MALE); + } + + public static function birthNumberFemale() + { + return static::birthNumber(static::GENDER_FEMALE); + } + + public function title($gender = null) + { + return static::titleMale(); + } + + /** + * replaced by specific unisex Czech title + */ + public static function titleMale() + { + return static::randomElement(static::$title); + } + + /** + * replaced by specific unisex Czech title + */ + public static function titleFemale() + { + return static::titleMale(); + } + + /** + * @param string|null $gender 'male', 'female' or null for any + * @example 'Albrecht' + */ + public function lastName($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::lastNameMale(); + } elseif ($gender === static::GENDER_FEMALE) { + return static::lastNameFemale(); + } + + return $this->generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/PhoneNumber.php new file mode 100644 index 0000000..49ab429 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/cs_CZ/PhoneNumber.php @@ -0,0 +1,14 @@ + + */ +class Address extends \Faker\Provider\Address +{ + /** + * @var array Danish city suffixes. + */ + protected static $citySuffix = array( + 'sted', 'bjerg', 'borg', 'rød', 'lund', 'by', + ); + + /** + * @var array Danish street suffixes. + */ + protected static $streetSuffix = array( + 'vej', 'gade', 'skov', 'shaven', + ); + + /** + * @var array Danish street word suffixes. + */ + protected static $streetSuffixWord = array( + 'Vej', 'Gade', 'Allé', 'Boulevard', 'Plads', 'Have', + ); + + /** + * @var array Danish building numbers. + */ + protected static $buildingNumber = array( + '%##', '%#', '%#', '%', '%', '%', '%?', '% ?', + ); + + /** + * @var array Danish building level. + */ + protected static $buildingLevel = array( + 'st.', '%.', '%. sal.', + ); + + /** + * @var array Danish building sides. + */ + protected static $buildingSide = array( + 'tv.', 'th.', + ); + + /** + * @var array Danish zip code. + */ + protected static $postcode = array( + '%###' + ); + + /** + * @var array Danish cities. + */ + protected static $cityNames = array( + 'Aabenraa', 'Aabybro', 'Aakirkeby', 'Aalborg', 'Aalestrup', 'Aars', 'Aarup', 'Agedrup', 'Agerbæk', 'Agerskov', + 'Albertslund', 'Allerød', 'Allinge', 'AllingÃ¥bro', 'Almind', 'Anholt', 'Ansager', 'Arden', 'Asaa', 'Askeby', + 'Asnæs', 'Asperup', 'Assens', 'Augustenborg', 'Aulum', 'Auning', 'Bagenkop', 'Bagsværd', 'Balle', 'Ballerup', + 'Bandholm', 'Barrit', 'Beder', 'Bedsted', 'Bevtoft', 'Billum', 'Billund', 'Bindslev', 'Birkerød', 'Bjerringbro', + 'Bjert', 'Bjæverskov', 'Blokhus', 'Blommenslyst', 'BlÃ¥vand', 'Boeslunde', 'Bogense', 'Bogø', 'Bolderslev', 'Bording', + 'Borre', 'Borup', 'Brøndby', 'Brabrand', 'Bramming', 'Brande', 'Branderup', 'Bredebro', 'Bredsten', 'Brenderup', + 'Broager', 'Broby', 'Brovst', 'Bryrup', 'Brædstrup', 'Strand', 'Brønderslev', 'Brønshøj', 'Brørup', 'Bække', + 'Bækmarksbro', 'Bælum', 'Børkop', 'Bøvlingbjerg', 'Charlottenlund', 'Christiansfeld', 'Dalby', 'Dalmose', + 'Dannemare', 'DaugÃ¥rd', 'Dianalund', 'Dragør', 'Dronninglund', 'Dronningmølle', 'Dybvad', 'DyssegÃ¥rd', 'Ebberup', + 'Ebeltoft', 'Egernsund', 'Egtved', 'EgÃ¥', 'Ejby', 'Ejstrupholm', 'Engesvang', 'Errindlev', 'Erslev', 'Esbjerg', + 'Eskebjerg', 'Eskilstrup', 'Espergærde', 'Faaborg', 'Fanø', 'Farsø', 'Farum', 'Faxe', 'Ladeplads', 'Fejø', + 'Ferritslev', 'Fjenneslev', 'Fjerritslev', 'Flemming', 'Fredensborg', 'Fredericia', 'Frederiksberg', + 'Frederikshavn', 'Frederikssund', 'Frederiksværk', 'Frørup', 'Frøstrup', 'Fuglebjerg', 'Føllenslev', 'Føvling', + 'FÃ¥revejle', 'FÃ¥rup', 'FÃ¥rvang', 'Gadbjerg', 'Gadstrup', 'Galten', 'Gandrup', 'Gedser', 'Gedsted', 'Gedved', 'Gelsted', + 'Gentofte', 'Gesten', 'Gilleleje', 'Gislev', 'Gislinge', 'Gistrup', 'Give', 'Gjerlev', 'Gjern', 'Glamsbjerg', + 'Glejbjerg', 'Glesborg', 'Glostrup', 'Glumsø', 'Gram', 'Gredstedbro', 'Grenaa', 'Greve', 'Grevinge', 'Grindsted', + 'Græsted', 'GrÃ¥sten', 'Gudbjerg', 'Sydfyn', 'Gudhjem', 'Gudme', 'Guldborg', 'Gørding', 'Gørlev', 'Gørløse', + 'Haderslev', 'Haderup', 'Hadsten', 'Hadsund', 'Hals', 'Hammel', 'Hampen', 'Hanstholm', 'Harboøre', 'Harlev', 'Harndrup', + 'Harpelunde', 'Hasle', 'Haslev', 'Hasselager', 'Havdrup', 'Havndal', 'Hedehusene', 'Hedensted', 'Hejls', 'Hejnsvig', + 'Hellebæk', 'Hellerup', 'Helsinge', 'Helsingør', 'Hemmet', 'Henne', 'Herfølge', 'Herlev', 'Herlufmagle', 'Herning', + 'Hesselager', 'Hillerød', 'Hinnerup', 'Hirtshals', 'Hjallerup', 'Hjerm', 'Hjortshøj', 'Hjørring', 'Hobro', 'Holbæk', + 'Holeby', 'Holmegaard', 'Holstebro', 'Holsted', 'Holte', 'Horbelev', 'Hornbæk', 'Hornslet', 'Hornsyld', 'Horsens', + 'Horslunde', 'Hovborg', 'HovedgÃ¥rd', 'Humble', 'Humlebæk', 'Hundested', 'Hundslund', 'Hurup', 'Hvalsø', 'Hvide', + 'Sande', 'Hvidovre', 'Højbjerg', 'Højby', 'Højer', 'Højslev', 'Høng', 'Hørning', 'Hørsholm', 'Hørve', 'HÃ¥rlev', + 'Idestrup', 'Ikast', 'Ishøj', 'Janderup', 'Vestj', 'Jelling', 'Jerslev', 'Sjælland', 'Jerup', 'Jordrup', 'Juelsminde', + 'Jyderup', 'Jyllinge', 'Jystrup', 'Midtsj', 'Jægerspris', 'Kalundborg', 'Kalvehave', 'Karby', 'Karise', 'Karlslunde', + 'Karrebæksminde', 'Karup', 'Kastrup', 'Kerteminde', 'Kettinge', 'Kibæk', 'Kirke', 'Hyllinge', 'SÃ¥by', 'Kjellerup', + 'Klampenborg', 'Klarup', 'Klemensker', 'Klippinge', 'Klovborg', 'Knebel', 'Kokkedal', 'Kolding', 'Kolind', 'Kongens', + 'Lyngby', 'Kongerslev', 'Korsør', 'KrusÃ¥', 'KvistgÃ¥rd', 'Kværndrup', 'København', 'Køge', 'Langebæk', 'Langeskov', + 'LangÃ¥', 'Lejre', 'Lemming', 'Lemvig', 'Lille', 'Skensved', 'Lintrup', 'Liseleje', 'Lundby', 'Lunderskov', 'Lynge', + 'Lystrup', 'Læsø', 'Løgstrup', 'Løgstør', 'Løgumkloster', 'Løkken', 'Løsning', 'LÃ¥sby', 'Malling', 'Mariager', + 'Maribo', 'Marslev', 'Marstal', 'Martofte', 'Melby', 'Mern', 'Mesinge', 'Middelfart', 'Millinge', 'Morud', 'Munke', + 'Bjergby', 'Munkebo', 'Møldrup', 'Mørke', 'Mørkøv', 'MÃ¥løv', 'MÃ¥rslet', 'Nakskov', 'Nexø', 'Nibe', 'Nimtofte', + 'Nordborg', 'Nyborg', 'Nykøbing', 'Nyrup', 'Nysted', 'Nærum', 'Næstved', 'Nørager', 'Nørre', 'Aaby', 'Alslev', + 'Asmindrup', 'Nebel', 'Snede', 'Nørreballe', 'Nørresundby', 'Odder', 'Odense', 'Oksbøl', 'Otterup', 'Oure', 'Outrup', + 'Padborg', 'Pandrup', 'Præstø', 'Randbøl', 'Randers', 'Ranum', 'Rask', 'Mølle', 'Redsted', 'Regstrup', 'Ribe', 'Ringe', + 'Ringkøbing', 'Ringsted', 'Risskov', 'Roskilde', 'Roslev', 'Rude', 'Rudkøbing', 'Ruds', 'Vedby', 'Rungsted', 'Kyst', + 'Rynkeby', 'RyomgÃ¥rd', 'Ryslinge', 'Rødby', 'Rødding', 'Rødekro', 'Rødkærsbro', 'Rødovre', 'Rødvig', 'Stevns', + 'Rønde', 'Rønne', 'Rønnede', 'Rørvig', 'Sabro', 'Sakskøbing', 'Saltum', 'Samsø', 'Sandved', 'Sejerø', 'Silkeborg', + 'Sindal', 'Sjællands', 'Odde', 'Sjølund', 'Skagen', 'Skals', 'Skamby', 'Skanderborg', 'Skibby', 'Skive', 'Skjern', + 'Skodsborg', 'Skovlunde', 'Skælskør', 'Skærbæk', 'Skævinge', 'Skødstrup', 'Skørping', 'SkÃ¥rup', 'Slagelse', + 'Slangerup', 'Smørum', 'Snedsted', 'Snekkersten', 'Snertinge', 'Solbjerg', 'Solrød', 'Sommersted', 'Sorring', 'Sorø', + 'Spentrup', 'Spjald', 'Sporup', 'Spøttrup', 'Stakroge', 'Stege', 'Stenderup', 'Stenlille', 'Stenløse', 'Stenstrup', + 'Stensved', 'Stoholm', 'Jyll', 'Stokkemarke', 'Store', 'Fuglede', 'Heddinge', 'Merløse', 'Storvorde', 'Stouby', + 'Strandby', 'Struer', 'Strøby', 'Stubbekøbing', 'Støvring', 'Suldrup', 'Sulsted', 'Sunds', 'Svaneke', 'Svebølle', + 'Svendborg', 'Svenstrup', 'Svinninge', 'Sydals', 'Sæby', 'Søborg', 'Søby', 'Ærø', 'Søllested', 'Sønder', 'Felding', + 'Sønderborg', 'Søndersø', 'Sørvad', 'Taastrup', 'Tappernøje', 'Tarm', 'Terndrup', 'Them', 'Thisted', 'Thorsø', + 'Thyborøn', 'Thyholm', 'Tikøb', 'Tilst', 'Tinglev', 'Tistrup', 'Tisvildeleje', 'Tjele', 'Tjæreborg', 'Toftlund', + 'Tommerup', 'Toreby', 'Torrig', 'Tranbjerg', 'Tranekær', 'Trige', 'Trustrup', 'Tune', 'Tureby', 'Tylstrup', 'Tølløse', + 'Tønder', 'Tørring', 'TÃ¥rs', 'Ugerløse', 'Uldum', 'Ulfborg', 'Ullerslev', 'Ulstrup', 'Vadum', 'Valby', 'Vallensbæk', + 'Vamdrup', 'Vandel', 'Vanløse', 'Varde', 'Vedbæk', 'Veflinge', 'Vejby', 'Vejen', 'Vejers', 'Vejle', 'Vejstrup', + 'Veksø', 'Vemb', 'Vemmelev', 'Vesløs', 'Vestbjerg', 'Vester', 'Skerninge', 'Vesterborg', 'Vestervig', 'Viborg', 'Viby', + 'Videbæk', 'Vildbjerg', 'Vils', 'Vinderup', 'Vipperød', 'Virum', 'Vissenbjerg', 'Viuf', 'Vodskov', 'Vojens', 'Vonge', + 'Vorbasse', 'Vordingborg', 'Væggerløse', 'Værløse', 'Ærøskøbing', 'Ølgod', 'Ølsted', 'Ølstykke', 'Ørbæk', + 'Ørnhøj', 'Ørsted', 'Djurs', 'Østbirk', 'Øster', 'Assels', 'Ulslev', 'Østermarie', 'ØstervrÃ¥', 'Ã…byhøj', + 'Ã…lbæk', 'Ã…lsgÃ¥rde', 'Ã…rhus', 'Ã…rre', 'Ã…rslev', 'Haarby', 'NivÃ¥', 'Rømø', 'Omme', 'VrÃ¥', 'Ørum', + ); + + /** + * @var array Danish municipalities, called 'kommuner' in danish. + */ + protected static $kommuneNames = array( + 'København', 'Frederiksberg', 'Ballerup', 'Brøndby', 'Dragør', 'Gentofte', 'Gladsaxe', 'Glostrup', 'Herlev', + 'Albertslund', 'Hvidovre', 'Høje Taastrup', 'Lyngby-Taarbæk', 'Rødovre', 'Ishøj', 'TÃ¥rnby', 'Vallensbæk', + 'Allerød', 'Fredensborg', 'Helsingør', 'Hillerød', 'Hørsholm', 'Rudersdal', 'Egedal', 'Frederikssund', 'Greve', + 'Halsnæs', 'Roskilde', 'Solrød', 'Gribskov', 'Odsherred', 'Holbæk', 'Faxe', 'Kalundborg', 'Ringsted', 'Slagelse', + 'Stevns', 'Sorø', 'Lejre', 'Lolland', 'Næstved', 'Guldborgsund', 'Vordingborg', 'Bornholm', 'Middelfart', + 'Christiansø', 'Assens', 'Faaborg-Midtfyn', 'Kerteminde', 'Nyborg', 'Odense', 'Svendborg', 'Nordfyns', 'Langeland', + 'Ærø', 'Haderslev', 'Billund', 'Sønderborg', 'Tønder', 'Esbjerg', 'Fanø', 'Varde', 'Vejen', 'Aabenraa', + 'Fredericia', 'Horsens', 'Kolding', 'Vejle', 'Herning', 'Holstebro', 'Lemvig', 'Struer', 'Syddjurs', 'Furesø', + 'Norddjurs', 'Favrskov', 'Odder', 'Randers', 'Silkeborg', 'Samsø', 'Skanderborg', 'Aarhus', 'Ikast-Brande', + 'Ringkøbing-Skjern', 'Hedensted', 'Morsø', 'Skive', 'Thisted', 'Viborg', 'Brønderslev', 'Frederikshavn', + 'Vesthimmerlands', 'Læsø', 'Rebild', 'Mariagerfjord', 'Jammerbugt', 'Aalborg', 'Hjørring', 'Køge', + ); + + /** + * @var array Danish regions. + */ + protected static $regionNames = array( + 'Region Nordjylland', 'Region Midtjylland', 'Region Syddanmark', 'Region Hovedstaden', 'Region Sjælland', + ); + + /** + * @link https://github.com/umpirsky/country-list/blob/master/country/cldr/da_DK/country.php + * + * @var array Some countries in danish. + */ + protected static $country = array( + 'Andorra', 'Forenede Arabiske Emirater', 'Afghanistan', 'Antigua og Barbuda', 'Anguilla', 'Albanien', 'Armenien', + 'Hollandske Antiller', 'Angola', 'Antarktis', 'Argentina', 'Amerikansk Samoa', 'Østrig', 'Australien', 'Aruba', + 'Ã…land', 'Aserbajdsjan', 'Bosnien-Hercegovina', 'Barbados', 'Bangladesh', 'Belgien', 'Burkina Faso', 'Bulgarien', + 'Bahrain', 'Burundi', 'Benin', 'Saint Barthélemy', 'Bermuda', 'Brunei Darussalam', 'Bolivia', 'Brasilien', 'Bahamas', + 'Bhutan', 'Bouvetø', 'Botswana', 'Hviderusland', 'Belize', 'Canada', 'Cocosøerne', 'Congo-Kinshasa', + 'Centralafrikanske Republik', 'Congo', 'Schweiz', 'Elfenbenskysten', 'Cook-øerne', 'Chile', 'Cameroun', 'Kina', + 'Colombia', 'Costa Rica', 'Serbien og Montenegro', 'Cuba', 'Kap Verde', 'Juleøen', 'Cypern', 'Tjekkiet', 'Tyskland', + 'Djibouti', 'Danmark', 'Dominica', 'Den Dominikanske Republik', 'Algeriet', 'Ecuador', 'Estland', 'Egypten', + 'Vestsahara', 'Eritrea', 'Spanien', 'Etiopien', 'Finland', 'Fiji-øerne', 'Falklandsøerne', + 'Mikronesiens Forenede Stater', 'Færøerne', 'Frankrig', 'Gabon', 'Storbritannien', 'Grenada', 'Georgien', + 'Fransk Guyana', 'Guernsey', 'Ghana', 'Gibraltar', 'Grønland', 'Gambia', 'Guinea', 'Guadeloupe', 'Ækvatorialguinea', + 'Grækenland', 'South Georgia og De Sydlige Sandwichøer', 'Guatemala', 'Guam', 'Guinea-Bissau', 'Guyana', + 'SAR Hongkong', 'Heard- og McDonald-øerne', 'Honduras', 'Kroatien', 'Haiti', 'Ungarn', 'Indonesien', 'Irland', + 'Israel', 'Isle of Man', 'Indien', 'Det Britiske Territorium i Det Indiske Ocean', 'Irak', 'Iran', 'Island', + 'Italien', 'Jersey', 'Jamaica', 'Jordan', 'Japan', 'Kenya', 'Kirgisistan', 'Cambodja', 'Kiribati', 'Comorerne', + 'Saint Kitts og Nevis', 'Nordkorea', 'Sydkorea', 'Kuwait', 'Caymanøerne', 'Kasakhstan', 'Laos', 'Libanon', + 'Saint Lucia', 'Liechtenstein', 'Sri Lanka', 'Liberia', 'Lesotho', 'Litauen', 'Luxembourg', 'Letland', 'Libyen', + 'Marokko', 'Monaco', 'Republikken Moldova', 'Montenegro', 'Saint Martin', 'Madagaskar', 'Marshalløerne', + 'Republikken Makedonien', 'Mali', 'Myanmar', 'Mongoliet', 'SAR Macao', 'Nordmarianerne', 'Martinique', + 'Mauretanien', 'Montserrat', 'Malta', 'Mauritius', 'Maldiverne', 'Malawi', 'Mexico', 'Malaysia', 'Mozambique', + 'Namibia', 'Ny Caledonien', 'Niger', 'Norfolk Island', 'Nigeria', 'Nicaragua', 'Holland', 'Norge', 'Nepal', 'Nauru', + 'Niue', 'New Zealand', 'Oman', 'Panama', 'Peru', 'Fransk Polynesien', 'Papua Ny Guinea', 'Filippinerne', 'Pakistan', + 'Polen', 'Saint Pierre og Miquelon', 'Pitcairn', 'Puerto Rico', 'De palæstinensiske omrÃ¥der', 'Portugal', 'Palau', + 'Paraguay', 'Qatar', 'Reunion', 'Rumænien', 'Serbien', 'Rusland', 'Rwanda', 'Saudi-Arabien', 'Salomonøerne', + 'Seychellerne', 'Sudan', 'Sverige', 'Singapore', 'St. Helena', 'Slovenien', 'Svalbard og Jan Mayen', 'Slovakiet', + 'Sierra Leone', 'San Marino', 'Senegal', 'Somalia', 'Surinam', 'Sao Tome og Principe', 'El Salvador', 'Syrien', + 'Swaziland', 'Turks- og Caicosøerne', 'Tchad', 'Franske Besiddelser i Det Sydlige Indiske Ocean', 'Togo', + 'Thailand', 'Tadsjikistan', 'Tokelau', 'Timor-Leste', 'Turkmenistan', 'Tunesien', 'Tonga', 'Tyrkiet', + 'Trinidad og Tobago', 'Tuvalu', 'Taiwan', 'Tanzania', 'Ukraine', 'Uganda', 'De Mindre Amerikanske Oversøiske Øer', + 'USA', 'Uruguay', 'Usbekistan', 'Vatikanstaten', 'St. Vincent og Grenadinerne', 'Venezuela', + 'De britiske jomfruøer', 'De amerikanske jomfruøer', 'Vietnam', 'Vanuatu', 'Wallis og Futunaøerne', 'Samoa', + 'Yemen', 'Mayotte', 'Sydafrika', 'Zambia', 'Zimbabwe', + ); + + /** + * @var array Danish city format. + */ + protected static $cityFormats = array( + '{{cityName}}', + ); + + /** + * @var array Danish street's name formats. + */ + protected static $streetNameFormats = array( + '{{lastName}}{{streetSuffix}}', + '{{middleName}}{{streetSuffix}}', + '{{lastName}} {{streetSuffixWord}}', + '{{middleName}} {{streetSuffixWord}}', + ); + + /** + * @var array Danish street's address formats. + */ + protected static $streetAddressFormats = array( + '{{streetName}} {{buildingNumber}}', + '{{streetName}} {{buildingNumber}}, {{buildingLevel}}', + '{{streetName}} {{buildingNumber}}, {{buildingLevel}} {{buildingSide}}', + ); + + /** + * @var array Danish address format. + */ + protected static $addressFormats = array( + "{{streetAddress}}\n{{postcode}} {{city}}", + ); + + /** + * Randomly return a real city name. + * + * @return string + */ + public static function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Randomly return a suffix word. + * + * @return string + */ + public static function streetSuffixWord() + { + return static::randomElement(static::$streetSuffixWord); + } + + /** + * Randomly return a building number. + * + * @return string + */ + public static function buildingNumber() + { + return static::toUpper(static::bothify(static::randomElement(static::$buildingNumber))); + } + + /** + * Randomly return a building level. + * + * @return string + */ + public static function buildingLevel() + { + return static::numerify(static::randomElement(static::$buildingLevel)); + } + + /** + * Randomly return a side of the building. + * + * @return string + */ + public static function buildingSide() + { + return static::randomElement(static::$buildingSide); + } + + /** + * Randomly return a real municipality name, called 'kommune' in danish. + * + * @return string + */ + public static function kommune() + { + return static::randomElement(static::$kommuneNames); + } + + /** + * Randomly return a real region name. + * + * @return string + */ + public static function region() + { + return static::randomElement(static::$regionNames); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Company.php new file mode 100644 index 0000000..b9f289c --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Company.php @@ -0,0 +1,70 @@ + + */ +class Company extends \Faker\Provider\Company +{ + /** + * @var array Danish company name formats. + */ + protected static $formats = array( + '{{lastName}} {{companySuffix}}', + '{{lastName}} {{companySuffix}}', + '{{lastName}} {{companySuffix}}', + '{{firstname}} {{lastName}} {{companySuffix}}', + '{{middleName}} {{companySuffix}}', + '{{middleName}} {{companySuffix}}', + '{{middleName}} {{companySuffix}}', + '{{firstname}} {{middleName}} {{companySuffix}}', + '{{lastName}} & {{lastName}} {{companySuffix}}', + '{{lastName}} og {{lastName}} {{companySuffix}}', + '{{lastName}} & {{lastName}} {{companySuffix}}', + '{{lastName}} og {{lastName}} {{companySuffix}}', + '{{middleName}} & {{middleName}} {{companySuffix}}', + '{{middleName}} og {{middleName}} {{companySuffix}}', + '{{middleName}} & {{lastName}}', + '{{middleName}} og {{lastName}}', + ); + + /** + * @var array Company suffixes. + */ + protected static $companySuffix = array('ApS', 'A/S', 'I/S', 'K/S'); + + /** + * @link http://cvr.dk/Site/Forms/CMS/DisplayPage.aspx?pageid=60 + * + * @var string CVR number format. + */ + protected static $cvrFormat = '%#######'; + + /** + * @link http://cvr.dk/Site/Forms/CMS/DisplayPage.aspx?pageid=60 + * + * @var string P number (production number) format. + */ + protected static $pFormat = '%#########'; + + /** + * Generates a CVR number (8 digits). + * + * @return string + */ + public static function cvr() + { + return static::numerify(static::$cvrFormat); + } + + /** + * Generates a P entity number (10 digits). + * + * @return string + */ + public static function p() + { + return static::numerify(static::$pFormat); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Internet.php new file mode 100644 index 0000000..1f778de --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Internet.php @@ -0,0 +1,30 @@ + + */ +class Internet extends \Faker\Provider\Internet +{ + /** + * @var array Some safe email TLD. + */ + protected static $safeEmailTld = array( + 'org', 'com', 'net', 'dk', 'dk', 'dk', + ); + + /** + * @var array Some email domains in Denmark. + */ + protected static $freeEmailDomain = array( + 'gmail.com', 'yahoo.com', 'yahoo.dk', 'hotmail.com', 'hotmail.dk', 'mail.dk', 'live.dk' + ); + + /** + * @var array Some TLD. + */ + protected static $tld = array( + 'com', 'com', 'com', 'biz', 'info', 'net', 'org', 'dk', 'dk', 'dk', + ); +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Payment.php b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Payment.php new file mode 100644 index 0000000..6a5b6a8 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/Payment.php @@ -0,0 +1,19 @@ + + */ +class Person extends \Faker\Provider\Person +{ + /** + * @var array Danish person name formats. + */ + protected static $maleNameFormats = array( + '{{firstNameMale}} {{lastName}}', + '{{firstNameMale}} {{lastName}}', + '{{firstNameMale}} {{lastName}}', + '{{firstNameMale}} {{middleName}} {{lastName}}', + '{{firstNameMale}} {{middleName}} {{lastName}}', + '{{firstNameMale}} {{middleName}}-{{middleName}} {{lastName}}', + '{{firstNameMale}} {{middleName}} {{middleName}}-{{lastName}}', + ); + + protected static $femaleNameFormats = array( + '{{firstNameFemale}} {{lastName}}', + '{{firstNameFemale}} {{lastName}}', + '{{firstNameFemale}} {{lastName}}', + '{{firstNameFemale}} {{middleName}} {{lastName}}', + '{{firstNameFemale}} {{middleName}} {{lastName}}', + '{{firstNameFemale}} {{middleName}}-{{middleName}} {{lastName}}', + '{{firstNameFemale}} {{middleName}} {{middleName}}-{{lastName}}', + ); + + /** + * @var array Danish first names. + */ + protected static $firstNameMale = array( + 'Aage', 'Adam', 'Adolf', 'Ahmad', 'Ahmed', 'Aksel', 'Albert', 'Alex', 'Alexander', 'Alf', 'Alfred', 'Ali', 'Allan', + 'Anders', 'Andreas', 'Anker', 'Anton', 'Arne', 'Arnold', 'Arthur', 'Asbjørn', 'Asger', 'August', 'Axel', 'Benjamin', + 'Benny', 'Bent', 'Bernhard', 'Birger', 'Bjarne', 'Bjørn', 'Bo', 'Brian', 'Bruno', 'Børge', 'Carl', 'Carlo', + 'Carsten', 'Casper', 'Charles', 'Chris', 'Christian', 'Christoffer', 'Christopher', 'Claus', 'Dan', 'Daniel', 'David', 'Dennis', + 'Ebbe', 'Edmund', 'Edvard', 'Egon', 'Einar', 'Ejvind', 'Elias', 'Emanuel', 'Emil', 'Erik', 'Erland', 'Erling', + 'Ernst', 'Esben', 'Ferdinand', 'Finn', 'Flemming', 'Frank', 'Freddy', 'Frederik', 'Frits', 'Fritz', 'Frode', 'Georg', + 'Gerhard', 'Gert', 'Gunnar', 'Gustav', 'Hans', 'Harald', 'Harry', 'Hassan', 'Heine', 'Heinrich', 'Helge', 'Helmer', + 'Helmuth', 'Henning', 'Henrik', 'Henry', 'Herman', 'Hermann', 'Holger', 'Hugo', 'Ib', 'Ibrahim', 'Ivan', 'Jack', + 'Jacob', 'Jakob', 'Jan', 'Janne', 'Jens', 'Jeppe', 'Jesper', 'Jimmi', 'Jimmy', 'Joachim', 'Johan', 'Johannes', + 'John', 'Johnny', 'Jon', 'Jonas', 'Jonathan', 'Josef', 'Jul', 'Julius', 'Jørgen', 'Jørn', 'Kai', 'Kaj', + 'Karl', 'Karlo', 'Karsten', 'Kasper', 'Kenneth', 'Kent', 'Kevin', 'Kjeld', 'Klaus', 'Knud', 'Kristian', 'Kristoffer', + 'Kurt', 'Lars', 'Lasse', 'Leif', 'Lennart', 'Leo', 'Leon', 'Louis', 'Lucas', 'Lukas', 'Mads', 'Magnus', + 'Malthe', 'Marc', 'Marcus', 'Marinus', 'Marius', 'Mark', 'Markus', 'Martin', 'Martinus', 'Mathias', 'Max', 'Michael', + 'Mikael', 'Mike', 'Mikkel', 'Mogens', 'Mohamad', 'Mohamed', 'Mohammad', 'Morten', 'Nick', 'Nicklas', 'Nicolai', 'Nicolaj', + 'Niels', 'Niklas', 'Nikolaj', 'Nils', 'Olaf', 'Olav', 'Ole', 'Oliver', 'Oscar', 'Oskar', 'Otto', 'Ove', + 'Palle', 'Patrick', 'Paul', 'Peder', 'Per', 'Peter', 'Philip', 'Poul', 'Preben', 'Rasmus', 'Rene', 'René', + 'Richard', 'Robert', 'Rolf', 'Rudolf', 'Rune', 'Sebastian', 'Sigurd', 'Simon', 'Simone', 'Steen', 'Stefan', 'Steffen', + 'Sten', 'Stig', 'Sune', 'Sven', 'Svend', 'Søren', 'Tage', 'Theodor', 'Thomas', 'Thor', 'Thorvald', 'Tim', + 'Tobias', 'Tom', 'Tommy', 'Tonny', 'Torben', 'Troels', 'Uffe', 'Ulrik', 'Vagn', 'Vagner', 'Valdemar', 'Vang', + 'Verner', 'Victor', 'Viktor', 'Villy', 'Walther', 'Werner', 'Wilhelm', 'William', 'Willy', 'Ã…ge', 'Bendt', 'Bjarke', + 'Chr', 'Eigil', 'Ejgil', 'Ejler', 'Ejnar', 'Ejner', 'Evald', 'Folmer', 'Gunner', 'Gurli', 'Hartvig', 'Herluf', 'Hjalmar', + 'Ingemann', 'Ingolf', 'Ingvard', 'Keld', 'Kresten', 'Laurids', 'Laurits', 'Lauritz', 'Ludvig', 'Lynge', 'Oluf', 'Osvald', + 'Povl', 'Richardt', 'Sigfred', 'Sofus', 'Thorkild', 'Viggo', 'Vilhelm', 'Villiam', + ); + + protected static $firstNameFemale = array( + 'Aase', 'Agathe', 'Agnes', 'Alberte', 'Alexandra', 'Alice', 'Alma', 'Amalie', 'Amanda', 'Andrea', 'Ane', 'Anette', 'Anita', + 'Anja', 'Ann', 'Anna', 'Annalise', 'Anne', 'Anne-Lise', 'Anne-Marie', 'Anne-Mette', 'Annelise', 'Annette', 'Anni', 'Annie', + 'Annika', 'Anny', 'Asta', 'Astrid', 'Augusta', 'Benedikte', 'Bente', 'Berit', 'Bertha', 'Betina', 'Bettina', 'Betty', + 'Birgit', 'Birgitte', 'Birte', 'Birthe', 'Bitten', 'Bodil', 'Britt', 'Britta', 'Camilla', 'Carina', 'Carla', 'Caroline', + 'Cathrine', 'Cecilie', 'Charlotte', 'Christa', 'Christen', 'Christiane', 'Christina', 'Christine', 'Clara', 'Conni', 'Connie', 'Conny', + 'Dagmar', 'Dagny', 'Diana', 'Ditte', 'Dora', 'Doris', 'Dorte', 'Dorthe', 'Ebba', 'Edel', 'Edith', 'Eleonora', + 'Eli', 'Elin', 'Eline', 'Elinor', 'Elisa', 'Elisabeth', 'Elise', 'Ella', 'Ellen', 'Ellinor', 'Elly', 'Elna', + 'Elsa', 'Else', 'Elsebeth', 'Elvira', 'Emilie', 'Emma', 'Emmy', 'Erna', 'Ester', 'Esther', 'Eva', 'Evelyn', + 'Frede', 'Frederikke', 'Freja', 'Frida', 'Gerda', 'Gertrud', 'Gitte', 'Grete', 'Grethe', 'Gudrun', 'Hanna', 'Hanne', + 'Hardy', 'Harriet', 'Hedvig', 'Heidi', 'Helen', 'Helena', 'Helene', 'Helga', 'Helle', 'Henny', 'Henriette', 'Herdis', + 'Hilda', 'Iben', 'Ida', 'Ilse', 'Ina', 'Inga', 'Inge', 'Ingeborg', 'Ingelise', 'Inger', 'Ingrid', 'Irene', + 'Iris', 'Irma', 'Isabella', 'Jane', 'Janni', 'Jannie', 'Jeanette', 'Jeanne', 'Jenny', 'Jes', 'Jette', 'Joan', + 'Johanna', 'Johanne', 'Jonna', 'Josefine', 'Josephine', 'Juliane', 'Julie', 'Jytte', 'Kaja', 'Kamilla', 'Karen', 'Karin', + 'Karina', 'Karla', 'Karoline', 'Kate', 'Kathrine', 'Katja', 'Katrine', 'Ketty', 'Kim', 'Kirsten', 'Kirstine', 'Klara', + 'Krista', 'Kristen', 'Kristina', 'Kristine', 'Laila', 'Laura', 'Laurine', 'Lea', 'Lena', 'Lene', 'Lilian', 'Lilli', + 'Lillian', 'Lilly', 'Linda', 'Line', 'Lis', 'Lisa', 'Lisbet', 'Lisbeth', 'Lise', 'Liselotte', 'Lissi', 'Lissy', + 'Liv', 'Lizzie', 'Lone', 'Lotte', 'Louise', 'Lydia', 'Lykke', 'Lærke', 'Magda', 'Magdalene', 'Mai', 'Maiken', + 'Maj', 'Maja', 'Majbritt', 'Malene', 'Maren', 'Margit', 'Margrethe', 'Maria', 'Mariane', 'Marianne', 'Marie', 'Marlene', + 'Martha', 'Martine', 'Mary', 'Mathilde', 'Matilde', 'Merete', 'Merethe', 'Meta', 'Mette', 'Mia', 'Michelle', 'Mie', + 'Mille', 'Minna', 'Mona', 'Monica', 'Nadia', 'Nancy', 'Nanna', 'Nicoline', 'Nikoline', 'Nina', 'Ninna', 'Oda', + 'Olga', 'Olivia', 'Orla', 'Paula', 'Pauline', 'Pernille', 'Petra', 'Pia', 'Poula', 'Ragnhild', 'Randi', 'Rasmine', + 'Rebecca', 'Rebekka', 'Rigmor', 'Rikke', 'Rita', 'Rosa', 'Rose', 'Ruth', 'Sabrina', 'Sandra', 'Sanne', 'Sara', + 'Sarah', 'Selma', 'Severin', 'Sidsel', 'Signe', 'Sigrid', 'Sine', 'Sofia', 'Sofie', 'Solveig', 'Solvejg', 'Sonja', + 'Sophie', 'Stephanie', 'Stine', 'Susan', 'Susanne', 'Tanja', 'Thea', 'Theodora', 'Therese', 'Thi', 'Thyra', 'Tina', + 'Tine', 'Tove', 'Trine', 'Ulla', 'Vera', 'Vibeke', 'Victoria', 'Viktoria', 'Viola', 'Vita', 'Vivi', 'Vivian', + 'Winnie', 'Yrsa', 'Yvonne', 'Agnete', 'Agnethe', 'Alfrida', 'Alvilda', 'Anine', 'Bolette', 'Dorthea', 'Gunhild', + 'Hansine', 'Inge-Lise', 'Jensine', 'Juel', 'Jørgine', 'Kamma', 'Kristiane', 'Maj-Britt', 'Margrete', 'Metha', 'Nielsine', + 'Oline', 'Petrea', 'Petrine', 'Pouline', 'Ragna', 'Sørine', 'Thora', 'Valborg', 'Vilhelmine', + ); + + /** + * @var array Danish middle names. + */ + protected static $middleName = array( + 'Møller', 'Lund', 'Holm', 'Jensen', 'Juul', 'Nielsen', 'Kjær', 'Hansen', 'Skov', 'Østergaard', 'Vestergaard', + 'Nørgaard', 'Dahl', 'Bach', 'Friis', 'Søndergaard', 'Andersen', 'Bech', 'Pedersen', 'Bruun', 'Nygaard', 'Winther', + 'Bang', 'Krogh', 'Schmidt', 'Christensen', 'Hedegaard', 'Toft', 'Damgaard', 'Holst', 'Sørensen', 'Juhl', 'Munk', + 'Skovgaard', 'Søgaard', 'Aagaard', 'Berg', 'Dam', 'Petersen', 'Lind', 'Overgaard', 'Brandt', 'Larsen', 'Bak', 'Schou', + 'Vinther', 'Bjerregaard', 'Riis', 'Bundgaard', 'Kruse', 'Mølgaard', 'Hjorth', 'Ravn', 'Madsen', 'Rasmussen', + 'Jørgensen', 'Kristensen', 'Bonde', 'Bay', 'Hougaard', 'Dalsgaard', 'Kjærgaard', 'Haugaard', 'Munch', 'Bjerre', 'Due', + 'Sloth', 'Leth', 'Kofoed', 'Thomsen', 'Kragh', 'Højgaard', 'Dalgaard', 'Hjort', 'Kirkegaard', 'Bøgh', 'Beck', 'Nissen', + 'Rask', 'Høj', 'Brix', 'Storm', 'Buch', 'Bisgaard', 'Birch', 'Gade', 'Kjærsgaard', 'Hald', 'Lindberg', 'Høgh', 'Falk', + 'Koch', 'Thorup', 'Borup', 'Knudsen', 'Vedel', 'Poulsen', 'Bøgelund', 'Juel', 'Frost', 'Hvid', 'Bjerg', 'Bæk', 'Elkjær', + 'Hartmann', 'Kirk', 'Sand', 'Sommer', 'Skou', 'Nedergaard', 'Meldgaard', 'Brink', 'Lindegaard', 'Fischer', 'Rye', + 'Hoffmann', 'Daugaard', 'Gram', 'Johansen', 'Meyer', 'Schultz', 'Fogh', 'Bloch', 'Lundgaard', 'Brøndum', 'Jessen', + 'Busk', 'Holmgaard', 'Lindholm', 'Krog', 'Egelund', 'Engelbrecht', 'Buus', 'Korsgaard', 'Ellegaard', 'Tang', 'Steen', + 'Kvist', 'Olsen', 'Nørregaard', 'Fuglsang', 'Wulff', 'Damsgaard', 'Hauge', 'Sonne', 'Skytte', 'Brun', 'Kronborg', + 'Abildgaard', 'Fabricius', 'Bille', 'Skaarup', 'Rahbek', 'Borg', 'Torp', 'Klitgaard', 'Nørskov', 'Greve', 'Hviid', + 'Mørch', 'Buhl', 'Rohde', 'Mørk', 'Vendelbo', 'Bjørn', 'Laursen', 'Egede', 'Rytter', 'Lehmann', 'Guldberg', 'Rosendahl', + 'Krarup', 'Krogsgaard', 'Westergaard', 'Rosendal', 'Fisker', 'Højer', 'Rosenberg', 'Svane', 'Storgaard', 'Pihl', + 'Mohamed', 'Bülow', 'Birk', 'Hammer', 'Bro', 'Kaas', 'Clausen', 'Nymann', 'Egholm', 'Ingemann', 'Haahr', 'Olesen', + 'Nøhr', 'Brinch', 'Bjerring', 'Christiansen', 'Schrøder', 'Guldager', 'Skjødt', 'Højlund', 'Ørum', 'Weber', + 'Bødker', 'Bruhn', 'Stampe', 'Astrup', 'Schack', 'Mikkelsen', 'Høyer', 'Husted', 'Skriver', 'Lindgaard', 'Yde', + 'Sylvest', 'Lykkegaard', 'Ploug', 'Gammelgaard', 'Pilgaard', 'Brogaard', 'Degn', 'Kaae', 'Kofod', 'Grønbæk', + 'Lundsgaard', 'Bagge', 'Lyng', 'Rømer', 'Kjeldgaard', 'Hovgaard', 'Groth', 'Hyldgaard', 'Ladefoged', 'Jacobsen', + 'Linde', 'Lange', 'Stokholm', 'Bredahl', 'Hein', 'Mose', 'Bækgaard', 'Sandberg', 'Klarskov', 'Kamp', 'Green', + 'Iversen', 'Riber', 'Smedegaard', 'Nyholm', 'Vad', 'Balle', 'Kjeldsen', 'Strøm', 'Borch', 'Lerche', 'Grønlund', + 'VestergÃ¥rd', 'ØstergÃ¥rd', 'Nyborg', 'Qvist', 'Damkjær', 'Kold', 'Sønderskov', 'Bank', + ); + + /** + * @var array Danish last names. + */ + protected static $lastName = array( + 'Jensen', 'Nielsen', 'Hansen', 'Pedersen', 'Andersen', 'Christensen', 'Larsen', 'Sørensen', 'Rasmussen', 'Petersen', + 'Jørgensen', 'Madsen', 'Kristensen', 'Olsen', 'Christiansen', 'Thomsen', 'Poulsen', 'Johansen', 'Knudsen', 'Mortensen', + 'Møller', 'Jacobsen', 'Jakobsen', 'Olesen', 'Frederiksen', 'Mikkelsen', 'Henriksen', 'Laursen', 'Lund', 'Schmidt', + 'Eriksen', 'Holm', 'Kristiansen', 'Clausen', 'Simonsen', 'Svendsen', 'Andreasen', 'Iversen', 'Jeppesen', 'Mogensen', + 'Jespersen', 'Nissen', 'Lauridsen', 'Frandsen', 'Østergaard', 'Jepsen', 'Kjær', 'Carlsen', 'Vestergaard', 'Jessen', + 'Nørgaard', 'Dahl', 'Christoffersen', 'Skov', 'Søndergaard', 'Bertelsen', 'Bruun', 'Lassen', 'Bach', 'Gregersen', + 'Friis', 'Johnsen', 'Steffensen', 'Kjeldsen', 'Bech', 'Krogh', 'Lauritsen', 'Danielsen', 'Mathiesen', 'Andresen', + 'Brandt', 'Winther', 'Toft', 'Ravn', 'Mathiasen', 'Dam', 'Holst', 'Nilsson', 'Lind', 'Berg', 'Schou', 'Overgaard', + 'Kristoffersen', 'Schultz', 'Klausen', 'Karlsen', 'Paulsen', 'Hermansen', 'Thorsen', 'Koch', 'Thygesen', 'Bak', 'Kruse', + 'Bang', 'Juhl', 'Davidsen', 'Berthelsen', 'Nygaard', 'Lorentzen', 'Villadsen', 'Lorenzen', 'Damgaard', 'Bjerregaard', + 'Lange', 'Hedegaard', 'Bendtsen', 'Lauritzen', 'Svensson', 'Justesen', 'Juul', 'Hald', 'Beck', 'Kofoed', 'Søgaard', + 'Meyer', 'Kjærgaard', 'Riis', 'Johannsen', 'Carstensen', 'Bonde', 'Ibsen', 'Fischer', 'Andersson', 'Bundgaard', + 'Johannesen', 'Eskildsen', 'Hemmingsen', 'Andreassen', 'Thomassen', 'Schrøder', 'Persson', 'Hjorth', 'Enevoldsen', + 'Nguyen', 'Henningsen', 'Jønsson', 'Olsson', 'Asmussen', 'Michelsen', 'Vinther', 'Markussen', 'Kragh', 'Thøgersen', + 'Johansson', 'Dalsgaard', 'Gade', 'Bjerre', 'Ali', 'Laustsen', 'Buch', 'Ludvigsen', 'Hougaard', 'Kirkegaard', 'Marcussen', + 'Mølgaard', 'Ipsen', 'Sommer', 'Ottosen', 'Müller', 'Krog', 'Hoffmann', 'Clemmensen', 'Nikolajsen', 'Brodersen', + 'Therkildsen', 'Leth', 'Michaelsen', 'Graversen', 'Frost', 'Dalgaard', 'Albertsen', 'Laugesen', 'Due', 'Ebbesen', + 'Munch', 'Svenningsen', 'Ottesen', 'Fisker', 'Albrechtsen', 'Axelsen', 'Erichsen', 'Sloth', 'Bentsen', 'Westergaard', + 'Bisgaard', 'Nicolaisen', 'Magnussen', 'Thuesen', 'Povlsen', 'Thorup', 'Høj', 'Bentzen', 'Johannessen', 'Vilhelmsen', + 'Isaksen', 'Bendixen', 'Ovesen', 'Villumsen', 'Lindberg', 'Thomasen', 'Kjærsgaard', 'Buhl', 'Kofod', 'Ahmed', 'Smith', + 'Storm', 'Christophersen', 'Bruhn', 'Matthiesen', 'Wagner', 'Bjerg', 'Gram', 'Nedergaard', 'Dinesen', 'Mouritsen', + 'Boesen', 'Borup', 'Abrahamsen', 'Wulff', 'Gravesen', 'Rask', 'Pallesen', 'Greve', 'Korsgaard', 'Haugaard', 'Josefsen', + 'Bæk', 'Espersen', 'Thrane', 'Mørch', 'Frank', 'Lynge', 'Rohde', 'Larsson', 'Hammer', 'Torp', 'Sonne', 'Boysen', 'Bay', + 'Pihl', 'Fabricius', 'Høyer', 'Birch', 'Skou', 'Kirk', 'Antonsen', 'Høgh', 'Damsgaard', 'Dall', 'Truelsen', 'Daugaard', + 'Fuglsang', 'Martinsen', 'Therkelsen', 'Jansen', 'Karlsson', 'Caspersen', 'Steen', 'Callesen', 'Balle', 'Bloch', 'Smidt', + 'Rahbek', 'Hjort', 'Bjørn', 'Skaarup', 'Sand', 'Storgaard', 'Willumsen', 'Busk', 'Hartmann', 'Ladefoged', 'Skovgaard', + 'Philipsen', 'Damm', 'Haagensen', 'Hviid', 'Duus', 'Kvist', 'Adamsen', 'Mathiassen', 'Degn', 'Borg', 'Brix', 'Troelsen', + 'Ditlevsen', 'Brøndum', 'Svane', 'Mohamed', 'Birk', 'Brink', 'Hassan', 'Vester', 'Elkjær', 'Lykke', 'Nørregaard', + 'Meldgaard', 'Mørk', 'Hvid', 'Abildgaard', 'Nicolajsen', 'Bengtsson', 'Stokholm', 'Ahmad', 'Wind', 'Rømer', 'Gundersen', + 'Carlsson', 'Grøn', 'Khan', 'Skytte', 'Bagger', 'Hendriksen', 'Rosenberg', 'Jonassen', 'Severinsen', 'Jürgensen', + 'Boisen', 'Groth', 'Bager', 'Fogh', 'Hussain', 'Samuelsen', 'Pilgaard', 'Bødker', 'Dideriksen', 'Brogaard', 'Lundberg', + 'Hansson', 'Schwartz', 'Tran', 'Skriver', 'Klitgaard', 'Hauge', 'Højgaard', 'Qvist', 'Voss', 'Strøm', 'Wolff', 'Krarup', + 'Green', 'Odgaard', 'Tønnesen', 'Blom', 'Gammelgaard', 'Jæger', 'Kramer', 'Astrup', 'Würtz', 'Lehmann', 'Koefoed', + 'Skøtt', 'Lundsgaard', 'Bøgh', 'Vang', 'Martinussen', 'Sandberg', 'Weber', 'Holmgaard', 'Bidstrup', 'Meier', 'Drejer', + 'Schneider', 'Joensen', 'Dupont', 'Lorentsen', 'Bro', 'Bagge', 'Terkelsen', 'Kaspersen', 'Keller', 'Eliasen', 'Lyberth', + 'Husted', 'Mouritzen', 'Krag', 'Kragelund', 'Nørskov', 'Vad', 'Jochumsen', 'Hein', 'Krogsgaard', 'Kaas', 'Tolstrup', + 'Ernst', 'Hermann', 'Børgesen', 'Skjødt', 'Holt', 'Buus', 'Gotfredsen', 'Kjeldgaard', 'Broberg', 'Roed', 'Sivertsen', + 'Bergmann', 'Bjerrum', 'Petersson', 'Smed', 'Jeremiassen', 'Nyborg', 'Borch', 'Foged', 'Terp', 'Mark', 'Busch', + 'Lundgaard', 'Boye', 'Yde', 'Hinrichsen', 'Matzen', 'Esbensen', 'Hertz', 'Westh', 'Holmberg', 'Geertsen', 'Raun', + 'Aagaard', 'Kock', 'Falk', 'Munk', + ); + + /** + * Randomly return a danish name. + * + * @return string + */ + public static function middleName() + { + return static::randomElement(static::$middleName); + } + + /** + * Randomly return a danish CPR number (Personnal identification number) format. + * + * @link http://cpr.dk/cpr/site.aspx?p=16 + * @link http://en.wikipedia.org/wiki/Personal_identification_number_%28Denmark%29 + * + * @return string + */ + public static function cpr() + { + $birthdate = new \DateTime('@' . mt_rand(0, time())); + + return sprintf('%s-%s', $birthdate->format('dmy'), static::numerify('%###')); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/PhoneNumber.php new file mode 100644 index 0000000..af96d3f --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/da_DK/PhoneNumber.php @@ -0,0 +1,21 @@ + + */ +class PhoneNumber extends \Faker\Provider\PhoneNumber +{ + /** + * @var array Danish phonenumber formats. + */ + protected static $formats = array( + '+45 ## ## ## ##', + '+45 #### ####', + '+45########', + '## ## ## ##', + '#### ####', + '########', + ); +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/de_AT/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/de_AT/Address.php new file mode 100644 index 0000000..861f6fc --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/de_AT/Address.php @@ -0,0 +1,116 @@ + 'Aargau'), + array('AI' => 'Appenzell Innerrhoden'), + array('AR' => 'Appenzell Ausserrhoden'), + array('BE' => 'Bern'), + array('BL' => 'Basel-Landschaft'), + array('BS' => 'Basel-Stadt'), + array('FR' => 'Freiburg'), + array('GE' => 'Genf'), + array('GL' => 'Glarus'), + array('GR' => 'Graubünden'), + array('JU' => 'Jura',), + array('LU' => 'Luzern'), + array('NE' => 'Neuenburg'), + array('NW' => 'Nidwalden'), + array('OW' => 'Obwalden'), + array('SG' => 'St. Gallen'), + array('SH' => 'Schaffhausen'), + array('SO' => 'Solothurn'), + array('SZ' => 'Schwyz'), + array('TG' => 'Thurgau'), + array('TI' => 'Tessin'), + array('UR' => 'Uri'), + array('VD' => 'Waadt'), + array('VS' => 'Wallis'), + array('ZG' => 'Zug'), + array('ZH' => 'Zürich') + ); + + protected static $country = array( + 'Afghanistan', 'Alandinseln', 'Albanien', 'Algerien', 'Amerikanisch-Ozeanien', 'Amerikanisch-Samoa', 'Amerikanische Jungferninseln', 'Andorra', 'Angola', 'Anguilla', 'Antarktis', 'Antigua und Barbuda', 'Argentinien', 'Armenien', 'Aruba', 'Aserbaidschan', 'Australien', 'Ägypten', 'Äquatorialguinea', 'Äthiopien', 'Äusseres Ozeanien', + 'Bahamas', 'Bahrain', 'Bangladesch', 'Barbados', 'Belarus', 'Belgien', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivien', 'Bosnien und Herzegowina', 'Botsuana', 'Bouvetinsel', 'Brasilien', 'Britische Jungferninseln', 'Britisches Territorium im Indischen Ozean', 'Brunei Darussalam', 'Bulgarien', 'Burkina Faso', 'Burundi', + 'Chile', 'China', 'Cookinseln', 'Costa Rica', 'Côte d’Ivoire', + 'Demokratische Republik Kongo', 'Demokratische Volksrepublik Korea', 'Deutschland', 'Dominica', 'Dominikanische Republik', 'Dschibuti', 'Dänemark', + 'Ecuador', 'El Salvador', 'Eritrea', 'Estland', 'Europäische Union', + 'Falklandinseln', 'Fidschi', 'Finnland', 'Frankreich', 'Französisch-Guayana', 'Französisch-Polynesien', 'Französische Süd- und Antarktisgebiete', 'Färöer', + 'Gabun', 'Gambia', 'Georgien', 'Ghana', 'Gibraltar', 'Grenada', 'Griechenland', 'Grönland', 'Guadeloupe', 'Guam', 'Guatemala', 'Guernsey', 'Guinea', 'Guinea-Bissau', 'Guyana', + 'Haiti', 'Heard- und McDonald-Inseln', 'Honduras', + 'Indien', 'Indonesien', 'Irak', 'Iran', 'Irland', 'Island', 'Isle of Man', 'Israel', 'Italien', + 'Jamaika', 'Japan', 'Jemen', 'Jersey', 'Jordanien', + 'Kaimaninseln', 'Kambodscha', 'Kamerun', 'Kanada', 'Kap Verde', 'Kasachstan', 'Katar', 'Kenia', 'Kirgisistan', 'Kiribati', 'Kokosinseln', 'Kolumbien', 'Komoren', 'Kongo', 'Kroatien', 'Kuba', 'Kuwait', + 'Laos', 'Lesotho', 'Lettland', 'Libanon', 'Liberia', 'Libyen', 'Liechtenstein', 'Litauen', 'Luxemburg', + 'Madagaskar', 'Malawi', 'Malaysia', 'Malediven', 'Mali', 'Malta', 'Marokko', 'Marshallinseln', 'Martinique', 'Mauretanien', 'Mauritius', 'Mayotte', 'Mazedonien', 'Mexiko', 'Mikronesien', 'Monaco', 'Mongolei', 'Montenegro', 'Montserrat', 'Mosambik', 'Myanmar', + 'Namibia', 'Nauru', 'Nepal', 'Neukaledonien', 'Neuseeland', 'Nicaragua', 'Niederlande', 'Niederländische Antillen', 'Niger', 'Nigeria', 'Niue', 'Norfolkinsel', 'Norwegen', 'Nördliche Marianen', + 'Oman', 'Osttimor', 'Österreich', + 'Pakistan', 'Palau', 'Palästinensische Gebiete', 'Panama', 'Papua-Neuguinea', 'Paraguay', 'Peru', 'Philippinen', 'Pitcairn', 'Polen', 'Portugal', 'Puerto Rico', + 'Republik Korea', 'Republik Moldau', 'Ruanda', 'Rumänien', 'Russische Föderation', 'Réunion', + 'Salomonen', 'Sambia', 'Samoa', 'San Marino', 'Saudi-Arabien', 'Schweden', 'Schweiz', 'Senegal', 'Serbien', 'Serbien und Montenegro', 'Seychellen', 'Sierra Leone', 'Simbabwe', 'Singapur', 'Slowakei', 'Slowenien', 'Somalia', 'Sonderverwaltungszone Hongkong', 'Sonderverwaltungszone Macao', 'Spanien', 'Sri Lanka', 'St. Barthélemy', 'St. Helena', 'St. Kitts und Nevis', 'St. Lucia', 'St. Martin', 'St. Pierre und Miquelon', 'St. Vincent und die Grenadinen', 'Sudan', 'Suriname', 'Svalbard und Jan Mayen', 'Swasiland', 'Syrien', 'São Tomé und Príncipe', 'Südafrika', 'Südgeorgien und die Südlichen Sandwichinseln', + 'Tadschikistan', 'Taiwan', 'Tansania', 'Thailand', 'Togo', 'Tokelau', 'Tonga', 'Trinidad und Tobago', 'Tschad', 'Tschechische Republik', 'Tunesien', 'Turkmenistan', 'Turks- und Caicosinseln', 'Tuvalu', 'Türkei', + 'Uganda', 'Ukraine', 'Unbekannte oder ungültige Region', 'Ungarn', 'Uruguay', 'Usbekistan', + 'Vanuatu', 'Vatikanstadt', 'Venezuela', 'Vereinigte Arabische Emirate', 'Vereinigte Staaten', 'Vereinigtes Königreich', 'Vietnam', + 'Wallis und Futuna', 'Weihnachtsinsel', 'Westsahara', + 'Zentralafrikanische Republik', 'Zypern', + ); + + protected static $cityFormats = array( + '{{cityName}}', + ); + + protected static $streetNameFormats = array( + '{{lastName}}{{streetSuffixShort}}', + '{{cityName}}{{streetSuffixShort}}', + '{{firstName}}-{{lastName}}-{{streetSuffixLong}}' + ); + + protected static $streetAddressFormats = array( + '{{streetName}} {{buildingNumber}}', + ); + protected static $addressFormats = array( + "{{streetAddress}}\n{{postcode}} {{city}}", + ); + + /** + * Returns a random city name. + * @example Luzern + * @return string + */ + public function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Returns a random street suffix. + * @example str. + * @return string + */ + public function streetSuffixShort() + { + return static::randomElement(static::$streetSuffixShort); + } + + /** + * Returns a random street suffix. + * @example Strasse + * @return string + */ + public function streetSuffixLong() + { + return static::randomElement(static::$streetSuffixLong); + } + + /** + * Returns a canton + * @example array('BE' => 'Bern') + * @return array + */ + public static function canton() + { + return static::randomElement(static::$canton); + } + + /** + * Returns the abbreviation of a canton. + * @return string + */ + public static function cantonShort() + { + $canton = static::canton(); + return key($canton); + } + + /** + * Returns the name of canton. + * @return string + */ + public static function cantonName() + { + $canton = static::canton(); + return current($canton); + } + + public static function buildingNumber() + { + return static::regexify(self::numerify(static::randomElement(static::$buildingNumber))); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/de_CH/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/de_CH/Company.php new file mode 100644 index 0000000..604ec5a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/de_CH/Company.php @@ -0,0 +1,15 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + /** + * @example 'ΘεωδωÏόπουλος' + */ + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + /** + * @example 'Κοκκίνου' + */ + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/el_GR/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/el_GR/PhoneNumber.php new file mode 100644 index 0000000..f8cf8b3 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/el_GR/PhoneNumber.php @@ -0,0 +1,85 @@ +generator->parse(static::randomElement(static::$towns)); + } + + public function syllable() + { + return static::randomElement(static::$syllables); + } + + public function direction() + { + return static::randomElement(static::$directions); + } + + public function englishStreetName() + { + return static::randomElement(static::$englishStreetNames); + } + + public function villageSuffix() + { + return static::randomElement(static::$villageSuffixes); + } + + public function estateSuffix() + { + return static::randomElement(static::$estateSuffixes); + } + + public function village() + { + return $this->generator->parse(static::randomElement(static::$villageNameFormats)); + } + + public function estate() + { + return $this->generator->parse(static::randomElement(static::$estateNameFormats)); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/en_HK/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/en_HK/Internet.php new file mode 100644 index 0000000..4d82d93 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/en_HK/Internet.php @@ -0,0 +1,14 @@ +generator->parse(static::randomElement(static::$societyNameFormat)); + } + /** + * @example Mumbai + */ + public function city() + { + return static::randomElement(static::$city); + } + /** + * @example Vaishali Nagar + */ + public function locality() + { + return $this->generator->parse(static::randomElement(static::$localityFormats)); + } + /* + * @example Kharadi + */ + public function localityName() + { + return $this->generator->parse(static::randomElement(static::$localityName)); + } + /** + * @example Nagar + */ + public function areaSuffix() + { + return static::randomElement(static::$areaSuffix); + } + + /** + * @example 'Delhi' + */ + public static function state() + { + return static::randomElement(static::$state); + } + + /** + * @example 'DL' + */ + public static function stateAbbr() + { + return static::randomElement(static::$stateAbbr); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/en_IN/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/en_IN/Internet.php new file mode 100644 index 0000000..6ec1671 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/en_IN/Internet.php @@ -0,0 +1,9 @@ +generator->parse($format)); + } + + public function fixedLineNumber() + { + $format = static::randomElement(static::$fixedLineNumberFormats); + + return static::numerify($this->generator->parse($format)); + } + + public function voipNumber() + { + $format = static::randomElement(static::$voipNumber); + + return $this->generator->parse($format); + } + + public function internationalCodePrefix() + { + $format = static::randomElement(static::$internationalCodePrefix); + + return $this->generator->parse($format); + } + + public function zeroToEight() + { + return static::randomElement(static::$zeroToEight); + } + + public function oneToNine() + { + return static::randomElement(static::$oneToNine); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/en_UG/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/en_UG/Address.php new file mode 100644 index 0000000..eb817e3 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/en_UG/Address.php @@ -0,0 +1,101 @@ +generator->parse($format)); + } + + /** + * NPA-format area code + * + * @see https://en.wikipedia.org/wiki/North_American_Numbering_Plan#Numbering_system + * + * @return string + */ + public static function areaCode() + { + $digits[] = self::numberBetween(2, 9); + $digits[] = self::randomDigit(); + $digits[] = self::randomDigitNot($digits[1]); + + return join('', $digits); + } + + /** + * NXX-format central office exchange code + * + * @see https://en.wikipedia.org/wiki/North_American_Numbering_Plan#Numbering_system + * + * @return string + */ + public static function exchangeCode() + { + $digits[] = self::numberBetween(2, 9); + $digits[] = self::randomDigit(); + + if ($digits[1] === 1) { + $digits[] = self::randomDigitNot(1); + } else { + $digits[] = self::randomDigit(); + } + + return join('', $digits); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/en_US/Text.php b/vendor/fzaninotto/faker/src/Faker/Provider/en_US/Text.php new file mode 100644 index 0000000..b3c5258 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/en_US/Text.php @@ -0,0 +1,3720 @@ +format('Y'), + static::randomNumber(6, true), + static::randomElement(static::$legalEntities) + ); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/Internet.php new file mode 100644 index 0000000..0c5c5f4 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/Internet.php @@ -0,0 +1,18 @@ +generator->dateTimeThisCentury(); + } + $birthDateString = $birthdate->format('ymd'); + switch (strtolower($gender)) { + case static::GENDER_FEMALE: + $genderDigit = self::numberBetween(0, 4); + break; + case static::GENDER_MALE: + $genderDigit = self::numberBetween(5, 9); + break; + default: + $genderDigit = self::numberBetween(0, 9); + } + $sequenceDigits = str_pad(self::randomNumber(3), 3, 0, STR_PAD_BOTH); + $citizenDigit = ($citizen === true) ? '0' : '1'; + $raceDigit = self::numberBetween(8, 9); + + $partialIdNumber = $birthDateString . $genderDigit . $sequenceDigits . $citizenDigit . $raceDigit; + + return $partialIdNumber . Luhn::computeCheckDigit($partialIdNumber); + } + + /** + * @see https://en.wikipedia.org/wiki/Driving_licence_in_South_Africa + * + * @return string + */ + public function licenceCode() + { + return static::randomElement(static::$licenceCodes); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/PhoneNumber.php new file mode 100644 index 0000000..02a364d --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/en_ZA/PhoneNumber.php @@ -0,0 +1,100 @@ +generator->parse($format)); + } + + public function tollFreeNumber() + { + $format = static::randomElement(static::$specialFormats); + + return self::numerify($this->generator->parse($format)); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/es_AR/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/es_AR/Address.php new file mode 100644 index 0000000..70f503f --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/es_AR/Address.php @@ -0,0 +1,68 @@ +numberBetween(10000, 100000000); + } + + return $id . $separator . $this->numberBetween(80000000, 100000000); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/es_VE/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/es_VE/PhoneNumber.php new file mode 100644 index 0000000..74caecc --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/es_VE/PhoneNumber.php @@ -0,0 +1,29 @@ +generator->parse($format); + } + + /** + * @example 'کد پستی' + */ + public static function postcodePrefix() + { + return static::randomElement(static::$postcodePrefix); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Company.php new file mode 100644 index 0000000..0de47b3 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Company.php @@ -0,0 +1,57 @@ +generator->parse($format)); + } + + /** + * @example 'ahmad.ir' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Person.php new file mode 100644 index 0000000..055b863 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fa_IR/Person.php @@ -0,0 +1,137 @@ + 5) { + throw new \InvalidArgumentException('indexSize must be at most 5'); + } + + $words = $this->getConsecutiveWords($indexSize); + $result = array(); + $resultLength = 0; + // take a random starting point + $next = static::randomKey($words); + while ($resultLength < $maxNbChars && isset($words[$next])) { + // fetch a random word to append + $word = static::randomElement($words[$next]); + + // calculate next index + $currentWords = explode(' ', $next); + + $currentWords[] = $word; + array_shift($currentWords); + $next = implode(' ', $currentWords); + + if ($resultLength == 0 && !preg_match('/^[\x{0600}-\x{06FF}]/u', $word)) { + continue; + } + // append the element + $result[] = $word; + $resultLength += strlen($word) + 1; + } + + // remove the element that caused the text to overflow + array_pop($result); + + // build result + $result = implode(' ', $result); + + return $result.'.'; + } + + /** + * License: Creative Commons Attribution-ShareAlike License + * + * Title: مدیر مدرسه + * Author: جلال آل‌احمد + * Language: Persian + * + * @see http://fa.wikisource.org/wiki/%D9%85%D8%AF%DB%8C%D8%B1_%D9%85%D8%AF%D8%B1%D8%B3%D9%87 + * @var string + */ + protected static $baseText = <<<'EOT' +از در Ú©Ù‡ وارد شدم سیگارم دستم بود. زورم آمد سلام کنم. همین طوری دنگم گرÙته بود قد باشم. رئیس Ùرهنگ Ú©Ù‡ اجازه‌ی نشستن داد، نگاهش لحظه‌ای روی دستم Ù…Ú©Ø« کرد Ùˆ بعد چیزی را Ú©Ù‡ می‌نوشت، تمام کرد Ùˆ می‌خواست متوجه من بشود Ú©Ù‡ رونویس Ø­Ú©Ù… را روی میزش گذاشته بودم. حرÙÛŒ نزدیم. رونویس را با کاغذهای ضمیمه‌اش زیر Ùˆ رو کرد Ùˆ بعد غبغب انداخت Ùˆ آرام Ùˆ مثلاً خالی از عصبانیت Ú¯Ùت: + +- جا نداریم آقا. این Ú©Ù‡ نمی‌شه! هر روز یه Ø­Ú©Ù… می‌دند دست یکی می‌Ùرستنش سراغ من... دیروز به آقای مدیر Ú©Ù„... + +حوصله‌ی این اباطیل را نداشتم. حرÙØ´ را بریدم Ú©Ù‡: + +- ممکنه خواهش کنم زیر همین ورقه مرقوم بÙرمایید؟ + +Ùˆ سیگارم را توی زیرسیگاری براق روی میزش تکاندم. روی میز، پاک Ùˆ مرتب بود. درست مثل اتاق همان مهمان‌خانه‌ی تازه‌عروس‌ها. هر چیز به جای خود Ùˆ نه یک ذره گرد. Ùقط خاکستر سیگار من زیادی بود. مثل تÙÛŒ در صورت تازه تراشیده‌ای.... قلم را برداشت Ùˆ زیر Ø­Ú©Ù… چیزی نوشت Ùˆ امضا کرد Ùˆ من از در آمده بودم بیرون. خلاص. تحمل این یکی را نداشتم. با اداهایش. پیدا بود Ú©Ù‡ تازه رئیس شده. زورکی غبغب می‌انداخت Ùˆ حرÙØ´ را آهسته توی چشم آدم می‌زد. انگار برای شنیدنش گوش لازم نیست. صد Ùˆ پنجاه تومان در کارگزینی Ú©Ù„ مایه گذاشته بودم تا این Ø­Ú©Ù… را به امضا رسانده بودم. توصیه هم برده بودم Ùˆ تازه دو ماه هم دویده بودم. مو، لای درزش نمی‌رÙت. می‌دانستم Ú©Ù‡ Ú†Ù‡ او بپذیرد، Ú†Ù‡ نپذیرد، کار تمام است. خودش هم می‌دانست. حتماً هم دستگیرش شد Ú©Ù‡ با این Ù†Ú© Ùˆ نالی Ú©Ù‡ می‌کرد، خودش را کن٠کرده. ولی کاری بود Ùˆ شده بود. در کارگزینی Ú©Ù„ØŒ سÙارش کرده بودند Ú©Ù‡ برای خالی نبودن عریضه رونویس را به رؤیت رئیس Ùرهنگ هم برسانم تازه این طور شد. Ùˆ گر نه بالی Ø­Ú©Ù… کارگزینی Ú©Ù„ Ú†Ù‡ کسی می‌توانست حرÙÛŒ بزند؟ یک وزارت خانه بود Ùˆ یک کارگزینی! شوخی Ú©Ù‡ نبود. ته دلم قرص‌تر از این‌ها بود Ú©Ù‡ محتاج به این استدلال‌ها باشم. اما به نظرم همه‌ی این تقصیرها از این سیگار لعنتی بود Ú©Ù‡ به خیال خودم خواسته بودم خرجش را از محل اضاÙÙ‡ حقوق شغل جدیدم در بیاورم. البته از معلمی، هم اÙقم نشسته بود. ده سال «الÙ.ب.» درس دادن Ùˆ قیاÙه‌های بهت‌زده‌ی بچه‌های مردم برای مزخرÙ‌ترین چرندی Ú©Ù‡ می‌گویی... Ùˆ استغناء با غین Ùˆ استقراء با قا٠و خراسانی Ùˆ هندی Ùˆ قدیمی‌ترین شعر دری Ùˆ صنعت ارسال مثل Ùˆ ردالعجز... Ùˆ از این مزخرÙات! دیدم دارم خر می‌شوم. Ú¯Ùتم مدیر بشوم. مدیر دبستان! دیگر نه درس خواهم داد Ùˆ نه مجبور خواهم بود برای Ùرار از اتلا٠وقت، در امتحان تجدیدی به هر احمق بی‌شعوری Ù‡Ùت بدهم تا ایام آخر تابستانم را Ú©Ù‡ لذیذترین تکه‌ی تعطیلات است، نجات داده باشم. این بود Ú©Ù‡ راه اÙتادم. رÙتم Ùˆ از اهلش پرسیدم. از یک کار چاق Ú©Ù†. دستم را توی دست کارگزینی گذاشت Ùˆ قول Ùˆ قرار Ùˆ طرÙین خوش Ùˆ خرم Ùˆ یک روز هم نشانی مدرسه را دستم دادند Ú©Ù‡ بروم وارسی، Ú©Ù‡ باب میلم هست یا نه. + +Ùˆ رÙتم. مدرسه دو طبقه بود Ùˆ نوساز بود Ùˆ در دامنه‌ی کوه تنها اÙتاده بود Ùˆ Ø¢Ùتاب‌رو بود. یک Ùرهنگ‌دوست خرپول، عمارتش را وسط زمین خودش ساخته بود Ùˆ بیست Ùˆ پنج سال هم در اختیار Ùرهنگ گذاشته بود Ú©Ù‡ مدرسه‌اش کنند Ùˆ رÙت Ùˆ آمد بشود Ùˆ جاده‌ها کوبیده بشود Ùˆ این قدر ازین بشودها بشود، تا دل ننه باباها بسوزد Ùˆ برای این‌که راه بچه‌هاشان را کوتاه بکنند، بیایند همان اطرا٠مدرسه را بخرند Ùˆ خانه بسازند Ùˆ زمین یارو از متری یک عباسی بشود صد تومان. یارو اسمش را هم روی دیوار مدرسه کاشی‌کاری کرده بود. هنوز در Ùˆ همسایه پیدا نکرده بودند Ú©Ù‡ حرÙ‌شان بشود Ùˆ لنگ Ùˆ پاچه‌ی سعدی Ùˆ باباطاهر را بکشند میان Ùˆ یک ورق دیگر از تاریخ‌الشعرا را بکوبند روی نبش دیوار کوچه‌شان. تابلوی مدرسه هم حسابی Ùˆ بزرگ Ùˆ خوانا. از صد متری داد می‌زد Ú©Ù‡ توانا بود هر.... هر Ú†Ù‡ دلتان بخواهد! با شیر Ùˆ خورشیدش Ú©Ù‡ آن بالا سر، سه پا ایستاده بود Ùˆ زورکی تعادل خودش را Ø­Ùظ می‌کرد Ùˆ خورشید خانم روی کولش با ابروهای پیوسته Ùˆ قمچیلی Ú©Ù‡ به دست داشت Ùˆ تا سه تیر پرتاب، اطرا٠مدرسه بیابان بود. درندشت Ùˆ بی آب Ùˆ آبادانی Ùˆ آن ته رو به شمال، ردی٠کاج‌های درهم Ùرو رÙته‌ای Ú©Ù‡ از سر دیوار Ú¯Ù„ÛŒ یک باغ پیدا بود روی آسمان لکه‌ی دراز Ùˆ تیره‌ای زده بود. حتماً تا بیست Ùˆ پنج سال دیگر همه‌ی این اطرا٠پر می‌شد Ùˆ بوق ماشین Ùˆ ونگ ونگ بچه‌ها Ùˆ Ùریاد لبویی Ùˆ زنگ روزنامه‌Ùروشی Ùˆ عربده‌ی Ú¯Ù„ به سر دارم خیار! نان یارو توی روغن بود. + +- راستی شاید متری ده دوازده شاهی بیشتر نخریده باشد؟ شاید هم زمین‌ها را همین جوری به ثبت داده باشد؟ هان؟ + +- احمق به توچه؟!... + +بله این Ùکرها را همان روزی کردم Ú©Ù‡ ناشناس به مدرسه سر زدم Ùˆ آخر سر هم به این نتیجه رسیدم Ú©Ù‡ مردم حق دارند جایی بخوابند Ú©Ù‡ آب زیرشان نرود. + +- تو اگر مردی، عرضه داشته باش مدیر همین مدرسه هم بشو. + +Ùˆ رÙته بودم Ùˆ دنبال کار را گرÙته بودم تا رسیده بودم به این‌جا. همان روز وارسی Ùهمیده بودم Ú©Ù‡ مدیر قبلی مدرسه زندانی است. لابد کله‌اش بوی قرمه‌سبزی می‌داده Ùˆ باز لابد حالا دارد Ú©Ùاره‌ی گناهانی را می‌دهد Ú©Ù‡ یا خودش نکرده یا آهنگری در بلخ کرده. جزو پر قیچی‌های رئیس Ùرهنگ هم کسی نبود Ú©Ù‡ با مدیرشان، اضاÙÙ‡ حقوقی نصیبش بشود Ùˆ ناچار سر Ùˆ دستی برای این کار بشکند. خارج از مرکز هم نداشت. این معلومات را توی کارگزینی به دست آورده بودم. هنوز «گه خوردم نامه‌نویسی» هم مد نشده بود Ú©Ù‡ بگویم یارو به این زودی‌ها از سولدونی در خواهد آمد. Ùکر نمی‌کردم Ú©Ù‡ دیگری هم برای این وسط بیابان دلش Ù„Ú© زده باشد با زمستان سختش Ùˆ با رÙت Ùˆ آمد دشوارش. + +این بود Ú©Ù‡ خیالم راحت بود. از همه‌ی این‌ها گذشته کارگزینی Ú©Ù„ مواÙقت کرده بود! دست است Ú©Ù‡ پیش از بلند شدن بوی اسکناس، آن جا هم دو سه تا عیب شرعی Ùˆ عرÙÛŒ گرÙته بودند Ùˆ مثلاً Ú¯Ùته بودن لابد کاسه‌ای زیر نیم کاسه است Ú©Ù‡ Ùلانی یعنی من، با ده سال سابقه‌ی تدریس، می‌خواهد مدیر دبستان بشود! غرض‌شان این بود Ú©Ù‡ لابد خل شدم Ú©Ù‡ از شغل مهم Ùˆ محترم دبیری دست می‌شویم. ماهی صد Ùˆ پنجاه تومان حق مقام در آن روزها پولی نبود Ú©Ù‡ بتوانم نادیده بگیرم. Ùˆ تازه اگر ندیده می‌گرÙتم چه؟ باز باید بر می‌گشتم به این کلاس‌ها Ùˆ این جور حماقت‌ها. این بود Ú©Ù‡ پیش رئیس Ùرهنگ، صا٠برگشتم به کارگزینی Ú©Ù„ØŒ سراغ آن Ú©Ù‡ بÙهمی Ù†Ùهمی، دلال کارم بود. Ùˆ رونویس Ø­Ú©Ù… را گذاشتم Ùˆ Ú¯Ùتم Ú©Ù‡ Ú†Ù‡ طور شد Ùˆ آمدم بیرون. + +دو روز بعد رÙتم سراغش. معلوم شد Ú©Ù‡ حدسم درست بوده است Ùˆ رئیس Ùرهنگ Ú¯Ùته بوده: «من از این لیسانسه‌های پر اÙاده نمی‌خواهم Ú©Ù‡ سیگار به دست توی هر اتاقی سر می‌کنند.» + +Ùˆ یارو برایش Ú¯Ùته بود Ú©Ù‡ اصلاً وابدا..! Ùلانی همچین Ùˆ همچون است Ùˆ مثقالی Ù‡Ùت صنار با دیگران Ùرق دارد Ùˆ این هندوانه‌ها Ùˆ خیال من راحت باشد Ùˆ پنج‌شنبه یک Ù‡Ùته‌ی دیگر خودم بروم پهلوی او... Ùˆ این کار را کردم. این بار رئیس Ùرهنگ جلوی پایم بلند شد Ú©Ù‡: «ای آقا... چرا اول Ù†Ùرمودید؟!...» Ùˆ از کارمندهایش گله کرد Ùˆ به قول خودش، مرا «در جریان موقعیت محل» گذاشت Ùˆ بعد با ماشین خودش مرا به مدرسه رساند Ùˆ Ú¯Ùت زنگ را زودتر از موعد زدند Ùˆ در حضور معلم‌ها Ùˆ ناظم، نطق غرایی در خصائل مدیر جدید – Ú©Ù‡ من باشم – کرد Ùˆ بعد هم مرا گذاشت Ùˆ رÙت با یک مدرسه‌ی شش کلاسه‌ی «نوبنیاد» Ùˆ یک ناظم Ùˆ Ù‡Ùت تا معلم Ùˆ دویست Ùˆ سی Ùˆ پنج تا شاگرد. دیگر حسابی مدیر مدرسه شده بودم! + +ناظم، جوان رشیدی بود Ú©Ù‡ بلند حر٠می‌زد Ùˆ به راحتی امر Ùˆ نهی می‌کرد Ùˆ بیا Ùˆ برویی داشت Ùˆ با شاگردهای درشت، روی هم ریخته بود Ú©Ù‡ خودشان ترتیب کارها را می‌دادند Ùˆ پیدا بود Ú©Ù‡ به سر خر احتیاجی ندارد Ùˆ بی‌مدیر هم می‌تواند گلیم مدرسه را از آب بکشد. معلم کلاس چهار خیلی گنده بود. دو تای یک آدم حسابی. توی دÙتر، اولین چیزی Ú©Ù‡ به چشم می‌آمد. از آن‌هایی Ú©Ù‡ اگر توی Ú©ÙˆÚ†Ù‡ ببینی، خیال می‌کنی مدیر Ú©Ù„ است. Ù„Ùظ قلم حر٠می‌زد Ùˆ شاید به همین دلیل بود Ú©Ù‡ وقتی رئیس Ùرهنگ رÙت Ùˆ تشریÙات را با خودش برد، از طر٠همکارانش تبریک ورود Ú¯Ùت Ùˆ اشاره کرد به اینکه «ان‌شاءالله زیر سایه‌ی سرکار، سال دیگر کلاس‌های دبیرستان را هم خواهیم داشت.» پیدا بود Ú©Ù‡ این هیکل کم‌کم دارد از سر دبستان زیادی می‌کند! وقتی حر٠می‌زد همه‌اش درین Ùکر بودم Ú©Ù‡ با نان آقا معلمی Ú†Ù‡ طور می‌شد چنین هیکلی به هم زد Ùˆ چنین سر Ùˆ تیپی داشت؟ Ùˆ راستش تصمیم گرÙتم Ú©Ù‡ از Ùردا صبح به صبح ریشم را بتراشم Ùˆ یخه‌ام تمیز باشد Ùˆ اتوی شلوارم تیز. + +معلم کلاس اول باریکه‌ای بود، سیاه سوخته. با ته ریشی Ùˆ سر ماشین کرده‌ای Ùˆ یخه‌ی بسته. بی‌کراوات. شبیه میرزابنویس‌های دم پست‌خانه. حتی نوکر باب می‌نمود. Ùˆ من آن روز نتوانستم بÙهمم وقتی حر٠می‌زند کجا را نگاه می‌کند. با هر جیغ کوتاهی Ú©Ù‡ می‌زد هرهر می‌خندید. با این قضیه نمی‌شد کاری کرد. معلم کلاس سه، یک جوان ترکه‌ای بود؛ بلند Ùˆ با صورت استخوانی Ùˆ ریش از ته تراشیده Ùˆ یخه‌ی بلند آهاردار. مثل ÙرÙره می‌جنبید. چشم‌هایش برق عجیبی می‌زد Ú©Ù‡ Ùقط از هوش نبود، چیزی از ناسلامتی در برق چشم‌هایش بود Ú©Ù‡ مرا واداشت از ناظم بپرسم مبادا مسلول باشد. البته مسلول نبود، تنها بود Ùˆ در دانشگاه درس می‌خواند. کلاس‌های پنجم Ùˆ ششم را دو Ù†Ùر با هم اداره می‌کردند. یکی Ùارسی Ùˆ شرعیات Ùˆ تاریخ، جغراÙÛŒ Ùˆ کاردستی Ùˆ این جور سرگرمی‌ها را می‌گÙت، Ú©Ù‡ جوانکی بود بریانتین زده، با شلوار پاچه تنگ Ùˆ پوشت Ùˆ کراوات زرد Ùˆ پهنی Ú©Ù‡ نعش یک لنگر بزرگ آن را روی سینه‌اش Ù†Ú¯Ù‡ داشته بود Ùˆ دائماً دستش حمایل موهای سرش بود Ùˆ دم به دم توی شیشه‌ها نگاه می‌کرد. Ùˆ آن دیگری Ú©Ù‡ حساب Ùˆ مرابحه Ùˆ چیزهای دیگر می‌گÙت، جوانی بود موقر Ùˆ سنگین مازندرانی به نظر می‌آمد Ùˆ به خودش اطمینان داشت. غیر از این‌ها، یک معلم ورزش هم داشتیم Ú©Ù‡ دو Ù‡Ùته بعد دیدمش Ùˆ اصÙهانی بود Ùˆ از آن قاچاق‌ها. + +رئیس Ùرهنگ Ú©Ù‡ رÙت، گرم Ùˆ نرم از همه‌شان حال Ùˆ احوال پرسیدم. بعد به همه سیگار تعار٠کردم. سراپا همکاری Ùˆ همدردی بود. از کار Ùˆ بار هر کدامشان پرسیدم. Ùقط همان معلم کلاس سه، دانشگاه می‌رÙت. آن Ú©Ù‡ لنگر به سینه انداخته بود، شب‌ها انگلیسی می‌خواند Ú©Ù‡ برود آمریکا. چای Ùˆ بساطی در کار نبود Ùˆ ربع ساعت‌های تÙریح، Ùقط توی دÙتر جمع می‌شدند Ùˆ دوباره از نو. Ùˆ این نمی‌شد. باید همه‌ی سنن را رعایت کرد. دست کردم Ùˆ یک پنج تومانی روی میز گذاشتم Ùˆ قرار شد قبل Ùˆ منقلی تهیه کنند Ùˆ خودشان چای را راه بیندازند. + +بعد از زنگ قرار شد من سر ص٠نطقی بکنم. ناظم قضیه را در دو سه کلمه برای بچه‌ها Ú¯Ùت Ú©Ù‡ من رسیدم Ùˆ همه دست زدند. چیزی نداشتم برایشان بگویم. Ùقط یادم است اشاره‌ای به این کردم Ú©Ù‡ مدیر خیلی دلش می‌خواست یکی از شما را به جای Ùرزند داشته باشد Ùˆ حالا نمی‌داند با این همه Ùرزند Ú†Ù‡ بکند؟! Ú©Ù‡ بی‌صدا خندیدند Ùˆ در میان صÙ‌های عقب یکی Ù¾Ú©ÛŒ زد به خنده. واهمه برم داشت Ú©Ù‡ «نه بابا. کار ساده‌ای هم نیست!» قبلاً Ùکر کرده بودم Ú©Ù‡ می‌روم Ùˆ Ùارغ از دردسر اداره‌ی کلاس، در اتاق را روی خودم می‌بندم Ùˆ کار خودم را می‌کنم. اما حالا می‌دیدم به این سادگی‌ها هم نیست. اگر Ùردا یکی‌شان زد سر اون یکی را شکست، اگر یکی زیر ماشین رÙت؛ اگر یکی از ایوان اÙتاد؛ Ú†Ù‡ خاکی به سرم خواهم ریخت؟ + +حالا من مانده بودم Ùˆ ناظم Ú©Ù‡ چیزی از لای در آهسته خزید تو. کسی بود؛ Ùراش مدرسه با قیاÙه‌ای دهاتی Ùˆ ریش نتراشیده Ùˆ قدی کوتاه Ùˆ گشاد گشاد راه می‌رÙت Ùˆ دست‌هایش را دور از بدن Ù†Ú¯Ù‡ می‌داشت. آمد Ùˆ همان کنار در ایستاد. صا٠توی چشمم نگاه می‌کرد. حال او را هم پرسیدم. هر Ú†Ù‡ بود او هم می‌توانست یک گوشه‌ی این بار را بگیرد. در یک دقیقه همه‌ی درد دل‌هایش را کرد Ùˆ التماس دعاهایش Ú©Ù‡ تمام شد، Ùرستادمش برایم چای درست کند Ùˆ بیاورد. بعد از آن من به ناظم پرداختم. سال پیش، از دانشسرای مقدماتی در آمده بود. یک سال گرمسار Ùˆ کرج کار کرده بود Ùˆ امسال آمده بود این‌جا. پدرش دو تا زن داشته. از اولی دو تا پسر Ú©Ù‡ هر دو تا چاقوکش از آب در آمده‌اند Ùˆ از دومی Ùقط او مانده بود Ú©Ù‡ درس‌خوان شده Ùˆ سرشناس Ùˆ نان مادرش را می‌دهد Ú©Ù‡ مریض است Ùˆ از پدر سال‌هاست Ú©Ù‡ خبری نیست Ùˆ... یک اتاق گرÙته‌اند به پنجاه تومان Ùˆ صد Ùˆ پنجاه تومان حقوق به جایی نمی‌رسد Ùˆ تازه زور Ú©Ù‡ بزند سه سال دیگر می‌تواند از حق ÙÙ†ÛŒ نظامت مدرسه استÙاده کند + +... بعد بلند شدیم Ú©Ù‡ به کلاس‌ها سرکشی کنیم. بعد با ناظم به تک تک کلاس‌ها سر زدیم در این میان من به یاد دوران دبستان خودم اÙتادم. در کلاس ششم را باز کردیم «... ت بی پدرو مادر» جوانک بریانتین زده خورد توی صورت‌مان. یکی از بچه‌ها صورتش مثل چغندر قرمز بود. لابد بزک Ùحش هنوز باقی بود. قرائت Ùارسی داشتند. معلم دستهایش توی جیبش بود Ùˆ سینه‌اش را پیش داده بود Ùˆ زبان به شکایت باز کرد: + +- آقای مدیر! اصلاً دوستی سرشون نمی‌شه. تو سَری می‌خوان. ملاحظه کنید بنده با Ú†Ù‡ صمیمیتی... + +حرÙØ´ را در تشدید «ایت» بریدم Ú©Ù‡: + +- صحیح می‌Ùرمایید. این بار به من ببخشید. + +Ùˆ از در آمدیم بیرون. بعد از آن به اطاقی Ú©Ù‡ در آینده مال من بود سر زدیم. بهتر از این نمی‌شد. بی سر Ùˆ صدا، Ø¢Ùتاب‌رو، دور اÙتاده. + +وسط حیاط، یک حوض بزرگ بود Ùˆ کم‌عمق. تنها قسمت ساختمان بود Ú©Ù‡ رعایت حال بچه‌های قد Ùˆ نیم قد در آن شده بود. دور حیاط دیوار بلندی بود درست مثل دیوار چین. سد مرتÙعی در مقابل Ùرار احتمالی Ùرهنگ Ùˆ ته حیاط مستراح Ùˆ اتاق Ùراش بغلش Ùˆ انبار زغال Ùˆ بعد هم یک کلاس. به مستراح هم سر کشیدیم. همه بی در Ùˆ سق٠و تیغه‌ای میان آن‌ها. نگاهی به ناظم کردم Ú©Ù‡ پا به پایم می‌آمد. Ú¯Ùت: + +- دردسر عجیبی شده آقا. تا حالا صد تا کاغذ به ادارÙردا صبح رÙتم مدرسه. بچه‌ها با صÙ‌هاشان به طر٠کلاس‌ها می‌رÙتند Ùˆ ناظم چوب به دست توی ایوان ایستاده بود Ùˆ توی دÙتر دو تا از معلم‌ها بودند. معلوم شد کار هر روزه‌شان است. ناظم را هم Ùرستادم سر یک کلاس دیگر Ùˆ خودم آمدم دم در مدرسه به قدم زدن؛ Ùکر کردم از هر طر٠که بیایند مرا این ته، دم در مدرسه خواهند دید Ùˆ تمام طول راه در این خجالت خواهند ماند Ùˆ دیگر دیر نخواهند آمد. یک سیاهی از ته جاده‌ی جنوبی پیداشد. جوانک بریانتین زده بود. مسلماً او هم مرا می‌دید، ولی آهسته‌تر از آن می‌آمد Ú©Ù‡ یک معلم تأخیر کرده جلوی مدیرش می‌آمد. جلوتر Ú©Ù‡ آمد حتی شنیدم Ú©Ù‡ سوت می‌زد. اما بی‌انصا٠چنان سلانه سلانه می‌آمد Ú©Ù‡ دیدم هیچ جای گذشت نیست. اصلاً محل سگ به من نمی‌گذاشت. داشتم از کوره در می‌رÙتم Ú©Ù‡ یک مرتبه احساس کردم تغییری در رÙتار خود داد Ùˆ تند کرد. + +به خیر گذشت Ùˆ گرنه خدا عالم است Ú†Ù‡ اتÙاقی می‌اÙتاد. سلام Ú©Ù‡ کرد مثل این Ú©Ù‡ می‌خواست چیزی بگوید Ú©Ù‡ پیش دستی کردم: + +- بÙرمایید آقا. بÙرمایید، بچه‌ها منتظرند. + +واقعاً به خیر گذشت. شاید اتوبوسش دیر کرده. شاید راه‌بندان بوده؛ جاده قرق بوده Ùˆ باز یک گردن‌کلÙتی از اقصای عالم می‌آمده Ú©Ù‡ ازین سÙره‌ی مرتضی علی بی‌نصیب نماند. به هر صورت در دل بخشیدمش. Ú†Ù‡ خوب شد Ú©Ù‡ بد Ùˆ بی‌راهی Ù†Ú¯Ùتی! Ú©Ù‡ از دور علم اÙراشته‌ی هیکل معلم کلاس چهارم نمایان شد. از همان ته مرا دیده بود. تقریباً می‌دوید. تحمل این یکی را نداشتم. «بدکاری می‌کنی. اول بسم‌الله Ùˆ مته به خشخاش!» رÙتم Ùˆ توی دÙتر نشستم Ùˆ خودم را به کاری مشغول کردم Ú©Ù‡ هن هن کنان رسید. چنان عرق از پیشانی‌اش می‌ریخت Ú©Ù‡ راستی خجالت کشیدم. یک لیوان آب از کوه به دستش دادم Ùˆ مسخ‌شده‌ی خنده‌اش را با آب به خوردش دادم Ùˆ بلند Ú©Ù‡ شد برود، Ú¯Ùتم: + +- عوضش دو کیلو لاغر شدید. + +برگشت نگاهی کرد Ùˆ خنده‌ای Ùˆ رÙت. ناگهان ناظم از در وارد شد Ùˆ از را Ù‡ نرسیده Ú¯Ùت: + +- دیدید آقا! این جوری می‌آند مدرسه. اون قرتی Ú©Ù‡ عین خیالش هم نبود آقا! اما این یکی... + +از او پرسیدم: + +- انگار هنوز دو تا از کلاس‌ها ولند؟ + +- بله آقا. کلاس سه ورزش دارند. Ú¯Ùتم بنشینند دیکته بنویسند آقا. معلم حساب پنج Ùˆ شش هم Ú©Ù‡ نیومده آقا. + +در همین حین یکی از عکس‌های بزرگ دخمه‌های هخامنشی را Ú©Ù‡ به دیوار کوبیده بود پس زد Ùˆ: + +- نگاه کنید آقا... + +روی Ú¯Ú† دیوار با مداد قرمز Ùˆ نه چندان درشت، به عجله Ùˆ ناشیانه علامت داس کشیده بودند. همچنین دنبال کرد: + +- از آثار دوره‌ی اوناست آقا. کارشون همین چیزها بود. روزنومه بÙروشند. تبلیغات کنند Ùˆ داس Ú†Ú©Ø´ بکشند آقا. رئیس‌شون رو Ú©Ù‡ گرÙتند Ú†Ù‡ جونی کندم آقا تا حالی‌شون کنم Ú©Ù‡ دست ور دارند آقا. Ùˆ از روی میز پرید پایین. + +- Ú¯Ùتم Ù…Ú¯Ù‡ باز هم هستند؟ + +- آره آقا، پس Ú†ÛŒ! یکی همین آقازاده Ú©Ù‡ هنوز نیومده آقا. هر روز نیم ساعت تأخیر داره آقا. یکی هم مثل کلاس سه. + +- خوب چرا تا حالا پاکش نکردی؟ + +- به! آخه آدم درد دلشو واسه‌ی Ú©ÛŒ بگه؟ آخه آقا در میان تو روی آدم می‌گند جاسوس، مأمور! باهاش حرÙÙ… شده آقا. کتک Ùˆ کتک‌کاری! + +Ùˆ بعد یک سخنرانی Ú©Ù‡ Ú†Ù‡ طور مدرسه را خراب کرده‌اند Ùˆ اعتماد اهل محله را Ú†Ù‡ طور از بین برده‌اند Ú©Ù‡ نه انجمنی، نه Ú©Ù…Ú©ÛŒ به بی‌بضاعت‌ها؛ Ùˆ از این حر٠ها. + +بعد از سخنرانی آقای ناظم دستمالم را دادم Ú©Ù‡ آن عکس‌ها را پاک کند Ùˆ بعد هم راه اÙتادم Ú©Ù‡ بروم سراغ اتاق خودم. در اتاقم را Ú©Ù‡ باز کردم، داشتم دماغم با بوی خاک نم کشیده‌اش اخت می‌کرد Ú©Ù‡ آخرین معلم هم آمد. آمدم توی ایوان Ùˆ با صدای بلند، جوری Ú©Ù‡ در تمام مدرسه بشنوند، ناظم را صدا زدم Ùˆ Ú¯Ùتم با قلم قرمز برای آقا یک ساعت تأخیر بگذارند.ه‌ی ساختمان نوشتیم آقا. می‌گند نمی‌شه پول دولت رو تو ملک دیگرون خرج کرد. + +- Ú¯Ùتم راست می‌گند. + +دیگه کاÙÛŒ بود. آمدیم بیرون. همان توی حیاط تا Ù†Ùسی تازه کنیم وضع مالی Ùˆ بودجه Ùˆ ازین حرÙ‌های مدرسه را پرسیدم. هر اتاق ماهی پانزده ریال حق نظاÙت داشت. لوازم‌التحریر Ùˆ دÙترها را هم اداره‌ی Ùرهنگ می‌داد. ماهی بیست Ùˆ پنج تومان هم برای آب خوردن داشتند Ú©Ù‡ هنوز وصول نشده بود. برای نصب هر بخاری سالی سه تومان. ماهی سی تومان هم تنخواه‌گردان مدرسه بود Ú©Ù‡ مثل پول آب سوخت شده بود Ùˆ حالا هم ماه دوم سال بود. اواخر آبان. حالیش کردم Ú©Ù‡ حوصله‌ی این کارها را ندارم Ùˆ غرضم را از مدیر شدن برایش خلاصه کردم Ùˆ Ú¯Ùتم حاضرم همه‌ی اختیارات را به او بدهم. «اصلاً انگار Ú©Ù‡ هنوز مدیر نیامده.» مهر مدرسه هم پهلوی خودش باشد. البته او را هنوز نمی‌شناختم. شنیده بودم Ú©Ù‡ مدیرها قبلاً ناظم خودشان را انتخاب می‌کنند، اما من نه کسی را سراغ داشتم Ùˆ نه حوصله‌اش را. Ø­Ú©Ù… خودم را هم به زور گرÙته بودم. سنگ‌هامان را وا کندیم Ùˆ به دÙتر رÙتیم Ùˆ چایی را Ú©Ù‡ Ùراش از بساط خانه‌اش درست کرده بود، خوردیم تا زنگ را زدند Ùˆ باز هم زدند Ùˆ من نگاهی به پرونده‌های شاگردها کردم Ú©Ù‡ هر کدام عبارت بود از دو برگ کاغذ. از همین دو سه برگ کاغذ دانستم Ú©Ù‡ اولیای بچه‌ها اغلب زارع Ùˆ باغبان Ùˆ اویارند Ùˆ قبل از این‌که زنگ آخر را بزنند Ùˆ مدرسه تعطیل بشود بیرون آمدم. برای روز اول خیلی زیاد بود. + +Ùردا صبح رÙتم مدرسه. بچه‌ها با صÙ‌هاشان به طر٠کلاس‌ها می‌رÙتند Ùˆ ناظم چوب به دست توی ایوان ایستاده بود Ùˆ توی دÙتر دو تا از معلم‌ها بودند. معلوم شد کار هر روزه‌شان است. ناظم را هم Ùرستادم سر یک کلاس دیگر Ùˆ خودم آمدم دم در مدرسه به قدم زدن؛ Ùکر کردم از هر طر٠که بیایند مرا این ته، دم در مدرسه خواهند دید Ùˆ تمام طول راه در این خجالت خواهند ماند Ùˆ دیگر دیر نخواهند آمد. یک سیاهی از ته جاده‌ی جنوبی پیداشد. جوانک بریانتین زده بود. مسلماً او هم مرا می‌دید، ولی آهسته‌تر از آن می‌آمد Ú©Ù‡ یک معلم تأخیر کرده جلوی مدیرش می‌آمد. جلوتر Ú©Ù‡ آمد حتی شنیدم Ú©Ù‡ سوت می‌زد. اما بی‌انصا٠چنان سلانه سلانه می‌آمد Ú©Ù‡ دیدم هیچ جای گذشت نیست. اصلاً محل سگ به من نمی‌گذاشت. داشتم از کوره در می‌رÙتم Ú©Ù‡ یک مرتبه احساس کردم تغییری در رÙتار خود داد Ùˆ تند کرد. + +به خیر گذشت Ùˆ گرنه خدا عالم است Ú†Ù‡ اتÙاقی می‌اÙتاد. سلام Ú©Ù‡ کرد مثل این Ú©Ù‡ می‌خواست چیزی بگوید Ú©Ù‡ پیش دستی کردم: + +- بÙرمایید آقا. بÙرمایید، بچه‌ها منتظرند. + +واقعاً به خیر گذشت. شاید اتوبوسش دیر کرده. شاید راه‌بندان بوده؛ جاده قرق بوده Ùˆ باز یک گردن‌کلÙتی از اقصای عالم می‌آمده Ú©Ù‡ ازین سÙره‌ی مرتضی علی بی‌نصیب نماند. به هر صورت در دل بخشیدمش. Ú†Ù‡ خوب شد Ú©Ù‡ بد Ùˆ بی‌راهی Ù†Ú¯Ùتی! Ú©Ù‡ از دور علم اÙراشته‌ی هیکل معلم کلاس چهارم نمایان شد. از همان ته مرا دیده بود. تقریباً می‌دوید. تحمل این یکی را نداشتم. «بدکاری می‌کنی. اول بسم‌الله Ùˆ مته به خشخاش!» رÙتم Ùˆ توی دÙتر نشستم Ùˆ خودم را به کاری مشغول کردم Ú©Ù‡ هن هن کنان رسید. چنان عرق از پیشانی‌اش می‌ریخت Ú©Ù‡ راستی خجالت کشیدم. یک لیوان آب از کوه به دستش دادم Ùˆ مسخ‌شده‌ی خنده‌اش را با آب به خوردش دادم Ùˆ بلند Ú©Ù‡ شد برود، Ú¯Ùتم: + +- عوضش دو کیلو لاغر شدید. + +برگشت نگاهی کرد Ùˆ خنده‌ای Ùˆ رÙت. ناگهان ناظم از در وارد شد Ùˆ از را Ù‡ نرسیده Ú¯Ùت: + +- دیدید آقا! این جوری می‌آند مدرسه. اون قرتی Ú©Ù‡ عین خیالش هم نبود آقا! اما این یکی... + +از او پرسیدم: + +- انگار هنوز دو تا از کلاس‌ها ولند؟ + +- بله آقا. کلاس سه ورزش دارند. Ú¯Ùتم بنشینند دیکته بنویسند آقا. معلم حساب پنج Ùˆ شش هم Ú©Ù‡ نیومده آقا. + +در همین حین یکی از عکس‌های بزرگ دخمه‌های هخامنشی را Ú©Ù‡ به دیوار کوبیده بود پس زد Ùˆ: + +- نگاه کنید آقا... + +روی Ú¯Ú† دیوار با مداد قرمز Ùˆ نه چندان درشت، به عجله Ùˆ ناشیانه علامت داس کشیده بودند. همچنین دنبال کرد: + +- از آثار دوره‌ی اوناست آقا. کارشون همین چیزها بود. روزنومه بÙروشند. تبلیغات کنند Ùˆ داس Ú†Ú©Ø´ بکشند آقا. رئیس‌شون رو Ú©Ù‡ گرÙتند Ú†Ù‡ جونی کندم آقا تا حالی‌شون کنم Ú©Ù‡ دست ور دارند آقا. Ùˆ از روی میز پرید پایین. + +- Ú¯Ùتم Ù…Ú¯Ù‡ باز هم هستند؟ + +- آره آقا، پس Ú†ÛŒ! یکی همین آقازاده Ú©Ù‡ هنوز نیومده آقا. هر روز نیم ساعت تأخیر داره آقا. یکی هم مثل کلاس سه. + +- خوب چرا تا حالا پاکش نکردی؟ + +- به! آخه آدم درد دلشو واسه‌ی Ú©ÛŒ بگه؟ آخه آقا در میان تو روی آدم می‌گند جاسوس، مأمور! باهاش حرÙÙ… شده آقا. کتک Ùˆ کتک‌کاری! + +Ùˆ بعد یک سخنرانی Ú©Ù‡ Ú†Ù‡ طور مدرسه را خراب کرده‌اند Ùˆ اعتماد اهل محله را Ú†Ù‡ طور از بین برده‌اند Ú©Ù‡ نه انجمنی، نه Ú©Ù…Ú©ÛŒ به بی‌بضاعت‌ها؛ Ùˆ از این حر٠ها. + +بعد از سخنرانی آقای ناظم دستمالم را دادم Ú©Ù‡ آن عکس‌ها را پاک کند Ùˆ بعد هم راه اÙتادم Ú©Ù‡ بروم سراغ اتاق خودم. در اتاقم را Ú©Ù‡ باز کردم، داشتم دماغم با بوی خاک نم کشیده‌اش اخت می‌کرد Ú©Ù‡ آخرین معلم هم آمد. آمدم توی ایوان Ùˆ با صدای بلند، جوری Ú©Ù‡ در تمام مدرسه بشنوند، ناظم را صدا زدم Ùˆ Ú¯Ùتم با قلم قرمز برای آقا یک ساعت تأخیر بگذارند. + +روز سوم باز اول وقت مدرسه بودم. هنوز از پشت دیوار نپیچیده بودم Ú©Ù‡ صدای سوز Ùˆ بریز بچه‌ها به پیشبازم آمد. تند کردم. پنج تا از بچه‌ها توی ایوان به خودشان می‌پیچیدند Ùˆ ناظم ترکه‌ای به دست داشت Ùˆ به نوبت به ک٠دست‌شان می‌زد. بچه‌ها التماس می‌کردند؛ گریه می‌کردند؛ اما دستشان را هم دراز می‌کردند. نزدیک بود داد بزنم یا با لگد بزنم Ùˆ ناظم را پرت کنم آن طرÙ. پشتش به من بود Ùˆ من را نمی‌دید. ناگهان زمزمه‌ای توی صÙ‌ها اÙتاد Ú©Ù‡ یک مرتبه مرا به صراÙت انداخت Ú©Ù‡ در مقام مدیریت مدرسه، به سختی می‌شود ناظم را کتک زد. این بود Ú©Ù‡ خشمم را Ùرو خوردم Ùˆ آرام از پله‌ها رÙتم بالا. ناظم، تازه متوجه من شده بود در همین حین دخالتم را کردم Ùˆ خواهش کردم این بار همه‌شان را به من ببخشند. + +نمی‌دانم Ú†Ù‡ کار خطایی از آنها سر زده بود Ú©Ù‡ ناظم را تا این حد عصبانی کرده بود. بچه‌ها سکسکه‌کنان رÙتند توی صÙ‌ها Ùˆ بعد زنگ را زدند Ùˆ صÙ‌ها رÙتند به کلاس‌ها Ùˆ دنبالشان هم معلم‌ها Ú©Ù‡ همه سر وقت حاضر بودند. نگاهی به ناظم انداختم Ú©Ù‡ تازه حالش سر جا آمده بود Ùˆ Ú¯Ùتم در آن حالی Ú©Ù‡ داشت، ممکن بود گردن یک کدامشان را بشکند. Ú©Ù‡ مرتبه براق شد: + +- اگه یک روز جلوشونو نگیرید سوارتون می‌شند آقا. نمی‌دونید Ú†Ù‡ قاطرهای چموشی شده‌اند آقا. + +مثل بچه مدرسه‌ای‌ها آقا آقا می‌کرد. موضوع را برگرداندم Ùˆ احوال مادرش را پرسیدم. خنده، صورتش را از هم باز کرد Ùˆ صدا زد Ùراش برایش آب بیاورد. یادم هست آن روز نیم ساعتی برای آقای ناظم صحبت کردم. پیرانه. Ùˆ او جوان بود Ùˆ زود می‌شد رامش کرد. بعد ازش خواستم Ú©Ù‡ ترکه‌ها را بشکند Ùˆ آن وقت من رÙتم سراغ اتاق خودم. + +در همان Ù‡Ùته‌ی اول به کارها وارد شدم. Ùردای زمستان Ùˆ نه تا بخاری زغال سنگی Ùˆ روزی چهار بار آب آوردن Ùˆ آب Ùˆ جاروی اتاق‌ها با یک Ùراش جور در نمی‌آید. یک Ùراش دیگر از اداره ÛŒ Ùرهنگ خواستم Ú©Ù‡ هر روز منتظر ورودش بودیم. بعد از ظهرها را نمی‌رÙتم. روزهای اول با دست Ùˆ دل لرزان، ولی سه چهار روزه جرأت پیدا کردم. احساس می‌کردم Ú©Ù‡ مدرسه زیاد هم محض خاطر من نمی‌گردد. کلاس اول هم یکسره بود Ùˆ به خاطر بچه‌های جغله دلهره‌ای نداشتم. در بیابان‌های اطرا٠مدرسه هم ماشینی آمد Ùˆ رÙت نداشت Ùˆ گرچه پست Ùˆ بلند بود اما به هر صورت از حیاط مدرسه Ú©Ù‡ بزرگ‌تر بود. معلم ها هم، هر بعد از ظهری دو تاشان به نوبت می‌رÙتند یک جوری باهم کنار آمده بودند. Ùˆ ترسی هم از این نبود Ú©Ù‡ بچه‌ها از علم Ùˆ Ùرهنگ ثقل سرد بکنند. یک روز هم بازرس آمد Ùˆ نیم ساعتی پیزر لای پالان هم گذاشتیم Ùˆ چای Ùˆ احترامات متقابل! Ùˆ در دÙتر بازرسی تصدیق کرد Ú©Ù‡ مدرسه «با وجود عدم وسایل» بسیار خوب اداره می‌شود. + +بچه‌ها مدام در مدرسه زمین می‌خوردند، بازی می‌کردند، زمین می‌خوردند. مثل اینکه تاتوله خورده بودند. ساده‌ترین Ø´Ú©Ù„ بازی‌هایشان در ربع ساعت‌های تÙریح، دعوا بود. Ùکر می‌کردم علت این همه زمین خوردن شاید این باشد Ú©Ù‡ بیش‌ترشان Ú©ÙØ´ حسابی ندارند. آن‌ها هم Ú©Ù‡ داشتند، بچه‌ننه بودند Ùˆ بلد نبودند بدوند Ùˆ حتی راه بروند. این بود Ú©Ù‡ روزی دو سه بار، دست Ùˆ پایی خراش بر می‌داشت. پرونده‌ی برق Ùˆ تلÙÙ† مدرسه را از بایگانی بسیار محقر مدرسه بیرون کشیده بودم Ùˆ خوانده بودم. اگر یک خرده می‌دویدی تا دو سه سال دیگر هم برق مدرسه درست می‌شد Ùˆ هم تلÙنش. دوباره سری به اداره ساختمان زدم Ùˆ موضوع را تازه کردم Ùˆ به رÙقایی Ú©Ù‡ دورادور در اداره‌ی برق Ùˆ تلÙÙ† داشتم، یکی دو بار رو انداختم Ú©Ù‡ اول خیال می‌کردند کار خودم را می‌خواهم به اسم مدرسه راه بیندازم Ùˆ ناچار رها کردم. این قدر بود Ú©Ù‡ ادای وظیÙه‌ای می‌کرد. مدرسه آب نداشت. نه آب خوراکی Ùˆ نه آب جاری. با هرزاب بهاره، آب انبار زیر حوض را می‌انباشتند Ú©Ù‡ تلمبه‌ای سرش بود Ùˆ حوض را با همان پر می‌کردند Ùˆ خود بچه‌ها. اما برای آب خوردن دو تا منبع صد لیتری داشتیم از آهن سÙید Ú©Ù‡ مثل امامزاده‌ای یا سقاخانه‌ای دو قلو، روی چهار پایه کنار حیاط بود Ùˆ روزی دو بار پر Ùˆ خالی می‌شد. این آب را از همان باغی می‌آوردیم Ú©Ù‡ ردی٠کاج‌هایش روی آسمان، لکه‌ی دراز سیاه انداخته بود. البته Ùراش می‌آورد. با یک سطل بزرگ Ùˆ یک آب‌پاش Ú©Ù‡ سوراخ بود Ùˆ تا به مدرسه می‌رسید، نص٠شده بود. هر دو را از جیب خودم دادم تعمیر کردند. + +یک روز هم مالک مدرسه آمد. پیرمردی موقر Ùˆ سنگین Ú©Ù‡ خیال می‌کرد برای سرکشی به خانه‌ی مستأجرنشینش آمده. از در وارد نشده Ùریادش بلند شد Ùˆ Ùحش را کشید به Ùراش Ùˆ به Ùرهنگ Ú©Ù‡ چرا بچه‌ها دیوار مدرسه را با زغال سیاه کرده‌اند واز همین توپ Ùˆ تشرش شناختمش. Ú©Ù„ÛŒ با او صحبت کردیم البته او دو برابر سن من را داشت. برایش چای هم آوردیم Ùˆ با معلم‌ها آشنا شد Ùˆ قول‌ها داد Ùˆ رÙت. کنه‌ای بود. درست یک پیرمرد. یک ساعت Ùˆ نیم درست نشست. ماهی یک بار هم این برنامه را داشتند Ú©Ù‡ بایست پیه‌اش را به تن می‌مالیدم. + +اما معلم‌ها. هر کدام یک ابلاغ بیست Ùˆ چهار ساعته در دست داشتند، ولی در برنامه به هر کدام‌شان بیست ساعت درس بیشتر نرسیده بود. Ú©Ù… Ú©Ù… قرار شد Ú©Ù‡ یک معلم از Ùرهنگ بخواهیم Ùˆ به هر کدام‌شان هجده ساعت درس بدهیم، به شرط آن‌که هیچ بعد از ظهری مدرسه تعطیل نباشد. حتی آن Ú©Ù‡ دانشگاه می‌رÙت می‌توانست با Ù‡Ùته‌ای هجده ساعت درس بسازد. Ùˆ دشوارترین کار همین بود Ú©Ù‡ با کدخدامنشی حل شد Ùˆ من یک معلم دیگر از Ùرهنگ خواستم. + +اواخر Ù‡Ùته‌ی دوم، Ùراش جدید آمد. مرد پنجاه ساله‌ای باریک Ùˆ زبر Ùˆ زرنگ Ú©Ù‡ شب‌کلاه می‌گذاشت Ùˆ لباس آبی می‌پوشید Ùˆ تسبیح می‌گرداند Ùˆ از هر کاری سر رشته داشت. آب خوردن را نوبتی می‌آوردند. مدرسه تر Ùˆ تمیز شد Ùˆ رونقی گرÙت. Ùراش جدید سرش توی حساب بود. هر دو مستخدم با هم تمام بخاری‌ها را راه انداختند Ùˆ یک کارگر هم برای Ú©Ù…Ú© به آن‌ها آمد. Ùراش قدیمی را چهار روز پشت سر هم، سر ظهر می‌Ùرستادیم اداره‌ی Ùرهنگ Ùˆ هر آن منتظر زغال بودیم. هنوز یک Ù‡Ùته از آمدن Ùراش جدید نگذشته بود Ú©Ù‡ صدای همه‌ی معلم‌ها در آمده بود. نه به هیچ کدامشان سلام می‌کرد Ùˆ نه به دنبال خرده Ùرمایش‌هایشان می‌رÙت. درست است Ú©Ù‡ به من سلام می‌کرد، اما معلم‌ها هم، لابد هر کدام در حدود من صاحب Ùضایل Ùˆ عنوان Ùˆ معلومات بودند Ú©Ù‡ از یک Ùراش مدرسه توقع سلام داشته باشند. اما انگار نه انگار. + +بدتر از همه این Ú©Ù‡ سر خر معلم‌ها بود. من Ú©Ù‡ از همان اول، خرجم را سوا کرده بودم Ùˆ آن‌ها را آزاد گذاشته بودم Ú©Ù‡ در مواقع بیکاری در دÙتر را روی خودشان ببندند Ùˆ هر Ú†Ù‡ می‌خواهند بگویند Ùˆ هر کاری می‌خواهند بکنند. اما او در Ùاصله‌ی ساعات درس، همچه Ú©Ù‡ معلم‌ها می‌آمدند، می‌آمد توی دÙتر Ùˆ همین طوری گوشه‌ی اتاق می‌ایستاد Ùˆ معلم‌ها کلاÙÙ‡ می‌شدند. نه می‌توانستند شلکلک‌های معلمی‌شان را در حضور او کنار بگذارند Ùˆ نه جرأت می‌کردند به او چیزی بگویند. بدزبان بود Ùˆ از عهده‌ی همه‌شان بر می‌آمد. یکی دوبار دنبال نخود سیاه Ùرستاده بودندش. اما زرنگ بود Ùˆ Ùوری کار را انجام می‌داد Ùˆ بر می‌گشت. حسابی موی دماغ شده بود. ده سال تجربه این حداقل را به من آموخته بود Ú©Ù‡ اگر معلم‌ها در ربع ساعت‌های تÙریح نتوانند بخندند، سر کلاس، بچه‌های مردم را کتک خواهند زد. این بود Ú©Ù‡ دخالت کردم. یک روز Ùراش جدید را صدا زدم. اول حال Ùˆ احوالپرسی Ùˆ بعد چند سال سابقه دارد Ùˆ چند تا بچه Ùˆ Ú†Ù‡ قدر می‌گیرد... Ú©Ù‡ قضیه حل شد. سی صد Ùˆ خرده‌ای حقوق می‌گرÙت. با بیست Ùˆ پنج سال سابقه. کار از همین جا خراب بود. پیدا بود Ú©Ù‡ معلم‌ها حق دارند او را غریبه بدانند. نه دیپلمی، نه کاغذپاره‌ای، هر Ú†Ù‡ باشد یک Ùراش Ú©Ù‡ بیشتر نبود! Ùˆ تازه قلدر هم بود Ùˆ حق هم داشت. اول به اشاره Ùˆ کنایه Ùˆ بعد با صراحت بهش Ùهماندم Ú©Ù‡ گر Ú†Ù‡ معلم جماعت اجر دنیایی ندارد، اما از او Ú©Ù‡ آدم متدین Ùˆ Ùهمیده‌ای است بعید است Ùˆ از این حرÙ‌ها... Ú©Ù‡ یک مرتبه پرید توی حرÙÙ… Ú©Ù‡: + +- ای آقا! Ú†Ù‡ می‌Ùرمایید؟ شما نه خودتون این کاره‌اید Ùˆ نه اینارو می‌شناسید. امروز می‌خواند سیگار براشون بخرم، Ùردا می‌Ùرستنم سراغ عرق. من این‌ها رو می‌شناسم. + +راست می‌گÙت. زودتر از همه، او دندان‌های مرا شمرده بود. Ùهمیده بود Ú©Ù‡ در مدرسه هیچ‌کاره‌ام. می‌خواستم کوتاه بیایم، ولی مدیر مدرسه بودن Ùˆ در مقابل یک Ùراش پررو ساکت ماندن!... Ú©Ù‡ خر خر کامیون زغال به دادم رسید. ترمز Ú©Ù‡ کرد Ùˆ صدا خوابید Ú¯Ùتم: + +- این حرÙ‌ها قباحت داره. معلم جماعت کجا پولش به عرق می‌رسه؟ حالا بدو زغال آورده‌اند. + +Ùˆ همین طور Ú©Ù‡ داشت بیرون می‌رÙت، اÙزودم: + +- دو روز دیگه Ú©Ù‡ محتاجت شدند Ùˆ ازت قرض خواستند با هم رÙیق می‌شید. + +Ùˆ آمدم توی ایوان. در بزرگ آهنی مدرسه را باز کرده بودند Ùˆ کامیون آمده بود تو Ùˆ داشتند بارش را جلوی انبار ته حیاط خالی می‌کردند Ùˆ راننده، کاغذی به دست ناظم داد Ú©Ù‡ نگاهی به آن انداخت Ùˆ مرا نشان داد Ú©Ù‡ در ایوان بالا ایستاده بودم Ùˆ Ùرستادش بالا. کاغذش را با سلام به دستم داد. بیجک زغال بود. رسید رسمی اداره‌ی Ùرهنگ بود در سه نسخه Ùˆ روی آن ورقه‌ی ماشین شده‌ی «باسکول» Ú©Ù‡ می‌گÙت کامیون Ùˆ محتویاتش جمعاً دوازده خروار است. اما رسیدهای رسمی اداری Ùرهنگ ساکت بودند. جای مقدار زغالی Ú©Ù‡ تحویل مدرسه داده شده بود، در هر سه نسخه خالی بود. پیدا بود Ú©Ù‡ تحویل گیرنده باید پرشان کند. همین کار را کردم. اوراق را بردم توی اتاق Ùˆ با خودنویسم عدد را روی هر سه ورق نوشتم Ùˆ امضا کردم Ùˆ به دست راننده دادم Ú©Ù‡ راه اÙتاد Ùˆ از همان بالا به ناظم Ú¯Ùتم: + +- اگر مهر هم بایست زد، خودت بزن بابا. + +Ùˆ رÙتم سراغ کارم Ú©Ù‡ ناگهان در باز شد Ùˆ ناظم آمد تو؛ بیجک زغال دستش بود Ùˆ: + +- Ù…Ú¯Ù‡ Ù†Ùهمیدین آقا؟ مخصوصاً جاش رو خالی گذاشته بودند آقا... + +Ù†Ùهمیده بودم. اما اگر هم Ùهمیده بودم، Ùرقی نمی‌کرد Ùˆ به هر صورت از چنین کودنی نا به هنگام از جا در رÙتم Ùˆ به شدت Ú¯Ùتم: + +- خوب؟ + +- هیچ Ú†ÛŒ آقا.... رسم‌شون همینه آقا. اگه باهاشون کنار نیایید کارمونو لنگ می‌گذارند آقا... + +Ú©Ù‡ از جا در رÙتم. به چنین صراحتی مرا Ú©Ù‡ مدیر مدرسه بودم در معامله شرکت می‌داد. Ùˆ Ùریاد زدم: + +- عجب! حالا سرکار برای من تکلی٠هم معین می‌کنید؟... خاک بر سر این Ùرهنگ با مدیرش Ú©Ù‡ من باشم! برو ورقه رو بده دست‌شون، گورشون رو Ú¯Ù… کنند. پدر سوخته‌ها... + +چنان Ùریاد زده بودم Ú©Ù‡ هیچ کس در مدرسه انتظار نداشت. مدیر سر به زیر Ùˆ پا به راهی بودم Ú©Ù‡ از همه خواهش می‌کردم Ùˆ حالا ناظم مدرسه، داشت به من یاد می‌داد Ú©Ù‡ به جای نه خروار زغال مثلا هجده خروار تحویل بگیرم Ùˆ بعد با اداره‌ی Ùرهنگ کنار بیایم. Ù‡ÛŒ Ù‡ÛŒ!.... تا ظهر هیچ کاری نتوانستم بکنم، جز این‌که چند بار متن استعÙانامه‌ام را بنویسم Ùˆ پاره کنم... قدم اول را این جور جلوی پای آدم می‌گذارند. + +بارندگی Ú©Ù‡ شروع شد دستور دادم بخاری‌ها را از Ù‡Ùت صبح بسوزانند. بچه‌ها همیشه زود می‌آمدند. حتی روزهای بارانی. مثل این‌که اول Ø¢Ùتاب از خانه بیرون‌شان می‌کنند. یا ناهارنخورده. خیلی سعی کردم یک روز زودتر از بچه‌ها مدرسه باشم. اما عاقبت نشد Ú©Ù‡ مدرسه را خالی از Ù†Ùس٠به علم‌آلوده‌ی بچه‌ها استنشاق کنم. از راه Ú©Ù‡ می‌رسیدند دور بخاری جمع می‌شدند Ùˆ گیوه‌هاشان را خشک می‌کردند. Ùˆ خیلی زود Ùهمیدم Ú©Ù‡ ظهر در مدرسه ماندن هم مسأله Ú©ÙØ´ بود. هر Ú©Ù‡ داشت نمی‌ماند.این قاعده در مورد معلم‌ها هم صدق می‌کرد اقلاً یک پول واکس جلو بودند. وقتی Ú©Ù‡ باران می‌بارید تمام کوهپایه Ùˆ بدتر از آن تمام حیاط مدرسه Ú¯Ù„ می‌شد. بازی Ùˆ دویدن متوق٠شده بود. مدرسه سوت Ùˆ کور بود. این جا هم مسأله Ú©ÙØ´ بود. چشم اغلبشان هم قرمز بود. پیدا بود باز آن روز صبح یک Ùصل گریه کرده‌اند Ùˆ در خانه‌شان علم صراطی بوده است. + +مدرسه داشت تخته می‌شد. عده‌ی غایب‌های صبح ده برابر شده بود Ùˆ ساعت اول هیچ معلمی نمی‌توانست درس بدهد. دست‌های ورم‌کرده Ùˆ سرمازده کار نمی‌کرد. حتی معلم کلاس اولمان هم می‌دانست Ú©Ù‡ Ùرهنگ Ùˆ معلومات مدارس ما صرÙاً تابع تمرین است. مشق Ùˆ تمرین. ده بار بیست بار. دست یخ‌کرده بیل Ùˆ رنده را هم نمی‌تواند به کار بگیرد Ú©Ù‡ خیلی هم زمخت‌اند Ùˆ دست پر Ú©Ù†. این بود Ú©Ù‡ به Ùکر اÙتادیم. Ùراش جدید واردتر از همه‌ی ما بود. یک روز در اتاق دÙتر، شورامانندی داشتیم Ú©Ù‡ البته او هم بود. خودش را کم‌کم تحمیل کرده بود. Ú¯Ùت حاضر است یکی از دÙم‌کلÙت‌های همسایه‌ی مدرسه را وادارد Ú©Ù‡ شن برایمان بÙرستد به شرط آن Ú©Ù‡ ما هم برویم Ùˆ از انجمن محلی برای بچه‌ها Ú©ÙØ´ Ùˆ لباس بخواهیم. قرار شد خودش قضیه را دنبال کند Ú©Ù‡ Ù‡Ùته‌ی آینده جلسه‌شان کجاست Ùˆ حتی بخواهد Ú©Ù‡ دعوت‌مانندی از ما بکنند. دو روز بعد سه تا کامیون شن آمد. دوتایش را توی حیاط مدرسه، خالی کردیم Ùˆ سومی را دم در مدرسه، Ùˆ خود بچه‌ها نیم ساعته پهنش کردند. با پا Ùˆ بیل Ùˆ هر Ú†Ù‡ Ú©Ù‡ به دست می‌رسید. + +عصر همان روز ما را به انجمن دعوت کردند. خود من Ùˆ ناظم باید می‌رÙتیم. معلم کلاس چهارم را هم با خودمان بردیم. خانه‌ای Ú©Ù‡ محل جلسه‌ی آن شب انجمن بود، درست مثل مدرسه، دور اÙتاده Ùˆ تنها بود. قالی‌ها Ùˆ کناره‌ها را به Ùرهنگ می‌آلودیم Ùˆ می‌رÙتیم. مثل این‌که سه تا سه تا روی هم انداخته بودند. اولی Ú©Ù‡ کثی٠شد دومی. به بالا Ú©Ù‡ رسیدیم یک حاجی آقا در حال نماز خواندن بود. Ùˆ صاحب‌خانه با لهجه‌ی غلیظ یزدی به استقبال‌مان آمد. همراهانم را معرÙÛŒ کردم Ùˆ لابد خودش Ùهمید مدیر کیست. برای ما چای آوردند. سیگارم را چاق کردم Ùˆ با صاحب‌خانه از قالی‌هایش حر٠زدیم. ناظم به بچه‌هایی می‌ماند Ú©Ù‡ در مجلس بزرگترها خوابشان می‌گیرد Ùˆ دل‌شان هم نمی‌خواست دست به سر شوند. سر اعضای انجمن باز شده بود. حاجی آقا صندوقدار بود. من Ùˆ ناظم عین دو Ø·Ùلان مسلم بودیم Ùˆ معلم کلاس چهارم عین خولی وسطمان نشسته. اغلب اعضای انجمن به زبان محلی صحبت می‌کردند Ùˆ رÙتار ناشی داشتند. حتی یک کدامشان نمی‌دانستند Ú©Ù‡ دست Ùˆ پاهای خود را Ú†Ù‡ جور ضبط Ùˆ ربط کنند. بلند بلند حر٠می‌زدند. درست مثل این‌که وزارتخانه‌ی دواب سه تا حیوان تازه برای باغ وحش محله‌شان وارد کرده. جلسه Ú©Ù‡ رسمی شد، صاحبخانه معرÙی‌مان کرد Ùˆ شروع کردند. مدام از خودشان صحبت می‌کردند از این‌که دزد دیشب Ùلان جا را گرÙته Ùˆ باید درخواست پاسبان شبانه کنیم Ùˆ... + +همین طور یک ساعت حر٠زدند Ùˆ به مهام امور رسیدگی کردند Ùˆ من Ùˆ معلم کلاس چهارم سیگار کشیدیم. انگار نه انگار Ú©Ù‡ ما هم بودیم. نوکرشان Ú©Ù‡ آمد استکان‌ها را جمع کند، چیزی روی جلد اشنو نوشتم Ùˆ برای صاحبخانه Ùرستادم Ú©Ù‡ یک مرتبه به صراÙت ما اÙتاد Ùˆ اجازه خواست Ùˆ: + +- آقایان عرضی دارند. بهتر است کارهای خودمان را بگذاریم برای بعد. + +مثلاً می‌خواست بÙهماند Ú©Ù‡ نباید همه‌ی حرÙ‌ها را در حضور ما زده باشند. Ùˆ اجازه دادند معلم کلاس چهار شروع کرد به نطق Ùˆ او هم شروع کرد Ú©Ù‡ هر Ú†Ù‡ باشد ما زیر سایه‌ی آقایانیم Ùˆ خوش‌آیند نیست Ú©Ù‡ بچه‌هایی باشند Ú©Ù‡ نه لباس داشته باشند Ùˆ نه Ú©ÙØ´ درست Ùˆ حسابی Ùˆ از این حرÙ‌ها Ùˆ مدام حر٠می‌زد. ناظم هم از Ú†Ùرت در آمد چیزهایی را Ú©Ù‡ از Ø­Ùظ کرده بود Ú¯Ùت Ùˆ التماس دعا Ùˆ کار را خراب کرد.تشری به ناظم زدم Ú©Ù‡ گدابازی را بگذارد کنار Ùˆ حالی‌شان کردم Ú©Ù‡ صحبت از تقاضا نیست Ùˆ گدایی. بلکه مدرسه دور اÙتاده است Ùˆ مستراح بی در Ùˆ پیکر Ùˆ از این اباطیل... Ú†Ù‡ خوب شد Ú©Ù‡ عصبانی نشدم. Ùˆ قرار شد Ú©Ù‡ پنج Ù†Ùرشان Ùردا عصر بیایند Ú©Ù‡ مدرسه را وارسی کنند Ùˆ تشکر Ùˆ اظهار خوشحالی Ùˆ در آمدیم. + +در تاریکی بیابان Ù‡Ùت تا سواری پشت در خانه ردی٠بودند Ùˆ راننده‌ها توی یکی از آن‌ها جمع شده بودند Ùˆ اسرار ارباب‌هاشان را به هم می‌گÙتند. در این حین من مدام به خودم می‌گÙتم من چرا رÙتم؟ به من چه؟ مگر من در بی Ú©ÙØ´ Ùˆ کلاهی‌شان مقصر بودم؟ می‌بینی احمق؟ مدیر مدرسه هم Ú©Ù‡ باشی باید شخصیت Ùˆ غرورت را لای زرورق بپیچی Ùˆ طاق کلاهت بگذاری Ú©Ù‡ اقلاً نپوسد. حتی اگر بخواهی یک معلم Ú©ÙˆÙتی باشی، نه چرا دور می‌زنی؟ حتی اگر یک Ùراش ماهی نود تومانی باشی، باید تا خرخره توی لجن Ùرو بروی.در همین حین Ú©Ù‡ من در Ùکر بودم ناظم Ú¯Ùت: + +- دیدید آقا Ú†Ù‡ طور باهامون رÙتار کردند؟ با یکی از قالی‌هاشون آقا تمام مدرسه رو می‌خرید. + +Ú¯Ùتم: + +- تا سر Ùˆ کارت با الÙ.ب است به‌پا قیاس Ù†Ú©Ù†ÛŒ. خودخوری می‌آره. + +Ùˆ معلم کلاس چهار Ú¯Ùت: + +- اگه Ùحشمون هم می‌دادند من باز هم راضی بودم، باید واقع‌بین بود. خدا کنه پشیمون نشند. + +بعد هم مدتی درد دل کردیم Ùˆ تا اتوبوس برسد Ùˆ سوار بشیم، معلوم شد Ú©Ù‡ معلم کلاس چهار با زنش متارکه کرده Ùˆ مادر ناظم را سرطانی تشخیص دادند. Ùˆ بعد هم شب بخیر... + +دو روز تمام مدرسه نرÙتم. خجالت می‌کشیدم توی صورت یک کدام‌شان نگاه کنم. Ùˆ در همین دو روز حاجی آقا با دو Ù†Ùر آمده بودند، مدرسه را وارسی Ùˆ صورت‌برداری Ùˆ ناظم می‌گÙت Ú©Ù‡ حتی بچه‌هایی هم Ú©Ù‡ Ú©ÙØ´ Ùˆ کلاهی داشتند پاره Ùˆ پوره آمده بودند. Ùˆ برای بچه‌ها Ú©ÙØ´ Ùˆ لباس خریدند. روزهای بعد احساس کردم زن‌هایی Ú©Ù‡ سر راهم لب جوی آب ظر٠می‌شستند، سلام می‌کنند Ùˆ یک بار هم دعای خیر یکی‌شان را از عقب سر شنیدم.اما چنان از خودم بدم آمده بود Ú©Ù‡ رغبتم نمی‌شد به Ú©ÙØ´ Ùˆ لباس‌هاشان نگاه کنم. قربان همان گیوه‌های پاره! بله، نان گدایی Ùرهنگ را نو نوار کرده بود. + +تازه از دردسرهای اول کار مدرسه Ùارغ شده بودم Ú©Ù‡ شنیدم Ú©Ù‡ یک روز صبح، یکی از اولیای اطÙال آمد. بعد از سلام Ùˆ احوالپرسی دست کرد توی جیبش Ùˆ شش تا عکس در آورد، گذاشت روی میزم. شش تا عکس زن لخت. لخت لخت Ùˆ هر کدام به یک حالت. یعنی چه؟ نگاه تندی به او کردم. آدم مرتبی بود. اداری مانند. کسر شأن خودم می‌دانستم Ú©Ù‡ این گوشه‌ی از زندگی را طبق دستور عکاس‌باشی Ùلان جنده‌خانه‌ی بندری ببینم. اما حالا یک مرد اتو کشیده‌ی مرتب آمده بود Ùˆ شش تا از همین عکس‌ها را روی میزم پهن کرده بود Ùˆ به انتظار آن Ú©Ù‡ وقاحت عکس‌ها چشم‌هایم را پر کند داشت سیگار چاق می‌کرد. + +حسابی غاÙلگیر شده بودم... حتماً تا هر شش تای عکس‌ها را ببینم، بیش از یک دقیقه طول کشید. همه از یک Ù†Ùر بود. به این Ùکر گریختم Ú©Ù‡ الان هزار ها یا میلیون ها نسخه‌ی آن، توی جیب Ú†Ù‡ جور آدم‌هایی است Ùˆ در کجاها Ùˆ Ú†Ù‡ قدر خوب بود Ú©Ù‡ همه‌ی این آدم‌ها را می‌شناختم یا می‌دیدم. بیش ازین نمی‌شد گریخت. یارو به تمام وزنه وقاحتش، جلوی رویم نشسته بود. سیگاری آتش زدم Ùˆ چشم به او دوختم. کلاÙÙ‡ بود Ùˆ پیدا بود برای کتک‌کاری هم آماده باشد. سرخ شده بود Ùˆ داشت در دود سیگارش تکیه‌گاهی برای جسارتی Ú©Ù‡ می‌خواست به خرج بدهد می‌جست. عکس‌ها را با یک ورقه از اباطیلی Ú©Ù‡ همان روز سیاه کرده بودم، پوشاندم Ùˆ بعد با لحنی Ú©Ù‡ دعوا را با آن شروع می‌کنند؛ پرسیدم: + +- خوب، غرض؟ + +Ùˆ صدایم توی اتاق پیچید. حرکتی از روی بیچارگی به خودش داد Ùˆ همه‌ی جسارت‌ها را با دستش توی جیبش کرد Ùˆ آرام‌تر از آن چیزی Ú©Ù‡ با خودش تو آورده بود، Ú¯Ùت: + +- Ú†Ù‡ عرض کنم؟... از معلم کلاس پنج تون بپرسید. + +Ú©Ù‡ راحت شدم Ùˆ او شروع کرد به این Ú©Ù‡ «این Ú†Ù‡ Ùرهنگی است؟ خراب بشود. پس بچه‌های مردم با Ú†Ù‡ اطمینانی به مدرسه بیایند؟ + +Ùˆ از این حرÙ‌ها... + +خلاصه این آقا معلم کاردستی کلاس پنجم، این عکس‌ها را داده به پسر آقا تا آن‌ها را روی تخته سه لایی بچسباند Ùˆ دورش را سمباده بکشد Ùˆ بیاورد. به هر صورت معلم کلاس پنج بی‌گدار به آب زده. Ùˆ حالا من Ú†Ù‡ بکنم؟ به او Ú†Ù‡ جوابی بدهم؟ بگویم معلم را اخراج می‌کنم؟ Ú©Ù‡ نه می‌توانم Ùˆ نه لزومی دارد. او Ú†Ù‡ بکند؟ حتماً در این شهر کسی را ندارد Ú©Ù‡ به این عکس‌ها دلخوش کرده. ولی آخر چرا این جور؟ یعنی این قدر احمق است Ú©Ù‡ حتی شاگردهایش را نمی‌شناسد؟... پاشدم ناظم را صدا بزنم Ú©Ù‡ خودش آمده بود بالا، توی ایوان منتظر ایستاده بود. من آخرین کسی بودم Ú©Ù‡ از هر اتÙاقی در مدرسه خبردار می‌شدم. حضور این ولی Ø·ÙÙ„ گیجم کرده بود Ú©Ù‡ چنین عکس‌هایی را از توی جیب پسرش، Ùˆ لابد به همین وقاحتی Ú©Ù‡ آن‌ها را روی میز من ریخت، در آورده بوده. وقتی Ùهمید هر دو در مانده‌ایم سوار بر اسب شد Ú©Ù‡ اله می‌کنم Ùˆ بله می‌کنم، در مدرسه را می‌بندم، Ùˆ از این جÙنگیات.... + +حتماً نمی‌دانست Ú©Ù‡ اگر در هر مدرسه بسته بشود، در یک اداره بسته شده است. اما من تا او بود نمی‌توانستم Ùکرم را جمع کنم. می‌خواست پسرش را بخواهیم تا شهادت بدهد Ùˆ Ú†Ù‡ جانی کندیم تا حالیش کنیم Ú©Ù‡ پسرش هر Ú†Ù‡ Ø®Ùت کشیده، بس است Ùˆ وعده‌ها دادیم Ú©Ù‡ معلمش را دم خورشید کباب کنیم Ùˆ از نان خوردن بیندازیم. یعنی اول ناظم شروع کرد Ú©Ù‡ از دست او دل پری داشت Ùˆ من هم دنبالش را گرÙتم. برای دک کردن او چاره‌ای جز این نبود. Ùˆ بعد رÙت، ما دو Ù†Ùری ماندیم با شش تا عکس زن لخت. حواسم Ú©Ù‡ جمع شد به ناظم سپردم صدایش را در نیاورد Ùˆ یک Ù‡Ùته‌ی تمام مطلب را با عکس‌ها، توی کشوی میزم Ù‚ÙÙ„ کردم Ùˆ بعد پسرک را صدا زدم. نه عزیزدÙردانه می‌نمود Ùˆ نه هیچ جور دیگر. داد می‌زد Ú©Ù‡ از خانواده‌ی عیال‌واری است. کم‌خونی Ùˆ Ùقر. دیدم معلمش زیاد هم بد تشخیص نداده. یعنی زیاد بی‌گدار به آب نزده. Ú¯Ùتم: + +- خواهر برادر هم داری؟ + +- Ø¢... Ø¢...آقا داریم آقا. + +- چند تا؟ + +- Ø¢... آقا چهار تا آقا. + +- عکس‌ها رو خودت به بابات نشون دادی؟ + +- نه به خدا آقا... به خدا قسم... + +- پس Ú†Ù‡ طور شد؟ + +Ùˆ دیدم از ترس دارد قالب تهی می‌کند. گرچه چوب‌های ناظم شکسته بود، اما ترس او از من Ú©Ù‡ مدیر باشم Ùˆ از ناظم Ùˆ از مدرسه Ùˆ از تنبیه سالم مانده بود. + +- نترس بابا. کاریت نداریم. تقصیر آقا معلمه Ú©Ù‡ عکس‌ها رو داده... تو کار بدی نکردی بابا جان. Ùهمیدی؟ اما می‌خواهم ببینم Ú†Ù‡ طور شد Ú©Ù‡ عکس‌ها دست بابات اÙتاد. + +- Ø¢.. Ø¢... آخه آقا... آخه... + +می‌دانستم Ú©Ù‡ باید Ú©Ù…Ú©Ø´ کنم تا به حر٠بیاید. + +Ú¯Ùتم: + +- می‌دونی بابا؟ عکس‌هام چیز بدی نبود. تو خودت Ùهمیدی Ú†ÛŒ بود؟ + +- آخه آقا...نه آقا.... خواهرم آقا... خواهرم می‌گÙت... + +- خواهرت؟ از تو کوچک‌تره؟ + +- نه آقا. بزرگ‌تره. می‌گÙتش Ú©Ù‡ آقا... می‌گÙتش Ú©Ù‡ آقا... هیچ Ú†ÛŒ سر عکس‌ها دعوامون شد. + +دیگر تمام بود. عکس‌ها را به خواهرش نشان داده بود Ú©Ù‡ لای دÙترچه پر بوده از عکس آرتیست‌ها. به او پز داده بوده. اما حاضر نبوده، حتی یکی از آن‌ها را به خواهرش بدهد. آدم مورد اعتماد معلم باشد Ùˆ چنین خبطی بکند؟ Ùˆ تازه جواب معلم را Ú†Ù‡ بدهد؟ ناچار خواهر او را لو داده بوده. بعد از او معلم را احضار کردم. علت احضار را می‌دانست. Ùˆ داد می‌زد Ú©Ù‡ چیزی ندارد بگوید. پس از یک Ù‡Ùته مهلت، هنوز از وقاحتی Ú©Ù‡ من پیدا کرده بودم، تا از آدم خلع سلاح‌شده‌ای مثل او، دست بر ندارم، در تعجب بود. به او سیگار تعار٠کردم Ùˆ این قصه را برایش تعری٠کردم Ú©Ù‡ در اوایل تأسیس وزارت معارÙØŒ یک روز به وزیر خبر می‌دهند Ú©Ù‡ Ùلان معلم با Ùلان بچه روابطی دارد. وزیر Ùوراً او را می‌خواهد Ùˆ حال Ùˆ احوال او را می‌پرسد Ùˆ این‌که چرا تا به حال زن نگرÙته Ùˆ ناچار تقصیر گردن بی‌پولی می‌اÙتد Ùˆ دستور Ú©Ù‡ Ùلان قدر به او Ú©Ù…Ú© کنند تا عروسی راه بیندازد Ùˆ خود او هم دعوت بشود Ùˆ قضیه به همین سادگی تمام می‌شود. Ùˆ بعد Ú¯Ùتم Ú©Ù‡ خیلی جوان‌ها هستند Ú©Ù‡ نمی‌توانند زن بگیرند Ùˆ وزرای Ùرهنگ هم این روزها گرÙتار مصاحبه‌های روزنامه‌ای Ùˆ رادیویی هستند. اما در نجیب‌خانه‌ها Ú©Ù‡ باز است Ùˆ ازین مزخرÙات... Ùˆ هم‌دردی Ùˆ نگذاشتم یک کلمه حر٠بزند. بعد هم عکس را Ú©Ù‡ توی پاکت گذاشته بودم، به دستش دادم Ùˆ وقاحت را با این جمله به حد اعلا رساندم Ú©Ù‡: + +- اگر به تخته نچسبونید، ضررشون کم‌تره. + +تا حقوقم به لیست اداره‌ی Ùرهنگ برسه، سه ماه طول کشید. Ùرهنگی‌های گداگشنه Ùˆ خزانه‌ی خالی Ùˆ دست‌های از پا درازتر! اما خوبیش این بود Ú©Ù‡ در مدرسه‌ی ما Ùراش جدیدمان پولدار بود Ùˆ به همه‌شان قرض داد. Ú©Ù… Ú©Ù… بانک مدرسه شده بود. از سیصد Ùˆ خرده‌ای تومان Ú©Ù‡ می‌گرÙت، پنجاه تومان را هم خرج نمی‌کرد. نه سیگار می‌کشید Ùˆ نه اهل سینما بود Ùˆ نه برج دیگری داشت. از این گذشته، باغبان یکی از دم‌کلÙت‌های همان اطرا٠بود Ùˆ باغی Ùˆ دستگاهی Ùˆ سور Ùˆ ساتی Ùˆ لابد آشپزخانه‌ی مرتبی. خیلی زود معلم‌ها Ùهمیدند Ú©Ù‡ یک Ùراش پولدار خیلی بیش‌تر به درد می‌خورد تا یک مدیر بی‌بو Ùˆ خاصیت. + +این از معلم‌ها. حقوق مرا هم هنوز از مرکز می‌دادند. با حقوق ماه بعد هم اسم مرا هم به لیست اداره منتقل کردند. درین مدت خودم برای خودم ورقه انجام کار می‌نوشتم Ùˆ امضا می‌کردم Ùˆ می‌رÙتم از مدرسه‌ای Ú©Ù‡ قبلاً در آن درس می‌دادم، حقوقم را می‌گرÙتم. سر Ùˆ صدای حقوق Ú©Ù‡ بلند می‌شد معلم‌ها مرتب می‌شدند Ùˆ کلاس ماهی سه چهار روز کاملاً دایر بود. تا ورقه‌ی انجام کار به دستشان بدهم. غیر از همان یک بار - در اوایل کار- Ú©Ù‡ برای معلم حساب پنج Ùˆ شش قرمز توی دÙتر گذاشتیم، دیگر با مداد قرمز کاری نداشتیم Ùˆ خیال همه‌شان راحت بود. وقتی برای گرÙتن حقوقم به اداره رÙتم، چنان شلوغی بود Ú©Ù‡ به خودم Ú¯Ùتم کاش اصلاً حقوقم را منتقل نکرده بودم. نه می‌توانستم سر ص٠بایستم Ùˆ نه می‌توانستم از حقوقم بگذرم. تازه مگر مواجب‌بگیر دولت چیزی جز یک انبان گشاده‌ی پای صندوق است؟..... Ùˆ اگر هم می‌ماندی با آن شلوغی باید تا دو بعداز ظهر سر پا بایستی. همه‌ی جیره‌خوارهای اداره بو برده بودند Ú©Ù‡ مدیرم. Ùˆ لابد آن‌قدر ساده لوح بودند Ú©Ù‡ Ùکر کنند روزی گذارشان به مدرسه‌ی ما بیÙتد. دنبال سÙته‌ها می‌گشتند، به حسابدار قبلی Ùحش می‌دادند، التماس می‌کردند Ú©Ù‡ این ماه را ندیده بگیرید Ùˆ همه‌ی حق Ùˆ حساب‌دان شده بودند Ùˆ یکی Ú©Ù‡ زودتر از نوبت پولش را می‌گرÙت صدای همه در می‌آمد. در لیست مدرسه، بزرگ‌ترین رقم مال من بود. درست مثل بزرگ‌ترین گناه در نامه‌ی عمل. دو برابر Ùراش جدیدمان حقوق می‌گرÙتم. از دیدن رقم‌های مردنی حقوق دیگران چنان خجالت کشیدم Ú©Ù‡ انگار مال آن‌ها را دزدیده‌ام. Ùˆ تازه خلوت Ú©Ù‡ شد Ùˆ ده پانزده تا امضا Ú©Ù‡ کردم، صندوق‌دار چشمش به من اÙتاد Ùˆ با یک معذرت، شش صد تومان پول دزدی را گذاشت ک٠دستم... مرده شور! + +هنوز بر٠اول نباریده بود Ú©Ù‡ یک روز عصر، معلم کلاس چهار رÙت زیر ماشین. زیر یک سواری. مثل همه‌ی عصرها من مدرسه نبودم. دم غروب بود Ú©Ù‡ Ùراش قدیمی مدرسه دم در خونه‌مون، خبرش را آورد. Ú©Ù‡ دویدم به طر٠لباسم Ùˆ تا حاضر بشوم، می‌شنیدم Ú©Ù‡ دارد قضیه را برای زنم تعری٠می‌کند. ماشین برای یکی از آمریکایی‌ها بوده. باقیش را از خانه Ú©Ù‡ در آمدیم برایم تعری٠کرد. گویا یارو خودش پشت Ùرمون بوده Ùˆ بعد هم هول شده Ùˆ در رÙته. بچه‌ها خبر را به مدرسه برگردانده‌اند Ùˆ تا Ùراش Ùˆ زنش برسند، جمعیت Ùˆ پاسبان‌ها سوارش کرده بودند Ùˆ Ùرستاده بوده‌اند مریض‌خانه. به اتوبوس Ú©Ù‡ رسیدم، دیدم لاک پشت است. Ùراش را مرخص کردم Ùˆ پریدم توی تاکسی. اول رÙتم سراغ پاسگاه جدید کلانتری. تعاری٠تکه Ùˆ پاره‌ای از پرونده مطلع بود. اما پرونده تصریحی نداشت Ú©Ù‡ راننده Ú©Ù‡ بوده. اما هیچ کس نمی‌دانست عاقبت Ú†Ù‡ بلایی بر سر معلم کلاس چهار ما آمده است. کشیک پاسگاه همین قدر مطلع بود Ú©Ù‡ درین جور موارد «طبق جریان اداری» اول می‌روند سرکلانتری، بعد دایره‌ی تصادÙات Ùˆ بعد بیمارستان. اگر آشنا در نمی‌آمدیم، کشیک پاسگاه مسلماً نمی‌گذاشت به پرونده نگاه Ú†Ù¾ بکنم. احساس کردم میان اهل محل کم‌کم دارم سرشناس می‌شوم. Ùˆ از این احساس خنده‌ام گرÙت. + +ساعت Û¸ دم در بیمارستان بودم، اگر سالم هم بود حتماً یه چیزیش شده بود. همان طور Ú©Ù‡ من یه چیزیم می‌شد. روی در بیمارستان نوشته شده بود: «از ساعت Û· به بعد ورود ممنوع». در زدم. از پشت در کسی همین آیه را صادر کرد. دیدم Ùایده ندارد Ùˆ باید از یک چیزی Ú©Ù…Ú© بگیرم. از قدرتی، از مقامی، از هیکلی، از یک چیزی. صدایم را Ú©Ù„Ùت کردم Ùˆ Ú¯Ùتم:« من...» می‌خواستم بگویم من مدیر مدرسه‌ام. ولی Ùوراً پشیمان شدم. یارو لابد می‌گÙت مدیر مدرسه کدام سگی است؟ این بود با Ú©Ù…ÛŒ Ù…Ú©Ø« Ùˆ طمطراق Ùراوان جمله‌ام را این طور تمام کردم: + +- ...بازرس وزارت Ùرهنگم. + +Ú©Ù‡ کلون صدایی کرد Ùˆ لای در باز شد. یارو با چشم‌هایش سلام کرد. رÙتم تو Ùˆ با همان صدا پرسیدم: + +- این معلمه مدرسه Ú©Ù‡ تصاد٠کرده... + +تا آخرش را خواند. یکی را صدا زد Ùˆ دنبالم Ùرستاد Ú©Ù‡ طبقه‌ی Ùلان، اتاق Ùلان. از حیاط به راهرو Ùˆ باز به حیاط دیگر Ú©Ù‡ نصÙØ´ را بر٠پوشانده بود Ùˆ من چنان می‌دویدم Ú©Ù‡ یارو از عقب سرم هن هن می‌کرد. طبقه‌ی اول Ùˆ دوم Ùˆ چهارم. چهار تا پله یکی. راهرو تاریک بود Ùˆ پر از بوهای مخصوص بود. هن هن کنان دری را نشان داد Ú©Ù‡ هل دادم Ùˆ رÙتم تو. بو تندتر بود Ùˆ تاریکی بیشتر. تالاری بود پر از تخت Ùˆ جیرجیر Ú©ÙØ´ Ùˆ خرخر یک Ù†Ùر. دور یک تخت چهار Ù†Ùر ایستاده بودند. حتماً خودش بود. پای تخت Ú©Ù‡ رسیدم، احساس کردم همه‌ی آنچه از خشونت Ùˆ تظاهر Ùˆ ابهت به Ú©Ù…Ú© خواسته بودم آب شد Ùˆ بر سر Ùˆ صورتم راه اÙتاد. Ùˆ این معلم کلاس چهارم مدرسه‌ام بود. سنگین Ùˆ با Ø´Ú©Ù… بر آمده دراز کشیده بود. خیلی کوتاه‌تر از زمانی Ú©Ù‡ سر پا بود به نظرم آمد. صورت Ùˆ سینه‌اش از روپوش چرک‌مÙرد بیرون بود. صورتش را Ú©Ù‡ شسته بودند کبود کبود بود، درست به رنگ جای سیلی روی صورت بچه‌ها. مرا Ú©Ù‡ دید، لبخند Ùˆ Ú†Ù‡ لبخندی! شاید می‌خواست بگوید مدرسه‌ای Ú©Ù‡ مدیرش عصرها سر کار نباشد، باید همین جورها هم باشد. خنده توی صورت او همین طور لرزید Ùˆ لرزید تا یخ زد. + +«آخر چرا تصاد٠کردی؟...» + +مثل این Ú©Ù‡ سوال را ازو کردم. اما وقتی Ú©Ù‡ دیدم نمی‌تواند حر٠بزند Ùˆ به جای هر جوابی همان خنده‌ی یخ‌بسته را روی صورت دارد، خودم را به عنوان او دم Ú†Ú© گرÙتم. «آخه چرا؟ چرا این هیکل مدیر Ú©Ù„ÛŒ را با خودت این قد این ور Ùˆ آن ور می‌بری تا بزنندت؟ تا زیرت کنند؟ مگر نمی‌دانستی Ú©Ù‡ معلم حق ندارد این قدر خوش‌هیکل باشد؟ آخر چرا تصاد٠کردی؟» به چنان عتاب Ùˆ خطابی این‌ها را می‌گÙتم Ú©Ù‡ هیچ مطمئن نیستم بلند بلند به خودش Ù†Ú¯Ùته باشم. Ùˆ یک مرتبه به کله‌ام زد Ú©Ù‡ «مبادا خودت چشمش زده باشی؟» Ùˆ بعد: «احمق خاک بر سر! بعد از سی Ùˆ چند سال عمر، تازه خراÙاتی شدی!» Ùˆ چنان از خودم بیزاریم گرÙت Ú©Ù‡ می‌خواستم به یکی Ùحش بدهم، کسی را بزنم. Ú©Ù‡ چشمم به دکتر کشیک اÙتاد. + +- مرده شور این مملکتو ببره. ساعت چهار تا حالا از تن این مرد خون می‌ره. Ø­ÛŒÙتون نیومد؟... + +دستی روی شانه‌ام نشست Ùˆ Ùریادم را خواباند. برگشتم پدرش بود. او هم می‌خندید. دو Ù†Ùر دیگر هم با او بودند. همه دهاتی‌وار؛ همه خوش قد Ùˆ قواره. حظ کردم! آن دو تا پسرهایش بودند یا برادرزاده‌هایش یا کسان دیگرش. تازه داشت Ú¯Ù„ از گلم می‌شکÙت Ú©Ù‡ شنیدم: + +- آقا Ú©ÛŒ باشند؟ + +این راهم دکتر کشیک Ú¯Ùت Ú©Ù‡ من باز سوار شدم: + +- مرا می‌گید آقا؟ من هیشکی. یک آقا مدیر Ú©ÙˆÙتی. این هم معلمم. + +Ú©Ù‡ یک مرتبه عقل Ù‡ÛŒ زد Ùˆ «پسر Ø®ÙÙ‡ شو» Ùˆ Ø®ÙÙ‡ شدم. بغض توی گلویم بود. دلم می‌خواست یک کلمه دیگر بگوید. یک کنایه بزند... نسبت به مهارت هیچ دکتری تا کنون نتوانسته‌ام قسم بخورم. دستش را دراز کرد Ú©Ù‡ به اکراه Ùشار دادم Ùˆ بعد شیشه‌ی بزرگی را نشانم داد Ú©Ù‡ وارونه بالای تخت آویزان بود Ùˆ خرÙهمم کرد Ú©Ù‡ این جوری غذا به او می‌رسانند Ùˆ عکس هم گرÙته‌اند Ùˆ تا Ùردا صبح اگر زخم‌ها چرک نکند، جا خواهند انداخت Ùˆ Ú¯Ú† خواهند کرد. Ú©Ù‡ یکی دیگر از راه رسید. گوشی به دست Ùˆ سÙید پوش Ùˆ معطر. با حرکاتی مثل آرتیست سینما. سلامم کرد. صدایش در ته ذهنم چیزی را مختصر تکانی داد. اما احتیاجی به کنجکاوی نبود. یکی از شاگردهای نمی‌دانم چند سال پیشم بود. خودش خودش را معرÙÛŒ کرد. آقای دکتر...! عجب روزگاری! هر تکه از وجودت را با مزخرÙÛŒ از انبان مزخرÙاتت، مثل ذره‌ای روزی در خاکی ریخته‌ای Ú©Ù‡ حالا سبز کرده. چشم داری احمق. این تویی Ú©Ù‡ روی تخت دراز کشیده‌ای. ده سال آزگار از پلکان ساعات Ùˆ دقایق عمرت هر لحظه یکی بالا رÙته Ùˆ تو Ùقط خستگی این بار را هنوز در تن داری. این جوجه‌ÙÚ©Ù„ÛŒ Ùˆ جوجه‌های دیگر Ú©Ù‡ نمی‌شناسی‌شان، همه از تخمی سر در آورده‌اند Ú©Ù‡ روزی حصار جوانی تو بوده Ùˆ حالا شکسته Ùˆ خالی مانده. دستش را گرÙتم Ùˆ کشیدمش کناری Ùˆ در گوشش هر Ú†Ù‡ بد Ùˆ بی‌راه می‌دانستم، به او Ùˆ همکارش Ùˆ شغلش دادم. مثلاً می‌خواستم سÙارش معلم کلاس چهار مدرسه‌ام را کرده باشم. بعد هم سری برای پدر تکان دادم Ùˆ گریختم. از در Ú©Ù‡ بیرون آمدم، حیاط بود Ùˆ هوای بارانی. از در بزرگ Ú©Ù‡ بیرون آمدم به این Ùکر می‌کردم Ú©Ù‡ «اصلا به تو چه؟ اصلاً چرا آمدی؟ می‌خواستی کنجکاوی‌ات را سیرکنی؟» Ùˆ دست آخر به این نتیجه رسیدم Ú©Ù‡ «طعمه‌ای برای میزنشین‌های شهربانی Ùˆ دادگستری به دست آمده Ùˆ تو نه می‌توانی این طعمه را از دستشان بیرون بیاوری Ùˆ نه هیچ کار دیگری می‌توانی بکنی...» + +Ùˆ داشتم سوار تاکسی می‌شدم تا برگردم خانه Ú©Ù‡ یک دÙعه به صراÙت اÙتادم Ú©Ù‡ اقلاً چرا نپرسیدی Ú†Ù‡ بلایی به سرش آمده؟» خواستم عقب‌گرد کنم، اما هیکل کبود معلم کلاس چهارم روی تخت بود Ùˆ دیدم نمی‌توانم. خجالت می‌کشیدم Ùˆ یا می‌ترسیدم. آن شب تا ساعت دو بیدار بودم Ùˆ Ùردا یک گزارش Ù…Ùصل به امضای مدیر مدرسه Ùˆ شهادت همه‌ی معلم‌ها برای اداره‌ی Ùرهنگ Ùˆ کلانتری محل Ùˆ بعد هم دوندگی در اداره‌ی بیمه Ùˆ قرار بر این Ú©Ù‡ روزی نه تومان بودجه برای خرج بیمارستان او بدهند Ùˆ عصر پس از مدتی رÙتم مدرسه Ùˆ کلاس‌ها را تعطیل کردم Ùˆ معلم‌ها Ùˆ بچه‌های ششم را Ùرستادم عیادتش Ùˆ دسته Ú¯Ù„ Ùˆ ازین بازی‌ها... Ùˆ یک ساعتی در مدرسه تنها ماندم Ùˆ Ùارغ از همه چیز برای خودم خیال باÙتم.... Ùˆ Ùردا صبح پدرش آمد سلام Ùˆ احوالپرسی Ùˆ Ú¯Ùت یک دست Ùˆ یک پایش شکسته Ùˆ Ú©Ù…ÛŒ خونریزی داخل مغز Ùˆ از طر٠یارو آمریکاییه آمده‌اند عیادتش Ùˆ وعده Ùˆ وعید Ú©Ù‡ وقتی خوب شد، در اصل چهار استخدامش کنند Ùˆ با زبان بی‌زبانی حالیم کرد Ú©Ù‡ گزارش را بیخود داده‌ام Ùˆ حالا هم داده‌ام، دنبالش نکنم Ùˆ رضایت طرÙین Ùˆ کاسه‌ی از آش داغ‌تر Ùˆ از این حرÙ‌ها... خاک بر سر مملکت. + +اوایل امر توجهی به بچه‌ها نداشتم. خیال می‌کردم اختلا٠سÙÙ†ÛŒ میان‌مان آن قدر هست Ú©Ù‡ کاری به کار همدیگر نداشته باشیم. همیشه سرم به کار خودم بود. در دÙتر را می‌بستم Ùˆ در گرمای بخاری دولت قلم صد تا یک غاز می‌زدم. اما این کار مرتب سه چهار Ù‡Ùته بیش‌تر دوام نکرد. خسته شدم. ناچار به مدرسه بیشتر می‌رسیدم. یاد روزهای قدیمی با دوستان قدیمی به خیر Ú†Ù‡ آدم‌های پاک Ùˆ بی‌آلایشی بودند، Ú†Ù‡ شخصیت‌های بی‌نام Ùˆ نشانی Ùˆ هر کدام با Ú†Ù‡ زبانی Ùˆ با Ú†Ù‡ ادا Ùˆ اطوارهای مخصوص به خودشان Ùˆ این جوان‌های Ú†Ù„Ùته‌ای. Ú†Ù‡ مقلدهای بی‌دردسری برای Ùرهنگی‌مابی! نه خبری از دیروزشان داشتند Ùˆ نه از املاک تازه‌ای Ú©Ù‡ با Ù‡Ùتاد واسطه به دست‌شان داده بودند، چیزی سرشان می‌شد. بدتر از همه بی‌دست Ùˆ پایی‌شان بود. آرام Ùˆ مرتب درست مثل واگن شاه عبدالعظیم می‌آمدند Ùˆ می‌رÙتند. Ùقط بلد بودند روزی ده دقیقه دیرتر بیایند Ùˆ همین. Ùˆ از این هم بدتر تنگ‌نظری‌شان بود. + +سه بار شاهد دعواهایی بودم Ú©Ù‡ سر یک گلدان میخک یا شمعدانی بود. بچه‌باغبان‌ها زیاد بودند Ùˆ هر کدام‌شان حداقل ماهی یک گلدان میخک یا شمعدانی می‌آوردند Ú©Ù‡ در آن بر٠و سرما نعمتی بود. اول تصمیم گرÙتم، مدرسه را با آن‌ها زینت دهم. ولی Ú†Ù‡ Ùایده؟ نه کسی آب‌شان می‌داد Ùˆ نه مواظبتی. Ùˆ باز بدتر از همه‌ی این‌ها، بی‌شخصیتی معلم‌ها بود Ú©Ù‡ درمانده‌ام کرده بود. دو کلمه نمی‌توانستند حر٠بزنند. عجب هیچ‌کاره‌هایی بودند! احساس کردم Ú©Ù‡ روز به روز در کلاس‌ها معلم‌ها به جای دانش‌آموزان جااÙتاده‌تر می‌شوند. در نتیجه Ú¯Ùتم بیش‌تر متوجه بچه‌ها باشم. + +آن‌ها Ú©Ù‡ تنها با ناظم سر Ùˆ کار داشتند Ùˆ مثل این بود Ú©Ù‡ به من Ùقط یک سلام نیمه‌جویده بدهکارند. با این همه نومیدکننده نبودند. توی Ú©ÙˆÚ†Ù‡ مواظب‌شان بودم. می‌خواستم حر٠و سخن‌ها Ùˆ درد دل‌ها Ùˆ اÙکارشان را از یک Ùحش نیمه‌کاره یا از یک ادای نیمه‌تمام حدس بزنم، Ú©Ù‡ سلام‌نکرده در می‌رÙتند. خیلی Ú©Ù… تنها به مدرسه می‌آمدند. پیدا بود Ú©Ù‡ سر راه همدیگر می‌ایستند یا در خانه‌ی یکدیگر می‌روند. سه چهار Ù†Ùرشان هم با اسکورت می‌آمدند. از بیست سی Ù†Ùری Ú©Ù‡ ناهار می‌ماندند، Ùقط دو Ù†Ùرشان چلو خورش می‌آوردند؛ Ùراش اولی مدرسه برایم خبر می‌آورد. بقیه گوشت‌کوبیده، پنیر گردوئی، دم پختکی Ùˆ از این جور چیزها. دو Ù†Ùرشان هم بودند Ú©Ù‡ نان سنگک خالی می‌آوردند. برادر بودند. پنجم Ùˆ سوم. صبح Ú©Ù‡ می‌آمدند، جیب‌هاشان باد کرده بود. سنگک را نص٠می‌کردند Ùˆ توی جیب‌هاشان می‌تپاندند Ùˆ ظهر می‌شد، مثل آن‌هایی Ú©Ù‡ ناهارشان را در خانه می‌خورند، می‌رÙتند بیرون. من Ùقط بیرون رÙتن‌شان را می‌دیدم. اما حتی همین‌ها هر کدام روزی، یکی دو قران از Ùراش مدرسه خرت Ùˆ خورت می‌خریدند. از همان Ùراش قدیمی مدرسه Ú©Ù‡ ماهی پنج تومان سرایداریش را وصول کرده بودم. هر روز Ú©Ù‡ وارد اتاقم می‌شدم پشت سر من می‌آمد بارانی‌ام را بر می‌داشت Ùˆ شروع می‌کرد به گزارش دادن، Ú©Ù‡ دیروز باز دو Ù†Ùر از معلم‌ها سر یک گلدان دعوا کرده‌اند یا مأمور Ùرماندار نظامی آمده یا دÙتردار عوض شده Ùˆ از این اباطیل... پیدا بود Ú©Ù‡ Ùراش جدید هم در مطالبی Ú©Ù‡ او می‌گÙت، سهمی دارد. + +یک روز در حین گزارش دادن، اشاره‌ای کرد به این مطلب Ú©Ù‡ دیروز عصر یکی از بچه‌های کلاس چهار دو تا کله قند به او Ùروخته است. درست مثل اینکه سر کلا٠را به دستم داده باشد پرسیدم: + +- چند؟ + +- دو تومنش دادم آقا. + +- زحمت کشیدی. Ù†Ú¯Ùتی از کجا آورده؟ + +- من Ú©Ù‡ ضامن بهشت Ùˆ جهنمش نبودم آقا. + +بعد پرسیدم: + +- چرا به آقای ناظم خبر ندادی؟ + +می‌دانستم Ú©Ù‡ هم او Ùˆ هم Ùراش جدید، ناظم را هووی خودشان می‌دانند Ùˆ خیلی چیزهاشان از او مخÙÛŒ بود. این بود Ú©Ù‡ میان من Ùˆ ناظم خاصه‌خرجی می‌کردند. در جوابم همین طور مردد مانده بود Ú©Ù‡ در باز شد Ùˆ Ùراش جدید آمد تو. Ú©Ù‡: + +- اگه خبرش می‌کرد آقا بایست سهمش رو می‌داد... + +اخمم را درهم کشیدم Ùˆ Ú¯Ùتم: + +- تو باز رÙتی تو Ú©ÙˆÚ© مردم! اونم این جوری سر نزده Ú©Ù‡ نمی‌آیند تو اتاق کسی، پیرمرد! + +Ùˆ بعد اسم پسرک را ازشان پرسیدم Ùˆ حالی‌شان کردم Ú©Ù‡ چندان مهم نیست Ùˆ Ùرستادمشان برایم چای بیاورند. بعد کارم را زودتر تمام کردم Ùˆ رÙتم به اتاق دÙتر احوالی از مادر ناظم پرسیدم Ùˆ به هوای ورق زدن پرونده‌ها Ùهمیدم Ú©Ù‡ پسرک شاگرد دوساله است Ùˆ پدرش تاجر بازار. بعد برگشتم به اتاقم. یادداشتی برای پدر نوشتم Ú©Ù‡ پس Ùردا صبح، بیاید مدرسه Ùˆ دادم دست Ùراش جدید Ú©Ù‡ خودش برساند Ùˆ رسیدش را بیاورد. + +Ùˆ پس Ùردا صبح یارو آمد. باید مدیر مدرسه بود تا دانست Ú©Ù‡ اولیای اطÙال Ú†Ù‡ راحت تن به کوچک‌ترین خرده‌Ùرمایش‌های مدرسه می‌دهند. حتم دارم Ú©Ù‡ اگر از اجرای ثبت هم دنبال‌شان بÙرستی به این زودی‌ها Ø¢Ùتابی نشوند. چهل Ùˆ پنج ساله مردی بود با یخه‌ی بسته بی‌کراوات Ùˆ پالتویی Ú©Ù‡ بیش‌تر به قبا می‌ماند. Ùˆ خجالتی می‌نمود. هنوز ننشسته، پرسیدم: + +- شما دو تا زن دارید آقا؟ + +درباره‌ی پسرش برای خودم پیش‌گویی‌هایی کرده بودم Ùˆ Ú¯Ùتم این طوری به او رودست می‌زنم. پیدا بود Ú©Ù‡ از سؤالم زیاد یکه نخورده است. Ú¯Ùتم برایش چای آوردند Ùˆ سیگاری تعارÙØ´ کردم Ú©Ù‡ ناشیانه دود کرد از ترس این Ú©Ù‡ مبادا جلویم در بیاید Ú©Ù‡ - به شما Ú†Ù‡ مربوط است Ùˆ از این اعتراض‌ها - امانش ندادم Ùˆ سؤالم را این جور دنبال کردم: + +- البته می‌بخشید. چون لابد به همین علت بچه شما دو سال در یک کلاس مانده. + +شروع کرده بودم برایش یک میتینگ بدهم Ú©Ù‡ پرید وسط حرÙÙ…: + +- به سر شما قسم، روزی چهار زار پول تو جیبی داره آقا. پدرسوخته‌ی نمک به حروم...! + +حالیش کردم Ú©Ù‡ علت، پول تو جیبی نیست Ùˆ خواستم Ú©Ù‡ عصبانی نشود Ùˆ قول گرÙتم Ú©Ù‡ اصلاً به روی پسرش هم نیاورد Ùˆ آن وقت میتینگم را برایش دادم Ú©Ù‡ لابد پسر در خانه مهر Ùˆ محبتی نمی‌بیند Ùˆ غیب‌گویی‌های دیگر... تا عاقبت یارو خجالتش ریخت Ùˆ سر٠درد دلش باز شد Ú©Ù‡ عÙریته زن اولش همچه بوده Ùˆ همچون بوده Ùˆ پسرش هم به خودش برده Ùˆ Ú©ÛŒ طلاقش داده Ùˆ از زن دومش چند تا بچه دارد Ùˆ این نره‌خر حالا باید برای خودش نان‌آور شده باشد Ùˆ زنش حق دارد Ú©Ù‡ با دو تا بچه‌ی خرده‌پا به او نرسد... من هم Ú©Ù„ÛŒ برایش صحبت کردم. چایی دومش را هم سر کشید Ùˆ قول‌هایش را Ú©Ù‡ داد Ùˆ رÙت، من به این Ùکر اÙتادم Ú©Ù‡ «نکند علمای تعلیم Ùˆ تربیت هم، همین جورها تخم دوزرده می‌کنند!» + +یک روز صبح Ú©Ù‡ رسیدم، ناظم هنوز نیامده بود. از این اتÙاق‌ها Ú©Ù… می‌اÙتاد. ده دقیقه‌ای از زنگ می‌گذشت Ùˆ معلم‌ها در دÙتر سرگرم اختلاط بودند. خودم هم وقتی معلم بودم به این مرض دچار بودم. اما وقتی مدیر شدم تازه Ùهمیدم Ú©Ù‡ معلم‌ها Ú†Ù‡ لذتی می‌برند. حق هم داشتند. آدم وقتی مجبور باشد Ø´Ú©Ù„Ú©ÛŒ را به صورت بگذارد Ú©Ù‡ نه دیگران از آن می‌خندند Ùˆ نه خود آدم لذتی می‌برد، پیداست Ú©Ù‡ رÙع تکلی٠می‌کند. زنگ را Ú¯Ùتم زدند Ùˆ بچه‌ها سر کلاس رÙتند. دو تا از کلاس‌ها بی‌معلم بود. یکی از ششمی‌ها را Ùرستادم سر کلاس سوم Ú©Ù‡ برای‌شان دیکته بگوید Ùˆ خودم رÙتم سر کلاس چهار. مدیر هم Ú©Ù‡ باشی، باز باید تمرین Ú©Ù†ÛŒ Ú©Ù‡ مبادا Ùوت Ùˆ ÙÙ† معلمی از یادت برود. در حال صحبت با بچه‌ها بودم Ú©Ù‡ Ùراش خبر آورد Ú©Ù‡ خانمی توی دÙتر منتظرم است. خیال کردم لابد همان زنکه‌ی بیکاره‌ای است Ú©Ù‡ Ù‡Ùته‌ای یک بار به هوای سرکشی، به وضع درس Ùˆ مشق بچه‌اش سری می‌زند. زن سÙیدرویی بود با چشم‌های درشت محزون Ùˆ موی بور. بیست Ùˆ پنج ساله هم نمی‌نمود. اما بچه‌اش کلاس سوم بود. روز اول Ú©Ù‡ دیدمش لباس نارنجی به تن داشت Ùˆ تن بزک کرده بود. از زیارت من خیلی خوشحال شد Ùˆ از مراتب Ùضل Ùˆ ادبم خبر داشت. + +خیلی ساده آمده بود تا با دو تا مرد حرÙÛŒ زده باشد. آن طور Ú©Ù‡ ناظم خبر می‌داد، یک سالی طلاق گرÙته بود Ùˆ روی هم رÙته آمد Ùˆ رÙتنش به مدرسه باعث دردسر بود. وسط بیابان Ùˆ مدرسه‌ای پر از معلم‌های عزب Ùˆ بی‌دست Ùˆ پا Ùˆ یک زن زیبا... ناچار جور در نمی‌آمد. این بود Ú©Ù‡ دÙعات بعد دست به سرش می‌کردم، اما از رو نمی‌رÙت. سراغ ناظم Ùˆ اتاق دÙتر را می‌گرÙت Ùˆ صبر می‌کرد تا زنگ را بزنند Ùˆ معلم‌ها جمع بشوند Ùˆ لابد حر٠و سخنی Ùˆ خنده‌ای Ùˆ بعد از معلم کلاس سوم سراغ کار Ùˆ بار Ùˆ بچه‌اش را می‌گرÙت Ùˆ زنگ بعد را Ú©Ù‡ می‌زدند، خداحاÙظی می‌کرد Ùˆ می‌رÙت. آزاری نداشت. با چشم‌هایش Ù†Ùس معلم‌ها را می‌برید. Ùˆ حالا باز هم همان زن بود Ùˆ آمده بود Ùˆ من تا از پلکان پایین بروم در ذهنم جملات زننده‌ای ردی٠می‌کردم، تا پایش را از مدرسه ببرد Ú©Ù‡ در را باز کردم Ùˆ سلام... + +عجب! او نبود. دخترک یکی دو ساله‌ای بود با دهان گشاد Ùˆ موهای زبرش را به زحمت عقب سرش گلوله کرده بود Ùˆ بÙهمی Ù†Ùهمی دستی توی صورتش برده بود. روی هم رÙته زشت نبود. اما داد می‌زد Ú©Ù‡ معلم است. Ú¯Ùتم Ú©Ù‡ مدیر مدرسه‌ام Ùˆ حکمش را داد دستم Ú©Ù‡ دانشسرا دیده بود Ùˆ تازه استخدام شده بود. برایمان معلم Ùرستاده بودند. خواستم بگویم «مگر رئیس Ùرهنگ نمی‌داند Ú©Ù‡ این جا بیش از حد مرد است» ولی دیدم لزومی ندارد Ùˆ Ùکر کردم این هم خودش تنوعی است. + +به هر صورت زنی بود Ùˆ می‌توانست محیط خشن مدرسه را Ú©Ù‡ به طرز ناشیانه‌ای پسرانه بود، لطاÙتی بدهد Ùˆ خوش‌آمد Ú¯Ùتم Ùˆ چای آوردند Ú©Ù‡ نخورد Ùˆ بردمش کلاس‌های سوم Ùˆ چهارم را نشانش دادم Ú©Ù‡ هر کدام را مایل است، قبول کند Ùˆ صحبت از هجده ساعت درس Ú©Ù‡ در انتظار او بود Ùˆ برگشتیم به دÙتر .پرسید غیر از او هم، معلم زن داریم. Ú¯Ùتم: + +- متأسÙانه راه مدرسه‌ی ما را برای پاشنه‌ی Ú©ÙØ´ خانم‌ها نساخته‌اند. + +Ú©Ù‡ خندید Ùˆ احساس کردم زورکی می‌خندد. بعد Ú©Ù…ÛŒ این دست Ùˆ آن دست کرد Ùˆ عاقبت: + +- آخه من شنیده بودم شما با معلماتون خیلی خوب تا می‌کنید. + +صدای جذابی داشت. Ùکر کردم حی٠که این صدا را پای تخته سیاه خراب خواهد کرد. Ùˆ Ú¯Ùتم: + +- اما نه این قدر Ú©Ù‡ مدرسه تعطیل بشود خانم! Ùˆ لابد به عرض‌تون رسیده Ú©Ù‡ همکارهای شما، خودشون نشسته‌اند Ùˆ تصمیم گرÙته‌اند Ú©Ù‡ هجده ساعت درس بدهند. بنده هیچ‌کاره‌ام. + +- اختیار دارید. + +Ùˆ Ù†Ùهمیدم با این «اختیار دارید» Ú†Ù‡ می‌خواست بگوید. اما پیدا بود Ú©Ù‡ بحث سر ساعات درس نیست. آناً تصمیم گرÙتم، امتحانی بکنم: + +- این را هم اطلاع داشته باشید Ú©Ù‡ Ùقط دو تا از معلم‌های ما متأهل‌اند. + +Ú©Ù‡ قرمز شد Ùˆ برای این Ú©Ù‡ کار دیگری نکرده باشد، برخاست Ùˆ حکمش را از روی میز برداشت. پا به پا می‌شد Ú©Ù‡ دیدم باید به دادش برسم. ساعت را از او پرسیدم. وقت زنگ بود. Ùراش را صدا کردم Ú©Ù‡ زنگ را بزند Ùˆ بعد به او Ú¯Ùتم، بهتر است مشورت دیگری هم با رئیس Ùرهنگ بکند Ùˆ ما به هر صورت خوشحال خواهیم شد Ú©Ù‡ اÙتخار همکاری با خانمی مثل ایشان را داشته باشیم Ùˆ خداحاÙظ شما. از در دÙتر Ú©Ù‡ بیرون رÙت، صدای زنگ برخاست Ùˆ معلم‌ها انگار موشان را آتش زده‌اند، به عجله رسیدند Ùˆ هر کدام از پشت سر، آن قدر او را پاییدند تا از در بزرگ آهنی مدرسه بیرون رÙت. + +Ùردا صبح معلوم شد Ú©Ù‡ ناظم، دنبال کار مادرش بوده است Ú©Ù‡ قرار بود بستری شود، تا جای سرطان گرÙته را یک دوره برق بگذارند. Ú©Ù„ کار بیمارستان را من به Ú©Ù…Ú© دوستانم انجام دادم Ùˆ موقع آن رسیده بود Ú©Ù‡ مادرش برود بیمارستان اما وحشتش گرÙته بود Ùˆ حاضر نبود به بیمارستان برود. Ùˆ ناظم می‌خواست رسماً دخالت کنم Ùˆ با هم برویم خانه‌شان Ùˆ با زبان چرب Ùˆ نرمی Ú©Ù‡ به قول ناظم داشتم مادرش را راضی کنم. چاره‌ای نبود. مدرسه را به معلم‌ها سپردیم Ùˆ راه اÙتادیم. بالاخره به خانه‌ی آن‌ها رسیدیم. خانه‌ای بسیار Ú©ÙˆÚ†Ú© Ùˆ اجاره‌ای. مادر با چشم‌های گود نشسته Ùˆ انگار زغال به صورت مالیده! سیاه نبود اما رنگش چنان تیره بود Ú©Ù‡ وحشتم گرÙت. اصلاً صورت نبود. زخم سیاه شده‌ای بود Ú©Ù‡ انگار از جای چشم‌ها Ùˆ دهان سر باز کرده است. Ú©Ù„ÛŒ با مادرش صحبت کردم. از پسرش Ùˆ Ú©Ù„ÛŒ دروغ Ùˆ دونگ، Ùˆ چادرش را روی چارقدش انداختیم Ùˆ علی... Ùˆ خلاصه در بیمارستان بستری شدند. + +Ùردا Ú©Ù‡ به مدرسه آمدم، ناظم سرحال بود Ùˆ پیدا بود Ú©Ù‡ از شر چیزی خلاص شده است Ùˆ خبر داد Ú©Ù‡ معلم کلاس سه را گرÙته‌اند. یک ماه Ùˆ خرده‌ای می‌شد Ú©Ù‡ مخÙÛŒ بود Ùˆ ما ورقه‌ی انجام کارش را به جانشین غیر رسمی‌اش داده بودیم Ùˆ حقوقش لنگ نشده بود Ùˆ تا خبر رسمی بشنود Ùˆ در روزنامه‌ای بیابد Ùˆ قضیه به اداره‌ی Ùرهنگ Ùˆ لیست حقوق بکشد، باز هم می‌دادیم. اما خبر Ú©Ù‡ رسمی شد، جانشین واجد شرایط هم نمی‌توانست بÙرستد Ùˆ باید طبق مقررات رÙتار می‌کردیم Ùˆ بدیش همین بود. Ú©Ù… Ú©Ù… احساس کردم Ú©Ù‡ مدرسه خلوت شده است Ùˆ کلاس‌ها اغلب اوقات بی‌کارند. جانشین معلم کلاس چهار هنوز سر Ùˆ صورتی به کارش نداده بود Ùˆ حالا یک کلاس دیگر هم بی‌معلم شد. این بود Ú©Ù‡ باز هم به سراغ رئیس Ùرهنگ رÙتم. معلوم شد آن دخترک ترسیده Ùˆ «نرسیده متلک پیچش کرده‌اید» رئیس Ùرهنگ این طور می‌گÙت. Ùˆ ترجیح داده بود همان زیر نظر خودش دÙترداری کند. Ùˆ بعد قول Ùˆ قرار Ùˆ Ùردا Ùˆ پس Ùردا Ùˆ عاقبت چهار روز دوندگی تا دو تا معلم گرÙتم. یکی جوانکی رشتی Ú©Ù‡ گذاشتیمش کلاس چهار Ùˆ دیگری باز یکی ازین آقاپسرهای بریانتین‌زده Ú©Ù‡ هر روز کراوات عوض می‌کرد، با نقش‌ها Ùˆ طرح‌های عجیب. عجب Ùرهنگ را با قرتی‌ها در آمیخته بودند! باداباد. او را هم گذاشتیم سر کلاس سه. اواخر بهمن، یک روز ناظم آمد اتاقم Ú©Ù‡ بودجه‌ی مدرسه را زنده کرده است. Ú¯Ùتم: + +- مبارکه، Ú†Ù‡ قدر گرÙتی؟ + +- هنوز هیچ Ú†ÛŒ آقا. قراره Ùردا سر ظهر بیاند این جا آقا Ùˆ همین جا قالش رو بکنند. + +Ùˆ Ùردا اصلاً مدرسه نرÙتم. حتماً می‌خواست من هم باشم Ùˆ در بده بستان ماهی پانزده قران، حق نظاÙت هر اتاق نظارت کنم Ùˆ از مدیریتم مایه بگذارم تا تنخواه‌گردان مدرسه Ùˆ حق آب Ùˆ دیگر پول‌های عقب‌اÙتاده وصول بشود... Ùردا سه Ù†Ùری آمده بودند مدرسه. ناهار هم به خرج ناظم خورده بودند. Ùˆ قرار دیگری برای یک سور حسابی گذاشته بودند Ùˆ رÙته بودند Ùˆ ناظم با زبان بی‌زبانی حالیم کرد Ú©Ù‡ این بار حتماً باید باشم Ùˆ آن طور Ú©Ù‡ می‌گÙت، جای شکرش باقی بود Ú©Ù‡ مراعات کرده بودند Ùˆ حق بوقی نخواسته بودند. اولین باری بود Ú©Ù‡ چنین اهمیتی پیدا می‌کردم. این هم یک مزیت دیگر مدیری مدرسه بود! سی صد تومان از بودجه‌ی دولت بسته به این بود Ú©Ù‡ به Ùلان مجلس بروی یا نروی. تا سه روز دیگر موعد سور بود، اصلاً یادم نیست Ú†Ù‡ کردم. اما همه‌اش در این Ùکر بودم Ú©Ù‡ بروم یا نروم؟ یک بار دیگر استعÙانامه‌ام را توی جیبم گذاشتم Ùˆ بی این Ú©Ù‡ صدایش را در بیاورم، روز سور هم نرÙتم. + +بعد دیدم این طور Ú©Ù‡ نمی‌شود. Ú¯Ùتم بروم قضایا را برای رئیس Ùرهنگ بگویم. Ùˆ رÙتم. سلام Ùˆ احوالپرسی نشستم. اما Ú†Ù‡ بگویم؟ بگویم چون نمی‌خواستم در خوردن سور شرکت کنم، استعÙا می‌دهم؟... دیدم چیزی ندارم Ú©Ù‡ بگویم. Ùˆ از این گذشته Ø®Ùت‌آور نبود Ú©Ù‡ به خاطر سیصد تومان جا بزنم Ùˆ استعÙا بدهم؟ Ùˆ «خداحاÙظ؛ Ùقط آمده بودم سلام عرض کنم.» Ùˆ از این دروغ‌ها Ùˆ استعÙانامه‌ام را توی جوی آب انداختم. اما ناظم؛ یک Ù‡Ùته‌ای مثل سگ بود. عصبانی، پر سر Ùˆ صدا Ùˆ شارت Ùˆ شورت! حتی نرÙتم احوال مادرش را بپرسم. یک Ù‡Ùته‌ی تمام می‌رÙتم Ùˆ در اتاقم را می‌بستم Ùˆ سوراخ‌های گوشم را می‌گرÙتم Ùˆ تا اÙز Ùˆ Ú†Ùزّ بچه‌ها بخوابد، از این سر تا آن سر اتاق را می‌کوبیدم. ده روز تمام، قلب من Ùˆ بچه‌ها با هم Ùˆ به یک اندازه از ترس Ùˆ وحشت تپید. تا عاقبت پول‌ها وصول شد. منتها به جای سیصد Ùˆ خرده‌ای، Ùقط صد Ùˆ پنجاه تومان. علت هم این بود Ú©Ù‡ در تنظیم صورت حساب‌ها اشتباهاتی رخ داده بود Ú©Ù‡ ناچار اصلاحش کرده بودند! + +غیر از آن زنی Ú©Ù‡ Ù‡Ùته‌ای یک بار به مدرسه سری می‌زد، از اولیای اطÙال دو سه Ù†Ùر دیگر هم بودند Ú©Ù‡ مرتب بودند. یکی همان پاسبانی Ú©Ù‡ با کمربند، پاهای پسرش را بست Ùˆ ÙÙ„Ú© کرد. یکی هم کارمند پست Ùˆ تلگراÙÛŒ بود Ú©Ù‡ ده روزی یک بار می‌آمد Ùˆ پدر همان بچه‌ی شیطان. Ùˆ یک استاد نجار Ú©Ù‡ پسرش کلاس اول بود Ùˆ خودش سواد داشت Ùˆ به آن می‌بالید Ùˆ کارآمد می‌نمود. یک مقنی هم بود درشت استخوان Ùˆ بلندقد Ú©Ù‡ بچه‌اش کلاس سوم بود Ùˆ Ù‡Ùته‌ای یک بار می‌آمد Ùˆ همان توی حیاط، ده پانزده دقیقه‌ای با Ùراش‌ها اختلاط می‌کرد Ùˆ بی سر Ùˆ صدا می‌رÙت. نه کاری داشت، نه چیزی از آدم می‌خواست Ùˆ همان طور Ú©Ù‡ آمده بود چند دقیقه‌ای را با Ùراش صحبت می‌کرد Ùˆ بعد Ù…ÛŒ رÙت. Ùقط یک روز نمی‌دانم چرا رÙته بود بالای دیوار مدرسه. البته اول Ùکر کردم مأمور اداره برق است ولی بعد متوجه شدم Ú©Ù‡ همان مرد مقنی است. بچه‌ها جیغ Ùˆ Ùریاد می‌کردند Ùˆ من همه‌اش درین Ùکر بودم Ú©Ù‡ Ú†Ù‡ طور به سر دیوار رÙته است؟ ماحصل داد Ùˆ Ùریادش این بود Ú©Ù‡ چرا اسم پسر او را برای گرÙتن Ú©ÙØ´ Ùˆ لباس به انجمن ندادیم. وقتی به او رسیدم نگاهی به او انداختم Ùˆ بعد تشری به ناظم Ùˆ معلم ها زدم Ú©Ù‡ ولش کردند Ùˆ بچه‌ها رÙتند سر کلاس Ùˆ بعد بی این Ú©Ù‡ نگاهی به او بکنم، Ú¯Ùتم: + +- خسته نباشی اوستا. + +Ùˆ همان طور Ú©Ù‡ به طر٠دÙتر می‌رÙتم رو به ناظم Ùˆ معلم‌ها اÙزودم: + +- لابد جواب درست Ùˆ حسابی نشنیده Ú©Ù‡ رÙته سر دیوار. + +Ú©Ù‡ پشت سرم گرپ صدایی آمد Ùˆ از در دÙتر Ú©Ù‡ رÙتم تو، او Ùˆ ناظم با هم وارد شدند. Ú¯Ùتم نشست. Ùˆ به جای این‌که حرÙÛŒ بزند به گریه اÙتاد. هرگز گمان نمی‌کردم از چنان قد Ùˆ قامتی صدای گریه در بیاید. این بود Ú©Ù‡ از اتاق بیرون آمدم Ùˆ Ùراش را صدا زدم Ú©Ù‡ آب برایش بیاورد Ùˆ حالش Ú©Ù‡ جا آمد، بیاوردش پهلوی من. اما دیگر از او خبری نشد Ú©Ù‡ نشد. نه آن روز Ùˆ نه هیچ روز دیگر. آن روز چند دقیقه‌ای بعد از شیشه‌ی اتاق خودم دیدمش Ú©Ù‡ دمش را لای پایش گذاشته بود از در مدرسه بیرون می‌رÙت Ùˆ Ùراش جدید آمد Ú©Ù‡ بله می‌گÙتند از پسرش پنج تومان خواسته بودند تا اسمش را برای Ú©ÙØ´ Ùˆ لباس به انجمن بدهند. پیدا بود باز توی Ú©ÙˆÚ© ناظم رÙته است. مرخصش کردم Ùˆ ناظم را خواستم. معلوم شد می‌خواسته ناظم را بزند. همین جوری Ùˆ بی‌مقدمه. + +اواخر بهمن بود Ú©Ù‡ یکی از روزهای برÙÛŒ با یکی دیگر از اولیای اطÙال آشنا شدم. یارو مرد بسیار کوتاهی بود؛ Ùرنگ مآب Ùˆ بزک کرده Ùˆ اتو کشیده Ú©Ù‡ ننشسته از تحصیلاتش Ùˆ از سÙرهای Ùرنگش حر٠زد. می‌خواست پسرش را آن وقت سال از مدرسه‌ی دیگر به آن جا بیاورد. پسرش از آن بچه‌هایی بود Ú©Ù‡ شیر Ùˆ مربای صبحانه‌اش را با قربان صدقه توی حلقشان می‌تپانند. کلاس دوم بود Ùˆ ثلث اول دو تا تجدید آورده بود. می‌گÙت در باغ ییلاقی‌اش Ú©Ù‡ نزدیک مدرسه است، باغبانی دارند Ú©Ù‡ پسرش شاگرد ماست Ùˆ درس‌خوان است Ùˆ پیدا است Ú©Ù‡ بچه‌ها زیر سایه شما خوب پیشرÙت می‌کنند. Ùˆ از این پیزرها. Ùˆ حال به خاطر همین بچه، توی این بر٠و سرما، آمده‌اند ساکن باغ ییلاقی شده‌اند. بلند شدم ناظم را صدا کردم Ùˆ دست او Ùˆ بچه‌اش را توی دست ناظم گذاشتم Ùˆ خداحاÙظ شما... Ùˆ نیم ساعت بعد ناظم برگشت Ú©Ù‡ یارو خانه‌ی شهرش را به یک دبیرستان اجاره داده، به ماهی سه هزار Ùˆ دویست تومان، Ùˆ التماس دعا داشته، یعنی معلم سرخانه می‌خواسته Ùˆ حتی بدش نمی‌آمده است Ú©Ù‡ خود مدیر زحمت بکشند Ùˆ ازین گنده‌گوزی‌ها... احساس کردم Ú©Ù‡ ناظم دهانش آب اÙتاده است. Ùˆ من به ناظم حالی کردم خودش برود بهتر است Ùˆ Ùقط کاری بکند Ú©Ù‡ نه صدای معلم‌ها در بیاید Ùˆ نه آخر سال، برای یک معدل ده احتیاجی به من بمیرم Ùˆ تو بمیری پیدا کند. همان روز عصر ناظم رÙته بود Ùˆ قرار Ùˆ مدار برای هر روز عصر یک ساعت به ماهی صد Ùˆ پنجاه تومان. + +دیگر دنیا به کام ناظم بود. حال مادرش هم بهتر بود Ùˆ از بیمارستان مرخصش کرده بودند Ùˆ به Ùکر زن گرÙتن اÙتاده بود. Ùˆ هر روز هم برای یک Ù†Ùر نقشه می‌کشید حتی برای من هم. یک روز در آمد Ú©Ù‡ چرا ما خودمان «انجمن خانه Ùˆ مدرسه» نداشته باشیم؟ نشسته بود Ùˆ حسابش را کرده بود دیده بود Ú©Ù‡ پنجاه شصت Ù†Ùری از اولیای مدرسه دستشان به دهان‌شان می‌رسد Ùˆ از آن هم Ú©Ù‡ به پسرش درس خصوصی می‌داد قول مساعد گرÙته بود. حالیش کردم Ú©Ù‡ مواظب حر٠و سخن اداره‌ای باشد Ùˆ هر کار دلش می‌خواهد بکند. کاغذ دعوت را هم برایش نوشتم با آب Ùˆ تاب Ùˆ خودش برای اداره‌ی Ùرهنگ، داد ماشین کردند Ùˆ به وسیله‌ی خود بچه‌ها Ùرستاد. Ùˆ جلسه با حضور بیست Ùˆ چند Ù†Ùری از اولیای بچه‌ها رسمی شد. خوبیش این بود Ú©Ù‡ پاسبان کشیک پاسگاه هم آمده بود Ùˆ دم در برای همه، پاشنه‌هایش را به هم می‌کوبید Ùˆ معلم‌ها گوش تا گوش نشسته بودند Ùˆ مجلس ابهتی داشت Ùˆ ناظم، چای Ùˆ شیرینی تهیه کرده بود Ùˆ چراغ زنبوری کرایه کرده بود Ùˆ باران هم گذاشت پشتش Ùˆ سالون برای اولین بار در عمرش به نوایی رسید. + +یک سرهنگ بود Ú©Ù‡ رئیسش کردیم Ùˆ آن زن را Ú©Ù‡ Ù‡Ùته‌ای یک بار می‌آمد نایب رئیس. آن Ú©Ù‡ ناظم به پسرش درس خصوصی می‌داد نیامده بود. اما پاکت سربسته‌ای به اسم مدیر Ùرستاده بود Ú©Ù‡ Ùی‌المجلس بازش کردیم. عذرخواهی از این‌که نتوانسته بود بیاید Ùˆ وجه ناقابلی جو٠پاکت. صد Ùˆ پنجاه تومان. Ùˆ پول را روی میز صندوق‌دار گذاشتیم Ú©Ù‡ ضبط Ùˆ ربط کند. نائب رئیس بزک کرده Ùˆ معطر شیرینی تعار٠می‌کرد Ùˆ معلم‌ها با هر بار Ú©Ù‡ شیرینی بر می‌داشتند، یک بار تا بناگوش سرخ می‌شدند Ùˆ Ùراش‌ها دست به دست چای می‌آوردند. + +در Ùکر بودم Ú©Ù‡ یک مرتبه احساس کردم، سیصد چهارصد تومان پول نقد، روی میز است Ùˆ هشت صد تومان هم تعهد کرده بودند. پیرزن صندوقدار Ú©Ù‡ کی٠پولش را همراهش نیاورده بود ناچار حضار تصویب کردند Ú©Ù‡ پول‌ها Ùعلاً پیش ناظم باشد. Ùˆ صورت مجلس مرتب شد Ùˆ امضاها ردی٠پای آن Ùˆ Ùردا Ùهمیدم Ú©Ù‡ ناظم همان شب روی خشت نشسته بوده Ùˆ به معلم‌ها سور داده بوده است. اولین کاری Ú©Ù‡ کردم رونوشت مجلس آن شب را برای اداره‌ی Ùرهنگ Ùرستادم. Ùˆ بعد همان استاد نجار را صدا کردم Ùˆ دستور دادم برای مستراح‌ها دو روزه در بسازد Ú©Ù‡ ناظم خیلی به سختی پولش را داد. Ùˆ بعد در کوچه‌ی مدرسه درخت کاشتیم. تور والیبال را تعویض Ùˆ تعدادی توپ در اختیار بچه‌ها گذاشتیم برای تمرین در بعد از ظهرها Ùˆ آمادگی برای مسابقه با دیگر مدارس Ùˆ در همین حین سر Ùˆ کله‌ی بازرس تربیت بدنی هم پیدا شد Ùˆ هر روز سرکشی Ùˆ بیا Ùˆ برو. تا یک روز Ú©Ù‡ به مدرسه رسیدم شنیدم Ú©Ù‡ از سالون سر Ùˆ صدا می‌آید. صدای هالتر بود. ناظم سر خود رÙته بود Ùˆ سرخود دویست سیصد تومان داده بود Ùˆ هالتر خریده بود Ùˆ بچه‌های لاغر زیر بار آن گردن خود را خرد می‌کردند. من در این میان حرÙÛŒ نزدم. می‌توانستم حرÙÛŒ بزنم؟ من چیکاره بودم؟ اصلاً به من Ú†Ù‡ ربطی داشت؟ هر کار Ú©Ù‡ دلشان می‌خواهد بکنند. مهم این بود Ú©Ù‡ سالون مدرسه رونقی گرÙته بود. ناظم هم راضی بود Ùˆ معلم‌ها هم. چون نه خبر از حسادتی بود Ùˆ نه حر٠و سخنی پیش آمد. Ùقط می‌بایست به ناظم سÙارش Ù…ÛŒ کردم Ú©Ù‡ Ùکر Ùراش‌ها هم باشد. + +Ú©Ù… Ú©Ù… خودمان را برای امتحان‌های ثلث دوم آماده می‌کردیم. این بود Ú©Ù‡ اوایل اسÙند، یک روز معلم‌ها را صدا زدم Ùˆ در شورا مانندی Ú©Ù‡ کردیم بی‌مقدمه برایشان داستان یکی از همکاران سابقم را Ú¯Ùتم Ú©Ù‡ هر وقت بیست می‌داد تا دو روز تب داشت. البته معلم‌ها خندیدند. ناچار تشویق شدم Ùˆ داستان آخوندی را Ú¯Ùتم Ú©Ù‡ در بچگی معلم شرعیاتمان بود Ùˆ زیر عبایش نمره می‌داد Ùˆ دستش چنان می‌لرزید Ú©Ù‡ عبا تکان می‌خورد Ùˆ درست ده دقیقه طول می‌کشید. Ùˆ تازه چند؟ بهترین شاگردها دوازده. Ùˆ البته باز هم خندیدند. Ú©Ù‡ این بار کلاÙه‌ام کرد. Ùˆ بعد حالیشان کردم Ú©Ù‡ بد نیست در طرح سؤال‌ها مشورت کنیم Ùˆ از این حرÙ‌ها... + +Ùˆ از شنبه‌ی بعد، امتحانات شروع شد. درست از نیمه‌ی دوم اسÙند. سؤال‌ها را سه Ù†Ùری می‌دیدیم. خودم با معلم هر کلاس Ùˆ ناظم. در سالون میزها را چیده بودیم البته از وقتی هالتردار شده بود خیلی زیباتر شده بود. در سالون کاردستی‌های بچه‌ها در همه جا به چشم می‌خورد. هر کسی هر چیزی را به عنوان کاردستی درست کرده بودند Ùˆ آورده بودند. Ú©Ù‡ برای این کاردستی‌ها Ú†Ù‡ پول‌ها Ú©Ù‡ خرج نشده بود Ùˆ Ú†Ù‡ دست‌ها Ú©Ù‡ نبریده بود Ùˆ Ú†Ù‡ دعواها Ú©Ù‡ نشده بود Ùˆ Ú†Ù‡ عرق‌ها Ú©Ù‡ ریخته نشده بود. پیش از هر امتحان Ú©Ù‡ می‌شد، خودم یک میتینگ برای بچه‌ها می‌دادم Ú©Ù‡ ترس از معلم Ùˆ امتحان بی‌جا است Ùˆ باید اعتماد به Ù†Ùس داشت Ùˆ ازین مزخرÙات....ولی مگر حر٠به گوش کسی می‌رÙت؟ از در Ú©Ù‡ وارد می‌شدند، چنان هجومی می‌بردند Ú©Ù‡ Ù†Ú¯Ùˆ! به جاهای دور از نظر. یک بار چنان بود Ú©Ù‡ احساس کردم مثل این‌که از ترس، لذت می‌برند. اگر معلم نبودی یا مدیر، به راحتی می‌توانستی حدس بزنی Ú©Ù‡ کی‌ها با هم قرار Ùˆ مداری دارند Ùˆ کدام یک پهلو دست کدام یک خواهد نشست. یکی دو بار کوشیدم بالای دست یکی‌شان بایستم Ùˆ ببینم Ú†Ù‡ می‌نویسد. ولی چنان مضطرب می‌شدند Ùˆ دستشان به لرزه می‌اÙتاد Ú©Ù‡ از نوشتن باز می‌ماندند. می‌دیدم Ú©Ù‡ این مردان آینده، درین کلاس‌ها Ùˆ امتحان‌ها آن قدر خواهند ترسید Ú©Ù‡ وقتی دیپلمه بشوند یا لیسانسه، اصلاً آدم نوع جدیدی خواهند شد. آدمی انباشته از وحشت، انبانی از ترس Ùˆ دلهره. به این ترتیب یک روز بیشتر دوام نیاوردم. چون دیدم نمی‌توانم قلب بچگانه‌ای داشته باشم تا با آن ترس Ùˆ وحشت بچه‌ها را درک کنم Ùˆ هم‌دردی نشان بدهم.این جور بود Ú©Ù‡ می‌دیدم Ú©Ù‡ معلم مدرسه هم نمی‌توانم باشم. + +دو روز قبل از عید کارنامه‌ها آماده بود Ùˆ منتظر امضای مدیر. دویست Ùˆ سی Ùˆ شش تا امضا اقلاً تا ظهر طول می‌کشید. پیش از آن هم تا می‌توانستم از امضای دÙترهای حضور Ùˆ غیاب می‌گریختم. خیلی از جیره‌خورهای دولت در ادارات دیگر یا در میان همکارانم دیده بودم Ú©Ù‡ در مواقع بیکاری تمرین امضا می‌کنند. پیش از آن نمی‌توانستم بÙهمم Ú†Ù‡ طور از مدیری یک مدرسه یا کارمندی ساده یک اداره می‌شود به وزارت رسید. یا اصلاً آرزویش را داشت. نیم‌قراضه امضای آماده Ùˆ هر کدام معر٠یک شخصیت، بعد نیم‌ذرع زبان چرب Ùˆ نرم Ú©Ù‡ با آن، مار را از سوراخ بیرون بکشی، یا همه جا را بلیسی Ùˆ یک دست هم قیاÙÙ‡. نه یک جور. دوازده جور. + +در این Ùکرها بودم Ú©Ù‡ ناگهان در میان کارنامه‌ها چشمم به یک اسم آشنا اÙتاد. به اسم پسران جناب سرهنگ Ú©Ù‡ رئیس انجمن بود. رÙتم توی نخ نمراتش. همه متوسط بود Ùˆ جای ایرادی نبود. Ùˆ یک مرتبه به صراÙت اÙتادم Ú©Ù‡ از اول سال تا به حال بچه‌های مدرسه را Ùقط به اعتبار وضع مالی پدرشان قضاوت کرده‌ام. درست مثل این پسر سرهنگ Ú©Ù‡ به اعتبار کیابیای پدرش درس نمی‌خواند. دیدم هر کدام Ú©Ù‡ پدرشان Ùقیرتر است به نظر من باهوش‌تر می‌آمده‌اند. البته ناظم با این حرÙ‌ها کاری نداشت. مر قانونی را عمل می‌کرد. از یکی چشم می‌پوشید به دیگری سخت می‌گرÙت. + +اما من مثل این Ú©Ù‡ قضاوتم را درباره‌ی بچه‌ها از پیش کرده باشم Ùˆ Ú†Ù‡ خوب بود Ú©Ù‡ نمره‌ها در اختیار من نبود Ùˆ آن یکی هم «انظباط» مال آخر سال بود. مسخره‌ترین کارها آن است Ú©Ù‡ کسی به اصلاح وضعی دست بزند، اما در قلمروی Ú©Ù‡ تا سر دماغش بیشتر نیست. Ùˆ تازه مدرسه‌ی من، این قلمروی Ùعالیت من، تا سر دماغم هم نبود. به همان توی ذهنم ختم می‌شد. وضعی را Ú©Ù‡ دیگران ترتیب داده بودند. به این ترتیب بعد از پنج شش ماه، می‌Ùهمیدم Ú©Ù‡ حسابم یک حساب عقلایی نبوده است. احساساتی بوده است. ضعÙ‌های احساساتی مرا خشونت‌های عملی ناظم جبران می‌کرد Ùˆ این بود Ú©Ù‡ جمعاً نمی‌توانستم ازو بگذرم. مرد عمل بود. کار را می‌برید Ùˆ پیش می‌رÙت. در زندگی Ùˆ در هر کاری، هر قدمی بر می‌داشت، برایش هد٠بود. Ùˆ چشم از وجوه دیگر قضیه می‌پوشید. این بود Ú©Ù‡ برش داشت. Ùˆ من نمی‌توانستم. چرا Ú©Ù‡ اصلاً مدیر نبودم. خلاص... + +Ùˆ کارنامه‌ی پسر سرهنگ را Ú©Ù‡ زیر دستم عرق کرده بود، به دقت Ùˆ احتیاج خشک کردم Ùˆ امضایی زیر آن گذاشتم به قدری بد خط Ùˆ مسخره بود Ú©Ù‡ به یاد امضای Ùراش جدیدمان اÙتادم. حتماً جناب سرهنگ کلاÙÙ‡ می‌شد Ú©Ù‡ چرا چنین آدم بی‌سوادی را با این خط Ùˆ ربط امضا مدیر مدرسه کرده‌اند. آخر یک جناب سرهنگ هم می‌داند Ú©Ù‡ امضای آدم معر٠شخصیت آدم است. + +اواخر تعطیلات نوروز رÙتم به ملاقات معلم ترکه‌ای کلاس سوم. ناظم Ú©Ù‡ با او میانه‌ی خوشی نداشت. ناچار با معلم حساب کلاس پنج Ùˆ شش قرار Ùˆ مداری گذاشته بودم Ú©Ù‡ مختصری علاقه‌ای هم به آن حر٠و سخن‌ها داشت. هم به وسیله‌ی او بود Ú©Ù‡ می‌دانستم نشانی‌اش کجا است Ùˆ توی کدام زندان است. در راه قبل از هر چیز خبر داد Ú©Ù‡ رئیس Ùرهنگ عوض شده Ùˆ این طور Ú©Ù‡ شایع است یکی از هم دوره‌ای‌های من، جایش آمده. Ú¯Ùتم: + +- عجب! چرا؟ Ù…Ú¯Ù‡ رئیس قبلی چپش Ú©Ù… بود؟ + +- Ú†Ù‡ عرض کنم. می‌گند پا تو Ú©ÙØ´ یکی از نماینده‌ها کرده. شما خبر ندارید؟ + +- Ú†Ù‡ طور؟ از کجا خبر داشته باشم؟ + +- هیچ Ú†ÛŒ... Ù…ÛŒ گند دو تا از کارچاق‌کن‌های انتخاباتی یارو از صندوق Ùرهنگ حقوق می‌گرÙته‌اند؛ شب عیدی رئیس Ùرهنگ حقوق‌شون رو زده. + +- عجب! پس اونم می‌خواسته اصلاحات کنه! بیچاره. + +Ùˆ بعد از این حر٠زدیم Ú©Ù‡ الحمدالله مدرسه مرتب است Ùˆ آرام Ùˆ معلم‌ها همکاری می‌کنند Ùˆ ناظم بیش از اندازه همه‌کاره شده است. Ùˆ من Ùهمیدم Ú©Ù‡ باز لابد مشتری خصوصی تازه‌ای پیدا شده است Ú©Ù‡ سر Ùˆ صدای همه همکارها بلند شده. دم در زندان شلوغ بود. کلاه مخملی‌ها، عم‌قزی گل‌بته‌ها، خاله خانباجی‌ها Ùˆ... اسم نوشتیم Ùˆ نوبت گرÙتیم Ùˆ به جای پاها، دست‌هامان زیر بار Ú©ÙˆÚ†Ú©ÛŒ Ú©Ù‡ داشتیم، خسته شد Ùˆ خواب رÙت تا نوبتمان شد. از این اتاق به آن اتاق Ùˆ عاقبت نرده‌های آهنی Ùˆ پشت آن معلم کلاس سه Ùˆ... عجب چاق شده بود!درست مثل یک آدم حسابی شده بود. خوشحال شدیم Ùˆ احوالپرسی Ùˆ تشکر؛ Ùˆ دیگر Ú†Ù‡ بگویم؟ بگویم چرا خودت را به دردسر انداختی؟ پیدا بود از مدرسه Ùˆ کلاس به او خوش‌تر می‌گذرد. ایمانی بود Ùˆ او آن را داشت Ùˆ خوشبخت بود Ùˆ دردسری نمی‌دید Ùˆ زندان حداقل برایش کلاس درس بود. عاقبت پرسیدم: + +- پرونده‌ای هم برات درست کردند یا هنوز بلاتکلیÙی؟ + +- امتحانمو دادم آقا مدیر، بد از آب در نیومد. + +- یعنی چه؟ + +- یعنی بی‌تکلی٠نیستم. چون اسمم تو لیست جیره‌ی زندون رÙته. خیالم راحته. چون سختی‌هاش گذشته. + +دیگر Ú†Ù‡ بگویم. دیدم چیزی ندارم خداحاÙظی کردم Ùˆ او را با معلم حساب تنها گذاشتم Ùˆ آمدم بیرون Ùˆ تا مدت ملاقات تمام بشود، دم در زندان قدم زدم Ùˆ به زندانی Ùکر کردم Ú©Ù‡ برای خودم ساخته بودم. یعنی آن خرپول Ùرهنگ‌دوست ساخته بود. Ùˆ من به میل Ùˆ رغبت خودم را در آن زندانی کرده بودم. این یکی را به ضرب دگنک این جا آورده بودند. ناچار حق داشت Ú©Ù‡ خیالش راحت باشد. اما من به میل Ùˆ رغبت رÙته بودم Ùˆ Ú†Ù‡ بکنم؟ ناظم Ú†Ù‡ طور؟ راستی اگر رئیس Ùرهنگ از هم دوره‌ای‌های خودم باشد؛ Ú†Ù‡ طور است بروم Ùˆ ازو بخواهم Ú©Ù‡ ناظم را جای من بگذارد، یا همین معلم حساب را؟... Ú©Ù‡ معلم حساب در آمد Ùˆ راه اÙتادیم. با او هم دیگر حرÙÛŒ نداشتم. سر پیچ خداحاÙظ شما Ùˆ تاکسی گرÙتم Ùˆ یک سر به اداره‌ی Ùرهنگ زدم. گرچه دهم عید بود، اما هنوز رÙت Ùˆ آمد سال نو تمام نشده بود. برو Ùˆ بیا Ùˆ شیرینی Ùˆ چای دو جانبه. رÙتم تو. سلام Ùˆ تبریک Ùˆ همین تعارÙات را پراندم. + +بله خودش بود. یکی از پخمه‌های کلاس. Ú©Ù‡ آخر سال سوم کشتیارش شدم دو بیت شعر را Ø­Ùظ کند، نتوانست Ú©Ù‡ نتوانست. Ùˆ حالا او رئیس بود Ùˆ من آقا مدیر. راستی حی٠از من، Ú©Ù‡ حتی وزیر چنین رئیس Ùرهنگ‌هایی باشم! میز همان طور پاک بود Ùˆ رÙته. اما زیرسیگاری انباشته از خاکستر Ùˆ ته سیگار. بلند شد Ùˆ چلپ Ùˆ چولوپ روبوسی کردیم Ùˆ پهلوی خودش جا باز کرد Ùˆ گوش تا گوش جیره‌خورهای Ùرهنگ تبریکات صمیمانه Ùˆ بدگویی از ماسبق Ùˆ هندوانه Ùˆ پیزرها! Ùˆ دو Ù†Ùر Ú©Ù‡ قد Ùˆ قواره‌شان به درد گود زورخانه می‌خورد یا پای صندوق انتخابات شیرینی به مردم می‌دادند. نزدیک بود شیرینی را توی ظرÙØ´ بیندازم Ú©Ù‡ دیدم بسیار احمقانه است. سیگارم Ú©Ù‡ تمام شد قضیه‌ی رئیس Ùرهنگ قبلی Ùˆ آن دو Ù†Ùر را در گوشی ازش پرسیدم، حرÙÛŒ نزد. Ùقط نگاهی می‌کرد Ú©Ù‡ شبیه التماس بود Ùˆ من Ùرصت جستم تا وضع معلم کلاس سوم را برایش روشن کنم Ùˆ از او بخواهم تا آن جا Ú©Ù‡ می‌تواند جلوی حقوقش را نگیرد. Ùˆ از در Ú©Ù‡ آمدم بیرون، تازه یادم آمد Ú©Ù‡ برای کار دیگری پیش رئیس Ùرهنگ بودم. + +باز دیروز اÙتضاحی به پا شد. معقول یک ماهه‌ی Ùروردین راحت بودیم. اول اردیبهشت ماه جلالی Ùˆ کوس رسوایی سر دیوار مدرسه. نزدیک آخر وقت یک جÙت پدر Ùˆ مادر، بچه‌شان در میان، وارد اتاق شدند. یکی بر اÙروخته Ùˆ دیگری رنگ Ùˆ رو باخته Ùˆ بچه‌شان عیناً مثل این عروسک‌های Ú©ÙˆÚ©ÛŒ. سلام Ùˆ علیک Ùˆ نشستند. خدایا دیگر Ú†Ù‡ اتÙاقی اÙتاده است؟ + +- Ú†Ù‡ خبر شده Ú©Ù‡ با خانوم سراÙرازمون کردید؟ + +مرد اشاره‌ای به زنش کرد Ú©Ù‡ بلند شد Ùˆ دست بچه را گرÙت Ùˆ رÙت بیرون Ùˆ من ماندم Ùˆ پدر. اما حر٠نمی‌زد. به خودش Ùرصت می‌داد تا عصبانیتش بپزد. سیگارم را در آوردم Ùˆ تعارÙØ´ کردم. مثل این Ú©Ù‡ مگس مزاحمی را از روی دماغش بپراند، سیگار را رد کرد Ùˆ من Ú©Ù‡ سیگارم را آتش می‌زدم، Ùکر کردم لابد دردی دارد Ú©Ù‡ چنین دست Ùˆ پا بسته Ùˆ چنین متکی به خانواده به مدرسه آمده. باز پرسیدم: + +- خوب، حالا Ú†Ù‡ Ùرمایش داشتید؟ + +Ú©Ù‡ یک مرتبه ترکید: + +- اگه من مدیر مدرسه بودم Ùˆ هم‌چه اتÙاقی می‌اÙتاد، شیکم خودمو پاره می‌کردم. خجالت بکش مرد! برو استعÙا بده. تا اهل محل نریختن تیکه تیکه‌ات کنند، دو تا گوشتو وردار Ùˆ دررو. بچه‌های مردم می‌آن این جا درس بخونن Ùˆ حسن اخلاق. نمی‌آن Ú©Ù‡... + +- این مزخرÙات کدومه آقا! حر٠حساب سرکار چیه؟ + +Ùˆ حرکتی کردم Ú©Ù‡ او را از در بیندازم بیرون. اما آخر باید می‌Ùهمیدم Ú†Ù‡ مرگش است. «ولی آخر با من Ú†Ù‡ کار دارد؟» + +- آبروی من رÙته. آبروی صد ساله‌ی خونواده‌ام رÙته. اگه در مدرسه‌ی تو رو تخته نکنم، تخم بابام نیستم. آخه من دیگه با این بچه Ú†ÛŒ کار کنم؟ تو این مدرسه ناموس مردم در خطره. کلانتری Ùهمیده؛ پزشک قانونی Ùهمیده؛ یک پرونده درست شده پنجاه ورق؛ تازه می‌گی حر٠حسابم چیه؟ حر٠حسابم اینه Ú©Ù‡ صندلی Ùˆ این مقام از سر تو زیاده. حر٠حسابم اینه Ú©Ù‡ می‌دم محاکمه‌ات کنند Ùˆ از نون خوردن بندازنت... + +او می‌گÙت Ùˆ من گوش می‌کردم Ùˆ مثل دو تا سگ هار به جان هم اÙتاده بودیم Ú©Ù‡ در باز شد Ùˆ ناظم آمد تو. به دادم رسید. در همان حال Ú©Ù‡ من Ùˆ پدر بچه در حال دعوا بودیم زن Ùˆ بچه همان آقا رÙته بودند Ùˆ قضایا را برای ناظم تعری٠کرده بودند Ùˆ او Ùرستاده بوده Ùاعل را از کلاس کشیده بودند بیرون... Ùˆ Ú¯Ùت Ú†Ù‡ طور است زنگ بزنیم Ùˆ جلوی بچه‌ها ادبش کنیم Ùˆ کردیم. یعنی این بار خود من رÙتم میدان. پسرک نره‌خری بود از پنجمی‌ها با لباس مرتب Ùˆ صورت سرخ Ùˆ سÙید Ùˆ سالکی به گونه. جلوی روی بچه‌ها کشیدمش زیر مشت Ùˆ لگد Ùˆ بعد سه تا از ترکه‌ها را Ú©Ù‡ Ùراش جدید Ùوری از باغ همسایه آورده بود، به سر Ùˆ صورتش خرد کردم. چنان وحشی شده بودم Ú©Ù‡ اگر ترکه‌ها نمی‌رسید، پسرک را کشته بودم. این هم بود Ú©Ù‡ ناظم به دادش رسید Ùˆ وساطت کرد Ùˆ لاشه‌اش را توی دÙتر بردند Ùˆ بچه‌ها را مرخص کردند Ùˆ من به اتاقم برگشتم Ùˆ با حالی زار روی صندلی اÙتادم، نه از پدر خبری بود Ùˆ نه از مادر Ùˆ نه از عروسک‌های کوکی‌شان Ú©Ù‡ ناموسش دست کاری شده بود. Ùˆ تازه احساس کردم Ú©Ù‡ این کتک‌کاری را باید به او می‌زدم. خیس عرق بودم Ùˆ دهانم تلخ بود. تمام Ùحش‌هایی Ú©Ù‡ می‌بایست به آن مردکه‌ی دبنگ می‌دادم Ùˆ نداده بودم، در دهانم رسوب کرده بود Ùˆ مثل دم مار تلخ شده بود. اصلاً چرا زدمش؟ چرا نگذاشتم مثل همیشه ناظم میدان‌داری کند Ú©Ù‡ هم کارکشته‌تر بود Ùˆ هم خونسردتر. لابد پسرک با دخترعمه‌اش هم نمی‌تواند بازی کند. لابد توی خانواده‌شان، دخترها سر ده دوازده سالگی باید از پسرهای هم سن رو بگیرند. نکند عیبی کرده باشد؟ Ùˆ یک مرتبه به صراÙت اÙتادم Ú©Ù‡ بروم ببینم Ú†Ù‡ بلایی به سرش آورده‌ام. بلند شدم Ùˆ یکی از Ùراش‌ها را صدا کردم Ú©Ù‡ Ùهمیدم روانه‌اش کرده‌اند. آبی آورد Ú©Ù‡ روی دستم می‌ریخت Ùˆ صورتم را می‌شستم Ùˆ می‌کوشیدم Ú©Ù‡ لرزش دست‌هایم را نبیند. Ùˆ در گوشم آهسته Ú¯Ùت Ú©Ù‡ پسر مدیر شرکت اتوبوسرانی است Ùˆ بدجوری کتک خورده Ùˆ آن‌ها خیلی سعی کرده‌اند Ú©Ù‡ تر Ùˆ تمیزش کنند... + +احمق مثلا داشت توی دل مرا خالی می‌کرد. نمی‌دانست Ú©Ù‡ من اول تصمیم را گرÙتم، بعد مثل سگ هار شدم. Ùˆ تازه می‌Ùهمیدم کسی را زده‌ام Ú©Ù‡ لیاقتش را داشته. حتماً از این اتÙاق‌ها جای دیگر هم می‌اÙتد. آدم بردارد پایین تنه بچه‌ی خودش را، یا به قول خودش ناموسش را بگذارد سر گذر Ú©Ù‡ کلانتر محل Ùˆ پزشک معاینه کنند! تا پرونده درست کنند؟ با این پدرو مادرها بچه‌ها حق دارند Ú©Ù‡ قرتی Ùˆ دزد Ùˆ دروغگو از آب در بیایند. این مدرسه‌ها را اول برای پدر Ùˆ مادرها باز کنند... + +با این اÙکار به خانه رسیدم. زنم در را Ú©Ù‡ باز کرد؛ چشم‌هایش گرد شد. همیشه وقتی می‌ترسد این طور می‌شود. برای اینکه خیال نکند آدم کشته‌ام، زود قضایا را برایش Ú¯Ùتم. Ùˆ دیدم Ú©Ù‡ در ماند. یعنی ساکت ماند. آب سرد، عرق بیدمشک، سیگار پشت سیگار Ùایده نداشت، لقمه از گلویم پایین نمی‌رÙت Ùˆ دست‌ها هنوز می‌لرزید. هر کدام به اندازه‌ی یک ماه Ùعالیت کرده بودند. با سیگار چهارم شروع کردم: + +- می‌دانی زن؟ بابای یارو پول‌داره. مسلماً کار به دادگستری Ùˆ این جور خنس‌ها می‌کشه. مدیریت Ú©Ù‡ الÙاتحه. اما خیلی دلم می‌خواد قضیه به دادگاه برسه. یک سال آزگار رو دل کشیده‌ام Ùˆ دیگه خسته شده‌ام. دلم می‌خواد یکی بپرسه چرا بچه‌ی مردم رو این طوری زدی، چرا تنبیه بدنی کردی! آخه یک مدیر مدرسه هم حرÙ‌هایی داره Ú©Ù‡ باید یک جایی بزنه... + +Ú©Ù‡ بلند شد Ùˆ رÙت سراغ تلÙÙ†. دو سه تا از دوستانم را Ú©Ù‡ در دادگستری کاره‌ای بودند، گرÙت Ùˆ خودم قضیه را برایشان Ú¯Ùتم Ú©Ù‡ مواظب باشند. Ùردا پسرک Ùاعل به مدرسه نیامده بود. Ùˆ ناظم برایم Ú¯Ùت Ú©Ù‡ قضیه ازین قرار بوده است Ú©Ù‡ دوتایی به هوای دیدن مجموعه تمبرهای Ùاعل با هم به خانه‌ای می‌روند Ùˆ قضایا همان جا اتÙاق می‌اÙتد Ùˆ داد Ùˆ هوار Ùˆ دخالت پدر Ùˆ مادرهای طرÙین Ùˆ خط Ùˆ نشان Ùˆ شبانه کلانتری؛ Ùˆ تمام اهل محل خبر دارند. او هم نظرش این بود Ú©Ù‡ کار به دادگستری خواهد کشید. + +Ùˆ من یک Ù‡Ùته‌ی تمام به انتظار اخطاریه‌ی دادگستری صبح Ùˆ عصر به مدرسه رÙتم Ùˆ مثل بخت‌النصر پشت پنجره ایستادم. اما در تمام این مدت نه از Ùاعل خبری شد، نه از Ù…Ùعول Ùˆ نه از پدر Ùˆ مادر ناموس‌پرست Ùˆ نه از مدیر شرکت اتوبوسرانی. انگار نه انگار Ú©Ù‡ اتÙاقی اÙتاده. بچه‌ها می‌آمدند Ùˆ می‌رÙتند؛ برای آب خوردن عجله می‌کردند؛ به جای بازی کتک‌کاری می‌کردند Ùˆ همه چیز مثل قبل بود. Ùقط من ماندم Ùˆ یک دنیا حر٠و انتظار. تا عاقبت رسید.... احضاریه‌ای با تعیین وقت قبلی برای دو روز بعد، در Ùلان شعبه Ùˆ پیش Ùلان بازپرس دادگستری. آخر کسی پیدا شده بود Ú©Ù‡ به حرÙÙ… گوش کند. + +تا دو روز بعد Ú©Ù‡ موعد احضار بود، اصلاً از خانه در نیامدم. نشستم Ùˆ ماحصل حرÙ‌هایم را روی کاغذ آوردم. حرÙ‌هایی Ú©Ù‡ با همه‌ی چرندی هر وزیر Ùرهنگی می‌توانست با آن یک برنامه‌ی Ù‡Ùت ساله برای کارش بریزد. Ùˆ سر ساعت معین رÙتم دادگستری. اتاق معین Ùˆ بازپرس معین. در را باز کردم Ùˆ سلام، Ùˆ تا آمدم خودم را معرÙÛŒ کنم Ùˆ احضاریه را در بیاورم، یارو پیش‌دستی کرد Ùˆ صندلی آورد Ùˆ چای سÙارش داد Ùˆ «احتیاجی به این حرÙ‌ها نیست Ùˆ قضیه‌ی Ú©ÙˆÚ†Ú© بود Ùˆ حل شد Ùˆ راضی به زحمت شما نبودیم...» + +Ú©Ù‡ عرق سرد بر بدن من نشست. چایی‌ام را Ú©Ù‡ خوردم، روی همان کاغذ نشان‌دار دادگستری استعÙانامه‌ام را نوشتم Ùˆ به نام هم‌کلاسی پخمه‌ام Ú©Ù‡ تازه رئیس شده بود، دم در پست کردم. +EOT; +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/Address.php new file mode 100644 index 0000000..8e0829e --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/Address.php @@ -0,0 +1,85 @@ +format('dmy'); + + switch ((int)($birthdate->format('Y')/100)) { + case 18: + $centurySign = '+'; + break; + case 19: + $centurySign = '-'; + break; + case 20: + $centurySign = 'A'; + break; + default: + throw new \InvalidArgumentException('Year must be between 1800 and 2099 inclusive.'); + } + + $randomDigits = self::numberBetween(0, 89); + if ($gender && $gender == static::GENDER_MALE) { + if ($randomDigits === 0) { + $randomDigits .= static::randomElement(array(3,5,7,9)); + } else { + $randomDigits .= static::randomElement(array(1,3,5,7,9)); + } + } elseif ($gender && $gender == static::GENDER_FEMALE) { + if ($randomDigits === 0) { + $randomDigits .= static::randomElement(array(2,4,6,8)); + } else { + $randomDigits .= static::randomElement(array(0,2,4,6,8)); + } + } else { + if ($randomDigits === 0) { + $randomDigits .= self::numberBetween(2, 9); + } else { + $randomDigits .= (string)static::numerify('#'); + } + } + $randomDigits = str_pad($randomDigits, 3, '0', STR_PAD_LEFT); + + $checksum = $checksumCharacters[(int)($datePart . $randomDigits) % strlen($checksumCharacters)]; + + return $datePart . $centurySign . $randomDigits . $checksum; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/PhoneNumber.php new file mode 100644 index 0000000..a323074 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fi_FI/PhoneNumber.php @@ -0,0 +1,99 @@ + 'Argovie'), + array('AI' => 'Appenzell Rhodes-Intérieures'), + array('AR' => 'Appenzell Rhodes-Extérieures'), + array('BE' => 'Berne'), + array('BL' => 'Bâle-Campagne'), + array('BS' => 'Bâle-Ville'), + array('FR' => 'Fribourg'), + array('GE' => 'Genève'), + array('GL' => 'Glaris'), + array('GR' => 'Grisons'), + array('JU' => 'Jura'), + array('LU' => 'Lucerne'), + array('NE' => 'Neuchâtel'), + array('NW' => 'Nidwald'), + array('OW' => 'Obwald'), + array('SG' => 'Saint-Gall'), + array('SH' => 'Schaffhouse'), + array('SO' => 'Soleure'), + array('SZ' => 'Schwytz'), + array('TG' => 'Thurgovie'), + array('TI' => 'Tessin'), + array('UR' => 'Uri'), + array('VD' => 'Vaud'), + array('VS' => 'Valais'), + array('ZG' => 'Zoug'), + array('ZH' => 'Zurich') + ); + + protected static $cityFormats = array( + '{{cityName}}', + ); + + protected static $streetNameFormats = array( + '{{streetPrefix}} {{lastName}}', + '{{streetPrefix}} de {{cityName}}', + '{{streetPrefix}} de {{lastName}}' + ); + + protected static $streetAddressFormats = array( + '{{streetName}} {{buildingNumber}}', + ); + protected static $addressFormats = array( + "{{streetAddress}}\n{{postcode}} {{city}}", + ); + + /** + * Returns a random street prefix + * @example Rue + * @return string + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Returns a random city name. + * @example Luzern + * @return string + */ + public function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Returns a canton + * @example array('BE' => 'Bern') + * @return array + */ + public static function canton() + { + return static::randomElement(static::$canton); + } + + /** + * Returns the abbreviation of a canton. + * @return string + */ + public static function cantonShort() + { + $canton = static::canton(); + return key($canton); + } + + /** + * Returns the name of canton. + * @return string + */ + public static function cantonName() + { + $canton = static::canton(); + return current($canton); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fr_CH/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/fr_CH/Company.php new file mode 100644 index 0000000..a4e91ea --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fr_CH/Company.php @@ -0,0 +1,15 @@ + 'Ain'), array('02' => 'Aisne'), array('03' => 'Allier'), array('04' => 'Alpes-de-Haute-Provence'), array('05' => 'Hautes-Alpes'), + array('06' => 'Alpes-Maritimes'), array('07' => 'Ardèche'), array('08' => 'Ardennes'), array('09' => 'Ariège'), array('10' => 'Aube'), + array('11' => 'Aude'), array('12' => 'Aveyron'), array('13' => 'Bouches-du-Rhône'), array('14' => 'Calvados'), array('15' => 'Cantal'), + array('16' => 'Charente'), array('17' => 'Charente-Maritime'), array('18' => 'Cher'), array('19' => 'Corrèze'), array('2A' => 'Corse-du-Sud'), + array('2B' => 'Haute-Corse'), array('21' => "Côte-d'Or"), array('22' => "Côtes-d'Armor"), array('23' => 'Creuse'), array('24' => 'Dordogne'), + array('25' => 'Doubs'), array('26' => 'Drôme'), array('27' => 'Eure'), array('28' => 'Eure-et-Loir'), array('29' => 'Finistère'), array('30' => 'Gard'), + array('31' => 'Haute-Garonne'), array('32' => 'Gers'), array('33' => 'Gironde'), array('34' => 'Hérault'), array('35' => 'Ille-et-Vilaine'), + array('36' => 'Indre'), array('37' => 'Indre-et-Loire'), array('38' => 'Isère'), array('39' => 'Jura'), array('40' => 'Landes'), array('41' => 'Loir-et-Cher'), + array('42' => 'Loire'), array('43' => 'Haute-Loire'), array('44' => 'Loire-Atlantique'), array('45' => 'Loiret'), array('46' => 'Lot'), + array('47' => 'Lot-et-Garonne'), array('48' => 'Lozère'), array('49' => 'Maine-et-Loire'), array('50' => 'Manche'), array('51' => 'Marne'), + array('52' => 'Haute-Marne'), array('53' => 'Mayenne'), array('54' => 'Meurthe-et-Moselle'), array('55' => 'Meuse'), array('56' => 'Morbihan'), + array('57' => 'Moselle'), array('58' => 'Nièvre'), array('59' => 'Nord'), array('60' => 'Oise'), array('61' => 'Orne'), array('62' => 'Pas-de-Calais'), + array('63' => 'Puy-de-Dôme'), array('64' => 'Pyrénées-Atlantiques'), array('65' => 'Hautes-Pyrénées'), array('66' => 'Pyrénées-Orientales'), + array('67' => 'Bas-Rhin'), array('68' => 'Haut-Rhin'), array('69' => 'Rhône'), array('70' => 'Haute-Saône'), array('71' => 'Saône-et-Loire'), + array('72' => 'Sarthe'), array('73' => 'Savoie'), array('74' => 'Haute-Savoie'), array('75' => 'Paris'), array('76' => 'Seine-Maritime'), + array('77' => 'Seine-et-Marne'), array('78' => 'Yvelines'), array('79' => 'Deux-Sèvres'), array('80' => 'Somme'), array('81' => 'Tarn'), + array('82' => 'Tarn-et-Garonne'), array('83' => 'Var'), array('84' => 'Vaucluse'), array('85' => 'Vendée'), array('86' => 'Vienne'), + array('87' => 'Haute-Vienne'), array('88' => 'Vosges'), array('89' => 'Yonne'), array('90' => 'Territoire de Belfort'), array('91' => 'Essonne'), + array('92' => 'Hauts-de-Seine'), array('93' => 'Seine-Saint-Denis'), array('94' => 'Val-de-Marne'), array('95' => "Val-d'Oise"), + array('971' => 'Guadeloupe'), array('972' => 'Martinique'), array('973' => 'Guyane'), array('974' => 'La Réunion'), array('976' => 'Mayotte') + ); + + protected static $secondaryAddressFormats = array('Apt. ###', 'Suite ###', 'Étage ###', "Bât. ###", "Chambre ###"); + + /** + * @example 'Appt. 350' + */ + public static function secondaryAddress() + { + return static::numerify(static::randomElement(static::$secondaryAddressFormats)); + } + + /** + * @example 'rue' + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Randomly returns a french region. + * + * @example 'Guadeloupe' + * + * @return string + */ + public static function region() + { + return static::randomElement(static::$regions); + } + + /** + * Randomly returns a french department ('departmentNumber' => 'departmentName'). + * + * @example array('2B' => 'Haute-Corse') + * + * @return array + */ + public static function department() + { + return static::randomElement(static::$departments); + } + + /** + * Randomly returns a french department name. + * + * @example 'Ardèche' + * + * @return string + */ + public static function departmentName() + { + $randomDepartmentName = array_values(static::department()); + + return $randomDepartmentName[0]; + } + + /** + * Randomly returns a french department number. + * + * @example '59' + * + * @return string + */ + public static function departmentNumber() + { + $randomDepartmentNumber = array_keys(static::department()); + + return $randomDepartmentNumber[0]; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Company.php new file mode 100644 index 0000000..9112802 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Company.php @@ -0,0 +1,476 @@ +generator->parse($format)); + + if ($this->isCatchPhraseValid($catchPhrase)) { + break; + } + } while (true); + + return $catchPhrase; + } + + /** + * Generates a siret number (14 digits) that passes the Luhn check. + * + * @see http://fr.wikipedia.org/wiki/Syst%C3%A8me_d'identification_du_r%C3%A9pertoire_des_%C3%A9tablissements + * @return string + */ + public function siret($formatted = true) + { + $siret = self::siren(false); + $nicFormat = static::randomElement(static::$siretNicFormats); + $siret .= $this->numerify($nicFormat); + $siret .= Luhn::computeCheckDigit($siret); + if ($formatted) { + $siret = substr($siret, 0, 3) . ' ' . substr($siret, 3, 3) . ' ' . substr($siret, 6, 3) . ' ' . substr($siret, 9, 5); + } + + return $siret; + } + + /** + * Generates a siren number (9 digits) that passes the Luhn check. + * + * @see http://fr.wikipedia.org/wiki/Syst%C3%A8me_d%27identification_du_r%C3%A9pertoire_des_entreprises + * @return string + */ + public static function siren($formatted = true) + { + $siren = self::numerify('%#######'); + $siren .= Luhn::computeCheckDigit($siren); + if ($formatted) { + $siren = substr($siren, 0, 3) . ' ' . substr($siren, 3, 3) . ' ' . substr($siren, 6, 3); + } + + return $siren; + } + + /** + * @var array An array containing string which should not appear twice in a catch phrase. + */ + protected static $wordsWhichShouldNotAppearTwice = array('sécurité', 'simpl'); + + /** + * Validates a french catch phrase. + * + * @param string $catchPhrase The catch phrase to validate. + * + * @return boolean (true if valid, false otherwise) + */ + protected static function isCatchPhraseValid($catchPhrase) + { + foreach (static::$wordsWhichShouldNotAppearTwice as $word) { + // Fastest way to check if a piece of word does not appear twice. + $beginPos = strpos($catchPhrase, $word); + $endPos = strrpos($catchPhrase, $word); + + if ($beginPos !== false && $beginPos != $endPos) { + return false; + } + } + + return true; + } + + /** + * @link http://www.pole-emploi.fr/candidat/le-code-rome-et-les-fiches-metiers-@/article.jspz?id=60702 + * @note Randomly took 300 from this list + */ + protected static $jobTitleFormat = array( + 'Agent d\'accueil', + 'Agent d\'enquêtes', + 'Agent d\'entreposage', + 'Agent de curage', + 'Agro-économiste', + 'Aide couvreur', + 'Aide à domicile', + 'Aide-déménageur', + 'Ambassadeur', + 'Analyste télématique', + 'Animateur d\'écomusée', + 'Animateur web', + 'Appareilleur-gazier', + 'Archéologue', + 'Armurier d\'art', + 'Armurier spectacle', + 'Artificier spectacle', + 'Artiste dramatique', + 'Aspigiculteur', + 'Assistant de justice', + 'Assistant des ventes', + 'Assistant logistique', + 'Assistant styliste', + 'Assurance', + 'Auteur-adaptateur', + 'Billettiste voyages', + 'Brigadier', + 'Bruiteur', + 'Bâtonnier d\'art', + 'Bûcheron', + 'Cameraman', + 'Capitaine de pêche', + 'Carrier', + 'Caviste', + 'Chansonnier', + 'Chanteur', + 'Chargé de recherche', + 'Chasseur-bagagiste', + 'Chef de fabrication', + 'Chef de scierie', + 'Chef des ventes', + 'Chef du personnel', + 'Chef géographe', + 'Chef monteur son', + 'Chef porion', + 'Chiropraticien', + 'Choréologue', + 'Chromiste', + 'Cintrier-machiniste', + 'Clerc hors rang', + 'Coach sportif', + 'Coffreur béton armé', + 'Coffreur-ferrailleur', + 'Commandant de police', + 'Commandant marine', + 'Commis de coupe', + 'Comptable unique', + 'Conception et études', + 'Conducteur de jumbo', + 'Conseiller culinaire', + 'Conseiller funéraire', + 'Conseiller relooking', + 'Consultant ergonome', + 'Contrebassiste', + 'Convoyeur garde', + 'Copiste offset', + 'Corniste', + 'Costumier-habilleur', + 'Coutelier d\'art', + 'Cueilleur de cerises', + 'Céramiste concepteur', + 'Danse', + 'Danseur', + 'Data manager', + 'Dee-jay', + 'Designer produit', + 'Diététicien conseil', + 'Diététique', + 'Doreur sur métaux', + 'Décorateur-costumier', + 'Défloqueur d\'amiante', + 'Dégustateur', + 'Délégué vétérinaire', + 'Délégué à la tutelle', + 'Désamianteur', + 'Détective', + 'Développeur web', + 'Ecotoxicologue', + 'Elagueur-botteur', + 'Elagueur-grimpeur', + 'Elastiqueur', + 'Eleveur d\'insectes', + 'Eleveur de chats', + 'Eleveur de volailles', + 'Embouteilleur', + 'Employé d\'accueil', + 'Employé d\'étage', + 'Employé de snack-bar', + 'Endivier', + 'Endocrinologue', + 'Epithésiste', + 'Essayeur-retoucheur', + 'Etainier', + 'Etancheur', + 'Etancheur-bardeur', + 'Etiqueteur', + 'Expert back-office', + 'Exploitant de tennis', + 'Extraction', + 'Facteur', + 'Facteur de clavecins', + 'Facteur de secteur', + 'Fantaisiste', + 'Façadier-bardeur', + 'Façadier-ravaleur', + 'Feutier', + 'Finance', + 'Flaconneur', + 'Foreur pétrole', + 'Formateur d\'italien', + 'Fossoyeur', + 'Fraiseur', + 'Fraiseur mouliste', + 'Frigoriste maritime', + 'Fromager', + 'Galeriste', + 'Gardien de résidence', + 'Garçon de chenil', + 'Garçon de hall', + 'Gendarme mobile', + 'Guitariste', + 'Gynécologue', + 'Géodésien', + 'Géologue prospecteur', + 'Géomètre', + 'Géomètre du cadastre', + 'Gérant d\'hôtel', + 'Gérant de tutelle', + 'Gériatre', + 'Hydrothérapie', + 'Hématologue', + 'Hôte de caisse', + 'Ingénieur bâtiment', + 'Ingénieur du son', + 'Ingénieur géologue', + 'Ingénieur géomètre', + 'Ingénieur halieute', + 'Ingénieur logistique', + 'Instituteur', + 'Jointeur de placage', + 'Juge des enfants', + 'Juriste financier', + 'Kiwiculteur', + 'Lexicographe', + 'Liftier', + 'Litigeur transport', + 'Logistique', + 'Logopède', + 'Magicien', + 'Manager d\'artiste', + 'Mannequin détail', + 'Maquilleur spectacle', + 'Marbrier-poseur', + 'Marin grande pêche', + 'Matelassier', + 'Maçon', + 'Maçon-fumiste', + 'Maçonnerie', + 'Maître de ballet', + 'Maïeuticien', + 'Menuisier', + 'Miroitier', + 'Modéliste industriel', + 'Moellonneur', + 'Moniteur de sport', + 'Monteur audiovisuel', + 'Monteur de fermettes', + 'Monteur de palettes', + 'Monteur en siège', + 'Monteur prototypiste', + 'Monteur-frigoriste', + 'Monteur-truquiste', + 'Mouleur sable', + 'Mouliste drapeur', + 'Mécanicien-armurier', + 'Médecin du sport', + 'Médecin scolaire', + 'Médiateur judiciaire', + 'Médiathécaire', + 'Net surfeur surfeuse', + 'Oenologue', + 'Opérateur de plateau', + 'Opérateur du son', + 'Opérateur géomètre', + 'Opérateur piquage', + 'Opérateur vidéo', + 'Ouvrier d\'abattoir', + 'Ouvrier serriste', + 'Ouvrier sidérurgiste', + 'Palefrenier', + 'Paléontologue', + 'Pareur en abattoir', + 'Parfumeur', + 'Parqueteur', + 'Percepteur', + 'Photographe d\'art', + 'Pilote automobile', + 'Pilote de soutireuse', + 'Pilote fluvial', + 'Piqueur en ganterie', + 'Pisteur secouriste', + 'Pizzaïolo', + 'Plaquiste enduiseur', + 'Plasticien', + 'Plisseur', + 'Poissonnier-traiteur', + 'Pontonnier', + 'Porion', + 'Porteur de hottes', + 'Porteur de journaux', + 'Portier', + 'Poseur de granit', + 'Posticheur spectacle', + 'Potier', + 'Praticien dentaire', + 'Praticiens médicaux', + 'Premier clerc', + 'Preneur de son', + 'Primeuriste', + 'Professeur d\'italien', + 'Projeteur béton armé', + 'Promotion des ventes', + 'Présentateur radio', + 'Pyrotechnicien', + 'Pédicure pour bovin', + 'Pédologue', + 'Pédopsychiatre', + 'Quincaillier', + 'Radio chargeur', + 'Ramasseur d\'asperges', + 'Ramasseur d\'endives', + 'Ravaleur-ragréeur', + 'Recherche', + 'Recuiseur', + 'Relieur-doreur', + 'Responsable de salle', + 'Responsable télécoms', + 'Revenue Manager', + 'Rippeur spectacle', + 'Rogneur', + 'Récupérateur', + 'Rédacteur des débats', + 'Régleur funéraire', + 'Régleur sur tour', + 'Sapeur-pompier', + 'Scannériste', + 'Scripte télévision', + 'Sculpteur sur verre', + 'Scénariste', + 'Second de cuisine', + 'Secrétaire juridique', + 'Semencier', + 'Sertisseur', + 'Services funéraires', + 'Solier-moquettiste', + 'Sommelier', + 'Sophrologue', + 'Staffeur', + 'Story boarder', + 'Stratifieur', + 'Stucateur', + 'Styliste graphiste', + 'Surjeteur-raseur', + 'Séismologue', + 'Technicien agricole', + 'Technicien bovin', + 'Technicien géomètre', + 'Technicien plateau', + 'Technicien énergie', + 'Terminologue', + 'Testeur informatique', + 'Toiliste', + 'Topographe', + 'Toréro', + 'Traducteur d\'édition', + 'Traffic manager', + 'Trieur de métaux', + 'Turbinier', + 'Téléconseiller', + 'Tôlier-traceur', + 'Vendeur carreau', + 'Vendeur en lingerie', + 'Vendeur en meubles', + 'Vendeur en épicerie', + 'Verrier d\'art', + 'Verrier à la calotte', + 'Verrier à la main', + 'Verrier à main levée', + 'Vidéo-jockey', + 'Vitrier', + ); +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Internet.php new file mode 100644 index 0000000..8e3024b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Internet.php @@ -0,0 +1,9 @@ +numberBetween(1, 2); + } + + $nir .= + // Year of birth (aa) + $this->numerify('##') . + // Mont of birth (mm) + sprintf('%02d', $this->numberBetween(1, 12)); + + // Department + $department = key(Address::department()); + $nir .= $department; + + // Town number, depends on department length + if (strlen($department) === 2) { + $nir .= $this->numerify('###'); + } elseif (strlen($department) === 3) { + $nir .= $this->numerify('##'); + } + + // Born number (depending of town and month of birth) + $nir .= $this->numerify('###'); + + /** + * The key for a given NIR is `97 - 97 % NIR` + * NIR has to be an integer, so we have to do a little replacment + * for departments 2A and 2B + */ + if ($department === '2A') { + $nirInteger = str_replace('2A', '19', $nir); + } elseif ($department === '2B') { + $nirInteger = str_replace('2B', '18', $nir); + } else { + $nirInteger = $nir; + } + $nir .= sprintf('%02d', 97 - $nirInteger % 97); + + // Format is x xx xx xx xxx xxx xx + if ($formatted) { + $nir = substr($nir, 0, 1) . ' ' . substr($nir, 1, 2) . ' ' . substr($nir, 3, 2) . ' ' . substr($nir, 5, 2) . ' ' . substr($nir, 7, 3). ' ' . substr($nir, 10, 3). ' ' . substr($nir, 13, 2); + } + + return $nir; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/PhoneNumber.php new file mode 100644 index 0000000..7c0bd9d --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/PhoneNumber.php @@ -0,0 +1,141 @@ +phoneNumber07WithSeparator(); + $phoneNumber = str_replace(' ', '', $phoneNumber); + return $phoneNumber; + } + + /** + * Only 073 to 079 are acceptable prefixes with 07 + * + * @see http://www.arcep.fr/index.php?id=8146 + */ + public function phoneNumber07WithSeparator() + { + $phoneNumber = $this->generator->numberBetween(3, 9); + $phoneNumber .= $this->numerify('# ## ## ##'); + return $phoneNumber; + } + + public function phoneNumber08() + { + $phoneNumber = $this->phoneNumber08WithSeparator(); + $phoneNumber = str_replace(' ', '', $phoneNumber); + return $phoneNumber; + } + + /** + * Valid formats for 08: + * + * 0# ## ## ## + * 1# ## ## ## + * 2# ## ## ## + * 91 ## ## ## + * 92 ## ## ## + * 93 ## ## ## + * 97 ## ## ## + * 98 ## ## ## + * 99 ## ## ## + * + * Formats 089(4|6)## ## ## are valid, but will be + * attributed when other 089 resource ranges are exhausted. + * + * @see https://www.arcep.fr/index.php?id=8146#c9625 + * @see https://issuetracker.google.com/u/1/issues/73269839 + */ + public function phoneNumber08WithSeparator() + { + $regex = '([012]{1}\d{1}|(9[1-357-9])( \d{2}){3}'; + return $this->regexify($regex); + } + + /** + * @example '0601020304' + */ + public function mobileNumber() + { + $format = static::randomElement(static::$mobileFormats); + + return static::numerify($this->generator->parse($format)); + } + /** + * @example '0891951357' + */ + public function serviceNumber() + { + $format = static::randomElement(static::$serviceFormats); + + return static::numerify($this->generator->parse($format)); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Text.php b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Text.php new file mode 100644 index 0000000..9403f16 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/fr_FR/Text.php @@ -0,0 +1,15531 @@ + static::latitude(46.262740, 47.564721), + 'longitude' => static::longitude(17.077949, 20.604560) + ); + } + + /* ----------- DATA -------------------- */ + + protected static $streetSuffix = array( + 'árok', 'átjáró', 'dűlÅ‘sor', 'dűlőút', 'erdÅ‘sor', 'fasor', 'forduló', 'gát', 'határsor', 'határút', 'híd', 'játszótér', 'kert', 'körönd', 'körtér', 'körút', 'köz', 'lakótelep', 'lejáró', 'lejtÅ‘', 'lépcsÅ‘', 'liget', 'mélyút', 'orom', 'országút', 'ösvény', 'park', 'part', 'pincesor', 'rakpart', 'sétány', 'sétaút', 'sor', 'sugárút', 'tér', 'tere', 'turistaút', 'udvar', 'út', 'útja', 'utca', 'üdülÅ‘part' + ); + protected static $postcode = array('####'); + protected static $state = array( + 'Budapest', 'Bács-Kiskun', 'Baranya', 'Békés', 'Borsod-Abaúj-Zemplén', 'Csongrád', 'Fejér', 'GyÅ‘r-Moson-Sopron', 'Hajdú-Bihar', 'Heves', 'Jász-Nagykun-Szolnok', 'Komárom-Esztergom', 'Nógrád', 'Pest', 'Somogy', 'Szabolcs-Szatmár-Bereg', 'Tolna', 'Vas', 'Veszprém', 'Zala' + ); + protected static $country = array( + 'Afganisztán', 'Albánia', 'Algéria', 'Amerikai Egyesült Ãllamok', 'Andorra', 'Angola', 'Antigua és Barbuda', 'Argentína', 'Ausztria', 'Ausztrália', 'Azerbajdzsán', + 'Bahama-szigetek', 'Bahrein', 'Banglades', 'Barbados', 'Belgium', 'Belize', 'Benin', 'Bhután', 'Bolívia', 'Bosznia-Hercegovina', 'Botswana', 'Brazília', 'Brunei', 'Bulgária', 'Burkina Faso', 'Burma', 'Burundi', + 'Chile', 'Ciprus', 'Costa Rica', 'Csehország', 'Csád', + 'Dominikai Köztársaság', 'Dominikai Közösség', 'Dzsibuti', 'Dánia', 'Dél-Afrika', 'Dél-Korea', 'Dél-Szudán', + 'Ecuador', 'EgyenlítÅ‘i-Guinea', 'Egyesült Arab Emírségek', 'Egyesült Királyság', 'Egyiptom', 'Elefántcsontpart', 'Eritrea', 'Etiópia', + 'Fehéroroszország', 'Fidzsi-szigetek', 'Finnország', 'Franciaország', 'Fülöp-szigetek', + 'Gabon', 'Gambia', 'Ghána', 'Grenada', 'Grúzia', 'Guatemala', 'Guinea', 'Guyana', 'Görögország', + 'Haiti', 'Hollandia', 'Horvátország', + 'India', 'Indonézia', 'Irak', 'Irán', 'Izland', 'Izrael', + 'Japán', 'Jemen', 'Jordánia', + 'Kambodzsa', 'Kamerun', 'Kanada', 'Katar', 'Kazahsztán', 'Kelet-Timor', 'Kenya', 'Kirgizisztán', 'Kiribati', 'Kolumbia', 'Kongói Demokratikus Köztársaság', 'Kongói Köztársaság', 'Kuba', 'Kuvait', 'Kína', 'Közép-Afrika', + 'Laosz', 'Lengyelország', 'Lesotho', 'Lettország', 'Libanon', 'Libéria', 'Liechtenstein', 'Litvánia', 'Luxemburg', 'Líbia', + 'Macedónia', 'Madagaszkár', 'Magyarország', 'Malawi', 'Maldív-szigetek', 'Mali', 'Malájzia', 'Marokkó', 'Marshall-szigetek', 'Mauritánia', 'Mexikó', 'Mikronézia', 'Moldova', 'Monaco', 'Mongólia', 'Montenegró', 'Mozambik', 'Málta', + 'Namíbia', 'Nauru', 'Nepál', 'Nicaragua', 'Niger', 'Nigéria', 'Norvégia', 'Németország', + 'Olaszország', 'Omán', 'Oroszország', + 'Pakisztán', 'Palau', 'Panama', 'Paraguay', 'Peru', 'Portugália', 'Pápua Új-Guinea', + 'Románia', 'Ruanda', + 'Saint Kitts és Nevis', 'Saint Vincent', 'Salamon-szigetek', 'Salvador', 'San Marino', 'Seychelle-szigetek', 'Spanyolország', 'Srí Lanka', 'Suriname', 'Svájc', 'Svédország', 'Szamoa', 'Szaúd-Arábia', 'Szenegál', 'Szerbia', 'Szingapúr', 'Szlovákia', 'Szlovénia', 'Szomália', 'Szudán', 'Szváziföld', 'Szíria', 'São Tomé és Príncipe', + 'Tadzsikisztán', 'Tanzánia', 'Thaiföld', 'Togo', 'Tonga', 'Trinidad és Tobago', 'Tunézia', 'Tuvalu', 'Törökország', 'Türkmenisztán', + 'Uganda', 'Ukrajna', 'Uruguay', + 'Vanuatu', 'Venezuela', 'Vietnám', + 'Zambia', 'Zimbabwe', 'Zöld-foki-szigetek', + 'Észak-Korea', 'Észtország', 'Ãrország', 'Örményország', 'Új-Zéland', 'Ãœzbegisztán' + ); + + /** + * Source: https://hu.wikipedia.org/wiki/Magyarorsz%C3%A1g_v%C3%A1rosainak_list%C3%A1ja + */ + protected static $capitals = array('Budapest'); + protected static $bigCities = array( + 'Békéscsaba', 'Debrecen', 'Dunaújváros', 'Eger', 'Érd', 'GyÅ‘r', 'HódmezÅ‘vásárhely', 'Kaposvár', 'Kecskemét', 'Miskolc', 'Nagykanizsa', 'Nyíregyháza', 'Pécs', 'Salgótarján', 'Sopron', 'Szeged', 'Székesfehérvár', 'Szekszárd', 'Szolnok', 'Szombathely', 'Tatabánya', 'Veszprém', 'Zalaegerszeg' + ); + protected static $smallerCities = array( + 'Ajka', 'Aszód', 'Bácsalmás', + 'Baja', 'Baktalórántháza', 'Balassagyarmat', 'Balatonalmádi', 'Balatonfüred', 'Balmazújváros', 'Barcs', 'Bátonyterenye', 'Békés', 'Bélapátfalva', 'Berettyóújfalu', 'Bicske', 'Bóly', 'Bonyhád', 'Budakeszi', + 'Cegléd', 'Celldömölk', 'Cigánd', 'Csenger', 'Csongrád', 'Csorna', 'Csurgó', + 'Dabas', 'Derecske', 'Devecser', 'Dombóvár', 'Dunakeszi', + 'Edelény', 'Encs', 'Enying', 'Esztergom', + 'Fehérgyarmat', 'Fonyód', 'Füzesabony', + 'Gárdony', 'GödöllÅ‘', 'Gönc', 'Gyál', 'GyomaendrÅ‘d', 'Gyöngyös', 'Gyula', + 'Hajdúböszörmény', 'Hajdúhadház', 'Hajdúnánás', 'Hajdúszoboszló', 'Hatvan', 'Heves', + 'Ibrány', + 'Jánoshalma', 'Jászapáti', 'Jászberény', + 'Kalocsa', 'Kapuvár', 'Karcag', 'Kazincbarcika', 'Kemecse', 'Keszthely', 'Kisbér', 'KiskÅ‘rös', 'Kiskunfélegyháza', 'Kiskunhalas', 'Kiskunmajsa', 'Kistelek', 'Kisvárda', 'Komárom', 'Komló', 'Körmend', 'KÅ‘szeg', 'Kunhegyes', 'Kunszentmárton', 'Kunszentmiklós', + 'Lenti', 'Letenye', + 'Makó', 'Marcali', 'Martonvásár', 'Mátészalka', 'MezÅ‘csát', 'MezÅ‘kovácsháza', 'MezÅ‘kövesd', 'MezÅ‘túr', 'Mohács', 'Monor', 'Mór', 'Mórahalom', 'Mosonmagyaróvár', + 'Nagyatád', 'Nagykálló', 'Nagykáta', 'NagykÅ‘rös', 'Nyíradony', 'Nyírbátor', + 'Orosháza', 'Oroszlány', 'Ózd', + 'Paks', 'Pannonhalma', 'Pápa', 'Pásztó', 'Pécsvárad', 'Pétervására', 'Pilisvörösvár', 'Polgárdi', 'Püspökladány', 'Putnok', + 'Ráckeve', 'Rétság', + 'Sárbogárd', 'Sarkad', 'Sárospatak', 'Sárvár', 'Sásd', 'Sátoraljaújhely', 'Sellye', 'Siklós', 'Siófok', 'Sümeg', 'Szarvas', 'Szécsény', 'Szeghalom', 'Szentendre', 'Szentes', 'Szentgotthárd', 'SzentlÅ‘rinc', 'Szerencs', 'Szigetszentmiklós', 'Szigetvár', 'Szikszó', 'Szob', + 'Tab', 'Tamási', 'Tapolca', 'Tata', 'Tét', 'Tiszafüred', 'Tiszakécske', 'Tiszaújváros', 'Tiszavasvári', 'Tokaj', 'Tolna', 'Törökszentmiklós', + 'Vác', 'Várpalota', 'Vásárosnamény', 'Vasvár', 'Vecsés', + 'Záhony', 'Zalaszentgrót', 'Zirc' + ); +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/hu_HU/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/hu_HU/Company.php new file mode 100644 index 0000000..7131654 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/hu_HU/Company.php @@ -0,0 +1,13 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function cityPrefix() + { + return static::randomElement(static::$cityPrefix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + public static function street() + { + return static::randomElement(static::$street); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/hy_AM/Color.php b/vendor/fzaninotto/faker/src/Faker/Provider/hy_AM/Color.php new file mode 100644 index 0000000..16b68d8 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/hy_AM/Color.php @@ -0,0 +1,12 @@ +generator->parse(static::randomElement(static::$formats))); + } + + public function code() + { + return static::randomElement(static::$codes); + } + + /** + * @return mixed + */ + public function numberFormat() + { + return static::randomElement(static::$numberFormats); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Address.php new file mode 100644 index 0000000..49fd1a7 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Address.php @@ -0,0 +1,316 @@ +generator->parse($format); + } + + public static function street() + { + return static::randomElement(static::$street); + } + + public static function buildingNumber() + { + return static::numberBetween(1, 999); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Company.php new file mode 100644 index 0000000..7839f1e --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/Company.php @@ -0,0 +1,43 @@ +generator->parse($lastNameRandomElement); + } + + /** + * Return last name for male + * + * @access public + * @return string last name + */ + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + /** + * Return last name for female + * + * @access public + * @return string last name + */ + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } + + /** + * For academic title + * + * @access public + * @return string suffix + */ + public static function suffix() + { + return static::randomElement(static::$suffix); + } + + /** + * Generates Nomor Induk Kependudukan (NIK) + * + * @link https://en.wikipedia.org/wiki/National_identification_number#Indonesia + * + * @param null|string $gender + * @param null|\DateTime $birthDate + * @return string + */ + public function nik($gender = null, $birthDate = null) + { + # generate first numbers (region data) + $nik = $this->generator->numerify('######'); + + if (!$birthDate) { + $birthDate = $this->generator->dateTimeBetween(); + } + + if (!$gender) { + $gender = $this->generator->randomElement(array(self::GENDER_MALE, self::GENDER_FEMALE)); + } + + # if gender is female, add 40 to days + if ($gender == self::GENDER_FEMALE) { + $nik .= $birthDate->format('d') + 40; + } else { + $nik .= $birthDate->format('d'); + } + + $nik .= $birthDate->format('my'); + + # add last random digits + $nik.= $this->generator->numerify('####'); + + return $nik; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/PhoneNumber.php new file mode 100644 index 0000000..de5c969 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/id_ID/PhoneNumber.php @@ -0,0 +1,55 @@ + + */ +class Address extends \Faker\Provider\Address +{ + /** + * @var array Countries in icelandic + */ + protected static $country = array( + 'Afganistan', 'Albanía', 'Alsír', 'Andorra', 'Angóla', 'Angvilla', 'Antígva og Barbúda', 'Argentína', + 'Armenía', 'Arúba', 'Aserbaídsjan', 'Austur-Kongó', 'Austurríki', 'Austur-Tímor', 'Ãlandseyjar', + 'Ãstralía', 'Bahamaeyjar', 'Bandaríkin', 'Bandaríska Samóa', 'Bangladess', 'Barbados', 'Barein', + 'Belgía', 'Belís', 'Benín', 'Bermúdaeyjar', 'Bosnía og Hersegóvína', 'Botsvana', 'Bouvet-eyja', 'Bólivía', + 'Brasilía', 'Bresku Indlandshafseyjar', 'Bretland', 'Brúnei', 'Búlgaría', 'Búrkína Fasó', 'Búrúndí', 'Bútan', + 'Cayman-eyjar', 'Chile', 'Cooks-eyjar', 'Danmörk', 'Djíbútí', 'Dóminíka', 'Dóminíska lýðveldið', 'Egyptaland', + 'Eistland', 'Ekvador', 'El Salvador', 'England', 'Erítrea', 'Eþíópía', 'Falklandseyjar', 'Filippseyjar', + 'Finnland', 'Fídjieyjar', 'Fílabeinsströndin', 'Frakkland', 'Franska Gvæjana', 'Franska Pólýnesía', + 'Frönsku suðlægu landsvæðin', 'Færeyjar', 'Gabon', 'Gambía', 'Gana', 'Georgía', 'Gíbraltar', 'Gínea', + 'Gínea-Bissá', 'Grenada', 'Grikkland', 'Grænhöfðaeyjar', 'Grænland', 'Gvadelúpeyjar', 'Gvam', 'Gvatemala', + 'Gvæjana', 'Haítí', 'Heard og McDonalds-eyjar', 'Holland', 'Hollensku Antillur', 'Hondúras', 'Hong Kong', + 'Hvíta-Rússland', 'Indland', 'Indónesía', 'Ãrak', 'Ãran', 'Ãrland', 'Ãsland', 'Ãsrael', 'Ãtalía', 'Jamaíka', + 'Japan', 'Jemen', 'Jólaey', 'Jómfrúaeyjar', 'Jórdanía', 'Kambódía', 'Kamerún', 'Kanada', 'Kasakstan', 'Katar', + 'Kenía', 'Kirgisistan', 'Kína', 'Kíribatí', 'Kongó', 'Austur-Kongó', 'Vestur-Kongó', 'Kostaríka', 'Kókoseyjar', + 'Kólumbía', 'Kómoreyjar', 'Kórea', 'Norður-Kórea;', 'Suður-Kórea', 'Króatía', 'Kúba', 'Kúveit', 'Kýpur', + 'Laos', 'Lesótó', 'Lettland', 'Liechtenstein', 'Litháen', 'Líbanon', 'Líbería', 'Líbía', 'Lúxemborg', + 'Madagaskar', 'Makaó', 'Makedónía', 'Malasía', 'Malaví', 'Maldíveyjar', 'Malí', 'Malta', 'Marokkó', + 'Marshall-eyjar', 'Martiník', 'Mayotte', 'Máritanía', 'Máritíus', 'Mexíkó', 'Mið-Afríkulýðveldið', + 'Miðbaugs-Gínea', 'Míkrónesía', 'Mjanmar', 'Moldóva', 'Mongólía', 'Montserrat', 'Mónakó', 'Mósambík', + 'Namibía', 'Nárú', 'Nepal', 'Niue', 'Níger', 'Nígería', 'Níkaragva', 'Norður-Ãrland', 'Norður-Kórea', + 'Norður-Maríanaeyjar', 'Noregur', 'Norfolkeyja', 'Nýja-Kaledónía', 'Nýja-Sjáland', 'Óman', 'Pakistan', + 'Palá', 'Palestína', 'Panama', 'Papúa Nýja-Gínea', 'Paragvæ', 'Páfagarður', 'Perú', 'Pitcairn', 'Portúgal', + 'Pólland', 'Púertó Ríkó', 'Réunion', 'Rúanda', 'Rúmenía', 'Rússland', 'Salómonseyjar', 'Sambía', + 'Sameinuðu arabísku furstadæmin', 'Samóa', 'San Marínó', 'Sankti Helena', 'Sankti Kristófer og Nevis', + 'Sankti Lúsía', 'Sankti Pierre og Miquelon', 'Sankti Vinsent og Grenadíneyjar', 'Saó Tóme og Prinsípe', + 'Sádi-Arabía', 'Senegal', 'Serbía', 'Seychelles-eyjar', 'Simbabve', 'Singapúr', 'Síerra Leóne', 'Skotland', + 'Slóvakía', 'Slóvenía', 'Smáeyjar Bandaríkjanna', 'Sómalía', 'Spánn', 'Srí Lanka', 'Suður-Afríka', + 'Suður-Georgía og Suður-Sandvíkureyjar', 'Suður-Kórea', 'Suðurskautslandið', 'Súdan', 'Súrínam', 'Jan Mayen', + 'Svartfjallaland', 'Svasíland', 'Sviss', 'Svíþjóð', 'Sýrland', 'Tadsjikistan', 'Taíland', 'Taívan', 'Tansanía', + 'Tékkland', 'Tonga', 'Tógó', 'Tókelá', 'Trínidad og Tóbagó', 'Tsjad', 'Tsjetsjenía', 'Turks- og Caicos-eyjar', + 'Túnis', 'Túrkmenistan', 'Túvalú', 'Tyrkland', 'Ungverjaland', 'Úganda', 'Úkraína', 'Úrúgvæ', 'Úsbekistan', + 'Vanúatú', 'Venesúela', 'Vestur-Kongó', 'Vestur-Sahara', 'Víetnam', 'Wales', 'Wallis- og Fútúnaeyjar', 'Þýskaland' + ); + + /** + * @var array Icelandic cities. + */ + protected static $cityNames = array( + 'Reykjavík', 'Seltjarnarnes', 'Vogar', 'Kópavogur', 'Garðabær', 'Hafnarfjörður', 'Reykjanesbær', 'Grindavík', + 'Sandgerði', 'Garður', 'Reykjanesbær', 'Mosfellsbær', 'Akranes', 'Borgarnes', 'Reykholt', 'Stykkishólmur', + 'Flatey', 'Grundarfjörður', 'Ólafsvík', 'Snæfellsbær', 'Hellissandur', 'Búðardalur', 'Reykhólahreppur', + 'Ãsafjörður', 'Hnífsdalur', 'Bolungarvík', 'Súðavík', 'Flateyri', 'Suðureyri', 'Patreksfjörður', + 'Tálknafjörður', 'Bíldudalur', 'Þingeyri', 'Staður', 'Hólmavík', 'Drangsnes', 'Ãrneshreppur', 'Hvammstangi', + 'Blönduós', 'Skagaströnd', 'Sauðárkrókur', 'Varmahlíð', 'Hofsós', 'Fljót', 'Siglufjörður', 'Akureyri', + 'Grenivík', 'Grímsey', 'Dalvík', 'Ólafsfjörður', 'Hrísey', 'Húsavík', 'Fosshóll', 'Laugar', 'Mývatn', + 'Kópasker', 'Raufarhöfn', 'Þórshöfn', 'Bakkafjörður', 'Vopnafjörður', 'Egilsstaðir', 'Seyðisfjörður', + 'Mjóifjörður', 'Borgarfjörður', 'Reyðarfjörður', 'Eskifjörður', 'Neskaupstaður', 'Fáskrúðsfjörður', + 'Stöðvarfjörður', 'Breiðdalsvík', 'Djúpivogur', 'Höfn', 'Selfoss', 'Hveragerði', 'Þorlákshöfn', 'Ölfus', + 'Eyrarbakki', 'Stokkseyri', 'Laugarvatn', 'Flúðir', 'Hella', 'Hvolsvöllur', 'Vík', 'Kirkjubæjarklaustur', + 'Vestmannaeyjar' + ); + + /** + * @var array Street name suffix. + */ + protected static $streetSuffix = array( + 'ás', 'bakki', 'braut', 'bær', 'brún', 'berg', 'fold', 'gata', 'gróf', + 'garðar', 'höfði', 'heimar', 'hamar', 'hólar', 'háls', 'kvísl', 'lækur', + 'leiti', 'land', 'múli', 'nes', 'rimi', 'stígur', 'stræti', 'stekkur', + 'slóð', 'skógar', 'sel', 'teigur', 'tún', 'vangur', 'vegur', 'vogur', + 'vað' + ); + + /** + * @var array Street name prefix. + */ + protected static $streetPrefix = array( + 'Aðal', 'Austur', 'Bakka', 'Braga', 'Báru', 'Brunn', 'Fiski', 'Leifs', + 'Týs', 'Birki', 'Suður', 'Norður', 'Vestur', 'Austur', 'Sanda', 'Skógar', + 'Stór', 'Sunnu', 'Tungu', 'Tangar', 'Úlfarfells', 'Vagn', 'Vind', 'Ysti', + 'Þing', 'Hamra', 'Hóla', 'Kríu', 'Iðu', 'Spóa', 'Starra', 'Uglu', 'Vals' + ); + + /** + * @var Icelandic zip code. + **/ + protected static $postcode = array( + '%##' + ); + + /** + * @var array Icelandic regions. + */ + protected static $regionNames = array( + 'Höfuðborgarsvæðið', 'Norðurland', 'Suðurland', 'Vesturland', 'Vestfirðir', 'Austurland', 'Suðurnes' + ); + + /** + * @var array Icelandic building numbers. + */ + protected static $buildingNumber = array( + '%##', '%#', '%#', '%', '%', '%', '%?', '% ?', + ); + + /** + * @var array Icelandic city format. + */ + protected static $cityFormats = array( + '{{cityName}}', + ); + + /** + * @var array Icelandic street's name formats. + */ + protected static $streetNameFormats = array( + '{{streetPrefix}}{{streetSuffix}}', + '{{streetPrefix}}{{streetSuffix}}', + '{{firstNameMale}}{{streetSuffix}}', + '{{firstNameFemale}}{{streetSuffix}}' + ); + + /** + * @var array Icelandic street's address formats. + */ + protected static $streetAddressFormats = array( + '{{streetName}} {{buildingNumber}}' + ); + + /** + * @var array Icelandic address format. + */ + protected static $addressFormats = array( + "{{streetAddress}}\n{{postcode}} {{city}}", + ); + + /** + * Randomly return a real city name. + * + * @return string + */ + public static function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Randomly return a street prefix. + * + * @return string + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Randomly return a building number. + * + * @return string + */ + public static function buildingNumber() + { + return static::toUpper(static::bothify(static::randomElement(static::$buildingNumber))); + } + + /** + * Randomly return a real region name. + * + * @return string + */ + public static function region() + { + return static::randomElement(static::$regionNames); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Company.php new file mode 100644 index 0000000..6b93451 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Company.php @@ -0,0 +1,53 @@ + + */ +class Company extends \Faker\Provider\Company +{ + /** + * @var array Danish company name formats. + */ + protected static $formats = array( + '{{lastName}} {{companySuffix}}', + '{{lastName}} {{companySuffix}}', + '{{lastName}} {{companySuffix}}', + '{{firstname}} {{lastName}} {{companySuffix}}', + '{{middleName}} {{companySuffix}}', + '{{middleName}} {{companySuffix}}', + '{{middleName}} {{companySuffix}}', + '{{firstname}} {{middleName}} {{companySuffix}}', + '{{lastName}} & {{lastName}} {{companySuffix}}', + '{{lastName}} og {{lastName}} {{companySuffix}}', + '{{lastName}} & {{lastName}} {{companySuffix}}', + '{{lastName}} og {{lastName}} {{companySuffix}}', + '{{middleName}} & {{middleName}} {{companySuffix}}', + '{{middleName}} og {{middleName}} {{companySuffix}}', + '{{middleName}} & {{lastName}}', + '{{middleName}} og {{lastName}}', + ); + + /** + * @var array Company suffixes. + */ + protected static $companySuffix = array('ehf.', 'hf.', 'sf.'); + + /** + * @link http://www.rsk.is/atvinnurekstur/virdisaukaskattur/ + * + * @var string VSK number format. + */ + protected static $vskFormat = '%####'; + + /** + * Generates a VSK number (5 digits). + * + * @return string + */ + public static function vsk() + { + return static::numerify(static::$vskFormat); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Internet.php new file mode 100644 index 0000000..a265da6 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Internet.php @@ -0,0 +1,23 @@ + + */ +class Internet extends \Faker\Provider\Internet +{ + /** + * @var array Some email domains in Denmark. + */ + protected static $freeEmailDomain = array( + 'gmail.com', 'yahoo.com', 'hotmail.com', 'visir.is', 'simnet.is', 'internet.is' + ); + + /** + * @var array Some TLD. + */ + protected static $tld = array( + 'com', 'com', 'com', 'net', 'is', 'is', 'is', + ); +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Payment.php b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Payment.php new file mode 100644 index 0000000..c119c38 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/Payment.php @@ -0,0 +1,19 @@ + + */ +class Person extends \Faker\Provider\Person +{ + /** + * @var array Icelandic person name formats. + */ + protected static $maleNameFormats = array( + '{{firstNameMale}} {{lastNameMale}}', + '{{firstNameMale}} {{lastNameMale}}', + '{{firstNameMale}} {{middleName}} {{lastNameMale}}', + '{{firstNameMale}} {{middleName}} {{lastNameMale}}', + ); + + protected static $femaleNameFormats = array( + '{{firstNameFemale}} {{lastNameFemale}}', + '{{firstNameFemale}} {{lastNameFemale}}', + '{{firstNameFemale}} {{middleName}} {{lastNameFemale}}', + '{{firstNameFemale}} {{middleName}} {{lastNameFemale}}', + ); + + /** + * @var string Icelandic women names. + */ + protected static $firstNameFemale = array('Aagot', 'Abela', 'Abigael', 'Ada', 'Adda', 'Addý', 'Adela', 'Adelía', 'Adríana', 'Aðalbjörg', 'Aðalbjört', 'Aðalborg', 'Aðaldís', 'Aðalfríður', 'Aðalheiður', 'Aðalrós', 'Aðalsteina', 'Aðalsteinunn', 'Aðalveig', 'Agata', 'Agatha', 'Agða', 'Agla', 'Agnea', 'Agnes', 'Agneta', 'Alanta', 'Alba', 'Alberta', 'Albína', 'Alda', 'Aldís', 'Aldný', 'Aleta', 'Aletta', 'Alexa', 'Alexandra', 'Alexandría', 'Alexis', 'Alexía', 'Alfa', 'Alfífa', 'Alice', 'Alida', 'Alída', 'Alína', 'Alís', 'Alísa', 'Alla', 'Allý', 'Alma', 'Alrún', 'Alva', 'Alvilda', 'Amadea', 'Amal', 'Amalía', 'Amanda', 'Amelía', 'Amilía', 'Amíra', 'Amy', 'Amý', 'Analía', 'Anastasía', 'Andra', 'Andrá', 'Andrea', 'Anetta', 'Angela', 'Angelíka', 'Anika', 'Anita', 'Aníka', 'Anína', 'Aníta', 'Anja', 'Ann', 'Anna', 'Annabella', 'Annalísa', 'Anne', 'Annelí', 'Annetta', 'Anney', 'Annika', 'Annía', 'Anný', 'Antonía', 'Apríl', 'Ardís', 'Arey', 'Arinbjörg', 'Aris', 'Arisa', 'Aría', 'Aríanna', 'Aríella', 'Arín', 'Arína', 'Arís', 'Armenía', 'Arna', 'Arnbjörg', 'Arnborg', 'Arndís', 'Arney', 'Arnfinna', 'Arnfríður', 'Arngerður', 'Arngunnur', 'Arnheiður', 'Arnhildur', 'Arnika', 'Arnkatla', 'Arnlaug', 'Arnleif', 'Arnlín', 'Arnljót', 'Arnóra', 'Arnrós', 'Arnrún', 'Arnþóra', 'Arnþrúður', 'Asírí', 'Askja', 'Assa', 'Astrid', 'Atalía', 'Atena', 'Athena', 'Atla', 'Atlanta', 'Auðbjörg', 'Auðbjört', 'Auðdís', 'Auðlín', 'Auðna', 'Auðný', 'Auðrún', 'Auður', 'Aurora', 'Axelía', 'Axelma', 'Aþena', 'Ãgústa', 'Ãgústína', 'Ãlfdís', 'Ãlfey', 'Ãlfgerður', 'Ãlfheiður', 'Ãlfhildur', 'Ãlfrós', 'Ãlfrún', 'Ãlfsól', 'Ãrbjörg', 'Ãrbjört', 'Ãrdís', 'Ãrelía', 'Ãrlaug', 'Ãrmey', 'Ãrna', 'Ãrndís', 'Ãrney', 'Ãrnheiður', 'Ãrnína', 'Ãrný', 'Ãróra', 'Ãrsól', 'Ãrsæl', 'Ãrún', 'Ãrveig', 'Ãrvök', 'Ãrþóra', 'Ãsa', 'Ãsbjörg', 'Ãsborg', 'Ãsdís', 'Ãsfríður', 'Ãsgerður', 'Ãshildur', 'Ãskatla', 'Ãsla', 'Ãslaug', 'Ãsleif', 'Ãsný', 'Ãsrós', 'Ãsrún', 'Ãst', 'Ãsta', 'Ãstbjörg', 'Ãstbjört', 'Ãstdís', 'Ãstfríður', 'Ãstgerður', 'Ãstheiður', 'Ãsthildur', 'Ãstríður', 'Ãstrós', 'Ãstrún', 'Ãstveig', 'Ãstþóra', 'Ãstþrúður', 'Ãsvör', 'Baldey', 'Baldrún', 'Baldvina', 'Barbara', 'Barbára', 'Bassí', 'Bára', 'Bebba', 'Begga', 'Belinda', 'Bella', 'Benedikta', 'Bengta', 'Benidikta', 'Benía', 'Beníta', 'Benna', 'Benney', 'Benný', 'Benta', 'Bentey', 'Bentína', 'Bera', 'Bergdís', 'Bergey', 'Bergfríður', 'Bergheiður', 'Berghildur', 'Berglaug', 'Berglind', 'Berglín', 'Bergljót', 'Bergmannía', 'Bergný', 'Bergrán', 'Bergrín', 'Bergrós', 'Bergrún', 'Bergþóra', 'Berit', 'Bernódía', 'Berta', 'Bertha', 'Bessí', 'Bestla', 'Beta', 'Betanía', 'Betsý', 'Bettý', 'Bil', 'Birgit', 'Birgitta', 'Birna', 'Birta', 'Birtna', 'Bíbí', 'Bína', 'Bjargdís', 'Bjargey', 'Bjargheiður', 'Bjarghildur', 'Bjarglind', 'Bjarkey', 'Bjarklind', 'Bjarma', 'Bjarndís', 'Bjarney', 'Bjarnfríður', 'Bjarngerður', 'Bjarnheiður', 'Bjarnhildur', 'Bjarnlaug', 'Bjarnrún', 'Bjarnveig', 'Bjarný', 'Bjarnþóra', 'Bjarnþrúður', 'Bjartey', 'Bjartmey', 'Björg', 'Björgey', 'Björgheiður', 'Björghildur', 'Björk', 'Björney', 'Björnfríður', 'Björt', 'Bláey', 'Blíða', 'Blín', 'Blómey', 'Blædís', 'Blær', 'Bobba', 'Boga', 'Bogdís', 'Bogey', 'Bogga', 'Boghildur', 'Borg', 'Borgdís', 'Borghildur', 'Borgný', 'Borgrún', 'Borgþóra', 'Botnía', 'Bóel', 'Bót', 'Bóthildur', 'Braga', 'Braghildur', 'Branddís', 'Brá', 'Brák', 'Brigitta', 'Brimdís', 'Brimhildur', 'Brimrún', 'Brit', 'Britt', 'Britta', 'Bríana', 'Bríanna', 'Bríet', 'Bryndís', 'Brynfríður', 'Bryngerður', 'Brynheiður', 'Brynhildur', 'Brynja', 'Brynný', 'Burkney', 'Bylgja', 'Camilla', 'Carla', 'Carmen', 'Cecilia', 'Cecilía', 'Charlotta', 'Charlotte', 'Christina', 'Christine', 'Clara', 'Daðey', 'Daðína', 'Dagbjörg', 'Dagbjört', 'Dagfríður', 'Daggrós', 'Dagheiður', 'Dagmar', 'Dagmey', 'Dagný', 'Dagrún', 'Daldís', 'Daley', 'Dalía', 'Dalla', 'Dallilja', 'Dalrós', 'Dana', 'Daney', 'Danfríður', 'Danheiður', 'Danhildur', 'Danía', 'Daníela', 'Daníella', 'Dara', 'Debora', 'Debóra', 'Dendý', 'Didda', 'Dilja', 'Diljá', 'Dimmblá', 'Dimmey', 'Día', 'Díana', 'Díanna', 'Díma', 'Dís', 'Dísa', 'Dísella', 'Donna', 'Doris', 'Dorothea', 'Dóa', 'Dómhildur', 'Dóra', 'Dórey', 'Dóris', 'Dórothea', 'Dórótea', 'Dóróthea', 'Drauma', 'Draumey', 'Drífa', 'Droplaug', 'Drótt', 'Dröfn', 'Dúa', 'Dúfa', 'Dúna', 'Dýrborg', 'Dýrfinna', 'Dýrleif', 'Dýrley', 'Dýrunn', 'Dæja', 'Dögg', 'Dögun', 'Ebba', 'Ebonney', 'Edda', 'Edel', 'Edil', 'Edit', 'Edith', 'Eðna', 'Efemía', 'Egedía', 'Eggrún', 'Egla', 'Eiðný', 'Eiðunn', 'Eik', 'Einbjörg', 'Eindís', 'Einey', 'Einfríður', 'Einhildur', 'Einína', 'Einrún', 'Eir', 'Eirdís', 'Eirfinna', 'Eiríka', 'Eirný', 'Eirún', 'Elba', 'Eldbjörg', 'Eldey', 'Eldlilja', 'Eldrún', 'Eleina', 'Elektra', 'Elena', 'Elenborg', 'Elfa', 'Elfur', 'Elina', 'Elinborg', 'Elisabeth', 'Elía', 'Elíana', 'Elín', 'Elína', 'Elíná', 'Elínbet', 'Elínbjörg', 'Elínbjört', 'Elínborg', 'Elíndís', 'Elíngunnur', 'Elínheiður', 'Elínrós', 'Elírós', 'Elísa', 'Elísabet', 'Elísabeth', 'Elka', 'Ella', 'Ellen', 'Elley', 'Ellisif', 'Ellín', 'Elly', 'Ellý', 'Elma', 'Elna', 'Elsa', 'Elsabet', 'Elsie', 'Elsí', 'Elsý', 'Elva', 'Elvi', 'Elvíra', 'Elvý', 'Embla', 'Emelía', 'Emelíana', 'Emelína', 'Emeralda', 'Emilía', 'Emilíana', 'Emilíanna', 'Emilý', 'Emma', 'Emmý', 'Emý', 'Enea', 'Eneka', 'Engilbjört', 'Engilráð', 'Engilrós', 'Engla', 'Enika', 'Enja', 'Enóla', 'Eres', 'Erika', 'Erin', 'Erla', 'Erlen', 'Erlín', 'Erna', 'Esja', 'Esmeralda', 'Ester', 'Esther', 'Estiva', 'Ethel', 'Etna', 'Eufemía', 'Eva', 'Evelyn', 'Evey', 'Evfemía', 'Evgenía', 'Evíta', 'Evlalía', 'Ey', 'Eybjörg', 'Eybjört', 'Eydís', 'Eyfríður', 'Eygerður', 'Eygló', 'Eyhildur', 'Eyja', 'Eyjalín', 'Eyleif', 'Eylín', 'Eyrós', 'Eyrún', 'Eyveig', 'Eyvör', 'Eyþóra', 'Eyþrúður', 'Fanndís', 'Fanney', 'Fannlaug', 'Fanny', 'Fanný', 'Febrún', 'Fema', 'Filipía', 'Filippa', 'Filippía', 'Finna', 'Finnbjörg', 'Finnbjörk', 'Finnboga', 'Finnborg', 'Finndís', 'Finney', 'Finnfríður', 'Finnlaug', 'Finnrós', 'Fía', 'Fídes', 'Fífa', 'Fjalldís', 'Fjóla', 'Flóra', 'Folda', 'Fransiska', 'Franziska', 'Frán', 'Fregn', 'Freydís', 'Freygerður', 'Freyja', 'Freylaug', 'Freyleif', 'Friðbjörg', 'Friðbjört', 'Friðborg', 'Friðdís', 'Friðdóra', 'Friðey', 'Friðfinna', 'Friðgerður', 'Friðjóna', 'Friðlaug', 'Friðleif', 'Friðlín', 'Friðmey', 'Friðný', 'Friðrika', 'Friðrikka', 'Friðrós', 'Friðrún', 'Friðsemd', 'Friðveig', 'Friðþóra', 'Frigg', 'Fríða', 'Fríður', 'Frostrós', 'Fróðný', 'Fura', 'Fönn', 'Gabríela', 'Gabríella', 'Gauja', 'Gauthildur', 'Gefjun', 'Gefn', 'Geira', 'Geirbjörg', 'Geirdís', 'Geirfinna', 'Geirfríður', 'Geirhildur', 'Geirlaug', 'Geirlöð', 'Geirný', 'Geirríður', 'Geirrún', 'Geirþrúður', 'Georgía', 'Gerða', 'Gerður', 'Gestheiður', 'Gestný', 'Gestrún', 'Gillý', 'Gilslaug', 'Gissunn', 'Gía', 'Gígja', 'Gísela', 'Gísla', 'Gísley', 'Gíslína', 'Gíslný', 'Gíslrún', 'Gíslunn', 'Gíta', 'Gjaflaug', 'Gloría', 'Gló', 'Glóa', 'Glóbjört', 'Glódís', 'Glóð', 'Glóey', 'Gná', 'Góa', 'Gógó', 'Grein', 'Gret', 'Greta', 'Grélöð', 'Grét', 'Gréta', 'Gríma', 'Grímey', 'Grímheiður', 'Grímhildur', 'Gróa', 'Guðbjörg', 'Guðbjört', 'Guðborg', 'Guðdís', 'Guðfinna', 'Guðfríður', 'Guðjóna', 'Guðlaug', 'Guðleif', 'Guðlín', 'Guðmey', 'Guðmunda', 'Guðmundína', 'Guðný', 'Guðríður', 'Guðrún', 'Guðsteina', 'Guðveig', 'Gullbrá', 'Gullveig', 'Gullý', 'Gumma', 'Gunnbjörg', 'Gunnbjört', 'Gunnborg', 'Gunndís', 'Gunndóra', 'Gunnella', 'Gunnfinna', 'Gunnfríður', 'Gunnharða', 'Gunnheiður', 'Gunnhildur', 'Gunnjóna', 'Gunnlaug', 'Gunnleif', 'Gunnlöð', 'Gunnrún', 'Gunnur', 'Gunnveig', 'Gunnvör', 'Gunný', 'Gunnþóra', 'Gunnþórunn', 'Gurrý', 'Gúa', 'Gyða', 'Gyðja', 'Gyðríður', 'Gytta', 'Gæfa', 'Gæflaug', 'Hadda', 'Haddý', 'Hafbjörg', 'Hafborg', 'Hafdís', 'Hafey', 'Hafliða', 'Haflína', 'Hafný', 'Hafrós', 'Hafrún', 'Hafsteina', 'Hafþóra', 'Halla', 'Hallbera', 'Hallbjörg', 'Hallborg', 'Halldís', 'Halldóra', 'Halley', 'Hallfríður', 'Hallgerður', 'Hallgunnur', 'Hallkatla', 'Hallný', 'Hallrún', 'Hallveig', 'Hallvör', 'Hanna', 'Hanney', 'Hansa', 'Hansína', 'Harpa', 'Hauður', 'Hákonía', 'Heba', 'Hedda', 'Hedí', 'Heiða', 'Heiðbjörg', 'Heiðbjörk', 'Heiðbjört', 'Heiðbrá', 'Heiðdís', 'Heiðlaug', 'Heiðlóa', 'Heiðný', 'Heiðrós', 'Heiðrún', 'Heiður', 'Heiðveig', 'Hekla', 'Helen', 'Helena', 'Helga', 'Hella', 'Helma', 'Hendrikka', 'Henný', 'Henrietta', 'Henrika', 'Henríetta', 'Hera', 'Herbjörg', 'Herbjört', 'Herborg', 'Herdís', 'Herfríður', 'Hergerður', 'Herlaug', 'Hermína', 'Hersilía', 'Herta', 'Hertha', 'Hervör', 'Herþrúður', 'Hilda', 'Hildegard', 'Hildibjörg', 'Hildigerður', 'Hildigunnur', 'Hildiríður', 'Hildisif', 'Hildur', 'Hilma', 'Himinbjörg', 'Hind', 'Hinrika', 'Hinrikka', 'Hjalta', 'Hjaltey', 'Hjálmdís', 'Hjálmey', 'Hjálmfríður', 'Hjálmgerður', 'Hjálmrós', 'Hjálmrún', 'Hjálmveig', 'Hjördís', 'Hjörfríður', 'Hjörleif', 'Hjörný', 'Hjörtfríður', 'Hlaðgerður', 'Hlédís', 'Hlíf', 'Hlín', 'Hlökk', 'Hólmbjörg', 'Hólmdís', 'Hólmfríður', 'Hrafna', 'Hrafnborg', 'Hrafndís', 'Hrafney', 'Hrafngerður', 'Hrafnheiður', 'Hrafnhildur', 'Hrafnkatla', 'Hrafnlaug', 'Hrafntinna', 'Hraundís', 'Hrefna', 'Hreindís', 'Hróðný', 'Hrólfdís', 'Hrund', 'Hrönn', 'Hugbjörg', 'Hugbjört', 'Hugborg', 'Hugdís', 'Hugljúf', 'Hugrún', 'Huld', 'Hulda', 'Huldís', 'Huldrún', 'Húnbjörg', 'Húndís', 'Húngerður', 'Hvönn', 'Hödd', 'Högna', 'Hörn', 'Ida', 'Idda', 'Iða', 'Iðunn', 'Ilmur', 'Immý', 'Ina', 'Inda', 'India', 'Indiana', 'Indía', 'Indíana', 'Indíra', 'Indra', 'Inga', 'Ingdís', 'Ingeborg', 'Inger', 'Ingey', 'Ingheiður', 'Inghildur', 'Ingibjörg', 'Ingibjört', 'Ingiborg', 'Ingifinna', 'Ingifríður', 'Ingigerður', 'Ingilaug', 'Ingileif', 'Ingilín', 'Ingimaría', 'Ingimunda', 'Ingiríður', 'Ingirós', 'Ingisól', 'Ingiveig', 'Ingrid', 'Ingrún', 'Ingunn', 'Ingveldur', 'Inna', 'Irena', 'Irene', 'Irja', 'Irma', 'Irmý', 'Irpa', 'Isabel', 'Isabella', 'Ãda', 'Ãma', 'Ãna', 'Ãr', 'Ãren', 'Ãrena', 'Ãris', 'Ãrunn', 'Ãsabel', 'Ãsabella', 'Ãsadóra', 'Ãsafold', 'Ãsalind', 'Ãsbjörg', 'Ãsdís', 'Ãsey', 'Ãsfold', 'Ãsgerður', 'Ãshildur', 'Ãsis', 'Ãslaug', 'Ãsleif', 'Ãsmey', 'Ãsold', 'Ãsól', 'Ãsrún', 'Ãssól', 'Ãsveig', 'Ãunn', 'Ãva', 'Jakobína', 'Jana', 'Jane', 'Janetta', 'Jannika', 'Jara', 'Jarún', 'Jarþrúður', 'Jasmín', 'Járnbrá', 'Járngerður', 'Jenetta', 'Jenna', 'Jenný', 'Jensína', 'Jessý', 'Jovina', 'Jóa', 'Jóanna', 'Jódís', 'Jófríður', 'Jóhanna', 'Jólín', 'Jóna', 'Jónanna', 'Jónasína', 'Jónbjörg', 'Jónbjört', 'Jóndís', 'Jóndóra', 'Jóney', 'Jónfríður', 'Jóngerð', 'Jónheiður', 'Jónhildur', 'Jóninna', 'Jónída', 'Jónína', 'Jónný', 'Jóný', 'Jóra', 'Jóríður', 'Jórlaug', 'Jórunn', 'Jósebína', 'Jósefín', 'Jósefína', 'Judith', 'Júdea', 'Júdit', 'Júlía', 'Júlíana', 'Júlíanna', 'Júlíetta', 'Júlírós', 'Júnía', 'Júníana', 'Jökla', 'Jökulrós', 'Jörgína', 'Kaðlín', 'Kaja', 'Kalla', 'Kamilla', 'Kamí', 'Kamma', 'Kapitola', 'Kapítóla', 'Kara', 'Karen', 'Karin', 'Karitas', 'Karí', 'Karín', 'Karína', 'Karítas', 'Karla', 'Karlinna', 'Karlína', 'Karlotta', 'Karolína', 'Karó', 'Karólín', 'Karólína', 'Kassandra', 'Kata', 'Katarína', 'Katerína', 'Katharina', 'Kathinka', 'Katinka', 'Katla', 'Katrín', 'Katrína', 'Katý', 'Kára', 'Kellý', 'Kendra', 'Ketilbjörg', 'Ketilfríður', 'Ketilríður', 'Kiddý', 'Kira', 'Kirsten', 'Kirstín', 'Kittý', 'Kjalvör', 'Klara', 'Kládía', 'Klementína', 'Kleópatra', 'Kolbjörg', 'Kolbrá', 'Kolbrún', 'Koldís', 'Kolfinna', 'Kolfreyja', 'Kolgríma', 'Kolka', 'Konkordía', 'Konný', 'Korka', 'Kormlöð', 'Kornelía', 'Kókó', 'Krista', 'Kristbjörg', 'Kristborg', 'Kristel', 'Kristensa', 'Kristey', 'Kristfríður', 'Kristgerður', 'Kristin', 'Kristine', 'Kristíana', 'Kristíanna', 'Kristín', 'Kristína', 'Kristjana', 'Kristjóna', 'Kristlaug', 'Kristlind', 'Kristlín', 'Kristný', 'Kristólína', 'Kristrós', 'Kristrún', 'Kristveig', 'Kristvina', 'Kristþóra', 'Kría', 'Kæja', 'Laila', 'Laíla', 'Lana', 'Lara', 'Laufey', 'Laufheiður', 'Laufhildur', 'Lauga', 'Laugey', 'Laugheiður', 'Lára', 'Lárensína', 'Láretta', 'Lárey', 'Lea', 'Leikný', 'Leila', 'Lena', 'Leonóra', 'Leóna', 'Leónóra', 'Lilja', 'Liljá', 'Liljurós', 'Lill', 'Lilla', 'Lillian', 'Lillý', 'Lily', 'Lilý', 'Lind', 'Linda', 'Linddís', 'Lingný', 'Lisbeth', 'Listalín', 'Liv', 'Líba', 'Líf', 'Lífdís', 'Lín', 'Lína', 'Línbjörg', 'Líndís', 'Líneik', 'Líney', 'Línhildur', 'Lísa', 'Lísabet', 'Lísandra', 'Lísbet', 'Lísebet', 'Lív', 'Ljósbjörg', 'Ljósbrá', 'Ljótunn', 'Lofn', 'Loftveig', 'Logey', 'Lokbrá', 'Lotta', 'Louisa', 'Lousie', 'Lovísa', 'Lóa', 'Lóreley', 'Lukka', 'Lúcía', 'Lúðvíka', 'Lúísa', 'Lúna', 'Lúsinda', 'Lúsía', 'Lúvísa', 'Lydia', 'Lydía', 'Lyngheiður', 'Lýdía', 'Læla', 'Maddý', 'Magda', 'Magdalena', 'Magðalena', 'Magga', 'Maggey', 'Maggý', 'Magna', 'Magndís', 'Magnea', 'Magnes', 'Magney', 'Magnfríður', 'Magnheiður', 'Magnhildur', 'Magnúsína', 'Magný', 'Magnþóra', 'Maía', 'Maídís', 'Maísól', 'Maj', 'Maja', 'Malen', 'Malena', 'Malía', 'Malín', 'Malla', 'Manda', 'Manúela', 'Mara', 'Mardís', 'Marela', 'Marella', 'Maren', 'Marey', 'Marfríður', 'Margit', 'Margot', 'Margret', 'Margrét', 'Margrjet', 'Margunnur', 'Marheiður', 'Maria', 'Marie', 'Marikó', 'Marinella', 'Marit', 'Marí', 'María', 'Maríam', 'Marían', 'Maríana', 'Maríanna', 'Marín', 'Marína', 'Marínella', 'Maríon', 'Marísa', 'Marísól', 'Marít', 'Maríuerla', 'Marja', 'Markrún', 'Marlaug', 'Marlena', 'Marlín', 'Marlís', 'Marólína', 'Marsa', 'Marselía', 'Marselína', 'Marsibil', 'Marsilía', 'Marsý', 'Marta', 'Martha', 'Martína', 'Mary', 'Marý', 'Matta', 'Mattea', 'Matthea', 'Matthilda', 'Matthildur', 'Matthía', 'Mattíana', 'Mattína', 'Mattý', 'Maxima', 'Mábil', 'Málfríður', 'Málhildur', 'Málmfríður', 'Mánadís', 'Máney', 'Mára', 'Meda', 'Mekkin', 'Mekkín', 'Melinda', 'Melissa', 'Melkorka', 'Melrós', 'Messíana', 'Metta', 'Mey', 'Mikaela', 'Mikaelína', 'Mikkalína', 'Milda', 'Mildríður', 'Milla', 'Millý', 'Minerva', 'Minna', 'Minney', 'Minný', 'Miriam', 'Mirja', 'Mirjam', 'Mirra', 'Mist', 'Mía', 'Mínerva', 'Míra', 'Míranda', 'Mítra', 'Mjaðveig', 'Mjalldís', 'Mjallhvít', 'Mjöll', 'Mona', 'Monika', 'Módís', 'Móeiður', 'Móey', 'Móheiður', 'Móna', 'Mónika', 'Móníka', 'Munda', 'Mundheiður', 'Mundhildur', 'Mundína', 'Myrra', 'Mýr', 'Mýra', 'Mýrún', 'Mörk', 'Nadia', 'Nadía', 'Nadja', 'Nana', 'Nanna', 'Nanný', 'Nansý', 'Naomí', 'Naómí', 'Natalie', 'Natalía', 'Náttsól', 'Nella', 'Nellý', 'Nenna', 'Nicole', 'Niðbjörg', 'Nikíta', 'Nikoletta', 'Nikólína', 'Ninja', 'Ninna', 'Nína', 'Níní', 'Njála', 'Njóla', 'Norma', 'Nóa', 'Nóra', 'Nótt', 'Nýbjörg', 'Odda', 'Oddbjörg', 'Oddfreyja', 'Oddfríður', 'Oddgerður', 'Oddhildur', 'Oddlaug', 'Oddleif', 'Oddný', 'Oddrún', 'Oddveig', 'Oddvör', 'Oktavía', 'Októvía', 'Olga', 'Ollý', 'Ora', 'Orka', 'Ormheiður', 'Ormhildur', 'Otkatla', 'Otta', 'Óda', 'Ófelía', 'Óla', 'Ólafía', 'Ólafína', 'Ólavía', 'Ólivía', 'Ólína', 'Ólöf', 'Ósa', 'Ósk', 'Ótta', 'Pamela', 'París', 'Patricia', 'Patrisía', 'Pála', 'Páldís', 'Páley', 'Pálfríður', 'Pálhanna', 'Pálheiður', 'Pálhildur', 'Pálín', 'Pálína', 'Pálmey', 'Pálmfríður', 'Pálrún', 'Perla', 'Peta', 'Petra', 'Petrea', 'Petrína', 'Petronella', 'Petrónella', 'Petrós', 'Petrún', 'Petrúnella', 'Pétrína', 'Pétrún', 'Pía', 'Polly', 'Pollý', 'Pría', 'Rafney', 'Rafnhildur', 'Ragna', 'Ragnbjörg', 'Ragney', 'Ragnfríður', 'Ragnheiður', 'Ragnhildur', 'Rakel', 'Ramóna', 'Randalín', 'Randíður', 'Randý', 'Ranka', 'Rannva', 'Rannveig', 'Ráðhildur', 'Rán', 'Rebekka', 'Reginbjörg', 'Regína', 'Rein', 'Renata', 'Reyn', 'Reyndís', 'Reynheiður', 'Reynhildur', 'Rikka', 'Ripley', 'Rita', 'Ríkey', 'Rín', 'Ríta', 'Ronja', 'Rorí', 'Roxanna', 'Róberta', 'Róbjörg', 'Rós', 'Rósa', 'Rósalind', 'Rósanna', 'Rósbjörg', 'Rósborg', 'Róselía', 'Rósey', 'Rósfríður', 'Róshildur', 'Rósinkara', 'Rósinkransa', 'Róska', 'Róslaug', 'Róslind', 'Róslinda', 'Róslín', 'Rósmary', 'Rósmarý', 'Rósmunda', 'Rósný', 'Runný', 'Rut', 'Ruth', 'Rúbý', 'Rún', 'Rúna', 'Rúndís', 'Rúnhildur', 'Rúrí', 'Röfn', 'Rögn', 'Röskva', 'Sabína', 'Sabrína', 'Saga', 'Salbjörg', 'Saldís', 'Salgerður', 'Salín', 'Salína', 'Salka', 'Salma', 'Salný', 'Salome', 'Salóme', 'Salvör', 'Sandra', 'Sanna', 'Santía', 'Sara', 'Sarína', 'Sefanía', 'Selja', 'Selka', 'Selma', 'Senía', 'Septíma', 'Sera', 'Serena', 'Seselía', 'Sesilía', 'Sesselía', 'Sesselja', 'Sessilía', 'Sif', 'Sigdís', 'Sigdóra', 'Sigfríð', 'Sigfríður', 'Sigga', 'Siggerður', 'Sigmunda', 'Signa', 'Signhildur', 'Signý', 'Sigríður', 'Sigrún', 'Sigurást', 'Sigurásta', 'Sigurbára', 'Sigurbirna', 'Sigurbjörg', 'Sigurbjört', 'Sigurborg', 'Sigurdís', 'Sigurdóra', 'Sigurdríf', 'Sigurdrífa', 'Sigurða', 'Sigurey', 'Sigurfinna', 'Sigurfljóð', 'Sigurgeira', 'Sigurhanna', 'Sigurhelga', 'Sigurhildur', 'Sigurjóna', 'Sigurlaug', 'Sigurleif', 'Sigurlilja', 'Sigurlinn', 'Sigurlín', 'Sigurlína', 'Sigurmunda', 'Sigurnanna', 'Sigurósk', 'Sigurrós', 'Sigursteina', 'Sigurunn', 'Sigurveig', 'Sigurvina', 'Sigurþóra', 'Sigyn', 'Sigþóra', 'Sigþrúður', 'Silfa', 'Silfá', 'Silfrún', 'Silja', 'Silka', 'Silla', 'Silva', 'Silvana', 'Silvía', 'Sirra', 'Sirrý', 'Siv', 'Sía', 'Símonía', 'Sísí', 'Síta', 'Sjöfn', 'Skarpheiður', 'Skugga', 'Skuld', 'Skúla', 'Skúlína', 'Snjáfríður', 'Snjáka', 'Snjófríður', 'Snjólaug', 'Snorra', 'Snót', 'Snæbjörg', 'Snæbjört', 'Snæborg', 'Snæbrá', 'Snædís', 'Snæfríður', 'Snælaug', 'Snærós', 'Snærún', 'Soffía', 'Sofie', 'Sofía', 'Solveig', 'Sonja', 'Sonný', 'Sophia', 'Sophie', 'Sól', 'Sóla', 'Sólbjörg', 'Sólbjört', 'Sólborg', 'Sólbrá', 'Sólbrún', 'Sóldís', 'Sóldögg', 'Sóley', 'Sólfríður', 'Sólgerður', 'Sólhildur', 'Sólín', 'Sólkatla', 'Sóllilja', 'Sólný', 'Sólrós', 'Sólrún', 'Sólveig', 'Sólvör', 'Sónata', 'Stefana', 'Stefanía', 'Stefánný', 'Steina', 'Steinbjörg', 'Steinborg', 'Steindís', 'Steindóra', 'Steiney', 'Steinfríður', 'Steingerður', 'Steinhildur', 'Steinlaug', 'Steinrós', 'Steinrún', 'Steinunn', 'Steinvör', 'Steinþóra', 'Stella', 'Stígheiður', 'Stígrún', 'Stína', 'Stjarna', 'Styrgerður', 'Sumarlína', 'Sumarrós', 'Sunna', 'Sunnefa', 'Sunneva', 'Sunniva', 'Sunníva', 'Susan', 'Súla', 'Súsan', 'Súsanna', 'Svafa', 'Svala', 'Svalrún', 'Svana', 'Svanbjörg', 'Svanbjört', 'Svanborg', 'Svandís', 'Svaney', 'Svanfríður', 'Svanheiður', 'Svanhildur', 'Svanhvít', 'Svanlaug', 'Svanrós', 'Svanþrúður', 'Svava', 'Svea', 'Sveina', 'Sveinbjörg', 'Sveinborg', 'Sveindís', 'Sveiney', 'Sveinfríður', 'Sveingerður', 'Sveinhildur', 'Sveinlaug', 'Sveinrós', 'Sveinrún', 'Sveinsína', 'Sveinveig', 'Sylgja', 'Sylva', 'Sylvía', 'Sæbjörg', 'Sæbjört', 'Sæborg', 'Sædís', 'Sæfinna', 'Sæfríður', 'Sæhildur', 'Sælaug', 'Sæmunda', 'Sæný', 'Særós', 'Særún', 'Sæsól', 'Sæunn', 'Sævör', 'Sölva', 'Sölvey', 'Sölvína', 'Tala', 'Talía', 'Tamar', 'Tamara', 'Tanía', 'Tanja', 'Tanya', 'Tanya', 'Tara', 'Tea', 'Teitný', 'Tekla', 'Telma', 'Tera', 'Teresa', 'Teresía', 'Thea', 'Thelma', 'Theodóra', 'Theódóra', 'Theresa', 'Tindra', 'Tinna', 'Tirsa', 'Tía', 'Tíbrá', 'Tína', 'Todda', 'Torbjörg', 'Torfey', 'Torfheiður', 'Torfhildur', 'Tóbý', 'Tóka', 'Tóta', 'Tristana', 'Trú', 'Tryggva', 'Tryggvína', 'Týra', 'Ugla', 'Una', 'Undína', 'Unna', 'Unnbjörg', 'Unndís', 'Unnur', 'Urður', 'Úa', 'Úlfa', 'Úlfdís', 'Úlfey', 'Úlfheiður', 'Úlfhildur', 'Úlfrún', 'Úlla', 'Úna', 'Úndína', 'Úranía', 'Úrsúla', 'Vagna', 'Vagnbjörg', 'Vagnfríður', 'Vaka', 'Vala', 'Valbjörg', 'Valbjörk', 'Valbjört', 'Valborg', 'Valdheiður', 'Valdís', 'Valentína', 'Valería', 'Valey', 'Valfríður', 'Valgerða', 'Valgerður', 'Valhildur', 'Valka', 'Vallý', 'Valný', 'Valrós', 'Valrún', 'Valva', 'Valý', 'Valþrúður', 'Vanda', 'Vár', 'Veig', 'Veiga', 'Venus', 'Vera', 'Veronika', 'Verónika', 'Veróníka', 'Vetrarrós', 'Vébjörg', 'Védís', 'Végerður', 'Vélaug', 'Véný', 'Vibeka', 'Victoría', 'Viðja', 'Vigdís', 'Vigný', 'Viktoria', 'Viktoría', 'Vilborg', 'Vildís', 'Vilfríður', 'Vilgerður', 'Vilhelmína', 'Villa', 'Villimey', 'Vilma', 'Vilný', 'Vinbjörg', 'Vinný', 'Vinsý', 'Virginía', 'Víbekka', 'Víf', 'Vígdögg', 'Víggunnur', 'Víóla', 'Víóletta', 'Vísa', 'Von', 'Von', 'Voney', 'Vordís', 'Ylfa', 'Ylfur', 'Ylja', 'Ylva', 'Ynja', 'Yrja', 'Yrsa', 'Ãja', 'Ãma', 'Ãr', 'Ãrr', 'Þalía', 'Þeba', 'Þeódís', 'Þeódóra', 'Þjóðbjörg', 'Þjóðhildur', 'Þoka', 'Þorbjörg', 'Þorfinna', 'Þorgerður', 'Þorgríma', 'Þorkatla', 'Þorlaug', 'Þorleif', 'Þorsteina', 'Þorstína', 'Þóra', 'Þóranna', 'Þórarna', 'Þórbjörg', 'Þórdís', 'Þórða', 'Þórelfa', 'Þórelfur', 'Þórey', 'Þórfríður', 'Þórgunna', 'Þórgunnur', 'Þórhalla', 'Þórhanna', 'Þórheiður', 'Þórhildur', 'Þórkatla', 'Þórlaug', 'Þórleif', 'Þórný', 'Þórodda', 'Þórsteina', 'Þórsteinunn', 'Þórstína', 'Þórunn', 'Þórveig', 'Þórvör', 'Þrá', 'Þrúða', 'Þrúður', 'Þula', 'Þura', 'Þurí', 'Þuríður', 'Þurý', 'Þúfa', 'Þyri', 'Þyrí', 'Þöll', 'Ægileif', 'Æsa', 'Æsgerður', 'Ögmunda', 'Ögn', 'Ölrún', 'Ölveig', 'Örbrún', 'Örk', 'Ösp'); + + /** + * @var string Icelandic men names. + */ + protected static $firstNameMale = array('Aage', 'Abel', 'Abraham', 'Adam', 'Addi', 'Adel', 'Adíel', 'Adólf', 'Adrían', 'Adríel', 'Aðalberg', 'Aðalbergur', 'Aðalbert', 'Aðalbjörn', 'Aðalborgar', 'Aðalgeir', 'Aðalmundur', 'Aðalráður', 'Aðalsteinn', 'Aðólf', 'Agnar', 'Agni', 'Albert', 'Aldar', 'Alex', 'Alexander', 'Alexíus', 'Alfons', 'Alfred', 'Alfreð', 'Ali', 'Allan', 'Alli', 'Almar', 'Alrekur', 'Alvar', 'Alvin', 'Amír', 'Amos', 'Anders', 'Andreas', 'André', 'Andrés', 'Andri', 'Anes', 'Anfinn', 'Angantýr', 'Angi', 'Annar', 'Annarr', 'Annas', 'Annel', 'Annes', 'Anthony', 'Anton', 'Antoníus', 'Aran', 'Arent', 'Ares', 'Ari', 'Arilíus', 'Arinbjörn', 'Aríel', 'Aríus', 'Arnald', 'Arnaldur', 'Arnar', 'Arnberg', 'Arnbergur', 'Arnbjörn', 'Arndór', 'Arnes', 'Arnfinnur', 'Arnfreyr', 'Arngeir', 'Arngils', 'Arngrímur', 'Arnkell', 'Arnlaugur', 'Arnleifur', 'Arnljótur', 'Arnmóður', 'Arnmundur', 'Arnoddur', 'Arnold', 'Arnór', 'Arnsteinn', 'Arnúlfur', 'Arnviður', 'Arnþór', 'Aron', 'Arthur', 'Arthúr', 'Artúr', 'Asael', 'Askur', 'Aspar', 'Atlas', 'Atli', 'Auðbergur', 'Auðbert', 'Auðbjörn', 'Auðgeir', 'Auðkell', 'Auðmundur', 'Auðólfur', 'Auðun', 'Auðunn', 'Austar', 'Austmann', 'Austmar', 'Austri', 'Axel', 'Ãgúst', 'Ãki', 'Ãlfar', 'Ãlfgeir', 'Ãlfgrímur', 'Ãlfur', 'Ãlfþór', 'Ãmundi', 'Ãrbjartur', 'Ãrbjörn', 'Ãrelíus', 'Ãrgeir', 'Ãrgils', 'Ãrmann', 'Ãrni', 'Ãrsæll', 'Ãs', 'Ãsberg', 'Ãsbergur', 'Ãsbjörn', 'Ãsgautur', 'Ãsgeir', 'Ãsgils', 'Ãsgrímur', 'Ãsi', 'Ãskell', 'Ãslaugur', 'Ãslákur', 'Ãsmar', 'Ãsmundur', 'Ãsólfur', 'Ãsröður', 'Ãstbjörn', 'Ãstgeir', 'Ãstmar', 'Ãstmundur', 'Ãstráður', 'Ãstríkur', 'Ãstvald', 'Ãstvaldur', 'Ãstvar', 'Ãstvin', 'Ãstþór', 'Ãsvaldur', 'Ãsvarður', 'Ãsþór', 'Baldur', 'Baldvin', 'Baldwin', 'Baltasar', 'Bambi', 'Barði', 'Barri', 'Bassi', 'Bastían', 'Baugur', 'Bárður', 'Beinir', 'Beinteinn', 'Beitir', 'Bekan', 'Benedikt', 'Benidikt', 'Benjamín', 'Benoný', 'Benóní', 'Benóný', 'Bent', 'Berent', 'Berg', 'Bergfinnur', 'Berghreinn', 'Bergjón', 'Bergmann', 'Bergmar', 'Bergmundur', 'Bergsteinn', 'Bergsveinn', 'Bergur', 'Bergvin', 'Bergþór', 'Bernhard', 'Bernharð', 'Bernharður', 'Berni', 'Bernódus', 'Bersi', 'Bertel', 'Bertram', 'Bessi', 'Betúel', 'Bill', 'Birgir', 'Birkir', 'Birnir', 'Birtingur', 'Birtir', 'Bjargar', 'Bjargmundur', 'Bjargþór', 'Bjarkan', 'Bjarkar', 'Bjarki', 'Bjarmar', 'Bjarmi', 'Bjarnar', 'Bjarnfinnur', 'Bjarnfreður', 'Bjarnharður', 'Bjarnhéðinn', 'Bjarni', 'Bjarnlaugur', 'Bjarnleifur', 'Bjarnólfur', 'Bjarnsteinn', 'Bjarnþór', 'Bjartmann', 'Bjartmar', 'Bjartur', 'Bjartþór', 'Bjólan', 'Bjólfur', 'Björgmundur', 'Björgólfur', 'Björgúlfur', 'Björgvin', 'Björn', 'Björnólfur', 'Blængur', 'Blær', 'Blævar', 'Boði', 'Bogi', 'Bolli', 'Borgar', 'Borgúlfur', 'Borgþór', 'Bóas', 'Bói', 'Bótólfur', 'Bragi', 'Brandur', 'Breki', 'Bresi', 'Brestir', 'Brimar', 'Brimi', 'Brimir', 'Brími', 'Brjánn', 'Broddi', 'Bruno', 'Bryngeir', 'Brynjar', 'Brynjólfur', 'Brynjúlfur', 'Brynleifur', 'Brynsteinn', 'Bryntýr', 'Brynþór', 'Burkni', 'Búi', 'Búri', 'Bæring', 'Bæringur', 'Bæron', 'Böðvar', 'Börkur', 'Carl', 'Cecil', 'Christian', 'Christopher', 'Cýrus', 'Daði', 'Dagbjartur', 'Dagfari', 'Dagfinnur', 'Daggeir', 'Dagmann', 'Dagnýr', 'Dagur', 'Dagþór', 'Dalbert', 'Dalli', 'Dalmann', 'Dalmar', 'Dalvin', 'Damjan', 'Dan', 'Danelíus', 'Daniel', 'Danival', 'Daníel', 'Daníval', 'Dante', 'Daríus', 'Darri', 'Davíð', 'Demus', 'Deníel', 'Dennis', 'Diðrik', 'Díómedes', 'Dofri', 'Dolli', 'Dominik', 'Dómald', 'Dómaldi', 'Dómaldur', 'Dónald', 'Dónaldur', 'Dór', 'Dóri', 'Dósóþeus', 'Draupnir', 'Dreki', 'Drengur', 'Dufgus', 'Dufþakur', 'Dugfús', 'Dúi', 'Dúnn', 'Dvalinn', 'Dýri', 'Dýrmundur', 'Ebbi', 'Ebeneser', 'Ebenezer', 'Eberg', 'Edgar', 'Edilon', 'Edílon', 'Edvard', 'Edvin', 'Edward', 'Eðvald', 'Eðvar', 'Eðvarð', 'Efraím', 'Eggert', 'Eggþór', 'Egill', 'Eiðar', 'Eiður', 'Eikar', 'Eilífur', 'Einar', 'Einir', 'Einvarður', 'Einþór', 'Eiríkur', 'Eivin', 'Elberg', 'Elbert', 'Eldar', 'Eldgrímur', 'Eldjárn', 'Eldmar', 'Eldon', 'Eldór', 'Eldur', 'Elentínus', 'Elfar', 'Elfráður', 'Elimar', 'Elinór', 'Elis', 'Elí', 'Elías', 'Elíeser', 'Elímar', 'Elínbergur', 'Elínmundur', 'Elínór', 'Elís', 'Ellert', 'Elli', 'Elliði', 'Ellís', 'Elmar', 'Elvar', 'Elvin', 'Elvis', 'Emanúel', 'Embrek', 'Emerald', 'Emil', 'Emmanúel', 'Engilbert', 'Engilbjartur', 'Engiljón', 'Engill', 'Enok', 'Eric', 'Erik', 'Erlar', 'Erlendur', 'Erling', 'Erlingur', 'Ernestó', 'Ernir', 'Ernst', 'Eron', 'Erpur', 'Esekíel', 'Esjar', 'Esra', 'Estefan', 'Evald', 'Evan', 'Evert', 'Eyberg', 'Eyjólfur', 'Eylaugur', 'Eyleifur', 'Eymar', 'Eymundur', 'Eyríkur', 'Eysteinn', 'Eyvar', 'Eyvindur', 'Eyþór', 'Fabrisíus', 'Falgeir', 'Falur', 'Fannar', 'Fannberg', 'Fanngeir', 'Fáfnir', 'Fálki', 'Felix', 'Fengur', 'Fenrir', 'Ferdinand', 'Ferdínand', 'Fertram', 'Feykir', 'Filip', 'Filippus', 'Finn', 'Finnbjörn', 'Finnbogi', 'Finngeir', 'Finnjón', 'Finnlaugur', 'Finnur', 'Finnvarður', 'Fífill', 'Fjalar', 'Fjarki', 'Fjólar', 'Fjólmundur', 'Fjölnir', 'Fjölvar', 'Fjörnir', 'Flemming', 'Flosi', 'Flóki', 'Flórent', 'Flóvent', 'Forni', 'Fossmar', 'Fólki', 'Francis', 'Frank', 'Franklín', 'Frans', 'Franz', 'Fránn', 'Frár', 'Freybjörn', 'Freygarður', 'Freymar', 'Freymóður', 'Freymundur', 'Freyr', 'Freysteinn', 'Freyviður', 'Freyþór', 'Friðberg', 'Friðbergur', 'Friðbert', 'Friðbjörn', 'Friðfinnur', 'Friðgeir', 'Friðjón', 'Friðlaugur', 'Friðleifur', 'Friðmann', 'Friðmar', 'Friðmundur', 'Friðrik', 'Friðsteinn', 'Friður', 'Friðvin', 'Friðþjófur', 'Friðþór', 'Friedrich', 'Fritz', 'Frímann', 'Frosti', 'Fróði', 'Fróðmar', 'Funi', 'Fúsi', 'Fylkir', 'Gabriel', 'Gabríel', 'Gael', 'Galdur', 'Gamalíel', 'Garðar', 'Garibaldi', 'Garpur', 'Garri', 'Gaui', 'Gaukur', 'Gauti', 'Gautrekur', 'Gautur', 'Gautviður', 'Geir', 'Geirarður', 'Geirfinnur', 'Geirharður', 'Geirhjörtur', 'Geirhvatur', 'Geiri', 'Geirlaugur', 'Geirleifur', 'Geirmundur', 'Geirólfur', 'Geirröður', 'Geirtryggur', 'Geirvaldur', 'Geirþjófur', 'Geisli', 'Gellir', 'Georg', 'Gerald', 'Gerðar', 'Geri', 'Gestur', 'Gilbert', 'Gilmar', 'Gils', 'Gissur', 'Gizur', 'Gídeon', 'Gígjar', 'Gísli', 'Gjúki', 'Glói', 'Glúmur', 'Gneisti', 'Gnúpur', 'Gnýr', 'Goði', 'Goðmundur', 'Gottskálk', 'Gottsveinn', 'Gói', 'Grani', 'Grankell', 'Gregor', 'Greipur', 'Greppur', 'Gretar', 'Grettir', 'Grétar', 'Grímar', 'Grímkell', 'Grímlaugur', 'Grímnir', 'Grímólfur', 'Grímur', 'Grímúlfur', 'Guðberg', 'Guðbergur', 'Guðbjarni', 'Guðbjartur', 'Guðbjörn', 'Guðbrandur', 'Guðfinnur', 'Guðfreður', 'Guðgeir', 'Guðjón', 'Guðlaugur', 'Guðleifur', 'Guðleikur', 'Guðmann', 'Guðmar', 'Guðmon', 'Guðmundur', 'Guðni', 'Guðráður', 'Guðröður', 'Guðsteinn', 'Guðvarður', 'Guðveigur', 'Guðvin', 'Guðþór', 'Gumi', 'Gunnar', 'Gunnberg', 'Gunnbjörn', 'Gunndór', 'Gunngeir', 'Gunnhallur', 'Gunnlaugur', 'Gunnleifur', 'Gunnólfur', 'Gunnóli', 'Gunnröður', 'Gunnsteinn', 'Gunnvaldur', 'Gunnþór', 'Gustav', 'Gutti', 'Guttormur', 'Gústaf', 'Gústav', 'Gylfi', 'Gyrðir', 'Gýgjar', 'Gýmir', 'Haddi', 'Haddur', 'Hafberg', 'Hafgrímur', 'Hafliði', 'Hafnar', 'Hafni', 'Hafsteinn', 'Hafþór', 'Hagalín', 'Hagbarður', 'Hagbert', 'Haki', 'Hallberg', 'Hallbjörn', 'Halldór', 'Hallfreður', 'Hallgarður', 'Hallgeir', 'Hallgils', 'Hallgrímur', 'Hallkell', 'Hallmann', 'Hallmar', 'Hallmundur', 'Hallsteinn', 'Hallur', 'Hallvarður', 'Hallþór', 'Hamar', 'Hannes', 'Hannibal', 'Hans', 'Harald', 'Haraldur', 'Harri', 'Harry', 'Harrý', 'Hartmann', 'Hartvig', 'Hauksteinn', 'Haukur', 'Haukvaldur', 'Hákon', 'Háleygur', 'Hálfdan', 'Hálfdán', 'Hámundur', 'Hárekur', 'Hárlaugur', 'Hásteinn', 'Hávar', 'Hávarður', 'Hávarr', 'Hávarr', 'Heiðar', 'Heiðarr', 'Heiðberg', 'Heiðbert', 'Heiðlindur', 'Heiðmann', 'Heiðmar', 'Heiðmundur', 'Heiðrekur', 'Heikir', 'Heilmóður', 'Heimir', 'Heinrekur', 'Heisi', 'Hektor', 'Helgi', 'Helmút', 'Hemmert', 'Hendrik', 'Henning', 'Henrik', 'Henry', 'Henrý', 'Herbert', 'Herbjörn', 'Herfinnur', 'Hergeir', 'Hergill', 'Hergils', 'Herjólfur', 'Herlaugur', 'Herleifur', 'Herluf', 'Hermann', 'Hermóður', 'Hermundur', 'Hersir', 'Hersteinn', 'Hersveinn', 'Hervar', 'Hervarður', 'Hervin', 'Héðinn', 'Hilaríus', 'Hilbert', 'Hildar', 'Hildibergur', 'Hildibrandur', 'Hildigeir', 'Hildiglúmur', 'Hildimar', 'Hildimundur', 'Hildingur', 'Hildir', 'Hildiþór', 'Hilmar', 'Hilmir', 'Himri', 'Hinrik', 'Híram', 'Hjallkár', 'Hjalti', 'Hjarnar', 'Hjálmar', 'Hjálmgeir', 'Hjálmtýr', 'Hjálmur', 'Hjálmþór', 'Hjörleifur', 'Hjörtur', 'Hjörtþór', 'Hjörvar', 'Hleiðar', 'Hlégestur', 'Hlér', 'Hlini', 'Hlíðar', 'Hlíðberg', 'Hlífar', 'Hljómur', 'Hlynur', 'Hlöðmundur', 'Hlöður', 'Hlöðvarður', 'Hlöðver', 'Hnefill', 'Hnikar', 'Hnikarr', 'Holgeir', 'Holger', 'Holti', 'Hólm', 'Hólmar', 'Hólmbert', 'Hólmfastur', 'Hólmgeir', 'Hólmgrímur', 'Hólmkell', 'Hólmsteinn', 'Hólmþór', 'Hóseas', 'Hrafn', 'Hrafnar', 'Hrafnbergur', 'Hrafnkell', 'Hrafntýr', 'Hrannar', 'Hrappur', 'Hraunar', 'Hreggviður', 'Hreiðar', 'Hreiðmar', 'Hreimur', 'Hreinn', 'Hringur', 'Hrímnir', 'Hrollaugur', 'Hrolleifur', 'Hróaldur', 'Hróar', 'Hróbjartur', 'Hróðgeir', 'Hróðmar', 'Hróðólfur', 'Hróðvar', 'Hrói', 'Hrólfur', 'Hrómundur', 'Hrútur', 'Hrærekur', 'Hugberg', 'Hugi', 'Huginn', 'Hugleikur', 'Hugo', 'Hugó', 'Huldar', 'Huxley', 'Húbert', 'Húgó', 'Húmi', 'Húnbogi', 'Húni', 'Húnn', 'Húnröður', 'Hvannar', 'Hyltir', 'Hylur', 'Hængur', 'Hænir', 'Höður', 'Högni', 'Hörður', 'Höskuldur', 'Illugi', 'Immanúel', 'Indriði', 'Ingberg', 'Ingi', 'Ingiberg', 'Ingibergur', 'Ingibert', 'Ingibjartur', 'Ingibjörn', 'Ingileifur', 'Ingimagn', 'Ingimar', 'Ingimundur', 'Ingivaldur', 'Ingiþór', 'Ingjaldur', 'Ingmar', 'Ingólfur', 'Ingvaldur', 'Ingvar', 'Ingvi', 'Ingþór', 'Ismael', 'Issi', 'Ãan', 'Ãgor', 'Ãmi', 'Ãsak', 'Ãsar', 'Ãsarr', 'Ãsbjörn', 'Ãseldur', 'Ãsgeir', 'Ãsidór', 'Ãsleifur', 'Ãsmael', 'Ãsmar', 'Ãsólfur', 'Ãsrael', 'Ãvan', 'Ãvar', 'Jack', 'Jafet', 'Jaki', 'Jakob', 'Jakop', 'Jamil', 'Jan', 'Janus', 'Jarl', 'Jason', 'Járngrímur', 'Játgeir', 'Játmundur', 'Játvarður', 'Jenni', 'Jens', 'Jeremías', 'Jes', 'Jesper', 'Jochum', 'Johan', 'John', 'Joshua', 'Jóakim', 'Jóann', 'Jóel', 'Jóhann', 'Jóhannes', 'Jói', 'Jómar', 'Jómundur', 'Jón', 'Jónar', 'Jónas', 'Jónatan', 'Jónbjörn', 'Jóndór', 'Jóngeir', 'Jónmundur', 'Jónsteinn', 'Jónþór', 'Jósafat', 'Jósavin', 'Jósef', 'Jósep', 'Jósteinn', 'Jósúa', 'Jóvin', 'Julian', 'Júlí', 'Júlían', 'Júlíus', 'Júní', 'Júníus', 'Júrek', 'Jökull', 'Jörfi', 'Jörgen', 'Jörmundur', 'Jörri', 'Jörundur', 'Jörvar', 'Jörvi', 'Kaj', 'Kakali', 'Kaktus', 'Kaldi', 'Kaleb', 'Kali', 'Kalman', 'Kalmann', 'Kalmar', 'Kaprasíus', 'Karel', 'Karim', 'Karkur', 'Karl', 'Karles', 'Karli', 'Karvel', 'Kaspar', 'Kasper', 'Kastíel', 'Katarínus', 'Kató', 'Kár', 'Kári', 'Keran', 'Ketilbjörn', 'Ketill', 'Kilían', 'Kiljan', 'Kjalar', 'Kjallakur', 'Kjaran', 'Kjartan', 'Kjarval', 'Kjárr', 'Kjói', 'Klemens', 'Klemenz', 'Klængur', 'Knútur', 'Knörr', 'Koðrán', 'Koggi', 'Kolbeinn', 'Kolbjörn', 'Kolfinnur', 'Kolgrímur', 'Kolmar', 'Kolskeggur', 'Kolur', 'Kolviður', 'Konráð', 'Konstantínus', 'Kormákur', 'Kornelíus', 'Kort', 'Kópur', 'Kraki', 'Kris', 'Kristall', 'Kristberg', 'Kristbergur', 'Kristbjörn', 'Kristdór', 'Kristens', 'Krister', 'Kristfinnur', 'Kristgeir', 'Kristian', 'Kristinn', 'Kristján', 'Kristjón', 'Kristlaugur', 'Kristleifur', 'Kristmann', 'Kristmar', 'Kristmundur', 'Kristofer', 'Kristófer', 'Kristvaldur', 'Kristvarður', 'Kristvin', 'Kristþór', 'Krummi', 'Kveldúlfur', 'Lambert', 'Lars', 'Laufar', 'Laugi', 'Lauritz', 'Lár', 'Lárent', 'Lárentíus', 'Lárus', 'Leiðólfur', 'Leif', 'Leifur', 'Leiknir', 'Leo', 'Leon', 'Leonard', 'Leonhard', 'Leó', 'Leópold', 'Leví', 'Lér', 'Liljar', 'Lindar', 'Lindberg', 'Línberg', 'Líni', 'Ljósálfur', 'Ljótur', 'Ljúfur', 'Loðmundur', 'Loftur', 'Logi', 'Loki', 'Lórens', 'Lórenz', 'Ludvig', 'Lundi', 'Lúðvíg', 'Lúðvík', 'Lúkas', 'Lúter', 'Lúther', 'Lyngar', 'Lýður', 'Lýtingur', 'Maggi', 'Magngeir', 'Magni', 'Magnús', 'Magnþór', 'Makan', 'Manfred', 'Manfreð', 'Manúel', 'Mar', 'Marbjörn', 'Marel', 'Margeir', 'Margrímur', 'Mari', 'Marijón', 'Marinó', 'Marías', 'Marínó', 'Marís', 'Maríus', 'Marjón', 'Markó', 'Markús', 'Markþór', 'Maron', 'Marri', 'Mars', 'Marsellíus', 'Marteinn', 'Marten', 'Marthen', 'Martin', 'Marvin', 'Mathías', 'Matthías', 'Matti', 'Mattías', 'Max', 'Maximus', 'Máni', 'Már', 'Márus', 'Mekkinó', 'Melkíor', 'Melkólmur', 'Melrakki', 'Mensalder', 'Merkúr', 'Methúsalem', 'Metúsalem', 'Meyvant', 'Michael', 'Mikael', 'Mikjáll', 'Mikkael', 'Mikkel', 'Mildinberg', 'Mías', 'Mímir', 'Míó', 'Mír', 'Mjöllnir', 'Mjölnir', 'Moli', 'Morgan', 'Moritz', 'Mosi', 'Móði', 'Móri', 'Mórits', 'Móses', 'Muggur', 'Muni', 'Muninn', 'Múli', 'Myrkvi', 'Mýrkjartan', 'Mörður', 'Narfi', 'Natan', 'Natanael', 'Nataníel', 'Náttmörður', 'Náttúlfur', 'Neisti', 'Nenni', 'Neptúnus', 'Nicolas', 'Nikanor', 'Nikolai', 'Nikolas', 'Nikulás', 'Nils', 'Níels', 'Níls', 'Njáll', 'Njörður', 'Nonni', 'Norbert', 'Norðmann', 'Normann', 'Nóam', 'Nóel', 'Nói', 'Nóni', 'Nóri', 'Nóvember', 'Númi', 'Nývarð', 'Nökkvi', 'Oddbergur', 'Oddbjörn', 'Oddfreyr', 'Oddgeir', 'Oddi', 'Oddkell', 'Oddleifur', 'Oddmar', 'Oddsteinn', 'Oddur', 'Oddvar', 'Oddþór', 'Oktavíus', 'Októ', 'Októvíus', 'Olaf', 'Olav', 'Olgeir', 'Oliver', 'Olivert', 'Orfeus', 'Ormar', 'Ormur', 'Orri', 'Orvar', 'Otkell', 'Otri', 'Otti', 'Ottó', 'Otur', 'Óðinn', 'Ófeigur', 'Ólafur', 'Óli', 'Óliver', 'Ólíver', 'Ómar', 'Ómi', 'Óskar', 'Ósvald', 'Ósvaldur', 'Ósvífur', 'Óttar', 'Óttarr', 'Parmes', 'Patrek', 'Patrekur', 'Patrick', 'Patrik', 'Páll', 'Pálmar', 'Pálmi', 'Pedró', 'Per', 'Peter', 'Pétur', 'Pjetur', 'Príor', 'Rafael', 'Rafn', 'Rafnar', 'Rafnkell', 'Ragnar', 'Ragúel', 'Randver', 'Rannver', 'Rasmus', 'Ráðgeir', 'Ráðvarður', 'Refur', 'Reginbaldur', 'Reginn', 'Reidar', 'Reifnir', 'Reimar', 'Reinar', 'Reinhart', 'Reinhold', 'Reynald', 'Reynar', 'Reynir', 'Reyr', 'Richard', 'Rikharð', 'Rikharður', 'Ríkarður', 'Ríkharð', 'Ríkharður', 'Ríó', 'Robert', 'Rolf', 'Ronald', 'Róbert', 'Rólant', 'Róman', 'Rómeó', 'Rósant', 'Rósar', 'Rósberg', 'Rósenberg', 'Rósi', 'Rósinberg', 'Rósinkar', 'Rósinkrans', 'Rósmann', 'Rósmundur', 'Rudolf', 'Runi', 'Runólfur', 'Rúbar', 'Rúben', 'Rúdólf', 'Rúnar', 'Rúrik', 'Rútur', 'Röðull', 'Rögnvald', 'Rögnvaldur', 'Rögnvar', 'Rökkvi', 'Safír', 'Sakarías', 'Salmann', 'Salmar', 'Salómon', 'Salvar', 'Samson', 'Samúel', 'Sandel', 'Sandri', 'Sandur', 'Saxi', 'Sebastian', 'Sebastían', 'Seifur', 'Seimur', 'Sesar', 'Sesil', 'Sigbergur', 'Sigbert', 'Sigbjartur', 'Sigbjörn', 'Sigdór', 'Sigfastur', 'Sigfinnur', 'Sigfreður', 'Sigfús', 'Siggeir', 'Sighvatur', 'Sigjón', 'Siglaugur', 'Sigmann', 'Sigmar', 'Sigmundur', 'Signar', 'Sigri', 'Sigríkur', 'Sigsteinn', 'Sigtryggur', 'Sigtýr', 'Sigur', 'Sigurbaldur', 'Sigurberg', 'Sigurbergur', 'Sigurbjarni', 'Sigurbjartur', 'Sigurbjörn', 'Sigurbrandur', 'Sigurdór', 'Sigurður', 'Sigurfinnur', 'Sigurgeir', 'Sigurgestur', 'Sigurgísli', 'Sigurgrímur', 'Sigurhans', 'Sigurhjörtur', 'Sigurjón', 'Sigurkarl', 'Sigurlaugur', 'Sigurlás', 'Sigurleifur', 'Sigurliði', 'Sigurlinni', 'Sigurmann', 'Sigurmar', 'Sigurmon', 'Sigurmundur', 'Sigurnýas', 'Sigurnýjas', 'Siguroddur', 'Siguróli', 'Sigurpáll', 'Sigursteinn', 'Sigursveinn', 'Sigurvaldi', 'Sigurvin', 'Sigurþór', 'Sigvaldi', 'Sigvarður', 'Sigþór', 'Silli', 'Sindri', 'Símon', 'Sírnir', 'Sírus', 'Sívar', 'Sjafnar', 'Skafti', 'Skapti', 'Skarphéðinn', 'Skefill', 'Skeggi', 'Skíði', 'Skírnir', 'Skjöldur', 'Skorri', 'Skuggi', 'Skúli', 'Skúta', 'Skær', 'Skæringur', 'Smári', 'Smiður', 'Smyrill', 'Snjóki', 'Snjólaugur', 'Snjólfur', 'Snorri', 'Snæbjartur', 'Snæbjörn', 'Snæhólm', 'Snælaugur', 'Snær', 'Snæringur', 'Snævar', 'Snævarr', 'Snæþór', 'Soffanías', 'Sophanías', 'Sophus', 'Sófónías', 'Sófus', 'Sókrates', 'Sólberg', 'Sólbergur', 'Sólbjartur', 'Sólbjörn', 'Sólimann', 'Sólmar', 'Sólmundur', 'Sólon', 'Sólver', 'Sólvin', 'Spartakus', 'Sporði', 'Spói', 'Stanley', 'Stapi', 'Starkaður', 'Starri', 'Stefan', 'Stefán', 'Stefnir', 'Steinar', 'Steinarr', 'Steinberg', 'Steinbergur', 'Steinbjörn', 'Steindór', 'Steinfinnur', 'Steingrímur', 'Steini', 'Steinkell', 'Steinmann', 'Steinmar', 'Steinmóður', 'Steinn', 'Steinólfur', 'Steinröður', 'Steinvarður', 'Steinþór', 'Stirnir', 'Stígur', 'Stormur', 'Stórólfur', 'Sturla', 'Sturlaugur', 'Sturri', 'Styr', 'Styrbjörn', 'Styrkár', 'Styrmir', 'Styrr', 'Sumarliði', 'Svafar', 'Svali', 'Svan', 'Svanberg', 'Svanbergur', 'Svanbjörn', 'Svangeir', 'Svanhólm', 'Svani', 'Svanlaugur', 'Svanmundur', 'Svanur', 'Svanþór', 'Svavar', 'Sváfnir', 'Sveinar', 'Sveinberg', 'Sveinbjartur', 'Sveinbjörn', 'Sveinjón', 'Sveinlaugur', 'Sveinmar', 'Sveinn', 'Sveinungi', 'Sveinþór', 'Svend', 'Sverre', 'Sverrir', 'Svölnir', 'Svörfuður', 'Sýrus', 'Sæberg', 'Sæbergur', 'Sæbjörn', 'Sæi', 'Sælaugur', 'Sæmann', 'Sæmundur', 'Sær', 'Sævald', 'Sævaldur', 'Sævar', 'Sævarr', 'Sævin', 'Sæþór', 'Sölmundur', 'Sölvar', 'Sölvi', 'Sören', 'Sörli', 'Tandri', 'Tarfur', 'Teitur', 'Theodór', 'Theódór', 'Thomas', 'Thor', 'Thorberg', 'Thór', 'Tindar', 'Tindri', 'Tindur', 'Tinni', 'Tími', 'Tímon', 'Tímoteus', 'Tímóteus', 'Tístran', 'Tjaldur', 'Tjörfi', 'Tjörvi', 'Tobías', 'Tolli', 'Tonni', 'Torfi', 'Tóbías', 'Tói', 'Tóki', 'Tómas', 'Tór', 'Trausti', 'Tristan', 'Trostan', 'Trúmann', 'Tryggvi', 'Tumas', 'Tumi', 'Tyrfingur', 'Týr', 'Ubbi', 'Uggi', 'Ulrich', 'Uni', 'Unnar', 'Unnbjörn', 'Unndór', 'Unnsteinn', 'Unnþór', 'Urðar', 'Uxi', 'Úddi', 'Úlfar', 'Úlfgeir', 'Úlfhéðinn', 'Úlfkell', 'Úlfljótur', 'Úlftýr', 'Úlfur', 'Úlrik', 'Úranus', 'Vagn', 'Vakur', 'Valberg', 'Valbergur', 'Valbjörn', 'Valbrandur', 'Valdemar', 'Valdi', 'Valdimar', 'Valdór', 'Valentín', 'Valentínus', 'Valgarð', 'Valgarður', 'Valgeir', 'Valíant', 'Vallaður', 'Valmar', 'Valmundur', 'Valsteinn', 'Valter', 'Valtýr', 'Valur', 'Valves', 'Valþór', 'Varmar', 'Vatnar', 'Váli', 'Vápni', 'Veigar', 'Veigur', 'Ver', 'Vermundur', 'Vernharð', 'Vernharður', 'Vestar', 'Vestmar', 'Veturliði', 'Vébjörn', 'Végeir', 'Vékell', 'Vélaugur', 'Vémundur', 'Vésteinn', 'Victor', 'Viðar', 'Vigfús', 'Viggó', 'Vignir', 'Vigri', 'Vigtýr', 'Vigur', 'Vikar', 'Viktor', 'Vilberg', 'Vilbergur', 'Vilbert', 'Vilbjörn', 'Vilbogi', 'Vilbrandur', 'Vilgeir', 'Vilhelm', 'Vilhjálmur', 'Vili', 'Viljar', 'Vilji', 'Villi', 'Vilmar', 'Vilmundur', 'Vincent', 'Vinjar', 'Virgill', 'Víðar', 'Víðir', 'Vífill', 'Víglundur', 'Vígmar', 'Vígmundur', 'Vígsteinn', 'Vígþór', 'Víkingur', 'Vopni', 'Vorm', 'Vöggur', 'Völundur', 'Vörður', 'Vöttur', 'Walter', 'Werner', 'Wilhelm', 'Willard', 'William', 'Willum', 'Ylur', 'Ymir', 'Yngvar', 'Yngvi', 'Yrkill', 'Ãmir', 'Ãrar', 'Zakaría', 'Zakarías', 'Zophanías', 'Zophonías', 'Zóphanías', 'Zóphonías', 'Þangbrandur', 'Þengill', 'Þeyr', 'Þiðrandi', 'Þiðrik', 'Þinur', 'Þjálfi', 'Þjóðann', 'Þjóðbjörn', 'Þjóðgeir', 'Þjóðleifur', 'Þjóðmar', 'Þjóðólfur', 'Þjóðrekur', 'Þjóðvarður', 'Þjóstar', 'Þjóstólfur', 'Þorberg', 'Þorbergur', 'Þorbjörn', 'Þorbrandur', 'Þorfinnur', 'Þorgarður', 'Þorgautur', 'Þorgeir', 'Þorgestur', 'Þorgils', 'Þorgísl', 'Þorgnýr', 'Þorgrímur', 'Þorkell', 'Þorlaugur', 'Þorlákur', 'Þorleifur', 'Þorleikur', 'Þormar', 'Þormóður', 'Þormundur', 'Þorri', 'Þorsteinn', 'Þorvaldur', 'Þorvar', 'Þorvarður', 'Þór', 'Þórar', 'Þórarinn', 'Þórbergur', 'Þórbjörn', 'Þórður', 'Þórgnýr', 'Þórgrímur', 'Þórhaddur', 'Þórhalli', 'Þórhallur', 'Þórir', 'Þórlaugur', 'Þórleifur', 'Þórlindur', 'Þórmar', 'Þórmundur', 'Þóroddur', 'Þórormur', 'Þórólfur', 'Þórsteinn', 'Þórörn', 'Þrastar', 'Þráinn', 'Þrándur', 'Þróttur', 'Þrúðmar', 'Þrymur', 'Þröstur', 'Þyrnir', 'Ægir', 'Æsir', 'Ævar', 'Ævarr', 'Ögmundur', 'Ögri', 'Ölnir', 'Ölver', 'Ölvir', 'Öndólfur', 'Önundur', 'Örlaugur', 'Örlygur', 'Örn', 'Örnólfur', 'Örvar', 'Össur', 'Öxar'); + + /** + * @var string Icelandic middle names. + */ + protected static $middleName = array( + 'Aðaldal', 'Aldan', 'Arnberg', 'Arnfjörð', 'Austan', 'Austdal', 'Austfjörð', 'Ãss', 'Bakkdal', 'Bakkmann', 'Bald', 'Ben', 'Bergholt', 'Bergland', 'Bíldsfells', 'Bjarg', 'Bjarndal', 'Bjarnfjörð', 'Bláfeld', 'Blómkvist', 'Borgdal', 'Brekkmann', 'Brim', 'Brúnsteð', 'Dalhoff', 'Dan', 'Diljan', 'Ektavon', 'Eldberg', 'Elísberg', 'Elvan', 'Espólín', 'Eyhlíð', 'Eyvík', 'Falk', 'Finndal', 'Fossberg', 'Freydal', 'Friðhólm', 'Giljan', 'Gilsfjörð', 'Gnarr', 'Gnurr', 'Grendal', 'Grindvík', 'Gull', 'Haffjörð', 'Hafnes', 'Hafnfjörð', 'Har', 'Heimdal', 'Heimsberg', 'Helgfell', 'Herberg', 'Hildiberg', 'Hjaltdal', 'Hlíðkvist', 'Hnappdal', 'Hnífsdal', 'Hofland', 'Hofteig', 'Hornfjörð', 'Hólmberg', 'Hrafnan', 'Hrafndal', 'Hraunberg', 'Hreinberg', 'Hreindal', 'Hrútfjörð', 'Hvammdal', 'Hvítfeld', 'Höfðdal', 'Hörðdal', 'Ãshólm', 'Júl', 'Kjarrval', 'Knaran', 'Knarran', 'Krossdal', 'Laufkvist', 'Laufland', 'Laugdal', 'Laxfoss', 'Liljan', 'Linddal', 'Línberg', 'Ljós', 'Loðmfjörð', 'Lyngberg', 'Magdal', 'Magg', 'Matt', 'Miðdal', 'Miðvík', 'Mjófjörð', 'Móberg', 'Mýrmann', 'Nesmann', 'Norðland', 'Núpdal', 'Ólfjörð', 'Ósland', 'Ósmann', 'Reginbald', 'Reykfell', 'Reykfjörð', 'Reynholt', 'Salberg', 'Sandhólm', 'Seljan', 'Sigurhólm', 'Skagalín', 'Skíðdal', 'Snæberg', 'Snædahl', 'Sólan', 'Stardal', 'Stein', 'Steinbekk', 'Steinberg', 'Storm', 'Straumberg', 'Svanhild', 'Svarfdal', 'Sædal', 'Val', 'Valagils', 'Vald', 'Varmdal', 'Vatnsfjörð', 'Vattar', 'Vattnes', 'Viðfjörð', 'Vídalín', 'Víking', 'Vopnfjörð', 'Yngling', 'Þor', 'Önfjörð', 'Örbekk', 'Öxdal', 'Öxndal' + ); + + /** + * Randomly return a icelandic middle name. + * + * @return string + */ + public static function middleName() + { + return static::randomElement(static::$middleName); + } + + /** + * Generate prepared last name for further processing + * + * @return string + */ + public function lastName() + { + $name = static::firstNameMale(); + + if (substr($name, -2) === 'ur') { + $name = substr($name, 0, strlen($name) - 2); + } + + if (substr($name, -1) !== 's') { + $name .= 's'; + } + + return $name; + } + + /** + * Randomly return a icelandic last name for woman. + * + * @return string + */ + public function lastNameMale() + { + return $this->lastName().'son'; + } + + /** + * Randomly return a icelandic last name for man. + * + * @return string + */ + public function lastNameFemale() + { + return $this->lastName().'dóttir'; + } + + /** + * Randomly return a icelandic Kennitala (Social Security number) format. + * + * @link http://en.wikipedia.org/wiki/Kennitala + * + * @return string + */ + public static function ssn() + { + // random birth date + $birthdate = new \DateTime('@' . mt_rand(0, time())); + + // last four buffer + $lastFour = null; + + // security variable reference + $ref = '32765432'; + + // valid flag + $valid = false; + + while (! $valid) { + // make two random numbers + $rand = static::randomDigit().static::randomDigit(); + + // 8 char string with birth date and two random numbers + $tmp = $birthdate->format('dmy').$rand; + + // loop through temp string + for ($i = 7, $sum = 0; $i >= 0; $i--) { + // calculate security variable + $sum += ($tmp[$i] * $ref[$i]); + } + + // subtract 11 if not 11 + $chk = ($sum % 11 === 0) ? 0 : (11 - ($sum % 11)); + + if ($chk < 10) { + $lastFour = $rand.$chk.substr($birthdate->format('Y'), 1, 1); + + $valid = true; + } + } + + return sprintf('%s-%s', $birthdate->format('dmy'), $lastFour); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/PhoneNumber.php new file mode 100644 index 0000000..de91f74 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/is_IS/PhoneNumber.php @@ -0,0 +1,20 @@ + + */ +class PhoneNumber extends \Faker\Provider\PhoneNumber +{ + /** + * @var array Icelandic phone number formats. + */ + protected static $formats = array( + '+354 ### ####', + '+354 #######', + '+354#######', + '### ####', + '#######', + ); +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Address.php new file mode 100644 index 0000000..1eee3b6 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Address.php @@ -0,0 +1,139 @@ + 'Argovia'), + array('AI' => 'Appenzello Interno'), + array('AR' => 'Appenzello Esterno'), + array('BE' => 'Berna'), + array('BL' => 'Basilea Campagna'), + array('BS' => 'Basilea Città'), + array('FR' => 'Friburgo'), + array('GE' => 'Ginevra'), + array('GL' => 'Glarona'), + array('GR' => 'Grigioni'), + array('JU' => 'Giura'), + array('LU' => 'Lucerna'), + array('NE' => 'Neuchâtel'), + array('NW' => 'Nidvaldo'), + array('OW' => 'Obvaldo'), + array('SG' => 'San Gallo'), + array('SH' => 'Sciaffusa'), + array('SO' => 'Soletta'), + array('SZ' => 'Svitto'), + array('TG' => 'Turgovia'), + array('TI' => 'Ticino'), + array('UR' => 'Uri'), + array('VD' => 'Vaud'), + array('VS' => 'Vallese'), + array('ZG' => 'Zugo'), + array('ZH' => 'Zurigo') + ); + + protected static $cityFormats = array( + '{{cityName}}', + ); + + protected static $streetNameFormats = array( + '{{streetSuffix}} {{firstName}}', + '{{streetSuffix}} {{lastName}}' + ); + + protected static $streetAddressFormats = array( + '{{streetName}} {{buildingNumber}}', + ); + protected static $addressFormats = array( + "{{streetAddress}}\n{{postcode}} {{city}}", + ); + + /** + * Returns a random street prefix + * @example Via + * @return string + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Returns a random city name. + * @example Luzern + * @return string + */ + public function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Returns a canton + * @example array('BE' => 'Bern') + * @return array + */ + public static function canton() + { + return static::randomElement(static::$canton); + } + + /** + * Returns the abbreviation of a canton. + * @return string + */ + public static function cantonShort() + { + $canton = static::canton(); + return key($canton); + } + + /** + * Returns the name of canton. + * @return string + */ + public static function cantonName() + { + $canton = static::canton(); + return current($canton); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Company.php new file mode 100644 index 0000000..9a42b1c --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/it_CH/Company.php @@ -0,0 +1,15 @@ +generator->parse($format); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Company.php new file mode 100644 index 0000000..937f375 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Company.php @@ -0,0 +1,17 @@ +generator->parse($format)); + } + + /** + * @example 'yamada.jp' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Person.php new file mode 100644 index 0000000..0db2db0 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/Person.php @@ -0,0 +1,141 @@ +generator->parse($format); + } + + /** + * @param string|null $gender 'male', 'female' or null for any + * @return string + * @example 'アキラ' + */ + public function firstKanaName($gender = null) + { + if ($gender === static::GENDER_MALE) { + return static::firstKanaNameMale(); + } elseif ($gender === static::GENDER_FEMALE) { + return static::firstKanaNameFemale(); + } + + return $this->generator->parse(static::randomElement(static::$firstKanaNameFormat)); + } + + /** + * @example 'アキラ' + */ + public static function firstKanaNameMale() + { + return static::randomElement(static::$firstKanaNameMale); + } + + /** + * @example 'アケミ' + */ + public static function firstKanaNameFemale() + { + return static::randomElement(static::$firstKanaNameFemale); + } + + /** + * @example 'アオタ' + */ + public static function lastKanaName() + { + return static::randomElement(static::$lastKanaName); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/PhoneNumber.php new file mode 100644 index 0000000..9f03c56 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ja_JP/PhoneNumber.php @@ -0,0 +1,19 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefixes); + } + + public static function companyNameElement() + { + return static::randomElement(static::$companyElements); + } + + public static function companyNameSuffix() + { + return static::randomElement(static::$companyNameSuffixes); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/DateTime.php b/vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/DateTime.php new file mode 100644 index 0000000..1a1a4dd --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/DateTime.php @@ -0,0 +1,42 @@ + 'კვირáƒ', + 'Monday' => 'áƒáƒ áƒ¨áƒáƒ‘áƒáƒ—ი', + 'Tuesday' => 'სáƒáƒ›áƒ¨áƒáƒ‘áƒáƒ—ი', + 'Wednesday' => 'áƒáƒ—ხშáƒáƒ‘áƒáƒ—ი', + 'Thursday' => 'ხუთშáƒáƒ‘áƒáƒ—ი', + 'Friday' => 'პáƒáƒ áƒáƒ¡áƒ™áƒ”ვი', + 'Saturday' => 'შáƒáƒ‘áƒáƒ—ი', + ); + $week = static::dateTime($max)->format('l'); + return isset($map[$week]) ? $map[$week] : $week; + } + + public static function monthName($max = 'now') + { + $map = array( + 'January' => 'იáƒáƒœáƒ•áƒáƒ áƒ˜', + 'February' => 'თებერვáƒáƒšáƒ˜', + 'March' => 'მáƒáƒ áƒ¢áƒ˜', + 'April' => 'áƒáƒžáƒ áƒ˜áƒšáƒ˜', + 'May' => 'მáƒáƒ˜áƒ¡áƒ˜', + 'June' => 'ივნისი', + 'July' => 'ივლისი', + 'August' => 'áƒáƒ’ვისტáƒ', + 'September' => 'სექტემბერი', + 'October' => 'áƒáƒ¥áƒ¢áƒáƒ›áƒ‘ერი', + 'November' => 'ნáƒáƒ”მბერი', + 'December' => 'დეკემბერი', + ); + $month = static::dateTime($max)->format('F'); + return isset($map[$month]) ? $map[$month] : $month; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/Internet.php new file mode 100644 index 0000000..01b15c7 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ka_GE/Internet.php @@ -0,0 +1,15 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefixes); + } + + public static function companyNameElement() + { + return static::randomElement(static::$companyElements); + } + + public static function companyNameSuffix() + { + return static::randomElement(static::$companyNameSuffixes); + } + + /** + * National Business Identification Numbers + * + * @link http://egov.kz/wps/portal/Content?contentPath=%2Fegovcontent%2Fbus_business%2Ffor_businessmen%2Farticle%2Fbusiness_identification_number&lang=en + * @param \DateTime $registrationDate + * @return string 12 digits, like 150140000019 + */ + public static function businessIdentificationNumber(\DateTime $registrationDate = null) + { + if (!$registrationDate) { + $registrationDate = \Faker\Provider\DateTime::dateTimeThisYear(); + } + + $dateAsString = $registrationDate->format('ym'); + $legalEntityType = (string) static::numberBetween(4, 6); + $legalEntityAdditionalType = (string) static::numberBetween(0, 3); + $randomDigits = (string) static::numerify('######'); + + return $dateAsString . $legalEntityType . $legalEntityAdditionalType . $randomDigits; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/Internet.php new file mode 100644 index 0000000..75999c2 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/Internet.php @@ -0,0 +1,9 @@ + array( + self::CENTURY_19TH => self::MALE_CENTURY_19TH, + self::CENTURY_20TH => self::MALE_CENTURY_20TH, + self::CENTURY_21ST => self::MALE_CENTURY_21ST, + ), + self::GENDER_FEMALE => array( + self::CENTURY_19TH => self::FEMALE_CENTURY_19TH, + self::CENTURY_20TH => self::FEMALE_CENTURY_20TH, + self::CENTURY_21ST => self::FEMALE_CENTURY_21ST, + ), + ); + + /** + * @see https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%B7%D0%B0%D1%85%D1%81%D0%BA%D0%B0%D1%8F_%D1%84%D0%B0%D0%BC%D0%B8%D0%BB%D0%B8%D1%8F + * + * @var array + */ + protected static $maleNameFormats = array( + '{{lastName}}ұлы {{firstNameMale}}', + ); + + /** + * @see https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%B7%D0%B0%D1%85%D1%81%D0%BA%D0%B0%D1%8F_%D1%84%D0%B0%D0%BC%D0%B8%D0%BB%D0%B8%D1%8F + * + * @var array + */ + protected static $femaleNameFormats = array( + '{{lastName}}қызы {{firstNameFemale}}', + ); + + /** + * @see http://koshpendi.kz/index.php/nomad/imena/ + * + * @var array + */ + protected static $firstNameMale = array( + 'Ðылғазы', + 'Әбдіқадыр', + 'Бабағожа', + 'ҒайÑа', + 'Дәмен', + 'Егізбек', + 'Жазылбек', + 'Зұлпықар', + 'ИгіÑін', + 'Кәдіржан', + 'Қадырқан', + 'Латиф', + 'Мағаз', + 'Ðармағамбет', + 'Оңалбай', + 'ӨндіріÑ', + 'Пердебек', + 'Рақат', + 'Сағындық', + 'Танабай', + 'УайыÑ', + 'Ұйықбай', + 'Үрімбай', + 'Файзрахман', + 'Хангелді', + 'Шаттық', + 'ЫÑтамбақы', + 'Ібни', + ); + + /** + * @see http://koshpendi.kz/index.php/nomad/imena/ + * + * @var array + */ + protected static $firstNameFemale = array( + 'ÐÑылтаÑ', + 'Әужа', + 'Бүлдіршін', + 'Гүлшаш', + 'Ғафура', + 'Ділдә', + 'Еркежан', + 'Жібек', + 'Зылиқа', + 'Ирада', + 'КүнÑұлу', + 'Қырмызы', + 'Ләтипа', + 'Мүштәри', + 'Ðұршара', + 'Орынша', + 'ӨрзиÑ', + 'Перизат', + 'РухиÑ', + 'Сындыбала', + 'ТұрÑынай', + 'УәÑима', + 'ҰрқиÑ', + 'ҮриÑ', + 'Фируза', + 'Хафиза', + 'Шырынгүл', + 'ЫрыÑÑ‚Ñ‹', + 'Іңкәр', + ); + + /** + * @see http://koshpendi.kz/index.php/nomad/imena/ + * @see https://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%B7%D0%B0%D1%85%D1%81%D0%BA%D0%B0%D1%8F_%D1%84%D0%B0%D0%BC%D0%B8%D0%BB%D0%B8%D1%8F + * + * @var array + */ + protected static $lastName = array( + 'Ðдырбай', + 'Әжібай', + 'Байбөрі', + 'Ғизат', + 'Ділдабек', + 'Ешмұхамбет', + 'Жігер', + 'ЗікіриÑ', + 'ИÑа', + 'Кунту', + 'Қыдыр', + 'Лұқпан', + 'Мышырбай', + 'ÐÑ‹Ñынбай', + 'Ошақбай', + 'Өтетілеу', + 'Пірәлі', + 'РүÑтем', + 'Сырмұхамбет', + 'ТілеміÑ', + 'Уәлі', + 'Ұлықбек', + 'Ò®Ñтем', + 'Фахир', + 'Ð¥Ò±Ñайын', + 'Шілдебай', + 'ЫÑтамбақы', + 'ІÑмет', + ); + + /** + * @param integer $year + * + * @return integer|null + */ + private static function getCenturyByYear($year) + { + if ($year >= 2000 && $year <= DateTime::year()) { + return self::CENTURY_21ST; + } elseif ($year >= 1900) { + return self::CENTURY_20TH; + } elseif ($year >= 1800) { + return self::CENTURY_19TH; + } + } + + /** + * National Individual Identification Numbers + * + * @link http://egov.kz/wps/portal/Content?contentPath=%2Fegovcontent%2Fcitizen_migration%2Fpassport_id_card%2Farticle%2Fiin_info&lang=en + * @link https://ru.wikipedia.org/wiki/%D0%98%D0%BD%D0%B4%D0%B8%D0%B2%D0%B8%D0%B4%D1%83%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9_%D0%B8%D0%B4%D0%B5%D0%BD%D1%82%D0%B8%D1%84%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9_%D0%BD%D0%BE%D0%BC%D0%B5%D1%80 + * + * @param \DateTime $birthDate + * @param integer $gender + * + * @return string 12 digits, like 780322300455 + */ + public static function individualIdentificationNumber(\DateTime $birthDate = null, $gender = self::GENDER_MALE) + { + if (!$birthDate) { + $birthDate = DateTime::dateTimeBetween(); + } + + do { + $population = mt_rand(1000, 2000); + $century = self::getCenturyByYear((int) $birthDate->format('Y')); + + $iin = $birthDate->format('ymd'); + $iin .= (string) self::$genderCenturyMap[$gender][$century]; + $iin .= (string) $population; + $checksum = self::checkSum($iin); + } while ($checksum === 10); + + return $iin . (string) $checksum; + } + + /** + * @param string $iinValue + * + * @return integer + */ + public static function checkSum($iinValue) + { + $controlDigit = self::getControlDigit($iinValue, self::$firstSequenceBitWeights); + + if ($controlDigit === 10) { + return self::getControlDigit($iinValue, self::$secondSequenceBitWeights); + } + + return $controlDigit; + } + + /** + * @param string $iinValue + * @param array $sequence + * + * @return integer + */ + protected static function getControlDigit($iinValue, $sequence) + { + $sum = 0; + + for ($i = 0; $i <= 10; $i++) { + $sum += (int) $iinValue[$i] * $sequence[$i]; + } + + return $sum % 11; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/PhoneNumber.php new file mode 100644 index 0000000..edb38dd --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/kk_KZ/PhoneNumber.php @@ -0,0 +1,16 @@ +generator->parse($format)); + } + + /** + * @example 'kim.kr' + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii) . '.' . $this->tld(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Person.php new file mode 100644 index 0000000..92d858f --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Person.php @@ -0,0 +1,55 @@ +generator->parse($format)); + } + + + + public function cellPhoneNumber() + { + $format = self::randomElement(array_slice(static::$formats, 6, 1)); + + return self::numerify($this->generator->parse($format)); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Text.php b/vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Text.php new file mode 100644 index 0000000..5f5148e --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ko_KR/Text.php @@ -0,0 +1,1723 @@ +ì— ë‚˜ì˜¤ëŠ” ìš”ê·€ì˜ ë¶ˆë¹› 모양으로 푸르무레 하게 í—ˆê³µì„ ë¹„ì¶”ì˜¤. ë™ê²½ì˜ 불바다는 ë‚´ 마ìŒì„ ë”ìš± ìŒì¹¨í•˜ê²Œ 하였소. +ì´ ë•Œì— ë’¤ì—ì„œ, +"모시모시(여보세요)." +하는 소리가 들렸소. ê·¸ê²ƒì€ í° ì €ê³ ë¦¬ë¥¼ ìž…ì€ í˜¸í…” ë³´ì´ì˜€ì†Œ. +"왜?" +하고 나는 고개만 ëŒë ¸ì†Œ. +"ì†ë‹˜ì´ 오셨습니다." +"ì†ë‹˜?" +하고 나는 ë³´ì´ì—게로 í•œ ê±¸ìŒ ê°€ê¹Œì´ ê°”ì†Œ. 나를 ì°¾ì„ ì†ë‹˜ì´ ì–´ë”” 있나 하고 나는 놀란 것ì´ì˜¤. +"따님께서 오셨습니다. 방으로 모셨습니다." +하고 ë³´ì´ëŠ” 들어가 버리고 ë§ì•˜ì†Œ. +"따님?" +하고 나는 ë”ìš± 놀ëžì†Œ. 순임ì´ê°€ 서울서 나를 ë”°ë¼ì™”나? ê·¸ê²ƒì€ ì•ˆ ë  ë§ì´ì˜¤. 순임ì´ê°€ ë‚´ 뒤를 ë”°ë¼ ë– ë‚¬ë”ë¼ë„ 아무리 빨리 ì™€ë„ ë‚´ì¼ì´ 아니면 못 ì™”ì„ ê²ƒì´ì˜¤. 그러면 누군가. ì •ìž„ì¸ê°€. ì •ìž„ì´ê°€ 병ì›ì—ì„œ 뛰어온 것ì¸ê°€. +나는 ë‘근거리는 ê°€ìŠ´ì„ ì–µì§€ë¡œ 진정하면서 ë‚´ ë°©ë¬¸ì„ ì—´ì—ˆì†Œ. +ê·¸ê²ƒì€ ì •ìž„ì´ì—ˆì†Œ. ì •ìž„ì€ ë‚´ê°€ 쓰다가 ë‘” 편지를 ë³´ê³  있다가 벌떡 ì¼ì–´ë‚˜ 내게 달려들어 안겨 버렸소. 나는 얼빠진 ë“¯ì´ ì •ìž„ì´ê°€ 하ë¼ëŠ” 대로 내버려ë‘었소. ê·¸ 편지는 부치려고 ì“´ ê²ƒë„ ì•„ë‹Œë° ê·¸ 편지를 ì •ìž„ì´ê°€ 본 ê²ƒì´ ì•ˆë˜ì—ˆë‹¤ê³  ìƒê°í•˜ì˜€ì†Œ. +형! 나를 ì±…ë§í•˜ì‹œì˜¤. 심히 부ë„러운 ë§ì´ì§€ë§ˆëŠ” 나는 ì •ìž„ì„ íž˜ê» ê»´ì•ˆì•„ 주고 싶었소. 나는 몇 번ì´ë‚˜ ì •ìž„ì˜ ë“±ì„ êµ½ì–´ ë³´ë©´ì„œ ë‚´ íŒ”ì— íž˜ì„ ë„£ìœ¼ë ¤ê³  하였소. ì •ìž„ì€ ì‹¬ížˆ 귀여웠소. ì •ìž„ì´ê°€ 그처럼 나를 사모하는 ê²ƒì´ ì‹¬ížˆ 기뻤소. 나는 ê°ì •ì´ 재우ì³ì„œ ëˆˆì´ ì•ˆ ë³´ì´ê³  ì •ì‹ ì´ ëª½ë¡±í•˜ì—¬ì§ì„ 깨달았소. 나는 아프고 쓰린 듯한 기ì¨ì„ 깨달았소. ì˜ì–´ë¡œ 엑스터시ë¼ë“ ì§€, 한문으로 ë¬´ì•„ì˜ ê²½ì§€ëž€ ì´ëŸ° ê²ƒì´ ì•„ë‹Œê°€ 하였소. 나는 사십 í‰ìƒì— ì´ëŸ¬í•œ ê²½í—˜ì„ ì²˜ìŒ í•œ 것ì´ì˜¤. +형! í˜•ì´ ì•„ì‹œë‹¤ì‹œí”¼ 나는 ë‚´ ì•„ë‚´ ì´ì™¸ì— ì Šì€ ì—¬ì„±ì—게 ì´ë ‡ê²Œ 안겨 본 ì¼ì´ 없소. 물론 안아 본 ì¼ë„ 없소. +그러나 형! 나는 나를 눌렀소. ë‚´ 타오르는 ì• ìš•ì„ ì°¨ë””ì°¬ ì´ì§€ì˜ 입김으로 불어서 ë„려고 애를 ì¼ì†Œ. +"글쎄 웬ì¼ì´ëƒ. 앓는 ê²ƒì´ ì´ ë°¤ì¤‘ì— ë¹„ë¥¼ 맞고 왜 나온단 ë§ì´ëƒ. 철없는 것 같으니." +하고 나는 ì•„ë²„ì§€ì˜ ìœ„ì—„ìœ¼ë¡œ ì •ìž„ì˜ ë‘ ì–´ê¹¨ë¥¼ 붙들어 ì•”ì²´ì–´ì— ì•‰í˜”ì†Œ. 그리고 ë‚˜ë„ í…Œì´ë¸”ì„ í•˜ë‚˜ 세워 ë‘ê³  맞ì€íŽ¸ì— 앉았소. +ì •ìž„ì€ ë¶€ë„러운 ë“¯ì´ ë‘ ì†ìœ¼ë¡œ ë‚¯ì„ ê°€ë¦¬ìš°ê³  ì œ ë¬´ë¦Žì— ì—Žë“œë ¤ 울기를 시작하오. +ì •ìž„ì€ ëˆ„ëŸ° ê°ˆìƒ‰ì˜ ì™¸íˆ¬ë¥¼ 입었소. ë¬´ì—‡ì„ íƒ€ê³  왔는지 모르지마는 구ë‘ì—는 꽤 ë§Žì´ ë¬¼ì´ ë¬»ê³  모ìžì—는 빗방울 ì–¼ë£©ì´ ë³´ì´ì˜¤. +"네가 ì´ëŸ¬ë‹¤ê°€ 다시 ë³‘ì´ ë”치면 어찌한단 ë§ì´ëƒ. ì•„ì´ê°€ 왜 그렇게 ì² ì´ ì—†ë‹ˆ?" +하고 나는 ë”ìš± 냉정한 ì–´ì¡°ë¡œ ì±…ë§í•˜ê³  ë°ìŠ¤í¬ ìœ„ì— ë†“ì¸ ë‚´ 편지 초를 집어 ë°•ë°• 찢어 버렸소. ì¢…ì´ ì°¢ëŠ” ì†Œë¦¬ì— ì •ìž„ì€ ìž ê¹ ê³ ê°œë¥¼ 들어서 처ìŒì—는 ë‚´ ì†ì„ ë³´ê³  다ìŒì—는 ë‚´ ì–¼êµ´ì„ ë³´ì•˜ì†Œ. 그러나 나는 모르는 체하고 ë„ë¡œ êµì˜ì— ëŒì•„와 앉아서 가만히 ëˆˆì„ ê°ì•˜ì†Œ. 그리고 ë„무지 í¥ë¶„ë˜ì§€ 아니한 ëª¨ì–‘ì„ ê¾¸ëª„ì†Œ. +형! 어떻게나 힘드는 ì¼ì´ì˜¤? 참으면 ì°¸ì„ìˆ˜ë¡ ë‚´ ì´ë¹¨ì´ 마주 부딪고, ì–¼êµ´ì˜ ê·¼ìœ¡ì€ ì”°ë£©ê±°ë¦¬ê³  ì†ì€ 불ëˆë¶ˆëˆ ì¥ì–´ì§€ì˜¤. +"ì •ë§ ë‚´ì¼ ê°€ì„¸ìš”?" +하고 아마 오 분 ë™ì•ˆì´ë‚˜ ì¹¨ë¬µì„ ì§€í‚¤ë‹¤ê°€ ì •ìž„ì´ê°€ 고개를 들고 물었소. +"그럼, 가야지." +하고 나는 빙그레 웃어 보였소. +"ì €ë„ ë°ë¦¬ê³  가세요!" +하는 ì •ìž„ì˜ ë§ì€ 마치 ì„œë¦¿ë°œì´ ë‚ ë¦¬ëŠ” 칼날과 같았소. 나는 ê¹œì§ ë†€ë¼ì„œ ì •ìž„ì„ ë°”ë¼ë³´ì•˜ì†Œ. ê·¸ì˜ ëˆˆì€ ë¹›ë‚˜ê³  ìž…ì€ ê¼­ 다물고 ì–¼êµ´ì˜ ê·¼ìœ¡ì€ íŒ½íŒ½í•˜ê²Œ 켕겼소. ì •ìž„ì˜ ì–¼êµ´ì—는 ì°¬ë°”ëžŒì´ ë„는 무서운 ê¸°ìš´ì´ ìžˆì—ˆì†Œ. +나는 즉ê°ì ìœ¼ë¡œ 죽기를 결심한 ì—¬ìžì˜ 모양ì´ë¼ê³  ìƒê°í•˜ì˜€ì†Œ. 열정으로 불ë©ì–´ë¦¬ê°€ ë˜ì—ˆë˜ ì •ìž„ì€ ë‚´ê°€ ë³´ì´ëŠ” 냉랭한 태ë„ë¡œ ë§ë¯¸ì•”ì•„ ê°‘ìžê¸° 얼어 버린 것 같았소. +"어디를?" +하고 나는 ì •ìž„ì˜ `ì €ë„ ë°ë¦¬ê³  가세요.' 하는 담대한 ë§ì— 놀ë¼ë©´ì„œ 물었소. +"어디든지, 아버지 가시는 ë°ë©´ 어디든지 저를 ë°ë¦¬ê³  가세요. 저는 아버지를 떠나서는 혼ìžì„œëŠ” 못 ì‚´ ê²ƒì„ ì§€ë‚˜ê°„ ë°˜ 달 ë™ì•ˆì— 잘 알았습니다. 아까 아버지 오셨다 가신 ë’¤ì— ìƒê°í•´ ë³´ë‹ˆê¹ ì•”ë§Œí•´ë„ ì•„ë²„ì§€ëŠ” 다시 ì €ì—게 와 보시지 아니하고 가실 것만 같애요. 그리고 저로 í•´ì„œ 아버지께서는 무슨 í° íƒ€ê²©ì„ ë‹¹í•˜ì‹  것만 같으셔요. ì²˜ìŒ ëµˆì˜¬ ì ì— ë²Œì¨ ê°€ìŠ´ì´ ëœ¨ë”했습니다. 그리고 ì—¬í–‰ì„ ë– ë‚˜ì‹ ë‹¤ëŠ” ë§ì”€ì„ 듣고는 반드시 무슨 í°ì¼ì´ 나셨ëŠë‹ˆë¼ê³ ë§Œ ìƒê°í–ˆìŠµë‹ˆë‹¤. 그리고 저어, 저로 í•´ì„œ 그러신 것만 같고, 저를 버리시고 í˜¼ìž ê°€ì‹œë ¤ëŠ” 것만 같고, 그래서 달려왔ë”니 여기 ì¨ ë†“ìœ¼ì‹  편지를 ë³´ê³  ê·¸ íŽ¸ì§€ì— ë‹¤ë¥¸ ë§ì”€ì€ ì–´ì°Œ ë든지, 네 ì¼ê¸°ë¥¼ 보았다 하신 ë§ì”€ì„ 보고는 다 알았습니다. 저와 í•œ ë°©ì— ìžˆëŠ” ì• ê°€ ì•”ë§Œí•´ë„ ì–´ë¨¸ë‹ˆ 스파ì¸ê°€ë´ìš”. 제가 ìž…ì›í•˜ê¸° ì „ì—ë„ ì œ 눈치를 슬슬 ë³´ê³  ë˜ ì±…ìƒ ì„œëžë„ 뒤지는 눈치가 ë³´ì´ê¸¸ëž˜ ì¼ê¸°ì±…ì€ ëŠ˜ 쇠 잠그는 ì„œëžì— 넣어 ë‘ì—ˆëŠ”ë° ì•„ë§ˆ 제가 ì •ì‹  ì—†ì´ ì•“ê³  누웠는 ë™ì•ˆì— ì œ 핸드백ì—ì„œ 쇳대를 í›”ì³ ê°”ë˜ê°€ë´ìš”. 그래서는 ê·¸ ì¼ê¸°ì±…ì„ êº¼ë‚´ì„œ 서울로 보냈나ë´ìš”. 그걸루 í•´ì„œ 아버지께서는 불명예스러운 ëˆ„ëª…ì„ ì“°ì‹œê³  í•™êµì¼ë„ 내놓으시게 ë˜ê³  ì§‘ë„ ë– ë‚˜ì‹œê²Œ ë˜ì…¨ë‚˜ë´ìš”. 다시는 ì§‘ì— ì•ˆ ëŒì•„오실 양으로 ê²°ì‹¬ì„ í•˜ì…¨ë‚˜ë´ìš”. 아까 병ì›ì—ì„œë„ í•˜ì‹œëŠ” ë§ì”€ì´ ëª¨ë‘ ìœ ì–¸í•˜ì‹œëŠ” 것만 같아서 í½ ì˜ì‹¬ì„ ê°€ì¡Œì—ˆëŠ”ë° ì§€ê¸ˆ ê·¸ ì“°ì‹œë˜ íŽ¸ì§€ë¥¼ 보고는 다 알았습니다. 그렇지만 그렇지만." +하고 웅변으로 ë‚´ë ¤ ë§í•˜ë˜ ì •ìž„ì€ ê°‘ìžê¸° 복받치는 ì—´ì •ì„ ì´ê¸°ì§€ 못하는 듯ì´, í•œ 번 í•œìˆ¨ì„ ì§€ìš°ê³ , +"그렇지만 저는 아버지를 ë”°ë¼ê°€ìš”. 절루 í•´ì„œ 아버지께서는 ì§‘ë„ ìžƒìœ¼ì‹œê³  ëª…ì˜ˆë„ ìžƒìœ¼ì‹œê³  ì‚¬ì—…ë„ ìžƒìœ¼ì‹œê³  ì¸ìƒì˜ 모든 ê²ƒì„ ë‹¤ 잃으셨으니 저는 아버지를 ë”°ë¼ê°€ìš”. 어디를 가시든지 저는 어린 딸로 아버지를 ë”°ë¼ë‹¤ë‹ˆë‹¤ê°€ 아버지께서 먼저 ëŒì•„가시면 ì €ë„ ë”°ë¼ ì£½ì–´ì„œ 아버지 ë°œ ë°‘ì— ë¬»íž í…Œì•¼ìš”. 제가 먼저 죽거든 제가 ë³‘ì´ ìžˆìœ¼ë‹ˆê¹ ë¬¼ë¡  제가 먼저 죽지요. ì£½ì–´ë„ ì¢‹ìŠµë‹ˆë‹¤. 병ì›ì—ì„œ 앓다가 í˜¼ìž ì£½ëŠ” ê±´ ì‹«ì–´ìš”. 아버지 ê³ì—ì„œ 죽으면 아버지께서, 오 ë‚´ 딸 ì •ìž„ì•„ 하시고 귀해 주시고 불ìŒížˆ 여겨 주시겠지요. 그리고 ì œ ëª¸ì„ ì–´ë””ë“ ì§€ ë•…ì— ë¬»ìœ¼ì‹œê³  `사랑하는 ë‚´ 딸 ì •ìž„ì˜ ë¬´ë¤'ì´ë¼ê³  패ë¼ë„ ì†ìˆ˜ 쓰셔서 세워 주시지 않겠습니까." +하고 ì •ìž„ì€ ë¹„ì­‰ë¹„ì­‰í•˜ë‹¤ê°€ 그만 무릎 ìœ„ì— ì—Žë”ì ¸ 울고 마오. +나는 다만 ì£½ì€ ì‚¬ëžŒ 모양으로 반쯤 ëˆˆì„ ê°ê³  앉아 있었소. 가슴 ì†ì—는 ì •ìž„ì˜ ê³ì—ì„œ 지지 않는 ì—´ì •ì„ í’ˆìœ¼ë©´ì„œë„ ì •ìž„ì˜ ë§ëŒ€ë¡œ ì •ìž„ì„ ë°ë¦¬ê³  ì•„ë¬´ë„ ëª¨ë¥´ëŠ” 곳으로 ê°€ 버리고 ì‹¶ìœ¼ë©´ì„œë„ ë‚˜ëŠ” ì´ ì—´ì •ì˜ ë¶ˆê¸¸ì„ ë‚´ 입김으로 꺼 버리지 아니하면 아니 ë˜ëŠ” 것ì´ì—ˆì†Œ. +"ì•„ì•„, 제가 왜 났어요? 왜 하나님께서 저를 세ìƒì— 보내셨어요? ì•„ë²„ì§€ì˜ ì¼ìƒì„ 파멸시키려 ë‚œ 것ì´ì§€ìš”? 제가 지금 죽어 버려서 ì•„ë²„ì§€ì˜ ëª…ì˜ˆë¥¼ 회복할 수 있다면 저는 죽어 버릴 í„°ì´ì•¼ìš”. 기ì˜ê²Œ 죽어 버리겠습니다. 제가 ì—¬ëŸ ì‚´ë¶€í„° 오늘날까지 ë°›ì€ ì€í˜œë¥¼ ì œ 목숨 하나로 ê°šì„ ìˆ˜ê°€ 있다면 저는 지금으로 죽어 버리겠습니다. 그렇지만 그렇지만……. +그렇지만 그렇지만 저는 다만 얼마ë¼ë„ 다만 하루ë¼ë„ 아버지 ê³ì—ì„œ ì‚´ê³  싶어요 다만 하루만ì´ë¼ë„, 아버지! 제가 왜 ì´ë ‡ìŠµë‹ˆê¹Œ, 네? 제가 어려서 ì´ë ‡ìŠµë‹ˆê¹Œ. 미친 ë…„ì´ ë˜ì–´ì„œ ì´ë ‡ìŠµë‹ˆê¹Œ. 아버지께서는 아실 테니 ë§ì”€í•´ 주세요. 하루만ì´ë¼ë„ 아버지를 모시고 아버지 ê³ì—ì„œ 살았으면 ì£½ì–´ë„ í•œì´ ì—†ê² ìŠµë‹ˆë‹¤. ì œ ìƒê°ì´ 잘못ì´ì•¼ìš”? ì œ ìƒê°ì´ 죄야요? 왜 죄입니까? 아버지, 저를 버리시고 í˜¼ìž ê°€ì‹œì§€ 마세요, 네? `ì •ìž„ì•„, 너를 ë°ë¦¬ê³  가마.' 하고 약ì†í•´ 주세요, 네." +ì •ìž„ì€ ì•„ì£¼ 담대하게 제가 í•˜ê³ ìž í•˜ëŠ” ë§ì„ 다 하오. ê·¸ 얌전한, ìˆ˜ì‚½í•œì •ìž„ì˜ ì†ì— ì–´ë”” 그러한 용기가 있었ë˜ê°€, ì°¸ ì´ìƒí•œ ì¼ì´ì˜¤. 나는 귀여운 어린 계집애 ì •ìž„ì˜ ì†ì— ì—‰í¼í•œ ì—¬ìžê°€ ë“¤ì–´ì•‰ì€ ê²ƒì„ ë°œê²¬í•˜ì˜€ì†Œ. 그가 몇 가지 재료(ë‚´ê°€ ì—¬í–‰ì„ ë– ë‚œë‹¤ëŠ” 것과 ì œ ì¼ê¸°ë¥¼ 보았다는 것)를 종합하여 나와 ì €ì™€ì˜ ìƒˆì—, ë˜ ê·¸ ë•Œë¬¸ì— ì–´ë– í•œ ì¼ì´ ì¼ì–´ë‚œ ê²ƒì„ ì¶”ì¸¡í•˜ëŠ” ê·¸ ìƒìƒë ¥ë„ 놀ëžê±°ë‹ˆì™€ 그렇게 ë‚´ ì•žì—서는 별로 ìž…ë„ ë²Œë¦¬ì§€ ì•„ë‹ˆí•˜ë˜ ê·¸ê°€ ì´ì²˜ëŸ¼ 담대하게 ì œ ì†ì— 있는 ë§ì„ ê±°ë¦¬ë‚Œì—†ì´ ë‹¤ í•´ 버리는 용기를 아니 놀랄 수 없었소. ë‚´ê°€, 사내요 ì–´ë¥¸ì¸ ë‚´ê°€ ë„리어 ì •ìž„ì—게 리드를 받고 ë†€ë¦¼ì„ ë°›ìŒì„ 깨달았소. +그러나 ì •ìž„ì„ ìœ„í•´ì„œë“ ì§€, 중년 남ìžì˜ ìœ„ì‹ ì„ ìœ„í•´ì„œë“ ì§€ 나는 ì˜ì§€ë ¥ìœ¼ë¡œ, ë„ë•ë ¥ìœ¼ë¡œ, ì •ìž„ì„ ëˆ„ë¥´ê³  훈계하지 아니하면 아니 ë˜ê² ë‹¤ê³  ìƒê°í•˜ì˜€ì†Œ. +"ì •ìž„ì•„." +하고 나는 비로소 ìž…ì„ ì—´ì–´ì„œ 불렀소. ë‚´ ì–´ì„±ì€ ìž¥ì¤‘í•˜ì˜€ì†Œ. 나는 í•  수 있는 ìœ„ì—„ì„ ë‹¤í•˜ì—¬ `ì •ìž„ì•„.' 하고 부른 것ì´ì˜¤. +"ì •ìž„ì•„, 네 ì†ì€ 다 알았다. 네 ë§ˆìŒ ë„¤ ëœ»ì€ ê·¸ë§Œí•˜ë©´ 다 알았다. 네가 나를 그처럼 ìƒê°í•´ 주는 ê²ƒì„ ê³ ë§™ê²Œ ìƒê°í•œë‹¤. 기ì˜ê²Œë„ ìƒê°í•œë‹¤. 그러나 ì •ìž„ì•„." +하고 나는 ì¼ì¸µ 태ë„와 소리를 엄숙하게 하여, +"네가 청하는 ë§ì€ 절대로 ë“¤ì„ ìˆ˜ 없는 ë§ì´ë‹¤. ë‚´ê°€ 너를 ì¹œë”¸ê°™ì´ ì‚¬ëž‘í•˜ê¸° ë•Œë¬¸ì— ë‚˜ëŠ” 너를 ë°ë¦¬ê³  가지 못하는 것ì´ë‹¤. 나는 세ìƒì—ì„œ 죽고 ì¡°ì„ ì—ì„œ 죽ë”ë¼ë„ 너는 죽어서 아니 ëœë‹¤. 차마 너까지는 죽ì´ê³  싶지 아니하단 ë§ì´ë‹¤. ë‚´ê°€ ì–´ë”” 가서 없어져 버리면 세ìƒì€ 네게 씌운 ëˆ„ëª…ì´ ì• ë§¤í•œ ì¤„ì„ ì•Œê²Œ ë  ê²ƒì´ ì•„ë‹ˆëƒ. 그리ë˜ë©´ 너는 ì¡°ì„ ì˜ ì¢‹ì€ ì¼ê¾¼ì´ ë˜ì–´ì„œ ì¼ë„ ë§Žì´ í•˜ê³  ë˜ ì‚¬ëž‘í•˜ëŠ” ë‚¨íŽ¸ì„ ë§žì•„ì„œ í–‰ë³µëœ ìƒí™œë„ í•  수 ìžˆì„ ê²ƒì´ ì•„ë‹ˆëƒ. ê·¸ê²ƒì´ ë‚´ê°€ 네게 ë°”ë¼ëŠ” 것ì´ë‹¤. ë‚´ê°€ ì–´ë”” ê°€ 있든지, ë‚´ê°€ ì‚´ì•„ 있는 ë™ì•ˆ 나는 네가 잘ë˜ëŠ” 것만, 행복ë˜ê²Œ 사는 것만 ë°”ë¼ë³´ê³  í˜¼ìž ê¸°ë»í•  ê²ƒì´ ì•„ë‹ˆëƒ. +네가 다 옳게 알았다. 나는 네 ë§ëŒ€ë¡œ ì¡°ì„ ì„ ì˜ì›ížˆ 떠나기로 하였다. 그렇지마는 나는 ì´ë ‡ê²Œ ëœ ê²ƒì„ ì¡°ê¸ˆë„ ìŠ¬í¼í•˜ì§€ 아니한다. 너를 위해서 ë‚´ê°€ 무슨 í¬ìƒì„ 한다고 하면 내게는 ê·¸ê²ƒì´ í° ê¸°ì¨ì´ë‹¤. ê·¸ë¿ ì•„ë‹ˆë¼, 나는 ì¸ì œëŠ” 세ìƒì´ 싫어졌다. ë” ì‚´ê¸°ê°€ 싫어졌다. ë‚´ê°€ ì‹­ì—¬ ë…„ ë™ì•ˆ ì „ìƒëª…ì„ ë°”ì³ì„œ êµìœ¡í•œ í•™ìƒë“¤ì—게까지 ë°°ì²™ì„ ë°›ì„ ë•Œì—는 나는 지금까지 살아온 ê²ƒì„ ìƒê°ë§Œ í•˜ì—¬ë„ ì§„ì €ë¦¬ê°€ 난다. 그렇지마는 나는 ì´ê²ƒì´ 다 ë‚´ê°€ 부족한 ë•Œë¬¸ì¸ ì¤„ì„ ìž˜ 안다. 나는 ì¡°ì„ ì„ ì›ë§í•œë‹¤ë“ ê°€, ë‚´ ë™í¬ë¥¼ ì›ë§í•œë‹¤ë“ ê°€, 그럴 ìƒê°ì€ 없다. ì›ë§ì„ 한다면 나 ìžì‹ ì˜ ë¶€ì¡±ì„ ì›ë§í•  ë¿ì´ë‹¤. ë‚´ê°€ ì›ì²´ êµìœ¡ì„ 한다든지 ë‚¨ì˜ ì§€ë„ìžê°€ ëœë‹¤ë“ ì§€ í•  ìžê²©ì´ ì—†ìŒì„ ì›ë§í•œë‹¤ë©´ ì›ë§í• ê¹Œ, ë‚´ê°€ 어떻게 ì¡°ì„ ì´ë‚˜ ì¡°ì„  ì‚¬ëžŒì„ ì›ë§í•˜ëŠëƒ. 그러니까 ì¸ì œ 내게 ë‚¨ì€ ì¼ì€ 나를 ì¡°ì„ ì—ì„œ 없애 버리는 것ì´ë‹¤. ê°ížˆ ì‹­ì—¬ ë…„ ê°„ êµìœ¡ê°€ë¼ê³  ìžì²˜í•´ ì˜¤ë˜ ê±°ì§“ë˜ê³  ì™¸ëžŒëœ ìƒí™œì„ ëŠì–´ 버리는 것ì´ë‹¤. 남편 ë…¸ë¦‡ë„ ëª» 하고 아버지 ë…¸ë¦‡ë„ ëª» 하는 ì‚¬ëžŒì´ ë‚¨ì˜ ìŠ¤ìŠ¹ì€ ì–´ë–»ê²Œ ë˜ê³  지ë„ìžëŠ” 어떻게 ë˜ëŠëƒ. 하니까 나는 ì´ì œ 세ìƒì„ 떠나 버리는 ê²ƒì´ ì¡°ê¸ˆë„ ìŠ¬í”„ì§€ 아니하고 ë„리어 ëª¸ì´ ê°€ëœ¬í•˜ê³  유쾌해지는 것 같다. +ì˜¤ì§ í•˜ë‚˜ 마ìŒì— 걸리는 ê²ƒì€ ë‚´ ì„ ë°°ìš” 사랑하는 ë™ì§€ì´ë˜ 남 ì„ ìƒì˜ 유ì¼í•œ 혈육ì´ë˜ 네게다가 ëˆ„ëª…ì„ ì”Œìš°ê³  가는 것ì´ë‹¤." +"그게 ì–´ë”” 아버지 잘못입니까?" +하고 ì •ìž„ì€ ìž…ìˆ ì„ ê¹¨ë¬¼ì—ˆì†Œ. +"ëª¨ë‘ ì œê°€ ì² ì´ ì—†ì–´ì„œ ì € 때문ì—……." +하고 ì •ìž„ì€ ëª¸ì„ ë–¨ê³  울었소. +"아니! 그렇게 ìƒê°í•˜ì§€ 마ë¼. ë‚´ê°€ 지금 세ìƒì„ 버릴 ë•Œì— ë¬´ìŠ¨ 기ì¨ì´ í•œ 가지 남는 ê²ƒì´ ìžˆë‹¤ê³  하면 너 하나가, ì´ ì„¸ìƒì—ì„œ ì˜¤ì§ ë„ˆ 하나가 나를 ë”°ë¼ ì£¼ëŠ” 것ì´ë‹¤. 아마 ë„ˆë„ ë‚˜ë¥¼ 잘못 알고 ë”°ë¼ ì£¼ëŠ” 것ì´ê² ì§€ë§ˆëŠ” 세ìƒì´ 다 나를 버리고, 처ìžê¹Œì§€ë„ 다 나를 버릴 ë•Œì— ì˜¤ì§ ë„ˆ 하나가 나를 소중히 알아 주니 ì–´ì°Œ 고맙지 ì•Šê² ëŠëƒ. 그러니까 ì •ìž„ì•„ 너는 ëª¸ì„ ì¡°ì‹¬í•˜ì—¬ì„œ ê±´ê°•ì„ íšŒë³µí•˜ì—¬ì„œ 오래 잘 ì‚´ê³ , 그리고 나를 ìƒê°í•´ 다오." +하고 ë‚˜ë„ ìš¸ì—ˆì†Œ. +형! ë‚´ê°€ ì •ìž„ì—게 ì´ëŸ° ë§ì„ í•œ ê²ƒì´ ìž˜ëª»ì´ì§€ìš”. 그러나 나는 ê·¸ ë•Œì— ì´ëŸ° ë§ì„ 아니 í•  수 없었소. 왜 그런고 하니, ê·¸ê²ƒì´ ë‚´ 진정ì´ë‹ˆê¹Œ. ë‚˜ë„ í•™êµ ì„ ìƒìœ¼ë¡œ, êµìž¥ìœ¼ë¡œ, ë˜ ì£¼ì œë„˜ê²Œ ì§€ì‚¬ë¡œì˜ ì¼ìƒì„ ë³´ë‚´ë…¸ë¼ê³  마치 ì˜¤ì§ ì–¼ìŒ ê°™ì€ ì˜ì§€ë ¥ë§Œ 가진 사람 모양으로 사십 í‰ìƒì„ ì‚´ì•„ 왔지마는 ë‚´ ì†ì—ë„ ì—´ì •ì€ ìžˆì—ˆë˜ ê²ƒì´ì˜¤. 다만 ê·¸ ì—´ì •ì„ ëˆ„ë¥´ê³  죽ì´ê³  ìžˆì—ˆì„ ë¿ì´ì˜¤. 물론 나는 아마 ì¼ìƒì— ì´ ì—´ì •ì˜ ê³ ì‚를 놓아 줄 ë‚ ì´ ì—†ê² ì§€ìš”. ë§Œì¼ ë‚´ê°€ ì´ ì—´ì •ì˜ ê³ ì‚를 놓아서 ìžìœ ë¡œ 달리게 한다고 하면 나는 ì´ ê²½ìš°ì— ì •ìž„ì„ ì•ˆê³ , ë‚´ 열정으로 ì •ìž„ì„ íƒœì›Œ 버렸ì„ëŠ”ì§€ë„ ëª¨ë¥´ì˜¤. 그러나 나는 ì •ìž„ì´ê°€ 열정으로 íƒˆìˆ˜ë¡ ë‚˜ëŠ” ë‚´ ì—´ì •ì˜ ê³ ì‚를 ë‘ ì†ìœ¼ë¡œ 꽉 붙들고 ì´ë¥¼ 악물고 매달릴 ê²°ì‹¬ì„ í•œ 것ì´ì˜¤. +ì—´í•œ ì‹œ! +"ì •ìž„ì•„. ì¸ì œ 병ì›ìœ¼ë¡œ 가거ë¼." +하고 나는 엄연하게 명령하였소. +"ë‚´ì¼ ì €ë¥¼ 보시고 떠나시지요?" +하고 ì •ìž„ì€ ëˆˆë¬¼ì„ ì”»ê³  물었소. +"그럼, Jì¡°êµìˆ˜ë„ 만나고 ë„ˆë„ ë³´ê³  떠나지." +하고 나는 거짓ë§ì„ 하였소. ì´ ê²½ìš°ì— ë‚´ê°€ 거짓ë§ìŸì´ë¼ëŠ” í° ì£„ì¸ì´ ë˜ëŠ” ê²ƒì´ ì •ìž„ì—게 대하여 ì •ìž„ì„ ìœ„í•˜ì—¬ 가장 ì˜³ì€ ì¼ì´ë¼ê³  ìƒê°í•œ 까닭ì´ì˜¤. +ì •ìž„ì€, 무서운 ì§ê°ë ¥ê³¼ ìƒìƒë ¥ì„ 가진 ì •ìž„ì€ ë‚´ ë§ì˜ ì§„ì‹¤ì„±ì„ ì˜ì‹¬í•˜ëŠ” ë“¯ì´ ë‚˜ë¥¼ 뚫어지게 ë°”ë¼ë³´ì•˜ì†Œ. 나는 차마 ì •ìž„ì˜ ì‹œì„ ì„ ë§ˆì£¼ 보지 못하여 외면하여 버렸소. +ì •ìž„ì€ ìˆ˜ê±´ìœ¼ë¡œ ëˆˆë¬¼ì„ ì”»ê³  ì²´ê²½ ì•žì— ê°€ì„œ í™”ìž¥ì„ ê³ ì¹˜ê³  그리고, +"저는 가요." +하고 ë‚´ ì•žì— í—ˆë¦¬ë¥¼ 굽혀서 작별 ì¸ì‚¬ë¥¼ 하였소. +"오, ê°€ ìžê±°ë¼." +하고 나는 극히 범연하게 대답하였소. 나는 ìžë¦¬ì˜·ì„ 입었기 ë•Œë¬¸ì— í˜„ê´€ê¹Œì§€ 작별할 ìˆ˜ë„ ì—†ì–´ì„œ ë³´ì´ë¥¼ 불러 ìžë™ì°¨ë¥¼ 하나 준비하ë¼ê³  명하고 ë‚´ ë°©ì—ì„œ 작별할 ìƒê°ì„ 하였소. +"ë‚´ì¼ ë³‘ì›ì— 오세요?" +하고 ì •ìž„ì€ ê³ ê°œë¥¼ 숙ì´ê³  낙루하였소. +"오, 가마." +하고 나는 ë˜ ê±°ì§“ë§ì„ 하였소. 세ìƒì„ 버리기로 결심한 ì‚¬ëžŒì˜ ê±°ì§“ë§ì€ í•˜ë‚˜ë‹˜ê»˜ì„œë„ ìš©ì„œí•˜ì‹œê² ì§€ìš”. 설사 ë‚´ê°€ 거짓ë§ì„ í•œ 죄로 ì§€ì˜¥ì— ê°„ë‹¤ 하ë”ë¼ë„ ì´ ê²½ìš°ì— ì •ìž„ì„ ìœ„í•˜ì—¬ 거짓ë§ì„ 아니 í•  수가 없지 않소? ë‚´ê°€ 거짓ë§ì„ 아니 하면 ì •ìž„ì€ ì•„ë‹ˆ ê°ˆ ê²ƒì´ ë¶„ëª…í•˜ì˜€ì†Œ. +"ì „ 가요." +하고 ì •ìž„ì€ ë˜ í•œ 번 ì ˆì„ í•˜ì˜€ìœ¼ë‚˜ 소리를 ë‚´ì–´ì„œ 울었소. +"울지 마ë¼! 몸 ìƒí•œë‹¤." +하고 나는 ì •ìž„ì—게 대한 ìµœí›„ì˜ ì¹œì ˆì„ ì •ìž„ì˜ ê³ì— í•œ ê±¸ìŒ ê°€ê¹Œì´ ê°€ì„œ 어깨를 ë˜ë‹¥ë˜ë‹¥í•˜ì—¬ 주고, 외투를 입혀 주었소. +"안녕히 주무세요." +하고 ì •ìž„ì€ ë¬¸ì„ ì—´ê³  나가 버렸소. +ì •ìž„ì˜ ê±¸ì–´ê°€ëŠ” 소리가 차차 멀어졌소. +나는 얼빠진 사람 모양으로 ê·¸ ìžë¦¬ì— ìš°ë‘커니 ì„œ 있었소. +ì°½ì— ë¶€ë”ªížˆëŠ” ë¹—ë°œ 소리가 들리고 ìžë™ì°¨ 소리가 먼 나ë¼ì—ì„œ 오는 ê²ƒê°™ì´ ë“¤ë¦¬ì˜¤. ì´ê²ƒì´ ì •ìž„ì´ê°€ 타고 가는 ìžë™ì°¨ 소리ì¸ê°€. 나는 ì •ìž„ì„ ë”°ë¼ê°€ì„œ 붙들어 오고 싶었소. ë‚´ 몸과 마ìŒì€ ì •ìž„ì„ ë”°ë¼ì„œ í—ˆê³µì— ë– ê°€ëŠ” 것 같았소. +ì•„ì•„ ì´ë ‡ê²Œ 나는 ì •ìž„ì„ ê³ì— ë‘ê³  싶ì„까. ì´ë ‡ê²Œ ë‚´ê°€ ì •ìž„ì˜ ê³ì— 있고 싶ì„까. 그러하건마는 나는 ì •ìž„ì„ ë–¼ì–´ 버리고 가지 아니하면 아니 ëœë‹¤! ê·¸ê²ƒì€ ì• ë“는 ì¼ì´ë‹¤. 기막히는 ì¼ì´ë‹¤! 그러나 ë‚´ ë„ë•ì  ì±…ìž„ì€ ì—„ì •í•˜ê²Œ 그렇게 명령하지 ì•ŠëŠëƒ. 나는 ì´ ë„ë•ì  ì±…ìž„ì˜ ëª…ë ¹ ê·¸ê²ƒì€ ë”위가 없는 명령ì´ë‹¤ ì„ í„¸ë만치ë¼ë„ 휘어서는 아니 ëœë‹¤. +그러나 ì •ìž„ì´ê°€ 호텔 현관까지 ìžë™ì°¨ë¥¼ 타기 ì „ì— í•œ 번만 ë” ë°”ë¼ë³´ëŠ” ê²ƒë„ ëª» í•  ì¼ì¼ê¹Œ. í•œ 번만, ìž ê¹ë§Œ ë” ë°”ë¼ë³´ëŠ” ê²ƒë„ ëª» í•  ì¼ì¼ê¹Œ. ìž ê¹ë§Œ ì¼ ë¶„ë§Œ 아니 ì¼ ì´ˆë§Œ í•œ 시그마ë¼ëŠ” 극히 ì§§ì€ ë™ì•ˆë§Œ ë°”ë¼ë³´ëŠ” ê²ƒë„ ëª» í•  ì¼ì¼ê¹Œ. 아니, ì •ìž„ì„ í•œ 시그마 ë™ì•ˆë§Œ ë” ë³´ê³  싶다 나는 ì´ë ‡ê²Œ ìƒê°í•˜ê³  벌떡 ì¼ì–´ë‚˜ì„œ ë„ì–´ì˜ í•¸ë“¤ì— ì†ì„ 대었소. +`안 ëœë‹¤! 옳잖다!' +하고 나는 ë‚´ ì†ŒíŒŒì— ëŒì•„와서 í„¸ì© ëª¸ì„ ë˜ì¡Œì†Œ. +`ìµœí›„ì˜ ìˆœê°„ì´ ì•„ë‹ˆëƒ. ìµœí›„ì˜ ìˆœê°„ì— ìš©ê°ížˆ ì´ê²¨ì•¼ í•  ê²ƒì´ ì•„ë‹ˆëƒ. ì•„ì„œë¼! ì•„ì„œë¼!' +하고 나는 í˜¼ìž ì£¼ë¨¹ì„ ë¶ˆëˆë¶ˆëˆ ì¥ì—ˆì†Œ. +ì´ ë•Œì— ì§œë°•ì§œë°• 하고 걸어오는 소리가 들리오. ë‚´ ê°€ìŠ´ì€ ìŒë°©ë§ì´ë¡œ ë‘들기는 ê²ƒê°™ì´ ë›°ì—ˆì†Œ. +`설마 ì •ìž„ì¼ê¹Œ.' +í•˜ë©´ì„œë„ ë‚˜ëŠ” ìˆ¨ì„ ì£½ì´ê³  귀를 기울였소. +ê·¸ ë°œìžêµ­ 소리는 분명 ë‚´ 문 ë°–ì— ì™€ì„œ 그쳤소. 그리고는 소리가 없었소. +`ë‚´ ê·€ì˜ í™˜ê°ì¸ê°€.' +하고 나는 í•œìˆ¨ì„ ë‚´ì‰¬ì—ˆì†Œ. +그러나 ë‹¤ìŒ ìˆœê°„ ë˜ ë‘ì–´ 번 ë¬¸ì„ ë‘드리는 소리가 들렸소. +"ì´ì—스." +하고 나는 대답하고 ë¬¸ì„ ë°”ë¼ë³´ì•˜ì†Œ. +ë¬¸ì´ ì—´ë ¸ì†Œ. +들어오는 ì´ëŠ” ì •ìž„ì´ì—ˆì†Œ. +"웬ì¼ì´ëƒ." +하고 나는 엄숙한 태ë„를 지었소. 그것으로 ì¼ ì´ˆì˜ ì¼ì²œë¶„지 ì¼ì´ë¼ë„ 다시 í•œ 번 ë³´ê³  ì‹¶ë˜ ì •ìž„ì„ ë³´ê³  기ì¨ì„ 카무플ë¼ì£¼í•œ 것ì´ì˜¤. +ì •ìž„ì€ ì„œìŠ´ì§€ ì•Šê³  ë‚´ ë’¤ì— ì™€ì„œ ë‚´ êµì˜ì— ëª¸ì„ ê¸°ëŒ€ë©°, +"ì•”ë§Œí•´ë„ ì˜¤ëŠ˜ì´ ë§ˆì§€ë§‰ì¸ ê²ƒë§Œ 같아서, 다시 뵈올 ê¸°ì•½ì€ ì—†ëŠ” 것만 같아서 가다가 ë„ë¡œ 왔습니다. í•œ 번만 ë” ëµ™ê³  ê°ˆ 양으로요. 그래 ë„ë¡œ ì™€ì„œë„ ë“¤ì–´ì˜¬ê¹Œ ë§ê¹Œ 하고 주저주저하다가 ì´ê²ƒì´ 마지막ì¸ë° 하고 용기를 ë‚´ì–´ì„œ 들어왔습니다. ë‚´ì¼ ì €ë¥¼ 보시고 가신다는 ê²ƒì´ ë¶€ëŸ¬ 하신 ë§ì”€ë§Œ 같고, 마지막 뵈옵고, ëµˆì˜¨ëŒ€ë„ ê·¸ëž˜ë„ í•œ 번 ë” ëµˆì˜µê¸°ë§Œ í•´ë„……." +하고 ì •ìž„ì˜ ë§ì€ ëì„ ì•„ë¬¼ì§€ 못하였소. 그는 ë‚´ 등 ë’¤ì— ì„œ 있기 ë•Œë¬¸ì— ê·¸ê°€ ì–´ë– í•œ í‘œì •ì„ í•˜ê³  있는지는 ë³¼ 수가 없었소. 나는 다만 ì•„ë²„ì§€ì˜ ìœ„ì—„ìœ¼ë¡œ ì •ë©´ì„ ë°”ë¼ë³´ê³  ìžˆì—ˆì„ ë¿ì´ì˜¤. +`ì •ìž„ì•„, ë‚˜ë„ ë„¤ê°€ ë³´ê³  싶었다. 네 뒤를 ë”°ë¼ê°€ê³  싶었다. ë‚´ 몸과 마ìŒì€ 네 뒤를 ë”°ë¼ì„œ 허공으로 날았다. 나는 너를 í•œ ì´ˆë¼ë„ í•œ ì´ˆì˜ ì²œë¶„ì§€ ì¼ ë™ì•ˆì´ë¼ë„ í•œ 번 ë” ë³´ê³  싶었다. ì •ìž„ì•„, ë‚´ ì§„ì •ì€ ë„ˆë¥¼ 언제든지 ë‚´ ê³ì— ë‘ê³  싶다. ì •ìž„ì•„, 지금 ë‚´ ìƒëª…ì´ ê°€ì§„ ê²ƒì€ ì˜¤ì§ ë„ˆë¿ì´ë‹¤.' +ì´ëŸ° ë§ì´ë¼ë„ 하고 싶었소. 그러나 ì´ëŸ° ë§ì„ 하여서는 아니 ë˜ì˜¤! ë§Œì¼ ë‚´ê°€ ì´ëŸ° ë§ì„ 하여 준다면 ì •ìž„ì´ê°€ 기ë»í•˜ê² ì§€ìš”. 그러나 나는 ì •ìž„ì´ì—게 ì´ëŸ° 기ì¨ì„ 주어서는 아니 ë˜ì˜¤! +나는 어디까지든지 ì•„ë²„ì§€ì˜ ìœ„ì—„, ì•„ë²„ì§€ì˜ ëƒ‰ì •í•¨ì„ ì•„ë‹ˆ 지켜서는 아니 ë˜ì˜¤. +그렇지마는 ë‚´ ê°€ìŠ´ì— íƒ€ì˜¤ë¥´ëŠ” ì´ë¦„ì§€ì„ ìˆ˜ 없는 ì—´ì •ì˜ ë¶ˆê¸¸ì€ ë‚´ ì´ì„±ê³¼ ì˜ì§€ë ¥ì„ 태워 버리려 하오. 나는 ëˆˆì´ ì•„ëœ©ì•„ëœ©í•¨ì„ ê¹¨ë‹«ì†Œ. 나는 ë‚´ ìƒëª…ì˜ ë¶ˆê¸¸ì´ ê¹œë°•ê¹œë°•í•¨ì„ ê¹¨ë‹«ì†Œ. +그렇지마는! ì•„ì•„ 그렇지마는 나는 ì´ ë„ë•ì  ì±…ìž„ì˜ ë¬´ìƒ ëª…ë ¹ì˜ ë°œë ¹ìžì¸ ì“´ ìž”ì„ ë§ˆì‹œì§€ 아니하여서는 아니 ë˜ëŠ” 것ì´ì˜¤. +`ì‚°! 바위!' +나는 ì •ì‹ ì„ ê°€ë‹¤ë“¬ì–´ì„œ ì´ê²ƒì„ 염하였소. +그러나 ì—´ì •ì˜ íŒŒë„ê°€ 치는 ê³³ì— ì‚°ì€ ì›€ì§ì´ì§€ 아니하오? 바위는 í”들리지 아니하오? 태산과 ë°˜ì„ì´ ê·¸ í° ë¶ˆê¸¸ì— íƒ€ì„œ 재가 ë˜ì§€ëŠ” 아니하오? ì¸ìƒì˜ 모든 힘 ê°€ìš´ë° ì—´ì •ë³´ë‹¤ ë” í­ë ¥ì ì¸ ê²ƒì´ ì–´ë”” 있소? ì•„ë§ˆë„ ìš°ì£¼ì˜ ëª¨ë“  힘 ê°€ìš´ë° ì‚¬ëžŒì˜ ì—´ì •ê³¼ ê°™ì´ í­ë ¥ì , 불가항력ì ì¸ ê²ƒì€ ì—†ìœ¼ë¦¬ë¼. 뇌성, 벽력, 글쎄 그것ì—나 비길까. ì°¨ë¼ë¦¬ 천체와 천체가 수학ì ìœ¼ë¡œ 계산할 수 없는 비ìƒí•œ ì†ë ¥ì„ 가지고 마주 달려들어서 ìš°ë¦¬ì˜ ê·€ë¡œ ë“¤ì„ ìˆ˜ 없는 í° ì†Œë¦¬ì™€ 우리가 굳다고 ì¼ì»«ëŠ” 금강ì„ì´ë¼ë„ ì¦ê¸°ë¥¼ 만들고야 ë§ ë§Œí•œ ì—´ì„ ë°œí•˜ëŠ” 충ëŒì˜ 순간ì—나 비길까. 형. 사람ì´ë¼ëŠ” 존재가 ìš°ì£¼ì˜ ëª¨ë“  존재 ì¤‘ì— ê°€ìž¥ 비ìƒí•œ ì¡´ìž¬ì¸ ê²ƒ 모양으로 ì‚¬ëžŒì˜ ì—´ì •ì˜ íž˜ì€ ìš°ì£¼ì˜ ëª¨ë“  신비한 힘 ê°€ìš´ë° ê°€ìž¥ 신비한 íž˜ì´ ì•„ë‹ˆê² ì†Œ? 대체 ìš°ì£¼ì˜ ëª¨ë“  íž˜ì€ ê·¸ê²ƒì´ ì•„ë¬´ë¦¬ í° íž˜ì´ë¼ê³  하ë”ë¼ë„ ì € ìžì‹ ì„ 깨뜨리는 ê²ƒì€ ì—†ì†Œ. 그렇지마는 사람ì´ë¼ëŠ” ì¡´ìž¬ì˜ ì—´ì •ì€ ëŠ¥ížˆ ì œ ìƒëª…ì„ ê¹¨ëœ¨ë ¤ 가루를 만들고 ì œ ìƒëª…ì„ ì‚´ë¼ì„œ 소지를 올리지 아니하오? 여보, 대체 ì´ì—ì„œ ë” í­ë ¥ì´ìš”, 신비ì ì¸ ê²ƒì´ ì–´ë”” 있단 ë§ì´ì˜¤. +ì´ ë•Œ ë‚´ ìƒíƒœ, 어깨 ë’¤ì—ì„œ 열정으로 타고 섰는 ì •ìž„ì„ ëŠë¼ëŠ” ë‚´ ìƒíƒœëŠ” 바야íë¡œ 대í­ë°œ, 대충ëŒì„ 기다리는 아슬아슬한 때가 아니었소. ë§Œì¼ ì¡°ê¸ˆë§Œì´ë¼ë„ ë‚´ê°€ ë‚´ ì—´ì •ì˜ ê³ ì‚ì— ëŠ¦ì¶¤ì„ ì¤€ë‹¤ê³  하면 무서운 대í­ë°œì´ ì¼ì–´ë‚¬ì„ 것ì´ì˜¤. +"ì •ìž„ì•„!" +하고 나는 충분히 마ìŒì„ 진정해 가지고 고개를 옆으로 ëŒë ¤ ì •ìž„ì˜ ì–¼êµ´ì„ ì°¾ì•˜ì†Œ. +"네ì—." +하고 ì •ìž„ì€ ìž…ì„ ì•½ê°„ ë‚´ ê·€ 가까ì´ë¡œ 가져와서 ê·¸ 씨근거리는 소리가 분명히 ë‚´ ê·€ì— ë“¤ë¦¬ê³  ê·¸ 후ëˆí›„ëˆí•˜ëŠ” 뜨거운 ìž…ê¹€ì´ ë‚´ 목과 ëº¨ì— ê°ê°ë˜ì—ˆì†Œ. +억지로 ì§„ì •í•˜ì˜€ë˜ ë‚´ ê°€ìŠ´ì€ ë‹¤ì‹œ 설레기를 시작하였소. ê·¸ 불규칙한 숨소리와 뜨거운 ìž…ê¹€ 때문ì´ì—ˆì„까. +"시간 늦는다. ì–´ì„œ 가거ë¼. ì´ ì•„ë²„ì§€ëŠ” 언제까지든지 너를 사랑하는 딸 ë¡œ 소중히 소중히 ê°€ìŠ´ì— í’ˆê³  있으마. ë˜ í›„ì¼ì— 다시 만날 ë•Œë„ ìžˆì„지 ì•„ëŠëƒ. 설사 다시 만날 때가 없다기로니 ê·¸ê²ƒì´ ë¬´ì—‡ì´ ê·¸ë¦¬ 대수ëƒ. ë‚˜ì´ ë§Žì€ ì‚¬ëžŒì€ ë¨¼ì € 죽고 ì Šì€ ì‚¬ëžŒì€ ì˜¤ëž˜ ì‚´ì•„ì„œ ì¸ìƒì˜ ì¼ì„ ë§Žì´ í•˜ëŠ” ê²ƒì´ ìˆœì„œê°€ 아니ëƒ. 너는 ëª¸ì´ ì•„ì§ ì•½í•˜ë‹ˆ 마ìŒì„ 잘 안정해서 ì–´ì„œ ê±´ê°•ì„ íšŒë³µí•˜ì—¬ë¼. 그리고 굳세게 굳세게, 힘있게 힘있게 ì‚´ì•„ 다오. ì¡°ì„ ì€ ì‚¬ëžŒì„ êµ¬í•œë‹¤. 나 ê°™ì€ ì‚¬ëžŒì€ ì¸ì œ ì¡°ì„ ì„œ ë” ì¼í•  ìžê²©ì„ 잃어버린 사람ì´ì§€ë§ˆëŠ” 네야 ì–´ë– ëƒ. 설사 누가 무슨 ë§ì„ í•´ì„œ í•™êµì—ì„œ 학비를 아니 준다거든 ë‚´ê°€ 네게 준 ìž¬ì‚°ì„ ê°€ì§€ê³  네 마ìŒëŒ€ë¡œ 공부를 하려무나. 네가 그렇게 í•´ 주어야 나를 위하는 것ì´ë‹¤. ìž ì¸ì œ 가거ë¼. 네 ì•žê¸¸ì´ ì–‘ì–‘í•˜ì§€ 아니하ëƒ. ìž ì¸ì œ 가거ë¼. 나는 ë‚´ì¼ ì•„ì¹¨ ë™ê²½ì„ 떠날란다. ìž ì–´ì„œ." +하고 나는 í™”í‰í•˜ê²Œ 웃는 낯으로 ì¼ì–´ì„°ì†Œ. +ì •ìž„ì€ ìš¸ë¨¹ìš¸ë¨¹í•˜ê³  고개를 숙ì´ì˜¤. +ë°–ì—서는 ë°”ëžŒì´ ì ì  강해져서 소리를 하고 ìœ ë¦¬ì°½ì„ í”드오. +"그럼, ì „ 가요." +하고 ì •ìž„ì€ ê³ ê°œë¥¼ 들었소. +"그래. ì–´ì„œ 가거ë¼. ë²Œì¨ ì—´í•œì‹œ ë°˜ì´ë‹¤. ë³‘ì› ë¬¸ì€ ì•„ë‹ˆ 닫니!" +ì •ìž„ì€ ëŒ€ë‹µì´ ì—†ì†Œ. +"ì–´ì„œ!" +하고 나는 ë³´ì´ë¥¼ 불러 ìžë™ì°¨ë¥¼ 하나 준비하ë¼ê³  ì¼ë €ì†Œ. +"ê°ˆëžë‹ˆë‹¤." +하고 ì •ìž„ì€ ê³ ê°œë¥¼ 숙여서 내게 ì¸ì‚¬ë¥¼ 하고 ë¬¸ì„ í–¥í•˜ì—¬ í•œ ê±¸ìŒ ê±·ë‹¤ê°€ ìž ê¹ ì£¼ì €í•˜ë”니, 다시 ëŒì•„서서, +"저를 í•œ 번만 안아 주셔요. 아버지가 어린 ë”¸ì„ ì•ˆë“¯ì´ í•œ 번만 안아 주셔요." +하고 ë‚´ 앞으로 ê°€ê¹Œì´ ì™€ 서오. +나는 íŒ”ì„ ë²Œë ¤ 주었소. ì •ìž„ì€ ë‚´ ê°€ìŠ´ì„ í–¥í•˜ê³  ëª¸ì„ ë˜ì¡Œì†Œ. 그리고 ì œ ì´ëº¨ ì €ëº¨ì„ ë‚´ ê°€ìŠ´ì— ëŒ€ê³  비ë³ì†Œ. 나는 ë‘ íŒ”ì„ ì •ìž„ì˜ ì–´ê¹¨ ìœ„ì— ê°€ë²¼ì´ ë†“ì•˜ì†Œ. +ì´ëŸ¬í•œ 지 몇 ë¶„ì´ ì§€ë‚¬ì†Œ. 아마 ì¼ ë¶„ë„ ë‹¤ 못 ë˜ì—ˆëŠ”지 모르오. +ì •ìž„ì€ ë‚´ 가슴ì—ì„œ 고개를 들어 나를 뚫어지게 우러러보ë”니, 다시 ë‚´ ê°€ìŠ´ì— ë‚¯ì„ ëŒ€ë”니 아마 ë‚´ ì‹¬ìž¥ì´ ë¬´ì„­ê²Œ 뛰는 소리를 ì •ìž„ì€ ë“¤ì—ˆì„ ê²ƒì´ì˜¤ ì •ìž„ì€ ë‹¤ì‹œ 고개를 들고, +"어디를 가시든지 편지나 주셔요." +하고 êµµì€ ëˆˆë¬¼ì„ ë–¨êµ¬ê³ ëŠ” 내게서 물러서서 ë˜ í•œ 번 절하고, +"안녕히 가셔요. 만주든지 ì•„ë ¹ì´ë“ ì§€ ì¡°ì„  사람 ë§Žì´ ì‚¬ëŠ” ê³³ì— ê°€ì…”ì„œ ì¼í•˜ê³  사셔요. ëŒì•„가실 ìƒê°ì€ 마셔요. 제가, 아버지 ë§ì”€ëŒ€ë¡œ í˜¼ìž ë–¨ì–´ì ¸ 있으니 ì•„ë²„ì§€ë„ ì œ ë§ì”€ëŒ€ë¡œ ëŒì•„가실 ìƒê°ì€ 마셔요, 네, 그렇다고 대답하셔요!" +하고는 ë˜ í•œ 번 ë‚´ ê°€ìŠ´ì— ëª¸ì„ ê¸°ëŒ€ì˜¤. +죽기를 결심한 나는 `오ëƒ, 그러마.' 하는 ëŒ€ë‹µì„ í•  수는 없었소. 그래서, +"오, ë‚´ ì‚´ë„ë¡ íž˜ì“°ë§ˆ." +하는 약ì†ì„ 주어서 ì •ìž„ì„ ëŒë ¤ë³´ëƒˆì†Œ. +ì •ìž„ì˜ ë°œìžêµ­ 소리가 안 들리게 ëœ ë•Œì— ë‚˜ëŠ” 빠른 걸ìŒìœ¼ë¡œ ì˜¥ìƒ ì •ì›ìœ¼ë¡œ 나갔소. 비가 막 뿌리오. +나는 ì •ìž„ì´ê°€ 타고 나가는 ìžë™ì°¨ë¼ë„ ë³¼ 양으로 호텔 현관 ì•žì´ ë³´ì´ëŠ” 꼭대기로 올ë¼ê°”소. í˜„ê´€ì„ ë– ë‚œ ìžë™ì°¨ 하나가 전찻길로 나서서는 ë¶ì„ 향하고 달아나서 순ì‹ê°„ì— ê·¸ ê½ë¬´ë‹ˆì— 달린 ë¶‰ì€ ë¶ˆì¡°ì°¨ 스러져 버리고 ë§ì•˜ì†Œ. +나는 미친 사람 모양으로, +"ì •ìž„ì•„, ì •ìž„ì•„!" +하고 ìˆ˜ì—†ì´ ë¶ˆë €ì†Œ. 나는 사 층ì´ë‚˜ ë˜ëŠ” ì´ ê¼­ëŒ€ê¸°ì—ì„œ 뛰어내려서 ì •ìž„ì´ê°€ 타고 ê°„ ìžë™ì°¨ì˜ 뒤를 따르고 싶었소. +"ì•„ì•„ ì˜ì›í•œ ì¸ìƒì˜ ì´ë³„!" +나는 ê·¸ 옥ìƒì— 얼마나 오래 ì„°ë˜ì§€ë¥¼ 모르오. ë‚´ 머리와 낯과 배스로브ì—서는 ë¬¼ì´ í르오. ë°©ì— ë“¤ì–´ì˜¤ë‹ˆ ì •ìž„ì´ê°€ ë¼ì¹˜ê³  ê°„ 향기와 추억만 남았소. +나는 ë°© 안 구ì„구ì„ì— ì •ìž„ì˜ ëª¨ì–‘ì´ ë³´ì´ëŠ” ê²ƒì„ ê¹¨ë‹¬ì•˜ì†Œ. 특별히 ì •ìž„ì´ê°€ 고개를 숙ì´ê³  ì„œ ìžˆë˜ ë‚´ êµì˜ ë’¤ì—는 분명히 갈색 외투를 ìž…ì€ ì •ìž„ì˜ ëª¨ì–‘ì´ ì™„ì—°í•˜ì˜¤. +"ì •ìž„ì•„!" +하고 나는 ê·¸ 곳으로 ë”°ë¼ê°€ì˜¤. 그러나 가면 거기는 ì •ìž„ì€ ì—†ì†Œ. +나는 êµì˜ì— 앉소. 그러면 ì •ìž„ì˜ ì”¨ê·¼ì”¨ê·¼í•˜ëŠ” 숨소리와 ë”ìš´ ìž…ê¹€ì´ ë¶„ëª… ë‚´ ì˜¤ë¥¸íŽ¸ì— ê°ê°ì´ ë˜ì˜¤. ì•„ì•„ 무서운 환ê°ì´ì—¬! +나는 ìžë¦¬ì— 눕소. 그리고 ì •ìž„ì˜ í™˜ê°ì„ 피하려고 ë¶ˆì„ ë„오. 그러면 ì •ìž„ì´ê°€ 내게 ì•ˆê¸°ë˜ ìžë¦¬ì¯¤ì— 환하게 ì •ìž„ì˜ ëª¨ì–‘ì´ ë‚˜íƒ€ë‚˜ì˜¤. +나는 ë¶ˆì„ ì¼œì˜¤. ë˜ ë¶ˆì„ ë„오. +ë‚ ì´ ë°ìž 나는 비가 ê°  ê²ƒì„ ë‹¤í–‰ìœ¼ë¡œ ë¹„í–‰ìž¥ì— ë‹¬ë ¤ê°€ì„œ 비행기를 얻어 탔소. +나는 다시 ì¡°ì„ ì˜ í•˜ëŠ˜ì„ í†µê³¼í•˜ê¸°ê°€ ì‹«ì–´ì„œ ë¶ê°•ì—ì„œ 비행기ì—ì„œ 내려서 ë¬¸ì‚¬ì— ì™€ì„œ 대련으로 가는 배를 탔소. +나는 대련ì—ì„œ 내려서 í•˜ë£»ë°¤ì„ ì—¬ê´€ì—ì„œ ìžê³ ëŠ” 곧 장춘 가는 ê¸‰í–‰ì„ íƒ”ì†Œ. 물론 아무ì—ê²Œë„ ì—½ì„œ í•œ 장 í•œ ì¼ ì—†ì—ˆì†Œ. ê·¸ê²ƒì€ ì¸ì—°ì„ ëŠì€ 세ìƒì— 대하여 ì—°ì—°í•œ 마ìŒì„ 가지는 ê²ƒì„ ë¶€ë„럽게 ìƒê°í•œ 까닭ì´ì˜¤. +차가 옛날ì—는 우리 ì¡°ìƒë„¤ê°€ ì‚´ê³  문화를 ì§“ë˜ ì˜› í„°ì „ì¸ ë§Œì£¼ì˜ ë²ŒíŒì„ 달릴 ë•Œì—는 ê°íšŒë„ 없지 아니하였소. 그러나 나는 지금 그런 한가한 ê°ìƒì„ 쓸 ê²¨ë¥¼ì´ ì—†ì†Œ. +ë‚´ê°€ 믿고 가는 ê³³ì€ í•˜ì–¼ë¹ˆì— ìžˆëŠ” ì–´ë–¤ 친구요. 그는 Rë¼ëŠ” 사람으로서 ê²½ìˆ ë…„ì— A씨 ë“±ì˜ ë§ëª…ê°ì„ ë”°ë¼ ë‚˜ê°”ë‹¤ê°€ ì•„ë¼ì‚¬ì—ì„œ 무관 í•™êµë¥¼ 졸업하고 ì•„ë¼ì‚¬ 사관으로서 구주 대전ì—ë„ ì¶œì •ì„ í•˜ì˜€ë‹¤ê°€, í˜ëª… 후ì—ë„ ì´ë‚´ ì ìœ„êµ°ì— ë¨¸ë¬¼ëŸ¬ì„œ 지금까지 소비ì—트 장êµë¡œ 있는 사람ì´ì˜¤. ì§€ê¸ˆì€ ìœ¡êµ° 소장ì´ë¼ë˜ê°€. +나는 í•˜ì–¼ë¹ˆì— ê·¸ ì‚¬ëžŒì„ ì°¾ì•„ê°€ëŠ” 것ì´ì˜¤. ê·¸ ì‚¬ëžŒì„ ì°¾ì•„ì•¼ ì•„ë¼ì‚¬ì— 들어갈 ì—¬í–‰ê¶Œì„ ì–»ì„ ê²ƒì´ìš”, ì—¬í–‰ê¶Œì„ ì–»ì–´ì•¼ ë‚´ê°€ í‰ì†Œì— ì´ìƒí•˜ê²Œë„ ê·¸ë¦¬ì›Œí•˜ë˜ ë°”ì´ì¹¼ 호를 ë³¼ 것ì´ì˜¤. +í•˜ì–¼ë¹ˆì— ë‚´ë¦° ê²ƒì€ í•´ê°€ 뉘엿뉘엿 넘어가는 ì„ì–‘ì´ì—ˆì†Œ. +나는 ì•ˆì¤‘ê·¼ì´ ì´ë“±ë°•ë¬¸(伊藤åšæ–‡:ì´í†  히로부미)ì„ ìœ ê³³ì´ ì–´ë”˜ê°€ 하고 벌íŒê³¼ ê°™ì´ ë„“ì€ í”Œëž«í¼ì— 내렸소. 과연 êµ­ì œ ë„ì‹œë¼ ì„œì–‘ 사람, 중국 사람, ì¼ë³¸ ì‚¬ëžŒì´ ê°ê¸° ì œ ë§ë¡œ 지껄ì´ì˜¤. ì•„ì•„ ì¡°ì„  ì‚¬ëžŒë„ ìžˆì„ ê²ƒì´ì˜¤ë§ˆëŠ” 다들 ì–‘ë³µì„ ìž…ê±°ë‚˜ ì²­ë³µì„ ìž…ê±°ë‚˜ 하고 ë˜ ì‚¬ëžŒì´ ë§Žì€ ê³³ì—서는 ë§ë„ 잘 하지 아니하여 ì•„ë¬´ìª¼ë¡ ì¡°ì„  ì‚¬ëžŒì¸ ê²ƒì„ í‘œì‹œí•˜ì§€ 아니하는 íŒì´ë¼ ê·¸ 골격과 í‘œì •ì„ ì‚´í”¼ê¸° ì „ì—는 ì–´ëŠ ê²ƒì´ ì¡°ì„  사람ì¸ì§€ ì•Œ ê¸¸ì´ ì—†ì†Œ. 아마 허름하게 차리고 기운 ì—†ì´, 비창한 ë¹›ì„ ë ê³  ì‚¬ëžŒì˜ ëˆˆì„ ìŠ¬ìŠ¬ 피하는 ì € 순하게 ìƒê¸´ ì‚¬ëžŒë“¤ì´ ì¡°ì„  사람ì´ê² ì§€ìš”. 언제나 í•œ 번 가는 곳마다 ë™ì–‘ì´ë“ ì§€, 서양ì´ë“ ì§€, +`나는 ì¡°ì„  사람ì´ì˜¤!' +하고 ë½ë‚´ê³  ë‹¤ë‹ ë‚ ì´ ìžˆì„까 하면 ëˆˆë¬¼ì´ ë‚˜ì˜¤. ë”구나, 하얼빈과 ê°™ì€ ê°ìƒ‰ ì¸ì¢…ì´ ëª¨ì—¬ì„œ ìƒì¡´ ê²½ìŸì„ 하는 ë§ˆë‹¹ì— ì„œì„œ ì´ëŸ° 비ê°ì´ 간절하오. ì•„ì•„ ì´ ë¶ˆìŒí•œ ìœ ëž‘ì˜ ë¬´ë¦¬ ì¤‘ì— ë‚˜ë„ í•˜ë‚˜ë¥¼ ë” ë³´íƒœëŠ”ê°€ 하면 ëˆˆë¬¼ì„ ì”»ì§€ 아니할 수 없었소. +나는 ì—­ì—ì„œ 나와서 ì–´ë–¤ ì•„ë¼ì‚¬ 병정 하나를 붙들고 Rì˜ ì•„ë¼ì‚¬ ì´ë¦„ì„ ë¶ˆë €ì†Œ. 그리고 ì•„ëŠëƒê³  ì˜ì–´ë¡œ 물었소. +ê·¸ ë³‘ì •ì€ ë‚´ ë§ì„ 잘못 알아들었는지, ë˜ëŠ” R를 모르는지 무엇ì´ë¼ê³  ì•„ë¼ì‚¬ë§ë¡œ 지껄ì´ëŠ” 모양ì´ë‚˜ 나는 물론 ê·¸ê²ƒì„ ì•Œì•„ë“¤ì„ ìˆ˜ê°€ 없었소. 그러나 나는 ê·¸ ë³‘ì •ì˜ í‘œì •ì—ì„œ 내게 호ì˜ë¥¼ 가진 ê²ƒì„ ì§ìž‘하고 í•œ 번 ë” ë¶„ëª…ížˆ, +"요십 알렉산드로비치 리가ì´." +ë¼ê³  불러 보았소. +ê·¸ ë³‘ì •ì€ ë¹™ê·¸ë ˆ 웃고 고개를 í”드오. ì´ ë‘ ì™¸êµ­ ì‚¬ëžŒì˜ ì´ìƒí•œ êµì„­ì— í¥ë¯¸ë¥¼ 가지고 여러 ì•„ë¼ì‚¬ 병정과 ë™ì–‘ ì‚¬ëžŒë“¤ì´ ì‹­ì—¬ ì¸ì´ë‚˜ 우리 ì£¼ìœ„ì— ëª¨ì—¬ë“œì˜¤. +ê·¸ ë³‘ì •ì´ ë‚˜ë¥¼ ë°”ë¼ë³´ê³  ë˜ í•œ 번 ê·¸ ì´ë¦„ì„ ë¶ˆëŸ¬ ë³´ë¼ëŠ” 모양 같기로 나는 ì´ë²ˆì—는 Rì˜ ì•„ë¼ì‚¬ ì´ë¦„ì— `제너럴'ì´ë¼ëŠ” ë§ì„ 붙여 불러 보았소. +그랬ë”니 ì–´ë–¤ 다른 ë³‘ì •ì´ ë›°ì–´ë“¤ë©°, +"게네ë¼ìš° 리가ì´!" +하고 안다는 í‘œì •ì„ í•˜ì˜¤. `게네ë¼ìš°'ë¼ëŠ” ê²ƒì´ ì•„ë§ˆ ì•„ë¼ì‚¬ë§ë¡œ 장군ì´ëž€ ë§ì¸ê°€ 하였소. +"예스. 예스." +하고 나는 기ì˜ê²Œ 대답하였소. 그리고는 ì•„ë¼ì‚¬ 병정들ë¼ë¦¬ 무ì—ë¼ê³  지껄ì´ë”니, ê·¸ ì¤‘ì— í•œ ë³‘ì •ì´ ë‚˜ì„œë©´ì„œ 고개를 ë„ë•ë„ë•í•˜ê³ , 제가 마차 하나를 불러서 나를 태우고 ì €ë„ íƒ€ê³  어디로 달려가오. +ê·¸ ì•„ë¼ì‚¬ ë³‘ì •ì€ ì¹œì ˆížˆ ì•Œì§€ë„ ëª»í•˜ëŠ” ë§ë¡œ ì´ê²ƒì €ê²ƒì„ 가리키면서 ì„¤ëª…ì„ í•˜ë”니 ë‚´ê°€ 못 알아듣는 ì¤„ì„ ìƒê°í•˜ê³  ë‚´ 어깨를 툭 치고 웃소. 어린애와 ê°™ì´ ìˆœí•œ 사람들ì´êµ¬ë‚˜ 하고 나는 고맙다는 표로 고개만 ë„ë•ë„ë•í•˜ì˜€ì†Œ. +어디로 어떻게 가는지 서양 시가로 달려가다가 ì–´ë–¤ í° ì €íƒ ì•žì— ì´ë¥´ëŸ¬ì„œ 마차를 ê·¸ 현관 앞으로 들ì´ëª°ì•˜ì†Œ. +현관ì—서는 ì¢…ì¡¸ì´ ë‚˜ì™”ì†Œ. ë‚´ê°€ ëª…í•¨ì„ ë“¤ì—¬ë³´ëƒˆë”니 ë¶€ê´€ì¸ ë“¯í•œ ì•„ë¼ì‚¬ 장êµê°€ 나와서 나를 으리으리한 ì‘접실로 ì¸ë„하였소. 얼마 있노ë¼ë‹ˆ ì¤‘ë…„ì´ ë„˜ì€ ì–´ë–¤ ëŒ€ìž¥ì´ ë‚˜ì˜¤ëŠ”ë° êµ°ë³µì— ì¹¼ëˆë§Œ 늘였소. +"ì´ê²Œ 누구요." +하고 ê·¸ ëŒ€ìž¥ì€ ë‹¬ë ¤ë“¤ì–´ì„œ 나를 껴안았소. ì´ì‹­ì˜¤ ë…„ ë§Œì— ë§Œë‚˜ëŠ” 우리는 서로 알아본 것ì´ì˜¤. +ì´ìœ½ê³  나는 ê·¸ì˜ ë¶€ì¸ê³¼ ìžë…€ë“¤ë„ 만났소. ê·¸ë“¤ì€ ë‹¤ ì•„ë¼ì‚¬ 사람ì´ì˜¤. +ì €ë…ì´ ëë‚œ ë’¤ì— ë‚˜ëŠ” Rì˜ ë¶€ì¸ê³¼ ë”¸ì˜ ìŒì•…ê³¼ 그림 구경과 ê¸°íƒ€ì˜ ê´€ëŒ€ë¥¼ 받고 ë‹¨ë‘˜ì´ ì´ì•¼ê¸°í•  기회를 얻었소. 경술년 당시 ì´ì•¼ê¸°ë„ 나오고, Aì”¨ì˜ ì´ì•¼ê¸°ë„ 나오고, Rì˜ ì‹ ì„¸ íƒ€ë ¹ë„ ë‚˜ì˜¤ê³ , ë‚´ ì´ì‹­ì˜¤ ë…„ ê°„ì˜ ìƒí™œ ì´ì•¼ê¸°ë„ 나오고, 소비ì—트 í˜ëª… ì´ì•¼ê¸°ë„ 나오고, 하얼빈 ì´ì•¼ê¸°ë„ 나오고, 우리네가 어려서 서로 ì‚¬ê·€ë˜ íšŒêµ¬ë‹´ë„ ë‚˜ì˜¤ê³  ì´ì•¼ê¸°ê°€ 그칠 바를 몰ëžì†Œ. "ì¡°ì„ ì€ ê·¸ë¦½ì§€ ì•Šì€ê°€." +하는 ë‚´ ë§ì— ì¾Œí™œí•˜ë˜ R는 고개를 숙ì´ê³  추연한 ë¹›ì„ ë³´ì˜€ì†Œ. +나는 Rì˜ ì¶”ì—°í•œ 태ë„를 아마 ê³ êµ­ì„ ê·¸ë¦¬ì›Œí•˜ëŠ” 것으로만 여겼소. 그래서 나는 그리 침ìŒí•˜ëŠ” ê²ƒì„ ë³´ê³ , +"얼마나 ê³ êµ­ì´ ê·¸ë¦½ê² ë‚˜. 나는 ê³ êµ­ì„ ë– ë‚œ 지가 ì¼ ì£¼ì¼ë„ 안 ë˜ê±´ë§ˆëŠ” 못 견디게 그리운ë°." +하고 ë™ì •í•˜ëŠ” ë§ì„ 하였소. +í–ˆë”니, ì´ ë§ ë³´ì‹œì˜¤. 그는 침ìŒì„ 깨뜨리고 고개를 ë²ˆì© ë“¤ë©°, +"아니! 나는 ê³ êµ­ì´ ì¡°ê¸ˆë„ ê·¸ë¦½ì§€ 아니하ì´. ë‚´ê°€ 지금 ìƒê°í•œ ê²ƒì€ ìžë„¤ ë§ì„ 듣고 ê³ êµ­ì´ ê·¸ë¦¬ìš´ê°€ 그리워할 ê²ƒì´ ìžˆëŠ”ê°€ë¥¼ ìƒê°í•´ 본 것ì¼ì„¸. 그랬ë”니 아무리 ìƒê°í•˜ì—¬ë„ 나는 ê³ êµ­ì´ ê·¸ë¦½ë‹¤ëŠ” ìƒê°ì„ 가질 수가 없어. 그야 어려서 ìžë¼ë‚  ë•Œì— ë³´ë˜ ê°•ì‚°ì´ë¼ë“ ì§€ ë‚´ ê¸°ì–µì— ë‚¨ì€ ì•„ëŠ” 사람들ì´ë¼ë“ ì§€, ë³´ê³  싶다 하는 ìƒê°ë„ 없지 아니하지마는 ê·¸ê²ƒì´ ê³ êµ­ì´ ê·¸ë¦¬ìš´ 것ì´ë¼ê³  í•  수가 있ì„까. ê·¸ ë°–ì—는 나는 아무리 ìƒê°í•˜ì—¬ë„ ê³ êµ­ì´ ê·¸ë¦¬ìš´ ê²ƒì„ ì°¾ì„ ê¸¸ì´ ì—†ë„¤. ë‚˜ë„ ì§€ê¸ˆ ìžë„¤ë¥¼ ë³´ê³  ë˜ ìžë„¤ ë§ì„ 듣고 오래 ìžŠì–´ë²„ë ¸ë˜ ê³ êµ­ì„ ì¢€ 그립게, 그립다 하게 ìƒê°í•˜ë ¤ê³  í•´ 보았지마는 ë„무지 나는 ê³ êµ­ì´ ê·¸ë¦½ë‹¤ëŠ” ìƒê°ì´ 나지 않네." +ì´ ë§ì— 나는 ê¹œì§ ë†€ëžì†Œ. 몸서리치게 무서웠소. 나는 í•´ì™¸ì— ì˜¤ëž˜ 표랑하는 ì‚¬ëžŒì€ ìœ¼ë ˆ ê³ êµ­ì„ ê·¸ë¦¬ì›Œí•  것으로 믿고 있었소. ê·¸ëŸ°ë° ì´ ì‚¬ëžŒì´, ì¼ì°ì€ ê³ êµ­ì„ ì‚¬ëž‘í•˜ì—¬ ëª©ìˆ¨ê¹Œì§€ë„ ë°”ì¹˜ë ¤ë˜ ì´ ì‚¬ëžŒì´ ë„무지 ì´ì²˜ëŸ¼ ê³ êµ­ì„ ìžŠì–´ë²„ë¦°ë‹¤ëŠ” ê²ƒì€ ë†€ë¼ìš´ ì •ë„를 지나서 괘씸하기 그지없었소. ë‚˜ë„ ë¹„ë¡ ì¡°ì„ ì„ ë– ë‚œë‹¤ê³ , ì˜ì›ížˆ 버린다고 나서기는 했지마는 나로는 죽기 ì „ì—는 아니 ë¹„ë¡ ì£½ë”ë¼ë„ 잊어버리지 못할 ê³ êµ­ì„ ìžŠì–´ë²„ë¦° Rì˜ ì‹¬ì‚¬ê°€ 난측하고 ì›ë§ìŠ¤ëŸ¬ì› ì†Œ. +"ê³ êµ­ì´ ê·¸ë¦½ì§€ê°€ ì•Šì•„?" +하고 Rì—게 묻는 ë‚´ 어성ì—는 격분한 ë¹›ì´ ìžˆì—ˆì†Œ. +"ì´ìƒí•˜ê²Œ ìƒê°í•˜ì‹œê² ì§€. 하지만 ê³ êµ­ì— ë¬´ìŠ¨ 그리울 ê²ƒì´ ìžˆë‹¨ ë§ì¸ê°€. ê·¸ 빈대 ë“는 오막살ì´ê°€ 그립단 ë§ì¸ê°€. 나무 í•œ ê°œ 없는 ì‚°ì´ ê·¸ë¦½ë‹¨ ë§ì¸ê°€. ë¬¼ë³´ë‹¤ë„ ëª¨ëž˜ê°€ ë§Žì€ ë‹¤ 늙어빠진 ê°œì²œì´ ê·¸ë¦½ë‹¨ ë§ì¸ê°€. ê·¸ 무기력하고 가난한, 시기 많고 싸우고 하는 ê·¸ ë°±ì„±ì„ ê·¸ë¦¬ì›Œí•œë‹¨ ë§ì¸ê°€. 그렇지 아니하면 무슨 그리워할 ìŒì•…ì´ ìžˆë‹¨ ë§ì¸ê°€, ë¯¸ìˆ ì´ ìžˆë‹¨ ë§ì¸ê°€, ë¬¸í•™ì´ ìžˆë‹¨ ë§ì¸ê°€, 사ìƒì´ 있단 ë§ì¸ê°€, 사모할 만한 ì¸ë¬¼ì´ 있단 ë§ì¸ê°€! ë‚ ë”러 ê³ êµ­ì˜ ë¬´ì—‡ì„ ê·¸ë¦¬ì›Œí•˜ëž€ ë§ì¸ê°€. 나는 ì¡°êµ­ì´ ì—†ëŠ” 사람ì¼ì„¸. ë‚´ê°€ 소비ì—트 êµ°ì¸ìœ¼ë¡œ 있으니 소비ì—트가 ë‚´ ì¡°êµ­ì´ê² ì§€. 그러나 진심으로 ë‚´ ì¡°êµ­ì´ë¼ëŠ” ìƒê°ì€ 나지 아니하네." +하고 ì €ë… ë¨¹ì„ ë•Œì— ì•½ê°„ ë¶‰ì—ˆë˜ Rì˜ ì–¼êµ´ì€ ì´ìƒí•œ í¥ë¶„으로 ë”ìš± 붉어지오.유 정유 ì • +R는 ë¨¹ë˜ ë‹´ë°°ë¥¼ 화나는 ë“¯ì´ ìž¬ë–¨ì´ì— 집어ë˜ì§€ë©°, +"ë‚´ê°€ í•˜ì–¼ë¹ˆì— ì˜¨ 지가 ì¸ì œ 겨우 삼사 ë…„ë°–ì— ì•ˆ ë˜ì§€ë§ˆëŠ” ì¡°ì„  사람 ë•Œë¬¸ì— ë‚˜ëŠ” 견딜 수가 없어. 와서 달ë¼ëŠ” ê²ƒë„ ë‹¬ë¼ëŠ” 것ì´ì§€ë§ˆëŠ” ì¡°ì„  ì‚¬ëžŒì´ ë˜ ì–´ì°Œí•˜ì˜€ëŠë‹ˆ ë˜ ì–´ì°Œí•˜ì˜€ëŠë‹ˆ 하는 불명예한 ë§ì„ ë“¤ì„ ë•Œì—는 나는 ê¸ˆì‹œì— ì£½ì–´ 버리고 싶단 ë§ì¼ì„¸. 내게 가장 불쾌한 ê²ƒì´ ìžˆë‹¤ê³  하면 ê·¸ê²ƒì€ ê³ êµ­ì´ë¼ëŠ” 기억과 ì¡°ì„  ì‚¬ëžŒì˜ ì¡´ìž´ì„¸. ë‚´ê°€ ë§Œì¼ ì–´ëŠ ë‚˜ë¼ì˜ ë…재ìžê°€ ëœë‹¤ê³  하면 나는 첫째로 ì¡°ì„ ì¸ ìž…êµ­ 금지를 단행하려네. ë§Œì¼ ì¡°ì„ ì´ë¼ëŠ” ê²ƒì„ ìžŠì–´ë²„ë¦´ ì•½ì´ ìžˆë‹¤ê³  하면 나는 ìƒëª…ê³¼ 바꾸어서ë¼ë„ 사 먹고 싶어." +하고 R는 약간 í¥ë¶„ëœ ì–´ì¡°ë¥¼ 늦추어서, +"ë‚˜ë„ ëª¨ìŠ¤í¬ë°”ì— ìžˆë‹¤ê°€ ì²˜ìŒ ì›ë™ì— ë‚˜ì™”ì„ ì ì—는 ê¸¸ì„ ë‹¤ë…€ë„ í˜¹ì‹œ ë™í¬ê°€ ëˆˆì— ëœ¨ì´ì§€ë‚˜ 아니하나 하고 찾았네. 그래서 어디서든지 ë™í¬ë¥¼ 만나면 ë°˜ê°€ì´ ì†ì„ 잡았지. 했지만 ì ì  ê·¸ë“¤ì€ ì˜¤ì§ ê·€ì°®ì€ ì¡´ìž¬ì— ì§€ë‚˜ì§€ 못하다는 ê²ƒì„ ì•Œì•˜ë‹¨ ë§ì¼ì„¸. ì¸ì œëŠ” ì¡°ì„  사람ì´ë¼ê³ ë§Œ 하면 만나기가 무섭고 ë”ì°ë”ì°í•˜ê³  진저리가 나는 걸 어떡허나. ìžë„¤ ëª…í•¨ì´ ë“¤ì–´ì˜¨ ë•Œì—ë„ ì¡°ì„  사람ì¸ê°€ 하고 ê°€ìŠ´ì´ ëœ¨ë”했네." +하고 R는 ì›ƒì§€ë„ ì•„ë‹ˆí•˜ì˜¤. ê·¸ì˜ ì–¼êµ´ì—는, êµ°ì¸ë‹¤ìš´ 기운찬 얼굴ì—는 ì¦ì˜¤ì™€ ë¶„ë…¸ì˜ ë¹›ì´ ë„˜ì³¤ì†Œ. +"ë‚˜ë„ ìžë„¤ ì§‘ì— í™˜ì˜ë°›ëŠ” 나그네는 ì•„ë‹ì„¸ê·¸ë ¤." +하고 나는 ì´ ê²¬ë””ê¸° 어려운 불쾌하고 무서운 공기를 완화하기 위하여 ë†ë‹´ì‚¼ì•„ í•œ 마디를 ë˜ì§€ê³  웃었소. +나는 Rì˜ ë§ì´ ê³¼ê²©í•¨ì— ë†€ëžì§€ë§ˆëŠ”, ë˜ ìƒê°í•˜ë©´ Rê°€ í•œ ë§ ê°€ìš´ë°ëŠ” ë“¤ì„ ë§Œí•œ ì´ìœ ë„ 없지 아니하오. ê·¸ê²ƒì„ ìƒê°í•  ë•Œì— ë‚˜ëŠ” R를 괘씸하게 ìƒê°í•˜ê¸° ì „ì— ë‚´ê°€ 버린다는 ì¡°ì„ ì„ ìœ„í•˜ì—¬ì„œ ê°€ìŠ´ì´ ì•„íŒ ì†Œ. 그렇지만 ì´ì œ 나 따위가 ê°€ìŠ´ì„ ì•„íŒŒí•œëŒ€ì•¼ 무슨 ì†Œìš©ì´ ìžˆì†Œ. ì¡°ì„ ì— ë‚¨ì•„ 계신 형ì´ë‚˜ Rì˜ ë§ì„ 참고삼아 쓰시기 ë°”ë¼ì˜¤. 어쨌으나 나는 Rì—게서 목ì í•œ ì—¬í–‰ê¶Œì„ ì–»ì—ˆì†Œ. Rì—게는 다만, +`나는 피곤한 ëª¸ì„ ì¢€ 정양하고 싶다. 나는 ë‚´ê°€ í‰ì†Œì— ì¦ê²¨í•˜ëŠ” ë°”ì´ì¹¼ 호반ì—ì„œ 눈과 ì–¼ìŒì˜ í•œê²¨ìš¸ì„ ì§€ë‚´ê³  싶다.' +는 ê²ƒì„ ì—¬í–‰ì˜ ì´ìœ ë¡œ 삼았소. +R는 ë‚˜ì˜ ì´ˆì·Œí•œ ëª¨ì–‘ì„ ì§ìž‘하고 ë‚´ 핑계를 그럴듯하게 아는 모양ì´ì—ˆì†Œ. 그리고 나ë”러, `ì´ì™• 정양하려거든 카프카 지방으로 가거ë¼. 거기는 기후 í’ê²½ë„ ì¢‹ê³  ë˜ ìš”ì–‘ì›ì˜ ì„¤ë¹„ë„ ìžˆë‹¤.'는 ê²ƒì„ ë§í•˜ì˜€ì†Œ. ë‚˜ë„ í†¨ìŠ¤í† ì´ì˜ 소설ì—ì„œ, ê¸°íƒ€ì˜ ì—¬í–‰ê¸° 등ì†ì—ì„œ ì´ ì§€ë°©ì— ê´€í•œ ë§ì„ 못 ë“¤ì€ ê²ƒì´ ì•„ë‹ˆë‚˜ 지금 ë‚´ 처지ì—는 그런 따뜻하고 경치 ì¢‹ì€ ì§€ë°©ì„ ê°€ë¦´ ì—¬ìœ ë„ ì—†ê³  ë˜ ê·¸ëŸ¬í•œ ì§€ë°©ë³´ë‹¤ë„ ëˆˆê³¼ ì–¼ìŒê³¼ ë°”ëžŒì˜ ì‹œë² ë¦¬ì•„ì˜ ê²¨ìš¸ì´ í•©ë‹¹í•œ 듯하였소. +그러나 나는 Rì˜ í˜¸ì˜ë¥¼ êµ³ì´ ì‚¬ì–‘í•  í•„ìš”ë„ ì—†ì–´ì„œ 그가 ì¨ ì£¼ëŠ” 대로 ì†Œê°œìž¥ì„ ë‹¤ 받아 넣었소. 그는 나를 처남 매부 ê°„ì´ë¼ê³  소개해 주었소. +나는 모스í¬ë°” 가는 ë‹¤ìŒ ê¸‰í–‰ì„ ê¸°ë‹¤ë¦¬ëŠ” ì‚¬í˜ ë™ì•ˆ Rì˜ ì§‘ì˜ ì†ì´ ë˜ì–´ì„œ Rë¶€ì²˜ì˜ ì¹œì ˆí•œ 대우를 받았소. +ê·¸ 후ì—는 나는 R와 ì¡°ì„ ì— ê´€í•œ í† ë¡ ì„ í•œ ì¼ì€ 없지마는 Rê°€ ì´ë¦„지어 ë§ì„ í•  ë•Œì—는 ì¡°ì„ ì„ ìžŠì—ˆë…¸ë¼, 그리워할 ê²ƒì´ ì—†ë…¸ë¼, 하지마는 무ì˜ì‹ì ìœ¼ë¡œ ë§ì„ í•  ë•Œì—는 ì¡°ì„ ì„ ëª» 잊고 ë˜ ì¡°ì„ ì„ ì—¬ëŸ¬ ì ìœ¼ë¡œ 그리워하는 ì–‘ì„ ë³´ì•˜ì†Œ. 나는 ê·¸ê²ƒìœ¼ë¡œì¨ ë§Œì¡±í•˜ê²Œ 여겼소. +나는 ê¸ˆìš”ì¼ ì˜¤í›„ 세시 모스í¬ë°” 가는 급행으로 í•˜ì–¼ë¹ˆì„ ë– ë‚¬ì†Œ. ì—­ë‘ì—는 R와 Rì˜ ê°€ì¡±ì´ ë‚˜ì™€ì„œ 꽃과 ê³¼ì¼ê³¼ 여러 가지 선물로 나를 전송하였소. R와 Rì˜ ê°€ì¡±ì€ ë‚˜ë¥¼ ì •ë§ í˜•ì œì˜ ì˜ˆë¡œ 대우하여 차가 떠나려 í•  ë•Œì— í¬ì˜¹ê³¼ 키스로 작별하여 주었소. +ì´ ë‚ ì€ í½ ë”°ëœ»í•˜ê³  ì¼ê¸°ê°€ ì¢‹ì€ ë‚ ì´ì—ˆì†Œ. í•˜ëŠ˜ì— êµ¬ë¦„ í•œ ì , ë•…ì— ë°”ëžŒ í•œ ì  ì—†ì´ ë§ˆì¹˜ ëŠ¦ì€ ë´„ë‚ ê³¼ ê°™ì´ ë”°ëœ»í•œ ë‚ ì´ì—ˆì†Œ. +차는 떠났소. íŒë‹¤ëŠ” ë‘¥ 안 íŒë‹¤ëŠ” ë‘¥ ë§ì½ ë§Žì€ ë™ì¤‘ë¡œ(ì§€ê¸ˆì€ ë¶ë§Œ ì² ë¡œë¼ê³  하오.)ì˜ êµ­ì œ ì—´ì°¨ì— ëª¸ì„ ì˜íƒí•œ 것ì´ì˜¤. +송화강(æ¾èŠ±æ±Ÿ:쑹화 ê°•)ì˜ ì² êµë¥¼ 건너오. ì•„ì•„ ê·¸ë¦¬ë„ ë‚¯ìµì€ 송화강! ì†¡í™”ê°•ì´ ì™œ ë‚¯ì´ ìµì†Œ. ì´ ì†¡í™”ê°•ì€ ë¶ˆí•¨ì‚°(장백산)ì— ê·¼ì›ì„ 발하여 광막한 ë¶ë§Œì£¼ì˜ ì‚¬ëžŒë„ ì—†ëŠ” 벌íŒì„ í˜¼ìž ì†Œë¦¬ë„ ì—†ì´ í˜ëŸ¬ê°€ëŠ” ê²ƒì´ ë‚´ 신세와 같소. ì´ ë¶ë§Œì£¼ì˜ 벌íŒì„ 만든 ìžê°€ 송화강ì´ì§€ë§ˆëŠ” 나는 그만한 íž˜ì´ ì—†ëŠ” ê²ƒì´ ë¶€ë„러울 ë¿ì´ì˜¤. ì´ ê´‘ë§‰í•œ ë¶ë§Œì˜ 벌íŒì„ ë‚´ ì†ìœ¼ë¡œ 개척하여서 ì¡°ì„  ì‚¬ëžŒì˜ ë‚™ì›ì„ ë§Œë“¤ìž í•˜ê³  ë½ë‚´ì–´ 볼까. ê·¸ê²ƒì€ í˜•ì´ í•˜ì‹œì˜¤. ë‚´ ì–´ë¦°ê²ƒì´ ìžë¼ê±°ë“  그놈ì—게나 그러한 ìƒê°ì„ 넣어 주시오. +ë™ì–‘ì˜ êµ­ì œì  ê´´ë¬¼ì¸ í•˜ì–¼ë¹ˆ ì‹œê°€ë„ ê¹Œë§£ê²Œ 안개ì—ì„œ 스러져 버리고 ë§ì•˜ì†Œ. 그러나 ê·¸ 시가를 싼 까만 ê¸°ìš´ì´ êµ­ì œì  í’ìš´ì„ í¬ìž¥í•œ 것ì´ë¼ê³  할까요. +ê°€ë„ê°€ë„ ë²ŒíŒ. ì„œë¦¬ë§žì€ ë§ˆë¥¸ 풀바다. 실개천 í•˜ë‚˜ë„ ì—†ëŠ” 메마른 사막. 어디를 ë³´ì•„ë„ ì‚° 하나 없으니 하늘과 ë•…ì´ ì°© 달ë¼ë¶™ì€ 듯한 천지. 구름 í•œ ì  ì—†ê±´ë§Œë„ ê·¸ í° íƒœì–‘ ê°€ì§€ê³ ë„ ë¯¸ì²˜ 다 비추지 못하여 지í‰ì„  호를 그린 지í‰ì„  위ì—는 í•­ìƒ í™©í˜¼ì´ ë– ë„는 듯한 세계. ì´ ì†ìœ¼ë¡œ ë‚´ê°€ ëª¸ì„ ë‹´ì€ ì—´ì°¨ëŠ” 서쪽으로 서쪽으로 í•´ê°€ 가는 걸ìŒì„ ë”°ë¼ì„œ 달리고 있소. 열차가 달리는 바퀴 ì†Œë¦¬ë„ ë°˜í–¥í•  ê³³ì´ ì—†ì–´ 힘없는 í•œìˆ¨ê°™ì´ ìŠ¤ëŸ¬ì§€ê³  마오. +ê¸°ì¨ ê°€ì§„ ì‚¬ëžŒì´ ì§€ë£¨í•´ì„œ 못 견딜 ì´ í’ê²½ì€ ë‚˜ê°™ì´ ìˆ˜ì‹¬ 가진 사람ì—게는 가장 ê³µìƒì˜ ë§ì„ ë‹¬ë¦¬ê¸°ì— í•©ë‹¹í•œ ê³³ì´ì˜¤. +ì´ ê³³ì—ë„ ì‚°ë„ ìžˆê³  ëƒ‡ë¬¼ë„ ìžˆê³  ì‚¼ë¦¼ë„ ìžˆê³  ê½ƒë„ í”¼ê³  ë‚ ì§ìŠ¹, 길ì§ìŠ¹ì´ ë‚ ê³  ê¸°ë˜ ë•Œë„ ìžˆì—ˆê² ì§€ìš”. ê·¸ëŸ¬ë˜ ê²ƒì´ ëª‡ë§Œ ë…„ 지나는 ë™ì•ˆì— ì‚°ì€ ë‚®ì•„ì§€ê³  ê³¨ì€ ë†’ì•„ì ¸ì„œ 마침내 ì´ ê¼´ì´ ëœ ê²ƒì¸ê°€ 하오. ë§Œì¼ í° íž˜ì´ ìžˆì–´ ì´ ê´‘ì•¼ë¥¼ 파낸다 하면 물 í르고 고기 ë†€ë˜ ê°•ê³¼, 울고 ì›ƒë˜ ìƒë¬¼ì´ ì‚´ë˜ ìžì·¨ê°€ ìžˆì„ ê²ƒì´ì˜¤. ì•„ì•„ ì´ ëª¨ë“  ê¸°ì–µì„ ê½‰ 품고 ì£½ì€ ë“¯ì´ ìž ìž í•œ 광야ì—! +ë‚´ê°€ 탄 차가 Fì—­ì— ë„ì°©í•˜ì˜€ì„ ë•Œì—는 ë¶ë§Œì£¼ ê´‘ì•¼ì˜ ì„ì–‘ì˜ ì•„ë¦„ë‹¤ì›€ì€ ê·¸ ê·¹ë„ì— ë‹¬í•œ 것 같았소. 둥긋한 지í‰ì„  ìœ„ì— ê±°ì˜ ê±¸ë¦° 커다란 í•´! 아마 ê·¸ 신비하고 ìž¥ì—„í•¨ì´ ë‚´ 경험으로는 ì´ ê³³ì—서밖ì—는 ë³¼ 수 없는 것ì´ë¼ê³ ìƒê°í•˜ì˜¤. ì´ê¸€ì´ê¸€ ì´ê¸€ì´ê¸€ ê·¸ëŸ¬ë©´ì„œë„ ë‘¥ê¸€ë‹¤ëŠ” 체모를 변치 아니하는 ê·¸ 지는 í•´! +게다가 먼 지í‰ì„ ìœ¼ë¡œë¶€í„° 기어드는 í™©í˜¼ì€ ì¸ì œëŠ” 대지를 ê±°ì˜ ë‹¤ ë®ì–´ 버려서 마른 풀로 ëœ ì§€ë©´ì€ ê°€ë­‡ê°€ë­‡í•œ ë¹›ì„ ë ê³  ì‚¬ë§‰ì˜ ê°€ëŠ” 모래를 ë¨¸ê¸ˆì€ ì§€ëŠ” í•´ì˜ ê´‘ì„ ì„ ë°˜ì‚¬í•˜ì—¬ì„œ 대기는 ì§™ì€ ìžì¤ë¹›ì„ 바탕으로 í•œ 가지ê°ìƒ‰ì˜ ëª…ì•”ì„ ê°€ì§„, ì˜¤ìƒ‰ì´ ì˜ë¡±í•œ, ë„무지 ë‚´ê°€ ì¼ì° 경험해 보지 못한 ìƒ‰ì±„ì˜ ì„¸ê³„ë¥¼ ì´ë£¨ì—ˆì†Œ. ì•„ 좋다! +ê·¸ ì†ì— 수ì€ê°™ì´ 빛나는, 수없는 ìž‘ê³  í° í˜¸ìˆ˜ë“¤ì˜ ë¹›! ê·¸ ì†ìœ¼ë¡œ 날아오는 수없고 ì´ë¦„ 모를 ìƒˆë“¤ì˜ ë–¼ë„ ì´ ì„¸ìƒì˜ 것ì´ë¼ê³ ëŠ” ìƒê°í•˜ì§€ 아니하오. +나는 ê±°ì˜ ë¬´ì˜ì‹ì ìœ¼ë¡œ ì°¨ì—ì„œ 뛰어내렸소. ê±°ì˜ ë– ë‚  ì‹œê°„ì´ ë‹¤ ë˜ì–´ì„œ ì§ì˜ ì¼ë¶€ë¶„ì€ ë¯¸ì²˜ ê°€ì§€ì§€ë„ ëª»í•˜ê³  뛰어내렸소. 반쯤 미친 것ì´ì˜¤. +정거장 ì•ž 조그마한 ì•„ë¼ì‚¬ ì‚¬ëžŒì˜ ì—¬ê´€ì—다가 ì§ì„ 맡겨 버리고 나는 ë‹¨ìž¥ì„ ëŒê³  ì² ë„ ì„ ë¡œë¥¼ ë›°ì–´ 건너서 í˜¸ìˆ˜ì˜ ìˆ˜ì€ë¹› 나는 ê³³ì„ ì°¾ì•„ì„œ 지향 ì—†ì´ ê±¸ì—ˆì†Œ. +í•œ 호수를 가서 ë³´ë©´ ë˜ ì € 편 호수가 ë” ì•„ë¦„ë‹¤ì›Œ ë³´ì´ì˜¤. ì›ì»¨ëŒ€ ì € 지는 í•´ê°€ 다 지기 ì „ì— ì´ ê´‘ì•¼ì— ìžˆëŠ” 호수를 다 ëŒì•„ë³´ê³  싶소. +ë‚´ê°€ 호숫 ê°€ì— ì„°ì„ ë•Œì— ê·¸ ê±°ìš¸ê°™ì´ ìž”ìž”í•œ í˜¸ìˆ˜ë©´ì— ë¹„ì¹˜ëŠ” ë‚´ 그림ìžì˜ 외로움ì´ì—¬, 그러나 아름다움ì´ì—¬! ê·¸ 호수는 ì˜ì›í•œ ìš°ì£¼ì˜ ì‹ ë¹„ë¥¼ 품고 í•˜ëŠ˜ì´ ì˜¤ë©´ 하늘ì„, 새가 오면 새를, êµ¬ë¦„ì´ ì˜¤ë©´ 구름ì„, 그리고 ë‚´ê°€ 오면 나를 비추지 아니하오. 나는 호수가 ë˜ê³  싶소. 그러나 형! 나는 ì´ í˜¸ìˆ˜ë©´ì—ì„œ 얼마나 ì •ìž„ì˜ ì–¼êµ´ì„ ì°¾ì•˜ê² ì†Œ. ê·¸ê²ƒì€ ë¬¼ë¦¬í•™ì ìœ¼ë¡œ 불가능한 ì¼ì´ê² ì§€ìš”. ë™ê²½ì˜ ë³‘ì‹¤ì— ëˆ„ì›Œ 있는 ì •ìž„ì˜ ëª¨ì–‘ì´ ëª½ê³  ì‚¬ë§‰ì˜ í˜¸ìˆ˜ë©´ì— ë¹„ì¹  리야 있겠소. 없겠지마는 나는 호수마다 ì •ìž„ì˜ ê·¸ë¦¼ìžë¥¼ 찾았소. 그러나 ë³´ì´ëŠ” ê²ƒì€ ì™¸ë¡œìš´ ë‚´ 그림ìžë¿ì´ì˜¤. +`ê°€ìž. ë없는 사막으로 í•œì—†ì´ ê°€ìž. 가다가 ë‚´ ê¸°ìš´ì´ ì§„í•˜ëŠ” ìžë¦¬ì— 나는 ë‚´ ì†ìœ¼ë¡œ 모래를 파고 ê·¸ ì†ì— ë‚´ ëª¸ì„ ë¬»ê³  죽어 버리ìž. ì‚´ì•„ì„œ 다시 ë³¼ 수 없는 ì •ìž„ì˜ ã€Œì´ë°ì•„ã€ë¥¼ 안고 ì´ ê¹¨ë—í•œ 광야ì—ì„œ 죽어 버리 ìž.' +하고 나는 지는 해를 향하고 한정 ì—†ì´ ê±¸ì—ˆì†Œ. ì‚¬ë§‰ì´ ë°›ì•˜ë˜ ë”°ëœ»í•œ ê¸°ìš´ì€ ì•„ì§ë„ 다 ì‹ì§€ëŠ” 아니하였소. 사막ì—는 바람 í•œ ì ë„ 없소. 소리 í•˜ë‚˜ë„ ì—†ì†Œ. ë°œìžêµ­ ë°‘ì—ì„œ 우는 마른 풀과 ëª¨ëž˜ì˜ ë°”ìŠ¤ë½ê±°ë¦¬ëŠ” 소리가 들릴 ë¿ì´ì˜¤. +나는 허리를 지í‰ì„ ì— 걸었소. ê·¸ 신비한 ê´‘ì„ ì€ ë‚´ 가슴으로부터 위ì—ë§Œì„ ë¹„ì¶”ê³  있소. +ë¬¸ë“ ë‚˜ëŠ” 해를 ë”°ë¼ê°€ëŠ” 별 ë‘ ê°œë¥¼ 보았소. 하나는 ì•žì„ ì„œê³  하나는 뒤를 섰소. ì•žì˜ ë³„ì€ ì¢€ í¬ê³  ë’¤ì˜ ë³„ì€ ì¢€ 작소. ì´ëŸ° ë³„ë“¤ì€ ì‚° ë§Žì€ ë‚˜ë¼ ë‹¤ì‹œ ë§í•˜ë©´ 서쪽 지í‰ì„ ì„ 보기 어려운 나ë¼ì—서만 ìƒìž¥í•œ 나로서는 보지 ëª»í•˜ë˜ ë³„ì´ì˜¤. 나는 ê·¸ ë³„ì˜ ì´ë¦„ì„ ëª¨ë¥´ì˜¤. `ë‘ ë³„'ì´ì˜¤. +í•´ê°€ 지í‰ì„ ì—ì„œ ëš ë–¨ì–´ì§€ìž ëŒ€ê¸°ì˜ ìžì¤ë¹›ì€ 남빛으로 변하였소. ì˜¤ì§ í•´ê°€ 금시 들어간 ìžë¦¬ì—만 주í™ë¹›ì˜ ì—¬ê´‘ì´ ìžˆì„ ë¿ì´ì˜¤. ë‚´ 눈앞ì—서는 남빛 안개가 피어오르는 듯하였소. ì•žì— ë³´ì´ëŠ” í˜¸ìˆ˜ë§Œì´ ìœ ë‚œížˆ 빛나오. ë˜ í•œ ë–¼ì˜ ì´ë¦„ 모를 ìƒˆë“¤ì´ ìˆ˜ë©´ì„ ìŠ¤ì¹˜ë©° ë‚  저문 ê²ƒì„ ë†€ë¼ëŠ” ë“¯ì´ ì–´ì§€ëŸ¬ì´ ë‚ ì•„ 지나가오. ê·¸ë“¤ì€ ì†Œë¦¬ë„ ì•„ë‹ˆ 하오. 날개치는 ì†Œë¦¬ë„ ì•„ë‹ˆ 들리오. ê·¸ê²ƒë“¤ì€ ì‚¬ë§‰ì˜ í™©í˜¼ì˜ í—ˆê¹¨ë¹„ì¸ ê²ƒ 같소. +나는 ìžê¾¸ 걷소. 해를 ë”°ë¥´ë˜ ë‚˜ëŠ” ë‘ ë³„ì„ ë”°ë¼ì„œ ìžê¾¸ 걷소. +ë³„ë“¤ì€ ì§„ 해를 ë”°ë¼ì„œ ë°”ì‚ ê±·ëŠ” ê²ƒë„ ê°™ê³ , 헤매는 나를 ì–´ë–¤ 나ë¼ë¡œ ë„는 ê²ƒë„ ê°™ì†Œ. +아니 ë‘ ë³„ ì¤‘ì— ì•žì„  ë³„ì´ í•œ 번 ë°˜ì§í•˜ê³ ëŠ” 최후로 í•œ 번 ë°˜ì§í•˜ê³ ëŠ” 지í‰ì„  ë°‘ì— ìˆ¨ì–´ 버리고 마오. ë’¤ì— ë‚¨ì€ ì™¸ë³„ì˜ ì™¸ë¡œì›€ì´ì—¬! 나는 울고 싶었소. 그러나 나는 하나만 ë‚¨ì€ ìž‘ì€ ë³„ 외로운 ìž‘ì€ ë³„ì„ ë”°ë¼ì„œ ë” ë¹¨ë¦¬ 걸ìŒì„ 걸었소. ê·¸ í•œ 별마저 넘어가 버리면 나는 어찌하오. +ë‚´ê°€ 웬ì¼ì´ì˜¤. 나는 ì‹œì¸ë„ 아니요, ì˜ˆìˆ ê°€ë„ ì•„ë‹ˆì˜¤. 나는 정으로 í–‰ë™í•œ ì¼ì€ 없다고 믿는 사람ì´ì˜¤. 그러나 형! ì´ ë•Œì— ë¯¸ì¹œ ê²ƒì´ ì•„ë‹ˆìš”, ë‚´ 가슴ì—는 무엇ì¸ì§€ 모를 ê²ƒì„ ë”°ë¥¼ 요샛ë§ë¡œ ì´ë¥¸ë°” ë™ê²½ìœ¼ë¡œ 찼소. +`ì•„ì•„ ì € ìž‘ì€ ë³„!' +ê·¸ê²ƒë„ ì§€í‰ì„ ì— 닿았소. +`ì•„ì•„ ì € ìž‘ì€ ë³„. 저것마저 넘어가면 나는 어찌하나.' +ì¸ì œëŠ” 어둡소. ê´‘ì•¼ì˜ í™©í˜¼ì€ ëª…ìƒ‰ë¿ì´ìš”, 순ì‹ê°„ì´ìš”, í•´ì§€ìž ì‹ ë¹„í•˜ë‹¤ê³  í•  만한 극히 ì§§ì€ ë™ì•ˆì— 아름다운 í™©í˜¼ì„ ì¡°ê¸ˆ ë³´ì´ê³ ëŠ” 곧 ì¹ ê³¼ ê°™ì€ ì•”í‘ì´ì˜¤. í˜¸ìˆ˜ì˜ ë¬¼ë§Œì´ ì–´ë””ì„œ ì€ë¹›ì„ 받았는지 뿌옇게 ë‚˜ë§Œì´ ìœ ì¼í•œ 존재다, ë‚˜ë§Œì´ ìœ ì¼í•œ ë¹›ì´ë‹¤ 하는 ë“¯ì´ ì¸ì œëŠ” 수ì€ë¹›ì´ ì•„ë‹ˆë¼ ë‚¨ë¹›ì„ ë°œí•˜ê³  ìžˆì„ ë¿ì´ì˜¤. +나는 ê·¸ 중 ë¹›ì„ ë§Žì´ ë°›ì€, ê·¸ 중 환해 ë³´ì´ëŠ” í˜¸ìˆ˜ë©´ì„ ì°¾ì•„ ë‘리번거리며, 그러나 빠른 걸ìŒìœ¼ë¡œ 헤매었소. 그러나 ë‚´ê°€ ì¢€ë” ë§‘ì€ í˜¸ìˆ˜ë©´ì„ ì°¾ëŠ” ë™ì•ˆì— ì´ ê´‘ì•¼ì˜ ì–´ë‘ ì€ ë”ìš±ë”ìš± 짙어지오. +나는 ì–´ë–¤ 조그마한 호숫 ê°€ì— íŽ„ì© ì•‰ì•˜ì†Œ. ë‚´ ì•žì—는 ì§™ì€ ë‚¨ë¹›ì˜ ìˆ˜ë©´ì— ì¡°ê·¸ë§ˆí•œ 거울만한 ë°ì€ ë°ê°€ 있소. 마치 ë‚´ 눈ì—ì„œ 무슨 ë¹›ì´ ë‚˜ì™€ì„œ, 아마 ì •ìž„ì„ ê·¸ë¦¬ì›Œí•˜ëŠ” ë¹›ì´ ë‚˜ì™€ì„œ ê·¸ ìˆ˜ë©´ì— ë°˜ì‚¬í•˜ëŠ” 듯ì´. 나는 í—ˆê²ì§€ê² ê·¸ 빤한 ìˆ˜ë©´ì„ ë“¤ì—¬ë‹¤ë³´ì•˜ì†Œ. 혹시나 ì •ìž„ì˜ ëª¨ì–‘ì´ ê±°ê¸° 나타나지나 아니할까 하고. 세ìƒì—는 그러한 기ì ë„ 있지 아니한가 하고. +물ì—는 ì •ìž„ì˜ ì–¼êµ´ì´ ì–´ë¥¸ê±°ë¦¬ëŠ” 것 같았소. ì´ë”°ê¸ˆ ì •ìž„ì˜ ëˆˆë„ ì–´ë¥¸ê±°ë¦¬ê³  ì½”ë„ ë²ˆëœ»ê±°ë¦¬ê³  ìž…ë„ ë²ˆëœ»ê±°ë¦¬ëŠ” 것 같소. 그러나 ìˆ˜ë©´ì€ ì ì  ì–´ë‘워 가서 ê·¸ 환ì˜ì¡°ì°¨ ë”ìš± í¬ë¯¸í•´ì§€ì˜¤. +나는 í˜¸ìˆ˜ë©´ì— ë¹¤í•˜ë˜ í•œ ì¡°ê°ì¡°ì°¨ 캄캄해지는 ê²ƒì„ ë³´ê³  ìˆ¨ì´ ë§‰íž ë“¯í•¨ì„ ê¹¨ë‹¬ìœ¼ë©´ì„œ 고개를 들었소. +고개를 들려고 í•  ë•Œì—, 형ì´ì—¬, ì´ìƒí•œ ì¼ë„ 다 있소. ê·¸ ìˆ˜ë©´ì— ì •ìž„ì˜ ëª¨ì–‘ì´, 얼굴만 아니ë¼, ê·¸ 몸 ì˜¨í†µì´ ê·¸ 어깨, 가슴, 팔, 다리까지ë„, ê·¸ 눈과 입까지ë„, ê·¸ ì–¼êµ´ì˜ í° ê²ƒê³¼ ìž…ìˆ ì´ ë¶ˆê·¸ë ˆí•œ 것까지ë„, 마치 환한 ëŒ€ë‚®ì— ì‹¤ë¬¼ì„ ëŒ€í•œ 모양으로 소ìƒí•˜ê²Œ 나타났소. +"ì •ìž„ì´!" +하고 나는 소리를 지르며 물로 뛰어들려 하였소. 그러나 형, ê·¸ ìˆœê°„ì— ì •ìž„ì˜ ëª¨ì–‘ì€ ì‚¬ë¼ì ¸ 버리고 ë§ì•˜ì†Œ. +나는 ì´ ì–´ë‘  ì†ì— ì–´ë”” ì •ìž„ì´ê°€ 나를 ë”°ë¼ì˜¨ ê²ƒê°™ì´ ìƒê°í–ˆì†Œ. 혹시나 ì •ìž„ì´ê°€ 죽어서 ê·¸ ëª¸ì€ ë™ê²½ì˜ 대학 병ì›ì— ë²—ì–´ ë‚´ì–´ë˜ì§€ê³  í˜¼ì´ ë¹ ì ¸ 나와서 ë¬¼ì— ë¹„ì¹˜ì—ˆë˜ ê²ƒì´ ì•„ë‹ê¹Œ, 나는 ê°€ìŠ´ì´ ìš¸ë ê±°ë¦¼ì„ 진정치 못하면서 호숫 ê°€ì—ì„œ 벌떡 ì¼ì–´ë‚˜ì„œ ì–´ë‘  ì†ì— ì •ìž„ì„ ë§Œì ¸ë³´ë ¤ëŠ” 듯ì´, ì–´ë‘워서 ëˆˆì— ë³´ì§€ëŠ” 못하ë”ë¼ë„ ìžê¾¸ 헤매노ë¼ë©´ ëª¸ì— ë¶€ë”ªížˆê¸°ë¼ë„ í•  것 같아서 함부로 헤매었소. 그리고는 ëˆˆì•žì— ë²ˆëœ»ê±°ë¦¬ëŠ” ì •ìž„ì˜ í™˜ì˜ì„ íŒ”ì„ ë²Œë ¤ì„œ 안고 소리를 ë‚´ì–´ì„œ 불렀소. +"ì •ìž„ì´, ì •ìž„ì´." +하고 나는 ìˆ˜ì—†ì´ ì •ìž„ì„ ë¶€ë¥´ë©´ì„œ 헤매었소. +그러나 형, ì´ê²ƒë„ 죄지요. ì´ê²ƒë„ 하나님께서 금하시는 ì¼ì´ì§€ìš”. 그러길래 ê´‘ì•¼ì— ì•„ì£¼ ì–´ë‘ ì´ ë®ì´ê³  새까만 í•˜ëŠ˜ì— ë³„ì´ ì´ì´í•˜ê²Œ 나고는 ì˜ ì •ìž„ì˜ í—›ê·¸ë¦¼ìžì¡°ì°¨ 아니 ë³´ì´ì§€ìš”. 나는 죄를 피해서 ì •ìž„ì„ ë– ë‚˜ì„œ 멀리 온 것ì´ë‹ˆ ì •ìž„ì˜ í—›ê·¸ë¦¼ìžë¥¼ ë”°ë¼ë‹¤ë‹ˆëŠ” ê²ƒë„ ì˜³ì§€ 않지요. +그렇지만 ë‚´ê°€ ì´ë ‡ê²Œ 혼ìžì„œ ì •ìž„ì„ ìƒê°ë§Œ 하는 것ì´ì•¼ 무슨 죄 ë  ê²ƒì´ ìžˆì„까요. ë‚´ê°€ ì •ìž„ì„ ë§Œ 리나 떠나서 ì´ë ‡ê²Œ 헛그림ìžë‚˜ 그리며 그리워하는 것ì´ì•¼ 무슨 죄가 ë ê¹Œìš”. 설사 죄가 ë˜ê¸°ë¡œì„œë‹ˆ 낸들 ì´ê²ƒê¹Œì§€ì•¼ 어찌하오. ë‚´ê°€ ë‚´ í˜¼ì„ ì£½ì—¬ 버리기 ì „ì—야 ë‚´ 힘으로 어찌하오. 설사 죄가 ë˜ì–´ì„œ ë‚´ê°€ ì§€ì˜¥ì˜ êº¼ì§€ì§€ 않는 유황불 ì†ì—ì„œ ì˜ì›í•œ í˜•ë²Œì„ ë°›ê²Œ ë˜ê¸°ë¡œì„œë‹ˆ ê·¸ê²ƒì„ ì–´ì°Œí•˜ì˜¤. 형, ì´ê²ƒ, ì´ê²ƒë„ ë§ì•„야 옳ì€ê°€ìš”. ì •ìž„ì˜ í—›ê·¸ë¦¼ìžê¹Œì§€ë„ ëŠì–´ 버려야 옳ì€ê°€ìš”. +ì´ ë•Œìš”. 바로 ì´ ë•Œìš”. ë‚´ ì•ž 수십 보나 ë ê¹Œ(캄캄한 ë°¤ì´ë¼ 먼지 가까운지 분명히 ì•Œ 수 없지마는) 하는 ê³³ì— ë‚œë°ì—†ëŠ” 등불 하나가 나서오. 나는 ê¹œì§ ë†€ë¼ì„œ ìš°ëš ì„°ì†Œ. ì´ ë¬´ì¸ì§€ê²½, ì´ ë°¤ì¤‘ì— ê°‘ìžê¸° ë³´ì´ëŠ” 등불 ê·¸ê²ƒì€ ë§ˆì¹˜ ì´ ì„¸ìƒ ê°™ì§€ 아니하였소. +ì € ë“±ë¶ˆì´ ì–´ë–¤ 등불ì¼ê¹Œ, ê·¸ ë“±ë¶ˆì´ ëª‡ ê±¸ìŒ ê°€ê¹Œì´ ì˜¤ë‹ˆ, ê·¸ 등불 ë’¤ì— ì‚¬ëžŒì˜ ë‹¤ë¦¬ê°€ ë³´ì´ì˜¤. +"누구요?" +하는 ê²ƒì€ ê·€ì— ìµì€ ì¡°ì„ ë§ì´ì˜¤. 어떻게 ì´ ëª½ê³ ì˜ ê´‘ì•¼ì—ì„œ ì¡°ì„ ë§ì„ 들ì„까 하고 나는 ë“±ë¶ˆì„ ì²˜ìŒ ë³¼ 때보다 ë”ìš± 놀ëžì†Œ. +"나는 ì§€ë‚˜ê°€ë˜ ì‚¬ëžŒì´ì˜¤." +하고 ë‚˜ë„ ë“±ë¶ˆì„ í–¥í•˜ì—¬ 마주 걸어갔소. +ê·¸ ì‚¬ëžŒì€ ë“±ë¶ˆì„ ë“¤ì–´ì„œ ë‚´ ì–¼êµ´ì„ ë¹„ì¶”ì–´ ë³´ë”니, +"당신 ì¡°ì„  사람ì´ì˜¤?" +하고 묻소. +"네, 나는 ì¡°ì„  사람ì´ì˜¤. ë‹¹ì‹ ë„ ìŒì„±ì„ 들으니 ì¡°ì„  사람ì¸ë°, 어떻게 ì´ëŸ° 광야ì—, ì•„ë‹Œ 밤중ì—, 여기 계시단 ë§ì´ì˜¤." +하고 나는 놀ë¼ëŠ” 표정 그대로 대답하였소. +"나는 ì´ ê·¼ë°©ì— ì‚¬ëŠ” 사람ì´ë‹ˆê¹Œ 여기 오는 ê²ƒë„ ìžˆì„ ì¼ì´ì§€ë§ˆëŠ” 당신ì´ì•¼ë§ë¡œ ì´ ì•„ë‹Œ 밤중ì—." +하고 육혈í¬ë¥¼ 집어넣고, ì†ì„ 내밀어서 내게 악수를 구하오. +나는 반갑게 ê·¸ì˜ ì†ì„ 잡았소. 그러나 나는 `ì£½ì„ ì§€ê²½ì— ì–´ë–»ê²Œ 오셨단 ë§ì´ì˜¤.' 하고, 그가 ë‚´ê°€ 무슨 ì•…ì˜ë¥¼ 가진 í‰í•œì´ ì•„ë‹Œ ì¤„ì„ ì•Œê³  ì†ì— ë¹¼ì–´ë“¤ì—ˆë˜ ìœ¡í˜ˆí¬ë¡œ 시기를 ìž ê¹ì´ë¼ë„ 노린 ê²ƒì„ ë¶ˆì¾Œí•˜ê²Œ ìƒê°í•˜ì˜€ë˜ 것ì´ì˜¤. +ê·¸ë„ ë‚´ ì´ë¦„ë„ ë¬»ì§€ 아니하고 ë˜ ë‚˜ë„ ê·¸ì˜ ì´ë¦„ì„ ë¬»ì§€ 아니하고 나는 ê·¸ì—게 ëŒë ¤ì„œ 그가 ì¸ë„하는 곳으로 갔소. ê·¸ ê³³ì´ëž€ ê²ƒì€ ì•„ê¹Œ ë“±ë¶ˆì´ ì²˜ìŒ ë‚˜íƒ€ë‚˜ë˜ ê³³ì¸ ë“¯í•œë°, 거기서 ë˜ í•œ 번 놀란 ê²ƒì€ ì–´ë–¤ 부ì¸ì´ 있는 것ì´ì˜¤. 남ìžëŠ” ì•„ë¼ì‚¬ì‹ ì–‘ë³µì„ ìž…ì—ˆìœ¼ë‚˜ 부ì¸ì€ 중국 옷 비슷한 ì˜·ì„ ìž…ì—ˆì†Œ. 남ìžëŠ” 나를 ëŒì–´ì„œ ê·¸ 부ì¸ì—게 ì¸ì‚¬í•˜ê²Œ 하고, +"ì´ëŠ” ë‚´ ì•„ë‚´ìš”." +하고 ë˜ ê·¸ ì•„ë‚´ë¼ëŠ” 부ì¸ì—게는, +"ì´ ì´ëŠ” ì¡°ì„  ì–‘ë°˜ì´ì˜¤. ì„±í•¨ì´ ë‰˜ì‹œì£ ?" +하고 그는 나를 ë°”ë¼ë³´ì˜¤. 나는, +"최ì„입니다." +하고 바로 대답하였소. +"ìµœì„ ì”¨?" +하고 ê·¸ 남ìžëŠ” ì†Œê°œí•˜ë˜ ê²ƒë„ ìžŠì–´ë²„ë¦¬ê³  ë‚´ ì–¼êµ´ì„ ë“¤ì—¬ë‹¤ë³´ì˜¤. +"네, 최ì„입니다." +"ì•„ â—â—í•™êµ êµìž¥ìœ¼ë¡œ 계신 ìµœì„ ì”¨." +하고 ê·¸ 남ìžëŠ” ë”ìš± 놀ë¼ì˜¤. +"네, 어떻게 ë‚´ ì´ë¦„ì„ ì•„ì„¸ìš”?" +하고 ë‚˜ë„ ê·¸ê°€ 혹시 아는 사람ì´ë‚˜ 아닌가 하고 등불 ë¹›ì— ì–¼êµ´ì„ ë“¤ì—¬ë‹¤ 보았으나 ë„무지 ê·¸ ì–¼êµ´ì´ ë³¸ ê¸°ì–µì´ ì—†ì†Œ. +"최 ì„ ìƒì„ ë‚´ê°€ 압니다. 남 ì„ ìƒí•œí…Œ ë§ì”€ì„ ë§Žì´ ë“¤ì—ˆì§€ìš”. ê·¸ëŸ°ë° ë‚¨ ì„ ìƒë„ ëŒì•„가신 지가 ë²Œì¨ ëª‡ 핸가." +하고 ê°ê°œë¬´ëŸ‰í•œ ë“¯ì´ ê·¸ 아내를 ëŒì•„보오. +"십오 ë…„ì´ì§€ìš”." +하고 ê³ì— ì„°ë˜ ë¶€ì¸ì´ ë§í•˜ì˜¤. +"ë²Œì¨ ì‹­ì˜¤ ë…„ì¸ê°€." +하고 ê·¸ 남ìžëŠ” 나를 ë³´ê³ , +"ì •ìž„ì´ ìž˜ ìžëžë‹ˆê¹Œ? ë²Œì¨ ì´ì‹­ì´ 넘었지." +하고 ë˜ ë¶€ì¸ì„ ëŒì•„보오. +"스물세 ì‚´ì´ì§€." +하고 부ì¸ì´ 확실치 아니한 ë“¯ì´ ëŒ€ë‹µí•˜ì˜¤. +"네, 스물세 살입니다. 지금 ë™ê²½ì— 있습니다. ë³‘ì´ ë‚˜ì„œ ìž…ì›í•œ ê²ƒì„ ë³´ê³  왔는ë°." +하고 나는 ë²ˆê°œê°™ì´ ì •ìž„ì˜ ë³‘ì‹¤ê³¼ ì •ìž„ì˜ í˜¸í…” 장면 ë“±ì„ ìƒê°í•˜ê³  ê°€ìŠ´ì´ ì„¤ë ˜ì„ ê¹¨ë‹¬ì•˜ì†Œ. ì˜ì™¸ì¸ ê³³ì—ì„œ ì˜ì™¸ì¸ ì‚¬ëžŒë“¤ì„ ë§Œë‚˜ì„œ ì •ìž„ì˜ ë§ì„ 하게 ëœ ê²ƒì„ ê¸°ë»í•˜ì˜€ì†Œ. +"무슨 병입니까. ì •ìž„ì´ê°€ 본래 ëª¸ì´ ì•½í•´ì„œ." +하고 부ì¸ì´ ì§ì ‘ 내게 묻소. +"네. ëª¸ì´ ì¢€ 약합니다. ë³‘ì´ ì¢€ ë‚˜ì€ ê²ƒì„ ë³´ê³  떠났습니다마는 염려가 ë©ë‹ˆë‹¤." +하고 나는 무ì˜ì‹ì¤‘ì— ê³ ê°œë¥¼ ë™ê²½ì´ 있는 방향으로 ëŒë ¸ì†Œ. 마치 고개를 ë™ìœ¼ë¡œ ëŒë¦¬ë©´ ì •ìž„ì´ê°€ ë³´ì´ê¸°ë‚˜ í•  것같ì´. +"ìž, 우리 집으로 갑시다." +하고 나는 ì•„ì§ ê·¸ì˜ ì„±ëª…ë„ ëª¨ë¥´ëŠ” 남ìžëŠ”, ê·¸ì˜ ì•„ë‚´ë¥¼ 재촉하ë”니, +"우리가 ì¡°ì„  ë™í¬ë¥¼ 만난 ê²ƒì´ ì‹­ì—¬ ë…„ 만ì´ì˜¤. ê·¸ëŸ°ë° ìµœ ì„ ìƒ, ì´ê²ƒì„ 좀 보시고 가시지요." +하고 그는 빙그레 웃으면서 나를 서너 ê±¸ìŒ ëŒê³  가오. 거기는 조그마한 무ë¤ì´ 있고 ê·¸ ì•žì—는 ì„ ìž ë†’ì´ë‚˜ ë˜ëŠ” 목패를 ì„¸ì› ëŠ”ë° ê·¸ 목패ì—는 `ë‘ ë³„ 무ë¤'ì´ë¼ëŠ” 넉 ìžë¥¼ ì¼ì†Œ. +ë‚´ê°€ ì´ìƒí•œ 눈으로 ê·¸ 무ë¤ê³¼ 목패를 ë³´ê³  있는 ê²ƒì„ ë³´ê³  그는, +"ì´ê²Œ 무슨 무ë¤ì¸ì§€ 아십니까?" +하고 유쾌하게 묻소. +"ë‘ ë³„ 무ë¤ì´ë¼ë‹ˆ 무슨 뜻ì¸ê°€ìš”?" +하고 ë‚˜ë„ ê·¸ì˜ ìœ ì¾Œí•œ í‘œì •ì— ì „ì—¼ì´ ë˜ì–´ì„œ 웃고 물었소. +"ì´ê²ƒì€ 우리 ë‘˜ì˜ ë¬´ë¤ì´ì™¸ë‹¤." +하고 그는 ì•„ë‚´ì˜ ì–´ê¹¨ë¥¼ 치며 유쾌하게 웃었소. 부ì¸ì€ 부ë„러운 ë“¯ì´ ì›ƒê³  고개를 숙ì´ì˜¤. +ë„무지 ëª¨ë‘ ê¿ˆ 같고 í™˜ì˜ ê°™ì†Œ. +"ìž ê°‘ì‹œë‹¤. ìžì„¸í•œ ë§ì€ 우리 ì§‘ì— ê°€ì„œ 합시다." +하고 서너 ê±¸ìŒ ì–´ë–¤ 방향으로 걸어가니 거기는 ë§ì„ 세 í•„ì´ë‚˜ 맨 마차가 있소. 몽고 ì‚¬ëžŒë“¤ì´ ê°€ì¡±ì„ ì‹£ê³  수초를 ë”°ë¼ ëŒì•„다니는 그러한 마차요. ì‚¿ìžë¦¬ë¡œ í™ì˜ˆí˜•ì˜ ì§€ë¶•ì„ ë§Œë“¤ê³  ê·¸ ì†ì— 들어가 앉게 ë˜ì—ˆì†Œ. ê·¸ì˜ ë¶€ì¸ê³¼ 나와는 ì´ ì§€ë¶• ì†ì— 들어앉고 그는 ì†ìˆ˜ ì–´ìžëŒ€ì— 앉아서 입으로 쮸쮸쮸쮸 하고 ë§ì„ 모오. ë“±ë¶ˆë„ êº¼ 버리고 캄캄한 ì†ìœ¼ë¡œ 달리오. +"ë¶ˆì´ ìžˆìœ¼ë©´ 군대ì—ì„œ ì˜ì‹¬ì„ 하지요. ë„ì ë†ˆì´ 엿보지요. 게다가 ë¶ˆì´ ìžˆìœ¼ë©´ ë„리어 ì•žì´ ì•ˆ ë³´ì¸ë‹¨ ë§ìš”. 쯧쯧쯧쯧!" +하는 소리가 들리오. +대체 ì´ ì‚¬ëžŒì€ ë¬´ìŠ¨ 사람ì¸ê°€. ë˜ ì´ ë¶€ì¸ì€ 무슨 사람ì¸ê°€ 하고 나는 ì–´ë‘ìš´ ì†ì—ì„œ í˜¼ìž ìƒê°í•˜ì˜€ì†Œ. 다만 ìž ì‹œ 본 ì¸ìƒìœ¼ë¡œ ë³´ì•„ì„œ ê·¸ë“¤ì€ í–‰ë³µëœ ë¶€ë¶€ì¸ ê²ƒ 같았소. ê·¸ë“¤ì´ ë¬´ì—‡ 하러 ì´ ì•„ë‹Œ ë°¤ì¤‘ì— ê´‘ì•¼ì— ë‚˜ì™”ë˜ê°€. ë˜ ê·¸ ì´ìƒì•¼ë¦‡í•œ ë‘ ë³„ 무ë¤ì´ëž€ 무엇ì¸ê°€. +나는 불현듯 ì§‘ì„ ìƒê°í•˜ì˜€ì†Œ. ë‚´ 아내와 ì–´ë¦°ê²ƒë“¤ì„ ìƒê°í•˜ì˜€ì†Œ. 가정과 사회ì—ì„œ 쫓겨난 ë‚´ê°€ 아니오. 쫓겨난 ìžì˜ ìƒê°ì€ 언제나 슬픔ë¿ì´ì—ˆì†Œ. +나는 ë‚´ 아내를 ì›ë§ì¹˜ 아니하오. 그는 ê²°ì½” ì•…í•œ ì—¬ìžê°€ 아니오. 다만 보통 ì—¬ìžìš”. 그는 질투 ë•Œë¬¸ì— ì´ì„±ì˜ íž˜ì„ ìžƒì€ ê²ƒì´ì˜¤. ì—¬ìžê°€ 질투 ë•Œë¬¸ì— ì´ì„±ì„ 잃는 ê²ƒì´ ì²œì§ì´ ì•„ë‹ê¹Œìš”. 그가 나를 사랑하길래 나를 위해서 질투를 가지는 ê²ƒì´ ì•„ë‹ˆì˜¤. +설사 질투가 그로 하여금 ì¹¼ì„ ë“¤ì–´ ë‚´ ê°€ìŠ´ì„ ì°Œë¥´ê²Œ 하였다 하ë”ë¼ë„ 나는 ê°ì‚¬í•œ ìƒê°ì„ 가지고 ëˆˆì„ ê°ì„ 것ì´ì˜¤. 사랑하는 ìžëŠ” 질투한다고 하오. 질투를 누르는 ê²ƒë„ ì•„ë¦„ë‹¤ìš´ ì¼ì´ì§€ë§ˆëŠ” ì§ˆíˆ¬ì— íƒ€ëŠ” ê²ƒë„ ì•„ë¦„ë‹¤ìš´ ì¼ì´ ì•„ë‹ê¹Œìš”. +ëœí¬ëŸ­ëœí¬ëŸ­ 하고 차바퀴가 ì² ë¡œê¸¸ì„ ë„˜ì–´ê°€ëŠ” 소리가 나ë”니 ì´ìœ½ê³  마차는 섰소. +ì•žì— ë¹¨ê°›ê²Œ ë¶ˆì´ ë¹„ì¹˜ì˜¤. +"ìž ì´ê²Œ 우리 집ì´ì˜¤." +하고 그가 마차ì—ì„œ 뛰어내리는 ì–‘ì´ ë³´ì´ì˜¤. ë‚´ë ¤ 보니까 ë‹¬ì´ ì˜¬ë¼ì˜¤ì˜¤. 굉장히 í° ë‹¬ì´, ë¶‰ì€ ë‹¬ì´ ì§€í‰ì„ ìœ¼ë¡œì„œ 넘ì„하고 올ë¼ì˜¤ì˜¤. +ë‹¬ë¹›ì— ë¹„ì¶”ì¸ ë°”ë¥¼ ë³´ë©´ 네모나게 ë‹´ ë‹´ì´ë¼ê¸°ë³´ë‹¤ëŠ” ì„±ì„ ë‘˜ëŸ¬ìŒ“ì€ ë‹¬ 뜨는 곳으로 열린 ëŒ€ë¬¸ì„ ë“¤ì–´ì„œì„œ ë„“ì€ ë§ˆë‹¹ì— ë‚´ë¦° ê²ƒì„ ë°œê²¬í•˜ì˜€ì†Œ. +"아버지!" +"엄마!" +하고 ì•„ì´ë“¤ì´ 뛰어나오오. ë§ë§Œí¼ì´ë‚˜ í° ê°œê°€ 네 놈ì´ë‚˜ 꼬리를 치고 나오오. ê·¸ë†ˆë“¤ì´ ì£¼ì¸ì§‘ 마차 소리를 알아듣고 짖지 아니한 모양ì´ì˜¤. +í° ì•„ì´ëŠ” 계집애로 ì—¬ë‚¨ì€ ì‚´, ìž‘ì€ ì•„ì´ëŠ” 사내로 육칠 세, ëª¨ë‘ ì¤‘êµ­ ì˜·ì„ ìž…ì—ˆì†Œ. +우리는 방으로 들어갔소. ë°©ì€ ì•„ë¼ì‚¬ì‹ 절반, ì¤‘êµ­ì‹ ì ˆë°˜ìœ¼ë¡œ ì„¸ê°„ì´ ë†“ì—¬ 있고 ë²½ì—는 ì¡°ì„  지ë„와 ë‹¨êµ°ì˜ ì´ˆìƒì´ 걸려 있소. +그들 부처는 지ë„와 단군 ì´ˆìƒ ì•žì— í—ˆë¦¬ë¥¼ 굽혀 배례하오. ë‚˜ë„ ë¬´ì˜ì‹ì ìœ¼ë¡œ 그대로 하였소. +그는 차를 마시며 ì´ë ‡ê²Œ ë§í•˜ì˜¤. +"우리는 ìžì‹ë“¤ì„ ì´ í¥ì•ˆë ¹ 가까운 무변 광야ì—ì„œ 기르는 것으로 ë‚™ì„ ì‚¼ê³  있지요. ì¡°ì„  ì‚¬ëžŒë“¤ì€ í•˜ë„ ë§ˆìŒì´ ìž‘ì•„ì„œ 걱정ì´ë‹ˆ ì´ëŸ° 호호탕탕한 ë„“ì€ ë²ŒíŒì—ì„œ 길러나면 마ìŒì´ 좀 커질까 하지요. ë˜ í¥ì•ˆë ¹ ë°‘ì—ì„œ 지나 중ì›ì„ 통ì¼í•œ ì œì™•ì´ ë§Žì´ ë‚¬ìœ¼ë‹ˆ 혹시나 ê·¸ 정기가 남아 있ì„까 하지요. 우리 ë¶€ì²˜ì˜ ìžì†ì´ 몇 대를 ë‘ê³  í¼ì§€ëŠ” ë™ì•ˆì—는 행여나 ë§ˆìŒ í° ì¸ë¬¼ì´ 하나 둘 날는지 알겠어요, 하하하하." +하고 그는 ì œ ë§ì„ 제가 비웃는 ë“¯ì´ í•œë°”íƒ• 웃고 나서, +"그러나 ì´ê±´ ë‚´ 진정ì´ì™¸ë‹¤. ìš°ë¦¬ë„ ì´ë ‡ê²Œ ê³ êµ­ì„ ë– ë‚˜ 있지마는 ê·¸ëž˜ë„ ê³ êµ­ 소ì‹ì´ ê¶ê¸ˆí•´ì„œ 신문 하나는 늘 보지요. 하지만 ì–´ë”” ì‹œì›í•œ 소ì‹ì´ 있어요. 그저 조리복소니가 ë˜ì–´ê°€ëŠ” ê²ƒì´ ì•„ë‹ˆë©´ 조그마한 ìƒê°ì„ 가지고, 눈곱만한 ì•¼ì‹¬ì„ ê°€ì§€ê³ , ì„œ 푼어치 안 ë˜ëŠ” ì´ìƒì„ 가지고 찧고 까불고 싸우고 하는 ê²ƒë°–ì— ì•ˆ ë³´ì´ë‹ˆ ì´ê±° ì–´ë”” ì‚´ 수가 있나. 그래서 나는 ë§ˆìŒ í° ìžì†ì„ 낳아서 길러 볼까 하고 ì´ë¥¼í…Œë©´ 새 ë¯¼ì¡±ì„ í•˜ë‚˜ 만들어 볼까 하고, 둘째 단군, 둘째 아브ë¼í•¨ì´ë‚˜ 하나 낳아 볼까 하고 하하하하앗하." +하고 유쾌하게, 그러나 비통하게 웃소. +나는 ì €ë…ì„ êµ¶ì–´ì„œ ë°°ê°€ 고프고, ë°¤ê¸¸ì„ ê±¸ì–´ì„œ ëª¸ì´ ê³¤í•œ ê²ƒë„ ìžŠê³  ê·¸ì˜ ë§ì„ 들었소. +부ì¸ì´ ê¹€ì´ ë¬´ëŸ­ë¬´ëŸ­ 나는 í˜¸ë–¡ì„ í° ëšë°°ê¸°ì— ë‹´ê³  김치를 ìž‘ì€ ëšë°°ê¸°ì— ë‹´ê³ , ë˜ ë¼ì§€ê³ ê¸° ì‚¶ì€ ê²ƒì„ í•œ ì ‘ì‹œ 담아다가 íƒìž ìœ„ì— ë†“ì†Œ. +건넌방ì´ë¼ê³  í•  만한 ë°©ì—ì„œ ì –ë¨¹ì´ ìš°ëŠ” 소리가 들리오. 부ì¸ì€ 삼십ì´ë‚˜ ë˜ì—ˆì„까, ë‚¨íŽ¸ì€ ì„œë¥¸ëŒ“ ë˜ì—ˆì„ 듯한 키가 í›¨ì© í¬ê³  눈과 코가 í¬ê³  ì†ë„ í° ê±´ìž¥í•œ 대장부요, ìŒì„±ì´ 부드러운 ê²ƒì´ ì²´ê²©ì— ì–´ìš¸ë¦¬ì§€ 아니하나 ê·¸ê²ƒì´ ì•„ë§ˆ ê·¸ì˜ ì •ì‹  ìƒí™œì´ ë†’ì€ í‘œê² ì§€ìš”. +"신문ì—ì„œ 최 ì„ ìƒì´ í•™êµë¥¼ 고만ë‘시게 ë˜ì—ˆë‹¤ëŠ” ë§ë„ 보았지요. 그러나 나는 ê·¸ê²ƒì´ ë‹¤ 최 ì„ ìƒì—게 대한 중ìƒì¸ ì¤„ì„ ì§ìž‘하였고, ë˜ ì˜¤ëŠ˜ ì´ë ‡ê²Œ 만나 보니까 ë”구나 ê·¸ê²ƒì´ ë‹¤ 중ìƒì¸ ì¤„ì„ ì•Œì§€ìš”." +하고 그는 확신 있는 ì–´ì¡°ë¡œ ë§í•˜ì˜¤. +"고맙습니다." +나는 ì´ë ‡ê²Œë°–ì— ëŒ€ë‹µí•  ë§ì´ 없었소. +"ì•„, 머, 고맙다고 하실 ê²ƒë„ ì—†ì§€ìš”." +하고 그는 머리를 뒤로 젖히고 한참ì´ë‚˜ ìƒê°ì„ 하ë”니 ìš°ì„  껄껄 한바탕 웃고 나서, +"ë‚´ê°€ 최 ì„ ìƒì´ 당하신 경우와 ê¼­ ê°™ì€ ê²½ìš°ë¥¼ 당하였거든요. ì´ë¥¼í…Œë©´ 과부 ì„¤ì›€ì€ ë™ë¬´ 과부가 안다는 것ì´ì§€ìš”." +하고 그는 ìžê¸°ì˜ ë‚´ë ¥ì„ ë§í•˜ê¸° 시작하오. +"ë‚´ ì§‘ì€ ë³¸ëž˜ 서울입니다. ë‚´ê°€ ì–´ë ¸ì„ ì ì— ë‚´ 선친께서 ì‹œêµ­ì— ëŒ€í•´ì„œ 불í‰ì„ 품고 당신 삼 í˜•ì œì˜ ê°€ì¡±ì„ ëŒê³  ìž¬ì‚°ì„ ëª¨ë‘ íŒ”ì•„ 가지고 ê°„ë„ì—를 건너오셨지요. ê°„ë„ì— ë§¨ 먼저 â—â—í•™êµë¥¼ 세운 ì´ê°€ ë‚´ 선친ì´ì§€ìš”." +여기까지 하는 ë§ì„ 듣고 나는 그가 누구ì¸ì§€ë¥¼ 알았소. 그는 R씨ë¼ê³  ê°„ë„ ê°œì²™ìžìš”, ê°„ë„ì— ì¡°ì„ ì¸ ë¬¸í™”ë¥¼ 세운 ì´ë¡œ 유명한 ì´ì˜ ì•„ë“¤ì¸ ê²ƒì´ ë¶„ëª…í•˜ì˜¤. 나는 ê·¸ì˜ ì´ë¦„ì´ ëˆ„êµ¬ì¸ì§€ë„ 물어 ë³¼ 것 ì—†ì´ ì•Œì•˜ì†Œ. +"ì•„ 그러십니까. 네, 그러세요." +하고 나는 ê°íƒ„하였소. +"네, ë‚´ ì„ ì¹œì„ í˜¹ 아실는지요. ì„ ì¹œì˜ ë§ì”€ì´ ë…¸ 그러신단 ë§ì”€ì•¼ìš”. ì¡°ì„  ì‚¬ëžŒì€ ì†ì´ ì¢ì•„ì„œ 못쓴다고 <ì •ê°ë¡>ì—ë„ ê·¸ëŸ° ë§ì´ 있다고 ì¡°ì„ ì€ ì‚°ì´ ë§Žê³  ë“¤ì´ ì¢ì•„ì„œ ì‚¬ëžŒì˜ ë§ˆìŒì´ ìž‘ì•„ì„œ í°ì¼í•˜ê¸°ê°€ 어렵고, í°ì‚¬ëžŒì´ 나기가 어렵다고. 웬만치 í°ì‚¬ëžŒì´ 나면 서로 시기해서 í°ì¼í•  새가 ì—†ì´ í•œë‹¤ê³  그렇게 <ì •ê°ë¡>ì—ë„ ìžˆë‹¤ë”êµ°ìš”. 그래서 선친께서 ìžì†ì—게나 í¬ë§ì„ 붙ì´ê³  ê°„ë„ë¡œ 오신 모양ì´ì§€ìš”. 거기서 ìžë¼ë‚¬ë‹¤ëŠ” ê²ƒì´ ë‚´ 꼴입니다마는, 아하하. +ë‚´ê°€ ìžë¼ì„œ 아버지께서 세우신 K여학êµì˜ êµì‚¬ë¡œ ìžˆì„ ë•Œ ì¼ìž…니다. 지금 ë‚´ 아내는 ê·¸ ë•Œ í•™ìƒìœ¼ë¡œ 있었구. ê·¸ëŸ¬ìž ë‚´ 아버지께서 ìž¬ì‚°ì´ ë‹¤ 없어져서 í•™êµë¥¼ ë…담하실 수가 없고, ë˜ ì–¼ë§ˆ 아니해서 아버지께서 ëŒì•„가시고 보니 í•™êµì—는 세력 ë‹¤íˆ¼ì´ ìƒê²¨ì„œ ì•„ë²„ì§€ì˜ í›„ê³„ìžë¡œ 추정ë˜ëŠ” 나를 배척하게 ë˜ì—ˆë‹¨ ë§ì”€ì´ì˜¤. 거기서 나를 배척하는 ìžë£Œë¥¼ ì‚¼ì€ ê²ƒì´ ë‚˜ì™€ 지금 ë‚´ ì•„ë‚´ê°€ ëœ í•™ìƒì˜ 관계란 것ì¸ë° ì´ê²ƒì€ ì „ì—° ë¬´ê·¼ì§€ì„¤ì¸ ê²ƒì€ ë§í•  ê²ƒë„ ì—†ì†Œ. ë‚˜ë„ ì´ê°ì´ìš”, 그는 처녀니까 혼ì¸ì„ 하ìžë©´ 못 í•  ê²ƒë„ ì—†ì§€ë§ˆëŠ” ê·¸ê²ƒì´ ì‚¬ì œ 관계ë¼ë©´ 중대 문제거든. 그래서 나는 단연히 사ì§ì„ 하고 ë‚´ê°€ 사ì§í•œ ê²ƒì€ ì œ 죄를 승ì¸í•œ 것ì´ë¼ 하여서 ê·¸ í•™ìƒ ì§€ê¸ˆ ë‚´ ì•„ë‚´ë„ ì¶œêµ ì²˜ë¶„ì„ ë‹¹í•œ 것ì´ì˜¤. 그러고 보니, ê·¸ ì—¬ìžì˜ 아버지 ë‚´ 장ì¸ì´ì§€ìš” ê·¸ ì—¬ìžì˜ 아버지는 나를 ì£½ì¼ ë†ˆê°™ì´ ì›ë§ì„ 하고 ê·¸ ë”¸ì„ ì£½ì¼ ë…„ì´ë¼ê³  ê°ê¸ˆì„ 하고 어쨌으나 조그마한 ê°„ë„ ì‚¬íšŒì—ì„œ í° íŒŒë¬¸ì„ ì¼ìœ¼ì¼°ë‹¨ ë§ì´ì˜¤. +ì´ ë¬¸ì œë¥¼ ë” í¬ê²Œ 만든 ê²ƒì€ ì§€ê¸ˆ ë‚´ ì•„ë‚´ì¸, ê·¸ ë”¸ì˜ ìžë°±ì´ì˜¤. 무어ë¼ê³  했는고 하니, 나는 ê·¸ ì‚¬ëžŒì„ ì‚¬ëž‘í•˜ì˜¤, ê·¸ 사람한테가 아니면 ì‹œì§‘ì„ ì•ˆ 가오, 하고 뻗댔단 ë§ìš”. +나는 ì´ ì—¬ìžê°€ ì´ë ‡ê²Œ 나를 ìƒê°í•˜ëŠ”ê°€ í•  ë•Œ ì˜ë¶„ì‹¬ì´ ë‚˜ì„œ 나는 어떻게 해서든지 ì´ ì—¬ìžì™€ 혼ì¸í•˜ë¦¬ë¼ê³  ê²°ì‹¬ì„ í•˜ì˜€ì†Œ. 나는 마침내 ì •ì‹ìœ¼ë¡œ K장로ë¼ëŠ” ë‚´ 장ì¸ì—게 ì²­í˜¼ì„ í•˜ì˜€ìœ¼ë‚˜ ë‹¨ë°•ì— ê±°ì ˆì„ ë‹¹í•˜ê³  ë§ì•˜ì§€ìš”. K장로는 ê·¸ ë”¸ì„ ê°„ë„ì— ë‘는 ê²ƒì´ ì˜³ì§€ 않다고 í•´ì„œ 서울로 보내기로 하였단 ë§ì„ 들었소. 그래서 나는 ìµœí›„ì˜ ê²°ì‹¬ìœ¼ë¡œ ê·¸ ì—¬ìž ì§€ê¸ˆ ë‚´ ì•„ë‚´ ëœ ì‚¬ëžŒì„ ë°ë¦¬ê³  ê°„ë„ì—ì„œ ë„ë§í•˜ì˜€ì†Œ. 하하하하. ë°¤ì¤‘ì— ë‹¨ë‘˜ì´ì„œ. +지금 같으면야 ì‚¬ì œê°„ì— ê²°í˜¼ì„ í•˜ê¸°ë¡œ 그리 í° ë¬¸ì œê°€ ë  ê²ƒì´ ì—†ì§€ë§ˆëŠ” ê·¸ ë•Œì— ì–´ë”” 그랬나요. ì‚¬ì œê°„ì— í˜¼ì¸ì´ëž€ ê²ƒì€ ë¶€ë…€ê°„ì— í˜¼ì¸í•œë‹¤ëŠ” 것과 ê°™ì´ ìƒê°í•˜ì˜€ì§€ìš”. ë”구나 ê·¸ ë•Œ ê°„ë„ ì‚¬íšŒì—는 ì²­êµë„ì  ì‚¬ìƒê³¼ 열렬한 ì• êµ­ì‹¬ì´ ìžˆì–´ì„œ ë„ë• í‘œì¤€ì´ ì—¬ê°„ 높지 아니하였지요. 그런 시대니까 ë‚´ê°€ ë‚´ ì œìžì¸ 여학ìƒì„ ë°ë¦¬ê³  달아난다는 ê²ƒì€ ì‚´ì¸ ê°•ë„를 하는 ì´ìƒìœ¼ë¡œ 무서운 ì¼ì´ì—ˆì§€ìš”. ì§€ê¸ˆë„ ë‚˜ëŠ” 그렇게 ìƒê°í•©ë‹ˆë‹¤ë§ˆëŠ”. +그래서 우리 ë‘ ì‚¬ëžŒì€ ìš°ë¦¬ ë‘ ì‚¬ëžŒì´ë¼ëŠ” ê²ƒë³´ë‹¤ë„ ë‚´ ìƒê°ì—는 어찌하였으나 나를 위해서 ì œ ëª©ìˆ¨ì„ ë²„ë¦¬ë ¤ëŠ” ê·¸ì—게 사실 ë‚˜ë„ ë§ˆìŒ ì†ìœ¼ë¡œëŠ” 그를 사랑하였지요. 다만 사제간ì´ë‹ˆê¹Œ ì˜ì›ížˆ 달할 수는 없는 사랑ì´ë¼ê³  단ë…í•˜ì˜€ì„ ë¿ì´ì§€ìš”. 그러니까 ë¹„ë¡ ë¶€ì²˜ ìƒí™œì€ 못 하ë”ë¼ë„ ë‚´ê°€ ê·¸ì˜ ì‚¬ëž‘ì„ ì•ˆë‹¤ëŠ” 것과 ë‚˜ë„ ê·¸ë¥¼ ì´ë§Œí¼ 사랑한다는 ê²ƒë§Œì„ ë³´ì—¬ 주ìžëŠ” 것ì´ì§€ìš”. +때는 마침 ê°€ì„ì´ì§€ë§ˆëŠ”, ëª¸ì— ì§€ë‹Œ ëˆë„ 얼마 없고 천신만고로 길림까지를 나와 가지고는 배를 타고 ì†¡í™”ê°•ì„ ë‚´ë ¤ì„œ í•˜ì–¼ë¹ˆì— ê°€ 가지고 ê±° 기서 간신히 ì¹˜íƒ€ê¹Œì§€ì˜ ì—¬ë¹„ì™€ ì—¬í–‰ê¶Œì„ ì–»ì–´ 가지고 차를 타고 떠나지 않았어요. ê·¸ê²ƒì´ ë°”ë¡œ ì‹­ì—¬ ë…„ ì „ 오늘ì´ëž€ ë§ì´ì˜¤." +ì´ ë•Œì— ë¶€ì¸ì´ 옥수수로 만든 국수와 ê°ìž ì‚¶ì€ ê²ƒì„ ê°€ì§€ê³  들어오오. +나는 Rì˜ ë§ì„ ë“£ë˜ ëì´ë¼ 유심히 부ì¸ì„ ë°”ë¼ë³´ì•˜ì†Œ. 그는 중키나 ë˜ëŠ” 둥근 ì–¼êµ´ì´ í˜ˆìƒ‰ì´ ì¢‹ê³  통통하여 미ì¸ì´ë¼ê¸°ë³´ë‹¤ëŠ” 씩씩한 ì—¬ìžìš”. 그런 ì¤‘ì— ì¡°ì„  ì—¬ìžë§Œì´ 가지는 아담하고 ì ìž–ì€ ë§›ì´ ìžˆì†Œ. +"앉으시지요. 지금 ë‘ ë¶„ê»˜ì„œ ì²˜ìŒ ì‚¬ëž‘í•˜ì‹œë˜ ë§ì”€ì„ 듣고 있습니다." +하고 나는 부ì¸ì—게 êµì˜ë¥¼ 권하였소. +"ì•„ì´, 그런 ë§ì”€ì€ 왜 하시오." +하고 부ì¸ì€ ê°‘ìžê¸° ì‹­ ë…„ì´ë‚˜ 어려지는 모양으로 수삽한 ë¹›ì„ ë³´ì´ê³  고개를 숙ì´ê³  달아나오. +"그래서요. 그래 ì˜¤ëŠ˜ì´ ê¸°ë…ì¼ì´ì™¸ë‹¤ê·¸ë ¤." +하고 ë‚˜ë„ ì›ƒì—ˆì†Œ. +"그렇지요. 우리는 해마다 ì˜¤ëŠ˜ì´ ì˜¤ë©´ 우리 무ë¤ì— 성묘를 가서 í•˜ë£»ë°¤ì„ ìƒˆìš°ì§€ìš”. ì˜¤ëŠ˜ì€ ì†ë‹˜ì´ 오셔서 ì¤‘ê°„ì— ëŒì•„왔지만, 하하하하." +하고 그는 유쾌하게 웃소. +"성묘ë¼ë‹ˆ?" +하고 나는 물었소. +"아까 ë³´ì‹  ë‘ ë³„ ë¬´ë¤ ë§ì´ì˜¤. ê·¸ê²ƒì´ ìš°ë¦¬ ë‚´ì™¸ì˜ ë¬´ë¤ì´ì§€ìš”. 하하하하." +"…………." +나는 ì˜ë¬¸ì„ 모르고 가만히 앉았소. +"ë‚´ ì´ì•¼ê¸°ë¥¼ 들으시지요. 그래 둘ì´ì„œ 차를 타고 오지 않았겠어요. 물론 여전히 ì„ ìƒë‹˜ê³¼ ì œìžì§€ìš”. 그렇지만 워낙 여러 ë‚  단둘ì´ì„œ ê°™ì´ ê³ ìƒì„ 하고 ì—¬í–‰ì„ í–ˆìœ¼ë‹ˆ ì‚¬ëž‘ì˜ ë¶ˆê¸¸ì´ íƒˆ 것ì´ì•¼ 물론 아니겠어요. 다만 사제ë¼ëŠ” êµ³ì€ ì˜ë¦¬ê°€ ê·¸ê²ƒì„ ê²‰ì— ë‚˜ì˜¤ì§€ 못하ë„ë¡ ëˆ„ë¥¸ 것ì´ì§€ìš”. â€¦â€¦ê·¸ëŸ°ë° ê¼­ ì˜¤ëŠ˜ê°™ì´ ì¢‹ì€ ë‚ ì¸ë° 여기는 대개 ì¼ê¸°ê°€ ì¼ì •í•©ë‹ˆë‹¤. 좀체로 비가 오는 ì¼ë„ 없고 í리는 ë‚ ë„ ì—†ì§€ìš”. í—Œë° Fì—­ì—를 오니까 ì°¸ ì„ì–‘ 경치가 좋단 ë§ì´ì˜¤. ê·¸ ë•Œì— ë¶ˆí˜„ë“¯, ì—ë¼ ì—¬ê¸°ì„œ 내려서 ì´ ì„ì–‘ ì†ì— ì € 호숫 ê°€ì— ë‘˜ì´ì„œ 헤매다가 깨ë—ì´ ì‚¬ì œì˜ ëª¸ìœ¼ë¡œ ì´ ê¹¨ë—í•œ ê´‘ì•¼ì— ë¬»í˜€ ë²„ë¦¬ìž í•˜ëŠ” ìƒê°ì´ 나겠지요. 그래 ê·¸ ë•Œ ë§ì„ ë‚´ ì•„ë‚´ ê·¸ ë•Œì—는 ì•„ì§ ì•„ë‚´ê°€ 아니지요 ë‚´ ì•„ë‚´ì—게 그런 ë§ì„ 하였ë”니 ì°¸ 좋다고 ë°•ìž¥ì„ í•˜ê³  ë‚´ ì–´ê¹¨ì— ë§¤ë‹¬ë¦¬ëŠ”êµ¬ë ¤. 그래서 우리 ë‘˜ì€ ì°¨ê°€ ê±°ì˜ ë– ë‚  ìž„ë°•í•´ì„œ ì°¨ì—ì„œ 뛰어내렸지요." +하고 그는 그때 ê´‘ê²½ì„ ëˆˆì•žì— ê·¸ë¦¬ëŠ” 모양으로 ë§ì„ ëŠê³  ìš°ë‘커니 í—ˆê³µì„ ë°”ë¼ë³´ì˜¤. 그러나 ê·¸ì˜ ìž… 언저리ì—는 유쾌한 회고ì—ì„œ 나오는 웃ìŒì´ì—ˆì†Œ. +"ì´ì•¼ê¸° 다 ë났어요?" +하고 부ì¸ì´ í¬ë°”스ë¼ëŠ” 청량 ìŒë£Œë¥¼ 들고 들어오오. +"아니오. ì´ì œë¶€í„°ê°€ 정통ì´ë‹ˆ ë‹¹ì‹ ë„ ê±°ê¸° 앉으시오. 지금 ì°¨ì—ì„œ 내린 ë°ê¹Œì§€ ì™”ëŠ”ë° ë‹¹ì‹ ë„ ì•‰ì•„ì„œ í•œ 파트를 맡으시오." +하고 R는 부ì¸ì˜ ì†ì„ ìž¡ì•„ì„œ ìžë¦¬ì— 앉히오. 부ì¸ë„ 웃으면서 앉소. +"최 ì„ ìƒ ì²˜ì§€ê°€ ê¼­ 나와 같단 ë§ìš”. ì •ìž„ì˜ ì²˜ì§€ê°€ 당신과 같고." +하고 그는 ë§ì„ 계ì†í•˜ì˜¤. +"그래 ì°¨ì—ì„œ 내려서 나는 ì´ ì–‘ë°˜í•˜ê³  ë¬¼ì„ ì°¾ì•„ 헤매었지요. ì•„ë”°, ì„ì–‘ì´ ì–´ë–»ê²Œ 좋ì€ì§€ ì´ ì–‘ë°˜ì€ ë°•ìž¥ì„ í•˜ê³  노래를 부르고 우리 ë‘˜ì€ ë§ˆì¹˜ 유쾌하게 산보하는 사람 같았지요." +"ì°¸ 좋았어요. ê·¸ ë•Œì—는 ì°¸ 좋았어요. ê·¸ ì„ì–‘ì— ë¹„ì¹œ 광야와 호수ë¼ëŠ” ê±´ 어떻게 좋ì€ì§€ ê·¸ ìˆ˜ì€ ê°™ì€ ë¬¼ ì†ì— 텀벙 뛰어들고 싶었어요. ê·¸ 후엔 해마다 ë³´ì•„ë„ ê·¸ë§Œ 못해." +하고 부ì¸ì´ ì°¸ê²¬ì„ í•˜ì˜¤. +ì•„ì´ë“¤ì€ 다 ìžëŠ” 모양ì´ì˜¤. +"그래 ì§€í–¥ì—†ì´ í—¤ë§¤ëŠ”ë° í•´ëŠ” 뉘엿뉘엿 넘어가구, ì–´ìŠ¤ë¦„ì€ ê¸°ì–´ë“¤ê³  ê·¸ ë•Œ 마침 하늘ì—는 별 ë‘˜ì´ ë‚˜íƒ€ë‚¬ë‹¨ ë§ì´ì•¼. ê·¸ê²ƒì„ ì´ ì—¬í•™ìƒì´ 먼저 ë³´ê³ ì„œ ê°‘ìžê¸° 추연해지면서 ì„ ìƒë‹˜ ì € 별 보셔요, ì•žì„  í° ë³„ì€ ì„ ìƒë‹˜ì´ 구 ë”°ë¼ê°€ëŠ” ìž‘ì€ ë³„ì€ ì €ì•¼ìš”, 하겠지요. ê·¸ ë§ì´, ë˜ ê·¸ 태ë„ê°€ 어떻게 가련한지. 그래서 나는 í•˜ëŠ˜ì„ ë°”ë¼ë³´ë‹ˆê¹ 과연 별 ë‘ ê°œê°€ 지는 해를 따르는 ë“¯ì´ ë”°ë¼ê°„다 ë§ìš”. ë§ì„ 듣고 보니 과연 우리 ì‹ ì„¸ì™€ë„ ê°™ì§€ ì•Šì•„ìš”? +그리고는 ì´ ì‚¬ëžŒì´ ë˜ ì´ëŸ½ë‹ˆë‹¤ê·¸ë ¤ `ì„ ìƒë‹˜, ì•žì„  í° ë³„ì€ ì•„ë¬´ë¦¬ ë”°ë¼ë„ ì € ìž‘ì€ ë³„ì€ ì˜ì›ížˆ ë”°ë¼ìž¡ì§€ 못하겠지요. ì˜ì›ížˆ ì˜ì›ížˆ ë”°ë¼ê°€ë‹¤ê°€ ë”°ë¼ê°€ë‹¤ê°€ 못 í•´ì„œ 마침내는 ì € ìž‘ì€ ë³„ì€ ì£½ì–´ì„œ ê²€ì€ ìž¬ê°€ ë˜ê³  ë§ê² ì§€ìš”? ì € ìž‘ì€ ë³„ì´ ì œ 신세와 어쩌면 그리 ê°™ì„까.' 하고 í•œíƒ„ì„ í•˜ê² ì§€ìš”. ê·¸ ë•Œì— í•œíƒ„ì„ í•˜ê³  ëˆˆë¬¼ì„ í˜ë¦¬ê³  섰는 어린 ì²˜ë…€ì˜ ì„ì–‘ë¹›ì— ë¹„ì·¬ ëª¨ì–‘ì„ ìƒìƒí•´ 보세요, 하하하하. ê·¸ ë•Œì—는 ë‹¹ì‹ ë„ ë¯¸ì¸ì´ì—ˆì†Œ. 하하하하." +하고 내외가 유쾌하게 웃는 ê²ƒì„ ë³´ë‹ˆ 나는 ë”ìš± ì ë§‰í•˜ì—¬ì§ì„ 깨달았소. 어쩌면 ê·¸ ì„ì–‘, ê·¸ ë‘ ë³„ì´ ì´ë“¤ì—게와 내게 ê¼­ ê°™ì€ ì¸ìƒì„ 주었ì„까 하니 참으로 ì´ìƒí•˜ë‹¤ 하였소. +"그래 ì¸ì œ." +하고 R는 다시 ì´ì•¼ê¸°ë¥¼ 계ì†í•˜ì˜¤. +"그래 ì¸ì œ 둘ì´ì„œ 그야ë§ë¡œ ê°ê°œë¬´ëŸ‰í•˜ê²Œ ë‘ ë³„ì„ ë°”ë¼ë³´ë©° 걸었지요. 그러다가 í•´ê°€ 넘어가고 ì•žì„  í° ë³„ì´ ë„˜ì–´ê°€ê³  그리고는 혼ìžì„œ 깜빡깜빡하고 ê°€ë˜ ìž‘ì€ ë³„ì´ ë„˜ì–´ê°€ë‹ˆ 우리는 그만 ë•…ì— ì£¼ì €ì•‰ì•˜ì†Œ. 거기가 어딘고 하니 ê·¸ ë‘ ë³„ 무ë¤ì´ 있는 ê³³ì´ì§€ìš”. `ì„ ìƒë‹˜ 저를 여기다가 파묻어 주시고 가셔요. ì„ ìƒë‹˜ ì†ìˆ˜ 저를 여기다가 묻어 놓고 ê°€ 주셔요.' 하고 ì´ ì‚¬ëžŒì´ ì¡°ë¥´ì§€ìš”." +하는 ê²ƒì„ ë¶€ì¸ì€, +"ë‚´ê°€ 언제." +하고 ë‚¨íŽ¸ì„ í˜ê²¨ë³´ì˜¤. +"그럼 무ì—ë¼ê³  했소? ì–´ë”” 본ì¸ì´ í•œ 번 옮겨 보오." +하고 Rê°€ ë§ì„ ëŠì†Œ. +"ê°„ë„를 ë– ë‚œ 지가 í•œ ë‹¬ì´ ë˜ë„ë¡ ë‹¨ë‘˜ì´ ë‹¤ë…€ë„ ìš”ë§Œí¼ë„ 귀해 주는 ì ì´ 안 뵈니 그럼 파묻어 달ë¼ê³  안 í•´ìš”?" +하고 부ì¸ì€ 웃소. +"í¥í¥." +하고 R는 부ì¸ì˜ ë§ì— 웃고 나서, +"ê·¸ ìžë¦¬ì— 묻어 달란 ë§ì„ 들으니까, 어떻게 측ì€í•œì§€, 그럼 ë‚˜ë„ í•¨ê»˜ 묻히ìžê³  그랬지요. 나는 ê·¸ ë•Œì— ì°¸ë§ ê·¸ ìžë¦¬ì— 함께 묻히고 싶었어요. 그래서 나는 ì†ìœ¼ë¡œ 곧 구ë©ì´ë¥¼ 팠지요. 떡가루 ê°™ì€ ëª¨ëž˜íŒì´ë‹ˆê¹Œ 파기는 íž˜ì´ ì•„ë‹ˆ 들겠지요. ì´ì´ë„ 물ë„러미 ë‚´ê°€ ë•…ì„ íŒŒëŠ” ê²ƒì„ ë³´ê³  ì„°ë”니만 ìžê¸°ë„ 파기를 시작하겠지요." +하고 내외가 다 웃소. +"그래 순ì‹ê°„ì—……." +하고 R는 ì´ì•¼ê¸°ë¥¼ 계ì†í•˜ì˜¤. +"순ì‹ê°„ì— ë‘˜ì´ ë“œëŸ¬ëˆ„ìš¸ 만한 구ë©ì´ë¥¼ 아마 ë‘ ìž ê¹Šì´ë‚˜ ë˜ê²Œ, 네모나게 파 놓고는 ë‚´ê°€ 들어가 누워 ë³´ê³  그러고는 ë˜ íŒŒê³  하여 아주 편안한 구ë©ì´ë¥¼ 파고 나서는 나는 아주 세ìƒì„ 하ì§í•  셈으로 ì‚¬ë°©ì„ ë‘˜ëŸ¬ë³´ ê³  사방ì´ëž˜ì•¼ ì»´ì»´í•œ ì–´ë‘ ë°–ì— ì—†ì§€ë§Œ ì‚¬ë°©ì„ ë‘˜ëŸ¬ë³´ê³ , ì´ë¥¼í…Œë©´ 세ìƒê³¼ ìž‘ë³„ì„ í•˜ê³  드러누웠지요. 지금 ì´ë ‡ê²Œ íšŒê³ ë‹´ì„ í•  ë•Œì—는 ìš°ìŠµê¸°ë„ í•˜ì§€ë§ˆëŠ” ê·¸ ë•Œì—는 참으로 종êµì ì´ë¼ í•  만한 엄숙ì´ì—ˆì†Œ. 그때 우리 ë‘˜ì˜ ì²˜ì§€ëŠ” ì•žë„ ì ˆë²½, ë’¤ë„ ì ˆë²½ì´ì–´ì„œ 죽는 ê¸¸ë°–ì— ì—†ì—ˆì§€ìš”. ë˜ ê·¸ë¿ ì•„ë‹ˆë¼ ì¸ìƒì˜ 가장 깨ë—하고 가장 ì‚¬ëž‘ì˜ ë§‘ì€ ì •ì´ íƒ€ê³  가장 기ì˜ê³ ë„ ìŠ¬í”„ê³ ë„ ì´ë¥¼í…Œë©´ 모든 ê°ì •ì´ ì ˆì •ì— ë‹¬í•˜ê³ , 그러한 ìˆœê°„ì— ëª©ìˆ¨ì„ ëŠì–´ 버리는 ê²ƒì´ ê°€ìž¥ ì¢‹ì€ ì¼ì´ìš”, 가장 마땅한 ì¼ê°™ì´ ìƒê°í•˜ì˜€ì§€ìš”. ê´‘ì•¼ì— ì•„ë¦„ë‹¤ìš´ í™©í˜¼ì´ ìˆœê°„ì— ìŠ¤ëŸ¬ì§€ëŠ” 모양으로 우리 ë‘ ìƒëª…ì˜ ì•„ë¦„ë‹¤ì›€ë„ ìˆœê°„ì— ìŠ¤ëŸ¬ì§€ìžëŠ” 우리는 ì² í•™ìžë„ ì‹œì¸ë„ 아니지마는 ìš°ë¦¬ë“¤ì˜ í™˜ê²½ì´ ìš°ë¦¬ 둘ì—게 그러한 ìƒê°ì„ 넣어 준 것ì´ì§€ìš”. +그래서 ë‚´ê°€ 가만히 드러누워 있는 ê²ƒì„ ì €ì´ê°€ 물ë„러미 ë³´ê³  있ë”니 ìžê¸°ë„ ë‚´ ê³ì— 들어와 눕겠지요. 그런 ë’¤ì—는 í™©í˜¼ì— ë‚¨ì€ ë¹›ë„ ë‹¤ 스러지고 아주 캄캄한 ì•”í‘ ì„¸ê³„ê°€ ë˜ì–´ 버렸지요. í•˜ëŠ˜ì— ì–´ë–»ê²Œ 그렇게 ë³„ì´ ë§Žì€ì§€. 가만히 í•˜ëŠ˜ì„ ë°”ë¼ë³´ë…¸ë¼ë©´ ì°¸ ë³„ì´ ë§Žì•„ìš”. 우주란 ì°¸ 커요. ê·¸ëŸ°ë° ì´ ëì—†ì´ í° ìš°ì£¼ì— í•œì—†ì´ ë§Žì€ ë³„ë“¤ì´ ë‹¤ ì œìžë¦¬ë¥¼ 지키고 ì œ ê¸¸ì„ ì§€ì¼œì„œ 서로 ë¶€ë”ªì§€ë„ ì•„ë‹ˆí•˜ê³  ëì—†ì´ ê¸´ ì‹œê°„ì— ì§ˆì„œë¥¼ 유지하고 있는 ê²ƒì„ ë³´ë©´ 우주ì—는 ì–´ë–¤ 주재하는 뜻, 섭리하는 ëœ»ì´ ìžˆë‹¤ 하는 ìƒê°ì´ 나겠지요. ë‚˜ë„ ì˜ˆìˆ˜êµì¸ì˜ 가정ì—ì„œ ìžë¼ë‚¬ì§€ë§ˆëŠ” ì´ ë•Œì²˜ëŸ¼ 하나님ì´ë¼ 할까 ì´ë¦„ì€ ë¬´ì—‡ì´ë¼ê³  하든지 ê°„ì— ìš°ì£¼ì˜ ì„­ë¦¬ìžì˜ 존재를 강렬하게 ì˜ì‹í•œ ì¼ì€ 없었지요. +그렇지만 `ì‚¬ëžŒì˜ ë§ˆìŒì— 비기면 저까짓 ë³„ë“¤ì´ ë‹¤ 무엇ì´ì˜¤?' 하고 그때 겨우 ì—´ì—¬ëŸ ì‚´ë°–ì— ì•ˆ ëœ ì´ì´ê°€ ë‚´ ê·€ì— ìž…ì„ ëŒ€ê³  ë§í•  ë•Œì—는 ë‚˜ë„ ì°¸ìœ¼ë¡œ 놀ëžìŠµë‹ˆë‹¤. 나ì´ëŠ” 나보다 오륙 ë…„ ìƒê´€ë°–ì— ì•ˆ ë˜ì§€ë§ˆëŠ” ì´ì‹­ 세 ë‚´ì™¸ì— ì˜¤ë¥™ ë…„ ìƒê´€ì´ ì ì€ 것ì¸ê°€ìš”? 게다가 나는 ì„ ìƒì´ìš” ìžê¸°ëŠ” í•™ìƒì´ë‹ˆê¹Œ 어린애로만 ì•Œì•˜ë˜ ê²ƒì´ ê·¸ëŸ° ë§ì„ 하니 놀ëžì§€ ì•Šì•„ìš”? 어째서 ì‚¬ëžŒì˜ ë§ˆìŒì´ í•˜ëŠ˜ë³´ë‹¤ë„ ë” ì´ìƒí• ê¹Œ 하고 ë‚´ê°€ 물으니까, ê·¸ ëŒ€ë‹µì´ `나는 무엇ì´ë¼ê³  설명할 수가 없지마는 ë‚´ ë§ˆìŒ ì†ì— ì¼ì–´ë‚˜ëŠ” ê²ƒì´ í•˜ëŠ˜ì´ë‚˜ ë•…ì— ì¼ì–´ë‚˜ëŠ” 모든 ê²ƒë³´ë‹¤ë„ ë” ì•„ë¦„ë‹µê³  ë” ì•Œ 수 없고 ë” ëœ¨ê²ê³  그런 것 같아요.' 그러겠지요. ìƒëª…ì´ëž€ 모든 아름다운 것 ì¤‘ì— ê°€ìž¥ 아름다운 것ì´ë¼ëŠ” ê²ƒì„ ë‚˜ëŠ” 깨달았어요. ê·¸ ë§ì—, `그렇다 하면 ì´ ì•„ë¦„ë‹µê³  신비한 ìƒëª…ì„ ë‚´ëŠ” 우주는 ë” ì•„ë¦„ë‹¤ìš´ ê²ƒì´ ì•„ë‹ˆì˜¤?' 하고 ë‚´ê°€ 반문하니까, 당신(부ì¸ì„ 향하여) ë§ì´, `ì „ 모르겠어요, 어쨌으나 ì „ 행복합니다. 저는 ì´ í–‰ë³µì„ ê¹¨ëœ¨ë¦¬ê³  싶지 않습니다. ë†“ì³ ë²„ë¦¬ê³  싶지 않습니다. ì´ í–‰ë³µ ì„ ìƒë‹˜ ê³ì— 있는 ì´ í–‰ë³µì„ ê½‰ 안고 죽고 싶어요.' 그러지 않았소?" +"누가 그랬어요? ì•„ì´ ë‚œ 다 잊어버렸어요." +하고 부ì¸ì€ 차를 따르오. R는 ì¸ì œëŠ” 하하하 하는 웃ìŒì¡°ì°¨ 잊어버리고, 부ì¸ì—게 ë†ë‹´ì„ 붙ì´ëŠ” 것조차 잊어버리고, 그야ë§ë¡œ 종êµì  엄숙 그대로ë§ì„ ì´ì–´, +"`ìž ì €ëŠ” ì•½ì„ ë¨¹ì–´ìš”.' 하고 ì†ì„ 입으로 가져가는 ë™ìž‘ì´ ê°í–‰ë˜ê² ì§€ìš”. 약ì´ëž€ ê²ƒì€ í•˜ì–¼ë¹ˆì—ì„œ 준비한 아편ì´ì§€ìš”. 하얼빈서 치타까지 가는 ë™ì•ˆì— í¥ì•ˆë ¹ì´ë‚˜ ì–´ëŠ ì‚¼ë¦¼ì§€ëŒ€ë‚˜ 어디서나 ì£½ì„ ìžë¦¬ë¥¼ ì°¾ìžê³  준비한 것ì´ë‹ˆê¹Œ. 나는 ìž… 근처로 가는 ê·¸ì˜ ì†ì„ 붙들었어요. 붙들면서 나는 `ìž ê¹ë§Œ 기다리오. 오늘 ë°¤ 안으로 ê·¸ ì•½ì„ ë¨¹ìœ¼ë©´ ê³ ë§Œì´ ì•„ë‹ˆì˜¤? ì´ í–‰ë³µëœ ìˆœê°„ì„ ìž ê¹ì´ë¼ë„ 늘립시다. 달 올ë¼ì˜¬ 때까지만.' 나는 ì´ë ‡ê²Œ ë§í–ˆì§€ìš”. `ì„ ìƒë‹˜ë„ 행복ë˜ì…”ìš”? ì„ ìƒë‹˜ì€ 불행ì´ì‹œì§€. ì € ë•Œë¬¸ì— ë¶ˆí–‰ì´ì‹œì§€. 저만 ì´ê³³ì— 묻어 주시구는 ì„ ìƒë‹˜ì€ 세ìƒì— ëŒì•„ê°€ 사셔요, 오래오래 사셔요, ì¼ ë§Žì´ í•˜ê³  사셔요.' 하고 울지 ì•Šê² ì–´ìš”. 나는 ê·¸ ë•Œì— ë‚´ ì•„ë‚´ê°€ í•˜ë˜ ë§ì„ í•œ ë§ˆë””ë„ ìžŠì§€ 아니합니다. ê·¸ ë§ì„ ë“£ë˜ ë•Œì˜ ë‚´ ì¸ìƒì€ 아마 ì¼ìƒ ë‘ê³  잊히지 아니하겠지요. +나는 ìžë°±í•©ë‹ˆë‹¤. ê·¸ ìˆœê°„ì— ë‚˜ëŠ” 처ìŒìœ¼ë¡œ ë‚´ 아내를 안고 키스를 하였지요. ë‚´ ì†ì— 눌리고 눌리고 쌓ì´ê³  í•˜ì˜€ë˜ ì—´ì •ì´ ê·¸ë§Œ ì¼ì‹œì— í­ë°œë˜ì—ˆë˜ 것ì´ì˜¤. ì•„ì•„ ì´ê²ƒì´ ìµœì´ˆì˜ ê²ƒì´ìš”, ë™ì‹œì— ìµœí›„ì˜ ê²ƒì´ë¡œêµ¬ë‚˜ í•  ë•Œì— ë‚´ 눈ì—서는 ë“는 듯한 ëˆˆë¬¼ì´ í˜ë €ì†Œì´ë‹¤. ë‘ ì‚¬ëžŒì˜ ì‹¬ìž¥ì´ ë›°ëŠ” 소리, ë‘ ì‚¬ëžŒì˜ í’€ë¬´ 불길 ê°™ì€ ìˆ¨ì†Œë¦¬. +ì´ìœ½ê³  ë‹¬ì´ ë– ì˜¬ë¼ ì™”ìŠµë‹ˆë‹¤. ê°€ì´ì—†ëŠ” 벌íŒì´ë‹ˆê¹Œ ë‹¬ì´ ëœ¨ë‹ˆê¹Œ ê°‘ìžê¸° 천지가 환해지고 우리 ë‘˜ì´ ì†ìœ¼ë¡œ 파서 쌓아 ë†“ì€ í™ë¬´ë”기가 ì´ ì‚° 없는 세ìƒì— ì‚°ì´ë‚˜ ë˜ëŠ” ê²ƒê°™ì´ ì¡°ê·¸ë§ˆí•œ ê²€ì€ ê·¸ë¦¼ìžë¥¼ 지고 있겠지요. `ìž ìš°ë¦¬ ë‹¬ë¹›ì„ ë ê³  좀 ëŒì•„다ë‹ê¹Œ.' 하고 나는 아내를 안아 ì¼ìœ¼ì¼°ì§€ìš”. ë‚´ íŒ”ì— ì•ˆê²¨ì„œ 고개를 뒤로 젖힌 ë‚´ ì•„ë‚´ì˜ ì–¼êµ´ì´ ë‹¬ë¹›ì— ë¹„ì¹œ ì–‘ì„ ë‚˜ëŠ” 잘 기억합니다. 실신한 듯한, 만족한 듯한, ê·¸ë¦¬ê³ ë„ ì ˆë§í•œ 듯한 ê·¸ í‘œì •ì„ ë¬´ì—‡ìœ¼ë¡œ 그릴지 모릅니다. ê·¸ë¦¼ë„ ê·¸ë¦´ 줄 모르고 ì¡°ê°ë„ í•  줄 모르고 ê¸€ë„ ì“¸ 줄 모르는 ë‚´ê°€ ê·¸ê²ƒì„ ì–´ë–»ê²Œ 그립니까. 그저 가슴 ì†ì— 품고 ì´ë ‡ê²Œ ì˜¤ëŠ˜ì˜ ë‚´ 아내를 ë°”ë¼ë³¼ ë¿ì´ì§€ìš”. +나는 ë‚´ 아내를 íŒ”ì— ê±¸ê³  네, 걸었다고 하는 ê²ƒì´ ê°€ìž¥ 합당하지 ìš” ì´ë ‡ê²Œ 팔ì—다 걸고 ë‹¬ë¹›ì„ ë°›ì€ í™©ëŸ‰í•œ 벌íŒ, 아무리 í•˜ì—¬ë„ í™˜í•˜ê²Œ ë°ì•„지지는 아니하는 벌íŒì„ 헤매었습니다. ì´ë”°ê¸ˆ ë‚´ ì•„ë‚´ê°€, `ì–´ì„œ 죽고 싶어요, ì „ 죽고만 싶어요.' 하는 ë§ì—는 ëŒ€ë‹µë„ ì•„ë‹ˆ 하고. 죽고 싶다는 ê·¸ ë§ì€ 물론 ì§„ì •ì¼ ê²ƒì´ì§€ìš”. 아무리 ë§‘ì€ ì¼ê¸°ë¼ 하ë”ë¼ë„ 오후가 ë˜ë©´ í려지는 법ì´ë‹ˆê¹Œ 오래 살아가는 ë™ì•ˆì— 늘 í•œ 모양으로 ì´ ìˆœê°„ê°™ì´ ê¹¨ë—하고 뜨거운 기분으로 ê°ˆ 수는 없지 ì•Šì•„ìš”? 불쾌한 ì¼ë„ ìƒê¸°ê³ , 보기 í‰í•œ ì¼ë„ ìƒê¸¸ëŠ”지 모르거든. 그러니까 ì´ ì™„ì „í•œ 깨ë—ê³¼ 완전한 사랑과 완전한 행복 ì†ì— 죽어 버리ìžëŠ” ëœ»ì„ ë‚˜ëŠ” 잘 알지요. ë”구나 ìš°ë¦¬ë“¤ì´ ì‚´ì•„ 남는대야 ì•žê¸¸ì´ ê¸°êµ¬í•˜ì§€ í‰íƒ„í•  리는 없지 아니해요? 그래서 나는 `죽지, 우리 ì´ ë‹¬ë°¤ì— ì‹¤ì»· ëŒì•„다니다가, ë” ëŒì•„다니기가 ì‹«ê±°ë“  ê·¸ 구ë©ì— ëŒì•„가서 ì•½ì„ ë¨¹ì시다.' ì´ë ‡ê²Œ ë§í•˜ê³  우리 ë‘˜ì€ í—¤ë§¸ì§€ìš”. ë‚®ì— ë³´ë©´ 어디까지나 í‰í‰í•œ 벌íŒì¸ 것만 같지마는 ë‹¬ë°¤ì— ë³´ë©´ ì´ ì‚¬ë§‰ì—ë„ ì•„ì§ ì±„ 스러지지 아니한 ì‚°ì˜ í˜•ì ì´ 남아 있어서 êµ°ë°êµ°ë° 거뭇거뭇한 그림ìžê°€ 있겠지요. ê·¸ ê·¸ë¦¼ìž ì†ì—는 걸어 들어가면 ì–´ë–¤ ë°ëŠ” 우리 í—ˆë¦¬ë§Œí¼ ê·¸ë¦¼ìžì— 가리우고 ì–´ë–¤ ë°ëŠ” 우리 ë‘˜ì„ ë‹¤ 가리워 버리는 ë°ë„ 있단 ë§ì•¼ìš”. 죽ìŒì˜ 그림ìžë¼ëŠ” ìƒê°ì´ 나면 ê·¸ëž˜ë„ ëª¸ì— ì†Œë¦„ì´ ë¼ì³ìš”. +차차 ë‹¬ì´ ë†’ì•„ì§€ê³  추위가 심해져서 ë°”ëžŒê²°ì´ ì§€ë‚˜ê°ˆ ë•Œì—는 눈ì—ì„œ ëˆˆë¬¼ì´ ë‚  지경ì´ì§€ìš”. ì›ì²´ 대기 ì¤‘ì— ìˆ˜ë¶„ì´ ì ìœ¼ë‹ˆê¹Œ ì„œë¦¬ë„ ë§Žì§€ 않지마는, ê·¸ëž˜ë„ ëŒ€ê¸° ì¤‘ì— ìžˆëŠ” ìˆ˜ë¶„ì€ ë‹¤ 얼어 버려서 ì–¼ìŒê°€ë£¨ê°€ ë˜ì—ˆëŠ” 게지요. 공중ì—는 ë°˜ì§ë°˜ì§í•˜ëŠ” 수정가루 ê°™ì€ ê²ƒì´ ë³´ìž…ë‹ˆë‹¤. ë‚®ì—는 ë•€ì´ íë¥´ë¦¬ë§Œí¼ ë¥ë˜ ì‚¬ë§‰ë„ ë°¤ì´ ë˜ë©´ ì´ë ‡ê²Œ ê¸°ì˜¨ì´ ë‚´ë ¤ê°€ì§€ìš”. 춥다고 ìƒê°ì€ í•˜ë©´ì„œë„ ì¶¥ë‹¤ëŠ” ë§ì€ 아니 하고 우리는 ì–´ë–¤ ë•Œì—는 ë‹¬ì„ ë”°ë¼ì„œ, ì–´ë–¤ ë•Œì—는 ë‹¬ì„ ë“±ì§€ê³ , ì–´ë–¤ ë•Œì—는 í˜¸ìˆ˜ì— ë¹„ì¹œ ë‹¬ì„ êµ½ì–´ë³´ê³ , ì´ ëª¨ì–‘ìœ¼ë¡œ í•œì—†ì´ ë§ë„ ì—†ì´ ëŒì•„다녔지요. ì´ ì„¸ìƒ ìƒëª…ì˜ ë§ˆì§€ë§‰ ìˆœê°„ì„ íž˜ê» ì˜ì‹í•˜ë ¤ëŠ” 듯ì´. +마침내 `나는 ë” ëª» 걸어요.' 하고 ì´ì´ê°€ ë‚´ ì–´ê¹¨ì— ë§¤ë‹¬ë ¤ 버리고 ë§ì•˜ì§€ìš”." +하고 Rê°€ 부ì¸ì„ ëŒì•„보니 부ì¸ì€ íŽ¸ë¬¼í•˜ë˜ ì†ì„ 쉬고, +"다리가 아픈 ì¤„ì€ ëª¨ë¥´ê² ëŠ”ë° ë‹¤ë¦¬ê°€ ì´ë¦¬ 뉘구 저리 뉘구 í•´ì„œ 걸ìŒì„ ê±¸ì„ ìˆ˜ê°€ 없었어요. 춥기는 하구." +하고 소리를 ë‚´ì–´ì„œ 웃소. +"그럴 ë§Œë„ í•˜ì§€." +하고 R는 긴장한 í‘œì •ì„ ì•½ê°„ 풀고 ì•‰ì€ ìžì„¸ë¥¼ ìž ê¹ ê³ ì¹˜ë©°, +"ê·¸ í›„ì— ê·¸ ë‚  ë°¤ ëŒì•„다닌 ê³³ì„ ë”듬어 보니까, ìžì„¸ížˆëŠ” ì•Œ 수 없지마는 삼십 리는 ë” ë˜ëŠ” 것 같거든. 다리가 아프지 아니할 리가 있나." +하고 차를 í•œ 모금 마시고 나서 ë§ì„ 계ì†í•˜ì˜¤. +"그래서 나는 ë‚´ 외투를 ë²—ì–´ì„œ, ì´ì´(부ì¸)를 싸서 어린애 ì•ˆë“¯ì´ ì•ˆê³  걸었지요. 외투로 쌌으니 ìžê¸°ë„ 춥지 않구, 나는 ë˜ ë¬´ê±°ìš´ ì§ì„ 안았으니 ë•€ì´ ë‚  지경ì´êµ¬, ê·¸ë¿ ì•„ë‹ˆë¼ ë‚´ê°€ 제게 주는 ìµœí›„ì˜ ì„œë¹„ìŠ¤ë¼ í•˜ë‹ˆ 기ì˜ê³ , ë§í•˜ìžë©´ ì¼ê±° 삼ë“ì´ì§€ìš”. 하하하하. 지난 ì¼ì´ë‹ˆ 웃지마는 ê·¸ ë•Œ ì‚¬ì •ì„ ìƒê°í•´ 보세요, 어떠했겠나." +하고 R는 약간 처참한 ë¹›ì„ ë ë©´ì„œ, +"그러니 ê·¸ 구ë©ì´ë¥¼ ì–´ë”” ì°¾ì„ ìˆ˜ê°€ 있나. 얼마를 찾아 ëŒì•„다니다가 아무 ë°ì„œë‚˜ ì£½ì„ ìƒê°ë„ í•´ 보았지마는 몸뚱ì´ë¥¼ 그냥 벌íŒì— 내놓고 죽고 싶지는 아니하고 ë˜ ê·¸ 구ë©ì´ê°€ 우리 ë‘ ì‚¬ëžŒì—게 특별한 ì˜ë¯¸ê°€ 있는 것 같아서 기어코 ê·¸ê²ƒì„ ì°¾ì•„ 내고야 ë§ì•˜ì§€ìš”. ê·¸ 때는 ë²Œì¨ ìƒˆë²½ì´ ê°€ê¹Œì› ë˜ ëª¨ì–‘ì´ì˜¤. ì—´ 시나 넘어서 뜬 í•˜í˜„ë‹¬ì´ ë‚®ì´ ê¸°ìš¸ì—ˆìœ¼ë‹ˆ 그렇지 ì•Šê² ì–´ìš”. ê·¸ 구ë©ì´ì— 와서 우리는 í•œ 번 ë” í•˜ëŠ˜ê³¼ 달과 별과, 그리고 ë§ˆìŒ ì†ì— 떠오른 사람들과 하ì§í•˜ê³  약 ë¨¹ì„ ì¤€ë¹„ë¥¼ 했지요. +ì•½ì„ ê²€ì€ ê³ ì•½ê³¼ ê°™ì€ ì•„íŽ¸ì„ ë§›ì´ ì“°ë‹¤ëŠ” ì•„íŽ¸ì„ ë¬¼ë„ ì—†ì´ ë¨¹ìœ¼ë ¤ 들었지요. +우리 ë‘˜ì€ ì•„ê¹Œ 모양으로 가지런히 누워서 í•˜ëŠ˜ì„ ë°”ë¼ë³´ì•˜ëŠ”ë° ë‹¬ì´ ë°ìœ¼ë‹ˆê¹Œ ë³´ì´ë˜ 별들 ì¤‘ì— ìˆ¨ì€ ë³„ì´ ë§Žê³  ë˜ ë³„ë“¤ì˜ ìœ„ì¹˜ 우리ì—게 낯ìµì€ ë¶ë‘칠성 ìžë¦¬ë„ ë³€í–ˆì„ ê²ƒ 아니야요. ì´ìƒí•œ ìƒê°ì´ 나요. 우리가 벌íŒìœ¼ë¡œ 헤매는 ë™ì•ˆì— 천지가 ëª¨ë‘ ë³€í•œ 것 같아요. 사실 변하였지요. ê·¸ 변한 ê²ƒì´ ìš°ìŠ¤ì›Œì„œ 나는 껄껄 웃었지요. 워낙 ë‚´ê°€ 웃ìŒì´ 좀 헤프지만 ì´ ë•Œì²˜ëŸ¼ 헤프게 실컷 웃어 본 ì¼ì€ 없습니다. +왜 웃ëŠëƒê³  ì•„ë‚´ê°€ 좀 ì„±ì„ ë‚¸ ë“¯ì´ ë¬»ê¸°ë¡œ, `천지와 ì¸ìƒì´ 변하는 ê²ƒì´ ìš°ìŠ¤ì›Œì„œ 웃었소.' 그랬지요. 그랬ë”니, `천지와 ì¸ìƒì€ 변할는지 몰ë¼ë„ ë‚´ 마ìŒì€ 안 변해요!' 하고 소리를 지르겠지요. í½ ë¶„ê°œí–ˆë˜ ëª¨ì–‘ì´ì•¼." +하고 R는 ê·¸ 아내를 보오. +"그럼 분개 안 í•´ìš”? ë‚¨ì€ ì£½ì„ ê²°ì‹¬ì„ í•˜ê³  발발 떨구 ìžˆëŠ”ë° ê³ì—ì„œ 껄껄거리고 웃으니, 어째 분하지가 ì•Šì•„ìš”. 나는 분해서 달아나려고 했어요." +하고 부ì¸ì€ ì•„ì§ë„ ë¶„í•¨ì´ ë‚¨ì€ ê²ƒê°™ì´ ë§í•˜ì˜¤. +"그래 달아나지 않았소?" +하고 R는 부ì¸ì´ 벌떡 ì¼ì–´ë‚˜ì„œ 비틀거리고 달아나는 í‰ë‚´ë¥¼ 팔과 다리로 ë‚´ê³  나서, +"ì´ëž˜ì„œ 죽는 ì‹œê°„ì´ ì§€ì²´ê°€ ë˜ì—ˆì§€ìš”. 그래서 ë‚´ê°€ 빌고 달래고 í•´ì„œ 가까스로 ì•ˆì •ì„ ì‹œí‚¤ê³  나니 ì†ì— ì¥ì—ˆë˜ ì•„íŽ¸ì´ ë•€ì— í‘¹ 젖었겠지요. ë‚´ê°€ ì›ƒì€ ê²ƒì€ ì£½ê¸° ì „ í•œ 번 천지와 ì¸ìƒì„ 웃어 버린 것ì¸ë° 그렇게 야단ì´ë‹ˆâ€¦â€¦ 하하하하." +R는 ì‹ì€ 차를 í•œ 모금 ë” ë§ˆì‹œë©°, +"ì°¸ ëª©ë„ ë§ˆë¥´ê¸°ë„ í•˜ë”니. ìž…ì—는 침 í•œ 방울 없고. 그러나 ëª»ë¬¼ì„ ë¨¹ì„ ìƒê°ë„ 없고. 나중ì—는 ë§ì„ 하려고 í•´ë„ í˜€ê°€ 안 ëŒì•„가겠지요. +ì´ëŸ¬ëŠ” ë™ì•ˆì— ë‹¬ë¹›ì´ í¬ë¯¸í•´ì§€ê¸¸ëž˜ 웬ì¼ì¸ê°€ 하고 고개를 ë²ˆì© ë“¤ì—ˆë”니 í•´ê°€ 떠오릅니다그려. 어떻게 붉고 둥글고 씩씩한지. `ì € í•´ 보오.' 하고 나는 기계ì ìœ¼ë¡œ 벌떡 ì¼ì–´ë‚˜ì„œ 구ë©ì´ì—ì„œ 뛰어나왔지요." +하고 빙그레 웃소. Rì˜ ë¹™ê·¸ë ˆ 웃는 ì–‘ì´ ì°¸ 좋았소. +"ë‚´ê°€ 뛰어나오는 ê²ƒì„ ë³´ê³  ì´ì´ë„ 뿌시시 ì¼ì–´ë‚¬ì§€ìš”. ê·¸ í•´! ê·¸ í•´ì˜ ìƒˆ ë¹›ì„ ë°›ëŠ” 하늘과 ë•…ì˜ ë¹›! 나는 ê·¸ê²ƒì„ í˜•ìš©í•  ë§ì„ 가지지 못합니다. 다만 íž˜ê» ì†Œë¦¬ì¹˜ê³  싶고 ê¸°ìš´ê» ë‹¬ìŒë°•ì§ˆì¹˜ê³  ì‹¶ì€ ìƒê°ì´ ë‚  ë¿ì´ì–´ìš”. +`우리 삽시다, 죽지 ë§ê³  삽시다, ì‚´ì•„ì„œ 새 세ìƒì„ 하나 만들어 봅시다.' ì´ë ‡ê²Œ ë§í•˜ì˜€ì§€ìš”. 하니까 ì´ì´ê°€ 처ìŒì—는 ê¹œì§ ë†€ë¼ëŠ” 것 같아요. 그러나 마침내 ì•„ë‚´ë„ ì£½ì„ ëœ»ì„ ë³€í•˜ì˜€ì§€ìš”. 그래서 남 ì„ ìƒì„ 청하여다가 ê·¸ ë§ì”€ì„ 여쭈었ë”니 남 ì„ ìƒê»˜ì„œ 고개를 ë„ë•ë„ë•í•˜ì‹œê³  우리 ë‘˜ì˜ í˜¼ì¸ ì£¼ë¡€ë¥¼ 하셨지요. ê·¸ 후 ì‹­ì—¬ ë…„ì— ìš°ë¦¬ëŠ” ë°­ 갈고 ì•„ì´ ê¸°ë¥´ê³  ì´ëŸ° ìƒí™œì„ 하고 ìžˆëŠ”ë° ì–¸ì œë‚˜ 여기 새 ë¯¼ì¡±ì´ ìƒê¸°ê³  누가 새 ë‹¨êµ°ì´ ë ëŠ”지요. 하하하하, 아하하하. 피곤하시겠습니다. ì´ì•¼ê¸°ê°€ 너무 길어서." +하고 R는 ë§ì„ ëŠì†Œ. +나는 R부처가 만류하는 ê²ƒë„ ë‹¤ 뿌리치고 여관으로 ëŒì•„왔소. R와 함께 달빛 ì†, ê°œ 짖는 소리 ì†ì„ 지나서 ì•„ë¼ì‚¬ ì‚¬ëžŒì˜ ì¡°ê·¸ë§ˆí•œ 여관으로 ëŒì•„왔소. 여관 주ì¸ë„ R를 아는 모양ì´ì–´ì„œ 반갑게 ì¸ì‚¬í•˜ê³  ë˜ ë‚´ê²Œ 대한 부íƒë„ 하는 모양ì¸ê°€ 보오. +R는 ë‚´ ë°©ì— ì˜¬ë¼ì™€ì„œ ë‚´ì¼ í•˜ë£¨ 지날 ì¼ë„ ì´ì•¼ê¸°í•˜ê³  ë˜ ë‚¨ ì„ ìƒê³¼ ì •ìž„ì—게 관한 ì´ì•¼ê¸°ë„ 하였으나, 나는 그가 무슨 ì´ì•¼ê¸°ë¥¼ 하는지 잘 ë“¤ì„ ë§Œí•œ 마ìŒì˜ ì—¬ìœ ë„ ì—†ì–´ì„œ ë§ˆìŒ ì—†ëŠ” ëŒ€ë‹µì„ í•  ë¿ì´ì—ˆì†Œ. +Rê°€ ëŒì•„ê°„ ë’¤ì— ë‚˜ëŠ” ì˜·ë„ ë²—ì§€ 아니하고 ì¹¨ëŒ€ì— ë“œëŸ¬ëˆ„ì› ì†Œ. 페치카를 때기는 í•œ 모양ì´ë‚˜ ë°©ì´ ì¨ëŠ˜í•˜ê¸° 그지없소. +`ê·¸ ë‘ ë³„ 무ë¤ì´ ì •ë§ R와 ê·¸ 여학ìƒê³¼ ë‘ ì‚¬ëžŒì´ ì˜ì›ížˆ 달치 못할 ê¿ˆì„ ì•ˆì€ ì±„ë¡œ 깨ë—하게 죽어서 묻힌 무ë¤ì´ì—ˆìœ¼ë©´ 얼마나 좋ì„까. ë§Œì¼ ê·¸ë ‡ë‹¤ 하면 ë‚´ì¼ í•œ 번 ë” ê°€ì„œ 보토ë¼ë„ 하고 오련마는.' +하고 나는 Rë¶€ì²˜ì˜ ìƒí™œì— 대하여 ì¼ì¢…ì˜ ë¶ˆë§Œê³¼ í™˜ë©¸ì„ ëŠê¼ˆì†Œ. +그리고 ë‚´ê°€ ì •ìž„ì„ ì—¬ê¸°ë‚˜ 시베리아나 ì–´ë–¤ 곳으로 불러다가 ë§Œì¼ R와 ê°™ì€ í‰ë‚´ë¥¼ 낸다 하면, 하고 ìƒê°í•´ 보고는 나는 진저리를 쳤소. 나는 내머리 ì†ì— 다시 그러한 ìƒê°ì´ í•œ ì¡°ê°ì´ë¼ë„ 들어올 ê²ƒì„ ë‘려워하였소. +ê¸‰í–‰ì„ ê¸°ë‹¤ë¦¬ìžë©´ ë˜ ì‚¬í˜ì„ 기다리지 아니하면 아니 ë˜ê¸°ë¡œ 나는 ì´íŠ¿ë‚  ìƒˆë²½ì— ë– ë‚˜ëŠ” 구간차를 타고 Fì—­ì„ ë– ë‚˜ 버렸소. Rì—게는 고맙다는 편지 í•œ ìž¥ë§Œì„ ì¨ ë†“ê³ . 나는 R를 ë” ë³´ê¸°ë¥¼ ì›ì¹˜ 아니하였소. ê·¸ê²ƒì€ ë°˜ë“œì‹œ R를 죄ì¸ìœ¼ë¡œ ë³´ì•„ì„œ 그런 ê²ƒì€ ì•„ë‹ˆì˜¤ë§ˆëŠ” 그저 나는 다시 R를 대면하기를 ì›ì¹˜ 아니한 것ì´ì˜¤. +나는 차가 Rì˜ ì§‘ ì•žì„ ì§€ë‚  ë•Œì—ë„ Rì˜ ì§‘ì— ëŒ€í•˜ì—¬ì„œëŠ” 외면하였소. +ì´ ëª¨ì–‘ìœ¼ë¡œ 나는 í¥ì•ˆë ¹ì„ 넘고, 하ì¼ë¼ë¥´ì˜ ì†”ë°­ì„ ì§€ë‚˜ì„œ 마침내 ì´ ê³³ì— ì˜¨ 것ì´ì˜¤. +형! 나는 ì¸ì œëŠ” ì´ íŽ¸ì§€ë¥¼ ë내오. ë” ì“¸ ë§ë„ 없거니와 ì¸ì œëŠ” ì´ê²ƒì„ ì“°ê¸°ë„ ì‹«ì¦ì´ 났소. +ì´ íŽ¸ì§€ë¥¼ 쓰기 시작할 ë•Œì—는 ë°”ì´ì¹¼ì— ë¬¼ê²°ì´ í‰ìš©í•˜ë”니 ì´ íŽ¸ì§€ë¥¼ ë내는 지금ì—는 ê°€ì˜ ê°€ê¹Œìš´ 물ì—는 ì–¼ìŒì´ 얼었소. 그리고 ì € 멀리 푸른 ë¬¼ì´ ëŠ ì‹¤ëŠ ì‹¤ 하얗게 눈 ë®ì¸ ì‚° 빛과 어울리게 ë˜ì—ˆì†Œ. +사í˜ì´ë‚˜ ì´ì–´ì„œ ì˜¤ë˜ ëˆˆì´ ë°¤ìƒˆì— ê°œê³  오늘 아침ì—는 칼날 ê°™ì€ ë°”ëžŒì´ ëˆˆì„ ë‚ ë¦¬ê³  있소. +나는 ì´ ì–¼ìŒ ìœ„ë¡œ 걸어서 ì € 푸른 물 있는 곳까지 가고 ì‹¶ì€ ìœ í˜¹ì„ ê¸ˆí•  수 없소. ë”구나 ì´ íŽ¸ì§€ë„ ë‹¤ ì“°ê³  나니, ì¸ì œëŠ” ë‚´ê°€ ì´ ì„¸ìƒì—ì„œ í•  마지막 ì¼ê¹Œì§€ 다 í•œ 것 같소. +ë‚´ê°€ ì´ ì•žì— ì–´ë””ë¡œ 가서 ì–´ì°Œ ë ëŠ”지는 ë‚˜ë„ ëª¨ë¥´ì§€ë§ˆëŠ” í¬ë¯¸í•œ 소ì›ì„ ë§í•˜ë©´ 눈 ë®ì¸ ì‹œë² ë¦¬ì•„ì˜ ì¸ì  없는 삼림 지대로 한정 ì—†ì´ í—¤ë§¤ë‹¤ê°€ 기운 진하는 ê³³ì—ì„œ ì´ ëª©ìˆ¨ì„ ë§ˆì¹˜ê³  싶소. +ìµœì„ êµ°ì€ `ë'ì´ë¼ëŠ” 글ìžë¥¼ ì¼ë‹¤ê°€ 지워 버리고 ë”´ 종ì´ì—다가 ì´ëŸ° ë§ì„ ì¼ë‹¤ +다 ì“°ê³  나니 ì´ëŸ° íŽ¸ì§€ë„ ë‹¤ 부질없는 ì¼ì´ì˜¤. ë‚´ê°€ ì´ëŸ° ë§ì„ 한대야 세ìƒì´ 믿어 줄 ë¦¬ë„ ì—†ì§€ 않소. ë§ì´ëž€ 소용 없는 것ì´ì˜¤. ë‚´ê°€ 아무리 ë‚´ ì•„ë‚´ì—게 ë§ì„ í–ˆì–´ë„ ì•„ë‹ˆ 믿었거든 ë‚´ ì•„ë‚´ë„ ë‚´ ë§ì„ 아니 믿었거든 하물며 세ìƒì´ ë‚´ ë§ì„ ë¯¿ì„ ë¦¬ê°€ 있소. 믿지 아니할 ë¿ ì•„ë‹ˆë¼ ë‚´ ë§ ì¤‘ì—ì„œ ìžê¸°ë„¤ 목ì ì— 필요한 ë¶€ë¶„ë§Œì€ ë¯¿ê³ , ë˜ ìžê¸°ë„¤ 목ì ì— 필요한 ë¶€ë¶„ì€ ë§ˆìŒëŒ€ë¡œ 고치고 뒤집고 보태고 í•  것ì´ë‹ˆê¹Œ, 나는 ì´ íŽ¸ì§€ë¥¼ ì“´ ê²ƒì´ í•œ 무ìµí•˜ê³  어리ì„ì€ ì¼ì¸ ì¤„ì„ ê¹¨ë‹¬ì•˜ì†Œ. +형ì´ì•¼ ì´ íŽ¸ì§€ë¥¼ 아니 보기로니 나를 안 믿겠소? ê·¸ 중ì—는 혹 í˜•ì´ ì§€ê¸ˆê¹Œì§€ ëª¨ë¥´ë˜ ìžë£Œë„ 없지 아니하니, 형만 í˜¼ìž ë³´ì‹œê³  형만 í˜¼ìž ë‚´ ì‚¬ì •ì„ ì•Œì•„ 주시면 다행ì´ê² ì†Œ. 세ìƒì— í•œ 믿는 친구를 가지는 ê²ƒì´ ì €ë§ˆë‹¤ 하는 ì¼ì´ê² ì†Œ? +나는 ì´ ì“¸ë°ì—†ëŠ” 편지를 몇 번ì´ë‚˜ ë¶ˆì‚´ë¼ ë²„ë¦¬ë ¤ê³  하였으나 ê·¸ëž˜ë„ ê±°ê¸°ë„ ì¼ì¢…ì˜ ì• ì°©ì‹¬ì´ ìƒê¸°ê³  ë¯¸ë ¨ì´ ìƒê¸°ëŠ”구려. 형 í•œ 분ì´ë¼ë„ ë³´ì—¬ 드리고 ì‹¶ì€ ë§ˆìŒì´ ìƒê¸°ëŠ”구려. ë‚´ê°€ Sí˜•ë¬´ì†Œì— ìž…ê°í•´ ìžˆì„ ì ì— 형무소 ë²½ì— ì£„ìˆ˜ê°€ ì†í†±ìœ¼ë¡œ ì„±ëª…ì„ ìƒˆê¸´ ê²ƒì„ ë³´ì•˜ì†Œ. ë’¤ì— ë¬¼ì—ˆë”니 ê·¸ê²ƒì€ í”히 사형수가 하는 짓ì´ë¼ê³ . 사형수가 êµìˆ˜ëŒ€ì— ëŒë ¤ 나가기 바로 ì „ì— í”히 ì†í†±ìœ¼ë¡œ ë‹´ë²¼ë½ì´ë‚˜ ë§ˆë£»ë°”ë‹¥ì— ì œ ì´ë¦„ì„ ìƒˆê¸°ëŠ” ì¼ì´ 있다고 하는 ë§ì„ 들었소. ë‚´ê°€ 형ì—게 쓰는 ì´ íŽ¸ì§€ë„ ê·¸ 심리와 비슷한 것ì¼ê¹Œìš”? +형! 나는 보통 사람보다는, 정보다는 지로, ìƒì‹ë³´ë‹¤ëŠ” ì´ë¡ ìœ¼ë¡œ, ì´í•´ë³´ë‹¤ëŠ” ì˜ë¦¬ë¡œ ì‚´ì•„ 왔다고 ìžì‹ í•˜ì˜¤. ì´ë¥¼í…Œë©´ 논리학ì ìœ¼ë¡œ 윤리학ì ìœ¼ë¡œ 살아온 것ì´ë¼ê³  할까. 나는 엄격한 êµì‚¬ìš”, êµìž¥ì´ì—ˆì†Œ. 내게는 ì˜ì§€ë ¥ê³¼ ì´ì§€ë ¥ë°–ì— ì—†ëŠ” 것 같았소. 그러한 ìƒí™œì„ 수십 ë…„ í•´ 오지 아니하였소? 나는 ì´ ì•žì— ëª‡ì‹­ ë…„ì„ ë” ì‚´ë”ë¼ë„ ë‚´ ì´ ì„±ê²©ì´ë‚˜ ìƒí™œ 태ë„ì—는 ë³€í•¨ì´ ì—†ìœ¼ë¦¬ë¼ê³  ìžì‹ í•˜ì˜€ì†Œ. ë¶ˆí˜¹ì§€ë…„ì´ ì§€ë‚¬ìœ¼ë‹ˆ 그렇게 ìƒê°í•˜ì˜€ì„ ê²ƒì´ ì•„ë‹ˆì˜¤? +ê·¸ëŸ°ë° í˜•! ì°¸ ì´ìƒí•œ ì¼ì´ 있소. ê·¸ê²ƒì€ ë‚´ê°€ 지금까지 처해 ìžˆë˜ í™˜ê²½ì„벗어나서 호호 탕탕하게 ë„“ì€ ì„¸ê³„ì— ì•Œëª¸ì„ ë‚´ì–´ë˜ì§ì„ 당하니 ë‚´ ë§ˆìŒ ì†ì—는 무서운 여러 가지 변화가 ì¼ì–´ë‚˜ëŠ”구려. 나는 ì´ ë§ë„ 형ì—게 아니 하려고 ìƒê°í•˜ì˜€ì†Œ. 노여워하지 마시오, ë‚´ê²Œê¹Œì§€ë„ ìˆ¨ê¸°ëŠëƒê³ . 그런 ê²ƒì´ ì•„ë‹ˆì˜¤, 형ì€ì»¤ë…• 나 ìžì‹ ì—ê²Œê¹Œì§€ë„ ìˆ¨ê¸°ë ¤ê³  í•˜ì˜€ë˜ ê²ƒì´ì˜¤. 혹시 그런 기다리지 아니 í•˜ì˜€ë˜ ì›, 그런 ìƒê°ì´ ë‚´ 마ìŒì˜ í•˜ëŠ˜ì— ì¼ì–´ë‚˜ë¦¬ë¼ê³  ìƒìƒë„ 아니하였ë˜, 그런 ìƒê°ì´ ì¼ì–´ë‚  ë•Œì—는 나는 스스로 놀ë¼ê³  스스로 슬í¼í•˜ì˜€ì†Œ. 그래서 스스로 숨기기로 하였소. +ê·¸ 숨긴다는 ê²ƒì´ ë¬´ì—‡ì´ëƒ 하면 ê·¸ê²ƒì€ ì—´ì •ì´ìš”, ì •ì˜ ë¶ˆê¸¸ì´ìš”, ì •ì˜ ê´‘í’ì´ìš”, ì •ì˜ ë¬¼ê²°ì´ì˜¤. ë§Œì¼ ë‚´ ì˜ì‹ì´ 세계를 í‰í™”로운 í’€ 있고, 꽃 있고, 나무 있는 벌íŒì´ë¼ê³  하면 거기 ë‚œë°ì—†ëŠ” 미친 ì§ìŠ¹ë“¤ì´ ë¶ˆì„ ë¿œê³  소리를 지르고 싸우고, ì˜ê°ì„ 하고 ë‚ ì³ì„œ, ì´ ë™ì‚°ì˜ í‰í™”ì˜ í™”ì´ˆë¥¼ 다 짓밟아 버리고 마는 그러한 모양과 같소. +형! ê·¸ ì´ìƒì•¼ë¦‡í•œ ì§ìŠ¹ë“¤ì´ 여태ê», 사십 ë…„ ê°„ì„ ì–´ëŠ êµ¬ì„ì— ìˆ¨ì–´ 있었소? 그러다가 ì¸ì œ 뛰어나와 ê°ê° ì œ 권리를 주장하오? +지금 ë‚´ 가슴 ì†ì€ ë“소. ë‚´ ëª¸ì€ ë°”ì§ ì—¬ìœ„ì—ˆì†Œ. ê·¸ê²ƒì€ ìƒë¦¬í•™ì ìœ¼ë¡œë‚˜ 심리학ì ìœ¼ë¡œë‚˜ 타는 것ì´ìš”, 연소하는 것ì´ì˜¤. 그래서 다만 ë‚´ ëª¸ì˜ ì§€ë°©ë§Œì´ íƒ€ëŠ” ê²ƒì´ ì•„ë‹ˆë¼, 골수까지 타고, ëª¸ì´ íƒˆ ë¿ì´ ì•„ë‹ˆë¼ ìƒëª… ê·¸ ë¬¼ê±´ì´ íƒ€ê³  있는 것ì´ì˜¤. 그러면 어찌할까. +지위, 명성, 습관, 시대 사조 등등으로 ì¼ìƒì— 눌리고 ëˆŒë ¸ë˜ ë‚´ ìžì•„ì˜ ì¼ë¶€ë¶„ì´ í˜ëª…ì„ ì¼ìœ¼í‚¨ 것ì´ì˜¤? í•œ ë²ˆë„ ìžìœ ë¡œ 권세를 부려 보지 못한 본능과 ê°ì •ë“¤ì´ ë‚´ ìƒëª…ì´ ë나기 ì „ì— í•œ 번 ë‚ ë›°ì–´ 보려는 것ì´ì˜¤. ì´ê²ƒì´ ì„ ì´ì˜¤? ì•…ì´ì˜¤? +ê·¸ë“¤ì€ ë‚´ê°€ 지금까지 옳다고 여기고 신성하다고 ì—¬ê¸°ë˜ ëª¨ë“  권위를 모조리 둘러엎으려고 드오. 그러나 형! 나는 ë„저히 ì´ í˜ëª…ì„ ìš©ì¸í•  수가 없소. 나는 죽기까지 버티기로 ê²°ì •ì„ í•˜ì˜€ì†Œ. ë‚´ ì†ì—ì„œ ë‘ ì„¸ë ¥ì´ ì‹¸ìš°ë‹¤ê°€ 싸우다가 승부가 ê²°ì •ì´ ëª» ëœë‹¤ë©´ 나는 ìŠ¹ë¶€ì˜ ê²°ì •ì„ ê¸°ë‹¤ë¦¬ì§€ 아니하고 살기를 그만ë‘려오. +나는 눈 ë®ì¸ 삼림 ì†ìœ¼ë¡œ 들어가려오. 나는 Vë¼ëŠ” 대삼림 지대가 ì–´ë””ì¸ ì¤„ë„ ì•Œê³  거기를 가려면 ì–´ëŠ ì •ê±°ìž¥ì—ì„œ 내릴 ê²ƒë„ ë‹¤ 알아 놓았소. +ë§Œì¼ ë‹¨ìˆœížˆ 죽는다 하면 구태여 멀리 찾아갈 í•„ìš”ë„ ì—†ì§€ë§ˆëŠ” ê·¸ëž˜ë„ ë‚˜ 혼ìžë¡œëŠ” ë‚´ 사ìƒê³¼ ê°ì •ì˜ ì²­ì‚°ì„ í•˜ê³  싶소. ì‚´ 수 있는 날까지 세ìƒì„ ë– ë‚œ ê³³ì—ì„œ 살다가 완전한 í•´ê²°ì„ ì–»ëŠ” ë‚  나는 í˜¹ì€ ìŠ¹ë¦¬ì˜, í˜¹ì€ íŒ¨ë°°ì˜ ì¢…ë§‰ì„ ë‹«ì¹  것ì´ì˜¤. ë§Œì¼ í•´ê²°ì´ ì•ˆ ë˜ë©´ 안 ë˜ëŠ” 대로 그치면 그만ì´ì§€ìš”. +나는 ì´ ë¶“ì„ ë†“ê¸° ì „ì— ì–´ì ¯ë°¤ì— ê¾¼ 꿈 ì´ì•¼ê¸° 하나는 하려오. ê¿ˆì´ í•˜ë„ ìˆ˜ìƒí•´ì„œ 마치 ë‚´ ì „ë„ì— ëŒ€í•œ ì‹ ì˜ ê³„ì‹œì™€ë„ ê°™ê¸°ë¡œ 하는 ë§ì´ì˜¤. ê·¸ ê¿ˆì€ ì´ëŸ¬í•˜ì˜€ì†Œ. +ë‚´ê°€ ê½ì´ê¹¨(꼬ì´ê¹Œë¼ëŠ” ì•„ë¼ì‚¬ë§ë¡œ 침대ë¼ëŠ” ë§ì´ ì¡°ì„  ë™í¬ì˜ 입으로 변한 ë§ì´ì˜¤.) ì§ì„ 지고 ì‚½ì„ ë©”ê³  ëˆˆì´ ë®ì¸ 삼림 ì†ì„ í˜¼ìž ê±¸ì—ˆì†Œ. ì´ ê½ì´ê¹¨ ì§ì´ëž€ ê²ƒì€ ê¸ˆì ê¾¼ë“¤ì´ ê·¸ 여행 ì¤‘ì— ì†Œìš©í’ˆ, 마른 ë¹µ, 소금, ë‚´ë³µ 등ì†ì„ 침대 ë§¤íŠ¸ë¦¬ìŠ¤ì— ë„£ì–´ì„œ 지고 다니는 것ì´ì˜¤. ì´ ì§í•˜ê³  삽 í•œ ê°œ, ë„ë¼ í•œ ê°œ, ê·¸ê²ƒì´ ì‹œë² ë¦¬ì•„ë¡œ ê¸ˆì„ ì°¾ì•„ 헤매는 ì¡°ì„  ë™í¬ë“¤ì˜ 행색ì´ì˜¤. ë‚´ê°€ ì´ë¥´ì¿ ì¸ í¬ì—ì„œ ì´ëŸ¬í•œ ë™í¬ë¥¼ ë§Œë‚¬ë˜ ê²ƒì´ ê¿ˆìœ¼ë¡œ ë˜ì–´ 나온 모양ì´ì˜¤. +나는 꿈ì—는 세ìƒì„ 다 잊어버린, 아주 깨ë—하고 침착한 사람으로 ì´ ê½ì´ê¹¨ ì§ì„ 지고 ì‚½ì„ ë©”ê³  ë°¤ì¸ì§€ ë‚®ì¸ì§€ ì•Œ 수 없으나 ë•…ì€ ëˆˆë¹›ìœ¼ë¡œ í¬ê³ , í•˜ëŠ˜ì€ êµ¬ë¦„ë¹›ìœ¼ë¡œ íšŒìƒ‰ì¸ ì‚¼ë¦¼ 지대를 í—ˆë•í—ˆë• 걸었소. ê¸¸ë„ ì—†ëŠ” ë°ë¥¼, ì¸ì ë„ 없는 ë°ë¥¼. +꿈ì—ë„ ë‚´ ëª¸ì€ í½ í”¼ê³¤í•´ì„œ 쉴 ìžë¦¬ë¥¼ 찾는 마ìŒì´ì—ˆì†Œ. +나는 마침내 ì–´ë–¤ ì–¸ë• ë°‘ í•œ êµ°ë°ë¥¼ 골ëžì†Œ. 그리고 ìƒì‹œì— ì´ì•¼ê¸°ì—ì„œ ë“¤ì€ ëŒ€ë¡œ 삽으로 ë‚´ê°€ 누울 ìžë¦¬ë§Œí•œ ëˆˆì„ ì¹˜ê³ , 그리고는 ë„ë¼ë¡œ ê³ì— ì„  나무 몇 개를 ì°ì–´ 누ì´ê³  거기다가 ë¶ˆì„ ë†“ê³  ê·¸ ë¶ˆê¹€ì— ë…¹ì€ ë•…ì„ ë‘ì–´ ìžë‚˜ 파내고 ê·¸ ì†ì— 드러누웠소. 훈훈한 ê²ƒì´ ì•„ì£¼ 편안하였소. +하늘ì—는 ë³„ì´ ë°˜ì§ê±°ë ¸ì†Œ. Fì—­ì—ì„œ ë³´ë˜ ë°”ì™€ ê°™ì´ í° ë³„ ìž‘ì€ ë³„ë„ ë³´ì´ê³  í‰ì‹œì— 보지 ëª»í•˜ë˜ ë¶‰ì€ ë³„, 푸른 별 ë“¤ë„ ë³´ì˜€ì†Œ. 나는 ì´ ì´ìƒí•œ 하늘, ì´ìƒí•œ ë³„ë“¤ì´ ìžˆëŠ” í•˜ëŠ˜ì„ ë³´ê³  드러누워 있노ë¼ë‹ˆê¹Œ ë¬¸ë“ ì–´ë””ì„œ ë°œìžêµ­ 소리가 들렸소. í‰í‰í‰í‰ 우루루루…… 나는 벌떡 ì¼ì–´ë‚˜ë ¤ 하였으나 ëª¸ì´ ì²œ ê·¼ì´ë‚˜ ë˜ì–´ì„œ 움ì§ì¼ 수가 없었소. 가까스로 고개를 조금 들고 보니 ë¿”ì´ ê¸¸ë‹¤ëž—ê³  ëˆˆì´ ë¶ˆê°™ì´ ë¶‰ì€ ì‚¬ìŠ´ì˜ ë–¼ê°€ ë¬´ì—‡ì— ë†€ëžëŠ”지 껑충껑충 ë›°ì–´ 지나가오. ì´ê²ƒì€ 아마 í¬ë¡œí¬íŠ¸í‚¨ì˜ <ìƒí˜¸ 부조론> ì†ì— ë§í•œ ì‹œë² ë¦¬ì•„ì˜ ì‚¬ìŠ´ì˜ ë–¼ê°€ ê¿ˆì´ ë˜ì–´ 나온 모양ì´ì˜¤. +그러ë”니 ê·¸ ì‚¬ìŠ´ì˜ ë–¼ê°€ 다 지나간 ë’¤ì—, ê·¸ ì‚¬ìŠ´ì˜ ë–¼ê°€ ì˜¤ë˜ ë°©í–¥ìœ¼ë¡œì„œ ì •ìž„ì´ê°€ 걸어오는 ê²ƒì´ ì•„ë‹ˆë¼ ìŠ¤ë¥´ë¥µ 하고 미ë„러져 오오. 마치 ì¸í˜•ì„ 밀어 주는 것같ì´. +"ì •ìž„ì•„!" +하고 나는 소리를 치고 ëª¸ì„ ì¼ìœ¼í‚¤ë ¤ 하였소. +ì •ìž„ì˜ ëª¨ì–‘ì€ ë‚˜ë¥¼ ìž ê¹ ë³´ê³ ëŠ” 미ë„러지는 ë“¯ì´ í˜ëŸ¬ê°€ 버리오. +나는 ì •ìž„ì•„, 정임아를 부르고 팔다리를 부둥거렸소. 그러다가 마침내 ë‚´ ëª¸ì´ ë²ˆì© ì¼ìœ¼ì¼œì§ì„ 깨달았소. 나는 ì •ìž„ì˜ ë’¤ë¥¼ ë”°ëžì†Œ. +나는 눈 위로 삼림 ì†ìœ¼ë¡œ ì •ìž„ì˜ ê·¸ë¦¼ìžë¥¼ ë”°ëžì†Œ. ë³´ì¼ ë“¯ 안 ë³´ì¼ ë“¯, ìž¡íž ë“¯ 안 ìž¡íž ë“¯, 나는 무거운 다리를 ëŒê³  ì •ìž„ì„ ë”°ëžì†Œ. +ì •ìž„ì€ ì´ ì¶”ìš´ ë‚ ì´ì–¸ë§Œ 눈과 ê°™ì´ í° ì˜·ì„ ìž…ì—ˆì†Œ. ê·¸ ì˜·ì€ ì˜›ë‚  로마 ì—¬ì¸ì˜ 옷과 ê°™ì´ ë°”ëžŒê²°ì— íŽ„ë ê±°ë ¸ì†Œ. +"오지 마세요. 저를 ë”°ë¼ì˜¤ì§€ 못하십니다." +하고 ì •ìž„ì€ ëˆˆë³´ë¼ ì†ì— 가리워 버리고 ë§ì•˜ì†Œ. 암만 ë¶ˆëŸ¬ë„ ëŒ€ë‹µì´ ì—†ê³  눈보ë¼ê°€ 다 지나간 ë’¤ì—ë„ ë¶‰ì€ ë³„, 푸른 별과 ë¿” 긴 ì‚¬ìŠ´ì˜ ë–¼ë¿ì´ì˜¤. ì •ìž„ì€ ë³´ì´ì§€ 아니하였소. 나는 미칠 ë“¯ì´ ì •ìž„ì„ ì°¾ê³  부르다가 ìž ì„ ê¹¨ì—ˆì†Œ. +ê¿ˆì€ ì´ê²ƒë¿ì´ì˜¤. ê¿ˆì„ ê¹¨ì–´ì„œ ì°½ ë°–ì„ ë°”ë¼ë³´ë‹ˆ ì–¼ìŒê³¼ ëˆˆì— ë®ì¸ ë°”ì´ì¹¼í˜¸ 위ì—는 ìƒˆë²½ì˜ ê²¨ìš¸ ë‹¬ì´ ë¹„ì¹˜ì–´ 있었소. ì € 멀리 검푸르게 ë³´ì´ëŠ” ê²ƒì´ ì±„ 얼어붙지 아니한 물ì´ê² ì§€ìš”. 오늘 ë°¤ì— ë°”ëžŒì´ ì—†ê³  ê¸°ì˜¨ì´ ë‚´ë¦¬ë©´ 그것마저 얼어붙ì„는지 모르지요. ë²Œì¨ ì‚´ì–¼ìŒì´ ìž¡í˜”ëŠ”ì§€ë„ ëª¨ë¥´ì§€ìš”. ì•„ì•„, ê·¸ ì†ì€ 얼마나 깊ì„까. 나는 ë°”ì´ì¹¼ì˜ 물 ì†ì´ ê´€ì‹¬ì´ ë˜ì–´ì„œ 못 견디겠소. +형! 나는 ìžë°±í•˜ì§€ 아니할 수 없소. ì´ ê¿ˆì€ ë‚´ 마ìŒì˜ ì–´ë–¤ ë¶€ë¶„ì„ ì„¤ëª…í•œ 것ì´ë¼ê³ . 그러나 형! 나는 ì´ê²ƒì„ 부정하려오. 굳세게 부정하려오. 나는 ì´ ê¿ˆì„ ë¶€ì •í•˜ë ¤ì˜¤. 억지로ë¼ë„ 부정하려오. 나는 ê²°ì½” ë‚´ ì†ì— ì¼ì–´ë‚œ í˜ëª…ì„ ìš©ì¸í•˜ì§€ 아니하려오. 나는 ê·¸ê²ƒì„ í˜ëª…으로 ì¸ì •í•˜ì§€ 아니하려오. 아니오! 아니오! ê·¸ê²ƒì€ ë°˜ëž€ì´ì˜¤! ë‚´ ì¸ê²©ì˜ 통ì¼ì— 대한 반란ì´ì˜¤. 단연코 무단ì ìœ¼ë¡œ 진정하지 아니하면 아니 ë  ë°˜ëž€ì´ì˜¤. 보시오! 나는 굳게 서서 í•œ 걸ìŒë„ 뒤로 물러서지 아니할 것ì´ì˜¤. 만ì¼ì— í˜•ì´ ê´‘ì•¼ì— êµ¬ë¥´ëŠ” ë‚´ 시체나 í•´ê³¨ì„ ë³¸ë‹¤ë“ ì§€, ë˜ëŠ” 무슨 ì¸ì—°ìœ¼ë¡œ ë‚´ 무ë¤ì„ 발견하는 ë‚ ì´ ìžˆë‹¤ê³  하면 ê·¸ ë•Œì— í˜•ì€ ë‚´ê°€ ì´ ëª¨ë“  ë°˜ëž€ì„ ì§„ì •í•œ ê°œì„ ì˜ êµ°ì£¼ë¡œ ì£½ì€ ê²ƒì„ ì•Œì•„ 주시오. +ì¸ì œ ë°”ì´ì¹¼ì— ê²¨ìš¸ì˜ ì„ì–‘ì´ ë¹„ì¹˜ì—ˆì†Œ. ëˆˆì„ ì¸ ë‚˜ì§€ë§‰í•œ ì‚°ë“¤ì´ ì§€ëŠ” í–‡ë¹›ì— ìžì¤ë¹›ì„ 발하고 있소. 극히 깨ë—하고 싸늘한 ê´‘ê²½ì´ì˜¤. 아디유! +ì´ íŽ¸ì§€ë¥¼ ìš°íŽ¸ì— ë¶€ì¹˜ê³ ëŠ” 나는 ìµœí›„ì˜ ë°©ëž‘ì˜ ê¸¸ì„ ë– ë‚˜ì˜¤. ì°¾ì„ ìˆ˜ë„ ì—†ê³ , 편지 ë°›ì„ ìˆ˜ë„ ì—†ëŠ” 곳으로. +부디 í‰ì•ˆížˆ 계시오. ì¼ ë§Žì´ í•˜ì‹œì˜¤. 부ì¸ê»˜ 문안 드리오. ë‚´ 가족과 ì •ìž„ì˜ ì¼ ë§¡ê¸°ì˜¤. 아디유! +ì´ê²ƒìœ¼ë¡œ ìµœì„ êµ°ì˜ íŽ¸ì§€ëŠ” ë났다. +나는 ì´ íŽ¸ì§€ë¥¼ 받고 울었다. ì´ê²ƒì´ ì¼ íŽ¸ì˜ ì†Œì„¤ì´ë¼ 하ë”ë¼ë„ 슬픈 ì¼ì´ì–´ë“ , 하물며 ë‚´ê°€ 가장 믿고 사랑하는 ì¹œêµ¬ì˜ ì¼ìž„ì—야. +ì´ íŽ¸ì§€ë¥¼ 받고 나는 곧 ìµœì„ êµ°ì˜ ì§‘ì„ ì°¾ì•˜ë‹¤. 주ì¸ì„ ìžƒì€ ì´ ì§‘ì—서는아ì´ë“¤ì´ 마당ì—ì„œ 떠들고 있었다. +"ì‚¼ì²­ë™ ì•„ìžì”¨ 오셨수. 어머니, ì‚¼ì²­ë™ ì•„ìžì”¨." +하고 ìµœì„ êµ°ì˜ ìž‘ì€ë”¸ì´ 나를 ë³´ê³  뛰어들어갔다. +최ì„ì˜ ë¶€ì¸ì´ 나와 나를 맞았다. +부ì¸ì€ ë¨¸ë¦¬ë„ ë¹—ì§€ 아니하고, 얼굴ì—는 ì¡°ê¸ˆë„ í™”ìž¥ì„ ì•„ë‹ˆí•˜ê³ , ë§¤ë¬´ì‹œë„ í˜ëŸ¬ë‚´ë¦´ 지경으로 ì •ëˆë˜ì§€ 못하였다. ì¼ ì£¼ì¼ì´ë‚˜ 못 만난 ë™ì•ˆì— 부ì¸ì˜ ëª¨ì–‘ì€ ë”ìš± 초췌하였다. +"ë…¸ì„헌테서 무슨 기별ì´ë‚˜ 있습니까." +하고 나는 무슨 ë§ë¡œ ë§ì„ 시작할지 몰ë¼ì„œ ì´ëŸ° ë§ì„ 하였다. +"아니오. 왜 ê·¸ì´ê°€ ì§‘ì— íŽ¸ì§€í•˜ë‚˜ìš”?" +하고 부ì¸ì€ 성난 ë¹›ì„ ë³´ì´ë©°, +"ì§‘ì„ ë– ë‚œ 지가 ê·¼ 사십 ì¼ì´ ë˜ê±´ë§Œ 엽서 í•œ 장 있나요. 집안 ì‹êµ¬ê°€ 다 죽기로 눈ì´ë‚˜ 깜ì§í•  ì¸ê°€ìš”. 그저 ì •ìž„ì´í—Œí…Œë§Œ 미ì³ì„œ 죽ì„지 살지를 모르지요." +하고 울먹울먹한다. +"잘못 아십니다. 부ì¸ê»˜ì„œ ë…¸ì„ì˜ ë§ˆìŒì„ 잘못 아십니다. 그런 ê²ƒì´ ì•„ë‹™ë‹ˆë‹¤." +하고 나는 확신 있는 ë“¯ì´ ë§ì„ 시작하였다. +"ë…¸ì„ì˜ ìƒê°ì„ 부ì¸ê»˜ì„œ 오해하신 ì¤„ì€ ë²Œì¨ë¶€í„° 알았지마는 오늘 ë…¸ì„ì˜ íŽ¸ì§€ë¥¼ 받아보고 ë”ìš± 분명히 알았습니다." +하고 나는 부ì¸ì˜ í‘œì •ì˜ ë³€í™”ë¥¼ 엿보았다. +"편지가 왔어요?" +하고 부ì¸ì€ 놀ë¼ë©´ì„œ, +"지금 ì–´ë”” 있어요? ì¼ë³¸ 있지요?" +하고 ì§ˆíˆ¬ì˜ ë¶ˆê¸¸ì„ ëˆˆìœ¼ë¡œ 토하였다. +"ì¼ë³¸ì´ 아닙니다. ë…¸ì„ì€ ì§€ê¸ˆ ì•„ë¼ì‚¬ì— 있습니다." +"ì•„ë¼ì‚¬ìš”?" +하고 부ì¸ì€ 놀ë¼ëŠ” ë¹›ì„ ë³´ì´ë”니, +"그럼 ì •ìž„ì´ë¥¼ ë°ë¦¬ê³  아주 ì•„ë¼ì‚¬ë¡œ 가케오치를 하였군요." +하고 히스테리컬한 웃ìŒì„ ë³´ì´ê³ ëŠ” ëª¸ì„ í•œ 번 떨었다. +부ì¸ì€ 남편과 ì •ìž„ì˜ ê´€ê³„ë¥¼ ë§í•  때마다 ì´ë ‡ê²Œ 경련ì ì¸ 웃ìŒì„ 웃고 ëª¸ì„ ë– ëŠ” ê²ƒì´ ë²„ë¦‡ì´ì—ˆë‹¤. +"아닙니다. ë…¸ì„ì€ í˜¼ìž ê°€ 있습니다. 그렇게 오해를 마세요." +하고 나는 ë³´ì— ì‹¼ 최ì„ì˜ íŽ¸ì§€ë¥¼ ë‚´ì–´ì„œ 부ì¸ì˜ 앞으로 밀어 놓으며, +"ì´ê²ƒì„ 보시면 다 아실 줄 압니다. 어쨌으나 ë…¸ì„ì€ ê²°ì½” ì •ìž„ì´ë¥¼ ë°ë¦¬ê³  ê°„ ê²ƒì´ ì•„ë‹ˆìš”, ë„리어 ì •ìž„ì´ë¥¼ 멀리 떠나서 ê°„ 것입니다. 그러나 ê·¸ë³´ë‹¤ë„ ì¤‘ëŒ€ 문제가 있습니다. ë…¸ì„ì€ ì´ íŽ¸ì§€ë¥¼ ë³´ë©´ ì£½ì„ ê²°ì‹¬ì„ í•œ 모양입니다." +하고 부ì¸ì˜ 주ì˜ë¥¼ 질투로부터 ê·¸ 남편ì—게 대한 ë™ì •ì— ëŒì–´ ë³´ë ¤ 하였다. +"í¥. 왜요? 시체 정사를 하나요? 좋겠습니다. 머리가 허연 ê²ƒì´ ë”¸ìžì‹ ê°™ì€ ê³„ì§‘ì• í—ˆêµ¬ 정사를 한다면 ê·¸ ê¼´ 좋겠습니다. 죽으ë¼ì§€ìš”. 죽으래요. 죽는 ê²ƒì´ ë‚«ì§€ìš”. 그리구 ì‚´ì•„ì„œ 무엇 í•´ìš”?" +ë‚´ ëœ»ì€ í‹€ë ¤ 버렸다. 부ì¸ì˜ 표정과 ë§ì—서는 ë”ìš±ë”ìš± ë…í•œ ì§ˆíˆ¬ì˜ ì•ˆê°œì™€ 싸늘한 ì–¼ìŒê°€ë£¨ê°€ 날았다. +나는 부ì¸ì˜ ì´ íƒœë„ì— ë°˜ê°ì„ ëŠê¼ˆë‹¤. 아무리 ì§ˆíˆ¬ì˜ ê°ì •ì´ 강하다 하기로, ì‚¬ëžŒì˜ ìƒëª…ì´ ì œ ë‚¨íŽ¸ì˜ ìƒëª…ì´ ìœ„íƒœí•¨ì—ë„ ë¶ˆêµ¬í•˜ê³  ì˜¤ì§ ì œ ì§ˆíˆ¬ì˜ ê°ì •ì—만 충실하려 하는 ê·¸ 태ë„ê°€ 불쾌하였다. 그래서 나는, +"나는 ê·¸ë§Œí¼ ë§ì”€í•´ 드렸으니 ë” í•  ë§ì”€ì€ 없습니다. 아무려나 ì¢€ë” ëƒ‰ì •í•˜ê²Œ ìƒê°í•´ 보세요. 그리고 ì´ê²ƒì„ ì½ì–´ 보세요." +하고 ì¼ì–´ë‚˜ì„œ 집으로 ëŒì•„와 버리고 ë§ì•˜ë‹¤. +ë„무지 불쾌하기 그지없는 ë‚ ì´ë‹¤. 최ì„ì˜ íƒœë„ê¹Œì§€ë„ ë¶ˆì¾Œí•˜ë‹¤. 달아나긴 왜 달아나? 죽기는 왜 죽어? 못난 것! 기운 없는 것! 하고 나는 최ì„ì´ê°€ ê³ì— 섰기나 í•œ 것처럼 ëˆˆì„ í˜ê¸°ê³  중얼거렸다. +최ì„ì˜ ë§ëŒ€ë¡œ 최ì„ì˜ ë¶€ì¸ì€ ì•…í•œ ì‚¬ëžŒì´ ì•„ë‹ˆìš”, 그저 ë³´í†µì¸ ì—¬ì„±ì¼ëŠ”지 모른다. 그렇다 하면 ì—¬ìžì˜ 마ìŒì´ëž€ ë„ˆë¬´ë„ ì§ˆíˆ¬ì˜ ì¢…ì´ ì•„ë‹ê¹Œ. 설사 남편 ë˜ëŠ” 최ì„ì˜ ì‚¬ëž‘ì´ ì•„ë‚´ë¡œë¶€í„° ì •ìž„ì—게로 옮아 갔다고 하ë”ë¼ë„ ê·¸ê²ƒì„ ì§ˆíˆ¬ë¡œ 회복하려는 ê²ƒì€ ì–´ë¦¬ì„ì€ ì¼ì´ë‹¤. ì´ë¯¸ ì‚¬ëž‘ì´ ë– ë‚œ ë‚¨íŽ¸ì„ ë„¤ 마ìŒëŒ€ë¡œ ê°€ê±°ë¼ í•˜ê³  ìžë°œì ìœ¼ë¡œ 내어버릴 것ì´ì§€ë§ˆëŠ” ê·¸ê²ƒì„ ëª» í•  ì‚¬ì •ì´ ìžˆë‹¤ê³  하면 모르는 체하고 내버려 둘 ê²ƒì´ ì•„ë‹Œê°€. ê·¸ëž˜ë„ ì´ê²ƒì€ 우리네 남ìžì˜ ì´ë¡ ì´ìš”, ì—¬ìžë¡œëŠ” ì´ëŸ° ê²½ìš°ì— ì§ˆíˆ¬ë¼ëŠ” ë°˜ì‘ë°–ì— ì—†ë„ë¡ ìƒê¸´ 것ì¼ê¹Œ 나는 ì´ëŸ° ìƒê°ì„ 하고 있었다. +시계가 아홉시를 친다. +남대문 ë°– ì •ê±°ìž¥ì„ ë– ë‚˜ëŠ” ì—´ì°¨ì˜ ê¸°ì  ì†Œë¦¬ê°€ 들린다. +나는 만주를 ìƒê°í•˜ê³ , 시베리아를 ìƒê°í•˜ê³  최ì„ì„ ìƒê°í•˜ì˜€ë‹¤. 마ìŒìœ¼ë¡œëŠ” ì •ìž„ì„ ì‚¬ëž‘í•˜ë©´ì„œ ê·¸ ì‚¬ëž‘ì„ ë°œí‘œí•  수 없어서 ì‹œë² ë¦¬ì•„ì˜ ëˆˆ ë®ì¸ 삼림 ì†ìœ¼ë¡œ 방황하는 최ì„ì˜ ëª¨ì–‘ì´ ìµœì„ì˜ ê¿ˆ ì´ì•¼ê¸°ì— 있는 대로 ëˆˆì•žì— ì„ í•˜ê²Œ 떠나온다. +`ì‚¬ëž‘ì€ ëª©ìˆ¨ì„ ë¹¼ì•—ëŠ”ë‹¤.' +하고 나는 사랑ì¼ëž˜ ì¼ì–´ë‚˜ëŠ” ì¸ìƒì˜ ë¹„ê·¹ì„ ìƒê°í•˜ì˜€ë‹¤. 그러나 최ì„ì˜ ê²½ìš°ëŠ” 보통 있는 ê³µì‹ê³¼ëŠ” 달ë¼ì„œ ì‚¬ëž‘ì„ ì£½ì´ê¸° 위해서 ì œ ëª©ìˆ¨ì„ ì£½ì´ëŠ” 것ì´ì—ˆë‹¤. 그렇다 하ë”ë¼ë„, +`ì‚¬ëž‘ì€ ëª©ìˆ¨ì„ ë¹¼ì•—ëŠ”ë‹¤.' +는 ë°ì—는 ë‹¤ë¦„ì´ ì—†ë‹¤. +나는 ë¶ˆì¾Œë„ í•˜ê³  ëª¸ë„ ìœ¼ìŠ¤ìŠ¤í•˜ì—¬ 얼른 ìžë¦¬ì— 누웠다. ë©°ëŠë¦¬ê°€ 들어온 뒤부터 사랑 ìƒí™œì„ 하는 지가 ë²Œì¨ ì˜¤ ë…„ì´ë‚˜ ë˜ì—ˆë‹¤. 우리 부처란 ì¸ì œëŠ” í•œ ì—­ì‚¬ì  ì¡´ìž¬ìš”, ìœ¤ë¦¬ì  ê´€ê³„ì— ë¶ˆê³¼í•˜ì˜€ë‹¤. 오래 사귄 친구와 ê°™ì€ ìµìˆ™í•¨ì´ 있고, ì§‘ì— ì—†ì§€ 못할 사람ì´ë¼ëŠ” í•„ìš”ê°ë„ 있지마는 ì Šì€ ë¶€ì²˜ê°€ 가지는 듯한 그런 ì •ì€ ë²Œì¨ ì—†ëŠ” 지 오래였다. ì•„ë‚´ë„ ë‚˜ë¥¼ 대하면 본체만체, ë‚˜ë„ ì•„ë‚´ë¥¼ 대하면 본체만체, 무슨 필요가 있어서 ë§ì„ 붙ì´ë”ë¼ë„ ì•„ë¬´ìª¼ë¡ ë“£ê¸° 싫기를 ì›í•˜ëŠ” ë“¯ì´ í†¡í†¡ ë‚´ë˜ì¡Œë‹¤. ì•„ë‚´ë„ ê·¼ëž˜ì— ì™€ì„œëŠ” ì˜·ë„ ì•„ë¬´ë ‡ê²Œë‚˜, ë¨¸ë¦¬ë„ ì•„ë¬´ë ‡ê²Œë‚˜, ì–´ë”” 출입할 때밖ì—는 ë„무지 í™”ìž¥ì„ ì•„ë‹ˆ 하였다. +그러나 그렇다고 우리 ë¶€ì²˜ì˜ ìƒˆê°€ 좋지 못한 ê²ƒë„ ì•„ë‹ˆì—ˆë‹¤. 서로 소중히 여기는 마ìŒë„ 있었다. ì•„ë‚´ê°€ ì•ˆì— ìžˆë‹¤ê³  ìƒê°í•˜ë©´ 마ìŒì´ 든든하고 ë˜ ì•„ë‚´ì˜ ë§ì— ì˜í•˜ê±´ëŒ€ ë‚´ê°€ ì‚¬ëž‘ì— ìžˆê±°ë‹ˆ 하면 마ìŒì´ 든든하다고 한다. +우리 ë¶€ì²˜ì˜ ê´€ê³„ëŠ” ì´ëŸ¬í•œ 관계다. +나는 í•œ ë°©ì—ì„œ í˜¼ìž ìž ì„ ìžëŠ” ê²ƒì´ ìŠµê´€ì´ ë˜ì–´ì„œ 누가 ê³ì— 있으면 ìž ì´ ìž˜ 들지 아니하였다. 혹시 ì–´ë¦°ê²ƒë“¤ì´ ë§¤ë¥¼ 얻어맞고 사랑으로 í”¼ë‚œì„ ì™€ì„œ 울다가 ë‚´ ìžë¦¬ì—ì„œ ìž ì´ ë“¤ë©´ 귀엽기는 ê·€ì—¬ì›Œë„ ìž ìžë¦¬ëŠ” 편안치 아니하였다. 나는 ì±…ì„ ë³´ê³  ê¸€ì„ ì“°ê³  ê³µìƒì„ 하고 있으면 족하였다. 내게는 아무 ì• ìš•ì  ìš”êµ¬ë„ ì—†ì—ˆë‹¤. ì´ê²ƒì€ ë‚´ ì •ë ¥ì´ ì‡ ëª¨í•œ 까닭ì¸ì§€ 모른다. +그러나 최ì„ì˜ íŽ¸ì§€ë¥¼ 본 ê·¸ ë‚  ë°¤ì—는 ë„무지 ìž ì´ ìž˜ 들지 아니하였다. 최ì„ì˜ íŽ¸ì§€ê°€ 최ì„ì˜ ê³ ë¯¼ì´ ë‚´ ì¡¸ë˜ ì˜ì‹ì— 무슨 ìžê·¹ì„ 준 듯하였다. ì ë§‰í•œ 듯하였다. 허전한 듯하였다. 무엇ì¸ì§€ 모르나 그리운 ê²ƒì´ ìžˆëŠ” 것 같았다. +"ì–´, ì´ê±° 안ë˜ì—ˆêµ°." +하고 나는 벌떡 ì¼ì–´ë‚˜ 담배를 피워 물었다. +"나으리 주무셔 곕시오?" +하고 ì•„ë²”ì´ ì „ë³´ë¥¼ 가지고 왔다. +"명조 경성 ì°© 남정임" +ì´ë¼ëŠ” 것ì´ì—ˆë‹¤. +"ì •ìž„ì´ê°€ 와?" +하고 나는 전보를 다시 ì½ì—ˆë‹¤. +최ì„ì˜ ê·¸ 편지를 ë³´ë©´ ìµœì„ ë¶€ì¸ì—게는 ì–´ë–¤ ë°˜ì‘ì´ ì¼ì–´ë‚˜ê³  ì •ìž„ì—게는 ì–´ë–¤ ë°˜ì‘ì´ ì¼ì–´ë‚ ê¹Œ, 하고 ìƒê°í•˜ë©´ ìžëª» 마ìŒì´ 편하지 못하였다. +ì´íŠ¿ë‚  ì•„ì¹¨ì— ë‚˜ëŠ” 부산서 오는 차를 맞으려고 정거장ì—를 나갔다. +차는 ì œ ì‹œê°„ì— ë“¤ì–´ì™”ë‹¤. ë‚¨ì •ìž„ì€ ìŠˆíŠ¸ì¼€ì´ìŠ¤ 하나를 들고 ì°¨ì—ì„œ 내렸다. ê²€ì€ ì™¸íˆ¬ì— ê²€ì€ ëª¨ìžë¥¼ ì“´ ê·¸ì˜ ì–¼êµ´ì€ ë”ìš± 해쓱해 보였다. +"ì„ ìƒë‹˜!" +하고 ì •ìž„ì€ ë‚˜ë¥¼ ë³´ê³  ì†ì— ë“¤ì—ˆë˜ ì§ì„ ë•…ë°”ë‹¥ì— ë‚´ë ¤ë†“ê³ , ë‚´ 앞으로 왔다. +"í’ëž‘ì´ë‚˜ 없었나?" +하고 나는 ë‚´ ì†ì— 잡힌 ì •ìž„ì˜ ì†ì´ 싸늘한 ê²ƒì„ ê·¼ì‹¬í•˜ì˜€ë‹¤. +"네. 아주 잔잔했습니다. ì €ê°™ì´ ì•½í•œ ì‚¬ëžŒë„ ë°–ì— ë‚˜ì™€ì„œ 바다 경치를 구경하였습니다." +하고 ì •ìž„ì€ ì‚¬êµì ì¸ 웃ìŒì„ 웃었다. 그러나 ê·¸ì˜ ëˆˆì—는 ëˆˆë¬¼ì´ ìžˆëŠ” 것 같았다. +"최 ì„ ìƒë‹˜ ì–´ë”” 계신지 아세요?" +하고 ì •ìž„ì€ ë‚˜ë¥¼ ë”°ë¼ ì„œë©´ì„œ 물었다. +"ë‚˜ë„ ì§€ê¸ˆê¹Œì§€ 몰ëžëŠ”ë° ì–´ì œ 편지를 하나 받았지." +하는 ê²ƒì´ ë‚´ 대답ì´ì—ˆë‹¤. +"네? 편지 받으셨어요? ì–´ë”” 계십니까?" +하고 ì •ìž„ì€ ê±¸ìŒì„ 멈추었다. +"ë‚˜ë„ ëª°ë¼." +하고 ë‚˜ë„ ì •ìž„ê³¼ ê°™ì´ ê±¸ìŒì„ 멈추고, +"ê·¸ 편지를 ì“´ ê³³ë„ ì•Œê³  부친 ê³³ë„ ì•Œì§€ë§ˆëŠ” 지금 어디로 갔는지 ê·¸ê²ƒì€ ëª¨ë¥´ì§€. ì°¾ì„ ìƒê°ë„ ë§ê³  편지할 ìƒê°ë„ ë§ë¼ê³  했으니까." +하고 사실대로 대답하였다. +"어디야요? ê·¸ 편지 부치신 ê³³ì´ ì–´ë””ì•¼ìš”? ì € ì´ ì°¨ë¡œ ë”°ë¼ê°ˆ 테야요." +하고 ì •ìž„ì€ ì¡°ê¸‰í•˜ì˜€ë‹¤. +"ê°ˆ ë•Œì—는 ê°€ë”ë¼ë„ ì´ ì°¨ì—야 ê°ˆ 수가 있나." +하고 나는 겨우 ì •ìž„ì„ ëŒê³  들어왔다. +ì •ìž„ì„ ì§‘ìœ¼ë¡œ ë°ë¦¬ê³  와서 대강 ë§ì„ 하고, ì´íŠ¿ë‚  새벽 차로 떠난다는 것ì„, +"가만 있어. 어떻게 계íšì„ 세워 가지고 해야지." +하여 가까스로 붙들어 놓았다. +ì•„ì¹¨ì„ ë¨¹ê³  나서 ìµœì„ ì§‘ì—를 ê°€ 보려고 í•  즈ìŒì— 순임ì´ê°€ 와서 마루 ëì— ì„  채로, +"ì„ ìƒë‹˜, 어머니가 ìž ê¹ë§Œ 오십시사구요." +하였다. +"ì •ìž„ì´ê°€ 왔다." +하고 ë‚´ê°€ 그러니까, +"ì •ìž„ì´ê°€ìš”?" +하고 ìˆœìž„ì€ ê¹œì§ ë†€ë¼ë©´ì„œ, +"ì •ìž„ì´ëŠ” 아버지 계신 ë°ë¥¼ 알아요?" +하고 물었다. +"ì •ìž„ì´ë„ 모른단다. 너 아버지는 ì‹œë² ë¦¬ì•„ì— ê³„ì‹œê³  ì •ìž„ì´ëŠ” ë™ê²½ 있다가 ì™”ëŠ”ë° ì•Œ 리가 있니?" +하고 나는 ìˆœìž„ì˜ ìƒê°ì„ 깨뜨리려 하였다. 순임ì€, +"ì •ìž„ì´ê°€ ì–´ë”” 있어요?" +하고 방들 있는 ê³³ì„ ë‘˜ëŸ¬ë³´ë©°, +"언제 왔어요?" +하고는 그제야 ì •ìž„ì—게 대한 반가운 ì •ì´ ë°œí•˜ëŠ” 듯ì´, +"ì •ìž„ì•„!" +하고 불러 본다. +"언니요? 여기 있수." +하고 ì •ìž„ì´ê°€ 머릿방 ë¬¸ì„ ì—´ê³  ì˜·ì„ ê°ˆì•„ìž…ë˜ ì±„ë¡œ 고개를 내어민다. +ìˆœìž„ì€ êµ¬ë‘를 ì°¨ë‚´ë²„ë¦¬ë“¯ì´ ë²—ì–´ 놓고 ì •ìž„ì˜ ë°©ìœ¼ë¡œ 뛰어들어간다. +나는 최ì„ì˜ ì§‘ì—를 ê°€ëŠë¼ê³  외투를 ìž…ê³  모ìžë¥¼ ì“°ê³  ì •ìž„ì˜ ë°©ë¬¸ì„ ì—´ì–´ 보았다. ë‘ ì²˜ë…€ëŠ” 울고 있었다. +"ì •ìž„ì´ë„ 가지. 아주머니 뵈러 안 ê°€?" +하고 나는 ì •ìž„ì„ ìž¬ì´‰í•˜ì˜€ë‹¤. +"ì„ ìƒë‹˜ 먼저 ê°€ 계셔요." +하고 순임ì´ê°€ ëˆˆë¬¼ì„ ì”»ê³  ì¼ì–´ë‚˜ë©´ì„œ, +"ì´ë”°ê°€ 제가 ì •ìž„ì´í—ˆêµ¬ 갑니다." +하고 내게 ëˆˆì„ ë”ì©ê±°ë ¤ 보였다. ê°‘ìžê¸° ì •ìž„ì´ê°€ 가면 어머니와 ì •ìž„ì´ì™€ 사ì´ì— ì–´ë– í•œ íŒŒëž€ì´ ì¼ì–´ë‚˜ì§€ë‚˜ 아니할까 하고 순임ì´ê°€ 염려하는 것ì´ì—ˆë‹¤. ìˆœìž„ë„ ì¸ì œëŠ” 노성하여졌다고 나는 ìƒê°í•˜ì˜€ë‹¤. +"ì„ ìƒë‹˜ ì´ íŽ¸ì§€ê°€ 다 ì°¸ë§ì¼ê¹Œìš”?" +하고 나를 보는 길로 ìµœì„ ë¶€ì¸ì´ 물었다. ìµœì„ ë¶€ì¸ì€ 히스테리를 ì¼ìœ¼í‚¨ 사람 모양으로 머리와 ì†ì„ 떨었다. +나는 ì°¸ë§ì´ëƒ 하는 ê²ƒì´ ë¬´ì—‡ì„ ê°€ë¦¬í‚¤ëŠ” ë§ì¸ì§€ 분명하지 아니하여서, +"ë…¸ì„ì´ ê±°ì§“ë§í•  사람입니까?" +하고 대체론으로 대답하였다. +"앉으십쇼. 앉으시란 ë§ì”€ë„ 안 하고." +하고 부ì¸ì€ 침착한 ëª¨ì–‘ì„ ë³´ì´ë ¤ê³  빙그레 웃었으나, ê·¸ê²ƒì€ ì‹¤íŒ¨ì˜€ë‹¤. +"그게 ì°¸ë§ì¼ê¹Œìš”? ì •ìž„ì´ê°€ 아기를 ë—€ ê²ƒì´ ì•„ë‹ˆë¼, íê°€ 나빠서 피를 토하고 ìž…ì›í•˜ì˜€ë‹¤ëŠ” 것ì´?" +하고 부ì¸ì€ 중대하다는 í‘œì •ì„ ê°€ì§€ê³  묻는다. +"그럼 ê·¸ê²ƒì´ ì°¸ë§ì´ 아니구요. ì•„ì§ë„ 그런 ì˜ì‹¬ì„ 가지고 계십니까. ì •ìž„ì´ì™€ í•œ ë°©ì— ìžˆëŠ” í•™ìƒì´ 모함한 것ì´ë¼ê³  안 그랬어요? 그게 ë§ì´ ë©ë‹ˆê¹Œ." +하고 ì–¸ì„±ì„ ë†’ì—¬ì„œ 대답하였다. +"그럼 왜 ì •ìž„ì´ê°€ 호텔ì—ì„œ 왜 아버지한테 í•œ 번 안아 달ë¼ê³  그래요? ê·¸ íŽ¸ì§€ì— ì“´ 대로 í•œ 번 안아만 보았ì„까요?" +ì´ê²ƒì€ 부ì¸ì˜ 둘째 물ìŒì´ì—ˆë‹¤. +"나는 ê·¸ë¿ì´ë¼ê³  믿습니다. ê·¸ê²ƒì´ ë„리어 깨ë—하다는 í‘œë¼ê³  믿습니다. 안 그렇습니까?" +하고 나는 딱하다는 í‘œì •ì„ í•˜ì˜€ë‹¤. +"글쎄요." +하고 부ì¸ì€ 한참ì´ë‚˜ ìƒê°í•˜ê³  있다가, +"ì •ë§ ì•  아버지가 í˜¼ìž ë‹¬ì•„ë‚¬ì„까요? ì •ìž„ì´ë¥¼ ë°ë¦¬ê³  가케오치한 ê²ƒì´ ì•„ë‹ê¹Œìš”? ê¼­ ê·¸ëž¬ì„ ê²ƒë§Œ ê°™ì€ë°." +하고 부ì¸ì€ 괴로운 í‘œì •ì„ ê°ì¶”려는 ë“¯ì´ ê³ ê°œë¥¼ 숙ì¸ë‹¤. +나는 남편ì—게 대한 ì•„ë‚´ì˜ ì˜ì‹¬ì´ 어떻게 깊ì€ê°€ì— 아니 놀랄 수가 없어서, +"í—ˆ." +하고 í•œ 마디 웃고, +"그렇게 수십 ë…„ ë™ì•ˆ 부부 ìƒí™œì„ í•˜ì‹œê³ ë„ ê·¸ë ‡ê²Œ ë…¸ì„ì˜ ì¸ê²©ì„ ëª°ë¼ ì£¼ì‹­ë‹ˆê¹Œ. 나는 부ì¸ê»˜ì„œ 하시는 ë§ì”€ì´ 부러 하시는 ë†ë‹´ìœ¼ë¡œë°–ì— ì•„ë‹ˆ 들립니다. ì •ìž„ì´ê°€ 지금 서울 있습니다." +하고 ë˜ í•œ 번 웃었다. ì •ë§ ê¸°ë§‰ížŒ 웃ìŒì´ì—ˆë‹¤. +"ì •ìž„ì´ê°€ 서울 있어요?" +하고 부ì¸ì€ íŽ„ì© ë›°ë©´ì„œ, +"ì–´ë”” 있다가 언제 왔습니까? 그게 ì •ë§ìž…니까?" +하고 ì˜ì•„í•œ ë¹›ì„ ë³´ì¸ë‹¤. ê¼­ 최ì„ì´í•˜ê³  함께 ë‹¬ì•„ë‚¬ì„ ì •ìž„ì´ê°€ ì„œìš¸ì— ìžˆì„ ë¦¬ê°€ 없는 것ì´ì—ˆë‹¤. +"ë™ê²½ì„œ 오늘 ì•„ì¹¨ì— ì™”ìŠµë‹ˆë‹¤. 지금 우리 집ì—ì„œ 순임ì´í—ˆêµ¬ ì´ì•¼ê¸°ë¥¼ 하고 있으니까 조금 있으면 뵈오러 올 것입니다." +하고 나는 ì •ìž„ì´ê°€ 분명히 서울 있는 ê²ƒì„ ì¼ì¼ì´ ì¦ê±°ë¥¼ 들어서 ì¦ëª…하였다. 그리고 우스운 ê²ƒì„ ì†ìœ¼ë¡œ 참았다. 그러나 ë‹¤ìŒ ìˆœê°„ì—는 ì´ ë³‘ë“¤ê³  ëŠ™ì€ ì•„ë‚´ì˜ ì§ˆíˆ¬ì™€ ì˜ì‹¬ìœ¼ë¡œ 괴로워서 ëœëœëœëœ 떨고 앉았는 ê²ƒì„ ê°€ì—¾ê²Œ ìƒê°í•˜ì˜€ë‹¤. +ì •ìž„ì´ê°€ 지금 ì„œìš¸ì— ìžˆëŠ” ê²ƒì´ ë” ì˜ì‹¬í•  여지가 없는 ì‚¬ì‹¤ìž„ì´ íŒëª…ë˜ë§¤, 부ì¸ì€ ë„리어 ë‚™ë§í•˜ëŠ” 듯하였다. 그가 ì œ 마ìŒëŒ€ë¡œ 그려 놓고 믿고 í•˜ë˜ ëª¨ë“  ì² í•™ì˜ ê³„í†µì´ ë¬´ë„ˆì§„ 것ì´ì—ˆë‹¤. +한참ì´ë‚˜ í©ì–´ì§„ ì •ì‹ ì„ ëª» 수습하는 ë“¯ì´ ì•‰ì•„ 있ë”니 아주 기운 없는 ì–´ì¡°ë¡œ, +"ì„ ìƒë‹˜ ì•  아버지가 ì •ë§ ì£½ì„까요? ì •ë§ ì˜ì˜ 집ì—를 안 ëŒì•„올까요?" +하고 묻는다. ê·¸ 눈ì—는 ë²Œì¨ ëˆˆë¬¼ì´ ì–´ë¦¬ì—ˆë‹¤. +"글쎄요. ë‚´ ìƒê° 같아서는 다시는 ì§‘ì— ëŒì•„오지 아니할 것 같습니다. ë˜ ê·¸ë§Œì¹˜ ë§ì‹ ì„ 했으니, ì´ì œ 무슨 낯으로 ëŒì•„옵니까. ë‚´ë¼ë„ 다시 ì§‘ì— ëŒì•„올 ìƒê°ì€ 아니 내겠습니다." +하고 나는 ì˜ì‹ì ìœ¼ë¡œ ì•…ì˜ë¥¼ 가지고 부ì¸ì˜ ê°€ìŠ´ì— ì¹¼ì„ í•˜ë‚˜ 박았다. +ê·¸ ì¹¼ì€ ë¶„ëª…ížˆ 부ì¸ì˜ ê°€ìŠ´ì— ì•„í”„ê²Œ 박힌 모양ì´ì—ˆë‹¤. +"ì„ ìƒë‹˜. 어떡하면 좋습니까. ì•  아버지가 죽지 않게 í•´ 주세요. 그렇지 ì•Šì•„ë„ ìˆœìž„ì´ë…„ì´ ì œê°€ ê±” 아버지를 달아나게나 í•œ 것처럼 ì›ë§ì„ 하는ë°ìš”. 그러다가 ì •ë…• 죽으면 어떻게 합니까. ì œì¼ ë”´ ìžì‹ë“¤ì˜ ì›ë§ì„ 들ì„ê¹Œë´ ê²ì´ 납니다. ì„ ìƒë‹˜, 어떻게 ì•  아버지를 붙들어다 주세요." +하고 마침내 ì°¸ì„ ìˆ˜ ì—†ì´ ìš¸ì—ˆë‹¤. ë§ì€ ë¹„ë¡ ìžì‹ë“¤ì˜ ì›ë§ì´ ë‘렵다고 하지마는 ì§ˆíˆ¬ì˜ ê°ì •ì´ 스러질 ë•Œì— ê·¸ì—게는 남편ì—게 대한 ì•„ë‚´ì˜ ì• ì •ì´ ë§‰í˜”ë˜ ë¬¼ê³¼ ê°™ì´ í„°ì ¸ 나온 것ì´ë¼ê³  나는 í•´ì„하였다. +"글쎄, ì–´ë”” 있는 줄 알고 찾습니까. ë…¸ì„ì˜ ì„±ë¯¸ì— í•œë²ˆ 아니 한다고 했으면 다시 편지할 리는 만무하다고 믿습니다." +하여 나는 부ì¸ì˜ ê°€ìŠ´ì— ë‘˜ì§¸ ì¹¼ë‚ ì„ ë°•ì•˜ë‹¤. +나는 ë¹„ë¡ ìµœì„ì˜ ë¶€ì¸ì´ 청하지 아니하ë”ë¼ë„ 최ì„ì„ ì°¾ìœ¼ëŸ¬ 떠나지 아니하면 아니 ë  ì˜ë¬´ë¥¼ 진다. ì‚° 최ì„ì„ ëª» ì°¾ë”ë¼ë„ 최ì„ì˜ ì‹œì²´ë¼ë„, 무ë¤ì´ë¼ë„, ì£½ì€ ìžë¦¬ë¼ë„, 마지막 ìžˆë˜ ê³³ì´ë¼ë„ 찾아보지 아니하면 아니 ë  ì˜ë¬´ë¥¼ 깨닫는다. +그러나 ì‹œêµ­ì´ ë³€í•˜ì—¬ ê·¸ ë•Œì—는 ì•„ë¼ì‚¬ì— 가는 ê²ƒì€ ì—¬ê°„ 곤란한 ì¼ì´ 아니었다. ê·¸ ë•Œì—는 ë¶ë§Œì˜ í’ìš´ì´ ê¸‰ë°•í•˜ì—¬ 만주리를 통과하기는 ì‚¬ì‹¤ìƒ ë¶ˆê°€ëŠ¥ì— ê°€ê¹Œì› ë‹¤. 마ì ì‚°(馬å å±±) ì¼íŒŒì˜ 군대가 í¥ì•ˆë ¹, 하ì¼ë¼ë¥´ ë“±ì§€ì— ì›…ê±°í•˜ì—¬ 언제 대충ëŒì´ í­ë°œë ëŠ”지 ëª¨ë¥´ë˜ ë•Œì˜€ë‹¤. ì´ ë•Œë¬¸ì— ì‹œë² ë¦¬ì•„ì— ë“¤ì–´ê°€ê¸°ëŠ” ê±°ì˜ ì ˆë§ ìƒíƒœë¼ê³  하겠고, ë˜ ê´€í—Œë„ ì•„ë¼ì‚¬ì— 들어가는 ì—¬í–‰ê¶Œì„ ìž˜ êµë¶€í•  것 같지 아니하였다. +부ì¸ì€ 울고, 나는 ì´ëŸ° ìƒê° 저런 ìƒê° 하고 있는 ë™ì•ˆì— 문 ë°–ì—는 순임ì´, ì •ìž„ì´ê°€ 들어오는 소리가 들렸다. +"ì•„ì´, ì •ìž„ì´ëƒ." +하고 부ì¸ì€ 반갑게 허리 굽혀 ì¸ì‚¬í•˜ëŠ” ì •ìž„ì˜ ì–´ê¹¨ì— ì†ì„ 대고, +"ìž ì•‰ì•„ë¼. 그래 ì¸ì œ ë³‘ì´ ì¢€ 나으ëƒâ€¦â€¦ 수척했구나. ë” ë…¸ì„±í•´ì§€êµ¬ ë°˜ ë…„ë„ ëª» ë˜ì—ˆëŠ”ë°." +하고 ì •ìž„ì—게 대하여 ì• ì •ì„ í‘œí•˜ëŠ” ê²ƒì„ ë³´ê³  나는 ì˜ì™¸ì§€ë§ˆëŠ” 다행으로 ìƒê°í•˜ì˜€ë‹¤. 나는 ì •ìž„ì´ê°€ 오면 보기 ì‹«ì€ í•œ ì‹ ì„ ì—°ì¶œí•˜ì§€ 않나 하고 ê·¼ì‹¬í•˜ì˜€ë˜ ê²ƒì´ë‹¤. +"í¬ ìž˜ ìžë¼ìš”?" +하고 ì •ìž„ì€ í•œì°¸ì´ë‚˜ 있다가 비로소 ìž…ì„ ì—´ì—ˆë‹¤. +"ì‘, 잘 있단다. 컸나 ê°€ ë³´ì•„ë¼." +하고 부ì¸ì€ ë”ìš± 반가운 í‘œì •ì„ ë³´ì¸ë‹¤. +"ì–´ëŠ ë°©ì´ì•¼?" +하고 ì •ìž„ì€ ì„ ë¬¼ ë³´í‰ì´ë¥¼ 들고 순임과 함께 나가 버린다. ì—¬ìžì¸ ì •ìž„ì€ í¬ì™€ 순임과 부ì¸ê³¼ ë˜ ìˆœìž„ì˜ ë‹¤ë¥¸ ë™ìƒì—게 선물 사 오는 ê²ƒì„ ìžŠì–´ë²„ë¦¬ì§€ 아니하였다. +ì •ìž„ê³¼ ìˆœìž„ì€ í•œ ì´ì‚¼ 분 있다가 ëŒì•„왔다. ë°–ì—ì„œ í¬ê°€ 무엇ì´ë¼ê³  지절대는 소리가 들린다. 아마 ì •ìž„ì´ê°€ 사다 준 ì„ ë¬¼ì„ ë°›ê³  좋아하는 모양ì´ë‹¤. +ì •ìž„ì€ ë“¤ê³  온 ë³´í‰ì´ì—ì„œ ì—¬ìžìš© 배스로브 하나를 ë‚´ì–´ì„œ 부ì¸ì—게주며, +"맞으실까?" +하였다. +"ì•„ì´ ê·¸ê±´ 무어ë¼ê³  사 왔니?" +하고 부ì¸ì€ 좋아ë¼ê³  ìž…ì–´ ë³´ê³ , ì´ë¦¬ ë³´ê³  저리 ë³´ê³  하면서, +"ë‚œ ì´ëŸ° ê±° ì²˜ìŒ ìž…ì–´ 본다." +하고 ìžê¾¸ ëˆì„ ë™ì—¬ë§¨ë‹¤. +"ì •ìž„ì´ê°€ ë‚œ 파ìžë§ˆë¥¼ 사다 주었어." +하고 ìˆœìž„ì€ ë”°ë¡œ ìŒŒë˜ êµµì€ ì¤„ 있는 융 파ìžë§ˆë¥¼ ë‚´ì–´ì„œ 경매장 사람 모양으로 í”들어 ë³´ì´ë©°, +"어머니 ê·¸ 배스로브 나 주우. 어머닌 늙ì€ì´ê°€ 그건 ìž…ì–´ì„œ 무엇 하우?" +하고 부ì¸ì´ ìž…ì€ ë°°ìŠ¤ë¡œë¸Œë¥¼ 벗겨서 제가 ìž…ê³  ë‘ í˜¸ì£¼ë¨¸ë‹ˆì— ì†ì„ 넣고 어기죽어기죽하고 서양 부ì¸ë„¤ í‰ë‚´ë¥¼ 낸다. +"저런 ë§ê´„량ì´ê°€ ë„ˆë„ ì •ìž„ì´ì²˜ëŸ¼ 좀 얌전해 ë³´ì•„ë¼." +하고 부ì¸ì€ ìˆœìž„ì„ í–¥í•˜ì—¬ ëˆˆì„ í˜ê¸´ë‹¤. +ì´ ëª¨ì–‘ìœ¼ë¡œ 부ì¸ê³¼ ì •ìž„ê³¼ì˜ ëŒ€ë©´ì€ ê°€ìž¥ ì›ë§Œí•˜ê²Œ ë˜ì—ˆë‹¤. +그러나 부ì¸ì€ ì •ìž„ì—게 최ì„ì˜ íŽ¸ì§€ë¥¼ ë³´ì´ê¸°ë¥¼ ì›ì¹˜ 아니하였다. 편지가 왔다는 ë§ì¡°ì°¨ ìž… ë°–ì— ë‚´ì§€ 아니하였다. 그러나 순임ì´ê°€ ì •ìž„ì—게 대하여 표하는 ì• ì •ì€ ì—¬ê°„ 깊지 아니하였다. ê·¸ ë‘˜ì€ í•˜ë£¨ ì¢…ì¼ ê°™ì´ ìžˆì—ˆë‹¤. ì •ìž„ì€ ê·¸ ë‚  ì €ë…ì— ë‚˜ë¥¼ ë³´ê³ , +"순임ì´í—Œí…Œ 최 ì„ ìƒë‹˜ 편지 ì‚¬ì—°ì€ ë‹¤ 들었어요. 순임ì´ê°€ ê·¸ 편지를 í›”ì³ë‹¤ê°€ 얼른얼른 몇 êµ°ë° ì½ì–´ë„ 보았습니다. 순임ì´ê°€ 저를 í½ ë™ì •í•˜ë©´ì„œ ì ˆë”러 최 ì„ ìƒì„ ë”°ë¼ê°€ ë³´ë¼ê³  그래요. í˜¼ìž ê°€ê¸°ê°€ 어려우면 ìžê¸°í—ˆêµ¬ ê°™ì´ ê°€ìžê³ . 가서 최 ì„ ìƒì„ ë°ë¦¬ê³  오ìžê³ . 어머니가 못 가게 하거든 몰래 ë‘˜ì´ ë„ë§í•´ ê°€ìžê³ . 그래서 그러ìžê³  그랬습니다. 안ë지요. ì„ ìƒë‹˜?" +하고 ì €í¬ë¼ë¦¬ ìž‘ì •ì€ ë‹¤ í•´ 놓고는 ìŠ¬ì© ë‚´ ì˜í–¥ì„ 물었다. +"ì Šì€ ì—¬ìž ë‹¨ë‘˜ì´ì„œ 먼 ì—¬í–‰ì„ ì–´ë–»ê²Œ 한단 ë§ì´ëƒ? 게다가 지금 ë¶ë§Œì£¼ 형세가 대단히 위급한 모양ì¸ë°. ë˜ ì •ìž„ì´ëŠ” ê·¸ ê±´ê°• 가지고 어디를 ê°€, ì´ ì¶”ìš´ 겨울ì—?" +하고 나는 ì´ëŸ° ë§ì´ 다 쓸ë°ì—†ëŠ” ë§ì¸ 줄 ì•Œë©´ì„œë„ ì–´ë¥¸ìœ¼ë¡œì„œ í•œ 마디 안 í•  수 없어서 하였다. ì •ìž„ì€ ë” ì œ ëœ»ì„ ì£¼ìž¥í•˜ì§€ë„ ì•„ë‹ˆí•˜ì˜€ë‹¤. +ê·¸ ë‚  ì €ë…ì— ì •ìž„ì€ ìˆœìž„ì˜ ì§‘ì—ì„œ 잤는지 ì§‘ì— ì˜¤ì§€ë¥¼ 아니하였다. +나는 ì´ ì¼ì„ 어찌하면 좋ì€ê°€, ì´ ë‘ ì—¬ìžì˜ í–‰ë™ì„ 어찌하면 좋ì€ê°€ 하고 í˜¼ìž ë™ë™ ìƒê°í•˜ê³  있었다. +ì´íŠ¿ë‚  나는 ê¶ê¸ˆí•´ì„œ 최ì„ì˜ ì§‘ì—를 ê°”ë”니 부ì¸ì´, +"우리 ìˆœìž„ì´ ëŒì— 갔어요?" +하고 ì˜ì™¸ì˜ ì§ˆë¬¸ì„ í•˜ì˜€ë‹¤. +"아니오." +하고 나는 놀ëžë‹¤. +"그럼, ì´ê²ƒë“¤ì´ 어딜 갔어요? ë‚œ ì •ìž„ì´í—ˆêµ¬ ëŒì—ì„œ ìž” 줄만 알았는ë°." +하고 부ì¸ì€ 무슨 불길한 것ì´ë‚˜ 본 ë“¯ì´ ëª¸ì„ ë–¤ë‹¤. 히스테리가 ì¼ì–´ë‚œ 것ì´ì—ˆë‹¤. +나는 ìž…ë§›ì„ ë‹¤ì‹œì—ˆë‹¤. 분명히 ì´ ë‘ ì—¬ìžê°€ 시베리아를 향하고 떠났구나 하였다. +ê·¸ ë‚ ì€ ì†Œì‹ì´ ì—†ì´ ì§€ë‚¬ë‹¤. ê·¸ ì´íŠ¿ë‚ ë„ 소ì‹ì´ ì—†ì´ ì§€ë‚¬ë‹¤. +ìµœì„ ë¶€ì¸ì€ 딸까지 잃어버리고 미친 ë“¯ì´ ìš¸ê³  애통하다가 머리를 싸매고 누워 버리고 ë§ì•˜ë‹¤. +ì •ìž„ì´ì™€ 순임ì´ê°€ 없어진 지 ì‚¬í˜ ë§Œì— ì•„ì¹¨ ìš°íŽ¸ì— íŽ¸ì§€ í•œ ìž¥ì„ ë°›ì•˜ë‹¤. ê·¸ 봉투는 봉천 ì•¼ë§ˆë„ í˜¸í…” 것ì´ì—ˆë‹¤. ê·¸ ì†ì—는 편지 ë‘ ìž¥ì´ ë“¤ì–´ 있었다. í•œ ìž¥ì€ , +ì„ ìƒë‹˜! 저는 아버지를 위하여, ì •ìž„ì„ ìœ„í•˜ì—¬ ì •ìž„ê³¼ ê°™ì´ ì§‘ì„ ë– ë‚¬ìŠµë‹ˆë‹¤. +어머님께서 슬í¼í•˜ì‹¤ ì¤„ì€ ì•Œì§€ë§ˆëŠ” ì €í¬ë“¤ì´ 다행히 아버지를 찾아서 모시고 오면 ì–´ë¨¸ë‹ˆê»˜ì„œë„ ê¸°ë»í•˜ì‹¤ ê²ƒì„ ë¯¿ìŠµë‹ˆë‹¤. ì €í¬ë“¤ì´ 가지 아니하고는 아버지는 ì‚´ì•„ì„œ ëŒì•„오실 것 같지 아니합니다. 아버지를 ì´ì²˜ëŸ¼ 불행하시게 í•œ 죄는 ì ˆë°˜ì€ ì–´ë¨¸ë‹ˆê»˜ 있고, ì ˆë°˜ì€ ì œê²Œ 있습니다. 저는 아버지 ì¼ì„ ìƒê°í•˜ë©´ ê°€ìŠ´ì´ ë¯¸ì–´ì§€ê³  ì´ê°€ 갈립니다. 저는 아무리 í•´ì„œë¼ë„ 아버지를 찾아내어야겠습니다. +저는 ì •ìž„ì„ ë¬´í•œížˆ ë™ì •í•©ë‹ˆë‹¤. 저는 어려서 ì •ìž„ì„ ë¯¸ì›Œí•˜ê³  아버지를 미워하였지마는 ì§€ê¸ˆì€ ì•„ë²„ì§€ì˜ ë§ˆìŒê³¼ ì •ìž„ì˜ ë§ˆìŒì„ 알아볼 만치 ìžëžìŠµë‹ˆë‹¤. +ì„ ìƒë‹˜! ì €í¬ë“¤ì€ ë‘˜ì´ ì†ì„ ìž¡ê³  어디를 가서든지 아버지를 찾아내겠습니다. í•˜ë‚˜ë‹˜ì˜ ì‚¬ìžê°€ ë‚®ì—는 êµ¬ë¦„ì´ ë˜ê³  ë°¤ì—는 ë³„ì´ ë˜ì–´ì„œ 반드시 ì €í¬ë“¤ì˜ ì•žê¸¸ì„ ì¸ë„í•  줄 믿습니다. +ì„ ìƒë‹˜, ì €í¬ ì–´ë¦°ê²ƒë“¤ì˜ ëœ»ì„ ë¶ˆìŒížˆ 여기셔서 ëˆ ì²œ ì›ë§Œ ì „ë³´ë¡œ ë³´ë‚´ 주시기를 ë°”ëžë‹ˆë‹¤. +ë§Œì¼ ë§Œì£¼ë¦¬ë¡œ 가는 ê¸¸ì´ ëŠì–´ì§€ë©´ 몽고로 ìžë™ì°¨ë¡œë¼ë„ 가려고 합니다. 아버지 íŽ¸ì§€ì— ì ížŒ Fì—­ì˜ R씨를 찾고, 그리고 ë°”ì´ì¹¼ í˜¸ë°˜ì˜ ë°”ì´ì¹¼ë¦¬ìŠ¤ì½”ì—를 찾아, ì´ ëª¨ì–‘ìœ¼ë¡œ 찾으면 반드시 아버지를 찾아 내고야 ë§ ê²ƒì„ ë¯¿ìŠµë‹ˆë‹¤. +ì„ ìƒë‹˜, ëˆ ì²œ ì›ë§Œ 봉천 ì•¼ë§ˆë„ í˜¸í…” 최순임 ì´ë¦„으로 ë¶€ì³ ì£¼ì„¸ìš”. 그리고 어머니헌테는 ì•„ì§ ë§ì”€ ë§ì•„ 주세요. +ì„ ìƒë‹˜. ì´ë ‡ê²Œ 걱정하시게 í•´ì„œ 미안합니다. 용서하세요. +순임 ìƒì„œ +ì´ë ‡ê²Œ ì¨ ìžˆë‹¤. ë˜ í•œ 장ì—는, +ì„ ìƒë‹˜! 저는 마침내 ëŒì•„오지 못할 ê¸¸ì„ ë– ë‚˜ë‚˜ì´ë‹¤. 어디든지 최 ì„ ìƒë‹˜ì„ 뵈옵는 ê³³ì—ì„œ ì´ ëª¸ì„ ë¬»ì–´ 버리려 하나ì´ë‹¤. 지금 ë˜ ëª¸ì— ì—´ì´ ë‚˜ëŠ” 모양ì´ìš”, í˜ˆë‹´ë„ ë³´ì´ì˜¤ë‚˜ 최 ì„ ìƒì„ 뵈올 때까지는 아무리 하여서ë¼ë„ ì´ ëª©ìˆ¨ì„ ë¶€ì§€í•˜ë ¤ 하오며, 최 ì„ ìƒì„ 뵈옵고 제가 진 ì€í˜œë¥¼ ê°ì‚¬í•˜ëŠ” í•œ ë§ì”€ë§Œ 사뢰면 고대 ì£½ì‚¬ì™€ë„ ì—¬í•œì´ ì—†ì„까 하나ì´ë‹¤. +순임 언니가 제게 주시는 사랑과 ë™ì •ì€ ì˜¤ì§ ëˆˆë¬¼ê³¼ ê°ê²©ë°–ì— ë” í‘œí•  ë§ì”€ì´ 없나ì´ë‹¤. 순임 언니가 저를 보호하여 주니 마ìŒì´ 든든하여ì´ë‹¤â€¦â€¦. +ì´ë¼ê³  하였다. +편지를 보아야 별로 놀랄 ê²ƒì€ ì—†ì—ˆë‹¤. 다만 ë§ê´„량ì´ë¡œë§Œ ì•Œì•˜ë˜ ìˆœìž„ì˜ ì†ì— ì–´ëŠìƒˆì— 그러한 ê°ì •ì´ 발달하였나 하는 ê²ƒì„ ë†€ëž„ ë¿ì´ì—ˆë‹¤. +그러나 ê±±ì •ì€ ì´ê²ƒì´ë‹¤. 순임ì´ë‚˜ ì •ìž„ì´ë‚˜ 다 ë‚´ê°€ ê°ë…해야 í•  ì²˜ì§€ì— ìžˆê±°ëŠ˜ ê·¸ë“¤ì´ ë§Œë¦¬ 긴 ì—¬í–‰ì„ ë– ë‚œë‹¤ê³  하니 ê°ë…ìžì¸ ë‚´ 태ë„를 어떻게 할까 하는 것ì´ë‹¤. +나는 편지를 받는 길로 ìš°ì„  ëˆ ì²œ ì›ì„ ì€í–‰ì— 가서 찾아다 놓았다. +ì•”ë§Œí•´ë„ ë‚´ê°€ ì„œìš¸ì— ê°€ë§Œížˆ 앉아서 ë‘ ì•„ì´ì—게 ëˆë§Œ ë¶€ì³ ì£¼ëŠ” ê²ƒì´ ì¸ì •ì— 어그러지는 것 같아서 나는 여러 가지로 ì£¼ì„ ì„ í•˜ì—¬ì„œ ì—¬í–‰ì˜ ì–‘í•´ë¥¼ 얻어 가지고 ë´‰ì²œì„ í–¥í•˜ì—¬ 떠났다. +ë‚´ê°€ ë´‰ì²œì— ë„ì°©í•œ ê²ƒì€ ë°¤ 열시가 지나서였다. 순임과 ì •ìž„ì€ ìžë¦¬ì˜· 바람으로 ë‚´ 방으로 달려와서 반가워하였다. ê·¸ë“¤ì´ ë°˜ê°€ì›Œí•˜ëŠ” ì–‘ì€ ì‹¤ë¡œ ëˆˆë¬¼ì´ í를 만하였다. +"ì•„ì´êµ¬ ì„ ìƒë‹˜!" +"ì•„ì´êµ¬ 어쩌면!" +하는 ê²ƒì´ ê·¸ë“¤ì˜ ë‚´ê²Œ 대한 ì¸ì‚¬ì˜ 전부였다. +"ì •ìž„ì´ ì–´ë– ì˜¤?" +하고 나는 ìˆœìž„ì˜ íŽ¸ì§€ì— ì •ìž„ì´ê°€ ì—´ì´ ìžˆë‹¨ ë§ì„ ìƒê°í•˜ì˜€ë‹¤. +"무어요. 괜찮습니다." +하고 ì •ìž„ì€ ì›ƒì—ˆë‹¤. +ì „ë“±ë¹›ì— ë³´ì´ëŠ” ì •ìž„ì˜ ì–¼êµ´ì€ ê·¸ì•¼ë§ë¡œ 대리ì„으로 ê¹Žì€ ë“¯í•˜ì˜€ë‹¤. 여위고 í•ê¸°ê°€ 없는 ê²ƒì´ ë”ìš± ì •ìž„ì˜ ìš©ëª¨ì— ì—„ìˆ™í•œ ë§›ì„ ì£¼ì—ˆë‹¤. +"ëˆ ê°€ì ¸ì˜¤ì…¨ì–´ìš”?" +하고 순임ì´ê°€ 어리광 절반으로 묻다가 ë‚´ê°€ 웃고 ëŒ€ë‹µì´ ì—†ìŒì„ ë³´ê³ , +"우리를 붙들러 오셨어요?" +하고 성내는 ì–‘ì„ ë³´ì¸ë‹¤. +"그래 둘ì´ì„œë“¤ 간다니 어떻게 간단 ë§ì¸ê°€. 시베리아가 ì–´ë–¤ ê³³ì— ë¶™ì—ˆëŠ”ì§€ ì•Œì§€ë„ ëª»í•˜ë©´ì„œ." +하고 나는 ë‘ ì‚¬ëžŒì´ ê·¸ë¦¬ 슬í¼í•˜ì§€ 아니하는 ìˆœê°„ì„ ë³´ëŠ” ê²ƒì´ ë‹¤í–‰í•˜ì—¬ì„œ ë†ë‹´ì‚¼ì•„ 물었다. +"왜 몰ë¼ìš”? 시베리아가 저기 아니야요?" +하고 순임ì´ê°€ ì‚°í•´ê´€ ìª½ì„ ê°€ë¦¬í‚¤ë©°, +"ìš°ë¦¬ë„ ì§€ë¦¬ì—ì„œ 배워서 다 알아요. 어저께 하루 ì¢…ì¼ ì§€ë„를 사다 놓고 연구를 하였답니다. 봉천서 ì‹ ê²½, 신경서 하얼빈, 하얼빈ì—ì„œ 만주리, 만주리ì—ì„œ ì´ë¥´ì¿ ì¸ í¬, 보세요, 잘 알지 않습니까. ë˜ ë§Œì¼ ì¤‘ë™ ì² ë„ê°€ 불통ì´ë©´ 어떻게 가는고 하니 여기서 ì‚°í•´ê´€ì„ ê°€ê³ , 산해관서 ë¶ê²½ì„ 가지요. 그리고는 ë¶ê²½ì„œ 장가구를 가지 않습니까. 장가구서 ìžë™ì°¨ë¥¼ 타고 몽고를 통과해서 가거든요. 잘 알지 않습니까." +하고 ì •ìž„ì˜ í—ˆë¦¬ë¥¼ 안으며, +"그렇지ì´?" +하고 ìžì‹  있는 ë“¯ì´ ì›ƒëŠ”ë‹¤. +"ë˜ ëª½ê³ ë¡œë„ ëª» 가게 ë˜ì–´ì„œ 구ë¼íŒŒë¥¼ ëŒê²Œ ë˜ë©´?" +하고 나는 êµì‚¬ê°€ ìƒë„ì—게 묻는 모양으로 물었다. +"네, ì € ì¸ë„양으로 í•´ì„œ 지중해로 í•´ì„œ 프랑스로 í•´ì„œ 그렇게 가지요." +"í—ˆ, 잘 아는구나." +하고 나는 웃었다. +"그렇게만 알아요? ë˜ í•´ì‚¼ìœ„ë¡œ í•´ì„œ 가는 ê¸¸ë„ ì•Œì•„ìš”. ì €í¬ë¥¼ 어린애로 아시네." +"잘못했소." +"하하." +"후후." +사실 ê·¸ë“¤ì€ ë²Œì¨ ì–´ë¦°ì• ë“¤ì€ ì•„ë‹ˆì—ˆë‹¤. ìˆœìž„ë„ ë²Œì¨ ê·¸ ì•„ë²„ì§€ì˜ ë§í•  수 없는 ì‚¬ì •ì— ë™ì •í•  나ì´ê°€ ë˜ì—ˆë‹¤. 순임ì´ê°€ 기어다닌 ê²ƒì€ ë³¸ 나로는 ì´ê²ƒë„ ì´ìƒí•˜ê²Œ 보였다. 나는 ë²Œì¨ ë‚˜ì´ ë§Žì•˜êµ¬ë‚˜ 하는 ìƒê°ì´ 나지 아니할 수 없었다. +나는 ìž  안 드는 í•˜ë£»ë°¤ì„ ì§€ë‚´ë©´ì„œ 옆방ì—ì„œ ì •ìž„ì´ê°€ ê¸°ì¹¨ì„ ì§“ëŠ” 소리를 들었다. ê·¸ 소리는 ë‚´ ê°€ìŠ´ì„ ì•„í”„ê²Œ 하였다. +ì´íŠ¿ë‚  나는 ë‘ ì‚¬ëžŒì—게 ëˆ ì²œ ì›ì„ 주어서 ì‹ ê²½ 가는 급행차를 태워 주었다. ëŒ€ë¥™ì˜ ì´ ê±´ì¡°í•˜ê³  추운 ê¸°í›„ì— ì •ìž„ì˜ ë³‘ë“  íê°€ 견디어 날까 하고 마ìŒì´ 놓ì´ì§€ 아니하였다. 그러나 나는 ê·¸ë“¤ì„ ê°€ë¼ê³  권할 수는 ìžˆì–´ë„ ê°€ì§€ ë§ë¼ê³  붙들 수는 없었다. 다만 ì œ 아버지, ì œ ì• ì¸ì„ 죽기 ì „ì— ë§Œë‚  수 있기만 빌 ë¿ì´ì—ˆë‹¤. +나는 ë‘ ì•„ì´ë¥¼ ë¶ìª½ìœ¼ë¡œ 떠나 ë³´ë‚´ê³  í˜¼ìž ì—¬ê´€ì— ë“¤ì–´ì™€ì„œ ë„무지 ì •ì‹ ì„ ì§„ì •í•˜ì§€ 못하여 ìˆ ì„ ë¨¹ê³  잊으려 하였다. 그러다가 ê·¸ ë‚  밤차로 서울로 ëŒì•„왔다. +ì´íŠ¿ë‚  ì•„ì¹¨ì— ë‚˜ëŠ” ìµœì„ ë¶€ì¸ì„ 찾아서 순임과 ì •ìž„ì´ê°€ 시베리아로 갔단 ë§ì„ 전하였다. +ê·¸ ë•Œì— ìµœ 부ì¸ì€ ê±°ì˜ ì•„ë¬´ ì •ì‹ ì´ ì—†ëŠ” 듯하였다. 아무 ë§ë„ 하지 아니하고 울고만 있었다. +얼마 있다가 부ì¸ì€, +"ê·¸ê²ƒë“¤ì´ ì €í¬ë“¤ë¼ë¦¬ 가서 괜찮ì„까요?" +하는 í•œ 마디를 í•  ë¿ì´ì—ˆë‹¤. +ë©°ì¹  í›„ì— ìˆœìž„ì—게서 편지가 왔다. ê·¸ê²ƒì€ í•˜ì–¼ë¹ˆì—ì„œ 부친 것ì´ì—ˆë‹¤. +í•˜ì–¼ë¹ˆì„ ì˜¤ëŠ˜ 떠납니다. í•˜ì–¼ë¹ˆì— ì™€ì„œ 아버지 친구 ë˜ì‹œëŠ” Rì†Œìž¥ì„ ë§Œë‚˜ëµˆì˜µê³  아버지 ì¼ì„ 물어 보았습니다. 그리고 ì €í¬ ë‘˜ì´ì„œ 찾아 떠났다는 ë§ì”€ì„ 하였ë”니 Rì†Œìž¥ì´ ëŒ€ë‹¨ížˆ ë™ì •í•˜ì—¬ì„œ ì—¬í–‰ê¶Œë„ ì¤€ë¹„í•´ 주시기로 ì €í¬ëŠ” 아버지를 찾아서 오늘 오후 모스í¬ë°” 가는 급행으로 떠납니다. 가다가 Fì—­ì— ë‚´ë¦¬ê¸°ëŠ” 어려울 듯합니다. ì •ìž„ì˜ ê±´ê°•ì´ ëŒ€ë‹¨ížˆ 좋지 못합니다. ì¼ê¸°ê°€ ê°‘ìžê¸° 추워지는 관계ì¸ì§€ ì •ìž„ì˜ ì‹ ì—´ì´ ì˜¤í›„ë©´ 삼십팔 ë„를 넘고 ê¸°ì¹¨ë„ ëŒ€ë‹¨í•©ë‹ˆë‹¤. 저는 염려가 ë˜ì–´ì„œ ì •ìž„ë”러 하얼빈ì—ì„œ ìž…ì›í•˜ì—¬ 조리를 하ë¼ê³  권하였지마는 ë„무지 듣지를 아니합니다. 어디까지든지 가는 대로 가다가 ë” ëª» 가게 ë˜ë©´ ê·¸ ê³³ì—ì„œ 죽는다고 합니다. +저는 ê·¸ ë™ì•ˆ ë©°ì¹  ì •ìž„ê³¼ ê°™ì´ ìžˆëŠ” ì¤‘ì— ì •ìž„ì´ê°€ 어떻게 아름답고 높고 굳세게 깨ë—í•œ ì—¬ìžì¸ ê²ƒì„ ë°œê²¬í•˜ì˜€ìŠµë‹ˆë‹¤. 저는 지금까지 ì •ìž„ì„ ëª°ë¼ë³¸ ê²ƒì„ ë¶€ë„럽게 ìƒê°í•©ë‹ˆë‹¤. 그리고 ë˜ ì œ 아버지께서 어떻게 갸륵한 어른ì´ì‹  ê²ƒì„ ì¸ì œì•¼ 깨달았습니다. ìžì‹ ëœ ì €ê¹Œì§€ë„ ì•„ë²„ì§€ì™€ ì •ìž„ê³¼ì˜ ê´€ê³„ë¥¼ ì˜ì‹¬í•˜ì˜€ìŠµë‹ˆë‹¤. ì˜ì‹¬í•˜ëŠ” 것보다는 세ìƒì—ì„œ ë§í•˜ëŠ” 대로 믿고 있었습니다. 그러나 ì •ìž„ì„ ë§Œë‚˜ ë³´ê³  ì •ìž„ì˜ ë§ì„ 듣고 아버지께서 ì„ ìƒë‹˜ê»˜ 드린 편지가 ëª¨ë‘ ì°¸ì¸ ê²ƒì„ ê¹¨ë‹¬ì•˜ìŠµë‹ˆë‹¤. 아버지께서는 ì¹œêµ¬ì˜ ì˜ì§€ 없는 ë”¸ì¸ ì •ìž„ì„ ë‹¹ì‹ ì˜ ì¹œí˜ˆìœ¡ì¸ ì €ì™€ ê¼­ ê°™ì´ ì‚¬ëž‘í•˜ë ¤ê³  하신 것ì´ì—ˆìŠµë‹ˆë‹¤. ê·¸ê²ƒì´ ì–¼ë§ˆë‚˜ 갸륵한 ì¼ìž…니까. ê·¸ëŸ°ë° ì œ 어머니와 저는 ê·¸ 갸륵하신 ì •ì‹ ì„ ëª°ë¼ë³´ê³  오해하였습니다. 어머니는 질투하시고 저는 시기하였습니다. ì´ê²ƒì´ 얼마나 아버지를 그렇게 갸륵하신 아버지를 몰ë¼ëµˆì˜¨ 것입니다. ì´ê²ƒì´ 얼마나 부ë„럽고 ì›í†µí•œ ì¼ìž…니까. +ì„ ìƒë‹˜ê»˜ì„œë„ 여러 번 ì•„ë²„ì§€ì˜ ì¸ê²©ì´ 높다는 ê²ƒì„ ì €í¬ ëª¨ë…€ì—게 설명해 주셨습니다마는 마ìŒì´ 막힌 저는 ì„ ìƒë‹˜ì˜ ë§ì”€ë„ 믿지 아니하였습니다. +ì„ ìƒë‹˜, ì •ìž„ì€ ì°¸ìœ¼ë¡œ 아버지를 사랑합니다. ì •ìž„ì—게는 ì´ ì„¸ìƒì— 아버지밖ì—는 사랑하는 ì•„ë¬´ê²ƒë„ ì—†ì´, 그렇게 외â—으로, 그렇게 열렬하게 아버지를 사모하고 사랑합니다. 저는 잘 압니다. ì •ìž„ì´ê°€ 처ìŒì—는 아버지로 ì‚¬ëž‘í•˜ì˜€ë˜ ê²ƒì„, 그러나 ì–´ëŠ ìƒˆì— ì •ìž„ì˜ ì•„ë²„ì§€ì—게 대한 ì‚¬ëž‘ì´ ë¬´ì—‡ì¸ì§€ 모를 사랑으로 변한 것ì„, ê·¸ê²ƒì´ ì—°ì• ëƒ í•˜ê³  물으면 ì •ìž„ì€ ì•„ë‹ˆë¼ê³  í•  것입니다. ì •ìž„ì˜ ê·¸ ëŒ€ë‹µì€ ê²°ì½” ê±°ì§“ì´ ì•„ë‹™ë‹ˆë‹¤. ì •ìž„ì€ ìˆ™ì„±í•˜ì§€ë§ˆëŠ” ì•„ì§ë„ 극히 순결합니다. ì •ìž„ì€ ë¶€ëª¨ë¥¼ ìžƒì€ í›„ì— ì•„ë²„ì§€ë°–ì— ì‚¬ëž‘í•œ ì‚¬ëžŒì´ ì—†ìŠµë‹ˆë‹¤. ë˜ ì•„ë²„ì§€ì—ê²Œë°–ì— ì‚¬ëž‘ë°›ë˜ ì¼ë„ 없습니다. ê·¸ëŸ¬ë‹ˆê¹ ì •ìž„ì€ ì•„ë²„ì§€ë¥¼ 그저 사랑합니다 ì „ì ìœ¼ë¡œ 사랑합니다. ì„ ìƒë‹˜, ì •ìž„ì˜ ì‚¬ëž‘ì—는 ì•„ë²„ì§€ì— ëŒ€í•œ ìžì‹ì˜ 사랑, 오ë¼ë¹„ì— ëŒ€í•œ 누ì´ì˜ 사랑, 사내 ì¹œêµ¬ì— ëŒ€í•œ ì—¬ìž ì¹œêµ¬ì˜ ì‚¬ëž‘, ì• ì¸ì— 대한 ì• ì¸ì˜ 사랑, ì´ ë°–ì— ì¡´ê²½í•˜ê³  숭배하는 ì„ ìƒì— 대한 ì œìžì˜ 사랑까지, ì‚¬ëž‘ì˜ ëª¨ë“  종류가 í¬í•¨ë˜ì–´ 있는 ê²ƒì„ ì €ëŠ” 발견하였습니다. +ì„ ìƒë‹˜, ì •ìž„ì˜ ì •ìƒì€ 차마 ë³¼ 수가 없습니다. ì•„ë²„ì§€ì˜ ì•ˆë¶€ë¥¼ 근심하는 ì–‘ì€ ì œ 몇십 배나 ë˜ëŠ”지 모르게 간절합니다. ì •ìž„ì€ ì € ë•Œë¬¸ì— ì•„ë²„ì§€ê°€ 불행하게 ë˜ì…¨ë‹¤ê³  í•´ì„œ 차마 ë³¼ 수 없게 애통하고 있습니다. ì§„ì •ì„ ë§ì”€í•˜ì˜¤ë©´ 저는 지금 ì•„ë²„ì§€ë³´ë‹¤ë„ ì–´ë¨¸ë‹ˆë³´ë‹¤ë„ ì •ìž„ì—게 가장 ë™ì •ì´ ëŒë¦½ë‹ˆë‹¤. ì„ ìƒë‹˜, 저는 아버지를 찾아가는 ê²ƒì´ ì•„ë‹ˆë¼ ì •ìž„ì„ ë•ê¸° 위하여 간호하기 위하여 가는 것 같습니다. +ì„ ìƒë‹˜, 저는 ì•„ì§ ì‚¬ëž‘ì´ëž€ ê²ƒì´ ë¬´ì—‡ì¸ì§€ë¥¼ 모릅니다. 그러나 ì •ìž„ì„ ë³´ê³  사랑ì´ëž€ ê²ƒì´ ì–´ë–»ê²Œ 신비하고 열렬하고 놀ë¼ìš´ 것ì¸ê°€ë¥¼ 안 것 같습니다. +ìˆœìž„ì˜ íŽ¸ì§€ëŠ” 계ì†ëœë‹¤. +ì„ ìƒë‹˜, í•˜ì–¼ë¹ˆì— ì˜¤ëŠ” ê¸¸ì— ì†¡í™”ê°• êµ½ì´ë¥¼ ë³¼ ë•Œì—는 ì •ìž„ì´ê°€ 어떻게나 울었는지, ê·¸ê²ƒì€ ì°¨ë§ˆ ë³¼ 수가 없었습니다. 아버지께서 ì†¡í™”ê°•ì„ ë³´ì‹œê³  ê°ìƒì´ 깊으셨ë”란 ê²ƒì„ ìƒê°í•œ 것입니다. 무ì¸ì§€ê²½ìœ¼ë¡œ, 허옇게 ëˆˆì´ ë®ì¸ 벌íŒìœ¼ë¡œ í˜ëŸ¬ê°€ëŠ” 송화강 êµ½ì´, ê·¸ê²ƒì€ ìŠ¬í”ˆ í’경입니다. 아버지께서 여기를 지나실 ë•Œì—는 마른 풀만 있는 ê´‘ì•¼ì˜€ì„ ê²ƒì´ë‹ˆ ê·¸ ë•Œì—는 ë”ìš± í™©ëŸ‰í•˜ì˜€ì„ ê²ƒì´ë¼ê³  ì •ìž„ì€ ë§í•˜ê³  ì›ë‹ˆë‹¤. +ì •ìž„ì€ ì œê°€ 아버지를 아는 것보다 아버지를 잘 아는 것 같습니다. í‰ì†Œì— 아버지와는 그리 ì ‘ì´‰ì´ ì—†ê±´ë§ˆëŠ” ì •ìž„ì€ ì•„ë²„ì§€ì˜ ì˜ì§€ë ¥, ì•„ë²„ì§€ì˜ ìˆ¨ì€ ì—´ì •, ì•„ë²„ì§€ì˜ ì„±ë¯¸ê¹Œì§€ 잘 압니다. 저는 ì •ìž„ì˜ ë§ì„ 듣고야 비로소 ì°¸ 그래, 하는 ê°íƒ„ì„ ë°œí•œ ì¼ì´ 여러 번 있습니다. +ì •ìž„ì˜ ë§ì„ 듣고야 비로소 아버지가 남보다 뛰어나신 ì¸ë¬¼ì¸ ê²ƒì„ ê¹¨ë‹¬ì•˜ìŠµë‹ˆë‹¤. 아버지는 ì •ì˜ê°ì´ 굳세고 겉으로는 싸늘하ë„ë¡ ì´ì§€ì ì´ì§€ë§ˆëŠ” ì†ì—는 불 ê°™ì€ ì—´ì •ì´ ìžˆìœ¼ì‹œê³ , 아버지는 쇠 ê°™ì€ ì˜ì§€ë ¥ê³¼ 칼날 ê°™ì€ íŒë‹¨ë ¥ì´ 있어서 언제나 ì£¼ì €í•˜ì‹¬ì´ ì—†ê³  ë˜ í”ë“¤ë¦¬ì‹¬ì´ ì—†ë‹¤ëŠ” 것, 아버지께서는 모든 ê²ƒì„ ìš©ì„œí•˜ê³  모든 ê²ƒì„ í˜¸ì˜ë¡œ í•´ì„하여서 누구를 미워하거나 ì›ë§í•˜ì‹¬ì´ 없는 등, ì •ìž„ì€ ì•„ë²„ì§€ì˜ ë§ˆìŒì˜ 목ë¡ê³¼ 설명서를 ë”°ë¡œ 외우는 것처럼 ì•„ë²„ì§€ì˜ ì„±ê²©ì„ ì„¤ëª…í•©ë‹ˆë‹¤. 듣고 ë³´ì•„ì„œ 비로소 ì•„ë²„ì§€ì˜ ë”¸ì¸ ì €ëŠ” ë‚´ 아버지가 ì–´ë–¤ 아버지ì¸ê°€ë¥¼ 알았습니다. +ì„ ìƒë‹˜, ì´í•´ê°€ ì‚¬ëž‘ì„ ë‚³ëŠ”ë‹¨ ë§ì”€ì´ 있지마는 저는 ì •ìž„ì„ ë³´ì•„ì„œ ì‚¬ëž‘ì´ ì´í•´ë¥¼ 낳는 ê²ƒì´ ì•„ë‹Œê°€ 합니다. +어쩌면 어머니와 저는 í‰ìƒì„ 아버지를 모시고 ìžˆìœ¼ë©´ì„œë„ ì•„ë²„ì§€ë¥¼ 몰ëžìŠµë‹ˆê¹Œ. ì´ì„±ì´ 무디고 ì–‘ì‹¬ì´ í려서 그랬습니까. ì •ìž„ì€ ì§„ì‹¤ë¡œ 존경할 ì—¬ìžìž…니다. 제가 남ìžë¼ 하ë”ë¼ë„ ì •ìž„ì„ ì•„ë‹ˆ 사랑하고는 못 견디겠습니다. +아버지는 분명 ì •ìž„ì„ ì‚¬ëž‘í•˜ì‹  것입니다. 처ìŒì—는 ì¹œêµ¬ì˜ ë”¸ë¡œ, 다ìŒì—는 친딸과 ê°™ì´, ë˜ ë‹¤ìŒì—는 무엇ì¸ì§€ 모르게 뜨거운 ì‚¬ëž‘ì´ ìƒê²¼ìœ¼ë¦¬ë¼ê³  믿습니다. ê·¸ê²ƒì„ ì•„ë²„ì§€ëŠ” ì£½ì¸ ê²ƒìž…ë‹ˆë‹¤. ê·¸ê²ƒì„ ì£½ì´ë ¤ê³  ì´ ë‹¬í•  수 없는 ì‚¬ëž‘ì„ ì£½ì´ë ¤ê³  시베리아로 달아나신 것입니다. ì¸ì œì•¼ 아버지께서 ì„ ìƒë‹˜ê»˜ 하신 íŽ¸ì§€ì˜ ëœ»ì´ ì•Œì•„ì§„ 것 같습니다. ë°±ì„¤ì´ ë®ì¸ ì‹œë² ë¦¬ì•„ì˜ ì‚¼ë¦¼ ì†ìœ¼ë¡œ í˜¼ìž í—¤ë§¤ë©° ì •ìž„ì—게로 향하는 ì‚¬ëž‘ì„ ì£½ì´ë ¤ê³  무진 애를 쓰시는 ê·¸ ì‹¬ì •ì´ ì•Œì•„ì§€ëŠ” 것 같습니다. +ì„ ìƒë‹˜ ì´ê²ƒì´ 얼마나 비참한 ì¼ìž…니까. 저는 ì •ìž„ì˜ ì§ì— 지니고 온 ì¼ê¸°ë¥¼ 보다가 ì´ëŸ¬í•œ êµ¬ì ˆì„ ë°œê²¬í•˜ì˜€ìŠµë‹ˆë‹¤. +ì„ ìƒë‹˜. 저는 세ì¸íŠ¸ ì˜¤ê±°ìŠ¤í‹´ì˜ <참회ë¡>ì„ ì ˆë°˜ì´ë‚˜ 다 ë³´ê³  ë‚˜ë„ ìž ì´ ë“¤ì§€ 아니합니다. ìž ì´ ë“¤ê¸° ì „ì— ì œê°€ í•­ìƒ ì¦ê²¨í•˜ëŠ” ì•„ë² ë§ˆë¦¬ì•„ì˜ ë…¸ëž˜ë¥¼ 유성기로 듣고 나서 오늘 ì¼ê¸°ë¥¼ 쓰려고 하니 슬픈 소리만 나옵니다. +사랑하는 어른ì´ì—¬. 저는 멀리서 ë‹¹ì‹ ì„ ì¡´ê²½í•˜ê³  신뢰하는 마ìŒì—서만 살아야 í•  ê²ƒì„ ìž˜ 압니다. 여기ì—ì„œ ì˜ì›í•œ 정지를 하지 아니하면 아니 ë©ë‹ˆë‹¤. ë¹„ë¡ ì œ ìƒëª…ì´ ê´´ë¡œì›€ìœ¼ë¡œ ëŠì–´ì§€ê³  ì œ í˜¼ì´ í”¼ì–´ 보지 못하고 스러져 버리ë”ë¼ë„ 저는 ì´ ë©€ë¦¬ì„œ ë°”ë¼ë³´ëŠ” 존경과 ì‹ ë¢°ì˜ ì‹¬ê²½ì—ì„œ í•œ ë°œìžêµ­ì´ë¼ë„ 옮기지 않아야 í•  ê²ƒì„ ìž˜ 압니다. 나를 위하여 놓여진 ìƒì˜ 궤ë„는 ë‚˜ì˜ ìƒëª…ì„ ë¶€ì¸í•˜ëŠ” ì–µì§€ì˜ ê¸¸ìž…ë‹ˆë‹¤. 제가 몇 ë…„ ì „ 기숙사 ë² ë“œì—ì„œ ì´ëŸ° ë°¤ì— ë‚´ë‹¤ë³´ë©´ ì¦ê²ê³  ì•„ë¦„ë‹µë˜ ë‚´ ìƒì˜ ê¿ˆì€ ë‹¤ 깨어졌습니다. +ì œ ì˜í˜¼ì˜ í•œ ì¡°ê°ì´ 먼 ì„¸ìƒ ì•Œì§€ 못할 세계로 떠다니고 있습니다. 잃어버린 ë§ˆìŒ ì¡°ê° ì–´ì°Œí•˜ë‹¤ê°€ 제가 ì´ë ‡ê²Œ ë˜ì—ˆëŠ”지 모릅니다. +피어 오르는 ìƒëª…ì˜ ê´‘ì±„ë¥¼ 스스로 ì‚¬í˜•ì— ì²˜í•˜ì§€ 아니하면 아니 ë  ë•Œ ì–´ì°Œ ìŠ¬í””ì´ ì—†ê² ìŠµë‹ˆê¹Œ. ì´ê²ƒì€ 현실로 ì‚¬ëžŒì˜ ìƒëª…ì„ ì£½ì´ëŠ” 것보다 ë” ë¬´ì„œìš´ 죄가 아니오리까. ë‚˜ì˜ ì„¸ê³„ì—ì„œ 처ìŒì´ìš” 마지막으로 발견한 ë¹›ì„ ì–´ë‘  ì†ì— 소멸해 버리ë¼ëŠ” ì´ ì¼ì´ 얼마나 떨리는 ì§ë¬´ì˜¤ë¦¬ê¹Œ. ì´ í—ˆê¹¨ë¹„ì˜ í˜•ì˜ ì‚¬ëžŒì´ ì‚´ê¸° 위하여 ë‚´ ì†ìœ¼ë¡œ ì¹¼ì„ ë“¤ì–´ ë‚´ ì˜í˜¼ì˜ 환í¬ë¥¼ ì³ì•¼ 옳습니까. 저는 í•˜ë‚˜ë‹˜ì„ ì›ë§í•©ë‹ˆë‹¤. +ì´ë ‡ê²Œ 씌어 있습니다. ì„ ìƒë‹˜ ì´ê²ƒì´ 얼마나 피 í르는 고백입니까. +ì„ ìƒë‹˜, 저는 ì •ìž„ì˜ ì´ ê³ ë°±ì„ ë³´ê³  무조건으로 ì •ìž„ì˜ ì‚¬ëž‘ì„ ì‹œì¸í•©ë‹ˆë‹¤. ì„ ìƒë‹˜, ì œ ëª©ìˆ¨ì„ ë°”ì³ì„œ 하는 ì¼ì— 누가 시비를 하겠습니까. ë”구나 ê·¸ ë™ê¸°ì— í‹°ëŒë§Œí¼ë„ 불순한 ê²ƒì´ ì—†ìŒì—야 무조건으로 ì‹œì¸í•˜ì§€ 아니하고 어찌합니까. +ë°”ë¼ê¸°ëŠ” ì •ìž„ì˜ ë³‘ì´ í¬ê²Œ ë˜ì§€ 아니하고 아버지께서 무사히 계셔서 ì†ížˆ 만나뵙게 ë˜ëŠ” 것입니다마는 ì•žê¸¸ì´ ë§ë§í•˜ì—¬ ê°€ìŠ´ì´ ë‘ê·¼ê±°ë¦¼ì„ ê¸ˆì¹˜ 못합니다. 게다가 ì˜¤ëŠ˜ì€ í•¨ë°•ëˆˆì´ í¼ë¶€ì–´ì„œ 천지가 온통 회색으로 í•œ ë¹›ì´ ë˜ì—ˆìœ¼ë‹ˆ ë”ìš± ì „ë„ê°€ 막막합니다. 그러나 ì„ ìƒë‹˜ 저는 앓는 ì •ìž„ì„ ë°ë¦¬ê³  ìš©ê°í•˜ê²Œ 시베리아 ê¸¸ì„ ë– ë‚©ë‹ˆë‹¤. +í•œ ì¼ ì£¼ì¼ í›„ì— ë˜ íŽ¸ì§€ í•œ ìž¥ì´ ì™”ë‹¤. ê·¸ê²ƒë„ ìˆœìž„ì˜ íŽ¸ì§€ì—¬ì„œ ì´ëŸ¬í•œ ë§ì´ 있었다. +……오늘 ìƒˆë²½ì— í¥ì•ˆë ¹ì„ 지났습니다. 플랫í¼ì˜ 한란계는 ì˜í•˜ ì´ì‹­ì‚¼ ë„를 가리켰습니다. ì‚¬ëžŒë“¤ì˜ ì–¼êµ´ì€ ì†œí„¸ì— ì„±ì—ê°€ 슬어서 남녀 노소 í•  것 ì—†ì´ í•˜ì–—ê²Œ ë¶„ì„ ë°”ë¥¸ 것 같습니다. ìœ ë¦¬ì— ë¹„ì¹œ ë‚´ ì–¼êµ´ë„ ê·¸ì™€ ê°™ì´ í° ê²ƒì„ ë³´ê³  놀ëžìŠµë‹ˆë‹¤. ìˆ¨ì„ ë“¤ì´ì‰´ ë•Œì—는 ì½”í„¸ì´ ì–¼ì–´ì„œ ìˆ¨ì´ ëŠê¸°ê³  ë°”ëžŒê²°ì´ ì§€ë‚˜ê°€ë©´ ëˆˆë¬¼ì´ ì–¼ì–´ì„œ 눈ì¹ì´ 마주 붙습니다. ì‚¬ëžŒë“¤ì€ í„¸ê³¼ ê°€ì£½ì— ì‹¸ì—¬ì„œ ê³°ê°™ì´ ë³´ìž…ë‹ˆë‹¤. +ë˜ ì´ëŸ° ë§ë„ 있었다. +ì•„ë¼ì‚¬ ê³„ì§‘ì• ë“¤ì´ ìš°ìœ ë³‘ë“¤ì„ í’ˆì— í’ˆê³  서서 ì†ë‹˜ì´ 사기를 기다리고 있습니다. ì €ë„ ë‘ ë³‘ì„ ì‚¬ì„œ ì •ìž„ì´ì™€ 나누어 먹었습니다. 우유는 따뜻합니다. ê·¸ê²ƒì„ ì‹ížˆì§€ 아니할 양으로 í’ˆì— í’ˆê³  ì„°ë˜ ê²ƒìž…ë‹ˆë‹¤. +ë˜ ì´ëŸ¬í•œ êµ¬ì ˆë„ ìžˆì—ˆë‹¤. +ì •ê±°ìž¥ì— ë‹¿ì„ ë•Œë§ˆë‹¤ ì €í¬ë“¤ì€ ë°–ì„ ë‚´ë‹¤ë´…ë‹ˆë‹¤. 행여나 아버지가 거기 계시지나 아니할까 하고요. 차가 어길 ë•Œì—는 ë”구나 마ìŒì´ 조입니다. 아버지가 ê·¸ 차를 타고 지나가시지나 아니하는가 하고요. 그리고는 ì •ìž„ì€ ì›ë‹ˆë‹¤. ê¼­ 뵈올 ì–´ë¥¸ì„ ë†“ì³ë‚˜ 버린 듯ì´. +그리고는 ì´ ì£¼ì¼ ë™ì•ˆì´ë‚˜ 소ì‹ì´ 없다가 편지 í•œ ìž¥ì´ ì™”ë‹¤. ê·¸ê²ƒì€ ì •ìž„ì˜ ê¸€ì”¨ì˜€ë‹¤. +ì„ ìƒë‹˜, 저는 지금 최 ì„ ìƒê»˜ì„œ ê³„ì‹œë˜ ë°”ì´ì¹¼ í˜¸ë°˜ì˜ ê·¸ ì§‘ì— ì™€ì„œ 홀로 누웠습니다. ìˆœìž„ì€ ì£¼ì¸ ë…¸íŒŒì™€ 함께 F역으로 최 ì„ ìƒì„ 찾아서 오늘 ì•„ì¹¨ì— ë– ë‚˜ê³  병든 저만 í˜¼ìž ëˆ„ì›Œì„œ ì–¼ìŒì— ì‹¸ì¸ ë°”ì´ì¹¼ í˜¸ì˜ ëˆˆë³´ë¼ì¹˜ëŠ” 바람 소리를 듣고 있습니다. ì—´ì€ ì‚¼ì‹­íŒ” ë„로부터 구 ë„ ì‚¬ì´ë¥¼ 오르내리고 ê¸°ì¹¨ì€ ë‚˜ê³  ëª¸ì˜ ê´´ë¡œì›€ì„ ê²¬ë”œ 수 없습니다. 그러하오나 ì„ ìƒë‹˜, 저는 í•˜ë‚˜ë‹˜ì„ ë¶ˆëŸ¬ì„œ 축ì›í•©ë‹ˆë‹¤. ì´ ì‹¤ë‚± ê°™ì€ ìƒëª…ì´ ë‹¤ 타 버리기 ì „ì— ìµœ ì„ ìƒì˜ ë‚¯ì„ ë‹¤ë§Œ ì¼ ì´ˆ ë™ì•ˆì´ë¼ë„ 보여지ì´ë¼ê³ . 그러하오나 ì„ ìƒë‹˜, ì´ ì¶•ì›ì´ ì´ë£¨ì–´ì§€ê² ìŠµë‹ˆê¹Œ. +저는 한사코 F역까지 가려 하였사오나 순임 í˜•ì´ ìš¸ê³  막사오며 ë˜ ì£¼ì¸ ë…¸íŒŒê°€ 본래 미국 사람과 ì‚´ë˜ ì‚¬ëžŒìœ¼ë¡œ ì˜ì–´ë¥¼ 알아서 순임 í˜•ì˜ ë„ì›€ì´ ë˜ê² ê¸°ë¡œ 저는 ì´ ê³³ì— ëˆ„ì›Œ 있습니다. 순임 í˜•ì€ ê¸°ì–´ì½” 아버지를 찾아 모시고 오마고 약ì†í•˜ì˜€ì‚¬ì˜¤ë‚˜ ì´ ë„“ì€ ì‹œë² ë¦¬ì•„ì—ì„œ ì–´ë”” 가서 찾겠습니까. +ì„ ìƒë‹˜, 저는 죽ìŒì„ 봅니다. 죽ìŒì´ 바로 ì œ ì•žì— ì™€ì„œ ì„  ê²ƒì„ ë´…ë‹ˆë‹¤. ê·¸ì˜ ì†ì€ ì œ 여윈 ì†ì„ 잡으려고 ë“¤ë¨¹ê±°ë¦¼ì„ ë´…ë‹ˆë‹¤. +ì„ ìƒë‹˜, ì£½ì€ ë’¤ì—ë„ ì˜ì‹ì´ 남습니까. ë§Œì¼ ì˜ì‹ì´ 남는다 하면 ì£½ì€ ë’¤ì—ë„ ì´ ì•„í””ê³¼ ê´´ë¡œì›€ì„ ê³„ì†í•˜ì§€ 아니하면 아니 ë©ë‹ˆê¹Œ. ì£½ì€ ë’¤ì—는 ì˜¤ì§ ì˜ì›í•œ ì–´ë‘ ê³¼ ìžŠì–´ë²„ë¦¼ì´ ìžˆìŠµë‹ˆê¹Œ. ì£½ì€ ë’¤ì—는 혹시나 ìƒì „ì— ë¨¹ì—ˆë˜ ë§ˆìŒì„ ìžìœ ë¡œ 펼 ë„리가 있습니까. ì´ ì„¸ìƒì—ì„œ 그립고 ì‚¬ëª¨í•˜ë˜ ì´ë¥¼ ì£½ì€ ë’¤ì—는 ìžìœ ë¡œ 만나 ë³´ê³  언제나 마ìŒê» ê°™ì´í•  수가 있습니까. 그런 ì¼ë„ 있습니까. ì´ëŸ° ì¼ì„ ë°”ë¼ëŠ” ê²ƒë„ ì£„ê°€ ë©ë‹ˆê¹Œ. +ì •ìž„ì˜ íŽ¸ì§€ëŠ” ë”ìš± ì ˆë§ì ì¸ ì–´ì¡°ë¡œ 찬다. +저는 ì²˜ìŒ ë³‘ì´ ë‚¬ì„ ë•Œì—는 죽는 ê²ƒì´ ì‹«ê³  무서웠습니다. 그러나 ì§€ê¸ˆì€ ì£½ëŠ” ê²ƒì´ ì¡°ê¸ˆë„ ë¬´ì„­ì§€ 아니합니다. 다만 차마 죽지 못하는 ê²ƒì´ í•œ. +하고는 `다만 차마' ì´í•˜ë¥¼ ë°•ë°• 지워 버렸다. 그리고는 새로 시작하여 나와내 가족ì—게 대한 ë¬¸ì•ˆì„ í•˜ê³ ëŠ” ëì„ ë§‰ì•˜ë‹¤. +나는 ì´ íŽ¸ì§€ë¥¼ 받고 울었다. 무슨 í° ë¹„ê·¹ì´ ê°€ê¹Œìš´ ê²ƒì„ ì˜ˆìƒí•˜ê²Œ 하였다. +ê·¸ 후 í•œ ì‹­ì—¬ ì¼ì´ë‚˜ 지나서 ì „ë³´ê°€ 왔다. ê·¸ê²ƒì€ ì˜ë¬¸ìœ¼ë¡œ 씌었는ë°, +"아버지 ë³‘ì´ ê¸‰í•˜ë‹¤. 나로는 ì–´ì©” 수 없다. ëˆ ê°€ì§€ê³  곧 오기를 바란다." +하고 ê·¸ ëì— B호텔ì´ë¼ê³  주소를 ì ì—ˆë‹¤. ì „ë³´ ë°œì‹ êµ­ì´ ì´ë¥´ì¿ ì¸ í¬ì¸ ê²ƒì„ ë³´ë‹ˆ B호텔ì´ë¼ í•¨ì€ ì´ë¥´ì¿ ì¸ í¬ì¸ ê²ƒì´ ë¶„ëª…í•˜ì˜€ë‹¤. +나는 ìµœì„ ë¶€ì¸ì—게 최ì„ì´ê°€ ì•„ì§ ì‚´ì•„ 있다는 ê²ƒì„ ì „í•˜ê³  곧 여행권 수ì†ì„ 하였다. ì ˆë§ìœ¼ë¡œ ì•Œì•˜ë˜ ì—¬í–‰ê¶Œì€ ì‚¬ì •ì´ ì‚¬ì •ì¸ë§Œí¼ 곧 발부ë˜ì—ˆë‹¤. +나는 비행기로 ì—¬ì˜ë„를 떠났다. ë°±ì„¤ì— ê°œê°œí•œ ë•…ì„, 남빛으로 푸른 바다를 굽어보는 ë™ì•ˆì— ëŒ€ë ¨ì„ ë“¤ëŸ¬ 거기서 다른 비행기를 갈아타고 봉천, ì‹ ê²½, í•˜ì–¼ë¹ˆì„ ê±°ì³, ì¹˜ì¹˜í•˜ì–¼ì— ë“¤ë €ë‹¤ê°€ 만주리로 급행하였다. +웅대한 ëŒ€ë¥™ì˜ ì„¤ê²½ë„ ë‚˜ì—게 아무러한 ì¸ìƒë„ 주지 못하였다. 다만 푸른 하늘과 í¬ê³  í‰í‰í•œ ë•…ê³¼ì˜ ì‚¬ì´ë¡œ 한량 ì—†ì´ í—ˆê³µì„ ë‚ ì•„ê°„ë‹¤ëŠ” ìƒê°ë°–ì— ì—†ì—ˆë‹¤. ê·¸ê²ƒì€ ì‚¬ëž‘í•˜ëŠ” ë‘ ì¹œêµ¬ê°€ ëª©ìˆ¨ì´ ê²½ê°ì— 달린 ê²ƒì„ ìƒê°í•  ë•Œì— ë§ˆìŒì— 아무 ì—¬ìœ ë„ ì—†ëŠ” 까닭ì´ì—ˆë‹¤. +만주리ì—ì„œë„ ë¹„í–‰ê¸°ë¥¼ 타려 하였으나 소비ì—트 ê´€í—Œì´ í—ˆë½ì„ 아니 하여 열차로 ê°ˆ ìˆ˜ë°–ì— ì—†ì—ˆë‹¤. +초조한 몇 ë°¤ì„ ì§€ë‚˜ê³  ì´ë¥´ì¿ ì¸ í¬ì— 내린 ê²ƒì´ ì˜¤ì „ ë‘ì‹œ. 나는 B호텔로 ì´ìŠ¤ë³´ìŠ¤ì¹˜ì¹´ë¼ëŠ” 마차를 몰았다. 죽ìŒê³¼ ê°™ì´ ê³ ìš”í•˜ê²Œ 눈 ì†ì— ìžëŠ” 시간ì—는 여기저기 ì „ë“±ì´ ë°˜ì§ê±°ë¦´ ë¿, ì´ë”°ê¸ˆ ë°¤ì˜ ì‹œê°€ë¥¼ 경계하는 ë³‘ì •ë“¤ì˜ ëˆˆì´ ë¬´ì„­ê²Œ 빛나는 ê²ƒì´ ë³´ì˜€ë‹¤. +B호텔ì—ì„œ 미스 ì´ˆì´(최 ì–‘)를 찾았으나 ìˆœìž„ì€ ì—†ê³  ì–´ë–¤ 서양 노파가 나와서, +"유 미스터 Y?" +하고 ì˜ì‹¬ìŠ¤ëŸ¬ìš´ 눈으로 나를 보았다. +그렇다는 ë‚´ ëŒ€ë‹µì„ ë“£ê³ ëŠ” 노파는 반갑게 ì†ì„ 내밀어서 ë‚´ ì†ì„ 잡았다. +나는 넉넉하지 못한 ì˜ì–´ë¡œ ê·¸ 노파ì—게서 최ì„ì´ê°€ ì•„ì§ ì‚´ì•˜ë‹¤ëŠ” ë§ê³¼ ì •ìž„ì˜ ì†Œì‹ì€ ë“¤ì€ ì§€ 오래ë¼ëŠ” ë§ê³¼ 최ì„ê³¼ ìˆœìž„ì€ ì—¬ê¸°ì„œ 삼십 마ì¼ì´ë‚˜ 떨어진 Fì—­ì—ì„œë„ ì°ë§¤ë¡œ ë” ê°€ëŠ” 삼림 ì†ì— 있다는 ë§ì„ 들었다. +나는 ê·¸ ë°¤ì„ ì—¬ê¸°ì„œ 지내고 ì´íŠ¿ë‚  ì•„ì¹¨ì— ë– ë‚˜ëŠ” 완행차로 ê·¸ 노파와 함께 ì´ë¥´ì¿ ì¸ í¬ë¥¼ 떠났다. +ì´ ë‚ ë„ ì²œì§€ëŠ” ì˜¤ì§ ëˆˆë¿ì´ì—ˆë‹¤. 차는 ê°€ë” ì‚¼ë¦¼ 중으로 가는 모양ì´ë‚˜ ëª¨ë‘ íšŒìƒ‰ë¹›ì— ê°€ë¦¬ì›Œì„œ 분명히 ë³´ì´ì§€ë¥¼ 아니하였다. +Fì—­ì´ë¼ëŠ” ê²ƒì€ ì‚¼ë¦¼ ì†ì— 있는 조그마한 정거장으로 집ì´ë¼ê³ ëŠ” 정거장 ì§‘ë°–ì— ì—†ì—ˆë‹¤. 역부 ë‘ì—‡ì´ í„¸ì˜·ì— í•˜ì–—ê²Œ ëˆˆì„ ë’¤ì“°ê³  졸리는 ë“¯ì´ ì˜¤ë½ê°€ë½í•  ë¿ì´ì—ˆë‹¤. +우리는 ì°ë§¤ 하나를 얻어 타고 어디가 길ì¸ì§€ ë¶„ëª…ì¹˜ë„ ì•„ë‹ˆí•œ 눈 ì†ìœ¼ë¡œ ë§ì„ 몰았다. +ë°”ëžŒì€ ì—†ëŠ” 듯하지마는 ê·¸ëž˜ë„ ëˆˆë°œì„ í•œíŽ¸ìœ¼ë¡œ 비ë¼ëŠ” 모양ì´ì–´ì„œ 아름드리 ë‚˜ë¬´ë“¤ì˜ í•œìª½ì€ í•˜ì–—ê²Œ 눈으로 쌓ì´ê³  í•œìª½ì€ ê²€ì€ ë¹›ì´ ë”ìš± ë‹ë³´ì˜€ë‹¤. ë°± ì²™ì€ ë„˜ì„ ë“¯í•œ 꼿꼿한 침엽수(전나무 따윈가)ë“¤ì´ ì–´ë””ê¹Œì§€ë“ ì§€, 하늘ì—ì„œ 곧 ë‚´ë ¤ë°•ì€ ëª» 모양으로, ìˆ˜ì—†ì´ ì„œ 있는 사ì´ë¡œ 우리 ì°ë§¤ëŠ” 간다. ë•…ì— ë®ì¸ ëˆˆì€ ìƒˆë¡œ 피워 ë†“ì€ ì†œê°™ì´ í¬ì§€ë§ˆëŠ” 하늘ì—ì„œ 내리는 ëˆˆì€ êµ¬ë¦„ë¹›ê³¼ 공기빛과 어울려서 ë°¥ ìž¦íž ë•Œì— êµ´ëšì—ì„œ 나오는 연기와 ê°™ì´ ì—°íšŒìƒ‰ì´ë‹¤. +ë°”ëžŒë„ ë¶ˆì§€ 아니하고 ìƒˆë„ ë‚ ì§€ 아니하건마는 나무 ë†’ì€ ê°€ì§€ì— ìŒ“ì¸ ëˆˆì´ ì´ë”°ê¸ˆ ë©ì¹˜ë¡œ 떨어져서는 고요한 수풀 ì†ì— ìž‘ì€ ë™ìš”를 ì¼ìœ¼í‚¨ë‹¤. +우리 ì°ë§¤ê°€ 가는 ê¸¸ì´ ìžì—°ìŠ¤ëŸ¬ìš´ 복잡한 커브를 ë„는 ê²ƒì„ ë³´ë©´ í•„ì‹œ ì–¼ìŒ ì–¸ 개천 위로 달리는 모양ì´ì—ˆë‹¤. +í•œ 시간ì´ë‚˜ 달린 ë’¤ì— ìš°ë¦¬ ì°ë§¤ëŠ” ëŠ¦ì€ ê²½ì‚¬ì§€ë¥¼ 올ëžë‹¤. ë§ì„ 어거하는 ì•„ë¼ì‚¬ ì‚¬ëžŒì€ ì­ˆì­ˆì­ˆì­ˆ, 후르르 하고 ì£¼ë¬¸ì„ ì™¸ìš°ë“¯ì´ ìž…ìœ¼ë¡œ ë§ì„ 재촉하고 ê³ ì‚를 ì´ë¦¬ 들고 저리 들어 ë§ì—게 ë°©í–¥ì„ ê°€ë¦¬í‚¬ ë¿ì´ìš”, 채ì°ì€ ë³´ì´ê¸°ë§Œí•˜ê³  í•œ ë²ˆë„ ì“°ì§€ 아니하였다. 그와 ë§ê³¼ëŠ” 완전히 뜻과 ì •ì´ ë§žëŠ” ë™ì§€ì¸ 듯하였다. +처ìŒì—는 몰ëžìœ¼ë‚˜ 차차 추워ì§ì„ 깨달았다. 발과 무르íŒì´ 시렸다. +"얼마나 머오?" +하고 나는 ì˜¤ëž˜ê°„ë§Œì— ìž…ì„ ì—´ì–´ì„œ 노파ì—게 물었다. 노파는 털수건으로 머리를 싸매고 깊숙한 눈만 남겨 가지고 실신한 사람 모양으로 허공만 ë°”ë¼ë³´ê³  있다가, ë‚´ê°€ 묻는 ë§ì— 비로소 ìž ì´ë‚˜ 깬 듯ì´, +"멀지 않소. ì¸ì   í•œ 십오 마ì¼." +하고는 나를 ë°”ë¼ë³´ì•˜ë‹¤. ê·¸ ëˆˆì€ ì•„ë§ˆ 웃는 모양ì´ì—ˆë‹¤. +ê·¸ 얼굴, ê·¸ 눈, ê·¸ ìŒì„±ì´ ëª¨ë‘ ì´ ë…¸íŒŒê°€ ì¸ìƒ í’íŒŒì˜ ìŠ¬í”ˆ ì¼ ê´´ë¡œìš´ ì¼ì— 부대ë¼ê³  지친 ê²ƒì„ í‘œí•˜ì˜€ë‹¤. 그리고 죽는 날까지 살아간다 하는 듯하였다. +경사지를 올ë¼ì„œì„œ 보니 ê·¸ê²ƒì€ í•œ 산등성ì´ì˜€ë‹¤. ë°©í–¥ì€ ì•Œ 수 없으나 우리가 가는 ë°©í–¥ì—는 ë” ë†’ì€ ë“±ì„±ì´ê°€ 있는 모양ì´ë‚˜ 다른 ê³³ì€ ë‹¤ ì´ë³´ë‹¤ ë‚®ì€ ê²ƒ 같아서 하얀 눈바다가 ëì—†ì´ ë³´ì´ëŠ” 듯하였다. ê·¸ 눈보ë¼ëŠ” ë“¤ì‘¹ë‚ ì‘¹ì´ ìžˆëŠ” ê²ƒì„ ë³´ë©´ ì‚¼ë¦¼ì˜ ê¼­ëŒ€ê¸°ì¸ ê²ƒì´ ë¶„ëª…í•˜ì˜€ë‹¤. ë”구나 여기저기 뾰족뾰족 ëˆˆì†¡ì´ ë¶™ì„ ìˆ˜ 없는 마른 나뭇가지가 거뭇거뭇 ë³´ì´ëŠ” ê²ƒì„ ë³´ì•„ì„œ 그러하였다. ë§Œì¼ ëˆˆì´ ê±·í˜€ 주었으면 얼마나 안계가 넓으랴, ìµœì„ êµ°ì´ ê³ ë¯¼í•˜ëŠ” ê°€ìŠ´ì„ ì•ˆê³  ì´ë¦¬ë¡œ 헤매었구나 하면서 나는 ëª©ì„ ë‘˜ëŸ¬ì„œ ì‚¬ë°©ì„ ë°”ë¼ë³´ì•˜ë‹¤. +우리는 ê·¸ 등성ì´ë¥¼ 내려갔다. ë§ì´ 미처 ë°œì„ ë•…ì— ë†“ì„ ìˆ˜ê°€ 없는 ì •ë„ë¡œ 빨리 내려갔다. 여기는 ì‚°ë¶ˆì´ ë‚¬ë˜ ìžë¦¬ì¸ 듯하여 거뭇거뭇 불탄 ìžêµ­ 있는 마른 ë‚˜ë¬´ë“¤ì´ ë“œë¬¸ë“œë¬¸ ì„œ 있었다. ê·¸ ë‚˜ë¬´ë“¤ì€ ì°ì–´ 가는 ì‚¬ëžŒë„ ì—†ìœ¼ë§¤ 저절로 ì©ì–´ì„œ 없어지기를 기다릴 ìˆ˜ë°–ì— ì—†ì—ˆë‹¤. ê·¸ë“¤ì€ ë‚˜ì„œ 아주 ì©ì–´ 버리기까지 천 ë…„ ì´ìƒì€ 걸린다고 하니 ë˜í•œ 장한 ì¼ì´ë‹¤. +ì´ ëŒ€ì‚¼ë¦¼ì— ë¶ˆì´ ë¶™ëŠ”ë‹¤ 하면 ê·¸ê²ƒì€ ìž¥ê´€ì¼ ê²ƒì´ë‹¤. ë‹¬ë°¤ì— ë†’ì€ ê³³ì—ì„œ ì´ ê²½ì¹˜ë¥¼ 내려다본다 하면 ê·¸ë„ ìž¥ê´€ì¼ ê²ƒì´ìš”, ì—¬ë¦„ì— í•œì°½ ê¸°ìš´ì„ íŽ¼ ë•Œë„ ìž¥ê´€ì¼ ê²ƒì´ë‹¤. 나는 ì˜¤ë‰´ì›”ê²½ì— ì‹œë² ë¦¬ì•„ë¥¼ 여행하는 ì´ë“¤ì´ ë없는 꽃바다를 보았다는 기ë¡ì„ ìƒê°í•˜ì˜€ë‹¤. +"저기요!" +하는 ë…¸íŒŒì˜ ë§ì— 나는 ìƒê°ì˜ ì¤„ì„ ëŠì—ˆë‹¤. 저기ë¼ê³  가리키는 ê³³ì„ ë³´ë‹ˆ 거기는 집ì´ë¼ê³  ìƒê°ë˜ëŠ” ë¬¼ê±´ì´ ë‚˜ë¬´ 사ì´ë¡œ 보였다. ì°½ì´ ìžˆìœ¼ë‹ˆ 분명 집ì´ì—ˆë‹¤. +우리 ì´ìŠ¤ë³´ìŠ¤ì¹˜ì¹´ê°€ ê°€ê¹Œì´ ì˜¤ëŠ” ê²ƒì„ ë³´ì•˜ëŠ”ì§€, ê·¸ 집 ê°™ì€ ë¬¼ê±´ì˜ ë¬¸ ê°™ì€ ê²ƒì´ ì—´ë¦¬ë©° ê²€ì€ ì™¸íˆ¬ ìž…ì€ ì—¬ìž í•˜ë‚˜ê°€ íŒ”ì„ í—ˆìš°ì ê±°ë¦¬ë©° 뛰어나온다. 아마 ì†Œë¦¬ë„ ì¹˜ëŠ” 모양ì´ê² ì§€ë§ˆëŠ” ê·¸ 소리는 아니 들렸다. 나는 ê·¸ê²ƒì´ ìˆœìž„ì¸ ì¤„ì„ ì–¼ë¥¸ 알았다. ë˜ ìˆœìž„ì´ë°–ì— ë  ì‚¬ëžŒë„ ì—†ì—ˆë‹¤. +ìˆœìž„ì€ í•œì°¸ 달ìŒë°•ì§ˆë¡œ 오다가 ëˆˆì´ ê¹Šì–´ì„œ 걸ìŒì„ 걷기가 íž˜ì´ ë“œëŠ”ì§€ 멈칫 섰다. ê·¸ì˜ ê²€ì€ ì™¸íˆ¬ëŠ” ì–´ëŠë§ í° ì ìœ¼ë¡œ 얼려져 가지고 어깨는 í¬ê²Œ ë˜ëŠ” ê²ƒì´ ë³´ì˜€ë‹¤. +ìˆœìž„ì˜ ê°¸ë¦„í•œ ì–¼êµ´ì´ ë³´ì˜€ë‹¤. +"ì„ ìƒë‹˜!" +하고 ìˆœìž„ë„ ë‚˜ë¥¼ 알아보고는 ë˜ íŒ”ì„ í—ˆìš°ì ê±°ë¦¬ë©° 소리를 질렀다. +ë‚˜ë„ ë°˜ê°€ì›Œì„œ 모ìžë¥¼ ë²—ì–´ 둘렀다. +"ì•„ì´ ì„ ìƒë‹˜!" +하고 ìˆœìž„ì€ ë‚´ê°€ ì°ë§¤ì—ì„œ ì¼ì–´ì„œê¸°ë„ ì „ì— ë‚´ê²Œ 와서 매달리며 울었다. +"아버지 ì–´ë– ì‹œëƒ?" +하고 나는 ìˆœìž„ì˜ ë“±ì„ ë‘드렸다. 나는 다리가 마비가 ë˜ì–´ì„œ 곧 ì¼ì–´ì„¤ 수가 없었다. +"아버지 ì–´ë– ì‹œëƒ?" +하고 나는 í•œ 번 ë” ë¬¼ì—ˆë‹¤. +ìˆœìž„ì€ ë²Œë–¡ ì¼ì–´ë‚˜ ë‘ ì£¼ë¨¹ìœ¼ë¡œ í르는 ëˆˆë¬¼ì„ ì³ë‚´ 버리며, +"대단하셔요." +í•˜ê³ ë„ ìš¸ìŒì„ 금치 못하였다. +노파는 ë²Œì¨ ì°ë§¤ì—ì„œ 내려서 기운 없는 걸ìŒìœ¼ë¡œ 비틀비틀 걷기를 시작하였다. +나는 ìˆœìž„ì„ ë”°ë¼ì„œ ì–¸ë•ì„ 오르며, +"그래 무슨 병환ì´ì‹œëƒ?" +하고 물었다. +"몰ë¼ìš”. ì‹ ì—´ì´ ëŒ€ë‹¨í•˜ì…”ìš”." +"ì •ì‹ ì€ ì°¨ë¦¬ì‹œë“ ?" +"ì²˜ìŒ ì œê°€ 여기 ì™”ì„ ì ì—는 그렇지 ì•Šë”니 요새ì—는 ê°€ë” í˜¼ìˆ˜ ìƒíƒœì— 빠지시는 모양ì´ì•¼ìš”." +ì´ë§Œí•œ 지ì‹ì„ 가지고 나는 최ì„ì´ê°€ 누워 있는 집 ì•žì— ë‹¤ë‹¤ëžë‹¤. +ì´ ì§‘ì€ í†µë‚˜ë¬´ë¥¼ 댓 ê°œ 우물 ì •ìžë¡œ 가로놓고 ì§€ë¶•ì€ ë¬´ì—‡ìœ¼ë¡œ 했는지 모르나 ëˆˆì´ ë®ì´ê³ , 문 하나 ì°½ 하나를 ë‚´ì—ˆëŠ”ë° ë¬¸ì€ ë‚˜ë¬´ê»ì§ˆì¸ 모양ì´ë‚˜ ì°½ì€ ì –ë¹› 나는 ìœ ë¦¬ì°½ì¸ ì¤„ 알았ë”니 ë’¤ì— ì•Œì•„ë³¸ì¦‰ ê·¸ê²ƒì€ ìœ ë¦¬ê°€ 아니요, ì–‘ëª©ì„ ë°”ë¥´ê³  ë¬¼ì„ ë¿œì–´ì„œ 얼려 ë†“ì€ ê²ƒì´ì—ˆë‹¤. 그리고 통나무와 통나무 틈바구니ì—는 쇠털과 ê°™ì€ ë§ˆë¥¸ í’€ì„ ê¼­ê¼­ ë°•ì•„ì„œ ë°”ëžŒì„ ë§‰ì•˜ë‹¤. +ë¬¸ì„ ì—´ê³  들어서니 ë¶€ì—Œì— ë“¤ì–´ì„œëŠ” 모양으로 ì‘¥ ë¹ ì¡ŒëŠ”ë° í™”ëˆí™”ëˆí•˜ëŠ” ê²ƒì´ í•œì¦ê³¼ 같다. 그렇지 ì•Šì•„ë„ ì¹¨ì¹¨í•œ ë‚ ì— ì–¸ 눈으로 ê´‘ì„  부족한 ë°©ì— ë“¤ì–´ì˜¤ë‹ˆ, 캄캄 절벽ì´ì–´ì„œ ì•„ë¬´ê²ƒë„ ë³´ì´ì§€ 아니하였다. +순임ì´ê°€ 앞서서 ì–‘ì´ˆì— ë¶ˆì„ ì¼ ë‹¤. 촛불 ë¹›ì€ ë°© 한편 쪽 침대ë¼ê³  í•  만한 ë†’ì€ ê³³ì— ë‹´ìš”ë¥¼ ë®ê³  누운 최ì„ì˜ ì‹œì²´ì™€ ê°™ì€ í° ì–¼êµ´ì„ ë¹„ì¶˜ë‹¤. +"아버지, 아버지 샌전 아저씨 오셨어요." +하고 ìˆœìž„ì€ ìµœì„ì˜ ê·€ì— ìž…ì„ ëŒ€ê³  가만히 불렀다. +그러나 ëŒ€ë‹µì´ ì—†ì—ˆë‹¤. +나는 최ì„ì˜ ì´ë§ˆë¥¼ 만져 보았다. 축축하게 ë•€ì´ í˜ë €ë‹¤. 그러나 그리 ë”ìš´ ì¤„ì€ ëª°ëžë‹¤. +ë°© ì•ˆì˜ ê³µê¸°ëŠ” ìˆ¨ì´ ë§‰íž ë“¯í•˜ì˜€ë‹¤. ê·¸ 난방 장치는 ì‚¼êµ¿ì˜ ì›ë¦¬ë¥¼ ì´ìš©í•œ 것ì´ì—ˆë‹¤. ëŒë©©ì´ë¡œ ì•„ê¶ì´ë¥¼ 쌓고 ê·¸ ìœ„ì— í° ëŒë©©ì´ë“¤ì„ ë§Žì´ ìŒ“ê³  거기다가 ë¶ˆì„ ë•Œì–´ì„œ 달게 í•œ ë’¤ì— ê±°ê¸° ëˆˆì„ ë¶€ì–´ 뜨거운 ì¦ê¸°ë¥¼ 발하는 것ì´ì—ˆë‹¤. +ì´ ê±´ì¶•ë²•ì€ ì¡°ì„  ë™í¬ë“¤ì´ 시베리아로 ê¸ˆê´‘ì„ ì°¾ì•„ë‹¤ë‹ˆë©´ì„œ 하는 법ì´ëž€ ë§ì„ 들었으나 최ì„ì´ê°€ 누구ì—게서 배워 가지고 ì–´ë–¤ 모양으로 지었는지는 최ì„ì˜ ë§ì„ 듣기 ì „ì—는 ì•Œ 수 없는 ì¼ì´ë‹¤. +나는 ë‚´ íž˜ì´ ë¯¸ì¹˜ëŠ” ë°ê¹Œì§€ 최ì„ì˜ ë³‘ ì¹˜ë£Œì— ëŒ€í•œ ì†ì„ ì“°ê³  어떻게 해서든지 ì´ë¥´ì¿ ì¸ í¬ì˜ 병ì›ìœ¼ë¡œ 최ì„ì„ ë°ë ¤ë‹¤ê°€ ìž…ì›ì‹œí‚¬ ë„리를 ê¶ë¦¬í•˜ì˜€ë‹¤. 그러나 냉정하게 ìƒê°í•˜ë©´ 최ì„ì€ ì‚´ì•„ë‚  ê°€ë§ì´ 없는 것만 같았다. +ë‚´ê°€ ê°„ 지 ì‚¬í˜ ë§Œì— ìµœì„ì€ ì²˜ìŒìœ¼ë¡œ ì •ì‹ ì„ ì°¨ë ¤ì„œ ëˆˆì„ ëœ¨ê³  나를 알아보았다. +그는 반가운 í‘œì •ì„ í•˜ê³  빙그레 웃기까지 하였다. +"다 ì¼ì—†ë‚˜?" +ì´ëŸ° ë§ë„ ì•Œì•„ë“¤ì„ ìˆ˜ê°€ 있었다. +그러나 심히 ê¸°ìš´ì´ ì—†ëŠ” 모양ì´ê¸°ë¡œ 나는 ë§Žì´ ë§ì„ 하지 아니하였다. +최ì„ì€ í•œì°¸ì´ë‚˜ ëˆˆì„ ê°ê³  있ë”니, +"ì •ìž„ì´ ì†Œì‹ ë“¤ì—ˆë‚˜?" +하였다. +"괜찮대요." +하고 ê³ì—ì„œ 순임ì´ê°€ ë§í•˜ì˜€ë‹¤. +그리고는 ë˜ í˜¼ëª½í•˜ëŠ” 듯하였다. +ê·¸ ë‚  ë˜ í•œ 번 최ì„ì€ ì •ì‹ ì„ ì°¨ë¦¬ê³  순임ë”러는 저리로 ê°€ë¼ëŠ” ëœ»ì„ í‘œí•˜ê³  나ë”러 귀를 ê°€ê¹Œì´ ëŒ€ë¼ëŠ” ëœ»ì„ ë³´ì´ê¸°ë¡œ 그대로 하였ë”니, +"ë‚´ 가방 ì†ì— ì¼ê¸°ê°€ 있으니 그걸 ìžë„¤ë§Œ 보고는 ë¶ˆì‚´ë¼ ë²„ë ¤. ë‚´ê°€ ì£½ì€ ë’¤ì—ë¼ë„ ê·¸ê²ƒì´ ì„¸ìƒ ì‚¬ëžŒì˜ ëˆˆì— ë“¤ë©´ 안 ë˜ì§€. 순임ì´ê°€ 볼까 ê±±ì •ì´ ë˜ì§€ë§ˆëŠ” ë‚´ê°€ ëª¸ì„ ê¼¼ì§í•  수가 있나." +하는 ëœ»ì„ ë§í•˜ì˜€ë‹¤. +"그러지." +하고 나는 고개를 ë„ë•ì—¬ 보였다. +그러고 ë‚œ ë’¤ì— ë‚˜ëŠ” 최ì„ì´ê°€ 시킨 대로 ê°€ë°©ì„ ì—´ê³  ì±…ë“¤ì„ ë’¤ì ¸ì„œ ê·¸ ì¼ê¸°ì±…ì´ë¼ëŠ” ê³µì±…ì„ êº¼ë‚´ì—ˆë‹¤. +"ìˆœìž„ì´ ë„ˆ ì´ê±° 보았니?" +하고 나는 ê³ì—ì„œ ë‚´ê°€ ì±… 찾는 ê²ƒì„ ë³´ê³  ì„°ë˜ ìˆœìž„ì—게 물었다. +"아니오. 그게 무어여요?" +하고 ìˆœìž„ì€ ë‚´ ì†ì— ë“  ì±…ì„ ë¹¼ì•—ìœ¼ë ¤ëŠ” ë“¯ì´ ì†ì„ 내밀었다. +나는 ìˆœìž„ì˜ ì†ì´ 닿지 ì•Šë„ë¡ ì±…ì„ í•œíŽ¸ìœ¼ë¡œ 비키며, +"ì´ê²ƒì´ 네 아버지 ì¼ê¸°ì¸ 모양ì¸ë° 너는 ë³´ì´ì§€ ë§ê³  나만 ë³´ë¼ê³  하셨다. 네 아버지가 네가 ì´ê²ƒì„ 보았ì„까 í•´ì„œ 염려를 í•˜ì‹œëŠ”ë° ì•ˆ 보았으면 다행ì´ë‹¤." +하고 나는 ê·¸ ì±…ì„ ë“¤ê³  밖으로 나왔다. +ë‚ ì´ ë°ë‹¤. 해는 ì¤‘ì²œì— ìžˆë‹¤. 중천ì´ëž˜ì•¼ ì € 남쪽 지í‰ì„  가까운 ë°ë‹¤. ë°¤ì´ ì—´ì—¬ëŸ ì‹œê°„, ë‚®ì´ ëŒ€ì—¬ì„¯ ì‹œê°„ë°–ì— ì•ˆ ë˜ëŠ” ë¶ìª½ 나ë¼ë‹¤. 멀건 햇빛ì´ë‹¤. +나는 ë³•ì´ ìž˜ 드는 ê³³ì„ ê³¨ë¼ì„œ ë‚˜ë¬´ì— ëª¸ì„ ê¸°ëŒ€ê³  최ì„ì˜ ì¼ê¸°ë¥¼ ì½ê¸° 시작하였다. ì½ì€ 중ì—ì„œ 몇 êµ¬ì ˆì„ ê³¨ë¼ ë³¼ê¹Œ. +"ì§‘ì´ ë‹¤ ë˜ì—ˆë‹¤. ì´ ì§‘ì€ ë‚´ê°€ ìƒì „ ì‚´ê³  ê·¸ ì†ì—ì„œ ì´ ì„¸ìƒì„ 마칠 집ì´ë‹¤. 마ìŒì´ 기ì˜ë‹¤. ì‹œë„러운 세ìƒì€ 여기서 멀지 아니하ëƒ. ë‚´ê°€ 여기 홀로 있기로 누가 ì°¾ì„ ì‚¬ëžŒë„ ì—†ì„ ê²ƒì´ë‹¤. ë‚´ê°€ 여기서 죽기로 누가 슬í¼í•´ 줄 ì‚¬ëžŒë„ ì—†ì„ ê²ƒì´ë‹¤. 때로 ê³°ì´ë‚˜ 찾아올까. ì§€ë‚˜ê°€ë˜ ì‚¬ìŠ´ì´ë‚˜ 들여다볼까. +ì´ê²ƒì´ ë‚´ 소ì›ì´ 아니ëƒ. 세ìƒì˜ ì‹œë„ëŸ¬ì›€ì„ ë– ë‚˜ëŠ” ê²ƒì´ ë‚´ 소ì›ì´ 아니ëƒ. ì´ ì†ì—ì„œ 나는 나를 ì´ê¸°ê¸°ë¥¼ 공부하ìž." +ì²«ë‚ ì€ ì´ëŸ° í‰ë²”í•œ 소리를 ì¼ë‹¤. +ê·¸ ì´íŠ¿ë‚ ì—는. +"어떻게나 나는 약한 사람ì¸ê³ . ì œ 마ìŒì„ 제가 지배하지 못하는 사람ì¸ê³ . 밤새ë„ë¡ ë‚˜ëŠ” ì •ìž„ì„ ìƒê°í•˜ì˜€ë‹¤. ì–´ë‘ìš´ í—ˆê³µì„ í–¥í•˜ì—¬ ì •ìž„ì„ ë¶ˆë €ë‹¤. ì •ìž„ì´ê°€ 나를 찾아서 ë™ê²½ì„ 떠나서 ì´ë¦¬ë¡œ 오지나 아니하나 하고 ìƒê°í•˜ì˜€ë‹¤. 어떻게나 부ë„러운 ì¼ì¸ê³ ? 어떻게나 ê°€ì¦í•œ ì¼ì¸ê³ ? +나는 아내를 ìƒê°í•˜ë ¤ 하였다. ì•„ì´ë“¤ì„ ìƒê°í•˜ë ¤ 하였다. 아내와 ì•„ì´ë“¤ì„ ìƒê°í•¨ìœ¼ë¡œ ì •ìž„ì˜ ìƒê°ì„ ì´ê¸°ë ¤ 하였다. +최ì„ì•„, 너는 ë‚¨íŽ¸ì´ ì•„ë‹ˆëƒ. 아버지가 아니ëƒ. ì •ìž„ì€ ë„¤ ë”¸ì´ ì•„ë‹ˆëƒ. ì´ëŸ° ìƒê°ì„ 하였다. +ê·¸ëž˜ë„ ì •ìž„ì˜ ì¼ë¥˜ì „ì€ ì•„ë‚´ì™€ ì•„ì´ë“¤ì˜ ìƒê°ì„ 밀치고 달려오는 절대 ìœ„ë ¥ì„ ê°€ì§„ 듯하였다. +ì•„, 나는 어떻게나 파렴치한 사람ì¸ê³ . ë‚˜ì´ ì‚¬ì‹­ì´ ë„˜ì–´ ì˜¤ì‹­ì„ ë°”ë¼ë³´ëŠ” ë†ˆì´ ì•„ë‹ˆëƒ. ì‚¬ì‹­ì— ë¶ˆí˜¹ì´ë¼ê³  아니 하ëŠëƒ. êµìœ¡ê°€ë¡œ 깨ë—í•œ êµì¸ìœ¼ë¡œ ì¼ìƒì„ ì‚´ì•„ 왔다고 ìžì²˜í•˜ëŠ” ë‚´ê°€ ì•„ë‹ˆëƒ í•˜ê³  나는 ë‚´ 입으로 ë‚´ ì†ê°€ë½ì„ 물어서 ë‘ êµ°ë°ë‚˜ 피를 내었다." +최ì„ì˜ ë‘˜ì§¸ ë‚  ì¼ê¸°ëŠ” 계ì†ëœë‹¤. +"ë‚´ ì†ê°€ë½ì—ì„œ 피가 ë‚  ë•Œì— ë‚˜ëŠ” 유쾌하였다. 나는 ìŠ¹ì²©ì˜ ê¸°ì¨ì„ 깨달았다. +그러나 ì•„ì•„ 그러나 ê·¸ 빨간, ì°¸íšŒì˜ í•ë°©ìš¸ ì†ì—ì„œë„ ì• ìš•ì˜ ë¶ˆê¸¸ì´ ì¼ì§€ 아니하는가. 나는 마침내 ì œë„í•  수 없는 ì¸ìƒì¸ê°€." +ì´ ì§‘ì— ë“  지 ë‘˜ì§¸ë‚ ì— ë²Œì¨ ì´ëŸ¬í•œ ë¹„ê´€ì  ë§ì„ 하였다. +ë˜ ë©°ì¹ ì„ ì§€ë‚œ ë’¤ ì¼ê¸°ì—, +"나는 ë™ê²½ìœ¼ë¡œ ëŒì•„가고 싶다. ì •ìž„ì˜ ê³ìœ¼ë¡œ 가고 싶다. 시베리아ì˜ê´‘ì•¼ì˜ ìœ í˜¹ë„ ì•„ë¬´ íž˜ì´ ì—†ë‹¤. ì–´ì ¯ë°¤ì€ ì‚¼ë¦¼ì˜ ì¢‹ì€ ë‹¬ì„ ë³´ì•˜ìœ¼ë‚˜ ê·¸ ë‹¬ì„ ì•„ë¦„ë‹µê²Œ ë³´ë ¤ 하였으나 아무리 í•˜ì—¬ë„ ì•„ë¦„ë‹µê²Œ ë³´ì´ì§€ë¥¼ 아니하였다. +하늘ì´ë‚˜ 달ì´ë‚˜ 삼림ì´ë‚˜ ëª¨ë‘ ë¬´ì˜ë¯¸í•œ 존재다. ì´ì²˜ëŸ¼ 무ì˜ë¯¸í•œ 존재를 나는 경험한 ì¼ì´ 없다. ê·¸ê²ƒì€ ë‹¤ë§Œ 기ì¨ì„ ìžì•„내지 아니할 ë¿ë”러 ìŠ¬í””ë„ ìžì•„내지 못하였다. ê·¸ê²ƒì€ ìž¿ë”미였다. ì•„ë¬´ë„ ë“£ëŠ” ì´ ì—†ëŠ” ë°ì„œ ë‚´ ì§„ì •ì„ ë§í•˜ë¼ë©´ ê·¸ê²ƒì€ ì´ ì²œì§€ì— ë‚´ê²Œ ì˜ë¯¸ 있는 ê²ƒì€ ì •ìž„ì´ë°–ì— ì—†ë‹¤ëŠ” 것ì´ë‹¤. +나는 ì •ìž„ì˜ ê³ì— 있고 싶다. ì •ìž„ì„ ë‚´ ê³ì— ë‘ê³  싶다. 왜? ê·¸ê²ƒì€ ë‚˜ë„ ëª¨ë¥¸ë‹¤. +ë§Œì¼ ì´ ì›€ ì†ì—ë¼ë„ ì •ìž„ì´ê°€ 있다 하면 얼마나 ì´ê²ƒì´ ì¦ê±°ìš´ ê³³ì´ ë ê¹Œ. +그러나 ì´ê²ƒì€ 불가능한 ì¼ì´ë‹¤. ì´ ì¼ì´ 있어서는 아니 ëœë‹¤. 나는 ì´ ìƒê°ì„ 죽여야 한다. 다시 ê±°ë‘를 못 하ë„ë¡ ëª©ìˆ¨ì„ ëŠì–´ 버려야 한다. +ì´ê²ƒì„ 나는 ì›í•œë‹¤. ì›í•˜ì§€ë§ˆëŠ” 내게는 ê·¸ íž˜ì´ ì—†ëŠ” 모양ì´ë‹¤. +나는 종êµë¥¼ ìƒê°í•˜ì—¬ 본다. ì² í•™ì„ ìƒê°í•˜ì—¬ 본다. ì¸ë¥˜ë¥¼ ìƒê°í•˜ì—¬ 본다. 나ë¼ë¥¼ ìƒê°í•˜ì—¬ 본다. ì´ê²ƒì„ 가지고 ë‚´ ì• ìš•ê³¼ 바꾸려고 ì• ì¨ ë³¸ë‹¤. 그렇지마는 내게 그러한 íž˜ì´ ì—†ë‹¤. 나는 완전히 í—¬í”Œë¦¬ìŠ¤í•¨ì„ ê¹¨ë‹«ëŠ”ë‹¤. +ì•„ì•„ 나는 어찌할꼬? +나는 못ìƒê¸´ 사람ì´ë‹¤. 그까짓 ê²ƒì„ ëª» ì´ê²¨? 그까짓 ê²ƒì„ ëª» ì´ê²¨? +나는 ì˜ˆìˆ˜ì˜ ê´‘ì•¼ì—ì„œì˜ ìœ í˜¹ì„ ìƒê°í•œë‹¤. 천하를 주마 하는 ìœ í˜¹ì„ ìƒê°í•œë‹¤. 나는 싯다르타 태ìžê°€ 왕ê¶ì„ 버리고 나온 ê²ƒì„ ìƒê°í•˜ê³ , ë˜ ìŠ¤í† ì•„ ì² í•™ìžì˜ ì˜ì§€ë ¥ì„ ìƒê°í•˜ì˜€ë‹¤. +그러나 나는 그러한 ìƒê°ìœ¼ë¡œë„ ì´ ìƒê°ì„ ì´ê¸¸ 수가 없는 것 같다. +나는 í˜ëª…가를 ìƒê°í•˜ì˜€ë‹¤. 모든 것 ì‚¬ëž‘ë„ ëª©ìˆ¨ë„ ë‹¤ 헌신ì§ê°™ì´ 집어ë˜ì§€ê³  피 í르는 마당으로 뛰어나가는 용사를 ìƒê°í•˜ì˜€ë‹¤. 나는 ì´ë없는 삼림 ì†ìœ¼ë¡œ í˜ëª…ì˜ ìš©ì‚¬ 모양으로 달ìŒë°•ì§ˆì¹˜ë‹¤ê°€ ê¸°ìš´ì´ ì§„í•œ ê³³ì—ì„œ 죽어 버리는 ê²ƒì´ ì†Œì›ì´ì—ˆë‹¤. 그러나 ê±°ê¸°ê¹Œì§€ë„ ì´ ìƒê°ì€ 따르지 아니할까. +나는 지금 곧 죽어 버릴까. 나는 육혈í¬ë¥¼ ì†ì— 들어 보았다. ì´ ë°©ì•„ì‡ ë¥¼ í•œ 번만 튕기면 ë‚´ ìƒëª…ì€ ì—†ì–´ì§€ëŠ” ê²ƒì´ ì•„ë‹Œê°€. 그리 ë˜ë©´ 모든 ì´ ë§ˆìŒì˜ 움ì§ìž„ì€ ì†Œë©¸ë˜ëŠ” ê²ƒì´ ì•„ë‹Œê°€. ì´ê²ƒìœ¼ë¡œ 만사가 í•´ê²°ë˜ëŠ” ê²ƒì´ ì•„ë‹Œê°€. +ì•„ 하나님ì´ì‹œì—¬, íž˜ì„ ì£¼ì‹œì˜µì†Œì„œ. 천하를 ì´ê¸°ëŠ” íž˜ë³´ë‹¤ë„ ë‚˜ ìžì‹ ì„ ì´ê¸°ëŠ” íž˜ì„ ì£¼ì‹œì˜µì†Œì„œ. ì´ ì£„ì¸ìœ¼ë¡œ 하여금 í•˜ë‚˜ë‹˜ì˜ ëˆˆì— ì˜ë¡­ê³  깨ë—í•œ 사람으로 ì´ ì¼ìƒì„ 마치게 하여 주시옵소서, ì´ë ‡ê²Œ 나는 기ë„를 한다. +그러나 하나님께서는 나를 버리셨다. 하나님께서는 내게 íž˜ì„ ì£¼ì‹œì§€ 아니하시었다. 나를 ì´ ë¹„ì°¸í•œ ìžë¦¬ì—ì„œ ì©ì–´ì ¸ 죽게 하시었다." +최ì„ì€ ì–´ë–¤ ë‚  ì¼ê¸°ì— ë˜ ì´ëŸ° ê²ƒë„ ì¼ë‹¤. ê·¸ê²ƒì€ ì˜ˆì „ 내게 보낸 íŽ¸ì§€ì— ìžˆë˜ ê¿ˆ ì´ì•¼ê¸°ë¥¼ ì—°ìƒì‹œí‚¤ëŠ” 것ì´ì—ˆë‹¤. ê·¸ê²ƒì€ ì´ëŸ¬í•˜ë‹¤. +"오늘 ë°¤ì€ ë‹¬ì´ ì¢‹ë‹¤. ì‹œë² ë¦¬ì•„ì˜ ê²¨ìš¸ 해는 ì°¸ 못ìƒê¸´ ì‚¬ëžŒê³¼ë„ ê°™ì´ ê¸°ìš´ì´ ì—†ì§€ë§ˆëŠ” 하얀 ë•…, 검푸른 í•˜ëŠ˜ì— ì €ìª½ 지í‰ì„ ì„ 향하고 í˜ëŸ¬ê°€ëŠ” ë°˜ë‹¬ì€ ì°¸ìœ¼ë¡œ ë§‘ìŒ ê·¸ê²ƒì´ì—ˆë‹¤. +나는 í‰ìƒ ì²˜ìŒ ì‹œ 비슷한 ê²ƒì„ ì§€ì—ˆë‹¤. +ìž„ê³¼ ì´ë³„í•˜ë˜ ë‚  ë°¤ì—는 남쪽 나ë¼ì— 바람비가 쳤네 +ìž„ 타신 ìžë™ì°¨ì˜ ë’·ë¶ˆì´ ë¹¨ê°„ ë’·ë¶ˆì´ ë¹—ë°œì— ì°¢ê²¼ë„¤ +ìž„ 떠나 í˜¼ìž í—¤ë§¤ëŠ” ì‹œë² ë¦¬ì•„ì˜ ì˜¤ëŠ˜ ë°¤ì—는 +지려는 ìª½ë‹¬ì´ ëˆˆ ë®ì¸ ì‚¼ë¦¼ì— ê±¸ë ¸êµ¬ë‚˜ +ì•„ì•„ ì € 쪽달ì´ì—¬ +억지로 ë°˜ì„ ê°ˆê²¨ì§„ ê²ƒë„ ê°™ì•„ë¼ +ì•„ì•„ ì € 쪽달ì´ì—¬ +잃어진 ì§ì„ 찾아 +차디찬 허공 ì†ì„ ì˜ì›ížˆ 헤매는 ê²ƒë„ ê°™êµ¬ë‚˜ +ë‚˜ë„ ì € 달과 ê°™ì´ ìžƒì–´ë²„ë¦° ë°˜ìª½ì„ ì°¾ì•„ 무ê¶í•œ 시간과 공간ì—ì„œ 헤매는 것만 같다. +ì—ìµ. ë‚´ê°€ 왜 ì´ë¦¬ 약한가. 어찌하여 í¬ë‚˜í° ë§Žì€ ì¼ì„ ëŒì•„보지 못하고 요만한 ì• ìš•ì˜ í¬ë¡œê°€ ë˜ëŠ”ê°€. +그러나 나는 차마 ê·¸ ë‹¬ì„ ë²„ë¦¬ê³  들어올 수가 없었다. ë‚´ê°€ 왜 ì´ë ‡ê²Œ 센티멘털하게 ë˜ì—ˆëŠ”ê³ . ë‚´ 쇠 ê°™ì€ ì˜ì§€ë ¥ì´ 어디로 갔는고. ë‚´ 누를 수 없는 ìžì¡´ì‹¬ì´ 어디로 갔는고. 나는 마치 ìœ ëª¨ì˜ ì†ì— 달린 젖먹ì´ì™€ë„ 같다. ë‚´ ì¼ì‹ ì€ ë„ì‹œ ì• ìš• ë©ì–´ë¦¬ë¡œ 화해 버린 것 같다. +ì´ë¥¸ë°” 사랑 사랑ì´ëž€ ë§ì€ 종êµì  ì˜ë¯¸ì¸ 것 ì´ì™¸ì—ë„ ìž…ì— ë‹´ê¸°ë„ ì‹«ì–´í•˜ë˜ ë§ì´ë‹¤ ì´ëŸ° ê²ƒì€ ë‚´ ì˜ì§€ë ¥ê³¼ ìžì¡´ì‹¬ì„ 녹여 버렸는가. ë˜ ì´ ë¶€ìžì—°í•œ ê³ ë…ì˜ ìƒí™œì´ 나를 ì´ë ‡ê²Œ ë‚´ ì¸ê²©ì„ ì´ë ‡ê²Œ 파괴하였는가. +그렇지 아니하면 ë‚´ ìžì¡´ì‹¬ì´ë¼ëŠ” 것ì´ë‚˜, ì˜ì§€ë ¥ì´ë¼ëŠ” 것ì´ë‚˜, ì¸ê²©ì´ë¼ëŠ” ê²ƒì´ ëª¨ë‘ ì„¸ìƒì˜ 습관과 ì‚¬ì¡°ì— íœ©ì“¸ë¦¬ë˜ ê²ƒì¸ê°€. ë‚¨ë“¤ì´ ê·¸ëŸ¬ë‹ˆê¹Œ ë‚¨ë“¤ì´ ì˜³ë‹¤ë‹ˆê¹Œ ë‚¨ë“¤ì´ ë¬´ì„œìš°ë‹ˆê¹Œ ì´ ì• ìš•ì˜ ë¬´ë¤ì— 회를 ë°œëžë˜ 것ì¸ê°€. 그러다가 ê³ ë…ê³¼ ë°˜ì„±ì˜ ê¸°íšŒë¥¼ 얻으매 모든 회칠과 ê°€ë©´ì„ ë–¼ì–´ 버리고 ë¹¨ê°€ë²—ì€ ì• ìš•ì˜ ë­‰í……ì´ê°€ 나온 것ì¸ê°€. +그렇다 하면, ì´ê²ƒì´ ì°¸ëœ ë‚˜ì¸ê°€. ì´ê²ƒì´ 하나님께서 지어 주신 ëŒ€ë¡œì˜ ë‚˜ì¸ê°€. ê°€ìŠ´ì— íƒ€ì˜¤ë¥´ëŠ” ì• ìš•ì˜ ë¶ˆê¸¸ ì´ ë¶ˆê¸¸ì´ ê³§ ë‚´ ì˜í˜¼ì˜ 불길ì¸ê°€. +어쩌면 ê·¸ 모든 ë†’ì€ ì´ìƒë“¤ ì¸ë¥˜ì— 대한, ë¯¼ì¡±ì— ëŒ€í•œ, ë„ë•ì— 대한, ì‹ ì•™ì— ëŒ€í•œ ê·¸ ë†’ì€ ì´ìƒë“¤ì´ ì´ë ‡ê²Œë„ 만만하게 마치 ë°”ëžŒì— ë¶ˆë¦¬ëŠ” 재 모양으로 ìžì·¨ë„ ì—†ì´ í©ì–´ì ¸ 버리고 ë§ê¹Œ. 그리고 ê·¸ ë’¤ì—는 í‰ì†Œì—ê·¸ë ‡ê²Œë„ ë¯¸ì›Œí•˜ê³  천히 ì—¬ê¸°ë˜ ì• ìš•ì˜ ê²€ì€ í™ë§Œ 남고 ë§ê¹Œ. +ì•„ì•„ ì € 눈 ë®ì¸ ë•…ì´ì—¬, 차고 ë§‘ì€ ë‹¬ì´ì—¬, 허공ì´ì—¬! 나는 너í¬ë“¤ì„ 부러워하노ë¼. +불êµë„ë“¤ì˜ í•´íƒˆì´ë¼ëŠ” ê²ƒì´ ì´ëŸ¬í•œ ì• ìš•ì´ ë¶ˆë¶™ëŠ” 지옥ì—ì„œ 눈과 ê°™ì´ ì‹¸ëŠ˜í•˜ê³  허공과 ê°™ì´ ë¹ˆ 곳으로 들어ê°ì„ ì´ë¦„ì¸ê°€. +ì„ê°€ì˜ íŒ” ë…„ ê°„ 설산 ê³ í–‰ì´ ì´ ì• ìš•ì˜ ë¿Œë¦¬ë¥¼ ëŠìœ¼ë ¤ 함ì´ë¼ 하고 ì˜ˆìˆ˜ì˜ ì‚¬ì‹­ ì¼ ê´‘ì•¼ì˜ ê³ í–‰ê³¼ ê²Ÿì„¸ë§ˆë„¤ì˜ ê³ ë¯¼ë„ ì´ ì• ìš•ì˜ ë¿Œë¦¬ 때문ì´ì—ˆë˜ê°€. +그러나 ê·¸ê²ƒì„ ì´ê¸°ì–´ 낸 ì‚¬ëžŒì´ ì²œì§€ 개벽 ì´ëž˜ì— 몇몇ì´ë‚˜ ë˜ì—ˆëŠ”ê³ ? 나 ê°™ì€ ê²ƒì´ ê·¸ ì¤‘ì— í•œ 사람 ë˜ê¸°ë¥¼ 바랄 수가 있ì„까. +나 같아서는 마침내 ì´ ì• ìš•ì˜ ë¶ˆê¸¸ì— ë‹¤ 타서 재가 ë˜ì–´ 버릴 것만 같다. ì•„ì•„ 어떻게나 힘있고 무서운 불길ì¸ê³ ." +ì´ëŸ¬í•œ ê³ ë¯¼ì˜ ìžë°±ë„ 있었다. +ë˜ ì–´ë–¤ ë‚  ì¼ê¸°ì—는 최ì„ì€ ì´ëŸ° ë§ì„ ì¼ë‹¤. +"나는 단연히 ë™ê²½ìœ¼ë¡œ ëŒì•„가기를 결심하였다." +그리고는 ê·¸ ì´íŠ¿ë‚ ì€, +"나는 단연히 ë™ê²½ìœ¼ë¡œ ëŒì•„가리란 ê²°ì‹¬ì„ í•œ ê²ƒì„ êµ³ì„¸ê²Œ 취소한다. 나는 ì´ëŸ¬í•œ ê²°ì‹¬ì„ í•˜ëŠ” 나 ìžì‹ ì„ 굳세게 부ì¸í•œë‹¤." +ë˜ ì´ëŸ° ë§ë„ 있다. +"나는 ì •ìž„ì„ ì‹œë² ë¦¬ì•„ë¡œ 부르련다." +ë˜ ê·¸ 다ìŒì—는, +"ì•„ì•„ 나는 í•˜ë£¨ë°”ì‚ ì£½ì–´ì•¼ 한다. ì´ ëª©ìˆ¨ì„ ì—°ìž¥í•˜ì˜€ë‹¤ê°€ëŠ” 무슨 ì¼ì„ 저지를는지 모른다. 나는 깨ë—하게 나를 ì´ê¸°ëŠ” ë„ë•ì  ì¸ê²©ìœ¼ë¡œ ì´ ì¼ìƒì„ 마ì³ì•¼ 한다. ì´ ë°–ì— ë‚´ ì‚¬ì—…ì´ ë¬´ì—‡ì´ëƒ." +ë˜ ì–´ë–¤ ê³³ì—는, +"ì•„ì•„ 무서운 하룻밤ì´ì—ˆë‹¤. 나는 지난 í•˜ë£»ë°¤ì„ ëˆ„ë¥¼ 수 없는 ì• ìš•ì˜ ë¶ˆê¸¸ì— íƒ”ë‹¤. 나는 ë‚´ 주먹으로 ë‚´ ê°€ìŠ´ì„ ë‘드리고 머리를 ë²½ì— ë¶€ë”ªì³¤ë‹¤. 나는 주먹으로 ë‹´ë²½ì„ ë‘드려 ì†ë“±ì´ 터져서 피가 í˜ë €ë‹¤. 나는 ë‚´ 머리카ë½ì„ ì¥ì–´ëœ¯ì—ˆë‹¤. 나는 ìˆ˜ì—†ì´ ë°œì„ êµ´ë €ë‹¤. 나는 ì´ ë¬´ì„œìš´ ìœ í˜¹ì„ ì´ê¸°ë ¤ê³  ë‚´ ëª¸ì„ ì•„í”„ê²Œ 하였다. 나는 견디다 못하여 ë¬¸ì„ ë°•ì°¨ê³  뛰어나갔다. ë°–ì—는 ë‹¬ì´ ìžˆê³  ëˆˆì´ ìžˆì—ˆë‹¤. 그러나 ëˆˆì€ í•ë¹›ì´ìš”, ë‹¬ì€ ì°Œê·¸ëŸ¬ì§„ 것 같았다. 나는 눈 ì†ìœ¼ë¡œ 달ìŒë°•ì§ˆì³¤ë‹¤. ë‹¬ì„ ë”°ë¼ì„œ 엎드러지며 ìžë¹ ì§€ë©° 달ìŒì§ˆì³¤ë‹¤. 나는 소리를 질렀다. 나는 미친 사람 같았다." +그러고는 어디까지 갔다가 ì–´ëŠ ë•Œì— ì–´ë– í•œ ì‹¬ê²½ì˜ ë³€í™”ë¥¼ 얻어 가지고 ëŒì•„왔다는 ë§ì€ ì“°ì´ì§€ 아니하였으나 최ì„ì˜ ë³‘ì˜ ì›ì¸ì„ 설명하는 것 같았다. +"ì—´ì´ ë‚˜ê³  ê¸°ì¹¨ì´ ë‚œë‹¤. ê°€ìŠ´ì´ ì•„í”„ë‹¤. ì´ê²ƒì´ íë ´ì´ ë˜ì–´ì„œ í˜¼ìž ê¹¨ë—하게 ì´ ìƒëª…ì„ ë§ˆì¹˜ê²Œ 하여 주소서 하고 빈다. 나는 오늘부터 먹고 마시기를 그치련다." +ì´ëŸ¬í•œ ë§ì„ ì¼ë‹¤. 그러고는, +"ì •ìž„, ì •ìž„, ì •ìž„, ì •ìž„." +하고 ì •ìž„ì˜ ì´ë¦„ì„ ìˆ˜ì—†ì´ ì“´ ê²ƒë„ ìžˆê³ , ì–´ë–¤ ë°ëŠ”, +"Overcome, Overcome." +하고 ì˜ì–´ë¡œ ì“´ ê²ƒë„ ìžˆì—ˆë‹¤. +그리고 마지막ì—, +"나는 죽ìŒê³¼ 대면하였다. 사í˜ì§¸ 굶고 ì•“ì€ ì˜¤ëŠ˜ì— ë‚˜ëŠ” 극히 맑고 침착한 정신으로 죽ìŒê³¼ 대면하였다. 죽ìŒì€ ê²€ì€ ì˜·ì„ ìž…ì—ˆìœ¼ë‚˜ ê·¸ 얼굴ì—는 ìžë¹„ì˜ í‘œì •ì´ ìžˆì—ˆë‹¤. 죽ìŒì€ 곧 ê²€ì€ ì˜·ì„ ìž…ì€ êµ¬ì›ì˜ ì†ì´ì—ˆë‹¤. 죽ìŒì€ 아름다운 그림ìžì˜€ë‹¤. 죽ìŒì€ 반가운 ì• ì¸ì´ìš”, ê²°ì½” 무서운 ì›ìˆ˜ê°€ 아니었다. 나는 죽ìŒì˜ ì†ì„ ìž¡ë…¸ë¼. ê°ì‚¬í•˜ëŠ” 마ìŒìœ¼ë¡œ 죽ìŒì˜ í’ˆì— ì•ˆê¸°ë…¸ë¼. 아멘." +ì´ê²ƒì„ ì“´ ë’¤ì—는 다시는 ì¼ê¸°ê°€ 없었다. ì´ê²ƒìœ¼ë¡œ 최ì„ì´ê°€ ê·¸ ë™ì•ˆ 지난 ì¼ì„ ì ì–´ë„ ì‹¬ë¦¬ì  ë³€í™”ë§Œì€ ëŒ€ê°• 추측할 수가 있었다. +다행히 최ì„ì˜ ë³‘ì€ ì ì  ëŒë¦¬ëŠ” 듯하였다. ì—´ë„ ë‚´ë¦¬ê³  ì‹ì€ë•€ë„ ëœ í˜ë ¸ë‹¤. 안 먹는다고 ê³ ì§‘í•˜ë˜ ìŒì‹ë„ 먹기를 시작하였다. +ì •ìž„ì—게로 ê°”ë˜ ë…¸íŒŒì—게서는 ì •ìž„ë„ ì—´ì´ ë‚´ë¦¬ê³  ì¼ì–´ë‚˜ ì•‰ì„ ë§Œí•˜ë‹¤ëŠ” 편지가 왔다. +나는 ë…¸íŒŒì˜ íŽ¸ì§€ë¥¼ 최ì„ì—게 ì½ì–´ 주었다. 최ì„ì€ ê·¸ 편지를 듣고 매우 í¥ë¶„하는 모양ì´ì—ˆìœ¼ë‚˜ 곧 안심하는 ë¹›ì„ ë³´ì˜€ë‹¤. +나는 최ì„ì˜ ë³‘ì´ ëŒë¦¬ëŠ” ê²ƒì„ ë³´ê³  ì •ìž„ì„ ì°¾ì•„ë³¼ 양으로 떠나려 하였으나 순임ì´ê°€ 듣지 아니하였다. 혼ìžì„œ 앓는 아버지를 맡아 가지고 ìžˆì„ ìˆ˜ëŠ” 없다는 것ì´ì—ˆë‹¤. 그래서 노파가 오기를 기다리기로 하였다. +나는 최ì„ì´ê°€ ë¨¹ì„ ìŒì‹ë„ ì‚´ 겸 우편국ì—ë„ ë“¤ë¥¼ 겸 시가까지 가기로 하고 ì´ ê³³ 온 지 ì¼ ì£¼ì¼ì´ë‚˜ 지나서 처ìŒìœ¼ë¡œ ì‚°ì—ì„œ 나왔다. +나는 ì´ë¥´ì¿ ì¸ í¬ì— 가서 최ì„ì„ ìœ„í•˜ì—¬ 약품과 ë¨¹ì„ ê²ƒì„ ì‚¬ê³  ë˜ ìˆœìž„ì„ ìœ„í•´ì„œë„ ë¨¹ì„ ê²ƒê³¼ ì˜ë³µê³¼ ë˜ í•˜ëª¨ë‹ˆì¹´ì™€ ì†í’ê¸ˆë„ ì‚¬ 가지고 ì •ê±°ìž¥ì— ë‚˜ì™€ì„œ ëŒì•„올 차를 기다리고 있었다. +나는 순후해 ë³´ì´ëŠ” ì•„ë¼ì‚¬ ì‚¬ëžŒë“¤ì´ ì •ê±°ìž¥ì—ì„œ 오ë½ê°€ë½í•˜ëŠ” ê²ƒì„ ë³´ê³  ì†ìœ¼ë¡œëŠ” 최ì„ì´ê°€ ë³‘ì´ ì¢€ ë‚˜ì€ ê²ƒì„ ë‹¤í–‰ìœ¼ë¡œ ìƒê°í•˜ê³ , ë˜ ìµœì„ê³¼ ì •ìž„ì˜ ìž¥ëž˜ê°€ ì–´ì°Œ ë ê¹Œ 하는 ê²ƒë„ ìƒê°í•˜ë©´ì„œ 뷔페(ì‹ë‹¹)ì—ì„œ 뜨거운 ì°¨ì´(ì°¨)를 마시고 있었다. +ì´ ë•Œì— ë°–ì„ ë°”ë¼ë³´ê³  ìžˆë˜ ë‚´ ëˆˆì€ ë¬¸ë“ ì´ìƒí•œ ê²ƒì„ ë³´ì•˜ë‹¤. ê·¸ê²ƒì€ ê·¸ 노파가 ì´ë¦¬ë¡œ 향하고 걸어오는 것ì¸ë° ê·¸ 노파와 íŒ”ì„ ê±¸ì€ ì Šì€ ì—¬ìžê°€ 있는 것ì´ë‹¤. 머리를 ê²€ì€ ìˆ˜ê±´ìœ¼ë¡œ 싸매고 ìž…ê³¼ 코를 가리웠으니 분명히 ì•Œ 수 없으나 í˜¹ì€ ì •ìž„ì´ë‚˜ 아닌가 í•  ìˆ˜ë°–ì— ì—†ì—ˆë‹¤. ì •ìž„ì´ê°€ 몸만 기ë™í•˜ê²Œ ë˜ë©´ 최ì„ì„ ë³´ëŸ¬ 올 ê²ƒì€ ì •ìž„ì˜ ì—´ì •ì ì¸ 성격으로 ë³´ì•„ì„œ 당연한 ì¼ì´ê¸° 때문ì´ì—ˆë‹¤. +나는 반쯤 ë¨¹ë˜ ì°¨ë¥¼ 놓고 뷔페 밖으로 뛰어나갔다. +"오 미시즈 체스터필드?" +하고 나는 노파 ì•žì— ì†ì„ 내어밀었다. 노파는 체스터필드ë¼ëŠ” 미국 ë‚¨íŽ¸ì˜ ì„±ì„ ë”°ë¼ì„œ 부르는 ê²ƒì„ ê¸°ì–µí•˜ì˜€ë‹¤. +"ì„ ìƒë‹˜!" +하는 ê²ƒì€ ì •ìž„ì´ì—ˆë‹¤. ê·¸ ì†Œë¦¬ë§Œì€ ë³€ì¹˜ 아니하였다. 나는 ê²€ì€ ìž¥ê°‘ì„ ë‚€ ì •ìž„ì˜ ì†ì„ 잡았다. 나는 여러 ë§ ì•„ë‹ˆí•˜ê³  노파와 ì •ìž„ì„ ë·”íŽ˜ë¡œ ëŒê³  들어왔다. +ëŠ™ì€ ë·”íŽ˜ ë³´ì´ëŠ” 번ì©ë²ˆì©í•˜ëŠ” 사모바르ì—ì„œ ì°¨ ë‘ ìž”ì„ ë”°ë¼ë‹¤ê°€ 노파와 ì •ìž„ì˜ ì•žì— ë†“ì•˜ë‹¤. +노파는 어린애ì—게 하는 모양으로 ì •ìž„ì˜ ìˆ˜ê±´ì„ ë²—ê²¨ 주었다. ê·¸ ì†ì—서는 해쓱하게 여윈 ì •ìž„ì˜ ì–¼êµ´ì´ ë‚˜ì™”ë‹¤. ë‘ ë³¼ì— ë¶ˆê·¸ë ˆí•˜ê²Œ í™í›ˆì´ ë„는 ê²ƒë„ ë³‘ 때문ì¸ê°€. +"ì–´ë•Œ? ì‹ ì—´ì€ ì—†ë‚˜?" +하고 나는 ì •ìž„ì—게 물었다. +"괜찮아요." +하고 ì •ìž„ì€ ì›ƒìœ¼ë©°, +"최 ì„ ìƒë‹˜ê»˜ì„œëŠ” 어떠세요?" +하고 묻는다. +"좀 나으신 모양ì´ì•¼. 그래서 나는 오늘 ì •ìž„ì„ ì¢€ 보러 가려고 í–ˆëŠ”ë° ì´ ì²´ìŠ¤í„°í•„ë“œ 부ì¸ê»˜ì„œ 아니 오시면 순임ì´ê°€ í˜¼ìž ìžˆì„ ìˆ˜ê°€ 없다고 í•´ì„œ, 그래 ì´ë ‡ê²Œ 최 ì„ ìƒ ìžì‹¤ ê²ƒì„ ì‚¬ 가지고 가는 길ì´ì•¼." +하고 ë§ì„ í•˜ë©´ì„œë„ ë‚˜ëŠ” ì •ìž„ì˜ ëˆˆê³¼ ìž…ê³¼ 목ì—ì„œ ê·¸ì˜ ë³‘ê³¼ 마ìŒì„ 알아보려고 애를 ì¼ë‹¤. +ì¤‘ë³‘ì„ ì•“ì€ ê¹ í•´ì„œëŠ” í•œ 달 ì „ 남대문서 ë³¼ 때보다 얼마 ë” ì´ˆì·Œí•œ 것 같지는 아니하였다. +"네ì—." +하고 ì •ìž„ì€ ê³ ê°œë¥¼ 숙였다. ê·¸ì˜ ì•ˆê²½ì•Œì—는 ì´ìŠ¬ì´ 맺혔다. +"ì„ ìƒë‹˜ ëŒì€ 다 안녕하셔요?" +"ì‘, ë‚´ê°€ ë– ë‚  ë•Œì—는 괜찮았어." +"최 ì„ ìƒë‹˜ ëŒë„?" +"ì‘." +"ì„ ìƒë‹˜ í½ì€ 애를 쓰셨어요." +하고 ì •ìž„ì€ ìš¸ìŒì¸ì§€ 웃ìŒì¸ì§€ 모를 웃ìŒì„ 웃는다. +ë§ì„ 모르는 노파는 우리가 하는 ë§ì„ 눈치나 채려는 ë“¯ì´ ë©€ê±°ë‹ˆ ë³´ê³  있다가 서투른 ì˜ì–´ë¡œ, +"ì•„ì§ ë¯¸ìŠ¤ ë‚¨ì€ ì‹ ì—´ì´ ìžˆë‹µë‹ˆë‹¤. ê·¸ëž˜ë„ ê°€ 본다고, ì£½ì–´ë„ ê°€ 본다고 ë‚´ ë§ì„ 안 듣고 ë”°ë¼ì™”지요." +하고 ì •ìž„ì—게 ì• ì • 있는 눈í˜ê¹€ì„ 주며, +"유 노티 ì°¨ì¼ë“œ(ë§ì½ê¾¼ì´)." +하고 ìž…ì„ ì”°ë£©í•˜ë©° ì •ìž„ì„ ì•ˆê²½ 위로 본다. +"니체워, 마뚜슈까(괜찮아요, 어머니)." +하고 ì •ìž„ì€ ë…¸íŒŒë¥¼ ë³´ê³  웃었다. ì •ìž„ì˜ ì„œì–‘ 사람ì—게 대한 í–‰ë™ì€ 서양ì‹ìœ¼ë¡œ 째었다고 ìƒê°í•˜ì˜€ë‹¤. +ì •ìž„ì€ ë„리어 유쾌한 ë¹›ì„ ë³´ì˜€ë‹¤. 다만 ê·¸ì˜ ë¶‰ì€ë¹› ë¤ ëˆˆê³¼ 마른 ìž…ìˆ ì´ ê·¸ì˜ ëª¸ì— ì—´ì´ ìžˆìŒì„ 보였다. 나는 ê·¸ì˜ ì†ëê³¼ ë°œëì´ ì‹¸ëŠ˜í•˜ê²Œ ì–¼ì—ˆì„ ê²ƒì„ ìƒìƒí•˜ì˜€ë‹¤. +마침 ì´ ë‚ ì€ ë‚ ì´ ì˜¨í™”í•˜ì˜€ë‹¤. ì—·ì€ í–‡ë¹›ë„ ì˜¤ëŠ˜ì€ ë‘꺼워진 듯하였다. +우리 세 ì‚¬ëžŒì€ Fì—­ì—ì„œ 내려서 ì°ë§¤ 하나를 얻어 타고 산으로 향하였다. ì‚°ë„ ì•„ë‹ˆì§€ë§ˆëŠ” ì‚° 있는 나ë¼ì—ì„œ ì‚´ë˜ ìš°ë¦¬ëŠ” 최ì„ì´ê°€ 사는 ê³³ì„ ì‚°ì´ë¼ê³  부르는 ìŠµê´€ì„ ì§€ì—ˆë‹¤. ì‚¼ë¦¼ì´ ìžˆìœ¼ë‹ˆ ì‚°ê°™ì´ ìƒê°ëœ 까닭ì´ì—ˆë‹¤. +노파가 오른편 ëì— ì•‰ê³ , 가운ë°ë‹¤ê°€ ì •ìž„ì„ ì•‰ížˆê³  왼편 ëì— ë‚´ê°€ 앉았다. +ì©Ÿì©Ÿì©Ÿ 하는 ì†Œë¦¬ì— ë§ì€ 달리기 시작하였다. í•œ í•„ì€ í‚¤ í° ë§ì´ìš”, í•œ í•„ì€ í‚¤ê°€ ìž‘ì€ ë§ì¸ë° 키 í° ë§ì€ 아마 ëŠ™ì€ êµ°ë§ˆ 퇴물ì¸ê°€ 싶게 허우대는 좋으나 ëª¸ì´ ì—¬ìœ„ê³  털ì—는 ìœ¤ì´ ì—†ì—ˆë‹¤. 조금만 올ë¼ê°€ëŠ” ê¸¸ì´ ë˜ì–´ë„ 고개를 숙ì´ê³  애를 ì¼ë‹¤. ìž‘ì€ ë§ì€ 까불어서 ê°€ë” ì±„ì°ìœ¼ë¡œ 얻어맞았다. +"ì•„ì´ ì‚¼ë¦¼ì´ ì¢‹ì•„ìš”." +하고 ì •ìž„ì€ ì •ë§ ê¸°ìœ ë“¯ì´ ë‚˜ë¥¼ ëŒì•„보았다. +"좋아?" +하고 나는 ë©‹ì—†ì´ ëŒ€ê¾¸í•˜ê³  나서, 후회ë˜ëŠ” 듯ì´, +"밤낮 삼림 ì†ì—서만 사니까 지루한ë°." +하는 ë§ì„ 붙였다. +"저는 ì € 눈 있는 삼림 ì†ìœ¼ë¡œ 한정 ì—†ì´ ê°€ê³  싶어요. 그러나 저는 ì¸ì œ ê¸°ìš´ì´ ì—†ìœ¼ë‹ˆê¹ ì›¬ê±¸ 그래 ë³´ê² ì–´ìš”?" +하고 í•œìˆ¨ì„ ì‰¬ì—ˆë‹¤. +"왜 그런 소릴 í•´. ì¸ì œ 나ì„걸." +하고 나는 ì •ìž„ì˜ ëˆˆì„ ë“¤ì—¬ë‹¤ë³´ì•˜ë‹¤. 마치 슬픈 눈물 방울ì´ë‚˜ 찾으려는 듯ì´. +"제가 ì§€ê¸ˆë„ ì—´ì´ ì‚¼ì‹­íŒ” ë„ê°€ 넘습니다. ì •ì‹ ì´ í릿해지는 ê²ƒì„ ë³´ë‹ˆê¹Œ 아마 ë” ì˜¬ë¼ê°€ë‚˜ ë´ìš”. ê·¸ëž˜ë„ ê´œì°®ì•„ìš”. 오늘 하루야 못 ì‚´ë¼ê³ ìš”. 오늘 하루만 ì‚´ë©´ 괜찮아요. 최 ì„ ìƒë‹˜ë§Œ í•œ 번 뵙고 죽으면 괜찮아요." +"왜 그런 소릴 í•´?" +하고 나는 ì±…ë§í•˜ëŠ” ë“¯ì´ ì–¸ì„±ì„ ë†’ì˜€ë‹¤. +ì •ìž„ì€ ê¸°ì¹¨ì„ ì‹œìž‘í•˜ì˜€ë‹¤. 한바탕 ê¸°ì¹¨ì„ í•˜ê³ ëŠ” ê¸°ìš´ì´ ì§„í•œ ë“¯ì´ ë…¸íŒŒì—게 기대며 ì¡°ì„ ë§ë¡œ, +"추워요." +하였다. ì´ ì—¬í–‰ì´ ì–´ë–»ê²Œ ì •ìž„ì˜ ë³‘ì— ì¢‹ì§€ 못할 ê²ƒì€ ì˜ì‚¬ê°€ ì•„ë‹Œ ë‚˜ë¡œë„ ì§ìž‘í•  수가 있었다. 그러나 나로는 ë” ì–´ì°Œí•  수가 없었다. +나는 외투를 ë²—ì–´ì„œ ì •ìž„ì—게 입혀 주고 노파는 ì •ìž„ì„ ì•ˆì•„ì„œ ëª¸ì´ ëœ í”들리ë„ë¡ ë˜ ì¶¥ì§€ ì•Šë„ë¡ í•˜ì˜€ë‹¤. +나는 ì •ìž„ì˜ ëª¨ì–‘ì„ ì• ì²˜ë¡œì›Œì„œ 차마 ë³¼ 수가 없었다. 그러나 ì´ê²ƒì€ 하나님밖ì—는 어찌할 ë„리가 없는 ì¼ì´ì—ˆë‹¤. +얼마를 지나서 ì •ìž„ì€ ê°‘ìžê¸° 고개를 들고 ì¼ì–´ë‚˜ë©°, +"ì¸ì œ ëª¸ì´ ì¢€ 녹았습니다. ì„ ìƒë‹˜ 추우시겠어요. ì´ ì™¸íˆ¬ 입으셔요." +하고 ê·¸ì˜ ìž…ë§Œ 웃는 웃ìŒì„ 웃었다. +"ë‚œ 춥지 ì•Šì•„. ì–´ì„œ ìž…ê³  있어." +하고 나는 ì •ìž„ì´ê°€ 외투를 벗는 ê²ƒì„ ë§‰ì•˜ë‹¤. ì •ìž„ì€ ë” ê³ ì§‘í•˜ë ¤ê³ ë„ ì•„ë‹ˆí•˜ê³ , +"ì„ ìƒë‹˜ ì‹œë² ë¦¬ì•„ì˜ ì‚¼ë¦¼ì€ ì°¸ 좋아요. 눈 ë®ì¸ ê²ƒì´ ë” ì¢‹ì€ ê²ƒ 같아요. 저는 ì´ ì¸ì  없고 ìžìœ ë¡œìš´ 삼림 ì†ìœ¼ë¡œ 헤매어 ë³´ê³  싶어요." +하고 아까 í•˜ë˜ ê²ƒê³¼ ê°™ì€ ë§ì„ ë˜ í•˜ì˜€ë‹¤. +"ë©°ì¹  잘 정양하여서, ë‚ ì´ë‚˜ 따뜻하거든 í•œ 번 산보나 í•´ 보지." +하고 나는 ì •ìž„ì˜ ë§ ëœ»ì´ ë‹¤ë¥¸ ë° ìžˆëŠ” ì¤„ì„ ì•Œë©´ì„œë„ ë¶€ëŸ¬ í‰ë²”하게 대답하였다. +ì •ìž„ì€ ëŒ€ë‹µì´ ì—†ì—ˆë‹¤. +"ì—¬ê¸°ì„œë„ ì•„ì§ ë©€ì–´ìš”?" +하고 ì •ìž„ì€ ëª¸ì´ í”들리는 ê²ƒì„ ì‹¬ížˆ 괴로워하는 모양으로 ë‘ ì†ì„ ìžë¦¬ì— 짚어 ëª¸ì„ ë²„í‹°ë©´ì„œ ë§í•˜ì˜€ë‹¤. +"고대야, 최 ì„ ìƒì´ 반가워할 í„°ì´ì§€. 오죽ì´ë‚˜ 반갑겠나." +하고 나는 ì •ìž„ì„ ìœ„ë¡œí•˜ëŠ” 뜻으로 ë§í•˜ì˜€ë‹¤. +"ì•„ì´ ì°¸ 미안해요. 제가 죄ì¸ì´ì•¼ìš”. ì € ë•Œë¬¸ì— ì• ë§¤í•œ ëˆ„ëª…ì„ ì“°ì‹œê³  저렇게 ì‚¬ì—…ë„ ë²„ë¦¬ì‹œê³  병환까지 나시니 저는 어떡허면 ì´ ì£„ë¥¼ 씻습니까?" +하고 눈물 ê³ ì¸ ëˆˆìœ¼ë¡œ ì •ìž„ì€ ë‚˜ë¥¼ ì³ë‹¤ë³´ì•˜ë‹¤. +나는 ì •ìž„ê³¼ 최ì„ì„ ì´ ìžìœ ë¡œìš´ ì‹œë² ë¦¬ì•„ì˜ ì‚¼ë¦¼ ì†ì— ë‹¨ë‘˜ì´ ì‚´ê²Œ 하고 싶었다. 그러나 최ì„ì€ ì‚´ì•„ë‚˜ê°€ê² ì§€ë§ˆëŠ” ì •ìž„ì´ê°€ ì‚´ì•„ë‚  수가 있ì„까, 하고 나는 ì •ìž„ì˜ ì–´ê¹¨ë¥¼ ë°”ë¼ë³´ì•˜ë‹¤. ê·¸ì˜ ëª©ìˆ¨ì€ ì‹¤ë‚± ê°™ì€ ê²ƒ 같았다. 바람받ì´ì— ë†“ì¸ ë“±ìž”ë¶ˆê³¼ë§Œ ê°™ì€ ê²ƒ 같았다. ì´ ëª©ìˆ¨ì´ ëŠì–´ì§€ê¸° ì „ì— ì‚¬ëž‘í•˜ëŠ” ì´ì˜ ì–¼êµ´ì„ í•œ 번 대하겠다는 ê²ƒë°–ì— ì•„ë¬´ 소ì›ì´ 없는 ì •ìž„ì€ ì°¸ìœ¼ë¡œ 가엾어서 ê°€ìŠ´ì´ ë¯¸ì–´ì§€ëŠ” 것 같았다. +"염려 ë§ì–´. 무슨 걱정ì´ì•¼? 최 ì„ ìƒë„ ë³‘ì´ ëŒë¦¬ê³  ì •ìž„ë„ ì¸ì œ 얼마 정양하면 ë‚˜ì„ ê²ƒ 아닌가. 아무 염려 ë§ì•„ìš”." +하고 나는 ë”ìš± 최ì„ê³¼ ì •ìž„ê³¼ ë‘ ì‚¬ëžŒì˜ ì‚¬ëž‘ì„ ë‹¬í•˜ê²Œ í•  ê²°ì‹¬ì„ í•˜ì˜€ë‹¤. 하나님께서 계시다면 ì´ ê°€ì—¾ì€ ê°„ì ˆí•œ ë‘ ì‚¬ëžŒì˜ ë§ˆìŒì„ 가슴 미어지게 아니 ìƒê°í•  리가 없다고 ìƒê°í•˜ì˜€ë‹¤. ìš°ì£¼ì˜ ëª¨ë“  ì¼ ì¤‘ì— ì •ìž„ì˜ ì •ê²½ë³´ë‹¤ ë” ìŠ¬í”„ê³  불ìŒí•œ ì •ê²½ì´ ë˜ ìžˆì„까 하였다. 차디찬 눈으로 ë®ì¸ ì‹œë² ë¦¬ì•„ì˜ ê´‘ì•¼ì— ë³‘ë“  ì •ìž„ì˜ ì‚¬ëž‘ìœ¼ë¡œ 타는 불똥과 ê°™ì´ ë‚ ì•„ê°€ëŠ” ì´ ì •ê²½ì€ ì¸ìƒì´ 가질 수 있는 최대한 ë¹„ê·¹ì¸ ê²ƒ 같았다. +ì •ìž„ì€ ì§€ì³ì„œ 고개를 숙ì´ê³  ìžˆë‹¤ê°€ë„ ê°€ë” ê³ ê°œë¥¼ 들어서는 기운 나는 ì–‘ì„ ë³´ì´ë ¤ê³ , 유쾌한 ì–‘ì„ ë³´ì´ë ¤ê³  애를 ì¼ë‹¤. +"ì € 나무 보셔요. 오백 ë…„ì€ ì‚´ì•˜ê² ì§€ìš”?" +ì´ëŸ° ë§ë„ 하였다. 그러나 ê·¸ê²ƒì€ ë‹¤ 억지로 지어서 하는 것ì´ì—ˆë‹¤. 그러다가는 ë˜ ê¸°ìš´ì´ ì§€ì³ì„œëŠ” 고개를 숙ì´ê³ , í˜¹ì€ ë…¸íŒŒì˜ ì–´ê¹¨ì— í˜¹ì€ ë‚´ ì–´ê¹¨ì— ì“°ëŸ¬ì¡Œë‹¤. +마침내 우리가 향하고 가는 ì›€ì§‘ì´ ë³´ì˜€ë‹¤. +"ì •ìž„ì´, 저기야." +하고 나는 ì›€ì§‘ì„ ê°€ë¦¬ì¼°ë‹¤. +"네ì—?" +하고 ì •ìž„ì€ ë‚´ ì†ê°€ë½ 가는 ê³³ì„ ë³´ê³  다ìŒì—는 ë‚´ ì–¼êµ´ì„ ë³´ì•˜ë‹¤. 잘 ë³´ì´ì§€ 않는 모양ì´ë‹¤. +"저기 저것 ë§ì•¼. 저기 ì € ê³ ìž‘ í° ì „ë‚˜ë¬´ ë‘ ê°œê°€ 있지 ì•Šì•„? ê·¸ 사ì´ë¡œ ë³´ì´ëŠ” ì €, 저거 ë§ì•¼. 옳지 옳지, ìˆœìž„ì´ ì§€ê¸ˆ 나오지 ì•Šì•„?" +하였다. +순임ì´ê°€ ë¬´ì—‡ì„ ê°€ì§€ëŸ¬ 나오는지 ë¬¸ì„ ì—´ê³  나와서는 ë°¥ 짓ëŠë¼ê³  지어 ë†“ì€ ì´ë¥¼í…Œë©´ 부엌ì—를 들어갔다가 나오는 ê¸¸ì— ì´ ìª½ì„ ë°”ë¼ë³´ë‹¤ê°€ 우리를 발견하였는지 몇 ê±¸ìŒ ë¹¨ë¦¬ 오다가는 서서 ë³´ê³  오다가는 서서 ë³´ë”니 ë‚´ê°€ 모ìžë¥¼ ë‚´ë‘르는 ê²ƒì„ ë³´ê³ ì•¼ 우리 ì¼í–‰ì¸ ê²ƒì„ í™•ì‹¤ížˆ 알고 달ìŒë°•ì§ˆì„ ì³ì„œ 나온다. +우리 ì°ë§¤ë¥¼ 만나ìž, +"ì •ìž„ì´ì•¼? 어쩌면 ì´ ì¶”ìš´ë°." +하고 ìˆœìž„ì€ ì •ìž„ì„ ì•ˆê³  ê·¸ 안경으로 ì •ìž„ì˜ ëˆˆì„ ë“¤ì—¬ë‹¤ë³¸ë‹¤. +"어쩌면 앓으면서 ì´ë ‡ê²Œ 와?" +하고 ìˆœìž„ì€ ë…¸íŒŒì™€ 나를 ì±…ë§í•˜ëŠ” ë“¯ì´ ëŒì•„보았다. +"아버지 ì–´ë– ì‹œëƒ?" +하고 나는 ì§ì„ 들고 앞서서 오면서 뒤따르는 순임ì—게 물었다. +"아버지요?" +하고 ìˆœìž„ì€ ì–´ë¥¸ì—게 대한 ê²½ì˜ë¥¼ 표하노ë¼ê³  ë‚´ ê³ì— 와서 걸으며, +"아버지께서 ì˜¤ëŠ˜ì€ ë§ì”€ì„ ë§Žì´ í•˜ì…¨ì–´ìš”. 순임ì´ê°€ ê³ ìƒí•˜ëŠ”구나 고맙다, ì´ëŸ° ë§ì”€ë„ 하시고, 지금 같아서는 ì¼ì–´ë‚  ê²ƒë„ ê°™ì€ë° ê¸°ìš´ì´ ì—†ì–´ì„œ, ì´ëŸ° ë§ì”€ë„ 하시고, ë˜ ì„ ìƒë‹˜ì´ ì´ë¥´ì¿ ì¸ í¬ì—를 들어가셨으니 ë¬´ì—‡ì„ ì‚¬ 오실 듯싶으ëƒ, 알아맞혀 ë³´ì•„ë¼, ì´ëŸ° ë†ë‹´ë„ 하시고, ì •ìž„ì´ê°€ 어떤가 í•œ 번 보았으면, ì´ëŸ° ë§ì”€ë„ 하시겠지요. ë˜ ìˆœìž„ì•„, ë‚´ê°€ 죽ë”ë¼ë„ ì •ìž„ì„ ë„¤ 친ë™ìƒìœ¼ë¡œ 알아서 부디 잘 사랑해 주어ë¼, ì •ìž„ì€ ë¶ˆìŒí•œ 애다, ì°¸ ì •ìž„ì€ ë¶ˆìŒí•´! ì´ëŸ° ë§ì”€ë„ 하시겠지요. 그렇게 여러 가지 ë§ì”€ì„ ë§Žì´ í•˜ì‹œë”니, 순임아 ë‚´ê°€ 죽거든 ì„ ìƒë‹˜ì„ 아버지로 알고 ê·¸ 지ë„를 받아ë¼, 그러시길래 제가 아버지 안 ëŒì•„가셔요! 그랬ë”니 아버지께서 웃으시면서, 죽지 ë§ê¹Œ, 하시고는 어째 ê°€ìŠ´ì´ ì¢€ ê±°ë¶í•œê°€, 하시ë”니 ìž ì´ ë“œì…¨ì–´ìš”. í•œ 시간ì´ë‚˜ ë˜ì—ˆì„까, 온." +집 ì•žì— ê±°ì˜ ë‹¤ 가서는 ìˆœìž„ì€ ì •ìž„ì˜ íŒ”ì„ ê¼ˆë˜ ê²ƒì„ ë†“ê³  빨리 집으로 뛰어들어갔다. +치마í­ì„ 펄럭거리고 뛰는 ì–‘ì—는 ì–´ë ¸ì„ ì  ë§ê´„ëŸ‰ì´ ìˆœìž„ì˜ ëª¨ìŠµì´ ë‚¨ì•„ 있어서 나는 í˜¼ìž ì›ƒì—ˆë‹¤. ìˆœìž„ì€ ì •ìž„ì´ê°€ 왔다는 ê¸°ìœ ì†Œì‹ì„ í•œ ì‹œê°ì´ë¼ë„ 빨리 아버지께 전하고 ì‹¶ì—ˆë˜ ê²ƒì´ë‹¤. +"아버지, 주무시우? ì •ìž„ì´ê°€ 왔어요. ì •ìž„ì´ê°€ 왔습니다." +하고 부르는 소리가 ë°–ì—ì„œë„ ë“¤ë ¸ë‹¤. +ë‚˜ë„ ë°©ì— ë“¤ì–´ì„œê³ , ì •ìž„ë„ ë’¤ë”°ë¼ ë“¤ì–´ì„œê³ , 노파는 부엌으로 ë¬¼ê±´ì„ ë‘러 들어갔다. +ë°©ì€ ì ˆë²½ê°™ì´ ì–´ë‘웠다. +"순임아, ë¶ˆì„ ì¢€ 켜려무나." +하고 최ì„ì˜ ì–¼êµ´ì„ ì°¾ëŠë¼ê³  ëˆˆì„ í¬ê²Œ 뜨고 고개를 숙ì´ë©°, +"ìžë‚˜? ì •ìž„ì´ê°€ 왔네." +하고 불렀다. +ì •ìž„ë„ ê³ì— 와서 선다. +최ì„ì€ ëŒ€ë‹µì´ ì—†ì—ˆë‹¤. +순임ì´ê°€ ì´›ë¶ˆì„ ì¼œìž ìµœì„ì˜ ì–¼êµ´ì´ í™˜í•˜ê²Œ 보였다. +"여보게, ì—¬ë´. ìžë‚˜?" +하고 나는 무서운 예ê°ì„ 가지면서 최ì„ì˜ ì–´ê¹¨ë¥¼ í”들었다. +ê·¸ê²ƒì´ ë¬´ì—‡ì¸ì§€ 모르지마는 최ì„ì€ ì‹œì²´ë¼ í•˜ëŠ” ê²ƒì„ ë‚˜ëŠ” ë‚´ ì†ì„ 통해서 깨달았다. +나는 ê¹œì§ ë†€ë¼ì„œ ì´ë¶ˆì„ 벗기고 최ì„ì˜ íŒ”ì„ ìž¡ì•„ ë§¥ì„ ì§šì–´ 보았다. 거기는 ë§¥ì´ ì—†ì—ˆë‹¤. +나는 최ì„ì˜ ìžë¦¬ì˜· ê°€ìŠ´ì„ í—¤ì¹˜ê³  귀를 ê°€ìŠ´ì— ëŒ€ì—ˆë‹¤. ê·¸ ì‚´ì€ ì–¼ìŒê³¼ ê°™ì´ ì°¨ê³  ê·¸ ê°€ìŠ´ì€ ê³ ìš”í•˜ì˜€ë‹¤. ì‹¬ìž¥ì€ ë›°ê¸°ë¥¼ 그친 것ì´ì—ˆë‹¤. +나는 최ì„ì˜ ê°€ìŠ´ì—ì„œ 귀를 떼고 ì¼ì–´ì„œë©´ì„œ, +"네 아버지는 ëŒì•„가셨다. 네 ì†ìœ¼ë¡œ 눈ì´ë‚˜ ê°ê²¨ 드려ë¼." +하였다. ë‚´ 눈ì—서는 ëˆˆë¬¼ì´ í˜ë €ë‹¤. +"ì„ ìƒë‹˜!" +하고 ì •ìž„ì€ ì „ì—°ížˆ 절제할 íž˜ì„ ìžƒì–´ë²„ë¦° ë“¯ì´ ìµœì„ì˜ ê°€ìŠ´ì— ì—Žì–´ì¡Œë‹¤. 그러고는 소리를 ë‚´ì–´ 울었다. 순임ì€, +"아버지, 아버지!" +하고 최ì„ì˜ ë² ê°œ ê³ì— ì´ë§ˆë¥¼ 대고 울었다. +ì•„ë¼ì‚¬ ë…¸íŒŒë„ ìš¸ì—ˆë‹¤. +ë°© 안ì—는 ì˜¤ì§ ìš¸ìŒ ì†Œë¦¬ë¿ì´ìš”, ë§ì´ 없었다. 최ì„ì€ ë²Œì¨ ì´ ìŠ¬í”ˆ ê´‘ê²½ë„ ëª°ë¼ë³´ëŠ” 사람ì´ì—ˆë‹¤. +최ì„ì´ê°€ ìžê¸°ì˜ ì‹¸ì›€ì„ ì´ê¸°ê³  죽었는지, ë˜ëŠ” ë까지 지다가 죽었는지 ê·¸ê²ƒì€ ì˜ì›í•œ 비밀ì´ì–´ì„œ ì•Œ ë„리가 없었다. 그러나 ì´ê²ƒë§Œì€ 확실하다 ê·¸ì˜ ì˜ì‹ì´ 마지막으로 ë나는 ìˆœê°„ì— ê·¸ì˜ ì˜ì‹ê¸°ì— ë– ì˜¤ë¥´ë˜ ì˜¤ì§ í•˜ë‚˜ê°€ ì •ìž„ì´ì—ˆìœ¼ë¦¬ë¼ëŠ” 것만ì€. +지금 ì •ìž„ì´ê°€ ê·¸ì˜ ê°€ìŠ´ì— ì—Žì–´ì ¸ 울지마는, ì •ìž„ì˜ ëœ¨ê±°ìš´ ëˆˆë¬¼ì´ ê·¸ì˜ ê°€ìŠ´ì„ ì ì‹œê±´ë§ˆëŠ” 최ì„ì˜ ê°€ìŠ´ì€ ë›¸ ì¤„ì„ ëª¨ë¥¸ë‹¤. ì´ê²ƒì´ 죽ìŒì´ëž€ 것ì´ë‹¤. +ë’¤ì— ê²½ì°°ì˜ê°€ 와서 검사한 ê²°ê³¼ì— ì˜í•˜ë©´, 최ì„ì€ í렴으로 ì•“ë˜ ê²°ê³¼ë¡œ 심장마비를 ì¼ìœ¼í‚¨ 것ì´ë¼ê³  하였다. +나는 최ì„ì˜ ìž¥ë¡€ë¥¼ ëë‚´ê³  순임과 ì •ìž„ì„ ë°ë¦¬ê³  오려 하였으나 ì •ìž„ì€ ë“£ì§€ 아니하고 노파와 ê°™ì´ ë°”ì´ì¹¼ 촌으로 ê°€ 버렸다. +그런 뒤로는 ì •ìž„ì—게서는 ì¼ì²´ ìŒì‹ ì´ 없다. 때때로 노파ì—게서 편지가 ì˜¤ëŠ”ë° ì •ìž„ì€ ìµœì„ì´ê°€ ìžˆë˜ ë°©ì— ê°€ë§Œížˆ 있다고만 하였다. +서투른 ì˜ì–´ê°€ ëœ»ì„ ì¶©ë¶„ížˆ 발표하지 못하는 것ì´ì—ˆë‹¤. +나는 ì •ìž„ì—게 안심하고 ë³‘ì„ ì¹˜ë£Œí•˜ë¼ëŠ” íŽ¸ì§€ë„ í•˜ê³  ëˆì´ 필요하거든 청구하ë¼ëŠ” íŽ¸ì§€ë„ í•˜ë‚˜ ì˜ ë‹µìž¥ì´ ì—†ë‹¤. +ë§Œì¼ ì •ìž„ì´ê°€ 죽었다는 ê¸°ë³„ì´ ì˜¤ë©´ 나는 í•œ 번 ë” ì‹œë² ë¦¬ì•„ì— ê°€ì„œ ë‘˜ì„ ê°€ì§€ëŸ°ížˆ 묻고 `ë‘ ë³„ 무ë¤'ì´ë¼ëŠ” 비를 세워 줄 ìƒê°ì´ë‹¤. 그러나 나는 ì •ìž„ì´ê°€ 조선으로 오기를 바란다. +ì—¬ëŸ¬ë¶„ì€ ìµœì„ê³¼ ì •ìž„ì—게 대한 ì´ ê¸°ë¡ì„ 믿고 ê·¸ ë‘ ì‚¬ëžŒì—게 대한 오해를 í’€ë¼. +EOT; +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Address.php new file mode 100644 index 0000000..5f44640 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Address.php @@ -0,0 +1,131 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function citySuffix() + { + return static::randomElement(static::$citySuffix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public static function streetSuffix() + { + return static::randomElement(static::$streetSuffix); + } + + public static function street() + { + return static::randomElement(static::$street); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Company.php new file mode 100644 index 0000000..4a110c2 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/Company.php @@ -0,0 +1,15 @@ +bothify("########"); + } + + /** + * Return passport number + * @return string + * @example 12345678 + */ + public function passportNumber() + { + return $this->bothify("########"); + } + + /** + * National Personal Identity number (asmens kodas) + * @link https://en.wikipedia.org/wiki/National_identification_number#Lithuania + * @link https://lt.wikipedia.org/wiki/Asmens_kodas + * @param string [male|female] + * @param \DateTime $birthdate + * @param string $randomNumber three integers + * @return string on format XXXXXXXXXXX + */ + public function personalIdentityNumber($gender = 'male', \DateTime $birthdate = null, $randomNumber = '') + { + if (!$birthdate) { + $birthdate = \Faker\Provider\DateTime::dateTimeThisCentury(); + } + + $genderNumber = ($gender == 'male') ? (int) 1 : (int) 0; + $firstNumber = (int) floor($birthdate->format('Y') / 100) * 2 - 34 - $genderNumber; + + $datePart = $birthdate->format('ymd'); + $randomDigits = (string) ( ! $randomNumber || strlen($randomNumber < 3)) ? static::numerify('###') : substr($randomNumber, 0, 3); + $partOfPerosnalCode = $firstNumber . $datePart . $randomDigits; + + $sum = self::calculateSum($partOfPerosnalCode, 1); + $liekana = $sum % 11; + + if ($liekana !== 10) { + $lastNumber = $liekana; + return $firstNumber . $datePart . $randomDigits . $lastNumber; + } + + $sum = self::calculateSum($partOfPerosnalCode, 2); + $liekana = (int) $sum % 11; + + $lastNumber = ($liekana !== 10) ? $liekana : 0; + return $firstNumber . $datePart . $randomDigits . $lastNumber; + } + + /** + * Calculate the sum of personal code + * @link https://en.wikipedia.org/wiki/National_identification_number#Lithuania + * @link https://lt.wikipedia.org/wiki/Asmens_kodas + * @param string $numbers + * @param int $time [1|2] + * @return int + */ + private static function calculateSum($numbers, $time = 1) + { + if ($time == 1) { + $multipliers = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 1 ); + } else { + $multipliers = array(3, 4, 5, 6, 7, 8, 9, 1, 2, 3 ); + } + + $sum = 0; + for ($i=1; $i <= 10; $i++) { + $sum += $numbers[$i-1] * $multipliers[$i-1]; + } + + return (int) $sum; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/PhoneNumber.php new file mode 100644 index 0000000..752eb78 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/lt_LT/PhoneNumber.php @@ -0,0 +1,17 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function cityPrefix() + { + return static::randomElement(static::$cityPrefix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + public static function street() + { + return static::randomElement(static::$street); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/Color.php b/vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/Color.php new file mode 100644 index 0000000..99e681b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/Color.php @@ -0,0 +1,19 @@ +format('dmy'); + $randomDigits = (string) static::numerify('####'); + + $checksum = Luhn::computeCheckDigit($datePart . $randomDigits); + + return $datePart . '-' . $randomDigits . $checksum; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/PhoneNumber.php new file mode 100644 index 0000000..29c19f6 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/lv_LV/PhoneNumber.php @@ -0,0 +1,15 @@ + static::latitude(42.43, 42.45), + 'longitude' => static::longitude(19.16, 19.27) + ); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/me_ME/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/me_ME/Company.php new file mode 100644 index 0000000..1f80312 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/me_ME/Company.php @@ -0,0 +1,49 @@ +generator->parse(static::$idNumberFormat)); + } + + /** + * @return string + * @example 'Ф' + */ + public function alphabet() + { + return static::randomElement(static::$alphabet); + } + + /** + * @return string + * @example 'Э' + */ + public function namePrefix() + { + return static::randomElement(static::$namePrefix); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/mn_MN/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/mn_MN/PhoneNumber.php new file mode 100644 index 0000000..dd0bb4a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/mn_MN/PhoneNumber.php @@ -0,0 +1,13 @@ + Townships + * @link https://en.wikipedia.org/wiki/Template:Johor > Townships + * @link https://en.wikipedia.org/wiki/Template:Kedah > Townships + * @link https://en.wikipedia.org/wiki/Template:Kelantan > Townships + * @link https://en.wikipedia.org/wiki/Template:Melaka > Townships + * @link https://en.wikipedia.org/wiki/Template:Negeri_Sembilan > Townships + * @link https://en.wikipedia.org/wiki/Template:Perak > Townships + * @link https://en.wikipedia.org/wiki/Template:Penang > Townships + * @link https://en.wikipedia.org/wiki/Template:Selangor > Townships + * @link https://en.wikipedia.org/wiki/Template:Terengganu > Townships + */ + protected static $townshipPrefix = array( + 'Alam','Apartment','Ara', + 'Bandar','Bandar','Bandar','Bandar','Bandar','Bandar', + 'Bandar Bukit','Bandar Seri','Bandar Sri','Bandar Baru','Batu','Bukit', + 'Desa','Damansara', + 'Kampung','Kampung Baru','Kampung Baru','Kondominium','Kota', + 'Laman','Lembah', + 'Medan', + 'Pandan','Pangsapuri','Petaling','Puncak', + 'Seri','Sri', + 'Taman','Taman','Taman','Taman','Taman','Taman', + 'Taman Desa', + ); + protected static $townshipSuffix = array( + 'Aman','Amanjaya','Anggerik','Angkasa','Antarabangsa','Awan', + 'Bahagia','Bangsar','Baru','Belakong','Bendahara','Bestari','Bintang','Brickfields', + 'Casa','Changkat','Country Heights', + 'Damansara','Damai','Dato Harun','Delima','Duta', + 'Flora', + 'Gembira','Genting', + 'Harmoni','Hartamas', + 'Impian','Indah','Intan', + 'Jasa','Jaya', + 'Keramat','Kerinchi','Kiara','Kinrara','Kuchai', + 'Laksamana', + 'Mahkota','Maluri','Manggis','Maxwell','Medan','Melawati','Menjalara','Meru','Mulia','Mutiara', + 'Pahlawan','Perdana','Pertama','Permai','Pelangi','Petaling','Pinang','Puchong','Puteri','Putra', + 'Rahman','Rahmat','Raya','Razak','Ria', + 'Saujana','Segambut','Selamat','Selatan','Semarak','Sentosa','Seputeh','Setapak','Setia Jaya','Sinar','Sungai Besi','Sungai Buaya','Sungai Long','Suria', + 'Tasik Puteri','Tengah','Timur','Tinggi','Tropika','Tun Hussein Onn','Tun Perak','Tunku', + 'Ulu','Utama','Utara', + 'Wangi', + ); + + /** + * @link https://en.wikipedia.org/wiki/Template:Greater_Kuala_Lumpur + * @link https://en.wikipedia.org/wiki/Template:Johor + * @link https://en.wikipedia.org/wiki/Template:Kedah + * @link https://en.wikipedia.org/wiki/Template:Kelantan + * @link https://en.wikipedia.org/wiki/Template:Labuan + * @link https://en.wikipedia.org/wiki/Template:Melaka + * @link https://en.wikipedia.org/wiki/Template:Negeri_Sembilan + * @link https://en.wikipedia.org/wiki/Template:Pahang + * @link https://en.wikipedia.org/wiki/Template:Perak + * @link https://en.wikipedia.org/wiki/Template:Perlis + * @link https://en.wikipedia.org/wiki/Template:Penang + * @link https://en.wikipedia.org/wiki/Template:Sabah + * @link https://en.wikipedia.org/wiki/Template:Sarawak + * @link https://en.wikipedia.org/wiki/Template:Selangor + * @link https://en.wikipedia.org/wiki/Template:Terengganu + */ + protected static $towns = array( + 'johor' => array( + 'Ayer Hitam', + 'Batu Pahat','Bukit Gambir','Bukit Kepong','Bukit Naning', + 'Desaru', + 'Endau', + 'Gelang Patah','Gemas Baharu', + 'Iskandar Puteri', + 'Jementah','Johor Lama','Johor Bahru', + 'Kempas','Kluang','Kota Iskandar','Kota Tinggi','Kukup','Kulai', + 'Labis ','Larkin','Layang-Layang', + 'Mersing','Muar', + 'Pagoh','Paloh','Parit Jawa','Pasir Gudang','Pekan Nanas','Permas Jaya','Pontian Kechil', + 'Renggam', + 'Segamat','Senai','Simpang Renggam','Skudai','Sri Gading', + 'Tangkak','Tebrau', + 'Ulu Tiram', + 'Yong Peng', + ), + 'kedah' => array( + 'Alor Setar', + 'Baling','Bukit Kayu Hitam', + 'Changlun', + 'Durian Burung', + 'Gurun', + 'Jitra', + 'Kepala Batas','Kuah','Kuala Kedah','Kuala Ketil','Kulim', + 'Langgar','Lunas', + 'Merbok', + 'Padang Serai','Pendang', + 'Serdang','Sintok','Sungai Petani', + 'Tawar, Baling', + 'Yan', + ), + 'kelantan' => array( + 'Bachok','Bunut Payong', + 'Dabong', + 'Gua Musang', + 'Jeli', + 'Ketereh','Kota Bharu','Kuala Krai', + 'Lojing', + 'Machang', + 'Pasir Mas','Pasir Puteh', + 'Rantau Panjang', + 'Salor', + 'Tok Bali', + 'Wakaf Bharu','Wakaf Che Yeh', + ), + 'kl' => array( + 'Ampang', + 'Bandar Tasik Selatan','Bandar Tun Razak','Bangsar','Batu','Brickfields','Bukit Bintang','Bukit Jalil','Bukit Tunku', + 'Cheras','Chow Kit', + 'Damansara Town Centre','Dang Wangi','Desa Petaling','Desa Tun Hussein Onn', + 'Jinjang', + 'Kampung Baru','Kampung Kasipillay','Kampung Pandan','Kampung Sungai Penchala','Kepong','KLCC','Kuchai Lama', + 'Lake Gardens','Lembah Pantai', + 'Medan Tuanku','Mid Valley City','Mont Kiara', + 'Pantai Dalam','Pudu', + 'Salak South','Segambut','Semarak','Sentul','Setapak','Setiawangsa','Seputeh','Sri Hartamas','Sri Petaling','Sungai Besi', + 'Taman Desa','Taman Melawati','Taman OUG','Taman Tun Dr Ismail','Taman U-Thant','Taman Wahyu','Titiwangsa','Tun Razak Exchange', + 'Wangsa Maju', + ), + 'labuan' => array( + 'Batu Manikar', + 'Kiamsam', + 'Layang-Layang', + 'Rancha-Rancha' + ), + 'melaka' => array( + 'Alor Gajah', + 'Bandaraya Melaka','Batu Berendam','Bukit Beruang','Bukit Katil', + 'Cheng', + 'Durian Tunggal', + 'Hang Tuah Jaya', + 'Jasin', + 'Klebang', + 'Lubuk China', + 'Masjid Tanah', + 'Naning', + 'Pekan Asahan', + 'Ramuan China', + 'Simpang Ampat', + 'Tanjung Bidara','Telok Mas', + 'Umbai', + ), + 'nsembilan' => array( + 'Ayer Kuning','Ampangan', + 'Bahau','Batang Benar', + 'Chembong', + 'Dangi', + 'Gemas', + 'Juasseh', + 'Kuala Pilah', + 'Labu','Lenggeng','Linggi', + 'Mantin', + 'Nilai', + 'Pajam','Pedas','Pengkalan Kempas','Port Dickson', + 'Rantau','Rompin', + 'Senawang','Seremban','Sungai Gadut', + 'Tampin','Tiroi', + ), + 'pahang' => array( + 'Bandar Tun Razak','Bentong','Brinchang','Bukit Fraser','Bukit Tinggi', + 'Chendor', + 'Gambang','Genting Highlands','Genting Sempah', + 'Jerantut', + 'Karak','Kemayan','Kota Shahbandar','Kuala Lipis','Kuala Pahang','Kuala Rompin','Kuantan', + 'Lanchang','Lubuk Paku', + 'Maran','Mengkuang','Mentakab', + 'Nenasi', + 'Panching', + 'Pekan','Penor', + 'Raub', + 'Sebertak','Sungai Lembing', + 'Tanah Rata','Tanjung Sepat','Tasik Chini','Temerloh','Teriang','Tringkap', + ), + 'penang' => array( + 'Air Itam', + 'Balik Pulau','Batu Ferringhi','Batu Kawan','Bayan Lepas','Bukit Mertajam','Butterworth', + 'Gelugor','George Town', + 'Jelutong', + 'Kepala Batas', + 'Nibong Tebal', + 'Permatang Pauh','Pulau Tikus', + 'Simpang Ampat', + 'Tanjung Bungah','Tanjung Tokong', + ), + 'perak' => array( + 'Ayer Tawar', + 'Bagan Serai','Batu Gajah','Behrang','Bidor','Bukit Gantang','Bukit Merah', + 'Changkat Jering','Chemor','Chenderiang', + 'Damar Laut', + 'Gerik','Gopeng','Gua Tempurung', + 'Hutan Melintang', + 'Ipoh', + 'Jelapang', + 'Kamunting','Kampar','Kuala Kangsar', + 'Lekir','Lenggong','Lumut', + 'Malim Nawar','Manong','Menglembu', + 'Pantai Remis','Parit','Parit Buntar','Pasir Salak','Proton City', + 'Simpang Pulai','Sitiawan','Slim River','Sungai Siput','Sungkai', + 'Taiping','Tambun','Tanjung Malim','Tanjung Rambutan','Tapah','Teluk Intan', + 'Ulu Bernam', + ), + 'perlis' => array( + 'Arau', + 'Beseri', + 'Chuping', + 'Kaki Bukit','Kangar','Kuala Perlis', + 'Mata Ayer', + 'Padang Besar', + 'Sanglang','Simpang Empat', + 'Wang Kelian', + ), + 'putrajaya' => array( + 'Precinct 1','Precinct 4','Precinct 5', + 'Precinct 6','Precinct 8','Precinct 10', + 'Precinct 11','Precinct 12','Precinct 13', + 'Precinct 16','Precinct 18','Precinct 19', + ), + 'sabah' => array( + 'Beaufort','Bingkor', + 'Donggongon', + 'Inanam', + 'Kinabatangan','Kota Belud','Kota Kinabalu','Kuala Penyu','Kimanis','Kundasang', + 'Lahad Datu','Likas','Lok Kawi', + 'Manggatal', + 'Nabawan', + 'Papar','Pitas', + 'Ranau', + 'Sandakan','Sapulut','Semporna','Sepanggar', + 'Tambunan','Tanjung Aru','Tawau','Tenom','Tuaran', + 'Weston', + ), + 'sarawak' => array( + 'Asajaya', + 'Ba\'kelalan','Bario','Batu Kawa','Batu Niah','Betong','Bintulu', + 'Dalat','Daro', + 'Engkilili', + 'Julau', + 'Kapit','Kota Samarahan','Kuching', + 'Lawas','Limbang','Lubok Antu', + 'Marudi','Matu','Miri', + 'Oya', + 'Pakan', + 'Sadong Jaya','Sematan','Sibu','Siburan','Song','Sri Aman','Sungai Tujoh', + 'Tanjung Kidurong','Tanjung Manis','Tatau', + ), + 'selangor' => array( + 'Ampang','Assam Jawa', + 'Balakong','Bandar Baru Bangi','Bandar Baru Selayang','Bandar Sunway','Bangi','Banting','Batang Kali','Batu Caves','Bestari Jaya','Bukit Lanjan', + 'Cheras','Cyberjaya', + 'Damansara','Dengkil', + 'Ijok', + 'Jenjarom', + 'Kajang','Kelana Jaya','Klang','Kuala Kubu Bharu','Kuala Selangor','Kuang', + 'Lagong', + 'Morib', + 'Pandamaran','Paya Jaras','Petaling Jaya','Port Klang','Puchong', + 'Rasa','Rawang', + 'Salak Tinggi','Sekinchan','Selayang','Semenyih','Sepang','Serendah','Seri Kembangan','Shah Alam','Subang','Subang Jaya','Sungai Buloh', + 'Tanjung Karang','Tanjung Sepat', + 'Ulu Klang','Ulu Yam', + ), + 'terengganu' => array( + 'Ajil', + 'Bandar Ketengah Jaya','Bandar Permaisuri','Bukit Besi','Bukit Payong', + 'Chukai', + 'Jerteh', + 'Kampung Raja','Kerteh','Kijal','Kuala Besut','Kuala Berang','Kuala Dungun','Kuala Terengganu', + 'Marang','Merchang', + 'Pasir Raja', + 'Rantau Abang', + 'Teluk Kalung', + 'Wakaf Tapai', + ) + ); + + /** + * @link https://en.wikipedia.org/wiki/States_and_federal_territories_of_Malaysia + */ + protected static $states = array( + 'johor' => array( + 'Johor Darul Ta\'zim', + 'Johor' + ), + 'kedah' => array( + 'Kedah Darul Aman', + 'Kedah' + ), + 'kelantan' => array( + 'Kelantan Darul Naim', + 'Kelantan' + ), + 'kl' => array( + 'KL', + 'Kuala Lumpur', + 'WP Kuala Lumpur' + ), + 'labuan' => array( + 'Labuan' + ), + 'melaka' => array( + 'Malacca', + 'Melaka' + ), + 'nsembilan' => array( + 'Negeri Sembilan Darul Khusus', + 'Negeri Sembilan' + ), + 'pahang' => array( + 'Pahang Darul Makmur', + 'Pahang' + ), + 'penang' => array( + 'Penang', + 'Pulau Pinang' + ), + 'perak' => array( + 'Perak Darul Ridzuan', + 'Perak' + ), + 'perlis' => array( + 'Perlis Indera Kayangan', + 'Perlis' + ), + 'putrajaya' => array( + 'Putrajaya' + ), + 'sabah' => array( + 'Sabah' + ), + 'sarawak' => array( + 'Sarawak' + ), + 'selangor' => array( + 'Selangor Darul Ehsan', + 'Selangor' + ), + 'terengganu' => array( + 'Terengganu Darul Iman', + 'Terengganu' + ) + ); + + /** + * @link https://ms.wikipedia.org/wiki/Senarai_negara_berdaulat + */ + protected static $country = array( + 'Abkhazia','Afghanistan','Afrika Selatan','Republik Afrika Tengah','Akrotiri dan Dhekelia','Albania','Algeria','Amerika Syarikat','Andorra','Angola','Antigua dan Barbuda','Arab Saudi','Argentina','Armenia','Australia','Austria','Azerbaijan', + 'Bahamas','Bahrain','Bangladesh','Barbados','Belanda','Belarus','Belgium','Belize','Benin','Bhutan','Bolivia','Bonaire','Bosnia dan Herzegovina','Botswana','Brazil','Brunei Darussalam','Bulgaria','Burkina Faso','Burundi', + 'Cameroon','Chad','Chile','Republik Rakyat China','Republik China di Taiwan','Colombia','Comoros','Republik Demokratik Congo','Republik Congo','Kepulauan Cook','Costa Rica','Côte d\'Ivoire (Ivory Coast)','Croatia','Cuba','Curaçao','Cyprus','Republik Turki Cyprus Utara','Republik Czech', + 'Denmark','Djibouti','Dominika','Republik Dominika', + 'Ecuador','El Salvador','Emiriah Arab Bersatu','Eritrea','Estonia', + 'Kepulauan Faroe','Fiji','Filipina','Finland', + 'Gabon','Gambia','Georgia','Ghana','Grenada','Greece (Yunani)','Guatemala','Guinea','Guinea-Bissau','Guinea Khatulistiwa','Guiana Perancis','Guyana', + 'Habsyah (Etiopia)','Haiti','Honduras','Hungary', + 'Iceland','India','Indonesia','Iran','Iraq','Ireland','Israel','Itali', + 'Jamaika','Jepun','Jerman','Jordan', + 'Kanada','Kazakhstan','Kemboja','Kenya','Kiribati','Korea Selatan','Korea Utara','Kosovo','Kuwait','Kyrgyzstan', + 'Laos','Latvia','Lesotho','Liberia','Libya','Liechtenstein','Lithuania','Lubnan','Luxembourg', + 'Macedonia','Madagaskar','Maghribi','Malawi','Malaysia','Maldives','Mali','Malta','Kepulauan Marshall','Mauritania','Mauritius','Mesir','Mexico','Persekutuan Micronesia','Moldova','Monaco','Montenegro','Mongolia','Mozambique','Myanmar', + 'Namibia','Nauru','Nepal','New Zealand','Nicaragua','Niger','Nigeria','Niue','Norway', + 'Oman','Ossetia Selatan', + 'Pakistan','Palau','Palestin','Panama','Papua New Guinea','Paraguay','Perancis','Peru','Poland','Portugal', + 'Qatar', + 'Romania','Russia','Rwanda', + 'Sahara Barat','Saint Kitts dan Nevis','Saint Lucia','Saint Vincent dan Grenadines','Samoa','San Marino','São Tomé dan Príncipe','Scotland','Senegal','Sepanyol','Serbia','Seychelles','Sierra Leone','Singapura','Slovakia','Slovenia','Kepulauan Solomon','Somalia','Somaliland','Sri Lanka','Sudan','Sudan Selatan','Suriname','Swaziland','Sweden','Switzerland','Syria', + 'Tajikistan','Tanjung Verde','Tanzania','Thailand','Timor Leste','Togo','Tonga','Transnistria','Trinidad dan Tobago','Tunisia','Turki','Turkmenistan','Tuvalu', + 'Uganda','Ukraine','United Kingdom','Uruguay','Uzbekistan', + 'Vanuatu','Kota Vatican','Venezuela','Vietnam', + 'Yaman', + 'Zambia','Zimbabwe', + ); + + /** + * Return a building prefix + * + * @example 'No.' + * + * @return @string + */ + public static function buildingPrefix() + { + return static::randomElement(static::$buildingPrefix); + } + + /** + * Return a building number + * + * @example '123' + * + * @return @string + */ + public static function buildingNumber() + { + return static::toUpper(static::lexify(static::numerify(static::randomElement(static::$buildingNumber)))); + } + + /** + * Return a street prefix + * + * @example 'Jalan' + */ + public function streetPrefix() + { + $format = static::randomElement(static::$streetPrefix); + + return $this->generator->parse($format); + } + + /** + * Return a complete streename + * + * @example 'Jalan Utama 7' + * + * @return @string + */ + public function streetName() + { + $format = static::toUpper(static::lexify(static::numerify(static::randomElement(static::$streetNameFormats)))); + + return $this->generator->parse($format); + } + + /** + * Return a randown township + * + * @example Taman Bahagia + * + * @return @string + */ + public function township() + { + $format = static::toUpper(static::lexify(static::numerify(static::randomElement(static::$townshipFormats)))); + + return $this->generator->parse($format); + } + + /** + * Return a township prefix abbreviation + * + * @example 'USJ' + * + * @return @string + */ + public function townshipPrefixAbbr() + { + return static::randomElement(static::$townshipPrefixAbbr); + } + + /** + * Return a township prefix + * + * @example 'Taman' + * + * @return @string + */ + public function townshipPrefix() + { + return static::randomElement(static::$townshipPrefix); + } + + /** + * Return a township suffix + * + * @example 'Bahagia' + */ + public function townshipSuffix() + { + return static::randomElement(static::$townshipSuffix); + } + + /** + * Return a postcode based on state + * + * @example '55100' + * @link https://en.wikipedia.org/wiki/Postal_codes_in_Malaysia#States + * + * @param null|string $state 'state' or null + * + * @return @string + */ + public static function postcode($state = null) + { + $format = array( + 'perlis' => array( // (01000 - 02800) + '0' . mt_rand(1000, 2800) + ), + 'kedah' => array( // (05000 - 09810) + '0' . mt_rand(5000, 9810) + ), + 'penang' => array( // (10000 - 14400) + mt_rand(10000, 14400) + ), + 'kelantan' => array( // (15000 - 18500) + mt_rand(15000, 18500) + ), + 'terengganu' => array( // (20000 - 24300) + mt_rand(20000, 24300) + ), + 'pahang' => array( // (25000 - 28800 | 39000 - 39200 | 49000, 69000) + mt_rand(25000, 28800), + mt_rand(39000, 39200), + mt_rand(49000, 69000) + ), + 'perak' => array( // (30000 - 36810) + mt_rand(30000, 36810) + ), + 'selangor' => array( // (40000 - 48300 | 63000 - 68100) + mt_rand(40000, 48300), + mt_rand(63000, 68100) + ), + 'kl' => array( // (50000 - 60000) + mt_rand(50000, 60000), + ), + 'putrajaya' => array( // (62000 - 62988) + mt_rand(62000, 62988) + ), + 'nsembilan' => array( // (70000 - 73509) + mt_rand(70000, 73509) + ), + 'melaka' => array( // (75000 - 78309) + mt_rand(75000, 78309) + ), + 'johor' => array( // (79000 - 86900) + mt_rand(79000, 86900) + ), + 'labuan' => array( // (87000 - 87033) + mt_rand(87000, 87033) + ), + 'sabah' => array( // (88000 - 91309) + mt_rand(88000, 91309) + ), + 'sarawak' => array( // (93000 - 98859) + mt_rand(93000, 98859) + ) + ); + + $postcode = is_null($state) ? static::randomElement($format) : $format[$state]; + return (string)static::randomElement($postcode); + } + + /** + * Return the complete town address with matching postcode and state + * + * @example 55100 Bukit Bintang, Kuala Lumpur + * + * @return @string + */ + public function townState() + { + $state = static::randomElement(array_keys(static::$states)); + $postcode = static::postcode($state); + $town = static::randomElement(static::$towns[$state]); + $state = static::randomElement(static::$states[$state]); + + return $postcode . ' ' . $town . ', ' . $state; + } + + /** + * Return a random city (town) + * + * @example 'Ampang' + * + * @return @string + */ + public function city() + { + $state = static::randomElement(array_keys(static::$towns)); + return static::randomElement(static::$towns[$state]); + } + + /** + * Return a random state + * + * @example 'Johor' + * + * @return @string + */ + public function state() + { + $state = static::randomElement(array_keys(static::$states)); + return static::randomElement(static::$states[$state]); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Company.php b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Company.php new file mode 100644 index 0000000..f2e2f5f --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Company.php @@ -0,0 +1,105 @@ +generator->parse($formats); + } + + /** + * Return Peninsular prefix alphabet + * + * @example 'W' + * + * @return @string + */ + public static function peninsularPrefix() + { + return static::randomElement(static::$peninsularPrefix); + } + + /** + * Return Sarawak state prefix alphabet + * + * @example 'QA' + * + * @return @string + */ + public static function sarawakPrefix() + { + return static::randomElement(static::$sarawakPrefix); + } + + /** + * Return Sabah state prefix alphabet + * + * @example 'SA' + * + * @return @string + */ + public static function sabahPrefix() + { + return static::randomElement(static::$sabahPrefix); + } + + /** + * Return specialty licence plate prefix + * + * @example 'G1M' + * + * @return @string + */ + public static function specialPrefix() + { + return static::randomElement(static::$specialPrefix); + } + + /** + * Return a valid license plate alphabet + * + * @example 'A' + * + * @return @string + */ + public static function validAlphabet() + { + return static::randomElement(static::$validAlphabets); + } + + /** + * Return a valid number sequence between 1 and 9999 + * + * @example '1234' + * + * @return @integer + */ + public static function numberSequence() + { + return mt_rand(1, 9999); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Payment.php b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Payment.php new file mode 100644 index 0000000..b70a590 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Payment.php @@ -0,0 +1,244 @@ +generator->parse($formats); + } + + /** + * Return a Malaysian Bank account number + * + * @example '1234567890123456' + * + * @return @string + */ + public function bankAccountNumber() + { + $formats = static::randomElement(static::$bankAccountNumberFormats); + + return static::numerify($formats); + } + + /** + * Return a Malaysian Local Bank + * + * @example 'Public Bank' + * + * @return @string + */ + public static function localBank() + { + return static::randomElement(static::$localBanks); + } + + /** + * Return a Malaysian Foreign Bank + * + * @example 'Citibank Berhad' + * + * @return @string + */ + public static function foreignBank() + { + return static::randomElement(static::$foreignBanks); + } + + /** + * Return a Malaysian Government Bank + * + * @example 'Bank Simpanan Nasional' + * + * @return @string + */ + public static function governmentBank() + { + return static::randomElement(static::$governmentBanks); + } + + /** + * Return a Malaysian insurance company + * + * @example 'AIA Malaysia' + * + * @return @string + */ + public static function insurance() + { + return static::randomElement(static::$insuranceCompanies); + } + + /** + * Return a Malaysian Bank SWIFT Code + * + * @example 'MBBEMYKLXXX' + * + * @return @string + */ + public static function swiftCode() + { + return static::toUpper(static::lexify(static::randomElement(static::$swiftCodes))); + } + + /** + * Return the Malaysian currency symbol + * + * @example 'RM' + * + * @return @string + */ + public static function currencySymbol() + { + return static::randomElement(static::$currencySymbol); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Person.php new file mode 100644 index 0000000..7dfaaac --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/Person.php @@ -0,0 +1,813 @@ +generator->parse(static::randomElement($formats)); + } + + /** + * Return a Malaysian I.C. No. + * + * @example '890123-45-6789' + * + * @link https://en.wikipedia.org/wiki/Malaysian_identity_card#Structure_of_the_National_Registration_Identity_Card_Number_(NRIC) + * + * @param string|null $gender 'male', 'female' or null for any + * @param bool|string|null $hyphen true, false, or any separator characters + * + * @return string + */ + public static function myKadNumber($gender = null, $hyphen = false) + { + // year of birth + $yy = mt_rand(0, 99); + + // month of birth + $mm = DateTime::month(); + + // day of birth + $dd = DateTime::dayOfMonth(); + + // place of birth (1-59 except 17-20) + while (in_array(($pb = mt_rand(1, 59)), array(17, 18, 19, 20))) { + }; + + // random number + $nnn = mt_rand(0, 999); + + // gender digit. Odd = MALE, Even = FEMALE + $g = mt_rand(0, 9); + //Credit: https://gist.github.com/mauris/3629548 + if ($gender === static::GENDER_MALE) { + $g = $g | 1; + } elseif ($gender === static::GENDER_FEMALE) { + $g = $g & ~1; + } + + // formatting with hyphen + if ($hyphen === true) { + $hyphen = "-"; + } else if ($hyphen === false) { + $hyphen = ""; + } + + return sprintf("%02d%02d%02d%s%02d%s%03d%01d", $yy, $mm, $dd, $hyphen, $pb, $hyphen, $nnn, $g); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/PhoneNumber.php new file mode 100644 index 0000000..ad199c0 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ms_MY/PhoneNumber.php @@ -0,0 +1,217 @@ +generator->parse($format)); + } else { + return static::numerify($this->generator->parse($format)); + } + } + + /** + * Return prefix digits for 011 numbers + * + * @example '10' + * + * @return string + */ + public static function zeroOneOnePrefix() + { + return static::numerify(static::randomElement(static::$zeroOneOnePrefix)); + } + + /** + * Return prefix digits for 014 numbers + * + * @example '2' + * + * @return string + */ + public static function zeroOneFourPrefix() + { + return static::numerify(static::randomElement(static::$zeroOneFourPrefix)); + } + + /** + * Return prefix digits for 015 numbers + * + * @example '1' + * + * @return string + */ + public static function zeroOneFivePrefix() + { + return static::numerify(static::randomElement(static::$zeroOneFivePrefix)); + } + + /** + * Return a Malaysian Fixed Line Phone Number. + * + * @example '+603-4567-8912' + * + * @param bool $countryCodePrefix true, false + * @param bool $formatting true, false + * + * @return string + */ + public function fixedLineNumber($countryCodePrefix = true, $formatting = true) + { + if ($formatting) { + $format = static::randomElement(static::$fixedLineNumberFormatsWithFormatting); + } else { + $format = static::randomElement(static::$fixedLineNumberFormats); + } + + if ($countryCodePrefix) { + return static::countryCodePrefix($formatting) . static::numerify($this->generator->parse($format)); + } else { + return static::numerify($this->generator->parse($format)); + } + } + + /** + * Return a Malaysian VoIP Phone Number. + * + * @example '+6015-678-9234' + * + * @param bool $countryCodePrefix true, false + * @param bool $formatting true, false + * + * @return string + */ + public function voipNumber($countryCodePrefix = true, $formatting = true) + { + if ($formatting) { + $format = static::randomElement(static::$voipNumberWithFormatting); + } else { + $format = static::randomElement(static::$voipNumber); + } + + if ($countryCodePrefix) { + return static::countryCodePrefix($formatting) . static::numerify($this->generator->parse($format)); + } else { + return static::numerify($this->generator->parse($format)); + } + } + + /** + * Return a Malaysian Country Code Prefix. + * + * @example '+6' + * + * @param bool $formatting true, false + * + * @return string + */ + public static function countryCodePrefix($formatting = true) + { + if ($formatting) { + return static::randomElement(static::$plusSymbol) . static::randomElement(static::$countryCodePrefix); + } else { + return static::randomElement(static::$countryCodePrefix); + } + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/Address.php new file mode 100644 index 0000000..d1d8c9e --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/Address.php @@ -0,0 +1,195 @@ +format('dmy'); + + /** + * @todo These number should be random based on birth year + * @link http://no.wikipedia.org/wiki/F%C3%B8dselsnummer + */ + $randomDigits = (string)static::numerify('##'); + + switch($gender) { + case static::GENDER_MALE: + $genderDigit = static::randomElement(array(1,3,5,7,9)); + break; + case static::GENDER_FEMALE: + $genderDigit = static::randomElement(array(0,2,4,6,8)); + break; + default: + $genderDigit = (string)static::numerify('#'); + } + + + $digits = $datePart.$randomDigits.$genderDigit; + + /** + * @todo Calculate modulo 11 of $digits + * @link http://no.wikipedia.org/wiki/F%C3%B8dselsnummer + */ + $checksum = (string)static::numerify('##'); + + + return $digits.$checksum; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/PhoneNumber.php new file mode 100644 index 0000000..9be2993 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/nb_NO/PhoneNumber.php @@ -0,0 +1,22 @@ +format('ymd')); + $help = $date->format('Y') >= 2000 ? 2 : null; + + $check = intval($help.$dob.$middle); + $rest = sprintf('%02d', 97 - ($check % 97)); + + return $dob.$middle.$rest; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/nl_BE/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/nl_BE/PhoneNumber.php new file mode 100644 index 0000000..ac17f1b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/nl_BE/PhoneNumber.php @@ -0,0 +1,20 @@ + 9) { + if ($nr[1] > 0) { + $nr[0] = 8; + $nr[1]--; + } else { + $nr[0] = 1; + $nr[1]++; + + } + } + return implode('', array_reverse($nr)); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/nl_NL/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/nl_NL/PhoneNumber.php new file mode 100644 index 0000000..c27fe9b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/nl_NL/PhoneNumber.php @@ -0,0 +1,39 @@ + 'Narodowy Bank Polski', + '102' => 'Powszechna Kasa OszczÄ™dnoÅ›ci Bank Polski SA', + '103' => 'Bank Handlowy w Warszawie SA', + '105' => 'ING Bank ÅšlÄ…ski SA', + '106' => 'Bank BPH SA', + '109' => 'Bank Zachodni WBK SA', + '113' => 'Bank Gospodarstwa Krajowego', + '114' => 'mBank SA', + '116' => 'Bank Millennium SA', + '122' => 'Bank Handlowo-Kredytowy Spółka Akcyjna w Katowicach w likwidacji', + '124' => 'Bank Polska Kasa Opieki SA', + '128' => 'HSBC Bank Polska SA', + '132' => 'Bank Pocztowy SA', + '147' => 'Euro Bank SA', + '154' => 'Bank Ochrony Åšrodowiska SA', + '158' => 'Mercedes-Benz Bank Polska SA', + '161' => 'SGB-Bank SA', + '167' => 'RBS Bank (Polska) SA', + '168' => 'PLUS BANK SA', + '175' => 'Raiffeisen Bank Polska SA', + '184' => 'Societe Generale SA OddziaÅ‚ w Polsce', + '187' => 'Nest Bank S.A.', + '189' => 'Pekao Bank Hipoteczny SA', + '191' => 'Deutsche Bank Polska SA', + '193' => 'BANK POLSKIEJ SPÓÅDZIELCZOÅšCI SA', + '194' => 'Credit Agricole Bank Polska SA', + '195' => 'Idea Bank SA', + '203' => 'Bank BGÅ» BNP Paribas SA', + '212' => 'Santander Consumer Bank SA', + '213' => 'VOLKSWAGEN BANK POLSKA SA', + '214' => 'FCA-Group Bank Polska SA', + '215' => 'mBank Hipoteczny SA', + '216' => 'Toyota Bank Polska SA', + '219' => 'DNB Bank Polska SA', + '224' => 'Banque PSA Finance SA OddziaÅ‚ w Polsce', + '225' => 'Svenska Handelsbanken AB SA OddziaÅ‚ w Polsce', + '229' => 'BPI Bank Polskich Inwestycji SA', + '232' => 'Nykredit Realkredit A/S SA - OddziaÅ‚ w Polsce', + '235' => 'BNP PARIBAS SA OddziaÅ‚ w Polsce', + '236' => 'Danske Bank A/S SA OddziaÅ‚ w Polsce', + '237' => 'Skandinaviska Enskilda Banken AB (SA) - OddziaÅ‚ w Polsce', + '239' => 'CAIXABANK, S.A. (SPÓÅKA AKCYJNA)ODDZIAÅ W POLSCE', + '241' => 'Elavon Financial Services Designated Activity Company (spółka z o.o. o wyznaczonym przedmiocie dziaÅ‚alnoÅ›ci) OddziaÅ‚ w Polsce', + '243' => 'BNP Paribas Securities Services SKA OddziaÅ‚ w Polsce', + '247' => 'HAITONG BANK, S.A. Spółka Akcyjna OddziaÅ‚ w Polsce', + '248' => 'Getin Noble Bank SA', + '249' => 'Alior Bank SA', + '251' => 'Aareal Bank Aktiengesellschaft (Spółka Akcyjna) - OddziaÅ‚ w Polsce', + '254' => 'Citibank Europe plc (Publiczna Spółka Akcyjna) OddziaÅ‚ w Polsce', + '255' => 'Ikano Bank AB (publ) Spółka Akcyjna OddziaÅ‚ w Polsce', + '256' => 'Nordea Bank AB SA OddziaÅ‚ w Polsce', + '257' => 'UBS Limited (spółka z ograniczonÄ… odpowiedzialnoÅ›ciÄ…) OddziaÅ‚ w Polsce', + '258' => 'J.P. Morgan Europe Limited Sp. z o.o. OddziaÅ‚ w Polsce', + '260' => 'Bank of China (Luxembourg) S.A. Spółka Akcyjna OddziaÅ‚ w Polsce', + '262' => 'Industrial and Commercial Bank of China (Europe) S.A. (Spółka Akcyjna) OddziaÅ‚ w Polsce', + '263' => 'Saxo Bank A/S Spółka Akcyjna OddziaÅ‚ w Polsce w likwidacji', + '264' => 'RCI Banque Spółka Akcyjna OddziaÅ‚ w Polsce', + '265' => 'EUROCLEAR Bank SA/NV (Spółka Akcyjna) - OddziaÅ‚ w Polsce', + '266' => 'Intesa Sanpaolo S.p.A. Spółka Akcyjna OddziaÅ‚ w Polsce', + '267' => 'Western Union International Bank GmbH, Sp. z o.o. OddziaÅ‚ w Polsce', + '269' => 'PKO Bank Hipoteczny SA', + '270' => 'TF BANK AB (Spółka z ograniczonÄ… odpowiedzialnoÅ›ciÄ…) OddziaÅ‚ w Polsce', + '271' => 'FCE Bank Spółka Akcyjna OddziaÅ‚ w Polsce', + '272' => 'AS Inbank Spółka Akcyjna - OddziaÅ‚ w Polsce', + '273' => 'China Construction Bank (Europe) S.A. (Spółka Akcyjna) OddziaÅ‚ w Polsce', + '274' => 'MUFG Bank (Europe) N.V. S.A. OddziaÅ‚ w Polsce', + '275' => 'John Deere Bank S.A. Spółka Akcyjna OddziaÅ‚ w Polsce', + ); + + /** + * @example 'Euro Bank SA' + */ + public static function bank() + { + return static::randomElement(static::$banks); + } + + /** + * International Bank Account Number (IBAN) + * @link http://en.wikipedia.org/wiki/International_Bank_Account_Number + * @param string $prefix for generating bank account number of a specific bank + * @param string $countryCode ISO 3166-1 alpha-2 country code + * @param integer $length total length without country code and 2 check digits + * @return string + */ + public static function bankAccountNumber($prefix = '', $countryCode = 'PL', $length = null) + { + return static::iban($countryCode, $prefix, $length); + } + + protected static function addBankCodeChecksum($iban, $countryCode = 'PL') + { + if ($countryCode != 'PL' || strlen($iban) <= 8) { + return $iban; + } + $checksum = 0; + $weights = array(7, 1, 3, 9, 7, 1, 3); + for ($i = 0; $i < 7; $i++) { + $checksum += $weights[$i] * (int) $iban[$i]; + } + $checksum = $checksum % 10; + + return substr($iban, 0, 7) . $checksum . substr($iban, 8); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/Person.php new file mode 100644 index 0000000..380f4d9 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/Person.php @@ -0,0 +1,227 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } + + public function title($gender = null) + { + return static::randomElement(static::$title); + } + + /** + * replaced by specific unisex Polish title + */ + public static function titleMale() + { + return static::title(); + } + + /** + * replaced by specific unisex Polish title + */ + public static function titleFemale() + { + return static::title(); + } + + /** + * PESEL - Universal Electronic System for Registration of the Population + * @link http://en.wikipedia.org/wiki/PESEL + * @param DateTime $birthdate + * @param string $sex M for male or F for female + * @return string 11 digit number, like 44051401358 + */ + public static function pesel($birthdate = null, $sex = null) + { + if ($birthdate === null) { + $birthdate = \Faker\Provider\DateTime::dateTimeThisCentury(); + } + + $weights = array(1, 3, 7, 9, 1, 3, 7, 9, 1, 3); + $length = count($weights); + + $fullYear = (int) $birthdate->format('Y'); + $year = (int) $birthdate->format('y'); + $month = $birthdate->format('m') + (((int) ($fullYear/100) - 14) % 5) * 20; + $day = $birthdate->format('d'); + + $result = array((int) ($year / 10), $year % 10, (int) ($month / 10), $month % 10, (int) ($day / 10), $day % 10); + + for ($i = 6; $i < $length; $i++) { + $result[$i] = static::randomDigit(); + } + + $result[$length - 1] |= 1; + if ($sex == "F") { + $result[$length - 1] -= 1; + } + + $checksum = 0; + for ($i = 0; $i < $length; $i++) { + $checksum += $weights[$i] * $result[$i]; + } + $checksum = (10 - ($checksum % 10)) % 10; + $result[] = $checksum; + + return implode('', $result); + } + + /** + * National Identity Card number + * @link http://en.wikipedia.org/wiki/Polish_National_Identity_Card + * @return string 3 letters and 6 digits, like ABA300000 + */ + public static function personalIdentityNumber() + { + $range = str_split("ABCDEFGHIJKLMNPRSTUVWXYZ"); + $low = array("A", static::randomElement($range), static::randomElement($range)); + $high = array(static::randomDigit(), static::randomDigit(), static::randomDigit(), static::randomDigit(), static::randomDigit()); + $weights = array(7, 3, 1, 7, 3, 1, 7, 3); + $checksum = 0; + for ($i = 0, $size = count($low); $i < $size; $i++) { + $checksum += $weights[$i] * (ord($low[$i]) - 55); + } + for ($i = 0, $size = count($high); $i < $size; $i++) { + $checksum += $weights[$i+3] * $high[$i]; + } + $checksum %= 10; + + return implode('', $low).$checksum.implode('', $high); + } + + /** + * Taxpayer Identification Number (NIP in Polish) + * @link http://en.wikipedia.org/wiki/PESEL#Other_identifiers + * @link http://pl.wikipedia.org/wiki/NIP + * @return string 10 digit number + */ + public static function taxpayerIdentificationNumber() + { + $weights = array(6, 5, 7, 2, 3, 4, 5, 6, 7); + $result = array(); + do { + $result = array( + static::randomDigitNotNull(), static::randomDigitNotNull(), static::randomDigitNotNull(), + static::randomDigit(), static::randomDigit(), static::randomDigit(), + static::randomDigit(), static::randomDigit(), static::randomDigit(), + ); + $checksum = 0; + for ($i = 0, $size = count($result); $i < $size; $i++) { + $checksum += $weights[$i] * $result[$i]; + } + $checksum %= 11; + } while ($checksum == 10); + $result[] = $checksum; + + return implode('', $result); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/PhoneNumber.php new file mode 100644 index 0000000..65bc5c0 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pl_PL/PhoneNumber.php @@ -0,0 +1,18 @@ + + + Prof. Hart will answer or forward your message. + + We would prefer to send you information by email. + + + **The Legal Small Print** + + + (Three Pages) + + ***START**THE SMALL PRINT!**FOR PUBLIC DOMAIN EBOOKS**START*** + Why is this "Small Print!" statement here? You know: lawyers. + They tell us you might sue us if there is something wrong with + your copy of this eBook, even if you got it for free from + someone other than us, and even if what's wrong is not our + fault. So, among other things, this "Small Print!" statement + disclaims most of our liability to you. It also tells you how + you may distribute copies of this eBook if you want to. + + *BEFORE!* YOU USE OR READ THIS EBOOK + By using or reading any part of this PROJECT GUTENBERG-tm + eBook, you indicate that you understand, agree to and accept + this "Small Print!" statement. If you do not, you can receive + a refund of the money (if any) you paid for this eBook by + sending a request within 30 days of receiving it to the person + you got it from. If you received this eBook on a physical + medium (such as a disk), you must return it with your request. + + ABOUT PROJECT GUTENBERG-TM EBOOKS + This PROJECT GUTENBERG-tm eBook, like most PROJECT GUTENBERG-tm eBooks, + is a "public domain" work distributed by Professor Michael S. Hart + through the Project Gutenberg Association (the "Project"). + Among other things, this means that no one owns a United States copyright + on or for this work, so the Project (and you!) can copy and + distribute it in the United States without permission and + without paying copyright royalties. Special rules, set forth + below, apply if you wish to copy and distribute this eBook + under the "PROJECT GUTENBERG" trademark. + + Please do not use the "PROJECT GUTENBERG" trademark to market + any commercial products without permission. + + To create these eBooks, the Project expends considerable + efforts to identify, transcribe and proofread public domain + works. Despite these efforts, the Project's eBooks and any + medium they may be on may contain "Defects". Among other + things, Defects may take the form of incomplete, inaccurate or + corrupt data, transcription errors, a copyright or other + intellectual property infringement, a defective or damaged + disk or other eBook medium, a computer virus, or computer + codes that damage or cannot be read by your equipment. + + LIMITED WARRANTY; DISCLAIMER OF DAMAGES + But for the "Right of Replacement or Refund" described below, + [1] Michael Hart and the Foundation (and any other party you may + receive this eBook from as a PROJECT GUTENBERG-tm eBook) disclaims + all liability to you for damages, costs and expenses, including + legal fees, and [2] YOU HAVE NO REMEDIES FOR NEGLIGENCE OR + UNDER STRICT LIABILITY, OR FOR BREACH OF WARRANTY OR CONTRACT, + INCLUDING BUT NOT LIMITED TO INDIRECT, CONSEQUENTIAL, PUNITIVE + OR INCIDENTAL DAMAGES, EVEN IF YOU GIVE NOTICE OF THE + POSSIBILITY OF SUCH DAMAGES. + + If you discover a Defect in this eBook within 90 days of + receiving it, you can receive a refund of the money (if any) + you paid for it by sending an explanatory note within that + time to the person you received it from. If you received it + on a physical medium, you must return it with your note, and + such person may choose to alternatively give you a replacement + copy. If you received it electronically, such person may + choose to alternatively give you a second opportunity to + receive it electronically. + + THIS EBOOK IS OTHERWISE PROVIDED TO YOU "AS-IS". NO OTHER + WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, ARE MADE TO YOU AS + TO THE EBOOK OR ANY MEDIUM IT MAY BE ON, INCLUDING BUT NOT + LIMITED TO WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A + PARTICULAR PURPOSE. + + Some states do not allow disclaimers of implied warranties or + the exclusion or limitation of consequential damages, so the + above disclaimers and exclusions may not apply to you, and you + may have other legal rights. + + INDEMNITY + You will indemnify and hold Michael Hart, the Foundation, + and its trustees and agents, and any volunteers associated + with the production and distribution of Project Gutenberg-tm + texts harmless, from all liability, cost and expense, including + legal fees, that arise directly or indirectly from any of the + following that you do or cause: [1] distribution of this eBook, + [2] alteration, modification, or addition to the eBook, + or [3] any Defect. + + DISTRIBUTION UNDER "PROJECT GUTENBERG-tm" + You may distribute copies of this eBook electronically, or by + disk, book or any other medium if you either delete this + "Small Print!" and all other references to Project Gutenberg, + or: + + [1] Only give exact copies of it. Among other things, this + requires that you do not remove, alter or modify the + eBook or this "small print!" statement. You may however, + if you wish, distribute this eBook in machine readable + binary, compressed, mark-up, or proprietary form, + including any form resulting from conversion by word + processing or hypertext software, but only so long as + *EITHER*: + + [*] The eBook, when displayed, is clearly readable, and + does *not* contain characters other than those + intended by the author of the work, although tilde + (~), asterisk (*) and underline (_) characters may + be used to convey punctuation intended by the + author, and additional characters may be used to + indicate hypertext links; OR + + [*] The eBook may be readily converted by the reader at + no expense into plain ASCII, EBCDIC or equivalent + form by the program that displays the eBook (as is + the case, for instance, with most word processors); + OR + + [*] You provide, or agree to also provide on request at + no additional cost, fee or expense, a copy of the + eBook in its original plain ASCII form (or in EBCDIC + or other equivalent proprietary form). + + [2] Honor the eBook refund and replacement provisions of this + "Small Print!" statement. + + [3] Pay a trademark license fee to the Foundation of 20% of the + gross profits you derive calculated using the method you + already use to calculate your applicable taxes. If you + don't derive profits, no royalty is due. Royalties are + payable to "Project Gutenberg Literary Archive Foundation" + the 60 days following each date you prepare (or were + legally required to prepare) your annual (or equivalent + periodic) tax return. Please contact us beforehand to + let us know your plans and to work out the details. + + WHAT IF YOU *WANT* TO SEND MONEY EVEN IF YOU DON'T HAVE TO? + Project Gutenberg is dedicated to increasing the number of + public domain and licensed works that can be freely distributed + in machine readable form. + + The Project gratefully accepts contributions of money, time, + public domain materials, or royalty free copyright licenses. + Money should be paid to the: + "Project Gutenberg Literary Archive Foundation." + + If you are interested in contributing scanning equipment or + software or other items, please contact Michael Hart at: + hart@pobox.com + + [Portions of this eBook's header and trailer may be reprinted only + when distributed free of all fees. Copyright (C) 2001, 2002 by + Michael S. Hart. Project Gutenberg is a TradeMark and may not be + used in any sales of Project Gutenberg eBooks or other materials be + they hardware or software or any other related product without + express permission.] + + *END THE SMALL PRINT! FOR PUBLIC DOMAIN EBOOKS*Ver.02/11/02*END* + + */ +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Address.php new file mode 100644 index 0000000..68b6df0 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Address.php @@ -0,0 +1,154 @@ +generator->numerify('########0001'); + $n .= check_digit($n); + $n .= check_digit($n); + + return $formatted? vsprintf('%d%d.%d%d%d.%d%d%d/%d%d%d%d-%d%d', str_split($n)) : $n; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Internet.php new file mode 100644 index 0000000..7481a6f --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Internet.php @@ -0,0 +1,9 @@ + array( + "4##############" + ), + 'MasterCard' => array( + "5##############" + ), + 'American Express' => array( + "34############", + "37############" + ), + 'Discover Card' => array( + "6011###########", + "622############", + "64#############", + "65#############" + ), + 'Diners' => array( + "301############", + "301##########", + "305############", + "305##########", + "36#############", + "36###########", + "38#############", + "38###########", + ), + 'Elo' => array( + "636368#########", + "438935#########", + "504175#########", + "451416#########", + "636297#########", + "5067###########", + "4576###########", + "4011###########", + ), + 'Hipercard' => array( + "38#############", + "60#############", + ), + "Aura" => array( + "50#############" + ) + ); + + /** + * International Bank Account Number (IBAN) + * @link http://en.wikipedia.org/wiki/International_Bank_Account_Number + * @param string $prefix for generating bank account number of a specific bank + * @param string $countryCode ISO 3166-1 alpha-2 country code + * @param integer $length total length without country code and 2 check digits + * @return string + */ + public static function bankAccountNumber($prefix = '', $countryCode = 'BR', $length = null) + { + return static::iban($countryCode, $prefix, $length); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Person.php new file mode 100644 index 0000000..be39a2e --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/Person.php @@ -0,0 +1,133 @@ +generator->numerify('#########'); + $n .= check_digit($n); + $n .= check_digit($n); + + return $formatted? vsprintf('%d%d%d.%d%d%d.%d%d%d-%d%d', str_split($n)) : $n; + } + + /** + * A random RG number, following Sao Paulo state's rules. + * @link http://pt.wikipedia.org/wiki/C%C3%A9dula_de_identidade + * @param bool $formatted If the number should have dots/dashes or not. + * @return string + */ + public function rg($formatted = true) + { + $n = $this->generator->numerify('########'); + $n .= check_digit($n); + + return $formatted? vsprintf('%d%d.%d%d%d.%d%d%d-%s', str_split($n)) : $n; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/PhoneNumber.php new file mode 100644 index 0000000..4949eef --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/PhoneNumber.php @@ -0,0 +1,137 @@ + '')); + } + + return $number; + } + + /** + * Generates an 9-digit landline number without formatting characters. + * @param bool $formatted [def: true] If it should return a formatted number or not. + * @return string + */ + public static function landline($formatted = true) + { + $number = static::numerify(static::randomElement(static::$landlineFormats)); + + if (!$formatted) { + $number = strtr($number, array('-' => '')); + } + + return $number; + } + + /** + * Randomizes between cellphone and landline numbers. + * @param bool $formatted [def: true] If it should return a formatted number or not. + * @return mixed + */ + public static function phone($formatted = true) + { + $options = static::randomElement(array( + array('cellphone', false), + array('cellphone', true), + array('landline', null), + )); + + return call_user_func("static::{$options[0]}", $formatted, $options[1]); + } + + /** + * Generates a complete phone number. + * @param string $type [def: landline] One of "landline" or "cellphone". Defaults to "landline" on invalid values. + * @param bool $formatted [def: true] If the number should be formatted or not. + * @return string + */ + protected static function anyPhoneNumber($type, $formatted = true) + { + $area = static::areaCode(); + $number = ($type == 'cellphone')? + static::cellphone($formatted) : + static::landline($formatted); + + return $formatted? "($area) $number" : $area.$number; + } + + /** + * Concatenates {@link areaCode} and {@link cellphone} into a national cellphone number. + * @param bool $formatted [def: true] If it should return a formatted number or not. + * @return string + */ + public static function cellphoneNumber($formatted = true) + { + return static::anyPhoneNumber('cellphone', $formatted); + } + + /** + * Concatenates {@link areaCode} and {@link landline} into a national landline number. + * @param bool $formatted [def: true] If it should return a formatted number or not. + * @return string + */ + public static function landlineNumber($formatted = true) + { + return static::anyPhoneNumber('landline', $formatted); + } + + /** + * Randomizes between complete cellphone and landline numbers. + * @return mixed + */ + public function phoneNumber() + { + $method = static::randomElement(array('cellphoneNumber', 'landlineNumber')); + return call_user_func("static::$method", true); + } + + /** + * Randomizes between complete cellphone and landline numbers, cleared from formatting symbols. + * @return mixed + */ + public static function phoneNumberCleared() + { + $method = static::randomElement(array('cellphoneNumber', 'landlineNumber')); + return call_user_func("static::$method", false); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/check_digit.php b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/check_digit.php new file mode 100644 index 0000000..ab67db9 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pt_BR/check_digit.php @@ -0,0 +1,35 @@ += 12; + $verifier = 0; + + for ($i = 1; $i <= $length; $i++) { + if (!$second_algorithm) { + $multiplier = $i+1; + } else { + $multiplier = ($i >= 9)? $i-7 : $i+1; + } + $verifier += $numbers[$length-$i] * $multiplier; + } + + $verifier = 11 - ($verifier % 11); + if ($verifier >= 10) { + $verifier = 0; + } + + return $verifier; +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/Address.php new file mode 100644 index 0000000..a6e1009 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/Address.php @@ -0,0 +1,124 @@ + 0; $i--) { + $numbers[$i] = substr($number, $i - 1, 1); + $partial[$i] = $numbers[$i] * $factor; + $sum += $partial[$i]; + if ($factor == $base) { + $factor = 1; + } + $factor++; + } + $res = $sum % 11; + + if ($res == 0 || $res == 1) { + $digit = 0; + } else { + $digit = 11 - $res; + } + + return $digit; + } + + /** + * + * @link http://nomesportugueses.blogspot.pt/2012/01/lista-dos-cem-nomes-mais-usados-em.html + */ + + protected static $firstNameMale = array( + 'Rodrigo', 'João', 'Martim', 'Afonso', 'Tomás', 'Gonçalo', 'Francisco', 'Tiago', + 'Diogo', 'Guilherme', 'Pedro', 'Miguel', 'Rafael', 'Gabriel', 'Santiago', 'Dinis', + 'David', 'Duarte', 'José', 'Simão', 'Daniel', 'Lucas', 'Gustavo', 'André', 'Denis', + 'Salvador', 'António', 'Vasco', 'Henrique', 'Lourenço', 'Manuel', 'Eduardo', 'Bernardo', + 'Leandro', 'Luís', 'Diego', 'Leonardo', 'Alexandre', 'Rúben', 'Mateus', 'Ricardo', + 'Vicente', 'Filipe', 'Bruno', 'Nuno', 'Carlos', 'Rui', 'Hugo', 'Samuel', 'Ãlvaro', + 'Matias', 'Fábio', 'Ivo', 'Paulo', 'Jorge', 'Xavier', 'Marco', 'Isaac', 'Raúl','Benjamim', + 'Renato', 'Artur', 'Mário', 'Frederico', 'Cristiano', 'Ivan', 'Sérgio', 'Micael', + 'Vítor', 'Edgar', 'Kevin', 'Joaquim', 'Igor', 'Ângelo', 'Enzo', 'Valentim', 'Flávio', + 'Joel', 'Fernando', 'Sebastião', 'Tomé', 'César', 'Cláudio', 'Nelson', 'Lisandro', 'Jaime', + 'Gil', 'Mauro', 'Sandro', 'Hélder', 'Matheus', 'William', 'Gaspar', 'Márcio', + 'Martinho', 'Emanuel', 'Marcos', 'Telmo', 'Davi', 'Wilson' + ); + + protected static $firstNameFemale = array( + 'Maria', 'Leonor', 'Matilde', 'Mariana', 'Ana', 'Beatriz', 'Inês', 'Lara', 'Carolina', 'Margarida', + 'Joana', 'Sofia', 'Diana', 'Francisca', 'Laura', 'Sara', 'Madalena', 'Rita', 'Mafalda', 'Catarina', + 'Luana', 'Marta', 'Ãris', 'Alice', 'Bianca', 'Constança', 'Gabriela', 'Eva', 'Clara', 'Bruna', 'Daniela', + 'Iara', 'Filipa', 'Vitória', 'Ariana', 'Letícia', 'Bárbara', 'Camila', 'Rafaela', 'Carlota', 'Yara', + 'Núria', 'Raquel', 'Ema', 'Helena', 'Benedita', 'Érica', 'Isabel', 'Nicole', 'Lia', 'Alícia', 'Mara', + 'Jéssica', 'Soraia', 'Júlia', 'Luna', 'Victória', 'Luísa', 'Teresa', 'Miriam', 'Adriana', 'Melissa', + 'Andreia', 'Juliana', 'Alexandra', 'Yasmin', 'Tatiana', 'Leticia', 'Luciana', 'Eduarda', 'Cláudia', + 'Débora', 'Fabiana', 'Renata', 'Kyara', 'Kelly', 'Irina', 'Mélanie', 'Nádia', 'Cristiana', 'Liliana', + 'Patrícia', 'Vera', 'Doriana', 'Ângela', 'Mia', 'Erica', 'Mónica', 'Isabela', 'Salomé', 'Cátia', + 'Verónica', 'Violeta', 'Lorena', 'Érika', 'Vanessa', 'Iris', 'Anna', 'Viviane', 'Rebeca', 'Neuza', + ); + + protected static $lastName = array( + 'Abreu', 'Almeida', 'Alves', 'Amaral', 'Amorim', 'Andrade', 'Anjos', 'Antunes', 'Araújo', 'Assunção', + 'Azevedo', 'Baptista', 'Barbosa', 'Barros', 'Batista', 'Borges', 'Branco', 'Brito', 'Campos', 'Cardoso', + 'Carneiro', 'Carvalho', 'Castro', 'Coelho', 'Correia', 'Costa', 'Cruz', 'Cunha', 'Domingues', 'Esteves', + 'Faria', 'Fernandes', 'Ferreira', 'Figueiredo', 'Fonseca', 'Freitas', 'Garcia', 'Gaspar', 'Gomes', + 'Gonçalves', 'Guerreiro', 'Henriques', 'Jesus', 'Leal', 'Leite', 'Lima', 'Lopes', 'Loureiro', 'Lourenço', + 'Macedo', 'Machado', 'Magalhães', 'Maia', 'Marques', 'Martins', 'Matias', 'Matos', 'Melo', 'Mendes', + 'Miranda', 'Monteiro', 'Morais', 'Moreira', 'Mota', 'Moura', 'Nascimento', 'Neto', 'Neves', 'Nogueira', + 'Nunes', 'Oliveira', 'Pacheco', 'Paiva', 'Pereira', 'Pinheiro', 'Pinho', 'Pinto', 'Pires', 'Ramos', + 'Reis', 'Ribeiro', 'Rocha', 'Rodrigues', 'Santos', 'Silva', 'Simões', 'Soares', 'Sousa', + 'Sá', 'Tavares', 'Teixeira', 'Torres', 'Valente', 'Vaz', 'Vicente', 'Vieira', + ); +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/PhoneNumber.php new file mode 100644 index 0000000..618a01c --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/pt_PT/PhoneNumber.php @@ -0,0 +1,50 @@ +generator->parse($format); + } + + public function address() + { + $format = static::randomElement(static::$addressFormats); + + return $this->generator->parse($format); + } + + public function streetAddress() + { + $format = static::randomElement(static::$streetAddressFormats); + + return $this->generator->parse($format); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ro_MD/Payment.php b/vendor/fzaninotto/faker/src/Faker/Provider/ro_MD/Payment.php new file mode 100644 index 0000000..5fb9543 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ro_MD/Payment.php @@ -0,0 +1,19 @@ +generator->parse($format); + } + + /** + * @example 'Cluj' + */ + public function county() + { + return static::randomElement(static::$counties); + } + + public function address() + { + $format = static::randomElement(static::$addressFormats); + + return $this->generator->parse($format); + } + + public function streetAddress() + { + $format = static::randomElement(static::$streetAddressFormats); + + return $this->generator->parse($format); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Payment.php b/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Payment.php new file mode 100644 index 0000000..980e8bb --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Payment.php @@ -0,0 +1,19 @@ + '01', 'AR' => '02', 'AG' => '03', 'B' => '40', 'BC' => '04', 'BH' => '05', + 'BN' => '06', 'BT' => '07', 'BV' => '08', 'BR' => '09', 'BZ' => '10', 'CS' => '11', + 'CL' => '51', 'CJ' => '12', 'CT' => '13', 'CV' => '14', 'DB' => '15', 'DJ' => '16', + 'GL' => '17', 'GR' => '52', 'GJ' => '18', 'HR' => '19', 'HD' => '20', 'IL' => '21', + 'IS' => '22', 'IF' => '23', 'MM' => '24', 'MH' => '25', 'MS' => '26', 'NT' => '27', + 'OT' => '28', 'PH' => '29', 'SM' => '30', 'SJ' => '31', 'SB' => '32', 'SV' => '33', + 'TR' => '34', 'TM' => '35', 'TL' => '36', 'VS' => '37', 'VL' => '38', 'VN' => '39', + + 'B1' => '41', 'B2' => '42', 'B3' => '43', 'B4' => '44', 'B5' => '45', 'B6' => '46' + ); + + /** + * Personal Numerical Code (CNP) + * + * @link http://ro.wikipedia.org/wiki/Cod_numeric_personal + * @example 1111111111118 + * + * @param null|string $gender Person::GENDER_MALE or Person::GENDER_FEMALE + * @param null|string $dateOfBirth (1800-2099) 'Y-m-d', 'Y-m', 'Y' I.E. '1981-06-16', '2085-03', '1900' + * @param null|string $county county code where the CNP was issued + * @param null|bool $isResident flag if the person resides in Romania + * @return string 13 digits CNP code + */ + public function cnp($gender = null, $dateOfBirth = null, $county = null, $isResident = true) + { + $genders = array(Person::GENDER_MALE, Person::GENDER_FEMALE); + if (empty($gender)) { + $gender = static::randomElement($genders); + } elseif (!in_array($gender, $genders)) { + throw new \InvalidArgumentException("Gender must be '{Person::GENDER_MALE}' or '{Person::GENDER_FEMALE}'"); + } + + $date = $this->getDateOfBirth($dateOfBirth); + + if (is_null($county)) { + $countyCode = static::randomElement(array_values(static::$cnpCountyCodes)); + } elseif (!array_key_exists($county, static::$cnpCountyCodes)) { + throw new \InvalidArgumentException("Invalid county code '{$county}' received"); + } else { + $countyCode = static::$cnpCountyCodes[$county]; + } + + $cnp = (string)$this->getGenderDigit($date, $gender, $isResident) + . $date->format('ymd') + . $countyCode + . static::numerify('##%') + ; + + $checksum = $this->getChecksumDigit($cnp); + + return $cnp.$checksum; + } + + /** + * @param $dateOfBirth + * @return \DateTime + */ + protected function getDateOfBirth($dateOfBirth) + { + if (empty($dateOfBirth)) { + $dateOfBirthParts = array(static::numberBetween(1800, 2099)); + } else { + $dateOfBirthParts = explode('-', $dateOfBirth); + } + $baseDate = \Faker\Provider\DateTime::dateTimeBetween("first day of {$dateOfBirthParts[0]}", "last day of {$dateOfBirthParts[0]}"); + + switch (count($dateOfBirthParts)) { + case 1: + $dateOfBirthParts[] = $baseDate->format('m'); + //don't break, we need the day also + case 2: + $dateOfBirthParts[] = $baseDate->format('d'); + //don't break, next line will + case 3: + break; + default: + throw new \InvalidArgumentException("Invalid date of birth - must be null or in the 'Y-m-d', 'Y-m', 'Y' format"); + } + + if ($dateOfBirthParts[0] < 1800 || $dateOfBirthParts[0] > 2099) { + throw new \InvalidArgumentException("Invalid date of birth - year must be between 1900 and 2099, '{$dateOfBirthParts[0]}' received"); + } + + $dateOfBirthFinal = implode('-', $dateOfBirthParts); + $date = \DateTime::createFromFormat('Y-m-d', $dateOfBirthFinal); + //a full (invalid) date might have been supplied, check if it converts + if ($date->format('Y-m-d') !== $dateOfBirthFinal) { + throw new \InvalidArgumentException("Invalid date of birth - '{$date->format('Y-m-d')}' generated based on '{$dateOfBirth}' received"); + } + + return $date; + } + + /** + * + * https://ro.wikipedia.org/wiki/Cod_numeric_personal#S + * + * @param \DateTime $dateOfBirth + * @param bool $isResident + * @param string $gender + * @return int + */ + protected static function getGenderDigit(\DateTime $dateOfBirth, $gender, $isResident) + { + if (!$isResident) { + return 9; + } + + if ($dateOfBirth->format('Y') < 1900) { + if ($gender == Person::GENDER_MALE) { + return 3; + } + return 4; + } + + if ($dateOfBirth->format('Y') < 2000) { + if ($gender == Person::GENDER_MALE) { + return 1; + } + return 2; + } + + if ($gender == Person::GENDER_MALE) { + return 5; + } + return 6; + } + + /** + * Calculates a checksum for the Personal Numerical Code (CNP). + * + * @param string $value 12 digit CNP + * @return int checksum digit + */ + protected function getChecksumDigit($value) + { + $checkNumber = 279146358279; + + $checksum = 0; + foreach (range(0, 11) as $digit) { + $checksum += (int)substr($value, $digit, 1) * (int)substr($checkNumber, $digit, 1); + } + $checksum = $checksum % 11; + + return $checksum == 10 ? 1 : $checksum; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/PhoneNumber.php new file mode 100644 index 0000000..e8af810 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/PhoneNumber.php @@ -0,0 +1,67 @@ + array( + '021#######', // Bucharest + '023#######', + '024#######', + '025#######', + '026#######', + '027#######', // non-geographic + '031#######', // Bucharest + '033#######', + '034#######', + '035#######', + '036#######', + '037#######', // non-geographic + ), + 'mobile' => array( + '07########', + ) + ); + + protected static $specialFormats = array( + 'toll-free' => array( + '0800######', + '0801######', // shared-cost numbers + '0802######', // personal numbering + '0806######', // virtual cards + '0807######', // pre-paid cards + '0870######', // internet dial-up + ), + 'premium-rate' => array( + '0900######', + '0903######', // financial information + '0906######', // adult entertainment + ) + ); + + /** + * @link http://en.wikipedia.org/wiki/Telephone_numbers_in_Romania#Last_years + */ + public function phoneNumber() + { + $type = static::randomElement(array_keys(static::$normalFormats)); + $number = static::numerify(static::randomElement(static::$normalFormats[$type])); + + return $number; + } + + public static function tollFreePhoneNumber() + { + $number = static::numerify(static::randomElement(static::$specialFormats['toll-free'])); + + return $number; + } + + public static function premiumRatePhoneNumber() + { + $number = static::numerify(static::randomElement(static::$specialFormats['premium-rate'])); + + return $number; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Text.php b/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Text.php new file mode 100644 index 0000000..410c6f9 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ro_RO/Text.php @@ -0,0 +1,154 @@ +generator->parse($format); + } + + public static function country() + { + return static::randomElement(static::$country); + } + + public static function postcode() + { + return static::toUpper(static::bothify(static::randomElement(static::$postcode))); + } + + public static function regionSuffix() + { + return static::randomElement(static::$regionSuffix); + } + + public static function region() + { + return static::randomElement(static::$region); + } + + public static function cityPrefix() + { + return static::randomElement(static::$cityPrefix); + } + + public function city() + { + return static::randomElement(static::$city); + } + + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + public static function street() + { + return static::randomElement(static::$street); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Color.php b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Color.php new file mode 100644 index 0000000..e1af033 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Color.php @@ -0,0 +1,23 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefixes); + } + + public static function companyNameElement() + { + return static::randomElement(static::$companyElements); + } + + public static function companyNameSuffix() + { + return static::randomElement(static::$companyNameSuffixes); + } + + public static function inn($area_code = "") + { + if ($area_code === "" || intval($area_code) == 0) { + //Simple generation code for areas in Russian without check for valid + $area_code = static::numberBetween(1, 91); + } else { + $area_code = intval($area_code); + } + $area_code = str_pad($area_code, 2, '0', STR_PAD_LEFT); + $inn_base = $area_code . static::numerify('#######'); + return $inn_base . \Faker\Calculator\Inn::checksum($inn_base); + } + + public static function kpp($inn = "") + { + if ($inn == "" || strlen($inn) < 4) { + $inn = static::inn(); + } + return substr($inn, 0, 4) . "01001"; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Internet.php new file mode 100644 index 0000000..53870ee --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Internet.php @@ -0,0 +1,9 @@ +.*<' | \ + * sed -r 's/—//' | sed -r 's/[\<\>]//g' | sed -r "s/(^|$)/'/g" | sed -r 's/$/,/' | sed -r 's/\&(laquo|raquo);/"/g' | \ + * sed -r 's/\s+/ /g'" + */ + protected static $banks = array( + 'Ðовый Промышленный Банк', + 'Ðовый Символ', + 'ÐокÑÑбанк', + 'ÐооÑфера', + 'Ðордеа Банк', + 'Ðота-Банк', + 'ÐС Банк', + 'ÐСТ-Банк', + 'ÐÑклиÑ-Банк', + 'Образование', + 'Объединенный Банк Промышленных ИнвеÑтиций', + 'Объединенный Банк РеÑпублики', + 'Объединенный Капитал', + 'Объединенный Кредитный Банк', + 'Объединенный Кредитный Банк МоÑковÑкий филиал', + 'Объединенный Ðациональный Банк', + 'Объединенный Резервный Банк', + 'Океан Банк', + 'ОЛМÐ-Банк', + 'Онего', + 'Оней Банк', + 'ОПМ-Банк', + 'Оргбанк', + 'Оренбург', + 'ОТП Банк', + 'ОФК Банк', + 'Охабанк', + 'Первобанк', + 'ПервомайÑкий', + 'ПервоуральÑкбанк', + 'Первый ДортранÑбанк', + 'Первый ИнвеÑтиционный банк', + 'Первый КлиентÑкий Банк', + 'Первый ЧешÑко-РоÑÑийÑкий Банк', + 'ПереÑвет', + 'Пермь', + 'ПетербургÑкий Социальный КоммерчеÑкий Банк', + 'Петрокоммерц', + 'ПИР Банк', + 'Платина', + 'Плато-Банк', + 'ÐŸÐ»ÑŽÑ Ð‘Ð°Ð½Ðº', + 'Пойдем!', + 'Почтобанк', + 'Прайм ФинанÑ', + 'Преодоление', + 'Приморье', + 'ПримÑоцбанк', + 'Примтеркомбанк', + 'Прио-Внешторгбанк', + 'Приобье', + 'ПриполÑрный', + 'ПриÑко Капитал Банк', + 'ПробизнеÑбанк', + 'ПроинвеÑтбанк', + 'Прокоммерцбанк', + 'ПроминвеÑтбанк', + 'Промрегионбанк', + 'ПромÑвÑзьбанк', + 'ПромÑвÑзьинвеÑтбанк', + 'ПромÑельхозбанк', + 'ПромтранÑбанк', + 'Промышленно-ФинанÑовое СотрудничеÑтво', + 'ПромÑнергобанк', + 'ПрофеÑÑионал Банк', + 'Профит Банк', + 'Прохладный', + 'ÐŸÑƒÐ»ÑŒÑ Ð¡Ñ‚Ð¾Ð»Ð¸Ñ†Ñ‹', + 'Радиотехбанк', + 'Развитие', + 'Развитие-Столица', + 'Райффайзенбанк', + 'РаÑчетно-Кредитный Банк', + 'РаÑчетный Дом', + 'РБÐ', + 'Региональный Банк РазвитиÑ', + 'Региональный Банк Сбережений', + 'Региональный КоммерчеÑкий Банк', + 'Региональный Кредит', + 'РегионфинанÑбанк', + 'Регнум', + 'Резерв', + 'РенеÑÑанÑ', + 'РенеÑÑÐ°Ð½Ñ ÐšÑ€ÐµÐ´Ð¸Ñ‚', + 'Рента-Банк', + 'РЕСО Кредит', + 'РеÑпубликанÑкий Кредитный ÐльÑнÑ', + 'РеÑурÑ-ТраÑÑ‚', + 'Риабанк', + 'Риал-Кредит', + 'РинвеÑтбанк', + 'РинвеÑтбанк МоÑковÑкий офиÑ', + 'РИТ-Банк', + 'РРБанк', + 'РоÑавтобанк', + 'РоÑбанк', + 'РоÑбизнеÑбанк', + 'РоÑгоÑÑтрах Банк', + 'РоÑдорбанк', + 'РоÑЕвроБанк', + 'РоÑинтерБанк', + 'РоÑпромбанк', + 'РоÑÑельхозбанк', + 'РоÑÑийÑÐºÐ°Ñ Ð¤Ð¸Ð½Ð°Ð½ÑÐ¾Ð²Ð°Ñ ÐšÐ¾Ñ€Ð¿Ð¾Ñ€Ð°Ñ†Ð¸Ñ', + 'РоÑÑийÑкий Капитал', + 'РоÑÑийÑкий Кредит', + 'РоÑÑийÑкий Ðациональный КоммерчеÑкий Банк', + 'РоÑÑита-Банк', + 'РоÑÑиÑ', + 'РоÑÑ‚ Банк', + 'РоÑтфинанÑ', + 'РоÑÑкÑимбанк', + 'РоÑÑнергобанк', + 'РоÑл Кредит Банк', + 'РСКБ', + 'РТС-Банк', + 'РУБанк', + 'Рублев', + 'Руна-Банк', + 'РунÑтбанк', + 'РуÑкобанк', + 'РуÑнарбанк', + 'РуÑÑкий Банк Сбережений', + 'РуÑÑкий Ипотечный Банк', + 'РуÑÑкий Международный Банк', + 'РуÑÑкий Ðациональный Банк', + 'РуÑÑкий Стандарт', + 'РуÑÑкий Торговый Банк', + 'РуÑÑкий ТраÑтовый Банк', + 'РуÑÑкий ФинанÑовый ÐльÑнÑ', + 'РуÑÑкий Элитарный Банк', + 'РуÑÑлавбанк', + 'РуÑÑобанк', + 'РуÑÑтройбанк', + 'РуÑÑ„Ð¸Ð½Ð°Ð½Ñ Ð‘Ð°Ð½Ðº', + 'РуÑÑŒ', + 'РуÑьРегионБанк', + 'РуÑьуниверÑалбанк', + 'РуÑЮгбанк', + 'РФИ Банк', + 'Саммит Банк', + 'Санкт-ПетербургÑкий Банк ИнвеÑтиций', + 'Саратов', + 'СаровбизнеÑбанк', + 'Сбербанк РоÑÑии', + 'СвÑзной Банк', + 'СвÑзь-Банк', + 'СДМ-Банк', + 'СеваÑтопольÑкий МорÑкой банк', + 'Северный Кредит', + 'Северный Ðародный Банк', + 'Северо-ВоÑточный ÐльÑнÑ', + 'Северо-Западный 1 ÐльÑÐ½Ñ Ð‘Ð°Ð½Ðº', + 'СеверÑтройбанк', + 'СевзапинвеÑтпромбанк', + 'Сельмашбанк', + 'СервиÑ-Резерв', + 'Сетелем Банк', + 'СИÐБ', + 'СибирÑкий Банк РеконÑтрукции и РазвитиÑ', + 'Сибнефтебанк', + 'СибÑоцбанк', + 'СибÑÑ', + 'СибÑÑ ÐœÐ¾ÑковÑкий офиÑ', + 'СинергиÑ', + 'Синко-Банк', + 'СиÑтема', + 'Сити ИнвеÑÑ‚ Банк', + 'Ситибанк', + 'СКÐ-Банк', + 'СКБ-Банк', + 'СлавиÑ', + 'СлавÑнбанк', + 'СлавÑнÑкий Кредит', + 'Смартбанк', + 'СМБ-Банк', + 'Смолевич', + 'СМП Банк', + 'СнежинÑкий', + 'Собинбанк', + 'Соверен Банк', + 'СоветÑкий', + 'Совкомбанк', + 'Современные Стандарты БизнеÑа', + 'СодружеÑтво', + 'СоколовÑкий', + 'Солид Банк', + 'СолидарноÑÑ‚ÑŒ (МоÑква)', + 'СолидарноÑÑ‚ÑŒ (Самара)', + 'СоцинвеÑтбанк', + 'СоцинвеÑтбанк МоÑковÑкий филиал', + 'Социум-Банк', + 'Союз', + 'Союзный', + 'СпецÑтройбанк', + 'Спиритбанк', + 'Спурт Банк', + 'Спутник', + 'СтавропольпромÑтройбанк', + 'Сталь Банк', + 'Стандарт-Кредит', + 'Стар ÐльÑнÑ', + 'СтарБанк', + 'СтарооÑкольÑкий Ðгропромбанк', + 'Старый Кремль', + 'Стелла-Банк', + 'Столичный Кредит', + 'СтратегиÑ', + 'Строительно-КоммерчеÑкий Банк', + 'СтройлеÑбанк', + 'Сумитомо Мицуи', + 'Сургутнефтегазбанк', + 'СЭБ Банк', + 'Таатта', + 'ТавричеÑкий', + 'Таганрогбанк', + 'Тагилбанк', + 'Тайдон', + 'Тайм Банк', + 'Тальменка-Банк', + 'Тальменка-Банк МоÑковÑкий филиал', + 'Тамбовкредитпромбанк', + 'Татагропромбанк', + 'ТатÑоцбанк', + 'Татфондбанк', + 'Ð¢Ð°ÑƒÑ€ÑƒÑ Ð‘Ð°Ð½Ðº', + 'ТверьУниверÑалБанк', + 'ТекÑбанк', + 'Темпбанк', + 'Тендер-Банк', + 'Терра', + 'ТетраполиÑ', + 'Тимер Банк', + 'Тинькофф Банк', + 'ТихоокеанÑкий Внешторгбанк', + 'Тойота Банк', + 'ТольÑттихимбанк', + 'ТомÑкпромÑтройбанк', + 'Торгово-Промышленный Банк КитаÑ', + 'Торговый ГородÑкой Банк', + 'ТоржокуниверÑалбанк', + 'ТранÑкапиталбанк', + 'ТранÑнациональный Банк', + 'ТранÑпортный', + 'ТранÑÑтройбанк', + 'ТраÑÑ‚ Капитал Банк', + 'Тройка-Д Банк', + 'ТульÑкий Промышленник', + 'ТульÑкий Промышленник МоÑковÑкий офиÑ', + 'ТульÑкий РаÑчетный Центр', + 'Турбобанк', + 'ТуÑар', + 'ТЭМБР-Банк', + 'ТЭСТ', + 'Углеметбанк', + 'Уздан', + 'Унифин', + 'Унифондбанк', + 'Уралкапиталбанк', + 'Уралприватбанк', + 'Уралпромбанк', + 'УралÑиб', + 'УралтранÑбанк', + 'УралфинанÑ', + 'УральÑкий Банк РеконÑтрукции и РазвитиÑ', + 'УральÑкий Межрегиональный Банк', + 'УральÑкий ФинанÑовый Дом', + 'Ури Банк', + 'УÑÑури', + 'ФДБ', + 'ФИÐ-Банк', + 'Финам Банк', + 'Ð¤Ð¸Ð½Ð°Ð½Ñ Ð‘Ð¸Ð·Ð½ÐµÑ Ð‘Ð°Ð½Ðº', + 'ФинанÑово-Промышленный Капитал', + 'ФинанÑовый Капитал', + 'ФинанÑовый Стандарт', + 'Ð¤Ð¸Ð½Ð°Ñ€Ñ Ð‘Ð°Ð½Ðº', + 'Финпромбанк (ФПБ Банк)', + 'ФинтраÑтбанк', + 'ФК Открытие (бывш. ÐОМОС-Банк)', + 'Флора-МоÑква', + 'ФолькÑваген Банк РуÑ', + 'ФондÑервиÑбанк', + 'Фора-Банк', + 'Форбанк', + 'Ð¤Ð¾Ñ€ÑƒÑ Ð‘Ð°Ð½Ðº', + 'Форштадт', + 'Фьючер', + 'ХакаÑÑкий Муниципальный Банк', + 'Ханты-МанÑийÑкий банк Открытие', + 'Химик', + 'Хлынов', + 'ХованÑкий', + 'ХолдинвеÑтбанк', + 'ХолмÑк', + 'Хоум Кредит Банк', + 'Центр-инвеÑÑ‚', + 'Центрально-ÐзиатÑкий', + 'Центрально-ЕвропейÑкий Банк', + 'Центркомбанк', + 'ЦентроКредит', + 'Церих', + 'Чайна КонÑтракшн', + 'ЧайнаÑельхозбанк', + 'Челиндбанк', + 'ЧелÑбинвеÑтбанк', + 'ЧерноморÑкий банк Ñ€Ð°Ð·Ð²Ð¸Ñ‚Ð¸Ñ Ð¸ реконÑтрукции', + 'Чувашкредитпромбанк', + 'Эйч-ЭÑ-Би-Си Банк (HSBC)', + 'Эко-ИнвеÑÑ‚', + 'Экономбанк', + 'ЭкономикÑ-Банк', + 'ЭкÑи-Банк', + 'ЭкÑперт Банк', + 'ЭкÑпобанк', + 'ЭкÑпреÑÑ-Волга', + 'ЭкÑпреÑÑ-Кредит', + 'Эл Банк', + 'Элита', + 'Эльбин', + 'Энергобанк', + 'Энергомашбанк', + 'ЭнерготранÑбанк', + 'Эно', + 'ЭнтузиаÑтбанк', + 'Эргобанк', + 'Ю Би Ð­Ñ Ð‘Ð°Ð½Ðº', + 'ЮГ-ИнвеÑтбанк', + 'Югра', + 'Южный Региональный Банк', + 'ЮМК', + 'ЮниаÑтрум Банк', + 'ЮниКредит Банк', + 'ЮниÑтрим', + 'Япы Креди Банк МоÑква', + 'ЯР-Банк', + 'Яринтербанк', + 'ЯроÑлавич', + 'K2 Банк', + 'ÐББ', + 'ÐбÑолют Банк', + 'Ðвангард', + 'ÐверÑ', + 'Ðвтоградбанк', + 'ÐвтоКредитБанк', + 'Ðвтоторгбанк', + 'Ðгроинкомбанк', + 'Ðгропромкредит', + 'ÐгророÑ', + 'ÐгроÑоюз', + 'Ðдамон Банк', + 'Ðдамон Банк МоÑковÑкий филиал', + 'Ðделантбанк', + 'ÐдмиралтейÑкий', + 'ÐзиатÑко-ТихоокеанÑкий Банк', + 'Ðзимут', + 'ÐÐ·Ð¸Ñ Ð‘Ð°Ð½Ðº', + 'ÐзиÑ-ИнвеÑÑ‚ Банк', + 'Ðй-Си-Ðй-Си-Ðй Банк (ICICI)', + 'Ðйви Банк', + 'ÐйМаниБанк', + 'Ðк БарÑ', + 'Ðкибанк', + 'Ðккобанк', + 'Ðкрополь', + 'ÐкÑонбанк', + 'Ðктив Банк', + 'ÐктивКапитал Банк', + 'ÐктивКапитал Банк МоÑковÑкий филиал', + 'ÐктивКапитал Банк Санкт-ПетербургÑкий филиал', + 'Ðкцент', + 'Ðкцепт', + 'ÐкциÑ', + 'Ðлданзолотобанк', + 'ÐлекÑандровÑкий', + 'Ðлеф-Банк', + 'Ðлжан', + 'ÐлмазÑргиÑнбанк', + 'ÐлтайБизнеÑ-Банк', + 'Ðлтайкапиталбанк', + 'Ðлтынбанк', + 'Ðльба ÐльÑнÑ', + 'Ðльта-Банк', + 'Ðльтернатива', + 'Ðльфа-Банк', + 'ÐМБ Банк', + 'ÐмерикÑн ЭкÑпреÑÑ Ð‘Ð°Ð½Ðº', + 'Ðнелик РУ', + 'Ðнкор Банк', + 'Ðнталбанк', + 'Ðпабанк', + 'ÐреÑбанк', + 'ÐрзамаÑ', + 'ÐркÑбанк', + 'ÐÑ€Ñенал', + 'ÐÑпект', + 'ÐÑÑоциациÑ', + 'БайкалБанк', + 'БайкалИнвеÑтБанк', + 'Байкалкредобанк', + 'Балаково-Банк', + 'БалтийÑкий Банк', + 'Балтика', + 'БалтинвеÑтбанк', + 'Банк "Ðкцент" МоÑковÑкий филиал', + 'Банк "МБÐ-МоÑква"', + 'Банк "Санкт-Петербург"', + 'Банк ÐВБ', + 'Банк БКФ', + 'Банк БФÐ', + 'Банк БЦК-МоÑква', + 'Банк Город', + 'Банк Жилищного ФинанÑированиÑ', + 'Банк Инноваций и РазвитиÑ', + 'Банк Интеза', + 'Банк ИТБ', + 'Банк Казани', + 'Банк ÐšÐ¸Ñ‚Ð°Ñ (ЭлоÑ)', + 'Банк Кредит СвиÑÑ', + 'Банк МБФИ', + 'Банк МоÑквы', + 'Банк на КраÑных Воротах', + 'Банк Оранжевый (бывш. ПромÑервиÑбанк)', + 'Банк оф Токио-МицубиÑи', + 'Банк Премьер Кредит', + 'Банк ÐŸÐ¡Ð Ð¤Ð¸Ð½Ð°Ð½Ñ Ð ÑƒÑ', + 'Банк Ð Ð°Ð·Ð²Ð¸Ñ‚Ð¸Ñ Ð¢ÐµÑ…Ð½Ð¾Ð»Ð¾Ð³Ð¸Ð¹', + 'Банк РаÑчетов и Сбережений', + 'Банк Раунд', + 'Банк РСИ', + 'Банк Сберегательно-кредитного ÑервиÑа', + 'Банк СГБ', + 'Банк Торгового ФинанÑированиÑ', + 'Банк ФинÑервиÑ', + 'Банк ЭкономичеÑкий Союз', + 'БанкирÑкий Дом', + 'Ð‘Ð°Ð½ÐºÑ…Ð°ÑƒÑ Ð­Ñ€Ð±Ðµ', + 'БашкомÑнаббанк', + 'Башпромбанк', + 'ББР Банк', + 'БелгородÑоцбанк', + 'Бенифит-Банк', + 'Берейт', + 'БеÑÑ‚ Ð­Ñ„Ñ„Ð¾Ñ€Ñ‚Ñ Ð‘Ð°Ð½Ðº', + 'Ð‘Ð¸Ð·Ð½ÐµÑ Ð´Ð»Ñ Ð‘Ð¸Ð·Ð½ÐµÑа', + 'Бинбанк', + 'БИÐБÐÐК кредитные карты', + 'Бинбанк МурманÑк', + 'БКС ИнвеÑтиционный Банк', + 'БМВ Банк', + 'БÐП Париба Банк', + 'БогородÑкий', + 'БогородÑкий Муниципальный Банк', + 'БратÑкий ÐÐКБ', + 'БСТ-Банк', + 'Булгар Банк', + 'Бум-Банк', + 'Бумеранг', + 'БФГ-Кредит', + 'БыÑтроБанк', + 'Вакобанк', + 'Вега-Банк', + 'Век', + 'Великие Луки Банк', + 'Венец', + 'ВерхневолжÑкий', + 'ВерхневолжÑкий КрымÑкий филиал', + 'ВерхневолжÑкий МоÑковÑкий филиал', + 'ВерхневолжÑкий ÐевÑкий филиал', + 'ВерхневолжÑкий ТавричеÑкий филиал', + 'ВерхневолжÑкий ЯроÑлавÑкий филиал', + 'ВеÑта', + 'ВеÑтинтербанк', + 'ВзаимодейÑтвие', + 'Викинг', + 'Витабанк', + 'ВитÑзь', + 'Вкабанк', + 'ВладбизнеÑбанк', + 'Владпромбанк', + 'Внешпромбанк', + 'Внешфинбанк', + 'ВнешÑкономбанк', + 'Военно-Промышленный Банк', + 'Возрождение', + 'Вокбанк', + 'Вологдабанк', + 'Вологжанин', + 'Воронеж', + 'ВоÑточно-ЕвропейÑкий ТраÑтовый Банк', + 'ВоÑточный ЭкÑпреÑÑ Ð‘Ð°Ð½Ðº', + 'ВоÑтСибтранÑкомбанк', + 'ВРБ МоÑква', + 'Ð’ÑероÑÑийÑкий Банк Ð Ð°Ð·Ð²Ð¸Ñ‚Ð¸Ñ Ð ÐµÐ³Ð¸Ð¾Ð½Ð¾Ð²', + 'ВТБ', + 'ВТБ 24', + 'ВУЗ-Банк', + 'Выборг-Банк', + 'Выборг-Банк МоÑковÑкий филиал', + 'Ð’Ñлтон Банк', + 'Ð’Ñтич', + 'Ð’Ñтка-Банк', + 'ГагаринÑкий', + 'Газбанк', + 'Газнефтьбанк', + 'Газпромбанк', + 'ГазÑтройбанк', + 'ГазтранÑбанк', + 'ГазÑнергобанк', + 'Ганзакомбанк', + 'Гарант-ИнвеÑÑ‚', + 'Гаранти Банк МоÑква', + 'Геленджик-Банк', + 'Генбанк', + 'Геобанк', + 'ГефеÑÑ‚', + 'ГлобуÑ', + 'ГлобÑкÑ', + 'Голдман Ð¡Ð°ÐºÑ Ð‘Ð°Ð½Ðº', + 'Горбанк', + 'ГПБ-Ипотека', + 'Гранд ИнвеÑÑ‚ Банк', + 'Гринкомбанк', + 'Гринфилдбанк', + 'ГриÑ-Банк', + 'Гута-Банк', + 'Далена', + 'Далетбанк', + 'Далта-Банк', + 'ДальневоÑточный Банк', + 'ДанÑке Банк', + 'Девон-Кредит', + 'ДельтаКредит', + 'Денизбанк МоÑква', + 'Держава', + 'Дж. П. ÐœÐ¾Ñ€Ð³Ð°Ð½ Банк', + 'ДжаÑÑ‚ Банк', + 'Джей Ñнд Ти Банк', + 'Дил-Банк', + 'Динамичные СиÑтемы', + 'Дойче Банк', + 'ДолинÑк', + 'Дом-Банк', + 'Дон-ТекÑбанк', + 'Донкомбанк', + 'Донхлеббанк', + 'Ð”Ð¾Ñ€Ð¸Ñ Ð‘Ð°Ð½Ðº', + 'Дружба', + 'ЕÐТП Банк', + 'ЕвразийÑкий Банк', + 'ЕвроазиатÑкий ИнвеÑтиционный Банк', + 'ЕвроÐкÑÐ¸Ñ Ð‘Ð°Ð½Ðº', + 'ЕвроальÑнÑ', + 'Еврокапитал-ÐльÑнÑ', + 'Еврокоммерц', + 'Еврокредит', + 'Евромет', + 'ЕвропейÑкий Стандарт', + 'Европлан Банк', + 'ЕвроÑитиБанк', + 'Ð•Ð²Ñ€Ð¾Ñ„Ð¸Ð½Ð°Ð½Ñ ÐœÐ¾Ñнарбанк', + 'ЕдинÑтвенный', + 'Единый Строительный Банк', + 'Екатеринбург', + 'ЕкатерининÑкий', + 'ЕниÑей', + 'ЕниÑейÑкий Объединенный Банк', + 'Ермак', + 'Живаго-Банк', + 'Жилкредит', + 'ЖилÑтройбанк', + 'ЗапÑибкомбанк', + 'Заречье', + 'Заубер Банк', + 'Земкомбанк', + 'ЗемÑкий Банк', + 'Зенит', + 'Зенит Сочи', + 'Зернобанк', + 'Зираат Банк', + 'Златкомбанк', + 'И.Д.Е.Ð. Банк', + 'Иваново', + 'Идеалбанк', + 'Ижкомбанк', + 'ИК Банк', + 'Икано Банк', + 'Инбанк', + 'ИнвеÑÑ‚-Экобанк', + 'ИнвеÑтиционный Банк Кубани', + 'ИнвеÑтиционный РеÑпубликанÑкий Банк', + 'ИнвеÑтиционный Союз', + 'ИнвеÑткапиталбанк', + 'ИнвеÑÑ‚Ñоцбанк', + 'ИнвеÑтторгбанк', + 'ИÐГ Банк', + 'ИндуÑтриальный Сберегательный Банк', + 'Инкаробанк', + 'Интерактивный Банк', + 'Интеркоммерц Банк', + 'Интеркоопбанк', + 'Интеркредит', + 'Интернациональный Торговый Банк', + 'ИнтерпрогреÑÑбанк', + 'Интерпромбанк', + 'Интехбанк', + 'ИнформпрогреÑÑ', + 'Ипозембанк', + 'ИпоТек Банк', + 'Иронбанк', + 'ИРС', + 'Итуруп', + 'Ишбанк', + 'Йошкар-Ола', + 'Калуга', + 'КамÑкий Горизонт', + 'КамÑкий КоммерчеÑкий Банк', + 'Камчаткомагропромбанк', + 'КанÑкий', + 'Капитал', + 'Капиталбанк', + 'Кедр', + 'КемÑоцинбанк', + 'КетовÑкий КоммерчеÑкий Банк', + 'Киви Банк', + 'КлаÑÑик Эконом Банк', + 'КлиентÑкий', + 'Кольцо Урала', + 'Коммерцбанк (ЕвразиÑ)', + 'КоммерчеÑкий Банк РазвитиÑ', + 'КоммерчеÑкий Индо Банк', + 'КонÑервативный КоммерчеÑкий Банк', + 'КонÑтанÑ-Банк', + 'Континенталь', + 'КонфидÑÐ½Ñ Ð‘Ð°Ð½Ðº', + 'Кор', + 'Кореа ЭкÑчендж Банк РуÑ', + 'КоролевÑкий Банк Шотландии', + 'КоÑмоÑ', + 'КоÑтромаÑелькомбанк', + 'Кошелев-Банк', + 'КрайинвеÑтбанк', + 'Кранбанк', + 'Креди Ðгриколь КИБ', + 'Кредит Европа Банк', + 'Кредит Урал Банк', + 'Кредит ЭкÑпреÑÑ', + 'Кредит-МоÑква', + 'КредитинвеÑÑ‚', + 'Кредо ФинанÑ', + 'Кредпромбанк', + 'КремлевÑкий', + 'КрокуÑ-Банк', + 'Крона-Банк', + 'КроÑна-Банк', + 'КроÑÑинвеÑтбанк', + 'КрыловÑкий', + 'КС Банк', + 'КубанÑкий УниверÑальный Банк', + 'Кубань Кредит', + 'Кубаньторгбанк', + 'КузбаÑÑхимбанк', + 'КузнецкбизнеÑбанк', + 'Кузнецкий', + 'Кузнецкий МоÑÑ‚', + 'Курган', + 'КурÑкпромбанк', + 'Лада-Кредит', + 'Лайтбанк', + 'Ланта-Банк', + 'Левобережный', + 'Легион', + 'Леноблбанк', + 'ЛеÑбанк', + 'Лето Банк', + 'Липецккомбанк', + 'ЛогоÑ', + 'Локо-Банк', + 'ЛÑнд-Банк', + 'Ðœ2Ðœ Прайвет Банк', + 'Майкопбанк', + 'МайÑкий', + 'ÐœÐК-Банк', + 'МакÑима', + 'МакÑимум', + 'ÐœÐСТ-Банк', + 'МаÑтер-Капитал', + 'МВС Банк', + 'МДМ Банк', + 'МегаполиÑ', + 'Международный Ðкционерный Банк', + 'Международный Банк РазвитиÑ', + 'Международный Банк Санкт-Петербурга (МБСП)', + 'Международный КоммерчеÑкий Банк', + 'Международный РаÑчетный Банк', + 'Международный Строительный Банк', + 'Международный ФинанÑовый Клуб', + 'МежотраÑÐ»ÐµÐ²Ð°Ñ Ð‘Ð°Ð½ÐºÐ¾Ð²ÑÐºÐ°Ñ ÐšÐ¾Ñ€Ð¿Ð¾Ñ€Ð°Ñ†Ð¸Ñ', + 'Межрегиональный Банк РеконÑтрукции', + 'Межрегиональный Клиринговый Банк', + 'Межрегиональный Почтовый Банк', + 'Межрегиональный промышленно-Ñтроительный банк', + 'Межрегионбанк', + 'МежтопÑнергобанк', + 'МежтраÑтбанк', + 'МерÑедеÑ-Бенц Банк РуÑ', + 'МеталлинвеÑтбанк', + 'Металлург', + 'Меткомбанк (КаменÑк-УральÑкий)', + 'Меткомбанк (Череповец)', + 'Метробанк', + 'Метрополь', + 'Мидзухо Банк', + 'Мико-Банк', + 'Милбанк', + 'Миллениум Банк', + 'Мир Ð‘Ð¸Ð·Ð½ÐµÑ Ð‘Ð°Ð½Ðº', + 'Мираф-Банк', + 'Мираф-Банк МоÑковÑкий филиал', + 'Миръ', + 'МихайловÑкий ПЖСБ', + 'Морган СтÑнли Банк', + 'МорÑкой Банк', + 'МоÑводоканалбанк', + 'МоÑква', + 'МоÑква-Сити', + 'МоÑковÑкий ВекÑельный Банк', + 'МоÑковÑкий ИндуÑтриальный Банк', + 'МоÑковÑкий КоммерчеÑкий Банк', + 'МоÑковÑкий Кредитный Банк', + 'МоÑковÑкий Ðациональный ИнвеÑтиционный Банк', + 'МоÑковÑкий ÐефтехимичеÑкий Банк', + 'МоÑковÑкий ОблаÑтной Банк', + 'МоÑковÑко-ПарижÑкий Банк', + 'МоÑковÑкое Ипотечное ÐгентÑтво', + 'МоÑкоммерцбанк', + 'МоÑÑтройÑкономбанк (Ðœ Банк)', + 'МоÑтранÑбанк', + 'МоÑуралбанк', + 'МС Банк РуÑ', + 'МСП Банк', + 'МТИ-Банк', + 'МТС Банк', + 'Муниципальный Камчатпрофитбанк', + 'МурманÑкий Социальный КоммерчеÑкий Банк', + 'МФБанк', + 'Ð-Банк', + 'Ðальчик', + 'Ðаратбанк', + 'Ðародный Банк', + 'Ðародный Банк РеÑпублики Тыва', + 'Ðародный Доверительный Банк', + 'Ðародный Земельно-Промышленный Банк', + 'Ðародный ИнвеÑтиционный Банк', + 'ÐатикÑÐ¸Ñ Ð‘Ð°Ð½Ðº', + 'ÐацинвеÑтпромбанк', + 'ÐÐ°Ñ†Ð¸Ð¾Ð½Ð°Ð»ÑŒÐ½Ð°Ñ Ð¤Ð°ÐºÑ‚Ð¾Ñ€Ð¸Ð½Ð³Ð¾Ð²Ð°Ñ ÐšÐ¾Ð¼Ð¿Ð°Ð½Ð¸Ñ', + 'Ðациональный Банк "ТраÑÑ‚"', + 'Ðациональный Банк Взаимного Кредита', + 'Ðациональный Банк Сбережений', + 'Ðациональный Залоговый Банк', + 'Ðациональный Клиринговый Банк', + 'Ðациональный Клиринговый Центр', + 'Ðациональный Корпоративный Банк', + 'Ðациональный Резервный Банк', + 'Ðациональный Стандарт', + 'Ðаш Дом', + 'ÐБД-Банк', + 'ÐБК-Банк', + 'ÐеваÑтройинвеÑÑ‚', + 'ÐевÑкий Банк', + 'Ðейва', + 'Ðерюнгрибанк', + 'Ðефтепромбанк', + 'ÐефтÑной ÐльÑнÑ', + 'ÐижневолжÑкий КоммерчеÑкий Банк', + 'Ðико-Банк', + 'ÐК Банк', + 'ÐоваховКапиталБанк', + 'ÐовациÑ', + 'Ðовикомбанк', + 'Ðовобанк', + 'Ðовое ВремÑ', + 'Ðовокиб', + 'ÐовопокровÑкий', + 'Ðовый Век', + 'Ðовый Кредитный Союз', + 'Ðовый МоÑковÑкий Банк', + ); + + /** + * @example 'Ðовый МоÑковÑкий Банк' + */ + public static function bank() + { + return static::randomElement(static::$banks); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Person.php new file mode 100644 index 0000000..25ebd5a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/Person.php @@ -0,0 +1,157 @@ +middleNameMale(); + } elseif ($gender === static::GENDER_FEMALE) { + return $this->middleNameFemale(); + } + + return $this->middleName(static::randomElement(array( + static::GENDER_MALE, + static::GENDER_FEMALE, + ))); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/PhoneNumber.php new file mode 100644 index 0000000..c7477d7 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/ru_RU/PhoneNumber.php @@ -0,0 +1,14 @@ +generator->parse(static::randomElement(static::$lastNameFormat)); + } + + public static function lastNameMale() + { + return static::randomElement(static::$lastNameMale); + } + + public static function lastNameFemale() + { + return static::randomElement(static::$lastNameFemale); + } + + /** + * @example 'PhD' + */ + public static function suffix() + { + return static::randomElement(static::$suffix); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/sk_SK/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/sk_SK/PhoneNumber.php new file mode 100644 index 0000000..1baf7cc --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/sk_SK/PhoneNumber.php @@ -0,0 +1,15 @@ +format('ymd'); + + if ($gender && $gender == static::GENDER_MALE) { + $randomDigits = (string)static::numerify('##') . static::randomElement(array(1,3,5,7,9)); + } elseif ($gender && $gender == static::GENDER_FEMALE) { + $randomDigits = (string)static::numerify('##') . static::randomElement(array(0,2,4,6,8)); + } else { + $randomDigits = (string)static::numerify('###'); + } + + + $checksum = Luhn::computeCheckDigit($datePart . $randomDigits); + + return $datePart . '-' . $randomDigits . $checksum; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/sv_SE/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/sv_SE/PhoneNumber.php new file mode 100644 index 0000000..d15e5dd --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/sv_SE/PhoneNumber.php @@ -0,0 +1,37 @@ +format('a') === 'am' ? 'öö' : 'ös'; + } + + public static function dayOfWeek($max = 'now') + { + $map = array( + 'Sunday' => 'Pazar', + 'Monday' => 'Pazartesi', + 'Tuesday' => 'Salı', + 'Wednesday' => 'ÇarÅŸamba', + 'Thursday' => 'PerÅŸembe', + 'Friday' => 'Cuma', + 'Saturday' => 'Cumartesi', + ); + $week = static::dateTime($max)->format('l'); + return isset($map[$week]) ? $map[$week] : $week; + } + + public static function monthName($max = 'now') + { + $map = array( + 'January' => 'Ocak', + 'February' => 'Åžubat', + 'March' => 'Mart', + 'April' => 'Nisan', + 'May' => 'Mayıs', + 'June' => 'Haziran', + 'July' => 'Temmuz', + 'August' => 'AÄŸustos', + 'September' => 'Eylül', + 'October' => 'Ekim', + 'November' => 'Kasım', + 'December' => 'Aralık', + ); + $month = static::dateTime($max)->format('F'); + return isset($map[$month]) ? $map[$month] : $month; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/tr_TR/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/tr_TR/Internet.php new file mode 100644 index 0000000..ef907d4 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/tr_TR/Internet.php @@ -0,0 +1,9 @@ +generator->parse($format); + } + + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Color.php b/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Color.php new file mode 100644 index 0000000..197cc3b --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Color.php @@ -0,0 +1,23 @@ +generator->parse($format); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefix); + } + + public static function companyName() + { + return static::randomElement(static::$companyName); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Internet.php new file mode 100644 index 0000000..33214d6 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/Internet.php @@ -0,0 +1,9 @@ +middleNameMale(); + } elseif ($gender === static::GENDER_FEMALE) { + return $this->middleNameFemale(); + } + + return $this->middleName(static::randomElement(array( + static::GENDER_MALE, + static::GENDER_FEMALE, + ))); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/PhoneNumber.php new file mode 100644 index 0000000..24187f3 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/uk_UA/PhoneNumber.php @@ -0,0 +1,51 @@ +generator->parse($format)); + } + + public function hamletPrefix() + { + return static::randomElement(static::$hamletPrefix); + } + + public function wardName() + { + $format = static::randomElement(static::$wardNameFormats); + + return static::bothify($this->generator->parse($format)); + } + + public function wardPrefix() + { + return static::randomElement(static::$wardPrefix); + } + + public function districtName() + { + $format = static::randomElement(static::$districtNameFormats); + + return static::bothify($this->generator->parse($format)); + } + + public function districtPrefix() + { + return static::randomElement(static::$districtPrefix); + } + + /** + * @example 'Hà Ná»™i' + */ + public function city() + { + return static::randomElement(static::$city); + } + + /** + * @example 'Bắc Giang' + */ + public static function province() + { + return static::randomElement(static::$province); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/Color.php b/vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/Color.php new file mode 100644 index 0000000..4deaa2f --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/Color.php @@ -0,0 +1,36 @@ +generator->parse(static::randomElement(static::$middleNameFormat)); + } + + public static function middleNameMale() + { + return static::randomElement(static::$middleNameMale); + } + + public static function middleNameFemale() + { + return static::randomElement(static::$middleNameFemale); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/PhoneNumber.php new file mode 100644 index 0000000..5f9f60a --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/vi_VN/PhoneNumber.php @@ -0,0 +1,61 @@ + array( + '0[a] ### ####', + '(0[a]) ### ####', + '0[a]-###-####', + '(0[a])###-####', + '84-[a]-###-####', + '(84)([a])###-####', + '+84-[a]-###-####', + ), + '8' => array( + '0[a] #### ####', + '(0[a]) #### ####', + '0[a]-####-####', + '(0[a])####-####', + '84-[a]-####-####', + '(84)([a])####-####', + '+84-[a]-####-####', + ), + ); + + public function phoneNumber() + { + $areaCode = static::randomElement(static::$areaCodes); + $areaCodeLength = strlen($areaCode); + $digits = 7; + + if ($areaCodeLength < 2) { + $digits = 8; + } + + return static::numerify(str_replace('[a]', $areaCode, static::randomElement(static::$formats[$digits]))); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Address.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Address.php new file mode 100644 index 0000000..19d1c94 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Address.php @@ -0,0 +1,149 @@ +city() . static::area(); + } + + public static function postcode() + { + $prefix = str_pad(mt_rand(1, 85), 2, 0, STR_PAD_LEFT); + $suffix = '00'; + + return $prefix . mt_rand(10, 88) . $suffix; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Color.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Color.php new file mode 100644 index 0000000..12d29e3 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Color.php @@ -0,0 +1,66 @@ +format('a') === 'am' ? '上åˆ' : '下åˆ'; + } + + public static function dayOfWeek($max = 'now') + { + $map = array( + 'Sunday' => '星期日', + 'Monday' => '星期一', + 'Tuesday' => '星期二', + 'Wednesday' => '星期三', + 'Thursday' => '星期四', + 'Friday' => '星期五', + 'Saturday' => '星期六', + ); + $week = static::dateTime($max)->format('l'); + return isset($map[$week]) ? $map[$week] : $week; + } + + public static function monthName($max = 'now') + { + $map = array( + 'January' => '一月', + 'February' => '二月', + 'March' => '三月', + 'April' => '四月', + 'May' => '五月', + 'June' => '六月', + 'July' => '七月', + 'August' => '八月', + 'September' => 'ä¹æœˆ', + 'October' => 'å月', + 'November' => 'å一月', + 'December' => 'å二月', + ); + $month = static::dateTime($max)->format('F'); + return isset($map[$month]) ? $map[$month] : $month; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Internet.php new file mode 100644 index 0000000..ca10822 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_CN/Internet.php @@ -0,0 +1,24 @@ + array( + 'æ¿æ©‹å€', '三é‡å€', '中和å€', '永和å€', + '新莊å€', '新店å€', '樹林å€', '鶯歌å€', + '三峽å€', 'æ·¡æ°´å€', 'æ±æ­¢å€', '瑞芳å€', + '土城å€', '蘆洲å€', '五股å€', 'æ³°å±±å€', + 'æž—å£å€', 'æ·±å‘å€', '石碇å€', 'åªæž—å€', + '三èŠå€', '石門å€', '八里å€', '平溪å€', + '雙溪å€', '貢寮å€', '金山å€', 'è¬é‡Œå€', + 'çƒä¾†å€', + ), + '宜蘭縣' => array( + '宜蘭市', 'ç¾…æ±éŽ®', '蘇澳鎮', '頭城鎮', 'ç¤æºªé„‰', + '壯åœé„‰', '員山鄉', '冬山鄉', '五çµé„‰', '三星鄉', + '大åŒé„‰', 'å—澳鄉', + ), + '桃園市' => array( + '桃園å€', '中壢å€', '大溪å€', '楊梅å€', '蘆竹å€', + '大園å€', '龜山å€', 'å…«å¾·å€', 'é¾æ½­å€', '平鎮å€', + '新屋å€', '觀音å€', '復興å€', + ), + '新竹縣' => array( + '竹北市', '竹æ±éŽ®', '新埔鎮', '關西鎮', 'æ¹–å£é„‰', + 'æ–°è±é„‰', '芎林鄉', '橫山鄉', '北埔鄉', '寶山鄉', + '峨眉鄉', '尖石鄉', '五峰鄉', + ), + '苗栗縣' => array( + '苗栗市', '苑裡鎮', '通霄鎮', '竹å—鎮', '頭份鎮', + '後é¾éŽ®', 'å“蘭鎮', '大湖鄉', '公館鄉', '銅鑼鄉', + 'å—庄鄉', '頭屋鄉', '三義鄉', '西湖鄉', '造橋鄉', + '三ç£é„‰', 'ç…潭鄉', '泰安鄉', + ), + '臺中市' => array( + 'è±åŽŸå€', 'æ±å‹¢å€', '大甲å€', '清水å€', '沙鹿å€', + '梧棲å€', 'åŽé‡Œå€', '神岡å€', 'æ½­å­å€', '大雅å€', + '新社å€', '石岡å€', '外埔å€', '大安å€', 'çƒæ—¥å€', + '大肚å€', 'é¾äº•å€', '霧峰å€', '太平å€', '大里å€', + '和平å€', '中å€', 'æ±å€', 'å—å€', '西å€', '北å€', + '西屯å€', 'å—屯å€', '北屯å€', + ), + '彰化縣' => array( + '彰化市', '鹿港鎮', '和美鎮', '線西鄉', '伸港鄉', + 'ç¦èˆˆé„‰', '秀水鄉', '花壇鄉', '芬園鄉', '員林鎮', + '溪湖鎮', '田中鎮', '大æ‘鄉', '埔鹽鄉', '埔心鄉', + 'æ°¸é–鄉', '社頭鄉', '二水鄉', '北斗鎮', '二林鎮', + '田尾鄉', '埤頭鄉', '芳苑鄉', '大城鄉', '竹塘鄉', + '溪州鄉', + ), + 'å—投縣' => array( + 'å—投市', '埔里鎮', 'è‰å±¯éŽ®', '竹山鎮', '集集鎮', + 'å間鄉', '鹿谷鄉', '中寮鄉', '魚池鄉', '國姓鄉', + '水里鄉', '信義鄉', 'ä»æ„›é„‰', + ), + '雲林縣' => array( + '斗六市', 'æ–—å—鎮', '虎尾鎮', '西螺鎮', '土庫鎮', + '北港鎮', 'å¤å‘鄉', '大埤鄉', '莿æ¡é„‰', '林內鄉', + '二崙鄉', '崙背鄉', '麥寮鄉', 'æ±å‹¢é„‰', '褒忠鄉', + '臺西鄉', '元長鄉', '四湖鄉', 'å£æ¹–鄉', '水林鄉', + ), + '嘉義縣' => array( + '太ä¿å¸‚', '朴å­å¸‚', '布袋鎮', '大林鎮', '民雄鄉', + '溪å£é„‰', '新港鄉', '六腳鄉', 'æ±çŸ³é„‰', '義竹鄉', + '鹿è‰é„‰', '水上鄉', '中埔鄉', '竹崎鄉', '梅山鄉', + '番路鄉', '大埔鄉', '阿里山鄉', + ), + '臺å—市' => array( + '新營å€', '鹽水å€', '白河å€', '柳營å€', '後å£å€', + 'æ±å±±å€', '麻豆å€', '下營å€', '六甲å€', '官田å€', + '大內å€', '佳里å€', '學甲å€', '西港å€', '七股å€', + 'å°‡è»å€', '北門å€', '新化å€', '善化å€', '新市å€', + '安定å€', '山上å€', '玉井å€', '楠西å€', 'å—化å€', + '左鎮å€', 'ä»å¾·å€', 'æ­¸ä»å€', '關廟å€', 'é¾å´Žå€', + '永康å€', 'æ±å€', 'å—å€', '西å€', '北å€', '中å€', + '安å—å€', '安平å€', + ), + '高雄市' => array( + '鳳山å€', '林園å€', '大寮å€', '大樹å€', '大社å€', + 'ä»æ­¦å€', 'é³¥æ¾å€', '岡山å€', 'æ©‹é ­å€', '燕巢å€', + '田寮å€', '阿蓮å€', '路竹å€', 'æ¹–å…§å€', '茄è£å€', + '永安å€', '彌陀å€', '梓官å€', 'æ——å±±å€', '美濃å€', + '六龜å€', '甲仙å€', 'æ‰æž—å€', '內門å€', '茂林å€', + '桃æºå€', '三民å€', '鹽埕å€', '鼓山å€', '左營å€', + '楠梓å€', '三民å€', '新興å€', 'å‰é‡‘å€', 'è‹“é›…å€', + 'å‰éŽ®å€', 'æ——æ´¥å€', 'å°æ¸¯å€', + ), + 'å±æ±ç¸£' => array( + 'å±æ±å¸‚', '潮州鎮', 'æ±æ¸¯éŽ®', 'æ†æ˜¥éŽ®', 'è¬ä¸¹é„‰', + '長治鄉', '麟洛鄉', 'ä¹å¦‚鄉', '里港鄉', '鹽埔鄉', + '高樹鄉', 'è¬å·’鄉', '內埔鄉', '竹田鄉', '新埤鄉', + '枋寮鄉', '新園鄉', 'å´é ‚鄉', '林邊鄉', 'å—州鄉', + '佳冬鄉', 'ç‰çƒé„‰', '車城鄉', '滿州鄉', '枋山鄉', + '三地門鄉', '霧臺鄉', '瑪家鄉', '泰武鄉', '來義鄉', + '春日鄉', 'ç…å­é„‰', '牡丹鄉', + ), + '臺æ±ç¸£' => array( + '臺æ±å¸‚', 'æˆåŠŸéŽ®', '關山鎮', 'å‘å—鄉', '鹿野鄉', + '池上鄉', 'æ±æ²³é„‰', '長濱鄉', '太麻里鄉', '大武鄉', + '綠島鄉', '海端鄉', '延平鄉', '金峰鄉', 'é”ä»é„‰', + '蘭嶼鄉', + ), + '花蓮縣' => array( + '花蓮市', '鳳林鎮', '玉里鎮', '新城鄉', 'å‰å®‰é„‰', + '壽è±é„‰', '光復鄉', 'è±æ¿±é„‰', '瑞穗鄉', '富里鄉', + '秀林鄉', 'è¬æ¦®é„‰', 'å“溪鄉', + ), + '澎湖縣' => array( + '馬公市', '湖西鄉', '白沙鄉', '西嶼鄉', '望安鄉', + '七美鄉', + ), + '基隆市' => array( + '中正å€', '七堵å€', 'æš–æš–å€', 'ä»æ„›å€', '中山å€', + '安樂å€', '信義å€', + ), + '新竹市' => array( + 'æ±å€', '北å€', '香山å€', + ), + '嘉義市' => array( + 'æ±å€', '西å€', + ), + '臺北市' => array( + 'æ¾å±±å€', '信義å€', '大安å€', '中山å€', '中正å€', + '大åŒå€', 'è¬è¯å€', '文山å€', 'å—港å€', '內湖å€', + '士林å€', '北投å€', + ), + '連江縣' => array( + 'å—竿鄉', '北竿鄉', '莒光鄉', 'æ±å¼•é„‰', + ), + '金門縣' => array( + '金城鎮', '金沙鎮', '金湖鎮', '金寧鄉', '烈嶼鄉', 'çƒåµé„‰', + ), + ); + + /** + * @link http://terms.naer.edu.tw/download/287/ + */ + protected static $country = array( + 'ä¸ä¸¹', '中éž', '丹麥', '伊朗', '冰島', '剛果', + '加彭', '北韓', 'å—éž', 'å¡é”', 'å°å°¼', 'å°åº¦', + 'å¤å·´', '哥德', '埃åŠ', '多哥', '寮國', '尼日', + '巴曼', 'å·´æž—', 'å·´ç´', '巴西', '希臘', '帛ç‰', + '德國', '挪å¨', 'æ·å…‹', '教廷', 'æ–æ¿Ÿ', '日本', + '智利', 'æ±åŠ ', '查德', '汶èŠ', '法國', '波蘭', + '波赫', '泰國', '海地', 'ç‘žå…¸', '瑞士', '祕魯', + '秘魯', 'ç´„æ—¦', 'ç´åŸƒ', '緬甸', '美國', 'è–å°¼', + 'è–æ™®', '肯亞', '芬蘭', '英國', 'è·è˜­', '葉門', + '蘇丹', '諾魯', 'è²å—', '越å—', '迦彭', + '迦ç´', '阿曼', '阿è¯', '韓國', '馬利', + '以色列', '以色利', '伊拉克', 'ä¿„ç¾…æ–¯', + '利比亞', '加拿大', '匈牙利', 'å—極洲', + 'å—蘇丹', '厄瓜多', 'å‰å¸ƒåœ°', 'å瓦魯', + '哈撒克', '哈薩克', '喀麥隆', '喬治亞', + '土庫曼', '土耳其', 'å¡”å‰å…‹', '塞席爾', + '墨西哥', '大西洋', '奧地利', '孟加拉', + '安哥拉', '安地å¡', '安é“爾', '尚比亞', + '尼伯爾', '尼泊爾', '巴哈馬', '巴拉圭', + '巴拿馬', 'å·´è²å¤š', '幾內亞', '愛爾蘭', + '所在國', '摩洛哥', 'æ‘©ç´å“¥', 'æ•åˆ©äºž', + '敘利亞', '新加å¡', 'æ±å¸æ±¶', '柬埔寨', + '比利時', '波扎那', '波札那', 'çƒå…‹è˜­', + 'çƒå¹²é”', 'çƒæ‹‰åœ­', '牙買加', 'ç…å­å±±', + '甘比亞', '盧安é”', '盧森堡', '科å¨ç‰¹', + '科索夫', '科索沃', '立陶宛', 'ç´è¥¿è˜­', + '維德角', '義大利', 'è–文森', '艾塞亞', + 'è²å¾‹è³“', 'è¬é‚£æœ', 'è‘¡è„牙', '蒲隆地', + '蓋亞ç´', '薩摩亞', '蘇利å—', '西ç­ç‰™', + 'è²é‡Œæ–¯', '賴索托', '辛巴å¨', '阿富汗', + '阿根廷', '馬其頓', '馬拉å¨', '馬爾他', + '黎巴嫩', '亞塞拜然', '亞美尼亞', 'ä¿åŠ åˆ©äºž', + 'å—斯拉夫', '厄利垂亞', 'å²ç“¦æ¿Ÿè˜­', 'å‰çˆ¾å‰æ–¯', + 'å‰é‡Œå·´æ–¯', '哥倫比亞', 'å¦å°šå°¼äºž', '塞內加爾', + '塞内加爾', '塞爾維亞', '多明尼加', '多米尼克', + '奈åŠåˆ©äºž', '委內瑞拉', 'å®éƒ½æ‹‰æ–¯', '尼加拉瓜', + '巴基斯å¦', '庫克群島', '愛沙尼亞', '拉脫維亞', + '摩爾多瓦', '摩里西斯', '斯洛ä¼å…‹', '斯里蘭å¡', + '格瑞那é”', '模里西斯', '波多黎å„', '澳大利亞', + 'çƒèŒ²åˆ¥å…‹', '玻利維亞', '瓜地馬拉', '白俄羅斯', + 'çªå°¼è¥¿äºž', 'ç´ç±³æ¯”亞', '索馬利亞', '索馬尼亞', + '羅馬尼亞', 'è–露西亞', 'è–馬利諾', '莫三比克', + '莫三鼻克', '葛摩è¯ç›Ÿ', '薩爾瓦多', '衣索比亞', + '西薩摩亞', '象牙海岸', '賴比瑞亞', '賽普勒斯', + '馬來西亞', '馬爾地夫', '克羅埃西亞', + '列支敦斯登', '哥斯大黎加', '布å‰ç´æ³•ç´¢', + '布å‰é‚£æ³•ç´¢', '幾內亞比索', '幾內亞比紹', + '斯洛維尼亞', '索羅門群島', '茅利塔尼亞', + '蒙特內哥羅', '赤é“幾內亞', '阿爾åŠåˆ©äºž', + '阿爾åŠå°¼äºž', '阿爾巴尼亞', '馬紹爾群島', + '馬é”加斯加', '密克羅尼西亞', 'æ²™çƒåœ°é˜¿æ‹‰ä¼¯', + 'åƒé‡Œé”åŠæ‰˜å·´å“¥', + ); + + protected static $postcode = array('###-##', '###'); + + public function street() + { + return static::randomElement(static::$street); + } + + public static function randomChineseNumber() + { + $digits = array( + '', '一', '二', '三', 'å››', '五', 'å…­', '七', 'å…«', 'ä¹', + ); + return $digits[static::randomDigitNotNull()]; + } + + public static function randomNumber2() + { + return static::randomNumber(2) + 1; + } + + public static function randomNumber3() + { + return static::randomNumber(3) + 1; + } + + public static function localLatitude() + { + return number_format(mt_rand(22000000, 25000000)/1000000, 6); + } + + public static function localLongitude() + { + return number_format(mt_rand(120000000, 122000000)/1000000, 6); + } + + public function city() + { + $county = static::randomElement(array_keys(static::$city)); + $city = static::randomElement(static::$city[$county]); + return $county.$city; + } + + public function state() + { + return '臺ç£çœ'; + } + + public static function stateAbbr() + { + return '臺'; + } + + public static function cityPrefix() + { + return ''; + } + + public static function citySuffix() + { + return ''; + } + + public static function secondaryAddress() + { + return (static::randomNumber(2)+1).static::randomElement(static::$secondaryAddressSuffix); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Color.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Color.php new file mode 100644 index 0000000..7be5953 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Color.php @@ -0,0 +1,66 @@ +generator->parse($format); + } + + public static function companyModifier() + { + return static::randomElement(static::$companyModifier); + } + + public static function companyPrefix() + { + return static::randomElement(static::$companyPrefix); + } + + public function catchPhrase() + { + return static::randomElement(static::$catchPhrase); + } + + public function bs() + { + $result = ''; + foreach (static::$bsWords as &$word) { + $result .= static::randomElement($word); + } + return $result; + } + + /** + * return standard VAT / Tax ID / Uniform Serial Number + * + * @example 28263822 + * + * @return int + */ + public function VAT() + { + return static::randomNumber(8, true); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/DateTime.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/DateTime.php new file mode 100644 index 0000000..6df5e92 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/DateTime.php @@ -0,0 +1,46 @@ +format('a') === 'am' ? '上åˆ' : '下åˆ'; + } + + public static function dayOfWeek($max = 'now') + { + $map = array( + 'Sunday' => '星期日', + 'Monday' => '星期一', + 'Tuesday' => '星期二', + 'Wednesday' => '星期三', + 'Thursday' => '星期四', + 'Friday' => '星期五', + 'Saturday' => '星期六', + ); + $week = static::dateTime($max)->format('l'); + return isset($map[$week]) ? $map[$week] : $week; + } + + public static function monthName($max = 'now') + { + $map = array( + 'January' => '一月', + 'February' => '二月', + 'March' => '三月', + 'April' => '四月', + 'May' => '五月', + 'June' => '六月', + 'July' => '七月', + 'August' => '八月', + 'September' => 'ä¹æœˆ', + 'October' => 'å月', + 'November' => 'å一月', + 'December' => 'å二月', + ); + $month = static::dateTime($max)->format('F'); + return isset($map[$month]) ? $map[$month] : $month; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Internet.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Internet.php new file mode 100644 index 0000000..4035ea8 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Internet.php @@ -0,0 +1,16 @@ +userName(); + } + + public function domainWord() + { + return \Faker\Factory::create('en_US')->domainWord(); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Payment.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Payment.php new file mode 100644 index 0000000..6b1a582 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Payment.php @@ -0,0 +1,11 @@ +creditCardDetails($valid); + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Person.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Person.php new file mode 100644 index 0000000..1ae7202 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/Person.php @@ -0,0 +1,201 @@ + 10, + 'B' => 11, + 'C' => 12, + 'D' => 13, + 'E' => 14, + 'F' => 15, + 'G' => 16, + 'H' => 17, + 'I' => 34, + 'J' => 18, + 'K' => 19, + 'M' => 21, + 'N' => 22, + 'O' => 35, + 'p' => 23, + 'Q' => 24, + 'T' => 27, + 'U' => 28, + 'V' => 29, + 'W' => 32, + 'X' => 30, + 'Z' => 33 + ); + + /** + * @see https://zh.wikipedia.org/wiki/%E4%B8%AD%E8%8F%AF%E6%B0%91%E5%9C%8B%E5%9C%8B%E6%B0%91%E8%BA%AB%E5%88%86%E8%AD%89 + */ + public static $idDigitValidator = array(1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1); + + protected static $maleNameFormats = array( + '{{lastName}}{{firstNameMale}}', + ); + + protected static $femaleNameFormats = array( + '{{lastName}}{{firstNameFemale}}', + ); + + protected static $titleMale = array('先生', 'åšå£«', '教授'); + protected static $titleFemale = array('å°å§', '太太', 'åšå£«', '教授'); + + /** + * @link http://zh.wikipedia.org/wiki/%E7%99%BE%E5%AE%B6%E5%A7%93 + */ + protected static $lastName = array( + '趙', '錢', 'å­«', 'æŽ', '周', 'å³', 'é„­', '王', '馮', + '陳', '褚', 'è¡›', '蔣', '沈', '韓', '楊', '朱', '秦', + 'å°¤', '許', '何', 'å‘‚', 'æ–½', 'å¼µ', 'å­”', '曹', 'åš´', + 'è¯', '金', 'é­', '陶', '姜', '戚', 'è¬', 'é„’', 'å–»', + 'æŸ', 'æ°´', '竇', 'ç« ', '雲', '蘇', '潘', 'è‘›', + '奚', '范', 'å½­', '郎', 'é­¯', '韋', '昌', '馬', + 'è‹—', 'é³³', '花', 'æ–¹', 'ä¿ž', 'ä»»', 'è¢', '柳', + 'é…†', '鮑', 'å²', 'å”', 'è²»', '廉', '岑', 'è–›', + 'é›·', 'è³€', '倪', '湯', '滕', 'æ®·', 'ç¾…', 'ç•¢', + 'éƒ', 'é„”', '安', '常', '樂', '于', '時', 'å‚…', + 'çš®', 'åž', '齊', '康', 'ä¼', 'ä½™', 'å…ƒ', 'åœ', + '顧', 'å­Ÿ', 'å¹³', '黃', 'å’Œ', '穆', 'è•­', 'å°¹', + '姚', '邵', 'æ¹›', '汪', 'ç¥', '毛', '禹', 'ç‹„', + 'ç±³', 'è²', '明', '臧', '計', 'ä¼', 'æˆ', '戴', + '談', '宋', '茅', 'é¾', '熊', 'ç´€', '舒', '屈', + 'é …', 'ç¥', 'è‘£', 'æ¢', 'æœ', '阮', 'è—', 'é–”', + '席', 'å­£', '麻', 'å¼·', '賈', 'è·¯', 'å©', 'å±', + '江', 'ç«¥', 'é¡', '郭', '梅', 'ç››', 'æž—', 'åˆ', + 'é¾', 'å¾', '丘', '駱', '高', 'å¤', '蔡', 'ç”°', + '樊', '胡', '凌', 'éœ', '虞', 'è¬', '支', '柯', + 'æ˜', '管', '盧', '莫', '經', '房', '裘', '繆', + 'å¹²', '解', '應', 'å®—', 'ä¸', '宣', 'è³', '鄧', + 'éƒ', 'å–®', 'æ­', 'æ´ª', '包', '諸', 'å·¦', '石', + 'å´”', 'å‰', '鈕', 'é¾”', '程', '嵇', 'é‚¢', '滑', + '裴', '陸', '榮', 'ç¿', 'è€', '羊', 'æ–¼', '惠', + '甄', '麴', '家', 'å°', '芮', '羿', '儲', 'é³', + 'æ±²', 'é‚´', '糜', 'æ¾', '井', '段', '富', 'å·«', + 'çƒ', '焦', 'å·´', '弓', '牧', 'éš—', 'å±±', 'è°·', + '車', '侯', '宓', '蓬', 'å…¨', '郗', 'ç­', 'ä»°', + '秋', '仲', '伊', 'å®®', '甯', '仇', '欒', 'æš´', + '甘', '鈄', '厲', '戎', '祖', 'æ­¦', '符', '劉', + '景', '詹', 'æŸ', 'é¾', '葉', '幸', 'å¸', '韶', + '郜', '黎', 'è–Š', 'è–„', 'å°', '宿', '白', '懷', + 'è’²', 'é‚°', '從', 'é„‚', 'ç´¢', 'å’¸', 'ç±', 'è³´', + 'å“', 'è—º', 'å± ', 'è’™', 'æ± ', 'å–¬', 'é™°', '鬱', + '胥', '能', 'è’¼', 'é›™', 'èž', '莘', '黨', 'ç¿Ÿ', + 'è­š', 'è²¢', 'å‹ž', '逄', '姬', '申', '扶', 'å µ', + '冉', 'å®°', 'é…ˆ', 'é›', '郤', 'ç’©', 'æ¡‘', 'æ¡‚', + 'æ¿®', '牛', '壽', '通', 'é‚Š', '扈', '燕', '冀', + '郟', '浦', 'å°š', 'è¾²', '溫', '別', '莊', 'æ™', + '柴', 'çž¿', 'é–»', 'å……', 'æ…•', '連', '茹', 'ç¿’', + '宦', '艾', 'é­š', '容', 'å‘', 'å¤', '易', 'æ…Ž', + '戈', 'å»–', '庾', '終', '暨', 'å±…', 'è¡¡', 'æ­¥', + '都', '耿', '滿', '弘', '匡', '國', 'æ–‡', '寇', + '廣', '祿', 'é—•', 'æ±', 'æ­', '殳', '沃', '利', + '蔚', '越', '夔', '隆', '師', 'éž', '厙', 'è¶', + 'æ™', '勾', 'æ•–', 'èž', '冷', '訾', 'è¾›', 'é—ž', + 'é‚£', 'ç°¡', '饒', '空', '曾', '毋', 'æ²™', '乜', + '養', 'éž ', 'é ˆ', 'è±', 'å·¢', 'é—œ', 'è’¯', '相', + '查', 'åŽ', 'èŠ', 'ç´…', '游', '竺', '權', '逯', + 'è“‹', '益', 'æ¡“', 'å…¬', '万俟', 'å¸é¦¬', '上官', + 'æ­é™½', 'å¤ä¾¯', '諸葛', 'èžäºº', 'æ±æ–¹', '赫連', + '皇甫', 'å°‰é²', '公羊', '澹臺', '公冶', '宗政', + '濮陽', '淳于', '單于', '太å”', '申屠', '公孫', + '仲孫', 'è»’è½…', '令ç‹', 'é¾é›¢', '宇文', 'é•·å­«', + '慕容', '鮮于', '閭丘', 'å¸å¾’', 'å¸ç©º', '亓官', + 'å¸å¯‡', '仉', 'ç£', 'å­è»Š', 'é¡“å­«', '端木', '巫馬', + '公西', '漆雕', '樂正', '壤駟', '公良', 'æ‹“è·‹', + '夾谷', '宰父', 'ç©€æ¢', '晉', '楚', 'é–†', '法', + 'æ±', 'é„¢', '涂', '欽', '段干', '百里', 'æ±éƒ­', + 'å—é–€', '呼延', 'æ­¸', 'æµ·', '羊舌', '微生', 'å²³', + '帥', 'ç·±', '亢', 'æ³', '後', '有', 'ç´', 'æ¢ä¸˜', + '左丘', 'æ±é–€', '西門', '商', '牟', '佘', 'ä½´', + '伯', '賞', 'å—å®®', '墨', '哈', 'è­™', '笪', 'å¹´', + 'æ„›', '陽', '佟', '第五', '言', 'ç¦', + ); + + /** + * @link http://technology.chtsai.org/namefreq/ + */ + protected static $characterMale = array( + 'ä½³', 'ä¿Š', 'ä¿¡', 'å‰', 'å‚‘', '冠', 'å›', '哲', + '嘉', 'å¨', '宇', '安', 'å®', 'å®—', '宜', '家', + '庭', 'å»·', '建', 'å½¥', '心', 'å¿—', 'æ€', '承', + 'æ–‡', 'æŸ', '樺', 'ç‘‹', 'ç©Ž', '美', 'ç¿°', 'è¯', + 'è©©', '豪', 'è³¢', 'è»’', '銘', '霖', + ); + + protected static $characterFemale = array( + '伶', '佩', 'ä½³', 'ä¾', 'å„€', '冠', 'å›', '嘉', + '如', '娟', '婉', 'å©·', '安', '宜', '家', '庭', + '心', 'æ€', '怡', '惠', 'æ…§', 'æ–‡', '欣', '涵', + 'æ·‘', '玲', 'çŠ', 'çª', 'ç¬', 'ç‘œ', 'ç©Ž', 'ç­‘', + 'ç­±', '美', '芬', '芳', 'è¯', 'è', 'è±', '蓉', + 'è©©', '貞', 'éƒ', '鈺', 'é›…', '雯', 'éœ', '馨', + ); + + public static function randomName($pool, $n) + { + $name = ''; + for ($i = 0; $i < $n; ++$i) { + $name .= static::randomElement($pool); + } + return $name; + } + + public static function firstNameMale() + { + return static::randomName(static::$characterMale, mt_rand(1, 2)); + } + + public static function firstNameFemale() + { + return static::randomName(static::$characterFemale, mt_rand(1, 2)); + } + + public static function suffix() + { + return ''; + } + + /** + * @param string $gender Person::GENDER_MALE || Person::GENDER_FEMALE + * + * @see https://en.wikipedia.org/wiki/National_Identification_Card_(Republic_of_China) + * + * @return string Length 10 alphanumeric characters, begins with 1 latin character (birthplace), + * 1 number (gender) and then 8 numbers (the last one is check digit). + */ + public function personalIdentityNumber($gender = null) + { + $birthPlace = self::randomKey(self::$idBirthplaceCode); + $birthPlaceCode = self::$idBirthplaceCode[$birthPlace]; + + $gender = ($gender != null) ? $gender : self::randomElement(array(self::GENDER_FEMALE, self::GENDER_MALE)); + $genderCode = ($gender === self::GENDER_MALE) ? 1 : 2; + + $randomNumberCode = self::randomNumber(7, true); + + $codes = str_split($birthPlaceCode . $genderCode . $randomNumberCode); + $total = 0; + + foreach ($codes as $key => $code) { + $total += $code * self::$idDigitValidator[$key]; + } + + $checkSumDigit = 10 - ($total % 10); + + if ($checkSumDigit == 10) { + $checkSumDigit = 0; + } + + $id = $birthPlace . $genderCode . $randomNumberCode . $checkSumDigit; + + return $id; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/PhoneNumber.php b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/PhoneNumber.php new file mode 100644 index 0000000..7c31a97 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/Provider/zh_TW/PhoneNumber.php @@ -0,0 +1,19 @@ + 251: + $temp .= $chars[++$i]; + // no break + case $ord > 247: + $temp .= $chars[++$i]; + // no break + case $ord > 239: + $temp .= $chars[++$i]; + // no break + case $ord > 223: + $temp .= $chars[++$i]; + // no break + case $ord > 191: + $temp .= $chars[++$i]; + // no break + } + + $encoding[] = $temp; + } + + return $encoding; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/UniqueGenerator.php b/vendor/fzaninotto/faker/src/Faker/UniqueGenerator.php new file mode 100644 index 0000000..431f765 --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/UniqueGenerator.php @@ -0,0 +1,58 @@ +unique() + */ +class UniqueGenerator +{ + protected $generator; + protected $maxRetries; + protected $uniques = array(); + + /** + * @param Generator $generator + * @param integer $maxRetries + */ + public function __construct(Generator $generator, $maxRetries = 10000) + { + $this->generator = $generator; + $this->maxRetries = $maxRetries; + } + + /** + * Catch and proxy all generator calls but return only unique values + * @param string $attribute + * @return mixed + */ + public function __get($attribute) + { + return $this->__call($attribute, array()); + } + + /** + * Catch and proxy all generator calls with arguments but return only unique values + * @param string $name + * @param array $arguments + * @return mixed + */ + public function __call($name, $arguments) + { + if (!isset($this->uniques[$name])) { + $this->uniques[$name] = array(); + } + $i = 0; + do { + $res = call_user_func_array(array($this->generator, $name), $arguments); + $i++; + if ($i > $this->maxRetries) { + throw new \OverflowException(sprintf('Maximum retries of %d reached without finding a unique value', $this->maxRetries)); + } + } while (array_key_exists(serialize($res), $this->uniques[$name])); + $this->uniques[$name][serialize($res)]= null; + + return $res; + } +} diff --git a/vendor/fzaninotto/faker/src/Faker/ValidGenerator.php b/vendor/fzaninotto/faker/src/Faker/ValidGenerator.php new file mode 100644 index 0000000..1352dfc --- /dev/null +++ b/vendor/fzaninotto/faker/src/Faker/ValidGenerator.php @@ -0,0 +1,65 @@ +valid() + */ +class ValidGenerator +{ + protected $generator; + protected $validator; + protected $maxRetries; + + /** + * @param Generator $generator + * @param callable|null $validator + * @param integer $maxRetries + */ + public function __construct(Generator $generator, $validator = null, $maxRetries = 10000) + { + if (is_null($validator)) { + $validator = function () { + return true; + }; + } elseif (!is_callable($validator)) { + throw new \InvalidArgumentException('valid() only accepts callables as first argument'); + } + $this->generator = $generator; + $this->validator = $validator; + $this->maxRetries = $maxRetries; + } + + /** + * Catch and proxy all generator calls but return only valid values + * @param string $attribute + * + * @return mixed + */ + public function __get($attribute) + { + return $this->__call($attribute, array()); + } + + /** + * Catch and proxy all generator calls with arguments but return only valid values + * @param string $name + * @param array $arguments + * + * @return mixed + */ + public function __call($name, $arguments) + { + $i = 0; + do { + $res = call_user_func_array(array($this->generator, $name), $arguments); + $i++; + if ($i > $this->maxRetries) { + throw new \OverflowException(sprintf('Maximum retries of %d reached without finding a valid value', $this->maxRetries)); + } + } while (!call_user_func($this->validator, $res)); + + return $res; + } +} diff --git a/vendor/fzaninotto/faker/src/autoload.php b/vendor/fzaninotto/faker/src/autoload.php new file mode 100644 index 0000000..f55914d --- /dev/null +++ b/vendor/fzaninotto/faker/src/autoload.php @@ -0,0 +1,26 @@ +assertEquals($checksum, Iban::checksum($iban), $iban); + } + + public function validatorProvider() + { + return array( + array('AL47212110090000000235698741', true), + array('AD1200012030200359100100', true), + array('AT611904300234573201', true), + array('AZ21NABZ00000000137010001944', true), + array('BH67BMAG00001299123456', true), + array('BE68539007547034', true), + array('BA391290079401028494', true), + array('BR7724891749412660603618210F3', true), + array('BG80BNBG96611020345678', true), + array('CR0515202001026284066', true), + array('HR1210010051863000160', true), + array('CY17002001280000001200527600', true), + array('CZ6508000000192000145399', true), + array('DK5000400440116243', true), + array('DO28BAGR00000001212453611324', true), + array('EE382200221020145685', true), + array('FO6264600001631634', true), + array('FI2112345600000785', true), + array('FR1420041010050500013M02606', true), + array('GE29NB0000000101904917', true), + array('DE89370400440532013000', true), + array('GI75NWBK000000007099453', true), + array('GR1601101250000000012300695', true), + array('GL8964710001000206', true), + array('GT82TRAJ01020000001210029690', true), + array('HU42117730161111101800000000', true), + array('IS140159260076545510730339', true), + array('IE29AIBK93115212345678', true), + array('IL620108000000099999999', true), + array('IT60X0542811101000000123456', true), + array('KZ86125KZT5004100100', true), + array('KW81CBKU0000000000001234560101', true), + array('LV80BANK0000435195001', true), + array('LB62099900000001001901229114', true), + array('LI21088100002324013AA', true), + array('LT121000011101001000', true), + array('LU280019400644750000', true), + array('MK07250120000058984', true), + array('MT84MALT011000012345MTLCAST001S', true), + array('MR1300020001010000123456753', true), + array('MU17BOMM0101101030300200000MUR', true), + array('MD24AG000225100013104168', true), + array('MC5811222000010123456789030', true), + array('ME25505000012345678951', true), + array('NL91ABNA0417164300', true), + array('NO9386011117947', true), + array('PK36SCBL0000001123456702', true), + array('PL61109010140000071219812874', true), + array('PS92PALS000000000400123456702', true), + array('PT50000201231234567890154', true), + array('QA58DOHB00001234567890ABCDEFG', true), + array('RO49AAAA1B31007593840000', true), + array('SM86U0322509800000000270100', true), + array('SA0380000000608010167519', true), + array('RS35260005601001611379', true), + array('SK3112000000198742637541', true), + array('SI56263300012039086', true), + array('ES9121000418450200051332', true), + array('SE4550000000058398257466', true), + array('CH9300762011623852957', true), + array('TN5910006035183598478831', true), + array('TR330006100519786457841326', true), + array('AE070331234567890123456', true), + array('GB29NWBK60161331926819', true), + array('VG96VPVG0000012345678901', true), + array('YY24KIHB12476423125915947930915268', true), + array('ZZ25VLQT382332233206588011313776421', true), + + + array('AL4721211009000000023569874', false), + array('AD120001203020035910010', false), + array('AT61190430023457320', false), + array('AZ21NABZ0000000013701000194', false), + array('BH67BMAG0000129912345', false), + array('BE6853900754703', false), + array('BA39129007940102849', false), + array('BR7724891749412660603618210F', false), + array('BG80BNBG9661102034567', false), + array('CR051520200102628406', false), + array('HR121001005186300016', false), + array('CY1700200128000000120052760', false), + array('CZ650800000019200014539', false), + array('DK500040044011624', false), + array('DO28BAGR0000000121245361132', false), + array('EE38220022102014568', false), + array('FO626460000163163', false), + array('FI2112345600000780', false), + array('FR1420041010050500013M0260', false), + array('GE29NB000000010190491', false), + array('DE8937040044053201300', false), + array('GI75NWBK00000000709945', false), + array('GR160110125000000001230069', false), + array('GL896471000100020', false), + array('GT82TRAJ0102000000121002969', false), + array('HU4211773016111110180000000', false), + array('IS14015926007654551073033', false), + array('IE29AIBK9311521234567', false), + array('IL62010800000009999999', false), + array('IT60X054281110100000012345', false), + array('KZ86125KZT500410010', false), + array('KW81CBKU000000000000123456010', false), + array('LV80BANK000043519500', false), + array('LB6209990000000100190122911', false), + array('LI21088100002324013A', false), + array('LT12100001110100100', false), + array('LU28001940064475000', false), + array('MK0725012000005898', false), + array('MT84MALT011000012345MTLCAST001', false), + array('MR130002000101000012345675', false), + array('MU17BOMM0101101030300200000MU', false), + array('MD24AG00022510001310416', false), + array('MC58112220000101234567890', false), + array('ME2550500001234567895', false), + array('NL91ABNA041716430', false), + array('NO938601111794', false), + array('PK36SCBL000000112345670', false), + array('PL6110901014000007121981287', false), + array('PS92PALS00000000040012345670', false), + array('PT5000020123123456789015', false), + array('QA58DOHB00001234567890ABCDEF', false), + array('RO49AAAA1B3100759384000', false), + array('SM86U032250980000000027010', false), + array('SA038000000060801016751', false), + array('RS3526000560100161137', false), + array('SK311200000019874263754', false), + array('SI5626330001203908', false), + array('ES912100041845020005133', false), + array('SE455000000005839825746', false), + array('CH930076201162385295', false), + array('TN591000603518359847883', false), + array('TR33000610051978645784132', false), + array('AE07033123456789012345', false), + array('GB29NWBK6016133192681', false), + array('VG96VPVG000001234567890', false), + array('YY24KIHB1247642312591594793091526', false), + array('ZZ25VLQT38233223320658801131377642', false), + ); + } + + /** + * @dataProvider validatorProvider + */ + public function testIsValid($iban, $isValid) + { + $this->assertEquals($isValid, Iban::isValid($iban), $iban); + } + + public function alphaToNumberProvider() + { + return array( + array('A', 10), + array('B', 11), + array('C', 12), + array('D', 13), + array('E', 14), + array('F', 15), + array('G', 16), + array('H', 17), + array('I', 18), + array('J', 19), + array('K', 20), + array('L', 21), + array('M', 22), + array('N', 23), + array('O', 24), + array('P', 25), + array('Q', 26), + array('R', 27), + array('S', 28), + array('T', 29), + array('U', 30), + array('V', 31), + array('W', 32), + array('X', 33), + array('Y', 34), + array('Z', 35), + ); + } + + /** + * @dataProvider alphaToNumberProvider + */ + public function testAlphaToNumber($letter, $number) + { + $this->assertEquals($number, Iban::alphaToNumber($letter), $letter); + } + + public function mod97Provider() + { + // Large numbers + $return = array( + array('123456789123456789', 7), + array('111222333444555666', 73), + array('4242424242424242424242', 19), + array('271828182845904523536028', 68), + ); + + // 0-200 + for ($i = 0; $i < 200; $i++) { + $return[] = array((string)$i, $i % 97); + } + + return $return; + } + /** + * @dataProvider mod97Provider + */ + public function testMod97($number, $result) + { + $this->assertEquals($result, Iban::mod97($number), $number); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Calculator/InnTest.php b/vendor/fzaninotto/faker/test/Faker/Calculator/InnTest.php new file mode 100644 index 0000000..71d9193 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Calculator/InnTest.php @@ -0,0 +1,51 @@ +assertEquals($checksum, Inn::checksum($inn), $inn); + } + + public function validatorProvider() + { + return array( + array('5902179757', true), + array('5408294405', true), + array('2724164617', true), + array('0726000515', true), + array('6312123552', true), + + array('1111111111', false), + array('0123456789', false), + ); + } + + /** + * @dataProvider validatorProvider + */ + public function testIsValid($inn, $isValid) + { + $this->assertEquals($isValid, Inn::isValid($inn), $inn); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Calculator/LuhnTest.php b/vendor/fzaninotto/faker/test/Faker/Calculator/LuhnTest.php new file mode 100644 index 0000000..2e81414 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Calculator/LuhnTest.php @@ -0,0 +1,72 @@ +assertInternalType('string', $checkDigit); + $this->assertEquals($checkDigit, Luhn::computeCheckDigit($partialNumber)); + } + + public function validatorProvider() + { + return array( + array('79927398710', false), + array('79927398711', false), + array('79927398712', false), + array('79927398713', true), + array('79927398714', false), + array('79927398715', false), + array('79927398716', false), + array('79927398717', false), + array('79927398718', false), + array('79927398719', false), + array(79927398713, true), + array(79927398714, false), + ); + } + + /** + * @dataProvider validatorProvider + */ + public function testIsValid($number, $isValid) + { + $this->assertEquals($isValid, Luhn::isValid($number)); + } + + /** + * @expectedException InvalidArgumentException + * @expectedExceptionMessage Argument should be an integer. + */ + public function testGenerateLuhnNumberWithInvalidPrefix() + { + Luhn::generateLuhnNumber('abc'); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Calculator/TCNoTest.php b/vendor/fzaninotto/faker/test/Faker/Calculator/TCNoTest.php new file mode 100644 index 0000000..9e40d79 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Calculator/TCNoTest.php @@ -0,0 +1,54 @@ +assertEquals($checksum, TCNo::checksum($tcNo), $tcNo); + } + + public function validatorProvider() + { + return array( + array('22978160678', true), + array('26480045324', true), + array('47278360658', true), + array('34285002510', true), + array('19874561012', true), + + array('11111111111', false), + array('11234567899', false), + ); + } + + /** + * @dataProvider validatorProvider + * @param $tcNo + * @param $isValid + */ + public function testIsValid($tcNo, $isValid) + { + $this->assertEquals($isValid, TCNo::isValid($tcNo), $tcNo); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/DefaultGeneratorTest.php b/vendor/fzaninotto/faker/test/Faker/DefaultGeneratorTest.php new file mode 100644 index 0000000..fa9eb85 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/DefaultGeneratorTest.php @@ -0,0 +1,28 @@ +assertNull($generator->value); + } + + public function testGeneratorReturnsDefaultValueForAnyPropertyGet() + { + $generator = new DefaultGenerator(123); + $this->assertSame(123, $generator->foo); + $this->assertNotNull($generator->bar); + } + + public function testGeneratorReturnsDefaultValueForAnyMethodCall() + { + $generator = new DefaultGenerator(123); + $this->assertSame(123, $generator->foobar()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/GeneratorTest.php b/vendor/fzaninotto/faker/test/Faker/GeneratorTest.php new file mode 100644 index 0000000..f15df44 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/GeneratorTest.php @@ -0,0 +1,148 @@ +addProvider(new FooProvider()); + $generator->addProvider(new BarProvider()); + $this->assertEquals('barfoo', $generator->format('fooFormatter')); + } + + public function testGetFormatterReturnsCallable() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $this->assertInternalType('callable', $generator->getFormatter('fooFormatter')); + } + + public function testGetFormatterReturnsCorrectFormatter() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $expected = array($provider, 'fooFormatter'); + $this->assertEquals($expected, $generator->getFormatter('fooFormatter')); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testGetFormatterThrowsExceptionOnIncorrectProvider() + { + $generator = new Generator; + $generator->getFormatter('fooFormatter'); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testGetFormatterThrowsExceptionOnIncorrectFormatter() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $generator->getFormatter('barFormatter'); + } + + public function testFormatCallsFormatterOnProvider() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $this->assertEquals('foobar', $generator->format('fooFormatter')); + } + + public function testFormatTransfersArgumentsToFormatter() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $this->assertEquals('bazfoo', $generator->format('fooFormatterWithArguments', array('foo'))); + } + + public function testParseReturnsSameStringWhenItContainsNoCurlyBraces() + { + $generator = new Generator(); + $this->assertEquals('fooBar#?', $generator->parse('fooBar#?')); + } + + public function testParseReturnsStringWithTokensReplacedByFormatters() + { + $generator = new Generator(); + $provider = new FooProvider(); + $generator->addProvider($provider); + $this->assertEquals('This is foobar a text with foobar', $generator->parse('This is {{fooFormatter}} a text with {{ fooFormatter }}')); + } + + public function testMagicGetCallsFormat() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $this->assertEquals('foobar', $generator->fooFormatter); + } + + public function testMagicCallCallsFormat() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $this->assertEquals('foobar', $generator->fooFormatter()); + } + + public function testMagicCallCallsFormatWithArguments() + { + $generator = new Generator; + $provider = new FooProvider(); + $generator->addProvider($provider); + $this->assertEquals('bazfoo', $generator->fooFormatterWithArguments('foo')); + } + + public function testSeed() + { + $generator = new Generator; + + $generator->seed(0); + $mtRandWithSeedZero = mt_rand(); + $generator->seed(0); + $this->assertEquals($mtRandWithSeedZero, mt_rand(), 'seed(0) should be deterministic.'); + + $generator->seed(); + $mtRandWithoutSeed = mt_rand(); + $this->assertNotEquals($mtRandWithSeedZero, $mtRandWithoutSeed, 'seed() should be different than seed(0)'); + $generator->seed(); + $this->assertNotEquals($mtRandWithoutSeed, mt_rand(), 'seed() should not be deterministic.'); + + $generator->seed('10'); + $this->assertTrue(true, 'seeding with a non int value doesn\'t throw an exception'); + } +} + +class FooProvider +{ + public function fooFormatter() + { + return 'foobar'; + } + + public function fooFormatterWithArguments($value = '') + { + return 'baz' . $value; + } +} + +class BarProvider +{ + public function fooFormatter() + { + return 'barfoo'; + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/AddressTest.php new file mode 100644 index 0000000..c7f1814 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/AddressTest.php @@ -0,0 +1,47 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + public function testLatitude() + { + $latitude = $this->faker->latitude(); + $this->assertInternalType('float', $latitude); + $this->assertGreaterThanOrEqual(-90, $latitude); + $this->assertLessThanOrEqual(90, $latitude); + } + + public function testLongitude() + { + $longitude = $this->faker->longitude(); + $this->assertInternalType('float', $longitude); + $this->assertGreaterThanOrEqual(-180, $longitude); + $this->assertLessThanOrEqual(180, $longitude); + } + + public function testCoordinate() + { + $coordinate = $this->faker->localCoordinates(); + $this->assertInternalType('array', $coordinate); + $this->assertInternalType('float', $coordinate['latitude']); + $this->assertGreaterThanOrEqual(-90, $coordinate['latitude']); + $this->assertLessThanOrEqual(90, $coordinate['latitude']); + $this->assertInternalType('float', $coordinate['longitude']); + $this->assertGreaterThanOrEqual(-180, $coordinate['longitude']); + $this->assertLessThanOrEqual(180, $coordinate['longitude']); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/BarcodeTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/BarcodeTest.php new file mode 100644 index 0000000..16ca3cd --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/BarcodeTest.php @@ -0,0 +1,46 @@ +addProvider(new Barcode($faker)); + $faker->seed(0); + $this->faker = $faker; + } + + public function testEan8() + { + $code = $this->faker->ean8(); + $this->assertRegExp('/^\d{8}$/i', $code); + $codeWithoutChecksum = substr($code, 0, -1); + $checksum = substr($code, -1); + $this->assertEquals(TestableBarcode::eanChecksum($codeWithoutChecksum), $checksum); + } + + public function testEan13() + { + $code = $this->faker->ean13(); + $this->assertRegExp('/^\d{13}$/i', $code); + $codeWithoutChecksum = substr($code, 0, -1); + $checksum = substr($code, -1); + $this->assertEquals(TestableBarcode::eanChecksum($codeWithoutChecksum), $checksum); + } +} + +class TestableBarcode extends Barcode +{ + public static function eanChecksum($input) + { + return parent::eanChecksum($input); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/BaseTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/BaseTest.php new file mode 100644 index 0000000..e619d5b --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/BaseTest.php @@ -0,0 +1,572 @@ +assertInternalType('integer', BaseProvider::randomDigit()); + } + + public function testRandomDigitReturnsDigit() + { + $this->assertGreaterThanOrEqual(0, BaseProvider::randomDigit()); + $this->assertLessThan(10, BaseProvider::randomDigit()); + } + + public function testRandomDigitNotNullReturnsNotNullDigit() + { + $this->assertGreaterThan(0, BaseProvider::randomDigitNotNull()); + $this->assertLessThan(10, BaseProvider::randomDigitNotNull()); + } + + + public function testRandomDigitNotReturnsValidDigit() + { + for ($i = 0; $i <= 9; $i++) { + $this->assertGreaterThanOrEqual(0, BaseProvider::randomDigitNot($i)); + $this->assertLessThan(10, BaseProvider::randomDigitNot($i)); + $this->assertNotSame(BaseProvider::randomDigitNot($i), $i); + } + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testRandomNumberThrowsExceptionWhenCalledWithAMax() + { + BaseProvider::randomNumber(5, 200); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testRandomNumberThrowsExceptionWhenCalledWithATooHighNumberOfDigits() + { + BaseProvider::randomNumber(10); + } + + public function testRandomNumberReturnsInteger() + { + $this->assertInternalType('integer', BaseProvider::randomNumber()); + $this->assertInternalType('integer', BaseProvider::randomNumber(5, false)); + } + + public function testRandomNumberReturnsDigit() + { + $this->assertGreaterThanOrEqual(0, BaseProvider::randomNumber(3)); + $this->assertLessThan(1000, BaseProvider::randomNumber(3)); + } + + public function testRandomNumberAcceptsStrictParamToEnforceNumberSize() + { + $this->assertEquals(5, strlen((string) BaseProvider::randomNumber(5, true))); + } + + public function testNumberBetween() + { + $min = 5; + $max = 6; + + $this->assertGreaterThanOrEqual($min, BaseProvider::numberBetween($min, $max)); + $this->assertGreaterThanOrEqual(BaseProvider::numberBetween($min, $max), $max); + } + + public function testNumberBetweenAcceptsZeroAsMax() + { + $this->assertEquals(0, BaseProvider::numberBetween(0, 0)); + } + + public function testRandomFloat() + { + $min = 4; + $max = 10; + $nbMaxDecimals = 8; + + $result = BaseProvider::randomFloat($nbMaxDecimals, $min, $max); + + $parts = explode('.', $result); + + $this->assertInternalType('float', $result); + $this->assertGreaterThanOrEqual($min, $result); + $this->assertLessThanOrEqual($max, $result); + $this->assertLessThanOrEqual($nbMaxDecimals, strlen($parts[1])); + } + + public function testRandomLetterReturnsString() + { + $this->assertInternalType('string', BaseProvider::randomLetter()); + } + + public function testRandomLetterReturnsSingleLetter() + { + $this->assertEquals(1, strlen(BaseProvider::randomLetter())); + } + + public function testRandomLetterReturnsLowercaseLetter() + { + $lowercaseLetters = 'abcdefghijklmnopqrstuvwxyz'; + $this->assertNotFalse(strpos($lowercaseLetters, BaseProvider::randomLetter())); + } + + public function testRandomAsciiReturnsString() + { + $this->assertInternalType('string', BaseProvider::randomAscii()); + } + + public function testRandomAsciiReturnsSingleCharacter() + { + $this->assertEquals(1, strlen(BaseProvider::randomAscii())); + } + + public function testRandomAsciiReturnsAsciiCharacter() + { + $lowercaseLetters = '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'; + $this->assertNotFalse(strpos($lowercaseLetters, BaseProvider::randomAscii())); + } + + public function testRandomElementReturnsNullWhenArrayEmpty() + { + $this->assertNull(BaseProvider::randomElement(array())); + } + + public function testRandomElementReturnsNullWhenCollectionEmpty() + { + $this->assertNull(BaseProvider::randomElement(new Collection(array()))); + } + + public function testRandomElementReturnsElementFromArray() + { + $elements = array('23', 'e', 32, '#'); + $this->assertContains(BaseProvider::randomElement($elements), $elements); + } + + public function testRandomElementReturnsElementFromAssociativeArray() + { + $elements = array('tata' => '23', 'toto' => 'e', 'tutu' => 32, 'titi' => '#'); + $this->assertContains(BaseProvider::randomElement($elements), $elements); + } + + public function testRandomElementReturnsElementFromCollection() + { + $collection = new Collection(array('one', 'two', 'three')); + $this->assertContains(BaseProvider::randomElement($collection), $collection); + } + + public function testShuffleReturnsStringWhenPassedAStringArgument() + { + $this->assertInternalType('string', BaseProvider::shuffle('foo')); + } + + public function testShuffleReturnsArrayWhenPassedAnArrayArgument() + { + $this->assertInternalType('array', BaseProvider::shuffle(array(1, 2, 3))); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testShuffleThrowsExceptionWhenPassedAnInvalidArgument() + { + BaseProvider::shuffle(false); + } + + public function testShuffleArraySupportsEmptyArrays() + { + $this->assertEquals(array(), BaseProvider::shuffleArray(array())); + } + + public function testShuffleArrayReturnsAnArrayOfTheSameSize() + { + $array = array(1, 2, 3, 4, 5); + $this->assertSameSize($array, BaseProvider::shuffleArray($array)); + } + + public function testShuffleArrayReturnsAnArrayWithSameElements() + { + $array = array(2, 4, 6, 8, 10); + $shuffleArray = BaseProvider::shuffleArray($array); + $this->assertContains(2, $shuffleArray); + $this->assertContains(4, $shuffleArray); + $this->assertContains(6, $shuffleArray); + $this->assertContains(8, $shuffleArray); + $this->assertContains(10, $shuffleArray); + } + + public function testShuffleArrayReturnsADifferentArrayThanTheOriginal() + { + $arr = array(1, 2, 3, 4, 5); + $shuffledArray = BaseProvider::shuffleArray($arr); + $this->assertNotEquals($arr, $shuffledArray); + } + + public function testShuffleArrayLeavesTheOriginalArrayUntouched() + { + $arr = array(1, 2, 3, 4, 5); + BaseProvider::shuffleArray($arr); + $this->assertEquals($arr, array(1, 2, 3, 4, 5)); + } + + public function testShuffleStringSupportsEmptyStrings() + { + $this->assertEquals('', BaseProvider::shuffleString('')); + } + + public function testShuffleStringReturnsAnStringOfTheSameSize() + { + $string = 'abcdef'; + $this->assertEquals(strlen($string), strlen(BaseProvider::shuffleString($string))); + } + + public function testShuffleStringReturnsAnStringWithSameElements() + { + $string = 'acegi'; + $shuffleString = BaseProvider::shuffleString($string); + $this->assertContains('a', $shuffleString); + $this->assertContains('c', $shuffleString); + $this->assertContains('e', $shuffleString); + $this->assertContains('g', $shuffleString); + $this->assertContains('i', $shuffleString); + } + + public function testShuffleStringReturnsADifferentStringThanTheOriginal() + { + $string = 'abcdef'; + $shuffledString = BaseProvider::shuffleString($string); + $this->assertNotEquals($string, $shuffledString); + } + + public function testShuffleStringLeavesTheOriginalStringUntouched() + { + $string = 'abcdef'; + BaseProvider::shuffleString($string); + $this->assertEquals($string, 'abcdef'); + } + + public function testNumerifyReturnsSameStringWhenItContainsNoHashSign() + { + $this->assertEquals('fooBar?', BaseProvider::numerify('fooBar?')); + } + + public function testNumerifyReturnsStringWithHashSignsReplacedByDigits() + { + $this->assertRegExp('/foo\dBa\dr/', BaseProvider::numerify('foo#Ba#r')); + } + + public function testNumerifyReturnsStringWithPercentageSignsReplacedByDigits() + { + $this->assertRegExp('/foo\dBa\dr/', BaseProvider::numerify('foo%Ba%r')); + } + + public function testNumerifyReturnsStringWithPercentageSignsReplacedByNotNullDigits() + { + $this->assertNotEquals('0', BaseProvider::numerify('%')); + } + + public function testNumerifyCanGenerateALargeNumberOfDigits() + { + $largePattern = str_repeat('#', 20); // definitely larger than PHP_INT_MAX on all systems + $this->assertEquals(20, strlen(BaseProvider::numerify($largePattern))); + } + + public function testLexifyReturnsSameStringWhenItContainsNoQuestionMark() + { + $this->assertEquals('fooBar#', BaseProvider::lexify('fooBar#')); + } + + public function testLexifyReturnsStringWithQuestionMarksReplacedByLetters() + { + $this->assertRegExp('/foo[a-z]Ba[a-z]r/', BaseProvider::lexify('foo?Ba?r')); + } + + public function testBothifyCombinesNumerifyAndLexify() + { + $this->assertRegExp('/foo[a-z]Ba\dr/', BaseProvider::bothify('foo?Ba#r')); + } + + public function testBothifyAsterisk() + { + $this->assertRegExp('/foo([a-z]|\d)Ba([a-z]|\d)r/', BaseProvider::bothify('foo*Ba*r')); + } + + public function testBothifyUtf() + { + $utf = 'œ∑´®†¥¨ˆøπ“‘和製╯°□°╯︵ â”»â”┻🵠🙈 ﺚﻣ ﻦﻔﺳ ﺲﻘﻄﺗ ﻮﺑﺎﻠﺘﺣﺪﻳﺩ،, ïºïº°ï»³ïº®ïº˜ï»³ ïºïºŽïº´ïº˜ïº§ïº©ïºŽï»£ ﺄﻧ ﺪﻧﻭ. ﺇﺫ ﻪﻧïºØŸ ﺎﻠﺴﺗïºïº­ ﻮﺘ'; + $this->assertRegExp('/'.$utf.'foo\dB[a-z]a([a-z]|\d)r/u', BaseProvider::bothify($utf.'foo#B?a*r')); + } + + public function testAsciifyReturnsSameStringWhenItContainsNoStarSign() + { + $this->assertEquals('fooBar?', BaseProvider::asciify('fooBar?')); + } + + public function testAsciifyReturnsStringWithStarSignsReplacedByAsciiChars() + { + $this->assertRegExp('/foo.Ba.r/', BaseProvider::asciify('foo*Ba*r')); + } + + public function regexifyBasicDataProvider() + { + return array( + array('azeQSDF1234', 'azeQSDF1234', 'does not change non regex chars'), + array('foo(bar){1}', 'foobar', 'replaces regex characters'), + array('', '', 'supports empty string'), + array('/^foo(bar){1}$/', 'foobar', 'ignores regex delimiters') + ); + } + + /** + * @dataProvider regexifyBasicDataProvider + */ + public function testRegexifyBasicFeatures($input, $output, $message) + { + $this->assertEquals($output, BaseProvider::regexify($input), $message); + } + + public function regexifyDataProvider() + { + return array( + array('\d', 'numbers'), + array('\w', 'letters'), + array('(a|b)', 'alternation'), + array('[aeiou]', 'basic character class'), + array('[a-z]', 'character class range'), + array('[a-z1-9]', 'multiple character class range'), + array('a*b+c?', 'single character quantifiers'), + array('a{2}', 'brackets quantifiers'), + array('a{2,3}', 'min-max brackets quantifiers'), + array('[aeiou]{2,3}', 'brackets quantifiers on basic character class'), + array('[a-z]{2,3}', 'brackets quantifiers on character class range'), + array('(a|b){2,3}', 'brackets quantifiers on alternation'), + array('\.\*\?\+', 'escaped characters'), + array('[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}', 'complex regex') + ); + } + + /** + * @dataProvider regexifyDataProvider + */ + public function testRegexifySupportedRegexSyntax($pattern, $message) + { + $this->assertRegExp('/' . $pattern . '/', BaseProvider::regexify($pattern), 'Regexify supports ' . $message); + } + + public function testOptionalReturnsProviderValueWhenCalledWithWeight1() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $this->assertNotNull($faker->optional(100)->randomDigit); + } + + public function testOptionalReturnsNullWhenCalledWithWeight0() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $this->assertNull($faker->optional(0)->randomDigit); + } + + public function testOptionalAllowsChainingPropertyAccess() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $faker->addProvider(new \ArrayObject(array(1))); // hack because method_exists forbids stubs + $this->assertEquals(1, $faker->optional(100)->count); + $this->assertNull($faker->optional(0)->count); + } + + public function testOptionalAllowsChainingMethodCall() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $faker->addProvider(new \ArrayObject(array(1))); // hack because method_exists forbids stubs + $this->assertEquals(1, $faker->optional(100)->count()); + $this->assertNull($faker->optional(0)->count()); + } + + public function testOptionalAllowsChainingProviderCallRandomlyReturnNull() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $values = array(); + for ($i=0; $i < 10; $i++) { + $values[]= $faker->optional()->randomDigit; + } + $this->assertContains(null, $values); + + $values = array(); + for ($i=0; $i < 10; $i++) { + $values[]= $faker->optional(50)->randomDigit; + } + $this->assertContains(null, $values); + } + + /** + * @link https://github.com/fzaninotto/Faker/issues/265 + */ + public function testOptionalPercentageAndWeight() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $faker->addProvider(new \Faker\Provider\Miscellaneous($faker)); + + $valuesOld = array(); + $valuesNew = array(); + + for ($i = 0; $i < 10000; ++$i) { + $valuesOld[] = $faker->optional(0.5)->boolean(100); + $valuesNew[] = $faker->optional(50)->boolean(100); + } + + $this->assertEquals( + round(array_sum($valuesOld) / 10000, 2), + round(array_sum($valuesNew) / 10000, 2) + ); + } + + public function testUniqueAllowsChainingPropertyAccess() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $faker->addProvider(new \ArrayObject(array(1))); // hack because method_exists forbids stubs + $this->assertEquals(1, $faker->unique()->count); + } + + public function testUniqueAllowsChainingMethodCall() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $faker->addProvider(new \ArrayObject(array(1))); // hack because method_exists forbids stubs + $this->assertEquals(1, $faker->unique()->count()); + } + + public function testUniqueReturnsOnlyUniqueValues() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $values = array(); + for ($i=0; $i < 10; $i++) { + $values[]= $faker->unique()->randomDigit; + } + sort($values); + $this->assertEquals(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9), $values); + } + + /** + * @expectedException OverflowException + */ + public function testUniqueThrowsExceptionWhenNoUniqueValueCanBeGenerated() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + for ($i=0; $i < 11; $i++) { + $faker->unique()->randomDigit; + } + } + + public function testUniqueCanResetUniquesWhenPassedTrueAsArgument() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $values = array(); + for ($i=0; $i < 10; $i++) { + $values[]= $faker->unique()->randomDigit; + } + $values[]= $faker->unique(true)->randomDigit; + for ($i=0; $i < 9; $i++) { + $values[]= $faker->unique()->randomDigit; + } + sort($values); + $this->assertEquals(array(0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9), $values); + } + + public function testValidAllowsChainingPropertyAccess() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $this->assertLessThan(10, $faker->valid()->randomDigit); + } + + public function testValidAllowsChainingMethodCall() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $this->assertLessThan(10, $faker->valid()->numberBetween(5, 9)); + } + + public function testValidReturnsOnlyValidValues() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $values = array(); + $evenValidator = function($digit) { + return $digit % 2 === 0; + }; + for ($i=0; $i < 50; $i++) { + $values[$faker->valid($evenValidator)->randomDigit] = true; + } + $uniqueValues = array_keys($values); + sort($uniqueValues); + $this->assertEquals(array(0, 2, 4, 6, 8), $uniqueValues); + } + + /** + * @expectedException OverflowException + */ + public function testValidThrowsExceptionWhenNoValidValueCanBeGenerated() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $evenValidator = function($digit) { + return $digit % 2 === 0; + }; + for ($i=0; $i < 11; $i++) { + $faker->valid($evenValidator)->randomElement(array(1, 3, 5, 7, 9)); + } + } + + /** + * @expectedException InvalidArgumentException + */ + public function testValidThrowsExceptionWhenParameterIsNotCollable() + { + $faker = new \Faker\Generator(); + $faker->addProvider(new \Faker\Provider\Base($faker)); + $faker->valid(12)->randomElement(array(1, 3, 5, 7, 9)); + } + + /** + * @expectedException LengthException + * @expectedExceptionMessage Cannot get 2 elements, only 1 in array + */ + public function testRandomElementsThrowsWhenRequestingTooManyKeys() + { + BaseProvider::randomElements(array('foo'), 2); + } + + public function testRandomElements() + { + $this->assertCount(1, BaseProvider::randomElements(), 'Should work without any input'); + + $empty = BaseProvider::randomElements(array(), 0); + $this->assertInternalType('array', $empty); + $this->assertCount(0, $empty); + + $shuffled = BaseProvider::randomElements(array('foo', 'bar', 'baz'), 3); + $this->assertContains('foo', $shuffled); + $this->assertContains('bar', $shuffled); + $this->assertContains('baz', $shuffled); + + $allowDuplicates = BaseProvider::randomElements(array('foo', 'bar'), 3, true); + $this->assertCount(3, $allowDuplicates); + $this->assertContainsOnly('string', $allowDuplicates); + } +} + +class Collection extends \ArrayObject +{ +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/BiasedTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/BiasedTest.php new file mode 100644 index 0000000..cce3dc0 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/BiasedTest.php @@ -0,0 +1,74 @@ +generator = new Generator(); + $this->generator->addProvider(new Biased($this->generator)); + + $this->results = array_fill(1, self::MAX, 0); + } + + public function performFake($function) + { + for($i = 0; $i < self::NUMBERS; $i++) { + $this->results[$this->generator->biasedNumberBetween(1, self::MAX, $function)]++; + } + } + + public function testUnbiased() + { + $this->performFake(array('\Faker\Provider\Biased', 'unbiased')); + + // assert that all numbers are near the expected unbiased value + foreach ($this->results as $number => $amount) { + // integral + $assumed = (1 / self::MAX * $number) - (1 / self::MAX * ($number - 1)); + // calculate the fraction of the whole area + $assumed /= 1; + $this->assertGreaterThan(self::NUMBERS * $assumed * .95, $amount, "Value was more than 5 percent under the expected value"); + $this->assertLessThan(self::NUMBERS * $assumed * 1.05, $amount, "Value was more than 5 percent over the expected value"); + } + } + + public function testLinearHigh() + { + $this->performFake(array('\Faker\Provider\Biased', 'linearHigh')); + + foreach ($this->results as $number => $amount) { + // integral + $assumed = 0.5 * pow(1 / self::MAX * $number, 2) - 0.5 * pow(1 / self::MAX * ($number - 1), 2); + // calculate the fraction of the whole area + $assumed /= pow(1, 2) * .5; + $this->assertGreaterThan(self::NUMBERS * $assumed * .9, $amount, "Value was more than 10 percent under the expected value"); + $this->assertLessThan(self::NUMBERS * $assumed * 1.1, $amount, "Value was more than 10 percent over the expected value"); + } + } + + public function testLinearLow() + { + $this->performFake(array('\Faker\Provider\Biased', 'linearLow')); + + foreach ($this->results as $number => $amount) { + // integral + $assumed = -0.5 * pow(1 / self::MAX * $number, 2) - -0.5 * pow(1 / self::MAX * ($number - 1), 2); + // shift the graph up + $assumed += 1 / self::MAX; + // calculate the fraction of the whole area + $assumed /= pow(1, 2) * .5; + $this->assertGreaterThan(self::NUMBERS * $assumed * .9, $amount, "Value was more than 10 percent under the expected value"); + $this->assertLessThan(self::NUMBERS * $assumed * 1.1, $amount, "Value was more than 10 percent over the expected value"); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ColorTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ColorTest.php new file mode 100644 index 0000000..ff5edac --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ColorTest.php @@ -0,0 +1,54 @@ +assertRegExp('/^#[a-f0-9]{6}$/i', Color::hexColor()); + } + + public function testSafeHexColor() + { + $this->assertRegExp('/^#[a-f0-9]{6}$/i', Color::safeHexColor()); + } + + public function testRgbColorAsArray() + { + $this->assertEquals(3, count(Color::rgbColorAsArray())); + } + + public function testRgbColor() + { + $regexp = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])'; + $this->assertRegExp('/^' . $regexp . ',' . $regexp . ',' . $regexp . '$/i', Color::rgbColor()); + } + + public function testRgbCssColor() + { + $regexp = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])'; + $this->assertRegExp('/^rgb\(' . $regexp . ',' . $regexp . ',' . $regexp . '\)$/i', Color::rgbCssColor()); + } + + public function testRgbaCssColor() + { + $regexp = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])'; + $regexpAlpha = '([01]?(\.\d+)?)'; + $this->assertRegExp('/^rgba\(' . $regexp . ',' . $regexp . ',' . $regexp . ',' . $regexpAlpha . '\)$/i', Color::rgbaCssColor()); + } + + public function testSafeColorName() + { + $this->assertRegExp('/^[\w]+$/', Color::safeColorName()); + } + + public function testColorName() + { + $this->assertRegExp('/^[\w]+$/', Color::colorName()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/CompanyTest.php new file mode 100644 index 0000000..28ce0eb --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/CompanyTest.php @@ -0,0 +1,31 @@ +addProvider(new Company($faker)); + $faker->addProvider(new Lorem($faker)); + $this->faker = $faker; + } + + public function testJobTitle() + { + $jobTitle = $this->faker->jobTitle(); + $pattern = '/^[A-Za-z]+$/'; + $this->assertRegExp($pattern, $jobTitle); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/DateTimeTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/DateTimeTest.php new file mode 100644 index 0000000..ec3ad86 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/DateTimeTest.php @@ -0,0 +1,282 @@ +defaultTz = 'UTC'; + DateTimeProvider::setDefaultTimezone($this->defaultTz); + } + + public function tearDown() + { + DateTimeProvider::setDefaultTimezone(); + } + + public function testPreferDefaultTimezoneOverSystemTimezone() + { + /** + * Set the system timezone to something *other* than the timezone used + * in setUp(). + */ + $originalSystemTimezone = date_default_timezone_get(); + $systemTimezone = 'Antarctica/Vostok'; + date_default_timezone_set($systemTimezone); + + /** + * Get a new date/time value and assert that it prefers the default + * timezone over the system timezone. + */ + $date = DateTimeProvider::dateTime(); + $this->assertNotSame($systemTimezone, $date->getTimezone()->getName()); + $this->assertSame($this->defaultTz, $date->getTimezone()->getName()); + + /** + * Restore the system timezone. + */ + date_default_timezone_set($originalSystemTimezone); + } + + public function testUseSystemTimezoneWhenDefaultTimezoneIsNotSet() + { + /** + * Set the system timezone to something *other* than the timezone used + * in setUp() *and* reset the default timezone. + */ + $originalSystemTimezone = date_default_timezone_get(); + $originalDefaultTimezone = DateTimeProvider::getDefaultTimezone(); + $systemTimezone = 'Antarctica/Vostok'; + date_default_timezone_set($systemTimezone); + DateTimeProvider::setDefaultTimezone(); + + /** + * Get a new date/time value and assert that it uses the system timezone + * and not the system timezone. + */ + $date = DateTimeProvider::dateTime(); + $this->assertSame($systemTimezone, $date->getTimezone()->getName()); + $this->assertNotSame($this->defaultTz, $date->getTimezone()->getName()); + + /** + * Restore the system timezone. + */ + date_default_timezone_set($originalSystemTimezone); + } + + public function testUnixTime() + { + $timestamp = DateTimeProvider::unixTime(); + $this->assertInternalType('int', $timestamp); + $this->assertGreaterThanOrEqual(0, $timestamp); + $this->assertLessThanOrEqual(time(), $timestamp); + } + + public function testDateTime() + { + $date = DateTimeProvider::dateTime(); + $this->assertInstanceOf('\DateTime', $date); + $this->assertGreaterThanOrEqual(new \DateTime('@0'), $date); + $this->assertLessThanOrEqual(new \DateTime(), $date); + $this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone()); + } + + public function testDateTimeWithTimezone() + { + $date = DateTimeProvider::dateTime('now', 'America/New_York'); + $this->assertEquals($date->getTimezone(), new \DateTimeZone('America/New_York')); + } + + public function testDateTimeAD() + { + $date = DateTimeProvider::dateTimeAD(); + $this->assertInstanceOf('\DateTime', $date); + $this->assertGreaterThanOrEqual(new \DateTime('0000-01-01 00:00:00'), $date); + $this->assertLessThanOrEqual(new \DateTime(), $date); + $this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone()); + } + + public function testDateTimeThisCentury() + { + $date = DateTimeProvider::dateTimeThisCentury(); + $this->assertInstanceOf('\DateTime', $date); + $this->assertGreaterThanOrEqual(new \DateTime('-100 year'), $date); + $this->assertLessThanOrEqual(new \DateTime(), $date); + $this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone()); + } + + public function testDateTimeThisDecade() + { + $date = DateTimeProvider::dateTimeThisDecade(); + $this->assertInstanceOf('\DateTime', $date); + $this->assertGreaterThanOrEqual(new \DateTime('-10 year'), $date); + $this->assertLessThanOrEqual(new \DateTime(), $date); + $this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone()); + } + + public function testDateTimeThisYear() + { + $date = DateTimeProvider::dateTimeThisYear(); + $this->assertInstanceOf('\DateTime', $date); + $this->assertGreaterThanOrEqual(new \DateTime('-1 year'), $date); + $this->assertLessThanOrEqual(new \DateTime(), $date); + $this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone()); + } + + public function testDateTimeThisMonth() + { + $date = DateTimeProvider::dateTimeThisMonth(); + $this->assertInstanceOf('\DateTime', $date); + $this->assertGreaterThanOrEqual(new \DateTime('-1 month'), $date); + $this->assertLessThanOrEqual(new \DateTime(), $date); + $this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone()); + } + + public function testDateTimeThisCenturyWithTimezone() + { + $date = DateTimeProvider::dateTimeThisCentury('now', 'America/New_York'); + $this->assertEquals($date->getTimezone(), new \DateTimeZone('America/New_York')); + } + + public function testDateTimeThisDecadeWithTimezone() + { + $date = DateTimeProvider::dateTimeThisDecade('now', 'America/New_York'); + $this->assertEquals($date->getTimezone(), new \DateTimeZone('America/New_York')); + } + + public function testDateTimeThisYearWithTimezone() + { + $date = DateTimeProvider::dateTimeThisYear('now', 'America/New_York'); + $this->assertEquals($date->getTimezone(), new \DateTimeZone('America/New_York')); + } + + public function testDateTimeThisMonthWithTimezone() + { + $date = DateTimeProvider::dateTimeThisMonth('now', 'America/New_York'); + $this->assertEquals($date->getTimezone(), new \DateTimeZone('America/New_York')); + } + + public function testIso8601() + { + $date = DateTimeProvider::iso8601(); + $this->assertRegExp('/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-Z](\d{4})?$/', $date); + $this->assertGreaterThanOrEqual(new \DateTime('@0'), new \DateTime($date)); + $this->assertLessThanOrEqual(new \DateTime(), new \DateTime($date)); + } + + public function testDate() + { + $date = DateTimeProvider::date(); + $this->assertRegExp('/^\d{4}-\d{2}-\d{2}$/', $date); + $this->assertGreaterThanOrEqual(new \DateTime('@0'), new \DateTime($date)); + $this->assertLessThanOrEqual(new \DateTime(), new \DateTime($date)); + } + + public function testTime() + { + $date = DateTimeProvider::time(); + $this->assertRegExp('/^\d{2}:\d{2}:\d{2}$/', $date); + } + + /** + * + * @dataProvider providerDateTimeBetween + */ + public function testDateTimeBetween($start, $end) + { + $date = DateTimeProvider::dateTimeBetween($start, $end); + $this->assertInstanceOf('\DateTime', $date); + $this->assertGreaterThanOrEqual(new \DateTime($start), $date); + $this->assertLessThanOrEqual(new \DateTime($end), $date); + $this->assertEquals(new \DateTimeZone($this->defaultTz), $date->getTimezone()); + } + + public function providerDateTimeBetween() + { + return array( + array('-1 year', false), + array('-1 year', null), + array('-1 day', '-1 hour'), + array('-1 day', 'now'), + ); + } + + /** + * + * @dataProvider providerDateTimeInInterval + */ + public function testDateTimeInInterval($start, $interval = "+5 days", $isInFuture) + { + $date = DateTimeProvider::dateTimeInInterval($start, $interval); + $this->assertInstanceOf('\DateTime', $date); + + $_interval = \DateInterval::createFromDateString($interval); + $_start = new \DateTime($start); + if ($isInFuture) { + $this->assertGreaterThanOrEqual($_start, $date); + $this->assertLessThanOrEqual($_start->add($_interval), $date); + } else { + $this->assertLessThanOrEqual($_start, $date); + $this->assertGreaterThanOrEqual($_start->add($_interval), $date); + } + } + + public function providerDateTimeInInterval() + { + return array( + array('-1 year', '+5 days', true), + array('-1 day', '-1 hour', false), + array('-1 day', '+1 hour', true), + ); + } + + public function testFixedSeedWithMaximumTimestamp() + { + $max = '2118-03-01 12:00:00'; + + mt_srand(1); + $unixTime = DateTimeProvider::unixTime($max); + $datetimeAD = DateTimeProvider::dateTimeAD($max); + $dateTime1 = DateTimeProvider::dateTime($max); + $dateTimeBetween = DateTimeProvider::dateTimeBetween('2014-03-01 06:00:00', $max); + $date = DateTimeProvider::date('Y-m-d', $max); + $time = DateTimeProvider::time('H:i:s', $max); + $iso8601 = DateTimeProvider::iso8601($max); + $dateTimeThisCentury = DateTimeProvider::dateTimeThisCentury($max); + $dateTimeThisDecade = DateTimeProvider::dateTimeThisDecade($max); + $dateTimeThisMonth = DateTimeProvider::dateTimeThisMonth($max); + $amPm = DateTimeProvider::amPm($max); + $dayOfMonth = DateTimeProvider::dayOfMonth($max); + $dayOfWeek = DateTimeProvider::dayOfWeek($max); + $month = DateTimeProvider::month($max); + $monthName = DateTimeProvider::monthName($max); + $year = DateTimeProvider::year($max); + $dateTimeThisYear = DateTimeProvider::dateTimeThisYear($max); + mt_srand(); + + //regenerate Random Date with same seed and same maximum end timestamp + mt_srand(1); + $this->assertEquals($unixTime, DateTimeProvider::unixTime($max)); + $this->assertEquals($datetimeAD, DateTimeProvider::dateTimeAD($max)); + $this->assertEquals($dateTime1, DateTimeProvider::dateTime($max)); + $this->assertEquals($dateTimeBetween, DateTimeProvider::dateTimeBetween('2014-03-01 06:00:00', $max)); + $this->assertEquals($date, DateTimeProvider::date('Y-m-d', $max)); + $this->assertEquals($time, DateTimeProvider::time('H:i:s', $max)); + $this->assertEquals($iso8601, DateTimeProvider::iso8601($max)); + $this->assertEquals($dateTimeThisCentury, DateTimeProvider::dateTimeThisCentury($max)); + $this->assertEquals($dateTimeThisDecade, DateTimeProvider::dateTimeThisDecade($max)); + $this->assertEquals($dateTimeThisMonth, DateTimeProvider::dateTimeThisMonth($max)); + $this->assertEquals($amPm, DateTimeProvider::amPm($max)); + $this->assertEquals($dayOfMonth, DateTimeProvider::dayOfMonth($max)); + $this->assertEquals($dayOfWeek, DateTimeProvider::dayOfWeek($max)); + $this->assertEquals($month, DateTimeProvider::month($max)); + $this->assertEquals($monthName, DateTimeProvider::monthName($max)); + $this->assertEquals($year, DateTimeProvider::year($max)); + $this->assertEquals($dateTimeThisYear, DateTimeProvider::dateTimeThisYear($max)); + mt_srand(); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/HtmlLoremTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/HtmlLoremTest.php new file mode 100644 index 0000000..f7814fa --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/HtmlLoremTest.php @@ -0,0 +1,30 @@ +addProvider(new HtmlLorem($faker)); + $node = $faker->randomHtml(6, 10); + $this->assertStringStartsWith("", $node); + $this->assertStringEndsWith("\n", $node); + } + + public function testRandomHtmlReturnsValidHTMLString(){ + $faker = new Generator(); + $faker->addProvider(new HtmlLorem($faker)); + $node = $faker->randomHtml(6, 10); + $dom = new \DOMDocument(); + $error = $dom->loadHTML($node); + $this->assertTrue($error); + } + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ImageTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ImageTest.php new file mode 100644 index 0000000..c73992c --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ImageTest.php @@ -0,0 +1,76 @@ +assertRegExp('#^https://lorempixel.com/640/480/#', Image::imageUrl()); + } + + public function testImageUrlAcceptsCustomWidthAndHeight() + { + $this->assertRegExp('#^https://lorempixel.com/800/400/#', Image::imageUrl(800, 400)); + } + + public function testImageUrlAcceptsCustomCategory() + { + $this->assertRegExp('#^https://lorempixel.com/800/400/nature/#', Image::imageUrl(800, 400, 'nature')); + } + + public function testImageUrlAcceptsCustomText() + { + $this->assertRegExp('#^https://lorempixel.com/800/400/nature/Faker#', Image::imageUrl(800, 400, 'nature', false, 'Faker')); + } + + public function testImageUrlAddsARandomGetParameterByDefault() + { + $url = Image::imageUrl(800, 400); + $splitUrl = preg_split('/\?/', $url); + + $this->assertEquals(count($splitUrl), 2); + $this->assertRegexp('#\d{5}#', $splitUrl[1]); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testUrlWithDimensionsAndBadCategory() + { + Image::imageUrl(800, 400, 'bullhonky'); + } + + public function testDownloadWithDefaults() + { + $url = "http://lorempixel.com/"; + $curlPing = curl_init($url); + curl_setopt($curlPing, CURLOPT_TIMEOUT, 5); + curl_setopt($curlPing, CURLOPT_CONNECTTIMEOUT, 5); + curl_setopt($curlPing, CURLOPT_RETURNTRANSFER, true); + $data = curl_exec($curlPing); + $httpCode = curl_getinfo($curlPing, CURLINFO_HTTP_CODE); + curl_close($curlPing); + + if ($httpCode < 200 | $httpCode > 300) { + $this->markTestSkipped("LoremPixel is offline, skipping image download"); + } + + $file = Image::image(sys_get_temp_dir()); + $this->assertFileExists($file); + if (function_exists('getimagesize')) { + list($width, $height, $type, $attr) = getimagesize($file); + $this->assertEquals(640, $width); + $this->assertEquals(480, $height); + $this->assertEquals(constant('IMAGETYPE_JPEG'), $type); + } else { + $this->assertEquals('jpg', pathinfo($file, PATHINFO_EXTENSION)); + } + if (file_exists($file)) { + unlink($file); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/InternetTest.php new file mode 100644 index 0000000..93fe7b4 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/InternetTest.php @@ -0,0 +1,167 @@ +addProvider(new Lorem($faker)); + $faker->addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function localeDataProvider() + { + $providerPath = realpath(__DIR__ . '/../../../src/Faker/Provider'); + $localePaths = array_filter(glob($providerPath . '/*', GLOB_ONLYDIR)); + foreach ($localePaths as $path) { + $parts = explode('/', $path); + $locales[] = array($parts[count($parts) - 1]); + } + + return $locales; + } + + /** + * @link http://stackoverflow.com/questions/12026842/how-to-validate-an-email-address-in-php + * + * @dataProvider localeDataProvider + */ + public function testEmailIsValid($locale) + { + if ($locale !== 'en_US' && !class_exists('Transliterator')) { + $this->markTestSkipped('Transliterator class not available (intl extension)'); + } + + $this->loadLocalProviders($locale); + $pattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD'; + $emailAddress = $this->faker->email(); + $this->assertRegExp($pattern, $emailAddress); + } + + /** + * @dataProvider localeDataProvider + */ + public function testUsernameIsValid($locale) + { + if ($locale !== 'en_US' && !class_exists('Transliterator')) { + $this->markTestSkipped('Transliterator class not available (intl extension)'); + } + + $this->loadLocalProviders($locale); + $pattern = '/^[A-Za-z0-9]+([._][A-Za-z0-9]+)*$/'; + $username = $this->faker->username(); + $this->assertRegExp($pattern, $username); + } + + /** + * @dataProvider localeDataProvider + */ + public function testDomainnameIsValid($locale) + { + if ($locale !== 'en_US' && !class_exists('Transliterator')) { + $this->markTestSkipped('Transliterator class not available (intl extension)'); + } + + $this->loadLocalProviders($locale); + $pattern = '/^[a-z]+(\.[a-z]+)+$/'; + $domainName = $this->faker->domainName(); + $this->assertRegExp($pattern, $domainName); + } + + /** + * @dataProvider localeDataProvider + */ + public function testDomainwordIsValid($locale) + { + if ($locale !== 'en_US' && !class_exists('Transliterator')) { + $this->markTestSkipped('Transliterator class not available (intl extension)'); + } + + $this->loadLocalProviders($locale); + $pattern = '/^[a-z]+$/'; + $domainWord = $this->faker->domainWord(); + $this->assertRegExp($pattern, $domainWord); + } + + public function loadLocalProviders($locale) + { + $providerPath = realpath(__DIR__ . '/../../../src/Faker/Provider'); + if (file_exists($providerPath.'/'.$locale.'/Internet.php')) { + $internet = "\\Faker\\Provider\\$locale\\Internet"; + $this->faker->addProvider(new $internet($this->faker)); + } + if (file_exists($providerPath.'/'.$locale.'/Person.php')) { + $person = "\\Faker\\Provider\\$locale\\Person"; + $this->faker->addProvider(new $person($this->faker)); + } + if (file_exists($providerPath.'/'.$locale.'/Company.php')) { + $company = "\\Faker\\Provider\\$locale\\Company"; + $this->faker->addProvider(new $company($this->faker)); + } + } + + public function testPasswordIsValid() + { + $this->assertRegexp('/^.{6}$/', $this->faker->password(6, 6)); + } + + public function testSlugIsValid() + { + $pattern = '/^[a-z0-9-]+$/'; + $slug = $this->faker->slug(); + $this->assertSame(preg_match($pattern, $slug), 1); + } + + public function testUrlIsValid() + { + $url = $this->faker->url(); + $this->assertNotFalse(filter_var($url, FILTER_VALIDATE_URL)); + } + + public function testLocalIpv4() + { + $this->assertNotFalse(filter_var(Internet::localIpv4(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)); + } + + public function testIpv4() + { + $this->assertNotFalse(filter_var($this->faker->ipv4(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)); + } + + public function testIpv4NotLocalNetwork() + { + $this->assertNotRegExp('/\A0\./', $this->faker->ipv4()); + } + + public function testIpv4NotBroadcast() + { + $this->assertNotEquals('255.255.255.255', $this->faker->ipv4()); + } + + public function testIpv6() + { + $this->assertNotFalse(filter_var($this->faker->ipv6(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)); + } + + public function testMacAddress() + { + $this->assertRegExp('/^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$/i', Internet::macAddress()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/LocalizationTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/LocalizationTest.php new file mode 100644 index 0000000..6cfcc89 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/LocalizationTest.php @@ -0,0 +1,27 @@ +assertNotNull($faker->name(), 'Localized Name Provider ' . $matches[1] . ' does not throw errors'); + } + } + + public function testLocalizedAddressProvidersDoNotThrowErrors() + { + foreach (glob(__DIR__ . '/../../../src/Faker/Provider/*/Address.php') as $localizedAddress) { + preg_match('#/([a-zA-Z_]+)/Address\.php#', $localizedAddress, $matches); + $faker = Factory::create($matches[1]); + $this->assertNotNull($faker->address(), 'Localized Address Provider ' . $matches[1] . ' does not throw errors'); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/LoremTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/LoremTest.php new file mode 100644 index 0000000..16d9889 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/LoremTest.php @@ -0,0 +1,109 @@ +assertEquals('Word word word word.', TestableLorem::text(24)); + } + + public function testTextReturnsSentencesWhenAskedSizeLessThan100() + { + $this->assertEquals('This is a test sentence. This is a test sentence. This is a test sentence.', TestableLorem::text(99)); + } + + public function testTextReturnsParagraphsWhenAskedSizeGreaterOrEqualThanThan100() + { + $this->assertEquals('This is a test paragraph. It has three sentences. Exactly three.', TestableLorem::text(100)); + } + + public function testSentenceWithZeroNbWordsReturnsEmptyString() + { + $this->assertEquals('', Lorem::sentence(0)); + } + + public function testSentenceWithNegativeNbWordsReturnsEmptyString() + { + $this->assertEquals('', Lorem::sentence(-1)); + } + + public function testParagraphWithZeroNbSentencesReturnsEmptyString() + { + $this->assertEquals('', Lorem::paragraph(0)); + } + + public function testParagraphWithNegativeNbSentencesReturnsEmptyString() + { + $this->assertEquals('', Lorem::paragraph(-1)); + } + + public function testSentenceWithPositiveNbWordsReturnsAtLeastOneWord() + { + $sentence = Lorem::sentence(1); + + $this->assertGreaterThan(1, strlen($sentence)); + $this->assertGreaterThanOrEqual(1, count(explode(' ', $sentence))); + } + + public function testParagraphWithPositiveNbSentencesReturnsAtLeastOneWord() + { + $paragraph = Lorem::paragraph(1); + + $this->assertGreaterThan(1, strlen($paragraph)); + $this->assertGreaterThanOrEqual(1, count(explode(' ', $paragraph))); + } + + public function testWordssAsText() + { + $words = TestableLorem::words(2, true); + + $this->assertEquals('word word', $words); + } + + public function testSentencesAsText() + { + $sentences = TestableLorem::sentences(2, true); + + $this->assertEquals('This is a test sentence. This is a test sentence.', $sentences); + } + + public function testParagraphsAsText() + { + $paragraphs = TestableLorem::paragraphs(2, true); + + $expected = "This is a test paragraph. It has three sentences. Exactly three.\n\nThis is a test paragraph. It has three sentences. Exactly three."; + $this->assertEquals($expected, $paragraphs); + } +} + +class TestableLorem extends Lorem +{ + + public static function word() + { + return 'word'; + } + + public static function sentence($nbWords = 5, $variableNbWords = true) + { + return 'This is a test sentence.'; + } + + public static function paragraph($nbSentences = 3, $variableNbSentences = true) + { + return 'This is a test paragraph. It has three sentences. Exactly three.'; + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/MiscellaneousTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/MiscellaneousTest.php new file mode 100644 index 0000000..6a29cd5 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/MiscellaneousTest.php @@ -0,0 +1,59 @@ +assertContains(Miscellaneous::boolean(), array(true, false)); + } + + public function testMd5() + { + $this->assertRegExp('/^[a-z0-9]{32}$/', Miscellaneous::md5()); + } + + public function testSha1() + { + $this->assertRegExp('/^[a-z0-9]{40}$/', Miscellaneous::sha1()); + } + + public function testSha256() + { + $this->assertRegExp('/^[a-z0-9]{64}$/', Miscellaneous::sha256()); + } + + public function testLocale() + { + $this->assertRegExp('/^[a-z]{2,3}_[A-Z]{2}$/', Miscellaneous::locale()); + } + + public function testCountryCode() + { + $this->assertRegExp('/^[A-Z]{2}$/', Miscellaneous::countryCode()); + } + + public function testCountryISOAlpha3() + { + $this->assertRegExp('/^[A-Z]{3}$/', Miscellaneous::countryISOAlpha3()); + } + + public function testLanguage() + { + $this->assertRegExp('/^[a-z]{2}$/', Miscellaneous::languageCode()); + } + + public function testCurrencyCode() + { + $this->assertRegExp('/^[A-Z]{3}$/', Miscellaneous::currencyCode()); + } + + public function testEmoji() + { + $this->assertRegExp('/^[\x{1F600}-\x{1F637}]$/u', Miscellaneous::emoji()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/PaymentTest.php new file mode 100644 index 0000000..966b9d6 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/PaymentTest.php @@ -0,0 +1,209 @@ +addProvider(new BaseProvider($faker)); + $faker->addProvider(new DateTimeProvider($faker)); + $faker->addProvider(new PersonProvider($faker)); + $faker->addProvider(new PaymentProvider($faker)); + $this->faker = $faker; + } + + public function localeDataProvider() + { + $providerPath = realpath(__DIR__ . '/../../../src/Faker/Provider'); + $localePaths = array_filter(glob($providerPath . '/*', GLOB_ONLYDIR)); + foreach ($localePaths as $path) { + $parts = explode('/', $path); + $locales[] = array($parts[count($parts) - 1]); + } + + return $locales; + } + + public function loadLocalProviders($locale) + { + $providerPath = realpath(__DIR__ . '/../../../src/Faker/Provider'); + if (file_exists($providerPath.'/'.$locale.'/Payment.php')) { + $payment = "\\Faker\\Provider\\$locale\\Payment"; + $this->faker->addProvider(new $payment($this->faker)); + } + } + + public function testCreditCardTypeReturnsValidVendorName() + { + $this->assertContains($this->faker->creditCardType, array('Visa', 'Visa Retired', 'MasterCard', 'American Express', 'Discover Card')); + } + + public function creditCardNumberProvider() + { + return array( + array('Discover Card', '/^6011\d{12}$/'), + array('Visa', '/^4\d{15}$/'), + array('Visa Retired', '/^4\d{12}$/'), + array('MasterCard', '/^(5[1-5]|2[2-7])\d{14}$/') + ); + } + + /** + * @dataProvider creditCardNumberProvider + */ + public function testCreditCardNumberReturnsValidCreditCardNumber($type, $regexp) + { + $cardNumber = $this->faker->creditCardNumber($type); + $this->assertRegExp($regexp, $cardNumber); + $this->assertTrue(Luhn::isValid($cardNumber)); + } + + public function testCreditCardNumberCanFormatOutput() + { + $this->assertRegExp('/^6011-\d{4}-\d{4}-\d{4}$/', $this->faker->creditCardNumber('Discover Card', true)); + } + + public function testCreditCardExpirationDateReturnsValidDateByDefault() + { + $expirationDate = $this->faker->creditCardExpirationDate; + $this->assertTrue(intval($expirationDate->format('U')) > strtotime('now')); + $this->assertTrue(intval($expirationDate->format('U')) < strtotime('+36 months')); + } + + public function testRandomCard() + { + $cardDetails = $this->faker->creditCardDetails; + $this->assertEquals(count($cardDetails), 4); + $this->assertEquals(array('type', 'number', 'name', 'expirationDate'), array_keys($cardDetails)); + } + + protected $ibanFormats = array( + 'AD' => '/^AD\d{2}\d{4}\d{4}[A-Z0-9]{12}$/', + 'AE' => '/^AE\d{2}\d{3}\d{16}$/', + 'AL' => '/^AL\d{2}\d{8}[A-Z0-9]{16}$/', + 'AT' => '/^AT\d{2}\d{5}\d{11}$/', + 'AZ' => '/^AZ\d{2}[A-Z]{4}[A-Z0-9]{20}$/', + 'BA' => '/^BA\d{2}\d{3}\d{3}\d{8}\d{2}$/', + 'BE' => '/^BE\d{2}\d{3}\d{7}\d{2}$/', + 'BG' => '/^BG\d{2}[A-Z]{4}\d{4}\d{2}[A-Z0-9]{8}$/', + 'BH' => '/^BH\d{2}[A-Z]{4}[A-Z0-9]{14}$/', + 'BR' => '/^BR\d{2}\d{8}\d{5}\d{10}[A-Z]{1}[A-Z0-9]{1}$/', + 'CH' => '/^CH\d{2}\d{5}[A-Z0-9]{12}$/', + 'CR' => '/^CR\d{2}\d{3}\d{14}$/', + 'CY' => '/^CY\d{2}\d{3}\d{5}[A-Z0-9]{16}$/', + 'CZ' => '/^CZ\d{2}\d{4}\d{6}\d{10}$/', + 'DE' => '/^DE\d{2}\d{8}\d{10}$/', + 'DK' => '/^DK\d{2}\d{4}\d{9}\d{1}$/', + 'DO' => '/^DO\d{2}[A-Z0-9]{4}\d{20}$/', + 'EE' => '/^EE\d{2}\d{2}\d{2}\d{11}\d{1}$/', + 'ES' => '/^ES\d{2}\d{4}\d{4}\d{1}\d{1}\d{10}$/', + 'FI' => '/^FI\d{2}\d{6}\d{7}\d{1}$/', + 'FR' => '/^FR\d{2}\d{5}\d{5}[A-Z0-9]{11}\d{2}$/', + 'GB' => '/^GB\d{2}[A-Z]{4}\d{6}\d{8}$/', + 'GE' => '/^GE\d{2}[A-Z]{2}\d{16}$/', + 'GI' => '/^GI\d{2}[A-Z]{4}[A-Z0-9]{15}$/', + 'GR' => '/^GR\d{2}\d{3}\d{4}[A-Z0-9]{16}$/', + 'GT' => '/^GT\d{2}[A-Z0-9]{4}[A-Z0-9]{20}$/', + 'HR' => '/^HR\d{2}\d{7}\d{10}$/', + 'HU' => '/^HU\d{2}\d{3}\d{4}\d{1}\d{15}\d{1}$/', + 'IE' => '/^IE\d{2}[A-Z]{4}\d{6}\d{8}$/', + 'IL' => '/^IL\d{2}\d{3}\d{3}\d{13}$/', + 'IS' => '/^IS\d{2}\d{4}\d{2}\d{6}\d{10}$/', + 'IT' => '/^IT\d{2}[A-Z]{1}\d{5}\d{5}[A-Z0-9]{12}$/', + 'KW' => '/^KW\d{2}[A-Z]{4}\d{22}$/', + 'KZ' => '/^KZ\d{2}\d{3}[A-Z0-9]{13}$/', + 'LB' => '/^LB\d{2}\d{4}[A-Z0-9]{20}$/', + 'LI' => '/^LI\d{2}\d{5}[A-Z0-9]{12}$/', + 'LT' => '/^LT\d{2}\d{5}\d{11}$/', + 'LU' => '/^LU\d{2}\d{3}[A-Z0-9]{13}$/', + 'LV' => '/^LV\d{2}[A-Z]{4}[A-Z0-9]{13}$/', + 'MC' => '/^MC\d{2}\d{5}\d{5}[A-Z0-9]{11}\d{2}$/', + 'MD' => '/^MD\d{2}[A-Z0-9]{2}[A-Z0-9]{18}$/', + 'ME' => '/^ME\d{2}\d{3}\d{13}\d{2}$/', + 'MK' => '/^MK\d{2}\d{3}[A-Z0-9]{10}\d{2}$/', + 'MR' => '/^MR\d{2}\d{5}\d{5}\d{11}\d{2}$/', + 'MT' => '/^MT\d{2}[A-Z]{4}\d{5}[A-Z0-9]{18}$/', + 'MU' => '/^MU\d{2}[A-Z]{4}\d{2}\d{2}\d{12}\d{3}[A-Z]{3}$/', + 'NL' => '/^NL\d{2}[A-Z]{4}\d{10}$/', + 'NO' => '/^NO\d{2}\d{4}\d{6}\d{1}$/', + 'PK' => '/^PK\d{2}[A-Z]{4}[A-Z0-9]{16}$/', + 'PL' => '/^PL\d{2}\d{8}\d{16}$/', + 'PS' => '/^PS\d{2}[A-Z]{4}[A-Z0-9]{21}$/', + 'PT' => '/^PT\d{2}\d{4}\d{4}\d{11}\d{2}$/', + 'RO' => '/^RO\d{2}[A-Z]{4}[A-Z0-9]{16}$/', + 'RS' => '/^RS\d{2}\d{3}\d{13}\d{2}$/', + 'SA' => '/^SA\d{2}\d{2}[A-Z0-9]{18}$/', + 'SE' => '/^SE\d{2}\d{3}\d{16}\d{1}$/', + 'SI' => '/^SI\d{2}\d{5}\d{8}\d{2}$/', + 'SK' => '/^SK\d{2}\d{4}\d{6}\d{10}$/', + 'SM' => '/^SM\d{2}[A-Z]{1}\d{5}\d{5}[A-Z0-9]{12}$/', + 'TN' => '/^TN\d{2}\d{2}\d{3}\d{13}\d{2}$/', + 'TR' => '/^TR\d{2}\d{5}\d{1}[A-Z0-9]{16}$/', + 'VG' => '/^VG\d{2}[A-Z]{4}\d{16}$/', + ); + + /** + * @dataProvider localeDataProvider + */ + public function testBankAccountNumber($locale) + { + $parts = explode('_', $locale); + $countryCode = array_pop($parts); + + if (!isset($this->ibanFormats[$countryCode])) { + // No IBAN format available + return; + } + + $this->loadLocalProviders($locale); + + try { + $iban = $this->faker->bankAccountNumber; + } catch (\InvalidArgumentException $e) { + // Not implemented, nothing to test + $this->markTestSkipped("bankAccountNumber not implemented for $locale"); + return; + } + + // Test format + $this->assertRegExp($this->ibanFormats[$countryCode], $iban); + + // Test checksum + $this->assertTrue(Iban::isValid($iban), "Checksum for $iban is invalid"); + } + + public function ibanFormatProvider() + { + $return = array(); + foreach ($this->ibanFormats as $countryCode => $regex) { + $return[] = array($countryCode, $regex); + } + return $return; + } + /** + * @dataProvider ibanFormatProvider + */ + public function testIban($countryCode, $regex) + { + $iban = $this->faker->iban($countryCode); + + // Test format + $this->assertRegExp($regex, $iban); + + // Test checksum + $this->assertTrue(Iban::isValid($iban), "Checksum for $iban is invalid"); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/PersonTest.php new file mode 100644 index 0000000..f53076f --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/PersonTest.php @@ -0,0 +1,87 @@ +addProvider(new Person($faker)); + $this->assertContains($faker->firstName($gender), $expected); + } + + public function firstNameProvider() + { + return array( + array(null, array('John', 'Jane')), + array('foobar', array('John', 'Jane')), + array('male', array('John')), + array('female', array('Jane')), + ); + } + + public function testFirstNameMale() + { + $this->assertContains(Person::firstNameMale(), array('John')); + } + + public function testFirstNameFemale() + { + $this->assertContains(Person::firstNameFemale(), array('Jane')); + } + + /** + * @dataProvider titleProvider + */ + public function testTitle($gender, $expected) + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $this->assertContains($faker->title($gender), $expected); + } + + public function titleProvider() + { + return array( + array(null, array('Mr.', 'Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.')), + array('foobar', array('Mr.', 'Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.')), + array('male', array('Mr.', 'Dr.', 'Prof.')), + array('female', array('Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.')), + ); + } + + public function testTitleMale() + { + $this->assertContains(Person::titleMale(), array('Mr.', 'Dr.', 'Prof.')); + } + + public function testTitleFemale() + { + $this->assertContains(Person::titleFemale(), array('Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.')); + } + + public function testLastNameReturnsDoe() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $this->assertEquals($faker->lastName(), 'Doe'); + } + + public function testNameReturnsFirstNameAndLastName() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $this->assertContains($faker->name(), array('John Doe', 'Jane Doe')); + $this->assertContains($faker->name('foobar'), array('John Doe', 'Jane Doe')); + $this->assertContains($faker->name('male'), array('John Doe')); + $this->assertContains($faker->name('female'), array('Jane Doe')); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/PhoneNumberTest.php new file mode 100644 index 0000000..520ecea --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/PhoneNumberTest.php @@ -0,0 +1,36 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumberFormat() + { + $number = $this->faker->e164PhoneNumber(); + $this->assertRegExp('/^\+[0-9]{11,}$/', $number); + } + + public function testImeiReturnsValidNumber() + { + $imei = $this->faker->imei(); + $this->assertTrue(Luhn::isValid($imei)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ProviderOverrideTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ProviderOverrideTest.php new file mode 100644 index 0000000..61d7d63 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ProviderOverrideTest.php @@ -0,0 +1,194 @@ + + */ + +namespace Faker\Test\Provider; + +use Faker; +use PHPUnit\Framework\TestCase; + +/** + * Class ProviderOverrideTest + * + * @package Faker\Test\Provider + * + * This class tests a large portion of all locale specific providers. It does not test the entire stack, because each + * locale specific provider (can) has specific implementations. The goal of this test is to test the common denominator + * and to try to catch possible invalid multi-byte sequences. + */ +class ProviderOverrideTest extends TestCase +{ + /** + * Constants with regular expression patterns for testing the output. + * + * Regular expressions are sensitive for malformed strings (e.g.: strings with incorrect encodings) so by using + * PCRE for the tests, even though they seem fairly pointless, we test for incorrect encodings also. + */ + const TEST_STRING_REGEX = '/.+/u'; + + /** + * Slightly more specific for e-mail, the point isn't to properly validate e-mails. + */ + const TEST_EMAIL_REGEX = '/^(.+)@(.+)$/ui'; + + /** + * @dataProvider localeDataProvider + * @param string $locale + */ + public function testAddress($locale = null) + { + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->city); + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->postcode); + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->address); + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->country); + } + + + /** + * @dataProvider localeDataProvider + * @param string $locale + */ + public function testCompany($locale = null) + { + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->company); + } + + + /** + * @dataProvider localeDataProvider + * @param string $locale + */ + public function testDateTime($locale = null) + { + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->century); + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->timezone); + } + + + /** + * @dataProvider localeDataProvider + * @param string $locale + */ + public function testInternet($locale = null) + { + if ($locale && $locale !== 'en_US' && !class_exists('Transliterator')) { + $this->markTestSkipped('Transliterator class not available (intl extension)'); + } + + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->userName); + + $this->assertRegExp(static::TEST_EMAIL_REGEX, $faker->email); + $this->assertRegExp(static::TEST_EMAIL_REGEX, $faker->safeEmail); + $this->assertRegExp(static::TEST_EMAIL_REGEX, $faker->freeEmail); + $this->assertRegExp(static::TEST_EMAIL_REGEX, $faker->companyEmail); + } + + + /** + * @dataProvider localeDataProvider + * @param string $locale + */ + public function testPerson($locale = null) + { + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->name); + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->title); + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->firstName); + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->lastName); + } + + + /** + * @dataProvider localeDataProvider + * @param string $locale + */ + public function testPhoneNumber($locale = null) + { + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->phoneNumber); + } + + + /** + * @dataProvider localeDataProvider + * @param string $locale + */ + public function testUserAgent($locale = null) + { + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->userAgent); + } + + + /** + * @dataProvider localeDataProvider + * + * @param null $locale + * @param string $locale + */ + public function testUuid($locale = null) + { + $faker = Faker\Factory::create($locale); + + $this->assertRegExp(static::TEST_STRING_REGEX, $faker->uuid); + } + + + /** + * @return array + */ + public function localeDataProvider() + { + $locales = $this->getAllLocales(); + $data = array(); + + foreach ($locales as $locale) { + $data[] = array( + $locale + ); + } + + return $data; + } + + + /** + * Returns all locales as array values + * + * @return array + */ + private function getAllLocales() + { + static $locales = array(); + + if ( ! empty($locales)) { + return $locales; + } + + // Finding all PHP files in the xx_XX directories + $providerDir = __DIR__ .'/../../../src/Faker/Provider'; + foreach (glob($providerDir .'/*_*/*.php') as $file) { + $localisation = basename(dirname($file)); + + if (isset($locales[ $localisation ])) { + continue; + } + + $locales[ $localisation ] = $localisation; + } + + return $locales; + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/TextTest.php new file mode 100644 index 0000000..a43d8d4 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/TextTest.php @@ -0,0 +1,55 @@ +addProvider(new Text($generator)); + $generator->seed(0); + + $lengths = array(10, 20, 50, 70, 90, 120, 150, 200, 500); + + foreach ($lengths as $length) { + $this->assertLessThan($length, $generator->realText($length)); + } + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testTextMaxIndex() + { + $generator = new Generator(); + $generator->addProvider(new Text($generator)); + $generator->seed(0); + $generator->realText(200, 11); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testTextMinIndex() + { + $generator = new Generator(); + $generator->addProvider(new Text($generator)); + $generator->seed(0); + $generator->realText(200, 0); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testTextMinLength() + { + $generator = new Generator(); + $generator->addProvider(new Text($generator)); + $generator->seed(0); + $generator->realText(9); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/UserAgentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/UserAgentTest.php new file mode 100644 index 0000000..5ba2459 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/UserAgentTest.php @@ -0,0 +1,39 @@ +assertNotNull(UserAgent::userAgent()); + } + + public function testFirefoxUserAgent() + { + $this->stringContains(' Firefox/', UserAgent::firefox()); + } + + public function testSafariUserAgent() + { + $this->stringContains('Safari/', UserAgent::safari()); + } + + public function testInternetExplorerUserAgent() + { + $this->assertStringStartsWith('Mozilla/5.0 (compatible; MSIE ', UserAgent::internetExplorer()); + } + + public function testOperaUserAgent() + { + $this->assertStringStartsWith('Opera/', UserAgent::opera()); + } + + public function testChromeUserAgent() + { + $this->stringContains('(KHTML, like Gecko) Chrome/', UserAgent::chrome()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/UuidTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/UuidTest.php new file mode 100644 index 0000000..5c639ca --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/UuidTest.php @@ -0,0 +1,32 @@ +assertTrue($this->isUuid($uuid)); + } + + public function testUuidExpectedSeed() + { + if (pack('L', 0x6162797A) == pack('N', 0x6162797A)) { + $this->markTestSkipped('Big Endian'); + } + $faker = new Generator(); + $faker->seed(123); + $this->assertEquals("8e2e0c84-50dd-367c-9e66-f3ab455c78d6", BaseProvider::uuid()); + $this->assertEquals("073eb60a-902c-30ab-93d0-a94db371f6c8", BaseProvider::uuid()); + } + + protected function isUuid($uuid) + { + return is_string($uuid) && (bool) preg_match('/^[a-f0-9]{8,8}-(?:[a-f0-9]{4,4}-){3,3}[a-f0-9]{12,12}$/i', $uuid); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ar_JO/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ar_JO/InternetTest.php new file mode 100644 index 0000000..33d70c4 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ar_JO/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ar_SA/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ar_SA/InternetTest.php new file mode 100644 index 0000000..8059f00 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ar_SA/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/at_AT/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/at_AT/PaymentTest.php new file mode 100644 index 0000000..f62dae8 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/at_AT/PaymentTest.php @@ -0,0 +1,31 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testVatIsValid() + { + $vat = $this->faker->vat(); + $unspacedVat = $this->faker->vat(false); + $this->assertRegExp('/^(AT U\d{8})$/', $vat); + $this->assertRegExp('/^(ATU\d{8})$/', $unspacedVat); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/bg_BG/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/bg_BG/PaymentTest.php new file mode 100644 index 0000000..b5645f9 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/bg_BG/PaymentTest.php @@ -0,0 +1,31 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testVatIsValid() + { + $vat = $this->faker->vat(); + $unspacedVat = $this->faker->vat(false); + $this->assertRegExp('/^(BG \d{9,10})$/', $vat); + $this->assertRegExp('/^(BG\d{9,10})$/', $unspacedVat); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/bn_BD/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/bn_BD/PersonTest.php new file mode 100644 index 0000000..e82fe8b --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/bn_BD/PersonTest.php @@ -0,0 +1,30 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testIfFirstNameMaleCanReturnData() + { + $firstNameMale = $this->faker->firstNameMale(); + $this->assertNotEmpty($firstNameMale); + } + + public function testIfFirstNameFemaleCanReturnData() + { + $firstNameFemale = $this->faker->firstNameFemale(); + $this->assertNotEmpty($firstNameFemale); + } +} +?> diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/cs_CZ/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/cs_CZ/PersonTest.php new file mode 100644 index 0000000..0b19872 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/cs_CZ/PersonTest.php @@ -0,0 +1,47 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Miscellaneous($faker)); + + for ($i = 0; $i < 1000; $i++) { + $birthNumber = $faker->birthNumber(); + $birthNumber = str_replace('/', '', $birthNumber); + + // check date + $year = intval(substr($birthNumber, 0, 2), 10); + $month = intval(substr($birthNumber, 2, 2), 10); + $day = intval(substr($birthNumber, 4, 2), 10); + + // make 4 digit year from 2 digit representation + $year += $year < 54 ? 2000 : 1900; + + // adjust special cases for month + if ($month > 50) $month -= 50; + if ($year >= 2004 && $month > 20) $month -= 20; + + $this->assertTrue(checkdate($month, $day, $year), "Birth number $birthNumber: date $year/$month/$day is invalid."); + + // check CRC if presented + if (strlen($birthNumber) == 10) { + $crc = intval(substr($birthNumber, -1), 10); + $refCrc = intval(substr($birthNumber, 0, -1), 10) % 11; + if ($refCrc == 10) { + $refCrc = 0; + } + $this->assertEquals($crc, $refCrc, "Birth number $birthNumber: checksum $crc doesn't match expected $refCrc."); + } + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/da_DK/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/da_DK/InternetTest.php new file mode 100644 index 0000000..43c09be --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/da_DK/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/de_AT/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/de_AT/InternetTest.php new file mode 100644 index 0000000..1d778ee --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/de_AT/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/de_AT/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/de_AT/PhoneNumberTest.php new file mode 100644 index 0000000..7cc6e6b --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/de_AT/PhoneNumberTest.php @@ -0,0 +1,29 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumberFormat() + { + $number = $this->faker->phoneNumber; + $this->assertRegExp('/^06\d{2} \d{7}|\+43 \d{4} \d{4}(-\d{2})?$/', $number); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/AddressTest.php new file mode 100644 index 0000000..668f211 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/AddressTest.php @@ -0,0 +1,70 @@ +addProvider(new Address($faker)); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function canton () + { + $canton = $this->faker->canton(); + $this->assertInternalType('array', $canton); + $this->assertCount(1, $canton); + + foreach ($canton as $cantonShort => $cantonName){ + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + } + + /** + * @test + */ + public function cantonName () + { + $cantonName = $this->faker->cantonName(); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + + /** + * @test + */ + public function cantonShort () + { + $cantonShort = $this->faker->cantonShort(); + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + } + + /** + * @test + */ + public function address (){ + $address = $this->faker->address(); + $this->assertInternalType('string', $address); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/InternetTest.php new file mode 100644 index 0000000..31dcc55 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/InternetTest.php @@ -0,0 +1,36 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function emailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/PhoneNumberTest.php new file mode 100644 index 0000000..5102297 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/de_CH/PhoneNumberTest.php @@ -0,0 +1,33 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumber() + { + $this->assertRegExp('/^0\d{2} ?\d{3} ?\d{2} ?\d{2}|\+41 ?(\(0\))?\d{2} ?\d{3} ?\d{2} ?\d{2}$/', $this->faker->phoneNumber()); + } + + public function testMobileNumber() + { + $this->assertRegExp('/^07[56789] ?\d{3} ?\d{2} ?\d{2}$/', $this->faker->mobileNumber()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/de_DE/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/de_DE/InternetTest.php new file mode 100644 index 0000000..a15f366 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/de_DE/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/el_GR/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/el_GR/TextTest.php new file mode 100644 index 0000000..3f03dd3 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/el_GR/TextTest.php @@ -0,0 +1,57 @@ +textClass = new \ReflectionClass('Faker\Provider\el_GR\Text'); + } + + protected function getMethod($name) { + $method = $this->textClass->getMethod($name); + + $method->setAccessible(true); + + return $method; + } + + /** @test */ + function testItShouldAppendEndPunctToTheEndOfString() + { + $this->assertSame( + 'Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ ')) + ); + + $this->assertSame( + 'Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ—')) + ); + + $this->assertSame( + 'Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ,')) + ); + + $this->assertSame( + 'Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ!.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ! ')) + ); + + $this->assertSame( + 'Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ; ')) + ); + + $this->assertSame( + 'Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Και δεν άκουσες το κλοπακλόπ, κλοπακλόπ, κλοπακλόπ: ')) + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_AU/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_AU/AddressTest.php new file mode 100644 index 0000000..b2f72e8 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_AU/AddressTest.php @@ -0,0 +1,49 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + public function testCityPrefix() + { + $cityPrefix = $this->faker->cityPrefix(); + $this->assertNotEmpty($cityPrefix); + $this->assertInternalType('string', $cityPrefix); + $this->assertRegExp('/[A-Z][a-z]+/', $cityPrefix); + } + + public function testStreetSuffix() + { + $streetSuffix = $this->faker->streetSuffix(); + $this->assertNotEmpty($streetSuffix); + $this->assertInternalType('string', $streetSuffix); + $this->assertRegExp('/[A-Z][a-z]+/', $streetSuffix); + } + + public function testState() + { + $state = $this->faker->state(); + $this->assertNotEmpty($state); + $this->assertInternalType('string', $state); + $this->assertRegExp('/[A-Z][a-z]+/', $state); + } +} + +?> diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_CA/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_CA/AddressTest.php new file mode 100644 index 0000000..6b1ece7 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_CA/AddressTest.php @@ -0,0 +1,69 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + /** + * Test the validity of province + */ + public function testProvince() + { + $province = $this->faker->province(); + $this->assertNotEmpty($province); + $this->assertInternalType('string', $province); + $this->assertRegExp('/[A-Z][a-z]+/', $province); + } + + /** + * Test the validity of province abbreviation + */ + public function testProvinceAbbr() + { + $provinceAbbr = $this->faker->provinceAbbr(); + $this->assertNotEmpty($provinceAbbr); + $this->assertInternalType('string', $provinceAbbr); + $this->assertRegExp('/^[A-Z]{2}$/', $provinceAbbr); + } + + /** + * Test the validity of postcode letter + */ + public function testPostcodeLetter() + { + $postcodeLetter = $this->faker->randomPostcodeLetter(); + $this->assertNotEmpty($postcodeLetter); + $this->assertInternalType('string', $postcodeLetter); + $this->assertRegExp('/^[A-Z]{1}$/', $postcodeLetter); + } + + /** + * Test the validity of Canadian postcode + */ + public function testPostcode() + { + $postcode = $this->faker->postcode(); + $this->assertNotEmpty($postcode); + $this->assertInternalType('string', $postcode); + $this->assertRegExp('/^[A-Za-z]\d[A-Za-z][ -]?\d[A-Za-z]\d$/', $postcode); + } +} + +?> diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_GB/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_GB/AddressTest.php new file mode 100644 index 0000000..762e11a --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_GB/AddressTest.php @@ -0,0 +1,36 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + /** + * + */ + public function testPostcode() + { + + $postcode = $this->faker->postcode(); + $this->assertNotEmpty($postcode); + $this->assertInternalType('string', $postcode); + $this->assertRegExp('@^(GIR ?0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]([0-9ABEHMNPRV-Y])?)|[0-9][A-HJKPS-UW]) ?[0-9][ABD-HJLNP-UW-Z]{2})$@i', $postcode); + + } + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_IN/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_IN/AddressTest.php new file mode 100644 index 0000000..125cbdf --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_IN/AddressTest.php @@ -0,0 +1,57 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + public function testCity() + { + $city = $this->faker->city(); + $this->assertNotEmpty($city); + $this->assertInternalType('string', $city); + $this->assertRegExp('/[A-Z][a-z]+/', $city); + } + + public function testCountry() + { + $country = $this->faker->country(); + $this->assertNotEmpty($country); + $this->assertInternalType('string', $country); + $this->assertRegExp('/[A-Z][a-z]+/', $country); + } + + public function testLocalityName() + { + $localityName = $this->faker->localityName(); + $this->assertNotEmpty($localityName); + $this->assertInternalType('string', $localityName); + $this->assertRegExp('/[A-Z][a-z]+/', $localityName); + } + + public function testAreaSuffix() + { + $areaSuffix = $this->faker->areaSuffix(); + $this->assertNotEmpty($areaSuffix); + $this->assertInternalType('string', $areaSuffix); + $this->assertRegExp('/[A-Z][a-z]+/', $areaSuffix); + } +} + +?> diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/AddressTest.php new file mode 100644 index 0000000..27c591b --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/AddressTest.php @@ -0,0 +1,57 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + /** + * + */ + public function testPostcodeIsNotEmptyAndIsValid() + { + $postcode = $this->faker->postcode(); + + $this->assertNotEmpty($postcode); + $this->assertInternalType('string', $postcode); + } + + /** + * Test the name of the Nigerian State/County + */ + public function testCountyIsAValidString() + { + $county = $this->faker->county; + + $this->assertNotEmpty($county); + $this->assertInternalType('string', $county); + } + + /** + * Test the name of the Nigerian Region in a State. + */ + public function testRegionIsAValidString() + { + $region = $this->faker->region; + + $this->assertNotEmpty($region); + $this->assertInternalType('string', $region); + } + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/InternetTest.php new file mode 100644 index 0000000..6ebc620 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + $this->assertNotEmpty($email); + $this->assertInternalType('string', $email); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/PersonTest.php new file mode 100644 index 0000000..2180e36 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/PersonTest.php @@ -0,0 +1,30 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testPersonNameIsAValidString() + { + $name = $this->faker->name; + + $this->assertNotEmpty($name); + $this->assertInternalType('string', $name); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/PhoneNumberTest.php new file mode 100644 index 0000000..c591b8a --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_NG/PhoneNumberTest.php @@ -0,0 +1,26 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumberReturnsPhoneNumberWithOrWithoutCountryCode() + { + $phoneNumber = $this->faker->phoneNumber(); + + $this->assertNotEmpty($phoneNumber); + $this->assertInternalType('string', $phoneNumber); + $this->assertRegExp('/^(0|(\+234))\s?[789][01]\d\s?(\d{3}\s?\d{4})/', $phoneNumber); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_NZ/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_NZ/PhoneNumberTest.php new file mode 100644 index 0000000..14b145c --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_NZ/PhoneNumberTest.php @@ -0,0 +1,36 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testIfPhoneNumberCanReturnData() + { + $number = $this->faker->phoneNumber; + $this->assertNotEmpty($number); + } + + public function phoneNumberFormat() + { + $number = $this->faker->phoneNumber; + $this->assertRegExp('/(^\([0]\d{1}\))(\d{7}$)|(^\([0][2]\d{1}\))(\d{6,8}$)|([0][8][0][0])([\s])(\d{5,8}$)/', $number); + } +} +?> diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_PH/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_PH/AddressTest.php new file mode 100644 index 0000000..19367a4 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_PH/AddressTest.php @@ -0,0 +1,50 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + public function testProvince() + { + $province = $this->faker->province(); + $this->assertNotEmpty($province); + $this->assertInternalType('string', $province); + } + + public function testCity() + { + $city = $this->faker->city(); + $this->assertNotEmpty($city); + $this->assertInternalType('string', $city); + } + + public function testMunicipality() + { + $municipality = $this->faker->municipality(); + $this->assertNotEmpty($municipality); + $this->assertInternalType('string', $municipality); + } + + public function testBarangay() + { + $barangay = $this->faker->barangay(); + $this->assertInternalType('string', $barangay); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_SG/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_SG/AddressTest.php new file mode 100644 index 0000000..abc62aa --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_SG/AddressTest.php @@ -0,0 +1,27 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + public function testStreetNumber() + { + $this->assertRegExp('/^\d{2,3}$/', $this->faker->streetNumber()); + } + + public function testBlockNumber() + { + $this->assertRegExp('/^Blk\s*\d{2,3}[A-H]*$/i', $this->faker->blockNumber()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_SG/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_SG/PhoneNumberTest.php new file mode 100644 index 0000000..c8bb13f --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_SG/PhoneNumberTest.php @@ -0,0 +1,46 @@ +faker = Factory::create('en_SG'); + $this->faker->seed(1); + $this->faker->addProvider(new PhoneNumber($this->faker)); + } + + // http://en.wikipedia.org/wiki/Telephone_numbers_in_Singapore#Numbering_plan + // y means 0 to 8 only + // x means 0 to 9 + public function testMobilePhoneNumberStartWith9Returns9yxxxxxx() + { + $startsWith9 = false; + while (!$startsWith9) { + $mobileNumber = $this->faker->mobileNumber(); + $startsWith9 = preg_match('/^(\+65|65)?\s*9/', $mobileNumber); + } + + $this->assertRegExp('/^(\+65|65)?\s*9\s*[0-8]{3}\s*\d{4}$/', $mobileNumber); + } + + // http://en.wikipedia.org/wiki/Telephone_numbers_in_Singapore#Numbering_plan + // z means 1 to 9 only + // x means 0 to 9 + public function testMobilePhoneNumberStartWith7Or8Returns7Or8zxxxxxx() + { + $startsWith7Or8 = false; + while (!$startsWith7Or8) { + $mobileNumber = $this->faker->mobileNumber(); + $startsWith7Or8 = preg_match('/^(\+65|65)?\s*[7-8]/', $mobileNumber); + } + $this->assertRegExp('/^(\+65|65)?\s*[7-8]\s*[1-9]{3}\s*\d{4}$/', $mobileNumber); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_UG/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_UG/AddressTest.php new file mode 100644 index 0000000..571d93f --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_UG/AddressTest.php @@ -0,0 +1,53 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function testCityName() + { + $city = $this->faker->cityName(); + $this->assertNotEmpty($city); + $this->assertInternalType('string', $city); + } + + /** + * @test + */ + public function testDistrict() + { + $district = $this->faker->district(); + $this->assertNotEmpty($district); + $this->assertInternalType('string', $district); + } + + /** + * @test + */ + public function testRegion() + { + $region = $this->faker->region(); + $this->assertNotEmpty($region); + $this->assertInternaltype('string', $region); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_US/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/CompanyTest.php new file mode 100644 index 0000000..735d833 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/CompanyTest.php @@ -0,0 +1,33 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + /** + * @link https://stackoverflow.com/questions/4242433/regex-for-ein-number-and-ssn-number-format-in-jquery/35471665#35471665 + */ + public function testEin() + { + $number = $this->faker->ein; + + // should be in the format ##-#######, with a valid prefix + $this->assertRegExp('/^(0[1-6]||1[0-6]|2[0-7]|[35]\d|[468][0-8]|7[1-7]|9[0-58-9])-\d{7}$/', $number); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PaymentTest.php new file mode 100644 index 0000000..ec82691 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PaymentTest.php @@ -0,0 +1,85 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testBankAccountNumber() + { + $accNo = $this->faker->bankAccountNumber; + $this->assertTrue(ctype_digit($accNo)); + $this->assertLessThanOrEqual(17, strlen($accNo)); + } + + public function testBankRoutingNumber() + { + $routingNo = $this->faker->bankRoutingNumber; + $this->assertRegExp('/^\d{9}$/', $routingNo); + $this->assertEquals(Payment::calculateRoutingNumberChecksum($routingNo), $routingNo[8]); + } + + public function routingNumberProvider() + { + return array( + array('122105155'), + array('082000549'), + array('121122676'), + array('122235821'), + array('102101645'), + array('102000021'), + array('123103729'), + array('071904779'), + array('081202759'), + array('074900783'), + array('104000029'), + array('073000545'), + array('101000187'), + array('042100175'), + array('083900363'), + array('091215927'), + array('091300023'), + array('091000022'), + array('081000210'), + array('101200453'), + array('092900383'), + array('104000029'), + array('121201694'), + array('107002312'), + array('091300023'), + array('041202582'), + array('042000013'), + array('123000220'), + array('091408501'), + array('064000059'), + array('124302150'), + array('125000105'), + array('075000022'), + array('307070115'), + array('091000022'), + ); + } + + /** + * @dataProvider routingNumberProvider + */ + public function testCalculateRoutingNumberChecksum($routingNo) + { + $this->assertEquals($routingNo[8], Payment::calculateRoutingNumberChecksum($routingNo), $routingNo); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PersonTest.php new file mode 100644 index 0000000..3ddb38b --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PersonTest.php @@ -0,0 +1,48 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testSsn() + { + for ($i = 0; $i < 100; $i++) { + $number = $this->faker->ssn; + + // should be in the format ###-##-#### + $this->assertRegExp('/^[0-9]{3}-[0-9]{2}-[0-9]{4}$/', $number); + + $parts = explode("-", $number); + + // first part must be between 001 and 899, excluding 666 + $this->assertNotEquals(666, $parts[0]); + $this->assertGreaterThan(0, $parts[0]); + $this->assertLessThan(900, $parts[0]); + + // second part must be between 01 and 99 + $this->assertGreaterThan(0, $parts[1]); + $this->assertLessThan(100, $parts[1]); + + // the third part must be between 0001 and 9999 + $this->assertGreaterThan(0, $parts[2]); + $this->assertLessThan(10000, $parts[2]); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PhoneNumberTest.php new file mode 100644 index 0000000..a54ff88 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_US/PhoneNumberTest.php @@ -0,0 +1,85 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumber() + { + for ($i = 0; $i < 100; $i++) { + $number = $this->faker->phoneNumber; + $baseNumber = preg_replace('/ *x.*$/', '', $number); // Remove possible extension + $digits = array_values(array_filter(str_split($baseNumber), 'ctype_digit')); + + // Prefix '1' allowed + if (count($digits) === 11) { + $this->assertEquals('1', $digits[0]); + $digits = array_slice($digits, 1); + } + + // 10 digits + $this->assertEquals(10, count($digits)); + + // Last two digits of area code cannot be identical + $this->assertNotEquals($digits[1], $digits[2]); + + // Last two digits of exchange code cannot be 1 + if ($digits[4] === 1) { + $this->assertNotEquals($digits[4], $digits[5]); + } + + // Test format + $this->assertRegExp('/^(\+?1)?([ -.]*\d{3}[ -.]*| *\(\d{3}\) *)\d{3}[-.]?\d{4}$/', $baseNumber); + } + } + + public function testTollFreeAreaCode() + { + $this->assertContains($this->faker->tollFreeAreaCode, array(800, 822, 833, 844, 855, 866, 877, 888, 880, 887, 889)); + } + + public function testTollFreePhoneNumber() + { + for ($i = 0; $i < 100; $i++) { + $number = $this->faker->tollFreePhoneNumber; + $digits = array_values(array_filter(str_split($number), 'ctype_digit')); + + // Prefix '1' allowed + if (count($digits) === 11) { + $this->assertEquals('1', $digits[0]); + $digits = array_slice($digits, 1); + } + + // 10 digits + $this->assertEquals(10, count($digits)); + + $areaCode = $digits[0] . $digits[1] . $digits[2]; + $this->assertContains($areaCode, array('800', '822', '833', '844', '855', '866', '877', '888', '880', '887', '889')); + + // Last two digits of exchange code cannot be 1 + if ($digits[4] === 1) { + $this->assertNotEquals($digits[4], $digits[5]); + } + + // Test format + $this->assertRegExp('/^(\+?1)?([ -.]*\d{3}[ -.]*| *\(\d{3}\) *)\d{3}[-.]?\d{4}$/', $number); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/CompanyTest.php new file mode 100644 index 0000000..0e51d49 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/CompanyTest.php @@ -0,0 +1,27 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testGenerateValidCompanyNumber() + { + $companyRegNo = $this->faker->companyNumber(); + + $this->assertEquals(14, strlen($companyRegNo)); + $this->assertRegExp('#^\d{4}/\d{6}/\d{2}$#', $companyRegNo); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/InternetTest.php new file mode 100644 index 0000000..02c2940 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/PersonTest.php new file mode 100644 index 0000000..d7973e7 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/PersonTest.php @@ -0,0 +1,69 @@ +addProvider(new Person($faker)); + $faker->addProvider(new DateTime($faker)); + $this->faker = $faker; + } + + public function testIdNumberWithDefaults() + { + $idNumber = $this->faker->idNumber(); + + $this->assertEquals(13, strlen($idNumber)); + $this->assertRegExp('#^\d{13}$#', $idNumber); + $this->assertInternalType('string', $idNumber); + } + + public function testIdNumberForMales() + { + $idNumber = $this->faker->idNumber(new \DateTime(), true, 'male'); + + $genderDigit = substr($idNumber, 6, 1); + + $this->assertContains($genderDigit, array('5', '6', '7', '8', '9')); + } + + public function testIdNumberForFemales() + { + $idNumber = $this->faker->idNumber(new \DateTime(), true, 'female'); + + $genderDigit = substr($idNumber, 6, 1); + + $this->assertContains($genderDigit, array('0', '1', '2', '3', '4')); + } + + public function testLicenceCode() + { + $validLicenceCodes = array('A', 'A1', 'B', 'C', 'C1', 'C2', 'EB', 'EC', 'EC1', 'I', 'L', 'L1'); + + $this->assertContains($this->faker->licenceCode, $validLicenceCodes); + } + + public function testMaleTitles() + { + $validMaleTitles = array('Mr.', 'Dr.', 'Prof.', 'Rev.', 'Hon.'); + + $this->assertContains(Person::titleMale(), $validMaleTitles); + } + + public function testFemaleTitles() + { + $validateFemaleTitles = array('Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.', 'Rev.', 'Hon.'); + + $this->assertContains(Person::titleFemale(), $validateFemaleTitles); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/PhoneNumberTest.php new file mode 100644 index 0000000..37b781b --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/en_ZA/PhoneNumberTest.php @@ -0,0 +1,66 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumber() + { + for ($i = 0; $i < 10; $i++) { + $number = $this->faker->phoneNumber; + + $digits = array_values(array_filter(str_split($number), 'ctype_digit')); + + // 10 digits + if($digits[0] = 2 && $digits[1] == 7) { + $this->assertLessThanOrEqual(11, count($digits)); + } else { + $this->assertGreaterThanOrEqual(10, count($digits)); + } + } + } + + public function testTollFreePhoneNumber() + { + for ($i = 0; $i < 10; $i++) { + $number = $this->faker->tollFreeNumber; + $digits = array_values(array_filter(str_split($number), 'ctype_digit')); + + if (count($digits) === 11) { + $this->assertEquals('0', $digits[0]); + } + + $areaCode = $digits[0] . $digits[1] . $digits[2] . $digits[3]; + $this->assertContains($areaCode, array('0800', '0860', '0861', '0862')); + } + } + + public function testCellPhoneNumber() + { + for ($i = 0; $i < 10; $i++) { + $number = $this->faker->mobileNumber; + $digits = array_values(array_filter(str_split($number), 'ctype_digit')); + + if($digits[0] = 2 && $digits[1] == 7) { + $this->assertLessThanOrEqual(11, count($digits)); + } else { + $this->assertGreaterThanOrEqual(10, count($digits)); + } + + $this->assertRegExp('/^(\+27|27)?(\()?0?([6][0-4]|[7][1-9]|[8][1-9])(\))?( |-|\.|_)?(\d{3})( |-|\.|_)?(\d{4})/', $number); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/PaymentTest.php new file mode 100644 index 0000000..e636544 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/PaymentTest.php @@ -0,0 +1,61 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testVAT() + { + $vat = $this->faker->vat(); + + $this->assertTrue($this->isValidCIF($vat)); + } + + /** + * Validation taken from https://github.com/amnesty/drupal-nif-nie-cif-validator/ + * @link https://github.com/amnesty/drupal-nif-nie-cif-validator/blob/master/includes/nif-nie-cif.php + */ + function isValidCIF($docNumber) + { + $fixedDocNumber = strtoupper($docNumber); + + return $this->isValidCIFFormat($fixedDocNumber); + } + + function isValidCIFFormat($docNumber) + { + return $this->respectsDocPattern($docNumber, '/^[PQSNWR][0-9][0-9][0-9][0-9][0-9][0-9][0-9][A-Z0-9]/') + || + $this->respectsDocPattern($docNumber, '/^[ABCDEFGHJUV][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/'); + } + + function respectsDocPattern($givenString, $pattern) + { + $isValid = FALSE; + $fixedString = strtoupper($givenString); + if (is_int(substr($fixedString, 0, 1))) { + $fixedString = substr("000000000" . $givenString, -9); + } + if (preg_match($pattern, $fixedString)) { + $isValid = TRUE; + } + return $isValid; + } + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/PersonTest.php new file mode 100644 index 0000000..e29f3f9 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/PersonTest.php @@ -0,0 +1,46 @@ +seed(1); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testDNI() + { + $dni = $this->faker->dni; + $this->assertTrue($this->isValidDNI($dni)); + } + + // validation taken from http://kiwwito.com/php-function-for-spanish-dni-nie-validation/ + public function isValidDNI($string) + { + if (strlen($string) != 9 || + preg_match('/^[XYZ]?([0-9]{7,8})([A-Z])$/i', $string, $matches) !== 1) { + return false; + } + + $map = 'TRWAGMYFPDXBNJZSQVHLCKE'; + + list(, $number, $letter) = $matches; + + return strtoupper($letter) === $map[((int) $number) % 23]; + } + + public function testLicenceCode() + { + $validLicenceCodes = array('AM', 'A1', 'A2', 'A','B', 'B+E', 'C1', 'C1+E', 'C', 'C+E', 'D1', 'D1+E', 'D', 'D+E'); + + $this->assertContains($this->faker->licenceCode, $validLicenceCodes); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/TextTest.php new file mode 100644 index 0000000..a8ae348 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/es_ES/TextTest.php @@ -0,0 +1,27 @@ +addProvider(new Text($faker)); + $this->faker = $faker; + } + + public function testText() + { + $this->assertNotSame('', $this->faker->realtext(200, 2)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/es_PE/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/es_PE/PersonTest.php new file mode 100644 index 0000000..6014938 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/es_PE/PersonTest.php @@ -0,0 +1,29 @@ +seed(1); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testDNI() + { + $dni = $this->faker->dni; + $this->assertRegExp('/\A[0-9]{8}\Z/', $dni); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/es_VE/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/es_VE/CompanyTest.php new file mode 100644 index 0000000..3c9b162 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/es_VE/CompanyTest.php @@ -0,0 +1,43 @@ + for Faker + * Date: 01/09/2017 + * Time: 09:45 PM + */ + +namespace Faker\Test\Provider\es_VE; + +use Faker\Generator; +use Faker\Provider\es_VE\Company; +use PHPUnit\Framework\TestCase; + +class CompanyTest extends TestCase +{ + /** + * @var Generator + */ + private $faker; + + public function setUp() + { + $faker = new Generator(); + $faker->seed(1); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + /** + * national Id format validator + */ + public function testNationalId() + { + $pattern = '/^[VJGECP]-?\d{8}-?\d$/'; + $rif = $this->faker->taxpayerIdentificationNumber; + $this->assertRegExp($pattern, $rif); + + $rif = $this->faker->taxpayerIdentificationNumber('-'); + $this->assertRegExp($pattern, $rif); + } + + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/es_VE/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/es_VE/PersonTest.php new file mode 100644 index 0000000..bb42cd7 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/es_VE/PersonTest.php @@ -0,0 +1,43 @@ +seed(1); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + /** + * national Id format validator + */ + public function testNationalId() + { + $pattern = '/(?:^V-?\d{5,9}$)|(?:^E-?\d{8,9}$)/'; + + $cedula = $this->faker->nationalId; + $this->assertRegExp($pattern, $cedula); + + $cedula = $this->faker->nationalId('-'); + $this->assertRegExp($pattern, $cedula); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fi_FI/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fi_FI/InternetTest.php new file mode 100644 index 0000000..6009bbd --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fi_FI/InternetTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fi_FI/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fi_FI/PersonTest.php new file mode 100644 index 0000000..b979666 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fi_FI/PersonTest.php @@ -0,0 +1,82 @@ +addProvider(new DateTime($faker)); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function provideSeedAndExpectedReturn() + { + return array( + array(1, '1800-01-01', '010100+5207'), + array(2, '1930-08-08', '080830-508R'), + array(3, '1999-12-31', '311299-409D'), + array(4, '2000-01-01', '010100A039P'), + array(5, '2015-06-17', '170615A690X') + ); + } + + /** + * @dataProvider provideSeedAndExpectedReturn + */ + public function testPersonalIdentityNumberUsesBirthDateIfProvided($seed, $birthdate, $expected) + { + $faker = $this->faker; + $faker->seed($seed); + $pin = $faker->personalIdentityNumber(\DateTime::createFromFormat('Y-m-d', $birthdate)); + $this->assertEquals($expected, $pin); + } + + public function testPersonalIdentityNumberGeneratesCompliantNumbers() + { + if (strtotime('1800-01-01 00:00:00')) { + $min="1900"; + $max="2099"; + for ($i = 0; $i < 10; $i++) { + $birthdate = $this->faker->dateTimeBetween('1800-01-01 00:00:00', '1899-12-31 23:59:59'); + $pin = $this->faker->personalIdentityNumber($birthdate, NULL, true); + $this->assertRegExp('/^[0-9]{6}\+[0-9]{3}[0-9ABCDEFHJKLMNPRSTUVWXY]$/', $pin); + } + } else { // timestamp limit for 32-bit computer + $min="1902"; + $max="2037"; + } + for ($i = 0; $i < 10; $i++) { + $birthdate = $this->faker->dateTimeBetween("$min-01-01 00:00:00", '1999-12-31 23:59:59'); + $pin = $this->faker->personalIdentityNumber($birthdate); + $this->assertRegExp('/^[0-9]{6}-[0-9]{3}[0-9ABCDEFHJKLMNPRSTUVWXY]$/', $pin); + } + for ($i = 0; $i < 10; $i++) { + $birthdate = $this->faker->dateTimeBetween('2000-01-01 00:00:00', "$max-12-31 23:59:59"); + $pin = $this->faker->personalIdentityNumber($birthdate); + $this->assertRegExp('/^[0-9]{6}A[0-9]{3}[0-9ABCDEFHJKLMNPRSTUVWXY]$/', $pin); + } + } + + public function testPersonalIdentityNumberGeneratesOddValuesForMales() + { + $pin = $this->faker->personalIdentityNumber(null, 'male'); + $this->assertEquals(1, $pin{9} % 2); + } + + public function testPersonalIdentityNumberGeneratesEvenValuesForFemales() + { + $pin = $this->faker->personalIdentityNumber(null, 'female'); + $this->assertEquals(0, $pin{9} % 2); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_BE/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_BE/PaymentTest.php new file mode 100644 index 0000000..6944c55 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_BE/PaymentTest.php @@ -0,0 +1,30 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testVatIsValid() + { + $vat = $this->faker->vat(); + $unspacedVat = $this->faker->vat(false); + $this->assertRegExp('/^(BE 0\d{9})$/', $vat); + $this->assertRegExp('/^(BE0\d{9})$/', $unspacedVat); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/AddressTest.php new file mode 100644 index 0000000..217ac9f --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/AddressTest.php @@ -0,0 +1,70 @@ +addProvider(new Address($faker)); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function canton () + { + $canton = $this->faker->canton(); + $this->assertInternalType('array', $canton); + $this->assertCount(1, $canton); + + foreach ($canton as $cantonShort => $cantonName){ + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + } + + /** + * @test + */ + public function cantonName () + { + $cantonName = $this->faker->cantonName(); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + + /** + * @test + */ + public function cantonShort () + { + $cantonShort = $this->faker->cantonShort(); + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + } + + /** + * @test + */ + public function address (){ + $address = $this->faker->address(); + $this->assertInternalType('string', $address); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/InternetTest.php new file mode 100644 index 0000000..f4e9484 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/InternetTest.php @@ -0,0 +1,36 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function emailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/PhoneNumberTest.php new file mode 100644 index 0000000..7bfcca7 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_CH/PhoneNumberTest.php @@ -0,0 +1,33 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumber() + { + $this->assertRegExp('/^0\d{2} ?\d{3} ?\d{2} ?\d{2}|\+41 ?(\(0\))?\d{2} ?\d{3} ?\d{2} ?\d{2}$/', $this->faker->phoneNumber()); + } + + public function testMobileNumber() + { + $this->assertRegExp('/^07[56789] ?\d{3} ?\d{2} ?\d{2}$/', $this->faker->mobileNumber()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/AddressTest.php new file mode 100644 index 0000000..50b40f4 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/AddressTest.php @@ -0,0 +1,33 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function testSecondaryAddress() + { + $secondaryAdress = $this->faker->secondaryAddress(); + $this->assertNotEmpty($secondaryAdress); + $this->assertInternalType('string', $secondaryAdress); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/CompanyTest.php new file mode 100644 index 0000000..83e54d9 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/CompanyTest.php @@ -0,0 +1,75 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testSiretReturnsAValidSiret() + { + $siret = $this->faker->siret(false); + $this->assertRegExp("/^\d{14}$/", $siret); + $this->assertTrue(Luhn::isValid($siret)); + } + + public function testSiretReturnsAWellFormattedSiret() + { + $siret = $this->faker->siret(); + $this->assertRegExp("/^\d{3}\s\d{3}\s\d{3}\s\d{5}$/", $siret); + $siret = str_replace(' ', '', $siret); + $this->assertTrue(Luhn::isValid($siret)); + } + + public function testSirenReturnsAValidSiren() + { + $siren = $this->faker->siren(false); + $this->assertRegExp("/^\d{9}$/", $siren); + $this->assertTrue(Luhn::isValid($siren)); + } + + public function testSirenReturnsAWellFormattedSiren() + { + $siren = $this->faker->siren(); + $this->assertRegExp("/^\d{3}\s\d{3}\s\d{3}$/", $siren); + $siren = str_replace(' ', '', $siren); + $this->assertTrue(Luhn::isValid($siren)); + } + + public function testCatchPhraseReturnsValidCatchPhrase() + { + $this->assertTrue(TestableCompany::isCatchPhraseValid($this->faker->catchPhrase())); + } + + public function testIsCatchPhraseValidReturnsFalseWhenAWordsAppearsTwice() + { + $isCatchPhraseValid = TestableCompany::isCatchPhraseValid('La sécurité de rouler en toute sécurité'); + $this->assertFalse($isCatchPhraseValid); + } + + public function testIsCatchPhraseValidReturnsTrueWhenNoWordAppearsTwice() + { + $isCatchPhraseValid = TestableCompany::isCatchPhraseValid('La sécurité de rouler en toute simplicité'); + $this->assertTrue($isCatchPhraseValid); + } +} + +class TestableCompany extends Company +{ + public static function isCatchPhraseValid($catchPhrase) + { + return parent::isCatchPhraseValid($catchPhrase); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PaymentTest.php new file mode 100644 index 0000000..d00a7c8 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PaymentTest.php @@ -0,0 +1,49 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testFormattedVat() + { + $vat = $this->faker->vat(true); + $this->assertRegExp("/^FR\s\w{2}\s\d{3}\s\d{3}\s\d{3}$/", $vat); + + $vat = str_replace(' ', '', $vat); + $siren = substr($vat, 4, 12); + $this->assertTrue(Luhn::isValid($siren)); + + $key = (int) substr($siren, 2, 2); + if ($key === 0) { + $this->assertEqual($key, (12 + 3 * ($siren % 97)) % 97); + } + } + + public function testUnformattedVat() + { + $vat = $this->faker->vat(false); + $this->assertRegExp("/^FR\w{2}\d{9}$/", $vat); + + $siren = substr($vat, 4, 12); + $this->assertTrue(Luhn::isValid($siren)); + + $key = (int) substr($siren, 2, 2); + if ($key === 0) { + $this->assertEqual($key, (12 + 3 * ($siren % 97)) % 97); + } + } +} \ No newline at end of file diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PersonTest.php new file mode 100644 index 0000000..8c5fc65 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PersonTest.php @@ -0,0 +1,37 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testNIRReturnsTheRightGender() + { + $nir = $this->faker->nir(\Faker\Provider\Person::GENDER_MALE); + $this->assertStringStartsWith('1', $nir); + } + + public function testNIRReturnsTheRightPattern() + { + $nir = $this->faker->nir; + $this->assertRegExp("/^[12]\d{5}[0-9A-B]\d{8}$/", $nir); + } + + public function testNIRFormattedReturnsTheRightPattern() + { + $nir = $this->faker->nir(null, true); + $this->assertRegExp("/^[12]\s\d{2}\s\d{2}\s\d{1}[0-9A-B]\s\d{3}\s\d{3}\s\d{2}$/", $nir); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PhoneNumberTest.php new file mode 100644 index 0000000..d417970 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PhoneNumberTest.php @@ -0,0 +1,57 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testMobileNumber() + { + $mobileNumber = $this->faker->mobileNumber(); + $this->assertRegExp('/^(\+33 |\+33 \(0\)|0)(6|7)(?:(\s{1})?\d{2}){4}$/', $mobileNumber); + } + + public function testMobileNumber07Format() + { + $mobileNumberFormat = $this->faker->phoneNumber07(); + $this->assertRegExp('/^([3-9]{1})\d(\d{2}){3}$/', $mobileNumberFormat); + } + + public function testMobileNumber07WithSeparatorFormat() + { + $mobileNumberFormat = $this->faker->phoneNumber07WithSeparator(); + $this->assertRegExp('/^([3-9]{1})\d( \d{2}){3}$/', $mobileNumberFormat); + } + + public function testServiceNumber() + { + $serviceNumber = $this->faker->serviceNumber(); + $this->assertRegExp('/^(\+33 |\+33 \(0\)|0)8(?:(\s{1})?\d{2}){4}$/', $serviceNumber); + } + + public function testServiceNumberFormat() + { + $serviceNumberFormat = $this->faker->phoneNumber08(); + $this->assertRegExp('/^((0|1|2)\d{1}|9[^46])\d{6}$/', $serviceNumberFormat); + } + + public function testServiceNumberWithSeparatorFormat() + { + $serviceNumberFormat = $this->faker->phoneNumber08WithSeparator(); + $this->assertRegExp('/^((0|1|2)\d{1}|9[^46])( \d{2}){3}$/', $serviceNumberFormat); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/TextTest.php new file mode 100644 index 0000000..c9c7a4f --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/TextTest.php @@ -0,0 +1,57 @@ +textClass = new \ReflectionClass('Faker\Provider\fr_FR\Text'); + } + + protected function getMethod($name) { + $method = $this->textClass->getMethod($name); + + $method->setAccessible(true); + + return $method; + } + + /** @test */ + function testItShouldAppendEndPunctToTheEndOfString() + { + $this->assertSame( + 'Que faisaient-elles maintenant? À.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Que faisaient-elles maintenant? À ')) + ); + + $this->assertSame( + 'Que faisaient-elles maintenant? À.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Que faisaient-elles maintenant? À— ')) + ); + + $this->assertSame( + 'Que faisaient-elles maintenant? À.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Que faisaient-elles maintenant? À,')) + ); + + $this->assertSame( + 'Que faisaient-elles maintenant? À!.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Que faisaient-elles maintenant? À! ')) + ); + + $this->assertSame( + 'Que faisaient-elles maintenant? À.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Que faisaient-elles maintenant? À: ')) + ); + + $this->assertSame( + 'Que faisaient-elles maintenant? À.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Que faisaient-elles maintenant? À; ')) + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/id_ID/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/id_ID/PersonTest.php new file mode 100644 index 0000000..5ebfeee --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/id_ID/PersonTest.php @@ -0,0 +1,41 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testIfFirstNameMaleCanReturnData() + { + $firstNameMale = $this->faker->firstNameMale(); + $this->assertNotEmpty($firstNameMale); + } + + public function testIfLastNameMaleCanReturnData() + { + $lastNameMale = $this->faker->lastNameMale(); + $this->assertNotEmpty($lastNameMale); + } + + public function testIfFirstNameFemaleCanReturnData() + { + $firstNameFemale = $this->faker->firstNameFemale(); + $this->assertNotEmpty($firstNameFemale); + } + + public function testIfLastNameFemaleCanReturnData() + { + $lastNameFemale = $this->faker->lastNameFemale(); + $this->assertNotEmpty($lastNameFemale); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/AddressTest.php new file mode 100644 index 0000000..0f0df5e --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/AddressTest.php @@ -0,0 +1,70 @@ +addProvider(new Address($faker)); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function canton () + { + $canton = $this->faker->canton(); + $this->assertInternalType('array', $canton); + $this->assertCount(1, $canton); + + foreach ($canton as $cantonShort => $cantonName){ + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + } + + /** + * @test + */ + public function cantonName () + { + $cantonName = $this->faker->cantonName(); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + + /** + * @test + */ + public function cantonShort () + { + $cantonShort = $this->faker->cantonShort(); + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + } + + /** + * @test + */ + public function address (){ + $address = $this->faker->address(); + $this->assertInternalType('string', $address); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/InternetTest.php new file mode 100644 index 0000000..d46f6b7 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/InternetTest.php @@ -0,0 +1,36 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function emailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/PhoneNumberTest.php new file mode 100644 index 0000000..5cda534 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/it_CH/PhoneNumberTest.php @@ -0,0 +1,33 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumber() + { + $this->assertRegExp('/^0\d{2} ?\d{3} ?\d{2} ?\d{2}|\+41 ?(\(0\))?\d{2} ?\d{3} ?\d{2} ?\d{2}$/', $this->faker->phoneNumber()); + } + + public function testMobileNumber() + { + $this->assertRegExp('/^07[56789] ?\d{3} ?\d{2} ?\d{2}$/', $this->faker->mobileNumber()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/it_IT/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/it_IT/CompanyTest.php new file mode 100644 index 0000000..33977e1 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/it_IT/CompanyTest.php @@ -0,0 +1,24 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testIfTaxIdCanReturnData() + { + $vatId = $this->faker->vatId(); + $this->assertRegExp('/^IT[0-9]{11}$/', $vatId); + } + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/it_IT/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/it_IT/PersonTest.php new file mode 100644 index 0000000..3e7b1a4 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/it_IT/PersonTest.php @@ -0,0 +1,24 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testIfTaxIdCanReturnData() + { + $taxId = $this->faker->taxId(); + $this->assertRegExp('/^[a-zA-Z]{6}[0-9]{2}[a-zA-Z][0-9]{2}[a-zA-Z][0-9]{3}[a-zA-Z]$/', $taxId); + } + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/InternetTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/InternetTest.php new file mode 100644 index 0000000..b4a19fd --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/InternetTest.php @@ -0,0 +1,28 @@ +addProvider(new Internet($faker)); + $faker->seed(1); + + $this->assertEquals('akira72', $faker->userName); + } + + public function testDomainName() + { + $faker = new Generator(); + $faker->addProvider(new Internet($faker)); + $faker->seed(1); + + $this->assertEquals('nakajima.com', $faker->domainName); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/PersonTest.php new file mode 100644 index 0000000..e785482 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/PersonTest.php @@ -0,0 +1,55 @@ +addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('アオタ ミノル', $faker->kanaName('male')); + } + + public function testKanaNameFemaleReturns() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('アオタ ミキ', $faker->kanaName('female')); + } + + public function testFirstKanaNameMaleReturns() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('ヒデキ', $faker->firstKanaName('male')); + } + + public function testFirstKanaNameFemaleReturns() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('マアヤ', $faker->firstKanaName('female')); + } + + public function testLastKanaNameReturnsNakajima() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('ナカジマ', $faker->lastKanaName); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/PhoneNumberTest.php new file mode 100644 index 0000000..158718a --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ja_JP/PhoneNumberTest.php @@ -0,0 +1,22 @@ +addProvider(new PhoneNumber($faker)); + + for ($i = 0; $i < 10; $i++) { + $phoneNumber = $faker->phoneNumber; + $this->assertNotEmpty($phoneNumber); + $this->assertRegExp('/^0\d{1,4}-\d{1,4}-\d{3,4}$/', $phoneNumber); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ka_GE/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ka_GE/TextTest.php new file mode 100644 index 0000000..0201cee --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ka_GE/TextTest.php @@ -0,0 +1,57 @@ +textClass = new \ReflectionClass('Faker\Provider\el_GR\Text'); + } + + protected function getMethod($name) { + $method = $this->textClass->getMethod($name); + + $method->setAccessible(true); + + return $method; + } + + /** @test */ + function testItShouldAppendEndPunctToTheEndOfString() + { + $this->assertSame( + 'ჭეშმáƒáƒ áƒ˜áƒ¢áƒ˜áƒ. ჩვენც ისე.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ჭეშმáƒáƒ áƒ˜áƒ¢áƒ˜áƒ. ჩვენც ისე ')) + ); + + $this->assertSame( + 'ჭეშმáƒáƒ áƒ˜áƒ¢áƒ˜áƒ. ჩვენც ისე.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ჭეშმáƒáƒ áƒ˜áƒ¢áƒ˜áƒ. ჩვენც ისე— ')) + ); + + $this->assertSame( + 'ჭეშმáƒáƒ áƒ˜áƒ¢áƒ˜áƒ. ჩვენც ისე.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ჭეშმáƒáƒ áƒ˜áƒ¢áƒ˜áƒ. ჩვენც ისე, ')) + ); + + $this->assertSame( + 'ჭეშმáƒáƒ áƒ˜áƒ¢áƒ˜áƒ. ჩვენც ისე!.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ჭეშმáƒáƒ áƒ˜áƒ¢áƒ˜áƒ. ჩვენც ისე! ')) + ); + + $this->assertSame( + 'ჭეშმáƒáƒ áƒ˜áƒ¢áƒ˜áƒ. ჩვენც ისე.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ჭეშმáƒáƒ áƒ˜áƒ¢áƒ˜áƒ. ჩვენც ისე; ')) + ); + + $this->assertSame( + 'ჭეშმáƒáƒ áƒ˜áƒ¢áƒ˜áƒ. ჩვენც ისე.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ჭეშმáƒáƒ áƒ˜áƒ¢áƒ˜áƒ. ჩვენც ისე: ')) + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/CompanyTest.php new file mode 100644 index 0000000..b6a3c06 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/CompanyTest.php @@ -0,0 +1,32 @@ +faker = new Generator(); + + $this->faker->addProvider(new Company($this->faker)); + } + + public function testBusinessIdentificationNumberIsValid() + { + $registrationDate = new \DateTime('now'); + $businessIdentificationNumber = $this->faker->businessIdentificationNumber($registrationDate); + $registrationDateAsString = $registrationDate->format('ym'); + + $this->assertRegExp( + "/^(" . $registrationDateAsString . ")([4-6]{1})([0-3]{1})(\\d{6})$/", + $businessIdentificationNumber + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/PersonTest.php new file mode 100644 index 0000000..c565735 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/PersonTest.php @@ -0,0 +1,30 @@ +faker = new Generator(); + + $this->faker->addProvider(new Person($this->faker)); + } + + public function testIndividualIdentificationNumberIsValid() + { + $birthDate = DateTime::dateTimeBetween('-30 years', '-10 years'); + $individualIdentificationNumber = $this->faker->individualIdentificationNumber($birthDate); + $controlDigit = Person::checkSum($individualIdentificationNumber); + + $this->assertSame($controlDigit, (int)substr($individualIdentificationNumber, 11, 1)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/TextTest.php new file mode 100644 index 0000000..2c78050 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/kk_KZ/TextTest.php @@ -0,0 +1,57 @@ +textClass = new \ReflectionClass('Faker\Provider\kk_KZ\Text'); + } + + protected function getMethod($name) { + $method = $this->textClass->getMethod($name); + + $method->setAccessible(true); + + return $method; + } + + /** @test */ + function testItShouldAppendEndPunctToTheEndOfString() + { + $this->assertSame( + 'ÐрыÑтан баб кеÑенеÑÑ– - көне Отырар.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ÐрыÑтан баб кеÑенеÑÑ– - көне Отырар ')) + ); + + $this->assertSame( + 'ÐрыÑтан баб кеÑенеÑÑ– - көне Отырар.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ÐрыÑтан баб кеÑенеÑÑ– - көне Отырар— ')) + ); + + $this->assertSame( + 'ÐрыÑтан баб кеÑенеÑÑ– - көне Отырар.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ÐрыÑтан баб кеÑенеÑÑ– - көне Отырар, ')) + ); + + $this->assertSame( + 'ÐрыÑтан баб кеÑенеÑÑ– - көне Отырар!.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ÐрыÑтан баб кеÑенеÑÑ– - көне Отырар! ')) + ); + + $this->assertSame( + 'ÐрыÑтан баб кеÑенеÑÑ– - көне Отырар.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ÐрыÑтан баб кеÑенеÑÑ– - көне Отырар: ')) + ); + + $this->assertSame( + 'ÐрыÑтан баб кеÑенеÑÑ– - көне Отырар.', + $this->getMethod('appendEnd')->invokeArgs(null, array('ÐрыÑтан баб кеÑенеÑÑ– - көне Отырар; ')) + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ko_KR/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ko_KR/TextTest.php new file mode 100644 index 0000000..336acc8 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ko_KR/TextTest.php @@ -0,0 +1,57 @@ +textClass = new \ReflectionClass('Faker\Provider\el_GR\Text'); + } + + protected function getMethod($name) { + $method = $this->textClass->getMethod($name); + + $method->setAccessible(true); + + return $method; + } + + /** @test */ + function testItShouldAppendEndPunctToTheEndOfString() + { + $this->assertSame( + '최ì„(崔晳)으로부터 ìµœí›„ì˜ íŽ¸ì§€ê°€.', + $this->getMethod('appendEnd')->invokeArgs(null, array('최ì„(崔晳)으로부터 ìµœí›„ì˜ íŽ¸ì§€ê°€ ')) + ); + + $this->assertSame( + '최ì„(崔晳)으로부터 ìµœí›„ì˜ íŽ¸ì§€ê°€.', + $this->getMethod('appendEnd')->invokeArgs(null, array('최ì„(崔晳)으로부터 ìµœí›„ì˜ íŽ¸ì§€ê°€â€”')) + ); + + $this->assertSame( + '최ì„(崔晳)으로부터 ìµœí›„ì˜ íŽ¸ì§€ê°€.', + $this->getMethod('appendEnd')->invokeArgs(null, array('최ì„(崔晳)으로부터 ìµœí›„ì˜ íŽ¸ì§€ê°€,')) + ); + + $this->assertSame( + '최ì„(崔晳)으로부터 ìµœí›„ì˜ íŽ¸ì§€ê°€!.', + $this->getMethod('appendEnd')->invokeArgs(null, array('최ì„(崔晳)으로부터 ìµœí›„ì˜ íŽ¸ì§€ê°€! ')) + ); + + $this->assertSame( + '최ì„(崔晳)으로부터 ìµœí›„ì˜ íŽ¸ì§€ê°€.', + $this->getMethod('appendEnd')->invokeArgs(null, array('최ì„(崔晳)으로부터 ìµœí›„ì˜ íŽ¸ì§€ê°€: ')) + ); + + $this->assertSame( + '최ì„(崔晳)으로부터 ìµœí›„ì˜ íŽ¸ì§€ê°€.', + $this->getMethod('appendEnd')->invokeArgs(null, array('최ì„(崔晳)으로부터 ìµœí›„ì˜ íŽ¸ì§€ê°€; ')) + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/mn_MN/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/mn_MN/PersonTest.php new file mode 100644 index 0000000..232f8f4 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/mn_MN/PersonTest.php @@ -0,0 +1,28 @@ +addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertRegExp('/^[Ð-Я]{1}\.[\w\W]+$/u', $faker->name); + } + + public function testIdNumber() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(2); + + $this->assertRegExp('/^[Ð-Я]{2}\d{8}$/u', $faker->idNumber); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ms_MY/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ms_MY/PersonTest.php new file mode 100644 index 0000000..c35c698 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ms_MY/PersonTest.php @@ -0,0 +1,50 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + /** + * @link https://en.wikipedia.org/wiki/Malaysian_identity_card#Structure_of_the_National_Registration_Identity_Card_Number_(NRIC) + */ + public function testPersonalIdentityCardNumber() + { + $myKadNumber = $this->faker->myKadNumber; + + $yy = substr($myKadNumber, 0, 2); + //match any year from 00-99 + $this->assertRegExp("/^[0-9]{2}$/", $yy); + + $mm = substr($myKadNumber, 2, 2); + //match any month from 01-12 + $this->assertRegExp("/^0[1-9]|1[0-2]$/", $mm); + + $dd = substr($myKadNumber, 4, 2); + //match any date from 01-31 + $this->assertRegExp("/^0[1-9]|1[0-9]|2[0-9]|3[0-1]$/", $dd); + + $pb = substr($myKadNumber, 6, 2); + //match any valid place of birth code from 01-59 except 17-20 + $this->assertRegExp("/^(0[1-9]|1[0-6])|(2[1-9]|3[0-9]|4[0-9]|5[0-9])$/", $pb); + + $nnnn = substr($myKadNumber, 8, 4); + //match any number from 0000-9999 + $this->assertRegExp("/^[0-9]{4}$/", $nnnn); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/nl_BE/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/nl_BE/PaymentTest.php new file mode 100644 index 0000000..e844103 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/nl_BE/PaymentTest.php @@ -0,0 +1,30 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testVatIsValid() + { + $vat = $this->faker->vat(); + $unspacedVat = $this->faker->vat(false); + $this->assertRegExp('/^(BE 0\d{9})$/', $vat); + $this->assertRegExp('/^(BE0\d{9})$/', $unspacedVat); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/nl_BE/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/nl_BE/PersonTest.php new file mode 100644 index 0000000..4885cc3 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/nl_BE/PersonTest.php @@ -0,0 +1,54 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testRrnIsValid() + { + $rrn = $this->faker->rrn(); + + $this->assertEquals(11, strlen($rrn)); + + $ctrlNumber = substr($rrn, 9, 2); + $calcCtrl = 97 - (substr($rrn, 0, 9) % 97); + $altcalcCtrl = 97 - ((2 . substr($rrn, 0, 9)) % 97); + $this->assertContains($ctrlNumber, array($calcCtrl, $altcalcCtrl)); + + $middle = substr($rrn, 6, 3); + $this->assertGreaterThan(1, $middle); + $this->assertLessThan(997, $middle); + } + + public function testRrnIsMale() + { + $rrn = $this->faker->rrn('male'); + $this->assertEquals(substr($rrn, 6, 3) % 2, 1); + } + + public function testRrnIsFemale() + { + $rrn = $this->faker->rrn('female'); + $this->assertEquals(substr($rrn, 6, 3) % 2, 0); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/nl_NL/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/nl_NL/CompanyTest.php new file mode 100644 index 0000000..6d5484c --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/nl_NL/CompanyTest.php @@ -0,0 +1,35 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testGenerateValidVatNumber() + { + $vatNo = $this->faker->vat(); + + $this->assertEquals(14, strlen($vatNo)); + $this->assertRegExp('/^NL[0-9]{9}B[0-9]{2}$/', $vatNo); + } + + public function testGenerateValidBtwNumberAlias() + { + $btwNo = $this->faker->btw(); + + $this->assertEquals(14, strlen($btwNo)); + $this->assertRegExp('/^NL[0-9]{9}B[0-9]{2}$/', $btwNo); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/nl_NL/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/nl_NL/PersonTest.php new file mode 100644 index 0000000..c8735f5 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/nl_NL/PersonTest.php @@ -0,0 +1,33 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testGenerateValidIdNumber() + { + $idNumber = $this->faker->idNumber(); + $this->assertEquals(9, strlen($idNumber)); + + + $sum = -1 * $idNumber % 10; + for ($multiplier = 2; $idNumber > 0; $multiplier++) { + $val = ($idNumber /= 10) % 10; + $sum += $multiplier * $val; + } + $this->assertTrue($sum != 0 && $sum % 11 == 0); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/pl_PL/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/pl_PL/AddressTest.php new file mode 100644 index 0000000..bbfdf4d --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/pl_PL/AddressTest.php @@ -0,0 +1,32 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + /** + * Test the validity of state + */ + public function testState() + { + $state = $this->faker->state(); + $this->assertNotEmpty($state); + $this->assertInternalType('string', $state); + $this->assertRegExp('/[a-z]+/', $state); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/pl_PL/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/pl_PL/PersonTest.php new file mode 100644 index 0000000..e5e0edc --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/pl_PL/PersonTest.php @@ -0,0 +1,101 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testPeselLenght() + { + $pesel = $this->faker->pesel(); + + $this->assertEquals(11, strlen($pesel)); + } + + public function testPeselDate() + { + $date = new DateTime('1990-01-01'); + $pesel = $this->faker->pesel($date); + + $this->assertEquals('90', substr($pesel, 0, 2)); + $this->assertEquals('01', substr($pesel, 2, 2)); + $this->assertEquals('01', substr($pesel, 4, 2)); + } + + public function testPeselDateWithYearAfter2000() + { + $date = new DateTime('2001-01-01'); + $pesel = $this->faker->pesel($date); + + $this->assertEquals('01', substr($pesel, 0, 2)); + $this->assertEquals('21', substr($pesel, 2, 2)); + $this->assertEquals('01', substr($pesel, 4, 2)); + } + + public function testPeselDateWithYearAfter2100() + { + $date = new DateTime('2101-01-01'); + $pesel = $this->faker->pesel($date); + + $this->assertEquals('01', substr($pesel, 0, 2)); + $this->assertEquals('41', substr($pesel, 2, 2)); + $this->assertEquals('01', substr($pesel, 4, 2)); + } + + public function testPeselDateWithYearAfter2200() + { + $date = new DateTime('2201-01-01'); + $pesel = $this->faker->pesel($date); + + $this->assertEquals('01', substr($pesel, 0, 2)); + $this->assertEquals('61', substr($pesel, 2, 2)); + $this->assertEquals('01', substr($pesel, 4, 2)); + } + + public function testPeselDateWithYearBefore1900() + { + $date = new DateTime('1801-01-01'); + $pesel = $this->faker->pesel($date); + + $this->assertEquals('01', substr($pesel, 0, 2)); + $this->assertEquals('81', substr($pesel, 2, 2)); + $this->assertEquals('01', substr($pesel, 4, 2)); + } + + public function testPeselSex() + { + $male = $this->faker->pesel(null, 'M'); + $female = $this->faker->pesel(null, 'F'); + + $this->assertEquals(1, $male[9] % 2); + $this->assertEquals(0, $female[9] % 2); + } + + public function testPeselCheckSum() + { + $pesel = $this->faker->pesel(); + $weights = array(1, 3, 7, 9, 1, 3, 7, 9, 1, 3, 1); + $sum = 0; + + foreach ($weights as $key => $weight) { + $sum += $pesel[$key] * $weight; + } + + $this->assertEquals(0, $sum % 10); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/pt_BR/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/pt_BR/CompanyTest.php new file mode 100644 index 0000000..b0feeca --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/pt_BR/CompanyTest.php @@ -0,0 +1,26 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testCnpjFormatIsValid() + { + $cnpj = $this->faker->cnpj(false); + $this->assertRegExp('/\d{8}\d{4}\d{2}/', $cnpj); + $cnpj = $this->faker->cnpj(true); + $this->assertRegExp('/\d{2}\.\d{3}\.\d{3}\/\d{4}-\d{2}/', $cnpj); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/pt_BR/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/pt_BR/PersonTest.php new file mode 100644 index 0000000..0b8318d --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/pt_BR/PersonTest.php @@ -0,0 +1,34 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testCpfFormatIsValid() + { + $cpf = $this->faker->cpf(false); + $this->assertRegExp('/\d{9}\d{2}/', $cpf); + $cpf = $this->faker->cpf(true); + $this->assertRegExp('/\d{3}\.\d{3}\.\d{3}-\d{2}/', $cpf); + } + + public function testRgFormatIsValid() + { + $rg = $this->faker->rg(false); + $this->assertRegExp('/\d{8}\d/', $rg); + $rg = $this->faker->rg(true); + $this->assertRegExp('/\d{2}\.\d{3}\.\d{3}-[0-9X]/', $rg); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/AddressTest.php new file mode 100644 index 0000000..3783fd5 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/AddressTest.php @@ -0,0 +1,40 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + public function testPostCodeIsValid() + { + $main = '[1-9]{1}[0-9]{2}[0,1,4,5,9]{1}'; + $pattern = "/^($main)|($main-[0-9]{3})+$/"; + $postcode = $this->faker->postcode(); + $this->assertSame(preg_match($pattern, $postcode), 1, $postcode); + } + + public function testAddressIsSingleLine() + { + $this->faker->addProvider(new Person($this->faker)); + + $address = $this->faker->address(); + $this->assertFalse(strstr($address, "\n")); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/PersonTest.php new file mode 100644 index 0000000..662f12a --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/PersonTest.php @@ -0,0 +1,53 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testTaxpayerIdentificationNumberIsValid() + { + $tin = $this->faker->taxpayerIdentificationNumber(); + $this->assertTrue($this->isValidTin($tin), $tin); + } + + /** + * + * @link http://pt.wikipedia.org/wiki/N%C3%BAmero_de_identifica%C3%A7%C3%A3o_fiscal + * + * @param type $tin + * + * @return boolean + */ + public static function isValidTin($tin) + { + $regex = '(([1,2,3,5,6,8]{1}[0-9]{8})|((45)|(70)|(71)|(72)|(77)|(79)|(90|(98|(99))))[0-9]{7})'; + if (is_null($tin) || !is_numeric($tin) || !strlen($tin) == 9 || preg_match("/$regex/", $tin) !== 1) { + return false; + } + $n = str_split($tin); + // cd - Control Digit + $cd = ($n[0] * 9 + $n[1] * 8 + $n[2] * 7 + $n[3] * 6 + $n[4] * 5 + $n[5] * 4 + $n[6] * 3 + $n[7] * 2) % 11; + if ($cd === 0 || $cd === 1) { + $cd = 0; + } else { + $cd = 11 - $cd; + } + if ($cd === intval($n[8])) { + return true; + } + + return false; + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/PhoneNumberTest.php new file mode 100644 index 0000000..fd5d319 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/pt_PT/PhoneNumberTest.php @@ -0,0 +1,26 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumberReturnsPhoneNumberWithOrWithoutPrefix() + { + $this->assertRegExp('/^(9[1,2,3,6][0-9]{7})|(2[0-9]{8})|(\+351 [2][0-9]{8})|(\+351 9[1,2,3,6][0-9]{7})/', $this->faker->phoneNumber()); + } + public function testMobileNumberReturnsMobileNumberWithOrWithoutPrefix() + { + $this->assertRegExp('/^(9[1,2,3,6][0-9]{7})/', $this->faker->mobileNumber()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ro_RO/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ro_RO/PersonTest.php new file mode 100644 index 0000000..f4743de --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ro_RO/PersonTest.php @@ -0,0 +1,252 @@ +addProvider(new DateTime($faker)); + $faker->addProvider(new Person($faker)); + $faker->setDefaultTimezone('Europe/Bucharest'); + $this->faker = $faker; + } + + public function tearDown() + { + $this->faker->setDefaultTimezone(); + } + + public function invalidGenderProvider() + { + return array( + array('elf'), + array('ent'), + array('fmle'), + array('mal'), + ); + } + + public function invalidYearProvider() + { + return array( + array(1652), + array(1799), + array(2100), + array(2252), + ); + } + + public function validYearProvider() + { + return array( + array(null), + array(''), + array(1800), + array(1850), + array(1900), + array(1990), + array(2000), + array(2099), + ); + } + + public function validCountyCodeProvider() + { + return array( + array('AB'), array('AR'), array('AG'), array('B'), array('BC'), array('BH'), array('BN'), array('BT'), + array('BV'), array('BR'), array('BZ'), array('CS'), array('CL'), array('CJ'), array('CT'), array('CV'), + array('DB'), array('DJ'), array('GL'), array('GR'), array('GJ'), array('HR'), array('HD'), array('IL'), + array('IS'), array('IF'), array('MM'), array('MH'), array('MS'), array('NT'), array('OT'), array('PH'), + array('SM'), array('SJ'), array('SB'), array('SV'), array('TR'), array('TM'), array('TL'), array('VS'), + array('VL'), array('VN'), array('B1'), array('B2'), array('B3'), array('B4'), array('B5'), array('B6') + ); + } + + public function invalidCountyCodeProvider() + { + return array( + array('JK'), array('REW'), array('x'), array('FF'), array('aaaddadaada') + ); + } + + public function validInputDataProvider() + { + return array( + array(Person::GENDER_MALE, '1981-06-16','B2', true, '181061642'), + array(Person::GENDER_FEMALE, '1981-06-16','B2', true, '281061642'), + array(Person::GENDER_MALE, '1981-06-16','B2', false, '981061642'), + array(Person::GENDER_FEMALE, '1981-06-16','B2', false, '981061642'), + ); + } + /** + * + */ + public function test_allRandom_returnsValidCnp() + { + $cnp = $this->faker->cnp; + $this->assertTrue( + $this->isValidCnp($cnp), + sprintf("Invalid CNP '%' generated", $cnp) + ); + } + + /** + * + */ + public function test_validGender_returnsValidCnp() + { + $cnp = $this->faker->cnp(Person::GENDER_MALE); + $this->assertTrue( + $this->isValidMaleCnp($cnp), + sprintf("Invalid CNP '%' generated for '%s' gender", $cnp, Person::GENDER_MALE) + ); + + $cnp = $this->faker->cnp(Person::GENDER_FEMALE); + $this->assertTrue( + $this->isValidFemaleCnp($cnp), + sprintf("Invalid CNP '%' generated for '%s' gender", $cnp, Person::GENDER_FEMALE) + ); + } + + /** + * @param string $value + * + * @dataProvider invalidGenderProvider + */ + public function test_invalidGender_throwsException($value) + { + $this->setExpectedException('InvalidArgumentException'); + $this->faker->cnp($value); + } + + /** + * @param string $value year of birth + * + * @dataProvider validYearProvider + */ + public function test_validYear_returnsValidCnp($value) + { + $cnp = $this->faker->cnp(null, $value); + $this->assertTrue( + $this->isValidCnp($cnp), + sprintf("Invalid CNP '%' generated for valid year '%s'", $cnp, $value) + ); + } + + /** + * @param string $value year of birth + * + * @dataProvider invalidYearProvider + */ + public function test_invalidYear_throwsException($value) + { + $this->setExpectedException('InvalidArgumentException'); + $this->faker->cnp(null, $value); + } + + /** + * @param $value + * @dataProvider validCountyCodeProvider + */ + public function test_validCountyCode_returnsValidCnp($value) + { + $cnp = $this->faker->cnp(null, null, $value); + $this->assertTrue( + $this->isValidCnp($cnp), + sprintf("Invalid CNP '%' generated for valid year '%s'", $cnp, $value) + ); + } + + /** + * @param $value + * @dataProvider invalidCountyCodeProvider + */ + public function test_invalidCountyCode_throwsException($value) + { + $this->setExpectedException('InvalidArgumentException'); + $this->faker->cnp(null, null, $value); + } + + /** + * + */ + public function test_nonResident_returnsValidCnp() + { + $cnp = $this->faker->cnp(null, null, null, false); + $this->assertTrue( + $this->isValidCnp($cnp), + sprintf("Invalid CNP '%' generated for non resident", $cnp) + ); + $this->assertStringStartsWith( + '9', + $cnp, + sprintf("Invalid CNP '%' generated for non resident (should start with 9)", $cnp) + ); + } + + /** + * + * @param $gender + * @param $dateOfBirth + * @param $county + * @param $isResident + * @param $expectedCnpStart + * + * @dataProvider validInputDataProvider + */ + public function test_validInputData_returnsValidCnp($gender, $dateOfBirth, $county, $isResident, $expectedCnpStart) + { + $cnp = $this->faker->cnp($gender, $dateOfBirth, $county, $isResident); + $this->assertStringStartsWith( + $expectedCnpStart, + $cnp, + sprintf("Invalid CNP '%' generated for non valid data", $cnp) + ); + } + + + protected function isValidFemaleCnp($value) + { + return $this->isValidCnp($value) && in_array($value[0], array(2, 4, 6, 8, 9)); + } + + protected function isValidMaleCnp($value) + { + return $this->isValidCnp($value) && in_array($value[0], array(1, 3, 5, 7, 9)); + } + + protected function isValidCnp($cnp) + { + if (preg_match(static::TEST_CNP_REGEX, $cnp) !== false) { + $checkNumber = 279146358279; + + $checksum = 0; + foreach (range(0, 11) as $digit) { + $checksum += (int)substr($cnp, $digit, 1) * (int)substr($checkNumber, $digit, 1); + } + $checksum = $checksum % 11; + $checksum = $checksum == 10 ? 1 : $checksum; + + if ($checksum == substr($cnp, -1)) { + return true; + } + } + + return false; + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ro_RO/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ro_RO/PhoneNumberTest.php new file mode 100644 index 0000000..b7965cd --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ro_RO/PhoneNumberTest.php @@ -0,0 +1,32 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumberReturnsNormalPhoneNumber() + { + $this->assertRegExp('/^0(?:[23][13-7]|7\d)\d{7}$/', $this->faker->phoneNumber()); + } + + public function testTollFreePhoneNumberReturnsTollFreePhoneNumber() + { + $this->assertRegExp('/^08(?:0[01267]|70)\d{6}$/', $this->faker->tollFreePhoneNumber()); + } + + public function testPremiumRatePhoneNumberReturnsPremiumRatePhoneNumber() + { + $this->assertRegExp('/^090[036]\d{6}$/', $this->faker->premiumRatePhoneNumber()); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ru_RU/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ru_RU/CompanyTest.php new file mode 100644 index 0000000..8fbcf26 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ru_RU/CompanyTest.php @@ -0,0 +1,37 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testINN() + { + $this->assertRegExp('/^[0-9]{10}$/', $this->faker->inn); + $this->assertEquals("77", substr($this->faker->inn("77"), 0, 2)); + $this->assertEquals("02", substr($this->faker->inn(2), 0, 2)); + } + + public function testKPP() + { + $this->assertRegExp('/^[0-9]{9}$/', $this->faker->kpp); + $this->assertEquals("01001", substr($this->faker->kpp, -5, 5)); + $inn = $this->faker->inn; + $this->assertEquals(substr($inn, 0, 4), substr($this->faker->kpp($inn), 0, 4)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/ru_RU/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/ru_RU/TextTest.php new file mode 100644 index 0000000..bbb0eae --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/ru_RU/TextTest.php @@ -0,0 +1,57 @@ +textClass = new \ReflectionClass('Faker\Provider\ru_RU\Text'); + } + + protected function getMethod($name) { + $method = $this->textClass->getMethod($name); + + $method->setAccessible(true); + + return $method; + } + + /** @test */ + function testItShouldAppendEndPunctToTheEndOfString() + { + $this->assertSame( + 'Ðа другой день Чичиков отправилÑÑ Ð½Ð° обед и вечер.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Ðа другой день Чичиков отправилÑÑ Ð½Ð° обед и вечер ')) + ); + + $this->assertSame( + 'Ðа другой день Чичиков отправилÑÑ Ð½Ð° обед и вечер.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Ðа другой день Чичиков отправилÑÑ Ð½Ð° обед и вечер—')) + ); + + $this->assertSame( + 'Ðа другой день Чичиков отправилÑÑ Ð½Ð° обед и вечер.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Ðа другой день Чичиков отправилÑÑ Ð½Ð° обед и вечер,')) + ); + + $this->assertSame( + 'Ðа другой день Чичиков отправилÑÑ Ð½Ð° обед и вечер!.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Ðа другой день Чичиков отправилÑÑ Ð½Ð° обед и вечер! ')) + ); + + $this->assertSame( + 'Ðа другой день Чичиков отправилÑÑ Ð½Ð° обед и вечер.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Ðа другой день Чичиков отправилÑÑ Ð½Ð° обед и вечер; ')) + ); + + $this->assertSame( + 'Ðа другой день Чичиков отправилÑÑ Ð½Ð° обед и вечер.', + $this->getMethod('appendEnd')->invokeArgs(null, array('Ðа другой день Чичиков отправилÑÑ Ð½Ð° обед и вечер: ')) + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/sv_SE/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/sv_SE/PersonTest.php new file mode 100644 index 0000000..584998d --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/sv_SE/PersonTest.php @@ -0,0 +1,61 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function provideSeedAndExpectedReturn() + { + return array( + array(1, '720727', '720727-5798'), + array(2, '710414', '710414-5664'), + array(3, '591012', '591012-4519'), + array(4, '180307', '180307-0356'), + array(5, '820904', '820904-7748') + ); + } + + /** + * @dataProvider provideSeedAndExpectedReturn + */ + public function testPersonalIdentityNumberUsesBirthDateIfProvided($seed, $birthdate, $expected) + { + $faker = $this->faker; + $faker->seed($seed); + $pin = $faker->personalIdentityNumber(\DateTime::createFromFormat('ymd', $birthdate)); + $this->assertEquals($expected, $pin); + } + + public function testPersonalIdentityNumberGeneratesLuhnCompliantNumbers() + { + $pin = str_replace('-', '', $this->faker->personalIdentityNumber()); + $this->assertTrue(Luhn::isValid($pin)); + } + + public function testPersonalIdentityNumberGeneratesOddValuesForMales() + { + $pin = $this->faker->personalIdentityNumber(null, 'male'); + $this->assertEquals(1, $pin{9} % 2); + } + + public function testPersonalIdentityNumberGeneratesEvenValuesForFemales() + { + $pin = $this->faker->personalIdentityNumber(null, 'female'); + $this->assertEquals(0, $pin{9} % 2); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/CompanyTest.php new file mode 100644 index 0000000..badf905 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/CompanyTest.php @@ -0,0 +1,28 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testCompany() + { + $company = $this->faker->companyField; + $this->assertNotNull($company); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PaymentTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PaymentTest.php new file mode 100644 index 0000000..7c8ffdb --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PaymentTest.php @@ -0,0 +1,29 @@ +addProvider(new Payment($faker)); + $this->faker = $faker; + } + + public function testBankAccountNumber() + { + $accNo = $this->faker->bankAccountNumber; + $this->assertEquals(substr($accNo, 0, 2), 'TR'); + $this->assertEquals(26, strlen($accNo)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PersonTest.php new file mode 100644 index 0000000..ad9db9c --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PersonTest.php @@ -0,0 +1,34 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + public function testTCNo() + { + for ($i = 0; $i < 100; $i++) { + $number = $this->faker->tcNo; + + $this->assertEquals(11, strlen($number)); + $this->assertTrue(TCNo::isValid($number)); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PhoneNumberTest.php new file mode 100644 index 0000000..0971d04 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/tr_TR/PhoneNumberTest.php @@ -0,0 +1,34 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumber() + { + for ($i = 0; $i < 100; $i++) { + $number = $this->faker->phoneNumber; + $baseNumber = preg_replace('/ *x.*$/', '', $number); // Remove possible extension + $digits = array_values(array_filter(str_split($baseNumber), 'ctype_digit')); + + $this->assertGreaterThan(10, count($digits)); + } + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/AddressTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/AddressTest.php new file mode 100644 index 0000000..4c4a061 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/AddressTest.php @@ -0,0 +1,81 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + public function testPostCodeIsValid() + { + $main = '[0-9]{5}'; + $pattern = "/^($main)|($main-[0-9]{3})+$/"; + $postcode = $this->faker->postcode; + $this->assertRegExp($pattern, $postcode, 'Post code ' . $postcode . ' is wrong!'); + } + + public function testEmptySuffixes() + { + $this->assertEmpty($this->faker->citySuffix, 'City suffix should be empty!'); + $this->assertEmpty($this->faker->streetSuffix, 'Street suffix should be empty!'); + } + + public function testStreetCyrOnly() + { + $pattern = "/[0-9Ð-ЩЯІЇЄЮа-щÑіїєюьIVXCM][0-9Ð-ЩЯІЇЄЮа-щÑіїєюь \'-.]*[Ð-Яа-Ñ.]/u"; + $streetName = $this->faker->streetName; + $this->assertSame( + preg_match($pattern, $streetName), + 1, + 'Street name ' . $streetName . ' is wrong!' + ); + } + + public function testCityNameCyrOnly() + { + $pattern = "/[Ð-ЩЯІЇЄЮа-щÑіїєюь][0-9Ð-ЩЯІЇЄЮа-щÑіїєюь \'-]*[Ð-Яа-Ñ]/u"; + $city = $this->faker->city; + $this->assertSame( + preg_match($pattern, $city), + 1, + 'City name ' . $city . ' is wrong!' + ); + } + + public function testRegionNameCyrOnly() + { + $pattern = "/[Ð-ЩЯІЇЄЮ][Ð-ЩЯІЇЄЮа-щÑіїєюь]*а$/u"; + $regionName = $this->faker->region; + $this->assertSame( + preg_match($pattern, $regionName), + 1, + 'Region name ' . $regionName . ' is wrong!' + ); + } + + public function testCountryCyrOnly() + { + $pattern = "/[Ð-ЩЯІЇЄЮа-щÑіїєюьIVXCM][Ð-ЩЯІЇЄЮа-щÑіїєюь \'-]*[Ð-Яа-Ñ.]/u"; + $country = $this->faker->country; + $this->assertSame( + preg_match($pattern, $country), + 1, + 'Country name ' . $country . ' is wrong!' + ); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/PersonTest.php new file mode 100644 index 0000000..a8d70f6 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/PersonTest.php @@ -0,0 +1,57 @@ +addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('МакÑим', $faker->firstNameMale()); + } + + public function testFirstNameFemaleReturns() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('Людмила', $faker->firstNameFemale()); + } + + public function testMiddleNameMaleReturns() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('Миколайович', $faker->middleNameMale()); + } + + public function testMiddleNameFemaleReturns() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('Миколаївна', $faker->middleNameFemale()); + } + + public function testLastNameReturns() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertEquals('Броваренко', $faker->lastName()); + } + + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/PhoneNumberTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/PhoneNumberTest.php new file mode 100644 index 0000000..f7f9f14 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/uk_UA/PhoneNumberTest.php @@ -0,0 +1,36 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + public function testPhoneNumberFormat() + { + $pattern = "/((\+38)(((\(\d{3}\))\d{7}|(\(\d{4}\))\d{6})|(\d{8})))|0\d{9}/"; + $phoneNumber = $this->faker->phoneNumber; + $this->assertSame( + preg_match($pattern, $phoneNumber), + 1, + 'Phone number format ' . $phoneNumber . ' is wrong!' + ); + + } + +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/CompanyTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/CompanyTest.php new file mode 100644 index 0000000..f2134b9 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/CompanyTest.php @@ -0,0 +1,27 @@ +addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testVAT() + { + $this->assertEquals(8, floor(log10($this->faker->VAT) + 1)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/PersonTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/PersonTest.php new file mode 100644 index 0000000..167d0fa --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/PersonTest.php @@ -0,0 +1,45 @@ +addProvider(new Person($faker)); + $this->faker = $faker; + } + + /** + * @see https://zh.wikipedia.org/wiki/%E4%B8%AD%E8%8F%AF%E6%B0%91%E5%9C%8B%E5%9C%8B%E6%B0%91%E8%BA%AB%E5%88%86%E8%AD%89 + */ + public function testPersonalIdentityNumber() + { + $id = $this->faker->personalIdentityNumber; + + $firstChar = substr($id, 0, 1); + $codesString = Person::$idBirthplaceCode[$firstChar] . substr($id, 1); + + // After transfer the first alphabet word into 2 digit number, there should be totally 11 numbers + $this->assertRegExp("/^[0-9]{11}$/", $codesString); + + $total = 0; + $codesArray = str_split($codesString); + foreach ($codesArray as $key => $code) { + $total += $code * Person::$idDigitValidator[$key]; + } + + // Validate + $this->assertEquals(0, ($total % 10)); + } +} diff --git a/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/TextTest.php b/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/TextTest.php new file mode 100644 index 0000000..ab56f83 --- /dev/null +++ b/vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/TextTest.php @@ -0,0 +1,79 @@ +textClass = new \ReflectionClass('Faker\Provider\zh_TW\Text'); + } + + protected function getMethod($name) { + $method = $this->textClass->getMethod($name); + + $method->setAccessible(true); + + return $method; + } + + /** @test */ + function testItShouldExplodeTheStringToArray() + { + $this->assertSame( + array('中', 'æ–‡', '測', '試', '真', '有', '趣'), + $this->getMethod('explode')->invokeArgs(null, array('中文測試真有趣')) + ); + + $this->assertSame( + array('標', '點', ',', '符', '號', 'ï¼'), + $this->getMethod('explode')->invokeArgs(null, array('標點,符號ï¼')) + ); + } + + /** @test */ + function testItShouldReturnTheStringLength() + { + $this->assertContains( + $this->getMethod('strlen')->invokeArgs(null, array('中文測試真有趣')), + array(7, 21) + ); + } + + /** @test */ + function testItShouldReturnTheCharacterIsValidStartOrNot() + { + $this->assertTrue($this->getMethod('validStart')->invokeArgs(null, array('中'))); + + $this->assertTrue($this->getMethod('validStart')->invokeArgs(null, array('2'))); + + $this->assertTrue($this->getMethod('validStart')->invokeArgs(null, array('Hello'))); + + $this->assertFalse($this->getMethod('validStart')->invokeArgs(null, array('。'))); + + $this->assertFalse($this->getMethod('validStart')->invokeArgs(null, array('ï¼'))); + } + + /** @test */ + function testItShouldAppendEndPunctToTheEndOfString() + { + $this->assertSame( + '中文測試真有趣。', + $this->getMethod('appendEnd')->invokeArgs(null, array('中文測試真有趣')) + ); + + $this->assertSame( + '中文測試真有趣。', + $this->getMethod('appendEnd')->invokeArgs(null, array('中文測試真有趣,')) + ); + + $this->assertSame( + '中文測試真有趣ï¼', + $this->getMethod('appendEnd')->invokeArgs(null, array('中文測試真有趣ï¼')) + ); + } +} diff --git a/vendor/fzaninotto/faker/test/documentor.php b/vendor/fzaninotto/faker/test/documentor.php new file mode 100644 index 0000000..1051ea2 --- /dev/null +++ b/vendor/fzaninotto/faker/test/documentor.php @@ -0,0 +1,16 @@ +seed(1); +$documentor = new Faker\Documentor($generator); +?> +getFormatters() as $provider => $formatters): ?> + +### `` + + $example): ?> + // + + +seed(5); + +echo ''; +?> + + + + +boolean(25)): ?> + + +
+ streetAddress ?> + city ?> + postcode ?> + state ?> +
+ +boolean(33)): ?> + bs ?> + +boolean(33)): ?> + + + +boolean(15)): ?> +
+text(400) ?> +]]> +
+ +
+ +
diff --git a/vendor/guzzlehttp/guzzle/CHANGELOG.md b/vendor/guzzlehttp/guzzle/CHANGELOG.md new file mode 100644 index 0000000..17badd7 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/CHANGELOG.md @@ -0,0 +1,1287 @@ +# Change Log + +## 6.3.3 - 2018-04-22 + +* Fix: Default headers when decode_content is specified + + +## 6.3.2 - 2018-03-26 + +* Fix: Release process + + +## 6.3.1 - 2018-03-26 + +* Bug fix: Parsing 0 epoch expiry times in cookies [#2014](https://github.com/guzzle/guzzle/pull/2014) +* Improvement: Better ConnectException detection [#2012](https://github.com/guzzle/guzzle/pull/2012) +* Bug fix: Malformed domain that contains a "/" [#1999](https://github.com/guzzle/guzzle/pull/1999) +* Bug fix: Undefined offset when a cookie has no first key-value pair [#1998](https://github.com/guzzle/guzzle/pull/1998) +* Improvement: Support PHPUnit 6 [#1953](https://github.com/guzzle/guzzle/pull/1953) +* Bug fix: Support empty headers [#1915](https://github.com/guzzle/guzzle/pull/1915) +* Bug fix: Ignore case during header modifications [#1916](https://github.com/guzzle/guzzle/pull/1916) + ++ Minor code cleanups, documentation fixes and clarifications. + + +## 6.3.0 - 2017-06-22 + +* Feature: force IP resolution (ipv4 or ipv6) [#1608](https://github.com/guzzle/guzzle/pull/1608), [#1659](https://github.com/guzzle/guzzle/pull/1659) +* Improvement: Don't include summary in exception message when body is empty [#1621](https://github.com/guzzle/guzzle/pull/1621) +* Improvement: Handle `on_headers` option in MockHandler [#1580](https://github.com/guzzle/guzzle/pull/1580) +* Improvement: Added SUSE Linux CA path [#1609](https://github.com/guzzle/guzzle/issues/1609) +* Improvement: Use class reference for getting the name of the class instead of using hardcoded strings [#1641](https://github.com/guzzle/guzzle/pull/1641) +* Feature: Added `read_timeout` option [#1611](https://github.com/guzzle/guzzle/pull/1611) +* Bug fix: PHP 7.x fixes [#1685](https://github.com/guzzle/guzzle/pull/1685), [#1686](https://github.com/guzzle/guzzle/pull/1686), [#1811](https://github.com/guzzle/guzzle/pull/1811) +* Deprecation: BadResponseException instantiation without a response [#1642](https://github.com/guzzle/guzzle/pull/1642) +* Feature: Added NTLM auth [#1569](https://github.com/guzzle/guzzle/pull/1569) +* Feature: Track redirect HTTP status codes [#1711](https://github.com/guzzle/guzzle/pull/1711) +* Improvement: Check handler type during construction [#1745](https://github.com/guzzle/guzzle/pull/1745) +* Improvement: Always include the Content-Length if there's a body [#1721](https://github.com/guzzle/guzzle/pull/1721) +* Feature: Added convenience method to access a cookie by name [#1318](https://github.com/guzzle/guzzle/pull/1318) +* Bug fix: Fill `CURLOPT_CAPATH` and `CURLOPT_CAINFO` properly [#1684](https://github.com/guzzle/guzzle/pull/1684) +* Improvement: Use `\GuzzleHttp\Promise\rejection_for` function instead of object init [#1827](https://github.com/guzzle/guzzle/pull/1827) + + ++ Minor code cleanups, documentation fixes and clarifications. + +## 6.2.3 - 2017-02-28 + +* Fix deprecations with guzzle/psr7 version 1.4 + +## 6.2.2 - 2016-10-08 + +* Allow to pass nullable Response to delay callable +* Only add scheme when host is present +* Fix drain case where content-length is the literal string zero +* Obfuscate in-URL credentials in exceptions + +## 6.2.1 - 2016-07-18 + +* Address HTTP_PROXY security vulnerability, CVE-2016-5385: + https://httpoxy.org/ +* Fixing timeout bug with StreamHandler: + https://github.com/guzzle/guzzle/pull/1488 +* Only read up to `Content-Length` in PHP StreamHandler to avoid timeouts when + a server does not honor `Connection: close`. +* Ignore URI fragment when sending requests. + +## 6.2.0 - 2016-03-21 + +* Feature: added `GuzzleHttp\json_encode` and `GuzzleHttp\json_decode`. + https://github.com/guzzle/guzzle/pull/1389 +* Bug fix: Fix sleep calculation when waiting for delayed requests. + https://github.com/guzzle/guzzle/pull/1324 +* Feature: More flexible history containers. + https://github.com/guzzle/guzzle/pull/1373 +* Bug fix: defer sink stream opening in StreamHandler. + https://github.com/guzzle/guzzle/pull/1377 +* Bug fix: do not attempt to escape cookie values. + https://github.com/guzzle/guzzle/pull/1406 +* Feature: report original content encoding and length on decoded responses. + https://github.com/guzzle/guzzle/pull/1409 +* Bug fix: rewind seekable request bodies before dispatching to cURL. + https://github.com/guzzle/guzzle/pull/1422 +* Bug fix: provide an empty string to `http_build_query` for HHVM workaround. + https://github.com/guzzle/guzzle/pull/1367 + +## 6.1.1 - 2015-11-22 + +* Bug fix: Proxy::wrapSync() now correctly proxies to the appropriate handler + https://github.com/guzzle/guzzle/commit/911bcbc8b434adce64e223a6d1d14e9a8f63e4e4 +* Feature: HandlerStack is now more generic. + https://github.com/guzzle/guzzle/commit/f2102941331cda544745eedd97fc8fd46e1ee33e +* Bug fix: setting verify to false in the StreamHandler now disables peer + verification. https://github.com/guzzle/guzzle/issues/1256 +* Feature: Middleware now uses an exception factory, including more error + context. https://github.com/guzzle/guzzle/pull/1282 +* Feature: better support for disabled functions. + https://github.com/guzzle/guzzle/pull/1287 +* Bug fix: fixed regression where MockHandler was not using `sink`. + https://github.com/guzzle/guzzle/pull/1292 + +## 6.1.0 - 2015-09-08 + +* Feature: Added the `on_stats` request option to provide access to transfer + statistics for requests. https://github.com/guzzle/guzzle/pull/1202 +* Feature: Added the ability to persist session cookies in CookieJars. + https://github.com/guzzle/guzzle/pull/1195 +* Feature: Some compatibility updates for Google APP Engine + https://github.com/guzzle/guzzle/pull/1216 +* Feature: Added support for NO_PROXY to prevent the use of a proxy based on + a simple set of rules. https://github.com/guzzle/guzzle/pull/1197 +* Feature: Cookies can now contain square brackets. + https://github.com/guzzle/guzzle/pull/1237 +* Bug fix: Now correctly parsing `=` inside of quotes in Cookies. + https://github.com/guzzle/guzzle/pull/1232 +* Bug fix: Cusotm cURL options now correctly override curl options of the + same name. https://github.com/guzzle/guzzle/pull/1221 +* Bug fix: Content-Type header is now added when using an explicitly provided + multipart body. https://github.com/guzzle/guzzle/pull/1218 +* Bug fix: Now ignoring Set-Cookie headers that have no name. +* Bug fix: Reason phrase is no longer cast to an int in some cases in the + cURL handler. https://github.com/guzzle/guzzle/pull/1187 +* Bug fix: Remove the Authorization header when redirecting if the Host + header changes. https://github.com/guzzle/guzzle/pull/1207 +* Bug fix: Cookie path matching fixes + https://github.com/guzzle/guzzle/issues/1129 +* Bug fix: Fixing the cURL `body_as_string` setting + https://github.com/guzzle/guzzle/pull/1201 +* Bug fix: quotes are no longer stripped when parsing cookies. + https://github.com/guzzle/guzzle/issues/1172 +* Bug fix: `form_params` and `query` now always uses the `&` separator. + https://github.com/guzzle/guzzle/pull/1163 +* Bug fix: Adding a Content-Length to PHP stream wrapper requests if not set. + https://github.com/guzzle/guzzle/pull/1189 + +## 6.0.2 - 2015-07-04 + +* Fixed a memory leak in the curl handlers in which references to callbacks + were not being removed by `curl_reset`. +* Cookies are now extracted properly before redirects. +* Cookies now allow more character ranges. +* Decoded Content-Encoding responses are now modified to correctly reflect + their state if the encoding was automatically removed by a handler. This + means that the `Content-Encoding` header may be removed an the + `Content-Length` modified to reflect the message size after removing the + encoding. +* Added a more explicit error message when trying to use `form_params` and + `multipart` in the same request. +* Several fixes for HHVM support. +* Functions are now conditionally required using an additional level of + indirection to help with global Composer installations. + +## 6.0.1 - 2015-05-27 + +* Fixed a bug with serializing the `query` request option where the `&` + separator was missing. +* Added a better error message for when `body` is provided as an array. Please + use `form_params` or `multipart` instead. +* Various doc fixes. + +## 6.0.0 - 2015-05-26 + +* See the UPGRADING.md document for more information. +* Added `multipart` and `form_params` request options. +* Added `synchronous` request option. +* Added the `on_headers` request option. +* Fixed `expect` handling. +* No longer adding default middlewares in the client ctor. These need to be + present on the provided handler in order to work. +* Requests are no longer initiated when sending async requests with the + CurlMultiHandler. This prevents unexpected recursion from requests completing + while ticking the cURL loop. +* Removed the semantics of setting `default` to `true`. This is no longer + required now that the cURL loop is not ticked for async requests. +* Added request and response logging middleware. +* No longer allowing self signed certificates when using the StreamHandler. +* Ensuring that `sink` is valid if saving to a file. +* Request exceptions now include a "handler context" which provides handler + specific contextual information. +* Added `GuzzleHttp\RequestOptions` to allow request options to be applied + using constants. +* `$maxHandles` has been removed from CurlMultiHandler. +* `MultipartPostBody` is now part of the `guzzlehttp/psr7` package. + +## 5.3.0 - 2015-05-19 + +* Mock now supports `save_to` +* Marked `AbstractRequestEvent::getTransaction()` as public. +* Fixed a bug in which multiple headers using different casing would overwrite + previous headers in the associative array. +* Added `Utils::getDefaultHandler()` +* Marked `GuzzleHttp\Client::getDefaultUserAgent` as deprecated. +* URL scheme is now always lowercased. + +## 6.0.0-beta.1 + +* Requires PHP >= 5.5 +* Updated to use PSR-7 + * Requires immutable messages, which basically means an event based system + owned by a request instance is no longer possible. + * Utilizing the [Guzzle PSR-7 package](https://github.com/guzzle/psr7). + * Removed the dependency on `guzzlehttp/streams`. These stream abstractions + are available in the `guzzlehttp/psr7` package under the `GuzzleHttp\Psr7` + namespace. +* Added middleware and handler system + * Replaced the Guzzle event and subscriber system with a middleware system. + * No longer depends on RingPHP, but rather places the HTTP handlers directly + in Guzzle, operating on PSR-7 messages. + * Retry logic is now encapsulated in `GuzzleHttp\Middleware::retry`, which + means the `guzzlehttp/retry-subscriber` is now obsolete. + * Mocking responses is now handled using `GuzzleHttp\Handler\MockHandler`. +* Asynchronous responses + * No longer supports the `future` request option to send an async request. + Instead, use one of the `*Async` methods of a client (e.g., `requestAsync`, + `getAsync`, etc.). + * Utilizing `GuzzleHttp\Promise` instead of React's promise library to avoid + recursion required by chaining and forwarding react promises. See + https://github.com/guzzle/promises + * Added `requestAsync` and `sendAsync` to send request asynchronously. + * Added magic methods for `getAsync()`, `postAsync()`, etc. to send requests + asynchronously. +* Request options + * POST and form updates + * Added the `form_fields` and `form_files` request options. + * Removed the `GuzzleHttp\Post` namespace. + * The `body` request option no longer accepts an array for POST requests. + * The `exceptions` request option has been deprecated in favor of the + `http_errors` request options. + * The `save_to` request option has been deprecated in favor of `sink` request + option. +* Clients no longer accept an array of URI template string and variables for + URI variables. You will need to expand URI templates before passing them + into a client constructor or request method. +* Client methods `get()`, `post()`, `put()`, `patch()`, `options()`, etc. are + now magic methods that will send synchronous requests. +* Replaced `Utils.php` with plain functions in `functions.php`. +* Removed `GuzzleHttp\Collection`. +* Removed `GuzzleHttp\BatchResults`. Batched pool results are now returned as + an array. +* Removed `GuzzleHttp\Query`. Query string handling is now handled using an + associative array passed into the `query` request option. The query string + is serialized using PHP's `http_build_query`. If you need more control, you + can pass the query string in as a string. +* `GuzzleHttp\QueryParser` has been replaced with the + `GuzzleHttp\Psr7\parse_query`. + +## 5.2.0 - 2015-01-27 + +* Added `AppliesHeadersInterface` to make applying headers to a request based + on the body more generic and not specific to `PostBodyInterface`. +* Reduced the number of stack frames needed to send requests. +* Nested futures are now resolved in the client rather than the RequestFsm +* Finishing state transitions is now handled in the RequestFsm rather than the + RingBridge. +* Added a guard in the Pool class to not use recursion for request retries. + +## 5.1.0 - 2014-12-19 + +* Pool class no longer uses recursion when a request is intercepted. +* The size of a Pool can now be dynamically adjusted using a callback. + See https://github.com/guzzle/guzzle/pull/943. +* Setting a request option to `null` when creating a request with a client will + ensure that the option is not set. This allows you to overwrite default + request options on a per-request basis. + See https://github.com/guzzle/guzzle/pull/937. +* Added the ability to limit which protocols are allowed for redirects by + specifying a `protocols` array in the `allow_redirects` request option. +* Nested futures due to retries are now resolved when waiting for synchronous + responses. See https://github.com/guzzle/guzzle/pull/947. +* `"0"` is now an allowed URI path. See + https://github.com/guzzle/guzzle/pull/935. +* `Query` no longer typehints on the `$query` argument in the constructor, + allowing for strings and arrays. +* Exceptions thrown in the `end` event are now correctly wrapped with Guzzle + specific exceptions if necessary. + +## 5.0.3 - 2014-11-03 + +This change updates query strings so that they are treated as un-encoded values +by default where the value represents an un-encoded value to send over the +wire. A Query object then encodes the value before sending over the wire. This +means that even value query string values (e.g., ":") are url encoded. This +makes the Query class match PHP's http_build_query function. However, if you +want to send requests over the wire using valid query string characters that do +not need to be encoded, then you can provide a string to Url::setQuery() and +pass true as the second argument to specify that the query string is a raw +string that should not be parsed or encoded (unless a call to getQuery() is +subsequently made, forcing the query-string to be converted into a Query +object). + +## 5.0.2 - 2014-10-30 + +* Added a trailing `\r\n` to multipart/form-data payloads. See + https://github.com/guzzle/guzzle/pull/871 +* Added a `GuzzleHttp\Pool::send()` convenience method to match the docs. +* Status codes are now returned as integers. See + https://github.com/guzzle/guzzle/issues/881 +* No longer overwriting an existing `application/x-www-form-urlencoded` header + when sending POST requests, allowing for customized headers. See + https://github.com/guzzle/guzzle/issues/877 +* Improved path URL serialization. + + * No longer double percent-encoding characters in the path or query string if + they are already encoded. + * Now properly encoding the supplied path to a URL object, instead of only + encoding ' ' and '?'. + * Note: This has been changed in 5.0.3 to now encode query string values by + default unless the `rawString` argument is provided when setting the query + string on a URL: Now allowing many more characters to be present in the + query string without being percent encoded. See http://tools.ietf.org/html/rfc3986#appendix-A + +## 5.0.1 - 2014-10-16 + +Bugfix release. + +* Fixed an issue where connection errors still returned response object in + error and end events event though the response is unusable. This has been + corrected so that a response is not returned in the `getResponse` method of + these events if the response did not complete. https://github.com/guzzle/guzzle/issues/867 +* Fixed an issue where transfer statistics were not being populated in the + RingBridge. https://github.com/guzzle/guzzle/issues/866 + +## 5.0.0 - 2014-10-12 + +Adding support for non-blocking responses and some minor API cleanup. + +### New Features + +* Added support for non-blocking responses based on `guzzlehttp/guzzle-ring`. +* Added a public API for creating a default HTTP adapter. +* Updated the redirect plugin to be non-blocking so that redirects are sent + concurrently. Other plugins like this can now be updated to be non-blocking. +* Added a "progress" event so that you can get upload and download progress + events. +* Added `GuzzleHttp\Pool` which implements FutureInterface and transfers + requests concurrently using a capped pool size as efficiently as possible. +* Added `hasListeners()` to EmitterInterface. +* Removed `GuzzleHttp\ClientInterface::sendAll` and marked + `GuzzleHttp\Client::sendAll` as deprecated (it's still there, just not the + recommended way). + +### Breaking changes + +The breaking changes in this release are relatively minor. The biggest thing to +look out for is that request and response objects no longer implement fluent +interfaces. + +* Removed the fluent interfaces (i.e., `return $this`) from requests, + responses, `GuzzleHttp\Collection`, `GuzzleHttp\Url`, + `GuzzleHttp\Query`, `GuzzleHttp\Post\PostBody`, and + `GuzzleHttp\Cookie\SetCookie`. This blog post provides a good outline of + why I did this: http://ocramius.github.io/blog/fluent-interfaces-are-evil/. + This also makes the Guzzle message interfaces compatible with the current + PSR-7 message proposal. +* Removed "functions.php", so that Guzzle is truly PSR-4 compliant. Except + for the HTTP request functions from function.php, these functions are now + implemented in `GuzzleHttp\Utils` using camelCase. `GuzzleHttp\json_decode` + moved to `GuzzleHttp\Utils::jsonDecode`. `GuzzleHttp\get_path` moved to + `GuzzleHttp\Utils::getPath`. `GuzzleHttp\set_path` moved to + `GuzzleHttp\Utils::setPath`. `GuzzleHttp\batch` should now be + `GuzzleHttp\Pool::batch`, which returns an `objectStorage`. Using functions.php + caused problems for many users: they aren't PSR-4 compliant, require an + explicit include, and needed an if-guard to ensure that the functions are not + declared multiple times. +* Rewrote adapter layer. + * Removing all classes from `GuzzleHttp\Adapter`, these are now + implemented as callables that are stored in `GuzzleHttp\Ring\Client`. + * Removed the concept of "parallel adapters". Sending requests serially or + concurrently is now handled using a single adapter. + * Moved `GuzzleHttp\Adapter\Transaction` to `GuzzleHttp\Transaction`. The + Transaction object now exposes the request, response, and client as public + properties. The getters and setters have been removed. +* Removed the "headers" event. This event was only useful for changing the + body a response once the headers of the response were known. You can implement + a similar behavior in a number of ways. One example might be to use a + FnStream that has access to the transaction being sent. For example, when the + first byte is written, you could check if the response headers match your + expectations, and if so, change the actual stream body that is being + written to. +* Removed the `asArray` parameter from + `GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header + value as an array, then use the newly added `getHeaderAsArray()` method of + `MessageInterface`. This change makes the Guzzle interfaces compatible with + the PSR-7 interfaces. +* `GuzzleHttp\Message\MessageFactory` no longer allows subclasses to add + custom request options using double-dispatch (this was an implementation + detail). Instead, you should now provide an associative array to the + constructor which is a mapping of the request option name mapping to a + function that applies the option value to a request. +* Removed the concept of "throwImmediately" from exceptions and error events. + This control mechanism was used to stop a transfer of concurrent requests + from completing. This can now be handled by throwing the exception or by + cancelling a pool of requests or each outstanding future request individually. +* Updated to "GuzzleHttp\Streams" 3.0. + * `GuzzleHttp\Stream\StreamInterface::getContents()` no longer accepts a + `maxLen` parameter. This update makes the Guzzle streams project + compatible with the current PSR-7 proposal. + * `GuzzleHttp\Stream\Stream::__construct`, + `GuzzleHttp\Stream\Stream::factory`, and + `GuzzleHttp\Stream\Utils::create` no longer accept a size in the second + argument. They now accept an associative array of options, including the + "size" key and "metadata" key which can be used to provide custom metadata. + +## 4.2.2 - 2014-09-08 + +* Fixed a memory leak in the CurlAdapter when reusing cURL handles. +* No longer using `request_fulluri` in stream adapter proxies. +* Relative redirects are now based on the last response, not the first response. + +## 4.2.1 - 2014-08-19 + +* Ensuring that the StreamAdapter does not always add a Content-Type header +* Adding automated github releases with a phar and zip + +## 4.2.0 - 2014-08-17 + +* Now merging in default options using a case-insensitive comparison. + Closes https://github.com/guzzle/guzzle/issues/767 +* Added the ability to automatically decode `Content-Encoding` response bodies + using the `decode_content` request option. This is set to `true` by default + to decode the response body if it comes over the wire with a + `Content-Encoding`. Set this value to `false` to disable decoding the + response content, and pass a string to provide a request `Accept-Encoding` + header and turn on automatic response decoding. This feature now allows you + to pass an `Accept-Encoding` header in the headers of a request but still + disable automatic response decoding. + Closes https://github.com/guzzle/guzzle/issues/764 +* Added the ability to throw an exception immediately when transferring + requests in parallel. Closes https://github.com/guzzle/guzzle/issues/760 +* Updating guzzlehttp/streams dependency to ~2.1 +* No longer utilizing the now deprecated namespaced methods from the stream + package. + +## 4.1.8 - 2014-08-14 + +* Fixed an issue in the CurlFactory that caused setting the `stream=false` + request option to throw an exception. + See: https://github.com/guzzle/guzzle/issues/769 +* TransactionIterator now calls rewind on the inner iterator. + See: https://github.com/guzzle/guzzle/pull/765 +* You can now set the `Content-Type` header to `multipart/form-data` + when creating POST requests to force multipart bodies. + See https://github.com/guzzle/guzzle/issues/768 + +## 4.1.7 - 2014-08-07 + +* Fixed an error in the HistoryPlugin that caused the same request and response + to be logged multiple times when an HTTP protocol error occurs. +* Ensuring that cURL does not add a default Content-Type when no Content-Type + has been supplied by the user. This prevents the adapter layer from modifying + the request that is sent over the wire after any listeners may have already + put the request in a desired state (e.g., signed the request). +* Throwing an exception when you attempt to send requests that have the + "stream" set to true in parallel using the MultiAdapter. +* Only calling curl_multi_select when there are active cURL handles. This was + previously changed and caused performance problems on some systems due to PHP + always selecting until the maximum select timeout. +* Fixed a bug where multipart/form-data POST fields were not correctly + aggregated (e.g., values with "&"). + +## 4.1.6 - 2014-08-03 + +* Added helper methods to make it easier to represent messages as strings, + including getting the start line and getting headers as a string. + +## 4.1.5 - 2014-08-02 + +* Automatically retrying cURL "Connection died, retrying a fresh connect" + errors when possible. +* cURL implementation cleanup +* Allowing multiple event subscriber listeners to be registered per event by + passing an array of arrays of listener configuration. + +## 4.1.4 - 2014-07-22 + +* Fixed a bug that caused multi-part POST requests with more than one field to + serialize incorrectly. +* Paths can now be set to "0" +* `ResponseInterface::xml` now accepts a `libxml_options` option and added a + missing default argument that was required when parsing XML response bodies. +* A `save_to` stream is now created lazily, which means that files are not + created on disk unless a request succeeds. + +## 4.1.3 - 2014-07-15 + +* Various fixes to multipart/form-data POST uploads +* Wrapping function.php in an if-statement to ensure Guzzle can be used + globally and in a Composer install +* Fixed an issue with generating and merging in events to an event array +* POST headers are only applied before sending a request to allow you to change + the query aggregator used before uploading +* Added much more robust query string parsing +* Fixed various parsing and normalization issues with URLs +* Fixing an issue where multi-valued headers were not being utilized correctly + in the StreamAdapter + +## 4.1.2 - 2014-06-18 + +* Added support for sending payloads with GET requests + +## 4.1.1 - 2014-06-08 + +* Fixed an issue related to using custom message factory options in subclasses +* Fixed an issue with nested form fields in a multi-part POST +* Fixed an issue with using the `json` request option for POST requests +* Added `ToArrayInterface` to `GuzzleHttp\Cookie\CookieJar` + +## 4.1.0 - 2014-05-27 + +* Added a `json` request option to easily serialize JSON payloads. +* Added a `GuzzleHttp\json_decode()` wrapper to safely parse JSON. +* Added `setPort()` and `getPort()` to `GuzzleHttp\Message\RequestInterface`. +* Added the ability to provide an emitter to a client in the client constructor. +* Added the ability to persist a cookie session using $_SESSION. +* Added a trait that can be used to add event listeners to an iterator. +* Removed request method constants from RequestInterface. +* Fixed warning when invalid request start-lines are received. +* Updated MessageFactory to work with custom request option methods. +* Updated cacert bundle to latest build. + +4.0.2 (2014-04-16) +------------------ + +* Proxy requests using the StreamAdapter now properly use request_fulluri (#632) +* Added the ability to set scalars as POST fields (#628) + +## 4.0.1 - 2014-04-04 + +* The HTTP status code of a response is now set as the exception code of + RequestException objects. +* 303 redirects will now correctly switch from POST to GET requests. +* The default parallel adapter of a client now correctly uses the MultiAdapter. +* HasDataTrait now initializes the internal data array as an empty array so + that the toArray() method always returns an array. + +## 4.0.0 - 2014-03-29 + +* For more information on the 4.0 transition, see: + http://mtdowling.com/blog/2014/03/15/guzzle-4-rc/ +* For information on changes and upgrading, see: + https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40 +* Added `GuzzleHttp\batch()` as a convenience function for sending requests in + parallel without needing to write asynchronous code. +* Restructured how events are added to `GuzzleHttp\ClientInterface::sendAll()`. + You can now pass a callable or an array of associative arrays where each + associative array contains the "fn", "priority", and "once" keys. + +## 4.0.0.rc-2 - 2014-03-25 + +* Removed `getConfig()` and `setConfig()` from clients to avoid confusion + around whether things like base_url, message_factory, etc. should be able to + be retrieved or modified. +* Added `getDefaultOption()` and `setDefaultOption()` to ClientInterface +* functions.php functions were renamed using snake_case to match PHP idioms +* Added support for `HTTP_PROXY`, `HTTPS_PROXY`, and + `GUZZLE_CURL_SELECT_TIMEOUT` environment variables +* Added the ability to specify custom `sendAll()` event priorities +* Added the ability to specify custom stream context options to the stream + adapter. +* Added a functions.php function for `get_path()` and `set_path()` +* CurlAdapter and MultiAdapter now use a callable to generate curl resources +* MockAdapter now properly reads a body and emits a `headers` event +* Updated Url class to check if a scheme and host are set before adding ":" + and "//". This allows empty Url (e.g., "") to be serialized as "". +* Parsing invalid XML no longer emits warnings +* Curl classes now properly throw AdapterExceptions +* Various performance optimizations +* Streams are created with the faster `Stream\create()` function +* Marked deprecation_proxy() as internal +* Test server is now a collection of static methods on a class + +## 4.0.0-rc.1 - 2014-03-15 + +* See https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40 + +## 3.8.1 - 2014-01-28 + +* Bug: Always using GET requests when redirecting from a 303 response +* Bug: CURLOPT_SSL_VERIFYHOST is now correctly set to false when setting `$certificateAuthority` to false in + `Guzzle\Http\ClientInterface::setSslVerification()` +* Bug: RedirectPlugin now uses strict RFC 3986 compliance when combining a base URL with a relative URL +* Bug: The body of a request can now be set to `"0"` +* Sending PHP stream requests no longer forces `HTTP/1.0` +* Adding more information to ExceptionCollection exceptions so that users have more context, including a stack trace of + each sub-exception +* Updated the `$ref` attribute in service descriptions to merge over any existing parameters of a schema (rather than + clobbering everything). +* Merging URLs will now use the query string object from the relative URL (thus allowing custom query aggregators) +* Query strings are now parsed in a way that they do no convert empty keys with no value to have a dangling `=`. + For example `foo&bar=baz` is now correctly parsed and recognized as `foo&bar=baz` rather than `foo=&bar=baz`. +* Now properly escaping the regular expression delimiter when matching Cookie domains. +* Network access is now disabled when loading XML documents + +## 3.8.0 - 2013-12-05 + +* Added the ability to define a POST name for a file +* JSON response parsing now properly walks additionalProperties +* cURL error code 18 is now retried automatically in the BackoffPlugin +* Fixed a cURL error when URLs contain fragments +* Fixed an issue in the BackoffPlugin retry event where it was trying to access all exceptions as if they were + CurlExceptions +* CURLOPT_PROGRESS function fix for PHP 5.5 (69fcc1e) +* Added the ability for Guzzle to work with older versions of cURL that do not support `CURLOPT_TIMEOUT_MS` +* Fixed a bug that was encountered when parsing empty header parameters +* UriTemplate now has a `setRegex()` method to match the docs +* The `debug` request parameter now checks if it is truthy rather than if it exists +* Setting the `debug` request parameter to true shows verbose cURL output instead of using the LogPlugin +* Added the ability to combine URLs using strict RFC 3986 compliance +* Command objects can now return the validation errors encountered by the command +* Various fixes to cache revalidation (#437 and 29797e5) +* Various fixes to the AsyncPlugin +* Cleaned up build scripts + +## 3.7.4 - 2013-10-02 + +* Bug fix: 0 is now an allowed value in a description parameter that has a default value (#430) +* Bug fix: SchemaFormatter now returns an integer when formatting to a Unix timestamp + (see https://github.com/aws/aws-sdk-php/issues/147) +* Bug fix: Cleaned up and fixed URL dot segment removal to properly resolve internal dots +* Minimum PHP version is now properly specified as 5.3.3 (up from 5.3.2) (#420) +* Updated the bundled cacert.pem (#419) +* OauthPlugin now supports adding authentication to headers or query string (#425) + +## 3.7.3 - 2013-09-08 + +* Added the ability to get the exception associated with a request/command when using `MultiTransferException` and + `CommandTransferException`. +* Setting `additionalParameters` of a response to false is now honored when parsing responses with a service description +* Schemas are only injected into response models when explicitly configured. +* No longer guessing Content-Type based on the path of a request. Content-Type is now only guessed based on the path of + an EntityBody. +* Bug fix: ChunkedIterator can now properly chunk a \Traversable as well as an \Iterator. +* Bug fix: FilterIterator now relies on `\Iterator` instead of `\Traversable`. +* Bug fix: Gracefully handling malformed responses in RequestMediator::writeResponseBody() +* Bug fix: Replaced call to canCache with canCacheRequest in the CallbackCanCacheStrategy of the CachePlugin +* Bug fix: Visiting XML attributes first before visiting XML children when serializing requests +* Bug fix: Properly parsing headers that contain commas contained in quotes +* Bug fix: mimetype guessing based on a filename is now case-insensitive + +## 3.7.2 - 2013-08-02 + +* Bug fix: Properly URL encoding paths when using the PHP-only version of the UriTemplate expander + See https://github.com/guzzle/guzzle/issues/371 +* Bug fix: Cookie domains are now matched correctly according to RFC 6265 + See https://github.com/guzzle/guzzle/issues/377 +* Bug fix: GET parameters are now used when calculating an OAuth signature +* Bug fix: Fixed an issue with cache revalidation where the If-None-Match header was being double quoted +* `Guzzle\Common\AbstractHasDispatcher::dispatch()` now returns the event that was dispatched +* `Guzzle\Http\QueryString::factory()` now guesses the most appropriate query aggregator to used based on the input. + See https://github.com/guzzle/guzzle/issues/379 +* Added a way to add custom domain objects to service description parsing using the `operation.parse_class` event. See + https://github.com/guzzle/guzzle/pull/380 +* cURL multi cleanup and optimizations + +## 3.7.1 - 2013-07-05 + +* Bug fix: Setting default options on a client now works +* Bug fix: Setting options on HEAD requests now works. See #352 +* Bug fix: Moving stream factory before send event to before building the stream. See #353 +* Bug fix: Cookies no longer match on IP addresses per RFC 6265 +* Bug fix: Correctly parsing header parameters that are in `<>` and quotes +* Added `cert` and `ssl_key` as request options +* `Host` header can now diverge from the host part of a URL if the header is set manually +* `Guzzle\Service\Command\LocationVisitor\Request\XmlVisitor` was rewritten to change from using SimpleXML to XMLWriter +* OAuth parameters are only added via the plugin if they aren't already set +* Exceptions are now thrown when a URL cannot be parsed +* Returning `false` if `Guzzle\Http\EntityBody::getContentMd5()` fails +* Not setting a `Content-MD5` on a command if calculating the Content-MD5 fails via the CommandContentMd5Plugin + +## 3.7.0 - 2013-06-10 + +* See UPGRADING.md for more information on how to upgrade. +* Requests now support the ability to specify an array of $options when creating a request to more easily modify a + request. You can pass a 'request.options' configuration setting to a client to apply default request options to + every request created by a client (e.g. default query string variables, headers, curl options, etc.). +* Added a static facade class that allows you to use Guzzle with static methods and mount the class to `\Guzzle`. + See `Guzzle\Http\StaticClient::mount`. +* Added `command.request_options` to `Guzzle\Service\Command\AbstractCommand` to pass request options to requests + created by a command (e.g. custom headers, query string variables, timeout settings, etc.). +* Stream size in `Guzzle\Stream\PhpStreamRequestFactory` will now be set if Content-Length is returned in the + headers of a response +* Added `Guzzle\Common\Collection::setPath($path, $value)` to set a value into an array using a nested key + (e.g. `$collection->setPath('foo/baz/bar', 'test'); echo $collection['foo']['bar']['bar'];`) +* ServiceBuilders now support storing and retrieving arbitrary data +* CachePlugin can now purge all resources for a given URI +* CachePlugin can automatically purge matching cached items when a non-idempotent request is sent to a resource +* CachePlugin now uses the Vary header to determine if a resource is a cache hit +* `Guzzle\Http\Message\Response` now implements `\Serializable` +* Added `Guzzle\Cache\CacheAdapterFactory::fromCache()` to more easily create cache adapters +* `Guzzle\Service\ClientInterface::execute()` now accepts an array, single command, or Traversable +* Fixed a bug in `Guzzle\Http\Message\Header\Link::addLink()` +* Better handling of calculating the size of a stream in `Guzzle\Stream\Stream` using fstat() and caching the size +* `Guzzle\Common\Exception\ExceptionCollection` now creates a more readable exception message +* Fixing BC break: Added back the MonologLogAdapter implementation rather than extending from PsrLog so that older + Symfony users can still use the old version of Monolog. +* Fixing BC break: Added the implementation back in for `Guzzle\Http\Message\AbstractMessage::getTokenizedHeader()`. + Now triggering an E_USER_DEPRECATED warning when used. Use `$message->getHeader()->parseParams()`. +* Several performance improvements to `Guzzle\Common\Collection` +* Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`: + createRequest, head, delete, put, patch, post, options, prepareRequest +* Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()` +* Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface` +* Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to + `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a + resource, string, or EntityBody into the $options parameter to specify the download location of the response. +* Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a + default `array()` +* Added `Guzzle\Stream\StreamInterface::isRepeatable` +* Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use + $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or + $client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))`. +* Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use $client->getConfig()->getPath('request.options/headers')`. +* Removed `Guzzle\Http\ClientInterface::expandTemplate()` +* Removed `Guzzle\Http\ClientInterface::setRequestFactory()` +* Removed `Guzzle\Http\ClientInterface::getCurlMulti()` +* Removed `Guzzle\Http\Message\RequestInterface::canCache` +* Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect` +* Removed `Guzzle\Http\Message\RequestInterface::isRedirect` +* Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods. +* You can now enable E_USER_DEPRECATED warnings to see if you are using a deprecated method by setting + `Guzzle\Common\Version::$emitWarnings` to true. +* Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use + `$request->getResponseBody()->isRepeatable()` instead. +* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use + `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. +* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use + `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. +* Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead. +* Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead. +* Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated +* Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand. + These will work through Guzzle 4.0 +* Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use [request.options][params]. +* Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client. +* Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use $client->getConfig()->getPath('request.options/headers')`. +* Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. +* Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8. +* Marked `Guzzle\Common\Collection::inject()` as deprecated. +* Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest');` +* CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a + CacheStorageInterface. These two objects and interface will be removed in a future version. +* Always setting X-cache headers on cached responses +* Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin +* `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface + $request, Response $response);` +* `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);` +* `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);` +* Added `CacheStorageInterface::purge($url)` +* `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin + $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache, + CanCacheStrategyInterface $canCache = null)` +* Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)` + +## 3.6.0 - 2013-05-29 + +* ServiceDescription now implements ToArrayInterface +* Added command.hidden_params to blacklist certain headers from being treated as additionalParameters +* Guzzle can now correctly parse incomplete URLs +* Mixed casing of headers are now forced to be a single consistent casing across all values for that header. +* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution +* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader(). +* Specific header implementations can be created for complex headers. When a message creates a header, it uses a + HeaderFactory which can map specific headers to specific header classes. There is now a Link header and + CacheControl header implementation. +* Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate +* Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti() +* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in + Guzzle\Http\Curl\RequestMediator +* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string. +* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface +* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders() +* Removed Guzzle\Parser\ParserRegister::get(). Use getParser() +* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser(). +* All response header helper functions return a string rather than mixing Header objects and strings inconsistently +* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle + directly via interfaces +* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist + but are a no-op until removed. +* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a + `Guzzle\Service\Command\ArrayCommandInterface`. +* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response + on a request while the request is still being transferred +* The ability to case-insensitively search for header values +* Guzzle\Http\Message\Header::hasExactHeader +* Guzzle\Http\Message\Header::raw. Use getAll() +* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object + instead. +* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess +* Added the ability to cast Model objects to a string to view debug information. + +## 3.5.0 - 2013-05-13 + +* Bug: Fixed a regression so that request responses are parsed only once per oncomplete event rather than multiple times +* Bug: Better cleanup of one-time events across the board (when an event is meant to fire once, it will now remove + itself from the EventDispatcher) +* Bug: `Guzzle\Log\MessageFormatter` now properly writes "total_time" and "connect_time" values +* Bug: Cloning an EntityEnclosingRequest now clones the EntityBody too +* Bug: Fixed an undefined index error when parsing nested JSON responses with a sentAs parameter that reference a + non-existent key +* Bug: All __call() method arguments are now required (helps with mocking frameworks) +* Deprecating Response::getRequest() and now using a shallow clone of a request object to remove a circular reference + to help with refcount based garbage collection of resources created by sending a request +* Deprecating ZF1 cache and log adapters. These will be removed in the next major version. +* Deprecating `Response::getPreviousResponse()` (method signature still exists, but it's deprecated). Use the + HistoryPlugin for a history. +* Added a `responseBody` alias for the `response_body` location +* Refactored internals to no longer rely on Response::getRequest() +* HistoryPlugin can now be cast to a string +* HistoryPlugin now logs transactions rather than requests and responses to more accurately keep track of the requests + and responses that are sent over the wire +* Added `getEffectiveUrl()` and `getRedirectCount()` to Response objects + +## 3.4.3 - 2013-04-30 + +* Bug fix: Fixing bug introduced in 3.4.2 where redirect responses are duplicated on the final redirected response +* Added a check to re-extract the temp cacert bundle from the phar before sending each request + +## 3.4.2 - 2013-04-29 + +* Bug fix: Stream objects now work correctly with "a" and "a+" modes +* Bug fix: Removing `Transfer-Encoding: chunked` header when a Content-Length is present +* Bug fix: AsyncPlugin no longer forces HEAD requests +* Bug fix: DateTime timezones are now properly handled when using the service description schema formatter +* Bug fix: CachePlugin now properly handles stale-if-error directives when a request to the origin server fails +* Setting a response on a request will write to the custom request body from the response body if one is specified +* LogPlugin now writes to php://output when STDERR is undefined +* Added the ability to set multiple POST files for the same key in a single call +* application/x-www-form-urlencoded POSTs now use the utf-8 charset by default +* Added the ability to queue CurlExceptions to the MockPlugin +* Cleaned up how manual responses are queued on requests (removed "queued_response" and now using request.before_send) +* Configuration loading now allows remote files + +## 3.4.1 - 2013-04-16 + +* Large refactoring to how CurlMulti handles work. There is now a proxy that sits in front of a pool of CurlMulti + handles. This greatly simplifies the implementation, fixes a couple bugs, and provides a small performance boost. +* Exceptions are now properly grouped when sending requests in parallel +* Redirects are now properly aggregated when a multi transaction fails +* Redirects now set the response on the original object even in the event of a failure +* Bug fix: Model names are now properly set even when using $refs +* Added support for PHP 5.5's CurlFile to prevent warnings with the deprecated @ syntax +* Added support for oauth_callback in OAuth signatures +* Added support for oauth_verifier in OAuth signatures +* Added support to attempt to retrieve a command first literally, then ucfirst, the with inflection + +## 3.4.0 - 2013-04-11 + +* Bug fix: URLs are now resolved correctly based on http://tools.ietf.org/html/rfc3986#section-5.2. #289 +* Bug fix: Absolute URLs with a path in a service description will now properly override the base URL. #289 +* Bug fix: Parsing a query string with a single PHP array value will now result in an array. #263 +* Bug fix: Better normalization of the User-Agent header to prevent duplicate headers. #264. +* Bug fix: Added `number` type to service descriptions. +* Bug fix: empty parameters are removed from an OAuth signature +* Bug fix: Revalidating a cache entry prefers the Last-Modified over the Date header +* Bug fix: Fixed "array to string" error when validating a union of types in a service description +* Bug fix: Removed code that attempted to determine the size of a stream when data is written to the stream +* Bug fix: Not including an `oauth_token` if the value is null in the OauthPlugin. +* Bug fix: Now correctly aggregating successful requests and failed requests in CurlMulti when a redirect occurs. +* The new default CURLOPT_TIMEOUT setting has been increased to 150 seconds so that Guzzle works on poor connections. +* Added a feature to EntityEnclosingRequest::setBody() that will automatically set the Content-Type of the request if + the Content-Type can be determined based on the entity body or the path of the request. +* Added the ability to overwrite configuration settings in a client when grabbing a throwaway client from a builder. +* Added support for a PSR-3 LogAdapter. +* Added a `command.after_prepare` event +* Added `oauth_callback` parameter to the OauthPlugin +* Added the ability to create a custom stream class when using a stream factory +* Added a CachingEntityBody decorator +* Added support for `additionalParameters` in service descriptions to define how custom parameters are serialized. +* The bundled SSL certificate is now provided in the phar file and extracted when running Guzzle from a phar. +* You can now send any EntityEnclosingRequest with POST fields or POST files and cURL will handle creating bodies +* POST requests using a custom entity body are now treated exactly like PUT requests but with a custom cURL method. This + means that the redirect behavior of POST requests with custom bodies will not be the same as POST requests that use + POST fields or files (the latter is only used when emulating a form POST in the browser). +* Lots of cleanup to CurlHandle::factory and RequestFactory::createRequest + +## 3.3.1 - 2013-03-10 + +* Added the ability to create PHP streaming responses from HTTP requests +* Bug fix: Running any filters when parsing response headers with service descriptions +* Bug fix: OauthPlugin fixes to allow for multi-dimensional array signing, and sorting parameters before signing +* Bug fix: Removed the adding of default empty arrays and false Booleans to responses in order to be consistent across + response location visitors. +* Bug fix: Removed the possibility of creating configuration files with circular dependencies +* RequestFactory::create() now uses the key of a POST file when setting the POST file name +* Added xmlAllowEmpty to serialize an XML body even if no XML specific parameters are set + +## 3.3.0 - 2013-03-03 + +* A large number of performance optimizations have been made +* Bug fix: Added 'wb' as a valid write mode for streams +* Bug fix: `Guzzle\Http\Message\Response::json()` now allows scalar values to be returned +* Bug fix: Fixed bug in `Guzzle\Http\Message\Response` where wrapping quotes were stripped from `getEtag()` +* BC: Removed `Guzzle\Http\Utils` class +* BC: Setting a service description on a client will no longer modify the client's command factories. +* BC: Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using + the 'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io' +* BC: `Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getSteamType()` are no longer converted to + lowercase +* Operation parameter objects are now lazy loaded internally +* Added ErrorResponsePlugin that can throw errors for responses defined in service description operations' errorResponses +* Added support for instantiating responseType=class responseClass classes. Classes must implement + `Guzzle\Service\Command\ResponseClassInterface` +* Added support for additionalProperties for top-level parameters in responseType=model responseClasses. These + additional properties also support locations and can be used to parse JSON responses where the outermost part of the + JSON is an array +* Added support for nested renaming of JSON models (rename sentAs to name) +* CachePlugin + * Added support for stale-if-error so that the CachePlugin can now serve stale content from the cache on error + * Debug headers can now added to cached response in the CachePlugin + +## 3.2.0 - 2013-02-14 + +* CurlMulti is no longer reused globally. A new multi object is created per-client. This helps to isolate clients. +* URLs with no path no longer contain a "/" by default +* Guzzle\Http\QueryString does no longer manages the leading "?". This is now handled in Guzzle\Http\Url. +* BadResponseException no longer includes the full request and response message +* Adding setData() to Guzzle\Service\Description\ServiceDescriptionInterface +* Adding getResponseBody() to Guzzle\Http\Message\RequestInterface +* Various updates to classes to use ServiceDescriptionInterface type hints rather than ServiceDescription +* Header values can now be normalized into distinct values when multiple headers are combined with a comma separated list +* xmlEncoding can now be customized for the XML declaration of a XML service description operation +* Guzzle\Http\QueryString now uses Guzzle\Http\QueryAggregator\QueryAggregatorInterface objects to add custom value + aggregation and no longer uses callbacks +* The URL encoding implementation of Guzzle\Http\QueryString can now be customized +* Bug fix: Filters were not always invoked for array service description parameters +* Bug fix: Redirects now use a target response body rather than a temporary response body +* Bug fix: The default exponential backoff BackoffPlugin was not giving when the request threshold was exceeded +* Bug fix: Guzzle now takes the first found value when grabbing Cache-Control directives + +## 3.1.2 - 2013-01-27 + +* Refactored how operation responses are parsed. Visitors now include a before() method responsible for parsing the + response body. For example, the XmlVisitor now parses the XML response into an array in the before() method. +* Fixed an issue where cURL would not automatically decompress responses when the Accept-Encoding header was sent +* CURLOPT_SSL_VERIFYHOST is never set to 1 because it is deprecated (see 5e0ff2ef20f839e19d1eeb298f90ba3598784444) +* Fixed a bug where redirect responses were not chained correctly using getPreviousResponse() +* Setting default headers on a client after setting the user-agent will not erase the user-agent setting + +## 3.1.1 - 2013-01-20 + +* Adding wildcard support to Guzzle\Common\Collection::getPath() +* Adding alias support to ServiceBuilder configs +* Adding Guzzle\Service\Resource\CompositeResourceIteratorFactory and cleaning up factory interface + +## 3.1.0 - 2013-01-12 + +* BC: CurlException now extends from RequestException rather than BadResponseException +* BC: Renamed Guzzle\Plugin\Cache\CanCacheStrategyInterface::canCache() to canCacheRequest() and added CanCacheResponse() +* Added getData to ServiceDescriptionInterface +* Added context array to RequestInterface::setState() +* Bug: Removing hard dependency on the BackoffPlugin from Guzzle\Http +* Bug: Adding required content-type when JSON request visitor adds JSON to a command +* Bug: Fixing the serialization of a service description with custom data +* Made it easier to deal with exceptions thrown when transferring commands or requests in parallel by providing + an array of successful and failed responses +* Moved getPath from Guzzle\Service\Resource\Model to Guzzle\Common\Collection +* Added Guzzle\Http\IoEmittingEntityBody +* Moved command filtration from validators to location visitors +* Added `extends` attributes to service description parameters +* Added getModels to ServiceDescriptionInterface + +## 3.0.7 - 2012-12-19 + +* Fixing phar detection when forcing a cacert to system if null or true +* Allowing filename to be passed to `Guzzle\Http\Message\Request::setResponseBody()` +* Cleaning up `Guzzle\Common\Collection::inject` method +* Adding a response_body location to service descriptions + +## 3.0.6 - 2012-12-09 + +* CurlMulti performance improvements +* Adding setErrorResponses() to Operation +* composer.json tweaks + +## 3.0.5 - 2012-11-18 + +* Bug: Fixing an infinite recursion bug caused from revalidating with the CachePlugin +* Bug: Response body can now be a string containing "0" +* Bug: Using Guzzle inside of a phar uses system by default but now allows for a custom cacert +* Bug: QueryString::fromString now properly parses query string parameters that contain equal signs +* Added support for XML attributes in service description responses +* DefaultRequestSerializer now supports array URI parameter values for URI template expansion +* Added better mimetype guessing to requests and post files + +## 3.0.4 - 2012-11-11 + +* Bug: Fixed a bug when adding multiple cookies to a request to use the correct glue value +* Bug: Cookies can now be added that have a name, domain, or value set to "0" +* Bug: Using the system cacert bundle when using the Phar +* Added json and xml methods to Response to make it easier to parse JSON and XML response data into data structures +* Enhanced cookie jar de-duplication +* Added the ability to enable strict cookie jars that throw exceptions when invalid cookies are added +* Added setStream to StreamInterface to actually make it possible to implement custom rewind behavior for entity bodies +* Added the ability to create any sort of hash for a stream rather than just an MD5 hash + +## 3.0.3 - 2012-11-04 + +* Implementing redirects in PHP rather than cURL +* Added PECL URI template extension and using as default parser if available +* Bug: Fixed Content-Length parsing of Response factory +* Adding rewind() method to entity bodies and streams. Allows for custom rewinding of non-repeatable streams. +* Adding ToArrayInterface throughout library +* Fixing OauthPlugin to create unique nonce values per request + +## 3.0.2 - 2012-10-25 + +* Magic methods are enabled by default on clients +* Magic methods return the result of a command +* Service clients no longer require a base_url option in the factory +* Bug: Fixed an issue with URI templates where null template variables were being expanded + +## 3.0.1 - 2012-10-22 + +* Models can now be used like regular collection objects by calling filter, map, etc. +* Models no longer require a Parameter structure or initial data in the constructor +* Added a custom AppendIterator to get around a PHP bug with the `\AppendIterator` + +## 3.0.0 - 2012-10-15 + +* Rewrote service description format to be based on Swagger + * Now based on JSON schema + * Added nested input structures and nested response models + * Support for JSON and XML input and output models + * Renamed `commands` to `operations` + * Removed dot class notation + * Removed custom types +* Broke the project into smaller top-level namespaces to be more component friendly +* Removed support for XML configs and descriptions. Use arrays or JSON files. +* Removed the Validation component and Inspector +* Moved all cookie code to Guzzle\Plugin\Cookie +* Magic methods on a Guzzle\Service\Client now return the command un-executed. +* Calling getResult() or getResponse() on a command will lazily execute the command if needed. +* Now shipping with cURL's CA certs and using it by default +* Added previousResponse() method to response objects +* No longer sending Accept and Accept-Encoding headers on every request +* Only sending an Expect header by default when a payload is greater than 1MB +* Added/moved client options: + * curl.blacklist to curl.option.blacklist + * Added ssl.certificate_authority +* Added a Guzzle\Iterator component +* Moved plugins from Guzzle\Http\Plugin to Guzzle\Plugin +* Added a more robust backoff retry strategy (replaced the ExponentialBackoffPlugin) +* Added a more robust caching plugin +* Added setBody to response objects +* Updating LogPlugin to use a more flexible MessageFormatter +* Added a completely revamped build process +* Cleaning up Collection class and removing default values from the get method +* Fixed ZF2 cache adapters + +## 2.8.8 - 2012-10-15 + +* Bug: Fixed a cookie issue that caused dot prefixed domains to not match where popular browsers did + +## 2.8.7 - 2012-09-30 + +* Bug: Fixed config file aliases for JSON includes +* Bug: Fixed cookie bug on a request object by using CookieParser to parse cookies on requests +* Bug: Removing the path to a file when sending a Content-Disposition header on a POST upload +* Bug: Hardening request and response parsing to account for missing parts +* Bug: Fixed PEAR packaging +* Bug: Fixed Request::getInfo +* Bug: Fixed cases where CURLM_CALL_MULTI_PERFORM return codes were causing curl transactions to fail +* Adding the ability for the namespace Iterator factory to look in multiple directories +* Added more getters/setters/removers from service descriptions +* Added the ability to remove POST fields from OAuth signatures +* OAuth plugin now supports 2-legged OAuth + +## 2.8.6 - 2012-09-05 + +* Added the ability to modify and build service descriptions +* Added the use of visitors to apply parameters to locations in service descriptions using the dynamic command +* Added a `json` parameter location +* Now allowing dot notation for classes in the CacheAdapterFactory +* Using the union of two arrays rather than an array_merge when extending service builder services and service params +* Ensuring that a service is a string before doing strpos() checks on it when substituting services for references + in service builder config files. +* Services defined in two different config files that include one another will by default replace the previously + defined service, but you can now create services that extend themselves and merge their settings over the previous +* The JsonLoader now supports aliasing filenames with different filenames. This allows you to alias something like + '_default' with a default JSON configuration file. + +## 2.8.5 - 2012-08-29 + +* Bug: Suppressed empty arrays from URI templates +* Bug: Added the missing $options argument from ServiceDescription::factory to enable caching +* Added support for HTTP responses that do not contain a reason phrase in the start-line +* AbstractCommand commands are now invokable +* Added a way to get the data used when signing an Oauth request before a request is sent + +## 2.8.4 - 2012-08-15 + +* Bug: Custom delay time calculations are no longer ignored in the ExponentialBackoffPlugin +* Added the ability to transfer entity bodies as a string rather than streamed. This gets around curl error 65. Set `body_as_string` in a request's curl options to enable. +* Added a StreamInterface, EntityBodyInterface, and added ftell() to Guzzle\Common\Stream +* Added an AbstractEntityBodyDecorator and a ReadLimitEntityBody decorator to transfer only a subset of a decorated stream +* Stream and EntityBody objects will now return the file position to the previous position after a read required operation (e.g. getContentMd5()) +* Added additional response status codes +* Removed SSL information from the default User-Agent header +* DELETE requests can now send an entity body +* Added an EventDispatcher to the ExponentialBackoffPlugin and added an ExponentialBackoffLogger to log backoff retries +* Added the ability of the MockPlugin to consume mocked request bodies +* LogPlugin now exposes request and response objects in the extras array + +## 2.8.3 - 2012-07-30 + +* Bug: Fixed a case where empty POST requests were sent as GET requests +* Bug: Fixed a bug in ExponentialBackoffPlugin that caused fatal errors when retrying an EntityEnclosingRequest that does not have a body +* Bug: Setting the response body of a request to null after completing a request, not when setting the state of a request to new +* Added multiple inheritance to service description commands +* Added an ApiCommandInterface and added `getParamNames()` and `hasParam()` +* Removed the default 2mb size cutoff from the Md5ValidatorPlugin so that it now defaults to validating everything +* Changed CurlMulti::perform to pass a smaller timeout to CurlMulti::executeHandles + +## 2.8.2 - 2012-07-24 + +* Bug: Query string values set to 0 are no longer dropped from the query string +* Bug: A Collection object is no longer created each time a call is made to `Guzzle\Service\Command\AbstractCommand::getRequestHeaders()` +* Bug: `+` is now treated as an encoded space when parsing query strings +* QueryString and Collection performance improvements +* Allowing dot notation for class paths in filters attribute of a service descriptions + +## 2.8.1 - 2012-07-16 + +* Loosening Event Dispatcher dependency +* POST redirects can now be customized using CURLOPT_POSTREDIR + +## 2.8.0 - 2012-07-15 + +* BC: Guzzle\Http\Query + * Query strings with empty variables will always show an equal sign unless the variable is set to QueryString::BLANK (e.g. ?acl= vs ?acl) + * Changed isEncodingValues() and isEncodingFields() to isUrlEncoding() + * Changed setEncodeValues(bool) and setEncodeFields(bool) to useUrlEncoding(bool) + * Changed the aggregation functions of QueryString to be static methods + * Can now use fromString() with querystrings that have a leading ? +* cURL configuration values can be specified in service descriptions using `curl.` prefixed parameters +* Content-Length is set to 0 before emitting the request.before_send event when sending an empty request body +* Cookies are no longer URL decoded by default +* Bug: URI template variables set to null are no longer expanded + +## 2.7.2 - 2012-07-02 + +* BC: Moving things to get ready for subtree splits. Moving Inflection into Common. Moving Guzzle\Http\Parser to Guzzle\Parser. +* BC: Removing Guzzle\Common\Batch\Batch::count() and replacing it with isEmpty() +* CachePlugin now allows for a custom request parameter function to check if a request can be cached +* Bug fix: CachePlugin now only caches GET and HEAD requests by default +* Bug fix: Using header glue when transferring headers over the wire +* Allowing deeply nested arrays for composite variables in URI templates +* Batch divisors can now return iterators or arrays + +## 2.7.1 - 2012-06-26 + +* Minor patch to update version number in UA string +* Updating build process + +## 2.7.0 - 2012-06-25 + +* BC: Inflection classes moved to Guzzle\Inflection. No longer static methods. Can now inject custom inflectors into classes. +* BC: Removed magic setX methods from commands +* BC: Magic methods mapped to service description commands are now inflected in the command factory rather than the client __call() method +* Verbose cURL options are no longer enabled by default. Set curl.debug to true on a client to enable. +* Bug: Now allowing colons in a response start-line (e.g. HTTP/1.1 503 Service Unavailable: Back-end server is at capacity) +* Guzzle\Service\Resource\ResourceIteratorApplyBatched now internally uses the Guzzle\Common\Batch namespace +* Added Guzzle\Service\Plugin namespace and a PluginCollectionPlugin +* Added the ability to set POST fields and files in a service description +* Guzzle\Http\EntityBody::factory() now accepts objects with a __toString() method +* Adding a command.before_prepare event to clients +* Added BatchClosureTransfer and BatchClosureDivisor +* BatchTransferException now includes references to the batch divisor and transfer strategies +* Fixed some tests so that they pass more reliably +* Added Guzzle\Common\Log\ArrayLogAdapter + +## 2.6.6 - 2012-06-10 + +* BC: Removing Guzzle\Http\Plugin\BatchQueuePlugin +* BC: Removing Guzzle\Service\Command\CommandSet +* Adding generic batching system (replaces the batch queue plugin and command set) +* Updating ZF cache and log adapters and now using ZF's composer repository +* Bug: Setting the name of each ApiParam when creating through an ApiCommand +* Adding result_type, result_doc, deprecated, and doc_url to service descriptions +* Bug: Changed the default cookie header casing back to 'Cookie' + +## 2.6.5 - 2012-06-03 + +* BC: Renaming Guzzle\Http\Message\RequestInterface::getResourceUri() to getResource() +* BC: Removing unused AUTH_BASIC and AUTH_DIGEST constants from +* BC: Guzzle\Http\Cookie is now used to manage Set-Cookie data, not Cookie data +* BC: Renaming methods in the CookieJarInterface +* Moving almost all cookie logic out of the CookiePlugin and into the Cookie or CookieJar implementations +* Making the default glue for HTTP headers ';' instead of ',' +* Adding a removeValue to Guzzle\Http\Message\Header +* Adding getCookies() to request interface. +* Making it easier to add event subscribers to HasDispatcherInterface classes. Can now directly call addSubscriber() + +## 2.6.4 - 2012-05-30 + +* BC: Cleaning up how POST files are stored in EntityEnclosingRequest objects. Adding PostFile class. +* BC: Moving ApiCommand specific functionality from the Inspector and on to the ApiCommand +* Bug: Fixing magic method command calls on clients +* Bug: Email constraint only validates strings +* Bug: Aggregate POST fields when POST files are present in curl handle +* Bug: Fixing default User-Agent header +* Bug: Only appending or prepending parameters in commands if they are specified +* Bug: Not requiring response reason phrases or status codes to match a predefined list of codes +* Allowing the use of dot notation for class namespaces when using instance_of constraint +* Added any_match validation constraint +* Added an AsyncPlugin +* Passing request object to the calculateWait method of the ExponentialBackoffPlugin +* Allowing the result of a command object to be changed +* Parsing location and type sub values when instantiating a service description rather than over and over at runtime + +## 2.6.3 - 2012-05-23 + +* [BC] Guzzle\Common\FromConfigInterface no longer requires any config options. +* [BC] Refactoring how POST files are stored on an EntityEnclosingRequest. They are now separate from POST fields. +* You can now use an array of data when creating PUT request bodies in the request factory. +* Removing the requirement that HTTPS requests needed a Cache-Control: public directive to be cacheable. +* [Http] Adding support for Content-Type in multipart POST uploads per upload +* [Http] Added support for uploading multiple files using the same name (foo[0], foo[1]) +* Adding more POST data operations for easier manipulation of POST data. +* You can now set empty POST fields. +* The body of a request is only shown on EntityEnclosingRequest objects that do not use POST files. +* Split the Guzzle\Service\Inspector::validateConfig method into two methods. One to initialize when a command is created, and one to validate. +* CS updates + +## 2.6.2 - 2012-05-19 + +* [Http] Better handling of nested scope requests in CurlMulti. Requests are now always prepares in the send() method rather than the addRequest() method. + +## 2.6.1 - 2012-05-19 + +* [BC] Removing 'path' support in service descriptions. Use 'uri'. +* [BC] Guzzle\Service\Inspector::parseDocBlock is now protected. Adding getApiParamsForClass() with cache. +* [BC] Removing Guzzle\Common\NullObject. Use https://github.com/mtdowling/NullObject if you need it. +* [BC] Removing Guzzle\Common\XmlElement. +* All commands, both dynamic and concrete, have ApiCommand objects. +* Adding a fix for CurlMulti so that if all of the connections encounter some sort of curl error, then the loop exits. +* Adding checks to EntityEnclosingRequest so that empty POST files and fields are ignored. +* Making the method signature of Guzzle\Service\Builder\ServiceBuilder::factory more flexible. + +## 2.6.0 - 2012-05-15 + +* [BC] Moving Guzzle\Service\Builder to Guzzle\Service\Builder\ServiceBuilder +* [BC] Executing a Command returns the result of the command rather than the command +* [BC] Moving all HTTP parsing logic to Guzzle\Http\Parsers. Allows for faster C implementations if needed. +* [BC] Changing the Guzzle\Http\Message\Response::setProtocol() method to accept a protocol and version in separate args. +* [BC] Moving ResourceIterator* to Guzzle\Service\Resource +* [BC] Completely refactored ResourceIterators to iterate over a cloned command object +* [BC] Moved Guzzle\Http\UriTemplate to Guzzle\Http\Parser\UriTemplate\UriTemplate +* [BC] Guzzle\Guzzle is now deprecated +* Moving Guzzle\Common\Guzzle::inject to Guzzle\Common\Collection::inject +* Adding Guzzle\Version class to give version information about Guzzle +* Adding Guzzle\Http\Utils class to provide getDefaultUserAgent() and getHttpDate() +* Adding Guzzle\Curl\CurlVersion to manage caching curl_version() data +* ServiceDescription and ServiceBuilder are now cacheable using similar configs +* Changing the format of XML and JSON service builder configs. Backwards compatible. +* Cleaned up Cookie parsing +* Trimming the default Guzzle User-Agent header +* Adding a setOnComplete() method to Commands that is called when a command completes +* Keeping track of requests that were mocked in the MockPlugin +* Fixed a caching bug in the CacheAdapterFactory +* Inspector objects can be injected into a Command object +* Refactoring a lot of code and tests to be case insensitive when dealing with headers +* Adding Guzzle\Http\Message\HeaderComparison for easy comparison of HTTP headers using a DSL +* Adding the ability to set global option overrides to service builder configs +* Adding the ability to include other service builder config files from within XML and JSON files +* Moving the parseQuery method out of Url and on to QueryString::fromString() as a static factory method. + +## 2.5.0 - 2012-05-08 + +* Major performance improvements +* [BC] Simplifying Guzzle\Common\Collection. Please check to see if you are using features that are now deprecated. +* [BC] Using a custom validation system that allows a flyweight implementation for much faster validation. No longer using Symfony2 Validation component. +* [BC] No longer supporting "{{ }}" for injecting into command or UriTemplates. Use "{}" +* Added the ability to passed parameters to all requests created by a client +* Added callback functionality to the ExponentialBackoffPlugin +* Using microtime in ExponentialBackoffPlugin to allow more granular backoff strategies. +* Rewinding request stream bodies when retrying requests +* Exception is thrown when JSON response body cannot be decoded +* Added configurable magic method calls to clients and commands. This is off by default. +* Fixed a defect that added a hash to every parsed URL part +* Fixed duplicate none generation for OauthPlugin. +* Emitting an event each time a client is generated by a ServiceBuilder +* Using an ApiParams object instead of a Collection for parameters of an ApiCommand +* cache.* request parameters should be renamed to params.cache.* +* Added the ability to set arbitrary curl options on requests (disable_wire, progress, etc.). See CurlHandle. +* Added the ability to disable type validation of service descriptions +* ServiceDescriptions and ServiceBuilders are now Serializable diff --git a/vendor/guzzlehttp/guzzle/LICENSE b/vendor/guzzlehttp/guzzle/LICENSE new file mode 100644 index 0000000..50a177b --- /dev/null +++ b/vendor/guzzlehttp/guzzle/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2011-2018 Michael Dowling, https://github.com/mtdowling + +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/guzzlehttp/guzzle/README.md b/vendor/guzzlehttp/guzzle/README.md new file mode 100644 index 0000000..bcd18b8 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/README.md @@ -0,0 +1,91 @@ +Guzzle, PHP HTTP client +======================= + +[![Latest Version](https://img.shields.io/github/release/guzzle/guzzle.svg?style=flat-square)](https://github.com/guzzle/guzzle/releases) +[![Build Status](https://img.shields.io/travis/guzzle/guzzle.svg?style=flat-square)](https://travis-ci.org/guzzle/guzzle) +[![Total Downloads](https://img.shields.io/packagist/dt/guzzlehttp/guzzle.svg?style=flat-square)](https://packagist.org/packages/guzzlehttp/guzzle) + +Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and +trivial to integrate with web services. + +- Simple interface for building query strings, POST requests, streaming large + uploads, streaming large downloads, using HTTP cookies, uploading JSON data, + etc... +- Can send both synchronous and asynchronous requests using the same interface. +- Uses PSR-7 interfaces for requests, responses, and streams. This allows you + to utilize other PSR-7 compatible libraries with Guzzle. +- Abstracts away the underlying HTTP transport, allowing you to write + environment and transport agnostic code; i.e., no hard dependency on cURL, + PHP streams, sockets, or non-blocking event loops. +- Middleware system allows you to augment and compose client behavior. + +```php +$client = new \GuzzleHttp\Client(); +$res = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle'); +echo $res->getStatusCode(); +// 200 +echo $res->getHeaderLine('content-type'); +// 'application/json; charset=utf8' +echo $res->getBody(); +// '{"id": 1420053, "name": "guzzle", ...}' + +// Send an asynchronous request. +$request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org'); +$promise = $client->sendAsync($request)->then(function ($response) { + echo 'I completed! ' . $response->getBody(); +}); +$promise->wait(); +``` + +## Help and docs + +- [Documentation](http://guzzlephp.org/) +- [Stack Overflow](http://stackoverflow.com/questions/tagged/guzzle) +- [Gitter](https://gitter.im/guzzle/guzzle) + + +## Installing Guzzle + +The recommended way to install Guzzle is through +[Composer](http://getcomposer.org). + +```bash +# Install Composer +curl -sS https://getcomposer.org/installer | php +``` + +Next, run the Composer command to install the latest stable version of Guzzle: + +```bash +php composer.phar require guzzlehttp/guzzle +``` + +After installing, you need to require Composer's autoloader: + +```php +require 'vendor/autoload.php'; +``` + +You can then later update Guzzle using composer: + + ```bash +composer.phar update + ``` + + +## Version Guidance + +| Version | Status | Packagist | Namespace | Repo | Docs | PSR-7 | PHP Version | +|---------|------------|---------------------|--------------|---------------------|---------------------|-------|-------------| +| 3.x | EOL | `guzzle/guzzle` | `Guzzle` | [v3][guzzle-3-repo] | [v3][guzzle-3-docs] | No | >= 5.3.3 | +| 4.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v4][guzzle-4-repo] | N/A | No | >= 5.4 | +| 5.x | Maintained | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No | >= 5.4 | +| 6.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes | >= 5.5 | + +[guzzle-3-repo]: https://github.com/guzzle/guzzle3 +[guzzle-4-repo]: https://github.com/guzzle/guzzle/tree/4.x +[guzzle-5-repo]: https://github.com/guzzle/guzzle/tree/5.3 +[guzzle-6-repo]: https://github.com/guzzle/guzzle +[guzzle-3-docs]: http://guzzle3.readthedocs.org/en/latest/ +[guzzle-5-docs]: http://guzzle.readthedocs.org/en/5.3/ +[guzzle-6-docs]: http://guzzle.readthedocs.org/en/latest/ diff --git a/vendor/guzzlehttp/guzzle/UPGRADING.md b/vendor/guzzlehttp/guzzle/UPGRADING.md new file mode 100644 index 0000000..91d1dcc --- /dev/null +++ b/vendor/guzzlehttp/guzzle/UPGRADING.md @@ -0,0 +1,1203 @@ +Guzzle Upgrade Guide +==================== + +5.0 to 6.0 +---------- + +Guzzle now uses [PSR-7](http://www.php-fig.org/psr/psr-7/) for HTTP messages. +Due to the fact that these messages are immutable, this prompted a refactoring +of Guzzle to use a middleware based system rather than an event system. Any +HTTP message interaction (e.g., `GuzzleHttp\Message\Request`) need to be +updated to work with the new immutable PSR-7 request and response objects. Any +event listeners or subscribers need to be updated to become middleware +functions that wrap handlers (or are injected into a +`GuzzleHttp\HandlerStack`). + +- Removed `GuzzleHttp\BatchResults` +- Removed `GuzzleHttp\Collection` +- Removed `GuzzleHttp\HasDataTrait` +- Removed `GuzzleHttp\ToArrayInterface` +- The `guzzlehttp/streams` dependency has been removed. Stream functionality + is now present in the `GuzzleHttp\Psr7` namespace provided by the + `guzzlehttp/psr7` package. +- Guzzle no longer uses ReactPHP promises and now uses the + `guzzlehttp/promises` library. We use a custom promise library for three + significant reasons: + 1. React promises (at the time of writing this) are recursive. Promise + chaining and promise resolution will eventually blow the stack. Guzzle + promises are not recursive as they use a sort of trampolining technique. + Note: there has been movement in the React project to modify promises to + no longer utilize recursion. + 2. Guzzle needs to have the ability to synchronously block on a promise to + wait for a result. Guzzle promises allows this functionality (and does + not require the use of recursion). + 3. Because we need to be able to wait on a result, doing so using React + promises requires wrapping react promises with RingPHP futures. This + overhead is no longer needed, reducing stack sizes, reducing complexity, + and improving performance. +- `GuzzleHttp\Mimetypes` has been moved to a function in + `GuzzleHttp\Psr7\mimetype_from_extension` and + `GuzzleHttp\Psr7\mimetype_from_filename`. +- `GuzzleHttp\Query` and `GuzzleHttp\QueryParser` have been removed. Query + strings must now be passed into request objects as strings, or provided to + the `query` request option when creating requests with clients. The `query` + option uses PHP's `http_build_query` to convert an array to a string. If you + need a different serialization technique, you will need to pass the query + string in as a string. There are a couple helper functions that will make + working with query strings easier: `GuzzleHttp\Psr7\parse_query` and + `GuzzleHttp\Psr7\build_query`. +- Guzzle no longer has a dependency on RingPHP. Due to the use of a middleware + system based on PSR-7, using RingPHP and it's middleware system as well adds + more complexity than the benefits it provides. All HTTP handlers that were + present in RingPHP have been modified to work directly with PSR-7 messages + and placed in the `GuzzleHttp\Handler` namespace. This significantly reduces + complexity in Guzzle, removes a dependency, and improves performance. RingPHP + will be maintained for Guzzle 5 support, but will no longer be a part of + Guzzle 6. +- As Guzzle now uses a middleware based systems the event system and RingPHP + integration has been removed. Note: while the event system has been removed, + it is possible to add your own type of event system that is powered by the + middleware system. + - Removed the `Event` namespace. + - Removed the `Subscriber` namespace. + - Removed `Transaction` class + - Removed `RequestFsm` + - Removed `RingBridge` + - `GuzzleHttp\Subscriber\Cookie` is now provided by + `GuzzleHttp\Middleware::cookies` + - `GuzzleHttp\Subscriber\HttpError` is now provided by + `GuzzleHttp\Middleware::httpError` + - `GuzzleHttp\Subscriber\History` is now provided by + `GuzzleHttp\Middleware::history` + - `GuzzleHttp\Subscriber\Mock` is now provided by + `GuzzleHttp\Handler\MockHandler` + - `GuzzleHttp\Subscriber\Prepare` is now provided by + `GuzzleHttp\PrepareBodyMiddleware` + - `GuzzleHttp\Subscriber\Redirect` is now provided by + `GuzzleHttp\RedirectMiddleware` +- Guzzle now uses `Psr\Http\Message\UriInterface` (implements in + `GuzzleHttp\Psr7\Uri`) for URI support. `GuzzleHttp\Url` is now gone. +- Static functions in `GuzzleHttp\Utils` have been moved to namespaced + functions under the `GuzzleHttp` namespace. This requires either a Composer + based autoloader or you to include functions.php. +- `GuzzleHttp\ClientInterface::getDefaultOption` has been renamed to + `GuzzleHttp\ClientInterface::getConfig`. +- `GuzzleHttp\ClientInterface::setDefaultOption` has been removed. +- The `json` and `xml` methods of response objects has been removed. With the + migration to strictly adhering to PSR-7 as the interface for Guzzle messages, + adding methods to message interfaces would actually require Guzzle messages + to extend from PSR-7 messages rather then work with them directly. + +## Migrating to middleware + +The change to PSR-7 unfortunately required significant refactoring to Guzzle +due to the fact that PSR-7 messages are immutable. Guzzle 5 relied on an event +system from plugins. The event system relied on mutability of HTTP messages and +side effects in order to work. With immutable messages, you have to change your +workflow to become more about either returning a value (e.g., functional +middlewares) or setting a value on an object. Guzzle v6 has chosen the +functional middleware approach. + +Instead of using the event system to listen for things like the `before` event, +you now create a stack based middleware function that intercepts a request on +the way in and the promise of the response on the way out. This is a much +simpler and more predictable approach than the event system and works nicely +with PSR-7 middleware. Due to the use of promises, the middleware system is +also asynchronous. + +v5: + +```php +use GuzzleHttp\Event\BeforeEvent; +$client = new GuzzleHttp\Client(); +// Get the emitter and listen to the before event. +$client->getEmitter()->on('before', function (BeforeEvent $e) { + // Guzzle v5 events relied on mutation + $e->getRequest()->setHeader('X-Foo', 'Bar'); +}); +``` + +v6: + +In v6, you can modify the request before it is sent using the `mapRequest` +middleware. The idiomatic way in v6 to modify the request/response lifecycle is +to setup a handler middleware stack up front and inject the handler into a +client. + +```php +use GuzzleHttp\Middleware; +// Create a handler stack that has all of the default middlewares attached +$handler = GuzzleHttp\HandlerStack::create(); +// Push the handler onto the handler stack +$handler->push(Middleware::mapRequest(function (RequestInterface $request) { + // Notice that we have to return a request object + return $request->withHeader('X-Foo', 'Bar'); +})); +// Inject the handler into the client +$client = new GuzzleHttp\Client(['handler' => $handler]); +``` + +## POST Requests + +This version added the [`form_params`](http://guzzle.readthedocs.org/en/latest/request-options.html#form_params) +and `multipart` request options. `form_params` is an associative array of +strings or array of strings and is used to serialize an +`application/x-www-form-urlencoded` POST request. The +[`multipart`](http://guzzle.readthedocs.org/en/latest/request-options.html#multipart) +option is now used to send a multipart/form-data POST request. + +`GuzzleHttp\Post\PostFile` has been removed. Use the `multipart` option to add +POST files to a multipart/form-data request. + +The `body` option no longer accepts an array to send POST requests. Please use +`multipart` or `form_params` instead. + +The `base_url` option has been renamed to `base_uri`. + +4.x to 5.0 +---------- + +## Rewritten Adapter Layer + +Guzzle now uses [RingPHP](http://ringphp.readthedocs.org/en/latest) to send +HTTP requests. The `adapter` option in a `GuzzleHttp\Client` constructor +is still supported, but it has now been renamed to `handler`. Instead of +passing a `GuzzleHttp\Adapter\AdapterInterface`, you must now pass a PHP +`callable` that follows the RingPHP specification. + +## Removed Fluent Interfaces + +[Fluent interfaces were removed](http://ocramius.github.io/blog/fluent-interfaces-are-evil) +from the following classes: + +- `GuzzleHttp\Collection` +- `GuzzleHttp\Url` +- `GuzzleHttp\Query` +- `GuzzleHttp\Post\PostBody` +- `GuzzleHttp\Cookie\SetCookie` + +## Removed functions.php + +Removed "functions.php", so that Guzzle is truly PSR-4 compliant. The following +functions can be used as replacements. + +- `GuzzleHttp\json_decode` -> `GuzzleHttp\Utils::jsonDecode` +- `GuzzleHttp\get_path` -> `GuzzleHttp\Utils::getPath` +- `GuzzleHttp\Utils::setPath` -> `GuzzleHttp\set_path` +- `GuzzleHttp\Pool::batch` -> `GuzzleHttp\batch`. This function is, however, + deprecated in favor of using `GuzzleHttp\Pool::batch()`. + +The "procedural" global client has been removed with no replacement (e.g., +`GuzzleHttp\get()`, `GuzzleHttp\post()`, etc.). Use a `GuzzleHttp\Client` +object as a replacement. + +## `throwImmediately` has been removed + +The concept of "throwImmediately" has been removed from exceptions and error +events. This control mechanism was used to stop a transfer of concurrent +requests from completing. This can now be handled by throwing the exception or +by cancelling a pool of requests or each outstanding future request +individually. + +## headers event has been removed + +Removed the "headers" event. This event was only useful for changing the +body a response once the headers of the response were known. You can implement +a similar behavior in a number of ways. One example might be to use a +FnStream that has access to the transaction being sent. For example, when the +first byte is written, you could check if the response headers match your +expectations, and if so, change the actual stream body that is being +written to. + +## Updates to HTTP Messages + +Removed the `asArray` parameter from +`GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header +value as an array, then use the newly added `getHeaderAsArray()` method of +`MessageInterface`. This change makes the Guzzle interfaces compatible with +the PSR-7 interfaces. + +3.x to 4.0 +---------- + +## Overarching changes: + +- Now requires PHP 5.4 or greater. +- No longer requires cURL to send requests. +- Guzzle no longer wraps every exception it throws. Only exceptions that are + recoverable are now wrapped by Guzzle. +- Various namespaces have been removed or renamed. +- No longer requiring the Symfony EventDispatcher. A custom event dispatcher + based on the Symfony EventDispatcher is + now utilized in `GuzzleHttp\Event\EmitterInterface` (resulting in significant + speed and functionality improvements). + +Changes per Guzzle 3.x namespace are described below. + +## Batch + +The `Guzzle\Batch` namespace has been removed. This is best left to +third-parties to implement on top of Guzzle's core HTTP library. + +## Cache + +The `Guzzle\Cache` namespace has been removed. (Todo: No suitable replacement +has been implemented yet, but hoping to utilize a PSR cache interface). + +## Common + +- Removed all of the wrapped exceptions. It's better to use the standard PHP + library for unrecoverable exceptions. +- `FromConfigInterface` has been removed. +- `Guzzle\Common\Version` has been removed. The VERSION constant can be found + at `GuzzleHttp\ClientInterface::VERSION`. + +### Collection + +- `getAll` has been removed. Use `toArray` to convert a collection to an array. +- `inject` has been removed. +- `keySearch` has been removed. +- `getPath` no longer supports wildcard expressions. Use something better like + JMESPath for this. +- `setPath` now supports appending to an existing array via the `[]` notation. + +### Events + +Guzzle no longer requires Symfony's EventDispatcher component. Guzzle now uses +`GuzzleHttp\Event\Emitter`. + +- `Symfony\Component\EventDispatcher\EventDispatcherInterface` is replaced by + `GuzzleHttp\Event\EmitterInterface`. +- `Symfony\Component\EventDispatcher\EventDispatcher` is replaced by + `GuzzleHttp\Event\Emitter`. +- `Symfony\Component\EventDispatcher\Event` is replaced by + `GuzzleHttp\Event\Event`, and Guzzle now has an EventInterface in + `GuzzleHttp\Event\EventInterface`. +- `AbstractHasDispatcher` has moved to a trait, `HasEmitterTrait`, and + `HasDispatcherInterface` has moved to `HasEmitterInterface`. Retrieving the + event emitter of a request, client, etc. now uses the `getEmitter` method + rather than the `getDispatcher` method. + +#### Emitter + +- Use the `once()` method to add a listener that automatically removes itself + the first time it is invoked. +- Use the `listeners()` method to retrieve a list of event listeners rather than + the `getListeners()` method. +- Use `emit()` instead of `dispatch()` to emit an event from an emitter. +- Use `attach()` instead of `addSubscriber()` and `detach()` instead of + `removeSubscriber()`. + +```php +$mock = new Mock(); +// 3.x +$request->getEventDispatcher()->addSubscriber($mock); +$request->getEventDispatcher()->removeSubscriber($mock); +// 4.x +$request->getEmitter()->attach($mock); +$request->getEmitter()->detach($mock); +``` + +Use the `on()` method to add a listener rather than the `addListener()` method. + +```php +// 3.x +$request->getEventDispatcher()->addListener('foo', function (Event $event) { /* ... */ } ); +// 4.x +$request->getEmitter()->on('foo', function (Event $event, $name) { /* ... */ } ); +``` + +## Http + +### General changes + +- The cacert.pem certificate has been moved to `src/cacert.pem`. +- Added the concept of adapters that are used to transfer requests over the + wire. +- Simplified the event system. +- Sending requests in parallel is still possible, but batching is no longer a + concept of the HTTP layer. Instead, you must use the `complete` and `error` + events to asynchronously manage parallel request transfers. +- `Guzzle\Http\Url` has moved to `GuzzleHttp\Url`. +- `Guzzle\Http\QueryString` has moved to `GuzzleHttp\Query`. +- QueryAggregators have been rewritten so that they are simply callable + functions. +- `GuzzleHttp\StaticClient` has been removed. Use the functions provided in + `functions.php` for an easy to use static client instance. +- Exceptions in `GuzzleHttp\Exception` have been updated to all extend from + `GuzzleHttp\Exception\TransferException`. + +### Client + +Calling methods like `get()`, `post()`, `head()`, etc. no longer create and +return a request, but rather creates a request, sends the request, and returns +the response. + +```php +// 3.0 +$request = $client->get('/'); +$response = $request->send(); + +// 4.0 +$response = $client->get('/'); + +// or, to mirror the previous behavior +$request = $client->createRequest('GET', '/'); +$response = $client->send($request); +``` + +`GuzzleHttp\ClientInterface` has changed. + +- The `send` method no longer accepts more than one request. Use `sendAll` to + send multiple requests in parallel. +- `setUserAgent()` has been removed. Use a default request option instead. You + could, for example, do something like: + `$client->setConfig('defaults/headers/User-Agent', 'Foo/Bar ' . $client::getDefaultUserAgent())`. +- `setSslVerification()` has been removed. Use default request options instead, + like `$client->setConfig('defaults/verify', true)`. + +`GuzzleHttp\Client` has changed. + +- The constructor now accepts only an associative array. You can include a + `base_url` string or array to use a URI template as the base URL of a client. + You can also specify a `defaults` key that is an associative array of default + request options. You can pass an `adapter` to use a custom adapter, + `batch_adapter` to use a custom adapter for sending requests in parallel, or + a `message_factory` to change the factory used to create HTTP requests and + responses. +- The client no longer emits a `client.create_request` event. +- Creating requests with a client no longer automatically utilize a URI + template. You must pass an array into a creational method (e.g., + `createRequest`, `get`, `put`, etc.) in order to expand a URI template. + +### Messages + +Messages no longer have references to their counterparts (i.e., a request no +longer has a reference to it's response, and a response no loger has a +reference to its request). This association is now managed through a +`GuzzleHttp\Adapter\TransactionInterface` object. You can get references to +these transaction objects using request events that are emitted over the +lifecycle of a request. + +#### Requests with a body + +- `GuzzleHttp\Message\EntityEnclosingRequest` and + `GuzzleHttp\Message\EntityEnclosingRequestInterface` have been removed. The + separation between requests that contain a body and requests that do not + contain a body has been removed, and now `GuzzleHttp\Message\RequestInterface` + handles both use cases. +- Any method that previously accepts a `GuzzleHttp\Response` object now accept a + `GuzzleHttp\Message\ResponseInterface`. +- `GuzzleHttp\Message\RequestFactoryInterface` has been renamed to + `GuzzleHttp\Message\MessageFactoryInterface`. This interface is used to create + both requests and responses and is implemented in + `GuzzleHttp\Message\MessageFactory`. +- POST field and file methods have been removed from the request object. You + must now use the methods made available to `GuzzleHttp\Post\PostBodyInterface` + to control the format of a POST body. Requests that are created using a + standard `GuzzleHttp\Message\MessageFactoryInterface` will automatically use + a `GuzzleHttp\Post\PostBody` body if the body was passed as an array or if + the method is POST and no body is provided. + +```php +$request = $client->createRequest('POST', '/'); +$request->getBody()->setField('foo', 'bar'); +$request->getBody()->addFile(new PostFile('file_key', fopen('/path/to/content', 'r'))); +``` + +#### Headers + +- `GuzzleHttp\Message\Header` has been removed. Header values are now simply + represented by an array of values or as a string. Header values are returned + as a string by default when retrieving a header value from a message. You can + pass an optional argument of `true` to retrieve a header value as an array + of strings instead of a single concatenated string. +- `GuzzleHttp\PostFile` and `GuzzleHttp\PostFileInterface` have been moved to + `GuzzleHttp\Post`. This interface has been simplified and now allows the + addition of arbitrary headers. +- Custom headers like `GuzzleHttp\Message\Header\Link` have been removed. Most + of the custom headers are now handled separately in specific + subscribers/plugins, and `GuzzleHttp\Message\HeaderValues::parseParams()` has + been updated to properly handle headers that contain parameters (like the + `Link` header). + +#### Responses + +- `GuzzleHttp\Message\Response::getInfo()` and + `GuzzleHttp\Message\Response::setInfo()` have been removed. Use the event + system to retrieve this type of information. +- `GuzzleHttp\Message\Response::getRawHeaders()` has been removed. +- `GuzzleHttp\Message\Response::getMessage()` has been removed. +- `GuzzleHttp\Message\Response::calculateAge()` and other cache specific + methods have moved to the CacheSubscriber. +- Header specific helper functions like `getContentMd5()` have been removed. + Just use `getHeader('Content-MD5')` instead. +- `GuzzleHttp\Message\Response::setRequest()` and + `GuzzleHttp\Message\Response::getRequest()` have been removed. Use the event + system to work with request and response objects as a transaction. +- `GuzzleHttp\Message\Response::getRedirectCount()` has been removed. Use the + Redirect subscriber instead. +- `GuzzleHttp\Message\Response::isSuccessful()` and other related methods have + been removed. Use `getStatusCode()` instead. + +#### Streaming responses + +Streaming requests can now be created by a client directly, returning a +`GuzzleHttp\Message\ResponseInterface` object that contains a body stream +referencing an open PHP HTTP stream. + +```php +// 3.0 +use Guzzle\Stream\PhpStreamRequestFactory; +$request = $client->get('/'); +$factory = new PhpStreamRequestFactory(); +$stream = $factory->fromRequest($request); +$data = $stream->read(1024); + +// 4.0 +$response = $client->get('/', ['stream' => true]); +// Read some data off of the stream in the response body +$data = $response->getBody()->read(1024); +``` + +#### Redirects + +The `configureRedirects()` method has been removed in favor of a +`allow_redirects` request option. + +```php +// Standard redirects with a default of a max of 5 redirects +$request = $client->createRequest('GET', '/', ['allow_redirects' => true]); + +// Strict redirects with a custom number of redirects +$request = $client->createRequest('GET', '/', [ + 'allow_redirects' => ['max' => 5, 'strict' => true] +]); +``` + +#### EntityBody + +EntityBody interfaces and classes have been removed or moved to +`GuzzleHttp\Stream`. All classes and interfaces that once required +`GuzzleHttp\EntityBodyInterface` now require +`GuzzleHttp\Stream\StreamInterface`. Creating a new body for a request no +longer uses `GuzzleHttp\EntityBody::factory` but now uses +`GuzzleHttp\Stream\Stream::factory` or even better: +`GuzzleHttp\Stream\create()`. + +- `Guzzle\Http\EntityBodyInterface` is now `GuzzleHttp\Stream\StreamInterface` +- `Guzzle\Http\EntityBody` is now `GuzzleHttp\Stream\Stream` +- `Guzzle\Http\CachingEntityBody` is now `GuzzleHttp\Stream\CachingStream` +- `Guzzle\Http\ReadLimitEntityBody` is now `GuzzleHttp\Stream\LimitStream` +- `Guzzle\Http\IoEmittyinEntityBody` has been removed. + +#### Request lifecycle events + +Requests previously submitted a large number of requests. The number of events +emitted over the lifecycle of a request has been significantly reduced to make +it easier to understand how to extend the behavior of a request. All events +emitted during the lifecycle of a request now emit a custom +`GuzzleHttp\Event\EventInterface` object that contains context providing +methods and a way in which to modify the transaction at that specific point in +time (e.g., intercept the request and set a response on the transaction). + +- `request.before_send` has been renamed to `before` and now emits a + `GuzzleHttp\Event\BeforeEvent` +- `request.complete` has been renamed to `complete` and now emits a + `GuzzleHttp\Event\CompleteEvent`. +- `request.sent` has been removed. Use `complete`. +- `request.success` has been removed. Use `complete`. +- `error` is now an event that emits a `GuzzleHttp\Event\ErrorEvent`. +- `request.exception` has been removed. Use `error`. +- `request.receive.status_line` has been removed. +- `curl.callback.progress` has been removed. Use a custom `StreamInterface` to + maintain a status update. +- `curl.callback.write` has been removed. Use a custom `StreamInterface` to + intercept writes. +- `curl.callback.read` has been removed. Use a custom `StreamInterface` to + intercept reads. + +`headers` is a new event that is emitted after the response headers of a +request have been received before the body of the response is downloaded. This +event emits a `GuzzleHttp\Event\HeadersEvent`. + +You can intercept a request and inject a response using the `intercept()` event +of a `GuzzleHttp\Event\BeforeEvent`, `GuzzleHttp\Event\CompleteEvent`, and +`GuzzleHttp\Event\ErrorEvent` event. + +See: http://docs.guzzlephp.org/en/latest/events.html + +## Inflection + +The `Guzzle\Inflection` namespace has been removed. This is not a core concern +of Guzzle. + +## Iterator + +The `Guzzle\Iterator` namespace has been removed. + +- `Guzzle\Iterator\AppendIterator`, `Guzzle\Iterator\ChunkedIterator`, and + `Guzzle\Iterator\MethodProxyIterator` are nice, but not a core requirement of + Guzzle itself. +- `Guzzle\Iterator\FilterIterator` is no longer needed because an equivalent + class is shipped with PHP 5.4. +- `Guzzle\Iterator\MapIterator` is not really needed when using PHP 5.5 because + it's easier to just wrap an iterator in a generator that maps values. + +For a replacement of these iterators, see https://github.com/nikic/iter + +## Log + +The LogPlugin has moved to https://github.com/guzzle/log-subscriber. The +`Guzzle\Log` namespace has been removed. Guzzle now relies on +`Psr\Log\LoggerInterface` for all logging. The MessageFormatter class has been +moved to `GuzzleHttp\Subscriber\Log\Formatter`. + +## Parser + +The `Guzzle\Parser` namespace has been removed. This was previously used to +make it possible to plug in custom parsers for cookies, messages, URI +templates, and URLs; however, this level of complexity is not needed in Guzzle +so it has been removed. + +- Cookie: Cookie parsing logic has been moved to + `GuzzleHttp\Cookie\SetCookie::fromString`. +- Message: Message parsing logic for both requests and responses has been moved + to `GuzzleHttp\Message\MessageFactory::fromMessage`. Message parsing is only + used in debugging or deserializing messages, so it doesn't make sense for + Guzzle as a library to add this level of complexity to parsing messages. +- UriTemplate: URI template parsing has been moved to + `GuzzleHttp\UriTemplate`. The Guzzle library will automatically use the PECL + URI template library if it is installed. +- Url: URL parsing is now performed in `GuzzleHttp\Url::fromString` (previously + it was `Guzzle\Http\Url::factory()`). If custom URL parsing is necessary, + then developers are free to subclass `GuzzleHttp\Url`. + +## Plugin + +The `Guzzle\Plugin` namespace has been renamed to `GuzzleHttp\Subscriber`. +Several plugins are shipping with the core Guzzle library under this namespace. + +- `GuzzleHttp\Subscriber\Cookie`: Replaces the old CookiePlugin. Cookie jar + code has moved to `GuzzleHttp\Cookie`. +- `GuzzleHttp\Subscriber\History`: Replaces the old HistoryPlugin. +- `GuzzleHttp\Subscriber\HttpError`: Throws errors when a bad HTTP response is + received. +- `GuzzleHttp\Subscriber\Mock`: Replaces the old MockPlugin. +- `GuzzleHttp\Subscriber\Prepare`: Prepares the body of a request just before + sending. This subscriber is attached to all requests by default. +- `GuzzleHttp\Subscriber\Redirect`: Replaces the RedirectPlugin. + +The following plugins have been removed (third-parties are free to re-implement +these if needed): + +- `GuzzleHttp\Plugin\Async` has been removed. +- `GuzzleHttp\Plugin\CurlAuth` has been removed. +- `GuzzleHttp\Plugin\ErrorResponse\ErrorResponsePlugin` has been removed. This + functionality should instead be implemented with event listeners that occur + after normal response parsing occurs in the guzzle/command package. + +The following plugins are not part of the core Guzzle package, but are provided +in separate repositories: + +- `Guzzle\Http\Plugin\BackoffPlugin` has been rewritten to be much simpler + to build custom retry policies using simple functions rather than various + chained classes. See: https://github.com/guzzle/retry-subscriber +- `Guzzle\Http\Plugin\Cache\CachePlugin` has moved to + https://github.com/guzzle/cache-subscriber +- `Guzzle\Http\Plugin\Log\LogPlugin` has moved to + https://github.com/guzzle/log-subscriber +- `Guzzle\Http\Plugin\Md5\Md5Plugin` has moved to + https://github.com/guzzle/message-integrity-subscriber +- `Guzzle\Http\Plugin\Mock\MockPlugin` has moved to + `GuzzleHttp\Subscriber\MockSubscriber`. +- `Guzzle\Http\Plugin\Oauth\OauthPlugin` has moved to + https://github.com/guzzle/oauth-subscriber + +## Service + +The service description layer of Guzzle has moved into two separate packages: + +- http://github.com/guzzle/command Provides a high level abstraction over web + services by representing web service operations using commands. +- http://github.com/guzzle/guzzle-services Provides an implementation of + guzzle/command that provides request serialization and response parsing using + Guzzle service descriptions. + +## Stream + +Stream have moved to a separate package available at +https://github.com/guzzle/streams. + +`Guzzle\Stream\StreamInterface` has been given a large update to cleanly take +on the responsibilities of `Guzzle\Http\EntityBody` and +`Guzzle\Http\EntityBodyInterface` now that they have been removed. The number +of methods implemented by the `StreamInterface` has been drastically reduced to +allow developers to more easily extend and decorate stream behavior. + +## Removed methods from StreamInterface + +- `getStream` and `setStream` have been removed to better encapsulate streams. +- `getMetadata` and `setMetadata` have been removed in favor of + `GuzzleHttp\Stream\MetadataStreamInterface`. +- `getWrapper`, `getWrapperData`, `getStreamType`, and `getUri` have all been + removed. This data is accessible when + using streams that implement `GuzzleHttp\Stream\MetadataStreamInterface`. +- `rewind` has been removed. Use `seek(0)` for a similar behavior. + +## Renamed methods + +- `detachStream` has been renamed to `detach`. +- `feof` has been renamed to `eof`. +- `ftell` has been renamed to `tell`. +- `readLine` has moved from an instance method to a static class method of + `GuzzleHttp\Stream\Stream`. + +## Metadata streams + +`GuzzleHttp\Stream\MetadataStreamInterface` has been added to denote streams +that contain additional metadata accessible via `getMetadata()`. +`GuzzleHttp\Stream\StreamInterface::getMetadata` and +`GuzzleHttp\Stream\StreamInterface::setMetadata` have been removed. + +## StreamRequestFactory + +The entire concept of the StreamRequestFactory has been removed. The way this +was used in Guzzle 3 broke the actual interface of sending streaming requests +(instead of getting back a Response, you got a StreamInterface). Streaming +PHP requests are now implemented through the `GuzzleHttp\Adapter\StreamAdapter`. + +3.6 to 3.7 +---------- + +### Deprecations + +- You can now enable E_USER_DEPRECATED warnings to see if you are using any deprecated methods.: + +```php +\Guzzle\Common\Version::$emitWarnings = true; +``` + +The following APIs and options have been marked as deprecated: + +- Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use `$request->getResponseBody()->isRepeatable()` instead. +- Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. +- Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. +- Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead. +- Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead. +- Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated +- Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client. +- Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8. +- Marked `Guzzle\Common\Collection::inject()` as deprecated. +- Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use + `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));` or + `$client->setDefaultOption('auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));` + +3.7 introduces `request.options` as a parameter for a client configuration and as an optional argument to all creational +request methods. When paired with a client's configuration settings, these options allow you to specify default settings +for various aspects of a request. Because these options make other previous configuration options redundant, several +configuration options and methods of a client and AbstractCommand have been deprecated. + +- Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use `$client->getDefaultOption('headers')`. +- Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use `$client->setDefaultOption('headers/{header_name}', 'value')`. +- Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use `$client->setDefaultOption('params/{param_name}', 'value')` +- Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand. These will work through Guzzle 4.0 + + $command = $client->getCommand('foo', array( + 'command.headers' => array('Test' => '123'), + 'command.response_body' => '/path/to/file' + )); + + // Should be changed to: + + $command = $client->getCommand('foo', array( + 'command.request_options' => array( + 'headers' => array('Test' => '123'), + 'save_as' => '/path/to/file' + ) + )); + +### Interface changes + +Additions and changes (you will need to update any implementations or subclasses you may have created): + +- Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`: + createRequest, head, delete, put, patch, post, options, prepareRequest +- Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()` +- Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface` +- Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to + `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a + resource, string, or EntityBody into the $options parameter to specify the download location of the response. +- Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a + default `array()` +- Added `Guzzle\Stream\StreamInterface::isRepeatable` +- Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods. + +The following methods were removed from interfaces. All of these methods are still available in the concrete classes +that implement them, but you should update your code to use alternative methods: + +- Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use + `$client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or + `$client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))` or + `$client->setDefaultOption('headers/{header_name}', 'value')`. or + `$client->setDefaultOption('headers', array('header_name' => 'value'))`. +- Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use `$client->getConfig()->getPath('request.options/headers')`. +- Removed `Guzzle\Http\ClientInterface::expandTemplate()`. This is an implementation detail. +- Removed `Guzzle\Http\ClientInterface::setRequestFactory()`. This is an implementation detail. +- Removed `Guzzle\Http\ClientInterface::getCurlMulti()`. This is a very specific implementation detail. +- Removed `Guzzle\Http\Message\RequestInterface::canCache`. Use the CachePlugin. +- Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect`. Use the HistoryPlugin. +- Removed `Guzzle\Http\Message\RequestInterface::isRedirect`. Use the HistoryPlugin. + +### Cache plugin breaking changes + +- CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a + CacheStorageInterface. These two objects and interface will be removed in a future version. +- Always setting X-cache headers on cached responses +- Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin +- `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface + $request, Response $response);` +- `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);` +- `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);` +- Added `CacheStorageInterface::purge($url)` +- `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin + $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache, + CanCacheStrategyInterface $canCache = null)` +- Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)` + +3.5 to 3.6 +---------- + +* Mixed casing of headers are now forced to be a single consistent casing across all values for that header. +* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution +* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader(). + For example, setHeader() first removes the header using unset on a HeaderCollection and then calls addHeader(). + Keeping the Host header and URL host in sync is now handled by overriding the addHeader method in Request. +* Specific header implementations can be created for complex headers. When a message creates a header, it uses a + HeaderFactory which can map specific headers to specific header classes. There is now a Link header and + CacheControl header implementation. +* Moved getLinks() from Response to just be used on a Link header object. + +If you previously relied on Guzzle\Http\Message\Header::raw(), then you will need to update your code to use the +HeaderInterface (e.g. toArray(), getAll(), etc.). + +### Interface changes + +* Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate +* Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti() +* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in + Guzzle\Http\Curl\RequestMediator +* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string. +* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface +* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders() + +### Removed deprecated functions + +* Removed Guzzle\Parser\ParserRegister::get(). Use getParser() +* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser(). + +### Deprecations + +* The ability to case-insensitively search for header values +* Guzzle\Http\Message\Header::hasExactHeader +* Guzzle\Http\Message\Header::raw. Use getAll() +* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object + instead. + +### Other changes + +* All response header helper functions return a string rather than mixing Header objects and strings inconsistently +* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle + directly via interfaces +* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist + but are a no-op until removed. +* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a + `Guzzle\Service\Command\ArrayCommandInterface`. +* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response + on a request while the request is still being transferred +* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess + +3.3 to 3.4 +---------- + +Base URLs of a client now follow the rules of http://tools.ietf.org/html/rfc3986#section-5.2.2 when merging URLs. + +3.2 to 3.3 +---------- + +### Response::getEtag() quote stripping removed + +`Guzzle\Http\Message\Response::getEtag()` no longer strips quotes around the ETag response header + +### Removed `Guzzle\Http\Utils` + +The `Guzzle\Http\Utils` class was removed. This class was only used for testing. + +### Stream wrapper and type + +`Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getStreamType()` are no longer converted to lowercase. + +### curl.emit_io became emit_io + +Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using the +'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io' + +3.1 to 3.2 +---------- + +### CurlMulti is no longer reused globally + +Before 3.2, the same CurlMulti object was reused globally for each client. This can cause issue where plugins added +to a single client can pollute requests dispatched from other clients. + +If you still wish to reuse the same CurlMulti object with each client, then you can add a listener to the +ServiceBuilder's `service_builder.create_client` event to inject a custom CurlMulti object into each client as it is +created. + +```php +$multi = new Guzzle\Http\Curl\CurlMulti(); +$builder = Guzzle\Service\Builder\ServiceBuilder::factory('/path/to/config.json'); +$builder->addListener('service_builder.create_client', function ($event) use ($multi) { + $event['client']->setCurlMulti($multi); +} +}); +``` + +### No default path + +URLs no longer have a default path value of '/' if no path was specified. + +Before: + +```php +$request = $client->get('http://www.foo.com'); +echo $request->getUrl(); +// >> http://www.foo.com/ +``` + +After: + +```php +$request = $client->get('http://www.foo.com'); +echo $request->getUrl(); +// >> http://www.foo.com +``` + +### Less verbose BadResponseException + +The exception message for `Guzzle\Http\Exception\BadResponseException` no longer contains the full HTTP request and +response information. You can, however, get access to the request and response object by calling `getRequest()` or +`getResponse()` on the exception object. + +### Query parameter aggregation + +Multi-valued query parameters are no longer aggregated using a callback function. `Guzzle\Http\Query` now has a +setAggregator() method that accepts a `Guzzle\Http\QueryAggregator\QueryAggregatorInterface` object. This object is +responsible for handling the aggregation of multi-valued query string variables into a flattened hash. + +2.8 to 3.x +---------- + +### Guzzle\Service\Inspector + +Change `\Guzzle\Service\Inspector::fromConfig` to `\Guzzle\Common\Collection::fromConfig` + +**Before** + +```php +use Guzzle\Service\Inspector; + +class YourClient extends \Guzzle\Service\Client +{ + public static function factory($config = array()) + { + $default = array(); + $required = array('base_url', 'username', 'api_key'); + $config = Inspector::fromConfig($config, $default, $required); + + $client = new self( + $config->get('base_url'), + $config->get('username'), + $config->get('api_key') + ); + $client->setConfig($config); + + $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json')); + + return $client; + } +``` + +**After** + +```php +use Guzzle\Common\Collection; + +class YourClient extends \Guzzle\Service\Client +{ + public static function factory($config = array()) + { + $default = array(); + $required = array('base_url', 'username', 'api_key'); + $config = Collection::fromConfig($config, $default, $required); + + $client = new self( + $config->get('base_url'), + $config->get('username'), + $config->get('api_key') + ); + $client->setConfig($config); + + $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json')); + + return $client; + } +``` + +### Convert XML Service Descriptions to JSON + +**Before** + +```xml + + + + + + Get a list of groups + + + Uses a search query to get a list of groups + + + + Create a group + + + + + Delete a group by ID + + + + + + + Update a group + + + + + + +``` + +**After** + +```json +{ + "name": "Zendesk REST API v2", + "apiVersion": "2012-12-31", + "description":"Provides access to Zendesk views, groups, tickets, ticket fields, and users", + "operations": { + "list_groups": { + "httpMethod":"GET", + "uri": "groups.json", + "summary": "Get a list of groups" + }, + "search_groups":{ + "httpMethod":"GET", + "uri": "search.json?query=\"{query} type:group\"", + "summary": "Uses a search query to get a list of groups", + "parameters":{ + "query":{ + "location": "uri", + "description":"Zendesk Search Query", + "type": "string", + "required": true + } + } + }, + "create_group": { + "httpMethod":"POST", + "uri": "groups.json", + "summary": "Create a group", + "parameters":{ + "data": { + "type": "array", + "location": "body", + "description":"Group JSON", + "filters": "json_encode", + "required": true + }, + "Content-Type":{ + "type": "string", + "location":"header", + "static": "application/json" + } + } + }, + "delete_group": { + "httpMethod":"DELETE", + "uri": "groups/{id}.json", + "summary": "Delete a group", + "parameters":{ + "id":{ + "location": "uri", + "description":"Group to delete by ID", + "type": "integer", + "required": true + } + } + }, + "get_group": { + "httpMethod":"GET", + "uri": "groups/{id}.json", + "summary": "Get a ticket", + "parameters":{ + "id":{ + "location": "uri", + "description":"Group to get by ID", + "type": "integer", + "required": true + } + } + }, + "update_group": { + "httpMethod":"PUT", + "uri": "groups/{id}.json", + "summary": "Update a group", + "parameters":{ + "id": { + "location": "uri", + "description":"Group to update by ID", + "type": "integer", + "required": true + }, + "data": { + "type": "array", + "location": "body", + "description":"Group JSON", + "filters": "json_encode", + "required": true + }, + "Content-Type":{ + "type": "string", + "location":"header", + "static": "application/json" + } + } + } +} +``` + +### Guzzle\Service\Description\ServiceDescription + +Commands are now called Operations + +**Before** + +```php +use Guzzle\Service\Description\ServiceDescription; + +$sd = new ServiceDescription(); +$sd->getCommands(); // @returns ApiCommandInterface[] +$sd->hasCommand($name); +$sd->getCommand($name); // @returns ApiCommandInterface|null +$sd->addCommand($command); // @param ApiCommandInterface $command +``` + +**After** + +```php +use Guzzle\Service\Description\ServiceDescription; + +$sd = new ServiceDescription(); +$sd->getOperations(); // @returns OperationInterface[] +$sd->hasOperation($name); +$sd->getOperation($name); // @returns OperationInterface|null +$sd->addOperation($operation); // @param OperationInterface $operation +``` + +### Guzzle\Common\Inflection\Inflector + +Namespace is now `Guzzle\Inflection\Inflector` + +### Guzzle\Http\Plugin + +Namespace is now `Guzzle\Plugin`. Many other changes occur within this namespace and are detailed in their own sections below. + +### Guzzle\Http\Plugin\LogPlugin and Guzzle\Common\Log + +Now `Guzzle\Plugin\Log\LogPlugin` and `Guzzle\Log` respectively. + +**Before** + +```php +use Guzzle\Common\Log\ClosureLogAdapter; +use Guzzle\Http\Plugin\LogPlugin; + +/** @var \Guzzle\Http\Client */ +$client; + +// $verbosity is an integer indicating desired message verbosity level +$client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $verbosity = LogPlugin::LOG_VERBOSE); +``` + +**After** + +```php +use Guzzle\Log\ClosureLogAdapter; +use Guzzle\Log\MessageFormatter; +use Guzzle\Plugin\Log\LogPlugin; + +/** @var \Guzzle\Http\Client */ +$client; + +// $format is a string indicating desired message format -- @see MessageFormatter +$client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $format = MessageFormatter::DEBUG_FORMAT); +``` + +### Guzzle\Http\Plugin\CurlAuthPlugin + +Now `Guzzle\Plugin\CurlAuth\CurlAuthPlugin`. + +### Guzzle\Http\Plugin\ExponentialBackoffPlugin + +Now `Guzzle\Plugin\Backoff\BackoffPlugin`, and other changes. + +**Before** + +```php +use Guzzle\Http\Plugin\ExponentialBackoffPlugin; + +$backoffPlugin = new ExponentialBackoffPlugin($maxRetries, array_merge( + ExponentialBackoffPlugin::getDefaultFailureCodes(), array(429) + )); + +$client->addSubscriber($backoffPlugin); +``` + +**After** + +```php +use Guzzle\Plugin\Backoff\BackoffPlugin; +use Guzzle\Plugin\Backoff\HttpBackoffStrategy; + +// Use convenient factory method instead -- see implementation for ideas of what +// you can do with chaining backoff strategies +$backoffPlugin = BackoffPlugin::getExponentialBackoff($maxRetries, array_merge( + HttpBackoffStrategy::getDefaultFailureCodes(), array(429) + )); +$client->addSubscriber($backoffPlugin); +``` + +### Known Issues + +#### [BUG] Accept-Encoding header behavior changed unintentionally. + +(See #217) (Fixed in 09daeb8c666fb44499a0646d655a8ae36456575e) + +In version 2.8 setting the `Accept-Encoding` header would set the CURLOPT_ENCODING option, which permitted cURL to +properly handle gzip/deflate compressed responses from the server. In versions affected by this bug this does not happen. +See issue #217 for a workaround, or use a version containing the fix. diff --git a/vendor/guzzlehttp/guzzle/composer.json b/vendor/guzzlehttp/guzzle/composer.json new file mode 100644 index 0000000..1f328e3 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/composer.json @@ -0,0 +1,44 @@ +{ + "name": "guzzlehttp/guzzle", + "type": "library", + "description": "Guzzle is a PHP HTTP client library", + "keywords": ["framework", "http", "rest", "web service", "curl", "client", "HTTP client"], + "homepage": "http://guzzlephp.org/", + "license": "MIT", + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "require": { + "php": ">=5.5", + "guzzlehttp/psr7": "^1.4", + "guzzlehttp/promises": "^1.0" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.0" + }, + "autoload": { + "files": ["src/functions_include.php"], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Tests\\": "tests/" + } + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "extra": { + "branch-alias": { + "dev-master": "6.3-dev" + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Client.php b/vendor/guzzlehttp/guzzle/src/Client.php new file mode 100644 index 0000000..8041791 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Client.php @@ -0,0 +1,422 @@ + 'http://www.foo.com/1.0/', + * 'timeout' => 0, + * 'allow_redirects' => false, + * 'proxy' => '192.168.16.1:10' + * ]); + * + * Client configuration settings include the following options: + * + * - handler: (callable) Function that transfers HTTP requests over the + * wire. The function is called with a Psr7\Http\Message\RequestInterface + * and array of transfer options, and must return a + * GuzzleHttp\Promise\PromiseInterface that is fulfilled with a + * Psr7\Http\Message\ResponseInterface on success. "handler" is a + * constructor only option that cannot be overridden in per/request + * options. If no handler is provided, a default handler will be created + * that enables all of the request options below by attaching all of the + * default middleware to the handler. + * - base_uri: (string|UriInterface) Base URI of the client that is merged + * into relative URIs. Can be a string or instance of UriInterface. + * - **: any request option + * + * @param array $config Client configuration settings. + * + * @see \GuzzleHttp\RequestOptions for a list of available request options. + */ + public function __construct(array $config = []) + { + if (!isset($config['handler'])) { + $config['handler'] = HandlerStack::create(); + } elseif (!is_callable($config['handler'])) { + throw new \InvalidArgumentException('handler must be a callable'); + } + + // Convert the base_uri to a UriInterface + if (isset($config['base_uri'])) { + $config['base_uri'] = Psr7\uri_for($config['base_uri']); + } + + $this->configureDefaults($config); + } + + public function __call($method, $args) + { + if (count($args) < 1) { + throw new \InvalidArgumentException('Magic request methods require a URI and optional options array'); + } + + $uri = $args[0]; + $opts = isset($args[1]) ? $args[1] : []; + + return substr($method, -5) === 'Async' + ? $this->requestAsync(substr($method, 0, -5), $uri, $opts) + : $this->request($method, $uri, $opts); + } + + public function sendAsync(RequestInterface $request, array $options = []) + { + // Merge the base URI into the request URI if needed. + $options = $this->prepareDefaults($options); + + return $this->transfer( + $request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')), + $options + ); + } + + public function send(RequestInterface $request, array $options = []) + { + $options[RequestOptions::SYNCHRONOUS] = true; + return $this->sendAsync($request, $options)->wait(); + } + + public function requestAsync($method, $uri = '', array $options = []) + { + $options = $this->prepareDefaults($options); + // Remove request modifying parameter because it can be done up-front. + $headers = isset($options['headers']) ? $options['headers'] : []; + $body = isset($options['body']) ? $options['body'] : null; + $version = isset($options['version']) ? $options['version'] : '1.1'; + // Merge the URI into the base URI. + $uri = $this->buildUri($uri, $options); + if (is_array($body)) { + $this->invalidBody(); + } + $request = new Psr7\Request($method, $uri, $headers, $body, $version); + // Remove the option so that they are not doubly-applied. + unset($options['headers'], $options['body'], $options['version']); + + return $this->transfer($request, $options); + } + + public function request($method, $uri = '', array $options = []) + { + $options[RequestOptions::SYNCHRONOUS] = true; + return $this->requestAsync($method, $uri, $options)->wait(); + } + + public function getConfig($option = null) + { + return $option === null + ? $this->config + : (isset($this->config[$option]) ? $this->config[$option] : null); + } + + private function buildUri($uri, array $config) + { + // for BC we accept null which would otherwise fail in uri_for + $uri = Psr7\uri_for($uri === null ? '' : $uri); + + if (isset($config['base_uri'])) { + $uri = Psr7\UriResolver::resolve(Psr7\uri_for($config['base_uri']), $uri); + } + + return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri; + } + + /** + * Configures the default options for a client. + * + * @param array $config + */ + private function configureDefaults(array $config) + { + $defaults = [ + 'allow_redirects' => RedirectMiddleware::$defaultSettings, + 'http_errors' => true, + 'decode_content' => true, + 'verify' => true, + 'cookies' => false + ]; + + // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set. + + // We can only trust the HTTP_PROXY environment variable in a CLI + // process due to the fact that PHP has no reliable mechanism to + // get environment variables that start with "HTTP_". + if (php_sapi_name() == 'cli' && getenv('HTTP_PROXY')) { + $defaults['proxy']['http'] = getenv('HTTP_PROXY'); + } + + if ($proxy = getenv('HTTPS_PROXY')) { + $defaults['proxy']['https'] = $proxy; + } + + if ($noProxy = getenv('NO_PROXY')) { + $cleanedNoProxy = str_replace(' ', '', $noProxy); + $defaults['proxy']['no'] = explode(',', $cleanedNoProxy); + } + + $this->config = $config + $defaults; + + if (!empty($config['cookies']) && $config['cookies'] === true) { + $this->config['cookies'] = new CookieJar(); + } + + // Add the default user-agent header. + if (!isset($this->config['headers'])) { + $this->config['headers'] = ['User-Agent' => default_user_agent()]; + } else { + // Add the User-Agent header if one was not already set. + foreach (array_keys($this->config['headers']) as $name) { + if (strtolower($name) === 'user-agent') { + return; + } + } + $this->config['headers']['User-Agent'] = default_user_agent(); + } + } + + /** + * Merges default options into the array. + * + * @param array $options Options to modify by reference + * + * @return array + */ + private function prepareDefaults($options) + { + $defaults = $this->config; + + if (!empty($defaults['headers'])) { + // Default headers are only added if they are not present. + $defaults['_conditional'] = $defaults['headers']; + unset($defaults['headers']); + } + + // Special handling for headers is required as they are added as + // conditional headers and as headers passed to a request ctor. + if (array_key_exists('headers', $options)) { + // Allows default headers to be unset. + if ($options['headers'] === null) { + $defaults['_conditional'] = null; + unset($options['headers']); + } elseif (!is_array($options['headers'])) { + throw new \InvalidArgumentException('headers must be an array'); + } + } + + // Shallow merge defaults underneath options. + $result = $options + $defaults; + + // Remove null values. + foreach ($result as $k => $v) { + if ($v === null) { + unset($result[$k]); + } + } + + return $result; + } + + /** + * Transfers the given request and applies request options. + * + * The URI of the request is not modified and the request options are used + * as-is without merging in default options. + * + * @param RequestInterface $request + * @param array $options + * + * @return Promise\PromiseInterface + */ + private function transfer(RequestInterface $request, array $options) + { + // save_to -> sink + if (isset($options['save_to'])) { + $options['sink'] = $options['save_to']; + unset($options['save_to']); + } + + // exceptions -> http_errors + if (isset($options['exceptions'])) { + $options['http_errors'] = $options['exceptions']; + unset($options['exceptions']); + } + + $request = $this->applyOptions($request, $options); + $handler = $options['handler']; + + try { + return Promise\promise_for($handler($request, $options)); + } catch (\Exception $e) { + return Promise\rejection_for($e); + } + } + + /** + * Applies the array of request options to a request. + * + * @param RequestInterface $request + * @param array $options + * + * @return RequestInterface + */ + private function applyOptions(RequestInterface $request, array &$options) + { + $modify = [ + 'set_headers' => [], + ]; + + if (isset($options['headers'])) { + $modify['set_headers'] = $options['headers']; + unset($options['headers']); + } + + if (isset($options['form_params'])) { + if (isset($options['multipart'])) { + throw new \InvalidArgumentException('You cannot use ' + . 'form_params and multipart at the same time. Use the ' + . 'form_params option if you want to send application/' + . 'x-www-form-urlencoded requests, and the multipart ' + . 'option to send multipart/form-data requests.'); + } + $options['body'] = http_build_query($options['form_params'], '', '&'); + unset($options['form_params']); + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); + $options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded'; + } + + if (isset($options['multipart'])) { + $options['body'] = new Psr7\MultipartStream($options['multipart']); + unset($options['multipart']); + } + + if (isset($options['json'])) { + $options['body'] = \GuzzleHttp\json_encode($options['json']); + unset($options['json']); + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); + $options['_conditional']['Content-Type'] = 'application/json'; + } + + if (!empty($options['decode_content']) + && $options['decode_content'] !== true + ) { + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\_caseless_remove(['Accept-Encoding'], $options['_conditional']); + $modify['set_headers']['Accept-Encoding'] = $options['decode_content']; + } + + if (isset($options['body'])) { + if (is_array($options['body'])) { + $this->invalidBody(); + } + $modify['body'] = Psr7\stream_for($options['body']); + unset($options['body']); + } + + if (!empty($options['auth']) && is_array($options['auth'])) { + $value = $options['auth']; + $type = isset($value[2]) ? strtolower($value[2]) : 'basic'; + switch ($type) { + case 'basic': + // Ensure that we don't have the header in different case and set the new value. + $modify['set_headers'] = Psr7\_caseless_remove(['Authorization'], $modify['set_headers']); + $modify['set_headers']['Authorization'] = 'Basic ' + . base64_encode("$value[0]:$value[1]"); + break; + case 'digest': + // @todo: Do not rely on curl + $options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_DIGEST; + $options['curl'][CURLOPT_USERPWD] = "$value[0]:$value[1]"; + break; + case 'ntlm': + $options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_NTLM; + $options['curl'][CURLOPT_USERPWD] = "$value[0]:$value[1]"; + break; + } + } + + if (isset($options['query'])) { + $value = $options['query']; + if (is_array($value)) { + $value = http_build_query($value, null, '&', PHP_QUERY_RFC3986); + } + if (!is_string($value)) { + throw new \InvalidArgumentException('query must be a string or array'); + } + $modify['query'] = $value; + unset($options['query']); + } + + // Ensure that sink is not an invalid value. + if (isset($options['sink'])) { + // TODO: Add more sink validation? + if (is_bool($options['sink'])) { + throw new \InvalidArgumentException('sink must not be a boolean'); + } + } + + $request = Psr7\modify_request($request, $modify); + if ($request->getBody() instanceof Psr7\MultipartStream) { + // Use a multipart/form-data POST if a Content-Type is not set. + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); + $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary=' + . $request->getBody()->getBoundary(); + } + + // Merge in conditional headers if they are not present. + if (isset($options['_conditional'])) { + // Build up the changes so it's in a single clone of the message. + $modify = []; + foreach ($options['_conditional'] as $k => $v) { + if (!$request->hasHeader($k)) { + $modify['set_headers'][$k] = $v; + } + } + $request = Psr7\modify_request($request, $modify); + // Don't pass this internal value along to middleware/handlers. + unset($options['_conditional']); + } + + return $request; + } + + private function invalidBody() + { + throw new \InvalidArgumentException('Passing in the "body" request ' + . 'option as an array to send a POST request has been deprecated. ' + . 'Please use the "form_params" request option to send a ' + . 'application/x-www-form-urlencoded request, or the "multipart" ' + . 'request option to send a multipart/form-data request.'); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/ClientInterface.php b/vendor/guzzlehttp/guzzle/src/ClientInterface.php new file mode 100644 index 0000000..2dbcffa --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/ClientInterface.php @@ -0,0 +1,84 @@ +strictMode = $strictMode; + + foreach ($cookieArray as $cookie) { + if (!($cookie instanceof SetCookie)) { + $cookie = new SetCookie($cookie); + } + $this->setCookie($cookie); + } + } + + /** + * Create a new Cookie jar from an associative array and domain. + * + * @param array $cookies Cookies to create the jar from + * @param string $domain Domain to set the cookies to + * + * @return self + */ + public static function fromArray(array $cookies, $domain) + { + $cookieJar = new self(); + foreach ($cookies as $name => $value) { + $cookieJar->setCookie(new SetCookie([ + 'Domain' => $domain, + 'Name' => $name, + 'Value' => $value, + 'Discard' => true + ])); + } + + return $cookieJar; + } + + /** + * @deprecated + */ + public static function getCookieValue($value) + { + return $value; + } + + /** + * Evaluate if this cookie should be persisted to storage + * that survives between requests. + * + * @param SetCookie $cookie Being evaluated. + * @param bool $allowSessionCookies If we should persist session cookies + * @return bool + */ + public static function shouldPersist( + SetCookie $cookie, + $allowSessionCookies = false + ) { + if ($cookie->getExpires() || $allowSessionCookies) { + if (!$cookie->getDiscard()) { + return true; + } + } + + return false; + } + + /** + * Finds and returns the cookie based on the name + * + * @param string $name cookie name to search for + * @return SetCookie|null cookie that was found or null if not found + */ + public function getCookieByName($name) + { + // don't allow a null name + if ($name === null) { + return null; + } + foreach ($this->cookies as $cookie) { + if ($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) { + return $cookie; + } + } + } + + public function toArray() + { + return array_map(function (SetCookie $cookie) { + return $cookie->toArray(); + }, $this->getIterator()->getArrayCopy()); + } + + public function clear($domain = null, $path = null, $name = null) + { + if (!$domain) { + $this->cookies = []; + return; + } elseif (!$path) { + $this->cookies = array_filter( + $this->cookies, + function (SetCookie $cookie) use ($path, $domain) { + return !$cookie->matchesDomain($domain); + } + ); + } elseif (!$name) { + $this->cookies = array_filter( + $this->cookies, + function (SetCookie $cookie) use ($path, $domain) { + return !($cookie->matchesPath($path) && + $cookie->matchesDomain($domain)); + } + ); + } else { + $this->cookies = array_filter( + $this->cookies, + function (SetCookie $cookie) use ($path, $domain, $name) { + return !($cookie->getName() == $name && + $cookie->matchesPath($path) && + $cookie->matchesDomain($domain)); + } + ); + } + } + + public function clearSessionCookies() + { + $this->cookies = array_filter( + $this->cookies, + function (SetCookie $cookie) { + return !$cookie->getDiscard() && $cookie->getExpires(); + } + ); + } + + public function setCookie(SetCookie $cookie) + { + // If the name string is empty (but not 0), ignore the set-cookie + // string entirely. + $name = $cookie->getName(); + if (!$name && $name !== '0') { + return false; + } + + // Only allow cookies with set and valid domain, name, value + $result = $cookie->validate(); + if ($result !== true) { + if ($this->strictMode) { + throw new \RuntimeException('Invalid cookie: ' . $result); + } else { + $this->removeCookieIfEmpty($cookie); + return false; + } + } + + // Resolve conflicts with previously set cookies + foreach ($this->cookies as $i => $c) { + + // Two cookies are identical, when their path, and domain are + // identical. + if ($c->getPath() != $cookie->getPath() || + $c->getDomain() != $cookie->getDomain() || + $c->getName() != $cookie->getName() + ) { + continue; + } + + // The previously set cookie is a discard cookie and this one is + // not so allow the new cookie to be set + if (!$cookie->getDiscard() && $c->getDiscard()) { + unset($this->cookies[$i]); + continue; + } + + // If the new cookie's expiration is further into the future, then + // replace the old cookie + if ($cookie->getExpires() > $c->getExpires()) { + unset($this->cookies[$i]); + continue; + } + + // If the value has changed, we better change it + if ($cookie->getValue() !== $c->getValue()) { + unset($this->cookies[$i]); + continue; + } + + // The cookie exists, so no need to continue + return false; + } + + $this->cookies[] = $cookie; + + return true; + } + + public function count() + { + return count($this->cookies); + } + + public function getIterator() + { + return new \ArrayIterator(array_values($this->cookies)); + } + + public function extractCookies( + RequestInterface $request, + ResponseInterface $response + ) { + if ($cookieHeader = $response->getHeader('Set-Cookie')) { + foreach ($cookieHeader as $cookie) { + $sc = SetCookie::fromString($cookie); + if (!$sc->getDomain()) { + $sc->setDomain($request->getUri()->getHost()); + } + if (0 !== strpos($sc->getPath(), '/')) { + $sc->setPath($this->getCookiePathFromRequest($request)); + } + $this->setCookie($sc); + } + } + } + + /** + * Computes cookie path following RFC 6265 section 5.1.4 + * + * @link https://tools.ietf.org/html/rfc6265#section-5.1.4 + * + * @param RequestInterface $request + * @return string + */ + private function getCookiePathFromRequest(RequestInterface $request) + { + $uriPath = $request->getUri()->getPath(); + if ('' === $uriPath) { + return '/'; + } + if (0 !== strpos($uriPath, '/')) { + return '/'; + } + if ('/' === $uriPath) { + return '/'; + } + if (0 === $lastSlashPos = strrpos($uriPath, '/')) { + return '/'; + } + + return substr($uriPath, 0, $lastSlashPos); + } + + public function withCookieHeader(RequestInterface $request) + { + $values = []; + $uri = $request->getUri(); + $scheme = $uri->getScheme(); + $host = $uri->getHost(); + $path = $uri->getPath() ?: '/'; + + foreach ($this->cookies as $cookie) { + if ($cookie->matchesPath($path) && + $cookie->matchesDomain($host) && + !$cookie->isExpired() && + (!$cookie->getSecure() || $scheme === 'https') + ) { + $values[] = $cookie->getName() . '=' + . $cookie->getValue(); + } + } + + return $values + ? $request->withHeader('Cookie', implode('; ', $values)) + : $request; + } + + /** + * If a cookie already exists and the server asks to set it again with a + * null value, the cookie must be deleted. + * + * @param SetCookie $cookie + */ + private function removeCookieIfEmpty(SetCookie $cookie) + { + $cookieValue = $cookie->getValue(); + if ($cookieValue === null || $cookieValue === '') { + $this->clear( + $cookie->getDomain(), + $cookie->getPath(), + $cookie->getName() + ); + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php new file mode 100644 index 0000000..2cf298a --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php @@ -0,0 +1,84 @@ +filename = $cookieFile; + $this->storeSessionCookies = $storeSessionCookies; + + if (file_exists($cookieFile)) { + $this->load($cookieFile); + } + } + + /** + * Saves the file when shutting down + */ + public function __destruct() + { + $this->save($this->filename); + } + + /** + * Saves the cookies to a file. + * + * @param string $filename File to save + * @throws \RuntimeException if the file cannot be found or created + */ + public function save($filename) + { + $json = []; + foreach ($this as $cookie) { + /** @var SetCookie $cookie */ + if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { + $json[] = $cookie->toArray(); + } + } + + $jsonStr = \GuzzleHttp\json_encode($json); + if (false === file_put_contents($filename, $jsonStr)) { + throw new \RuntimeException("Unable to save file {$filename}"); + } + } + + /** + * Load cookies from a JSON formatted file. + * + * Old cookies are kept unless overwritten by newly loaded ones. + * + * @param string $filename Cookie file to load. + * @throws \RuntimeException if the file cannot be loaded. + */ + public function load($filename) + { + $json = file_get_contents($filename); + if (false === $json) { + throw new \RuntimeException("Unable to load file {$filename}"); + } elseif ($json === '') { + return; + } + + $data = \GuzzleHttp\json_decode($json, true); + if (is_array($data)) { + foreach (json_decode($json, true) as $cookie) { + $this->setCookie(new SetCookie($cookie)); + } + } elseif (strlen($data)) { + throw new \RuntimeException("Invalid cookie file: {$filename}"); + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php new file mode 100644 index 0000000..4497bcf --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php @@ -0,0 +1,71 @@ +sessionKey = $sessionKey; + $this->storeSessionCookies = $storeSessionCookies; + $this->load(); + } + + /** + * Saves cookies to session when shutting down + */ + public function __destruct() + { + $this->save(); + } + + /** + * Save cookies to the client session + */ + public function save() + { + $json = []; + foreach ($this as $cookie) { + /** @var SetCookie $cookie */ + if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { + $json[] = $cookie->toArray(); + } + } + + $_SESSION[$this->sessionKey] = json_encode($json); + } + + /** + * Load the contents of the client session into the data array + */ + protected function load() + { + if (!isset($_SESSION[$this->sessionKey])) { + return; + } + $data = json_decode($_SESSION[$this->sessionKey], true); + if (is_array($data)) { + foreach ($data as $cookie) { + $this->setCookie(new SetCookie($cookie)); + } + } elseif (strlen($data)) { + throw new \RuntimeException("Invalid cookie data"); + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php new file mode 100644 index 0000000..f699394 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php @@ -0,0 +1,403 @@ + null, + 'Value' => null, + 'Domain' => null, + 'Path' => '/', + 'Max-Age' => null, + 'Expires' => null, + 'Secure' => false, + 'Discard' => false, + 'HttpOnly' => false + ]; + + /** @var array Cookie data */ + private $data; + + /** + * Create a new SetCookie object from a string + * + * @param string $cookie Set-Cookie header string + * + * @return self + */ + public static function fromString($cookie) + { + // Create the default return array + $data = self::$defaults; + // Explode the cookie string using a series of semicolons + $pieces = array_filter(array_map('trim', explode(';', $cookie))); + // The name of the cookie (first kvp) must exist and include an equal sign. + if (empty($pieces[0]) || !strpos($pieces[0], '=')) { + return new self($data); + } + + // Add the cookie pieces into the parsed data array + foreach ($pieces as $part) { + $cookieParts = explode('=', $part, 2); + $key = trim($cookieParts[0]); + $value = isset($cookieParts[1]) + ? trim($cookieParts[1], " \n\r\t\0\x0B") + : true; + + // Only check for non-cookies when cookies have been found + if (empty($data['Name'])) { + $data['Name'] = $key; + $data['Value'] = $value; + } else { + foreach (array_keys(self::$defaults) as $search) { + if (!strcasecmp($search, $key)) { + $data[$search] = $value; + continue 2; + } + } + $data[$key] = $value; + } + } + + return new self($data); + } + + /** + * @param array $data Array of cookie data provided by a Cookie parser + */ + public function __construct(array $data = []) + { + $this->data = array_replace(self::$defaults, $data); + // Extract the Expires value and turn it into a UNIX timestamp if needed + if (!$this->getExpires() && $this->getMaxAge()) { + // Calculate the Expires date + $this->setExpires(time() + $this->getMaxAge()); + } elseif ($this->getExpires() && !is_numeric($this->getExpires())) { + $this->setExpires($this->getExpires()); + } + } + + public function __toString() + { + $str = $this->data['Name'] . '=' . $this->data['Value'] . '; '; + foreach ($this->data as $k => $v) { + if ($k !== 'Name' && $k !== 'Value' && $v !== null && $v !== false) { + if ($k === 'Expires') { + $str .= 'Expires=' . gmdate('D, d M Y H:i:s \G\M\T', $v) . '; '; + } else { + $str .= ($v === true ? $k : "{$k}={$v}") . '; '; + } + } + } + + return rtrim($str, '; '); + } + + public function toArray() + { + return $this->data; + } + + /** + * Get the cookie name + * + * @return string + */ + public function getName() + { + return $this->data['Name']; + } + + /** + * Set the cookie name + * + * @param string $name Cookie name + */ + public function setName($name) + { + $this->data['Name'] = $name; + } + + /** + * Get the cookie value + * + * @return string + */ + public function getValue() + { + return $this->data['Value']; + } + + /** + * Set the cookie value + * + * @param string $value Cookie value + */ + public function setValue($value) + { + $this->data['Value'] = $value; + } + + /** + * Get the domain + * + * @return string|null + */ + public function getDomain() + { + return $this->data['Domain']; + } + + /** + * Set the domain of the cookie + * + * @param string $domain + */ + public function setDomain($domain) + { + $this->data['Domain'] = $domain; + } + + /** + * Get the path + * + * @return string + */ + public function getPath() + { + return $this->data['Path']; + } + + /** + * Set the path of the cookie + * + * @param string $path Path of the cookie + */ + public function setPath($path) + { + $this->data['Path'] = $path; + } + + /** + * Maximum lifetime of the cookie in seconds + * + * @return int|null + */ + public function getMaxAge() + { + return $this->data['Max-Age']; + } + + /** + * Set the max-age of the cookie + * + * @param int $maxAge Max age of the cookie in seconds + */ + public function setMaxAge($maxAge) + { + $this->data['Max-Age'] = $maxAge; + } + + /** + * The UNIX timestamp when the cookie Expires + * + * @return mixed + */ + public function getExpires() + { + return $this->data['Expires']; + } + + /** + * Set the unix timestamp for which the cookie will expire + * + * @param int $timestamp Unix timestamp + */ + public function setExpires($timestamp) + { + $this->data['Expires'] = is_numeric($timestamp) + ? (int) $timestamp + : strtotime($timestamp); + } + + /** + * Get whether or not this is a secure cookie + * + * @return null|bool + */ + public function getSecure() + { + return $this->data['Secure']; + } + + /** + * Set whether or not the cookie is secure + * + * @param bool $secure Set to true or false if secure + */ + public function setSecure($secure) + { + $this->data['Secure'] = $secure; + } + + /** + * Get whether or not this is a session cookie + * + * @return null|bool + */ + public function getDiscard() + { + return $this->data['Discard']; + } + + /** + * Set whether or not this is a session cookie + * + * @param bool $discard Set to true or false if this is a session cookie + */ + public function setDiscard($discard) + { + $this->data['Discard'] = $discard; + } + + /** + * Get whether or not this is an HTTP only cookie + * + * @return bool + */ + public function getHttpOnly() + { + return $this->data['HttpOnly']; + } + + /** + * Set whether or not this is an HTTP only cookie + * + * @param bool $httpOnly Set to true or false if this is HTTP only + */ + public function setHttpOnly($httpOnly) + { + $this->data['HttpOnly'] = $httpOnly; + } + + /** + * Check if the cookie matches a path value. + * + * A request-path path-matches a given cookie-path if at least one of + * the following conditions holds: + * + * - The cookie-path and the request-path are identical. + * - The cookie-path is a prefix of the request-path, and the last + * character of the cookie-path is %x2F ("/"). + * - The cookie-path is a prefix of the request-path, and the first + * character of the request-path that is not included in the cookie- + * path is a %x2F ("/") character. + * + * @param string $requestPath Path to check against + * + * @return bool + */ + public function matchesPath($requestPath) + { + $cookiePath = $this->getPath(); + + // Match on exact matches or when path is the default empty "/" + if ($cookiePath === '/' || $cookiePath == $requestPath) { + return true; + } + + // Ensure that the cookie-path is a prefix of the request path. + if (0 !== strpos($requestPath, $cookiePath)) { + return false; + } + + // Match if the last character of the cookie-path is "/" + if (substr($cookiePath, -1, 1) === '/') { + return true; + } + + // Match if the first character not included in cookie path is "/" + return substr($requestPath, strlen($cookiePath), 1) === '/'; + } + + /** + * Check if the cookie matches a domain value + * + * @param string $domain Domain to check against + * + * @return bool + */ + public function matchesDomain($domain) + { + // Remove the leading '.' as per spec in RFC 6265. + // http://tools.ietf.org/html/rfc6265#section-5.2.3 + $cookieDomain = ltrim($this->getDomain(), '.'); + + // Domain not set or exact match. + if (!$cookieDomain || !strcasecmp($domain, $cookieDomain)) { + return true; + } + + // Matching the subdomain according to RFC 6265. + // http://tools.ietf.org/html/rfc6265#section-5.1.3 + if (filter_var($domain, FILTER_VALIDATE_IP)) { + return false; + } + + return (bool) preg_match('/\.' . preg_quote($cookieDomain, '/') . '$/', $domain); + } + + /** + * Check if the cookie is expired + * + * @return bool + */ + public function isExpired() + { + return $this->getExpires() !== null && time() > $this->getExpires(); + } + + /** + * Check if the cookie is valid according to RFC 6265 + * + * @return bool|string Returns true if valid or an error message if invalid + */ + public function validate() + { + // Names must not be empty, but can be 0 + $name = $this->getName(); + if (empty($name) && !is_numeric($name)) { + return 'The cookie name must not be empty'; + } + + // Check if any of the invalid characters are present in the cookie name + if (preg_match( + '/[\x00-\x20\x22\x28-\x29\x2c\x2f\x3a-\x40\x5c\x7b\x7d\x7f]/', + $name + )) { + return 'Cookie name must not contain invalid characters: ASCII ' + . 'Control characters (0-31;127), space, tab and the ' + . 'following characters: ()<>@,;:\"/?={}'; + } + + // Value must not be empty, but can be 0 + $value = $this->getValue(); + if (empty($value) && !is_numeric($value)) { + return 'The cookie value must not be empty'; + } + + // Domains must not be empty, but can be 0 + // A "0" is not a valid internet domain, but may be used as server name + // in a private network. + $domain = $this->getDomain(); + if (empty($domain) && !is_numeric($domain)) { + return 'The cookie domain must not be empty'; + } + + return true; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php b/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php new file mode 100644 index 0000000..427d896 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php @@ -0,0 +1,27 @@ +getStatusCode() + : 0; + parent::__construct($message, $code, $previous); + $this->request = $request; + $this->response = $response; + $this->handlerContext = $handlerContext; + } + + /** + * Wrap non-RequestExceptions with a RequestException + * + * @param RequestInterface $request + * @param \Exception $e + * + * @return RequestException + */ + public static function wrapException(RequestInterface $request, \Exception $e) + { + return $e instanceof RequestException + ? $e + : new RequestException($e->getMessage(), $request, null, $e); + } + + /** + * Factory method to create a new exception with a normalized error message + * + * @param RequestInterface $request Request + * @param ResponseInterface $response Response received + * @param \Exception $previous Previous exception + * @param array $ctx Optional handler context. + * + * @return self + */ + public static function create( + RequestInterface $request, + ResponseInterface $response = null, + \Exception $previous = null, + array $ctx = [] + ) { + if (!$response) { + return new self( + 'Error completing request', + $request, + null, + $previous, + $ctx + ); + } + + $level = (int) floor($response->getStatusCode() / 100); + if ($level === 4) { + $label = 'Client error'; + $className = ClientException::class; + } elseif ($level === 5) { + $label = 'Server error'; + $className = ServerException::class; + } else { + $label = 'Unsuccessful request'; + $className = __CLASS__; + } + + $uri = $request->getUri(); + $uri = static::obfuscateUri($uri); + + // Client Error: `GET /` resulted in a `404 Not Found` response: + // ... (truncated) + $message = sprintf( + '%s: `%s %s` resulted in a `%s %s` response', + $label, + $request->getMethod(), + $uri, + $response->getStatusCode(), + $response->getReasonPhrase() + ); + + $summary = static::getResponseBodySummary($response); + + if ($summary !== null) { + $message .= ":\n{$summary}\n"; + } + + return new $className($message, $request, $response, $previous, $ctx); + } + + /** + * Get a short summary of the response + * + * Will return `null` if the response is not printable. + * + * @param ResponseInterface $response + * + * @return string|null + */ + public static function getResponseBodySummary(ResponseInterface $response) + { + $body = $response->getBody(); + + if (!$body->isSeekable()) { + return null; + } + + $size = $body->getSize(); + + if ($size === 0) { + return null; + } + + $summary = $body->read(120); + $body->rewind(); + + if ($size > 120) { + $summary .= ' (truncated...)'; + } + + // Matches any printable character, including unicode characters: + // letters, marks, numbers, punctuation, spacing, and separators. + if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) { + return null; + } + + return $summary; + } + + /** + * Obfuscates URI if there is an username and a password present + * + * @param UriInterface $uri + * + * @return UriInterface + */ + private static function obfuscateUri($uri) + { + $userInfo = $uri->getUserInfo(); + + if (false !== ($pos = strpos($userInfo, ':'))) { + return $uri->withUserInfo(substr($userInfo, 0, $pos), '***'); + } + + return $uri; + } + + /** + * Get the request that caused the exception + * + * @return RequestInterface + */ + public function getRequest() + { + return $this->request; + } + + /** + * Get the associated response + * + * @return ResponseInterface|null + */ + public function getResponse() + { + return $this->response; + } + + /** + * Check if a response was received + * + * @return bool + */ + public function hasResponse() + { + return $this->response !== null; + } + + /** + * Get contextual information about the error from the underlying handler. + * + * The contents of this array will vary depending on which handler you are + * using. It may also be just an empty array. Relying on this data will + * couple you to a specific handler, but can give more debug information + * when needed. + * + * @return array + */ + public function getHandlerContext() + { + return $this->handlerContext; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php b/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php new file mode 100644 index 0000000..a77c289 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php @@ -0,0 +1,27 @@ +stream = $stream; + $msg = $msg ?: 'Could not seek the stream to position ' . $pos; + parent::__construct($msg); + } + + /** + * @return StreamInterface + */ + public function getStream() + { + return $this->stream; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php b/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php new file mode 100644 index 0000000..7cdd340 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php @@ -0,0 +1,7 @@ +maxHandles = $maxHandles; + } + + public function create(RequestInterface $request, array $options) + { + if (isset($options['curl']['body_as_string'])) { + $options['_body_as_string'] = $options['curl']['body_as_string']; + unset($options['curl']['body_as_string']); + } + + $easy = new EasyHandle; + $easy->request = $request; + $easy->options = $options; + $conf = $this->getDefaultConf($easy); + $this->applyMethod($easy, $conf); + $this->applyHandlerOptions($easy, $conf); + $this->applyHeaders($easy, $conf); + unset($conf['_headers']); + + // Add handler options from the request configuration options + if (isset($options['curl'])) { + $conf = array_replace($conf, $options['curl']); + } + + $conf[CURLOPT_HEADERFUNCTION] = $this->createHeaderFn($easy); + $easy->handle = $this->handles + ? array_pop($this->handles) + : curl_init(); + curl_setopt_array($easy->handle, $conf); + + return $easy; + } + + public function release(EasyHandle $easy) + { + $resource = $easy->handle; + unset($easy->handle); + + if (count($this->handles) >= $this->maxHandles) { + curl_close($resource); + } else { + // Remove all callback functions as they can hold onto references + // and are not cleaned up by curl_reset. Using curl_setopt_array + // does not work for some reason, so removing each one + // individually. + curl_setopt($resource, CURLOPT_HEADERFUNCTION, null); + curl_setopt($resource, CURLOPT_READFUNCTION, null); + curl_setopt($resource, CURLOPT_WRITEFUNCTION, null); + curl_setopt($resource, CURLOPT_PROGRESSFUNCTION, null); + curl_reset($resource); + $this->handles[] = $resource; + } + } + + /** + * Completes a cURL transaction, either returning a response promise or a + * rejected promise. + * + * @param callable $handler + * @param EasyHandle $easy + * @param CurlFactoryInterface $factory Dictates how the handle is released + * + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public static function finish( + callable $handler, + EasyHandle $easy, + CurlFactoryInterface $factory + ) { + if (isset($easy->options['on_stats'])) { + self::invokeStats($easy); + } + + if (!$easy->response || $easy->errno) { + return self::finishError($handler, $easy, $factory); + } + + // Return the response if it is present and there is no error. + $factory->release($easy); + + // Rewind the body of the response if possible. + $body = $easy->response->getBody(); + if ($body->isSeekable()) { + $body->rewind(); + } + + return new FulfilledPromise($easy->response); + } + + private static function invokeStats(EasyHandle $easy) + { + $curlStats = curl_getinfo($easy->handle); + $stats = new TransferStats( + $easy->request, + $easy->response, + $curlStats['total_time'], + $easy->errno, + $curlStats + ); + call_user_func($easy->options['on_stats'], $stats); + } + + private static function finishError( + callable $handler, + EasyHandle $easy, + CurlFactoryInterface $factory + ) { + // Get error information and release the handle to the factory. + $ctx = [ + 'errno' => $easy->errno, + 'error' => curl_error($easy->handle), + ] + curl_getinfo($easy->handle); + $factory->release($easy); + + // Retry when nothing is present or when curl failed to rewind. + if (empty($easy->options['_err_message']) + && (!$easy->errno || $easy->errno == 65) + ) { + return self::retryFailedRewind($handler, $easy, $ctx); + } + + return self::createRejection($easy, $ctx); + } + + private static function createRejection(EasyHandle $easy, array $ctx) + { + static $connectionErrors = [ + CURLE_OPERATION_TIMEOUTED => true, + CURLE_COULDNT_RESOLVE_HOST => true, + CURLE_COULDNT_CONNECT => true, + CURLE_SSL_CONNECT_ERROR => true, + CURLE_GOT_NOTHING => true, + ]; + + // If an exception was encountered during the onHeaders event, then + // return a rejected promise that wraps that exception. + if ($easy->onHeadersException) { + return \GuzzleHttp\Promise\rejection_for( + new RequestException( + 'An error was encountered during the on_headers event', + $easy->request, + $easy->response, + $easy->onHeadersException, + $ctx + ) + ); + } + + $message = sprintf( + 'cURL error %s: %s (%s)', + $ctx['errno'], + $ctx['error'], + 'see http://curl.haxx.se/libcurl/c/libcurl-errors.html' + ); + + // Create a connection exception if it was a specific error code. + $error = isset($connectionErrors[$easy->errno]) + ? new ConnectException($message, $easy->request, null, $ctx) + : new RequestException($message, $easy->request, $easy->response, null, $ctx); + + return \GuzzleHttp\Promise\rejection_for($error); + } + + private function getDefaultConf(EasyHandle $easy) + { + $conf = [ + '_headers' => $easy->request->getHeaders(), + CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(), + CURLOPT_URL => (string) $easy->request->getUri()->withFragment(''), + CURLOPT_RETURNTRANSFER => false, + CURLOPT_HEADER => false, + CURLOPT_CONNECTTIMEOUT => 150, + ]; + + if (defined('CURLOPT_PROTOCOLS')) { + $conf[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS; + } + + $version = $easy->request->getProtocolVersion(); + if ($version == 1.1) { + $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1; + } elseif ($version == 2.0) { + $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0; + } else { + $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0; + } + + return $conf; + } + + private function applyMethod(EasyHandle $easy, array &$conf) + { + $body = $easy->request->getBody(); + $size = $body->getSize(); + + if ($size === null || $size > 0) { + $this->applyBody($easy->request, $easy->options, $conf); + return; + } + + $method = $easy->request->getMethod(); + if ($method === 'PUT' || $method === 'POST') { + // See http://tools.ietf.org/html/rfc7230#section-3.3.2 + if (!$easy->request->hasHeader('Content-Length')) { + $conf[CURLOPT_HTTPHEADER][] = 'Content-Length: 0'; + } + } elseif ($method === 'HEAD') { + $conf[CURLOPT_NOBODY] = true; + unset( + $conf[CURLOPT_WRITEFUNCTION], + $conf[CURLOPT_READFUNCTION], + $conf[CURLOPT_FILE], + $conf[CURLOPT_INFILE] + ); + } + } + + private function applyBody(RequestInterface $request, array $options, array &$conf) + { + $size = $request->hasHeader('Content-Length') + ? (int) $request->getHeaderLine('Content-Length') + : null; + + // Send the body as a string if the size is less than 1MB OR if the + // [curl][body_as_string] request value is set. + if (($size !== null && $size < 1000000) || + !empty($options['_body_as_string']) + ) { + $conf[CURLOPT_POSTFIELDS] = (string) $request->getBody(); + // Don't duplicate the Content-Length header + $this->removeHeader('Content-Length', $conf); + $this->removeHeader('Transfer-Encoding', $conf); + } else { + $conf[CURLOPT_UPLOAD] = true; + if ($size !== null) { + $conf[CURLOPT_INFILESIZE] = $size; + $this->removeHeader('Content-Length', $conf); + } + $body = $request->getBody(); + if ($body->isSeekable()) { + $body->rewind(); + } + $conf[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body) { + return $body->read($length); + }; + } + + // If the Expect header is not present, prevent curl from adding it + if (!$request->hasHeader('Expect')) { + $conf[CURLOPT_HTTPHEADER][] = 'Expect:'; + } + + // cURL sometimes adds a content-type by default. Prevent this. + if (!$request->hasHeader('Content-Type')) { + $conf[CURLOPT_HTTPHEADER][] = 'Content-Type:'; + } + } + + private function applyHeaders(EasyHandle $easy, array &$conf) + { + foreach ($conf['_headers'] as $name => $values) { + foreach ($values as $value) { + $value = (string) $value; + if ($value === '') { + // cURL requires a special format for empty headers. + // See https://github.com/guzzle/guzzle/issues/1882 for more details. + $conf[CURLOPT_HTTPHEADER][] = "$name;"; + } else { + $conf[CURLOPT_HTTPHEADER][] = "$name: $value"; + } + } + } + + // Remove the Accept header if one was not set + if (!$easy->request->hasHeader('Accept')) { + $conf[CURLOPT_HTTPHEADER][] = 'Accept:'; + } + } + + /** + * Remove a header from the options array. + * + * @param string $name Case-insensitive header to remove + * @param array $options Array of options to modify + */ + private function removeHeader($name, array &$options) + { + foreach (array_keys($options['_headers']) as $key) { + if (!strcasecmp($key, $name)) { + unset($options['_headers'][$key]); + return; + } + } + } + + private function applyHandlerOptions(EasyHandle $easy, array &$conf) + { + $options = $easy->options; + if (isset($options['verify'])) { + if ($options['verify'] === false) { + unset($conf[CURLOPT_CAINFO]); + $conf[CURLOPT_SSL_VERIFYHOST] = 0; + $conf[CURLOPT_SSL_VERIFYPEER] = false; + } else { + $conf[CURLOPT_SSL_VERIFYHOST] = 2; + $conf[CURLOPT_SSL_VERIFYPEER] = true; + if (is_string($options['verify'])) { + // Throw an error if the file/folder/link path is not valid or doesn't exist. + if (!file_exists($options['verify'])) { + throw new \InvalidArgumentException( + "SSL CA bundle not found: {$options['verify']}" + ); + } + // If it's a directory or a link to a directory use CURLOPT_CAPATH. + // If not, it's probably a file, or a link to a file, so use CURLOPT_CAINFO. + if (is_dir($options['verify']) || + (is_link($options['verify']) && is_dir(readlink($options['verify'])))) { + $conf[CURLOPT_CAPATH] = $options['verify']; + } else { + $conf[CURLOPT_CAINFO] = $options['verify']; + } + } + } + } + + if (!empty($options['decode_content'])) { + $accept = $easy->request->getHeaderLine('Accept-Encoding'); + if ($accept) { + $conf[CURLOPT_ENCODING] = $accept; + } else { + $conf[CURLOPT_ENCODING] = ''; + // Don't let curl send the header over the wire + $conf[CURLOPT_HTTPHEADER][] = 'Accept-Encoding:'; + } + } + + if (isset($options['sink'])) { + $sink = $options['sink']; + if (!is_string($sink)) { + $sink = \GuzzleHttp\Psr7\stream_for($sink); + } elseif (!is_dir(dirname($sink))) { + // Ensure that the directory exists before failing in curl. + throw new \RuntimeException(sprintf( + 'Directory %s does not exist for sink value of %s', + dirname($sink), + $sink + )); + } else { + $sink = new LazyOpenStream($sink, 'w+'); + } + $easy->sink = $sink; + $conf[CURLOPT_WRITEFUNCTION] = function ($ch, $write) use ($sink) { + return $sink->write($write); + }; + } else { + // Use a default temp stream if no sink was set. + $conf[CURLOPT_FILE] = fopen('php://temp', 'w+'); + $easy->sink = Psr7\stream_for($conf[CURLOPT_FILE]); + } + $timeoutRequiresNoSignal = false; + if (isset($options['timeout'])) { + $timeoutRequiresNoSignal |= $options['timeout'] < 1; + $conf[CURLOPT_TIMEOUT_MS] = $options['timeout'] * 1000; + } + + // CURL default value is CURL_IPRESOLVE_WHATEVER + if (isset($options['force_ip_resolve'])) { + if ('v4' === $options['force_ip_resolve']) { + $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4; + } elseif ('v6' === $options['force_ip_resolve']) { + $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V6; + } + } + + if (isset($options['connect_timeout'])) { + $timeoutRequiresNoSignal |= $options['connect_timeout'] < 1; + $conf[CURLOPT_CONNECTTIMEOUT_MS] = $options['connect_timeout'] * 1000; + } + + if ($timeoutRequiresNoSignal && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + $conf[CURLOPT_NOSIGNAL] = true; + } + + if (isset($options['proxy'])) { + if (!is_array($options['proxy'])) { + $conf[CURLOPT_PROXY] = $options['proxy']; + } else { + $scheme = $easy->request->getUri()->getScheme(); + if (isset($options['proxy'][$scheme])) { + $host = $easy->request->getUri()->getHost(); + if (!isset($options['proxy']['no']) || + !\GuzzleHttp\is_host_in_noproxy($host, $options['proxy']['no']) + ) { + $conf[CURLOPT_PROXY] = $options['proxy'][$scheme]; + } + } + } + } + + if (isset($options['cert'])) { + $cert = $options['cert']; + if (is_array($cert)) { + $conf[CURLOPT_SSLCERTPASSWD] = $cert[1]; + $cert = $cert[0]; + } + if (!file_exists($cert)) { + throw new \InvalidArgumentException( + "SSL certificate not found: {$cert}" + ); + } + $conf[CURLOPT_SSLCERT] = $cert; + } + + if (isset($options['ssl_key'])) { + $sslKey = $options['ssl_key']; + if (is_array($sslKey)) { + $conf[CURLOPT_SSLKEYPASSWD] = $sslKey[1]; + $sslKey = $sslKey[0]; + } + if (!file_exists($sslKey)) { + throw new \InvalidArgumentException( + "SSL private key not found: {$sslKey}" + ); + } + $conf[CURLOPT_SSLKEY] = $sslKey; + } + + if (isset($options['progress'])) { + $progress = $options['progress']; + if (!is_callable($progress)) { + throw new \InvalidArgumentException( + 'progress client option must be callable' + ); + } + $conf[CURLOPT_NOPROGRESS] = false; + $conf[CURLOPT_PROGRESSFUNCTION] = function () use ($progress) { + $args = func_get_args(); + // PHP 5.5 pushed the handle onto the start of the args + if (is_resource($args[0])) { + array_shift($args); + } + call_user_func_array($progress, $args); + }; + } + + if (!empty($options['debug'])) { + $conf[CURLOPT_STDERR] = \GuzzleHttp\debug_resource($options['debug']); + $conf[CURLOPT_VERBOSE] = true; + } + } + + /** + * This function ensures that a response was set on a transaction. If one + * was not set, then the request is retried if possible. This error + * typically means you are sending a payload, curl encountered a + * "Connection died, retrying a fresh connect" error, tried to rewind the + * stream, and then encountered a "necessary data rewind wasn't possible" + * error, causing the request to be sent through curl_multi_info_read() + * without an error status. + */ + private static function retryFailedRewind( + callable $handler, + EasyHandle $easy, + array $ctx + ) { + try { + // Only rewind if the body has been read from. + $body = $easy->request->getBody(); + if ($body->tell() > 0) { + $body->rewind(); + } + } catch (\RuntimeException $e) { + $ctx['error'] = 'The connection unexpectedly failed without ' + . 'providing an error. The request would have been retried, ' + . 'but attempting to rewind the request body failed. ' + . 'Exception: ' . $e; + return self::createRejection($easy, $ctx); + } + + // Retry no more than 3 times before giving up. + if (!isset($easy->options['_curl_retries'])) { + $easy->options['_curl_retries'] = 1; + } elseif ($easy->options['_curl_retries'] == 2) { + $ctx['error'] = 'The cURL request was retried 3 times ' + . 'and did not succeed. The most likely reason for the failure ' + . 'is that cURL was unable to rewind the body of the request ' + . 'and subsequent retries resulted in the same error. Turn on ' + . 'the debug option to see what went wrong. See ' + . 'https://bugs.php.net/bug.php?id=47204 for more information.'; + return self::createRejection($easy, $ctx); + } else { + $easy->options['_curl_retries']++; + } + + return $handler($easy->request, $easy->options); + } + + private function createHeaderFn(EasyHandle $easy) + { + if (isset($easy->options['on_headers'])) { + $onHeaders = $easy->options['on_headers']; + + if (!is_callable($onHeaders)) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + } else { + $onHeaders = null; + } + + return function ($ch, $h) use ( + $onHeaders, + $easy, + &$startingResponse + ) { + $value = trim($h); + if ($value === '') { + $startingResponse = true; + $easy->createResponse(); + if ($onHeaders !== null) { + try { + $onHeaders($easy->response); + } catch (\Exception $e) { + // Associate the exception with the handle and trigger + // a curl header write error by returning 0. + $easy->onHeadersException = $e; + return -1; + } + } + } elseif ($startingResponse) { + $startingResponse = false; + $easy->headers = [$value]; + } else { + $easy->headers[] = $value; + } + return strlen($h); + }; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php new file mode 100644 index 0000000..b0fc236 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php @@ -0,0 +1,27 @@ +factory = isset($options['handle_factory']) + ? $options['handle_factory'] + : new CurlFactory(3); + } + + public function __invoke(RequestInterface $request, array $options) + { + if (isset($options['delay'])) { + usleep($options['delay'] * 1000); + } + + $easy = $this->factory->create($request, $options); + curl_exec($easy->handle); + $easy->errno = curl_errno($easy->handle); + + return CurlFactory::finish($this, $easy, $this->factory); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php new file mode 100644 index 0000000..2754d8e --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php @@ -0,0 +1,199 @@ +factory = isset($options['handle_factory']) + ? $options['handle_factory'] : new CurlFactory(50); + $this->selectTimeout = isset($options['select_timeout']) + ? $options['select_timeout'] : 1; + } + + public function __get($name) + { + if ($name === '_mh') { + return $this->_mh = curl_multi_init(); + } + + throw new \BadMethodCallException(); + } + + public function __destruct() + { + if (isset($this->_mh)) { + curl_multi_close($this->_mh); + unset($this->_mh); + } + } + + public function __invoke(RequestInterface $request, array $options) + { + $easy = $this->factory->create($request, $options); + $id = (int) $easy->handle; + + $promise = new Promise( + [$this, 'execute'], + function () use ($id) { + return $this->cancel($id); + } + ); + + $this->addRequest(['easy' => $easy, 'deferred' => $promise]); + + return $promise; + } + + /** + * Ticks the curl event loop. + */ + public function tick() + { + // Add any delayed handles if needed. + if ($this->delays) { + $currentTime = microtime(true); + foreach ($this->delays as $id => $delay) { + if ($currentTime >= $delay) { + unset($this->delays[$id]); + curl_multi_add_handle( + $this->_mh, + $this->handles[$id]['easy']->handle + ); + } + } + } + + // Step through the task queue which may add additional requests. + P\queue()->run(); + + if ($this->active && + curl_multi_select($this->_mh, $this->selectTimeout) === -1 + ) { + // Perform a usleep if a select returns -1. + // See: https://bugs.php.net/bug.php?id=61141 + usleep(250); + } + + while (curl_multi_exec($this->_mh, $this->active) === CURLM_CALL_MULTI_PERFORM); + + $this->processMessages(); + } + + /** + * Runs until all outstanding connections have completed. + */ + public function execute() + { + $queue = P\queue(); + + while ($this->handles || !$queue->isEmpty()) { + // If there are no transfers, then sleep for the next delay + if (!$this->active && $this->delays) { + usleep($this->timeToNext()); + } + $this->tick(); + } + } + + private function addRequest(array $entry) + { + $easy = $entry['easy']; + $id = (int) $easy->handle; + $this->handles[$id] = $entry; + if (empty($easy->options['delay'])) { + curl_multi_add_handle($this->_mh, $easy->handle); + } else { + $this->delays[$id] = microtime(true) + ($easy->options['delay'] / 1000); + } + } + + /** + * Cancels a handle from sending and removes references to it. + * + * @param int $id Handle ID to cancel and remove. + * + * @return bool True on success, false on failure. + */ + private function cancel($id) + { + // Cannot cancel if it has been processed. + if (!isset($this->handles[$id])) { + return false; + } + + $handle = $this->handles[$id]['easy']->handle; + unset($this->delays[$id], $this->handles[$id]); + curl_multi_remove_handle($this->_mh, $handle); + curl_close($handle); + + return true; + } + + private function processMessages() + { + while ($done = curl_multi_info_read($this->_mh)) { + $id = (int) $done['handle']; + curl_multi_remove_handle($this->_mh, $done['handle']); + + if (!isset($this->handles[$id])) { + // Probably was cancelled. + continue; + } + + $entry = $this->handles[$id]; + unset($this->handles[$id], $this->delays[$id]); + $entry['easy']->errno = $done['result']; + $entry['deferred']->resolve( + CurlFactory::finish( + $this, + $entry['easy'], + $this->factory + ) + ); + } + } + + private function timeToNext() + { + $currentTime = microtime(true); + $nextTime = PHP_INT_MAX; + foreach ($this->delays as $time) { + if ($time < $nextTime) { + $nextTime = $time; + } + } + + return max(0, $nextTime - $currentTime) * 1000000; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php b/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php new file mode 100644 index 0000000..7754e91 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php @@ -0,0 +1,92 @@ +headers)) { + throw new \RuntimeException('No headers have been received'); + } + + // HTTP-version SP status-code SP reason-phrase + $startLine = explode(' ', array_shift($this->headers), 3); + $headers = \GuzzleHttp\headers_from_lines($this->headers); + $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers); + + if (!empty($this->options['decode_content']) + && isset($normalizedKeys['content-encoding']) + ) { + $headers['x-encoded-content-encoding'] + = $headers[$normalizedKeys['content-encoding']]; + unset($headers[$normalizedKeys['content-encoding']]); + if (isset($normalizedKeys['content-length'])) { + $headers['x-encoded-content-length'] + = $headers[$normalizedKeys['content-length']]; + + $bodyLength = (int) $this->sink->getSize(); + if ($bodyLength) { + $headers[$normalizedKeys['content-length']] = $bodyLength; + } else { + unset($headers[$normalizedKeys['content-length']]); + } + } + } + + // Attach a response to the easy handle with the parsed headers. + $this->response = new Response( + $startLine[1], + $headers, + $this->sink, + substr($startLine[0], 5), + isset($startLine[2]) ? (string) $startLine[2] : null + ); + } + + public function __get($name) + { + $msg = $name === 'handle' + ? 'The EasyHandle has been released' + : 'Invalid property: ' . $name; + throw new \BadMethodCallException($msg); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php new file mode 100644 index 0000000..d892061 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php @@ -0,0 +1,189 @@ +onFulfilled = $onFulfilled; + $this->onRejected = $onRejected; + + if ($queue) { + call_user_func_array([$this, 'append'], $queue); + } + } + + public function __invoke(RequestInterface $request, array $options) + { + if (!$this->queue) { + throw new \OutOfBoundsException('Mock queue is empty'); + } + + if (isset($options['delay'])) { + usleep($options['delay'] * 1000); + } + + $this->lastRequest = $request; + $this->lastOptions = $options; + $response = array_shift($this->queue); + + if (isset($options['on_headers'])) { + if (!is_callable($options['on_headers'])) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + try { + $options['on_headers']($response); + } catch (\Exception $e) { + $msg = 'An error was encountered during the on_headers event'; + $response = new RequestException($msg, $request, $response, $e); + } + } + + if (is_callable($response)) { + $response = call_user_func($response, $request, $options); + } + + $response = $response instanceof \Exception + ? \GuzzleHttp\Promise\rejection_for($response) + : \GuzzleHttp\Promise\promise_for($response); + + return $response->then( + function ($value) use ($request, $options) { + $this->invokeStats($request, $options, $value); + if ($this->onFulfilled) { + call_user_func($this->onFulfilled, $value); + } + if (isset($options['sink'])) { + $contents = (string) $value->getBody(); + $sink = $options['sink']; + + if (is_resource($sink)) { + fwrite($sink, $contents); + } elseif (is_string($sink)) { + file_put_contents($sink, $contents); + } elseif ($sink instanceof \Psr\Http\Message\StreamInterface) { + $sink->write($contents); + } + } + + return $value; + }, + function ($reason) use ($request, $options) { + $this->invokeStats($request, $options, null, $reason); + if ($this->onRejected) { + call_user_func($this->onRejected, $reason); + } + return \GuzzleHttp\Promise\rejection_for($reason); + } + ); + } + + /** + * Adds one or more variadic requests, exceptions, callables, or promises + * to the queue. + */ + public function append() + { + foreach (func_get_args() as $value) { + if ($value instanceof ResponseInterface + || $value instanceof \Exception + || $value instanceof PromiseInterface + || is_callable($value) + ) { + $this->queue[] = $value; + } else { + throw new \InvalidArgumentException('Expected a response or ' + . 'exception. Found ' . \GuzzleHttp\describe_type($value)); + } + } + } + + /** + * Get the last received request. + * + * @return RequestInterface + */ + public function getLastRequest() + { + return $this->lastRequest; + } + + /** + * Get the last received request options. + * + * @return array + */ + public function getLastOptions() + { + return $this->lastOptions; + } + + /** + * Returns the number of remaining items in the queue. + * + * @return int + */ + public function count() + { + return count($this->queue); + } + + private function invokeStats( + RequestInterface $request, + array $options, + ResponseInterface $response = null, + $reason = null + ) { + if (isset($options['on_stats'])) { + $stats = new TransferStats($request, $response, 0, $reason); + call_user_func($options['on_stats'], $stats); + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php b/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php new file mode 100644 index 0000000..f8b00be --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php @@ -0,0 +1,55 @@ +withoutHeader('Expect'); + + // Append a content-length header if body size is zero to match + // cURL's behavior. + if (0 === $request->getBody()->getSize()) { + $request = $request->withHeader('Content-Length', 0); + } + + return $this->createResponse( + $request, + $options, + $this->createStream($request, $options), + $startTime + ); + } catch (\InvalidArgumentException $e) { + throw $e; + } catch (\Exception $e) { + // Determine if the error was a networking error. + $message = $e->getMessage(); + // This list can probably get more comprehensive. + if (strpos($message, 'getaddrinfo') // DNS lookup failed + || strpos($message, 'Connection refused') + || strpos($message, "couldn't connect to host") // error on HHVM + || strpos($message, "connection attempt failed") + ) { + $e = new ConnectException($e->getMessage(), $request, $e); + } + $e = RequestException::wrapException($request, $e); + $this->invokeStats($options, $request, $startTime, null, $e); + + return \GuzzleHttp\Promise\rejection_for($e); + } + } + + private function invokeStats( + array $options, + RequestInterface $request, + $startTime, + ResponseInterface $response = null, + $error = null + ) { + if (isset($options['on_stats'])) { + $stats = new TransferStats( + $request, + $response, + microtime(true) - $startTime, + $error, + [] + ); + call_user_func($options['on_stats'], $stats); + } + } + + private function createResponse( + RequestInterface $request, + array $options, + $stream, + $startTime + ) { + $hdrs = $this->lastHeaders; + $this->lastHeaders = []; + $parts = explode(' ', array_shift($hdrs), 3); + $ver = explode('/', $parts[0])[1]; + $status = $parts[1]; + $reason = isset($parts[2]) ? $parts[2] : null; + $headers = \GuzzleHttp\headers_from_lines($hdrs); + list($stream, $headers) = $this->checkDecode($options, $headers, $stream); + $stream = Psr7\stream_for($stream); + $sink = $stream; + + if (strcasecmp('HEAD', $request->getMethod())) { + $sink = $this->createSink($stream, $options); + } + + $response = new Psr7\Response($status, $headers, $sink, $ver, $reason); + + if (isset($options['on_headers'])) { + try { + $options['on_headers']($response); + } catch (\Exception $e) { + $msg = 'An error was encountered during the on_headers event'; + $ex = new RequestException($msg, $request, $response, $e); + return \GuzzleHttp\Promise\rejection_for($ex); + } + } + + // Do not drain when the request is a HEAD request because they have + // no body. + if ($sink !== $stream) { + $this->drain( + $stream, + $sink, + $response->getHeaderLine('Content-Length') + ); + } + + $this->invokeStats($options, $request, $startTime, $response, null); + + return new FulfilledPromise($response); + } + + private function createSink(StreamInterface $stream, array $options) + { + if (!empty($options['stream'])) { + return $stream; + } + + $sink = isset($options['sink']) + ? $options['sink'] + : fopen('php://temp', 'r+'); + + return is_string($sink) + ? new Psr7\LazyOpenStream($sink, 'w+') + : Psr7\stream_for($sink); + } + + private function checkDecode(array $options, array $headers, $stream) + { + // Automatically decode responses when instructed. + if (!empty($options['decode_content'])) { + $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers); + if (isset($normalizedKeys['content-encoding'])) { + $encoding = $headers[$normalizedKeys['content-encoding']]; + if ($encoding[0] === 'gzip' || $encoding[0] === 'deflate') { + $stream = new Psr7\InflateStream( + Psr7\stream_for($stream) + ); + $headers['x-encoded-content-encoding'] + = $headers[$normalizedKeys['content-encoding']]; + // Remove content-encoding header + unset($headers[$normalizedKeys['content-encoding']]); + // Fix content-length header + if (isset($normalizedKeys['content-length'])) { + $headers['x-encoded-content-length'] + = $headers[$normalizedKeys['content-length']]; + + $length = (int) $stream->getSize(); + if ($length === 0) { + unset($headers[$normalizedKeys['content-length']]); + } else { + $headers[$normalizedKeys['content-length']] = [$length]; + } + } + } + } + } + + return [$stream, $headers]; + } + + /** + * Drains the source stream into the "sink" client option. + * + * @param StreamInterface $source + * @param StreamInterface $sink + * @param string $contentLength Header specifying the amount of + * data to read. + * + * @return StreamInterface + * @throws \RuntimeException when the sink option is invalid. + */ + private function drain( + StreamInterface $source, + StreamInterface $sink, + $contentLength + ) { + // If a content-length header is provided, then stop reading once + // that number of bytes has been read. This can prevent infinitely + // reading from a stream when dealing with servers that do not honor + // Connection: Close headers. + Psr7\copy_to_stream( + $source, + $sink, + (strlen($contentLength) > 0 && (int) $contentLength > 0) ? (int) $contentLength : -1 + ); + + $sink->seek(0); + $source->close(); + + return $sink; + } + + /** + * Create a resource and check to ensure it was created successfully + * + * @param callable $callback Callable that returns stream resource + * + * @return resource + * @throws \RuntimeException on error + */ + private function createResource(callable $callback) + { + $errors = null; + set_error_handler(function ($_, $msg, $file, $line) use (&$errors) { + $errors[] = [ + 'message' => $msg, + 'file' => $file, + 'line' => $line + ]; + return true; + }); + + $resource = $callback(); + restore_error_handler(); + + if (!$resource) { + $message = 'Error creating resource: '; + foreach ($errors as $err) { + foreach ($err as $key => $value) { + $message .= "[$key] $value" . PHP_EOL; + } + } + throw new \RuntimeException(trim($message)); + } + + return $resource; + } + + private function createStream(RequestInterface $request, array $options) + { + static $methods; + if (!$methods) { + $methods = array_flip(get_class_methods(__CLASS__)); + } + + // HTTP/1.1 streams using the PHP stream wrapper require a + // Connection: close header + if ($request->getProtocolVersion() == '1.1' + && !$request->hasHeader('Connection') + ) { + $request = $request->withHeader('Connection', 'close'); + } + + // Ensure SSL is verified by default + if (!isset($options['verify'])) { + $options['verify'] = true; + } + + $params = []; + $context = $this->getDefaultContext($request); + + if (isset($options['on_headers']) && !is_callable($options['on_headers'])) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + + if (!empty($options)) { + foreach ($options as $key => $value) { + $method = "add_{$key}"; + if (isset($methods[$method])) { + $this->{$method}($request, $context, $value, $params); + } + } + } + + if (isset($options['stream_context'])) { + if (!is_array($options['stream_context'])) { + throw new \InvalidArgumentException('stream_context must be an array'); + } + $context = array_replace_recursive( + $context, + $options['stream_context'] + ); + } + + // Microsoft NTLM authentication only supported with curl handler + if (isset($options['auth']) + && is_array($options['auth']) + && isset($options['auth'][2]) + && 'ntlm' == $options['auth'][2] + ) { + throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler'); + } + + $uri = $this->resolveHost($request, $options); + + $context = $this->createResource( + function () use ($context, $params) { + return stream_context_create($context, $params); + } + ); + + return $this->createResource( + function () use ($uri, &$http_response_header, $context, $options) { + $resource = fopen((string) $uri, 'r', null, $context); + $this->lastHeaders = $http_response_header; + + if (isset($options['read_timeout'])) { + $readTimeout = $options['read_timeout']; + $sec = (int) $readTimeout; + $usec = ($readTimeout - $sec) * 100000; + stream_set_timeout($resource, $sec, $usec); + } + + return $resource; + } + ); + } + + private function resolveHost(RequestInterface $request, array $options) + { + $uri = $request->getUri(); + + if (isset($options['force_ip_resolve']) && !filter_var($uri->getHost(), FILTER_VALIDATE_IP)) { + if ('v4' === $options['force_ip_resolve']) { + $records = dns_get_record($uri->getHost(), DNS_A); + if (!isset($records[0]['ip'])) { + throw new ConnectException(sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request); + } + $uri = $uri->withHost($records[0]['ip']); + } elseif ('v6' === $options['force_ip_resolve']) { + $records = dns_get_record($uri->getHost(), DNS_AAAA); + if (!isset($records[0]['ipv6'])) { + throw new ConnectException(sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request); + } + $uri = $uri->withHost('[' . $records[0]['ipv6'] . ']'); + } + } + + return $uri; + } + + private function getDefaultContext(RequestInterface $request) + { + $headers = ''; + foreach ($request->getHeaders() as $name => $value) { + foreach ($value as $val) { + $headers .= "$name: $val\r\n"; + } + } + + $context = [ + 'http' => [ + 'method' => $request->getMethod(), + 'header' => $headers, + 'protocol_version' => $request->getProtocolVersion(), + 'ignore_errors' => true, + 'follow_location' => 0, + ], + ]; + + $body = (string) $request->getBody(); + + if (!empty($body)) { + $context['http']['content'] = $body; + // Prevent the HTTP handler from adding a Content-Type header. + if (!$request->hasHeader('Content-Type')) { + $context['http']['header'] .= "Content-Type:\r\n"; + } + } + + $context['http']['header'] = rtrim($context['http']['header']); + + return $context; + } + + private function add_proxy(RequestInterface $request, &$options, $value, &$params) + { + if (!is_array($value)) { + $options['http']['proxy'] = $value; + } else { + $scheme = $request->getUri()->getScheme(); + if (isset($value[$scheme])) { + if (!isset($value['no']) + || !\GuzzleHttp\is_host_in_noproxy( + $request->getUri()->getHost(), + $value['no'] + ) + ) { + $options['http']['proxy'] = $value[$scheme]; + } + } + } + } + + private function add_timeout(RequestInterface $request, &$options, $value, &$params) + { + if ($value > 0) { + $options['http']['timeout'] = $value; + } + } + + private function add_verify(RequestInterface $request, &$options, $value, &$params) + { + if ($value === true) { + // PHP 5.6 or greater will find the system cert by default. When + // < 5.6, use the Guzzle bundled cacert. + if (PHP_VERSION_ID < 50600) { + $options['ssl']['cafile'] = \GuzzleHttp\default_ca_bundle(); + } + } elseif (is_string($value)) { + $options['ssl']['cafile'] = $value; + if (!file_exists($value)) { + throw new \RuntimeException("SSL CA bundle not found: $value"); + } + } elseif ($value === false) { + $options['ssl']['verify_peer'] = false; + $options['ssl']['verify_peer_name'] = false; + return; + } else { + throw new \InvalidArgumentException('Invalid verify request option'); + } + + $options['ssl']['verify_peer'] = true; + $options['ssl']['verify_peer_name'] = true; + $options['ssl']['allow_self_signed'] = false; + } + + private function add_cert(RequestInterface $request, &$options, $value, &$params) + { + if (is_array($value)) { + $options['ssl']['passphrase'] = $value[1]; + $value = $value[0]; + } + + if (!file_exists($value)) { + throw new \RuntimeException("SSL certificate not found: {$value}"); + } + + $options['ssl']['local_cert'] = $value; + } + + private function add_progress(RequestInterface $request, &$options, $value, &$params) + { + $this->addNotification( + $params, + function ($code, $a, $b, $c, $transferred, $total) use ($value) { + if ($code == STREAM_NOTIFY_PROGRESS) { + $value($total, $transferred, null, null); + } + } + ); + } + + private function add_debug(RequestInterface $request, &$options, $value, &$params) + { + if ($value === false) { + return; + } + + static $map = [ + STREAM_NOTIFY_CONNECT => 'CONNECT', + STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED', + STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT', + STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS', + STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS', + STREAM_NOTIFY_REDIRECTED => 'REDIRECTED', + STREAM_NOTIFY_PROGRESS => 'PROGRESS', + STREAM_NOTIFY_FAILURE => 'FAILURE', + STREAM_NOTIFY_COMPLETED => 'COMPLETED', + STREAM_NOTIFY_RESOLVE => 'RESOLVE', + ]; + static $args = ['severity', 'message', 'message_code', + 'bytes_transferred', 'bytes_max']; + + $value = \GuzzleHttp\debug_resource($value); + $ident = $request->getMethod() . ' ' . $request->getUri()->withFragment(''); + $this->addNotification( + $params, + function () use ($ident, $value, $map, $args) { + $passed = func_get_args(); + $code = array_shift($passed); + fprintf($value, '<%s> [%s] ', $ident, $map[$code]); + foreach (array_filter($passed) as $i => $v) { + fwrite($value, $args[$i] . ': "' . $v . '" '); + } + fwrite($value, "\n"); + } + ); + } + + private function addNotification(array &$params, callable $notify) + { + // Wrap the existing function if needed. + if (!isset($params['notification'])) { + $params['notification'] = $notify; + } else { + $params['notification'] = $this->callArray([ + $params['notification'], + $notify + ]); + } + } + + private function callArray(array $functions) + { + return function () use ($functions) { + $args = func_get_args(); + foreach ($functions as $fn) { + call_user_func_array($fn, $args); + } + }; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/HandlerStack.php b/vendor/guzzlehttp/guzzle/src/HandlerStack.php new file mode 100644 index 0000000..24c46fd --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/HandlerStack.php @@ -0,0 +1,273 @@ +push(Middleware::httpErrors(), 'http_errors'); + $stack->push(Middleware::redirect(), 'allow_redirects'); + $stack->push(Middleware::cookies(), 'cookies'); + $stack->push(Middleware::prepareBody(), 'prepare_body'); + + return $stack; + } + + /** + * @param callable $handler Underlying HTTP handler. + */ + public function __construct(callable $handler = null) + { + $this->handler = $handler; + } + + /** + * Invokes the handler stack as a composed handler + * + * @param RequestInterface $request + * @param array $options + */ + public function __invoke(RequestInterface $request, array $options) + { + $handler = $this->resolve(); + + return $handler($request, $options); + } + + /** + * Dumps a string representation of the stack. + * + * @return string + */ + public function __toString() + { + $depth = 0; + $stack = []; + if ($this->handler) { + $stack[] = "0) Handler: " . $this->debugCallable($this->handler); + } + + $result = ''; + foreach (array_reverse($this->stack) as $tuple) { + $depth++; + $str = "{$depth}) Name: '{$tuple[1]}', "; + $str .= "Function: " . $this->debugCallable($tuple[0]); + $result = "> {$str}\n{$result}"; + $stack[] = $str; + } + + foreach (array_keys($stack) as $k) { + $result .= "< {$stack[$k]}\n"; + } + + return $result; + } + + /** + * Set the HTTP handler that actually returns a promise. + * + * @param callable $handler Accepts a request and array of options and + * returns a Promise. + */ + public function setHandler(callable $handler) + { + $this->handler = $handler; + $this->cached = null; + } + + /** + * Returns true if the builder has a handler. + * + * @return bool + */ + public function hasHandler() + { + return (bool) $this->handler; + } + + /** + * Unshift a middleware to the bottom of the stack. + * + * @param callable $middleware Middleware function + * @param string $name Name to register for this middleware. + */ + public function unshift(callable $middleware, $name = null) + { + array_unshift($this->stack, [$middleware, $name]); + $this->cached = null; + } + + /** + * Push a middleware to the top of the stack. + * + * @param callable $middleware Middleware function + * @param string $name Name to register for this middleware. + */ + public function push(callable $middleware, $name = '') + { + $this->stack[] = [$middleware, $name]; + $this->cached = null; + } + + /** + * Add a middleware before another middleware by name. + * + * @param string $findName Middleware to find + * @param callable $middleware Middleware function + * @param string $withName Name to register for this middleware. + */ + public function before($findName, callable $middleware, $withName = '') + { + $this->splice($findName, $withName, $middleware, true); + } + + /** + * Add a middleware after another middleware by name. + * + * @param string $findName Middleware to find + * @param callable $middleware Middleware function + * @param string $withName Name to register for this middleware. + */ + public function after($findName, callable $middleware, $withName = '') + { + $this->splice($findName, $withName, $middleware, false); + } + + /** + * Remove a middleware by instance or name from the stack. + * + * @param callable|string $remove Middleware to remove by instance or name. + */ + public function remove($remove) + { + $this->cached = null; + $idx = is_callable($remove) ? 0 : 1; + $this->stack = array_values(array_filter( + $this->stack, + function ($tuple) use ($idx, $remove) { + return $tuple[$idx] !== $remove; + } + )); + } + + /** + * Compose the middleware and handler into a single callable function. + * + * @return callable + */ + public function resolve() + { + if (!$this->cached) { + if (!($prev = $this->handler)) { + throw new \LogicException('No handler has been specified'); + } + + foreach (array_reverse($this->stack) as $fn) { + $prev = $fn[0]($prev); + } + + $this->cached = $prev; + } + + return $this->cached; + } + + /** + * @param $name + * @return int + */ + private function findByName($name) + { + foreach ($this->stack as $k => $v) { + if ($v[1] === $name) { + return $k; + } + } + + throw new \InvalidArgumentException("Middleware not found: $name"); + } + + /** + * Splices a function into the middleware list at a specific position. + * + * @param $findName + * @param $withName + * @param callable $middleware + * @param $before + */ + private function splice($findName, $withName, callable $middleware, $before) + { + $this->cached = null; + $idx = $this->findByName($findName); + $tuple = [$middleware, $withName]; + + if ($before) { + if ($idx === 0) { + array_unshift($this->stack, $tuple); + } else { + $replacement = [$tuple, $this->stack[$idx]]; + array_splice($this->stack, $idx, 1, $replacement); + } + } elseif ($idx === count($this->stack) - 1) { + $this->stack[] = $tuple; + } else { + $replacement = [$this->stack[$idx], $tuple]; + array_splice($this->stack, $idx, 1, $replacement); + } + } + + /** + * Provides a debug string for a given callable. + * + * @param array|callable $fn Function to write as a string. + * + * @return string + */ + private function debugCallable($fn) + { + if (is_string($fn)) { + return "callable({$fn})"; + } + + if (is_array($fn)) { + return is_string($fn[0]) + ? "callable({$fn[0]}::{$fn[1]})" + : "callable(['" . get_class($fn[0]) . "', '{$fn[1]}'])"; + } + + return 'callable(' . spl_object_hash($fn) . ')'; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/MessageFormatter.php b/vendor/guzzlehttp/guzzle/src/MessageFormatter.php new file mode 100644 index 0000000..663ac73 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/MessageFormatter.php @@ -0,0 +1,180 @@ +>>>>>>>\n{request}\n<<<<<<<<\n{response}\n--------\n{error}"; + const SHORT = '[{ts}] "{method} {target} HTTP/{version}" {code}'; + + /** @var string Template used to format log messages */ + private $template; + + /** + * @param string $template Log message template + */ + public function __construct($template = self::CLF) + { + $this->template = $template ?: self::CLF; + } + + /** + * Returns a formatted message string. + * + * @param RequestInterface $request Request that was sent + * @param ResponseInterface $response Response that was received + * @param \Exception $error Exception that was received + * + * @return string + */ + public function format( + RequestInterface $request, + ResponseInterface $response = null, + \Exception $error = null + ) { + $cache = []; + + return preg_replace_callback( + '/{\s*([A-Za-z_\-\.0-9]+)\s*}/', + function (array $matches) use ($request, $response, $error, &$cache) { + if (isset($cache[$matches[1]])) { + return $cache[$matches[1]]; + } + + $result = ''; + switch ($matches[1]) { + case 'request': + $result = Psr7\str($request); + break; + case 'response': + $result = $response ? Psr7\str($response) : ''; + break; + case 'req_headers': + $result = trim($request->getMethod() + . ' ' . $request->getRequestTarget()) + . ' HTTP/' . $request->getProtocolVersion() . "\r\n" + . $this->headers($request); + break; + case 'res_headers': + $result = $response ? + sprintf( + 'HTTP/%s %d %s', + $response->getProtocolVersion(), + $response->getStatusCode(), + $response->getReasonPhrase() + ) . "\r\n" . $this->headers($response) + : 'NULL'; + break; + case 'req_body': + $result = $request->getBody(); + break; + case 'res_body': + $result = $response ? $response->getBody() : 'NULL'; + break; + case 'ts': + case 'date_iso_8601': + $result = gmdate('c'); + break; + case 'date_common_log': + $result = date('d/M/Y:H:i:s O'); + break; + case 'method': + $result = $request->getMethod(); + break; + case 'version': + $result = $request->getProtocolVersion(); + break; + case 'uri': + case 'url': + $result = $request->getUri(); + break; + case 'target': + $result = $request->getRequestTarget(); + break; + case 'req_version': + $result = $request->getProtocolVersion(); + break; + case 'res_version': + $result = $response + ? $response->getProtocolVersion() + : 'NULL'; + break; + case 'host': + $result = $request->getHeaderLine('Host'); + break; + case 'hostname': + $result = gethostname(); + break; + case 'code': + $result = $response ? $response->getStatusCode() : 'NULL'; + break; + case 'phrase': + $result = $response ? $response->getReasonPhrase() : 'NULL'; + break; + case 'error': + $result = $error ? $error->getMessage() : 'NULL'; + break; + default: + // handle prefixed dynamic headers + if (strpos($matches[1], 'req_header_') === 0) { + $result = $request->getHeaderLine(substr($matches[1], 11)); + } elseif (strpos($matches[1], 'res_header_') === 0) { + $result = $response + ? $response->getHeaderLine(substr($matches[1], 11)) + : 'NULL'; + } + } + + $cache[$matches[1]] = $result; + return $result; + }, + $this->template + ); + } + + private function headers(MessageInterface $message) + { + $result = ''; + foreach ($message->getHeaders() as $name => $values) { + $result .= $name . ': ' . implode(', ', $values) . "\r\n"; + } + + return trim($result); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Middleware.php b/vendor/guzzlehttp/guzzle/src/Middleware.php new file mode 100644 index 0000000..d4ad75c --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Middleware.php @@ -0,0 +1,255 @@ +withCookieHeader($request); + return $handler($request, $options) + ->then( + function ($response) use ($cookieJar, $request) { + $cookieJar->extractCookies($request, $response); + return $response; + } + ); + }; + }; + } + + /** + * Middleware that throws exceptions for 4xx or 5xx responses when the + * "http_error" request option is set to true. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function httpErrors() + { + return function (callable $handler) { + return function ($request, array $options) use ($handler) { + if (empty($options['http_errors'])) { + return $handler($request, $options); + } + return $handler($request, $options)->then( + function (ResponseInterface $response) use ($request, $handler) { + $code = $response->getStatusCode(); + if ($code < 400) { + return $response; + } + throw RequestException::create($request, $response); + } + ); + }; + }; + } + + /** + * Middleware that pushes history data to an ArrayAccess container. + * + * @param array|\ArrayAccess $container Container to hold the history (by reference). + * + * @return callable Returns a function that accepts the next handler. + * @throws \InvalidArgumentException if container is not an array or ArrayAccess. + */ + public static function history(&$container) + { + if (!is_array($container) && !$container instanceof \ArrayAccess) { + throw new \InvalidArgumentException('history container must be an array or object implementing ArrayAccess'); + } + + return function (callable $handler) use (&$container) { + return function ($request, array $options) use ($handler, &$container) { + return $handler($request, $options)->then( + function ($value) use ($request, &$container, $options) { + $container[] = [ + 'request' => $request, + 'response' => $value, + 'error' => null, + 'options' => $options + ]; + return $value; + }, + function ($reason) use ($request, &$container, $options) { + $container[] = [ + 'request' => $request, + 'response' => null, + 'error' => $reason, + 'options' => $options + ]; + return \GuzzleHttp\Promise\rejection_for($reason); + } + ); + }; + }; + } + + /** + * Middleware that invokes a callback before and after sending a request. + * + * The provided listener cannot modify or alter the response. It simply + * "taps" into the chain to be notified before returning the promise. The + * before listener accepts a request and options array, and the after + * listener accepts a request, options array, and response promise. + * + * @param callable $before Function to invoke before forwarding the request. + * @param callable $after Function invoked after forwarding. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function tap(callable $before = null, callable $after = null) + { + return function (callable $handler) use ($before, $after) { + return function ($request, array $options) use ($handler, $before, $after) { + if ($before) { + $before($request, $options); + } + $response = $handler($request, $options); + if ($after) { + $after($request, $options, $response); + } + return $response; + }; + }; + } + + /** + * Middleware that handles request redirects. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function redirect() + { + return function (callable $handler) { + return new RedirectMiddleware($handler); + }; + } + + /** + * Middleware that retries requests based on the boolean result of + * invoking the provided "decider" function. + * + * If no delay function is provided, a simple implementation of exponential + * backoff will be utilized. + * + * @param callable $decider Function that accepts the number of retries, + * a request, [response], and [exception] and + * returns true if the request is to be retried. + * @param callable $delay Function that accepts the number of retries and + * returns the number of milliseconds to delay. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function retry(callable $decider, callable $delay = null) + { + return function (callable $handler) use ($decider, $delay) { + return new RetryMiddleware($decider, $handler, $delay); + }; + } + + /** + * Middleware that logs requests, responses, and errors using a message + * formatter. + * + * @param LoggerInterface $logger Logs messages. + * @param MessageFormatter $formatter Formatter used to create message strings. + * @param string $logLevel Level at which to log requests. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = LogLevel::INFO) + { + return function (callable $handler) use ($logger, $formatter, $logLevel) { + return function ($request, array $options) use ($handler, $logger, $formatter, $logLevel) { + return $handler($request, $options)->then( + function ($response) use ($logger, $request, $formatter, $logLevel) { + $message = $formatter->format($request, $response); + $logger->log($logLevel, $message); + return $response; + }, + function ($reason) use ($logger, $request, $formatter) { + $response = $reason instanceof RequestException + ? $reason->getResponse() + : null; + $message = $formatter->format($request, $response, $reason); + $logger->notice($message); + return \GuzzleHttp\Promise\rejection_for($reason); + } + ); + }; + }; + } + + /** + * This middleware adds a default content-type if possible, a default + * content-length or transfer-encoding header, and the expect header. + * + * @return callable + */ + public static function prepareBody() + { + return function (callable $handler) { + return new PrepareBodyMiddleware($handler); + }; + } + + /** + * Middleware that applies a map function to the request before passing to + * the next handler. + * + * @param callable $fn Function that accepts a RequestInterface and returns + * a RequestInterface. + * @return callable + */ + public static function mapRequest(callable $fn) + { + return function (callable $handler) use ($fn) { + return function ($request, array $options) use ($handler, $fn) { + return $handler($fn($request), $options); + }; + }; + } + + /** + * Middleware that applies a map function to the resolved promise's + * response. + * + * @param callable $fn Function that accepts a ResponseInterface and + * returns a ResponseInterface. + * @return callable + */ + public static function mapResponse(callable $fn) + { + return function (callable $handler) use ($fn) { + return function ($request, array $options) use ($handler, $fn) { + return $handler($request, $options)->then($fn); + }; + }; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Pool.php b/vendor/guzzlehttp/guzzle/src/Pool.php new file mode 100644 index 0000000..8f1be33 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Pool.php @@ -0,0 +1,123 @@ + $rfn) { + if ($rfn instanceof RequestInterface) { + yield $key => $client->sendAsync($rfn, $opts); + } elseif (is_callable($rfn)) { + yield $key => $rfn($opts); + } else { + throw new \InvalidArgumentException('Each value yielded by ' + . 'the iterator must be a Psr7\Http\Message\RequestInterface ' + . 'or a callable that returns a promise that fulfills ' + . 'with a Psr7\Message\Http\ResponseInterface object.'); + } + } + }; + + $this->each = new EachPromise($requests(), $config); + } + + public function promise() + { + return $this->each->promise(); + } + + /** + * Sends multiple requests concurrently and returns an array of responses + * and exceptions that uses the same ordering as the provided requests. + * + * IMPORTANT: This method keeps every request and response in memory, and + * as such, is NOT recommended when sending a large number or an + * indeterminate number of requests concurrently. + * + * @param ClientInterface $client Client used to send the requests + * @param array|\Iterator $requests Requests to send concurrently. + * @param array $options Passes through the options available in + * {@see GuzzleHttp\Pool::__construct} + * + * @return array Returns an array containing the response or an exception + * in the same order that the requests were sent. + * @throws \InvalidArgumentException if the event format is incorrect. + */ + public static function batch( + ClientInterface $client, + $requests, + array $options = [] + ) { + $res = []; + self::cmpCallback($options, 'fulfilled', $res); + self::cmpCallback($options, 'rejected', $res); + $pool = new static($client, $requests, $options); + $pool->promise()->wait(); + ksort($res); + + return $res; + } + + private static function cmpCallback(array &$options, $name, array &$results) + { + if (!isset($options[$name])) { + $options[$name] = function ($v, $k) use (&$results) { + $results[$k] = $v; + }; + } else { + $currentFn = $options[$name]; + $options[$name] = function ($v, $k) use (&$results, $currentFn) { + $currentFn($v, $k); + $results[$k] = $v; + }; + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php b/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php new file mode 100644 index 0000000..2eb95f9 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php @@ -0,0 +1,106 @@ +nextHandler = $nextHandler; + } + + /** + * @param RequestInterface $request + * @param array $options + * + * @return PromiseInterface + */ + public function __invoke(RequestInterface $request, array $options) + { + $fn = $this->nextHandler; + + // Don't do anything if the request has no body. + if ($request->getBody()->getSize() === 0) { + return $fn($request, $options); + } + + $modify = []; + + // Add a default content-type if possible. + if (!$request->hasHeader('Content-Type')) { + if ($uri = $request->getBody()->getMetadata('uri')) { + if ($type = Psr7\mimetype_from_filename($uri)) { + $modify['set_headers']['Content-Type'] = $type; + } + } + } + + // Add a default content-length or transfer-encoding header. + if (!$request->hasHeader('Content-Length') + && !$request->hasHeader('Transfer-Encoding') + ) { + $size = $request->getBody()->getSize(); + if ($size !== null) { + $modify['set_headers']['Content-Length'] = $size; + } else { + $modify['set_headers']['Transfer-Encoding'] = 'chunked'; + } + } + + // Add the expect header if needed. + $this->addExpectHeader($request, $options, $modify); + + return $fn(Psr7\modify_request($request, $modify), $options); + } + + private function addExpectHeader( + RequestInterface $request, + array $options, + array &$modify + ) { + // Determine if the Expect header should be used + if ($request->hasHeader('Expect')) { + return; + } + + $expect = isset($options['expect']) ? $options['expect'] : null; + + // Return if disabled or if you're not using HTTP/1.1 or HTTP/2.0 + if ($expect === false || $request->getProtocolVersion() < 1.1) { + return; + } + + // The expect header is unconditionally enabled + if ($expect === true) { + $modify['set_headers']['Expect'] = '100-Continue'; + return; + } + + // By default, send the expect header when the payload is > 1mb + if ($expect === null) { + $expect = 1048576; + } + + // Always add if the body cannot be rewound, the size cannot be + // determined, or the size is greater than the cutoff threshold + $body = $request->getBody(); + $size = $body->getSize(); + + if ($size === null || $size >= (int) $expect || !$body->isSeekable()) { + $modify['set_headers']['Expect'] = '100-Continue'; + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php new file mode 100644 index 0000000..131b771 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php @@ -0,0 +1,237 @@ + 5, + 'protocols' => ['http', 'https'], + 'strict' => false, + 'referer' => false, + 'track_redirects' => false, + ]; + + /** @var callable */ + private $nextHandler; + + /** + * @param callable $nextHandler Next handler to invoke. + */ + public function __construct(callable $nextHandler) + { + $this->nextHandler = $nextHandler; + } + + /** + * @param RequestInterface $request + * @param array $options + * + * @return PromiseInterface + */ + public function __invoke(RequestInterface $request, array $options) + { + $fn = $this->nextHandler; + + if (empty($options['allow_redirects'])) { + return $fn($request, $options); + } + + if ($options['allow_redirects'] === true) { + $options['allow_redirects'] = self::$defaultSettings; + } elseif (!is_array($options['allow_redirects'])) { + throw new \InvalidArgumentException('allow_redirects must be true, false, or array'); + } else { + // Merge the default settings with the provided settings + $options['allow_redirects'] += self::$defaultSettings; + } + + if (empty($options['allow_redirects']['max'])) { + return $fn($request, $options); + } + + return $fn($request, $options) + ->then(function (ResponseInterface $response) use ($request, $options) { + return $this->checkRedirect($request, $options, $response); + }); + } + + /** + * @param RequestInterface $request + * @param array $options + * @param ResponseInterface|PromiseInterface $response + * + * @return ResponseInterface|PromiseInterface + */ + public function checkRedirect( + RequestInterface $request, + array $options, + ResponseInterface $response + ) { + if (substr($response->getStatusCode(), 0, 1) != '3' + || !$response->hasHeader('Location') + ) { + return $response; + } + + $this->guardMax($request, $options); + $nextRequest = $this->modifyRequest($request, $options, $response); + + if (isset($options['allow_redirects']['on_redirect'])) { + call_user_func( + $options['allow_redirects']['on_redirect'], + $request, + $response, + $nextRequest->getUri() + ); + } + + /** @var PromiseInterface|ResponseInterface $promise */ + $promise = $this($nextRequest, $options); + + // Add headers to be able to track history of redirects. + if (!empty($options['allow_redirects']['track_redirects'])) { + return $this->withTracking( + $promise, + (string) $nextRequest->getUri(), + $response->getStatusCode() + ); + } + + return $promise; + } + + private function withTracking(PromiseInterface $promise, $uri, $statusCode) + { + return $promise->then( + function (ResponseInterface $response) use ($uri, $statusCode) { + // Note that we are pushing to the front of the list as this + // would be an earlier response than what is currently present + // in the history header. + $historyHeader = $response->getHeader(self::HISTORY_HEADER); + $statusHeader = $response->getHeader(self::STATUS_HISTORY_HEADER); + array_unshift($historyHeader, $uri); + array_unshift($statusHeader, $statusCode); + return $response->withHeader(self::HISTORY_HEADER, $historyHeader) + ->withHeader(self::STATUS_HISTORY_HEADER, $statusHeader); + } + ); + } + + private function guardMax(RequestInterface $request, array &$options) + { + $current = isset($options['__redirect_count']) + ? $options['__redirect_count'] + : 0; + $options['__redirect_count'] = $current + 1; + $max = $options['allow_redirects']['max']; + + if ($options['__redirect_count'] > $max) { + throw new TooManyRedirectsException( + "Will not follow more than {$max} redirects", + $request + ); + } + } + + /** + * @param RequestInterface $request + * @param array $options + * @param ResponseInterface $response + * + * @return RequestInterface + */ + public function modifyRequest( + RequestInterface $request, + array $options, + ResponseInterface $response + ) { + // Request modifications to apply. + $modify = []; + $protocols = $options['allow_redirects']['protocols']; + + // Use a GET request if this is an entity enclosing request and we are + // not forcing RFC compliance, but rather emulating what all browsers + // would do. + $statusCode = $response->getStatusCode(); + if ($statusCode == 303 || + ($statusCode <= 302 && $request->getBody() && !$options['allow_redirects']['strict']) + ) { + $modify['method'] = 'GET'; + $modify['body'] = ''; + } + + $modify['uri'] = $this->redirectUri($request, $response, $protocols); + Psr7\rewind_body($request); + + // Add the Referer header if it is told to do so and only + // add the header if we are not redirecting from https to http. + if ($options['allow_redirects']['referer'] + && $modify['uri']->getScheme() === $request->getUri()->getScheme() + ) { + $uri = $request->getUri()->withUserInfo('', ''); + $modify['set_headers']['Referer'] = (string) $uri; + } else { + $modify['remove_headers'][] = 'Referer'; + } + + // Remove Authorization header if host is different. + if ($request->getUri()->getHost() !== $modify['uri']->getHost()) { + $modify['remove_headers'][] = 'Authorization'; + } + + return Psr7\modify_request($request, $modify); + } + + /** + * Set the appropriate URL on the request based on the location header + * + * @param RequestInterface $request + * @param ResponseInterface $response + * @param array $protocols + * + * @return UriInterface + */ + private function redirectUri( + RequestInterface $request, + ResponseInterface $response, + array $protocols + ) { + $location = Psr7\UriResolver::resolve( + $request->getUri(), + new Psr7\Uri($response->getHeaderLine('Location')) + ); + + // Ensure that the redirect URI is allowed based on the protocols. + if (!in_array($location->getScheme(), $protocols)) { + throw new BadResponseException( + sprintf( + 'Redirect URI, %s, does not use one of the allowed redirect protocols: %s', + $location, + implode(', ', $protocols) + ), + $request, + $response + ); + } + + return $location; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/RequestOptions.php b/vendor/guzzlehttp/guzzle/src/RequestOptions.php new file mode 100644 index 0000000..c6aacfb --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/RequestOptions.php @@ -0,0 +1,255 @@ +decider = $decider; + $this->nextHandler = $nextHandler; + $this->delay = $delay ?: __CLASS__ . '::exponentialDelay'; + } + + /** + * Default exponential backoff delay function. + * + * @param $retries + * + * @return int + */ + public static function exponentialDelay($retries) + { + return (int) pow(2, $retries - 1); + } + + /** + * @param RequestInterface $request + * @param array $options + * + * @return PromiseInterface + */ + public function __invoke(RequestInterface $request, array $options) + { + if (!isset($options['retries'])) { + $options['retries'] = 0; + } + + $fn = $this->nextHandler; + return $fn($request, $options) + ->then( + $this->onFulfilled($request, $options), + $this->onRejected($request, $options) + ); + } + + private function onFulfilled(RequestInterface $req, array $options) + { + return function ($value) use ($req, $options) { + if (!call_user_func( + $this->decider, + $options['retries'], + $req, + $value, + null + )) { + return $value; + } + return $this->doRetry($req, $options, $value); + }; + } + + private function onRejected(RequestInterface $req, array $options) + { + return function ($reason) use ($req, $options) { + if (!call_user_func( + $this->decider, + $options['retries'], + $req, + null, + $reason + )) { + return \GuzzleHttp\Promise\rejection_for($reason); + } + return $this->doRetry($req, $options); + }; + } + + private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null) + { + $options['delay'] = call_user_func($this->delay, ++$options['retries'], $response); + + return $this($request, $options); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/TransferStats.php b/vendor/guzzlehttp/guzzle/src/TransferStats.php new file mode 100644 index 0000000..15f717e --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/TransferStats.php @@ -0,0 +1,126 @@ +request = $request; + $this->response = $response; + $this->transferTime = $transferTime; + $this->handlerErrorData = $handlerErrorData; + $this->handlerStats = $handlerStats; + } + + /** + * @return RequestInterface + */ + public function getRequest() + { + return $this->request; + } + + /** + * Returns the response that was received (if any). + * + * @return ResponseInterface|null + */ + public function getResponse() + { + return $this->response; + } + + /** + * Returns true if a response was received. + * + * @return bool + */ + public function hasResponse() + { + return $this->response !== null; + } + + /** + * Gets handler specific error data. + * + * This might be an exception, a integer representing an error code, or + * anything else. Relying on this value assumes that you know what handler + * you are using. + * + * @return mixed + */ + public function getHandlerErrorData() + { + return $this->handlerErrorData; + } + + /** + * Get the effective URI the request was sent to. + * + * @return UriInterface + */ + public function getEffectiveUri() + { + return $this->request->getUri(); + } + + /** + * Get the estimated time the request was being transferred by the handler. + * + * @return float Time in seconds. + */ + public function getTransferTime() + { + return $this->transferTime; + } + + /** + * Gets an array of all of the handler specific transfer data. + * + * @return array + */ + public function getHandlerStats() + { + return $this->handlerStats; + } + + /** + * Get a specific handler statistic from the handler by name. + * + * @param string $stat Handler specific transfer stat to retrieve. + * + * @return mixed|null + */ + public function getHandlerStat($stat) + { + return isset($this->handlerStats[$stat]) + ? $this->handlerStats[$stat] + : null; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/UriTemplate.php b/vendor/guzzlehttp/guzzle/src/UriTemplate.php new file mode 100644 index 0000000..96dcfd0 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/UriTemplate.php @@ -0,0 +1,237 @@ + ['prefix' => '', 'joiner' => ',', 'query' => false], + '+' => ['prefix' => '', 'joiner' => ',', 'query' => false], + '#' => ['prefix' => '#', 'joiner' => ',', 'query' => false], + '.' => ['prefix' => '.', 'joiner' => '.', 'query' => false], + '/' => ['prefix' => '/', 'joiner' => '/', 'query' => false], + ';' => ['prefix' => ';', 'joiner' => ';', 'query' => true], + '?' => ['prefix' => '?', 'joiner' => '&', 'query' => true], + '&' => ['prefix' => '&', 'joiner' => '&', 'query' => true] + ]; + + /** @var array Delimiters */ + private static $delims = [':', '/', '?', '#', '[', ']', '@', '!', '$', + '&', '\'', '(', ')', '*', '+', ',', ';', '=']; + + /** @var array Percent encoded delimiters */ + private static $delimsPct = ['%3A', '%2F', '%3F', '%23', '%5B', '%5D', + '%40', '%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C', + '%3B', '%3D']; + + public function expand($template, array $variables) + { + if (false === strpos($template, '{')) { + return $template; + } + + $this->template = $template; + $this->variables = $variables; + + return preg_replace_callback( + '/\{([^\}]+)\}/', + [$this, 'expandMatch'], + $this->template + ); + } + + /** + * Parse an expression into parts + * + * @param string $expression Expression to parse + * + * @return array Returns an associative array of parts + */ + private function parseExpression($expression) + { + $result = []; + + if (isset(self::$operatorHash[$expression[0]])) { + $result['operator'] = $expression[0]; + $expression = substr($expression, 1); + } else { + $result['operator'] = ''; + } + + foreach (explode(',', $expression) as $value) { + $value = trim($value); + $varspec = []; + if ($colonPos = strpos($value, ':')) { + $varspec['value'] = substr($value, 0, $colonPos); + $varspec['modifier'] = ':'; + $varspec['position'] = (int) substr($value, $colonPos + 1); + } elseif (substr($value, -1) === '*') { + $varspec['modifier'] = '*'; + $varspec['value'] = substr($value, 0, -1); + } else { + $varspec['value'] = (string) $value; + $varspec['modifier'] = ''; + } + $result['values'][] = $varspec; + } + + return $result; + } + + /** + * Process an expansion + * + * @param array $matches Matches met in the preg_replace_callback + * + * @return string Returns the replacement string + */ + private function expandMatch(array $matches) + { + static $rfc1738to3986 = ['+' => '%20', '%7e' => '~']; + + $replacements = []; + $parsed = self::parseExpression($matches[1]); + $prefix = self::$operatorHash[$parsed['operator']]['prefix']; + $joiner = self::$operatorHash[$parsed['operator']]['joiner']; + $useQuery = self::$operatorHash[$parsed['operator']]['query']; + + foreach ($parsed['values'] as $value) { + if (!isset($this->variables[$value['value']])) { + continue; + } + + $variable = $this->variables[$value['value']]; + $actuallyUseQuery = $useQuery; + $expanded = ''; + + if (is_array($variable)) { + $isAssoc = $this->isAssoc($variable); + $kvp = []; + foreach ($variable as $key => $var) { + if ($isAssoc) { + $key = rawurlencode($key); + $isNestedArray = is_array($var); + } else { + $isNestedArray = false; + } + + if (!$isNestedArray) { + $var = rawurlencode($var); + if ($parsed['operator'] === '+' || + $parsed['operator'] === '#' + ) { + $var = $this->decodeReserved($var); + } + } + + if ($value['modifier'] === '*') { + if ($isAssoc) { + if ($isNestedArray) { + // Nested arrays must allow for deeply nested + // structures. + $var = strtr( + http_build_query([$key => $var]), + $rfc1738to3986 + ); + } else { + $var = $key . '=' . $var; + } + } elseif ($key > 0 && $actuallyUseQuery) { + $var = $value['value'] . '=' . $var; + } + } + + $kvp[$key] = $var; + } + + if (empty($variable)) { + $actuallyUseQuery = false; + } elseif ($value['modifier'] === '*') { + $expanded = implode($joiner, $kvp); + if ($isAssoc) { + // Don't prepend the value name when using the explode + // modifier with an associative array. + $actuallyUseQuery = false; + } + } else { + if ($isAssoc) { + // When an associative array is encountered and the + // explode modifier is not set, then the result must be + // a comma separated list of keys followed by their + // respective values. + foreach ($kvp as $k => &$v) { + $v = $k . ',' . $v; + } + } + $expanded = implode(',', $kvp); + } + } else { + if ($value['modifier'] === ':') { + $variable = substr($variable, 0, $value['position']); + } + $expanded = rawurlencode($variable); + if ($parsed['operator'] === '+' || $parsed['operator'] === '#') { + $expanded = $this->decodeReserved($expanded); + } + } + + if ($actuallyUseQuery) { + if (!$expanded && $joiner !== '&') { + $expanded = $value['value']; + } else { + $expanded = $value['value'] . '=' . $expanded; + } + } + + $replacements[] = $expanded; + } + + $ret = implode($joiner, $replacements); + if ($ret && $prefix) { + return $prefix . $ret; + } + + return $ret; + } + + /** + * Determines if an array is associative. + * + * This makes the assumption that input arrays are sequences or hashes. + * This assumption is a tradeoff for accuracy in favor of speed, but it + * should work in almost every case where input is supplied for a URI + * template. + * + * @param array $array Array to check + * + * @return bool + */ + private function isAssoc(array $array) + { + return $array && array_keys($array)[0] !== 0; + } + + /** + * Removes percent encoding on reserved characters (used with + and # + * modifiers). + * + * @param string $string String to fix + * + * @return string + */ + private function decodeReserved($string) + { + return str_replace(self::$delimsPct, self::$delims, $string); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/functions.php b/vendor/guzzlehttp/guzzle/src/functions.php new file mode 100644 index 0000000..a3ac450 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/functions.php @@ -0,0 +1,333 @@ +expand($template, $variables); +} + +/** + * Debug function used to describe the provided value type and class. + * + * @param mixed $input + * + * @return string Returns a string containing the type of the variable and + * if a class is provided, the class name. + */ +function describe_type($input) +{ + switch (gettype($input)) { + case 'object': + return 'object(' . get_class($input) . ')'; + case 'array': + return 'array(' . count($input) . ')'; + default: + ob_start(); + var_dump($input); + // normalize float vs double + return str_replace('double(', 'float(', rtrim(ob_get_clean())); + } +} + +/** + * Parses an array of header lines into an associative array of headers. + * + * @param array $lines Header lines array of strings in the following + * format: "Name: Value" + * @return array + */ +function headers_from_lines($lines) +{ + $headers = []; + + foreach ($lines as $line) { + $parts = explode(':', $line, 2); + $headers[trim($parts[0])][] = isset($parts[1]) + ? trim($parts[1]) + : null; + } + + return $headers; +} + +/** + * Returns a debug stream based on the provided variable. + * + * @param mixed $value Optional value + * + * @return resource + */ +function debug_resource($value = null) +{ + if (is_resource($value)) { + return $value; + } elseif (defined('STDOUT')) { + return STDOUT; + } + + return fopen('php://output', 'w'); +} + +/** + * Chooses and creates a default handler to use based on the environment. + * + * The returned handler is not wrapped by any default middlewares. + * + * @throws \RuntimeException if no viable Handler is available. + * @return callable Returns the best handler for the given system. + */ +function choose_handler() +{ + $handler = null; + if (function_exists('curl_multi_exec') && function_exists('curl_exec')) { + $handler = Proxy::wrapSync(new CurlMultiHandler(), new CurlHandler()); + } elseif (function_exists('curl_exec')) { + $handler = new CurlHandler(); + } elseif (function_exists('curl_multi_exec')) { + $handler = new CurlMultiHandler(); + } + + if (ini_get('allow_url_fopen')) { + $handler = $handler + ? Proxy::wrapStreaming($handler, new StreamHandler()) + : new StreamHandler(); + } elseif (!$handler) { + throw new \RuntimeException('GuzzleHttp requires cURL, the ' + . 'allow_url_fopen ini setting, or a custom HTTP handler.'); + } + + return $handler; +} + +/** + * Get the default User-Agent string to use with Guzzle + * + * @return string + */ +function default_user_agent() +{ + static $defaultAgent = ''; + + if (!$defaultAgent) { + $defaultAgent = 'GuzzleHttp/' . Client::VERSION; + if (extension_loaded('curl') && function_exists('curl_version')) { + $defaultAgent .= ' curl/' . \curl_version()['version']; + } + $defaultAgent .= ' PHP/' . PHP_VERSION; + } + + return $defaultAgent; +} + +/** + * Returns the default cacert bundle for the current system. + * + * First, the openssl.cafile and curl.cainfo php.ini settings are checked. + * If those settings are not configured, then the common locations for + * bundles found on Red Hat, CentOS, Fedora, Ubuntu, Debian, FreeBSD, OS X + * and Windows are checked. If any of these file locations are found on + * disk, they will be utilized. + * + * Note: the result of this function is cached for subsequent calls. + * + * @return string + * @throws \RuntimeException if no bundle can be found. + */ +function default_ca_bundle() +{ + static $cached = null; + static $cafiles = [ + // Red Hat, CentOS, Fedora (provided by the ca-certificates package) + '/etc/pki/tls/certs/ca-bundle.crt', + // Ubuntu, Debian (provided by the ca-certificates package) + '/etc/ssl/certs/ca-certificates.crt', + // FreeBSD (provided by the ca_root_nss package) + '/usr/local/share/certs/ca-root-nss.crt', + // SLES 12 (provided by the ca-certificates package) + '/var/lib/ca-certificates/ca-bundle.pem', + // OS X provided by homebrew (using the default path) + '/usr/local/etc/openssl/cert.pem', + // Google app engine + '/etc/ca-certificates.crt', + // Windows? + 'C:\\windows\\system32\\curl-ca-bundle.crt', + 'C:\\windows\\curl-ca-bundle.crt', + ]; + + if ($cached) { + return $cached; + } + + if ($ca = ini_get('openssl.cafile')) { + return $cached = $ca; + } + + if ($ca = ini_get('curl.cainfo')) { + return $cached = $ca; + } + + foreach ($cafiles as $filename) { + if (file_exists($filename)) { + return $cached = $filename; + } + } + + throw new \RuntimeException(<<< EOT +No system CA bundle could be found in any of the the common system locations. +PHP versions earlier than 5.6 are not properly configured to use the system's +CA bundle by default. In order to verify peer certificates, you will need to +supply the path on disk to a certificate bundle to the 'verify' request +option: http://docs.guzzlephp.org/en/latest/clients.html#verify. If you do not +need a specific certificate bundle, then Mozilla provides a commonly used CA +bundle which can be downloaded here (provided by the maintainer of cURL): +https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt. Once +you have a CA bundle available on disk, you can set the 'openssl.cafile' PHP +ini setting to point to the path to the file, allowing you to omit the 'verify' +request option. See http://curl.haxx.se/docs/sslcerts.html for more +information. +EOT + ); +} + +/** + * Creates an associative array of lowercase header names to the actual + * header casing. + * + * @param array $headers + * + * @return array + */ +function normalize_header_keys(array $headers) +{ + $result = []; + foreach (array_keys($headers) as $key) { + $result[strtolower($key)] = $key; + } + + return $result; +} + +/** + * Returns true if the provided host matches any of the no proxy areas. + * + * This method will strip a port from the host if it is present. Each pattern + * can be matched with an exact match (e.g., "foo.com" == "foo.com") or a + * partial match: (e.g., "foo.com" == "baz.foo.com" and ".foo.com" == + * "baz.foo.com", but ".foo.com" != "foo.com"). + * + * Areas are matched in the following cases: + * 1. "*" (without quotes) always matches any hosts. + * 2. An exact match. + * 3. The area starts with "." and the area is the last part of the host. e.g. + * '.mit.edu' will match any host that ends with '.mit.edu'. + * + * @param string $host Host to check against the patterns. + * @param array $noProxyArray An array of host patterns. + * + * @return bool + */ +function is_host_in_noproxy($host, array $noProxyArray) +{ + if (strlen($host) === 0) { + throw new \InvalidArgumentException('Empty host provided'); + } + + // Strip port if present. + if (strpos($host, ':')) { + $host = explode($host, ':', 2)[0]; + } + + foreach ($noProxyArray as $area) { + // Always match on wildcards. + if ($area === '*') { + return true; + } elseif (empty($area)) { + // Don't match on empty values. + continue; + } elseif ($area === $host) { + // Exact matches. + return true; + } else { + // Special match if the area when prefixed with ".". Remove any + // existing leading "." and add a new leading ".". + $area = '.' . ltrim($area, '.'); + if (substr($host, -(strlen($area))) === $area) { + return true; + } + } + } + + return false; +} + +/** + * Wrapper for json_decode that throws when an error occurs. + * + * @param string $json JSON data to parse + * @param bool $assoc When true, returned objects will be converted + * into associative arrays. + * @param int $depth User specified recursion depth. + * @param int $options Bitmask of JSON decode options. + * + * @return mixed + * @throws \InvalidArgumentException if the JSON cannot be decoded. + * @link http://www.php.net/manual/en/function.json-decode.php + */ +function json_decode($json, $assoc = false, $depth = 512, $options = 0) +{ + $data = \json_decode($json, $assoc, $depth, $options); + if (JSON_ERROR_NONE !== json_last_error()) { + throw new \InvalidArgumentException( + 'json_decode error: ' . json_last_error_msg() + ); + } + + return $data; +} + +/** + * Wrapper for JSON encoding that throws when an error occurs. + * + * @param mixed $value The value being encoded + * @param int $options JSON encode option bitmask + * @param int $depth Set the maximum depth. Must be greater than zero. + * + * @return string + * @throws \InvalidArgumentException if the JSON cannot be encoded. + * @link http://www.php.net/manual/en/function.json-encode.php + */ +function json_encode($value, $options = 0, $depth = 512) +{ + $json = \json_encode($value, $options, $depth); + if (JSON_ERROR_NONE !== json_last_error()) { + throw new \InvalidArgumentException( + 'json_encode error: ' . json_last_error_msg() + ); + } + + return $json; +} diff --git a/vendor/guzzlehttp/guzzle/src/functions_include.php b/vendor/guzzlehttp/guzzle/src/functions_include.php new file mode 100644 index 0000000..a93393a --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/functions_include.php @@ -0,0 +1,6 @@ + + +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/guzzlehttp/promises/Makefile b/vendor/guzzlehttp/promises/Makefile new file mode 100644 index 0000000..8d5b3ef --- /dev/null +++ b/vendor/guzzlehttp/promises/Makefile @@ -0,0 +1,13 @@ +all: clean test + +test: + vendor/bin/phpunit + +coverage: + vendor/bin/phpunit --coverage-html=artifacts/coverage + +view-coverage: + open artifacts/coverage/index.html + +clean: + rm -rf artifacts/* diff --git a/vendor/guzzlehttp/promises/README.md b/vendor/guzzlehttp/promises/README.md new file mode 100644 index 0000000..7b607e2 --- /dev/null +++ b/vendor/guzzlehttp/promises/README.md @@ -0,0 +1,504 @@ +# Guzzle Promises + +[Promises/A+](https://promisesaplus.com/) implementation that handles promise +chaining and resolution iteratively, allowing for "infinite" promise chaining +while keeping the stack size constant. Read [this blog post](https://blog.domenic.me/youre-missing-the-point-of-promises/) +for a general introduction to promises. + +- [Features](#features) +- [Quick start](#quick-start) +- [Synchronous wait](#synchronous-wait) +- [Cancellation](#cancellation) +- [API](#api) + - [Promise](#promise) + - [FulfilledPromise](#fulfilledpromise) + - [RejectedPromise](#rejectedpromise) +- [Promise interop](#promise-interop) +- [Implementation notes](#implementation-notes) + + +# Features + +- [Promises/A+](https://promisesaplus.com/) implementation. +- Promise resolution and chaining is handled iteratively, allowing for + "infinite" promise chaining. +- Promises have a synchronous `wait` method. +- Promises can be cancelled. +- Works with any object that has a `then` function. +- C# style async/await coroutine promises using + `GuzzleHttp\Promise\coroutine()`. + + +# Quick start + +A *promise* represents the eventual result of an asynchronous operation. The +primary way of interacting with a promise is through its `then` method, which +registers callbacks to receive either a promise's eventual value or the reason +why the promise cannot be fulfilled. + + +## Callbacks + +Callbacks are registered with the `then` method by providing an optional +`$onFulfilled` followed by an optional `$onRejected` function. + + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise->then( + // $onFulfilled + function ($value) { + echo 'The promise was fulfilled.'; + }, + // $onRejected + function ($reason) { + echo 'The promise was rejected.'; + } +); +``` + +*Resolving* a promise means that you either fulfill a promise with a *value* or +reject a promise with a *reason*. Resolving a promises triggers callbacks +registered with the promises's `then` method. These callbacks are triggered +only once and in the order in which they were added. + + +## Resolving a promise + +Promises are fulfilled using the `resolve($value)` method. Resolving a promise +with any value other than a `GuzzleHttp\Promise\RejectedPromise` will trigger +all of the onFulfilled callbacks (resolving a promise with a rejected promise +will reject the promise and trigger the `$onRejected` callbacks). + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise + ->then(function ($value) { + // Return a value and don't break the chain + return "Hello, " . $value; + }) + // This then is executed after the first then and receives the value + // returned from the first then. + ->then(function ($value) { + echo $value; + }); + +// Resolving the promise triggers the $onFulfilled callbacks and outputs +// "Hello, reader". +$promise->resolve('reader.'); +``` + + +## Promise forwarding + +Promises can be chained one after the other. Each then in the chain is a new +promise. The return value of a promise is what's forwarded to the next +promise in the chain. Returning a promise in a `then` callback will cause the +subsequent promises in the chain to only be fulfilled when the returned promise +has been fulfilled. The next promise in the chain will be invoked with the +resolved value of the promise. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$nextPromise = new Promise(); + +$promise + ->then(function ($value) use ($nextPromise) { + echo $value; + return $nextPromise; + }) + ->then(function ($value) { + echo $value; + }); + +// Triggers the first callback and outputs "A" +$promise->resolve('A'); +// Triggers the second callback and outputs "B" +$nextPromise->resolve('B'); +``` + +## Promise rejection + +When a promise is rejected, the `$onRejected` callbacks are invoked with the +rejection reason. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise->then(null, function ($reason) { + echo $reason; +}); + +$promise->reject('Error!'); +// Outputs "Error!" +``` + +## Rejection forwarding + +If an exception is thrown in an `$onRejected` callback, subsequent +`$onRejected` callbacks are invoked with the thrown exception as the reason. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise->then(null, function ($reason) { + throw new \Exception($reason); +})->then(null, function ($reason) { + assert($reason->getMessage() === 'Error!'); +}); + +$promise->reject('Error!'); +``` + +You can also forward a rejection down the promise chain by returning a +`GuzzleHttp\Promise\RejectedPromise` in either an `$onFulfilled` or +`$onRejected` callback. + +```php +use GuzzleHttp\Promise\Promise; +use GuzzleHttp\Promise\RejectedPromise; + +$promise = new Promise(); +$promise->then(null, function ($reason) { + return new RejectedPromise($reason); +})->then(null, function ($reason) { + assert($reason === 'Error!'); +}); + +$promise->reject('Error!'); +``` + +If an exception is not thrown in a `$onRejected` callback and the callback +does not return a rejected promise, downstream `$onFulfilled` callbacks are +invoked using the value returned from the `$onRejected` callback. + +```php +use GuzzleHttp\Promise\Promise; +use GuzzleHttp\Promise\RejectedPromise; + +$promise = new Promise(); +$promise + ->then(null, function ($reason) { + return "It's ok"; + }) + ->then(function ($value) { + assert($value === "It's ok"); + }); + +$promise->reject('Error!'); +``` + +# Synchronous wait + +You can synchronously force promises to complete using a promise's `wait` +method. When creating a promise, you can provide a wait function that is used +to synchronously force a promise to complete. When a wait function is invoked +it is expected to deliver a value to the promise or reject the promise. If the +wait function does not deliver a value, then an exception is thrown. The wait +function provided to a promise constructor is invoked when the `wait` function +of the promise is called. + +```php +$promise = new Promise(function () use (&$promise) { + $promise->resolve('foo'); +}); + +// Calling wait will return the value of the promise. +echo $promise->wait(); // outputs "foo" +``` + +If an exception is encountered while invoking the wait function of a promise, +the promise is rejected with the exception and the exception is thrown. + +```php +$promise = new Promise(function () use (&$promise) { + throw new \Exception('foo'); +}); + +$promise->wait(); // throws the exception. +``` + +Calling `wait` on a promise that has been fulfilled will not trigger the wait +function. It will simply return the previously resolved value. + +```php +$promise = new Promise(function () { die('this is not called!'); }); +$promise->resolve('foo'); +echo $promise->wait(); // outputs "foo" +``` + +Calling `wait` on a promise that has been rejected will throw an exception. If +the rejection reason is an instance of `\Exception` the reason is thrown. +Otherwise, a `GuzzleHttp\Promise\RejectionException` is thrown and the reason +can be obtained by calling the `getReason` method of the exception. + +```php +$promise = new Promise(); +$promise->reject('foo'); +$promise->wait(); +``` + +> PHP Fatal error: Uncaught exception 'GuzzleHttp\Promise\RejectionException' with message 'The promise was rejected with value: foo' + + +## Unwrapping a promise + +When synchronously waiting on a promise, you are joining the state of the +promise into the current state of execution (i.e., return the value of the +promise if it was fulfilled or throw an exception if it was rejected). This is +called "unwrapping" the promise. Waiting on a promise will by default unwrap +the promise state. + +You can force a promise to resolve and *not* unwrap the state of the promise +by passing `false` to the first argument of the `wait` function: + +```php +$promise = new Promise(); +$promise->reject('foo'); +// This will not throw an exception. It simply ensures the promise has +// been resolved. +$promise->wait(false); +``` + +When unwrapping a promise, the resolved value of the promise will be waited +upon until the unwrapped value is not a promise. This means that if you resolve +promise A with a promise B and unwrap promise A, the value returned by the +wait function will be the value delivered to promise B. + +**Note**: when you do not unwrap the promise, no value is returned. + + +# Cancellation + +You can cancel a promise that has not yet been fulfilled using the `cancel()` +method of a promise. When creating a promise you can provide an optional +cancel function that when invoked cancels the action of computing a resolution +of the promise. + + +# API + + +## Promise + +When creating a promise object, you can provide an optional `$waitFn` and +`$cancelFn`. `$waitFn` is a function that is invoked with no arguments and is +expected to resolve the promise. `$cancelFn` is a function with no arguments +that is expected to cancel the computation of a promise. It is invoked when the +`cancel()` method of a promise is called. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise( + function () use (&$promise) { + $promise->resolve('waited'); + }, + function () { + // do something that will cancel the promise computation (e.g., close + // a socket, cancel a database query, etc...) + } +); + +assert('waited' === $promise->wait()); +``` + +A promise has the following methods: + +- `then(callable $onFulfilled, callable $onRejected) : PromiseInterface` + + Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler. + +- `otherwise(callable $onRejected) : PromiseInterface` + + Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled. + +- `wait($unwrap = true) : mixed` + + Synchronously waits on the promise to complete. + + `$unwrap` controls whether or not the value of the promise is returned for a + fulfilled promise or if an exception is thrown if the promise is rejected. + This is set to `true` by default. + +- `cancel()` + + Attempts to cancel the promise if possible. The promise being cancelled and + the parent most ancestor that has not yet been resolved will also be + cancelled. Any promises waiting on the cancelled promise to resolve will also + be cancelled. + +- `getState() : string` + + Returns the state of the promise. One of `pending`, `fulfilled`, or + `rejected`. + +- `resolve($value)` + + Fulfills the promise with the given `$value`. + +- `reject($reason)` + + Rejects the promise with the given `$reason`. + + +## FulfilledPromise + +A fulfilled promise can be created to represent a promise that has been +fulfilled. + +```php +use GuzzleHttp\Promise\FulfilledPromise; + +$promise = new FulfilledPromise('value'); + +// Fulfilled callbacks are immediately invoked. +$promise->then(function ($value) { + echo $value; +}); +``` + + +## RejectedPromise + +A rejected promise can be created to represent a promise that has been +rejected. + +```php +use GuzzleHttp\Promise\RejectedPromise; + +$promise = new RejectedPromise('Error'); + +// Rejected callbacks are immediately invoked. +$promise->then(null, function ($reason) { + echo $reason; +}); +``` + + +# Promise interop + +This library works with foreign promises that have a `then` method. This means +you can use Guzzle promises with [React promises](https://github.com/reactphp/promise) +for example. When a foreign promise is returned inside of a then method +callback, promise resolution will occur recursively. + +```php +// Create a React promise +$deferred = new React\Promise\Deferred(); +$reactPromise = $deferred->promise(); + +// Create a Guzzle promise that is fulfilled with a React promise. +$guzzlePromise = new \GuzzleHttp\Promise\Promise(); +$guzzlePromise->then(function ($value) use ($reactPromise) { + // Do something something with the value... + // Return the React promise + return $reactPromise; +}); +``` + +Please note that wait and cancel chaining is no longer possible when forwarding +a foreign promise. You will need to wrap a third-party promise with a Guzzle +promise in order to utilize wait and cancel functions with foreign promises. + + +## Event Loop Integration + +In order to keep the stack size constant, Guzzle promises are resolved +asynchronously using a task queue. When waiting on promises synchronously, the +task queue will be automatically run to ensure that the blocking promise and +any forwarded promises are resolved. When using promises asynchronously in an +event loop, you will need to run the task queue on each tick of the loop. If +you do not run the task queue, then promises will not be resolved. + +You can run the task queue using the `run()` method of the global task queue +instance. + +```php +// Get the global task queue +$queue = \GuzzleHttp\Promise\queue(); +$queue->run(); +``` + +For example, you could use Guzzle promises with React using a periodic timer: + +```php +$loop = React\EventLoop\Factory::create(); +$loop->addPeriodicTimer(0, [$queue, 'run']); +``` + +*TODO*: Perhaps adding a `futureTick()` on each tick would be faster? + + +# Implementation notes + + +## Promise resolution and chaining is handled iteratively + +By shuffling pending handlers from one owner to another, promises are +resolved iteratively, allowing for "infinite" then chaining. + +```php +then(function ($v) { + // The stack size remains constant (a good thing) + echo xdebug_get_stack_depth() . ', '; + return $v + 1; + }); +} + +$parent->resolve(0); +var_dump($p->wait()); // int(1000) + +``` + +When a promise is fulfilled or rejected with a non-promise value, the promise +then takes ownership of the handlers of each child promise and delivers values +down the chain without using recursion. + +When a promise is resolved with another promise, the original promise transfers +all of its pending handlers to the new promise. When the new promise is +eventually resolved, all of the pending handlers are delivered the forwarded +value. + + +## A promise is the deferred. + +Some promise libraries implement promises using a deferred object to represent +a computation and a promise object to represent the delivery of the result of +the computation. This is a nice separation of computation and delivery because +consumers of the promise cannot modify the value that will be eventually +delivered. + +One side effect of being able to implement promise resolution and chaining +iteratively is that you need to be able for one promise to reach into the state +of another promise to shuffle around ownership of handlers. In order to achieve +this without making the handlers of a promise publicly mutable, a promise is +also the deferred value, allowing promises of the same parent class to reach +into and modify the private properties of promises of the same type. While this +does allow consumers of the value to modify the resolution or rejection of the +deferred, it is a small price to pay for keeping the stack size constant. + +```php +$promise = new Promise(); +$promise->then(function ($value) { echo $value; }); +// The promise is the deferred value, so you can deliver a value to it. +$promise->resolve('foo'); +// prints "foo" +``` diff --git a/vendor/guzzlehttp/promises/composer.json b/vendor/guzzlehttp/promises/composer.json new file mode 100644 index 0000000..ec41a61 --- /dev/null +++ b/vendor/guzzlehttp/promises/composer.json @@ -0,0 +1,34 @@ +{ + "name": "guzzlehttp/promises", + "description": "Guzzle promises library", + "keywords": ["promise"], + "license": "MIT", + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": ["src/functions_include.php"] + }, + "scripts": { + "test": "vendor/bin/phpunit", + "test-ci": "vendor/bin/phpunit --coverage-text" + }, + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + } +} diff --git a/vendor/guzzlehttp/promises/src/AggregateException.php b/vendor/guzzlehttp/promises/src/AggregateException.php new file mode 100644 index 0000000..6a5690c --- /dev/null +++ b/vendor/guzzlehttp/promises/src/AggregateException.php @@ -0,0 +1,16 @@ +then(function ($v) { echo $v; }); + * + * @param callable $generatorFn Generator function to wrap into a promise. + * + * @return Promise + * @link https://github.com/petkaantonov/bluebird/blob/master/API.md#generators inspiration + */ +final class Coroutine implements PromiseInterface +{ + /** + * @var PromiseInterface|null + */ + private $currentPromise; + + /** + * @var Generator + */ + private $generator; + + /** + * @var Promise + */ + private $result; + + public function __construct(callable $generatorFn) + { + $this->generator = $generatorFn(); + $this->result = new Promise(function () { + while (isset($this->currentPromise)) { + $this->currentPromise->wait(); + } + }); + $this->nextCoroutine($this->generator->current()); + } + + public function then( + callable $onFulfilled = null, + callable $onRejected = null + ) { + return $this->result->then($onFulfilled, $onRejected); + } + + public function otherwise(callable $onRejected) + { + return $this->result->otherwise($onRejected); + } + + public function wait($unwrap = true) + { + return $this->result->wait($unwrap); + } + + public function getState() + { + return $this->result->getState(); + } + + public function resolve($value) + { + $this->result->resolve($value); + } + + public function reject($reason) + { + $this->result->reject($reason); + } + + public function cancel() + { + $this->currentPromise->cancel(); + $this->result->cancel(); + } + + private function nextCoroutine($yielded) + { + $this->currentPromise = promise_for($yielded) + ->then([$this, '_handleSuccess'], [$this, '_handleFailure']); + } + + /** + * @internal + */ + public function _handleSuccess($value) + { + unset($this->currentPromise); + try { + $next = $this->generator->send($value); + if ($this->generator->valid()) { + $this->nextCoroutine($next); + } else { + $this->result->resolve($value); + } + } catch (Exception $exception) { + $this->result->reject($exception); + } catch (Throwable $throwable) { + $this->result->reject($throwable); + } + } + + /** + * @internal + */ + public function _handleFailure($reason) + { + unset($this->currentPromise); + try { + $nextYield = $this->generator->throw(exception_for($reason)); + // The throw was caught, so keep iterating on the coroutine + $this->nextCoroutine($nextYield); + } catch (Exception $exception) { + $this->result->reject($exception); + } catch (Throwable $throwable) { + $this->result->reject($throwable); + } + } +} diff --git a/vendor/guzzlehttp/promises/src/EachPromise.php b/vendor/guzzlehttp/promises/src/EachPromise.php new file mode 100644 index 0000000..d0ddf60 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/EachPromise.php @@ -0,0 +1,229 @@ +iterable = iter_for($iterable); + + if (isset($config['concurrency'])) { + $this->concurrency = $config['concurrency']; + } + + if (isset($config['fulfilled'])) { + $this->onFulfilled = $config['fulfilled']; + } + + if (isset($config['rejected'])) { + $this->onRejected = $config['rejected']; + } + } + + public function promise() + { + if ($this->aggregate) { + return $this->aggregate; + } + + try { + $this->createPromise(); + $this->iterable->rewind(); + $this->refillPending(); + } catch (\Throwable $e) { + $this->aggregate->reject($e); + } catch (\Exception $e) { + $this->aggregate->reject($e); + } + + return $this->aggregate; + } + + private function createPromise() + { + $this->mutex = false; + $this->aggregate = new Promise(function () { + reset($this->pending); + if (empty($this->pending) && !$this->iterable->valid()) { + $this->aggregate->resolve(null); + return; + } + + // Consume a potentially fluctuating list of promises while + // ensuring that indexes are maintained (precluding array_shift). + while ($promise = current($this->pending)) { + next($this->pending); + $promise->wait(); + if ($this->aggregate->getState() !== PromiseInterface::PENDING) { + return; + } + } + }); + + // Clear the references when the promise is resolved. + $clearFn = function () { + $this->iterable = $this->concurrency = $this->pending = null; + $this->onFulfilled = $this->onRejected = null; + }; + + $this->aggregate->then($clearFn, $clearFn); + } + + private function refillPending() + { + if (!$this->concurrency) { + // Add all pending promises. + while ($this->addPending() && $this->advanceIterator()); + return; + } + + // Add only up to N pending promises. + $concurrency = is_callable($this->concurrency) + ? call_user_func($this->concurrency, count($this->pending)) + : $this->concurrency; + $concurrency = max($concurrency - count($this->pending), 0); + // Concurrency may be set to 0 to disallow new promises. + if (!$concurrency) { + return; + } + // Add the first pending promise. + $this->addPending(); + // Note this is special handling for concurrency=1 so that we do + // not advance the iterator after adding the first promise. This + // helps work around issues with generators that might not have the + // next value to yield until promise callbacks are called. + while (--$concurrency + && $this->advanceIterator() + && $this->addPending()); + } + + private function addPending() + { + if (!$this->iterable || !$this->iterable->valid()) { + return false; + } + + $promise = promise_for($this->iterable->current()); + $idx = $this->iterable->key(); + + $this->pending[$idx] = $promise->then( + function ($value) use ($idx) { + if ($this->onFulfilled) { + call_user_func( + $this->onFulfilled, $value, $idx, $this->aggregate + ); + } + $this->step($idx); + }, + function ($reason) use ($idx) { + if ($this->onRejected) { + call_user_func( + $this->onRejected, $reason, $idx, $this->aggregate + ); + } + $this->step($idx); + } + ); + + return true; + } + + private function advanceIterator() + { + // Place a lock on the iterator so that we ensure to not recurse, + // preventing fatal generator errors. + if ($this->mutex) { + return false; + } + + $this->mutex = true; + + try { + $this->iterable->next(); + $this->mutex = false; + return true; + } catch (\Throwable $e) { + $this->aggregate->reject($e); + $this->mutex = false; + return false; + } catch (\Exception $e) { + $this->aggregate->reject($e); + $this->mutex = false; + return false; + } + } + + private function step($idx) + { + // If the promise was already resolved, then ignore this step. + if ($this->aggregate->getState() !== PromiseInterface::PENDING) { + return; + } + + unset($this->pending[$idx]); + + // Only refill pending promises if we are not locked, preventing the + // EachPromise to recursively invoke the provided iterator, which + // cause a fatal error: "Cannot resume an already running generator" + if ($this->advanceIterator() && !$this->checkIfFinished()) { + // Add more pending promises if possible. + $this->refillPending(); + } + } + + private function checkIfFinished() + { + if (!$this->pending && !$this->iterable->valid()) { + // Resolve the promise if there's nothing left to do. + $this->aggregate->resolve(null); + return true; + } + + return false; + } +} diff --git a/vendor/guzzlehttp/promises/src/FulfilledPromise.php b/vendor/guzzlehttp/promises/src/FulfilledPromise.php new file mode 100644 index 0000000..dbbeeb9 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/FulfilledPromise.php @@ -0,0 +1,82 @@ +value = $value; + } + + public function then( + callable $onFulfilled = null, + callable $onRejected = null + ) { + // Return itself if there is no onFulfilled function. + if (!$onFulfilled) { + return $this; + } + + $queue = queue(); + $p = new Promise([$queue, 'run']); + $value = $this->value; + $queue->add(static function () use ($p, $value, $onFulfilled) { + if ($p->getState() === self::PENDING) { + try { + $p->resolve($onFulfilled($value)); + } catch (\Throwable $e) { + $p->reject($e); + } catch (\Exception $e) { + $p->reject($e); + } + } + }); + + return $p; + } + + public function otherwise(callable $onRejected) + { + return $this->then(null, $onRejected); + } + + public function wait($unwrap = true, $defaultDelivery = null) + { + return $unwrap ? $this->value : null; + } + + public function getState() + { + return self::FULFILLED; + } + + public function resolve($value) + { + if ($value !== $this->value) { + throw new \LogicException("Cannot resolve a fulfilled promise"); + } + } + + public function reject($reason) + { + throw new \LogicException("Cannot reject a fulfilled promise"); + } + + public function cancel() + { + // pass + } +} diff --git a/vendor/guzzlehttp/promises/src/Promise.php b/vendor/guzzlehttp/promises/src/Promise.php new file mode 100644 index 0000000..844ada0 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/Promise.php @@ -0,0 +1,280 @@ +waitFn = $waitFn; + $this->cancelFn = $cancelFn; + } + + public function then( + callable $onFulfilled = null, + callable $onRejected = null + ) { + if ($this->state === self::PENDING) { + $p = new Promise(null, [$this, 'cancel']); + $this->handlers[] = [$p, $onFulfilled, $onRejected]; + $p->waitList = $this->waitList; + $p->waitList[] = $this; + return $p; + } + + // Return a fulfilled promise and immediately invoke any callbacks. + if ($this->state === self::FULFILLED) { + return $onFulfilled + ? promise_for($this->result)->then($onFulfilled) + : promise_for($this->result); + } + + // It's either cancelled or rejected, so return a rejected promise + // and immediately invoke any callbacks. + $rejection = rejection_for($this->result); + return $onRejected ? $rejection->then(null, $onRejected) : $rejection; + } + + public function otherwise(callable $onRejected) + { + return $this->then(null, $onRejected); + } + + public function wait($unwrap = true) + { + $this->waitIfPending(); + + $inner = $this->result instanceof PromiseInterface + ? $this->result->wait($unwrap) + : $this->result; + + if ($unwrap) { + if ($this->result instanceof PromiseInterface + || $this->state === self::FULFILLED + ) { + return $inner; + } else { + // It's rejected so "unwrap" and throw an exception. + throw exception_for($inner); + } + } + } + + public function getState() + { + return $this->state; + } + + public function cancel() + { + if ($this->state !== self::PENDING) { + return; + } + + $this->waitFn = $this->waitList = null; + + if ($this->cancelFn) { + $fn = $this->cancelFn; + $this->cancelFn = null; + try { + $fn(); + } catch (\Throwable $e) { + $this->reject($e); + } catch (\Exception $e) { + $this->reject($e); + } + } + + // Reject the promise only if it wasn't rejected in a then callback. + if ($this->state === self::PENDING) { + $this->reject(new CancellationException('Promise has been cancelled')); + } + } + + public function resolve($value) + { + $this->settle(self::FULFILLED, $value); + } + + public function reject($reason) + { + $this->settle(self::REJECTED, $reason); + } + + private function settle($state, $value) + { + if ($this->state !== self::PENDING) { + // Ignore calls with the same resolution. + if ($state === $this->state && $value === $this->result) { + return; + } + throw $this->state === $state + ? new \LogicException("The promise is already {$state}.") + : new \LogicException("Cannot change a {$this->state} promise to {$state}"); + } + + if ($value === $this) { + throw new \LogicException('Cannot fulfill or reject a promise with itself'); + } + + // Clear out the state of the promise but stash the handlers. + $this->state = $state; + $this->result = $value; + $handlers = $this->handlers; + $this->handlers = null; + $this->waitList = $this->waitFn = null; + $this->cancelFn = null; + + if (!$handlers) { + return; + } + + // If the value was not a settled promise or a thenable, then resolve + // it in the task queue using the correct ID. + if (!method_exists($value, 'then')) { + $id = $state === self::FULFILLED ? 1 : 2; + // It's a success, so resolve the handlers in the queue. + queue()->add(static function () use ($id, $value, $handlers) { + foreach ($handlers as $handler) { + self::callHandler($id, $value, $handler); + } + }); + } elseif ($value instanceof Promise + && $value->getState() === self::PENDING + ) { + // We can just merge our handlers onto the next promise. + $value->handlers = array_merge($value->handlers, $handlers); + } else { + // Resolve the handlers when the forwarded promise is resolved. + $value->then( + static function ($value) use ($handlers) { + foreach ($handlers as $handler) { + self::callHandler(1, $value, $handler); + } + }, + static function ($reason) use ($handlers) { + foreach ($handlers as $handler) { + self::callHandler(2, $reason, $handler); + } + } + ); + } + } + + /** + * Call a stack of handlers using a specific callback index and value. + * + * @param int $index 1 (resolve) or 2 (reject). + * @param mixed $value Value to pass to the callback. + * @param array $handler Array of handler data (promise and callbacks). + * + * @return array Returns the next group to resolve. + */ + private static function callHandler($index, $value, array $handler) + { + /** @var PromiseInterface $promise */ + $promise = $handler[0]; + + // The promise may have been cancelled or resolved before placing + // this thunk in the queue. + if ($promise->getState() !== self::PENDING) { + return; + } + + try { + if (isset($handler[$index])) { + $promise->resolve($handler[$index]($value)); + } elseif ($index === 1) { + // Forward resolution values as-is. + $promise->resolve($value); + } else { + // Forward rejections down the chain. + $promise->reject($value); + } + } catch (\Throwable $reason) { + $promise->reject($reason); + } catch (\Exception $reason) { + $promise->reject($reason); + } + } + + private function waitIfPending() + { + if ($this->state !== self::PENDING) { + return; + } elseif ($this->waitFn) { + $this->invokeWaitFn(); + } elseif ($this->waitList) { + $this->invokeWaitList(); + } else { + // If there's not wait function, then reject the promise. + $this->reject('Cannot wait on a promise that has ' + . 'no internal wait function. You must provide a wait ' + . 'function when constructing the promise to be able to ' + . 'wait on a promise.'); + } + + queue()->run(); + + if ($this->state === self::PENDING) { + $this->reject('Invoking the wait callback did not resolve the promise'); + } + } + + private function invokeWaitFn() + { + try { + $wfn = $this->waitFn; + $this->waitFn = null; + $wfn(true); + } catch (\Exception $reason) { + if ($this->state === self::PENDING) { + // The promise has not been resolved yet, so reject the promise + // with the exception. + $this->reject($reason); + } else { + // The promise was already resolved, so there's a problem in + // the application. + throw $reason; + } + } + } + + private function invokeWaitList() + { + $waitList = $this->waitList; + $this->waitList = null; + + foreach ($waitList as $result) { + while (true) { + $result->waitIfPending(); + + if ($result->result instanceof Promise) { + $result = $result->result; + } else { + if ($result->result instanceof PromiseInterface) { + $result->result->wait(false); + } + break; + } + } + } + } +} diff --git a/vendor/guzzlehttp/promises/src/PromiseInterface.php b/vendor/guzzlehttp/promises/src/PromiseInterface.php new file mode 100644 index 0000000..8f5f4b9 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/PromiseInterface.php @@ -0,0 +1,93 @@ +reason = $reason; + } + + public function then( + callable $onFulfilled = null, + callable $onRejected = null + ) { + // If there's no onRejected callback then just return self. + if (!$onRejected) { + return $this; + } + + $queue = queue(); + $reason = $this->reason; + $p = new Promise([$queue, 'run']); + $queue->add(static function () use ($p, $reason, $onRejected) { + if ($p->getState() === self::PENDING) { + try { + // Return a resolved promise if onRejected does not throw. + $p->resolve($onRejected($reason)); + } catch (\Throwable $e) { + // onRejected threw, so return a rejected promise. + $p->reject($e); + } catch (\Exception $e) { + // onRejected threw, so return a rejected promise. + $p->reject($e); + } + } + }); + + return $p; + } + + public function otherwise(callable $onRejected) + { + return $this->then(null, $onRejected); + } + + public function wait($unwrap = true, $defaultDelivery = null) + { + if ($unwrap) { + throw exception_for($this->reason); + } + } + + public function getState() + { + return self::REJECTED; + } + + public function resolve($value) + { + throw new \LogicException("Cannot resolve a rejected promise"); + } + + public function reject($reason) + { + if ($reason !== $this->reason) { + throw new \LogicException("Cannot reject a rejected promise"); + } + } + + public function cancel() + { + // pass + } +} diff --git a/vendor/guzzlehttp/promises/src/RejectionException.php b/vendor/guzzlehttp/promises/src/RejectionException.php new file mode 100644 index 0000000..07c1136 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/RejectionException.php @@ -0,0 +1,47 @@ +reason = $reason; + + $message = 'The promise was rejected'; + + if ($description) { + $message .= ' with reason: ' . $description; + } elseif (is_string($reason) + || (is_object($reason) && method_exists($reason, '__toString')) + ) { + $message .= ' with reason: ' . $this->reason; + } elseif ($reason instanceof \JsonSerializable) { + $message .= ' with reason: ' + . json_encode($this->reason, JSON_PRETTY_PRINT); + } + + parent::__construct($message); + } + + /** + * Returns the rejection reason. + * + * @return mixed + */ + public function getReason() + { + return $this->reason; + } +} diff --git a/vendor/guzzlehttp/promises/src/TaskQueue.php b/vendor/guzzlehttp/promises/src/TaskQueue.php new file mode 100644 index 0000000..6e8a2a0 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/TaskQueue.php @@ -0,0 +1,66 @@ +run(); + */ +class TaskQueue implements TaskQueueInterface +{ + private $enableShutdown = true; + private $queue = []; + + public function __construct($withShutdown = true) + { + if ($withShutdown) { + register_shutdown_function(function () { + if ($this->enableShutdown) { + // Only run the tasks if an E_ERROR didn't occur. + $err = error_get_last(); + if (!$err || ($err['type'] ^ E_ERROR)) { + $this->run(); + } + } + }); + } + } + + public function isEmpty() + { + return !$this->queue; + } + + public function add(callable $task) + { + $this->queue[] = $task; + } + + public function run() + { + /** @var callable $task */ + while ($task = array_shift($this->queue)) { + $task(); + } + } + + /** + * The task queue will be run and exhausted by default when the process + * exits IFF the exit is not the result of a PHP E_ERROR error. + * + * You can disable running the automatic shutdown of the queue by calling + * this function. If you disable the task queue shutdown process, then you + * MUST either run the task queue (as a result of running your event loop + * or manually using the run() method) or wait on each outstanding promise. + * + * Note: This shutdown will occur before any destructors are triggered. + */ + public function disableShutdown() + { + $this->enableShutdown = false; + } +} diff --git a/vendor/guzzlehttp/promises/src/TaskQueueInterface.php b/vendor/guzzlehttp/promises/src/TaskQueueInterface.php new file mode 100644 index 0000000..ac8306e --- /dev/null +++ b/vendor/guzzlehttp/promises/src/TaskQueueInterface.php @@ -0,0 +1,25 @@ + + * while ($eventLoop->isRunning()) { + * GuzzleHttp\Promise\queue()->run(); + * } + * + * + * @param TaskQueueInterface $assign Optionally specify a new queue instance. + * + * @return TaskQueueInterface + */ +function queue(TaskQueueInterface $assign = null) +{ + static $queue; + + if ($assign) { + $queue = $assign; + } elseif (!$queue) { + $queue = new TaskQueue(); + } + + return $queue; +} + +/** + * Adds a function to run in the task queue when it is next `run()` and returns + * a promise that is fulfilled or rejected with the result. + * + * @param callable $task Task function to run. + * + * @return PromiseInterface + */ +function task(callable $task) +{ + $queue = queue(); + $promise = new Promise([$queue, 'run']); + $queue->add(function () use ($task, $promise) { + try { + $promise->resolve($task()); + } catch (\Throwable $e) { + $promise->reject($e); + } catch (\Exception $e) { + $promise->reject($e); + } + }); + + return $promise; +} + +/** + * Creates a promise for a value if the value is not a promise. + * + * @param mixed $value Promise or value. + * + * @return PromiseInterface + */ +function promise_for($value) +{ + if ($value instanceof PromiseInterface) { + return $value; + } + + // Return a Guzzle promise that shadows the given promise. + if (method_exists($value, 'then')) { + $wfn = method_exists($value, 'wait') ? [$value, 'wait'] : null; + $cfn = method_exists($value, 'cancel') ? [$value, 'cancel'] : null; + $promise = new Promise($wfn, $cfn); + $value->then([$promise, 'resolve'], [$promise, 'reject']); + return $promise; + } + + return new FulfilledPromise($value); +} + +/** + * Creates a rejected promise for a reason if the reason is not a promise. If + * the provided reason is a promise, then it is returned as-is. + * + * @param mixed $reason Promise or reason. + * + * @return PromiseInterface + */ +function rejection_for($reason) +{ + if ($reason instanceof PromiseInterface) { + return $reason; + } + + return new RejectedPromise($reason); +} + +/** + * Create an exception for a rejected promise value. + * + * @param mixed $reason + * + * @return \Exception|\Throwable + */ +function exception_for($reason) +{ + return $reason instanceof \Exception || $reason instanceof \Throwable + ? $reason + : new RejectionException($reason); +} + +/** + * Returns an iterator for the given value. + * + * @param mixed $value + * + * @return \Iterator + */ +function iter_for($value) +{ + if ($value instanceof \Iterator) { + return $value; + } elseif (is_array($value)) { + return new \ArrayIterator($value); + } else { + return new \ArrayIterator([$value]); + } +} + +/** + * Synchronously waits on a promise to resolve and returns an inspection state + * array. + * + * Returns a state associative array containing a "state" key mapping to a + * valid promise state. If the state of the promise is "fulfilled", the array + * will contain a "value" key mapping to the fulfilled value of the promise. If + * the promise is rejected, the array will contain a "reason" key mapping to + * the rejection reason of the promise. + * + * @param PromiseInterface $promise Promise or value. + * + * @return array + */ +function inspect(PromiseInterface $promise) +{ + try { + return [ + 'state' => PromiseInterface::FULFILLED, + 'value' => $promise->wait() + ]; + } catch (RejectionException $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e->getReason()]; + } catch (\Throwable $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e]; + } catch (\Exception $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e]; + } +} + +/** + * Waits on all of the provided promises, but does not unwrap rejected promises + * as thrown exception. + * + * Returns an array of inspection state arrays. + * + * @param PromiseInterface[] $promises Traversable of promises to wait upon. + * + * @return array + * @see GuzzleHttp\Promise\inspect for the inspection state array format. + */ +function inspect_all($promises) +{ + $results = []; + foreach ($promises as $key => $promise) { + $results[$key] = inspect($promise); + } + + return $results; +} + +/** + * Waits on all of the provided promises and returns the fulfilled values. + * + * Returns an array that contains the value of each promise (in the same order + * the promises were provided). An exception is thrown if any of the promises + * are rejected. + * + * @param mixed $promises Iterable of PromiseInterface objects to wait on. + * + * @return array + * @throws \Exception on error + * @throws \Throwable on error in PHP >=7 + */ +function unwrap($promises) +{ + $results = []; + foreach ($promises as $key => $promise) { + $results[$key] = $promise->wait(); + } + + return $results; +} + +/** + * Given an array of promises, return a promise that is fulfilled when all the + * items in the array are fulfilled. + * + * The promise's fulfillment value is an array with fulfillment values at + * respective positions to the original array. If any promise in the array + * rejects, the returned promise is rejected with the rejection reason. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + */ +function all($promises) +{ + $results = []; + return each( + $promises, + function ($value, $idx) use (&$results) { + $results[$idx] = $value; + }, + function ($reason, $idx, Promise $aggregate) { + $aggregate->reject($reason); + } + )->then(function () use (&$results) { + ksort($results); + return $results; + }); +} + +/** + * Initiate a competitive race between multiple promises or values (values will + * become immediately fulfilled promises). + * + * When count amount of promises have been fulfilled, the returned promise is + * fulfilled with an array that contains the fulfillment values of the winners + * in order of resolution. + * + * This prommise is rejected with a {@see GuzzleHttp\Promise\AggregateException} + * if the number of fulfilled promises is less than the desired $count. + * + * @param int $count Total number of promises. + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + */ +function some($count, $promises) +{ + $results = []; + $rejections = []; + + return each( + $promises, + function ($value, $idx, PromiseInterface $p) use (&$results, $count) { + if ($p->getState() !== PromiseInterface::PENDING) { + return; + } + $results[$idx] = $value; + if (count($results) >= $count) { + $p->resolve(null); + } + }, + function ($reason) use (&$rejections) { + $rejections[] = $reason; + } + )->then( + function () use (&$results, &$rejections, $count) { + if (count($results) !== $count) { + throw new AggregateException( + 'Not enough promises to fulfill count', + $rejections + ); + } + ksort($results); + return array_values($results); + } + ); +} + +/** + * Like some(), with 1 as count. However, if the promise fulfills, the + * fulfillment value is not an array of 1 but the value directly. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + */ +function any($promises) +{ + return some(1, $promises)->then(function ($values) { return $values[0]; }); +} + +/** + * Returns a promise that is fulfilled when all of the provided promises have + * been fulfilled or rejected. + * + * The returned promise is fulfilled with an array of inspection state arrays. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + * @see GuzzleHttp\Promise\inspect for the inspection state array format. + */ +function settle($promises) +{ + $results = []; + + return each( + $promises, + function ($value, $idx) use (&$results) { + $results[$idx] = ['state' => PromiseInterface::FULFILLED, 'value' => $value]; + }, + function ($reason, $idx) use (&$results) { + $results[$idx] = ['state' => PromiseInterface::REJECTED, 'reason' => $reason]; + } + )->then(function () use (&$results) { + ksort($results); + return $results; + }); +} + +/** + * Given an iterator that yields promises or values, returns a promise that is + * fulfilled with a null value when the iterator has been consumed or the + * aggregate promise has been fulfilled or rejected. + * + * $onFulfilled is a function that accepts the fulfilled value, iterator + * index, and the aggregate promise. The callback can invoke any necessary side + * effects and choose to resolve or reject the aggregate promise if needed. + * + * $onRejected is a function that accepts the rejection reason, iterator + * index, and the aggregate promise. The callback can invoke any necessary side + * effects and choose to resolve or reject the aggregate promise if needed. + * + * @param mixed $iterable Iterator or array to iterate over. + * @param callable $onFulfilled + * @param callable $onRejected + * + * @return PromiseInterface + */ +function each( + $iterable, + callable $onFulfilled = null, + callable $onRejected = null +) { + return (new EachPromise($iterable, [ + 'fulfilled' => $onFulfilled, + 'rejected' => $onRejected + ]))->promise(); +} + +/** + * Like each, but only allows a certain number of outstanding promises at any + * given time. + * + * $concurrency may be an integer or a function that accepts the number of + * pending promises and returns a numeric concurrency limit value to allow for + * dynamic a concurrency size. + * + * @param mixed $iterable + * @param int|callable $concurrency + * @param callable $onFulfilled + * @param callable $onRejected + * + * @return PromiseInterface + */ +function each_limit( + $iterable, + $concurrency, + callable $onFulfilled = null, + callable $onRejected = null +) { + return (new EachPromise($iterable, [ + 'fulfilled' => $onFulfilled, + 'rejected' => $onRejected, + 'concurrency' => $concurrency + ]))->promise(); +} + +/** + * Like each_limit, but ensures that no promise in the given $iterable argument + * is rejected. If any promise is rejected, then the aggregate promise is + * rejected with the encountered rejection. + * + * @param mixed $iterable + * @param int|callable $concurrency + * @param callable $onFulfilled + * + * @return PromiseInterface + */ +function each_limit_all( + $iterable, + $concurrency, + callable $onFulfilled = null +) { + return each_limit( + $iterable, + $concurrency, + $onFulfilled, + function ($reason, $idx, PromiseInterface $aggregate) { + $aggregate->reject($reason); + } + ); +} + +/** + * Returns true if a promise is fulfilled. + * + * @param PromiseInterface $promise + * + * @return bool + */ +function is_fulfilled(PromiseInterface $promise) +{ + return $promise->getState() === PromiseInterface::FULFILLED; +} + +/** + * Returns true if a promise is rejected. + * + * @param PromiseInterface $promise + * + * @return bool + */ +function is_rejected(PromiseInterface $promise) +{ + return $promise->getState() === PromiseInterface::REJECTED; +} + +/** + * Returns true if a promise is fulfilled or rejected. + * + * @param PromiseInterface $promise + * + * @return bool + */ +function is_settled(PromiseInterface $promise) +{ + return $promise->getState() !== PromiseInterface::PENDING; +} + +/** + * @see Coroutine + * + * @param callable $generatorFn + * + * @return PromiseInterface + */ +function coroutine(callable $generatorFn) +{ + return new Coroutine($generatorFn); +} diff --git a/vendor/guzzlehttp/promises/src/functions_include.php b/vendor/guzzlehttp/promises/src/functions_include.php new file mode 100644 index 0000000..34cd171 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/functions_include.php @@ -0,0 +1,6 @@ +withPath('foo')->withHost('example.com')` will throw an exception + because the path of a URI with an authority must start with a slash "/" or be empty + - `(new Uri())->withScheme('http')` will return `'http://localhost'` + +### Deprecated + +- `Uri::resolve` in favor of `UriResolver::resolve` +- `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments` + +### Fixed + +- `Stream::read` when length parameter <= 0. +- `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory. +- `ServerRequest::getUriFromGlobals` when `Host` header contains port. +- Compatibility of URIs with `file` scheme and empty host. + + +## [1.3.1] - 2016-06-25 + +### Fixed + +- `Uri::__toString` for network path references, e.g. `//example.org`. +- Missing lowercase normalization for host. +- Handling of URI components in case they are `'0'` in a lot of places, + e.g. as a user info password. +- `Uri::withAddedHeader` to correctly merge headers with different case. +- Trimming of header values in `Uri::withAddedHeader`. Header values may + be surrounded by whitespace which should be ignored according to RFC 7230 + Section 3.2.4. This does not apply to header names. +- `Uri::withAddedHeader` with an array of header values. +- `Uri::resolve` when base path has no slash and handling of fragment. +- Handling of encoding in `Uri::with(out)QueryValue` so one can pass the + key/value both in encoded as well as decoded form to those methods. This is + consistent with withPath, withQuery etc. +- `ServerRequest::withoutAttribute` when attribute value is null. + + +## [1.3.0] - 2016-04-13 + +### Added + +- Remaining interfaces needed for full PSR7 compatibility + (ServerRequestInterface, UploadedFileInterface, etc.). +- Support for stream_for from scalars. + +### Changed + +- Can now extend Uri. + +### Fixed +- A bug in validating request methods by making it more permissive. + + +## [1.2.3] - 2016-02-18 + +### Fixed + +- Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote + streams, which can sometimes return fewer bytes than requested with `fread`. +- Handling of gzipped responses with FNAME headers. + + +## [1.2.2] - 2016-01-22 + +### Added + +- Support for URIs without any authority. +- Support for HTTP 451 'Unavailable For Legal Reasons.' +- Support for using '0' as a filename. +- Support for including non-standard ports in Host headers. + + +## [1.2.1] - 2015-11-02 + +### Changes + +- Now supporting negative offsets when seeking to SEEK_END. + + +## [1.2.0] - 2015-08-15 + +### Changed + +- Body as `"0"` is now properly added to a response. +- Now allowing forward seeking in CachingStream. +- Now properly parsing HTTP requests that contain proxy targets in + `parse_request`. +- functions.php is now conditionally required. +- user-info is no longer dropped when resolving URIs. + + +## [1.1.0] - 2015-06-24 + +### Changed + +- URIs can now be relative. +- `multipart/form-data` headers are now overridden case-insensitively. +- URI paths no longer encode the following characters because they are allowed + in URIs: "(", ")", "*", "!", "'" +- A port is no longer added to a URI when the scheme is missing and no port is + present. + + +## 1.0.0 - 2015-05-19 + +Initial release. + +Currently unsupported: + +- `Psr\Http\Message\ServerRequestInterface` +- `Psr\Http\Message\UploadedFileInterface` + + + +[Unreleased]: https://github.com/guzzle/psr7/compare/1.5.2...HEAD +[1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2 +[1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1 +[1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0 +[1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2 +[1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1 +[1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0 +[1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1 +[1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0 +[1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3 +[1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2 +[1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1 +[1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0 +[1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0 diff --git a/vendor/guzzlehttp/psr7/LICENSE b/vendor/guzzlehttp/psr7/LICENSE new file mode 100644 index 0000000..581d95f --- /dev/null +++ b/vendor/guzzlehttp/psr7/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Michael Dowling, https://github.com/mtdowling + +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/guzzlehttp/psr7/README.md b/vendor/guzzlehttp/psr7/README.md new file mode 100644 index 0000000..c60a6a3 --- /dev/null +++ b/vendor/guzzlehttp/psr7/README.md @@ -0,0 +1,745 @@ +# PSR-7 Message Implementation + +This repository contains a full [PSR-7](http://www.php-fig.org/psr/psr-7/) +message implementation, several stream decorators, and some helpful +functionality like query string parsing. + + +[![Build Status](https://travis-ci.org/guzzle/psr7.svg?branch=master)](https://travis-ci.org/guzzle/psr7) + + +# Stream implementation + +This package comes with a number of stream implementations and stream +decorators. + + +## AppendStream + +`GuzzleHttp\Psr7\AppendStream` + +Reads from multiple streams, one after the other. + +```php +use GuzzleHttp\Psr7; + +$a = Psr7\stream_for('abc, '); +$b = Psr7\stream_for('123.'); +$composed = new Psr7\AppendStream([$a, $b]); + +$composed->addStream(Psr7\stream_for(' Above all listen to me')); + +echo $composed; // abc, 123. Above all listen to me. +``` + + +## BufferStream + +`GuzzleHttp\Psr7\BufferStream` + +Provides a buffer stream that can be written to fill a buffer, and read +from to remove bytes from the buffer. + +This stream returns a "hwm" metadata value that tells upstream consumers +what the configured high water mark of the stream is, or the maximum +preferred size of the buffer. + +```php +use GuzzleHttp\Psr7; + +// When more than 1024 bytes are in the buffer, it will begin returning +// false to writes. This is an indication that writers should slow down. +$buffer = new Psr7\BufferStream(1024); +``` + + +## CachingStream + +The CachingStream is used to allow seeking over previously read bytes on +non-seekable streams. This can be useful when transferring a non-seekable +entity body fails due to needing to rewind the stream (for example, resulting +from a redirect). Data that is read from the remote stream will be buffered in +a PHP temp stream so that previously read bytes are cached first in memory, +then on disk. + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for(fopen('http://www.google.com', 'r')); +$stream = new Psr7\CachingStream($original); + +$stream->read(1024); +echo $stream->tell(); +// 1024 + +$stream->seek(0); +echo $stream->tell(); +// 0 +``` + + +## DroppingStream + +`GuzzleHttp\Psr7\DroppingStream` + +Stream decorator that begins dropping data once the size of the underlying +stream becomes too full. + +```php +use GuzzleHttp\Psr7; + +// Create an empty stream +$stream = Psr7\stream_for(); + +// Start dropping data when the stream has more than 10 bytes +$dropping = new Psr7\DroppingStream($stream, 10); + +$dropping->write('01234567890123456789'); +echo $stream; // 0123456789 +``` + + +## FnStream + +`GuzzleHttp\Psr7\FnStream` + +Compose stream implementations based on a hash of functions. + +Allows for easy testing and extension of a provided stream without needing +to create a concrete class for a simple extension point. + +```php + +use GuzzleHttp\Psr7; + +$stream = Psr7\stream_for('hi'); +$fnStream = Psr7\FnStream::decorate($stream, [ + 'rewind' => function () use ($stream) { + echo 'About to rewind - '; + $stream->rewind(); + echo 'rewound!'; + } +]); + +$fnStream->rewind(); +// Outputs: About to rewind - rewound! +``` + + +## InflateStream + +`GuzzleHttp\Psr7\InflateStream` + +Uses PHP's zlib.inflate filter to inflate deflate or gzipped content. + +This stream decorator skips the first 10 bytes of the given stream to remove +the gzip header, converts the provided stream to a PHP stream resource, +then appends the zlib.inflate filter. The stream is then converted back +to a Guzzle stream resource to be used as a Guzzle stream. + + +## LazyOpenStream + +`GuzzleHttp\Psr7\LazyOpenStream` + +Lazily reads or writes to a file that is opened only after an IO operation +take place on the stream. + +```php +use GuzzleHttp\Psr7; + +$stream = new Psr7\LazyOpenStream('/path/to/file', 'r'); +// The file has not yet been opened... + +echo $stream->read(10); +// The file is opened and read from only when needed. +``` + + +## LimitStream + +`GuzzleHttp\Psr7\LimitStream` + +LimitStream can be used to read a subset or slice of an existing stream object. +This can be useful for breaking a large file into smaller pieces to be sent in +chunks (e.g. Amazon S3's multipart upload API). + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for(fopen('/tmp/test.txt', 'r+')); +echo $original->getSize(); +// >>> 1048576 + +// Limit the size of the body to 1024 bytes and start reading from byte 2048 +$stream = new Psr7\LimitStream($original, 1024, 2048); +echo $stream->getSize(); +// >>> 1024 +echo $stream->tell(); +// >>> 0 +``` + + +## MultipartStream + +`GuzzleHttp\Psr7\MultipartStream` + +Stream that when read returns bytes for a streaming multipart or +multipart/form-data stream. + + +## NoSeekStream + +`GuzzleHttp\Psr7\NoSeekStream` + +NoSeekStream wraps a stream and does not allow seeking. + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for('foo'); +$noSeek = new Psr7\NoSeekStream($original); + +echo $noSeek->read(3); +// foo +var_export($noSeek->isSeekable()); +// false +$noSeek->seek(0); +var_export($noSeek->read(3)); +// NULL +``` + + +## PumpStream + +`GuzzleHttp\Psr7\PumpStream` + +Provides a read only stream that pumps data from a PHP callable. + +When invoking the provided callable, the PumpStream will pass the amount of +data requested to read to the callable. The callable can choose to ignore +this value and return fewer or more bytes than requested. Any extra data +returned by the provided callable is buffered internally until drained using +the read() function of the PumpStream. The provided callable MUST return +false when there is no more data to read. + + +## Implementing stream decorators + +Creating a stream decorator is very easy thanks to the +`GuzzleHttp\Psr7\StreamDecoratorTrait`. This trait provides methods that +implement `Psr\Http\Message\StreamInterface` by proxying to an underlying +stream. Just `use` the `StreamDecoratorTrait` and implement your custom +methods. + +For example, let's say we wanted to call a specific function each time the last +byte is read from a stream. This could be implemented by overriding the +`read()` method. + +```php +use Psr\Http\Message\StreamInterface; +use GuzzleHttp\Psr7\StreamDecoratorTrait; + +class EofCallbackStream implements StreamInterface +{ + use StreamDecoratorTrait; + + private $callback; + + public function __construct(StreamInterface $stream, callable $cb) + { + $this->stream = $stream; + $this->callback = $cb; + } + + public function read($length) + { + $result = $this->stream->read($length); + + // Invoke the callback when EOF is hit. + if ($this->eof()) { + call_user_func($this->callback); + } + + return $result; + } +} +``` + +This decorator could be added to any existing stream and used like so: + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for('foo'); + +$eofStream = new EofCallbackStream($original, function () { + echo 'EOF!'; +}); + +$eofStream->read(2); +$eofStream->read(1); +// echoes "EOF!" +$eofStream->seek(0); +$eofStream->read(3); +// echoes "EOF!" +``` + + +## PHP StreamWrapper + +You can use the `GuzzleHttp\Psr7\StreamWrapper` class if you need to use a +PSR-7 stream as a PHP stream resource. + +Use the `GuzzleHttp\Psr7\StreamWrapper::getResource()` method to create a PHP +stream from a PSR-7 stream. + +```php +use GuzzleHttp\Psr7\StreamWrapper; + +$stream = GuzzleHttp\Psr7\stream_for('hello!'); +$resource = StreamWrapper::getResource($stream); +echo fread($resource, 6); // outputs hello! +``` + + +# Function API + +There are various functions available under the `GuzzleHttp\Psr7` namespace. + + +## `function str` + +`function str(MessageInterface $message)` + +Returns the string representation of an HTTP message. + +```php +$request = new GuzzleHttp\Psr7\Request('GET', 'http://example.com'); +echo GuzzleHttp\Psr7\str($request); +``` + + +## `function uri_for` + +`function uri_for($uri)` + +This function accepts a string or `Psr\Http\Message\UriInterface` and returns a +UriInterface for the given value. If the value is already a `UriInterface`, it +is returned as-is. + +```php +$uri = GuzzleHttp\Psr7\uri_for('http://example.com'); +assert($uri === GuzzleHttp\Psr7\uri_for($uri)); +``` + + +## `function stream_for` + +`function stream_for($resource = '', array $options = [])` + +Create a new stream based on the input type. + +Options is an associative array that can contain the following keys: + +* - metadata: Array of custom metadata. +* - size: Size of the stream. + +This method accepts the following `$resource` types: + +- `Psr\Http\Message\StreamInterface`: Returns the value as-is. +- `string`: Creates a stream object that uses the given string as the contents. +- `resource`: Creates a stream object that wraps the given PHP stream resource. +- `Iterator`: If the provided value implements `Iterator`, then a read-only + stream object will be created that wraps the given iterable. Each time the + stream is read from, data from the iterator will fill a buffer and will be + continuously called until the buffer is equal to the requested read size. + Subsequent read calls will first read from the buffer and then call `next` + on the underlying iterator until it is exhausted. +- `object` with `__toString()`: If the object has the `__toString()` method, + the object will be cast to a string and then a stream will be returned that + uses the string value. +- `NULL`: When `null` is passed, an empty stream object is returned. +- `callable` When a callable is passed, a read-only stream object will be + created that invokes the given callable. The callable is invoked with the + number of suggested bytes to read. The callable can return any number of + bytes, but MUST return `false` when there is no more data to return. The + stream object that wraps the callable will invoke the callable until the + number of requested bytes are available. Any additional bytes will be + buffered and used in subsequent reads. + +```php +$stream = GuzzleHttp\Psr7\stream_for('foo'); +$stream = GuzzleHttp\Psr7\stream_for(fopen('/path/to/file', 'r')); + +$generator = function ($bytes) { + for ($i = 0; $i < $bytes; $i++) { + yield ' '; + } +} + +$stream = GuzzleHttp\Psr7\stream_for($generator(100)); +``` + + +## `function parse_header` + +`function parse_header($header)` + +Parse an array of header values containing ";" separated data into an array of +associative arrays representing the header key value pair data of the header. +When a parameter does not contain a value, but just contains a key, this +function will inject a key with a '' string value. + + +## `function normalize_header` + +`function normalize_header($header)` + +Converts an array of header values that may contain comma separated headers +into an array of headers with no comma separated values. + + +## `function modify_request` + +`function modify_request(RequestInterface $request, array $changes)` + +Clone and modify a request with the given changes. This method is useful for +reducing the number of clones needed to mutate a message. + +The changes can be one of: + +- method: (string) Changes the HTTP method. +- set_headers: (array) Sets the given headers. +- remove_headers: (array) Remove the given headers. +- body: (mixed) Sets the given body. +- uri: (UriInterface) Set the URI. +- query: (string) Set the query string value of the URI. +- version: (string) Set the protocol version. + + +## `function rewind_body` + +`function rewind_body(MessageInterface $message)` + +Attempts to rewind a message body and throws an exception on failure. The body +of the message will only be rewound if a call to `tell()` returns a value other +than `0`. + + +## `function try_fopen` + +`function try_fopen($filename, $mode)` + +Safely opens a PHP stream resource using a filename. + +When fopen fails, PHP normally raises a warning. This function adds an error +handler that checks for errors and throws an exception instead. + + +## `function copy_to_string` + +`function copy_to_string(StreamInterface $stream, $maxLen = -1)` + +Copy the contents of a stream into a string until the given number of bytes +have been read. + + +## `function copy_to_stream` + +`function copy_to_stream(StreamInterface $source, StreamInterface $dest, $maxLen = -1)` + +Copy the contents of a stream into another stream until the given number of +bytes have been read. + + +## `function hash` + +`function hash(StreamInterface $stream, $algo, $rawOutput = false)` + +Calculate a hash of a Stream. This method reads the entire stream to calculate +a rolling hash (based on PHP's hash_init functions). + + +## `function readline` + +`function readline(StreamInterface $stream, $maxLength = null)` + +Read a line from the stream up to the maximum allowed buffer length. + + +## `function parse_request` + +`function parse_request($message)` + +Parses a request message string into a request object. + + +## `function parse_response` + +`function parse_response($message)` + +Parses a response message string into a response object. + + +## `function parse_query` + +`function parse_query($str, $urlEncoding = true)` + +Parse a query string into an associative array. + +If multiple values are found for the same key, the value of that key value pair +will become an array. This function does not parse nested PHP style arrays into +an associative array (e.g., `foo[a]=1&foo[b]=2` will be parsed into +`['foo[a]' => '1', 'foo[b]' => '2']`). + + +## `function build_query` + +`function build_query(array $params, $encoding = PHP_QUERY_RFC3986)` + +Build a query string from an array of key value pairs. + +This function can use the return value of parse_query() to build a query string. +This function does not modify the provided keys when an array is encountered +(like http_build_query would). + + +## `function mimetype_from_filename` + +`function mimetype_from_filename($filename)` + +Determines the mimetype of a file by looking at its extension. + + +## `function mimetype_from_extension` + +`function mimetype_from_extension($extension)` + +Maps a file extensions to a mimetype. + + +# Additional URI Methods + +Aside from the standard `Psr\Http\Message\UriInterface` implementation in form of the `GuzzleHttp\Psr7\Uri` class, +this library also provides additional functionality when working with URIs as static methods. + +## URI Types + +An instance of `Psr\Http\Message\UriInterface` can either be an absolute URI or a relative reference. +An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI, +the base URI. Relative references can be divided into several forms according to +[RFC 3986 Section 4.2](https://tools.ietf.org/html/rfc3986#section-4.2): + +- network-path references, e.g. `//example.com/path` +- absolute-path references, e.g. `/path` +- relative-path references, e.g. `subpath` + +The following methods can be used to identify the type of the URI. + +### `GuzzleHttp\Psr7\Uri::isAbsolute` + +`public static function isAbsolute(UriInterface $uri): bool` + +Whether the URI is absolute, i.e. it has a scheme. + +### `GuzzleHttp\Psr7\Uri::isNetworkPathReference` + +`public static function isNetworkPathReference(UriInterface $uri): bool` + +Whether the URI is a network-path reference. A relative reference that begins with two slash characters is +termed an network-path reference. + +### `GuzzleHttp\Psr7\Uri::isAbsolutePathReference` + +`public static function isAbsolutePathReference(UriInterface $uri): bool` + +Whether the URI is a absolute-path reference. A relative reference that begins with a single slash character is +termed an absolute-path reference. + +### `GuzzleHttp\Psr7\Uri::isRelativePathReference` + +`public static function isRelativePathReference(UriInterface $uri): bool` + +Whether the URI is a relative-path reference. A relative reference that does not begin with a slash character is +termed a relative-path reference. + +### `GuzzleHttp\Psr7\Uri::isSameDocumentReference` + +`public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool` + +Whether the URI is a same-document reference. A same-document reference refers to a URI that is, aside from its +fragment component, identical to the base URI. When no base URI is given, only an empty URI reference +(apart from its fragment) is considered a same-document reference. + +## URI Components + +Additional methods to work with URI components. + +### `GuzzleHttp\Psr7\Uri::isDefaultPort` + +`public static function isDefaultPort(UriInterface $uri): bool` + +Whether the URI has the default port of the current scheme. `Psr\Http\Message\UriInterface::getPort` may return null +or the standard port. This method can be used independently of the implementation. + +### `GuzzleHttp\Psr7\Uri::composeComponents` + +`public static function composeComponents($scheme, $authority, $path, $query, $fragment): string` + +Composes a URI reference string from its various components according to +[RFC 3986 Section 5.3](https://tools.ietf.org/html/rfc3986#section-5.3). Usually this method does not need to be called +manually but instead is used indirectly via `Psr\Http\Message\UriInterface::__toString`. + +### `GuzzleHttp\Psr7\Uri::fromParts` + +`public static function fromParts(array $parts): UriInterface` + +Creates a URI from a hash of [`parse_url`](http://php.net/manual/en/function.parse-url.php) components. + + +### `GuzzleHttp\Psr7\Uri::withQueryValue` + +`public static function withQueryValue(UriInterface $uri, $key, $value): UriInterface` + +Creates a new URI with a specific query string value. Any existing query string values that exactly match the +provided key are removed and replaced with the given key value pair. A value of null will set the query string +key without a value, e.g. "key" instead of "key=value". + +### `GuzzleHttp\Psr7\Uri::withQueryValues` + +`public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface` + +Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an +associative array of key => value. + +### `GuzzleHttp\Psr7\Uri::withoutQueryValue` + +`public static function withoutQueryValue(UriInterface $uri, $key): UriInterface` + +Creates a new URI with a specific query string value removed. Any existing query string values that exactly match the +provided key are removed. + +## Reference Resolution + +`GuzzleHttp\Psr7\UriResolver` provides methods to resolve a URI reference in the context of a base URI according +to [RFC 3986 Section 5](https://tools.ietf.org/html/rfc3986#section-5). This is for example also what web browsers +do when resolving a link in a website based on the current request URI. + +### `GuzzleHttp\Psr7\UriResolver::resolve` + +`public static function resolve(UriInterface $base, UriInterface $rel): UriInterface` + +Converts the relative URI into a new URI that is resolved against the base URI. + +### `GuzzleHttp\Psr7\UriResolver::removeDotSegments` + +`public static function removeDotSegments(string $path): string` + +Removes dot segments from a path and returns the new path according to +[RFC 3986 Section 5.2.4](https://tools.ietf.org/html/rfc3986#section-5.2.4). + +### `GuzzleHttp\Psr7\UriResolver::relativize` + +`public static function relativize(UriInterface $base, UriInterface $target): UriInterface` + +Returns the target URI as a relative reference from the base URI. This method is the counterpart to resolve(): + +```php +(string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) +``` + +One use-case is to use the current request URI as base URI and then generate relative links in your documents +to reduce the document size or offer self-contained downloadable document archives. + +```php +$base = new Uri('http://example.com/a/b/'); +echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. +echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. +echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. +echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. +``` + +## Normalization and Comparison + +`GuzzleHttp\Psr7\UriNormalizer` provides methods to normalize and compare URIs according to +[RFC 3986 Section 6](https://tools.ietf.org/html/rfc3986#section-6). + +### `GuzzleHttp\Psr7\UriNormalizer::normalize` + +`public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS): UriInterface` + +Returns a normalized URI. The scheme and host component are already normalized to lowercase per PSR-7 UriInterface. +This methods adds additional normalizations that can be configured with the `$flags` parameter which is a bitmask +of normalizations to apply. The following normalizations are available: + +- `UriNormalizer::PRESERVING_NORMALIZATIONS` + + Default normalizations which only include the ones that preserve semantics. + +- `UriNormalizer::CAPITALIZE_PERCENT_ENCODING` + + All letters within a percent-encoding triplet (e.g., "%3A") are case-insensitive, and should be capitalized. + + Example: `http://example.org/a%c2%b1b` → `http://example.org/a%C2%B1b` + +- `UriNormalizer::DECODE_UNRESERVED_CHARACTERS` + + Decodes percent-encoded octets of unreserved characters. For consistency, percent-encoded octets in the ranges of + ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should + not be created by URI producers and, when found in a URI, should be decoded to their corresponding unreserved + characters by URI normalizers. + + Example: `http://example.org/%7Eusern%61me/` → `http://example.org/~username/` + +- `UriNormalizer::CONVERT_EMPTY_PATH` + + Converts the empty path to "/" for http and https URIs. + + Example: `http://example.org` → `http://example.org/` + +- `UriNormalizer::REMOVE_DEFAULT_HOST` + + Removes the default host of the given URI scheme from the URI. Only the "file" scheme defines the default host + "localhost". All of `file:/myfile`, `file:///myfile`, and `file://localhost/myfile` are equivalent according to + RFC 3986. + + Example: `file://localhost/myfile` → `file:///myfile` + +- `UriNormalizer::REMOVE_DEFAULT_PORT` + + Removes the default port of the given URI scheme from the URI. + + Example: `http://example.org:80/` → `http://example.org/` + +- `UriNormalizer::REMOVE_DOT_SEGMENTS` + + Removes unnecessary dot-segments. Dot-segments in relative-path references are not removed as it would + change the semantics of the URI reference. + + Example: `http://example.org/../a/b/../c/./d.html` → `http://example.org/a/c/d.html` + +- `UriNormalizer::REMOVE_DUPLICATE_SLASHES` + + Paths which include two or more adjacent slashes are converted to one. Webservers usually ignore duplicate slashes + and treat those URIs equivalent. But in theory those URIs do not need to be equivalent. So this normalization + may change the semantics. Encoded slashes (%2F) are not removed. + + Example: `http://example.org//foo///bar.html` → `http://example.org/foo/bar.html` + +- `UriNormalizer::SORT_QUERY_PARAMETERS` + + Sort query parameters with their values in alphabetical order. However, the order of parameters in a URI may be + significant (this is not defined by the standard). So this normalization is not safe and may change the semantics + of the URI. + + Example: `?lang=en&article=fred` → `?article=fred&lang=en` + +### `GuzzleHttp\Psr7\UriNormalizer::isEquivalent` + +`public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS): bool` + +Whether two URIs can be considered equivalent. Both URIs are normalized automatically before comparison with the given +`$normalizations` bitmask. The method also accepts relative URI references and returns true when they are equivalent. +This of course assumes they will be resolved against the same base URI. If this is not the case, determination of +equivalence or difference of relative references does not mean anything. diff --git a/vendor/guzzlehttp/psr7/composer.json b/vendor/guzzlehttp/psr7/composer.json new file mode 100644 index 0000000..2add153 --- /dev/null +++ b/vendor/guzzlehttp/psr7/composer.json @@ -0,0 +1,45 @@ +{ + "name": "guzzlehttp/psr7", + "type": "library", + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"], + "license": "MIT", + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": ["src/functions_include.php"] + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Tests\\Psr7\\": "tests/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/AppendStream.php b/vendor/guzzlehttp/psr7/src/AppendStream.php new file mode 100644 index 0000000..472a0d6 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/AppendStream.php @@ -0,0 +1,241 @@ +addStream($stream); + } + } + + public function __toString() + { + try { + $this->rewind(); + return $this->getContents(); + } catch (\Exception $e) { + return ''; + } + } + + /** + * Add a stream to the AppendStream + * + * @param StreamInterface $stream Stream to append. Must be readable. + * + * @throws \InvalidArgumentException if the stream is not readable + */ + public function addStream(StreamInterface $stream) + { + if (!$stream->isReadable()) { + throw new \InvalidArgumentException('Each stream must be readable'); + } + + // The stream is only seekable if all streams are seekable + if (!$stream->isSeekable()) { + $this->seekable = false; + } + + $this->streams[] = $stream; + } + + public function getContents() + { + return copy_to_string($this); + } + + /** + * Closes each attached stream. + * + * {@inheritdoc} + */ + public function close() + { + $this->pos = $this->current = 0; + $this->seekable = true; + + foreach ($this->streams as $stream) { + $stream->close(); + } + + $this->streams = []; + } + + /** + * Detaches each attached stream. + * + * Returns null as it's not clear which underlying stream resource to return. + * + * {@inheritdoc} + */ + public function detach() + { + $this->pos = $this->current = 0; + $this->seekable = true; + + foreach ($this->streams as $stream) { + $stream->detach(); + } + + $this->streams = []; + } + + public function tell() + { + return $this->pos; + } + + /** + * Tries to calculate the size by adding the size of each stream. + * + * If any of the streams do not return a valid number, then the size of the + * append stream cannot be determined and null is returned. + * + * {@inheritdoc} + */ + public function getSize() + { + $size = 0; + + foreach ($this->streams as $stream) { + $s = $stream->getSize(); + if ($s === null) { + return null; + } + $size += $s; + } + + return $size; + } + + public function eof() + { + return !$this->streams || + ($this->current >= count($this->streams) - 1 && + $this->streams[$this->current]->eof()); + } + + public function rewind() + { + $this->seek(0); + } + + /** + * Attempts to seek to the given position. Only supports SEEK_SET. + * + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + if (!$this->seekable) { + throw new \RuntimeException('This AppendStream is not seekable'); + } elseif ($whence !== SEEK_SET) { + throw new \RuntimeException('The AppendStream can only seek with SEEK_SET'); + } + + $this->pos = $this->current = 0; + + // Rewind each stream + foreach ($this->streams as $i => $stream) { + try { + $stream->rewind(); + } catch (\Exception $e) { + throw new \RuntimeException('Unable to seek stream ' + . $i . ' of the AppendStream', 0, $e); + } + } + + // Seek to the actual position by reading from each stream + while ($this->pos < $offset && !$this->eof()) { + $result = $this->read(min(8096, $offset - $this->pos)); + if ($result === '') { + break; + } + } + } + + /** + * Reads from all of the appended streams until the length is met or EOF. + * + * {@inheritdoc} + */ + public function read($length) + { + $buffer = ''; + $total = count($this->streams) - 1; + $remaining = $length; + $progressToNext = false; + + while ($remaining > 0) { + + // Progress to the next stream if needed. + if ($progressToNext || $this->streams[$this->current]->eof()) { + $progressToNext = false; + if ($this->current === $total) { + break; + } + $this->current++; + } + + $result = $this->streams[$this->current]->read($remaining); + + // Using a loose comparison here to match on '', false, and null + if ($result == null) { + $progressToNext = true; + continue; + } + + $buffer .= $result; + $remaining = $length - strlen($buffer); + } + + $this->pos += strlen($buffer); + + return $buffer; + } + + public function isReadable() + { + return true; + } + + public function isWritable() + { + return false; + } + + public function isSeekable() + { + return $this->seekable; + } + + public function write($string) + { + throw new \RuntimeException('Cannot write to an AppendStream'); + } + + public function getMetadata($key = null) + { + return $key ? null : []; + } +} diff --git a/vendor/guzzlehttp/psr7/src/BufferStream.php b/vendor/guzzlehttp/psr7/src/BufferStream.php new file mode 100644 index 0000000..af4d4c2 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/BufferStream.php @@ -0,0 +1,137 @@ +hwm = $hwm; + } + + public function __toString() + { + return $this->getContents(); + } + + public function getContents() + { + $buffer = $this->buffer; + $this->buffer = ''; + + return $buffer; + } + + public function close() + { + $this->buffer = ''; + } + + public function detach() + { + $this->close(); + } + + public function getSize() + { + return strlen($this->buffer); + } + + public function isReadable() + { + return true; + } + + public function isWritable() + { + return true; + } + + public function isSeekable() + { + return false; + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + throw new \RuntimeException('Cannot seek a BufferStream'); + } + + public function eof() + { + return strlen($this->buffer) === 0; + } + + public function tell() + { + throw new \RuntimeException('Cannot determine the position of a BufferStream'); + } + + /** + * Reads data from the buffer. + */ + public function read($length) + { + $currentLength = strlen($this->buffer); + + if ($length >= $currentLength) { + // No need to slice the buffer because we don't have enough data. + $result = $this->buffer; + $this->buffer = ''; + } else { + // Slice up the result to provide a subset of the buffer. + $result = substr($this->buffer, 0, $length); + $this->buffer = substr($this->buffer, $length); + } + + return $result; + } + + /** + * Writes data to the buffer. + */ + public function write($string) + { + $this->buffer .= $string; + + // TODO: What should happen here? + if (strlen($this->buffer) >= $this->hwm) { + return false; + } + + return strlen($string); + } + + public function getMetadata($key = null) + { + if ($key == 'hwm') { + return $this->hwm; + } + + return $key ? null : []; + } +} diff --git a/vendor/guzzlehttp/psr7/src/CachingStream.php b/vendor/guzzlehttp/psr7/src/CachingStream.php new file mode 100644 index 0000000..ed68f08 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/CachingStream.php @@ -0,0 +1,138 @@ +remoteStream = $stream; + $this->stream = $target ?: new Stream(fopen('php://temp', 'r+')); + } + + public function getSize() + { + return max($this->stream->getSize(), $this->remoteStream->getSize()); + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + if ($whence == SEEK_SET) { + $byte = $offset; + } elseif ($whence == SEEK_CUR) { + $byte = $offset + $this->tell(); + } elseif ($whence == SEEK_END) { + $size = $this->remoteStream->getSize(); + if ($size === null) { + $size = $this->cacheEntireStream(); + } + $byte = $size + $offset; + } else { + throw new \InvalidArgumentException('Invalid whence'); + } + + $diff = $byte - $this->stream->getSize(); + + if ($diff > 0) { + // Read the remoteStream until we have read in at least the amount + // of bytes requested, or we reach the end of the file. + while ($diff > 0 && !$this->remoteStream->eof()) { + $this->read($diff); + $diff = $byte - $this->stream->getSize(); + } + } else { + // We can just do a normal seek since we've already seen this byte. + $this->stream->seek($byte); + } + } + + public function read($length) + { + // Perform a regular read on any previously read data from the buffer + $data = $this->stream->read($length); + $remaining = $length - strlen($data); + + // More data was requested so read from the remote stream + if ($remaining) { + // If data was written to the buffer in a position that would have + // been filled from the remote stream, then we must skip bytes on + // the remote stream to emulate overwriting bytes from that + // position. This mimics the behavior of other PHP stream wrappers. + $remoteData = $this->remoteStream->read( + $remaining + $this->skipReadBytes + ); + + if ($this->skipReadBytes) { + $len = strlen($remoteData); + $remoteData = substr($remoteData, $this->skipReadBytes); + $this->skipReadBytes = max(0, $this->skipReadBytes - $len); + } + + $data .= $remoteData; + $this->stream->write($remoteData); + } + + return $data; + } + + public function write($string) + { + // When appending to the end of the currently read stream, you'll want + // to skip bytes from being read from the remote stream to emulate + // other stream wrappers. Basically replacing bytes of data of a fixed + // length. + $overflow = (strlen($string) + $this->tell()) - $this->remoteStream->tell(); + if ($overflow > 0) { + $this->skipReadBytes += $overflow; + } + + return $this->stream->write($string); + } + + public function eof() + { + return $this->stream->eof() && $this->remoteStream->eof(); + } + + /** + * Close both the remote stream and buffer stream + */ + public function close() + { + $this->remoteStream->close() && $this->stream->close(); + } + + private function cacheEntireStream() + { + $target = new FnStream(['write' => 'strlen']); + copy_to_stream($this, $target); + + return $this->tell(); + } +} diff --git a/vendor/guzzlehttp/psr7/src/DroppingStream.php b/vendor/guzzlehttp/psr7/src/DroppingStream.php new file mode 100644 index 0000000..8935c80 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/DroppingStream.php @@ -0,0 +1,42 @@ +stream = $stream; + $this->maxLength = $maxLength; + } + + public function write($string) + { + $diff = $this->maxLength - $this->stream->getSize(); + + // Begin returning 0 when the underlying stream is too large. + if ($diff <= 0) { + return 0; + } + + // Write the stream or a subset of the stream if needed. + if (strlen($string) < $diff) { + return $this->stream->write($string); + } + + return $this->stream->write(substr($string, 0, $diff)); + } +} diff --git a/vendor/guzzlehttp/psr7/src/FnStream.php b/vendor/guzzlehttp/psr7/src/FnStream.php new file mode 100644 index 0000000..73daea6 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/FnStream.php @@ -0,0 +1,158 @@ +methods = $methods; + + // Create the functions on the class + foreach ($methods as $name => $fn) { + $this->{'_fn_' . $name} = $fn; + } + } + + /** + * Lazily determine which methods are not implemented. + * @throws \BadMethodCallException + */ + public function __get($name) + { + throw new \BadMethodCallException(str_replace('_fn_', '', $name) + . '() is not implemented in the FnStream'); + } + + /** + * The close method is called on the underlying stream only if possible. + */ + public function __destruct() + { + if (isset($this->_fn_close)) { + call_user_func($this->_fn_close); + } + } + + /** + * An unserialize would allow the __destruct to run when the unserialized value goes out of scope. + * @throws \LogicException + */ + public function __wakeup() + { + throw new \LogicException('FnStream should never be unserialized'); + } + + /** + * Adds custom functionality to an underlying stream by intercepting + * specific method calls. + * + * @param StreamInterface $stream Stream to decorate + * @param array $methods Hash of method name to a closure + * + * @return FnStream + */ + public static function decorate(StreamInterface $stream, array $methods) + { + // If any of the required methods were not provided, then simply + // proxy to the decorated stream. + foreach (array_diff(self::$slots, array_keys($methods)) as $diff) { + $methods[$diff] = [$stream, $diff]; + } + + return new self($methods); + } + + public function __toString() + { + return call_user_func($this->_fn___toString); + } + + public function close() + { + return call_user_func($this->_fn_close); + } + + public function detach() + { + return call_user_func($this->_fn_detach); + } + + public function getSize() + { + return call_user_func($this->_fn_getSize); + } + + public function tell() + { + return call_user_func($this->_fn_tell); + } + + public function eof() + { + return call_user_func($this->_fn_eof); + } + + public function isSeekable() + { + return call_user_func($this->_fn_isSeekable); + } + + public function rewind() + { + call_user_func($this->_fn_rewind); + } + + public function seek($offset, $whence = SEEK_SET) + { + call_user_func($this->_fn_seek, $offset, $whence); + } + + public function isWritable() + { + return call_user_func($this->_fn_isWritable); + } + + public function write($string) + { + return call_user_func($this->_fn_write, $string); + } + + public function isReadable() + { + return call_user_func($this->_fn_isReadable); + } + + public function read($length) + { + return call_user_func($this->_fn_read, $length); + } + + public function getContents() + { + return call_user_func($this->_fn_getContents); + } + + public function getMetadata($key = null) + { + return call_user_func($this->_fn_getMetadata, $key); + } +} diff --git a/vendor/guzzlehttp/psr7/src/InflateStream.php b/vendor/guzzlehttp/psr7/src/InflateStream.php new file mode 100644 index 0000000..5e4f602 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/InflateStream.php @@ -0,0 +1,52 @@ +read(10); + $filenameHeaderLength = $this->getLengthOfPossibleFilenameHeader($stream, $header); + // Skip the header, that is 10 + length of filename + 1 (nil) bytes + $stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength); + $resource = StreamWrapper::getResource($stream); + stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ); + $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource)); + } + + /** + * @param StreamInterface $stream + * @param $header + * @return int + */ + private function getLengthOfPossibleFilenameHeader(StreamInterface $stream, $header) + { + $filename_header_length = 0; + + if (substr(bin2hex($header), 6, 2) === '08') { + // we have a filename, read until nil + $filename_header_length = 1; + while ($stream->read(1) !== chr(0)) { + $filename_header_length++; + } + } + + return $filename_header_length; + } +} diff --git a/vendor/guzzlehttp/psr7/src/LazyOpenStream.php b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php new file mode 100644 index 0000000..02cec3a --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php @@ -0,0 +1,39 @@ +filename = $filename; + $this->mode = $mode; + } + + /** + * Creates the underlying stream lazily when required. + * + * @return StreamInterface + */ + protected function createStream() + { + return stream_for(try_fopen($this->filename, $this->mode)); + } +} diff --git a/vendor/guzzlehttp/psr7/src/LimitStream.php b/vendor/guzzlehttp/psr7/src/LimitStream.php new file mode 100644 index 0000000..3c13d4f --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/LimitStream.php @@ -0,0 +1,155 @@ +stream = $stream; + $this->setLimit($limit); + $this->setOffset($offset); + } + + public function eof() + { + // Always return true if the underlying stream is EOF + if ($this->stream->eof()) { + return true; + } + + // No limit and the underlying stream is not at EOF + if ($this->limit == -1) { + return false; + } + + return $this->stream->tell() >= $this->offset + $this->limit; + } + + /** + * Returns the size of the limited subset of data + * {@inheritdoc} + */ + public function getSize() + { + if (null === ($length = $this->stream->getSize())) { + return null; + } elseif ($this->limit == -1) { + return $length - $this->offset; + } else { + return min($this->limit, $length - $this->offset); + } + } + + /** + * Allow for a bounded seek on the read limited stream + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + if ($whence !== SEEK_SET || $offset < 0) { + throw new \RuntimeException(sprintf( + 'Cannot seek to offset % with whence %s', + $offset, + $whence + )); + } + + $offset += $this->offset; + + if ($this->limit !== -1) { + if ($offset > $this->offset + $this->limit) { + $offset = $this->offset + $this->limit; + } + } + + $this->stream->seek($offset); + } + + /** + * Give a relative tell() + * {@inheritdoc} + */ + public function tell() + { + return $this->stream->tell() - $this->offset; + } + + /** + * Set the offset to start limiting from + * + * @param int $offset Offset to seek to and begin byte limiting from + * + * @throws \RuntimeException if the stream cannot be seeked. + */ + public function setOffset($offset) + { + $current = $this->stream->tell(); + + if ($current !== $offset) { + // If the stream cannot seek to the offset position, then read to it + if ($this->stream->isSeekable()) { + $this->stream->seek($offset); + } elseif ($current > $offset) { + throw new \RuntimeException("Could not seek to stream offset $offset"); + } else { + $this->stream->read($offset - $current); + } + } + + $this->offset = $offset; + } + + /** + * Set the limit of bytes that the decorator allows to be read from the + * stream. + * + * @param int $limit Number of bytes to allow to be read from the stream. + * Use -1 for no limit. + */ + public function setLimit($limit) + { + $this->limit = $limit; + } + + public function read($length) + { + if ($this->limit == -1) { + return $this->stream->read($length); + } + + // Check if the current position is less than the total allowed + // bytes + original offset + $remaining = ($this->offset + $this->limit) - $this->stream->tell(); + if ($remaining > 0) { + // Only return the amount of requested data, ensuring that the byte + // limit is not exceeded + return $this->stream->read(min($remaining, $length)); + } + + return ''; + } +} diff --git a/vendor/guzzlehttp/psr7/src/MessageTrait.php b/vendor/guzzlehttp/psr7/src/MessageTrait.php new file mode 100644 index 0000000..1e4da64 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/MessageTrait.php @@ -0,0 +1,183 @@ + array of values */ + private $headers = []; + + /** @var array Map of lowercase header name => original name at registration */ + private $headerNames = []; + + /** @var string */ + private $protocol = '1.1'; + + /** @var StreamInterface */ + private $stream; + + public function getProtocolVersion() + { + return $this->protocol; + } + + public function withProtocolVersion($version) + { + if ($this->protocol === $version) { + return $this; + } + + $new = clone $this; + $new->protocol = $version; + return $new; + } + + public function getHeaders() + { + return $this->headers; + } + + public function hasHeader($header) + { + return isset($this->headerNames[strtolower($header)]); + } + + public function getHeader($header) + { + $header = strtolower($header); + + if (!isset($this->headerNames[$header])) { + return []; + } + + $header = $this->headerNames[$header]; + + return $this->headers[$header]; + } + + public function getHeaderLine($header) + { + return implode(', ', $this->getHeader($header)); + } + + public function withHeader($header, $value) + { + if (!is_array($value)) { + $value = [$value]; + } + + $value = $this->trimHeaderValues($value); + $normalized = strtolower($header); + + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + unset($new->headers[$new->headerNames[$normalized]]); + } + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + + return $new; + } + + public function withAddedHeader($header, $value) + { + if (!is_array($value)) { + $value = [$value]; + } + + $value = $this->trimHeaderValues($value); + $normalized = strtolower($header); + + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $new->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + } + + return $new; + } + + public function withoutHeader($header) + { + $normalized = strtolower($header); + + if (!isset($this->headerNames[$normalized])) { + return $this; + } + + $header = $this->headerNames[$normalized]; + + $new = clone $this; + unset($new->headers[$header], $new->headerNames[$normalized]); + + return $new; + } + + public function getBody() + { + if (!$this->stream) { + $this->stream = stream_for(''); + } + + return $this->stream; + } + + public function withBody(StreamInterface $body) + { + if ($body === $this->stream) { + return $this; + } + + $new = clone $this; + $new->stream = $body; + return $new; + } + + private function setHeaders(array $headers) + { + $this->headerNames = $this->headers = []; + foreach ($headers as $header => $value) { + if (!is_array($value)) { + $value = [$value]; + } + + $value = $this->trimHeaderValues($value); + $normalized = strtolower($header); + if (isset($this->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $this->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $this->headerNames[$normalized] = $header; + $this->headers[$header] = $value; + } + } + } + + /** + * Trims whitespace from the header values. + * + * Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field. + * + * header-field = field-name ":" OWS field-value OWS + * OWS = *( SP / HTAB ) + * + * @param string[] $values Header values + * + * @return string[] Trimmed header values + * + * @see https://tools.ietf.org/html/rfc7230#section-3.2.4 + */ + private function trimHeaderValues(array $values) + { + return array_map(function ($value) { + return trim($value, " \t"); + }, $values); + } +} diff --git a/vendor/guzzlehttp/psr7/src/MultipartStream.php b/vendor/guzzlehttp/psr7/src/MultipartStream.php new file mode 100644 index 0000000..c0fd584 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/MultipartStream.php @@ -0,0 +1,153 @@ +boundary = $boundary ?: sha1(uniqid('', true)); + $this->stream = $this->createStream($elements); + } + + /** + * Get the boundary + * + * @return string + */ + public function getBoundary() + { + return $this->boundary; + } + + public function isWritable() + { + return false; + } + + /** + * Get the headers needed before transferring the content of a POST file + */ + private function getHeaders(array $headers) + { + $str = ''; + foreach ($headers as $key => $value) { + $str .= "{$key}: {$value}\r\n"; + } + + return "--{$this->boundary}\r\n" . trim($str) . "\r\n\r\n"; + } + + /** + * Create the aggregate stream that will be used to upload the POST data + */ + protected function createStream(array $elements) + { + $stream = new AppendStream(); + + foreach ($elements as $element) { + $this->addElement($stream, $element); + } + + // Add the trailing boundary with CRLF + $stream->addStream(stream_for("--{$this->boundary}--\r\n")); + + return $stream; + } + + private function addElement(AppendStream $stream, array $element) + { + foreach (['contents', 'name'] as $key) { + if (!array_key_exists($key, $element)) { + throw new \InvalidArgumentException("A '{$key}' key is required"); + } + } + + $element['contents'] = stream_for($element['contents']); + + if (empty($element['filename'])) { + $uri = $element['contents']->getMetadata('uri'); + if (substr($uri, 0, 6) !== 'php://') { + $element['filename'] = $uri; + } + } + + list($body, $headers) = $this->createElement( + $element['name'], + $element['contents'], + isset($element['filename']) ? $element['filename'] : null, + isset($element['headers']) ? $element['headers'] : [] + ); + + $stream->addStream(stream_for($this->getHeaders($headers))); + $stream->addStream($body); + $stream->addStream(stream_for("\r\n")); + } + + /** + * @return array + */ + private function createElement($name, StreamInterface $stream, $filename, array $headers) + { + // Set a default content-disposition header if one was no provided + $disposition = $this->getHeader($headers, 'content-disposition'); + if (!$disposition) { + $headers['Content-Disposition'] = ($filename === '0' || $filename) + ? sprintf('form-data; name="%s"; filename="%s"', + $name, + basename($filename)) + : "form-data; name=\"{$name}\""; + } + + // Set a default content-length header if one was no provided + $length = $this->getHeader($headers, 'content-length'); + if (!$length) { + if ($length = $stream->getSize()) { + $headers['Content-Length'] = (string) $length; + } + } + + // Set a default Content-Type if one was not supplied + $type = $this->getHeader($headers, 'content-type'); + if (!$type && ($filename === '0' || $filename)) { + if ($type = mimetype_from_filename($filename)) { + $headers['Content-Type'] = $type; + } + } + + return [$stream, $headers]; + } + + private function getHeader(array $headers, $key) + { + $lowercaseHeader = strtolower($key); + foreach ($headers as $k => $v) { + if (strtolower($k) === $lowercaseHeader) { + return $v; + } + } + + return null; + } +} diff --git a/vendor/guzzlehttp/psr7/src/NoSeekStream.php b/vendor/guzzlehttp/psr7/src/NoSeekStream.php new file mode 100644 index 0000000..2332218 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/NoSeekStream.php @@ -0,0 +1,22 @@ +source = $source; + $this->size = isset($options['size']) ? $options['size'] : null; + $this->metadata = isset($options['metadata']) ? $options['metadata'] : []; + $this->buffer = new BufferStream(); + } + + public function __toString() + { + try { + return copy_to_string($this); + } catch (\Exception $e) { + return ''; + } + } + + public function close() + { + $this->detach(); + } + + public function detach() + { + $this->tellPos = false; + $this->source = null; + } + + public function getSize() + { + return $this->size; + } + + public function tell() + { + return $this->tellPos; + } + + public function eof() + { + return !$this->source; + } + + public function isSeekable() + { + return false; + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + throw new \RuntimeException('Cannot seek a PumpStream'); + } + + public function isWritable() + { + return false; + } + + public function write($string) + { + throw new \RuntimeException('Cannot write to a PumpStream'); + } + + public function isReadable() + { + return true; + } + + public function read($length) + { + $data = $this->buffer->read($length); + $readLen = strlen($data); + $this->tellPos += $readLen; + $remaining = $length - $readLen; + + if ($remaining) { + $this->pump($remaining); + $data .= $this->buffer->read($remaining); + $this->tellPos += strlen($data) - $readLen; + } + + return $data; + } + + public function getContents() + { + $result = ''; + while (!$this->eof()) { + $result .= $this->read(1000000); + } + + return $result; + } + + public function getMetadata($key = null) + { + if (!$key) { + return $this->metadata; + } + + return isset($this->metadata[$key]) ? $this->metadata[$key] : null; + } + + private function pump($length) + { + if ($this->source) { + do { + $data = call_user_func($this->source, $length); + if ($data === false || $data === null) { + $this->source = null; + return; + } + $this->buffer->write($data); + $length -= strlen($data); + } while ($length > 0); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/Request.php b/vendor/guzzlehttp/psr7/src/Request.php new file mode 100644 index 0000000..0006642 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Request.php @@ -0,0 +1,142 @@ +method = strtoupper($method); + $this->uri = $uri; + $this->setHeaders($headers); + $this->protocol = $version; + + if (!isset($this->headerNames['host'])) { + $this->updateHostFromUri(); + } + + if ($body !== '' && $body !== null) { + $this->stream = stream_for($body); + } + } + + public function getRequestTarget() + { + if ($this->requestTarget !== null) { + return $this->requestTarget; + } + + $target = $this->uri->getPath(); + if ($target == '') { + $target = '/'; + } + if ($this->uri->getQuery() != '') { + $target .= '?' . $this->uri->getQuery(); + } + + return $target; + } + + public function withRequestTarget($requestTarget) + { + if (preg_match('#\s#', $requestTarget)) { + throw new InvalidArgumentException( + 'Invalid request target provided; cannot contain whitespace' + ); + } + + $new = clone $this; + $new->requestTarget = $requestTarget; + return $new; + } + + public function getMethod() + { + return $this->method; + } + + public function withMethod($method) + { + $new = clone $this; + $new->method = strtoupper($method); + return $new; + } + + public function getUri() + { + return $this->uri; + } + + public function withUri(UriInterface $uri, $preserveHost = false) + { + if ($uri === $this->uri) { + return $this; + } + + $new = clone $this; + $new->uri = $uri; + + if (!$preserveHost || !isset($this->headerNames['host'])) { + $new->updateHostFromUri(); + } + + return $new; + } + + private function updateHostFromUri() + { + $host = $this->uri->getHost(); + + if ($host == '') { + return; + } + + if (($port = $this->uri->getPort()) !== null) { + $host .= ':' . $port; + } + + if (isset($this->headerNames['host'])) { + $header = $this->headerNames['host']; + } else { + $header = 'Host'; + $this->headerNames['host'] = 'Host'; + } + // Ensure Host is the first header. + // See: http://tools.ietf.org/html/rfc7230#section-5.4 + $this->headers = [$header => [$host]] + $this->headers; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Response.php b/vendor/guzzlehttp/psr7/src/Response.php new file mode 100644 index 0000000..6e72c06 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Response.php @@ -0,0 +1,136 @@ + 'Continue', + 101 => 'Switching Protocols', + 102 => 'Processing', + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + 207 => 'Multi-status', + 208 => 'Already Reported', + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', + 303 => 'See Other', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 306 => 'Switch Proxy', + 307 => 'Temporary Redirect', + 400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Time-out', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Request Entity Too Large', + 414 => 'Request-URI Too Large', + 415 => 'Unsupported Media Type', + 416 => 'Requested range not satisfiable', + 417 => 'Expectation Failed', + 418 => 'I\'m a teapot', + 422 => 'Unprocessable Entity', + 423 => 'Locked', + 424 => 'Failed Dependency', + 425 => 'Unordered Collection', + 426 => 'Upgrade Required', + 428 => 'Precondition Required', + 429 => 'Too Many Requests', + 431 => 'Request Header Fields Too Large', + 451 => 'Unavailable For Legal Reasons', + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Time-out', + 505 => 'HTTP Version not supported', + 506 => 'Variant Also Negotiates', + 507 => 'Insufficient Storage', + 508 => 'Loop Detected', + 511 => 'Network Authentication Required', + ]; + + /** @var string */ + private $reasonPhrase = ''; + + /** @var int */ + private $statusCode = 200; + + /** + * @param int $status Status code + * @param array $headers Response headers + * @param string|null|resource|StreamInterface $body Response body + * @param string $version Protocol version + * @param string|null $reason Reason phrase (when empty a default will be used based on the status code) + */ + public function __construct( + $status = 200, + array $headers = [], + $body = null, + $version = '1.1', + $reason = null + ) { + if (filter_var($status, FILTER_VALIDATE_INT) === false) { + throw new \InvalidArgumentException('Status code must be an integer value.'); + } + + $this->statusCode = (int) $status; + + if ($body !== '' && $body !== null) { + $this->stream = stream_for($body); + } + + $this->setHeaders($headers); + if ($reason == '' && isset(self::$phrases[$this->statusCode])) { + $this->reasonPhrase = self::$phrases[$this->statusCode]; + } else { + $this->reasonPhrase = (string) $reason; + } + + $this->protocol = $version; + } + + public function getStatusCode() + { + return $this->statusCode; + } + + public function getReasonPhrase() + { + return $this->reasonPhrase; + } + + public function withStatus($code, $reasonPhrase = '') + { + $new = clone $this; + $new->statusCode = (int) $code; + if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) { + $reasonPhrase = self::$phrases[$new->statusCode]; + } + $new->reasonPhrase = $reasonPhrase; + return $new; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Rfc7230.php b/vendor/guzzlehttp/psr7/src/Rfc7230.php new file mode 100644 index 0000000..505e474 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Rfc7230.php @@ -0,0 +1,18 @@ +@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m"; + const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)"; +} diff --git a/vendor/guzzlehttp/psr7/src/ServerRequest.php b/vendor/guzzlehttp/psr7/src/ServerRequest.php new file mode 100644 index 0000000..99f453a --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/ServerRequest.php @@ -0,0 +1,376 @@ +serverParams = $serverParams; + + parent::__construct($method, $uri, $headers, $body, $version); + } + + /** + * Return an UploadedFile instance array. + * + * @param array $files A array which respect $_FILES structure + * @throws InvalidArgumentException for unrecognized values + * @return array + */ + public static function normalizeFiles(array $files) + { + $normalized = []; + + foreach ($files as $key => $value) { + if ($value instanceof UploadedFileInterface) { + $normalized[$key] = $value; + } elseif (is_array($value) && isset($value['tmp_name'])) { + $normalized[$key] = self::createUploadedFileFromSpec($value); + } elseif (is_array($value)) { + $normalized[$key] = self::normalizeFiles($value); + continue; + } else { + throw new InvalidArgumentException('Invalid value in files specification'); + } + } + + return $normalized; + } + + /** + * Create and return an UploadedFile instance from a $_FILES specification. + * + * If the specification represents an array of values, this method will + * delegate to normalizeNestedFileSpec() and return that return value. + * + * @param array $value $_FILES struct + * @return array|UploadedFileInterface + */ + private static function createUploadedFileFromSpec(array $value) + { + if (is_array($value['tmp_name'])) { + return self::normalizeNestedFileSpec($value); + } + + return new UploadedFile( + $value['tmp_name'], + (int) $value['size'], + (int) $value['error'], + $value['name'], + $value['type'] + ); + } + + /** + * Normalize an array of file specifications. + * + * Loops through all nested files and returns a normalized array of + * UploadedFileInterface instances. + * + * @param array $files + * @return UploadedFileInterface[] + */ + private static function normalizeNestedFileSpec(array $files = []) + { + $normalizedFiles = []; + + foreach (array_keys($files['tmp_name']) as $key) { + $spec = [ + 'tmp_name' => $files['tmp_name'][$key], + 'size' => $files['size'][$key], + 'error' => $files['error'][$key], + 'name' => $files['name'][$key], + 'type' => $files['type'][$key], + ]; + $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec); + } + + return $normalizedFiles; + } + + /** + * Return a ServerRequest populated with superglobals: + * $_GET + * $_POST + * $_COOKIE + * $_FILES + * $_SERVER + * + * @return ServerRequestInterface + */ + public static function fromGlobals() + { + $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'; + $headers = getallheaders(); + $uri = self::getUriFromGlobals(); + $body = new LazyOpenStream('php://input', 'r+'); + $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1'; + + $serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER); + + return $serverRequest + ->withCookieParams($_COOKIE) + ->withQueryParams($_GET) + ->withParsedBody($_POST) + ->withUploadedFiles(self::normalizeFiles($_FILES)); + } + + private static function extractHostAndPortFromAuthority($authority) + { + $uri = 'http://'.$authority; + $parts = parse_url($uri); + if (false === $parts) { + return [null, null]; + } + + $host = isset($parts['host']) ? $parts['host'] : null; + $port = isset($parts['port']) ? $parts['port'] : null; + + return [$host, $port]; + } + + /** + * Get a Uri populated with values from $_SERVER. + * + * @return UriInterface + */ + public static function getUriFromGlobals() + { + $uri = new Uri(''); + + $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http'); + + $hasPort = false; + if (isset($_SERVER['HTTP_HOST'])) { + list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']); + if ($host !== null) { + $uri = $uri->withHost($host); + } + + if ($port !== null) { + $hasPort = true; + $uri = $uri->withPort($port); + } + } elseif (isset($_SERVER['SERVER_NAME'])) { + $uri = $uri->withHost($_SERVER['SERVER_NAME']); + } elseif (isset($_SERVER['SERVER_ADDR'])) { + $uri = $uri->withHost($_SERVER['SERVER_ADDR']); + } + + if (!$hasPort && isset($_SERVER['SERVER_PORT'])) { + $uri = $uri->withPort($_SERVER['SERVER_PORT']); + } + + $hasQuery = false; + if (isset($_SERVER['REQUEST_URI'])) { + $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2); + $uri = $uri->withPath($requestUriParts[0]); + if (isset($requestUriParts[1])) { + $hasQuery = true; + $uri = $uri->withQuery($requestUriParts[1]); + } + } + + if (!$hasQuery && isset($_SERVER['QUERY_STRING'])) { + $uri = $uri->withQuery($_SERVER['QUERY_STRING']); + } + + return $uri; + } + + + /** + * {@inheritdoc} + */ + public function getServerParams() + { + return $this->serverParams; + } + + /** + * {@inheritdoc} + */ + public function getUploadedFiles() + { + return $this->uploadedFiles; + } + + /** + * {@inheritdoc} + */ + public function withUploadedFiles(array $uploadedFiles) + { + $new = clone $this; + $new->uploadedFiles = $uploadedFiles; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getCookieParams() + { + return $this->cookieParams; + } + + /** + * {@inheritdoc} + */ + public function withCookieParams(array $cookies) + { + $new = clone $this; + $new->cookieParams = $cookies; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getQueryParams() + { + return $this->queryParams; + } + + /** + * {@inheritdoc} + */ + public function withQueryParams(array $query) + { + $new = clone $this; + $new->queryParams = $query; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getParsedBody() + { + return $this->parsedBody; + } + + /** + * {@inheritdoc} + */ + public function withParsedBody($data) + { + $new = clone $this; + $new->parsedBody = $data; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * {@inheritdoc} + */ + public function getAttribute($attribute, $default = null) + { + if (false === array_key_exists($attribute, $this->attributes)) { + return $default; + } + + return $this->attributes[$attribute]; + } + + /** + * {@inheritdoc} + */ + public function withAttribute($attribute, $value) + { + $new = clone $this; + $new->attributes[$attribute] = $value; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function withoutAttribute($attribute) + { + if (false === array_key_exists($attribute, $this->attributes)) { + return $this; + } + + $new = clone $this; + unset($new->attributes[$attribute]); + + return $new; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Stream.php b/vendor/guzzlehttp/psr7/src/Stream.php new file mode 100644 index 0000000..111795e --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Stream.php @@ -0,0 +1,270 @@ + [ + 'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true, + 'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, + 'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true, + 'x+t' => true, 'c+t' => true, 'a+' => true, 'rb+' => true, + ], + 'write' => [ + 'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true, + 'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true, 'rb+' => true, + 'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true, + 'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true + ] + ]; + + /** + * This constructor accepts an associative array of options. + * + * - size: (int) If a read stream would otherwise have an indeterminate + * size, but the size is known due to foreknowledge, then you can + * provide that size, in bytes. + * - metadata: (array) Any additional metadata to return when the metadata + * of the stream is accessed. + * + * @param resource $stream Stream resource to wrap. + * @param array $options Associative array of options. + * + * @throws \InvalidArgumentException if the stream is not a stream resource + */ + public function __construct($stream, $options = []) + { + if (!is_resource($stream)) { + throw new \InvalidArgumentException('Stream must be a resource'); + } + + if (isset($options['size'])) { + $this->size = $options['size']; + } + + $this->customMetadata = isset($options['metadata']) + ? $options['metadata'] + : []; + + $this->stream = $stream; + $meta = stream_get_meta_data($this->stream); + $this->seekable = $meta['seekable']; + $this->readable = isset(self::$readWriteHash['read'][$meta['mode']]); + $this->writable = isset(self::$readWriteHash['write'][$meta['mode']]); + $this->uri = $this->getMetadata('uri'); + } + + /** + * Closes the stream when the destructed + */ + public function __destruct() + { + $this->close(); + } + + public function __toString() + { + try { + $this->seek(0); + return (string) stream_get_contents($this->stream); + } catch (\Exception $e) { + return ''; + } + } + + public function getContents() + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + $contents = stream_get_contents($this->stream); + + if ($contents === false) { + throw new \RuntimeException('Unable to read stream contents'); + } + + return $contents; + } + + public function close() + { + if (isset($this->stream)) { + if (is_resource($this->stream)) { + fclose($this->stream); + } + $this->detach(); + } + } + + public function detach() + { + if (!isset($this->stream)) { + return null; + } + + $result = $this->stream; + unset($this->stream); + $this->size = $this->uri = null; + $this->readable = $this->writable = $this->seekable = false; + + return $result; + } + + public function getSize() + { + if ($this->size !== null) { + return $this->size; + } + + if (!isset($this->stream)) { + return null; + } + + // Clear the stat cache if the stream has a URI + if ($this->uri) { + clearstatcache(true, $this->uri); + } + + $stats = fstat($this->stream); + if (isset($stats['size'])) { + $this->size = $stats['size']; + return $this->size; + } + + return null; + } + + public function isReadable() + { + return $this->readable; + } + + public function isWritable() + { + return $this->writable; + } + + public function isSeekable() + { + return $this->seekable; + } + + public function eof() + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + return feof($this->stream); + } + + public function tell() + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + $result = ftell($this->stream); + + if ($result === false) { + throw new \RuntimeException('Unable to determine stream position'); + } + + return $result; + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->seekable) { + throw new \RuntimeException('Stream is not seekable'); + } + if (fseek($this->stream, $offset, $whence) === -1) { + throw new \RuntimeException('Unable to seek to stream position ' + . $offset . ' with whence ' . var_export($whence, true)); + } + } + + public function read($length) + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->readable) { + throw new \RuntimeException('Cannot read from non-readable stream'); + } + if ($length < 0) { + throw new \RuntimeException('Length parameter cannot be negative'); + } + + if (0 === $length) { + return ''; + } + + $string = fread($this->stream, $length); + if (false === $string) { + throw new \RuntimeException('Unable to read from stream'); + } + + return $string; + } + + public function write($string) + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->writable) { + throw new \RuntimeException('Cannot write to a non-writable stream'); + } + + // We can't know the size after writing anything + $this->size = null; + $result = fwrite($this->stream, $string); + + if ($result === false) { + throw new \RuntimeException('Unable to write to stream'); + } + + return $result; + } + + public function getMetadata($key = null) + { + if (!isset($this->stream)) { + return $key ? null : []; + } elseif (!$key) { + return $this->customMetadata + stream_get_meta_data($this->stream); + } elseif (isset($this->customMetadata[$key])) { + return $this->customMetadata[$key]; + } + + $meta = stream_get_meta_data($this->stream); + + return isset($meta[$key]) ? $meta[$key] : null; + } +} diff --git a/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php b/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php new file mode 100644 index 0000000..daec6f5 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php @@ -0,0 +1,149 @@ +stream = $stream; + } + + /** + * Magic method used to create a new stream if streams are not added in + * the constructor of a decorator (e.g., LazyOpenStream). + * + * @param string $name Name of the property (allows "stream" only). + * + * @return StreamInterface + */ + public function __get($name) + { + if ($name == 'stream') { + $this->stream = $this->createStream(); + return $this->stream; + } + + throw new \UnexpectedValueException("$name not found on class"); + } + + public function __toString() + { + try { + if ($this->isSeekable()) { + $this->seek(0); + } + return $this->getContents(); + } catch (\Exception $e) { + // Really, PHP? https://bugs.php.net/bug.php?id=53648 + trigger_error('StreamDecorator::__toString exception: ' + . (string) $e, E_USER_ERROR); + return ''; + } + } + + public function getContents() + { + return copy_to_string($this); + } + + /** + * Allow decorators to implement custom methods + * + * @param string $method Missing method name + * @param array $args Method arguments + * + * @return mixed + */ + public function __call($method, array $args) + { + $result = call_user_func_array([$this->stream, $method], $args); + + // Always return the wrapped object if the result is a return $this + return $result === $this->stream ? $this : $result; + } + + public function close() + { + $this->stream->close(); + } + + public function getMetadata($key = null) + { + return $this->stream->getMetadata($key); + } + + public function detach() + { + return $this->stream->detach(); + } + + public function getSize() + { + return $this->stream->getSize(); + } + + public function eof() + { + return $this->stream->eof(); + } + + public function tell() + { + return $this->stream->tell(); + } + + public function isReadable() + { + return $this->stream->isReadable(); + } + + public function isWritable() + { + return $this->stream->isWritable(); + } + + public function isSeekable() + { + return $this->stream->isSeekable(); + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + $this->stream->seek($offset, $whence); + } + + public function read($length) + { + return $this->stream->read($length); + } + + public function write($string) + { + return $this->stream->write($string); + } + + /** + * Implement in subclasses to dynamically create streams when requested. + * + * @return StreamInterface + * @throws \BadMethodCallException + */ + protected function createStream() + { + throw new \BadMethodCallException('Not implemented'); + } +} diff --git a/vendor/guzzlehttp/psr7/src/StreamWrapper.php b/vendor/guzzlehttp/psr7/src/StreamWrapper.php new file mode 100644 index 0000000..0f3a285 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/StreamWrapper.php @@ -0,0 +1,161 @@ +isReadable()) { + $mode = $stream->isWritable() ? 'r+' : 'r'; + } elseif ($stream->isWritable()) { + $mode = 'w'; + } else { + throw new \InvalidArgumentException('The stream must be readable, ' + . 'writable, or both.'); + } + + return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream)); + } + + /** + * Creates a stream context that can be used to open a stream as a php stream resource. + * + * @param StreamInterface $stream + * + * @return resource + */ + public static function createStreamContext(StreamInterface $stream) + { + return stream_context_create([ + 'guzzle' => ['stream' => $stream] + ]); + } + + /** + * Registers the stream wrapper if needed + */ + public static function register() + { + if (!in_array('guzzle', stream_get_wrappers())) { + stream_wrapper_register('guzzle', __CLASS__); + } + } + + public function stream_open($path, $mode, $options, &$opened_path) + { + $options = stream_context_get_options($this->context); + + if (!isset($options['guzzle']['stream'])) { + return false; + } + + $this->mode = $mode; + $this->stream = $options['guzzle']['stream']; + + return true; + } + + public function stream_read($count) + { + return $this->stream->read($count); + } + + public function stream_write($data) + { + return (int) $this->stream->write($data); + } + + public function stream_tell() + { + return $this->stream->tell(); + } + + public function stream_eof() + { + return $this->stream->eof(); + } + + public function stream_seek($offset, $whence) + { + $this->stream->seek($offset, $whence); + + return true; + } + + public function stream_cast($cast_as) + { + $stream = clone($this->stream); + + return $stream->detach(); + } + + public function stream_stat() + { + static $modeMap = [ + 'r' => 33060, + 'rb' => 33060, + 'r+' => 33206, + 'w' => 33188, + 'wb' => 33188 + ]; + + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => $modeMap[$this->mode], + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => $this->stream->getSize() ?: 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0 + ]; + } + + public function url_stat($path, $flags) + { + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => 0, + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0 + ]; + } +} diff --git a/vendor/guzzlehttp/psr7/src/UploadedFile.php b/vendor/guzzlehttp/psr7/src/UploadedFile.php new file mode 100644 index 0000000..e62bd5c --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UploadedFile.php @@ -0,0 +1,316 @@ +setError($errorStatus); + $this->setSize($size); + $this->setClientFilename($clientFilename); + $this->setClientMediaType($clientMediaType); + + if ($this->isOk()) { + $this->setStreamOrFile($streamOrFile); + } + } + + /** + * Depending on the value set file or stream variable + * + * @param mixed $streamOrFile + * @throws InvalidArgumentException + */ + private function setStreamOrFile($streamOrFile) + { + if (is_string($streamOrFile)) { + $this->file = $streamOrFile; + } elseif (is_resource($streamOrFile)) { + $this->stream = new Stream($streamOrFile); + } elseif ($streamOrFile instanceof StreamInterface) { + $this->stream = $streamOrFile; + } else { + throw new InvalidArgumentException( + 'Invalid stream or file provided for UploadedFile' + ); + } + } + + /** + * @param int $error + * @throws InvalidArgumentException + */ + private function setError($error) + { + if (false === is_int($error)) { + throw new InvalidArgumentException( + 'Upload file error status must be an integer' + ); + } + + if (false === in_array($error, UploadedFile::$errors)) { + throw new InvalidArgumentException( + 'Invalid error status for UploadedFile' + ); + } + + $this->error = $error; + } + + /** + * @param int $size + * @throws InvalidArgumentException + */ + private function setSize($size) + { + if (false === is_int($size)) { + throw new InvalidArgumentException( + 'Upload file size must be an integer' + ); + } + + $this->size = $size; + } + + /** + * @param mixed $param + * @return boolean + */ + private function isStringOrNull($param) + { + return in_array(gettype($param), ['string', 'NULL']); + } + + /** + * @param mixed $param + * @return boolean + */ + private function isStringNotEmpty($param) + { + return is_string($param) && false === empty($param); + } + + /** + * @param string|null $clientFilename + * @throws InvalidArgumentException + */ + private function setClientFilename($clientFilename) + { + if (false === $this->isStringOrNull($clientFilename)) { + throw new InvalidArgumentException( + 'Upload file client filename must be a string or null' + ); + } + + $this->clientFilename = $clientFilename; + } + + /** + * @param string|null $clientMediaType + * @throws InvalidArgumentException + */ + private function setClientMediaType($clientMediaType) + { + if (false === $this->isStringOrNull($clientMediaType)) { + throw new InvalidArgumentException( + 'Upload file client media type must be a string or null' + ); + } + + $this->clientMediaType = $clientMediaType; + } + + /** + * Return true if there is no upload error + * + * @return boolean + */ + private function isOk() + { + return $this->error === UPLOAD_ERR_OK; + } + + /** + * @return boolean + */ + public function isMoved() + { + return $this->moved; + } + + /** + * @throws RuntimeException if is moved or not ok + */ + private function validateActive() + { + if (false === $this->isOk()) { + throw new RuntimeException('Cannot retrieve stream due to upload error'); + } + + if ($this->isMoved()) { + throw new RuntimeException('Cannot retrieve stream after it has already been moved'); + } + } + + /** + * {@inheritdoc} + * @throws RuntimeException if the upload was not successful. + */ + public function getStream() + { + $this->validateActive(); + + if ($this->stream instanceof StreamInterface) { + return $this->stream; + } + + return new LazyOpenStream($this->file, 'r+'); + } + + /** + * {@inheritdoc} + * + * @see http://php.net/is_uploaded_file + * @see http://php.net/move_uploaded_file + * @param string $targetPath Path to which to move the uploaded file. + * @throws RuntimeException if the upload was not successful. + * @throws InvalidArgumentException if the $path specified is invalid. + * @throws RuntimeException on any error during the move operation, or on + * the second or subsequent call to the method. + */ + public function moveTo($targetPath) + { + $this->validateActive(); + + if (false === $this->isStringNotEmpty($targetPath)) { + throw new InvalidArgumentException( + 'Invalid path provided for move operation; must be a non-empty string' + ); + } + + if ($this->file) { + $this->moved = php_sapi_name() == 'cli' + ? rename($this->file, $targetPath) + : move_uploaded_file($this->file, $targetPath); + } else { + copy_to_stream( + $this->getStream(), + new LazyOpenStream($targetPath, 'w') + ); + + $this->moved = true; + } + + if (false === $this->moved) { + throw new RuntimeException( + sprintf('Uploaded file could not be moved to %s', $targetPath) + ); + } + } + + /** + * {@inheritdoc} + * + * @return int|null The file size in bytes or null if unknown. + */ + public function getSize() + { + return $this->size; + } + + /** + * {@inheritdoc} + * + * @see http://php.net/manual/en/features.file-upload.errors.php + * @return int One of PHP's UPLOAD_ERR_XXX constants. + */ + public function getError() + { + return $this->error; + } + + /** + * {@inheritdoc} + * + * @return string|null The filename sent by the client or null if none + * was provided. + */ + public function getClientFilename() + { + return $this->clientFilename; + } + + /** + * {@inheritdoc} + */ + public function getClientMediaType() + { + return $this->clientMediaType; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Uri.php b/vendor/guzzlehttp/psr7/src/Uri.php new file mode 100644 index 0000000..3621956 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Uri.php @@ -0,0 +1,738 @@ + 80, + 'https' => 443, + 'ftp' => 21, + 'gopher' => 70, + 'nntp' => 119, + 'news' => 119, + 'telnet' => 23, + 'tn3270' => 23, + 'imap' => 143, + 'pop' => 110, + 'ldap' => 389, + ]; + + private static $charUnreserved = 'a-zA-Z0-9_\-\.~'; + private static $charSubDelims = '!\$&\'\(\)\*\+,;='; + private static $replaceQuery = ['=' => '%3D', '&' => '%26']; + + /** @var string Uri scheme. */ + private $scheme = ''; + + /** @var string Uri user info. */ + private $userInfo = ''; + + /** @var string Uri host. */ + private $host = ''; + + /** @var int|null Uri port. */ + private $port; + + /** @var string Uri path. */ + private $path = ''; + + /** @var string Uri query string. */ + private $query = ''; + + /** @var string Uri fragment. */ + private $fragment = ''; + + /** + * @param string $uri URI to parse + */ + public function __construct($uri = '') + { + // weak type check to also accept null until we can add scalar type hints + if ($uri != '') { + $parts = parse_url($uri); + if ($parts === false) { + throw new \InvalidArgumentException("Unable to parse URI: $uri"); + } + $this->applyParts($parts); + } + } + + public function __toString() + { + return self::composeComponents( + $this->scheme, + $this->getAuthority(), + $this->path, + $this->query, + $this->fragment + ); + } + + /** + * Composes a URI reference string from its various components. + * + * Usually this method does not need to be called manually but instead is used indirectly via + * `Psr\Http\Message\UriInterface::__toString`. + * + * PSR-7 UriInterface treats an empty component the same as a missing component as + * getQuery(), getFragment() etc. always return a string. This explains the slight + * difference to RFC 3986 Section 5.3. + * + * Another adjustment is that the authority separator is added even when the authority is missing/empty + * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with + * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But + * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to + * that format). + * + * @param string $scheme + * @param string $authority + * @param string $path + * @param string $query + * @param string $fragment + * + * @return string + * + * @link https://tools.ietf.org/html/rfc3986#section-5.3 + */ + public static function composeComponents($scheme, $authority, $path, $query, $fragment) + { + $uri = ''; + + // weak type checks to also accept null until we can add scalar type hints + if ($scheme != '') { + $uri .= $scheme . ':'; + } + + if ($authority != ''|| $scheme === 'file') { + $uri .= '//' . $authority; + } + + $uri .= $path; + + if ($query != '') { + $uri .= '?' . $query; + } + + if ($fragment != '') { + $uri .= '#' . $fragment; + } + + return $uri; + } + + /** + * Whether the URI has the default port of the current scheme. + * + * `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used + * independently of the implementation. + * + * @param UriInterface $uri + * + * @return bool + */ + public static function isDefaultPort(UriInterface $uri) + { + return $uri->getPort() === null + || (isset(self::$defaultPorts[$uri->getScheme()]) && $uri->getPort() === self::$defaultPorts[$uri->getScheme()]); + } + + /** + * Whether the URI is absolute, i.e. it has a scheme. + * + * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true + * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative + * to another URI, the base URI. Relative references can be divided into several forms: + * - network-path references, e.g. '//example.com/path' + * - absolute-path references, e.g. '/path' + * - relative-path references, e.g. 'subpath' + * + * @param UriInterface $uri + * + * @return bool + * @see Uri::isNetworkPathReference + * @see Uri::isAbsolutePathReference + * @see Uri::isRelativePathReference + * @link https://tools.ietf.org/html/rfc3986#section-4 + */ + public static function isAbsolute(UriInterface $uri) + { + return $uri->getScheme() !== ''; + } + + /** + * Whether the URI is a network-path reference. + * + * A relative reference that begins with two slash characters is termed an network-path reference. + * + * @param UriInterface $uri + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isNetworkPathReference(UriInterface $uri) + { + return $uri->getScheme() === '' && $uri->getAuthority() !== ''; + } + + /** + * Whether the URI is a absolute-path reference. + * + * A relative reference that begins with a single slash character is termed an absolute-path reference. + * + * @param UriInterface $uri + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isAbsolutePathReference(UriInterface $uri) + { + return $uri->getScheme() === '' + && $uri->getAuthority() === '' + && isset($uri->getPath()[0]) + && $uri->getPath()[0] === '/'; + } + + /** + * Whether the URI is a relative-path reference. + * + * A relative reference that does not begin with a slash character is termed a relative-path reference. + * + * @param UriInterface $uri + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isRelativePathReference(UriInterface $uri) + { + return $uri->getScheme() === '' + && $uri->getAuthority() === '' + && (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/'); + } + + /** + * Whether the URI is a same-document reference. + * + * A same-document reference refers to a URI that is, aside from its fragment + * component, identical to the base URI. When no base URI is given, only an empty + * URI reference (apart from its fragment) is considered a same-document reference. + * + * @param UriInterface $uri The URI to check + * @param UriInterface|null $base An optional base URI to compare against + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.4 + */ + public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null) + { + if ($base !== null) { + $uri = UriResolver::resolve($base, $uri); + + return ($uri->getScheme() === $base->getScheme()) + && ($uri->getAuthority() === $base->getAuthority()) + && ($uri->getPath() === $base->getPath()) + && ($uri->getQuery() === $base->getQuery()); + } + + return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === ''; + } + + /** + * Removes dot segments from a path and returns the new path. + * + * @param string $path + * + * @return string + * + * @deprecated since version 1.4. Use UriResolver::removeDotSegments instead. + * @see UriResolver::removeDotSegments + */ + public static function removeDotSegments($path) + { + return UriResolver::removeDotSegments($path); + } + + /** + * Converts the relative URI into a new URI that is resolved against the base URI. + * + * @param UriInterface $base Base URI + * @param string|UriInterface $rel Relative URI + * + * @return UriInterface + * + * @deprecated since version 1.4. Use UriResolver::resolve instead. + * @see UriResolver::resolve + */ + public static function resolve(UriInterface $base, $rel) + { + if (!($rel instanceof UriInterface)) { + $rel = new self($rel); + } + + return UriResolver::resolve($base, $rel); + } + + /** + * Creates a new URI with a specific query string value removed. + * + * Any existing query string values that exactly match the provided key are + * removed. + * + * @param UriInterface $uri URI to use as a base. + * @param string $key Query string key to remove. + * + * @return UriInterface + */ + public static function withoutQueryValue(UriInterface $uri, $key) + { + $result = self::getFilteredQueryString($uri, [$key]); + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a new URI with a specific query string value. + * + * Any existing query string values that exactly match the provided key are + * removed and replaced with the given key value pair. + * + * A value of null will set the query string key without a value, e.g. "key" + * instead of "key=value". + * + * @param UriInterface $uri URI to use as a base. + * @param string $key Key to set. + * @param string|null $value Value to set + * + * @return UriInterface + */ + public static function withQueryValue(UriInterface $uri, $key, $value) + { + $result = self::getFilteredQueryString($uri, [$key]); + + $result[] = self::generateQueryString($key, $value); + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a new URI with multiple specific query string values. + * + * It has the same behavior as withQueryValue() but for an associative array of key => value. + * + * @param UriInterface $uri URI to use as a base. + * @param array $keyValueArray Associative array of key and values + * + * @return UriInterface + */ + public static function withQueryValues(UriInterface $uri, array $keyValueArray) + { + $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); + + foreach ($keyValueArray as $key => $value) { + $result[] = self::generateQueryString($key, $value); + } + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a URI from a hash of `parse_url` components. + * + * @param array $parts + * + * @return UriInterface + * @link http://php.net/manual/en/function.parse-url.php + * + * @throws \InvalidArgumentException If the components do not form a valid URI. + */ + public static function fromParts(array $parts) + { + $uri = new self(); + $uri->applyParts($parts); + $uri->validateState(); + + return $uri; + } + + public function getScheme() + { + return $this->scheme; + } + + public function getAuthority() + { + $authority = $this->host; + if ($this->userInfo !== '') { + $authority = $this->userInfo . '@' . $authority; + } + + if ($this->port !== null) { + $authority .= ':' . $this->port; + } + + return $authority; + } + + public function getUserInfo() + { + return $this->userInfo; + } + + public function getHost() + { + return $this->host; + } + + public function getPort() + { + return $this->port; + } + + public function getPath() + { + return $this->path; + } + + public function getQuery() + { + return $this->query; + } + + public function getFragment() + { + return $this->fragment; + } + + public function withScheme($scheme) + { + $scheme = $this->filterScheme($scheme); + + if ($this->scheme === $scheme) { + return $this; + } + + $new = clone $this; + $new->scheme = $scheme; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withUserInfo($user, $password = null) + { + $info = $user; + if ($password != '') { + $info .= ':' . $password; + } + + if ($this->userInfo === $info) { + return $this; + } + + $new = clone $this; + $new->userInfo = $info; + $new->validateState(); + + return $new; + } + + public function withHost($host) + { + $host = $this->filterHost($host); + + if ($this->host === $host) { + return $this; + } + + $new = clone $this; + $new->host = $host; + $new->validateState(); + + return $new; + } + + public function withPort($port) + { + $port = $this->filterPort($port); + + if ($this->port === $port) { + return $this; + } + + $new = clone $this; + $new->port = $port; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withPath($path) + { + $path = $this->filterPath($path); + + if ($this->path === $path) { + return $this; + } + + $new = clone $this; + $new->path = $path; + $new->validateState(); + + return $new; + } + + public function withQuery($query) + { + $query = $this->filterQueryAndFragment($query); + + if ($this->query === $query) { + return $this; + } + + $new = clone $this; + $new->query = $query; + + return $new; + } + + public function withFragment($fragment) + { + $fragment = $this->filterQueryAndFragment($fragment); + + if ($this->fragment === $fragment) { + return $this; + } + + $new = clone $this; + $new->fragment = $fragment; + + return $new; + } + + /** + * Apply parse_url parts to a URI. + * + * @param array $parts Array of parse_url parts to apply. + */ + private function applyParts(array $parts) + { + $this->scheme = isset($parts['scheme']) + ? $this->filterScheme($parts['scheme']) + : ''; + $this->userInfo = isset($parts['user']) ? $parts['user'] : ''; + $this->host = isset($parts['host']) + ? $this->filterHost($parts['host']) + : ''; + $this->port = isset($parts['port']) + ? $this->filterPort($parts['port']) + : null; + $this->path = isset($parts['path']) + ? $this->filterPath($parts['path']) + : ''; + $this->query = isset($parts['query']) + ? $this->filterQueryAndFragment($parts['query']) + : ''; + $this->fragment = isset($parts['fragment']) + ? $this->filterQueryAndFragment($parts['fragment']) + : ''; + if (isset($parts['pass'])) { + $this->userInfo .= ':' . $parts['pass']; + } + + $this->removeDefaultPort(); + } + + /** + * @param string $scheme + * + * @return string + * + * @throws \InvalidArgumentException If the scheme is invalid. + */ + private function filterScheme($scheme) + { + if (!is_string($scheme)) { + throw new \InvalidArgumentException('Scheme must be a string'); + } + + return strtolower($scheme); + } + + /** + * @param string $host + * + * @return string + * + * @throws \InvalidArgumentException If the host is invalid. + */ + private function filterHost($host) + { + if (!is_string($host)) { + throw new \InvalidArgumentException('Host must be a string'); + } + + return strtolower($host); + } + + /** + * @param int|null $port + * + * @return int|null + * + * @throws \InvalidArgumentException If the port is invalid. + */ + private function filterPort($port) + { + if ($port === null) { + return null; + } + + $port = (int) $port; + if (1 > $port || 0xffff < $port) { + throw new \InvalidArgumentException( + sprintf('Invalid port: %d. Must be between 1 and 65535', $port) + ); + } + + return $port; + } + + /** + * @param UriInterface $uri + * @param array $keys + * + * @return array + */ + private static function getFilteredQueryString(UriInterface $uri, array $keys) + { + $current = $uri->getQuery(); + + if ($current === '') { + return []; + } + + $decodedKeys = array_map('rawurldecode', $keys); + + return array_filter(explode('&', $current), function ($part) use ($decodedKeys) { + return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true); + }); + } + + /** + * @param string $key + * @param string|null $value + * + * @return string + */ + private static function generateQueryString($key, $value) + { + // Query string separators ("=", "&") within the key or value need to be encoded + // (while preventing double-encoding) before setting the query string. All other + // chars that need percent-encoding will be encoded by withQuery(). + $queryString = strtr($key, self::$replaceQuery); + + if ($value !== null) { + $queryString .= '=' . strtr($value, self::$replaceQuery); + } + + return $queryString; + } + + private function removeDefaultPort() + { + if ($this->port !== null && self::isDefaultPort($this)) { + $this->port = null; + } + } + + /** + * Filters the path of a URI + * + * @param string $path + * + * @return string + * + * @throws \InvalidArgumentException If the path is invalid. + */ + private function filterPath($path) + { + if (!is_string($path)) { + throw new \InvalidArgumentException('Path must be a string'); + } + + return preg_replace_callback( + '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $path + ); + } + + /** + * Filters the query string or fragment of a URI. + * + * @param string $str + * + * @return string + * + * @throws \InvalidArgumentException If the query or fragment is invalid. + */ + private function filterQueryAndFragment($str) + { + if (!is_string($str)) { + throw new \InvalidArgumentException('Query and fragment must be a string'); + } + + return preg_replace_callback( + '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $str + ); + } + + private function rawurlencodeMatchZero(array $match) + { + return rawurlencode($match[0]); + } + + private function validateState() + { + if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) { + $this->host = self::HTTP_DEFAULT_HOST; + } + + if ($this->getAuthority() === '') { + if (0 === strpos($this->path, '//')) { + throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"'); + } + if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) { + throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon'); + } + } elseif (isset($this->path[0]) && $this->path[0] !== '/') { + @trigger_error( + 'The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI ' . + 'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.', + E_USER_DEPRECATED + ); + $this->path = '/'. $this->path; + //throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty'); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/UriNormalizer.php b/vendor/guzzlehttp/psr7/src/UriNormalizer.php new file mode 100644 index 0000000..384c29e --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UriNormalizer.php @@ -0,0 +1,216 @@ +getPath() === '' && + ($uri->getScheme() === 'http' || $uri->getScheme() === 'https') + ) { + $uri = $uri->withPath('/'); + } + + if ($flags & self::REMOVE_DEFAULT_HOST && $uri->getScheme() === 'file' && $uri->getHost() === 'localhost') { + $uri = $uri->withHost(''); + } + + if ($flags & self::REMOVE_DEFAULT_PORT && $uri->getPort() !== null && Uri::isDefaultPort($uri)) { + $uri = $uri->withPort(null); + } + + if ($flags & self::REMOVE_DOT_SEGMENTS && !Uri::isRelativePathReference($uri)) { + $uri = $uri->withPath(UriResolver::removeDotSegments($uri->getPath())); + } + + if ($flags & self::REMOVE_DUPLICATE_SLASHES) { + $uri = $uri->withPath(preg_replace('#//++#', '/', $uri->getPath())); + } + + if ($flags & self::SORT_QUERY_PARAMETERS && $uri->getQuery() !== '') { + $queryKeyValues = explode('&', $uri->getQuery()); + sort($queryKeyValues); + $uri = $uri->withQuery(implode('&', $queryKeyValues)); + } + + return $uri; + } + + /** + * Whether two URIs can be considered equivalent. + * + * Both URIs are normalized automatically before comparison with the given $normalizations bitmask. The method also + * accepts relative URI references and returns true when they are equivalent. This of course assumes they will be + * resolved against the same base URI. If this is not the case, determination of equivalence or difference of + * relative references does not mean anything. + * + * @param UriInterface $uri1 An URI to compare + * @param UriInterface $uri2 An URI to compare + * @param int $normalizations A bitmask of normalizations to apply, see constants + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-6.1 + */ + public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS) + { + return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations); + } + + private static function capitalizePercentEncoding(UriInterface $uri) + { + $regex = '/(?:%[A-Fa-f0-9]{2})++/'; + + $callback = function (array $match) { + return strtoupper($match[0]); + }; + + return + $uri->withPath( + preg_replace_callback($regex, $callback, $uri->getPath()) + )->withQuery( + preg_replace_callback($regex, $callback, $uri->getQuery()) + ); + } + + private static function decodeUnreservedCharacters(UriInterface $uri) + { + $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i'; + + $callback = function (array $match) { + return rawurldecode($match[0]); + }; + + return + $uri->withPath( + preg_replace_callback($regex, $callback, $uri->getPath()) + )->withQuery( + preg_replace_callback($regex, $callback, $uri->getQuery()) + ); + } + + private function __construct() + { + // cannot be instantiated + } +} diff --git a/vendor/guzzlehttp/psr7/src/UriResolver.php b/vendor/guzzlehttp/psr7/src/UriResolver.php new file mode 100644 index 0000000..c1cb8a2 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UriResolver.php @@ -0,0 +1,219 @@ +getScheme() != '') { + return $rel->withPath(self::removeDotSegments($rel->getPath())); + } + + if ($rel->getAuthority() != '') { + $targetAuthority = $rel->getAuthority(); + $targetPath = self::removeDotSegments($rel->getPath()); + $targetQuery = $rel->getQuery(); + } else { + $targetAuthority = $base->getAuthority(); + if ($rel->getPath() === '') { + $targetPath = $base->getPath(); + $targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery(); + } else { + if ($rel->getPath()[0] === '/') { + $targetPath = $rel->getPath(); + } else { + if ($targetAuthority != '' && $base->getPath() === '') { + $targetPath = '/' . $rel->getPath(); + } else { + $lastSlashPos = strrpos($base->getPath(), '/'); + if ($lastSlashPos === false) { + $targetPath = $rel->getPath(); + } else { + $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath(); + } + } + } + $targetPath = self::removeDotSegments($targetPath); + $targetQuery = $rel->getQuery(); + } + } + + return new Uri(Uri::composeComponents( + $base->getScheme(), + $targetAuthority, + $targetPath, + $targetQuery, + $rel->getFragment() + )); + } + + /** + * Returns the target URI as a relative reference from the base URI. + * + * This method is the counterpart to resolve(): + * + * (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) + * + * One use-case is to use the current request URI as base URI and then generate relative links in your documents + * to reduce the document size or offer self-contained downloadable document archives. + * + * $base = new Uri('http://example.com/a/b/'); + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. + * echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. + * + * This method also accepts a target that is already relative and will try to relativize it further. Only a + * relative-path reference will be returned as-is. + * + * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well + * + * @param UriInterface $base Base URI + * @param UriInterface $target Target URI + * + * @return UriInterface The relative URI reference + */ + public static function relativize(UriInterface $base, UriInterface $target) + { + if ($target->getScheme() !== '' && + ($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '') + ) { + return $target; + } + + if (Uri::isRelativePathReference($target)) { + // As the target is already highly relative we return it as-is. It would be possible to resolve + // the target with `$target = self::resolve($base, $target);` and then try make it more relative + // by removing a duplicate query. But let's not do that automatically. + return $target; + } + + if ($target->getAuthority() !== '' && $base->getAuthority() !== $target->getAuthority()) { + return $target->withScheme(''); + } + + // We must remove the path before removing the authority because if the path starts with two slashes, the URI + // would turn invalid. And we also cannot set a relative path before removing the authority, as that is also + // invalid. + $emptyPathUri = $target->withScheme('')->withPath('')->withUserInfo('')->withPort(null)->withHost(''); + + if ($base->getPath() !== $target->getPath()) { + return $emptyPathUri->withPath(self::getRelativePath($base, $target)); + } + + if ($base->getQuery() === $target->getQuery()) { + // Only the target fragment is left. And it must be returned even if base and target fragment are the same. + return $emptyPathUri->withQuery(''); + } + + // If the base URI has a query but the target has none, we cannot return an empty path reference as it would + // inherit the base query component when resolving. + if ($target->getQuery() === '') { + $segments = explode('/', $target->getPath()); + $lastSegment = end($segments); + + return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment); + } + + return $emptyPathUri; + } + + private static function getRelativePath(UriInterface $base, UriInterface $target) + { + $sourceSegments = explode('/', $base->getPath()); + $targetSegments = explode('/', $target->getPath()); + array_pop($sourceSegments); + $targetLastSegment = array_pop($targetSegments); + foreach ($sourceSegments as $i => $segment) { + if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) { + unset($sourceSegments[$i], $targetSegments[$i]); + } else { + break; + } + } + $targetSegments[] = $targetLastSegment; + $relativePath = str_repeat('../', count($sourceSegments)) . implode('/', $targetSegments); + + // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./". + // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used + // as the first segment of a relative-path reference, as it would be mistaken for a scheme name. + if ('' === $relativePath || false !== strpos(explode('/', $relativePath, 2)[0], ':')) { + $relativePath = "./$relativePath"; + } elseif ('/' === $relativePath[0]) { + if ($base->getAuthority() != '' && $base->getPath() === '') { + // In this case an extra slash is added by resolve() automatically. So we must not add one here. + $relativePath = ".$relativePath"; + } else { + $relativePath = "./$relativePath"; + } + } + + return $relativePath; + } + + private function __construct() + { + // cannot be instantiated + } +} diff --git a/vendor/guzzlehttp/psr7/src/functions.php b/vendor/guzzlehttp/psr7/src/functions.php new file mode 100644 index 0000000..957bfb4 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/functions.php @@ -0,0 +1,898 @@ +getMethod() . ' ' + . $message->getRequestTarget()) + . ' HTTP/' . $message->getProtocolVersion(); + if (!$message->hasHeader('host')) { + $msg .= "\r\nHost: " . $message->getUri()->getHost(); + } + } elseif ($message instanceof ResponseInterface) { + $msg = 'HTTP/' . $message->getProtocolVersion() . ' ' + . $message->getStatusCode() . ' ' + . $message->getReasonPhrase(); + } else { + throw new \InvalidArgumentException('Unknown message type'); + } + + foreach ($message->getHeaders() as $name => $values) { + $msg .= "\r\n{$name}: " . implode(', ', $values); + } + + return "{$msg}\r\n\r\n" . $message->getBody(); +} + +/** + * Returns a UriInterface for the given value. + * + * This function accepts a string or {@see Psr\Http\Message\UriInterface} and + * returns a UriInterface for the given value. If the value is already a + * `UriInterface`, it is returned as-is. + * + * @param string|UriInterface $uri + * + * @return UriInterface + * @throws \InvalidArgumentException + */ +function uri_for($uri) +{ + if ($uri instanceof UriInterface) { + return $uri; + } elseif (is_string($uri)) { + return new Uri($uri); + } + + throw new \InvalidArgumentException('URI must be a string or UriInterface'); +} + +/** + * Create a new stream based on the input type. + * + * Options is an associative array that can contain the following keys: + * - metadata: Array of custom metadata. + * - size: Size of the stream. + * + * @param resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource Entity body data + * @param array $options Additional options + * + * @return StreamInterface + * @throws \InvalidArgumentException if the $resource arg is not valid. + */ +function stream_for($resource = '', array $options = []) +{ + if (is_scalar($resource)) { + $stream = fopen('php://temp', 'r+'); + if ($resource !== '') { + fwrite($stream, $resource); + fseek($stream, 0); + } + return new Stream($stream, $options); + } + + switch (gettype($resource)) { + case 'resource': + return new Stream($resource, $options); + case 'object': + if ($resource instanceof StreamInterface) { + return $resource; + } elseif ($resource instanceof \Iterator) { + return new PumpStream(function () use ($resource) { + if (!$resource->valid()) { + return false; + } + $result = $resource->current(); + $resource->next(); + return $result; + }, $options); + } elseif (method_exists($resource, '__toString')) { + return stream_for((string) $resource, $options); + } + break; + case 'NULL': + return new Stream(fopen('php://temp', 'r+'), $options); + } + + if (is_callable($resource)) { + return new PumpStream($resource, $options); + } + + throw new \InvalidArgumentException('Invalid resource type: ' . gettype($resource)); +} + +/** + * Parse an array of header values containing ";" separated data into an + * array of associative arrays representing the header key value pair + * data of the header. When a parameter does not contain a value, but just + * contains a key, this function will inject a key with a '' string value. + * + * @param string|array $header Header to parse into components. + * + * @return array Returns the parsed header values. + */ +function parse_header($header) +{ + static $trimmed = "\"' \n\t\r"; + $params = $matches = []; + + foreach (normalize_header($header) as $val) { + $part = []; + foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) { + if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) { + $m = $matches[0]; + if (isset($m[1])) { + $part[trim($m[0], $trimmed)] = trim($m[1], $trimmed); + } else { + $part[] = trim($m[0], $trimmed); + } + } + } + if ($part) { + $params[] = $part; + } + } + + return $params; +} + +/** + * Converts an array of header values that may contain comma separated + * headers into an array of headers with no comma separated values. + * + * @param string|array $header Header to normalize. + * + * @return array Returns the normalized header field values. + */ +function normalize_header($header) +{ + if (!is_array($header)) { + return array_map('trim', explode(',', $header)); + } + + $result = []; + foreach ($header as $value) { + foreach ((array) $value as $v) { + if (strpos($v, ',') === false) { + $result[] = $v; + continue; + } + foreach (preg_split('/,(?=([^"]*"[^"]*")*[^"]*$)/', $v) as $vv) { + $result[] = trim($vv); + } + } + } + + return $result; +} + +/** + * Clone and modify a request with the given changes. + * + * The changes can be one of: + * - method: (string) Changes the HTTP method. + * - set_headers: (array) Sets the given headers. + * - remove_headers: (array) Remove the given headers. + * - body: (mixed) Sets the given body. + * - uri: (UriInterface) Set the URI. + * - query: (string) Set the query string value of the URI. + * - version: (string) Set the protocol version. + * + * @param RequestInterface $request Request to clone and modify. + * @param array $changes Changes to apply. + * + * @return RequestInterface + */ +function modify_request(RequestInterface $request, array $changes) +{ + if (!$changes) { + return $request; + } + + $headers = $request->getHeaders(); + + if (!isset($changes['uri'])) { + $uri = $request->getUri(); + } else { + // Remove the host header if one is on the URI + if ($host = $changes['uri']->getHost()) { + $changes['set_headers']['Host'] = $host; + + if ($port = $changes['uri']->getPort()) { + $standardPorts = ['http' => 80, 'https' => 443]; + $scheme = $changes['uri']->getScheme(); + if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) { + $changes['set_headers']['Host'] .= ':'.$port; + } + } + } + $uri = $changes['uri']; + } + + if (!empty($changes['remove_headers'])) { + $headers = _caseless_remove($changes['remove_headers'], $headers); + } + + if (!empty($changes['set_headers'])) { + $headers = _caseless_remove(array_keys($changes['set_headers']), $headers); + $headers = $changes['set_headers'] + $headers; + } + + if (isset($changes['query'])) { + $uri = $uri->withQuery($changes['query']); + } + + if ($request instanceof ServerRequestInterface) { + return (new ServerRequest( + isset($changes['method']) ? $changes['method'] : $request->getMethod(), + $uri, + $headers, + isset($changes['body']) ? $changes['body'] : $request->getBody(), + isset($changes['version']) + ? $changes['version'] + : $request->getProtocolVersion(), + $request->getServerParams() + )) + ->withParsedBody($request->getParsedBody()) + ->withQueryParams($request->getQueryParams()) + ->withCookieParams($request->getCookieParams()) + ->withUploadedFiles($request->getUploadedFiles()); + } + + return new Request( + isset($changes['method']) ? $changes['method'] : $request->getMethod(), + $uri, + $headers, + isset($changes['body']) ? $changes['body'] : $request->getBody(), + isset($changes['version']) + ? $changes['version'] + : $request->getProtocolVersion() + ); +} + +/** + * Attempts to rewind a message body and throws an exception on failure. + * + * The body of the message will only be rewound if a call to `tell()` returns a + * value other than `0`. + * + * @param MessageInterface $message Message to rewind + * + * @throws \RuntimeException + */ +function rewind_body(MessageInterface $message) +{ + $body = $message->getBody(); + + if ($body->tell()) { + $body->rewind(); + } +} + +/** + * Safely opens a PHP stream resource using a filename. + * + * When fopen fails, PHP normally raises a warning. This function adds an + * error handler that checks for errors and throws an exception instead. + * + * @param string $filename File to open + * @param string $mode Mode used to open the file + * + * @return resource + * @throws \RuntimeException if the file cannot be opened + */ +function try_fopen($filename, $mode) +{ + $ex = null; + set_error_handler(function () use ($filename, $mode, &$ex) { + $ex = new \RuntimeException(sprintf( + 'Unable to open %s using mode %s: %s', + $filename, + $mode, + func_get_args()[1] + )); + }); + + $handle = fopen($filename, $mode); + restore_error_handler(); + + if ($ex) { + /** @var $ex \RuntimeException */ + throw $ex; + } + + return $handle; +} + +/** + * Copy the contents of a stream into a string until the given number of + * bytes have been read. + * + * @param StreamInterface $stream Stream to read + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + * @return string + * @throws \RuntimeException on error. + */ +function copy_to_string(StreamInterface $stream, $maxLen = -1) +{ + $buffer = ''; + + if ($maxLen === -1) { + while (!$stream->eof()) { + $buf = $stream->read(1048576); + // Using a loose equality here to match on '' and false. + if ($buf == null) { + break; + } + $buffer .= $buf; + } + return $buffer; + } + + $len = 0; + while (!$stream->eof() && $len < $maxLen) { + $buf = $stream->read($maxLen - $len); + // Using a loose equality here to match on '' and false. + if ($buf == null) { + break; + } + $buffer .= $buf; + $len = strlen($buffer); + } + + return $buffer; +} + +/** + * Copy the contents of a stream into another stream until the given number + * of bytes have been read. + * + * @param StreamInterface $source Stream to read from + * @param StreamInterface $dest Stream to write to + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + * + * @throws \RuntimeException on error. + */ +function copy_to_stream( + StreamInterface $source, + StreamInterface $dest, + $maxLen = -1 +) { + $bufferSize = 8192; + + if ($maxLen === -1) { + while (!$source->eof()) { + if (!$dest->write($source->read($bufferSize))) { + break; + } + } + } else { + $remaining = $maxLen; + while ($remaining > 0 && !$source->eof()) { + $buf = $source->read(min($bufferSize, $remaining)); + $len = strlen($buf); + if (!$len) { + break; + } + $remaining -= $len; + $dest->write($buf); + } + } +} + +/** + * Calculate a hash of a Stream + * + * @param StreamInterface $stream Stream to calculate the hash for + * @param string $algo Hash algorithm (e.g. md5, crc32, etc) + * @param bool $rawOutput Whether or not to use raw output + * + * @return string Returns the hash of the stream + * @throws \RuntimeException on error. + */ +function hash( + StreamInterface $stream, + $algo, + $rawOutput = false +) { + $pos = $stream->tell(); + + if ($pos > 0) { + $stream->rewind(); + } + + $ctx = hash_init($algo); + while (!$stream->eof()) { + hash_update($ctx, $stream->read(1048576)); + } + + $out = hash_final($ctx, (bool) $rawOutput); + $stream->seek($pos); + + return $out; +} + +/** + * Read a line from the stream up to the maximum allowed buffer length + * + * @param StreamInterface $stream Stream to read from + * @param int $maxLength Maximum buffer length + * + * @return string + */ +function readline(StreamInterface $stream, $maxLength = null) +{ + $buffer = ''; + $size = 0; + + while (!$stream->eof()) { + // Using a loose equality here to match on '' and false. + if (null == ($byte = $stream->read(1))) { + return $buffer; + } + $buffer .= $byte; + // Break when a new line is found or the max length - 1 is reached + if ($byte === "\n" || ++$size === $maxLength - 1) { + break; + } + } + + return $buffer; +} + +/** + * Parses a request message string into a request object. + * + * @param string $message Request message string. + * + * @return Request + */ +function parse_request($message) +{ + $data = _parse_message($message); + $matches = []; + if (!preg_match('/^[\S]+\s+([a-zA-Z]+:\/\/|\/).*/', $data['start-line'], $matches)) { + throw new \InvalidArgumentException('Invalid request string'); + } + $parts = explode(' ', $data['start-line'], 3); + $version = isset($parts[2]) ? explode('/', $parts[2])[1] : '1.1'; + + $request = new Request( + $parts[0], + $matches[1] === '/' ? _parse_request_uri($parts[1], $data['headers']) : $parts[1], + $data['headers'], + $data['body'], + $version + ); + + return $matches[1] === '/' ? $request : $request->withRequestTarget($parts[1]); +} + +/** + * Parses a response message string into a response object. + * + * @param string $message Response message string. + * + * @return Response + */ +function parse_response($message) +{ + $data = _parse_message($message); + // According to https://tools.ietf.org/html/rfc7230#section-3.1.2 the space + // between status-code and reason-phrase is required. But browsers accept + // responses without space and reason as well. + if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) { + throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']); + } + $parts = explode(' ', $data['start-line'], 3); + + return new Response( + $parts[1], + $data['headers'], + $data['body'], + explode('/', $parts[0])[1], + isset($parts[2]) ? $parts[2] : null + ); +} + +/** + * Parse a query string into an associative array. + * + * If multiple values are found for the same key, the value of that key + * value pair will become an array. This function does not parse nested + * PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will + * be parsed into ['foo[a]' => '1', 'foo[b]' => '2']). + * + * @param string $str Query string to parse + * @param int|bool $urlEncoding How the query string is encoded + * + * @return array + */ +function parse_query($str, $urlEncoding = true) +{ + $result = []; + + if ($str === '') { + return $result; + } + + if ($urlEncoding === true) { + $decoder = function ($value) { + return rawurldecode(str_replace('+', ' ', $value)); + }; + } elseif ($urlEncoding === PHP_QUERY_RFC3986) { + $decoder = 'rawurldecode'; + } elseif ($urlEncoding === PHP_QUERY_RFC1738) { + $decoder = 'urldecode'; + } else { + $decoder = function ($str) { return $str; }; + } + + foreach (explode('&', $str) as $kvp) { + $parts = explode('=', $kvp, 2); + $key = $decoder($parts[0]); + $value = isset($parts[1]) ? $decoder($parts[1]) : null; + if (!isset($result[$key])) { + $result[$key] = $value; + } else { + if (!is_array($result[$key])) { + $result[$key] = [$result[$key]]; + } + $result[$key][] = $value; + } + } + + return $result; +} + +/** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of parse_query() to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like http_build_query would). + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + * @return string + */ +function build_query(array $params, $encoding = PHP_QUERY_RFC3986) +{ + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function ($str) { return $str; }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder($k); + if (!is_array($v)) { + $qs .= $k; + if ($v !== null) { + $qs .= '=' . $encoder($v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + if ($vv !== null) { + $qs .= '=' . $encoder($vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; +} + +/** + * Determines the mimetype of a file by looking at its extension. + * + * @param $filename + * + * @return null|string + */ +function mimetype_from_filename($filename) +{ + return mimetype_from_extension(pathinfo($filename, PATHINFO_EXTENSION)); +} + +/** + * Maps a file extensions to a mimetype. + * + * @param $extension string The file extension. + * + * @return string|null + * @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types + */ +function mimetype_from_extension($extension) +{ + static $mimetypes = [ + '3gp' => 'video/3gpp', + '7z' => 'application/x-7z-compressed', + 'aac' => 'audio/x-aac', + 'ai' => 'application/postscript', + 'aif' => 'audio/x-aiff', + 'asc' => 'text/plain', + 'asf' => 'video/x-ms-asf', + 'atom' => 'application/atom+xml', + 'avi' => 'video/x-msvideo', + 'bmp' => 'image/bmp', + 'bz2' => 'application/x-bzip2', + 'cer' => 'application/pkix-cert', + 'crl' => 'application/pkix-crl', + 'crt' => 'application/x-x509-ca-cert', + 'css' => 'text/css', + 'csv' => 'text/csv', + 'cu' => 'application/cu-seeme', + 'deb' => 'application/x-debian-package', + 'doc' => 'application/msword', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'dvi' => 'application/x-dvi', + 'eot' => 'application/vnd.ms-fontobject', + 'eps' => 'application/postscript', + 'epub' => 'application/epub+zip', + 'etx' => 'text/x-setext', + 'flac' => 'audio/flac', + 'flv' => 'video/x-flv', + 'gif' => 'image/gif', + 'gz' => 'application/gzip', + 'htm' => 'text/html', + 'html' => 'text/html', + 'ico' => 'image/x-icon', + 'ics' => 'text/calendar', + 'ini' => 'text/plain', + 'iso' => 'application/x-iso9660-image', + 'jar' => 'application/java-archive', + 'jpe' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpg' => 'image/jpeg', + 'js' => 'text/javascript', + 'json' => 'application/json', + 'latex' => 'application/x-latex', + 'log' => 'text/plain', + 'm4a' => 'audio/mp4', + 'm4v' => 'video/mp4', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mov' => 'video/quicktime', + 'mkv' => 'video/x-matroska', + 'mp3' => 'audio/mpeg', + 'mp4' => 'video/mp4', + 'mp4a' => 'audio/mp4', + 'mp4v' => 'video/mp4', + 'mpe' => 'video/mpeg', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpg4' => 'video/mp4', + 'oga' => 'audio/ogg', + 'ogg' => 'audio/ogg', + 'ogv' => 'video/ogg', + 'ogx' => 'application/ogg', + 'pbm' => 'image/x-portable-bitmap', + 'pdf' => 'application/pdf', + 'pgm' => 'image/x-portable-graymap', + 'png' => 'image/png', + 'pnm' => 'image/x-portable-anymap', + 'ppm' => 'image/x-portable-pixmap', + 'ppt' => 'application/vnd.ms-powerpoint', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'ps' => 'application/postscript', + 'qt' => 'video/quicktime', + 'rar' => 'application/x-rar-compressed', + 'ras' => 'image/x-cmu-raster', + 'rss' => 'application/rss+xml', + 'rtf' => 'application/rtf', + 'sgm' => 'text/sgml', + 'sgml' => 'text/sgml', + 'svg' => 'image/svg+xml', + 'swf' => 'application/x-shockwave-flash', + 'tar' => 'application/x-tar', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'torrent' => 'application/x-bittorrent', + 'ttf' => 'application/x-font-ttf', + 'txt' => 'text/plain', + 'wav' => 'audio/x-wav', + 'webm' => 'video/webm', + 'wma' => 'audio/x-ms-wma', + 'wmv' => 'video/x-ms-wmv', + 'woff' => 'application/x-font-woff', + 'wsdl' => 'application/wsdl+xml', + 'xbm' => 'image/x-xbitmap', + 'xls' => 'application/vnd.ms-excel', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xml' => 'application/xml', + 'xpm' => 'image/x-xpixmap', + 'xwd' => 'image/x-xwindowdump', + 'yaml' => 'text/yaml', + 'yml' => 'text/yaml', + 'zip' => 'application/zip', + ]; + + $extension = strtolower($extension); + + return isset($mimetypes[$extension]) + ? $mimetypes[$extension] + : null; +} + +/** + * Parses an HTTP message into an associative array. + * + * The array contains the "start-line" key containing the start line of + * the message, "headers" key containing an associative array of header + * array values, and a "body" key containing the body of the message. + * + * @param string $message HTTP request or response to parse. + * + * @return array + * @internal + */ +function _parse_message($message) +{ + if (!$message) { + throw new \InvalidArgumentException('Invalid message'); + } + + $message = ltrim($message, "\r\n"); + + $messageParts = preg_split("/\r?\n\r?\n/", $message, 2); + + if ($messageParts === false || count($messageParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing header delimiter'); + } + + list($rawHeaders, $body) = $messageParts; + $rawHeaders .= "\r\n"; // Put back the delimiter we split previously + $headerParts = preg_split("/\r?\n/", $rawHeaders, 2); + + if ($headerParts === false || count($headerParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing status line'); + } + + list($startLine, $rawHeaders) = $headerParts; + + if (preg_match("/(?:^HTTP\/|^[A-Z]+ \S+ HTTP\/)(\d+(?:\.\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') { + // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0 + $rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders); + } + + /** @var array[] $headerLines */ + $count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER); + + // If these aren't the same, then one line didn't match and there's an invalid header. + if ($count !== substr_count($rawHeaders, "\n")) { + // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4 + if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) { + throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding'); + } + + throw new \InvalidArgumentException('Invalid header syntax'); + } + + $headers = []; + + foreach ($headerLines as $headerLine) { + $headers[$headerLine[1]][] = $headerLine[2]; + } + + return [ + 'start-line' => $startLine, + 'headers' => $headers, + 'body' => $body, + ]; +} + +/** + * Constructs a URI for an HTTP request message. + * + * @param string $path Path from the start-line + * @param array $headers Array of headers (each value an array). + * + * @return string + * @internal + */ +function _parse_request_uri($path, array $headers) +{ + $hostKey = array_filter(array_keys($headers), function ($k) { + return strtolower($k) === 'host'; + }); + + // If no host is found, then a full URI cannot be constructed. + if (!$hostKey) { + return $path; + } + + $host = $headers[reset($hostKey)][0]; + $scheme = substr($host, -4) === ':443' ? 'https' : 'http'; + + return $scheme . '://' . $host . '/' . ltrim($path, '/'); +} + +/** + * Get a short summary of the message body + * + * Will return `null` if the response is not printable. + * + * @param MessageInterface $message The message to get the body summary + * @param int $truncateAt The maximum allowed size of the summary + * + * @return null|string + */ +function get_message_body_summary(MessageInterface $message, $truncateAt = 120) +{ + $body = $message->getBody(); + + if (!$body->isSeekable() || !$body->isReadable()) { + return null; + } + + $size = $body->getSize(); + + if ($size === 0) { + return null; + } + + $summary = $body->read($truncateAt); + $body->rewind(); + + if ($size > $truncateAt) { + $summary .= ' (truncated...)'; + } + + // Matches any printable character, including unicode characters: + // letters, marks, numbers, punctuation, spacing, and separators. + if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) { + return null; + } + + return $summary; +} + +/** @internal */ +function _caseless_remove($keys, array $data) +{ + $result = []; + + foreach ($keys as &$key) { + $key = strtolower($key); + } + + foreach ($data as $k => $v) { + if (!in_array(strtolower($k), $keys)) { + $result[$k] = $v; + } + } + + return $result; +} diff --git a/vendor/guzzlehttp/psr7/src/functions_include.php b/vendor/guzzlehttp/psr7/src/functions_include.php new file mode 100644 index 0000000..96a4a83 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/functions_include.php @@ -0,0 +1,6 @@ +ignoringCase()); + +* Fixed Hamcrest_Core_IsInstanceOf to return false for native types. + +* Moved string-based matchers to Hamcrest_Text package. + StringContains, StringEndsWith, StringStartsWith, and SubstringMatcher + +* Hamcrest.php and Hamcrest_Matchers.php are now built from @factory doctags. + Added @factory doctag to every static factory method. + +* Hamcrest_Matchers and Hamcrest.php now import each matcher as-needed + and Hamcrest.php calls the matchers directly instead of Hamcrest_Matchers. + + +== Version 0.3.0: Released Jul 26 2010 == + +* Added running count to Hamcrest_MatcherAssert with methods to get and reset it. + This can be used by unit testing frameworks for reporting. + +* Added Hamcrest_Core_HasToString to assert return value of toString() or __toString(). + + assertThat($anObject, hasToString('foo')); + +* Added Hamcrest_Type_IsScalar to assert is_scalar(). + Matches values of type bool, int, float, double, and string. + + assertThat($count, scalarValue()); + assertThat('foo', scalarValue()); + +* Added Hamcrest_Collection package. + + - IsEmptyTraversable + - IsTraversableWithSize + + assertThat($iterator, emptyTraversable()); + assertThat($iterator, traversableWithSize(5)); + +* Added Hamcrest_Xml_HasXPath to assert XPath expressions or the content of nodes in an XML/HTML DOM. + + assertThat($dom, hasXPath('books/book/title')); + assertThat($dom, hasXPath('books/book[contains(title, "Alice")]', 3)); + assertThat($dom, hasXPath('books/book/title', 'Alice in Wonderland')); + assertThat($dom, hasXPath('count(books/book)', greaterThan(10))); + +* Added aliases to match the Java API. + + hasEntry() -> hasKeyValuePair() + hasValue() -> hasItemInArray() + contains() -> arrayContaining() + containsInAnyOrder() -> arrayContainingInAnyOrder() + +* Added optional subtype to Hamcrest_TypeSafeMatcher to enforce object class or resource type. + +* Hamcrest_TypeSafeDiagnosingMatcher now extends Hamcrest_TypeSafeMatcher. + + +== Version 0.2.0: Released Jul 14 2010 == + +Issues Fixed: 109, 111, 114, 115 + +* Description::appendValues() and appendValueList() accept Iterator and IteratorAggregate. [111] + BaseDescription::appendValue() handles IteratorAggregate. + +* assertThat() accepts a single boolean parameter and + wraps any non-Matcher third parameter with equalTo(). + +* Removed null return value from assertThat(). [114] + +* Fixed wrong variable name in contains(). [109] + +* Added Hamcrest_Core_IsSet to assert isset(). + + assertThat(array('foo' => 'bar'), set('foo')); + assertThat(array('foo' => 'bar'), notSet('bar')); + +* Added Hamcrest_Core_IsTypeOf to assert built-in types with gettype(). [115] + Types: array, boolean, double, integer, null, object, resource, and string. + Note that gettype() returns "double" for float values. + + assertThat($count, typeOf('integer')); + assertThat(3.14159, typeOf('double')); + assertThat(array('foo', 'bar'), typeOf('array')); + assertThat(new stdClass(), typeOf('object')); + +* Added type-specific matchers in new Hamcrest_Type package. + + - IsArray + - IsBoolean + - IsDouble (includes float values) + - IsInteger + - IsObject + - IsResource + - IsString + + assertThat($count, integerValue()); + assertThat(3.14159, floatValue()); + assertThat('foo', stringValue()); + +* Added Hamcrest_Type_IsNumeric to assert is_numeric(). + Matches values of type int and float/double or strings that are formatted as numbers. + + assertThat(5, numericValue()); + assertThat('-5e+3', numericValue()); + +* Added Hamcrest_Type_IsCallable to assert is_callable(). + + assertThat('preg_match', callable()); + assertThat(array('SomeClass', 'SomeMethod'), callable()); + assertThat(array($object, 'SomeMethod'), callable()); + assertThat($object, callable()); + assertThat(function ($x, $y) { return $x + $y; }, callable()); + +* Added Hamcrest_Text_MatchesPattern for regex matching with preg_match(). + + assertThat('foobar', matchesPattern('/o+b/')); + +* Added aliases: + - atLeast() for greaterThanOrEqualTo() + - atMost() for lessThanOrEqualTo() + + +== Version 0.1.0: Released Jul 7 2010 == + +* Created PEAR package + +* Core matchers + diff --git a/vendor/hamcrest/hamcrest-php/LICENSE.txt b/vendor/hamcrest/hamcrest-php/LICENSE.txt new file mode 100644 index 0000000..91cd329 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/LICENSE.txt @@ -0,0 +1,27 @@ +BSD License + +Copyright (c) 2000-2014, www.hamcrest.org +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of Hamcrest nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. diff --git a/vendor/hamcrest/hamcrest-php/README.md b/vendor/hamcrest/hamcrest-php/README.md new file mode 100644 index 0000000..0b07c71 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/README.md @@ -0,0 +1,53 @@ +This is the PHP port of Hamcrest Matchers +========================================= + +[![Build Status](https://travis-ci.org/hamcrest/hamcrest-php.png?branch=master)](https://travis-ci.org/hamcrest/hamcrest-php) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/hamcrest/hamcrest-php/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/hamcrest/hamcrest-php/?branch=master) +[![Code Coverage](https://scrutinizer-ci.com/g/hamcrest/hamcrest-php/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/hamcrest/hamcrest-php/?branch=master) + +Hamcrest is a matching library originally written for Java, but +subsequently ported to many other languages. hamcrest-php is the +official PHP port of Hamcrest and essentially follows a literal +translation of the original Java API for Hamcrest, with a few +Exceptions, mostly down to PHP language barriers: + + 1. `instanceOf($theClass)` is actually `anInstanceOf($theClass)` + + 2. `both(containsString('a'))->and(containsString('b'))` + is actually `both(containsString('a'))->andAlso(containsString('b'))` + + 3. `either(containsString('a'))->or(containsString('b'))` + is actually `either(containsString('a'))->orElse(containsString('b'))` + + 4. Unless it would be non-semantic for a matcher to do so, hamcrest-php + allows dynamic typing for it's input, in "the PHP way". Exception are + where semantics surrounding the type itself would suggest otherwise, + such as stringContains() and greaterThan(). + + 5. Several official matchers have not been ported because they don't + make sense or don't apply in PHP: + + - `typeCompatibleWith($theClass)` + - `eventFrom($source)` + - `hasProperty($name)` ** + - `samePropertyValuesAs($obj)` ** + + 6. When most of the collections matchers are finally ported, PHP-specific + aliases will probably be created due to a difference in naming + conventions between Java's Arrays, Collections, Sets and Maps compared + with PHP's Arrays. + +--- +** [Unless we consider POPO's (Plain Old PHP Objects) akin to JavaBeans] + - The POPO thing is a joke. Java devs coin the term POJO's (Plain Old + Java Objects). + + +Usage +----- + +Hamcrest matchers are easy to use as: + +```php +Hamcrest_MatcherAssert::assertThat('a', Hamcrest_Matchers::equalToIgnoringCase('A')); +``` diff --git a/vendor/hamcrest/hamcrest-php/TODO.txt b/vendor/hamcrest/hamcrest-php/TODO.txt new file mode 100644 index 0000000..92e1190 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/TODO.txt @@ -0,0 +1,22 @@ +Still TODO Before Complete for PHP +---------------------------------- + +Port: + + - Hamcrest_Collection_* + - IsCollectionWithSize + - IsEmptyCollection + - IsIn + - IsTraversableContainingInAnyOrder + - IsTraversableContainingInOrder + - IsMapContaining (aliases) + +Aliasing/Deprecation (questionable): + + - Find and fix any factory methods that start with "is". + +Namespaces: + + - Investigate adding PHP 5.3+ namespace support in a way that still permits + use in PHP 5.2. + - Other than a parallel codebase, I don't see how this could be possible. diff --git a/vendor/hamcrest/hamcrest-php/composer.json b/vendor/hamcrest/hamcrest-php/composer.json new file mode 100644 index 0000000..5349f5f --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/composer.json @@ -0,0 +1,38 @@ +{ + "name": "hamcrest/hamcrest-php", + "type": "library", + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": ["test"], + "license": "BSD", + "authors": [ + ], + + "autoload": { + "classmap": ["hamcrest"] + }, + "autoload-dev": { + "classmap": ["tests", "generator"] + }, + + "require": { + "php": "^5.3|^7.0" + }, + + "require-dev": { + "satooshi/php-coveralls": "^1.0", + "phpunit/php-file-iterator": "1.3.3", + "phpunit/phpunit": "~4.0" + }, + + "replace": { + "kodova/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "cordoval/hamcrest-php": "*" + }, + + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + } +} diff --git a/vendor/hamcrest/hamcrest-php/composer.lock b/vendor/hamcrest/hamcrest-php/composer.lock new file mode 100644 index 0000000..0581a4e --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/composer.lock @@ -0,0 +1,1493 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "52d9e3c2e238bdc2aab7f6e1d322e31d", + "content-hash": "ed113672807f01f40b4d9809b102dc31", + "packages": [], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14 21:17:01" + }, + { + "name": "guzzle/guzzle", + "version": "v3.9.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle3.git", + "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9", + "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3.3", + "symfony/event-dispatcher": "~2.1" + }, + "replace": { + "guzzle/batch": "self.version", + "guzzle/cache": "self.version", + "guzzle/common": "self.version", + "guzzle/http": "self.version", + "guzzle/inflection": "self.version", + "guzzle/iterator": "self.version", + "guzzle/log": "self.version", + "guzzle/parser": "self.version", + "guzzle/plugin": "self.version", + "guzzle/plugin-async": "self.version", + "guzzle/plugin-backoff": "self.version", + "guzzle/plugin-cache": "self.version", + "guzzle/plugin-cookie": "self.version", + "guzzle/plugin-curlauth": "self.version", + "guzzle/plugin-error-response": "self.version", + "guzzle/plugin-history": "self.version", + "guzzle/plugin-log": "self.version", + "guzzle/plugin-md5": "self.version", + "guzzle/plugin-mock": "self.version", + "guzzle/plugin-oauth": "self.version", + "guzzle/service": "self.version", + "guzzle/stream": "self.version" + }, + "require-dev": { + "doctrine/cache": "~1.3", + "monolog/monolog": "~1.0", + "phpunit/phpunit": "3.7.*", + "psr/log": "~1.0", + "symfony/class-loader": "~2.1", + "zendframework/zend-cache": "2.*,<2.3", + "zendframework/zend-log": "2.*,<2.3" + }, + "suggest": { + "guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.9-dev" + } + }, + "autoload": { + "psr-0": { + "Guzzle": "src/", + "Guzzle\\Tests": "tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Guzzle Community", + "homepage": "https://github.com/guzzle/guzzle/contributors" + } + ], + "description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2015-03-18 18:23:50" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "time": "2015-02-03 12:10:50" + }, + { + "name": "phpspec/prophecy", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "phpdocumentor/reflection-docblock": "~2.0", + "sebastian/comparator": "~1.1" + }, + "require-dev": { + "phpspec/phpspec": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2015-08-13 10:07:40" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2015-10-06 15:47:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.3.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "16a78140ed2fc01b945cfa539665fadc6a038029" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/16a78140ed2fc01b945cfa539665fadc6a038029", + "reference": "16a78140ed2fc01b945cfa539665fadc6a038029", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "File/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "http://www.phpunit.de/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2012-10-11 11:44:38" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21 13:50:34" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.7", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2015-06-21 08:01:12" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2015-09-15 10:49:45" + }, + { + "name": "phpunit/phpunit", + "version": "4.5.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d6429b0995b24a2d9dfe5587ee3a7071c1161af4", + "reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpspec/prophecy": "~1.3,>=1.3.1", + "phpunit/php-code-coverage": "~2.0,>=2.0.11", + "phpunit/php-file-iterator": "~1.3.2", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "~1.0.2", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.1", + "sebastian/diff": "~1.1", + "sebastian/environment": "~1.2", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.5.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2015-03-29 09:24:05" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "2.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": ">=5.3.3", + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2015-10-02 06:51:40" + }, + { + "name": "psr/log", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Psr\\Log\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2012-12-21 11:40:51" + }, + { + "name": "satooshi/php-coveralls", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/satooshi/php-coveralls.git", + "reference": "3edbdbdb4f4cfab5cb9ce83655ff81432f2221a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/3edbdbdb4f4cfab5cb9ce83655ff81432f2221a6", + "reference": "3edbdbdb4f4cfab5cb9ce83655ff81432f2221a6", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-simplexml": "*", + "guzzle/guzzle": "^2.8|^3.0", + "php": ">=5.3.3", + "psr/log": "^1.0", + "symfony/config": "^2.4|^3.0", + "symfony/console": "^2.1|^3.0", + "symfony/stopwatch": "^2.2|^3.0", + "symfony/yaml": "^2.1|^3.0" + }, + "suggest": { + "symfony/http-kernel": "Allows Symfony integration" + }, + "bin": [ + "bin/coveralls" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.8-dev" + } + }, + "autoload": { + "psr-4": { + "Satooshi\\": "src/Satooshi/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kitamura Satoshi", + "email": "with.no.parachute@gmail.com", + "homepage": "https://www.facebook.com/satooshi.jp" + } + ], + "description": "PHP client library for Coveralls API", + "homepage": "https://github.com/satooshi/php-coveralls", + "keywords": [ + "ci", + "coverage", + "github", + "test" + ], + "time": "2015-12-28 09:07:32" + }, + { + "name": "sebastian/comparator", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2015-07-26 15:48:44" + }, + { + "name": "sebastian/diff", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2015-12-08 07:14:41" + }, + { + "name": "sebastian/environment", + "version": "1.3.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "6e7133793a8e5a5714a551a8324337374be209df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e7133793a8e5a5714a551a8324337374be209df", + "reference": "6e7133793a8e5a5714a551a8324337374be209df", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2015-12-02 08:37:27" + }, + { + "name": "sebastian/exporter", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2015-06-21 07:55:53" + }, + { + "name": "sebastian/global-state", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2015-10-12 03:26:01" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2015-11-11 19:50:13" + }, + { + "name": "sebastian/version", + "version": "1.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2015-06-21 13:59:46" + }, + { + "name": "symfony/config", + "version": "v2.8.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "17d4b2e64ce1c6ba7caa040f14469b3c44d7f7d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/17d4b2e64ce1c6ba7caa040f14469b3c44d7f7d2", + "reference": "17d4b2e64ce1c6ba7caa040f14469b3c44d7f7d2", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/filesystem": "~2.3|~3.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Config Component", + "homepage": "https://symfony.com", + "time": "2015-12-26 13:37:56" + }, + { + "name": "symfony/console", + "version": "v2.8.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "2e06a5ccb19dcf9b89f1c6a677a39a8df773635a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/2e06a5ccb19dcf9b89f1c6a677a39a8df773635a", + "reference": "2e06a5ccb19dcf9b89f1c6a677a39a8df773635a", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.1|~3.0.0", + "symfony/process": "~2.1|~3.0.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2015-12-22 10:25:57" + }, + { + "name": "symfony/event-dispatcher", + "version": "v2.8.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a5eb815363c0388e83247e7e9853e5dbc14999cc", + "reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.0,>=2.0.5|~3.0.0", + "symfony/dependency-injection": "~2.6|~3.0.0", + "symfony/expression-language": "~2.6|~3.0.0", + "symfony/stopwatch": "~2.3|~3.0.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2015-10-30 20:15:42" + }, + { + "name": "symfony/filesystem", + "version": "v2.8.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "a7ad724530a764d70c168d321ac226ba3d2f10fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/a7ad724530a764d70c168d321ac226ba3d2f10fc", + "reference": "a7ad724530a764d70c168d321ac226ba3d2f10fc", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2015-12-22 10:25:57" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "49ff736bd5d41f45240cec77b44967d76e0c3d25" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/49ff736bd5d41f45240cec77b44967d76e0c3d25", + "reference": "49ff736bd5d41f45240cec77b44967d76e0c3d25", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2015-11-20 09:19:13" + }, + { + "name": "symfony/stopwatch", + "version": "v2.8.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "5f1e2ebd1044da542d2b9510527836e8be92b1cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5f1e2ebd1044da542d2b9510527836e8be92b1cb", + "reference": "5f1e2ebd1044da542d2b9510527836e8be92b1cb", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Stopwatch Component", + "homepage": "https://symfony.com", + "time": "2015-10-30 20:15:42" + }, + { + "name": "symfony/yaml", + "version": "v2.8.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "ac84cbb98b68a6abbc9f5149eb96ccc7b07b8966" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/ac84cbb98b68a6abbc9f5149eb96ccc7b07b8966", + "reference": "ac84cbb98b68a6abbc9f5149eb96ccc7b07b8966", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2015-12-26 13:37:56" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.3.2" + }, + "platform-dev": [] +} diff --git a/vendor/hamcrest/hamcrest-php/generator/FactoryCall.php b/vendor/hamcrest/hamcrest-php/generator/FactoryCall.php new file mode 100644 index 0000000..83965b2 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/FactoryCall.php @@ -0,0 +1,41 @@ +method = $method; + $this->name = $name; + } + + public function getMethod() + { + return $this->method; + } + + public function getName() + { + return $this->name; + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/FactoryClass.php b/vendor/hamcrest/hamcrest-php/generator/FactoryClass.php new file mode 100644 index 0000000..0c6bf78 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/FactoryClass.php @@ -0,0 +1,72 @@ +file = $file; + $this->reflector = $class; + $this->extractFactoryMethods(); + } + + public function extractFactoryMethods() + { + $this->methods = array(); + foreach ($this->getPublicStaticMethods() as $method) { + if ($method->isFactory()) { +// echo $this->getName() . '::' . $method->getName() . ' : ' . count($method->getCalls()) . PHP_EOL; + $this->methods[] = $method; + } + } + } + + public function getPublicStaticMethods() + { + $methods = array(); + foreach ($this->reflector->getMethods(ReflectionMethod::IS_STATIC) as $method) { + if ($method->isPublic() && $method->getDeclaringClass() == $this->reflector) { + $methods[] = new FactoryMethod($this, $method); + } + } + return $methods; + } + + public function getFile() + { + return $this->file; + } + + public function getName() + { + return $this->reflector->name; + } + + public function isFactory() + { + return !empty($this->methods); + } + + public function getMethods() + { + return $this->methods; + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/FactoryFile.php b/vendor/hamcrest/hamcrest-php/generator/FactoryFile.php new file mode 100644 index 0000000..ac3d6c7 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/FactoryFile.php @@ -0,0 +1,122 @@ +file = $file; + $this->indent = $indent; + } + + abstract public function addCall(FactoryCall $call); + + abstract public function build(); + + public function addFileHeader() + { + $this->code = ''; + $this->addPart('file_header'); + } + + public function addPart($name) + { + $this->addCode($this->readPart($name)); + } + + public function addCode($code) + { + $this->code .= $code; + } + + public function readPart($name) + { + return file_get_contents(__DIR__ . "/parts/$name.txt"); + } + + public function generateFactoryCall(FactoryCall $call) + { + $method = $call->getMethod(); + $code = $method->getComment($this->indent) . PHP_EOL; + $code .= $this->generateDeclaration($call->getName(), $method); + // $code .= $this->generateImport($method); + $code .= $this->generateCall($method); + $code .= $this->generateClosing(); + return $code; + } + + public function generateDeclaration($name, FactoryMethod $method) + { + $code = $this->indent . $this->getDeclarationModifiers() + . 'function ' . $name . '(' + . $this->generateDeclarationArguments($method) + . ')' . PHP_EOL . $this->indent . '{' . PHP_EOL; + return $code; + } + + public function getDeclarationModifiers() + { + return ''; + } + + public function generateDeclarationArguments(FactoryMethod $method) + { + if ($method->acceptsVariableArguments()) { + return '/* args... */'; + } else { + return $method->getParameterDeclarations(); + } + } + + public function generateImport(FactoryMethod $method) + { + return $this->indent . self::INDENT . "require_once '" . $method->getClass()->getFile() . "';" . PHP_EOL; + } + + public function generateCall(FactoryMethod $method) + { + $code = ''; + if ($method->acceptsVariableArguments()) { + $code .= $this->indent . self::INDENT . '$args = func_get_args();' . PHP_EOL; + } + + $code .= $this->indent . self::INDENT . 'return '; + if ($method->acceptsVariableArguments()) { + $code .= 'call_user_func_array(array(\'' + . '\\' . $method->getClassName() . '\', \'' + . $method->getName() . '\'), $args);' . PHP_EOL; + } else { + $code .= '\\' . $method->getClassName() . '::' + . $method->getName() . '(' + . $method->getParameterInvocations() . ');' . PHP_EOL; + } + + return $code; + } + + public function generateClosing() + { + return $this->indent . '}' . PHP_EOL; + } + + public function write() + { + file_put_contents($this->file, $this->code); + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/FactoryGenerator.php b/vendor/hamcrest/hamcrest-php/generator/FactoryGenerator.php new file mode 100644 index 0000000..37f80b6 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/FactoryGenerator.php @@ -0,0 +1,115 @@ +path = $path; + $this->factoryFiles = array(); + } + + public function addFactoryFile(FactoryFile $factoryFile) + { + $this->factoryFiles[] = $factoryFile; + } + + public function generate() + { + $classes = $this->getClassesWithFactoryMethods(); + foreach ($classes as $class) { + foreach ($class->getMethods() as $method) { + foreach ($method->getCalls() as $call) { + foreach ($this->factoryFiles as $file) { + $file->addCall($call); + } + } + } + } + } + + public function write() + { + foreach ($this->factoryFiles as $file) { + $file->build(); + $file->write(); + } + } + + public function getClassesWithFactoryMethods() + { + $classes = array(); + $files = $this->getSortedFiles(); + foreach ($files as $file) { + $class = $this->getFactoryClass($file); + if ($class !== null) { + $classes[] = $class; + } + } + + return $classes; + } + + public function getSortedFiles() + { + $iter = \File_Iterator_Factory::getFileIterator($this->path, '.php'); + $files = array(); + foreach ($iter as $file) { + $files[] = $file; + } + sort($files, SORT_STRING); + + return $files; + } + + public function getFactoryClass($file) + { + $name = $this->getFactoryClassName($file); + if ($name !== null) { + require_once $file; + + if (class_exists($name)) { + $class = new FactoryClass(substr($file, strpos($file, 'Hamcrest/')), new ReflectionClass($name)); + if ($class->isFactory()) { + return $class; + } + } + } + + return null; + } + + public function getFactoryClassName($file) + { + $content = file_get_contents($file); + if (preg_match('/namespace\s+(.+);/', $content, $namespace) + && preg_match('/\n\s*class\s+(\w+)\s+extends\b/', $content, $className) + && preg_match('/@factory\b/', $content) + ) { + return $namespace[1] . '\\' . $className[1]; + } + + return null; + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/FactoryMethod.php b/vendor/hamcrest/hamcrest-php/generator/FactoryMethod.php new file mode 100644 index 0000000..44f8dc5 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/FactoryMethod.php @@ -0,0 +1,231 @@ +class = $class; + $this->reflector = $reflector; + $this->extractCommentWithoutLeadingShashesAndStars(); + $this->extractFactoryNamesFromComment(); + $this->extractParameters(); + } + + public function extractCommentWithoutLeadingShashesAndStars() + { + $this->comment = explode("\n", $this->reflector->getDocComment()); + foreach ($this->comment as &$line) { + $line = preg_replace('#^\s*(/\\*+|\\*+/|\\*)\s?#', '', $line); + } + $this->trimLeadingBlankLinesFromComment(); + $this->trimTrailingBlankLinesFromComment(); + } + + public function trimLeadingBlankLinesFromComment() + { + while (count($this->comment) > 0) { + $line = array_shift($this->comment); + if (trim($line) != '') { + array_unshift($this->comment, $line); + break; + } + } + } + + public function trimTrailingBlankLinesFromComment() + { + while (count($this->comment) > 0) { + $line = array_pop($this->comment); + if (trim($line) != '') { + array_push($this->comment, $line); + break; + } + } + } + + public function extractFactoryNamesFromComment() + { + $this->calls = array(); + for ($i = 0; $i < count($this->comment); $i++) { + if ($this->extractFactoryNamesFromLine($this->comment[$i])) { + unset($this->comment[$i]); + } + } + $this->trimTrailingBlankLinesFromComment(); + } + + public function extractFactoryNamesFromLine($line) + { + if (preg_match('/^\s*@factory(\s+(.+))?$/', $line, $match)) { + $this->createCalls( + $this->extractFactoryNamesFromAnnotation( + isset($match[2]) ? trim($match[2]) : null + ) + ); + return true; + } + return false; + } + + public function extractFactoryNamesFromAnnotation($value) + { + $primaryName = $this->reflector->getName(); + if (empty($value)) { + return array($primaryName); + } + preg_match_all('/(\.{3}|-|[a-zA-Z_][a-zA-Z_0-9]*)/', $value, $match); + $names = $match[0]; + if (in_array('...', $names)) { + $this->isVarArgs = true; + } + if (!in_array('-', $names) && !in_array($primaryName, $names)) { + array_unshift($names, $primaryName); + } + return $names; + } + + public function createCalls(array $names) + { + $names = array_unique($names); + foreach ($names as $name) { + if ($name != '-' && $name != '...') { + $this->calls[] = new FactoryCall($this, $name); + } + } + } + + public function extractParameters() + { + $this->parameters = array(); + if (!$this->isVarArgs) { + foreach ($this->reflector->getParameters() as $parameter) { + $this->parameters[] = new FactoryParameter($this, $parameter); + } + } + } + + public function getParameterDeclarations() + { + if ($this->isVarArgs || !$this->hasParameters()) { + return ''; + } + $params = array(); + foreach ($this->parameters as /** @var $parameter FactoryParameter */ + $parameter) { + $params[] = $parameter->getDeclaration(); + } + return implode(', ', $params); + } + + public function getParameterInvocations() + { + if ($this->isVarArgs) { + return ''; + } + $params = array(); + foreach ($this->parameters as $parameter) { + $params[] = $parameter->getInvocation(); + } + return implode(', ', $params); + } + + + public function getClass() + { + return $this->class; + } + + public function getClassName() + { + return $this->class->getName(); + } + + public function getName() + { + return $this->reflector->name; + } + + public function isFactory() + { + return count($this->calls) > 0; + } + + public function getCalls() + { + return $this->calls; + } + + public function acceptsVariableArguments() + { + return $this->isVarArgs; + } + + public function hasParameters() + { + return !empty($this->parameters); + } + + public function getParameters() + { + return $this->parameters; + } + + public function getFullName() + { + return $this->getClassName() . '::' . $this->getName(); + } + + public function getCommentText() + { + return implode(PHP_EOL, $this->comment); + } + + public function getComment($indent = '') + { + $comment = $indent . '/**'; + foreach ($this->comment as $line) { + $comment .= PHP_EOL . rtrim($indent . ' * ' . $line); + } + $comment .= PHP_EOL . $indent . ' */'; + return $comment; + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/FactoryParameter.php b/vendor/hamcrest/hamcrest-php/generator/FactoryParameter.php new file mode 100644 index 0000000..93a76b3 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/FactoryParameter.php @@ -0,0 +1,69 @@ +method = $method; + $this->reflector = $reflector; + } + + public function getDeclaration() + { + if ($this->reflector->isArray()) { + $code = 'array '; + } else { + $class = $this->reflector->getClass(); + if ($class !== null) { + $code = '\\' . $class->name . ' '; + } else { + $code = ''; + } + } + $code .= '$' . $this->reflector->name; + if ($this->reflector->isOptional()) { + $default = $this->reflector->getDefaultValue(); + if (is_null($default)) { + $default = 'null'; + } elseif (is_bool($default)) { + $default = $default ? 'true' : 'false'; + } elseif (is_string($default)) { + $default = "'" . $default . "'"; + } elseif (is_numeric($default)) { + $default = strval($default); + } elseif (is_array($default)) { + $default = 'array()'; + } else { + echo 'Warning: unknown default type for ' . $this->getMethod()->getFullName() . PHP_EOL; + var_dump($default); + $default = 'null'; + } + $code .= ' = ' . $default; + } + return $code; + } + + public function getInvocation() + { + return '$' . $this->reflector->name; + } + + public function getMethod() + { + return $this->method; + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/GlobalFunctionFile.php b/vendor/hamcrest/hamcrest-php/generator/GlobalFunctionFile.php new file mode 100644 index 0000000..5ee1b69 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/GlobalFunctionFile.php @@ -0,0 +1,42 @@ +functions = ''; + } + + public function addCall(FactoryCall $call) + { + $this->functions .= PHP_EOL . $this->generateFactoryCall($call); + } + + public function build() + { + $this->addFileHeader(); + $this->addPart('functions_imports'); + $this->addPart('functions_header'); + $this->addCode($this->functions); + $this->addPart('functions_footer'); + } + + public function generateFactoryCall(FactoryCall $call) + { + $code = "if (!function_exists('{$call->getName()}')) {"; + $code.= parent::generateFactoryCall($call); + $code.= "}\n"; + + return $code; + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/StaticMethodFile.php b/vendor/hamcrest/hamcrest-php/generator/StaticMethodFile.php new file mode 100644 index 0000000..44cec02 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/StaticMethodFile.php @@ -0,0 +1,38 @@ +methods = ''; + } + + public function addCall(FactoryCall $call) + { + $this->methods .= PHP_EOL . $this->generateFactoryCall($call); + } + + public function getDeclarationModifiers() + { + return 'public static '; + } + + public function build() + { + $this->addFileHeader(); + $this->addPart('matchers_imports'); + $this->addPart('matchers_header'); + $this->addCode($this->methods); + $this->addPart('matchers_footer'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/parts/file_header.txt b/vendor/hamcrest/hamcrest-php/generator/parts/file_header.txt new file mode 100644 index 0000000..7b352e4 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/parts/file_header.txt @@ -0,0 +1,7 @@ + + * //With an identifier + * assertThat("assertion identifier", $apple->flavour(), equalTo("tasty")); + * //Without an identifier + * assertThat($apple->flavour(), equalTo("tasty")); + * //Evaluating a boolean expression + * assertThat("some error", $a > $b); + * + */ + function assertThat() + { + $args = func_get_args(); + call_user_func_array( + array('Hamcrest\MatcherAssert', 'assertThat'), + $args + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/generator/parts/functions_imports.txt b/vendor/hamcrest/hamcrest-php/generator/parts/functions_imports.txt new file mode 100644 index 0000000..e69de29 diff --git a/vendor/hamcrest/hamcrest-php/generator/parts/matchers_footer.txt b/vendor/hamcrest/hamcrest-php/generator/parts/matchers_footer.txt new file mode 100644 index 0000000..5c34318 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/parts/matchers_footer.txt @@ -0,0 +1 @@ +} diff --git a/vendor/hamcrest/hamcrest-php/generator/parts/matchers_header.txt b/vendor/hamcrest/hamcrest-php/generator/parts/matchers_header.txt new file mode 100644 index 0000000..4f8bb2b --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/parts/matchers_header.txt @@ -0,0 +1,7 @@ + + +/** + * A series of static factories for all hamcrest matchers. + */ +class Matchers +{ diff --git a/vendor/hamcrest/hamcrest-php/generator/parts/matchers_imports.txt b/vendor/hamcrest/hamcrest-php/generator/parts/matchers_imports.txt new file mode 100644 index 0000000..7dd6849 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/parts/matchers_imports.txt @@ -0,0 +1,2 @@ + +namespace Hamcrest; \ No newline at end of file diff --git a/vendor/hamcrest/hamcrest-php/generator/run.php b/vendor/hamcrest/hamcrest-php/generator/run.php new file mode 100644 index 0000000..924d752 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/generator/run.php @@ -0,0 +1,37 @@ +addFactoryFile(new StaticMethodFile(STATIC_MATCHERS_FILE)); +$generator->addFactoryFile(new GlobalFunctionFile(GLOBAL_FUNCTIONS_FILE)); +$generator->generate(); +$generator->write(); diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php new file mode 100644 index 0000000..8a719eb --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php @@ -0,0 +1,805 @@ + + * //With an identifier + * assertThat("assertion identifier", $apple->flavour(), equalTo("tasty")); + * //Without an identifier + * assertThat($apple->flavour(), equalTo("tasty")); + * //Evaluating a boolean expression + * assertThat("some error", $a > $b); + * + */ + function assertThat() + { + $args = func_get_args(); + call_user_func_array( + array('Hamcrest\MatcherAssert', 'assertThat'), + $args + ); + } +} + +if (!function_exists('anArray')) { /** + * Evaluates to true only if each $matcher[$i] is satisfied by $array[$i]. + */ + function anArray(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Arrays\IsArray', 'anArray'), $args); + } +} + +if (!function_exists('hasItemInArray')) { /** + * Evaluates to true if any item in an array satisfies the given matcher. + * + * @param mixed $item as a {@link Hamcrest\Matcher} or a value. + * + * @return \Hamcrest\Arrays\IsArrayContaining + */ + function hasItemInArray($item) + { + return \Hamcrest\Arrays\IsArrayContaining::hasItemInArray($item); + } +} + +if (!function_exists('hasValue')) { /** + * Evaluates to true if any item in an array satisfies the given matcher. + * + * @param mixed $item as a {@link Hamcrest\Matcher} or a value. + * + * @return \Hamcrest\Arrays\IsArrayContaining + */ + function hasValue($item) + { + return \Hamcrest\Arrays\IsArrayContaining::hasItemInArray($item); + } +} + +if (!function_exists('arrayContainingInAnyOrder')) { /** + * An array with elements that match the given matchers. + */ + function arrayContainingInAnyOrder(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args); + } +} + +if (!function_exists('containsInAnyOrder')) { /** + * An array with elements that match the given matchers. + */ + function containsInAnyOrder(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args); + } +} + +if (!function_exists('arrayContaining')) { /** + * An array with elements that match the given matchers in the same order. + */ + function arrayContaining(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', 'arrayContaining'), $args); + } +} + +if (!function_exists('contains')) { /** + * An array with elements that match the given matchers in the same order. + */ + function contains(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', 'arrayContaining'), $args); + } +} + +if (!function_exists('hasKeyInArray')) { /** + * Evaluates to true if any key in an array matches the given matcher. + * + * @param mixed $key as a {@link Hamcrest\Matcher} or a value. + * + * @return \Hamcrest\Arrays\IsArrayContainingKey + */ + function hasKeyInArray($key) + { + return \Hamcrest\Arrays\IsArrayContainingKey::hasKeyInArray($key); + } +} + +if (!function_exists('hasKey')) { /** + * Evaluates to true if any key in an array matches the given matcher. + * + * @param mixed $key as a {@link Hamcrest\Matcher} or a value. + * + * @return \Hamcrest\Arrays\IsArrayContainingKey + */ + function hasKey($key) + { + return \Hamcrest\Arrays\IsArrayContainingKey::hasKeyInArray($key); + } +} + +if (!function_exists('hasKeyValuePair')) { /** + * Test if an array has both an key and value in parity with each other. + */ + function hasKeyValuePair($key, $value) + { + return \Hamcrest\Arrays\IsArrayContainingKeyValuePair::hasKeyValuePair($key, $value); + } +} + +if (!function_exists('hasEntry')) { /** + * Test if an array has both an key and value in parity with each other. + */ + function hasEntry($key, $value) + { + return \Hamcrest\Arrays\IsArrayContainingKeyValuePair::hasKeyValuePair($key, $value); + } +} + +if (!function_exists('arrayWithSize')) { /** + * Does array size satisfy a given matcher? + * + * @param \Hamcrest\Matcher|int $size as a {@link Hamcrest\Matcher} or a value. + * + * @return \Hamcrest\Arrays\IsArrayWithSize + */ + function arrayWithSize($size) + { + return \Hamcrest\Arrays\IsArrayWithSize::arrayWithSize($size); + } +} + +if (!function_exists('emptyArray')) { /** + * Matches an empty array. + */ + function emptyArray() + { + return \Hamcrest\Arrays\IsArrayWithSize::emptyArray(); + } +} + +if (!function_exists('nonEmptyArray')) { /** + * Matches an empty array. + */ + function nonEmptyArray() + { + return \Hamcrest\Arrays\IsArrayWithSize::nonEmptyArray(); + } +} + +if (!function_exists('emptyTraversable')) { /** + * Returns true if traversable is empty. + */ + function emptyTraversable() + { + return \Hamcrest\Collection\IsEmptyTraversable::emptyTraversable(); + } +} + +if (!function_exists('nonEmptyTraversable')) { /** + * Returns true if traversable is not empty. + */ + function nonEmptyTraversable() + { + return \Hamcrest\Collection\IsEmptyTraversable::nonEmptyTraversable(); + } +} + +if (!function_exists('traversableWithSize')) { /** + * Does traversable size satisfy a given matcher? + */ + function traversableWithSize($size) + { + return \Hamcrest\Collection\IsTraversableWithSize::traversableWithSize($size); + } +} + +if (!function_exists('allOf')) { /** + * Evaluates to true only if ALL of the passed in matchers evaluate to true. + */ + function allOf(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\AllOf', 'allOf'), $args); + } +} + +if (!function_exists('anyOf')) { /** + * Evaluates to true if ANY of the passed in matchers evaluate to true. + */ + function anyOf(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\AnyOf', 'anyOf'), $args); + } +} + +if (!function_exists('noneOf')) { /** + * Evaluates to false if ANY of the passed in matchers evaluate to true. + */ + function noneOf(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\AnyOf', 'noneOf'), $args); + } +} + +if (!function_exists('both')) { /** + * This is useful for fluently combining matchers that must both pass. + * For example: + *
+     *   assertThat($string, both(containsString("a"))->andAlso(containsString("b")));
+     * 
+ */ + function both(\Hamcrest\Matcher $matcher) + { + return \Hamcrest\Core\CombinableMatcher::both($matcher); + } +} + +if (!function_exists('either')) { /** + * This is useful for fluently combining matchers where either may pass, + * for example: + *
+     *   assertThat($string, either(containsString("a"))->orElse(containsString("b")));
+     * 
+ */ + function either(\Hamcrest\Matcher $matcher) + { + return \Hamcrest\Core\CombinableMatcher::either($matcher); + } +} + +if (!function_exists('describedAs')) { /** + * Wraps an existing matcher and overrides the description when it fails. + */ + function describedAs(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\DescribedAs', 'describedAs'), $args); + } +} + +if (!function_exists('everyItem')) { /** + * @param Matcher $itemMatcher + * A matcher to apply to every element in an array. + * + * @return \Hamcrest\Core\Every + * Evaluates to TRUE for a collection in which every item matches $itemMatcher + */ + function everyItem(\Hamcrest\Matcher $itemMatcher) + { + return \Hamcrest\Core\Every::everyItem($itemMatcher); + } +} + +if (!function_exists('hasToString')) { /** + * Does array size satisfy a given matcher? + */ + function hasToString($matcher) + { + return \Hamcrest\Core\HasToString::hasToString($matcher); + } +} + +if (!function_exists('is')) { /** + * Decorates another Matcher, retaining the behavior but allowing tests + * to be slightly more expressive. + * + * For example: assertThat($cheese, equalTo($smelly)) + * vs. assertThat($cheese, is(equalTo($smelly))) + */ + function is($value) + { + return \Hamcrest\Core\Is::is($value); + } +} + +if (!function_exists('anything')) { /** + * This matcher always evaluates to true. + * + * @param string $description A meaningful string used when describing itself. + * + * @return \Hamcrest\Core\IsAnything + */ + function anything($description = 'ANYTHING') + { + return \Hamcrest\Core\IsAnything::anything($description); + } +} + +if (!function_exists('hasItem')) { /** + * Test if the value is an array containing this matcher. + * + * Example: + *
+     * assertThat(array('a', 'b'), hasItem(equalTo('b')));
+     * //Convenience defaults to equalTo()
+     * assertThat(array('a', 'b'), hasItem('b'));
+     * 
+ */ + function hasItem(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItem'), $args); + } +} + +if (!function_exists('hasItems')) { /** + * Test if the value is an array containing elements that match all of these + * matchers. + * + * Example: + *
+     * assertThat(array('a', 'b', 'c'), hasItems(equalTo('a'), equalTo('b')));
+     * 
+ */ + function hasItems(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItems'), $args); + } +} + +if (!function_exists('equalTo')) { /** + * Is the value equal to another value, as tested by the use of the "==" + * comparison operator? + */ + function equalTo($item) + { + return \Hamcrest\Core\IsEqual::equalTo($item); + } +} + +if (!function_exists('identicalTo')) { /** + * Tests of the value is identical to $value as tested by the "===" operator. + */ + function identicalTo($value) + { + return \Hamcrest\Core\IsIdentical::identicalTo($value); + } +} + +if (!function_exists('anInstanceOf')) { /** + * Is the value an instance of a particular type? + * This version assumes no relationship between the required type and + * the signature of the method that sets it up, for example in + * assertThat($anObject, anInstanceOf('Thing')); + */ + function anInstanceOf($theClass) + { + return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass); + } +} + +if (!function_exists('any')) { /** + * Is the value an instance of a particular type? + * This version assumes no relationship between the required type and + * the signature of the method that sets it up, for example in + * assertThat($anObject, anInstanceOf('Thing')); + */ + function any($theClass) + { + return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass); + } +} + +if (!function_exists('not')) { /** + * Matches if value does not match $value. + */ + function not($value) + { + return \Hamcrest\Core\IsNot::not($value); + } +} + +if (!function_exists('nullValue')) { /** + * Matches if value is null. + */ + function nullValue() + { + return \Hamcrest\Core\IsNull::nullValue(); + } +} + +if (!function_exists('notNullValue')) { /** + * Matches if value is not null. + */ + function notNullValue() + { + return \Hamcrest\Core\IsNull::notNullValue(); + } +} + +if (!function_exists('sameInstance')) { /** + * Creates a new instance of IsSame. + * + * @param mixed $object + * The predicate evaluates to true only when the argument is + * this object. + * + * @return \Hamcrest\Core\IsSame + */ + function sameInstance($object) + { + return \Hamcrest\Core\IsSame::sameInstance($object); + } +} + +if (!function_exists('typeOf')) { /** + * Is the value a particular built-in type? + */ + function typeOf($theType) + { + return \Hamcrest\Core\IsTypeOf::typeOf($theType); + } +} + +if (!function_exists('set')) { /** + * Matches if value (class, object, or array) has named $property. + */ + function set($property) + { + return \Hamcrest\Core\Set::set($property); + } +} + +if (!function_exists('notSet')) { /** + * Matches if value (class, object, or array) does not have named $property. + */ + function notSet($property) + { + return \Hamcrest\Core\Set::notSet($property); + } +} + +if (!function_exists('closeTo')) { /** + * Matches if value is a number equal to $value within some range of + * acceptable error $delta. + */ + function closeTo($value, $delta) + { + return \Hamcrest\Number\IsCloseTo::closeTo($value, $delta); + } +} + +if (!function_exists('comparesEqualTo')) { /** + * The value is not > $value, nor < $value. + */ + function comparesEqualTo($value) + { + return \Hamcrest\Number\OrderingComparison::comparesEqualTo($value); + } +} + +if (!function_exists('greaterThan')) { /** + * The value is > $value. + */ + function greaterThan($value) + { + return \Hamcrest\Number\OrderingComparison::greaterThan($value); + } +} + +if (!function_exists('greaterThanOrEqualTo')) { /** + * The value is >= $value. + */ + function greaterThanOrEqualTo($value) + { + return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value); + } +} + +if (!function_exists('atLeast')) { /** + * The value is >= $value. + */ + function atLeast($value) + { + return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value); + } +} + +if (!function_exists('lessThan')) { /** + * The value is < $value. + */ + function lessThan($value) + { + return \Hamcrest\Number\OrderingComparison::lessThan($value); + } +} + +if (!function_exists('lessThanOrEqualTo')) { /** + * The value is <= $value. + */ + function lessThanOrEqualTo($value) + { + return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value); + } +} + +if (!function_exists('atMost')) { /** + * The value is <= $value. + */ + function atMost($value) + { + return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value); + } +} + +if (!function_exists('isEmptyString')) { /** + * Matches if value is a zero-length string. + */ + function isEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyString(); + } +} + +if (!function_exists('emptyString')) { /** + * Matches if value is a zero-length string. + */ + function emptyString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyString(); + } +} + +if (!function_exists('isEmptyOrNullString')) { /** + * Matches if value is null or a zero-length string. + */ + function isEmptyOrNullString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString(); + } +} + +if (!function_exists('nullOrEmptyString')) { /** + * Matches if value is null or a zero-length string. + */ + function nullOrEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString(); + } +} + +if (!function_exists('isNonEmptyString')) { /** + * Matches if value is a non-zero-length string. + */ + function isNonEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isNonEmptyString(); + } +} + +if (!function_exists('nonEmptyString')) { /** + * Matches if value is a non-zero-length string. + */ + function nonEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isNonEmptyString(); + } +} + +if (!function_exists('equalToIgnoringCase')) { /** + * Matches if value is a string equal to $string, regardless of the case. + */ + function equalToIgnoringCase($string) + { + return \Hamcrest\Text\IsEqualIgnoringCase::equalToIgnoringCase($string); + } +} + +if (!function_exists('equalToIgnoringWhiteSpace')) { /** + * Matches if value is a string equal to $string, regardless of whitespace. + */ + function equalToIgnoringWhiteSpace($string) + { + return \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace($string); + } +} + +if (!function_exists('matchesPattern')) { /** + * Matches if value is a string that matches regular expression $pattern. + */ + function matchesPattern($pattern) + { + return \Hamcrest\Text\MatchesPattern::matchesPattern($pattern); + } +} + +if (!function_exists('containsString')) { /** + * Matches if value is a string that contains $substring. + */ + function containsString($substring) + { + return \Hamcrest\Text\StringContains::containsString($substring); + } +} + +if (!function_exists('containsStringIgnoringCase')) { /** + * Matches if value is a string that contains $substring regardless of the case. + */ + function containsStringIgnoringCase($substring) + { + return \Hamcrest\Text\StringContainsIgnoringCase::containsStringIgnoringCase($substring); + } +} + +if (!function_exists('stringContainsInOrder')) { /** + * Matches if value contains $substrings in a constrained order. + */ + function stringContainsInOrder(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Text\StringContainsInOrder', 'stringContainsInOrder'), $args); + } +} + +if (!function_exists('endsWith')) { /** + * Matches if value is a string that ends with $substring. + */ + function endsWith($substring) + { + return \Hamcrest\Text\StringEndsWith::endsWith($substring); + } +} + +if (!function_exists('startsWith')) { /** + * Matches if value is a string that starts with $substring. + */ + function startsWith($substring) + { + return \Hamcrest\Text\StringStartsWith::startsWith($substring); + } +} + +if (!function_exists('arrayValue')) { /** + * Is the value an array? + */ + function arrayValue() + { + return \Hamcrest\Type\IsArray::arrayValue(); + } +} + +if (!function_exists('booleanValue')) { /** + * Is the value a boolean? + */ + function booleanValue() + { + return \Hamcrest\Type\IsBoolean::booleanValue(); + } +} + +if (!function_exists('boolValue')) { /** + * Is the value a boolean? + */ + function boolValue() + { + return \Hamcrest\Type\IsBoolean::booleanValue(); + } +} + +if (!function_exists('callableValue')) { /** + * Is the value callable? + */ + function callableValue() + { + return \Hamcrest\Type\IsCallable::callableValue(); + } +} + +if (!function_exists('doubleValue')) { /** + * Is the value a float/double? + */ + function doubleValue() + { + return \Hamcrest\Type\IsDouble::doubleValue(); + } +} + +if (!function_exists('floatValue')) { /** + * Is the value a float/double? + */ + function floatValue() + { + return \Hamcrest\Type\IsDouble::doubleValue(); + } +} + +if (!function_exists('integerValue')) { /** + * Is the value an integer? + */ + function integerValue() + { + return \Hamcrest\Type\IsInteger::integerValue(); + } +} + +if (!function_exists('intValue')) { /** + * Is the value an integer? + */ + function intValue() + { + return \Hamcrest\Type\IsInteger::integerValue(); + } +} + +if (!function_exists('numericValue')) { /** + * Is the value a numeric? + */ + function numericValue() + { + return \Hamcrest\Type\IsNumeric::numericValue(); + } +} + +if (!function_exists('objectValue')) { /** + * Is the value an object? + */ + function objectValue() + { + return \Hamcrest\Type\IsObject::objectValue(); + } +} + +if (!function_exists('anObject')) { /** + * Is the value an object? + */ + function anObject() + { + return \Hamcrest\Type\IsObject::objectValue(); + } +} + +if (!function_exists('resourceValue')) { /** + * Is the value a resource? + */ + function resourceValue() + { + return \Hamcrest\Type\IsResource::resourceValue(); + } +} + +if (!function_exists('scalarValue')) { /** + * Is the value a scalar (boolean, integer, double, or string)? + */ + function scalarValue() + { + return \Hamcrest\Type\IsScalar::scalarValue(); + } +} + +if (!function_exists('stringValue')) { /** + * Is the value a string? + */ + function stringValue() + { + return \Hamcrest\Type\IsString::stringValue(); + } +} + +if (!function_exists('hasXPath')) { /** + * Wraps $matcher with {@link Hamcrest\Core\IsEqual) + * if it's not a matcher and the XPath in count() + * if it's an integer. + */ + function hasXPath($xpath, $matcher = null) + { + return \Hamcrest\Xml\HasXPath::hasXPath($xpath, $matcher); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArray.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArray.php new file mode 100644 index 0000000..9ea5697 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArray.php @@ -0,0 +1,118 @@ +_elementMatchers = $elementMatchers; + } + + protected function matchesSafely($array) + { + if (array_keys($array) != array_keys($this->_elementMatchers)) { + return false; + } + + /** @var $matcher \Hamcrest\Matcher */ + foreach ($this->_elementMatchers as $k => $matcher) { + if (!$matcher->matches($array[$k])) { + return false; + } + } + + return true; + } + + protected function describeMismatchSafely($actual, Description $mismatchDescription) + { + if (count($actual) != count($this->_elementMatchers)) { + $mismatchDescription->appendText('array length was ' . count($actual)); + + return; + } elseif (array_keys($actual) != array_keys($this->_elementMatchers)) { + $mismatchDescription->appendText('array keys were ') + ->appendValueList( + $this->descriptionStart(), + $this->descriptionSeparator(), + $this->descriptionEnd(), + array_keys($actual) + ) + ; + + return; + } + + /** @var $matcher \Hamcrest\Matcher */ + foreach ($this->_elementMatchers as $k => $matcher) { + if (!$matcher->matches($actual[$k])) { + $mismatchDescription->appendText('element ')->appendValue($k) + ->appendText(' was ')->appendValue($actual[$k]); + + return; + } + } + } + + public function describeTo(Description $description) + { + $description->appendList( + $this->descriptionStart(), + $this->descriptionSeparator(), + $this->descriptionEnd(), + $this->_elementMatchers + ); + } + + /** + * Evaluates to true only if each $matcher[$i] is satisfied by $array[$i]. + * + * @factory ... + */ + public static function anArray(/* args... */) + { + $args = func_get_args(); + + return new self(Util::createMatcherArray($args)); + } + + // -- Protected Methods + + protected function descriptionStart() + { + return '['; + } + + protected function descriptionSeparator() + { + return ', '; + } + + protected function descriptionEnd() + { + return ']'; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContaining.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContaining.php new file mode 100644 index 0000000..0e4a1ed --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContaining.php @@ -0,0 +1,63 @@ +_elementMatcher = $elementMatcher; + } + + protected function matchesSafely($array) + { + foreach ($array as $element) { + if ($this->_elementMatcher->matches($element)) { + return true; + } + } + + return false; + } + + protected function describeMismatchSafely($array, Description $mismatchDescription) + { + $mismatchDescription->appendText('was ')->appendValue($array); + } + + public function describeTo(Description $description) + { + $description + ->appendText('an array containing ') + ->appendDescriptionOf($this->_elementMatcher) + ; + } + + /** + * Evaluates to true if any item in an array satisfies the given matcher. + * + * @param mixed $item as a {@link Hamcrest\Matcher} or a value. + * + * @return \Hamcrest\Arrays\IsArrayContaining + * @factory hasValue + */ + public static function hasItemInArray($item) + { + return new self(Util::wrapValueWithIsEqual($item)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php new file mode 100644 index 0000000..9009026 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInAnyOrder.php @@ -0,0 +1,59 @@ +_elementMatchers = $elementMatchers; + } + + protected function matchesSafelyWithDiagnosticDescription($array, Description $mismatchDescription) + { + $matching = new MatchingOnce($this->_elementMatchers, $mismatchDescription); + + foreach ($array as $element) { + if (!$matching->matches($element)) { + return false; + } + } + + return $matching->isFinished($array); + } + + public function describeTo(Description $description) + { + $description->appendList('[', ', ', ']', $this->_elementMatchers) + ->appendText(' in any order') + ; + } + + /** + * An array with elements that match the given matchers. + * + * @factory containsInAnyOrder ... + */ + public static function arrayContainingInAnyOrder(/* args... */) + { + $args = func_get_args(); + + return new self(Util::createMatcherArray($args)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInOrder.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInOrder.php new file mode 100644 index 0000000..6115740 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingInOrder.php @@ -0,0 +1,57 @@ +_elementMatchers = $elementMatchers; + } + + protected function matchesSafelyWithDiagnosticDescription($array, Description $mismatchDescription) + { + $series = new SeriesMatchingOnce($this->_elementMatchers, $mismatchDescription); + + foreach ($array as $element) { + if (!$series->matches($element)) { + return false; + } + } + + return $series->isFinished(); + } + + public function describeTo(Description $description) + { + $description->appendList('[', ', ', ']', $this->_elementMatchers); + } + + /** + * An array with elements that match the given matchers in the same order. + * + * @factory contains ... + */ + public static function arrayContaining(/* args... */) + { + $args = func_get_args(); + + return new self(Util::createMatcherArray($args)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKey.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKey.php new file mode 100644 index 0000000..523477e --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKey.php @@ -0,0 +1,75 @@ +_keyMatcher = $keyMatcher; + } + + protected function matchesSafely($array) + { + foreach ($array as $key => $element) { + if ($this->_keyMatcher->matches($key)) { + return true; + } + } + + return false; + } + + protected function describeMismatchSafely($array, Description $mismatchDescription) + { + //Not using appendValueList() so that keys can be shown + $mismatchDescription->appendText('array was ') + ->appendText('[') + ; + $loop = false; + foreach ($array as $key => $value) { + if ($loop) { + $mismatchDescription->appendText(', '); + } + $mismatchDescription->appendValue($key)->appendText(' => ')->appendValue($value); + $loop = true; + } + $mismatchDescription->appendText(']'); + } + + public function describeTo(Description $description) + { + $description + ->appendText('array with key ') + ->appendDescriptionOf($this->_keyMatcher) + ; + } + + /** + * Evaluates to true if any key in an array matches the given matcher. + * + * @param mixed $key as a {@link Hamcrest\Matcher} or a value. + * + * @return \Hamcrest\Arrays\IsArrayContainingKey + * @factory hasKey + */ + public static function hasKeyInArray($key) + { + return new self(Util::wrapValueWithIsEqual($key)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKeyValuePair.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKeyValuePair.php new file mode 100644 index 0000000..9ac3eba --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContainingKeyValuePair.php @@ -0,0 +1,80 @@ +_keyMatcher = $keyMatcher; + $this->_valueMatcher = $valueMatcher; + } + + protected function matchesSafely($array) + { + foreach ($array as $key => $value) { + if ($this->_keyMatcher->matches($key) && $this->_valueMatcher->matches($value)) { + return true; + } + } + + return false; + } + + protected function describeMismatchSafely($array, Description $mismatchDescription) + { + //Not using appendValueList() so that keys can be shown + $mismatchDescription->appendText('array was ') + ->appendText('[') + ; + $loop = false; + foreach ($array as $key => $value) { + if ($loop) { + $mismatchDescription->appendText(', '); + } + $mismatchDescription->appendValue($key)->appendText(' => ')->appendValue($value); + $loop = true; + } + $mismatchDescription->appendText(']'); + } + + public function describeTo(Description $description) + { + $description->appendText('array containing [') + ->appendDescriptionOf($this->_keyMatcher) + ->appendText(' => ') + ->appendDescriptionOf($this->_valueMatcher) + ->appendText(']') + ; + } + + /** + * Test if an array has both an key and value in parity with each other. + * + * @factory hasEntry + */ + public static function hasKeyValuePair($key, $value) + { + return new self( + Util::wrapValueWithIsEqual($key), + Util::wrapValueWithIsEqual($value) + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayWithSize.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayWithSize.php new file mode 100644 index 0000000..074375c --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayWithSize.php @@ -0,0 +1,73 @@ +_elementMatchers = $elementMatchers; + $this->_mismatchDescription = $mismatchDescription; + } + + public function matches($item) + { + return $this->_isNotSurplus($item) && $this->_isMatched($item); + } + + public function isFinished($items) + { + if (empty($this->_elementMatchers)) { + return true; + } + + $this->_mismatchDescription + ->appendText('No item matches: ')->appendList('', ', ', '', $this->_elementMatchers) + ->appendText(' in ')->appendValueList('[', ', ', ']', $items) + ; + + return false; + } + + // -- Private Methods + + private function _isNotSurplus($item) + { + if (empty($this->_elementMatchers)) { + $this->_mismatchDescription->appendText('Not matched: ')->appendValue($item); + + return false; + } + + return true; + } + + private function _isMatched($item) + { + /** @var $matcher \Hamcrest\Matcher */ + foreach ($this->_elementMatchers as $i => $matcher) { + if ($matcher->matches($item)) { + unset($this->_elementMatchers[$i]); + + return true; + } + } + + $this->_mismatchDescription->appendText('Not matched: ')->appendValue($item); + + return false; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php new file mode 100644 index 0000000..12a912d --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/SeriesMatchingOnce.php @@ -0,0 +1,75 @@ +_elementMatchers = $elementMatchers; + $this->_keys = array_keys($elementMatchers); + $this->_mismatchDescription = $mismatchDescription; + } + + public function matches($item) + { + return $this->_isNotSurplus($item) && $this->_isMatched($item); + } + + public function isFinished() + { + if (!empty($this->_elementMatchers)) { + $nextMatcher = current($this->_elementMatchers); + $this->_mismatchDescription->appendText('No item matched: ')->appendDescriptionOf($nextMatcher); + + return false; + } + + return true; + } + + // -- Private Methods + + private function _isNotSurplus($item) + { + if (empty($this->_elementMatchers)) { + $this->_mismatchDescription->appendText('Not matched: ')->appendValue($item); + + return false; + } + + return true; + } + + private function _isMatched($item) + { + $this->_nextMatchKey = array_shift($this->_keys); + $nextMatcher = array_shift($this->_elementMatchers); + + if (!$nextMatcher->matches($item)) { + $this->_describeMismatch($nextMatcher, $item); + + return false; + } + + return true; + } + + private function _describeMismatch(Matcher $matcher, $item) + { + $this->_mismatchDescription->appendText('item with key ' . $this->_nextMatchKey . ': '); + $matcher->describeMismatch($item, $this->_mismatchDescription); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/AssertionError.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/AssertionError.php new file mode 100644 index 0000000..3a2a0e7 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/AssertionError.php @@ -0,0 +1,10 @@ +append($text); + + return $this; + } + + public function appendDescriptionOf(SelfDescribing $value) + { + $value->describeTo($this); + + return $this; + } + + public function appendValue($value) + { + if (is_null($value)) { + $this->append('null'); + } elseif (is_string($value)) { + $this->_toPhpSyntax($value); + } elseif (is_float($value)) { + $this->append('<'); + $this->append($value); + $this->append('F>'); + } elseif (is_bool($value)) { + $this->append('<'); + $this->append($value ? 'true' : 'false'); + $this->append('>'); + } elseif (is_array($value) || $value instanceof \Iterator || $value instanceof \IteratorAggregate) { + $this->appendValueList('[', ', ', ']', $value); + } elseif (is_object($value) && !method_exists($value, '__toString')) { + $this->append('<'); + $this->append(get_class($value)); + $this->append('>'); + } else { + $this->append('<'); + $this->append($value); + $this->append('>'); + } + + return $this; + } + + public function appendValueList($start, $separator, $end, $values) + { + $list = array(); + foreach ($values as $v) { + $list[] = new SelfDescribingValue($v); + } + + $this->appendList($start, $separator, $end, $list); + + return $this; + } + + public function appendList($start, $separator, $end, $values) + { + $this->append($start); + + $separate = false; + + foreach ($values as $value) { + /*if (!($value instanceof Hamcrest\SelfDescribing)) { + $value = new Hamcrest\Internal\SelfDescribingValue($value); + }*/ + + if ($separate) { + $this->append($separator); + } + + $this->appendDescriptionOf($value); + + $separate = true; + } + + $this->append($end); + + return $this; + } + + // -- Protected Methods + + /** + * Append the String $str to the description. + */ + abstract protected function append($str); + + // -- Private Methods + + private function _toPhpSyntax($value) + { + $str = '"'; + for ($i = 0, $len = strlen($value); $i < $len; ++$i) { + switch ($value[$i]) { + case '"': + $str .= '\\"'; + break; + + case "\t": + $str .= '\\t'; + break; + + case "\r": + $str .= '\\r'; + break; + + case "\n": + $str .= '\\n'; + break; + + default: + $str .= $value[$i]; + } + } + $str .= '"'; + $this->append($str); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseMatcher.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseMatcher.php new file mode 100644 index 0000000..286db3e --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/BaseMatcher.php @@ -0,0 +1,25 @@ +appendText('was ')->appendValue($item); + } + + public function __toString() + { + return StringDescription::toString($this); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsEmptyTraversable.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsEmptyTraversable.php new file mode 100644 index 0000000..8ab58ea --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsEmptyTraversable.php @@ -0,0 +1,71 @@ +_empty = $empty; + } + + public function matches($item) + { + if (!$item instanceof \Traversable) { + return false; + } + + foreach ($item as $value) { + return !$this->_empty; + } + + return $this->_empty; + } + + public function describeTo(Description $description) + { + $description->appendText($this->_empty ? 'an empty traversable' : 'a non-empty traversable'); + } + + /** + * Returns true if traversable is empty. + * + * @factory + */ + public static function emptyTraversable() + { + if (!self::$_INSTANCE) { + self::$_INSTANCE = new self; + } + + return self::$_INSTANCE; + } + + /** + * Returns true if traversable is not empty. + * + * @factory + */ + public static function nonEmptyTraversable() + { + if (!self::$_NOT_INSTANCE) { + self::$_NOT_INSTANCE = new self(false); + } + + return self::$_NOT_INSTANCE; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsTraversableWithSize.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsTraversableWithSize.php new file mode 100644 index 0000000..c95edc5 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Collection/IsTraversableWithSize.php @@ -0,0 +1,47 @@ +false. + */ +class AllOf extends DiagnosingMatcher +{ + + private $_matchers; + + public function __construct(array $matchers) + { + Util::checkAllAreMatchers($matchers); + + $this->_matchers = $matchers; + } + + public function matchesWithDiagnosticDescription($item, Description $mismatchDescription) + { + /** @var $matcher \Hamcrest\Matcher */ + foreach ($this->_matchers as $matcher) { + if (!$matcher->matches($item)) { + $mismatchDescription->appendDescriptionOf($matcher)->appendText(' '); + $matcher->describeMismatch($item, $mismatchDescription); + + return false; + } + } + + return true; + } + + public function describeTo(Description $description) + { + $description->appendList('(', ' and ', ')', $this->_matchers); + } + + /** + * Evaluates to true only if ALL of the passed in matchers evaluate to true. + * + * @factory ... + */ + public static function allOf(/* args... */) + { + $args = func_get_args(); + + return new self(Util::createMatcherArray($args)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AnyOf.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AnyOf.php new file mode 100644 index 0000000..4504279 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/AnyOf.php @@ -0,0 +1,58 @@ +true. + */ +class AnyOf extends ShortcutCombination +{ + + public function __construct(array $matchers) + { + parent::__construct($matchers); + } + + public function matches($item) + { + return $this->matchesWithShortcut($item, true); + } + + public function describeTo(Description $description) + { + $this->describeToWithOperator($description, 'or'); + } + + /** + * Evaluates to true if ANY of the passed in matchers evaluate to true. + * + * @factory ... + */ + public static function anyOf(/* args... */) + { + $args = func_get_args(); + + return new self(Util::createMatcherArray($args)); + } + + /** + * Evaluates to false if ANY of the passed in matchers evaluate to true. + * + * @factory ... + */ + public static function noneOf(/* args... */) + { + $args = func_get_args(); + + return IsNot::not( + new self(Util::createMatcherArray($args)) + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/CombinableMatcher.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/CombinableMatcher.php new file mode 100644 index 0000000..e3b4aa7 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/CombinableMatcher.php @@ -0,0 +1,78 @@ +_matcher = $matcher; + } + + public function matches($item) + { + return $this->_matcher->matches($item); + } + + public function describeTo(Description $description) + { + $description->appendDescriptionOf($this->_matcher); + } + + /** Diversion from Hamcrest-Java... Logical "and" not permitted */ + public function andAlso(Matcher $other) + { + return new self(new AllOf($this->_templatedListWith($other))); + } + + /** Diversion from Hamcrest-Java... Logical "or" not permitted */ + public function orElse(Matcher $other) + { + return new self(new AnyOf($this->_templatedListWith($other))); + } + + /** + * This is useful for fluently combining matchers that must both pass. + * For example: + *
+     *   assertThat($string, both(containsString("a"))->andAlso(containsString("b")));
+     * 
+ * + * @factory + */ + public static function both(Matcher $matcher) + { + return new self($matcher); + } + + /** + * This is useful for fluently combining matchers where either may pass, + * for example: + *
+     *   assertThat($string, either(containsString("a"))->orElse(containsString("b")));
+     * 
+ * + * @factory + */ + public static function either(Matcher $matcher) + { + return new self($matcher); + } + + // -- Private Methods + + private function _templatedListWith(Matcher $other) + { + return array($this->_matcher, $other); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/DescribedAs.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/DescribedAs.php new file mode 100644 index 0000000..5b2583f --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/DescribedAs.php @@ -0,0 +1,68 @@ +_descriptionTemplate = $descriptionTemplate; + $this->_matcher = $matcher; + $this->_values = $values; + } + + public function matches($item) + { + return $this->_matcher->matches($item); + } + + public function describeTo(Description $description) + { + $textStart = 0; + while (preg_match(self::ARG_PATTERN, $this->_descriptionTemplate, $matches, PREG_OFFSET_CAPTURE, $textStart)) { + $text = $matches[0][0]; + $index = $matches[1][0]; + $offset = $matches[0][1]; + + $description->appendText(substr($this->_descriptionTemplate, $textStart, $offset - $textStart)); + $description->appendValue($this->_values[$index]); + + $textStart = $offset + strlen($text); + } + + if ($textStart < strlen($this->_descriptionTemplate)) { + $description->appendText(substr($this->_descriptionTemplate, $textStart)); + } + } + + /** + * Wraps an existing matcher and overrides the description when it fails. + * + * @factory ... + */ + public static function describedAs(/* $description, Hamcrest\Matcher $matcher, $values... */) + { + $args = func_get_args(); + $description = array_shift($args); + $matcher = array_shift($args); + $values = $args; + + return new self($description, $matcher, $values); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Every.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Every.php new file mode 100644 index 0000000..d686f8d --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Every.php @@ -0,0 +1,56 @@ +_matcher = $matcher; + } + + protected function matchesSafelyWithDiagnosticDescription($items, Description $mismatchDescription) + { + foreach ($items as $item) { + if (!$this->_matcher->matches($item)) { + $mismatchDescription->appendText('an item '); + $this->_matcher->describeMismatch($item, $mismatchDescription); + + return false; + } + } + + return true; + } + + public function describeTo(Description $description) + { + $description->appendText('every item is ')->appendDescriptionOf($this->_matcher); + } + + /** + * @param Matcher $itemMatcher + * A matcher to apply to every element in an array. + * + * @return \Hamcrest\Core\Every + * Evaluates to TRUE for a collection in which every item matches $itemMatcher + * + * @factory + */ + public static function everyItem(Matcher $itemMatcher) + { + return new self($itemMatcher); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/HasToString.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/HasToString.php new file mode 100644 index 0000000..45bd910 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/HasToString.php @@ -0,0 +1,56 @@ +toString(); + } + + return (string) $actual; + } + + /** + * Does array size satisfy a given matcher? + * + * @factory + */ + public static function hasToString($matcher) + { + return new self(Util::wrapValueWithIsEqual($matcher)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Is.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Is.php new file mode 100644 index 0000000..41266dc --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Is.php @@ -0,0 +1,57 @@ +_matcher = $matcher; + } + + public function matches($arg) + { + return $this->_matcher->matches($arg); + } + + public function describeTo(Description $description) + { + $description->appendText('is ')->appendDescriptionOf($this->_matcher); + } + + public function describeMismatch($item, Description $mismatchDescription) + { + $this->_matcher->describeMismatch($item, $mismatchDescription); + } + + /** + * Decorates another Matcher, retaining the behavior but allowing tests + * to be slightly more expressive. + * + * For example: assertThat($cheese, equalTo($smelly)) + * vs. assertThat($cheese, is(equalTo($smelly))) + * + * @factory + */ + public static function is($value) + { + return new self(Util::wrapValueWithIsEqual($value)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsAnything.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsAnything.php new file mode 100644 index 0000000..f20e6c0 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsAnything.php @@ -0,0 +1,45 @@ +true. + */ +class IsAnything extends BaseMatcher +{ + + private $_message; + + public function __construct($message = 'ANYTHING') + { + $this->_message = $message; + } + + public function matches($item) + { + return true; + } + + public function describeTo(Description $description) + { + $description->appendText($this->_message); + } + + /** + * This matcher always evaluates to true. + * + * @param string $description A meaningful string used when describing itself. + * + * @return \Hamcrest\Core\IsAnything + * @factory + */ + public static function anything($description = 'ANYTHING') + { + return new self($description); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsCollectionContaining.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsCollectionContaining.php new file mode 100644 index 0000000..5e60426 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsCollectionContaining.php @@ -0,0 +1,93 @@ +_elementMatcher = $elementMatcher; + } + + protected function matchesSafely($items) + { + foreach ($items as $item) { + if ($this->_elementMatcher->matches($item)) { + return true; + } + } + + return false; + } + + protected function describeMismatchSafely($items, Description $mismatchDescription) + { + $mismatchDescription->appendText('was ')->appendValue($items); + } + + public function describeTo(Description $description) + { + $description + ->appendText('a collection containing ') + ->appendDescriptionOf($this->_elementMatcher) + ; + } + + /** + * Test if the value is an array containing this matcher. + * + * Example: + *
+     * assertThat(array('a', 'b'), hasItem(equalTo('b')));
+     * //Convenience defaults to equalTo()
+     * assertThat(array('a', 'b'), hasItem('b'));
+     * 
+ * + * @factory ... + */ + public static function hasItem() + { + $args = func_get_args(); + $firstArg = array_shift($args); + + return new self(Util::wrapValueWithIsEqual($firstArg)); + } + + /** + * Test if the value is an array containing elements that match all of these + * matchers. + * + * Example: + *
+     * assertThat(array('a', 'b', 'c'), hasItems(equalTo('a'), equalTo('b')));
+     * 
+ * + * @factory ... + */ + public static function hasItems(/* args... */) + { + $args = func_get_args(); + $matchers = array(); + + foreach ($args as $arg) { + $matchers[] = self::hasItem($arg); + } + + return AllOf::allOf($matchers); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsEqual.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsEqual.php new file mode 100644 index 0000000..523fba0 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsEqual.php @@ -0,0 +1,44 @@ +_item = $item; + } + + public function matches($arg) + { + return (($arg == $this->_item) && ($this->_item == $arg)); + } + + public function describeTo(Description $description) + { + $description->appendValue($this->_item); + } + + /** + * Is the value equal to another value, as tested by the use of the "==" + * comparison operator? + * + * @factory + */ + public static function equalTo($item) + { + return new self($item); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsIdentical.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsIdentical.php new file mode 100644 index 0000000..28f7b36 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsIdentical.php @@ -0,0 +1,38 @@ +_value = $value; + } + + public function describeTo(Description $description) + { + $description->appendValue($this->_value); + } + + /** + * Tests of the value is identical to $value as tested by the "===" operator. + * + * @factory + */ + public static function identicalTo($value) + { + return new self($value); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsInstanceOf.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsInstanceOf.php new file mode 100644 index 0000000..7a5c92a --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsInstanceOf.php @@ -0,0 +1,67 @@ +_theClass = $theClass; + } + + protected function matchesWithDiagnosticDescription($item, Description $mismatchDescription) + { + if (!is_object($item)) { + $mismatchDescription->appendText('was ')->appendValue($item); + + return false; + } + + if (!($item instanceof $this->_theClass)) { + $mismatchDescription->appendText('[' . get_class($item) . '] ') + ->appendValue($item); + + return false; + } + + return true; + } + + public function describeTo(Description $description) + { + $description->appendText('an instance of ') + ->appendText($this->_theClass) + ; + } + + /** + * Is the value an instance of a particular type? + * This version assumes no relationship between the required type and + * the signature of the method that sets it up, for example in + * assertThat($anObject, anInstanceOf('Thing')); + * + * @factory any + */ + public static function anInstanceOf($theClass) + { + return new self($theClass); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNot.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNot.php new file mode 100644 index 0000000..167f0d0 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNot.php @@ -0,0 +1,44 @@ +_matcher = $matcher; + } + + public function matches($arg) + { + return !$this->_matcher->matches($arg); + } + + public function describeTo(Description $description) + { + $description->appendText('not ')->appendDescriptionOf($this->_matcher); + } + + /** + * Matches if value does not match $value. + * + * @factory + */ + public static function not($value) + { + return new self(Util::wrapValueWithIsEqual($value)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNull.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNull.php new file mode 100644 index 0000000..91a454c --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsNull.php @@ -0,0 +1,56 @@ +appendText('null'); + } + + /** + * Matches if value is null. + * + * @factory + */ + public static function nullValue() + { + if (!self::$_INSTANCE) { + self::$_INSTANCE = new self(); + } + + return self::$_INSTANCE; + } + + /** + * Matches if value is not null. + * + * @factory + */ + public static function notNullValue() + { + if (!self::$_NOT_INSTANCE) { + self::$_NOT_INSTANCE = IsNot::not(self::nullValue()); + } + + return self::$_NOT_INSTANCE; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsSame.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsSame.php new file mode 100644 index 0000000..8107870 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsSame.php @@ -0,0 +1,51 @@ +_object = $object; + } + + public function matches($object) + { + return ($object === $this->_object) && ($this->_object === $object); + } + + public function describeTo(Description $description) + { + $description->appendText('sameInstance(') + ->appendValue($this->_object) + ->appendText(')') + ; + } + + /** + * Creates a new instance of IsSame. + * + * @param mixed $object + * The predicate evaluates to true only when the argument is + * this object. + * + * @return \Hamcrest\Core\IsSame + * @factory + */ + public static function sameInstance($object) + { + return new self($object); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsTypeOf.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsTypeOf.php new file mode 100644 index 0000000..d24f0f9 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/IsTypeOf.php @@ -0,0 +1,71 @@ +_theType = strtolower($theType); + } + + public function matches($item) + { + return strtolower(gettype($item)) == $this->_theType; + } + + public function describeTo(Description $description) + { + $description->appendText(self::getTypeDescription($this->_theType)); + } + + public function describeMismatch($item, Description $description) + { + if ($item === null) { + $description->appendText('was null'); + } else { + $description->appendText('was ') + ->appendText(self::getTypeDescription(strtolower(gettype($item)))) + ->appendText(' ') + ->appendValue($item) + ; + } + } + + public static function getTypeDescription($type) + { + if ($type == 'null') { + return 'null'; + } + + return (strpos('aeiou', substr($type, 0, 1)) === false ? 'a ' : 'an ') + . $type; + } + + /** + * Is the value a particular built-in type? + * + * @factory + */ + public static function typeOf($theType) + { + return new self($theType); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Set.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Set.php new file mode 100644 index 0000000..cdc45d5 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/Set.php @@ -0,0 +1,95 @@ + + * assertThat(array('a', 'b'), set('b')); + * assertThat($foo, set('bar')); + * assertThat('Server', notSet('defaultPort')); + * + * + * @todo Replace $property with a matcher and iterate all property names. + */ +class Set extends BaseMatcher +{ + + private $_property; + private $_not; + + public function __construct($property, $not = false) + { + $this->_property = $property; + $this->_not = $not; + } + + public function matches($item) + { + if ($item === null) { + return false; + } + $property = $this->_property; + if (is_array($item)) { + $result = isset($item[$property]); + } elseif (is_object($item)) { + $result = isset($item->$property); + } elseif (is_string($item)) { + $result = isset($item::$$property); + } else { + throw new \InvalidArgumentException('Must pass an object, array, or class name'); + } + + return $this->_not ? !$result : $result; + } + + public function describeTo(Description $description) + { + $description->appendText($this->_not ? 'unset property ' : 'set property ')->appendText($this->_property); + } + + public function describeMismatch($item, Description $description) + { + $value = ''; + if (!$this->_not) { + $description->appendText('was not set'); + } else { + $property = $this->_property; + if (is_array($item)) { + $value = $item[$property]; + } elseif (is_object($item)) { + $value = $item->$property; + } elseif (is_string($item)) { + $value = $item::$$property; + } + parent::describeMismatch($value, $description); + } + } + + /** + * Matches if value (class, object, or array) has named $property. + * + * @factory + */ + public static function set($property) + { + return new self($property); + } + + /** + * Matches if value (class, object, or array) does not have named $property. + * + * @factory + */ + public static function notSet($property) + { + return new self($property, true); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/ShortcutCombination.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/ShortcutCombination.php new file mode 100644 index 0000000..d93db74 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/ShortcutCombination.php @@ -0,0 +1,43 @@ + + */ + private $_matchers; + + public function __construct(array $matchers) + { + Util::checkAllAreMatchers($matchers); + + $this->_matchers = $matchers; + } + + protected function matchesWithShortcut($item, $shortcut) + { + /** @var $matcher \Hamcrest\Matcher */ + foreach ($this->_matchers as $matcher) { + if ($matcher->matches($item) == $shortcut) { + return $shortcut; + } + } + + return !$shortcut; + } + + public function describeToWithOperator(Description $description, $operator) + { + $description->appendList('(', ' ' . $operator . ' ', ')', $this->_matchers); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Description.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Description.php new file mode 100644 index 0000000..9a482db --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Description.php @@ -0,0 +1,70 @@ +matchesWithDiagnosticDescription($item, new NullDescription()); + } + + public function describeMismatch($item, Description $mismatchDescription) + { + $this->matchesWithDiagnosticDescription($item, $mismatchDescription); + } + + abstract protected function matchesWithDiagnosticDescription($item, Description $mismatchDescription); +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/FeatureMatcher.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/FeatureMatcher.php new file mode 100644 index 0000000..59f6cc7 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/FeatureMatcher.php @@ -0,0 +1,67 @@ +featureValueOf() in a subclass to pull out the feature to be + * matched against. + */ +abstract class FeatureMatcher extends TypeSafeDiagnosingMatcher +{ + + private $_subMatcher; + private $_featureDescription; + private $_featureName; + + /** + * Constructor. + * + * @param string $type + * @param string $subtype + * @param \Hamcrest\Matcher $subMatcher The matcher to apply to the feature + * @param string $featureDescription Descriptive text to use in describeTo + * @param string $featureName Identifying text for mismatch message + */ + public function __construct($type, $subtype, Matcher $subMatcher, $featureDescription, $featureName) + { + parent::__construct($type, $subtype); + + $this->_subMatcher = $subMatcher; + $this->_featureDescription = $featureDescription; + $this->_featureName = $featureName; + } + + /** + * Implement this to extract the interesting feature. + * + * @param mixed $actual the target object + * + * @return mixed the feature to be matched + */ + abstract protected function featureValueOf($actual); + + public function matchesSafelyWithDiagnosticDescription($actual, Description $mismatchDescription) + { + $featureValue = $this->featureValueOf($actual); + + if (!$this->_subMatcher->matches($featureValue)) { + $mismatchDescription->appendText($this->_featureName) + ->appendText(' was ')->appendValue($featureValue); + + return false; + } + + return true; + } + + final public function describeTo(Description $description) + { + $description->appendText($this->_featureDescription)->appendText(' ') + ->appendDescriptionOf($this->_subMatcher) + ; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Internal/SelfDescribingValue.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Internal/SelfDescribingValue.php new file mode 100644 index 0000000..995da71 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Internal/SelfDescribingValue.php @@ -0,0 +1,27 @@ +_value = $value; + } + + public function describeTo(Description $description) + { + $description->appendValue($this->_value); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matcher.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matcher.php new file mode 100644 index 0000000..e5dcf09 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matcher.php @@ -0,0 +1,50 @@ + + * Matcher implementations should NOT directly implement this interface. + * Instead, extend the {@link Hamcrest\BaseMatcher} abstract class, + * which will ensure that the Matcher API can grow to support + * new features and remain compatible with all Matcher implementations. + *

+ * For easy access to common Matcher implementations, use the static factory + * methods in {@link Hamcrest\CoreMatchers}. + * + * @see Hamcrest\CoreMatchers + * @see Hamcrest\BaseMatcher + */ +interface Matcher extends SelfDescribing +{ + + /** + * Evaluates the matcher for argument $item. + * + * @param mixed $item the object against which the matcher is evaluated. + * + * @return boolean true if $item matches, + * otherwise false. + * + * @see Hamcrest\BaseMatcher + */ + public function matches($item); + + /** + * Generate a description of why the matcher has not accepted the item. + * The description will be part of a larger description of why a matching + * failed, so it should be concise. + * This method assumes that matches($item) is false, but + * will not check this. + * + * @param mixed $item The item that the Matcher has rejected. + * @param Description $description + * @return + */ + public function describeMismatch($item, Description $description); +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/MatcherAssert.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/MatcherAssert.php new file mode 100644 index 0000000..d546dbe --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/MatcherAssert.php @@ -0,0 +1,118 @@ + + * // With an identifier + * assertThat("apple flavour", $apple->flavour(), equalTo("tasty")); + * // Without an identifier + * assertThat($apple->flavour(), equalTo("tasty")); + * // Evaluating a boolean expression + * assertThat("some error", $a > $b); + * assertThat($a > $b); + * + */ + public static function assertThat(/* $args ... */) + { + $args = func_get_args(); + switch (count($args)) { + case 1: + self::$_count++; + if (!$args[0]) { + throw new AssertionError(); + } + break; + + case 2: + self::$_count++; + if ($args[1] instanceof Matcher) { + self::doAssert('', $args[0], $args[1]); + } elseif (!$args[1]) { + throw new AssertionError($args[0]); + } + break; + + case 3: + self::$_count++; + self::doAssert( + $args[0], + $args[1], + Util::wrapValueWithIsEqual($args[2]) + ); + break; + + default: + throw new \InvalidArgumentException('assertThat() requires one to three arguments'); + } + } + + /** + * Returns the number of assertions performed. + * + * @return int + */ + public static function getCount() + { + return self::$_count; + } + + /** + * Resets the number of assertions performed to zero. + */ + public static function resetCount() + { + self::$_count = 0; + } + + /** + * Performs the actual assertion logic. + * + * If $matcher doesn't match $actual, + * throws a {@link Hamcrest\AssertionError} with a description + * of the failure along with the optional $identifier. + * + * @param string $identifier added to the message upon failure + * @param mixed $actual value to compare against $matcher + * @param \Hamcrest\Matcher $matcher applied to $actual + * @throws AssertionError + */ + private static function doAssert($identifier, $actual, Matcher $matcher) + { + if (!$matcher->matches($actual)) { + $description = new StringDescription(); + if (!empty($identifier)) { + $description->appendText($identifier . PHP_EOL); + } + $description->appendText('Expected: ') + ->appendDescriptionOf($matcher) + ->appendText(PHP_EOL . ' but: '); + + $matcher->describeMismatch($actual, $description); + + throw new AssertionError((string) $description); + } + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matchers.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matchers.php new file mode 100644 index 0000000..23232e4 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Matchers.php @@ -0,0 +1,713 @@ + + * assertThat($string, both(containsString("a"))->andAlso(containsString("b"))); + * + */ + public static function both(\Hamcrest\Matcher $matcher) + { + return \Hamcrest\Core\CombinableMatcher::both($matcher); + } + + /** + * This is useful for fluently combining matchers where either may pass, + * for example: + *

+     *   assertThat($string, either(containsString("a"))->orElse(containsString("b")));
+     * 
+ */ + public static function either(\Hamcrest\Matcher $matcher) + { + return \Hamcrest\Core\CombinableMatcher::either($matcher); + } + + /** + * Wraps an existing matcher and overrides the description when it fails. + */ + public static function describedAs(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\DescribedAs', 'describedAs'), $args); + } + + /** + * @param Matcher $itemMatcher + * A matcher to apply to every element in an array. + * + * @return \Hamcrest\Core\Every + * Evaluates to TRUE for a collection in which every item matches $itemMatcher + */ + public static function everyItem(\Hamcrest\Matcher $itemMatcher) + { + return \Hamcrest\Core\Every::everyItem($itemMatcher); + } + + /** + * Does array size satisfy a given matcher? + */ + public static function hasToString($matcher) + { + return \Hamcrest\Core\HasToString::hasToString($matcher); + } + + /** + * Decorates another Matcher, retaining the behavior but allowing tests + * to be slightly more expressive. + * + * For example: assertThat($cheese, equalTo($smelly)) + * vs. assertThat($cheese, is(equalTo($smelly))) + */ + public static function is($value) + { + return \Hamcrest\Core\Is::is($value); + } + + /** + * This matcher always evaluates to true. + * + * @param string $description A meaningful string used when describing itself. + * + * @return \Hamcrest\Core\IsAnything + */ + public static function anything($description = 'ANYTHING') + { + return \Hamcrest\Core\IsAnything::anything($description); + } + + /** + * Test if the value is an array containing this matcher. + * + * Example: + *
+     * assertThat(array('a', 'b'), hasItem(equalTo('b')));
+     * //Convenience defaults to equalTo()
+     * assertThat(array('a', 'b'), hasItem('b'));
+     * 
+ */ + public static function hasItem(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItem'), $args); + } + + /** + * Test if the value is an array containing elements that match all of these + * matchers. + * + * Example: + *
+     * assertThat(array('a', 'b', 'c'), hasItems(equalTo('a'), equalTo('b')));
+     * 
+ */ + public static function hasItems(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItems'), $args); + } + + /** + * Is the value equal to another value, as tested by the use of the "==" + * comparison operator? + */ + public static function equalTo($item) + { + return \Hamcrest\Core\IsEqual::equalTo($item); + } + + /** + * Tests of the value is identical to $value as tested by the "===" operator. + */ + public static function identicalTo($value) + { + return \Hamcrest\Core\IsIdentical::identicalTo($value); + } + + /** + * Is the value an instance of a particular type? + * This version assumes no relationship between the required type and + * the signature of the method that sets it up, for example in + * assertThat($anObject, anInstanceOf('Thing')); + */ + public static function anInstanceOf($theClass) + { + return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass); + } + + /** + * Is the value an instance of a particular type? + * This version assumes no relationship between the required type and + * the signature of the method that sets it up, for example in + * assertThat($anObject, anInstanceOf('Thing')); + */ + public static function any($theClass) + { + return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass); + } + + /** + * Matches if value does not match $value. + */ + public static function not($value) + { + return \Hamcrest\Core\IsNot::not($value); + } + + /** + * Matches if value is null. + */ + public static function nullValue() + { + return \Hamcrest\Core\IsNull::nullValue(); + } + + /** + * Matches if value is not null. + */ + public static function notNullValue() + { + return \Hamcrest\Core\IsNull::notNullValue(); + } + + /** + * Creates a new instance of IsSame. + * + * @param mixed $object + * The predicate evaluates to true only when the argument is + * this object. + * + * @return \Hamcrest\Core\IsSame + */ + public static function sameInstance($object) + { + return \Hamcrest\Core\IsSame::sameInstance($object); + } + + /** + * Is the value a particular built-in type? + */ + public static function typeOf($theType) + { + return \Hamcrest\Core\IsTypeOf::typeOf($theType); + } + + /** + * Matches if value (class, object, or array) has named $property. + */ + public static function set($property) + { + return \Hamcrest\Core\Set::set($property); + } + + /** + * Matches if value (class, object, or array) does not have named $property. + */ + public static function notSet($property) + { + return \Hamcrest\Core\Set::notSet($property); + } + + /** + * Matches if value is a number equal to $value within some range of + * acceptable error $delta. + */ + public static function closeTo($value, $delta) + { + return \Hamcrest\Number\IsCloseTo::closeTo($value, $delta); + } + + /** + * The value is not > $value, nor < $value. + */ + public static function comparesEqualTo($value) + { + return \Hamcrest\Number\OrderingComparison::comparesEqualTo($value); + } + + /** + * The value is > $value. + */ + public static function greaterThan($value) + { + return \Hamcrest\Number\OrderingComparison::greaterThan($value); + } + + /** + * The value is >= $value. + */ + public static function greaterThanOrEqualTo($value) + { + return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value); + } + + /** + * The value is >= $value. + */ + public static function atLeast($value) + { + return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value); + } + + /** + * The value is < $value. + */ + public static function lessThan($value) + { + return \Hamcrest\Number\OrderingComparison::lessThan($value); + } + + /** + * The value is <= $value. + */ + public static function lessThanOrEqualTo($value) + { + return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value); + } + + /** + * The value is <= $value. + */ + public static function atMost($value) + { + return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value); + } + + /** + * Matches if value is a zero-length string. + */ + public static function isEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyString(); + } + + /** + * Matches if value is a zero-length string. + */ + public static function emptyString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyString(); + } + + /** + * Matches if value is null or a zero-length string. + */ + public static function isEmptyOrNullString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString(); + } + + /** + * Matches if value is null or a zero-length string. + */ + public static function nullOrEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString(); + } + + /** + * Matches if value is a non-zero-length string. + */ + public static function isNonEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isNonEmptyString(); + } + + /** + * Matches if value is a non-zero-length string. + */ + public static function nonEmptyString() + { + return \Hamcrest\Text\IsEmptyString::isNonEmptyString(); + } + + /** + * Matches if value is a string equal to $string, regardless of the case. + */ + public static function equalToIgnoringCase($string) + { + return \Hamcrest\Text\IsEqualIgnoringCase::equalToIgnoringCase($string); + } + + /** + * Matches if value is a string equal to $string, regardless of whitespace. + */ + public static function equalToIgnoringWhiteSpace($string) + { + return \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace($string); + } + + /** + * Matches if value is a string that matches regular expression $pattern. + */ + public static function matchesPattern($pattern) + { + return \Hamcrest\Text\MatchesPattern::matchesPattern($pattern); + } + + /** + * Matches if value is a string that contains $substring. + */ + public static function containsString($substring) + { + return \Hamcrest\Text\StringContains::containsString($substring); + } + + /** + * Matches if value is a string that contains $substring regardless of the case. + */ + public static function containsStringIgnoringCase($substring) + { + return \Hamcrest\Text\StringContainsIgnoringCase::containsStringIgnoringCase($substring); + } + + /** + * Matches if value contains $substrings in a constrained order. + */ + public static function stringContainsInOrder(/* args... */) + { + $args = func_get_args(); + return call_user_func_array(array('\Hamcrest\Text\StringContainsInOrder', 'stringContainsInOrder'), $args); + } + + /** + * Matches if value is a string that ends with $substring. + */ + public static function endsWith($substring) + { + return \Hamcrest\Text\StringEndsWith::endsWith($substring); + } + + /** + * Matches if value is a string that starts with $substring. + */ + public static function startsWith($substring) + { + return \Hamcrest\Text\StringStartsWith::startsWith($substring); + } + + /** + * Is the value an array? + */ + public static function arrayValue() + { + return \Hamcrest\Type\IsArray::arrayValue(); + } + + /** + * Is the value a boolean? + */ + public static function booleanValue() + { + return \Hamcrest\Type\IsBoolean::booleanValue(); + } + + /** + * Is the value a boolean? + */ + public static function boolValue() + { + return \Hamcrest\Type\IsBoolean::booleanValue(); + } + + /** + * Is the value callable? + */ + public static function callableValue() + { + return \Hamcrest\Type\IsCallable::callableValue(); + } + + /** + * Is the value a float/double? + */ + public static function doubleValue() + { + return \Hamcrest\Type\IsDouble::doubleValue(); + } + + /** + * Is the value a float/double? + */ + public static function floatValue() + { + return \Hamcrest\Type\IsDouble::doubleValue(); + } + + /** + * Is the value an integer? + */ + public static function integerValue() + { + return \Hamcrest\Type\IsInteger::integerValue(); + } + + /** + * Is the value an integer? + */ + public static function intValue() + { + return \Hamcrest\Type\IsInteger::integerValue(); + } + + /** + * Is the value a numeric? + */ + public static function numericValue() + { + return \Hamcrest\Type\IsNumeric::numericValue(); + } + + /** + * Is the value an object? + */ + public static function objectValue() + { + return \Hamcrest\Type\IsObject::objectValue(); + } + + /** + * Is the value an object? + */ + public static function anObject() + { + return \Hamcrest\Type\IsObject::objectValue(); + } + + /** + * Is the value a resource? + */ + public static function resourceValue() + { + return \Hamcrest\Type\IsResource::resourceValue(); + } + + /** + * Is the value a scalar (boolean, integer, double, or string)? + */ + public static function scalarValue() + { + return \Hamcrest\Type\IsScalar::scalarValue(); + } + + /** + * Is the value a string? + */ + public static function stringValue() + { + return \Hamcrest\Type\IsString::stringValue(); + } + + /** + * Wraps $matcher with {@link Hamcrest\Core\IsEqual) + * if it's not a matcher and the XPath in count() + * if it's an integer. + */ + public static function hasXPath($xpath, $matcher = null) + { + return \Hamcrest\Xml\HasXPath::hasXPath($xpath, $matcher); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/NullDescription.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/NullDescription.php new file mode 100644 index 0000000..aae8e46 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/NullDescription.php @@ -0,0 +1,43 @@ +_value = $value; + $this->_delta = $delta; + } + + protected function matchesSafely($item) + { + return $this->_actualDelta($item) <= 0.0; + } + + protected function describeMismatchSafely($item, Description $mismatchDescription) + { + $mismatchDescription->appendValue($item) + ->appendText(' differed by ') + ->appendValue($this->_actualDelta($item)) + ; + } + + public function describeTo(Description $description) + { + $description->appendText('a numeric value within ') + ->appendValue($this->_delta) + ->appendText(' of ') + ->appendValue($this->_value) + ; + } + + /** + * Matches if value is a number equal to $value within some range of + * acceptable error $delta. + * + * @factory + */ + public static function closeTo($value, $delta) + { + return new self($value, $delta); + } + + // -- Private Methods + + private function _actualDelta($item) + { + return (abs(($item - $this->_value)) - $this->_delta); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/OrderingComparison.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/OrderingComparison.php new file mode 100644 index 0000000..369d0cf --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Number/OrderingComparison.php @@ -0,0 +1,132 @@ +_value = $value; + $this->_minCompare = $minCompare; + $this->_maxCompare = $maxCompare; + } + + protected function matchesSafely($other) + { + $compare = $this->_compare($this->_value, $other); + + return ($this->_minCompare <= $compare) && ($compare <= $this->_maxCompare); + } + + protected function describeMismatchSafely($item, Description $mismatchDescription) + { + $mismatchDescription + ->appendValue($item)->appendText(' was ') + ->appendText($this->_comparison($this->_compare($this->_value, $item))) + ->appendText(' ')->appendValue($this->_value) + ; + } + + public function describeTo(Description $description) + { + $description->appendText('a value ') + ->appendText($this->_comparison($this->_minCompare)) + ; + if ($this->_minCompare != $this->_maxCompare) { + $description->appendText(' or ') + ->appendText($this->_comparison($this->_maxCompare)) + ; + } + $description->appendText(' ')->appendValue($this->_value); + } + + /** + * The value is not > $value, nor < $value. + * + * @factory + */ + public static function comparesEqualTo($value) + { + return new self($value, 0, 0); + } + + /** + * The value is > $value. + * + * @factory + */ + public static function greaterThan($value) + { + return new self($value, -1, -1); + } + + /** + * The value is >= $value. + * + * @factory atLeast + */ + public static function greaterThanOrEqualTo($value) + { + return new self($value, -1, 0); + } + + /** + * The value is < $value. + * + * @factory + */ + public static function lessThan($value) + { + return new self($value, 1, 1); + } + + /** + * The value is <= $value. + * + * @factory atMost + */ + public static function lessThanOrEqualTo($value) + { + return new self($value, 0, 1); + } + + // -- Private Methods + + private function _compare($left, $right) + { + $a = $left; + $b = $right; + + if ($a < $b) { + return -1; + } elseif ($a == $b) { + return 0; + } else { + return 1; + } + } + + private function _comparison($compare) + { + if ($compare > 0) { + return 'less than'; + } elseif ($compare == 0) { + return 'equal to'; + } else { + return 'greater than'; + } + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/SelfDescribing.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/SelfDescribing.php new file mode 100644 index 0000000..872fdf9 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/SelfDescribing.php @@ -0,0 +1,23 @@ +_out = (string) $out; + } + + public function __toString() + { + return $this->_out; + } + + /** + * Return the description of a {@link Hamcrest\SelfDescribing} object as a + * String. + * + * @param \Hamcrest\SelfDescribing $selfDescribing + * The object to be described. + * + * @return string + * The description of the object. + */ + public static function toString(SelfDescribing $selfDescribing) + { + $self = new self(); + + return (string) $self->appendDescriptionOf($selfDescribing); + } + + /** + * Alias for {@link toString()}. + */ + public static function asString(SelfDescribing $selfDescribing) + { + return self::toString($selfDescribing); + } + + // -- Protected Methods + + protected function append($str) + { + $this->_out .= $str; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEmptyString.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEmptyString.php new file mode 100644 index 0000000..2ae61b9 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEmptyString.php @@ -0,0 +1,85 @@ +_empty = $empty; + } + + public function matches($item) + { + return $this->_empty + ? ($item === '') + : is_string($item) && $item !== ''; + } + + public function describeTo(Description $description) + { + $description->appendText($this->_empty ? 'an empty string' : 'a non-empty string'); + } + + /** + * Matches if value is a zero-length string. + * + * @factory emptyString + */ + public static function isEmptyString() + { + if (!self::$_INSTANCE) { + self::$_INSTANCE = new self(true); + } + + return self::$_INSTANCE; + } + + /** + * Matches if value is null or a zero-length string. + * + * @factory nullOrEmptyString + */ + public static function isEmptyOrNullString() + { + if (!self::$_NULL_OR_EMPTY_INSTANCE) { + self::$_NULL_OR_EMPTY_INSTANCE = AnyOf::anyOf( + IsNull::nullvalue(), + self::isEmptyString() + ); + } + + return self::$_NULL_OR_EMPTY_INSTANCE; + } + + /** + * Matches if value is a non-zero-length string. + * + * @factory nonEmptyString + */ + public static function isNonEmptyString() + { + if (!self::$_NOT_INSTANCE) { + self::$_NOT_INSTANCE = new self(false); + } + + return self::$_NOT_INSTANCE; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php new file mode 100644 index 0000000..3836a8c --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringCase.php @@ -0,0 +1,52 @@ +_string = $string; + } + + protected function matchesSafely($item) + { + return strtolower($this->_string) === strtolower($item); + } + + protected function describeMismatchSafely($item, Description $mismatchDescription) + { + $mismatchDescription->appendText('was ')->appendText($item); + } + + public function describeTo(Description $description) + { + $description->appendText('equalToIgnoringCase(') + ->appendValue($this->_string) + ->appendText(')') + ; + } + + /** + * Matches if value is a string equal to $string, regardless of the case. + * + * @factory + */ + public static function equalToIgnoringCase($string) + { + return new self($string); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php new file mode 100644 index 0000000..853692b --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/IsEqualIgnoringWhiteSpace.php @@ -0,0 +1,66 @@ +_string = $string; + } + + protected function matchesSafely($item) + { + return (strtolower($this->_stripSpace($item)) + === strtolower($this->_stripSpace($this->_string))); + } + + protected function describeMismatchSafely($item, Description $mismatchDescription) + { + $mismatchDescription->appendText('was ')->appendText($item); + } + + public function describeTo(Description $description) + { + $description->appendText('equalToIgnoringWhiteSpace(') + ->appendValue($this->_string) + ->appendText(')') + ; + } + + /** + * Matches if value is a string equal to $string, regardless of whitespace. + * + * @factory + */ + public static function equalToIgnoringWhiteSpace($string) + { + return new self($string); + } + + // -- Private Methods + + private function _stripSpace($string) + { + $parts = preg_split("/[\r\n\t ]+/", $string); + foreach ($parts as $i => $part) { + $parts[$i] = trim($part, " \r\n\t"); + } + + return trim(implode(' ', $parts), " \r\n\t"); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/MatchesPattern.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/MatchesPattern.php new file mode 100644 index 0000000..fa0d68e --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/MatchesPattern.php @@ -0,0 +1,40 @@ +_substring, (string) $item) >= 1; + } + + protected function relationship() + { + return 'matching'; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContains.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContains.php new file mode 100644 index 0000000..b92786b --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContains.php @@ -0,0 +1,45 @@ +_substring); + } + + /** + * Matches if value is a string that contains $substring. + * + * @factory + */ + public static function containsString($substring) + { + return new self($substring); + } + + // -- Protected Methods + + protected function evalSubstringOf($item) + { + return (false !== strpos((string) $item, $this->_substring)); + } + + protected function relationship() + { + return 'containing'; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php new file mode 100644 index 0000000..69f37c2 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsIgnoringCase.php @@ -0,0 +1,40 @@ +_substring)); + } + + protected function relationship() + { + return 'containing in any case'; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsInOrder.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsInOrder.php new file mode 100644 index 0000000..e75de65 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringContainsInOrder.php @@ -0,0 +1,66 @@ +_substrings = $substrings; + } + + protected function matchesSafely($item) + { + $fromIndex = 0; + + foreach ($this->_substrings as $substring) { + if (false === $fromIndex = strpos($item, $substring, $fromIndex)) { + return false; + } + } + + return true; + } + + protected function describeMismatchSafely($item, Description $mismatchDescription) + { + $mismatchDescription->appendText('was ')->appendText($item); + } + + public function describeTo(Description $description) + { + $description->appendText('a string containing ') + ->appendValueList('', ', ', '', $this->_substrings) + ->appendText(' in order') + ; + } + + /** + * Matches if value contains $substrings in a constrained order. + * + * @factory ... + */ + public static function stringContainsInOrder(/* args... */) + { + $args = func_get_args(); + + if (isset($args[0]) && is_array($args[0])) { + $args = $args[0]; + } + + return new self($args); + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringEndsWith.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringEndsWith.php new file mode 100644 index 0000000..f802ee4 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringEndsWith.php @@ -0,0 +1,40 @@ +_substring))) === $this->_substring); + } + + protected function relationship() + { + return 'ending with'; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringStartsWith.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringStartsWith.php new file mode 100644 index 0000000..79c9565 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/StringStartsWith.php @@ -0,0 +1,40 @@ +_substring)) === $this->_substring); + } + + protected function relationship() + { + return 'starting with'; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/SubstringMatcher.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/SubstringMatcher.php new file mode 100644 index 0000000..e560ad6 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Text/SubstringMatcher.php @@ -0,0 +1,45 @@ +_substring = $substring; + } + + protected function matchesSafely($item) + { + return $this->evalSubstringOf($item); + } + + protected function describeMismatchSafely($item, Description $mismatchDescription) + { + $mismatchDescription->appendText('was "')->appendText($item)->appendText('"'); + } + + public function describeTo(Description $description) + { + $description->appendText('a string ') + ->appendText($this->relationship()) + ->appendText(' ') + ->appendValue($this->_substring) + ; + } + + abstract protected function evalSubstringOf($string); + + abstract protected function relationship(); +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsArray.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsArray.php new file mode 100644 index 0000000..9179102 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsArray.php @@ -0,0 +1,32 @@ +isHexadecimal($item)) { + return true; + } + + return is_numeric($item); + } + + /** + * Return if the string passed is a valid hexadecimal number. + * This check is necessary because PHP 7 doesn't recognize hexadecimal string as numeric anymore. + * + * @param mixed $item + * @return boolean + */ + private function isHexadecimal($item) + { + if (is_string($item) && preg_match('/^0x(.*)$/', $item, $matches)) { + return ctype_xdigit($matches[1]); + } + + return false; + } + + /** + * Is the value a numeric? + * + * @factory + */ + public static function numericValue() + { + return new self; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsObject.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsObject.php new file mode 100644 index 0000000..65918fc --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Type/IsObject.php @@ -0,0 +1,32 @@ +matchesSafelyWithDiagnosticDescription($item, new NullDescription()); + } + + final public function describeMismatchSafely($item, Description $mismatchDescription) + { + $this->matchesSafelyWithDiagnosticDescription($item, $mismatchDescription); + } + + // -- Protected Methods + + /** + * Subclasses should implement these. The item will already have been checked for + * the specific type. + */ + abstract protected function matchesSafelyWithDiagnosticDescription($item, Description $mismatchDescription); +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeMatcher.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeMatcher.php new file mode 100644 index 0000000..56e299a --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/TypeSafeMatcher.php @@ -0,0 +1,107 @@ +_expectedType = $expectedType; + $this->_expectedSubtype = $expectedSubtype; + } + + final public function matches($item) + { + return $this->_isSafeType($item) && $this->matchesSafely($item); + } + + final public function describeMismatch($item, Description $mismatchDescription) + { + if (!$this->_isSafeType($item)) { + parent::describeMismatch($item, $mismatchDescription); + } else { + $this->describeMismatchSafely($item, $mismatchDescription); + } + } + + // -- Protected Methods + + /** + * The item will already have been checked for the specific type and subtype. + */ + abstract protected function matchesSafely($item); + + /** + * The item will already have been checked for the specific type and subtype. + */ + abstract protected function describeMismatchSafely($item, Description $mismatchDescription); + + // -- Private Methods + + private function _isSafeType($value) + { + switch ($this->_expectedType) { + + case self::TYPE_ANY: + return true; + + case self::TYPE_STRING: + return is_string($value) || is_numeric($value); + + case self::TYPE_NUMERIC: + return is_numeric($value) || is_string($value); + + case self::TYPE_ARRAY: + return is_array($value); + + case self::TYPE_OBJECT: + return is_object($value) + && ($this->_expectedSubtype === null + || $value instanceof $this->_expectedSubtype); + + case self::TYPE_RESOURCE: + return is_resource($value) + && ($this->_expectedSubtype === null + || get_resource_type($value) == $this->_expectedSubtype); + + case self::TYPE_BOOLEAN: + return true; + + default: + return true; + + } + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Util.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Util.php new file mode 100644 index 0000000..169b036 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Util.php @@ -0,0 +1,76 @@ + all items are + */ + public static function createMatcherArray(array $items) + { + //Extract single array item + if (count($items) == 1 && is_array($items[0])) { + $items = $items[0]; + } + + //Replace non-matchers + foreach ($items as &$item) { + if (!($item instanceof Matcher)) { + $item = Core\IsEqual::equalTo($item); + } + } + + return $items; + } +} diff --git a/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml/HasXPath.php b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml/HasXPath.php new file mode 100644 index 0000000..d9764e4 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Xml/HasXPath.php @@ -0,0 +1,195 @@ +_xpath = $xpath; + $this->_matcher = $matcher; + } + + /** + * Matches if the XPath matches against the DOM node and the matcher. + * + * @param string|\DOMNode $actual + * @param Description $mismatchDescription + * @return bool + */ + protected function matchesWithDiagnosticDescription($actual, Description $mismatchDescription) + { + if (is_string($actual)) { + $actual = $this->createDocument($actual); + } elseif (!$actual instanceof \DOMNode) { + $mismatchDescription->appendText('was ')->appendValue($actual); + + return false; + } + $result = $this->evaluate($actual); + if ($result instanceof \DOMNodeList) { + return $this->matchesContent($result, $mismatchDescription); + } else { + return $this->matchesExpression($result, $mismatchDescription); + } + } + + /** + * Creates and returns a DOMDocument from the given + * XML or HTML string. + * + * @param string $text + * @return \DOMDocument built from $text + * @throws \InvalidArgumentException if the document is not valid + */ + protected function createDocument($text) + { + $document = new \DOMDocument(); + if (preg_match('/^\s*<\?xml/', $text)) { + if (!@$document->loadXML($text)) { + throw new \InvalidArgumentException('Must pass a valid XML document'); + } + } else { + if (!@$document->loadHTML($text)) { + throw new \InvalidArgumentException('Must pass a valid HTML or XHTML document'); + } + } + + return $document; + } + + /** + * Applies the configured XPath to the DOM node and returns either + * the result if it's an expression or the node list if it's a query. + * + * @param \DOMNode $node context from which to issue query + * @return mixed result of expression or DOMNodeList from query + */ + protected function evaluate(\DOMNode $node) + { + if ($node instanceof \DOMDocument) { + $xpathDocument = new \DOMXPath($node); + + return $xpathDocument->evaluate($this->_xpath); + } else { + $xpathDocument = new \DOMXPath($node->ownerDocument); + + return $xpathDocument->evaluate($this->_xpath, $node); + } + } + + /** + * Matches if the list of nodes is not empty and the content of at least + * one node matches the configured matcher, if supplied. + * + * @param \DOMNodeList $nodes selected by the XPath query + * @param Description $mismatchDescription + * @return bool + */ + protected function matchesContent(\DOMNodeList $nodes, Description $mismatchDescription) + { + if ($nodes->length == 0) { + $mismatchDescription->appendText('XPath returned no results'); + } elseif ($this->_matcher === null) { + return true; + } else { + foreach ($nodes as $node) { + if ($this->_matcher->matches($node->textContent)) { + return true; + } + } + $content = array(); + foreach ($nodes as $node) { + $content[] = $node->textContent; + } + $mismatchDescription->appendText('XPath returned ') + ->appendValue($content); + } + + return false; + } + + /** + * Matches if the result of the XPath expression matches the configured + * matcher or evaluates to true if there is none. + * + * @param mixed $result result of the XPath expression + * @param Description $mismatchDescription + * @return bool + */ + protected function matchesExpression($result, Description $mismatchDescription) + { + if ($this->_matcher === null) { + if ($result) { + return true; + } + $mismatchDescription->appendText('XPath expression result was ') + ->appendValue($result); + } else { + if ($this->_matcher->matches($result)) { + return true; + } + $mismatchDescription->appendText('XPath expression result '); + $this->_matcher->describeMismatch($result, $mismatchDescription); + } + + return false; + } + + public function describeTo(Description $description) + { + $description->appendText('XML or HTML document with XPath "') + ->appendText($this->_xpath) + ->appendText('"'); + if ($this->_matcher !== null) { + $description->appendText(' '); + $this->_matcher->describeTo($description); + } + } + + /** + * Wraps $matcher with {@link Hamcrest\Core\IsEqual) + * if it's not a matcher and the XPath in count() + * if it's an integer. + * + * @factory + */ + public static function hasXPath($xpath, $matcher = null) + { + if ($matcher === null || $matcher instanceof Matcher) { + return new self($xpath, $matcher); + } elseif (is_int($matcher) && strpos($xpath, 'count(') !== 0) { + $xpath = 'count(' . $xpath . ')'; + } + + return new self($xpath, IsEqual::equalTo($matcher)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/AbstractMatcherTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/AbstractMatcherTest.php new file mode 100644 index 0000000..6c52c0e --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/AbstractMatcherTest.php @@ -0,0 +1,66 @@ +assertTrue($matcher->matches($arg), $message); + } + + public function assertDoesNotMatch(\Hamcrest\Matcher $matcher, $arg, $message) + { + $this->assertFalse($matcher->matches($arg), $message); + } + + public function assertDescription($expected, \Hamcrest\Matcher $matcher) + { + $description = new \Hamcrest\StringDescription(); + $description->appendDescriptionOf($matcher); + $this->assertEquals($expected, (string) $description, 'Expected description'); + } + + public function assertMismatchDescription($expected, \Hamcrest\Matcher $matcher, $arg) + { + $description = new \Hamcrest\StringDescription(); + $this->assertFalse( + $matcher->matches($arg), + 'Precondtion: Matcher should not match item' + ); + $matcher->describeMismatch($arg, $description); + $this->assertEquals( + $expected, + (string) $description, + 'Expected mismatch description' + ); + } + + public function testIsNullSafe() + { + //Should not generate any notices + $this->createMatcher()->matches(null); + $this->createMatcher()->describeMismatch( + null, + new \Hamcrest\NullDescription() + ); + } + + public function testCopesWithUnknownTypes() + { + //Should not generate any notices + $this->createMatcher()->matches(new UnknownType()); + $this->createMatcher()->describeMismatch( + new UnknownType(), + new NullDescription() + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingInAnyOrderTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingInAnyOrderTest.php new file mode 100644 index 0000000..45d9f13 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingInAnyOrderTest.php @@ -0,0 +1,54 @@ +assertDescription('[<1>, <2>] in any order', containsInAnyOrder(array(1, 2))); + } + + public function testMatchesItemsInAnyOrder() + { + $this->assertMatches(containsInAnyOrder(array(1, 2, 3)), array(1, 2, 3), 'in order'); + $this->assertMatches(containsInAnyOrder(array(1, 2, 3)), array(3, 2, 1), 'out of order'); + $this->assertMatches(containsInAnyOrder(array(1)), array(1), 'single'); + } + + public function testAppliesMatchersInAnyOrder() + { + $this->assertMatches( + containsInAnyOrder(array(1, 2, 3)), + array(1, 2, 3), + 'in order' + ); + $this->assertMatches( + containsInAnyOrder(array(1, 2, 3)), + array(3, 2, 1), + 'out of order' + ); + $this->assertMatches( + containsInAnyOrder(array(1)), + array(1), + 'single' + ); + } + + public function testMismatchesItemsInAnyOrder() + { + $matcher = containsInAnyOrder(array(1, 2, 3)); + + $this->assertMismatchDescription('was null', $matcher, null); + $this->assertMismatchDescription('No item matches: <1>, <2>, <3> in []', $matcher, array()); + $this->assertMismatchDescription('No item matches: <2>, <3> in [<1>]', $matcher, array(1)); + $this->assertMismatchDescription('Not matched: <4>', $matcher, array(4, 3, 2, 1)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingInOrderTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingInOrderTest.php new file mode 100644 index 0000000..1868343 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingInOrderTest.php @@ -0,0 +1,44 @@ +assertDescription('[<1>, <2>]', arrayContaining(array(1, 2))); + } + + public function testMatchesItemsInOrder() + { + $this->assertMatches(arrayContaining(array(1, 2, 3)), array(1, 2, 3), 'in order'); + $this->assertMatches(arrayContaining(array(1)), array(1), 'single'); + } + + public function testAppliesMatchersInOrder() + { + $this->assertMatches( + arrayContaining(array(1, 2, 3)), + array(1, 2, 3), + 'in order' + ); + $this->assertMatches(arrayContaining(array(1)), array(1), 'single'); + } + + public function testMismatchesItemsInAnyOrder() + { + $matcher = arrayContaining(array(1, 2, 3)); + $this->assertMismatchDescription('was null', $matcher, null); + $this->assertMismatchDescription('No item matched: <1>', $matcher, array()); + $this->assertMismatchDescription('No item matched: <2>', $matcher, array(1)); + $this->assertMismatchDescription('item with key 0: was <4>', $matcher, array(4, 3, 2, 1)); + $this->assertMismatchDescription('item with key 2: was <4>', $matcher, array(1, 2, 4)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingKeyTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingKeyTest.php new file mode 100644 index 0000000..31770d8 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingKeyTest.php @@ -0,0 +1,62 @@ +1); + + $this->assertMatches(hasKey('a'), $array, 'Matches single key'); + } + + public function testMatchesArrayContainingKey() + { + $array = array('a'=>1, 'b'=>2, 'c'=>3); + + $this->assertMatches(hasKey('a'), $array, 'Matches a'); + $this->assertMatches(hasKey('c'), $array, 'Matches c'); + } + + public function testMatchesArrayContainingKeyWithIntegerKeys() + { + $array = array(1=>'A', 2=>'B'); + + assertThat($array, hasKey(1)); + } + + public function testMatchesArrayContainingKeyWithNumberKeys() + { + $array = array(1=>'A', 2=>'B'); + + assertThat($array, hasKey(1)); + + // very ugly version! + assertThat($array, IsArrayContainingKey::hasKeyInArray(2)); + } + + public function testHasReadableDescription() + { + $this->assertDescription('array with key "a"', hasKey('a')); + } + + public function testDoesNotMatchEmptyArray() + { + $this->assertMismatchDescription('array was []', hasKey('Foo'), array()); + } + + public function testDoesNotMatchArrayMissingKey() + { + $array = array('a'=>1, 'b'=>2, 'c'=>3); + + $this->assertMismatchDescription('array was ["a" => <1>, "b" => <2>, "c" => <3>]', hasKey('d'), $array); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingKeyValuePairTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingKeyValuePairTest.php new file mode 100644 index 0000000..a415f9f --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingKeyValuePairTest.php @@ -0,0 +1,36 @@ +1, 'b'=>2); + + $this->assertMatches(hasKeyValuePair(equalTo('a'), equalTo(1)), $array, 'matcherA'); + $this->assertMatches(hasKeyValuePair(equalTo('b'), equalTo(2)), $array, 'matcherB'); + $this->assertMismatchDescription( + 'array was ["a" => <1>, "b" => <2>]', + hasKeyValuePair(equalTo('c'), equalTo(3)), + $array + ); + } + + public function testDoesNotMatchNull() + { + $this->assertMismatchDescription('was null', hasKeyValuePair(anything(), anything()), null); + } + + public function testHasReadableDescription() + { + $this->assertDescription('array containing ["a" => <2>]', hasKeyValuePair(equalTo('a'), equalTo(2))); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingTest.php new file mode 100644 index 0000000..8d5bd81 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayContainingTest.php @@ -0,0 +1,50 @@ +assertMatches( + hasItemInArray('a'), + array('a', 'b', 'c'), + "should matches array that contains 'a'" + ); + } + + public function testDoesNotMatchAnArrayThatDoesntContainAnElementMatchingTheGivenMatcher() + { + $this->assertDoesNotMatch( + hasItemInArray('a'), + array('b', 'c'), + "should not matches array that doesn't contain 'a'" + ); + $this->assertDoesNotMatch( + hasItemInArray('a'), + array(), + 'should not match empty array' + ); + } + + public function testDoesNotMatchNull() + { + $this->assertDoesNotMatch( + hasItemInArray('a'), + null, + 'should not match null' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('an array containing "a"', hasItemInArray('a')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayTest.php new file mode 100644 index 0000000..e4db53e --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayTest.php @@ -0,0 +1,89 @@ +assertMatches( + anArray(array(equalTo('a'), equalTo('b'), equalTo('c'))), + array('a', 'b', 'c'), + 'should match array with matching elements' + ); + } + + public function testDoesNotMatchAnArrayWhenElementsDoNotMatch() + { + $this->assertDoesNotMatch( + anArray(array(equalTo('a'), equalTo('b'))), + array('b', 'c'), + 'should not match array with different elements' + ); + } + + public function testDoesNotMatchAnArrayOfDifferentSize() + { + $this->assertDoesNotMatch( + anArray(array(equalTo('a'), equalTo('b'))), + array('a', 'b', 'c'), + 'should not match larger array' + ); + $this->assertDoesNotMatch( + anArray(array(equalTo('a'), equalTo('b'))), + array('a'), + 'should not match smaller array' + ); + } + + public function testDoesNotMatchNull() + { + $this->assertDoesNotMatch( + anArray(array(equalTo('a'))), + null, + 'should not match null' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + '["a", "b"]', + anArray(array(equalTo('a'), equalTo('b'))) + ); + } + + public function testHasAReadableMismatchDescriptionWhenKeysDontMatch() + { + $this->assertMismatchDescription( + 'array keys were [<1>, <2>]', + anArray(array(equalTo('a'), equalTo('b'))), + array(1 => 'a', 2 => 'b') + ); + } + + public function testSupportsMatchesAssociativeArrays() + { + $this->assertMatches( + anArray(array('x'=>equalTo('a'), 'y'=>equalTo('b'), 'z'=>equalTo('c'))), + array('x'=>'a', 'y'=>'b', 'z'=>'c'), + 'should match associative array with matching elements' + ); + } + + public function testDoesNotMatchAnAssociativeArrayWhenKeysDoNotMatch() + { + $this->assertDoesNotMatch( + anArray(array('x'=>equalTo('a'), 'y'=>equalTo('b'))), + array('x'=>'b', 'z'=>'c'), + 'should not match array with different keys' + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayWithSizeTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayWithSizeTest.php new file mode 100644 index 0000000..8413c89 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Array/IsArrayWithSizeTest.php @@ -0,0 +1,37 @@ +assertMatches(arrayWithSize(equalTo(3)), array(1, 2, 3), 'correct size'); + $this->assertDoesNotMatch(arrayWithSize(equalTo(2)), array(1, 2, 3), 'incorrect size'); + } + + public function testProvidesConvenientShortcutForArrayWithSizeEqualTo() + { + $this->assertMatches(arrayWithSize(3), array(1, 2, 3), 'correct size'); + $this->assertDoesNotMatch(arrayWithSize(2), array(1, 2, 3), 'incorrect size'); + } + + public function testEmptyArray() + { + $this->assertMatches(emptyArray(), array(), 'correct size'); + $this->assertDoesNotMatch(emptyArray(), array(1), 'incorrect size'); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('an array with size <3>', arrayWithSize(equalTo(3))); + $this->assertDescription('an empty array', emptyArray()); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/BaseMatcherTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/BaseMatcherTest.php new file mode 100644 index 0000000..833e2c3 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/BaseMatcherTest.php @@ -0,0 +1,23 @@ +appendText('SOME DESCRIPTION'); + } + + public function testDescribesItselfWithToStringMethod() + { + $someMatcher = new \Hamcrest\SomeMatcher(); + $this->assertEquals('SOME DESCRIPTION', (string) $someMatcher); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Collection/IsEmptyTraversableTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Collection/IsEmptyTraversableTest.php new file mode 100644 index 0000000..2f15fb4 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Collection/IsEmptyTraversableTest.php @@ -0,0 +1,77 @@ +assertMatches( + emptyTraversable(), + new \ArrayObject(array()), + 'an empty traversable' + ); + } + + public function testEmptyMatcherDoesNotMatchWhenNotEmpty() + { + $this->assertDoesNotMatch( + emptyTraversable(), + new \ArrayObject(array(1, 2, 3)), + 'a non-empty traversable' + ); + } + + public function testEmptyMatcherDoesNotMatchNull() + { + $this->assertDoesNotMatch( + emptyTraversable(), + null, + 'should not match null' + ); + } + + public function testEmptyMatcherHasAReadableDescription() + { + $this->assertDescription('an empty traversable', emptyTraversable()); + } + + public function testNonEmptyDoesNotMatchNull() + { + $this->assertDoesNotMatch( + nonEmptyTraversable(), + null, + 'should not match null' + ); + } + + public function testNonEmptyDoesNotMatchWhenEmpty() + { + $this->assertDoesNotMatch( + nonEmptyTraversable(), + new \ArrayObject(array()), + 'an empty traversable' + ); + } + + public function testNonEmptyMatchesWhenNotEmpty() + { + $this->assertMatches( + nonEmptyTraversable(), + new \ArrayObject(array(1, 2, 3)), + 'a non-empty traversable' + ); + } + + public function testNonEmptyNonEmptyMatcherHasAReadableDescription() + { + $this->assertDescription('a non-empty traversable', nonEmptyTraversable()); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Collection/IsTraversableWithSizeTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Collection/IsTraversableWithSizeTest.php new file mode 100644 index 0000000..c1c67a7 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Collection/IsTraversableWithSizeTest.php @@ -0,0 +1,57 @@ +assertMatches( + traversableWithSize(equalTo(3)), + new \ArrayObject(array(1, 2, 3)), + 'correct size' + ); + } + + public function testDoesNotMatchWhenSizeIsIncorrect() + { + $this->assertDoesNotMatch( + traversableWithSize(equalTo(2)), + new \ArrayObject(array(1, 2, 3)), + 'incorrect size' + ); + } + + public function testDoesNotMatchNull() + { + $this->assertDoesNotMatch( + traversableWithSize(3), + null, + 'should not match null' + ); + } + + public function testProvidesConvenientShortcutForTraversableWithSizeEqualTo() + { + $this->assertMatches( + traversableWithSize(3), + new \ArrayObject(array(1, 2, 3)), + 'correct size' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + 'a traversable with size <3>', + traversableWithSize(equalTo(3)) + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AllOfTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AllOfTest.php new file mode 100644 index 0000000..86b8c27 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AllOfTest.php @@ -0,0 +1,56 @@ +assertDescription( + '("good" and "bad" and "ugly")', + allOf('good', 'bad', 'ugly') + ); + } + + public function testMismatchDescriptionDescribesFirstFailingMatch() + { + $this->assertMismatchDescription( + '"good" was "bad"', + allOf('bad', 'good'), + 'bad' + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AnyOfTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AnyOfTest.php new file mode 100644 index 0000000..3d62b93 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AnyOfTest.php @@ -0,0 +1,79 @@ +assertDescription( + '("good" or "bad" or "ugly")', + anyOf('good', 'bad', 'ugly') + ); + } + + public function testNoneOfEvaluatesToTheLogicalDisjunctionOfTwoOtherMatchers() + { + assertThat('good', not(noneOf('bad', 'good'))); + assertThat('good', not(noneOf('good', 'good'))); + assertThat('good', not(noneOf('good', 'bad'))); + + assertThat('good', noneOf('bad', startsWith('b'))); + } + + public function testNoneOfEvaluatesToTheLogicalDisjunctionOfManyOtherMatchers() + { + assertThat('good', not(noneOf('bad', 'good', 'bad', 'bad', 'bad'))); + assertThat('good', noneOf('bad', 'bad', 'bad', 'bad', 'bad')); + } + + public function testNoneOfSupportsMixedTypes() + { + $combined = noneOf( + equalTo(new \Hamcrest\Core\SampleBaseClass('good')), + equalTo(new \Hamcrest\Core\SampleBaseClass('ugly')), + equalTo(new \Hamcrest\Core\SampleSubClass('good')) + ); + + assertThat(new \Hamcrest\Core\SampleSubClass('bad'), $combined); + } + + public function testNoneOfHasAReadableDescription() + { + $this->assertDescription( + 'not ("good" or "bad" or "ugly")', + noneOf('good', 'bad', 'ugly') + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/CombinableMatcherTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/CombinableMatcherTest.php new file mode 100644 index 0000000..4c22614 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/CombinableMatcherTest.php @@ -0,0 +1,59 @@ +_either_3_or_4 = \Hamcrest\Core\CombinableMatcher::either(equalTo(3))->orElse(equalTo(4)); + $this->_not_3_and_not_4 = \Hamcrest\Core\CombinableMatcher::both(not(equalTo(3)))->andAlso(not(equalTo(4))); + } + + protected function createMatcher() + { + return \Hamcrest\Core\CombinableMatcher::either(equalTo('irrelevant'))->orElse(equalTo('ignored')); + } + + public function testBothAcceptsAndRejects() + { + assertThat(2, $this->_not_3_and_not_4); + assertThat(3, not($this->_not_3_and_not_4)); + } + + public function testAcceptsAndRejectsThreeAnds() + { + $tripleAnd = $this->_not_3_and_not_4->andAlso(equalTo(2)); + assertThat(2, $tripleAnd); + assertThat(3, not($tripleAnd)); + } + + public function testBothDescribesItself() + { + $this->assertEquals('(not <3> and not <4>)', (string) $this->_not_3_and_not_4); + $this->assertMismatchDescription('was <3>', $this->_not_3_and_not_4, 3); + } + + public function testEitherAcceptsAndRejects() + { + assertThat(3, $this->_either_3_or_4); + assertThat(6, not($this->_either_3_or_4)); + } + + public function testAcceptsAndRejectsThreeOrs() + { + $orTriple = $this->_either_3_or_4->orElse(greaterThan(10)); + + assertThat(11, $orTriple); + assertThat(9, not($orTriple)); + } + + public function testEitherDescribesItself() + { + $this->assertEquals('(<3> or <4>)', (string) $this->_either_3_or_4); + $this->assertMismatchDescription('was <6>', $this->_either_3_or_4, 6); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/DescribedAsTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/DescribedAsTest.php new file mode 100644 index 0000000..673ab41 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/DescribedAsTest.php @@ -0,0 +1,36 @@ +assertDescription('m1 description', $m1); + $this->assertDescription('m2 description', $m2); + } + + public function testAppendsValuesToDescription() + { + $m = describedAs('value 1 = %0, value 2 = %1', anything(), 33, 97); + + $this->assertDescription('value 1 = <33>, value 2 = <97>', $m); + } + + public function testDelegatesMatchingToAnotherMatcher() + { + $m1 = describedAs('irrelevant', anything()); + $m2 = describedAs('irrelevant', not(anything())); + + $this->assertTrue($m1->matches(new \stdClass())); + $this->assertFalse($m2->matches('hi')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/EveryTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/EveryTest.php new file mode 100644 index 0000000..5eb153c --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/EveryTest.php @@ -0,0 +1,30 @@ +assertEquals('every item is a string containing "a"', (string) $each); + + $this->assertMismatchDescription('an item was "BbB"', $each, array('BbB')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/HasToStringTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/HasToStringTest.php new file mode 100644 index 0000000..e2e136d --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/HasToStringTest.php @@ -0,0 +1,108 @@ +assertMatches( + hasToString(equalTo('php')), + new \Hamcrest\Core\PhpForm(), + 'correct __toString' + ); + $this->assertMatches( + hasToString(equalTo('java')), + new \Hamcrest\Core\JavaForm(), + 'correct toString' + ); + } + + public function testPicksJavaOverPhpToString() + { + $this->assertMatches( + hasToString(equalTo('java')), + new \Hamcrest\Core\BothForms(), + 'correct toString' + ); + } + + public function testDoesNotMatchWhenToStringDoesNotMatch() + { + $this->assertDoesNotMatch( + hasToString(equalTo('mismatch')), + new \Hamcrest\Core\PhpForm(), + 'incorrect __toString' + ); + $this->assertDoesNotMatch( + hasToString(equalTo('mismatch')), + new \Hamcrest\Core\JavaForm(), + 'incorrect toString' + ); + $this->assertDoesNotMatch( + hasToString(equalTo('mismatch')), + new \Hamcrest\Core\BothForms(), + 'incorrect __toString' + ); + } + + public function testDoesNotMatchNull() + { + $this->assertDoesNotMatch( + hasToString(equalTo('a')), + null, + 'should not match null' + ); + } + + public function testProvidesConvenientShortcutForTraversableWithSizeEqualTo() + { + $this->assertMatches( + hasToString(equalTo('php')), + new \Hamcrest\Core\PhpForm(), + 'correct __toString' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + 'an object with toString() "php"', + hasToString(equalTo('php')) + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsAnythingTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsAnythingTest.php new file mode 100644 index 0000000..f68032e --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsAnythingTest.php @@ -0,0 +1,29 @@ +assertDescription('ANYTHING', anything()); + } + + public function testCanOverrideDescription() + { + $description = 'description'; + $this->assertDescription($description, anything($description)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsCollectionContainingTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsCollectionContainingTest.php new file mode 100644 index 0000000..a3929b5 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsCollectionContainingTest.php @@ -0,0 +1,91 @@ +assertMatches( + $itemMatcher, + array('a', 'b', 'c'), + "should match list that contains 'a'" + ); + } + + public function testDoesNotMatchCollectionThatDoesntContainAnElementMatchingTheGivenMatcher() + { + $matcher1 = hasItem(equalTo('a')); + $this->assertDoesNotMatch( + $matcher1, + array('b', 'c'), + "should not match list that doesn't contain 'a'" + ); + + $matcher2 = hasItem(equalTo('a')); + $this->assertDoesNotMatch( + $matcher2, + array(), + 'should not match the empty list' + ); + } + + public function testDoesNotMatchNull() + { + $this->assertDoesNotMatch( + hasItem(equalTo('a')), + null, + 'should not match null' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('a collection containing "a"', hasItem(equalTo('a'))); + } + + public function testMatchesAllItemsInCollection() + { + $matcher1 = hasItems(equalTo('a'), equalTo('b'), equalTo('c')); + $this->assertMatches( + $matcher1, + array('a', 'b', 'c'), + 'should match list containing all items' + ); + + $matcher2 = hasItems('a', 'b', 'c'); + $this->assertMatches( + $matcher2, + array('a', 'b', 'c'), + 'should match list containing all items (without matchers)' + ); + + $matcher3 = hasItems(equalTo('a'), equalTo('b'), equalTo('c')); + $this->assertMatches( + $matcher3, + array('c', 'b', 'a'), + 'should match list containing all items in any order' + ); + + $matcher4 = hasItems(equalTo('a'), equalTo('b'), equalTo('c')); + $this->assertMatches( + $matcher4, + array('e', 'c', 'b', 'a', 'd'), + 'should match list containing all items plus others' + ); + + $matcher5 = hasItems(equalTo('a'), equalTo('b'), equalTo('c')); + $this->assertDoesNotMatch( + $matcher5, + array('e', 'c', 'b', 'd'), // 'a' missing + 'should not match list unless it contains all items' + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsEqualTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsEqualTest.php new file mode 100644 index 0000000..73e3ff0 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsEqualTest.php @@ -0,0 +1,102 @@ +_arg = $arg; + } + + public function __toString() + { + return $this->_arg; + } +} + +class IsEqualTest extends \Hamcrest\AbstractMatcherTest +{ + + protected function createMatcher() + { + return \Hamcrest\Core\IsEqual::equalTo('irrelevant'); + } + + public function testComparesObjectsUsingEqualityOperator() + { + assertThat("hi", equalTo("hi")); + assertThat("bye", not(equalTo("hi"))); + + assertThat(1, equalTo(1)); + assertThat(1, not(equalTo(2))); + + assertThat("2", equalTo(2)); + } + + public function testCanCompareNullValues() + { + assertThat(null, equalTo(null)); + + assertThat(null, not(equalTo('hi'))); + assertThat('hi', not(equalTo(null))); + } + + public function testComparesTheElementsOfAnArray() + { + $s1 = array('a', 'b'); + $s2 = array('a', 'b'); + $s3 = array('c', 'd'); + $s4 = array('a', 'b', 'c', 'd'); + + assertThat($s1, equalTo($s1)); + assertThat($s2, equalTo($s1)); + assertThat($s3, not(equalTo($s1))); + assertThat($s4, not(equalTo($s1))); + } + + public function testComparesTheElementsOfAnArrayOfPrimitiveTypes() + { + $i1 = array(1, 2); + $i2 = array(1, 2); + $i3 = array(3, 4); + $i4 = array(1, 2, 3, 4); + + assertThat($i1, equalTo($i1)); + assertThat($i2, equalTo($i1)); + assertThat($i3, not(equalTo($i1))); + assertThat($i4, not(equalTo($i1))); + } + + public function testRecursivelyTestsElementsOfArrays() + { + $i1 = array(array(1, 2), array(3, 4)); + $i2 = array(array(1, 2), array(3, 4)); + $i3 = array(array(5, 6), array(7, 8)); + $i4 = array(array(1, 2, 3, 4), array(3, 4)); + + assertThat($i1, equalTo($i1)); + assertThat($i2, equalTo($i1)); + assertThat($i3, not(equalTo($i1))); + assertThat($i4, not(equalTo($i1))); + } + + public function testIncludesTheResultOfCallingToStringOnItsArgumentInTheDescription() + { + $argumentDescription = 'ARGUMENT DESCRIPTION'; + $argument = new \Hamcrest\Core\DummyToStringClass($argumentDescription); + $this->assertDescription('<' . $argumentDescription . '>', equalTo($argument)); + } + + public function testReturnsAnObviousDescriptionIfCreatedWithANestedMatcherByMistake() + { + $innerMatcher = equalTo('NestedMatcher'); + $this->assertDescription('<' . (string) $innerMatcher . '>', equalTo($innerMatcher)); + } + + public function testReturnsGoodDescriptionIfCreatedWithNullReference() + { + $this->assertDescription('null', equalTo(null)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsIdenticalTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsIdenticalTest.php new file mode 100644 index 0000000..9cc2794 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsIdenticalTest.php @@ -0,0 +1,30 @@ +assertDescription('"ARG"', identicalTo('ARG')); + } + + public function testReturnsReadableDescriptionFromToStringWhenInitialisedWithNull() + { + $this->assertDescription('null', identicalTo(null)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsInstanceOfTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsInstanceOfTest.php new file mode 100644 index 0000000..7a5f095 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsInstanceOfTest.php @@ -0,0 +1,51 @@ +_baseClassInstance = new \Hamcrest\Core\SampleBaseClass('good'); + $this->_subClassInstance = new \Hamcrest\Core\SampleSubClass('good'); + } + + protected function createMatcher() + { + return \Hamcrest\Core\IsInstanceOf::anInstanceOf('stdClass'); + } + + public function testEvaluatesToTrueIfArgumentIsInstanceOfASpecificClass() + { + assertThat($this->_baseClassInstance, anInstanceOf('Hamcrest\Core\SampleBaseClass')); + assertThat($this->_subClassInstance, anInstanceOf('Hamcrest\Core\SampleSubClass')); + assertThat(null, not(anInstanceOf('Hamcrest\Core\SampleBaseClass'))); + assertThat(new \stdClass(), not(anInstanceOf('Hamcrest\Core\SampleBaseClass'))); + } + + public function testEvaluatesToFalseIfArgumentIsNotAnObject() + { + assertThat(null, not(anInstanceOf('Hamcrest\Core\SampleBaseClass'))); + assertThat(false, not(anInstanceOf('Hamcrest\Core\SampleBaseClass'))); + assertThat(5, not(anInstanceOf('Hamcrest\Core\SampleBaseClass'))); + assertThat('foo', not(anInstanceOf('Hamcrest\Core\SampleBaseClass'))); + assertThat(array(1, 2, 3), not(anInstanceOf('Hamcrest\Core\SampleBaseClass'))); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('an instance of stdClass', anInstanceOf('stdClass')); + } + + public function testDecribesActualClassInMismatchMessage() + { + $this->assertMismatchDescription( + '[Hamcrest\Core\SampleBaseClass] ', + anInstanceOf('Hamcrest\Core\SampleSubClass'), + $this->_baseClassInstance + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsNotTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsNotTest.php new file mode 100644 index 0000000..09d4a65 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsNotTest.php @@ -0,0 +1,31 @@ +assertMatches(not(equalTo('A')), 'B', 'should match'); + $this->assertDoesNotMatch(not(equalTo('B')), 'B', 'should not match'); + } + + public function testProvidesConvenientShortcutForNotEqualTo() + { + $this->assertMatches(not('A'), 'B', 'should match'); + $this->assertMatches(not('B'), 'A', 'should match'); + $this->assertDoesNotMatch(not('A'), 'A', 'should not match'); + $this->assertDoesNotMatch(not('B'), 'B', 'should not match'); + } + + public function testUsesDescriptionOfNegatedMatcherWithPrefix() + { + $this->assertDescription('not a value greater than <2>', not(greaterThan(2))); + $this->assertDescription('not "A"', not('A')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsNullTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsNullTest.php new file mode 100644 index 0000000..bfa4255 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsNullTest.php @@ -0,0 +1,20 @@ +assertDescription('sameInstance("ARG")', sameInstance('ARG')); + } + + public function testReturnsReadableDescriptionFromToStringWhenInitialisedWithNull() + { + $this->assertDescription('sameInstance(null)', sameInstance(null)); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsTest.php new file mode 100644 index 0000000..bbd848b --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsTest.php @@ -0,0 +1,33 @@ +assertMatches(is(equalTo(true)), true, 'should match'); + $this->assertMatches(is(equalTo(false)), false, 'should match'); + $this->assertDoesNotMatch(is(equalTo(true)), false, 'should not match'); + $this->assertDoesNotMatch(is(equalTo(false)), true, 'should not match'); + } + + public function testGeneratesIsPrefixInDescription() + { + $this->assertDescription('is ', is(equalTo(true))); + } + + public function testProvidesConvenientShortcutForIsEqualTo() + { + $this->assertMatches(is('A'), 'A', 'should match'); + $this->assertMatches(is('B'), 'B', 'should match'); + $this->assertDoesNotMatch(is('A'), 'B', 'should not match'); + $this->assertDoesNotMatch(is('B'), 'A', 'should not match'); + $this->assertDescription('is "A"', is('A')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsTypeOfTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsTypeOfTest.php new file mode 100644 index 0000000..3f48dea --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/IsTypeOfTest.php @@ -0,0 +1,45 @@ +assertDescription('a double', typeOf('double')); + $this->assertDescription('an integer', typeOf('integer')); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', typeOf('boolean'), null); + $this->assertMismatchDescription('was an integer <5>', typeOf('float'), 5); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/SampleBaseClass.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/SampleBaseClass.php new file mode 100644 index 0000000..c953e7c --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/SampleBaseClass.php @@ -0,0 +1,18 @@ +_arg = $arg; + } + + public function __toString() + { + return $this->_arg; + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/SampleSubClass.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/SampleSubClass.php new file mode 100644 index 0000000..822f1b6 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/SampleSubClass.php @@ -0,0 +1,6 @@ +_instanceProperty); + } + + protected function createMatcher() + { + return \Hamcrest\Core\Set::set('property_name'); + } + + public function testEvaluatesToTrueIfArrayPropertyIsSet() + { + assertThat(array('foo' => 'bar'), set('foo')); + } + + public function testNegatedEvaluatesToFalseIfArrayPropertyIsSet() + { + assertThat(array('foo' => 'bar'), not(notSet('foo'))); + } + + public function testEvaluatesToTrueIfClassPropertyIsSet() + { + self::$_classProperty = 'bar'; + assertThat('Hamcrest\Core\SetTest', set('_classProperty')); + } + + public function testNegatedEvaluatesToFalseIfClassPropertyIsSet() + { + self::$_classProperty = 'bar'; + assertThat('Hamcrest\Core\SetTest', not(notSet('_classProperty'))); + } + + public function testEvaluatesToTrueIfObjectPropertyIsSet() + { + $this->_instanceProperty = 'bar'; + assertThat($this, set('_instanceProperty')); + } + + public function testNegatedEvaluatesToFalseIfObjectPropertyIsSet() + { + $this->_instanceProperty = 'bar'; + assertThat($this, not(notSet('_instanceProperty'))); + } + + public function testEvaluatesToFalseIfArrayPropertyIsNotSet() + { + assertThat(array('foo' => 'bar'), not(set('baz'))); + } + + public function testNegatedEvaluatesToTrueIfArrayPropertyIsNotSet() + { + assertThat(array('foo' => 'bar'), notSet('baz')); + } + + public function testEvaluatesToFalseIfClassPropertyIsNotSet() + { + assertThat('Hamcrest\Core\SetTest', not(set('_classProperty'))); + } + + public function testNegatedEvaluatesToTrueIfClassPropertyIsNotSet() + { + assertThat('Hamcrest\Core\SetTest', notSet('_classProperty')); + } + + public function testEvaluatesToFalseIfObjectPropertyIsNotSet() + { + assertThat($this, not(set('_instanceProperty'))); + } + + public function testNegatedEvaluatesToTrueIfObjectPropertyIsNotSet() + { + assertThat($this, notSet('_instanceProperty')); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('set property foo', set('foo')); + $this->assertDescription('unset property bar', notSet('bar')); + } + + public function testDecribesPropertySettingInMismatchMessage() + { + $this->assertMismatchDescription( + 'was not set', + set('bar'), + array('foo' => 'bar') + ); + $this->assertMismatchDescription( + 'was "bar"', + notSet('foo'), + array('foo' => 'bar') + ); + self::$_classProperty = 'bar'; + $this->assertMismatchDescription( + 'was "bar"', + notSet('_classProperty'), + 'Hamcrest\Core\SetTest' + ); + $this->_instanceProperty = 'bar'; + $this->assertMismatchDescription( + 'was "bar"', + notSet('_instanceProperty'), + $this + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/FeatureMatcherTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/FeatureMatcherTest.php new file mode 100644 index 0000000..7543294 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/FeatureMatcherTest.php @@ -0,0 +1,73 @@ +_result = $result; + } + public function getResult() + { + return $this->_result; + } +} + +/* Test-specific subclass only */ +class ResultMatcher extends \Hamcrest\FeatureMatcher +{ + public function __construct() + { + parent::__construct(self::TYPE_ANY, null, equalTo('bar'), 'Thingy with result', 'result'); + } + public function featureValueOf($actual) + { + if ($actual instanceof \Hamcrest\Thingy) { + return $actual->getResult(); + } + } +} + +class FeatureMatcherTest extends \Hamcrest\AbstractMatcherTest +{ + + private $_resultMatcher; + + public function setUp() + { + $this->_resultMatcher = $this->_resultMatcher(); + } + + protected function createMatcher() + { + return $this->_resultMatcher(); + } + + public function testMatchesPartOfAnObject() + { + $this->assertMatches($this->_resultMatcher, new \Hamcrest\Thingy('bar'), 'feature'); + $this->assertDescription('Thingy with result "bar"', $this->_resultMatcher); + } + + public function testMismatchesPartOfAnObject() + { + $this->assertMismatchDescription( + 'result was "foo"', + $this->_resultMatcher, + new \Hamcrest\Thingy('foo') + ); + } + + public function testDoesNotGenerateNoticesForNull() + { + $this->assertMismatchDescription('result was null', $this->_resultMatcher, null); + } + + // -- Creation Methods + + private function _resultMatcher() + { + return new \Hamcrest\ResultMatcher(); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/MatcherAssertTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/MatcherAssertTest.php new file mode 100644 index 0000000..2183712 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/MatcherAssertTest.php @@ -0,0 +1,190 @@ +getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat(null); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat(''); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat(0); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat(0.0); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat(array()); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('', $ex->getMessage()); + } + self::assertEquals(6, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + + public function testAssertThatWithIdentifierAndTrueArgPasses() + { + \Hamcrest\MatcherAssert::assertThat('identifier', true); + \Hamcrest\MatcherAssert::assertThat('identifier', 'non-empty'); + \Hamcrest\MatcherAssert::assertThat('identifier', 1); + \Hamcrest\MatcherAssert::assertThat('identifier', 3.14159); + \Hamcrest\MatcherAssert::assertThat('identifier', array(true)); + self::assertEquals(5, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + + public function testAssertThatWithIdentifierAndFalseArgFails() + { + try { + \Hamcrest\MatcherAssert::assertThat('identifier', false); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('identifier', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat('identifier', null); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('identifier', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat('identifier', ''); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('identifier', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat('identifier', 0); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('identifier', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat('identifier', 0.0); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('identifier', $ex->getMessage()); + } + try { + \Hamcrest\MatcherAssert::assertThat('identifier', array()); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals('identifier', $ex->getMessage()); + } + self::assertEquals(6, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + + public function testAssertThatWithActualValueAndMatcherArgsThatMatchPasses() + { + \Hamcrest\MatcherAssert::assertThat(true, is(true)); + self::assertEquals(1, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + + public function testAssertThatWithActualValueAndMatcherArgsThatDontMatchFails() + { + $expected = 'expected'; + $actual = 'actual'; + + $expectedMessage = + 'Expected: "expected"' . PHP_EOL . + ' but: was "actual"'; + + try { + \Hamcrest\MatcherAssert::assertThat($actual, equalTo($expected)); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals($expectedMessage, $ex->getMessage()); + self::assertEquals(1, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + } + + public function testAssertThatWithIdentifierAndActualValueAndMatcherArgsThatMatchPasses() + { + \Hamcrest\MatcherAssert::assertThat('identifier', true, is(true)); + self::assertEquals(1, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + + public function testAssertThatWithIdentifierAndActualValueAndMatcherArgsThatDontMatchFails() + { + $expected = 'expected'; + $actual = 'actual'; + + $expectedMessage = + 'identifier' . PHP_EOL . + 'Expected: "expected"' . PHP_EOL . + ' but: was "actual"'; + + try { + \Hamcrest\MatcherAssert::assertThat('identifier', $actual, equalTo($expected)); + self::fail('expected assertion failure'); + } catch (\Hamcrest\AssertionError $ex) { + self::assertEquals($expectedMessage, $ex->getMessage()); + self::assertEquals(1, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + } + + public function testAssertThatWithNoArgsThrowsErrorAndDoesntIncrementCount() + { + try { + \Hamcrest\MatcherAssert::assertThat(); + self::fail('expected invalid argument exception'); + } catch (\InvalidArgumentException $ex) { + self::assertEquals(0, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + } + + public function testAssertThatWithFourArgsThrowsErrorAndDoesntIncrementCount() + { + try { + \Hamcrest\MatcherAssert::assertThat(1, 2, 3, 4); + self::fail('expected invalid argument exception'); + } catch (\InvalidArgumentException $ex) { + self::assertEquals(0, \Hamcrest\MatcherAssert::getCount(), 'assertion count'); + } + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Number/IsCloseToTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Number/IsCloseToTest.php new file mode 100644 index 0000000..987d552 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Number/IsCloseToTest.php @@ -0,0 +1,27 @@ +assertTrue($p->matches(1.0)); + $this->assertTrue($p->matches(0.5)); + $this->assertTrue($p->matches(1.5)); + + $this->assertDoesNotMatch($p, 2.0, 'too large'); + $this->assertMismatchDescription('<2F> differed by <0.5F>', $p, 2.0); + $this->assertDoesNotMatch($p, 0.0, 'number too small'); + $this->assertMismatchDescription('<0F> differed by <0.5F>', $p, 0.0); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Number/OrderingComparisonTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Number/OrderingComparisonTest.php new file mode 100644 index 0000000..a4c94d3 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Number/OrderingComparisonTest.php @@ -0,0 +1,41 @@ +_text = $text; + } + + public function describeTo(\Hamcrest\Description $description) + { + $description->appendText($this->_text); + } +} + +class StringDescriptionTest extends \PhpUnit_Framework_TestCase +{ + + private $_description; + + public function setUp() + { + $this->_description = new \Hamcrest\StringDescription(); + } + + public function testAppendTextAppendsTextInformation() + { + $this->_description->appendText('foo')->appendText('bar'); + $this->assertEquals('foobar', (string) $this->_description); + } + + public function testAppendValueCanAppendTextTypes() + { + $this->_description->appendValue('foo'); + $this->assertEquals('"foo"', (string) $this->_description); + } + + public function testSpecialCharactersAreEscapedForStringTypes() + { + $this->_description->appendValue("foo\\bar\"zip\r\n"); + $this->assertEquals('"foo\\bar\\"zip\r\n"', (string) $this->_description); + } + + public function testIntegerValuesCanBeAppended() + { + $this->_description->appendValue(42); + $this->assertEquals('<42>', (string) $this->_description); + } + + public function testFloatValuesCanBeAppended() + { + $this->_description->appendValue(42.78); + $this->assertEquals('<42.78F>', (string) $this->_description); + } + + public function testNullValuesCanBeAppended() + { + $this->_description->appendValue(null); + $this->assertEquals('null', (string) $this->_description); + } + + public function testArraysCanBeAppended() + { + $this->_description->appendValue(array('foo', 42.78)); + $this->assertEquals('["foo", <42.78F>]', (string) $this->_description); + } + + public function testObjectsCanBeAppended() + { + $this->_description->appendValue(new \stdClass()); + $this->assertEquals('', (string) $this->_description); + } + + public function testBooleanValuesCanBeAppended() + { + $this->_description->appendValue(false); + $this->assertEquals('', (string) $this->_description); + } + + public function testListsOfvaluesCanBeAppended() + { + $this->_description->appendValue(array('foo', 42.78)); + $this->assertEquals('["foo", <42.78F>]', (string) $this->_description); + } + + public function testIterableOfvaluesCanBeAppended() + { + $items = new \ArrayObject(array('foo', 42.78)); + $this->_description->appendValue($items); + $this->assertEquals('["foo", <42.78F>]', (string) $this->_description); + } + + public function testIteratorOfvaluesCanBeAppended() + { + $items = new \ArrayObject(array('foo', 42.78)); + $this->_description->appendValue($items->getIterator()); + $this->assertEquals('["foo", <42.78F>]', (string) $this->_description); + } + + public function testListsOfvaluesCanBeAppendedManually() + { + $this->_description->appendValueList('@start@', '@sep@ ', '@end@', array('foo', 42.78)); + $this->assertEquals('@start@"foo"@sep@ <42.78F>@end@', (string) $this->_description); + } + + public function testIterableOfvaluesCanBeAppendedManually() + { + $items = new \ArrayObject(array('foo', 42.78)); + $this->_description->appendValueList('@start@', '@sep@ ', '@end@', $items); + $this->assertEquals('@start@"foo"@sep@ <42.78F>@end@', (string) $this->_description); + } + + public function testIteratorOfvaluesCanBeAppendedManually() + { + $items = new \ArrayObject(array('foo', 42.78)); + $this->_description->appendValueList('@start@', '@sep@ ', '@end@', $items->getIterator()); + $this->assertEquals('@start@"foo"@sep@ <42.78F>@end@', (string) $this->_description); + } + + public function testSelfDescribingObjectsCanBeAppended() + { + $this->_description + ->appendDescriptionOf(new \Hamcrest\SampleSelfDescriber('foo')) + ->appendDescriptionOf(new \Hamcrest\SampleSelfDescriber('bar')) + ; + $this->assertEquals('foobar', (string) $this->_description); + } + + public function testSelfDescribingObjectsCanBeAppendedAsLists() + { + $this->_description->appendList('@start@', '@sep@ ', '@end@', array( + new \Hamcrest\SampleSelfDescriber('foo'), + new \Hamcrest\SampleSelfDescriber('bar') + )); + $this->assertEquals('@start@foo@sep@ bar@end@', (string) $this->_description); + } + + public function testSelfDescribingObjectsCanBeAppendedAsIteratedLists() + { + $items = new \ArrayObject(array( + new \Hamcrest\SampleSelfDescriber('foo'), + new \Hamcrest\SampleSelfDescriber('bar') + )); + $this->_description->appendList('@start@', '@sep@ ', '@end@', $items); + $this->assertEquals('@start@foo@sep@ bar@end@', (string) $this->_description); + } + + public function testSelfDescribingObjectsCanBeAppendedAsIterators() + { + $items = new \ArrayObject(array( + new \Hamcrest\SampleSelfDescriber('foo'), + new \Hamcrest\SampleSelfDescriber('bar') + )); + $this->_description->appendList('@start@', '@sep@ ', '@end@', $items->getIterator()); + $this->assertEquals('@start@foo@sep@ bar@end@', (string) $this->_description); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEmptyStringTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEmptyStringTest.php new file mode 100644 index 0000000..8d5c56b --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEmptyStringTest.php @@ -0,0 +1,86 @@ +assertDoesNotMatch(emptyString(), null, 'null'); + } + + public function testEmptyDoesNotMatchZero() + { + $this->assertDoesNotMatch(emptyString(), 0, 'zero'); + } + + public function testEmptyDoesNotMatchFalse() + { + $this->assertDoesNotMatch(emptyString(), false, 'false'); + } + + public function testEmptyDoesNotMatchEmptyArray() + { + $this->assertDoesNotMatch(emptyString(), array(), 'empty array'); + } + + public function testEmptyMatchesEmptyString() + { + $this->assertMatches(emptyString(), '', 'empty string'); + } + + public function testEmptyDoesNotMatchNonEmptyString() + { + $this->assertDoesNotMatch(emptyString(), 'foo', 'non-empty string'); + } + + public function testEmptyHasAReadableDescription() + { + $this->assertDescription('an empty string', emptyString()); + } + + public function testEmptyOrNullMatchesNull() + { + $this->assertMatches(nullOrEmptyString(), null, 'null'); + } + + public function testEmptyOrNullMatchesEmptyString() + { + $this->assertMatches(nullOrEmptyString(), '', 'empty string'); + } + + public function testEmptyOrNullDoesNotMatchNonEmptyString() + { + $this->assertDoesNotMatch(nullOrEmptyString(), 'foo', 'non-empty string'); + } + + public function testEmptyOrNullHasAReadableDescription() + { + $this->assertDescription('(null or an empty string)', nullOrEmptyString()); + } + + public function testNonEmptyDoesNotMatchNull() + { + $this->assertDoesNotMatch(nonEmptyString(), null, 'null'); + } + + public function testNonEmptyDoesNotMatchEmptyString() + { + $this->assertDoesNotMatch(nonEmptyString(), '', 'empty string'); + } + + public function testNonEmptyMatchesNonEmptyString() + { + $this->assertMatches(nonEmptyString(), 'foo', 'non-empty string'); + } + + public function testNonEmptyHasAReadableDescription() + { + $this->assertDescription('a non-empty string', nonEmptyString()); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEqualIgnoringCaseTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEqualIgnoringCaseTest.php new file mode 100644 index 0000000..0539fd5 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEqualIgnoringCaseTest.php @@ -0,0 +1,40 @@ +assertDescription( + 'equalToIgnoringCase("heLLo")', + equalToIgnoringCase('heLLo') + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php new file mode 100644 index 0000000..6c2304f --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php @@ -0,0 +1,51 @@ +_matcher = \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace( + "Hello World how\n are we? " + ); + } + + protected function createMatcher() + { + return $this->_matcher; + } + + public function testPassesIfWordsAreSameButWhitespaceDiffers() + { + assertThat('Hello World how are we?', $this->_matcher); + assertThat(" Hello \rWorld \t how are\nwe?", $this->_matcher); + } + + public function testFailsIfTextOtherThanWhitespaceDiffers() + { + assertThat('Hello PLANET how are we?', not($this->_matcher)); + assertThat('Hello World how are we', not($this->_matcher)); + } + + public function testFailsIfWhitespaceIsAddedOrRemovedInMidWord() + { + assertThat('HelloWorld how are we?', not($this->_matcher)); + assertThat('Hello Wo rld how are we?', not($this->_matcher)); + } + + public function testFailsIfMatchingAgainstNull() + { + assertThat(null, not($this->_matcher)); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + "equalToIgnoringWhiteSpace(\"Hello World how\\n are we? \")", + $this->_matcher + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/MatchesPatternTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/MatchesPatternTest.php new file mode 100644 index 0000000..4891598 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/MatchesPatternTest.php @@ -0,0 +1,30 @@ +assertDescription('a string matching "pattern"', matchesPattern('pattern')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php new file mode 100644 index 0000000..3b5b08e --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php @@ -0,0 +1,80 @@ +_stringContains = \Hamcrest\Text\StringContainsIgnoringCase::containsStringIgnoringCase( + strtolower(self::EXCERPT) + ); + } + + protected function createMatcher() + { + return $this->_stringContains; + } + + public function testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring() + { + $this->assertTrue( + $this->_stringContains->matches(self::EXCERPT . 'END'), + 'should be true if excerpt at beginning' + ); + $this->assertTrue( + $this->_stringContains->matches('START' . self::EXCERPT), + 'should be true if excerpt at end' + ); + $this->assertTrue( + $this->_stringContains->matches('START' . self::EXCERPT . 'END'), + 'should be true if excerpt in middle' + ); + $this->assertTrue( + $this->_stringContains->matches(self::EXCERPT . self::EXCERPT), + 'should be true if excerpt is repeated' + ); + + $this->assertFalse( + $this->_stringContains->matches('Something else'), + 'should not be true if excerpt is not in string' + ); + $this->assertFalse( + $this->_stringContains->matches(substr(self::EXCERPT, 1)), + 'should not be true if part of excerpt is in string' + ); + } + + public function testEvaluatesToTrueIfArgumentIsEqualToSubstring() + { + $this->assertTrue( + $this->_stringContains->matches(self::EXCERPT), + 'should be true if excerpt is entire string' + ); + } + + public function testEvaluatesToTrueIfArgumentContainsExactSubstring() + { + $this->assertTrue( + $this->_stringContains->matches(strtolower(self::EXCERPT)), + 'should be false if excerpt is entire string ignoring case' + ); + $this->assertTrue( + $this->_stringContains->matches('START' . strtolower(self::EXCERPT) . 'END'), + 'should be false if excerpt is contained in string ignoring case' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + 'a string containing in any case "' + . strtolower(self::EXCERPT) . '"', + $this->_stringContains + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsInOrderTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsInOrderTest.php new file mode 100644 index 0000000..0be7062 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsInOrderTest.php @@ -0,0 +1,42 @@ +_m = \Hamcrest\Text\StringContainsInOrder::stringContainsInOrder(array('a', 'b', 'c')); + } + + protected function createMatcher() + { + return $this->_m; + } + + public function testMatchesOnlyIfStringContainsGivenSubstringsInTheSameOrder() + { + $this->assertMatches($this->_m, 'abc', 'substrings in order'); + $this->assertMatches($this->_m, '1a2b3c4', 'substrings separated'); + + $this->assertDoesNotMatch($this->_m, 'cab', 'substrings out of order'); + $this->assertDoesNotMatch($this->_m, 'xyz', 'no substrings in string'); + $this->assertDoesNotMatch($this->_m, 'ac', 'substring missing'); + $this->assertDoesNotMatch($this->_m, '', 'empty string'); + } + + public function testAcceptsVariableArguments() + { + $this->assertMatches(stringContainsInOrder('a', 'b', 'c'), 'abc', 'substrings as variable arguments'); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + 'a string containing "a", "b", "c" in order', + $this->_m + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsTest.php new file mode 100644 index 0000000..203fd91 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringContainsTest.php @@ -0,0 +1,86 @@ +_stringContains = \Hamcrest\Text\StringContains::containsString(self::EXCERPT); + } + + protected function createMatcher() + { + return $this->_stringContains; + } + + public function testEvaluatesToTrueIfArgumentContainsSubstring() + { + $this->assertTrue( + $this->_stringContains->matches(self::EXCERPT . 'END'), + 'should be true if excerpt at beginning' + ); + $this->assertTrue( + $this->_stringContains->matches('START' . self::EXCERPT), + 'should be true if excerpt at end' + ); + $this->assertTrue( + $this->_stringContains->matches('START' . self::EXCERPT . 'END'), + 'should be true if excerpt in middle' + ); + $this->assertTrue( + $this->_stringContains->matches(self::EXCERPT . self::EXCERPT), + 'should be true if excerpt is repeated' + ); + + $this->assertFalse( + $this->_stringContains->matches('Something else'), + 'should not be true if excerpt is not in string' + ); + $this->assertFalse( + $this->_stringContains->matches(substr(self::EXCERPT, 1)), + 'should not be true if part of excerpt is in string' + ); + } + + public function testEvaluatesToTrueIfArgumentIsEqualToSubstring() + { + $this->assertTrue( + $this->_stringContains->matches(self::EXCERPT), + 'should be true if excerpt is entire string' + ); + } + + public function testEvaluatesToFalseIfArgumentContainsSubstringIgnoringCase() + { + $this->assertFalse( + $this->_stringContains->matches(strtolower(self::EXCERPT)), + 'should be false if excerpt is entire string ignoring case' + ); + $this->assertFalse( + $this->_stringContains->matches('START' . strtolower(self::EXCERPT) . 'END'), + 'should be false if excerpt is contained in string ignoring case' + ); + } + + public function testIgnoringCaseReturnsCorrectMatcher() + { + $this->assertTrue( + $this->_stringContains->ignoringCase()->matches('EXceRpT'), + 'should be true if excerpt is entire string ignoring case' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + 'a string containing "' + . self::EXCERPT . '"', + $this->_stringContains + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringEndsWithTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringEndsWithTest.php new file mode 100644 index 0000000..fffa3c9 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringEndsWithTest.php @@ -0,0 +1,62 @@ +_stringEndsWith = \Hamcrest\Text\StringEndsWith::endsWith(self::EXCERPT); + } + + protected function createMatcher() + { + return $this->_stringEndsWith; + } + + public function testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring() + { + $this->assertFalse( + $this->_stringEndsWith->matches(self::EXCERPT . 'END'), + 'should be false if excerpt at beginning' + ); + $this->assertTrue( + $this->_stringEndsWith->matches('START' . self::EXCERPT), + 'should be true if excerpt at end' + ); + $this->assertFalse( + $this->_stringEndsWith->matches('START' . self::EXCERPT . 'END'), + 'should be false if excerpt in middle' + ); + $this->assertTrue( + $this->_stringEndsWith->matches(self::EXCERPT . self::EXCERPT), + 'should be true if excerpt is at end and repeated' + ); + + $this->assertFalse( + $this->_stringEndsWith->matches('Something else'), + 'should be false if excerpt is not in string' + ); + $this->assertFalse( + $this->_stringEndsWith->matches(substr(self::EXCERPT, 0, strlen(self::EXCERPT) - 2)), + 'should be false if part of excerpt is at end of string' + ); + } + + public function testEvaluatesToTrueIfArgumentIsEqualToSubstring() + { + $this->assertTrue( + $this->_stringEndsWith->matches(self::EXCERPT), + 'should be true if excerpt is entire string' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('a string ending with "EXCERPT"', $this->_stringEndsWith); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringStartsWithTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringStartsWithTest.php new file mode 100644 index 0000000..fc3761b --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Text/StringStartsWithTest.php @@ -0,0 +1,62 @@ +_stringStartsWith = \Hamcrest\Text\StringStartsWith::startsWith(self::EXCERPT); + } + + protected function createMatcher() + { + return $this->_stringStartsWith; + } + + public function testEvaluatesToTrueIfArgumentContainsSpecifiedSubstring() + { + $this->assertTrue( + $this->_stringStartsWith->matches(self::EXCERPT . 'END'), + 'should be true if excerpt at beginning' + ); + $this->assertFalse( + $this->_stringStartsWith->matches('START' . self::EXCERPT), + 'should be false if excerpt at end' + ); + $this->assertFalse( + $this->_stringStartsWith->matches('START' . self::EXCERPT . 'END'), + 'should be false if excerpt in middle' + ); + $this->assertTrue( + $this->_stringStartsWith->matches(self::EXCERPT . self::EXCERPT), + 'should be true if excerpt is at beginning and repeated' + ); + + $this->assertFalse( + $this->_stringStartsWith->matches('Something else'), + 'should be false if excerpt is not in string' + ); + $this->assertFalse( + $this->_stringStartsWith->matches(substr(self::EXCERPT, 1)), + 'should be false if part of excerpt is at start of string' + ); + } + + public function testEvaluatesToTrueIfArgumentIsEqualToSubstring() + { + $this->assertTrue( + $this->_stringStartsWith->matches(self::EXCERPT), + 'should be true if excerpt is entire string' + ); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('a string starting with "EXCERPT"', $this->_stringStartsWith); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsArrayTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsArrayTest.php new file mode 100644 index 0000000..d13c24d --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsArrayTest.php @@ -0,0 +1,35 @@ +assertDescription('an array', arrayValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', arrayValue(), null); + $this->assertMismatchDescription('was a string "foo"', arrayValue(), 'foo'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsBooleanTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsBooleanTest.php new file mode 100644 index 0000000..24309fc --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsBooleanTest.php @@ -0,0 +1,35 @@ +assertDescription('a boolean', booleanValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', booleanValue(), null); + $this->assertMismatchDescription('was a string "foo"', booleanValue(), 'foo'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsCallableTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsCallableTest.php new file mode 100644 index 0000000..5098e21 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsCallableTest.php @@ -0,0 +1,103 @@ +=')) { + $this->markTestSkipped('Closures require php 5.3'); + } + eval('assertThat(function () {}, callableValue());'); + } + + public function testEvaluatesToTrueIfArgumentImplementsInvoke() + { + if (!version_compare(PHP_VERSION, '5.3', '>=')) { + $this->markTestSkipped('Magic method __invoke() requires php 5.3'); + } + assertThat($this, callableValue()); + } + + public function testEvaluatesToFalseIfArgumentIsInvalidFunctionName() + { + if (function_exists('not_a_Hamcrest_function')) { + $this->markTestSkipped('Function "not_a_Hamcrest_function" must not exist'); + } + + assertThat('not_a_Hamcrest_function', not(callableValue())); + } + + public function testEvaluatesToFalseIfArgumentIsInvalidStaticMethodCallback() + { + assertThat( + array('Hamcrest\Type\IsCallableTest', 'noMethod'), + not(callableValue()) + ); + } + + public function testEvaluatesToFalseIfArgumentIsInvalidInstanceMethodCallback() + { + assertThat(array($this, 'noMethod'), not(callableValue())); + } + + public function testEvaluatesToFalseIfArgumentDoesntImplementInvoke() + { + assertThat(new \stdClass(), not(callableValue())); + } + + public function testEvaluatesToFalseIfArgumentDoesntMatchType() + { + assertThat(false, not(callableValue())); + assertThat(5.2, not(callableValue())); + } + + public function testHasAReadableDescription() + { + $this->assertDescription('a callable', callableValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription( + 'was a string "invalid-function"', + callableValue(), + 'invalid-function' + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsDoubleTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsDoubleTest.php new file mode 100644 index 0000000..85c2a96 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsDoubleTest.php @@ -0,0 +1,35 @@ +assertDescription('a double', doubleValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', doubleValue(), null); + $this->assertMismatchDescription('was a string "foo"', doubleValue(), 'foo'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsIntegerTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsIntegerTest.php new file mode 100644 index 0000000..ce5a51a --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsIntegerTest.php @@ -0,0 +1,36 @@ +assertDescription('an integer', integerValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', integerValue(), null); + $this->assertMismatchDescription('was a string "foo"', integerValue(), 'foo'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsNumericTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsNumericTest.php new file mode 100644 index 0000000..1fd83ef --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsNumericTest.php @@ -0,0 +1,53 @@ +assertDescription('a number', numericValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', numericValue(), null); + $this->assertMismatchDescription('was a string "foo"', numericValue(), 'foo'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsObjectTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsObjectTest.php new file mode 100644 index 0000000..a3b617c --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsObjectTest.php @@ -0,0 +1,34 @@ +assertDescription('an object', objectValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', objectValue(), null); + $this->assertMismatchDescription('was a string "foo"', objectValue(), 'foo'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsResourceTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsResourceTest.php new file mode 100644 index 0000000..d6ea534 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsResourceTest.php @@ -0,0 +1,34 @@ +assertDescription('a resource', resourceValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', resourceValue(), null); + $this->assertMismatchDescription('was a string "foo"', resourceValue(), 'foo'); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsScalarTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsScalarTest.php new file mode 100644 index 0000000..72a188d --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsScalarTest.php @@ -0,0 +1,39 @@ +assertDescription('a scalar', scalarValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', scalarValue(), null); + $this->assertMismatchDescription('was an array ["foo"]', scalarValue(), array('foo')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsStringTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsStringTest.php new file mode 100644 index 0000000..557d591 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Type/IsStringTest.php @@ -0,0 +1,35 @@ +assertDescription('a string', stringValue()); + } + + public function testDecribesActualTypeInMismatchMessage() + { + $this->assertMismatchDescription('was null', stringValue(), null); + $this->assertMismatchDescription('was a double <5.2F>', stringValue(), 5.2); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/UtilTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/UtilTest.php new file mode 100644 index 0000000..0c2cd04 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/UtilTest.php @@ -0,0 +1,80 @@ +assertSame($matcher, $newMatcher); + } + + public function testWrapValueWithIsEqualWrapsPrimitive() + { + $matcher = \Hamcrest\Util::wrapValueWithIsEqual('foo'); + $this->assertInstanceOf('Hamcrest\Core\IsEqual', $matcher); + $this->assertTrue($matcher->matches('foo')); + } + + public function testCheckAllAreMatchersAcceptsMatchers() + { + \Hamcrest\Util::checkAllAreMatchers(array( + new \Hamcrest\Text\MatchesPattern('/fo+/'), + new \Hamcrest\Core\IsEqual('foo'), + )); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testCheckAllAreMatchersFailsForPrimitive() + { + \Hamcrest\Util::checkAllAreMatchers(array( + new \Hamcrest\Text\MatchesPattern('/fo+/'), + 'foo', + )); + } + + private function callAndAssertCreateMatcherArray($items) + { + $matchers = \Hamcrest\Util::createMatcherArray($items); + $this->assertInternalType('array', $matchers); + $this->assertSameSize($items, $matchers); + foreach ($matchers as $matcher) { + $this->assertInstanceOf('\Hamcrest\Matcher', $matcher); + } + + return $matchers; + } + + public function testCreateMatcherArrayLeavesMatchersUntouched() + { + $matcher = new \Hamcrest\Text\MatchesPattern('/fo+/'); + $items = array($matcher); + $matchers = $this->callAndAssertCreateMatcherArray($items); + $this->assertSame($matcher, $matchers[0]); + } + + public function testCreateMatcherArrayWrapsPrimitiveWithIsEqualMatcher() + { + $matchers = $this->callAndAssertCreateMatcherArray(array('foo')); + $this->assertInstanceOf('Hamcrest\Core\IsEqual', $matchers[0]); + $this->assertTrue($matchers[0]->matches('foo')); + } + + public function testCreateMatcherArrayDoesntModifyOriginalArray() + { + $items = array('foo'); + $this->callAndAssertCreateMatcherArray($items); + $this->assertSame('foo', $items[0]); + } + + public function testCreateMatcherArrayUnwrapsSingleArrayElement() + { + $matchers = $this->callAndAssertCreateMatcherArray(array(array('foo'))); + $this->assertInstanceOf('Hamcrest\Core\IsEqual', $matchers[0]); + $this->assertTrue($matchers[0]->matches('foo')); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Xml/HasXPathTest.php b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Xml/HasXPathTest.php new file mode 100644 index 0000000..6774887 --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Xml/HasXPathTest.php @@ -0,0 +1,198 @@ + + + + alice + Alice Frankel + admin + + + bob + Bob Frankel + user + + + charlie + Charlie Chan + user + + +XML; + self::$doc = new \DOMDocument(); + self::$doc->loadXML(self::$xml); + + self::$html = << + + Home Page + + +

Heading

+

Some text

+ + +HTML; + } + + protected function createMatcher() + { + return \Hamcrest\Xml\HasXPath::hasXPath('/users/user'); + } + + public function testMatchesWhenXPathIsFound() + { + assertThat('one match', self::$doc, hasXPath('user[id = "bob"]')); + assertThat('two matches', self::$doc, hasXPath('user[role = "user"]')); + } + + public function testDoesNotMatchWhenXPathIsNotFound() + { + assertThat( + 'no match', + self::$doc, + not(hasXPath('user[contains(id, "frank")]')) + ); + } + + public function testMatchesWhenExpressionWithoutMatcherEvaluatesToTrue() + { + assertThat( + 'one match', + self::$doc, + hasXPath('count(user[id = "bob"])') + ); + } + + public function testDoesNotMatchWhenExpressionWithoutMatcherEvaluatesToFalse() + { + assertThat( + 'no matches', + self::$doc, + not(hasXPath('count(user[id = "frank"])')) + ); + } + + public function testMatchesWhenExpressionIsEqual() + { + assertThat( + 'one match', + self::$doc, + hasXPath('count(user[id = "bob"])', 1) + ); + assertThat( + 'two matches', + self::$doc, + hasXPath('count(user[role = "user"])', 2) + ); + } + + public function testDoesNotMatchWhenExpressionIsNotEqual() + { + assertThat( + 'no match', + self::$doc, + not(hasXPath('count(user[id = "frank"])', 2)) + ); + assertThat( + 'one match', + self::$doc, + not(hasXPath('count(user[role = "admin"])', 2)) + ); + } + + public function testMatchesWhenContentMatches() + { + assertThat( + 'one match', + self::$doc, + hasXPath('user/name', containsString('ice')) + ); + assertThat( + 'two matches', + self::$doc, + hasXPath('user/role', equalTo('user')) + ); + } + + public function testDoesNotMatchWhenContentDoesNotMatch() + { + assertThat( + 'no match', + self::$doc, + not(hasXPath('user/name', containsString('Bobby'))) + ); + assertThat( + 'no matches', + self::$doc, + not(hasXPath('user/role', equalTo('owner'))) + ); + } + + public function testProvidesConvenientShortcutForHasXPathEqualTo() + { + assertThat('matches', self::$doc, hasXPath('count(user)', 3)); + assertThat('matches', self::$doc, hasXPath('user[2]/id', 'bob')); + } + + public function testProvidesConvenientShortcutForHasXPathCountEqualTo() + { + assertThat('matches', self::$doc, hasXPath('user[id = "charlie"]', 1)); + } + + public function testMatchesAcceptsXmlString() + { + assertThat('accepts XML string', self::$xml, hasXPath('user')); + } + + public function testMatchesAcceptsHtmlString() + { + assertThat('accepts HTML string', self::$html, hasXPath('body/h1', 'Heading')); + } + + public function testHasAReadableDescription() + { + $this->assertDescription( + 'XML or HTML document with XPath "/users/user"', + hasXPath('/users/user') + ); + $this->assertDescription( + 'XML or HTML document with XPath "count(/users/user)" <2>', + hasXPath('/users/user', 2) + ); + $this->assertDescription( + 'XML or HTML document with XPath "/users/user/name"' + . ' a string starting with "Alice"', + hasXPath('/users/user/name', startsWith('Alice')) + ); + } + + public function testHasAReadableMismatchDescription() + { + $this->assertMismatchDescription( + 'XPath returned no results', + hasXPath('/users/name'), + self::$doc + ); + $this->assertMismatchDescription( + 'XPath expression result was <3F>', + hasXPath('/users/user', 2), + self::$doc + ); + $this->assertMismatchDescription( + 'XPath returned ["alice", "bob", "charlie"]', + hasXPath('/users/user/id', 'Frank'), + self::$doc + ); + } +} diff --git a/vendor/hamcrest/hamcrest-php/tests/bootstrap.php b/vendor/hamcrest/hamcrest-php/tests/bootstrap.php new file mode 100644 index 0000000..bc4958d --- /dev/null +++ b/vendor/hamcrest/hamcrest-php/tests/bootstrap.php @@ -0,0 +1,11 @@ + + + + . + + + + + + ../hamcrest + + + diff --git a/vendor/hassankhan/config/.scrutinizer.yml b/vendor/hassankhan/config/.scrutinizer.yml new file mode 100644 index 0000000..cf46d83 --- /dev/null +++ b/vendor/hassankhan/config/.scrutinizer.yml @@ -0,0 +1,35 @@ +filter: + excluded_paths: [tests/*] +checks: + php: + code_rating: true + remove_extra_empty_lines: true + remove_php_closing_tag: true + remove_trailing_whitespace: true + fix_use_statements: + remove_unused: true + preserve_multiple: false + preserve_blanklines: true + order_alphabetically: true + fix_php_opening_tag: true + fix_linefeed: true + fix_line_ending: true + fix_identation_4spaces: true + fix_doc_comments: true +tools: + external_code_coverage: + timeout: 600 + runs: 3 + php_analyzer: true + php_code_coverage: false + php_code_sniffer: + config: + standard: PSR2 + filter: + paths: ['src'] + php_loc: + enabled: true + excluded_dirs: [vendor, tests] + php_cpd: + enabled: true + excluded_dirs: [vendor, tests] diff --git a/vendor/hassankhan/config/CHANGELOG.md b/vendor/hassankhan/config/CHANGELOG.md new file mode 100644 index 0000000..3e9a2dd --- /dev/null +++ b/vendor/hassankhan/config/CHANGELOG.md @@ -0,0 +1,133 @@ +# Changelog + +All notable changes to `Config` will be documented in this file + +## 0.10.0 - 2016-02-11 + +### Added +- Package-level exceptions so callers can catch exceptions at package-level +- Added support for files suffixed with the `.dist` extension + +### Fixed +- Rearranged error-handling in `FileParser\Json` for better test coverage +- Project-wide code style fixes to adhere to PSR-2 +- Fixes `has()` method returning `false` on `null` values in a config field + +## 0.9.1 - 2016-01-23 + +### Added +- PHP 7.0 is now tested on Travis + +## 0.9.0 - 2015-10-22 + +### Added +- Added namespace to example in `README.md` +- Added `has()` method to `ConfigInterface` and implemented in `AbstractConfig` +- Added `all()` method to `ConfigInterface` and implemented in `AbstractConfig` +- Added documentation for new methods +- `AbstractConfig` now implements the `Iterator` interface + +### Fixed +- PSR-2 compliance +- Give YamlParser file content instead of path +- Updated `AbstractConfig` constructor to only accept arrays +- Removed check to fix loading an empty array +- Fix for #44: Warnings emitted if configuration file is empty +- Fix for #55: Unset cache after a set + + +## 0.8.2 - 2015-03-21 + +### Fixed +- Some code smells in `Config` +- Updated README.md + + +## 0.8.1 - 2015-03-21 + +### Fixed +- Various things relating to recent repo transfer + + +## 0.8.0 - 2015-03-21 + +### Added +- Individual `FileParser` classes for each filetype, and a `FileParserInterface` to type-hint methods with +- Optional paths; you can now prefix a path with '?' and `Config` will skip the file if it doesn't exist + +### Fixed +- Made the Symfony YAML component a suggested dependency +- Parent constructor was not being called from `Config` + + +## 0.7.1 - 2015-02-24 + +### Added +- Moved file logic into file-specific loaders + +### Fixed +- Corrected class name in README.md + + +## 0.7.0 - 2015-02-23 + +### Fixed +- Removed kludgy hack for YAML/YML + + +## 0.6.0 - 2015-02-23 + +### Added +- Can now extend `AbstractConfig` to create simple subclasses without any file IO + + +## 0.5.0 - 2015-02-23 + +### Added +- Moved file logic into file-specific loaders + +### Fixed +- Cleaned up exception class constructors, PSR-2 compliance + + +## 0.4.0 - 2015-02-22 + +### Fixed +- Moved file logic into file-specific loaders + + +## 0.3.0 - 2015-02-22 + +### Fixed +- Created new classes `ConfigInterface` and `AbstractConfig` to simplify code + + +## 0.2.1 - 2015-02-22 + +### Added +- Array and directory support in constructor + +### Fixed +- Corrected deprecated usage of `Symfony\Yaml` + +## 0.2.0 - 2015-02-21 + +### Added +- Array and directory support in constructor + +### Fixed +- Now can load .YAML and .YML files + + +## 0.1.0 - 2014-11-27 + +### Added +- Uses PSR-4 for autoloading +- Supports YAML +- Now uses custom exceptions + + +## 0.0.1 - 2014-11-19 + +### Added +- Tagged first release diff --git a/vendor/hassankhan/config/CONTRIBUTING.md b/vendor/hassankhan/config/CONTRIBUTING.md new file mode 100644 index 0000000..5f9dabb --- /dev/null +++ b/vendor/hassankhan/config/CONTRIBUTING.md @@ -0,0 +1,32 @@ +# Contributing + +Contributions are **welcome** and will be fully **credited**. + +We accept contributions via Pull Requests on [GitHub](https://github.com/noodlehaus/config). + + +## Pull Requests + +- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). + +- **Add tests!** - Your patch won't be accepted if it doesn't have tests. + +- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. + +- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. + +- **Use Git Flow** - Don't ask us to pull from your master branch. Set up [Git Flow](http://nvie.com/posts/a-successful-git-branching-model/) and create a new feature branch from `develop` + +- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. + +- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting. + + +## Running Tests + +``` bash +$ phpunit +``` + + +**Happy coding**! diff --git a/vendor/hassankhan/config/LICENSE.md b/vendor/hassankhan/config/LICENSE.md new file mode 100644 index 0000000..e26e6ee --- /dev/null +++ b/vendor/hassankhan/config/LICENSE.md @@ -0,0 +1,8 @@ +The MIT License (MIT) +Copyright © 2015 Hassan Khan + +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/hassankhan/config/composer.json b/vendor/hassankhan/config/composer.json new file mode 100644 index 0000000..73e3eba --- /dev/null +++ b/vendor/hassankhan/config/composer.json @@ -0,0 +1,36 @@ +{ + "name": "hassankhan/config", + "type": "library", + "description": "Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files", + "keywords": ["configuration", "config", "json", "yaml", "yml", "ini", "xml", "unframework", "microphp"], + "homepage": "http://hassankhan.me/config/", + "license": "MIT", + "authors": [ + { + "name": "Hassan Khan", + "role": "Developer", + "homepage": "http://hassankhan.me/" + } + ], + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "scrutinizer/ocular": "~1.1", + "squizlabs/php_codesniffer": "~2.2" + }, + "suggest": { + "symfony/yaml": "~2.5" + }, + "autoload": { + "psr-4": { + "Noodlehaus\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Noodlehaus\\Test\\": "tests" + } + } +} diff --git a/vendor/hassankhan/config/src/AbstractConfig.php b/vendor/hassankhan/config/src/AbstractConfig.php new file mode 100644 index 0000000..eecc69a --- /dev/null +++ b/vendor/hassankhan/config/src/AbstractConfig.php @@ -0,0 +1,265 @@ + + * @author Hassan Khan + * @link https://github.com/noodlehaus/config + * @license MIT + */ +abstract class AbstractConfig implements ArrayAccess, ConfigInterface, Iterator +{ + /** + * Stores the configuration data + * + * @var array|null + */ + protected $data = null; + + /** + * Caches the configuration data + * + * @var array + */ + protected $cache = array(); + + /** + * Constructor method and sets default options, if any + * + * @param array $data + */ + public function __construct(array $data) + { + $this->data = array_merge($this->getDefaults(), $data); + } + + /** + * Override this method in your own subclass to provide an array of default + * options and values + * + * @return array + * + * @codeCoverageIgnore + */ + protected function getDefaults() + { + return array(); + } + + /** + * ConfigInterface Methods + */ + + /** + * {@inheritDoc} + */ + public function get($key, $default = null) + { + if ($this->has($key)) { + return $this->cache[$key]; + } + + return $default; + } + + /** + * {@inheritDoc} + */ + public function set($key, $value) + { + $segs = explode('.', $key); + $root = &$this->data; + $cacheKey = ''; + + // Look for the key, creating nested keys if needed + while ($part = array_shift($segs)) { + if ($cacheKey != '') { + $cacheKey .= '.'; + } + $cacheKey .= $part; + if (!isset($root[$part]) && count($segs)) { + $root[$part] = array(); + } + $root = &$root[$part]; + + //Unset all old nested cache + if (isset($this->cache[$cacheKey])) { + unset($this->cache[$cacheKey]); + } + + //Unset all old nested cache in case of array + if (count($segs) == 0) { + foreach ($this->cache as $cacheLocalKey => $cacheValue) { + if (substr($cacheLocalKey, 0, strlen($cacheKey)) === $cacheKey) { + unset($this->cache[$cacheLocalKey]); + } + } + } + } + + // Assign value at target node + $this->cache[$key] = $root = $value; + } + + /** + * {@inheritDoc} + */ + public function has($key) + { + // Check if already cached + if (isset($this->cache[$key])) { + return true; + } + + $segments = explode('.', $key); + $root = $this->data; + + // nested case + foreach ($segments as $segment) { + if (array_key_exists($segment, $root)) { + $root = $root[$segment]; + continue; + } else { + return false; + } + } + + // Set cache for the given key + $this->cache[$key] = $root; + + return true; + } + + /** + * {@inheritDoc} + */ + public function all() + { + return $this->data; + } + + /** + * ArrayAccess Methods + */ + + /** + * Gets a value using the offset as a key + * + * @param string $offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return $this->get($offset); + } + + /** + * Checks if a key exists + * + * @param string $offset + * + * @return bool + */ + public function offsetExists($offset) + { + return $this->has($offset); + } + + /** + * Sets a value using the offset as a key + * + * @param string $offset + * @param mixed $value + * + * @return void + */ + public function offsetSet($offset, $value) + { + $this->set($offset, $value); + } + + /** + * Deletes a key and its value + * + * @param string $offset + * + * @return void + */ + public function offsetUnset($offset) + { + $this->set($offset, null); + } + + /** + * Iterator Methods + */ + + /** + * Returns the data array element referenced by its internal cursor + * + * @return mixed The element referenced by the data array's internal cursor. + * If the array is empty or there is no element at the cursor, the + * function returns false. If the array is undefined, the function + * returns null + */ + public function current() + { + return (is_array($this->data) ? current($this->data) : null); + } + + /** + * Returns the data array index referenced by its internal cursor + * + * @return mixed The index referenced by the data array's internal cursor. + * If the array is empty or undefined or there is no element at the + * cursor, the function returns null + */ + public function key() + { + return (is_array($this->data) ? key($this->data) : null); + } + + /** + * Moves the data array's internal cursor forward one element + * + * @return mixed The element referenced by the data array's internal cursor + * after the move is completed. If there are no more elements in the + * array after the move, the function returns false. If the data array + * is undefined, the function returns null + */ + public function next() + { + return (is_array($this->data) ? next($this->data) : null); + } + + /** + * Moves the data array's internal cursor to the first element + * + * @return mixed The element referenced by the data array's internal cursor + * after the move is completed. If the data array is empty, the function + * returns false. If the data array is undefined, the function returns + * null + */ + public function rewind() + { + return (is_array($this->data) ? reset($this->data) : null); + } + + /** + * Tests whether the iterator's current index is valid + * + * @return bool True if the current index is valid; false otherwise + */ + public function valid() + { + return (is_array($this->data) ? key($this->data) !== null : false); + } +} diff --git a/vendor/hassankhan/config/src/Config.php b/vendor/hassankhan/config/src/Config.php new file mode 100644 index 0000000..11be5bd --- /dev/null +++ b/vendor/hassankhan/config/src/Config.php @@ -0,0 +1,177 @@ + + * @author Hassan Khan + * @link https://github.com/noodlehaus/config + * @license MIT + */ +class Config extends AbstractConfig +{ + /** + * All file formats supported by Config + * + * @var array + */ + private $supportedFileParsers = array( + 'Noodlehaus\FileParser\Php', + 'Noodlehaus\FileParser\Ini', + 'Noodlehaus\FileParser\Json', + 'Noodlehaus\FileParser\Xml', + 'Noodlehaus\FileParser\Yaml' + ); + + /** + * Static method for loading a Config instance. + * + * @param string|array $path + * + * @return Config + */ + public static function load($path) + { + return new static($path); + } + + /** + * Loads a supported configuration file format. + * + * @param string|array $path + * + * @throws EmptyDirectoryException If `$path` is an empty directory + */ + public function __construct($path) + { + $paths = $this->getValidPath($path); + $this->data = array(); + + foreach ($paths as $path) { + + // Get file information + $info = pathinfo($path); + $parts = explode('.', $info['basename']); + $extension = array_pop($parts); + if ($extension === 'dist') { + $extension = array_pop($parts); + } + $parser = $this->getParser($extension); + + // Try and load file + $this->data = array_replace_recursive($this->data, (array) $parser->parse($path)); + } + + parent::__construct($this->data); + } + + /** + * Gets a parser for a given file extension + * + * @param string $extension + * + * @return Noodlehaus\FileParser\FileParserInterface + * + * @throws UnsupportedFormatException If `$path` is an unsupported file format + */ + private function getParser($extension) + { + $parser = null; + + foreach ($this->supportedFileParsers as $fileParser) { + $tempParser = new $fileParser; + + if (in_array($extension, $tempParser->getSupportedExtensions($extension))) { + $parser = $tempParser; + continue; + } + + } + + // If none exist, then throw an exception + if ($parser === null) { + throw new UnsupportedFormatException('Unsupported configuration format'); + } + + return $parser; + } + + /** + * Gets an array of paths + * + * @param array $path + * + * @return array + * + * @throws FileNotFoundException If a file is not found at `$path` + */ + private function getPathFromArray($path) + { + $paths = array(); + + foreach ($path as $unverifiedPath) { + try { + // Check if `$unverifiedPath` is optional + // If it exists, then it's added to the list + // If it doesn't, it throws an exception which we catch + if ($unverifiedPath[0] !== '?') { + $paths = array_merge($paths, $this->getValidPath($unverifiedPath)); + continue; + } + $optionalPath = ltrim($unverifiedPath, '?'); + $paths = array_merge($paths, $this->getValidPath($optionalPath)); + + } catch (FileNotFoundException $e) { + // If `$unverifiedPath` is optional, then skip it + if ($unverifiedPath[0] === '?') { + continue; + } + // Otherwise rethrow the exception + throw $e; + } + } + + return $paths; + } + + /** + * Checks `$path` to see if it is either an array, a directory, or a file + * + * @param string|array $path + * + * @return array + * + * @throws EmptyDirectoryException If `$path` is an empty directory + * + * @throws FileNotFoundException If a file is not found at `$path` + */ + private function getValidPath($path) + { + // If `$path` is array + if (is_array($path)) { + return $this->getPathFromArray($path); + } + + // If `$path` is a directory + if (is_dir($path)) { + $paths = glob($path . '/*.*'); + if (empty($paths)) { + throw new EmptyDirectoryException("Configuration directory: [$path] is empty"); + } + return $paths; + } + + // If `$path` is not a file, throw an exception + if (!file_exists($path)) { + throw new FileNotFoundException("Configuration file: [$path] cannot be found"); + } + return array($path); + } +} diff --git a/vendor/hassankhan/config/src/ConfigInterface.php b/vendor/hassankhan/config/src/ConfigInterface.php new file mode 100644 index 0000000..ac001df --- /dev/null +++ b/vendor/hassankhan/config/src/ConfigInterface.php @@ -0,0 +1,55 @@ + + * @author Hassan Khan + * @link https://github.com/noodlehaus/config + * @license MIT + */ +interface ConfigInterface +{ + /** + * Gets a configuration setting using a simple or nested key. + * Nested keys are similar to JSON paths that use the dot + * dot notation. + * + * @param string $key + * @param mixed $default + * + * @return mixed + */ + public function get($key, $default = null); + + /** + * Function for setting configuration values, using + * either simple or nested keys. + * + * @param string $key + * @param mixed $value + * + * @return void + */ + public function set($key, $value); + + /** + * Function for checking if configuration values exist, using + * either simple or nested keys. + * + * @param string $key + * + * @return boolean + */ + public function has($key); + + /** + * Get all of the configuration items + * + * @return array + */ + public function all(); +} diff --git a/vendor/hassankhan/config/src/ErrorException.php b/vendor/hassankhan/config/src/ErrorException.php new file mode 100644 index 0000000..83d13da --- /dev/null +++ b/vendor/hassankhan/config/src/ErrorException.php @@ -0,0 +1,7 @@ + + * @author Hassan Khan + * @link https://github.com/noodlehaus/config + * @license MIT + */ +abstract class AbstractFileParser implements FileParserInterface +{ + + /** + * Path to the config file + * + * @var string + */ + protected $path; + + /** + * Sets the path to the config file + * + * @param string $path + * + * @codeCoverageIgnore + */ + public function __construct($path) + { + $this->path = $path; + } +} diff --git a/vendor/hassankhan/config/src/FileParser/FileParserInterface.php b/vendor/hassankhan/config/src/FileParser/FileParserInterface.php new file mode 100644 index 0000000..e14c848 --- /dev/null +++ b/vendor/hassankhan/config/src/FileParser/FileParserInterface.php @@ -0,0 +1,31 @@ + + * @author Hassan Khan + * @link https://github.com/noodlehaus/config + * @license MIT + */ +interface FileParserInterface +{ + /** + * Parses a file from `$path` and gets its contents as an array + * + * @param string $path + * + * @return array + */ + public function parse($path); + + /** + * Returns an array of allowed file extensions for this parser + * + * @return array + */ + public function getSupportedExtensions(); +} diff --git a/vendor/hassankhan/config/src/FileParser/Ini.php b/vendor/hassankhan/config/src/FileParser/Ini.php new file mode 100644 index 0000000..0eb22ce --- /dev/null +++ b/vendor/hassankhan/config/src/FileParser/Ini.php @@ -0,0 +1,43 @@ + + * @author Hassan Khan + * @link https://github.com/noodlehaus/config + * @license MIT + */ +class Ini implements FileParserInterface +{ + /** + * {@inheritDoc} + * Parses an INI file as an array + * + * @throws ParseException If there is an error parsing the INI file + */ + public function parse($path) + { + $data = @parse_ini_file($path, true); + + if (!$data) { + $error = error_get_last(); + throw new ParseException($error); + } + + return $data; + } + + /** + * {@inheritDoc} + */ + public function getSupportedExtensions() + { + return array('ini'); + } +} diff --git a/vendor/hassankhan/config/src/FileParser/Json.php b/vendor/hassankhan/config/src/FileParser/Json.php new file mode 100644 index 0000000..1549871 --- /dev/null +++ b/vendor/hassankhan/config/src/FileParser/Json.php @@ -0,0 +1,52 @@ + + * @author Hassan Khan + * @link https://github.com/noodlehaus/config + * @license MIT + */ +class Json implements FileParserInterface +{ + /** + * {@inheritDoc} + * Loads a JSON file as an array + * + * @throws ParseException If there is an error parsing the JSON file + */ + public function parse($path) + { + $data = json_decode(file_get_contents($path), true); + + if (json_last_error() !== JSON_ERROR_NONE) { + $error_message = 'Syntax error'; + if (function_exists('json_last_error_msg')) { + $error_message = json_last_error_msg(); + } + + $error = array( + 'message' => $error_message, + 'type' => json_last_error(), + 'file' => $path, + ); + throw new ParseException($error); + } + + return $data; + } + + /** + * {@inheritDoc} + */ + public function getSupportedExtensions() + { + return array('json'); + } +} diff --git a/vendor/hassankhan/config/src/FileParser/Php.php b/vendor/hassankhan/config/src/FileParser/Php.php new file mode 100644 index 0000000..e5e1793 --- /dev/null +++ b/vendor/hassankhan/config/src/FileParser/Php.php @@ -0,0 +1,61 @@ + + * @author Hassan Khan + * @link https://github.com/noodlehaus/config + * @license MIT + */ +class Php implements FileParserInterface +{ + /** + * {@inheritDoc} + * Loads a PHP file and gets its' contents as an array + * + * @throws ParseException If the PHP file throws an exception + * @throws UnsupportedFormatException If the PHP file does not return an array + */ + public function parse($path) + { + // Require the file, if it throws an exception, rethrow it + try { + $temp = require $path; + } catch (Exception $exception) { + throw new ParseException( + array( + 'message' => 'PHP file threw an exception', + 'exception' => $exception, + ) + ); + } + + // If we have a callable, run it and expect an array back + if (is_callable($temp)) { + $temp = call_user_func($temp); + } + + // Check for array, if its anything else, throw an exception + if (!is_array($temp)) { + throw new UnsupportedFormatException('PHP file does not return an array'); + } + + return $temp; + } + + /** + * {@inheritDoc} + */ + public function getSupportedExtensions() + { + return array('php'); + } +} diff --git a/vendor/hassankhan/config/src/FileParser/Xml.php b/vendor/hassankhan/config/src/FileParser/Xml.php new file mode 100644 index 0000000..9532f1b --- /dev/null +++ b/vendor/hassankhan/config/src/FileParser/Xml.php @@ -0,0 +1,55 @@ + + * @author Hassan Khan + * @link https://github.com/noodlehaus/config + * @license MIT + */ +class Xml implements FileParserInterface +{ + /** + * {@inheritDoc} + * Parses an XML file as an array + * + * @throws ParseException If there is an error parsing the XML file + */ + public function parse($path) + { + libxml_use_internal_errors(true); + + $data = simplexml_load_file($path, null, LIBXML_NOERROR); + + if ($data === false) { + $errors = libxml_get_errors(); + $latestError = array_pop($errors); + $error = array( + 'message' => $latestError->message, + 'type' => $latestError->level, + 'code' => $latestError->code, + 'file' => $latestError->file, + 'line' => $latestError->line, + ); + throw new ParseException($error); + } + + $data = json_decode(json_encode($data), true); + + return $data; + } + + /** + * {@inheritDoc} + */ + public function getSupportedExtensions() + { + return array('xml'); + } +} diff --git a/vendor/hassankhan/config/src/FileParser/Yaml.php b/vendor/hassankhan/config/src/FileParser/Yaml.php new file mode 100644 index 0000000..fe18499 --- /dev/null +++ b/vendor/hassankhan/config/src/FileParser/Yaml.php @@ -0,0 +1,49 @@ + + * @author Hassan Khan + * @link https://github.com/noodlehaus/config + * @license MIT + */ +class Yaml implements FileParserInterface +{ + /** + * {@inheritDoc} + * Loads a YAML/YML file as an array + * + * @throws ParseException If If there is an error parsing the YAML file + */ + public function parse($path) + { + try { + $data = YamlParser::parse(file_get_contents($path)); + } catch (Exception $exception) { + throw new ParseException( + array( + 'message' => 'Error parsing YAML file', + 'exception' => $exception, + ) + ); + } + + return $data; + } + + /** + * {@inheritDoc} + */ + public function getSupportedExtensions() + { + return array('yaml', 'yml'); + } +} diff --git a/vendor/laravel/framework/LICENSE.md b/vendor/laravel/framework/LICENSE.md new file mode 100644 index 0000000..79810c8 --- /dev/null +++ b/vendor/laravel/framework/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Taylor Otwell + +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/laravel/framework/README.md b/vendor/laravel/framework/README.md new file mode 100644 index 0000000..834277a --- /dev/null +++ b/vendor/laravel/framework/README.md @@ -0,0 +1,45 @@ +

+ +

+Build Status +Total Downloads +Latest Stable Version +License +

+ +## About Laravel + +> **Note:** This repository contains the core code of the Laravel framework. If you want to build an application using Laravel 5, visit the main [Laravel repository](https://github.com/laravel/laravel). + +Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as: + +- [Simple, fast routing engine](https://laravel.com/docs/routing). +- [Powerful dependency injection container](https://laravel.com/docs/container). +- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. +- Database agnostic [schema migrations](https://laravel.com/docs/migrations). +- [Robust background job processing](https://laravel.com/docs/queues). +- [Real-time event broadcasting](https://laravel.com/docs/broadcasting). + +Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation gives you a complete toolset required to build any application with which you are tasked + +## Learning Laravel + +Laravel has the most extensive and thorough documentation and video tutorial library of any modern web application framework. The [Laravel documentation](https://laravel.com/docs) is in-depth and complete, making it a breeze to get started learning the framework. + +If you're not in the mood to read, [Laracasts](https://laracasts.com) contains over 1100 video tutorials covering a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library. + +## Contributing + +Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). + +## Code of Conduct + +In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](CODE_OF_CONDUCT.md). + +## Security Vulnerabilities + +If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed. + +## License + +The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). diff --git a/vendor/laravel/framework/composer.json b/vendor/laravel/framework/composer.json new file mode 100644 index 0000000..9e3b6ea --- /dev/null +++ b/vendor/laravel/framework/composer.json @@ -0,0 +1,143 @@ +{ + "name": "laravel/framework", + "description": "The Laravel Framework.", + "keywords": ["framework", "laravel"], + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "ext-mbstring": "*", + "ext-openssl": "*", + "doctrine/inflector": "^1.1", + "dragonmantank/cron-expression": "^2.0", + "erusev/parsedown": "^1.7", + "laravel/nexmo-notification-channel": "^1.0", + "laravel/slack-notification-channel": "^1.0", + "league/flysystem": "^1.0.8", + "monolog/monolog": "^1.12", + "nesbot/carbon": "^1.26.3", + "opis/closure": "^3.1", + "psr/container": "^1.0", + "psr/simple-cache": "^1.0", + "ramsey/uuid": "^3.7", + "swiftmailer/swiftmailer": "^6.0", + "symfony/console": "^4.1", + "symfony/debug": "^4.1", + "symfony/finder": "^4.1", + "symfony/http-foundation": "^4.1", + "symfony/http-kernel": "^4.1", + "symfony/process": "^4.1", + "symfony/routing": "^4.1", + "symfony/var-dumper": "^4.1", + "tijsverkoyen/css-to-inline-styles": "^2.2.1", + "vlucas/phpdotenv": "^2.2" + }, + "replace": { + "illuminate/auth": "self.version", + "illuminate/broadcasting": "self.version", + "illuminate/bus": "self.version", + "illuminate/cache": "self.version", + "illuminate/config": "self.version", + "illuminate/console": "self.version", + "illuminate/container": "self.version", + "illuminate/contracts": "self.version", + "illuminate/cookie": "self.version", + "illuminate/database": "self.version", + "illuminate/encryption": "self.version", + "illuminate/events": "self.version", + "illuminate/filesystem": "self.version", + "illuminate/hashing": "self.version", + "illuminate/http": "self.version", + "illuminate/log": "self.version", + "illuminate/mail": "self.version", + "illuminate/notifications": "self.version", + "illuminate/pagination": "self.version", + "illuminate/pipeline": "self.version", + "illuminate/queue": "self.version", + "illuminate/redis": "self.version", + "illuminate/routing": "self.version", + "illuminate/session": "self.version", + "illuminate/support": "self.version", + "illuminate/translation": "self.version", + "illuminate/validation": "self.version", + "illuminate/view": "self.version" + }, + "conflict": { + "tightenco/collect": "<5.5.33" + }, + "require-dev": { + "aws/aws-sdk-php": "^3.0", + "doctrine/dbal": "^2.6", + "filp/whoops": "^2.1.4", + "guzzlehttp/guzzle": "^6.3", + "league/flysystem-cached-adapter": "^1.0", + "mockery/mockery": "^1.0", + "moontoast/math": "^1.1", + "orchestra/testbench-core": "3.7.*", + "pda/pheanstalk": "^3.0", + "phpunit/phpunit": "^7.0", + "predis/predis": "^1.1.1", + "symfony/css-selector": "^4.1", + "symfony/dom-crawler": "^4.1", + "true/punycode": "^2.1" + }, + "autoload": { + "files": [ + "src/Illuminate/Foundation/helpers.php", + "src/Illuminate/Support/helpers.php" + ], + "psr-4": { + "Illuminate\\": "src/Illuminate/" + } + }, + "autoload-dev": { + "files": [ + "tests/Database/stubs/MigrationCreatorFakeMigration.php" + ], + "psr-4": { + "Illuminate\\Tests\\": "tests/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "suggest": { + "ext-pcntl": "Required to use all features of the queue worker.", + "ext-posix": "Required to use all features of the queue worker.", + "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (^3.0).", + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "filp/whoops": "Required for friendly error pages in development (^2.1.4).", + "fzaninotto/faker": "Required to use the eloquent factory builder (^1.4).", + "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (^6.0).", + "laravel/tinker": "Required to use the tinker console command (^1.0).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", + "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", + "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (^1.0).", + "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", + "moontoast/math": "Required to use ordered UUIDs (^1.1).", + "nexmo/client": "Required to use the Nexmo transport (^1.0).", + "pda/pheanstalk": "Required to use the beanstalk queue driver (^3.0).", + "predis/predis": "Required to use the redis cache and queue drivers (^1.0).", + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^3.0).", + "symfony/css-selector": "Required to use some of the crawler integration testing tools (^4.1).", + "symfony/dom-crawler": "Required to use most of the crawler integration testing tools (^4.1).", + "symfony/psr-http-message-bridge": "Required to psr7 bridging features (^1.0)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Access/AuthorizationException.php b/vendor/laravel/framework/src/Illuminate/Auth/Access/AuthorizationException.php new file mode 100644 index 0000000..dc0753e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Access/AuthorizationException.php @@ -0,0 +1,10 @@ +policies = $policies; + $this->container = $container; + $this->abilities = $abilities; + $this->userResolver = $userResolver; + $this->afterCallbacks = $afterCallbacks; + $this->beforeCallbacks = $beforeCallbacks; + } + + /** + * Determine if a given ability has been defined. + * + * @param string|array $ability + * @return bool + */ + public function has($ability) + { + $abilities = is_array($ability) ? $ability : func_get_args(); + + foreach ($abilities as $ability) { + if (! isset($this->abilities[$ability])) { + return false; + } + } + + return true; + } + + /** + * Define a new ability. + * + * @param string $ability + * @param callable|string $callback + * @return $this + * + * @throws \InvalidArgumentException + */ + public function define($ability, $callback) + { + if (is_callable($callback)) { + $this->abilities[$ability] = $callback; + } elseif (is_string($callback)) { + $this->abilities[$ability] = $this->buildAbilityCallback($ability, $callback); + } else { + throw new InvalidArgumentException("Callback must be a callable or a 'Class@method' string."); + } + + return $this; + } + + /** + * Define abilities for a resource. + * + * @param string $name + * @param string $class + * @param array|null $abilities + * @return $this + */ + public function resource($name, $class, array $abilities = null) + { + $abilities = $abilities ?: [ + 'view' => 'view', + 'create' => 'create', + 'update' => 'update', + 'delete' => 'delete', + ]; + + foreach ($abilities as $ability => $method) { + $this->define($name.'.'.$ability, $class.'@'.$method); + } + + return $this; + } + + /** + * Create the ability callback for a callback string. + * + * @param string $ability + * @param string $callback + * @return \Closure + */ + protected function buildAbilityCallback($ability, $callback) + { + return function () use ($ability, $callback) { + if (Str::contains($callback, '@')) { + [$class, $method] = Str::parseCallback($callback); + } else { + $class = $callback; + } + + $policy = $this->resolvePolicy($class); + + $arguments = func_get_args(); + + $user = array_shift($arguments); + + $result = $this->callPolicyBefore( + $policy, $user, $ability, $arguments + ); + + if (! is_null($result)) { + return $result; + } + + return isset($method) + ? $policy->{$method}(...func_get_args()) + : $policy(...func_get_args()); + }; + } + + /** + * Define a policy class for a given class type. + * + * @param string $class + * @param string $policy + * @return $this + */ + public function policy($class, $policy) + { + $this->policies[$class] = $policy; + + return $this; + } + + /** + * Register a callback to run before all Gate checks. + * + * @param callable $callback + * @return $this + */ + public function before(callable $callback) + { + $this->beforeCallbacks[] = $callback; + + return $this; + } + + /** + * Register a callback to run after all Gate checks. + * + * @param callable $callback + * @return $this + */ + public function after(callable $callback) + { + $this->afterCallbacks[] = $callback; + + return $this; + } + + /** + * Determine if the given ability should be granted for the current user. + * + * @param string $ability + * @param array|mixed $arguments + * @return bool + */ + public function allows($ability, $arguments = []) + { + return $this->check($ability, $arguments); + } + + /** + * Determine if the given ability should be denied for the current user. + * + * @param string $ability + * @param array|mixed $arguments + * @return bool + */ + public function denies($ability, $arguments = []) + { + return ! $this->allows($ability, $arguments); + } + + /** + * Determine if all of the given abilities should be granted for the current user. + * + * @param iterable|string $abilities + * @param array|mixed $arguments + * @return bool + */ + public function check($abilities, $arguments = []) + { + return collect($abilities)->every(function ($ability) use ($arguments) { + try { + return (bool) $this->raw($ability, $arguments); + } catch (AuthorizationException $e) { + return false; + } + }); + } + + /** + * Determine if any one of the given abilities should be granted for the current user. + * + * @param iterable|string $abilities + * @param array|mixed $arguments + * @return bool + */ + public function any($abilities, $arguments = []) + { + return collect($abilities)->contains(function ($ability) use ($arguments) { + return $this->check($ability, $arguments); + }); + } + + /** + * Determine if the given ability should be granted for the current user. + * + * @param string $ability + * @param array|mixed $arguments + * @return \Illuminate\Auth\Access\Response + * + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + public function authorize($ability, $arguments = []) + { + $result = $this->raw($ability, $arguments); + + if ($result instanceof Response) { + return $result; + } + + return $result ? $this->allow() : $this->deny(); + } + + /** + * Get the raw result from the authorization callback. + * + * @param string $ability + * @param array|mixed $arguments + * @return mixed + */ + public function raw($ability, $arguments = []) + { + $arguments = Arr::wrap($arguments); + + $user = $this->resolveUser(); + + // First we will call the "before" callbacks for the Gate. If any of these give + // back a non-null response, we will immediately return that result in order + // to let the developers override all checks for some authorization cases. + $result = $this->callBeforeCallbacks( + $user, $ability, $arguments + ); + + if (is_null($result)) { + $result = $this->callAuthCallback($user, $ability, $arguments); + } + + // After calling the authorization callback, we will call the "after" callbacks + // that are registered with the Gate, which allows a developer to do logging + // if that is required for this application. Then we'll return the result. + return $this->callAfterCallbacks( + $user, $ability, $arguments, $result + ); + } + + /** + * Determine whether the callback/method can be called with the given user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|null $user + * @param \Closure|string|array $class + * @param string|null $method + * @return bool + */ + protected function canBeCalledWithUser($user, $class, $method = null) + { + if (! is_null($user)) { + return true; + } + + if (! is_null($method)) { + return $this->methodAllowsGuests($class, $method); + } + + if (is_array($class)) { + $className = is_string($class[0]) ? $class[0] : get_class($class[0]); + + return $this->methodAllowsGuests($className, $class[1]); + } + + return $this->callbackAllowsGuests($class); + } + + /** + * Determine if the given class method allows guests. + * + * @param string $class + * @param string $method + * @return bool + */ + protected function methodAllowsGuests($class, $method) + { + try { + $reflection = new ReflectionClass($class); + + $method = $reflection->getMethod($method); + } catch (Exception $e) { + return false; + } + + if ($method) { + $parameters = $method->getParameters(); + + return isset($parameters[0]) && $this->parameterAllowsGuests($parameters[0]); + } + + return false; + } + + /** + * Determine if the callback allows guests. + * + * @param callable $callback + * @return bool + */ + protected function callbackAllowsGuests($callback) + { + $parameters = (new ReflectionFunction($callback))->getParameters(); + + return isset($parameters[0]) && $this->parameterAllowsGuests($parameters[0]); + } + + /** + * Determine if the given parameter allows guests. + * + * @param \ReflectionParameter $parameter + * @return bool + */ + protected function parameterAllowsGuests($parameter) + { + return ($parameter->getClass() && $parameter->allowsNull()) || + ($parameter->isDefaultValueAvailable() && is_null($parameter->getDefaultValue())); + } + + /** + * Resolve and call the appropriate authorization callback. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|null $user + * @param string $ability + * @param array $arguments + * @return bool + */ + protected function callAuthCallback($user, $ability, array $arguments) + { + $callback = $this->resolveAuthCallback($user, $ability, $arguments); + + return $callback($user, ...$arguments); + } + + /** + * Call all of the before callbacks and return if a result is given. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|null $user + * @param string $ability + * @param array $arguments + * @return bool|null + */ + protected function callBeforeCallbacks($user, $ability, array $arguments) + { + $arguments = array_merge([$user, $ability], [$arguments]); + + foreach ($this->beforeCallbacks as $before) { + if (! $this->canBeCalledWithUser($user, $before)) { + continue; + } + + if (! is_null($result = $before(...$arguments))) { + return $result; + } + } + } + + /** + * Call all of the after callbacks with check result. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string $ability + * @param array $arguments + * @param bool $result + * @return bool|null + */ + protected function callAfterCallbacks($user, $ability, array $arguments, $result) + { + foreach ($this->afterCallbacks as $after) { + if (! $this->canBeCalledWithUser($user, $after)) { + continue; + } + + $afterResult = $after($user, $ability, $result, $arguments); + + $result = $result ?? $afterResult; + } + + return $result; + } + + /** + * Resolve the callable for the given ability and arguments. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|null $user + * @param string $ability + * @param array $arguments + * @return callable + */ + protected function resolveAuthCallback($user, $ability, array $arguments) + { + if (isset($arguments[0]) && + ! is_null($policy = $this->getPolicyFor($arguments[0])) && + $callback = $this->resolvePolicyCallback($user, $ability, $arguments, $policy)) { + return $callback; + } + + if (isset($this->abilities[$ability]) && + $this->canBeCalledWithUser($user, $this->abilities[$ability])) { + return $this->abilities[$ability]; + } + + return function () { + return null; + }; + } + + /** + * Get a policy instance for a given class. + * + * @param object|string $class + * @return mixed + */ + public function getPolicyFor($class) + { + if (is_object($class)) { + $class = get_class($class); + } + + if (! is_string($class)) { + return; + } + + if (isset($this->policies[$class])) { + return $this->resolvePolicy($this->policies[$class]); + } + + foreach ($this->policies as $expected => $policy) { + if (is_subclass_of($class, $expected)) { + return $this->resolvePolicy($policy); + } + } + } + + /** + * Build a policy class instance of the given type. + * + * @param object|string $class + * @return mixed + */ + public function resolvePolicy($class) + { + return $this->container->make($class); + } + + /** + * Resolve the callback for a policy check. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string $ability + * @param array $arguments + * @param mixed $policy + * @return bool|callable + */ + protected function resolvePolicyCallback($user, $ability, array $arguments, $policy) + { + if (! is_callable([$policy, $this->formatAbilityToMethod($ability)])) { + return false; + } + + return function () use ($user, $ability, $arguments, $policy) { + // This callback will be responsible for calling the policy's before method and + // running this policy method if necessary. This is used to when objects are + // mapped to policy objects in the user's configurations or on this class. + $result = $this->callPolicyBefore( + $policy, $user, $ability, $arguments + ); + + // When we receive a non-null result from this before method, we will return it + // as the "final" results. This will allow developers to override the checks + // in this policy to return the result for all rules defined in the class. + if (! is_null($result)) { + return $result; + } + + $method = $this->formatAbilityToMethod($ability); + + return $this->callPolicyMethod($policy, $method, $user, $arguments); + }; + } + + /** + * Call the "before" method on the given policy, if applicable. + * + * @param mixed $policy + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string $ability + * @param array $arguments + * @return mixed + */ + protected function callPolicyBefore($policy, $user, $ability, $arguments) + { + if (! method_exists($policy, 'before')) { + return null; + } + + if ($this->canBeCalledWithUser($user, $policy, 'before')) { + return $policy->before($user, $ability, ...$arguments); + } + } + + /** + * Call the appropriate method on the given policy. + * + * @param mixed $policy + * @param string $method + * @param \Illuminate\Contracts\Auth\Authenticatable|null $user + * @param array $arguments + * @return mixed + */ + protected function callPolicyMethod($policy, $method, $user, array $arguments) + { + // If this first argument is a string, that means they are passing a class name + // to the policy. We will remove the first argument from this argument array + // because this policy already knows what type of models it can authorize. + if (isset($arguments[0]) && is_string($arguments[0])) { + array_shift($arguments); + } + + if (! is_callable([$policy, $method])) { + return null; + } + + if ($this->canBeCalledWithUser($user, $policy, $method)) { + return $policy->{$method}($user, ...$arguments); + } + } + + /** + * Format the policy ability into a method name. + * + * @param string $ability + * @return string + */ + protected function formatAbilityToMethod($ability) + { + return strpos($ability, '-') !== false ? Str::camel($ability) : $ability; + } + + /** + * Get a gate instance for the given user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user + * @return static + */ + public function forUser($user) + { + $callback = function () use ($user) { + return $user; + }; + + return new static( + $this->container, $callback, $this->abilities, + $this->policies, $this->beforeCallbacks, $this->afterCallbacks + ); + } + + /** + * Resolve the user from the user resolver. + * + * @return mixed + */ + protected function resolveUser() + { + return call_user_func($this->userResolver); + } + + /** + * Get all of the defined abilities. + * + * @return array + */ + public function abilities() + { + return $this->abilities; + } + + /** + * Get all of the defined policies. + * + * @return array + */ + public function policies() + { + return $this->policies; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php b/vendor/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php new file mode 100644 index 0000000..1a597bb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Access/HandlesAuthorization.php @@ -0,0 +1,30 @@ +message = $message; + } + + /** + * Get the response message. + * + * @return string|null + */ + public function message() + { + return $this->message; + } + + /** + * Get the string representation of the message. + * + * @return string + */ + public function __toString() + { + return (string) $this->message(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php b/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php new file mode 100755 index 0000000..05fefe1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php @@ -0,0 +1,294 @@ +app = $app; + + $this->userResolver = function ($guard = null) { + return $this->guard($guard)->user(); + }; + } + + /** + * Attempt to get the guard from the local cache. + * + * @param string $name + * @return \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard + */ + public function guard($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + return $this->guards[$name] ?? $this->guards[$name] = $this->resolve($name); + } + + /** + * Resolve the given guard. + * + * @param string $name + * @return \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard + * + * @throws \InvalidArgumentException + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + if (is_null($config)) { + throw new InvalidArgumentException("Auth guard [{$name}] is not defined."); + } + + if (isset($this->customCreators[$config['driver']])) { + return $this->callCustomCreator($name, $config); + } + + $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; + + if (method_exists($this, $driverMethod)) { + return $this->{$driverMethod}($name, $config); + } + + throw new InvalidArgumentException("Auth driver [{$config['driver']}] for guard [{$name}] is not defined."); + } + + /** + * Call a custom driver creator. + * + * @param string $name + * @param array $config + * @return mixed + */ + protected function callCustomCreator($name, array $config) + { + return $this->customCreators[$config['driver']]($this->app, $name, $config); + } + + /** + * Create a session based authentication guard. + * + * @param string $name + * @param array $config + * @return \Illuminate\Auth\SessionGuard + */ + public function createSessionDriver($name, $config) + { + $provider = $this->createUserProvider($config['provider'] ?? null); + + $guard = new SessionGuard($name, $provider, $this->app['session.store']); + + // When using the remember me functionality of the authentication services we + // will need to be set the encryption instance of the guard, which allows + // secure, encrypted cookie values to get generated for those cookies. + if (method_exists($guard, 'setCookieJar')) { + $guard->setCookieJar($this->app['cookie']); + } + + if (method_exists($guard, 'setDispatcher')) { + $guard->setDispatcher($this->app['events']); + } + + if (method_exists($guard, 'setRequest')) { + $guard->setRequest($this->app->refresh('request', $guard, 'setRequest')); + } + + return $guard; + } + + /** + * Create a token based authentication guard. + * + * @param string $name + * @param array $config + * @return \Illuminate\Auth\TokenGuard + */ + public function createTokenDriver($name, $config) + { + // The token guard implements a basic API token based guard implementation + // that takes an API token field from the request and matches it to the + // user in the database or another persistence layer where users are. + $guard = new TokenGuard( + $this->createUserProvider($config['provider'] ?? null), + $this->app['request'] + ); + + $this->app->refresh('request', $guard, 'setRequest'); + + return $guard; + } + + /** + * Get the guard configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + return $this->app['config']["auth.guards.{$name}"]; + } + + /** + * Get the default authentication driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['auth.defaults.guard']; + } + + /** + * Set the default guard driver the factory should serve. + * + * @param string $name + * @return void + */ + public function shouldUse($name) + { + $name = $name ?: $this->getDefaultDriver(); + + $this->setDefaultDriver($name); + + $this->userResolver = function ($name = null) { + return $this->guard($name)->user(); + }; + } + + /** + * Set the default authentication driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['auth.defaults.guard'] = $name; + } + + /** + * Register a new callback based request guard. + * + * @param string $driver + * @param callable $callback + * @return $this + */ + public function viaRequest($driver, callable $callback) + { + return $this->extend($driver, function () use ($callback) { + $guard = new RequestGuard($callback, $this->app['request'], $this->createUserProvider()); + + $this->app->refresh('request', $guard, 'setRequest'); + + return $guard; + }); + } + + /** + * Get the user resolver callback. + * + * @return \Closure + */ + public function userResolver() + { + return $this->userResolver; + } + + /** + * Set the callback to be used to resolve users. + * + * @param \Closure $userResolver + * @return $this + */ + public function resolveUsersUsing(Closure $userResolver) + { + $this->userResolver = $userResolver; + + return $this; + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback; + + return $this; + } + + /** + * Register a custom provider creator Closure. + * + * @param string $name + * @param \Closure $callback + * @return $this + */ + public function provider($name, Closure $callback) + { + $this->customProviderCreators[$name] = $callback; + + return $this; + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->guard()->{$method}(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php new file mode 100755 index 0000000..2820beb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php @@ -0,0 +1,90 @@ +registerAuthenticator(); + + $this->registerUserResolver(); + + $this->registerAccessGate(); + + $this->registerRequestRebindHandler(); + } + + /** + * Register the authenticator services. + * + * @return void + */ + protected function registerAuthenticator() + { + $this->app->singleton('auth', function ($app) { + // Once the authentication service has actually been requested by the developer + // we will set a variable in the application indicating such. This helps us + // know that we need to set any queued cookies in the after event later. + $app['auth.loaded'] = true; + + return new AuthManager($app); + }); + + $this->app->singleton('auth.driver', function ($app) { + return $app['auth']->guard(); + }); + } + + /** + * Register a resolver for the authenticated user. + * + * @return void + */ + protected function registerUserResolver() + { + $this->app->bind( + AuthenticatableContract::class, function ($app) { + return call_user_func($app['auth']->userResolver()); + } + ); + } + + /** + * Register the access gate service. + * + * @return void + */ + protected function registerAccessGate() + { + $this->app->singleton(GateContract::class, function ($app) { + return new Gate($app, function () use ($app) { + return call_user_func($app['auth']->userResolver()); + }); + }); + } + + /** + * Register a resolver for the authenticated user. + * + * @return void + */ + protected function registerRequestRebindHandler() + { + $this->app->rebinding('request', function ($app, $request) { + $request->setUserResolver(function ($guard = null) use ($app) { + return call_user_func($app['auth']->userResolver(), $guard); + }); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Authenticatable.php b/vendor/laravel/framework/src/Illuminate/Auth/Authenticatable.php new file mode 100644 index 0000000..d7578a3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Authenticatable.php @@ -0,0 +1,78 @@ +getKeyName(); + } + + /** + * Get the unique identifier for the user. + * + * @return mixed + */ + public function getAuthIdentifier() + { + return $this->{$this->getAuthIdentifierName()}; + } + + /** + * Get the password for the user. + * + * @return string + */ + public function getAuthPassword() + { + return $this->password; + } + + /** + * Get the token value for the "remember me" session. + * + * @return string|null + */ + public function getRememberToken() + { + if (! empty($this->getRememberTokenName())) { + return (string) $this->{$this->getRememberTokenName()}; + } + } + + /** + * Set the token value for the "remember me" session. + * + * @param string $value + * @return void + */ + public function setRememberToken($value) + { + if (! empty($this->getRememberTokenName())) { + $this->{$this->getRememberTokenName()} = $value; + } + } + + /** + * Get the column name for the "remember me" token. + * + * @return string + */ + public function getRememberTokenName() + { + return $this->rememberTokenName; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/AuthenticationException.php b/vendor/laravel/framework/src/Illuminate/Auth/AuthenticationException.php new file mode 100644 index 0000000..ef7dbee --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/AuthenticationException.php @@ -0,0 +1,58 @@ +guards = $guards; + $this->redirectTo = $redirectTo; + } + + /** + * Get the guards that were checked. + * + * @return array + */ + public function guards() + { + return $this->guards; + } + + /** + * Get the path the user should be redirected to. + * + * @return string + */ + public function redirectTo() + { + return $this->redirectTo; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Console/AuthMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Auth/Console/AuthMakeCommand.php new file mode 100644 index 0000000..cfe9597 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Console/AuthMakeCommand.php @@ -0,0 +1,120 @@ + 'auth/login.blade.php', + 'auth/register.stub' => 'auth/register.blade.php', + 'auth/verify.stub' => 'auth/verify.blade.php', + 'auth/passwords/email.stub' => 'auth/passwords/email.blade.php', + 'auth/passwords/reset.stub' => 'auth/passwords/reset.blade.php', + 'layouts/app.stub' => 'layouts/app.blade.php', + 'home.stub' => 'home.blade.php', + ]; + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->createDirectories(); + + $this->exportViews(); + + if (! $this->option('views')) { + file_put_contents( + app_path('Http/Controllers/HomeController.php'), + $this->compileControllerStub() + ); + + file_put_contents( + base_path('routes/web.php'), + file_get_contents(__DIR__.'/stubs/make/routes.stub'), + FILE_APPEND + ); + } + + $this->info('Authentication scaffolding generated successfully.'); + } + + /** + * Create the directories for the files. + * + * @return void + */ + protected function createDirectories() + { + if (! is_dir($directory = resource_path('views/layouts'))) { + mkdir($directory, 0755, true); + } + + if (! is_dir($directory = resource_path('views/auth/passwords'))) { + mkdir($directory, 0755, true); + } + } + + /** + * Export the authentication views. + * + * @return void + */ + protected function exportViews() + { + foreach ($this->views as $key => $value) { + if (file_exists($view = resource_path('views/'.$value)) && ! $this->option('force')) { + if (! $this->confirm("The [{$value}] view already exists. Do you want to replace it?")) { + continue; + } + } + + copy( + __DIR__.'/stubs/make/views/'.$key, + $view + ); + } + } + + /** + * Compiles the HomeController stub. + * + * @return string + */ + protected function compileControllerStub() + { + return str_replace( + '{{namespace}}', + $this->getAppNamespace(), + file_get_contents(__DIR__.'/stubs/make/controllers/HomeController.stub') + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Console/ClearResetsCommand.php b/vendor/laravel/framework/src/Illuminate/Auth/Console/ClearResetsCommand.php new file mode 100644 index 0000000..57c3bd5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Console/ClearResetsCommand.php @@ -0,0 +1,34 @@ +laravel['auth.password']->broker($this->argument('name'))->getRepository()->deleteExpired(); + + $this->info('Expired reset tokens cleared!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/controllers/HomeController.stub b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/controllers/HomeController.stub new file mode 100644 index 0000000..63a1e36 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/controllers/HomeController.stub @@ -0,0 +1,28 @@ +middleware('auth'); + } + + /** + * Show the application dashboard. + * + * @return \Illuminate\Contracts\Support\Renderable + */ + public function index() + { + return view('home'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/routes.stub b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/routes.stub new file mode 100644 index 0000000..2c37ded --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/routes.stub @@ -0,0 +1,4 @@ + +Auth::routes(); + +Route::get('/home', 'HomeController@index')->name('home'); diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/login.stub b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/login.stub new file mode 100644 index 0000000..9edb920 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/login.stub @@ -0,0 +1,73 @@ +@extends('layouts.app') + +@section('content') +
+
+
+
+
{{ __('Login') }}
+ +
+
+ @csrf + +
+ + +
+ + + @if ($errors->has('email')) + + {{ $errors->first('email') }} + + @endif +
+
+ +
+ + +
+ + + @if ($errors->has('password')) + + {{ $errors->first('password') }} + + @endif +
+
+ +
+
+
+ + + +
+
+
+ +
+
+ + + @if (Route::has('password.request')) + + {{ __('Forgot Your Password?') }} + + @endif +
+
+
+
+
+
+
+
+@endsection diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/passwords/email.stub b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/passwords/email.stub new file mode 100644 index 0000000..ccbee59 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/passwords/email.stub @@ -0,0 +1,47 @@ +@extends('layouts.app') + +@section('content') +
+
+
+
+
{{ __('Reset Password') }}
+ +
+ @if (session('status')) + + @endif + +
+ @csrf + +
+ + +
+ + + @if ($errors->has('email')) + + {{ $errors->first('email') }} + + @endif +
+
+ +
+
+ +
+
+
+
+
+
+
+
+@endsection diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/passwords/reset.stub b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/passwords/reset.stub new file mode 100644 index 0000000..bf27f4c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/passwords/reset.stub @@ -0,0 +1,65 @@ +@extends('layouts.app') + +@section('content') +
+
+
+
+
{{ __('Reset Password') }}
+ +
+
+ @csrf + + + +
+ + +
+ + + @if ($errors->has('email')) + + {{ $errors->first('email') }} + + @endif +
+
+ +
+ + +
+ + + @if ($errors->has('password')) + + {{ $errors->first('password') }} + + @endif +
+
+ +
+ + +
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+@endsection diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/register.stub b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/register.stub new file mode 100644 index 0000000..ad95f2c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/register.stub @@ -0,0 +1,77 @@ +@extends('layouts.app') + +@section('content') +
+
+
+
+
{{ __('Register') }}
+ +
+
+ @csrf + +
+ + +
+ + + @if ($errors->has('name')) + + {{ $errors->first('name') }} + + @endif +
+
+ +
+ + +
+ + + @if ($errors->has('email')) + + {{ $errors->first('email') }} + + @endif +
+
+ +
+ + +
+ + + @if ($errors->has('password')) + + {{ $errors->first('password') }} + + @endif +
+
+ +
+ + +
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+@endsection diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/verify.stub b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/verify.stub new file mode 100644 index 0000000..c742cb4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/auth/verify.stub @@ -0,0 +1,24 @@ +@extends('layouts.app') + +@section('content') +
+
+
+
+
{{ __('Verify Your Email Address') }}
+ +
+ @if (session('resent')) + + @endif + + {{ __('Before proceeding, please check your email for a verification link.') }} + {{ __('If you did not receive the email') }}, {{ __('click here to request another') }}. +
+
+
+
+
+@endsection diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/home.stub b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/home.stub new file mode 100644 index 0000000..05dfca9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/home.stub @@ -0,0 +1,23 @@ +@extends('layouts.app') + +@section('content') +
+
+
+
+
Dashboard
+ +
+ @if (session('status')) + + @endif + + You are logged in! +
+
+
+
+
+@endsection diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/layouts/app.stub b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/layouts/app.stub new file mode 100644 index 0000000..ee7767c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Console/stubs/make/views/layouts/app.stub @@ -0,0 +1,80 @@ + + + + + + + + + + {{ config('app.name', 'Laravel') }} + + + + + + + + + + + + +
+ + +
+ @yield('content') +
+
+ + diff --git a/vendor/laravel/framework/src/Illuminate/Auth/CreatesUserProviders.php b/vendor/laravel/framework/src/Illuminate/Auth/CreatesUserProviders.php new file mode 100644 index 0000000..46416b5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/CreatesUserProviders.php @@ -0,0 +1,94 @@ +getProviderConfiguration($provider))) { + return; + } + + if (isset($this->customProviderCreators[$driver = ($config['driver'] ?? null)])) { + return call_user_func( + $this->customProviderCreators[$driver], $this->app, $config + ); + } + + switch ($driver) { + case 'database': + return $this->createDatabaseProvider($config); + case 'eloquent': + return $this->createEloquentProvider($config); + default: + throw new InvalidArgumentException( + "Authentication user provider [{$driver}] is not defined." + ); + } + } + + /** + * Get the user provider configuration. + * + * @param string|null $provider + * @return array|null + */ + protected function getProviderConfiguration($provider) + { + if ($provider = $provider ?: $this->getDefaultUserProvider()) { + return $this->app['config']['auth.providers.'.$provider]; + } + } + + /** + * Create an instance of the database user provider. + * + * @param array $config + * @return \Illuminate\Auth\DatabaseUserProvider + */ + protected function createDatabaseProvider($config) + { + $connection = $this->app['db']->connection(); + + return new DatabaseUserProvider($connection, $this->app['hash'], $config['table']); + } + + /** + * Create an instance of the Eloquent user provider. + * + * @param array $config + * @return \Illuminate\Auth\EloquentUserProvider + */ + protected function createEloquentProvider($config) + { + return new EloquentUserProvider($this->app['hash'], $config['model']); + } + + /** + * Get the default user provider name. + * + * @return string + */ + public function getDefaultUserProvider() + { + return $this->app['config']['auth.defaults.provider']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/DatabaseUserProvider.php b/vendor/laravel/framework/src/Illuminate/Auth/DatabaseUserProvider.php new file mode 100755 index 0000000..f8005b7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/DatabaseUserProvider.php @@ -0,0 +1,159 @@ +conn = $conn; + $this->table = $table; + $this->hasher = $hasher; + } + + /** + * Retrieve a user by their unique identifier. + * + * @param mixed $identifier + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveById($identifier) + { + $user = $this->conn->table($this->table)->find($identifier); + + return $this->getGenericUser($user); + } + + /** + * Retrieve a user by their unique identifier and "remember me" token. + * + * @param mixed $identifier + * @param string $token + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveByToken($identifier, $token) + { + $user = $this->getGenericUser( + $this->conn->table($this->table)->find($identifier) + ); + + return $user && $user->getRememberToken() && hash_equals($user->getRememberToken(), $token) + ? $user : null; + } + + /** + * Update the "remember me" token for the given user in storage. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string $token + * @return void + */ + public function updateRememberToken(UserContract $user, $token) + { + $this->conn->table($this->table) + ->where($user->getAuthIdentifierName(), $user->getAuthIdentifier()) + ->update([$user->getRememberTokenName() => $token]); + } + + /** + * Retrieve a user by the given credentials. + * + * @param array $credentials + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveByCredentials(array $credentials) + { + if (empty($credentials) || + (count($credentials) === 1 && + array_key_exists('password', $credentials))) { + return; + } + + // First we will add each credential element to the query as a where clause. + // Then we can execute the query and, if we found a user, return it in a + // generic "user" object that will be utilized by the Guard instances. + $query = $this->conn->table($this->table); + + foreach ($credentials as $key => $value) { + if (Str::contains($key, 'password')) { + continue; + } + + if (is_array($value) || $value instanceof Arrayable) { + $query->whereIn($key, $value); + } else { + $query->where($key, $value); + } + } + + // Now we are ready to execute the query to see if we have an user matching + // the given credentials. If not, we will just return nulls and indicate + // that there are no matching users for these given credential arrays. + $user = $query->first(); + + return $this->getGenericUser($user); + } + + /** + * Get the generic user. + * + * @param mixed $user + * @return \Illuminate\Auth\GenericUser|null + */ + protected function getGenericUser($user) + { + if (! is_null($user)) { + return new GenericUser((array) $user); + } + } + + /** + * Validate a user against the given credentials. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param array $credentials + * @return bool + */ + public function validateCredentials(UserContract $user, array $credentials) + { + return $this->hasher->check( + $credentials['password'], $user->getAuthPassword() + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php b/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php new file mode 100755 index 0000000..23b5b79 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php @@ -0,0 +1,202 @@ +model = $model; + $this->hasher = $hasher; + } + + /** + * Retrieve a user by their unique identifier. + * + * @param mixed $identifier + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveById($identifier) + { + $model = $this->createModel(); + + return $model->newQuery() + ->where($model->getAuthIdentifierName(), $identifier) + ->first(); + } + + /** + * Retrieve a user by their unique identifier and "remember me" token. + * + * @param mixed $identifier + * @param string $token + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveByToken($identifier, $token) + { + $model = $this->createModel(); + + $model = $model->where($model->getAuthIdentifierName(), $identifier)->first(); + + if (! $model) { + return null; + } + + $rememberToken = $model->getRememberToken(); + + return $rememberToken && hash_equals($rememberToken, $token) ? $model : null; + } + + /** + * Update the "remember me" token for the given user in storage. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|\Illuminate\Database\Eloquent\Model $user + * @param string $token + * @return void + */ + public function updateRememberToken(UserContract $user, $token) + { + $user->setRememberToken($token); + + $timestamps = $user->timestamps; + + $user->timestamps = false; + + $user->save(); + + $user->timestamps = $timestamps; + } + + /** + * Retrieve a user by the given credentials. + * + * @param array $credentials + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function retrieveByCredentials(array $credentials) + { + if (empty($credentials) || + (count($credentials) === 1 && + array_key_exists('password', $credentials))) { + return; + } + + // First we will add each credential element to the query as a where clause. + // Then we can execute the query and, if we found a user, return it in a + // Eloquent User "model" that will be utilized by the Guard instances. + $query = $this->createModel()->newQuery(); + + foreach ($credentials as $key => $value) { + if (Str::contains($key, 'password')) { + continue; + } + + if (is_array($value) || $value instanceof Arrayable) { + $query->whereIn($key, $value); + } else { + $query->where($key, $value); + } + } + + return $query->first(); + } + + /** + * Validate a user against the given credentials. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param array $credentials + * @return bool + */ + public function validateCredentials(UserContract $user, array $credentials) + { + $plain = $credentials['password']; + + return $this->hasher->check($plain, $user->getAuthPassword()); + } + + /** + * Create a new instance of the model. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function createModel() + { + $class = '\\'.ltrim($this->model, '\\'); + + return new $class; + } + + /** + * Gets the hasher implementation. + * + * @return \Illuminate\Contracts\Hashing\Hasher + */ + public function getHasher() + { + return $this->hasher; + } + + /** + * Sets the hasher implementation. + * + * @param \Illuminate\Contracts\Hashing\Hasher $hasher + * @return $this + */ + public function setHasher(HasherContract $hasher) + { + $this->hasher = $hasher; + + return $this; + } + + /** + * Gets the name of the Eloquent user model. + * + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Sets the name of the Eloquent user model. + * + * @param string $model + * @return $this + */ + public function setModel($model) + { + $this->model = $model; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Attempting.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Attempting.php new file mode 100644 index 0000000..3f911ba --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Attempting.php @@ -0,0 +1,42 @@ +guard = $guard; + $this->remember = $remember; + $this->credentials = $credentials; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Authenticated.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Authenticated.php new file mode 100644 index 0000000..faefcbe --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Authenticated.php @@ -0,0 +1,37 @@ +user = $user; + $this->guard = $guard; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Failed.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Failed.php new file mode 100644 index 0000000..34f8124 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Failed.php @@ -0,0 +1,42 @@ +user = $user; + $this->guard = $guard; + $this->credentials = $credentials; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Lockout.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Lockout.php new file mode 100644 index 0000000..347943f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Lockout.php @@ -0,0 +1,26 @@ +request = $request; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Login.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Login.php new file mode 100644 index 0000000..3005183 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Login.php @@ -0,0 +1,46 @@ +user = $user; + $this->guard = $guard; + $this->remember = $remember; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Logout.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Logout.php new file mode 100644 index 0000000..bc8c394 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Logout.php @@ -0,0 +1,37 @@ +user = $user; + $this->guard = $guard; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/PasswordReset.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/PasswordReset.php new file mode 100644 index 0000000..f57b3c9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/PasswordReset.php @@ -0,0 +1,28 @@ +user = $user; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Registered.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Registered.php new file mode 100644 index 0000000..f84058c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Registered.php @@ -0,0 +1,28 @@ +user = $user; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Events/Verified.php b/vendor/laravel/framework/src/Illuminate/Auth/Events/Verified.php new file mode 100644 index 0000000..1d6e4c0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Events/Verified.php @@ -0,0 +1,28 @@ +user = $user; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/GenericUser.php b/vendor/laravel/framework/src/Illuminate/Auth/GenericUser.php new file mode 100755 index 0000000..b6880c0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/GenericUser.php @@ -0,0 +1,134 @@ +attributes = $attributes; + } + + /** + * Get the name of the unique identifier for the user. + * + * @return string + */ + public function getAuthIdentifierName() + { + return 'id'; + } + + /** + * Get the unique identifier for the user. + * + * @return mixed + */ + public function getAuthIdentifier() + { + $name = $this->getAuthIdentifierName(); + + return $this->attributes[$name]; + } + + /** + * Get the password for the user. + * + * @return string + */ + public function getAuthPassword() + { + return $this->attributes['password']; + } + + /** + * Get the "remember me" token value. + * + * @return string + */ + public function getRememberToken() + { + return $this->attributes[$this->getRememberTokenName()]; + } + + /** + * Set the "remember me" token value. + * + * @param string $value + * @return void + */ + public function setRememberToken($value) + { + $this->attributes[$this->getRememberTokenName()] = $value; + } + + /** + * Get the column name for the "remember me" token. + * + * @return string + */ + public function getRememberTokenName() + { + return 'remember_token'; + } + + /** + * Dynamically access the user's attributes. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->attributes[$key]; + } + + /** + * Dynamically set an attribute on the user. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this->attributes[$key] = $value; + } + + /** + * Dynamically check if a value is set on the user. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return isset($this->attributes[$key]); + } + + /** + * Dynamically unset a value on the user. + * + * @param string $key + * @return void + */ + public function __unset($key) + { + unset($this->attributes[$key]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/GuardHelpers.php b/vendor/laravel/framework/src/Illuminate/Auth/GuardHelpers.php new file mode 100644 index 0000000..8bfa77a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/GuardHelpers.php @@ -0,0 +1,118 @@ +user())) { + return $user; + } + + throw new AuthenticationException; + } + + /** + * Determine if the guard has a user instance. + * + * @return bool + */ + public function hasUser() + { + return ! is_null($this->user); + } + + /** + * Determine if the current user is authenticated. + * + * @return bool + */ + public function check() + { + return ! is_null($this->user()); + } + + /** + * Determine if the current user is a guest. + * + * @return bool + */ + public function guest() + { + return ! $this->check(); + } + + /** + * Get the ID for the currently authenticated user. + * + * @return int|null + */ + public function id() + { + if ($this->user()) { + return $this->user()->getAuthIdentifier(); + } + } + + /** + * Set the current user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return $this + */ + public function setUser(AuthenticatableContract $user) + { + $this->user = $user; + + return $this; + } + + /** + * Get the user provider used by the guard. + * + * @return \Illuminate\Contracts\Auth\UserProvider + */ + public function getProvider() + { + return $this->provider; + } + + /** + * Set the user provider used by the guard. + * + * @param \Illuminate\Contracts\Auth\UserProvider $provider + * @return void + */ + public function setProvider(UserProvider $provider) + { + $this->provider = $provider; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Listeners/SendEmailVerificationNotification.php b/vendor/laravel/framework/src/Illuminate/Auth/Listeners/SendEmailVerificationNotification.php new file mode 100644 index 0000000..12dfa69 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Listeners/SendEmailVerificationNotification.php @@ -0,0 +1,22 @@ +user instanceof MustVerifyEmail && ! $event->user->hasVerifiedEmail()) { + $event->user->sendEmailVerificationNotification(); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php new file mode 100644 index 0000000..98b9bc6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php @@ -0,0 +1,82 @@ +auth = $auth; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string[] ...$guards + * @return mixed + * + * @throws \Illuminate\Auth\AuthenticationException + */ + public function handle($request, Closure $next, ...$guards) + { + $this->authenticate($request, $guards); + + return $next($request); + } + + /** + * Determine if the user is logged in to any of the given guards. + * + * @param \Illuminate\Http\Request $request + * @param array $guards + * @return void + * + * @throws \Illuminate\Auth\AuthenticationException + */ + protected function authenticate($request, array $guards) + { + if (empty($guards)) { + $guards = [null]; + } + + foreach ($guards as $guard) { + if ($this->auth->guard($guard)->check()) { + return $this->auth->shouldUse($guard); + } + } + + throw new AuthenticationException( + 'Unauthenticated.', $guards, $this->redirectTo($request) + ); + } + + /** + * Get the path the user should be redirected to when they are not authenticated. + * + * @param \Illuminate\Http\Request $request + * @return string + */ + protected function redirectTo($request) + { + // + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php new file mode 100644 index 0000000..c51df90 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/AuthenticateWithBasicAuth.php @@ -0,0 +1,41 @@ +auth = $auth; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard + * @param string|null $field + * @return mixed + */ + public function handle($request, Closure $next, $guard = null, $field = null) + { + return $this->auth->guard($guard)->basic($field ?: 'email') ?: $next($request); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authorize.php b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authorize.php new file mode 100644 index 0000000..d1774d7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authorize.php @@ -0,0 +1,88 @@ +gate = $gate; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string $ability + * @param array|null ...$models + * @return mixed + * + * @throws \Illuminate\Auth\AuthenticationException + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + public function handle($request, Closure $next, $ability, ...$models) + { + $this->gate->authorize($ability, $this->getGateArguments($request, $models)); + + return $next($request); + } + + /** + * Get the arguments parameter for the gate. + * + * @param \Illuminate\Http\Request $request + * @param array|null $models + * @return array|string|\Illuminate\Database\Eloquent\Model + */ + protected function getGateArguments($request, $models) + { + if (is_null($models)) { + return []; + } + + return collect($models)->map(function ($model) use ($request) { + return $model instanceof Model ? $model : $this->getModel($request, $model); + })->all(); + } + + /** + * Get the model to authorize. + * + * @param \Illuminate\Http\Request $request + * @param string $model + * @return \Illuminate\Database\Eloquent\Model|string + */ + protected function getModel($request, $model) + { + return $this->isClassName($model) ? trim($model) : $request->route($model, $model); + } + + /** + * Checks if the given string looks like a fully qualified class name. + * + * @param string $value + * @return bool + */ + protected function isClassName($value) + { + return strpos($value, '\\') !== false; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.php b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.php new file mode 100644 index 0000000..f43855d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.php @@ -0,0 +1,30 @@ +user() || + ($request->user() instanceof MustVerifyEmail && + ! $request->user()->hasVerifiedEmail())) { + return $request->expectsJson() + ? abort(403, 'Your email address is not verified.') + : Redirect::route('verification.notice'); + } + + return $next($request); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/MustVerifyEmail.php b/vendor/laravel/framework/src/Illuminate/Auth/MustVerifyEmail.php new file mode 100644 index 0000000..d7782cd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/MustVerifyEmail.php @@ -0,0 +1,38 @@ +email_verified_at); + } + + /** + * Mark the given user's email as verified. + * + * @return bool + */ + public function markEmailAsVerified() + { + return $this->forceFill([ + 'email_verified_at' => $this->freshTimestamp(), + ])->save(); + } + + /** + * Send the email verification notification. + * + * @return void + */ + public function sendEmailVerificationNotification() + { + $this->notify(new Notifications\VerifyEmail); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Notifications/ResetPassword.php b/vendor/laravel/framework/src/Illuminate/Auth/Notifications/ResetPassword.php new file mode 100644 index 0000000..c2978fe --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Notifications/ResetPassword.php @@ -0,0 +1,76 @@ +token = $token; + } + + /** + * Get the notification's channels. + * + * @param mixed $notifiable + * @return array|string + */ + public function via($notifiable) + { + return ['mail']; + } + + /** + * Build the mail representation of the notification. + * + * @param mixed $notifiable + * @return \Illuminate\Notifications\Messages\MailMessage + */ + public function toMail($notifiable) + { + if (static::$toMailCallback) { + return call_user_func(static::$toMailCallback, $notifiable, $this->token); + } + + return (new MailMessage) + ->subject(Lang::getFromJson('Reset Password Notification')) + ->line(Lang::getFromJson('You are receiving this email because we received a password reset request for your account.')) + ->action(Lang::getFromJson('Reset Password'), url(config('app.url').route('password.reset', $this->token, false))) + ->line(Lang::getFromJson('If you did not request a password reset, no further action is required.')); + } + + /** + * Set a callback that should be used when building the notification mail message. + * + * @param \Closure $callback + * @return void + */ + public static function toMailUsing($callback) + { + static::$toMailCallback = $callback; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Notifications/VerifyEmail.php b/vendor/laravel/framework/src/Illuminate/Auth/Notifications/VerifyEmail.php new file mode 100644 index 0000000..f8f3162 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Notifications/VerifyEmail.php @@ -0,0 +1,76 @@ +subject(Lang::getFromJson('Verify Email Address')) + ->line(Lang::getFromJson('Please click the button below to verify your email address.')) + ->action( + Lang::getFromJson('Verify Email Address'), + $this->verificationUrl($notifiable) + ) + ->line(Lang::getFromJson('If you did not create an account, no further action is required.')); + } + + /** + * Get the verification URL for the given notifiable. + * + * @param mixed $notifiable + * @return string + */ + protected function verificationUrl($notifiable) + { + return URL::temporarySignedRoute( + 'verification.verify', Carbon::now()->addMinutes(60), ['id' => $notifiable->getKey()] + ); + } + + /** + * Set a callback that should be used when building the notification mail message. + * + * @param \Closure $callback + * @return void + */ + public static function toMailUsing($callback) + { + static::$toMailCallback = $callback; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Passwords/CanResetPassword.php b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/CanResetPassword.php new file mode 100644 index 0000000..918a288 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/CanResetPassword.php @@ -0,0 +1,29 @@ +email; + } + + /** + * Send the password reset notification. + * + * @param string $token + * @return void + */ + public function sendPasswordResetNotification($token) + { + $this->notify(new ResetPasswordNotification($token)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php new file mode 100755 index 0000000..c470175 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php @@ -0,0 +1,204 @@ +table = $table; + $this->hasher = $hasher; + $this->hashKey = $hashKey; + $this->expires = $expires * 60; + $this->connection = $connection; + } + + /** + * Create a new token record. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @return string + */ + public function create(CanResetPasswordContract $user) + { + $email = $user->getEmailForPasswordReset(); + + $this->deleteExisting($user); + + // We will create a new, random token for the user so that we can e-mail them + // a safe link to the password reset form. Then we will insert a record in + // the database so that we can verify the token within the actual reset. + $token = $this->createNewToken(); + + $this->getTable()->insert($this->getPayload($email, $token)); + + return $token; + } + + /** + * Delete all existing reset tokens from the database. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @return int + */ + protected function deleteExisting(CanResetPasswordContract $user) + { + return $this->getTable()->where('email', $user->getEmailForPasswordReset())->delete(); + } + + /** + * Build the record payload for the table. + * + * @param string $email + * @param string $token + * @return array + */ + protected function getPayload($email, $token) + { + return ['email' => $email, 'token' => $this->hasher->make($token), 'created_at' => new Carbon]; + } + + /** + * Determine if a token record exists and is valid. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @param string $token + * @return bool + */ + public function exists(CanResetPasswordContract $user, $token) + { + $record = (array) $this->getTable()->where( + 'email', $user->getEmailForPasswordReset() + )->first(); + + return $record && + ! $this->tokenExpired($record['created_at']) && + $this->hasher->check($token, $record['token']); + } + + /** + * Determine if the token has expired. + * + * @param string $createdAt + * @return bool + */ + protected function tokenExpired($createdAt) + { + return Carbon::parse($createdAt)->addSeconds($this->expires)->isPast(); + } + + /** + * Delete a token record by user. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @return void + */ + public function delete(CanResetPasswordContract $user) + { + $this->deleteExisting($user); + } + + /** + * Delete expired tokens. + * + * @return void + */ + public function deleteExpired() + { + $expiredAt = Carbon::now()->subSeconds($this->expires); + + $this->getTable()->where('created_at', '<', $expiredAt)->delete(); + } + + /** + * Create a new token for the user. + * + * @return string + */ + public function createNewToken() + { + return hash_hmac('sha256', Str::random(40), $this->hashKey); + } + + /** + * Get the database connection instance. + * + * @return \Illuminate\Database\ConnectionInterface + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Begin a new database query against the table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function getTable() + { + return $this->connection->table($this->table); + } + + /** + * Get the hasher instance. + * + * @return \Illuminate\Contracts\Hashing\Hasher + */ + public function getHasher() + { + return $this->hasher; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBroker.php b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBroker.php new file mode 100755 index 0000000..66918fc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBroker.php @@ -0,0 +1,242 @@ +users = $users; + $this->tokens = $tokens; + } + + /** + * Send a password reset link to a user. + * + * @param array $credentials + * @return string + */ + public function sendResetLink(array $credentials) + { + // First we will check to see if we found a user at the given credentials and + // if we did not we will redirect back to this current URI with a piece of + // "flash" data in the session to indicate to the developers the errors. + $user = $this->getUser($credentials); + + if (is_null($user)) { + return static::INVALID_USER; + } + + // Once we have the reset token, we are ready to send the message out to this + // user with a link to reset their password. We will then redirect back to + // the current URI having nothing set in the session to indicate errors. + $user->sendPasswordResetNotification( + $this->tokens->create($user) + ); + + return static::RESET_LINK_SENT; + } + + /** + * Reset the password for the given token. + * + * @param array $credentials + * @param \Closure $callback + * @return mixed + */ + public function reset(array $credentials, Closure $callback) + { + // If the responses from the validate method is not a user instance, we will + // assume that it is a redirect and simply return it from this method and + // the user is properly redirected having an error message on the post. + $user = $this->validateReset($credentials); + + if (! $user instanceof CanResetPasswordContract) { + return $user; + } + + $password = $credentials['password']; + + // Once the reset has been validated, we'll call the given callback with the + // new password. This gives the user an opportunity to store the password + // in their persistent storage. Then we'll delete the token and return. + $callback($user, $password); + + $this->tokens->delete($user); + + return static::PASSWORD_RESET; + } + + /** + * Validate a password reset for the given credentials. + * + * @param array $credentials + * @return \Illuminate\Contracts\Auth\CanResetPassword|string + */ + protected function validateReset(array $credentials) + { + if (is_null($user = $this->getUser($credentials))) { + return static::INVALID_USER; + } + + if (! $this->validateNewPassword($credentials)) { + return static::INVALID_PASSWORD; + } + + if (! $this->tokens->exists($user, $credentials['token'])) { + return static::INVALID_TOKEN; + } + + return $user; + } + + /** + * Set a custom password validator. + * + * @param \Closure $callback + * @return void + */ + public function validator(Closure $callback) + { + $this->passwordValidator = $callback; + } + + /** + * Determine if the passwords match for the request. + * + * @param array $credentials + * @return bool + */ + public function validateNewPassword(array $credentials) + { + if (isset($this->passwordValidator)) { + [$password, $confirm] = [ + $credentials['password'], + $credentials['password_confirmation'], + ]; + + return call_user_func( + $this->passwordValidator, $credentials + ) && $password === $confirm; + } + + return $this->validatePasswordWithDefaults($credentials); + } + + /** + * Determine if the passwords are valid for the request. + * + * @param array $credentials + * @return bool + */ + protected function validatePasswordWithDefaults(array $credentials) + { + [$password, $confirm] = [ + $credentials['password'], + $credentials['password_confirmation'], + ]; + + return $password === $confirm && mb_strlen($password) >= 6; + } + + /** + * Get the user for the given credentials. + * + * @param array $credentials + * @return \Illuminate\Contracts\Auth\CanResetPassword|null + * + * @throws \UnexpectedValueException + */ + public function getUser(array $credentials) + { + $credentials = Arr::except($credentials, ['token']); + + $user = $this->users->retrieveByCredentials($credentials); + + if ($user && ! $user instanceof CanResetPasswordContract) { + throw new UnexpectedValueException('User must implement CanResetPassword interface.'); + } + + return $user; + } + + /** + * Create a new password reset token for the given user. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @return string + */ + public function createToken(CanResetPasswordContract $user) + { + return $this->tokens->create($user); + } + + /** + * Delete password reset tokens of the given user. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @return void + */ + public function deleteToken(CanResetPasswordContract $user) + { + $this->tokens->delete($user); + } + + /** + * Validate the given password reset token. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @param string $token + * @return bool + */ + public function tokenExists(CanResetPasswordContract $user, $token) + { + return $this->tokens->exists($user, $token); + } + + /** + * Get the password reset token repository implementation. + * + * @return \Illuminate\Auth\Passwords\TokenRepositoryInterface + */ + public function getRepository() + { + return $this->tokens; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php new file mode 100644 index 0000000..1d943bd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php @@ -0,0 +1,147 @@ +app = $app; + } + + /** + * Attempt to get the broker from the local cache. + * + * @param string|null $name + * @return \Illuminate\Contracts\Auth\PasswordBroker + */ + public function broker($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + return isset($this->brokers[$name]) + ? $this->brokers[$name] + : $this->brokers[$name] = $this->resolve($name); + } + + /** + * Resolve the given broker. + * + * @param string $name + * @return \Illuminate\Contracts\Auth\PasswordBroker + * + * @throws \InvalidArgumentException + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + if (is_null($config)) { + throw new InvalidArgumentException("Password resetter [{$name}] is not defined."); + } + + // The password broker uses a token repository to validate tokens and send user + // password e-mails, as well as validating that password reset process as an + // aggregate service of sorts providing a convenient interface for resets. + return new PasswordBroker( + $this->createTokenRepository($config), + $this->app['auth']->createUserProvider($config['provider'] ?? null) + ); + } + + /** + * Create a token repository instance based on the given configuration. + * + * @param array $config + * @return \Illuminate\Auth\Passwords\TokenRepositoryInterface + */ + protected function createTokenRepository(array $config) + { + $key = $this->app['config']['app.key']; + + if (Str::startsWith($key, 'base64:')) { + $key = base64_decode(substr($key, 7)); + } + + $connection = $config['connection'] ?? null; + + return new DatabaseTokenRepository( + $this->app['db']->connection($connection), + $this->app['hash'], + $config['table'], + $key, + $config['expire'] + ); + } + + /** + * Get the password broker configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + return $this->app['config']["auth.passwords.{$name}"]; + } + + /** + * Get the default password broker name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['auth.defaults.passwords']; + } + + /** + * Set the default password broker name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['auth.defaults.passwords'] = $name; + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->broker()->{$method}(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php new file mode 100755 index 0000000..165ecaf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordResetServiceProvider.php @@ -0,0 +1,51 @@ +registerPasswordBroker(); + } + + /** + * Register the password broker instance. + * + * @return void + */ + protected function registerPasswordBroker() + { + $this->app->singleton('auth.password', function ($app) { + return new PasswordBrokerManager($app); + }); + + $this->app->bind('auth.password.broker', function ($app) { + return $app->make('auth.password')->broker(); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['auth.password', 'auth.password.broker']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php new file mode 100755 index 0000000..dcd06e8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php @@ -0,0 +1,40 @@ +recaller = @unserialize($recaller, ['allowed_classes' => false]) ?: $recaller; + } + + /** + * Get the user ID from the recaller. + * + * @return string + */ + public function id() + { + return explode('|', $this->recaller, 3)[0]; + } + + /** + * Get the "remember token" token from the recaller. + * + * @return string + */ + public function token() + { + return explode('|', $this->recaller, 3)[1]; + } + + /** + * Get the password from the recaller. + * + * @return string + */ + public function hash() + { + return explode('|', $this->recaller, 3)[2]; + } + + /** + * Determine if the recaller is valid. + * + * @return bool + */ + public function valid() + { + return $this->properString() && $this->hasAllSegments(); + } + + /** + * Determine if the recaller is an invalid string. + * + * @return bool + */ + protected function properString() + { + return is_string($this->recaller) && Str::contains($this->recaller, '|'); + } + + /** + * Determine if the recaller has all segments. + * + * @return bool + */ + protected function hasAllSegments() + { + $segments = explode('|', $this->recaller); + + return count($segments) === 3 && trim($segments[0]) !== '' && trim($segments[1]) !== ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/RequestGuard.php b/vendor/laravel/framework/src/Illuminate/Auth/RequestGuard.php new file mode 100644 index 0000000..2adc2cc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/RequestGuard.php @@ -0,0 +1,87 @@ +request = $request; + $this->callback = $callback; + $this->provider = $provider; + } + + /** + * Get the currently authenticated user. + * + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function user() + { + // If we've already retrieved the user for the current request we can just + // return it back immediately. We do not want to fetch the user data on + // every call to this method because that would be tremendously slow. + if (! is_null($this->user)) { + return $this->user; + } + + return $this->user = call_user_func( + $this->callback, $this->request, $this->getProvider() + ); + } + + /** + * Validate a user's credentials. + * + * @param array $credentials + * @return bool + */ + public function validate(array $credentials = []) + { + return ! is_null((new static( + $this->callback, $credentials['request'], $this->getProvider() + ))->user()); + } + + /** + * Set the current request instance. + * + * @param \Illuminate\Http\Request $request + * @return $this + */ + public function setRequest(Request $request) + { + $this->request = $request; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php b/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php new file mode 100644 index 0000000..6d980b8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php @@ -0,0 +1,783 @@ +name = $name; + $this->session = $session; + $this->request = $request; + $this->provider = $provider; + } + + /** + * Get the currently authenticated user. + * + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function user() + { + if ($this->loggedOut) { + return; + } + + // If we've already retrieved the user for the current request we can just + // return it back immediately. We do not want to fetch the user data on + // every call to this method because that would be tremendously slow. + if (! is_null($this->user)) { + return $this->user; + } + + $id = $this->session->get($this->getName()); + + // First we will try to load the user using the identifier in the session if + // one exists. Otherwise we will check for a "remember me" cookie in this + // request, and if one exists, attempt to retrieve the user using that. + if (! is_null($id) && $this->user = $this->provider->retrieveById($id)) { + $this->fireAuthenticatedEvent($this->user); + } + + // If the user is null, but we decrypt a "recaller" cookie we can attempt to + // pull the user data on that cookie which serves as a remember cookie on + // the application. Once we have a user we can return it to the caller. + $recaller = $this->recaller(); + + if (is_null($this->user) && ! is_null($recaller)) { + $this->user = $this->userFromRecaller($recaller); + + if ($this->user) { + $this->updateSession($this->user->getAuthIdentifier()); + + $this->fireLoginEvent($this->user, true); + } + } + + return $this->user; + } + + /** + * Pull a user from the repository by its "remember me" cookie token. + * + * @param \Illuminate\Auth\Recaller $recaller + * @return mixed + */ + protected function userFromRecaller($recaller) + { + if (! $recaller->valid() || $this->recallAttempted) { + return; + } + + // If the user is null, but we decrypt a "recaller" cookie we can attempt to + // pull the user data on that cookie which serves as a remember cookie on + // the application. Once we have a user we can return it to the caller. + $this->recallAttempted = true; + + $this->viaRemember = ! is_null($user = $this->provider->retrieveByToken( + $recaller->id(), $recaller->token() + )); + + return $user; + } + + /** + * Get the decrypted recaller cookie for the request. + * + * @return \Illuminate\Auth\Recaller|null + */ + protected function recaller() + { + if (is_null($this->request)) { + return; + } + + if ($recaller = $this->request->cookies->get($this->getRecallerName())) { + return new Recaller($recaller); + } + } + + /** + * Get the ID for the currently authenticated user. + * + * @return int|null + */ + public function id() + { + if ($this->loggedOut) { + return; + } + + return $this->user() + ? $this->user()->getAuthIdentifier() + : $this->session->get($this->getName()); + } + + /** + * Log a user into the application without sessions or cookies. + * + * @param array $credentials + * @return bool + */ + public function once(array $credentials = []) + { + $this->fireAttemptEvent($credentials); + + if ($this->validate($credentials)) { + $this->setUser($this->lastAttempted); + + return true; + } + + return false; + } + + /** + * Log the given user ID into the application without sessions or cookies. + * + * @param mixed $id + * @return \Illuminate\Contracts\Auth\Authenticatable|false + */ + public function onceUsingId($id) + { + if (! is_null($user = $this->provider->retrieveById($id))) { + $this->setUser($user); + + return $user; + } + + return false; + } + + /** + * Validate a user's credentials. + * + * @param array $credentials + * @return bool + */ + public function validate(array $credentials = []) + { + $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials); + + return $this->hasValidCredentials($user, $credentials); + } + + /** + * Attempt to authenticate using HTTP Basic Auth. + * + * @param string $field + * @param array $extraConditions + * @return \Symfony\Component\HttpFoundation\Response|null + */ + public function basic($field = 'email', $extraConditions = []) + { + if ($this->check()) { + return; + } + + // If a username is set on the HTTP basic request, we will return out without + // interrupting the request lifecycle. Otherwise, we'll need to generate a + // request indicating that the given credentials were invalid for login. + if ($this->attemptBasic($this->getRequest(), $field, $extraConditions)) { + return; + } + + return $this->failedBasicResponse(); + } + + /** + * Perform a stateless HTTP Basic login attempt. + * + * @param string $field + * @param array $extraConditions + * @return \Symfony\Component\HttpFoundation\Response|null + */ + public function onceBasic($field = 'email', $extraConditions = []) + { + $credentials = $this->basicCredentials($this->getRequest(), $field); + + if (! $this->once(array_merge($credentials, $extraConditions))) { + return $this->failedBasicResponse(); + } + } + + /** + * Attempt to authenticate using basic authentication. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param string $field + * @param array $extraConditions + * @return bool + */ + protected function attemptBasic(Request $request, $field, $extraConditions = []) + { + if (! $request->getUser()) { + return false; + } + + return $this->attempt(array_merge( + $this->basicCredentials($request, $field), $extraConditions + )); + } + + /** + * Get the credential array for a HTTP Basic request. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param string $field + * @return array + */ + protected function basicCredentials(Request $request, $field) + { + return [$field => $request->getUser(), 'password' => $request->getPassword()]; + } + + /** + * Get the response for basic authentication. + * + * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException + */ + protected function failedBasicResponse() + { + throw new UnauthorizedHttpException('Basic', 'Invalid credentials.'); + } + + /** + * Attempt to authenticate a user using the given credentials. + * + * @param array $credentials + * @param bool $remember + * @return bool + */ + public function attempt(array $credentials = [], $remember = false) + { + $this->fireAttemptEvent($credentials, $remember); + + $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials); + + // If an implementation of UserInterface was returned, we'll ask the provider + // to validate the user against the given credentials, and if they are in + // fact valid we'll log the users into the application and return true. + if ($this->hasValidCredentials($user, $credentials)) { + $this->login($user, $remember); + + return true; + } + + // If the authentication attempt fails we will fire an event so that the user + // may be notified of any suspicious attempts to access their account from + // an unrecognized user. A developer may listen to this event as needed. + $this->fireFailedEvent($user, $credentials); + + return false; + } + + /** + * Determine if the user matches the credentials. + * + * @param mixed $user + * @param array $credentials + * @return bool + */ + protected function hasValidCredentials($user, $credentials) + { + return ! is_null($user) && $this->provider->validateCredentials($user, $credentials); + } + + /** + * Log the given user ID into the application. + * + * @param mixed $id + * @param bool $remember + * @return \Illuminate\Contracts\Auth\Authenticatable|false + */ + public function loginUsingId($id, $remember = false) + { + if (! is_null($user = $this->provider->retrieveById($id))) { + $this->login($user, $remember); + + return $user; + } + + return false; + } + + /** + * Log a user into the application. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param bool $remember + * @return void + */ + public function login(AuthenticatableContract $user, $remember = false) + { + $this->updateSession($user->getAuthIdentifier()); + + // If the user should be permanently "remembered" by the application we will + // queue a permanent cookie that contains the encrypted copy of the user + // identifier. We will then decrypt this later to retrieve the users. + if ($remember) { + $this->ensureRememberTokenIsSet($user); + + $this->queueRecallerCookie($user); + } + + // If we have an event dispatcher instance set we will fire an event so that + // any listeners will hook into the authentication events and run actions + // based on the login and logout events fired from the guard instances. + $this->fireLoginEvent($user, $remember); + + $this->setUser($user); + } + + /** + * Update the session with the given ID. + * + * @param string $id + * @return void + */ + protected function updateSession($id) + { + $this->session->put($this->getName(), $id); + + $this->session->migrate(true); + } + + /** + * Create a new "remember me" token for the user if one doesn't already exist. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return void + */ + protected function ensureRememberTokenIsSet(AuthenticatableContract $user) + { + if (empty($user->getRememberToken())) { + $this->cycleRememberToken($user); + } + } + + /** + * Queue the recaller cookie into the cookie jar. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return void + */ + protected function queueRecallerCookie(AuthenticatableContract $user) + { + $this->getCookieJar()->queue($this->createRecaller( + $user->getAuthIdentifier().'|'.$user->getRememberToken().'|'.$user->getAuthPassword() + )); + } + + /** + * Create a "remember me" cookie for a given ID. + * + * @param string $value + * @return \Symfony\Component\HttpFoundation\Cookie + */ + protected function createRecaller($value) + { + return $this->getCookieJar()->forever($this->getRecallerName(), $value); + } + + /** + * Log the user out of the application. + * + * @return void + */ + public function logout() + { + $user = $this->user(); + + // If we have an event dispatcher instance, we can fire off the logout event + // so any further processing can be done. This allows the developer to be + // listening for anytime a user signs out of this application manually. + $this->clearUserDataFromStorage(); + + if (! is_null($this->user)) { + $this->cycleRememberToken($user); + } + + if (isset($this->events)) { + $this->events->dispatch(new Events\Logout($this->name, $user)); + } + + // Once we have fired the logout event we will clear the users out of memory + // so they are no longer available as the user is no longer considered as + // being signed into this application and should not be available here. + $this->user = null; + + $this->loggedOut = true; + } + + /** + * Remove the user data from the session and cookies. + * + * @return void + */ + protected function clearUserDataFromStorage() + { + $this->session->remove($this->getName()); + + if (! is_null($this->recaller())) { + $this->getCookieJar()->queue($this->getCookieJar() + ->forget($this->getRecallerName())); + } + } + + /** + * Refresh the "remember me" token for the user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return void + */ + protected function cycleRememberToken(AuthenticatableContract $user) + { + $user->setRememberToken($token = Str::random(60)); + + $this->provider->updateRememberToken($user, $token); + } + + /** + * Invalidate other sessions for the current user. + * + * The application must be using the AuthenticateSession middleware. + * + * @param string $password + * @param string $attribute + * @return bool|null + */ + public function logoutOtherDevices($password, $attribute = 'password') + { + if (! $this->user()) { + return; + } + + $result = tap($this->user()->forceFill([ + $attribute => Hash::make($password), + ]))->save(); + + $this->queueRecallerCookie($this->user()); + + return $result; + } + + /** + * Register an authentication attempt event listener. + * + * @param mixed $callback + * @return void + */ + public function attempting($callback) + { + if (isset($this->events)) { + $this->events->listen(Events\Attempting::class, $callback); + } + } + + /** + * Fire the attempt event with the arguments. + * + * @param array $credentials + * @param bool $remember + * @return void + */ + protected function fireAttemptEvent(array $credentials, $remember = false) + { + if (isset($this->events)) { + $this->events->dispatch(new Events\Attempting( + $this->name, $credentials, $remember + )); + } + } + + /** + * Fire the login event if the dispatcher is set. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param bool $remember + * @return void + */ + protected function fireLoginEvent($user, $remember = false) + { + if (isset($this->events)) { + $this->events->dispatch(new Events\Login( + $this->name, $user, $remember + )); + } + } + + /** + * Fire the authenticated event if the dispatcher is set. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return void + */ + protected function fireAuthenticatedEvent($user) + { + if (isset($this->events)) { + $this->events->dispatch(new Events\Authenticated( + $this->name, $user + )); + } + } + + /** + * Fire the failed authentication attempt event with the given arguments. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|null $user + * @param array $credentials + * @return void + */ + protected function fireFailedEvent($user, array $credentials) + { + if (isset($this->events)) { + $this->events->dispatch(new Events\Failed( + $this->name, $user, $credentials + )); + } + } + + /** + * Get the last user we attempted to authenticate. + * + * @return \Illuminate\Contracts\Auth\Authenticatable + */ + public function getLastAttempted() + { + return $this->lastAttempted; + } + + /** + * Get a unique identifier for the auth session value. + * + * @return string + */ + public function getName() + { + return 'login_'.$this->name.'_'.sha1(static::class); + } + + /** + * Get the name of the cookie used to store the "recaller". + * + * @return string + */ + public function getRecallerName() + { + return 'remember_'.$this->name.'_'.sha1(static::class); + } + + /** + * Determine if the user was authenticated via "remember me" cookie. + * + * @return bool + */ + public function viaRemember() + { + return $this->viaRemember; + } + + /** + * Get the cookie creator instance used by the guard. + * + * @return \Illuminate\Contracts\Cookie\QueueingFactory + * + * @throws \RuntimeException + */ + public function getCookieJar() + { + if (! isset($this->cookie)) { + throw new RuntimeException('Cookie jar has not been set.'); + } + + return $this->cookie; + } + + /** + * Set the cookie creator instance used by the guard. + * + * @param \Illuminate\Contracts\Cookie\QueueingFactory $cookie + * @return void + */ + public function setCookieJar(CookieJar $cookie) + { + $this->cookie = $cookie; + } + + /** + * Get the event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public function getDispatcher() + { + return $this->events; + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function setDispatcher(Dispatcher $events) + { + $this->events = $events; + } + + /** + * Get the session store used by the guard. + * + * @return \Illuminate\Contracts\Session\Session + */ + public function getSession() + { + return $this->session; + } + + /** + * Return the currently cached user. + * + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function getUser() + { + return $this->user; + } + + /** + * Set the current user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @return $this + */ + public function setUser(AuthenticatableContract $user) + { + $this->user = $user; + + $this->loggedOut = false; + + $this->fireAuthenticatedEvent($user); + + return $this; + } + + /** + * Get the current request instance. + * + * @return \Symfony\Component\HttpFoundation\Request + */ + public function getRequest() + { + return $this->request ?: Request::createFromGlobals(); + } + + /** + * Set the current request instance. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return $this + */ + public function setRequest(Request $request) + { + $this->request = $request; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/TokenGuard.php b/vendor/laravel/framework/src/Illuminate/Auth/TokenGuard.php new file mode 100644 index 0000000..56ac19b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/TokenGuard.php @@ -0,0 +1,135 @@ +request = $request; + $this->provider = $provider; + $this->inputKey = $inputKey; + $this->storageKey = $storageKey; + } + + /** + * Get the currently authenticated user. + * + * @return \Illuminate\Contracts\Auth\Authenticatable|null + */ + public function user() + { + // If we've already retrieved the user for the current request we can just + // return it back immediately. We do not want to fetch the user data on + // every call to this method because that would be tremendously slow. + if (! is_null($this->user)) { + return $this->user; + } + + $user = null; + + $token = $this->getTokenForRequest(); + + if (! empty($token)) { + $user = $this->provider->retrieveByCredentials( + [$this->storageKey => $token] + ); + } + + return $this->user = $user; + } + + /** + * Get the token for the current request. + * + * @return string + */ + public function getTokenForRequest() + { + $token = $this->request->query($this->inputKey); + + if (empty($token)) { + $token = $this->request->input($this->inputKey); + } + + if (empty($token)) { + $token = $this->request->bearerToken(); + } + + if (empty($token)) { + $token = $this->request->getPassword(); + } + + return $token; + } + + /** + * Validate a user's credentials. + * + * @param array $credentials + * @return bool + */ + public function validate(array $credentials = []) + { + if (empty($credentials[$this->inputKey])) { + return false; + } + + $credentials = [$this->storageKey => $credentials[$this->inputKey]]; + + if ($this->provider->retrieveByCredentials($credentials)) { + return true; + } + + return false; + } + + /** + * Set the current request instance. + * + * @param \Illuminate\Http\Request $request + * @return $this + */ + public function setRequest(Request $request) + { + $this->request = $request; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Auth/composer.json b/vendor/laravel/framework/src/Illuminate/Auth/composer.json new file mode 100644 index 0000000..ae98c7d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Auth/composer.json @@ -0,0 +1,42 @@ +{ + "name": "illuminate/auth", + "description": "The Illuminate Auth package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/contracts": "5.7.*", + "illuminate/http": "5.7.*", + "illuminate/queue": "5.7.*", + "illuminate/support": "5.7.*" + }, + "autoload": { + "psr-4": { + "Illuminate\\Auth\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "suggest": { + "illuminate/console": "Required to use the auth:clear-resets command (5.7.*).", + "illuminate/queue": "Required to fire login / logout events (5.7.*).", + "illuminate/session": "Required to use the session based guard (5.7.*)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastController.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastController.php new file mode 100644 index 0000000..f71c923 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastController.php @@ -0,0 +1,21 @@ +event = $event; + } + + /** + * Handle the queued job. + * + * @param \Illuminate\Contracts\Broadcasting\Broadcaster $broadcaster + * @return void + */ + public function handle(Broadcaster $broadcaster) + { + $name = method_exists($this->event, 'broadcastAs') + ? $this->event->broadcastAs() : get_class($this->event); + + $broadcaster->broadcast( + Arr::wrap($this->event->broadcastOn()), $name, + $this->getPayloadFromEvent($this->event) + ); + } + + /** + * Get the payload for the given event. + * + * @param mixed $event + * @return array + */ + protected function getPayloadFromEvent($event) + { + if (method_exists($event, 'broadcastWith')) { + return array_merge( + $event->broadcastWith(), ['socket' => data_get($event, 'socket')] + ); + } + + $payload = []; + + foreach ((new ReflectionClass($event))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { + $payload[$property->getName()] = $this->formatProperty($property->getValue($event)); + } + + unset($payload['broadcastQueue']); + + return $payload; + } + + /** + * Format the given value for a property. + * + * @param mixed $value + * @return mixed + */ + protected function formatProperty($value) + { + if ($value instanceof Arrayable) { + return $value->toArray(); + } + + return $value; + } + + /** + * Get the display name for the queued job. + * + * @return string + */ + public function displayName() + { + return get_class($this->event); + } + + /** + * Prepare the instance for cloning. + * + * @return void + */ + public function __clone() + { + $this->event = clone $this->event; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastException.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastException.php new file mode 100644 index 0000000..8fd55f7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastException.php @@ -0,0 +1,10 @@ +app = $app; + } + + /** + * Register the routes for handling broadcast authentication and sockets. + * + * @param array|null $attributes + * @return void + */ + public function routes(array $attributes = null) + { + if ($this->app->routesAreCached()) { + return; + } + + $attributes = $attributes ?: ['middleware' => ['web']]; + + $this->app['router']->group($attributes, function ($router) { + $router->match( + ['get', 'post'], '/broadcasting/auth', + '\\'.BroadcastController::class.'@authenticate' + ); + }); + } + + /** + * Get the socket ID for the given request. + * + * @param \Illuminate\Http\Request|null $request + * @return string|null + */ + public function socket($request = null) + { + if (! $request && ! $this->app->bound('request')) { + return; + } + + $request = $request ?: $this->app['request']; + + return $request->header('X-Socket-ID'); + } + + /** + * Begin broadcasting an event. + * + * @param mixed|null $event + * @return \Illuminate\Broadcasting\PendingBroadcast|void + */ + public function event($event = null) + { + return new PendingBroadcast($this->app->make('events'), $event); + } + + /** + * Queue the given event for broadcast. + * + * @param mixed $event + * @return void + */ + public function queue($event) + { + $connection = $event instanceof ShouldBroadcastNow ? 'sync' : null; + + if (is_null($connection) && isset($event->connection)) { + $connection = $event->connection; + } + + $queue = null; + + if (method_exists($event, 'broadcastQueue')) { + $queue = $event->broadcastQueue(); + } elseif (isset($event->broadcastQueue)) { + $queue = $event->broadcastQueue; + } elseif (isset($event->queue)) { + $queue = $event->queue; + } + + $this->app->make('queue')->connection($connection)->pushOn( + $queue, new BroadcastEvent(clone $event) + ); + } + + /** + * Get a driver instance. + * + * @param string $driver + * @return mixed + */ + public function connection($driver = null) + { + return $this->driver($driver); + } + + /** + * Get a driver instance. + * + * @param string|null $name + * @return mixed + */ + public function driver($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + return $this->drivers[$name] = $this->get($name); + } + + /** + * Attempt to get the connection from the local cache. + * + * @param string $name + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + */ + protected function get($name) + { + return $this->drivers[$name] ?? $this->resolve($name); + } + + /** + * Resolve the given store. + * + * @param string $name + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + * + * @throws \InvalidArgumentException + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + if (is_null($config)) { + throw new InvalidArgumentException("Broadcaster [{$name}] is not defined."); + } + + if (isset($this->customCreators[$config['driver']])) { + return $this->callCustomCreator($config); + } + + $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; + + if (! method_exists($this, $driverMethod)) { + throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported."); + } + + return $this->{$driverMethod}($config); + } + + /** + * Call a custom driver creator. + * + * @param array $config + * @return mixed + */ + protected function callCustomCreator(array $config) + { + return $this->customCreators[$config['driver']]($this->app, $config); + } + + /** + * Create an instance of the driver. + * + * @param array $config + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + */ + protected function createPusherDriver(array $config) + { + $pusher = new Pusher( + $config['key'], $config['secret'], + $config['app_id'], $config['options'] ?? [] + ); + + if ($config['log'] ?? false) { + $pusher->setLogger($this->app->make(LoggerInterface::class)); + } + + return new PusherBroadcaster($pusher); + } + + /** + * Create an instance of the driver. + * + * @param array $config + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + */ + protected function createRedisDriver(array $config) + { + return new RedisBroadcaster( + $this->app->make('redis'), $config['connection'] ?? null + ); + } + + /** + * Create an instance of the driver. + * + * @param array $config + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + */ + protected function createLogDriver(array $config) + { + return new LogBroadcaster( + $this->app->make(LoggerInterface::class) + ); + } + + /** + * Create an instance of the driver. + * + * @param array $config + * @return \Illuminate\Contracts\Broadcasting\Broadcaster + */ + protected function createNullDriver(array $config) + { + return new NullBroadcaster; + } + + /** + * Get the connection configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + return $this->app['config']["broadcasting.connections.{$name}"]; + } + + /** + * Get the default driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['broadcasting.default']; + } + + /** + * Set the default driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['broadcasting.default'] = $name; + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback; + + return $this; + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->driver()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastServiceProvider.php new file mode 100644 index 0000000..adf88a6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastServiceProvider.php @@ -0,0 +1,51 @@ +app->singleton(BroadcastManager::class, function ($app) { + return new BroadcastManager($app); + }); + + $this->app->singleton(BroadcasterContract::class, function ($app) { + return $app->make(BroadcastManager::class)->connection(); + }); + + $this->app->alias( + BroadcastManager::class, BroadcastingFactory::class + ); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + BroadcastManager::class, + BroadcastingFactory::class, + BroadcasterContract::class, + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php new file mode 100644 index 0000000..9a458ea --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php @@ -0,0 +1,263 @@ +channels[$channel] = $callback; + + return $this; + } + + /** + * Authenticate the incoming request for a given channel. + * + * @param \Illuminate\Http\Request $request + * @param string $channel + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException + */ + protected function verifyUserCanAccessChannel($request, $channel) + { + foreach ($this->channels as $pattern => $callback) { + if (! Str::is(preg_replace('/\{(.*?)\}/', '*', $pattern), $channel)) { + continue; + } + + $parameters = $this->extractAuthParameters($pattern, $channel, $callback); + + $handler = $this->normalizeChannelHandlerToCallable($callback); + + if ($result = $handler($request->user(), ...$parameters)) { + return $this->validAuthenticationResponse($request, $result); + } + } + + throw new AccessDeniedHttpException; + } + + /** + * Extract the parameters from the given pattern and channel. + * + * @param string $pattern + * @param string $channel + * @param callable|string $callback + * @return array + */ + protected function extractAuthParameters($pattern, $channel, $callback) + { + $callbackParameters = $this->extractParameters($callback); + + return collect($this->extractChannelKeys($pattern, $channel))->reject(function ($value, $key) { + return is_numeric($key); + })->map(function ($value, $key) use ($callbackParameters) { + return $this->resolveBinding($key, $value, $callbackParameters); + })->values()->all(); + } + + /** + * Extracts the parameters out of what the user passed to handle the channel authentication. + * + * @param callable|string $callback + * @return \ReflectionParameter[] + * + * @throws \Exception + */ + protected function extractParameters($callback) + { + if (is_callable($callback)) { + return (new ReflectionFunction($callback))->getParameters(); + } elseif (is_string($callback)) { + return $this->extractParametersFromClass($callback); + } + + throw new Exception('Given channel handler is an unknown type.'); + } + + /** + * Extracts the parameters out of a class channel's "join" method. + * + * @param string $callback + * @return \ReflectionParameter[] + * + * @throws \Exception + */ + protected function extractParametersFromClass($callback) + { + $reflection = new ReflectionClass($callback); + + if (! $reflection->hasMethod('join')) { + throw new Exception('Class based channel must define a "join" method.'); + } + + return $reflection->getMethod('join')->getParameters(); + } + + /** + * Extract the channel keys from the incoming channel name. + * + * @param string $pattern + * @param string $channel + * @return array + */ + protected function extractChannelKeys($pattern, $channel) + { + preg_match('/^'.preg_replace('/\{(.*?)\}/', '(?<$1>[^\.]+)', $pattern).'/', $channel, $keys); + + return $keys; + } + + /** + * Resolve the given parameter binding. + * + * @param string $key + * @param string $value + * @param array $callbackParameters + * @return mixed + */ + protected function resolveBinding($key, $value, $callbackParameters) + { + $newValue = $this->resolveExplicitBindingIfPossible($key, $value); + + return $newValue === $value ? $this->resolveImplicitBindingIfPossible( + $key, $value, $callbackParameters + ) : $newValue; + } + + /** + * Resolve an explicit parameter binding if applicable. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function resolveExplicitBindingIfPossible($key, $value) + { + $binder = $this->binder(); + + if ($binder && $binder->getBindingCallback($key)) { + return call_user_func($binder->getBindingCallback($key), $value); + } + + return $value; + } + + /** + * Resolve an implicit parameter binding if applicable. + * + * @param string $key + * @param mixed $value + * @param array $callbackParameters + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException + */ + protected function resolveImplicitBindingIfPossible($key, $value, $callbackParameters) + { + foreach ($callbackParameters as $parameter) { + if (! $this->isImplicitlyBindable($key, $parameter)) { + continue; + } + + $instance = $parameter->getClass()->newInstance(); + + if (! $model = $instance->resolveRouteBinding($value)) { + throw new AccessDeniedHttpException; + } + + return $model; + } + + return $value; + } + + /** + * Determine if a given key and parameter is implicitly bindable. + * + * @param string $key + * @param \ReflectionParameter $parameter + * @return bool + */ + protected function isImplicitlyBindable($key, $parameter) + { + return $parameter->name === $key && $parameter->getClass() && + $parameter->getClass()->isSubclassOf(UrlRoutable::class); + } + + /** + * Format the channel array into an array of strings. + * + * @param array $channels + * @return array + */ + protected function formatChannels(array $channels) + { + return array_map(function ($channel) { + return (string) $channel; + }, $channels); + } + + /** + * Get the model binding registrar instance. + * + * @return \Illuminate\Contracts\Routing\BindingRegistrar + */ + protected function binder() + { + if (! $this->bindingRegistrar) { + $this->bindingRegistrar = Container::getInstance()->bound(BindingRegistrar::class) + ? Container::getInstance()->make(BindingRegistrar::class) : null; + } + + return $this->bindingRegistrar; + } + + /** + * Normalize the given callback into a callable. + * + * @param mixed $callback + * @return callable|\Closure + */ + protected function normalizeChannelHandlerToCallable($callback) + { + return is_callable($callback) ? $callback : function (...$args) use ($callback) { + return Container::getInstance() + ->make($callback) + ->join(...$args); + }; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php new file mode 100644 index 0000000..50877dc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/LogBroadcaster.php @@ -0,0 +1,54 @@ +logger = $logger; + } + + /** + * {@inheritdoc} + */ + public function auth($request) + { + // + } + + /** + * {@inheritdoc} + */ + public function validAuthenticationResponse($request, $result) + { + // + } + + /** + * {@inheritdoc} + */ + public function broadcast(array $channels, $event, array $payload = []) + { + $channels = implode(', ', $this->formatChannels($channels)); + + $payload = json_encode($payload, JSON_PRETTY_PRINT); + + $this->logger->info('Broadcasting ['.$event.'] on channels ['.$channels.'] with payload:'.PHP_EOL.$payload); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/NullBroadcaster.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/NullBroadcaster.php new file mode 100644 index 0000000..6205c90 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/NullBroadcaster.php @@ -0,0 +1,30 @@ +pusher = $pusher; + } + + /** + * Authenticate the incoming request for a given channel. + * + * @param \Illuminate\Http\Request $request + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException + */ + public function auth($request) + { + if (Str::startsWith($request->channel_name, ['private-', 'presence-']) && + ! $request->user()) { + throw new AccessDeniedHttpException; + } + + $channelName = Str::startsWith($request->channel_name, 'private-') + ? Str::replaceFirst('private-', '', $request->channel_name) + : Str::replaceFirst('presence-', '', $request->channel_name); + + return parent::verifyUserCanAccessChannel( + $request, $channelName + ); + } + + /** + * Return the valid authentication response. + * + * @param \Illuminate\Http\Request $request + * @param mixed $result + * @return mixed + */ + public function validAuthenticationResponse($request, $result) + { + if (Str::startsWith($request->channel_name, 'private')) { + return $this->decodePusherResponse( + $request, $this->pusher->socket_auth($request->channel_name, $request->socket_id) + ); + } + + return $this->decodePusherResponse( + $request, + $this->pusher->presence_auth( + $request->channel_name, $request->socket_id, + $request->user()->getAuthIdentifier(), $result + ) + ); + } + + /** + * Decode the given Pusher response. + * + * @param \Illuminate\Http\Request $request + * @param mixed $response + * @return array + */ + protected function decodePusherResponse($request, $response) + { + if (! $request->input('callback', false)) { + return json_decode($response, true); + } + + return response()->json(json_decode($response, true)) + ->withCallback($request->callback); + } + + /** + * Broadcast the given event. + * + * @param array $channels + * @param string $event + * @param array $payload + * @return void + */ + public function broadcast(array $channels, $event, array $payload = []) + { + $socket = Arr::pull($payload, 'socket'); + + $response = $this->pusher->trigger( + $this->formatChannels($channels), $event, $payload, $socket, true + ); + + if ((is_array($response) && $response['status'] >= 200 && $response['status'] <= 299) + || $response === true) { + return; + } + + throw new BroadcastException( + is_bool($response) ? 'Failed to connect to Pusher.' : $response['body'] + ); + } + + /** + * Get the Pusher SDK instance. + * + * @return \Pusher\Pusher + */ + public function getPusher() + { + return $this->pusher; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php new file mode 100644 index 0000000..2351e49 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php @@ -0,0 +1,104 @@ +redis = $redis; + $this->connection = $connection; + } + + /** + * Authenticate the incoming request for a given channel. + * + * @param \Illuminate\Http\Request $request + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException + */ + public function auth($request) + { + if (Str::startsWith($request->channel_name, ['private-', 'presence-']) && + ! $request->user()) { + throw new AccessDeniedHttpException; + } + + $channelName = Str::startsWith($request->channel_name, 'private-') + ? Str::replaceFirst('private-', '', $request->channel_name) + : Str::replaceFirst('presence-', '', $request->channel_name); + + return parent::verifyUserCanAccessChannel( + $request, $channelName + ); + } + + /** + * Return the valid authentication response. + * + * @param \Illuminate\Http\Request $request + * @param mixed $result + * @return mixed + */ + public function validAuthenticationResponse($request, $result) + { + if (is_bool($result)) { + return json_encode($result); + } + + return json_encode(['channel_data' => [ + 'user_id' => $request->user()->getAuthIdentifier(), + 'user_info' => $result, + ]]); + } + + /** + * Broadcast the given event. + * + * @param array $channels + * @param string $event + * @param array $payload + * @return void + */ + public function broadcast(array $channels, $event, array $payload = []) + { + $connection = $this->redis->connection($this->connection); + + $payload = json_encode([ + 'event' => $event, + 'data' => $payload, + 'socket' => Arr::pull($payload, 'socket'), + ]); + + foreach ($this->formatChannels($channels) as $channel) { + $connection->publish($channel, $payload); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/Channel.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/Channel.php new file mode 100644 index 0000000..798d602 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/Channel.php @@ -0,0 +1,34 @@ +name = $name; + } + + /** + * Convert the channel instance to a string. + * + * @return string + */ + public function __toString() + { + return $this->name; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/InteractsWithSockets.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/InteractsWithSockets.php new file mode 100644 index 0000000..6be0791 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/InteractsWithSockets.php @@ -0,0 +1,39 @@ +socket = Broadcast::socket(); + + return $this; + } + + /** + * Broadcast the event to everyone. + * + * @return $this + */ + public function broadcastToEveryone() + { + $this->socket = null; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/PendingBroadcast.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/PendingBroadcast.php new file mode 100644 index 0000000..b755029 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/PendingBroadcast.php @@ -0,0 +1,59 @@ +event = $event; + $this->events = $events; + } + + /** + * Broadcast the event to everyone except the current user. + * + * @return $this + */ + public function toOthers() + { + if (method_exists($this->event, 'dontBroadcastToCurrentUser')) { + $this->event->dontBroadcastToCurrentUser(); + } + + return $this; + } + + /** + * Handle the object's destruction. + * + * @return void + */ + public function __destruct() + { + $this->events->dispatch($this->event); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Broadcasting/PresenceChannel.php b/vendor/laravel/framework/src/Illuminate/Broadcasting/PresenceChannel.php new file mode 100644 index 0000000..22de12d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Broadcasting/PresenceChannel.php @@ -0,0 +1,17 @@ +app->singleton(Dispatcher::class, function ($app) { + return new Dispatcher($app, function ($connection = null) use ($app) { + return $app[QueueFactoryContract::class]->connection($connection); + }); + }); + + $this->app->alias( + Dispatcher::class, DispatcherContract::class + ); + + $this->app->alias( + Dispatcher::class, QueueingDispatcherContract::class + ); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + Dispatcher::class, + DispatcherContract::class, + QueueingDispatcherContract::class, + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php b/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php new file mode 100644 index 0000000..1a7b9a4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php @@ -0,0 +1,212 @@ +container = $container; + $this->queueResolver = $queueResolver; + $this->pipeline = new Pipeline($container); + } + + /** + * Dispatch a command to its appropriate handler. + * + * @param mixed $command + * @return mixed + */ + public function dispatch($command) + { + if ($this->queueResolver && $this->commandShouldBeQueued($command)) { + return $this->dispatchToQueue($command); + } + + return $this->dispatchNow($command); + } + + /** + * Dispatch a command to its appropriate handler in the current process. + * + * @param mixed $command + * @param mixed $handler + * @return mixed + */ + public function dispatchNow($command, $handler = null) + { + if ($handler || $handler = $this->getCommandHandler($command)) { + $callback = function ($command) use ($handler) { + return $handler->handle($command); + }; + } else { + $callback = function ($command) { + return $this->container->call([$command, 'handle']); + }; + } + + return $this->pipeline->send($command)->through($this->pipes)->then($callback); + } + + /** + * Determine if the given command has a handler. + * + * @param mixed $command + * @return bool + */ + public function hasCommandHandler($command) + { + return array_key_exists(get_class($command), $this->handlers); + } + + /** + * Retrieve the handler for a command. + * + * @param mixed $command + * @return bool|mixed + */ + public function getCommandHandler($command) + { + if ($this->hasCommandHandler($command)) { + return $this->container->make($this->handlers[get_class($command)]); + } + + return false; + } + + /** + * Determine if the given command should be queued. + * + * @param mixed $command + * @return bool + */ + protected function commandShouldBeQueued($command) + { + return $command instanceof ShouldQueue; + } + + /** + * Dispatch a command to its appropriate handler behind a queue. + * + * @param mixed $command + * @return mixed + * + * @throws \RuntimeException + */ + public function dispatchToQueue($command) + { + $connection = $command->connection ?? null; + + $queue = call_user_func($this->queueResolver, $connection); + + if (! $queue instanceof Queue) { + throw new RuntimeException('Queue resolver did not return a Queue implementation.'); + } + + if (method_exists($command, 'queue')) { + return $command->queue($queue, $command); + } + + return $this->pushCommandToQueue($queue, $command); + } + + /** + * Push the command onto the given queue instance. + * + * @param \Illuminate\Contracts\Queue\Queue $queue + * @param mixed $command + * @return mixed + */ + protected function pushCommandToQueue($queue, $command) + { + if (isset($command->queue, $command->delay)) { + return $queue->laterOn($command->queue, $command->delay, $command); + } + + if (isset($command->queue)) { + return $queue->pushOn($command->queue, $command); + } + + if (isset($command->delay)) { + return $queue->later($command->delay, $command); + } + + return $queue->push($command); + } + + /** + * Set the pipes through which commands should be piped before dispatching. + * + * @param array $pipes + * @return $this + */ + public function pipeThrough(array $pipes) + { + $this->pipes = $pipes; + + return $this; + } + + /** + * Map a command to a handler. + * + * @param array $map + * @return $this + */ + public function map(array $map) + { + $this->handlers = array_merge($this->handlers, $map); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Bus/Queueable.php b/vendor/laravel/framework/src/Illuminate/Bus/Queueable.php new file mode 100644 index 0000000..48cee18 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Bus/Queueable.php @@ -0,0 +1,150 @@ +connection = $connection; + + return $this; + } + + /** + * Set the desired queue for the job. + * + * @param string|null $queue + * @return $this + */ + public function onQueue($queue) + { + $this->queue = $queue; + + return $this; + } + + /** + * Set the desired connection for the chain. + * + * @param string|null $connection + * @return $this + */ + public function allOnConnection($connection) + { + $this->chainConnection = $connection; + $this->connection = $connection; + + return $this; + } + + /** + * Set the desired queue for the chain. + * + * @param string|null $queue + * @return $this + */ + public function allOnQueue($queue) + { + $this->chainQueue = $queue; + $this->queue = $queue; + + return $this; + } + + /** + * Set the desired delay for the job. + * + * @param \DateTimeInterface|\DateInterval|int|null $delay + * @return $this + */ + public function delay($delay) + { + $this->delay = $delay; + + return $this; + } + + /** + * Set the jobs that should run if this job is successful. + * + * @param array $chain + * @return $this + */ + public function chain($chain) + { + $this->chained = collect($chain)->map(function ($job) { + return serialize($job); + })->all(); + + return $this; + } + + /** + * Dispatch the next job on the chain. + * + * @return void + */ + public function dispatchNextJobInChain() + { + if (! empty($this->chained)) { + dispatch(tap(unserialize(array_shift($this->chained)), function ($next) { + $next->chained = $this->chained; + + $next->onConnection($next->connection ?: $this->chainConnection); + $next->onQueue($next->queue ?: $this->chainQueue); + + $next->chainConnection = $this->chainConnection; + $next->chainQueue = $this->chainQueue; + })); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Bus/composer.json b/vendor/laravel/framework/src/Illuminate/Bus/composer.json new file mode 100644 index 0000000..da911fd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Bus/composer.json @@ -0,0 +1,36 @@ +{ + "name": "illuminate/bus", + "description": "The Illuminate Bus package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/contracts": "5.7.*", + "illuminate/pipeline": "5.7.*", + "illuminate/support": "5.7.*" + }, + "autoload": { + "psr-4": { + "Illuminate\\Bus\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/ApcStore.php b/vendor/laravel/framework/src/Illuminate/Cache/ApcStore.php new file mode 100755 index 0000000..db11ea4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/ApcStore.php @@ -0,0 +1,132 @@ +apc = $apc; + $this->prefix = $prefix; + } + + /** + * Retrieve an item from the cache by key. + * + * @param string|array $key + * @return mixed + */ + public function get($key) + { + $value = $this->apc->get($this->prefix.$key); + + if ($value !== false) { + return $value; + } + } + + /** + * Store an item in the cache for a given number of minutes. + * + * @param string $key + * @param mixed $value + * @param float|int $minutes + * @return void + */ + public function put($key, $value, $minutes) + { + $this->apc->put($this->prefix.$key, $value, (int) ($minutes * 60)); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value = 1) + { + return $this->apc->increment($this->prefix.$key, $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value = 1) + { + return $this->apc->decrement($this->prefix.$key, $value); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->put($key, $value, 0); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + return $this->apc->delete($this->prefix.$key); + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + return $this->apc->flush(); + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/ApcWrapper.php b/vendor/laravel/framework/src/Illuminate/Cache/ApcWrapper.php new file mode 100755 index 0000000..42e76aa --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/ApcWrapper.php @@ -0,0 +1,92 @@ +apcu = function_exists('apcu_fetch'); + } + + /** + * Get an item from the cache. + * + * @param string $key + * @return mixed + */ + public function get($key) + { + return $this->apcu ? apcu_fetch($key) : apc_fetch($key); + } + + /** + * Store an item in the cache. + * + * @param string $key + * @param mixed $value + * @param int $seconds + * @return array|bool + */ + public function put($key, $value, $seconds) + { + return $this->apcu ? apcu_store($key, $value, $seconds) : apc_store($key, $value, $seconds); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value) + { + return $this->apcu ? apcu_inc($key, $value) : apc_inc($key, $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value) + { + return $this->apcu ? apcu_dec($key, $value) : apc_dec($key, $value); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function delete($key) + { + return $this->apcu ? apcu_delete($key) : apc_delete($key); + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + return $this->apcu ? apcu_clear_cache() : apc_clear_cache('user'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/ArrayStore.php b/vendor/laravel/framework/src/Illuminate/Cache/ArrayStore.php new file mode 100644 index 0000000..806f971 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/ArrayStore.php @@ -0,0 +1,115 @@ +storage[$key] ?? null; + } + + /** + * Store an item in the cache for a given number of minutes. + * + * @param string $key + * @param mixed $value + * @param float|int $minutes + * @return void + */ + public function put($key, $value, $minutes) + { + $this->storage[$key] = $value; + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function increment($key, $value = 1) + { + $this->storage[$key] = ! isset($this->storage[$key]) + ? $value : ((int) $this->storage[$key]) + $value; + + return $this->storage[$key]; + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function decrement($key, $value = 1) + { + return $this->increment($key, $value * -1); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->put($key, $value, 0); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + unset($this->storage[$key]); + + return true; + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + $this->storage = []; + + return true; + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php b/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php new file mode 100755 index 0000000..6c2e6d8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php @@ -0,0 +1,325 @@ +app = $app; + } + + /** + * Get a cache store instance by name. + * + * @param string|null $name + * @return \Illuminate\Contracts\Cache\Repository + */ + public function store($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + return $this->stores[$name] = $this->get($name); + } + + /** + * Get a cache driver instance. + * + * @param string|null $driver + * @return \Illuminate\Contracts\Cache\Repository + */ + public function driver($driver = null) + { + return $this->store($driver); + } + + /** + * Attempt to get the store from the local cache. + * + * @param string $name + * @return \Illuminate\Contracts\Cache\Repository + */ + protected function get($name) + { + return $this->stores[$name] ?? $this->resolve($name); + } + + /** + * Resolve the given store. + * + * @param string $name + * @return \Illuminate\Contracts\Cache\Repository + * + * @throws \InvalidArgumentException + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + if (is_null($config)) { + throw new InvalidArgumentException("Cache store [{$name}] is not defined."); + } + + if (isset($this->customCreators[$config['driver']])) { + return $this->callCustomCreator($config); + } else { + $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; + + if (method_exists($this, $driverMethod)) { + return $this->{$driverMethod}($config); + } else { + throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported."); + } + } + } + + /** + * Call a custom driver creator. + * + * @param array $config + * @return mixed + */ + protected function callCustomCreator(array $config) + { + return $this->customCreators[$config['driver']]($this->app, $config); + } + + /** + * Create an instance of the APC cache driver. + * + * @param array $config + * @return \Illuminate\Cache\ApcStore + */ + protected function createApcDriver(array $config) + { + $prefix = $this->getPrefix($config); + + return $this->repository(new ApcStore(new ApcWrapper, $prefix)); + } + + /** + * Create an instance of the array cache driver. + * + * @return \Illuminate\Cache\ArrayStore + */ + protected function createArrayDriver() + { + return $this->repository(new ArrayStore); + } + + /** + * Create an instance of the file cache driver. + * + * @param array $config + * @return \Illuminate\Cache\FileStore + */ + protected function createFileDriver(array $config) + { + return $this->repository(new FileStore($this->app['files'], $config['path'])); + } + + /** + * Create an instance of the Memcached cache driver. + * + * @param array $config + * @return \Illuminate\Cache\MemcachedStore + */ + protected function createMemcachedDriver(array $config) + { + $prefix = $this->getPrefix($config); + + $memcached = $this->app['memcached.connector']->connect( + $config['servers'], + $config['persistent_id'] ?? null, + $config['options'] ?? [], + array_filter($config['sasl'] ?? []) + ); + + return $this->repository(new MemcachedStore($memcached, $prefix)); + } + + /** + * Create an instance of the Null cache driver. + * + * @return \Illuminate\Cache\NullStore + */ + protected function createNullDriver() + { + return $this->repository(new NullStore); + } + + /** + * Create an instance of the Redis cache driver. + * + * @param array $config + * @return \Illuminate\Cache\RedisStore + */ + protected function createRedisDriver(array $config) + { + $redis = $this->app['redis']; + + $connection = $config['connection'] ?? 'default'; + + return $this->repository(new RedisStore($redis, $this->getPrefix($config), $connection)); + } + + /** + * Create an instance of the database cache driver. + * + * @param array $config + * @return \Illuminate\Cache\DatabaseStore + */ + protected function createDatabaseDriver(array $config) + { + $connection = $this->app['db']->connection($config['connection'] ?? null); + + return $this->repository( + new DatabaseStore( + $connection, $config['table'], $this->getPrefix($config) + ) + ); + } + + /** + * Create a new cache repository with the given implementation. + * + * @param \Illuminate\Contracts\Cache\Store $store + * @return \Illuminate\Cache\Repository + */ + public function repository(Store $store) + { + $repository = new Repository($store); + + if ($this->app->bound(DispatcherContract::class)) { + $repository->setEventDispatcher( + $this->app[DispatcherContract::class] + ); + } + + return $repository; + } + + /** + * Get the cache prefix. + * + * @param array $config + * @return string + */ + protected function getPrefix(array $config) + { + return $config['prefix'] ?? $this->app['config']['cache.prefix']; + } + + /** + * Get the cache connection configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + return $this->app['config']["cache.stores.{$name}"]; + } + + /** + * Get the default cache driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['cache.default']; + } + + /** + * Set the default cache driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['cache.default'] = $name; + } + + /** + * Unset the given driver instances. + * + * @param array|string|null $name + * @return $this + */ + public function forgetDriver($name = null) + { + $name = $name ?? $this->getDefaultDriver(); + + foreach ((array) $name as $cacheName) { + if (isset($this->stores[$cacheName])) { + unset($this->stores[$cacheName]); + } + } + + return $this; + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback->bindTo($this, $this); + + return $this; + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->store()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/CacheServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Cache/CacheServiceProvider.php new file mode 100755 index 0000000..8eb5ed6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/CacheServiceProvider.php @@ -0,0 +1,47 @@ +app->singleton('cache', function ($app) { + return new CacheManager($app); + }); + + $this->app->singleton('cache.store', function ($app) { + return $app['cache']->driver(); + }); + + $this->app->singleton('memcached.connector', function () { + return new MemcachedConnector; + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'cache', 'cache.store', 'memcached.connector', + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Console/CacheTableCommand.php b/vendor/laravel/framework/src/Illuminate/Cache/Console/CacheTableCommand.php new file mode 100644 index 0000000..bde2d4b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Console/CacheTableCommand.php @@ -0,0 +1,81 @@ +files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $fullPath = $this->createBaseMigration(); + + $this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/cache.stub')); + + $this->info('Migration created successfully!'); + + $this->composer->dumpAutoloads(); + } + + /** + * Create a base migration file for the table. + * + * @return string + */ + protected function createBaseMigration() + { + $name = 'create_cache_table'; + + $path = $this->laravel->databasePath().'/migrations'; + + return $this->laravel['migration.creator']->create($name, $path); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Console/ClearCommand.php b/vendor/laravel/framework/src/Illuminate/Cache/Console/ClearCommand.php new file mode 100755 index 0000000..4feeb17 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Console/ClearCommand.php @@ -0,0 +1,145 @@ +cache = $cache; + $this->files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->laravel['events']->dispatch( + 'cache:clearing', [$this->argument('store'), $this->tags()] + ); + + $successful = $this->cache()->flush(); + + $this->flushFacades(); + + if (! $successful) { + return $this->error('Failed to clear cache. Make sure you have the appropriate permissions.'); + } + + $this->laravel['events']->dispatch( + 'cache:cleared', [$this->argument('store'), $this->tags()] + ); + + $this->info('Application cache cleared!'); + } + + /** + * Flush the real-time facades stored in the cache directory. + * + * @return void + */ + public function flushFacades() + { + if (! $this->files->exists($storagePath = storage_path('framework/cache'))) { + return; + } + + foreach ($this->files->files($storagePath) as $file) { + if (preg_match('/facade-.*\.php$/', $file)) { + $this->files->delete($file); + } + } + } + + /** + * Get the cache instance for the command. + * + * @return \Illuminate\Cache\Repository + */ + protected function cache() + { + $cache = $this->cache->store($this->argument('store')); + + return empty($this->tags()) ? $cache : $cache->tags($this->tags()); + } + + /** + * Get the tags passed to the command. + * + * @return array + */ + protected function tags() + { + return array_filter(explode(',', $this->option('tags'))); + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['store', InputArgument::OPTIONAL, 'The name of the store you would like to clear'], + ]; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['tags', null, InputOption::VALUE_OPTIONAL, 'The cache tags you would like to clear', null], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Console/ForgetCommand.php b/vendor/laravel/framework/src/Illuminate/Cache/Console/ForgetCommand.php new file mode 100755 index 0000000..646dc14 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Console/ForgetCommand.php @@ -0,0 +1,57 @@ +cache = $cache; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->cache->store($this->argument('store'))->forget( + $this->argument('key') + ); + + $this->info('The ['.$this->argument('key').'] key has been removed from the cache.'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Console/stubs/cache.stub b/vendor/laravel/framework/src/Illuminate/Cache/Console/stubs/cache.stub new file mode 100644 index 0000000..058afe6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Console/stubs/cache.stub @@ -0,0 +1,32 @@ +string('key')->unique(); + $table->mediumText('value'); + $table->integer('expiration'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('cache'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/DatabaseStore.php b/vendor/laravel/framework/src/Illuminate/Cache/DatabaseStore.php new file mode 100755 index 0000000..8a68c50 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/DatabaseStore.php @@ -0,0 +1,292 @@ +table = $table; + $this->prefix = $prefix; + $this->connection = $connection; + } + + /** + * Retrieve an item from the cache by key. + * + * @param string|array $key + * @return mixed + */ + public function get($key) + { + $prefixed = $this->prefix.$key; + + $cache = $this->table()->where('key', '=', $prefixed)->first(); + + // If we have a cache record we will check the expiration time against current + // time on the system and see if the record has expired. If it has, we will + // remove the records from the database table so it isn't returned again. + if (is_null($cache)) { + return; + } + + $cache = is_array($cache) ? (object) $cache : $cache; + + // If this cache expiration date is past the current time, we will remove this + // item from the cache. Then we will return a null value since the cache is + // expired. We will use "Carbon" to make this comparison with the column. + if ($this->currentTime() >= $cache->expiration) { + $this->forget($key); + + return; + } + + return $this->unserialize($cache->value); + } + + /** + * Store an item in the cache for a given number of minutes. + * + * @param string $key + * @param mixed $value + * @param float|int $minutes + * @return void + */ + public function put($key, $value, $minutes) + { + $key = $this->prefix.$key; + + $value = $this->serialize($value); + + $expiration = $this->getTime() + (int) ($minutes * 60); + + try { + $this->table()->insert(compact('key', 'value', 'expiration')); + } catch (Exception $e) { + $this->table()->where('key', $key)->update(compact('value', 'expiration')); + } + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value = 1) + { + return $this->incrementOrDecrement($key, $value, function ($current, $value) { + return $current + $value; + }); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value = 1) + { + return $this->incrementOrDecrement($key, $value, function ($current, $value) { + return $current - $value; + }); + } + + /** + * Increment or decrement an item in the cache. + * + * @param string $key + * @param mixed $value + * @param \Closure $callback + * @return int|bool + */ + protected function incrementOrDecrement($key, $value, Closure $callback) + { + return $this->connection->transaction(function () use ($key, $value, $callback) { + $prefixed = $this->prefix.$key; + + $cache = $this->table()->where('key', $prefixed) + ->lockForUpdate()->first(); + + // If there is no value in the cache, we will return false here. Otherwise the + // value will be decrypted and we will proceed with this function to either + // increment or decrement this value based on the given action callbacks. + if (is_null($cache)) { + return false; + } + + $cache = is_array($cache) ? (object) $cache : $cache; + + $current = $this->unserialize($cache->value); + + // Here we'll call this callback function that was given to the function which + // is used to either increment or decrement the function. We use a callback + // so we do not have to recreate all this logic in each of the functions. + $new = $callback((int) $current, $value); + + if (! is_numeric($current)) { + return false; + } + + // Here we will update the values in the table. We will also encrypt the value + // since database cache values are encrypted by default with secure storage + // that can't be easily read. We will return the new value after storing. + $this->table()->where('key', $prefixed)->update([ + 'value' => $this->serialize($new), + ]); + + return $new; + }); + } + + /** + * Get the current system time. + * + * @return int + */ + protected function getTime() + { + return $this->currentTime(); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->put($key, $value, 5256000); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + $this->table()->where('key', '=', $this->prefix.$key)->delete(); + + return true; + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + $this->table()->delete(); + + return true; + } + + /** + * Get a query builder for the cache table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function table() + { + return $this->connection->table($this->table); + } + + /** + * Get the underlying database connection. + * + * @return \Illuminate\Database\ConnectionInterface + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * Serialize the given value. + * + * @param mixed $value + * @return string + */ + protected function serialize($value) + { + $result = serialize($value); + + if ($this->connection instanceof PostgresConnection && Str::contains($result, "\0")) { + $result = base64_encode($result); + } + + return $result; + } + + /** + * Unserialize the given value. + * + * @param string $value + * @return mixed + */ + protected function unserialize($value) + { + if ($this->connection instanceof PostgresConnection && ! Str::contains($value, [':', ';'])) { + $value = base64_decode($value); + } + + return unserialize($value); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheEvent.php b/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheEvent.php new file mode 100644 index 0000000..6c9d42c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheEvent.php @@ -0,0 +1,46 @@ +key = $key; + $this->tags = $tags; + } + + /** + * Set the tags for the cache event. + * + * @param array $tags + * @return $this + */ + public function setTags($tags) + { + $this->tags = $tags; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheHit.php b/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheHit.php new file mode 100644 index 0000000..976c9e4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheHit.php @@ -0,0 +1,28 @@ +value = $value; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheMissed.php b/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheMissed.php new file mode 100644 index 0000000..d2a5c9f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Events/CacheMissed.php @@ -0,0 +1,8 @@ +value = $value; + $this->minutes = $minutes; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php b/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php new file mode 100755 index 0000000..cead4ac --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php @@ -0,0 +1,262 @@ +files = $files; + $this->directory = $directory; + } + + /** + * Retrieve an item from the cache by key. + * + * @param string|array $key + * @return mixed + */ + public function get($key) + { + return $this->getPayload($key)['data'] ?? null; + } + + /** + * Store an item in the cache for a given number of minutes. + * + * @param string $key + * @param mixed $value + * @param float|int $minutes + * @return void + */ + public function put($key, $value, $minutes) + { + $this->ensureCacheDirectoryExists($path = $this->path($key)); + + $this->files->put( + $path, $this->expiration($minutes).serialize($value), true + ); + } + + /** + * Create the file cache directory if necessary. + * + * @param string $path + * @return void + */ + protected function ensureCacheDirectoryExists($path) + { + if (! $this->files->exists(dirname($path))) { + $this->files->makeDirectory(dirname($path), 0777, true, true); + } + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function increment($key, $value = 1) + { + $raw = $this->getPayload($key); + + return tap(((int) $raw['data']) + $value, function ($newValue) use ($key, $raw) { + $this->put($key, $newValue, $raw['time'] ?? 0); + }); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function decrement($key, $value = 1) + { + return $this->increment($key, $value * -1); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->put($key, $value, 0); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + if ($this->files->exists($file = $this->path($key))) { + return $this->files->delete($file); + } + + return false; + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + if (! $this->files->isDirectory($this->directory)) { + return false; + } + + foreach ($this->files->directories($this->directory) as $directory) { + if (! $this->files->deleteDirectory($directory)) { + return false; + } + } + + return true; + } + + /** + * Retrieve an item and expiry time from the cache by key. + * + * @param string $key + * @return array + */ + protected function getPayload($key) + { + $path = $this->path($key); + + // If the file doesn't exist, we obviously cannot return the cache so we will + // just return null. Otherwise, we'll get the contents of the file and get + // the expiration UNIX timestamps from the start of the file's contents. + try { + $expire = substr( + $contents = $this->files->get($path, true), 0, 10 + ); + } catch (Exception $e) { + return $this->emptyPayload(); + } + + // If the current time is greater than expiration timestamps we will delete + // the file and return null. This helps clean up the old files and keeps + // this directory much cleaner for us as old files aren't hanging out. + if ($this->currentTime() >= $expire) { + $this->forget($key); + + return $this->emptyPayload(); + } + + $data = unserialize(substr($contents, 10)); + + // Next, we'll extract the number of minutes that are remaining for a cache + // so that we can properly retain the time for things like the increment + // operation that may be performed on this cache on a later operation. + $time = ($expire - $this->currentTime()) / 60; + + return compact('data', 'time'); + } + + /** + * Get a default empty payload for the cache. + * + * @return array + */ + protected function emptyPayload() + { + return ['data' => null, 'time' => null]; + } + + /** + * Get the full path for the given cache key. + * + * @param string $key + * @return string + */ + protected function path($key) + { + $parts = array_slice(str_split($hash = sha1($key), 2), 0, 2); + + return $this->directory.'/'.implode('/', $parts).'/'.$hash; + } + + /** + * Get the expiration time based on the given minutes. + * + * @param float|int $minutes + * @return int + */ + protected function expiration($minutes) + { + $time = $this->availableAt((int) ($minutes * 60)); + + return $minutes === 0 || $time > 9999999999 ? 9999999999 : (int) $time; + } + + /** + * Get the Filesystem instance. + * + * @return \Illuminate\Filesystem\Filesystem + */ + public function getFilesystem() + { + return $this->files; + } + + /** + * Get the working directory of the cache. + * + * @return string + */ + public function getDirectory() + { + return $this->directory; + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Lock.php b/vendor/laravel/framework/src/Illuminate/Cache/Lock.php new file mode 100644 index 0000000..f117246 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Lock.php @@ -0,0 +1,102 @@ +name = $name; + $this->seconds = $seconds; + } + + /** + * Attempt to acquire the lock. + * + * @return bool + */ + abstract public function acquire(); + + /** + * Release the lock. + * + * @return void + */ + abstract public function release(); + + /** + * Attempt to acquire the lock. + * + * @param callable|null $callback + * @return bool + */ + public function get($callback = null) + { + $result = $this->acquire(); + + if ($result && is_callable($callback)) { + return tap($callback(), function () { + $this->release(); + }); + } + + return $result; + } + + /** + * Attempt to acquire the lock for the given number of seconds. + * + * @param int $seconds + * @param callable|null $callback + * @return bool + * + * @throws \Illuminate\Contracts\Cache\LockTimeoutException + */ + public function block($seconds, $callback = null) + { + $starting = $this->currentTime(); + + while (! $this->acquire()) { + usleep(250 * 1000); + + if ($this->currentTime() - $seconds >= $starting) { + throw new LockTimeoutException; + } + } + + if (is_callable($callback)) { + return tap($callback(), function () { + $this->release(); + }); + } + + return true; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php b/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php new file mode 100755 index 0000000..224d940 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php @@ -0,0 +1,87 @@ +getMemcached( + $connectionId, $credentials, $options + ); + + if (! $memcached->getServerList()) { + // For each server in the array, we'll just extract the configuration and add + // the server to the Memcached connection. Once we have added all of these + // servers we'll verify the connection is successful and return it back. + foreach ($servers as $server) { + $memcached->addServer( + $server['host'], $server['port'], $server['weight'] + ); + } + } + + return $memcached; + } + + /** + * Get a new Memcached instance. + * + * @param string|null $connectionId + * @param array $credentials + * @param array $options + * @return \Memcached + */ + protected function getMemcached($connectionId, array $credentials, array $options) + { + $memcached = $this->createMemcachedInstance($connectionId); + + if (count($credentials) === 2) { + $this->setCredentials($memcached, $credentials); + } + + if (count($options)) { + $memcached->setOptions($options); + } + + return $memcached; + } + + /** + * Create the Memcached instance. + * + * @param string|null $connectionId + * @return \Memcached + */ + protected function createMemcachedInstance($connectionId) + { + return empty($connectionId) ? new Memcached : new Memcached($connectionId); + } + + /** + * Set the SASL credentials on the Memcached connection. + * + * @param \Memcached $memcached + * @param array $credentials + * @return void + */ + protected function setCredentials($memcached, $credentials) + { + [$username, $password] = $credentials; + + $memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, true); + + $memcached->setSaslAuthData($username, $password); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/MemcachedLock.php b/vendor/laravel/framework/src/Illuminate/Cache/MemcachedLock.php new file mode 100644 index 0000000..c0db841 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/MemcachedLock.php @@ -0,0 +1,50 @@ +memcached = $memcached; + } + + /** + * Attempt to acquire the lock. + * + * @return bool + */ + public function acquire() + { + return $this->memcached->add( + $this->name, 1, $this->seconds + ); + } + + /** + * Release the lock. + * + * @return void + */ + public function release() + { + $this->memcached->delete($this->name); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/MemcachedStore.php b/vendor/laravel/framework/src/Illuminate/Cache/MemcachedStore.php new file mode 100755 index 0000000..0d2d8c0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/MemcachedStore.php @@ -0,0 +1,274 @@ += 3.0.0. + * + * @var bool + */ + protected $onVersionThree; + + /** + * Create a new Memcached store. + * + * @param \Memcached $memcached + * @param string $prefix + * @return void + */ + public function __construct($memcached, $prefix = '') + { + $this->setPrefix($prefix); + $this->memcached = $memcached; + + $this->onVersionThree = (new ReflectionMethod('Memcached', 'getMulti')) + ->getNumberOfParameters() == 2; + } + + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @return mixed + */ + public function get($key) + { + $value = $this->memcached->get($this->prefix.$key); + + if ($this->memcached->getResultCode() == 0) { + return $value; + } + } + + /** + * Retrieve multiple items from the cache by key. + * + * Items not found in the cache will have a null value. + * + * @param array $keys + * @return array + */ + public function many(array $keys) + { + $prefixedKeys = array_map(function ($key) { + return $this->prefix.$key; + }, $keys); + + if ($this->onVersionThree) { + $values = $this->memcached->getMulti($prefixedKeys, Memcached::GET_PRESERVE_ORDER); + } else { + $null = null; + + $values = $this->memcached->getMulti($prefixedKeys, $null, Memcached::GET_PRESERVE_ORDER); + } + + if ($this->memcached->getResultCode() != 0) { + return array_fill_keys($keys, null); + } + + return array_combine($keys, $values); + } + + /** + * Store an item in the cache for a given number of minutes. + * + * @param string $key + * @param mixed $value + * @param float|int $minutes + * @return void + */ + public function put($key, $value, $minutes) + { + $this->memcached->set( + $this->prefix.$key, $value, $this->calculateExpiration($minutes) + ); + } + + /** + * Store multiple items in the cache for a given number of minutes. + * + * @param array $values + * @param float|int $minutes + * @return void + */ + public function putMany(array $values, $minutes) + { + $prefixedValues = []; + + foreach ($values as $key => $value) { + $prefixedValues[$this->prefix.$key] = $value; + } + + $this->memcached->setMulti( + $prefixedValues, $this->calculateExpiration($minutes) + ); + } + + /** + * Store an item in the cache if the key doesn't exist. + * + * @param string $key + * @param mixed $value + * @param float|int $minutes + * @return bool + */ + public function add($key, $value, $minutes) + { + return $this->memcached->add( + $this->prefix.$key, $value, $this->calculateExpiration($minutes) + ); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value = 1) + { + return $this->memcached->increment($this->prefix.$key, $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value = 1) + { + return $this->memcached->decrement($this->prefix.$key, $value); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->put($key, $value, 0); + } + + /** + * Get a lock instance. + * + * @param string $name + * @param int $seconds + * @return \Illuminate\Contracts\Cache\Lock + */ + public function lock($name, $seconds = 0) + { + return new MemcachedLock($this->memcached, $this->prefix.$name, $seconds); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + return $this->memcached->delete($this->prefix.$key); + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + return $this->memcached->flush(); + } + + /** + * Get the expiration time of the key. + * + * @param int $minutes + * @return int + */ + protected function calculateExpiration($minutes) + { + return $this->toTimestamp($minutes); + } + + /** + * Get the UNIX timestamp for the given number of minutes. + * + * @param int $minutes + * @return int + */ + protected function toTimestamp($minutes) + { + return $minutes > 0 ? $this->availableAt($minutes * 60) : 0; + } + + /** + * Get the underlying Memcached connection. + * + * @return \Memcached + */ + public function getMemcached() + { + return $this->memcached; + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * Set the cache key prefix. + * + * @param string $prefix + * @return void + */ + public function setPrefix($prefix) + { + $this->prefix = ! empty($prefix) ? $prefix.':' : ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/NullStore.php b/vendor/laravel/framework/src/Illuminate/Cache/NullStore.php new file mode 100755 index 0000000..16e869c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/NullStore.php @@ -0,0 +1,108 @@ +cache = $cache; + } + + /** + * Determine if the given key has been "accessed" too many times. + * + * @param string $key + * @param int $maxAttempts + * @return bool + */ + public function tooManyAttempts($key, $maxAttempts) + { + if ($this->attempts($key) >= $maxAttempts) { + if ($this->cache->has($key.':timer')) { + return true; + } + + $this->resetAttempts($key); + } + + return false; + } + + /** + * Increment the counter for a given key for a given decay time. + * + * @param string $key + * @param float|int $decayMinutes + * @return int + */ + public function hit($key, $decayMinutes = 1) + { + $this->cache->add( + $key.':timer', $this->availableAt($decayMinutes * 60), $decayMinutes + ); + + $added = $this->cache->add($key, 0, $decayMinutes); + + $hits = (int) $this->cache->increment($key); + + if (! $added && $hits == 1) { + $this->cache->put($key, 1, $decayMinutes); + } + + return $hits; + } + + /** + * Get the number of attempts for the given key. + * + * @param string $key + * @return mixed + */ + public function attempts($key) + { + return $this->cache->get($key, 0); + } + + /** + * Reset the number of attempts for the given key. + * + * @param string $key + * @return mixed + */ + public function resetAttempts($key) + { + return $this->cache->forget($key); + } + + /** + * Get the number of retries left for the given key. + * + * @param string $key + * @param int $maxAttempts + * @return int + */ + public function retriesLeft($key, $maxAttempts) + { + $attempts = $this->attempts($key); + + return $maxAttempts - $attempts; + } + + /** + * Clear the hits and lockout timer for the given key. + * + * @param string $key + * @return void + */ + public function clear($key) + { + $this->resetAttempts($key); + + $this->cache->forget($key.':timer'); + } + + /** + * Get the number of seconds until the "key" is accessible again. + * + * @param string $key + * @return int + */ + public function availableIn($key) + { + return $this->cache->get($key.':timer') - $this->currentTime(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/RedisLock.php b/vendor/laravel/framework/src/Illuminate/Cache/RedisLock.php new file mode 100644 index 0000000..6ce5afe --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/RedisLock.php @@ -0,0 +1,54 @@ +redis = $redis; + } + + /** + * Attempt to acquire the lock. + * + * @return bool + */ + public function acquire() + { + $result = $this->redis->setnx($this->name, 1); + + if ($result === 1 && $this->seconds > 0) { + $this->redis->expire($this->name, $this->seconds); + } + + return $result === 1; + } + + /** + * Release the lock. + * + * @return void + */ + public function release() + { + $this->redis->del($this->name); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php b/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php new file mode 100755 index 0000000..b448e46 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php @@ -0,0 +1,289 @@ +redis = $redis; + $this->setPrefix($prefix); + $this->setConnection($connection); + } + + /** + * Retrieve an item from the cache by key. + * + * @param string|array $key + * @return mixed + */ + public function get($key) + { + $value = $this->connection()->get($this->prefix.$key); + + return ! is_null($value) ? $this->unserialize($value) : null; + } + + /** + * Retrieve multiple items from the cache by key. + * + * Items not found in the cache will have a null value. + * + * @param array $keys + * @return array + */ + public function many(array $keys) + { + $results = []; + + $values = $this->connection()->mget(array_map(function ($key) { + return $this->prefix.$key; + }, $keys)); + + foreach ($values as $index => $value) { + $results[$keys[$index]] = ! is_null($value) ? $this->unserialize($value) : null; + } + + return $results; + } + + /** + * Store an item in the cache for a given number of minutes. + * + * @param string $key + * @param mixed $value + * @param float|int $minutes + * @return void + */ + public function put($key, $value, $minutes) + { + $this->connection()->setex( + $this->prefix.$key, (int) max(1, $minutes * 60), $this->serialize($value) + ); + } + + /** + * Store multiple items in the cache for a given number of minutes. + * + * @param array $values + * @param float|int $minutes + * @return void + */ + public function putMany(array $values, $minutes) + { + $this->connection()->multi(); + + foreach ($values as $key => $value) { + $this->put($key, $value, $minutes); + } + + $this->connection()->exec(); + } + + /** + * Store an item in the cache if the key doesn't exist. + * + * @param string $key + * @param mixed $value + * @param float|int $minutes + * @return bool + */ + public function add($key, $value, $minutes) + { + $lua = "return redis.call('exists',KEYS[1])<1 and redis.call('setex',KEYS[1],ARGV[2],ARGV[1])"; + + return (bool) $this->connection()->eval( + $lua, 1, $this->prefix.$key, $this->serialize($value), (int) max(1, $minutes * 60) + ); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function increment($key, $value = 1) + { + return $this->connection()->incrby($this->prefix.$key, $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int + */ + public function decrement($key, $value = 1) + { + return $this->connection()->decrby($this->prefix.$key, $value); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->connection()->set($this->prefix.$key, $this->serialize($value)); + } + + /** + * Get a lock instance. + * + * @param string $name + * @param int $seconds + * @return \Illuminate\Contracts\Cache\Lock + */ + public function lock($name, $seconds = 0) + { + return new RedisLock($this->connection(), $this->prefix.$name, $seconds); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + return (bool) $this->connection()->del($this->prefix.$key); + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + $this->connection()->flushdb(); + + return true; + } + + /** + * Begin executing a new tags operation. + * + * @param array|mixed $names + * @return \Illuminate\Cache\RedisTaggedCache + */ + public function tags($names) + { + return new RedisTaggedCache( + $this, new TagSet($this, is_array($names) ? $names : func_get_args()) + ); + } + + /** + * Get the Redis connection instance. + * + * @return \Predis\ClientInterface + */ + public function connection() + { + return $this->redis->connection($this->connection); + } + + /** + * Set the connection name to be used. + * + * @param string $connection + * @return void + */ + public function setConnection($connection) + { + $this->connection = $connection; + } + + /** + * Get the Redis database instance. + * + * @return \Illuminate\Contracts\Redis\Factory + */ + public function getRedis() + { + return $this->redis; + } + + /** + * Get the cache key prefix. + * + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * Set the cache key prefix. + * + * @param string $prefix + * @return void + */ + public function setPrefix($prefix) + { + $this->prefix = ! empty($prefix) ? $prefix.':' : ''; + } + + /** + * Serialize the value. + * + * @param mixed $value + * @return mixed + */ + protected function serialize($value) + { + return is_numeric($value) ? $value : serialize($value); + } + + /** + * Unserialize the value. + * + * @param mixed $value + * @return mixed + */ + protected function unserialize($value) + { + return is_numeric($value) ? $value : unserialize($value); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php b/vendor/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php new file mode 100644 index 0000000..7a28d82 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/RedisTaggedCache.php @@ -0,0 +1,194 @@ +pushStandardKeys($this->tags->getNamespace(), $key); + + parent::put($key, $value, $minutes); + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function increment($key, $value = 1) + { + $this->pushStandardKeys($this->tags->getNamespace(), $key); + + parent::increment($key, $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function decrement($key, $value = 1) + { + $this->pushStandardKeys($this->tags->getNamespace(), $key); + + parent::decrement($key, $value); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->pushForeverKeys($this->tags->getNamespace(), $key); + + parent::forever($key, $value); + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + $this->deleteForeverKeys(); + $this->deleteStandardKeys(); + + return parent::flush(); + } + + /** + * Store standard key references into store. + * + * @param string $namespace + * @param string $key + * @return void + */ + protected function pushStandardKeys($namespace, $key) + { + $this->pushKeys($namespace, $key, self::REFERENCE_KEY_STANDARD); + } + + /** + * Store forever key references into store. + * + * @param string $namespace + * @param string $key + * @return void + */ + protected function pushForeverKeys($namespace, $key) + { + $this->pushKeys($namespace, $key, self::REFERENCE_KEY_FOREVER); + } + + /** + * Store a reference to the cache key against the reference key. + * + * @param string $namespace + * @param string $key + * @param string $reference + * @return void + */ + protected function pushKeys($namespace, $key, $reference) + { + $fullKey = $this->store->getPrefix().sha1($namespace).':'.$key; + + foreach (explode('|', $namespace) as $segment) { + $this->store->connection()->sadd($this->referenceKey($segment, $reference), $fullKey); + } + } + + /** + * Delete all of the items that were stored forever. + * + * @return void + */ + protected function deleteForeverKeys() + { + $this->deleteKeysByReference(self::REFERENCE_KEY_FOREVER); + } + + /** + * Delete all standard items. + * + * @return void + */ + protected function deleteStandardKeys() + { + $this->deleteKeysByReference(self::REFERENCE_KEY_STANDARD); + } + + /** + * Find and delete all of the items that were stored against a reference. + * + * @param string $reference + * @return void + */ + protected function deleteKeysByReference($reference) + { + foreach (explode('|', $this->tags->getNamespace()) as $segment) { + $this->deleteValues($segment = $this->referenceKey($segment, $reference)); + + $this->store->connection()->del($segment); + } + } + + /** + * Delete item keys that have been stored against a reference. + * + * @param string $referenceKey + * @return void + */ + protected function deleteValues($referenceKey) + { + $values = array_unique($this->store->connection()->smembers($referenceKey)); + + if (count($values) > 0) { + foreach (array_chunk($values, 1000) as $valuesChunk) { + call_user_func_array([$this->store->connection(), 'del'], $valuesChunk); + } + } + } + + /** + * Get the reference key for the segment. + * + * @param string $segment + * @param string $suffix + * @return string + */ + protected function referenceKey($segment, $suffix) + { + return $this->store->getPrefix().$segment.':'.$suffix; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/Repository.php b/vendor/laravel/framework/src/Illuminate/Cache/Repository.php new file mode 100755 index 0000000..afb0d2e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/Repository.php @@ -0,0 +1,599 @@ +store = $store; + } + + /** + * Determine if an item exists in the cache. + * + * @param string $key + * @return bool + */ + public function has($key) + { + return ! is_null($this->get($key)); + } + + /** + * Determine if an item doesn't exist in the cache. + * + * @param string $key + * @return bool + */ + public function missing($key) + { + return ! $this->has($key); + } + + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + if (is_array($key)) { + return $this->many($key); + } + + $value = $this->store->get($this->itemKey($key)); + + // If we could not find the cache value, we will fire the missed event and get + // the default value for this cache value. This default could be a callback + // so we will execute the value function which will resolve it if needed. + if (is_null($value)) { + $this->event(new CacheMissed($key)); + + $value = value($default); + } else { + $this->event(new CacheHit($key, $value)); + } + + return $value; + } + + /** + * Retrieve multiple items from the cache by key. + * + * Items not found in the cache will have a null value. + * + * @param array $keys + * @return array + */ + public function many(array $keys) + { + $values = $this->store->many(collect($keys)->map(function ($value, $key) { + return is_string($key) ? $key : $value; + })->values()->all()); + + return collect($values)->map(function ($value, $key) use ($keys) { + return $this->handleManyResult($keys, $key, $value); + })->all(); + } + + /** + * {@inheritdoc} + */ + public function getMultiple($keys, $default = null) + { + if (is_null($default)) { + return $this->many($keys); + } + + foreach ($keys as $key) { + if (! isset($default[$key])) { + $default[$key] = null; + } + } + + return $this->many($default); + } + + /** + * Handle a result for the "many" method. + * + * @param array $keys + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function handleManyResult($keys, $key, $value) + { + // If we could not find the cache value, we will fire the missed event and get + // the default value for this cache value. This default could be a callback + // so we will execute the value function which will resolve it if needed. + if (is_null($value)) { + $this->event(new CacheMissed($key)); + + return isset($keys[$key]) ? value($keys[$key]) : null; + } + + // If we found a valid value we will fire the "hit" event and return the value + // back from this function. The "hit" event gives developers an opportunity + // to listen for every possible cache "hit" throughout this applications. + $this->event(new CacheHit($key, $value)); + + return $value; + } + + /** + * Retrieve an item from the cache and delete it. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function pull($key, $default = null) + { + return tap($this->get($key, $default), function () use ($key) { + $this->forget($key); + }); + } + + /** + * Store an item in the cache. + * + * @param string $key + * @param mixed $value + * @param \DateTimeInterface|\DateInterval|float|int|null $minutes + * @return void + */ + public function put($key, $value, $minutes = null) + { + if (is_array($key)) { + $this->putMany($key, $value); + + return; + } + + if (! is_null($minutes = $this->getMinutes($minutes))) { + $this->store->put($this->itemKey($key), $value, $minutes); + + $this->event(new KeyWritten($key, $value, $minutes)); + } + } + + /** + * {@inheritdoc} + */ + public function set($key, $value, $ttl = null) + { + $this->put($key, $value, $ttl); + } + + /** + * Store multiple items in the cache for a given number of minutes. + * + * @param array $values + * @param \DateTimeInterface|\DateInterval|float|int $minutes + * @return void + */ + public function putMany(array $values, $minutes) + { + if (! is_null($minutes = $this->getMinutes($minutes))) { + $this->store->putMany($values, $minutes); + + foreach ($values as $key => $value) { + $this->event(new KeyWritten($key, $value, $minutes)); + } + } + } + + /** + * {@inheritdoc} + */ + public function setMultiple($values, $ttl = null) + { + $this->putMany($values, $ttl); + } + + /** + * Store an item in the cache if the key does not exist. + * + * @param string $key + * @param mixed $value + * @param \DateTimeInterface|\DateInterval|float|int $minutes + * @return bool + */ + public function add($key, $value, $minutes) + { + if (is_null($minutes = $this->getMinutes($minutes))) { + return false; + } + + // If the store has an "add" method we will call the method on the store so it + // has a chance to override this logic. Some drivers better support the way + // this operation should work with a total "atomic" implementation of it. + if (method_exists($this->store, 'add')) { + return $this->store->add( + $this->itemKey($key), $value, $minutes + ); + } + + // If the value did not exist in the cache, we will put the value in the cache + // so it exists for subsequent requests. Then, we will return true so it is + // easy to know if the value gets added. Otherwise, we will return false. + if (is_null($this->get($key))) { + $this->put($key, $value, $minutes); + + return true; + } + + return false; + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function increment($key, $value = 1) + { + return $this->store->increment($key, $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return int|bool + */ + public function decrement($key, $value = 1) + { + return $this->store->decrement($key, $value); + } + + /** + * Store an item in the cache indefinitely. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function forever($key, $value) + { + $this->store->forever($this->itemKey($key), $value); + + $this->event(new KeyWritten($key, $value, 0)); + } + + /** + * Get an item from the cache, or execute the given Closure and store the result. + * + * @param string $key + * @param \DateTimeInterface|\DateInterval|float|int $minutes + * @param \Closure $callback + * @return mixed + */ + public function remember($key, $minutes, Closure $callback) + { + $value = $this->get($key); + + // If the item exists in the cache we will just return this immediately and if + // not we will execute the given Closure and cache the result of that for a + // given number of minutes so it's available for all subsequent requests. + if (! is_null($value)) { + return $value; + } + + $this->put($key, $value = $callback(), $minutes); + + return $value; + } + + /** + * Get an item from the cache, or execute the given Closure and store the result forever. + * + * @param string $key + * @param \Closure $callback + * @return mixed + */ + public function sear($key, Closure $callback) + { + return $this->rememberForever($key, $callback); + } + + /** + * Get an item from the cache, or execute the given Closure and store the result forever. + * + * @param string $key + * @param \Closure $callback + * @return mixed + */ + public function rememberForever($key, Closure $callback) + { + $value = $this->get($key); + + // If the item exists in the cache we will just return this immediately and if + // not we will execute the given Closure and cache the result of that for a + // given number of minutes so it's available for all subsequent requests. + if (! is_null($value)) { + return $value; + } + + $this->forever($key, $value = $callback()); + + return $value; + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return bool + */ + public function forget($key) + { + return tap($this->store->forget($this->itemKey($key)), function () use ($key) { + $this->event(new KeyForgotten($key)); + }); + } + + /** + * {@inheritdoc} + */ + public function delete($key) + { + return $this->forget($key); + } + + /** + * {@inheritdoc} + */ + public function deleteMultiple($keys) + { + foreach ($keys as $key) { + $this->forget($key); + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function clear() + { + return $this->store->flush(); + } + + /** + * Begin executing a new tags operation if the store supports it. + * + * @param array|mixed $names + * @return \Illuminate\Cache\TaggedCache + * + * @throws \BadMethodCallException + */ + public function tags($names) + { + if (! method_exists($this->store, 'tags')) { + throw new BadMethodCallException('This cache store does not support tagging.'); + } + + $cache = $this->store->tags(is_array($names) ? $names : func_get_args()); + + if (! is_null($this->events)) { + $cache->setEventDispatcher($this->events); + } + + return $cache->setDefaultCacheTime($this->default); + } + + /** + * Format the key for a cache item. + * + * @param string $key + * @return string + */ + protected function itemKey($key) + { + return $key; + } + + /** + * Get the default cache time. + * + * @return float|int + */ + public function getDefaultCacheTime() + { + return $this->default; + } + + /** + * Set the default cache time in minutes. + * + * @param float|int $minutes + * @return $this + */ + public function setDefaultCacheTime($minutes) + { + $this->default = $minutes; + + return $this; + } + + /** + * Get the cache store implementation. + * + * @return \Illuminate\Contracts\Cache\Store + */ + public function getStore() + { + return $this->store; + } + + /** + * Fire an event for this cache instance. + * + * @param string $event + * @return void + */ + protected function event($event) + { + if (isset($this->events)) { + $this->events->dispatch($event); + } + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function setEventDispatcher(Dispatcher $events) + { + $this->events = $events; + } + + /** + * Determine if a cached value exists. + * + * @param string $key + * @return bool + */ + public function offsetExists($key) + { + return $this->has($key); + } + + /** + * Retrieve an item from the cache by key. + * + * @param string $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->get($key); + } + + /** + * Store an item in the cache for the default time. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + $this->put($key, $value, $this->default); + } + + /** + * Remove an item from the cache. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + $this->forget($key); + } + + /** + * Calculate the number of minutes with the given duration. + * + * @param \DateTimeInterface|\DateInterval|float|int $duration + * @return float|int|null + */ + protected function getMinutes($duration) + { + $duration = $this->parseDateInterval($duration); + + if ($duration instanceof DateTimeInterface) { + $duration = Carbon::now()->diffInRealSeconds($duration, false) / 60; + } + + return (int) ($duration * 60) > 0 ? $duration : null; + } + + /** + * Handle dynamic calls into macros or pass missing methods to the store. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + return $this->store->$method(...$parameters); + } + + /** + * Clone cache repository instance. + * + * @return void + */ + public function __clone() + { + $this->store = clone $this->store; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/RetrievesMultipleKeys.php b/vendor/laravel/framework/src/Illuminate/Cache/RetrievesMultipleKeys.php new file mode 100644 index 0000000..4d46797 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/RetrievesMultipleKeys.php @@ -0,0 +1,39 @@ +get($key); + } + + return $return; + } + + /** + * Store multiple items in the cache for a given number of minutes. + * + * @param array $values + * @param float|int $minutes + * @return void + */ + public function putMany(array $values, $minutes) + { + foreach ($values as $key => $value) { + $this->put($key, $value, $minutes); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/TagSet.php b/vendor/laravel/framework/src/Illuminate/Cache/TagSet.php new file mode 100644 index 0000000..214d648 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/TagSet.php @@ -0,0 +1,110 @@ +store = $store; + $this->names = $names; + } + + /** + * Reset all tags in the set. + * + * @return void + */ + public function reset() + { + array_walk($this->names, [$this, 'resetTag']); + } + + /** + * Reset the tag and return the new tag identifier. + * + * @param string $name + * @return string + */ + public function resetTag($name) + { + $this->store->forever($this->tagKey($name), $id = str_replace('.', '', uniqid('', true))); + + return $id; + } + + /** + * Get a unique namespace that changes when any of the tags are flushed. + * + * @return string + */ + public function getNamespace() + { + return implode('|', $this->tagIds()); + } + + /** + * Get an array of tag identifiers for all of the tags in the set. + * + * @return array + */ + protected function tagIds() + { + return array_map([$this, 'tagId'], $this->names); + } + + /** + * Get the unique tag identifier for a given tag. + * + * @param string $name + * @return string + */ + public function tagId($name) + { + return $this->store->get($this->tagKey($name)) ?: $this->resetTag($name); + } + + /** + * Get the tag identifier key for a given tag. + * + * @param string $name + * @return string + */ + public function tagKey($name) + { + return 'tag:'.$name.':key'; + } + + /** + * Get all of the tag names in the set. + * + * @return array + */ + public function getNames() + { + return $this->names; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/TaggableStore.php b/vendor/laravel/framework/src/Illuminate/Cache/TaggableStore.php new file mode 100644 index 0000000..ba00fa4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/TaggableStore.php @@ -0,0 +1,17 @@ +tags = $tags; + } + + /** + * Increment the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function increment($key, $value = 1) + { + $this->store->increment($this->itemKey($key), $value); + } + + /** + * Decrement the value of an item in the cache. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function decrement($key, $value = 1) + { + $this->store->decrement($this->itemKey($key), $value); + } + + /** + * Remove all items from the cache. + * + * @return bool + */ + public function flush() + { + $this->tags->reset(); + + return true; + } + + /** + * {@inheritdoc} + */ + protected function itemKey($key) + { + return $this->taggedItemKey($key); + } + + /** + * Get a fully qualified key for a tagged item. + * + * @param string $key + * @return string + */ + public function taggedItemKey($key) + { + return sha1($this->tags->getNamespace()).':'.$key; + } + + /** + * Fire an event for this cache instance. + * + * @param string $event + * @return void + */ + protected function event($event) + { + parent::event($event->setTags($this->tags->getNames())); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cache/composer.json b/vendor/laravel/framework/src/Illuminate/Cache/composer.json new file mode 100755 index 0000000..a461242 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cache/composer.json @@ -0,0 +1,40 @@ +{ + "name": "illuminate/cache", + "description": "The Illuminate Cache package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*" + }, + "autoload": { + "psr-4": { + "Illuminate\\Cache\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "suggest": { + "illuminate/database": "Required to use the database cache driver (5.7.*).", + "illuminate/filesystem": "Required to use the file cache driver (5.7.*).", + "illuminate/redis": "Required to use the redis cache driver (5.7.*)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Config/Repository.php b/vendor/laravel/framework/src/Illuminate/Config/Repository.php new file mode 100644 index 0000000..cadcd64 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Config/Repository.php @@ -0,0 +1,179 @@ +items = $items; + } + + /** + * Determine if the given configuration value exists. + * + * @param string $key + * @return bool + */ + public function has($key) + { + return Arr::has($this->items, $key); + } + + /** + * Get the specified configuration value. + * + * @param array|string $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + if (is_array($key)) { + return $this->getMany($key); + } + + return Arr::get($this->items, $key, $default); + } + + /** + * Get many configuration values. + * + * @param array $keys + * @return array + */ + public function getMany($keys) + { + $config = []; + + foreach ($keys as $key => $default) { + if (is_numeric($key)) { + [$key, $default] = [$default, null]; + } + + $config[$key] = Arr::get($this->items, $key, $default); + } + + return $config; + } + + /** + * Set a given configuration value. + * + * @param array|string $key + * @param mixed $value + * @return void + */ + public function set($key, $value = null) + { + $keys = is_array($key) ? $key : [$key => $value]; + + foreach ($keys as $key => $value) { + Arr::set($this->items, $key, $value); + } + } + + /** + * Prepend a value onto an array configuration value. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function prepend($key, $value) + { + $array = $this->get($key); + + array_unshift($array, $value); + + $this->set($key, $array); + } + + /** + * Push a value onto an array configuration value. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function push($key, $value) + { + $array = $this->get($key); + + $array[] = $value; + + $this->set($key, $array); + } + + /** + * Get all of the configuration items for the application. + * + * @return array + */ + public function all() + { + return $this->items; + } + + /** + * Determine if the given configuration option exists. + * + * @param string $key + * @return bool + */ + public function offsetExists($key) + { + return $this->has($key); + } + + /** + * Get a configuration option. + * + * @param string $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->get($key); + } + + /** + * Set a configuration option. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + $this->set($key, $value); + } + + /** + * Unset a configuration option. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + $this->set($key, null); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Config/composer.json b/vendor/laravel/framework/src/Illuminate/Config/composer.json new file mode 100755 index 0000000..1dbdd4b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Config/composer.json @@ -0,0 +1,35 @@ +{ + "name": "illuminate/config", + "description": "The Illuminate Config package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*" + }, + "autoload": { + "psr-4": { + "Illuminate\\Config\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Application.php b/vendor/laravel/framework/src/Illuminate/Console/Application.php new file mode 100755 index 0000000..f8b9ca4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Application.php @@ -0,0 +1,296 @@ +laravel = $laravel; + $this->events = $events; + $this->setAutoExit(false); + $this->setCatchExceptions(false); + + $this->events->dispatch(new Events\ArtisanStarting($this)); + + $this->bootstrap(); + } + + /** + * {@inheritdoc} + */ + public function run(InputInterface $input = null, OutputInterface $output = null) + { + $commandName = $this->getCommandName( + $input = $input ?: new ArgvInput + ); + + $this->events->dispatch( + new Events\CommandStarting( + $commandName, $input, $output = $output ?: new ConsoleOutput + ) + ); + + $exitCode = parent::run($input, $output); + + $this->events->dispatch( + new Events\CommandFinished($commandName, $input, $output, $exitCode) + ); + + return $exitCode; + } + + /** + * Determine the proper PHP executable. + * + * @return string + */ + public static function phpBinary() + { + return ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)); + } + + /** + * Determine the proper Artisan executable. + * + * @return string + */ + public static function artisanBinary() + { + return defined('ARTISAN_BINARY') ? ProcessUtils::escapeArgument(ARTISAN_BINARY) : 'artisan'; + } + + /** + * Format the given command as a fully-qualified executable command. + * + * @param string $string + * @return string + */ + public static function formatCommandString($string) + { + return sprintf('%s %s %s', static::phpBinary(), static::artisanBinary(), $string); + } + + /** + * Register a console "starting" bootstrapper. + * + * @param \Closure $callback + * @return void + */ + public static function starting(Closure $callback) + { + static::$bootstrappers[] = $callback; + } + + /** + * Bootstrap the console application. + * + * @return void + */ + protected function bootstrap() + { + foreach (static::$bootstrappers as $bootstrapper) { + $bootstrapper($this); + } + } + + /** + * Clear the console application bootstrappers. + * + * @return void + */ + public static function forgetBootstrappers() + { + static::$bootstrappers = []; + } + + /** + * Run an Artisan console command by name. + * + * @param string $command + * @param array $parameters + * @param \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer + * @return int + * + * @throws \Symfony\Component\Console\Exception\CommandNotFoundException + */ + public function call($command, array $parameters = [], $outputBuffer = null) + { + if (is_subclass_of($command, SymfonyCommand::class)) { + $command = $this->laravel->make($command)->getName(); + } + + if (! $this->has($command)) { + throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $command)); + } + + array_unshift($parameters, $command); + + $this->lastOutput = $outputBuffer ?: new BufferedOutput; + + $this->setCatchExceptions(false); + + $result = $this->run(new ArrayInput($parameters), $this->lastOutput); + + $this->setCatchExceptions(true); + + return $result; + } + + /** + * Get the output for the last run command. + * + * @return string + */ + public function output() + { + return $this->lastOutput && method_exists($this->lastOutput, 'fetch') + ? $this->lastOutput->fetch() + : ''; + } + + /** + * Add a command to the console. + * + * @param \Symfony\Component\Console\Command\Command $command + * @return \Symfony\Component\Console\Command\Command + */ + public function add(SymfonyCommand $command) + { + if ($command instanceof Command) { + $command->setLaravel($this->laravel); + } + + return $this->addToParent($command); + } + + /** + * Add the command to the parent instance. + * + * @param \Symfony\Component\Console\Command\Command $command + * @return \Symfony\Component\Console\Command\Command + */ + protected function addToParent(SymfonyCommand $command) + { + return parent::add($command); + } + + /** + * Add a command, resolving through the application. + * + * @param string $command + * @return \Symfony\Component\Console\Command\Command + */ + public function resolve($command) + { + return $this->add($this->laravel->make($command)); + } + + /** + * Resolve an array of commands through the application. + * + * @param array|mixed $commands + * @return $this + */ + public function resolveCommands($commands) + { + $commands = is_array($commands) ? $commands : func_get_args(); + + foreach ($commands as $command) { + $this->resolve($command); + } + + return $this; + } + + /** + * Get the default input definition for the application. + * + * This is used to add the --env option to every available command. + * + * @return \Symfony\Component\Console\Input\InputDefinition + */ + protected function getDefaultInputDefinition() + { + return tap(parent::getDefaultInputDefinition(), function ($definition) { + $definition->addOption($this->getEnvironmentOption()); + }); + } + + /** + * Get the global environment option for the definition. + * + * @return \Symfony\Component\Console\Input\InputOption + */ + protected function getEnvironmentOption() + { + $message = 'The environment the command should run under'; + + return new InputOption('--env', null, InputOption::VALUE_OPTIONAL, $message); + } + + /** + * Get the Laravel application instance. + * + * @return \Illuminate\Contracts\Foundation\Application + */ + public function getLaravel() + { + return $this->laravel; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Command.php b/vendor/laravel/framework/src/Illuminate/Console/Command.php new file mode 100755 index 0000000..1d06646 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Command.php @@ -0,0 +1,604 @@ + OutputInterface::VERBOSITY_VERBOSE, + 'vv' => OutputInterface::VERBOSITY_VERY_VERBOSE, + 'vvv' => OutputInterface::VERBOSITY_DEBUG, + 'quiet' => OutputInterface::VERBOSITY_QUIET, + 'normal' => OutputInterface::VERBOSITY_NORMAL, + ]; + + /** + * Create a new console command instance. + * + * @return void + */ + public function __construct() + { + // We will go ahead and set the name, description, and parameters on console + // commands just to make things a little easier on the developer. This is + // so they don't have to all be manually specified in the constructors. + if (isset($this->signature)) { + $this->configureUsingFluentDefinition(); + } else { + parent::__construct($this->name); + } + + // Once we have constructed the command, we'll set the description and other + // related properties of the command. If a signature wasn't used to build + // the command we'll set the arguments and the options on this command. + $this->setDescription($this->description); + + $this->setHidden($this->isHidden()); + + if (! isset($this->signature)) { + $this->specifyParameters(); + } + } + + /** + * Configure the console command using a fluent definition. + * + * @return void + */ + protected function configureUsingFluentDefinition() + { + [$name, $arguments, $options] = Parser::parse($this->signature); + + parent::__construct($this->name = $name); + + // After parsing the signature we will spin through the arguments and options + // and set them on this command. These will already be changed into proper + // instances of these "InputArgument" and "InputOption" Symfony classes. + $this->getDefinition()->addArguments($arguments); + $this->getDefinition()->addOptions($options); + } + + /** + * Specify the arguments and options on the command. + * + * @return void + */ + protected function specifyParameters() + { + // We will loop through all of the arguments and options for the command and + // set them all on the base command instance. This specifies what can get + // passed into these commands as "parameters" to control the execution. + foreach ($this->getArguments() as $arguments) { + call_user_func_array([$this, 'addArgument'], $arguments); + } + + foreach ($this->getOptions() as $options) { + call_user_func_array([$this, 'addOption'], $options); + } + } + + /** + * Run the console command. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @return int + */ + public function run(InputInterface $input, OutputInterface $output) + { + $this->output = $this->laravel->make( + OutputStyle::class, ['input' => $input, 'output' => $output] + ); + + return parent::run( + $this->input = $input, $this->output + ); + } + + /** + * Execute the console command. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @return mixed + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + return $this->laravel->call([$this, 'handle']); + } + + /** + * Call another console command. + * + * @param string $command + * @param array $arguments + * @return int + */ + public function call($command, array $arguments = []) + { + $arguments['command'] = $command; + + return $this->getApplication()->find($command)->run( + $this->createInputFromArguments($arguments), $this->output + ); + } + + /** + * Call another console command silently. + * + * @param string $command + * @param array $arguments + * @return int + */ + public function callSilent($command, array $arguments = []) + { + $arguments['command'] = $command; + + return $this->getApplication()->find($command)->run( + $this->createInputFromArguments($arguments), new NullOutput + ); + } + + /** + * Create an input instance from the given arguments. + * + * @param array $arguments + * @return \Symfony\Component\Console\Input\ArrayInput + */ + protected function createInputFromArguments(array $arguments) + { + return tap(new ArrayInput($arguments), function ($input) { + if ($input->hasParameterOption(['--no-interaction'], true)) { + $input->setInteractive(false); + } + }); + } + + /** + * Determine if the given argument is present. + * + * @param string|int $name + * @return bool + */ + public function hasArgument($name) + { + return $this->input->hasArgument($name); + } + + /** + * Get the value of a command argument. + * + * @param string|null $key + * @return string|array|null + */ + public function argument($key = null) + { + if (is_null($key)) { + return $this->input->getArguments(); + } + + return $this->input->getArgument($key); + } + + /** + * Get all of the arguments passed to the command. + * + * @return array + */ + public function arguments() + { + return $this->argument(); + } + + /** + * Determine if the given option is present. + * + * @param string $name + * @return bool + */ + public function hasOption($name) + { + return $this->input->hasOption($name); + } + + /** + * Get the value of a command option. + * + * @param string|null $key + * @return string|array|null + */ + public function option($key = null) + { + if (is_null($key)) { + return $this->input->getOptions(); + } + + return $this->input->getOption($key); + } + + /** + * Get all of the options passed to the command. + * + * @return array + */ + public function options() + { + return $this->option(); + } + + /** + * Confirm a question with the user. + * + * @param string $question + * @param bool $default + * @return bool + */ + public function confirm($question, $default = false) + { + return $this->output->confirm($question, $default); + } + + /** + * Prompt the user for input. + * + * @param string $question + * @param string|null $default + * @return mixed + */ + public function ask($question, $default = null) + { + return $this->output->ask($question, $default); + } + + /** + * Prompt the user for input with auto completion. + * + * @param string $question + * @param array $choices + * @param string|null $default + * @return mixed + */ + public function anticipate($question, array $choices, $default = null) + { + return $this->askWithCompletion($question, $choices, $default); + } + + /** + * Prompt the user for input with auto completion. + * + * @param string $question + * @param array $choices + * @param string|null $default + * @return mixed + */ + public function askWithCompletion($question, array $choices, $default = null) + { + $question = new Question($question, $default); + + $question->setAutocompleterValues($choices); + + return $this->output->askQuestion($question); + } + + /** + * Prompt the user for input but hide the answer from the console. + * + * @param string $question + * @param bool $fallback + * @return mixed + */ + public function secret($question, $fallback = true) + { + $question = new Question($question); + + $question->setHidden(true)->setHiddenFallback($fallback); + + return $this->output->askQuestion($question); + } + + /** + * Give the user a single choice from an array of answers. + * + * @param string $question + * @param array $choices + * @param string|null $default + * @param mixed|null $attempts + * @param bool|null $multiple + * @return string + */ + public function choice($question, array $choices, $default = null, $attempts = null, $multiple = null) + { + $question = new ChoiceQuestion($question, $choices, $default); + + $question->setMaxAttempts($attempts)->setMultiselect($multiple); + + return $this->output->askQuestion($question); + } + + /** + * Format input to textual table. + * + * @param array $headers + * @param \Illuminate\Contracts\Support\Arrayable|array $rows + * @param string $tableStyle + * @param array $columnStyles + * @return void + */ + public function table($headers, $rows, $tableStyle = 'default', array $columnStyles = []) + { + $table = new Table($this->output); + + if ($rows instanceof Arrayable) { + $rows = $rows->toArray(); + } + + $table->setHeaders((array) $headers)->setRows($rows)->setStyle($tableStyle); + + foreach ($columnStyles as $columnIndex => $columnStyle) { + $table->setColumnStyle($columnIndex, $columnStyle); + } + + $table->render(); + } + + /** + * Write a string as information output. + * + * @param string $string + * @param int|string|null $verbosity + * @return void + */ + public function info($string, $verbosity = null) + { + $this->line($string, 'info', $verbosity); + } + + /** + * Write a string as standard output. + * + * @param string $string + * @param string $style + * @param int|string|null $verbosity + * @return void + */ + public function line($string, $style = null, $verbosity = null) + { + $styled = $style ? "<$style>$string" : $string; + + $this->output->writeln($styled, $this->parseVerbosity($verbosity)); + } + + /** + * Write a string as comment output. + * + * @param string $string + * @param int|string|null $verbosity + * @return void + */ + public function comment($string, $verbosity = null) + { + $this->line($string, 'comment', $verbosity); + } + + /** + * Write a string as question output. + * + * @param string $string + * @param int|string|null $verbosity + * @return void + */ + public function question($string, $verbosity = null) + { + $this->line($string, 'question', $verbosity); + } + + /** + * Write a string as error output. + * + * @param string $string + * @param int|string|null $verbosity + * @return void + */ + public function error($string, $verbosity = null) + { + $this->line($string, 'error', $verbosity); + } + + /** + * Write a string as warning output. + * + * @param string $string + * @param int|string|null $verbosity + * @return void + */ + public function warn($string, $verbosity = null) + { + if (! $this->output->getFormatter()->hasStyle('warning')) { + $style = new OutputFormatterStyle('yellow'); + + $this->output->getFormatter()->setStyle('warning', $style); + } + + $this->line($string, 'warning', $verbosity); + } + + /** + * Write a string in an alert box. + * + * @param string $string + * @return void + */ + public function alert($string) + { + $length = Str::length(strip_tags($string)) + 12; + + $this->comment(str_repeat('*', $length)); + $this->comment('* '.$string.' *'); + $this->comment(str_repeat('*', $length)); + + $this->output->newLine(); + } + + /** + * Set the verbosity level. + * + * @param string|int $level + * @return void + */ + protected function setVerbosity($level) + { + $this->verbosity = $this->parseVerbosity($level); + } + + /** + * Get the verbosity level in terms of Symfony's OutputInterface level. + * + * @param string|int|null $level + * @return int + */ + protected function parseVerbosity($level = null) + { + if (isset($this->verbosityMap[$level])) { + $level = $this->verbosityMap[$level]; + } elseif (! is_int($level)) { + $level = $this->verbosity; + } + + return $level; + } + + /** + * {@inheritdoc} + */ + public function isHidden() + { + return $this->hidden; + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return []; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return []; + } + + /** + * Get the output implementation. + * + * @return \Illuminate\Console\OutputStyle + */ + public function getOutput() + { + return $this->output; + } + + /** + * Get the Laravel application instance. + * + * @return \Illuminate\Contracts\Foundation\Application + */ + public function getLaravel() + { + return $this->laravel; + } + + /** + * Set the Laravel application instance. + * + * @param \Illuminate\Contracts\Container\Container $laravel + * @return void + */ + public function setLaravel($laravel) + { + $this->laravel = $laravel; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php b/vendor/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php new file mode 100644 index 0000000..1a5308e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/ConfirmableTrait.php @@ -0,0 +1,54 @@ +getDefaultConfirmCallback() : $callback; + + $shouldConfirm = $callback instanceof Closure ? call_user_func($callback) : $callback; + + if ($shouldConfirm) { + if ($this->option('force')) { + return true; + } + + $this->alert($warning); + + $confirmed = $this->confirm('Do you really wish to run this command?'); + + if (! $confirmed) { + $this->comment('Command Cancelled!'); + + return false; + } + } + + return true; + } + + /** + * Get the default confirmation callback. + * + * @return \Closure + */ + protected function getDefaultConfirmCallback() + { + return function () { + return $this->getLaravel()->environment() === 'production'; + }; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/DetectsApplicationNamespace.php b/vendor/laravel/framework/src/Illuminate/Console/DetectsApplicationNamespace.php new file mode 100644 index 0000000..cb5e8e8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/DetectsApplicationNamespace.php @@ -0,0 +1,18 @@ +getNamespace(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Events/ArtisanStarting.php b/vendor/laravel/framework/src/Illuminate/Console/Events/ArtisanStarting.php new file mode 100644 index 0000000..f228ac5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Events/ArtisanStarting.php @@ -0,0 +1,24 @@ +artisan = $artisan; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Events/CommandFinished.php b/vendor/laravel/framework/src/Illuminate/Console/Events/CommandFinished.php new file mode 100644 index 0000000..ef066af --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Events/CommandFinished.php @@ -0,0 +1,54 @@ +input = $input; + $this->output = $output; + $this->command = $command; + $this->exitCode = $exitCode; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Events/CommandStarting.php b/vendor/laravel/framework/src/Illuminate/Console/Events/CommandStarting.php new file mode 100644 index 0000000..c6238b5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Events/CommandStarting.php @@ -0,0 +1,45 @@ +input = $input; + $this->output = $output; + $this->command = $command; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/GeneratorCommand.php b/vendor/laravel/framework/src/Illuminate/Console/GeneratorCommand.php new file mode 100644 index 0000000..ec5eb8c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/GeneratorCommand.php @@ -0,0 +1,253 @@ +files = $files; + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + abstract protected function getStub(); + + /** + * Execute the console command. + * + * @return bool|null + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + */ + public function handle() + { + $name = $this->qualifyClass($this->getNameInput()); + + $path = $this->getPath($name); + + // First we will check to see if the class already exists. If it does, we don't want + // to create the class and overwrite the user's code. So, we will bail out so the + // code is untouched. Otherwise, we will continue generating this class' files. + if ((! $this->hasOption('force') || + ! $this->option('force')) && + $this->alreadyExists($this->getNameInput())) { + $this->error($this->type.' already exists!'); + + return false; + } + + // Next, we will generate the path to the location where this class' file should get + // written. Then, we will build the class and make the proper replacements on the + // stub files so that it gets the correctly formatted namespace and class name. + $this->makeDirectory($path); + + $this->files->put($path, $this->buildClass($name)); + + $this->info($this->type.' created successfully.'); + } + + /** + * Parse the class name and format according to the root namespace. + * + * @param string $name + * @return string + */ + protected function qualifyClass($name) + { + $name = ltrim($name, '\\/'); + + $rootNamespace = $this->rootNamespace(); + + if (Str::startsWith($name, $rootNamespace)) { + return $name; + } + + $name = str_replace('/', '\\', $name); + + return $this->qualifyClass( + $this->getDefaultNamespace(trim($rootNamespace, '\\')).'\\'.$name + ); + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace; + } + + /** + * Determine if the class already exists. + * + * @param string $rawName + * @return bool + */ + protected function alreadyExists($rawName) + { + return $this->files->exists($this->getPath($this->qualifyClass($rawName))); + } + + /** + * Get the destination class path. + * + * @param string $name + * @return string + */ + protected function getPath($name) + { + $name = Str::replaceFirst($this->rootNamespace(), '', $name); + + return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'.php'; + } + + /** + * Build the directory for the class if necessary. + * + * @param string $path + * @return string + */ + protected function makeDirectory($path) + { + if (! $this->files->isDirectory(dirname($path))) { + $this->files->makeDirectory(dirname($path), 0777, true, true); + } + + return $path; + } + + /** + * Build the class with the given name. + * + * @param string $name + * @return string + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + */ + protected function buildClass($name) + { + $stub = $this->files->get($this->getStub()); + + return $this->replaceNamespace($stub, $name)->replaceClass($stub, $name); + } + + /** + * Replace the namespace for the given stub. + * + * @param string $stub + * @param string $name + * @return $this + */ + protected function replaceNamespace(&$stub, $name) + { + $stub = str_replace( + ['DummyNamespace', 'DummyRootNamespace', 'NamespacedDummyUserModel'], + [$this->getNamespace($name), $this->rootNamespace(), $this->userProviderModel()], + $stub + ); + + return $this; + } + + /** + * Get the full namespace for a given class, without the class name. + * + * @param string $name + * @return string + */ + protected function getNamespace($name) + { + return trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\'); + } + + /** + * Replace the class name for the given stub. + * + * @param string $stub + * @param string $name + * @return string + */ + protected function replaceClass($stub, $name) + { + $class = str_replace($this->getNamespace($name).'\\', '', $name); + + return str_replace('DummyClass', $class, $stub); + } + + /** + * Get the desired class name from the input. + * + * @return string + */ + protected function getNameInput() + { + return trim($this->argument('name')); + } + + /** + * Get the root namespace for the class. + * + * @return string + */ + protected function rootNamespace() + { + return $this->laravel->getNamespace(); + } + + /** + * Get the model for the default guard's user provider. + * + * @return string|null + */ + protected function userProviderModel() + { + $guard = config('auth.defaults.guard'); + + $provider = config("auth.guards.{$guard}.provider"); + + return config("auth.providers.{$provider}.model"); + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['name', InputArgument::REQUIRED, 'The name of the class'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/OutputStyle.php b/vendor/laravel/framework/src/Illuminate/Console/OutputStyle.php new file mode 100644 index 0000000..925e66d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/OutputStyle.php @@ -0,0 +1,71 @@ +output = $output; + + parent::__construct($input, $output); + } + + /** + * Returns whether verbosity is quiet (-q). + * + * @return bool + */ + public function isQuiet() + { + return $this->output->isQuiet(); + } + + /** + * Returns whether verbosity is verbose (-v). + * + * @return bool + */ + public function isVerbose() + { + return $this->output->isVerbose(); + } + + /** + * Returns whether verbosity is very verbose (-vv). + * + * @return bool + */ + public function isVeryVerbose() + { + return $this->output->isVeryVerbose(); + } + + /** + * Returns whether verbosity is debug (-vvv). + * + * @return bool + */ + public function isDebug() + { + return $this->output->isDebug(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Parser.php b/vendor/laravel/framework/src/Illuminate/Console/Parser.php new file mode 100644 index 0000000..7764310 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Parser.php @@ -0,0 +1,148 @@ +cache = $cache; + } + + /** + * Attempt to obtain an event mutex for the given event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @return bool + */ + public function create(Event $event) + { + return $this->cache->store($this->store)->add( + $event->mutexName(), true, $event->expiresAt + ); + } + + /** + * Determine if an event mutex exists for the given event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @return bool + */ + public function exists(Event $event) + { + return $this->cache->store($this->store)->has($event->mutexName()); + } + + /** + * Clear the event mutex for the given event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @return void + */ + public function forget(Event $event) + { + $this->cache->store($this->store)->forget($event->mutexName()); + } + + /** + * Specify the cache store that should be used. + * + * @param string $store + * @return $this + */ + public function useStore($store) + { + $this->store = $store; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php new file mode 100644 index 0000000..dfa2034 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php @@ -0,0 +1,75 @@ +cache = $cache; + } + + /** + * Attempt to obtain a scheduling mutex for the given event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @param \DateTimeInterface $time + * @return bool + */ + public function create(Event $event, DateTimeInterface $time) + { + return $this->cache->store($this->store)->add( + $event->mutexName().$time->format('Hi'), true, 60 + ); + } + + /** + * Determine if a scheduling mutex exists for the given event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @param \DateTimeInterface $time + * @return bool + */ + public function exists(Event $event, DateTimeInterface $time) + { + return $this->cache->store($this->store)->has( + $event->mutexName().$time->format('Hi') + ); + } + + /** + * Specify the cache store that should be used. + * + * @param string $store + * @return $this + */ + public function useStore($store) + { + $this->store = $store; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php new file mode 100644 index 0000000..ba6395b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php @@ -0,0 +1,166 @@ +mutex = $mutex; + $this->callback = $callback; + $this->parameters = $parameters; + } + + /** + * Run the given event. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return mixed + * + * @throws \Exception + */ + public function run(Container $container) + { + if ($this->description && $this->withoutOverlapping && + ! $this->mutex->create($this)) { + return; + } + + $pid = getmypid(); + + register_shutdown_function(function () use ($pid) { + if ($pid === getmypid()) { + $this->removeMutex(); + } + }); + + parent::callBeforeCallbacks($container); + + try { + $response = is_object($this->callback) + ? $container->call([$this->callback, '__invoke'], $this->parameters) + : $container->call($this->callback, $this->parameters); + } finally { + $this->removeMutex(); + + parent::callAfterCallbacks($container); + } + + return $response; + } + + /** + * Clear the mutex for the event. + * + * @return void + */ + protected function removeMutex() + { + if ($this->description) { + $this->mutex->forget($this); + } + } + + /** + * Do not allow the event to overlap each other. + * + * @param int $expiresAt + * @return $this + * + * @throws \LogicException + */ + public function withoutOverlapping($expiresAt = 1440) + { + if (! isset($this->description)) { + throw new LogicException( + "A scheduled event name is required to prevent overlapping. Use the 'name' method before 'withoutOverlapping'." + ); + } + + $this->withoutOverlapping = true; + + $this->expiresAt = $expiresAt; + + return $this->skip(function () { + return $this->mutex->exists($this); + }); + } + + /** + * Allow the event to only run on one server for each cron expression. + * + * @return $this + * + * @throws \LogicException + */ + public function onOneServer() + { + if (! isset($this->description)) { + throw new LogicException( + "A scheduled event name is required to only run on one server. Use the 'name' method before 'onOneServer'." + ); + } + + $this->onOneServer = true; + + return $this; + } + + /** + * Get the mutex name for the scheduled command. + * + * @return string + */ + public function mutexName() + { + return 'framework/schedule-'.sha1($this->description); + } + + /** + * Get the summary of the event for display. + * + * @return string + */ + public function getSummaryForDisplay() + { + if (is_string($this->description)) { + return $this->description; + } + + return is_string($this->callback) ? $this->callback : 'Closure'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CommandBuilder.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CommandBuilder.php new file mode 100644 index 0000000..df7cdf6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CommandBuilder.php @@ -0,0 +1,71 @@ +runInBackground) { + return $this->buildBackgroundCommand($event); + } + + return $this->buildForegroundCommand($event); + } + + /** + * Build the command for running the event in the foreground. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @return string + */ + protected function buildForegroundCommand(Event $event) + { + $output = ProcessUtils::escapeArgument($event->output); + + return $this->ensureCorrectUser( + $event, $event->command.($event->shouldAppendOutput ? ' >> ' : ' > ').$output.' 2>&1' + ); + } + + /** + * Build the command for running the event in the background. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @return string + */ + protected function buildBackgroundCommand(Event $event) + { + $output = ProcessUtils::escapeArgument($event->output); + + $redirect = $event->shouldAppendOutput ? ' >> ' : ' > '; + + $finished = Application::formatCommandString('schedule:finish').' "'.$event->mutexName().'"'; + + return $this->ensureCorrectUser($event, + '('.$event->command.$redirect.$output.' 2>&1 '.(windows_os() ? '&' : ';').' '.$finished.') > ' + .ProcessUtils::escapeArgument($event->getDefaultOutput()).' 2>&1 &' + ); + } + + /** + * Finalize the event's command syntax with the correct user. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @param string $command + * @return string + */ + protected function ensureCorrectUser(Event $event, $command) + { + return $event->user && ! windows_os() ? 'sudo -u '.$event->user.' -- sh -c \''.$command.'\'' : $command; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php new file mode 100644 index 0000000..d21defd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php @@ -0,0 +1,745 @@ +mutex = $mutex; + $this->command = $command; + $this->output = $this->getDefaultOutput(); + } + + /** + * Get the default output depending on the OS. + * + * @return string + */ + public function getDefaultOutput() + { + return (DIRECTORY_SEPARATOR === '\\') ? 'NUL' : '/dev/null'; + } + + /** + * Run the given event. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function run(Container $container) + { + if ($this->withoutOverlapping && + ! $this->mutex->create($this)) { + return; + } + + $this->runInBackground + ? $this->runCommandInBackground($container) + : $this->runCommandInForeground($container); + } + + /** + * Get the mutex name for the scheduled command. + * + * @return string + */ + public function mutexName() + { + return 'framework'.DIRECTORY_SEPARATOR.'schedule-'.sha1($this->expression.$this->command); + } + + /** + * Run the command in the foreground. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + protected function runCommandInForeground(Container $container) + { + $this->callBeforeCallbacks($container); + + (new Process( + $this->buildCommand(), base_path(), null, null, null + ))->run(); + + $this->callAfterCallbacks($container); + } + + /** + * Run the command in the background. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + protected function runCommandInBackground(Container $container) + { + $this->callBeforeCallbacks($container); + + (new Process( + $this->buildCommand(), base_path(), null, null, null + ))->run(); + } + + /** + * Call all of the "before" callbacks for the event. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function callBeforeCallbacks(Container $container) + { + foreach ($this->beforeCallbacks as $callback) { + $container->call($callback); + } + } + + /** + * Call all of the "after" callbacks for the event. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function callAfterCallbacks(Container $container) + { + foreach ($this->afterCallbacks as $callback) { + $container->call($callback); + } + } + + /** + * Build the command string. + * + * @return string + */ + public function buildCommand() + { + return (new CommandBuilder)->buildCommand($this); + } + + /** + * Determine if the given event should run based on the Cron expression. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return bool + */ + public function isDue($app) + { + if (! $this->runsInMaintenanceMode() && $app->isDownForMaintenance()) { + return false; + } + + return $this->expressionPasses() && + $this->runsInEnvironment($app->environment()); + } + + /** + * Determine if the event runs in maintenance mode. + * + * @return bool + */ + public function runsInMaintenanceMode() + { + return $this->evenInMaintenanceMode; + } + + /** + * Determine if the Cron expression passes. + * + * @return bool + */ + protected function expressionPasses() + { + $date = Carbon::now(); + + if ($this->timezone) { + $date->setTimezone($this->timezone); + } + + return CronExpression::factory($this->expression)->isDue($date->toDateTimeString()); + } + + /** + * Determine if the event runs in the given environment. + * + * @param string $environment + * @return bool + */ + public function runsInEnvironment($environment) + { + return empty($this->environments) || in_array($environment, $this->environments); + } + + /** + * Determine if the filters pass for the event. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return bool + */ + public function filtersPass($app) + { + foreach ($this->filters as $callback) { + if (! $app->call($callback)) { + return false; + } + } + + foreach ($this->rejects as $callback) { + if ($app->call($callback)) { + return false; + } + } + + return true; + } + + /** + * Ensure that the output is stored on disk in a log file. + * + * @return $this + */ + public function storeOutput() + { + $this->ensureOutputIsBeingCaptured(); + + return $this; + } + + /** + * Send the output of the command to a given location. + * + * @param string $location + * @param bool $append + * @return $this + */ + public function sendOutputTo($location, $append = false) + { + $this->output = $location; + + $this->shouldAppendOutput = $append; + + return $this; + } + + /** + * Append the output of the command to a given location. + * + * @param string $location + * @return $this + */ + public function appendOutputTo($location) + { + return $this->sendOutputTo($location, true); + } + + /** + * E-mail the results of the scheduled operation. + * + * @param array|mixed $addresses + * @param bool $onlyIfOutputExists + * @return $this + * + * @throws \LogicException + */ + public function emailOutputTo($addresses, $onlyIfOutputExists = false) + { + $this->ensureOutputIsBeingCapturedForEmail(); + + $addresses = Arr::wrap($addresses); + + return $this->then(function (Mailer $mailer) use ($addresses, $onlyIfOutputExists) { + $this->emailOutput($mailer, $addresses, $onlyIfOutputExists); + }); + } + + /** + * E-mail the results of the scheduled operation if it produces output. + * + * @param array|mixed $addresses + * @return $this + * + * @throws \LogicException + */ + public function emailWrittenOutputTo($addresses) + { + return $this->emailOutputTo($addresses, true); + } + + /** + * Ensure that output is being captured for email. + * + * @return void + * + * @deprecated See ensureOutputIsBeingCaptured. + */ + protected function ensureOutputIsBeingCapturedForEmail() + { + $this->ensureOutputIsBeingCaptured(); + } + + /** + * Ensure that the command output is being captured. + * + * @return void + */ + protected function ensureOutputIsBeingCaptured() + { + if (is_null($this->output) || $this->output == $this->getDefaultOutput()) { + $this->sendOutputTo(storage_path('logs/schedule-'.sha1($this->mutexName()).'.log')); + } + } + + /** + * E-mail the output of the event to the recipients. + * + * @param \Illuminate\Contracts\Mail\Mailer $mailer + * @param array $addresses + * @param bool $onlyIfOutputExists + * @return void + */ + protected function emailOutput(Mailer $mailer, $addresses, $onlyIfOutputExists = false) + { + $text = file_exists($this->output) ? file_get_contents($this->output) : ''; + + if ($onlyIfOutputExists && empty($text)) { + return; + } + + $mailer->raw($text, function ($m) use ($addresses) { + $m->to($addresses)->subject($this->getEmailSubject()); + }); + } + + /** + * Get the e-mail subject line for output results. + * + * @return string + */ + protected function getEmailSubject() + { + if ($this->description) { + return $this->description; + } + + return "Scheduled Job Output For [{$this->command}]"; + } + + /** + * Register a callback to ping a given URL before the job runs. + * + * @param string $url + * @return $this + */ + public function pingBefore($url) + { + return $this->before(function () use ($url) { + (new HttpClient)->get($url); + }); + } + + /** + * Register a callback to ping a given URL before the job runs if the given condition is true. + * + * @param bool $value + * @param string $url + * @return $this + */ + public function pingBeforeIf($value, $url) + { + return $value ? $this->pingBefore($url) : $this; + } + + /** + * Register a callback to ping a given URL after the job runs. + * + * @param string $url + * @return $this + */ + public function thenPing($url) + { + return $this->then(function () use ($url) { + (new HttpClient)->get($url); + }); + } + + /** + * Register a callback to ping a given URL after the job runs if the given condition is true. + * + * @param bool $value + * @param string $url + * @return $this + */ + public function thenPingIf($value, $url) + { + return $value ? $this->thenPing($url) : $this; + } + + /** + * State that the command should run in background. + * + * @return $this + */ + public function runInBackground() + { + $this->runInBackground = true; + + return $this; + } + + /** + * Set which user the command should run as. + * + * @param string $user + * @return $this + */ + public function user($user) + { + $this->user = $user; + + return $this; + } + + /** + * Limit the environments the command should run in. + * + * @param array|mixed $environments + * @return $this + */ + public function environments($environments) + { + $this->environments = is_array($environments) ? $environments : func_get_args(); + + return $this; + } + + /** + * State that the command should run even in maintenance mode. + * + * @return $this + */ + public function evenInMaintenanceMode() + { + $this->evenInMaintenanceMode = true; + + return $this; + } + + /** + * Do not allow the event to overlap each other. + * + * @param int $expiresAt + * @return $this + */ + public function withoutOverlapping($expiresAt = 1440) + { + $this->withoutOverlapping = true; + + $this->expiresAt = $expiresAt; + + return $this->then(function () { + $this->mutex->forget($this); + })->skip(function () { + return $this->mutex->exists($this); + }); + } + + /** + * Allow the event to only run on one server for each cron expression. + * + * @return $this + */ + public function onOneServer() + { + $this->onOneServer = true; + + return $this; + } + + /** + * Register a callback to further filter the schedule. + * + * @param \Closure|bool $callback + * @return $this + */ + public function when($callback) + { + $this->filters[] = is_callable($callback) ? $callback : function () use ($callback) { + return $callback; + }; + + return $this; + } + + /** + * Register a callback to further filter the schedule. + * + * @param \Closure|bool $callback + * @return $this + */ + public function skip($callback) + { + $this->rejects[] = is_callable($callback) ? $callback : function () use ($callback) { + return $callback; + }; + + return $this; + } + + /** + * Register a callback to be called before the operation. + * + * @param \Closure $callback + * @return $this + */ + public function before(Closure $callback) + { + $this->beforeCallbacks[] = $callback; + + return $this; + } + + /** + * Register a callback to be called after the operation. + * + * @param \Closure $callback + * @return $this + */ + public function after(Closure $callback) + { + return $this->then($callback); + } + + /** + * Register a callback to be called after the operation. + * + * @param \Closure $callback + * @return $this + */ + public function then(Closure $callback) + { + $this->afterCallbacks[] = $callback; + + return $this; + } + + /** + * Set the human-friendly description of the event. + * + * @param string $description + * @return $this + */ + public function name($description) + { + return $this->description($description); + } + + /** + * Set the human-friendly description of the event. + * + * @param string $description + * @return $this + */ + public function description($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get the summary of the event for display. + * + * @return string + */ + public function getSummaryForDisplay() + { + if (is_string($this->description)) { + return $this->description; + } + + return $this->buildCommand(); + } + + /** + * Determine the next due date for an event. + * + * @param \DateTime|string $currentTime + * @param int $nth + * @param bool $allowCurrentDate + * @return \Illuminate\Support\Carbon + */ + public function nextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false) + { + return Carbon::instance(CronExpression::factory( + $this->getExpression() + )->getNextRunDate($currentTime, $nth, $allowCurrentDate, $this->timezone)); + } + + /** + * Get the Cron expression for the event. + * + * @return string + */ + public function getExpression() + { + return $this->expression; + } + + /** + * Set the event mutex implementation to be used. + * + * @param \Illuminate\Console\Scheduling\EventMutex $mutex + * @return $this + */ + public function preventOverlapsUsing(EventMutex $mutex) + { + $this->mutex = $mutex; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/EventMutex.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/EventMutex.php new file mode 100644 index 0000000..1840e24 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/EventMutex.php @@ -0,0 +1,30 @@ +expression = $expression; + + return $this; + } + + /** + * Schedule the event to run between start and end time. + * + * @param string $startTime + * @param string $endTime + * @return $this + */ + public function between($startTime, $endTime) + { + return $this->when($this->inTimeInterval($startTime, $endTime)); + } + + /** + * Schedule the event to not run between start and end time. + * + * @param string $startTime + * @param string $endTime + * @return $this + */ + public function unlessBetween($startTime, $endTime) + { + return $this->skip($this->inTimeInterval($startTime, $endTime)); + } + + /** + * Schedule the event to run between start and end time. + * + * @param string $startTime + * @param string $endTime + * @return \Closure + */ + private function inTimeInterval($startTime, $endTime) + { + return function () use ($startTime, $endTime) { + return Carbon::now($this->timezone)->between( + Carbon::parse($startTime, $this->timezone), + Carbon::parse($endTime, $this->timezone), + true + ); + }; + } + + /** + * Schedule the event to run every minute. + * + * @return $this + */ + public function everyMinute() + { + return $this->spliceIntoPosition(1, '*'); + } + + /** + * Schedule the event to run every five minutes. + * + * @return $this + */ + public function everyFiveMinutes() + { + return $this->spliceIntoPosition(1, '*/5'); + } + + /** + * Schedule the event to run every ten minutes. + * + * @return $this + */ + public function everyTenMinutes() + { + return $this->spliceIntoPosition(1, '*/10'); + } + + /** + * Schedule the event to run every fifteen minutes. + * + * @return $this + */ + public function everyFifteenMinutes() + { + return $this->spliceIntoPosition(1, '*/15'); + } + + /** + * Schedule the event to run every thirty minutes. + * + * @return $this + */ + public function everyThirtyMinutes() + { + return $this->spliceIntoPosition(1, '0,30'); + } + + /** + * Schedule the event to run hourly. + * + * @return $this + */ + public function hourly() + { + return $this->spliceIntoPosition(1, 0); + } + + /** + * Schedule the event to run hourly at a given offset in the hour. + * + * @param int $offset + * @return $this + */ + public function hourlyAt($offset) + { + return $this->spliceIntoPosition(1, $offset); + } + + /** + * Schedule the event to run daily. + * + * @return $this + */ + public function daily() + { + return $this->spliceIntoPosition(1, 0) + ->spliceIntoPosition(2, 0); + } + + /** + * Schedule the command at a given time. + * + * @param string $time + * @return $this + */ + public function at($time) + { + return $this->dailyAt($time); + } + + /** + * Schedule the event to run daily at a given time (10:00, 19:30, etc). + * + * @param string $time + * @return $this + */ + public function dailyAt($time) + { + $segments = explode(':', $time); + + return $this->spliceIntoPosition(2, (int) $segments[0]) + ->spliceIntoPosition(1, count($segments) === 2 ? (int) $segments[1] : '0'); + } + + /** + * Schedule the event to run twice daily. + * + * @param int $first + * @param int $second + * @return $this + */ + public function twiceDaily($first = 1, $second = 13) + { + $hours = $first.','.$second; + + return $this->spliceIntoPosition(1, 0) + ->spliceIntoPosition(2, $hours); + } + + /** + * Schedule the event to run only on weekdays. + * + * @return $this + */ + public function weekdays() + { + return $this->spliceIntoPosition(5, '1-5'); + } + + /** + * Schedule the event to run only on weekends. + * + * @return $this + */ + public function weekends() + { + return $this->spliceIntoPosition(5, '0,6'); + } + + /** + * Schedule the event to run only on Mondays. + * + * @return $this + */ + public function mondays() + { + return $this->days(1); + } + + /** + * Schedule the event to run only on Tuesdays. + * + * @return $this + */ + public function tuesdays() + { + return $this->days(2); + } + + /** + * Schedule the event to run only on Wednesdays. + * + * @return $this + */ + public function wednesdays() + { + return $this->days(3); + } + + /** + * Schedule the event to run only on Thursdays. + * + * @return $this + */ + public function thursdays() + { + return $this->days(4); + } + + /** + * Schedule the event to run only on Fridays. + * + * @return $this + */ + public function fridays() + { + return $this->days(5); + } + + /** + * Schedule the event to run only on Saturdays. + * + * @return $this + */ + public function saturdays() + { + return $this->days(6); + } + + /** + * Schedule the event to run only on Sundays. + * + * @return $this + */ + public function sundays() + { + return $this->days(0); + } + + /** + * Schedule the event to run weekly. + * + * @return $this + */ + public function weekly() + { + return $this->spliceIntoPosition(1, 0) + ->spliceIntoPosition(2, 0) + ->spliceIntoPosition(5, 0); + } + + /** + * Schedule the event to run weekly on a given day and time. + * + * @param int $day + * @param string $time + * @return $this + */ + public function weeklyOn($day, $time = '0:0') + { + $this->dailyAt($time); + + return $this->spliceIntoPosition(5, $day); + } + + /** + * Schedule the event to run monthly. + * + * @return $this + */ + public function monthly() + { + return $this->spliceIntoPosition(1, 0) + ->spliceIntoPosition(2, 0) + ->spliceIntoPosition(3, 1); + } + + /** + * Schedule the event to run monthly on a given day and time. + * + * @param int $day + * @param string $time + * @return $this + */ + public function monthlyOn($day = 1, $time = '0:0') + { + $this->dailyAt($time); + + return $this->spliceIntoPosition(3, $day); + } + + /** + * Schedule the event to run twice monthly. + * + * @param int $first + * @param int $second + * @return $this + */ + public function twiceMonthly($first = 1, $second = 16) + { + $days = $first.','.$second; + + return $this->spliceIntoPosition(1, 0) + ->spliceIntoPosition(2, 0) + ->spliceIntoPosition(3, $days); + } + + /** + * Schedule the event to run quarterly. + * + * @return $this + */ + public function quarterly() + { + return $this->spliceIntoPosition(1, 0) + ->spliceIntoPosition(2, 0) + ->spliceIntoPosition(3, 1) + ->spliceIntoPosition(4, '1-12/3'); + } + + /** + * Schedule the event to run yearly. + * + * @return $this + */ + public function yearly() + { + return $this->spliceIntoPosition(1, 0) + ->spliceIntoPosition(2, 0) + ->spliceIntoPosition(3, 1) + ->spliceIntoPosition(4, 1); + } + + /** + * Set the days of the week the command should run on. + * + * @param array|mixed $days + * @return $this + */ + public function days($days) + { + $days = is_array($days) ? $days : func_get_args(); + + return $this->spliceIntoPosition(5, implode(',', $days)); + } + + /** + * Set the timezone the date should be evaluated on. + * + * @param \DateTimeZone|string $timezone + * @return $this + */ + public function timezone($timezone) + { + $this->timezone = $timezone; + + return $this; + } + + /** + * Splice the given value into the given position of the expression. + * + * @param int $position + * @param string $value + * @return $this + */ + protected function spliceIntoPosition($position, $value) + { + $segments = explode(' ', $this->expression); + + $segments[$position - 1] = $value; + + return $this->cron(implode(' ', $segments)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Schedule.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Schedule.php new file mode 100644 index 0000000..3855f17 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Schedule.php @@ -0,0 +1,199 @@ +eventMutex = $container->bound(EventMutex::class) + ? $container->make(EventMutex::class) + : $container->make(CacheEventMutex::class); + + $this->schedulingMutex = $container->bound(SchedulingMutex::class) + ? $container->make(SchedulingMutex::class) + : $container->make(CacheSchedulingMutex::class); + } + + /** + * Add a new callback event to the schedule. + * + * @param string|callable $callback + * @param array $parameters + * @return \Illuminate\Console\Scheduling\CallbackEvent + */ + public function call($callback, array $parameters = []) + { + $this->events[] = $event = new CallbackEvent( + $this->eventMutex, $callback, $parameters + ); + + return $event; + } + + /** + * Add a new Artisan command event to the schedule. + * + * @param string $command + * @param array $parameters + * @return \Illuminate\Console\Scheduling\Event + */ + public function command($command, array $parameters = []) + { + if (class_exists($command)) { + $command = Container::getInstance()->make($command)->getName(); + } + + return $this->exec( + Application::formatCommandString($command), $parameters + ); + } + + /** + * Add a new job callback event to the schedule. + * + * @param object|string $job + * @param string|null $queue + * @param string|null $connection + * @return \Illuminate\Console\Scheduling\CallbackEvent + */ + public function job($job, $queue = null, $connection = null) + { + return $this->call(function () use ($job, $queue, $connection) { + $job = is_string($job) ? resolve($job) : $job; + + if ($job instanceof ShouldQueue) { + dispatch($job) + ->onConnection($connection ?? $job->connection) + ->onQueue($queue ?? $job->queue); + } else { + dispatch_now($job); + } + })->name(is_string($job) ? $job : get_class($job)); + } + + /** + * Add a new command event to the schedule. + * + * @param string $command + * @param array $parameters + * @return \Illuminate\Console\Scheduling\Event + */ + public function exec($command, array $parameters = []) + { + if (count($parameters)) { + $command .= ' '.$this->compileParameters($parameters); + } + + $this->events[] = $event = new Event($this->eventMutex, $command); + + return $event; + } + + /** + * Compile parameters for a command. + * + * @param array $parameters + * @return string + */ + protected function compileParameters(array $parameters) + { + return collect($parameters)->map(function ($value, $key) { + if (is_array($value)) { + $value = collect($value)->map(function ($value) { + return ProcessUtils::escapeArgument($value); + })->implode(' '); + } elseif (! is_numeric($value) && ! preg_match('/^(-.$|--.*)/i', $value)) { + $value = ProcessUtils::escapeArgument($value); + } + + return is_numeric($key) ? $value : "{$key}={$value}"; + })->implode(' '); + } + + /** + * Determine if the server is allowed to run this event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @param \DateTimeInterface $time + * @return bool + */ + public function serverShouldRun(Event $event, DateTimeInterface $time) + { + return $this->schedulingMutex->create($event, $time); + } + + /** + * Get all of the events on the schedule that are due. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return \Illuminate\Support\Collection + */ + public function dueEvents($app) + { + return collect($this->events)->filter->isDue($app); + } + + /** + * Get all of the events on the schedule. + * + * @return \Illuminate\Console\Scheduling\Event[] + */ + public function events() + { + return $this->events; + } + + /** + * Specify the cache store that should be used to store mutexes. + * + * @param string $store + * @return $this + */ + public function useCache($store) + { + if ($this->eventMutex instanceof CacheEventMutex) { + $this->eventMutex->useStore($store); + } + + if ($this->schedulingMutex instanceof CacheSchedulingMutex) { + $this->schedulingMutex->useStore($store); + } + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php new file mode 100644 index 0000000..f697ea8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php @@ -0,0 +1,61 @@ +schedule = $schedule; + + parent::__construct(); + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + collect($this->schedule->events())->filter(function ($value) { + return $value->mutexName() == $this->argument('id'); + })->each->callAfterCallbacks($this->laravel); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php new file mode 100644 index 0000000..2169543 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php @@ -0,0 +1,115 @@ +schedule = $schedule; + + $this->startedAt = Carbon::now(); + + parent::__construct(); + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + foreach ($this->schedule->dueEvents($this->laravel) as $event) { + if (! $event->filtersPass($this->laravel)) { + continue; + } + + if ($event->onOneServer) { + $this->runSingleServerEvent($event); + } else { + $this->runEvent($event); + } + + $this->eventsRan = true; + } + + if (! $this->eventsRan) { + $this->info('No scheduled commands are ready to run.'); + } + } + + /** + * Run the given single server event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @return void + */ + protected function runSingleServerEvent($event) + { + if ($this->schedule->serverShouldRun($event, $this->startedAt)) { + $this->runEvent($event); + } else { + $this->line('Skipping command (has already run on another server): '.$event->getSummaryForDisplay()); + } + } + + /** + * Run the given event. + * + * @param \Illuminate\Console\Scheduling\Event $event + * @return void + */ + protected function runEvent($event) + { + $this->line('Running scheduled command: '.$event->getSummaryForDisplay()); + + $event->run($this->laravel); + + $this->eventsRan = true; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Console/Scheduling/SchedulingMutex.php b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/SchedulingMutex.php new file mode 100644 index 0000000..ab4e87d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Console/Scheduling/SchedulingMutex.php @@ -0,0 +1,26 @@ +make($segments[0]), $method], $parameters + ); + } + + /** + * Call a method that has been bound to the container. + * + * @param \Illuminate\Container\Container $container + * @param callable $callback + * @param mixed $default + * @return mixed + */ + protected static function callBoundMethod($container, $callback, $default) + { + if (! is_array($callback)) { + return $default instanceof Closure ? $default() : $default; + } + + // Here we need to turn the array callable into a Class@method string we can use to + // examine the container and see if there are any method bindings for this given + // method. If there are, we can call this method binding callback immediately. + $method = static::normalizeMethod($callback); + + if ($container->hasMethodBinding($method)) { + return $container->callMethodBinding($method, $callback[0]); + } + + return $default instanceof Closure ? $default() : $default; + } + + /** + * Normalize the given callback into a Class@method string. + * + * @param callable $callback + * @return string + */ + protected static function normalizeMethod($callback) + { + $class = is_string($callback[0]) ? $callback[0] : get_class($callback[0]); + + return "{$class}@{$callback[1]}"; + } + + /** + * Get all dependencies for a given method. + * + * @param \Illuminate\Container\Container $container + * @param callable|string $callback + * @param array $parameters + * @return array + */ + protected static function getMethodDependencies($container, $callback, array $parameters = []) + { + $dependencies = []; + + foreach (static::getCallReflector($callback)->getParameters() as $parameter) { + static::addDependencyForCallParameter($container, $parameter, $parameters, $dependencies); + } + + return array_merge($dependencies, $parameters); + } + + /** + * Get the proper reflection instance for the given callback. + * + * @param callable|string $callback + * @return \ReflectionFunctionAbstract + * + * @throws \ReflectionException + */ + protected static function getCallReflector($callback) + { + if (is_string($callback) && strpos($callback, '::') !== false) { + $callback = explode('::', $callback); + } + + return is_array($callback) + ? new ReflectionMethod($callback[0], $callback[1]) + : new ReflectionFunction($callback); + } + + /** + * Get the dependency for the given call parameter. + * + * @param \Illuminate\Container\Container $container + * @param \ReflectionParameter $parameter + * @param array $parameters + * @param array $dependencies + * @return mixed + */ + protected static function addDependencyForCallParameter($container, $parameter, + array &$parameters, &$dependencies) + { + if (array_key_exists($parameter->name, $parameters)) { + $dependencies[] = $parameters[$parameter->name]; + + unset($parameters[$parameter->name]); + } elseif ($parameter->getClass() && array_key_exists($parameter->getClass()->name, $parameters)) { + $dependencies[] = $parameters[$parameter->getClass()->name]; + + unset($parameters[$parameter->getClass()->name]); + } elseif ($parameter->getClass()) { + $dependencies[] = $container->make($parameter->getClass()->name); + } elseif ($parameter->isDefaultValueAvailable()) { + $dependencies[] = $parameter->getDefaultValue(); + } + } + + /** + * Determine if the given string is in Class@method syntax. + * + * @param mixed $callback + * @return bool + */ + protected static function isCallableWithAtSign($callback) + { + return is_string($callback) && strpos($callback, '@') !== false; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Container/Container.php b/vendor/laravel/framework/src/Illuminate/Container/Container.php new file mode 100755 index 0000000..0f1becd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Container/Container.php @@ -0,0 +1,1272 @@ +getAlias($c); + } + + return new ContextualBindingBuilder($this, $aliases); + } + + /** + * Determine if the given abstract type has been bound. + * + * @param string $abstract + * @return bool + */ + public function bound($abstract) + { + return isset($this->bindings[$abstract]) || + isset($this->instances[$abstract]) || + $this->isAlias($abstract); + } + + /** + * {@inheritdoc} + */ + public function has($id) + { + return $this->bound($id); + } + + /** + * Determine if the given abstract type has been resolved. + * + * @param string $abstract + * @return bool + */ + public function resolved($abstract) + { + if ($this->isAlias($abstract)) { + $abstract = $this->getAlias($abstract); + } + + return isset($this->resolved[$abstract]) || + isset($this->instances[$abstract]); + } + + /** + * Determine if a given type is shared. + * + * @param string $abstract + * @return bool + */ + public function isShared($abstract) + { + return isset($this->instances[$abstract]) || + (isset($this->bindings[$abstract]['shared']) && + $this->bindings[$abstract]['shared'] === true); + } + + /** + * Determine if a given string is an alias. + * + * @param string $name + * @return bool + */ + public function isAlias($name) + { + return isset($this->aliases[$name]); + } + + /** + * Register a binding with the container. + * + * @param string $abstract + * @param \Closure|string|null $concrete + * @param bool $shared + * @return void + */ + public function bind($abstract, $concrete = null, $shared = false) + { + $this->dropStaleInstances($abstract); + + // If no concrete type was given, we will simply set the concrete type to the + // abstract type. After that, the concrete type to be registered as shared + // without being forced to state their classes in both of the parameters. + if (is_null($concrete)) { + $concrete = $abstract; + } + + // If the factory is not a Closure, it means it is just a class name which is + // bound into this container to the abstract type and we will just wrap it + // up inside its own Closure to give us more convenience when extending. + if (! $concrete instanceof Closure) { + $concrete = $this->getClosure($abstract, $concrete); + } + + $this->bindings[$abstract] = compact('concrete', 'shared'); + + // If the abstract type was already resolved in this container we'll fire the + // rebound listener so that any objects which have already gotten resolved + // can have their copy of the object updated via the listener callbacks. + if ($this->resolved($abstract)) { + $this->rebound($abstract); + } + } + + /** + * Get the Closure to be used when building a type. + * + * @param string $abstract + * @param string $concrete + * @return \Closure + */ + protected function getClosure($abstract, $concrete) + { + return function ($container, $parameters = []) use ($abstract, $concrete) { + if ($abstract == $concrete) { + return $container->build($concrete); + } + + return $container->make($concrete, $parameters); + }; + } + + /** + * Determine if the container has a method binding. + * + * @param string $method + * @return bool + */ + public function hasMethodBinding($method) + { + return isset($this->methodBindings[$method]); + } + + /** + * Bind a callback to resolve with Container::call. + * + * @param array|string $method + * @param \Closure $callback + * @return void + */ + public function bindMethod($method, $callback) + { + $this->methodBindings[$this->parseBindMethod($method)] = $callback; + } + + /** + * Get the method to be bound in class@method format. + * + * @param array|string $method + * @return string + */ + protected function parseBindMethod($method) + { + if (is_array($method)) { + return $method[0].'@'.$method[1]; + } + + return $method; + } + + /** + * Get the method binding for the given method. + * + * @param string $method + * @param mixed $instance + * @return mixed + */ + public function callMethodBinding($method, $instance) + { + return call_user_func($this->methodBindings[$method], $instance, $this); + } + + /** + * Add a contextual binding to the container. + * + * @param string $concrete + * @param string $abstract + * @param \Closure|string $implementation + * @return void + */ + public function addContextualBinding($concrete, $abstract, $implementation) + { + $this->contextual[$concrete][$this->getAlias($abstract)] = $implementation; + } + + /** + * Register a binding if it hasn't already been registered. + * + * @param string $abstract + * @param \Closure|string|null $concrete + * @param bool $shared + * @return void + */ + public function bindIf($abstract, $concrete = null, $shared = false) + { + if (! $this->bound($abstract)) { + $this->bind($abstract, $concrete, $shared); + } + } + + /** + * Register a shared binding in the container. + * + * @param string $abstract + * @param \Closure|string|null $concrete + * @return void + */ + public function singleton($abstract, $concrete = null) + { + $this->bind($abstract, $concrete, true); + } + + /** + * "Extend" an abstract type in the container. + * + * @param string $abstract + * @param \Closure $closure + * @return void + * + * @throws \InvalidArgumentException + */ + public function extend($abstract, Closure $closure) + { + $abstract = $this->getAlias($abstract); + + if (isset($this->instances[$abstract])) { + $this->instances[$abstract] = $closure($this->instances[$abstract], $this); + + $this->rebound($abstract); + } else { + $this->extenders[$abstract][] = $closure; + + if ($this->resolved($abstract)) { + $this->rebound($abstract); + } + } + } + + /** + * Register an existing instance as shared in the container. + * + * @param string $abstract + * @param mixed $instance + * @return mixed + */ + public function instance($abstract, $instance) + { + $this->removeAbstractAlias($abstract); + + $isBound = $this->bound($abstract); + + unset($this->aliases[$abstract]); + + // We'll check to determine if this type has been bound before, and if it has + // we will fire the rebound callbacks registered with the container and it + // can be updated with consuming classes that have gotten resolved here. + $this->instances[$abstract] = $instance; + + if ($isBound) { + $this->rebound($abstract); + } + + return $instance; + } + + /** + * Remove an alias from the contextual binding alias cache. + * + * @param string $searched + * @return void + */ + protected function removeAbstractAlias($searched) + { + if (! isset($this->aliases[$searched])) { + return; + } + + foreach ($this->abstractAliases as $abstract => $aliases) { + foreach ($aliases as $index => $alias) { + if ($alias == $searched) { + unset($this->abstractAliases[$abstract][$index]); + } + } + } + } + + /** + * Assign a set of tags to a given binding. + * + * @param array|string $abstracts + * @param array|mixed ...$tags + * @return void + */ + public function tag($abstracts, $tags) + { + $tags = is_array($tags) ? $tags : array_slice(func_get_args(), 1); + + foreach ($tags as $tag) { + if (! isset($this->tags[$tag])) { + $this->tags[$tag] = []; + } + + foreach ((array) $abstracts as $abstract) { + $this->tags[$tag][] = $abstract; + } + } + } + + /** + * Resolve all of the bindings for a given tag. + * + * @param string $tag + * @return array + */ + public function tagged($tag) + { + $results = []; + + if (isset($this->tags[$tag])) { + foreach ($this->tags[$tag] as $abstract) { + $results[] = $this->make($abstract); + } + } + + return $results; + } + + /** + * Alias a type to a different name. + * + * @param string $abstract + * @param string $alias + * @return void + */ + public function alias($abstract, $alias) + { + $this->aliases[$alias] = $abstract; + + $this->abstractAliases[$abstract][] = $alias; + } + + /** + * Bind a new callback to an abstract's rebind event. + * + * @param string $abstract + * @param \Closure $callback + * @return mixed + */ + public function rebinding($abstract, Closure $callback) + { + $this->reboundCallbacks[$abstract = $this->getAlias($abstract)][] = $callback; + + if ($this->bound($abstract)) { + return $this->make($abstract); + } + } + + /** + * Refresh an instance on the given target and method. + * + * @param string $abstract + * @param mixed $target + * @param string $method + * @return mixed + */ + public function refresh($abstract, $target, $method) + { + return $this->rebinding($abstract, function ($app, $instance) use ($target, $method) { + $target->{$method}($instance); + }); + } + + /** + * Fire the "rebound" callbacks for the given abstract type. + * + * @param string $abstract + * @return void + */ + protected function rebound($abstract) + { + $instance = $this->make($abstract); + + foreach ($this->getReboundCallbacks($abstract) as $callback) { + call_user_func($callback, $this, $instance); + } + } + + /** + * Get the rebound callbacks for a given type. + * + * @param string $abstract + * @return array + */ + protected function getReboundCallbacks($abstract) + { + if (isset($this->reboundCallbacks[$abstract])) { + return $this->reboundCallbacks[$abstract]; + } + + return []; + } + + /** + * Wrap the given closure such that its dependencies will be injected when executed. + * + * @param \Closure $callback + * @param array $parameters + * @return \Closure + */ + public function wrap(Closure $callback, array $parameters = []) + { + return function () use ($callback, $parameters) { + return $this->call($callback, $parameters); + }; + } + + /** + * Call the given Closure / class@method and inject its dependencies. + * + * @param callable|string $callback + * @param array $parameters + * @param string|null $defaultMethod + * @return mixed + */ + public function call($callback, array $parameters = [], $defaultMethod = null) + { + return BoundMethod::call($this, $callback, $parameters, $defaultMethod); + } + + /** + * Get a closure to resolve the given type from the container. + * + * @param string $abstract + * @return \Closure + */ + public function factory($abstract) + { + return function () use ($abstract) { + return $this->make($abstract); + }; + } + + /** + * An alias function name for make(). + * + * @param string $abstract + * @param array $parameters + * @return mixed + */ + public function makeWith($abstract, array $parameters = []) + { + return $this->make($abstract, $parameters); + } + + /** + * Resolve the given type from the container. + * + * @param string $abstract + * @param array $parameters + * @return mixed + */ + public function make($abstract, array $parameters = []) + { + return $this->resolve($abstract, $parameters); + } + + /** + * {@inheritdoc} + */ + public function get($id) + { + try { + return $this->resolve($id); + } catch (Exception $e) { + if ($this->has($id)) { + throw $e; + } + + throw new EntryNotFoundException; + } + } + + /** + * Resolve the given type from the container. + * + * @param string $abstract + * @param array $parameters + * @return mixed + */ + protected function resolve($abstract, $parameters = []) + { + $abstract = $this->getAlias($abstract); + + $needsContextualBuild = ! empty($parameters) || ! is_null( + $this->getContextualConcrete($abstract) + ); + + // If an instance of the type is currently being managed as a singleton we'll + // just return an existing instance instead of instantiating new instances + // so the developer can keep using the same objects instance every time. + if (isset($this->instances[$abstract]) && ! $needsContextualBuild) { + return $this->instances[$abstract]; + } + + $this->with[] = $parameters; + + $concrete = $this->getConcrete($abstract); + + // We're ready to instantiate an instance of the concrete type registered for + // the binding. This will instantiate the types, as well as resolve any of + // its "nested" dependencies recursively until all have gotten resolved. + if ($this->isBuildable($concrete, $abstract)) { + $object = $this->build($concrete); + } else { + $object = $this->make($concrete); + } + + // If we defined any extenders for this type, we'll need to spin through them + // and apply them to the object being built. This allows for the extension + // of services, such as changing configuration or decorating the object. + foreach ($this->getExtenders($abstract) as $extender) { + $object = $extender($object, $this); + } + + // If the requested type is registered as a singleton we'll want to cache off + // the instances in "memory" so we can return it later without creating an + // entirely new instance of an object on each subsequent request for it. + if ($this->isShared($abstract) && ! $needsContextualBuild) { + $this->instances[$abstract] = $object; + } + + $this->fireResolvingCallbacks($abstract, $object); + + // Before returning, we will also set the resolved flag to "true" and pop off + // the parameter overrides for this build. After those two things are done + // we will be ready to return back the fully constructed class instance. + $this->resolved[$abstract] = true; + + array_pop($this->with); + + return $object; + } + + /** + * Get the concrete type for a given abstract. + * + * @param string $abstract + * @return mixed $concrete + */ + protected function getConcrete($abstract) + { + if (! is_null($concrete = $this->getContextualConcrete($abstract))) { + return $concrete; + } + + // If we don't have a registered resolver or concrete for the type, we'll just + // assume each type is a concrete name and will attempt to resolve it as is + // since the container should be able to resolve concretes automatically. + if (isset($this->bindings[$abstract])) { + return $this->bindings[$abstract]['concrete']; + } + + return $abstract; + } + + /** + * Get the contextual concrete binding for the given abstract. + * + * @param string $abstract + * @return string|null + */ + protected function getContextualConcrete($abstract) + { + if (! is_null($binding = $this->findInContextualBindings($abstract))) { + return $binding; + } + + // Next we need to see if a contextual binding might be bound under an alias of the + // given abstract type. So, we will need to check if any aliases exist with this + // type and then spin through them and check for contextual bindings on these. + if (empty($this->abstractAliases[$abstract])) { + return; + } + + foreach ($this->abstractAliases[$abstract] as $alias) { + if (! is_null($binding = $this->findInContextualBindings($alias))) { + return $binding; + } + } + } + + /** + * Find the concrete binding for the given abstract in the contextual binding array. + * + * @param string $abstract + * @return string|null + */ + protected function findInContextualBindings($abstract) + { + if (isset($this->contextual[end($this->buildStack)][$abstract])) { + return $this->contextual[end($this->buildStack)][$abstract]; + } + } + + /** + * Determine if the given concrete is buildable. + * + * @param mixed $concrete + * @param string $abstract + * @return bool + */ + protected function isBuildable($concrete, $abstract) + { + return $concrete === $abstract || $concrete instanceof Closure; + } + + /** + * Instantiate a concrete instance of the given type. + * + * @param string $concrete + * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + public function build($concrete) + { + // If the concrete type is actually a Closure, we will just execute it and + // hand back the results of the functions, which allows functions to be + // used as resolvers for more fine-tuned resolution of these objects. + if ($concrete instanceof Closure) { + return $concrete($this, $this->getLastParameterOverride()); + } + + $reflector = new ReflectionClass($concrete); + + // If the type is not instantiable, the developer is attempting to resolve + // an abstract type such as an Interface or Abstract Class and there is + // no binding registered for the abstractions so we need to bail out. + if (! $reflector->isInstantiable()) { + return $this->notInstantiable($concrete); + } + + $this->buildStack[] = $concrete; + + $constructor = $reflector->getConstructor(); + + // If there are no constructors, that means there are no dependencies then + // we can just resolve the instances of the objects right away, without + // resolving any other types or dependencies out of these containers. + if (is_null($constructor)) { + array_pop($this->buildStack); + + return new $concrete; + } + + $dependencies = $constructor->getParameters(); + + // Once we have all the constructor's parameters we can create each of the + // dependency instances and then use the reflection instances to make a + // new instance of this class, injecting the created dependencies in. + $instances = $this->resolveDependencies( + $dependencies + ); + + array_pop($this->buildStack); + + return $reflector->newInstanceArgs($instances); + } + + /** + * Resolve all of the dependencies from the ReflectionParameters. + * + * @param array $dependencies + * @return array + */ + protected function resolveDependencies(array $dependencies) + { + $results = []; + + foreach ($dependencies as $dependency) { + // If this dependency has a override for this particular build we will use + // that instead as the value. Otherwise, we will continue with this run + // of resolutions and let reflection attempt to determine the result. + if ($this->hasParameterOverride($dependency)) { + $results[] = $this->getParameterOverride($dependency); + + continue; + } + + // If the class is null, it means the dependency is a string or some other + // primitive type which we can not resolve since it is not a class and + // we will just bomb out with an error since we have no-where to go. + $results[] = is_null($dependency->getClass()) + ? $this->resolvePrimitive($dependency) + : $this->resolveClass($dependency); + } + + return $results; + } + + /** + * Determine if the given dependency has a parameter override. + * + * @param \ReflectionParameter $dependency + * @return bool + */ + protected function hasParameterOverride($dependency) + { + return array_key_exists( + $dependency->name, $this->getLastParameterOverride() + ); + } + + /** + * Get a parameter override for a dependency. + * + * @param \ReflectionParameter $dependency + * @return mixed + */ + protected function getParameterOverride($dependency) + { + return $this->getLastParameterOverride()[$dependency->name]; + } + + /** + * Get the last parameter override. + * + * @return array + */ + protected function getLastParameterOverride() + { + return count($this->with) ? end($this->with) : []; + } + + /** + * Resolve a non-class hinted primitive dependency. + * + * @param \ReflectionParameter $parameter + * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + protected function resolvePrimitive(ReflectionParameter $parameter) + { + if (! is_null($concrete = $this->getContextualConcrete('$'.$parameter->name))) { + return $concrete instanceof Closure ? $concrete($this) : $concrete; + } + + if ($parameter->isDefaultValueAvailable()) { + return $parameter->getDefaultValue(); + } + + $this->unresolvablePrimitive($parameter); + } + + /** + * Resolve a class based dependency from the container. + * + * @param \ReflectionParameter $parameter + * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + protected function resolveClass(ReflectionParameter $parameter) + { + try { + return $this->make($parameter->getClass()->name); + } + + // If we can not resolve the class instance, we will check to see if the value + // is optional, and if it is we will return the optional parameter value as + // the value of the dependency, similarly to how we do this with scalars. + catch (BindingResolutionException $e) { + if ($parameter->isOptional()) { + return $parameter->getDefaultValue(); + } + + throw $e; + } + } + + /** + * Throw an exception that the concrete is not instantiable. + * + * @param string $concrete + * @return void + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + protected function notInstantiable($concrete) + { + if (! empty($this->buildStack)) { + $previous = implode(', ', $this->buildStack); + + $message = "Target [$concrete] is not instantiable while building [$previous]."; + } else { + $message = "Target [$concrete] is not instantiable."; + } + + throw new BindingResolutionException($message); + } + + /** + * Throw an exception for an unresolvable primitive. + * + * @param \ReflectionParameter $parameter + * @return void + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + protected function unresolvablePrimitive(ReflectionParameter $parameter) + { + $message = "Unresolvable dependency resolving [$parameter] in class {$parameter->getDeclaringClass()->getName()}"; + + throw new BindingResolutionException($message); + } + + /** + * Register a new resolving callback. + * + * @param \Closure|string $abstract + * @param \Closure|null $callback + * @return void + */ + public function resolving($abstract, Closure $callback = null) + { + if (is_string($abstract)) { + $abstract = $this->getAlias($abstract); + } + + if (is_null($callback) && $abstract instanceof Closure) { + $this->globalResolvingCallbacks[] = $abstract; + } else { + $this->resolvingCallbacks[$abstract][] = $callback; + } + } + + /** + * Register a new after resolving callback for all types. + * + * @param \Closure|string $abstract + * @param \Closure|null $callback + * @return void + */ + public function afterResolving($abstract, Closure $callback = null) + { + if (is_string($abstract)) { + $abstract = $this->getAlias($abstract); + } + + if ($abstract instanceof Closure && is_null($callback)) { + $this->globalAfterResolvingCallbacks[] = $abstract; + } else { + $this->afterResolvingCallbacks[$abstract][] = $callback; + } + } + + /** + * Fire all of the resolving callbacks. + * + * @param string $abstract + * @param mixed $object + * @return void + */ + protected function fireResolvingCallbacks($abstract, $object) + { + $this->fireCallbackArray($object, $this->globalResolvingCallbacks); + + $this->fireCallbackArray( + $object, $this->getCallbacksForType($abstract, $object, $this->resolvingCallbacks) + ); + + $this->fireAfterResolvingCallbacks($abstract, $object); + } + + /** + * Fire all of the after resolving callbacks. + * + * @param string $abstract + * @param mixed $object + * @return void + */ + protected function fireAfterResolvingCallbacks($abstract, $object) + { + $this->fireCallbackArray($object, $this->globalAfterResolvingCallbacks); + + $this->fireCallbackArray( + $object, $this->getCallbacksForType($abstract, $object, $this->afterResolvingCallbacks) + ); + } + + /** + * Get all callbacks for a given type. + * + * @param string $abstract + * @param object $object + * @param array $callbacksPerType + * + * @return array + */ + protected function getCallbacksForType($abstract, $object, array $callbacksPerType) + { + $results = []; + + foreach ($callbacksPerType as $type => $callbacks) { + if ($type === $abstract || $object instanceof $type) { + $results = array_merge($results, $callbacks); + } + } + + return $results; + } + + /** + * Fire an array of callbacks with an object. + * + * @param mixed $object + * @param array $callbacks + * @return void + */ + protected function fireCallbackArray($object, array $callbacks) + { + foreach ($callbacks as $callback) { + $callback($object, $this); + } + } + + /** + * Get the container's bindings. + * + * @return array + */ + public function getBindings() + { + return $this->bindings; + } + + /** + * Get the alias for an abstract if available. + * + * @param string $abstract + * @return string + * + * @throws \LogicException + */ + public function getAlias($abstract) + { + if (! isset($this->aliases[$abstract])) { + return $abstract; + } + + if ($this->aliases[$abstract] === $abstract) { + throw new LogicException("[{$abstract}] is aliased to itself."); + } + + return $this->getAlias($this->aliases[$abstract]); + } + + /** + * Get the extender callbacks for a given type. + * + * @param string $abstract + * @return array + */ + protected function getExtenders($abstract) + { + $abstract = $this->getAlias($abstract); + + if (isset($this->extenders[$abstract])) { + return $this->extenders[$abstract]; + } + + return []; + } + + /** + * Remove all of the extender callbacks for a given type. + * + * @param string $abstract + * @return void + */ + public function forgetExtenders($abstract) + { + unset($this->extenders[$this->getAlias($abstract)]); + } + + /** + * Drop all of the stale instances and aliases. + * + * @param string $abstract + * @return void + */ + protected function dropStaleInstances($abstract) + { + unset($this->instances[$abstract], $this->aliases[$abstract]); + } + + /** + * Remove a resolved instance from the instance cache. + * + * @param string $abstract + * @return void + */ + public function forgetInstance($abstract) + { + unset($this->instances[$abstract]); + } + + /** + * Clear all of the instances from the container. + * + * @return void + */ + public function forgetInstances() + { + $this->instances = []; + } + + /** + * Flush the container of all bindings and resolved instances. + * + * @return void + */ + public function flush() + { + $this->aliases = []; + $this->resolved = []; + $this->bindings = []; + $this->instances = []; + $this->abstractAliases = []; + } + + /** + * Set the globally available instance of the container. + * + * @return static + */ + public static function getInstance() + { + if (is_null(static::$instance)) { + static::$instance = new static; + } + + return static::$instance; + } + + /** + * Set the shared instance of the container. + * + * @param \Illuminate\Contracts\Container\Container|null $container + * @return \Illuminate\Contracts\Container\Container|static + */ + public static function setInstance(ContainerContract $container = null) + { + return static::$instance = $container; + } + + /** + * Determine if a given offset exists. + * + * @param string $key + * @return bool + */ + public function offsetExists($key) + { + return $this->bound($key); + } + + /** + * Get the value at a given offset. + * + * @param string $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->make($key); + } + + /** + * Set the value at a given offset. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + $this->bind($key, $value instanceof Closure ? $value : function () use ($value) { + return $value; + }); + } + + /** + * Unset the value at a given offset. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + unset($this->bindings[$key], $this->instances[$key], $this->resolved[$key]); + } + + /** + * Dynamically access container services. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this[$key]; + } + + /** + * Dynamically set container services. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this[$key] = $value; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Container/ContextualBindingBuilder.php b/vendor/laravel/framework/src/Illuminate/Container/ContextualBindingBuilder.php new file mode 100644 index 0000000..2bd4b5a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Container/ContextualBindingBuilder.php @@ -0,0 +1,69 @@ +concrete = $concrete; + $this->container = $container; + } + + /** + * Define the abstract target that depends on the context. + * + * @param string $abstract + * @return $this + */ + public function needs($abstract) + { + $this->needs = $abstract; + + return $this; + } + + /** + * Define the implementation for the contextual binding. + * + * @param \Closure|string $implementation + * @return void + */ + public function give($implementation) + { + foreach (Arr::wrap($this->concrete) as $concrete) { + $this->container->addContextualBinding($concrete, $this->needs, $implementation); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Container/EntryNotFoundException.php b/vendor/laravel/framework/src/Illuminate/Container/EntryNotFoundException.php new file mode 100644 index 0000000..4266921 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Container/EntryNotFoundException.php @@ -0,0 +1,11 @@ +id = $id; + $this->class = $class; + $this->relations = $relations; + $this->connection = $connection; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Contracts/Debug/ExceptionHandler.php b/vendor/laravel/framework/src/Illuminate/Contracts/Debug/ExceptionHandler.php new file mode 100644 index 0000000..e3f18a5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Contracts/Debug/ExceptionHandler.php @@ -0,0 +1,34 @@ +getPathAndDomain($path, $domain, $secure, $sameSite); + + $time = ($minutes == 0) ? 0 : $this->availableAt($minutes * 60); + + return new Cookie($name, $value, $time, $path, $domain, $secure, $httpOnly, $raw, $sameSite); + } + + /** + * Create a cookie that lasts "forever" (five years). + * + * @param string $name + * @param string $value + * @param string $path + * @param string $domain + * @param bool|null $secure + * @param bool $httpOnly + * @param bool $raw + * @param string|null $sameSite + * @return \Symfony\Component\HttpFoundation\Cookie + */ + public function forever($name, $value, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null) + { + return $this->make($name, $value, 2628000, $path, $domain, $secure, $httpOnly, $raw, $sameSite); + } + + /** + * Expire the given cookie. + * + * @param string $name + * @param string $path + * @param string $domain + * @return \Symfony\Component\HttpFoundation\Cookie + */ + public function forget($name, $path = null, $domain = null) + { + return $this->make($name, null, -2628000, $path, $domain); + } + + /** + * Determine if a cookie has been queued. + * + * @param string $key + * @return bool + */ + public function hasQueued($key) + { + return ! is_null($this->queued($key)); + } + + /** + * Get a queued cookie instance. + * + * @param string $key + * @param mixed $default + * @return \Symfony\Component\HttpFoundation\Cookie + */ + public function queued($key, $default = null) + { + return Arr::get($this->queued, $key, $default); + } + + /** + * Queue a cookie to send with the next response. + * + * @param array $parameters + * @return void + */ + public function queue(...$parameters) + { + if (head($parameters) instanceof Cookie) { + $cookie = head($parameters); + } else { + $cookie = call_user_func_array([$this, 'make'], $parameters); + } + + $this->queued[$cookie->getName()] = $cookie; + } + + /** + * Remove a cookie from the queue. + * + * @param string $name + * @return void + */ + public function unqueue($name) + { + unset($this->queued[$name]); + } + + /** + * Get the path and domain, or the default values. + * + * @param string $path + * @param string $domain + * @param bool|null $secure + * @param string $sameSite + * @return array + */ + protected function getPathAndDomain($path, $domain, $secure = null, $sameSite = null) + { + return [$path ?: $this->path, $domain ?: $this->domain, is_bool($secure) ? $secure : $this->secure, $sameSite ?: $this->sameSite]; + } + + /** + * Set the default path and domain for the jar. + * + * @param string $path + * @param string $domain + * @param bool $secure + * @param string $sameSite + * @return $this + */ + public function setDefaultPathAndDomain($path, $domain, $secure = false, $sameSite = null) + { + [$this->path, $this->domain, $this->secure, $this->sameSite] = [$path, $domain, $secure, $sameSite]; + + return $this; + } + + /** + * Get the cookies which have been queued for the next request. + * + * @return \Symfony\Component\HttpFoundation\Cookie[] + */ + public function getQueuedCookies() + { + return $this->queued; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cookie/CookieServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Cookie/CookieServiceProvider.php new file mode 100755 index 0000000..7c82dc1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cookie/CookieServiceProvider.php @@ -0,0 +1,24 @@ +app->singleton('cookie', function ($app) { + $config = $app->make('config')->get('session'); + + return (new CookieJar)->setDefaultPathAndDomain( + $config['path'], $config['domain'], $config['secure'], $config['same_site'] ?? null + ); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php b/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php new file mode 100644 index 0000000..4caa574 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php @@ -0,0 +1,45 @@ +cookies = $cookies; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + $response = $next($request); + + foreach ($this->cookies->getQueuedCookies() as $cookie) { + $response->headers->setCookie($cookie); + } + + return $response; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php b/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php new file mode 100644 index 0000000..1036a08 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php @@ -0,0 +1,183 @@ +encrypter = $encrypter; + } + + /** + * Disable encryption for the given cookie name(s). + * + * @param string|array $name + * @return void + */ + public function disableFor($name) + { + $this->except = array_merge($this->except, (array) $name); + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return \Symfony\Component\HttpFoundation\Response + */ + public function handle($request, Closure $next) + { + return $this->encrypt($next($this->decrypt($request))); + } + + /** + * Decrypt the cookies on the request. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return \Symfony\Component\HttpFoundation\Request + */ + protected function decrypt(Request $request) + { + foreach ($request->cookies as $key => $cookie) { + if ($this->isDisabled($key)) { + continue; + } + + try { + $request->cookies->set($key, $this->decryptCookie($key, $cookie)); + } catch (DecryptException $e) { + $request->cookies->set($key, null); + } + } + + return $request; + } + + /** + * Decrypt the given cookie and return the value. + * + * @param string $name + * @param string|array $cookie + * @return string|array + */ + protected function decryptCookie($name, $cookie) + { + return is_array($cookie) + ? $this->decryptArray($cookie) + : $this->encrypter->decrypt($cookie, static::serialized($name)); + } + + /** + * Decrypt an array based cookie. + * + * @param array $cookie + * @return array + */ + protected function decryptArray(array $cookie) + { + $decrypted = []; + + foreach ($cookie as $key => $value) { + if (is_string($value)) { + $decrypted[$key] = $this->encrypter->decrypt($value, static::serialized($key)); + } + } + + return $decrypted; + } + + /** + * Encrypt the cookies on an outgoing response. + * + * @param \Symfony\Component\HttpFoundation\Response $response + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function encrypt(Response $response) + { + foreach ($response->headers->getCookies() as $cookie) { + if ($this->isDisabled($cookie->getName())) { + continue; + } + + $response->headers->setCookie($this->duplicate( + $cookie, $this->encrypter->encrypt($cookie->getValue(), static::serialized($cookie->getName())) + )); + } + + return $response; + } + + /** + * Duplicate a cookie with a new value. + * + * @param \Symfony\Component\HttpFoundation\Cookie $cookie + * @param mixed $value + * @return \Symfony\Component\HttpFoundation\Cookie + */ + protected function duplicate(Cookie $cookie, $value) + { + return new Cookie( + $cookie->getName(), $value, $cookie->getExpiresTime(), + $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), + $cookie->isHttpOnly(), $cookie->isRaw(), $cookie->getSameSite() + ); + } + + /** + * Determine whether encryption has been disabled for the given cookie. + * + * @param string $name + * @return bool + */ + public function isDisabled($name) + { + return in_array($name, $this->except); + } + + /** + * Determine if the cookie contents should be serialized. + * + * @param string $name + * @return bool + */ + public static function serialized($name) + { + return static::$serialize; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Cookie/composer.json b/vendor/laravel/framework/src/Illuminate/Cookie/composer.json new file mode 100755 index 0000000..014b7d2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Cookie/composer.json @@ -0,0 +1,37 @@ +{ + "name": "illuminate/cookie", + "description": "The Illuminate Cookie package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*", + "symfony/http-foundation": "^4.1", + "symfony/http-kernel": "^4.1" + }, + "autoload": { + "psr-4": { + "Illuminate\\Cookie\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php b/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php new file mode 100755 index 0000000..b82a792 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php @@ -0,0 +1,201 @@ +setupContainer($container ?: new Container); + + // Once we have the container setup, we will setup the default configuration + // options in the container "config" binding. This will make the database + // manager work correctly out of the box without extreme configuration. + $this->setupDefaultConfiguration(); + + $this->setupManager(); + } + + /** + * Setup the default database configuration options. + * + * @return void + */ + protected function setupDefaultConfiguration() + { + $this->container['config']['database.fetch'] = PDO::FETCH_OBJ; + + $this->container['config']['database.default'] = 'default'; + } + + /** + * Build the database manager instance. + * + * @return void + */ + protected function setupManager() + { + $factory = new ConnectionFactory($this->container); + + $this->manager = new DatabaseManager($this->container, $factory); + } + + /** + * Get a connection instance from the global manager. + * + * @param string $connection + * @return \Illuminate\Database\Connection + */ + public static function connection($connection = null) + { + return static::$instance->getConnection($connection); + } + + /** + * Get a fluent query builder instance. + * + * @param string $table + * @param string $connection + * @return \Illuminate\Database\Query\Builder + */ + public static function table($table, $connection = null) + { + return static::$instance->connection($connection)->table($table); + } + + /** + * Get a schema builder instance. + * + * @param string $connection + * @return \Illuminate\Database\Schema\Builder + */ + public static function schema($connection = null) + { + return static::$instance->connection($connection)->getSchemaBuilder(); + } + + /** + * Get a registered connection instance. + * + * @param string $name + * @return \Illuminate\Database\Connection + */ + public function getConnection($name = null) + { + return $this->manager->connection($name); + } + + /** + * Register a connection with the manager. + * + * @param array $config + * @param string $name + * @return void + */ + public function addConnection(array $config, $name = 'default') + { + $connections = $this->container['config']['database.connections']; + + $connections[$name] = $config; + + $this->container['config']['database.connections'] = $connections; + } + + /** + * Bootstrap Eloquent so it is ready for usage. + * + * @return void + */ + public function bootEloquent() + { + Eloquent::setConnectionResolver($this->manager); + + // If we have an event dispatcher instance, we will go ahead and register it + // with the Eloquent ORM, allowing for model callbacks while creating and + // updating "model" instances; however, it is not necessary to operate. + if ($dispatcher = $this->getEventDispatcher()) { + Eloquent::setEventDispatcher($dispatcher); + } + } + + /** + * Set the fetch mode for the database connections. + * + * @param int $fetchMode + * @return $this + */ + public function setFetchMode($fetchMode) + { + $this->container['config']['database.fetch'] = $fetchMode; + + return $this; + } + + /** + * Get the database manager instance. + * + * @return \Illuminate\Database\DatabaseManager + */ + public function getDatabaseManager() + { + return $this->manager; + } + + /** + * Get the current event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher|null + */ + public function getEventDispatcher() + { + if ($this->container->bound('events')) { + return $this->container['events']; + } + } + + /** + * Set the event dispatcher instance to be used by connections. + * + * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher + * @return void + */ + public function setEventDispatcher(Dispatcher $dispatcher) + { + $this->container->instance('events', $dispatcher); + } + + /** + * Dynamically pass methods to the default connection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + return static::connection()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php b/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php new file mode 100644 index 0000000..c712bbe --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php @@ -0,0 +1,161 @@ +enforceOrderBy(); + + $page = 1; + + do { + // We'll execute the query for the given page and get the results. If there are + // no results we can just break and return from here. When there are results + // we will call the callback with the current chunk of these results here. + $results = $this->forPage($page, $count)->get(); + + $countResults = $results->count(); + + if ($countResults == 0) { + break; + } + + // On each chunk result set, we will pass them to the callback and then let the + // developer take care of everything within the callback, which allows us to + // keep the memory low for spinning through large result sets for working. + if ($callback($results, $page) === false) { + return false; + } + + unset($results); + + $page++; + } while ($countResults == $count); + + return true; + } + + /** + * Execute a callback over each item while chunking. + * + * @param callable $callback + * @param int $count + * @return bool + */ + public function each(callable $callback, $count = 1000) + { + return $this->chunk($count, function ($results) use ($callback) { + foreach ($results as $key => $value) { + if ($callback($value, $key) === false) { + return false; + } + } + }); + } + + /** + * Execute the query and get the first result. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|object|static|null + */ + public function first($columns = ['*']) + { + return $this->take(1)->get($columns)->first(); + } + + /** + * Apply the callback's query changes if the given "value" is true. + * + * @param mixed $value + * @param callable $callback + * @param callable $default + * @return mixed|$this + */ + public function when($value, $callback, $default = null) + { + if ($value) { + return $callback($this, $value) ?: $this; + } elseif ($default) { + return $default($this, $value) ?: $this; + } + + return $this; + } + + /** + * Pass the query to a given callback. + * + * @param \Closure $callback + * @return \Illuminate\Database\Query\Builder + */ + public function tap($callback) + { + return $this->when(true, $callback); + } + + /** + * Apply the callback's query changes if the given "value" is false. + * + * @param mixed $value + * @param callable $callback + * @param callable $default + * @return mixed|$this + */ + public function unless($value, $callback, $default = null) + { + if (! $value) { + return $callback($this, $value) ?: $this; + } elseif ($default) { + return $default($this, $value) ?: $this; + } + + return $this; + } + + /** + * Create a new length-aware paginator instance. + * + * @param \Illuminate\Support\Collection $items + * @param int $total + * @param int $perPage + * @param int $currentPage + * @param array $options + * @return \Illuminate\Pagination\LengthAwarePaginator + */ + protected function paginator($items, $total, $perPage, $currentPage, $options) + { + return Container::getInstance()->makeWith(LengthAwarePaginator::class, compact( + 'items', 'total', 'perPage', 'currentPage', 'options' + )); + } + + /** + * Create a new simple paginator instance. + * + * @param \Illuminate\Support\Collection $items + * @param int $perPage + * @param int $currentPage + * @param array $options + * @return \Illuminate\Pagination\Paginator + */ + protected function simplePaginator($items, $perPage, $currentPage, $options) + { + return Container::getInstance()->makeWith(Paginator::class, compact( + 'items', 'perPage', 'currentPage', 'options' + )); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php b/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php new file mode 100644 index 0000000..f8a3d66 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php @@ -0,0 +1,242 @@ +beginTransaction(); + + // We'll simply execute the given callback within a try / catch block and if we + // catch any exception we can rollback this transaction so that none of this + // gets actually persisted to a database or stored in a permanent fashion. + try { + return tap($callback($this), function () { + $this->commit(); + }); + } + + // If we catch an exception we'll rollback this transaction and try again if we + // are not out of attempts. If we are out of attempts we will just throw the + // exception back out and let the developer handle an uncaught exceptions. + catch (Exception $e) { + $this->handleTransactionException( + $e, $currentAttempt, $attempts + ); + } catch (Throwable $e) { + $this->rollBack(); + + throw $e; + } + } + } + + /** + * Handle an exception encountered when running a transacted statement. + * + * @param \Exception $e + * @param int $currentAttempt + * @param int $maxAttempts + * @return void + * + * @throws \Exception + */ + protected function handleTransactionException($e, $currentAttempt, $maxAttempts) + { + // On a deadlock, MySQL rolls back the entire transaction so we can't just + // retry the query. We have to throw this exception all the way out and + // let the developer handle it in another way. We will decrement too. + if ($this->causedByDeadlock($e) && + $this->transactions > 1) { + $this->transactions--; + + throw $e; + } + + // If there was an exception we will rollback this transaction and then we + // can check if we have exceeded the maximum attempt count for this and + // if we haven't we will return and try this query again in our loop. + $this->rollBack(); + + if ($this->causedByDeadlock($e) && + $currentAttempt < $maxAttempts) { + return; + } + + throw $e; + } + + /** + * Start a new database transaction. + * + * @return void + * + * @throws \Exception + */ + public function beginTransaction() + { + $this->createTransaction(); + + $this->transactions++; + + $this->fireConnectionEvent('beganTransaction'); + } + + /** + * Create a transaction within the database. + * + * @return void + */ + protected function createTransaction() + { + if ($this->transactions == 0) { + try { + $this->getPdo()->beginTransaction(); + } catch (Exception $e) { + $this->handleBeginTransactionException($e); + } + } elseif ($this->transactions >= 1 && $this->queryGrammar->supportsSavepoints()) { + $this->createSavepoint(); + } + } + + /** + * Create a save point within the database. + * + * @return void + */ + protected function createSavepoint() + { + $this->getPdo()->exec( + $this->queryGrammar->compileSavepoint('trans'.($this->transactions + 1)) + ); + } + + /** + * Handle an exception from a transaction beginning. + * + * @param \Throwable $e + * @return void + * + * @throws \Exception + */ + protected function handleBeginTransactionException($e) + { + if ($this->causedByLostConnection($e)) { + $this->reconnect(); + + $this->pdo->beginTransaction(); + } else { + throw $e; + } + } + + /** + * Commit the active database transaction. + * + * @return void + */ + public function commit() + { + if ($this->transactions == 1) { + $this->getPdo()->commit(); + } + + $this->transactions = max(0, $this->transactions - 1); + + $this->fireConnectionEvent('committed'); + } + + /** + * Rollback the active database transaction. + * + * @param int|null $toLevel + * @return void + * + * @throws \Exception + */ + public function rollBack($toLevel = null) + { + // We allow developers to rollback to a certain transaction level. We will verify + // that this given transaction level is valid before attempting to rollback to + // that level. If it's not we will just return out and not attempt anything. + $toLevel = is_null($toLevel) + ? $this->transactions - 1 + : $toLevel; + + if ($toLevel < 0 || $toLevel >= $this->transactions) { + return; + } + + // Next, we will actually perform this rollback within this database and fire the + // rollback event. We will also set the current transaction level to the given + // level that was passed into this method so it will be right from here out. + try { + $this->performRollBack($toLevel); + } catch (Exception $e) { + $this->handleRollBackException($e); + } + + $this->transactions = $toLevel; + + $this->fireConnectionEvent('rollingBack'); + } + + /** + * Perform a rollback within the database. + * + * @param int $toLevel + * @return void + */ + protected function performRollBack($toLevel) + { + if ($toLevel == 0) { + $this->getPdo()->rollBack(); + } elseif ($this->queryGrammar->supportsSavepoints()) { + $this->getPdo()->exec( + $this->queryGrammar->compileSavepointRollBack('trans'.($toLevel + 1)) + ); + } + } + + /** + * Handle an exception from a rollback. + * + * @param \Exception $e + * + * @throws \Exception + */ + protected function handleRollBackException($e) + { + if ($this->causedByLostConnection($e)) { + $this->transactions = 0; + } + + throw $e; + } + + /** + * Get the number of active transactions. + * + * @return int + */ + public function transactionLevel() + { + return $this->transactions; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Connection.php b/vendor/laravel/framework/src/Illuminate/Database/Connection.php new file mode 100755 index 0000000..004545c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Connection.php @@ -0,0 +1,1263 @@ +pdo = $pdo; + + // First we will setup the default properties. We keep track of the DB + // name we are connected to since it is needed when some reflective + // type commands are run such as checking whether a table exists. + $this->database = $database; + + $this->tablePrefix = $tablePrefix; + + $this->config = $config; + + // We need to initialize a query grammar and the query post processors + // which are both very important parts of the database abstractions + // so we initialize these to their default values while starting. + $this->useDefaultQueryGrammar(); + + $this->useDefaultPostProcessor(); + } + + /** + * Set the query grammar to the default implementation. + * + * @return void + */ + public function useDefaultQueryGrammar() + { + $this->queryGrammar = $this->getDefaultQueryGrammar(); + } + + /** + * Get the default query grammar instance. + * + * @return \Illuminate\Database\Query\Grammars\Grammar + */ + protected function getDefaultQueryGrammar() + { + return new QueryGrammar; + } + + /** + * Set the schema grammar to the default implementation. + * + * @return void + */ + public function useDefaultSchemaGrammar() + { + $this->schemaGrammar = $this->getDefaultSchemaGrammar(); + } + + /** + * Get the default schema grammar instance. + * + * @return \Illuminate\Database\Schema\Grammars\Grammar + */ + protected function getDefaultSchemaGrammar() + { + // + } + + /** + * Set the query post processor to the default implementation. + * + * @return void + */ + public function useDefaultPostProcessor() + { + $this->postProcessor = $this->getDefaultPostProcessor(); + } + + /** + * Get the default post processor instance. + * + * @return \Illuminate\Database\Query\Processors\Processor + */ + protected function getDefaultPostProcessor() + { + return new Processor; + } + + /** + * Get a schema builder instance for the connection. + * + * @return \Illuminate\Database\Schema\Builder + */ + public function getSchemaBuilder() + { + if (is_null($this->schemaGrammar)) { + $this->useDefaultSchemaGrammar(); + } + + return new SchemaBuilder($this); + } + + /** + * Begin a fluent query against a database table. + * + * @param string $table + * @return \Illuminate\Database\Query\Builder + */ + public function table($table) + { + return $this->query()->from($table); + } + + /** + * Get a new query builder instance. + * + * @return \Illuminate\Database\Query\Builder + */ + public function query() + { + return new QueryBuilder( + $this, $this->getQueryGrammar(), $this->getPostProcessor() + ); + } + + /** + * Run a select statement and return a single result. + * + * @param string $query + * @param array $bindings + * @param bool $useReadPdo + * @return mixed + */ + public function selectOne($query, $bindings = [], $useReadPdo = true) + { + $records = $this->select($query, $bindings, $useReadPdo); + + return array_shift($records); + } + + /** + * Run a select statement against the database. + * + * @param string $query + * @param array $bindings + * @return array + */ + public function selectFromWriteConnection($query, $bindings = []) + { + return $this->select($query, $bindings, false); + } + + /** + * Run a select statement against the database. + * + * @param string $query + * @param array $bindings + * @param bool $useReadPdo + * @return array + */ + public function select($query, $bindings = [], $useReadPdo = true) + { + return $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) { + if ($this->pretending()) { + return []; + } + + // For select statements, we'll simply execute the query and return an array + // of the database result set. Each element in the array will be a single + // row from the database table, and will either be an array or objects. + $statement = $this->prepared($this->getPdoForSelect($useReadPdo) + ->prepare($query)); + + $this->bindValues($statement, $this->prepareBindings($bindings)); + + $statement->execute(); + + return $statement->fetchAll(); + }); + } + + /** + * Run a select statement against the database and returns a generator. + * + * @param string $query + * @param array $bindings + * @param bool $useReadPdo + * @return \Generator + */ + public function cursor($query, $bindings = [], $useReadPdo = true) + { + $statement = $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) { + if ($this->pretending()) { + return []; + } + + // First we will create a statement for the query. Then, we will set the fetch + // mode and prepare the bindings for the query. Once that's done we will be + // ready to execute the query against the database and return the cursor. + $statement = $this->prepared($this->getPdoForSelect($useReadPdo) + ->prepare($query)); + + $this->bindValues( + $statement, $this->prepareBindings($bindings) + ); + + // Next, we'll execute the query against the database and return the statement + // so we can return the cursor. The cursor will use a PHP generator to give + // back one row at a time without using a bunch of memory to render them. + $statement->execute(); + + return $statement; + }); + + while ($record = $statement->fetch()) { + yield $record; + } + } + + /** + * Configure the PDO prepared statement. + * + * @param \PDOStatement $statement + * @return \PDOStatement + */ + protected function prepared(PDOStatement $statement) + { + $statement->setFetchMode($this->fetchMode); + + $this->event(new Events\StatementPrepared( + $this, $statement + )); + + return $statement; + } + + /** + * Get the PDO connection to use for a select query. + * + * @param bool $useReadPdo + * @return \PDO + */ + protected function getPdoForSelect($useReadPdo = true) + { + return $useReadPdo ? $this->getReadPdo() : $this->getPdo(); + } + + /** + * Run an insert statement against the database. + * + * @param string $query + * @param array $bindings + * @return bool + */ + public function insert($query, $bindings = []) + { + return $this->statement($query, $bindings); + } + + /** + * Run an update statement against the database. + * + * @param string $query + * @param array $bindings + * @return int + */ + public function update($query, $bindings = []) + { + return $this->affectingStatement($query, $bindings); + } + + /** + * Run a delete statement against the database. + * + * @param string $query + * @param array $bindings + * @return int + */ + public function delete($query, $bindings = []) + { + return $this->affectingStatement($query, $bindings); + } + + /** + * Execute an SQL statement and return the boolean result. + * + * @param string $query + * @param array $bindings + * @return bool + */ + public function statement($query, $bindings = []) + { + return $this->run($query, $bindings, function ($query, $bindings) { + if ($this->pretending()) { + return true; + } + + $statement = $this->getPdo()->prepare($query); + + $this->bindValues($statement, $this->prepareBindings($bindings)); + + $this->recordsHaveBeenModified(); + + return $statement->execute(); + }); + } + + /** + * Run an SQL statement and get the number of rows affected. + * + * @param string $query + * @param array $bindings + * @return int + */ + public function affectingStatement($query, $bindings = []) + { + return $this->run($query, $bindings, function ($query, $bindings) { + if ($this->pretending()) { + return 0; + } + + // For update or delete statements, we want to get the number of rows affected + // by the statement and return that back to the developer. We'll first need + // to execute the statement and then we'll use PDO to fetch the affected. + $statement = $this->getPdo()->prepare($query); + + $this->bindValues($statement, $this->prepareBindings($bindings)); + + $statement->execute(); + + $this->recordsHaveBeenModified( + ($count = $statement->rowCount()) > 0 + ); + + return $count; + }); + } + + /** + * Run a raw, unprepared query against the PDO connection. + * + * @param string $query + * @return bool + */ + public function unprepared($query) + { + return $this->run($query, [], function ($query) { + if ($this->pretending()) { + return true; + } + + $this->recordsHaveBeenModified( + $change = $this->getPdo()->exec($query) !== false + ); + + return $change; + }); + } + + /** + * Execute the given callback in "dry run" mode. + * + * @param \Closure $callback + * @return array + */ + public function pretend(Closure $callback) + { + return $this->withFreshQueryLog(function () use ($callback) { + $this->pretending = true; + + // Basically to make the database connection "pretend", we will just return + // the default values for all the query methods, then we will return an + // array of queries that were "executed" within the Closure callback. + $callback($this); + + $this->pretending = false; + + return $this->queryLog; + }); + } + + /** + * Execute the given callback in "dry run" mode. + * + * @param \Closure $callback + * @return array + */ + protected function withFreshQueryLog($callback) + { + $loggingQueries = $this->loggingQueries; + + // First we will back up the value of the logging queries property and then + // we'll be ready to run callbacks. This query log will also get cleared + // so we will have a new log of all the queries that are executed now. + $this->enableQueryLog(); + + $this->queryLog = []; + + // Now we'll execute this callback and capture the result. Once it has been + // executed we will restore the value of query logging and give back the + // value of the callback so the original callers can have the results. + $result = $callback(); + + $this->loggingQueries = $loggingQueries; + + return $result; + } + + /** + * Bind values to their parameters in the given statement. + * + * @param \PDOStatement $statement + * @param array $bindings + * @return void + */ + public function bindValues($statement, $bindings) + { + foreach ($bindings as $key => $value) { + $statement->bindValue( + is_string($key) ? $key : $key + 1, $value, + is_int($value) ? PDO::PARAM_INT : PDO::PARAM_STR + ); + } + } + + /** + * Prepare the query bindings for execution. + * + * @param array $bindings + * @return array + */ + public function prepareBindings(array $bindings) + { + $grammar = $this->getQueryGrammar(); + + foreach ($bindings as $key => $value) { + // We need to transform all instances of DateTimeInterface into the actual + // date string. Each query grammar maintains its own date string format + // so we'll just ask the grammar for the format to get from the date. + if ($value instanceof DateTimeInterface) { + $bindings[$key] = $value->format($grammar->getDateFormat()); + } elseif (is_bool($value)) { + $bindings[$key] = (int) $value; + } + } + + return $bindings; + } + + /** + * Run a SQL statement and log its execution context. + * + * @param string $query + * @param array $bindings + * @param \Closure $callback + * @return mixed + * + * @throws \Illuminate\Database\QueryException + */ + protected function run($query, $bindings, Closure $callback) + { + $this->reconnectIfMissingConnection(); + + $start = microtime(true); + + // Here we will run this query. If an exception occurs we'll determine if it was + // caused by a connection that has been lost. If that is the cause, we'll try + // to re-establish connection and re-run the query with a fresh connection. + try { + $result = $this->runQueryCallback($query, $bindings, $callback); + } catch (QueryException $e) { + $result = $this->handleQueryException( + $e, $query, $bindings, $callback + ); + } + + // Once we have run the query we will calculate the time that it took to run and + // then log the query, bindings, and execution time so we will report them on + // the event that the developer needs them. We'll log time in milliseconds. + $this->logQuery( + $query, $bindings, $this->getElapsedTime($start) + ); + + return $result; + } + + /** + * Run a SQL statement. + * + * @param string $query + * @param array $bindings + * @param \Closure $callback + * @return mixed + * + * @throws \Illuminate\Database\QueryException + */ + protected function runQueryCallback($query, $bindings, Closure $callback) + { + // To execute the statement, we'll simply call the callback, which will actually + // run the SQL against the PDO connection. Then we can calculate the time it + // took to execute and log the query SQL, bindings and time in our memory. + try { + $result = $callback($query, $bindings); + } + + // If an exception occurs when attempting to run a query, we'll format the error + // message to include the bindings with SQL, which will make this exception a + // lot more helpful to the developer instead of just the database's errors. + catch (Exception $e) { + throw new QueryException( + $query, $this->prepareBindings($bindings), $e + ); + } + + return $result; + } + + /** + * Log a query in the connection's query log. + * + * @param string $query + * @param array $bindings + * @param float|null $time + * @return void + */ + public function logQuery($query, $bindings, $time = null) + { + $this->event(new QueryExecuted($query, $bindings, $time, $this)); + + if ($this->loggingQueries) { + $this->queryLog[] = compact('query', 'bindings', 'time'); + } + } + + /** + * Get the elapsed time since a given starting point. + * + * @param int $start + * @return float + */ + protected function getElapsedTime($start) + { + return round((microtime(true) - $start) * 1000, 2); + } + + /** + * Handle a query exception. + * + * @param \Exception $e + * @param string $query + * @param array $bindings + * @param \Closure $callback + * @return mixed + * + * @throws \Exception + */ + protected function handleQueryException($e, $query, $bindings, Closure $callback) + { + if ($this->transactions >= 1) { + throw $e; + } + + return $this->tryAgainIfCausedByLostConnection( + $e, $query, $bindings, $callback + ); + } + + /** + * Handle a query exception that occurred during query execution. + * + * @param \Illuminate\Database\QueryException $e + * @param string $query + * @param array $bindings + * @param \Closure $callback + * @return mixed + * + * @throws \Illuminate\Database\QueryException + */ + protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $bindings, Closure $callback) + { + if ($this->causedByLostConnection($e->getPrevious())) { + $this->reconnect(); + + return $this->runQueryCallback($query, $bindings, $callback); + } + + throw $e; + } + + /** + * Reconnect to the database. + * + * @return void + * + * @throws \LogicException + */ + public function reconnect() + { + if (is_callable($this->reconnector)) { + $this->doctrineConnection = null; + + return call_user_func($this->reconnector, $this); + } + + throw new LogicException('Lost connection and no reconnector available.'); + } + + /** + * Reconnect to the database if a PDO connection is missing. + * + * @return void + */ + protected function reconnectIfMissingConnection() + { + if (is_null($this->pdo)) { + $this->reconnect(); + } + } + + /** + * Disconnect from the underlying PDO connection. + * + * @return void + */ + public function disconnect() + { + $this->setPdo(null)->setReadPdo(null); + } + + /** + * Register a database query listener with the connection. + * + * @param \Closure $callback + * @return void + */ + public function listen(Closure $callback) + { + if (isset($this->events)) { + $this->events->listen(Events\QueryExecuted::class, $callback); + } + } + + /** + * Fire an event for this connection. + * + * @param string $event + * @return array|null + */ + protected function fireConnectionEvent($event) + { + if (! isset($this->events)) { + return; + } + + switch ($event) { + case 'beganTransaction': + return $this->events->dispatch(new Events\TransactionBeginning($this)); + case 'committed': + return $this->events->dispatch(new Events\TransactionCommitted($this)); + case 'rollingBack': + return $this->events->dispatch(new Events\TransactionRolledBack($this)); + } + } + + /** + * Fire the given event if possible. + * + * @param mixed $event + * @return void + */ + protected function event($event) + { + if (isset($this->events)) { + $this->events->dispatch($event); + } + } + + /** + * Get a new raw query expression. + * + * @param mixed $value + * @return \Illuminate\Database\Query\Expression + */ + public function raw($value) + { + return new Expression($value); + } + + /** + * Indicate if any records have been modified. + * + * @param bool $value + * @return void + */ + public function recordsHaveBeenModified($value = true) + { + if (! $this->recordsModified) { + $this->recordsModified = $value; + } + } + + /** + * Is Doctrine available? + * + * @return bool + */ + public function isDoctrineAvailable() + { + return class_exists('Doctrine\DBAL\Connection'); + } + + /** + * Get a Doctrine Schema Column instance. + * + * @param string $table + * @param string $column + * @return \Doctrine\DBAL\Schema\Column + */ + public function getDoctrineColumn($table, $column) + { + $schema = $this->getDoctrineSchemaManager(); + + return $schema->listTableDetails($table)->getColumn($column); + } + + /** + * Get the Doctrine DBAL schema manager for the connection. + * + * @return \Doctrine\DBAL\Schema\AbstractSchemaManager + */ + public function getDoctrineSchemaManager() + { + return $this->getDoctrineDriver()->getSchemaManager($this->getDoctrineConnection()); + } + + /** + * Get the Doctrine DBAL database connection instance. + * + * @return \Doctrine\DBAL\Connection + */ + public function getDoctrineConnection() + { + if (is_null($this->doctrineConnection)) { + $driver = $this->getDoctrineDriver(); + + $this->doctrineConnection = new DoctrineConnection([ + 'pdo' => $this->getPdo(), + 'dbname' => $this->getConfig('database'), + 'driver' => $driver->getName(), + ], $driver); + } + + return $this->doctrineConnection; + } + + /** + * Get the current PDO connection. + * + * @return \PDO + */ + public function getPdo() + { + if ($this->pdo instanceof Closure) { + return $this->pdo = call_user_func($this->pdo); + } + + return $this->pdo; + } + + /** + * Get the current PDO connection used for reading. + * + * @return \PDO + */ + public function getReadPdo() + { + if ($this->transactions > 0) { + return $this->getPdo(); + } + + if ($this->recordsModified && $this->getConfig('sticky')) { + return $this->getPdo(); + } + + if ($this->readPdo instanceof Closure) { + return $this->readPdo = call_user_func($this->readPdo); + } + + return $this->readPdo ?: $this->getPdo(); + } + + /** + * Set the PDO connection. + * + * @param \PDO|\Closure|null $pdo + * @return $this + */ + public function setPdo($pdo) + { + $this->transactions = 0; + + $this->pdo = $pdo; + + return $this; + } + + /** + * Set the PDO connection used for reading. + * + * @param \PDO|\Closure|null $pdo + * @return $this + */ + public function setReadPdo($pdo) + { + $this->readPdo = $pdo; + + return $this; + } + + /** + * Set the reconnect instance on the connection. + * + * @param callable $reconnector + * @return $this + */ + public function setReconnector(callable $reconnector) + { + $this->reconnector = $reconnector; + + return $this; + } + + /** + * Get the database connection name. + * + * @return string|null + */ + public function getName() + { + return $this->getConfig('name'); + } + + /** + * Get an option from the configuration options. + * + * @param string|null $option + * @return mixed + */ + public function getConfig($option = null) + { + return Arr::get($this->config, $option); + } + + /** + * Get the PDO driver name. + * + * @return string + */ + public function getDriverName() + { + return $this->getConfig('driver'); + } + + /** + * Get the query grammar used by the connection. + * + * @return \Illuminate\Database\Query\Grammars\Grammar + */ + public function getQueryGrammar() + { + return $this->queryGrammar; + } + + /** + * Set the query grammar used by the connection. + * + * @param \Illuminate\Database\Query\Grammars\Grammar $grammar + * @return $this + */ + public function setQueryGrammar(Query\Grammars\Grammar $grammar) + { + $this->queryGrammar = $grammar; + + return $this; + } + + /** + * Get the schema grammar used by the connection. + * + * @return \Illuminate\Database\Schema\Grammars\Grammar + */ + public function getSchemaGrammar() + { + return $this->schemaGrammar; + } + + /** + * Set the schema grammar used by the connection. + * + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @return $this + */ + public function setSchemaGrammar(Schema\Grammars\Grammar $grammar) + { + $this->schemaGrammar = $grammar; + + return $this; + } + + /** + * Get the query post processor used by the connection. + * + * @return \Illuminate\Database\Query\Processors\Processor + */ + public function getPostProcessor() + { + return $this->postProcessor; + } + + /** + * Set the query post processor used by the connection. + * + * @param \Illuminate\Database\Query\Processors\Processor $processor + * @return $this + */ + public function setPostProcessor(Processor $processor) + { + $this->postProcessor = $processor; + + return $this; + } + + /** + * Get the event dispatcher used by the connection. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public function getEventDispatcher() + { + return $this->events; + } + + /** + * Set the event dispatcher instance on the connection. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return $this + */ + public function setEventDispatcher(Dispatcher $events) + { + $this->events = $events; + + return $this; + } + + /** + * Unset the event dispatcher for this connection. + * + * @return void + */ + public function unsetEventDispatcher() + { + $this->events = null; + } + + /** + * Determine if the connection in a "dry run". + * + * @return bool + */ + public function pretending() + { + return $this->pretending === true; + } + + /** + * Get the connection query log. + * + * @return array + */ + public function getQueryLog() + { + return $this->queryLog; + } + + /** + * Clear the query log. + * + * @return void + */ + public function flushQueryLog() + { + $this->queryLog = []; + } + + /** + * Enable the query log on the connection. + * + * @return void + */ + public function enableQueryLog() + { + $this->loggingQueries = true; + } + + /** + * Disable the query log on the connection. + * + * @return void + */ + public function disableQueryLog() + { + $this->loggingQueries = false; + } + + /** + * Determine whether we're logging queries. + * + * @return bool + */ + public function logging() + { + return $this->loggingQueries; + } + + /** + * Get the name of the connected database. + * + * @return string + */ + public function getDatabaseName() + { + return $this->database; + } + + /** + * Set the name of the connected database. + * + * @param string $database + * @return $this + */ + public function setDatabaseName($database) + { + $this->database = $database; + + return $this; + } + + /** + * Get the table prefix for the connection. + * + * @return string + */ + public function getTablePrefix() + { + return $this->tablePrefix; + } + + /** + * Set the table prefix in use by the connection. + * + * @param string $prefix + * @return $this + */ + public function setTablePrefix($prefix) + { + $this->tablePrefix = $prefix; + + $this->getQueryGrammar()->setTablePrefix($prefix); + + return $this; + } + + /** + * Set the table prefix and return the grammar. + * + * @param \Illuminate\Database\Grammar $grammar + * @return \Illuminate\Database\Grammar + */ + public function withTablePrefix(Grammar $grammar) + { + $grammar->setTablePrefix($this->tablePrefix); + + return $grammar; + } + + /** + * Register a connection resolver. + * + * @param string $driver + * @param \Closure $callback + * @return void + */ + public static function resolverFor($driver, Closure $callback) + { + static::$resolvers[$driver] = $callback; + } + + /** + * Get the connection resolver for the given driver. + * + * @param string $driver + * @return mixed + */ + public static function getResolver($driver) + { + return static::$resolvers[$driver] ?? null; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/ConnectionInterface.php b/vendor/laravel/framework/src/Illuminate/Database/ConnectionInterface.php new file mode 100755 index 0000000..56127e1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/ConnectionInterface.php @@ -0,0 +1,162 @@ + $connection) { + $this->addConnection($name, $connection); + } + } + + /** + * Get a database connection instance. + * + * @param string $name + * @return \Illuminate\Database\ConnectionInterface + */ + public function connection($name = null) + { + if (is_null($name)) { + $name = $this->getDefaultConnection(); + } + + return $this->connections[$name]; + } + + /** + * Add a connection to the resolver. + * + * @param string $name + * @param \Illuminate\Database\ConnectionInterface $connection + * @return void + */ + public function addConnection($name, ConnectionInterface $connection) + { + $this->connections[$name] = $connection; + } + + /** + * Check if a connection has been registered. + * + * @param string $name + * @return bool + */ + public function hasConnection($name) + { + return isset($this->connections[$name]); + } + + /** + * Get the default connection name. + * + * @return string + */ + public function getDefaultConnection() + { + return $this->default; + } + + /** + * Set the default connection name. + * + * @param string $name + * @return void + */ + public function setDefaultConnection($name) + { + $this->default = $name; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/ConnectionResolverInterface.php b/vendor/laravel/framework/src/Illuminate/Database/ConnectionResolverInterface.php new file mode 100755 index 0000000..eb0397a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/ConnectionResolverInterface.php @@ -0,0 +1,29 @@ +container = $container; + } + + /** + * Establish a PDO connection based on the configuration. + * + * @param array $config + * @param string $name + * @return \Illuminate\Database\Connection + */ + public function make(array $config, $name = null) + { + $config = $this->parseConfig($config, $name); + + if (isset($config['read'])) { + return $this->createReadWriteConnection($config); + } + + return $this->createSingleConnection($config); + } + + /** + * Parse and prepare the database configuration. + * + * @param array $config + * @param string $name + * @return array + */ + protected function parseConfig(array $config, $name) + { + return Arr::add(Arr::add($config, 'prefix', ''), 'name', $name); + } + + /** + * Create a single database connection instance. + * + * @param array $config + * @return \Illuminate\Database\Connection + */ + protected function createSingleConnection(array $config) + { + $pdo = $this->createPdoResolver($config); + + return $this->createConnection( + $config['driver'], $pdo, $config['database'], $config['prefix'], $config + ); + } + + /** + * Create a single database connection instance. + * + * @param array $config + * @return \Illuminate\Database\Connection + */ + protected function createReadWriteConnection(array $config) + { + $connection = $this->createSingleConnection($this->getWriteConfig($config)); + + return $connection->setReadPdo($this->createReadPdo($config)); + } + + /** + * Create a new PDO instance for reading. + * + * @param array $config + * @return \Closure + */ + protected function createReadPdo(array $config) + { + return $this->createPdoResolver($this->getReadConfig($config)); + } + + /** + * Get the read configuration for a read / write connection. + * + * @param array $config + * @return array + */ + protected function getReadConfig(array $config) + { + return $this->mergeReadWriteConfig( + $config, $this->getReadWriteConfig($config, 'read') + ); + } + + /** + * Get the read configuration for a read / write connection. + * + * @param array $config + * @return array + */ + protected function getWriteConfig(array $config) + { + return $this->mergeReadWriteConfig( + $config, $this->getReadWriteConfig($config, 'write') + ); + } + + /** + * Get a read / write level configuration. + * + * @param array $config + * @param string $type + * @return array + */ + protected function getReadWriteConfig(array $config, $type) + { + return isset($config[$type][0]) + ? Arr::random($config[$type]) + : $config[$type]; + } + + /** + * Merge a configuration for a read / write connection. + * + * @param array $config + * @param array $merge + * @return array + */ + protected function mergeReadWriteConfig(array $config, array $merge) + { + return Arr::except(array_merge($config, $merge), ['read', 'write']); + } + + /** + * Create a new Closure that resolves to a PDO instance. + * + * @param array $config + * @return \Closure + */ + protected function createPdoResolver(array $config) + { + return array_key_exists('host', $config) + ? $this->createPdoResolverWithHosts($config) + : $this->createPdoResolverWithoutHosts($config); + } + + /** + * Create a new Closure that resolves to a PDO instance with a specific host or an array of hosts. + * + * @param array $config + * @return \Closure + */ + protected function createPdoResolverWithHosts(array $config) + { + return function () use ($config) { + foreach (Arr::shuffle($hosts = $this->parseHosts($config)) as $key => $host) { + $config['host'] = $host; + + try { + return $this->createConnector($config)->connect($config); + } catch (PDOException $e) { + continue; + } + } + + throw $e; + }; + } + + /** + * Parse the hosts configuration item into an array. + * + * @param array $config + * @return array + */ + protected function parseHosts(array $config) + { + $hosts = Arr::wrap($config['host']); + + if (empty($hosts)) { + throw new InvalidArgumentException('Database hosts array is empty.'); + } + + return $hosts; + } + + /** + * Create a new Closure that resolves to a PDO instance where there is no configured host. + * + * @param array $config + * @return \Closure + */ + protected function createPdoResolverWithoutHosts(array $config) + { + return function () use ($config) { + return $this->createConnector($config)->connect($config); + }; + } + + /** + * Create a connector instance based on the configuration. + * + * @param array $config + * @return \Illuminate\Database\Connectors\ConnectorInterface + * + * @throws \InvalidArgumentException + */ + public function createConnector(array $config) + { + if (! isset($config['driver'])) { + throw new InvalidArgumentException('A driver must be specified.'); + } + + if ($this->container->bound($key = "db.connector.{$config['driver']}")) { + return $this->container->make($key); + } + + switch ($config['driver']) { + case 'mysql': + return new MySqlConnector; + case 'pgsql': + return new PostgresConnector; + case 'sqlite': + return new SQLiteConnector; + case 'sqlsrv': + return new SqlServerConnector; + } + + throw new InvalidArgumentException("Unsupported driver [{$config['driver']}]"); + } + + /** + * Create a new connection instance. + * + * @param string $driver + * @param \PDO|\Closure $connection + * @param string $database + * @param string $prefix + * @param array $config + * @return \Illuminate\Database\Connection + * + * @throws \InvalidArgumentException + */ + protected function createConnection($driver, $connection, $database, $prefix = '', array $config = []) + { + if ($resolver = Connection::getResolver($driver)) { + return $resolver($connection, $database, $prefix, $config); + } + + switch ($driver) { + case 'mysql': + return new MySqlConnection($connection, $database, $prefix, $config); + case 'pgsql': + return new PostgresConnection($connection, $database, $prefix, $config); + case 'sqlite': + return new SQLiteConnection($connection, $database, $prefix, $config); + case 'sqlsrv': + return new SqlServerConnection($connection, $database, $prefix, $config); + } + + throw new InvalidArgumentException("Unsupported driver [{$driver}]"); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php b/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php new file mode 100755 index 0000000..ab0903d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php @@ -0,0 +1,139 @@ + PDO::CASE_NATURAL, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, + PDO::ATTR_STRINGIFY_FETCHES => false, + PDO::ATTR_EMULATE_PREPARES => false, + ]; + + /** + * Create a new PDO connection. + * + * @param string $dsn + * @param array $config + * @param array $options + * @return \PDO + * + * @throws \Exception + */ + public function createConnection($dsn, array $config, array $options) + { + [$username, $password] = [ + $config['username'] ?? null, $config['password'] ?? null, + ]; + + try { + return $this->createPdoConnection( + $dsn, $username, $password, $options + ); + } catch (Exception $e) { + return $this->tryAgainIfCausedByLostConnection( + $e, $dsn, $username, $password, $options + ); + } + } + + /** + * Create a new PDO connection instance. + * + * @param string $dsn + * @param string $username + * @param string $password + * @param array $options + * @return \PDO + */ + protected function createPdoConnection($dsn, $username, $password, $options) + { + if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) { + return new PDOConnection($dsn, $username, $password, $options); + } + + return new PDO($dsn, $username, $password, $options); + } + + /** + * Determine if the connection is persistent. + * + * @param array $options + * @return bool + */ + protected function isPersistentConnection($options) + { + return isset($options[PDO::ATTR_PERSISTENT]) && + $options[PDO::ATTR_PERSISTENT]; + } + + /** + * Handle an exception that occurred during connect execution. + * + * @param \Throwable $e + * @param string $dsn + * @param string $username + * @param string $password + * @param array $options + * @return \PDO + * + * @throws \Exception + */ + protected function tryAgainIfCausedByLostConnection(Throwable $e, $dsn, $username, $password, $options) + { + if ($this->causedByLostConnection($e)) { + return $this->createPdoConnection($dsn, $username, $password, $options); + } + + throw $e; + } + + /** + * Get the PDO options based on the configuration. + * + * @param array $config + * @return array + */ + public function getOptions(array $config) + { + $options = $config['options'] ?? []; + + return array_diff_key($this->options, $options) + $options; + } + + /** + * Get the default PDO connection options. + * + * @return array + */ + public function getDefaultOptions() + { + return $this->options; + } + + /** + * Set the default PDO connection options. + * + * @param array $options + * @return void + */ + public function setDefaultOptions(array $options) + { + $this->options = $options; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectorInterface.php b/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectorInterface.php new file mode 100755 index 0000000..08597ac --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectorInterface.php @@ -0,0 +1,14 @@ +getDsn($config); + + $options = $this->getOptions($config); + + // We need to grab the PDO options that should be used while making the brand + // new connection instance. The PDO options control various aspects of the + // connection's behavior, and some might be specified by the developers. + $connection = $this->createConnection($dsn, $config, $options); + + if (! empty($config['database'])) { + $connection->exec("use `{$config['database']}`;"); + } + + $this->configureEncoding($connection, $config); + + // Next, we will check to see if a timezone has been specified in this config + // and if it has we will issue a statement to modify the timezone with the + // database. Setting this DB timezone is an optional configuration item. + $this->configureTimezone($connection, $config); + + $this->setModes($connection, $config); + + return $connection; + } + + /** + * Set the connection character set and collation. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function configureEncoding($connection, array $config) + { + if (! isset($config['charset'])) { + return $connection; + } + + $connection->prepare( + "set names '{$config['charset']}'".$this->getCollation($config) + )->execute(); + } + + /** + * Get the collation for the configuration. + * + * @param array $config + * @return string + */ + protected function getCollation(array $config) + { + return isset($config['collation']) ? " collate '{$config['collation']}'" : ''; + } + + /** + * Set the timezone on the connection. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function configureTimezone($connection, array $config) + { + if (isset($config['timezone'])) { + $connection->prepare('set time_zone="'.$config['timezone'].'"')->execute(); + } + } + + /** + * Create a DSN string from a configuration. + * + * Chooses socket or host/port based on the 'unix_socket' config value. + * + * @param array $config + * @return string + */ + protected function getDsn(array $config) + { + return $this->hasSocket($config) + ? $this->getSocketDsn($config) + : $this->getHostDsn($config); + } + + /** + * Determine if the given configuration array has a UNIX socket value. + * + * @param array $config + * @return bool + */ + protected function hasSocket(array $config) + { + return isset($config['unix_socket']) && ! empty($config['unix_socket']); + } + + /** + * Get the DSN string for a socket configuration. + * + * @param array $config + * @return string + */ + protected function getSocketDsn(array $config) + { + return "mysql:unix_socket={$config['unix_socket']};dbname={$config['database']}"; + } + + /** + * Get the DSN string for a host / port configuration. + * + * @param array $config + * @return string + */ + protected function getHostDsn(array $config) + { + extract($config, EXTR_SKIP); + + return isset($port) + ? "mysql:host={$host};port={$port};dbname={$database}" + : "mysql:host={$host};dbname={$database}"; + } + + /** + * Set the modes for the connection. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function setModes(PDO $connection, array $config) + { + if (isset($config['modes'])) { + $this->setCustomModes($connection, $config); + } elseif (isset($config['strict'])) { + if ($config['strict']) { + $connection->prepare($this->strictMode($connection))->execute(); + } else { + $connection->prepare("set session sql_mode='NO_ENGINE_SUBSTITUTION'")->execute(); + } + } + } + + /** + * Set the custom modes on the connection. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function setCustomModes(PDO $connection, array $config) + { + $modes = implode(',', $config['modes']); + + $connection->prepare("set session sql_mode='{$modes}'")->execute(); + } + + /** + * Get the query to enable strict mode. + * + * @param \PDO $connection + * @return string + */ + protected function strictMode(PDO $connection) + { + if (version_compare($connection->getAttribute(PDO::ATTR_SERVER_VERSION), '8.0.11') >= 0) { + return "set session sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'"; + } + + return "set session sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'"; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Connectors/PostgresConnector.php b/vendor/laravel/framework/src/Illuminate/Database/Connectors/PostgresConnector.php new file mode 100755 index 0000000..c80fea6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Connectors/PostgresConnector.php @@ -0,0 +1,176 @@ + PDO::CASE_NATURAL, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, + PDO::ATTR_STRINGIFY_FETCHES => false, + ]; + + /** + * Establish a database connection. + * + * @param array $config + * @return \PDO + */ + public function connect(array $config) + { + // First we'll create the basic DSN and connection instance connecting to the + // using the configuration option specified by the developer. We will also + // set the default character set on the connections to UTF-8 by default. + $connection = $this->createConnection( + $this->getDsn($config), $config, $this->getOptions($config) + ); + + $this->configureEncoding($connection, $config); + + // Next, we will check to see if a timezone has been specified in this config + // and if it has we will issue a statement to modify the timezone with the + // database. Setting this DB timezone is an optional configuration item. + $this->configureTimezone($connection, $config); + + $this->configureSchema($connection, $config); + + // Postgres allows an application_name to be set by the user and this name is + // used to when monitoring the application with pg_stat_activity. So we'll + // determine if the option has been specified and run a statement if so. + $this->configureApplicationName($connection, $config); + + return $connection; + } + + /** + * Set the connection character set and collation. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function configureEncoding($connection, $config) + { + if (! isset($config['charset'])) { + return; + } + + $connection->prepare("set names '{$config['charset']}'")->execute(); + } + + /** + * Set the timezone on the connection. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function configureTimezone($connection, array $config) + { + if (isset($config['timezone'])) { + $timezone = $config['timezone']; + + $connection->prepare("set time zone '{$timezone}'")->execute(); + } + } + + /** + * Set the schema on the connection. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function configureSchema($connection, $config) + { + if (isset($config['schema'])) { + $schema = $this->formatSchema($config['schema']); + + $connection->prepare("set search_path to {$schema}")->execute(); + } + } + + /** + * Format the schema for the DSN. + * + * @param array|string $schema + * @return string + */ + protected function formatSchema($schema) + { + if (is_array($schema)) { + return '"'.implode('", "', $schema).'"'; + } + + return '"'.$schema.'"'; + } + + /** + * Set the schema on the connection. + * + * @param \PDO $connection + * @param array $config + * @return void + */ + protected function configureApplicationName($connection, $config) + { + if (isset($config['application_name'])) { + $applicationName = $config['application_name']; + + $connection->prepare("set application_name to '$applicationName'")->execute(); + } + } + + /** + * Create a DSN string from a configuration. + * + * @param array $config + * @return string + */ + protected function getDsn(array $config) + { + // First we will create the basic DSN setup as well as the port if it is in + // in the configuration options. This will give us the basic DSN we will + // need to establish the PDO connections and return them back for use. + extract($config, EXTR_SKIP); + + $host = isset($host) ? "host={$host};" : ''; + + $dsn = "pgsql:{$host}dbname={$database}"; + + // If a port was specified, we will add it to this Postgres DSN connections + // format. Once we have done that we are ready to return this connection + // string back out for usage, as this has been fully constructed here. + if (isset($config['port'])) { + $dsn .= ";port={$port}"; + } + + return $this->addSslOptions($dsn, $config); + } + + /** + * Add the SSL options to the DSN. + * + * @param string $dsn + * @param array $config + * @return string + */ + protected function addSslOptions($dsn, array $config) + { + foreach (['sslmode', 'sslcert', 'sslkey', 'sslrootcert'] as $option) { + if (isset($config[$option])) { + $dsn .= ";{$option}={$config[$option]}"; + } + } + + return $dsn; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Connectors/SQLiteConnector.php b/vendor/laravel/framework/src/Illuminate/Database/Connectors/SQLiteConnector.php new file mode 100755 index 0000000..90dc16b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Connectors/SQLiteConnector.php @@ -0,0 +1,39 @@ +getOptions($config); + + // SQLite supports "in-memory" databases that only last as long as the owning + // connection does. These are useful for tests or for short lifetime store + // querying. In-memory databases may only have a single open connection. + if ($config['database'] === ':memory:') { + return $this->createConnection('sqlite::memory:', $config, $options); + } + + $path = realpath($config['database']); + + // Here we'll verify that the SQLite database exists before going any further + // as the developer probably wants to know if the database exists and this + // SQLite driver will not throw any exception if it does not by default. + if ($path === false) { + throw new InvalidArgumentException("Database ({$config['database']}) does not exist."); + } + + return $this->createConnection("sqlite:{$path}", $config, $options); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Connectors/SqlServerConnector.php b/vendor/laravel/framework/src/Illuminate/Database/Connectors/SqlServerConnector.php new file mode 100755 index 0000000..6cfc33f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Connectors/SqlServerConnector.php @@ -0,0 +1,185 @@ + PDO::CASE_NATURAL, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, + PDO::ATTR_STRINGIFY_FETCHES => false, + ]; + + /** + * Establish a database connection. + * + * @param array $config + * @return \PDO + */ + public function connect(array $config) + { + $options = $this->getOptions($config); + + return $this->createConnection($this->getDsn($config), $config, $options); + } + + /** + * Create a DSN string from a configuration. + * + * @param array $config + * @return string + */ + protected function getDsn(array $config) + { + // First we will create the basic DSN setup as well as the port if it is in + // in the configuration options. This will give us the basic DSN we will + // need to establish the PDO connections and return them back for use. + if ($this->prefersOdbc($config)) { + return $this->getOdbcDsn($config); + } + + if (in_array('sqlsrv', $this->getAvailableDrivers())) { + return $this->getSqlSrvDsn($config); + } else { + return $this->getDblibDsn($config); + } + } + + /** + * Determine if the database configuration prefers ODBC. + * + * @param array $config + * @return bool + */ + protected function prefersOdbc(array $config) + { + return in_array('odbc', $this->getAvailableDrivers()) && + ($config['odbc'] ?? null) === true; + } + + /** + * Get the DSN string for a DbLib connection. + * + * @param array $config + * @return string + */ + protected function getDblibDsn(array $config) + { + return $this->buildConnectString('dblib', array_merge([ + 'host' => $this->buildHostString($config, ':'), + 'dbname' => $config['database'], + ], Arr::only($config, ['appname', 'charset', 'version']))); + } + + /** + * Get the DSN string for an ODBC connection. + * + * @param array $config + * @return string + */ + protected function getOdbcDsn(array $config) + { + return isset($config['odbc_datasource_name']) + ? 'odbc:'.$config['odbc_datasource_name'] : ''; + } + + /** + * Get the DSN string for a SqlSrv connection. + * + * @param array $config + * @return string + */ + protected function getSqlSrvDsn(array $config) + { + $arguments = [ + 'Server' => $this->buildHostString($config, ','), + ]; + + if (isset($config['database'])) { + $arguments['Database'] = $config['database']; + } + + if (isset($config['readonly'])) { + $arguments['ApplicationIntent'] = 'ReadOnly'; + } + + if (isset($config['pooling']) && $config['pooling'] === false) { + $arguments['ConnectionPooling'] = '0'; + } + + if (isset($config['appname'])) { + $arguments['APP'] = $config['appname']; + } + + if (isset($config['encrypt'])) { + $arguments['Encrypt'] = $config['encrypt']; + } + + if (isset($config['trust_server_certificate'])) { + $arguments['TrustServerCertificate'] = $config['trust_server_certificate']; + } + + if (isset($config['multiple_active_result_sets']) && $config['multiple_active_result_sets'] === false) { + $arguments['MultipleActiveResultSets'] = 'false'; + } + + if (isset($config['transaction_isolation'])) { + $arguments['TransactionIsolation'] = $config['transaction_isolation']; + } + + if (isset($config['multi_subnet_failover'])) { + $arguments['MultiSubnetFailover'] = $config['multi_subnet_failover']; + } + + return $this->buildConnectString('sqlsrv', $arguments); + } + + /** + * Build a connection string from the given arguments. + * + * @param string $driver + * @param array $arguments + * @return string + */ + protected function buildConnectString($driver, array $arguments) + { + return $driver.':'.implode(';', array_map(function ($key) use ($arguments) { + return sprintf('%s=%s', $key, $arguments[$key]); + }, array_keys($arguments))); + } + + /** + * Build a host string from the given configuration. + * + * @param array $config + * @param string $separator + * @return string + */ + protected function buildHostString(array $config, $separator) + { + if (isset($config['port']) && ! empty($config['port'])) { + return $config['host'].$separator.$config['port']; + } else { + return $config['host']; + } + } + + /** + * Get the available PDO drivers. + * + * @return array + */ + protected function getAvailableDrivers() + { + return PDO::getAvailableDrivers(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Factories/FactoryMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Factories/FactoryMakeCommand.php new file mode 100644 index 0000000..8634159 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Factories/FactoryMakeCommand.php @@ -0,0 +1,84 @@ +option('model') + ? $this->qualifyClass($this->option('model')) + : 'Model'; + + return str_replace( + 'DummyModel', $model, parent::buildClass($name) + ); + } + + /** + * Get the destination class path. + * + * @param string $name + * @return string + */ + protected function getPath($name) + { + $name = str_replace( + ['\\', '/'], '', $this->argument('name') + ); + + return $this->laravel->databasePath()."/factories/{$name}.php"; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['model', 'm', InputOption::VALUE_OPTIONAL, 'The name of the model'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Factories/stubs/factory.stub b/vendor/laravel/framework/src/Illuminate/Database/Console/Factories/stubs/factory.stub new file mode 100644 index 0000000..9e3f90b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Factories/stubs/factory.stub @@ -0,0 +1,9 @@ +define(DummyModel::class, function (Faker $faker) { + return [ + // + ]; +}); diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/BaseCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/BaseCommand.php new file mode 100755 index 0000000..6c4f255 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/BaseCommand.php @@ -0,0 +1,51 @@ +input->hasOption('path') && $this->option('path')) { + return collect($this->option('path'))->map(function ($path) { + return ! $this->usingRealPath() + ? $this->laravel->basePath().'/'.$path + : $path; + })->all(); + } + + return array_merge( + $this->migrator->paths(), [$this->getMigrationPath()] + ); + } + + /** + * Determine if the given path(s) are pre-resolved "real" paths. + * + * @return bool + */ + protected function usingRealPath() + { + return $this->input->hasOption('realpath') && $this->option('realpath'); + } + + /** + * Get the path to the migration directory. + * + * @return string + */ + protected function getMigrationPath() + { + return $this->laravel->databasePath().DIRECTORY_SEPARATOR.'migrations'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/FreshCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/FreshCommand.php new file mode 100644 index 0000000..83b6306 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/FreshCommand.php @@ -0,0 +1,139 @@ +confirmToProceed()) { + return; + } + + $database = $this->input->getOption('database'); + + if ($this->option('drop-views')) { + $this->dropAllViews($database); + + $this->info('Dropped all views successfully.'); + } + + $this->dropAllTables($database); + + $this->info('Dropped all tables successfully.'); + + $this->call('migrate', [ + '--database' => $database, + '--path' => $this->input->getOption('path'), + '--realpath' => $this->input->getOption('realpath'), + '--force' => true, + '--step' => $this->option('step'), + ]); + + if ($this->needsSeeding()) { + $this->runSeeder($database); + } + } + + /** + * Drop all of the database tables. + * + * @param string $database + * @return void + */ + protected function dropAllTables($database) + { + $this->laravel['db']->connection($database) + ->getSchemaBuilder() + ->dropAllTables(); + } + + /** + * Drop all of the database views. + * + * @param string $database + * @return void + */ + protected function dropAllViews($database) + { + $this->laravel['db']->connection($database) + ->getSchemaBuilder() + ->dropAllViews(); + } + + /** + * Determine if the developer has requested database seeding. + * + * @return bool + */ + protected function needsSeeding() + { + return $this->option('seed') || $this->option('seeder'); + } + + /** + * Run the database seeder command. + * + * @param string $database + * @return void + */ + protected function runSeeder($database) + { + $this->call('db:seed', [ + '--database' => $database, + '--class' => $this->option('seeder') ?: 'DatabaseSeeder', + '--force' => $this->option('force'), + ]); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + + ['drop-views', null, InputOption::VALUE_NONE, 'Drop all tables and views'], + + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], + + ['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to be executed'], + + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], + + ['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run'], + + ['seeder', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder'], + + ['step', null, InputOption::VALUE_NONE, 'Force the migrations to be run so they can be rolled back individually'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/InstallCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/InstallCommand.php new file mode 100755 index 0000000..354d7a1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/InstallCommand.php @@ -0,0 +1,70 @@ +repository = $repository; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->repository->setSource($this->input->getOption('database')); + + $this->repository->createRepository(); + + $this->info('Migration table created successfully.'); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php new file mode 100755 index 0000000..79d4814 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php @@ -0,0 +1,97 @@ +migrator = $migrator; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + if (! $this->confirmToProceed()) { + return; + } + + $this->prepareDatabase(); + + // Next, we will check to see if a path option has been defined. If it has + // we will use the path relative to the root of this installation folder + // so that migrations may be run for any path within the applications. + $this->migrator->setOutput($this->output) + ->run($this->getMigrationPaths(), [ + 'pretend' => $this->option('pretend'), + 'step' => $this->option('step'), + ]); + + // Finally, if the "seed" option has been given, we will re-run the database + // seed task to re-populate the database, which is convenient when adding + // a migration and a seed at the same time, as it is only this command. + if ($this->option('seed')) { + $this->call('db:seed', ['--force' => true]); + } + } + + /** + * Prepare the migration database for running. + * + * @return void + */ + protected function prepareDatabase() + { + $this->migrator->setConnection($this->option('database')); + + if (! $this->migrator->repositoryExists()) { + $this->call( + 'migrate:install', ['--database' => $this->option('database')] + ); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php new file mode 100644 index 0000000..1cce57b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php @@ -0,0 +1,140 @@ +creator = $creator; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + // It's possible for the developer to specify the tables to modify in this + // schema operation. The developer may also specify if this table needs + // to be freshly created so we can create the appropriate migrations. + $name = Str::snake(trim($this->input->getArgument('name'))); + + $table = $this->input->getOption('table'); + + $create = $this->input->getOption('create') ?: false; + + // If no table was given as an option but a create option is given then we + // will use the "create" option as the table name. This allows the devs + // to pass a table name into this option as a short-cut for creating. + if (! $table && is_string($create)) { + $table = $create; + + $create = true; + } + + // Next, we will attempt to guess the table name if this the migration has + // "create" in the name. This will allow us to provide a convenient way + // of creating migrations that create new tables for the application. + if (! $table) { + [$table, $create] = TableGuesser::guess($name); + } + + // Now we are ready to write the migration out to disk. Once we've written + // the migration out, we will dump-autoload for the entire framework to + // make sure that the migrations are registered by the class loaders. + $this->writeMigration($name, $table, $create); + + $this->composer->dumpAutoloads(); + } + + /** + * Write the migration file to disk. + * + * @param string $name + * @param string $table + * @param bool $create + * @return string + */ + protected function writeMigration($name, $table, $create) + { + $file = pathinfo($this->creator->create( + $name, $this->getMigrationPath(), $table, $create + ), PATHINFO_FILENAME); + + $this->line("Created Migration: {$file}"); + } + + /** + * Get migration path (either specified by '--path' option or default location). + * + * @return string + */ + protected function getMigrationPath() + { + if (! is_null($targetPath = $this->input->getOption('path'))) { + return ! $this->usingRealPath() + ? $this->laravel->basePath().'/'.$targetPath + : $targetPath; + } + + return parent::getMigrationPath(); + } + + /** + * Determine if the given path(s) are pre-resolved "real" paths. + * + * @return bool + */ + protected function usingRealPath() + { + return $this->input->hasOption('realpath') && $this->option('realpath'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RefreshCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RefreshCommand.php new file mode 100755 index 0000000..0a03e5b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RefreshCommand.php @@ -0,0 +1,159 @@ +confirmToProceed()) { + return; + } + + // Next we'll gather some of the options so that we can have the right options + // to pass to the commands. This includes options such as which database to + // use and the path to use for the migration. Then we'll run the command. + $database = $this->input->getOption('database'); + + $path = $this->input->getOption('path'); + + $force = $this->input->getOption('force'); + + // If the "step" option is specified it means we only want to rollback a small + // number of migrations before migrating again. For example, the user might + // only rollback and remigrate the latest four migrations instead of all. + $step = $this->input->getOption('step') ?: 0; + + if ($step > 0) { + $this->runRollback($database, $path, $step, $force); + } else { + $this->runReset($database, $path, $force); + } + + // The refresh command is essentially just a brief aggregate of a few other of + // the migration commands and just provides a convenient wrapper to execute + // them in succession. We'll also see if we need to re-seed the database. + $this->call('migrate', [ + '--database' => $database, + '--path' => $path, + '--realpath' => $this->input->getOption('realpath'), + '--force' => $force, + ]); + + if ($this->needsSeeding()) { + $this->runSeeder($database); + } + } + + /** + * Run the rollback command. + * + * @param string $database + * @param string $path + * @param bool $step + * @param bool $force + * @return void + */ + protected function runRollback($database, $path, $step, $force) + { + $this->call('migrate:rollback', [ + '--database' => $database, + '--path' => $path, + '--realpath' => $this->input->getOption('realpath'), + '--step' => $step, + '--force' => $force, + ]); + } + + /** + * Run the reset command. + * + * @param string $database + * @param string $path + * @param bool $force + * @return void + */ + protected function runReset($database, $path, $force) + { + $this->call('migrate:reset', [ + '--database' => $database, + '--path' => $path, + '--realpath' => $this->input->getOption('realpath'), + '--force' => $force, + ]); + } + + /** + * Determine if the developer has requested database seeding. + * + * @return bool + */ + protected function needsSeeding() + { + return $this->option('seed') || $this->option('seeder'); + } + + /** + * Run the database seeder command. + * + * @param string $database + * @return void + */ + protected function runSeeder($database) + { + $this->call('db:seed', [ + '--database' => $database, + '--class' => $this->option('seeder') ?: 'DatabaseSeeder', + '--force' => $this->option('force'), + ]); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], + + ['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to be executed'], + + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], + + ['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run'], + + ['seeder', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder'], + + ['step', null, InputOption::VALUE_OPTIONAL, 'The number of migrations to be reverted & re-run'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php new file mode 100755 index 0000000..2880380 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php @@ -0,0 +1,91 @@ +migrator = $migrator; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + if (! $this->confirmToProceed()) { + return; + } + + $this->migrator->setConnection($this->option('database')); + + // First, we'll make sure that the migration table actually exists before we + // start trying to rollback and re-run all of the migrations. If it's not + // present we'll just bail out with an info message for the developers. + if (! $this->migrator->repositoryExists()) { + return $this->comment('Migration table not found.'); + } + + $this->migrator->setOutput($this->output)->reset( + $this->getMigrationPaths(), $this->option('pretend') + ); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], + + ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed'], + + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], + + ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RollbackCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RollbackCommand.php new file mode 100755 index 0000000..457bcb1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RollbackCommand.php @@ -0,0 +1,89 @@ +migrator = $migrator; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + if (! $this->confirmToProceed()) { + return; + } + + $this->migrator->setConnection($this->option('database')); + + $this->migrator->setOutput($this->output)->rollback( + $this->getMigrationPaths(), [ + 'pretend' => $this->option('pretend'), + 'step' => (int) $this->option('step'), + ] + ); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], + + ['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to be executed'], + + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], + + ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run'], + + ['step', null, InputOption::VALUE_OPTIONAL, 'The number of migrations to be reverted'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/StatusCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/StatusCommand.php new file mode 100644 index 0000000..520f6c7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/StatusCommand.php @@ -0,0 +1,113 @@ +migrator = $migrator; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->migrator->setConnection($this->option('database')); + + if (! $this->migrator->repositoryExists()) { + return $this->error('No migrations found.'); + } + + $ran = $this->migrator->getRepository()->getRan(); + + $batches = $this->migrator->getRepository()->getMigrationBatches(); + + if (count($migrations = $this->getStatusFor($ran, $batches)) > 0) { + $this->table(['Ran?', 'Migration', 'Batch'], $migrations); + } else { + $this->error('No migrations found'); + } + } + + /** + * Get the status for the given ran migrations. + * + * @param array $ran + * @param array $batches + * @return \Illuminate\Support\Collection + */ + protected function getStatusFor(array $ran, array $batches) + { + return Collection::make($this->getAllMigrationFiles()) + ->map(function ($migration) use ($ran, $batches) { + $migrationName = $this->migrator->getMigrationName($migration); + + return in_array($migrationName, $ran) + ? ['Yes', $migrationName, $batches[$migrationName]] + : ['No', $migrationName]; + }); + } + + /** + * Get an array of all of the migration files. + * + * @return array + */ + protected function getAllMigrationFiles() + { + return $this->migrator->getMigrationFiles($this->getMigrationPaths()); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'], + + ['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to use'], + + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/TableGuesser.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/TableGuesser.php new file mode 100644 index 0000000..82dfbdd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/TableGuesser.php @@ -0,0 +1,37 @@ +resolver = $resolver; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + if (! $this->confirmToProceed()) { + return; + } + + $this->resolver->setDefaultConnection($this->getDatabase()); + + Model::unguarded(function () { + $this->getSeeder()->__invoke(); + }); + + $this->info('Database seeding completed successfully.'); + } + + /** + * Get a seeder instance from the container. + * + * @return \Illuminate\Database\Seeder + */ + protected function getSeeder() + { + $class = $this->laravel->make($this->input->getOption('class')); + + return $class->setContainer($this->laravel)->setCommand($this); + } + + /** + * Get the name of the database connection to use. + * + * @return string + */ + protected function getDatabase() + { + $database = $this->input->getOption('database'); + + return $database ?: $this->laravel['config']['database.default']; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['class', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder', 'DatabaseSeeder'], + + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to seed'], + + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php new file mode 100644 index 0000000..6e85e3e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php @@ -0,0 +1,96 @@ +composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + parent::handle(); + + $this->composer->dumpAutoloads(); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return __DIR__.'/stubs/seeder.stub'; + } + + /** + * Get the destination class path. + * + * @param string $name + * @return string + */ + protected function getPath($name) + { + return $this->laravel->databasePath().'/seeds/'.$name.'.php'; + } + + /** + * Parse the class name and format according to the root namespace. + * + * @param string $name + * @return string + */ + protected function qualifyClass($name) + { + return $name; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/stubs/seeder.stub b/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/stubs/seeder.stub new file mode 100644 index 0000000..4aa3845 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/stubs/seeder.stub @@ -0,0 +1,16 @@ +app = $app; + $this->factory = $factory; + } + + /** + * Get a database connection instance. + * + * @param string $name + * @return \Illuminate\Database\Connection + */ + public function connection($name = null) + { + [$database, $type] = $this->parseConnectionName($name); + + $name = $name ?: $database; + + // If we haven't created this connection, we'll create it based on the config + // provided in the application. Once we've created the connections we will + // set the "fetch mode" for PDO which determines the query return types. + if (! isset($this->connections[$name])) { + $this->connections[$name] = $this->configure( + $this->makeConnection($database), $type + ); + } + + return $this->connections[$name]; + } + + /** + * Parse the connection into an array of the name and read / write type. + * + * @param string $name + * @return array + */ + protected function parseConnectionName($name) + { + $name = $name ?: $this->getDefaultConnection(); + + return Str::endsWith($name, ['::read', '::write']) + ? explode('::', $name, 2) : [$name, null]; + } + + /** + * Make the database connection instance. + * + * @param string $name + * @return \Illuminate\Database\Connection + */ + protected function makeConnection($name) + { + $config = $this->configuration($name); + + // First we will check by the connection name to see if an extension has been + // registered specifically for that connection. If it has we will call the + // Closure and pass it the config allowing it to resolve the connection. + if (isset($this->extensions[$name])) { + return call_user_func($this->extensions[$name], $config, $name); + } + + // Next we will check to see if an extension has been registered for a driver + // and will call the Closure if so, which allows us to have a more generic + // resolver for the drivers themselves which applies to all connections. + if (isset($this->extensions[$driver = $config['driver']])) { + return call_user_func($this->extensions[$driver], $config, $name); + } + + return $this->factory->make($config, $name); + } + + /** + * Get the configuration for a connection. + * + * @param string $name + * @return array + * + * @throws \InvalidArgumentException + */ + protected function configuration($name) + { + $name = $name ?: $this->getDefaultConnection(); + + // To get the database connection configuration, we will just pull each of the + // connection configurations and get the configurations for the given name. + // If the configuration doesn't exist, we'll throw an exception and bail. + $connections = $this->app['config']['database.connections']; + + if (is_null($config = Arr::get($connections, $name))) { + throw new InvalidArgumentException("Database [{$name}] not configured."); + } + + return $config; + } + + /** + * Prepare the database connection instance. + * + * @param \Illuminate\Database\Connection $connection + * @param string $type + * @return \Illuminate\Database\Connection + */ + protected function configure(Connection $connection, $type) + { + $connection = $this->setPdoForType($connection, $type); + + // First we'll set the fetch mode and a few other dependencies of the database + // connection. This method basically just configures and prepares it to get + // used by the application. Once we're finished we'll return it back out. + if ($this->app->bound('events')) { + $connection->setEventDispatcher($this->app['events']); + } + + // Here we'll set a reconnector callback. This reconnector can be any callable + // so we will set a Closure to reconnect from this manager with the name of + // the connection, which will allow us to reconnect from the connections. + $connection->setReconnector(function ($connection) { + $this->reconnect($connection->getName()); + }); + + return $connection; + } + + /** + * Prepare the read / write mode for database connection instance. + * + * @param \Illuminate\Database\Connection $connection + * @param string $type + * @return \Illuminate\Database\Connection + */ + protected function setPdoForType(Connection $connection, $type = null) + { + if ($type === 'read') { + $connection->setPdo($connection->getReadPdo()); + } elseif ($type === 'write') { + $connection->setReadPdo($connection->getPdo()); + } + + return $connection; + } + + /** + * Disconnect from the given database and remove from local cache. + * + * @param string $name + * @return void + */ + public function purge($name = null) + { + $name = $name ?: $this->getDefaultConnection(); + + $this->disconnect($name); + + unset($this->connections[$name]); + } + + /** + * Disconnect from the given database. + * + * @param string $name + * @return void + */ + public function disconnect($name = null) + { + if (isset($this->connections[$name = $name ?: $this->getDefaultConnection()])) { + $this->connections[$name]->disconnect(); + } + } + + /** + * Reconnect to the given database. + * + * @param string $name + * @return \Illuminate\Database\Connection + */ + public function reconnect($name = null) + { + $this->disconnect($name = $name ?: $this->getDefaultConnection()); + + if (! isset($this->connections[$name])) { + return $this->connection($name); + } + + return $this->refreshPdoConnections($name); + } + + /** + * Refresh the PDO connections on a given connection. + * + * @param string $name + * @return \Illuminate\Database\Connection + */ + protected function refreshPdoConnections($name) + { + $fresh = $this->makeConnection($name); + + return $this->connections[$name] + ->setPdo($fresh->getPdo()) + ->setReadPdo($fresh->getReadPdo()); + } + + /** + * Get the default connection name. + * + * @return string + */ + public function getDefaultConnection() + { + return $this->app['config']['database.default']; + } + + /** + * Set the default connection name. + * + * @param string $name + * @return void + */ + public function setDefaultConnection($name) + { + $this->app['config']['database.default'] = $name; + } + + /** + * Get all of the support drivers. + * + * @return array + */ + public function supportedDrivers() + { + return ['mysql', 'pgsql', 'sqlite', 'sqlsrv']; + } + + /** + * Get all of the drivers that are actually available. + * + * @return array + */ + public function availableDrivers() + { + return array_intersect( + $this->supportedDrivers(), + str_replace('dblib', 'sqlsrv', PDO::getAvailableDrivers()) + ); + } + + /** + * Register an extension connection resolver. + * + * @param string $name + * @param callable $resolver + * @return void + */ + public function extend($name, callable $resolver) + { + $this->extensions[$name] = $resolver; + } + + /** + * Return all of the created connections. + * + * @return array + */ + public function getConnections() + { + return $this->connections; + } + + /** + * Dynamically pass methods to the default connection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->connection()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php new file mode 100755 index 0000000..a8ee7b0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php @@ -0,0 +1,99 @@ +app['db']); + + Model::setEventDispatcher($this->app['events']); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + Model::clearBootedModels(); + + $this->registerConnectionServices(); + + $this->registerEloquentFactory(); + + $this->registerQueueableEntityResolver(); + } + + /** + * Register the primary database bindings. + * + * @return void + */ + protected function registerConnectionServices() + { + // The connection factory is used to create the actual connection instances on + // the database. We will inject the factory into the manager so that it may + // make the connections while they are actually needed and not of before. + $this->app->singleton('db.factory', function ($app) { + return new ConnectionFactory($app); + }); + + // The database manager is used to resolve various connections, since multiple + // connections might be managed. It also implements the connection resolver + // interface which may be used by other components requiring connections. + $this->app->singleton('db', function ($app) { + return new DatabaseManager($app, $app['db.factory']); + }); + + $this->app->bind('db.connection', function ($app) { + return $app['db']->connection(); + }); + } + + /** + * Register the Eloquent factory instance in the container. + * + * @return void + */ + protected function registerEloquentFactory() + { + $this->app->singleton(FakerGenerator::class, function ($app) { + return FakerFactory::create($app['config']->get('app.faker_locale', 'en_US')); + }); + + $this->app->singleton(EloquentFactory::class, function ($app) { + return EloquentFactory::construct( + $app->make(FakerGenerator::class), $this->app->databasePath('factories') + ); + }); + } + + /** + * Register the queueable entity resolver implementation. + * + * @return void + */ + protected function registerQueueableEntityResolver() + { + $this->app->singleton(EntityResolver::class, function () { + return new QueueEntityResolver; + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/DetectsDeadlocks.php b/vendor/laravel/framework/src/Illuminate/Database/DetectsDeadlocks.php new file mode 100644 index 0000000..a8193ee --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/DetectsDeadlocks.php @@ -0,0 +1,32 @@ +getMessage(); + + return Str::contains($message, [ + 'Deadlock found when trying to get lock', + 'deadlock detected', + 'The database file is locked', + 'database is locked', + 'database table is locked', + 'A table in the database is locked', + 'has been chosen as the deadlock victim', + 'Lock wait timeout exceeded; try restarting transaction', + 'WSREP detected deadlock/conflict and aborted the transaction. Try restarting the transaction', + ]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php b/vendor/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php new file mode 100644 index 0000000..b747d84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/DetectsLostConnections.php @@ -0,0 +1,42 @@ +getMessage(); + + return Str::contains($message, [ + 'server has gone away', + 'no connection to the server', + 'Lost connection', + 'is dead or not enabled', + 'Error while sending', + 'decryption failed or bad record mac', + 'server closed the connection unexpectedly', + 'SSL connection has been closed unexpectedly', + 'Error writing data to the connection', + 'Resource deadlock avoided', + 'Transaction() on null', + 'child connection forced to terminate due to client_idle_limit', + 'query_wait_timeout', + 'reset by peer', + 'Physical connection is not usable', + 'TCP Provider: Error code 0x68', + 'Name or service not known', + 'ORA-03114', + 'Packets out of order. Expected', + ]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php new file mode 100755 index 0000000..2d530a7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php @@ -0,0 +1,1363 @@ +query = $query; + } + + /** + * Create and return an un-saved model instance. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function make(array $attributes = []) + { + return $this->newModelInstance($attributes); + } + + /** + * Register a new global scope. + * + * @param string $identifier + * @param \Illuminate\Database\Eloquent\Scope|\Closure $scope + * @return $this + */ + public function withGlobalScope($identifier, $scope) + { + $this->scopes[$identifier] = $scope; + + if (method_exists($scope, 'extend')) { + $scope->extend($this); + } + + return $this; + } + + /** + * Remove a registered global scope. + * + * @param \Illuminate\Database\Eloquent\Scope|string $scope + * @return $this + */ + public function withoutGlobalScope($scope) + { + if (! is_string($scope)) { + $scope = get_class($scope); + } + + unset($this->scopes[$scope]); + + $this->removedScopes[] = $scope; + + return $this; + } + + /** + * Remove all or passed registered global scopes. + * + * @param array|null $scopes + * @return $this + */ + public function withoutGlobalScopes(array $scopes = null) + { + if (! is_array($scopes)) { + $scopes = array_keys($this->scopes); + } + + foreach ($scopes as $scope) { + $this->withoutGlobalScope($scope); + } + + return $this; + } + + /** + * Get an array of global scopes that were removed from the query. + * + * @return array + */ + public function removedScopes() + { + return $this->removedScopes; + } + + /** + * Add a where clause on the primary key to the query. + * + * @param mixed $id + * @return $this + */ + public function whereKey($id) + { + if (is_array($id) || $id instanceof Arrayable) { + $this->query->whereIn($this->model->getQualifiedKeyName(), $id); + + return $this; + } + + return $this->where($this->model->getQualifiedKeyName(), '=', $id); + } + + /** + * Add a where clause on the primary key to the query. + * + * @param mixed $id + * @return $this + */ + public function whereKeyNot($id) + { + if (is_array($id) || $id instanceof Arrayable) { + $this->query->whereNotIn($this->model->getQualifiedKeyName(), $id); + + return $this; + } + + return $this->where($this->model->getQualifiedKeyName(), '!=', $id); + } + + /** + * Add a basic where clause to the query. + * + * @param string|array|\Closure $column + * @param mixed $operator + * @param mixed $value + * @param string $boolean + * @return $this + */ + public function where($column, $operator = null, $value = null, $boolean = 'and') + { + if ($column instanceof Closure) { + $column($query = $this->model->newModelQuery()); + + $this->query->addNestedWhereQuery($query->getQuery(), $boolean); + } else { + $this->query->where(...func_get_args()); + } + + return $this; + } + + /** + * Add an "or where" clause to the query. + * + * @param \Closure|array|string $column + * @param mixed $operator + * @param mixed $value + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orWhere($column, $operator = null, $value = null) + { + [$value, $operator] = $this->query->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->where($column, $operator, $value, 'or'); + } + + /** + * Add an "order by" clause for a timestamp to the query. + * + * @param string $column + * @return $this + */ + public function latest($column = null) + { + if (is_null($column)) { + $column = $this->model->getCreatedAtColumn() ?? 'created_at'; + } + + $this->query->latest($column); + + return $this; + } + + /** + * Add an "order by" clause for a timestamp to the query. + * + * @param string $column + * @return $this + */ + public function oldest($column = null) + { + if (is_null($column)) { + $column = $this->model->getCreatedAtColumn() ?? 'created_at'; + } + + $this->query->oldest($column); + + return $this; + } + + /** + * Create a collection of models from plain arrays. + * + * @param array $items + * @return \Illuminate\Database\Eloquent\Collection + */ + public function hydrate(array $items) + { + $instance = $this->newModelInstance(); + + return $instance->newCollection(array_map(function ($item) use ($instance) { + return $instance->newFromBuilder($item); + }, $items)); + } + + /** + * Create a collection of models from a raw query. + * + * @param string $query + * @param array $bindings + * @return \Illuminate\Database\Eloquent\Collection + */ + public function fromQuery($query, $bindings = []) + { + return $this->hydrate( + $this->query->getConnection()->select($query, $bindings) + ); + } + + /** + * Find a model by its primary key. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static[]|static|null + */ + public function find($id, $columns = ['*']) + { + if (is_array($id) || $id instanceof Arrayable) { + return $this->findMany($id, $columns); + } + + return $this->whereKey($id)->first($columns); + } + + /** + * Find multiple models by their primary keys. + * + * @param \Illuminate\Contracts\Support\Arrayable|array $ids + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function findMany($ids, $columns = ['*']) + { + if (empty($ids)) { + return $this->model->newCollection(); + } + + return $this->whereKey($ids)->get($columns); + } + + /** + * Find a model by its primary key or throw an exception. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static|static[] + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function findOrFail($id, $columns = ['*']) + { + $result = $this->find($id, $columns); + + if (is_array($id)) { + if (count($result) === count(array_unique($id))) { + return $result; + } + } elseif (! is_null($result)) { + return $result; + } + + throw (new ModelNotFoundException)->setModel( + get_class($this->model), $id + ); + } + + /** + * Find a model by its primary key or return fresh model instance. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function findOrNew($id, $columns = ['*']) + { + if (! is_null($model = $this->find($id, $columns))) { + return $model; + } + + return $this->newModelInstance(); + } + + /** + * Get the first record matching the attributes or instantiate it. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function firstOrNew(array $attributes, array $values = []) + { + if (! is_null($instance = $this->where($attributes)->first())) { + return $instance; + } + + return $this->newModelInstance($attributes + $values); + } + + /** + * Get the first record matching the attributes or create it. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function firstOrCreate(array $attributes, array $values = []) + { + if (! is_null($instance = $this->where($attributes)->first())) { + return $instance; + } + + return tap($this->newModelInstance($attributes + $values), function ($instance) { + $instance->save(); + }); + } + + /** + * Create or update a record matching the attributes, and fill it with values. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function updateOrCreate(array $attributes, array $values = []) + { + return tap($this->firstOrNew($attributes), function ($instance) use ($values) { + $instance->fill($values)->save(); + }); + } + + /** + * Execute the query and get the first result or throw an exception. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|static + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function firstOrFail($columns = ['*']) + { + if (! is_null($model = $this->first($columns))) { + return $model; + } + + throw (new ModelNotFoundException)->setModel(get_class($this->model)); + } + + /** + * Execute the query and get the first result or call a callback. + * + * @param \Closure|array $columns + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Model|static|mixed + */ + public function firstOr($columns = ['*'], Closure $callback = null) + { + if ($columns instanceof Closure) { + $callback = $columns; + + $columns = ['*']; + } + + if (! is_null($model = $this->first($columns))) { + return $model; + } + + return call_user_func($callback); + } + + /** + * Get a single column's value from the first result of a query. + * + * @param string $column + * @return mixed + */ + public function value($column) + { + if ($result = $this->first([$column])) { + return $result->{$column}; + } + } + + /** + * Execute the query as a "select" statement. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection|static[] + */ + public function get($columns = ['*']) + { + $builder = $this->applyScopes(); + + // If we actually found models we will also eager load any relationships that + // have been specified as needing to be eager loaded, which will solve the + // n+1 query issue for the developers to avoid running a lot of queries. + if (count($models = $builder->getModels($columns)) > 0) { + $models = $builder->eagerLoadRelations($models); + } + + return $builder->getModel()->newCollection($models); + } + + /** + * Get the hydrated models without eager loading. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model[]|static[] + */ + public function getModels($columns = ['*']) + { + return $this->model->hydrate( + $this->query->get($columns)->all() + )->all(); + } + + /** + * Eager load the relationships for the models. + * + * @param array $models + * @return array + */ + public function eagerLoadRelations(array $models) + { + foreach ($this->eagerLoad as $name => $constraints) { + // For nested eager loads we'll skip loading them here and they will be set as an + // eager load on the query to retrieve the relation so that they will be eager + // loaded on that query, because that is where they get hydrated as models. + if (strpos($name, '.') === false) { + $models = $this->eagerLoadRelation($models, $name, $constraints); + } + } + + return $models; + } + + /** + * Eagerly load the relationship on a set of models. + * + * @param array $models + * @param string $name + * @param \Closure $constraints + * @return array + */ + protected function eagerLoadRelation(array $models, $name, Closure $constraints) + { + // First we will "back up" the existing where conditions on the query so we can + // add our eager constraints. Then we will merge the wheres that were on the + // query back to it in order that any where conditions might be specified. + $relation = $this->getRelation($name); + + $relation->addEagerConstraints($models); + + $constraints($relation); + + // Once we have the results, we just match those back up to their parent models + // using the relationship instance. Then we just return the finished arrays + // of models which have been eagerly hydrated and are readied for return. + return $relation->match( + $relation->initRelation($models, $name), + $relation->getEager(), $name + ); + } + + /** + * Get the relation instance for the given relation name. + * + * @param string $name + * @return \Illuminate\Database\Eloquent\Relations\Relation + */ + public function getRelation($name) + { + // We want to run a relationship query without any constrains so that we will + // not have to remove these where clauses manually which gets really hacky + // and error prone. We don't want constraints because we add eager ones. + $relation = Relation::noConstraints(function () use ($name) { + try { + return $this->getModel()->newInstance()->$name(); + } catch (BadMethodCallException $e) { + throw RelationNotFoundException::make($this->getModel(), $name); + } + }); + + $nested = $this->relationsNestedUnder($name); + + // If there are nested relationships set on the query, we will put those onto + // the query instances so that they can be handled after this relationship + // is loaded. In this way they will all trickle down as they are loaded. + if (count($nested) > 0) { + $relation->getQuery()->with($nested); + } + + return $relation; + } + + /** + * Get the deeply nested relations for a given top-level relation. + * + * @param string $relation + * @return array + */ + protected function relationsNestedUnder($relation) + { + $nested = []; + + // We are basically looking for any relationships that are nested deeper than + // the given top-level relationship. We will just check for any relations + // that start with the given top relations and adds them to our arrays. + foreach ($this->eagerLoad as $name => $constraints) { + if ($this->isNestedUnder($relation, $name)) { + $nested[substr($name, strlen($relation.'.'))] = $constraints; + } + } + + return $nested; + } + + /** + * Determine if the relationship is nested. + * + * @param string $relation + * @param string $name + * @return bool + */ + protected function isNestedUnder($relation, $name) + { + return Str::contains($name, '.') && Str::startsWith($name, $relation.'.'); + } + + /** + * Get a generator for the given query. + * + * @return \Generator + */ + public function cursor() + { + foreach ($this->applyScopes()->query->cursor() as $record) { + yield $this->model->newFromBuilder($record); + } + } + + /** + * Chunk the results of a query by comparing numeric IDs. + * + * @param int $count + * @param callable $callback + * @param string|null $column + * @param string|null $alias + * @return bool + */ + public function chunkById($count, callable $callback, $column = null, $alias = null) + { + $column = is_null($column) ? $this->getModel()->getKeyName() : $column; + + $alias = is_null($alias) ? $column : $alias; + + $lastId = null; + + do { + $clone = clone $this; + + // We'll execute the query for the given page and get the results. If there are + // no results we can just break and return from here. When there are results + // we will call the callback with the current chunk of these results here. + $results = $clone->forPageAfterId($count, $lastId, $column)->get(); + + $countResults = $results->count(); + + if ($countResults == 0) { + break; + } + + // On each chunk result set, we will pass them to the callback and then let the + // developer take care of everything within the callback, which allows us to + // keep the memory low for spinning through large result sets for working. + if ($callback($results) === false) { + return false; + } + + $lastId = $results->last()->{$alias}; + + unset($results); + } while ($countResults == $count); + + return true; + } + + /** + * Add a generic "order by" clause if the query doesn't already have one. + * + * @return void + */ + protected function enforceOrderBy() + { + if (empty($this->query->orders) && empty($this->query->unionOrders)) { + $this->orderBy($this->model->getQualifiedKeyName(), 'asc'); + } + } + + /** + * Get an array with the values of a given column. + * + * @param string $column + * @param string|null $key + * @return \Illuminate\Support\Collection + */ + public function pluck($column, $key = null) + { + $results = $this->toBase()->pluck($column, $key); + + // If the model has a mutator for the requested column, we will spin through + // the results and mutate the values so that the mutated version of these + // columns are returned as you would expect from these Eloquent models. + if (! $this->model->hasGetMutator($column) && + ! $this->model->hasCast($column) && + ! in_array($column, $this->model->getDates())) { + return $results; + } + + return $results->map(function ($value) use ($column) { + return $this->model->newFromBuilder([$column => $value])->{$column}; + }); + } + + /** + * Paginate the given query. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator + * + * @throws \InvalidArgumentException + */ + public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) + { + $page = $page ?: Paginator::resolveCurrentPage($pageName); + + $perPage = $perPage ?: $this->model->getPerPage(); + + $results = ($total = $this->toBase()->getCountForPagination()) + ? $this->forPage($page, $perPage)->get($columns) + : $this->model->newCollection(); + + return $this->paginator($results, $total, $perPage, $page, [ + 'path' => Paginator::resolveCurrentPath(), + 'pageName' => $pageName, + ]); + } + + /** + * Paginate the given query into a simple paginator. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\Paginator + */ + public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) + { + $page = $page ?: Paginator::resolveCurrentPage($pageName); + + $perPage = $perPage ?: $this->model->getPerPage(); + + // Next we will set the limit and offset for this query so that when we get the + // results we get the proper section of results. Then, we'll create the full + // paginator instances for these results with the given page and per page. + $this->skip(($page - 1) * $perPage)->take($perPage + 1); + + return $this->simplePaginator($this->get($columns), $perPage, $page, [ + 'path' => Paginator::resolveCurrentPath(), + 'pageName' => $pageName, + ]); + } + + /** + * Save a new model and return the instance. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model|$this + */ + public function create(array $attributes = []) + { + return tap($this->newModelInstance($attributes), function ($instance) { + $instance->save(); + }); + } + + /** + * Save a new model and return the instance. Allow mass-assignment. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model|$this + */ + public function forceCreate(array $attributes) + { + return $this->model->unguarded(function () use ($attributes) { + return $this->newModelInstance()->create($attributes); + }); + } + + /** + * Update a record in the database. + * + * @param array $values + * @return int + */ + public function update(array $values) + { + return $this->toBase()->update($this->addUpdatedAtColumn($values)); + } + + /** + * Increment a column's value by a given amount. + * + * @param string $column + * @param float|int $amount + * @param array $extra + * @return int + */ + public function increment($column, $amount = 1, array $extra = []) + { + return $this->toBase()->increment( + $column, $amount, $this->addUpdatedAtColumn($extra) + ); + } + + /** + * Decrement a column's value by a given amount. + * + * @param string $column + * @param float|int $amount + * @param array $extra + * @return int + */ + public function decrement($column, $amount = 1, array $extra = []) + { + return $this->toBase()->decrement( + $column, $amount, $this->addUpdatedAtColumn($extra) + ); + } + + /** + * Add the "updated at" column to an array of values. + * + * @param array $values + * @return array + */ + protected function addUpdatedAtColumn(array $values) + { + if (! $this->model->usesTimestamps()) { + return $values; + } + + return Arr::add( + $values, $this->model->getUpdatedAtColumn(), + $this->model->freshTimestampString() + ); + } + + /** + * Delete a record from the database. + * + * @return mixed + */ + public function delete() + { + if (isset($this->onDelete)) { + return call_user_func($this->onDelete, $this); + } + + return $this->toBase()->delete(); + } + + /** + * Run the default delete function on the builder. + * + * Since we do not apply scopes here, the row will actually be deleted. + * + * @return mixed + */ + public function forceDelete() + { + return $this->query->delete(); + } + + /** + * Register a replacement for the default delete function. + * + * @param \Closure $callback + * @return void + */ + public function onDelete(Closure $callback) + { + $this->onDelete = $callback; + } + + /** + * Call the given local model scopes. + * + * @param array $scopes + * @return mixed + */ + public function scopes(array $scopes) + { + $builder = $this; + + foreach ($scopes as $scope => $parameters) { + // If the scope key is an integer, then the scope was passed as the value and + // the parameter list is empty, so we will format the scope name and these + // parameters here. Then, we'll be ready to call the scope on the model. + if (is_int($scope)) { + [$scope, $parameters] = [$parameters, []]; + } + + // Next we'll pass the scope callback to the callScope method which will take + // care of grouping the "wheres" properly so the logical order doesn't get + // messed up when adding scopes. Then we'll return back out the builder. + $builder = $builder->callScope( + [$this->model, 'scope'.ucfirst($scope)], + (array) $parameters + ); + } + + return $builder; + } + + /** + * Apply the scopes to the Eloquent builder instance and return it. + * + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function applyScopes() + { + if (! $this->scopes) { + return $this; + } + + $builder = clone $this; + + foreach ($this->scopes as $identifier => $scope) { + if (! isset($builder->scopes[$identifier])) { + continue; + } + + $builder->callScope(function (Builder $builder) use ($scope) { + // If the scope is a Closure we will just go ahead and call the scope with the + // builder instance. The "callScope" method will properly group the clauses + // that are added to this query so "where" clauses maintain proper logic. + if ($scope instanceof Closure) { + $scope($builder); + } + + // If the scope is a scope object, we will call the apply method on this scope + // passing in the builder and the model instance. After we run all of these + // scopes we will return back the builder instance to the outside caller. + if ($scope instanceof Scope) { + $scope->apply($builder, $this->getModel()); + } + }); + } + + return $builder; + } + + /** + * Apply the given scope on the current builder instance. + * + * @param callable $scope + * @param array $parameters + * @return mixed + */ + protected function callScope(callable $scope, $parameters = []) + { + array_unshift($parameters, $this); + + $query = $this->getQuery(); + + // We will keep track of how many wheres are on the query before running the + // scope so that we can properly group the added scope constraints in the + // query as their own isolated nested where statement and avoid issues. + $originalWhereCount = is_null($query->wheres) + ? 0 : count($query->wheres); + + $result = $scope(...array_values($parameters)) ?? $this; + + if (count((array) $query->wheres) > $originalWhereCount) { + $this->addNewWheresWithinGroup($query, $originalWhereCount); + } + + return $result; + } + + /** + * Nest where conditions by slicing them at the given where count. + * + * @param \Illuminate\Database\Query\Builder $query + * @param int $originalWhereCount + * @return void + */ + protected function addNewWheresWithinGroup(QueryBuilder $query, $originalWhereCount) + { + // Here, we totally remove all of the where clauses since we are going to + // rebuild them as nested queries by slicing the groups of wheres into + // their own sections. This is to prevent any confusing logic order. + $allWheres = $query->wheres; + + $query->wheres = []; + + $this->groupWhereSliceForScope( + $query, array_slice($allWheres, 0, $originalWhereCount) + ); + + $this->groupWhereSliceForScope( + $query, array_slice($allWheres, $originalWhereCount) + ); + } + + /** + * Slice where conditions at the given offset and add them to the query as a nested condition. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $whereSlice + * @return void + */ + protected function groupWhereSliceForScope(QueryBuilder $query, $whereSlice) + { + $whereBooleans = collect($whereSlice)->pluck('boolean'); + + // Here we'll check if the given subset of where clauses contains any "or" + // booleans and in this case create a nested where expression. That way + // we don't add any unnecessary nesting thus keeping the query clean. + if ($whereBooleans->contains('or')) { + $query->wheres[] = $this->createNestedWhere( + $whereSlice, $whereBooleans->first() + ); + } else { + $query->wheres = array_merge($query->wheres, $whereSlice); + } + } + + /** + * Create a where array with nested where conditions. + * + * @param array $whereSlice + * @param string $boolean + * @return array + */ + protected function createNestedWhere($whereSlice, $boolean = 'and') + { + $whereGroup = $this->getQuery()->forNestedWhere(); + + $whereGroup->wheres = $whereSlice; + + return ['type' => 'Nested', 'query' => $whereGroup, 'boolean' => $boolean]; + } + + /** + * Set the relationships that should be eager loaded. + * + * @param mixed $relations + * @return $this + */ + public function with($relations) + { + $eagerLoad = $this->parseWithRelations(is_string($relations) ? func_get_args() : $relations); + + $this->eagerLoad = array_merge($this->eagerLoad, $eagerLoad); + + return $this; + } + + /** + * Prevent the specified relations from being eager loaded. + * + * @param mixed $relations + * @return $this + */ + public function without($relations) + { + $this->eagerLoad = array_diff_key($this->eagerLoad, array_flip( + is_string($relations) ? func_get_args() : $relations + )); + + return $this; + } + + /** + * Create a new instance of the model being queried. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function newModelInstance($attributes = []) + { + return $this->model->newInstance($attributes)->setConnection( + $this->query->getConnection()->getName() + ); + } + + /** + * Parse a list of relations into individuals. + * + * @param array $relations + * @return array + */ + protected function parseWithRelations(array $relations) + { + $results = []; + + foreach ($relations as $name => $constraints) { + // If the "name" value is a numeric key, we can assume that no + // constraints have been specified. We'll just put an empty + // Closure there, so that we can treat them all the same. + if (is_numeric($name)) { + $name = $constraints; + + [$name, $constraints] = Str::contains($name, ':') + ? $this->createSelectWithConstraint($name) + : [$name, function () { + // + }]; + } + + // We need to separate out any nested includes, which allows the developers + // to load deep relationships using "dots" without stating each level of + // the relationship with its own key in the array of eager-load names. + $results = $this->addNestedWiths($name, $results); + + $results[$name] = $constraints; + } + + return $results; + } + + /** + * Create a constraint to select the given columns for the relation. + * + * @param string $name + * @return array + */ + protected function createSelectWithConstraint($name) + { + return [explode(':', $name)[0], function ($query) use ($name) { + $query->select(explode(',', explode(':', $name)[1])); + }]; + } + + /** + * Parse the nested relationships in a relation. + * + * @param string $name + * @param array $results + * @return array + */ + protected function addNestedWiths($name, $results) + { + $progress = []; + + // If the relation has already been set on the result array, we will not set it + // again, since that would override any constraints that were already placed + // on the relationships. We will only set the ones that are not specified. + foreach (explode('.', $name) as $segment) { + $progress[] = $segment; + + if (! isset($results[$last = implode('.', $progress)])) { + $results[$last] = function () { + // + }; + } + } + + return $results; + } + + /** + * Get the underlying query builder instance. + * + * @return \Illuminate\Database\Query\Builder + */ + public function getQuery() + { + return $this->query; + } + + /** + * Set the underlying query builder instance. + * + * @param \Illuminate\Database\Query\Builder $query + * @return $this + */ + public function setQuery($query) + { + $this->query = $query; + + return $this; + } + + /** + * Get a base query builder instance. + * + * @return \Illuminate\Database\Query\Builder + */ + public function toBase() + { + return $this->applyScopes()->getQuery(); + } + + /** + * Get the relationships being eagerly loaded. + * + * @return array + */ + public function getEagerLoads() + { + return $this->eagerLoad; + } + + /** + * Set the relationships being eagerly loaded. + * + * @param array $eagerLoad + * @return $this + */ + public function setEagerLoads(array $eagerLoad) + { + $this->eagerLoad = $eagerLoad; + + return $this; + } + + /** + * Get the model instance being queried. + * + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function getModel() + { + return $this->model; + } + + /** + * Set a model instance for the model being queried. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return $this + */ + public function setModel(Model $model) + { + $this->model = $model; + + $this->query->from($model->getTable()); + + return $this; + } + + /** + * Qualify the given column name by the model's table. + * + * @param string $column + * @return string + */ + public function qualifyColumn($column) + { + return $this->model->qualifyColumn($column); + } + + /** + * Get the given macro by name. + * + * @param string $name + * @return \Closure + */ + public function getMacro($name) + { + return Arr::get($this->localMacros, $name); + } + + /** + * Dynamically handle calls into the query instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if ($method === 'macro') { + $this->localMacros[$parameters[0]] = $parameters[1]; + + return; + } + + if (isset($this->localMacros[$method])) { + array_unshift($parameters, $this); + + return $this->localMacros[$method](...$parameters); + } + + if (isset(static::$macros[$method])) { + if (static::$macros[$method] instanceof Closure) { + return call_user_func_array(static::$macros[$method]->bindTo($this, static::class), $parameters); + } + + return call_user_func_array(static::$macros[$method], $parameters); + } + + if (method_exists($this->model, $scope = 'scope'.ucfirst($method))) { + return $this->callScope([$this->model, $scope], $parameters); + } + + if (in_array($method, $this->passthru)) { + return $this->toBase()->{$method}(...$parameters); + } + + $this->forwardCallTo($this->query, $method, $parameters); + + return $this; + } + + /** + * Dynamically handle calls into the query instance. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public static function __callStatic($method, $parameters) + { + if ($method === 'macro') { + static::$macros[$parameters[0]] = $parameters[1]; + + return; + } + + if (! isset(static::$macros[$method])) { + static::throwBadMethodCallException($method); + } + + if (static::$macros[$method] instanceof Closure) { + return call_user_func_array(Closure::bind(static::$macros[$method], null, static::class), $parameters); + } + + return call_user_func_array(static::$macros[$method], $parameters); + } + + /** + * Force a clone of the underlying query builder when cloning. + * + * @return void + */ + public function __clone() + { + $this->query = clone $this->query; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php new file mode 100755 index 0000000..72d2d85 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Collection.php @@ -0,0 +1,582 @@ +getKey(); + } + + if ($key instanceof Arrayable) { + $key = $key->toArray(); + } + + if (is_array($key)) { + if ($this->isEmpty()) { + return new static; + } + + return $this->whereIn($this->first()->getKeyName(), $key); + } + + return Arr::first($this->items, function ($model) use ($key) { + return $model->getKey() == $key; + }, $default); + } + + /** + * Load a set of relationships onto the collection. + * + * @param array|string $relations + * @return $this + */ + public function load($relations) + { + if ($this->isNotEmpty()) { + if (is_string($relations)) { + $relations = func_get_args(); + } + + $query = $this->first()->newQueryWithoutRelationships()->with($relations); + + $this->items = $query->eagerLoadRelations($this->items); + } + + return $this; + } + + /** + * Load a set of relationship counts onto the collection. + * + * @param array|string $relations + * @return $this + */ + public function loadCount($relations) + { + if ($this->isEmpty()) { + return $this; + } + + $models = $this->first()->newModelQuery() + ->whereKey($this->modelKeys()) + ->select($this->first()->getKeyName()) + ->withCount(...func_get_args()) + ->get(); + + $attributes = Arr::except( + array_keys($models->first()->getAttributes()), + $models->first()->getKeyName() + ); + + $models->each(function ($model) use ($attributes) { + $this->find($model->getKey())->forceFill( + Arr::only($model->getAttributes(), $attributes) + )->syncOriginalAttributes($attributes); + }); + + return $this; + } + + /** + * Load a set of relationships onto the collection if they are not already eager loaded. + * + * @param array|string $relations + * @return $this + */ + public function loadMissing($relations) + { + if (is_string($relations)) { + $relations = func_get_args(); + } + + foreach ($relations as $key => $value) { + if (is_numeric($key)) { + $key = $value; + } + + $segments = explode('.', explode(':', $key)[0]); + + if (Str::contains($key, ':')) { + $segments[count($segments) - 1] .= ':'.explode(':', $key)[1]; + } + + $path = array_combine($segments, $segments); + + if (is_callable($value)) { + $path[end($segments)] = $value; + } + + $this->loadMissingRelation($this, $path); + } + + return $this; + } + + /** + * Load a relationship path if it is not already eager loaded. + * + * @param \Illuminate\Database\Eloquent\Collection $models + * @param array $path + * @return void + */ + protected function loadMissingRelation(Collection $models, array $path) + { + $relation = array_splice($path, 0, 1); + + $name = explode(':', key($relation))[0]; + + if (is_string(reset($relation))) { + $relation = reset($relation); + } + + $models->filter(function ($model) use ($name) { + return ! is_null($model) && ! $model->relationLoaded($name); + })->load($relation); + + if (empty($path)) { + return; + } + + $models = $models->pluck($name); + + if ($models->first() instanceof BaseCollection) { + $models = $models->collapse(); + } + + $this->loadMissingRelation(new static($models), $path); + } + + /** + * Load a set of relationships onto the mixed relationship collection. + * + * @param string $relation + * @param array $relations + * @return $this + */ + public function loadMorph($relation, $relations) + { + $this->pluck($relation) + ->filter() + ->groupBy(function ($model) { + return get_class($model); + }) + ->filter(function ($models, $className) use ($relations) { + return Arr::has($relations, $className); + }) + ->each(function ($models, $className) use ($relations) { + $className::with($relations[$className]) + ->eagerLoadRelations($models->all()); + }); + + return $this; + } + + /** + * Add an item to the collection. + * + * @param mixed $item + * @return $this + */ + public function add($item) + { + $this->items[] = $item; + + return $this; + } + + /** + * Determine if a key exists in the collection. + * + * @param mixed $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function contains($key, $operator = null, $value = null) + { + if (func_num_args() > 1 || $this->useAsCallable($key)) { + return parent::contains(...func_get_args()); + } + + if ($key instanceof Model) { + return parent::contains(function ($model) use ($key) { + return $model->is($key); + }); + } + + return parent::contains(function ($model) use ($key) { + return $model->getKey() == $key; + }); + } + + /** + * Get the array of primary keys. + * + * @return array + */ + public function modelKeys() + { + return array_map(function ($model) { + return $model->getKey(); + }, $this->items); + } + + /** + * Merge the collection with the given items. + * + * @param \ArrayAccess|array $items + * @return static + */ + public function merge($items) + { + $dictionary = $this->getDictionary(); + + foreach ($items as $item) { + $dictionary[$item->getKey()] = $item; + } + + return new static(array_values($dictionary)); + } + + /** + * Run a map over each of the items. + * + * @param callable $callback + * @return \Illuminate\Support\Collection|static + */ + public function map(callable $callback) + { + $result = parent::map($callback); + + return $result->contains(function ($item) { + return ! $item instanceof Model; + }) ? $result->toBase() : $result; + } + + /** + * Reload a fresh model instance from the database for all the entities. + * + * @param array|string $with + * @return static + */ + public function fresh($with = []) + { + if ($this->isEmpty()) { + return new static; + } + + $model = $this->first(); + + $freshModels = $model->newQueryWithoutScopes() + ->with(is_string($with) ? func_get_args() : $with) + ->whereIn($model->getKeyName(), $this->modelKeys()) + ->get() + ->getDictionary(); + + return $this->map(function ($model) use ($freshModels) { + return $model->exists && isset($freshModels[$model->getKey()]) + ? $freshModels[$model->getKey()] : null; + }); + } + + /** + * Diff the collection with the given items. + * + * @param \ArrayAccess|array $items + * @return static + */ + public function diff($items) + { + $diff = new static; + + $dictionary = $this->getDictionary($items); + + foreach ($this->items as $item) { + if (! isset($dictionary[$item->getKey()])) { + $diff->add($item); + } + } + + return $diff; + } + + /** + * Intersect the collection with the given items. + * + * @param \ArrayAccess|array $items + * @return static + */ + public function intersect($items) + { + $intersect = new static; + + $dictionary = $this->getDictionary($items); + + foreach ($this->items as $item) { + if (isset($dictionary[$item->getKey()])) { + $intersect->add($item); + } + } + + return $intersect; + } + + /** + * Return only unique items from the collection. + * + * @param string|callable|null $key + * @param bool $strict + * @return static|\Illuminate\Support\Collection + */ + public function unique($key = null, $strict = false) + { + if (! is_null($key)) { + return parent::unique($key, $strict); + } + + return new static(array_values($this->getDictionary())); + } + + /** + * Returns only the models from the collection with the specified keys. + * + * @param mixed $keys + * @return static + */ + public function only($keys) + { + if (is_null($keys)) { + return new static($this->items); + } + + $dictionary = Arr::only($this->getDictionary(), $keys); + + return new static(array_values($dictionary)); + } + + /** + * Returns all models in the collection except the models with specified keys. + * + * @param mixed $keys + * @return static + */ + public function except($keys) + { + $dictionary = Arr::except($this->getDictionary(), $keys); + + return new static(array_values($dictionary)); + } + + /** + * Make the given, typically visible, attributes hidden across the entire collection. + * + * @param array|string $attributes + * @return $this + */ + public function makeHidden($attributes) + { + return $this->each->addHidden($attributes); + } + + /** + * Make the given, typically hidden, attributes visible across the entire collection. + * + * @param array|string $attributes + * @return $this + */ + public function makeVisible($attributes) + { + return $this->each->makeVisible($attributes); + } + + /** + * Get a dictionary keyed by primary keys. + * + * @param \ArrayAccess|array|null $items + * @return array + */ + public function getDictionary($items = null) + { + $items = is_null($items) ? $this->items : $items; + + $dictionary = []; + + foreach ($items as $value) { + $dictionary[$value->getKey()] = $value; + } + + return $dictionary; + } + + /** + * The following methods are intercepted to always return base collections. + */ + + /** + * Get an array with the values of a given key. + * + * @param string $value + * @param string|null $key + * @return \Illuminate\Support\Collection + */ + public function pluck($value, $key = null) + { + return $this->toBase()->pluck($value, $key); + } + + /** + * Get the keys of the collection items. + * + * @return \Illuminate\Support\Collection + */ + public function keys() + { + return $this->toBase()->keys(); + } + + /** + * Zip the collection together with one or more arrays. + * + * @param mixed ...$items + * @return \Illuminate\Support\Collection + */ + public function zip($items) + { + return call_user_func_array([$this->toBase(), 'zip'], func_get_args()); + } + + /** + * Collapse the collection of items into a single array. + * + * @return \Illuminate\Support\Collection + */ + public function collapse() + { + return $this->toBase()->collapse(); + } + + /** + * Get a flattened array of the items in the collection. + * + * @param int $depth + * @return \Illuminate\Support\Collection + */ + public function flatten($depth = INF) + { + return $this->toBase()->flatten($depth); + } + + /** + * Flip the items in the collection. + * + * @return \Illuminate\Support\Collection + */ + public function flip() + { + return $this->toBase()->flip(); + } + + /** + * Pad collection to the specified length with a value. + * + * @param int $size + * @param mixed $value + * @return \Illuminate\Support\Collection + */ + public function pad($size, $value) + { + return $this->toBase()->pad($size, $value); + } + + /** + * Get the type of the entities being queued. + * + * @return string|null + * + * @throws \LogicException + */ + public function getQueueableClass() + { + if ($this->isEmpty()) { + return; + } + + $class = get_class($this->first()); + + $this->each(function ($model) use ($class) { + if (get_class($model) !== $class) { + throw new LogicException('Queueing collections with multiple model types is not supported.'); + } + }); + + return $class; + } + + /** + * Get the identifiers for all of the entities. + * + * @return array + */ + public function getQueueableIds() + { + if ($this->isEmpty()) { + return []; + } + + return $this->first() instanceof Pivot + ? $this->map->getQueueableId()->all() + : $this->modelKeys(); + } + + /** + * Get the relationships of the entities being queued. + * + * @return array + */ + public function getQueueableRelations() + { + return $this->isNotEmpty() ? $this->first()->getQueueableRelations() : []; + } + + /** + * Get the connection of the entities being queued. + * + * @return string|null + * + * @throws \LogicException + */ + public function getQueueableConnection() + { + if ($this->isEmpty()) { + return; + } + + $connection = $this->first()->getConnectionName(); + + $this->each(function ($model) use ($connection) { + if ($model->getConnectionName() !== $connection) { + throw new LogicException('Queueing collections with multiple model connections is not supported.'); + } + }); + + return $connection; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php new file mode 100644 index 0000000..b9095c0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php @@ -0,0 +1,193 @@ +fillable; + } + + /** + * Set the fillable attributes for the model. + * + * @param array $fillable + * @return $this + */ + public function fillable(array $fillable) + { + $this->fillable = $fillable; + + return $this; + } + + /** + * Get the guarded attributes for the model. + * + * @return array + */ + public function getGuarded() + { + return $this->guarded; + } + + /** + * Set the guarded attributes for the model. + * + * @param array $guarded + * @return $this + */ + public function guard(array $guarded) + { + $this->guarded = $guarded; + + return $this; + } + + /** + * Disable all mass assignable restrictions. + * + * @param bool $state + * @return void + */ + public static function unguard($state = true) + { + static::$unguarded = $state; + } + + /** + * Enable the mass assignment restrictions. + * + * @return void + */ + public static function reguard() + { + static::$unguarded = false; + } + + /** + * Determine if current state is "unguarded". + * + * @return bool + */ + public static function isUnguarded() + { + return static::$unguarded; + } + + /** + * Run the given callable while being unguarded. + * + * @param callable $callback + * @return mixed + */ + public static function unguarded(callable $callback) + { + if (static::$unguarded) { + return $callback(); + } + + static::unguard(); + + try { + return $callback(); + } finally { + static::reguard(); + } + } + + /** + * Determine if the given attribute may be mass assigned. + * + * @param string $key + * @return bool + */ + public function isFillable($key) + { + if (static::$unguarded) { + return true; + } + + // If the key is in the "fillable" array, we can of course assume that it's + // a fillable attribute. Otherwise, we will check the guarded array when + // we need to determine if the attribute is black-listed on the model. + if (in_array($key, $this->getFillable())) { + return true; + } + + // If the attribute is explicitly listed in the "guarded" array then we can + // return false immediately. This means this attribute is definitely not + // fillable and there is no point in going any further in this method. + if ($this->isGuarded($key)) { + return false; + } + + return empty($this->getFillable()) && + ! Str::startsWith($key, '_'); + } + + /** + * Determine if the given key is guarded. + * + * @param string $key + * @return bool + */ + public function isGuarded($key) + { + return in_array($key, $this->getGuarded()) || $this->getGuarded() == ['*']; + } + + /** + * Determine if the model is totally guarded. + * + * @return bool + */ + public function totallyGuarded() + { + return count($this->getFillable()) === 0 && $this->getGuarded() == ['*']; + } + + /** + * Get the fillable attributes of a given array. + * + * @param array $attributes + * @return array + */ + protected function fillableFromArray(array $attributes) + { + if (count($this->getFillable()) > 0 && ! static::$unguarded) { + return array_intersect_key($attributes, array_flip($this->getFillable())); + } + + return $attributes; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php new file mode 100644 index 0000000..6d144ab --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php @@ -0,0 +1,1238 @@ +addDateAttributesToArray( + $attributes = $this->getArrayableAttributes() + ); + + $attributes = $this->addMutatedAttributesToArray( + $attributes, $mutatedAttributes = $this->getMutatedAttributes() + ); + + // Next we will handle any casts that have been setup for this model and cast + // the values to their appropriate type. If the attribute has a mutator we + // will not perform the cast on those attributes to avoid any confusion. + $attributes = $this->addCastAttributesToArray( + $attributes, $mutatedAttributes + ); + + // Here we will grab all of the appended, calculated attributes to this model + // as these attributes are not really in the attributes array, but are run + // when we need to array or JSON the model for convenience to the coder. + foreach ($this->getArrayableAppends() as $key) { + $attributes[$key] = $this->mutateAttributeForArray($key, null); + } + + return $attributes; + } + + /** + * Add the date attributes to the attributes array. + * + * @param array $attributes + * @return array + */ + protected function addDateAttributesToArray(array $attributes) + { + foreach ($this->getDates() as $key) { + if (! isset($attributes[$key])) { + continue; + } + + $attributes[$key] = $this->serializeDate( + $this->asDateTime($attributes[$key]) + ); + } + + return $attributes; + } + + /** + * Add the mutated attributes to the attributes array. + * + * @param array $attributes + * @param array $mutatedAttributes + * @return array + */ + protected function addMutatedAttributesToArray(array $attributes, array $mutatedAttributes) + { + foreach ($mutatedAttributes as $key) { + // We want to spin through all the mutated attributes for this model and call + // the mutator for the attribute. We cache off every mutated attributes so + // we don't have to constantly check on attributes that actually change. + if (! array_key_exists($key, $attributes)) { + continue; + } + + // Next, we will call the mutator for this attribute so that we can get these + // mutated attribute's actual values. After we finish mutating each of the + // attributes we will return this final array of the mutated attributes. + $attributes[$key] = $this->mutateAttributeForArray( + $key, $attributes[$key] + ); + } + + return $attributes; + } + + /** + * Add the casted attributes to the attributes array. + * + * @param array $attributes + * @param array $mutatedAttributes + * @return array + */ + protected function addCastAttributesToArray(array $attributes, array $mutatedAttributes) + { + foreach ($this->getCasts() as $key => $value) { + if (! array_key_exists($key, $attributes) || in_array($key, $mutatedAttributes)) { + continue; + } + + // Here we will cast the attribute. Then, if the cast is a date or datetime cast + // then we will serialize the date for the array. This will convert the dates + // to strings based on the date format specified for these Eloquent models. + $attributes[$key] = $this->castAttribute( + $key, $attributes[$key] + ); + + // If the attribute cast was a date or a datetime, we will serialize the date as + // a string. This allows the developers to customize how dates are serialized + // into an array without affecting how they are persisted into the storage. + if ($attributes[$key] && + ($value === 'date' || $value === 'datetime')) { + $attributes[$key] = $this->serializeDate($attributes[$key]); + } + + if ($attributes[$key] && $this->isCustomDateTimeCast($value)) { + $attributes[$key] = $attributes[$key]->format(explode(':', $value, 2)[1]); + } + } + + return $attributes; + } + + /** + * Get an attribute array of all arrayable attributes. + * + * @return array + */ + protected function getArrayableAttributes() + { + return $this->getArrayableItems($this->attributes); + } + + /** + * Get all of the appendable values that are arrayable. + * + * @return array + */ + protected function getArrayableAppends() + { + if (! count($this->appends)) { + return []; + } + + return $this->getArrayableItems( + array_combine($this->appends, $this->appends) + ); + } + + /** + * Get the model's relationships in array form. + * + * @return array + */ + public function relationsToArray() + { + $attributes = []; + + foreach ($this->getArrayableRelations() as $key => $value) { + // If the values implements the Arrayable interface we can just call this + // toArray method on the instances which will convert both models and + // collections to their proper array form and we'll set the values. + if ($value instanceof Arrayable) { + $relation = $value->toArray(); + } + + // If the value is null, we'll still go ahead and set it in this list of + // attributes since null is used to represent empty relationships if + // if it a has one or belongs to type relationships on the models. + elseif (is_null($value)) { + $relation = $value; + } + + // If the relationships snake-casing is enabled, we will snake case this + // key so that the relation attribute is snake cased in this returned + // array to the developers, making this consistent with attributes. + if (static::$snakeAttributes) { + $key = Str::snake($key); + } + + // If the relation value has been set, we will set it on this attributes + // list for returning. If it was not arrayable or null, we'll not set + // the value on the array because it is some type of invalid value. + if (isset($relation) || is_null($value)) { + $attributes[$key] = $relation; + } + + unset($relation); + } + + return $attributes; + } + + /** + * Get an attribute array of all arrayable relations. + * + * @return array + */ + protected function getArrayableRelations() + { + return $this->getArrayableItems($this->relations); + } + + /** + * Get an attribute array of all arrayable values. + * + * @param array $values + * @return array + */ + protected function getArrayableItems(array $values) + { + if (count($this->getVisible()) > 0) { + $values = array_intersect_key($values, array_flip($this->getVisible())); + } + + if (count($this->getHidden()) > 0) { + $values = array_diff_key($values, array_flip($this->getHidden())); + } + + return $values; + } + + /** + * Get an attribute from the model. + * + * @param string $key + * @return mixed + */ + public function getAttribute($key) + { + if (! $key) { + return; + } + + // If the attribute exists in the attribute array or has a "get" mutator we will + // get the attribute's value. Otherwise, we will proceed as if the developers + // are asking for a relationship's value. This covers both types of values. + if (array_key_exists($key, $this->attributes) || + $this->hasGetMutator($key)) { + return $this->getAttributeValue($key); + } + + // Here we will determine if the model base class itself contains this given key + // since we don't want to treat any of those methods as relationships because + // they are all intended as helper methods and none of these are relations. + if (method_exists(self::class, $key)) { + return; + } + + return $this->getRelationValue($key); + } + + /** + * Get a plain attribute (not a relationship). + * + * @param string $key + * @return mixed + */ + public function getAttributeValue($key) + { + $value = $this->getAttributeFromArray($key); + + // If the attribute has a get mutator, we will call that then return what + // it returns as the value, which is useful for transforming values on + // retrieval from the model to a form that is more useful for usage. + if ($this->hasGetMutator($key)) { + return $this->mutateAttribute($key, $value); + } + + // If the attribute exists within the cast array, we will convert it to + // an appropriate native PHP type dependant upon the associated value + // given with the key in the pair. Dayle made this comment line up. + if ($this->hasCast($key)) { + return $this->castAttribute($key, $value); + } + + // If the attribute is listed as a date, we will convert it to a DateTime + // instance on retrieval, which makes it quite convenient to work with + // date fields without having to create a mutator for each property. + if (in_array($key, $this->getDates()) && + ! is_null($value)) { + return $this->asDateTime($value); + } + + return $value; + } + + /** + * Get an attribute from the $attributes array. + * + * @param string $key + * @return mixed + */ + protected function getAttributeFromArray($key) + { + if (isset($this->attributes[$key])) { + return $this->attributes[$key]; + } + } + + /** + * Get a relationship. + * + * @param string $key + * @return mixed + */ + public function getRelationValue($key) + { + // If the key already exists in the relationships array, it just means the + // relationship has already been loaded, so we'll just return it out of + // here because there is no need to query within the relations twice. + if ($this->relationLoaded($key)) { + return $this->relations[$key]; + } + + // If the "attribute" exists as a method on the model, we will just assume + // it is a relationship and will load and return results from the query + // and hydrate the relationship's value on the "relationships" array. + if (method_exists($this, $key)) { + return $this->getRelationshipFromMethod($key); + } + } + + /** + * Get a relationship value from a method. + * + * @param string $method + * @return mixed + * + * @throws \LogicException + */ + protected function getRelationshipFromMethod($method) + { + $relation = $this->$method(); + + if (! $relation instanceof Relation) { + throw new LogicException(sprintf( + '%s::%s must return a relationship instance.', static::class, $method + )); + } + + return tap($relation->getResults(), function ($results) use ($method) { + $this->setRelation($method, $results); + }); + } + + /** + * Determine if a get mutator exists for an attribute. + * + * @param string $key + * @return bool + */ + public function hasGetMutator($key) + { + return method_exists($this, 'get'.Str::studly($key).'Attribute'); + } + + /** + * Get the value of an attribute using its mutator. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function mutateAttribute($key, $value) + { + return $this->{'get'.Str::studly($key).'Attribute'}($value); + } + + /** + * Get the value of an attribute using its mutator for array conversion. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function mutateAttributeForArray($key, $value) + { + $value = $this->mutateAttribute($key, $value); + + return $value instanceof Arrayable ? $value->toArray() : $value; + } + + /** + * Cast an attribute to a native PHP type. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function castAttribute($key, $value) + { + if (is_null($value)) { + return $value; + } + + switch ($this->getCastType($key)) { + case 'int': + case 'integer': + return (int) $value; + case 'real': + case 'float': + case 'double': + return $this->fromFloat($value); + case 'decimal': + return $this->asDecimal($value, explode(':', $this->getCasts()[$key], 2)[1]); + case 'string': + return (string) $value; + case 'bool': + case 'boolean': + return (bool) $value; + case 'object': + return $this->fromJson($value, true); + case 'array': + case 'json': + return $this->fromJson($value); + case 'collection': + return new BaseCollection($this->fromJson($value)); + case 'date': + return $this->asDate($value); + case 'datetime': + case 'custom_datetime': + return $this->asDateTime($value); + case 'timestamp': + return $this->asTimestamp($value); + default: + return $value; + } + } + + /** + * Get the type of cast for a model attribute. + * + * @param string $key + * @return string + */ + protected function getCastType($key) + { + if ($this->isCustomDateTimeCast($this->getCasts()[$key])) { + return 'custom_datetime'; + } + + if ($this->isDecimalCast($this->getCasts()[$key])) { + return 'decimal'; + } + + return trim(strtolower($this->getCasts()[$key])); + } + + /** + * Determine if the cast type is a custom date time cast. + * + * @param string $cast + * @return bool + */ + protected function isCustomDateTimeCast($cast) + { + return strncmp($cast, 'date:', 5) === 0 || + strncmp($cast, 'datetime:', 9) === 0; + } + + /** + * Determine if the cast type is a decimal cast. + * + * @param string $cast + * @return bool + */ + protected function isDecimalCast($cast) + { + return strncmp($cast, 'decimal:', 8) === 0; + } + + /** + * Set a given attribute on the model. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + public function setAttribute($key, $value) + { + // First we will check for the presence of a mutator for the set operation + // which simply lets the developers tweak the attribute as it is set on + // the model, such as "json_encoding" an listing of data for storage. + if ($this->hasSetMutator($key)) { + return $this->setMutatedAttributeValue($key, $value); + } + + // If an attribute is listed as a "date", we'll convert it from a DateTime + // instance into a form proper for storage on the database tables using + // the connection grammar's date format. We will auto set the values. + elseif ($value && $this->isDateAttribute($key)) { + $value = $this->fromDateTime($value); + } + + if ($this->isJsonCastable($key) && ! is_null($value)) { + $value = $this->castAttributeAsJson($key, $value); + } + + // If this attribute contains a JSON ->, we'll set the proper value in the + // attribute's underlying array. This takes care of properly nesting an + // attribute in the array's value in the case of deeply nested items. + if (Str::contains($key, '->')) { + return $this->fillJsonAttribute($key, $value); + } + + $this->attributes[$key] = $value; + + return $this; + } + + /** + * Determine if a set mutator exists for an attribute. + * + * @param string $key + * @return bool + */ + public function hasSetMutator($key) + { + return method_exists($this, 'set'.Str::studly($key).'Attribute'); + } + + /** + * Set the value of an attribute using its mutator. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function setMutatedAttributeValue($key, $value) + { + return $this->{'set'.Str::studly($key).'Attribute'}($value); + } + + /** + * Determine if the given attribute is a date or date castable. + * + * @param string $key + * @return bool + */ + protected function isDateAttribute($key) + { + return in_array($key, $this->getDates()) || + $this->isDateCastable($key); + } + + /** + * Set a given JSON attribute on the model. + * + * @param string $key + * @param mixed $value + * @return $this + */ + public function fillJsonAttribute($key, $value) + { + [$key, $path] = explode('->', $key, 2); + + $this->attributes[$key] = $this->asJson($this->getArrayAttributeWithValue( + $path, $key, $value + )); + + return $this; + } + + /** + * Get an array attribute with the given key and value set. + * + * @param string $path + * @param string $key + * @param mixed $value + * @return $this + */ + protected function getArrayAttributeWithValue($path, $key, $value) + { + return tap($this->getArrayAttributeByKey($key), function (&$array) use ($path, $value) { + Arr::set($array, str_replace('->', '.', $path), $value); + }); + } + + /** + * Get an array attribute or return an empty array if it is not set. + * + * @param string $key + * @return array + */ + protected function getArrayAttributeByKey($key) + { + return isset($this->attributes[$key]) ? + $this->fromJson($this->attributes[$key]) : []; + } + + /** + * Cast the given attribute to JSON. + * + * @param string $key + * @param mixed $value + * @return string + */ + protected function castAttributeAsJson($key, $value) + { + $value = $this->asJson($value); + + if ($value === false) { + throw JsonEncodingException::forAttribute( + $this, $key, json_last_error_msg() + ); + } + + return $value; + } + + /** + * Encode the given value as JSON. + * + * @param mixed $value + * @return string + */ + protected function asJson($value) + { + return json_encode($value); + } + + /** + * Decode the given JSON back into an array or object. + * + * @param string $value + * @param bool $asObject + * @return mixed + */ + public function fromJson($value, $asObject = false) + { + return json_decode($value, ! $asObject); + } + + /** + * Decode the given float. + * + * @param mixed $value + * @return mixed + */ + public function fromFloat($value) + { + switch ((string) $value) { + case 'Infinity': + return INF; + case '-Infinity': + return -INF; + case 'NaN': + return NAN; + default: + return (float) $value; + } + } + + /** + * Return a decimal as string. + * + * @param float $value + * @param int $decimals + * @return string + */ + protected function asDecimal($value, $decimals) + { + return number_format($value, $decimals, '.', ''); + } + + /** + * Return a timestamp as DateTime object with time set to 00:00:00. + * + * @param mixed $value + * @return \Illuminate\Support\Carbon + */ + protected function asDate($value) + { + return $this->asDateTime($value)->startOfDay(); + } + + /** + * Return a timestamp as DateTime object. + * + * @param mixed $value + * @return \Illuminate\Support\Carbon + */ + protected function asDateTime($value) + { + // If this value is already a Carbon instance, we shall just return it as is. + // This prevents us having to re-instantiate a Carbon instance when we know + // it already is one, which wouldn't be fulfilled by the DateTime check. + if ($value instanceof Carbon) { + return $value; + } + + // If the value is already a DateTime instance, we will just skip the rest of + // these checks since they will be a waste of time, and hinder performance + // when checking the field. We will just return the DateTime right away. + if ($value instanceof DateTimeInterface) { + return new Carbon( + $value->format('Y-m-d H:i:s.u'), $value->getTimezone() + ); + } + + // If this value is an integer, we will assume it is a UNIX timestamp's value + // and format a Carbon object from this timestamp. This allows flexibility + // when defining your date fields as they might be UNIX timestamps here. + if (is_numeric($value)) { + return Carbon::createFromTimestamp($value); + } + + // If the value is in simply year, month, day format, we will instantiate the + // Carbon instances from that format. Again, this provides for simple date + // fields on the database, while still supporting Carbonized conversion. + if ($this->isStandardDateFormat($value)) { + return Carbon::createFromFormat('Y-m-d', $value)->startOfDay(); + } + + // Finally, we will just assume this date is in the format used by default on + // the database connection and use that format to create the Carbon object + // that is returned back out to the developers after we convert it here. + return Carbon::createFromFormat( + str_replace('.v', '.u', $this->getDateFormat()), $value + ); + } + + /** + * Determine if the given value is a standard date format. + * + * @param string $value + * @return bool + */ + protected function isStandardDateFormat($value) + { + return preg_match('/^(\d{4})-(\d{1,2})-(\d{1,2})$/', $value); + } + + /** + * Convert a DateTime to a storable string. + * + * @param mixed $value + * @return string|null + */ + public function fromDateTime($value) + { + return empty($value) ? $value : $this->asDateTime($value)->format( + $this->getDateFormat() + ); + } + + /** + * Return a timestamp as unix timestamp. + * + * @param mixed $value + * @return int + */ + protected function asTimestamp($value) + { + return $this->asDateTime($value)->getTimestamp(); + } + + /** + * Prepare a date for array / JSON serialization. + * + * @param \DateTimeInterface $date + * @return string + */ + protected function serializeDate(DateTimeInterface $date) + { + return $date->format($this->getDateFormat()); + } + + /** + * Get the attributes that should be converted to dates. + * + * @return array + */ + public function getDates() + { + $defaults = [static::CREATED_AT, static::UPDATED_AT]; + + return $this->usesTimestamps() + ? array_unique(array_merge($this->dates, $defaults)) + : $this->dates; + } + + /** + * Get the format for database stored dates. + * + * @return string + */ + public function getDateFormat() + { + return $this->dateFormat ?: $this->getConnection()->getQueryGrammar()->getDateFormat(); + } + + /** + * Set the date format used by the model. + * + * @param string $format + * @return $this + */ + public function setDateFormat($format) + { + $this->dateFormat = $format; + + return $this; + } + + /** + * Determine whether an attribute should be cast to a native type. + * + * @param string $key + * @param array|string|null $types + * @return bool + */ + public function hasCast($key, $types = null) + { + if (array_key_exists($key, $this->getCasts())) { + return $types ? in_array($this->getCastType($key), (array) $types, true) : true; + } + + return false; + } + + /** + * Get the casts array. + * + * @return array + */ + public function getCasts() + { + if ($this->getIncrementing()) { + return array_merge([$this->getKeyName() => $this->getKeyType()], $this->casts); + } + + return $this->casts; + } + + /** + * Determine whether a value is Date / DateTime castable for inbound manipulation. + * + * @param string $key + * @return bool + */ + protected function isDateCastable($key) + { + return $this->hasCast($key, ['date', 'datetime']); + } + + /** + * Determine whether a value is JSON castable for inbound manipulation. + * + * @param string $key + * @return bool + */ + protected function isJsonCastable($key) + { + return $this->hasCast($key, ['array', 'json', 'object', 'collection']); + } + + /** + * Get all of the current attributes on the model. + * + * @return array + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Set the array of model attributes. No checking is done. + * + * @param array $attributes + * @param bool $sync + * @return $this + */ + public function setRawAttributes(array $attributes, $sync = false) + { + $this->attributes = $attributes; + + if ($sync) { + $this->syncOriginal(); + } + + return $this; + } + + /** + * Get the model's original attribute values. + * + * @param string|null $key + * @param mixed $default + * @return mixed|array + */ + public function getOriginal($key = null, $default = null) + { + return Arr::get($this->original, $key, $default); + } + + /** + * Get a subset of the model's attributes. + * + * @param array|mixed $attributes + * @return array + */ + public function only($attributes) + { + $results = []; + + foreach (is_array($attributes) ? $attributes : func_get_args() as $attribute) { + $results[$attribute] = $this->getAttribute($attribute); + } + + return $results; + } + + /** + * Sync the original attributes with the current. + * + * @return $this + */ + public function syncOriginal() + { + $this->original = $this->attributes; + + return $this; + } + + /** + * Sync a single original attribute with its current value. + * + * @param string $attribute + * @return $this + */ + public function syncOriginalAttribute($attribute) + { + return $this->syncOriginalAttributes($attribute); + } + + /** + * Sync multiple original attribute with their current values. + * + * @param array|string $attributes + * @return $this + */ + public function syncOriginalAttributes($attributes) + { + $attributes = is_array($attributes) ? $attributes : func_get_args(); + + foreach ($attributes as $attribute) { + $this->original[$attribute] = $this->attributes[$attribute]; + } + + return $this; + } + + /** + * Sync the changed attributes. + * + * @return $this + */ + public function syncChanges() + { + $this->changes = $this->getDirty(); + + return $this; + } + + /** + * Determine if the model or given attribute(s) have been modified. + * + * @param array|string|null $attributes + * @return bool + */ + public function isDirty($attributes = null) + { + return $this->hasChanges( + $this->getDirty(), is_array($attributes) ? $attributes : func_get_args() + ); + } + + /** + * Determine if the model or given attribute(s) have remained the same. + * + * @param array|string|null $attributes + * @return bool + */ + public function isClean($attributes = null) + { + return ! $this->isDirty(...func_get_args()); + } + + /** + * Determine if the model or given attribute(s) have been modified. + * + * @param array|string|null $attributes + * @return bool + */ + public function wasChanged($attributes = null) + { + return $this->hasChanges( + $this->getChanges(), is_array($attributes) ? $attributes : func_get_args() + ); + } + + /** + * Determine if the given attributes were changed. + * + * @param array $changes + * @param array|string|null $attributes + * @return bool + */ + protected function hasChanges($changes, $attributes = null) + { + // If no specific attributes were provided, we will just see if the dirty array + // already contains any attributes. If it does we will just return that this + // count is greater than zero. Else, we need to check specific attributes. + if (empty($attributes)) { + return count($changes) > 0; + } + + // Here we will spin through every attribute and see if this is in the array of + // dirty attributes. If it is, we will return true and if we make it through + // all of the attributes for the entire array we will return false at end. + foreach (Arr::wrap($attributes) as $attribute) { + if (array_key_exists($attribute, $changes)) { + return true; + } + } + + return false; + } + + /** + * Get the attributes that have been changed since last sync. + * + * @return array + */ + public function getDirty() + { + $dirty = []; + + foreach ($this->getAttributes() as $key => $value) { + if (! $this->originalIsEquivalent($key, $value)) { + $dirty[$key] = $value; + } + } + + return $dirty; + } + + /** + * Get the attributes that were changed. + * + * @return array + */ + public function getChanges() + { + return $this->changes; + } + + /** + * Determine if the new and old values for a given key are equivalent. + * + * @param string $key + * @param mixed $current + * @return bool + */ + protected function originalIsEquivalent($key, $current) + { + if (! array_key_exists($key, $this->original)) { + return false; + } + + $original = $this->getOriginal($key); + + if ($current === $original) { + return true; + } elseif (is_null($current)) { + return false; + } elseif ($this->isDateAttribute($key)) { + return $this->fromDateTime($current) === + $this->fromDateTime($original); + } elseif ($this->hasCast($key)) { + return $this->castAttribute($key, $current) === + $this->castAttribute($key, $original); + } + + return is_numeric($current) && is_numeric($original) + && strcmp((string) $current, (string) $original) === 0; + } + + /** + * Append attributes to query when building a query. + * + * @param array|string $attributes + * @return $this + */ + public function append($attributes) + { + $this->appends = array_unique( + array_merge($this->appends, is_string($attributes) ? func_get_args() : $attributes) + ); + + return $this; + } + + /** + * Set the accessors to append to model arrays. + * + * @param array $appends + * @return $this + */ + public function setAppends(array $appends) + { + $this->appends = $appends; + + return $this; + } + + /** + * Get the mutated attributes for a given instance. + * + * @return array + */ + public function getMutatedAttributes() + { + $class = static::class; + + if (! isset(static::$mutatorCache[$class])) { + static::cacheMutatedAttributes($class); + } + + return static::$mutatorCache[$class]; + } + + /** + * Extract and cache all the mutated attributes of a class. + * + * @param string $class + * @return void + */ + public static function cacheMutatedAttributes($class) + { + static::$mutatorCache[$class] = collect(static::getMutatorMethods($class))->map(function ($match) { + return lcfirst(static::$snakeAttributes ? Str::snake($match) : $match); + })->all(); + } + + /** + * Get all of the attribute mutator methods. + * + * @param mixed $class + * @return array + */ + protected static function getMutatorMethods($class) + { + preg_match_all('/(?<=^|;)get([^;]+?)Attribute(;|$)/', implode(';', get_class_methods($class)), $matches); + + return $matches[1]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php new file mode 100644 index 0000000..720266d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php @@ -0,0 +1,354 @@ +registerObserver($class); + } + } + + /** + * Register a single observer with the model. + * + * @param object|string $class + * @return void + */ + protected function registerObserver($class) + { + $className = is_string($class) ? $class : get_class($class); + + // When registering a model observer, we will spin through the possible events + // and determine if this observer has that method. If it does, we will hook + // it into the model's event system, making it convenient to watch these. + foreach ($this->getObservableEvents() as $event) { + if (method_exists($class, $event)) { + static::registerModelEvent($event, $className.'@'.$event); + } + } + } + + /** + * Get the observable event names. + * + * @return array + */ + public function getObservableEvents() + { + return array_merge( + [ + 'retrieved', 'creating', 'created', 'updating', 'updated', + 'saving', 'saved', 'restoring', 'restored', + 'deleting', 'deleted', 'forceDeleted', + ], + $this->observables + ); + } + + /** + * Set the observable event names. + * + * @param array $observables + * @return $this + */ + public function setObservableEvents(array $observables) + { + $this->observables = $observables; + + return $this; + } + + /** + * Add an observable event name. + * + * @param array|mixed $observables + * @return void + */ + public function addObservableEvents($observables) + { + $this->observables = array_unique(array_merge( + $this->observables, is_array($observables) ? $observables : func_get_args() + )); + } + + /** + * Remove an observable event name. + * + * @param array|mixed $observables + * @return void + */ + public function removeObservableEvents($observables) + { + $this->observables = array_diff( + $this->observables, is_array($observables) ? $observables : func_get_args() + ); + } + + /** + * Register a model event with the dispatcher. + * + * @param string $event + * @param \Closure|string $callback + * @return void + */ + protected static function registerModelEvent($event, $callback) + { + if (isset(static::$dispatcher)) { + $name = static::class; + + static::$dispatcher->listen("eloquent.{$event}: {$name}", $callback); + } + } + + /** + * Fire the given event for the model. + * + * @param string $event + * @param bool $halt + * @return mixed + */ + protected function fireModelEvent($event, $halt = true) + { + if (! isset(static::$dispatcher)) { + return true; + } + + // First, we will get the proper method to call on the event dispatcher, and then we + // will attempt to fire a custom, object based event for the given event. If that + // returns a result we can return that result, or we'll call the string events. + $method = $halt ? 'until' : 'dispatch'; + + $result = $this->filterModelEventResults( + $this->fireCustomModelEvent($event, $method) + ); + + if ($result === false) { + return false; + } + + return ! empty($result) ? $result : static::$dispatcher->{$method}( + "eloquent.{$event}: ".static::class, $this + ); + } + + /** + * Fire a custom model event for the given event. + * + * @param string $event + * @param string $method + * @return mixed|null + */ + protected function fireCustomModelEvent($event, $method) + { + if (! isset($this->dispatchesEvents[$event])) { + return; + } + + $result = static::$dispatcher->$method(new $this->dispatchesEvents[$event]($this)); + + if (! is_null($result)) { + return $result; + } + } + + /** + * Filter the model event results. + * + * @param mixed $result + * @return mixed + */ + protected function filterModelEventResults($result) + { + if (is_array($result)) { + $result = array_filter($result, function ($response) { + return ! is_null($response); + }); + } + + return $result; + } + + /** + * Register a retrieved model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function retrieved($callback) + { + static::registerModelEvent('retrieved', $callback); + } + + /** + * Register a saving model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function saving($callback) + { + static::registerModelEvent('saving', $callback); + } + + /** + * Register a saved model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function saved($callback) + { + static::registerModelEvent('saved', $callback); + } + + /** + * Register an updating model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function updating($callback) + { + static::registerModelEvent('updating', $callback); + } + + /** + * Register an updated model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function updated($callback) + { + static::registerModelEvent('updated', $callback); + } + + /** + * Register a creating model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function creating($callback) + { + static::registerModelEvent('creating', $callback); + } + + /** + * Register a created model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function created($callback) + { + static::registerModelEvent('created', $callback); + } + + /** + * Register a deleting model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function deleting($callback) + { + static::registerModelEvent('deleting', $callback); + } + + /** + * Register a deleted model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function deleted($callback) + { + static::registerModelEvent('deleted', $callback); + } + + /** + * Remove all of the event listeners for the model. + * + * @return void + */ + public static function flushEventListeners() + { + if (! isset(static::$dispatcher)) { + return; + } + + $instance = new static; + + foreach ($instance->getObservableEvents() as $event) { + static::$dispatcher->forget("eloquent.{$event}: ".static::class); + } + + foreach (array_values($instance->dispatchesEvents) as $event) { + static::$dispatcher->forget($event); + } + } + + /** + * Get the event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public static function getEventDispatcher() + { + return static::$dispatcher; + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher + * @return void + */ + public static function setEventDispatcher(Dispatcher $dispatcher) + { + static::$dispatcher = $dispatcher; + } + + /** + * Unset the event dispatcher for models. + * + * @return void + */ + public static function unsetEventDispatcher() + { + static::$dispatcher = null; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php new file mode 100644 index 0000000..97a549f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasGlobalScopes.php @@ -0,0 +1,71 @@ +newRelatedInstance($related); + + $foreignKey = $foreignKey ?: $this->getForeignKey(); + + $localKey = $localKey ?: $this->getKeyName(); + + return $this->newHasOne($instance->newQuery(), $this, $instance->getTable().'.'.$foreignKey, $localKey); + } + + /** + * Instantiate a new HasOne relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $foreignKey + * @param string $localKey + * @return \Illuminate\Database\Eloquent\Relations\HasOne + */ + protected function newHasOne(Builder $query, Model $parent, $foreignKey, $localKey) + { + return new HasOne($query, $parent, $foreignKey, $localKey); + } + + /** + * Define a polymorphic one-to-one relationship. + * + * @param string $related + * @param string $name + * @param string $type + * @param string $id + * @param string $localKey + * @return \Illuminate\Database\Eloquent\Relations\MorphOne + */ + public function morphOne($related, $name, $type = null, $id = null, $localKey = null) + { + $instance = $this->newRelatedInstance($related); + + [$type, $id] = $this->getMorphs($name, $type, $id); + + $table = $instance->getTable(); + + $localKey = $localKey ?: $this->getKeyName(); + + return $this->newMorphOne($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey); + } + + /** + * Instantiate a new MorphOne relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $type + * @param string $id + * @param string $localKey + * @return \Illuminate\Database\Eloquent\Relations\MorphOne + */ + protected function newMorphOne(Builder $query, Model $parent, $type, $id, $localKey) + { + return new MorphOne($query, $parent, $type, $id, $localKey); + } + + /** + * Define an inverse one-to-one or many relationship. + * + * @param string $related + * @param string $foreignKey + * @param string $ownerKey + * @param string $relation + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function belongsTo($related, $foreignKey = null, $ownerKey = null, $relation = null) + { + // If no relation name was given, we will use this debug backtrace to extract + // the calling method's name and use that as the relationship name as most + // of the time this will be what we desire to use for the relationships. + if (is_null($relation)) { + $relation = $this->guessBelongsToRelation(); + } + + $instance = $this->newRelatedInstance($related); + + // If no foreign key was supplied, we can use a backtrace to guess the proper + // foreign key name by using the name of the relationship function, which + // when combined with an "_id" should conventionally match the columns. + if (is_null($foreignKey)) { + $foreignKey = Str::snake($relation).'_'.$instance->getKeyName(); + } + + // Once we have the foreign key names, we'll just create a new Eloquent query + // for the related models and returns the relationship instance which will + // actually be responsible for retrieving and hydrating every relations. + $ownerKey = $ownerKey ?: $instance->getKeyName(); + + return $this->newBelongsTo( + $instance->newQuery(), $this, $foreignKey, $ownerKey, $relation + ); + } + + /** + * Instantiate a new BelongsTo relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $child + * @param string $foreignKey + * @param string $ownerKey + * @param string $relation + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + protected function newBelongsTo(Builder $query, Model $child, $foreignKey, $ownerKey, $relation) + { + return new BelongsTo($query, $child, $foreignKey, $ownerKey, $relation); + } + + /** + * Define a polymorphic, inverse one-to-one or many relationship. + * + * @param string $name + * @param string $type + * @param string $id + * @param string $ownerKey + * @return \Illuminate\Database\Eloquent\Relations\MorphTo + */ + public function morphTo($name = null, $type = null, $id = null, $ownerKey = null) + { + // If no name is provided, we will use the backtrace to get the function name + // since that is most likely the name of the polymorphic interface. We can + // use that to get both the class and foreign key that will be utilized. + $name = $name ?: $this->guessBelongsToRelation(); + + [$type, $id] = $this->getMorphs( + Str::snake($name), $type, $id + ); + + // If the type value is null it is probably safe to assume we're eager loading + // the relationship. In this case we'll just pass in a dummy query where we + // need to remove any eager loads that may already be defined on a model. + return empty($class = $this->{$type}) + ? $this->morphEagerTo($name, $type, $id, $ownerKey) + : $this->morphInstanceTo($class, $name, $type, $id, $ownerKey); + } + + /** + * Define a polymorphic, inverse one-to-one or many relationship. + * + * @param string $name + * @param string $type + * @param string $id + * @param string $ownerKey + * @return \Illuminate\Database\Eloquent\Relations\MorphTo + */ + protected function morphEagerTo($name, $type, $id, $ownerKey) + { + return $this->newMorphTo( + $this->newQuery()->setEagerLoads([]), $this, $id, $ownerKey, $type, $name + ); + } + + /** + * Define a polymorphic, inverse one-to-one or many relationship. + * + * @param string $target + * @param string $name + * @param string $type + * @param string $id + * @param string $ownerKey + * @return \Illuminate\Database\Eloquent\Relations\MorphTo + */ + protected function morphInstanceTo($target, $name, $type, $id, $ownerKey) + { + $instance = $this->newRelatedInstance( + static::getActualClassNameForMorph($target) + ); + + return $this->newMorphTo( + $instance->newQuery(), $this, $id, $ownerKey ?? $instance->getKeyName(), $type, $name + ); + } + + /** + * Instantiate a new MorphTo relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $foreignKey + * @param string $ownerKey + * @param string $type + * @param string $relation + * @return \Illuminate\Database\Eloquent\Relations\MorphTo + */ + protected function newMorphTo(Builder $query, Model $parent, $foreignKey, $ownerKey, $type, $relation) + { + return new MorphTo($query, $parent, $foreignKey, $ownerKey, $type, $relation); + } + + /** + * Retrieve the actual class name for a given morph class. + * + * @param string $class + * @return string + */ + public static function getActualClassNameForMorph($class) + { + return Arr::get(Relation::morphMap() ?: [], $class, $class); + } + + /** + * Guess the "belongs to" relationship name. + * + * @return string + */ + protected function guessBelongsToRelation() + { + [$one, $two, $caller] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); + + return $caller['function']; + } + + /** + * Define a one-to-many relationship. + * + * @param string $related + * @param string $foreignKey + * @param string $localKey + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function hasMany($related, $foreignKey = null, $localKey = null) + { + $instance = $this->newRelatedInstance($related); + + $foreignKey = $foreignKey ?: $this->getForeignKey(); + + $localKey = $localKey ?: $this->getKeyName(); + + return $this->newHasMany( + $instance->newQuery(), $this, $instance->getTable().'.'.$foreignKey, $localKey + ); + } + + /** + * Instantiate a new HasMany relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $foreignKey + * @param string $localKey + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + protected function newHasMany(Builder $query, Model $parent, $foreignKey, $localKey) + { + return new HasMany($query, $parent, $foreignKey, $localKey); + } + + /** + * Define a has-many-through relationship. + * + * @param string $related + * @param string $through + * @param string|null $firstKey + * @param string|null $secondKey + * @param string|null $localKey + * @param string|null $secondLocalKey + * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough + */ + public function hasManyThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null) + { + $through = new $through; + + $firstKey = $firstKey ?: $this->getForeignKey(); + + $secondKey = $secondKey ?: $through->getForeignKey(); + + return $this->newHasManyThrough( + $this->newRelatedInstance($related)->newQuery(), $this, $through, + $firstKey, $secondKey, $localKey ?: $this->getKeyName(), + $secondLocalKey ?: $through->getKeyName() + ); + } + + /** + * Instantiate a new HasManyThrough relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $farParent + * @param \Illuminate\Database\Eloquent\Model $throughParent + * @param string $firstKey + * @param string $secondKey + * @param string $localKey + * @param string $secondLocalKey + * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough + */ + protected function newHasManyThrough(Builder $query, Model $farParent, Model $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey) + { + return new HasManyThrough($query, $farParent, $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey); + } + + /** + * Define a polymorphic one-to-many relationship. + * + * @param string $related + * @param string $name + * @param string $type + * @param string $id + * @param string $localKey + * @return \Illuminate\Database\Eloquent\Relations\MorphMany + */ + public function morphMany($related, $name, $type = null, $id = null, $localKey = null) + { + $instance = $this->newRelatedInstance($related); + + // Here we will gather up the morph type and ID for the relationship so that we + // can properly query the intermediate table of a relation. Finally, we will + // get the table and create the relationship instances for the developers. + [$type, $id] = $this->getMorphs($name, $type, $id); + + $table = $instance->getTable(); + + $localKey = $localKey ?: $this->getKeyName(); + + return $this->newMorphMany($instance->newQuery(), $this, $table.'.'.$type, $table.'.'.$id, $localKey); + } + + /** + * Instantiate a new MorphMany relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $type + * @param string $id + * @param string $localKey + * @return \Illuminate\Database\Eloquent\Relations\MorphMany + */ + protected function newMorphMany(Builder $query, Model $parent, $type, $id, $localKey) + { + return new MorphMany($query, $parent, $type, $id, $localKey); + } + + /** + * Define a many-to-many relationship. + * + * @param string $related + * @param string $table + * @param string $foreignPivotKey + * @param string $relatedPivotKey + * @param string $parentKey + * @param string $relatedKey + * @param string $relation + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + */ + public function belongsToMany($related, $table = null, $foreignPivotKey = null, $relatedPivotKey = null, + $parentKey = null, $relatedKey = null, $relation = null) + { + // If no relationship name was passed, we will pull backtraces to get the + // name of the calling function. We will use that function name as the + // title of this relation since that is a great convention to apply. + if (is_null($relation)) { + $relation = $this->guessBelongsToManyRelation(); + } + + // First, we'll need to determine the foreign key and "other key" for the + // relationship. Once we have determined the keys we'll make the query + // instances as well as the relationship instances we need for this. + $instance = $this->newRelatedInstance($related); + + $foreignPivotKey = $foreignPivotKey ?: $this->getForeignKey(); + + $relatedPivotKey = $relatedPivotKey ?: $instance->getForeignKey(); + + // If no table name was provided, we can guess it by concatenating the two + // models using underscores in alphabetical order. The two model names + // are transformed to snake case from their default CamelCase also. + if (is_null($table)) { + $table = $this->joiningTable($related, $instance); + } + + return $this->newBelongsToMany( + $instance->newQuery(), $this, $table, $foreignPivotKey, + $relatedPivotKey, $parentKey ?: $this->getKeyName(), + $relatedKey ?: $instance->getKeyName(), $relation + ); + } + + /** + * Instantiate a new BelongsToMany relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $table + * @param string $foreignPivotKey + * @param string $relatedPivotKey + * @param string $parentKey + * @param string $relatedKey + * @param string $relationName + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + */ + protected function newBelongsToMany(Builder $query, Model $parent, $table, $foreignPivotKey, $relatedPivotKey, + $parentKey, $relatedKey, $relationName = null) + { + return new BelongsToMany($query, $parent, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, $relationName); + } + + /** + * Define a polymorphic many-to-many relationship. + * + * @param string $related + * @param string $name + * @param string $table + * @param string $foreignPivotKey + * @param string $relatedPivotKey + * @param string $parentKey + * @param string $relatedKey + * @param bool $inverse + * @return \Illuminate\Database\Eloquent\Relations\MorphToMany + */ + public function morphToMany($related, $name, $table = null, $foreignPivotKey = null, + $relatedPivotKey = null, $parentKey = null, + $relatedKey = null, $inverse = false) + { + $caller = $this->guessBelongsToManyRelation(); + + // First, we will need to determine the foreign key and "other key" for the + // relationship. Once we have determined the keys we will make the query + // instances, as well as the relationship instances we need for these. + $instance = $this->newRelatedInstance($related); + + $foreignPivotKey = $foreignPivotKey ?: $name.'_id'; + + $relatedPivotKey = $relatedPivotKey ?: $instance->getForeignKey(); + + // Now we're ready to create a new query builder for this related model and + // the relationship instances for this relation. This relations will set + // appropriate query constraints then entirely manages the hydrations. + $table = $table ?: Str::plural($name); + + return $this->newMorphToMany( + $instance->newQuery(), $this, $name, $table, + $foreignPivotKey, $relatedPivotKey, $parentKey ?: $this->getKeyName(), + $relatedKey ?: $instance->getKeyName(), $caller, $inverse + ); + } + + /** + * Instantiate a new MorphToMany relationship. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Model $parent + * @param string $name + * @param string $table + * @param string $foreignPivotKey + * @param string $relatedPivotKey + * @param string $parentKey + * @param string $relatedKey + * @param string $relationName + * @param bool $inverse + * @return \Illuminate\Database\Eloquent\Relations\MorphToMany + */ + protected function newMorphToMany(Builder $query, Model $parent, $name, $table, $foreignPivotKey, + $relatedPivotKey, $parentKey, $relatedKey, + $relationName = null, $inverse = false) + { + return new MorphToMany($query, $parent, $name, $table, $foreignPivotKey, $relatedPivotKey, $parentKey, $relatedKey, + $relationName, $inverse); + } + + /** + * Define a polymorphic, inverse many-to-many relationship. + * + * @param string $related + * @param string $name + * @param string $table + * @param string $foreignPivotKey + * @param string $relatedPivotKey + * @param string $parentKey + * @param string $relatedKey + * @return \Illuminate\Database\Eloquent\Relations\MorphToMany + */ + public function morphedByMany($related, $name, $table = null, $foreignPivotKey = null, + $relatedPivotKey = null, $parentKey = null, $relatedKey = null) + { + $foreignPivotKey = $foreignPivotKey ?: $this->getForeignKey(); + + // For the inverse of the polymorphic many-to-many relations, we will change + // the way we determine the foreign and other keys, as it is the opposite + // of the morph-to-many method since we're figuring out these inverses. + $relatedPivotKey = $relatedPivotKey ?: $name.'_id'; + + return $this->morphToMany( + $related, $name, $table, $foreignPivotKey, + $relatedPivotKey, $parentKey, $relatedKey, true + ); + } + + /** + * Get the relationship name of the belongsToMany relationship. + * + * @return string|null + */ + protected function guessBelongsToManyRelation() + { + $caller = Arr::first(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), function ($trace) { + return ! in_array( + $trace['function'], + array_merge(static::$manyMethods, ['guessBelongsToManyRelation']) + ); + }); + + return ! is_null($caller) ? $caller['function'] : null; + } + + /** + * Get the joining table name for a many-to-many relation. + * + * @param string $related + * @param \Illuminate\Database\Eloquent\Model|null $instance + * @return string + */ + public function joiningTable($related, $instance = null) + { + // The joining table name, by convention, is simply the snake cased models + // sorted alphabetically and concatenated with an underscore, so we can + // just sort the models and join them together to get the table name. + $segments = [ + $instance ? $instance->joiningTableSegment() + : Str::snake(class_basename($related)), + $this->joiningTableSegment(), + ]; + + // Now that we have the model names in an array we can just sort them and + // use the implode function to join them together with an underscores, + // which is typically used by convention within the database system. + sort($segments); + + return strtolower(implode('_', $segments)); + } + + /** + * Get this model's half of the intermediate table name for belongsToMany relationships. + * + * @return string + */ + public function joiningTableSegment() + { + return Str::snake(class_basename($this)); + } + + /** + * Determine if the model touches a given relation. + * + * @param string $relation + * @return bool + */ + public function touches($relation) + { + return in_array($relation, $this->touches); + } + + /** + * Touch the owning relations of the model. + * + * @return void + */ + public function touchOwners() + { + foreach ($this->touches as $relation) { + $this->$relation()->touch(); + + if ($this->$relation instanceof self) { + $this->$relation->fireModelEvent('saved', false); + + $this->$relation->touchOwners(); + } elseif ($this->$relation instanceof Collection) { + $this->$relation->each(function (Model $relation) { + $relation->touchOwners(); + }); + } + } + } + + /** + * Get the polymorphic relationship columns. + * + * @param string $name + * @param string $type + * @param string $id + * @return array + */ + protected function getMorphs($name, $type, $id) + { + return [$type ?: $name.'_type', $id ?: $name.'_id']; + } + + /** + * Get the class name for polymorphic relations. + * + * @return string + */ + public function getMorphClass() + { + $morphMap = Relation::morphMap(); + + if (! empty($morphMap) && in_array(static::class, $morphMap)) { + return array_search(static::class, $morphMap, true); + } + + return static::class; + } + + /** + * Create a new model instance for a related model. + * + * @param string $class + * @return mixed + */ + protected function newRelatedInstance($class) + { + return tap(new $class, function ($instance) { + if (! $instance->getConnectionName()) { + $instance->setConnection($this->connection); + } + }); + } + + /** + * Get all the loaded relations for the instance. + * + * @return array + */ + public function getRelations() + { + return $this->relations; + } + + /** + * Get a specified relationship. + * + * @param string $relation + * @return mixed + */ + public function getRelation($relation) + { + return $this->relations[$relation]; + } + + /** + * Determine if the given relation is loaded. + * + * @param string $key + * @return bool + */ + public function relationLoaded($key) + { + return array_key_exists($key, $this->relations); + } + + /** + * Set the given relationship on the model. + * + * @param string $relation + * @param mixed $value + * @return $this + */ + public function setRelation($relation, $value) + { + $this->relations[$relation] = $value; + + return $this; + } + + /** + * Unset a loaded relationship. + * + * @param string $relation + * @return $this + */ + public function unsetRelation($relation) + { + unset($this->relations[$relation]); + + return $this; + } + + /** + * Set the entire relations array on the model. + * + * @param array $relations + * @return $this + */ + public function setRelations(array $relations) + { + $this->relations = $relations; + + return $this; + } + + /** + * Get the relationships that are touched on save. + * + * @return array + */ + public function getTouchedRelations() + { + return $this->touches; + } + + /** + * Set the relationships that are touched on save. + * + * @param array $touches + * @return $this + */ + public function setTouchedRelations(array $touches) + { + $this->touches = $touches; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php new file mode 100644 index 0000000..8e3d488 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasTimestamps.php @@ -0,0 +1,126 @@ +usesTimestamps()) { + return false; + } + + $this->updateTimestamps(); + + return $this->save(); + } + + /** + * Update the creation and update timestamps. + * + * @return void + */ + protected function updateTimestamps() + { + $time = $this->freshTimestamp(); + + if (! is_null(static::UPDATED_AT) && ! $this->isDirty(static::UPDATED_AT)) { + $this->setUpdatedAt($time); + } + + if (! $this->exists && ! is_null(static::CREATED_AT) && + ! $this->isDirty(static::CREATED_AT)) { + $this->setCreatedAt($time); + } + } + + /** + * Set the value of the "created at" attribute. + * + * @param mixed $value + * @return $this + */ + public function setCreatedAt($value) + { + $this->{static::CREATED_AT} = $value; + + return $this; + } + + /** + * Set the value of the "updated at" attribute. + * + * @param mixed $value + * @return $this + */ + public function setUpdatedAt($value) + { + $this->{static::UPDATED_AT} = $value; + + return $this; + } + + /** + * Get a fresh timestamp for the model. + * + * @return \Illuminate\Support\Carbon + */ + public function freshTimestamp() + { + return new Carbon; + } + + /** + * Get a fresh timestamp for the model. + * + * @return string + */ + public function freshTimestampString() + { + return $this->fromDateTime($this->freshTimestamp()); + } + + /** + * Determine if the model uses timestamps. + * + * @return bool + */ + public function usesTimestamps() + { + return $this->timestamps; + } + + /** + * Get the name of the "created at" column. + * + * @return string + */ + public function getCreatedAtColumn() + { + return static::CREATED_AT; + } + + /** + * Get the name of the "updated at" column. + * + * @return string + */ + public function getUpdatedAtColumn() + { + return static::UPDATED_AT; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php new file mode 100644 index 0000000..7bd9ef9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php @@ -0,0 +1,126 @@ +hidden; + } + + /** + * Set the hidden attributes for the model. + * + * @param array $hidden + * @return $this + */ + public function setHidden(array $hidden) + { + $this->hidden = $hidden; + + return $this; + } + + /** + * Add hidden attributes for the model. + * + * @param array|string|null $attributes + * @return void + */ + public function addHidden($attributes = null) + { + $this->hidden = array_merge( + $this->hidden, is_array($attributes) ? $attributes : func_get_args() + ); + } + + /** + * Get the visible attributes for the model. + * + * @return array + */ + public function getVisible() + { + return $this->visible; + } + + /** + * Set the visible attributes for the model. + * + * @param array $visible + * @return $this + */ + public function setVisible(array $visible) + { + $this->visible = $visible; + + return $this; + } + + /** + * Add visible attributes for the model. + * + * @param array|string|null $attributes + * @return void + */ + public function addVisible($attributes = null) + { + $this->visible = array_merge( + $this->visible, is_array($attributes) ? $attributes : func_get_args() + ); + } + + /** + * Make the given, typically hidden, attributes visible. + * + * @param array|string $attributes + * @return $this + */ + public function makeVisible($attributes) + { + $this->hidden = array_diff($this->hidden, (array) $attributes); + + if (! empty($this->visible)) { + $this->addVisible($attributes); + } + + return $this; + } + + /** + * Make the given, typically visible, attributes hidden. + * + * @param array|string $attributes + * @return $this + */ + public function makeHidden($attributes) + { + $attributes = (array) $attributes; + + $this->visible = array_diff($this->visible, $attributes); + + $this->hidden = array_unique(array_merge($this->hidden, $attributes)); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php new file mode 100644 index 0000000..be14321 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php @@ -0,0 +1,327 @@ +=', $count = 1, $boolean = 'and', Closure $callback = null) + { + if (strpos($relation, '.') !== false) { + return $this->hasNested($relation, $operator, $count, $boolean, $callback); + } + + $relation = $this->getRelationWithoutConstraints($relation); + + if ($relation instanceof MorphTo) { + throw new RuntimeException('has() and whereHas() do not support MorphTo relationships.'); + } + + // If we only need to check for the existence of the relation, then we can optimize + // the subquery to only run a "where exists" clause instead of this full "count" + // clause. This will make these queries run much faster compared with a count. + $method = $this->canUseExistsForExistenceCheck($operator, $count) + ? 'getRelationExistenceQuery' + : 'getRelationExistenceCountQuery'; + + $hasQuery = $relation->{$method}( + $relation->getRelated()->newQueryWithoutRelationships(), $this + ); + + // Next we will call any given callback as an "anonymous" scope so they can get the + // proper logical grouping of the where clauses if needed by this Eloquent query + // builder. Then, we will be ready to finalize and return this query instance. + if ($callback) { + $hasQuery->callScope($callback); + } + + return $this->addHasWhere( + $hasQuery, $relation, $operator, $count, $boolean + ); + } + + /** + * Add nested relationship count / exists conditions to the query. + * + * Sets up recursive call to whereHas until we finish the nested relation. + * + * @param string $relations + * @param string $operator + * @param int $count + * @param string $boolean + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + protected function hasNested($relations, $operator = '>=', $count = 1, $boolean = 'and', $callback = null) + { + $relations = explode('.', $relations); + + $doesntHave = $operator === '<' && $count === 1; + + if ($doesntHave) { + $operator = '>='; + $count = 1; + } + + $closure = function ($q) use (&$closure, &$relations, $operator, $count, $callback) { + // In order to nest "has", we need to add count relation constraints on the + // callback Closure. We'll do this by simply passing the Closure its own + // reference to itself so it calls itself recursively on each segment. + count($relations) > 1 + ? $q->whereHas(array_shift($relations), $closure) + : $q->has(array_shift($relations), $operator, $count, 'and', $callback); + }; + + return $this->has(array_shift($relations), $doesntHave ? '<' : '>=', 1, $boolean, $closure); + } + + /** + * Add a relationship count / exists condition to the query with an "or". + * + * @param string $relation + * @param string $operator + * @param int $count + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orHas($relation, $operator = '>=', $count = 1) + { + return $this->has($relation, $operator, $count, 'or'); + } + + /** + * Add a relationship count / exists condition to the query. + * + * @param string $relation + * @param string $boolean + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function doesntHave($relation, $boolean = 'and', Closure $callback = null) + { + return $this->has($relation, '<', 1, $boolean, $callback); + } + + /** + * Add a relationship count / exists condition to the query with an "or". + * + * @param string $relation + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orDoesntHave($relation) + { + return $this->doesntHave($relation, 'or'); + } + + /** + * Add a relationship count / exists condition to the query with where clauses. + * + * @param string $relation + * @param \Closure|null $callback + * @param string $operator + * @param int $count + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function whereHas($relation, Closure $callback = null, $operator = '>=', $count = 1) + { + return $this->has($relation, $operator, $count, 'and', $callback); + } + + /** + * Add a relationship count / exists condition to the query with where clauses and an "or". + * + * @param string $relation + * @param \Closure $callback + * @param string $operator + * @param int $count + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orWhereHas($relation, Closure $callback = null, $operator = '>=', $count = 1) + { + return $this->has($relation, $operator, $count, 'or', $callback); + } + + /** + * Add a relationship count / exists condition to the query with where clauses. + * + * @param string $relation + * @param \Closure|null $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function whereDoesntHave($relation, Closure $callback = null) + { + return $this->doesntHave($relation, 'and', $callback); + } + + /** + * Add a relationship count / exists condition to the query with where clauses and an "or". + * + * @param string $relation + * @param \Closure $callback + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function orWhereDoesntHave($relation, Closure $callback = null) + { + return $this->doesntHave($relation, 'or', $callback); + } + + /** + * Add subselect queries to count the relations. + * + * @param mixed $relations + * @return $this + */ + public function withCount($relations) + { + if (empty($relations)) { + return $this; + } + + if (is_null($this->query->columns)) { + $this->query->select([$this->query->from.'.*']); + } + + $relations = is_array($relations) ? $relations : func_get_args(); + + foreach ($this->parseWithRelations($relations) as $name => $constraints) { + // First we will determine if the name has been aliased using an "as" clause on the name + // and if it has we will extract the actual relationship name and the desired name of + // the resulting column. This allows multiple counts on the same relationship name. + $segments = explode(' ', $name); + + unset($alias); + + if (count($segments) === 3 && Str::lower($segments[1]) === 'as') { + [$name, $alias] = [$segments[0], $segments[2]]; + } + + $relation = $this->getRelationWithoutConstraints($name); + + // Here we will get the relationship count query and prepare to add it to the main query + // as a sub-select. First, we'll get the "has" query and use that to get the relation + // count query. We will normalize the relation name then append _count as the name. + $query = $relation->getRelationExistenceCountQuery( + $relation->getRelated()->newQuery(), $this + ); + + $query->callScope($constraints); + + $query = $query->mergeConstraintsFrom($relation->getQuery())->toBase(); + + if (count($query->columns) > 1) { + $query->columns = [$query->columns[0]]; + } + + // Finally we will add the proper result column alias to the query and run the subselect + // statement against the query builder. Then we will return the builder instance back + // to the developer for further constraint chaining that needs to take place on it. + $column = $alias ?? Str::snake($name.'_count'); + + $this->selectSub($query, $column); + } + + return $this; + } + + /** + * Add the "has" condition where clause to the query. + * + * @param \Illuminate\Database\Eloquent\Builder $hasQuery + * @param \Illuminate\Database\Eloquent\Relations\Relation $relation + * @param string $operator + * @param int $count + * @param string $boolean + * @return \Illuminate\Database\Eloquent\Builder|static + */ + protected function addHasWhere(Builder $hasQuery, Relation $relation, $operator, $count, $boolean) + { + $hasQuery->mergeConstraintsFrom($relation->getQuery()); + + return $this->canUseExistsForExistenceCheck($operator, $count) + ? $this->addWhereExistsQuery($hasQuery->toBase(), $boolean, $operator === '<' && $count === 1) + : $this->addWhereCountQuery($hasQuery->toBase(), $operator, $count, $boolean); + } + + /** + * Merge the where constraints from another query to the current query. + * + * @param \Illuminate\Database\Eloquent\Builder $from + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function mergeConstraintsFrom(Builder $from) + { + $whereBindings = $from->getQuery()->getRawBindings()['where'] ?? []; + + // Here we have some other query that we want to merge the where constraints from. We will + // copy over any where constraints on the query as well as remove any global scopes the + // query might have removed. Then we will return ourselves with the finished merging. + return $this->withoutGlobalScopes( + $from->removedScopes() + )->mergeWheres( + $from->getQuery()->wheres, $whereBindings + ); + } + + /** + * Add a sub-query count clause to this query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $operator + * @param int $count + * @param string $boolean + * @return $this + */ + protected function addWhereCountQuery(QueryBuilder $query, $operator = '>=', $count = 1, $boolean = 'and') + { + $this->query->addBinding($query->getBindings(), 'where'); + + return $this->where( + new Expression('('.$query->toSql().')'), + $operator, + is_numeric($count) ? new Expression($count) : $count, + $boolean + ); + } + + /** + * Get the "has relation" base query instance. + * + * @param string $relation + * @return \Illuminate\Database\Eloquent\Relations\Relation + */ + protected function getRelationWithoutConstraints($relation) + { + return Relation::noConstraints(function () use ($relation) { + return $this->getModel()->{$relation}(); + }); + } + + /** + * Check if we can run an "exists" query to optimize performance. + * + * @param string $operator + * @param int $count + * @return bool + */ + protected function canUseExistsForExistenceCheck($operator, $count) + { + return ($operator === '>=' || $operator === '<') && $count === 1; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php new file mode 100644 index 0000000..82917ae --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php @@ -0,0 +1,326 @@ +faker = $faker; + } + + /** + * Create a new factory container. + * + * @param \Faker\Generator $faker + * @param string|null $pathToFactories + * @return static + */ + public static function construct(Faker $faker, $pathToFactories = null) + { + $pathToFactories = $pathToFactories ?: database_path('factories'); + + return (new static($faker))->load($pathToFactories); + } + + /** + * Define a class with a given short-name. + * + * @param string $class + * @param string $name + * @param callable $attributes + * @return $this + */ + public function defineAs($class, $name, callable $attributes) + { + return $this->define($class, $attributes, $name); + } + + /** + * Define a class with a given set of attributes. + * + * @param string $class + * @param callable $attributes + * @param string $name + * @return $this + */ + public function define($class, callable $attributes, $name = 'default') + { + $this->definitions[$class][$name] = $attributes; + + return $this; + } + + /** + * Define a state with a given set of attributes. + * + * @param string $class + * @param string $state + * @param callable|array $attributes + * @return $this + */ + public function state($class, $state, $attributes) + { + $this->states[$class][$state] = $attributes; + + return $this; + } + + /** + * Define a callback to run after making a model. + * + * @param string $class + * @param callable $callback + * @param string $name + * @return $this + */ + public function afterMaking($class, callable $callback, $name = 'default') + { + $this->afterMaking[$class][$name][] = $callback; + + return $this; + } + + /** + * Define a callback to run after making a model with given state. + * + * @param string $class + * @param string $state + * @param callable $callback + * @return $this + */ + public function afterMakingState($class, $state, callable $callback) + { + return $this->afterMaking($class, $callback, $state); + } + + /** + * Define a callback to run after creating a model. + * + * @param string $class + * @param callable $callback + * @param string $name + * @return $this + */ + public function afterCreating($class, callable $callback, $name = 'default') + { + $this->afterCreating[$class][$name][] = $callback; + + return $this; + } + + /** + * Define a callback to run after creating a model with given state. + * + * @param string $class + * @param string $state + * @param callable $callback + * @return $this + */ + public function afterCreatingState($class, $state, callable $callback) + { + return $this->afterCreating($class, $callback, $state); + } + + /** + * Create an instance of the given model and persist it to the database. + * + * @param string $class + * @param array $attributes + * @return mixed + */ + public function create($class, array $attributes = []) + { + return $this->of($class)->create($attributes); + } + + /** + * Create an instance of the given model and type and persist it to the database. + * + * @param string $class + * @param string $name + * @param array $attributes + * @return mixed + */ + public function createAs($class, $name, array $attributes = []) + { + return $this->of($class, $name)->create($attributes); + } + + /** + * Create an instance of the given model. + * + * @param string $class + * @param array $attributes + * @return mixed + */ + public function make($class, array $attributes = []) + { + return $this->of($class)->make($attributes); + } + + /** + * Create an instance of the given model and type. + * + * @param string $class + * @param string $name + * @param array $attributes + * @return mixed + */ + public function makeAs($class, $name, array $attributes = []) + { + return $this->of($class, $name)->make($attributes); + } + + /** + * Get the raw attribute array for a given named model. + * + * @param string $class + * @param string $name + * @param array $attributes + * @return array + */ + public function rawOf($class, $name, array $attributes = []) + { + return $this->raw($class, $attributes, $name); + } + + /** + * Get the raw attribute array for a given model. + * + * @param string $class + * @param array $attributes + * @param string $name + * @return array + */ + public function raw($class, array $attributes = [], $name = 'default') + { + return array_merge( + call_user_func($this->definitions[$class][$name], $this->faker), $attributes + ); + } + + /** + * Create a builder for the given model. + * + * @param string $class + * @param string $name + * @return \Illuminate\Database\Eloquent\FactoryBuilder + */ + public function of($class, $name = 'default') + { + return new FactoryBuilder( + $class, $name, $this->definitions, $this->states, + $this->afterMaking, $this->afterCreating, $this->faker + ); + } + + /** + * Load factories from path. + * + * @param string $path + * @return $this + */ + public function load($path) + { + $factory = $this; + + if (is_dir($path)) { + foreach (Finder::create()->files()->name('*.php')->in($path) as $file) { + require $file->getRealPath(); + } + } + + return $factory; + } + + /** + * Determine if the given offset exists. + * + * @param string $offset + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->definitions[$offset]); + } + + /** + * Get the value of the given offset. + * + * @param string $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->make($offset); + } + + /** + * Set the given offset to the given value. + * + * @param string $offset + * @param callable $value + * @return void + */ + public function offsetSet($offset, $value) + { + return $this->define($offset, $value); + } + + /** + * Unset the value at the given offset. + * + * @param string $offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->definitions[$offset]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php new file mode 100644 index 0000000..87bb0d8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php @@ -0,0 +1,448 @@ +name = $name; + $this->class = $class; + $this->faker = $faker; + $this->states = $states; + $this->definitions = $definitions; + $this->afterMaking = $afterMaking; + $this->afterCreating = $afterCreating; + } + + /** + * Set the amount of models you wish to create / make. + * + * @param int $amount + * @return $this + */ + public function times($amount) + { + $this->amount = $amount; + + return $this; + } + + /** + * Set the state to be applied to the model. + * + * @param string $state + * @return $this + */ + public function state($state) + { + return $this->states([$state]); + } + + /** + * Set the states to be applied to the model. + * + * @param array|mixed $states + * @return $this + */ + public function states($states) + { + $this->activeStates = is_array($states) ? $states : func_get_args(); + + return $this; + } + + /** + * Set the database connection on which the model instance should be persisted. + * + * @param string $name + * @return $this + */ + public function connection($name) + { + $this->connection = $name; + + return $this; + } + + /** + * Create a model and persist it in the database if requested. + * + * @param array $attributes + * @return \Closure + */ + public function lazy(array $attributes = []) + { + return function () use ($attributes) { + return $this->create($attributes); + }; + } + + /** + * Create a collection of models and persist them to the database. + * + * @param array $attributes + * @return mixed + */ + public function create(array $attributes = []) + { + $results = $this->make($attributes); + + if ($results instanceof Model) { + $this->store(collect([$results])); + + $this->callAfterCreating(collect([$results])); + } else { + $this->store($results); + + $this->callAfterCreating($results); + } + + return $results; + } + + /** + * Set the connection name on the results and store them. + * + * @param \Illuminate\Support\Collection $results + * @return void + */ + protected function store($results) + { + $results->each(function ($model) { + if (! isset($this->connection)) { + $model->setConnection($model->newQueryWithoutScopes()->getConnection()->getName()); + } + + $model->save(); + }); + } + + /** + * Create a collection of models. + * + * @param array $attributes + * @return mixed + */ + public function make(array $attributes = []) + { + if ($this->amount === null) { + return tap($this->makeInstance($attributes), function ($instance) { + $this->callAfterMaking(collect([$instance])); + }); + } + + if ($this->amount < 1) { + return (new $this->class)->newCollection(); + } + + $instances = (new $this->class)->newCollection(array_map(function () use ($attributes) { + return $this->makeInstance($attributes); + }, range(1, $this->amount))); + + $this->callAfterMaking($instances); + + return $instances; + } + + /** + * Create an array of raw attribute arrays. + * + * @param array $attributes + * @return mixed + */ + public function raw(array $attributes = []) + { + if ($this->amount === null) { + return $this->getRawAttributes($attributes); + } + + if ($this->amount < 1) { + return []; + } + + return array_map(function () use ($attributes) { + return $this->getRawAttributes($attributes); + }, range(1, $this->amount)); + } + + /** + * Get a raw attributes array for the model. + * + * @param array $attributes + * @return mixed + * + * @throws \InvalidArgumentException + */ + protected function getRawAttributes(array $attributes = []) + { + if (! isset($this->definitions[$this->class][$this->name])) { + throw new InvalidArgumentException("Unable to locate factory with name [{$this->name}] [{$this->class}]."); + } + + $definition = call_user_func( + $this->definitions[$this->class][$this->name], + $this->faker, $attributes + ); + + return $this->expandAttributes( + array_merge($this->applyStates($definition, $attributes), $attributes) + ); + } + + /** + * Make an instance of the model with the given attributes. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + protected function makeInstance(array $attributes = []) + { + return Model::unguarded(function () use ($attributes) { + $instance = new $this->class( + $this->getRawAttributes($attributes) + ); + + if (isset($this->connection)) { + $instance->setConnection($this->connection); + } + + return $instance; + }); + } + + /** + * Apply the active states to the model definition array. + * + * @param array $definition + * @param array $attributes + * @return array + * + * @throws \InvalidArgumentException + */ + protected function applyStates(array $definition, array $attributes = []) + { + foreach ($this->activeStates as $state) { + if (! isset($this->states[$this->class][$state])) { + if ($this->stateHasAfterCallback($state)) { + continue; + } + + throw new InvalidArgumentException("Unable to locate [{$state}] state for [{$this->class}]."); + } + + $definition = array_merge( + $definition, + $this->stateAttributes($state, $attributes) + ); + } + + return $definition; + } + + /** + * Get the state attributes. + * + * @param string $state + * @param array $attributes + * @return array + */ + protected function stateAttributes($state, array $attributes) + { + $stateAttributes = $this->states[$this->class][$state]; + + if (! is_callable($stateAttributes)) { + return $stateAttributes; + } + + return call_user_func( + $stateAttributes, + $this->faker, $attributes + ); + } + + /** + * Expand all attributes to their underlying values. + * + * @param array $attributes + * @return array + */ + protected function expandAttributes(array $attributes) + { + foreach ($attributes as &$attribute) { + if (is_callable($attribute) && ! is_string($attribute) && ! is_array($attribute)) { + $attribute = $attribute($attributes); + } + + if ($attribute instanceof static) { + $attribute = $attribute->create()->getKey(); + } + + if ($attribute instanceof Model) { + $attribute = $attribute->getKey(); + } + } + + return $attributes; + } + + /** + * Run after making callbacks on a collection of models. + * + * @param \Illuminate\Support\Collection $models + * @return void + */ + public function callAfterMaking($models) + { + $this->callAfter($this->afterMaking, $models); + } + + /** + * Run after creating callbacks on a collection of models. + * + * @param \Illuminate\Support\Collection $models + * @return void + */ + public function callAfterCreating($models) + { + $this->callAfter($this->afterCreating, $models); + } + + /** + * Call after callbacks for each model and state. + * + * @param array $afterCallbacks + * @param \Illuminate\Support\Collection $models + * @return void + */ + protected function callAfter(array $afterCallbacks, $models) + { + $states = array_merge([$this->name], $this->activeStates); + + $models->each(function ($model) use ($states, $afterCallbacks) { + foreach ($states as $state) { + $this->callAfterCallbacks($afterCallbacks, $model, $state); + } + }); + } + + /** + * Call after callbacks for each model and state. + * + * @param array $afterCallbacks + * @param \Illuminate\Database\Eloquent\Model $model + * @param string $state + * @return void + */ + protected function callAfterCallbacks(array $afterCallbacks, $model, $state) + { + if (! isset($afterCallbacks[$this->class][$state])) { + return; + } + + foreach ($afterCallbacks[$this->class][$state] as $callback) { + $callback($model, $this->faker); + } + } + + /** + * Determine if the given state has an "after" callback. + * + * @param string $state + * @return bool + */ + protected function stateHasAfterCallback($state) + { + return isset($this->afterMaking[$this->class][$state]) || + isset($this->afterCreating[$this->class][$state]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/JsonEncodingException.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/JsonEncodingException.php new file mode 100644 index 0000000..5878b0f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/JsonEncodingException.php @@ -0,0 +1,35 @@ +getKey().'] to JSON: '.$message); + } + + /** + * Create a new JSON encoding exception for an attribute. + * + * @param mixed $model + * @param mixed $key + * @param string $message + * @return static + */ + public static function forAttribute($model, $key, $message) + { + $class = get_class($model); + + return new static("Unable to encode attribute [{$key}] for model [{$class}] to JSON: {$message}."); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/MassAssignmentException.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/MassAssignmentException.php new file mode 100755 index 0000000..7c81aae --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/MassAssignmentException.php @@ -0,0 +1,10 @@ +bootIfNotBooted(); + + $this->initializeTraits(); + + $this->syncOriginal(); + + $this->fill($attributes); + } + + /** + * Check if the model needs to be booted and if so, do it. + * + * @return void + */ + protected function bootIfNotBooted() + { + if (! isset(static::$booted[static::class])) { + static::$booted[static::class] = true; + + $this->fireModelEvent('booting', false); + + static::boot(); + + $this->fireModelEvent('booted', false); + } + } + + /** + * The "booting" method of the model. + * + * @return void + */ + protected static function boot() + { + static::bootTraits(); + } + + /** + * Boot all of the bootable traits on the model. + * + * @return void + */ + protected static function bootTraits() + { + $class = static::class; + + $booted = []; + + static::$traitInitializers[$class] = []; + + foreach (class_uses_recursive($class) as $trait) { + $method = 'boot'.class_basename($trait); + + if (method_exists($class, $method) && ! in_array($method, $booted)) { + forward_static_call([$class, $method]); + + $booted[] = $method; + } + + if (method_exists($class, $method = 'initialize'.class_basename($trait))) { + static::$traitInitializers[$class][] = $method; + + static::$traitInitializers[$class] = array_unique( + static::$traitInitializers[$class] + ); + } + } + } + + /** + * Initialize any initializable traits on the model. + * + * @return void + */ + protected function initializeTraits() + { + foreach (static::$traitInitializers[static::class] as $method) { + $this->{$method}(); + } + } + + /** + * Clear the list of booted models so they will be re-booted. + * + * @return void + */ + public static function clearBootedModels() + { + static::$booted = []; + + static::$globalScopes = []; + } + + /** + * Disables relationship model touching for the current class during given callback scope. + * + * @param callable $callback + * @return void + */ + public static function withoutTouching(callable $callback) + { + static::withoutTouchingOn([static::class], $callback); + } + + /** + * Disables relationship model touching for the given model classes during given callback scope. + * + * @param array $models + * @param callable $callback + * @return void + */ + public static function withoutTouchingOn(array $models, callable $callback) + { + static::$ignoreOnTouch = array_values(array_merge(static::$ignoreOnTouch, $models)); + + try { + call_user_func($callback); + } finally { + static::$ignoreOnTouch = array_values(array_diff(static::$ignoreOnTouch, $models)); + } + } + + /** + * Determine if the given model is ignoring touches. + * + * @param string|null $class + * @return bool + */ + public static function isIgnoringTouch($class = null) + { + $class = $class ?: static::class; + + foreach (static::$ignoreOnTouch as $ignoredClass) { + if ($class === $ignoredClass || is_subclass_of($class, $ignoredClass)) { + return true; + } + } + + return false; + } + + /** + * Fill the model with an array of attributes. + * + * @param array $attributes + * @return $this + * + * @throws \Illuminate\Database\Eloquent\MassAssignmentException + */ + public function fill(array $attributes) + { + $totallyGuarded = $this->totallyGuarded(); + + foreach ($this->fillableFromArray($attributes) as $key => $value) { + $key = $this->removeTableFromKey($key); + + // The developers may choose to place some attributes in the "fillable" array + // which means only those attributes may be set through mass assignment to + // the model, and all others will just get ignored for security reasons. + if ($this->isFillable($key)) { + $this->setAttribute($key, $value); + } elseif ($totallyGuarded) { + throw new MassAssignmentException(sprintf( + 'Add [%s] to fillable property to allow mass assignment on [%s].', + $key, get_class($this) + )); + } + } + + return $this; + } + + /** + * Fill the model with an array of attributes. Force mass assignment. + * + * @param array $attributes + * @return $this + */ + public function forceFill(array $attributes) + { + return static::unguarded(function () use ($attributes) { + return $this->fill($attributes); + }); + } + + /** + * Qualify the given column name by the model's table. + * + * @param string $column + * @return string + */ + public function qualifyColumn($column) + { + if (Str::contains($column, '.')) { + return $column; + } + + return $this->getTable().'.'.$column; + } + + /** + * Remove the table name from a given key. + * + * @param string $key + * @return string + */ + protected function removeTableFromKey($key) + { + return Str::contains($key, '.') ? last(explode('.', $key)) : $key; + } + + /** + * Create a new instance of the given model. + * + * @param array $attributes + * @param bool $exists + * @return static + */ + public function newInstance($attributes = [], $exists = false) + { + // This method just provides a convenient way for us to generate fresh model + // instances of this current model. It is particularly useful during the + // hydration of new objects via the Eloquent query builder instances. + $model = new static((array) $attributes); + + $model->exists = $exists; + + $model->setConnection( + $this->getConnectionName() + ); + + $model->setTable($this->getTable()); + + return $model; + } + + /** + * Create a new model instance that is existing. + * + * @param array $attributes + * @param string|null $connection + * @return static + */ + public function newFromBuilder($attributes = [], $connection = null) + { + $model = $this->newInstance([], true); + + $model->setRawAttributes((array) $attributes, true); + + $model->setConnection($connection ?: $this->getConnectionName()); + + $model->fireModelEvent('retrieved', false); + + return $model; + } + + /** + * Begin querying the model on a given connection. + * + * @param string|null $connection + * @return \Illuminate\Database\Eloquent\Builder + */ + public static function on($connection = null) + { + // First we will just create a fresh instance of this model, and then we can set the + // connection on the model so that it is used for the queries we execute, as well + // as being set on every relation we retrieve without a custom connection name. + $instance = new static; + + $instance->setConnection($connection); + + return $instance->newQuery(); + } + + /** + * Begin querying the model on the write connection. + * + * @return \Illuminate\Database\Query\Builder + */ + public static function onWriteConnection() + { + $instance = new static; + + return $instance->newQuery()->useWritePdo(); + } + + /** + * Get all of the models from the database. + * + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Collection|static[] + */ + public static function all($columns = ['*']) + { + return (new static)->newQuery()->get( + is_array($columns) ? $columns : func_get_args() + ); + } + + /** + * Begin querying a model with eager loading. + * + * @param array|string $relations + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public static function with($relations) + { + return (new static)->newQuery()->with( + is_string($relations) ? func_get_args() : $relations + ); + } + + /** + * Eager load relations on the model. + * + * @param array|string $relations + * @return $this + */ + public function load($relations) + { + $query = $this->newQueryWithoutRelationships()->with( + is_string($relations) ? func_get_args() : $relations + ); + + $query->eagerLoadRelations([$this]); + + return $this; + } + + /** + * Eager load relations on the model if they are not already eager loaded. + * + * @param array|string $relations + * @return $this + */ + public function loadMissing($relations) + { + $relations = is_string($relations) ? func_get_args() : $relations; + + $this->newCollection([$this])->loadMissing($relations); + + return $this; + } + + /** + * Increment a column's value by a given amount. + * + * @param string $column + * @param float|int $amount + * @param array $extra + * @return int + */ + protected function increment($column, $amount = 1, array $extra = []) + { + return $this->incrementOrDecrement($column, $amount, $extra, 'increment'); + } + + /** + * Decrement a column's value by a given amount. + * + * @param string $column + * @param float|int $amount + * @param array $extra + * @return int + */ + protected function decrement($column, $amount = 1, array $extra = []) + { + return $this->incrementOrDecrement($column, $amount, $extra, 'decrement'); + } + + /** + * Run the increment or decrement method on the model. + * + * @param string $column + * @param float|int $amount + * @param array $extra + * @param string $method + * @return int + */ + protected function incrementOrDecrement($column, $amount, $extra, $method) + { + $query = $this->newModelQuery(); + + if (! $this->exists) { + return $query->{$method}($column, $amount, $extra); + } + + $this->incrementOrDecrementAttributeValue($column, $amount, $extra, $method); + + return $query->where( + $this->getKeyName(), $this->getKey() + )->{$method}($column, $amount, $extra); + } + + /** + * Increment the underlying attribute value and sync with original. + * + * @param string $column + * @param float|int $amount + * @param array $extra + * @param string $method + * @return void + */ + protected function incrementOrDecrementAttributeValue($column, $amount, $extra, $method) + { + $this->{$column} = $this->{$column} + ($method === 'increment' ? $amount : $amount * -1); + + $this->forceFill($extra); + + $this->syncOriginalAttribute($column); + } + + /** + * Update the model in the database. + * + * @param array $attributes + * @param array $options + * @return bool + */ + public function update(array $attributes = [], array $options = []) + { + if (! $this->exists) { + return false; + } + + return $this->fill($attributes)->save($options); + } + + /** + * Save the model and all of its relationships. + * + * @return bool + */ + public function push() + { + if (! $this->save()) { + return false; + } + + // To sync all of the relationships to the database, we will simply spin through + // the relationships and save each model via this "push" method, which allows + // us to recurse into all of these nested relations for the model instance. + foreach ($this->relations as $models) { + $models = $models instanceof Collection + ? $models->all() : [$models]; + + foreach (array_filter($models) as $model) { + if (! $model->push()) { + return false; + } + } + } + + return true; + } + + /** + * Save the model to the database. + * + * @param array $options + * @return bool + */ + public function save(array $options = []) + { + $query = $this->newModelQuery(); + + // If the "saving" event returns false we'll bail out of the save and return + // false, indicating that the save failed. This provides a chance for any + // listeners to cancel save operations if validations fail or whatever. + if ($this->fireModelEvent('saving') === false) { + return false; + } + + // If the model already exists in the database we can just update our record + // that is already in this database using the current IDs in this "where" + // clause to only update this model. Otherwise, we'll just insert them. + if ($this->exists) { + $saved = $this->isDirty() ? + $this->performUpdate($query) : true; + } + + // If the model is brand new, we'll insert it into our database and set the + // ID attribute on the model to the value of the newly inserted row's ID + // which is typically an auto-increment value managed by the database. + else { + $saved = $this->performInsert($query); + + if (! $this->getConnectionName() && + $connection = $query->getConnection()) { + $this->setConnection($connection->getName()); + } + } + + // If the model is successfully saved, we need to do a few more things once + // that is done. We will call the "saved" method here to run any actions + // we need to happen after a model gets successfully saved right here. + if ($saved) { + $this->finishSave($options); + } + + return $saved; + } + + /** + * Save the model to the database using transaction. + * + * @param array $options + * @return bool + * + * @throws \Throwable + */ + public function saveOrFail(array $options = []) + { + return $this->getConnection()->transaction(function () use ($options) { + return $this->save($options); + }); + } + + /** + * Perform any actions that are necessary after the model is saved. + * + * @param array $options + * @return void + */ + protected function finishSave(array $options) + { + $this->fireModelEvent('saved', false); + + if ($this->isDirty() && ($options['touch'] ?? true)) { + $this->touchOwners(); + } + + $this->syncOriginal(); + } + + /** + * Perform a model update operation. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return bool + */ + protected function performUpdate(Builder $query) + { + // If the updating event returns false, we will cancel the update operation so + // developers can hook Validation systems into their models and cancel this + // operation if the model does not pass validation. Otherwise, we update. + if ($this->fireModelEvent('updating') === false) { + return false; + } + + // First we need to create a fresh query instance and touch the creation and + // update timestamp on the model which are maintained by us for developer + // convenience. Then we will just continue saving the model instances. + if ($this->usesTimestamps()) { + $this->updateTimestamps(); + } + + // Once we have run the update operation, we will fire the "updated" event for + // this model instance. This will allow developers to hook into these after + // models are updated, giving them a chance to do any special processing. + $dirty = $this->getDirty(); + + if (count($dirty) > 0) { + $this->setKeysForSaveQuery($query)->update($dirty); + + $this->syncChanges(); + + $this->fireModelEvent('updated', false); + } + + return true; + } + + /** + * Set the keys for a save update query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function setKeysForSaveQuery(Builder $query) + { + $query->where($this->getKeyName(), '=', $this->getKeyForSaveQuery()); + + return $query; + } + + /** + * Get the primary key value for a save query. + * + * @return mixed + */ + protected function getKeyForSaveQuery() + { + return $this->original[$this->getKeyName()] + ?? $this->getKey(); + } + + /** + * Perform a model insert operation. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return bool + */ + protected function performInsert(Builder $query) + { + if ($this->fireModelEvent('creating') === false) { + return false; + } + + // First we'll need to create a fresh query instance and touch the creation and + // update timestamps on this model, which are maintained by us for developer + // convenience. After, we will just continue saving these model instances. + if ($this->usesTimestamps()) { + $this->updateTimestamps(); + } + + // If the model has an incrementing key, we can use the "insertGetId" method on + // the query builder, which will give us back the final inserted ID for this + // table from the database. Not all tables have to be incrementing though. + $attributes = $this->getAttributes(); + + if ($this->getIncrementing()) { + $this->insertAndSetId($query, $attributes); + } + + // If the table isn't incrementing we'll simply insert these attributes as they + // are. These attribute arrays must contain an "id" column previously placed + // there by the developer as the manually determined key for these models. + else { + if (empty($attributes)) { + return true; + } + + $query->insert($attributes); + } + + // We will go ahead and set the exists property to true, so that it is set when + // the created event is fired, just in case the developer tries to update it + // during the event. This will allow them to do so and run an update here. + $this->exists = true; + + $this->wasRecentlyCreated = true; + + $this->fireModelEvent('created', false); + + return true; + } + + /** + * Insert the given attributes and set the ID on the model. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param array $attributes + * @return void + */ + protected function insertAndSetId(Builder $query, $attributes) + { + $id = $query->insertGetId($attributes, $keyName = $this->getKeyName()); + + $this->setAttribute($keyName, $id); + } + + /** + * Destroy the models for the given IDs. + * + * @param \Illuminate\Support\Collection|array|int $ids + * @return int + */ + public static function destroy($ids) + { + // We'll initialize a count here so we will return the total number of deletes + // for the operation. The developers can then check this number as a boolean + // type value or get this total count of records deleted for logging, etc. + $count = 0; + + if ($ids instanceof BaseCollection) { + $ids = $ids->all(); + } + + $ids = is_array($ids) ? $ids : func_get_args(); + + // We will actually pull the models from the database table and call delete on + // each of them individually so that their events get fired properly with a + // correct set of attributes in case the developers wants to check these. + $key = ($instance = new static)->getKeyName(); + + foreach ($instance->whereIn($key, $ids)->get() as $model) { + if ($model->delete()) { + $count++; + } + } + + return $count; + } + + /** + * Delete the model from the database. + * + * @return bool|null + * + * @throws \Exception + */ + public function delete() + { + if (is_null($this->getKeyName())) { + throw new Exception('No primary key defined on model.'); + } + + // If the model doesn't exist, there is nothing to delete so we'll just return + // immediately and not do anything else. Otherwise, we will continue with a + // deletion process on the model, firing the proper events, and so forth. + if (! $this->exists) { + return; + } + + if ($this->fireModelEvent('deleting') === false) { + return false; + } + + // Here, we'll touch the owning models, verifying these timestamps get updated + // for the models. This will allow any caching to get broken on the parents + // by the timestamp. Then we will go ahead and delete the model instance. + $this->touchOwners(); + + $this->performDeleteOnModel(); + + // Once the model has been deleted, we will fire off the deleted event so that + // the developers may hook into post-delete operations. We will then return + // a boolean true as the delete is presumably successful on the database. + $this->fireModelEvent('deleted', false); + + return true; + } + + /** + * Force a hard delete on a soft deleted model. + * + * This method protects developers from running forceDelete when trait is missing. + * + * @return bool|null + */ + public function forceDelete() + { + return $this->delete(); + } + + /** + * Perform the actual delete query on this model instance. + * + * @return void + */ + protected function performDeleteOnModel() + { + $this->setKeysForSaveQuery($this->newModelQuery())->delete(); + + $this->exists = false; + } + + /** + * Begin querying the model. + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public static function query() + { + return (new static)->newQuery(); + } + + /** + * Get a new query builder for the model's table. + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function newQuery() + { + return $this->registerGlobalScopes($this->newQueryWithoutScopes()); + } + + /** + * Get a new query builder that doesn't have any global scopes or eager loading. + * + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function newModelQuery() + { + return $this->newEloquentBuilder( + $this->newBaseQueryBuilder() + )->setModel($this); + } + + /** + * Get a new query builder with no relationships loaded. + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function newQueryWithoutRelationships() + { + return $this->registerGlobalScopes($this->newModelQuery()); + } + + /** + * Register the global scopes for this builder instance. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return \Illuminate\Database\Eloquent\Builder + */ + public function registerGlobalScopes($builder) + { + foreach ($this->getGlobalScopes() as $identifier => $scope) { + $builder->withGlobalScope($identifier, $scope); + } + + return $builder; + } + + /** + * Get a new query builder that doesn't have any global scopes. + * + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function newQueryWithoutScopes() + { + return $this->newModelQuery() + ->with($this->with) + ->withCount($this->withCount); + } + + /** + * Get a new query instance without a given scope. + * + * @param \Illuminate\Database\Eloquent\Scope|string $scope + * @return \Illuminate\Database\Eloquent\Builder + */ + public function newQueryWithoutScope($scope) + { + return $this->newQuery()->withoutGlobalScope($scope); + } + + /** + * Get a new query to restore one or more models by their queueable IDs. + * + * @param array|int $ids + * @return \Illuminate\Database\Eloquent\Builder + */ + public function newQueryForRestoration($ids) + { + return is_array($ids) + ? $this->newQueryWithoutScopes()->whereIn($this->getQualifiedKeyName(), $ids) + : $this->newQueryWithoutScopes()->whereKey($ids); + } + + /** + * Create a new Eloquent query builder for the model. + * + * @param \Illuminate\Database\Query\Builder $query + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function newEloquentBuilder($query) + { + return new Builder($query); + } + + /** + * Get a new query builder instance for the connection. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function newBaseQueryBuilder() + { + $connection = $this->getConnection(); + + return new QueryBuilder( + $connection, $connection->getQueryGrammar(), $connection->getPostProcessor() + ); + } + + /** + * Create a new Eloquent Collection instance. + * + * @param array $models + * @return \Illuminate\Database\Eloquent\Collection + */ + public function newCollection(array $models = []) + { + return new Collection($models); + } + + /** + * Create a new pivot model instance. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @param array $attributes + * @param string $table + * @param bool $exists + * @param string|null $using + * @return \Illuminate\Database\Eloquent\Relations\Pivot + */ + public function newPivot(self $parent, array $attributes, $table, $exists, $using = null) + { + return $using ? $using::fromRawAttributes($parent, $attributes, $table, $exists) + : Pivot::fromAttributes($parent, $attributes, $table, $exists); + } + + /** + * Convert the model instance to an array. + * + * @return array + */ + public function toArray() + { + return array_merge($this->attributesToArray(), $this->relationsToArray()); + } + + /** + * Convert the model instance to JSON. + * + * @param int $options + * @return string + * + * @throws \Illuminate\Database\Eloquent\JsonEncodingException + */ + public function toJson($options = 0) + { + $json = json_encode($this->jsonSerialize(), $options); + + if (JSON_ERROR_NONE !== json_last_error()) { + throw JsonEncodingException::forModel($this, json_last_error_msg()); + } + + return $json; + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Reload a fresh model instance from the database. + * + * @param array|string $with + * @return static|null + */ + public function fresh($with = []) + { + if (! $this->exists) { + return; + } + + return static::newQueryWithoutScopes() + ->with(is_string($with) ? func_get_args() : $with) + ->where($this->getKeyName(), $this->getKey()) + ->first(); + } + + /** + * Reload the current model instance with fresh attributes from the database. + * + * @return $this + */ + public function refresh() + { + if (! $this->exists) { + return $this; + } + + $this->setRawAttributes( + static::newQueryWithoutScopes()->findOrFail($this->getKey())->attributes + ); + + $this->load(collect($this->relations)->except('pivot')->keys()->toArray()); + + $this->syncOriginal(); + + return $this; + } + + /** + * Clone the model into a new, non-existing instance. + * + * @param array|null $except + * @return static + */ + public function replicate(array $except = null) + { + $defaults = [ + $this->getKeyName(), + $this->getCreatedAtColumn(), + $this->getUpdatedAtColumn(), + ]; + + $attributes = Arr::except( + $this->attributes, $except ? array_unique(array_merge($except, $defaults)) : $defaults + ); + + return tap(new static, function ($instance) use ($attributes) { + $instance->setRawAttributes($attributes); + + $instance->setRelations($this->relations); + }); + } + + /** + * Determine if two models have the same ID and belong to the same table. + * + * @param \Illuminate\Database\Eloquent\Model|null $model + * @return bool + */ + public function is($model) + { + return ! is_null($model) && + $this->getKey() === $model->getKey() && + $this->getTable() === $model->getTable() && + $this->getConnectionName() === $model->getConnectionName(); + } + + /** + * Determine if two models are not the same. + * + * @param \Illuminate\Database\Eloquent\Model|null $model + * @return bool + */ + public function isNot($model) + { + return ! $this->is($model); + } + + /** + * Get the database connection for the model. + * + * @return \Illuminate\Database\Connection + */ + public function getConnection() + { + return static::resolveConnection($this->getConnectionName()); + } + + /** + * Get the current connection name for the model. + * + * @return string + */ + public function getConnectionName() + { + return $this->connection; + } + + /** + * Set the connection associated with the model. + * + * @param string $name + * @return $this + */ + public function setConnection($name) + { + $this->connection = $name; + + return $this; + } + + /** + * Resolve a connection instance. + * + * @param string|null $connection + * @return \Illuminate\Database\Connection + */ + public static function resolveConnection($connection = null) + { + return static::$resolver->connection($connection); + } + + /** + * Get the connection resolver instance. + * + * @return \Illuminate\Database\ConnectionResolverInterface + */ + public static function getConnectionResolver() + { + return static::$resolver; + } + + /** + * Set the connection resolver instance. + * + * @param \Illuminate\Database\ConnectionResolverInterface $resolver + * @return void + */ + public static function setConnectionResolver(Resolver $resolver) + { + static::$resolver = $resolver; + } + + /** + * Unset the connection resolver for models. + * + * @return void + */ + public static function unsetConnectionResolver() + { + static::$resolver = null; + } + + /** + * Get the table associated with the model. + * + * @return string + */ + public function getTable() + { + if (! isset($this->table)) { + return str_replace( + '\\', '', Str::snake(Str::plural(class_basename($this))) + ); + } + + return $this->table; + } + + /** + * Set the table associated with the model. + * + * @param string $table + * @return $this + */ + public function setTable($table) + { + $this->table = $table; + + return $this; + } + + /** + * Get the primary key for the model. + * + * @return string + */ + public function getKeyName() + { + return $this->primaryKey; + } + + /** + * Set the primary key for the model. + * + * @param string $key + * @return $this + */ + public function setKeyName($key) + { + $this->primaryKey = $key; + + return $this; + } + + /** + * Get the table qualified key name. + * + * @return string + */ + public function getQualifiedKeyName() + { + return $this->qualifyColumn($this->getKeyName()); + } + + /** + * Get the auto-incrementing key type. + * + * @return string + */ + public function getKeyType() + { + return $this->keyType; + } + + /** + * Set the data type for the primary key. + * + * @param string $type + * @return $this + */ + public function setKeyType($type) + { + $this->keyType = $type; + + return $this; + } + + /** + * Get the value indicating whether the IDs are incrementing. + * + * @return bool + */ + public function getIncrementing() + { + return $this->incrementing; + } + + /** + * Set whether IDs are incrementing. + * + * @param bool $value + * @return $this + */ + public function setIncrementing($value) + { + $this->incrementing = $value; + + return $this; + } + + /** + * Get the value of the model's primary key. + * + * @return mixed + */ + public function getKey() + { + return $this->getAttribute($this->getKeyName()); + } + + /** + * Get the queueable identity for the entity. + * + * @return mixed + */ + public function getQueueableId() + { + return $this->getKey(); + } + + /** + * Get the queueable relationships for the entity. + * + * @return array + */ + public function getQueueableRelations() + { + $relations = []; + + foreach ($this->getRelations() as $key => $relation) { + if (method_exists($this, $key)) { + $relations[] = $key; + } + + if ($relation instanceof QueueableCollection) { + foreach ($relation->getQueueableRelations() as $collectionValue) { + $relations[] = $key.'.'.$collectionValue; + } + } + + if ($relation instanceof QueueableEntity) { + foreach ($relation->getQueueableRelations() as $entityKey => $entityValue) { + $relations[] = $key.'.'.$entityValue; + } + } + } + + return array_unique($relations); + } + + /** + * Get the queueable connection for the entity. + * + * @return mixed + */ + public function getQueueableConnection() + { + return $this->getConnectionName(); + } + + /** + * Get the value of the model's route key. + * + * @return mixed + */ + public function getRouteKey() + { + return $this->getAttribute($this->getRouteKeyName()); + } + + /** + * Get the route key for the model. + * + * @return string + */ + public function getRouteKeyName() + { + return $this->getKeyName(); + } + + /** + * Retrieve the model for a bound value. + * + * @param mixed $value + * @return \Illuminate\Database\Eloquent\Model|null + */ + public function resolveRouteBinding($value) + { + return $this->where($this->getRouteKeyName(), $value)->first(); + } + + /** + * Get the default foreign key name for the model. + * + * @return string + */ + public function getForeignKey() + { + return Str::snake(class_basename($this)).'_'.$this->getKeyName(); + } + + /** + * Get the number of models to return per page. + * + * @return int + */ + public function getPerPage() + { + return $this->perPage; + } + + /** + * Set the number of models to return per page. + * + * @param int $perPage + * @return $this + */ + public function setPerPage($perPage) + { + $this->perPage = $perPage; + + return $this; + } + + /** + * Dynamically retrieve attributes on the model. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->getAttribute($key); + } + + /** + * Dynamically set attributes on the model. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this->setAttribute($key, $value); + } + + /** + * Determine if the given attribute exists. + * + * @param mixed $offset + * @return bool + */ + public function offsetExists($offset) + { + return ! is_null($this->getAttribute($offset)); + } + + /** + * Get the value for a given offset. + * + * @param mixed $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->getAttribute($offset); + } + + /** + * Set the value for a given offset. + * + * @param mixed $offset + * @param mixed $value + * @return void + */ + public function offsetSet($offset, $value) + { + $this->setAttribute($offset, $value); + } + + /** + * Unset the value for a given offset. + * + * @param mixed $offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->attributes[$offset], $this->relations[$offset]); + } + + /** + * Determine if an attribute or relation exists on the model. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return $this->offsetExists($key); + } + + /** + * Unset an attribute on the model. + * + * @param string $key + * @return void + */ + public function __unset($key) + { + $this->offsetUnset($key); + } + + /** + * Handle dynamic method calls into the model. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (in_array($method, ['increment', 'decrement'])) { + return $this->$method(...$parameters); + } + + return $this->forwardCallTo($this->newQuery(), $method, $parameters); + } + + /** + * Handle dynamic static method calls into the method. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + return (new static)->$method(...$parameters); + } + + /** + * Convert the model to its string representation. + * + * @return string + */ + public function __toString() + { + return $this->toJson(); + } + + /** + * When a model is being unserialized, check if it needs to be booted. + * + * @return void + */ + public function __wakeup() + { + $this->bootIfNotBooted(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/ModelNotFoundException.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/ModelNotFoundException.php new file mode 100755 index 0000000..c3db824 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/ModelNotFoundException.php @@ -0,0 +1,66 @@ +model = $model; + $this->ids = Arr::wrap($ids); + + $this->message = "No query results for model [{$model}]"; + + if (count($this->ids) > 0) { + $this->message .= ' '.implode(', ', $this->ids); + } else { + $this->message .= '.'; + } + + return $this; + } + + /** + * Get the affected Eloquent model. + * + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Get the affected Eloquent model IDs. + * + * @return int|array + */ + public function getIds() + { + return $this->ids; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/QueueEntityResolver.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/QueueEntityResolver.php new file mode 100644 index 0000000..22fccf2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/QueueEntityResolver.php @@ -0,0 +1,29 @@ +find($id); + + if ($instance) { + return $instance; + } + + throw new EntityNotFoundException($type, $id); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/RelationNotFoundException.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/RelationNotFoundException.php new file mode 100755 index 0000000..088429c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/RelationNotFoundException.php @@ -0,0 +1,41 @@ +model = $model; + $instance->relation = $relation; + + return $instance; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php new file mode 100755 index 0000000..4cd1f33 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsTo.php @@ -0,0 +1,361 @@ +ownerKey = $ownerKey; + $this->relation = $relation; + $this->foreignKey = $foreignKey; + + // In the underlying base relationship class, this variable is referred to as + // the "parent" since most relationships are not inversed. But, since this + // one is we will create a "child" variable for much better readability. + $this->child = $child; + + parent::__construct($query, $child); + } + + /** + * Get the results of the relationship. + * + * @return mixed + */ + public function getResults() + { + return $this->query->first() ?: $this->getDefaultFor($this->parent); + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + public function addConstraints() + { + if (static::$constraints) { + // For belongs to relationships, which are essentially the inverse of has one + // or has many relationships, we need to actually query on the primary key + // of the related models matching on the foreign key that's on a parent. + $table = $this->related->getTable(); + + $this->query->where($table.'.'.$this->ownerKey, '=', $this->child->{$this->foreignKey}); + } + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + // We'll grab the primary key name of the related models since it could be set to + // a non-standard name and not "id". We will then construct the constraint for + // our eagerly loading query so it returns the proper models from execution. + $key = $this->related->getTable().'.'.$this->ownerKey; + + $whereIn = $this->whereInMethod($this->related, $this->ownerKey); + + $this->query->{$whereIn}($key, $this->getEagerModelKeys($models)); + } + + /** + * Gather the keys from an array of related models. + * + * @param array $models + * @return array + */ + protected function getEagerModelKeys(array $models) + { + $keys = []; + + // First we need to gather all of the keys from the parent models so we know what + // to query for via the eager loading query. We will add them to an array then + // execute a "where in" statement to gather up all of those related records. + foreach ($models as $model) { + if (! is_null($value = $model->{$this->foreignKey})) { + $keys[] = $value; + } + } + + // If there are no keys that were not null we will just return an array with null + // so this query wont fail plus returns zero results, which should be what the + // developer expects to happen in this situation. Otherwise we'll sort them. + if (count($keys) === 0) { + return [null]; + } + + sort($keys); + + return array_values(array_unique($keys)); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->getDefaultFor($model)); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + $foreign = $this->foreignKey; + + $owner = $this->ownerKey; + + // First we will get to build a dictionary of the child models by their primary + // key of the relationship, then we can easily match the children back onto + // the parents using that dictionary and the primary key of the children. + $dictionary = []; + + foreach ($results as $result) { + $dictionary[$result->getAttribute($owner)] = $result; + } + + // Once we have the dictionary constructed, we can loop through all the parents + // and match back onto their children using these keys of the dictionary and + // the primary key of the children to map them onto the correct instances. + foreach ($models as $model) { + if (isset($dictionary[$model->{$foreign}])) { + $model->setRelation($relation, $dictionary[$model->{$foreign}]); + } + } + + return $models; + } + + /** + * Update the parent model on the relationship. + * + * @param array $attributes + * @return mixed + */ + public function update(array $attributes) + { + return $this->getResults()->fill($attributes)->save(); + } + + /** + * Associate the model instance to the given parent. + * + * @param \Illuminate\Database\Eloquent\Model|int|string $model + * @return \Illuminate\Database\Eloquent\Model + */ + public function associate($model) + { + $ownerKey = $model instanceof Model ? $model->getAttribute($this->ownerKey) : $model; + + $this->child->setAttribute($this->foreignKey, $ownerKey); + + if ($model instanceof Model) { + $this->child->setRelation($this->relation, $model); + } + + return $this->child; + } + + /** + * Dissociate previously associated model from the given parent. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function dissociate() + { + $this->child->setAttribute($this->foreignKey, null); + + return $this->child->setRelation($this->relation, null); + } + + /** + * Add the constraints for a relationship query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) + { + if ($parentQuery->getQuery()->from == $query->getQuery()->from) { + return $this->getRelationExistenceQueryForSelfRelation($query, $parentQuery, $columns); + } + + return $query->select($columns)->whereColumn( + $this->getQualifiedForeignKey(), '=', $query->qualifyColumn($this->ownerKey) + ); + } + + /** + * Add the constraints for a relationship query on the same table. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) + { + $query->select($columns)->from( + $query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash() + ); + + $query->getModel()->setTable($hash); + + return $query->whereColumn( + $hash.'.'.$this->ownerKey, '=', $this->getQualifiedForeignKey() + ); + } + + /** + * Get a relationship join table hash. + * + * @return string + */ + public function getRelationCountHash() + { + return 'laravel_reserved_'.static::$selfJoinCount++; + } + + /** + * Determine if the related model has an auto-incrementing ID. + * + * @return bool + */ + protected function relationHasIncrementingId() + { + return $this->related->getIncrementing() && + $this->related->getKeyType() === 'int'; + } + + /** + * Make a new related instance for the given model. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @return \Illuminate\Database\Eloquent\Model + */ + protected function newRelatedInstanceFor(Model $parent) + { + return $this->related->newInstance(); + } + + /** + * Get the foreign key of the relationship. + * + * @return string + */ + public function getForeignKey() + { + return $this->foreignKey; + } + + /** + * Get the fully qualified foreign key of the relationship. + * + * @return string + */ + public function getQualifiedForeignKey() + { + return $this->child->qualifyColumn($this->foreignKey); + } + + /** + * Get the associated key of the relationship. + * + * @return string + */ + public function getOwnerKey() + { + return $this->ownerKey; + } + + /** + * Get the fully qualified associated key of the relationship. + * + * @return string + */ + public function getQualifiedOwnerKeyName() + { + return $this->related->qualifyColumn($this->ownerKey); + } + + /** + * Get the name of the relationship. + * + * @return string + */ + public function getRelation() + { + return $this->relation; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php new file mode 100755 index 0000000..d502897 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php @@ -0,0 +1,1083 @@ +table = $table; + $this->parentKey = $parentKey; + $this->relatedKey = $relatedKey; + $this->relationName = $relationName; + $this->relatedPivotKey = $relatedPivotKey; + $this->foreignPivotKey = $foreignPivotKey; + + parent::__construct($query, $parent); + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + public function addConstraints() + { + $this->performJoin(); + + if (static::$constraints) { + $this->addWhereConstraints(); + } + } + + /** + * Set the join clause for the relation query. + * + * @param \Illuminate\Database\Eloquent\Builder|null $query + * @return $this + */ + protected function performJoin($query = null) + { + $query = $query ?: $this->query; + + // We need to join to the intermediate table on the related model's primary + // key column with the intermediate table's foreign key for the related + // model instance. Then we can set the "where" for the parent models. + $baseTable = $this->related->getTable(); + + $key = $baseTable.'.'.$this->relatedKey; + + $query->join($this->table, $key, '=', $this->getQualifiedRelatedPivotKeyName()); + + return $this; + } + + /** + * Set the where clause for the relation query. + * + * @return $this + */ + protected function addWhereConstraints() + { + $this->query->where( + $this->getQualifiedForeignPivotKeyName(), '=', $this->parent->{$this->parentKey} + ); + + return $this; + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + $whereIn = $this->whereInMethod($this->parent, $this->parentKey); + + $this->query->{$whereIn}( + $this->getQualifiedForeignPivotKeyName(), + $this->getKeys($models, $this->parentKey) + ); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->related->newCollection()); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + $dictionary = $this->buildDictionary($results); + + // Once we have an array dictionary of child objects we can easily match the + // children back to their parent using the dictionary and the keys on the + // the parent models. Then we will return the hydrated models back out. + foreach ($models as $model) { + if (isset($dictionary[$key = $model->{$this->parentKey}])) { + $model->setRelation( + $relation, $this->related->newCollection($dictionary[$key]) + ); + } + } + + return $models; + } + + /** + * Build model dictionary keyed by the relation's foreign key. + * + * @param \Illuminate\Database\Eloquent\Collection $results + * @return array + */ + protected function buildDictionary(Collection $results) + { + // First we will build a dictionary of child models keyed by the foreign key + // of the relation so that we will easily and quickly match them to their + // parents without having a possibly slow inner loops for every models. + $dictionary = []; + + foreach ($results as $result) { + $dictionary[$result->{$this->accessor}->{$this->foreignPivotKey}][] = $result; + } + + return $dictionary; + } + + /** + * Get the class being used for pivot models. + * + * @return string + */ + public function getPivotClass() + { + return $this->using ?? Pivot::class; + } + + /** + * Specify the custom pivot model to use for the relationship. + * + * @param string $class + * @return $this + */ + public function using($class) + { + $this->using = $class; + + return $this; + } + + /** + * Specify the custom pivot accessor to use for the relationship. + * + * @param string $accessor + * @return $this + */ + public function as($accessor) + { + $this->accessor = $accessor; + + return $this; + } + + /** + * Set a where clause for a pivot table column. + * + * @param string $column + * @param string $operator + * @param mixed $value + * @param string $boolean + * @return $this + */ + public function wherePivot($column, $operator = null, $value = null, $boolean = 'and') + { + $this->pivotWheres[] = func_get_args(); + + return $this->where($this->table.'.'.$column, $operator, $value, $boolean); + } + + /** + * Set a "where in" clause for a pivot table column. + * + * @param string $column + * @param mixed $values + * @param string $boolean + * @param bool $not + * @return $this + */ + public function wherePivotIn($column, $values, $boolean = 'and', $not = false) + { + $this->pivotWhereIns[] = func_get_args(); + + return $this->whereIn($this->table.'.'.$column, $values, $boolean, $not); + } + + /** + * Set an "or where" clause for a pivot table column. + * + * @param string $column + * @param string $operator + * @param mixed $value + * @return $this + */ + public function orWherePivot($column, $operator = null, $value = null) + { + return $this->wherePivot($column, $operator, $value, 'or'); + } + + /** + * Set a where clause for a pivot table column. + * + * In addition, new pivot records will receive this value. + * + * @param string|array $column + * @param mixed $value + * @return $this + */ + public function withPivotValue($column, $value = null) + { + if (is_array($column)) { + foreach ($column as $name => $value) { + $this->withPivotValue($name, $value); + } + + return $this; + } + + if (is_null($value)) { + throw new InvalidArgumentException('The provided value may not be null.'); + } + + $this->pivotValues[] = compact('column', 'value'); + + return $this->wherePivot($column, '=', $value); + } + + /** + * Set an "or where in" clause for a pivot table column. + * + * @param string $column + * @param mixed $values + * @return $this + */ + public function orWherePivotIn($column, $values) + { + return $this->wherePivotIn($column, $values, 'or'); + } + + /** + * Find a related model by its primary key or return new instance of the related model. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model + */ + public function findOrNew($id, $columns = ['*']) + { + if (is_null($instance = $this->find($id, $columns))) { + $instance = $this->related->newInstance(); + } + + return $instance; + } + + /** + * Get the first related model record matching the attributes or instantiate it. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrNew(array $attributes) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->related->newInstance($attributes); + } + + return $instance; + } + + /** + * Get the first related record matching the attributes or create it. + * + * @param array $attributes + * @param array $joining + * @param bool $touch + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrCreate(array $attributes, array $joining = [], $touch = true) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->create($attributes, $joining, $touch); + } + + return $instance; + } + + /** + * Create or update a related record matching the attributes, and fill it with values. + * + * @param array $attributes + * @param array $values + * @param array $joining + * @param bool $touch + * @return \Illuminate\Database\Eloquent\Model + */ + public function updateOrCreate(array $attributes, array $values = [], array $joining = [], $touch = true) + { + if (is_null($instance = $this->where($attributes)->first())) { + return $this->create($values, $joining, $touch); + } + + $instance->fill($values); + + $instance->save(['touch' => false]); + + return $instance; + } + + /** + * Find a related model by its primary key. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null + */ + public function find($id, $columns = ['*']) + { + return is_array($id) ? $this->findMany($id, $columns) : $this->where( + $this->getRelated()->getQualifiedKeyName(), '=', $id + )->first($columns); + } + + /** + * Find multiple related models by their primary keys. + * + * @param mixed $ids + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function findMany($ids, $columns = ['*']) + { + return empty($ids) ? $this->getRelated()->newCollection() : $this->whereIn( + $this->getRelated()->getQualifiedKeyName(), $ids + )->get($columns); + } + + /** + * Find a related model by its primary key or throw an exception. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function findOrFail($id, $columns = ['*']) + { + $result = $this->find($id, $columns); + + if (is_array($id)) { + if (count($result) === count(array_unique($id))) { + return $result; + } + } elseif (! is_null($result)) { + return $result; + } + + throw (new ModelNotFoundException)->setModel(get_class($this->related), $id); + } + + /** + * Execute the query and get the first result. + * + * @param array $columns + * @return mixed + */ + public function first($columns = ['*']) + { + $results = $this->take(1)->get($columns); + + return count($results) > 0 ? $results->first() : null; + } + + /** + * Execute the query and get the first result or throw an exception. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|static + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function firstOrFail($columns = ['*']) + { + if (! is_null($model = $this->first($columns))) { + return $model; + } + + throw (new ModelNotFoundException)->setModel(get_class($this->related)); + } + + /** + * Get the results of the relationship. + * + * @return mixed + */ + public function getResults() + { + return $this->get(); + } + + /** + * Execute the query as a "select" statement. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function get($columns = ['*']) + { + // First we'll add the proper select columns onto the query so it is run with + // the proper columns. Then, we will get the results and hydrate out pivot + // models with the result of those columns as a separate model relation. + $builder = $this->query->applyScopes(); + + $columns = $builder->getQuery()->columns ? [] : $columns; + + $models = $builder->addSelect( + $this->shouldSelect($columns) + )->getModels(); + + $this->hydratePivotRelation($models); + + // If we actually found models we will also eager load any relationships that + // have been specified as needing to be eager loaded. This will solve the + // n + 1 query problem for the developer and also increase performance. + if (count($models) > 0) { + $models = $builder->eagerLoadRelations($models); + } + + return $this->related->newCollection($models); + } + + /** + * Get the select columns for the relation query. + * + * @param array $columns + * @return array + */ + protected function shouldSelect(array $columns = ['*']) + { + if ($columns == ['*']) { + $columns = [$this->related->getTable().'.*']; + } + + return array_merge($columns, $this->aliasedPivotColumns()); + } + + /** + * Get the pivot columns for the relation. + * + * "pivot_" is prefixed ot each column for easy removal later. + * + * @return array + */ + protected function aliasedPivotColumns() + { + $defaults = [$this->foreignPivotKey, $this->relatedPivotKey]; + + return collect(array_merge($defaults, $this->pivotColumns))->map(function ($column) { + return $this->table.'.'.$column.' as pivot_'.$column; + })->unique()->all(); + } + + /** + * Get a paginator for the "select" statement. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator + */ + public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) + { + $this->query->addSelect($this->shouldSelect($columns)); + + return tap($this->query->paginate($perPage, $columns, $pageName, $page), function ($paginator) { + $this->hydratePivotRelation($paginator->items()); + }); + } + + /** + * Paginate the given query into a simple paginator. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\Paginator + */ + public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) + { + $this->query->addSelect($this->shouldSelect($columns)); + + return tap($this->query->simplePaginate($perPage, $columns, $pageName, $page), function ($paginator) { + $this->hydratePivotRelation($paginator->items()); + }); + } + + /** + * Chunk the results of the query. + * + * @param int $count + * @param callable $callback + * @return bool + */ + public function chunk($count, callable $callback) + { + $this->query->addSelect($this->shouldSelect()); + + return $this->query->chunk($count, function ($results) use ($callback) { + $this->hydratePivotRelation($results->all()); + + return $callback($results); + }); + } + + /** + * Execute a callback over each item while chunking. + * + * @param callable $callback + * @param int $count + * @return bool + */ + public function each(callable $callback, $count = 1000) + { + return $this->chunk($count, function ($results) use ($callback) { + foreach ($results as $key => $value) { + if ($callback($value, $key) === false) { + return false; + } + } + }); + } + + /** + * Hydrate the pivot table relationship on the models. + * + * @param array $models + * @return void + */ + protected function hydratePivotRelation(array $models) + { + // To hydrate the pivot relationship, we will just gather the pivot attributes + // and create a new Pivot model, which is basically a dynamic model that we + // will set the attributes, table, and connections on it so it will work. + foreach ($models as $model) { + $model->setRelation($this->accessor, $this->newExistingPivot( + $this->migratePivotAttributes($model) + )); + } + } + + /** + * Get the pivot attributes from a model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return array + */ + protected function migratePivotAttributes(Model $model) + { + $values = []; + + foreach ($model->getAttributes() as $key => $value) { + // To get the pivots attributes we will just take any of the attributes which + // begin with "pivot_" and add those to this arrays, as well as unsetting + // them from the parent's models since they exist in a different table. + if (strpos($key, 'pivot_') === 0) { + $values[substr($key, 6)] = $value; + + unset($model->$key); + } + } + + return $values; + } + + /** + * If we're touching the parent model, touch. + * + * @return void + */ + public function touchIfTouching() + { + if ($this->touchingParent()) { + $this->getParent()->touch(); + } + + if ($this->getParent()->touches($this->relationName)) { + $this->touch(); + } + } + + /** + * Determine if we should touch the parent on sync. + * + * @return bool + */ + protected function touchingParent() + { + return $this->getRelated()->touches($this->guessInverseRelation()); + } + + /** + * Attempt to guess the name of the inverse of the relation. + * + * @return string + */ + protected function guessInverseRelation() + { + return Str::camel(Str::plural(class_basename($this->getParent()))); + } + + /** + * Touch all of the related models for the relationship. + * + * E.g.: Touch all roles associated with this user. + * + * @return void + */ + public function touch() + { + $key = $this->getRelated()->getKeyName(); + + $columns = [ + $this->related->getUpdatedAtColumn() => $this->related->freshTimestampString(), + ]; + + // If we actually have IDs for the relation, we will run the query to update all + // the related model's timestamps, to make sure these all reflect the changes + // to the parent models. This will help us keep any caching synced up here. + if (count($ids = $this->allRelatedIds()) > 0) { + $this->getRelated()->newModelQuery()->whereIn($key, $ids)->update($columns); + } + } + + /** + * Get all of the IDs for the related models. + * + * @return \Illuminate\Support\Collection + */ + public function allRelatedIds() + { + return $this->newPivotQuery()->pluck($this->relatedPivotKey); + } + + /** + * Save a new model and attach it to the parent model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @param array $pivotAttributes + * @param bool $touch + * @return \Illuminate\Database\Eloquent\Model + */ + public function save(Model $model, array $pivotAttributes = [], $touch = true) + { + $model->save(['touch' => false]); + + $this->attach($model, $pivotAttributes, $touch); + + return $model; + } + + /** + * Save an array of new models and attach them to the parent model. + * + * @param \Illuminate\Support\Collection|array $models + * @param array $pivotAttributes + * @return array + */ + public function saveMany($models, array $pivotAttributes = []) + { + foreach ($models as $key => $model) { + $this->save($model, (array) ($pivotAttributes[$key] ?? []), false); + } + + $this->touchIfTouching(); + + return $models; + } + + /** + * Create a new instance of the related model. + * + * @param array $attributes + * @param array $joining + * @param bool $touch + * @return \Illuminate\Database\Eloquent\Model + */ + public function create(array $attributes = [], array $joining = [], $touch = true) + { + $instance = $this->related->newInstance($attributes); + + // Once we save the related model, we need to attach it to the base model via + // through intermediate table so we'll use the existing "attach" method to + // accomplish this which will insert the record and any more attributes. + $instance->save(['touch' => false]); + + $this->attach($instance, $joining, $touch); + + return $instance; + } + + /** + * Create an array of new instances of the related models. + * + * @param array $records + * @param array $joinings + * @return array + */ + public function createMany(array $records, array $joinings = []) + { + $instances = []; + + foreach ($records as $key => $record) { + $instances[] = $this->create($record, (array) ($joinings[$key] ?? []), false); + } + + $this->touchIfTouching(); + + return $instances; + } + + /** + * Add the constraints for a relationship query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) + { + if ($parentQuery->getQuery()->from == $query->getQuery()->from) { + return $this->getRelationExistenceQueryForSelfJoin($query, $parentQuery, $columns); + } + + $this->performJoin($query); + + return parent::getRelationExistenceQuery($query, $parentQuery, $columns); + } + + /** + * Add the constraints for a relationship query on the same table. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQueryForSelfJoin(Builder $query, Builder $parentQuery, $columns = ['*']) + { + $query->select($columns); + + $query->from($this->related->getTable().' as '.$hash = $this->getRelationCountHash()); + + $this->related->setTable($hash); + + $this->performJoin($query); + + return parent::getRelationExistenceQuery($query, $parentQuery, $columns); + } + + /** + * Get the key for comparing against the parent key in "has" query. + * + * @return string + */ + public function getExistenceCompareKey() + { + return $this->getQualifiedForeignPivotKeyName(); + } + + /** + * Get a relationship join table hash. + * + * @return string + */ + public function getRelationCountHash() + { + return 'laravel_reserved_'.static::$selfJoinCount++; + } + + /** + * Specify that the pivot table has creation and update timestamps. + * + * @param mixed $createdAt + * @param mixed $updatedAt + * @return $this + */ + public function withTimestamps($createdAt = null, $updatedAt = null) + { + $this->withTimestamps = true; + + $this->pivotCreatedAt = $createdAt; + $this->pivotUpdatedAt = $updatedAt; + + return $this->withPivot($this->createdAt(), $this->updatedAt()); + } + + /** + * Get the name of the "created at" column. + * + * @return string + */ + public function createdAt() + { + return $this->pivotCreatedAt ?: $this->parent->getCreatedAtColumn(); + } + + /** + * Get the name of the "updated at" column. + * + * @return string + */ + public function updatedAt() + { + return $this->pivotUpdatedAt ?: $this->parent->getUpdatedAtColumn(); + } + + /** + * Get the foreign key for the relation. + * + * @return string + */ + public function getForeignPivotKeyName() + { + return $this->foreignPivotKey; + } + + /** + * Get the fully qualified foreign key for the relation. + * + * @return string + */ + public function getQualifiedForeignPivotKeyName() + { + return $this->table.'.'.$this->foreignPivotKey; + } + + /** + * Get the "related key" for the relation. + * + * @return string + */ + public function getRelatedPivotKeyName() + { + return $this->relatedPivotKey; + } + + /** + * Get the fully qualified "related key" for the relation. + * + * @return string + */ + public function getQualifiedRelatedPivotKeyName() + { + return $this->table.'.'.$this->relatedPivotKey; + } + + /** + * Get the parent key for the relationship. + * + * @return string + */ + public function getParentKeyName() + { + return $this->parentKey; + } + + /** + * Get the fully qualified parent key name for the relation. + * + * @return string + */ + public function getQualifiedParentKeyName() + { + return $this->parent->qualifyColumn($this->parentKey); + } + + /** + * Get the related key for the relationship. + * + * @return string + */ + public function getRelatedKeyName() + { + return $this->relatedKey; + } + + /** + * Get the intermediate table for the relationship. + * + * @return string + */ + public function getTable() + { + return $this->table; + } + + /** + * Get the relationship name for the relationship. + * + * @return string + */ + public function getRelationName() + { + return $this->relationName; + } + + /** + * Get the name of the pivot accessor for this relationship. + * + * @return string + */ + public function getPivotAccessor() + { + return $this->accessor; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php new file mode 100644 index 0000000..58f5430 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php @@ -0,0 +1,295 @@ +setConnection($parent->getConnectionName()) + ->setTable($table) + ->forceFill($attributes) + ->syncOriginal(); + + // We store off the parent instance so we will access the timestamp column names + // for the model, since the pivot model timestamps aren't easily configurable + // from the developer's point of view. We can use the parents to get these. + $instance->pivotParent = $parent; + + $instance->exists = $exists; + + $instance->timestamps = $instance->hasTimestampAttributes(); + + return $instance; + } + + /** + * Create a new pivot model from raw values returned from a query. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @param array $attributes + * @param string $table + * @param bool $exists + * @return static + */ + public static function fromRawAttributes(Model $parent, $attributes, $table, $exists = false) + { + $instance = static::fromAttributes($parent, [], $table, $exists); + + $instance->setRawAttributes($attributes, true); + + $instance->timestamps = $instance->hasTimestampAttributes(); + + return $instance; + } + + /** + * Set the keys for a save update query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function setKeysForSaveQuery(Builder $query) + { + if (isset($this->attributes[$this->getKeyName()])) { + return parent::setKeysForSaveQuery($query); + } + + $query->where($this->foreignKey, $this->getOriginal( + $this->foreignKey, $this->getAttribute($this->foreignKey) + )); + + return $query->where($this->relatedKey, $this->getOriginal( + $this->relatedKey, $this->getAttribute($this->relatedKey) + )); + } + + /** + * Delete the pivot model record from the database. + * + * @return int + */ + public function delete() + { + if (isset($this->attributes[$this->getKeyName()])) { + return parent::delete(); + } + + return $this->getDeleteQuery()->delete(); + } + + /** + * Get the query builder for a delete operation on the pivot. + * + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function getDeleteQuery() + { + return $this->newModelQuery()->where([ + $this->foreignKey => $this->getOriginal($this->foreignKey, $this->getAttribute($this->foreignKey)), + $this->relatedKey => $this->getOriginal($this->relatedKey, $this->getAttribute($this->relatedKey)), + ]); + } + + /** + * Get the table associated with the model. + * + * @return string + */ + public function getTable() + { + if (! isset($this->table)) { + $this->setTable(str_replace( + '\\', '', Str::snake(Str::singular(class_basename($this))) + )); + } + + return $this->table; + } + + /** + * Get the foreign key column name. + * + * @return string + */ + public function getForeignKey() + { + return $this->foreignKey; + } + + /** + * Get the "related key" column name. + * + * @return string + */ + public function getRelatedKey() + { + return $this->relatedKey; + } + + /** + * Get the "related key" column name. + * + * @return string + */ + public function getOtherKey() + { + return $this->getRelatedKey(); + } + + /** + * Set the key names for the pivot model instance. + * + * @param string $foreignKey + * @param string $relatedKey + * @return $this + */ + public function setPivotKeys($foreignKey, $relatedKey) + { + $this->foreignKey = $foreignKey; + + $this->relatedKey = $relatedKey; + + return $this; + } + + /** + * Determine if the pivot model has timestamp attributes. + * + * @return bool + */ + public function hasTimestampAttributes() + { + return array_key_exists($this->getCreatedAtColumn(), $this->attributes); + } + + /** + * Get the name of the "created at" column. + * + * @return string + */ + public function getCreatedAtColumn() + { + return $this->pivotParent + ? $this->pivotParent->getCreatedAtColumn() + : parent::getCreatedAtColumn(); + } + + /** + * Get the name of the "updated at" column. + * + * @return string + */ + public function getUpdatedAtColumn() + { + return $this->pivotParent + ? $this->pivotParent->getUpdatedAtColumn() + : parent::getUpdatedAtColumn(); + } + + /** + * Get the queueable identity for the entity. + * + * @return mixed + */ + public function getQueueableId() + { + if (isset($this->attributes[$this->getKeyName()])) { + return $this->getKey(); + } + + return sprintf( + '%s:%s:%s:%s', + $this->foreignKey, $this->getAttribute($this->foreignKey), + $this->relatedKey, $this->getAttribute($this->relatedKey) + ); + } + + /** + * Get a new query to restore one or more models by their queueable IDs. + * + * @param array $ids + * @return \Illuminate\Database\Eloquent\Builder + */ + public function newQueryForRestoration($ids) + { + if (is_array($ids)) { + return $this->newQueryForCollectionRestoration($ids); + } + + if (! Str::contains($ids, ':')) { + return parent::newQueryForRestoration($ids); + } + + $segments = explode(':', $ids); + + return $this->newQueryWithoutScopes() + ->where($segments[0], $segments[1]) + ->where($segments[2], $segments[3]); + } + + /** + * Get a new query to restore multiple models by their queueable IDs. + * + * @param array|int $ids + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function newQueryForCollectionRestoration(array $ids) + { + if (! Str::contains($ids[0], ':')) { + return parent::newQueryForRestoration($ids); + } + + $query = $this->newQueryWithoutScopes(); + + foreach ($ids as $id) { + $segments = explode(':', $id); + + $query->orWhere(function ($query) use ($segments) { + return $query->where($segments[0], $segments[1]) + ->where($segments[2], $segments[3]); + }); + } + + return $query; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php new file mode 100644 index 0000000..1984ec6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php @@ -0,0 +1,565 @@ + [], 'detached' => [], + ]; + + $records = $this->formatRecordsList($this->parseIds($ids)); + + // Next, we will determine which IDs should get removed from the join table by + // checking which of the given ID/records is in the list of current records + // and removing all of those rows from this "intermediate" joining table. + $detach = array_values(array_intersect( + $this->newPivotQuery()->pluck($this->relatedPivotKey)->all(), + array_keys($records) + )); + + if (count($detach) > 0) { + $this->detach($detach, false); + + $changes['detached'] = $this->castKeys($detach); + } + + // Finally, for all of the records which were not "detached", we'll attach the + // records into the intermediate table. Then, we will add those attaches to + // this change list and get ready to return these results to the callers. + $attach = array_diff_key($records, array_flip($detach)); + + if (count($attach) > 0) { + $this->attach($attach, [], false); + + $changes['attached'] = array_keys($attach); + } + + // Once we have finished attaching or detaching the records, we will see if we + // have done any attaching or detaching, and if we have we will touch these + // relationships if they are configured to touch on any database updates. + if ($touch && (count($changes['attached']) || + count($changes['detached']))) { + $this->touchIfTouching(); + } + + return $changes; + } + + /** + * Sync the intermediate tables with a list of IDs without detaching. + * + * @param \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|array $ids + * @return array + */ + public function syncWithoutDetaching($ids) + { + return $this->sync($ids, false); + } + + /** + * Sync the intermediate tables with a list of IDs or collection of models. + * + * @param \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|array $ids + * @param bool $detaching + * @return array + */ + public function sync($ids, $detaching = true) + { + $changes = [ + 'attached' => [], 'detached' => [], 'updated' => [], + ]; + + // First we need to attach any of the associated models that are not currently + // in this joining table. We'll spin through the given IDs, checking to see + // if they exist in the array of current ones, and if not we will insert. + $current = $this->newPivotQuery()->pluck( + $this->relatedPivotKey + )->all(); + + $detach = array_diff($current, array_keys( + $records = $this->formatRecordsList($this->parseIds($ids)) + )); + + // Next, we will take the differences of the currents and given IDs and detach + // all of the entities that exist in the "current" array but are not in the + // array of the new IDs given to the method which will complete the sync. + if ($detaching && count($detach) > 0) { + $this->detach($detach); + + $changes['detached'] = $this->castKeys($detach); + } + + // Now we are finally ready to attach the new records. Note that we'll disable + // touching until after the entire operation is complete so we don't fire a + // ton of touch operations until we are totally done syncing the records. + $changes = array_merge( + $changes, $this->attachNew($records, $current, false) + ); + + // Once we have finished attaching or detaching the records, we will see if we + // have done any attaching or detaching, and if we have we will touch these + // relationships if they are configured to touch on any database updates. + if (count($changes['attached']) || + count($changes['updated'])) { + $this->touchIfTouching(); + } + + return $changes; + } + + /** + * Format the sync / toggle record list so that it is keyed by ID. + * + * @param array $records + * @return array + */ + protected function formatRecordsList(array $records) + { + return collect($records)->mapWithKeys(function ($attributes, $id) { + if (! is_array($attributes)) { + [$id, $attributes] = [$attributes, []]; + } + + return [$id => $attributes]; + })->all(); + } + + /** + * Attach all of the records that aren't in the given current records. + * + * @param array $records + * @param array $current + * @param bool $touch + * @return array + */ + protected function attachNew(array $records, array $current, $touch = true) + { + $changes = ['attached' => [], 'updated' => []]; + + foreach ($records as $id => $attributes) { + // If the ID is not in the list of existing pivot IDs, we will insert a new pivot + // record, otherwise, we will just update this existing record on this joining + // table, so that the developers will easily update these records pain free. + if (! in_array($id, $current)) { + $this->attach($id, $attributes, $touch); + + $changes['attached'][] = $this->castKey($id); + } + + // Now we'll try to update an existing pivot record with the attributes that were + // given to the method. If the model is actually updated we will add it to the + // list of updated pivot records so we return them back out to the consumer. + elseif (count($attributes) > 0 && + $this->updateExistingPivot($id, $attributes, $touch)) { + $changes['updated'][] = $this->castKey($id); + } + } + + return $changes; + } + + /** + * Update an existing pivot record on the table. + * + * @param mixed $id + * @param array $attributes + * @param bool $touch + * @return int + */ + public function updateExistingPivot($id, array $attributes, $touch = true) + { + if (in_array($this->updatedAt(), $this->pivotColumns)) { + $attributes = $this->addTimestampsToAttachment($attributes, true); + } + + $updated = $this->newPivotStatementForId($this->parseId($id))->update( + $this->castAttributes($attributes) + ); + + if ($touch) { + $this->touchIfTouching(); + } + + return $updated; + } + + /** + * Attach a model to the parent. + * + * @param mixed $id + * @param array $attributes + * @param bool $touch + * @return void + */ + public function attach($id, array $attributes = [], $touch = true) + { + // Here we will insert the attachment records into the pivot table. Once we have + // inserted the records, we will touch the relationships if necessary and the + // function will return. We can parse the IDs before inserting the records. + $this->newPivotStatement()->insert($this->formatAttachRecords( + $this->parseIds($id), $attributes + )); + + if ($touch) { + $this->touchIfTouching(); + } + } + + /** + * Create an array of records to insert into the pivot table. + * + * @param array $ids + * @param array $attributes + * @return array + */ + protected function formatAttachRecords($ids, array $attributes) + { + $records = []; + + $hasTimestamps = ($this->hasPivotColumn($this->createdAt()) || + $this->hasPivotColumn($this->updatedAt())); + + // To create the attachment records, we will simply spin through the IDs given + // and create a new record to insert for each ID. Each ID may actually be a + // key in the array, with extra attributes to be placed in other columns. + foreach ($ids as $key => $value) { + $records[] = $this->formatAttachRecord( + $key, $value, $attributes, $hasTimestamps + ); + } + + return $records; + } + + /** + * Create a full attachment record payload. + * + * @param int $key + * @param mixed $value + * @param array $attributes + * @param bool $hasTimestamps + * @return array + */ + protected function formatAttachRecord($key, $value, $attributes, $hasTimestamps) + { + [$id, $attributes] = $this->extractAttachIdAndAttributes($key, $value, $attributes); + + return array_merge( + $this->baseAttachRecord($id, $hasTimestamps), $this->castAttributes($attributes) + ); + } + + /** + * Get the attach record ID and extra attributes. + * + * @param mixed $key + * @param mixed $value + * @param array $attributes + * @return array + */ + protected function extractAttachIdAndAttributes($key, $value, array $attributes) + { + return is_array($value) + ? [$key, array_merge($value, $attributes)] + : [$value, $attributes]; + } + + /** + * Create a new pivot attachment record. + * + * @param int $id + * @param bool $timed + * @return array + */ + protected function baseAttachRecord($id, $timed) + { + $record[$this->relatedPivotKey] = $id; + + $record[$this->foreignPivotKey] = $this->parent->{$this->parentKey}; + + // If the record needs to have creation and update timestamps, we will make + // them by calling the parent model's "freshTimestamp" method which will + // provide us with a fresh timestamp in this model's preferred format. + if ($timed) { + $record = $this->addTimestampsToAttachment($record); + } + + foreach ($this->pivotValues as $value) { + $record[$value['column']] = $value['value']; + } + + return $record; + } + + /** + * Set the creation and update timestamps on an attach record. + * + * @param array $record + * @param bool $exists + * @return array + */ + protected function addTimestampsToAttachment(array $record, $exists = false) + { + $fresh = $this->parent->freshTimestamp(); + + if ($this->using) { + $pivotModel = new $this->using; + + $fresh = $fresh->format($pivotModel->getDateFormat()); + } + + if (! $exists && $this->hasPivotColumn($this->createdAt())) { + $record[$this->createdAt()] = $fresh; + } + + if ($this->hasPivotColumn($this->updatedAt())) { + $record[$this->updatedAt()] = $fresh; + } + + return $record; + } + + /** + * Determine whether the given column is defined as a pivot column. + * + * @param string $column + * @return bool + */ + protected function hasPivotColumn($column) + { + return in_array($column, $this->pivotColumns); + } + + /** + * Detach models from the relationship. + * + * @param mixed $ids + * @param bool $touch + * @return int + */ + public function detach($ids = null, $touch = true) + { + $query = $this->newPivotQuery(); + + // If associated IDs were passed to the method we will only delete those + // associations, otherwise all of the association ties will be broken. + // We'll return the numbers of affected rows when we do the deletes. + if (! is_null($ids)) { + $ids = $this->parseIds($ids); + + if (empty($ids)) { + return 0; + } + + $query->whereIn($this->relatedPivotKey, (array) $ids); + } + + // Once we have all of the conditions set on the statement, we are ready + // to run the delete on the pivot table. Then, if the touch parameter + // is true, we will go ahead and touch all related models to sync. + $results = $query->delete(); + + if ($touch) { + $this->touchIfTouching(); + } + + return $results; + } + + /** + * Create a new pivot model instance. + * + * @param array $attributes + * @param bool $exists + * @return \Illuminate\Database\Eloquent\Relations\Pivot + */ + public function newPivot(array $attributes = [], $exists = false) + { + $pivot = $this->related->newPivot( + $this->parent, $attributes, $this->table, $exists, $this->using + ); + + return $pivot->setPivotKeys($this->foreignPivotKey, $this->relatedPivotKey); + } + + /** + * Create a new existing pivot model instance. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Relations\Pivot + */ + public function newExistingPivot(array $attributes = []) + { + return $this->newPivot($attributes, true); + } + + /** + * Get a new plain query builder for the pivot table. + * + * @return \Illuminate\Database\Query\Builder + */ + public function newPivotStatement() + { + return $this->query->getQuery()->newQuery()->from($this->table); + } + + /** + * Get a new pivot statement for a given "other" ID. + * + * @param mixed $id + * @return \Illuminate\Database\Query\Builder + */ + public function newPivotStatementForId($id) + { + return $this->newPivotQuery()->whereIn($this->relatedPivotKey, $this->parseIds($id)); + } + + /** + * Create a new query builder for the pivot table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function newPivotQuery() + { + $query = $this->newPivotStatement(); + + foreach ($this->pivotWheres as $arguments) { + call_user_func_array([$query, 'where'], $arguments); + } + + foreach ($this->pivotWhereIns as $arguments) { + call_user_func_array([$query, 'whereIn'], $arguments); + } + + return $query->where($this->foreignPivotKey, $this->parent->{$this->parentKey}); + } + + /** + * Set the columns on the pivot table to retrieve. + * + * @param array|mixed $columns + * @return $this + */ + public function withPivot($columns) + { + $this->pivotColumns = array_merge( + $this->pivotColumns, is_array($columns) ? $columns : func_get_args() + ); + + return $this; + } + + /** + * Get all of the IDs from the given mixed value. + * + * @param mixed $value + * @return array + */ + protected function parseIds($value) + { + if ($value instanceof Model) { + return [$value->{$this->relatedKey}]; + } + + if ($value instanceof Collection) { + return $value->pluck($this->relatedKey)->all(); + } + + if ($value instanceof BaseCollection) { + return $value->toArray(); + } + + return (array) $value; + } + + /** + * Get the ID from the given mixed value. + * + * @param mixed $value + * @return mixed + */ + protected function parseId($value) + { + return $value instanceof Model ? $value->{$this->relatedKey} : $value; + } + + /** + * Cast the given keys to integers if they are numeric and string otherwise. + * + * @param array $keys + * @return array + */ + protected function castKeys(array $keys) + { + return array_map(function ($v) { + return $this->castKey($v); + }, $keys); + } + + /** + * Cast the given key to convert to primary key type. + * + * @param mixed $key + * @return mixed + */ + protected function castKey($key) + { + return $this->getTypeSwapValue( + $this->related->getKeyType(), + $key + ); + } + + /** + * Cast the given pivot attributes. + * + * @param array $attributes + * @return array + */ + protected function castAttributes($attributes) + { + return $this->using + ? $this->newPivot()->fill($attributes)->getAttributes() + : $attributes; + } + + /** + * Converts a given value to a given type value. + * + * @param string $type + * @param mixed $value + * @return mixed + */ + protected function getTypeSwapValue($type, $value) + { + switch (strtolower($type)) { + case 'int': + case 'integer': + return (int) $value; + case 'real': + case 'float': + case 'double': + return (float) $value; + case 'string': + return (string) $value; + default: + return $value; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/SupportsDefaultModels.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/SupportsDefaultModels.php new file mode 100644 index 0000000..74e758f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/SupportsDefaultModels.php @@ -0,0 +1,63 @@ +withDefault = $callback; + + return $this; + } + + /** + * Get the default value for this relation. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @return \Illuminate\Database\Eloquent\Model|null + */ + protected function getDefaultFor(Model $parent) + { + if (! $this->withDefault) { + return; + } + + $instance = $this->newRelatedInstanceFor($parent); + + if (is_callable($this->withDefault)) { + return call_user_func($this->withDefault, $instance, $parent) ?: $instance; + } + + if (is_array($this->withDefault)) { + $instance->forceFill($this->withDefault); + } + + return $instance; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasMany.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasMany.php new file mode 100755 index 0000000..6149e47 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasMany.php @@ -0,0 +1,47 @@ +query->get(); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->related->newCollection()); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + return $this->matchMany($models, $results, $relation); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php new file mode 100644 index 0000000..96a5420 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php @@ -0,0 +1,635 @@ +localKey = $localKey; + $this->firstKey = $firstKey; + $this->secondKey = $secondKey; + $this->farParent = $farParent; + $this->throughParent = $throughParent; + $this->secondLocalKey = $secondLocalKey; + + parent::__construct($query, $throughParent); + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + public function addConstraints() + { + $localValue = $this->farParent[$this->localKey]; + + $this->performJoin(); + + if (static::$constraints) { + $this->query->where($this->getQualifiedFirstKeyName(), '=', $localValue); + } + } + + /** + * Set the join clause on the query. + * + * @param \Illuminate\Database\Eloquent\Builder|null $query + * @return void + */ + protected function performJoin(Builder $query = null) + { + $query = $query ?: $this->query; + + $farKey = $this->getQualifiedFarKeyName(); + + $query->join($this->throughParent->getTable(), $this->getQualifiedParentKeyName(), '=', $farKey); + + if ($this->throughParentSoftDeletes()) { + $query->whereNull($this->throughParent->getQualifiedDeletedAtColumn()); + } + } + + /** + * Get the fully qualified parent key name. + * + * @return string + */ + public function getQualifiedParentKeyName() + { + return $this->parent->qualifyColumn($this->secondLocalKey); + } + + /** + * Determine whether "through" parent of the relation uses Soft Deletes. + * + * @return bool + */ + public function throughParentSoftDeletes() + { + return in_array(SoftDeletes::class, class_uses_recursive($this->throughParent)); + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + $whereIn = $this->whereInMethod($this->farParent, $this->localKey); + + $this->query->{$whereIn}( + $this->getQualifiedFirstKeyName(), $this->getKeys($models, $this->localKey) + ); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->related->newCollection()); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + $dictionary = $this->buildDictionary($results); + + // Once we have the dictionary we can simply spin through the parent models to + // link them up with their children using the keyed dictionary to make the + // matching very convenient and easy work. Then we'll just return them. + foreach ($models as $model) { + if (isset($dictionary[$key = $model->getAttribute($this->localKey)])) { + $model->setRelation( + $relation, $this->related->newCollection($dictionary[$key]) + ); + } + } + + return $models; + } + + /** + * Build model dictionary keyed by the relation's foreign key. + * + * @param \Illuminate\Database\Eloquent\Collection $results + * @return array + */ + protected function buildDictionary(Collection $results) + { + $dictionary = []; + + // First we will create a dictionary of models keyed by the foreign key of the + // relationship as this will allow us to quickly access all of the related + // models without having to do nested looping which will be quite slow. + foreach ($results as $result) { + $dictionary[$result->{$this->firstKey}][] = $result; + } + + return $dictionary; + } + + /** + * Get the first related model record matching the attributes or instantiate it. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrNew(array $attributes) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->related->newInstance($attributes); + } + + return $instance; + } + + /** + * Create or update a related record matching the attributes, and fill it with values. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model + */ + public function updateOrCreate(array $attributes, array $values = []) + { + $instance = $this->firstOrNew($attributes); + + $instance->fill($values)->save(); + + return $instance; + } + + /** + * Execute the query and get the first related model. + * + * @param array $columns + * @return mixed + */ + public function first($columns = ['*']) + { + $results = $this->take(1)->get($columns); + + return count($results) > 0 ? $results->first() : null; + } + + /** + * Execute the query and get the first result or throw an exception. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|static + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function firstOrFail($columns = ['*']) + { + if (! is_null($model = $this->first($columns))) { + return $model; + } + + throw (new ModelNotFoundException)->setModel(get_class($this->related)); + } + + /** + * Find a related model by its primary key. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null + */ + public function find($id, $columns = ['*']) + { + if (is_array($id)) { + return $this->findMany($id, $columns); + } + + return $this->where( + $this->getRelated()->getQualifiedKeyName(), '=', $id + )->first($columns); + } + + /** + * Find multiple related models by their primary keys. + * + * @param mixed $ids + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function findMany($ids, $columns = ['*']) + { + if (empty($ids)) { + return $this->getRelated()->newCollection(); + } + + return $this->whereIn( + $this->getRelated()->getQualifiedKeyName(), $ids + )->get($columns); + } + + /** + * Find a related model by its primary key or throw an exception. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function findOrFail($id, $columns = ['*']) + { + $result = $this->find($id, $columns); + + if (is_array($id)) { + if (count($result) === count(array_unique($id))) { + return $result; + } + } elseif (! is_null($result)) { + return $result; + } + + throw (new ModelNotFoundException)->setModel(get_class($this->related), $id); + } + + /** + * Get the results of the relationship. + * + * @return mixed + */ + public function getResults() + { + return $this->get(); + } + + /** + * Execute the query as a "select" statement. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function get($columns = ['*']) + { + $builder = $this->prepareQueryBuilder($columns); + + $models = $builder->getModels(); + + // If we actually found models we will also eager load any relationships that + // have been specified as needing to be eager loaded. This will solve the + // n + 1 query problem for the developer and also increase performance. + if (count($models) > 0) { + $models = $builder->eagerLoadRelations($models); + } + + return $this->related->newCollection($models); + } + + /** + * Get a paginator for the "select" statement. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @param int $page + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator + */ + public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) + { + $this->query->addSelect($this->shouldSelect($columns)); + + return $this->query->paginate($perPage, $columns, $pageName, $page); + } + + /** + * Paginate the given query into a simple paginator. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\Paginator + */ + public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) + { + $this->query->addSelect($this->shouldSelect($columns)); + + return $this->query->simplePaginate($perPage, $columns, $pageName, $page); + } + + /** + * Set the select clause for the relation query. + * + * @param array $columns + * @return array + */ + protected function shouldSelect(array $columns = ['*']) + { + if ($columns == ['*']) { + $columns = [$this->related->getTable().'.*']; + } + + return array_merge($columns, [$this->getQualifiedFirstKeyName()]); + } + + /** + * Chunk the results of the query. + * + * @param int $count + * @param callable $callback + * @return bool + */ + public function chunk($count, callable $callback) + { + return $this->prepareQueryBuilder()->chunk($count, $callback); + } + + /** + * Get a generator for the given query. + * + * @return \Generator + */ + public function cursor() + { + return $this->prepareQueryBuilder()->cursor(); + } + + /** + * Execute a callback over each item while chunking. + * + * @param callable $callback + * @param int $count + * @return bool + */ + public function each(callable $callback, $count = 1000) + { + return $this->chunk($count, function ($results) use ($callback) { + foreach ($results as $key => $value) { + if ($callback($value, $key) === false) { + return false; + } + } + }); + } + + /** + * Prepare the query builder for query execution. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function prepareQueryBuilder($columns = ['*']) + { + $builder = $this->query->applyScopes(); + + return $builder->addSelect( + $this->shouldSelect($builder->getQuery()->columns ? [] : $columns) + ); + } + + /** + * Add the constraints for a relationship query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) + { + if ($parentQuery->getQuery()->from === $query->getQuery()->from) { + return $this->getRelationExistenceQueryForSelfRelation($query, $parentQuery, $columns); + } + + if ($parentQuery->getQuery()->from === $this->throughParent->getTable()) { + return $this->getRelationExistenceQueryForThroughSelfRelation($query, $parentQuery, $columns); + } + + $this->performJoin($query); + + return $query->select($columns)->whereColumn( + $this->getQualifiedLocalKeyName(), '=', $this->getQualifiedFirstKeyName() + ); + } + + /** + * Add the constraints for a relationship query on the same table. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) + { + $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash()); + + $query->join($this->throughParent->getTable(), $this->getQualifiedParentKeyName(), '=', $hash.'.'.$this->secondKey); + + if ($this->throughParentSoftDeletes()) { + $query->whereNull($this->throughParent->getQualifiedDeletedAtColumn()); + } + + $query->getModel()->setTable($hash); + + return $query->select($columns)->whereColumn( + $parentQuery->getQuery()->from.'.'.$this->localKey, '=', $this->getQualifiedFirstKeyName() + ); + } + + /** + * Add the constraints for a relationship query on the same table as the through parent. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQueryForThroughSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) + { + $table = $this->throughParent->getTable().' as '.$hash = $this->getRelationCountHash(); + + $query->join($table, $hash.'.'.$this->secondLocalKey, '=', $this->getQualifiedFarKeyName()); + + if ($this->throughParentSoftDeletes()) { + $query->whereNull($hash.'.'.$this->throughParent->getDeletedAtColumn()); + } + + return $query->select($columns)->whereColumn( + $parentQuery->getQuery()->from.'.'.$this->localKey, '=', $hash.'.'.$this->firstKey + ); + } + + /** + * Get a relationship join table hash. + * + * @return string + */ + public function getRelationCountHash() + { + return 'laravel_reserved_'.static::$selfJoinCount++; + } + + /** + * Get the qualified foreign key on the related model. + * + * @return string + */ + public function getQualifiedFarKeyName() + { + return $this->getQualifiedForeignKeyName(); + } + + /** + * Get the foreign key on the "through" model. + * + * @return string + */ + public function getFirstKeyName() + { + return $this->firstKey; + } + + /** + * Get the qualified foreign key on the "through" model. + * + * @return string + */ + public function getQualifiedFirstKeyName() + { + return $this->throughParent->qualifyColumn($this->firstKey); + } + + /** + * Get the foreign key on the related model. + * + * @return string + */ + public function getForeignKeyName() + { + return $this->secondKey; + } + + /** + * Get the qualified foreign key on the related model. + * + * @return string + */ + public function getQualifiedForeignKeyName() + { + return $this->related->qualifyColumn($this->secondKey); + } + + /** + * Get the local key on the far parent model. + * + * @return string + */ + public function getLocalKeyName() + { + return $this->localKey; + } + + /** + * Get the qualified local key on the far parent model. + * + * @return string + */ + public function getQualifiedLocalKeyName() + { + return $this->farParent->qualifyColumn($this->localKey); + } + + /** + * Get the local key on the intermediary model. + * + * @return string + */ + public function getSecondLocalKeyName() + { + return $this->secondLocalKey; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOne.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOne.php new file mode 100755 index 0000000..858e5d0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOne.php @@ -0,0 +1,64 @@ +query->first() ?: $this->getDefaultFor($this->parent); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->getDefaultFor($model)); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + return $this->matchOne($models, $results, $relation); + } + + /** + * Make a new related instance for the given model. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @return \Illuminate\Database\Eloquent\Model + */ + public function newRelatedInstanceFor(Model $parent) + { + return $this->related->newInstance()->setAttribute( + $this->getForeignKeyName(), $parent->{$this->localKey} + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php new file mode 100755 index 0000000..ffcbb96 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php @@ -0,0 +1,435 @@ +localKey = $localKey; + $this->foreignKey = $foreignKey; + + parent::__construct($query, $parent); + } + + /** + * Create and return an un-saved instance of the related model. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function make(array $attributes = []) + { + return tap($this->related->newInstance($attributes), function ($instance) { + $this->setForeignAttributesForCreate($instance); + }); + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + public function addConstraints() + { + if (static::$constraints) { + $this->query->where($this->foreignKey, '=', $this->getParentKey()); + + $this->query->whereNotNull($this->foreignKey); + } + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + $whereIn = $this->whereInMethod($this->parent, $this->localKey); + + $this->query->{$whereIn}( + $this->foreignKey, $this->getKeys($models, $this->localKey) + ); + } + + /** + * Match the eagerly loaded results to their single parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function matchOne(array $models, Collection $results, $relation) + { + return $this->matchOneOrMany($models, $results, $relation, 'one'); + } + + /** + * Match the eagerly loaded results to their many parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function matchMany(array $models, Collection $results, $relation) + { + return $this->matchOneOrMany($models, $results, $relation, 'many'); + } + + /** + * Match the eagerly loaded results to their many parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @param string $type + * @return array + */ + protected function matchOneOrMany(array $models, Collection $results, $relation, $type) + { + $dictionary = $this->buildDictionary($results); + + // Once we have the dictionary we can simply spin through the parent models to + // link them up with their children using the keyed dictionary to make the + // matching very convenient and easy work. Then we'll just return them. + foreach ($models as $model) { + if (isset($dictionary[$key = $model->getAttribute($this->localKey)])) { + $model->setRelation( + $relation, $this->getRelationValue($dictionary, $key, $type) + ); + } + } + + return $models; + } + + /** + * Get the value of a relationship by one or many type. + * + * @param array $dictionary + * @param string $key + * @param string $type + * @return mixed + */ + protected function getRelationValue(array $dictionary, $key, $type) + { + $value = $dictionary[$key]; + + return $type === 'one' ? reset($value) : $this->related->newCollection($value); + } + + /** + * Build model dictionary keyed by the relation's foreign key. + * + * @param \Illuminate\Database\Eloquent\Collection $results + * @return array + */ + protected function buildDictionary(Collection $results) + { + $foreign = $this->getForeignKeyName(); + + return $results->mapToDictionary(function ($result) use ($foreign) { + return [$result->{$foreign} => $result]; + })->all(); + } + + /** + * Find a model by its primary key or return new instance of the related model. + * + * @param mixed $id + * @param array $columns + * @return \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model + */ + public function findOrNew($id, $columns = ['*']) + { + if (is_null($instance = $this->find($id, $columns))) { + $instance = $this->related->newInstance(); + + $this->setForeignAttributesForCreate($instance); + } + + return $instance; + } + + /** + * Get the first related model record matching the attributes or instantiate it. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrNew(array $attributes, array $values = []) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->related->newInstance($attributes + $values); + + $this->setForeignAttributesForCreate($instance); + } + + return $instance; + } + + /** + * Get the first related record matching the attributes or create it. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model + */ + public function firstOrCreate(array $attributes, array $values = []) + { + if (is_null($instance = $this->where($attributes)->first())) { + $instance = $this->create($attributes + $values); + } + + return $instance; + } + + /** + * Create or update a related record matching the attributes, and fill it with values. + * + * @param array $attributes + * @param array $values + * @return \Illuminate\Database\Eloquent\Model + */ + public function updateOrCreate(array $attributes, array $values = []) + { + return tap($this->firstOrNew($attributes), function ($instance) use ($values) { + $instance->fill($values); + + $instance->save(); + }); + } + + /** + * Attach a model instance to the parent model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return \Illuminate\Database\Eloquent\Model|false + */ + public function save(Model $model) + { + $this->setForeignAttributesForCreate($model); + + return $model->save() ? $model : false; + } + + /** + * Attach a collection of models to the parent instance. + * + * @param \Traversable|array $models + * @return \Traversable|array + */ + public function saveMany($models) + { + foreach ($models as $model) { + $this->save($model); + } + + return $models; + } + + /** + * Create a new instance of the related model. + * + * @param array $attributes + * @return \Illuminate\Database\Eloquent\Model + */ + public function create(array $attributes = []) + { + return tap($this->related->newInstance($attributes), function ($instance) { + $this->setForeignAttributesForCreate($instance); + + $instance->save(); + }); + } + + /** + * Create a Collection of new instances of the related model. + * + * @param array $records + * @return \Illuminate\Database\Eloquent\Collection + */ + public function createMany(array $records) + { + $instances = $this->related->newCollection(); + + foreach ($records as $record) { + $instances->push($this->create($record)); + } + + return $instances; + } + + /** + * Set the foreign ID for creating a related model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return void + */ + protected function setForeignAttributesForCreate(Model $model) + { + $model->setAttribute($this->getForeignKeyName(), $this->getParentKey()); + } + + /** + * Perform an update on all the related models. + * + * @param array $attributes + * @return int + */ + public function update(array $attributes) + { + if ($this->related->usesTimestamps() && ! is_null($this->relatedUpdatedAt())) { + $attributes[$this->relatedUpdatedAt()] = $this->related->freshTimestampString(); + } + + return $this->query->update($attributes); + } + + /** + * Add the constraints for a relationship query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) + { + if ($query->getQuery()->from == $parentQuery->getQuery()->from) { + return $this->getRelationExistenceQueryForSelfRelation($query, $parentQuery, $columns); + } + + return parent::getRelationExistenceQuery($query, $parentQuery, $columns); + } + + /** + * Add the constraints for a relationship query on the same table. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, $columns = ['*']) + { + $query->from($query->getModel()->getTable().' as '.$hash = $this->getRelationCountHash()); + + $query->getModel()->setTable($hash); + + return $query->select($columns)->whereColumn( + $this->getQualifiedParentKeyName(), '=', $hash.'.'.$this->getForeignKeyName() + ); + } + + /** + * Get a relationship join table hash. + * + * @return string + */ + public function getRelationCountHash() + { + return 'laravel_reserved_'.static::$selfJoinCount++; + } + + /** + * Get the key for comparing against the parent key in "has" query. + * + * @return string + */ + public function getExistenceCompareKey() + { + return $this->getQualifiedForeignKeyName(); + } + + /** + * Get the key value of the parent's local key. + * + * @return mixed + */ + public function getParentKey() + { + return $this->parent->getAttribute($this->localKey); + } + + /** + * Get the fully qualified parent key name. + * + * @return string + */ + public function getQualifiedParentKeyName() + { + return $this->parent->qualifyColumn($this->localKey); + } + + /** + * Get the plain foreign key. + * + * @return string + */ + public function getForeignKeyName() + { + $segments = explode('.', $this->getQualifiedForeignKeyName()); + + return end($segments); + } + + /** + * Get the foreign key for the relationship. + * + * @return string + */ + public function getQualifiedForeignKeyName() + { + return $this->foreignKey; + } + + /** + * Get the local key for the relationship. + * + * @return string + */ + public function getLocalKeyName() + { + return $this->localKey; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphMany.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphMany.php new file mode 100755 index 0000000..e2a5c5a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphMany.php @@ -0,0 +1,47 @@ +query->get(); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->related->newCollection()); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + return $this->matchMany($models, $results, $relation); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOne.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOne.php new file mode 100755 index 0000000..520a7ec --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOne.php @@ -0,0 +1,64 @@ +query->first() ?: $this->getDefaultFor($this->parent); + } + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + public function initRelation(array $models, $relation) + { + foreach ($models as $model) { + $model->setRelation($relation, $this->getDefaultFor($model)); + } + + return $models; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + return $this->matchOne($models, $results, $relation); + } + + /** + * Make a new related instance for the given model. + * + * @param \Illuminate\Database\Eloquent\Model $parent + * @return \Illuminate\Database\Eloquent\Model + */ + public function newRelatedInstanceFor(Model $parent) + { + return $this->related->newInstance() + ->setAttribute($this->getForeignKeyName(), $parent->{$this->localKey}) + ->setAttribute($this->getMorphType(), $this->morphClass); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php new file mode 100755 index 0000000..58de31c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php @@ -0,0 +1,127 @@ +morphType = $type; + + $this->morphClass = $parent->getMorphClass(); + + parent::__construct($query, $parent, $id, $localKey); + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + public function addConstraints() + { + if (static::$constraints) { + parent::addConstraints(); + + $this->query->where($this->morphType, $this->morphClass); + } + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + parent::addEagerConstraints($models); + + $this->query->where($this->morphType, $this->morphClass); + } + + /** + * Set the foreign ID and type for creating a related model. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return void + */ + protected function setForeignAttributesForCreate(Model $model) + { + $model->{$this->getForeignKeyName()} = $this->getParentKey(); + + $model->{$this->getMorphType()} = $this->morphClass; + } + + /** + * Get the relationship query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) + { + return parent::getRelationExistenceQuery($query, $parentQuery, $columns)->where( + $this->morphType, $this->morphClass + ); + } + + /** + * Get the foreign key "type" name. + * + * @return string + */ + public function getQualifiedMorphType() + { + return $this->morphType; + } + + /** + * Get the plain morph type name without the table. + * + * @return string + */ + public function getMorphType() + { + return last(explode('.', $this->morphType)); + } + + /** + * Get the class name of the parent model. + * + * @return string + */ + public function getMorphClass() + { + return $this->morphClass; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php new file mode 100644 index 0000000..ade5953 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php @@ -0,0 +1,150 @@ +where($this->morphType, $this->morphClass); + + return parent::setKeysForSaveQuery($query); + } + + /** + * Delete the pivot model record from the database. + * + * @return int + */ + public function delete() + { + $query = $this->getDeleteQuery(); + + $query->where($this->morphType, $this->morphClass); + + return $query->delete(); + } + + /** + * Set the morph type for the pivot. + * + * @param string $morphType + * @return $this + */ + public function setMorphType($morphType) + { + $this->morphType = $morphType; + + return $this; + } + + /** + * Set the morph class for the pivot. + * + * @param string $morphClass + * @return \Illuminate\Database\Eloquent\Relations\MorphPivot + */ + public function setMorphClass($morphClass) + { + $this->morphClass = $morphClass; + + return $this; + } + + /** + * Get the queueable identity for the entity. + * + * @return mixed + */ + public function getQueueableId() + { + if (isset($this->attributes[$this->getKeyName()])) { + return $this->getKey(); + } + + return sprintf( + '%s:%s:%s:%s:%s:%s', + $this->foreignKey, $this->getAttribute($this->foreignKey), + $this->relatedKey, $this->getAttribute($this->relatedKey), + $this->morphType, $this->morphClass + ); + } + + /** + * Get a new query to restore one or more models by their queueable IDs. + * + * @param array|int $ids + * @return \Illuminate\Database\Eloquent\Builder + */ + public function newQueryForRestoration($ids) + { + if (is_array($ids)) { + return $this->newQueryForCollectionRestoration($ids); + } + + if (! Str::contains($ids, ':')) { + return parent::newQueryForRestoration($ids); + } + + $segments = explode(':', $ids); + + return $this->newQueryWithoutScopes() + ->where($segments[0], $segments[1]) + ->where($segments[2], $segments[3]) + ->where($segments[4], $segments[5]); + } + + /** + * Get a new query to restore multiple models by their queueable IDs. + * + * @param array $ids + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function newQueryForCollectionRestoration(array $ids) + { + if (! Str::contains($ids[0], ':')) { + return parent::newQueryForRestoration($ids); + } + + $query = $this->newQueryWithoutScopes(); + + foreach ($ids as $id) { + $segments = explode(':', $id); + + $query->orWhere(function ($query) use ($segments) { + return $query->where($segments[0], $segments[1]) + ->where($segments[2], $segments[3]) + ->where($segments[4], $segments[5]); + }); + } + + return $query; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphTo.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphTo.php new file mode 100644 index 0000000..3a14973 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphTo.php @@ -0,0 +1,298 @@ +morphType = $type; + + parent::__construct($query, $parent, $foreignKey, $ownerKey, $relation); + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + $this->buildDictionary($this->models = Collection::make($models)); + } + + /** + * Build a dictionary with the models. + * + * @param \Illuminate\Database\Eloquent\Collection $models + * @return void + */ + protected function buildDictionary(Collection $models) + { + foreach ($models as $model) { + if ($model->{$this->morphType}) { + $this->dictionary[$model->{$this->morphType}][$model->{$this->foreignKey}][] = $model; + } + } + } + + /** + * Get the results of the relationship. + * + * @return mixed + */ + public function getResults() + { + return $this->ownerKey ? parent::getResults() : null; + } + + /** + * Get the results of the relationship. + * + * Called via eager load method of Eloquent query builder. + * + * @return mixed + */ + public function getEager() + { + foreach (array_keys($this->dictionary) as $type) { + $this->matchToMorphParents($type, $this->getResultsByType($type)); + } + + return $this->models; + } + + /** + * Get all of the relation results for a type. + * + * @param string $type + * @return \Illuminate\Database\Eloquent\Collection + */ + protected function getResultsByType($type) + { + $instance = $this->createModelByType($type); + + $ownerKey = $this->ownerKey ?? $instance->getKeyName(); + + $query = $this->replayMacros($instance->newQuery()) + ->mergeConstraintsFrom($this->getQuery()) + ->with($this->getQuery()->getEagerLoads()); + + return $query->whereIn( + $instance->getTable().'.'.$ownerKey, $this->gatherKeysByType($type) + )->get(); + } + + /** + * Gather all of the foreign keys for a given type. + * + * @param string $type + * @return array + */ + protected function gatherKeysByType($type) + { + return collect($this->dictionary[$type])->map(function ($models) { + return head($models)->{$this->foreignKey}; + })->values()->unique()->all(); + } + + /** + * Create a new model instance by type. + * + * @param string $type + * @return \Illuminate\Database\Eloquent\Model + */ + public function createModelByType($type) + { + $class = Model::getActualClassNameForMorph($type); + + return new $class; + } + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + public function match(array $models, Collection $results, $relation) + { + return $models; + } + + /** + * Match the results for a given type to their parents. + * + * @param string $type + * @param \Illuminate\Database\Eloquent\Collection $results + * @return void + */ + protected function matchToMorphParents($type, Collection $results) + { + foreach ($results as $result) { + $ownerKey = ! is_null($this->ownerKey) ? $result->{$this->ownerKey} : $result->getKey(); + + if (isset($this->dictionary[$type][$ownerKey])) { + foreach ($this->dictionary[$type][$ownerKey] as $model) { + $model->setRelation($this->relation, $result); + } + } + } + } + + /** + * Associate the model instance to the given parent. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @return \Illuminate\Database\Eloquent\Model + */ + public function associate($model) + { + $this->parent->setAttribute( + $this->foreignKey, $model instanceof Model ? $model->getKey() : null + ); + + $this->parent->setAttribute( + $this->morphType, $model instanceof Model ? $model->getMorphClass() : null + ); + + return $this->parent->setRelation($this->relation, $model); + } + + /** + * Dissociate previously associated model from the given parent. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function dissociate() + { + $this->parent->setAttribute($this->foreignKey, null); + + $this->parent->setAttribute($this->morphType, null); + + return $this->parent->setRelation($this->relation, null); + } + + /** + * Touch all of the related models for the relationship. + * + * @return void + */ + public function touch() + { + if (! is_null($this->ownerKey)) { + parent::touch(); + } + } + + /** + * Get the foreign key "type" name. + * + * @return string + */ + public function getMorphType() + { + return $this->morphType; + } + + /** + * Get the dictionary used by the relationship. + * + * @return array + */ + public function getDictionary() + { + return $this->dictionary; + } + + /** + * Replay stored macro calls on the actual related instance. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function replayMacros(Builder $query) + { + foreach ($this->macroBuffer as $macro) { + $query->{$macro['method']}(...$macro['parameters']); + } + + return $query; + } + + /** + * Handle dynamic method calls to the relationship. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + try { + $result = parent::__call($method, $parameters); + + if (in_array($method, ['select', 'selectRaw', 'selectSub', 'addSelect', 'withoutGlobalScopes'])) { + $this->macroBuffer[] = compact('method', 'parameters'); + } + + return $result; + } + + // If we tried to call a method that does not exist on the parent Builder instance, + // we'll assume that we want to call a query macro (e.g. withTrashed) that only + // exists on related models. We will just store the call and replay it later. + catch (BadMethodCallException $e) { + $this->macroBuffer[] = compact('method', 'parameters'); + + return $this; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php new file mode 100644 index 0000000..e487af0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php @@ -0,0 +1,194 @@ +inverse = $inverse; + $this->morphType = $name.'_type'; + $this->morphClass = $inverse ? $query->getModel()->getMorphClass() : $parent->getMorphClass(); + + parent::__construct( + $query, $parent, $table, $foreignPivotKey, + $relatedPivotKey, $parentKey, $relatedKey, $relationName + ); + } + + /** + * Set the where clause for the relation query. + * + * @return $this + */ + protected function addWhereConstraints() + { + parent::addWhereConstraints(); + + $this->query->where($this->table.'.'.$this->morphType, $this->morphClass); + + return $this; + } + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + public function addEagerConstraints(array $models) + { + parent::addEagerConstraints($models); + + $this->query->where($this->table.'.'.$this->morphType, $this->morphClass); + } + + /** + * Create a new pivot attachment record. + * + * @param int $id + * @param bool $timed + * @return array + */ + protected function baseAttachRecord($id, $timed) + { + return Arr::add( + parent::baseAttachRecord($id, $timed), $this->morphType, $this->morphClass + ); + } + + /** + * Add the constraints for a relationship count query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) + { + return parent::getRelationExistenceQuery($query, $parentQuery, $columns)->where( + $this->table.'.'.$this->morphType, $this->morphClass + ); + } + + /** + * Create a new query builder for the pivot table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function newPivotQuery() + { + return parent::newPivotQuery()->where($this->morphType, $this->morphClass); + } + + /** + * Create a new pivot model instance. + * + * @param array $attributes + * @param bool $exists + * @return \Illuminate\Database\Eloquent\Relations\Pivot + */ + public function newPivot(array $attributes = [], $exists = false) + { + $using = $this->using; + + $pivot = $using ? $using::fromRawAttributes($this->parent, $attributes, $this->table, $exists) + : MorphPivot::fromAttributes($this->parent, $attributes, $this->table, $exists); + + $pivot->setPivotKeys($this->foreignPivotKey, $this->relatedPivotKey) + ->setMorphType($this->morphType) + ->setMorphClass($this->morphClass); + + return $pivot; + } + + /** + * Get the pivot columns for the relation. + * + * "pivot_" is prefixed at each column for easy removal later. + * + * @return array + */ + protected function aliasedPivotColumns() + { + $defaults = [$this->foreignPivotKey, $this->relatedPivotKey, $this->morphType]; + + return collect(array_merge($defaults, $this->pivotColumns))->map(function ($column) { + return $this->table.'.'.$column.' as pivot_'.$column; + })->unique()->all(); + } + + /** + * Get the foreign key "type" name. + * + * @return string + */ + public function getMorphType() + { + return $this->morphType; + } + + /** + * Get the class name of the parent model. + * + * @return string + */ + public function getMorphClass() + { + return $this->morphClass; + } + + /** + * Get the indicator for a reverse relationship. + * + * @return bool + */ + public function getInverse() + { + return $this->inverse; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Pivot.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Pivot.php new file mode 100755 index 0000000..2ec8235 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Pivot.php @@ -0,0 +1,18 @@ +query = $query; + $this->parent = $parent; + $this->related = $query->getModel(); + + $this->addConstraints(); + } + + /** + * Run a callback with constraints disabled on the relation. + * + * @param \Closure $callback + * @return mixed + */ + public static function noConstraints(Closure $callback) + { + $previous = static::$constraints; + + static::$constraints = false; + + // When resetting the relation where clause, we want to shift the first element + // off of the bindings, leaving only the constraints that the developers put + // as "extra" on the relationships, and not original relation constraints. + try { + return call_user_func($callback); + } finally { + static::$constraints = $previous; + } + } + + /** + * Set the base constraints on the relation query. + * + * @return void + */ + abstract public function addConstraints(); + + /** + * Set the constraints for an eager load of the relation. + * + * @param array $models + * @return void + */ + abstract public function addEagerConstraints(array $models); + + /** + * Initialize the relation on a set of models. + * + * @param array $models + * @param string $relation + * @return array + */ + abstract public function initRelation(array $models, $relation); + + /** + * Match the eagerly loaded results to their parents. + * + * @param array $models + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation + * @return array + */ + abstract public function match(array $models, Collection $results, $relation); + + /** + * Get the results of the relationship. + * + * @return mixed + */ + abstract public function getResults(); + + /** + * Get the relationship for eager loading. + * + * @return \Illuminate\Database\Eloquent\Collection + */ + public function getEager() + { + return $this->get(); + } + + /** + * Execute the query as a "select" statement. + * + * @param array $columns + * @return \Illuminate\Database\Eloquent\Collection + */ + public function get($columns = ['*']) + { + return $this->query->get($columns); + } + + /** + * Touch all of the related models for the relationship. + * + * @return void + */ + public function touch() + { + $model = $this->getRelated(); + + if (! $model::isIgnoringTouch()) { + $this->rawUpdate([ + $model->getUpdatedAtColumn() => $model->freshTimestampString(), + ]); + } + } + + /** + * Run a raw update against the base query. + * + * @param array $attributes + * @return int + */ + public function rawUpdate(array $attributes = []) + { + return $this->query->withoutGlobalScopes()->update($attributes); + } + + /** + * Add the constraints for a relationship count query. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceCountQuery(Builder $query, Builder $parentQuery) + { + return $this->getRelationExistenceQuery( + $query, $parentQuery, new Expression('count(*)') + )->setBindings([], 'select'); + } + + /** + * Add the constraints for an internal relationship existence query. + * + * Essentially, these queries compare on column names like whereColumn. + * + * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $parentQuery + * @param array|mixed $columns + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) + { + return $query->select($columns)->whereColumn( + $this->getQualifiedParentKeyName(), '=', $this->getExistenceCompareKey() + ); + } + + /** + * Get all of the primary keys for an array of models. + * + * @param array $models + * @param string $key + * @return array + */ + protected function getKeys(array $models, $key = null) + { + return collect($models)->map(function ($value) use ($key) { + return $key ? $value->getAttribute($key) : $value->getKey(); + })->values()->unique(null, true)->sort()->all(); + } + + /** + * Get the underlying query for the relation. + * + * @return \Illuminate\Database\Eloquent\Builder + */ + public function getQuery() + { + return $this->query; + } + + /** + * Get the base query builder driving the Eloquent builder. + * + * @return \Illuminate\Database\Query\Builder + */ + public function getBaseQuery() + { + return $this->query->getQuery(); + } + + /** + * Get the parent model of the relation. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function getParent() + { + return $this->parent; + } + + /** + * Get the fully qualified parent key name. + * + * @return string + */ + public function getQualifiedParentKeyName() + { + return $this->parent->getQualifiedKeyName(); + } + + /** + * Get the related model of the relation. + * + * @return \Illuminate\Database\Eloquent\Model + */ + public function getRelated() + { + return $this->related; + } + + /** + * Get the name of the "created at" column. + * + * @return string + */ + public function createdAt() + { + return $this->parent->getCreatedAtColumn(); + } + + /** + * Get the name of the "updated at" column. + * + * @return string + */ + public function updatedAt() + { + return $this->parent->getUpdatedAtColumn(); + } + + /** + * Get the name of the related model's "updated at" column. + * + * @return string + */ + public function relatedUpdatedAt() + { + return $this->related->getUpdatedAtColumn(); + } + + /** + * Get the name of the "where in" method for eager loading. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @param string $key + * @return string + */ + protected function whereInMethod(Model $model, $key) + { + return $model->getKeyName() === last(explode('.', $key)) + && $model->getIncrementing() + && in_array($model->getKeyType(), ['int', 'integer']) + ? 'whereIntegerInRaw' + : 'whereIn'; + } + + /** + * Set or get the morph map for polymorphic relations. + * + * @param array|null $map + * @param bool $merge + * @return array + */ + public static function morphMap(array $map = null, $merge = true) + { + $map = static::buildMorphMapFromModels($map); + + if (is_array($map)) { + static::$morphMap = $merge && static::$morphMap + ? $map + static::$morphMap : $map; + } + + return static::$morphMap; + } + + /** + * Builds a table-keyed array from model class names. + * + * @param string[]|null $models + * @return array|null + */ + protected static function buildMorphMapFromModels(array $models = null) + { + if (is_null($models) || Arr::isAssoc($models)) { + return $models; + } + + return array_combine(array_map(function ($model) { + return (new $model)->getTable(); + }, $models), $models); + } + + /** + * Get the model associated with a custom polymorphic type. + * + * @param string $alias + * @return string|null + */ + public static function getMorphedModel($alias) + { + return self::$morphMap[$alias] ?? null; + } + + /** + * Handle dynamic method calls to the relationship. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + $result = $this->forwardCallTo($this->query, $method, $parameters); + + if ($result === $this->query) { + return $this; + } + + return $result; + } + + /** + * Force a clone of the underlying query builder when cloning. + * + * @return void + */ + public function __clone() + { + $this->query = clone $this->query; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Scope.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Scope.php new file mode 100644 index 0000000..63cba6a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Scope.php @@ -0,0 +1,15 @@ +forceDeleting = true; + + return tap($this->delete(), function ($deleted) { + $this->forceDeleting = false; + + if ($deleted) { + $this->fireModelEvent('forceDeleted', false); + } + }); + } + + /** + * Perform the actual delete query on this model instance. + * + * @return mixed + */ + protected function performDeleteOnModel() + { + if ($this->forceDeleting) { + $this->exists = false; + + return $this->newModelQuery()->where($this->getKeyName(), $this->getKey())->forceDelete(); + } + + return $this->runSoftDelete(); + } + + /** + * Perform the actual delete query on this model instance. + * + * @return void + */ + protected function runSoftDelete() + { + $query = $this->newModelQuery()->where($this->getKeyName(), $this->getKey()); + + $time = $this->freshTimestamp(); + + $columns = [$this->getDeletedAtColumn() => $this->fromDateTime($time)]; + + $this->{$this->getDeletedAtColumn()} = $time; + + if ($this->timestamps && ! is_null($this->getUpdatedAtColumn())) { + $this->{$this->getUpdatedAtColumn()} = $time; + + $columns[$this->getUpdatedAtColumn()] = $this->fromDateTime($time); + } + + $query->update($columns); + } + + /** + * Restore a soft-deleted model instance. + * + * @return bool|null + */ + public function restore() + { + // If the restoring event does not return false, we will proceed with this + // restore operation. Otherwise, we bail out so the developer will stop + // the restore totally. We will clear the deleted timestamp and save. + if ($this->fireModelEvent('restoring') === false) { + return false; + } + + $this->{$this->getDeletedAtColumn()} = null; + + // Once we have saved the model, we will fire the "restored" event so this + // developer will do anything they need to after a restore operation is + // totally finished. Then we will return the result of the save call. + $this->exists = true; + + $result = $this->save(); + + $this->fireModelEvent('restored', false); + + return $result; + } + + /** + * Determine if the model instance has been soft-deleted. + * + * @return bool + */ + public function trashed() + { + return ! is_null($this->{$this->getDeletedAtColumn()}); + } + + /** + * Register a restoring model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function restoring($callback) + { + static::registerModelEvent('restoring', $callback); + } + + /** + * Register a restored model event with the dispatcher. + * + * @param \Closure|string $callback + * @return void + */ + public static function restored($callback) + { + static::registerModelEvent('restored', $callback); + } + + /** + * Determine if the model is currently force deleting. + * + * @return bool + */ + public function isForceDeleting() + { + return $this->forceDeleting; + } + + /** + * Get the name of the "deleted at" column. + * + * @return string + */ + public function getDeletedAtColumn() + { + return defined('static::DELETED_AT') ? static::DELETED_AT : 'deleted_at'; + } + + /** + * Get the fully qualified "deleted at" column. + * + * @return string + */ + public function getQualifiedDeletedAtColumn() + { + return $this->qualifyColumn($this->getDeletedAtColumn()); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php new file mode 100644 index 0000000..0d51696 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php @@ -0,0 +1,131 @@ +whereNull($model->getQualifiedDeletedAtColumn()); + } + + /** + * Extend the query builder with the needed functions. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return void + */ + public function extend(Builder $builder) + { + foreach ($this->extensions as $extension) { + $this->{"add{$extension}"}($builder); + } + + $builder->onDelete(function (Builder $builder) { + $column = $this->getDeletedAtColumn($builder); + + return $builder->update([ + $column => $builder->getModel()->freshTimestampString(), + ]); + }); + } + + /** + * Get the "deleted at" column for the builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return string + */ + protected function getDeletedAtColumn(Builder $builder) + { + if (count((array) $builder->getQuery()->joins) > 0) { + return $builder->getModel()->getQualifiedDeletedAtColumn(); + } + + return $builder->getModel()->getDeletedAtColumn(); + } + + /** + * Add the restore extension to the builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return void + */ + protected function addRestore(Builder $builder) + { + $builder->macro('restore', function (Builder $builder) { + $builder->withTrashed(); + + return $builder->update([$builder->getModel()->getDeletedAtColumn() => null]); + }); + } + + /** + * Add the with-trashed extension to the builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return void + */ + protected function addWithTrashed(Builder $builder) + { + $builder->macro('withTrashed', function (Builder $builder, $withTrashed = true) { + if (! $withTrashed) { + return $builder->withoutTrashed(); + } + + return $builder->withoutGlobalScope($this); + }); + } + + /** + * Add the without-trashed extension to the builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return void + */ + protected function addWithoutTrashed(Builder $builder) + { + $builder->macro('withoutTrashed', function (Builder $builder) { + $model = $builder->getModel(); + + $builder->withoutGlobalScope($this)->whereNull( + $model->getQualifiedDeletedAtColumn() + ); + + return $builder; + }); + } + + /** + * Add the only-trashed extension to the builder. + * + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return void + */ + protected function addOnlyTrashed(Builder $builder) + { + $builder->macro('onlyTrashed', function (Builder $builder) { + $model = $builder->getModel(); + + $builder->withoutGlobalScope($this)->whereNotNull( + $model->getQualifiedDeletedAtColumn() + ); + + return $builder; + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Events/ConnectionEvent.php b/vendor/laravel/framework/src/Illuminate/Database/Events/ConnectionEvent.php new file mode 100644 index 0000000..818c785 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Events/ConnectionEvent.php @@ -0,0 +1,32 @@ +connection = $connection; + $this->connectionName = $connection->getName(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Events/QueryExecuted.php b/vendor/laravel/framework/src/Illuminate/Database/Events/QueryExecuted.php new file mode 100644 index 0000000..833a21e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Events/QueryExecuted.php @@ -0,0 +1,59 @@ +sql = $sql; + $this->time = $time; + $this->bindings = $bindings; + $this->connection = $connection; + $this->connectionName = $connection->getName(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Events/StatementPrepared.php b/vendor/laravel/framework/src/Illuminate/Database/Events/StatementPrepared.php new file mode 100644 index 0000000..2f60323 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Events/StatementPrepared.php @@ -0,0 +1,33 @@ +statement = $statement; + $this->connection = $connection; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Events/TransactionBeginning.php b/vendor/laravel/framework/src/Illuminate/Database/Events/TransactionBeginning.php new file mode 100644 index 0000000..3287b5c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Events/TransactionBeginning.php @@ -0,0 +1,8 @@ +isExpression($table)) { + return $this->wrap($this->tablePrefix.$table, true); + } + + return $this->getValue($table); + } + + /** + * Wrap a value in keyword identifiers. + * + * @param \Illuminate\Database\Query\Expression|string $value + * @param bool $prefixAlias + * @return string + */ + public function wrap($value, $prefixAlias = false) + { + if ($this->isExpression($value)) { + return $this->getValue($value); + } + + // If the value being wrapped has a column alias we will need to separate out + // the pieces so we can wrap each of the segments of the expression on its + // own, and then join these both back together using the "as" connector. + if (stripos($value, ' as ') !== false) { + return $this->wrapAliasedValue($value, $prefixAlias); + } + + return $this->wrapSegments(explode('.', $value)); + } + + /** + * Wrap a value that has an alias. + * + * @param string $value + * @param bool $prefixAlias + * @return string + */ + protected function wrapAliasedValue($value, $prefixAlias = false) + { + $segments = preg_split('/\s+as\s+/i', $value); + + // If we are wrapping a table we need to prefix the alias with the table prefix + // as well in order to generate proper syntax. If this is a column of course + // no prefix is necessary. The condition will be true when from wrapTable. + if ($prefixAlias) { + $segments[1] = $this->tablePrefix.$segments[1]; + } + + return $this->wrap( + $segments[0]).' as '.$this->wrapValue($segments[1] + ); + } + + /** + * Wrap the given value segments. + * + * @param array $segments + * @return string + */ + protected function wrapSegments($segments) + { + return collect($segments)->map(function ($segment, $key) use ($segments) { + return $key == 0 && count($segments) > 1 + ? $this->wrapTable($segment) + : $this->wrapValue($segment); + })->implode('.'); + } + + /** + * Wrap a single string in keyword identifiers. + * + * @param string $value + * @return string + */ + protected function wrapValue($value) + { + if ($value !== '*') { + return '"'.str_replace('"', '""', $value).'"'; + } + + return $value; + } + + /** + * Convert an array of column names into a delimited string. + * + * @param array $columns + * @return string + */ + public function columnize(array $columns) + { + return implode(', ', array_map([$this, 'wrap'], $columns)); + } + + /** + * Create query parameter place-holders for an array. + * + * @param array $values + * @return string + */ + public function parameterize(array $values) + { + return implode(', ', array_map([$this, 'parameter'], $values)); + } + + /** + * Get the appropriate query parameter place-holder for a value. + * + * @param mixed $value + * @return string + */ + public function parameter($value) + { + return $this->isExpression($value) ? $this->getValue($value) : '?'; + } + + /** + * Quote the given string literal. + * + * @param string|array $value + * @return string + */ + public function quoteString($value) + { + if (is_array($value)) { + return implode(', ', array_map([$this, __FUNCTION__], $value)); + } + + return "'$value'"; + } + + /** + * Determine if the given value is a raw expression. + * + * @param mixed $value + * @return bool + */ + public function isExpression($value) + { + return $value instanceof Expression; + } + + /** + * Get the value of a raw expression. + * + * @param \Illuminate\Database\Query\Expression $expression + * @return string + */ + public function getValue($expression) + { + return $expression->getValue(); + } + + /** + * Get the format for database stored dates. + * + * @return string + */ + public function getDateFormat() + { + return 'Y-m-d H:i:s'; + } + + /** + * Get the grammar's table prefix. + * + * @return string + */ + public function getTablePrefix() + { + return $this->tablePrefix; + } + + /** + * Set the grammar's table prefix. + * + * @param string $prefix + * @return $this + */ + public function setTablePrefix($prefix) + { + $this->tablePrefix = $prefix; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php new file mode 100755 index 0000000..a8b92ab --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/MigrationServiceProvider.php @@ -0,0 +1,87 @@ +registerRepository(); + + $this->registerMigrator(); + + $this->registerCreator(); + } + + /** + * Register the migration repository service. + * + * @return void + */ + protected function registerRepository() + { + $this->app->singleton('migration.repository', function ($app) { + $table = $app['config']['database.migrations']; + + return new DatabaseMigrationRepository($app['db'], $table); + }); + } + + /** + * Register the migrator service. + * + * @return void + */ + protected function registerMigrator() + { + // The migrator is responsible for actually running and rollback the migration + // files in the application. We'll pass in our database connection resolver + // so the migrator can resolve any of these connections when it needs to. + $this->app->singleton('migrator', function ($app) { + $repository = $app['migration.repository']; + + return new Migrator($repository, $app['db'], $app['files']); + }); + } + + /** + * Register the migration creator. + * + * @return void + */ + protected function registerCreator() + { + $this->app->singleton('migration.creator', function ($app) { + return new MigrationCreator($app['files']); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'migrator', 'migration.repository', 'migration.creator', + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php b/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php new file mode 100755 index 0000000..1ace1a6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php @@ -0,0 +1,212 @@ +table = $table; + $this->resolver = $resolver; + } + + /** + * Get the completed migrations. + * + * @return array + */ + public function getRan() + { + return $this->table() + ->orderBy('batch', 'asc') + ->orderBy('migration', 'asc') + ->pluck('migration')->all(); + } + + /** + * Get list of migrations. + * + * @param int $steps + * @return array + */ + public function getMigrations($steps) + { + $query = $this->table()->where('batch', '>=', '1'); + + return $query->orderBy('batch', 'desc') + ->orderBy('migration', 'desc') + ->take($steps)->get()->all(); + } + + /** + * Get the last migration batch. + * + * @return array + */ + public function getLast() + { + $query = $this->table()->where('batch', $this->getLastBatchNumber()); + + return $query->orderBy('migration', 'desc')->get()->all(); + } + + /** + * Get the completed migrations with their batch numbers. + * + * @return array + */ + public function getMigrationBatches() + { + return $this->table() + ->orderBy('batch', 'asc') + ->orderBy('migration', 'asc') + ->pluck('batch', 'migration')->all(); + } + + /** + * Log that a migration was run. + * + * @param string $file + * @param int $batch + * @return void + */ + public function log($file, $batch) + { + $record = ['migration' => $file, 'batch' => $batch]; + + $this->table()->insert($record); + } + + /** + * Remove a migration from the log. + * + * @param object $migration + * @return void + */ + public function delete($migration) + { + $this->table()->where('migration', $migration->migration)->delete(); + } + + /** + * Get the next migration batch number. + * + * @return int + */ + public function getNextBatchNumber() + { + return $this->getLastBatchNumber() + 1; + } + + /** + * Get the last migration batch number. + * + * @return int + */ + public function getLastBatchNumber() + { + return $this->table()->max('batch'); + } + + /** + * Create the migration repository data store. + * + * @return void + */ + public function createRepository() + { + $schema = $this->getConnection()->getSchemaBuilder(); + + $schema->create($this->table, function ($table) { + // The migrations table is responsible for keeping track of which of the + // migrations have actually run for the application. We'll create the + // table to hold the migration file's path as well as the batch ID. + $table->increments('id'); + $table->string('migration'); + $table->integer('batch'); + }); + } + + /** + * Determine if the migration repository exists. + * + * @return bool + */ + public function repositoryExists() + { + $schema = $this->getConnection()->getSchemaBuilder(); + + return $schema->hasTable($this->table); + } + + /** + * Get a query builder for the migration table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function table() + { + return $this->getConnection()->table($this->table)->useWritePdo(); + } + + /** + * Get the connection resolver instance. + * + * @return \Illuminate\Database\ConnectionResolverInterface + */ + public function getConnectionResolver() + { + return $this->resolver; + } + + /** + * Resolve the database connection instance. + * + * @return \Illuminate\Database\Connection + */ + public function getConnection() + { + return $this->resolver->connection($this->connection); + } + + /** + * Set the information source to gather data. + * + * @param string $name + * @return void + */ + public function setSource($name) + { + $this->connection = $name; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migration.php b/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migration.php new file mode 100755 index 0000000..ac1b9e7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migration.php @@ -0,0 +1,30 @@ +connection; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationCreator.php b/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationCreator.php new file mode 100755 index 0000000..88ab403 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationCreator.php @@ -0,0 +1,204 @@ +files = $files; + } + + /** + * Create a new migration at the given path. + * + * @param string $name + * @param string $path + * @param string $table + * @param bool $create + * @return string + * + * @throws \Exception + */ + public function create($name, $path, $table = null, $create = false) + { + $this->ensureMigrationDoesntAlreadyExist($name); + + // First we will get the stub file for the migration, which serves as a type + // of template for the migration. Once we have those we will populate the + // various place-holders, save the file, and run the post create event. + $stub = $this->getStub($table, $create); + + $this->files->put( + $path = $this->getPath($name, $path), + $this->populateStub($name, $stub, $table) + ); + + // Next, we will fire any hooks that are supposed to fire after a migration is + // created. Once that is done we'll be ready to return the full path to the + // migration file so it can be used however it's needed by the developer. + $this->firePostCreateHooks($table); + + return $path; + } + + /** + * Ensure that a migration with the given name doesn't already exist. + * + * @param string $name + * @return void + * + * @throws \InvalidArgumentException + */ + protected function ensureMigrationDoesntAlreadyExist($name) + { + if (class_exists($className = $this->getClassName($name))) { + throw new InvalidArgumentException("A {$className} class already exists."); + } + } + + /** + * Get the migration stub file. + * + * @param string $table + * @param bool $create + * @return string + */ + protected function getStub($table, $create) + { + if (is_null($table)) { + return $this->files->get($this->stubPath().'/blank.stub'); + } + + // We also have stubs for creating new tables and modifying existing tables + // to save the developer some typing when they are creating a new tables + // or modifying existing tables. We'll grab the appropriate stub here. + $stub = $create ? 'create.stub' : 'update.stub'; + + return $this->files->get($this->stubPath()."/{$stub}"); + } + + /** + * Populate the place-holders in the migration stub. + * + * @param string $name + * @param string $stub + * @param string $table + * @return string + */ + protected function populateStub($name, $stub, $table) + { + $stub = str_replace('DummyClass', $this->getClassName($name), $stub); + + // Here we will replace the table place-holders with the table specified by + // the developer, which is useful for quickly creating a tables creation + // or update migration from the console instead of typing it manually. + if (! is_null($table)) { + $stub = str_replace('DummyTable', $table, $stub); + } + + return $stub; + } + + /** + * Get the class name of a migration name. + * + * @param string $name + * @return string + */ + protected function getClassName($name) + { + return Str::studly($name); + } + + /** + * Get the full path to the migration. + * + * @param string $name + * @param string $path + * @return string + */ + protected function getPath($name, $path) + { + return $path.'/'.$this->getDatePrefix().'_'.$name.'.php'; + } + + /** + * Fire the registered post create hooks. + * + * @param string $table + * @return void + */ + protected function firePostCreateHooks($table) + { + foreach ($this->postCreate as $callback) { + call_user_func($callback, $table); + } + } + + /** + * Register a post migration create hook. + * + * @param \Closure $callback + * @return void + */ + public function afterCreate(Closure $callback) + { + $this->postCreate[] = $callback; + } + + /** + * Get the date prefix for the migration. + * + * @return string + */ + protected function getDatePrefix() + { + return date('Y_m_d_His'); + } + + /** + * Get the path to the stubs. + * + * @return string + */ + public function stubPath() + { + return __DIR__.'/stubs'; + } + + /** + * Get the filesystem instance. + * + * @return \Illuminate\Filesystem\Filesystem + */ + public function getFilesystem() + { + return $this->files; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php b/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php new file mode 100755 index 0000000..410326a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php @@ -0,0 +1,81 @@ +files = $files; + $this->resolver = $resolver; + $this->repository = $repository; + } + + /** + * Run the pending migrations at a given path. + * + * @param array|string $paths + * @param array $options + * @return array + */ + public function run($paths = [], array $options = []) + { + $this->notes = []; + + // Once we grab all of the migration files for the path, we will compare them + // against the migrations that have already been run for this package then + // run each of the outstanding migrations against a database connection. + $files = $this->getMigrationFiles($paths); + + $this->requireFiles($migrations = $this->pendingMigrations( + $files, $this->repository->getRan() + )); + + // Once we have all these migrations that are outstanding we are ready to run + // we will go ahead and run them "up". This will execute each migration as + // an operation against a database. Then we'll return this list of them. + $this->runPending($migrations, $options); + + return $migrations; + } + + /** + * Get the migration files that have not yet run. + * + * @param array $files + * @param array $ran + * @return array + */ + protected function pendingMigrations($files, $ran) + { + return Collection::make($files) + ->reject(function ($file) use ($ran) { + return in_array($this->getMigrationName($file), $ran); + })->values()->all(); + } + + /** + * Run an array of migrations. + * + * @param array $migrations + * @param array $options + * @return void + */ + public function runPending(array $migrations, array $options = []) + { + // First we will just make sure that there are any migrations to run. If there + // aren't, we will just make a note of it to the developer so they're aware + // that all of the migrations have been run against this database system. + if (count($migrations) === 0) { + $this->note('Nothing to migrate.'); + + return; + } + + // Next, we will get the next batch number for the migrations so we can insert + // correct batch number in the database migrations repository when we store + // each migration's execution. We will also extract a few of the options. + $batch = $this->repository->getNextBatchNumber(); + + $pretend = $options['pretend'] ?? false; + + $step = $options['step'] ?? false; + + // Once we have the array of migrations, we will spin through them and run the + // migrations "up" so the changes are made to the databases. We'll then log + // that the migration was run so we don't repeat it next time we execute. + foreach ($migrations as $file) { + $this->runUp($file, $batch, $pretend); + + if ($step) { + $batch++; + } + } + } + + /** + * Run "up" a migration instance. + * + * @param string $file + * @param int $batch + * @param bool $pretend + * @return void + */ + protected function runUp($file, $batch, $pretend) + { + // First we will resolve a "real" instance of the migration class from this + // migration file name. Once we have the instances we can run the actual + // command such as "up" or "down", or we can just simulate the action. + $migration = $this->resolve( + $name = $this->getMigrationName($file) + ); + + if ($pretend) { + return $this->pretendToRun($migration, 'up'); + } + + $this->note("Migrating: {$name}"); + + $this->runMigration($migration, 'up'); + + // Once we have run a migrations class, we will log that it was run in this + // repository so that we don't try to run it next time we do a migration + // in the application. A migration repository keeps the migrate order. + $this->repository->log($name, $batch); + + $this->note("Migrated: {$name}"); + } + + /** + * Rollback the last migration operation. + * + * @param array|string $paths + * @param array $options + * @return array + */ + public function rollback($paths = [], array $options = []) + { + $this->notes = []; + + // We want to pull in the last batch of migrations that ran on the previous + // migration operation. We'll then reverse those migrations and run each + // of them "down" to reverse the last migration "operation" which ran. + $migrations = $this->getMigrationsForRollback($options); + + if (count($migrations) === 0) { + $this->note('Nothing to rollback.'); + + return []; + } + + return $this->rollbackMigrations($migrations, $paths, $options); + } + + /** + * Get the migrations for a rollback operation. + * + * @param array $options + * @return array + */ + protected function getMigrationsForRollback(array $options) + { + if (($steps = $options['step'] ?? 0) > 0) { + return $this->repository->getMigrations($steps); + } + + return $this->repository->getLast(); + } + + /** + * Rollback the given migrations. + * + * @param array $migrations + * @param array|string $paths + * @param array $options + * @return array + */ + protected function rollbackMigrations(array $migrations, $paths, array $options) + { + $rolledBack = []; + + $this->requireFiles($files = $this->getMigrationFiles($paths)); + + // Next we will run through all of the migrations and call the "down" method + // which will reverse each migration in order. This getLast method on the + // repository already returns these migration's names in reverse order. + foreach ($migrations as $migration) { + $migration = (object) $migration; + + if (! $file = Arr::get($files, $migration->migration)) { + $this->note("Migration not found: {$migration->migration}"); + + continue; + } + + $rolledBack[] = $file; + + $this->runDown( + $file, $migration, + $options['pretend'] ?? false + ); + } + + return $rolledBack; + } + + /** + * Rolls all of the currently applied migrations back. + * + * @param array|string $paths + * @param bool $pretend + * @return array + */ + public function reset($paths = [], $pretend = false) + { + $this->notes = []; + + // Next, we will reverse the migration list so we can run them back in the + // correct order for resetting this database. This will allow us to get + // the database back into its "empty" state ready for the migrations. + $migrations = array_reverse($this->repository->getRan()); + + if (count($migrations) === 0) { + $this->note('Nothing to rollback.'); + + return []; + } + + return $this->resetMigrations($migrations, $paths, $pretend); + } + + /** + * Reset the given migrations. + * + * @param array $migrations + * @param array $paths + * @param bool $pretend + * @return array + */ + protected function resetMigrations(array $migrations, array $paths, $pretend = false) + { + // Since the getRan method that retrieves the migration name just gives us the + // migration name, we will format the names into objects with the name as a + // property on the objects so that we can pass it to the rollback method. + $migrations = collect($migrations)->map(function ($m) { + return (object) ['migration' => $m]; + })->all(); + + return $this->rollbackMigrations( + $migrations, $paths, compact('pretend') + ); + } + + /** + * Run "down" a migration instance. + * + * @param string $file + * @param object $migration + * @param bool $pretend + * @return void + */ + protected function runDown($file, $migration, $pretend) + { + // First we will get the file name of the migration so we can resolve out an + // instance of the migration. Once we get an instance we can either run a + // pretend execution of the migration or we can run the real migration. + $instance = $this->resolve( + $name = $this->getMigrationName($file) + ); + + $this->note("Rolling back: {$name}"); + + if ($pretend) { + return $this->pretendToRun($instance, 'down'); + } + + $this->runMigration($instance, 'down'); + + // Once we have successfully run the migration "down" we will remove it from + // the migration repository so it will be considered to have not been run + // by the application then will be able to fire by any later operation. + $this->repository->delete($migration); + + $this->note("Rolled back: {$name}"); + } + + /** + * Run a migration inside a transaction if the database supports it. + * + * @param object $migration + * @param string $method + * @return void + */ + protected function runMigration($migration, $method) + { + $connection = $this->resolveConnection( + $migration->getConnection() + ); + + $callback = function () use ($migration, $method) { + if (method_exists($migration, $method)) { + $migration->{$method}(); + } + }; + + $this->getSchemaGrammar($connection)->supportsSchemaTransactions() + && $migration->withinTransaction + ? $connection->transaction($callback) + : $callback(); + } + + /** + * Pretend to run the migrations. + * + * @param object $migration + * @param string $method + * @return void + */ + protected function pretendToRun($migration, $method) + { + foreach ($this->getQueries($migration, $method) as $query) { + $name = get_class($migration); + + $this->note("{$name}: {$query['query']}"); + } + } + + /** + * Get all of the queries that would be run for a migration. + * + * @param object $migration + * @param string $method + * @return array + */ + protected function getQueries($migration, $method) + { + // Now that we have the connections we can resolve it and pretend to run the + // queries against the database returning the array of raw SQL statements + // that would get fired against the database system for this migration. + $db = $this->resolveConnection( + $migration->getConnection() + ); + + return $db->pretend(function () use ($migration, $method) { + if (method_exists($migration, $method)) { + $migration->{$method}(); + } + }); + } + + /** + * Resolve a migration instance from a file. + * + * @param string $file + * @return object + */ + public function resolve($file) + { + $class = Str::studly(implode('_', array_slice(explode('_', $file), 4))); + + return new $class; + } + + /** + * Get all of the migration files in a given path. + * + * @param string|array $paths + * @return array + */ + public function getMigrationFiles($paths) + { + return Collection::make($paths)->flatMap(function ($path) { + return Str::endsWith($path, '.php') ? [$path] : $this->files->glob($path.'/*_*.php'); + })->filter()->sortBy(function ($file) { + return $this->getMigrationName($file); + })->values()->keyBy(function ($file) { + return $this->getMigrationName($file); + })->all(); + } + + /** + * Require in all the migration files in a given path. + * + * @param array $files + * @return void + */ + public function requireFiles(array $files) + { + foreach ($files as $file) { + $this->files->requireOnce($file); + } + } + + /** + * Get the name of the migration. + * + * @param string $path + * @return string + */ + public function getMigrationName($path) + { + return str_replace('.php', '', basename($path)); + } + + /** + * Register a custom migration path. + * + * @param string $path + * @return void + */ + public function path($path) + { + $this->paths = array_unique(array_merge($this->paths, [$path])); + } + + /** + * Get all of the custom migration paths. + * + * @return array + */ + public function paths() + { + return $this->paths; + } + + /** + * Get the default connection name. + * + * @return string + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Set the default connection name. + * + * @param string $name + * @return void + */ + public function setConnection($name) + { + if (! is_null($name)) { + $this->resolver->setDefaultConnection($name); + } + + $this->repository->setSource($name); + + $this->connection = $name; + } + + /** + * Resolve the database connection instance. + * + * @param string $connection + * @return \Illuminate\Database\Connection + */ + public function resolveConnection($connection) + { + return $this->resolver->connection($connection ?: $this->connection); + } + + /** + * Get the schema grammar out of a migration connection. + * + * @param \Illuminate\Database\Connection $connection + * @return \Illuminate\Database\Schema\Grammars\Grammar + */ + protected function getSchemaGrammar($connection) + { + if (is_null($grammar = $connection->getSchemaGrammar())) { + $connection->useDefaultSchemaGrammar(); + + $grammar = $connection->getSchemaGrammar(); + } + + return $grammar; + } + + /** + * Get the migration repository instance. + * + * @return \Illuminate\Database\Migrations\MigrationRepositoryInterface + */ + public function getRepository() + { + return $this->repository; + } + + /** + * Determine if the migration repository exists. + * + * @return bool + */ + public function repositoryExists() + { + return $this->repository->repositoryExists(); + } + + /** + * Get the file system instance. + * + * @return \Illuminate\Filesystem\Filesystem + */ + public function getFilesystem() + { + return $this->files; + } + + /** + * Set the output implementation that should be used by the console. + * + * @param \Illuminate\Console\OutputStyle $output + * @return $this + */ + public function setOutput(OutputStyle $output) + { + $this->output = $output; + + return $this; + } + + /** + * Write a note to the conosle's output. + * + * @param string $message + * @return void + */ + protected function note($message) + { + if ($this->output) { + $this->output->writeln($message); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/blank.stub b/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/blank.stub new file mode 100755 index 0000000..da4ce82 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/blank.stub @@ -0,0 +1,28 @@ +increments('id'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('DummyTable'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/update.stub b/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/update.stub new file mode 100755 index 0000000..1fd4f6e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/update.stub @@ -0,0 +1,32 @@ +withTablePrefix(new QueryGrammar); + } + + /** + * Get a schema builder instance for the connection. + * + * @return \Illuminate\Database\Schema\MySqlBuilder + */ + public function getSchemaBuilder() + { + if (is_null($this->schemaGrammar)) { + $this->useDefaultSchemaGrammar(); + } + + return new MySqlBuilder($this); + } + + /** + * Get the default schema grammar instance. + * + * @return \Illuminate\Database\Schema\Grammars\MySqlGrammar + */ + protected function getDefaultSchemaGrammar() + { + return $this->withTablePrefix(new SchemaGrammar); + } + + /** + * Get the default post processor instance. + * + * @return \Illuminate\Database\Query\Processors\MySqlProcessor + */ + protected function getDefaultPostProcessor() + { + return new MySqlProcessor; + } + + /** + * Get the Doctrine DBAL driver. + * + * @return \Doctrine\DBAL\Driver\PDOMySql\Driver + */ + protected function getDoctrineDriver() + { + return new DoctrineDriver; + } + + /** + * Bind values to their parameters in the given statement. + * + * @param \PDOStatement $statement + * @param array $bindings + * @return void + */ + public function bindValues($statement, $bindings) + { + foreach ($bindings as $key => $value) { + $statement->bindValue( + is_string($key) ? $key : $key + 1, $value, + is_int($value) || is_float($value) ? PDO::PARAM_INT : PDO::PARAM_STR + ); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/PostgresConnection.php b/vendor/laravel/framework/src/Illuminate/Database/PostgresConnection.php new file mode 100755 index 0000000..01804a7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/PostgresConnection.php @@ -0,0 +1,66 @@ +withTablePrefix(new QueryGrammar); + } + + /** + * Get a schema builder instance for the connection. + * + * @return \Illuminate\Database\Schema\PostgresBuilder + */ + public function getSchemaBuilder() + { + if (is_null($this->schemaGrammar)) { + $this->useDefaultSchemaGrammar(); + } + + return new PostgresBuilder($this); + } + + /** + * Get the default schema grammar instance. + * + * @return \Illuminate\Database\Schema\Grammars\PostgresGrammar + */ + protected function getDefaultSchemaGrammar() + { + return $this->withTablePrefix(new SchemaGrammar); + } + + /** + * Get the default post processor instance. + * + * @return \Illuminate\Database\Query\Processors\PostgresProcessor + */ + protected function getDefaultPostProcessor() + { + return new PostgresProcessor; + } + + /** + * Get the Doctrine DBAL driver. + * + * @return \Doctrine\DBAL\Driver\PDOPgSql\Driver + */ + protected function getDoctrineDriver() + { + return new DoctrineDriver; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php new file mode 100755 index 0000000..b774afd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php @@ -0,0 +1,2956 @@ + [], + 'from' => [], + 'join' => [], + 'where' => [], + 'having' => [], + 'order' => [], + 'union' => [], + ]; + + /** + * An aggregate function and column to be run. + * + * @var array + */ + public $aggregate; + + /** + * The columns that should be returned. + * + * @var array + */ + public $columns; + + /** + * Indicates if the query returns distinct results. + * + * @var bool + */ + public $distinct = false; + + /** + * The table which the query is targeting. + * + * @var string + */ + public $from; + + /** + * The table joins for the query. + * + * @var array + */ + public $joins; + + /** + * The where constraints for the query. + * + * @var array + */ + public $wheres = []; + + /** + * The groupings for the query. + * + * @var array + */ + public $groups; + + /** + * The having constraints for the query. + * + * @var array + */ + public $havings; + + /** + * The orderings for the query. + * + * @var array + */ + public $orders; + + /** + * The maximum number of records to return. + * + * @var int + */ + public $limit; + + /** + * The number of records to skip. + * + * @var int + */ + public $offset; + + /** + * The query union statements. + * + * @var array + */ + public $unions; + + /** + * The maximum number of union records to return. + * + * @var int + */ + public $unionLimit; + + /** + * The number of union records to skip. + * + * @var int + */ + public $unionOffset; + + /** + * The orderings for the union query. + * + * @var array + */ + public $unionOrders; + + /** + * Indicates whether row locking is being used. + * + * @var string|bool + */ + public $lock; + + /** + * All of the available clause operators. + * + * @var array + */ + public $operators = [ + '=', '<', '>', '<=', '>=', '<>', '!=', '<=>', + 'like', 'like binary', 'not like', 'ilike', + '&', '|', '^', '<<', '>>', + 'rlike', 'regexp', 'not regexp', + '~', '~*', '!~', '!~*', 'similar to', + 'not similar to', 'not ilike', '~~*', '!~~*', + ]; + + /** + * Whether use write pdo for select. + * + * @var bool + */ + public $useWritePdo = false; + + /** + * Create a new query builder instance. + * + * @param \Illuminate\Database\ConnectionInterface $connection + * @param \Illuminate\Database\Query\Grammars\Grammar $grammar + * @param \Illuminate\Database\Query\Processors\Processor $processor + * @return void + */ + public function __construct(ConnectionInterface $connection, + Grammar $grammar = null, + Processor $processor = null) + { + $this->connection = $connection; + $this->grammar = $grammar ?: $connection->getQueryGrammar(); + $this->processor = $processor ?: $connection->getPostProcessor(); + } + + /** + * Set the columns to be selected. + * + * @param array|mixed $columns + * @return $this + */ + public function select($columns = ['*']) + { + $this->columns = is_array($columns) ? $columns : func_get_args(); + + return $this; + } + + /** + * Add a subselect expression to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @return \Illuminate\Database\Query\Builder|static + * + * @throws \InvalidArgumentException + */ + public function selectSub($query, $as) + { + [$query, $bindings] = $this->createSub($query); + + return $this->selectRaw( + '('.$query.') as '.$this->grammar->wrap($as), $bindings + ); + } + + /** + * Add a new "raw" select expression to the query. + * + * @param string $expression + * @param array $bindings + * @return \Illuminate\Database\Query\Builder|static + */ + public function selectRaw($expression, array $bindings = []) + { + $this->addSelect(new Expression($expression)); + + if ($bindings) { + $this->addBinding($bindings, 'select'); + } + + return $this; + } + + /** + * Makes "from" fetch from a subquery. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @return \Illuminate\Database\Query\Builder|static + * + * @throws \InvalidArgumentException + */ + public function fromSub($query, $as) + { + [$query, $bindings] = $this->createSub($query); + + return $this->fromRaw('('.$query.') as '.$this->grammar->wrap($as), $bindings); + } + + /** + * Add a raw from clause to the query. + * + * @param string $expression + * @param mixed $bindings + * @return \Illuminate\Database\Query\Builder|static + */ + public function fromRaw($expression, $bindings = []) + { + $this->from = new Expression($expression); + + $this->addBinding($bindings, 'from'); + + return $this; + } + + /** + * Creates a subquery and parse it. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @return array + */ + protected function createSub($query) + { + // If the given query is a Closure, we will execute it while passing in a new + // query instance to the Closure. This will give the developer a chance to + // format and work with the query before we cast it to a raw SQL string. + if ($query instanceof Closure) { + $callback = $query; + + $callback($query = $this->forSubQuery()); + } + + return $this->parseSub($query); + } + + /** + * Parse the subquery into SQL and bindings. + * + * @param mixed $query + * @return array + */ + protected function parseSub($query) + { + if ($query instanceof self || $query instanceof EloquentBuilder) { + return [$query->toSql(), $query->getBindings()]; + } elseif (is_string($query)) { + return [$query, []]; + } else { + throw new InvalidArgumentException; + } + } + + /** + * Add a new select column to the query. + * + * @param array|mixed $column + * @return $this + */ + public function addSelect($column) + { + $column = is_array($column) ? $column : func_get_args(); + + $this->columns = array_merge((array) $this->columns, $column); + + return $this; + } + + /** + * Force the query to only return distinct results. + * + * @return $this + */ + public function distinct() + { + $this->distinct = true; + + return $this; + } + + /** + * Set the table which the query is targeting. + * + * @param string $table + * @return $this + */ + public function from($table) + { + $this->from = $table; + + return $this; + } + + /** + * Add a join clause to the query. + * + * @param string $table + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @param string $type + * @param bool $where + * @return $this + */ + public function join($table, $first, $operator = null, $second = null, $type = 'inner', $where = false) + { + $join = new JoinClause($this, $type, $table); + + // If the first "column" of the join is really a Closure instance the developer + // is trying to build a join with a complex "on" clause containing more than + // one condition, so we'll add the join and call a Closure with the query. + if ($first instanceof Closure) { + call_user_func($first, $join); + + $this->joins[] = $join; + + $this->addBinding($join->getBindings(), 'join'); + } + + // If the column is simply a string, we can assume the join simply has a basic + // "on" clause with a single condition. So we will just build the join with + // this simple join clauses attached to it. There is not a join callback. + else { + $method = $where ? 'where' : 'on'; + + $this->joins[] = $join->$method($first, $operator, $second); + + $this->addBinding($join->getBindings(), 'join'); + } + + return $this; + } + + /** + * Add a "join where" clause to the query. + * + * @param string $table + * @param \Closure|string $first + * @param string $operator + * @param string $second + * @param string $type + * @return \Illuminate\Database\Query\Builder|static + */ + public function joinWhere($table, $first, $operator, $second, $type = 'inner') + { + return $this->join($table, $first, $operator, $second, $type, true); + } + + /** + * Add a subquery join clause to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @param string $type + * @param bool $where + * @return \Illuminate\Database\Query\Builder|static + * + * @throws \InvalidArgumentException + */ + public function joinSub($query, $as, $first, $operator = null, $second = null, $type = 'inner', $where = false) + { + [$query, $bindings] = $this->createSub($query); + + $expression = '('.$query.') as '.$this->grammar->wrap($as); + + $this->addBinding($bindings, 'join'); + + return $this->join(new Expression($expression), $first, $operator, $second, $type, $where); + } + + /** + * Add a left join to the query. + * + * @param string $table + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function leftJoin($table, $first, $operator = null, $second = null) + { + return $this->join($table, $first, $operator, $second, 'left'); + } + + /** + * Add a "join where" clause to the query. + * + * @param string $table + * @param string $first + * @param string $operator + * @param string $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function leftJoinWhere($table, $first, $operator, $second) + { + return $this->joinWhere($table, $first, $operator, $second, 'left'); + } + + /** + * Add a subquery left join to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @param string $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function leftJoinSub($query, $as, $first, $operator = null, $second = null) + { + return $this->joinSub($query, $as, $first, $operator, $second, 'left'); + } + + /** + * Add a right join to the query. + * + * @param string $table + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function rightJoin($table, $first, $operator = null, $second = null) + { + return $this->join($table, $first, $operator, $second, 'right'); + } + + /** + * Add a "right join where" clause to the query. + * + * @param string $table + * @param string $first + * @param string $operator + * @param string $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function rightJoinWhere($table, $first, $operator, $second) + { + return $this->joinWhere($table, $first, $operator, $second, 'right'); + } + + /** + * Add a subquery right join to the query. + * + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @param string $as + * @param string $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function rightJoinSub($query, $as, $first, $operator = null, $second = null) + { + return $this->joinSub($query, $as, $first, $operator, $second, 'right'); + } + + /** + * Add a "cross join" clause to the query. + * + * @param string $table + * @param \Closure|string|null $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function crossJoin($table, $first = null, $operator = null, $second = null) + { + if ($first) { + return $this->join($table, $first, $operator, $second, 'cross'); + } + + $this->joins[] = new JoinClause($this, 'cross', $table); + + return $this; + } + + /** + * Merge an array of where clauses and bindings. + * + * @param array $wheres + * @param array $bindings + * @return void + */ + public function mergeWheres($wheres, $bindings) + { + $this->wheres = array_merge($this->wheres, (array) $wheres); + + $this->bindings['where'] = array_values( + array_merge($this->bindings['where'], (array) $bindings) + ); + } + + /** + * Add a basic where clause to the query. + * + * @param string|array|\Closure $column + * @param mixed $operator + * @param mixed $value + * @param string $boolean + * @return $this + */ + public function where($column, $operator = null, $value = null, $boolean = 'and') + { + // If the column is an array, we will assume it is an array of key-value pairs + // and can add them each as a where clause. We will maintain the boolean we + // received when the method was called and pass it into the nested where. + if (is_array($column)) { + return $this->addArrayOfWheres($column, $boolean); + } + + // Here we will make some assumptions about the operator. If only 2 values are + // passed to the method, we will assume that the operator is an equals sign + // and keep going. Otherwise, we'll require the operator to be passed in. + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + // If the columns is actually a Closure instance, we will assume the developer + // wants to begin a nested where statement which is wrapped in parenthesis. + // We'll add that Closure to the query then return back out immediately. + if ($column instanceof Closure) { + return $this->whereNested($column, $boolean); + } + + // If the given operator is not found in the list of valid operators we will + // assume that the developer is just short-cutting the '=' operators and + // we will set the operators to '=' and set the values appropriately. + if ($this->invalidOperator($operator)) { + [$value, $operator] = [$operator, '=']; + } + + // If the value is a Closure, it means the developer is performing an entire + // sub-select within the query and we will need to compile the sub-select + // within the where clause to get the appropriate query record results. + if ($value instanceof Closure) { + return $this->whereSub($column, $operator, $value, $boolean); + } + + // If the value is "null", we will just assume the developer wants to add a + // where null clause to the query. So, we will allow a short-cut here to + // that method for convenience so the developer doesn't have to check. + if (is_null($value)) { + return $this->whereNull($column, $boolean, $operator !== '='); + } + + // If the column is making a JSON reference we'll check to see if the value + // is a boolean. If it is, we'll add the raw boolean string as an actual + // value to the query to ensure this is properly handled by the query. + if (Str::contains($column, '->') && is_bool($value)) { + $value = new Expression($value ? 'true' : 'false'); + } + + // Now that we are working with just a simple query we can put the elements + // in our array and add the query binding to our array of bindings that + // will be bound to each SQL statements when it is finally executed. + $type = 'Basic'; + + $this->wheres[] = compact( + 'type', 'column', 'operator', 'value', 'boolean' + ); + + if (! $value instanceof Expression) { + $this->addBinding($value, 'where'); + } + + return $this; + } + + /** + * Add an array of where clauses to the query. + * + * @param array $column + * @param string $boolean + * @param string $method + * @return $this + */ + protected function addArrayOfWheres($column, $boolean, $method = 'where') + { + return $this->whereNested(function ($query) use ($column, $method, $boolean) { + foreach ($column as $key => $value) { + if (is_numeric($key) && is_array($value)) { + $query->{$method}(...array_values($value)); + } else { + $query->$method($key, '=', $value, $boolean); + } + } + }, $boolean); + } + + /** + * Prepare the value and operator for a where clause. + * + * @param string $value + * @param string $operator + * @param bool $useDefault + * @return array + * + * @throws \InvalidArgumentException + */ + public function prepareValueAndOperator($value, $operator, $useDefault = false) + { + if ($useDefault) { + return [$operator, '=']; + } elseif ($this->invalidOperatorAndValue($operator, $value)) { + throw new InvalidArgumentException('Illegal operator and value combination.'); + } + + return [$value, $operator]; + } + + /** + * Determine if the given operator and value combination is legal. + * + * Prevents using Null values with invalid operators. + * + * @param string $operator + * @param mixed $value + * @return bool + */ + protected function invalidOperatorAndValue($operator, $value) + { + return is_null($value) && in_array($operator, $this->operators) && + ! in_array($operator, ['=', '<>', '!=']); + } + + /** + * Determine if the given operator is supported. + * + * @param string $operator + * @return bool + */ + protected function invalidOperator($operator) + { + return ! in_array(strtolower($operator), $this->operators, true) && + ! in_array(strtolower($operator), $this->grammar->getOperators(), true); + } + + /** + * Add an "or where" clause to the query. + * + * @param string|array|\Closure $column + * @param mixed $operator + * @param mixed $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhere($column, $operator = null, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->where($column, $operator, $value, 'or'); + } + + /** + * Add a "where" clause comparing two columns to the query. + * + * @param string|array $first + * @param string|null $operator + * @param string|null $second + * @param string|null $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereColumn($first, $operator = null, $second = null, $boolean = 'and') + { + // If the column is an array, we will assume it is an array of key-value pairs + // and can add them each as a where clause. We will maintain the boolean we + // received when the method was called and pass it into the nested where. + if (is_array($first)) { + return $this->addArrayOfWheres($first, $boolean, 'whereColumn'); + } + + // If the given operator is not found in the list of valid operators we will + // assume that the developer is just short-cutting the '=' operators and + // we will set the operators to '=' and set the values appropriately. + if ($this->invalidOperator($operator)) { + [$second, $operator] = [$operator, '=']; + } + + // Finally, we will add this where clause into this array of clauses that we + // are building for the query. All of them will be compiled via a grammar + // once the query is about to be executed and run against the database. + $type = 'Column'; + + $this->wheres[] = compact( + 'type', 'first', 'operator', 'second', 'boolean' + ); + + return $this; + } + + /** + * Add an "or where" clause comparing two columns to the query. + * + * @param string|array $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereColumn($first, $operator = null, $second = null) + { + return $this->whereColumn($first, $operator, $second, 'or'); + } + + /** + * Add a raw where clause to the query. + * + * @param string $sql + * @param mixed $bindings + * @param string $boolean + * @return $this + */ + public function whereRaw($sql, $bindings = [], $boolean = 'and') + { + $this->wheres[] = ['type' => 'raw', 'sql' => $sql, 'boolean' => $boolean]; + + $this->addBinding((array) $bindings, 'where'); + + return $this; + } + + /** + * Add a raw or where clause to the query. + * + * @param string $sql + * @param mixed $bindings + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereRaw($sql, $bindings = []) + { + return $this->whereRaw($sql, $bindings, 'or'); + } + + /** + * Add a "where in" clause to the query. + * + * @param string $column + * @param mixed $values + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereIn($column, $values, $boolean = 'and', $not = false) + { + $type = $not ? 'NotIn' : 'In'; + + if ($values instanceof EloquentBuilder) { + $values = $values->getQuery(); + } + + // If the value is a query builder instance we will assume the developer wants to + // look for any values that exists within this given query. So we will add the + // query accordingly so that this query is properly executed when it is run. + if ($values instanceof self) { + return $this->whereInExistingQuery( + $column, $values, $boolean, $not + ); + } + + // If the value of the where in clause is actually a Closure, we will assume that + // the developer is using a full sub-select for this "in" statement, and will + // execute those Closures, then we can re-construct the entire sub-selects. + if ($values instanceof Closure) { + return $this->whereInSub($column, $values, $boolean, $not); + } + + // Next, if the value is Arrayable we need to cast it to its raw array form so we + // have the underlying array value instead of an Arrayable object which is not + // able to be added as a binding, etc. We will then add to the wheres array. + if ($values instanceof Arrayable) { + $values = $values->toArray(); + } + + $this->wheres[] = compact('type', 'column', 'values', 'boolean'); + + // Finally we'll add a binding for each values unless that value is an expression + // in which case we will just skip over it since it will be the query as a raw + // string and not as a parameterized place-holder to be replaced by the PDO. + $this->addBinding($this->cleanBindings($values), 'where'); + + return $this; + } + + /** + * Add an "or where in" clause to the query. + * + * @param string $column + * @param mixed $values + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereIn($column, $values) + { + return $this->whereIn($column, $values, 'or'); + } + + /** + * Add a "where not in" clause to the query. + * + * @param string $column + * @param mixed $values + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereNotIn($column, $values, $boolean = 'and') + { + return $this->whereIn($column, $values, $boolean, true); + } + + /** + * Add an "or where not in" clause to the query. + * + * @param string $column + * @param mixed $values + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereNotIn($column, $values) + { + return $this->whereNotIn($column, $values, 'or'); + } + + /** + * Add a where in with a sub-select to the query. + * + * @param string $column + * @param \Closure $callback + * @param string $boolean + * @param bool $not + * @return $this + */ + protected function whereInSub($column, Closure $callback, $boolean, $not) + { + $type = $not ? 'NotInSub' : 'InSub'; + + // To create the exists sub-select, we will actually create a query and call the + // provided callback with the query so the developer may set any of the query + // conditions they want for the in clause, then we'll put it in this array. + call_user_func($callback, $query = $this->forSubQuery()); + + $this->wheres[] = compact('type', 'column', 'query', 'boolean'); + + $this->addBinding($query->getBindings(), 'where'); + + return $this; + } + + /** + * Add an external sub-select to the query. + * + * @param string $column + * @param \Illuminate\Database\Query\Builder|static $query + * @param string $boolean + * @param bool $not + * @return $this + */ + protected function whereInExistingQuery($column, $query, $boolean, $not) + { + $type = $not ? 'NotInSub' : 'InSub'; + + $this->wheres[] = compact('type', 'column', 'query', 'boolean'); + + $this->addBinding($query->getBindings(), 'where'); + + return $this; + } + + /** + * Add a "where in raw" clause for integer values to the query. + * + * @param string $column + * @param \Illuminate\Contracts\Support\Arrayable|array $values + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereIntegerInRaw($column, $values, $boolean = 'and', $not = false) + { + $type = $not ? 'NotInRaw' : 'InRaw'; + + if ($values instanceof Arrayable) { + $values = $values->toArray(); + } + + foreach ($values as &$value) { + $value = (int) $value; + } + + $this->wheres[] = compact('type', 'column', 'values', 'boolean'); + + return $this; + } + + /** + * Add a "where not in raw" clause for integer values to the query. + * + * @param string $column + * @param \Illuminate\Contracts\Support\Arrayable|array $values + * @param string $boolean + * @return $this + */ + public function whereIntegerNotInRaw($column, $values, $boolean = 'and') + { + return $this->whereIntegerInRaw($column, $values, $boolean, true); + } + + /** + * Add a "where null" clause to the query. + * + * @param string $column + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereNull($column, $boolean = 'and', $not = false) + { + $type = $not ? 'NotNull' : 'Null'; + + $this->wheres[] = compact('type', 'column', 'boolean'); + + return $this; + } + + /** + * Add an "or where null" clause to the query. + * + * @param string $column + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereNull($column) + { + return $this->whereNull($column, 'or'); + } + + /** + * Add a "where not null" clause to the query. + * + * @param string $column + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereNotNull($column, $boolean = 'and') + { + return $this->whereNull($column, $boolean, true); + } + + /** + * Add a where between statement to the query. + * + * @param string $column + * @param array $values + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereBetween($column, array $values, $boolean = 'and', $not = false) + { + $type = 'between'; + + $this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not'); + + $this->addBinding($this->cleanBindings($values), 'where'); + + return $this; + } + + /** + * Add an or where between statement to the query. + * + * @param string $column + * @param array $values + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereBetween($column, array $values) + { + return $this->whereBetween($column, $values, 'or'); + } + + /** + * Add a where not between statement to the query. + * + * @param string $column + * @param array $values + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereNotBetween($column, array $values, $boolean = 'and') + { + return $this->whereBetween($column, $values, $boolean, true); + } + + /** + * Add an or where not between statement to the query. + * + * @param string $column + * @param array $values + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereNotBetween($column, array $values) + { + return $this->whereNotBetween($column, $values, 'or'); + } + + /** + * Add an "or where not null" clause to the query. + * + * @param string $column + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereNotNull($column) + { + return $this->whereNotNull($column, 'or'); + } + + /** + * Add a "where date" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string $value + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereDate($column, $operator, $value = null, $boolean = 'and') + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + if ($value instanceof DateTimeInterface) { + $value = $value->format('Y-m-d'); + } + + return $this->addDateBasedWhere('Date', $column, $operator, $value, $boolean); + } + + /** + * Add an "or where date" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereDate($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->whereDate($column, $operator, $value, 'or'); + } + + /** + * Add a "where time" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string $value + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereTime($column, $operator, $value = null, $boolean = 'and') + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + if ($value instanceof DateTimeInterface) { + $value = $value->format('H:i:s'); + } + + return $this->addDateBasedWhere('Time', $column, $operator, $value, $boolean); + } + + /** + * Add an "or where time" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereTime($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->whereTime($column, $operator, $value, 'or'); + } + + /** + * Add a "where day" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string $value + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereDay($column, $operator, $value = null, $boolean = 'and') + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + if ($value instanceof DateTimeInterface) { + $value = $value->format('d'); + } + + return $this->addDateBasedWhere('Day', $column, $operator, $value, $boolean); + } + + /** + * Add an "or where day" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereDay($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->addDateBasedWhere('Day', $column, $operator, $value, 'or'); + } + + /** + * Add a "where month" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string $value + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereMonth($column, $operator, $value = null, $boolean = 'and') + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + if ($value instanceof DateTimeInterface) { + $value = $value->format('m'); + } + + return $this->addDateBasedWhere('Month', $column, $operator, $value, $boolean); + } + + /** + * Add an "or where month" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereMonth($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->addDateBasedWhere('Month', $column, $operator, $value, 'or'); + } + + /** + * Add a "where year" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string|int $value + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereYear($column, $operator, $value = null, $boolean = 'and') + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + if ($value instanceof DateTimeInterface) { + $value = $value->format('Y'); + } + + return $this->addDateBasedWhere('Year', $column, $operator, $value, $boolean); + } + + /** + * Add an "or where year" statement to the query. + * + * @param string $column + * @param string $operator + * @param \DateTimeInterface|string|int $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereYear($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->addDateBasedWhere('Year', $column, $operator, $value, 'or'); + } + + /** + * Add a date based (year, month, day, time) statement to the query. + * + * @param string $type + * @param string $column + * @param string $operator + * @param mixed $value + * @param string $boolean + * @return $this + */ + protected function addDateBasedWhere($type, $column, $operator, $value, $boolean = 'and') + { + $this->wheres[] = compact('column', 'type', 'boolean', 'operator', 'value'); + + if (! $value instanceof Expression) { + $this->addBinding($value, 'where'); + } + + return $this; + } + + /** + * Add a nested where statement to the query. + * + * @param \Closure $callback + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereNested(Closure $callback, $boolean = 'and') + { + call_user_func($callback, $query = $this->forNestedWhere()); + + return $this->addNestedWhereQuery($query, $boolean); + } + + /** + * Create a new query instance for nested where condition. + * + * @return \Illuminate\Database\Query\Builder + */ + public function forNestedWhere() + { + return $this->newQuery()->from($this->from); + } + + /** + * Add another query builder as a nested where to the query builder. + * + * @param \Illuminate\Database\Query\Builder|static $query + * @param string $boolean + * @return $this + */ + public function addNestedWhereQuery($query, $boolean = 'and') + { + if (count($query->wheres)) { + $type = 'Nested'; + + $this->wheres[] = compact('type', 'query', 'boolean'); + + $this->addBinding($query->getRawBindings()['where'], 'where'); + } + + return $this; + } + + /** + * Add a full sub-select to the query. + * + * @param string $column + * @param string $operator + * @param \Closure $callback + * @param string $boolean + * @return $this + */ + protected function whereSub($column, $operator, Closure $callback, $boolean) + { + $type = 'Sub'; + + // Once we have the query instance we can simply execute it so it can add all + // of the sub-select's conditions to itself, and then we can cache it off + // in the array of where clauses for the "main" parent query instance. + call_user_func($callback, $query = $this->forSubQuery()); + + $this->wheres[] = compact( + 'type', 'column', 'operator', 'query', 'boolean' + ); + + $this->addBinding($query->getBindings(), 'where'); + + return $this; + } + + /** + * Add an exists clause to the query. + * + * @param \Closure $callback + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereExists(Closure $callback, $boolean = 'and', $not = false) + { + $query = $this->forSubQuery(); + + // Similar to the sub-select clause, we will create a new query instance so + // the developer may cleanly specify the entire exists query and we will + // compile the whole thing in the grammar and insert it into the SQL. + call_user_func($callback, $query); + + return $this->addWhereExistsQuery($query, $boolean, $not); + } + + /** + * Add an or exists clause to the query. + * + * @param \Closure $callback + * @param bool $not + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereExists(Closure $callback, $not = false) + { + return $this->whereExists($callback, 'or', $not); + } + + /** + * Add a where not exists clause to the query. + * + * @param \Closure $callback + * @param string $boolean + * @return \Illuminate\Database\Query\Builder|static + */ + public function whereNotExists(Closure $callback, $boolean = 'and') + { + return $this->whereExists($callback, $boolean, true); + } + + /** + * Add a where not exists clause to the query. + * + * @param \Closure $callback + * @return \Illuminate\Database\Query\Builder|static + */ + public function orWhereNotExists(Closure $callback) + { + return $this->orWhereExists($callback, true); + } + + /** + * Add an exists clause to the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $boolean + * @param bool $not + * @return $this + */ + public function addWhereExistsQuery(self $query, $boolean = 'and', $not = false) + { + $type = $not ? 'NotExists' : 'Exists'; + + $this->wheres[] = compact('type', 'query', 'boolean'); + + $this->addBinding($query->getBindings(), 'where'); + + return $this; + } + + /** + * Adds a where condition using row values. + * + * @param array $columns + * @param string $operator + * @param array $values + * @param string $boolean + * @return $this + */ + public function whereRowValues($columns, $operator, $values, $boolean = 'and') + { + if (count($columns) !== count($values)) { + throw new InvalidArgumentException('The number of columns must match the number of values'); + } + + $type = 'RowValues'; + + $this->wheres[] = compact('type', 'columns', 'operator', 'values', 'boolean'); + + $this->addBinding($this->cleanBindings($values)); + + return $this; + } + + /** + * Adds a or where condition using row values. + * + * @param array $columns + * @param string $operator + * @param array $values + * @return $this + */ + public function orWhereRowValues($columns, $operator, $values) + { + return $this->whereRowValues($columns, $operator, $values, 'or'); + } + + /** + * Add a "where JSON contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereJsonContains($column, $value, $boolean = 'and', $not = false) + { + $type = 'JsonContains'; + + $this->wheres[] = compact('type', 'column', 'value', 'boolean', 'not'); + + if (! $value instanceof Expression) { + $this->addBinding($this->grammar->prepareBindingForJsonContains($value)); + } + + return $this; + } + + /** + * Add a "or where JSON contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @return $this + */ + public function orWhereJsonContains($column, $value) + { + return $this->whereJsonContains($column, $value, 'or'); + } + + /** + * Add a "where JSON not contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @param string $boolean + * @return $this + */ + public function whereJsonDoesntContain($column, $value, $boolean = 'and') + { + return $this->whereJsonContains($column, $value, $boolean, true); + } + + /** + * Add a "or where JSON not contains" clause to the query. + * + * @param string $column + * @param mixed $value + * @return $this + */ + public function orWhereJsonDoesntContain($column, $value) + { + return $this->whereJsonDoesntContain($column, $value, 'or'); + } + + /** + * Add a "where JSON length" clause to the query. + * + * @param string $column + * @param mixed $operator + * @param mixed $value + * @param string $boolean + * @return $this + */ + public function whereJsonLength($column, $operator, $value = null, $boolean = 'and') + { + $type = 'JsonLength'; + + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + $this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean'); + + if (! $value instanceof Expression) { + $this->addBinding($value); + } + + return $this; + } + + /** + * Add a "or where JSON length" clause to the query. + * + * @param string $column + * @param mixed $operator + * @param mixed $value + * @return $this + */ + public function orWhereJsonLength($column, $operator, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->whereJsonLength($column, $operator, $value, 'or'); + } + + /** + * Handles dynamic "where" clauses to the query. + * + * @param string $method + * @param string $parameters + * @return $this + */ + public function dynamicWhere($method, $parameters) + { + $finder = substr($method, 5); + + $segments = preg_split( + '/(And|Or)(?=[A-Z])/', $finder, -1, PREG_SPLIT_DELIM_CAPTURE + ); + + // The connector variable will determine which connector will be used for the + // query condition. We will change it as we come across new boolean values + // in the dynamic method strings, which could contain a number of these. + $connector = 'and'; + + $index = 0; + + foreach ($segments as $segment) { + // If the segment is not a boolean connector, we can assume it is a column's name + // and we will add it to the query as a new constraint as a where clause, then + // we can keep iterating through the dynamic method string's segments again. + if ($segment !== 'And' && $segment !== 'Or') { + $this->addDynamic($segment, $connector, $parameters, $index); + + $index++; + } + + // Otherwise, we will store the connector so we know how the next where clause we + // find in the query should be connected to the previous ones, meaning we will + // have the proper boolean connector to connect the next where clause found. + else { + $connector = $segment; + } + } + + return $this; + } + + /** + * Add a single dynamic where clause statement to the query. + * + * @param string $segment + * @param string $connector + * @param array $parameters + * @param int $index + * @return void + */ + protected function addDynamic($segment, $connector, $parameters, $index) + { + // Once we have parsed out the columns and formatted the boolean operators we + // are ready to add it to this query as a where clause just like any other + // clause on the query. Then we'll increment the parameter index values. + $bool = strtolower($connector); + + $this->where(Str::snake($segment), '=', $parameters[$index], $bool); + } + + /** + * Add a "group by" clause to the query. + * + * @param array ...$groups + * @return $this + */ + public function groupBy(...$groups) + { + foreach ($groups as $group) { + $this->groups = array_merge( + (array) $this->groups, + Arr::wrap($group) + ); + } + + return $this; + } + + /** + * Add a "having" clause to the query. + * + * @param string $column + * @param string|null $operator + * @param string|null $value + * @param string $boolean + * @return $this + */ + public function having($column, $operator = null, $value = null, $boolean = 'and') + { + $type = 'Basic'; + + // Here we will make some assumptions about the operator. If only 2 values are + // passed to the method, we will assume that the operator is an equals sign + // and keep going. Otherwise, we'll require the operator to be passed in. + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + // If the given operator is not found in the list of valid operators we will + // assume that the developer is just short-cutting the '=' operators and + // we will set the operators to '=' and set the values appropriately. + if ($this->invalidOperator($operator)) { + [$value, $operator] = [$operator, '=']; + } + + $this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean'); + + if (! $value instanceof Expression) { + $this->addBinding($value, 'having'); + } + + return $this; + } + + /** + * Add a "or having" clause to the query. + * + * @param string $column + * @param string|null $operator + * @param string|null $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function orHaving($column, $operator = null, $value = null) + { + [$value, $operator] = $this->prepareValueAndOperator( + $value, $operator, func_num_args() === 2 + ); + + return $this->having($column, $operator, $value, 'or'); + } + + /** + * Add a "having between " clause to the query. + * + * @param string $column + * @param array $values + * @param string $boolean + * @param bool $not + * @return \Illuminate\Database\Query\Builder|static + */ + public function havingBetween($column, array $values, $boolean = 'and', $not = false) + { + $type = 'between'; + + $this->havings[] = compact('type', 'column', 'values', 'boolean', 'not'); + + $this->addBinding($this->cleanBindings($values), 'having'); + + return $this; + } + + /** + * Add a raw having clause to the query. + * + * @param string $sql + * @param array $bindings + * @param string $boolean + * @return $this + */ + public function havingRaw($sql, array $bindings = [], $boolean = 'and') + { + $type = 'Raw'; + + $this->havings[] = compact('type', 'sql', 'boolean'); + + $this->addBinding($bindings, 'having'); + + return $this; + } + + /** + * Add a raw or having clause to the query. + * + * @param string $sql + * @param array $bindings + * @return \Illuminate\Database\Query\Builder|static + */ + public function orHavingRaw($sql, array $bindings = []) + { + return $this->havingRaw($sql, $bindings, 'or'); + } + + /** + * Add an "order by" clause to the query. + * + * @param string $column + * @param string $direction + * @return $this + */ + public function orderBy($column, $direction = 'asc') + { + $this->{$this->unions ? 'unionOrders' : 'orders'}[] = [ + 'column' => $column, + 'direction' => strtolower($direction) === 'asc' ? 'asc' : 'desc', + ]; + + return $this; + } + + /** + * Add a descending "order by" clause to the query. + * + * @param string $column + * @return $this + */ + public function orderByDesc($column) + { + return $this->orderBy($column, 'desc'); + } + + /** + * Add an "order by" clause for a timestamp to the query. + * + * @param string $column + * @return \Illuminate\Database\Query\Builder|static + */ + public function latest($column = 'created_at') + { + return $this->orderBy($column, 'desc'); + } + + /** + * Add an "order by" clause for a timestamp to the query. + * + * @param string $column + * @return \Illuminate\Database\Query\Builder|static + */ + public function oldest($column = 'created_at') + { + return $this->orderBy($column, 'asc'); + } + + /** + * Put the query's results in random order. + * + * @param string $seed + * @return $this + */ + public function inRandomOrder($seed = '') + { + return $this->orderByRaw($this->grammar->compileRandom($seed)); + } + + /** + * Add a raw "order by" clause to the query. + * + * @param string $sql + * @param array $bindings + * @return $this + */ + public function orderByRaw($sql, $bindings = []) + { + $type = 'Raw'; + + $this->{$this->unions ? 'unionOrders' : 'orders'}[] = compact('type', 'sql'); + + $this->addBinding($bindings, 'order'); + + return $this; + } + + /** + * Alias to set the "offset" value of the query. + * + * @param int $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function skip($value) + { + return $this->offset($value); + } + + /** + * Set the "offset" value of the query. + * + * @param int $value + * @return $this + */ + public function offset($value) + { + $property = $this->unions ? 'unionOffset' : 'offset'; + + $this->$property = max(0, $value); + + return $this; + } + + /** + * Alias to set the "limit" value of the query. + * + * @param int $value + * @return \Illuminate\Database\Query\Builder|static + */ + public function take($value) + { + return $this->limit($value); + } + + /** + * Set the "limit" value of the query. + * + * @param int $value + * @return $this + */ + public function limit($value) + { + $property = $this->unions ? 'unionLimit' : 'limit'; + + if ($value >= 0) { + $this->$property = $value; + } + + return $this; + } + + /** + * Set the limit and offset for a given page. + * + * @param int $page + * @param int $perPage + * @return \Illuminate\Database\Query\Builder|static + */ + public function forPage($page, $perPage = 15) + { + return $this->skip(($page - 1) * $perPage)->take($perPage); + } + + /** + * Constrain the query to the next "page" of results after a given ID. + * + * @param int $perPage + * @param int|null $lastId + * @param string $column + * @return \Illuminate\Database\Query\Builder|static + */ + public function forPageAfterId($perPage = 15, $lastId = 0, $column = 'id') + { + $this->orders = $this->removeExistingOrdersFor($column); + + if (! is_null($lastId)) { + $this->where($column, '>', $lastId); + } + + return $this->orderBy($column, 'asc') + ->take($perPage); + } + + /** + * Get an array with all orders with a given column removed. + * + * @param string $column + * @return array + */ + protected function removeExistingOrdersFor($column) + { + return Collection::make($this->orders) + ->reject(function ($order) use ($column) { + return isset($order['column']) + ? $order['column'] === $column : false; + })->values()->all(); + } + + /** + * Add a union statement to the query. + * + * @param \Illuminate\Database\Query\Builder|\Closure $query + * @param bool $all + * @return \Illuminate\Database\Query\Builder|static + */ + public function union($query, $all = false) + { + if ($query instanceof Closure) { + call_user_func($query, $query = $this->newQuery()); + } + + $this->unions[] = compact('query', 'all'); + + $this->addBinding($query->getBindings(), 'union'); + + return $this; + } + + /** + * Add a union all statement to the query. + * + * @param \Illuminate\Database\Query\Builder|\Closure $query + * @return \Illuminate\Database\Query\Builder|static + */ + public function unionAll($query) + { + return $this->union($query, true); + } + + /** + * Lock the selected rows in the table. + * + * @param string|bool $value + * @return $this + */ + public function lock($value = true) + { + $this->lock = $value; + + if (! is_null($this->lock)) { + $this->useWritePdo(); + } + + return $this; + } + + /** + * Lock the selected rows in the table for updating. + * + * @return \Illuminate\Database\Query\Builder + */ + public function lockForUpdate() + { + return $this->lock(true); + } + + /** + * Share lock the selected rows in the table. + * + * @return \Illuminate\Database\Query\Builder + */ + public function sharedLock() + { + return $this->lock(false); + } + + /** + * Get the SQL representation of the query. + * + * @return string + */ + public function toSql() + { + return $this->grammar->compileSelect($this); + } + + /** + * Execute a query for a single record by ID. + * + * @param int $id + * @param array $columns + * @return mixed|static + */ + public function find($id, $columns = ['*']) + { + return $this->where('id', '=', $id)->first($columns); + } + + /** + * Get a single column's value from the first result of a query. + * + * @param string $column + * @return mixed + */ + public function value($column) + { + $result = (array) $this->first([$column]); + + return count($result) > 0 ? reset($result) : null; + } + + /** + * Execute the query as a "select" statement. + * + * @param array $columns + * @return \Illuminate\Support\Collection + */ + public function get($columns = ['*']) + { + return collect($this->onceWithColumns($columns, function () { + return $this->processor->processSelect($this, $this->runSelect()); + })); + } + + /** + * Run the query as a "select" statement against the connection. + * + * @return array + */ + protected function runSelect() + { + return $this->connection->select( + $this->toSql(), $this->getBindings(), ! $this->useWritePdo + ); + } + + /** + * Paginate the given query into a simple paginator. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator + */ + public function paginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null) + { + $page = $page ?: Paginator::resolveCurrentPage($pageName); + + $total = $this->getCountForPagination($columns); + + $results = $total ? $this->forPage($page, $perPage)->get($columns) : collect(); + + return $this->paginator($results, $total, $perPage, $page, [ + 'path' => Paginator::resolveCurrentPath(), + 'pageName' => $pageName, + ]); + } + + /** + * Get a paginator only supporting simple next and previous links. + * + * This is more efficient on larger data-sets, etc. + * + * @param int $perPage + * @param array $columns + * @param string $pageName + * @param int|null $page + * @return \Illuminate\Contracts\Pagination\Paginator + */ + public function simplePaginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null) + { + $page = $page ?: Paginator::resolveCurrentPage($pageName); + + $this->skip(($page - 1) * $perPage)->take($perPage + 1); + + return $this->simplePaginator($this->get($columns), $perPage, $page, [ + 'path' => Paginator::resolveCurrentPath(), + 'pageName' => $pageName, + ]); + } + + /** + * Get the count of the total records for the paginator. + * + * @param array $columns + * @return int + */ + public function getCountForPagination($columns = ['*']) + { + $results = $this->runPaginationCountQuery($columns); + + // Once we have run the pagination count query, we will get the resulting count and + // take into account what type of query it was. When there is a group by we will + // just return the count of the entire results set since that will be correct. + if (isset($this->groups)) { + return count($results); + } elseif (! isset($results[0])) { + return 0; + } elseif (is_object($results[0])) { + return (int) $results[0]->aggregate; + } + + return (int) array_change_key_case((array) $results[0])['aggregate']; + } + + /** + * Run a pagination count query. + * + * @param array $columns + * @return array + */ + protected function runPaginationCountQuery($columns = ['*']) + { + $without = $this->unions ? ['orders', 'limit', 'offset'] : ['columns', 'orders', 'limit', 'offset']; + + return $this->cloneWithout($without) + ->cloneWithoutBindings($this->unions ? ['order'] : ['select', 'order']) + ->setAggregate('count', $this->withoutSelectAliases($columns)) + ->get()->all(); + } + + /** + * Remove the column aliases since they will break count queries. + * + * @param array $columns + * @return array + */ + protected function withoutSelectAliases(array $columns) + { + return array_map(function ($column) { + return is_string($column) && ($aliasPosition = stripos($column, ' as ')) !== false + ? substr($column, 0, $aliasPosition) : $column; + }, $columns); + } + + /** + * Get a generator for the given query. + * + * @return \Generator + */ + public function cursor() + { + if (is_null($this->columns)) { + $this->columns = ['*']; + } + + return $this->connection->cursor( + $this->toSql(), $this->getBindings(), ! $this->useWritePdo + ); + } + + /** + * Chunk the results of a query by comparing numeric IDs. + * + * @param int $count + * @param callable $callback + * @param string $column + * @param string|null $alias + * @return bool + */ + public function chunkById($count, callable $callback, $column = 'id', $alias = null) + { + $alias = $alias ?: $column; + + $lastId = null; + + do { + $clone = clone $this; + + // We'll execute the query for the given page and get the results. If there are + // no results we can just break and return from here. When there are results + // we will call the callback with the current chunk of these results here. + $results = $clone->forPageAfterId($count, $lastId, $column)->get(); + + $countResults = $results->count(); + + if ($countResults == 0) { + break; + } + + // On each chunk result set, we will pass them to the callback and then let the + // developer take care of everything within the callback, which allows us to + // keep the memory low for spinning through large result sets for working. + if ($callback($results) === false) { + return false; + } + + $lastId = $results->last()->{$alias}; + + unset($results); + } while ($countResults == $count); + + return true; + } + + /** + * Throw an exception if the query doesn't have an orderBy clause. + * + * @return void + * + * @throws \RuntimeException + */ + protected function enforceOrderBy() + { + if (empty($this->orders) && empty($this->unionOrders)) { + throw new RuntimeException('You must specify an orderBy clause when using this function.'); + } + } + + /** + * Get an array with the values of a given column. + * + * @param string $column + * @param string|null $key + * @return \Illuminate\Support\Collection + */ + public function pluck($column, $key = null) + { + // First, we will need to select the results of the query accounting for the + // given columns / key. Once we have the results, we will be able to take + // the results and get the exact data that was requested for the query. + $queryResult = $this->onceWithColumns( + is_null($key) ? [$column] : [$column, $key], + function () { + return $this->processor->processSelect( + $this, $this->runSelect() + ); + } + ); + + if (empty($queryResult)) { + return collect(); + } + + // If the columns are qualified with a table or have an alias, we cannot use + // those directly in the "pluck" operations since the results from the DB + // are only keyed by the column itself. We'll strip the table out here. + $column = $this->stripTableForPluck($column); + + $key = $this->stripTableForPluck($key); + + return is_array($queryResult[0]) + ? $this->pluckFromArrayColumn($queryResult, $column, $key) + : $this->pluckFromObjectColumn($queryResult, $column, $key); + } + + /** + * Strip off the table name or alias from a column identifier. + * + * @param string $column + * @return string|null + */ + protected function stripTableForPluck($column) + { + return is_null($column) ? $column : last(preg_split('~\.| ~', $column)); + } + + /** + * Retrieve column values from rows represented as objects. + * + * @param array $queryResult + * @param string $column + * @param string $key + * @return \Illuminate\Support\Collection + */ + protected function pluckFromObjectColumn($queryResult, $column, $key) + { + $results = []; + + if (is_null($key)) { + foreach ($queryResult as $row) { + $results[] = $row->$column; + } + } else { + foreach ($queryResult as $row) { + $results[$row->$key] = $row->$column; + } + } + + return collect($results); + } + + /** + * Retrieve column values from rows represented as arrays. + * + * @param array $queryResult + * @param string $column + * @param string $key + * @return \Illuminate\Support\Collection + */ + protected function pluckFromArrayColumn($queryResult, $column, $key) + { + $results = []; + + if (is_null($key)) { + foreach ($queryResult as $row) { + $results[] = $row[$column]; + } + } else { + foreach ($queryResult as $row) { + $results[$row[$key]] = $row[$column]; + } + } + + return collect($results); + } + + /** + * Concatenate values of a given column as a string. + * + * @param string $column + * @param string $glue + * @return string + */ + public function implode($column, $glue = '') + { + return $this->pluck($column)->implode($glue); + } + + /** + * Determine if any rows exist for the current query. + * + * @return bool + */ + public function exists() + { + $results = $this->connection->select( + $this->grammar->compileExists($this), $this->getBindings(), ! $this->useWritePdo + ); + + // If the results has rows, we will get the row and see if the exists column is a + // boolean true. If there is no results for this query we will return false as + // there are no rows for this query at all and we can return that info here. + if (isset($results[0])) { + $results = (array) $results[0]; + + return (bool) $results['exists']; + } + + return false; + } + + /** + * Determine if no rows exist for the current query. + * + * @return bool + */ + public function doesntExist() + { + return ! $this->exists(); + } + + /** + * Retrieve the "count" result of the query. + * + * @param string $columns + * @return int + */ + public function count($columns = '*') + { + return (int) $this->aggregate(__FUNCTION__, Arr::wrap($columns)); + } + + /** + * Retrieve the minimum value of a given column. + * + * @param string $column + * @return mixed + */ + public function min($column) + { + return $this->aggregate(__FUNCTION__, [$column]); + } + + /** + * Retrieve the maximum value of a given column. + * + * @param string $column + * @return mixed + */ + public function max($column) + { + return $this->aggregate(__FUNCTION__, [$column]); + } + + /** + * Retrieve the sum of the values of a given column. + * + * @param string $column + * @return mixed + */ + public function sum($column) + { + $result = $this->aggregate(__FUNCTION__, [$column]); + + return $result ?: 0; + } + + /** + * Retrieve the average of the values of a given column. + * + * @param string $column + * @return mixed + */ + public function avg($column) + { + return $this->aggregate(__FUNCTION__, [$column]); + } + + /** + * Alias for the "avg" method. + * + * @param string $column + * @return mixed + */ + public function average($column) + { + return $this->avg($column); + } + + /** + * Execute an aggregate function on the database. + * + * @param string $function + * @param array $columns + * @return mixed + */ + public function aggregate($function, $columns = ['*']) + { + $results = $this->cloneWithout($this->unions ? [] : ['columns']) + ->cloneWithoutBindings($this->unions ? [] : ['select']) + ->setAggregate($function, $columns) + ->get($columns); + + if (! $results->isEmpty()) { + return array_change_key_case((array) $results[0])['aggregate']; + } + } + + /** + * Execute a numeric aggregate function on the database. + * + * @param string $function + * @param array $columns + * @return float|int + */ + public function numericAggregate($function, $columns = ['*']) + { + $result = $this->aggregate($function, $columns); + + // If there is no result, we can obviously just return 0 here. Next, we will check + // if the result is an integer or float. If it is already one of these two data + // types we can just return the result as-is, otherwise we will convert this. + if (! $result) { + return 0; + } + + if (is_int($result) || is_float($result)) { + return $result; + } + + // If the result doesn't contain a decimal place, we will assume it is an int then + // cast it to one. When it does we will cast it to a float since it needs to be + // cast to the expected data type for the developers out of pure convenience. + return strpos((string) $result, '.') === false + ? (int) $result : (float) $result; + } + + /** + * Set the aggregate property without running the query. + * + * @param string $function + * @param array $columns + * @return $this + */ + protected function setAggregate($function, $columns) + { + $this->aggregate = compact('function', 'columns'); + + if (empty($this->groups)) { + $this->orders = null; + + $this->bindings['order'] = []; + } + + return $this; + } + + /** + * Execute the given callback while selecting the given columns. + * + * After running the callback, the columns are reset to the original value. + * + * @param array $columns + * @param callable $callback + * @return mixed + */ + protected function onceWithColumns($columns, $callback) + { + $original = $this->columns; + + if (is_null($original)) { + $this->columns = $columns; + } + + $result = $callback(); + + $this->columns = $original; + + return $result; + } + + /** + * Insert a new record into the database. + * + * @param array $values + * @return bool + */ + public function insert(array $values) + { + // Since every insert gets treated like a batch insert, we will make sure the + // bindings are structured in a way that is convenient when building these + // inserts statements by verifying these elements are actually an array. + if (empty($values)) { + return true; + } + + if (! is_array(reset($values))) { + $values = [$values]; + } + + // Here, we will sort the insert keys for every record so that each insert is + // in the same order for the record. We need to make sure this is the case + // so there are not any errors or problems when inserting these records. + else { + foreach ($values as $key => $value) { + ksort($value); + + $values[$key] = $value; + } + } + + // Finally, we will run this query against the database connection and return + // the results. We will need to also flatten these bindings before running + // the query so they are all in one huge, flattened array for execution. + return $this->connection->insert( + $this->grammar->compileInsert($this, $values), + $this->cleanBindings(Arr::flatten($values, 1)) + ); + } + + /** + * Insert a new record and get the value of the primary key. + * + * @param array $values + * @param string|null $sequence + * @return int + */ + public function insertGetId(array $values, $sequence = null) + { + $sql = $this->grammar->compileInsertGetId($this, $values, $sequence); + + $values = $this->cleanBindings($values); + + return $this->processor->processInsertGetId($this, $sql, $values, $sequence); + } + + /** + * Insert new records into the table using a subquery. + * + * @param array $columns + * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @return bool + */ + public function insertUsing(array $columns, $query) + { + [$sql, $bindings] = $this->createSub($query); + + return $this->connection->insert( + $this->grammar->compileInsertUsing($this, $columns, $sql), + $this->cleanBindings($bindings) + ); + } + + /** + * Update a record in the database. + * + * @param array $values + * @return int + */ + public function update(array $values) + { + $sql = $this->grammar->compileUpdate($this, $values); + + return $this->connection->update($sql, $this->cleanBindings( + $this->grammar->prepareBindingsForUpdate($this->bindings, $values) + )); + } + + /** + * Insert or update a record matching the attributes, and fill it with values. + * + * @param array $attributes + * @param array $values + * @return bool + */ + public function updateOrInsert(array $attributes, array $values = []) + { + if (! $this->where($attributes)->exists()) { + return $this->insert(array_merge($attributes, $values)); + } + + return (bool) $this->take(1)->update($values); + } + + /** + * Increment a column's value by a given amount. + * + * @param string $column + * @param float|int $amount + * @param array $extra + * @return int + */ + public function increment($column, $amount = 1, array $extra = []) + { + if (! is_numeric($amount)) { + throw new InvalidArgumentException('Non-numeric value passed to increment method.'); + } + + $wrapped = $this->grammar->wrap($column); + + $columns = array_merge([$column => $this->raw("$wrapped + $amount")], $extra); + + return $this->update($columns); + } + + /** + * Decrement a column's value by a given amount. + * + * @param string $column + * @param float|int $amount + * @param array $extra + * @return int + */ + public function decrement($column, $amount = 1, array $extra = []) + { + if (! is_numeric($amount)) { + throw new InvalidArgumentException('Non-numeric value passed to decrement method.'); + } + + $wrapped = $this->grammar->wrap($column); + + $columns = array_merge([$column => $this->raw("$wrapped - $amount")], $extra); + + return $this->update($columns); + } + + /** + * Delete a record from the database. + * + * @param mixed $id + * @return int + */ + public function delete($id = null) + { + // If an ID is passed to the method, we will set the where clause to check the + // ID to let developers to simply and quickly remove a single row from this + // database without manually specifying the "where" clauses on the query. + if (! is_null($id)) { + $this->where($this->from.'.id', '=', $id); + } + + return $this->connection->delete( + $this->grammar->compileDelete($this), $this->cleanBindings( + $this->grammar->prepareBindingsForDelete($this->bindings) + ) + ); + } + + /** + * Run a truncate statement on the table. + * + * @return void + */ + public function truncate() + { + foreach ($this->grammar->compileTruncate($this) as $sql => $bindings) { + $this->connection->statement($sql, $bindings); + } + } + + /** + * Get a new instance of the query builder. + * + * @return \Illuminate\Database\Query\Builder + */ + public function newQuery() + { + return new static($this->connection, $this->grammar, $this->processor); + } + + /** + * Create a new query instance for a sub-query. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function forSubQuery() + { + return $this->newQuery(); + } + + /** + * Create a raw database expression. + * + * @param mixed $value + * @return \Illuminate\Database\Query\Expression + */ + public function raw($value) + { + return $this->connection->raw($value); + } + + /** + * Get the current query value bindings in a flattened array. + * + * @return array + */ + public function getBindings() + { + return Arr::flatten($this->bindings); + } + + /** + * Get the raw array of bindings. + * + * @return array + */ + public function getRawBindings() + { + return $this->bindings; + } + + /** + * Set the bindings on the query builder. + * + * @param array $bindings + * @param string $type + * @return $this + * + * @throws \InvalidArgumentException + */ + public function setBindings(array $bindings, $type = 'where') + { + if (! array_key_exists($type, $this->bindings)) { + throw new InvalidArgumentException("Invalid binding type: {$type}."); + } + + $this->bindings[$type] = $bindings; + + return $this; + } + + /** + * Add a binding to the query. + * + * @param mixed $value + * @param string $type + * @return $this + * + * @throws \InvalidArgumentException + */ + public function addBinding($value, $type = 'where') + { + if (! array_key_exists($type, $this->bindings)) { + throw new InvalidArgumentException("Invalid binding type: {$type}."); + } + + if (is_array($value)) { + $this->bindings[$type] = array_values(array_merge($this->bindings[$type], $value)); + } else { + $this->bindings[$type][] = $value; + } + + return $this; + } + + /** + * Merge an array of bindings into our bindings. + * + * @param \Illuminate\Database\Query\Builder $query + * @return $this + */ + public function mergeBindings(self $query) + { + $this->bindings = array_merge_recursive($this->bindings, $query->bindings); + + return $this; + } + + /** + * Remove all of the expressions from a list of bindings. + * + * @param array $bindings + * @return array + */ + protected function cleanBindings(array $bindings) + { + return array_values(array_filter($bindings, function ($binding) { + return ! $binding instanceof Expression; + })); + } + + /** + * Get the database connection instance. + * + * @return \Illuminate\Database\ConnectionInterface + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Get the database query processor instance. + * + * @return \Illuminate\Database\Query\Processors\Processor + */ + public function getProcessor() + { + return $this->processor; + } + + /** + * Get the query grammar instance. + * + * @return \Illuminate\Database\Query\Grammars\Grammar + */ + public function getGrammar() + { + return $this->grammar; + } + + /** + * Use the write pdo for query. + * + * @return $this + */ + public function useWritePdo() + { + $this->useWritePdo = true; + + return $this; + } + + /** + * Clone the query without the given properties. + * + * @param array $properties + * @return static + */ + public function cloneWithout(array $properties) + { + return tap(clone $this, function ($clone) use ($properties) { + foreach ($properties as $property) { + $clone->{$property} = null; + } + }); + } + + /** + * Clone the query without the given bindings. + * + * @param array $except + * @return static + */ + public function cloneWithoutBindings(array $except) + { + return tap(clone $this, function ($clone) use ($except) { + foreach ($except as $type) { + $clone->bindings[$type] = []; + } + }); + } + + /** + * Handle dynamic method calls into the method. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + if (Str::startsWith($method, 'where')) { + return $this->dynamicWhere($method, $parameters); + } + + static::throwBadMethodCallException($method); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Expression.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Expression.php new file mode 100755 index 0000000..de69029 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Expression.php @@ -0,0 +1,44 @@ +value = $value; + } + + /** + * Get the value of the expression. + * + * @return mixed + */ + public function getValue() + { + return $this->value; + } + + /** + * Get the value of the expression. + * + * @return string + */ + public function __toString() + { + return (string) $this->getValue(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php new file mode 100755 index 0000000..679ae3b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php @@ -0,0 +1,1128 @@ +unions && $query->aggregate) { + return $this->compileUnionAggregate($query); + } + + // If the query does not have any columns set, we'll set the columns to the + // * character to just get all of the columns from the database. Then we + // can build the query and concatenate all the pieces together as one. + $original = $query->columns; + + if (is_null($query->columns)) { + $query->columns = ['*']; + } + + // To compile the query, we'll spin through each component of the query and + // see if that component exists. If it does we'll just call the compiler + // function for the component which is responsible for making the SQL. + $sql = trim($this->concatenate( + $this->compileComponents($query)) + ); + + $query->columns = $original; + + return $sql; + } + + /** + * Compile the components necessary for a select clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + protected function compileComponents(Builder $query) + { + $sql = []; + + foreach ($this->selectComponents as $component) { + // To compile the query, we'll spin through each component of the query and + // see if that component exists. If it does we'll just call the compiler + // function for the component which is responsible for making the SQL. + if (isset($query->$component) && ! is_null($query->$component)) { + $method = 'compile'.ucfirst($component); + + $sql[$component] = $this->$method($query, $query->$component); + } + } + + return $sql; + } + + /** + * Compile an aggregated select clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $aggregate + * @return string + */ + protected function compileAggregate(Builder $query, $aggregate) + { + $column = $this->columnize($aggregate['columns']); + + // If the query has a "distinct" constraint and we're not asking for all columns + // we need to prepend "distinct" onto the column name so that the query takes + // it into account when it performs the aggregating operations on the data. + if ($query->distinct && $column !== '*') { + $column = 'distinct '.$column; + } + + return 'select '.$aggregate['function'].'('.$column.') as aggregate'; + } + + /** + * Compile the "select *" portion of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $columns + * @return string|null + */ + protected function compileColumns(Builder $query, $columns) + { + // If the query is actually performing an aggregating select, we will let that + // compiler handle the building of the select clauses, as it will need some + // more syntax that is best handled by that function to keep things neat. + if (! is_null($query->aggregate)) { + return; + } + + $select = $query->distinct ? 'select distinct ' : 'select '; + + return $select.$this->columnize($columns); + } + + /** + * Compile the "from" portion of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @return string + */ + protected function compileFrom(Builder $query, $table) + { + return 'from '.$this->wrapTable($table); + } + + /** + * Compile the "join" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $joins + * @return string + */ + protected function compileJoins(Builder $query, $joins) + { + return collect($joins)->map(function ($join) use ($query) { + $table = $this->wrapTable($join->table); + + $nestedJoins = is_null($join->joins) ? '' : ' '.$this->compileJoins($query, $join->joins); + + $tableAndNestedJoins = is_null($join->joins) ? $table : '('.$table.$nestedJoins.')'; + + return trim("{$join->type} join {$tableAndNestedJoins} {$this->compileWheres($join)}"); + })->implode(' '); + } + + /** + * Compile the "where" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileWheres(Builder $query) + { + // Each type of where clauses has its own compiler function which is responsible + // for actually creating the where clauses SQL. This helps keep the code nice + // and maintainable since each clause has a very small method that it uses. + if (is_null($query->wheres)) { + return ''; + } + + // If we actually have some where clauses, we will strip off the first boolean + // operator, which is added by the query builders for convenience so we can + // avoid checking for the first clauses in each of the compilers methods. + if (count($sql = $this->compileWheresToArray($query)) > 0) { + return $this->concatenateWhereClauses($query, $sql); + } + + return ''; + } + + /** + * Get an array of all the where clauses for the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + protected function compileWheresToArray($query) + { + return collect($query->wheres)->map(function ($where) use ($query) { + return $where['boolean'].' '.$this->{"where{$where['type']}"}($query, $where); + })->all(); + } + + /** + * Format the where clause statements into one string. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $sql + * @return string + */ + protected function concatenateWhereClauses($query, $sql) + { + $conjunction = $query instanceof JoinClause ? 'on' : 'where'; + + return $conjunction.' '.$this->removeLeadingBoolean(implode(' ', $sql)); + } + + /** + * Compile a raw where clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereRaw(Builder $query, $where) + { + return $where['sql']; + } + + /** + * Compile a basic where clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereBasic(Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return $this->wrap($where['column']).' '.$where['operator'].' '.$value; + } + + /** + * Compile a "where in" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereIn(Builder $query, $where) + { + if (! empty($where['values'])) { + return $this->wrap($where['column']).' in ('.$this->parameterize($where['values']).')'; + } + + return '0 = 1'; + } + + /** + * Compile a "where not in" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNotIn(Builder $query, $where) + { + if (! empty($where['values'])) { + return $this->wrap($where['column']).' not in ('.$this->parameterize($where['values']).')'; + } + + return '1 = 1'; + } + + /** + * Compile a "where not in raw" clause. + * + * For safety, whereIntegerInRaw ensures this method is only used with integer values. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNotInRaw(Builder $query, $where) + { + if (! empty($where['values'])) { + return $this->wrap($where['column']).' not in ('.implode(', ', $where['values']).')'; + } + + return '1 = 1'; + } + + /** + * Compile a where in sub-select clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereInSub(Builder $query, $where) + { + return $this->wrap($where['column']).' in ('.$this->compileSelect($where['query']).')'; + } + + /** + * Compile a where not in sub-select clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNotInSub(Builder $query, $where) + { + return $this->wrap($where['column']).' not in ('.$this->compileSelect($where['query']).')'; + } + + /** + * Compile a "where in raw" clause. + * + * For safety, whereIntegerInRaw ensures this method is only used with integer values. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereInRaw(Builder $query, $where) + { + if (! empty($where['values'])) { + return $this->wrap($where['column']).' in ('.implode(', ', $where['values']).')'; + } + + return '0 = 1'; + } + + /** + * Compile a "where null" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNull(Builder $query, $where) + { + return $this->wrap($where['column']).' is null'; + } + + /** + * Compile a "where not null" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNotNull(Builder $query, $where) + { + return $this->wrap($where['column']).' is not null'; + } + + /** + * Compile a "between" where clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereBetween(Builder $query, $where) + { + $between = $where['not'] ? 'not between' : 'between'; + + $min = $this->parameter(reset($where['values'])); + + $max = $this->parameter(end($where['values'])); + + return $this->wrap($where['column']).' '.$between.' '.$min.' and '.$max; + } + + /** + * Compile a "where date" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDate(Builder $query, $where) + { + return $this->dateBasedWhere('date', $query, $where); + } + + /** + * Compile a "where time" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereTime(Builder $query, $where) + { + return $this->dateBasedWhere('time', $query, $where); + } + + /** + * Compile a "where day" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDay(Builder $query, $where) + { + return $this->dateBasedWhere('day', $query, $where); + } + + /** + * Compile a "where month" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereMonth(Builder $query, $where) + { + return $this->dateBasedWhere('month', $query, $where); + } + + /** + * Compile a "where year" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereYear(Builder $query, $where) + { + return $this->dateBasedWhere('year', $query, $where); + } + + /** + * Compile a date based where clause. + * + * @param string $type + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function dateBasedWhere($type, Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return $type.'('.$this->wrap($where['column']).') '.$where['operator'].' '.$value; + } + + /** + * Compile a where clause comparing two columns.. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereColumn(Builder $query, $where) + { + return $this->wrap($where['first']).' '.$where['operator'].' '.$this->wrap($where['second']); + } + + /** + * Compile a nested where clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNested(Builder $query, $where) + { + // Here we will calculate what portion of the string we need to remove. If this + // is a join clause query, we need to remove the "on" portion of the SQL and + // if it is a normal query we need to take the leading "where" of queries. + $offset = $query instanceof JoinClause ? 3 : 6; + + return '('.substr($this->compileWheres($where['query']), $offset).')'; + } + + /** + * Compile a where condition with a sub-select. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereSub(Builder $query, $where) + { + $select = $this->compileSelect($where['query']); + + return $this->wrap($where['column']).' '.$where['operator']." ($select)"; + } + + /** + * Compile a where exists clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereExists(Builder $query, $where) + { + return 'exists ('.$this->compileSelect($where['query']).')'; + } + + /** + * Compile a where exists clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereNotExists(Builder $query, $where) + { + return 'not exists ('.$this->compileSelect($where['query']).')'; + } + + /** + * Compile a where row values condition. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereRowValues(Builder $query, $where) + { + $columns = $this->columnize($where['columns']); + + $values = $this->parameterize($where['values']); + + return '('.$columns.') '.$where['operator'].' ('.$values.')'; + } + + /** + * Compile a "where JSON contains" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereJsonContains(Builder $query, $where) + { + $not = $where['not'] ? 'not ' : ''; + + return $not.$this->compileJsonContains( + $where['column'], $this->parameter($where['value']) + ); + } + + /** + * Compile a "JSON contains" statement into SQL. + * + * @param string $column + * @param string $value + * @return string + * + * @throws \RuntimeException + */ + protected function compileJsonContains($column, $value) + { + throw new RuntimeException('This database engine does not support JSON contains operations.'); + } + + /** + * Prepare the binding for a "JSON contains" statement. + * + * @param mixed $binding + * @return string + */ + public function prepareBindingForJsonContains($binding) + { + return json_encode($binding); + } + + /** + * Compile a "where JSON length" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereJsonLength(Builder $query, $where) + { + return $this->compileJsonLength( + $where['column'], $where['operator'], $this->parameter($where['value']) + ); + } + + /** + * Compile a "JSON length" statement into SQL. + * + * @param string $column + * @param string $operator + * @param string $value + * @return string + * + * @throws \RuntimeException + */ + protected function compileJsonLength($column, $operator, $value) + { + throw new RuntimeException('This database engine does not support JSON length operations.'); + } + + /** + * Compile the "group by" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $groups + * @return string + */ + protected function compileGroups(Builder $query, $groups) + { + return 'group by '.$this->columnize($groups); + } + + /** + * Compile the "having" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $havings + * @return string + */ + protected function compileHavings(Builder $query, $havings) + { + $sql = implode(' ', array_map([$this, 'compileHaving'], $havings)); + + return 'having '.$this->removeLeadingBoolean($sql); + } + + /** + * Compile a single having clause. + * + * @param array $having + * @return string + */ + protected function compileHaving(array $having) + { + // If the having clause is "raw", we can just return the clause straight away + // without doing any more processing on it. Otherwise, we will compile the + // clause into SQL based on the components that make it up from builder. + if ($having['type'] === 'Raw') { + return $having['boolean'].' '.$having['sql']; + } elseif ($having['type'] === 'between') { + return $this->compileHavingBetween($having); + } + + return $this->compileBasicHaving($having); + } + + /** + * Compile a basic having clause. + * + * @param array $having + * @return string + */ + protected function compileBasicHaving($having) + { + $column = $this->wrap($having['column']); + + $parameter = $this->parameter($having['value']); + + return $having['boolean'].' '.$column.' '.$having['operator'].' '.$parameter; + } + + /** + * Compile a "between" having clause. + * + * @param array $having + * @return string + */ + protected function compileHavingBetween($having) + { + $between = $having['not'] ? 'not between' : 'between'; + + $column = $this->wrap($having['column']); + + $min = $this->parameter(head($having['values'])); + + $max = $this->parameter(last($having['values'])); + + return $having['boolean'].' '.$column.' '.$between.' '.$min.' and '.$max; + } + + /** + * Compile the "order by" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $orders + * @return string + */ + protected function compileOrders(Builder $query, $orders) + { + if (! empty($orders)) { + return 'order by '.implode(', ', $this->compileOrdersToArray($query, $orders)); + } + + return ''; + } + + /** + * Compile the query orders to an array. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $orders + * @return array + */ + protected function compileOrdersToArray(Builder $query, $orders) + { + return array_map(function ($order) { + return ! isset($order['sql']) + ? $this->wrap($order['column']).' '.$order['direction'] + : $order['sql']; + }, $orders); + } + + /** + * Compile the random statement into SQL. + * + * @param string $seed + * @return string + */ + public function compileRandom($seed) + { + return 'RANDOM()'; + } + + /** + * Compile the "limit" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param int $limit + * @return string + */ + protected function compileLimit(Builder $query, $limit) + { + return 'limit '.(int) $limit; + } + + /** + * Compile the "offset" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param int $offset + * @return string + */ + protected function compileOffset(Builder $query, $offset) + { + return 'offset '.(int) $offset; + } + + /** + * Compile the "union" queries attached to the main query. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileUnions(Builder $query) + { + $sql = ''; + + foreach ($query->unions as $union) { + $sql .= $this->compileUnion($union); + } + + if (! empty($query->unionOrders)) { + $sql .= ' '.$this->compileOrders($query, $query->unionOrders); + } + + if (isset($query->unionLimit)) { + $sql .= ' '.$this->compileLimit($query, $query->unionLimit); + } + + if (isset($query->unionOffset)) { + $sql .= ' '.$this->compileOffset($query, $query->unionOffset); + } + + return ltrim($sql); + } + + /** + * Compile a single union statement. + * + * @param array $union + * @return string + */ + protected function compileUnion(array $union) + { + $conjunction = $union['all'] ? ' union all ' : ' union '; + + return $conjunction.$union['query']->toSql(); + } + + /** + * Compile a union aggregate query into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileUnionAggregate(Builder $query) + { + $sql = $this->compileAggregate($query, $query->aggregate); + + $query->aggregate = null; + + return $sql.' from ('.$this->compileSelect($query).') as '.$this->wrapTable('temp_table'); + } + + /** + * Compile an exists statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileExists(Builder $query) + { + $select = $this->compileSelect($query); + + return "select exists({$select}) as {$this->wrap('exists')}"; + } + + /** + * Compile an insert statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileInsert(Builder $query, array $values) + { + // Essentially we will force every insert to be treated as a batch insert which + // simply makes creating the SQL easier for us since we can utilize the same + // basic routine regardless of an amount of records given to us to insert. + $table = $this->wrapTable($query->from); + + if (! is_array(reset($values))) { + $values = [$values]; + } + + $columns = $this->columnize(array_keys(reset($values))); + + // We need to build a list of parameter place-holders of values that are bound + // to the query. Each insert should have the exact same amount of parameter + // bindings so we will loop through the record and parameterize them all. + $parameters = collect($values)->map(function ($record) { + return '('.$this->parameterize($record).')'; + })->implode(', '); + + return "insert into $table ($columns) values $parameters"; + } + + /** + * Compile an insert and get ID statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @param string $sequence + * @return string + */ + public function compileInsertGetId(Builder $query, $values, $sequence) + { + return $this->compileInsert($query, $values); + } + + /** + * Compile an insert statement using a subquery into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $columns + * @param string $sql + * @return string + */ + public function compileInsertUsing(Builder $query, array $columns, string $sql) + { + return "insert into {$this->wrapTable($query->from)} ({$this->columnize($columns)}) $sql"; + } + + /** + * Compile an update statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileUpdate(Builder $query, $values) + { + $table = $this->wrapTable($query->from); + + // Each one of the columns in the update statements needs to be wrapped in the + // keyword identifiers, also a place-holder needs to be created for each of + // the values in the list of bindings so we can make the sets statements. + $columns = collect($values)->map(function ($value, $key) { + return $this->wrap($key).' = '.$this->parameter($value); + })->implode(', '); + + // If the query has any "join" clauses, we will setup the joins on the builder + // and compile them so we can attach them to this update, as update queries + // can get join statements to attach to other tables when they're needed. + $joins = ''; + + if (isset($query->joins)) { + $joins = ' '.$this->compileJoins($query, $query->joins); + } + + // Of course, update queries may also be constrained by where clauses so we'll + // need to compile the where clauses and attach it to the query so only the + // intended records are updated by the SQL statements we generate to run. + $wheres = $this->compileWheres($query); + + return trim("update {$table}{$joins} set $columns $wheres"); + } + + /** + * Prepare the bindings for an update statement. + * + * @param array $bindings + * @param array $values + * @return array + */ + public function prepareBindingsForUpdate(array $bindings, array $values) + { + $cleanBindings = Arr::except($bindings, ['join', 'select']); + + return array_values( + array_merge($bindings['join'], $values, Arr::flatten($cleanBindings)) + ); + } + + /** + * Compile a delete statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileDelete(Builder $query) + { + $wheres = is_array($query->wheres) ? $this->compileWheres($query) : ''; + + return trim("delete from {$this->wrapTable($query->from)} $wheres"); + } + + /** + * Prepare the bindings for a delete statement. + * + * @param array $bindings + * @return array + */ + public function prepareBindingsForDelete(array $bindings) + { + return Arr::flatten($bindings); + } + + /** + * Compile a truncate table statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + public function compileTruncate(Builder $query) + { + return ['truncate '.$this->wrapTable($query->from) => []]; + } + + /** + * Compile the lock into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param bool|string $value + * @return string + */ + protected function compileLock(Builder $query, $value) + { + return is_string($value) ? $value : ''; + } + + /** + * Determine if the grammar supports savepoints. + * + * @return bool + */ + public function supportsSavepoints() + { + return true; + } + + /** + * Compile the SQL statement to define a savepoint. + * + * @param string $name + * @return string + */ + public function compileSavepoint($name) + { + return 'SAVEPOINT '.$name; + } + + /** + * Compile the SQL statement to execute a savepoint rollback. + * + * @param string $name + * @return string + */ + public function compileSavepointRollBack($name) + { + return 'ROLLBACK TO SAVEPOINT '.$name; + } + + /** + * Wrap a value in keyword identifiers. + * + * @param \Illuminate\Database\Query\Expression|string $value + * @param bool $prefixAlias + * @return string + */ + public function wrap($value, $prefixAlias = false) + { + if ($this->isExpression($value)) { + return $this->getValue($value); + } + + // If the value being wrapped has a column alias we will need to separate out + // the pieces so we can wrap each of the segments of the expression on its + // own, and then join these both back together using the "as" connector. + if (stripos($value, ' as ') !== false) { + return $this->wrapAliasedValue($value, $prefixAlias); + } + + // If the given value is a JSON selector we will wrap it differently than a + // traditional value. We will need to split this path and wrap each part + // wrapped, etc. Otherwise, we will simply wrap the value as a string. + if ($this->isJsonSelector($value)) { + return $this->wrapJsonSelector($value); + } + + return $this->wrapSegments(explode('.', $value)); + } + + /** + * Wrap the given JSON selector. + * + * @param string $value + * @return string + */ + protected function wrapJsonSelector($value) + { + throw new RuntimeException('This database engine does not support JSON operations.'); + } + + /** + * Split the given JSON selector into the field and the optional path and wrap them separately. + * + * @param string $column + * @return array + */ + protected function wrapJsonFieldAndPath($column) + { + $parts = explode('->', $column, 2); + + $field = $this->wrap($parts[0]); + + $path = count($parts) > 1 ? ', '.$this->wrapJsonPath($parts[1]) : ''; + + return [$field, $path]; + } + + /** + * Wrap the given JSON path. + * + * @param string $value + * @return string + */ + protected function wrapJsonPath($value) + { + return '\'$."'.str_replace('->', '"."', $value).'"\''; + } + + /** + * Determine if the given string is a JSON selector. + * + * @param string $value + * @return bool + */ + protected function isJsonSelector($value) + { + return Str::contains($value, '->'); + } + + /** + * Concatenate an array of segments, removing empties. + * + * @param array $segments + * @return string + */ + protected function concatenate($segments) + { + return implode(' ', array_filter($segments, function ($value) { + return (string) $value !== ''; + })); + } + + /** + * Remove the leading boolean from a statement. + * + * @param string $value + * @return string + */ + protected function removeLeadingBoolean($value) + { + return preg_replace('/and |or /i', '', $value, 1); + } + + /** + * Get the grammar specific operators. + * + * @return array + */ + public function getOperators() + { + return $this->operators; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php new file mode 100755 index 0000000..50af227 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php @@ -0,0 +1,331 @@ +unions && $query->aggregate) { + return $this->compileUnionAggregate($query); + } + + $sql = parent::compileSelect($query); + + if ($query->unions) { + $sql = '('.$sql.') '.$this->compileUnions($query); + } + + return $sql; + } + + /** + * Compile a "JSON contains" statement into SQL. + * + * @param string $column + * @param string $value + * @return string + */ + protected function compileJsonContains($column, $value) + { + return 'json_contains('.$this->wrap($column).', '.$value.')'; + } + + /** + * Compile a "JSON length" statement into SQL. + * + * @param string $column + * @param string $operator + * @param string $value + * @return string + */ + protected function compileJsonLength($column, $operator, $value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($column); + + return 'json_length('.$field.$path.') '.$operator.' '.$value; + } + + /** + * Compile a single union statement. + * + * @param array $union + * @return string + */ + protected function compileUnion(array $union) + { + $conjunction = $union['all'] ? ' union all ' : ' union '; + + return $conjunction.'('.$union['query']->toSql().')'; + } + + /** + * Compile the random statement into SQL. + * + * @param string $seed + * @return string + */ + public function compileRandom($seed) + { + return 'RAND('.$seed.')'; + } + + /** + * Compile the lock into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param bool|string $value + * @return string + */ + protected function compileLock(Builder $query, $value) + { + if (! is_string($value)) { + return $value ? 'for update' : 'lock in share mode'; + } + + return $value; + } + + /** + * Compile an update statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileUpdate(Builder $query, $values) + { + $table = $this->wrapTable($query->from); + + // Each one of the columns in the update statements needs to be wrapped in the + // keyword identifiers, also a place-holder needs to be created for each of + // the values in the list of bindings so we can make the sets statements. + $columns = $this->compileUpdateColumns($values); + + // If the query has any "join" clauses, we will setup the joins on the builder + // and compile them so we can attach them to this update, as update queries + // can get join statements to attach to other tables when they're needed. + $joins = ''; + + if (isset($query->joins)) { + $joins = ' '.$this->compileJoins($query, $query->joins); + } + + // Of course, update queries may also be constrained by where clauses so we'll + // need to compile the where clauses and attach it to the query so only the + // intended records are updated by the SQL statements we generate to run. + $where = $this->compileWheres($query); + + $sql = rtrim("update {$table}{$joins} set $columns $where"); + + // If the query has an order by clause we will compile it since MySQL supports + // order bys on update statements. We'll compile them using the typical way + // of compiling order bys. Then they will be appended to the SQL queries. + if (! empty($query->orders)) { + $sql .= ' '.$this->compileOrders($query, $query->orders); + } + + // Updates on MySQL also supports "limits", which allow you to easily update a + // single record very easily. This is not supported by all database engines + // so we have customized this update compiler here in order to add it in. + if (isset($query->limit)) { + $sql .= ' '.$this->compileLimit($query, $query->limit); + } + + return rtrim($sql); + } + + /** + * Compile all of the columns for an update statement. + * + * @param array $values + * @return string + */ + protected function compileUpdateColumns($values) + { + return collect($values)->map(function ($value, $key) { + if ($this->isJsonSelector($key)) { + return $this->compileJsonUpdateColumn($key, new JsonExpression($value)); + } + + return $this->wrap($key).' = '.$this->parameter($value); + })->implode(', '); + } + + /** + * Prepares a JSON column being updated using the JSON_SET function. + * + * @param string $key + * @param \Illuminate\Database\Query\JsonExpression $value + * @return string + */ + protected function compileJsonUpdateColumn($key, JsonExpression $value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($key); + + return "{$field} = json_set({$field}{$path}, {$value->getValue()})"; + } + + /** + * Prepare the bindings for an update statement. + * + * Booleans, integers, and doubles are inserted into JSON updates as raw values. + * + * @param array $bindings + * @param array $values + * @return array + */ + public function prepareBindingsForUpdate(array $bindings, array $values) + { + $values = collect($values)->reject(function ($value, $column) { + return $this->isJsonSelector($column) && is_bool($value); + })->all(); + + return parent::prepareBindingsForUpdate($bindings, $values); + } + + /** + * Compile a delete statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileDelete(Builder $query) + { + $table = $this->wrapTable($query->from); + + $where = is_array($query->wheres) ? $this->compileWheres($query) : ''; + + return isset($query->joins) + ? $this->compileDeleteWithJoins($query, $table, $where) + : $this->compileDeleteWithoutJoins($query, $table, $where); + } + + /** + * Prepare the bindings for a delete statement. + * + * @param array $bindings + * @return array + */ + public function prepareBindingsForDelete(array $bindings) + { + $cleanBindings = Arr::except($bindings, ['join', 'select']); + + return array_values( + array_merge($bindings['join'], Arr::flatten($cleanBindings)) + ); + } + + /** + * Compile a delete query that does not use joins. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @param array $where + * @return string + */ + protected function compileDeleteWithoutJoins($query, $table, $where) + { + $sql = trim("delete from {$table} {$where}"); + + // When using MySQL, delete statements may contain order by statements and limits + // so we will compile both of those here. Once we have finished compiling this + // we will return the completed SQL statement so it will be executed for us. + if (! empty($query->orders)) { + $sql .= ' '.$this->compileOrders($query, $query->orders); + } + + if (isset($query->limit)) { + $sql .= ' '.$this->compileLimit($query, $query->limit); + } + + return $sql; + } + + /** + * Compile a delete query that uses joins. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @param array $where + * @return string + */ + protected function compileDeleteWithJoins($query, $table, $where) + { + $joins = ' '.$this->compileJoins($query, $query->joins); + + $alias = stripos($table, ' as ') !== false + ? explode(' as ', $table)[1] : $table; + + return trim("delete {$alias} from {$table}{$joins} {$where}"); + } + + /** + * Wrap a single string in keyword identifiers. + * + * @param string $value + * @return string + */ + protected function wrapValue($value) + { + return $value === '*' ? $value : '`'.str_replace('`', '``', $value).'`'; + } + + /** + * Wrap the given JSON selector. + * + * @param string $value + * @return string + */ + protected function wrapJsonSelector($value) + { + $delimiter = Str::contains($value, '->>') + ? '->>' + : '->'; + + $path = explode($delimiter, $value); + + $field = $this->wrapSegments(explode('.', array_shift($path))); + + return sprintf('%s'.$delimiter.'\'$.%s\'', $field, collect($path)->map(function ($part) { + return '"'.$part.'"'; + })->implode('.')); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php new file mode 100755 index 0000000..be5b882 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php @@ -0,0 +1,401 @@ +', '<=', '>=', '<>', '!=', + 'like', 'not like', 'between', 'ilike', 'not ilike', + '~', '&', '|', '#', '<<', '>>', '<<=', '>>=', + '&&', '@>', '<@', '?', '?|', '?&', '||', '-', '-', '#-', + 'is distinct from', 'is not distinct from', + ]; + + /** + * {@inheritdoc} + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereBasic(Builder $query, $where) + { + if (Str::contains(strtolower($where['operator']), 'like')) { + return sprintf( + '%s::text %s %s', + $this->wrap($where['column']), + $where['operator'], + $this->parameter($where['value']) + ); + } + + return parent::whereBasic($query, $where); + } + + /** + * Compile a "where date" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDate(Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return $this->wrap($where['column']).'::date '.$where['operator'].' '.$value; + } + + /** + * Compile a "where time" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereTime(Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return $this->wrap($where['column']).'::time '.$where['operator'].' '.$value; + } + + /** + * Compile a date based where clause. + * + * @param string $type + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function dateBasedWhere($type, Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return 'extract('.$type.' from '.$this->wrap($where['column']).') '.$where['operator'].' '.$value; + } + + /** + * Compile a "JSON contains" statement into SQL. + * + * @param string $column + * @param string $value + * @return string + */ + protected function compileJsonContains($column, $value) + { + $column = str_replace('->>', '->', $this->wrap($column)); + + return '('.$column.')::jsonb @> '.$value; + } + + /** + * Compile a "JSON length" statement into SQL. + * + * @param string $column + * @param string $operator + * @param string $value + * @return string + */ + protected function compileJsonLength($column, $operator, $value) + { + $column = str_replace('->>', '->', $this->wrap($column)); + + return 'json_array_length(('.$column.')::json) '.$operator.' '.$value; + } + + /** + * Compile the lock into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param bool|string $value + * @return string + */ + protected function compileLock(Builder $query, $value) + { + if (! is_string($value)) { + return $value ? 'for update' : 'for share'; + } + + return $value; + } + + /** + * {@inheritdoc} + */ + public function compileInsert(Builder $query, array $values) + { + $table = $this->wrapTable($query->from); + + return empty($values) + ? "insert into {$table} DEFAULT VALUES" + : parent::compileInsert($query, $values); + } + + /** + * Compile an insert and get ID statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @param string $sequence + * @return string + */ + public function compileInsertGetId(Builder $query, $values, $sequence) + { + if (is_null($sequence)) { + $sequence = 'id'; + } + + return $this->compileInsert($query, $values).' returning '.$this->wrap($sequence); + } + + /** + * Compile an update statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileUpdate(Builder $query, $values) + { + $table = $this->wrapTable($query->from); + + // Each one of the columns in the update statements needs to be wrapped in the + // keyword identifiers, also a place-holder needs to be created for each of + // the values in the list of bindings so we can make the sets statements. + $columns = $this->compileUpdateColumns($values); + + $from = $this->compileUpdateFrom($query); + + $where = $this->compileUpdateWheres($query); + + return trim("update {$table} set {$columns}{$from} {$where}"); + } + + /** + * Compile the columns for the update statement. + * + * @param array $values + * @return string + */ + protected function compileUpdateColumns($values) + { + // When gathering the columns for an update statement, we'll wrap each of the + // columns and convert it to a parameter value. Then we will concatenate a + // list of the columns that can be added into this update query clauses. + return collect($values)->map(function ($value, $key) { + if ($this->isJsonSelector($key)) { + return $this->compileJsonUpdateColumn($key, $value); + } + + return $this->wrap($key).' = '.$this->parameter($value); + })->implode(', '); + } + + /** + * Prepares a JSON column being updated using the JSONB_SET function. + * + * @param string $key + * @param mixed $value + * @return string + */ + protected function compileJsonUpdateColumn($key, $value) + { + $parts = explode('->', $key); + + $field = $this->wrap(array_shift($parts)); + + $path = '\'{"'.implode('","', $parts).'"}\''; + + return "{$field} = jsonb_set({$field}::jsonb, {$path}, {$this->parameter($value)})"; + } + + /** + * Compile the "from" clause for an update with a join. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string|null + */ + protected function compileUpdateFrom(Builder $query) + { + if (! isset($query->joins)) { + return ''; + } + + // When using Postgres, updates with joins list the joined tables in the from + // clause, which is different than other systems like MySQL. Here, we will + // compile out the tables that are joined and add them to a from clause. + $froms = collect($query->joins)->map(function ($join) { + return $this->wrapTable($join->table); + })->all(); + + if (count($froms) > 0) { + return ' from '.implode(', ', $froms); + } + } + + /** + * Compile the additional where clauses for updates with joins. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileUpdateWheres(Builder $query) + { + $baseWheres = $this->compileWheres($query); + + if (! isset($query->joins)) { + return $baseWheres; + } + + // Once we compile the join constraints, we will either use them as the where + // clause or append them to the existing base where clauses. If we need to + // strip the leading boolean we will do so when using as the only where. + $joinWheres = $this->compileUpdateJoinWheres($query); + + if (trim($baseWheres) == '') { + return 'where '.$this->removeLeadingBoolean($joinWheres); + } + + return $baseWheres.' '.$joinWheres; + } + + /** + * Compile the "join" clause where clauses for an update. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileUpdateJoinWheres(Builder $query) + { + $joinWheres = []; + + // Here we will just loop through all of the join constraints and compile them + // all out then implode them. This should give us "where" like syntax after + // everything has been built and then we will join it to the real wheres. + foreach ($query->joins as $join) { + foreach ($join->wheres as $where) { + $method = "where{$where['type']}"; + + $joinWheres[] = $where['boolean'].' '.$this->$method($query, $where); + } + } + + return implode(' ', $joinWheres); + } + + /** + * Prepare the bindings for an update statement. + * + * @param array $bindings + * @param array $values + * @return array + */ + public function prepareBindingsForUpdate(array $bindings, array $values) + { + $values = collect($values)->map(function ($value, $column) { + return $this->isJsonSelector($column) && ! $this->isExpression($value) + ? json_encode($value) + : $value; + })->all(); + + // Update statements with "joins" in Postgres use an interesting syntax. We need to + // take all of the bindings and put them on the end of this array since they are + // added to the end of the "where" clause statements as typical where clauses. + $bindingsWithoutJoin = Arr::except($bindings, 'join'); + + return array_values( + array_merge($values, $bindings['join'], Arr::flatten($bindingsWithoutJoin)) + ); + } + + /** + * Compile a delete statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileDelete(Builder $query) + { + $table = $this->wrapTable($query->from); + + return isset($query->joins) + ? $this->compileDeleteWithJoins($query, $table) + : parent::compileDelete($query); + } + + /** + * Compile a delete query that uses joins. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @return string + */ + protected function compileDeleteWithJoins($query, $table) + { + $using = ' USING '.collect($query->joins)->map(function ($join) { + return $this->wrapTable($join->table); + })->implode(', '); + + $where = count($query->wheres) > 0 ? ' '.$this->compileUpdateWheres($query) : ''; + + return trim("delete from {$table}{$using}{$where}"); + } + + /** + * Compile a truncate table statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + public function compileTruncate(Builder $query) + { + return ['truncate '.$this->wrapTable($query->from).' restart identity cascade' => []]; + } + + /** + * Wrap the given JSON selector. + * + * @param string $value + * @return string + */ + protected function wrapJsonSelector($value) + { + $path = explode('->', $value); + + $field = $this->wrapSegments(explode('.', array_shift($path))); + + $wrappedPath = $this->wrapJsonPathAttributes($path); + + $attribute = array_pop($wrappedPath); + + if (! empty($wrappedPath)) { + return $field.'->'.implode('->', $wrappedPath).'->>'.$attribute; + } + + return $field.'->>'.$attribute; + } + + /** + * Wrap the attributes of the give JSON path. + * + * @param array $path + * @return array + */ + protected function wrapJsonPathAttributes($path) + { + return array_map(function ($attribute) { + return "'$attribute'"; + }, $path); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php new file mode 100755 index 0000000..43ddec9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php @@ -0,0 +1,312 @@ +', '<=', '>=', '<>', '!=', + 'like', 'not like', 'ilike', + '&', '|', '<<', '>>', + ]; + + /** + * Compile a select query into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileSelect(Builder $query) + { + if ($query->unions && $query->aggregate) { + return $this->compileUnionAggregate($query); + } + + $sql = parent::compileSelect($query); + + if ($query->unions) { + $sql = 'select * from ('.$sql.') '.$this->compileUnions($query); + } + + return $sql; + } + + /** + * Compile a single union statement. + * + * @param array $union + * @return string + */ + protected function compileUnion(array $union) + { + $conjunction = $union['all'] ? ' union all ' : ' union '; + + return $conjunction.'select * from ('.$union['query']->toSql().')'; + } + + /** + * Compile a "where date" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDate(Builder $query, $where) + { + return $this->dateBasedWhere('%Y-%m-%d', $query, $where); + } + + /** + * Compile a "where day" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDay(Builder $query, $where) + { + return $this->dateBasedWhere('%d', $query, $where); + } + + /** + * Compile a "where month" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereMonth(Builder $query, $where) + { + return $this->dateBasedWhere('%m', $query, $where); + } + + /** + * Compile a "where year" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereYear(Builder $query, $where) + { + return $this->dateBasedWhere('%Y', $query, $where); + } + + /** + * Compile a "where time" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereTime(Builder $query, $where) + { + return $this->dateBasedWhere('%H:%M:%S', $query, $where); + } + + /** + * Compile a date based where clause. + * + * @param string $type + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function dateBasedWhere($type, Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return "strftime('{$type}', {$this->wrap($where['column'])}) {$where['operator']} cast({$value} as text)"; + } + + /** + * Compile a "JSON length" statement into SQL. + * + * @param string $column + * @param string $operator + * @param string $value + * @return string + */ + protected function compileJsonLength($column, $operator, $value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($column); + + return 'json_array_length('.$field.$path.') '.$operator.' '.$value; + } + + /** + * Compile an insert statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileInsert(Builder $query, array $values) + { + // Essentially we will force every insert to be treated as a batch insert which + // simply makes creating the SQL easier for us since we can utilize the same + // basic routine regardless of an amount of records given to us to insert. + $table = $this->wrapTable($query->from); + + if (! is_array(reset($values))) { + $values = [$values]; + } + + // If there is only one record being inserted, we will just use the usual query + // grammar insert builder because no special syntax is needed for the single + // row inserts in SQLite. However, if there are multiples, we'll continue. + if (count($values) === 1) { + return empty(reset($values)) + ? "insert into $table default values" + : parent::compileInsert($query, reset($values)); + } + + $names = $this->columnize(array_keys(reset($values))); + + $columns = []; + + // SQLite requires us to build the multi-row insert as a listing of select with + // unions joining them together. So we'll build out this list of columns and + // then join them all together with select unions to complete the queries. + foreach (array_keys(reset($values)) as $column) { + $columns[] = '? as '.$this->wrap($column); + } + + $columns = array_fill(0, count($values), implode(', ', $columns)); + + return "insert into $table ($names) select ".implode(' union all select ', $columns); + } + + /** + * Compile an update statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileUpdate(Builder $query, $values) + { + $table = $this->wrapTable($query->from); + + $columns = collect($values)->map(function ($value, $key) use ($query) { + return $this->wrap(Str::after($key, $query->from.'.')).' = '.$this->parameter($value); + })->implode(', '); + + if (isset($query->joins) || isset($query->limit)) { + $selectSql = parent::compileSelect($query->select("{$query->from}.rowid")); + + return "update {$table} set $columns where {$this->wrap('rowid')} in ({$selectSql})"; + } + + return trim("update {$table} set {$columns} {$this->compileWheres($query)}"); + } + + /** + * Prepare the bindings for an update statement. + * + * @param array $bindings + * @param array $values + * @return array + */ + public function prepareBindingsForUpdate(array $bindings, array $values) + { + $cleanBindings = Arr::except($bindings, ['select', 'join']); + + return array_values( + array_merge($values, $bindings['join'], Arr::flatten($cleanBindings)) + ); + } + + /** + * Compile a delete statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileDelete(Builder $query) + { + if (isset($query->joins) || isset($query->limit)) { + $selectSql = parent::compileSelect($query->select("{$query->from}.rowid")); + + return "delete from {$this->wrapTable($query->from)} where {$this->wrap('rowid')} in ({$selectSql})"; + } + + $wheres = is_array($query->wheres) ? $this->compileWheres($query) : ''; + + return trim("delete from {$this->wrapTable($query->from)} $wheres"); + } + + /** + * Prepare the bindings for a delete statement. + * + * @param array $bindings + * @return array + */ + public function prepareBindingsForDelete(array $bindings) + { + $cleanBindings = Arr::except($bindings, ['select', 'join']); + + return array_values( + array_merge($bindings['join'], Arr::flatten($cleanBindings)) + ); + } + + /** + * Compile a truncate table statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + public function compileTruncate(Builder $query) + { + return [ + 'delete from sqlite_sequence where name = ?' => [$query->from], + 'delete from '.$this->wrapTable($query->from) => [], + ]; + } + + /** + * Wrap the given JSON selector. + * + * @param string $value + * @return string + */ + protected function wrapJsonSelector($value) + { + $parts = explode('->', $value, 2); + + $field = $this->wrap($parts[0]); + + $path = count($parts) > 1 ? ', '.$this->wrapJsonPath($parts[1]) : ''; + + return 'json_extract('.$field.$path.')'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php new file mode 100755 index 0000000..b2aff7b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php @@ -0,0 +1,515 @@ +', '<=', '>=', '!<', '!>', '<>', '!=', + 'like', 'not like', 'ilike', + '&', '&=', '|', '|=', '^', '^=', + ]; + + /** + * Compile a select query into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileSelect(Builder $query) + { + if (! $query->offset) { + return parent::compileSelect($query); + } + + // If an offset is present on the query, we will need to wrap the query in + // a big "ANSI" offset syntax block. This is very nasty compared to the + // other database systems but is necessary for implementing features. + if (is_null($query->columns)) { + $query->columns = ['*']; + } + + return $this->compileAnsiOffset( + $query, $this->compileComponents($query) + ); + } + + /** + * Compile the "select *" portion of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $columns + * @return string|null + */ + protected function compileColumns(Builder $query, $columns) + { + if (! is_null($query->aggregate)) { + return; + } + + $select = $query->distinct ? 'select distinct ' : 'select '; + + // If there is a limit on the query, but not an offset, we will add the top + // clause to the query, which serves as a "limit" type clause within the + // SQL Server system similar to the limit keywords available in MySQL. + if ($query->limit > 0 && $query->offset <= 0) { + $select .= 'top '.$query->limit.' '; + } + + return $select.$this->columnize($columns); + } + + /** + * Compile the "from" portion of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @return string + */ + protected function compileFrom(Builder $query, $table) + { + $from = parent::compileFrom($query, $table); + + if (is_string($query->lock)) { + return $from.' '.$query->lock; + } + + if (! is_null($query->lock)) { + return $from.' with(rowlock,'.($query->lock ? 'updlock,' : '').'holdlock)'; + } + + return $from; + } + + /** + * Compile a "where date" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereDate(Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return 'cast('.$this->wrap($where['column']).' as date) '.$where['operator'].' '.$value; + } + + /** + * Compile a "where time" clause. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $where + * @return string + */ + protected function whereTime(Builder $query, $where) + { + $value = $this->parameter($where['value']); + + return 'cast('.$this->wrap($where['column']).' as time) '.$where['operator'].' '.$value; + } + + /** + * Compile a "JSON contains" statement into SQL. + * + * @param string $column + * @param string $value + * @return string + */ + protected function compileJsonContains($column, $value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($column); + + return $value.' in (select [value] from openjson('.$field.$path.'))'; + } + + /** + * Prepare the binding for a "JSON contains" statement. + * + * @param mixed $binding + * @return string + */ + public function prepareBindingForJsonContains($binding) + { + return is_bool($binding) ? json_encode($binding) : $binding; + } + + /** + * Compile a "JSON length" statement into SQL. + * + * @param string $column + * @param string $operator + * @param string $value + * @return string + */ + protected function compileJsonLength($column, $operator, $value) + { + [$field, $path] = $this->wrapJsonFieldAndPath($column); + + return '(select count(*) from openjson('.$field.$path.')) '.$operator.' '.$value; + } + + /** + * Create a full ANSI offset clause for the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $components + * @return string + */ + protected function compileAnsiOffset(Builder $query, $components) + { + // An ORDER BY clause is required to make this offset query work, so if one does + // not exist we'll just create a dummy clause to trick the database and so it + // does not complain about the queries for not having an "order by" clause. + if (empty($components['orders'])) { + $components['orders'] = 'order by (select 0)'; + } + + // We need to add the row number to the query so we can compare it to the offset + // and limit values given for the statements. So we will add an expression to + // the "select" that will give back the row numbers on each of the records. + $components['columns'] .= $this->compileOver($components['orders']); + + unset($components['orders']); + + // Next we need to calculate the constraints that should be placed on the query + // to get the right offset and limit from our query but if there is no limit + // set we will just handle the offset only since that is all that matters. + $sql = $this->concatenate($components); + + return $this->compileTableExpression($sql, $query); + } + + /** + * Compile the over statement for a table expression. + * + * @param string $orderings + * @return string + */ + protected function compileOver($orderings) + { + return ", row_number() over ({$orderings}) as row_num"; + } + + /** + * Compile a common table expression for a query. + * + * @param string $sql + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileTableExpression($sql, $query) + { + $constraint = $this->compileRowConstraint($query); + + return "select * from ({$sql}) as temp_table where row_num {$constraint} order by row_num"; + } + + /** + * Compile the limit / offset row constraint for a query. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + protected function compileRowConstraint($query) + { + $start = $query->offset + 1; + + if ($query->limit > 0) { + $finish = $query->offset + $query->limit; + + return "between {$start} and {$finish}"; + } + + return ">= {$start}"; + } + + /** + * Compile the random statement into SQL. + * + * @param string $seed + * @return string + */ + public function compileRandom($seed) + { + return 'NEWID()'; + } + + /** + * Compile the "limit" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param int $limit + * @return string + */ + protected function compileLimit(Builder $query, $limit) + { + return ''; + } + + /** + * Compile the "offset" portions of the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param int $offset + * @return string + */ + protected function compileOffset(Builder $query, $offset) + { + return ''; + } + + /** + * Compile the lock into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param bool|string $value + * @return string + */ + protected function compileLock(Builder $query, $value) + { + return ''; + } + + /** + * Compile an exists statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileExists(Builder $query) + { + $existsQuery = clone $query; + + $existsQuery->columns = []; + + return $this->compileSelect($existsQuery->selectRaw('1 [exists]')->limit(1)); + } + + /** + * Compile a delete statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return string + */ + public function compileDelete(Builder $query) + { + $table = $this->wrapTable($query->from); + + $where = is_array($query->wheres) ? $this->compileWheres($query) : ''; + + return isset($query->joins) + ? $this->compileDeleteWithJoins($query, $table, $where) + : trim("delete from {$table} {$where}"); + } + + /** + * Compile a delete statement with joins into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $table + * @param string $where + * @return string + */ + protected function compileDeleteWithJoins(Builder $query, $table, $where) + { + $joins = ' '.$this->compileJoins($query, $query->joins); + + $alias = stripos($table, ' as ') !== false + ? explode(' as ', $table)[1] : $table; + + return trim("delete {$alias} from {$table}{$joins} {$where}"); + } + + /** + * Compile a truncate table statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @return array + */ + public function compileTruncate(Builder $query) + { + return ['truncate table '.$this->wrapTable($query->from) => []]; + } + + /** + * Compile an update statement into SQL. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $values + * @return string + */ + public function compileUpdate(Builder $query, $values) + { + [$table, $alias] = $this->parseUpdateTable($query->from); + + // Each one of the columns in the update statements needs to be wrapped in the + // keyword identifiers, also a place-holder needs to be created for each of + // the values in the list of bindings so we can make the sets statements. + $columns = collect($values)->map(function ($value, $key) { + return $this->wrap($key).' = '.$this->parameter($value); + })->implode(', '); + + // If the query has any "join" clauses, we will setup the joins on the builder + // and compile them so we can attach them to this update, as update queries + // can get join statements to attach to other tables when they're needed. + $joins = ''; + + if (isset($query->joins)) { + $joins = ' '.$this->compileJoins($query, $query->joins); + } + + // Of course, update queries may also be constrained by where clauses so we'll + // need to compile the where clauses and attach it to the query so only the + // intended records are updated by the SQL statements we generate to run. + $where = $this->compileWheres($query); + + if (! empty($joins)) { + return trim("update {$alias} set {$columns} from {$table}{$joins} {$where}"); + } + + return trim("update {$table}{$joins} set $columns $where"); + } + + /** + * Get the table and alias for the given table. + * + * @param string $table + * @return array + */ + protected function parseUpdateTable($table) + { + $table = $alias = $this->wrapTable($table); + + if (stripos($table, '] as [') !== false) { + $alias = '['.explode('] as [', $table)[1]; + } + + return [$table, $alias]; + } + + /** + * Prepare the bindings for an update statement. + * + * @param array $bindings + * @param array $values + * @return array + */ + public function prepareBindingsForUpdate(array $bindings, array $values) + { + // Update statements with joins in SQL Servers utilize an unique syntax. We need to + // take all of the bindings and put them on the end of this array since they are + // added to the end of the "where" clause statements as typical where clauses. + $bindingsWithoutJoin = Arr::except($bindings, 'join'); + + return array_values( + array_merge($values, $bindings['join'], Arr::flatten($bindingsWithoutJoin)) + ); + } + + /** + * Determine if the grammar supports savepoints. + * + * @return bool + */ + public function supportsSavepoints() + { + return true; + } + + /** + * Compile the SQL statement to define a savepoint. + * + * @param string $name + * @return string + */ + public function compileSavepoint($name) + { + return 'SAVE TRANSACTION '.$name; + } + + /** + * Compile the SQL statement to execute a savepoint rollback. + * + * @param string $name + * @return string + */ + public function compileSavepointRollBack($name) + { + return 'ROLLBACK TRANSACTION '.$name; + } + + /** + * Get the format for database stored dates. + * + * @return string + */ + public function getDateFormat() + { + return 'Y-m-d H:i:s.v'; + } + + /** + * Wrap a single string in keyword identifiers. + * + * @param string $value + * @return string + */ + protected function wrapValue($value) + { + return $value === '*' ? $value : '['.str_replace(']', ']]', $value).']'; + } + + /** + * Wrap the given JSON selector. + * + * @param string $value + * @return string + */ + protected function wrapJsonSelector($value) + { + $parts = explode('->', $value, 2); + + $field = $this->wrapSegments(explode('.', array_shift($parts))); + + return 'json_value('.$field.', '.$this->wrapJsonPath($parts[0]).')'; + } + + /** + * Wrap a table in keyword identifiers. + * + * @param \Illuminate\Database\Query\Expression|string $table + * @return string + */ + public function wrapTable($table) + { + if (! $this->isExpression($table)) { + return $this->wrapTableValuedFunction(parent::wrapTable($table)); + } + + return $this->getValue($table); + } + + /** + * Wrap a table in keyword identifiers. + * + * @param string $table + * @return string + */ + protected function wrapTableValuedFunction($table) + { + if (preg_match('/^(.+?)(\(.*?\))]$/', $table, $matches) === 1) { + $table = $matches[1].']'.$matches[2]; + } + + return $table; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/JoinClause.php b/vendor/laravel/framework/src/Illuminate/Database/Query/JoinClause.php new file mode 100755 index 0000000..4b32df2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/JoinClause.php @@ -0,0 +1,110 @@ +type = $type; + $this->table = $table; + $this->parentQuery = $parentQuery; + + parent::__construct( + $parentQuery->getConnection(), $parentQuery->getGrammar(), $parentQuery->getProcessor() + ); + } + + /** + * Add an "on" clause to the join. + * + * On clauses can be chained, e.g. + * + * $join->on('contacts.user_id', '=', 'users.id') + * ->on('contacts.info_id', '=', 'info.id') + * + * will produce the following SQL: + * + * on `contacts`.`user_id` = `users`.`id` and `contacts`.`info_id` = `info`.`id` + * + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @param string $boolean + * @return $this + * + * @throws \InvalidArgumentException + */ + public function on($first, $operator = null, $second = null, $boolean = 'and') + { + if ($first instanceof Closure) { + return $this->whereNested($first, $boolean); + } + + return $this->whereColumn($first, $operator, $second, $boolean); + } + + /** + * Add an "or on" clause to the join. + * + * @param \Closure|string $first + * @param string|null $operator + * @param string|null $second + * @return \Illuminate\Database\Query\JoinClause + */ + public function orOn($first, $operator = null, $second = null) + { + return $this->on($first, $operator, $second, 'or'); + } + + /** + * Get a new instance of the join clause builder. + * + * @return \Illuminate\Database\Query\JoinClause + */ + public function newQuery() + { + return new static($this->parentQuery, $this->type, $this->table); + } + + /** + * Create a new query instance for sub-query. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function forSubQuery() + { + return $this->parentQuery->newQuery(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/JsonExpression.php b/vendor/laravel/framework/src/Illuminate/Database/Query/JsonExpression.php new file mode 100644 index 0000000..3d68ee6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/JsonExpression.php @@ -0,0 +1,51 @@ +getJsonBindingParameter($value) + ); + } + + /** + * Translate the given value into the appropriate JSON binding parameter. + * + * @param mixed $value + * @return string + * + * @throws \InvalidArgumentException + */ + protected function getJsonBindingParameter($value) + { + if ($value instanceof Expression) { + return $value->getValue(); + } + + switch ($type = gettype($value)) { + case 'boolean': + return $value ? 'true' : 'false'; + case 'NULL': + case 'integer': + case 'double': + case 'string': + return '?'; + case 'object': + case 'array': + return '?'; + } + + throw new InvalidArgumentException("JSON value is of illegal type: {$type}"); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/MySqlProcessor.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/MySqlProcessor.php new file mode 100644 index 0000000..ce91838 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/MySqlProcessor.php @@ -0,0 +1,19 @@ +column_name; + }, $results); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/PostgresProcessor.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/PostgresProcessor.php new file mode 100755 index 0000000..90abf24 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/PostgresProcessor.php @@ -0,0 +1,41 @@ +getConnection()->selectFromWriteConnection($sql, $values)[0]; + + $sequence = $sequence ?: 'id'; + + $id = is_object($result) ? $result->{$sequence} : $result[$sequence]; + + return is_numeric($id) ? (int) $id : $id; + } + + /** + * Process the results of a column listing query. + * + * @param array $results + * @return array + */ + public function processColumnListing($results) + { + return array_map(function ($result) { + return ((object) $result)->column_name; + }, $results); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php new file mode 100755 index 0000000..f78429f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php @@ -0,0 +1,49 @@ +getConnection()->insert($sql, $values); + + $id = $query->getConnection()->getPdo()->lastInsertId($sequence); + + return is_numeric($id) ? (int) $id : $id; + } + + /** + * Process the results of a column listing query. + * + * @param array $results + * @return array + */ + public function processColumnListing($results) + { + return $results; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php new file mode 100644 index 0000000..65da1df --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SQLiteProcessor.php @@ -0,0 +1,19 @@ +name; + }, $results); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php new file mode 100755 index 0000000..4912d9d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php @@ -0,0 +1,70 @@ +getConnection(); + + $connection->insert($sql, $values); + + if ($connection->getConfig('odbc') === true) { + $id = $this->processInsertGetIdForOdbc($connection); + } else { + $id = $connection->getPdo()->lastInsertId(); + } + + return is_numeric($id) ? (int) $id : $id; + } + + /** + * Process an "insert get ID" query for ODBC. + * + * @param \Illuminate\Database\Connection $connection + * @return int + * + * @throws \Exception + */ + protected function processInsertGetIdForOdbc(Connection $connection) + { + $result = $connection->selectFromWriteConnection( + 'SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS int) AS insertid' + ); + + if (! $result) { + throw new Exception('Unable to retrieve lastInsertID for ODBC.'); + } + + $row = $result[0]; + + return is_object($row) ? $row->insertid : $row['insertid']; + } + + /** + * Process the results of a column listing query. + * + * @param array $results + * @return array + */ + public function processColumnListing($results) + { + return array_map(function ($result) { + return ((object) $result)->name; + }, $results); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/QueryException.php b/vendor/laravel/framework/src/Illuminate/Database/QueryException.php new file mode 100644 index 0000000..9a3687d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/QueryException.php @@ -0,0 +1,78 @@ +sql = $sql; + $this->bindings = $bindings; + $this->code = $previous->getCode(); + $this->message = $this->formatMessage($sql, $bindings, $previous); + + if ($previous instanceof PDOException) { + $this->errorInfo = $previous->errorInfo; + } + } + + /** + * Format the SQL error message. + * + * @param string $sql + * @param array $bindings + * @param \Exception $previous + * @return string + */ + protected function formatMessage($sql, $bindings, $previous) + { + return $previous->getMessage().' (SQL: '.Str::replaceArray('?', $bindings, $sql).')'; + } + + /** + * Get the SQL for the query. + * + * @return string + */ + public function getSql() + { + return $this->sql; + } + + /** + * Get the bindings for the query. + * + * @return array + */ + public function getBindings() + { + return $this->bindings; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/README.md b/vendor/laravel/framework/src/Illuminate/Database/README.md new file mode 100755 index 0000000..b3014b0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/README.md @@ -0,0 +1,69 @@ +## Illuminate Database + +The Illuminate Database component is a full database toolkit for PHP, providing an expressive query builder, ActiveRecord style ORM, and schema builder. It currently supports MySQL, Postgres, SQL Server, and SQLite. It also serves as the database layer of the Laravel PHP framework. + +### Usage Instructions + +First, create a new "Capsule" manager instance. Capsule aims to make configuring the library for usage outside of the Laravel framework as easy as possible. + +```PHP +use Illuminate\Database\Capsule\Manager as Capsule; + +$capsule = new Capsule; + +$capsule->addConnection([ + 'driver' => 'mysql', + 'host' => 'localhost', + 'database' => 'database', + 'username' => 'root', + 'password' => 'password', + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', +]); + +// Set the event dispatcher used by Eloquent models... (optional) +use Illuminate\Events\Dispatcher; +use Illuminate\Container\Container; +$capsule->setEventDispatcher(new Dispatcher(new Container)); + +// Make this Capsule instance available globally via static methods... (optional) +$capsule->setAsGlobal(); + +// Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher()) +$capsule->bootEloquent(); +``` + +> `composer require "illuminate/events"` required when you need to use observers with Eloquent. + +Once the Capsule instance has been registered. You may use it like so: + +**Using The Query Builder** + +```PHP +$users = Capsule::table('users')->where('votes', '>', 100)->get(); +``` +Other core methods may be accessed directly from the Capsule in the same manner as from the DB facade: +```PHP +$results = Capsule::select('select * from users where id = ?', array(1)); +``` + +**Using The Schema Builder** + +```PHP +Capsule::schema()->create('users', function ($table) { + $table->increments('id'); + $table->string('email')->unique(); + $table->timestamps(); +}); +``` + +**Using The Eloquent ORM** + +```PHP +class User extends Illuminate\Database\Eloquent\Model {} + +$users = User::where('votes', '>', 1)->get(); +``` + +For further documentation on using the various database facilities this library provides, consult the [Laravel framework documentation](https://laravel.com/docs). diff --git a/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php b/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php new file mode 100755 index 0000000..21f890d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/SQLiteConnection.php @@ -0,0 +1,100 @@ +getForeignKeyConstraintsConfigurationValue(); + + if ($enableForeignKeyConstraints === null) { + return; + } + + $enableForeignKeyConstraints + ? $this->getSchemaBuilder()->enableForeignKeyConstraints() + : $this->getSchemaBuilder()->disableForeignKeyConstraints(); + } + + /** + * Get the default query grammar instance. + * + * @return \Illuminate\Database\Query\Grammars\SQLiteGrammar + */ + protected function getDefaultQueryGrammar() + { + return $this->withTablePrefix(new QueryGrammar); + } + + /** + * Get a schema builder instance for the connection. + * + * @return \Illuminate\Database\Schema\SQLiteBuilder + */ + public function getSchemaBuilder() + { + if (is_null($this->schemaGrammar)) { + $this->useDefaultSchemaGrammar(); + } + + return new SQLiteBuilder($this); + } + + /** + * Get the default schema grammar instance. + * + * @return \Illuminate\Database\Schema\Grammars\SQLiteGrammar + */ + protected function getDefaultSchemaGrammar() + { + return $this->withTablePrefix(new SchemaGrammar); + } + + /** + * Get the default post processor instance. + * + * @return \Illuminate\Database\Query\Processors\SQLiteProcessor + */ + protected function getDefaultPostProcessor() + { + return new SQLiteProcessor; + } + + /** + * Get the Doctrine DBAL driver. + * + * @return \Doctrine\DBAL\Driver\PDOSqlite\Driver + */ + protected function getDoctrineDriver() + { + return new DoctrineDriver; + } + + /** + * Get the database connection foreign key constraints configuration option. + * + * @return bool|null + */ + protected function getForeignKeyConstraintsConfigurationValue() + { + return $this->getConfig('foreign_key_constraints'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php new file mode 100755 index 0000000..089fcd2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php @@ -0,0 +1,1372 @@ +table = $table; + $this->prefix = $prefix; + + if (! is_null($callback)) { + $callback($this); + } + } + + /** + * Execute the blueprint against the database. + * + * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @return void + */ + public function build(Connection $connection, Grammar $grammar) + { + foreach ($this->toSql($connection, $grammar) as $statement) { + $connection->statement($statement); + } + } + + /** + * Get the raw SQL statements for the blueprint. + * + * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @return array + */ + public function toSql(Connection $connection, Grammar $grammar) + { + $this->addImpliedCommands($grammar); + + $statements = []; + + // Each type of command has a corresponding compiler function on the schema + // grammar which is used to build the necessary SQL statements to build + // the blueprint element, so we'll just call that compilers function. + $this->ensureCommandsAreValid($connection); + + foreach ($this->commands as $command) { + $method = 'compile'.ucfirst($command->name); + + if (method_exists($grammar, $method)) { + if (! is_null($sql = $grammar->$method($this, $command, $connection))) { + $statements = array_merge($statements, (array) $sql); + } + } + } + + return $statements; + } + + /** + * Ensure the commands on the blueprint are valid for the connection type. + * + * @param \Illuminate\Database\Connection $connection + * @return void + * + * @throws \BadMethodCallException + */ + protected function ensureCommandsAreValid(Connection $connection) + { + if ($connection instanceof SQLiteConnection) { + if ($this->commandsNamed(['dropColumn', 'renameColumn'])->count() > 1) { + throw new BadMethodCallException( + "SQLite doesn't support multiple calls to dropColumn / renameColumn in a single modification." + ); + } + + if ($this->commandsNamed(['dropForeign'])->count() > 0) { + throw new BadMethodCallException( + "SQLite doesn't support dropping foreign keys (you would need to re-create the table)." + ); + } + } + } + + /** + * Get all of the commands matching the given names. + * + * @param array $names + * @return \Illuminate\Support\Collection + */ + protected function commandsNamed(array $names) + { + return collect($this->commands)->filter(function ($command) use ($names) { + return in_array($command->name, $names); + }); + } + + /** + * Add the commands that are implied by the blueprint's state. + * + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @return void + */ + protected function addImpliedCommands(Grammar $grammar) + { + if (count($this->getAddedColumns()) > 0 && ! $this->creating()) { + array_unshift($this->commands, $this->createCommand('add')); + } + + if (count($this->getChangedColumns()) > 0 && ! $this->creating()) { + array_unshift($this->commands, $this->createCommand('change')); + } + + $this->addFluentIndexes(); + + $this->addFluentCommands($grammar); + } + + /** + * Add the index commands fluently specified on columns. + * + * @return void + */ + protected function addFluentIndexes() + { + foreach ($this->columns as $column) { + foreach (['primary', 'unique', 'index', 'spatialIndex'] as $index) { + // If the index has been specified on the given column, but is simply equal + // to "true" (boolean), no name has been specified for this index so the + // index method can be called without a name and it will generate one. + if ($column->{$index} === true) { + $this->{$index}($column->name); + + continue 2; + } + + // If the index has been specified on the given column, and it has a string + // value, we'll go ahead and call the index method and pass the name for + // the index since the developer specified the explicit name for this. + elseif (isset($column->{$index})) { + $this->{$index}($column->name, $column->{$index}); + + continue 2; + } + } + } + } + + /** + * Add the fluent commands specified on any columns. + * + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @return void + */ + public function addFluentCommands(Grammar $grammar) + { + foreach ($this->columns as $column) { + foreach ($grammar->getFluentCommands() as $commandName) { + $attributeName = lcfirst($commandName); + + if (! isset($column->{$attributeName})) { + continue; + } + + $value = $column->{$attributeName}; + + $this->addCommand( + $commandName, compact('value', 'column') + ); + } + } + } + + /** + * Determine if the blueprint has a create command. + * + * @return bool + */ + protected function creating() + { + return collect($this->commands)->contains(function ($command) { + return $command->name === 'create'; + }); + } + + /** + * Indicate that the table needs to be created. + * + * @return \Illuminate\Support\Fluent + */ + public function create() + { + return $this->addCommand('create'); + } + + /** + * Indicate that the table needs to be temporary. + * + * @return void + */ + public function temporary() + { + $this->temporary = true; + } + + /** + * Indicate that the table should be dropped. + * + * @return \Illuminate\Support\Fluent + */ + public function drop() + { + return $this->addCommand('drop'); + } + + /** + * Indicate that the table should be dropped if it exists. + * + * @return \Illuminate\Support\Fluent + */ + public function dropIfExists() + { + return $this->addCommand('dropIfExists'); + } + + /** + * Indicate that the given columns should be dropped. + * + * @param array|mixed $columns + * @return \Illuminate\Support\Fluent + */ + public function dropColumn($columns) + { + $columns = is_array($columns) ? $columns : func_get_args(); + + return $this->addCommand('dropColumn', compact('columns')); + } + + /** + * Indicate that the given columns should be renamed. + * + * @param string $from + * @param string $to + * @return \Illuminate\Support\Fluent + */ + public function renameColumn($from, $to) + { + return $this->addCommand('renameColumn', compact('from', 'to')); + } + + /** + * Indicate that the given primary key should be dropped. + * + * @param string|array $index + * @return \Illuminate\Support\Fluent + */ + public function dropPrimary($index = null) + { + return $this->dropIndexCommand('dropPrimary', 'primary', $index); + } + + /** + * Indicate that the given unique key should be dropped. + * + * @param string|array $index + * @return \Illuminate\Support\Fluent + */ + public function dropUnique($index) + { + return $this->dropIndexCommand('dropUnique', 'unique', $index); + } + + /** + * Indicate that the given index should be dropped. + * + * @param string|array $index + * @return \Illuminate\Support\Fluent + */ + public function dropIndex($index) + { + return $this->dropIndexCommand('dropIndex', 'index', $index); + } + + /** + * Indicate that the given spatial index should be dropped. + * + * @param string|array $index + * @return \Illuminate\Support\Fluent + */ + public function dropSpatialIndex($index) + { + return $this->dropIndexCommand('dropSpatialIndex', 'spatialIndex', $index); + } + + /** + * Indicate that the given foreign key should be dropped. + * + * @param string|array $index + * @return \Illuminate\Support\Fluent + */ + public function dropForeign($index) + { + return $this->dropIndexCommand('dropForeign', 'foreign', $index); + } + + /** + * Indicate that the given indexes should be renamed. + * + * @param string $from + * @param string $to + * @return \Illuminate\Support\Fluent + */ + public function renameIndex($from, $to) + { + return $this->addCommand('renameIndex', compact('from', 'to')); + } + + /** + * Indicate that the timestamp columns should be dropped. + * + * @return void + */ + public function dropTimestamps() + { + $this->dropColumn('created_at', 'updated_at'); + } + + /** + * Indicate that the timestamp columns should be dropped. + * + * @return void + */ + public function dropTimestampsTz() + { + $this->dropTimestamps(); + } + + /** + * Indicate that the soft delete column should be dropped. + * + * @param string $column + * @return void + */ + public function dropSoftDeletes($column = 'deleted_at') + { + $this->dropColumn($column); + } + + /** + * Indicate that the soft delete column should be dropped. + * + * @param string $column + * @return void + */ + public function dropSoftDeletesTz($column = 'deleted_at') + { + $this->dropSoftDeletes($column); + } + + /** + * Indicate that the remember token column should be dropped. + * + * @return void + */ + public function dropRememberToken() + { + $this->dropColumn('remember_token'); + } + + /** + * Indicate that the polymorphic columns should be dropped. + * + * @param string $name + * @param string|null $indexName + * @return void + */ + public function dropMorphs($name, $indexName = null) + { + $this->dropIndex($indexName ?: $this->createIndexName('index', ["{$name}_type", "{$name}_id"])); + + $this->dropColumn("{$name}_type", "{$name}_id"); + } + + /** + * Rename the table to a given name. + * + * @param string $to + * @return \Illuminate\Support\Fluent + */ + public function rename($to) + { + return $this->addCommand('rename', compact('to')); + } + + /** + * Specify the primary key(s) for the table. + * + * @param string|array $columns + * @param string $name + * @param string|null $algorithm + * @return \Illuminate\Support\Fluent + */ + public function primary($columns, $name = null, $algorithm = null) + { + return $this->indexCommand('primary', $columns, $name, $algorithm); + } + + /** + * Specify a unique index for the table. + * + * @param string|array $columns + * @param string $name + * @param string|null $algorithm + * @return \Illuminate\Support\Fluent + */ + public function unique($columns, $name = null, $algorithm = null) + { + return $this->indexCommand('unique', $columns, $name, $algorithm); + } + + /** + * Specify an index for the table. + * + * @param string|array $columns + * @param string $name + * @param string|null $algorithm + * @return \Illuminate\Support\Fluent + */ + public function index($columns, $name = null, $algorithm = null) + { + return $this->indexCommand('index', $columns, $name, $algorithm); + } + + /** + * Specify a spatial index for the table. + * + * @param string|array $columns + * @param string $name + * @return \Illuminate\Support\Fluent + */ + public function spatialIndex($columns, $name = null) + { + return $this->indexCommand('spatialIndex', $columns, $name); + } + + /** + * Specify a foreign key for the table. + * + * @param string|array $columns + * @param string $name + * @return \Illuminate\Support\Fluent + */ + public function foreign($columns, $name = null) + { + return $this->indexCommand('foreign', $columns, $name); + } + + /** + * Create a new auto-incrementing integer (4-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function increments($column) + { + return $this->unsignedInteger($column, true); + } + + /** + * Create a new auto-incrementing tiny integer (1-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function tinyIncrements($column) + { + return $this->unsignedTinyInteger($column, true); + } + + /** + * Create a new auto-incrementing small integer (2-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function smallIncrements($column) + { + return $this->unsignedSmallInteger($column, true); + } + + /** + * Create a new auto-incrementing medium integer (3-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function mediumIncrements($column) + { + return $this->unsignedMediumInteger($column, true); + } + + /** + * Create a new auto-incrementing big integer (8-byte) column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function bigIncrements($column) + { + return $this->unsignedBigInteger($column, true); + } + + /** + * Create a new char column on the table. + * + * @param string $column + * @param int $length + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function char($column, $length = null) + { + $length = $length ?: Builder::$defaultStringLength; + + return $this->addColumn('char', $column, compact('length')); + } + + /** + * Create a new string column on the table. + * + * @param string $column + * @param int $length + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function string($column, $length = null) + { + $length = $length ?: Builder::$defaultStringLength; + + return $this->addColumn('string', $column, compact('length')); + } + + /** + * Create a new text column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function text($column) + { + return $this->addColumn('text', $column); + } + + /** + * Create a new medium text column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function mediumText($column) + { + return $this->addColumn('mediumText', $column); + } + + /** + * Create a new long text column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function longText($column) + { + return $this->addColumn('longText', $column); + } + + /** + * Create a new integer (4-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @param bool $unsigned + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function integer($column, $autoIncrement = false, $unsigned = false) + { + return $this->addColumn('integer', $column, compact('autoIncrement', 'unsigned')); + } + + /** + * Create a new tiny integer (1-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @param bool $unsigned + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function tinyInteger($column, $autoIncrement = false, $unsigned = false) + { + return $this->addColumn('tinyInteger', $column, compact('autoIncrement', 'unsigned')); + } + + /** + * Create a new small integer (2-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @param bool $unsigned + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function smallInteger($column, $autoIncrement = false, $unsigned = false) + { + return $this->addColumn('smallInteger', $column, compact('autoIncrement', 'unsigned')); + } + + /** + * Create a new medium integer (3-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @param bool $unsigned + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function mediumInteger($column, $autoIncrement = false, $unsigned = false) + { + return $this->addColumn('mediumInteger', $column, compact('autoIncrement', 'unsigned')); + } + + /** + * Create a new big integer (8-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @param bool $unsigned + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function bigInteger($column, $autoIncrement = false, $unsigned = false) + { + return $this->addColumn('bigInteger', $column, compact('autoIncrement', 'unsigned')); + } + + /** + * Create a new unsigned integer (4-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function unsignedInteger($column, $autoIncrement = false) + { + return $this->integer($column, $autoIncrement, true); + } + + /** + * Create a new unsigned tiny integer (1-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function unsignedTinyInteger($column, $autoIncrement = false) + { + return $this->tinyInteger($column, $autoIncrement, true); + } + + /** + * Create a new unsigned small integer (2-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function unsignedSmallInteger($column, $autoIncrement = false) + { + return $this->smallInteger($column, $autoIncrement, true); + } + + /** + * Create a new unsigned medium integer (3-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function unsignedMediumInteger($column, $autoIncrement = false) + { + return $this->mediumInteger($column, $autoIncrement, true); + } + + /** + * Create a new unsigned big integer (8-byte) column on the table. + * + * @param string $column + * @param bool $autoIncrement + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function unsignedBigInteger($column, $autoIncrement = false) + { + return $this->bigInteger($column, $autoIncrement, true); + } + + /** + * Create a new float column on the table. + * + * @param string $column + * @param int $total + * @param int $places + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function float($column, $total = 8, $places = 2) + { + return $this->addColumn('float', $column, compact('total', 'places')); + } + + /** + * Create a new double column on the table. + * + * @param string $column + * @param int|null $total + * @param int|null $places + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function double($column, $total = null, $places = null) + { + return $this->addColumn('double', $column, compact('total', 'places')); + } + + /** + * Create a new decimal column on the table. + * + * @param string $column + * @param int $total + * @param int $places + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function decimal($column, $total = 8, $places = 2) + { + return $this->addColumn('decimal', $column, compact('total', 'places')); + } + + /** + * Create a new unsigned decimal column on the table. + * + * @param string $column + * @param int $total + * @param int $places + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function unsignedDecimal($column, $total = 8, $places = 2) + { + return $this->addColumn('decimal', $column, [ + 'total' => $total, 'places' => $places, 'unsigned' => true, + ]); + } + + /** + * Create a new boolean column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function boolean($column) + { + return $this->addColumn('boolean', $column); + } + + /** + * Create a new enum column on the table. + * + * @param string $column + * @param array $allowed + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function enum($column, array $allowed) + { + return $this->addColumn('enum', $column, compact('allowed')); + } + + /** + * Create a new json column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function json($column) + { + return $this->addColumn('json', $column); + } + + /** + * Create a new jsonb column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function jsonb($column) + { + return $this->addColumn('jsonb', $column); + } + + /** + * Create a new date column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function date($column) + { + return $this->addColumn('date', $column); + } + + /** + * Create a new date-time column on the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function dateTime($column, $precision = 0) + { + return $this->addColumn('dateTime', $column, compact('precision')); + } + + /** + * Create a new date-time column (with time zone) on the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function dateTimeTz($column, $precision = 0) + { + return $this->addColumn('dateTimeTz', $column, compact('precision')); + } + + /** + * Create a new time column on the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function time($column, $precision = 0) + { + return $this->addColumn('time', $column, compact('precision')); + } + + /** + * Create a new time column (with time zone) on the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function timeTz($column, $precision = 0) + { + return $this->addColumn('timeTz', $column, compact('precision')); + } + + /** + * Create a new timestamp column on the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function timestamp($column, $precision = 0) + { + return $this->addColumn('timestamp', $column, compact('precision')); + } + + /** + * Create a new timestamp (with time zone) column on the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function timestampTz($column, $precision = 0) + { + return $this->addColumn('timestampTz', $column, compact('precision')); + } + + /** + * Add nullable creation and update timestamps to the table. + * + * @param int $precision + * @return void + */ + public function timestamps($precision = 0) + { + $this->timestamp('created_at', $precision)->nullable(); + + $this->timestamp('updated_at', $precision)->nullable(); + } + + /** + * Add nullable creation and update timestamps to the table. + * + * Alias for self::timestamps(). + * + * @param int $precision + * @return void + */ + public function nullableTimestamps($precision = 0) + { + $this->timestamps($precision); + } + + /** + * Add creation and update timestampTz columns to the table. + * + * @param int $precision + * @return void + */ + public function timestampsTz($precision = 0) + { + $this->timestampTz('created_at', $precision)->nullable(); + + $this->timestampTz('updated_at', $precision)->nullable(); + } + + /** + * Add a "deleted at" timestamp for the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function softDeletes($column = 'deleted_at', $precision = 0) + { + return $this->timestamp($column, $precision)->nullable(); + } + + /** + * Add a "deleted at" timestampTz for the table. + * + * @param string $column + * @param int $precision + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function softDeletesTz($column = 'deleted_at', $precision = 0) + { + return $this->timestampTz($column, $precision)->nullable(); + } + + /** + * Create a new year column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function year($column) + { + return $this->addColumn('year', $column); + } + + /** + * Create a new binary column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function binary($column) + { + return $this->addColumn('binary', $column); + } + + /** + * Create a new uuid column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function uuid($column) + { + return $this->addColumn('uuid', $column); + } + + /** + * Create a new IP address column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function ipAddress($column) + { + return $this->addColumn('ipAddress', $column); + } + + /** + * Create a new MAC address column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function macAddress($column) + { + return $this->addColumn('macAddress', $column); + } + + /** + * Create a new geometry column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function geometry($column) + { + return $this->addColumn('geometry', $column); + } + + /** + * Create a new point column on the table. + * + * @param string $column + * @param int|null $srid + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function point($column, $srid = null) + { + return $this->addColumn('point', $column, compact('srid')); + } + + /** + * Create a new linestring column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function lineString($column) + { + return $this->addColumn('linestring', $column); + } + + /** + * Create a new polygon column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function polygon($column) + { + return $this->addColumn('polygon', $column); + } + + /** + * Create a new geometrycollection column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function geometryCollection($column) + { + return $this->addColumn('geometrycollection', $column); + } + + /** + * Create a new multipoint column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function multiPoint($column) + { + return $this->addColumn('multipoint', $column); + } + + /** + * Create a new multilinestring column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function multiLineString($column) + { + return $this->addColumn('multilinestring', $column); + } + + /** + * Create a new multipolygon column on the table. + * + * @param string $column + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function multiPolygon($column) + { + return $this->addColumn('multipolygon', $column); + } + + /** + * Add the proper columns for a polymorphic table. + * + * @param string $name + * @param string|null $indexName + * @return void + */ + public function morphs($name, $indexName = null) + { + $this->string("{$name}_type"); + + $this->unsignedBigInteger("{$name}_id"); + + $this->index(["{$name}_type", "{$name}_id"], $indexName); + } + + /** + * Add nullable columns for a polymorphic table. + * + * @param string $name + * @param string|null $indexName + * @return void + */ + public function nullableMorphs($name, $indexName = null) + { + $this->string("{$name}_type")->nullable(); + + $this->unsignedBigInteger("{$name}_id")->nullable(); + + $this->index(["{$name}_type", "{$name}_id"], $indexName); + } + + /** + * Adds the `remember_token` column to the table. + * + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function rememberToken() + { + return $this->string('remember_token', 100)->nullable(); + } + + /** + * Add a new index command to the blueprint. + * + * @param string $type + * @param string|array $columns + * @param string $index + * @param string|null $algorithm + * @return \Illuminate\Support\Fluent + */ + protected function indexCommand($type, $columns, $index, $algorithm = null) + { + $columns = (array) $columns; + + // If no name was specified for this index, we will create one using a basic + // convention of the table name, followed by the columns, followed by an + // index type, such as primary or index, which makes the index unique. + $index = $index ?: $this->createIndexName($type, $columns); + + return $this->addCommand( + $type, compact('index', 'columns', 'algorithm') + ); + } + + /** + * Create a new drop index command on the blueprint. + * + * @param string $command + * @param string $type + * @param string|array $index + * @return \Illuminate\Support\Fluent + */ + protected function dropIndexCommand($command, $type, $index) + { + $columns = []; + + // If the given "index" is actually an array of columns, the developer means + // to drop an index merely by specifying the columns involved without the + // conventional name, so we will build the index name from the columns. + if (is_array($index)) { + $index = $this->createIndexName($type, $columns = $index); + } + + return $this->indexCommand($command, $columns, $index); + } + + /** + * Create a default index name for the table. + * + * @param string $type + * @param array $columns + * @return string + */ + protected function createIndexName($type, array $columns) + { + $index = strtolower($this->prefix.$this->table.'_'.implode('_', $columns).'_'.$type); + + return str_replace(['-', '.'], '_', $index); + } + + /** + * Add a new column to the blueprint. + * + * @param string $type + * @param string $name + * @param array $parameters + * @return \Illuminate\Database\Schema\ColumnDefinition + */ + public function addColumn($type, $name, array $parameters = []) + { + $this->columns[] = $column = new ColumnDefinition( + array_merge(compact('type', 'name'), $parameters) + ); + + return $column; + } + + /** + * Remove a column from the schema blueprint. + * + * @param string $name + * @return $this + */ + public function removeColumn($name) + { + $this->columns = array_values(array_filter($this->columns, function ($c) use ($name) { + return $c['attributes']['name'] != $name; + })); + + return $this; + } + + /** + * Add a new command to the blueprint. + * + * @param string $name + * @param array $parameters + * @return \Illuminate\Support\Fluent + */ + protected function addCommand($name, array $parameters = []) + { + $this->commands[] = $command = $this->createCommand($name, $parameters); + + return $command; + } + + /** + * Create a new Fluent command. + * + * @param string $name + * @param array $parameters + * @return \Illuminate\Support\Fluent + */ + protected function createCommand($name, array $parameters = []) + { + return new Fluent(array_merge(compact('name'), $parameters)); + } + + /** + * Get the table the blueprint describes. + * + * @return string + */ + public function getTable() + { + return $this->table; + } + + /** + * Get the columns on the blueprint. + * + * @return \Illuminate\Database\Schema\ColumnDefinition[] + */ + public function getColumns() + { + return $this->columns; + } + + /** + * Get the commands on the blueprint. + * + * @return \Illuminate\Support\Fluent[] + */ + public function getCommands() + { + return $this->commands; + } + + /** + * Get the columns on the blueprint that should be added. + * + * @return \Illuminate\Database\Schema\ColumnDefinition[] + */ + public function getAddedColumns() + { + return array_filter($this->columns, function ($column) { + return ! $column->change; + }); + } + + /** + * Get the columns on the blueprint that should be changed. + * + * @return \Illuminate\Database\Schema\ColumnDefinition[] + */ + public function getChangedColumns() + { + return array_filter($this->columns, function ($column) { + return (bool) $column->change; + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php new file mode 100755 index 0000000..2e25cf0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php @@ -0,0 +1,320 @@ +connection = $connection; + $this->grammar = $connection->getSchemaGrammar(); + } + + /** + * Set the default string length for migrations. + * + * @param int $length + * @return void + */ + public static function defaultStringLength($length) + { + static::$defaultStringLength = $length; + } + + /** + * Determine if the given table exists. + * + * @param string $table + * @return bool + */ + public function hasTable($table) + { + $table = $this->connection->getTablePrefix().$table; + + return count($this->connection->selectFromWriteConnection( + $this->grammar->compileTableExists(), [$table] + )) > 0; + } + + /** + * Determine if the given table has a given column. + * + * @param string $table + * @param string $column + * @return bool + */ + public function hasColumn($table, $column) + { + return in_array( + strtolower($column), array_map('strtolower', $this->getColumnListing($table)) + ); + } + + /** + * Determine if the given table has given columns. + * + * @param string $table + * @param array $columns + * @return bool + */ + public function hasColumns($table, array $columns) + { + $tableColumns = array_map('strtolower', $this->getColumnListing($table)); + + foreach ($columns as $column) { + if (! in_array(strtolower($column), $tableColumns)) { + return false; + } + } + + return true; + } + + /** + * Get the data type for the given column name. + * + * @param string $table + * @param string $column + * @return string + */ + public function getColumnType($table, $column) + { + $table = $this->connection->getTablePrefix().$table; + + return $this->connection->getDoctrineColumn($table, $column)->getType()->getName(); + } + + /** + * Get the column listing for a given table. + * + * @param string $table + * @return array + */ + public function getColumnListing($table) + { + $results = $this->connection->selectFromWriteConnection($this->grammar->compileColumnListing( + $this->connection->getTablePrefix().$table + )); + + return $this->connection->getPostProcessor()->processColumnListing($results); + } + + /** + * Modify a table on the schema. + * + * @param string $table + * @param \Closure $callback + * @return void + */ + public function table($table, Closure $callback) + { + $this->build($this->createBlueprint($table, $callback)); + } + + /** + * Create a new table on the schema. + * + * @param string $table + * @param \Closure $callback + * @return void + */ + public function create($table, Closure $callback) + { + $this->build(tap($this->createBlueprint($table), function ($blueprint) use ($callback) { + $blueprint->create(); + + $callback($blueprint); + })); + } + + /** + * Drop a table from the schema. + * + * @param string $table + * @return void + */ + public function drop($table) + { + $this->build(tap($this->createBlueprint($table), function ($blueprint) { + $blueprint->drop(); + })); + } + + /** + * Drop a table from the schema if it exists. + * + * @param string $table + * @return void + */ + public function dropIfExists($table) + { + $this->build(tap($this->createBlueprint($table), function ($blueprint) { + $blueprint->dropIfExists(); + })); + } + + /** + * Drop all tables from the database. + * + * @return void + * + * @throws \LogicException + */ + public function dropAllTables() + { + throw new LogicException('This database driver does not support dropping all tables.'); + } + + /** + * Drop all views from the database. + * + * @return void + * + * @throws \LogicException + */ + public function dropAllViews() + { + throw new LogicException('This database driver does not support dropping all views.'); + } + + /** + * Rename a table on the schema. + * + * @param string $from + * @param string $to + * @return void + */ + public function rename($from, $to) + { + $this->build(tap($this->createBlueprint($from), function ($blueprint) use ($to) { + $blueprint->rename($to); + })); + } + + /** + * Enable foreign key constraints. + * + * @return bool + */ + public function enableForeignKeyConstraints() + { + return $this->connection->statement( + $this->grammar->compileEnableForeignKeyConstraints() + ); + } + + /** + * Disable foreign key constraints. + * + * @return bool + */ + public function disableForeignKeyConstraints() + { + return $this->connection->statement( + $this->grammar->compileDisableForeignKeyConstraints() + ); + } + + /** + * Execute the blueprint to build / modify the table. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return void + */ + protected function build(Blueprint $blueprint) + { + $blueprint->build($this->connection, $this->grammar); + } + + /** + * Create a new command set with a Closure. + * + * @param string $table + * @param \Closure|null $callback + * @return \Illuminate\Database\Schema\Blueprint + */ + protected function createBlueprint($table, Closure $callback = null) + { + $prefix = $this->connection->getConfig('prefix_indexes') + ? $this->connection->getConfig('prefix') + : ''; + + if (isset($this->resolver)) { + return call_user_func($this->resolver, $table, $callback, $prefix); + } + + return new Blueprint($table, $callback, $prefix); + } + + /** + * Get the database connection instance. + * + * @return \Illuminate\Database\Connection + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Set the database connection instance. + * + * @param \Illuminate\Database\Connection $connection + * @return $this + */ + public function setConnection(Connection $connection) + { + $this->connection = $connection; + + return $this; + } + + /** + * Set the Schema Blueprint resolver callback. + * + * @param \Closure $resolver + * @return void + */ + public function blueprintResolver(Closure $resolver) + { + $this->resolver = $resolver; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/ColumnDefinition.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/ColumnDefinition.php new file mode 100644 index 0000000..d6feac7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/ColumnDefinition.php @@ -0,0 +1,31 @@ +isDoctrineAvailable()) { + throw new RuntimeException(sprintf( + 'Changing columns for table "%s" requires Doctrine DBAL; install "doctrine/dbal".', + $blueprint->getTable() + )); + } + + $tableDiff = static::getChangedDiff( + $grammar, $blueprint, $schema = $connection->getDoctrineSchemaManager() + ); + + if ($tableDiff !== false) { + return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff); + } + + return []; + } + + /** + * Get the Doctrine table difference for the given changes. + * + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema + * @return \Doctrine\DBAL\Schema\TableDiff|bool + */ + protected static function getChangedDiff($grammar, Blueprint $blueprint, SchemaManager $schema) + { + $current = $schema->listTableDetails($grammar->getTablePrefix().$blueprint->getTable()); + + return (new Comparator)->diffTable( + $current, static::getTableWithColumnChanges($blueprint, $current) + ); + } + + /** + * Get a copy of the given Doctrine table after making the column changes. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Doctrine\DBAL\Schema\Table $table + * @return \Doctrine\DBAL\Schema\Table + */ + protected static function getTableWithColumnChanges(Blueprint $blueprint, Table $table) + { + $table = clone $table; + + foreach ($blueprint->getChangedColumns() as $fluent) { + $column = static::getDoctrineColumn($table, $fluent); + + // Here we will spin through each fluent column definition and map it to the proper + // Doctrine column definitions - which is necessary because Laravel and Doctrine + // use some different terminology for various column attributes on the tables. + foreach ($fluent->getAttributes() as $key => $value) { + if (! is_null($option = static::mapFluentOptionToDoctrine($key))) { + if (method_exists($column, $method = 'set'.ucfirst($option))) { + $column->{$method}(static::mapFluentValueToDoctrine($option, $value)); + } + } + } + } + + return $table; + } + + /** + * Get the Doctrine column instance for a column change. + * + * @param \Doctrine\DBAL\Schema\Table $table + * @param \Illuminate\Support\Fluent $fluent + * @return \Doctrine\DBAL\Schema\Column + */ + protected static function getDoctrineColumn(Table $table, Fluent $fluent) + { + return $table->changeColumn( + $fluent['name'], static::getDoctrineColumnChangeOptions($fluent) + )->getColumn($fluent['name']); + } + + /** + * Get the Doctrine column change options. + * + * @param \Illuminate\Support\Fluent $fluent + * @return array + */ + protected static function getDoctrineColumnChangeOptions(Fluent $fluent) + { + $options = ['type' => static::getDoctrineColumnType($fluent['type'])]; + + if (in_array($fluent['type'], ['text', 'mediumText', 'longText'])) { + $options['length'] = static::calculateDoctrineTextLength($fluent['type']); + } + + if ($fluent['type'] === 'json') { + $options['customSchemaOptions'] = [ + 'collation' => '', + ]; + } + + return $options; + } + + /** + * Get the doctrine column type. + * + * @param string $type + * @return \Doctrine\DBAL\Types\Type + */ + protected static function getDoctrineColumnType($type) + { + $type = strtolower($type); + + switch ($type) { + case 'biginteger': + $type = 'bigint'; + break; + case 'smallinteger': + $type = 'smallint'; + break; + case 'mediumtext': + case 'longtext': + $type = 'text'; + break; + case 'binary': + $type = 'blob'; + break; + } + + return Type::getType($type); + } + + /** + * Calculate the proper column length to force the Doctrine text type. + * + * @param string $type + * @return int + */ + protected static function calculateDoctrineTextLength($type) + { + switch ($type) { + case 'mediumText': + return 65535 + 1; + case 'longText': + return 16777215 + 1; + default: + return 255 + 1; + } + } + + /** + * Get the matching Doctrine option for a given Fluent attribute name. + * + * @param string $attribute + * @return string|null + */ + protected static function mapFluentOptionToDoctrine($attribute) + { + switch ($attribute) { + case 'type': + case 'name': + return; + case 'nullable': + return 'notnull'; + case 'total': + return 'precision'; + case 'places': + return 'scale'; + default: + return $attribute; + } + } + + /** + * Get the matching Doctrine value for a given Fluent attribute. + * + * @param string $option + * @param mixed $value + * @return mixed + */ + protected static function mapFluentValueToDoctrine($option, $value) + { + return $option === 'notnull' ? ! $value : $value; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php new file mode 100755 index 0000000..1ea4dab --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php @@ -0,0 +1,272 @@ +wrapTable($blueprint), + $this->wrap($command->index) + ); + + // Once we have the initial portion of the SQL statement we will add on the + // key name, table name, and referenced columns. These will complete the + // main portion of the SQL statement and this SQL will almost be done. + $sql .= sprintf('foreign key (%s) references %s (%s)', + $this->columnize($command->columns), + $this->wrapTable($command->on), + $this->columnize((array) $command->references) + ); + + // Once we have the basic foreign key creation statement constructed we can + // build out the syntax for what should happen on an update or delete of + // the affected columns, which will get something like "cascade", etc. + if (! is_null($command->onDelete)) { + $sql .= " on delete {$command->onDelete}"; + } + + if (! is_null($command->onUpdate)) { + $sql .= " on update {$command->onUpdate}"; + } + + return $sql; + } + + /** + * Compile the blueprint's column definitions. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return array + */ + protected function getColumns(Blueprint $blueprint) + { + $columns = []; + + foreach ($blueprint->getAddedColumns() as $column) { + // Each of the column types have their own compiler functions which are tasked + // with turning the column definition into its SQL format for this platform + // used by the connection. The column's modifiers are compiled and added. + $sql = $this->wrap($column).' '.$this->getType($column); + + $columns[] = $this->addModifiers($sql, $blueprint, $column); + } + + return $columns; + } + + /** + * Get the SQL for the column data type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function getType(Fluent $column) + { + return $this->{'type'.ucfirst($column->type)}($column); + } + + /** + * Add the column modifiers to the definition. + * + * @param string $sql + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function addModifiers($sql, Blueprint $blueprint, Fluent $column) + { + foreach ($this->modifiers as $modifier) { + if (method_exists($this, $method = "modify{$modifier}")) { + $sql .= $this->{$method}($blueprint, $column); + } + } + + return $sql; + } + + /** + * Get the primary key command if it exists on the blueprint. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param string $name + * @return \Illuminate\Support\Fluent|null + */ + protected function getCommandByName(Blueprint $blueprint, $name) + { + $commands = $this->getCommandsByName($blueprint, $name); + + if (count($commands) > 0) { + return reset($commands); + } + } + + /** + * Get all of the commands with a given name. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param string $name + * @return array + */ + protected function getCommandsByName(Blueprint $blueprint, $name) + { + return array_filter($blueprint->getCommands(), function ($value) use ($name) { + return $value->name == $name; + }); + } + + /** + * Add a prefix to an array of values. + * + * @param string $prefix + * @param array $values + * @return array + */ + public function prefixArray($prefix, array $values) + { + return array_map(function ($value) use ($prefix) { + return $prefix.' '.$value; + }, $values); + } + + /** + * Wrap a table in keyword identifiers. + * + * @param mixed $table + * @return string + */ + public function wrapTable($table) + { + return parent::wrapTable( + $table instanceof Blueprint ? $table->getTable() : $table + ); + } + + /** + * Wrap a value in keyword identifiers. + * + * @param \Illuminate\Database\Query\Expression|string $value + * @param bool $prefixAlias + * @return string + */ + public function wrap($value, $prefixAlias = false) + { + return parent::wrap( + $value instanceof Fluent ? $value->name : $value, $prefixAlias + ); + } + + /** + * Format a value so that it can be used in "default" clauses. + * + * @param mixed $value + * @return string + */ + protected function getDefaultValue($value) + { + if ($value instanceof Expression) { + return $value; + } + + return is_bool($value) + ? "'".(int) $value."'" + : "'".(string) $value."'"; + } + + /** + * Create an empty Doctrine DBAL TableDiff from the Blueprint. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema + * @return \Doctrine\DBAL\Schema\TableDiff + */ + public function getDoctrineTableDiff(Blueprint $blueprint, SchemaManager $schema) + { + $table = $this->getTablePrefix().$blueprint->getTable(); + + return tap(new TableDiff($table), function ($tableDiff) use ($schema, $table) { + $tableDiff->fromTable = $schema->listTableDetails($table); + }); + } + + /** + * Get the fluent commands for the grammar. + * + * @return array + */ + public function getFluentCommands() + { + return $this->fluentCommands; + } + + /** + * Check if this Grammar supports schema changes wrapped in a transaction. + * + * @return bool + */ + public function supportsSchemaTransactions() + { + return $this->transactions; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php new file mode 100755 index 0000000..2e5ec24 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php @@ -0,0 +1,1018 @@ +compileCreateTable( + $blueprint, $command, $connection + ); + + // Once we have the primary SQL, we can add the encoding option to the SQL for + // the table. Then, we can check if a storage engine has been supplied for + // the table. If so, we will add the engine declaration to the SQL query. + $sql = $this->compileCreateEncoding( + $sql, $connection, $blueprint + ); + + // Finally, we will append the engine configuration onto this SQL statement as + // the final thing we do before returning this finished SQL. Once this gets + // added the query will be ready to execute against the real connections. + return $this->compileCreateEngine( + $sql, $connection, $blueprint + ); + } + + /** + * Create the main create table clause. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param \Illuminate\Database\Connection $connection + * @return string + */ + protected function compileCreateTable($blueprint, $command, $connection) + { + return sprintf('%s table %s (%s)', + $blueprint->temporary ? 'create temporary' : 'create', + $this->wrapTable($blueprint), + implode(', ', $this->getColumns($blueprint)) + ); + } + + /** + * Append the character set specifications to a command. + * + * @param string $sql + * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return string + */ + protected function compileCreateEncoding($sql, Connection $connection, Blueprint $blueprint) + { + // First we will set the character set if one has been set on either the create + // blueprint itself or on the root configuration for the connection that the + // table is being created on. We will add these to the create table query. + if (isset($blueprint->charset)) { + $sql .= ' default character set '.$blueprint->charset; + } elseif (! is_null($charset = $connection->getConfig('charset'))) { + $sql .= ' default character set '.$charset; + } + + // Next we will add the collation to the create table statement if one has been + // added to either this create table blueprint or the configuration for this + // connection that the query is targeting. We'll add it to this SQL query. + if (isset($blueprint->collation)) { + $sql .= " collate '{$blueprint->collation}'"; + } elseif (! is_null($collation = $connection->getConfig('collation'))) { + $sql .= " collate '{$collation}'"; + } + + return $sql; + } + + /** + * Append the engine specifications to a command. + * + * @param string $sql + * @param \Illuminate\Database\Connection $connection + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return string + */ + protected function compileCreateEngine($sql, Connection $connection, Blueprint $blueprint) + { + if (isset($blueprint->engine)) { + return $sql.' engine = '.$blueprint->engine; + } elseif (! is_null($engine = $connection->getConfig('engine'))) { + return $sql.' engine = '.$engine; + } + + return $sql; + } + + /** + * Compile an add column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileAdd(Blueprint $blueprint, Fluent $command) + { + $columns = $this->prefixArray('add', $this->getColumns($blueprint)); + + return 'alter table '.$this->wrapTable($blueprint).' '.implode(', ', $columns); + } + + /** + * Compile a primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compilePrimary(Blueprint $blueprint, Fluent $command) + { + $command->name(null); + + return $this->compileKey($blueprint, $command, 'primary key'); + } + + /** + * Compile a unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileUnique(Blueprint $blueprint, Fluent $command) + { + return $this->compileKey($blueprint, $command, 'unique'); + } + + /** + * Compile a plain index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileIndex(Blueprint $blueprint, Fluent $command) + { + return $this->compileKey($blueprint, $command, 'index'); + } + + /** + * Compile a spatial index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) + { + return $this->compileKey($blueprint, $command, 'spatial index'); + } + + /** + * Compile an index creation command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param string $type + * @return string + */ + protected function compileKey(Blueprint $blueprint, Fluent $command, $type) + { + return sprintf('alter table %s add %s %s%s(%s)', + $this->wrapTable($blueprint), + $type, + $this->wrap($command->index), + $command->algorithm ? ' using '.$command->algorithm : '', + $this->columnize($command->columns) + ); + } + + /** + * Compile a drop table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDrop(Blueprint $blueprint, Fluent $command) + { + return 'drop table '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop table (if exists) command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIfExists(Blueprint $blueprint, Fluent $command) + { + return 'drop table if exists '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropColumn(Blueprint $blueprint, Fluent $command) + { + $columns = $this->prefixArray('drop', $this->wrapArray($command->columns)); + + return 'alter table '.$this->wrapTable($blueprint).' '.implode(', ', $columns); + } + + /** + * Compile a drop primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropPrimary(Blueprint $blueprint, Fluent $command) + { + return 'alter table '.$this->wrapTable($blueprint).' drop primary key'; + } + + /** + * Compile a drop unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropUnique(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "alter table {$this->wrapTable($blueprint)} drop index {$index}"; + } + + /** + * Compile a drop index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIndex(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "alter table {$this->wrapTable($blueprint)} drop index {$index}"; + } + + /** + * Compile a drop spatial index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropSpatialIndex(Blueprint $blueprint, Fluent $command) + { + return $this->compileDropIndex($blueprint, $command); + } + + /** + * Compile a drop foreign key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropForeign(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "alter table {$this->wrapTable($blueprint)} drop foreign key {$index}"; + } + + /** + * Compile a rename table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRename(Blueprint $blueprint, Fluent $command) + { + $from = $this->wrapTable($blueprint); + + return "rename table {$from} to ".$this->wrapTable($command->to); + } + + /** + * Compile a rename index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRenameIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf('alter table %s rename index %s to %s', + $this->wrapTable($blueprint), + $this->wrap($command->from), + $this->wrap($command->to) + ); + } + + /** + * Compile the SQL needed to drop all tables. + * + * @param array $tables + * @return string + */ + public function compileDropAllTables($tables) + { + return 'drop table '.implode(',', $this->wrapArray($tables)); + } + + /** + * Compile the SQL needed to drop all views. + * + * @param array $views + * @return string + */ + public function compileDropAllViews($views) + { + return 'drop view '.implode(',', $this->wrapArray($views)); + } + + /** + * Compile the SQL needed to retrieve all table names. + * + * @return string + */ + public function compileGetAllTables() + { + return 'SHOW FULL TABLES WHERE table_type = \'BASE TABLE\''; + } + + /** + * Compile the SQL needed to retrieve all view names. + * + * @return string + */ + public function compileGetAllViews() + { + return 'SHOW FULL TABLES WHERE table_type = \'VIEW\''; + } + + /** + * Compile the command to enable foreign key constraints. + * + * @return string + */ + public function compileEnableForeignKeyConstraints() + { + return 'SET FOREIGN_KEY_CHECKS=1;'; + } + + /** + * Compile the command to disable foreign key constraints. + * + * @return string + */ + public function compileDisableForeignKeyConstraints() + { + return 'SET FOREIGN_KEY_CHECKS=0;'; + } + + /** + * Create the column definition for a char type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeChar(Fluent $column) + { + return "char({$column->length})"; + } + + /** + * Create the column definition for a string type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeString(Fluent $column) + { + return "varchar({$column->length})"; + } + + /** + * Create the column definition for a text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a medium text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumText(Fluent $column) + { + return 'mediumtext'; + } + + /** + * Create the column definition for a long text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeLongText(Fluent $column) + { + return 'longtext'; + } + + /** + * Create the column definition for a big integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBigInteger(Fluent $column) + { + return 'bigint'; + } + + /** + * Create the column definition for an integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeInteger(Fluent $column) + { + return 'int'; + } + + /** + * Create the column definition for a medium integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumInteger(Fluent $column) + { + return 'mediumint'; + } + + /** + * Create the column definition for a tiny integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTinyInteger(Fluent $column) + { + return 'tinyint'; + } + + /** + * Create the column definition for a small integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeSmallInteger(Fluent $column) + { + return 'smallint'; + } + + /** + * Create the column definition for a float type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeFloat(Fluent $column) + { + return $this->typeDouble($column); + } + + /** + * Create the column definition for a double type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDouble(Fluent $column) + { + if ($column->total && $column->places) { + return "double({$column->total}, {$column->places})"; + } + + return 'double'; + } + + /** + * Create the column definition for a decimal type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDecimal(Fluent $column) + { + return "decimal({$column->total}, {$column->places})"; + } + + /** + * Create the column definition for a boolean type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBoolean(Fluent $column) + { + return 'tinyint(1)'; + } + + /** + * Create the column definition for an enumeration type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeEnum(Fluent $column) + { + return sprintf('enum(%s)', $this->quoteString($column->allowed)); + } + + /** + * Create the column definition for a json type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJson(Fluent $column) + { + return 'json'; + } + + /** + * Create the column definition for a jsonb type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJsonb(Fluent $column) + { + return 'json'; + } + + /** + * Create the column definition for a date type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDate(Fluent $column) + { + return 'date'; + } + + /** + * Create the column definition for a date-time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTime(Fluent $column) + { + return $column->precision ? "datetime($column->precision)" : 'datetime'; + } + + /** + * Create the column definition for a date-time (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTimeTz(Fluent $column) + { + return $this->typeDateTime($column); + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTime(Fluent $column) + { + return $column->precision ? "time($column->precision)" : 'time'; + } + + /** + * Create the column definition for a time (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimeTz(Fluent $column) + { + return $this->typeTime($column); + } + + /** + * Create the column definition for a timestamp type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestamp(Fluent $column) + { + $columnType = $column->precision ? "timestamp($column->precision)" : 'timestamp'; + + return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; + } + + /** + * Create the column definition for a timestamp (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestampTz(Fluent $column) + { + return $this->typeTimestamp($column); + } + + /** + * Create the column definition for a year type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeYear(Fluent $column) + { + return 'year'; + } + + /** + * Create the column definition for a binary type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBinary(Fluent $column) + { + return 'blob'; + } + + /** + * Create the column definition for a uuid type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeUuid(Fluent $column) + { + return 'char(36)'; + } + + /** + * Create the column definition for an IP address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeIpAddress(Fluent $column) + { + return 'varchar(45)'; + } + + /** + * Create the column definition for a MAC address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMacAddress(Fluent $column) + { + return 'varchar(17)'; + } + + /** + * Create the column definition for a spatial Geometry type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeGeometry(Fluent $column) + { + return 'geometry'; + } + + /** + * Create the column definition for a spatial Point type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typePoint(Fluent $column) + { + return 'point'; + } + + /** + * Create the column definition for a spatial LineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeLineString(Fluent $column) + { + return 'linestring'; + } + + /** + * Create the column definition for a spatial Polygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typePolygon(Fluent $column) + { + return 'polygon'; + } + + /** + * Create the column definition for a spatial GeometryCollection type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeGeometryCollection(Fluent $column) + { + return 'geometrycollection'; + } + + /** + * Create the column definition for a spatial MultiPoint type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiPoint(Fluent $column) + { + return 'multipoint'; + } + + /** + * Create the column definition for a spatial MultiLineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiLineString(Fluent $column) + { + return 'multilinestring'; + } + + /** + * Create the column definition for a spatial MultiPolygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiPolygon(Fluent $column) + { + return 'multipolygon'; + } + + /** + * Get the SQL for a generated virtual column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyVirtualAs(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->virtualAs)) { + return " as ({$column->virtualAs})"; + } + } + + /** + * Get the SQL for a generated stored column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyStoredAs(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->storedAs)) { + return " as ({$column->storedAs}) stored"; + } + } + + /** + * Get the SQL for an unsigned column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyUnsigned(Blueprint $blueprint, Fluent $column) + { + if ($column->unsigned) { + return ' unsigned'; + } + } + + /** + * Get the SQL for a character set column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyCharset(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->charset)) { + return ' character set '.$column->charset; + } + } + + /** + * Get the SQL for a collation column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyCollate(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->collation)) { + return " collate '{$column->collation}'"; + } + } + + /** + * Get the SQL for a nullable column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyNullable(Blueprint $blueprint, Fluent $column) + { + if (is_null($column->virtualAs) && is_null($column->storedAs)) { + return $column->nullable ? ' null' : ' not null'; + } + } + + /** + * Get the SQL for a default column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyDefault(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->default)) { + return ' default '.$this->getDefaultValue($column->default); + } + } + + /** + * Get the SQL for an auto-increment column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyIncrement(Blueprint $blueprint, Fluent $column) + { + if (in_array($column->type, $this->serials) && $column->autoIncrement) { + return ' auto_increment primary key'; + } + } + + /** + * Get the SQL for a "first" column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyFirst(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->first)) { + return ' first'; + } + } + + /** + * Get the SQL for an "after" column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyAfter(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->after)) { + return ' after '.$this->wrap($column->after); + } + } + + /** + * Get the SQL for a "comment" column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyComment(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->comment)) { + return " comment '".addslashes($column->comment)."'"; + } + } + + /** + * Get the SQL for a SRID column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifySrid(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->srid) && is_int($column->srid) && $column->srid > 0) { + return ' srid '.$column->srid; + } + } + + /** + * Wrap a single string in keyword identifiers. + * + * @param string $value + * @return string + */ + protected function wrapValue($value) + { + if ($value !== '*') { + return '`'.str_replace('`', '``', $value).'`'; + } + + return $value; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php new file mode 100755 index 0000000..4fa3285 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php @@ -0,0 +1,900 @@ +temporary ? 'create temporary' : 'create', + $this->wrapTable($blueprint), + implode(', ', $this->getColumns($blueprint)) + ); + } + + /** + * Compile a column addition command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileAdd(Blueprint $blueprint, Fluent $command) + { + return sprintf('alter table %s %s', + $this->wrapTable($blueprint), + implode(', ', $this->prefixArray('add column', $this->getColumns($blueprint))) + ); + } + + /** + * Compile a primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compilePrimary(Blueprint $blueprint, Fluent $command) + { + $columns = $this->columnize($command->columns); + + return 'alter table '.$this->wrapTable($blueprint)." add primary key ({$columns})"; + } + + /** + * Compile a unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileUnique(Blueprint $blueprint, Fluent $command) + { + return sprintf('alter table %s add constraint %s unique (%s)', + $this->wrapTable($blueprint), + $this->wrap($command->index), + $this->columnize($command->columns) + ); + } + + /** + * Compile a plain index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf('create index %s on %s%s (%s)', + $this->wrap($command->index), + $this->wrapTable($blueprint), + $command->algorithm ? ' using '.$command->algorithm : '', + $this->columnize($command->columns) + ); + } + + /** + * Compile a spatial index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) + { + $command->algorithm = 'gist'; + + return $this->compileIndex($blueprint, $command); + } + + /** + * Compile a foreign key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileForeign(Blueprint $blueprint, Fluent $command) + { + $sql = parent::compileForeign($blueprint, $command); + + if (! is_null($command->deferrable)) { + $sql .= $command->deferrable ? ' deferrable' : ' not deferrable'; + } + + if ($command->deferrable && ! is_null($command->initiallyImmediate)) { + $sql .= $command->initiallyImmediate ? ' initially immediate' : ' initially deferred'; + } + + if (! is_null($command->notValid)) { + $sql .= ' not valid'; + } + + return $sql; + } + + /** + * Compile a drop table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDrop(Blueprint $blueprint, Fluent $command) + { + return 'drop table '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop table (if exists) command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIfExists(Blueprint $blueprint, Fluent $command) + { + return 'drop table if exists '.$this->wrapTable($blueprint); + } + + /** + * Compile the SQL needed to drop all tables. + * + * @param string $tables + * @return string + */ + public function compileDropAllTables($tables) + { + return 'drop table "'.implode('","', $tables).'" cascade'; + } + + /** + * Compile the SQL needed to drop all views. + * + * @param string $views + * @return string + */ + public function compileDropAllViews($views) + { + return 'drop view "'.implode('","', $views).'" cascade'; + } + + /** + * Compile the SQL needed to retrieve all table names. + * + * @param string $schema + * @return string + */ + public function compileGetAllTables($schema) + { + return "select tablename from pg_catalog.pg_tables where schemaname = '{$schema}'"; + } + + /** + * Compile the SQL needed to retrieve all view names. + * + * @param string $schema + * @return string + */ + public function compileGetAllViews($schema) + { + return "select viewname from pg_catalog.pg_views where schemaname = '{$schema}'"; + } + + /** + * Compile a drop column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropColumn(Blueprint $blueprint, Fluent $command) + { + $columns = $this->prefixArray('drop column', $this->wrapArray($command->columns)); + + return 'alter table '.$this->wrapTable($blueprint).' '.implode(', ', $columns); + } + + /** + * Compile a drop primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropPrimary(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap("{$blueprint->getTable()}_pkey"); + + return 'alter table '.$this->wrapTable($blueprint)." drop constraint {$index}"; + } + + /** + * Compile a drop unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropUnique(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "alter table {$this->wrapTable($blueprint)} drop constraint {$index}"; + } + + /** + * Compile a drop index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIndex(Blueprint $blueprint, Fluent $command) + { + return "drop index {$this->wrap($command->index)}"; + } + + /** + * Compile a drop spatial index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropSpatialIndex(Blueprint $blueprint, Fluent $command) + { + return $this->compileDropIndex($blueprint, $command); + } + + /** + * Compile a drop foreign key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropForeign(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "alter table {$this->wrapTable($blueprint)} drop constraint {$index}"; + } + + /** + * Compile a rename table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRename(Blueprint $blueprint, Fluent $command) + { + $from = $this->wrapTable($blueprint); + + return "alter table {$from} rename to ".$this->wrapTable($command->to); + } + + /** + * Compile a rename index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRenameIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf('alter index %s rename to %s', + $this->wrap($command->from), + $this->wrap($command->to) + ); + } + + /** + * Compile the command to enable foreign key constraints. + * + * @return string + */ + public function compileEnableForeignKeyConstraints() + { + return 'SET CONSTRAINTS ALL IMMEDIATE;'; + } + + /** + * Compile the command to disable foreign key constraints. + * + * @return string + */ + public function compileDisableForeignKeyConstraints() + { + return 'SET CONSTRAINTS ALL DEFERRED;'; + } + + /** + * Compile a comment command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileComment(Blueprint $blueprint, Fluent $command) + { + return sprintf('comment on column %s.%s is %s', + $this->wrapTable($blueprint), + $this->wrap($command->column->name), + "'".str_replace("'", "''", $command->value)."'" + ); + } + + /** + * Create the column definition for a char type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeChar(Fluent $column) + { + return "char({$column->length})"; + } + + /** + * Create the column definition for a string type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeString(Fluent $column) + { + return "varchar({$column->length})"; + } + + /** + * Create the column definition for a text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a medium text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a long text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeLongText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for an integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeInteger(Fluent $column) + { + return $this->generatableColumn('integer', $column); + } + + /** + * Create the column definition for a big integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBigInteger(Fluent $column) + { + return $this->generatableColumn('bigint', $column); + } + + /** + * Create the column definition for a medium integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumInteger(Fluent $column) + { + return $this->generatableColumn('integer', $column); + } + + /** + * Create the column definition for a tiny integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTinyInteger(Fluent $column) + { + return $this->generatableColumn('smallint', $column); + } + + /** + * Create the column definition for a small integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeSmallInteger(Fluent $column) + { + return $this->generatableColumn('smallint', $column); + } + + /** + * Create the column definition for a generatable column. + * + * @param string $type + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function generatableColumn($type, Fluent $column) + { + if (! $column->autoIncrement && is_null($column->generatedAs)) { + return $type; + } + + if ($column->autoIncrement && is_null($column->generatedAs)) { + return with([ + 'integer' => 'serial', + 'bigint' => 'bigserial', + 'smallint' => 'smallserial', + ])[$type]; + } + + $options = ''; + + if (! is_bool($column->generatedAs) && ! empty($column->generatedAs)) { + $options = sprintf(' (%s)', $column->generatedAs); + } + + return sprintf( + '%s generated %s as identity%s', + $type, + $column->always ? 'always' : 'by default', + $options + ); + } + + /** + * Create the column definition for a float type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeFloat(Fluent $column) + { + return $this->typeDouble($column); + } + + /** + * Create the column definition for a double type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDouble(Fluent $column) + { + return 'double precision'; + } + + /** + * Create the column definition for a real type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeReal(Fluent $column) + { + return 'real'; + } + + /** + * Create the column definition for a decimal type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDecimal(Fluent $column) + { + return "decimal({$column->total}, {$column->places})"; + } + + /** + * Create the column definition for a boolean type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBoolean(Fluent $column) + { + return 'boolean'; + } + + /** + * Create the column definition for an enumeration type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeEnum(Fluent $column) + { + return sprintf( + 'varchar(255) check ("%s" in (%s))', + $column->name, + $this->quoteString($column->allowed) + ); + } + + /** + * Create the column definition for a json type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJson(Fluent $column) + { + return 'json'; + } + + /** + * Create the column definition for a jsonb type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJsonb(Fluent $column) + { + return 'jsonb'; + } + + /** + * Create the column definition for a date type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDate(Fluent $column) + { + return 'date'; + } + + /** + * Create the column definition for a date-time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTime(Fluent $column) + { + return "timestamp($column->precision) without time zone"; + } + + /** + * Create the column definition for a date-time (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTimeTz(Fluent $column) + { + return "timestamp($column->precision) with time zone"; + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTime(Fluent $column) + { + return "time($column->precision) without time zone"; + } + + /** + * Create the column definition for a time (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimeTz(Fluent $column) + { + return "time($column->precision) with time zone"; + } + + /** + * Create the column definition for a timestamp type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestamp(Fluent $column) + { + $columnType = "timestamp($column->precision) without time zone"; + + return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; + } + + /** + * Create the column definition for a timestamp (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestampTz(Fluent $column) + { + $columnType = "timestamp($column->precision) with time zone"; + + return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; + } + + /** + * Create the column definition for a year type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeYear(Fluent $column) + { + return $this->typeInteger($column); + } + + /** + * Create the column definition for a binary type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBinary(Fluent $column) + { + return 'bytea'; + } + + /** + * Create the column definition for a uuid type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeUuid(Fluent $column) + { + return 'uuid'; + } + + /** + * Create the column definition for an IP address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeIpAddress(Fluent $column) + { + return 'inet'; + } + + /** + * Create the column definition for a MAC address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMacAddress(Fluent $column) + { + return 'macaddr'; + } + + /** + * Create the column definition for a spatial Geometry type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeGeometry(Fluent $column) + { + return $this->formatPostGisType('geometry'); + } + + /** + * Create the column definition for a spatial Point type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typePoint(Fluent $column) + { + return $this->formatPostGisType('point'); + } + + /** + * Create the column definition for a spatial LineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeLineString(Fluent $column) + { + return $this->formatPostGisType('linestring'); + } + + /** + * Create the column definition for a spatial Polygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typePolygon(Fluent $column) + { + return $this->formatPostGisType('polygon'); + } + + /** + * Create the column definition for a spatial GeometryCollection type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeGeometryCollection(Fluent $column) + { + return $this->formatPostGisType('geometrycollection'); + } + + /** + * Create the column definition for a spatial MultiPoint type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMultiPoint(Fluent $column) + { + return $this->formatPostGisType('multipoint'); + } + + /** + * Create the column definition for a spatial MultiLineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiLineString(Fluent $column) + { + return $this->formatPostGisType('multilinestring'); + } + + /** + * Create the column definition for a spatial MultiPolygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMultiPolygon(Fluent $column) + { + return $this->formatPostGisType('multipolygon'); + } + + /** + * Format the column definition for a PostGIS spatial type. + * + * @param string $type + * @return string + */ + private function formatPostGisType(string $type) + { + return "geography($type, 4326)"; + } + + /** + * Get the SQL for a nullable column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyNullable(Blueprint $blueprint, Fluent $column) + { + return $column->nullable ? ' null' : ' not null'; + } + + /** + * Get the SQL for a default column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyDefault(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->default)) { + return ' default '.$this->getDefaultValue($column->default); + } + } + + /** + * Get the SQL for an auto-increment column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyIncrement(Blueprint $blueprint, Fluent $column) + { + if ((in_array($column->type, $this->serials) || ($column->generatedAs !== null)) && $column->autoIncrement) { + return ' primary key'; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/RenameColumn.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/RenameColumn.php new file mode 100644 index 0000000..a07c4fe --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/RenameColumn.php @@ -0,0 +1,69 @@ +getDoctrineColumn( + $grammar->getTablePrefix().$blueprint->getTable(), $command->from + ); + + $schema = $connection->getDoctrineSchemaManager(); + + return (array) $schema->getDatabasePlatform()->getAlterTableSQL(static::getRenamedDiff( + $grammar, $blueprint, $command, $column, $schema + )); + } + + /** + * Get a new column instance with the new column name. + * + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param \Doctrine\DBAL\Schema\Column $column + * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema + * @return \Doctrine\DBAL\Schema\TableDiff + */ + protected static function getRenamedDiff(Grammar $grammar, Blueprint $blueprint, Fluent $command, Column $column, SchemaManager $schema) + { + return static::setRenamedColumns( + $grammar->getDoctrineTableDiff($blueprint, $schema), $command, $column + ); + } + + /** + * Set the renamed columns on the table diff. + * + * @param \Doctrine\DBAL\Schema\TableDiff $tableDiff + * @param \Illuminate\Support\Fluent $command + * @param \Doctrine\DBAL\Schema\Column $column + * @return \Doctrine\DBAL\Schema\TableDiff + */ + protected static function setRenamedColumns(TableDiff $tableDiff, Fluent $command, Column $column) + { + $tableDiff->renamedColumns = [ + $command->from => new Column($command->to, $column->getType(), $column->toArray()), + ]; + + return $tableDiff; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php new file mode 100755 index 0000000..d6ef59d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php @@ -0,0 +1,860 @@ +wrap(str_replace('.', '__', $table)).')'; + } + + /** + * Compile a create table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileCreate(Blueprint $blueprint, Fluent $command) + { + return sprintf('%s table %s (%s%s%s)', + $blueprint->temporary ? 'create temporary' : 'create', + $this->wrapTable($blueprint), + implode(', ', $this->getColumns($blueprint)), + (string) $this->addForeignKeys($blueprint), + (string) $this->addPrimaryKeys($blueprint) + ); + } + + /** + * Get the foreign key syntax for a table creation statement. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return string|null + */ + protected function addForeignKeys(Blueprint $blueprint) + { + $foreigns = $this->getCommandsByName($blueprint, 'foreign'); + + return collect($foreigns)->reduce(function ($sql, $foreign) { + // Once we have all the foreign key commands for the table creation statement + // we'll loop through each of them and add them to the create table SQL we + // are building, since SQLite needs foreign keys on the tables creation. + $sql .= $this->getForeignKey($foreign); + + if (! is_null($foreign->onDelete)) { + $sql .= " on delete {$foreign->onDelete}"; + } + + // If this foreign key specifies the action to be taken on update we will add + // that to the statement here. We'll append it to this SQL and then return + // the SQL so we can keep adding any other foreign constraints onto this. + if (! is_null($foreign->onUpdate)) { + $sql .= " on update {$foreign->onUpdate}"; + } + + return $sql; + }, ''); + } + + /** + * Get the SQL for the foreign key. + * + * @param \Illuminate\Support\Fluent $foreign + * @return string + */ + protected function getForeignKey($foreign) + { + // We need to columnize the columns that the foreign key is being defined for + // so that it is a properly formatted list. Once we have done this, we can + // return the foreign key SQL declaration to the calling method for use. + return sprintf(', foreign key(%s) references %s(%s)', + $this->columnize($foreign->columns), + $this->wrapTable($foreign->on), + $this->columnize((array) $foreign->references) + ); + } + + /** + * Get the primary key syntax for a table creation statement. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @return string|null + */ + protected function addPrimaryKeys(Blueprint $blueprint) + { + if (! is_null($primary = $this->getCommandByName($blueprint, 'primary'))) { + return ", primary key ({$this->columnize($primary->columns)})"; + } + } + + /** + * Compile alter table commands for adding columns. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return array + */ + public function compileAdd(Blueprint $blueprint, Fluent $command) + { + $columns = $this->prefixArray('add column', $this->getColumns($blueprint)); + + return collect($columns)->map(function ($column) use ($blueprint) { + return 'alter table '.$this->wrapTable($blueprint).' '.$column; + })->all(); + } + + /** + * Compile a unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileUnique(Blueprint $blueprint, Fluent $command) + { + return sprintf('create unique index %s on %s (%s)', + $this->wrap($command->index), + $this->wrapTable($blueprint), + $this->columnize($command->columns) + ); + } + + /** + * Compile a plain index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf('create index %s on %s (%s)', + $this->wrap($command->index), + $this->wrapTable($blueprint), + $this->columnize($command->columns) + ); + } + + /** + * Compile a spatial index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * + * @throws \RuntimeException + */ + public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) + { + throw new RuntimeException('The database driver in use does not support spatial indexes.'); + } + + /** + * Compile a foreign key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileForeign(Blueprint $blueprint, Fluent $command) + { + // Handled on table creation... + } + + /** + * Compile a drop table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDrop(Blueprint $blueprint, Fluent $command) + { + return 'drop table '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop table (if exists) command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIfExists(Blueprint $blueprint, Fluent $command) + { + return 'drop table if exists '.$this->wrapTable($blueprint); + } + + /** + * Compile the SQL needed to drop all tables. + * + * @return string + */ + public function compileDropAllTables() + { + return "delete from sqlite_master where type in ('table', 'index', 'trigger')"; + } + + /** + * Compile the SQL needed to drop all views. + * + * @return string + */ + public function compileDropAllViews() + { + return "delete from sqlite_master where type in ('view')"; + } + + /** + * Compile the SQL needed to rebuild the database. + * + * @return string + */ + public function compileRebuild() + { + return 'vacuum'; + } + + /** + * Compile a drop column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param \Illuminate\Database\Connection $connection + * @return array + */ + public function compileDropColumn(Blueprint $blueprint, Fluent $command, Connection $connection) + { + $tableDiff = $this->getDoctrineTableDiff( + $blueprint, $schema = $connection->getDoctrineSchemaManager() + ); + + foreach ($command->columns as $name) { + $tableDiff->removedColumns[$name] = $connection->getDoctrineColumn( + $this->getTablePrefix().$blueprint->getTable(), $name + ); + } + + return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff); + } + + /** + * Compile a drop unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropUnique(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "drop index {$index}"; + } + + /** + * Compile a drop index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIndex(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "drop index {$index}"; + } + + /** + * Compile a drop spatial index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * + * @throws \RuntimeException + */ + public function compileDropSpatialIndex(Blueprint $blueprint, Fluent $command) + { + throw new RuntimeException('The database driver in use does not support spatial indexes.'); + } + + /** + * Compile a rename table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRename(Blueprint $blueprint, Fluent $command) + { + $from = $this->wrapTable($blueprint); + + return "alter table {$from} rename to ".$this->wrapTable($command->to); + } + + /** + * Compile a rename index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @param \Illuminate\Database\Connection $connection + * @return array + */ + public function compileRenameIndex(Blueprint $blueprint, Fluent $command, Connection $connection) + { + $schemaManager = $connection->getDoctrineSchemaManager(); + + $indexes = $schemaManager->listTableIndexes($this->getTablePrefix().$blueprint->getTable()); + + $index = Arr::get($indexes, $command->from); + + if (! $index) { + throw new RuntimeException("Index [{$command->from}] does not exist."); + } + + $newIndex = new Index( + $command->to, $index->getColumns(), $index->isUnique(), + $index->isPrimary(), $index->getFlags(), $index->getOptions() + ); + + $platform = $schemaManager->getDatabasePlatform(); + + return [ + $platform->getDropIndexSQL($command->from, $this->getTablePrefix().$blueprint->getTable()), + $platform->getCreateIndexSQL($newIndex, $this->getTablePrefix().$blueprint->getTable()), + ]; + } + + /** + * Compile the command to enable foreign key constraints. + * + * @return string + */ + public function compileEnableForeignKeyConstraints() + { + return 'PRAGMA foreign_keys = ON;'; + } + + /** + * Compile the command to disable foreign key constraints. + * + * @return string + */ + public function compileDisableForeignKeyConstraints() + { + return 'PRAGMA foreign_keys = OFF;'; + } + + /** + * Compile the SQL needed to enable a writable schema. + * + * @return string + */ + public function compileEnableWriteableSchema() + { + return 'PRAGMA writable_schema = 1;'; + } + + /** + * Compile the SQL needed to disable a writable schema. + * + * @return string + */ + public function compileDisableWriteableSchema() + { + return 'PRAGMA writable_schema = 0;'; + } + + /** + * Create the column definition for a char type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeChar(Fluent $column) + { + return 'varchar'; + } + + /** + * Create the column definition for a string type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeString(Fluent $column) + { + return 'varchar'; + } + + /** + * Create the column definition for a text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a medium text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a long text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeLongText(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeInteger(Fluent $column) + { + return 'integer'; + } + + /** + * Create the column definition for a big integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBigInteger(Fluent $column) + { + return 'integer'; + } + + /** + * Create the column definition for a medium integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumInteger(Fluent $column) + { + return 'integer'; + } + + /** + * Create the column definition for a tiny integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTinyInteger(Fluent $column) + { + return 'integer'; + } + + /** + * Create the column definition for a small integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeSmallInteger(Fluent $column) + { + return 'integer'; + } + + /** + * Create the column definition for a float type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeFloat(Fluent $column) + { + return 'float'; + } + + /** + * Create the column definition for a double type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDouble(Fluent $column) + { + return 'float'; + } + + /** + * Create the column definition for a decimal type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDecimal(Fluent $column) + { + return 'numeric'; + } + + /** + * Create the column definition for a boolean type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBoolean(Fluent $column) + { + return 'tinyint(1)'; + } + + /** + * Create the column definition for an enumeration type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeEnum(Fluent $column) + { + return sprintf( + 'varchar check ("%s" in (%s))', + $column->name, + $this->quoteString($column->allowed) + ); + } + + /** + * Create the column definition for a json type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJson(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a jsonb type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJsonb(Fluent $column) + { + return 'text'; + } + + /** + * Create the column definition for a date type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDate(Fluent $column) + { + return 'date'; + } + + /** + * Create the column definition for a date-time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTime(Fluent $column) + { + return 'datetime'; + } + + /** + * Create the column definition for a date-time (with time zone) type. + * + * Note: "SQLite does not have a storage class set aside for storing dates and/or times." + * @link https://www.sqlite.org/datatype3.html + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTimeTz(Fluent $column) + { + return $this->typeDateTime($column); + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTime(Fluent $column) + { + return 'time'; + } + + /** + * Create the column definition for a time (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimeTz(Fluent $column) + { + return $this->typeTime($column); + } + + /** + * Create the column definition for a timestamp type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestamp(Fluent $column) + { + return $column->useCurrent ? 'datetime default CURRENT_TIMESTAMP' : 'datetime'; + } + + /** + * Create the column definition for a timestamp (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestampTz(Fluent $column) + { + return $this->typeTimestamp($column); + } + + /** + * Create the column definition for a year type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeYear(Fluent $column) + { + return $this->typeInteger($column); + } + + /** + * Create the column definition for a binary type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBinary(Fluent $column) + { + return 'blob'; + } + + /** + * Create the column definition for a uuid type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeUuid(Fluent $column) + { + return 'varchar'; + } + + /** + * Create the column definition for an IP address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeIpAddress(Fluent $column) + { + return 'varchar'; + } + + /** + * Create the column definition for a MAC address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMacAddress(Fluent $column) + { + return 'varchar'; + } + + /** + * Create the column definition for a spatial Geometry type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeGeometry(Fluent $column) + { + return 'geometry'; + } + + /** + * Create the column definition for a spatial Point type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typePoint(Fluent $column) + { + return 'point'; + } + + /** + * Create the column definition for a spatial LineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeLineString(Fluent $column) + { + return 'linestring'; + } + + /** + * Create the column definition for a spatial Polygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typePolygon(Fluent $column) + { + return 'polygon'; + } + + /** + * Create the column definition for a spatial GeometryCollection type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeGeometryCollection(Fluent $column) + { + return 'geometrycollection'; + } + + /** + * Create the column definition for a spatial MultiPoint type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiPoint(Fluent $column) + { + return 'multipoint'; + } + + /** + * Create the column definition for a spatial MultiLineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiLineString(Fluent $column) + { + return 'multilinestring'; + } + + /** + * Create the column definition for a spatial MultiPolygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiPolygon(Fluent $column) + { + return 'multipolygon'; + } + + /** + * Get the SQL for a nullable column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyNullable(Blueprint $blueprint, Fluent $column) + { + return $column->nullable ? ' null' : ' not null'; + } + + /** + * Get the SQL for a default column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyDefault(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->default)) { + return ' default '.$this->getDefaultValue($column->default); + } + } + + /** + * Get the SQL for an auto-increment column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyIncrement(Blueprint $blueprint, Fluent $column) + { + if (in_array($column->type, $this->serials) && $column->autoIncrement) { + return ' primary key autoincrement'; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php new file mode 100755 index 0000000..38f55fc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php @@ -0,0 +1,804 @@ +getColumns($blueprint)); + + return 'create table '.$this->wrapTable($blueprint)." ($columns)"; + } + + /** + * Compile a column addition table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileAdd(Blueprint $blueprint, Fluent $command) + { + return sprintf('alter table %s add %s', + $this->wrapTable($blueprint), + implode(', ', $this->getColumns($blueprint)) + ); + } + + /** + * Compile a primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compilePrimary(Blueprint $blueprint, Fluent $command) + { + return sprintf('alter table %s add constraint %s primary key (%s)', + $this->wrapTable($blueprint), + $this->wrap($command->index), + $this->columnize($command->columns) + ); + } + + /** + * Compile a unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileUnique(Blueprint $blueprint, Fluent $command) + { + return sprintf('create unique index %s on %s (%s)', + $this->wrap($command->index), + $this->wrapTable($blueprint), + $this->columnize($command->columns) + ); + } + + /** + * Compile a plain index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf('create index %s on %s (%s)', + $this->wrap($command->index), + $this->wrapTable($blueprint), + $this->columnize($command->columns) + ); + } + + /** + * Compile a spatial index key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileSpatialIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf('create spatial index %s on %s (%s)', + $this->wrap($command->index), + $this->wrapTable($blueprint), + $this->columnize($command->columns) + ); + } + + /** + * Compile a drop table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDrop(Blueprint $blueprint, Fluent $command) + { + return 'drop table '.$this->wrapTable($blueprint); + } + + /** + * Compile a drop table (if exists) command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIfExists(Blueprint $blueprint, Fluent $command) + { + return sprintf('if exists (select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME = %s) drop table %s', + "'".str_replace("'", "''", $this->getTablePrefix().$blueprint->getTable())."'", + $this->wrapTable($blueprint) + ); + } + + /** + * Compile the SQL needed to drop all tables. + * + * @return string + */ + public function compileDropAllTables() + { + return "EXEC sp_msforeachtable 'DROP TABLE ?'"; + } + + /** + * Compile a drop column command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropColumn(Blueprint $blueprint, Fluent $command) + { + $columns = $this->wrapArray($command->columns); + + return 'alter table '.$this->wrapTable($blueprint).' drop column '.implode(', ', $columns); + } + + /** + * Compile a drop primary key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropPrimary(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "alter table {$this->wrapTable($blueprint)} drop constraint {$index}"; + } + + /** + * Compile a drop unique key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropUnique(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "drop index {$index} on {$this->wrapTable($blueprint)}"; + } + + /** + * Compile a drop index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropIndex(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "drop index {$index} on {$this->wrapTable($blueprint)}"; + } + + /** + * Compile a drop spatial index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropSpatialIndex(Blueprint $blueprint, Fluent $command) + { + return $this->compileDropIndex($blueprint, $command); + } + + /** + * Compile a drop foreign key command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileDropForeign(Blueprint $blueprint, Fluent $command) + { + $index = $this->wrap($command->index); + + return "alter table {$this->wrapTable($blueprint)} drop constraint {$index}"; + } + + /** + * Compile a rename table command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRename(Blueprint $blueprint, Fluent $command) + { + $from = $this->wrapTable($blueprint); + + return "sp_rename {$from}, ".$this->wrapTable($command->to); + } + + /** + * Compile a rename index command. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $command + * @return string + */ + public function compileRenameIndex(Blueprint $blueprint, Fluent $command) + { + return sprintf("sp_rename N'%s', %s, N'INDEX'", + $this->wrap($blueprint->getTable().'.'.$command->from), + $this->wrap($command->to) + ); + } + + /** + * Compile the command to enable foreign key constraints. + * + * @return string + */ + public function compileEnableForeignKeyConstraints() + { + return 'EXEC sp_msforeachtable @command1="print \'?\'", @command2="ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all";'; + } + + /** + * Compile the command to disable foreign key constraints. + * + * @return string + */ + public function compileDisableForeignKeyConstraints() + { + return 'EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all";'; + } + + /** + * Create the column definition for a char type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeChar(Fluent $column) + { + return "nchar({$column->length})"; + } + + /** + * Create the column definition for a string type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeString(Fluent $column) + { + return "nvarchar({$column->length})"; + } + + /** + * Create the column definition for a text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeText(Fluent $column) + { + return 'nvarchar(max)'; + } + + /** + * Create the column definition for a medium text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumText(Fluent $column) + { + return 'nvarchar(max)'; + } + + /** + * Create the column definition for a long text type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeLongText(Fluent $column) + { + return 'nvarchar(max)'; + } + + /** + * Create the column definition for an integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeInteger(Fluent $column) + { + return 'int'; + } + + /** + * Create the column definition for a big integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBigInteger(Fluent $column) + { + return 'bigint'; + } + + /** + * Create the column definition for a medium integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMediumInteger(Fluent $column) + { + return 'int'; + } + + /** + * Create the column definition for a tiny integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTinyInteger(Fluent $column) + { + return 'tinyint'; + } + + /** + * Create the column definition for a small integer type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeSmallInteger(Fluent $column) + { + return 'smallint'; + } + + /** + * Create the column definition for a float type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeFloat(Fluent $column) + { + return 'float'; + } + + /** + * Create the column definition for a double type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDouble(Fluent $column) + { + return 'float'; + } + + /** + * Create the column definition for a decimal type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDecimal(Fluent $column) + { + return "decimal({$column->total}, {$column->places})"; + } + + /** + * Create the column definition for a boolean type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBoolean(Fluent $column) + { + return 'bit'; + } + + /** + * Create the column definition for an enumeration type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeEnum(Fluent $column) + { + return sprintf( + 'nvarchar(255) check ("%s" in (%s))', + $column->name, + $this->quoteString($column->allowed) + ); + } + + /** + * Create the column definition for a json type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJson(Fluent $column) + { + return 'nvarchar(max)'; + } + + /** + * Create the column definition for a jsonb type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeJsonb(Fluent $column) + { + return 'nvarchar(max)'; + } + + /** + * Create the column definition for a date type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDate(Fluent $column) + { + return 'date'; + } + + /** + * Create the column definition for a date-time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTime(Fluent $column) + { + return $column->precision ? "datetime2($column->precision)" : 'datetime'; + } + + /** + * Create the column definition for a date-time (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeDateTimeTz(Fluent $column) + { + return $column->precision ? "datetimeoffset($column->precision)" : 'datetimeoffset'; + } + + /** + * Create the column definition for a time type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTime(Fluent $column) + { + return $column->precision ? "time($column->precision)" : 'time'; + } + + /** + * Create the column definition for a time (with time zone) type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimeTz(Fluent $column) + { + return $this->typeTime($column); + } + + /** + * Create the column definition for a timestamp type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestamp(Fluent $column) + { + $columnType = $column->precision ? "datetime2($column->precision)" : 'datetime'; + + return $column->useCurrent ? "$columnType default CURRENT_TIMESTAMP" : $columnType; + } + + /** + * Create the column definition for a timestamp (with time zone) type. + * + * @link https://msdn.microsoft.com/en-us/library/bb630289(v=sql.120).aspx + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeTimestampTz(Fluent $column) + { + if ($column->useCurrent) { + $columnType = $column->precision ? "datetimeoffset($column->precision)" : 'datetimeoffset'; + + return "$columnType default CURRENT_TIMESTAMP"; + } + + return "datetimeoffset($column->precision)"; + } + + /** + * Create the column definition for a year type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeYear(Fluent $column) + { + return $this->typeInteger($column); + } + + /** + * Create the column definition for a binary type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeBinary(Fluent $column) + { + return 'varbinary(max)'; + } + + /** + * Create the column definition for a uuid type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeUuid(Fluent $column) + { + return 'uniqueidentifier'; + } + + /** + * Create the column definition for an IP address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeIpAddress(Fluent $column) + { + return 'nvarchar(45)'; + } + + /** + * Create the column definition for a MAC address type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeMacAddress(Fluent $column) + { + return 'nvarchar(17)'; + } + + /** + * Create the column definition for a spatial Geometry type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeGeometry(Fluent $column) + { + return 'geography'; + } + + /** + * Create the column definition for a spatial Point type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typePoint(Fluent $column) + { + return 'geography'; + } + + /** + * Create the column definition for a spatial LineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeLineString(Fluent $column) + { + return 'geography'; + } + + /** + * Create the column definition for a spatial Polygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typePolygon(Fluent $column) + { + return 'geography'; + } + + /** + * Create the column definition for a spatial GeometryCollection type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeGeometryCollection(Fluent $column) + { + return 'geography'; + } + + /** + * Create the column definition for a spatial MultiPoint type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiPoint(Fluent $column) + { + return 'geography'; + } + + /** + * Create the column definition for a spatial MultiLineString type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiLineString(Fluent $column) + { + return 'geography'; + } + + /** + * Create the column definition for a spatial MultiPolygon type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + public function typeMultiPolygon(Fluent $column) + { + return 'geography'; + } + + /** + * Get the SQL for a collation column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyCollate(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->collation)) { + return ' collate '.$column->collation; + } + } + + /** + * Get the SQL for a nullable column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyNullable(Blueprint $blueprint, Fluent $column) + { + return $column->nullable ? ' null' : ' not null'; + } + + /** + * Get the SQL for a default column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyDefault(Blueprint $blueprint, Fluent $column) + { + if (! is_null($column->default)) { + return ' default '.$this->getDefaultValue($column->default); + } + } + + /** + * Get the SQL for an auto-increment column modifier. + * + * @param \Illuminate\Database\Schema\Blueprint $blueprint + * @param \Illuminate\Support\Fluent $column + * @return string|null + */ + protected function modifyIncrement(Blueprint $blueprint, Fluent $column) + { + if (in_array($column->type, $this->serials) && $column->autoIncrement) { + return ' identity primary key'; + } + } + + /** + * Wrap a table in keyword identifiers. + * + * @param \Illuminate\Database\Query\Expression|string $table + * @return string + */ + public function wrapTable($table) + { + if ($table instanceof Blueprint && $table->temporary) { + $this->setTablePrefix('#'); + } + + return parent::wrapTable($table); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php new file mode 100755 index 0000000..85f3e92 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php @@ -0,0 +1,114 @@ +connection->getTablePrefix().$table; + + return count($this->connection->select( + $this->grammar->compileTableExists(), [$this->connection->getDatabaseName(), $table] + )) > 0; + } + + /** + * Get the column listing for a given table. + * + * @param string $table + * @return array + */ + public function getColumnListing($table) + { + $table = $this->connection->getTablePrefix().$table; + + $results = $this->connection->select( + $this->grammar->compileColumnListing(), [$this->connection->getDatabaseName(), $table] + ); + + return $this->connection->getPostProcessor()->processColumnListing($results); + } + + /** + * Drop all tables from the database. + * + * @return void + */ + public function dropAllTables() + { + $tables = []; + + foreach ($this->getAllTables() as $row) { + $row = (array) $row; + + $tables[] = reset($row); + } + + if (empty($tables)) { + return; + } + + $this->disableForeignKeyConstraints(); + + $this->connection->statement( + $this->grammar->compileDropAllTables($tables) + ); + + $this->enableForeignKeyConstraints(); + } + + /** + * Drop all views from the database. + * + * @return void + */ + public function dropAllViews() + { + $views = []; + + foreach ($this->getAllViews() as $row) { + $row = (array) $row; + + $views[] = reset($row); + } + + if (empty($views)) { + return; + } + + $this->connection->statement( + $this->grammar->compileDropAllViews($views) + ); + } + + /** + * Get all of the table names for the database. + * + * @return array + */ + protected function getAllTables() + { + return $this->connection->select( + $this->grammar->compileGetAllTables() + ); + } + + /** + * Get all of the view names for the database. + * + * @return array + */ + protected function getAllViews() + { + return $this->connection->select( + $this->grammar->compileGetAllViews() + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/PostgresBuilder.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/PostgresBuilder.php new file mode 100755 index 0000000..bdeb972 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/PostgresBuilder.php @@ -0,0 +1,141 @@ +parseSchemaAndTable($table); + + $table = $this->connection->getTablePrefix().$table; + + return count($this->connection->select( + $this->grammar->compileTableExists(), [$schema, $table] + )) > 0; + } + + /** + * Drop all tables from the database. + * + * @return void + */ + public function dropAllTables() + { + $tables = []; + + $excludedTables = ['spatial_ref_sys']; + + foreach ($this->getAllTables() as $row) { + $row = (array) $row; + + $table = reset($row); + + if (! in_array($table, $excludedTables)) { + $tables[] = $table; + } + } + + if (empty($tables)) { + return; + } + + $this->connection->statement( + $this->grammar->compileDropAllTables($tables) + ); + } + + /** + * Drop all views from the database. + * + * @return void + */ + public function dropAllViews() + { + $views = []; + + foreach ($this->getAllViews() as $row) { + $row = (array) $row; + + $views[] = reset($row); + } + + if (empty($views)) { + return; + } + + $this->connection->statement( + $this->grammar->compileDropAllViews($views) + ); + } + + /** + * Get all of the table names for the database. + * + * @return array + */ + protected function getAllTables() + { + return $this->connection->select( + $this->grammar->compileGetAllTables($this->connection->getConfig('schema')) + ); + } + + /** + * Get all of the view names for the database. + * + * @return array + */ + protected function getAllViews() + { + return $this->connection->select( + $this->grammar->compileGetAllViews($this->connection->getConfig('schema')) + ); + } + + /** + * Get the column listing for a given table. + * + * @param string $table + * @return array + */ + public function getColumnListing($table) + { + [$schema, $table] = $this->parseSchemaAndTable($table); + + $table = $this->connection->getTablePrefix().$table; + + $results = $this->connection->select( + $this->grammar->compileColumnListing(), [$schema, $table] + ); + + return $this->connection->getPostProcessor()->processColumnListing($results); + } + + /** + * Parse the table name and extract the schema and table. + * + * @param string $table + * @return array + */ + protected function parseSchemaAndTable($table) + { + $table = explode('.', $table); + + if (is_array($schema = $this->connection->getConfig('schema'))) { + if (in_array($table[0], $schema)) { + return [array_shift($table), implode('.', $table)]; + } + + $schema = head($schema); + } + + return [$schema ?: 'public', implode('.', $table)]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/SQLiteBuilder.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/SQLiteBuilder.php new file mode 100644 index 0000000..78b6b9c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/SQLiteBuilder.php @@ -0,0 +1,52 @@ +connection->getDatabaseName() !== ':memory:') { + return $this->refreshDatabaseFile(); + } + + $this->connection->select($this->grammar->compileEnableWriteableSchema()); + + $this->connection->select($this->grammar->compileDropAllTables()); + + $this->connection->select($this->grammar->compileDisableWriteableSchema()); + + $this->connection->select($this->grammar->compileRebuild()); + } + + /** + * Drop all views from the database. + * + * @return void + */ + public function dropAllViews() + { + $this->connection->select($this->grammar->compileEnableWriteableSchema()); + + $this->connection->select($this->grammar->compileDropAllViews()); + + $this->connection->select($this->grammar->compileDisableWriteableSchema()); + + $this->connection->select($this->grammar->compileRebuild()); + } + + /** + * Empty the database file. + * + * @return void + */ + public function refreshDatabaseFile() + { + file_put_contents($this->connection->getDatabaseName(), ''); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Schema/SqlServerBuilder.php b/vendor/laravel/framework/src/Illuminate/Database/Schema/SqlServerBuilder.php new file mode 100644 index 0000000..2c54282 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Schema/SqlServerBuilder.php @@ -0,0 +1,20 @@ +disableForeignKeyConstraints(); + + $this->connection->statement($this->grammar->compileDropAllTables()); + + $this->enableForeignKeyConstraints(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/Seeder.php b/vendor/laravel/framework/src/Illuminate/Database/Seeder.php new file mode 100755 index 0000000..f8675ea --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/Seeder.php @@ -0,0 +1,125 @@ +command)) { + $this->command->getOutput()->writeln("Seeding: $class"); + } + + $this->resolve($class)->__invoke(); + } + + return $this; + } + + /** + * Silently seed the given connection from the given path. + * + * @param array|string $class + * @return void + */ + public function callSilent($class) + { + $this->call($class, true); + } + + /** + * Resolve an instance of the given seeder class. + * + * @param string $class + * @return \Illuminate\Database\Seeder + */ + protected function resolve($class) + { + if (isset($this->container)) { + $instance = $this->container->make($class); + + $instance->setContainer($this->container); + } else { + $instance = new $class; + } + + if (isset($this->command)) { + $instance->setCommand($this->command); + } + + return $instance; + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Container\Container $container + * @return $this + */ + public function setContainer(Container $container) + { + $this->container = $container; + + return $this; + } + + /** + * Set the console command instance. + * + * @param \Illuminate\Console\Command $command + * @return $this + */ + public function setCommand(Command $command) + { + $this->command = $command; + + return $this; + } + + /** + * Run the database seeds. + * + * @return dynamic + * + * @throws \InvalidArgumentException + */ + public function __invoke() + { + if (! method_exists($this, 'run')) { + throw new InvalidArgumentException('Method [run] missing from '.get_class($this)); + } + + return isset($this->container) + ? $this->container->call([$this, 'run']) + : $this->run(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/SqlServerConnection.php b/vendor/laravel/framework/src/Illuminate/Database/SqlServerConnection.php new file mode 100755 index 0000000..db5a0be --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/SqlServerConnection.php @@ -0,0 +1,113 @@ +getDriverName() === 'sqlsrv') { + return parent::transaction($callback); + } + + $this->getPdo()->exec('BEGIN TRAN'); + + // We'll simply execute the given callback within a try / catch block + // and if we catch any exception we can rollback the transaction + // so that none of the changes are persisted to the database. + try { + $result = $callback($this); + + $this->getPdo()->exec('COMMIT TRAN'); + } + + // If we catch an exception, we will roll back so nothing gets messed + // up in the database. Then we'll re-throw the exception so it can + // be handled how the developer sees fit for their applications. + catch (Exception $e) { + $this->getPdo()->exec('ROLLBACK TRAN'); + + throw $e; + } catch (Throwable $e) { + $this->getPdo()->exec('ROLLBACK TRAN'); + + throw $e; + } + + return $result; + } + } + + /** + * Get the default query grammar instance. + * + * @return \Illuminate\Database\Query\Grammars\SqlServerGrammar + */ + protected function getDefaultQueryGrammar() + { + return $this->withTablePrefix(new QueryGrammar); + } + + /** + * Get a schema builder instance for the connection. + * + * @return \Illuminate\Database\Schema\SqlServerBuilder + */ + public function getSchemaBuilder() + { + if (is_null($this->schemaGrammar)) { + $this->useDefaultSchemaGrammar(); + } + + return new SqlServerBuilder($this); + } + + /** + * Get the default schema grammar instance. + * + * @return \Illuminate\Database\Schema\Grammars\SqlServerGrammar + */ + protected function getDefaultSchemaGrammar() + { + return $this->withTablePrefix(new SchemaGrammar); + } + + /** + * Get the default post processor instance. + * + * @return \Illuminate\Database\Query\Processors\SqlServerProcessor + */ + protected function getDefaultPostProcessor() + { + return new SqlServerProcessor; + } + + /** + * Get the Doctrine DBAL driver. + * + * @return \Doctrine\DBAL\Driver\PDOSqlsrv\Driver + */ + protected function getDoctrineDriver() + { + return new DoctrineDriver; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Database/composer.json b/vendor/laravel/framework/src/Illuminate/Database/composer.json new file mode 100644 index 0000000..81ef3b4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Database/composer.json @@ -0,0 +1,45 @@ +{ + "name": "illuminate/database", + "description": "The Illuminate Database package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "keywords": ["laravel", "database", "sql", "orm"], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/container": "5.7.*", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*" + }, + "autoload": { + "psr-4": { + "Illuminate\\Database\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "suggest": { + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "fzaninotto/faker": "Required to use the eloquent factory builder (^1.4).", + "illuminate/console": "Required to use the database commands (5.7.*).", + "illuminate/events": "Required to use the observers with Eloquent (5.7.*).", + "illuminate/filesystem": "Required to use the migrations (5.7.*).", + "illuminate/pagination": "Required to paginate the result set (5.7.*)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php b/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php new file mode 100755 index 0000000..d4a1822 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php @@ -0,0 +1,251 @@ +key = $key; + $this->cipher = $cipher; + } else { + throw new RuntimeException('The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.'); + } + } + + /** + * Determine if the given key and cipher combination is valid. + * + * @param string $key + * @param string $cipher + * @return bool + */ + public static function supported($key, $cipher) + { + $length = mb_strlen($key, '8bit'); + + return ($cipher === 'AES-128-CBC' && $length === 16) || + ($cipher === 'AES-256-CBC' && $length === 32); + } + + /** + * Create a new encryption key for the given cipher. + * + * @param string $cipher + * @return string + */ + public static function generateKey($cipher) + { + return random_bytes($cipher === 'AES-128-CBC' ? 16 : 32); + } + + /** + * Encrypt the given value. + * + * @param mixed $value + * @param bool $serialize + * @return string + * + * @throws \Illuminate\Contracts\Encryption\EncryptException + */ + public function encrypt($value, $serialize = true) + { + $iv = random_bytes(openssl_cipher_iv_length($this->cipher)); + + // First we will encrypt the value using OpenSSL. After this is encrypted we + // will proceed to calculating a MAC for the encrypted value so that this + // value can be verified later as not having been changed by the users. + $value = \openssl_encrypt( + $serialize ? serialize($value) : $value, + $this->cipher, $this->key, 0, $iv + ); + + if ($value === false) { + throw new EncryptException('Could not encrypt the data.'); + } + + // Once we get the encrypted value we'll go ahead and base64_encode the input + // vector and create the MAC for the encrypted value so we can then verify + // its authenticity. Then, we'll JSON the data into the "payload" array. + $mac = $this->hash($iv = base64_encode($iv), $value); + + $json = json_encode(compact('iv', 'value', 'mac')); + + if (json_last_error() !== JSON_ERROR_NONE) { + throw new EncryptException('Could not encrypt the data.'); + } + + return base64_encode($json); + } + + /** + * Encrypt a string without serialization. + * + * @param string $value + * @return string + */ + public function encryptString($value) + { + return $this->encrypt($value, false); + } + + /** + * Decrypt the given value. + * + * @param mixed $payload + * @param bool $unserialize + * @return mixed + * + * @throws \Illuminate\Contracts\Encryption\DecryptException + */ + public function decrypt($payload, $unserialize = true) + { + $payload = $this->getJsonPayload($payload); + + $iv = base64_decode($payload['iv']); + + // Here we will decrypt the value. If we are able to successfully decrypt it + // we will then unserialize it and return it out to the caller. If we are + // unable to decrypt this value we will throw out an exception message. + $decrypted = \openssl_decrypt( + $payload['value'], $this->cipher, $this->key, 0, $iv + ); + + if ($decrypted === false) { + throw new DecryptException('Could not decrypt the data.'); + } + + return $unserialize ? unserialize($decrypted) : $decrypted; + } + + /** + * Decrypt the given string without unserialization. + * + * @param string $payload + * @return string + */ + public function decryptString($payload) + { + return $this->decrypt($payload, false); + } + + /** + * Create a MAC for the given value. + * + * @param string $iv + * @param mixed $value + * @return string + */ + protected function hash($iv, $value) + { + return hash_hmac('sha256', $iv.$value, $this->key); + } + + /** + * Get the JSON array from the given payload. + * + * @param string $payload + * @return array + * + * @throws \Illuminate\Contracts\Encryption\DecryptException + */ + protected function getJsonPayload($payload) + { + $payload = json_decode(base64_decode($payload), true); + + // If the payload is not valid JSON or does not have the proper keys set we will + // assume it is invalid and bail out of the routine since we will not be able + // to decrypt the given value. We'll also check the MAC for this encryption. + if (! $this->validPayload($payload)) { + throw new DecryptException('The payload is invalid.'); + } + + if (! $this->validMac($payload)) { + throw new DecryptException('The MAC is invalid.'); + } + + return $payload; + } + + /** + * Verify that the encryption payload is valid. + * + * @param mixed $payload + * @return bool + */ + protected function validPayload($payload) + { + return is_array($payload) && isset($payload['iv'], $payload['value'], $payload['mac']) && + strlen(base64_decode($payload['iv'], true)) === openssl_cipher_iv_length($this->cipher); + } + + /** + * Determine if the MAC for the given payload is valid. + * + * @param array $payload + * @return bool + */ + protected function validMac(array $payload) + { + $calculated = $this->calculateMac($payload, $bytes = random_bytes(16)); + + return hash_equals( + hash_hmac('sha256', $payload['mac'], $bytes, true), $calculated + ); + } + + /** + * Calculate the hash of the given payload. + * + * @param array $payload + * @param string $bytes + * @return string + */ + protected function calculateMac($payload, $bytes) + { + return hash_hmac( + 'sha256', $this->hash($payload['iv'], $payload['value']), $bytes, true + ); + } + + /** + * Get the encryption key. + * + * @return string + */ + public function getKey() + { + return $this->key; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php new file mode 100755 index 0000000..ad7b93d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php @@ -0,0 +1,50 @@ +app->singleton('encrypter', function ($app) { + $config = $app->make('config')->get('app'); + + // If the key starts with "base64:", we will need to decode the key before handing + // it off to the encrypter. Keys may be base-64 encoded for presentation and we + // want to make sure to convert them back to the raw bytes before encrypting. + if (Str::startsWith($key = $this->key($config), 'base64:')) { + $key = base64_decode(substr($key, 7)); + } + + return new Encrypter($key, $config['cipher']); + }); + } + + /** + * Extract the encryption key from the given configuration. + * + * @param array $config + * @return string + * + * @throws \RuntimeException + */ + protected function key(array $config) + { + return tap($config['key'], function ($key) { + if (empty($key)) { + throw new RuntimeException( + 'No application encryption key has been specified.' + ); + } + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Encryption/composer.json b/vendor/laravel/framework/src/Illuminate/Encryption/composer.json new file mode 100644 index 0000000..09eb4c7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Encryption/composer.json @@ -0,0 +1,37 @@ +{ + "name": "illuminate/encryption", + "description": "The Illuminate Encryption package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "ext-mbstring": "*", + "ext-openssl": "*", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*" + }, + "autoload": { + "psr-4": { + "Illuminate\\Encryption\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Events/CallQueuedListener.php b/vendor/laravel/framework/src/Illuminate/Events/CallQueuedListener.php new file mode 100644 index 0000000..be0fee3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Events/CallQueuedListener.php @@ -0,0 +1,160 @@ +data = $data; + $this->class = $class; + $this->method = $method; + } + + /** + * Handle the queued job. + * + * @param \Illuminate\Container\Container $container + * @return void + */ + public function handle(Container $container) + { + $this->prepareData(); + + $handler = $this->setJobInstanceIfNecessary( + $this->job, $container->make($this->class) + ); + + call_user_func_array( + [$handler, $this->method], $this->data + ); + } + + /** + * Set the job instance of the given class if necessary. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param mixed $instance + * @return mixed + */ + protected function setJobInstanceIfNecessary(Job $job, $instance) + { + if (in_array(InteractsWithQueue::class, class_uses_recursive($instance))) { + $instance->setJob($job); + } + + return $instance; + } + + /** + * Call the failed method on the job instance. + * + * The event instance and the exception will be passed. + * + * @param \Exception $e + * @return void + */ + public function failed($e) + { + $this->prepareData(); + + $handler = Container::getInstance()->make($this->class); + + $parameters = array_merge($this->data, [$e]); + + if (method_exists($handler, 'failed')) { + call_user_func_array([$handler, 'failed'], $parameters); + } + } + + /** + * Unserialize the data if needed. + * + * @return void + */ + protected function prepareData() + { + if (is_string($this->data)) { + $this->data = unserialize($this->data); + } + } + + /** + * Get the display name for the queued job. + * + * @return string + */ + public function displayName() + { + return $this->class; + } + + /** + * Prepare the instance for cloning. + * + * @return void + */ + public function __clone() + { + $this->data = array_map(function ($data) { + return is_object($data) ? clone $data : $data; + }, $this->data); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php b/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php new file mode 100755 index 0000000..8fb73ba --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php @@ -0,0 +1,573 @@ +container = $container ?: new Container; + } + + /** + * Register an event listener with the dispatcher. + * + * @param string|array $events + * @param mixed $listener + * @return void + */ + public function listen($events, $listener) + { + foreach ((array) $events as $event) { + if (Str::contains($event, '*')) { + $this->setupWildcardListen($event, $listener); + } else { + $this->listeners[$event][] = $this->makeListener($listener); + } + } + } + + /** + * Setup a wildcard listener callback. + * + * @param string $event + * @param mixed $listener + * @return void + */ + protected function setupWildcardListen($event, $listener) + { + $this->wildcards[$event][] = $this->makeListener($listener, true); + + $this->wildcardsCache = []; + } + + /** + * Determine if a given event has listeners. + * + * @param string $eventName + * @return bool + */ + public function hasListeners($eventName) + { + return isset($this->listeners[$eventName]) || isset($this->wildcards[$eventName]); + } + + /** + * Register an event and payload to be fired later. + * + * @param string $event + * @param array $payload + * @return void + */ + public function push($event, $payload = []) + { + $this->listen($event.'_pushed', function () use ($event, $payload) { + $this->dispatch($event, $payload); + }); + } + + /** + * Flush a set of pushed events. + * + * @param string $event + * @return void + */ + public function flush($event) + { + $this->dispatch($event.'_pushed'); + } + + /** + * Register an event subscriber with the dispatcher. + * + * @param object|string $subscriber + * @return void + */ + public function subscribe($subscriber) + { + $subscriber = $this->resolveSubscriber($subscriber); + + $subscriber->subscribe($this); + } + + /** + * Resolve the subscriber instance. + * + * @param object|string $subscriber + * @return mixed + */ + protected function resolveSubscriber($subscriber) + { + if (is_string($subscriber)) { + return $this->container->make($subscriber); + } + + return $subscriber; + } + + /** + * Fire an event until the first non-null response is returned. + * + * @param string|object $event + * @param mixed $payload + * @return array|null + */ + public function until($event, $payload = []) + { + return $this->dispatch($event, $payload, true); + } + + /** + * Fire an event and call the listeners. + * + * @param string|object $event + * @param mixed $payload + * @param bool $halt + * @return array|null + */ + public function fire($event, $payload = [], $halt = false) + { + return $this->dispatch($event, $payload, $halt); + } + + /** + * Fire an event and call the listeners. + * + * @param string|object $event + * @param mixed $payload + * @param bool $halt + * @return array|null + */ + public function dispatch($event, $payload = [], $halt = false) + { + // When the given "event" is actually an object we will assume it is an event + // object and use the class as the event name and this event itself as the + // payload to the handler, which makes object based events quite simple. + [$event, $payload] = $this->parseEventAndPayload( + $event, $payload + ); + + if ($this->shouldBroadcast($payload)) { + $this->broadcastEvent($payload[0]); + } + + $responses = []; + + foreach ($this->getListeners($event) as $listener) { + $response = $listener($event, $payload); + + // If a response is returned from the listener and event halting is enabled + // we will just return this response, and not call the rest of the event + // listeners. Otherwise we will add the response on the response list. + if ($halt && ! is_null($response)) { + return $response; + } + + // If a boolean false is returned from a listener, we will stop propagating + // the event to any further listeners down in the chain, else we keep on + // looping through the listeners and firing every one in our sequence. + if ($response === false) { + break; + } + + $responses[] = $response; + } + + return $halt ? null : $responses; + } + + /** + * Parse the given event and payload and prepare them for dispatching. + * + * @param mixed $event + * @param mixed $payload + * @return array + */ + protected function parseEventAndPayload($event, $payload) + { + if (is_object($event)) { + [$payload, $event] = [[$event], get_class($event)]; + } + + return [$event, Arr::wrap($payload)]; + } + + /** + * Determine if the payload has a broadcastable event. + * + * @param array $payload + * @return bool + */ + protected function shouldBroadcast(array $payload) + { + return isset($payload[0]) && + $payload[0] instanceof ShouldBroadcast && + $this->broadcastWhen($payload[0]); + } + + /** + * Check if event should be broadcasted by condition. + * + * @param mixed $event + * @return bool + */ + protected function broadcastWhen($event) + { + return method_exists($event, 'broadcastWhen') + ? $event->broadcastWhen() : true; + } + + /** + * Broadcast the given event class. + * + * @param \Illuminate\Contracts\Broadcasting\ShouldBroadcast $event + * @return void + */ + protected function broadcastEvent($event) + { + $this->container->make(BroadcastFactory::class)->queue($event); + } + + /** + * Get all of the listeners for a given event name. + * + * @param string $eventName + * @return array + */ + public function getListeners($eventName) + { + $listeners = $this->listeners[$eventName] ?? []; + + $listeners = array_merge( + $listeners, + $this->wildcardsCache[$eventName] ?? $this->getWildcardListeners($eventName) + ); + + return class_exists($eventName, false) + ? $this->addInterfaceListeners($eventName, $listeners) + : $listeners; + } + + /** + * Get the wildcard listeners for the event. + * + * @param string $eventName + * @return array + */ + protected function getWildcardListeners($eventName) + { + $wildcards = []; + + foreach ($this->wildcards as $key => $listeners) { + if (Str::is($key, $eventName)) { + $wildcards = array_merge($wildcards, $listeners); + } + } + + return $this->wildcardsCache[$eventName] = $wildcards; + } + + /** + * Add the listeners for the event's interfaces to the given array. + * + * @param string $eventName + * @param array $listeners + * @return array + */ + protected function addInterfaceListeners($eventName, array $listeners = []) + { + foreach (class_implements($eventName) as $interface) { + if (isset($this->listeners[$interface])) { + foreach ($this->listeners[$interface] as $names) { + $listeners = array_merge($listeners, (array) $names); + } + } + } + + return $listeners; + } + + /** + * Register an event listener with the dispatcher. + * + * @param \Closure|string $listener + * @param bool $wildcard + * @return \Closure + */ + public function makeListener($listener, $wildcard = false) + { + if (is_string($listener)) { + return $this->createClassListener($listener, $wildcard); + } + + return function ($event, $payload) use ($listener, $wildcard) { + if ($wildcard) { + return $listener($event, $payload); + } + + return $listener(...array_values($payload)); + }; + } + + /** + * Create a class based listener using the IoC container. + * + * @param string $listener + * @param bool $wildcard + * @return \Closure + */ + public function createClassListener($listener, $wildcard = false) + { + return function ($event, $payload) use ($listener, $wildcard) { + if ($wildcard) { + return call_user_func($this->createClassCallable($listener), $event, $payload); + } + + return call_user_func_array( + $this->createClassCallable($listener), $payload + ); + }; + } + + /** + * Create the class based event callable. + * + * @param string $listener + * @return callable + */ + protected function createClassCallable($listener) + { + [$class, $method] = $this->parseClassCallable($listener); + + if ($this->handlerShouldBeQueued($class)) { + return $this->createQueuedHandlerCallable($class, $method); + } + + return [$this->container->make($class), $method]; + } + + /** + * Parse the class listener into class and method. + * + * @param string $listener + * @return array + */ + protected function parseClassCallable($listener) + { + return Str::parseCallback($listener, 'handle'); + } + + /** + * Determine if the event handler class should be queued. + * + * @param string $class + * @return bool + */ + protected function handlerShouldBeQueued($class) + { + try { + return (new ReflectionClass($class))->implementsInterface( + ShouldQueue::class + ); + } catch (Exception $e) { + return false; + } + } + + /** + * Create a callable for putting an event handler on the queue. + * + * @param string $class + * @param string $method + * @return \Closure + */ + protected function createQueuedHandlerCallable($class, $method) + { + return function () use ($class, $method) { + $arguments = array_map(function ($a) { + return is_object($a) ? clone $a : $a; + }, func_get_args()); + + if ($this->handlerWantsToBeQueued($class, $arguments)) { + $this->queueHandler($class, $method, $arguments); + } + }; + } + + /** + * Determine if the event handler wants to be queued. + * + * @param string $class + * @param array $arguments + * @return bool + */ + protected function handlerWantsToBeQueued($class, $arguments) + { + if (method_exists($class, 'shouldQueue')) { + return $this->container->make($class)->shouldQueue($arguments[0]); + } + + return true; + } + + /** + * Queue the handler class. + * + * @param string $class + * @param string $method + * @param array $arguments + * @return void + */ + protected function queueHandler($class, $method, $arguments) + { + [$listener, $job] = $this->createListenerAndJob($class, $method, $arguments); + + $connection = $this->resolveQueue()->connection( + $listener->connection ?? null + ); + + $queue = $listener->queue ?? null; + + isset($listener->delay) + ? $connection->laterOn($queue, $listener->delay, $job) + : $connection->pushOn($queue, $job); + } + + /** + * Create the listener and job for a queued listener. + * + * @param string $class + * @param string $method + * @param array $arguments + * @return array + */ + protected function createListenerAndJob($class, $method, $arguments) + { + $listener = (new ReflectionClass($class))->newInstanceWithoutConstructor(); + + return [$listener, $this->propagateListenerOptions( + $listener, new CallQueuedListener($class, $method, $arguments) + )]; + } + + /** + * Propagate listener options to the job. + * + * @param mixed $listener + * @param mixed $job + * @return mixed + */ + protected function propagateListenerOptions($listener, $job) + { + return tap($job, function ($job) use ($listener) { + $job->tries = $listener->tries ?? null; + $job->timeout = $listener->timeout ?? null; + $job->timeoutAt = method_exists($listener, 'retryUntil') + ? $listener->retryUntil() : null; + }); + } + + /** + * Remove a set of listeners from the dispatcher. + * + * @param string $event + * @return void + */ + public function forget($event) + { + if (Str::contains($event, '*')) { + unset($this->wildcards[$event]); + } else { + unset($this->listeners[$event]); + } + } + + /** + * Forget all of the pushed listeners. + * + * @return void + */ + public function forgetPushed() + { + foreach ($this->listeners as $key => $value) { + if (Str::endsWith($key, '_pushed')) { + $this->forget($key); + } + } + } + + /** + * Get the queue implementation from the resolver. + * + * @return \Illuminate\Contracts\Queue\Queue + */ + protected function resolveQueue() + { + return call_user_func($this->queueResolver); + } + + /** + * Set the queue resolver implementation. + * + * @param callable $resolver + * @return $this + */ + public function setQueueResolver(callable $resolver) + { + $this->queueResolver = $resolver; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Events/EventServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Events/EventServiceProvider.php new file mode 100755 index 0000000..fa3ed6f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Events/EventServiceProvider.php @@ -0,0 +1,23 @@ +app->singleton('events', function ($app) { + return (new Dispatcher($app))->setQueueResolver(function () use ($app) { + return $app->make(QueueFactoryContract::class); + }); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Events/composer.json b/vendor/laravel/framework/src/Illuminate/Events/composer.json new file mode 100755 index 0000000..cba2e0f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Events/composer.json @@ -0,0 +1,36 @@ +{ + "name": "illuminate/events", + "description": "The Illuminate Events package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/container": "5.7.*", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*" + }, + "autoload": { + "psr-4": { + "Illuminate\\Events\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Filesystem/Cache.php b/vendor/laravel/framework/src/Illuminate/Filesystem/Cache.php new file mode 100644 index 0000000..deb5fe5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Filesystem/Cache.php @@ -0,0 +1,77 @@ +key = $key; + $this->repository = $repository; + + if (! is_null($expire)) { + $this->expire = (int) ceil($expire / 60); + } + } + + /** + * Load the cache. + * + * @return void + */ + public function load() + { + $contents = $this->repository->get($this->key); + + if (! is_null($contents)) { + $this->setFromStorage($contents); + } + } + + /** + * Persist the cache. + * + * @return void + */ + public function save() + { + $contents = $this->getForStorage(); + + if (! is_null($this->expire)) { + $this->repository->put($this->key, $contents, $this->expire); + } else { + $this->repository->forever($this->key, $contents); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php b/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php new file mode 100644 index 0000000..6f80105 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php @@ -0,0 +1,609 @@ +isFile($path)) { + return $lock ? $this->sharedGet($path) : file_get_contents($path); + } + + throw new FileNotFoundException("File does not exist at path {$path}"); + } + + /** + * Get contents of a file with shared access. + * + * @param string $path + * @return string + */ + public function sharedGet($path) + { + $contents = ''; + + $handle = fopen($path, 'rb'); + + if ($handle) { + try { + if (flock($handle, LOCK_SH)) { + clearstatcache(true, $path); + + $contents = fread($handle, $this->size($path) ?: 1); + + flock($handle, LOCK_UN); + } + } finally { + fclose($handle); + } + } + + return $contents; + } + + /** + * Get the returned value of a file. + * + * @param string $path + * @return mixed + * + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + */ + public function getRequire($path) + { + if ($this->isFile($path)) { + return require $path; + } + + throw new FileNotFoundException("File does not exist at path {$path}"); + } + + /** + * Require the given file once. + * + * @param string $file + * @return mixed + */ + public function requireOnce($file) + { + require_once $file; + } + + /** + * Get the MD5 hash of the file at the given path. + * + * @param string $path + * @return string + */ + public function hash($path) + { + return md5_file($path); + } + + /** + * Write the contents of a file. + * + * @param string $path + * @param string $contents + * @param bool $lock + * @return int + */ + public function put($path, $contents, $lock = false) + { + return file_put_contents($path, $contents, $lock ? LOCK_EX : 0); + } + + /** + * Write the contents of a file, replacing it atomically if it already exists. + * + * @param string $path + * @param string $content + * @return void + */ + public function replace($path, $content) + { + // If the path already exists and is a symlink, get the real path... + clearstatcache(true, $path); + + $path = realpath($path) ?: $path; + + $tempPath = tempnam(dirname($path), basename($path)); + + // Fix permissions of tempPath because `tempnam()` creates it with permissions set to 0600... + chmod($tempPath, 0777 - umask()); + + file_put_contents($tempPath, $content); + + rename($tempPath, $path); + } + + /** + * Prepend to a file. + * + * @param string $path + * @param string $data + * @return int + */ + public function prepend($path, $data) + { + if ($this->exists($path)) { + return $this->put($path, $data.$this->get($path)); + } + + return $this->put($path, $data); + } + + /** + * Append to a file. + * + * @param string $path + * @param string $data + * @return int + */ + public function append($path, $data) + { + return file_put_contents($path, $data, FILE_APPEND); + } + + /** + * Get or set UNIX mode of a file or directory. + * + * @param string $path + * @param int $mode + * @return mixed + */ + public function chmod($path, $mode = null) + { + if ($mode) { + return chmod($path, $mode); + } + + return substr(sprintf('%o', fileperms($path)), -4); + } + + /** + * Delete the file at a given path. + * + * @param string|array $paths + * @return bool + */ + public function delete($paths) + { + $paths = is_array($paths) ? $paths : func_get_args(); + + $success = true; + + foreach ($paths as $path) { + try { + if (! @unlink($path)) { + $success = false; + } + } catch (ErrorException $e) { + $success = false; + } + } + + return $success; + } + + /** + * Move a file to a new location. + * + * @param string $path + * @param string $target + * @return bool + */ + public function move($path, $target) + { + return rename($path, $target); + } + + /** + * Copy a file to a new location. + * + * @param string $path + * @param string $target + * @return bool + */ + public function copy($path, $target) + { + return copy($path, $target); + } + + /** + * Create a hard link to the target file or directory. + * + * @param string $target + * @param string $link + * @return void + */ + public function link($target, $link) + { + if (! windows_os()) { + return symlink($target, $link); + } + + $mode = $this->isDirectory($target) ? 'J' : 'H'; + + exec("mklink /{$mode} \"{$link}\" \"{$target}\""); + } + + /** + * Extract the file name from a file path. + * + * @param string $path + * @return string + */ + public function name($path) + { + return pathinfo($path, PATHINFO_FILENAME); + } + + /** + * Extract the trailing name component from a file path. + * + * @param string $path + * @return string + */ + public function basename($path) + { + return pathinfo($path, PATHINFO_BASENAME); + } + + /** + * Extract the parent directory from a file path. + * + * @param string $path + * @return string + */ + public function dirname($path) + { + return pathinfo($path, PATHINFO_DIRNAME); + } + + /** + * Extract the file extension from a file path. + * + * @param string $path + * @return string + */ + public function extension($path) + { + return pathinfo($path, PATHINFO_EXTENSION); + } + + /** + * Get the file type of a given file. + * + * @param string $path + * @return string + */ + public function type($path) + { + return filetype($path); + } + + /** + * Get the mime-type of a given file. + * + * @param string $path + * @return string|false + */ + public function mimeType($path) + { + return finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path); + } + + /** + * Get the file size of a given file. + * + * @param string $path + * @return int + */ + public function size($path) + { + return filesize($path); + } + + /** + * Get the file's last modification time. + * + * @param string $path + * @return int + */ + public function lastModified($path) + { + return filemtime($path); + } + + /** + * Determine if the given path is a directory. + * + * @param string $directory + * @return bool + */ + public function isDirectory($directory) + { + return is_dir($directory); + } + + /** + * Determine if the given path is readable. + * + * @param string $path + * @return bool + */ + public function isReadable($path) + { + return is_readable($path); + } + + /** + * Determine if the given path is writable. + * + * @param string $path + * @return bool + */ + public function isWritable($path) + { + return is_writable($path); + } + + /** + * Determine if the given path is a file. + * + * @param string $file + * @return bool + */ + public function isFile($file) + { + return is_file($file); + } + + /** + * Find path names matching a given pattern. + * + * @param string $pattern + * @param int $flags + * @return array + */ + public function glob($pattern, $flags = 0) + { + return glob($pattern, $flags); + } + + /** + * Get an array of all files in a directory. + * + * @param string $directory + * @param bool $hidden + * @return \Symfony\Component\Finder\SplFileInfo[] + */ + public function files($directory, $hidden = false) + { + return iterator_to_array( + Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->depth(0)->sortByName(), + false + ); + } + + /** + * Get all of the files from the given directory (recursive). + * + * @param string $directory + * @param bool $hidden + * @return \Symfony\Component\Finder\SplFileInfo[] + */ + public function allFiles($directory, $hidden = false) + { + return iterator_to_array( + Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->sortByName(), + false + ); + } + + /** + * Get all of the directories within a given directory. + * + * @param string $directory + * @return array + */ + public function directories($directory) + { + $directories = []; + + foreach (Finder::create()->in($directory)->directories()->depth(0)->sortByName() as $dir) { + $directories[] = $dir->getPathname(); + } + + return $directories; + } + + /** + * Create a directory. + * + * @param string $path + * @param int $mode + * @param bool $recursive + * @param bool $force + * @return bool + */ + public function makeDirectory($path, $mode = 0755, $recursive = false, $force = false) + { + if ($force) { + return @mkdir($path, $mode, $recursive); + } + + return mkdir($path, $mode, $recursive); + } + + /** + * Move a directory. + * + * @param string $from + * @param string $to + * @param bool $overwrite + * @return bool + */ + public function moveDirectory($from, $to, $overwrite = false) + { + if ($overwrite && $this->isDirectory($to) && ! $this->deleteDirectory($to)) { + return false; + } + + return @rename($from, $to) === true; + } + + /** + * Copy a directory from one location to another. + * + * @param string $directory + * @param string $destination + * @param int $options + * @return bool + */ + public function copyDirectory($directory, $destination, $options = null) + { + if (! $this->isDirectory($directory)) { + return false; + } + + $options = $options ?: FilesystemIterator::SKIP_DOTS; + + // If the destination directory does not actually exist, we will go ahead and + // create it recursively, which just gets the destination prepared to copy + // the files over. Once we make the directory we'll proceed the copying. + if (! $this->isDirectory($destination)) { + $this->makeDirectory($destination, 0777, true); + } + + $items = new FilesystemIterator($directory, $options); + + foreach ($items as $item) { + // As we spin through items, we will check to see if the current file is actually + // a directory or a file. When it is actually a directory we will need to call + // back into this function recursively to keep copying these nested folders. + $target = $destination.'/'.$item->getBasename(); + + if ($item->isDir()) { + $path = $item->getPathname(); + + if (! $this->copyDirectory($path, $target, $options)) { + return false; + } + } + + // If the current items is just a regular file, we will just copy this to the new + // location and keep looping. If for some reason the copy fails we'll bail out + // and return false, so the developer is aware that the copy process failed. + else { + if (! $this->copy($item->getPathname(), $target)) { + return false; + } + } + } + + return true; + } + + /** + * Recursively delete a directory. + * + * The directory itself may be optionally preserved. + * + * @param string $directory + * @param bool $preserve + * @return bool + */ + public function deleteDirectory($directory, $preserve = false) + { + if (! $this->isDirectory($directory)) { + return false; + } + + $items = new FilesystemIterator($directory); + + foreach ($items as $item) { + // If the item is a directory, we can just recurse into the function and + // delete that sub-directory otherwise we'll just delete the file and + // keep iterating through each file until the directory is cleaned. + if ($item->isDir() && ! $item->isLink()) { + $this->deleteDirectory($item->getPathname()); + } + + // If the item is just a file, we can go ahead and delete it since we're + // just looping through and waxing all of the files in this directory + // and calling directories recursively, so we delete the real path. + else { + $this->delete($item->getPathname()); + } + } + + if (! $preserve) { + @rmdir($directory); + } + + return true; + } + + /** + * Remove all of the directories within a given directory. + * + * @param string $directory + * @return bool + */ + public function deleteDirectories($directory) + { + $allDirectories = $this->directories($directory); + + if (! empty($allDirectories)) { + foreach ($allDirectories as $directoryName) { + $this->deleteDirectory($directoryName); + } + + return true; + } + + return false; + } + + /** + * Empty the specified directory of all files and folders. + * + * @param string $directory + * @return bool + */ + public function cleanDirectory($directory) + { + return $this->deleteDirectory($directory, true); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php b/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php new file mode 100644 index 0000000..64f45b5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php @@ -0,0 +1,718 @@ +driver = $driver; + } + + /** + * Assert that the given file exists. + * + * @param string $path + * @return void + */ + public function assertExists($path) + { + PHPUnit::assertTrue( + $this->exists($path), "Unable to find a file at path [{$path}]." + ); + } + + /** + * Assert that the given file does not exist. + * + * @param string $path + * @return void + */ + public function assertMissing($path) + { + PHPUnit::assertFalse( + $this->exists($path), "Found unexpected file at path [{$path}]." + ); + } + + /** + * Determine if a file exists. + * + * @param string $path + * @return bool + */ + public function exists($path) + { + return $this->driver->has($path); + } + + /** + * Get the full path for the file at the given "short" path. + * + * @param string $path + * @return string + */ + public function path($path) + { + return $this->driver->getAdapter()->getPathPrefix().$path; + } + + /** + * Get the contents of a file. + * + * @param string $path + * @return string + * + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + */ + public function get($path) + { + try { + return $this->driver->read($path); + } catch (FileNotFoundException $e) { + throw new ContractFileNotFoundException($path, $e->getCode(), $e); + } + } + + /** + * Create a streamed response for a given file. + * + * @param string $path + * @param string|null $name + * @param array|null $headers + * @param string|null $disposition + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + public function response($path, $name = null, array $headers = [], $disposition = 'inline') + { + $response = new StreamedResponse; + + $disposition = $response->headers->makeDisposition($disposition, $name ?? basename($path)); + + $response->headers->replace($headers + [ + 'Content-Type' => $this->mimeType($path), + 'Content-Length' => $this->size($path), + 'Content-Disposition' => $disposition, + ]); + + $response->setCallback(function () use ($path) { + $stream = $this->readStream($path); + fpassthru($stream); + fclose($stream); + }); + + return $response; + } + + /** + * Create a streamed download response for a given file. + * + * @param string $path + * @param string|null $name + * @param array|null $headers + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + public function download($path, $name = null, array $headers = []) + { + return $this->response($path, $name, $headers, 'attachment'); + } + + /** + * Write the contents of a file. + * + * @param string $path + * @param string|resource $contents + * @param mixed $options + * @return bool + */ + public function put($path, $contents, $options = []) + { + $options = is_string($options) + ? ['visibility' => $options] + : (array) $options; + + // If the given contents is actually a file or uploaded file instance than we will + // automatically store the file using a stream. This provides a convenient path + // for the developer to store streams without managing them manually in code. + if ($contents instanceof File || + $contents instanceof UploadedFile) { + return $this->putFile($path, $contents, $options); + } + + return is_resource($contents) + ? $this->driver->putStream($path, $contents, $options) + : $this->driver->put($path, $contents, $options); + } + + /** + * Store the uploaded file on the disk. + * + * @param string $path + * @param \Illuminate\Http\File|\Illuminate\Http\UploadedFile $file + * @param array $options + * @return string|false + */ + public function putFile($path, $file, $options = []) + { + return $this->putFileAs($path, $file, $file->hashName(), $options); + } + + /** + * Store the uploaded file on the disk with a given name. + * + * @param string $path + * @param \Illuminate\Http\File|\Illuminate\Http\UploadedFile $file + * @param string $name + * @param array $options + * @return string|false + */ + public function putFileAs($path, $file, $name, $options = []) + { + $stream = fopen($file->getRealPath(), 'r'); + + // Next, we will format the path of the file and store the file using a stream since + // they provide better performance than alternatives. Once we write the file this + // stream will get closed automatically by us so the developer doesn't have to. + $result = $this->put( + $path = trim($path.'/'.$name, '/'), $stream, $options + ); + + if (is_resource($stream)) { + fclose($stream); + } + + return $result ? $path : false; + } + + /** + * Get the visibility for the given path. + * + * @param string $path + * @return string + */ + public function getVisibility($path) + { + if ($this->driver->getVisibility($path) == AdapterInterface::VISIBILITY_PUBLIC) { + return FilesystemContract::VISIBILITY_PUBLIC; + } + + return FilesystemContract::VISIBILITY_PRIVATE; + } + + /** + * Set the visibility for the given path. + * + * @param string $path + * @param string $visibility + * @return bool + */ + public function setVisibility($path, $visibility) + { + return $this->driver->setVisibility($path, $this->parseVisibility($visibility)); + } + + /** + * Prepend to a file. + * + * @param string $path + * @param string $data + * @param string $separator + * @return bool + */ + public function prepend($path, $data, $separator = PHP_EOL) + { + if ($this->exists($path)) { + return $this->put($path, $data.$separator.$this->get($path)); + } + + return $this->put($path, $data); + } + + /** + * Append to a file. + * + * @param string $path + * @param string $data + * @param string $separator + * @return bool + */ + public function append($path, $data, $separator = PHP_EOL) + { + if ($this->exists($path)) { + return $this->put($path, $this->get($path).$separator.$data); + } + + return $this->put($path, $data); + } + + /** + * Delete the file at a given path. + * + * @param string|array $paths + * @return bool + */ + public function delete($paths) + { + $paths = is_array($paths) ? $paths : func_get_args(); + + $success = true; + + foreach ($paths as $path) { + try { + if (! $this->driver->delete($path)) { + $success = false; + } + } catch (FileNotFoundException $e) { + $success = false; + } + } + + return $success; + } + + /** + * Copy a file to a new location. + * + * @param string $from + * @param string $to + * @return bool + */ + public function copy($from, $to) + { + return $this->driver->copy($from, $to); + } + + /** + * Move a file to a new location. + * + * @param string $from + * @param string $to + * @return bool + */ + public function move($from, $to) + { + return $this->driver->rename($from, $to); + } + + /** + * Get the file size of a given file. + * + * @param string $path + * @return int + */ + public function size($path) + { + return $this->driver->getSize($path); + } + + /** + * Get the mime-type of a given file. + * + * @param string $path + * @return string|false + */ + public function mimeType($path) + { + return $this->driver->getMimetype($path); + } + + /** + * Get the file's last modification time. + * + * @param string $path + * @return int + */ + public function lastModified($path) + { + return $this->driver->getTimestamp($path); + } + + /** + * Get the URL for the file at the given path. + * + * @param string $path + * @return string + * + * @throws \RuntimeException + */ + public function url($path) + { + $adapter = $this->driver->getAdapter(); + + if ($adapter instanceof CachedAdapter) { + $adapter = $adapter->getAdapter(); + } + + if (method_exists($adapter, 'getUrl')) { + return $adapter->getUrl($path); + } elseif (method_exists($this->driver, 'getUrl')) { + return $this->driver->getUrl($path); + } elseif ($adapter instanceof AwsS3Adapter) { + return $this->getAwsUrl($adapter, $path); + } elseif ($adapter instanceof RackspaceAdapter) { + return $this->getRackspaceUrl($adapter, $path); + } elseif ($adapter instanceof LocalAdapter) { + return $this->getLocalUrl($path); + } else { + throw new RuntimeException('This driver does not support retrieving URLs.'); + } + } + + /** + * {@inheritdoc} + */ + public function readStream($path) + { + try { + $resource = $this->driver->readStream($path); + + return $resource ? $resource : null; + } catch (FileNotFoundException $e) { + throw new ContractFileNotFoundException($e->getMessage(), $e->getCode(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function writeStream($path, $resource, array $options = []) + { + try { + return $this->driver->writeStream($path, $resource, $options); + } catch (FileExistsException $e) { + throw new ContractFileExistsException($e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Get the URL for the file at the given path. + * + * @param \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter + * @param string $path + * @return string + */ + protected function getAwsUrl($adapter, $path) + { + // If an explicit base URL has been set on the disk configuration then we will use + // it as the base URL instead of the default path. This allows the developer to + // have full control over the base path for this filesystem's generated URLs. + if (! is_null($url = $this->driver->getConfig()->get('url'))) { + return $this->concatPathToUrl($url, $adapter->getPathPrefix().$path); + } + + return $adapter->getClient()->getObjectUrl( + $adapter->getBucket(), $adapter->getPathPrefix().$path + ); + } + + /** + * Get the URL for the file at the given path. + * + * @param \League\Flysystem\Rackspace\RackspaceAdapter $adapter + * @param string $path + * @return string + */ + protected function getRackspaceUrl($adapter, $path) + { + return (string) $adapter->getContainer()->getObject($path)->getPublicUrl(); + } + + /** + * Get the URL for the file at the given path. + * + * @param string $path + * @return string + */ + protected function getLocalUrl($path) + { + $config = $this->driver->getConfig(); + + // If an explicit base URL has been set on the disk configuration then we will use + // it as the base URL instead of the default path. This allows the developer to + // have full control over the base path for this filesystem's generated URLs. + if ($config->has('url')) { + return $this->concatPathToUrl($config->get('url'), $path); + } + + $path = '/storage/'.$path; + + // If the path contains "storage/public", it probably means the developer is using + // the default disk to generate the path instead of the "public" disk like they + // are really supposed to use. We will remove the public from this path here. + if (Str::contains($path, '/storage/public/')) { + return Str::replaceFirst('/public/', '/', $path); + } + + return $path; + } + + /** + * Get a temporary URL for the file at the given path. + * + * @param string $path + * @param \DateTimeInterface $expiration + * @param array $options + * @return string + * + * @throws \RuntimeException + */ + public function temporaryUrl($path, $expiration, array $options = []) + { + $adapter = $this->driver->getAdapter(); + + if ($adapter instanceof CachedAdapter) { + $adapter = $adapter->getAdapter(); + } + + if (method_exists($adapter, 'getTemporaryUrl')) { + return $adapter->getTemporaryUrl($path, $expiration, $options); + } elseif ($adapter instanceof AwsS3Adapter) { + return $this->getAwsTemporaryUrl($adapter, $path, $expiration, $options); + } elseif ($adapter instanceof RackspaceAdapter) { + return $this->getRackspaceTemporaryUrl($adapter, $path, $expiration, $options); + } else { + throw new RuntimeException('This driver does not support creating temporary URLs.'); + } + } + + /** + * Get a temporary URL for the file at the given path. + * + * @param \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter + * @param string $path + * @param \DateTimeInterface $expiration + * @param array $options + * @return string + */ + public function getAwsTemporaryUrl($adapter, $path, $expiration, $options) + { + $client = $adapter->getClient(); + + $command = $client->getCommand('GetObject', array_merge([ + 'Bucket' => $adapter->getBucket(), + 'Key' => $adapter->getPathPrefix().$path, + ], $options)); + + return (string) $client->createPresignedRequest( + $command, $expiration + )->getUri(); + } + + /** + * Get a temporary URL for the file at the given path. + * + * @param \League\Flysystem\Rackspace\RackspaceAdapter $adapter + * @param string $path + * @param \DateTimeInterface $expiration + * @param array $options + * @return string + */ + public function getRackspaceTemporaryUrl($adapter, $path, $expiration, $options) + { + return $adapter->getContainer()->getObject($path)->getTemporaryUrl( + Carbon::now()->diffInSeconds($expiration), + $options['method'] ?? 'GET', + $options['forcePublicUrl'] ?? true + ); + } + + /** + * Concatenate a path to a URL. + * + * @param string $url + * @param string $path + * @return string + */ + protected function concatPathToUrl($url, $path) + { + return rtrim($url, '/').'/'.ltrim($path, '/'); + } + + /** + * Get an array of all files in a directory. + * + * @param string|null $directory + * @param bool $recursive + * @return array + */ + public function files($directory = null, $recursive = false) + { + $contents = $this->driver->listContents($directory, $recursive); + + return $this->filterContentsByType($contents, 'file'); + } + + /** + * Get all of the files from the given directory (recursive). + * + * @param string|null $directory + * @return array + */ + public function allFiles($directory = null) + { + return $this->files($directory, true); + } + + /** + * Get all of the directories within a given directory. + * + * @param string|null $directory + * @param bool $recursive + * @return array + */ + public function directories($directory = null, $recursive = false) + { + $contents = $this->driver->listContents($directory, $recursive); + + return $this->filterContentsByType($contents, 'dir'); + } + + /** + * Get all (recursive) of the directories within a given directory. + * + * @param string|null $directory + * @return array + */ + public function allDirectories($directory = null) + { + return $this->directories($directory, true); + } + + /** + * Create a directory. + * + * @param string $path + * @return bool + */ + public function makeDirectory($path) + { + return $this->driver->createDir($path); + } + + /** + * Recursively delete a directory. + * + * @param string $directory + * @return bool + */ + public function deleteDirectory($directory) + { + return $this->driver->deleteDir($directory); + } + + /** + * Flush the Flysystem cache. + * + * @return void + */ + public function flushCache() + { + $adapter = $this->driver->getAdapter(); + + if ($adapter instanceof CachedAdapter) { + $adapter->getCache()->flush(); + } + } + + /** + * Get the Flysystem driver. + * + * @return \League\Flysystem\FilesystemInterface + */ + public function getDriver() + { + return $this->driver; + } + + /** + * Filter directory contents by type. + * + * @param array $contents + * @param string $type + * @return array + */ + protected function filterContentsByType($contents, $type) + { + return Collection::make($contents) + ->where('type', $type) + ->pluck('path') + ->values() + ->all(); + } + + /** + * Parse the given visibility value. + * + * @param string|null $visibility + * @return string|null + * + * @throws \InvalidArgumentException + */ + protected function parseVisibility($visibility) + { + if (is_null($visibility)) { + return; + } + + switch ($visibility) { + case FilesystemContract::VISIBILITY_PUBLIC: + return AdapterInterface::VISIBILITY_PUBLIC; + case FilesystemContract::VISIBILITY_PRIVATE: + return AdapterInterface::VISIBILITY_PRIVATE; + } + + throw new InvalidArgumentException("Unknown visibility: {$visibility}"); + } + + /** + * Pass dynamic methods call onto Flysystem. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, array $parameters) + { + return call_user_func_array([$this->driver, $method], $parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php b/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php new file mode 100644 index 0000000..7897352 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php @@ -0,0 +1,401 @@ +app = $app; + } + + /** + * Get a filesystem instance. + * + * @param string $name + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function drive($name = null) + { + return $this->disk($name); + } + + /** + * Get a filesystem instance. + * + * @param string $name + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function disk($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + return $this->disks[$name] = $this->get($name); + } + + /** + * Get a default cloud filesystem instance. + * + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function cloud() + { + $name = $this->getDefaultCloudDriver(); + + return $this->disks[$name] = $this->get($name); + } + + /** + * Attempt to get the disk from the local cache. + * + * @param string $name + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + protected function get($name) + { + return $this->disks[$name] ?? $this->resolve($name); + } + + /** + * Resolve the given disk. + * + * @param string $name + * @return \Illuminate\Contracts\Filesystem\Filesystem + * + * @throws \InvalidArgumentException + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + if (isset($this->customCreators[$config['driver']])) { + return $this->callCustomCreator($config); + } + + $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; + + if (method_exists($this, $driverMethod)) { + return $this->{$driverMethod}($config); + } else { + throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported."); + } + } + + /** + * Call a custom driver creator. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + protected function callCustomCreator(array $config) + { + $driver = $this->customCreators[$config['driver']]($this->app, $config); + + if ($driver instanceof FilesystemInterface) { + return $this->adapt($driver); + } + + return $driver; + } + + /** + * Create an instance of the local driver. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function createLocalDriver(array $config) + { + $permissions = $config['permissions'] ?? []; + + $links = ($config['links'] ?? null) === 'skip' + ? LocalAdapter::SKIP_LINKS + : LocalAdapter::DISALLOW_LINKS; + + return $this->adapt($this->createFlysystem(new LocalAdapter( + $config['root'], LOCK_EX, $links, $permissions + ), $config)); + } + + /** + * Create an instance of the ftp driver. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function createFtpDriver(array $config) + { + return $this->adapt($this->createFlysystem( + new FtpAdapter($config), $config + )); + } + + /** + * Create an instance of the sftp driver. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + public function createSftpDriver(array $config) + { + return $this->adapt($this->createFlysystem( + new SftpAdapter($config), $config + )); + } + + /** + * Create an instance of the Amazon S3 driver. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Cloud + */ + public function createS3Driver(array $config) + { + $s3Config = $this->formatS3Config($config); + + $root = $s3Config['root'] ?? null; + + $options = $config['options'] ?? []; + + return $this->adapt($this->createFlysystem( + new S3Adapter(new S3Client($s3Config), $s3Config['bucket'], $root, $options), $config + )); + } + + /** + * Format the given S3 configuration with the default options. + * + * @param array $config + * @return array + */ + protected function formatS3Config(array $config) + { + $config += ['version' => 'latest']; + + if ($config['key'] && $config['secret']) { + $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']); + } + + return $config; + } + + /** + * Create an instance of the Rackspace driver. + * + * @param array $config + * @return \Illuminate\Contracts\Filesystem\Cloud + */ + public function createRackspaceDriver(array $config) + { + $client = new Rackspace($config['endpoint'], [ + 'username' => $config['username'], 'apiKey' => $config['key'], + ], $config['options'] ?? []); + + $root = $config['root'] ?? null; + + return $this->adapt($this->createFlysystem( + new RackspaceAdapter($this->getRackspaceContainer($client, $config), $root), $config + )); + } + + /** + * Get the Rackspace Cloud Files container. + * + * @param \OpenCloud\Rackspace $client + * @param array $config + * @return \OpenCloud\ObjectStore\Resource\Container + */ + protected function getRackspaceContainer(Rackspace $client, array $config) + { + $urlType = $config['url_type'] ?? null; + + $store = $client->objectStoreService('cloudFiles', $config['region'], $urlType); + + return $store->getContainer($config['container']); + } + + /** + * Create a Flysystem instance with the given adapter. + * + * @param \League\Flysystem\AdapterInterface $adapter + * @param array $config + * @return \League\Flysystem\FilesystemInterface + */ + protected function createFlysystem(AdapterInterface $adapter, array $config) + { + $cache = Arr::pull($config, 'cache'); + + $config = Arr::only($config, ['visibility', 'disable_asserts', 'url']); + + if ($cache) { + $adapter = new CachedAdapter($adapter, $this->createCacheStore($cache)); + } + + return new Flysystem($adapter, count($config) > 0 ? $config : null); + } + + /** + * Create a cache store instance. + * + * @param mixed $config + * @return \League\Flysystem\Cached\CacheInterface + * + * @throws \InvalidArgumentException + */ + protected function createCacheStore($config) + { + if ($config === true) { + return new MemoryStore; + } + + return new Cache( + $this->app['cache']->store($config['store']), + $config['prefix'] ?? 'flysystem', + $config['expire'] ?? null + ); + } + + /** + * Adapt the filesystem implementation. + * + * @param \League\Flysystem\FilesystemInterface $filesystem + * @return \Illuminate\Contracts\Filesystem\Filesystem + */ + protected function adapt(FilesystemInterface $filesystem) + { + return new FilesystemAdapter($filesystem); + } + + /** + * Set the given disk instance. + * + * @param string $name + * @param mixed $disk + * @return $this + */ + public function set($name, $disk) + { + $this->disks[$name] = $disk; + + return $this; + } + + /** + * Get the filesystem connection configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + return $this->app['config']["filesystems.disks.{$name}"]; + } + + /** + * Get the default driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['filesystems.default']; + } + + /** + * Get the default cloud driver name. + * + * @return string + */ + public function getDefaultCloudDriver() + { + return $this->app['config']['filesystems.cloud']; + } + + /** + * Unset the given disk instances. + * + * @param array|string $disk + * @return $this + */ + public function forgetDisk($disk) + { + foreach ((array) $disk as $diskName) { + unset($this->disks[$diskName]); + } + + return $this; + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback; + + return $this; + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->disk()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php new file mode 100644 index 0000000..6932270 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php @@ -0,0 +1,82 @@ +registerNativeFilesystem(); + + $this->registerFlysystem(); + } + + /** + * Register the native filesystem implementation. + * + * @return void + */ + protected function registerNativeFilesystem() + { + $this->app->singleton('files', function () { + return new Filesystem; + }); + } + + /** + * Register the driver based filesystem. + * + * @return void + */ + protected function registerFlysystem() + { + $this->registerManager(); + + $this->app->singleton('filesystem.disk', function () { + return $this->app['filesystem']->disk($this->getDefaultDriver()); + }); + + $this->app->singleton('filesystem.cloud', function () { + return $this->app['filesystem']->disk($this->getCloudDriver()); + }); + } + + /** + * Register the filesystem manager. + * + * @return void + */ + protected function registerManager() + { + $this->app->singleton('filesystem', function () { + return new FilesystemManager($this->app); + }); + } + + /** + * Get the default file driver. + * + * @return string + */ + protected function getDefaultDriver() + { + return $this->app['config']['filesystems.default']; + } + + /** + * Get the default cloud based file driver. + * + * @return string + */ + protected function getCloudDriver() + { + return $this->app['config']['filesystems.cloud']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Filesystem/composer.json b/vendor/laravel/framework/src/Illuminate/Filesystem/composer.json new file mode 100644 index 0000000..4157c81 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Filesystem/composer.json @@ -0,0 +1,43 @@ +{ + "name": "illuminate/filesystem", + "description": "The Illuminate Filesystem package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*", + "symfony/finder": "^4.1" + }, + "autoload": { + "psr-4": { + "Illuminate\\Filesystem\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "suggest": { + "league/flysystem": "Required to use the Flysystem local and FTP drivers (^1.0).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", + "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", + "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (^1.0).", + "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php b/vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php new file mode 100755 index 0000000..63f3891 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php @@ -0,0 +1,243 @@ +aliases = $aliases; + } + + /** + * Get or create the singleton alias loader instance. + * + * @param array $aliases + * @return \Illuminate\Foundation\AliasLoader + */ + public static function getInstance(array $aliases = []) + { + if (is_null(static::$instance)) { + return static::$instance = new static($aliases); + } + + $aliases = array_merge(static::$instance->getAliases(), $aliases); + + static::$instance->setAliases($aliases); + + return static::$instance; + } + + /** + * Load a class alias if it is registered. + * + * @param string $alias + * @return bool|null + */ + public function load($alias) + { + if (static::$facadeNamespace && strpos($alias, static::$facadeNamespace) === 0) { + $this->loadFacade($alias); + + return true; + } + + if (isset($this->aliases[$alias])) { + return class_alias($this->aliases[$alias], $alias); + } + } + + /** + * Load a real-time facade for the given alias. + * + * @param string $alias + * @return void + */ + protected function loadFacade($alias) + { + require $this->ensureFacadeExists($alias); + } + + /** + * Ensure that the given alias has an existing real-time facade class. + * + * @param string $alias + * @return string + */ + protected function ensureFacadeExists($alias) + { + if (file_exists($path = storage_path('framework/cache/facade-'.sha1($alias).'.php'))) { + return $path; + } + + file_put_contents($path, $this->formatFacadeStub( + $alias, file_get_contents(__DIR__.'/stubs/facade.stub') + )); + + return $path; + } + + /** + * Format the facade stub with the proper namespace and class. + * + * @param string $alias + * @param string $stub + * @return string + */ + protected function formatFacadeStub($alias, $stub) + { + $replacements = [ + str_replace('/', '\\', dirname(str_replace('\\', '/', $alias))), + class_basename($alias), + substr($alias, strlen(static::$facadeNamespace)), + ]; + + return str_replace( + ['DummyNamespace', 'DummyClass', 'DummyTarget'], $replacements, $stub + ); + } + + /** + * Add an alias to the loader. + * + * @param string $class + * @param string $alias + * @return void + */ + public function alias($class, $alias) + { + $this->aliases[$class] = $alias; + } + + /** + * Register the loader on the auto-loader stack. + * + * @return void + */ + public function register() + { + if (! $this->registered) { + $this->prependToLoaderStack(); + + $this->registered = true; + } + } + + /** + * Prepend the load method to the auto-loader stack. + * + * @return void + */ + protected function prependToLoaderStack() + { + spl_autoload_register([$this, 'load'], true, true); + } + + /** + * Get the registered aliases. + * + * @return array + */ + public function getAliases() + { + return $this->aliases; + } + + /** + * Set the registered aliases. + * + * @param array $aliases + * @return void + */ + public function setAliases(array $aliases) + { + $this->aliases = $aliases; + } + + /** + * Indicates if the loader has been registered. + * + * @return bool + */ + public function isRegistered() + { + return $this->registered; + } + + /** + * Set the "registered" state of the loader. + * + * @param bool $value + * @return void + */ + public function setRegistered($value) + { + $this->registered = $value; + } + + /** + * Set the real-time facade namespace. + * + * @param string $namespace + * @return void + */ + public static function setFacadeNamespace($namespace) + { + static::$facadeNamespace = rtrim($namespace, '\\').'\\'; + } + + /** + * Set the value of the singleton alias loader. + * + * @param \Illuminate\Foundation\AliasLoader $loader + * @return void + */ + public static function setInstance($loader) + { + static::$instance = $loader; + } + + /** + * Clone method. + * + * @return void + */ + private function __clone() + { + // + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Application.php b/vendor/laravel/framework/src/Illuminate/Foundation/Application.php new file mode 100755 index 0000000..5b9c2e4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Application.php @@ -0,0 +1,1167 @@ +setBasePath($basePath); + } + + $this->registerBaseBindings(); + + $this->registerBaseServiceProviders(); + + $this->registerCoreContainerAliases(); + } + + /** + * Get the version number of the application. + * + * @return string + */ + public function version() + { + return static::VERSION; + } + + /** + * Register the basic bindings into the container. + * + * @return void + */ + protected function registerBaseBindings() + { + static::setInstance($this); + + $this->instance('app', $this); + + $this->instance(Container::class, $this); + + $this->instance(PackageManifest::class, new PackageManifest( + new Filesystem, $this->basePath(), $this->getCachedPackagesPath() + )); + } + + /** + * Register all of the base service providers. + * + * @return void + */ + protected function registerBaseServiceProviders() + { + $this->register(new EventServiceProvider($this)); + $this->register(new LogServiceProvider($this)); + $this->register(new RoutingServiceProvider($this)); + } + + /** + * Run the given array of bootstrap classes. + * + * @param array $bootstrappers + * @return void + */ + public function bootstrapWith(array $bootstrappers) + { + $this->hasBeenBootstrapped = true; + + foreach ($bootstrappers as $bootstrapper) { + $this['events']->dispatch('bootstrapping: '.$bootstrapper, [$this]); + + $this->make($bootstrapper)->bootstrap($this); + + $this['events']->dispatch('bootstrapped: '.$bootstrapper, [$this]); + } + } + + /** + * Register a callback to run after loading the environment. + * + * @param \Closure $callback + * @return void + */ + public function afterLoadingEnvironment(Closure $callback) + { + return $this->afterBootstrapping( + LoadEnvironmentVariables::class, $callback + ); + } + + /** + * Register a callback to run before a bootstrapper. + * + * @param string $bootstrapper + * @param \Closure $callback + * @return void + */ + public function beforeBootstrapping($bootstrapper, Closure $callback) + { + $this['events']->listen('bootstrapping: '.$bootstrapper, $callback); + } + + /** + * Register a callback to run after a bootstrapper. + * + * @param string $bootstrapper + * @param \Closure $callback + * @return void + */ + public function afterBootstrapping($bootstrapper, Closure $callback) + { + $this['events']->listen('bootstrapped: '.$bootstrapper, $callback); + } + + /** + * Determine if the application has been bootstrapped before. + * + * @return bool + */ + public function hasBeenBootstrapped() + { + return $this->hasBeenBootstrapped; + } + + /** + * Set the base path for the application. + * + * @param string $basePath + * @return $this + */ + public function setBasePath($basePath) + { + $this->basePath = rtrim($basePath, '\/'); + + $this->bindPathsInContainer(); + + return $this; + } + + /** + * Bind all of the application paths in the container. + * + * @return void + */ + protected function bindPathsInContainer() + { + $this->instance('path', $this->path()); + $this->instance('path.base', $this->basePath()); + $this->instance('path.lang', $this->langPath()); + $this->instance('path.config', $this->configPath()); + $this->instance('path.public', $this->publicPath()); + $this->instance('path.storage', $this->storagePath()); + $this->instance('path.database', $this->databasePath()); + $this->instance('path.resources', $this->resourcePath()); + $this->instance('path.bootstrap', $this->bootstrapPath()); + } + + /** + * Get the path to the application "app" directory. + * + * @param string $path Optionally, a path to append to the app path + * @return string + */ + public function path($path = '') + { + return $this->basePath.DIRECTORY_SEPARATOR.'app'.($path ? DIRECTORY_SEPARATOR.$path : $path); + } + + /** + * Get the base path of the Laravel installation. + * + * @param string $path Optionally, a path to append to the base path + * @return string + */ + public function basePath($path = '') + { + return $this->basePath.($path ? DIRECTORY_SEPARATOR.$path : $path); + } + + /** + * Get the path to the bootstrap directory. + * + * @param string $path Optionally, a path to append to the bootstrap path + * @return string + */ + public function bootstrapPath($path = '') + { + return $this->basePath.DIRECTORY_SEPARATOR.'bootstrap'.($path ? DIRECTORY_SEPARATOR.$path : $path); + } + + /** + * Get the path to the application configuration files. + * + * @param string $path Optionally, a path to append to the config path + * @return string + */ + public function configPath($path = '') + { + return $this->basePath.DIRECTORY_SEPARATOR.'config'.($path ? DIRECTORY_SEPARATOR.$path : $path); + } + + /** + * Get the path to the database directory. + * + * @param string $path Optionally, a path to append to the database path + * @return string + */ + public function databasePath($path = '') + { + return ($this->databasePath ?: $this->basePath.DIRECTORY_SEPARATOR.'database').($path ? DIRECTORY_SEPARATOR.$path : $path); + } + + /** + * Set the database directory. + * + * @param string $path + * @return $this + */ + public function useDatabasePath($path) + { + $this->databasePath = $path; + + $this->instance('path.database', $path); + + return $this; + } + + /** + * Get the path to the language files. + * + * @return string + */ + public function langPath() + { + return $this->resourcePath().DIRECTORY_SEPARATOR.'lang'; + } + + /** + * Get the path to the public / web directory. + * + * @return string + */ + public function publicPath() + { + return $this->basePath.DIRECTORY_SEPARATOR.'public'; + } + + /** + * Get the path to the storage directory. + * + * @return string + */ + public function storagePath() + { + return $this->storagePath ?: $this->basePath.DIRECTORY_SEPARATOR.'storage'; + } + + /** + * Set the storage directory. + * + * @param string $path + * @return $this + */ + public function useStoragePath($path) + { + $this->storagePath = $path; + + $this->instance('path.storage', $path); + + return $this; + } + + /** + * Get the path to the resources directory. + * + * @param string $path + * @return string + */ + public function resourcePath($path = '') + { + return $this->basePath.DIRECTORY_SEPARATOR.'resources'.($path ? DIRECTORY_SEPARATOR.$path : $path); + } + + /** + * Get the path to the environment file directory. + * + * @return string + */ + public function environmentPath() + { + return $this->environmentPath ?: $this->basePath; + } + + /** + * Set the directory for the environment file. + * + * @param string $path + * @return $this + */ + public function useEnvironmentPath($path) + { + $this->environmentPath = $path; + + return $this; + } + + /** + * Set the environment file to be loaded during bootstrapping. + * + * @param string $file + * @return $this + */ + public function loadEnvironmentFrom($file) + { + $this->environmentFile = $file; + + return $this; + } + + /** + * Get the environment file the application is using. + * + * @return string + */ + public function environmentFile() + { + return $this->environmentFile ?: '.env'; + } + + /** + * Get the fully qualified path to the environment file. + * + * @return string + */ + public function environmentFilePath() + { + return $this->environmentPath().DIRECTORY_SEPARATOR.$this->environmentFile(); + } + + /** + * Get or check the current application environment. + * + * @return string|bool + */ + public function environment() + { + if (func_num_args() > 0) { + $patterns = is_array(func_get_arg(0)) ? func_get_arg(0) : func_get_args(); + + return Str::is($patterns, $this['env']); + } + + return $this['env']; + } + + /** + * Determine if application is in local environment. + * + * @return bool + */ + public function isLocal() + { + return $this['env'] === 'local'; + } + + /** + * Detect the application's current environment. + * + * @param \Closure $callback + * @return string + */ + public function detectEnvironment(Closure $callback) + { + $args = $_SERVER['argv'] ?? null; + + return $this['env'] = (new EnvironmentDetector)->detect($callback, $args); + } + + /** + * Determine if the application is running in the console. + * + * @return bool + */ + public function runningInConsole() + { + if (isset($_ENV['APP_RUNNING_IN_CONSOLE'])) { + return $_ENV['APP_RUNNING_IN_CONSOLE'] === 'true'; + } + + return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg'; + } + + /** + * Determine if the application is running unit tests. + * + * @return bool + */ + public function runningUnitTests() + { + return $this['env'] === 'testing'; + } + + /** + * Register all of the configured providers. + * + * @return void + */ + public function registerConfiguredProviders() + { + $providers = Collection::make($this->config['app.providers']) + ->partition(function ($provider) { + return Str::startsWith($provider, 'Illuminate\\'); + }); + + $providers->splice(1, 0, [$this->make(PackageManifest::class)->providers()]); + + (new ProviderRepository($this, new Filesystem, $this->getCachedServicesPath())) + ->load($providers->collapse()->toArray()); + } + + /** + * Register a service provider with the application. + * + * @param \Illuminate\Support\ServiceProvider|string $provider + * @param bool $force + * @return \Illuminate\Support\ServiceProvider + */ + public function register($provider, $force = false) + { + if (($registered = $this->getProvider($provider)) && ! $force) { + return $registered; + } + + // If the given "provider" is a string, we will resolve it, passing in the + // application instance automatically for the developer. This is simply + // a more convenient way of specifying your service provider classes. + if (is_string($provider)) { + $provider = $this->resolveProvider($provider); + } + + if (method_exists($provider, 'register')) { + $provider->register(); + } + + // If there are bindings / singletons set as properties on the provider we + // will spin through them and register them with the application, which + // serves as a convenience layer while registering a lot of bindings. + if (property_exists($provider, 'bindings')) { + foreach ($provider->bindings as $key => $value) { + $this->bind($key, $value); + } + } + + if (property_exists($provider, 'singletons')) { + foreach ($provider->singletons as $key => $value) { + $this->singleton($key, $value); + } + } + + $this->markAsRegistered($provider); + + // If the application has already booted, we will call this boot method on + // the provider class so it has an opportunity to do its boot logic and + // will be ready for any usage by this developer's application logic. + if ($this->booted) { + $this->bootProvider($provider); + } + + return $provider; + } + + /** + * Get the registered service provider instance if it exists. + * + * @param \Illuminate\Support\ServiceProvider|string $provider + * @return \Illuminate\Support\ServiceProvider|null + */ + public function getProvider($provider) + { + return array_values($this->getProviders($provider))[0] ?? null; + } + + /** + * Get the registered service provider instances if any exist. + * + * @param \Illuminate\Support\ServiceProvider|string $provider + * @return array + */ + public function getProviders($provider) + { + $name = is_string($provider) ? $provider : get_class($provider); + + return Arr::where($this->serviceProviders, function ($value) use ($name) { + return $value instanceof $name; + }); + } + + /** + * Resolve a service provider instance from the class name. + * + * @param string $provider + * @return \Illuminate\Support\ServiceProvider + */ + public function resolveProvider($provider) + { + return new $provider($this); + } + + /** + * Mark the given provider as registered. + * + * @param \Illuminate\Support\ServiceProvider $provider + * @return void + */ + protected function markAsRegistered($provider) + { + $this->serviceProviders[] = $provider; + + $this->loadedProviders[get_class($provider)] = true; + } + + /** + * Load and boot all of the remaining deferred providers. + * + * @return void + */ + public function loadDeferredProviders() + { + // We will simply spin through each of the deferred providers and register each + // one and boot them if the application has booted. This should make each of + // the remaining services available to this application for immediate use. + foreach ($this->deferredServices as $service => $provider) { + $this->loadDeferredProvider($service); + } + + $this->deferredServices = []; + } + + /** + * Load the provider for a deferred service. + * + * @param string $service + * @return void + */ + public function loadDeferredProvider($service) + { + if (! isset($this->deferredServices[$service])) { + return; + } + + $provider = $this->deferredServices[$service]; + + // If the service provider has not already been loaded and registered we can + // register it with the application and remove the service from this list + // of deferred services, since it will already be loaded on subsequent. + if (! isset($this->loadedProviders[$provider])) { + $this->registerDeferredProvider($provider, $service); + } + } + + /** + * Register a deferred provider and service. + * + * @param string $provider + * @param string|null $service + * @return void + */ + public function registerDeferredProvider($provider, $service = null) + { + // Once the provider that provides the deferred service has been registered we + // will remove it from our local list of the deferred services with related + // providers so that this container does not try to resolve it out again. + if ($service) { + unset($this->deferredServices[$service]); + } + + $this->register($instance = new $provider($this)); + + if (! $this->booted) { + $this->booting(function () use ($instance) { + $this->bootProvider($instance); + }); + } + } + + /** + * Resolve the given type from the container. + * + * (Overriding Container::make) + * + * @param string $abstract + * @param array $parameters + * @return mixed + */ + public function make($abstract, array $parameters = []) + { + $abstract = $this->getAlias($abstract); + + if (isset($this->deferredServices[$abstract]) && ! isset($this->instances[$abstract])) { + $this->loadDeferredProvider($abstract); + } + + return parent::make($abstract, $parameters); + } + + /** + * Determine if the given abstract type has been bound. + * + * (Overriding Container::bound) + * + * @param string $abstract + * @return bool + */ + public function bound($abstract) + { + return isset($this->deferredServices[$abstract]) || parent::bound($abstract); + } + + /** + * Determine if the application has booted. + * + * @return bool + */ + public function isBooted() + { + return $this->booted; + } + + /** + * Boot the application's service providers. + * + * @return void + */ + public function boot() + { + if ($this->booted) { + return; + } + + // Once the application has booted we will also fire some "booted" callbacks + // for any listeners that need to do work after this initial booting gets + // finished. This is useful when ordering the boot-up processes we run. + $this->fireAppCallbacks($this->bootingCallbacks); + + array_walk($this->serviceProviders, function ($p) { + $this->bootProvider($p); + }); + + $this->booted = true; + + $this->fireAppCallbacks($this->bootedCallbacks); + } + + /** + * Boot the given service provider. + * + * @param \Illuminate\Support\ServiceProvider $provider + * @return mixed + */ + protected function bootProvider(ServiceProvider $provider) + { + if (method_exists($provider, 'boot')) { + return $this->call([$provider, 'boot']); + } + } + + /** + * Register a new boot listener. + * + * @param mixed $callback + * @return void + */ + public function booting($callback) + { + $this->bootingCallbacks[] = $callback; + } + + /** + * Register a new "booted" listener. + * + * @param mixed $callback + * @return void + */ + public function booted($callback) + { + $this->bootedCallbacks[] = $callback; + + if ($this->isBooted()) { + $this->fireAppCallbacks([$callback]); + } + } + + /** + * Call the booting callbacks for the application. + * + * @param array $callbacks + * @return void + */ + protected function fireAppCallbacks(array $callbacks) + { + foreach ($callbacks as $callback) { + call_user_func($callback, $this); + } + } + + /** + * {@inheritdoc} + */ + public function handle(SymfonyRequest $request, $type = self::MASTER_REQUEST, $catch = true) + { + return $this[HttpKernelContract::class]->handle(Request::createFromBase($request)); + } + + /** + * Determine if middleware has been disabled for the application. + * + * @return bool + */ + public function shouldSkipMiddleware() + { + return $this->bound('middleware.disable') && + $this->make('middleware.disable') === true; + } + + /** + * Get the path to the cached services.php file. + * + * @return string + */ + public function getCachedServicesPath() + { + return $this->bootstrapPath().'/cache/services.php'; + } + + /** + * Get the path to the cached packages.php file. + * + * @return string + */ + public function getCachedPackagesPath() + { + return $this->bootstrapPath().'/cache/packages.php'; + } + + /** + * Determine if the application configuration is cached. + * + * @return bool + */ + public function configurationIsCached() + { + return file_exists($this->getCachedConfigPath()); + } + + /** + * Get the path to the configuration cache file. + * + * @return string + */ + public function getCachedConfigPath() + { + return $_ENV['APP_CONFIG_CACHE'] ?? $this->bootstrapPath().'/cache/config.php'; + } + + /** + * Determine if the application routes are cached. + * + * @return bool + */ + public function routesAreCached() + { + return $this['files']->exists($this->getCachedRoutesPath()); + } + + /** + * Get the path to the routes cache file. + * + * @return string + */ + public function getCachedRoutesPath() + { + return $this->bootstrapPath().'/cache/routes.php'; + } + + /** + * Determine if the application is currently down for maintenance. + * + * @return bool + */ + public function isDownForMaintenance() + { + return file_exists($this->storagePath().'/framework/down'); + } + + /** + * Throw an HttpException with the given data. + * + * @param int $code + * @param string $message + * @param array $headers + * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + */ + public function abort($code, $message = '', array $headers = []) + { + if ($code == 404) { + throw new NotFoundHttpException($message); + } + + throw new HttpException($code, $message, null, $headers); + } + + /** + * Register a terminating callback with the application. + * + * @param \Closure $callback + * @return $this + */ + public function terminating(Closure $callback) + { + $this->terminatingCallbacks[] = $callback; + + return $this; + } + + /** + * Terminate the application. + * + * @return void + */ + public function terminate() + { + foreach ($this->terminatingCallbacks as $terminating) { + $this->call($terminating); + } + } + + /** + * Get the service providers that have been loaded. + * + * @return array + */ + public function getLoadedProviders() + { + return $this->loadedProviders; + } + + /** + * Get the application's deferred services. + * + * @return array + */ + public function getDeferredServices() + { + return $this->deferredServices; + } + + /** + * Set the application's deferred services. + * + * @param array $services + * @return void + */ + public function setDeferredServices(array $services) + { + $this->deferredServices = $services; + } + + /** + * Add an array of services to the application's deferred services. + * + * @param array $services + * @return void + */ + public function addDeferredServices(array $services) + { + $this->deferredServices = array_merge($this->deferredServices, $services); + } + + /** + * Determine if the given service is a deferred service. + * + * @param string $service + * @return bool + */ + public function isDeferredService($service) + { + return isset($this->deferredServices[$service]); + } + + /** + * Configure the real-time facade namespace. + * + * @param string $namespace + * @return void + */ + public function provideFacades($namespace) + { + AliasLoader::setFacadeNamespace($namespace); + } + + /** + * Get the current application locale. + * + * @return string + */ + public function getLocale() + { + return $this['config']->get('app.locale'); + } + + /** + * Set the current application locale. + * + * @param string $locale + * @return void + */ + public function setLocale($locale) + { + $this['config']->set('app.locale', $locale); + + $this['translator']->setLocale($locale); + + $this['events']->dispatch(new Events\LocaleUpdated($locale)); + } + + /** + * Determine if application locale is the given locale. + * + * @param string $locale + * @return bool + */ + public function isLocale($locale) + { + return $this->getLocale() == $locale; + } + + /** + * Register the core class aliases in the container. + * + * @return void + */ + public function registerCoreContainerAliases() + { + foreach ([ + 'app' => [\Illuminate\Foundation\Application::class, \Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class], + 'auth' => [\Illuminate\Auth\AuthManager::class, \Illuminate\Contracts\Auth\Factory::class], + 'auth.driver' => [\Illuminate\Contracts\Auth\Guard::class], + 'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class], + 'cache' => [\Illuminate\Cache\CacheManager::class, \Illuminate\Contracts\Cache\Factory::class], + 'cache.store' => [\Illuminate\Cache\Repository::class, \Illuminate\Contracts\Cache\Repository::class], + 'config' => [\Illuminate\Config\Repository::class, \Illuminate\Contracts\Config\Repository::class], + 'cookie' => [\Illuminate\Cookie\CookieJar::class, \Illuminate\Contracts\Cookie\Factory::class, \Illuminate\Contracts\Cookie\QueueingFactory::class], + 'encrypter' => [\Illuminate\Encryption\Encrypter::class, \Illuminate\Contracts\Encryption\Encrypter::class], + 'db' => [\Illuminate\Database\DatabaseManager::class], + 'db.connection' => [\Illuminate\Database\Connection::class, \Illuminate\Database\ConnectionInterface::class], + 'events' => [\Illuminate\Events\Dispatcher::class, \Illuminate\Contracts\Events\Dispatcher::class], + 'files' => [\Illuminate\Filesystem\Filesystem::class], + 'filesystem' => [\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class], + 'filesystem.disk' => [\Illuminate\Contracts\Filesystem\Filesystem::class], + 'filesystem.cloud' => [\Illuminate\Contracts\Filesystem\Cloud::class], + 'hash' => [\Illuminate\Hashing\HashManager::class], + 'hash.driver' => [\Illuminate\Contracts\Hashing\Hasher::class], + 'translator' => [\Illuminate\Translation\Translator::class, \Illuminate\Contracts\Translation\Translator::class], + 'log' => [\Illuminate\Log\LogManager::class, \Psr\Log\LoggerInterface::class], + 'mailer' => [\Illuminate\Mail\Mailer::class, \Illuminate\Contracts\Mail\Mailer::class, \Illuminate\Contracts\Mail\MailQueue::class], + 'auth.password' => [\Illuminate\Auth\Passwords\PasswordBrokerManager::class, \Illuminate\Contracts\Auth\PasswordBrokerFactory::class], + 'auth.password.broker' => [\Illuminate\Auth\Passwords\PasswordBroker::class, \Illuminate\Contracts\Auth\PasswordBroker::class], + 'queue' => [\Illuminate\Queue\QueueManager::class, \Illuminate\Contracts\Queue\Factory::class, \Illuminate\Contracts\Queue\Monitor::class], + 'queue.connection' => [\Illuminate\Contracts\Queue\Queue::class], + 'queue.failer' => [\Illuminate\Queue\Failed\FailedJobProviderInterface::class], + 'redirect' => [\Illuminate\Routing\Redirector::class], + 'redis' => [\Illuminate\Redis\RedisManager::class, \Illuminate\Contracts\Redis\Factory::class], + 'request' => [\Illuminate\Http\Request::class, \Symfony\Component\HttpFoundation\Request::class], + 'router' => [\Illuminate\Routing\Router::class, \Illuminate\Contracts\Routing\Registrar::class, \Illuminate\Contracts\Routing\BindingRegistrar::class], + 'session' => [\Illuminate\Session\SessionManager::class], + 'session.store' => [\Illuminate\Session\Store::class, \Illuminate\Contracts\Session\Session::class], + 'url' => [\Illuminate\Routing\UrlGenerator::class, \Illuminate\Contracts\Routing\UrlGenerator::class], + 'validator' => [\Illuminate\Validation\Factory::class, \Illuminate\Contracts\Validation\Factory::class], + 'view' => [\Illuminate\View\Factory::class, \Illuminate\Contracts\View\Factory::class], + ] as $key => $aliases) { + foreach ($aliases as $alias) { + $this->alias($key, $alias); + } + } + } + + /** + * Flush the container of all bindings and resolved instances. + * + * @return void + */ + public function flush() + { + parent::flush(); + + $this->buildStack = []; + $this->loadedProviders = []; + $this->bootedCallbacks = []; + $this->bootingCallbacks = []; + $this->deferredServices = []; + $this->reboundCallbacks = []; + $this->serviceProviders = []; + $this->resolvingCallbacks = []; + $this->afterResolvingCallbacks = []; + $this->globalResolvingCallbacks = []; + } + + /** + * Get the application namespace. + * + * @return string + * + * @throws \RuntimeException + */ + public function getNamespace() + { + if (! is_null($this->namespace)) { + return $this->namespace; + } + + $composer = json_decode(file_get_contents(base_path('composer.json')), true); + + foreach ((array) data_get($composer, 'autoload.psr-4') as $namespace => $path) { + foreach ((array) $path as $pathChoice) { + if (realpath(app_path()) == realpath(base_path().'/'.$pathChoice)) { + return $this->namespace = $namespace; + } + } + } + + throw new RuntimeException('Unable to detect application namespace.'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/Authorizable.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/Authorizable.php new file mode 100644 index 0000000..9e8e33b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/Authorizable.php @@ -0,0 +1,44 @@ +forUser($this)->check($ability, $arguments); + } + + /** + * Determine if the entity does not have a given ability. + * + * @param string $ability + * @param array|mixed $arguments + * @return bool + */ + public function cant($ability, $arguments = []) + { + return ! $this->can($ability, $arguments); + } + + /** + * Determine if the entity does not have a given ability. + * + * @param string $ability + * @param array|mixed $arguments + * @return bool + */ + public function cannot($ability, $arguments = []) + { + return $this->cant($ability, $arguments); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php new file mode 100644 index 0000000..9930d90 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php @@ -0,0 +1,126 @@ +parseAbilityAndArguments($ability, $arguments); + + return app(Gate::class)->authorize($ability, $arguments); + } + + /** + * Authorize a given action for a user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user + * @param mixed $ability + * @param mixed|array $arguments + * @return \Illuminate\Auth\Access\Response + * + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + public function authorizeForUser($user, $ability, $arguments = []) + { + [$ability, $arguments] = $this->parseAbilityAndArguments($ability, $arguments); + + return app(Gate::class)->forUser($user)->authorize($ability, $arguments); + } + + /** + * Guesses the ability's name if it wasn't provided. + * + * @param mixed $ability + * @param mixed|array $arguments + * @return array + */ + protected function parseAbilityAndArguments($ability, $arguments) + { + if (is_string($ability) && strpos($ability, '\\') === false) { + return [$ability, $arguments]; + } + + $method = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3)[2]['function']; + + return [$this->normalizeGuessedAbilityName($method), $ability]; + } + + /** + * Normalize the ability name that has been guessed from the method name. + * + * @param string $ability + * @return string + */ + protected function normalizeGuessedAbilityName($ability) + { + $map = $this->resourceAbilityMap(); + + return $map[$ability] ?? $ability; + } + + /** + * Authorize a resource action based on the incoming request. + * + * @param string $model + * @param string|null $parameter + * @param array $options + * @param \Illuminate\Http\Request|null $request + * @return void + */ + public function authorizeResource($model, $parameter = null, array $options = [], $request = null) + { + $parameter = $parameter ?: Str::snake(class_basename($model)); + + $middleware = []; + + foreach ($this->resourceAbilityMap() as $method => $ability) { + $modelName = in_array($method, $this->resourceMethodsWithoutModels()) ? $model : $parameter; + + $middleware["can:{$ability},{$modelName}"][] = $method; + } + + foreach ($middleware as $middlewareName => $methods) { + $this->middleware($middlewareName, $options)->only($methods); + } + } + + /** + * Get the map of resource methods to ability names. + * + * @return array + */ + protected function resourceAbilityMap() + { + return [ + 'show' => 'view', + 'create' => 'create', + 'store' => 'create', + 'edit' => 'update', + 'update' => 'update', + 'destroy' => 'delete', + ]; + } + + /** + * Get the list of resource methods which do not have model parameters. + * + * @return array + */ + protected function resourceMethodsWithoutModels() + { + return ['index', 'create', 'store']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php new file mode 100644 index 0000000..6ee7171 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php @@ -0,0 +1,184 @@ +validateLogin($request); + + // If the class is using the ThrottlesLogins trait, we can automatically throttle + // the login attempts for this application. We'll key this by the username and + // the IP address of the client making these requests into this application. + if ($this->hasTooManyLoginAttempts($request)) { + $this->fireLockoutEvent($request); + + return $this->sendLockoutResponse($request); + } + + if ($this->attemptLogin($request)) { + return $this->sendLoginResponse($request); + } + + // If the login attempt was unsuccessful we will increment the number of attempts + // to login and redirect the user back to the login form. Of course, when this + // user surpasses their maximum number of attempts they will get locked out. + $this->incrementLoginAttempts($request); + + return $this->sendFailedLoginResponse($request); + } + + /** + * Validate the user login request. + * + * @param \Illuminate\Http\Request $request + * @return void + * + * @throws \Illuminate\Validation\ValidationException + */ + protected function validateLogin(Request $request) + { + $request->validate([ + $this->username() => 'required|string', + 'password' => 'required|string', + ]); + } + + /** + * Attempt to log the user into the application. + * + * @param \Illuminate\Http\Request $request + * @return bool + */ + protected function attemptLogin(Request $request) + { + return $this->guard()->attempt( + $this->credentials($request), $request->filled('remember') + ); + } + + /** + * Get the needed authorization credentials from the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function credentials(Request $request) + { + return $request->only($this->username(), 'password'); + } + + /** + * Send the response after the user was authenticated. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + protected function sendLoginResponse(Request $request) + { + $request->session()->regenerate(); + + $this->clearLoginAttempts($request); + + return $this->authenticated($request, $this->guard()->user()) + ?: redirect()->intended($this->redirectPath()); + } + + /** + * The user has been authenticated. + * + * @param \Illuminate\Http\Request $request + * @param mixed $user + * @return mixed + */ + protected function authenticated(Request $request, $user) + { + // + } + + /** + * Get the failed login response instance. + * + * @param \Illuminate\Http\Request $request + * @return \Symfony\Component\HttpFoundation\Response + * + * @throws \Illuminate\Validation\ValidationException + */ + protected function sendFailedLoginResponse(Request $request) + { + throw ValidationException::withMessages([ + $this->username() => [trans('auth.failed')], + ]); + } + + /** + * Get the login username to be used by the controller. + * + * @return string + */ + public function username() + { + return 'email'; + } + + /** + * Log the user out of the application. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function logout(Request $request) + { + $this->guard()->logout(); + + $request->session()->invalidate(); + + return $this->loggedOut($request) ?: redirect('/'); + } + + /** + * The user has logged out of the application. + * + * @param \Illuminate\Http\Request $request + * @return mixed + */ + protected function loggedOut(Request $request) + { + // + } + + /** + * Get the guard to be used during authentication. + * + * @return \Illuminate\Contracts\Auth\StatefulGuard + */ + protected function guard() + { + return Auth::guard(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUsers.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUsers.php new file mode 100644 index 0000000..cc99229 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUsers.php @@ -0,0 +1,20 @@ +redirectTo(); + } + + return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php new file mode 100644 index 0000000..f3238f2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php @@ -0,0 +1,62 @@ +validator($request->all())->validate(); + + event(new Registered($user = $this->create($request->all()))); + + $this->guard()->login($user); + + return $this->registered($request, $user) + ?: redirect($this->redirectPath()); + } + + /** + * Get the guard to be used during registration. + * + * @return \Illuminate\Contracts\Auth\StatefulGuard + */ + protected function guard() + { + return Auth::guard(); + } + + /** + * The user has been registered. + * + * @param \Illuminate\Http\Request $request + * @param mixed $user + * @return mixed + */ + protected function registered(Request $request, $user) + { + // + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php new file mode 100644 index 0000000..3cf5af9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php @@ -0,0 +1,162 @@ +with( + ['token' => $token, 'email' => $request->email] + ); + } + + /** + * Reset the given user's password. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse + */ + public function reset(Request $request) + { + $request->validate($this->rules(), $this->validationErrorMessages()); + + // Here we will attempt to reset the user's password. If it is successful we + // will update the password on an actual user model and persist it to the + // database. Otherwise we will parse the error and return the response. + $response = $this->broker()->reset( + $this->credentials($request), function ($user, $password) { + $this->resetPassword($user, $password); + } + ); + + // If the password was successfully reset, we will redirect the user back to + // the application's home authenticated view. If there is an error we can + // redirect them back to where they came from with their error message. + return $response == Password::PASSWORD_RESET + ? $this->sendResetResponse($request, $response) + : $this->sendResetFailedResponse($request, $response); + } + + /** + * Get the password reset validation rules. + * + * @return array + */ + protected function rules() + { + return [ + 'token' => 'required', + 'email' => 'required|email', + 'password' => 'required|confirmed|min:6', + ]; + } + + /** + * Get the password reset validation error messages. + * + * @return array + */ + protected function validationErrorMessages() + { + return []; + } + + /** + * Get the password reset credentials from the request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function credentials(Request $request) + { + return $request->only( + 'email', 'password', 'password_confirmation', 'token' + ); + } + + /** + * Reset the given user's password. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @param string $password + * @return void + */ + protected function resetPassword($user, $password) + { + $user->password = Hash::make($password); + + $user->setRememberToken(Str::random(60)); + + $user->save(); + + event(new PasswordReset($user)); + + $this->guard()->login($user); + } + + /** + * Get the response for a successful password reset. + * + * @param \Illuminate\Http\Request $request + * @param string $response + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse + */ + protected function sendResetResponse(Request $request, $response) + { + return redirect($this->redirectPath()) + ->with('status', trans($response)); + } + + /** + * Get the response for a failed password reset. + * + * @param \Illuminate\Http\Request $request + * @param string $response + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse + */ + protected function sendResetFailedResponse(Request $request, $response) + { + return redirect()->back() + ->withInput($request->only('email')) + ->withErrors(['email' => trans($response)]); + } + + /** + * Get the broker to be used during password reset. + * + * @return \Illuminate\Contracts\Auth\PasswordBroker + */ + public function broker() + { + return Password::broker(); + } + + /** + * Get the guard to be used during password reset. + * + * @return \Illuminate\Contracts\Auth\StatefulGuard + */ + protected function guard() + { + return Auth::guard(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/SendsPasswordResetEmails.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/SendsPasswordResetEmails.php new file mode 100644 index 0000000..52d77cc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/SendsPasswordResetEmails.php @@ -0,0 +1,88 @@ +validateEmail($request); + + // We will send the password reset link to this user. Once we have attempted + // to send the link, we will examine the response then see the message we + // need to show to the user. Finally, we'll send out a proper response. + $response = $this->broker()->sendResetLink( + $request->only('email') + ); + + return $response == Password::RESET_LINK_SENT + ? $this->sendResetLinkResponse($request, $response) + : $this->sendResetLinkFailedResponse($request, $response); + } + + /** + * Validate the email for the given request. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function validateEmail(Request $request) + { + $request->validate(['email' => 'required|email']); + } + + /** + * Get the response for a successful password reset link. + * + * @param \Illuminate\Http\Request $request + * @param string $response + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse + */ + protected function sendResetLinkResponse(Request $request, $response) + { + return back()->with('status', trans($response)); + } + + /** + * Get the response for a failed password reset link. + * + * @param \Illuminate\Http\Request $request + * @param string $response + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse + */ + protected function sendResetLinkFailedResponse(Request $request, $response) + { + return back() + ->withInput($request->only('email')) + ->withErrors(['email' => trans($response)]); + } + + /** + * Get the broker to be used during password reset. + * + * @return \Illuminate\Contracts\Auth\PasswordBroker + */ + public function broker() + { + return Password::broker(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ThrottlesLogins.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ThrottlesLogins.php new file mode 100644 index 0000000..1dca25c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ThrottlesLogins.php @@ -0,0 +1,121 @@ +limiter()->tooManyAttempts( + $this->throttleKey($request), $this->maxAttempts() + ); + } + + /** + * Increment the login attempts for the user. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function incrementLoginAttempts(Request $request) + { + $this->limiter()->hit( + $this->throttleKey($request), $this->decayMinutes() + ); + } + + /** + * Redirect the user after determining they are locked out. + * + * @param \Illuminate\Http\Request $request + * @return void + * + * @throws \Illuminate\Validation\ValidationException + */ + protected function sendLockoutResponse(Request $request) + { + $seconds = $this->limiter()->availableIn( + $this->throttleKey($request) + ); + + throw ValidationException::withMessages([ + $this->username() => [Lang::get('auth.throttle', ['seconds' => $seconds])], + ])->status(429); + } + + /** + * Clear the login locks for the given user credentials. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function clearLoginAttempts(Request $request) + { + $this->limiter()->clear($this->throttleKey($request)); + } + + /** + * Fire an event when a lockout occurs. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function fireLockoutEvent(Request $request) + { + event(new Lockout($request)); + } + + /** + * Get the throttle key for the given request. + * + * @param \Illuminate\Http\Request $request + * @return string + */ + protected function throttleKey(Request $request) + { + return Str::lower($request->input($this->username())).'|'.$request->ip(); + } + + /** + * Get the rate limiter instance. + * + * @return \Illuminate\Cache\RateLimiter + */ + protected function limiter() + { + return app(RateLimiter::class); + } + + /** + * Get the maximum number of attempts to allow. + * + * @return int + */ + public function maxAttempts() + { + return property_exists($this, 'maxAttempts') ? $this->maxAttempts : 5; + } + + /** + * Get the number of minutes to throttle for. + * + * @return int + */ + public function decayMinutes() + { + return property_exists($this, 'decayMinutes') ? $this->decayMinutes : 1; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Auth/User.php b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/User.php new file mode 100644 index 0000000..c816436 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Auth/User.php @@ -0,0 +1,20 @@ +user()->hasVerifiedEmail() + ? redirect($this->redirectPath()) + : view('auth.verify'); + } + + /** + * Mark the authenticated user's email address as verified. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + public function verify(Request $request) + { + if ($request->route('id') != $request->user()->getKey()) { + throw new AuthorizationException; + } + + if ($request->user()->markEmailAsVerified()) { + event(new Verified($request->user())); + } + + return redirect($this->redirectPath())->with('verified', true); + } + + /** + * Resend the email verification notification. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function resend(Request $request) + { + if ($request->user()->hasVerifiedEmail()) { + return redirect($this->redirectPath()); + } + + $request->user()->sendEmailVerificationNotification(); + + return back()->with('resent', true); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php new file mode 100644 index 0000000..2c0bcb0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php @@ -0,0 +1,19 @@ +boot(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php new file mode 100644 index 0000000..b7edb68 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php @@ -0,0 +1,161 @@ +app = $app; + + error_reporting(-1); + + set_error_handler([$this, 'handleError']); + + set_exception_handler([$this, 'handleException']); + + register_shutdown_function([$this, 'handleShutdown']); + + if (! $app->environment('testing')) { + ini_set('display_errors', 'Off'); + } + } + + /** + * Convert PHP errors to ErrorException instances. + * + * @param int $level + * @param string $message + * @param string $file + * @param int $line + * @param array $context + * @return void + * + * @throws \ErrorException + */ + public function handleError($level, $message, $file = '', $line = 0, $context = []) + { + if (error_reporting() & $level) { + throw new ErrorException($message, 0, $level, $file, $line); + } + } + + /** + * Handle an uncaught exception from the application. + * + * Note: Most exceptions can be handled via the try / catch block in + * the HTTP and Console kernels. But, fatal error exceptions must + * be handled differently since they are not normal exceptions. + * + * @param \Throwable $e + * @return void + */ + public function handleException($e) + { + if (! $e instanceof Exception) { + $e = new FatalThrowableError($e); + } + + try { + $this->getExceptionHandler()->report($e); + } catch (Exception $e) { + // + } + + if ($this->app->runningInConsole()) { + $this->renderForConsole($e); + } else { + $this->renderHttpResponse($e); + } + } + + /** + * Render an exception to the console. + * + * @param \Exception $e + * @return void + */ + protected function renderForConsole(Exception $e) + { + $this->getExceptionHandler()->renderForConsole(new ConsoleOutput, $e); + } + + /** + * Render an exception as an HTTP response and send it. + * + * @param \Exception $e + * @return void + */ + protected function renderHttpResponse(Exception $e) + { + $this->getExceptionHandler()->render($this->app['request'], $e)->send(); + } + + /** + * Handle the PHP shutdown event. + * + * @return void + */ + public function handleShutdown() + { + if (! is_null($error = error_get_last()) && $this->isFatal($error['type'])) { + $this->handleException($this->fatalExceptionFromError($error, 0)); + } + } + + /** + * Create a new fatal exception instance from an error array. + * + * @param array $error + * @param int|null $traceOffset + * @return \Symfony\Component\Debug\Exception\FatalErrorException + */ + protected function fatalExceptionFromError(array $error, $traceOffset = null) + { + return new FatalErrorException( + $error['message'], $error['type'], 0, $error['file'], $error['line'], $traceOffset + ); + } + + /** + * Determine if the error type is fatal. + * + * @param int $type + * @return bool + */ + protected function isFatal($type) + { + return in_array($type, [E_COMPILE_ERROR, E_CORE_ERROR, E_ERROR, E_PARSE]); + } + + /** + * Get an instance of the exception handler. + * + * @return \Illuminate\Contracts\Debug\ExceptionHandler + */ + protected function getExceptionHandler() + { + return $this->app->make(ExceptionHandler::class); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php new file mode 100644 index 0000000..8f4653d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php @@ -0,0 +1,116 @@ +getCachedConfigPath())) { + $items = require $cached; + + $loadedFromCache = true; + } + + // Next we will spin through all of the configuration files in the configuration + // directory and load each one into the repository. This will make all of the + // options available to the developer for use in various parts of this app. + $app->instance('config', $config = new Repository($items)); + + if (! isset($loadedFromCache)) { + $this->loadConfigurationFiles($app, $config); + } + + // Finally, we will set the application's environment based on the configuration + // values that were loaded. We will pass a callback which will be used to get + // the environment in a web context where an "--env" switch is not present. + $app->detectEnvironment(function () use ($config) { + return $config->get('app.env', 'production'); + }); + + date_default_timezone_set($config->get('app.timezone', 'UTC')); + + mb_internal_encoding('UTF-8'); + } + + /** + * Load the configuration items from all of the files. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param \Illuminate\Contracts\Config\Repository $repository + * @return void + * + * @throws \Exception + */ + protected function loadConfigurationFiles(Application $app, RepositoryContract $repository) + { + $files = $this->getConfigurationFiles($app); + + if (! isset($files['app'])) { + throw new Exception('Unable to load the "app" configuration file.'); + } + + foreach ($files as $key => $path) { + $repository->set($key, require $path); + } + } + + /** + * Get all of the configuration files for the application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return array + */ + protected function getConfigurationFiles(Application $app) + { + $files = []; + + $configPath = realpath($app->configPath()); + + foreach (Finder::create()->files()->name('*.php')->in($configPath) as $file) { + $directory = $this->getNestedDirectory($file, $configPath); + + $files[$directory.basename($file->getRealPath(), '.php')] = $file->getRealPath(); + } + + ksort($files, SORT_NATURAL); + + return $files; + } + + /** + * Get the configuration file nesting path. + * + * @param \SplFileInfo $file + * @param string $configPath + * @return string + */ + protected function getNestedDirectory(SplFileInfo $file, $configPath) + { + $directory = $file->getPath(); + + if ($nested = trim(str_replace($configPath, '', $directory), DIRECTORY_SEPARATOR)) { + $nested = str_replace(DIRECTORY_SEPARATOR, '.', $nested).'.'; + } + + return $nested; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php new file mode 100644 index 0000000..6eeb735 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php @@ -0,0 +1,79 @@ +configurationIsCached()) { + return; + } + + $this->checkForSpecificEnvironmentFile($app); + + try { + (new Dotenv($app->environmentPath(), $app->environmentFile()))->load(); + } catch (InvalidPathException $e) { + // + } catch (InvalidFileException $e) { + echo 'The environment file is invalid: '.$e->getMessage(); + die(1); + } + } + + /** + * Detect if a custom environment file matching the APP_ENV exists. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return void + */ + protected function checkForSpecificEnvironmentFile($app) + { + if ($app->runningInConsole() && ($input = new ArgvInput)->hasParameterOption('--env')) { + if ($this->setEnvironmentFilePath( + $app, $app->environmentFile().'.'.$input->getParameterOption('--env') + )) { + return; + } + } + + if (! env('APP_ENV')) { + return; + } + + $this->setEnvironmentFilePath( + $app, $app->environmentFile().'.'.env('APP_ENV') + ); + } + + /** + * Load a custom environment file. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param string $file + * @return bool + */ + protected function setEnvironmentFilePath($app, $file) + { + if (file_exists($app->environmentPath().'/'.$file)) { + $app->loadEnvironmentFrom($file); + + return true; + } + + return false; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php new file mode 100644 index 0000000..62a42d0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php @@ -0,0 +1,29 @@ +make('config')->get('app.aliases', []), + $app->make(PackageManifest::class)->aliases() + ))->register(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php new file mode 100644 index 0000000..f18375c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php @@ -0,0 +1,19 @@ +registerConfiguredProviders(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php new file mode 100644 index 0000000..fda735b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php @@ -0,0 +1,35 @@ +make('config')->get('app.url', 'http://localhost'); + + $components = parse_url($uri); + + $server = $_SERVER; + + if (isset($components['path'])) { + $server = array_merge($server, [ + 'SCRIPT_FILENAME' => $components['path'], + 'SCRIPT_NAME' => $components['path'], + ]); + } + + $app->instance('request', Request::create( + $uri, 'GET', [], [], [], $server + )); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php new file mode 100644 index 0000000..bd509a9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php @@ -0,0 +1,39 @@ +dispatchNow(new static(...func_get_args())); + } + + /** + * Set the jobs that should run if this job is successful. + * + * @param array $chain + * @return \Illuminate\Foundation\Bus\PendingChain + */ + public static function withChain($chain) + { + return new PendingChain(get_called_class(), $chain); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesJobs.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesJobs.php new file mode 100644 index 0000000..46d6e5b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesJobs.php @@ -0,0 +1,30 @@ +dispatch($job); + } + + /** + * Dispatch a job to its appropriate handler in the current process. + * + * @param mixed $job + * @return mixed + */ + public function dispatchNow($job) + { + return app(Dispatcher::class)->dispatchNow($job); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingChain.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingChain.php new file mode 100644 index 0000000..b345536 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingChain.php @@ -0,0 +1,45 @@ +class = $class; + $this->chain = $chain; + } + + /** + * Dispatch the job with the given arguments. + * + * @return \Illuminate\Foundation\Bus\PendingDispatch + */ + public function dispatch() + { + return (new PendingDispatch( + new $this->class(...func_get_args()) + ))->chain($this->chain); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingDispatch.php b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingDispatch.php new file mode 100644 index 0000000..8ae625a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Bus/PendingDispatch.php @@ -0,0 +1,114 @@ +job = $job; + } + + /** + * Set the desired connection for the job. + * + * @param string|null $connection + * @return $this + */ + public function onConnection($connection) + { + $this->job->onConnection($connection); + + return $this; + } + + /** + * Set the desired queue for the job. + * + * @param string|null $queue + * @return $this + */ + public function onQueue($queue) + { + $this->job->onQueue($queue); + + return $this; + } + + /** + * Set the desired connection for the chain. + * + * @param string|null $connection + * @return $this + */ + public function allOnConnection($connection) + { + $this->job->allOnConnection($connection); + + return $this; + } + + /** + * Set the desired queue for the chain. + * + * @param string|null $queue + * @return $this + */ + public function allOnQueue($queue) + { + $this->job->allOnQueue($queue); + + return $this; + } + + /** + * Set the desired delay for the job. + * + * @param \DateTime|int|null $delay + * @return $this + */ + public function delay($delay) + { + $this->job->delay($delay); + + return $this; + } + + /** + * Set the jobs that should run if this job is successful. + * + * @param array $chain + * @return $this + */ + public function chain($chain) + { + $this->job->chain($chain); + + return $this; + } + + /** + * Handle the object's destruction. + * + * @return void + */ + public function __destruct() + { + app(Dispatcher::class)->dispatch($this->job); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php b/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php new file mode 100644 index 0000000..fcda187 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php @@ -0,0 +1,65 @@ +getComposer()->getConfig()->get('vendor-dir').'/autoload.php'; + + static::clearCompiled(); + } + + /** + * Handle the post-update Composer event. + * + * @param \Composer\Script\Event $event + * @return void + */ + public static function postUpdate(Event $event) + { + require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php'; + + static::clearCompiled(); + } + + /** + * Handle the post-autoload-dump Composer event. + * + * @param \Composer\Script\Event $event + * @return void + */ + public static function postAutoloadDump(Event $event) + { + require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php'; + + static::clearCompiled(); + } + + /** + * Clear the cached Laravel bootstrapping files. + * + * @return void + */ + protected static function clearCompiled() + { + $laravel = new Application(getcwd()); + + if (file_exists($servicesPath = $laravel->getCachedServicesPath())) { + @unlink($servicesPath); + } + + if (file_exists($packagesPath = $laravel->getCachedPackagesPath())) { + @unlink($packagesPath); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/AppNameCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/AppNameCommand.php new file mode 100644 index 0000000..1c0d359 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/AppNameCommand.php @@ -0,0 +1,296 @@ +files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->currentRoot = trim($this->laravel->getNamespace(), '\\'); + + $this->setAppDirectoryNamespace(); + $this->setBootstrapNamespaces(); + $this->setConfigNamespaces(); + $this->setComposerNamespace(); + $this->setDatabaseFactoryNamespaces(); + + $this->info('Application namespace set!'); + + $this->composer->dumpAutoloads(); + + $this->call('optimize:clear'); + } + + /** + * Set the namespace on the files in the app directory. + * + * @return void + */ + protected function setAppDirectoryNamespace() + { + $files = Finder::create() + ->in($this->laravel['path']) + ->contains($this->currentRoot) + ->name('*.php'); + + foreach ($files as $file) { + $this->replaceNamespace($file->getRealPath()); + } + } + + /** + * Replace the App namespace at the given path. + * + * @param string $path + * @return void + */ + protected function replaceNamespace($path) + { + $search = [ + 'namespace '.$this->currentRoot.';', + $this->currentRoot.'\\', + ]; + + $replace = [ + 'namespace '.$this->argument('name').';', + $this->argument('name').'\\', + ]; + + $this->replaceIn($path, $search, $replace); + } + + /** + * Set the bootstrap namespaces. + * + * @return void + */ + protected function setBootstrapNamespaces() + { + $search = [ + $this->currentRoot.'\\Http', + $this->currentRoot.'\\Console', + $this->currentRoot.'\\Exceptions', + ]; + + $replace = [ + $this->argument('name').'\\Http', + $this->argument('name').'\\Console', + $this->argument('name').'\\Exceptions', + ]; + + $this->replaceIn($this->getBootstrapPath(), $search, $replace); + } + + /** + * Set the namespace in the appropriate configuration files. + * + * @return void + */ + protected function setConfigNamespaces() + { + $this->setAppConfigNamespaces(); + $this->setAuthConfigNamespace(); + $this->setServicesConfigNamespace(); + } + + /** + * Set the application provider namespaces. + * + * @return void + */ + protected function setAppConfigNamespaces() + { + $search = [ + $this->currentRoot.'\\Providers', + $this->currentRoot.'\\Http\\Controllers\\', + ]; + + $replace = [ + $this->argument('name').'\\Providers', + $this->argument('name').'\\Http\\Controllers\\', + ]; + + $this->replaceIn($this->getConfigPath('app'), $search, $replace); + } + + /** + * Set the authentication User namespace. + * + * @return void + */ + protected function setAuthConfigNamespace() + { + $this->replaceIn( + $this->getConfigPath('auth'), + $this->currentRoot.'\\User', + $this->argument('name').'\\User' + ); + } + + /** + * Set the services User namespace. + * + * @return void + */ + protected function setServicesConfigNamespace() + { + $this->replaceIn( + $this->getConfigPath('services'), + $this->currentRoot.'\\User', + $this->argument('name').'\\User' + ); + } + + /** + * Set the PSR-4 namespace in the Composer file. + * + * @return void + */ + protected function setComposerNamespace() + { + $this->replaceIn( + $this->getComposerPath(), + str_replace('\\', '\\\\', $this->currentRoot).'\\\\', + str_replace('\\', '\\\\', $this->argument('name')).'\\\\' + ); + } + + /** + * Set the namespace in database factory files. + * + * @return void + */ + protected function setDatabaseFactoryNamespaces() + { + $files = Finder::create() + ->in(database_path('factories')) + ->contains($this->currentRoot) + ->name('*.php'); + + foreach ($files as $file) { + $this->replaceIn( + $file->getRealPath(), + $this->currentRoot, $this->argument('name') + ); + } + } + + /** + * Replace the given string in the given file. + * + * @param string $path + * @param string|array $search + * @param string|array $replace + * @return void + */ + protected function replaceIn($path, $search, $replace) + { + if ($this->files->exists($path)) { + $this->files->put($path, str_replace($search, $replace, $this->files->get($path))); + } + } + + /** + * Get the path to the bootstrap/app.php file. + * + * @return string + */ + protected function getBootstrapPath() + { + return $this->laravel->bootstrapPath().'/app.php'; + } + + /** + * Get the path to the Composer.json file. + * + * @return string + */ + protected function getComposerPath() + { + return base_path('composer.json'); + } + + /** + * Get the path to the given configuration file. + * + * @param string $name + * @return string + */ + protected function getConfigPath($name) + { + return $this->laravel['path.config'].'/'.$name.'.php'; + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['name', InputArgument::REQUIRED, 'The desired namespace'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ChannelMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ChannelMakeCommand.php new file mode 100644 index 0000000..202d81c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ChannelMakeCommand.php @@ -0,0 +1,65 @@ +userProviderModel()), + parent::buildClass($name) + ); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return __DIR__.'/stubs/channel.stub'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Broadcasting'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php new file mode 100644 index 0000000..399a44d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php @@ -0,0 +1,40 @@ +laravel->getCachedServicesPath())) { + @unlink($servicesPath); + } + + if (file_exists($packagesPath = $this->laravel->getCachedPackagesPath())) { + @unlink($packagesPath); + } + + $this->info('Compiled services and packages files removed!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClosureCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClosureCommand.php new file mode 100644 index 0000000..1e34b86 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClosureCommand.php @@ -0,0 +1,71 @@ +callback = $callback; + $this->signature = $signature; + + parent::__construct(); + } + + /** + * Execute the console command. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @return mixed + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $inputs = array_merge($input->getArguments(), $input->getOptions()); + + $parameters = []; + + foreach ((new ReflectionFunction($this->callback))->getParameters() as $parameter) { + if (isset($inputs[$parameter->name])) { + $parameters[$parameter->name] = $inputs[$parameter->name]; + } + } + + return $this->laravel->call( + $this->callback->bindTo($this, $this), $parameters + ); + } + + /** + * Set the description for the command. + * + * @param string $description + * @return $this + */ + public function describe($description) + { + $this->setDescription($description); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php new file mode 100644 index 0000000..c127f6e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php @@ -0,0 +1,90 @@ +files = $files; + } + + /** + * Execute the console command. + * + * @return void + * + * @throws \LogicException + */ + public function handle() + { + $this->call('config:clear'); + + $config = $this->getFreshConfiguration(); + + $configPath = $this->laravel->getCachedConfigPath(); + + $this->files->put( + $configPath, 'files->delete($configPath); + + throw new LogicException('Your configuration files are not serializable.', 0, $e); + } + + $this->info('Configuration cached successfully!'); + } + + /** + * Boot a fresh copy of the application configuration. + * + * @return array + */ + protected function getFreshConfiguration() + { + $app = require $this->laravel->bootstrapPath().'/app.php'; + + $app->make(ConsoleKernelContract::class)->bootstrap(); + + return $app['config']->all(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigClearCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigClearCommand.php new file mode 100644 index 0000000..d20e2d8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigClearCommand.php @@ -0,0 +1,55 @@ +files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->files->delete($this->laravel->getCachedConfigPath()); + + $this->info('Configuration cache cleared!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php new file mode 100644 index 0000000..54183e9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php @@ -0,0 +1,90 @@ +option('command'), $stub); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return __DIR__.'/stubs/console.stub'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Console\Commands'; + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['name', InputArgument::REQUIRED, 'The name of the command'], + ]; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['command', null, InputOption::VALUE_OPTIONAL, 'The terminal command that should be assigned', 'command:name'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/DownCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/DownCommand.php new file mode 100644 index 0000000..ff1e594 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/DownCommand.php @@ -0,0 +1,69 @@ +getDownFilePayload(), JSON_PRETTY_PRINT) + ); + + $this->comment('Application is now in maintenance mode.'); + } + + /** + * Get the payload to be placed in the "down" file. + * + * @return array + */ + protected function getDownFilePayload() + { + return [ + 'time' => $this->currentTime(), + 'message' => $this->option('message'), + 'retry' => $this->getRetryTime(), + 'allowed' => $this->option('allow'), + ]; + } + + /** + * Get the number of seconds the client should wait before retrying their request. + * + * @return int|null + */ + protected function getRetryTime() + { + $retry = $this->option('retry'); + + return is_numeric($retry) && $retry > 0 ? (int) $retry : null; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/EnvironmentCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EnvironmentCommand.php new file mode 100644 index 0000000..ab3bb32 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EnvironmentCommand.php @@ -0,0 +1,32 @@ +line('Current application environment: '.$this->laravel['env'].''); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventGenerateCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventGenerateCommand.php new file mode 100644 index 0000000..0c6a4a7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventGenerateCommand.php @@ -0,0 +1,78 @@ +laravel->getProviders(EventServiceProvider::class); + + foreach ($providers as $provider) { + foreach ($provider->listens() as $event => $listeners) { + $this->makeEventAndListeners($event, $listeners); + } + } + + $this->info('Events and listeners generated successfully!'); + } + + /** + * Make the event and listeners for the given event. + * + * @param string $event + * @param array $listeners + * @return void + */ + protected function makeEventAndListeners($event, $listeners) + { + if (! Str::contains($event, '\\')) { + return; + } + + $this->callSilent('make:event', ['name' => $event]); + + $this->makeListeners($event, $listeners); + } + + /** + * Make the listeners for the given event. + * + * @param string $event + * @param array $listeners + * @return void + */ + protected function makeListeners($event, $listeners) + { + foreach ($listeners as $listener) { + $listener = preg_replace('/@.+$/', '', $listener); + + $this->callSilent('make:listener', array_filter( + ['name' => $listener, '--event' => $event] + )); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventMakeCommand.php new file mode 100644 index 0000000..f18719a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/EventMakeCommand.php @@ -0,0 +1,61 @@ +option('render')) { + return $this->option('report') + ? __DIR__.'/stubs/exception-render-report.stub' + : __DIR__.'/stubs/exception-render.stub'; + } + + return $this->option('report') + ? __DIR__.'/stubs/exception-report.stub' + : __DIR__.'/stubs/exception.stub'; + } + + /** + * Determine if the class already exists. + * + * @param string $rawName + * @return bool + */ + protected function alreadyExists($rawName) + { + return class_exists($this->rootNamespace().'Exceptions\\'.$rawName); + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Exceptions'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['render', null, InputOption::VALUE_NONE, 'Create the exception with an empty render method'], + + ['report', null, InputOption::VALUE_NONE, 'Create the exception with an empty report method'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/JobMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/JobMakeCommand.php new file mode 100644 index 0000000..60d942e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/JobMakeCommand.php @@ -0,0 +1,65 @@ +option('sync') + ? __DIR__.'/stubs/job.stub' + : __DIR__.'/stubs/job-queued.stub'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Jobs'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['sync', null, InputOption::VALUE_NONE, 'Indicates that job should be synchronous'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php new file mode 100644 index 0000000..1cdbd16 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php @@ -0,0 +1,367 @@ +app = $app; + $this->events = $events; + + $this->app->booted(function () { + $this->defineConsoleSchedule(); + }); + } + + /** + * Define the application's command schedule. + * + * @return void + */ + protected function defineConsoleSchedule() + { + $this->app->singleton(Schedule::class, function () { + return new Schedule; + }); + + $schedule = $this->app->make(Schedule::class); + + $this->schedule($schedule); + } + + /** + * Run the console application. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @return int + */ + public function handle($input, $output = null) + { + try { + $this->bootstrap(); + + return $this->getArtisan()->run($input, $output); + } catch (Exception $e) { + $this->reportException($e); + + $this->renderException($output, $e); + + return 1; + } catch (Throwable $e) { + $e = new FatalThrowableError($e); + + $this->reportException($e); + + $this->renderException($output, $e); + + return 1; + } + } + + /** + * Terminate the application. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param int $status + * @return void + */ + public function terminate($input, $status) + { + $this->app->terminate(); + } + + /** + * Define the application's command schedule. + * + * @param \Illuminate\Console\Scheduling\Schedule $schedule + * @return void + */ + protected function schedule(Schedule $schedule) + { + // + } + + /** + * Register the Closure based commands for the application. + * + * @return void + */ + protected function commands() + { + // + } + + /** + * Register a Closure based command with the application. + * + * @param string $signature + * @param \Closure $callback + * @return \Illuminate\Foundation\Console\ClosureCommand + */ + public function command($signature, Closure $callback) + { + $command = new ClosureCommand($signature, $callback); + + Artisan::starting(function ($artisan) use ($command) { + $artisan->add($command); + }); + + return $command; + } + + /** + * Register all of the commands in the given directory. + * + * @param array|string $paths + * @return void + */ + protected function load($paths) + { + $paths = array_unique(Arr::wrap($paths)); + + $paths = array_filter($paths, function ($path) { + return is_dir($path); + }); + + if (empty($paths)) { + return; + } + + $namespace = $this->app->getNamespace(); + + foreach ((new Finder)->in($paths)->files() as $command) { + $command = $namespace.str_replace( + ['/', '.php'], + ['\\', ''], + Str::after($command->getPathname(), app_path().DIRECTORY_SEPARATOR) + ); + + if (is_subclass_of($command, Command::class) && + ! (new ReflectionClass($command))->isAbstract()) { + Artisan::starting(function ($artisan) use ($command) { + $artisan->resolve($command); + }); + } + } + } + + /** + * Register the given command with the console application. + * + * @param \Symfony\Component\Console\Command\Command $command + * @return void + */ + public function registerCommand($command) + { + $this->getArtisan()->add($command); + } + + /** + * Run an Artisan console command by name. + * + * @param string $command + * @param array $parameters + * @param \Symfony\Component\Console\Output\OutputInterface $outputBuffer + * @return int + */ + public function call($command, array $parameters = [], $outputBuffer = null) + { + $this->bootstrap(); + + return $this->getArtisan()->call($command, $parameters, $outputBuffer); + } + + /** + * Queue the given console command. + * + * @param string $command + * @param array $parameters + * @return \Illuminate\Foundation\Bus\PendingDispatch + */ + public function queue($command, array $parameters = []) + { + return QueuedCommand::dispatch(func_get_args()); + } + + /** + * Get all of the commands registered with the console. + * + * @return array + */ + public function all() + { + $this->bootstrap(); + + return $this->getArtisan()->all(); + } + + /** + * Get the output for the last run command. + * + * @return string + */ + public function output() + { + $this->bootstrap(); + + return $this->getArtisan()->output(); + } + + /** + * Bootstrap the application for artisan commands. + * + * @return void + */ + public function bootstrap() + { + if (! $this->app->hasBeenBootstrapped()) { + $this->app->bootstrapWith($this->bootstrappers()); + } + + $this->app->loadDeferredProviders(); + + if (! $this->commandsLoaded) { + $this->commands(); + + $this->commandsLoaded = true; + } + } + + /** + * Get the Artisan application instance. + * + * @return \Illuminate\Console\Application + */ + protected function getArtisan() + { + if (is_null($this->artisan)) { + return $this->artisan = (new Artisan($this->app, $this->events, $this->app->version())) + ->resolveCommands($this->commands); + } + + return $this->artisan; + } + + /** + * Set the Artisan application instance. + * + * @param \Illuminate\Console\Application $artisan + * @return void + */ + public function setArtisan($artisan) + { + $this->artisan = $artisan; + } + + /** + * Get the bootstrap classes for the application. + * + * @return array + */ + protected function bootstrappers() + { + return $this->bootstrappers; + } + + /** + * Report the exception to the exception handler. + * + * @param \Exception $e + * @return void + */ + protected function reportException(Exception $e) + { + $this->app[ExceptionHandler::class]->report($e); + } + + /** + * Render the given exception. + * + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @param \Exception $e + * @return void + */ + protected function renderException($output, Exception $e) + { + $this->app[ExceptionHandler::class]->renderForConsole($output, $e); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php new file mode 100644 index 0000000..99492f0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php @@ -0,0 +1,111 @@ +generateRandomKey(); + + if ($this->option('show')) { + return $this->line(''.$key.''); + } + + // Next, we will replace the application key in the environment file so it is + // automatically setup for this developer. This key gets generated using a + // secure random byte generator and is later base64 encoded for storage. + if (! $this->setKeyInEnvironmentFile($key)) { + return; + } + + $this->laravel['config']['app.key'] = $key; + + $this->info('Application key set successfully.'); + } + + /** + * Generate a random key for the application. + * + * @return string + */ + protected function generateRandomKey() + { + return 'base64:'.base64_encode( + Encrypter::generateKey($this->laravel['config']['app.cipher']) + ); + } + + /** + * Set the application key in the environment file. + * + * @param string $key + * @return bool + */ + protected function setKeyInEnvironmentFile($key) + { + $currentKey = $this->laravel['config']['app.key']; + + if (strlen($currentKey) !== 0 && (! $this->confirmToProceed())) { + return false; + } + + $this->writeNewEnvironmentFileWith($key); + + return true; + } + + /** + * Write a new environment file with the given key. + * + * @param string $key + * @return void + */ + protected function writeNewEnvironmentFileWith($key) + { + file_put_contents($this->laravel->environmentFilePath(), preg_replace( + $this->keyReplacementPattern(), + 'APP_KEY='.$key, + file_get_contents($this->laravel->environmentFilePath()) + )); + } + + /** + * Get a regex pattern that will match env APP_KEY with any random key. + * + * @return string + */ + protected function keyReplacementPattern() + { + $escaped = preg_quote('='.$this->laravel['config']['app.key'], '/'); + + return "/^APP_KEY{$escaped}/m"; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ListenerMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ListenerMakeCommand.php new file mode 100644 index 0000000..c13bfbb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ListenerMakeCommand.php @@ -0,0 +1,112 @@ +option('event'); + + if (! Str::startsWith($event, [ + $this->laravel->getNamespace(), + 'Illuminate', + '\\', + ])) { + $event = $this->laravel->getNamespace().'Events\\'.$event; + } + + $stub = str_replace( + 'DummyEvent', class_basename($event), parent::buildClass($name) + ); + + return str_replace( + 'DummyFullEvent', $event, $stub + ); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + if ($this->option('queued')) { + return $this->option('event') + ? __DIR__.'/stubs/listener-queued.stub' + : __DIR__.'/stubs/listener-queued-duck.stub'; + } + + return $this->option('event') + ? __DIR__.'/stubs/listener.stub' + : __DIR__.'/stubs/listener-duck.stub'; + } + + /** + * Determine if the class already exists. + * + * @param string $rawName + * @return bool + */ + protected function alreadyExists($rawName) + { + return class_exists($rawName); + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Listeners'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['event', 'e', InputOption::VALUE_OPTIONAL, 'The event class being listened for'], + + ['queued', null, InputOption::VALUE_NONE, 'Indicates the event listener should be queued'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/MailMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/MailMakeCommand.php new file mode 100644 index 0000000..d401a9e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/MailMakeCommand.php @@ -0,0 +1,116 @@ +option('force')) { + return; + } + + if ($this->option('markdown')) { + $this->writeMarkdownTemplate(); + } + } + + /** + * Write the Markdown template for the mailable. + * + * @return void + */ + protected function writeMarkdownTemplate() + { + $path = resource_path('views/'.str_replace('.', '/', $this->option('markdown'))).'.blade.php'; + + if (! $this->files->isDirectory(dirname($path))) { + $this->files->makeDirectory(dirname($path), 0755, true); + } + + $this->files->put($path, file_get_contents(__DIR__.'/stubs/markdown.stub')); + } + + /** + * Build the class with the given name. + * + * @param string $name + * @return string + */ + protected function buildClass($name) + { + $class = parent::buildClass($name); + + if ($this->option('markdown')) { + $class = str_replace('DummyView', $this->option('markdown'), $class); + } + + return $class; + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return $this->option('markdown') + ? __DIR__.'/stubs/markdown-mail.stub' + : __DIR__.'/stubs/mail.stub'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Mail'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the mailable already exists'], + + ['markdown', 'm', InputOption::VALUE_OPTIONAL, 'Create a new Markdown template for the mailable'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ModelMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ModelMakeCommand.php new file mode 100644 index 0000000..c730499 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ModelMakeCommand.php @@ -0,0 +1,162 @@ +option('force')) { + return; + } + + if ($this->option('all')) { + $this->input->setOption('factory', true); + $this->input->setOption('migration', true); + $this->input->setOption('controller', true); + $this->input->setOption('resource', true); + } + + if ($this->option('factory')) { + $this->createFactory(); + } + + if ($this->option('migration')) { + $this->createMigration(); + } + + if ($this->option('controller') || $this->option('resource')) { + $this->createController(); + } + } + + /** + * Create a model factory for the model. + * + * @return void + */ + protected function createFactory() + { + $factory = Str::studly(class_basename($this->argument('name'))); + + $this->call('make:factory', [ + 'name' => "{$factory}Factory", + '--model' => $this->qualifyClass($this->getNameInput()), + ]); + } + + /** + * Create a migration file for the model. + * + * @return void + */ + protected function createMigration() + { + $table = Str::plural(Str::snake(class_basename($this->argument('name')))); + + if ($this->option('pivot')) { + $table = Str::singular($table); + } + + $this->call('make:migration', [ + 'name' => "create_{$table}_table", + '--create' => $table, + ]); + } + + /** + * Create a controller for the model. + * + * @return void + */ + protected function createController() + { + $controller = Str::studly(class_basename($this->argument('name'))); + + $modelName = $this->qualifyClass($this->getNameInput()); + + $this->call('make:controller', [ + 'name' => "{$controller}Controller", + '--model' => $this->option('resource') ? $modelName : null, + ]); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + if ($this->option('pivot')) { + return __DIR__.'/stubs/pivot.model.stub'; + } + + return __DIR__.'/stubs/model.stub'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['all', 'a', InputOption::VALUE_NONE, 'Generate a migration, factory, and resource controller for the model'], + + ['controller', 'c', InputOption::VALUE_NONE, 'Create a new controller for the model'], + + ['factory', 'f', InputOption::VALUE_NONE, 'Create a new factory for the model'], + + ['force', null, InputOption::VALUE_NONE, 'Create the class even if the model already exists'], + + ['migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model'], + + ['pivot', 'p', InputOption::VALUE_NONE, 'Indicates if the generated model should be a custom intermediate table model'], + + ['resource', 'r', InputOption::VALUE_NONE, 'Indicates if the generated controller should be a resource controller'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/NotificationMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/NotificationMakeCommand.php new file mode 100644 index 0000000..40e9d84 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/NotificationMakeCommand.php @@ -0,0 +1,116 @@ +option('force')) { + return; + } + + if ($this->option('markdown')) { + $this->writeMarkdownTemplate(); + } + } + + /** + * Write the Markdown template for the mailable. + * + * @return void + */ + protected function writeMarkdownTemplate() + { + $path = resource_path('views/'.str_replace('.', '/', $this->option('markdown'))).'.blade.php'; + + if (! $this->files->isDirectory(dirname($path))) { + $this->files->makeDirectory(dirname($path), 0755, true); + } + + $this->files->put($path, file_get_contents(__DIR__.'/stubs/markdown.stub')); + } + + /** + * Build the class with the given name. + * + * @param string $name + * @return string + */ + protected function buildClass($name) + { + $class = parent::buildClass($name); + + if ($this->option('markdown')) { + $class = str_replace('DummyView', $this->option('markdown'), $class); + } + + return $class; + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return $this->option('markdown') + ? __DIR__.'/stubs/markdown-notification.stub' + : __DIR__.'/stubs/notification.stub'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Notifications'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the notification already exists'], + + ['markdown', 'm', InputOption::VALUE_OPTIONAL, 'Create a new Markdown template for the notification'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ObserverMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ObserverMakeCommand.php new file mode 100644 index 0000000..77a8162 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ObserverMakeCommand.php @@ -0,0 +1,113 @@ +option('model'); + + return $model ? $this->replaceModel($stub, $model) : $stub; + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return $this->option('model') + ? __DIR__.'/stubs/observer.stub' + : __DIR__.'/stubs/observer.plain.stub'; + } + + /** + * Replace the model for the given stub. + * + * @param string $stub + * @param string $model + * @return string + */ + protected function replaceModel($stub, $model) + { + $model = str_replace('/', '\\', $model); + + $namespaceModel = $this->laravel->getNamespace().$model; + + if (Str::startsWith($model, '\\')) { + $stub = str_replace('NamespacedDummyModel', trim($model, '\\'), $stub); + } else { + $stub = str_replace('NamespacedDummyModel', $namespaceModel, $stub); + } + + $stub = str_replace( + "use {$namespaceModel};\nuse {$namespaceModel};", "use {$namespaceModel};", $stub + ); + + $model = class_basename(trim($model, '\\')); + + $stub = str_replace('DocDummyModel', Str::snake($model, ' '), $stub); + + $stub = str_replace('DummyModel', $model, $stub); + + return str_replace('dummyModel', Str::camel($model), $stub); + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Observers'; + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getOptions() + { + return [ + ['model', 'm', InputOption::VALUE_OPTIONAL, 'The model that the observer applies to.'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeClearCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeClearCommand.php new file mode 100644 index 0000000..0bd92df --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeClearCommand.php @@ -0,0 +1,38 @@ +call('view:clear'); + $this->call('cache:clear'); + $this->call('route:clear'); + $this->call('config:clear'); + $this->call('clear-compiled'); + + $this->info('Caches cleared successfully!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php new file mode 100644 index 0000000..af5d731 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php @@ -0,0 +1,35 @@ +call('config:cache'); + $this->call('route:cache'); + + $this->info('Files cached successfully!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php new file mode 100644 index 0000000..3ef8f01 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php @@ -0,0 +1,40 @@ +build(); + + foreach (array_keys($manifest->manifest) as $package) { + $this->line("Discovered Package: {$package}"); + } + + $this->info('Package manifest generated successfully.'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/PolicyMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/PolicyMakeCommand.php new file mode 100644 index 0000000..fba1e0c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/PolicyMakeCommand.php @@ -0,0 +1,144 @@ +replaceUserNamespace( + parent::buildClass($name) + ); + + $model = $this->option('model'); + + return $model ? $this->replaceModel($stub, $model) : $stub; + } + + /** + * Replace the User model namespace. + * + * @param string $stub + * @return string + */ + protected function replaceUserNamespace($stub) + { + $model = $this->userProviderModel(); + + if (! $model) { + return $stub; + } + + return str_replace( + $this->rootNamespace().'User', + $model, + $stub + ); + } + + /** + * Replace the model for the given stub. + * + * @param string $stub + * @param string $model + * @return string + */ + protected function replaceModel($stub, $model) + { + $model = str_replace('/', '\\', $model); + + $namespaceModel = $this->laravel->getNamespace().$model; + + if (Str::startsWith($model, '\\')) { + $stub = str_replace('NamespacedDummyModel', trim($model, '\\'), $stub); + } else { + $stub = str_replace('NamespacedDummyModel', $namespaceModel, $stub); + } + + $stub = str_replace( + "use {$namespaceModel};\nuse {$namespaceModel};", "use {$namespaceModel};", $stub + ); + + $model = class_basename(trim($model, '\\')); + + $dummyUser = class_basename($this->userProviderModel()); + + $dummyModel = Str::camel($model) === 'user' ? 'model' : $model; + + $stub = str_replace('DocDummyModel', Str::snake($dummyModel, ' '), $stub); + + $stub = str_replace('DummyModel', $model, $stub); + + $stub = str_replace('dummyModel', Str::camel($dummyModel), $stub); + + $stub = str_replace('DummyUser', $dummyUser, $stub); + + return str_replace('DocDummyPluralModel', Str::snake(Str::plural($dummyModel), ' '), $stub); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return $this->option('model') + ? __DIR__.'/stubs/policy.stub' + : __DIR__.'/stubs/policy.plain.stub'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Policies'; + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getOptions() + { + return [ + ['model', 'm', InputOption::VALUE_OPTIONAL, 'The model that the policy applies to'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/PresetCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/PresetCommand.php new file mode 100644 index 0000000..9c7e6c1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/PresetCommand.php @@ -0,0 +1,96 @@ +argument('type'))) { + return call_user_func(static::$macros[$this->argument('type')], $this); + } + + if (! in_array($this->argument('type'), ['none', 'bootstrap', 'vue', 'react'])) { + throw new InvalidArgumentException('Invalid preset.'); + } + + return $this->{$this->argument('type')}(); + } + + /** + * Install the "fresh" preset. + * + * @return void + */ + protected function none() + { + Presets\None::install(); + + $this->info('Frontend scaffolding removed successfully.'); + } + + /** + * Install the "bootstrap" preset. + * + * @return void + */ + protected function bootstrap() + { + Presets\Bootstrap::install(); + + $this->info('Bootstrap scaffolding installed successfully.'); + $this->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); + } + + /** + * Install the "vue" preset. + * + * @return void + */ + protected function vue() + { + Presets\Vue::install(); + + $this->info('Vue scaffolding installed successfully.'); + $this->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); + } + + /** + * Install the "react" preset. + * + * @return void + */ + protected function react() + { + Presets\React::install(); + + $this->info('React scaffolding installed successfully.'); + $this->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Bootstrap.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Bootstrap.php new file mode 100644 index 0000000..248e2f2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Bootstrap.php @@ -0,0 +1,44 @@ + '^4.0.0', + 'jquery' => '^3.2', + 'popper.js' => '^1.12', + ] + $packages; + } + + /** + * Update the Sass files for the application. + * + * @return void + */ + protected static function updateSass() + { + copy(__DIR__.'/bootstrap-stubs/_variables.scss', resource_path('sass/_variables.scss')); + copy(__DIR__.'/bootstrap-stubs/app.scss', resource_path('sass/app.scss')); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/None.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/None.php new file mode 100644 index 0000000..bc93a2a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/None.php @@ -0,0 +1,60 @@ +deleteDirectory(resource_path('js/components')); + $filesystem->delete(resource_path('sass/_variables.scss')); + $filesystem->deleteDirectory(base_path('node_modules')); + $filesystem->deleteDirectory(public_path('css')); + $filesystem->deleteDirectory(public_path('js')); + }); + } + + /** + * Update the given package array. + * + * @param array $packages + * @return array + */ + protected static function updatePackageArray(array $packages) + { + unset( + $packages['bootstrap'], + $packages['jquery'], + $packages['popper.js'], + $packages['vue'], + $packages['babel-preset-react'], + $packages['react'], + $packages['react-dom'] + ); + + return $packages; + } + + /** + * Write the stubs for the Sass and JavaScript files. + * + * @return void + */ + protected static function updateBootstrapping() + { + file_put_contents(resource_path('sass/app.scss'), ''.PHP_EOL); + copy(__DIR__.'/none-stubs/app.js', resource_path('js/app.js')); + copy(__DIR__.'/none-stubs/bootstrap.js', resource_path('js/bootstrap.js')); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Preset.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Preset.php new file mode 100644 index 0000000..efa0817 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Preset.php @@ -0,0 +1,65 @@ +isDirectory($directory = resource_path('js/components'))) { + $filesystem->makeDirectory($directory, 0755, true); + } + } + + /** + * Update the "package.json" file. + * + * @param bool $dev + * @return void + */ + protected static function updatePackages($dev = true) + { + if (! file_exists(base_path('package.json'))) { + return; + } + + $configurationKey = $dev ? 'devDependencies' : 'dependencies'; + + $packages = json_decode(file_get_contents(base_path('package.json')), true); + + $packages[$configurationKey] = static::updatePackageArray( + array_key_exists($configurationKey, $packages) ? $packages[$configurationKey] : [], + $configurationKey + ); + + ksort($packages[$configurationKey]); + + file_put_contents( + base_path('package.json'), + json_encode($packages, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT).PHP_EOL + ); + } + + /** + * Remove the installed Node modules. + * + * @return void + */ + protected static function removeNodeModules() + { + tap(new Filesystem, function ($files) { + $files->deleteDirectory(base_path('node_modules')); + + $files->delete(base_path('yarn.lock')); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/React.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/React.php new file mode 100644 index 0000000..e7f3b3b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/React.php @@ -0,0 +1,76 @@ + '^6.23.0', + 'react' => '^16.2.0', + 'react-dom' => '^16.2.0', + ] + Arr::except($packages, ['vue']); + } + + /** + * Update the Webpack configuration. + * + * @return void + */ + protected static function updateWebpackConfiguration() + { + copy(__DIR__.'/react-stubs/webpack.mix.js', base_path('webpack.mix.js')); + } + + /** + * Update the example component. + * + * @return void + */ + protected static function updateComponent() + { + (new Filesystem)->delete( + resource_path('js/components/ExampleComponent.vue') + ); + + copy( + __DIR__.'/react-stubs/Example.js', + resource_path('js/components/Example.js') + ); + } + + /** + * Update the bootstrapping files. + * + * @return void + */ + protected static function updateBootstrapping() + { + copy(__DIR__.'/react-stubs/app.js', resource_path('js/app.js')); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Vue.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Vue.php new file mode 100644 index 0000000..d25ffb8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Vue.php @@ -0,0 +1,76 @@ + '^2.5.17'] + Arr::except($packages, [ + 'babel-preset-react', + 'react', + 'react-dom', + ]); + } + + /** + * Update the Webpack configuration. + * + * @return void + */ + protected static function updateWebpackConfiguration() + { + copy(__DIR__.'/vue-stubs/webpack.mix.js', base_path('webpack.mix.js')); + } + + /** + * Update the example component. + * + * @return void + */ + protected static function updateComponent() + { + (new Filesystem)->delete( + resource_path('js/components/Example.js') + ); + + copy( + __DIR__.'/vue-stubs/ExampleComponent.vue', + resource_path('js/components/ExampleComponent.vue') + ); + } + + /** + * Update the bootstrapping files. + * + * @return void + */ + protected static function updateBootstrapping() + { + copy(__DIR__.'/vue-stubs/app.js', resource_path('js/app.js')); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/_variables.scss b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/_variables.scss new file mode 100644 index 0000000..6799fc4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/_variables.scss @@ -0,0 +1,20 @@ + +// Body +$body-bg: #f8fafc; + +// Typography +$font-family-sans-serif: "Nunito", sans-serif; +$font-size-base: 0.9rem; +$line-height-base: 1.6; + +// Colors +$blue: #3490dc; +$indigo: #6574cd; +$purple: #9561e2; +$pink: #f66D9b; +$red: #e3342f; +$orange: #f6993f; +$yellow: #ffed4a; +$green: #38c172; +$teal: #4dc0b5; +$cyan: #6cb2eb; diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/app.scss b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/app.scss new file mode 100644 index 0000000..f42e798 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/app.scss @@ -0,0 +1,14 @@ + +// Fonts +@import url('https://fonts.googleapis.com/css?family=Nunito'); + +// Variables +@import 'variables'; + +// Bootstrap +@import '~bootstrap/scss/bootstrap'; + +.navbar-laravel { + background-color: #fff; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04); +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/app.js b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/app.js new file mode 100644 index 0000000..e34e8a4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/app.js @@ -0,0 +1,8 @@ + +/** + * First, we will load all of this project's Javascript utilities and other + * dependencies. Then, we will be ready to develop a robust and powerful + * application frontend using useful Laravel and JavaScript libraries. + */ + +require('./bootstrap'); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/bootstrap.js b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/bootstrap.js new file mode 100644 index 0000000..372bf25 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/none-stubs/bootstrap.js @@ -0,0 +1,43 @@ + +window._ = require('lodash'); + +/** + * We'll load the axios HTTP library which allows us to easily issue requests + * to our Laravel back-end. This library automatically handles sending the + * CSRF token as a header based on the value of the "XSRF" token cookie. + */ + +window.axios = require('axios'); + +window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; + +/** + * Next we will register the CSRF Token as a common header with Axios so that + * all outgoing HTTP requests automatically have it attached. This is just + * a simple convenience so we don't have to attach every token manually. + */ + +let token = document.head.querySelector('meta[name="csrf-token"]'); + +if (token) { + window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; +} else { + console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); +} + +/** + * Echo exposes an expressive API for subscribing to channels and listening + * for events that are broadcast by Laravel. Echo and event broadcasting + * allows your team to easily build robust real-time web applications. + */ + +// import Echo from 'laravel-echo' + +// window.Pusher = require('pusher-js'); + +// window.Echo = new Echo({ +// broadcaster: 'pusher', +// key: process.env.MIX_PUSHER_APP_KEY, +// cluster: process.env.MIX_PUSHER_APP_CLUSTER, +// encrypted: true +// }); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/Example.js b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/Example.js new file mode 100644 index 0000000..937bb98 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/Example.js @@ -0,0 +1,26 @@ +import React, { Component } from 'react'; +import ReactDOM from 'react-dom'; + +export default class Example extends Component { + render() { + return ( +
+
+
+
+
Example Component
+ +
+ I'm an example component! +
+
+
+
+
+ ); + } +} + +if (document.getElementById('example')) { + ReactDOM.render(, document.getElementById('example')); +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/app.js b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/app.js new file mode 100644 index 0000000..583ecce --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/app.js @@ -0,0 +1,16 @@ + +/** + * First we will load all of this project's JavaScript dependencies which + * includes React and other helpers. It's a great starting point while + * building robust, powerful web applications using React + Laravel. + */ + +require('./bootstrap'); + +/** + * Next, we will create a fresh React component instance and attach it to + * the page. Then, you may begin adding components to this application + * or customize the JavaScript scaffolding to fit your unique needs. + */ + +require('./components/Example'); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/webpack.mix.js b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/webpack.mix.js new file mode 100644 index 0000000..cc075aa --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/react-stubs/webpack.mix.js @@ -0,0 +1,15 @@ +const mix = require('laravel-mix'); + +/* + |-------------------------------------------------------------------------- + | Mix Asset Management + |-------------------------------------------------------------------------- + | + | Mix provides a clean, fluent API for defining some Webpack build steps + | for your Laravel application. By default, we are compiling the Sass + | file for the application as well as bundling up all the JS files. + | + */ + +mix.react('resources/js/app.js', 'public/js') + .sass('resources/sass/app.scss', 'public/css'); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/ExampleComponent.vue b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/ExampleComponent.vue new file mode 100644 index 0000000..3fb9f9a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/ExampleComponent.vue @@ -0,0 +1,23 @@ + + + diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/app.js b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/app.js new file mode 100644 index 0000000..98eca79 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/app.js @@ -0,0 +1,22 @@ + +/** + * First we will load all of this project's JavaScript dependencies which + * includes Vue and other libraries. It is a great starting point when + * building robust, powerful web applications using Vue and Laravel. + */ + +require('./bootstrap'); + +window.Vue = require('vue'); + +/** + * Next, we will create a fresh Vue application instance and attach it to + * the page. Then, you may begin adding components to this application + * or customize the JavaScript scaffolding to fit your unique needs. + */ + +Vue.component('example-component', require('./components/ExampleComponent.vue')); + +const app = new Vue({ + el: '#app' +}); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/webpack.mix.js b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/webpack.mix.js new file mode 100644 index 0000000..19a48fa --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/vue-stubs/webpack.mix.js @@ -0,0 +1,15 @@ +const mix = require('laravel-mix'); + +/* + |-------------------------------------------------------------------------- + | Mix Asset Management + |-------------------------------------------------------------------------- + | + | Mix provides a clean, fluent API for defining some Webpack build steps + | for your Laravel application. By default, we are compiling the Sass + | file for the application as well as bundling up all the JS files. + | + */ + +mix.js('resources/js/app.js', 'public/js') + .sass('resources/sass/app.scss', 'public/css'); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ProviderMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ProviderMakeCommand.php new file mode 100644 index 0000000..fa887ed --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ProviderMakeCommand.php @@ -0,0 +1,50 @@ +data = $data; + } + + /** + * Handle the job. + * + * @param \Illuminate\Contracts\Console\Kernel $kernel + * @return void + */ + public function handle(KernelContract $kernel) + { + call_user_func_array([$kernel, 'call'], $this->data); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php new file mode 100644 index 0000000..95b7a87 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php @@ -0,0 +1,50 @@ +collection()) { + $this->type = 'Resource collection'; + } + + parent::handle(); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return $this->collection() + ? __DIR__.'/stubs/resource-collection.stub' + : __DIR__.'/stubs/resource.stub'; + } + + /** + * Determine if the command is generating a resource collection. + * + * @return bool + */ + protected function collection() + { + return $this->option('collection') || + Str::endsWith($this->argument('name'), 'Collection'); + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Http\Resources'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['collection', 'c', InputOption::VALUE_NONE, 'Create a resource collection'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteCacheCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteCacheCommand.php new file mode 100644 index 0000000..3c85b87 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteCacheCommand.php @@ -0,0 +1,109 @@ +files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->call('route:clear'); + + $routes = $this->getFreshApplicationRoutes(); + + if (count($routes) === 0) { + return $this->error("Your application doesn't have any routes."); + } + + foreach ($routes as $route) { + $route->prepareForSerialization(); + } + + $this->files->put( + $this->laravel->getCachedRoutesPath(), $this->buildRouteCacheFile($routes) + ); + + $this->info('Routes cached successfully!'); + } + + /** + * Boot a fresh copy of the application and get the routes. + * + * @return \Illuminate\Routing\RouteCollection + */ + protected function getFreshApplicationRoutes() + { + return tap($this->getFreshApplication()['router']->getRoutes(), function ($routes) { + $routes->refreshNameLookups(); + $routes->refreshActionLookups(); + }); + } + + /** + * Get a fresh application instance. + * + * @return \Illuminate\Foundation\Application + */ + protected function getFreshApplication() + { + return tap(require $this->laravel->bootstrapPath().'/app.php', function ($app) { + $app->make(ConsoleKernelContract::class)->bootstrap(); + }); + } + + /** + * Build the route cache file. + * + * @param \Illuminate\Routing\RouteCollection $routes + * @return string + */ + protected function buildRouteCacheFile(RouteCollection $routes) + { + $stub = $this->files->get(__DIR__.'/stubs/routes.stub'); + + return str_replace('{{routes}}', base64_encode(serialize($routes)), $stub); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteClearCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteClearCommand.php new file mode 100644 index 0000000..03fab1d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteClearCommand.php @@ -0,0 +1,55 @@ +files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->files->delete($this->laravel->getCachedRoutesPath()); + + $this->info('Route cache cleared!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php new file mode 100644 index 0000000..12af805 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php @@ -0,0 +1,192 @@ +router = $router; + $this->routes = $router->getRoutes(); + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + if (count($this->routes) === 0) { + return $this->error("Your application doesn't have any routes."); + } + + $this->displayRoutes($this->getRoutes()); + } + + /** + * Compile the routes into a displayable format. + * + * @return array + */ + protected function getRoutes() + { + $routes = collect($this->routes)->map(function ($route) { + return $this->getRouteInformation($route); + })->all(); + + if ($sort = $this->option('sort')) { + $routes = $this->sortRoutes($sort, $routes); + } + + if ($this->option('reverse')) { + $routes = array_reverse($routes); + } + + return array_filter($routes); + } + + /** + * Get the route information for a given route. + * + * @param \Illuminate\Routing\Route $route + * @return array + */ + protected function getRouteInformation(Route $route) + { + return $this->filterRoute([ + 'host' => $route->domain(), + 'method' => implode('|', $route->methods()), + 'uri' => $route->uri(), + 'name' => $route->getName(), + 'action' => ltrim($route->getActionName(), '\\'), + 'middleware' => $this->getMiddleware($route), + ]); + } + + /** + * Sort the routes by a given element. + * + * @param string $sort + * @param array $routes + * @return array + */ + protected function sortRoutes($sort, $routes) + { + return Arr::sort($routes, function ($route) use ($sort) { + return $route[$sort]; + }); + } + + /** + * Display the route information on the console. + * + * @param array $routes + * @return void + */ + protected function displayRoutes(array $routes) + { + $this->table($this->headers, $routes); + } + + /** + * Get before filters. + * + * @param \Illuminate\Routing\Route $route + * @return string + */ + protected function getMiddleware($route) + { + return collect($route->gatherMiddleware())->map(function ($middleware) { + return $middleware instanceof Closure ? 'Closure' : $middleware; + })->implode(','); + } + + /** + * Filter the route by URI and / or name. + * + * @param array $route + * @return array|null + */ + protected function filterRoute(array $route) + { + if (($this->option('name') && ! Str::contains($route['name'], $this->option('name'))) || + $this->option('path') && ! Str::contains($route['uri'], $this->option('path')) || + $this->option('method') && ! Str::contains($route['method'], strtoupper($this->option('method')))) { + return; + } + + return $route; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['method', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by method'], + + ['name', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by name'], + + ['path', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by path'], + + ['reverse', 'r', InputOption::VALUE_NONE, 'Reverse the ordering of the routes'], + + ['sort', null, InputOption::VALUE_OPTIONAL, 'The column (host, method, uri, name, action, middleware) to sort by', 'uri'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/RuleMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RuleMakeCommand.php new file mode 100644 index 0000000..2b69953 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/RuleMakeCommand.php @@ -0,0 +1,50 @@ +line("Laravel development server started: host()}:{$this->port()}>"); + + passthru($this->serverCommand(), $status); + + return $status; + } + + /** + * Get the full server command. + * + * @return string + */ + protected function serverCommand() + { + return sprintf('%s -S %s:%s %s', + ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)), + $this->host(), + $this->port(), + ProcessUtils::escapeArgument(base_path('server.php')) + ); + } + + /** + * Get the host for the command. + * + * @return string + */ + protected function host() + { + return $this->input->getOption('host'); + } + + /** + * Get the port for the command. + * + * @return string + */ + protected function port() + { + return $this->input->getOption('port'); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on', '127.0.0.1'], + + ['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on', 8000], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php new file mode 100644 index 0000000..11e5c14 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/StorageLinkCommand.php @@ -0,0 +1,40 @@ +error('The "public/storage" directory already exists.'); + } + + $this->laravel->make('files')->link( + storage_path('app/public'), public_path('storage') + ); + + $this->info('The [public/storage] directory has been linked.'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/TestMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/TestMakeCommand.php new file mode 100644 index 0000000..ea08d7c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/TestMakeCommand.php @@ -0,0 +1,82 @@ +option('unit')) { + return __DIR__.'/stubs/unit-test.stub'; + } + + return __DIR__.'/stubs/test.stub'; + } + + /** + * Get the destination class path. + * + * @param string $name + * @return string + */ + protected function getPath($name) + { + $name = Str::replaceFirst($this->rootNamespace(), '', $name); + + return base_path('tests').str_replace('\\', '/', $name).'.php'; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + if ($this->option('unit')) { + return $rootNamespace.'\Unit'; + } else { + return $rootNamespace.'\Feature'; + } + } + + /** + * Get the root namespace for the class. + * + * @return string + */ + protected function rootNamespace() + { + return 'Tests'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/UpCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/UpCommand.php new file mode 100644 index 0000000..8055456 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/UpCommand.php @@ -0,0 +1,34 @@ +info('Application is now live.'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php new file mode 100644 index 0000000..5c878cd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php @@ -0,0 +1,275 @@ +files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $this->determineWhatShouldBePublished(); + + foreach ($this->tags ?: [null] as $tag) { + $this->publishTag($tag); + } + + $this->info('Publishing complete.'); + } + + /** + * Determine the provider or tag(s) to publish. + * + * @return void + */ + protected function determineWhatShouldBePublished() + { + if ($this->option('all')) { + return; + } + + [$this->provider, $this->tags] = [ + $this->option('provider'), (array) $this->option('tag'), + ]; + + if (! $this->provider && ! $this->tags) { + $this->promptForProviderOrTag(); + } + } + + /** + * Prompt for which provider or tag to publish. + * + * @return void + */ + protected function promptForProviderOrTag() + { + $choice = $this->choice( + "Which provider or tag's files would you like to publish?", + $choices = $this->publishableChoices() + ); + + if ($choice == $choices[0] || is_null($choice)) { + return; + } + + $this->parseChoice($choice); + } + + /** + * The choices available via the prompt. + * + * @return array + */ + protected function publishableChoices() + { + return array_merge( + ['Publish files from all providers and tags listed below'], + preg_filter('/^/', 'Provider: ', Arr::sort(ServiceProvider::publishableProviders())), + preg_filter('/^/', 'Tag: ', Arr::sort(ServiceProvider::publishableGroups())) + ); + } + + /** + * Parse the answer that was given via the prompt. + * + * @param string $choice + * @return void + */ + protected function parseChoice($choice) + { + [$type, $value] = explode(': ', strip_tags($choice)); + + if ($type === 'Provider') { + $this->provider = $value; + } elseif ($type === 'Tag') { + $this->tags = [$value]; + } + } + + /** + * Publishes the assets for a tag. + * + * @param string $tag + * @return mixed + */ + protected function publishTag($tag) + { + foreach ($this->pathsToPublish($tag) as $from => $to) { + $this->publishItem($from, $to); + } + } + + /** + * Get all of the paths to publish. + * + * @param string $tag + * @return array + */ + protected function pathsToPublish($tag) + { + return ServiceProvider::pathsToPublish( + $this->provider, $tag + ); + } + + /** + * Publish the given item from and to the given location. + * + * @param string $from + * @param string $to + * @return void + */ + protected function publishItem($from, $to) + { + if ($this->files->isFile($from)) { + return $this->publishFile($from, $to); + } elseif ($this->files->isDirectory($from)) { + return $this->publishDirectory($from, $to); + } + + $this->error("Can't locate path: <{$from}>"); + } + + /** + * Publish the file to the given path. + * + * @param string $from + * @param string $to + * @return void + */ + protected function publishFile($from, $to) + { + if (! $this->files->exists($to) || $this->option('force')) { + $this->createParentDirectory(dirname($to)); + + $this->files->copy($from, $to); + + $this->status($from, $to, 'File'); + } + } + + /** + * Publish the directory to the given directory. + * + * @param string $from + * @param string $to + * @return void + */ + protected function publishDirectory($from, $to) + { + $this->moveManagedFiles(new MountManager([ + 'from' => new Flysystem(new LocalAdapter($from)), + 'to' => new Flysystem(new LocalAdapter($to)), + ])); + + $this->status($from, $to, 'Directory'); + } + + /** + * Move all the files in the given MountManager. + * + * @param \League\Flysystem\MountManager $manager + * @return void + */ + protected function moveManagedFiles($manager) + { + foreach ($manager->listContents('from://', true) as $file) { + if ($file['type'] === 'file' && (! $manager->has('to://'.$file['path']) || $this->option('force'))) { + $manager->put('to://'.$file['path'], $manager->read('from://'.$file['path'])); + } + } + } + + /** + * Create the directory to house the published files if needed. + * + * @param string $directory + * @return void + */ + protected function createParentDirectory($directory) + { + if (! $this->files->isDirectory($directory)) { + $this->files->makeDirectory($directory, 0755, true); + } + } + + /** + * Write a status message to the console. + * + * @param string $from + * @param string $to + * @param string $type + * @return void + */ + protected function status($from, $to, $type) + { + $from = str_replace(base_path(), '', realpath($from)); + + $to = str_replace(base_path(), '', realpath($to)); + + $this->line('Copied '.$type.' ['.$from.'] To ['.$to.']'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewCacheCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewCacheCommand.php new file mode 100644 index 0000000..408d959 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewCacheCommand.php @@ -0,0 +1,85 @@ +paths()->each(function ($path) { + $this->compileViews($this->bladeFilesIn([$path])); + }); + + $this->info('Blade templates cached successfully!'); + } + + /** + * Compile the given view files. + * + * @param \Illuminate\Support\Collection $views + * @return void + */ + protected function compileViews(Collection $views) + { + $compiler = $this->laravel['view']->getEngineResolver()->resolve('blade')->getCompiler(); + + $views->map(function (SplFileInfo $file) use ($compiler) { + $compiler->compile($file->getRealPath()); + }); + } + + /** + * Get the Blade files in the given path. + * + * @param array $paths + * @return \Illuminate\Support\Collection + */ + protected function bladeFilesIn(array $paths) + { + return collect( + Finder::create() + ->in($paths) + ->exclude('vendor') + ->name('*.blade.php') + ->files() + ); + } + + /** + * Get all of the possible view paths. + * + * @return \Illuminate\Support\Collection + */ + protected function paths() + { + $finder = $this->laravel['view']->getFinder(); + + return collect($finder->getPaths())->merge( + collect($finder->getHints())->flatten() + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewClearCommand.php b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewClearCommand.php new file mode 100644 index 0000000..251e393 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/ViewClearCommand.php @@ -0,0 +1,66 @@ +files = $files; + } + + /** + * Execute the console command. + * + * @return void + * + * @throws \RuntimeException + */ + public function handle() + { + $path = $this->laravel['config']['view.compiled']; + + if (! $path) { + throw new RuntimeException('View path not found.'); + } + + foreach ($this->files->glob("{$path}/*") as $view) { + $this->files->delete($view); + } + + $this->info('Compiled views cleared!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/channel.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/channel.stub new file mode 100644 index 0000000..bf261cc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/channel.stub @@ -0,0 +1,29 @@ +view('view.name'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown-mail.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown-mail.stub new file mode 100644 index 0000000..25a0cdc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown-mail.stub @@ -0,0 +1,33 @@ +markdown('DummyView'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown-notification.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown-notification.stub new file mode 100644 index 0000000..f554b2c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown-notification.stub @@ -0,0 +1,58 @@ +markdown('DummyView'); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * @return array + */ + public function toArray($notifiable) + { + return [ + // + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown.stub new file mode 100644 index 0000000..bc41428 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/markdown.stub @@ -0,0 +1,12 @@ +@component('mail::message') +# Introduction + +The body of your message. + +@component('mail::button', ['url' => '']) +Button Text +@endcomponent + +Thanks,
+{{ config('app.name') }} +@endcomponent diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/model.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/model.stub new file mode 100644 index 0000000..f01a833 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/model.stub @@ -0,0 +1,10 @@ +line('The introduction to the notification.') + ->action('Notification Action', url('/')) + ->line('Thank you for using our application!'); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * @return array + */ + public function toArray($notifiable) + { + return [ + // + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/observer.plain.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/observer.plain.stub new file mode 100644 index 0000000..daae325 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/observer.plain.stub @@ -0,0 +1,8 @@ +setRoutes( + unserialize(base64_decode('{{routes}}')) +); diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/rule.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/rule.stub new file mode 100644 index 0000000..826af0d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/rule.stub @@ -0,0 +1,40 @@ +assertTrue(true); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/unit-test.stub b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/unit-test.stub new file mode 100644 index 0000000..173fb8d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/unit-test.stub @@ -0,0 +1,20 @@ +assertTrue(true); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php b/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php new file mode 100644 index 0000000..205f73b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php @@ -0,0 +1,69 @@ +detectConsoleEnvironment($callback, $consoleArgs); + } + + return $this->detectWebEnvironment($callback); + } + + /** + * Set the application environment for a web request. + * + * @param \Closure $callback + * @return string + */ + protected function detectWebEnvironment(Closure $callback) + { + return call_user_func($callback); + } + + /** + * Set the application environment from command-line arguments. + * + * @param \Closure $callback + * @param array $args + * @return string + */ + protected function detectConsoleEnvironment(Closure $callback, array $args) + { + // First we will check if an environment argument was passed via console arguments + // and if it was that automatically overrides as the environment. Otherwise, we + // will check the environment as a "web" request like a typical HTTP request. + if (! is_null($value = $this->getEnvironmentArgument($args))) { + return head(array_slice(explode('=', $value), 1)); + } + + return $this->detectWebEnvironment($callback); + } + + /** + * Get the environment argument from the console. + * + * @param array $args + * @return string|null + */ + protected function getEnvironmentArgument(array $args) + { + return Arr::first($args, function ($value) { + return Str::startsWith($value, '--env'); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Events/Dispatchable.php b/vendor/laravel/framework/src/Illuminate/Foundation/Events/Dispatchable.php new file mode 100644 index 0000000..0018295 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Events/Dispatchable.php @@ -0,0 +1,26 @@ +locale = $locale; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php new file mode 100644 index 0000000..4a2d285 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php @@ -0,0 +1,482 @@ +container = $container; + } + + /** + * Report or log an exception. + * + * @param \Exception $e + * @return mixed + * + * @throws \Exception + */ + public function report(Exception $e) + { + if ($this->shouldntReport($e)) { + return; + } + + if (method_exists($e, 'report')) { + return $e->report(); + } + + try { + $logger = $this->container->make(LoggerInterface::class); + } catch (Exception $ex) { + throw $e; + } + + $logger->error( + $e->getMessage(), + array_merge($this->context(), ['exception' => $e] + )); + } + + /** + * Determine if the exception should be reported. + * + * @param \Exception $e + * @return bool + */ + public function shouldReport(Exception $e) + { + return ! $this->shouldntReport($e); + } + + /** + * Determine if the exception is in the "do not report" list. + * + * @param \Exception $e + * @return bool + */ + protected function shouldntReport(Exception $e) + { + $dontReport = array_merge($this->dontReport, $this->internalDontReport); + + return ! is_null(Arr::first($dontReport, function ($type) use ($e) { + return $e instanceof $type; + })); + } + + /** + * Get the default context variables for logging. + * + * @return array + */ + protected function context() + { + try { + return array_filter([ + 'userId' => Auth::id(), + 'email' => Auth::user() ? Auth::user()->email : null, + ]); + } catch (Throwable $e) { + return []; + } + } + + /** + * Render an exception into a response. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $e + * @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\Response + */ + public function render($request, Exception $e) + { + if (method_exists($e, 'render') && $response = $e->render($request)) { + return Router::toResponse($request, $response); + } elseif ($e instanceof Responsable) { + return $e->toResponse($request); + } + + $e = $this->prepareException($e); + + if ($e instanceof HttpResponseException) { + return $e->getResponse(); + } elseif ($e instanceof AuthenticationException) { + return $this->unauthenticated($request, $e); + } elseif ($e instanceof ValidationException) { + return $this->convertValidationExceptionToResponse($e, $request); + } + + return $request->expectsJson() + ? $this->prepareJsonResponse($request, $e) + : $this->prepareResponse($request, $e); + } + + /** + * Prepare exception for rendering. + * + * @param \Exception $e + * @return \Exception + */ + protected function prepareException(Exception $e) + { + if ($e instanceof ModelNotFoundException) { + $e = new NotFoundHttpException($e->getMessage(), $e); + } elseif ($e instanceof AuthorizationException) { + $e = new AccessDeniedHttpException($e->getMessage(), $e); + } elseif ($e instanceof TokenMismatchException) { + $e = new HttpException(419, $e->getMessage(), $e); + } + + return $e; + } + + /** + * Convert an authentication exception into a response. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Auth\AuthenticationException $exception + * @return \Illuminate\Http\Response + */ + protected function unauthenticated($request, AuthenticationException $exception) + { + return $request->expectsJson() + ? response()->json(['message' => $exception->getMessage()], 401) + : redirect()->guest($exception->redirectTo() ?? route('login')); + } + + /** + * Create a response object from the given validation exception. + * + * @param \Illuminate\Validation\ValidationException $e + * @param \Illuminate\Http\Request $request + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function convertValidationExceptionToResponse(ValidationException $e, $request) + { + if ($e->response) { + return $e->response; + } + + return $request->expectsJson() + ? $this->invalidJson($request, $e) + : $this->invalid($request, $e); + } + + /** + * Convert a validation exception into a response. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Validation\ValidationException $exception + * @return \Illuminate\Http\Response + */ + protected function invalid($request, ValidationException $exception) + { + return redirect($exception->redirectTo ?? url()->previous()) + ->withInput($request->except($this->dontFlash)) + ->withErrors($exception->errors(), $exception->errorBag); + } + + /** + * Convert a validation exception into a JSON response. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Validation\ValidationException $exception + * @return \Illuminate\Http\JsonResponse + */ + protected function invalidJson($request, ValidationException $exception) + { + return response()->json([ + 'message' => $exception->getMessage(), + 'errors' => $exception->errors(), + ], $exception->status); + } + + /** + * Prepare a response for the given exception. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $e + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function prepareResponse($request, Exception $e) + { + if (! $this->isHttpException($e) && config('app.debug')) { + return $this->toIlluminateResponse($this->convertExceptionToResponse($e), $e); + } + + if (! $this->isHttpException($e)) { + $e = new HttpException(500, $e->getMessage()); + } + + return $this->toIlluminateResponse( + $this->renderHttpException($e), $e + ); + } + + /** + * Create a Symfony response for the given exception. + * + * @param \Exception $e + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function convertExceptionToResponse(Exception $e) + { + return SymfonyResponse::create( + $this->renderExceptionContent($e), + $this->isHttpException($e) ? $e->getStatusCode() : 500, + $this->isHttpException($e) ? $e->getHeaders() : [] + ); + } + + /** + * Get the response content for the given exception. + * + * @param \Exception $e + * @return string + */ + protected function renderExceptionContent(Exception $e) + { + try { + return config('app.debug') && class_exists(Whoops::class) + ? $this->renderExceptionWithWhoops($e) + : $this->renderExceptionWithSymfony($e, config('app.debug')); + } catch (Exception $e) { + return $this->renderExceptionWithSymfony($e, config('app.debug')); + } + } + + /** + * Render an exception to a string using "Whoops". + * + * @param \Exception $e + * @return string + */ + protected function renderExceptionWithWhoops(Exception $e) + { + return tap(new Whoops, function ($whoops) { + $whoops->pushHandler($this->whoopsHandler()); + + $whoops->writeToOutput(false); + + $whoops->allowQuit(false); + })->handleException($e); + } + + /** + * Get the Whoops handler for the application. + * + * @return \Whoops\Handler\Handler + */ + protected function whoopsHandler() + { + return (new WhoopsHandler)->forDebug(); + } + + /** + * Render an exception to a string using Symfony. + * + * @param \Exception $e + * @param bool $debug + * @return string + */ + protected function renderExceptionWithSymfony(Exception $e, $debug) + { + return (new SymfonyExceptionHandler($debug))->getHtml( + FlattenException::create($e) + ); + } + + /** + * Render the given HttpException. + * + * @param \Symfony\Component\HttpKernel\Exception\HttpException $e + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function renderHttpException(HttpException $e) + { + $this->registerErrorViewPaths(); + + if (view()->exists($view = "errors::{$e->getStatusCode()}")) { + return response()->view($view, [ + 'errors' => new ViewErrorBag, + 'exception' => $e, + ], $e->getStatusCode(), $e->getHeaders()); + } + + return $this->convertExceptionToResponse($e); + } + + /** + * Register the error template hint paths. + * + * @return void + */ + protected function registerErrorViewPaths() + { + $paths = collect(config('view.paths')); + + View::replaceNamespace('errors', $paths->map(function ($path) { + return "{$path}/errors"; + })->push(__DIR__.'/views')->all()); + } + + /** + * Map the given exception into an Illuminate response. + * + * @param \Symfony\Component\HttpFoundation\Response $response + * @param \Exception $e + * @return \Illuminate\Http\Response + */ + protected function toIlluminateResponse($response, Exception $e) + { + if ($response instanceof SymfonyRedirectResponse) { + $response = new RedirectResponse( + $response->getTargetUrl(), $response->getStatusCode(), $response->headers->all() + ); + } else { + $response = new Response( + $response->getContent(), $response->getStatusCode(), $response->headers->all() + ); + } + + return $response->withException($e); + } + + /** + * Prepare a JSON response for the given exception. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $e + * @return \Illuminate\Http\JsonResponse + */ + protected function prepareJsonResponse($request, Exception $e) + { + return new JsonResponse( + $this->convertExceptionToArray($e), + $this->isHttpException($e) ? $e->getStatusCode() : 500, + $this->isHttpException($e) ? $e->getHeaders() : [], + JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES + ); + } + + /** + * Convert the given exception to an array. + * + * @param \Exception $e + * @return array + */ + protected function convertExceptionToArray(Exception $e) + { + return config('app.debug') ? [ + 'message' => $e->getMessage(), + 'exception' => get_class($e), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'trace' => collect($e->getTrace())->map(function ($trace) { + return Arr::except($trace, ['args']); + })->all(), + ] : [ + 'message' => $this->isHttpException($e) ? $e->getMessage() : 'Server Error', + ]; + } + + /** + * Render an exception to the console. + * + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @param \Exception $e + * @return void + */ + public function renderForConsole($output, Exception $e) + { + (new ConsoleApplication)->renderException($e, $output); + } + + /** + * Determine if the given exception is an HTTP exception. + * + * @param \Exception $e + * @return bool + */ + protected function isHttpException(Exception $e) + { + return $e instanceof HttpExceptionInterface; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/WhoopsHandler.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/WhoopsHandler.php new file mode 100644 index 0000000..b94a7ac --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/WhoopsHandler.php @@ -0,0 +1,86 @@ +handleUnconditionally(true); + + $this->registerApplicationPaths($handler) + ->registerBlacklist($handler) + ->registerEditor($handler); + }); + } + + /** + * Register the application paths with the handler. + * + * @param \Whoops\Handler\PrettyPageHandler $handler + * @return $this + */ + protected function registerApplicationPaths($handler) + { + $handler->setApplicationPaths( + array_flip($this->directoriesExceptVendor()) + ); + + return $this; + } + + /** + * Get the application paths except for the "vendor" directory. + * + * @return array + */ + protected function directoriesExceptVendor() + { + return Arr::except( + array_flip((new Filesystem)->directories(base_path())), + [base_path('vendor')] + ); + } + + /** + * Register the blacklist with the handler. + * + * @param \Whoops\Handler\PrettyPageHandler $handler + * @return $this + */ + protected function registerBlacklist($handler) + { + foreach (config('app.debug_blacklist', []) as $key => $secrets) { + foreach ($secrets as $secret) { + $handler->blacklist($key, $secret); + } + } + + return $this; + } + + /** + * Register the editor with the handler. + * + * @param \Whoops\Handler\PrettyPageHandler $handler + * @return $this + */ + protected function registerEditor($handler) + { + if (config('app.editor', false)) { + $handler->setEditor(config('app.editor')); + } + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/401.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/401.blade.php new file mode 100644 index 0000000..10f05b8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/401.blade.php @@ -0,0 +1,11 @@ +@extends('errors::illustrated-layout') + +@section('code', '401') +@section('title', __('Unauthorized')) + +@section('image') +
+
+@endsection + +@section('message', __('Sorry, you are not authorized to access this page.')) diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/403.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/403.blade.php new file mode 100644 index 0000000..bbb79a4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/403.blade.php @@ -0,0 +1,11 @@ +@extends('errors::illustrated-layout') + +@section('code', '403') +@section('title', __('Forbidden')) + +@section('image') +
+
+@endsection + +@section('message', __($exception->getMessage() ?: __('Sorry, you are forbidden from accessing this page.'))) diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/404.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/404.blade.php new file mode 100644 index 0000000..d2bae51 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/404.blade.php @@ -0,0 +1,11 @@ +@extends('errors::illustrated-layout') + +@section('code', '404') +@section('title', __('Page Not Found')) + +@section('image') +
+
+@endsection + +@section('message', __('Sorry, the page you are looking for could not be found.')) diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/419.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/419.blade.php new file mode 100644 index 0000000..1b00819 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/419.blade.php @@ -0,0 +1,11 @@ +@extends('errors::illustrated-layout') + +@section('code', '419') +@section('title', __('Page Expired')) + +@section('image') +
+
+@endsection + +@section('message', __('Sorry, your session has expired. Please refresh and try again.')) diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/429.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/429.blade.php new file mode 100644 index 0000000..2747654 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/429.blade.php @@ -0,0 +1,11 @@ +@extends('errors::illustrated-layout') + +@section('code', '429') +@section('title', __('Too Many Requests')) + +@section('image') +
+
+@endsection + +@section('message', __('Sorry, you are making too many requests to our servers.')) diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/500.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/500.blade.php new file mode 100644 index 0000000..8868cf8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/500.blade.php @@ -0,0 +1,11 @@ +@extends('errors::illustrated-layout') + +@section('code', '500') +@section('title', __('Error')) + +@section('image') +
+
+@endsection + +@section('message', __('Whoops, something went wrong on our servers.')) diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/503.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/503.blade.php new file mode 100644 index 0000000..476ff52 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/503.blade.php @@ -0,0 +1,11 @@ +@extends('errors::illustrated-layout') + +@section('code', '503') +@section('title', __('Service Unavailable')) + +@section('image') +
+
+@endsection + +@section('message', __($exception->getMessage() ?: __('Sorry, we are doing some maintenance. Please check back soon.'))) diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/illustrated-layout.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/illustrated-layout.blade.php new file mode 100644 index 0000000..3730d05 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/illustrated-layout.blade.php @@ -0,0 +1,486 @@ + + + + @yield('title') + + + + + + + + + + + + +
+
+
+
+ @yield('code', __('Oh no')) +
+ +
+ +

+ @yield('message') +

+ + + + +
+
+ +
+ @yield('image') +
+
+ + diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/layout.blade.php b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/layout.blade.php new file mode 100644 index 0000000..2c51d4f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/views/layout.blade.php @@ -0,0 +1,57 @@ + + + + + + + @yield('title') + + + + + + + + + +
+
+
+ @yield('message') +
+
+
+ + diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Events/RequestHandled.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Events/RequestHandled.php new file mode 100644 index 0000000..d6f71e0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Events/RequestHandled.php @@ -0,0 +1,33 @@ +request = $request; + $this->response = $response; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Exceptions/MaintenanceModeException.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Exceptions/MaintenanceModeException.php new file mode 100644 index 0000000..6d5a2ab --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Exceptions/MaintenanceModeException.php @@ -0,0 +1,54 @@ +wentDownAt = Carbon::createFromTimestamp($time); + + if ($retryAfter) { + $this->retryAfter = $retryAfter; + + $this->willBeAvailableAt = Carbon::createFromTimestamp($time)->addSeconds($this->retryAfter); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php new file mode 100644 index 0000000..b5fcaab --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php @@ -0,0 +1,245 @@ +container->make(ValidationFactory::class); + + if (method_exists($this, 'validator')) { + $validator = $this->container->call([$this, 'validator'], compact('factory')); + } else { + $validator = $this->createDefaultValidator($factory); + } + + if (method_exists($this, 'withValidator')) { + $this->withValidator($validator); + } + + $this->setValidator($validator); + + return $this->validator; + } + + /** + * Create the default validator instance. + * + * @param \Illuminate\Contracts\Validation\Factory $factory + * @return \Illuminate\Contracts\Validation\Validator + */ + protected function createDefaultValidator(ValidationFactory $factory) + { + return $factory->make( + $this->validationData(), $this->container->call([$this, 'rules']), + $this->messages(), $this->attributes() + ); + } + + /** + * Get data to be validated from the request. + * + * @return array + */ + protected function validationData() + { + return $this->all(); + } + + /** + * Handle a failed validation attempt. + * + * @param \Illuminate\Contracts\Validation\Validator $validator + * @return void + * + * @throws \Illuminate\Validation\ValidationException + */ + protected function failedValidation(Validator $validator) + { + throw (new ValidationException($validator)) + ->errorBag($this->errorBag) + ->redirectTo($this->getRedirectUrl()); + } + + /** + * Get the URL to redirect to on a validation error. + * + * @return string + */ + protected function getRedirectUrl() + { + $url = $this->redirector->getUrlGenerator(); + + if ($this->redirect) { + return $url->to($this->redirect); + } elseif ($this->redirectRoute) { + return $url->route($this->redirectRoute); + } elseif ($this->redirectAction) { + return $url->action($this->redirectAction); + } + + return $url->previous(); + } + + /** + * Determine if the request passes the authorization check. + * + * @return bool + */ + protected function passesAuthorization() + { + if (method_exists($this, 'authorize')) { + return $this->container->call([$this, 'authorize']); + } + + return true; + } + + /** + * Handle a failed authorization attempt. + * + * @return void + * + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + protected function failedAuthorization() + { + throw new AuthorizationException('This action is unauthorized.'); + } + + /** + * Get the validated data from the request. + * + * @return array + */ + public function validated() + { + return $this->validator->validated(); + } + + /** + * Get custom messages for validator errors. + * + * @return array + */ + public function messages() + { + return []; + } + + /** + * Get custom attributes for validator errors. + * + * @return array + */ + public function attributes() + { + return []; + } + + /** + * Set the Validator instance. + * + * @param \Illuminate\Contracts\Validation\Validator $validator + * @return $this + */ + public function setValidator(Validator $validator) + { + $this->validator = $validator; + + return $this; + } + + /** + * Set the Redirector instance. + * + * @param \Illuminate\Routing\Redirector $redirector + * @return $this + */ + public function setRedirector(Redirector $redirector) + { + $this->redirector = $redirector; + + return $this; + } + + /** + * Set the container implementation. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return $this + */ + public function setContainer(Container $container) + { + $this->container = $container; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php new file mode 100644 index 0000000..a44214a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php @@ -0,0 +1,348 @@ +app = $app; + $this->router = $router; + + $router->middlewarePriority = $this->middlewarePriority; + + foreach ($this->middlewareGroups as $key => $middleware) { + $router->middlewareGroup($key, $middleware); + } + + foreach ($this->routeMiddleware as $key => $middleware) { + $router->aliasMiddleware($key, $middleware); + } + } + + /** + * Handle an incoming HTTP request. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function handle($request) + { + try { + $request->enableHttpMethodParameterOverride(); + + $response = $this->sendRequestThroughRouter($request); + } catch (Exception $e) { + $this->reportException($e); + + $response = $this->renderException($request, $e); + } catch (Throwable $e) { + $this->reportException($e = new FatalThrowableError($e)); + + $response = $this->renderException($request, $e); + } + + $this->app['events']->dispatch( + new Events\RequestHandled($request, $response) + ); + + return $response; + } + + /** + * Send the given request through the middleware / router. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + protected function sendRequestThroughRouter($request) + { + $this->app->instance('request', $request); + + Facade::clearResolvedInstance('request'); + + $this->bootstrap(); + + return (new Pipeline($this->app)) + ->send($request) + ->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware) + ->then($this->dispatchToRouter()); + } + + /** + * Bootstrap the application for HTTP requests. + * + * @return void + */ + public function bootstrap() + { + if (! $this->app->hasBeenBootstrapped()) { + $this->app->bootstrapWith($this->bootstrappers()); + } + } + + /** + * Get the route dispatcher callback. + * + * @return \Closure + */ + protected function dispatchToRouter() + { + return function ($request) { + $this->app->instance('request', $request); + + return $this->router->dispatch($request); + }; + } + + /** + * Call the terminate method on any terminable middleware. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Response $response + * @return void + */ + public function terminate($request, $response) + { + $this->terminateMiddleware($request, $response); + + $this->app->terminate(); + } + + /** + * Call the terminate method on any terminable middleware. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Response $response + * @return void + */ + protected function terminateMiddleware($request, $response) + { + $middlewares = $this->app->shouldSkipMiddleware() ? [] : array_merge( + $this->gatherRouteMiddleware($request), + $this->middleware + ); + + foreach ($middlewares as $middleware) { + if (! is_string($middleware)) { + continue; + } + + [$name] = $this->parseMiddleware($middleware); + + $instance = $this->app->make($name); + + if (method_exists($instance, 'terminate')) { + $instance->terminate($request, $response); + } + } + } + + /** + * Gather the route middleware for the given request. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function gatherRouteMiddleware($request) + { + if ($route = $request->route()) { + return $this->router->gatherRouteMiddleware($route); + } + + return []; + } + + /** + * Parse a middleware string to get the name and parameters. + * + * @param string $middleware + * @return array + */ + protected function parseMiddleware($middleware) + { + [$name, $parameters] = array_pad(explode(':', $middleware, 2), 2, []); + + if (is_string($parameters)) { + $parameters = explode(',', $parameters); + } + + return [$name, $parameters]; + } + + /** + * Determine if the kernel has a given middleware. + * + * @param string $middleware + * @return bool + */ + public function hasMiddleware($middleware) + { + return in_array($middleware, $this->middleware); + } + + /** + * Add a new middleware to beginning of the stack if it does not already exist. + * + * @param string $middleware + * @return $this + */ + public function prependMiddleware($middleware) + { + if (array_search($middleware, $this->middleware) === false) { + array_unshift($this->middleware, $middleware); + } + + return $this; + } + + /** + * Add a new middleware to end of the stack if it does not already exist. + * + * @param string $middleware + * @return $this + */ + public function pushMiddleware($middleware) + { + if (array_search($middleware, $this->middleware) === false) { + $this->middleware[] = $middleware; + } + + return $this; + } + + /** + * Get the bootstrap classes for the application. + * + * @return array + */ + protected function bootstrappers() + { + return $this->bootstrappers; + } + + /** + * Report the exception to the exception handler. + * + * @param \Exception $e + * @return void + */ + protected function reportException(Exception $e) + { + $this->app[ExceptionHandler::class]->report($e); + } + + /** + * Render the exception to a response. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $e + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function renderException($request, Exception $e) + { + return $this->app[ExceptionHandler::class]->render($request, $e); + } + + /** + * Get the application's route middleware groups. + * + * @return array + */ + public function getMiddlewareGroups() + { + return $this->middlewareGroups; + } + + /** + * Get the Laravel application instance. + * + * @return \Illuminate\Contracts\Foundation\Application + */ + public function getApplication() + { + return $this->app; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php new file mode 100644 index 0000000..037e5a4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php @@ -0,0 +1,85 @@ +app = $app; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + */ + public function handle($request, Closure $next) + { + if ($this->app->isDownForMaintenance()) { + $data = json_decode(file_get_contents($this->app->storagePath().'/framework/down'), true); + + if (isset($data['allowed']) && IpUtils::checkIp($request->ip(), (array) $data['allowed'])) { + return $next($request); + } + + if ($this->inExceptArray($request)) { + return $next($request); + } + + throw new MaintenanceModeException($data['time'], $data['retry'], $data['message']); + } + + return $next($request); + } + + /** + * Determine if the request has a URI that should be accessible in maintenance mode. + * + * @param \Illuminate\Http\Request $request + * @return bool + */ + protected function inExceptArray($request) + { + foreach ($this->except as $except) { + if ($except !== '/') { + $except = trim($except, '/'); + } + + if ($request->fullUrlIs($except) || $request->is($except)) { + return true; + } + } + + return false; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php new file mode 100644 index 0000000..813c9cf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php @@ -0,0 +1,18 @@ +attributes = $attributes; + + $this->clean($request); + + return $next($request); + } + + /** + * Clean the request's data. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function clean($request) + { + $this->cleanParameterBag($request->query); + + if ($request->isJson()) { + $this->cleanParameterBag($request->json()); + } elseif ($request->request !== $request->query) { + $this->cleanParameterBag($request->request); + } + } + + /** + * Clean the data in the parameter bag. + * + * @param \Symfony\Component\HttpFoundation\ParameterBag $bag + * @return void + */ + protected function cleanParameterBag(ParameterBag $bag) + { + $bag->replace($this->cleanArray($bag->all())); + } + + /** + * Clean the data in the given array. + * + * @param array $data + * @return array + */ + protected function cleanArray(array $data) + { + return collect($data)->map(function ($value, $key) { + return $this->cleanValue($key, $value); + })->all(); + } + + /** + * Clean the given value. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function cleanValue($key, $value) + { + if (is_array($value)) { + return $this->cleanArray($value); + } + + return $this->transform($key, $value); + } + + /** + * Transform the given value. + * + * @param string $key + * @param mixed $value + * @return mixed + */ + protected function transform($key, $value) + { + return $value; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php new file mode 100644 index 0000000..4c8d1dd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php @@ -0,0 +1,31 @@ +except, true)) { + return $value; + } + + return is_string($value) ? trim($value) : $value; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php new file mode 100644 index 0000000..adc5f5a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php @@ -0,0 +1,55 @@ +getPostMaxSize(); + + if ($max > 0 && $request->server('CONTENT_LENGTH') > $max) { + throw new PostTooLargeException; + } + + return $next($request); + } + + /** + * Determine the server 'post_max_size' as bytes. + * + * @return int + */ + protected function getPostMaxSize() + { + if (is_numeric($postMaxSize = ini_get('post_max_size'))) { + return (int) $postMaxSize; + } + + $metric = strtoupper(substr($postMaxSize, -1)); + $postMaxSize = (int) $postMaxSize; + + switch ($metric) { + case 'K': + return $postMaxSize * 1024; + case 'M': + return $postMaxSize * 1048576; + case 'G': + return $postMaxSize * 1073741824; + default: + return $postMaxSize; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php new file mode 100644 index 0000000..2c21bcf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php @@ -0,0 +1,199 @@ +app = $app; + $this->encrypter = $encrypter; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + * + * @throws \Illuminate\Session\TokenMismatchException + */ + public function handle($request, Closure $next) + { + if ( + $this->isReading($request) || + $this->runningUnitTests() || + $this->inExceptArray($request) || + $this->tokensMatch($request) + ) { + return tap($next($request), function ($response) use ($request) { + if ($this->shouldAddXsrfTokenCookie()) { + $this->addCookieToResponse($request, $response); + } + }); + } + + throw new TokenMismatchException; + } + + /** + * Determine if the HTTP request uses a ‘read’ verb. + * + * @param \Illuminate\Http\Request $request + * @return bool + */ + protected function isReading($request) + { + return in_array($request->method(), ['HEAD', 'GET', 'OPTIONS']); + } + + /** + * Determine if the application is running unit tests. + * + * @return bool + */ + protected function runningUnitTests() + { + return $this->app->runningInConsole() && $this->app->runningUnitTests(); + } + + /** + * Determine if the request has a URI that should pass through CSRF verification. + * + * @param \Illuminate\Http\Request $request + * @return bool + */ + protected function inExceptArray($request) + { + foreach ($this->except as $except) { + if ($except !== '/') { + $except = trim($except, '/'); + } + + if ($request->fullUrlIs($except) || $request->is($except)) { + return true; + } + } + + return false; + } + + /** + * Determine if the session and input CSRF tokens match. + * + * @param \Illuminate\Http\Request $request + * @return bool + */ + protected function tokensMatch($request) + { + $token = $this->getTokenFromRequest($request); + + return is_string($request->session()->token()) && + is_string($token) && + hash_equals($request->session()->token(), $token); + } + + /** + * Get the CSRF token from the request. + * + * @param \Illuminate\Http\Request $request + * @return string + */ + protected function getTokenFromRequest($request) + { + $token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN'); + + if (! $token && $header = $request->header('X-XSRF-TOKEN')) { + $token = $this->encrypter->decrypt($header, static::serialized()); + } + + return $token; + } + + /** + * Determine if the cookie should be added to the response. + * + * @return bool + */ + public function shouldAddXsrfTokenCookie() + { + return $this->addHttpCookie; + } + + /** + * Add the CSRF token to the response cookies. + * + * @param \Illuminate\Http\Request $request + * @param \Symfony\Component\HttpFoundation\Response $response + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function addCookieToResponse($request, $response) + { + $config = config('session'); + + $response->headers->setCookie( + new Cookie( + 'XSRF-TOKEN', $request->session()->token(), $this->availableAt(60 * $config['lifetime']), + $config['path'], $config['domain'], $config['secure'], false, false, $config['same_site'] ?? null + ) + ); + + return $response; + } + + /** + * Determine if the cookie contents should be serialized. + * + * @return bool + */ + public static function serialized() + { + return EncryptCookies::serialized('XSRF-TOKEN'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Inspiring.php b/vendor/laravel/framework/src/Illuminate/Foundation/Inspiring.php new file mode 100644 index 0000000..61258cb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Inspiring.php @@ -0,0 +1,38 @@ +random(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php b/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php new file mode 100644 index 0000000..a091372 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php @@ -0,0 +1,175 @@ +files = $files; + $this->basePath = $basePath; + $this->manifestPath = $manifestPath; + $this->vendorPath = $basePath.'/vendor'; + } + + /** + * Get all of the service provider class names for all packages. + * + * @return array + */ + public function providers() + { + return collect($this->getManifest())->flatMap(function ($configuration) { + return (array) ($configuration['providers'] ?? []); + })->filter()->all(); + } + + /** + * Get all of the aliases for all packages. + * + * @return array + */ + public function aliases() + { + return collect($this->getManifest())->flatMap(function ($configuration) { + return (array) ($configuration['aliases'] ?? []); + })->filter()->all(); + } + + /** + * Get the current package manifest. + * + * @return array + */ + protected function getManifest() + { + if (! is_null($this->manifest)) { + return $this->manifest; + } + + if (! file_exists($this->manifestPath)) { + $this->build(); + } + + $this->files->get($this->manifestPath); + + return $this->manifest = file_exists($this->manifestPath) ? + $this->files->getRequire($this->manifestPath) : []; + } + + /** + * Build the manifest and write it to disk. + * + * @return void + */ + public function build() + { + $packages = []; + + if ($this->files->exists($path = $this->vendorPath.'/composer/installed.json')) { + $packages = json_decode($this->files->get($path), true); + } + + $ignoreAll = in_array('*', $ignore = $this->packagesToIgnore()); + + $this->write(collect($packages)->mapWithKeys(function ($package) { + return [$this->format($package['name']) => $package['extra']['laravel'] ?? []]; + })->each(function ($configuration) use (&$ignore) { + $ignore = array_merge($ignore, $configuration['dont-discover'] ?? []); + })->reject(function ($configuration, $package) use ($ignore, $ignoreAll) { + return $ignoreAll || in_array($package, $ignore); + })->filter()->all()); + } + + /** + * Format the given package name. + * + * @param string $package + * @return string + */ + protected function format($package) + { + return str_replace($this->vendorPath.'/', '', $package); + } + + /** + * Get all of the package names that should be ignored. + * + * @return array + */ + protected function packagesToIgnore() + { + if (! file_exists($this->basePath.'/composer.json')) { + return []; + } + + return json_decode(file_get_contents( + $this->basePath.'/composer.json' + ), true)['extra']['laravel']['dont-discover'] ?? []; + } + + /** + * Write the given manifest array to disk. + * + * @param array $manifest + * @return void + * + * @throws \Exception + */ + protected function write(array $manifest) + { + if (! is_writable(dirname($this->manifestPath))) { + throw new Exception('The '.dirname($this->manifestPath).' directory must be present and writable.'); + } + + $this->files->replace( + $this->manifestPath, 'app = $app; + $this->files = $files; + $this->manifestPath = $manifestPath; + } + + /** + * Register the application service providers. + * + * @param array $providers + * @return void + */ + public function load(array $providers) + { + $manifest = $this->loadManifest(); + + // First we will load the service manifest, which contains information on all + // service providers registered with the application and which services it + // provides. This is used to know which services are "deferred" loaders. + if ($this->shouldRecompile($manifest, $providers)) { + $manifest = $this->compileManifest($providers); + } + + // Next, we will register events to load the providers for each of the events + // that it has requested. This allows the service provider to defer itself + // while still getting automatically loaded when a certain event occurs. + foreach ($manifest['when'] as $provider => $events) { + $this->registerLoadEvents($provider, $events); + } + + // We will go ahead and register all of the eagerly loaded providers with the + // application so their services can be registered with the application as + // a provided service. Then we will set the deferred service list on it. + foreach ($manifest['eager'] as $provider) { + $this->app->register($provider); + } + + $this->app->addDeferredServices($manifest['deferred']); + } + + /** + * Load the service provider manifest JSON file. + * + * @return array|null + */ + public function loadManifest() + { + // The service manifest is a file containing a JSON representation of every + // service provided by the application and whether its provider is using + // deferred loading or should be eagerly loaded on each request to us. + if ($this->files->exists($this->manifestPath)) { + $manifest = $this->files->getRequire($this->manifestPath); + + if ($manifest) { + return array_merge(['when' => []], $manifest); + } + } + } + + /** + * Determine if the manifest should be compiled. + * + * @param array $manifest + * @param array $providers + * @return bool + */ + public function shouldRecompile($manifest, $providers) + { + return is_null($manifest) || $manifest['providers'] != $providers; + } + + /** + * Register the load events for the given provider. + * + * @param string $provider + * @param array $events + * @return void + */ + protected function registerLoadEvents($provider, array $events) + { + if (count($events) < 1) { + return; + } + + $this->app->make('events')->listen($events, function () use ($provider) { + $this->app->register($provider); + }); + } + + /** + * Compile the application service manifest file. + * + * @param array $providers + * @return array + */ + protected function compileManifest($providers) + { + // The service manifest should contain a list of all of the providers for + // the application so we can compare it on each request to the service + // and determine if the manifest should be recompiled or is current. + $manifest = $this->freshManifest($providers); + + foreach ($providers as $provider) { + $instance = $this->createProvider($provider); + + // When recompiling the service manifest, we will spin through each of the + // providers and check if it's a deferred provider or not. If so we'll + // add it's provided services to the manifest and note the provider. + if ($instance->isDeferred()) { + foreach ($instance->provides() as $service) { + $manifest['deferred'][$service] = $provider; + } + + $manifest['when'][$provider] = $instance->when(); + } + + // If the service providers are not deferred, we will simply add it to an + // array of eagerly loaded providers that will get registered on every + // request to this application instead of "lazy" loading every time. + else { + $manifest['eager'][] = $provider; + } + } + + return $this->writeManifest($manifest); + } + + /** + * Create a fresh service manifest data structure. + * + * @param array $providers + * @return array + */ + protected function freshManifest(array $providers) + { + return ['providers' => $providers, 'eager' => [], 'deferred' => []]; + } + + /** + * Write the service manifest file to disk. + * + * @param array $manifest + * @return array + * + * @throws \Exception + */ + public function writeManifest($manifest) + { + if (! is_writable(dirname($this->manifestPath))) { + throw new Exception('The bootstrap/cache directory must be present and writable.'); + } + + $this->files->put( + $this->manifestPath, ' []], $manifest); + } + + /** + * Create a new provider instance. + * + * @param string $provider + * @return \Illuminate\Support\ServiceProvider + */ + public function createProvider($provider) + { + return new $provider($this->app); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php new file mode 100755 index 0000000..aabdfd5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php @@ -0,0 +1,1023 @@ + 'command.cache.clear', + 'CacheForget' => 'command.cache.forget', + 'ClearCompiled' => 'command.clear-compiled', + 'ClearResets' => 'command.auth.resets.clear', + 'ConfigCache' => 'command.config.cache', + 'ConfigClear' => 'command.config.clear', + 'Down' => 'command.down', + 'Environment' => 'command.environment', + 'KeyGenerate' => 'command.key.generate', + 'Migrate' => 'command.migrate', + 'MigrateFresh' => 'command.migrate.fresh', + 'MigrateInstall' => 'command.migrate.install', + 'MigrateRefresh' => 'command.migrate.refresh', + 'MigrateReset' => 'command.migrate.reset', + 'MigrateRollback' => 'command.migrate.rollback', + 'MigrateStatus' => 'command.migrate.status', + 'Optimize' => 'command.optimize', + 'OptimizeClear' => 'command.optimize.clear', + 'PackageDiscover' => 'command.package.discover', + 'Preset' => 'command.preset', + 'QueueFailed' => 'command.queue.failed', + 'QueueFlush' => 'command.queue.flush', + 'QueueForget' => 'command.queue.forget', + 'QueueListen' => 'command.queue.listen', + 'QueueRestart' => 'command.queue.restart', + 'QueueRetry' => 'command.queue.retry', + 'QueueWork' => 'command.queue.work', + 'RouteCache' => 'command.route.cache', + 'RouteClear' => 'command.route.clear', + 'RouteList' => 'command.route.list', + 'Seed' => 'command.seed', + 'ScheduleFinish' => ScheduleFinishCommand::class, + 'ScheduleRun' => ScheduleRunCommand::class, + 'StorageLink' => 'command.storage.link', + 'Up' => 'command.up', + 'ViewCache' => 'command.view.cache', + 'ViewClear' => 'command.view.clear', + ]; + + /** + * The commands to be registered. + * + * @var array + */ + protected $devCommands = [ + 'AppName' => 'command.app.name', + 'AuthMake' => 'command.auth.make', + 'CacheTable' => 'command.cache.table', + 'ChannelMake' => 'command.channel.make', + 'ConsoleMake' => 'command.console.make', + 'ControllerMake' => 'command.controller.make', + 'EventGenerate' => 'command.event.generate', + 'EventMake' => 'command.event.make', + 'ExceptionMake' => 'command.exception.make', + 'FactoryMake' => 'command.factory.make', + 'JobMake' => 'command.job.make', + 'ListenerMake' => 'command.listener.make', + 'MailMake' => 'command.mail.make', + 'MiddlewareMake' => 'command.middleware.make', + 'MigrateMake' => 'command.migrate.make', + 'ModelMake' => 'command.model.make', + 'NotificationMake' => 'command.notification.make', + 'NotificationTable' => 'command.notification.table', + 'ObserverMake' => 'command.observer.make', + 'PolicyMake' => 'command.policy.make', + 'ProviderMake' => 'command.provider.make', + 'QueueFailedTable' => 'command.queue.failed-table', + 'QueueTable' => 'command.queue.table', + 'RequestMake' => 'command.request.make', + 'ResourceMake' => 'command.resource.make', + 'RuleMake' => 'command.rule.make', + 'SeederMake' => 'command.seeder.make', + 'SessionTable' => 'command.session.table', + 'Serve' => 'command.serve', + 'TestMake' => 'command.test.make', + 'VendorPublish' => 'command.vendor.publish', + ]; + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerCommands(array_merge( + $this->commands, $this->devCommands + )); + } + + /** + * Register the given commands. + * + * @param array $commands + * @return void + */ + protected function registerCommands(array $commands) + { + foreach (array_keys($commands) as $command) { + call_user_func_array([$this, "register{$command}Command"], []); + } + + $this->commands(array_values($commands)); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerAppNameCommand() + { + $this->app->singleton('command.app.name', function ($app) { + return new AppNameCommand($app['composer'], $app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerAuthMakeCommand() + { + $this->app->singleton('command.auth.make', function () { + return new AuthMakeCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerCacheClearCommand() + { + $this->app->singleton('command.cache.clear', function ($app) { + return new CacheClearCommand($app['cache'], $app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerCacheForgetCommand() + { + $this->app->singleton('command.cache.forget', function ($app) { + return new CacheForgetCommand($app['cache']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerCacheTableCommand() + { + $this->app->singleton('command.cache.table', function ($app) { + return new CacheTableCommand($app['files'], $app['composer']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerChannelMakeCommand() + { + $this->app->singleton('command.channel.make', function ($app) { + return new ChannelMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerClearCompiledCommand() + { + $this->app->singleton('command.clear-compiled', function () { + return new ClearCompiledCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerClearResetsCommand() + { + $this->app->singleton('command.auth.resets.clear', function () { + return new ClearResetsCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerConfigCacheCommand() + { + $this->app->singleton('command.config.cache', function ($app) { + return new ConfigCacheCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerConfigClearCommand() + { + $this->app->singleton('command.config.clear', function ($app) { + return new ConfigClearCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerConsoleMakeCommand() + { + $this->app->singleton('command.console.make', function ($app) { + return new ConsoleMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerControllerMakeCommand() + { + $this->app->singleton('command.controller.make', function ($app) { + return new ControllerMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerEventGenerateCommand() + { + $this->app->singleton('command.event.generate', function () { + return new EventGenerateCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerEventMakeCommand() + { + $this->app->singleton('command.event.make', function ($app) { + return new EventMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerExceptionMakeCommand() + { + $this->app->singleton('command.exception.make', function ($app) { + return new ExceptionMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerFactoryMakeCommand() + { + $this->app->singleton('command.factory.make', function ($app) { + return new FactoryMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerDownCommand() + { + $this->app->singleton('command.down', function () { + return new DownCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerEnvironmentCommand() + { + $this->app->singleton('command.environment', function () { + return new EnvironmentCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerJobMakeCommand() + { + $this->app->singleton('command.job.make', function ($app) { + return new JobMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerKeyGenerateCommand() + { + $this->app->singleton('command.key.generate', function () { + return new KeyGenerateCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerListenerMakeCommand() + { + $this->app->singleton('command.listener.make', function ($app) { + return new ListenerMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMailMakeCommand() + { + $this->app->singleton('command.mail.make', function ($app) { + return new MailMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMiddlewareMakeCommand() + { + $this->app->singleton('command.middleware.make', function ($app) { + return new MiddlewareMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateCommand() + { + $this->app->singleton('command.migrate', function ($app) { + return new MigrateCommand($app['migrator']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateFreshCommand() + { + $this->app->singleton('command.migrate.fresh', function () { + return new MigrateFreshCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateInstallCommand() + { + $this->app->singleton('command.migrate.install', function ($app) { + return new MigrateInstallCommand($app['migration.repository']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateMakeCommand() + { + $this->app->singleton('command.migrate.make', function ($app) { + // Once we have the migration creator registered, we will create the command + // and inject the creator. The creator is responsible for the actual file + // creation of the migrations, and may be extended by these developers. + $creator = $app['migration.creator']; + + $composer = $app['composer']; + + return new MigrateMakeCommand($creator, $composer); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateRefreshCommand() + { + $this->app->singleton('command.migrate.refresh', function () { + return new MigrateRefreshCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateResetCommand() + { + $this->app->singleton('command.migrate.reset', function ($app) { + return new MigrateResetCommand($app['migrator']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateRollbackCommand() + { + $this->app->singleton('command.migrate.rollback', function ($app) { + return new MigrateRollbackCommand($app['migrator']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerMigrateStatusCommand() + { + $this->app->singleton('command.migrate.status', function ($app) { + return new MigrateStatusCommand($app['migrator']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerModelMakeCommand() + { + $this->app->singleton('command.model.make', function ($app) { + return new ModelMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerNotificationMakeCommand() + { + $this->app->singleton('command.notification.make', function ($app) { + return new NotificationMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerNotificationTableCommand() + { + $this->app->singleton('command.notification.table', function ($app) { + return new NotificationTableCommand($app['files'], $app['composer']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerOptimizeCommand() + { + $this->app->singleton('command.optimize', function () { + return new OptimizeCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerObserverMakeCommand() + { + $this->app->singleton('command.observer.make', function ($app) { + return new ObserverMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerOptimizeClearCommand() + { + $this->app->singleton('command.optimize.clear', function () { + return new OptimizeClearCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerPackageDiscoverCommand() + { + $this->app->singleton('command.package.discover', function () { + return new PackageDiscoverCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerPolicyMakeCommand() + { + $this->app->singleton('command.policy.make', function ($app) { + return new PolicyMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerPresetCommand() + { + $this->app->singleton('command.preset', function () { + return new PresetCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerProviderMakeCommand() + { + $this->app->singleton('command.provider.make', function ($app) { + return new ProviderMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueFailedCommand() + { + $this->app->singleton('command.queue.failed', function () { + return new ListFailedQueueCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueForgetCommand() + { + $this->app->singleton('command.queue.forget', function () { + return new ForgetFailedQueueCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueFlushCommand() + { + $this->app->singleton('command.queue.flush', function () { + return new FlushFailedQueueCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueListenCommand() + { + $this->app->singleton('command.queue.listen', function ($app) { + return new QueueListenCommand($app['queue.listener']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueRestartCommand() + { + $this->app->singleton('command.queue.restart', function () { + return new QueueRestartCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueRetryCommand() + { + $this->app->singleton('command.queue.retry', function () { + return new QueueRetryCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueWorkCommand() + { + $this->app->singleton('command.queue.work', function ($app) { + return new QueueWorkCommand($app['queue.worker']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueFailedTableCommand() + { + $this->app->singleton('command.queue.failed-table', function ($app) { + return new FailedTableCommand($app['files'], $app['composer']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerQueueTableCommand() + { + $this->app->singleton('command.queue.table', function ($app) { + return new TableCommand($app['files'], $app['composer']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerRequestMakeCommand() + { + $this->app->singleton('command.request.make', function ($app) { + return new RequestMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerResourceMakeCommand() + { + $this->app->singleton('command.resource.make', function ($app) { + return new ResourceMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerRuleMakeCommand() + { + $this->app->singleton('command.rule.make', function ($app) { + return new RuleMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerSeederMakeCommand() + { + $this->app->singleton('command.seeder.make', function ($app) { + return new SeederMakeCommand($app['files'], $app['composer']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerSessionTableCommand() + { + $this->app->singleton('command.session.table', function ($app) { + return new SessionTableCommand($app['files'], $app['composer']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerStorageLinkCommand() + { + $this->app->singleton('command.storage.link', function () { + return new StorageLinkCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerRouteCacheCommand() + { + $this->app->singleton('command.route.cache', function ($app) { + return new RouteCacheCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerRouteClearCommand() + { + $this->app->singleton('command.route.clear', function ($app) { + return new RouteClearCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerRouteListCommand() + { + $this->app->singleton('command.route.list', function ($app) { + return new RouteListCommand($app['router']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerSeedCommand() + { + $this->app->singleton('command.seed', function ($app) { + return new SeedCommand($app['db']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerScheduleFinishCommand() + { + $this->app->singleton(ScheduleFinishCommand::class); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerScheduleRunCommand() + { + $this->app->singleton(ScheduleRunCommand::class); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerServeCommand() + { + $this->app->singleton('command.serve', function () { + return new ServeCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerTestMakeCommand() + { + $this->app->singleton('command.test.make', function ($app) { + return new TestMakeCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerUpCommand() + { + $this->app->singleton('command.up', function () { + return new UpCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerVendorPublishCommand() + { + $this->app->singleton('command.vendor.publish', function ($app) { + return new VendorPublishCommand($app['files']); + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerViewCacheCommand() + { + $this->app->singleton('command.view.cache', function () { + return new ViewCacheCommand; + }); + } + + /** + * Register the command. + * + * @return void + */ + protected function registerViewClearCommand() + { + $this->app->singleton('command.view.clear', function ($app) { + return new ViewClearCommand($app['files']); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return array_merge(array_values($this->commands), array_values($this->devCommands)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ComposerServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ComposerServiceProvider.php new file mode 100755 index 0000000..295ca96 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ComposerServiceProvider.php @@ -0,0 +1,38 @@ +app->singleton('composer', function ($app) { + return new Composer($app['files'], $app->basePath()); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['composer']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php new file mode 100644 index 0000000..8e92d28 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php @@ -0,0 +1,27 @@ +app->afterResolving(ValidatesWhenResolved::class, function ($resolved) { + $resolved->validateResolved(); + }); + + $this->app->resolving(FormRequest::class, function ($request, $app) { + $request = FormRequest::createFrom($app['request'], $request); + + $request->setContainer($app)->setRedirector($app->make(Redirector::class)); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php new file mode 100644 index 0000000..fc00885 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php @@ -0,0 +1,68 @@ +app->runningInConsole()) { + $this->publishes([ + __DIR__.'/../Exceptions/views' => $this->app->resourcePath('views/errors/'), + ], 'laravel-errors'); + } + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + parent::register(); + + $this->registerRequestValidation(); + $this->registerRequestSignatureValidation(); + } + + /** + * Register the "validate" macro on the request. + * + * @return void + */ + public function registerRequestValidation() + { + Request::macro('validate', function (array $rules, ...$params) { + return validator()->validate($this->all(), $rules, ...$params); + }); + } + + /** + * Register the "hasValidSignature" macro on the request. + * + * @return void + */ + public function registerRequestSignatureValidation() + { + Request::macro('hasValidSignature', function ($absolute = true) { + return URL::hasValidSignature($this, $absolute); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php new file mode 100644 index 0000000..4fc90b7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php @@ -0,0 +1,46 @@ +policies as $key => $value) { + Gate::policy($key, $value); + } + } + + /** + * {@inheritdoc} + */ + public function register() + { + // + } + + /** + * Get the policies defined on the provider. + * + * @return array + */ + public function policies() + { + return $this->policies; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php new file mode 100644 index 0000000..307f2ce --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php @@ -0,0 +1,59 @@ +listens() as $event => $listeners) { + foreach ($listeners as $listener) { + Event::listen($event, $listener); + } + } + + foreach ($this->subscribe as $subscriber) { + Event::subscribe($subscriber); + } + } + + /** + * {@inheritdoc} + */ + public function register() + { + // + } + + /** + * Get the events and handlers. + * + * @return array + */ + public function listens() + { + return $this->listen; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php new file mode 100644 index 0000000..5034869 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php @@ -0,0 +1,104 @@ +setRootControllerNamespace(); + + if ($this->app->routesAreCached()) { + $this->loadCachedRoutes(); + } else { + $this->loadRoutes(); + + $this->app->booted(function () { + $this->app['router']->getRoutes()->refreshNameLookups(); + $this->app['router']->getRoutes()->refreshActionLookups(); + }); + } + } + + /** + * Set the root controller namespace for the application. + * + * @return void + */ + protected function setRootControllerNamespace() + { + if (! is_null($this->namespace)) { + $this->app[UrlGenerator::class]->setRootControllerNamespace($this->namespace); + } + } + + /** + * Load the cached routes for the application. + * + * @return void + */ + protected function loadCachedRoutes() + { + $this->app->booted(function () { + require $this->app->getCachedRoutesPath(); + }); + } + + /** + * Load the application routes. + * + * @return void + */ + protected function loadRoutes() + { + if (method_exists($this, 'map')) { + $this->app->call([$this, 'map']); + } + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + // + } + + /** + * Pass dynamic methods onto the router instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->forwardCallTo( + $this->app->make(Router::class), $method, $parameters + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithAuthentication.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithAuthentication.php new file mode 100644 index 0000000..404a8bf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithAuthentication.php @@ -0,0 +1,151 @@ +be($user, $driver); + } + + /** + * Set the currently logged in user for the application. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string|null $driver + * @return $this + */ + public function be(UserContract $user, $driver = null) + { + if (isset($user->wasRecentlyCreated) && $user->wasRecentlyCreated) { + $user->wasRecentlyCreated = false; + } + + $this->app['auth']->guard($driver)->setUser($user); + + $this->app['auth']->shouldUse($driver); + + return $this; + } + + /** + * Assert that the user is authenticated. + * + * @param string|null $guard + * @return $this + */ + public function assertAuthenticated($guard = null) + { + $this->assertTrue($this->isAuthenticated($guard), 'The user is not authenticated'); + + return $this; + } + + /** + * Assert that the user is not authenticated. + * + * @param string|null $guard + * @return $this + */ + public function assertGuest($guard = null) + { + $this->assertFalse($this->isAuthenticated($guard), 'The user is authenticated'); + + return $this; + } + + /** + * Return true if the user is authenticated, false otherwise. + * + * @param string|null $guard + * @return bool + */ + protected function isAuthenticated($guard = null) + { + return $this->app->make('auth')->guard($guard)->check(); + } + + /** + * Assert that the user is authenticated as the given user. + * + * @param \Illuminate\Contracts\Auth\Authenticatable $user + * @param string|null $guard + * @return $this + */ + public function assertAuthenticatedAs($user, $guard = null) + { + $expected = $this->app->make('auth')->guard($guard)->user(); + + $this->assertNotNull($expected, 'The current user is not authenticated.'); + + $this->assertInstanceOf( + get_class($expected), $user, + 'The currently authenticated user is not who was expected' + ); + + $this->assertSame( + $expected->getAuthIdentifier(), $user->getAuthIdentifier(), + 'The currently authenticated user is not who was expected' + ); + + return $this; + } + + /** + * Assert that the given credentials are valid. + * + * @param array $credentials + * @param string|null $guard + * @return $this + */ + public function assertCredentials(array $credentials, $guard = null) + { + $this->assertTrue( + $this->hasCredentials($credentials, $guard), 'The given credentials are invalid.' + ); + + return $this; + } + + /** + * Assert that the given credentials are invalid. + * + * @param array $credentials + * @param string|null $guard + * @return $this + */ + public function assertInvalidCredentials(array $credentials, $guard = null) + { + $this->assertFalse( + $this->hasCredentials($credentials, $guard), 'The given credentials are valid.' + ); + + return $this; + } + + /** + * Return true if the credentials are valid, false otherwise. + * + * @param array $credentials + * @param string|null $guard + * @return bool + */ + protected function hasCredentials(array $credentials, $guard = null) + { + $provider = $this->app->make('auth')->guard($guard)->getProvider(); + + $user = $provider->retrieveByCredentials($credentials); + + return $user && $provider->validateCredentials($user, $credentials); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php new file mode 100644 index 0000000..382f292 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php @@ -0,0 +1,71 @@ +mockConsoleOutput) { + return $this->app[Kernel::class]->call($command, $parameters); + } + + $this->beforeApplicationDestroyed(function () { + if (count($this->expectedQuestions)) { + $this->fail('Question "'.array_first($this->expectedQuestions)[0].'" was not asked.'); + } + + if (count($this->expectedOutput)) { + $this->fail('Output "'.array_first($this->expectedOutput).'" was not printed.'); + } + }); + + return new PendingCommand($this, $this->app, $command, $parameters); + } + + /** + * Disable mocking the console output. + * + * @return $this + */ + protected function withoutMockingConsoleOutput() + { + $this->mockConsoleOutput = false; + + $this->app->offsetUnset(OutputStyle::class); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.php new file mode 100644 index 0000000..9077601 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.php @@ -0,0 +1,59 @@ +instance($abstract, $instance); + } + + /** + * Register an instance of an object in the container. + * + * @param string $abstract + * @param object $instance + * @return object + */ + protected function instance($abstract, $instance) + { + $this->app->instance($abstract, $instance); + + return $instance; + } + + /** + * Mock an instance of an object in the container. + * + * @param string $abstract + * @param \Closure|null $mock + * @return object + */ + protected function mock($abstract, Closure $mock = null) + { + return $this->instance($abstract, Mockery::mock(...array_filter(func_get_args()))); + } + + /** + * Spy an instance of an object in the container. + * + * @param string $abstract + * @param \Closure|null $mock + * @return object + */ + protected function spy($abstract, Closure $mock = null) + { + return $this->instance($abstract, Mockery::spy(...array_filter(func_get_args()))); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php new file mode 100644 index 0000000..843e4f6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php @@ -0,0 +1,99 @@ +assertThat( + $table, new HasInDatabase($this->getConnection($connection), $data) + ); + + return $this; + } + + /** + * Assert that a given where condition does not exist in the database. + * + * @param string $table + * @param array $data + * @param string $connection + * @return $this + */ + protected function assertDatabaseMissing($table, array $data, $connection = null) + { + $constraint = new ReverseConstraint( + new HasInDatabase($this->getConnection($connection), $data) + ); + + $this->assertThat($table, $constraint); + + return $this; + } + + /** + * Assert the given record has been deleted. + * + * @param string|\Illuminate\Database\Eloquent\Model $table + * @param array $data + * @param string $connection + * @return $this + */ + protected function assertSoftDeleted($table, array $data = [], $connection = null) + { + if ($table instanceof Model) { + return $this->assertSoftDeleted($table->getTable(), [$table->getKeyName() => $table->getKey()], $table->getConnectionName()); + } + + $this->assertThat( + $table, new SoftDeletedInDatabase($this->getConnection($connection), $data) + ); + + return $this; + } + + /** + * Get the database connection. + * + * @param string|null $connection + * @return \Illuminate\Database\Connection + */ + protected function getConnection($connection = null) + { + $database = $this->app->make('db'); + + $connection = $connection ?: $database->getDefaultConnection(); + + return $database->connection($connection); + } + + /** + * Seed a given database connection. + * + * @param array|string $class + * @return $this + */ + public function seed($class = 'DatabaseSeeder') + { + foreach (Arr::wrap($class) as $class) { + $this->artisan('db:seed', ['--class' => $class, '--no-interaction' => true]); + } + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php new file mode 100644 index 0000000..efa13f3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php @@ -0,0 +1,136 @@ +originalExceptionHandler) { + $this->app->instance(ExceptionHandler::class, $this->originalExceptionHandler); + } + + return $this; + } + + /** + * Only handle the given exceptions via the exception handler. + * + * @param array $exceptions + * @return $this + */ + protected function handleExceptions(array $exceptions) + { + return $this->withoutExceptionHandling($exceptions); + } + + /** + * Only handle validation exceptions via the exception handler. + * + * @return $this + */ + protected function handleValidationExceptions() + { + return $this->handleExceptions([ValidationException::class]); + } + + /** + * Disable exception handling for the test. + * + * @param array $except + * @return $this + */ + protected function withoutExceptionHandling(array $except = []) + { + if ($this->originalExceptionHandler == null) { + $this->originalExceptionHandler = app(ExceptionHandler::class); + } + + $this->app->instance(ExceptionHandler::class, new class($this->originalExceptionHandler, $except) implements ExceptionHandler { + protected $except; + protected $originalHandler; + + /** + * Create a new class instance. + * + * @param \Illuminate\Contracts\Debug\ExceptionHandler $originalHandler + * @param array $except + * @return void + */ + public function __construct($originalHandler, $except = []) + { + $this->except = $except; + $this->originalHandler = $originalHandler; + } + + /** + * Report the given exception. + * + * @param \Exception $e + * @return void + */ + public function report(Exception $e) + { + // + } + + /** + * Render the given exception. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $e + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException|\Exception + */ + public function render($request, Exception $e) + { + if ($e instanceof NotFoundHttpException) { + throw new NotFoundHttpException( + "{$request->method()} {$request->url()}", null, $e->getCode() + ); + } + + foreach ($this->except as $class) { + if ($e instanceof $class) { + return $this->originalHandler->render($request, $e); + } + } + + throw $e; + } + + /** + * Render the exception for the console. + * + * @param \Symfony\Component\Console\Output\OutputInterface $output + * @param \Exception $e + * @return void + */ + public function renderForConsole($output, Exception $e) + { + (new ConsoleApplication)->renderException($e, $output); + } + }); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithRedis.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithRedis.php new file mode 100644 index 0000000..30fab68 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithRedis.php @@ -0,0 +1,112 @@ +app ?? new Application; + $host = getenv('REDIS_HOST') ?: '127.0.0.1'; + $port = getenv('REDIS_PORT') ?: 6379; + + if (static::$connectionFailedOnceWithDefaultsSkip) { + $this->markTestSkipped('Trying default host/port failed, please set environment variable REDIS_HOST & REDIS_PORT to enable '.__CLASS__); + + return; + } + + foreach ($this->redisDriverProvider() as $driver) { + $this->redis[$driver[0]] = new RedisManager($app, $driver[0], [ + 'cluster' => false, + 'default' => [ + 'host' => $host, + 'port' => $port, + 'database' => 5, + 'timeout' => 0.5, + ], + ]); + } + + try { + $this->redis['predis']->connection()->flushdb(); + } catch (Exception $e) { + if ($host === '127.0.0.1' && $port === 6379 && getenv('REDIS_HOST') === false) { + $this->markTestSkipped('Trying default host/port failed, please set environment variable REDIS_HOST & REDIS_PORT to enable '.__CLASS__); + static::$connectionFailedOnceWithDefaultsSkip = true; + + return; + } + } + } + + /** + * Teardown redis connection. + * + * @return void + */ + public function tearDownRedis() + { + $this->redis['predis']->connection()->flushdb(); + + foreach ($this->redisDriverProvider() as $driver) { + $this->redis[$driver[0]]->connection()->disconnect(); + } + } + + /** + * Get redis driver provider. + * + * @return array + */ + public function redisDriverProvider() + { + $providers = [ + ['predis'], + ]; + + if (extension_loaded('redis')) { + $providers[] = ['phpredis']; + } + + return $providers; + } + + /** + * Run test if redis is available. + * + * @param callable $callback + * @return void + */ + public function ifRedisAvailable($callback) + { + $this->setUpRedis(); + + $callback(); + + $this->tearDownRedis(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithSession.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithSession.php new file mode 100644 index 0000000..9d72e7c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithSession.php @@ -0,0 +1,64 @@ +session($data); + + return $this; + } + + /** + * Set the session to the given array. + * + * @param array $data + * @return $this + */ + public function session(array $data) + { + $this->startSession(); + + foreach ($data as $key => $value) { + $this->app['session']->put($key, $value); + } + + return $this; + } + + /** + * Start the session for the application. + * + * @return $this + */ + protected function startSession() + { + if (! $this->app['session']->isStarted()) { + $this->app['session']->start(); + } + + return $this; + } + + /** + * Flush all of the current session data. + * + * @return $this + */ + public function flushSession() + { + $this->startSession(); + + $this->app['session']->flush(); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php new file mode 100644 index 0000000..a530979 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php @@ -0,0 +1,460 @@ +defaultHeaders = array_merge($this->defaultHeaders, $headers); + + return $this; + } + + /** + * Add a header to be sent with the request. + * + * @param string $name + * @param string $value + * @return $this + */ + public function withHeader(string $name, string $value) + { + $this->defaultHeaders[$name] = $value; + + return $this; + } + + /** + * Flush all the configured headers. + * + * @return $this + */ + public function flushHeaders() + { + $this->defaultHeaders = []; + + return $this; + } + + /** + * Define a set of server variables to be sent with the requests. + * + * @param array $server + * @return $this + */ + public function withServerVariables(array $server) + { + $this->serverVariables = $server; + + return $this; + } + + /** + * Disable middleware for the test. + * + * @param string|array $middleware + * @return $this + */ + public function withoutMiddleware($middleware = null) + { + if (is_null($middleware)) { + $this->app->instance('middleware.disable', true); + + return $this; + } + + foreach ((array) $middleware as $abstract) { + $this->app->instance($abstract, new class { + public function handle($request, $next) + { + return $next($request); + } + }); + } + + return $this; + } + + /** + * Enable the given middleware for the test. + * + * @param string|array $middleware + * @return $this + */ + public function withMiddleware($middleware = null) + { + if (is_null($middleware)) { + unset($this->app['middleware.disable']); + + return $this; + } + + foreach ((array) $middleware as $abstract) { + unset($this->app[$abstract]); + } + + return $this; + } + + /** + * Automatically follow any redirects returned from the response. + * + * @return $this + */ + public function followingRedirects() + { + $this->followRedirects = true; + + return $this; + } + + /** + * Set the referer header to simulate a previous request. + * + * @param string $url + * @return $this + */ + public function from(string $url) + { + return $this->withHeader('referer', $url); + } + + /** + * Visit the given URI with a GET request. + * + * @param string $uri + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function get($uri, array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + + return $this->call('GET', $uri, [], [], [], $server); + } + + /** + * Visit the given URI with a GET request, expecting a JSON response. + * + * @param string $uri + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function getJson($uri, array $headers = []) + { + return $this->json('GET', $uri, [], $headers); + } + + /** + * Visit the given URI with a POST request. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function post($uri, array $data = [], array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + + return $this->call('POST', $uri, $data, [], [], $server); + } + + /** + * Visit the given URI with a POST request, expecting a JSON response. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function postJson($uri, array $data = [], array $headers = []) + { + return $this->json('POST', $uri, $data, $headers); + } + + /** + * Visit the given URI with a PUT request. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function put($uri, array $data = [], array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + + return $this->call('PUT', $uri, $data, [], [], $server); + } + + /** + * Visit the given URI with a PUT request, expecting a JSON response. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function putJson($uri, array $data = [], array $headers = []) + { + return $this->json('PUT', $uri, $data, $headers); + } + + /** + * Visit the given URI with a PATCH request. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function patch($uri, array $data = [], array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + + return $this->call('PATCH', $uri, $data, [], [], $server); + } + + /** + * Visit the given URI with a PATCH request, expecting a JSON response. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function patchJson($uri, array $data = [], array $headers = []) + { + return $this->json('PATCH', $uri, $data, $headers); + } + + /** + * Visit the given URI with a DELETE request. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function delete($uri, array $data = [], array $headers = []) + { + $server = $this->transformHeadersToServerVars($headers); + + return $this->call('DELETE', $uri, $data, [], [], $server); + } + + /** + * Visit the given URI with a DELETE request, expecting a JSON response. + * + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function deleteJson($uri, array $data = [], array $headers = []) + { + return $this->json('DELETE', $uri, $data, $headers); + } + + /** + * Call the given URI with a JSON request. + * + * @param string $method + * @param string $uri + * @param array $data + * @param array $headers + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function json($method, $uri, array $data = [], array $headers = []) + { + $files = $this->extractFilesFromDataArray($data); + + $content = json_encode($data); + + $headers = array_merge([ + 'CONTENT_LENGTH' => mb_strlen($content, '8bit'), + 'CONTENT_TYPE' => 'application/json', + 'Accept' => 'application/json', + ], $headers); + + return $this->call( + $method, $uri, [], [], $files, $this->transformHeadersToServerVars($headers), $content + ); + } + + /** + * Call the given URI and return the Response. + * + * @param string $method + * @param string $uri + * @param array $parameters + * @param array $cookies + * @param array $files + * @param array $server + * @param string $content + * @return \Illuminate\Foundation\Testing\TestResponse + */ + public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null) + { + $kernel = $this->app->make(HttpKernel::class); + + $files = array_merge($files, $this->extractFilesFromDataArray($parameters)); + + $symfonyRequest = SymfonyRequest::create( + $this->prepareUrlForRequest($uri), $method, $parameters, + $cookies, $files, array_replace($this->serverVariables, $server), $content + ); + + $response = $kernel->handle( + $request = Request::createFromBase($symfonyRequest) + ); + + if ($this->followRedirects) { + $response = $this->followRedirects($response); + } + + $kernel->terminate($request, $response); + + return $this->createTestResponse($response); + } + + /** + * Turn the given URI into a fully qualified URL. + * + * @param string $uri + * @return string + */ + protected function prepareUrlForRequest($uri) + { + if (Str::startsWith($uri, '/')) { + $uri = substr($uri, 1); + } + + if (! Str::startsWith($uri, 'http')) { + $uri = config('app.url').'/'.$uri; + } + + return trim($uri, '/'); + } + + /** + * Transform headers array to array of $_SERVER vars with HTTP_* format. + * + * @param array $headers + * @return array + */ + protected function transformHeadersToServerVars(array $headers) + { + return collect(array_merge($this->defaultHeaders, $headers))->mapWithKeys(function ($value, $name) { + $name = strtr(strtoupper($name), '-', '_'); + + return [$this->formatServerHeaderKey($name) => $value]; + })->all(); + } + + /** + * Format the header name for the server array. + * + * @param string $name + * @return string + */ + protected function formatServerHeaderKey($name) + { + if (! Str::startsWith($name, 'HTTP_') && $name !== 'CONTENT_TYPE' && $name !== 'REMOTE_ADDR') { + return 'HTTP_'.$name; + } + + return $name; + } + + /** + * Extract the file uploads from the given data array. + * + * @param array $data + * @return array + */ + protected function extractFilesFromDataArray(&$data) + { + $files = []; + + foreach ($data as $key => $value) { + if ($value instanceof SymfonyUploadedFile) { + $files[$key] = $value; + + unset($data[$key]); + } + + if (is_array($value)) { + $files[$key] = $this->extractFilesFromDataArray($value); + + $data[$key] = $value; + } + } + + return $files; + } + + /** + * Follow a redirect chain until a non-redirect is received. + * + * @param \Illuminate\Http\Response $response + * @return \Illuminate\Http\Response|\Illuminate\Foundation\Testing\TestResponse + */ + protected function followRedirects($response) + { + while ($response->isRedirect()) { + $response = $this->get($response->headers->get('Location')); + } + + $this->followRedirects = false; + + return $response; + } + + /** + * Create the test response instance from the given response. + * + * @param \Illuminate\Http\Response $response + * @return \Illuminate\Foundation\Testing\TestResponse + */ + protected function createTestResponse($response) + { + return TestResponse::fromBaseResponse($response); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php new file mode 100644 index 0000000..a6e51d4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php @@ -0,0 +1,283 @@ +withoutEvents(); + + $this->beforeApplicationDestroyed(function () use ($events) { + $fired = $this->getFiredEvents($events); + + $this->assertEmpty( + $eventsNotFired = array_diff($events, $fired), + 'These expected events were not fired: ['.implode(', ', $eventsNotFired).']' + ); + }); + + return $this; + } + + /** + * Specify a list of events that should not be fired for the given operation. + * + * These events will be mocked, so that handlers will not actually be executed. + * + * @param array|string $events + * @return $this + */ + public function doesntExpectEvents($events) + { + $events = is_array($events) ? $events : func_get_args(); + + $this->withoutEvents(); + + $this->beforeApplicationDestroyed(function () use ($events) { + $this->assertEmpty( + $fired = $this->getFiredEvents($events), + 'These unexpected events were fired: ['.implode(', ', $fired).']' + ); + }); + + return $this; + } + + /** + * Mock the event dispatcher so all events are silenced and collected. + * + * @return $this + */ + protected function withoutEvents() + { + $mock = Mockery::mock(EventsDispatcherContract::class)->shouldIgnoreMissing(); + + $mock->shouldReceive('dispatch')->andReturnUsing(function ($called) { + $this->firedEvents[] = $called; + }); + + $this->app->instance('events', $mock); + + return $this; + } + + /** + * Filter the given events against the fired events. + * + * @param array $events + * @return array + */ + protected function getFiredEvents(array $events) + { + return $this->getDispatched($events, $this->firedEvents); + } + + /** + * Specify a list of jobs that should be dispatched for the given operation. + * + * These jobs will be mocked, so that handlers will not actually be executed. + * + * @param array|string $jobs + * @return $this + */ + protected function expectsJobs($jobs) + { + $jobs = is_array($jobs) ? $jobs : func_get_args(); + + $this->withoutJobs(); + + $this->beforeApplicationDestroyed(function () use ($jobs) { + $dispatched = $this->getDispatchedJobs($jobs); + + $this->assertEmpty( + $jobsNotDispatched = array_diff($jobs, $dispatched), + 'These expected jobs were not dispatched: ['.implode(', ', $jobsNotDispatched).']' + ); + }); + + return $this; + } + + /** + * Specify a list of jobs that should not be dispatched for the given operation. + * + * These jobs will be mocked, so that handlers will not actually be executed. + * + * @param array|string $jobs + * @return $this + */ + protected function doesntExpectJobs($jobs) + { + $jobs = is_array($jobs) ? $jobs : func_get_args(); + + $this->withoutJobs(); + + $this->beforeApplicationDestroyed(function () use ($jobs) { + $this->assertEmpty( + $dispatched = $this->getDispatchedJobs($jobs), + 'These unexpected jobs were dispatched: ['.implode(', ', $dispatched).']' + ); + }); + + return $this; + } + + /** + * Mock the job dispatcher so all jobs are silenced and collected. + * + * @return $this + */ + protected function withoutJobs() + { + $mock = Mockery::mock(BusDispatcherContract::class)->shouldIgnoreMissing(); + + $mock->shouldReceive('dispatch', 'dispatchNow')->andReturnUsing(function ($dispatched) { + $this->dispatchedJobs[] = $dispatched; + }); + + $this->app->instance( + BusDispatcherContract::class, $mock + ); + + return $this; + } + + /** + * Filter the given jobs against the dispatched jobs. + * + * @param array $jobs + * @return array + */ + protected function getDispatchedJobs(array $jobs) + { + return $this->getDispatched($jobs, $this->dispatchedJobs); + } + + /** + * Filter the given classes against an array of dispatched classes. + * + * @param array $classes + * @param array $dispatched + * @return array + */ + protected function getDispatched(array $classes, array $dispatched) + { + return array_filter($classes, function ($class) use ($dispatched) { + return $this->wasDispatched($class, $dispatched); + }); + } + + /** + * Check if the given class exists in an array of dispatched classes. + * + * @param string $needle + * @param array $haystack + * @return bool + */ + protected function wasDispatched($needle, array $haystack) + { + foreach ($haystack as $dispatched) { + if ((is_string($dispatched) && ($dispatched === $needle || is_subclass_of($dispatched, $needle))) || + $dispatched instanceof $needle) { + return true; + } + } + + return false; + } + + /** + * Mock the notification dispatcher so all notifications are silenced. + * + * @return $this + */ + protected function withoutNotifications() + { + $mock = Mockery::mock(NotificationDispatcher::class); + + $mock->shouldReceive('send')->andReturnUsing(function ($notifiable, $instance, $channels = []) { + $this->dispatchedNotifications[] = compact( + 'notifiable', 'instance', 'channels' + ); + }); + + $this->app->instance(NotificationDispatcher::class, $mock); + + return $this; + } + + /** + * Specify a notification that is expected to be dispatched. + * + * @param mixed $notifiable + * @param string $notification + * @return $this + */ + protected function expectsNotification($notifiable, $notification) + { + $this->withoutNotifications(); + + $this->beforeApplicationDestroyed(function () use ($notifiable, $notification) { + foreach ($this->dispatchedNotifications as $dispatched) { + $notified = $dispatched['notifiable']; + + if (($notified === $notifiable || + $notified->getKey() == $notifiable->getKey()) && + get_class($dispatched['instance']) === $notification + ) { + return $this; + } + } + + $this->fail('The following expected notification were not dispatched: ['.$notification.']'); + }); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/HasInDatabase.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/HasInDatabase.php new file mode 100644 index 0000000..b88f342 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/HasInDatabase.php @@ -0,0 +1,103 @@ +data = $data; + + $this->database = $database; + } + + /** + * Check if the data is found in the given table. + * + * @param string $table + * @return bool + */ + public function matches($table): bool + { + return $this->database->table($table)->where($this->data)->count() > 0; + } + + /** + * Get the description of the failure. + * + * @param string $table + * @return string + */ + public function failureDescription($table): string + { + return sprintf( + "a row in the table [%s] matches the attributes %s.\n\n%s", + $table, $this->toString(JSON_PRETTY_PRINT), $this->getAdditionalInfo($table) + ); + } + + /** + * Get additional info about the records found in the database table. + * + * @param string $table + * @return string + */ + protected function getAdditionalInfo($table) + { + $results = $this->database->table($table)->get(); + + if ($results->isEmpty()) { + return 'The table is empty'; + } + + $description = 'Found: '.json_encode($results->take($this->show), JSON_PRETTY_PRINT); + + if ($results->count() > $this->show) { + $description .= sprintf(' and %s others', $results->count() - $this->show); + } + + return $description; + } + + /** + * Get a string representation of the object. + * + * @param int $options + * @return string + */ + public function toString($options = 0): string + { + return json_encode($this->data, $options); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/SeeInOrder.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/SeeInOrder.php new file mode 100644 index 0000000..8c0cb18 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/SeeInOrder.php @@ -0,0 +1,88 @@ +content = $content; + } + + /** + * Determine if the rule passes validation. + * + * @param array $values + * @return bool + */ + public function matches($values) : bool + { + $position = 0; + + foreach ($values as $value) { + if (empty($value)) { + continue; + } + + $valuePosition = mb_strpos($this->content, $value, $position); + + if ($valuePosition === false || $valuePosition < $position) { + $this->failedValue = $value; + + return false; + } + + $position = $valuePosition + mb_strlen($value); + } + + return true; + } + + /** + * Get the description of the failure. + * + * @param array $values + * @return string + */ + public function failureDescription($values) : string + { + return sprintf( + 'Failed asserting that \'%s\' contains "%s" in specified order.', + $this->content, + $this->failedValue + ); + } + + /** + * Get a string representation of the object. + * + * @return string + */ + public function toString() : string + { + return (new ReflectionClass($this))->name; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/SoftDeletedInDatabase.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/SoftDeletedInDatabase.php new file mode 100644 index 0000000..abab48c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/SoftDeletedInDatabase.php @@ -0,0 +1,103 @@ +data = $data; + + $this->database = $database; + } + + /** + * Check if the data is found in the given table. + * + * @param string $table + * @return bool + */ + public function matches($table): bool + { + return $this->database->table($table) + ->where($this->data)->whereNotNull('deleted_at')->count() > 0; + } + + /** + * Get the description of the failure. + * + * @param string $table + * @return string + */ + public function failureDescription($table): string + { + return sprintf( + "any soft deleted row in the table [%s] matches the attributes %s.\n\n%s", + $table, $this->toString(), $this->getAdditionalInfo($table) + ); + } + + /** + * Get additional info about the records found in the database table. + * + * @param string $table + * @return string + */ + protected function getAdditionalInfo($table) + { + $results = $this->database->table($table)->get(); + + if ($results->isEmpty()) { + return 'The table is empty'; + } + + $description = 'Found: '.json_encode($results->take($this->show), JSON_PRETTY_PRINT); + + if ($results->count() > $this->show) { + $description .= sprintf(' and %s others', $results->count() - $this->show); + } + + return $description; + } + + /** + * Get a string representation of the object. + * + * @return string + */ + public function toString(): string + { + return json_encode($this->data); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseMigrations.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseMigrations.php new file mode 100644 index 0000000..889a453 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseMigrations.php @@ -0,0 +1,26 @@ +artisan('migrate:fresh'); + + $this->app[Kernel::class]->setArtisan(null); + + $this->beforeApplicationDestroyed(function () { + $this->artisan('migrate:rollback'); + + RefreshDatabaseState::$migrated = false; + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseTransactions.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseTransactions.php new file mode 100644 index 0000000..9870153 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/DatabaseTransactions.php @@ -0,0 +1,40 @@ +app->make('db'); + + foreach ($this->connectionsToTransact() as $name) { + $database->connection($name)->beginTransaction(); + } + + $this->beforeApplicationDestroyed(function () use ($database) { + foreach ($this->connectionsToTransact() as $name) { + $connection = $database->connection($name); + + $connection->rollBack(); + $connection->disconnect(); + } + }); + } + + /** + * The database connections that should have transactions. + * + * @return array + */ + protected function connectionsToTransact() + { + return property_exists($this, 'connectionsToTransact') + ? $this->connectionsToTransact : [null]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/HttpException.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/HttpException.php new file mode 100644 index 0000000..537b9e0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/HttpException.php @@ -0,0 +1,10 @@ +app = $app; + $this->test = $test; + $this->command = $command; + $this->parameters = $parameters; + } + + /** + * Specify a question that should be asked when the command runs. + * + * @param string $question + * @param string $answer + * @return $this + */ + public function expectsQuestion($question, $answer) + { + $this->test->expectedQuestions[] = [$question, $answer]; + + return $this; + } + + /** + * Specify output that should be printed when the command runs. + * + * @param string $output + * @return $this + */ + public function expectsOutput($output) + { + $this->test->expectedOutput[] = $output; + + return $this; + } + + /** + * Assert that the command has the given exit code. + * + * @param int $exitCode + * @return $this + */ + public function assertExitCode($exitCode) + { + $this->expectedExitCode = $exitCode; + + return $this; + } + + /** + * Execute the command. + * + * @return int + */ + public function execute() + { + return $this->run(); + } + + /** + * Execute the command. + * + * @return int + */ + public function run() + { + $this->hasExecuted = true; + + $this->mockConsoleOutput(); + + try { + $exitCode = $this->app[Kernel::class]->call($this->command, $this->parameters); + } catch (NoMatchingExpectationException $e) { + if ($e->getMethodName() === 'askQuestion') { + $this->test->fail('Unexpected question "'.$e->getActualArguments()[0]->getQuestion().'" was asked.'); + } + } + + if ($this->expectedExitCode !== null) { + $this->test->assertEquals( + $this->expectedExitCode, $exitCode, + "Expected status code {$this->expectedExitCode} but received {$exitCode}." + ); + } + + return $exitCode; + } + + /** + * Mock the application's console output. + * + * @return void + */ + protected function mockConsoleOutput() + { + $mock = Mockery::mock(OutputStyle::class.'[askQuestion]', [ + (new ArrayInput($this->parameters)), $this->createABufferedOutputMock(), + ]); + + foreach ($this->test->expectedQuestions as $i => $question) { + $mock->shouldReceive('askQuestion') + ->once() + ->ordered() + ->with(Mockery::on(function ($argument) use ($question) { + return $argument->getQuestion() == $question[0]; + })) + ->andReturnUsing(function () use ($question, $i) { + unset($this->test->expectedQuestions[$i]); + + return $question[1]; + }); + } + + $this->app->bind(OutputStyle::class, function () use ($mock) { + return $mock; + }); + } + + /** + * Create a mock for the buffered output. + * + * @return \Mockery\MockInterface + */ + private function createABufferedOutputMock() + { + $mock = Mockery::mock(BufferedOutput::class.'[doWrite]') + ->shouldAllowMockingProtectedMethods() + ->shouldIgnoreMissing(); + + foreach ($this->test->expectedOutput as $i => $output) { + $mock->shouldReceive('doWrite') + ->once() + ->ordered() + ->with($output, Mockery::any()) + ->andReturnUsing(function () use ($i) { + unset($this->test->expectedOutput[$i]); + }); + } + + return $mock; + } + + /** + * Handle the object's destruction. + * + * @return void + */ + public function __destruct() + { + if ($this->hasExecuted) { + return; + } + + $this->run(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php new file mode 100644 index 0000000..50fb391 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php @@ -0,0 +1,117 @@ +usingInMemoryDatabase() + ? $this->refreshInMemoryDatabase() + : $this->refreshTestDatabase(); + } + + /** + * Determine if an in-memory database is being used. + * + * @return bool + */ + protected function usingInMemoryDatabase() + { + return config('database.connections')[ + config('database.default') + ]['database'] === ':memory:'; + } + + /** + * Refresh the in-memory database. + * + * @return void + */ + protected function refreshInMemoryDatabase() + { + $this->artisan('migrate'); + + $this->app[Kernel::class]->setArtisan(null); + } + + /** + * Refresh a conventional test database. + * + * @return void + */ + protected function refreshTestDatabase() + { + if (! RefreshDatabaseState::$migrated) { + $this->artisan('migrate:fresh', $this->shouldDropViews() ? [ + '--drop-views' => true, + ] : []); + + $this->app[Kernel::class]->setArtisan(null); + + RefreshDatabaseState::$migrated = true; + } + + $this->beginDatabaseTransaction(); + } + + /** + * Begin a database transaction on the testing database. + * + * @return void + */ + public function beginDatabaseTransaction() + { + $database = $this->app->make('db'); + + foreach ($this->connectionsToTransact() as $name) { + $connection = $database->connection($name); + $dispatcher = $connection->getEventDispatcher(); + + $connection->unsetEventDispatcher(); + $connection->beginTransaction(); + $connection->setEventDispatcher($dispatcher); + } + + $this->beforeApplicationDestroyed(function () use ($database) { + foreach ($this->connectionsToTransact() as $name) { + $connection = $database->connection($name); + $dispatcher = $connection->getEventDispatcher(); + + $connection->unsetEventDispatcher(); + $connection->rollback(); + $connection->setEventDispatcher($dispatcher); + $connection->disconnect(); + } + }); + } + + /** + * The database connections that should have transactions. + * + * @return array + */ + protected function connectionsToTransact() + { + return property_exists($this, 'connectionsToTransact') + ? $this->connectionsToTransact : [null]; + } + + /** + * Determine if views should be dropped when refreshing the database. + * + * @return bool + */ + protected function shouldDropViews() + { + return property_exists($this, 'dropViews') + ? $this->dropViews : false; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabaseState.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabaseState.php new file mode 100644 index 0000000..1f33087 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabaseState.php @@ -0,0 +1,13 @@ +app) { + $this->refreshApplication(); + } + + $this->setUpTraits(); + + foreach ($this->afterApplicationCreatedCallbacks as $callback) { + call_user_func($callback); + } + + Facade::clearResolvedInstances(); + + Model::setEventDispatcher($this->app['events']); + + $this->setUpHasRun = true; + } + + /** + * Refresh the application instance. + * + * @return void + */ + protected function refreshApplication() + { + $this->app = $this->createApplication(); + } + + /** + * Boot the testing helper traits. + * + * @return array + */ + protected function setUpTraits() + { + $uses = array_flip(class_uses_recursive(static::class)); + + if (isset($uses[RefreshDatabase::class])) { + $this->refreshDatabase(); + } + + if (isset($uses[DatabaseMigrations::class])) { + $this->runDatabaseMigrations(); + } + + if (isset($uses[DatabaseTransactions::class])) { + $this->beginDatabaseTransaction(); + } + + if (isset($uses[WithoutMiddleware::class])) { + $this->disableMiddlewareForAllTests(); + } + + if (isset($uses[WithoutEvents::class])) { + $this->disableEventsForAllTests(); + } + + if (isset($uses[WithFaker::class])) { + $this->setUpFaker(); + } + + return $uses; + } + + /** + * Clean up the testing environment before the next test. + * + * @return void + */ + protected function tearDown() + { + if ($this->app) { + foreach ($this->beforeApplicationDestroyedCallbacks as $callback) { + call_user_func($callback); + } + + $this->app->flush(); + + $this->app = null; + } + + $this->setUpHasRun = false; + + if (property_exists($this, 'serverVariables')) { + $this->serverVariables = []; + } + + if (property_exists($this, 'defaultHeaders')) { + $this->defaultHeaders = []; + } + + if (class_exists('Mockery')) { + if ($container = Mockery::getContainer()) { + $this->addToAssertionCount($container->mockery_getExpectationCount()); + } + + Mockery::close(); + } + + if (class_exists(Carbon::class)) { + Carbon::setTestNow(); + } + + $this->afterApplicationCreatedCallbacks = []; + $this->beforeApplicationDestroyedCallbacks = []; + + Artisan::forgetBootstrappers(); + } + + /** + * Register a callback to be run after the application is created. + * + * @param callable $callback + * @return void + */ + public function afterApplicationCreated(callable $callback) + { + $this->afterApplicationCreatedCallbacks[] = $callback; + + if ($this->setUpHasRun) { + call_user_func($callback); + } + } + + /** + * Register a callback to be run before the application is destroyed. + * + * @param callable $callback + * @return void + */ + protected function beforeApplicationDestroyed(callable $callback) + { + $this->beforeApplicationDestroyedCallbacks[] = $callback; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php new file mode 100644 index 0000000..40d7746 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php @@ -0,0 +1,1059 @@ +baseResponse = $response; + } + + /** + * Create a new TestResponse from another response. + * + * @param \Illuminate\Http\Response $response + * @return static + */ + public static function fromBaseResponse($response) + { + return new static($response); + } + + /** + * Assert that the response has a successful status code. + * + * @return $this + */ + public function assertSuccessful() + { + PHPUnit::assertTrue( + $this->isSuccessful(), + 'Response status code ['.$this->getStatusCode().'] is not a successful status code.' + ); + + return $this; + } + + /** + * Assert that the response has a 200 status code. + * + * @return $this + */ + public function assertOk() + { + PHPUnit::assertTrue( + $this->isOk(), + 'Response status code ['.$this->getStatusCode().'] does not match expected 200 status code.' + ); + + return $this; + } + + /** + * Assert that the response has a not found status code. + * + * @return $this + */ + public function assertNotFound() + { + PHPUnit::assertTrue( + $this->isNotFound(), + 'Response status code ['.$this->getStatusCode().'] is not a not found status code.' + ); + + return $this; + } + + /** + * Assert that the response has a forbidden status code. + * + * @return $this + */ + public function assertForbidden() + { + PHPUnit::assertTrue( + $this->isForbidden(), + 'Response status code ['.$this->getStatusCode().'] is not a forbidden status code.' + ); + + return $this; + } + + /** + * Assert that the response has the given status code. + * + * @param int $status + * @return $this + */ + public function assertStatus($status) + { + $actual = $this->getStatusCode(); + + PHPUnit::assertTrue( + $actual === $status, + "Expected status code {$status} but received {$actual}." + ); + + return $this; + } + + /** + * Assert whether the response is redirecting to a given URI. + * + * @param string $uri + * @return $this + */ + public function assertRedirect($uri = null) + { + PHPUnit::assertTrue( + $this->isRedirect(), 'Response status code ['.$this->getStatusCode().'] is not a redirect status code.' + ); + + if (! is_null($uri)) { + $this->assertLocation($uri); + } + + return $this; + } + + /** + * Asserts that the response contains the given header and equals the optional value. + * + * @param string $headerName + * @param mixed $value + * @return $this + */ + public function assertHeader($headerName, $value = null) + { + PHPUnit::assertTrue( + $this->headers->has($headerName), "Header [{$headerName}] not present on response." + ); + + $actual = $this->headers->get($headerName); + + if (! is_null($value)) { + PHPUnit::assertEquals( + $value, $this->headers->get($headerName), + "Header [{$headerName}] was found, but value [{$actual}] does not match [{$value}]." + ); + } + + return $this; + } + + /** + * Asserts that the response does not contains the given header. + * + * @param string $headerName + * @return $this + */ + public function assertHeaderMissing($headerName) + { + PHPUnit::assertFalse( + $this->headers->has($headerName), "Unexpected header [{$headerName}] is present on response." + ); + + return $this; + } + + /** + * Assert that the current location header matches the given URI. + * + * @param string $uri + * @return $this + */ + public function assertLocation($uri) + { + PHPUnit::assertEquals( + app('url')->to($uri), app('url')->to($this->headers->get('Location')) + ); + + return $this; + } + + /** + * Asserts that the response contains the given cookie and equals the optional value. + * + * @param string $cookieName + * @param mixed $value + * @return $this + */ + public function assertPlainCookie($cookieName, $value = null) + { + $this->assertCookie($cookieName, $value, false); + + return $this; + } + + /** + * Asserts that the response contains the given cookie and equals the optional value. + * + * @param string $cookieName + * @param mixed $value + * @param bool $encrypted + * @param bool $unserialize + * @return $this + */ + public function assertCookie($cookieName, $value = null, $encrypted = true, $unserialize = false) + { + PHPUnit::assertNotNull( + $cookie = $this->getCookie($cookieName), + "Cookie [{$cookieName}] not present on response." + ); + + if (! $cookie || is_null($value)) { + return $this; + } + + $cookieValue = $cookie->getValue(); + + $actual = $encrypted + ? app('encrypter')->decrypt($cookieValue, $unserialize) : $cookieValue; + + PHPUnit::assertEquals( + $value, $actual, + "Cookie [{$cookieName}] was found, but value [{$actual}] does not match [{$value}]." + ); + + return $this; + } + + /** + * Asserts that the response contains the given cookie and is expired. + * + * @param string $cookieName + * @return $this + */ + public function assertCookieExpired($cookieName) + { + PHPUnit::assertNotNull( + $cookie = $this->getCookie($cookieName), + "Cookie [{$cookieName}] not present on response." + ); + + $expiresAt = Carbon::createFromTimestamp($cookie->getExpiresTime()); + + PHPUnit::assertTrue( + $expiresAt->lessThan(Carbon::now()), + "Cookie [{$cookieName}] is not expired, it expires at [{$expiresAt}]." + ); + + return $this; + } + + /** + * Asserts that the response contains the given cookie and is not expired. + * + * @param string $cookieName + * @return $this + */ + public function assertCookieNotExpired($cookieName) + { + PHPUnit::assertNotNull( + $cookie = $this->getCookie($cookieName), + "Cookie [{$cookieName}] not present on response." + ); + + $expiresAt = Carbon::createFromTimestamp($cookie->getExpiresTime()); + + PHPUnit::assertTrue( + $expiresAt->greaterThan(Carbon::now()), + "Cookie [{$cookieName}] is expired, it expired at [{$expiresAt}]." + ); + + return $this; + } + + /** + * Asserts that the response does not contains the given cookie. + * + * @param string $cookieName + * @return $this + */ + public function assertCookieMissing($cookieName) + { + PHPUnit::assertNull( + $this->getCookie($cookieName), + "Cookie [{$cookieName}] is present on response." + ); + + return $this; + } + + /** + * Get the given cookie from the response. + * + * @param string $cookieName + * @return \Symfony\Component\HttpFoundation\Cookie|null + */ + protected function getCookie($cookieName) + { + foreach ($this->headers->getCookies() as $cookie) { + if ($cookie->getName() === $cookieName) { + return $cookie; + } + } + } + + /** + * Assert that the given string is contained within the response. + * + * @param string $value + * @return $this + */ + public function assertSee($value) + { + PHPUnit::assertContains((string) $value, $this->getContent()); + + return $this; + } + + /** + * Assert that the given strings are contained in order within the response. + * + * @param array $values + * @return $this + */ + public function assertSeeInOrder(array $values) + { + PHPUnit::assertThat($values, new SeeInOrder($this->getContent())); + + return $this; + } + + /** + * Assert that the given string is contained within the response text. + * + * @param string $value + * @return $this + */ + public function assertSeeText($value) + { + PHPUnit::assertContains((string) $value, strip_tags($this->getContent())); + + return $this; + } + + /** + * Assert that the given strings are contained in order within the response text. + * + * @param array $values + * @return $this + */ + public function assertSeeTextInOrder(array $values) + { + PHPUnit::assertThat($values, new SeeInOrder(strip_tags($this->getContent()))); + + return $this; + } + + /** + * Assert that the given string is not contained within the response. + * + * @param string $value + * @return $this + */ + public function assertDontSee($value) + { + PHPUnit::assertNotContains((string) $value, $this->getContent()); + + return $this; + } + + /** + * Assert that the given string is not contained within the response text. + * + * @param string $value + * @return $this + */ + public function assertDontSeeText($value) + { + PHPUnit::assertNotContains((string) $value, strip_tags($this->getContent())); + + return $this; + } + + /** + * Assert that the response is a superset of the given JSON. + * + * @param array $data + * @param bool $strict + * @return $this + */ + public function assertJson(array $data, $strict = false) + { + PHPUnit::assertArraySubset( + $data, $this->decodeResponseJson(), $strict, $this->assertJsonMessage($data) + ); + + return $this; + } + + /** + * Get the assertion message for assertJson. + * + * @param array $data + * @return string + */ + protected function assertJsonMessage(array $data) + { + $expected = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); + + $actual = json_encode($this->decodeResponseJson(), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); + + return 'Unable to find JSON: '.PHP_EOL.PHP_EOL. + "[{$expected}]".PHP_EOL.PHP_EOL. + 'within response JSON:'.PHP_EOL.PHP_EOL. + "[{$actual}].".PHP_EOL.PHP_EOL; + } + + /** + * Assert that the response has the exact given JSON. + * + * @param array $data + * @return $this + */ + public function assertExactJson(array $data) + { + $actual = json_encode(Arr::sortRecursive( + (array) $this->decodeResponseJson() + )); + + PHPUnit::assertEquals(json_encode(Arr::sortRecursive($data)), $actual); + + return $this; + } + + /** + * Assert that the response contains the given JSON fragment. + * + * @param array $data + * @return $this + */ + public function assertJsonFragment(array $data) + { + $actual = json_encode(Arr::sortRecursive( + (array) $this->decodeResponseJson() + )); + + foreach (Arr::sortRecursive($data) as $key => $value) { + $expected = $this->jsonSearchStrings($key, $value); + + PHPUnit::assertTrue( + Str::contains($actual, $expected), + 'Unable to find JSON fragment: '.PHP_EOL.PHP_EOL. + '['.json_encode([$key => $value]).']'.PHP_EOL.PHP_EOL. + 'within'.PHP_EOL.PHP_EOL. + "[{$actual}]." + ); + } + + return $this; + } + + /** + * Assert that the response does not contain the given JSON fragment. + * + * @param array $data + * @param bool $exact + * @return $this + */ + public function assertJsonMissing(array $data, $exact = false) + { + if ($exact) { + return $this->assertJsonMissingExact($data); + } + + $actual = json_encode(Arr::sortRecursive( + (array) $this->decodeResponseJson() + )); + + foreach (Arr::sortRecursive($data) as $key => $value) { + $unexpected = $this->jsonSearchStrings($key, $value); + + PHPUnit::assertFalse( + Str::contains($actual, $unexpected), + 'Found unexpected JSON fragment: '.PHP_EOL.PHP_EOL. + '['.json_encode([$key => $value]).']'.PHP_EOL.PHP_EOL. + 'within'.PHP_EOL.PHP_EOL. + "[{$actual}]." + ); + } + + return $this; + } + + /** + * Assert that the response does not contain the exact JSON fragment. + * + * @param array $data + * @return $this + */ + public function assertJsonMissingExact(array $data) + { + $actual = json_encode(Arr::sortRecursive( + (array) $this->decodeResponseJson() + )); + + foreach (Arr::sortRecursive($data) as $key => $value) { + $unexpected = $this->jsonSearchStrings($key, $value); + + if (! Str::contains($actual, $unexpected)) { + return $this; + } + } + + PHPUnit::fail( + 'Found unexpected JSON fragment: '.PHP_EOL.PHP_EOL. + '['.json_encode($data).']'.PHP_EOL.PHP_EOL. + 'within'.PHP_EOL.PHP_EOL. + "[{$actual}]." + ); + } + + /** + * Get the strings we need to search for when examining the JSON. + * + * @param string $key + * @param string $value + * @return array + */ + protected function jsonSearchStrings($key, $value) + { + $needle = substr(json_encode([$key => $value]), 1, -1); + + return [ + $needle.']', + $needle.'}', + $needle.',', + ]; + } + + /** + * Assert that the response has a given JSON structure. + * + * @param array|null $structure + * @param array|null $responseData + * @return $this + */ + public function assertJsonStructure(array $structure = null, $responseData = null) + { + if (is_null($structure)) { + return $this->assertExactJson($this->json()); + } + + if (is_null($responseData)) { + $responseData = $this->decodeResponseJson(); + } + + foreach ($structure as $key => $value) { + if (is_array($value) && $key === '*') { + PHPUnit::assertInternalType('array', $responseData); + + foreach ($responseData as $responseDataItem) { + $this->assertJsonStructure($structure['*'], $responseDataItem); + } + } elseif (is_array($value)) { + PHPUnit::assertArrayHasKey($key, $responseData); + + $this->assertJsonStructure($structure[$key], $responseData[$key]); + } else { + PHPUnit::assertArrayHasKey($value, $responseData); + } + } + + return $this; + } + + /** + * Assert that the response JSON has the expected count of items at the given key. + * + * @param int $count + * @param string|null $key + * @return $this + */ + public function assertJsonCount(int $count, $key = null) + { + if ($key) { + PHPUnit::assertCount( + $count, data_get($this->json(), $key), + "Failed to assert that the response count matched the expected {$count}" + ); + + return $this; + } + + PHPUnit::assertCount($count, + $this->json(), + "Failed to assert that the response count matched the expected {$count}" + ); + + return $this; + } + + /** + * Assert that the response has the given JSON validation errors for the given keys. + * + * @param string|array $keys + * @return $this + */ + public function assertJsonValidationErrors($keys) + { + $errors = $this->json()['errors']; + + foreach (Arr::wrap($keys) as $key) { + PHPUnit::assertTrue( + isset($errors[$key]), + "Failed to find a validation error in the response for key: '{$key}'" + ); + } + + return $this; + } + + /** + * Assert that the response has no JSON validation errors for the given keys. + * + * @param string|array $keys + * @return $this + */ + public function assertJsonMissingValidationErrors($keys) + { + $json = $this->json(); + + if (! array_key_exists('errors', $json)) { + PHPUnit::assertArrayNotHasKey('errors', $json); + + return $this; + } + + $errors = $json['errors']; + + foreach (Arr::wrap($keys) as $key) { + PHPUnit::assertFalse( + isset($errors[$key]), + "Found unexpected validation error for key: '{$key}'" + ); + } + + return $this; + } + + /** + * Validate and return the decoded response JSON. + * + * @param string|null $key + * @return mixed + */ + public function decodeResponseJson($key = null) + { + $decodedResponse = json_decode($this->getContent(), true); + + if (is_null($decodedResponse) || $decodedResponse === false) { + if ($this->exception) { + throw $this->exception; + } else { + PHPUnit::fail('Invalid JSON was returned from the route.'); + } + } + + return data_get($decodedResponse, $key); + } + + /** + * Validate and return the decoded response JSON. + * + * @param string|null $key + * @return mixed + */ + public function json($key = null) + { + return $this->decodeResponseJson($key); + } + + /** + * Assert that the response view equals the given value. + * + * @param string $value + * @return $this + */ + public function assertViewIs($value) + { + $this->ensureResponseHasView(); + + PHPUnit::assertEquals($value, $this->original->getName()); + + return $this; + } + + /** + * Assert that the response view has a given piece of bound data. + * + * @param string|array $key + * @param mixed $value + * @return $this + */ + public function assertViewHas($key, $value = null) + { + if (is_array($key)) { + return $this->assertViewHasAll($key); + } + + $this->ensureResponseHasView(); + + if (is_null($value)) { + PHPUnit::assertArrayHasKey($key, $this->original->getData()); + } elseif ($value instanceof Closure) { + PHPUnit::assertTrue($value($this->original->$key)); + } elseif ($value instanceof Model) { + PHPUnit::assertTrue($value->is($this->original->$key)); + } else { + PHPUnit::assertEquals($value, $this->original->$key); + } + + return $this; + } + + /** + * Assert that the response view has a given list of bound data. + * + * @param array $bindings + * @return $this + */ + public function assertViewHasAll(array $bindings) + { + foreach ($bindings as $key => $value) { + if (is_int($key)) { + $this->assertViewHas($value); + } else { + $this->assertViewHas($key, $value); + } + } + + return $this; + } + + /** + * Get a piece of data from the original view. + * + * @param string $key + * @return mixed + */ + public function viewData($key) + { + $this->ensureResponseHasView(); + + return $this->original->$key; + } + + /** + * Assert that the response view is missing a piece of bound data. + * + * @param string $key + * @return $this + */ + public function assertViewMissing($key) + { + $this->ensureResponseHasView(); + + PHPUnit::assertArrayNotHasKey($key, $this->original->getData()); + + return $this; + } + + /** + * Ensure that the response has a view as its original content. + * + * @return $this + */ + protected function ensureResponseHasView() + { + if (! isset($this->original) || ! $this->original instanceof View) { + return PHPUnit::fail('The response is not a view.'); + } + + return $this; + } + + /** + * Assert that the session has a given value. + * + * @param string|array $key + * @param mixed $value + * @return $this + */ + public function assertSessionHas($key, $value = null) + { + if (is_array($key)) { + return $this->assertSessionHasAll($key); + } + + if (is_null($value)) { + PHPUnit::assertTrue( + $this->session()->has($key), + "Session is missing expected key [{$key}]." + ); + } else { + PHPUnit::assertEquals($value, $this->session()->get($key)); + } + + return $this; + } + + /** + * Assert that the session has a given list of values. + * + * @param array $bindings + * @return $this + */ + public function assertSessionHasAll(array $bindings) + { + foreach ($bindings as $key => $value) { + if (is_int($key)) { + $this->assertSessionHas($value); + } else { + $this->assertSessionHas($key, $value); + } + } + + return $this; + } + + /** + * Assert that the session has the given errors. + * + * @param string|array $keys + * @param mixed $format + * @param string $errorBag + * @return $this + */ + public function assertSessionHasErrors($keys = [], $format = null, $errorBag = 'default') + { + $this->assertSessionHas('errors'); + + $keys = (array) $keys; + + $errors = $this->session()->get('errors')->getBag($errorBag); + + foreach ($keys as $key => $value) { + if (is_int($key)) { + PHPUnit::assertTrue($errors->has($value), "Session missing error: $value"); + } else { + PHPUnit::assertContains($value, $errors->get($key, $format)); + } + } + + return $this; + } + + /** + * Assert that the session is missing the given errors. + * + * @param string|array $keys + * @param string $format + * @param string $errorBag + * @return $this + */ + public function assertSessionDoesntHaveErrors($keys = [], $format = null, $errorBag = 'default') + { + $keys = (array) $keys; + + if (empty($keys)) { + return $this->assertSessionMissing('errors'); + } + + $errors = $this->session()->get('errors')->getBag($errorBag); + + foreach ($keys as $key => $value) { + if (is_int($key)) { + PHPUnit::assertFalse($errors->has($value), "Session has unexpected error: $value"); + } else { + PHPUnit::assertNotContains($value, $errors->get($key, $format)); + } + } + + return $this; + } + + /** + * Assert that the session has no errors. + * + * @return $this + */ + public function assertSessionHasNoErrors() + { + $hasErrors = $this->session()->has('errors'); + + $errors = $hasErrors ? $this->session()->get('errors')->all() : []; + + PHPUnit::assertFalse( + $hasErrors, + 'Session has unexpected errors: '.PHP_EOL.PHP_EOL. + json_encode($errors, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) + ); + + return $this; + } + + /** + * Assert that the session has the given errors. + * + * @param string $errorBag + * @param string|array $keys + * @param mixed $format + * @return $this + */ + public function assertSessionHasErrorsIn($errorBag, $keys = [], $format = null) + { + return $this->assertSessionHasErrors($keys, $format, $errorBag); + } + + /** + * Assert that the session does not have a given key. + * + * @param string|array $key + * @return $this + */ + public function assertSessionMissing($key) + { + if (is_array($key)) { + foreach ($key as $value) { + $this->assertSessionMissing($value); + } + } else { + PHPUnit::assertFalse( + $this->session()->has($key), + "Session has unexpected key [{$key}]." + ); + } + + return $this; + } + + /** + * Get the current session store. + * + * @return \Illuminate\Session\Store + */ + protected function session() + { + return app('session.store'); + } + + /** + * Dump the content from the response. + * + * @return void + */ + public function dump() + { + $content = $this->getContent(); + + $json = json_decode($content); + + if (json_last_error() === JSON_ERROR_NONE) { + $content = $json; + } + + dd($content); + } + + /** + * Get the streamed content from the response. + * + * @return string + */ + public function streamedContent() + { + if (! is_null($this->streamedContent)) { + return $this->streamedContent; + } + + if (! $this->baseResponse instanceof StreamedResponse) { + PHPUnit::fail('The response is not a streamed response.'); + } + + ob_start(); + + $this->sendContent(); + + return $this->streamedContent = ob_get_clean(); + } + + /** + * Dynamically access base response parameters. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->baseResponse->{$key}; + } + + /** + * Proxy isset() checks to the underlying base response. + * + * @param string $key + * @return mixed + */ + public function __isset($key) + { + return isset($this->baseResponse->{$key}); + } + + /** + * Handle dynamic calls into macros or pass missing methods to the base response. + * + * @param string $method + * @param array $args + * @return mixed + */ + public function __call($method, $args) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $args); + } + + return $this->baseResponse->{$method}(...$args); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithFaker.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithFaker.php new file mode 100644 index 0000000..8eff5d4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithFaker.php @@ -0,0 +1,47 @@ +faker = $this->makeFaker(); + } + + /** + * Get the default Faker instance for a given locale. + * + * @param string $locale + * @return \Faker\Generator + */ + protected function faker($locale = null) + { + return is_null($locale) ? $this->faker : $this->makeFaker($locale); + } + + /** + * Create a Faker instance for the given locale. + * + * @param string $locale + * @return \Faker\Generator + */ + protected function makeFaker($locale = null) + { + return Factory::create($locale ?? Factory::DEFAULT_LOCALE); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutEvents.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutEvents.php new file mode 100644 index 0000000..fa5df3c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutEvents.php @@ -0,0 +1,22 @@ +withoutEvents(); + } else { + throw new Exception('Unable to disable events. ApplicationTrait not used.'); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutMiddleware.php b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutMiddleware.php new file mode 100644 index 0000000..269b532 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Testing/WithoutMiddleware.php @@ -0,0 +1,22 @@ +withoutMiddleware(); + } else { + throw new Exception('Unable to disable middleware. MakesHttpRequests trait not used.'); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php b/vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php new file mode 100644 index 0000000..89ab3d1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php @@ -0,0 +1,83 @@ +getValidationFactory()->make($request->all(), $validator); + } + + return $validator->validate(); + } + + /** + * Validate the given request with the given rules. + * + * @param \Illuminate\Http\Request $request + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return array + * + * @throws \Illuminate\Validation\ValidationException + */ + public function validate(Request $request, array $rules, + array $messages = [], array $customAttributes = []) + { + return $this->getValidationFactory()->make( + $request->all(), $rules, $messages, $customAttributes + )->validate(); + } + + /** + * Validate the given request with the given rules. + * + * @param string $errorBag + * @param \Illuminate\Http\Request $request + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return array + * + * @throws \Illuminate\Validation\ValidationException + */ + public function validateWithBag($errorBag, Request $request, array $rules, + array $messages = [], array $customAttributes = []) + { + try { + return $this->validate($request, $rules, $messages, $customAttributes); + } catch (ValidationException $e) { + $e->errorBag = $errorBag; + + throw $e; + } + } + + /** + * Get a validation factory instance. + * + * @return \Illuminate\Contracts\Validation\Factory + */ + protected function getValidationFactory() + { + return app(Factory::class); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php b/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php new file mode 100644 index 0000000..123df89 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php @@ -0,0 +1,1013 @@ +toResponse(request())); + } + + app()->abort($code, $message, $headers); + } +} + +if (! function_exists('abort_if')) { + /** + * Throw an HttpException with the given data if the given condition is true. + * + * @param bool $boolean + * @param int $code + * @param string $message + * @param array $headers + * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + function abort_if($boolean, $code, $message = '', array $headers = []) + { + if ($boolean) { + abort($code, $message, $headers); + } + } +} + +if (! function_exists('abort_unless')) { + /** + * Throw an HttpException with the given data unless the given condition is true. + * + * @param bool $boolean + * @param int $code + * @param string $message + * @param array $headers + * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + function abort_unless($boolean, $code, $message = '', array $headers = []) + { + if (! $boolean) { + abort($code, $message, $headers); + } + } +} + +if (! function_exists('action')) { + /** + * Generate the URL to a controller action. + * + * @param string|array $name + * @param mixed $parameters + * @param bool $absolute + * @return string + */ + function action($name, $parameters = [], $absolute = true) + { + return app('url')->action($name, $parameters, $absolute); + } +} + +if (! function_exists('app')) { + /** + * Get the available container instance. + * + * @param string $abstract + * @param array $parameters + * @return mixed|\Illuminate\Foundation\Application + */ + function app($abstract = null, array $parameters = []) + { + if (is_null($abstract)) { + return Container::getInstance(); + } + + return Container::getInstance()->make($abstract, $parameters); + } +} + +if (! function_exists('app_path')) { + /** + * Get the path to the application folder. + * + * @param string $path + * @return string + */ + function app_path($path = '') + { + return app('path').($path ? DIRECTORY_SEPARATOR.$path : $path); + } +} + +if (! function_exists('asset')) { + /** + * Generate an asset path for the application. + * + * @param string $path + * @param bool $secure + * @return string + */ + function asset($path, $secure = null) + { + return app('url')->asset($path, $secure); + } +} + +if (! function_exists('auth')) { + /** + * Get the available auth instance. + * + * @param string|null $guard + * @return \Illuminate\Contracts\Auth\Factory|\Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard + */ + function auth($guard = null) + { + if (is_null($guard)) { + return app(AuthFactory::class); + } + + return app(AuthFactory::class)->guard($guard); + } +} + +if (! function_exists('back')) { + /** + * Create a new redirect response to the previous location. + * + * @param int $status + * @param array $headers + * @param mixed $fallback + * @return \Illuminate\Http\RedirectResponse + */ + function back($status = 302, $headers = [], $fallback = false) + { + return app('redirect')->back($status, $headers, $fallback); + } +} + +if (! function_exists('base_path')) { + /** + * Get the path to the base of the install. + * + * @param string $path + * @return string + */ + function base_path($path = '') + { + return app()->basePath().($path ? DIRECTORY_SEPARATOR.$path : $path); + } +} + +if (! function_exists('bcrypt')) { + /** + * Hash the given value against the bcrypt algorithm. + * + * @param string $value + * @param array $options + * @return string + */ + function bcrypt($value, $options = []) + { + return app('hash')->driver('bcrypt')->make($value, $options); + } +} + +if (! function_exists('broadcast')) { + /** + * Begin broadcasting an event. + * + * @param mixed|null $event + * @return \Illuminate\Broadcasting\PendingBroadcast + */ + function broadcast($event = null) + { + return app(BroadcastFactory::class)->event($event); + } +} + +if (! function_exists('cache')) { + /** + * Get / set the specified cache value. + * + * If an array is passed, we'll assume you want to put to the cache. + * + * @param dynamic key|key,default|data,expiration|null + * @return mixed|\Illuminate\Cache\CacheManager + * + * @throws \Exception + */ + function cache() + { + $arguments = func_get_args(); + + if (empty($arguments)) { + return app('cache'); + } + + if (is_string($arguments[0])) { + return app('cache')->get(...$arguments); + } + + if (! is_array($arguments[0])) { + throw new Exception( + 'When setting a value in the cache, you must pass an array of key / value pairs.' + ); + } + + if (! isset($arguments[1])) { + throw new Exception( + 'You must specify an expiration time when setting a value in the cache.' + ); + } + + return app('cache')->put(key($arguments[0]), reset($arguments[0]), $arguments[1]); + } +} + +if (! function_exists('config')) { + /** + * Get / set the specified configuration value. + * + * If an array is passed as the key, we will assume you want to set an array of values. + * + * @param array|string $key + * @param mixed $default + * @return mixed|\Illuminate\Config\Repository + */ + function config($key = null, $default = null) + { + if (is_null($key)) { + return app('config'); + } + + if (is_array($key)) { + return app('config')->set($key); + } + + return app('config')->get($key, $default); + } +} + +if (! function_exists('config_path')) { + /** + * Get the configuration path. + * + * @param string $path + * @return string + */ + function config_path($path = '') + { + return app()->make('path.config').($path ? DIRECTORY_SEPARATOR.$path : $path); + } +} + +if (! function_exists('cookie')) { + /** + * Create a new cookie instance. + * + * @param string $name + * @param string $value + * @param int $minutes + * @param string $path + * @param string $domain + * @param bool $secure + * @param bool $httpOnly + * @param bool $raw + * @param string|null $sameSite + * @return \Illuminate\Cookie\CookieJar|\Symfony\Component\HttpFoundation\Cookie + */ + function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true, $raw = false, $sameSite = null) + { + $cookie = app(CookieFactory::class); + + if (is_null($name)) { + return $cookie; + } + + return $cookie->make($name, $value, $minutes, $path, $domain, $secure, $httpOnly, $raw, $sameSite); + } +} + +if (! function_exists('csrf_field')) { + /** + * Generate a CSRF token form field. + * + * @return \Illuminate\Support\HtmlString + */ + function csrf_field() + { + return new HtmlString(''); + } +} + +if (! function_exists('csrf_token')) { + /** + * Get the CSRF token value. + * + * @return string + * + * @throws \RuntimeException + */ + function csrf_token() + { + $session = app('session'); + + if (isset($session)) { + return $session->token(); + } + + throw new RuntimeException('Application session store not set.'); + } +} + +if (! function_exists('database_path')) { + /** + * Get the database path. + * + * @param string $path + * @return string + */ + function database_path($path = '') + { + return app()->databasePath($path); + } +} + +if (! function_exists('decrypt')) { + /** + * Decrypt the given value. + * + * @param string $value + * @param bool $unserialize + * @return mixed + */ + function decrypt($value, $unserialize = true) + { + return app('encrypter')->decrypt($value, $unserialize); + } +} + +if (! function_exists('dispatch')) { + /** + * Dispatch a job to its appropriate handler. + * + * @param mixed $job + * @return \Illuminate\Foundation\Bus\PendingDispatch + */ + function dispatch($job) + { + if ($job instanceof Closure) { + $job = new CallQueuedClosure(new SerializableClosure($job)); + } + + return new PendingDispatch($job); + } +} + +if (! function_exists('dispatch_now')) { + /** + * Dispatch a command to its appropriate handler in the current process. + * + * @param mixed $job + * @param mixed $handler + * @return mixed + */ + function dispatch_now($job, $handler = null) + { + return app(Dispatcher::class)->dispatchNow($job, $handler); + } +} + +if (! function_exists('elixir')) { + /** + * Get the path to a versioned Elixir file. + * + * @param string $file + * @param string $buildDirectory + * @return string + * + * @throws \InvalidArgumentException + */ + function elixir($file, $buildDirectory = 'build') + { + static $manifest = []; + static $manifestPath; + + if (empty($manifest) || $manifestPath !== $buildDirectory) { + $path = public_path($buildDirectory.'/rev-manifest.json'); + + if (file_exists($path)) { + $manifest = json_decode(file_get_contents($path), true); + $manifestPath = $buildDirectory; + } + } + + $file = ltrim($file, '/'); + + if (isset($manifest[$file])) { + return '/'.trim($buildDirectory.'/'.$manifest[$file], '/'); + } + + $unversioned = public_path($file); + + if (file_exists($unversioned)) { + return '/'.trim($file, '/'); + } + + throw new InvalidArgumentException("File {$file} not defined in asset manifest."); + } +} + +if (! function_exists('encrypt')) { + /** + * Encrypt the given value. + * + * @param mixed $value + * @param bool $serialize + * @return string + */ + function encrypt($value, $serialize = true) + { + return app('encrypter')->encrypt($value, $serialize); + } +} + +if (! function_exists('event')) { + /** + * Dispatch an event and call the listeners. + * + * @param string|object $event + * @param mixed $payload + * @param bool $halt + * @return array|null + */ + function event(...$args) + { + return app('events')->dispatch(...$args); + } +} + +if (! function_exists('factory')) { + /** + * Create a model factory builder for a given class, name, and amount. + * + * @param dynamic class|class,name|class,amount|class,name,amount + * @return \Illuminate\Database\Eloquent\FactoryBuilder + */ + function factory() + { + $factory = app(EloquentFactory::class); + + $arguments = func_get_args(); + + if (isset($arguments[1]) && is_string($arguments[1])) { + return $factory->of($arguments[0], $arguments[1])->times($arguments[2] ?? null); + } elseif (isset($arguments[1])) { + return $factory->of($arguments[0])->times($arguments[1]); + } + + return $factory->of($arguments[0]); + } +} + +if (! function_exists('info')) { + /** + * Write some information to the log. + * + * @param string $message + * @param array $context + * @return void + */ + function info($message, $context = []) + { + app('log')->info($message, $context); + } +} + +if (! function_exists('logger')) { + /** + * Log a debug message to the logs. + * + * @param string $message + * @param array $context + * @return \Illuminate\Log\LogManager|null + */ + function logger($message = null, array $context = []) + { + if (is_null($message)) { + return app('log'); + } + + return app('log')->debug($message, $context); + } +} + +if (! function_exists('logs')) { + /** + * Get a log driver instance. + * + * @param string $driver + * @return \Illuminate\Log\LogManager|\Psr\Log\LoggerInterface + */ + function logs($driver = null) + { + return $driver ? app('log')->driver($driver) : app('log'); + } +} + +if (! function_exists('method_field')) { + /** + * Generate a form field to spoof the HTTP verb used by forms. + * + * @param string $method + * @return \Illuminate\Support\HtmlString + */ + function method_field($method) + { + return new HtmlString(''); + } +} + +if (! function_exists('mix')) { + /** + * Get the path to a versioned Mix file. + * + * @param string $path + * @param string $manifestDirectory + * @return \Illuminate\Support\HtmlString|string + * + * @throws \Exception + */ + function mix($path, $manifestDirectory = '') + { + static $manifests = []; + + if (! Str::startsWith($path, '/')) { + $path = "/{$path}"; + } + + if ($manifestDirectory && ! Str::startsWith($manifestDirectory, '/')) { + $manifestDirectory = "/{$manifestDirectory}"; + } + + if (file_exists(public_path($manifestDirectory.'/hot'))) { + $url = rtrim(file_get_contents(public_path($manifestDirectory.'/hot'))); + + if (Str::startsWith($url, ['http://', 'https://'])) { + return new HtmlString(Str::after($url, ':').$path); + } + + return new HtmlString("//localhost:8080{$path}"); + } + + $manifestPath = public_path($manifestDirectory.'/mix-manifest.json'); + + if (! isset($manifests[$manifestPath])) { + if (! file_exists($manifestPath)) { + throw new Exception('The Mix manifest does not exist.'); + } + + $manifests[$manifestPath] = json_decode(file_get_contents($manifestPath), true); + } + + $manifest = $manifests[$manifestPath]; + + if (! isset($manifest[$path])) { + $exception = new Exception("Unable to locate Mix file: {$path}."); + + if (! app('config')->get('app.debug')) { + report($exception); + + return $path; + } else { + throw $exception; + } + } + + return new HtmlString($manifestDirectory.$manifest[$path]); + } +} + +if (! function_exists('now')) { + /** + * Create a new Carbon instance for the current time. + * + * @param \DateTimeZone|string|null $tz + * @return \Illuminate\Support\Carbon + */ + function now($tz = null) + { + return Carbon::now($tz); + } +} + +if (! function_exists('old')) { + /** + * Retrieve an old input item. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + function old($key = null, $default = null) + { + return app('request')->old($key, $default); + } +} + +if (! function_exists('policy')) { + /** + * Get a policy instance for a given class. + * + * @param object|string $class + * @return mixed + * + * @throws \InvalidArgumentException + */ + function policy($class) + { + return app(Gate::class)->getPolicyFor($class); + } +} + +if (! function_exists('public_path')) { + /** + * Get the path to the public folder. + * + * @param string $path + * @return string + */ + function public_path($path = '') + { + return app()->make('path.public').($path ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : $path); + } +} + +if (! function_exists('redirect')) { + /** + * Get an instance of the redirector. + * + * @param string|null $to + * @param int $status + * @param array $headers + * @param bool $secure + * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse + */ + function redirect($to = null, $status = 302, $headers = [], $secure = null) + { + if (is_null($to)) { + return app('redirect'); + } + + return app('redirect')->to($to, $status, $headers, $secure); + } +} + +if (! function_exists('report')) { + /** + * Report an exception. + * + * @param \Exception $exception + * @return void + */ + function report($exception) + { + if ($exception instanceof Throwable && + ! $exception instanceof Exception) { + $exception = new FatalThrowableError($exception); + } + + app(ExceptionHandler::class)->report($exception); + } +} + +if (! function_exists('request')) { + /** + * Get an instance of the current request or an input item from the request. + * + * @param array|string $key + * @param mixed $default + * @return \Illuminate\Http\Request|string|array + */ + function request($key = null, $default = null) + { + if (is_null($key)) { + return app('request'); + } + + if (is_array($key)) { + return app('request')->only($key); + } + + $value = app('request')->__get($key); + + return is_null($value) ? value($default) : $value; + } +} + +if (! function_exists('rescue')) { + /** + * Catch a potential exception and return a default value. + * + * @param callable $callback + * @param mixed $rescue + * @return mixed + */ + function rescue(callable $callback, $rescue = null) + { + try { + return $callback(); + } catch (Throwable $e) { + report($e); + + return value($rescue); + } + } +} + +if (! function_exists('resolve')) { + /** + * Resolve a service from the container. + * + * @param string $name + * @return mixed + */ + function resolve($name) + { + return app($name); + } +} + +if (! function_exists('resource_path')) { + /** + * Get the path to the resources folder. + * + * @param string $path + * @return string + */ + function resource_path($path = '') + { + return app()->resourcePath($path); + } +} + +if (! function_exists('response')) { + /** + * Return a new response from the application. + * + * @param \Illuminate\View\View|string|array|null $content + * @param int $status + * @param array $headers + * @return \Illuminate\Http\Response|\Illuminate\Contracts\Routing\ResponseFactory + */ + function response($content = '', $status = 200, array $headers = []) + { + $factory = app(ResponseFactory::class); + + if (func_num_args() === 0) { + return $factory; + } + + return $factory->make($content, $status, $headers); + } +} + +if (! function_exists('route')) { + /** + * Generate the URL to a named route. + * + * @param array|string $name + * @param mixed $parameters + * @param bool $absolute + * @return string + */ + function route($name, $parameters = [], $absolute = true) + { + return app('url')->route($name, $parameters, $absolute); + } +} + +if (! function_exists('secure_asset')) { + /** + * Generate an asset path for the application. + * + * @param string $path + * @return string + */ + function secure_asset($path) + { + return asset($path, true); + } +} + +if (! function_exists('secure_url')) { + /** + * Generate a HTTPS url for the application. + * + * @param string $path + * @param mixed $parameters + * @return string + */ + function secure_url($path, $parameters = []) + { + return url($path, $parameters, true); + } +} + +if (! function_exists('session')) { + /** + * Get / set the specified session value. + * + * If an array is passed as the key, we will assume you want to set an array of values. + * + * @param array|string $key + * @param mixed $default + * @return mixed|\Illuminate\Session\Store|\Illuminate\Session\SessionManager + */ + function session($key = null, $default = null) + { + if (is_null($key)) { + return app('session'); + } + + if (is_array($key)) { + return app('session')->put($key); + } + + return app('session')->get($key, $default); + } +} + +if (! function_exists('storage_path')) { + /** + * Get the path to the storage folder. + * + * @param string $path + * @return string + */ + function storage_path($path = '') + { + return app('path.storage').($path ? DIRECTORY_SEPARATOR.$path : $path); + } +} + +if (! function_exists('today')) { + /** + * Create a new Carbon instance for the current date. + * + * @param \DateTimeZone|string|null $tz + * @return \Illuminate\Support\Carbon + */ + function today($tz = null) + { + return Carbon::today($tz); + } +} + +if (! function_exists('trans')) { + /** + * Translate the given message. + * + * @param string $key + * @param array $replace + * @param string $locale + * @return \Illuminate\Contracts\Translation\Translator|string|array|null + */ + function trans($key = null, $replace = [], $locale = null) + { + if (is_null($key)) { + return app('translator'); + } + + return app('translator')->trans($key, $replace, $locale); + } +} + +if (! function_exists('trans_choice')) { + /** + * Translates the given message based on a count. + * + * @param string $key + * @param int|array|\Countable $number + * @param array $replace + * @param string $locale + * @return string + */ + function trans_choice($key, $number, array $replace = [], $locale = null) + { + return app('translator')->transChoice($key, $number, $replace, $locale); + } +} + +if (! function_exists('__')) { + /** + * Translate the given message. + * + * @param string $key + * @param array $replace + * @param string $locale + * @return string|array|null + */ + function __($key, $replace = [], $locale = null) + { + return app('translator')->getFromJson($key, $replace, $locale); + } +} + +if (! function_exists('url')) { + /** + * Generate a url for the application. + * + * @param string $path + * @param mixed $parameters + * @param bool $secure + * @return \Illuminate\Contracts\Routing\UrlGenerator|string + */ + function url($path = null, $parameters = [], $secure = null) + { + if (is_null($path)) { + return app(UrlGenerator::class); + } + + return app(UrlGenerator::class)->to($path, $parameters, $secure); + } +} + +if (! function_exists('validator')) { + /** + * Create a new Validator instance. + * + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return \Illuminate\Contracts\Validation\Validator|\Illuminate\Contracts\Validation\Factory + */ + function validator(array $data = [], array $rules = [], array $messages = [], array $customAttributes = []) + { + $factory = app(ValidationFactory::class); + + if (func_num_args() === 0) { + return $factory; + } + + return $factory->make($data, $rules, $messages, $customAttributes); + } +} + +if (! function_exists('view')) { + /** + * Get the evaluated view contents for the given view. + * + * @param string $view + * @param array $data + * @param array $mergeData + * @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory + */ + function view($view = null, $data = [], $mergeData = []) + { + $factory = app(ViewFactory::class); + + if (func_num_args() === 0) { + return $factory; + } + + return $factory->make($view, $data, $mergeData); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Foundation/stubs/facade.stub b/vendor/laravel/framework/src/Illuminate/Foundation/stubs/facade.stub new file mode 100644 index 0000000..aadbe74 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Foundation/stubs/facade.stub @@ -0,0 +1,21 @@ +verifyAlgorithm && $this->info($hashedValue)['algoName'] !== 'argon2id') { + throw new RuntimeException('This password does not use the Argon2id algorithm.'); + } + + if (strlen($hashedValue) === 0) { + return false; + } + + return password_verify($value, $hashedValue); + } + + /** + * Get the algorithm that should be used for hashing. + * + * @return int + */ + protected function algorithm() + { + return PASSWORD_ARGON2ID; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Hashing/ArgonHasher.php b/vendor/laravel/framework/src/Illuminate/Hashing/ArgonHasher.php new file mode 100644 index 0000000..66b3930 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Hashing/ArgonHasher.php @@ -0,0 +1,190 @@ +time = $options['time'] ?? $this->time; + $this->memory = $options['memory'] ?? $this->memory; + $this->threads = $options['threads'] ?? $this->threads; + $this->verifyAlgorithm = $options['verify'] ?? $this->verifyAlgorithm; + } + + /** + * Hash the given value. + * + * @param string $value + * @param array $options + * @return string + * + * @throws \RuntimeException + */ + public function make($value, array $options = []) + { + $hash = password_hash($value, $this->algorithm(), [ + 'memory_cost' => $this->memory($options), + 'time_cost' => $this->time($options), + 'threads' => $this->threads($options), + ]); + + if ($hash === false) { + throw new RuntimeException('Argon2 hashing not supported.'); + } + + return $hash; + } + + /** + * Get the algorithm that should be used for hashing. + * + * @return int + */ + protected function algorithm() + { + return PASSWORD_ARGON2I; + } + + /** + * Check the given plain value against a hash. + * + * @param string $value + * @param string $hashedValue + * @param array $options + * @return bool + */ + public function check($value, $hashedValue, array $options = []) + { + if ($this->verifyAlgorithm && $this->info($hashedValue)['algoName'] !== 'argon2i') { + throw new RuntimeException('This password does not use the Argon2i algorithm.'); + } + + return parent::check($value, $hashedValue, $options); + } + + /** + * Check if the given hash has been hashed using the given options. + * + * @param string $hashedValue + * @param array $options + * @return bool + */ + public function needsRehash($hashedValue, array $options = []) + { + return password_needs_rehash($hashedValue, $this->algorithm(), [ + 'memory_cost' => $this->memory($options), + 'time_cost' => $this->time($options), + 'threads' => $this->threads($options), + ]); + } + + /** + * Set the default password memory factor. + * + * @param int $memory + * @return $this + */ + public function setMemory(int $memory) + { + $this->memory = $memory; + + return $this; + } + + /** + * Set the default password timing factor. + * + * @param int $time + * @return $this + */ + public function setTime(int $time) + { + $this->time = $time; + + return $this; + } + + /** + * Set the default password threads factor. + * + * @param int $threads + * @return $this + */ + public function setThreads(int $threads) + { + $this->threads = $threads; + + return $this; + } + + /** + * Extract the memory cost value from the options array. + * + * @param array $options + * @return int + */ + protected function memory(array $options) + { + return $options['memory'] ?? $this->memory; + } + + /** + * Extract the time cost value from the options array. + * + * @param array $options + * @return int + */ + protected function time(array $options) + { + return $options['time'] ?? $this->time; + } + + /** + * Extract the threads value from the options array. + * + * @param array $options + * @return int + */ + protected function threads(array $options) + { + return $options['threads'] ?? $this->threads; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php b/vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php new file mode 100755 index 0000000..c853915 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php @@ -0,0 +1,114 @@ +rounds = $options['rounds'] ?? $this->rounds; + $this->verifyAlgorithm = $options['verify'] ?? $this->verifyAlgorithm; + } + + /** + * Hash the given value. + * + * @param string $value + * @param array $options + * @return string + * + * @throws \RuntimeException + */ + public function make($value, array $options = []) + { + $hash = password_hash($value, PASSWORD_BCRYPT, [ + 'cost' => $this->cost($options), + ]); + + if ($hash === false) { + throw new RuntimeException('Bcrypt hashing not supported.'); + } + + return $hash; + } + + /** + * Check the given plain value against a hash. + * + * @param string $value + * @param string $hashedValue + * @param array $options + * @return bool + * + * @throws \RuntimeException + */ + public function check($value, $hashedValue, array $options = []) + { + if ($this->verifyAlgorithm && $this->info($hashedValue)['algoName'] !== 'bcrypt') { + throw new RuntimeException('This password does not use the Bcrypt algorithm.'); + } + + return parent::check($value, $hashedValue, $options); + } + + /** + * Check if the given hash has been hashed using the given options. + * + * @param string $hashedValue + * @param array $options + * @return bool + */ + public function needsRehash($hashedValue, array $options = []) + { + return password_needs_rehash($hashedValue, PASSWORD_BCRYPT, [ + 'cost' => $this->cost($options), + ]); + } + + /** + * Set the default password work factor. + * + * @param int $rounds + * @return $this + */ + public function setRounds($rounds) + { + $this->rounds = (int) $rounds; + + return $this; + } + + /** + * Extract the cost value from the options array. + * + * @param array $options + * @return int + */ + protected function cost(array $options = []) + { + return $options['rounds'] ?? $this->rounds; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Hashing/HashManager.php b/vendor/laravel/framework/src/Illuminate/Hashing/HashManager.php new file mode 100644 index 0000000..4dbae34 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Hashing/HashManager.php @@ -0,0 +1,97 @@ +app['config']['hashing.bcrypt'] ?? []); + } + + /** + * Create an instance of the Argon2i hash Driver. + * + * @return \Illuminate\Hashing\ArgonHasher + */ + public function createArgonDriver() + { + return new ArgonHasher($this->app['config']['hashing.argon'] ?? []); + } + + /** + * Create an instance of the Argon2id hash Driver. + * + * @return \Illuminate\Hashing\Argon2IdHasher + */ + public function createArgon2idDriver() + { + return new Argon2IdHasher($this->app['config']['hashing.argon'] ?? []); + } + + /** + * Get information about the given hashed value. + * + * @param string $hashedValue + * @return array + */ + public function info($hashedValue) + { + return $this->driver()->info($hashedValue); + } + + /** + * Hash the given value. + * + * @param string $value + * @param array $options + * @return string + */ + public function make($value, array $options = []) + { + return $this->driver()->make($value, $options); + } + + /** + * Check the given plain value against a hash. + * + * @param string $value + * @param string $hashedValue + * @param array $options + * @return bool + */ + public function check($value, $hashedValue, array $options = []) + { + return $this->driver()->check($value, $hashedValue, $options); + } + + /** + * Check if the given hash has been hashed using the given options. + * + * @param string $hashedValue + * @param array $options + * @return bool + */ + public function needsRehash($hashedValue, array $options = []) + { + return $this->driver()->needsRehash($hashedValue, $options); + } + + /** + * Get the default driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['hashing.driver'] ?? 'bcrypt'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php new file mode 100755 index 0000000..435e54b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php @@ -0,0 +1,41 @@ +app->singleton('hash', function ($app) { + return new HashManager($app); + }); + + $this->app->singleton('hash.driver', function ($app) { + return $app['hash']->driver(); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['hash', 'hash.driver']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Hashing/composer.json b/vendor/laravel/framework/src/Illuminate/Hashing/composer.json new file mode 100755 index 0000000..ed9e20e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Hashing/composer.json @@ -0,0 +1,35 @@ +{ + "name": "illuminate/hashing", + "description": "The Illuminate Hashing package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*" + }, + "autoload": { + "psr-4": { + "Illuminate\\Hashing\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php b/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php new file mode 100644 index 0000000..be760a2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php @@ -0,0 +1,171 @@ +header('CONTENT_TYPE'), ['/json', '+json']); + } + + /** + * Determine if the current request probably expects a JSON response. + * + * @return bool + */ + public function expectsJson() + { + return ($this->ajax() && ! $this->pjax() && $this->acceptsAnyContentType()) || $this->wantsJson(); + } + + /** + * Determine if the current request is asking for JSON. + * + * @return bool + */ + public function wantsJson() + { + $acceptable = $this->getAcceptableContentTypes(); + + return isset($acceptable[0]) && Str::contains($acceptable[0], ['/json', '+json']); + } + + /** + * Determines whether the current requests accepts a given content type. + * + * @param string|array $contentTypes + * @return bool + */ + public function accepts($contentTypes) + { + $accepts = $this->getAcceptableContentTypes(); + + if (count($accepts) === 0) { + return true; + } + + $types = (array) $contentTypes; + + foreach ($accepts as $accept) { + if ($accept === '*/*' || $accept === '*') { + return true; + } + + foreach ($types as $type) { + if ($this->matchesType($accept, $type) || $accept === strtok($type, '/').'/*') { + return true; + } + } + } + + return false; + } + + /** + * Return the most suitable content type from the given array based on content negotiation. + * + * @param string|array $contentTypes + * @return string|null + */ + public function prefers($contentTypes) + { + $accepts = $this->getAcceptableContentTypes(); + + $contentTypes = (array) $contentTypes; + + foreach ($accepts as $accept) { + if (in_array($accept, ['*/*', '*'])) { + return $contentTypes[0]; + } + + foreach ($contentTypes as $contentType) { + $type = $contentType; + + if (! is_null($mimeType = $this->getMimeType($contentType))) { + $type = $mimeType; + } + + if ($this->matchesType($type, $accept) || $accept === strtok($type, '/').'/*') { + return $contentType; + } + } + } + } + + /** + * Determine if the current request accepts any content type. + * + * @return bool + */ + public function acceptsAnyContentType() + { + $acceptable = $this->getAcceptableContentTypes(); + + return count($acceptable) === 0 || ( + isset($acceptable[0]) && ($acceptable[0] === '*/*' || $acceptable[0] === '*') + ); + } + + /** + * Determines whether a request accepts JSON. + * + * @return bool + */ + public function acceptsJson() + { + return $this->accepts('application/json'); + } + + /** + * Determines whether a request accepts HTML. + * + * @return bool + */ + public function acceptsHtml() + { + return $this->accepts('text/html'); + } + + /** + * Get the data format expected in the response. + * + * @param string $default + * @return string + */ + public function format($default = 'html') + { + foreach ($this->getAcceptableContentTypes() as $type) { + if ($format = $this->getFormat($type)) { + return $format; + } + } + + return $default; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithFlashData.php b/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithFlashData.php new file mode 100644 index 0000000..221d938 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithFlashData.php @@ -0,0 +1,64 @@ +hasSession() ? $this->session()->getOldInput($key, $default) : $default; + } + + /** + * Flash the input for the current request to the session. + * + * @return void + */ + public function flash() + { + $this->session()->flashInput($this->input()); + } + + /** + * Flash only some of the input to the session. + * + * @param array|mixed $keys + * @return void + */ + public function flashOnly($keys) + { + $this->session()->flashInput( + $this->only(is_array($keys) ? $keys : func_get_args()) + ); + } + + /** + * Flash only some of the input to the session. + * + * @param array|mixed $keys + * @return void + */ + public function flashExcept($keys) + { + $this->session()->flashInput( + $this->except(is_array($keys) ? $keys : func_get_args()) + ); + } + + /** + * Flush all of the old input from the session. + * + * @return void + */ + public function flush() + { + $this->session()->flashInput([]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithInput.php b/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithInput.php new file mode 100644 index 0000000..101ca9d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithInput.php @@ -0,0 +1,396 @@ +retrieveItem('server', $key, $default); + } + + /** + * Determine if a header is set on the request. + * + * @param string $key + * @return bool + */ + public function hasHeader($key) + { + return ! is_null($this->header($key)); + } + + /** + * Retrieve a header from the request. + * + * @param string $key + * @param string|array|null $default + * @return string|array|null + */ + public function header($key = null, $default = null) + { + return $this->retrieveItem('headers', $key, $default); + } + + /** + * Get the bearer token from the request headers. + * + * @return string|null + */ + public function bearerToken() + { + $header = $this->header('Authorization', ''); + + if (Str::startsWith($header, 'Bearer ')) { + return Str::substr($header, 7); + } + } + + /** + * Determine if the request contains a given input item key. + * + * @param string|array $key + * @return bool + */ + public function exists($key) + { + return $this->has($key); + } + + /** + * Determine if the request contains a given input item key. + * + * @param string|array $key + * @return bool + */ + public function has($key) + { + $keys = is_array($key) ? $key : func_get_args(); + + $input = $this->all(); + + foreach ($keys as $value) { + if (! Arr::has($input, $value)) { + return false; + } + } + + return true; + } + + /** + * Determine if the request contains any of the given inputs. + * + * @param string|array $keys + * @return bool + */ + public function hasAny($keys) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + $input = $this->all(); + + foreach ($keys as $key) { + if (Arr::has($input, $key)) { + return true; + } + } + + return false; + } + + /** + * Determine if the request contains a non-empty value for an input item. + * + * @param string|array $key + * @return bool + */ + public function filled($key) + { + $keys = is_array($key) ? $key : func_get_args(); + + foreach ($keys as $value) { + if ($this->isEmptyString($value)) { + return false; + } + } + + return true; + } + + /** + * Determine if the request contains a non-empty value for any of the given inputs. + * + * @param string|array $keys + * @return bool + */ + public function anyFilled($keys) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + foreach ($keys as $key) { + if ($this->filled($key)) { + return true; + } + } + + return false; + } + + /** + * Determine if the given input key is an empty string for "has". + * + * @param string $key + * @return bool + */ + protected function isEmptyString($key) + { + $value = $this->input($key); + + return ! is_bool($value) && ! is_array($value) && trim((string) $value) === ''; + } + + /** + * Get the keys for all of the input and files. + * + * @return array + */ + public function keys() + { + return array_merge(array_keys($this->input()), $this->files->keys()); + } + + /** + * Get all of the input and files for the request. + * + * @param array|mixed $keys + * @return array + */ + public function all($keys = null) + { + $input = array_replace_recursive($this->input(), $this->allFiles()); + + if (! $keys) { + return $input; + } + + $results = []; + + foreach (is_array($keys) ? $keys : func_get_args() as $key) { + Arr::set($results, $key, Arr::get($input, $key)); + } + + return $results; + } + + /** + * Retrieve an input item from the request. + * + * @param string|null $key + * @param string|array|null $default + * @return string|array|null + */ + public function input($key = null, $default = null) + { + return data_get( + $this->getInputSource()->all() + $this->query->all(), $key, $default + ); + } + + /** + * Get a subset containing the provided keys with values from the input data. + * + * @param array|mixed $keys + * @return array + */ + public function only($keys) + { + $results = []; + + $input = $this->all(); + + $placeholder = new stdClass; + + foreach (is_array($keys) ? $keys : func_get_args() as $key) { + $value = data_get($input, $key, $placeholder); + + if ($value !== $placeholder) { + Arr::set($results, $key, $value); + } + } + + return $results; + } + + /** + * Get all of the input except for a specified array of items. + * + * @param array|mixed $keys + * @return array + */ + public function except($keys) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + $results = $this->all(); + + Arr::forget($results, $keys); + + return $results; + } + + /** + * Retrieve a query string item from the request. + * + * @param string $key + * @param string|array|null $default + * @return string|array|null + */ + public function query($key = null, $default = null) + { + return $this->retrieveItem('query', $key, $default); + } + + /** + * Retrieve a request payload item from the request. + * + * @param string $key + * @param string|array|null $default + * + * @return string|array|null + */ + public function post($key = null, $default = null) + { + return $this->retrieveItem('request', $key, $default); + } + + /** + * Determine if a cookie is set on the request. + * + * @param string $key + * @return bool + */ + public function hasCookie($key) + { + return ! is_null($this->cookie($key)); + } + + /** + * Retrieve a cookie from the request. + * + * @param string $key + * @param string|array|null $default + * @return string|array|null + */ + public function cookie($key = null, $default = null) + { + return $this->retrieveItem('cookies', $key, $default); + } + + /** + * Get an array of all of the files on the request. + * + * @return array + */ + public function allFiles() + { + $files = $this->files->all(); + + return $this->convertedFiles + ? $this->convertedFiles + : $this->convertedFiles = $this->convertUploadedFiles($files); + } + + /** + * Convert the given array of Symfony UploadedFiles to custom Laravel UploadedFiles. + * + * @param array $files + * @return array + */ + protected function convertUploadedFiles(array $files) + { + return array_map(function ($file) { + if (is_null($file) || (is_array($file) && empty(array_filter($file)))) { + return $file; + } + + return is_array($file) + ? $this->convertUploadedFiles($file) + : UploadedFile::createFromBase($file); + }, $files); + } + + /** + * Determine if the uploaded data contains a file. + * + * @param string $key + * @return bool + */ + public function hasFile($key) + { + if (! is_array($files = $this->file($key))) { + $files = [$files]; + } + + foreach ($files as $file) { + if ($this->isValidFile($file)) { + return true; + } + } + + return false; + } + + /** + * Check that the given file is a valid file instance. + * + * @param mixed $file + * @return bool + */ + protected function isValidFile($file) + { + return $file instanceof SplFileInfo && $file->getPath() !== ''; + } + + /** + * Retrieve a file from the request. + * + * @param string $key + * @param mixed $default + * @return \Illuminate\Http\UploadedFile|array|null + */ + public function file($key = null, $default = null) + { + return data_get($this->allFiles(), $key, $default); + } + + /** + * Retrieve a parameter item from a given source. + * + * @param string $source + * @param string $key + * @param string|array|null $default + * @return string|array|null + */ + protected function retrieveItem($source, $key, $default) + { + if (is_null($key)) { + return $this->$source->all(); + } + + return $this->$source->get($key, $default); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Exceptions/HttpResponseException.php b/vendor/laravel/framework/src/Illuminate/Http/Exceptions/HttpResponseException.php new file mode 100644 index 0000000..b27052f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Exceptions/HttpResponseException.php @@ -0,0 +1,37 @@ +response = $response; + } + + /** + * Get the underlying response instance. + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function getResponse() + { + return $this->response; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Exceptions/PostTooLargeException.php b/vendor/laravel/framework/src/Illuminate/Http/Exceptions/PostTooLargeException.php new file mode 100644 index 0000000..640b8ec --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Exceptions/PostTooLargeException.php @@ -0,0 +1,23 @@ +getRealPath(); + } + + /** + * Get the file's extension. + * + * @return string + */ + public function extension() + { + return $this->guessExtension(); + } + + /** + * Get the file's extension supplied by the client. + * + * @return string + */ + public function clientExtension() + { + return $this->guessClientExtension(); + } + + /** + * Get a filename for the file. + * + * @param string $path + * @return string + */ + public function hashName($path = null) + { + if ($path) { + $path = rtrim($path, '/').'/'; + } + + $hash = $this->hashName ?: $this->hashName = Str::random(40); + + if ($extension = $this->guessExtension()) { + $extension = '.'.$extension; + } + + return $path.$hash.$extension; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php b/vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php new file mode 100755 index 0000000..9baf417 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/JsonResponse.php @@ -0,0 +1,121 @@ +encodingOptions = $options; + + parent::__construct($data, $status, $headers); + } + + /** + * Sets the JSONP callback. + * + * @param string|null $callback + * @return $this + */ + public function withCallback($callback = null) + { + return $this->setCallback($callback); + } + + /** + * Get the json_decoded data from the response. + * + * @param bool $assoc + * @param int $depth + * @return mixed + */ + public function getData($assoc = false, $depth = 512) + { + return json_decode($this->data, $assoc, $depth); + } + + /** + * {@inheritdoc} + */ + public function setData($data = []) + { + $this->original = $data; + + if ($data instanceof Jsonable) { + $this->data = $data->toJson($this->encodingOptions); + } elseif ($data instanceof JsonSerializable) { + $this->data = json_encode($data->jsonSerialize(), $this->encodingOptions); + } elseif ($data instanceof Arrayable) { + $this->data = json_encode($data->toArray(), $this->encodingOptions); + } else { + $this->data = json_encode($data, $this->encodingOptions); + } + + if (! $this->hasValidJson(json_last_error())) { + throw new InvalidArgumentException(json_last_error_msg()); + } + + return $this->update(); + } + + /** + * Determine if an error occurred during JSON encoding. + * + * @param int $jsonError + * @return bool + */ + protected function hasValidJson($jsonError) + { + if ($jsonError === JSON_ERROR_NONE) { + return true; + } + + return $this->hasEncodingOption(JSON_PARTIAL_OUTPUT_ON_ERROR) && + in_array($jsonError, [ + JSON_ERROR_RECURSION, + JSON_ERROR_INF_OR_NAN, + JSON_ERROR_UNSUPPORTED_TYPE, + ]); + } + + /** + * {@inheritdoc} + */ + public function setEncodingOptions($options) + { + $this->encodingOptions = (int) $options; + + return $this->setData($this->getData()); + } + + /** + * Determine if a JSON encoding option is set. + * + * @param int $option + * @return bool + */ + public function hasEncodingOption($option) + { + return (bool) ($this->encodingOptions & $option); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Middleware/CheckResponseForModifications.php b/vendor/laravel/framework/src/Illuminate/Http/Middleware/CheckResponseForModifications.php new file mode 100644 index 0000000..2a93e21 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Middleware/CheckResponseForModifications.php @@ -0,0 +1,27 @@ +isNotModified($request); + } + + return $response; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php b/vendor/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php new file mode 100644 index 0000000..66edce4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php @@ -0,0 +1,24 @@ +headers->set('X-Frame-Options', 'SAMEORIGIN', false); + + return $response; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Middleware/SetCacheHeaders.php b/vendor/laravel/framework/src/Illuminate/Http/Middleware/SetCacheHeaders.php new file mode 100644 index 0000000..fe04fe6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Middleware/SetCacheHeaders.php @@ -0,0 +1,55 @@ +isMethodCacheable() || ! $response->getContent()) { + return $response; + } + + if (is_string($options)) { + $options = $this->parseOptions($options); + } + + if (isset($options['etag']) && $options['etag'] === true) { + $options['etag'] = md5($response->getContent()); + } + + $response->setCache($options); + $response->isNotModified($request); + + return $response; + } + + /** + * Parse the given header options. + * + * @param string $options + * @return array + */ + protected function parseOptions($options) + { + return collect(explode(';', $options))->mapWithKeys(function ($option) { + $data = explode('=', $option, 2); + + return [$data[0] => $data[1] ?? true]; + })->all(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/RedirectResponse.php b/vendor/laravel/framework/src/Illuminate/Http/RedirectResponse.php new file mode 100755 index 0000000..1fcfe94 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/RedirectResponse.php @@ -0,0 +1,236 @@ + $value]; + + foreach ($key as $k => $v) { + $this->session->flash($k, $v); + } + + return $this; + } + + /** + * Add multiple cookies to the response. + * + * @param array $cookies + * @return $this + */ + public function withCookies(array $cookies) + { + foreach ($cookies as $cookie) { + $this->headers->setCookie($cookie); + } + + return $this; + } + + /** + * Flash an array of input to the session. + * + * @param array $input + * @return $this + */ + public function withInput(array $input = null) + { + $this->session->flashInput($this->removeFilesFromInput( + ! is_null($input) ? $input : $this->request->input() + )); + + return $this; + } + + /** + * Remove all uploaded files form the given input array. + * + * @param array $input + * @return array + */ + protected function removeFilesFromInput(array $input) + { + foreach ($input as $key => $value) { + if (is_array($value)) { + $input[$key] = $this->removeFilesFromInput($value); + } + + if ($value instanceof SymfonyUploadedFile) { + unset($input[$key]); + } + } + + return $input; + } + + /** + * Flash an array of input to the session. + * + * @return $this + */ + public function onlyInput() + { + return $this->withInput($this->request->only(func_get_args())); + } + + /** + * Flash an array of input to the session. + * + * @return \Illuminate\Http\RedirectResponse + */ + public function exceptInput() + { + return $this->withInput($this->request->except(func_get_args())); + } + + /** + * Flash a container of errors to the session. + * + * @param \Illuminate\Contracts\Support\MessageProvider|array|string $provider + * @param string $key + * @return $this + */ + public function withErrors($provider, $key = 'default') + { + $value = $this->parseErrors($provider); + + $errors = $this->session->get('errors', new ViewErrorBag); + + if (! $errors instanceof ViewErrorBag) { + $errors = new ViewErrorBag; + } + + $this->session->flash( + 'errors', $errors->put($key, $value) + ); + + return $this; + } + + /** + * Parse the given errors into an appropriate value. + * + * @param \Illuminate\Contracts\Support\MessageProvider|array|string $provider + * @return \Illuminate\Support\MessageBag + */ + protected function parseErrors($provider) + { + if ($provider instanceof MessageProvider) { + return $provider->getMessageBag(); + } + + return new MessageBag((array) $provider); + } + + /** + * Get the original response content. + * + * @return null + */ + public function getOriginalContent() + { + // + } + + /** + * Get the request instance. + * + * @return \Illuminate\Http\Request|null + */ + public function getRequest() + { + return $this->request; + } + + /** + * Set the request instance. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + public function setRequest(Request $request) + { + $this->request = $request; + } + + /** + * Get the session store instance. + * + * @return \Illuminate\Session\Store|null + */ + public function getSession() + { + return $this->session; + } + + /** + * Set the session store instance. + * + * @param \Illuminate\Session\Store $session + * @return void + */ + public function setSession(SessionStore $session) + { + $this->session = $session; + } + + /** + * Dynamically bind flash data in the session. + * + * @param string $method + * @param array $parameters + * @return $this + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + if (Str::startsWith($method, 'with')) { + return $this->with(Str::snake(substr($method, 4)), $parameters[0]); + } + + static::throwBadMethodCallException($method); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Request.php b/vendor/laravel/framework/src/Illuminate/Http/Request.php new file mode 100644 index 0000000..409d65f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Request.php @@ -0,0 +1,686 @@ +getMethod(); + } + + /** + * Get the root URL for the application. + * + * @return string + */ + public function root() + { + return rtrim($this->getSchemeAndHttpHost().$this->getBaseUrl(), '/'); + } + + /** + * Get the URL (no query string) for the request. + * + * @return string + */ + public function url() + { + return rtrim(preg_replace('/\?.*/', '', $this->getUri()), '/'); + } + + /** + * Get the full URL for the request. + * + * @return string + */ + public function fullUrl() + { + $query = $this->getQueryString(); + + $question = $this->getBaseUrl().$this->getPathInfo() === '/' ? '/?' : '?'; + + return $query ? $this->url().$question.$query : $this->url(); + } + + /** + * Get the full URL for the request with the added query string parameters. + * + * @param array $query + * @return string + */ + public function fullUrlWithQuery(array $query) + { + $question = $this->getBaseUrl().$this->getPathInfo() === '/' ? '/?' : '?'; + + return count($this->query()) > 0 + ? $this->url().$question.Arr::query(array_merge($this->query(), $query)) + : $this->fullUrl().$question.Arr::query($query); + } + + /** + * Get the current path info for the request. + * + * @return string + */ + public function path() + { + $pattern = trim($this->getPathInfo(), '/'); + + return $pattern == '' ? '/' : $pattern; + } + + /** + * Get the current decoded path info for the request. + * + * @return string + */ + public function decodedPath() + { + return rawurldecode($this->path()); + } + + /** + * Get a segment from the URI (1 based index). + * + * @param int $index + * @param string|null $default + * @return string|null + */ + public function segment($index, $default = null) + { + return Arr::get($this->segments(), $index - 1, $default); + } + + /** + * Get all of the segments for the request path. + * + * @return array + */ + public function segments() + { + $segments = explode('/', $this->decodedPath()); + + return array_values(array_filter($segments, function ($value) { + return $value !== ''; + })); + } + + /** + * Determine if the current request URI matches a pattern. + * + * @param mixed ...$patterns + * @return bool + */ + public function is(...$patterns) + { + foreach ($patterns as $pattern) { + if (Str::is($pattern, $this->decodedPath())) { + return true; + } + } + + return false; + } + + /** + * Determine if the route name matches a given pattern. + * + * @param mixed ...$patterns + * @return bool + */ + public function routeIs(...$patterns) + { + return $this->route() && $this->route()->named(...$patterns); + } + + /** + * Determine if the current request URL and query string matches a pattern. + * + * @param mixed ...$patterns + * @return bool + */ + public function fullUrlIs(...$patterns) + { + $url = $this->fullUrl(); + + foreach ($patterns as $pattern) { + if (Str::is($pattern, $url)) { + return true; + } + } + + return false; + } + + /** + * Determine if the request is the result of an AJAX call. + * + * @return bool + */ + public function ajax() + { + return $this->isXmlHttpRequest(); + } + + /** + * Determine if the request is the result of an PJAX call. + * + * @return bool + */ + public function pjax() + { + return $this->headers->get('X-PJAX') == true; + } + + /** + * Determine if the request is over HTTPS. + * + * @return bool + */ + public function secure() + { + return $this->isSecure(); + } + + /** + * Get the client IP address. + * + * @return string + */ + public function ip() + { + return $this->getClientIp(); + } + + /** + * Get the client IP addresses. + * + * @return array + */ + public function ips() + { + return $this->getClientIps(); + } + + /** + * Get the client user agent. + * + * @return string + */ + public function userAgent() + { + return $this->headers->get('User-Agent'); + } + + /** + * Merge new input into the current request's input array. + * + * @param array $input + * @return \Illuminate\Http\Request + */ + public function merge(array $input) + { + $this->getInputSource()->add($input); + + return $this; + } + + /** + * Replace the input for the current request. + * + * @param array $input + * @return \Illuminate\Http\Request + */ + public function replace(array $input) + { + $this->getInputSource()->replace($input); + + return $this; + } + + /** + * This method belongs to Symfony HttpFoundation and is not usually needed when using Laravel. + * + * Instead, you may use the "input" method. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + return parent::get($key, $default); + } + + /** + * Get the JSON payload for the request. + * + * @param string $key + * @param mixed $default + * @return \Symfony\Component\HttpFoundation\ParameterBag|mixed + */ + public function json($key = null, $default = null) + { + if (! isset($this->json)) { + $this->json = new ParameterBag((array) json_decode($this->getContent(), true)); + } + + if (is_null($key)) { + return $this->json; + } + + return data_get($this->json->all(), $key, $default); + } + + /** + * Get the input source for the request. + * + * @return \Symfony\Component\HttpFoundation\ParameterBag + */ + protected function getInputSource() + { + if ($this->isJson()) { + return $this->json(); + } + + return in_array($this->getRealMethod(), ['GET', 'HEAD']) ? $this->query : $this->request; + } + + /** + * Create a new request instance from the given Laravel request. + * + * @param \Illuminate\Http\Request $from + * @param \Illuminate\Http\Request|null $to + * @return static + */ + public static function createFrom(self $from, $to = null) + { + $request = $to ?: new static; + + $files = $from->files->all(); + + $files = is_array($files) ? array_filter($files) : $files; + + $request->initialize( + $from->query->all(), + $from->request->all(), + $from->attributes->all(), + $from->cookies->all(), + $files, + $from->server->all(), + $from->getContent() + ); + + $request->setJson($from->json()); + + if ($session = $from->getSession()) { + $request->setLaravelSession($session); + } + + $request->setUserResolver($from->getUserResolver()); + + $request->setRouteResolver($from->getRouteResolver()); + + return $request; + } + + /** + * Create an Illuminate request from a Symfony instance. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return \Illuminate\Http\Request + */ + public static function createFromBase(SymfonyRequest $request) + { + if ($request instanceof static) { + return $request; + } + + $content = $request->content; + + $request = (new static)->duplicate( + $request->query->all(), $request->request->all(), $request->attributes->all(), + $request->cookies->all(), $request->files->all(), $request->server->all() + ); + + $request->content = $content; + + $request->request = $request->getInputSource(); + + return $request; + } + + /** + * {@inheritdoc} + */ + public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null) + { + return parent::duplicate($query, $request, $attributes, $cookies, $this->filterFiles($files), $server); + } + + /** + * Filter the given array of files, removing any empty values. + * + * @param mixed $files + * @return mixed + */ + protected function filterFiles($files) + { + if (! $files) { + return; + } + + foreach ($files as $key => $file) { + if (is_array($file)) { + $files[$key] = $this->filterFiles($files[$key]); + } + + if (empty($files[$key])) { + unset($files[$key]); + } + } + + return $files; + } + + /** + * Get the session associated with the request. + * + * @return \Illuminate\Session\Store + * + * @throws \RuntimeException + */ + public function session() + { + if (! $this->hasSession()) { + throw new RuntimeException('Session store not set on request.'); + } + + return $this->session; + } + + /** + * Get the session associated with the request. + * + * @return \Illuminate\Session\Store|null + */ + public function getSession() + { + return $this->session; + } + + /** + * Set the session instance on the request. + * + * @param \Illuminate\Contracts\Session\Session $session + * @return void + */ + public function setLaravelSession($session) + { + $this->session = $session; + } + + /** + * Get the user making the request. + * + * @param string|null $guard + * @return mixed + */ + public function user($guard = null) + { + return call_user_func($this->getUserResolver(), $guard); + } + + /** + * Get the route handling the request. + * + * @param string|null $param + * @param mixed $default + * @return \Illuminate\Routing\Route|object|string + */ + public function route($param = null, $default = null) + { + $route = call_user_func($this->getRouteResolver()); + + if (is_null($route) || is_null($param)) { + return $route; + } + + return $route->parameter($param, $default); + } + + /** + * Get a unique fingerprint for the request / route / IP address. + * + * @return string + * + * @throws \RuntimeException + */ + public function fingerprint() + { + if (! $route = $this->route()) { + throw new RuntimeException('Unable to generate fingerprint. Route unavailable.'); + } + + return sha1(implode('|', array_merge( + $route->methods(), + [$route->getDomain(), $route->uri(), $this->ip()] + ))); + } + + /** + * Set the JSON payload for the request. + * + * @param \Symfony\Component\HttpFoundation\ParameterBag $json + * @return $this + */ + public function setJson($json) + { + $this->json = $json; + + return $this; + } + + /** + * Get the user resolver callback. + * + * @return \Closure + */ + public function getUserResolver() + { + return $this->userResolver ?: function () { + // + }; + } + + /** + * Set the user resolver callback. + * + * @param \Closure $callback + * @return $this + */ + public function setUserResolver(Closure $callback) + { + $this->userResolver = $callback; + + return $this; + } + + /** + * Get the route resolver callback. + * + * @return \Closure + */ + public function getRouteResolver() + { + return $this->routeResolver ?: function () { + // + }; + } + + /** + * Set the route resolver callback. + * + * @param \Closure $callback + * @return $this + */ + public function setRouteResolver(Closure $callback) + { + $this->routeResolver = $callback; + + return $this; + } + + /** + * Get all of the input and files for the request. + * + * @return array + */ + public function toArray() + { + return $this->all(); + } + + /** + * Determine if the given offset exists. + * + * @param string $offset + * @return bool + */ + public function offsetExists($offset) + { + return Arr::has( + $this->all() + $this->route()->parameters(), + $offset + ); + } + + /** + * Get the value at the given offset. + * + * @param string $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->__get($offset); + } + + /** + * Set the value at the given offset. + * + * @param string $offset + * @param mixed $value + * @return void + */ + public function offsetSet($offset, $value) + { + $this->getInputSource()->set($offset, $value); + } + + /** + * Remove the value at the given offset. + * + * @param string $offset + * @return void + */ + public function offsetUnset($offset) + { + $this->getInputSource()->remove($offset); + } + + /** + * Check if an input element is set on the request. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return ! is_null($this->__get($key)); + } + + /** + * Get an input element from the request. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return Arr::get($this->all(), $key, function () use ($key) { + return $this->route($key); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/CollectsResources.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/CollectsResources.php new file mode 100644 index 0000000..66e6a8b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/CollectsResources.php @@ -0,0 +1,59 @@ +collects(); + + $this->collection = $collects && ! $resource->first() instanceof $collects + ? $resource->mapInto($collects) + : $resource->toBase(); + + return $resource instanceof AbstractPaginator + ? $resource->setCollection($this->collection) + : $this->collection; + } + + /** + * Get the resource that this resource collects. + * + * @return string|null + */ + protected function collects() + { + if ($this->collects) { + return $this->collects; + } + + if (Str::endsWith(class_basename($this), 'Collection') && + class_exists($class = Str::replaceLast('Collection', '', get_class($this)))) { + return $class; + } + } + + /** + * Get an iterator for the resource collection. + * + * @return \ArrayIterator + */ + public function getIterator() + { + return $this->collection->getIterator(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php new file mode 100644 index 0000000..4315fad --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php @@ -0,0 +1,219 @@ + $value) { + $index++; + + if (is_array($value)) { + $data[$key] = $this->filter($value); + + continue; + } + + if (is_numeric($key) && $value instanceof MergeValue) { + return $this->mergeData($data, $index, $this->filter($value->data), $numericKeys); + } + + if ($value instanceof self && is_null($value->resource)) { + $data[$key] = null; + } + } + + return $this->removeMissingValues($data, $numericKeys); + } + + /** + * Merge the given data in at the given index. + * + * @param array $data + * @param int $index + * @param array $merge + * @param bool $numericKeys + * @return array + */ + protected function mergeData($data, $index, $merge, $numericKeys) + { + if ($numericKeys) { + return $this->removeMissingValues(array_merge( + array_merge(array_slice($data, 0, $index, true), $merge), + $this->filter(array_values(array_slice($data, $index + 1, null, true))) + ), $numericKeys); + } + + return $this->removeMissingValues(array_slice($data, 0, $index, true) + + $merge + + $this->filter(array_slice($data, $index + 1, null, true))); + } + + /** + * Remove the missing values from the filtered data. + * + * @param array $data + * @param bool $numericKeys + * @return array + */ + protected function removeMissingValues($data, $numericKeys = false) + { + foreach ($data as $key => $value) { + if (($value instanceof PotentiallyMissing && $value->isMissing()) || + ($value instanceof self && + $value->resource instanceof PotentiallyMissing && + $value->isMissing())) { + unset($data[$key]); + } + } + + return ! empty($data) && is_numeric(array_keys($data)[0]) + ? array_values($data) : $data; + } + + /** + * Retrieve a value based on a given condition. + * + * @param bool $condition + * @param mixed $value + * @param mixed $default + * @return \Illuminate\Http\Resources\MissingValue|mixed + */ + protected function when($condition, $value, $default = null) + { + if ($condition) { + return value($value); + } + + return func_num_args() === 3 ? value($default) : new MissingValue; + } + + /** + * Merge a value into the array. + * + * @param mixed $value + * @return \Illuminate\Http\Resources\MergeValue|mixed + */ + protected function merge($value) + { + return $this->mergeWhen(true, $value); + } + + /** + * Merge a value based on a given condition. + * + * @param bool $condition + * @param mixed $value + * @return \Illuminate\Http\Resources\MergeValue|mixed + */ + protected function mergeWhen($condition, $value) + { + return $condition ? new MergeValue(value($value)) : new MissingValue; + } + + /** + * Merge the given attributes. + * + * @param array $attributes + * @return \Illuminate\Http\Resources\MergeValue + */ + protected function attributes($attributes) + { + return new MergeValue( + Arr::only($this->resource->toArray(), $attributes) + ); + } + + /** + * Retrieve a relationship if it has been loaded. + * + * @param string $relationship + * @param mixed $value + * @param mixed $default + * @return \Illuminate\Http\Resources\MissingValue|mixed + */ + protected function whenLoaded($relationship, $value = null, $default = null) + { + if (func_num_args() < 3) { + $default = new MissingValue; + } + + if (! $this->resource->relationLoaded($relationship)) { + return value($default); + } + + if (func_num_args() === 1) { + return $this->resource->{$relationship}; + } + + if ($this->resource->{$relationship} === null) { + return null; + } + + return value($value); + } + + /** + * Execute a callback if the given pivot table has been loaded. + * + * @param string $table + * @param mixed $value + * @param mixed $default + * @return \Illuminate\Http\Resources\MissingValue|mixed + */ + protected function whenPivotLoaded($table, $value, $default = null) + { + return $this->whenPivotLoadedAs('pivot', ...func_get_args()); + } + + /** + * Execute a callback if the given pivot table with a custom accessor has been loaded. + * + * @param string $accessor + * @param string $table + * @param mixed $value + * @param mixed $default + * @return \Illuminate\Http\Resources\MissingValue|mixed + */ + protected function whenPivotLoadedAs($accessor, $table, $value, $default = null) + { + if (func_num_args() === 3) { + $default = new MissingValue; + } + + return $this->when( + $this->resource->$accessor && + ($this->resource->$accessor instanceof $table || + $this->resource->$accessor->getTable() === $table), + ...[$value, $default] + ); + } + + /** + * Transform the given value if it is present. + * + * @param mixed $value + * @param callable $callback + * @param mixed $default + * @return mixed + */ + protected function transform($value, callable $callback, $default = null) + { + return transform( + $value, $callback, func_num_args() === 3 ? $default : new MissingValue + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/DelegatesToResource.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/DelegatesToResource.php new file mode 100644 index 0000000..04fd437 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/DelegatesToResource.php @@ -0,0 +1,134 @@ +resource->getRouteKey(); + } + + /** + * Get the route key for the resource. + * + * @return string + */ + public function getRouteKeyName() + { + return $this->resource->getRouteKeyName(); + } + + /** + * Retrieve the model for a bound value. + * + * @param mixed $value + * @return void + * + * @throws \Exception + */ + public function resolveRouteBinding($value) + { + throw new Exception('Resources may not be implicitly resolved from route bindings.'); + } + + /** + * Determine if the given attribute exists. + * + * @param mixed $offset + * @return bool + */ + public function offsetExists($offset) + { + return array_key_exists($offset, $this->resource); + } + + /** + * Get the value for a given offset. + * + * @param mixed $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->resource[$offset]; + } + + /** + * Set the value for a given offset. + * + * @param mixed $offset + * @param mixed $value + * @return void + */ + public function offsetSet($offset, $value) + { + $this->resource[$offset] = $value; + } + + /** + * Unset the value for a given offset. + * + * @param mixed $offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->resource[$offset]); + } + + /** + * Determine if an attribute exists on the resource. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return isset($this->resource->{$key}); + } + + /** + * Unset an attribute on the resource. + * + * @param string $key + * @return void + */ + public function __unset($key) + { + unset($this->resource->{$key}); + } + + /** + * Dynamically get properties from the underlying resource. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->resource->{$key}; + } + + /** + * Dynamically pass method calls to the underlying resource. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->forwardCallTo($this->resource, $method, $parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/AnonymousResourceCollection.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/AnonymousResourceCollection.php new file mode 100644 index 0000000..a583136 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/AnonymousResourceCollection.php @@ -0,0 +1,27 @@ +collects = $collects; + + parent::__construct($resource); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/JsonResource.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/JsonResource.php new file mode 100644 index 0000000..9e81516 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/JsonResource.php @@ -0,0 +1,209 @@ +resource = $resource; + } + + /** + * Create a new resource instance. + * + * @param mixed ...$parameters + * @return static + */ + public static function make(...$parameters) + { + return new static(...$parameters); + } + + /** + * Create new anonymous resource collection. + * + * @param mixed $resource + * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection + */ + public static function collection($resource) + { + return new AnonymousResourceCollection($resource, get_called_class()); + } + + /** + * Resolve the resource to an array. + * + * @param \Illuminate\Http\Request|null $request + * @return array + */ + public function resolve($request = null) + { + $data = $this->toArray( + $request = $request ?: Container::getInstance()->make('request') + ); + + if ($data instanceof Arrayable) { + $data = $data->toArray(); + } elseif ($data instanceof JsonSerializable) { + $data = $data->jsonSerialize(); + } + + return $this->filter((array) $data); + } + + /** + * Transform the resource into an array. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function toArray($request) + { + if (is_null($this->resource)) { + return []; + } + + return is_array($this->resource) + ? $this->resource + : $this->resource->toArray(); + } + + /** + * Get any additional data that should be returned with the resource array. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function with($request) + { + return $this->with; + } + + /** + * Add additional meta data to the resource response. + * + * @param array $data + * @return $this + */ + public function additional(array $data) + { + $this->additional = $data; + + return $this; + } + + /** + * Customize the response for a request. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\JsonResponse $response + * @return void + */ + public function withResponse($request, $response) + { + // + } + + /** + * Set the string that should wrap the outer-most resource array. + * + * @param string $value + * @return void + */ + public static function wrap($value) + { + static::$wrap = $value; + } + + /** + * Disable wrapping of the outer-most resource array. + * + * @return void + */ + public static function withoutWrapping() + { + static::$wrap = null; + } + + /** + * Transform the resource into an HTTP response. + * + * @param \Illuminate\Http\Request|null $request + * @return \Illuminate\Http\JsonResponse + */ + public function response($request = null) + { + return $this->toResponse( + $request ?: Container::getInstance()->make('request') + ); + } + + /** + * Create an HTTP response that represents the object. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\JsonResponse + */ + public function toResponse($request) + { + return (new ResourceResponse($this))->toResponse($request); + } + + /** + * Prepare the resource for JSON serialization. + * + * @return array + */ + public function jsonSerialize() + { + return $this->resolve(Container::getInstance()->make('request')); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/PaginatedResourceResponse.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/PaginatedResourceResponse.php new file mode 100644 index 0000000..596a4cb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/PaginatedResourceResponse.php @@ -0,0 +1,82 @@ +json( + $this->wrap( + $this->resource->resolve($request), + array_merge_recursive( + $this->paginationInformation($request), + $this->resource->with($request), + $this->resource->additional + ) + ), + $this->calculateStatus() + ), function ($response) use ($request) { + $response->original = $this->resource->resource->pluck('resource'); + + $this->resource->withResponse($request, $response); + }); + } + + /** + * Add the pagination information to the response. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function paginationInformation($request) + { + $paginated = $this->resource->resource->toArray(); + + return [ + 'links' => $this->paginationLinks($paginated), + 'meta' => $this->meta($paginated), + ]; + } + + /** + * Get the pagination links for the response. + * + * @param array $paginated + * @return array + */ + protected function paginationLinks($paginated) + { + return [ + 'first' => $paginated['first_page_url'] ?? null, + 'last' => $paginated['last_page_url'] ?? null, + 'prev' => $paginated['prev_page_url'] ?? null, + 'next' => $paginated['next_page_url'] ?? null, + ]; + } + + /** + * Gather the meta data for the response. + * + * @param array $paginated + * @return array + */ + protected function meta($paginated) + { + return Arr::except($paginated, [ + 'data', + 'first_page_url', + 'last_page_url', + 'prev_page_url', + 'next_page_url', + ]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/Resource.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/Resource.php new file mode 100644 index 0000000..49f6744 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/Resource.php @@ -0,0 +1,8 @@ +resource = $this->collectResource($resource); + } + + /** + * Return the count of items in the resource collection. + * + * @return int + */ + public function count() + { + return $this->collection->count(); + } + + /** + * Transform the resource into a JSON array. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function toArray($request) + { + return $this->collection->map->toArray($request)->all(); + } + + /** + * Create an HTTP response that represents the object. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\JsonResponse + */ + public function toResponse($request) + { + return $this->resource instanceof AbstractPaginator + ? (new PaginatedResourceResponse($this))->toResponse($request) + : parent::toResponse($request); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/ResourceResponse.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/ResourceResponse.php new file mode 100644 index 0000000..d3acb4e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/ResourceResponse.php @@ -0,0 +1,120 @@ +resource = $resource; + } + + /** + * Create an HTTP response that represents the object. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\JsonResponse + */ + public function toResponse($request) + { + return tap(response()->json( + $this->wrap( + $this->resource->resolve($request), + $this->resource->with($request), + $this->resource->additional + ), + $this->calculateStatus() + ), function ($response) use ($request) { + $response->original = $this->resource->resource; + + $this->resource->withResponse($request, $response); + }); + } + + /** + * Wrap the given data if necessary. + * + * @param array $data + * @param array $with + * @param array $additional + * @return array + */ + protected function wrap($data, $with = [], $additional = []) + { + if ($data instanceof Collection) { + $data = $data->all(); + } + + if ($this->haveDefaultWrapperAndDataIsUnwrapped($data)) { + $data = [$this->wrapper() => $data]; + } elseif ($this->haveAdditionalInformationAndDataIsUnwrapped($data, $with, $additional)) { + $data = [($this->wrapper() ?? 'data') => $data]; + } + + return array_merge_recursive($data, $with, $additional); + } + + /** + * Determine if we have a default wrapper and the given data is unwrapped. + * + * @param array $data + * @return bool + */ + protected function haveDefaultWrapperAndDataIsUnwrapped($data) + { + return $this->wrapper() && ! array_key_exists($this->wrapper(), $data); + } + + /** + * Determine if "with" data has been added and our data is unwrapped. + * + * @param array $data + * @param array $with + * @param array $additional + * @return bool + */ + protected function haveAdditionalInformationAndDataIsUnwrapped($data, $with, $additional) + { + return (! empty($with) || ! empty($additional)) && + (! $this->wrapper() || + ! array_key_exists($this->wrapper(), $data)); + } + + /** + * Get the default data wrapper for the resource. + * + * @return string + */ + protected function wrapper() + { + return get_class($this->resource)::$wrap; + } + + /** + * Calculate the appropriate status code for the response. + * + * @return int + */ + protected function calculateStatus() + { + return $this->resource->resource instanceof Model && + $this->resource->resource->wasRecentlyCreated ? 201 : 200; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/MergeValue.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/MergeValue.php new file mode 100644 index 0000000..9894f38 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/MergeValue.php @@ -0,0 +1,26 @@ +data = $data instanceof Collection ? $data->all() : $data; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Resources/MissingValue.php b/vendor/laravel/framework/src/Illuminate/Http/Resources/MissingValue.php new file mode 100644 index 0000000..d0d8dfa --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Resources/MissingValue.php @@ -0,0 +1,16 @@ +original = $content; + + // If the content is "JSONable" we will set the appropriate header and convert + // the content to JSON. This is useful when returning something like models + // from routes that will be automatically transformed to their JSON form. + if ($this->shouldBeJson($content)) { + $this->header('Content-Type', 'application/json'); + + $content = $this->morphToJson($content); + } + + // If this content implements the "Renderable" interface then we will call the + // render method on the object so we will avoid any "__toString" exceptions + // that might be thrown and have their errors obscured by PHP's handling. + elseif ($content instanceof Renderable) { + $content = $content->render(); + } + + parent::setContent($content); + + return $this; + } + + /** + * Determine if the given content should be turned into JSON. + * + * @param mixed $content + * @return bool + */ + protected function shouldBeJson($content) + { + return $content instanceof Arrayable || + $content instanceof Jsonable || + $content instanceof ArrayObject || + $content instanceof JsonSerializable || + is_array($content); + } + + /** + * Morph the given content into JSON. + * + * @param mixed $content + * @return string + */ + protected function morphToJson($content) + { + if ($content instanceof Jsonable) { + return $content->toJson(); + } elseif ($content instanceof Arrayable) { + return json_encode($content->toArray()); + } + + return json_encode($content); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php b/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php new file mode 100644 index 0000000..d6237d3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php @@ -0,0 +1,141 @@ +getStatusCode(); + } + + /** + * Get the content of the response. + * + * @return string + */ + public function content() + { + return $this->getContent(); + } + + /** + * Get the original response content. + * + * @return mixed + */ + public function getOriginalContent() + { + $original = $this->original; + + return $original instanceof self ? $original->{__FUNCTION__}() : $original; + } + + /** + * Set a header on the Response. + * + * @param string $key + * @param array|string $values + * @param bool $replace + * @return $this + */ + public function header($key, $values, $replace = true) + { + $this->headers->set($key, $values, $replace); + + return $this; + } + + /** + * Add an array of headers to the response. + * + * @param \Symfony\Component\HttpFoundation\HeaderBag|array $headers + * @return $this + */ + public function withHeaders($headers) + { + if ($headers instanceof HeaderBag) { + $headers = $headers->all(); + } + + foreach ($headers as $key => $value) { + $this->headers->set($key, $value); + } + + return $this; + } + + /** + * Add a cookie to the response. + * + * @param \Symfony\Component\HttpFoundation\Cookie|mixed $cookie + * @return $this + */ + public function cookie($cookie) + { + return call_user_func_array([$this, 'withCookie'], func_get_args()); + } + + /** + * Add a cookie to the response. + * + * @param \Symfony\Component\HttpFoundation\Cookie|mixed $cookie + * @return $this + */ + public function withCookie($cookie) + { + if (is_string($cookie) && function_exists('cookie')) { + $cookie = call_user_func_array('cookie', func_get_args()); + } + + $this->headers->setCookie($cookie); + + return $this; + } + + /** + * Set the exception to attach to the response. + * + * @param \Exception $e + * @return $this + */ + public function withException(Exception $e) + { + $this->exception = $e; + + return $this; + } + + /** + * Throws the response in a HttpResponseException instance. + * + * @throws \Illuminate\Http\Exceptions\HttpResponseException + */ + public function throwResponse() + { + throw new HttpResponseException($this); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Testing/File.php b/vendor/laravel/framework/src/Illuminate/Http/Testing/File.php new file mode 100644 index 0000000..4b1140c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Testing/File.php @@ -0,0 +1,115 @@ +name = $name; + $this->tempFile = $tempFile; + + parent::__construct( + $this->tempFilePath(), $name, $this->getMimeType(), + null, true + ); + } + + /** + * Create a new fake file. + * + * @param string $name + * @param int $kilobytes + * @return \Illuminate\Http\Testing\File + */ + public static function create($name, $kilobytes = 0) + { + return (new FileFactory)->create($name, $kilobytes); + } + + /** + * Create a new fake image. + * + * @param string $name + * @param int $width + * @param int $height + * @return \Illuminate\Http\Testing\File + */ + public static function image($name, $width = 10, $height = 10) + { + return (new FileFactory)->image($name, $width, $height); + } + + /** + * Set the "size" of the file in kilobytes. + * + * @param int $kilobytes + * @return $this + */ + public function size($kilobytes) + { + $this->sizeToReport = $kilobytes * 1024; + + return $this; + } + + /** + * Get the size of the file. + * + * @return int + */ + public function getSize() + { + return $this->sizeToReport ?: parent::getSize(); + } + + /** + * Get the MIME type for the file. + * + * @return string + */ + public function getMimeType() + { + return MimeType::from($this->name); + } + + /** + * Get the path to the temporary file. + * + * @return string + */ + protected function tempFilePath() + { + return stream_get_meta_data($this->tempFile)['uri']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Testing/FileFactory.php b/vendor/laravel/framework/src/Illuminate/Http/Testing/FileFactory.php new file mode 100644 index 0000000..c79617e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Testing/FileFactory.php @@ -0,0 +1,65 @@ +sizeToReport = $kilobytes * 1024; + }); + } + + /** + * Create a new fake image. + * + * @param string $name + * @param int $width + * @param int $height + * @return \Illuminate\Http\Testing\File + */ + public function image($name, $width = 10, $height = 10) + { + return new File($name, $this->generateImage( + $width, $height, Str::endsWith(Str::lower($name), ['.jpg', '.jpeg']) ? 'jpeg' : 'png' + )); + } + + /** + * Generate a dummy image of the given width and height. + * + * @param int $width + * @param int $height + * @param string $type + * @return resource + */ + protected function generateImage($width, $height, $type) + { + return tap(tmpfile(), function ($temp) use ($width, $height, $type) { + ob_start(); + + $image = imagecreatetruecolor($width, $height); + + switch ($type) { + case 'jpeg': + imagejpeg($image); + break; + case 'png': + imagepng($image); + break; + } + + fwrite($temp, ob_get_clean()); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/Testing/MimeType.php b/vendor/laravel/framework/src/Illuminate/Http/Testing/MimeType.php new file mode 100644 index 0000000..b4212ae --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/Testing/MimeType.php @@ -0,0 +1,827 @@ + 'application/andrew-inset', + 'aw' => 'application/applixware', + 'atom' => 'application/atom+xml', + 'atomcat' => 'application/atomcat+xml', + 'atomsvc' => 'application/atomsvc+xml', + 'ccxml' => 'application/ccxml+xml', + 'cdmia' => 'application/cdmi-capability', + 'cdmic' => 'application/cdmi-container', + 'cdmid' => 'application/cdmi-domain', + 'cdmio' => 'application/cdmi-object', + 'cdmiq' => 'application/cdmi-queue', + 'cu' => 'application/cu-seeme', + 'davmount' => 'application/davmount+xml', + 'dbk' => 'application/docbook+xml', + 'dssc' => 'application/dssc+der', + 'xdssc' => 'application/dssc+xml', + 'ecma' => 'application/ecmascript', + 'emma' => 'application/emma+xml', + 'epub' => 'application/epub+zip', + 'exi' => 'application/exi', + 'pfr' => 'application/font-tdpfr', + 'gml' => 'application/gml+xml', + 'gpx' => 'application/gpx+xml', + 'gxf' => 'application/gxf', + 'stk' => 'application/hyperstudio', + 'ink' => 'application/inkml+xml', + 'ipfix' => 'application/ipfix', + 'jar' => 'application/java-archive', + 'ser' => 'application/java-serialized-object', + 'class' => 'application/java-vm', + 'js' => 'application/javascript', + 'json' => 'application/json', + 'jsonml' => 'application/jsonml+json', + 'lostxml' => 'application/lost+xml', + 'hqx' => 'application/mac-binhex40', + 'cpt' => 'application/mac-compactpro', + 'mads' => 'application/mads+xml', + 'mrc' => 'application/marc', + 'mrcx' => 'application/marcxml+xml', + 'ma' => 'application/mathematica', + 'mathml' => 'application/mathml+xml', + 'mbox' => 'application/mbox', + 'mscml' => 'application/mediaservercontrol+xml', + 'metalink' => 'application/metalink+xml', + 'meta4' => 'application/metalink4+xml', + 'mets' => 'application/mets+xml', + 'mods' => 'application/mods+xml', + 'm21' => 'application/mp21', + 'mp4s' => 'application/mp4', + 'doc' => 'application/msword', + 'mxf' => 'application/mxf', + 'bin' => 'application/octet-stream', + 'oda' => 'application/oda', + 'opf' => 'application/oebps-package+xml', + 'ogx' => 'application/ogg', + 'omdoc' => 'application/omdoc+xml', + 'onetoc' => 'application/onenote', + 'oxps' => 'application/oxps', + 'xer' => 'application/patch-ops-error+xml', + 'pdf' => 'application/pdf', + 'pgp' => 'application/pgp-encrypted', + 'asc' => 'application/pgp-signature', + 'prf' => 'application/pics-rules', + 'p10' => 'application/pkcs10', + 'p7m' => 'application/pkcs7-mime', + 'p7s' => 'application/pkcs7-signature', + 'p8' => 'application/pkcs8', + 'ac' => 'application/pkix-attr-cert', + 'cer' => 'application/pkix-cert', + 'crl' => 'application/pkix-crl', + 'pkipath' => 'application/pkix-pkipath', + 'pki' => 'application/pkixcmp', + 'pls' => 'application/pls+xml', + 'ai' => 'application/postscript', + 'cww' => 'application/prs.cww', + 'pskcxml' => 'application/pskc+xml', + 'rdf' => 'application/rdf+xml', + 'rif' => 'application/reginfo+xml', + 'rnc' => 'application/relax-ng-compact-syntax', + 'rl' => 'application/resource-lists+xml', + 'rld' => 'application/resource-lists-diff+xml', + 'rs' => 'application/rls-services+xml', + 'gbr' => 'application/rpki-ghostbusters', + 'mft' => 'application/rpki-manifest', + 'roa' => 'application/rpki-roa', + 'rsd' => 'application/rsd+xml', + 'rss' => 'application/rss+xml', + 'sbml' => 'application/sbml+xml', + 'scq' => 'application/scvp-cv-request', + 'scs' => 'application/scvp-cv-response', + 'spq' => 'application/scvp-vp-request', + 'spp' => 'application/scvp-vp-response', + 'sdp' => 'application/sdp', + 'setpay' => 'application/set-payment-initiation', + 'setreg' => 'application/set-registration-initiation', + 'shf' => 'application/shf+xml', + 'smi' => 'application/smil+xml', + 'rq' => 'application/sparql-query', + 'srx' => 'application/sparql-results+xml', + 'gram' => 'application/srgs', + 'grxml' => 'application/srgs+xml', + 'sru' => 'application/sru+xml', + 'ssdl' => 'application/ssdl+xml', + 'ssml' => 'application/ssml+xml', + 'tei' => 'application/tei+xml', + 'tfi' => 'application/thraud+xml', + 'tsd' => 'application/timestamped-data', + 'plb' => 'application/vnd.3gpp.pic-bw-large', + 'psb' => 'application/vnd.3gpp.pic-bw-small', + 'pvb' => 'application/vnd.3gpp.pic-bw-var', + 'tcap' => 'application/vnd.3gpp2.tcap', + 'pwn' => 'application/vnd.3m.post-it-notes', + 'aso' => 'application/vnd.accpac.simply.aso', + 'imp' => 'application/vnd.accpac.simply.imp', + 'acu' => 'application/vnd.acucobol', + 'atc' => 'application/vnd.acucorp', + 'air' => 'application/vnd.adobe.air-application-installer-package+zip', + 'fcdt' => 'application/vnd.adobe.formscentral.fcdt', + 'fxp' => 'application/vnd.adobe.fxp', + 'xdp' => 'application/vnd.adobe.xdp+xml', + 'xfdf' => 'application/vnd.adobe.xfdf', + 'ahead' => 'application/vnd.ahead.space', + 'azf' => 'application/vnd.airzip.filesecure.azf', + 'azs' => 'application/vnd.airzip.filesecure.azs', + 'azw' => 'application/vnd.amazon.ebook', + 'acc' => 'application/vnd.americandynamics.acc', + 'ami' => 'application/vnd.amiga.ami', + 'apk' => 'application/vnd.android.package-archive', + 'cii' => 'application/vnd.anser-web-certificate-issue-initiation', + 'fti' => 'application/vnd.anser-web-funds-transfer-initiation', + 'atx' => 'application/vnd.antix.game-component', + 'mpkg' => 'application/vnd.apple.installer+xml', + 'm3u8' => 'application/vnd.apple.mpegurl', + 'swi' => 'application/vnd.aristanetworks.swi', + 'iota' => 'application/vnd.astraea-software.iota', + 'aep' => 'application/vnd.audiograph', + 'mpm' => 'application/vnd.blueice.multipass', + 'bmi' => 'application/vnd.bmi', + 'rep' => 'application/vnd.businessobjects', + 'cdxml' => 'application/vnd.chemdraw+xml', + 'mmd' => 'application/vnd.chipnuts.karaoke-mmd', + 'cdy' => 'application/vnd.cinderella', + 'cla' => 'application/vnd.claymore', + 'rp9' => 'application/vnd.cloanto.rp9', + 'c4g' => 'application/vnd.clonk.c4group', + 'c11amc' => 'application/vnd.cluetrust.cartomobile-config', + 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg', + 'csp' => 'application/vnd.commonspace', + 'cdbcmsg' => 'application/vnd.contact.cmsg', + 'cmc' => 'application/vnd.cosmocaller', + 'clkx' => 'application/vnd.crick.clicker', + 'clkk' => 'application/vnd.crick.clicker.keyboard', + 'clkp' => 'application/vnd.crick.clicker.palette', + 'clkt' => 'application/vnd.crick.clicker.template', + 'clkw' => 'application/vnd.crick.clicker.wordbank', + 'wbs' => 'application/vnd.criticaltools.wbs+xml', + 'pml' => 'application/vnd.ctc-posml', + 'ppd' => 'application/vnd.cups-ppd', + 'car' => 'application/vnd.curl.car', + 'pcurl' => 'application/vnd.curl.pcurl', + 'dart' => 'application/vnd.dart', + 'rdz' => 'application/vnd.data-vision.rdz', + 'uvf' => 'application/vnd.dece.data', + 'uvt' => 'application/vnd.dece.ttml+xml', + 'uvx' => 'application/vnd.dece.unspecified', + 'uvz' => 'application/vnd.dece.zip', + 'fe_launch' => 'application/vnd.denovo.fcselayout-link', + 'dna' => 'application/vnd.dna', + 'mlp' => 'application/vnd.dolby.mlp', + 'dpg' => 'application/vnd.dpgraph', + 'dfac' => 'application/vnd.dreamfactory', + 'kpxx' => 'application/vnd.ds-keypoint', + 'ait' => 'application/vnd.dvb.ait', + 'svc' => 'application/vnd.dvb.service', + 'geo' => 'application/vnd.dynageo', + 'mag' => 'application/vnd.ecowin.chart', + 'nml' => 'application/vnd.enliven', + 'esf' => 'application/vnd.epson.esf', + 'msf' => 'application/vnd.epson.msf', + 'qam' => 'application/vnd.epson.quickanime', + 'slt' => 'application/vnd.epson.salt', + 'ssf' => 'application/vnd.epson.ssf', + 'es3' => 'application/vnd.eszigno3+xml', + 'ez2' => 'application/vnd.ezpix-album', + 'ez3' => 'application/vnd.ezpix-package', + 'fdf' => 'application/vnd.fdf', + 'mseed' => 'application/vnd.fdsn.mseed', + 'seed' => 'application/vnd.fdsn.seed', + 'gph' => 'application/vnd.flographit', + 'ftc' => 'application/vnd.fluxtime.clip', + 'fm' => 'application/vnd.framemaker', + 'fnc' => 'application/vnd.frogans.fnc', + 'ltf' => 'application/vnd.frogans.ltf', + 'fsc' => 'application/vnd.fsc.weblaunch', + 'oas' => 'application/vnd.fujitsu.oasys', + 'oa2' => 'application/vnd.fujitsu.oasys2', + 'oa3' => 'application/vnd.fujitsu.oasys3', + 'fg5' => 'application/vnd.fujitsu.oasysgp', + 'bh2' => 'application/vnd.fujitsu.oasysprs', + 'ddd' => 'application/vnd.fujixerox.ddd', + 'xdw' => 'application/vnd.fujixerox.docuworks', + 'xbd' => 'application/vnd.fujixerox.docuworks.binder', + 'fzs' => 'application/vnd.fuzzysheet', + 'txd' => 'application/vnd.genomatix.tuxedo', + 'ggb' => 'application/vnd.geogebra.file', + 'ggt' => 'application/vnd.geogebra.tool', + 'gex' => 'application/vnd.geometry-explorer', + 'gxt' => 'application/vnd.geonext', + 'g2w' => 'application/vnd.geoplan', + 'g3w' => 'application/vnd.geospace', + 'gmx' => 'application/vnd.gmx', + 'kml' => 'application/vnd.google-earth.kml+xml', + 'kmz' => 'application/vnd.google-earth.kmz', + 'gqf' => 'application/vnd.grafeq', + 'gac' => 'application/vnd.groove-account', + 'ghf' => 'application/vnd.groove-help', + 'gim' => 'application/vnd.groove-identity-message', + 'grv' => 'application/vnd.groove-injector', + 'gtm' => 'application/vnd.groove-tool-message', + 'tpl' => 'application/vnd.groove-tool-template', + 'vcg' => 'application/vnd.groove-vcard', + 'hal' => 'application/vnd.hal+xml', + 'zmm' => 'application/vnd.handheld-entertainment+xml', + 'hbci' => 'application/vnd.hbci', + 'les' => 'application/vnd.hhe.lesson-player', + 'hpgl' => 'application/vnd.hp-hpgl', + 'hpid' => 'application/vnd.hp-hpid', + 'hps' => 'application/vnd.hp-hps', + 'jlt' => 'application/vnd.hp-jlyt', + 'pcl' => 'application/vnd.hp-pcl', + 'pclxl' => 'application/vnd.hp-pclxl', + 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data', + 'mpy' => 'application/vnd.ibm.minipay', + 'afp' => 'application/vnd.ibm.modcap', + 'irm' => 'application/vnd.ibm.rights-management', + 'sc' => 'application/vnd.ibm.secure-container', + 'icc' => 'application/vnd.iccprofile', + 'igl' => 'application/vnd.igloader', + 'ivp' => 'application/vnd.immervision-ivp', + 'ivu' => 'application/vnd.immervision-ivu', + 'igm' => 'application/vnd.insors.igm', + 'xpw' => 'application/vnd.intercon.formnet', + 'i2g' => 'application/vnd.intergeo', + 'qbo' => 'application/vnd.intu.qbo', + 'qfx' => 'application/vnd.intu.qfx', + 'rcprofile' => 'application/vnd.ipunplugged.rcprofile', + 'irp' => 'application/vnd.irepository.package+xml', + 'xpr' => 'application/vnd.is-xpr', + 'fcs' => 'application/vnd.isac.fcs', + 'jam' => 'application/vnd.jam', + 'rms' => 'application/vnd.jcp.javame.midlet-rms', + 'jisp' => 'application/vnd.jisp', + 'joda' => 'application/vnd.joost.joda-archive', + 'ktz' => 'application/vnd.kahootz', + 'karbon' => 'application/vnd.kde.karbon', + 'chrt' => 'application/vnd.kde.kchart', + 'kfo' => 'application/vnd.kde.kformula', + 'flw' => 'application/vnd.kde.kivio', + 'kon' => 'application/vnd.kde.kontour', + 'kpr' => 'application/vnd.kde.kpresenter', + 'ksp' => 'application/vnd.kde.kspread', + 'kwd' => 'application/vnd.kde.kword', + 'htke' => 'application/vnd.kenameaapp', + 'kia' => 'application/vnd.kidspiration', + 'kne' => 'application/vnd.kinar', + 'skp' => 'application/vnd.koan', + 'sse' => 'application/vnd.kodak-descriptor', + 'lasxml' => 'application/vnd.las.las+xml', + 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop', + 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml', + '123' => 'application/vnd.lotus-1-2-3', + 'apr' => 'application/vnd.lotus-approach', + 'pre' => 'application/vnd.lotus-freelance', + 'nsf' => 'application/vnd.lotus-notes', + 'org' => 'application/vnd.lotus-organizer', + 'scm' => 'application/vnd.lotus-screencam', + 'lwp' => 'application/vnd.lotus-wordpro', + 'portpkg' => 'application/vnd.macports.portpkg', + 'mcd' => 'application/vnd.mcd', + 'mc1' => 'application/vnd.medcalcdata', + 'cdkey' => 'application/vnd.mediastation.cdkey', + 'mwf' => 'application/vnd.mfer', + 'mfm' => 'application/vnd.mfmp', + 'flo' => 'application/vnd.micrografx.flo', + 'igx' => 'application/vnd.micrografx.igx', + 'mif' => 'application/vnd.mif', + 'daf' => 'application/vnd.mobius.daf', + 'dis' => 'application/vnd.mobius.dis', + 'mbk' => 'application/vnd.mobius.mbk', + 'mqy' => 'application/vnd.mobius.mqy', + 'msl' => 'application/vnd.mobius.msl', + 'plc' => 'application/vnd.mobius.plc', + 'txf' => 'application/vnd.mobius.txf', + 'mpn' => 'application/vnd.mophun.application', + 'mpc' => 'application/vnd.mophun.certificate', + 'xul' => 'application/vnd.mozilla.xul+xml', + 'cil' => 'application/vnd.ms-artgalry', + 'cab' => 'application/vnd.ms-cab-compressed', + 'xls' => 'application/vnd.ms-excel', + 'xlam' => 'application/vnd.ms-excel.addin.macroenabled.12', + 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroenabled.12', + 'xlsm' => 'application/vnd.ms-excel.sheet.macroenabled.12', + 'xltm' => 'application/vnd.ms-excel.template.macroenabled.12', + 'eot' => 'application/vnd.ms-fontobject', + 'chm' => 'application/vnd.ms-htmlhelp', + 'ims' => 'application/vnd.ms-ims', + 'lrm' => 'application/vnd.ms-lrm', + 'thmx' => 'application/vnd.ms-officetheme', + 'cat' => 'application/vnd.ms-pki.seccat', + 'stl' => 'application/vnd.ms-pki.stl', + 'ppt' => 'application/vnd.ms-powerpoint', + 'ppam' => 'application/vnd.ms-powerpoint.addin.macroenabled.12', + 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroenabled.12', + 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12', + 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroenabled.12', + 'potm' => 'application/vnd.ms-powerpoint.template.macroenabled.12', + 'mpp' => 'application/vnd.ms-project', + 'docm' => 'application/vnd.ms-word.document.macroenabled.12', + 'dotm' => 'application/vnd.ms-word.template.macroenabled.12', + 'wps' => 'application/vnd.ms-works', + 'wpl' => 'application/vnd.ms-wpl', + 'xps' => 'application/vnd.ms-xpsdocument', + 'mseq' => 'application/vnd.mseq', + 'mus' => 'application/vnd.musician', + 'msty' => 'application/vnd.muvee.style', + 'taglet' => 'application/vnd.mynfc', + 'nlu' => 'application/vnd.neurolanguage.nlu', + 'ntf' => 'application/vnd.nitf', + 'nnd' => 'application/vnd.noblenet-directory', + 'nns' => 'application/vnd.noblenet-sealer', + 'nnw' => 'application/vnd.noblenet-web', + 'ngdat' => 'application/vnd.nokia.n-gage.data', + 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install', + 'rpst' => 'application/vnd.nokia.radio-preset', + 'rpss' => 'application/vnd.nokia.radio-presets', + 'edm' => 'application/vnd.novadigm.edm', + 'edx' => 'application/vnd.novadigm.edx', + 'ext' => 'application/vnd.novadigm.ext', + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'otc' => 'application/vnd.oasis.opendocument.chart-template', + 'odb' => 'application/vnd.oasis.opendocument.database', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'odft' => 'application/vnd.oasis.opendocument.formula-template', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'otg' => 'application/vnd.oasis.opendocument.graphics-template', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'oti' => 'application/vnd.oasis.opendocument.image-template', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'otp' => 'application/vnd.oasis.opendocument.presentation-template', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'ott' => 'application/vnd.oasis.opendocument.text-template', + 'oth' => 'application/vnd.oasis.opendocument.text-web', + 'xo' => 'application/vnd.olpc-sugar', + 'dd2' => 'application/vnd.oma.dd2+xml', + 'oxt' => 'application/vnd.openofficeorg.extension', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', + 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + 'mgp' => 'application/vnd.osgeo.mapguide.package', + 'dp' => 'application/vnd.osgi.dp', + 'esa' => 'application/vnd.osgi.subsystem', + 'pdb' => 'application/vnd.palm', + 'paw' => 'application/vnd.pawaafile', + 'str' => 'application/vnd.pg.format', + 'ei6' => 'application/vnd.pg.osasli', + 'efif' => 'application/vnd.picsel', + 'wg' => 'application/vnd.pmi.widget', + 'plf' => 'application/vnd.pocketlearn', + 'pbd' => 'application/vnd.powerbuilder6', + 'box' => 'application/vnd.previewsystems.box', + 'mgz' => 'application/vnd.proteus.magazine', + 'qps' => 'application/vnd.publishare-delta-tree', + 'ptid' => 'application/vnd.pvi.ptid1', + 'qxd' => 'application/vnd.quark.quarkxpress', + 'bed' => 'application/vnd.realvnc.bed', + 'mxl' => 'application/vnd.recordare.musicxml', + 'musicxml' => 'application/vnd.recordare.musicxml+xml', + 'cryptonote' => 'application/vnd.rig.cryptonote', + 'cod' => 'application/vnd.rim.cod', + 'rm' => 'application/vnd.rn-realmedia', + 'rmvb' => 'application/vnd.rn-realmedia-vbr', + 'link66' => 'application/vnd.route66.link66+xml', + 'st' => 'application/vnd.sailingtracker.track', + 'see' => 'application/vnd.seemail', + 'sema' => 'application/vnd.sema', + 'semd' => 'application/vnd.semd', + 'semf' => 'application/vnd.semf', + 'ifm' => 'application/vnd.shana.informed.formdata', + 'itp' => 'application/vnd.shana.informed.formtemplate', + 'iif' => 'application/vnd.shana.informed.interchange', + 'ipk' => 'application/vnd.shana.informed.package', + 'twd' => 'application/vnd.simtech-mindmapper', + 'mmf' => 'application/vnd.smaf', + 'teacher' => 'application/vnd.smart.teacher', + 'sdkm' => 'application/vnd.solent.sdkm+xml', + 'dxp' => 'application/vnd.spotfire.dxp', + 'sfs' => 'application/vnd.spotfire.sfs', + 'sdc' => 'application/vnd.stardivision.calc', + 'sda' => 'application/vnd.stardivision.draw', + 'sdd' => 'application/vnd.stardivision.impress', + 'smf' => 'application/vnd.stardivision.math', + 'sdw' => 'application/vnd.stardivision.writer', + 'sgl' => 'application/vnd.stardivision.writer-global', + 'smzip' => 'application/vnd.stepmania.package', + 'sm' => 'application/vnd.stepmania.stepchart', + 'sxc' => 'application/vnd.sun.xml.calc', + 'stc' => 'application/vnd.sun.xml.calc.template', + 'sxd' => 'application/vnd.sun.xml.draw', + 'std' => 'application/vnd.sun.xml.draw.template', + 'sxi' => 'application/vnd.sun.xml.impress', + 'sti' => 'application/vnd.sun.xml.impress.template', + 'sxm' => 'application/vnd.sun.xml.math', + 'sxw' => 'application/vnd.sun.xml.writer', + 'sxg' => 'application/vnd.sun.xml.writer.global', + 'stw' => 'application/vnd.sun.xml.writer.template', + 'sus' => 'application/vnd.sus-calendar', + 'svd' => 'application/vnd.svd', + 'sis' => 'application/vnd.symbian.install', + 'xsm' => 'application/vnd.syncml+xml', + 'bdm' => 'application/vnd.syncml.dm+wbxml', + 'xdm' => 'application/vnd.syncml.dm+xml', + 'tao' => 'application/vnd.tao.intent-module-archive', + 'pcap' => 'application/vnd.tcpdump.pcap', + 'tmo' => 'application/vnd.tmobile-livetv', + 'tpt' => 'application/vnd.trid.tpt', + 'mxs' => 'application/vnd.triscape.mxs', + 'tra' => 'application/vnd.trueapp', + 'ufd' => 'application/vnd.ufdl', + 'utz' => 'application/vnd.uiq.theme', + 'umj' => 'application/vnd.umajin', + 'unityweb' => 'application/vnd.unity', + 'uoml' => 'application/vnd.uoml+xml', + 'vcx' => 'application/vnd.vcx', + 'vsd' => 'application/vnd.visio', + 'vis' => 'application/vnd.visionary', + 'vsf' => 'application/vnd.vsf', + 'wbxml' => 'application/vnd.wap.wbxml', + 'wmlc' => 'application/vnd.wap.wmlc', + 'wmlsc' => 'application/vnd.wap.wmlscriptc', + 'wtb' => 'application/vnd.webturbo', + 'nbp' => 'application/vnd.wolfram.player', + 'wpd' => 'application/vnd.wordperfect', + 'wqd' => 'application/vnd.wqd', + 'stf' => 'application/vnd.wt.stf', + 'xar' => 'application/vnd.xara', + 'xfdl' => 'application/vnd.xfdl', + 'hvd' => 'application/vnd.yamaha.hv-dic', + 'hvs' => 'application/vnd.yamaha.hv-script', + 'hvp' => 'application/vnd.yamaha.hv-voice', + 'osf' => 'application/vnd.yamaha.openscoreformat', + 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml', + 'saf' => 'application/vnd.yamaha.smaf-audio', + 'spf' => 'application/vnd.yamaha.smaf-phrase', + 'cmp' => 'application/vnd.yellowriver-custom-menu', + 'zir' => 'application/vnd.zul', + 'zaz' => 'application/vnd.zzazz.deck+xml', + 'vxml' => 'application/voicexml+xml', + 'wgt' => 'application/widget', + 'hlp' => 'application/winhlp', + 'wsdl' => 'application/wsdl+xml', + 'wspolicy' => 'application/wspolicy+xml', + '7z' => 'application/x-7z-compressed', + 'abw' => 'application/x-abiword', + 'ace' => 'application/x-ace-compressed', + 'dmg' => 'application/x-apple-diskimage', + 'aab' => 'application/x-authorware-bin', + 'aam' => 'application/x-authorware-map', + 'aas' => 'application/x-authorware-seg', + 'bcpio' => 'application/x-bcpio', + 'torrent' => 'application/x-bittorrent', + 'blb' => 'application/x-blorb', + 'bz' => 'application/x-bzip', + 'bz2' => 'application/x-bzip2', + 'cbr' => 'application/x-cbr', + 'vcd' => 'application/x-cdlink', + 'cfs' => 'application/x-cfs-compressed', + 'chat' => 'application/x-chat', + 'pgn' => 'application/x-chess-pgn', + 'nsc' => 'application/x-conference', + 'cpio' => 'application/x-cpio', + 'csh' => 'application/x-csh', + 'deb' => 'application/x-debian-package', + 'dgc' => 'application/x-dgc-compressed', + 'dir' => 'application/x-director', + 'wad' => 'application/x-doom', + 'ncx' => 'application/x-dtbncx+xml', + 'dtb' => 'application/x-dtbook+xml', + 'res' => 'application/x-dtbresource+xml', + 'dvi' => 'application/x-dvi', + 'evy' => 'application/x-envoy', + 'eva' => 'application/x-eva', + 'bdf' => 'application/x-font-bdf', + 'gsf' => 'application/x-font-ghostscript', + 'psf' => 'application/x-font-linux-psf', + 'otf' => 'application/x-font-otf', + 'pcf' => 'application/x-font-pcf', + 'snf' => 'application/x-font-snf', + 'ttf' => 'application/x-font-ttf', + 'pfa' => 'application/x-font-type1', + 'woff' => 'application/x-font-woff', + 'arc' => 'application/x-freearc', + 'spl' => 'application/x-futuresplash', + 'gca' => 'application/x-gca-compressed', + 'ulx' => 'application/x-glulx', + 'gnumeric' => 'application/x-gnumeric', + 'gramps' => 'application/x-gramps-xml', + 'gtar' => 'application/x-gtar', + 'hdf' => 'application/x-hdf', + 'install' => 'application/x-install-instructions', + 'iso' => 'application/x-iso9660-image', + 'jnlp' => 'application/x-java-jnlp-file', + 'latex' => 'application/x-latex', + 'lzh' => 'application/x-lzh-compressed', + 'mie' => 'application/x-mie', + 'prc' => 'application/x-mobipocket-ebook', + 'application' => 'application/x-ms-application', + 'lnk' => 'application/x-ms-shortcut', + 'wmd' => 'application/x-ms-wmd', + 'wmz' => 'application/x-ms-wmz', + 'xbap' => 'application/x-ms-xbap', + 'mdb' => 'application/x-msaccess', + 'obd' => 'application/x-msbinder', + 'crd' => 'application/x-mscardfile', + 'clp' => 'application/x-msclip', + 'exe' => 'application/x-msdownload', + 'mvb' => 'application/x-msmediaview', + 'wmf' => 'application/x-msmetafile', + 'mny' => 'application/x-msmoney', + 'pub' => 'application/x-mspublisher', + 'scd' => 'application/x-msschedule', + 'trm' => 'application/x-msterminal', + 'wri' => 'application/x-mswrite', + 'nc' => 'application/x-netcdf', + 'nzb' => 'application/x-nzb', + 'p12' => 'application/x-pkcs12', + 'p7b' => 'application/x-pkcs7-certificates', + 'p7r' => 'application/x-pkcs7-certreqresp', + 'rar' => 'application/x-rar', + 'ris' => 'application/x-research-info-systems', + 'sh' => 'application/x-sh', + 'shar' => 'application/x-shar', + 'swf' => 'application/x-shockwave-flash', + 'xap' => 'application/x-silverlight-app', + 'sql' => 'application/x-sql', + 'sit' => 'application/x-stuffit', + 'sitx' => 'application/x-stuffitx', + 'srt' => 'application/x-subrip', + 'sv4cpio' => 'application/x-sv4cpio', + 'sv4crc' => 'application/x-sv4crc', + 't3' => 'application/x-t3vm-image', + 'gam' => 'application/x-tads', + 'tar' => 'application/x-tar', + 'tcl' => 'application/x-tcl', + 'tex' => 'application/x-tex', + 'tfm' => 'application/x-tex-tfm', + 'texinfo' => 'application/x-texinfo', + 'obj' => 'application/x-tgif', + 'ustar' => 'application/x-ustar', + 'src' => 'application/x-wais-source', + 'der' => 'application/x-x509-ca-cert', + 'fig' => 'application/x-xfig', + 'xlf' => 'application/x-xliff+xml', + 'xpi' => 'application/x-xpinstall', + 'xz' => 'application/x-xz', + 'z1' => 'application/x-zmachine', + 'xaml' => 'application/xaml+xml', + 'xdf' => 'application/xcap-diff+xml', + 'xenc' => 'application/xenc+xml', + 'xhtml' => 'application/xhtml+xml', + 'xml' => 'application/xml', + 'dtd' => 'application/xml-dtd', + 'xop' => 'application/xop+xml', + 'xpl' => 'application/xproc+xml', + 'xslt' => 'application/xslt+xml', + 'xspf' => 'application/xspf+xml', + 'mxml' => 'application/xv+xml', + 'yang' => 'application/yang', + 'yin' => 'application/yin+xml', + 'zip' => 'application/zip', + 'adp' => 'audio/adpcm', + 'au' => 'audio/basic', + 'mid' => 'audio/midi', + 'mp3' => 'audio/mpeg', + 'mp4a' => 'audio/mp4', + 'mpga' => 'audio/mpeg', + 'oga' => 'audio/ogg', + 's3m' => 'audio/s3m', + 'sil' => 'audio/silk', + 'uva' => 'audio/vnd.dece.audio', + 'eol' => 'audio/vnd.digital-winds', + 'dra' => 'audio/vnd.dra', + 'dts' => 'audio/vnd.dts', + 'dtshd' => 'audio/vnd.dts.hd', + 'lvp' => 'audio/vnd.lucent.voice', + 'pya' => 'audio/vnd.ms-playready.media.pya', + 'ecelp4800' => 'audio/vnd.nuera.ecelp4800', + 'ecelp7470' => 'audio/vnd.nuera.ecelp7470', + 'ecelp9600' => 'audio/vnd.nuera.ecelp9600', + 'rip' => 'audio/vnd.rip', + 'weba' => 'audio/webm', + 'aac' => 'audio/x-aac', + 'aif' => 'audio/x-aiff', + 'caf' => 'audio/x-caf', + 'flac' => 'audio/x-flac', + 'mka' => 'audio/x-matroska', + 'm3u' => 'audio/x-mpegurl', + 'wax' => 'audio/x-ms-wax', + 'wma' => 'audio/x-ms-wma', + 'ram' => 'audio/x-pn-realaudio', + 'rmp' => 'audio/x-pn-realaudio-plugin', + 'wav' => 'audio/x-wav', + 'xm' => 'audio/xm', + 'cdx' => 'chemical/x-cdx', + 'cif' => 'chemical/x-cif', + 'cmdf' => 'chemical/x-cmdf', + 'cml' => 'chemical/x-cml', + 'csml' => 'chemical/x-csml', + 'xyz' => 'chemical/x-xyz', + 'bmp' => 'image/bmp', + 'cgm' => 'image/cgm', + 'g3' => 'image/g3fax', + 'gif' => 'image/gif', + 'ief' => 'image/ief', + 'jpg' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'ktx' => 'image/ktx', + 'png' => 'image/png', + 'btif' => 'image/prs.btif', + 'sgi' => 'image/sgi', + 'svg' => 'image/svg+xml', + 'tiff' => 'image/tiff', + 'psd' => 'image/vnd.adobe.photoshop', + 'uvi' => 'image/vnd.dece.graphic', + 'djvu' => 'image/vnd.djvu', + 'dwg' => 'image/vnd.dwg', + 'dxf' => 'image/vnd.dxf', + 'fbs' => 'image/vnd.fastbidsheet', + 'fpx' => 'image/vnd.fpx', + 'fst' => 'image/vnd.fst', + 'mmr' => 'image/vnd.fujixerox.edmics-mmr', + 'rlc' => 'image/vnd.fujixerox.edmics-rlc', + 'mdi' => 'image/vnd.ms-modi', + 'wdp' => 'image/vnd.ms-photo', + 'npx' => 'image/vnd.net-fpx', + 'wbmp' => 'image/vnd.wap.wbmp', + 'xif' => 'image/vnd.xiff', + 'webp' => 'image/webp', + '3ds' => 'image/x-3ds', + 'ras' => 'image/x-cmu-raster', + 'cmx' => 'image/x-cmx', + 'fh' => 'image/x-freehand', + 'ico' => 'image/x-icon', + 'sid' => 'image/x-mrsid-image', + 'pcx' => 'image/x-pcx', + 'pic' => 'image/x-pict', + 'pnm' => 'image/x-portable-anymap', + 'pbm' => 'image/x-portable-bitmap', + 'pgm' => 'image/x-portable-graymap', + 'ppm' => 'image/x-portable-pixmap', + 'rgb' => 'image/x-rgb', + 'tga' => 'image/x-tga', + 'xbm' => 'image/x-xbitmap', + 'xpm' => 'image/x-xpixmap', + 'xwd' => 'image/x-xwindowdump', + 'eml' => 'message/rfc822', + 'igs' => 'model/iges', + 'msh' => 'model/mesh', + 'dae' => 'model/vnd.collada+xml', + 'dwf' => 'model/vnd.dwf', + 'gdl' => 'model/vnd.gdl', + 'gtw' => 'model/vnd.gtw', + 'mts' => 'model/vnd.mts', + 'vtu' => 'model/vnd.vtu', + 'wrl' => 'model/vrml', + 'x3db' => 'model/x3d+binary', + 'x3dv' => 'model/x3d+vrml', + 'x3d' => 'model/x3d+xml', + 'appcache' => 'text/cache-manifest', + 'ics' => 'text/calendar', + 'css' => 'text/css', + 'csv' => 'text/csv', + 'html' => 'text/html', + 'n3' => 'text/n3', + 'txt' => 'text/plain', + 'dsc' => 'text/prs.lines.tag', + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'sgml' => 'text/sgml', + 'tsv' => 'text/tab-separated-values', + 't' => 'text/troff', + 'ttl' => 'text/turtle', + 'uri' => 'text/uri-list', + 'vcard' => 'text/vcard', + 'curl' => 'text/vnd.curl', + 'dcurl' => 'text/vnd.curl.dcurl', + 'scurl' => 'text/vnd.curl.scurl', + 'mcurl' => 'text/vnd.curl.mcurl', + 'sub' => 'text/vnd.dvb.subtitle', + 'fly' => 'text/vnd.fly', + 'flx' => 'text/vnd.fmi.flexstor', + 'gv' => 'text/vnd.graphviz', + '3dml' => 'text/vnd.in3d.3dml', + 'spot' => 'text/vnd.in3d.spot', + 'jad' => 'text/vnd.sun.j2me.app-descriptor', + 'wml' => 'text/vnd.wap.wml', + 'wmls' => 'text/vnd.wap.wmlscript', + 's' => 'text/x-asm', + 'c' => 'text/x-c', + 'f' => 'text/x-fortran', + 'p' => 'text/x-pascal', + 'java' => 'text/x-java-source', + 'opml' => 'text/x-opml', + 'nfo' => 'text/x-nfo', + 'etx' => 'text/x-setext', + 'sfv' => 'text/x-sfv', + 'uu' => 'text/x-uuencode', + 'vcs' => 'text/x-vcalendar', + 'vcf' => 'text/x-vcard', + '3gp' => 'video/3gpp', + '3g2' => 'video/3gpp2', + 'h261' => 'video/h261', + 'h263' => 'video/h263', + 'h264' => 'video/h264', + 'jpgv' => 'video/jpeg', + 'jpm' => 'video/jpm', + 'mj2' => 'video/mj2', + 'mp4' => 'video/mp4', + 'mpeg' => 'video/mpeg', + 'ogv' => 'video/ogg', + 'mov' => 'video/quicktime', + 'qt' => 'video/quicktime', + 'uvh' => 'video/vnd.dece.hd', + 'uvm' => 'video/vnd.dece.mobile', + 'uvp' => 'video/vnd.dece.pd', + 'uvs' => 'video/vnd.dece.sd', + 'uvv' => 'video/vnd.dece.video', + 'dvb' => 'video/vnd.dvb.file', + 'fvt' => 'video/vnd.fvt', + 'mxu' => 'video/vnd.mpegurl', + 'pyv' => 'video/vnd.ms-playready.media.pyv', + 'uvu' => 'video/vnd.uvvu.mp4', + 'viv' => 'video/vnd.vivo', + 'webm' => 'video/webm', + 'f4v' => 'video/x-f4v', + 'fli' => 'video/x-fli', + 'flv' => 'video/x-flv', + 'm4v' => 'video/x-m4v', + 'mkv' => 'video/x-matroska', + 'mng' => 'video/x-mng', + 'asf' => 'video/x-ms-asf', + 'vob' => 'video/x-ms-vob', + 'wm' => 'video/x-ms-wm', + 'wmv' => 'video/x-ms-wmv', + 'wmx' => 'video/x-ms-wmx', + 'wvx' => 'video/x-ms-wvx', + 'avi' => 'video/x-msvideo', + 'movie' => 'video/x-sgi-movie', + 'smv' => 'video/x-smv', + 'ice' => 'x-conference/x-cooltalk', + ]; + + /** + * Get the MIME type for a file based on the file's extension. + * + * @param string $filename + * @return string + */ + public static function from($filename) + { + $extension = pathinfo($filename, PATHINFO_EXTENSION); + + return self::getMimeTypeFromExtension($extension); + } + + /** + * Get the MIME type for a given extension or return all mimes. + * + * @param string $extension + * @return string|array + */ + public static function get($extension = null) + { + return $extension ? self::getMimeTypeFromExtension($extension) : self::$mimes; + } + + /** + * Search for the extension of a given MIME type. + * + * @param string $mimeType + * @return string|null + */ + public static function search($mimeType) + { + return array_search($mimeType, self::$mimes) ?: null; + } + + /** + * Get the MIME type for a given extension. + * + * @param string $extension + * @return string + */ + protected static function getMimeTypeFromExtension($extension) + { + return self::$mimes[$extension] ?? 'application/octet-stream'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/UploadedFile.php b/vendor/laravel/framework/src/Illuminate/Http/UploadedFile.php new file mode 100644 index 0000000..61b7c12 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/UploadedFile.php @@ -0,0 +1,138 @@ +storeAs($path, $this->hashName(), $this->parseOptions($options)); + } + + /** + * Store the uploaded file on a filesystem disk with public visibility. + * + * @param string $path + * @param array|string $options + * @return string|false + */ + public function storePublicly($path, $options = []) + { + $options = $this->parseOptions($options); + + $options['visibility'] = 'public'; + + return $this->storeAs($path, $this->hashName(), $options); + } + + /** + * Store the uploaded file on a filesystem disk with public visibility. + * + * @param string $path + * @param string $name + * @param array|string $options + * @return string|false + */ + public function storePubliclyAs($path, $name, $options = []) + { + $options = $this->parseOptions($options); + + $options['visibility'] = 'public'; + + return $this->storeAs($path, $name, $options); + } + + /** + * Store the uploaded file on a filesystem disk. + * + * @param string $path + * @param string $name + * @param array|string $options + * @return string|false + */ + public function storeAs($path, $name, $options = []) + { + $options = $this->parseOptions($options); + + $disk = Arr::pull($options, 'disk'); + + return Container::getInstance()->make(FilesystemFactory::class)->disk($disk)->putFileAs( + $path, $this, $name, $options + ); + } + + /** + * Get the contents of the uploaded file. + * + * @return bool|string + * + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + */ + public function get() + { + if (! $this->isValid()) { + throw new FileNotFoundException("File does not exist at path {$this->getPathname()}"); + } + + return file_get_contents($this->getPathname()); + } + + /** + * Create a new file instance from a base instance. + * + * @param \Symfony\Component\HttpFoundation\File\UploadedFile $file + * @param bool $test + * @return static + */ + public static function createFromBase(SymfonyUploadedFile $file, $test = false) + { + return $file instanceof static ? $file : new static( + $file->getPathname(), + $file->getClientOriginalName(), + $file->getClientMimeType(), + $file->getError(), + $test + ); + } + + /** + * Parse and format the given options. + * + * @param array|string $options + * @return array + */ + protected function parseOptions($options) + { + if (is_string($options)) { + $options = ['disk' => $options]; + } + + return $options; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Http/composer.json b/vendor/laravel/framework/src/Illuminate/Http/composer.json new file mode 100755 index 0000000..69eb155 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Http/composer.json @@ -0,0 +1,37 @@ +{ + "name": "illuminate/http", + "description": "The Illuminate Http package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/session": "5.7.*", + "illuminate/support": "5.7.*", + "symfony/http-foundation": "^4.1", + "symfony/http-kernel": "^4.1" + }, + "autoload": { + "psr-4": { + "Illuminate\\Http\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Log/Events/MessageLogged.php b/vendor/laravel/framework/src/Illuminate/Log/Events/MessageLogged.php new file mode 100644 index 0000000..312b343 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Log/Events/MessageLogged.php @@ -0,0 +1,42 @@ +level = $level; + $this->message = $message; + $this->context = $context; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Log/LogManager.php b/vendor/laravel/framework/src/Illuminate/Log/LogManager.php new file mode 100644 index 0000000..d0beae9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Log/LogManager.php @@ -0,0 +1,578 @@ +app = $app; + } + + /** + * Create a new, on-demand aggregate logger instance. + * + * @param array $channels + * @param string|null $channel + * @return \Psr\Log\LoggerInterface + */ + public function stack(array $channels, $channel = null) + { + return new Logger( + $this->createStackDriver(compact('channels', 'channel')), + $this->app['events'] + ); + } + + /** + * Get a log channel instance. + * + * @param string|null $channel + * @return mixed + */ + public function channel($channel = null) + { + return $this->driver($channel); + } + + /** + * Get a log driver instance. + * + * @param string|null $driver + * @return mixed + */ + public function driver($driver = null) + { + return $this->get($driver ?? $this->getDefaultDriver()); + } + + /** + * Attempt to get the log from the local cache. + * + * @param string $name + * @return \Psr\Log\LoggerInterface + */ + protected function get($name) + { + try { + return $this->channels[$name] ?? with($this->resolve($name), function ($logger) use ($name) { + return $this->channels[$name] = $this->tap($name, new Logger($logger, $this->app['events'])); + }); + } catch (Throwable $e) { + return tap($this->createEmergencyLogger(), function ($logger) use ($e) { + $logger->emergency('Unable to create configured logger. Using emergency logger.', [ + 'exception' => $e, + ]); + }); + } + } + + /** + * Apply the configured taps for the logger. + * + * @param string $name + * @param \Illuminate\Log\Logger $logger + * @return \Illuminate\Log\Logger + */ + protected function tap($name, Logger $logger) + { + foreach ($this->configurationFor($name)['tap'] ?? [] as $tap) { + [$class, $arguments] = $this->parseTap($tap); + + $this->app->make($class)->__invoke($logger, ...explode(',', $arguments)); + } + + return $logger; + } + + /** + * Parse the given tap class string into a class name and arguments string. + * + * @param string $tap + * @return array + */ + protected function parseTap($tap) + { + return Str::contains($tap, ':') ? explode(':', $tap, 2) : [$tap, '']; + } + + /** + * Create an emergency log handler to avoid white screens of death. + * + * @return \Psr\Log\LoggerInterface + */ + protected function createEmergencyLogger() + { + return new Logger(new Monolog('laravel', $this->prepareHandlers([new StreamHandler( + $this->app->storagePath().'/logs/laravel.log', $this->level(['level' => 'debug']) + )])), $this->app['events']); + } + + /** + * Resolve the given log instance by name. + * + * @param string $name + * @return \Psr\Log\LoggerInterface + * + * @throws \InvalidArgumentException + */ + protected function resolve($name) + { + $config = $this->configurationFor($name); + + if (is_null($config)) { + throw new InvalidArgumentException("Log [{$name}] is not defined."); + } + + if (isset($this->customCreators[$config['driver']])) { + return $this->callCustomCreator($config); + } + + $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; + + if (method_exists($this, $driverMethod)) { + return $this->{$driverMethod}($config); + } + + throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported."); + } + + /** + * Call a custom driver creator. + * + * @param array $config + * @return mixed + */ + protected function callCustomCreator(array $config) + { + return $this->customCreators[$config['driver']]($this->app, $config); + } + + /** + * Create a custom log driver instance. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + */ + protected function createCustomDriver(array $config) + { + $factory = is_callable($via = $config['via']) ? $via : $this->app->make($via); + + return $factory($config); + } + + /** + * Create an aggregate log driver instance. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + */ + protected function createStackDriver(array $config) + { + $handlers = collect($config['channels'])->flatMap(function ($channel) { + return $this->channel($channel)->getHandlers(); + })->all(); + + return new Monolog($this->parseChannel($config), $handlers); + } + + /** + * Create an instance of the single file log driver. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + */ + protected function createSingleDriver(array $config) + { + return new Monolog($this->parseChannel($config), [ + $this->prepareHandler( + new StreamHandler( + $config['path'], $this->level($config), + $config['bubble'] ?? true, $config['permission'] ?? null, $config['locking'] ?? false + ) + ), + ]); + } + + /** + * Create an instance of the daily file log driver. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + */ + protected function createDailyDriver(array $config) + { + return new Monolog($this->parseChannel($config), [ + $this->prepareHandler(new RotatingFileHandler( + $config['path'], $config['days'] ?? 7, $this->level($config), + $config['bubble'] ?? true, $config['permission'] ?? null, $config['locking'] ?? false + )), + ]); + } + + /** + * Create an instance of the Slack log driver. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + */ + protected function createSlackDriver(array $config) + { + return new Monolog($this->parseChannel($config), [ + $this->prepareHandler(new SlackWebhookHandler( + $config['url'], + $config['channel'] ?? null, + $config['username'] ?? 'Laravel', + $config['attachment'] ?? true, + $config['emoji'] ?? ':boom:', + $config['short'] ?? false, + $config['context'] ?? true, + $this->level($config), + $config['bubble'] ?? true, + $config['exclude_fields'] ?? [] + ), $config), + ]); + } + + /** + * Create an instance of the syslog log driver. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + */ + protected function createSyslogDriver(array $config) + { + return new Monolog($this->parseChannel($config), [ + $this->prepareHandler(new SyslogHandler( + $this->app['config']['app.name'], $config['facility'] ?? LOG_USER, $this->level($config) + )), + ]); + } + + /** + * Create an instance of the "error log" log driver. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + */ + protected function createErrorlogDriver(array $config) + { + return new Monolog($this->parseChannel($config), [ + $this->prepareHandler(new ErrorLogHandler( + $config['type'] ?? ErrorLogHandler::OPERATING_SYSTEM, $this->level($config) + )), + ]); + } + + /** + * Create an instance of any handler available in Monolog. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + * + * @throws \InvalidArgumentException + * @throws \Illuminate\Contracts\Container\BindingResolutionException + */ + protected function createMonologDriver(array $config) + { + if (! is_a($config['handler'], HandlerInterface::class, true)) { + throw new InvalidArgumentException( + $config['handler'].' must be an instance of '.HandlerInterface::class + ); + } + + $with = array_merge( + $config['with'] ?? [], + $config['handler_with'] ?? [] + ); + + return new Monolog($this->parseChannel($config), [$this->prepareHandler( + $this->app->make($config['handler'], $with), $config + )]); + } + + /** + * Prepare the handlers for usage by Monolog. + * + * @param array $handlers + * @return array + */ + protected function prepareHandlers(array $handlers) + { + foreach ($handlers as $key => $handler) { + $handlers[$key] = $this->prepareHandler($handler); + } + + return $handlers; + } + + /** + * Prepare the handler for usage by Monolog. + * + * @param \Monolog\Handler\HandlerInterface $handler + * @param array $config + * @return \Monolog\Handler\HandlerInterface + */ + protected function prepareHandler(HandlerInterface $handler, array $config = []) + { + if (! isset($config['formatter'])) { + $handler->setFormatter($this->formatter()); + } elseif ($config['formatter'] !== 'default') { + $handler->setFormatter($this->app->make($config['formatter'], $config['formatter_with'] ?? [])); + } + + return $handler; + } + + /** + * Get a Monolog formatter instance. + * + * @return \Monolog\Formatter\FormatterInterface + */ + protected function formatter() + { + return tap(new LineFormatter(null, null, true, true), function ($formatter) { + $formatter->includeStacktraces(); + }); + } + + /** + * Get fallback log channel name. + * + * @return string + */ + protected function getFallbackChannelName() + { + return $this->app->bound('env') ? $this->app->environment() : 'production'; + } + + /** + * Get the log connection configuration. + * + * @param string $name + * @return array + */ + protected function configurationFor($name) + { + return $this->app['config']["logging.channels.{$name}"]; + } + + /** + * Get the default log driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['logging.default']; + } + + /** + * Set the default log driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['logging.default'] = $name; + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback->bindTo($this, $this); + + return $this; + } + + /** + * System is unusable. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function emergency($message, array $context = []) + { + $this->driver()->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 = []) + { + $this->driver()->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 = []) + { + $this->driver()->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 = []) + { + $this->driver()->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 = []) + { + $this->driver()->warning($message, $context); + } + + /** + * Normal but significant events. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function notice($message, array $context = []) + { + $this->driver()->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 = []) + { + $this->driver()->info($message, $context); + } + + /** + * Detailed debug information. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function debug($message, array $context = []) + { + $this->driver()->debug($message, $context); + } + + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string $message + * @param array $context + * + * @return void + */ + public function log($level, $message, array $context = []) + { + $this->driver()->log($level, $message, $context); + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->driver()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php new file mode 100644 index 0000000..cd07392 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php @@ -0,0 +1,20 @@ +app->singleton('log', function () { + return new LogManager($this->app); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Log/Logger.php b/vendor/laravel/framework/src/Illuminate/Log/Logger.php new file mode 100755 index 0000000..6d5fdca --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Log/Logger.php @@ -0,0 +1,275 @@ +logger = $logger; + $this->dispatcher = $dispatcher; + } + + /** + * Log an emergency message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function emergency($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log an alert message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function alert($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log a critical message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function critical($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log an error message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function error($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log a warning message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function warning($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log a notice to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function notice($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log an informational message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function info($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log a debug message to the logs. + * + * @param string $message + * @param array $context + * @return void + */ + public function debug($message, array $context = []) + { + $this->writeLog(__FUNCTION__, $message, $context); + } + + /** + * Log a message to the logs. + * + * @param string $level + * @param string $message + * @param array $context + * @return void + */ + public function log($level, $message, array $context = []) + { + $this->writeLog($level, $message, $context); + } + + /** + * Dynamically pass log calls into the writer. + * + * @param string $level + * @param string $message + * @param array $context + * @return void + */ + public function write($level, $message, array $context = []) + { + $this->writeLog($level, $message, $context); + } + + /** + * Write a message to the log. + * + * @param string $level + * @param string $message + * @param array $context + * @return void + */ + protected function writeLog($level, $message, $context) + { + $this->fireLogEvent($level, $message = $this->formatMessage($message), $context); + + $this->logger->{$level}($message, $context); + } + + /** + * Register a new callback handler for when a log event is triggered. + * + * @param \Closure $callback + * @return void + * + * @throws \RuntimeException + */ + public function listen(Closure $callback) + { + if (! isset($this->dispatcher)) { + throw new RuntimeException('Events dispatcher has not been set.'); + } + + $this->dispatcher->listen(MessageLogged::class, $callback); + } + + /** + * Fires a log event. + * + * @param string $level + * @param string $message + * @param array $context + * @return void + */ + protected function fireLogEvent($level, $message, array $context = []) + { + // If the event dispatcher is set, we will pass along the parameters to the + // log listeners. These are useful for building profilers or other tools + // that aggregate all of the log messages for a given "request" cycle. + if (isset($this->dispatcher)) { + $this->dispatcher->dispatch(new MessageLogged($level, $message, $context)); + } + } + + /** + * Format the parameters for the logger. + * + * @param mixed $message + * @return mixed + */ + protected function formatMessage($message) + { + if (is_array($message)) { + return var_export($message, true); + } elseif ($message instanceof Jsonable) { + return $message->toJson(); + } elseif ($message instanceof Arrayable) { + return var_export($message->toArray(), true); + } + + return $message; + } + + /** + * Get the underlying logger implementation. + * + * @return \Psr\Log\LoggerInterface + */ + public function getLogger() + { + return $this->logger; + } + + /** + * Get the event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public function getEventDispatcher() + { + return $this->dispatcher; + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher + * @return void + */ + public function setEventDispatcher(Dispatcher $dispatcher) + { + $this->dispatcher = $dispatcher; + } + + /** + * Dynamically proxy method calls to the underlying logger. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->logger->{$method}(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Log/ParsesLogConfiguration.php b/vendor/laravel/framework/src/Illuminate/Log/ParsesLogConfiguration.php new file mode 100644 index 0000000..ebcb21d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Log/ParsesLogConfiguration.php @@ -0,0 +1,66 @@ + Monolog::DEBUG, + 'info' => Monolog::INFO, + 'notice' => Monolog::NOTICE, + 'warning' => Monolog::WARNING, + 'error' => Monolog::ERROR, + 'critical' => Monolog::CRITICAL, + 'alert' => Monolog::ALERT, + 'emergency' => Monolog::EMERGENCY, + ]; + + /** + * Get fallback log channel name. + * + * @return string + */ + abstract protected function getFallbackChannelName(); + + /** + * Parse the string level into a Monolog constant. + * + * @param array $config + * @return int + * + * @throws \InvalidArgumentException + */ + protected function level(array $config) + { + $level = $config['level'] ?? 'debug'; + + if (isset($this->levels[$level])) { + return $this->levels[$level]; + } + + throw new InvalidArgumentException('Invalid log level.'); + } + + /** + * Extract the log channel from the given configuration. + * + * @param array $config + * @return string + */ + protected function parseChannel(array $config) + { + if (! isset($config['name'])) { + return $this->getFallbackChannelName(); + } + + return $config['name']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Log/composer.json b/vendor/laravel/framework/src/Illuminate/Log/composer.json new file mode 100755 index 0000000..f0af69b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Log/composer.json @@ -0,0 +1,36 @@ +{ + "name": "illuminate/log", + "description": "The Illuminate Log package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*", + "monolog/monolog": "^1.11" + }, + "autoload": { + "psr-4": { + "Illuminate\\Log\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSending.php b/vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSending.php new file mode 100644 index 0000000..cff4521 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSending.php @@ -0,0 +1,33 @@ +data = $data; + $this->message = $message; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSent.php b/vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSent.php new file mode 100644 index 0000000..9dee09c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSent.php @@ -0,0 +1,33 @@ +data = $data; + $this->message = $message; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php new file mode 100755 index 0000000..8345eff --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php @@ -0,0 +1,152 @@ +registerSwiftMailer(); + $this->registerIlluminateMailer(); + $this->registerMarkdownRenderer(); + } + + /** + * Register the Illuminate mailer instance. + * + * @return void + */ + protected function registerIlluminateMailer() + { + $this->app->singleton('mailer', function () { + $config = $this->app->make('config')->get('mail'); + + // Once we have create the mailer instance, we will set a container instance + // on the mailer. This allows us to resolve mailer classes via containers + // for maximum testability on said classes instead of passing Closures. + $mailer = new Mailer( + $this->app['view'], + $this->app['swift.mailer'], + $this->app['events'] + ); + + if ($this->app->bound('queue')) { + $mailer->setQueue($this->app['queue']); + } + + // Next we will set all of the global addresses on this mailer, which allows + // for easy unification of all "from" addresses as well as easy debugging + // of sent messages since they get be sent into a single email address. + foreach (['from', 'reply_to', 'to'] as $type) { + $this->setGlobalAddress($mailer, $config, $type); + } + + return $mailer; + }); + } + + /** + * Set a global address on the mailer by type. + * + * @param \Illuminate\Mail\Mailer $mailer + * @param array $config + * @param string $type + * @return void + */ + protected function setGlobalAddress($mailer, array $config, $type) + { + $address = Arr::get($config, $type); + + if (is_array($address) && isset($address['address'])) { + $mailer->{'always'.Str::studly($type)}($address['address'], $address['name']); + } + } + + /** + * Register the Swift Mailer instance. + * + * @return void + */ + public function registerSwiftMailer() + { + $this->registerSwiftTransport(); + + // Once we have the transporter registered, we will register the actual Swift + // mailer instance, passing in the transport instances, which allows us to + // override this transporter instances during app start-up if necessary. + $this->app->singleton('swift.mailer', function () { + if ($domain = $this->app->make('config')->get('mail.domain')) { + Swift_DependencyContainer::getInstance() + ->register('mime.idgenerator.idright') + ->asValue($domain); + } + + return new Swift_Mailer($this->app['swift.transport']->driver()); + }); + } + + /** + * Register the Swift Transport instance. + * + * @return void + */ + protected function registerSwiftTransport() + { + $this->app->singleton('swift.transport', function () { + return new TransportManager($this->app); + }); + } + + /** + * Register the Markdown renderer instance. + * + * @return void + */ + protected function registerMarkdownRenderer() + { + if ($this->app->runningInConsole()) { + $this->publishes([ + __DIR__.'/resources/views' => $this->app->resourcePath('views/vendor/mail'), + ], 'laravel-mail'); + } + + $this->app->singleton(Markdown::class, function () { + $config = $this->app->make('config'); + + return new Markdown($this->app->make('view'), [ + 'theme' => $config->get('mail.markdown.theme', 'default'), + 'paths' => $config->get('mail.markdown.paths', []), + ]); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'mailer', 'swift.mailer', 'swift.transport', Markdown::class, + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php b/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php new file mode 100644 index 0000000..05ed890 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php @@ -0,0 +1,845 @@ +withLocale($this->locale, function () use ($mailer) { + Container::getInstance()->call([$this, 'build']); + + $mailer->send($this->buildView(), $this->buildViewData(), function ($message) { + $this->buildFrom($message) + ->buildRecipients($message) + ->buildSubject($message) + ->runCallbacks($message) + ->buildAttachments($message); + }); + }); + } + + /** + * Queue the message for sending. + * + * @param \Illuminate\Contracts\Queue\Factory $queue + * @return mixed + */ + public function queue(Queue $queue) + { + if (isset($this->delay)) { + return $this->later($this->delay, $queue); + } + + $connection = property_exists($this, 'connection') ? $this->connection : null; + + $queueName = property_exists($this, 'queue') ? $this->queue : null; + + return $queue->connection($connection)->pushOn( + $queueName ?: null, new SendQueuedMailable($this) + ); + } + + /** + * Deliver the queued message after the given delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param \Illuminate\Contracts\Queue\Factory $queue + * @return mixed + */ + public function later($delay, Queue $queue) + { + $connection = property_exists($this, 'connection') ? $this->connection : null; + + $queueName = property_exists($this, 'queue') ? $this->queue : null; + + return $queue->connection($connection)->laterOn( + $queueName ?: null, $delay, new SendQueuedMailable($this) + ); + } + + /** + * Render the mailable into a view. + * + * @return \Illuminate\View\View + * + * @throws \ReflectionException + */ + public function render() + { + return $this->withLocale($this->locale, function () { + Container::getInstance()->call([$this, 'build']); + + return Container::getInstance()->make('mailer')->render( + $this->buildView(), $this->buildViewData() + ); + }); + } + + /** + * Build the view for the message. + * + * @return array|string + * + * @throws \ReflectionException + */ + protected function buildView() + { + if (isset($this->html)) { + return array_filter([ + 'html' => new HtmlString($this->html), + 'text' => $this->textView ?? null, + ]); + } + + if (isset($this->markdown)) { + return $this->buildMarkdownView(); + } + + if (isset($this->view, $this->textView)) { + return [$this->view, $this->textView]; + } elseif (isset($this->textView)) { + return ['text' => $this->textView]; + } + + return $this->view; + } + + /** + * Build the Markdown view for the message. + * + * @return array + * + * @throws \ReflectionException + */ + protected function buildMarkdownView() + { + $markdown = Container::getInstance()->make(Markdown::class); + + if (isset($this->theme)) { + $markdown->theme($this->theme); + } + + $data = $this->buildViewData(); + + return [ + 'html' => $markdown->render($this->markdown, $data), + 'text' => $this->buildMarkdownText($markdown, $data), + ]; + } + + /** + * Build the view data for the message. + * + * @return array + * + * @throws \ReflectionException + */ + public function buildViewData() + { + $data = $this->viewData; + + if (static::$viewDataCallback) { + $data = array_merge($data, call_user_func(static::$viewDataCallback, $this)); + } + + foreach ((new ReflectionClass($this))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { + if ($property->getDeclaringClass()->getName() !== self::class) { + $data[$property->getName()] = $property->getValue($this); + } + } + + return $data; + } + + /** + * Build the text view for a Markdown message. + * + * @param \Illuminate\Mail\Markdown $markdown + * @param array $data + * @return string + */ + protected function buildMarkdownText($markdown, $data) + { + return $this->textView + ?? $markdown->renderText($this->markdown, $data); + } + + /** + * Add the sender to the message. + * + * @param \Illuminate\Mail\Message $message + * @return $this + */ + protected function buildFrom($message) + { + if (! empty($this->from)) { + $message->from($this->from[0]['address'], $this->from[0]['name']); + } + + return $this; + } + + /** + * Add all of the recipients to the message. + * + * @param \Illuminate\Mail\Message $message + * @return $this + */ + protected function buildRecipients($message) + { + foreach (['to', 'cc', 'bcc', 'replyTo'] as $type) { + foreach ($this->{$type} as $recipient) { + $message->{$type}($recipient['address'], $recipient['name']); + } + } + + return $this; + } + + /** + * Set the subject for the message. + * + * @param \Illuminate\Mail\Message $message + * @return $this + */ + protected function buildSubject($message) + { + if ($this->subject) { + $message->subject($this->subject); + } else { + $message->subject(Str::title(Str::snake(class_basename($this), ' '))); + } + + return $this; + } + + /** + * Add all of the attachments to the message. + * + * @param \Illuminate\Mail\Message $message + * @return $this + */ + protected function buildAttachments($message) + { + foreach ($this->attachments as $attachment) { + $message->attach($attachment['file'], $attachment['options']); + } + + foreach ($this->rawAttachments as $attachment) { + $message->attachData( + $attachment['data'], $attachment['name'], $attachment['options'] + ); + } + + $this->buildDiskAttachments($message); + + return $this; + } + + /** + * Add all of the disk attachments to the message. + * + * @param \Illuminate\Mail\Message $message + * @return void + */ + protected function buildDiskAttachments($message) + { + foreach ($this->diskAttachments as $attachment) { + $storage = Container::getInstance()->make( + FilesystemFactory::class + )->disk($attachment['disk']); + + $message->attachData( + $storage->get($attachment['path']), + $attachment['name'] ?? basename($attachment['path']), + array_merge(['mime' => $storage->mimeType($attachment['path'])], $attachment['options']) + ); + } + } + + /** + * Run the callbacks for the message. + * + * @param \Illuminate\Mail\Message $message + * @return $this + */ + protected function runCallbacks($message) + { + foreach ($this->callbacks as $callback) { + $callback($message->getSwiftMessage()); + } + + return $this; + } + + /** + * Set the locale of the message. + * + * @param string $locale + * @return $this + */ + public function locale($locale) + { + $this->locale = $locale; + + return $this; + } + + /** + * Set the priority of this message. + * + * The value is an integer where 1 is the highest priority and 5 is the lowest. + * + * @param int $level + * @return $this + */ + public function priority($level = 3) + { + $this->callbacks[] = function ($message) use ($level) { + $message->setPriority($level); + }; + + return $this; + } + + /** + * Set the sender of the message. + * + * @param object|array|string $address + * @param string|null $name + * @return $this + */ + public function from($address, $name = null) + { + return $this->setAddress($address, $name, 'from'); + } + + /** + * Determine if the given recipient is set on the mailable. + * + * @param object|array|string $address + * @param string|null $name + * @return bool + */ + public function hasFrom($address, $name = null) + { + return $this->hasRecipient($address, $name, 'from'); + } + + /** + * Set the recipients of the message. + * + * @param object|array|string $address + * @param string|null $name + * @return $this + */ + public function to($address, $name = null) + { + return $this->setAddress($address, $name, 'to'); + } + + /** + * Determine if the given recipient is set on the mailable. + * + * @param object|array|string $address + * @param string|null $name + * @return bool + */ + public function hasTo($address, $name = null) + { + return $this->hasRecipient($address, $name, 'to'); + } + + /** + * Set the recipients of the message. + * + * @param object|array|string $address + * @param string|null $name + * @return $this + */ + public function cc($address, $name = null) + { + return $this->setAddress($address, $name, 'cc'); + } + + /** + * Determine if the given recipient is set on the mailable. + * + * @param object|array|string $address + * @param string|null $name + * @return bool + */ + public function hasCc($address, $name = null) + { + return $this->hasRecipient($address, $name, 'cc'); + } + + /** + * Set the recipients of the message. + * + * @param object|array|string $address + * @param string|null $name + * @return $this + */ + public function bcc($address, $name = null) + { + return $this->setAddress($address, $name, 'bcc'); + } + + /** + * Determine if the given recipient is set on the mailable. + * + * @param object|array|string $address + * @param string|null $name + * @return bool + */ + public function hasBcc($address, $name = null) + { + return $this->hasRecipient($address, $name, 'bcc'); + } + + /** + * Set the "reply to" address of the message. + * + * @param object|array|string $address + * @param string|null $name + * @return $this + */ + public function replyTo($address, $name = null) + { + return $this->setAddress($address, $name, 'replyTo'); + } + + /** + * Determine if the given replyTo is set on the mailable. + * + * @param object|array|string $address + * @param string|null $name + * @return bool + */ + public function hasReplyTo($address, $name = null) + { + return $this->hasRecipient($address, $name, 'replyTo'); + } + + /** + * Set the recipients of the message. + * + * All recipients are stored internally as [['name' => ?, 'address' => ?]] + * + * @param object|array|string $address + * @param string|null $name + * @param string $property + * @return $this + */ + protected function setAddress($address, $name = null, $property = 'to') + { + foreach ($this->addressesToArray($address, $name) as $recipient) { + $recipient = $this->normalizeRecipient($recipient); + + $this->{$property}[] = [ + 'name' => $recipient->name ?? null, + 'address' => $recipient->email, + ]; + } + + return $this; + } + + /** + * Convert the given recipient arguments to an array. + * + * @param object|array|string $address + * @param string|null $name + * @return array + */ + protected function addressesToArray($address, $name) + { + if (! is_array($address) && ! $address instanceof Collection) { + $address = is_string($name) ? [['name' => $name, 'email' => $address]] : [$address]; + } + + return $address; + } + + /** + * Convert the given recipient into an object. + * + * @param mixed $recipient + * @return object + */ + protected function normalizeRecipient($recipient) + { + if (is_array($recipient)) { + return (object) $recipient; + } elseif (is_string($recipient)) { + return (object) ['email' => $recipient]; + } + + return $recipient; + } + + /** + * Determine if the given recipient is set on the mailable. + * + * @param object|array|string $address + * @param string|null $name + * @param string $property + * @return bool + */ + protected function hasRecipient($address, $name = null, $property = 'to') + { + $expected = $this->normalizeRecipient( + $this->addressesToArray($address, $name)[0] + ); + + $expected = [ + 'name' => $expected->name ?? null, + 'address' => $expected->email, + ]; + + return collect($this->{$property})->contains(function ($actual) use ($expected) { + if (! isset($expected['name'])) { + return $actual['address'] == $expected['address']; + } + + return $actual == $expected; + }); + } + + /** + * Set the subject of the message. + * + * @param string $subject + * @return $this + */ + public function subject($subject) + { + $this->subject = $subject; + + return $this; + } + + /** + * Set the Markdown template for the message. + * + * @param string $view + * @param array $data + * @return $this + */ + public function markdown($view, array $data = []) + { + $this->markdown = $view; + $this->viewData = array_merge($this->viewData, $data); + + return $this; + } + + /** + * Set the view and view data for the message. + * + * @param string $view + * @param array $data + * @return $this + */ + public function view($view, array $data = []) + { + $this->view = $view; + $this->viewData = array_merge($this->viewData, $data); + + return $this; + } + + /** + * Set the rendered HTML content for the message. + * + * @param string $html + * @return $this + */ + public function html($html) + { + $this->html = $html; + + return $this; + } + + /** + * Set the plain text view for the message. + * + * @param string $textView + * @param array $data + * @return $this + */ + public function text($textView, array $data = []) + { + $this->textView = $textView; + $this->viewData = array_merge($this->viewData, $data); + + return $this; + } + + /** + * Set the view data for the message. + * + * @param string|array $key + * @param mixed $value + * @return $this + */ + public function with($key, $value = null) + { + if (is_array($key)) { + $this->viewData = array_merge($this->viewData, $key); + } else { + $this->viewData[$key] = $value; + } + + return $this; + } + + /** + * Attach a file to the message. + * + * @param string $file + * @param array $options + * @return $this + */ + public function attach($file, array $options = []) + { + $this->attachments[] = compact('file', 'options'); + + return $this; + } + + /** + * Attach a file to the message from storage. + * + * @param string $path + * @param string $name + * @param array $options + * @return $this + */ + public function attachFromStorage($path, $name = null, array $options = []) + { + return $this->attachFromStorageDisk(null, $path, $name, $options); + } + + /** + * Attach a file to the message from storage. + * + * @param string $disk + * @param string $path + * @param string $name + * @param array $options + * @return $this + */ + public function attachFromStorageDisk($disk, $path, $name = null, array $options = []) + { + $this->diskAttachments[] = [ + 'disk' => $disk, + 'path' => $path, + 'name' => $name ?? basename($path), + 'options' => $options, + ]; + + return $this; + } + + /** + * Attach in-memory data as an attachment. + * + * @param string $data + * @param string $name + * @param array $options + * @return $this + */ + public function attachData($data, $name, array $options = []) + { + $this->rawAttachments[] = compact('data', 'name', 'options'); + + return $this; + } + + /** + * Register a callback to be called with the Swift message instance. + * + * @param callable $callback + * @return $this + */ + public function withSwiftMessage($callback) + { + $this->callbacks[] = $callback; + + return $this; + } + + /** + * Register a callback to be called while building the view data. + * + * @param callable $callback + * @return void + */ + public static function buildViewDataUsing(callable $callback) + { + static::$viewDataCallback = $callback; + } + + /** + * Dynamically bind parameters to the message. + * + * @param string $method + * @param array $parameters + * @return $this + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (Str::startsWith($method, 'with')) { + return $this->with(Str::camel(substr($method, 4)), $parameters[0]); + } + + static::throwBadMethodCallException($method); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php b/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php new file mode 100755 index 0000000..cb56d04 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php @@ -0,0 +1,584 @@ +views = $views; + $this->swift = $swift; + $this->events = $events; + } + + /** + * Set the global from address and name. + * + * @param string $address + * @param string|null $name + * @return void + */ + public function alwaysFrom($address, $name = null) + { + $this->from = compact('address', 'name'); + } + + /** + * Set the global reply-to address and name. + * + * @param string $address + * @param string|null $name + * @return void + */ + public function alwaysReplyTo($address, $name = null) + { + $this->replyTo = compact('address', 'name'); + } + + /** + * Set the global to address and name. + * + * @param string $address + * @param string|null $name + * @return void + */ + public function alwaysTo($address, $name = null) + { + $this->to = compact('address', 'name'); + } + + /** + * Begin the process of mailing a mailable class instance. + * + * @param mixed $users + * @return \Illuminate\Mail\PendingMail + */ + public function to($users) + { + return (new PendingMail($this))->to($users); + } + + /** + * Begin the process of mailing a mailable class instance. + * + * @param mixed $users + * @return \Illuminate\Mail\PendingMail + */ + public function cc($users) + { + return (new PendingMail($this))->cc($users); + } + + /** + * Begin the process of mailing a mailable class instance. + * + * @param mixed $users + * @return \Illuminate\Mail\PendingMail + */ + public function bcc($users) + { + return (new PendingMail($this))->bcc($users); + } + + /** + * Send a new message with only an HTML part. + * + * @param string $html + * @param mixed $callback + * @return void + */ + public function html($html, $callback) + { + return $this->send(['html' => new HtmlString($html)], [], $callback); + } + + /** + * Send a new message when only a raw text part. + * + * @param string $text + * @param mixed $callback + * @return void + */ + public function raw($text, $callback) + { + return $this->send(['raw' => $text], [], $callback); + } + + /** + * Send a new message when only a plain part. + * + * @param string $view + * @param array $data + * @param mixed $callback + * @return void + */ + public function plain($view, array $data, $callback) + { + return $this->send(['text' => $view], $data, $callback); + } + + /** + * Render the given message as a view. + * + * @param string|array $view + * @param array $data + * @return string + */ + public function render($view, array $data = []) + { + // First we need to parse the view, which could either be a string or an array + // containing both an HTML and plain text versions of the view which should + // be used when sending an e-mail. We will extract both of them out here. + [$view, $plain, $raw] = $this->parseView($view); + + $data['message'] = $this->createMessage(); + + return $this->renderView($view ?: $plain, $data); + } + + /** + * Send a new message using a view. + * + * @param string|array|\Illuminate\Contracts\Mail\Mailable $view + * @param array $data + * @param \Closure|string $callback + * @return void + */ + public function send($view, array $data = [], $callback = null) + { + if ($view instanceof MailableContract) { + return $this->sendMailable($view); + } + + // First we need to parse the view, which could either be a string or an array + // containing both an HTML and plain text versions of the view which should + // be used when sending an e-mail. We will extract both of them out here. + [$view, $plain, $raw] = $this->parseView($view); + + $data['message'] = $message = $this->createMessage(); + + // Once we have retrieved the view content for the e-mail we will set the body + // of this message using the HTML type, which will provide a simple wrapper + // to creating view based emails that are able to receive arrays of data. + call_user_func($callback, $message); + + $this->addContent($message, $view, $plain, $raw, $data); + + // If a global "to" address has been set, we will set that address on the mail + // message. This is primarily useful during local development in which each + // message should be delivered into a single mail address for inspection. + if (isset($this->to['address'])) { + $this->setGlobalToAndRemoveCcAndBcc($message); + } + + // Next we will determine if the message should be sent. We give the developer + // one final chance to stop this message and then we will send it to all of + // its recipients. We will then fire the sent event for the sent message. + $swiftMessage = $message->getSwiftMessage(); + + if ($this->shouldSendMessage($swiftMessage, $data)) { + $this->sendSwiftMessage($swiftMessage); + + $this->dispatchSentEvent($message, $data); + } + } + + /** + * Send the given mailable. + * + * @param \Illuminate\Contracts\Mail\Mailable $mailable + * @return mixed + */ + protected function sendMailable(MailableContract $mailable) + { + return $mailable instanceof ShouldQueue + ? $mailable->queue($this->queue) : $mailable->send($this); + } + + /** + * Parse the given view name or array. + * + * @param string|array $view + * @return array + * + * @throws \InvalidArgumentException + */ + protected function parseView($view) + { + if (is_string($view)) { + return [$view, null, null]; + } + + // If the given view is an array with numeric keys, we will just assume that + // both a "pretty" and "plain" view were provided, so we will return this + // array as is, since it should contain both views with numerical keys. + if (is_array($view) && isset($view[0])) { + return [$view[0], $view[1], null]; + } + + // If this view is an array but doesn't contain numeric keys, we will assume + // the views are being explicitly specified and will extract them via the + // named keys instead, allowing the developers to use one or the other. + if (is_array($view)) { + return [ + $view['html'] ?? null, + $view['text'] ?? null, + $view['raw'] ?? null, + ]; + } + + throw new InvalidArgumentException('Invalid view.'); + } + + /** + * Add the content to a given message. + * + * @param \Illuminate\Mail\Message $message + * @param string $view + * @param string $plain + * @param string $raw + * @param array $data + * @return void + */ + protected function addContent($message, $view, $plain, $raw, $data) + { + if (isset($view)) { + $message->setBody($this->renderView($view, $data), 'text/html'); + } + + if (isset($plain)) { + $method = isset($view) ? 'addPart' : 'setBody'; + + $message->$method($this->renderView($plain, $data), 'text/plain'); + } + + if (isset($raw)) { + $method = (isset($view) || isset($plain)) ? 'addPart' : 'setBody'; + + $message->$method($raw, 'text/plain'); + } + } + + /** + * Render the given view. + * + * @param string $view + * @param array $data + * @return string + */ + protected function renderView($view, $data) + { + return $view instanceof Htmlable + ? $view->toHtml() + : $this->views->make($view, $data)->render(); + } + + /** + * Set the global "to" address on the given message. + * + * @param \Illuminate\Mail\Message $message + * @return void + */ + protected function setGlobalToAndRemoveCcAndBcc($message) + { + $message->to($this->to['address'], $this->to['name'], true); + $message->cc(null, null, true); + $message->bcc(null, null, true); + } + + /** + * Queue a new e-mail message for sending. + * + * @param string|array|\Illuminate\Contracts\Mail\Mailable $view + * @param string|null $queue + * @return mixed + * + * @throws \InvalidArgumentException + */ + public function queue($view, $queue = null) + { + if (! $view instanceof MailableContract) { + throw new InvalidArgumentException('Only mailables may be queued.'); + } + + return $view->queue(is_null($queue) ? $this->queue : $queue); + } + + /** + * Queue a new e-mail message for sending on the given queue. + * + * @param string $queue + * @param string|array $view + * @return mixed + */ + public function onQueue($queue, $view) + { + return $this->queue($view, $queue); + } + + /** + * Queue a new e-mail message for sending on the given queue. + * + * This method didn't match rest of framework's "onQueue" phrasing. Added "onQueue". + * + * @param string $queue + * @param string|array $view + * @return mixed + */ + public function queueOn($queue, $view) + { + return $this->onQueue($queue, $view); + } + + /** + * Queue a new e-mail message for sending after (n) seconds. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string|array|\Illuminate\Contracts\Mail\Mailable $view + * @param string|null $queue + * @return mixed + * + * @throws \InvalidArgumentException + */ + public function later($delay, $view, $queue = null) + { + if (! $view instanceof MailableContract) { + throw new InvalidArgumentException('Only mailables may be queued.'); + } + + return $view->later($delay, is_null($queue) ? $this->queue : $queue); + } + + /** + * Queue a new e-mail message for sending after (n) seconds on the given queue. + * + * @param string $queue + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string|array $view + * @return mixed + */ + public function laterOn($queue, $delay, $view) + { + return $this->later($delay, $view, $queue); + } + + /** + * Create a new message instance. + * + * @return \Illuminate\Mail\Message + */ + protected function createMessage() + { + $message = new Message($this->swift->createMessage('message')); + + // If a global from address has been specified we will set it on every message + // instance so the developer does not have to repeat themselves every time + // they create a new message. We'll just go ahead and push this address. + if (! empty($this->from['address'])) { + $message->from($this->from['address'], $this->from['name']); + } + + // When a global reply address was specified we will set this on every message + // instance so the developer does not have to repeat themselves every time + // they create a new message. We will just go ahead and push this address. + if (! empty($this->replyTo['address'])) { + $message->replyTo($this->replyTo['address'], $this->replyTo['name']); + } + + return $message; + } + + /** + * Send a Swift Message instance. + * + * @param \Swift_Message $message + * @return int|null + */ + protected function sendSwiftMessage($message) + { + try { + return $this->swift->send($message, $this->failedRecipients); + } finally { + $this->forceReconnection(); + } + } + + /** + * Determines if the message can be sent. + * + * @param \Swift_Message $message + * @param array $data + * @return bool + */ + protected function shouldSendMessage($message, $data = []) + { + if (! $this->events) { + return true; + } + + return $this->events->until( + new Events\MessageSending($message, $data) + ) !== false; + } + + /** + * Dispatch the message sent event. + * + * @param \Illuminate\Mail\Message $message + * @param array $data + * @return void + */ + protected function dispatchSentEvent($message, $data = []) + { + if ($this->events) { + $this->events->dispatch( + new Events\MessageSent($message->getSwiftMessage(), $data) + ); + } + } + + /** + * Force the transport to re-connect. + * + * This will prevent errors in daemon queue situations. + * + * @return void + */ + protected function forceReconnection() + { + $this->getSwiftMailer()->getTransport()->stop(); + } + + /** + * Get the view factory instance. + * + * @return \Illuminate\Contracts\View\Factory + */ + public function getViewFactory() + { + return $this->views; + } + + /** + * Get the Swift Mailer instance. + * + * @return \Swift_Mailer + */ + public function getSwiftMailer() + { + return $this->swift; + } + + /** + * Get the array of failed recipients. + * + * @return array + */ + public function failures() + { + return $this->failedRecipients; + } + + /** + * Set the Swift Mailer instance. + * + * @param \Swift_Mailer $swift + * @return void + */ + public function setSwiftMailer($swift) + { + $this->swift = $swift; + } + + /** + * Set the queue manager instance. + * + * @param \Illuminate\Contracts\Queue\Factory $queue + * @return $this + */ + public function setQueue(QueueContract $queue) + { + $this->queue = $queue; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Markdown.php b/vendor/laravel/framework/src/Illuminate/Mail/Markdown.php new file mode 100644 index 0000000..ab9ed3e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Markdown.php @@ -0,0 +1,160 @@ +view = $view; + $this->theme = $options['theme'] ?? 'default'; + $this->loadComponentsFrom($options['paths'] ?? []); + } + + /** + * Render the Markdown template into HTML. + * + * @param string $view + * @param array $data + * @param \TijsVerkoyen\CssToInlineStyles\CssToInlineStyles|null $inliner + * @return \Illuminate\Support\HtmlString + */ + public function render($view, array $data = [], $inliner = null) + { + $this->view->flushFinderCache(); + + $contents = $this->view->replaceNamespace( + 'mail', $this->htmlComponentPaths() + )->make($view, $data)->render(); + + return new HtmlString(($inliner ?: new CssToInlineStyles)->convert( + $contents, $this->view->make('mail::themes.'.$this->theme)->render() + )); + } + + /** + * Render the Markdown template into HTML. + * + * @param string $view + * @param array $data + * @return \Illuminate\Support\HtmlString + */ + public function renderText($view, array $data = []) + { + $this->view->flushFinderCache(); + + $contents = $this->view->replaceNamespace( + 'mail', $this->markdownComponentPaths() + )->make($view, $data)->render(); + + return new HtmlString( + html_entity_decode(preg_replace("/[\r\n]{2,}/", "\n\n", $contents), ENT_QUOTES, 'UTF-8') + ); + } + + /** + * Parse the given Markdown text into HTML. + * + * @param string $text + * @return \Illuminate\Support\HtmlString + */ + public static function parse($text) + { + $parsedown = new Parsedown; + + return new HtmlString($parsedown->text($text)); + } + + /** + * Get the HTML component paths. + * + * @return array + */ + public function htmlComponentPaths() + { + return array_map(function ($path) { + return $path.'/html'; + }, $this->componentPaths()); + } + + /** + * Get the Markdown component paths. + * + * @return array + */ + public function markdownComponentPaths() + { + return array_map(function ($path) { + return $path.'/markdown'; + }, $this->componentPaths()); + } + + /** + * Get the component paths. + * + * @return array + */ + protected function componentPaths() + { + return array_unique(array_merge($this->componentPaths, [ + __DIR__.'/resources/views', + ])); + } + + /** + * Register new mail component paths. + * + * @param array $paths + * @return void + */ + public function loadComponentsFrom(array $paths = []) + { + $this->componentPaths = $paths; + } + + /** + * Set the default theme to be used. + * + * @param string $theme + * @return $this + */ + public function theme($theme) + { + $this->theme = $theme; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Message.php b/vendor/laravel/framework/src/Illuminate/Mail/Message.php new file mode 100755 index 0000000..94c9dce --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Message.php @@ -0,0 +1,329 @@ +swift = $swift; + } + + /** + * Add a "from" address to the message. + * + * @param string|array $address + * @param string|null $name + * @return $this + */ + public function from($address, $name = null) + { + $this->swift->setFrom($address, $name); + + return $this; + } + + /** + * Set the "sender" of the message. + * + * @param string|array $address + * @param string|null $name + * @return $this + */ + public function sender($address, $name = null) + { + $this->swift->setSender($address, $name); + + return $this; + } + + /** + * Set the "return path" of the message. + * + * @param string $address + * @return $this + */ + public function returnPath($address) + { + $this->swift->setReturnPath($address); + + return $this; + } + + /** + * Add a recipient to the message. + * + * @param string|array $address + * @param string|null $name + * @param bool $override + * @return $this + */ + public function to($address, $name = null, $override = false) + { + if ($override) { + $this->swift->setTo($address, $name); + + return $this; + } + + return $this->addAddresses($address, $name, 'To'); + } + + /** + * Add a carbon copy to the message. + * + * @param string|array $address + * @param string|null $name + * @param bool $override + * @return $this + */ + public function cc($address, $name = null, $override = false) + { + if ($override) { + $this->swift->setCc($address, $name); + + return $this; + } + + return $this->addAddresses($address, $name, 'Cc'); + } + + /** + * Add a blind carbon copy to the message. + * + * @param string|array $address + * @param string|null $name + * @param bool $override + * @return $this + */ + public function bcc($address, $name = null, $override = false) + { + if ($override) { + $this->swift->setBcc($address, $name); + + return $this; + } + + return $this->addAddresses($address, $name, 'Bcc'); + } + + /** + * Add a reply to address to the message. + * + * @param string|array $address + * @param string|null $name + * @return $this + */ + public function replyTo($address, $name = null) + { + return $this->addAddresses($address, $name, 'ReplyTo'); + } + + /** + * Add a recipient to the message. + * + * @param string|array $address + * @param string $name + * @param string $type + * @return $this + */ + protected function addAddresses($address, $name, $type) + { + if (is_array($address)) { + $this->swift->{"set{$type}"}($address, $name); + } else { + $this->swift->{"add{$type}"}($address, $name); + } + + return $this; + } + + /** + * Set the subject of the message. + * + * @param string $subject + * @return $this + */ + public function subject($subject) + { + $this->swift->setSubject($subject); + + return $this; + } + + /** + * Set the message priority level. + * + * @param int $level + * @return $this + */ + public function priority($level) + { + $this->swift->setPriority($level); + + return $this; + } + + /** + * Attach a file to the message. + * + * @param string $file + * @param array $options + * @return $this + */ + public function attach($file, array $options = []) + { + $attachment = $this->createAttachmentFromPath($file); + + return $this->prepAttachment($attachment, $options); + } + + /** + * Create a Swift Attachment instance. + * + * @param string $file + * @return \Swift_Mime_Attachment + */ + protected function createAttachmentFromPath($file) + { + return Swift_Attachment::fromPath($file); + } + + /** + * Attach in-memory data as an attachment. + * + * @param string $data + * @param string $name + * @param array $options + * @return $this + */ + public function attachData($data, $name, array $options = []) + { + $attachment = $this->createAttachmentFromData($data, $name); + + return $this->prepAttachment($attachment, $options); + } + + /** + * Create a Swift Attachment instance from data. + * + * @param string $data + * @param string $name + * @return \Swift_Attachment + */ + protected function createAttachmentFromData($data, $name) + { + return new Swift_Attachment($data, $name); + } + + /** + * Embed a file in the message and get the CID. + * + * @param string $file + * @return string + */ + public function embed($file) + { + if (isset($this->embeddedFiles[$file])) { + return $this->embeddedFiles[$file]; + } + + return $this->embeddedFiles[$file] = $this->swift->embed( + Swift_Image::fromPath($file) + ); + } + + /** + * Embed in-memory data in the message and get the CID. + * + * @param string $data + * @param string $name + * @param string|null $contentType + * @return string + */ + public function embedData($data, $name, $contentType = null) + { + $image = new Swift_Image($data, $name, $contentType); + + return $this->swift->embed($image); + } + + /** + * Prepare and attach the given attachment. + * + * @param \Swift_Attachment $attachment + * @param array $options + * @return $this + */ + protected function prepAttachment($attachment, $options = []) + { + // First we will check for a MIME type on the message, which instructs the + // mail client on what type of attachment the file is so that it may be + // downloaded correctly by the user. The MIME option is not required. + if (isset($options['mime'])) { + $attachment->setContentType($options['mime']); + } + + // If an alternative name was given as an option, we will set that on this + // attachment so that it will be downloaded with the desired names from + // the developer, otherwise the default file names will get assigned. + if (isset($options['as'])) { + $attachment->setFilename($options['as']); + } + + $this->swift->attach($attachment); + + return $this; + } + + /** + * Get the underlying Swift Message instance. + * + * @return \Swift_Message + */ + public function getSwiftMessage() + { + return $this->swift; + } + + /** + * Dynamically pass missing methods to the Swift instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->forwardCallTo($this->swift, $method, $parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php b/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php new file mode 100644 index 0000000..512eaaf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php @@ -0,0 +1,180 @@ +mailer = $mailer; + } + + /** + * Set the locale of the message. + * + * @param string $locale + * @return $this + */ + public function locale($locale) + { + $this->locale = $locale; + + return $this; + } + + /** + * Set the recipients of the message. + * + * @param mixed $users + * @return $this + */ + public function to($users) + { + $this->to = $users; + + if (! $this->locale && $users instanceof HasLocalePreference) { + $this->locale($users->preferredLocale()); + } + + return $this; + } + + /** + * Set the recipients of the message. + * + * @param mixed $users + * @return $this + */ + public function cc($users) + { + $this->cc = $users; + + return $this; + } + + /** + * Set the recipients of the message. + * + * @param mixed $users + * @return $this + */ + public function bcc($users) + { + $this->bcc = $users; + + return $this; + } + + /** + * Send a new mailable message instance. + * + * @param \Illuminate\Mail\Mailable $mailable + * @return mixed + */ + public function send(Mailable $mailable) + { + if ($mailable instanceof ShouldQueue) { + return $this->queue($mailable); + } + + return $this->mailer->send($this->fill($mailable)); + } + + /** + * Send a mailable message immediately. + * + * @param \Illuminate\Mail\Mailable $mailable + * @return mixed + */ + public function sendNow(Mailable $mailable) + { + return $this->mailer->send($this->fill($mailable)); + } + + /** + * Push the given mailable onto the queue. + * + * @param \Illuminate\Mail\Mailable $mailable + * @return mixed + */ + public function queue(Mailable $mailable) + { + $mailable = $this->fill($mailable); + + if (isset($mailable->delay)) { + return $this->mailer->later($mailable->delay, $mailable); + } + + return $this->mailer->queue($mailable); + } + + /** + * Deliver the queued message after the given delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param \Illuminate\Mail\Mailable $mailable + * @return mixed + */ + public function later($delay, Mailable $mailable) + { + return $this->mailer->later($delay, $this->fill($mailable)); + } + + /** + * Populate the mailable with the addresses. + * + * @param \Illuminate\Mail\Mailable $mailable + * @return \Illuminate\Mail\Mailable + */ + protected function fill(Mailable $mailable) + { + return $mailable->to($this->to) + ->cc($this->cc) + ->bcc($this->bcc) + ->locale($this->locale); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/SendQueuedMailable.php b/vendor/laravel/framework/src/Illuminate/Mail/SendQueuedMailable.php new file mode 100644 index 0000000..e9e256d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/SendQueuedMailable.php @@ -0,0 +1,87 @@ +mailable = $mailable; + $this->tries = property_exists($mailable, 'tries') ? $mailable->tries : null; + $this->timeout = property_exists($mailable, 'timeout') ? $mailable->timeout : null; + } + + /** + * Handle the queued job. + * + * @param \Illuminate\Contracts\Mail\Mailer $mailer + * @return void + */ + public function handle(MailerContract $mailer) + { + $this->mailable->send($mailer); + } + + /** + * Get the display name for the queued job. + * + * @return string + */ + public function displayName() + { + return get_class($this->mailable); + } + + /** + * Call the failed method on the mailable instance. + * + * @param \Exception $e + * @return void + */ + public function failed($e) + { + if (method_exists($this->mailable, 'failed')) { + $this->mailable->failed($e); + } + } + + /** + * Prepare the instance for cloning. + * + * @return void + */ + public function __clone() + { + $this->mailable = clone $this->mailable; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Transport/ArrayTransport.php b/vendor/laravel/framework/src/Illuminate/Mail/Transport/ArrayTransport.php new file mode 100644 index 0000000..766af83 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Transport/ArrayTransport.php @@ -0,0 +1,58 @@ +messages = new Collection; + } + + /** + * {@inheritdoc} + */ + public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) + { + $this->beforeSendPerformed($message); + + $this->messages[] = $message; + + return $this->numberOfRecipients($message); + } + + /** + * Retrieve the collection of messages. + * + * @return \Illuminate\Support\Collection + */ + public function messages() + { + return $this->messages; + } + + /** + * Clear all of the messages from the local collection. + * + * @return \Illuminate\Support\Collection + */ + public function flush() + { + return $this->messages = new Collection; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php b/vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php new file mode 100644 index 0000000..273fb78 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php @@ -0,0 +1,59 @@ +logger = $logger; + } + + /** + * {@inheritdoc} + */ + public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) + { + $this->beforeSendPerformed($message); + + $this->logger->debug($this->getMimeEntityString($message)); + + $this->sendPerformed($message); + + return $this->numberOfRecipients($message); + } + + /** + * Get a loggable string out of a Swiftmailer entity. + * + * @param \Swift_Mime_SimpleMimeEntity $entity + * @return string + */ + protected function getMimeEntityString(Swift_Mime_SimpleMimeEntity $entity) + { + $string = (string) $entity->getHeaders().PHP_EOL.$entity->getBody(); + + foreach ($entity->getChildren() as $children) { + $string .= PHP_EOL.PHP_EOL.$this->getMimeEntityString($children); + } + + return $string; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php b/vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php new file mode 100644 index 0000000..73dfb56 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php @@ -0,0 +1,173 @@ +key = $key; + $this->client = $client; + $this->endpoint = $endpoint ?? 'api.mailgun.net'; + + $this->setDomain($domain); + } + + /** + * {@inheritdoc} + */ + public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) + { + $this->beforeSendPerformed($message); + + $to = $this->getTo($message); + + $message->setBcc([]); + + $this->client->request( + 'POST', + "https://{$this->endpoint}/v3/{$this->domain}/messages.mime", + $this->payload($message, $to) + ); + + $this->sendPerformed($message); + + return $this->numberOfRecipients($message); + } + + /** + * Get the HTTP payload for sending the Mailgun message. + * + * @param \Swift_Mime_SimpleMessage $message + * @param string $to + * @return array + */ + protected function payload(Swift_Mime_SimpleMessage $message, $to) + { + return [ + 'auth' => [ + 'api', + $this->key, + ], + 'multipart' => [ + [ + 'name' => 'to', + 'contents' => $to, + ], + [ + 'name' => 'message', + 'contents' => $message->toString(), + 'filename' => 'message.mime', + ], + ], + ]; + } + + /** + * Get the "to" payload field for the API request. + * + * @param \Swift_Mime_SimpleMessage $message + * @return string + */ + protected function getTo(Swift_Mime_SimpleMessage $message) + { + return collect($this->allContacts($message))->map(function ($display, $address) { + return $display ? $display." <{$address}>" : $address; + })->values()->implode(','); + } + + /** + * Get all of the contacts for the message. + * + * @param \Swift_Mime_SimpleMessage $message + * @return array + */ + protected function allContacts(Swift_Mime_SimpleMessage $message) + { + return array_merge( + (array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc() + ); + } + + /** + * Get the API key being used by the transport. + * + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * Set the API key being used by the transport. + * + * @param string $key + * @return string + */ + public function setKey($key) + { + return $this->key = $key; + } + + /** + * Get the domain being used by the transport. + * + * @return string + */ + public function getDomain() + { + return $this->domain; + } + + /** + * Set the domain being used by the transport. + * + * @param string $domain + * @return string + */ + public function setDomain($domain) + { + return $this->domain = $domain; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php b/vendor/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php new file mode 100644 index 0000000..e8e6ae1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php @@ -0,0 +1,105 @@ +key = $key; + $this->client = $client; + } + + /** + * {@inheritdoc} + */ + public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) + { + $this->beforeSendPerformed($message); + + $this->client->request('POST', 'https://mandrillapp.com/api/1.0/messages/send-raw.json', [ + 'form_params' => [ + 'key' => $this->key, + 'to' => $this->getTo($message), + 'raw_message' => $message->toString(), + 'async' => true, + ], + ]); + + $this->sendPerformed($message); + + return $this->numberOfRecipients($message); + } + + /** + * Get all the addresses this message should be sent to. + * + * Note that Mandrill still respects CC, BCC headers in raw message itself. + * + * @param \Swift_Mime_SimpleMessage $message + * @return array + */ + protected function getTo(Swift_Mime_SimpleMessage $message) + { + $to = []; + + if ($message->getTo()) { + $to = array_merge($to, array_keys($message->getTo())); + } + + if ($message->getCc()) { + $to = array_merge($to, array_keys($message->getCc())); + } + + if ($message->getBcc()) { + $to = array_merge($to, array_keys($message->getBcc())); + } + + return $to; + } + + /** + * Get the API key being used by the transport. + * + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * Set the API key being used by the transport. + * + * @param string $key + * @return string + */ + public function setKey($key) + { + return $this->key = $key; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php b/vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php new file mode 100644 index 0000000..00e92bc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php @@ -0,0 +1,82 @@ +ses = $ses; + $this->options = $options; + } + + /** + * {@inheritdoc} + */ + public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) + { + $this->beforeSendPerformed($message); + + $result = $this->ses->sendRawEmail( + array_merge( + $this->options, [ + 'Source' => key($message->getSender() ?: $message->getFrom()), + 'RawMessage' => [ + 'Data' => $message->toString(), + ], + ] + ) + ); + + $message->getHeaders()->addTextHeader('X-SES-Message-ID', $result->get('MessageId')); + + $this->sendPerformed($message); + + return $this->numberOfRecipients($message); + } + + /** + * Get the transmission options being used by the transport. + * + * @return array + */ + public function getOptions() + { + return $this->options; + } + + /** + * Set the transmission options being used by the transport. + * + * @param array $options + * @return array + */ + public function setOptions(array $options) + { + return $this->options = $options; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Transport/SparkPostTransport.php b/vendor/laravel/framework/src/Illuminate/Mail/Transport/SparkPostTransport.php new file mode 100644 index 0000000..a2358f1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Transport/SparkPostTransport.php @@ -0,0 +1,169 @@ +key = $key; + $this->client = $client; + $this->options = $options; + } + + /** + * {@inheritdoc} + */ + public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) + { + $this->beforeSendPerformed($message); + + $recipients = $this->getRecipients($message); + + $message->setBcc([]); + + $response = $this->client->request('POST', $this->getEndpoint(), [ + 'headers' => [ + 'Authorization' => $this->key, + ], + 'json' => array_merge([ + 'recipients' => $recipients, + 'content' => [ + 'email_rfc822' => $message->toString(), + ], + ], $this->options), + ]); + + $message->getHeaders()->addTextHeader( + 'X-SparkPost-Transmission-ID', $this->getTransmissionId($response) + ); + + $this->sendPerformed($message); + + return $this->numberOfRecipients($message); + } + + /** + * Get all the addresses this message should be sent to. + * + * Note that SparkPost still respects CC, BCC headers in raw message itself. + * + * @param \Swift_Mime_SimpleMessage $message + * @return array + */ + protected function getRecipients(Swift_Mime_SimpleMessage $message) + { + $recipients = []; + + foreach ((array) $message->getTo() as $email => $name) { + $recipients[] = ['address' => compact('name', 'email')]; + } + + foreach ((array) $message->getCc() as $email => $name) { + $recipients[] = ['address' => compact('name', 'email')]; + } + + foreach ((array) $message->getBcc() as $email => $name) { + $recipients[] = ['address' => compact('name', 'email')]; + } + + return $recipients; + } + + /** + * Get the transmission ID from the response. + * + * @param \GuzzleHttp\Psr7\Response $response + * @return string + */ + protected function getTransmissionId($response) + { + return object_get( + json_decode($response->getBody()->getContents()), 'results.id' + ); + } + + /** + * Get the API key being used by the transport. + * + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * Set the API key being used by the transport. + * + * @param string $key + * @return string + */ + public function setKey($key) + { + return $this->key = $key; + } + + /** + * Get the SparkPost API endpoint. + * + * @return string + */ + public function getEndpoint() + { + return $this->getOptions()['endpoint'] ?? 'https://api.sparkpost.com/api/v1/transmissions'; + } + + /** + * Get the transmission options being used by the transport. + * + * @return array + */ + public function getOptions() + { + return $this->options; + } + + /** + * Set the transmission options being used by the transport. + * + * @param array $options + * @return array + */ + public function setOptions(array $options) + { + return $this->options = $options; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Transport/Transport.php b/vendor/laravel/framework/src/Illuminate/Mail/Transport/Transport.php new file mode 100644 index 0000000..bc25749 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/Transport/Transport.php @@ -0,0 +1,108 @@ +plugins, $plugin); + } + + /** + * Iterate through registered plugins and execute plugins' methods. + * + * @param \Swift_Mime_SimpleMessage $message + * @return void + */ + protected function beforeSendPerformed(Swift_Mime_SimpleMessage $message) + { + $event = new Swift_Events_SendEvent($this, $message); + + foreach ($this->plugins as $plugin) { + if (method_exists($plugin, 'beforeSendPerformed')) { + $plugin->beforeSendPerformed($event); + } + } + } + + /** + * Iterate through registered plugins and execute plugins' methods. + * + * @param \Swift_Mime_SimpleMessage $message + * @return void + */ + protected function sendPerformed(Swift_Mime_SimpleMessage $message) + { + $event = new Swift_Events_SendEvent($this, $message); + + foreach ($this->plugins as $plugin) { + if (method_exists($plugin, 'sendPerformed')) { + $plugin->sendPerformed($event); + } + } + } + + /** + * Get the number of recipients. + * + * @param \Swift_Mime_SimpleMessage $message + * @return int + */ + protected function numberOfRecipients(Swift_Mime_SimpleMessage $message) + { + return count(array_merge( + (array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc() + )); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php b/vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php new file mode 100644 index 0000000..5ccfb3e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php @@ -0,0 +1,215 @@ +app->make('config')->get('mail'); + + // The Swift SMTP transport instance will allow us to use any SMTP backend + // for delivering mail such as Sendgrid, Amazon SES, or a custom server + // a developer has available. We will just pass this configured host. + $transport = new SmtpTransport($config['host'], $config['port']); + + if (isset($config['encryption'])) { + $transport->setEncryption($config['encryption']); + } + + // Once we have the transport we will check for the presence of a username + // and password. If we have it we will set the credentials on the Swift + // transporter instance so that we'll properly authenticate delivery. + if (isset($config['username'])) { + $transport->setUsername($config['username']); + + $transport->setPassword($config['password']); + } + + // Next we will set any stream context options specified for the transport + // and then return it. The option is not required any may not be inside + // the configuration array at all so we'll verify that before adding. + if (isset($config['stream'])) { + $transport->setStreamOptions($config['stream']); + } + + return $transport; + } + + /** + * Create an instance of the Sendmail Swift Transport driver. + * + * @return \Swift_SendmailTransport + */ + protected function createSendmailDriver() + { + return new SendmailTransport($this->app['config']['mail']['sendmail']); + } + + /** + * Create an instance of the Amazon SES Swift Transport driver. + * + * @return \Illuminate\Mail\Transport\SesTransport + */ + protected function createSesDriver() + { + $config = array_merge($this->app['config']->get('services.ses', []), [ + 'version' => 'latest', 'service' => 'email', + ]); + + return new SesTransport( + new SesClient($this->addSesCredentials($config)), + $config['options'] ?? [] + ); + } + + /** + * Add the SES credentials to the configuration array. + * + * @param array $config + * @return array + */ + protected function addSesCredentials(array $config) + { + if ($config['key'] && $config['secret']) { + $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']); + } + + return $config; + } + + /** + * Create an instance of the Mail Swift Transport driver. + * + * @return \Swift_SendmailTransport + */ + protected function createMailDriver() + { + return new SendmailTransport; + } + + /** + * Create an instance of the Mailgun Swift Transport driver. + * + * @return \Illuminate\Mail\Transport\MailgunTransport + */ + protected function createMailgunDriver() + { + $config = $this->app['config']->get('services.mailgun', []); + + return new MailgunTransport( + $this->guzzle($config), + $config['secret'], + $config['domain'], + $config['endpoint'] ?? null + ); + } + + /** + * Create an instance of the Mandrill Swift Transport driver. + * + * @return \Illuminate\Mail\Transport\MandrillTransport + */ + protected function createMandrillDriver() + { + $config = $this->app['config']->get('services.mandrill', []); + + return new MandrillTransport( + $this->guzzle($config), $config['secret'] + ); + } + + /** + * Create an instance of the SparkPost Swift Transport driver. + * + * @return \Illuminate\Mail\Transport\SparkPostTransport + */ + protected function createSparkPostDriver() + { + $config = $this->app['config']->get('services.sparkpost', []); + + return new SparkPostTransport( + $this->guzzle($config), $config['secret'], $config['options'] ?? [] + ); + } + + /** + * Create an instance of the Log Swift Transport driver. + * + * @return \Illuminate\Mail\Transport\LogTransport + */ + protected function createLogDriver() + { + $logger = $this->app->make(LoggerInterface::class); + + if ($logger instanceof LogManager) { + $logger = $logger->channel($this->app['config']['mail.log_channel']); + } + + return new LogTransport($logger); + } + + /** + * Create an instance of the Array Swift Transport Driver. + * + * @return \Illuminate\Mail\Transport\ArrayTransport + */ + protected function createArrayDriver() + { + return new ArrayTransport; + } + + /** + * Get a fresh Guzzle HTTP client instance. + * + * @param array $config + * @return \GuzzleHttp\Client + */ + protected function guzzle($config) + { + return new HttpClient(Arr::add( + $config['guzzle'] ?? [], 'connect_timeout', 60 + )); + } + + /** + * Get the default mail driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['mail.driver']; + } + + /** + * Set the default mail driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['mail.driver'] = $name; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/composer.json b/vendor/laravel/framework/src/Illuminate/Mail/composer.json new file mode 100755 index 0000000..d07f513 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/composer.json @@ -0,0 +1,44 @@ +{ + "name": "illuminate/mail", + "description": "The Illuminate Mail package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "erusev/parsedown": "^1.7", + "illuminate/container": "5.7.*", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*", + "psr/log": "^1.0", + "swiftmailer/swiftmailer": "^6.0", + "tijsverkoyen/css-to-inline-styles": "^2.2.1" + }, + "autoload": { + "psr-4": { + "Illuminate\\Mail\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "suggest": { + "aws/aws-sdk-php": "Required to use the SES mail driver (^3.0).", + "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers (^6.0)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/button.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/button.blade.php new file mode 100644 index 0000000..9d14d9b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/button.blade.php @@ -0,0 +1,19 @@ + + + + +
+ + + + +
+ + + + +
+ {{ $slot }} +
+
+
diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/footer.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/footer.blade.php new file mode 100644 index 0000000..c3f9360 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/footer.blade.php @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/header.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/header.blade.php new file mode 100644 index 0000000..eefabab --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/header.blade.php @@ -0,0 +1,7 @@ + + + + {{ $slot }} + + + diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/layout.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/layout.blade.php new file mode 100644 index 0000000..859900a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/layout.blade.php @@ -0,0 +1,54 @@ + + + + + + + + + + + + + +
+ + {{ $header ?? '' }} + + + + + + + {{ $footer ?? '' }} +
+ + + + + +
+ {{ Illuminate\Mail\Markdown::parse($slot) }} + + {{ $subcopy ?? '' }} +
+
+
+ + diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/message.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/message.blade.php new file mode 100644 index 0000000..1ae9ed8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/message.blade.php @@ -0,0 +1,27 @@ +@component('mail::layout') + {{-- Header --}} + @slot('header') + @component('mail::header', ['url' => config('app.url')]) + {{ config('app.name') }} + @endcomponent + @endslot + + {{-- Body --}} + {{ $slot }} + + {{-- Subcopy --}} + @isset($subcopy) + @slot('subcopy') + @component('mail::subcopy') + {{ $subcopy }} + @endcomponent + @endslot + @endisset + + {{-- Footer --}} + @slot('footer') + @component('mail::footer') + © {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') + @endcomponent + @endslot +@endcomponent diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/panel.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/panel.blade.php new file mode 100644 index 0000000..f397080 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/panel.blade.php @@ -0,0 +1,13 @@ + + + + +
+ + + + +
+ {{ Illuminate\Mail\Markdown::parse($slot) }} +
+
diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion.blade.php new file mode 100644 index 0000000..0debcf8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion.blade.php @@ -0,0 +1,7 @@ + + + + +
+ {{ Illuminate\Mail\Markdown::parse($slot) }} +
diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion/button.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion/button.blade.php new file mode 100644 index 0000000..8e79081 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion/button.blade.php @@ -0,0 +1,13 @@ + + + + +
+ + + + +
+ {{ $slot }} +
+
diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/subcopy.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/subcopy.blade.php new file mode 100644 index 0000000..c3df7b4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/subcopy.blade.php @@ -0,0 +1,7 @@ + + + + +
+ {{ Illuminate\Mail\Markdown::parse($slot) }} +
diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/table.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/table.blade.php new file mode 100644 index 0000000..a5f3348 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/table.blade.php @@ -0,0 +1,3 @@ +
+{{ Illuminate\Mail\Markdown::parse($slot) }} +
diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/themes/default.css b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/themes/default.css new file mode 100644 index 0000000..aa4afb2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/themes/default.css @@ -0,0 +1,290 @@ +/* Base */ + +body, body *:not(html):not(style):not(br):not(tr):not(code) { + font-family: Avenir, Helvetica, sans-serif; + box-sizing: border-box; +} + +body { + background-color: #f5f8fa; + color: #74787E; + height: 100%; + hyphens: auto; + line-height: 1.4; + margin: 0; + -moz-hyphens: auto; + -ms-word-break: break-all; + width: 100% !important; + -webkit-hyphens: auto; + -webkit-text-size-adjust: none; + word-break: break-all; + word-break: break-word; +} + +p, +ul, +ol, +blockquote { + line-height: 1.4; + text-align: left; +} + +a { + color: #3869D4; +} + +a img { + border: none; +} + +/* Typography */ + +h1 { + color: #2F3133; + font-size: 19px; + font-weight: bold; + margin-top: 0; + text-align: left; +} + +h2 { + color: #2F3133; + font-size: 16px; + font-weight: bold; + margin-top: 0; + text-align: left; +} + +h3 { + color: #2F3133; + font-size: 14px; + font-weight: bold; + margin-top: 0; + text-align: left; +} + +p { + color: #74787E; + font-size: 16px; + line-height: 1.5em; + margin-top: 0; + text-align: left; +} + +p.sub { + font-size: 12px; +} + +img { + max-width: 100%; +} + +/* Layout */ + +.wrapper { + background-color: #f5f8fa; + margin: 0; + padding: 0; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.content { + margin: 0; + padding: 0; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +/* Header */ + +.header { + padding: 25px 0; + text-align: center; +} + +.header a { + color: #bbbfc3; + font-size: 19px; + font-weight: bold; + text-decoration: none; + text-shadow: 0 1px 0 white; +} + +/* Body */ + +.body { + background-color: #FFFFFF; + border-bottom: 1px solid #EDEFF2; + border-top: 1px solid #EDEFF2; + margin: 0; + padding: 0; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.inner-body { + background-color: #FFFFFF; + margin: 0 auto; + padding: 0; + width: 570px; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 570px; +} + +/* Subcopy */ + +.subcopy { + border-top: 1px solid #EDEFF2; + margin-top: 25px; + padding-top: 25px; +} + +.subcopy p { + font-size: 12px; +} + +/* Footer */ + +.footer { + margin: 0 auto; + padding: 0; + text-align: center; + width: 570px; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 570px; +} + +.footer p { + color: #AEAEAE; + font-size: 12px; + text-align: center; +} + +/* Tables */ + +.table table { + margin: 30px auto; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.table th { + border-bottom: 1px solid #EDEFF2; + padding-bottom: 8px; + margin: 0; +} + +.table td { + color: #74787E; + font-size: 15px; + line-height: 18px; + padding: 10px 0; + margin: 0; +} + +.content-cell { + padding: 35px; +} + +/* Buttons */ + +.action { + margin: 30px auto; + padding: 0; + text-align: center; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.button { + border-radius: 3px; + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16); + color: #FFF; + display: inline-block; + text-decoration: none; + -webkit-text-size-adjust: none; +} + +.button-blue, +.button-primary { + background-color: #3097D1; + border-top: 10px solid #3097D1; + border-right: 18px solid #3097D1; + border-bottom: 10px solid #3097D1; + border-left: 18px solid #3097D1; +} + +.button-green, +.button-success { + background-color: #2ab27b; + border-top: 10px solid #2ab27b; + border-right: 18px solid #2ab27b; + border-bottom: 10px solid #2ab27b; + border-left: 18px solid #2ab27b; +} + +.button-red, +.button-error { + background-color: #bf5329; + border-top: 10px solid #bf5329; + border-right: 18px solid #bf5329; + border-bottom: 10px solid #bf5329; + border-left: 18px solid #bf5329; +} + +/* Panels */ + +.panel { + margin: 0 0 21px; +} + +.panel-content { + background-color: #EDEFF2; + padding: 16px; +} + +.panel-item { + padding: 0; +} + +.panel-item p:last-of-type { + margin-bottom: 0; + padding-bottom: 0; +} + +/* Promotions */ + +.promotion { + background-color: #FFFFFF; + border: 2px dashed #9BA2AB; + margin: 0; + margin-bottom: 25px; + margin-top: 25px; + padding: 24px; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.promotion h1 { + text-align: center; +} + +.promotion p { + font-size: 15px; + text-align: center; +} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/button.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/button.blade.php new file mode 100644 index 0000000..97444eb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/button.blade.php @@ -0,0 +1 @@ +{{ $slot }}: {{ $url }} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/footer.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/footer.blade.php new file mode 100644 index 0000000..3338f62 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/footer.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/header.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/header.blade.php new file mode 100644 index 0000000..aaa3e57 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/header.blade.php @@ -0,0 +1 @@ +[{{ $slot }}]({{ $url }}) diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/layout.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/layout.blade.php new file mode 100644 index 0000000..9378baa --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/layout.blade.php @@ -0,0 +1,9 @@ +{!! strip_tags($header) !!} + +{!! strip_tags($slot) !!} +@isset($subcopy) + +{!! strip_tags($subcopy) !!} +@endisset + +{!! strip_tags($footer) !!} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/message.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/message.blade.php new file mode 100644 index 0000000..1ae9ed8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/message.blade.php @@ -0,0 +1,27 @@ +@component('mail::layout') + {{-- Header --}} + @slot('header') + @component('mail::header', ['url' => config('app.url')]) + {{ config('app.name') }} + @endcomponent + @endslot + + {{-- Body --}} + {{ $slot }} + + {{-- Subcopy --}} + @isset($subcopy) + @slot('subcopy') + @component('mail::subcopy') + {{ $subcopy }} + @endcomponent + @endslot + @endisset + + {{-- Footer --}} + @slot('footer') + @component('mail::footer') + © {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') + @endcomponent + @endslot +@endcomponent diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/panel.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/panel.blade.php new file mode 100644 index 0000000..3338f62 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/panel.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/promotion.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/promotion.blade.php new file mode 100644 index 0000000..3338f62 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/promotion.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/promotion/button.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/promotion/button.blade.php new file mode 100644 index 0000000..aaa3e57 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/promotion/button.blade.php @@ -0,0 +1 @@ +[{{ $slot }}]({{ $url }}) diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/subcopy.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/subcopy.blade.php new file mode 100644 index 0000000..3338f62 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/subcopy.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/table.blade.php b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/table.blade.php new file mode 100644 index 0000000..3338f62 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/table.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Action.php b/vendor/laravel/framework/src/Illuminate/Notifications/Action.php new file mode 100644 index 0000000..071db2d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Action.php @@ -0,0 +1,33 @@ +url = $url; + $this->text = $text; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/AnonymousNotifiable.php b/vendor/laravel/framework/src/Illuminate/Notifications/AnonymousNotifiable.php new file mode 100644 index 0000000..d820239 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/AnonymousNotifiable.php @@ -0,0 +1,72 @@ +routes[$channel] = $route; + + return $this; + } + + /** + * Send the given notification. + * + * @param mixed $notification + * @return void + */ + public function notify($notification) + { + app(Dispatcher::class)->send($this, $notification); + } + + /** + * Send the given notification immediately. + * + * @param mixed $notification + * @return void + */ + public function notifyNow($notification) + { + app(Dispatcher::class)->sendNow($this, $notification); + } + + /** + * Get the notification routing information for the given driver. + * + * @param string $driver + * @return mixed + */ + public function routeNotificationFor($driver) + { + return $this->routes[$driver] ?? null; + } + + /** + * Get the value of the notifiable's primary key. + * + * @return mixed + */ + public function getKey() + { + // + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php b/vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php new file mode 100644 index 0000000..7a89146 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php @@ -0,0 +1,162 @@ +app->make(Bus::class), $this->app->make(Dispatcher::class), $this->locale) + )->send($notifiables, $notification); + } + + /** + * Send the given notification immediately. + * + * @param \Illuminate\Support\Collection|array|mixed $notifiables + * @param mixed $notification + * @param array|null $channels + * @return void + */ + public function sendNow($notifiables, $notification, array $channels = null) + { + return (new NotificationSender( + $this, $this->app->make(Bus::class), $this->app->make(Dispatcher::class), $this->locale) + )->sendNow($notifiables, $notification, $channels); + } + + /** + * Get a channel instance. + * + * @param string|null $name + * @return mixed + */ + public function channel($name = null) + { + return $this->driver($name); + } + + /** + * Create an instance of the database driver. + * + * @return \Illuminate\Notifications\Channels\DatabaseChannel + */ + protected function createDatabaseDriver() + { + return $this->app->make(Channels\DatabaseChannel::class); + } + + /** + * Create an instance of the broadcast driver. + * + * @return \Illuminate\Notifications\Channels\BroadcastChannel + */ + protected function createBroadcastDriver() + { + return $this->app->make(Channels\BroadcastChannel::class); + } + + /** + * Create an instance of the mail driver. + * + * @return \Illuminate\Notifications\Channels\MailChannel + */ + protected function createMailDriver() + { + return $this->app->make(Channels\MailChannel::class); + } + + /** + * Create a new driver instance. + * + * @param string $driver + * @return mixed + * + * @throws \InvalidArgumentException + */ + protected function createDriver($driver) + { + try { + return parent::createDriver($driver); + } catch (InvalidArgumentException $e) { + if (class_exists($driver)) { + return $this->app->make($driver); + } + + throw $e; + } + } + + /** + * Get the default channel driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->defaultChannel; + } + + /** + * Get the default channel driver name. + * + * @return string + */ + public function deliversVia() + { + return $this->getDefaultDriver(); + } + + /** + * Set the default channel driver name. + * + * @param string $channel + * @return void + */ + public function deliverVia($channel) + { + $this->defaultChannel = $channel; + } + + /** + * Set the locale of notifications. + * + * @param string $locale + * @return $this + */ + public function locale($locale) + { + $this->locale = $locale; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Channels/BroadcastChannel.php b/vendor/laravel/framework/src/Illuminate/Notifications/Channels/BroadcastChannel.php new file mode 100644 index 0000000..d3f5861 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Channels/BroadcastChannel.php @@ -0,0 +1,75 @@ +events = $events; + } + + /** + * Send the given notification. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @return array|null + */ + public function send($notifiable, Notification $notification) + { + $message = $this->getData($notifiable, $notification); + + $event = new BroadcastNotificationCreated( + $notifiable, $notification, is_array($message) ? $message : $message->data + ); + + if ($message instanceof BroadcastMessage) { + $event->onConnection($message->connection) + ->onQueue($message->queue); + } + + return $this->events->dispatch($event); + } + + /** + * Get the data for the notification. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @return mixed + * + * @throws \RuntimeException + */ + protected function getData($notifiable, Notification $notification) + { + if (method_exists($notification, 'toBroadcast')) { + return $notification->toBroadcast($notifiable); + } + + if (method_exists($notification, 'toArray')) { + return $notification->toArray($notifiable); + } + + throw new RuntimeException('Notification is missing toArray method.'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Channels/DatabaseChannel.php b/vendor/laravel/framework/src/Illuminate/Notifications/Channels/DatabaseChannel.php new file mode 100644 index 0000000..1019e5a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Channels/DatabaseChannel.php @@ -0,0 +1,63 @@ +routeNotificationFor('database', $notification)->create( + $this->buildPayload($notifiable, $notification) + ); + } + + /** + * Get the data for the notification. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @return array + * + * @throws \RuntimeException + */ + protected function getData($notifiable, Notification $notification) + { + if (method_exists($notification, 'toDatabase')) { + return is_array($data = $notification->toDatabase($notifiable)) + ? $data : $data->data; + } + + if (method_exists($notification, 'toArray')) { + return $notification->toArray($notifiable); + } + + throw new RuntimeException('Notification is missing toDatabase / toArray method.'); + } + + /** + * Build an array payload for the DatabaseNotification Model. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @return array + */ + protected function buildPayload($notifiable, Notification $notification) + { + return [ + 'id' => $notification->id, + 'type' => get_class($notification), + 'data' => $this->getData($notifiable, $notification), + 'read_at' => null, + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php b/vendor/laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php new file mode 100644 index 0000000..f26319d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php @@ -0,0 +1,228 @@ +mailer = $mailer; + $this->markdown = $markdown; + } + + /** + * Send the given notification. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @return void + */ + public function send($notifiable, Notification $notification) + { + $message = $notification->toMail($notifiable); + + if (! $notifiable->routeNotificationFor('mail', $notification) && + ! $message instanceof Mailable) { + return; + } + + if ($message instanceof Mailable) { + return $message->send($this->mailer); + } + + $this->mailer->send( + $this->buildView($message), + array_merge($message->data(), $this->additionalMessageData($notification)), + $this->messageBuilder($notifiable, $notification, $message) + ); + } + + /** + * Get the mailer Closure for the message. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return \Closure + */ + protected function messageBuilder($notifiable, $notification, $message) + { + return function ($mailMessage) use ($notifiable, $notification, $message) { + $this->buildMessage($mailMessage, $notifiable, $notification, $message); + }; + } + + /** + * Build the notification's view. + * + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return string|array + */ + protected function buildView($message) + { + if ($message->view) { + return $message->view; + } + + return [ + 'html' => $this->markdown->render($message->markdown, $message->data()), + 'text' => $this->markdown->renderText($message->markdown, $message->data()), + ]; + } + + /** + * Get additional meta-data to pass along with the view data. + * + * @param \Illuminate\Notifications\Notification $notification + * @return array + */ + protected function additionalMessageData($notification) + { + return [ + '__laravel_notification' => get_class($notification), + '__laravel_notification_queued' => in_array( + ShouldQueue::class, class_implements($notification) + ), + ]; + } + + /** + * Build the mail message. + * + * @param \Illuminate\Mail\Message $mailMessage + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return void + */ + protected function buildMessage($mailMessage, $notifiable, $notification, $message) + { + $this->addressMessage($mailMessage, $notifiable, $notification, $message); + + $mailMessage->subject($message->subject ?: Str::title( + Str::snake(class_basename($notification), ' ') + )); + + $this->addAttachments($mailMessage, $message); + + if (! is_null($message->priority)) { + $mailMessage->setPriority($message->priority); + } + } + + /** + * Address the mail message. + * + * @param \Illuminate\Mail\Message $mailMessage + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return void + */ + protected function addressMessage($mailMessage, $notifiable, $notification, $message) + { + $this->addSender($mailMessage, $message); + + $mailMessage->to($this->getRecipients($notifiable, $notification, $message)); + + if (! empty($message->cc)) { + foreach ($message->cc as $cc) { + $mailMessage->cc($cc[0], Arr::get($cc, 1)); + } + } + + if (! empty($message->bcc)) { + foreach ($message->bcc as $bcc) { + $mailMessage->bcc($bcc[0], Arr::get($bcc, 1)); + } + } + } + + /** + * Add the "from" and "reply to" addresses to the message. + * + * @param \Illuminate\Mail\Message $mailMessage + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return void + */ + protected function addSender($mailMessage, $message) + { + if (! empty($message->from)) { + $mailMessage->from($message->from[0], Arr::get($message->from, 1)); + } + + if (! empty($message->replyTo)) { + foreach ($message->replyTo as $replyTo) { + $mailMessage->replyTo($replyTo[0], Arr::get($replyTo, 1)); + } + } + } + + /** + * Get the recipients of the given message. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return mixed + */ + protected function getRecipients($notifiable, $notification, $message) + { + if (is_string($recipients = $notifiable->routeNotificationFor('mail', $notification))) { + $recipients = [$recipients]; + } + + return collect($recipients)->mapWithKeys(function ($recipient, $email) { + return is_numeric($email) + ? [$email => (is_string($recipient) ? $recipient : $recipient->email)] + : [$email => $recipient]; + })->all(); + } + + /** + * Add the attachments to the message. + * + * @param \Illuminate\Mail\Message $mailMessage + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return void + */ + protected function addAttachments($mailMessage, $message) + { + foreach ($message->attachments as $attachment) { + $mailMessage->attach($attachment['file'], $attachment['options']); + } + + foreach ($message->rawAttachments as $attachment) { + $mailMessage->attachData($attachment['data'], $attachment['name'], $attachment['options']); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Console/NotificationTableCommand.php b/vendor/laravel/framework/src/Illuminate/Notifications/Console/NotificationTableCommand.php new file mode 100644 index 0000000..2398280 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Console/NotificationTableCommand.php @@ -0,0 +1,81 @@ +files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $fullPath = $this->createBaseMigration(); + + $this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/notifications.stub')); + + $this->info('Migration created successfully!'); + + $this->composer->dumpAutoloads(); + } + + /** + * Create a base migration file for the notifications. + * + * @return string + */ + protected function createBaseMigration() + { + $name = 'create_notifications_table'; + + $path = $this->laravel->databasePath().'/migrations'; + + return $this->laravel['migration.creator']->create($name, $path); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Console/stubs/notifications.stub b/vendor/laravel/framework/src/Illuminate/Notifications/Console/stubs/notifications.stub new file mode 100644 index 0000000..fb16d5b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Console/stubs/notifications.stub @@ -0,0 +1,35 @@ +uuid('id')->primary(); + $table->string('type'); + $table->morphs('notifiable'); + $table->text('data'); + $table->timestamp('read_at')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('notifications'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/DatabaseNotification.php b/vendor/laravel/framework/src/Illuminate/Notifications/DatabaseNotification.php new file mode 100644 index 0000000..1c1b6bb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/DatabaseNotification.php @@ -0,0 +1,102 @@ + 'array', + 'read_at' => 'datetime', + ]; + + /** + * Get the notifiable entity that the notification belongs to. + */ + public function notifiable() + { + return $this->morphTo(); + } + + /** + * Mark the notification as read. + * + * @return void + */ + public function markAsRead() + { + if (is_null($this->read_at)) { + $this->forceFill(['read_at' => $this->freshTimestamp()])->save(); + } + } + + /** + * Mark the notification as unread. + * + * @return void + */ + public function markAsUnread() + { + if (! is_null($this->read_at)) { + $this->forceFill(['read_at' => null])->save(); + } + } + + /** + * Determine if a notification has been read. + * + * @return bool + */ + public function read() + { + return $this->read_at !== null; + } + + /** + * Determine if a notification has not been read. + * + * @return bool + */ + public function unread() + { + return $this->read_at === null; + } + + /** + * Create a new database notification collection instance. + * + * @param array $models + * @return \Illuminate\Notifications\DatabaseNotificationCollection + */ + public function newCollection(array $models = []) + { + return new DatabaseNotificationCollection($models); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/DatabaseNotificationCollection.php b/vendor/laravel/framework/src/Illuminate/Notifications/DatabaseNotificationCollection.php new file mode 100644 index 0000000..fc7b470 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/DatabaseNotificationCollection.php @@ -0,0 +1,32 @@ +each(function ($notification) { + $notification->markAsRead(); + }); + } + + /** + * Mark all notifications as unread. + * + * @return void + */ + public function markAsUnread() + { + $this->each(function ($notification) { + $notification->markAsUnread(); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Events/BroadcastNotificationCreated.php b/vendor/laravel/framework/src/Illuminate/Notifications/Events/BroadcastNotificationCreated.php new file mode 100644 index 0000000..d58ae77 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Events/BroadcastNotificationCreated.php @@ -0,0 +1,106 @@ +data = $data; + $this->notifiable = $notifiable; + $this->notification = $notification; + } + + /** + * Get the channels the event should broadcast on. + * + * @return array + */ + public function broadcastOn() + { + $channels = $this->notification->broadcastOn(); + + if (! empty($channels)) { + return $channels; + } + + return [new PrivateChannel($this->channelName())]; + } + + /** + * Get the broadcast channel name for the event. + * + * @return string + */ + protected function channelName() + { + if (method_exists($this->notifiable, 'receivesBroadcastNotificationsOn')) { + return $this->notifiable->receivesBroadcastNotificationsOn($this->notification); + } + + $class = str_replace('\\', '.', get_class($this->notifiable)); + + return $class.'.'.$this->notifiable->getKey(); + } + + /** + * Get the data that should be sent with the broadcasted event. + * + * @return array + */ + public function broadcastWith() + { + return array_merge($this->data, [ + 'id' => $this->notification->id, + 'type' => $this->broadcastType(), + ]); + } + + /** + * Get the type of the notification being broadcast. + * + * @return string + */ + public function broadcastType() + { + return method_exists($this->notification, 'broadcastType') + ? $this->notification->broadcastType() + : get_class($this->notification); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationFailed.php b/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationFailed.php new file mode 100644 index 0000000..b69e1c5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationFailed.php @@ -0,0 +1,56 @@ +data = $data; + $this->channel = $channel; + $this->notifiable = $notifiable; + $this->notification = $notification; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationSending.php b/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationSending.php new file mode 100644 index 0000000..6efd1d0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationSending.php @@ -0,0 +1,47 @@ +channel = $channel; + $this->notifiable = $notifiable; + $this->notification = $notification; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationSent.php b/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationSent.php new file mode 100644 index 0000000..4f09069 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Events/NotificationSent.php @@ -0,0 +1,56 @@ +channel = $channel; + $this->response = $response; + $this->notifiable = $notifiable; + $this->notification = $notification; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/HasDatabaseNotifications.php b/vendor/laravel/framework/src/Illuminate/Notifications/HasDatabaseNotifications.php new file mode 100644 index 0000000..981d8e5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/HasDatabaseNotifications.php @@ -0,0 +1,36 @@ +morphMany(DatabaseNotification::class, 'notifiable')->orderBy('created_at', 'desc'); + } + + /** + * Get the entity's read notifications. + * + * @return \Illuminate\Database\Query\Builder + */ + public function readNotifications() + { + return $this->notifications()->whereNotNull('read_at'); + } + + /** + * Get the entity's unread notifications. + * + * @return \Illuminate\Database\Query\Builder + */ + public function unreadNotifications() + { + return $this->notifications()->whereNull('read_at'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Messages/BroadcastMessage.php b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/BroadcastMessage.php new file mode 100644 index 0000000..9884a8f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/BroadcastMessage.php @@ -0,0 +1,41 @@ +data = $data; + } + + /** + * Set the message data. + * + * @param array $data + * @return $this + */ + public function data($data) + { + $this->data = $data; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Messages/DatabaseMessage.php b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/DatabaseMessage.php new file mode 100644 index 0000000..55707a7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/DatabaseMessage.php @@ -0,0 +1,24 @@ +data = $data; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Messages/MailMessage.php b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/MailMessage.php new file mode 100644 index 0000000..c13f4ef --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/MailMessage.php @@ -0,0 +1,274 @@ +view = $view; + $this->viewData = $data; + + $this->markdown = null; + + return $this; + } + + /** + * Set the Markdown template for the notification. + * + * @param string $view + * @param array $data + * @return $this + */ + public function markdown($view, array $data = []) + { + $this->markdown = $view; + $this->viewData = $data; + + $this->view = null; + + return $this; + } + + /** + * Set the default markdown template. + * + * @param string $template + * @return $this + */ + public function template($template) + { + $this->markdown = $template; + + return $this; + } + + /** + * Set the from address for the mail message. + * + * @param string $address + * @param string|null $name + * @return $this + */ + public function from($address, $name = null) + { + $this->from = [$address, $name]; + + return $this; + } + + /** + * Set the "reply to" address of the message. + * + * @param array|string $address + * @param string|null $name + * @return $this + */ + public function replyTo($address, $name = null) + { + if ($this->arrayOfAddresses($address)) { + $this->replyTo += $this->parseAddresses($address); + } else { + $this->replyTo[] = [$address, $name]; + } + + return $this; + } + + /** + * Set the cc address for the mail message. + * + * @param array|string $address + * @param string|null $name + * @return $this + */ + public function cc($address, $name = null) + { + if ($this->arrayOfAddresses($address)) { + $this->cc += $this->parseAddresses($address); + } else { + $this->cc[] = [$address, $name]; + } + + return $this; + } + + /** + * Set the bcc address for the mail message. + * + * @param array|string $address + * @param string|null $name + * @return $this + */ + public function bcc($address, $name = null) + { + if ($this->arrayOfAddresses($address)) { + $this->bcc += $this->parseAddresses($address); + } else { + $this->bcc[] = [$address, $name]; + } + + return $this; + } + + /** + * Attach a file to the message. + * + * @param string $file + * @param array $options + * @return $this + */ + public function attach($file, array $options = []) + { + $this->attachments[] = compact('file', 'options'); + + return $this; + } + + /** + * Attach in-memory data as an attachment. + * + * @param string $data + * @param string $name + * @param array $options + * @return $this + */ + public function attachData($data, $name, array $options = []) + { + $this->rawAttachments[] = compact('data', 'name', 'options'); + + return $this; + } + + /** + * Set the priority of this message. + * + * The value is an integer where 1 is the highest priority and 5 is the lowest. + * + * @param int $level + * @return $this + */ + public function priority($level) + { + $this->priority = $level; + + return $this; + } + + /** + * Get the data array for the mail message. + * + * @return array + */ + public function data() + { + return array_merge($this->toArray(), $this->viewData); + } + + /** + * Parse the multi-address array into the necessary format. + * + * @param array $value + * @return array + */ + protected function parseAddresses($value) + { + return collect($value)->map(function ($address, $name) { + return [$address, is_numeric($name) ? null : $name]; + })->values()->all(); + } + + /** + * Determine if the given "address" is actually an array of addresses. + * + * @param mixed $address + * @return bool + */ + protected function arrayOfAddresses($address) + { + return is_array($address) || + $address instanceof Arrayable || + $address instanceof Traversable; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Messages/SimpleMessage.php b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/SimpleMessage.php new file mode 100644 index 0000000..395983c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Messages/SimpleMessage.php @@ -0,0 +1,224 @@ +level = 'success'; + + return $this; + } + + /** + * Indicate that the notification gives information about an error. + * + * @return $this + */ + public function error() + { + $this->level = 'error'; + + return $this; + } + + /** + * Set the "level" of the notification (success, error, etc.). + * + * @param string $level + * @return $this + */ + public function level($level) + { + $this->level = $level; + + return $this; + } + + /** + * Set the subject of the notification. + * + * @param string $subject + * @return $this + */ + public function subject($subject) + { + $this->subject = $subject; + + return $this; + } + + /** + * Set the greeting of the notification. + * + * @param string $greeting + * @return $this + */ + public function greeting($greeting) + { + $this->greeting = $greeting; + + return $this; + } + + /** + * Set the salutation of the notification. + * + * @param string $salutation + * @return $this + */ + public function salutation($salutation) + { + $this->salutation = $salutation; + + return $this; + } + + /** + * Add a line of text to the notification. + * + * @param mixed $line + * @return $this + */ + public function line($line) + { + return $this->with($line); + } + + /** + * Add a line of text to the notification. + * + * @param mixed $line + * @return $this + */ + public function with($line) + { + if ($line instanceof Action) { + $this->action($line->text, $line->url); + } elseif (! $this->actionText) { + $this->introLines[] = $this->formatLine($line); + } else { + $this->outroLines[] = $this->formatLine($line); + } + + return $this; + } + + /** + * Format the given line of text. + * + * @param \Illuminate\Contracts\Support\Htmlable|string|array $line + * @return \Illuminate\Contracts\Support\Htmlable|string + */ + protected function formatLine($line) + { + if ($line instanceof Htmlable) { + return $line; + } + + if (is_array($line)) { + return implode(' ', array_map('trim', $line)); + } + + return trim(implode(' ', array_map('trim', preg_split('/\\r\\n|\\r|\\n/', $line)))); + } + + /** + * Configure the "call to action" button. + * + * @param string $text + * @param string $url + * @return $this + */ + public function action($text, $url) + { + $this->actionText = $text; + $this->actionUrl = $url; + + return $this; + } + + /** + * Get an array representation of the message. + * + * @return array + */ + public function toArray() + { + return [ + 'level' => $this->level, + 'subject' => $this->subject, + 'greeting' => $this->greeting, + 'salutation' => $this->salutation, + 'introLines' => $this->introLines, + 'outroLines' => $this->outroLines, + 'actionText' => $this->actionText, + 'actionUrl' => $this->actionUrl, + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/Notifiable.php b/vendor/laravel/framework/src/Illuminate/Notifications/Notifiable.php new file mode 100644 index 0000000..82381e1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/Notifiable.php @@ -0,0 +1,8 @@ +locale = $locale; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php b/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php new file mode 100644 index 0000000..f75c6a8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php @@ -0,0 +1,216 @@ +bus = $bus; + $this->events = $events; + $this->manager = $manager; + $this->locale = $locale; + } + + /** + * Send the given notification to the given notifiable entities. + * + * @param \Illuminate\Support\Collection|array|mixed $notifiables + * @param mixed $notification + * @return void + */ + public function send($notifiables, $notification) + { + $notifiables = $this->formatNotifiables($notifiables); + + if ($notification instanceof ShouldQueue) { + return $this->queueNotification($notifiables, $notification); + } + + return $this->sendNow($notifiables, $notification); + } + + /** + * Send the given notification immediately. + * + * @param \Illuminate\Support\Collection|array|mixed $notifiables + * @param mixed $notification + * @param array $channels + * @return void + */ + public function sendNow($notifiables, $notification, array $channels = null) + { + $notifiables = $this->formatNotifiables($notifiables); + + $original = clone $notification; + + foreach ($notifiables as $notifiable) { + if (empty($viaChannels = $channels ?: $notification->via($notifiable))) { + continue; + } + + $this->withLocale($this->preferredLocale($notifiable, $notification), function () use ($viaChannels, $notifiable, $original) { + $notificationId = Str::uuid()->toString(); + + foreach ((array) $viaChannels as $channel) { + $this->sendToNotifiable($notifiable, $notificationId, clone $original, $channel); + } + }); + } + } + + /** + * Get the notifiable's preferred locale for the notification. + * + * @param mixed $notifiable + * @param mixed $notification + * @return string|null + */ + protected function preferredLocale($notifiable, $notification) + { + return $notification->locale ?? $this->locale ?? value(function () use ($notifiable) { + if ($notifiable instanceof HasLocalePreference) { + return $notifiable->preferredLocale(); + } + }); + } + + /** + * Send the given notification to the given notifiable via a channel. + * + * @param mixed $notifiable + * @param string $id + * @param mixed $notification + * @param string $channel + * @return void + */ + protected function sendToNotifiable($notifiable, $id, $notification, $channel) + { + if (! $notification->id) { + $notification->id = $id; + } + + if (! $this->shouldSendNotification($notifiable, $notification, $channel)) { + return; + } + + $response = $this->manager->driver($channel)->send($notifiable, $notification); + + $this->events->dispatch( + new Events\NotificationSent($notifiable, $notification, $channel, $response) + ); + } + + /** + * Determines if the notification can be sent. + * + * @param mixed $notifiable + * @param mixed $notification + * @param string $channel + * @return bool + */ + protected function shouldSendNotification($notifiable, $notification, $channel) + { + return $this->events->until( + new Events\NotificationSending($notifiable, $notification, $channel) + ) !== false; + } + + /** + * Queue the given notification instances. + * + * @param mixed $notifiables + * @param array[\Illuminate\Notifications\Channels\Notification] $notification + * @return void + */ + protected function queueNotification($notifiables, $notification) + { + $notifiables = $this->formatNotifiables($notifiables); + + $original = clone $notification; + + foreach ($notifiables as $notifiable) { + $notificationId = Str::uuid()->toString(); + + foreach ($original->via($notifiable) as $channel) { + $notification = clone $original; + + $notification->id = $notificationId; + + if (! is_null($this->locale)) { + $notification->locale = $this->locale; + } + + $this->bus->dispatch( + (new SendQueuedNotifications($notifiable, $notification, [$channel])) + ->onConnection($notification->connection) + ->onQueue($notification->queue) + ->delay($notification->delay) + ); + } + } + } + + /** + * Format the notifiables into a Collection / array if necessary. + * + * @param mixed $notifiables + * @return \Illuminate\Database\Eloquent\Collection|array + */ + protected function formatNotifiables($notifiables) + { + if (! $notifiables instanceof Collection && ! is_array($notifiables)) { + return $notifiables instanceof Model + ? new ModelCollection([$notifiables]) : [$notifiables]; + } + + return $notifiables; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/NotificationServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Notifications/NotificationServiceProvider.php new file mode 100644 index 0000000..e8909f4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/NotificationServiceProvider.php @@ -0,0 +1,46 @@ +loadViewsFrom(__DIR__.'/resources/views', 'notifications'); + + if ($this->app->runningInConsole()) { + $this->publishes([ + __DIR__.'/resources/views' => $this->app->resourcePath('views/vendor/notifications'), + ], 'laravel-notifications'); + } + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton(ChannelManager::class, function ($app) { + return new ChannelManager($app); + }); + + $this->app->alias( + ChannelManager::class, DispatcherContract::class + ); + + $this->app->alias( + ChannelManager::class, FactoryContract::class + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/RoutesNotifications.php b/vendor/laravel/framework/src/Illuminate/Notifications/RoutesNotifications.php new file mode 100644 index 0000000..80df2ea --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/RoutesNotifications.php @@ -0,0 +1,55 @@ +send($this, $instance); + } + + /** + * Send the given notification immediately. + * + * @param mixed $instance + * @param array|null $channels + * @return void + */ + public function notifyNow($instance, array $channels = null) + { + app(Dispatcher::class)->sendNow($this, $instance, $channels); + } + + /** + * Get the notification routing information for the given driver. + * + * @param string $driver + * @param \Illuminate\Notifications\Notification|null $notification + * @return mixed + */ + public function routeNotificationFor($driver, $notification = null) + { + if (method_exists($this, $method = 'routeNotificationFor'.Str::studly($driver))) { + return $this->{$method}($notification); + } + + switch ($driver) { + case 'database': + return $this->notifications(); + case 'mail': + return $this->email; + case 'nexmo': + return $this->phone_number; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php b/vendor/laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php new file mode 100644 index 0000000..109650b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php @@ -0,0 +1,109 @@ +channels = $channels; + $this->notifiables = $notifiables; + $this->notification = $notification; + $this->tries = property_exists($notification, 'tries') ? $notification->tries : null; + $this->timeout = property_exists($notification, 'timeout') ? $notification->timeout : null; + } + + /** + * Send the notifications. + * + * @param \Illuminate\Notifications\ChannelManager $manager + * @return void + */ + public function handle(ChannelManager $manager) + { + $manager->sendNow($this->notifiables, $this->notification, $this->channels); + } + + /** + * Get the display name for the queued job. + * + * @return string + */ + public function displayName() + { + return get_class($this->notification); + } + + /** + * Call the failed method on the notification instance. + * + * @param \Exception $e + * @return void + */ + public function failed($e) + { + if (method_exists($this->notification, 'failed')) { + $this->notification->failed($e); + } + } + + /** + * Prepare the instance for cloning. + * + * @return void + */ + public function __clone() + { + $this->notifiables = clone $this->notifiables; + $this->notification = clone $this->notification; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/composer.json b/vendor/laravel/framework/src/Illuminate/Notifications/composer.json new file mode 100644 index 0000000..2eb0acc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/composer.json @@ -0,0 +1,46 @@ +{ + "name": "illuminate/notifications", + "description": "The Illuminate Notifications package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/broadcasting": "5.7.*", + "illuminate/bus": "5.7.*", + "illuminate/container": "5.7.*", + "illuminate/contracts": "5.7.*", + "illuminate/filesystem": "5.7.*", + "illuminate/mail": "5.7.*", + "illuminate/queue": "5.7.*", + "illuminate/support": "5.7.*", + "laravel/nexmo-notification-channel": "^1.0", + "laravel/slack-notification-channel": "^1.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Notifications\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "suggest": { + "illuminate/database": "Required to use the database transport (5.7.*)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Notifications/resources/views/email.blade.php b/vendor/laravel/framework/src/Illuminate/Notifications/resources/views/email.blade.php new file mode 100644 index 0000000..5e8073d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Notifications/resources/views/email.blade.php @@ -0,0 +1,62 @@ +@component('mail::message') +{{-- Greeting --}} +@if (! empty($greeting)) +# {{ $greeting }} +@else +@if ($level === 'error') +# @lang('Whoops!') +@else +# @lang('Hello!') +@endif +@endif + +{{-- Intro Lines --}} +@foreach ($introLines as $line) +{{ $line }} + +@endforeach + +{{-- Action Button --}} +@isset($actionText) + +@component('mail::button', ['url' => $actionUrl, 'color' => $color]) +{{ $actionText }} +@endcomponent +@endisset + +{{-- Outro Lines --}} +@foreach ($outroLines as $line) +{{ $line }} + +@endforeach + +{{-- Salutation --}} +@if (! empty($salutation)) +{{ $salutation }} +@else +@lang('Regards'),
{{ config('app.name') }} +@endif + +{{-- Subcopy --}} +@isset($actionText) +@component('mail::subcopy') +@lang( + "If you’re having trouble clicking the \":actionText\" button, copy and paste the URL below\n". + 'into your web browser: [:actionURL](:actionURL)', + [ + 'actionText' => $actionText, + 'actionURL' => $actionUrl, + ] +) +@endcomponent +@endisset +@endcomponent diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php b/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php new file mode 100644 index 0000000..1cf3a97 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php @@ -0,0 +1,642 @@ += 1 && filter_var($page, FILTER_VALIDATE_INT) !== false; + } + + /** + * Get the URL for the previous page. + * + * @return string|null + */ + public function previousPageUrl() + { + if ($this->currentPage() > 1) { + return $this->url($this->currentPage() - 1); + } + } + + /** + * Create a range of pagination URLs. + * + * @param int $start + * @param int $end + * @return array + */ + public function getUrlRange($start, $end) + { + return collect(range($start, $end))->mapWithKeys(function ($page) { + return [$page => $this->url($page)]; + })->all(); + } + + /** + * Get the URL for a given page number. + * + * @param int $page + * @return string + */ + public function url($page) + { + if ($page <= 0) { + $page = 1; + } + + // If we have any extra query string key / value pairs that need to be added + // onto the URL, we will put them in query string form and then attach it + // to the URL. This allows for extra information like sortings storage. + $parameters = [$this->pageName => $page]; + + if (count($this->query) > 0) { + $parameters = array_merge($this->query, $parameters); + } + + return $this->path + .(Str::contains($this->path, '?') ? '&' : '?') + .Arr::query($parameters) + .$this->buildFragment(); + } + + /** + * Get / set the URL fragment to be appended to URLs. + * + * @param string|null $fragment + * @return $this|string|null + */ + public function fragment($fragment = null) + { + if (is_null($fragment)) { + return $this->fragment; + } + + $this->fragment = $fragment; + + return $this; + } + + /** + * Add a set of query string values to the paginator. + * + * @param array|string|null $key + * @param string|null $value + * @return $this + */ + public function appends($key, $value = null) + { + if (is_null($key)) { + return $this; + } + + if (is_array($key)) { + return $this->appendArray($key); + } + + return $this->addQuery($key, $value); + } + + /** + * Add an array of query string values. + * + * @param array $keys + * @return $this + */ + protected function appendArray(array $keys) + { + foreach ($keys as $key => $value) { + $this->addQuery($key, $value); + } + + return $this; + } + + /** + * Add a query string value to the paginator. + * + * @param string $key + * @param string $value + * @return $this + */ + protected function addQuery($key, $value) + { + if ($key !== $this->pageName) { + $this->query[$key] = $value; + } + + return $this; + } + + /** + * Build the full fragment portion of a URL. + * + * @return string + */ + protected function buildFragment() + { + return $this->fragment ? '#'.$this->fragment : ''; + } + + /** + * Load a set of relationships onto the mixed relationship collection. + * + * @param string $relation + * @param array $relations + * @return $this + */ + public function loadMorph($relation, $relations) + { + $this->getCollection()->loadMorph($relation, $relations); + + return $this; + } + + /** + * Get the slice of items being paginated. + * + * @return array + */ + public function items() + { + return $this->items->all(); + } + + /** + * Get the number of the first item in the slice. + * + * @return int + */ + public function firstItem() + { + return count($this->items) > 0 ? ($this->currentPage - 1) * $this->perPage + 1 : null; + } + + /** + * Get the number of the last item in the slice. + * + * @return int + */ + public function lastItem() + { + return count($this->items) > 0 ? $this->firstItem() + $this->count() - 1 : null; + } + + /** + * Get the number of items shown per page. + * + * @return int + */ + public function perPage() + { + return $this->perPage; + } + + /** + * Determine if there are enough items to split into multiple pages. + * + * @return bool + */ + public function hasPages() + { + return $this->currentPage() != 1 || $this->hasMorePages(); + } + + /** + * Determine if the paginator is on the first page. + * + * @return bool + */ + public function onFirstPage() + { + return $this->currentPage() <= 1; + } + + /** + * Get the current page. + * + * @return int + */ + public function currentPage() + { + return $this->currentPage; + } + + /** + * Get the query string variable used to store the page. + * + * @return string + */ + public function getPageName() + { + return $this->pageName; + } + + /** + * Set the query string variable used to store the page. + * + * @param string $name + * @return $this + */ + public function setPageName($name) + { + $this->pageName = $name; + + return $this; + } + + /** + * Set the base path to assign to all URLs. + * + * @param string $path + * @return $this + */ + public function withPath($path) + { + return $this->setPath($path); + } + + /** + * Set the base path to assign to all URLs. + * + * @param string $path + * @return $this + */ + public function setPath($path) + { + $this->path = $path; + + return $this; + } + + /** + * Set the number of links to display on each side of current page link. + * + * @param int $count + * @return $this + */ + public function onEachSide($count) + { + $this->onEachSide = $count; + + return $this; + } + + /** + * Resolve the current request path or return the default value. + * + * @param string $default + * @return string + */ + public static function resolveCurrentPath($default = '/') + { + if (isset(static::$currentPathResolver)) { + return call_user_func(static::$currentPathResolver); + } + + return $default; + } + + /** + * Set the current request path resolver callback. + * + * @param \Closure $resolver + * @return void + */ + public static function currentPathResolver(Closure $resolver) + { + static::$currentPathResolver = $resolver; + } + + /** + * Resolve the current page or return the default value. + * + * @param string $pageName + * @param int $default + * @return int + */ + public static function resolveCurrentPage($pageName = 'page', $default = 1) + { + if (isset(static::$currentPageResolver)) { + return call_user_func(static::$currentPageResolver, $pageName); + } + + return $default; + } + + /** + * Set the current page resolver callback. + * + * @param \Closure $resolver + * @return void + */ + public static function currentPageResolver(Closure $resolver) + { + static::$currentPageResolver = $resolver; + } + + /** + * Get an instance of the view factory from the resolver. + * + * @return \Illuminate\Contracts\View\Factory + */ + public static function viewFactory() + { + return call_user_func(static::$viewFactoryResolver); + } + + /** + * Set the view factory resolver callback. + * + * @param \Closure $resolver + * @return void + */ + public static function viewFactoryResolver(Closure $resolver) + { + static::$viewFactoryResolver = $resolver; + } + + /** + * Set the default pagination view. + * + * @param string $view + * @return void + */ + public static function defaultView($view) + { + static::$defaultView = $view; + } + + /** + * Set the default "simple" pagination view. + * + * @param string $view + * @return void + */ + public static function defaultSimpleView($view) + { + static::$defaultSimpleView = $view; + } + + /** + * Indicate that Bootstrap 3 styling should be used for generated links. + * + * @return void + */ + public static function useBootstrapThree() + { + static::defaultView('pagination::default'); + static::defaultSimpleView('pagination::simple-default'); + } + + /** + * Get an iterator for the items. + * + * @return \ArrayIterator + */ + public function getIterator() + { + return $this->items->getIterator(); + } + + /** + * Determine if the list of items is empty. + * + * @return bool + */ + public function isEmpty() + { + return $this->items->isEmpty(); + } + + /** + * Determine if the list of items is not empty. + * + * @return bool + */ + public function isNotEmpty() + { + return $this->items->isNotEmpty(); + } + + /** + * Get the number of items for the current page. + * + * @return int + */ + public function count() + { + return $this->items->count(); + } + + /** + * Get the paginator's underlying collection. + * + * @return \Illuminate\Support\Collection + */ + public function getCollection() + { + return $this->items; + } + + /** + * Set the paginator's underlying collection. + * + * @param \Illuminate\Support\Collection $collection + * @return $this + */ + public function setCollection(Collection $collection) + { + $this->items = $collection; + + return $this; + } + + /** + * Determine if the given item exists. + * + * @param mixed $key + * @return bool + */ + public function offsetExists($key) + { + return $this->items->has($key); + } + + /** + * Get the item at the given offset. + * + * @param mixed $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->items->get($key); + } + + /** + * Set the item at the given offset. + * + * @param mixed $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + $this->items->put($key, $value); + } + + /** + * Unset the item at the given key. + * + * @param mixed $key + * @return void + */ + public function offsetUnset($key) + { + $this->items->forget($key); + } + + /** + * Render the contents of the paginator to HTML. + * + * @return string + */ + public function toHtml() + { + return (string) $this->render(); + } + + /** + * Make dynamic calls into the collection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->forwardCallTo($this->getCollection(), $method, $parameters); + } + + /** + * Render the contents of the paginator when casting to string. + * + * @return string + */ + public function __toString() + { + return (string) $this->render(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php b/vendor/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php new file mode 100644 index 0000000..5a7094e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/LengthAwarePaginator.php @@ -0,0 +1,199 @@ + $value) { + $this->{$key} = $value; + } + + $this->total = $total; + $this->perPage = $perPage; + $this->lastPage = max((int) ceil($total / $perPage), 1); + $this->path = $this->path !== '/' ? rtrim($this->path, '/') : $this->path; + $this->currentPage = $this->setCurrentPage($currentPage, $this->pageName); + $this->items = $items instanceof Collection ? $items : Collection::make($items); + } + + /** + * Get the current page for the request. + * + * @param int $currentPage + * @param string $pageName + * @return int + */ + protected function setCurrentPage($currentPage, $pageName) + { + $currentPage = $currentPage ?: static::resolveCurrentPage($pageName); + + return $this->isValidPageNumber($currentPage) ? (int) $currentPage : 1; + } + + /** + * Render the paginator using the given view. + * + * @param string|null $view + * @param array $data + * @return \Illuminate\Support\HtmlString + */ + public function links($view = null, $data = []) + { + return $this->render($view, $data); + } + + /** + * Render the paginator using the given view. + * + * @param string|null $view + * @param array $data + * @return \Illuminate\Support\HtmlString + */ + public function render($view = null, $data = []) + { + return new HtmlString(static::viewFactory()->make($view ?: static::$defaultView, array_merge($data, [ + 'paginator' => $this, + 'elements' => $this->elements(), + ]))->render()); + } + + /** + * Get the array of elements to pass to the view. + * + * @return array + */ + protected function elements() + { + $window = UrlWindow::make($this); + + return array_filter([ + $window['first'], + is_array($window['slider']) ? '...' : null, + $window['slider'], + is_array($window['last']) ? '...' : null, + $window['last'], + ]); + } + + /** + * Get the total number of items being paginated. + * + * @return int + */ + public function total() + { + return $this->total; + } + + /** + * Determine if there are more items in the data source. + * + * @return bool + */ + public function hasMorePages() + { + return $this->currentPage() < $this->lastPage(); + } + + /** + * Get the URL for the next page. + * + * @return string|null + */ + public function nextPageUrl() + { + if ($this->lastPage() > $this->currentPage()) { + return $this->url($this->currentPage() + 1); + } + } + + /** + * Get the last page. + * + * @return int + */ + public function lastPage() + { + return $this->lastPage; + } + + /** + * Get the instance as an array. + * + * @return array + */ + public function toArray() + { + return [ + 'current_page' => $this->currentPage(), + 'data' => $this->items->toArray(), + 'first_page_url' => $this->url(1), + 'from' => $this->firstItem(), + 'last_page' => $this->lastPage(), + 'last_page_url' => $this->url($this->lastPage()), + 'next_page_url' => $this->nextPageUrl(), + 'path' => $this->path, + 'per_page' => $this->perPage(), + 'prev_page_url' => $this->previousPageUrl(), + 'to' => $this->lastItem(), + 'total' => $this->total(), + ]; + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Convert the object to its JSON representation. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->jsonSerialize(), $options); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php new file mode 100755 index 0000000..ed58ccf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php @@ -0,0 +1,50 @@ +loadViewsFrom(__DIR__.'/resources/views', 'pagination'); + + if ($this->app->runningInConsole()) { + $this->publishes([ + __DIR__.'/resources/views' => $this->app->resourcePath('views/vendor/pagination'), + ], 'laravel-pagination'); + } + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + Paginator::viewFactoryResolver(function () { + return $this->app['view']; + }); + + Paginator::currentPathResolver(function () { + return $this->app['request']->url(); + }); + + Paginator::currentPageResolver(function ($pageName = 'page') { + $page = $this->app['request']->input($pageName); + + if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) { + return (int) $page; + } + + return 1; + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php b/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php new file mode 100644 index 0000000..a159d04 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php @@ -0,0 +1,177 @@ + $value) { + $this->{$key} = $value; + } + + $this->perPage = $perPage; + $this->currentPage = $this->setCurrentPage($currentPage); + $this->path = $this->path !== '/' ? rtrim($this->path, '/') : $this->path; + + $this->setItems($items); + } + + /** + * Get the current page for the request. + * + * @param int $currentPage + * @return int + */ + protected function setCurrentPage($currentPage) + { + $currentPage = $currentPage ?: static::resolveCurrentPage(); + + return $this->isValidPageNumber($currentPage) ? (int) $currentPage : 1; + } + + /** + * Set the items for the paginator. + * + * @param mixed $items + * @return void + */ + protected function setItems($items) + { + $this->items = $items instanceof Collection ? $items : Collection::make($items); + + $this->hasMore = $this->items->count() > $this->perPage; + + $this->items = $this->items->slice(0, $this->perPage); + } + + /** + * Get the URL for the next page. + * + * @return string|null + */ + public function nextPageUrl() + { + if ($this->hasMorePages()) { + return $this->url($this->currentPage() + 1); + } + } + + /** + * Render the paginator using the given view. + * + * @param string|null $view + * @param array $data + * @return string + */ + public function links($view = null, $data = []) + { + return $this->render($view, $data); + } + + /** + * Render the paginator using the given view. + * + * @param string|null $view + * @param array $data + * @return string + */ + public function render($view = null, $data = []) + { + return new HtmlString( + static::viewFactory()->make($view ?: static::$defaultSimpleView, array_merge($data, [ + 'paginator' => $this, + ]))->render() + ); + } + + /** + * Manually indicate that the paginator does have more pages. + * + * @param bool $hasMore + * @return $this + */ + public function hasMorePagesWhen($hasMore = true) + { + $this->hasMore = $hasMore; + + return $this; + } + + /** + * Determine if there are more items in the data source. + * + * @return bool + */ + public function hasMorePages() + { + return $this->hasMore; + } + + /** + * Get the instance as an array. + * + * @return array + */ + public function toArray() + { + return [ + 'current_page' => $this->currentPage(), + 'data' => $this->items->toArray(), + 'first_page_url' => $this->url(1), + 'from' => $this->firstItem(), + 'next_page_url' => $this->nextPageUrl(), + 'path' => $this->path, + 'per_page' => $this->perPage(), + 'prev_page_url' => $this->previousPageUrl(), + 'to' => $this->lastItem(), + ]; + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Convert the object to its JSON representation. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->jsonSerialize(), $options); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/UrlWindow.php b/vendor/laravel/framework/src/Illuminate/Pagination/UrlWindow.php new file mode 100644 index 0000000..0fd3aa8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/UrlWindow.php @@ -0,0 +1,218 @@ +paginator = $paginator; + } + + /** + * Create a new URL window instance. + * + * @param \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator + * @return array + */ + public static function make(PaginatorContract $paginator) + { + return (new static($paginator))->get(); + } + + /** + * Get the window of URLs to be shown. + * + * @return array + */ + public function get() + { + $onEachSide = $this->paginator->onEachSide; + + if ($this->paginator->lastPage() < ($onEachSide * 2) + 6) { + return $this->getSmallSlider(); + } + + return $this->getUrlSlider($onEachSide); + } + + /** + * Get the slider of URLs there are not enough pages to slide. + * + * @return array + */ + protected function getSmallSlider() + { + return [ + 'first' => $this->paginator->getUrlRange(1, $this->lastPage()), + 'slider' => null, + 'last' => null, + ]; + } + + /** + * Create a URL slider links. + * + * @param int $onEachSide + * @return array + */ + protected function getUrlSlider($onEachSide) + { + $window = $onEachSide * 2; + + if (! $this->hasPages()) { + return ['first' => null, 'slider' => null, 'last' => null]; + } + + // If the current page is very close to the beginning of the page range, we will + // just render the beginning of the page range, followed by the last 2 of the + // links in this list, since we will not have room to create a full slider. + if ($this->currentPage() <= $window) { + return $this->getSliderTooCloseToBeginning($window); + } + + // If the current page is close to the ending of the page range we will just get + // this first couple pages, followed by a larger window of these ending pages + // since we're too close to the end of the list to create a full on slider. + elseif ($this->currentPage() > ($this->lastPage() - $window)) { + return $this->getSliderTooCloseToEnding($window); + } + + // If we have enough room on both sides of the current page to build a slider we + // will surround it with both the beginning and ending caps, with this window + // of pages in the middle providing a Google style sliding paginator setup. + return $this->getFullSlider($onEachSide); + } + + /** + * Get the slider of URLs when too close to beginning of window. + * + * @param int $window + * @return array + */ + protected function getSliderTooCloseToBeginning($window) + { + return [ + 'first' => $this->paginator->getUrlRange(1, $window + 2), + 'slider' => null, + 'last' => $this->getFinish(), + ]; + } + + /** + * Get the slider of URLs when too close to ending of window. + * + * @param int $window + * @return array + */ + protected function getSliderTooCloseToEnding($window) + { + $last = $this->paginator->getUrlRange( + $this->lastPage() - ($window + 2), + $this->lastPage() + ); + + return [ + 'first' => $this->getStart(), + 'slider' => null, + 'last' => $last, + ]; + } + + /** + * Get the slider of URLs when a full slider can be made. + * + * @param int $onEachSide + * @return array + */ + protected function getFullSlider($onEachSide) + { + return [ + 'first' => $this->getStart(), + 'slider' => $this->getAdjacentUrlRange($onEachSide), + 'last' => $this->getFinish(), + ]; + } + + /** + * Get the page range for the current page window. + * + * @param int $onEachSide + * @return array + */ + public function getAdjacentUrlRange($onEachSide) + { + return $this->paginator->getUrlRange( + $this->currentPage() - $onEachSide, + $this->currentPage() + $onEachSide + ); + } + + /** + * Get the starting URLs of a pagination slider. + * + * @return array + */ + public function getStart() + { + return $this->paginator->getUrlRange(1, 2); + } + + /** + * Get the ending URLs of a pagination slider. + * + * @return array + */ + public function getFinish() + { + return $this->paginator->getUrlRange( + $this->lastPage() - 1, + $this->lastPage() + ); + } + + /** + * Determine if the underlying paginator being presented has pages to show. + * + * @return bool + */ + public function hasPages() + { + return $this->paginator->lastPage() > 1; + } + + /** + * Get the current page from the paginator. + * + * @return int + */ + protected function currentPage() + { + return $this->paginator->currentPage(); + } + + /** + * Get the last page from the paginator. + * + * @return int + */ + protected function lastPage() + { + return $this->paginator->lastPage(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/composer.json b/vendor/laravel/framework/src/Illuminate/Pagination/composer.json new file mode 100755 index 0000000..9e4d737 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/composer.json @@ -0,0 +1,35 @@ +{ + "name": "illuminate/pagination", + "description": "The Illuminate Pagination package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*" + }, + "autoload": { + "psr-4": { + "Illuminate\\Pagination\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php new file mode 100644 index 0000000..044bbaa --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php @@ -0,0 +1,44 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/default.blade.php b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/default.blade.php new file mode 100644 index 0000000..e59847a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/default.blade.php @@ -0,0 +1,44 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/semantic-ui.blade.php b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/semantic-ui.blade.php new file mode 100644 index 0000000..ef0dbb1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/semantic-ui.blade.php @@ -0,0 +1,36 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/simple-bootstrap-4.blade.php b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/simple-bootstrap-4.blade.php new file mode 100644 index 0000000..cc30c9b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/simple-bootstrap-4.blade.php @@ -0,0 +1,25 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/simple-default.blade.php b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/simple-default.blade.php new file mode 100644 index 0000000..bdf2fe8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/simple-default.blade.php @@ -0,0 +1,17 @@ +@if ($paginator->hasPages()) + +@endif diff --git a/vendor/laravel/framework/src/Illuminate/Pipeline/Hub.php b/vendor/laravel/framework/src/Illuminate/Pipeline/Hub.php new file mode 100644 index 0000000..87331a5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pipeline/Hub.php @@ -0,0 +1,74 @@ +container = $container; + } + + /** + * Define the default named pipeline. + * + * @param \Closure $callback + * @return void + */ + public function defaults(Closure $callback) + { + return $this->pipeline('default', $callback); + } + + /** + * Define a new named pipeline. + * + * @param string $name + * @param \Closure $callback + * @return void + */ + public function pipeline($name, Closure $callback) + { + $this->pipelines[$name] = $callback; + } + + /** + * Send an object through one of the available pipelines. + * + * @param mixed $object + * @param string|null $pipeline + * @return mixed + */ + public function pipe($object, $pipeline = null) + { + $pipeline = $pipeline ?: 'default'; + + return call_user_func( + $this->pipelines[$pipeline], new Pipeline($this->container), $object + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php b/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php new file mode 100644 index 0000000..2949c26 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php @@ -0,0 +1,193 @@ +container = $container; + } + + /** + * Set the object being sent through the pipeline. + * + * @param mixed $passable + * @return $this + */ + public function send($passable) + { + $this->passable = $passable; + + return $this; + } + + /** + * Set the array of pipes. + * + * @param array|mixed $pipes + * @return $this + */ + public function through($pipes) + { + $this->pipes = is_array($pipes) ? $pipes : func_get_args(); + + return $this; + } + + /** + * Set the method to call on the pipes. + * + * @param string $method + * @return $this + */ + public function via($method) + { + $this->method = $method; + + return $this; + } + + /** + * Run the pipeline with a final destination callback. + * + * @param \Closure $destination + * @return mixed + */ + public function then(Closure $destination) + { + $pipeline = array_reduce( + array_reverse($this->pipes), $this->carry(), $this->prepareDestination($destination) + ); + + return $pipeline($this->passable); + } + + /** + * Get the final piece of the Closure onion. + * + * @param \Closure $destination + * @return \Closure + */ + protected function prepareDestination(Closure $destination) + { + return function ($passable) use ($destination) { + return $destination($passable); + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function carry() + { + return function ($stack, $pipe) { + return function ($passable) use ($stack, $pipe) { + if (is_callable($pipe)) { + // If the pipe is an instance of a Closure, we will just call it directly but + // otherwise we'll resolve the pipes out of the container and call it with + // the appropriate method and arguments, returning the results back out. + return $pipe($passable, $stack); + } elseif (! is_object($pipe)) { + [$name, $parameters] = $this->parsePipeString($pipe); + + // If the pipe is a string we will parse the string and resolve the class out + // of the dependency injection container. We can then build a callable and + // execute the pipe function giving in the parameters that are required. + $pipe = $this->getContainer()->make($name); + + $parameters = array_merge([$passable, $stack], $parameters); + } else { + // If the pipe is already an object we'll just make a callable and pass it to + // the pipe as-is. There is no need to do any extra parsing and formatting + // since the object we're given was already a fully instantiated object. + $parameters = [$passable, $stack]; + } + + $response = method_exists($pipe, $this->method) + ? $pipe->{$this->method}(...$parameters) + : $pipe(...$parameters); + + return $response instanceof Responsable + ? $response->toResponse($this->container->make(Request::class)) + : $response; + }; + }; + } + + /** + * Parse full pipe string to get name and parameters. + * + * @param string $pipe + * @return array + */ + protected function parsePipeString($pipe) + { + [$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []); + + if (is_string($parameters)) { + $parameters = explode(',', $parameters); + } + + return [$name, $parameters]; + } + + /** + * Get the container instance. + * + * @return \Illuminate\Contracts\Container\Container + * + * @throws \RuntimeException + */ + protected function getContainer() + { + if (! $this->container) { + throw new RuntimeException('A container instance has not been passed to the Pipeline.'); + } + + return $this->container; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pipeline/PipelineServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Pipeline/PipelineServiceProvider.php new file mode 100644 index 0000000..d829187 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pipeline/PipelineServiceProvider.php @@ -0,0 +1,40 @@ +app->singleton( + PipelineHubContract::class, Hub::class + ); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + PipelineHubContract::class, + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Pipeline/composer.json b/vendor/laravel/framework/src/Illuminate/Pipeline/composer.json new file mode 100644 index 0000000..f3225d4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Pipeline/composer.json @@ -0,0 +1,35 @@ +{ + "name": "illuminate/pipeline", + "description": "The Illuminate Pipeline package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*" + }, + "autoload": { + "psr-4": { + "Illuminate\\Pipeline\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php b/vendor/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php new file mode 100755 index 0000000..28f7f30 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/BeanstalkdQueue.php @@ -0,0 +1,163 @@ +default = $default; + $this->timeToRun = $timeToRun; + $this->pheanstalk = $pheanstalk; + } + + /** + * Get the size of the queue. + * + * @param string $queue + * @return int + */ + public function size($queue = null) + { + $queue = $this->getQueue($queue); + + return (int) $this->pheanstalk->statsTube($queue)->current_jobs_ready; + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + return $this->pushRaw($this->createPayload($job, $this->getQueue($queue), $data), $queue); + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + return $this->pheanstalk->useTube($this->getQueue($queue))->put( + $payload, Pheanstalk::DEFAULT_PRIORITY, Pheanstalk::DEFAULT_DELAY, $this->timeToRun + ); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + $pheanstalk = $this->pheanstalk->useTube($this->getQueue($queue)); + + return $pheanstalk->put( + $this->createPayload($job, $this->getQueue($queue), $data), + Pheanstalk::DEFAULT_PRIORITY, + $this->secondsUntil($delay), + $this->timeToRun + ); + } + + /** + * Pop the next job off of the queue. + * + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + $queue = $this->getQueue($queue); + + $job = $this->pheanstalk->watchOnly($queue)->reserve(0); + + if ($job instanceof PheanstalkJob) { + return new BeanstalkdJob( + $this->container, $this->pheanstalk, $job, $this->connectionName, $queue + ); + } + } + + /** + * Delete a message from the Beanstalk queue. + * + * @param string $queue + * @param string $id + * @return void + */ + public function deleteMessage($queue, $id) + { + $queue = $this->getQueue($queue); + + $this->pheanstalk->useTube($queue)->delete(new PheanstalkJob($id, '')); + } + + /** + * Get the queue or return the default. + * + * @param string|null $queue + * @return string + */ + public function getQueue($queue) + { + return $queue ?: $this->default; + } + + /** + * Get the underlying Pheanstalk instance. + * + * @return \Pheanstalk\Pheanstalk + */ + public function getPheanstalk() + { + return $this->pheanstalk; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedClosure.php b/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedClosure.php new file mode 100644 index 0000000..616e7ed --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedClosure.php @@ -0,0 +1,62 @@ +closure = $closure; + } + + /** + * Execute the job. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function handle(Container $container) + { + $container->call($this->closure->getClosure()); + } + + /** + * Get the display name for the queued job. + * + * @return string + */ + public function displayName() + { + $reflection = new ReflectionFunction($this->closure->getClosure()); + + return 'Closure ('.basename($reflection->getFileName()).':'.$reflection->getStartLine().')'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php b/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php new file mode 100644 index 0000000..e8bc19a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php @@ -0,0 +1,152 @@ +dispatcher = $dispatcher; + } + + /** + * Handle the queued job. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param array $data + * @return void + */ + public function call(Job $job, array $data) + { + try { + $command = $this->setJobInstanceIfNecessary( + $job, unserialize($data['command']) + ); + } catch (ModelNotFoundException $e) { + return $this->handleModelNotFound($job, $e); + } + + $this->dispatcher->dispatchNow( + $command, $this->resolveHandler($job, $command) + ); + + if (! $job->hasFailed() && ! $job->isReleased()) { + $this->ensureNextJobInChainIsDispatched($command); + } + + if (! $job->isDeletedOrReleased()) { + $job->delete(); + } + } + + /** + * Resolve the handler for the given command. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param mixed $command + * @return mixed + */ + protected function resolveHandler($job, $command) + { + $handler = $this->dispatcher->getCommandHandler($command) ?: null; + + if ($handler) { + $this->setJobInstanceIfNecessary($job, $handler); + } + + return $handler; + } + + /** + * Set the job instance of the given class if necessary. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param mixed $instance + * @return mixed + */ + protected function setJobInstanceIfNecessary(Job $job, $instance) + { + if (in_array(InteractsWithQueue::class, class_uses_recursive($instance))) { + $instance->setJob($job); + } + + return $instance; + } + + /** + * Ensure the next job in the chain is dispatched if applicable. + * + * @param mixed $command + * @return void + */ + protected function ensureNextJobInChainIsDispatched($command) + { + if (method_exists($command, 'dispatchNextJobInChain')) { + $command->dispatchNextJobInChain(); + } + } + + /** + * Handle a model not found exception. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param \Exception $e + * @return void + */ + protected function handleModelNotFound(Job $job, $e) + { + $class = $job->resolveName(); + + try { + $shouldDelete = (new ReflectionClass($class)) + ->getDefaultProperties()['deleteWhenMissingModels'] ?? false; + } catch (Exception $e) { + $shouldDelete = false; + } + + if ($shouldDelete) { + return $job->delete(); + } + + return FailingJob::handle( + $job->getConnectionName(), $job, $e + ); + } + + /** + * Call the failed method on the job instance. + * + * The exception that caused the failure will be passed. + * + * @param array $data + * @param \Exception $e + * @return void + */ + public function failed(array $data, $e) + { + $command = unserialize($data['command']); + + if (method_exists($command, 'failed')) { + $command->failed($e); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Capsule/Manager.php b/vendor/laravel/framework/src/Illuminate/Queue/Capsule/Manager.php new file mode 100644 index 0000000..310621a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Capsule/Manager.php @@ -0,0 +1,187 @@ +setupContainer($container ?: new Container); + + // Once we have the container setup, we will setup the default configuration + // options in the container "config" bindings. This just makes this queue + // manager behave correctly since all the correct binding are in place. + $this->setupDefaultConfiguration(); + + $this->setupManager(); + + $this->registerConnectors(); + } + + /** + * Setup the default queue configuration options. + * + * @return void + */ + protected function setupDefaultConfiguration() + { + $this->container['config']['queue.default'] = 'default'; + } + + /** + * Build the queue manager instance. + * + * @return void + */ + protected function setupManager() + { + $this->manager = new QueueManager($this->container); + } + + /** + * Register the default connectors that the component ships with. + * + * @return void + */ + protected function registerConnectors() + { + $provider = new QueueServiceProvider($this->container); + + $provider->registerConnectors($this->manager); + } + + /** + * Get a connection instance from the global manager. + * + * @param string $connection + * @return \Illuminate\Contracts\Queue\Queue + */ + public static function connection($connection = null) + { + return static::$instance->getConnection($connection); + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @param string $connection + * @return mixed + */ + public static function push($job, $data = '', $queue = null, $connection = null) + { + return static::$instance->connection($connection)->push($job, $data, $queue); + } + + /** + * Push a new an array of jobs onto the queue. + * + * @param array $jobs + * @param mixed $data + * @param string $queue + * @param string $connection + * @return mixed + */ + public static function bulk($jobs, $data = '', $queue = null, $connection = null) + { + return static::$instance->connection($connection)->bulk($jobs, $data, $queue); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $job + * @param mixed $data + * @param string $queue + * @param string $connection + * @return mixed + */ + public static function later($delay, $job, $data = '', $queue = null, $connection = null) + { + return static::$instance->connection($connection)->later($delay, $job, $data, $queue); + } + + /** + * Get a registered connection instance. + * + * @param string $name + * @return \Illuminate\Contracts\Queue\Queue + */ + public function getConnection($name = null) + { + return $this->manager->connection($name); + } + + /** + * Register a connection with the manager. + * + * @param array $config + * @param string $name + * @return void + */ + public function addConnection(array $config, $name = 'default') + { + $this->container['config']["queue.connections.{$name}"] = $config; + } + + /** + * Get the queue manager instance. + * + * @return \Illuminate\Queue\QueueManager + */ + public function getQueueManager() + { + return $this->manager; + } + + /** + * Pass dynamic instance methods to the manager. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->manager->$method(...$parameters); + } + + /** + * Dynamically pass methods to the default connection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + return static::connection()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php new file mode 100755 index 0000000..ae0e626 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php @@ -0,0 +1,40 @@ +pheanstalk($config), $config['queue'], $retryAfter); + } + + /** + * Create a Pheanstalk instance. + * + * @param array $config + * @return \Pheanstalk\Pheanstalk + */ + protected function pheanstalk(array $config) + { + return new Pheanstalk( + $config['host'], + $config['port'] ?? PheanstalkInterface::DEFAULT_PORT, + $config['timeout'] ?? Connection::DEFAULT_CONNECT_TIMEOUT, + $config['persistent'] ?? false + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Connectors/ConnectorInterface.php b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/ConnectorInterface.php new file mode 100755 index 0000000..617bf09 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/ConnectorInterface.php @@ -0,0 +1,14 @@ +connections = $connections; + } + + /** + * Establish a queue connection. + * + * @param array $config + * @return \Illuminate\Contracts\Queue\Queue + */ + public function connect(array $config) + { + return new DatabaseQueue( + $this->connections->connection($config['connection'] ?? null), + $config['table'], + $config['queue'], + $config['retry_after'] ?? 60 + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Connectors/NullConnector.php b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/NullConnector.php new file mode 100644 index 0000000..39de480 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/NullConnector.php @@ -0,0 +1,19 @@ +redis = $redis; + $this->connection = $connection; + } + + /** + * Establish a queue connection. + * + * @param array $config + * @return \Illuminate\Contracts\Queue\Queue + */ + public function connect(array $config) + { + return new RedisQueue( + $this->redis, $config['queue'], + $config['connection'] ?? $this->connection, + $config['retry_after'] ?? 60, + $config['block_for'] ?? null + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php new file mode 100755 index 0000000..9072b63 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php @@ -0,0 +1,46 @@ +getDefaultConfiguration($config); + + if ($config['key'] && $config['secret']) { + $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']); + } + + return new SqsQueue( + new SqsClient($config), $config['queue'], $config['prefix'] ?? '' + ); + } + + /** + * Get the default configuration for SQS. + * + * @param array $config + * @return array + */ + protected function getDefaultConfiguration(array $config) + { + return array_merge([ + 'version' => 'latest', + 'http' => [ + 'timeout' => 60, + 'connect_timeout' => 60, + ], + ], $config); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SyncConnector.php b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SyncConnector.php new file mode 100755 index 0000000..4269b80 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SyncConnector.php @@ -0,0 +1,19 @@ +files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $table = $this->laravel['config']['queue.failed.table']; + + $this->replaceMigration( + $this->createBaseMigration($table), $table, Str::studly($table) + ); + + $this->info('Migration created successfully!'); + + $this->composer->dumpAutoloads(); + } + + /** + * Create a base migration file for the table. + * + * @param string $table + * @return string + */ + protected function createBaseMigration($table = 'failed_jobs') + { + return $this->laravel['migration.creator']->create( + 'create_'.$table.'_table', $this->laravel->databasePath().'/migrations' + ); + } + + /** + * Replace the generated migration with the failed job table stub. + * + * @param string $path + * @param string $table + * @param string $tableClassName + * @return void + */ + protected function replaceMigration($path, $table, $tableClassName) + { + $stub = str_replace( + ['{{table}}', '{{tableClassName}}'], + [$table, $tableClassName], + $this->files->get(__DIR__.'/stubs/failed_jobs.stub') + ); + + $this->files->put($path, $stub); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/FlushFailedCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/FlushFailedCommand.php new file mode 100644 index 0000000..550b860 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/FlushFailedCommand.php @@ -0,0 +1,34 @@ +laravel['queue.failer']->flush(); + + $this->info('All failed jobs deleted successfully!'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/ForgetFailedCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/ForgetFailedCommand.php new file mode 100644 index 0000000..b8eecb9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/ForgetFailedCommand.php @@ -0,0 +1,36 @@ +laravel['queue.failer']->forget($this->argument('id'))) { + $this->info('Failed job deleted successfully!'); + } else { + $this->error('No failed job matches the given ID.'); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/ListFailedCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/ListFailedCommand.php new file mode 100644 index 0000000..1c218ea --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/ListFailedCommand.php @@ -0,0 +1,118 @@ +getFailedJobs()) === 0) { + return $this->info('No failed jobs!'); + } + + $this->displayFailedJobs($jobs); + } + + /** + * Compile the failed jobs into a displayable format. + * + * @return array + */ + protected function getFailedJobs() + { + $failed = $this->laravel['queue.failer']->all(); + + return collect($failed)->map(function ($failed) { + return $this->parseFailedJob((array) $failed); + })->filter()->all(); + } + + /** + * Parse the failed job row. + * + * @param array $failed + * @return array + */ + protected function parseFailedJob(array $failed) + { + $row = array_values(Arr::except($failed, ['payload', 'exception'])); + + array_splice($row, 3, 0, $this->extractJobName($failed['payload'])); + + return $row; + } + + /** + * Extract the failed job name from payload. + * + * @param string $payload + * @return string|null + */ + private function extractJobName($payload) + { + $payload = json_decode($payload, true); + + if ($payload && (! isset($payload['data']['command']))) { + return $payload['job'] ?? null; + } elseif ($payload && isset($payload['data']['command'])) { + return $this->matchJobName($payload); + } + } + + /** + * Match the job name from the payload. + * + * @param array $payload + * @return string + */ + protected function matchJobName($payload) + { + preg_match('/"([^"]+)"/', $payload['data']['command'], $matches); + + if (isset($matches[1])) { + return $matches[1]; + } + + return $payload['job'] ?? null; + } + + /** + * Display the failed jobs in the console. + * + * @param array $jobs + * @return void + */ + protected function displayFailedJobs(array $jobs) + { + $this->table($this->headers, $jobs); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/ListenCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/ListenCommand.php new file mode 100755 index 0000000..fca4cd0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/ListenCommand.php @@ -0,0 +1,114 @@ +setOutputHandler($this->listener = $listener); + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + // We need to get the right queue for the connection which is set in the queue + // configuration file for the application. We will pull it based on the set + // connection being run for the queue operation currently being executed. + $queue = $this->getQueue( + $connection = $this->input->getArgument('connection') + ); + + $this->listener->listen( + $connection, $queue, $this->gatherOptions() + ); + } + + /** + * Get the name of the queue connection to listen on. + * + * @param string $connection + * @return string + */ + protected function getQueue($connection) + { + $connection = $connection ?: $this->laravel['config']['queue.default']; + + return $this->input->getOption('queue') ?: $this->laravel['config']->get( + "queue.connections.{$connection}.queue", 'default' + ); + } + + /** + * Get the listener options for the command. + * + * @return \Illuminate\Queue\ListenerOptions + */ + protected function gatherOptions() + { + return new ListenerOptions( + $this->option('env'), $this->option('delay'), + $this->option('memory'), $this->option('timeout'), + $this->option('sleep'), $this->option('tries'), + $this->option('force') + ); + } + + /** + * Set the options on the queue listener. + * + * @param \Illuminate\Queue\Listener $listener + * @return void + */ + protected function setOutputHandler(Listener $listener) + { + $listener->setOutputHandler(function ($type, $line) { + $this->output->write($line); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/RestartCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/RestartCommand.php new file mode 100644 index 0000000..1b34041 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/RestartCommand.php @@ -0,0 +1,37 @@ +laravel['cache']->forever('illuminate:queue:restart', $this->currentTime()); + + $this->info('Broadcasting queue restart signal.'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/RetryCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/RetryCommand.php new file mode 100644 index 0000000..96fb9e3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/RetryCommand.php @@ -0,0 +1,93 @@ +getJobIds() as $id) { + $job = $this->laravel['queue.failer']->find($id); + + if (is_null($job)) { + $this->error("Unable to find failed job with ID [{$id}]."); + } else { + $this->retryJob($job); + + $this->info("The failed job [{$id}] has been pushed back onto the queue!"); + + $this->laravel['queue.failer']->forget($id); + } + } + } + + /** + * Get the job IDs to be retried. + * + * @return array + */ + protected function getJobIds() + { + $ids = (array) $this->argument('id'); + + if (count($ids) === 1 && $ids[0] === 'all') { + $ids = Arr::pluck($this->laravel['queue.failer']->all(), 'id'); + } + + return $ids; + } + + /** + * Retry the queue job. + * + * @param \stdClass $job + * @return void + */ + protected function retryJob($job) + { + $this->laravel['queue']->connection($job->connection)->pushRaw( + $this->resetAttempts($job->payload), $job->queue + ); + } + + /** + * Reset the payload attempts. + * + * Applicable to Redis jobs which store attempts in their payload. + * + * @param string $payload + * @return string + */ + protected function resetAttempts($payload) + { + $payload = json_decode($payload, true); + + if (isset($payload['attempts'])) { + $payload['attempts'] = 0; + } + + return json_encode($payload); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/TableCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/TableCommand.php new file mode 100644 index 0000000..50f1f01 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/TableCommand.php @@ -0,0 +1,102 @@ +files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $table = $this->laravel['config']['queue.connections.database.table']; + + $this->replaceMigration( + $this->createBaseMigration($table), $table, Str::studly($table) + ); + + $this->info('Migration created successfully!'); + + $this->composer->dumpAutoloads(); + } + + /** + * Create a base migration file for the table. + * + * @param string $table + * @return string + */ + protected function createBaseMigration($table = 'jobs') + { + return $this->laravel['migration.creator']->create( + 'create_'.$table.'_table', $this->laravel->databasePath().'/migrations' + ); + } + + /** + * Replace the generated migration with the job table stub. + * + * @param string $path + * @param string $table + * @param string $tableClassName + * @return void + */ + protected function replaceMigration($path, $table, $tableClassName) + { + $stub = str_replace( + ['{{table}}', '{{tableClassName}}'], + [$table, $tableClassName], + $this->files->get(__DIR__.'/stubs/jobs.stub') + ); + + $this->files->put($path, $stub); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php b/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php new file mode 100644 index 0000000..6761615 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php @@ -0,0 +1,216 @@ +worker = $worker; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + if ($this->downForMaintenance() && $this->option('once')) { + return $this->worker->sleep($this->option('sleep')); + } + + // We'll listen to the processed and failed events so we can write information + // to the console as jobs are processed, which will let the developer watch + // which jobs are coming through a queue and be informed on its progress. + $this->listenForEvents(); + + $connection = $this->argument('connection') + ?: $this->laravel['config']['queue.default']; + + // We need to get the right queue for the connection which is set in the queue + // configuration file for the application. We will pull it based on the set + // connection being run for the queue operation currently being executed. + $queue = $this->getQueue($connection); + + $this->runWorker( + $connection, $queue + ); + } + + /** + * Run the worker instance. + * + * @param string $connection + * @param string $queue + * @return array + */ + protected function runWorker($connection, $queue) + { + $this->worker->setCache($this->laravel['cache']->driver()); + + return $this->worker->{$this->option('once') ? 'runNextJob' : 'daemon'}( + $connection, $queue, $this->gatherWorkerOptions() + ); + } + + /** + * Gather all of the queue worker options as a single object. + * + * @return \Illuminate\Queue\WorkerOptions + */ + protected function gatherWorkerOptions() + { + return new WorkerOptions( + $this->option('delay'), $this->option('memory'), + $this->option('timeout'), $this->option('sleep'), + $this->option('tries'), $this->option('force'), + $this->option('stop-when-empty') + ); + } + + /** + * Listen for the queue events in order to update the console output. + * + * @return void + */ + protected function listenForEvents() + { + $this->laravel['events']->listen(JobProcessing::class, function ($event) { + $this->writeOutput($event->job, 'starting'); + }); + + $this->laravel['events']->listen(JobProcessed::class, function ($event) { + $this->writeOutput($event->job, 'success'); + }); + + $this->laravel['events']->listen(JobFailed::class, function ($event) { + $this->writeOutput($event->job, 'failed'); + + $this->logFailedJob($event); + }); + } + + /** + * Write the status output for the queue worker. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param string $status + * @return void + */ + protected function writeOutput(Job $job, $status) + { + switch ($status) { + case 'starting': + return $this->writeStatus($job, 'Processing', 'comment'); + case 'success': + return $this->writeStatus($job, 'Processed', 'info'); + case 'failed': + return $this->writeStatus($job, 'Failed', 'error'); + } + } + + /** + * Format the status output for the queue worker. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param string $status + * @param string $type + * @return void + */ + protected function writeStatus(Job $job, $status, $type) + { + $this->output->writeln(sprintf( + "<{$type}>[%s][%s] %s %s", + Carbon::now()->format('Y-m-d H:i:s'), + $job->getJobId(), + str_pad("{$status}:", 11), $job->resolveName() + )); + } + + /** + * Store a failed job event. + * + * @param \Illuminate\Queue\Events\JobFailed $event + * @return void + */ + protected function logFailedJob(JobFailed $event) + { + $this->laravel['queue.failer']->log( + $event->connectionName, $event->job->getQueue(), + $event->job->getRawBody(), $event->exception + ); + } + + /** + * Get the queue name for the worker. + * + * @param string $connection + * @return string + */ + protected function getQueue($connection) + { + return $this->option('queue') ?: $this->laravel['config']->get( + "queue.connections.{$connection}.queue", 'default' + ); + } + + /** + * Determine if the worker should run in maintenance mode. + * + * @return bool + */ + protected function downForMaintenance() + { + return $this->option('force') ? false : $this->laravel->isDownForMaintenance(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/failed_jobs.stub b/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/failed_jobs.stub new file mode 100644 index 0000000..037b5ee --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/failed_jobs.stub @@ -0,0 +1,35 @@ +bigIncrements('id'); + $table->text('connection'); + $table->text('queue'); + $table->longText('payload'); + $table->longText('exception'); + $table->timestamp('failed_at')->useCurrent(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('{{table}}'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/jobs.stub b/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/jobs.stub new file mode 100644 index 0000000..8440beb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Console/stubs/jobs.stub @@ -0,0 +1,36 @@ +bigIncrements('id'); + $table->string('queue')->index(); + $table->longText('payload'); + $table->unsignedTinyInteger('attempts'); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('{{table}}'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php b/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php new file mode 100644 index 0000000..41e87e5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php @@ -0,0 +1,327 @@ +table = $table; + $this->default = $default; + $this->database = $database; + $this->retryAfter = $retryAfter; + } + + /** + * Get the size of the queue. + * + * @param string $queue + * @return int + */ + public function size($queue = null) + { + return $this->database->table($this->table) + ->where('queue', $this->getQueue($queue)) + ->count(); + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + return $this->pushToDatabase($queue, $this->createPayload( + $job, $this->getQueue($queue), $data + )); + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + return $this->pushToDatabase($queue, $payload); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $job + * @param mixed $data + * @param string $queue + * @return void + */ + public function later($delay, $job, $data = '', $queue = null) + { + return $this->pushToDatabase($queue, $this->createPayload( + $job, $this->getQueue($queue), $data + ), $delay); + } + + /** + * Push an array of jobs onto the queue. + * + * @param array $jobs + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function bulk($jobs, $data = '', $queue = null) + { + $queue = $this->getQueue($queue); + + $availableAt = $this->availableAt(); + + return $this->database->table($this->table)->insert(collect((array) $jobs)->map( + function ($job) use ($queue, $data, $availableAt) { + return $this->buildDatabaseRecord($queue, $this->createPayload($job, $this->getQueue($queue), $data), $availableAt); + } + )->all()); + } + + /** + * Release a reserved job back onto the queue. + * + * @param string $queue + * @param \Illuminate\Queue\Jobs\DatabaseJobRecord $job + * @param int $delay + * @return mixed + */ + public function release($queue, $job, $delay) + { + return $this->pushToDatabase($queue, $job->payload, $delay, $job->attempts); + } + + /** + * Push a raw payload to the database with a given delay. + * + * @param string|null $queue + * @param string $payload + * @param \DateTimeInterface|\DateInterval|int $delay + * @param int $attempts + * @return mixed + */ + protected function pushToDatabase($queue, $payload, $delay = 0, $attempts = 0) + { + return $this->database->table($this->table)->insertGetId($this->buildDatabaseRecord( + $this->getQueue($queue), $payload, $this->availableAt($delay), $attempts + )); + } + + /** + * Create an array to insert for the given job. + * + * @param string|null $queue + * @param string $payload + * @param int $availableAt + * @param int $attempts + * @return array + */ + protected function buildDatabaseRecord($queue, $payload, $availableAt, $attempts = 0) + { + return [ + 'queue' => $queue, + 'attempts' => $attempts, + 'reserved_at' => null, + 'available_at' => $availableAt, + 'created_at' => $this->currentTime(), + 'payload' => $payload, + ]; + } + + /** + * Pop the next job off of the queue. + * + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + * + * @throws \Exception|\Throwable + */ + public function pop($queue = null) + { + $queue = $this->getQueue($queue); + + return $this->database->transaction(function () use ($queue) { + if ($job = $this->getNextAvailableJob($queue)) { + return $this->marshalJob($queue, $job); + } + + return null; + }); + } + + /** + * Get the next available job for the queue. + * + * @param string|null $queue + * @return \Illuminate\Queue\Jobs\DatabaseJobRecord|null + */ + protected function getNextAvailableJob($queue) + { + $job = $this->database->table($this->table) + ->lockForUpdate() + ->where('queue', $this->getQueue($queue)) + ->where(function ($query) { + $this->isAvailable($query); + $this->isReservedButExpired($query); + }) + ->orderBy('id', 'asc') + ->first(); + + return $job ? new DatabaseJobRecord((object) $job) : null; + } + + /** + * Modify the query to check for available jobs. + * + * @param \Illuminate\Database\Query\Builder $query + * @return void + */ + protected function isAvailable($query) + { + $query->where(function ($query) { + $query->whereNull('reserved_at') + ->where('available_at', '<=', $this->currentTime()); + }); + } + + /** + * Modify the query to check for jobs that are reserved but have expired. + * + * @param \Illuminate\Database\Query\Builder $query + * @return void + */ + protected function isReservedButExpired($query) + { + $expiration = Carbon::now()->subSeconds($this->retryAfter)->getTimestamp(); + + $query->orWhere(function ($query) use ($expiration) { + $query->where('reserved_at', '<=', $expiration); + }); + } + + /** + * Marshal the reserved job into a DatabaseJob instance. + * + * @param string $queue + * @param \Illuminate\Queue\Jobs\DatabaseJobRecord $job + * @return \Illuminate\Queue\Jobs\DatabaseJob + */ + protected function marshalJob($queue, $job) + { + $job = $this->markJobAsReserved($job); + + return new DatabaseJob( + $this->container, $this, $job, $this->connectionName, $queue + ); + } + + /** + * Mark the given job ID as reserved. + * + * @param \Illuminate\Queue\Jobs\DatabaseJobRecord $job + * @return \Illuminate\Queue\Jobs\DatabaseJobRecord + */ + protected function markJobAsReserved($job) + { + $this->database->table($this->table)->where('id', $job->id)->update([ + 'reserved_at' => $job->touch(), + 'attempts' => $job->increment(), + ]); + + return $job; + } + + /** + * Delete a reserved job from the queue. + * + * @param string $queue + * @param string $id + * @return void + * + * @throws \Exception|\Throwable + */ + public function deleteReserved($queue, $id) + { + $this->database->transaction(function () use ($id) { + if ($this->database->table($this->table)->lockForUpdate()->find($id)) { + $this->database->table($this->table)->where('id', $id)->delete(); + } + }); + } + + /** + * Get the queue or return the default. + * + * @param string|null $queue + * @return string + */ + public function getQueue($queue) + { + return $queue ?: $this->default; + } + + /** + * Get the underlying database instance. + * + * @return \Illuminate\Database\Connection + */ + public function getDatabase() + { + return $this->database; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Events/JobExceptionOccurred.php b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobExceptionOccurred.php new file mode 100644 index 0000000..dc7940e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobExceptionOccurred.php @@ -0,0 +1,42 @@ +job = $job; + $this->exception = $exception; + $this->connectionName = $connectionName; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Events/JobFailed.php b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobFailed.php new file mode 100644 index 0000000..49b84f7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobFailed.php @@ -0,0 +1,42 @@ +job = $job; + $this->exception = $exception; + $this->connectionName = $connectionName; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Events/JobProcessed.php b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobProcessed.php new file mode 100644 index 0000000..f8abefb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobProcessed.php @@ -0,0 +1,33 @@ +job = $job; + $this->connectionName = $connectionName; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Events/JobProcessing.php b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobProcessing.php new file mode 100644 index 0000000..3dd9724 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Events/JobProcessing.php @@ -0,0 +1,33 @@ +job = $job; + $this->connectionName = $connectionName; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Events/Looping.php b/vendor/laravel/framework/src/Illuminate/Queue/Events/Looping.php new file mode 100644 index 0000000..f9538e4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Events/Looping.php @@ -0,0 +1,33 @@ +queue = $queue; + $this->connectionName = $connectionName; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Events/WorkerStopping.php b/vendor/laravel/framework/src/Illuminate/Queue/Events/WorkerStopping.php new file mode 100644 index 0000000..6d49bb2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Events/WorkerStopping.php @@ -0,0 +1,24 @@ +status = $status; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php b/vendor/laravel/framework/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php new file mode 100644 index 0000000..59de88e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php @@ -0,0 +1,117 @@ +table = $table; + $this->resolver = $resolver; + $this->database = $database; + } + + /** + * Log a failed job into storage. + * + * @param string $connection + * @param string $queue + * @param string $payload + * @param \Exception $exception + * @return int|null + */ + public function log($connection, $queue, $payload, $exception) + { + $failed_at = Carbon::now(); + + $exception = (string) $exception; + + return $this->getTable()->insertGetId(compact( + 'connection', 'queue', 'payload', 'exception', 'failed_at' + )); + } + + /** + * Get a list of all of the failed jobs. + * + * @return array + */ + public function all() + { + return $this->getTable()->orderBy('id', 'desc')->get()->all(); + } + + /** + * Get a single failed job. + * + * @param mixed $id + * @return object|null + */ + public function find($id) + { + return $this->getTable()->find($id); + } + + /** + * Delete a single failed job from storage. + * + * @param mixed $id + * @return bool + */ + public function forget($id) + { + return $this->getTable()->where('id', $id)->delete() > 0; + } + + /** + * Flush all of the failed jobs from storage. + * + * @return void + */ + public function flush() + { + $this->getTable()->delete(); + } + + /** + * Get a new query builder instance for the table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function getTable() + { + return $this->resolver->connection($this->database)->table($this->table); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php b/vendor/laravel/framework/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php new file mode 100644 index 0000000..b818636 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Failed/FailedJobProviderInterface.php @@ -0,0 +1,47 @@ +markAsFailed(); + + if ($job->isDeleted()) { + return; + } + + try { + // If the job has failed, we will delete it, call the "failed" method and then call + // an event indicating the job has failed so it can be logged if needed. This is + // to allow every developer to better keep monitor of their failed queue jobs. + $job->delete(); + + $job->failed($e); + } finally { + static::events()->dispatch(new JobFailed( + $connectionName, $job, $e ?: new ManuallyFailedException + )); + } + } + + /** + * Get the event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + protected static function events() + { + return Container::getInstance()->make(Dispatcher::class); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/InteractsWithQueue.php b/vendor/laravel/framework/src/Illuminate/Queue/InteractsWithQueue.php new file mode 100644 index 0000000..20bcecb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/InteractsWithQueue.php @@ -0,0 +1,76 @@ +job ? $this->job->attempts() : 1; + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + if ($this->job) { + return $this->job->delete(); + } + } + + /** + * Fail the job from the queue. + * + * @param \Throwable $exception + * @return void + */ + public function fail($exception = null) + { + if ($this->job) { + FailingJob::handle($this->job->getConnectionName(), $this->job, $exception); + } + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + if ($this->job) { + return $this->job->release($delay); + } + } + + /** + * Set the base queue job instance. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @return $this + */ + public function setJob(JobContract $job) + { + $this->job = $job; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/InvalidPayloadException.php b/vendor/laravel/framework/src/Illuminate/Queue/InvalidPayloadException.php new file mode 100644 index 0000000..788fa66 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/InvalidPayloadException.php @@ -0,0 +1,19 @@ +job = $job; + $this->queue = $queue; + $this->container = $container; + $this->pheanstalk = $pheanstalk; + $this->connectionName = $connectionName; + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + parent::release($delay); + + $priority = Pheanstalk::DEFAULT_PRIORITY; + + $this->pheanstalk->release($this->job, $priority, $delay); + } + + /** + * Bury the job in the queue. + * + * @return void + */ + public function bury() + { + parent::release(); + + $this->pheanstalk->bury($this->job); + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + parent::delete(); + + $this->pheanstalk->delete($this->job); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + $stats = $this->pheanstalk->statsJob($this->job); + + return (int) $stats->reserves; + } + + /** + * Get the job identifier. + * + * @return int + */ + public function getJobId() + { + return $this->job->getId(); + } + + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->job->getData(); + } + + /** + * Get the underlying Pheanstalk instance. + * + * @return \Pheanstalk\Pheanstalk + */ + public function getPheanstalk() + { + return $this->pheanstalk; + } + + /** + * Get the underlying Pheanstalk job. + * + * @return \Pheanstalk\Job + */ + public function getPheanstalkJob() + { + return $this->job; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJob.php b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJob.php new file mode 100644 index 0000000..9b57fb0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJob.php @@ -0,0 +1,100 @@ +job = $job; + $this->queue = $queue; + $this->database = $database; + $this->container = $container; + $this->connectionName = $connectionName; + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return mixed + */ + public function release($delay = 0) + { + parent::release($delay); + + $this->delete(); + + return $this->database->release($this->queue, $this->job, $delay); + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + parent::delete(); + + $this->database->deleteReserved($this->queue, $this->job->id); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + return (int) $this->job->attempts; + } + + /** + * Get the job identifier. + * + * @return string + */ + public function getJobId() + { + return $this->job->id; + } + + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->job->payload; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJobRecord.php b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJobRecord.php new file mode 100644 index 0000000..b4b5725 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJobRecord.php @@ -0,0 +1,63 @@ +record = $record; + } + + /** + * Increment the number of times the job has been attempted. + * + * @return int + */ + public function increment() + { + $this->record->attempts++; + + return $this->record->attempts; + } + + /** + * Update the "reserved at" timestamp of the job. + * + * @return int + */ + public function touch() + { + $this->record->reserved_at = $this->currentTime(); + + return $this->record->reserved_at; + } + + /** + * Dynamically access the underlying job information. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->record->{$key}; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php new file mode 100755 index 0000000..2f043c5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php @@ -0,0 +1,278 @@ +payload(); + + [$class, $method] = JobName::parse($payload['job']); + + ($this->instance = $this->resolve($class))->{$method}($this, $payload['data']); + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + $this->deleted = true; + } + + /** + * Determine if the job has been deleted. + * + * @return bool + */ + public function isDeleted() + { + return $this->deleted; + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + $this->released = true; + } + + /** + * Determine if the job was released back into the queue. + * + * @return bool + */ + public function isReleased() + { + return $this->released; + } + + /** + * Determine if the job has been deleted or released. + * + * @return bool + */ + public function isDeletedOrReleased() + { + return $this->isDeleted() || $this->isReleased(); + } + + /** + * Determine if the job has been marked as a failure. + * + * @return bool + */ + public function hasFailed() + { + return $this->failed; + } + + /** + * Mark the job as "failed". + * + * @return void + */ + public function markAsFailed() + { + $this->failed = true; + } + + /** + * Process an exception that caused the job to fail. + * + * @param \Exception $e + * @return void + */ + public function failed($e) + { + $this->markAsFailed(); + + $payload = $this->payload(); + + [$class, $method] = JobName::parse($payload['job']); + + if (method_exists($this->instance = $this->resolve($class), 'failed')) { + $this->instance->failed($payload['data'], $e); + } + } + + /** + * Resolve the given class. + * + * @param string $class + * @return mixed + */ + protected function resolve($class) + { + return $this->container->make($class); + } + + /** + * Get the decoded body of the job. + * + * @return array + */ + public function payload() + { + return json_decode($this->getRawBody(), true); + } + + /** + * Get the number of times to attempt a job. + * + * @return int|null + */ + public function maxTries() + { + return $this->payload()['maxTries'] ?? null; + } + + /** + * Get the number of seconds the job can run. + * + * @return int|null + */ + public function timeout() + { + return $this->payload()['timeout'] ?? null; + } + + /** + * Get the timestamp indicating when the job should timeout. + * + * @return int|null + */ + public function timeoutAt() + { + return $this->payload()['timeoutAt'] ?? null; + } + + /** + * Get the name of the queued job class. + * + * @return string + */ + public function getName() + { + return $this->payload()['job']; + } + + /** + * Get the resolved name of the queued job class. + * + * Resolves the name of "wrapped" jobs such as class-based handlers. + * + * @return string + */ + public function resolveName() + { + return JobName::resolve($this->getName(), $this->payload()); + } + + /** + * Get the name of the connection the job belongs to. + * + * @return string + */ + public function getConnectionName() + { + return $this->connectionName; + } + + /** + * Get the name of the queue the job belongs to. + * + * @return string + */ + public function getQueue() + { + return $this->queue; + } + + /** + * Get the service container instance. + * + * @return \Illuminate\Container\Container + */ + public function getContainer() + { + return $this->container; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Jobs/JobName.php b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/JobName.php new file mode 100644 index 0000000..0db53bb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/JobName.php @@ -0,0 +1,35 @@ +job = $job; + $this->redis = $redis; + $this->queue = $queue; + $this->reserved = $reserved; + $this->container = $container; + $this->connectionName = $connectionName; + + $this->decoded = $this->payload(); + } + + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->job; + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + parent::delete(); + + $this->redis->deleteReserved($this->queue, $this); + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + parent::release($delay); + + $this->redis->deleteAndRelease($this->queue, $this, $delay); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + return ($this->decoded['attempts'] ?? null) + 1; + } + + /** + * Get the job identifier. + * + * @return string + */ + public function getJobId() + { + return $this->decoded['id'] ?? null; + } + + /** + * Get the underlying Redis factory implementation. + * + * @return \Illuminate\Queue\RedisQueue + */ + public function getRedisQueue() + { + return $this->redis; + } + + /** + * Get the underlying reserved Redis job. + * + * @return string + */ + public function getReservedJob() + { + return $this->reserved; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SqsJob.php b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SqsJob.php new file mode 100755 index 0000000..962d758 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SqsJob.php @@ -0,0 +1,124 @@ +sqs = $sqs; + $this->job = $job; + $this->queue = $queue; + $this->container = $container; + $this->connectionName = $connectionName; + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + parent::release($delay); + + $this->sqs->changeMessageVisibility([ + 'QueueUrl' => $this->queue, + 'ReceiptHandle' => $this->job['ReceiptHandle'], + 'VisibilityTimeout' => $delay, + ]); + } + + /** + * Delete the job from the queue. + * + * @return void + */ + public function delete() + { + parent::delete(); + + $this->sqs->deleteMessage([ + 'QueueUrl' => $this->queue, 'ReceiptHandle' => $this->job['ReceiptHandle'], + ]); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + return (int) $this->job['Attributes']['ApproximateReceiveCount']; + } + + /** + * Get the job identifier. + * + * @return string + */ + public function getJobId() + { + return $this->job['MessageId']; + } + + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->job['Body']; + } + + /** + * Get the underlying SQS client instance. + * + * @return \Aws\Sqs\SqsClient + */ + public function getSqs() + { + return $this->sqs; + } + + /** + * Get the underlying raw SQS job. + * + * @return array + */ + public function getSqsJob() + { + return $this->job; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SyncJob.php b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SyncJob.php new file mode 100755 index 0000000..9aafb8a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SyncJob.php @@ -0,0 +1,91 @@ +queue = $queue; + $this->payload = $payload; + $this->container = $container; + $this->connectionName = $connectionName; + } + + /** + * Release the job back into the queue. + * + * @param int $delay + * @return void + */ + public function release($delay = 0) + { + parent::release($delay); + } + + /** + * Get the number of times the job has been attempted. + * + * @return int + */ + public function attempts() + { + return 1; + } + + /** + * Get the job identifier. + * + * @return string + */ + public function getJobId() + { + return ''; + } + + /** + * Get the raw body string for the job. + * + * @return string + */ + public function getRawBody() + { + return $this->payload; + } + + /** + * Get the name of the queue the job belongs to. + * + * @return string + */ + public function getQueue() + { + return 'sync'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Listener.php b/vendor/laravel/framework/src/Illuminate/Queue/Listener.php new file mode 100755 index 0000000..f0dbcb6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Listener.php @@ -0,0 +1,230 @@ +commandPath = $commandPath; + } + + /** + * Get the PHP binary. + * + * @return string + */ + protected function phpBinary() + { + return (new PhpExecutableFinder)->find(false); + } + + /** + * Get the Artisan binary. + * + * @return string + */ + protected function artisanBinary() + { + return defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan'; + } + + /** + * Listen to the given queue connection. + * + * @param string $connection + * @param string $queue + * @param \Illuminate\Queue\ListenerOptions $options + * @return void + */ + public function listen($connection, $queue, ListenerOptions $options) + { + $process = $this->makeProcess($connection, $queue, $options); + + while (true) { + $this->runProcess($process, $options->memory); + } + } + + /** + * Create a new Symfony process for the worker. + * + * @param string $connection + * @param string $queue + * @param \Illuminate\Queue\ListenerOptions $options + * @return \Symfony\Component\Process\Process + */ + public function makeProcess($connection, $queue, ListenerOptions $options) + { + $command = $this->createCommand( + $connection, + $queue, + $options + ); + + // If the environment is set, we will append it to the command array so the + // workers will run under the specified environment. Otherwise, they will + // just run under the production environment which is not always right. + if (isset($options->environment)) { + $command = $this->addEnvironment($command, $options); + } + + return new Process( + $command, + $this->commandPath, + null, + null, + $options->timeout + ); + } + + /** + * Add the environment option to the given command. + * + * @param string $command + * @param \Illuminate\Queue\ListenerOptions $options + * @return array + */ + protected function addEnvironment($command, ListenerOptions $options) + { + return array_merge($command, ["--env={$options->environment}"]); + } + + /** + * Create the command with the listener options. + * + * @param string $connection + * @param string $queue + * @param \Illuminate\Queue\ListenerOptions $options + * @return array + */ + protected function createCommand($connection, $queue, ListenerOptions $options) + { + return array_filter([ + $this->phpBinary(), + $this->artisanBinary(), + 'queue:work', + $connection, + '--once', + "--queue={$queue}", + "--delay={$options->delay}", + "--memory={$options->memory}", + "--sleep={$options->sleep}", + "--tries={$options->maxTries}", + ], function ($value) { + return ! is_null($value); + }); + } + + /** + * Run the given process. + * + * @param \Symfony\Component\Process\Process $process + * @param int $memory + * @return void + */ + public function runProcess(Process $process, $memory) + { + $process->run(function ($type, $line) { + $this->handleWorkerOutput($type, $line); + }); + + // Once we have run the job we'll go check if the memory limit has been exceeded + // for the script. If it has, we will kill this script so the process manager + // will restart this with a clean slate of memory automatically on exiting. + if ($this->memoryExceeded($memory)) { + $this->stop(); + } + } + + /** + * Handle output from the worker process. + * + * @param int $type + * @param string $line + * @return void + */ + protected function handleWorkerOutput($type, $line) + { + if (isset($this->outputHandler)) { + call_user_func($this->outputHandler, $type, $line); + } + } + + /** + * Determine if the memory limit has been exceeded. + * + * @param int $memoryLimit + * @return bool + */ + public function memoryExceeded($memoryLimit) + { + return (memory_get_usage(true) / 1024 / 1024) >= $memoryLimit; + } + + /** + * Stop listening and bail out of the script. + * + * @return void + */ + public function stop() + { + die; + } + + /** + * Set the output handler callback. + * + * @param \Closure $outputHandler + * @return void + */ + public function setOutputHandler(Closure $outputHandler) + { + $this->outputHandler = $outputHandler; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/ListenerOptions.php b/vendor/laravel/framework/src/Illuminate/Queue/ListenerOptions.php new file mode 100644 index 0000000..a1b9014 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/ListenerOptions.php @@ -0,0 +1,32 @@ +environment = $environment; + + parent::__construct($delay, $memory, $timeout, $sleep, $maxTries, $force); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/LuaScripts.php b/vendor/laravel/framework/src/Illuminate/Queue/LuaScripts.php new file mode 100644 index 0000000..93ac047 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/LuaScripts.php @@ -0,0 +1,103 @@ +push($job, $data, $queue); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param string $queue + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $job + * @param mixed $data + * @return mixed + */ + public function laterOn($queue, $delay, $job, $data = '') + { + return $this->later($delay, $job, $data, $queue); + } + + /** + * Push an array of jobs onto the queue. + * + * @param array $jobs + * @param mixed $data + * @param string $queue + * @return void + */ + public function bulk($jobs, $data = '', $queue = null) + { + foreach ((array) $jobs as $job) { + $this->push($job, $data, $queue); + } + } + + /** + * Create a payload string from the given job and data. + * + * @param string $job + * @param string $queue + * @param mixed $data + * @return string + * + * @throws \Illuminate\Queue\InvalidPayloadException + */ + protected function createPayload($job, $queue, $data = '') + { + $payload = json_encode($this->createPayloadArray($job, $queue, $data)); + + if (JSON_ERROR_NONE !== json_last_error()) { + throw new InvalidPayloadException( + 'Unable to JSON encode payload. Error code: '.json_last_error() + ); + } + + return $payload; + } + + /** + * Create a payload array from the given job and data. + * + * @param mixed $job + * @param string $queue + * @param mixed $data + * @return array + */ + protected function createPayloadArray($job, $queue, $data = '') + { + return is_object($job) + ? $this->createObjectPayload($job, $queue) + : $this->createStringPayload($job, $queue, $data); + } + + /** + * Create a payload for an object-based queue handler. + * + * @param mixed $job + * @param string $queue + * @return array + */ + protected function createObjectPayload($job, $queue) + { + $payload = $this->withCreatePayloadHooks($queue, [ + 'displayName' => $this->getDisplayName($job), + 'job' => 'Illuminate\Queue\CallQueuedHandler@call', + 'maxTries' => $job->tries ?? null, + 'timeout' => $job->timeout ?? null, + 'timeoutAt' => $this->getJobExpiration($job), + 'data' => [ + 'commandName' => $job, + 'command' => $job, + ], + ]); + + return array_merge($payload, [ + 'data' => [ + 'commandName' => get_class($job), + 'command' => serialize(clone $job), + ], + ]); + } + + /** + * Get the display name for the given job. + * + * @param mixed $job + * @return string + */ + protected function getDisplayName($job) + { + return method_exists($job, 'displayName') + ? $job->displayName() : get_class($job); + } + + /** + * Get the expiration timestamp for an object-based queue handler. + * + * @param mixed $job + * @return mixed + */ + public function getJobExpiration($job) + { + if (! method_exists($job, 'retryUntil') && ! isset($job->timeoutAt)) { + return; + } + + $expiration = $job->timeoutAt ?? $job->retryUntil(); + + return $expiration instanceof DateTimeInterface + ? $expiration->getTimestamp() : $expiration; + } + + /** + * Create a typical, string based queue payload array. + * + * @param string $job + * @param string $queue + * @param mixed $data + * @return array + */ + protected function createStringPayload($job, $queue, $data) + { + return $this->withCreatePayloadHooks($queue, [ + 'displayName' => is_string($job) ? explode('@', $job)[0] : null, + 'job' => $job, + 'maxTries' => null, + 'timeout' => null, + 'data' => $data, + ]); + } + + /** + * Register a callback to be executed when creating job payloads. + * + * @param callable $callback + * @return void + */ + public static function createPayloadUsing($callback) + { + if (is_null($callback)) { + static::$createPayloadCallbacks = []; + } else { + static::$createPayloadCallbacks[] = $callback; + } + } + + /** + * Create the given payload using any registered payload hooks. + * + * @param string $queue + * @param array $payload + * @return array + */ + protected function withCreatePayloadHooks($queue, array $payload) + { + if (! empty(static::$createPayloadCallbacks)) { + foreach (static::$createPayloadCallbacks as $callback) { + $payload = array_merge($payload, call_user_func( + $callback, $this->getConnectionName(), $queue, $payload + )); + } + } + + return $payload; + } + + /** + * Get the connection name for the queue. + * + * @return string + */ + public function getConnectionName() + { + return $this->connectionName; + } + + /** + * Set the connection name for the queue. + * + * @param string $name + * @return $this + */ + public function setConnectionName($name) + { + $this->connectionName = $name; + + return $this; + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Container\Container $container + * @return void + */ + public function setContainer(Container $container) + { + $this->container = $container; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php b/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php new file mode 100755 index 0000000..f9bb7f6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/QueueManager.php @@ -0,0 +1,270 @@ +app = $app; + } + + /** + * Register an event listener for the before job event. + * + * @param mixed $callback + * @return void + */ + public function before($callback) + { + $this->app['events']->listen(Events\JobProcessing::class, $callback); + } + + /** + * Register an event listener for the after job event. + * + * @param mixed $callback + * @return void + */ + public function after($callback) + { + $this->app['events']->listen(Events\JobProcessed::class, $callback); + } + + /** + * Register an event listener for the exception occurred job event. + * + * @param mixed $callback + * @return void + */ + public function exceptionOccurred($callback) + { + $this->app['events']->listen(Events\JobExceptionOccurred::class, $callback); + } + + /** + * Register an event listener for the daemon queue loop. + * + * @param mixed $callback + * @return void + */ + public function looping($callback) + { + $this->app['events']->listen(Events\Looping::class, $callback); + } + + /** + * Register an event listener for the failed job event. + * + * @param mixed $callback + * @return void + */ + public function failing($callback) + { + $this->app['events']->listen(Events\JobFailed::class, $callback); + } + + /** + * Register an event listener for the daemon queue stopping. + * + * @param mixed $callback + * @return void + */ + public function stopping($callback) + { + $this->app['events']->listen(Events\WorkerStopping::class, $callback); + } + + /** + * Determine if the driver is connected. + * + * @param string $name + * @return bool + */ + public function connected($name = null) + { + return isset($this->connections[$name ?: $this->getDefaultDriver()]); + } + + /** + * Resolve a queue connection instance. + * + * @param string $name + * @return \Illuminate\Contracts\Queue\Queue + */ + public function connection($name = null) + { + $name = $name ?: $this->getDefaultDriver(); + + // If the connection has not been resolved yet we will resolve it now as all + // of the connections are resolved when they are actually needed so we do + // not make any unnecessary connection to the various queue end-points. + if (! isset($this->connections[$name])) { + $this->connections[$name] = $this->resolve($name); + + $this->connections[$name]->setContainer($this->app); + } + + return $this->connections[$name]; + } + + /** + * Resolve a queue connection. + * + * @param string $name + * @return \Illuminate\Contracts\Queue\Queue + */ + protected function resolve($name) + { + $config = $this->getConfig($name); + + return $this->getConnector($config['driver']) + ->connect($config) + ->setConnectionName($name); + } + + /** + * Get the connector for a given driver. + * + * @param string $driver + * @return \Illuminate\Queue\Connectors\ConnectorInterface + * + * @throws \InvalidArgumentException + */ + protected function getConnector($driver) + { + if (! isset($this->connectors[$driver])) { + throw new InvalidArgumentException("No connector for [$driver]"); + } + + return call_user_func($this->connectors[$driver]); + } + + /** + * Add a queue connection resolver. + * + * @param string $driver + * @param \Closure $resolver + * @return void + */ + public function extend($driver, Closure $resolver) + { + return $this->addConnector($driver, $resolver); + } + + /** + * Add a queue connection resolver. + * + * @param string $driver + * @param \Closure $resolver + * @return void + */ + public function addConnector($driver, Closure $resolver) + { + $this->connectors[$driver] = $resolver; + } + + /** + * Get the queue connection configuration. + * + * @param string $name + * @return array + */ + protected function getConfig($name) + { + if (! is_null($name) && $name !== 'null') { + return $this->app['config']["queue.connections.{$name}"]; + } + + return ['driver' => 'null']; + } + + /** + * Get the name of the default queue connection. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['queue.default']; + } + + /** + * Set the name of the default queue connection. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['queue.default'] = $name; + } + + /** + * Get the full name for the given connection. + * + * @param string $connection + * @return string + */ + public function getName($connection = null) + { + return $connection ?: $this->getDefaultDriver(); + } + + /** + * Determine if the application is in maintenance mode. + * + * @return bool + */ + public function isDownForMaintenance() + { + return $this->app->isDownForMaintenance(); + } + + /** + * Dynamically pass calls to the default connection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->connection()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/QueueServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Queue/QueueServiceProvider.php new file mode 100755 index 0000000..8b54e09 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/QueueServiceProvider.php @@ -0,0 +1,243 @@ +registerManager(); + $this->registerConnection(); + $this->registerWorker(); + $this->registerListener(); + $this->registerFailedJobServices(); + $this->registerOpisSecurityKey(); + } + + /** + * Register the queue manager. + * + * @return void + */ + protected function registerManager() + { + $this->app->singleton('queue', function ($app) { + // Once we have an instance of the queue manager, we will register the various + // resolvers for the queue connectors. These connectors are responsible for + // creating the classes that accept queue configs and instantiate queues. + return tap(new QueueManager($app), function ($manager) { + $this->registerConnectors($manager); + }); + }); + } + + /** + * Register the default queue connection binding. + * + * @return void + */ + protected function registerConnection() + { + $this->app->singleton('queue.connection', function ($app) { + return $app['queue']->connection(); + }); + } + + /** + * Register the connectors on the queue manager. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + public function registerConnectors($manager) + { + foreach (['Null', 'Sync', 'Database', 'Redis', 'Beanstalkd', 'Sqs'] as $connector) { + $this->{"register{$connector}Connector"}($manager); + } + } + + /** + * Register the Null queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerNullConnector($manager) + { + $manager->addConnector('null', function () { + return new NullConnector; + }); + } + + /** + * Register the Sync queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerSyncConnector($manager) + { + $manager->addConnector('sync', function () { + return new SyncConnector; + }); + } + + /** + * Register the database queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerDatabaseConnector($manager) + { + $manager->addConnector('database', function () { + return new DatabaseConnector($this->app['db']); + }); + } + + /** + * Register the Redis queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerRedisConnector($manager) + { + $manager->addConnector('redis', function () { + return new RedisConnector($this->app['redis']); + }); + } + + /** + * Register the Beanstalkd queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerBeanstalkdConnector($manager) + { + $manager->addConnector('beanstalkd', function () { + return new BeanstalkdConnector; + }); + } + + /** + * Register the Amazon SQS queue connector. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + protected function registerSqsConnector($manager) + { + $manager->addConnector('sqs', function () { + return new SqsConnector; + }); + } + + /** + * Register the queue worker. + * + * @return void + */ + protected function registerWorker() + { + $this->app->singleton('queue.worker', function () { + return new Worker( + $this->app['queue'], $this->app['events'], $this->app[ExceptionHandler::class] + ); + }); + } + + /** + * Register the queue listener. + * + * @return void + */ + protected function registerListener() + { + $this->app->singleton('queue.listener', function () { + return new Listener($this->app->basePath()); + }); + } + + /** + * Register the failed job services. + * + * @return void + */ + protected function registerFailedJobServices() + { + $this->app->singleton('queue.failer', function () { + $config = $this->app['config']['queue.failed']; + + return isset($config['table']) + ? $this->databaseFailedJobProvider($config) + : new NullFailedJobProvider; + }); + } + + /** + * Create a new database failed job provider. + * + * @param array $config + * @return \Illuminate\Queue\Failed\DatabaseFailedJobProvider + */ + protected function databaseFailedJobProvider($config) + { + return new DatabaseFailedJobProvider( + $this->app['db'], $config['database'], $config['table'] + ); + } + + /** + * Configure Opis Closure signing for security. + * + * @return void + */ + protected function registerOpisSecurityKey() + { + if (Str::startsWith($key = $this->app['config']->get('app.key'), 'base64:')) { + $key = base64_decode(substr($key, 7)); + } + + SerializableClosure::setSecretKey($key); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'queue', 'queue.worker', 'queue.listener', + 'queue.failer', 'queue.connection', + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/README.md b/vendor/laravel/framework/src/Illuminate/Queue/README.md new file mode 100644 index 0000000..d0f2ba4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/README.md @@ -0,0 +1,34 @@ +## Illuminate Queue + +The Laravel Queue component provides a unified API across a variety of different queue services. Queues allow you to defer the processing of a time consuming task, such as sending an e-mail, until a later time, thus drastically speeding up the web requests to your application. + +### Usage Instructions + +First, create a new Queue `Capsule` manager instance. Similar to the "Capsule" provided for the Eloquent ORM, the queue Capsule aims to make configuring the library for usage outside of the Laravel framework as easy as possible. + +```PHP +use Illuminate\Queue\Capsule\Manager as Queue; + +$queue = new Queue; + +$queue->addConnection([ + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', +]); + +// Make this Capsule instance available globally via static methods... (optional) +$queue->setAsGlobal(); +``` + +Once the Capsule instance has been registered. You may use it like so: + +```PHP +// As an instance... +$queue->push('SendEmail', array('message' => $message)); + +// If setAsGlobal has been called... +Queue::push('SendEmail', array('message' => $message)); +``` + +For further documentation on using the queue, consult the [Laravel framework documentation](https://laravel.com/docs). diff --git a/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php b/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php new file mode 100644 index 0000000..31eac51 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php @@ -0,0 +1,324 @@ +redis = $redis; + $this->default = $default; + $this->blockFor = $blockFor; + $this->connection = $connection; + $this->retryAfter = $retryAfter; + } + + /** + * Get the size of the queue. + * + * @param string $queue + * @return int + */ + public function size($queue = null) + { + $queue = $this->getQueue($queue); + + return $this->getConnection()->eval( + LuaScripts::size(), 3, $queue, $queue.':delayed', $queue.':reserved' + ); + } + + /** + * Push a new job onto the queue. + * + * @param object|string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + return $this->pushRaw($this->createPayload($job, $this->getQueue($queue), $data), $queue); + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + $this->getConnection()->rpush($this->getQueue($queue), $payload); + + return json_decode($payload, true)['id'] ?? null; + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param object|string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + return $this->laterRaw($delay, $this->createPayload($job, $this->getQueue($queue), $data), $queue); + } + + /** + * Push a raw job onto the queue after a delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $payload + * @param string $queue + * @return mixed + */ + protected function laterRaw($delay, $payload, $queue = null) + { + $this->getConnection()->zadd( + $this->getQueue($queue).':delayed', $this->availableAt($delay), $payload + ); + + return json_decode($payload, true)['id'] ?? null; + } + + /** + * Create a payload string from the given job and data. + * + * @param string $job + * @param string $queue + * @param mixed $data + * @return string + */ + protected function createPayloadArray($job, $queue, $data = '') + { + return array_merge(parent::createPayloadArray($job, $queue, $data), [ + 'id' => $this->getRandomId(), + 'attempts' => 0, + ]); + } + + /** + * Pop the next job off of the queue. + * + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + $this->migrate($prefixed = $this->getQueue($queue)); + + if (empty($nextJob = $this->retrieveNextJob($prefixed))) { + return; + } + + [$job, $reserved] = $nextJob; + + if ($reserved) { + return new RedisJob( + $this->container, $this, $job, + $reserved, $this->connectionName, $queue ?: $this->default + ); + } + } + + /** + * Migrate any delayed or expired jobs onto the primary queue. + * + * @param string $queue + * @return void + */ + protected function migrate($queue) + { + $this->migrateExpiredJobs($queue.':delayed', $queue); + + if (! is_null($this->retryAfter)) { + $this->migrateExpiredJobs($queue.':reserved', $queue); + } + } + + /** + * Migrate the delayed jobs that are ready to the regular queue. + * + * @param string $from + * @param string $to + * @return array + */ + public function migrateExpiredJobs($from, $to) + { + return $this->getConnection()->eval( + LuaScripts::migrateExpiredJobs(), 2, $from, $to, $this->currentTime() + ); + } + + /** + * Retrieve the next job from the queue. + * + * @param string $queue + * @return array + */ + protected function retrieveNextJob($queue) + { + if (! is_null($this->blockFor)) { + return $this->blockingPop($queue); + } + + return $this->getConnection()->eval( + LuaScripts::pop(), 2, $queue, $queue.':reserved', + $this->availableAt($this->retryAfter) + ); + } + + /** + * Retrieve the next job by blocking-pop. + * + * @param string $queue + * @return array + */ + protected function blockingPop($queue) + { + $rawBody = $this->getConnection()->blpop($queue, $this->blockFor); + + if (! empty($rawBody)) { + $payload = json_decode($rawBody[1], true); + + $payload['attempts']++; + + $reserved = json_encode($payload); + + $this->getConnection()->zadd($queue.':reserved', [ + $reserved => $this->availableAt($this->retryAfter), + ]); + + return [$rawBody[1], $reserved]; + } + + return [null, null]; + } + + /** + * Delete a reserved job from the queue. + * + * @param string $queue + * @param \Illuminate\Queue\Jobs\RedisJob $job + * @return void + */ + public function deleteReserved($queue, $job) + { + $this->getConnection()->zrem($this->getQueue($queue).':reserved', $job->getReservedJob()); + } + + /** + * Delete a reserved job from the reserved queue and release it. + * + * @param string $queue + * @param \Illuminate\Queue\Jobs\RedisJob $job + * @param int $delay + * @return void + */ + public function deleteAndRelease($queue, $job, $delay) + { + $queue = $this->getQueue($queue); + + $this->getConnection()->eval( + LuaScripts::release(), 2, $queue.':delayed', $queue.':reserved', + $job->getReservedJob(), $this->availableAt($delay) + ); + } + + /** + * Get a random ID string. + * + * @return string + */ + protected function getRandomId() + { + return Str::random(32); + } + + /** + * Get the queue or return the default. + * + * @param string|null $queue + * @return string + */ + public function getQueue($queue) + { + return 'queues:'.($queue ?: $this->default); + } + + /** + * Get the connection for the queue. + * + * @return \Illuminate\Redis\Connections\Connection + */ + protected function getConnection() + { + return $this->redis->connection($this->connection); + } + + /** + * Get the underlying Redis instance. + * + * @return \Illuminate\Contracts\Redis\Factory + */ + public function getRedis() + { + return $this->redis; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/SerializableClosure.php b/vendor/laravel/framework/src/Illuminate/Queue/SerializableClosure.php new file mode 100644 index 0000000..f8a1cf4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/SerializableClosure.php @@ -0,0 +1,40 @@ + $value) { + $data[$key] = $this->getSerializedPropertyValue($value); + } + + return $data; + } + + /** + * Resolve the use variables after unserialization. + * + * @param array $data The Closure's transformed use variables + * @return array + */ + protected function resolveUseVariables($data) + { + foreach ($data as $key => $value) { + $data[$key] = $this->getRestoredPropertyValue($value); + } + + return $data; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php b/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php new file mode 100644 index 0000000..4b9476e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php @@ -0,0 +1,99 @@ +getQueueableClass(), + $value->getQueueableIds(), + $value->getQueueableRelations(), + $value->getQueueableConnection() + ); + } + + if ($value instanceof QueueableEntity) { + return new ModelIdentifier( + get_class($value), + $value->getQueueableId(), + $value->getQueueableRelations(), + $value->getQueueableConnection() + ); + } + + return $value; + } + + /** + * Get the restored property value after deserialization. + * + * @param mixed $value + * @return mixed + */ + protected function getRestoredPropertyValue($value) + { + if (! $value instanceof ModelIdentifier) { + return $value; + } + + return is_array($value->id) + ? $this->restoreCollection($value) + : $this->restoreModel($value); + } + + /** + * Restore a queueable collection instance. + * + * @param \Illuminate\Contracts\Database\ModelIdentifier $value + * @return \Illuminate\Database\Eloquent\Collection + */ + protected function restoreCollection($value) + { + if (! $value->class || count($value->id) === 0) { + return new EloquentCollection; + } + + return $this->getQueryForModelRestoration( + (new $value->class)->setConnection($value->connection), $value->id + )->useWritePdo()->get(); + } + + /** + * Restore the model from the model identifier instance. + * + * @param \Illuminate\Contracts\Database\ModelIdentifier $value + * @return \Illuminate\Database\Eloquent\Model + */ + public function restoreModel($value) + { + return $this->getQueryForModelRestoration( + (new $value->class)->setConnection($value->connection), $value->id + )->useWritePdo()->firstOrFail()->load($value->relations ?? []); + } + + /** + * Get the query for model restoration. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @param array|int $ids + * @return \Illuminate\Database\Eloquent\Builder + */ + protected function getQueryForModelRestoration($model, $ids) + { + return $model->newQueryForRestoration($ids); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php b/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php new file mode 100644 index 0000000..e083d6f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php @@ -0,0 +1,62 @@ +getProperties(); + + foreach ($properties as $property) { + $property->setValue($this, $this->getSerializedPropertyValue( + $this->getPropertyValue($property) + )); + } + + return array_values(array_filter(array_map(function ($p) { + return $p->isStatic() ? null : $p->getName(); + }, $properties))); + } + + /** + * Restore the model after serialization. + * + * @return void + */ + public function __wakeup() + { + foreach ((new ReflectionClass($this))->getProperties() as $property) { + if ($property->isStatic()) { + continue; + } + + $property->setValue($this, $this->getRestoredPropertyValue( + $this->getPropertyValue($property) + )); + } + } + + /** + * Get the property value for the given property. + * + * @param \ReflectionProperty $property + * @return mixed + */ + protected function getPropertyValue(ReflectionProperty $property) + { + $property->setAccessible(true); + + return $property->getValue($this); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/SqsQueue.php b/vendor/laravel/framework/src/Illuminate/Queue/SqsQueue.php new file mode 100755 index 0000000..9a7c2dc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/SqsQueue.php @@ -0,0 +1,155 @@ +sqs = $sqs; + $this->prefix = $prefix; + $this->default = $default; + } + + /** + * Get the size of the queue. + * + * @param string $queue + * @return int + */ + public function size($queue = null) + { + $response = $this->sqs->getQueueAttributes([ + 'QueueUrl' => $this->getQueue($queue), + 'AttributeNames' => ['ApproximateNumberOfMessages'], + ]); + + $attributes = $response->get('Attributes'); + + return (int) $attributes['ApproximateNumberOfMessages']; + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + return $this->pushRaw($this->createPayload($job, $queue ?: $this->default, $data), $queue); + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + return $this->sqs->sendMessage([ + 'QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload, + ])->get('MessageId'); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + return $this->sqs->sendMessage([ + 'QueueUrl' => $this->getQueue($queue), + 'MessageBody' => $this->createPayload($job, $queue ?: $this->default, $data), + 'DelaySeconds' => $this->secondsUntil($delay), + ])->get('MessageId'); + } + + /** + * Pop the next job off of the queue. + * + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + $response = $this->sqs->receiveMessage([ + 'QueueUrl' => $queue = $this->getQueue($queue), + 'AttributeNames' => ['ApproximateReceiveCount'], + ]); + + if (! is_null($response['Messages']) && count($response['Messages']) > 0) { + return new SqsJob( + $this->container, $this->sqs, $response['Messages'][0], + $this->connectionName, $queue + ); + } + } + + /** + * Get the queue or return the default. + * + * @param string|null $queue + * @return string + */ + public function getQueue($queue) + { + $queue = $queue ?: $this->default; + + return filter_var($queue, FILTER_VALIDATE_URL) === false + ? rtrim($this->prefix, '/').'/'.$queue : $queue; + } + + /** + * Get the underlying SQS instance. + * + * @return \Aws\Sqs\SqsClient + */ + public function getSqs() + { + return $this->sqs; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php b/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php new file mode 100755 index 0000000..0652215 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php @@ -0,0 +1,161 @@ +resolveJob($this->createPayload($job, $queue, $data), $queue); + + try { + $this->raiseBeforeJobEvent($queueJob); + + $queueJob->fire(); + + $this->raiseAfterJobEvent($queueJob); + } catch (Exception $e) { + $this->handleException($queueJob, $e); + } catch (Throwable $e) { + $this->handleException($queueJob, new FatalThrowableError($e)); + } + + return 0; + } + + /** + * Resolve a Sync job instance. + * + * @param string $payload + * @param string $queue + * @return \Illuminate\Queue\Jobs\SyncJob + */ + protected function resolveJob($payload, $queue) + { + return new SyncJob($this->container, $payload, $this->connectionName, $queue); + } + + /** + * Raise the before queue job event. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @return void + */ + protected function raiseBeforeJobEvent(Job $job) + { + if ($this->container->bound('events')) { + $this->container['events']->dispatch(new Events\JobProcessing($this->connectionName, $job)); + } + } + + /** + * Raise the after queue job event. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @return void + */ + protected function raiseAfterJobEvent(Job $job) + { + if ($this->container->bound('events')) { + $this->container['events']->dispatch(new Events\JobProcessed($this->connectionName, $job)); + } + } + + /** + * Raise the exception occurred queue job event. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param \Exception $e + * @return void + */ + protected function raiseExceptionOccurredJobEvent(Job $job, $e) + { + if ($this->container->bound('events')) { + $this->container['events']->dispatch(new Events\JobExceptionOccurred($this->connectionName, $job, $e)); + } + } + + /** + * Handle an exception that occurred while processing a job. + * + * @param \Illuminate\Queue\Jobs\Job $queueJob + * @param \Exception $e + * @return void + * + * @throws \Exception + */ + protected function handleException($queueJob, $e) + { + $this->raiseExceptionOccurredJobEvent($queueJob, $e); + + FailingJob::handle($this->connectionName, $queueJob, $e); + + throw $e; + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + // + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + return $this->push($job, $data, $queue); + } + + /** + * Pop the next job off of the queue. + * + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + // + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/Worker.php b/vendor/laravel/framework/src/Illuminate/Queue/Worker.php new file mode 100644 index 0000000..492fae5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/Worker.php @@ -0,0 +1,628 @@ +events = $events; + $this->manager = $manager; + $this->exceptions = $exceptions; + } + + /** + * Listen to the given queue in a loop. + * + * @param string $connectionName + * @param string $queue + * @param \Illuminate\Queue\WorkerOptions $options + * @return void + */ + public function daemon($connectionName, $queue, WorkerOptions $options) + { + if ($this->supportsAsyncSignals()) { + $this->listenForSignals(); + } + + $lastRestart = $this->getTimestampOfLastQueueRestart(); + + while (true) { + // Before reserving any jobs, we will make sure this queue is not paused and + // if it is we will just pause this worker for a given amount of time and + // make sure we do not need to kill this worker process off completely. + if (! $this->daemonShouldRun($options, $connectionName, $queue)) { + $this->pauseWorker($options, $lastRestart); + + continue; + } + + // First, we will attempt to get the next job off of the queue. We will also + // register the timeout handler and reset the alarm for this job so it is + // not stuck in a frozen state forever. Then, we can fire off this job. + $job = $this->getNextJob( + $this->manager->connection($connectionName), $queue + ); + + if ($this->supportsAsyncSignals()) { + $this->registerTimeoutHandler($job, $options); + } + + // If the daemon should run (not in maintenance mode, etc.), then we can run + // fire off this job for processing. Otherwise, we will need to sleep the + // worker so no more jobs are processed until they should be processed. + if ($job) { + $this->runJob($job, $connectionName, $options); + } else { + $this->sleep($options->sleep); + } + + // Finally, we will check to see if we have exceeded our memory limits or if + // the queue should restart based on other indications. If so, we'll stop + // this worker and let whatever is "monitoring" it restart the process. + $this->stopIfNecessary($options, $lastRestart, $job); + } + } + + /** + * Register the worker timeout handler. + * + * @param \Illuminate\Contracts\Queue\Job|null $job + * @param \Illuminate\Queue\WorkerOptions $options + * @return void + */ + protected function registerTimeoutHandler($job, WorkerOptions $options) + { + // We will register a signal handler for the alarm signal so that we can kill this + // process if it is running too long because it has frozen. This uses the async + // signals supported in recent versions of PHP to accomplish it conveniently. + pcntl_signal(SIGALRM, function () { + $this->kill(1); + }); + + pcntl_alarm( + max($this->timeoutForJob($job, $options), 0) + ); + } + + /** + * Get the appropriate timeout for the given job. + * + * @param \Illuminate\Contracts\Queue\Job|null $job + * @param \Illuminate\Queue\WorkerOptions $options + * @return int + */ + protected function timeoutForJob($job, WorkerOptions $options) + { + return $job && ! is_null($job->timeout()) ? $job->timeout() : $options->timeout; + } + + /** + * Determine if the daemon should process on this iteration. + * + * @param \Illuminate\Queue\WorkerOptions $options + * @param string $connectionName + * @param string $queue + * @return bool + */ + protected function daemonShouldRun(WorkerOptions $options, $connectionName, $queue) + { + return ! (($this->manager->isDownForMaintenance() && ! $options->force) || + $this->paused || + $this->events->until(new Events\Looping($connectionName, $queue)) === false); + } + + /** + * Pause the worker for the current loop. + * + * @param \Illuminate\Queue\WorkerOptions $options + * @param int $lastRestart + * @return void + */ + protected function pauseWorker(WorkerOptions $options, $lastRestart) + { + $this->sleep($options->sleep > 0 ? $options->sleep : 1); + + $this->stopIfNecessary($options, $lastRestart); + } + + /** + * Stop the process if necessary. + * + * @param \Illuminate\Queue\WorkerOptions $options + * @param int $lastRestart + * @param mixed $job + */ + protected function stopIfNecessary(WorkerOptions $options, $lastRestart, $job = null) + { + if ($this->shouldQuit) { + $this->stop(); + } elseif ($this->memoryExceeded($options->memory)) { + $this->stop(12); + } elseif ($this->queueShouldRestart($lastRestart)) { + $this->stop(); + } elseif ($options->stopWhenEmpty && is_null($job)) { + $this->stop(); + } + } + + /** + * Process the next job on the queue. + * + * @param string $connectionName + * @param string $queue + * @param \Illuminate\Queue\WorkerOptions $options + * @return void + */ + public function runNextJob($connectionName, $queue, WorkerOptions $options) + { + $job = $this->getNextJob( + $this->manager->connection($connectionName), $queue + ); + + // If we're able to pull a job off of the stack, we will process it and then return + // from this method. If there is no job on the queue, we will "sleep" the worker + // for the specified number of seconds, then keep processing jobs after sleep. + if ($job) { + return $this->runJob($job, $connectionName, $options); + } + + $this->sleep($options->sleep); + } + + /** + * Get the next job from the queue connection. + * + * @param \Illuminate\Contracts\Queue\Queue $connection + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + protected function getNextJob($connection, $queue) + { + try { + foreach (explode(',', $queue) as $queue) { + if (! is_null($job = $connection->pop($queue))) { + return $job; + } + } + } catch (Exception $e) { + $this->exceptions->report($e); + + $this->stopWorkerIfLostConnection($e); + + $this->sleep(1); + } catch (Throwable $e) { + $this->exceptions->report($e = new FatalThrowableError($e)); + + $this->stopWorkerIfLostConnection($e); + + $this->sleep(1); + } + } + + /** + * Process the given job. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @param string $connectionName + * @param \Illuminate\Queue\WorkerOptions $options + * @return void + */ + protected function runJob($job, $connectionName, WorkerOptions $options) + { + try { + return $this->process($connectionName, $job, $options); + } catch (Exception $e) { + $this->exceptions->report($e); + + $this->stopWorkerIfLostConnection($e); + } catch (Throwable $e) { + $this->exceptions->report($e = new FatalThrowableError($e)); + + $this->stopWorkerIfLostConnection($e); + } + } + + /** + * Stop the worker if we have lost connection to a database. + * + * @param \Throwable $e + * @return void + */ + protected function stopWorkerIfLostConnection($e) + { + if ($this->causedByLostConnection($e)) { + $this->shouldQuit = true; + } + } + + /** + * Process the given job from the queue. + * + * @param string $connectionName + * @param \Illuminate\Contracts\Queue\Job $job + * @param \Illuminate\Queue\WorkerOptions $options + * @return void + * + * @throws \Throwable + */ + public function process($connectionName, $job, WorkerOptions $options) + { + try { + // First we will raise the before job event and determine if the job has already ran + // over its maximum attempt limits, which could primarily happen when this job is + // continually timing out and not actually throwing any exceptions from itself. + $this->raiseBeforeJobEvent($connectionName, $job); + + $this->markJobAsFailedIfAlreadyExceedsMaxAttempts( + $connectionName, $job, (int) $options->maxTries + ); + + // Here we will fire off the job and let it process. We will catch any exceptions so + // they can be reported to the developers logs, etc. Once the job is finished the + // proper events will be fired to let any listeners know this job has finished. + $job->fire(); + + $this->raiseAfterJobEvent($connectionName, $job); + } catch (Exception $e) { + $this->handleJobException($connectionName, $job, $options, $e); + } catch (Throwable $e) { + $this->handleJobException( + $connectionName, $job, $options, new FatalThrowableError($e) + ); + } + } + + /** + * Handle an exception that occurred while the job was running. + * + * @param string $connectionName + * @param \Illuminate\Contracts\Queue\Job $job + * @param \Illuminate\Queue\WorkerOptions $options + * @param \Exception $e + * @return void + * + * @throws \Exception + */ + protected function handleJobException($connectionName, $job, WorkerOptions $options, $e) + { + try { + // First, we will go ahead and mark the job as failed if it will exceed the maximum + // attempts it is allowed to run the next time we process it. If so we will just + // go ahead and mark it as failed now so we do not have to release this again. + if (! $job->hasFailed()) { + $this->markJobAsFailedIfWillExceedMaxAttempts( + $connectionName, $job, (int) $options->maxTries, $e + ); + } + + $this->raiseExceptionOccurredJobEvent( + $connectionName, $job, $e + ); + } finally { + // If we catch an exception, we will attempt to release the job back onto the queue + // so it is not lost entirely. This'll let the job be retried at a later time by + // another listener (or this same one). We will re-throw this exception after. + if (! $job->isDeleted() && ! $job->isReleased() && ! $job->hasFailed()) { + $job->release($options->delay); + } + } + + throw $e; + } + + /** + * Mark the given job as failed if it has exceeded the maximum allowed attempts. + * + * This will likely be because the job previously exceeded a timeout. + * + * @param string $connectionName + * @param \Illuminate\Contracts\Queue\Job $job + * @param int $maxTries + * @return void + */ + protected function markJobAsFailedIfAlreadyExceedsMaxAttempts($connectionName, $job, $maxTries) + { + $maxTries = ! is_null($job->maxTries()) ? $job->maxTries() : $maxTries; + + $timeoutAt = $job->timeoutAt(); + + if ($timeoutAt && Carbon::now()->getTimestamp() <= $timeoutAt) { + return; + } + + if (! $timeoutAt && ($maxTries === 0 || $job->attempts() <= $maxTries)) { + return; + } + + $this->failJob($connectionName, $job, $e = new MaxAttemptsExceededException( + $job->resolveName().' has been attempted too many times or run too long. The job may have previously timed out.' + )); + + throw $e; + } + + /** + * Mark the given job as failed if it has exceeded the maximum allowed attempts. + * + * @param string $connectionName + * @param \Illuminate\Contracts\Queue\Job $job + * @param int $maxTries + * @param \Exception $e + * @return void + */ + protected function markJobAsFailedIfWillExceedMaxAttempts($connectionName, $job, $maxTries, $e) + { + $maxTries = ! is_null($job->maxTries()) ? $job->maxTries() : $maxTries; + + if ($job->timeoutAt() && $job->timeoutAt() <= Carbon::now()->getTimestamp()) { + $this->failJob($connectionName, $job, $e); + } + + if ($maxTries > 0 && $job->attempts() >= $maxTries) { + $this->failJob($connectionName, $job, $e); + } + } + + /** + * Mark the given job as failed and raise the relevant event. + * + * @param string $connectionName + * @param \Illuminate\Contracts\Queue\Job $job + * @param \Exception $e + * @return void + */ + protected function failJob($connectionName, $job, $e) + { + return FailingJob::handle($connectionName, $job, $e); + } + + /** + * Raise the before queue job event. + * + * @param string $connectionName + * @param \Illuminate\Contracts\Queue\Job $job + * @return void + */ + protected function raiseBeforeJobEvent($connectionName, $job) + { + $this->events->dispatch(new Events\JobProcessing( + $connectionName, $job + )); + } + + /** + * Raise the after queue job event. + * + * @param string $connectionName + * @param \Illuminate\Contracts\Queue\Job $job + * @return void + */ + protected function raiseAfterJobEvent($connectionName, $job) + { + $this->events->dispatch(new Events\JobProcessed( + $connectionName, $job + )); + } + + /** + * Raise the exception occurred queue job event. + * + * @param string $connectionName + * @param \Illuminate\Contracts\Queue\Job $job + * @param \Exception $e + * @return void + */ + protected function raiseExceptionOccurredJobEvent($connectionName, $job, $e) + { + $this->events->dispatch(new Events\JobExceptionOccurred( + $connectionName, $job, $e + )); + } + + /** + * Determine if the queue worker should restart. + * + * @param int|null $lastRestart + * @return bool + */ + protected function queueShouldRestart($lastRestart) + { + return $this->getTimestampOfLastQueueRestart() != $lastRestart; + } + + /** + * Get the last queue restart timestamp, or null. + * + * @return int|null + */ + protected function getTimestampOfLastQueueRestart() + { + if ($this->cache) { + return $this->cache->get('illuminate:queue:restart'); + } + } + + /** + * Enable async signals for the process. + * + * @return void + */ + protected function listenForSignals() + { + pcntl_async_signals(true); + + pcntl_signal(SIGTERM, function () { + $this->shouldQuit = true; + }); + + pcntl_signal(SIGUSR2, function () { + $this->paused = true; + }); + + pcntl_signal(SIGCONT, function () { + $this->paused = false; + }); + } + + /** + * Determine if "async" signals are supported. + * + * @return bool + */ + protected function supportsAsyncSignals() + { + return extension_loaded('pcntl'); + } + + /** + * Determine if the memory limit has been exceeded. + * + * @param int $memoryLimit + * @return bool + */ + public function memoryExceeded($memoryLimit) + { + return (memory_get_usage(true) / 1024 / 1024) >= $memoryLimit; + } + + /** + * Stop listening and bail out of the script. + * + * @param int $status + * @return void + */ + public function stop($status = 0) + { + $this->events->dispatch(new Events\WorkerStopping($status)); + + exit($status); + } + + /** + * Kill the process. + * + * @param int $status + * @return void + */ + public function kill($status = 0) + { + $this->events->dispatch(new Events\WorkerStopping($status)); + + if (extension_loaded('posix')) { + posix_kill(getmypid(), SIGKILL); + } + + exit($status); + } + + /** + * Sleep the script for a given number of seconds. + * + * @param int|float $seconds + * @return void + */ + public function sleep($seconds) + { + if ($seconds < 1) { + usleep($seconds * 1000000); + } else { + sleep($seconds); + } + } + + /** + * Set the cache repository implementation. + * + * @param \Illuminate\Contracts\Cache\Repository $cache + * @return void + */ + public function setCache(CacheContract $cache) + { + $this->cache = $cache; + } + + /** + * Get the queue manager instance. + * + * @return \Illuminate\Queue\QueueManager + */ + public function getManager() + { + return $this->manager; + } + + /** + * Set the queue manager instance. + * + * @param \Illuminate\Queue\QueueManager $manager + * @return void + */ + public function setManager(QueueManager $manager) + { + $this->manager = $manager; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/WorkerOptions.php b/vendor/laravel/framework/src/Illuminate/Queue/WorkerOptions.php new file mode 100644 index 0000000..8e51c4d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/WorkerOptions.php @@ -0,0 +1,78 @@ +delay = $delay; + $this->sleep = $sleep; + $this->force = $force; + $this->memory = $memory; + $this->timeout = $timeout; + $this->maxTries = $maxTries; + $this->stopWhenEmpty = $stopWhenEmpty; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Queue/composer.json b/vendor/laravel/framework/src/Illuminate/Queue/composer.json new file mode 100644 index 0000000..8ef7982 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Queue/composer.json @@ -0,0 +1,49 @@ +{ + "name": "illuminate/queue", + "description": "The Illuminate Queue package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/console": "5.7.*", + "illuminate/container": "5.7.*", + "illuminate/contracts": "5.7.*", + "illuminate/database": "5.7.*", + "illuminate/filesystem": "5.7.*", + "illuminate/support": "5.7.*", + "opis/closure": "^3.1", + "symfony/debug": "^4.1", + "symfony/process": "^4.1" + }, + "autoload": { + "psr-4": { + "Illuminate\\Queue\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "suggest": { + "ext-pcntl": "Required to use all features of the queue worker.", + "ext-posix": "Required to use all features of the queue worker.", + "aws/aws-sdk-php": "Required to use the SQS queue driver (^3.0).", + "illuminate/redis": "Required to use the Redis queue driver (5.7.*).", + "pda/pheanstalk": "Required to use the Beanstalk queue driver (^3.0)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php b/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php new file mode 100644 index 0000000..e09c203 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php @@ -0,0 +1,216 @@ +client; + } + + /** + * Subscribe to a set of given channels for messages. + * + * @param array|string $channels + * @param \Closure $callback + * @return void + */ + public function subscribe($channels, Closure $callback) + { + return $this->createSubscription($channels, $callback, __FUNCTION__); + } + + /** + * Subscribe to a set of given channels with wildcards. + * + * @param array|string $channels + * @param \Closure $callback + * @return void + */ + public function psubscribe($channels, Closure $callback) + { + return $this->createSubscription($channels, $callback, __FUNCTION__); + } + + /** + * Run a command against the Redis database. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function command($method, array $parameters = []) + { + $start = microtime(true); + + $result = $this->client->{$method}(...$parameters); + + $time = round((microtime(true) - $start) * 1000, 2); + + if (isset($this->events)) { + $this->event(new CommandExecuted($method, $parameters, $time, $this)); + } + + return $result; + } + + /** + * Fire the given event if possible. + * + * @param mixed $event + * @return void + */ + protected function event($event) + { + if (isset($this->events)) { + $this->events->dispatch($event); + } + } + + /** + * Register a Redis command listener with the connection. + * + * @param \Closure $callback + * @return void + */ + public function listen(Closure $callback) + { + if (isset($this->events)) { + $this->events->listen(CommandExecuted::class, $callback); + } + } + + /** + * Get the connection name. + * + * @return string|null + */ + public function getName() + { + return $this->name; + } + + /** + * Set the connections name. + * + * @param string $name + * @return $this + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get the event dispatcher used by the connection. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public function getEventDispatcher() + { + return $this->events; + } + + /** + * Set the event dispatcher instance on the connection. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function setEventDispatcher(Dispatcher $events) + { + $this->events = $events; + } + + /** + * Unset the event dispatcher instance on the connection. + * + * @return void + */ + public function unsetEventDispatcher() + { + $this->events = null; + } + + /** + * Pass other method calls down to the underlying client. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->command($method, $parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisClusterConnection.php b/vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisClusterConnection.php new file mode 100644 index 0000000..e246fe6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisClusterConnection.php @@ -0,0 +1,8 @@ +client = $client; + } + + /** + * Returns the value of the given key. + * + * @param string $key + * @return string|null + */ + public function get($key) + { + $result = $this->command('get', [$key]); + + return $result !== false ? $result : null; + } + + /** + * Get the values of all the given keys. + * + * @param array $keys + * @return array + */ + public function mget(array $keys) + { + return array_map(function ($value) { + return $value !== false ? $value : null; + }, $this->command('mget', [$keys])); + } + + /** + * Determine if the given keys exist. + * + * @param dynamic $keys + * @return int + */ + public function exists(...$keys) + { + $keys = collect($keys)->map(function ($key) { + return $this->applyPrefix($key); + })->all(); + + return $this->executeRaw(array_merge(['exists'], $keys)); + } + + /** + * Set the string value in argument as value of the key. + * + * @param string $key + * @param mixed $value + * @param string|null $expireResolution + * @param int|null $expireTTL + * @param string|null $flag + * @return bool + */ + public function set($key, $value, $expireResolution = null, $expireTTL = null, $flag = null) + { + return $this->command('set', [ + $key, + $value, + $expireResolution ? [$flag, $expireResolution => $expireTTL] : null, + ]); + } + + /** + * Set the given key if it doesn't exist. + * + * @param string $key + * @param string $value + * @return int + */ + public function setnx($key, $value) + { + return (int) $this->command('setnx', [$key, $value]); + } + + /** + * Get the value of the given hash fields. + * + * @param string $key + * @param dynamic $dictionary + * @return int + */ + public function hmget($key, ...$dictionary) + { + if (count($dictionary) === 1) { + $dictionary = $dictionary[0]; + } + + return array_values($this->command('hmget', [$key, $dictionary])); + } + + /** + * Set the given hash fields to their respective values. + * + * @param string $key + * @param dynamic $dictionary + * @return int + */ + public function hmset($key, ...$dictionary) + { + if (count($dictionary) === 1) { + $dictionary = $dictionary[0]; + } else { + $input = collect($dictionary); + + $dictionary = $input->nth(2)->combine($input->nth(2, 1))->toArray(); + } + + return $this->command('hmset', [$key, $dictionary]); + } + + /** + * Set the given hash field if it doesn't exist. + * + * @param string $hash + * @param string $key + * @param string $value + * @return int + */ + public function hsetnx($hash, $key, $value) + { + return (int) $this->command('hsetnx', [$hash, $key, $value]); + } + + /** + * Removes the first count occurrences of the value element from the list. + * + * @param string $key + * @param int $count + * @param $value $value + * @return int|false + */ + public function lrem($key, $count, $value) + { + return $this->command('lrem', [$key, $value, $count]); + } + + /** + * Removes and returns the first element of the list stored at key. + * + * @param dynamic $arguments + * @return array|null + */ + public function blpop(...$arguments) + { + $result = $this->command('blpop', $arguments); + + return empty($result) ? null : $result; + } + + /** + * Removes and returns the last element of the list stored at key. + * + * @param dynamic $arguments + * @return array|null + */ + public function brpop(...$arguments) + { + $result = $this->command('brpop', $arguments); + + return empty($result) ? null : $result; + } + + /** + * Removes and returns a random element from the set value at key. + * + * @param string $key + * @param int|null $count + * @return mixed|false + */ + public function spop($key, $count = null) + { + return $this->command('spop', [$key]); + } + + /** + * Add one or more members to a sorted set or update its score if it already exists. + * + * @param string $key + * @param dynamic $dictionary + * @return int + */ + public function zadd($key, ...$dictionary) + { + if (is_array(end($dictionary))) { + foreach (array_pop($dictionary) as $member => $score) { + $dictionary[] = $score; + $dictionary[] = $member; + } + } + + $key = $this->applyPrefix($key); + + return $this->executeRaw(array_merge(['zadd', $key], $dictionary)); + } + + /** + * Return elements with score between $min and $max. + * + * @param string $key + * @param mixed $min + * @param mixed $max + * @param array $options + * @return int + */ + public function zrangebyscore($key, $min, $max, $options = []) + { + if (isset($options['limit'])) { + $options['limit'] = [ + $options['limit']['offset'], + $options['limit']['count'], + ]; + } + + return $this->command('zRangeByScore', [$key, $min, $max, $options]); + } + + /** + * Return elements with score between $min and $max. + * + * @param string $key + * @param mixed $min + * @param mixed $max + * @param array $options + * @return int + */ + public function zrevrangebyscore($key, $min, $max, $options = []) + { + if (isset($options['limit'])) { + $options['limit'] = [ + $options['limit']['offset'], + $options['limit']['count'], + ]; + } + + return $this->command('zRevRangeByScore', [$key, $min, $max, $options]); + } + + /** + * Find the intersection between sets and store in a new set. + * + * @param string $output + * @param array $keys + * @param array $options + * @return int + */ + public function zinterstore($output, $keys, $options = []) + { + return $this->command('zInter', [$output, $keys, + $options['weights'] ?? null, + $options['aggregate'] ?? 'sum', + ]); + } + + /** + * Find the union between sets and store in a new set. + * + * @param string $output + * @param array $keys + * @param array $options + * @return int + */ + public function zunionstore($output, $keys, $options = []) + { + return $this->command('zUnion', [$output, $keys, + $options['weights'] ?? null, + $options['aggregate'] ?? 'sum', + ]); + } + + /** + * Execute commands in a pipeline. + * + * @param callable $callback + * @return \Redis|array + */ + public function pipeline(callable $callback = null) + { + $pipeline = $this->client()->pipeline(); + + return is_null($callback) + ? $pipeline + : tap($pipeline, $callback)->exec(); + } + + /** + * Execute commands in a transaction. + * + * @param callable $callback + * @return \Redis|array + */ + public function transaction(callable $callback = null) + { + $transaction = $this->client()->multi(); + + return is_null($callback) + ? $transaction + : tap($transaction, $callback)->exec(); + } + + /** + * Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself. + * + * @param string $script + * @param int $numkeys + * @param mixed $arguments + * @return mixed + */ + public function evalsha($script, $numkeys, ...$arguments) + { + return $this->command('evalsha', [ + $this->script('load', $script), $arguments, $numkeys, + ]); + } + + /** + * Evaluate a script and return its result. + * + * @param string $script + * @param int $numberOfKeys + * @param dynamic $arguments + * @return mixed + */ + public function eval($script, $numberOfKeys, ...$arguments) + { + return $this->command('eval', [$script, $arguments, $numberOfKeys]); + } + + /** + * Subscribe to a set of given channels for messages. + * + * @param array|string $channels + * @param \Closure $callback + * @return void + */ + public function subscribe($channels, Closure $callback) + { + $this->client->subscribe((array) $channels, function ($redis, $channel, $message) use ($callback) { + $callback($message, $channel); + }); + } + + /** + * Subscribe to a set of given channels with wildcards. + * + * @param array|string $channels + * @param \Closure $callback + * @return void + */ + public function psubscribe($channels, Closure $callback) + { + $this->client->psubscribe((array) $channels, function ($redis, $pattern, $channel, $message) use ($callback) { + $callback($message, $channel); + }); + } + + /** + * Subscribe to a set of given channels for messages. + * + * @param array|string $channels + * @param \Closure $callback + * @param string $method + * @return void + */ + public function createSubscription($channels, Closure $callback, $method = 'subscribe') + { + // + } + + /** + * Execute a raw command. + * + * @param array $parameters + * @return mixed + */ + public function executeRaw(array $parameters) + { + return $this->command('rawCommand', $parameters); + } + + /** + * Disconnects from the Redis instance. + * + * @return void + */ + public function disconnect() + { + $this->client->close(); + } + + /** + * Apply prefix to the given key if necessary. + * + * @param string $key + * @return string + */ + private function applyPrefix($key) + { + $prefix = (string) $this->client->getOption(Redis::OPT_PREFIX); + + return $prefix.$key; + } + + /** + * Pass other method calls down to the underlying client. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return parent::__call(strtolower($method), $parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Connections/PredisClusterConnection.php b/vendor/laravel/framework/src/Illuminate/Redis/Connections/PredisClusterConnection.php new file mode 100644 index 0000000..399be1e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Connections/PredisClusterConnection.php @@ -0,0 +1,8 @@ +client = $client; + } + + /** + * Subscribe to a set of given channels for messages. + * + * @param array|string $channels + * @param \Closure $callback + * @param string $method + * @return void + */ + public function createSubscription($channels, Closure $callback, $method = 'subscribe') + { + $loop = $this->pubSubLoop(); + + call_user_func_array([$loop, $method], (array) $channels); + + foreach ($loop as $message) { + if ($message->kind === 'message' || $message->kind === 'pmessage') { + call_user_func($callback, $message->payload, $message->channel); + } + } + + unset($loop); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php b/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php new file mode 100644 index 0000000..a3800b1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php @@ -0,0 +1,129 @@ +createClient(array_merge( + $config, $options, Arr::pull($config, 'options', []) + ))); + } + + /** + * Create a new clustered PhpRedis connection. + * + * @param array $config + * @param array $clusterOptions + * @param array $options + * @return \Illuminate\Redis\Connections\PhpRedisClusterConnection + */ + public function connectToCluster(array $config, array $clusterOptions, array $options) + { + $options = array_merge($options, $clusterOptions, Arr::pull($config, 'options', [])); + + return new PhpRedisClusterConnection($this->createRedisClusterInstance( + array_map([$this, 'buildClusterConnectionString'], $config), $options + )); + } + + /** + * Build a single cluster seed string from array. + * + * @param array $server + * @return string + */ + protected function buildClusterConnectionString(array $server) + { + return $server['host'].':'.$server['port'].'?'.Arr::query(Arr::only($server, [ + 'database', 'password', 'prefix', 'read_timeout', + ])); + } + + /** + * Create the Redis client instance. + * + * @param array $config + * @return \Redis + */ + protected function createClient(array $config) + { + return tap(new Redis, function ($client) use ($config) { + $this->establishConnection($client, $config); + + if (! empty($config['password'])) { + $client->auth($config['password']); + } + + if (! empty($config['database'])) { + $client->select($config['database']); + } + + if (! empty($config['prefix'])) { + $client->setOption(Redis::OPT_PREFIX, $config['prefix']); + } + + if (! empty($config['read_timeout'])) { + $client->setOption(Redis::OPT_READ_TIMEOUT, $config['read_timeout']); + } + }); + } + + /** + * Establish a connection with the Redis host. + * + * @param \Redis $client + * @param array $config + * @return void + */ + protected function establishConnection($client, array $config) + { + $persistent = $config['persistent'] ?? false; + + $parameters = [ + $config['host'], + $config['port'], + Arr::get($config, 'timeout', 0.0), + $persistent ? Arr::get($config, 'persistent_id', null) : null, + Arr::get($config, 'retry_interval', 0), + ]; + + if (version_compare(phpversion('redis'), '3.1.3', '>=')) { + $parameters[] = Arr::get($config, 'read_timeout', 0.0); + } + + $client->{($persistent ? 'pconnect' : 'connect')}(...$parameters); + } + + /** + * Create a new redis cluster instance. + * + * @param array $servers + * @param array $options + * @return \RedisCluster + */ + protected function createRedisClusterInstance(array $servers, array $options) + { + return new RedisCluster( + null, + array_values($servers), + $options['timeout'] ?? 0, + $options['read_timeout'] ?? 0, + isset($options['persistent']) && $options['persistent'] + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PredisConnector.php b/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PredisConnector.php new file mode 100644 index 0000000..8b1a46b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PredisConnector.php @@ -0,0 +1,44 @@ + 10.0], $options, Arr::pull($config, 'options', []) + ); + + return new PredisConnection(new Client($config, $formattedOptions)); + } + + /** + * Create a new clustered Predis connection. + * + * @param array $config + * @param array $clusterOptions + * @param array $options + * @return \Illuminate\Redis\Connections\PredisClusterConnection + */ + public function connectToCluster(array $config, array $clusterOptions, array $options) + { + $clusterSpecificOptions = Arr::pull($config, 'options', []); + + return new PredisClusterConnection(new Client(array_values($config), array_merge( + $options, $clusterOptions, $clusterSpecificOptions + ))); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Events/CommandExecuted.php b/vendor/laravel/framework/src/Illuminate/Redis/Events/CommandExecuted.php new file mode 100644 index 0000000..fa65719 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Events/CommandExecuted.php @@ -0,0 +1,59 @@ +time = $time; + $this->command = $command; + $this->parameters = $parameters; + $this->connection = $connection; + $this->connectionName = $connection->getName(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Limiters/ConcurrencyLimiter.php b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/ConcurrencyLimiter.php new file mode 100644 index 0000000..78fc923 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/ConcurrencyLimiter.php @@ -0,0 +1,140 @@ +name = $name; + $this->redis = $redis; + $this->maxLocks = $maxLocks; + $this->releaseAfter = $releaseAfter; + } + + /** + * Attempt to acquire the lock for the given number of seconds. + * + * @param int $timeout + * @param callable|null $callback + * @return bool + * + * @throws \Illuminate\Contracts\Redis\LimiterTimeoutException + * @throws \Exception + */ + public function block($timeout, $callback = null) + { + $starting = time(); + + while (! $slot = $this->acquire()) { + if (time() - $timeout >= $starting) { + throw new LimiterTimeoutException; + } + + usleep(250 * 1000); + } + + if (is_callable($callback)) { + try { + return tap($callback(), function () use ($slot) { + $this->release($slot); + }); + } catch (Exception $exception) { + $this->release($slot); + + throw $exception; + } + } + + return true; + } + + /** + * Attempt to acquire the lock. + * + * @return mixed + */ + protected function acquire() + { + $slots = array_map(function ($i) { + return $this->name.$i; + }, range(1, $this->maxLocks)); + + return $this->redis->eval(...array_merge( + [$this->luaScript(), count($slots)], + array_merge($slots, [$this->name, $this->releaseAfter]) + )); + } + + /** + * Get the Lua script for acquiring a lock. + * + * KEYS - The keys that represent available slots + * ARGV[1] - The limiter name + * ARGV[2] - The number of seconds the slot should be reserved + * + * @return string + */ + protected function luaScript() + { + return <<<'LUA' +for index, value in pairs(redis.call('mget', unpack(KEYS))) do + if not value then + redis.call('set', ARGV[1]..index, "1", "EX", ARGV[2]) + return ARGV[1]..index + end +end +LUA; + } + + /** + * Release the lock. + * + * @param string $key + * @return void + */ + protected function release($key) + { + $this->redis->command('del', [$key]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Limiters/ConcurrencyLimiterBuilder.php b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/ConcurrencyLimiterBuilder.php new file mode 100644 index 0000000..10a614f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/ConcurrencyLimiterBuilder.php @@ -0,0 +1,122 @@ +name = $name; + $this->connection = $connection; + } + + /** + * Set the maximum number of locks that can obtained per time window. + * + * @param int $maxLocks + * @return $this + */ + public function limit($maxLocks) + { + $this->maxLocks = $maxLocks; + + return $this; + } + + /** + * Set the number of seconds until the lock will be released. + * + * @param int $releaseAfter + * @return $this + */ + public function releaseAfter($releaseAfter) + { + $this->releaseAfter = $this->secondsUntil($releaseAfter); + + return $this; + } + + /** + * Set the amount of time to block until a lock is available. + * + * @param int $timeout + * @return $this + */ + public function block($timeout) + { + $this->timeout = $timeout; + + return $this; + } + + /** + * Execute the given callback if a lock is obtained, otherwise call the failure callback. + * + * @param callable $callback + * @param callable|null $failure + * @return mixed + * + * @throws \Illuminate\Contracts\Redis\LimiterTimeoutException + */ + public function then(callable $callback, callable $failure = null) + { + try { + return (new ConcurrencyLimiter( + $this->connection, $this->name, $this->maxLocks, $this->releaseAfter + ))->block($this->timeout, $callback); + } catch (LimiterTimeoutException $e) { + if ($failure) { + return $failure($e); + } + + throw $e; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Limiters/DurationLimiter.php b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/DurationLimiter.php new file mode 100644 index 0000000..3c74087 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/DurationLimiter.php @@ -0,0 +1,148 @@ +name = $name; + $this->decay = $decay; + $this->redis = $redis; + $this->maxLocks = $maxLocks; + } + + /** + * Attempt to acquire the lock for the given number of seconds. + * + * @param int $timeout + * @param callable|null $callback + * @return bool + * + * @throws \Illuminate\Contracts\Redis\LimiterTimeoutException + */ + public function block($timeout, $callback = null) + { + $starting = time(); + + while (! $this->acquire()) { + if (time() - $timeout >= $starting) { + throw new LimiterTimeoutException; + } + + usleep(750 * 1000); + } + + if (is_callable($callback)) { + $callback(); + } + + return true; + } + + /** + * Attempt to acquire the lock. + * + * @return bool + */ + public function acquire() + { + $results = $this->redis->eval( + $this->luaScript(), 1, $this->name, microtime(true), time(), $this->decay, $this->maxLocks + ); + + $this->decaysAt = $results[1]; + + $this->remaining = max(0, $results[2]); + + return (bool) $results[0]; + } + + /** + * Get the Lua script for acquiring a lock. + * + * KEYS[1] - The limiter name + * ARGV[1] - Current time in microseconds + * ARGV[2] - Current time in seconds + * ARGV[3] - Duration of the bucket + * ARGV[4] - Allowed number of tasks + * + * @return string + */ + protected function luaScript() + { + return <<<'LUA' +local function reset() + redis.call('HMSET', KEYS[1], 'start', ARGV[2], 'end', ARGV[2] + ARGV[3], 'count', 1) + return redis.call('EXPIRE', KEYS[1], ARGV[3] * 2) +end + +if redis.call('EXISTS', KEYS[1]) == 0 then + return {reset(), ARGV[2] + ARGV[3], ARGV[4] - 1} +end + +if ARGV[1] >= redis.call('HGET', KEYS[1], 'start') and ARGV[1] <= redis.call('HGET', KEYS[1], 'end') then + return { + tonumber(redis.call('HINCRBY', KEYS[1], 'count', 1)) <= tonumber(ARGV[4]), + redis.call('HGET', KEYS[1], 'end'), + ARGV[4] - redis.call('HGET', KEYS[1], 'count') + } +end + +return {reset(), ARGV[2] + ARGV[3], ARGV[4] - 1} +LUA; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php new file mode 100644 index 0000000..096e50c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php @@ -0,0 +1,122 @@ +name = $name; + $this->connection = $connection; + } + + /** + * Set the maximum number of locks that can obtained per time window. + * + * @param int $maxLocks + * @return $this + */ + public function allow($maxLocks) + { + $this->maxLocks = $maxLocks; + + return $this; + } + + /** + * Set the amount of time the lock window is maintained. + * + * @param int $decay + * @return $this + */ + public function every($decay) + { + $this->decay = $this->secondsUntil($decay); + + return $this; + } + + /** + * Set the amount of time to block until a lock is available. + * + * @param int $timeout + * @return $this + */ + public function block($timeout) + { + $this->timeout = $timeout; + + return $this; + } + + /** + * Execute the given callback if a lock is obtained, otherwise call the failure callback. + * + * @param callable $callback + * @param callable|null $failure + * @return mixed + * + * @throws \Illuminate\Contracts\Redis\LimiterTimeoutException + */ + public function then(callable $callback, callable $failure = null) + { + try { + return (new DurationLimiter( + $this->connection, $this->name, $this->maxLocks, $this->decay + ))->block($this->timeout, $callback); + } catch (LimiterTimeoutException $e) { + if ($failure) { + return $failure($e); + } + + throw $e; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php b/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php new file mode 100644 index 0000000..969c4db --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php @@ -0,0 +1,197 @@ +app = $app; + $this->driver = $driver; + $this->config = $config; + } + + /** + * Get a Redis connection by name. + * + * @param string|null $name + * @return \Illuminate\Redis\Connections\Connection + */ + public function connection($name = null) + { + $name = $name ?: 'default'; + + if (isset($this->connections[$name])) { + return $this->connections[$name]; + } + + return $this->connections[$name] = $this->configure( + $this->resolve($name), $name + ); + } + + /** + * Resolve the given connection by name. + * + * @param string|null $name + * @return \Illuminate\Redis\Connections\Connection + * + * @throws \InvalidArgumentException + */ + public function resolve($name = null) + { + $name = $name ?: 'default'; + + $options = $this->config['options'] ?? []; + + if (isset($this->config[$name])) { + return $this->connector()->connect($this->config[$name], $options); + } + + if (isset($this->config['clusters'][$name])) { + return $this->resolveCluster($name); + } + + throw new InvalidArgumentException("Redis connection [{$name}] not configured."); + } + + /** + * Resolve the given cluster connection by name. + * + * @param string $name + * @return \Illuminate\Redis\Connections\Connection + */ + protected function resolveCluster($name) + { + $clusterOptions = $this->config['clusters']['options'] ?? []; + + return $this->connector()->connectToCluster( + $this->config['clusters'][$name], $clusterOptions, $this->config['options'] ?? [] + ); + } + + /** + * Configure the given connection to prepare it for commands. + * + * @param \Illuminate\Redis\Connections\Connection $connection + * @param string $name + * @return \Illuminate\Redis\Connections\Connection + */ + protected function configure(Connection $connection, $name) + { + $connection->setName($name); + + if ($this->events && $this->app->bound('events')) { + $connection->setEventDispatcher($this->app->make('events')); + } + + return $connection; + } + + /** + * Get the connector instance for the current driver. + * + * @return \Illuminate\Redis\Connectors\PhpRedisConnector|\Illuminate\Redis\Connectors\PredisConnector + */ + protected function connector() + { + switch ($this->driver) { + case 'predis': + return new Connectors\PredisConnector; + case 'phpredis': + return new Connectors\PhpRedisConnector; + } + } + + /** + * Return all of the created connections. + * + * @return array + */ + public function connections() + { + return $this->connections; + } + + /** + * Enable the firing of Redis command events. + * + * @return void + */ + public function enableEvents() + { + $this->events = true; + } + + /** + * Disable the firing of Redis command events. + * + * @return void + */ + public function disableEvents() + { + $this->events = false; + } + + /** + * Pass methods onto the default Redis connection. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->connection()->{$method}(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/RedisServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Redis/RedisServiceProvider.php new file mode 100755 index 0000000..2d41938 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/RedisServiceProvider.php @@ -0,0 +1,44 @@ +app->singleton('redis', function ($app) { + $config = $app->make('config')->get('database.redis', []); + + return new RedisManager($app, Arr::pull($config, 'client', 'predis'), $config); + }); + + $this->app->bind('redis.connection', function ($app) { + return $app['redis']->connection(); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['redis', 'redis.connection']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Redis/composer.json b/vendor/laravel/framework/src/Illuminate/Redis/composer.json new file mode 100755 index 0000000..72f8b3b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Redis/composer.json @@ -0,0 +1,36 @@ +{ + "name": "illuminate/redis", + "description": "The Illuminate Redis package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*", + "predis/predis": "^1.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Redis\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Console/ControllerMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Routing/Console/ControllerMakeCommand.php new file mode 100755 index 0000000..85ee7d3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Console/ControllerMakeCommand.php @@ -0,0 +1,186 @@ +option('parent')) { + $stub = '/stubs/controller.nested.stub'; + } elseif ($this->option('model')) { + $stub = '/stubs/controller.model.stub'; + } elseif ($this->option('invokable')) { + $stub = '/stubs/controller.invokable.stub'; + } elseif ($this->option('resource')) { + $stub = '/stubs/controller.stub'; + } + + if ($this->option('api') && is_null($stub)) { + $stub = '/stubs/controller.api.stub'; + } elseif ($this->option('api') && ! is_null($stub) && ! $this->option('invokable')) { + $stub = str_replace('.stub', '.api.stub', $stub); + } + + $stub = $stub ?? '/stubs/controller.plain.stub'; + + return __DIR__.$stub; + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Http\Controllers'; + } + + /** + * Build the class with the given name. + * + * Remove the base controller import if we are already in base namespace. + * + * @param string $name + * @return string + */ + protected function buildClass($name) + { + $controllerNamespace = $this->getNamespace($name); + + $replace = []; + + if ($this->option('parent')) { + $replace = $this->buildParentReplacements(); + } + + if ($this->option('model')) { + $replace = $this->buildModelReplacements($replace); + } + + $replace["use {$controllerNamespace}\Controller;\n"] = ''; + + return str_replace( + array_keys($replace), array_values($replace), parent::buildClass($name) + ); + } + + /** + * Build the replacements for a parent controller. + * + * @return array + */ + protected function buildParentReplacements() + { + $parentModelClass = $this->parseModel($this->option('parent')); + + if (! class_exists($parentModelClass)) { + if ($this->confirm("A {$parentModelClass} model does not exist. Do you want to generate it?", true)) { + $this->call('make:model', ['name' => $parentModelClass]); + } + } + + return [ + 'ParentDummyFullModelClass' => $parentModelClass, + 'ParentDummyModelClass' => class_basename($parentModelClass), + 'ParentDummyModelVariable' => lcfirst(class_basename($parentModelClass)), + ]; + } + + /** + * Build the model replacement values. + * + * @param array $replace + * @return array + */ + protected function buildModelReplacements(array $replace) + { + $modelClass = $this->parseModel($this->option('model')); + + if (! class_exists($modelClass)) { + if ($this->confirm("A {$modelClass} model does not exist. Do you want to generate it?", true)) { + $this->call('make:model', ['name' => $modelClass]); + } + } + + return array_merge($replace, [ + 'DummyFullModelClass' => $modelClass, + 'DummyModelClass' => class_basename($modelClass), + 'DummyModelVariable' => lcfirst(class_basename($modelClass)), + ]); + } + + /** + * Get the fully-qualified model class name. + * + * @param string $model + * @return string + * + * @throws \InvalidArgumentException + */ + protected function parseModel($model) + { + if (preg_match('([^A-Za-z0-9_/\\\\])', $model)) { + throw new InvalidArgumentException('Model name contains invalid characters.'); + } + + $model = trim(str_replace('/', '\\', $model), '\\'); + + if (! Str::startsWith($model, $rootNamespace = $this->laravel->getNamespace())) { + $model = $rootNamespace.$model; + } + + return $model; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['model', 'm', InputOption::VALUE_OPTIONAL, 'Generate a resource controller for the given model.'], + ['resource', 'r', InputOption::VALUE_NONE, 'Generate a resource controller class.'], + ['invokable', 'i', InputOption::VALUE_NONE, 'Generate a single method, invokable controller class.'], + ['parent', 'p', InputOption::VALUE_OPTIONAL, 'Generate a nested resource controller class.'], + ['api', null, InputOption::VALUE_NONE, 'Exclude the create and edit methods from the controller.'], + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php b/vendor/laravel/framework/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php new file mode 100644 index 0000000..e41813d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Console/MiddlewareMakeCommand.php @@ -0,0 +1,50 @@ +middleware[] = [ + 'middleware' => $m, + 'options' => &$options, + ]; + } + + return new ControllerMiddlewareOptions($options); + } + + /** + * Get the middleware assigned to the controller. + * + * @return array + */ + public function getMiddleware() + { + return $this->middleware; + } + + /** + * Execute an action on the controller. + * + * @param string $method + * @param array $parameters + * @return \Symfony\Component\HttpFoundation\Response + */ + public function callAction($method, $parameters) + { + return call_user_func_array([$this, $method], $parameters); + } + + /** + * Handle calls to missing methods on the controller. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + throw new BadMethodCallException(sprintf( + 'Method %s::%s does not exist.', static::class, $method + )); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php b/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php new file mode 100644 index 0000000..673a333 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php @@ -0,0 +1,81 @@ +container = $container; + } + + /** + * Dispatch a request to a given controller and method. + * + * @param \Illuminate\Routing\Route $route + * @param mixed $controller + * @param string $method + * @return mixed + */ + public function dispatch(Route $route, $controller, $method) + { + $parameters = $this->resolveClassMethodDependencies( + $route->parametersWithoutNulls(), $controller, $method + ); + + if (method_exists($controller, 'callAction')) { + return $controller->callAction($method, $parameters); + } + + return $controller->{$method}(...array_values($parameters)); + } + + /** + * Get the middleware for the controller instance. + * + * @param \Illuminate\Routing\Controller $controller + * @param string $method + * @return array + */ + public function getMiddleware($controller, $method) + { + if (! method_exists($controller, 'getMiddleware')) { + return []; + } + + return collect($controller->getMiddleware())->reject(function ($data) use ($method) { + return static::methodExcludedByOptions($method, $data['options']); + })->pluck('middleware')->all(); + } + + /** + * Determine if the given options exclude a particular method. + * + * @param string $method + * @param array $options + * @return bool + */ + protected static function methodExcludedByOptions($method, array $options) + { + return (isset($options['only']) && ! in_array($method, (array) $options['only'])) || + (! empty($options['except']) && in_array($method, (array) $options['except'])); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/ControllerMiddlewareOptions.php b/vendor/laravel/framework/src/Illuminate/Routing/ControllerMiddlewareOptions.php new file mode 100644 index 0000000..13ef189 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/ControllerMiddlewareOptions.php @@ -0,0 +1,50 @@ +options = &$options; + } + + /** + * Set the controller methods the middleware should apply to. + * + * @param array|string|dynamic $methods + * @return $this + */ + public function only($methods) + { + $this->options['only'] = is_array($methods) ? $methods : func_get_args(); + + return $this; + } + + /** + * Set the controller methods the middleware should exclude. + * + * @param array|string|dynamic $methods + * @return $this + */ + public function except($methods) + { + $this->options['except'] = is_array($methods) ? $methods : func_get_args(); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Events/RouteMatched.php b/vendor/laravel/framework/src/Illuminate/Routing/Events/RouteMatched.php new file mode 100644 index 0000000..c848607 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Events/RouteMatched.php @@ -0,0 +1,33 @@ +route = $route; + $this->request = $request; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Exceptions/InvalidSignatureException.php b/vendor/laravel/framework/src/Illuminate/Routing/Exceptions/InvalidSignatureException.php new file mode 100644 index 0000000..06a35c5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Exceptions/InvalidSignatureException.php @@ -0,0 +1,18 @@ +getName()}] [URI: {$route->uri()}]."); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/ImplicitRouteBinding.php b/vendor/laravel/framework/src/Illuminate/Routing/ImplicitRouteBinding.php new file mode 100644 index 0000000..1f52fc1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/ImplicitRouteBinding.php @@ -0,0 +1,60 @@ +parameters(); + + foreach ($route->signatureParameters(UrlRoutable::class) as $parameter) { + if (! $parameterName = static::getParameterName($parameter->name, $parameters)) { + continue; + } + + $parameterValue = $parameters[$parameterName]; + + if ($parameterValue instanceof UrlRoutable) { + continue; + } + + $instance = $container->make($parameter->getClass()->name); + + if (! $model = $instance->resolveRouteBinding($parameterValue)) { + throw (new ModelNotFoundException)->setModel(get_class($instance)); + } + + $route->setParameter($parameterName, $model); + } + } + + /** + * Return the parameter name if it exists in the given parameters. + * + * @param string $name + * @param array $parameters + * @return string|null + */ + protected static function getParameterName($name, $parameters) + { + if (array_key_exists($name, $parameters)) { + return $name; + } + + if (array_key_exists($snakedName = Str::snake($name), $parameters)) { + return $snakedName; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php b/vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php new file mode 100644 index 0000000..76f9d87 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php @@ -0,0 +1,25 @@ +getCompiled()->getHostRegex())) { + return true; + } + + return preg_match($route->getCompiled()->getHostRegex(), $request->getHost()); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php b/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php new file mode 100644 index 0000000..f9cf155 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php @@ -0,0 +1,21 @@ +getMethod(), $route->methods()); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php b/vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php new file mode 100644 index 0000000..fd5d5af --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php @@ -0,0 +1,27 @@ +httpOnly()) { + return ! $request->secure(); + } elseif ($route->secure()) { + return $request->secure(); + } + + return true; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php b/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php new file mode 100644 index 0000000..3aeb73b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php @@ -0,0 +1,23 @@ +path() === '/' ? '/' : '/'.$request->path(); + + return preg_match($route->getCompiled()->getRegex(), rawurldecode($path)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php b/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php new file mode 100644 index 0000000..0f178f1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php @@ -0,0 +1,18 @@ +router = $router; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + $this->router->substituteBindings($route = $request->route()); + + $this->router->substituteImplicitBindings($route); + + return $next($request); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php b/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php new file mode 100644 index 0000000..b0b37b8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php @@ -0,0 +1,197 @@ +limiter = $limiter; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param int|string $maxAttempts + * @param float|int $decayMinutes + * @return \Symfony\Component\HttpFoundation\Response + * + * @throws \Illuminate\Http\Exceptions\ThrottleRequestsException + */ + public function handle($request, Closure $next, $maxAttempts = 60, $decayMinutes = 1) + { + $key = $this->resolveRequestSignature($request); + + $maxAttempts = $this->resolveMaxAttempts($request, $maxAttempts); + + if ($this->limiter->tooManyAttempts($key, $maxAttempts)) { + throw $this->buildException($key, $maxAttempts); + } + + $this->limiter->hit($key, $decayMinutes); + + $response = $next($request); + + return $this->addHeaders( + $response, $maxAttempts, + $this->calculateRemainingAttempts($key, $maxAttempts) + ); + } + + /** + * Resolve the number of attempts if the user is authenticated or not. + * + * @param \Illuminate\Http\Request $request + * @param int|string $maxAttempts + * @return int + */ + protected function resolveMaxAttempts($request, $maxAttempts) + { + if (Str::contains($maxAttempts, '|')) { + $maxAttempts = explode('|', $maxAttempts, 2)[$request->user() ? 1 : 0]; + } + + if (! is_numeric($maxAttempts) && $request->user()) { + $maxAttempts = $request->user()->{$maxAttempts}; + } + + return (int) $maxAttempts; + } + + /** + * Resolve request signature. + * + * @param \Illuminate\Http\Request $request + * @return string + * + * @throws \RuntimeException + */ + protected function resolveRequestSignature($request) + { + if ($user = $request->user()) { + return sha1($user->getAuthIdentifier()); + } + + if ($route = $request->route()) { + return sha1($route->getDomain().'|'.$request->ip()); + } + + throw new RuntimeException('Unable to generate the request signature. Route unavailable.'); + } + + /** + * Create a 'too many attempts' exception. + * + * @param string $key + * @param int $maxAttempts + * @return \Illuminate\Http\Exceptions\ThrottleRequestsException + */ + protected function buildException($key, $maxAttempts) + { + $retryAfter = $this->getTimeUntilNextRetry($key); + + $headers = $this->getHeaders( + $maxAttempts, + $this->calculateRemainingAttempts($key, $maxAttempts, $retryAfter), + $retryAfter + ); + + return new ThrottleRequestsException( + 'Too Many Attempts.', null, $headers + ); + } + + /** + * Get the number of seconds until the next retry. + * + * @param string $key + * @return int + */ + protected function getTimeUntilNextRetry($key) + { + return $this->limiter->availableIn($key); + } + + /** + * Add the limit header information to the given response. + * + * @param \Symfony\Component\HttpFoundation\Response $response + * @param int $maxAttempts + * @param int $remainingAttempts + * @param int|null $retryAfter + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function addHeaders(Response $response, $maxAttempts, $remainingAttempts, $retryAfter = null) + { + $response->headers->add( + $this->getHeaders($maxAttempts, $remainingAttempts, $retryAfter) + ); + + return $response; + } + + /** + * Get the limit headers information. + * + * @param int $maxAttempts + * @param int $remainingAttempts + * @param int|null $retryAfter + * @return array + */ + protected function getHeaders($maxAttempts, $remainingAttempts, $retryAfter = null) + { + $headers = [ + 'X-RateLimit-Limit' => $maxAttempts, + 'X-RateLimit-Remaining' => $remainingAttempts, + ]; + + if (! is_null($retryAfter)) { + $headers['Retry-After'] = $retryAfter; + $headers['X-RateLimit-Reset'] = $this->availableAt($retryAfter); + } + + return $headers; + } + + /** + * Calculate the number of remaining attempts. + * + * @param string $key + * @param int $maxAttempts + * @param int|null $retryAfter + * @return int + */ + protected function calculateRemainingAttempts($key, $maxAttempts, $retryAfter = null) + { + if (is_null($retryAfter)) { + return $this->limiter->retriesLeft($key, $maxAttempts); + } + + return 0; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php b/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php new file mode 100644 index 0000000..fe2567f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php @@ -0,0 +1,120 @@ +redis = $redis; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param int|string $maxAttempts + * @param float|int $decayMinutes + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + */ + public function handle($request, Closure $next, $maxAttempts = 60, $decayMinutes = 1) + { + $key = $this->resolveRequestSignature($request); + + $maxAttempts = $this->resolveMaxAttempts($request, $maxAttempts); + + if ($this->tooManyAttempts($key, $maxAttempts, $decayMinutes)) { + throw $this->buildException($key, $maxAttempts); + } + + $response = $next($request); + + return $this->addHeaders( + $response, $maxAttempts, + $this->calculateRemainingAttempts($key, $maxAttempts) + ); + } + + /** + * Determine if the given key has been "accessed" too many times. + * + * @param string $key + * @param int $maxAttempts + * @param int $decayMinutes + * @return mixed + */ + protected function tooManyAttempts($key, $maxAttempts, $decayMinutes) + { + $limiter = new DurationLimiter( + $this->redis, $key, $maxAttempts, $decayMinutes * 60 + ); + + return tap(! $limiter->acquire(), function () use ($limiter) { + [$this->decaysAt, $this->remaining] = [ + $limiter->decaysAt, $limiter->remaining, + ]; + }); + } + + /** + * Calculate the number of remaining attempts. + * + * @param string $key + * @param int $maxAttempts + * @param int|null $retryAfter + * @return int + */ + protected function calculateRemainingAttempts($key, $maxAttempts, $retryAfter = null) + { + if (is_null($retryAfter)) { + return $this->remaining; + } + + return 0; + } + + /** + * Get the number of seconds until the lock is released. + * + * @param string $key + * @return int + */ + protected function getTimeUntilNextRetry($key) + { + return $this->decaysAt - $this->currentTime(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ValidateSignature.php b/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ValidateSignature.php new file mode 100644 index 0000000..85de9a2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ValidateSignature.php @@ -0,0 +1,27 @@ +hasValidSignature()) { + return $next($request); + } + + throw new InvalidSignatureException; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/MiddlewareNameResolver.php b/vendor/laravel/framework/src/Illuminate/Routing/MiddlewareNameResolver.php new file mode 100644 index 0000000..605d61a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/MiddlewareNameResolver.php @@ -0,0 +1,85 @@ +name = $name; + $this->options = $options; + $this->registrar = $registrar; + $this->controller = $controller; + } + + /** + * Set the methods the controller should apply to. + * + * @param array|string|dynamic $methods + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function only($methods) + { + $this->options['only'] = is_array($methods) ? $methods : func_get_args(); + + return $this; + } + + /** + * Set the methods the controller should exclude. + * + * @param array|string|dynamic $methods + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function except($methods) + { + $this->options['except'] = is_array($methods) ? $methods : func_get_args(); + + return $this; + } + + /** + * Set the route names for controller actions. + * + * @param array|string $names + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function names($names) + { + $this->options['names'] = $names; + + return $this; + } + + /** + * Set the route name for a controller action. + * + * @param string $method + * @param string $name + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function name($method, $name) + { + $this->options['names'][$method] = $name; + + return $this; + } + + /** + * Override the route parameter names. + * + * @param array|string $parameters + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function parameters($parameters) + { + $this->options['parameters'] = $parameters; + + return $this; + } + + /** + * Override a route parameter's name. + * + * @param string $previous + * @param string $new + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function parameter($previous, $new) + { + $this->options['parameters'][$previous] = $new; + + return $this; + } + + /** + * Set a middleware to the resource. + * + * @param mixed $middleware + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function middleware($middleware) + { + $this->options['middleware'] = $middleware; + + return $this; + } + + /** + * Register the resource route. + * + * @return \Illuminate\Routing\RouteCollection + */ + public function register() + { + $this->registered = true; + + return $this->registrar->register( + $this->name, $this->controller, $this->options + ); + } + + /** + * Handle the object's destruction. + * + * @return void + */ + public function __destruct() + { + if (! $this->registered) { + $this->register(); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php b/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php new file mode 100644 index 0000000..17a7d8f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php @@ -0,0 +1,91 @@ +handleException($passable, $e); + } catch (Throwable $e) { + return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + } + + /** + * Get a Closure that represents a slice of the application onion. + * + * @return \Closure + */ + protected function carry() + { + return function ($stack, $pipe) { + return function ($passable) use ($stack, $pipe) { + try { + $slice = parent::carry(); + + $callable = $slice($stack, $pipe); + + return $callable($passable); + } catch (Exception $e) { + return $this->handleException($passable, $e); + } catch (Throwable $e) { + return $this->handleException($passable, new FatalThrowableError($e)); + } + }; + }; + } + + /** + * Handle the given exception. + * + * @param mixed $passable + * @param \Exception $e + * @return mixed + * + * @throws \Exception + */ + protected function handleException($passable, Exception $e) + { + if (! $this->container->bound(ExceptionHandler::class) || + ! $passable instanceof Request) { + throw $e; + } + + $handler = $this->container->make(ExceptionHandler::class); + + $handler->report($e); + + $response = $handler->render($passable, $e); + + if (method_exists($response, 'withException')) { + $response->withException($e); + } + + return $response; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RedirectController.php b/vendor/laravel/framework/src/Illuminate/Routing/RedirectController.php new file mode 100644 index 0000000..e825ddf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RedirectController.php @@ -0,0 +1,21 @@ +generator = $generator; + } + + /** + * Create a new redirect response to the "home" route. + * + * @param int $status + * @return \Illuminate\Http\RedirectResponse + */ + public function home($status = 302) + { + return $this->to($this->generator->route('home'), $status); + } + + /** + * Create a new redirect response to the previous location. + * + * @param int $status + * @param array $headers + * @param mixed $fallback + * @return \Illuminate\Http\RedirectResponse + */ + public function back($status = 302, $headers = [], $fallback = false) + { + return $this->createRedirect($this->generator->previous($fallback), $status, $headers); + } + + /** + * Create a new redirect response to the current URI. + * + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function refresh($status = 302, $headers = []) + { + return $this->to($this->generator->getRequest()->path(), $status, $headers); + } + + /** + * Create a new redirect response, while putting the current URL in the session. + * + * @param string $path + * @param int $status + * @param array $headers + * @param bool $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function guest($path, $status = 302, $headers = [], $secure = null) + { + $request = $this->generator->getRequest(); + + $intended = $request->method() === 'GET' && $request->route() && ! $request->expectsJson() + ? $this->generator->full() + : $this->generator->previous(); + + if ($intended) { + $this->setIntendedUrl($intended); + } + + return $this->to($path, $status, $headers, $secure); + } + + /** + * Create a new redirect response to the previously intended location. + * + * @param string $default + * @param int $status + * @param array $headers + * @param bool $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function intended($default = '/', $status = 302, $headers = [], $secure = null) + { + $path = $this->session->pull('url.intended', $default); + + return $this->to($path, $status, $headers, $secure); + } + + /** + * Set the intended url. + * + * @param string $url + * @return void + */ + public function setIntendedUrl($url) + { + $this->session->put('url.intended', $url); + } + + /** + * Create a new redirect response to the given path. + * + * @param string $path + * @param int $status + * @param array $headers + * @param bool $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function to($path, $status = 302, $headers = [], $secure = null) + { + return $this->createRedirect($this->generator->to($path, [], $secure), $status, $headers); + } + + /** + * Create a new redirect response to an external URL (no validation). + * + * @param string $path + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function away($path, $status = 302, $headers = []) + { + return $this->createRedirect($path, $status, $headers); + } + + /** + * Create a new redirect response to the given HTTPS path. + * + * @param string $path + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function secure($path, $status = 302, $headers = []) + { + return $this->to($path, $status, $headers, true); + } + + /** + * Create a new redirect response to a named route. + * + * @param string $route + * @param mixed $parameters + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function route($route, $parameters = [], $status = 302, $headers = []) + { + return $this->to($this->generator->route($route, $parameters), $status, $headers); + } + + /** + * Create a new redirect response to a controller action. + * + * @param string|array $action + * @param mixed $parameters + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function action($action, $parameters = [], $status = 302, $headers = []) + { + return $this->to($this->generator->action($action, $parameters), $status, $headers); + } + + /** + * Create a new redirect response. + * + * @param string $path + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + protected function createRedirect($path, $status, $headers) + { + return tap(new RedirectResponse($path, $status, $headers), function ($redirect) { + if (isset($this->session)) { + $redirect->setSession($this->session); + } + + $redirect->setRequest($this->generator->getRequest()); + }); + } + + /** + * Get the URL generator instance. + * + * @return \Illuminate\Routing\UrlGenerator + */ + public function getUrlGenerator() + { + return $this->generator; + } + + /** + * Set the active session store. + * + * @param \Illuminate\Session\Store $session + * @return void + */ + public function setSession(SessionStore $session) + { + $this->session = $session; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/ResourceRegistrar.php b/vendor/laravel/framework/src/Illuminate/Routing/ResourceRegistrar.php new file mode 100644 index 0000000..33b74ec --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/ResourceRegistrar.php @@ -0,0 +1,450 @@ + 'create', + 'edit' => 'edit', + ]; + + /** + * Create a new resource registrar instance. + * + * @param \Illuminate\Routing\Router $router + * @return void + */ + public function __construct(Router $router) + { + $this->router = $router; + } + + /** + * Route a resource to a controller. + * + * @param string $name + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\RouteCollection + */ + public function register($name, $controller, array $options = []) + { + if (isset($options['parameters']) && ! isset($this->parameters)) { + $this->parameters = $options['parameters']; + } + + // If the resource name contains a slash, we will assume the developer wishes to + // register these resource routes with a prefix so we will set that up out of + // the box so they don't have to mess with it. Otherwise, we will continue. + if (Str::contains($name, '/')) { + $this->prefixedResource($name, $controller, $options); + + return; + } + + // We need to extract the base resource from the resource name. Nested resources + // are supported in the framework, but we need to know what name to use for a + // place-holder on the route parameters, which should be the base resources. + $base = $this->getResourceWildcard(last(explode('.', $name))); + + $defaults = $this->resourceDefaults; + + $collection = new RouteCollection; + + foreach ($this->getResourceMethods($defaults, $options) as $m) { + $collection->add($this->{'addResource'.ucfirst($m)}( + $name, $base, $controller, $options + )); + } + + return $collection; + } + + /** + * Build a set of prefixed resource routes. + * + * @param string $name + * @param string $controller + * @param array $options + * @return void + */ + protected function prefixedResource($name, $controller, array $options) + { + [$name, $prefix] = $this->getResourcePrefix($name); + + // We need to extract the base resource from the resource name. Nested resources + // are supported in the framework, but we need to know what name to use for a + // place-holder on the route parameters, which should be the base resources. + $callback = function ($me) use ($name, $controller, $options) { + $me->resource($name, $controller, $options); + }; + + return $this->router->group(compact('prefix'), $callback); + } + + /** + * Extract the resource and prefix from a resource name. + * + * @param string $name + * @return array + */ + protected function getResourcePrefix($name) + { + $segments = explode('/', $name); + + // To get the prefix, we will take all of the name segments and implode them on + // a slash. This will generate a proper URI prefix for us. Then we take this + // last segment, which will be considered the final resources name we use. + $prefix = implode('/', array_slice($segments, 0, -1)); + + return [end($segments), $prefix]; + } + + /** + * Get the applicable resource methods. + * + * @param array $defaults + * @param array $options + * @return array + */ + protected function getResourceMethods($defaults, $options) + { + $methods = $defaults; + + if (isset($options['only'])) { + $methods = array_intersect($methods, (array) $options['only']); + } + + if (isset($options['except'])) { + $methods = array_diff($methods, (array) $options['except']); + } + + return $methods; + } + + /** + * Add the index method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceIndex($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name); + + $action = $this->getResourceAction($name, $controller, 'index', $options); + + return $this->router->get($uri, $action); + } + + /** + * Add the create method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceCreate($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name).'/'.static::$verbs['create']; + + $action = $this->getResourceAction($name, $controller, 'create', $options); + + return $this->router->get($uri, $action); + } + + /** + * Add the store method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceStore($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name); + + $action = $this->getResourceAction($name, $controller, 'store', $options); + + return $this->router->post($uri, $action); + } + + /** + * Add the show method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceShow($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name).'/{'.$base.'}'; + + $action = $this->getResourceAction($name, $controller, 'show', $options); + + return $this->router->get($uri, $action); + } + + /** + * Add the edit method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceEdit($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name).'/{'.$base.'}/'.static::$verbs['edit']; + + $action = $this->getResourceAction($name, $controller, 'edit', $options); + + return $this->router->get($uri, $action); + } + + /** + * Add the update method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceUpdate($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name).'/{'.$base.'}'; + + $action = $this->getResourceAction($name, $controller, 'update', $options); + + return $this->router->match(['PUT', 'PATCH'], $uri, $action); + } + + /** + * Add the destroy method for a resourceful route. + * + * @param string $name + * @param string $base + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\Route + */ + protected function addResourceDestroy($name, $base, $controller, $options) + { + $uri = $this->getResourceUri($name).'/{'.$base.'}'; + + $action = $this->getResourceAction($name, $controller, 'destroy', $options); + + return $this->router->delete($uri, $action); + } + + /** + * Get the base resource URI for a given resource. + * + * @param string $resource + * @return string + */ + public function getResourceUri($resource) + { + if (! Str::contains($resource, '.')) { + return $resource; + } + + // Once we have built the base URI, we'll remove the parameter holder for this + // base resource name so that the individual route adders can suffix these + // paths however they need to, as some do not have any parameters at all. + $segments = explode('.', $resource); + + $uri = $this->getNestedResourceUri($segments); + + return str_replace('/{'.$this->getResourceWildcard(end($segments)).'}', '', $uri); + } + + /** + * Get the URI for a nested resource segment array. + * + * @param array $segments + * @return string + */ + protected function getNestedResourceUri(array $segments) + { + // We will spin through the segments and create a place-holder for each of the + // resource segments, as well as the resource itself. Then we should get an + // entire string for the resource URI that contains all nested resources. + return implode('/', array_map(function ($s) { + return $s.'/{'.$this->getResourceWildcard($s).'}'; + }, $segments)); + } + + /** + * Format a resource parameter for usage. + * + * @param string $value + * @return string + */ + public function getResourceWildcard($value) + { + if (isset($this->parameters[$value])) { + $value = $this->parameters[$value]; + } elseif (isset(static::$parameterMap[$value])) { + $value = static::$parameterMap[$value]; + } elseif ($this->parameters === 'singular' || static::$singularParameters) { + $value = Str::singular($value); + } + + return str_replace('-', '_', $value); + } + + /** + * Get the action array for a resource route. + * + * @param string $resource + * @param string $controller + * @param string $method + * @param array $options + * @return array + */ + protected function getResourceAction($resource, $controller, $method, $options) + { + $name = $this->getResourceRouteName($resource, $method, $options); + + $action = ['as' => $name, 'uses' => $controller.'@'.$method]; + + if (isset($options['middleware'])) { + $action['middleware'] = $options['middleware']; + } + + return $action; + } + + /** + * Get the name for a given resource. + * + * @param string $resource + * @param string $method + * @param array $options + * @return string + */ + protected function getResourceRouteName($resource, $method, $options) + { + $name = $resource; + + // If the names array has been provided to us we will check for an entry in the + // array first. We will also check for the specific method within this array + // so the names may be specified on a more "granular" level using methods. + if (isset($options['names'])) { + if (is_string($options['names'])) { + $name = $options['names']; + } elseif (isset($options['names'][$method])) { + return $options['names'][$method]; + } + } + + // If a global prefix has been assigned to all names for this resource, we will + // grab that so we can prepend it onto the name when we create this name for + // the resource action. Otherwise we'll just use an empty string for here. + $prefix = isset($options['as']) ? $options['as'].'.' : ''; + + return trim(sprintf('%s%s.%s', $prefix, $name, $method), '.'); + } + + /** + * Set or unset the unmapped global parameters to singular. + * + * @param bool $singular + * @return void + */ + public static function singularParameters($singular = true) + { + static::$singularParameters = (bool) $singular; + } + + /** + * Get the global parameter map. + * + * @return array + */ + public static function getParameters() + { + return static::$parameterMap; + } + + /** + * Set the global parameter mapping. + * + * @param array $parameters + * @return void + */ + public static function setParameters(array $parameters = []) + { + static::$parameterMap = $parameters; + } + + /** + * Get or set the action verbs used in the resource URIs. + * + * @param array $verbs + * @return array + */ + public static function verbs(array $verbs = []) + { + if (empty($verbs)) { + return static::$verbs; + } else { + static::$verbs = array_merge(static::$verbs, $verbs); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php b/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php new file mode 100644 index 0000000..58e04fa --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php @@ -0,0 +1,262 @@ +view = $view; + $this->redirector = $redirector; + } + + /** + * Create a new response instance. + * + * @param string $content + * @param int $status + * @param array $headers + * @return \Illuminate\Http\Response + */ + public function make($content = '', $status = 200, array $headers = []) + { + return new Response($content, $status, $headers); + } + + /** + * Create a new "no content" response. + * + * @param int $status + * @param array $headers + * @return \Illuminate\Http\Response + */ + public function noContent($status = 204, array $headers = []) + { + return $this->make('', $status, $headers); + } + + /** + * Create a new response for a given view. + * + * @param string $view + * @param array $data + * @param int $status + * @param array $headers + * @return \Illuminate\Http\Response + */ + public function view($view, $data = [], $status = 200, array $headers = []) + { + return $this->make($this->view->make($view, $data), $status, $headers); + } + + /** + * Create a new JSON response instance. + * + * @param mixed $data + * @param int $status + * @param array $headers + * @param int $options + * @return \Illuminate\Http\JsonResponse + */ + public function json($data = [], $status = 200, array $headers = [], $options = 0) + { + return new JsonResponse($data, $status, $headers, $options); + } + + /** + * Create a new JSONP response instance. + * + * @param string $callback + * @param mixed $data + * @param int $status + * @param array $headers + * @param int $options + * @return \Illuminate\Http\JsonResponse + */ + public function jsonp($callback, $data = [], $status = 200, array $headers = [], $options = 0) + { + return $this->json($data, $status, $headers, $options)->setCallback($callback); + } + + /** + * Create a new streamed response instance. + * + * @param \Closure $callback + * @param int $status + * @param array $headers + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + public function stream($callback, $status = 200, array $headers = []) + { + return new StreamedResponse($callback, $status, $headers); + } + + /** + * Create a new streamed response instance as a file download. + * + * @param \Closure $callback + * @param string|null $name + * @param array $headers + * @param string|null $disposition + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + public function streamDownload($callback, $name = null, array $headers = [], $disposition = 'attachment') + { + $response = new StreamedResponse($callback, 200, $headers); + + if (! is_null($name)) { + $response->headers->set('Content-Disposition', $response->headers->makeDisposition( + $disposition, + $name, + $this->fallbackName($name) + )); + } + + return $response; + } + + /** + * Create a new file download response. + * + * @param \SplFileInfo|string $file + * @param string|null $name + * @param array $headers + * @param string|null $disposition + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + */ + public function download($file, $name = null, array $headers = [], $disposition = 'attachment') + { + $response = new BinaryFileResponse($file, 200, $headers, true, $disposition); + + if (! is_null($name)) { + return $response->setContentDisposition($disposition, $name, $this->fallbackName($name)); + } + + return $response; + } + + /** + * Convert the string to ASCII characters that are equivalent to the given name. + * + * @param string $name + * @return string + */ + protected function fallbackName($name) + { + return str_replace('%', '', Str::ascii($name)); + } + + /** + * Return the raw contents of a binary file. + * + * @param \SplFileInfo|string $file + * @param array $headers + * @return \Symfony\Component\HttpFoundation\BinaryFileResponse + */ + public function file($file, array $headers = []) + { + return new BinaryFileResponse($file, 200, $headers); + } + + /** + * Create a new redirect response to the given path. + * + * @param string $path + * @param int $status + * @param array $headers + * @param bool|null $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function redirectTo($path, $status = 302, $headers = [], $secure = null) + { + return $this->redirector->to($path, $status, $headers, $secure); + } + + /** + * Create a new redirect response to a named route. + * + * @param string $route + * @param array $parameters + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function redirectToRoute($route, $parameters = [], $status = 302, $headers = []) + { + return $this->redirector->route($route, $parameters, $status, $headers); + } + + /** + * Create a new redirect response to a controller action. + * + * @param string $action + * @param array $parameters + * @param int $status + * @param array $headers + * @return \Illuminate\Http\RedirectResponse + */ + public function redirectToAction($action, $parameters = [], $status = 302, $headers = []) + { + return $this->redirector->action($action, $parameters, $status, $headers); + } + + /** + * Create a new redirect response, while putting the current URL in the session. + * + * @param string $path + * @param int $status + * @param array $headers + * @param bool|null $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function redirectGuest($path, $status = 302, $headers = [], $secure = null) + { + return $this->redirector->guest($path, $status, $headers, $secure); + } + + /** + * Create a new redirect response to the previously intended location. + * + * @param string $default + * @param int $status + * @param array $headers + * @param bool|null $secure + * @return \Illuminate\Http\RedirectResponse + */ + public function redirectToIntended($default = '/', $status = 302, $headers = [], $secure = null) + { + return $this->redirector->intended($default, $status, $headers, $secure); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Route.php b/vendor/laravel/framework/src/Illuminate/Routing/Route.php new file mode 100755 index 0000000..56b676b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Route.php @@ -0,0 +1,898 @@ +uri = $uri; + $this->methods = (array) $methods; + $this->action = $this->parseAction($action); + + if (in_array('GET', $this->methods) && ! in_array('HEAD', $this->methods)) { + $this->methods[] = 'HEAD'; + } + + if (isset($this->action['prefix'])) { + $this->prefix($this->action['prefix']); + } + } + + /** + * Parse the route action into a standard array. + * + * @param callable|array|null $action + * @return array + * + * @throws \UnexpectedValueException + */ + protected function parseAction($action) + { + return RouteAction::parse($this->uri, $action); + } + + /** + * Run the route action and return the response. + * + * @return mixed + */ + public function run() + { + $this->container = $this->container ?: new Container; + + try { + if ($this->isControllerAction()) { + return $this->runController(); + } + + return $this->runCallable(); + } catch (HttpResponseException $e) { + return $e->getResponse(); + } + } + + /** + * Checks whether the route's action is a controller. + * + * @return bool + */ + protected function isControllerAction() + { + return is_string($this->action['uses']); + } + + /** + * Run the route action and return the response. + * + * @return mixed + */ + protected function runCallable() + { + $callable = $this->action['uses']; + + return $callable(...array_values($this->resolveMethodDependencies( + $this->parametersWithoutNulls(), new ReflectionFunction($this->action['uses']) + ))); + } + + /** + * Run the route action and return the response. + * + * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + protected function runController() + { + return $this->controllerDispatcher()->dispatch( + $this, $this->getController(), $this->getControllerMethod() + ); + } + + /** + * Get the controller instance for the route. + * + * @return mixed + */ + public function getController() + { + if (! $this->controller) { + $class = $this->parseControllerCallback()[0]; + + $this->controller = $this->container->make(ltrim($class, '\\')); + } + + return $this->controller; + } + + /** + * Get the controller method used for the route. + * + * @return string + */ + protected function getControllerMethod() + { + return $this->parseControllerCallback()[1]; + } + + /** + * Parse the controller. + * + * @return array + */ + protected function parseControllerCallback() + { + return Str::parseCallback($this->action['uses']); + } + + /** + * Determine if the route matches given request. + * + * @param \Illuminate\Http\Request $request + * @param bool $includingMethod + * @return bool + */ + public function matches(Request $request, $includingMethod = true) + { + $this->compileRoute(); + + foreach ($this->getValidators() as $validator) { + if (! $includingMethod && $validator instanceof MethodValidator) { + continue; + } + + if (! $validator->matches($this, $request)) { + return false; + } + } + + return true; + } + + /** + * Compile the route into a Symfony CompiledRoute instance. + * + * @return \Symfony\Component\Routing\CompiledRoute + */ + protected function compileRoute() + { + if (! $this->compiled) { + $this->compiled = (new RouteCompiler($this))->compile(); + } + + return $this->compiled; + } + + /** + * Bind the route to a given request for execution. + * + * @param \Illuminate\Http\Request $request + * @return $this + */ + public function bind(Request $request) + { + $this->compileRoute(); + + $this->parameters = (new RouteParameterBinder($this)) + ->parameters($request); + + return $this; + } + + /** + * Determine if the route has parameters. + * + * @return bool + */ + public function hasParameters() + { + return isset($this->parameters); + } + + /** + * Determine a given parameter exists from the route. + * + * @param string $name + * @return bool + */ + public function hasParameter($name) + { + if ($this->hasParameters()) { + return array_key_exists($name, $this->parameters()); + } + + return false; + } + + /** + * Get a given parameter from the route. + * + * @param string $name + * @param mixed $default + * @return string|object + */ + public function parameter($name, $default = null) + { + return Arr::get($this->parameters(), $name, $default); + } + + /** + * Set a parameter to the given value. + * + * @param string $name + * @param mixed $value + * @return void + */ + public function setParameter($name, $value) + { + $this->parameters(); + + $this->parameters[$name] = $value; + } + + /** + * Unset a parameter on the route if it is set. + * + * @param string $name + * @return void + */ + public function forgetParameter($name) + { + $this->parameters(); + + unset($this->parameters[$name]); + } + + /** + * Get the key / value list of parameters for the route. + * + * @return array + * + * @throws \LogicException + */ + public function parameters() + { + if (isset($this->parameters)) { + return $this->parameters; + } + + throw new LogicException('Route is not bound.'); + } + + /** + * Get the key / value list of parameters without null values. + * + * @return array + */ + public function parametersWithoutNulls() + { + return array_filter($this->parameters(), function ($p) { + return ! is_null($p); + }); + } + + /** + * Get all of the parameter names for the route. + * + * @return array + */ + public function parameterNames() + { + if (isset($this->parameterNames)) { + return $this->parameterNames; + } + + return $this->parameterNames = $this->compileParameterNames(); + } + + /** + * Get the parameter names for the route. + * + * @return array + */ + protected function compileParameterNames() + { + preg_match_all('/\{(.*?)\}/', $this->getDomain().$this->uri, $matches); + + return array_map(function ($m) { + return trim($m, '?'); + }, $matches[1]); + } + + /** + * Get the parameters that are listed in the route / controller signature. + * + * @param string|null $subClass + * @return array + */ + public function signatureParameters($subClass = null) + { + return RouteSignatureParameters::fromAction($this->action, $subClass); + } + + /** + * Set a default value for the route. + * + * @param string $key + * @param mixed $value + * @return $this + */ + public function defaults($key, $value) + { + $this->defaults[$key] = $value; + + return $this; + } + + /** + * Set a regular expression requirement on the route. + * + * @param array|string $name + * @param string $expression + * @return $this + */ + public function where($name, $expression = null) + { + foreach ($this->parseWhere($name, $expression) as $name => $expression) { + $this->wheres[$name] = $expression; + } + + return $this; + } + + /** + * Parse arguments to the where method into an array. + * + * @param array|string $name + * @param string $expression + * @return array + */ + protected function parseWhere($name, $expression) + { + return is_array($name) ? $name : [$name => $expression]; + } + + /** + * Set a list of regular expression requirements on the route. + * + * @param array $wheres + * @return $this + */ + protected function whereArray(array $wheres) + { + foreach ($wheres as $name => $expression) { + $this->where($name, $expression); + } + + return $this; + } + + /** + * Mark this route as a fallback route. + * + * @return $this + */ + public function fallback() + { + $this->isFallback = true; + + return $this; + } + + /** + * Get the HTTP verbs the route responds to. + * + * @return array + */ + public function methods() + { + return $this->methods; + } + + /** + * Determine if the route only responds to HTTP requests. + * + * @return bool + */ + public function httpOnly() + { + return in_array('http', $this->action, true); + } + + /** + * Determine if the route only responds to HTTPS requests. + * + * @return bool + */ + public function httpsOnly() + { + return $this->secure(); + } + + /** + * Determine if the route only responds to HTTPS requests. + * + * @return bool + */ + public function secure() + { + return in_array('https', $this->action, true); + } + + /** + * Get or set the domain for the route. + * + * @param string|null $domain + * @return $this|string|null + */ + public function domain($domain = null) + { + if (is_null($domain)) { + return $this->getDomain(); + } + + $this->action['domain'] = $domain; + + return $this; + } + + /** + * Get the domain defined for the route. + * + * @return string|null + */ + public function getDomain() + { + return isset($this->action['domain']) + ? str_replace(['http://', 'https://'], '', $this->action['domain']) : null; + } + + /** + * Get the prefix of the route instance. + * + * @return string + */ + public function getPrefix() + { + return $this->action['prefix'] ?? null; + } + + /** + * Add a prefix to the route URI. + * + * @param string $prefix + * @return $this + */ + public function prefix($prefix) + { + $uri = rtrim($prefix, '/').'/'.ltrim($this->uri, '/'); + + $this->uri = trim($uri, '/'); + + return $this; + } + + /** + * Get the URI associated with the route. + * + * @return string + */ + public function uri() + { + return $this->uri; + } + + /** + * Set the URI that the route responds to. + * + * @param string $uri + * @return $this + */ + public function setUri($uri) + { + $this->uri = $uri; + + return $this; + } + + /** + * Get the name of the route instance. + * + * @return string + */ + public function getName() + { + return $this->action['as'] ?? null; + } + + /** + * Add or change the route name. + * + * @param string $name + * @return $this + */ + public function name($name) + { + $this->action['as'] = isset($this->action['as']) ? $this->action['as'].$name : $name; + + return $this; + } + + /** + * Determine whether the route's name matches the given patterns. + * + * @param mixed ...$patterns + * @return bool + */ + public function named(...$patterns) + { + if (is_null($routeName = $this->getName())) { + return false; + } + + foreach ($patterns as $pattern) { + if (Str::is($pattern, $routeName)) { + return true; + } + } + + return false; + } + + /** + * Set the handler for the route. + * + * @param \Closure|string $action + * @return $this + */ + public function uses($action) + { + $action = is_string($action) ? $this->addGroupNamespaceToStringUses($action) : $action; + + return $this->setAction(array_merge($this->action, $this->parseAction([ + 'uses' => $action, + 'controller' => $action, + ]))); + } + + /** + * Parse a string based action for the "uses" fluent method. + * + * @param string $action + * @return string + */ + protected function addGroupNamespaceToStringUses($action) + { + $groupStack = last($this->router->getGroupStack()); + + if (isset($groupStack['namespace']) && strpos($action, '\\') !== 0) { + return $groupStack['namespace'].'\\'.$action; + } + + return $action; + } + + /** + * Get the action name for the route. + * + * @return string + */ + public function getActionName() + { + return $this->action['controller'] ?? 'Closure'; + } + + /** + * Get the method name of the route action. + * + * @return string + */ + public function getActionMethod() + { + return Arr::last(explode('@', $this->getActionName())); + } + + /** + * Get the action array or one of its properties for the route. + * + * @param string|null $key + * @return mixed + */ + public function getAction($key = null) + { + return Arr::get($this->action, $key); + } + + /** + * Set the action array for the route. + * + * @param array $action + * @return $this + */ + public function setAction(array $action) + { + $this->action = $action; + + return $this; + } + + /** + * Get all middleware, including the ones from the controller. + * + * @return array + */ + public function gatherMiddleware() + { + if (! is_null($this->computedMiddleware)) { + return $this->computedMiddleware; + } + + $this->computedMiddleware = []; + + return $this->computedMiddleware = array_unique(array_merge( + $this->middleware(), $this->controllerMiddleware() + ), SORT_REGULAR); + } + + /** + * Get or set the middlewares attached to the route. + * + * @param array|string|null $middleware + * @return $this|array + */ + public function middleware($middleware = null) + { + if (is_null($middleware)) { + return (array) ($this->action['middleware'] ?? []); + } + + if (is_string($middleware)) { + $middleware = func_get_args(); + } + + $this->action['middleware'] = array_merge( + (array) ($this->action['middleware'] ?? []), $middleware + ); + + return $this; + } + + /** + * Get the middleware for the route's controller. + * + * @return array + */ + public function controllerMiddleware() + { + if (! $this->isControllerAction()) { + return []; + } + + return $this->controllerDispatcher()->getMiddleware( + $this->getController(), $this->getControllerMethod() + ); + } + + /** + * Get the dispatcher for the route's controller. + * + * @return \Illuminate\Routing\Contracts\ControllerDispatcher + */ + public function controllerDispatcher() + { + if ($this->container->bound(ControllerDispatcherContract::class)) { + return $this->container->make(ControllerDispatcherContract::class); + } + + return new ControllerDispatcher($this->container); + } + + /** + * Get the route validators for the instance. + * + * @return array + */ + public static function getValidators() + { + if (isset(static::$validators)) { + return static::$validators; + } + + // To match the route, we will use a chain of responsibility pattern with the + // validator implementations. We will spin through each one making sure it + // passes and then we will know if the route as a whole matches request. + return static::$validators = [ + new UriValidator, new MethodValidator, + new SchemeValidator, new HostValidator, + ]; + } + + /** + * Get the compiled version of the route. + * + * @return \Symfony\Component\Routing\CompiledRoute + */ + public function getCompiled() + { + return $this->compiled; + } + + /** + * Set the router instance on the route. + * + * @param \Illuminate\Routing\Router $router + * @return $this + */ + public function setRouter(Router $router) + { + $this->router = $router; + + return $this; + } + + /** + * Set the container instance on the route. + * + * @param \Illuminate\Container\Container $container + * @return $this + */ + public function setContainer(Container $container) + { + $this->container = $container; + + return $this; + } + + /** + * Prepare the route instance for serialization. + * + * @return void + * + * @throws \LogicException + */ + public function prepareForSerialization() + { + if ($this->action['uses'] instanceof Closure) { + throw new LogicException("Unable to prepare route [{$this->uri}] for serialization. Uses Closure."); + } + + $this->compileRoute(); + + unset($this->router, $this->container); + } + + /** + * Dynamically access route parameters. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->parameter($key); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteAction.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteAction.php new file mode 100644 index 0000000..9c84ff1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteAction.php @@ -0,0 +1,94 @@ + $action] : [ + 'uses' => $action[0].'@'.$action[1], + 'controller' => $action[0].'@'.$action[1], + ]; + } + + // If no "uses" property has been set, we will dig through the array to find a + // Closure instance within this list. We will set the first Closure we come + // across into the "uses" property that will get fired off by this route. + elseif (! isset($action['uses'])) { + $action['uses'] = static::findCallable($action); + } + + if (is_string($action['uses']) && ! Str::contains($action['uses'], '@')) { + $action['uses'] = static::makeInvokable($action['uses']); + } + + return $action; + } + + /** + * Get an action for a route that has no action. + * + * @param string $uri + * @return array + */ + protected static function missingAction($uri) + { + return ['uses' => function () use ($uri) { + throw new LogicException("Route for [{$uri}] has no action."); + }]; + } + + /** + * Find the callable in an action array. + * + * @param array $action + * @return callable + */ + protected static function findCallable(array $action) + { + return Arr::first($action, function ($value, $key) { + return is_callable($value) && is_numeric($key); + }); + } + + /** + * Make an action for an invokable controller. + * + * @param string $action + * @return string + * + * @throws \UnexpectedValueException + */ + protected static function makeInvokable($action) + { + if (! method_exists($action, '__invoke')) { + throw new UnexpectedValueException("Invalid route action: [{$action}]."); + } + + return $action.'@__invoke'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteBinding.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteBinding.php new file mode 100644 index 0000000..e2f284c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteBinding.php @@ -0,0 +1,82 @@ +make($class), $method]; + + return call_user_func($callable, $value, $route); + }; + } + + /** + * Create a Route model binding for a model. + * + * @param \Illuminate\Container\Container $container + * @param string $class + * @param \Closure|null $callback + * @return \Closure + */ + public static function forModel($container, $class, $callback = null) + { + return function ($value) use ($container, $class, $callback) { + if (is_null($value)) { + return; + } + + // For model binders, we will attempt to retrieve the models using the first + // method on the model instance. If we cannot retrieve the models we'll + // throw a not found exception otherwise we will return the instance. + $instance = $container->make($class); + + if ($model = $instance->resolveRouteBinding($value)) { + return $model; + } + + // If a callback was supplied to the method we will call that to determine + // what we should do when the model is not found. This just gives these + // developer a little greater flexibility to decide what will happen. + if ($callback instanceof Closure) { + return call_user_func($callback, $value); + } + + throw (new ModelNotFoundException)->setModel($class); + }; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php new file mode 100644 index 0000000..265d282 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php @@ -0,0 +1,351 @@ +addToCollections($route); + + $this->addLookups($route); + + return $route; + } + + /** + * Add the given route to the arrays of routes. + * + * @param \Illuminate\Routing\Route $route + * @return void + */ + protected function addToCollections($route) + { + $domainAndUri = $route->getDomain().$route->uri(); + + foreach ($route->methods() as $method) { + $this->routes[$method][$domainAndUri] = $route; + } + + $this->allRoutes[$method.$domainAndUri] = $route; + } + + /** + * Add the route to any look-up tables if necessary. + * + * @param \Illuminate\Routing\Route $route + * @return void + */ + protected function addLookups($route) + { + // If the route has a name, we will add it to the name look-up table so that we + // will quickly be able to find any route associate with a name and not have + // to iterate through every route every time we need to perform a look-up. + if ($name = $route->getName()) { + $this->nameList[$name] = $route; + } + + // When the route is routing to a controller we will also store the action that + // is used by the route. This will let us reverse route to controllers while + // processing a request and easily generate URLs to the given controllers. + $action = $route->getAction(); + + if (isset($action['controller'])) { + $this->addToActionList($action, $route); + } + } + + /** + * Add a route to the controller action dictionary. + * + * @param array $action + * @param \Illuminate\Routing\Route $route + * @return void + */ + protected function addToActionList($action, $route) + { + $this->actionList[trim($action['controller'], '\\')] = $route; + } + + /** + * Refresh the name look-up table. + * + * This is done in case any names are fluently defined or if routes are overwritten. + * + * @return void + */ + public function refreshNameLookups() + { + $this->nameList = []; + + foreach ($this->allRoutes as $route) { + if ($route->getName()) { + $this->nameList[$route->getName()] = $route; + } + } + } + + /** + * Refresh the action look-up table. + * + * This is done in case any actions are overwritten with new controllers. + * + * @return void + */ + public function refreshActionLookups() + { + $this->actionList = []; + + foreach ($this->allRoutes as $route) { + if (isset($route->getAction()['controller'])) { + $this->addToActionList($route->getAction(), $route); + } + } + } + + /** + * Find the first route matching a given request. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Routing\Route + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + public function match(Request $request) + { + $routes = $this->get($request->getMethod()); + + // First, we will see if we can find a matching route for this current request + // method. If we can, great, we can just return it so that it can be called + // by the consumer. Otherwise we will check for routes with another verb. + $route = $this->matchAgainstRoutes($routes, $request); + + if (! is_null($route)) { + return $route->bind($request); + } + + // If no route was found we will now check if a matching route is specified by + // another HTTP verb. If it is we will need to throw a MethodNotAllowed and + // inform the user agent of which HTTP verb it should use for this route. + $others = $this->checkForAlternateVerbs($request); + + if (count($others) > 0) { + return $this->getRouteForMethods($request, $others); + } + + throw new NotFoundHttpException; + } + + /** + * Determine if a route in the array matches the request. + * + * @param array $routes + * @param \Illuminate\Http\Request $request + * @param bool $includingMethod + * @return \Illuminate\Routing\Route|null + */ + protected function matchAgainstRoutes(array $routes, $request, $includingMethod = true) + { + [$fallbacks, $routes] = collect($routes)->partition(function ($route) { + return $route->isFallback; + }); + + return $routes->merge($fallbacks)->first(function ($value) use ($request, $includingMethod) { + return $value->matches($request, $includingMethod); + }); + } + + /** + * Determine if any routes match on another HTTP verb. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function checkForAlternateVerbs($request) + { + $methods = array_diff(Router::$verbs, [$request->getMethod()]); + + // Here we will spin through all verbs except for the current request verb and + // check to see if any routes respond to them. If they do, we will return a + // proper error response with the correct headers on the response string. + $others = []; + + foreach ($methods as $method) { + if (! is_null($this->matchAgainstRoutes($this->get($method), $request, false))) { + $others[] = $method; + } + } + + return $others; + } + + /** + * Get a route (if necessary) that responds when other available methods are present. + * + * @param \Illuminate\Http\Request $request + * @param array $methods + * @return \Illuminate\Routing\Route + * + * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException + */ + protected function getRouteForMethods($request, array $methods) + { + if ($request->method() === 'OPTIONS') { + return (new Route('OPTIONS', $request->path(), function () use ($methods) { + return new Response('', 200, ['Allow' => implode(',', $methods)]); + }))->bind($request); + } + + $this->methodNotAllowed($methods); + } + + /** + * Throw a method not allowed HTTP exception. + * + * @param array $others + * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException + */ + protected function methodNotAllowed(array $others) + { + throw new MethodNotAllowedHttpException($others); + } + + /** + * Get routes from the collection by method. + * + * @param string|null $method + * @return array + */ + public function get($method = null) + { + return is_null($method) ? $this->getRoutes() : Arr::get($this->routes, $method, []); + } + + /** + * Determine if the route collection contains a given named route. + * + * @param string $name + * @return bool + */ + public function hasNamedRoute($name) + { + return ! is_null($this->getByName($name)); + } + + /** + * Get a route instance by its name. + * + * @param string $name + * @return \Illuminate\Routing\Route|null + */ + public function getByName($name) + { + return $this->nameList[$name] ?? null; + } + + /** + * Get a route instance by its controller action. + * + * @param string $action + * @return \Illuminate\Routing\Route|null + */ + public function getByAction($action) + { + return $this->actionList[$action] ?? null; + } + + /** + * Get all of the routes in the collection. + * + * @return array + */ + public function getRoutes() + { + return array_values($this->allRoutes); + } + + /** + * Get all of the routes keyed by their HTTP verb / method. + * + * @return array + */ + public function getRoutesByMethod() + { + return $this->routes; + } + + /** + * Get all of the routes keyed by their name. + * + * @return array + */ + public function getRoutesByName() + { + return $this->nameList; + } + + /** + * Get an iterator for the items. + * + * @return \ArrayIterator + */ + public function getIterator() + { + return new ArrayIterator($this->getRoutes()); + } + + /** + * Count the number of items in the collection. + * + * @return int + */ + public function count() + { + return count($this->getRoutes()); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteCompiler.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteCompiler.php new file mode 100644 index 0000000..c191663 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteCompiler.php @@ -0,0 +1,54 @@ +route = $route; + } + + /** + * Compile the route. + * + * @return \Symfony\Component\Routing\CompiledRoute + */ + public function compile() + { + $optionals = $this->getOptionalParameters(); + + $uri = preg_replace('/\{(\w+?)\?\}/', '{$1}', $this->route->uri()); + + return ( + new SymfonyRoute($uri, $optionals, $this->route->wheres, ['utf8' => true], $this->route->getDomain() ?: '') + )->compile(); + } + + /** + * Get the optional parameters for the route. + * + * @return array + */ + protected function getOptionalParameters() + { + preg_match_all('/\{(\w+?)\?\}/', $this->route->uri(), $matches); + + return isset($matches[1]) ? array_fill_keys($matches[1], null) : []; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php new file mode 100644 index 0000000..2db31c0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php @@ -0,0 +1,111 @@ +resolveMethodDependencies( + $parameters, new ReflectionMethod($instance, $method) + ); + } + + /** + * Resolve the given method's type-hinted dependencies. + * + * @param array $parameters + * @param \ReflectionFunctionAbstract $reflector + * @return array + */ + public function resolveMethodDependencies(array $parameters, ReflectionFunctionAbstract $reflector) + { + $instanceCount = 0; + + $values = array_values($parameters); + + foreach ($reflector->getParameters() as $key => $parameter) { + $instance = $this->transformDependency( + $parameter, $parameters + ); + + if (! is_null($instance)) { + $instanceCount++; + + $this->spliceIntoParameters($parameters, $key, $instance); + } elseif (! isset($values[$key - $instanceCount]) && + $parameter->isDefaultValueAvailable()) { + $this->spliceIntoParameters($parameters, $key, $parameter->getDefaultValue()); + } + } + + return $parameters; + } + + /** + * Attempt to transform the given parameter into a class instance. + * + * @param \ReflectionParameter $parameter + * @param array $parameters + * @return mixed + */ + protected function transformDependency(ReflectionParameter $parameter, $parameters) + { + $class = $parameter->getClass(); + + // If the parameter has a type-hinted class, we will check to see if it is already in + // the list of parameters. If it is we will just skip it as it is probably a model + // binding and we do not want to mess with those; otherwise, we resolve it here. + if ($class && ! $this->alreadyInParameters($class->name, $parameters)) { + return $parameter->isDefaultValueAvailable() + ? $parameter->getDefaultValue() + : $this->container->make($class->name); + } + } + + /** + * Determine if an object of the given class is in a list of parameters. + * + * @param string $class + * @param array $parameters + * @return bool + */ + protected function alreadyInParameters($class, array $parameters) + { + return ! is_null(Arr::first($parameters, function ($value) use ($class) { + return $value instanceof $class; + })); + } + + /** + * Splice the given value into the parameter list. + * + * @param array $parameters + * @param string $offset + * @param mixed $value + * @return void + */ + protected function spliceIntoParameters(array &$parameters, $offset, $value) + { + array_splice( + $parameters, $offset, 0, [$value] + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteGroup.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteGroup.php new file mode 100644 index 0000000..4041f1f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteGroup.php @@ -0,0 +1,95 @@ + static::formatNamespace($new, $old), + 'prefix' => static::formatPrefix($new, $old), + 'where' => static::formatWhere($new, $old), + ]); + + return array_merge_recursive(Arr::except( + $old, ['namespace', 'prefix', 'where', 'as'] + ), $new); + } + + /** + * Format the namespace for the new group attributes. + * + * @param array $new + * @param array $old + * @return string|null + */ + protected static function formatNamespace($new, $old) + { + if (isset($new['namespace'])) { + return isset($old['namespace']) && strpos($new['namespace'], '\\') !== 0 + ? trim($old['namespace'], '\\').'\\'.trim($new['namespace'], '\\') + : trim($new['namespace'], '\\'); + } + + return $old['namespace'] ?? null; + } + + /** + * Format the prefix for the new group attributes. + * + * @param array $new + * @param array $old + * @return string|null + */ + protected static function formatPrefix($new, $old) + { + $old = $old['prefix'] ?? null; + + return isset($new['prefix']) ? trim($old, '/').'/'.trim($new['prefix'], '/') : $old; + } + + /** + * Format the "wheres" for the new group attributes. + * + * @param array $new + * @param array $old + * @return array + */ + protected static function formatWhere($new, $old) + { + return array_merge( + $old['where'] ?? [], + $new['where'] ?? [] + ); + } + + /** + * Format the "as" clause of the new group attributes. + * + * @param array $new + * @param array $old + * @return array + */ + protected static function formatAs($new, $old) + { + if (isset($old['as'])) { + $new['as'] = $old['as'].($new['as'] ?? ''); + } + + return $new; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteParameterBinder.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteParameterBinder.php new file mode 100644 index 0000000..53e766e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteParameterBinder.php @@ -0,0 +1,120 @@ +route = $route; + } + + /** + * Get the parameters for the route. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + public function parameters($request) + { + // If the route has a regular expression for the host part of the URI, we will + // compile that and get the parameter matches for this domain. We will then + // merge them into this parameters array so that this array is completed. + $parameters = $this->bindPathParameters($request); + + // If the route has a regular expression for the host part of the URI, we will + // compile that and get the parameter matches for this domain. We will then + // merge them into this parameters array so that this array is completed. + if (! is_null($this->route->compiled->getHostRegex())) { + $parameters = $this->bindHostParameters( + $request, $parameters + ); + } + + return $this->replaceDefaults($parameters); + } + + /** + * Get the parameter matches for the path portion of the URI. + * + * @param \Illuminate\Http\Request $request + * @return array + */ + protected function bindPathParameters($request) + { + $path = '/'.ltrim($request->decodedPath(), '/'); + + preg_match($this->route->compiled->getRegex(), $path, $matches); + + return $this->matchToKeys(array_slice($matches, 1)); + } + + /** + * Extract the parameter list from the host part of the request. + * + * @param \Illuminate\Http\Request $request + * @param array $parameters + * @return array + */ + protected function bindHostParameters($request, $parameters) + { + preg_match($this->route->compiled->getHostRegex(), $request->getHost(), $matches); + + return array_merge($this->matchToKeys(array_slice($matches, 1)), $parameters); + } + + /** + * Combine a set of parameter matches with the route's keys. + * + * @param array $matches + * @return array + */ + protected function matchToKeys(array $matches) + { + if (empty($parameterNames = $this->route->parameterNames())) { + return []; + } + + $parameters = array_intersect_key($matches, array_flip($parameterNames)); + + return array_filter($parameters, function ($value) { + return is_string($value) && strlen($value) > 0; + }); + } + + /** + * Replace null parameters with their defaults. + * + * @param array $parameters + * @return array + */ + protected function replaceDefaults(array $parameters) + { + foreach ($parameters as $key => $value) { + $parameters[$key] = $value ?? Arr::get($this->route->defaults, $key); + } + + foreach ($this->route->defaults as $key => $value) { + if (! isset($parameters[$key])) { + $parameters[$key] = $value; + } + } + + return $parameters; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteRegistrar.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteRegistrar.php new file mode 100644 index 0000000..81e2385 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteRegistrar.php @@ -0,0 +1,200 @@ + 'as', + ]; + + /** + * Create a new route registrar instance. + * + * @param \Illuminate\Routing\Router $router + * @return void + */ + public function __construct(Router $router) + { + $this->router = $router; + } + + /** + * Set the value for a given attribute. + * + * @param string $key + * @param mixed $value + * @return $this + * + * @throws \InvalidArgumentException + */ + public function attribute($key, $value) + { + if (! in_array($key, $this->allowedAttributes)) { + throw new InvalidArgumentException("Attribute [{$key}] does not exist."); + } + + $this->attributes[Arr::get($this->aliases, $key, $key)] = $value; + + return $this; + } + + /** + * Route a resource to a controller. + * + * @param string $name + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function resource($name, $controller, array $options = []) + { + return $this->router->resource($name, $controller, $this->attributes + $options); + } + + /** + * Create a route group with shared attributes. + * + * @param \Closure|string $callback + * @return void + */ + public function group($callback) + { + $this->router->group($this->attributes, $callback); + } + + /** + * Register a new route with the given verbs. + * + * @param array|string $methods + * @param string $uri + * @param \Closure|array|string|null $action + * @return \Illuminate\Routing\Route + */ + public function match($methods, $uri, $action = null) + { + return $this->router->match($methods, $uri, $this->compileAction($action)); + } + + /** + * Register a new route with the router. + * + * @param string $method + * @param string $uri + * @param \Closure|array|string|null $action + * @return \Illuminate\Routing\Route + */ + protected function registerRoute($method, $uri, $action = null) + { + if (! is_array($action)) { + $action = array_merge($this->attributes, $action ? ['uses' => $action] : []); + } + + return $this->router->{$method}($uri, $this->compileAction($action)); + } + + /** + * Compile the action into an array including the attributes. + * + * @param \Closure|array|string|null $action + * @return array + */ + protected function compileAction($action) + { + if (is_null($action)) { + return $this->attributes; + } + + if (is_string($action) || $action instanceof Closure) { + $action = ['uses' => $action]; + } + + return array_merge($this->attributes, $action); + } + + /** + * Dynamically handle calls into the route registrar. + * + * @param string $method + * @param array $parameters + * @return \Illuminate\Routing\Route|$this + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (in_array($method, $this->passthru)) { + return $this->registerRoute($method, ...$parameters); + } + + if (in_array($method, $this->allowedAttributes)) { + if ($method === 'middleware') { + return $this->attribute($method, is_array($parameters[0]) ? $parameters[0] : $parameters); + } + + return $this->attribute($method, $parameters[0]); + } + + throw new BadMethodCallException(sprintf( + 'Method %s::%s does not exist.', static::class, $method + )); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php new file mode 100644 index 0000000..59d660f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php @@ -0,0 +1,45 @@ +getParameters(); + + return is_null($subClass) ? $parameters : array_filter($parameters, function ($p) use ($subClass) { + return $p->getClass() && $p->getClass()->isSubclassOf($subClass); + }); + } + + /** + * Get the parameters for the given class / method by string. + * + * @param string $uses + * @return array + */ + protected static function fromClassMethodString($uses) + { + [$class, $method] = Str::parseCallback($uses); + + if (! method_exists($class, $method) && is_callable($class, $method)) { + return []; + } + + return (new ReflectionMethod($class, $method))->getParameters(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RouteUrlGenerator.php b/vendor/laravel/framework/src/Illuminate/Routing/RouteUrlGenerator.php new file mode 100644 index 0000000..33d406e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RouteUrlGenerator.php @@ -0,0 +1,314 @@ + '/', + '%40' => '@', + '%3A' => ':', + '%3B' => ';', + '%2C' => ',', + '%3D' => '=', + '%2B' => '+', + '%21' => '!', + '%2A' => '*', + '%7C' => '|', + '%3F' => '?', + '%26' => '&', + '%23' => '#', + '%25' => '%', + ]; + + /** + * Create a new Route URL generator. + * + * @param \Illuminate\Routing\UrlGenerator $url + * @param \Illuminate\Http\Request $request + * @return void + */ + public function __construct($url, $request) + { + $this->url = $url; + $this->request = $request; + } + + /** + * Generate a URL for the given route. + * + * @param \Illuminate\Routing\Route $route + * @param array $parameters + * @param bool $absolute + * @return string + * + * @throws \Illuminate\Routing\Exceptions\UrlGenerationException + */ + public function to($route, $parameters = [], $absolute = false) + { + $domain = $this->getRouteDomain($route, $parameters); + + // First we will construct the entire URI including the root and query string. Once it + // has been constructed, we'll make sure we don't have any missing parameters or we + // will need to throw the exception to let the developers know one was not given. + $uri = $this->addQueryString($this->url->format( + $root = $this->replaceRootParameters($route, $domain, $parameters), + $this->replaceRouteParameters($route->uri(), $parameters), + $route + ), $parameters); + + if (preg_match('/\{.*?\}/', $uri)) { + throw UrlGenerationException::forMissingParameters($route); + } + + // Once we have ensured that there are no missing parameters in the URI we will encode + // the URI and prepare it for returning to the developer. If the URI is supposed to + // be absolute, we will return it as-is. Otherwise we will remove the URL's root. + $uri = strtr(rawurlencode($uri), $this->dontEncode); + + if (! $absolute) { + $uri = preg_replace('#^(//|[^/?])+#', '', $uri); + + if ($base = $this->request->getBaseUrl()) { + $uri = preg_replace('#^'.$base.'#i', '', $uri); + } + + return '/'.ltrim($uri, '/'); + } + + return $uri; + } + + /** + * Get the formatted domain for a given route. + * + * @param \Illuminate\Routing\Route $route + * @param array $parameters + * @return string + */ + protected function getRouteDomain($route, &$parameters) + { + return $route->getDomain() ? $this->formatDomain($route, $parameters) : null; + } + + /** + * Format the domain and port for the route and request. + * + * @param \Illuminate\Routing\Route $route + * @param array $parameters + * @return string + */ + protected function formatDomain($route, &$parameters) + { + return $this->addPortToDomain( + $this->getRouteScheme($route).$route->getDomain() + ); + } + + /** + * Get the scheme for the given route. + * + * @param \Illuminate\Routing\Route $route + * @return string + */ + protected function getRouteScheme($route) + { + if ($route->httpOnly()) { + return 'http://'; + } elseif ($route->httpsOnly()) { + return 'https://'; + } + + return $this->url->formatScheme(); + } + + /** + * Add the port to the domain if necessary. + * + * @param string $domain + * @return string + */ + protected function addPortToDomain($domain) + { + $secure = $this->request->isSecure(); + + $port = (int) $this->request->getPort(); + + return ($secure && $port === 443) || (! $secure && $port === 80) + ? $domain : $domain.':'.$port; + } + + /** + * Replace the parameters on the root path. + * + * @param \Illuminate\Routing\Route $route + * @param string $domain + * @param array $parameters + * @return string + */ + protected function replaceRootParameters($route, $domain, &$parameters) + { + $scheme = $this->getRouteScheme($route); + + return $this->replaceRouteParameters( + $this->url->formatRoot($scheme, $domain), $parameters + ); + } + + /** + * Replace all of the wildcard parameters for a route path. + * + * @param string $path + * @param array $parameters + * @return string + */ + protected function replaceRouteParameters($path, array &$parameters) + { + $path = $this->replaceNamedParameters($path, $parameters); + + $path = preg_replace_callback('/\{.*?\}/', function ($match) use (&$parameters) { + return (empty($parameters) && ! Str::endsWith($match[0], '?}')) + ? $match[0] + : array_shift($parameters); + }, $path); + + return trim(preg_replace('/\{.*?\?\}/', '', $path), '/'); + } + + /** + * Replace all of the named parameters in the path. + * + * @param string $path + * @param array $parameters + * @return string + */ + protected function replaceNamedParameters($path, &$parameters) + { + return preg_replace_callback('/\{(.*?)\??\}/', function ($m) use (&$parameters) { + if (isset($parameters[$m[1]])) { + return Arr::pull($parameters, $m[1]); + } elseif (isset($this->defaultParameters[$m[1]])) { + return $this->defaultParameters[$m[1]]; + } + + return $m[0]; + }, $path); + } + + /** + * Add a query string to the URI. + * + * @param string $uri + * @param array $parameters + * @return mixed|string + */ + protected function addQueryString($uri, array $parameters) + { + // If the URI has a fragment we will move it to the end of this URI since it will + // need to come after any query string that may be added to the URL else it is + // not going to be available. We will remove it then append it back on here. + if (! is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) { + $uri = preg_replace('/#.*/', '', $uri); + } + + $uri .= $this->getRouteQueryString($parameters); + + return is_null($fragment) ? $uri : $uri."#{$fragment}"; + } + + /** + * Get the query string for a given route. + * + * @param array $parameters + * @return string + */ + protected function getRouteQueryString(array $parameters) + { + // First we will get all of the string parameters that are remaining after we + // have replaced the route wildcards. We'll then build a query string from + // these string parameters then use it as a starting point for the rest. + if (count($parameters) === 0) { + return ''; + } + + $query = Arr::query( + $keyed = $this->getStringParameters($parameters) + ); + + // Lastly, if there are still parameters remaining, we will fetch the numeric + // parameters that are in the array and add them to the query string or we + // will make the initial query string if it wasn't started with strings. + if (count($keyed) < count($parameters)) { + $query .= '&'.implode( + '&', $this->getNumericParameters($parameters) + ); + } + + return '?'.trim($query, '&'); + } + + /** + * Get the string parameters from a given list. + * + * @param array $parameters + * @return array + */ + protected function getStringParameters(array $parameters) + { + return array_filter($parameters, 'is_string', ARRAY_FILTER_USE_KEY); + } + + /** + * Get the numeric parameters from a given list. + * + * @param array $parameters + * @return array + */ + protected function getNumericParameters(array $parameters) + { + return array_filter($parameters, 'is_numeric', ARRAY_FILTER_USE_KEY); + } + + /** + * Set the default named parameters used by the URL generator. + * + * @param array $defaults + * @return void + */ + public function defaults(array $defaults) + { + $this->defaultParameters = array_merge( + $this->defaultParameters, $defaults + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/Router.php b/vendor/laravel/framework/src/Illuminate/Routing/Router.php new file mode 100644 index 0000000..8c6b559 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/Router.php @@ -0,0 +1,1275 @@ +events = $events; + $this->routes = new RouteCollection; + $this->container = $container ?: new Container; + } + + /** + * Register a new GET route with the router. + * + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function get($uri, $action = null) + { + return $this->addRoute(['GET', 'HEAD'], $uri, $action); + } + + /** + * Register a new POST route with the router. + * + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function post($uri, $action = null) + { + return $this->addRoute('POST', $uri, $action); + } + + /** + * Register a new PUT route with the router. + * + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function put($uri, $action = null) + { + return $this->addRoute('PUT', $uri, $action); + } + + /** + * Register a new PATCH route with the router. + * + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function patch($uri, $action = null) + { + return $this->addRoute('PATCH', $uri, $action); + } + + /** + * Register a new DELETE route with the router. + * + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function delete($uri, $action = null) + { + return $this->addRoute('DELETE', $uri, $action); + } + + /** + * Register a new OPTIONS route with the router. + * + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function options($uri, $action = null) + { + return $this->addRoute('OPTIONS', $uri, $action); + } + + /** + * Register a new route responding to all verbs. + * + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function any($uri, $action = null) + { + return $this->addRoute(self::$verbs, $uri, $action); + } + + /** + * Register a new Fallback route with the router. + * + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function fallback($action) + { + $placeholder = 'fallbackPlaceholder'; + + return $this->addRoute( + 'GET', "{{$placeholder}}", $action + )->where($placeholder, '.*')->fallback(); + } + + /** + * Create a redirect from one URI to another. + * + * @param string $uri + * @param string $destination + * @param int $status + * @return \Illuminate\Routing\Route + */ + public function redirect($uri, $destination, $status = 302) + { + return $this->any($uri, '\Illuminate\Routing\RedirectController') + ->defaults('destination', $destination) + ->defaults('status', $status); + } + + /** + * Create a permanent redirect from one URI to another. + * + * @param string $uri + * @param string $destination + * @return \Illuminate\Routing\Route + */ + public function permanentRedirect($uri, $destination) + { + return $this->redirect($uri, $destination, 301); + } + + /** + * Register a new route that returns a view. + * + * @param string $uri + * @param string $view + * @param array $data + * @return \Illuminate\Routing\Route + */ + public function view($uri, $view, $data = []) + { + return $this->match(['GET', 'HEAD'], $uri, '\Illuminate\Routing\ViewController') + ->defaults('view', $view) + ->defaults('data', $data); + } + + /** + * Register a new route with the given verbs. + * + * @param array|string $methods + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function match($methods, $uri, $action = null) + { + return $this->addRoute(array_map('strtoupper', (array) $methods), $uri, $action); + } + + /** + * Register an array of resource controllers. + * + * @param array $resources + * @param array $options + * @return void + */ + public function resources(array $resources, array $options = []) + { + foreach ($resources as $name => $controller) { + $this->resource($name, $controller, $options); + } + } + + /** + * Route a resource to a controller. + * + * @param string $name + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function resource($name, $controller, array $options = []) + { + if ($this->container && $this->container->bound(ResourceRegistrar::class)) { + $registrar = $this->container->make(ResourceRegistrar::class); + } else { + $registrar = new ResourceRegistrar($this); + } + + return new PendingResourceRegistration( + $registrar, $name, $controller, $options + ); + } + + /** + * Register an array of API resource controllers. + * + * @param array $resources + * @param array $options + * @return void + */ + public function apiResources(array $resources, array $options = []) + { + foreach ($resources as $name => $controller) { + $this->apiResource($name, $controller, $options); + } + } + + /** + * Route an API resource to a controller. + * + * @param string $name + * @param string $controller + * @param array $options + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function apiResource($name, $controller, array $options = []) + { + $only = ['index', 'show', 'store', 'update', 'destroy']; + + if (isset($options['except'])) { + $only = array_diff($only, (array) $options['except']); + } + + return $this->resource($name, $controller, array_merge([ + 'only' => $only, + ], $options)); + } + + /** + * Create a route group with shared attributes. + * + * @param array $attributes + * @param \Closure|string $routes + * @return void + */ + public function group(array $attributes, $routes) + { + $this->updateGroupStack($attributes); + + // Once we have updated the group stack, we'll load the provided routes and + // merge in the group's attributes when the routes are created. After we + // have created the routes, we will pop the attributes off the stack. + $this->loadRoutes($routes); + + array_pop($this->groupStack); + } + + /** + * Update the group stack with the given attributes. + * + * @param array $attributes + * @return void + */ + protected function updateGroupStack(array $attributes) + { + if (! empty($this->groupStack)) { + $attributes = $this->mergeWithLastGroup($attributes); + } + + $this->groupStack[] = $attributes; + } + + /** + * Merge the given array with the last group stack. + * + * @param array $new + * @return array + */ + public function mergeWithLastGroup($new) + { + return RouteGroup::merge($new, end($this->groupStack)); + } + + /** + * Load the provided routes. + * + * @param \Closure|string $routes + * @return void + */ + protected function loadRoutes($routes) + { + if ($routes instanceof Closure) { + $routes($this); + } else { + $router = $this; + + require $routes; + } + } + + /** + * Get the prefix from the last group on the stack. + * + * @return string + */ + public function getLastGroupPrefix() + { + if (! empty($this->groupStack)) { + $last = end($this->groupStack); + + return $last['prefix'] ?? ''; + } + + return ''; + } + + /** + * Add a route to the underlying route collection. + * + * @param array|string $methods + * @param string $uri + * @param \Closure|array|string|callable|null $action + * @return \Illuminate\Routing\Route + */ + public function addRoute($methods, $uri, $action) + { + return $this->routes->add($this->createRoute($methods, $uri, $action)); + } + + /** + * Create a new route instance. + * + * @param array|string $methods + * @param string $uri + * @param mixed $action + * @return \Illuminate\Routing\Route + */ + protected function createRoute($methods, $uri, $action) + { + // If the route is routing to a controller we will parse the route action into + // an acceptable array format before registering it and creating this route + // instance itself. We need to build the Closure that will call this out. + if ($this->actionReferencesController($action)) { + $action = $this->convertToControllerAction($action); + } + + $route = $this->newRoute( + $methods, $this->prefix($uri), $action + ); + + // If we have groups that need to be merged, we will merge them now after this + // route has already been created and is ready to go. After we're done with + // the merge we will be ready to return the route back out to the caller. + if ($this->hasGroupStack()) { + $this->mergeGroupAttributesIntoRoute($route); + } + + $this->addWhereClausesToRoute($route); + + return $route; + } + + /** + * Determine if the action is routing to a controller. + * + * @param array $action + * @return bool + */ + protected function actionReferencesController($action) + { + if (! $action instanceof Closure) { + return is_string($action) || (isset($action['uses']) && is_string($action['uses'])); + } + + return false; + } + + /** + * Add a controller based route action to the action array. + * + * @param array|string $action + * @return array + */ + protected function convertToControllerAction($action) + { + if (is_string($action)) { + $action = ['uses' => $action]; + } + + // Here we'll merge any group "uses" statement if necessary so that the action + // has the proper clause for this property. Then we can simply set the name + // of the controller on the action and return the action array for usage. + if (! empty($this->groupStack)) { + $action['uses'] = $this->prependGroupNamespace($action['uses']); + } + + // Here we will set this controller name on the action array just so we always + // have a copy of it for reference if we need it. This can be used while we + // search for a controller name or do some other type of fetch operation. + $action['controller'] = $action['uses']; + + return $action; + } + + /** + * Prepend the last group namespace onto the use clause. + * + * @param string $class + * @return string + */ + protected function prependGroupNamespace($class) + { + $group = end($this->groupStack); + + return isset($group['namespace']) && strpos($class, '\\') !== 0 + ? $group['namespace'].'\\'.$class : $class; + } + + /** + * Create a new Route object. + * + * @param array|string $methods + * @param string $uri + * @param mixed $action + * @return \Illuminate\Routing\Route + */ + protected function newRoute($methods, $uri, $action) + { + return (new Route($methods, $uri, $action)) + ->setRouter($this) + ->setContainer($this->container); + } + + /** + * Prefix the given URI with the last prefix. + * + * @param string $uri + * @return string + */ + protected function prefix($uri) + { + return trim(trim($this->getLastGroupPrefix(), '/').'/'.trim($uri, '/'), '/') ?: '/'; + } + + /** + * Add the necessary where clauses to the route based on its initial registration. + * + * @param \Illuminate\Routing\Route $route + * @return \Illuminate\Routing\Route + */ + protected function addWhereClausesToRoute($route) + { + $route->where(array_merge( + $this->patterns, $route->getAction()['where'] ?? [] + )); + + return $route; + } + + /** + * Merge the group stack with the controller action. + * + * @param \Illuminate\Routing\Route $route + * @return void + */ + protected function mergeGroupAttributesIntoRoute($route) + { + $route->setAction($this->mergeWithLastGroup($route->getAction())); + } + + /** + * Return the response returned by the given route. + * + * @param string $name + * @return mixed + */ + public function respondWithRoute($name) + { + $route = tap($this->routes->getByName($name))->bind($this->currentRequest); + + return $this->runRoute($this->currentRequest, $route); + } + + /** + * Dispatch the request to the application. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse + */ + public function dispatch(Request $request) + { + $this->currentRequest = $request; + + return $this->dispatchToRoute($request); + } + + /** + * Dispatch the request to a route and return the response. + * + * @param \Illuminate\Http\Request $request + * @return mixed + */ + public function dispatchToRoute(Request $request) + { + return $this->runRoute($request, $this->findRoute($request)); + } + + /** + * Find the route matching a given request. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Routing\Route + */ + protected function findRoute($request) + { + $this->current = $route = $this->routes->match($request); + + $this->container->instance(Route::class, $route); + + return $route; + } + + /** + * Return the response for the given route. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Routing\Route $route + * @return mixed + */ + protected function runRoute(Request $request, Route $route) + { + $request->setRouteResolver(function () use ($route) { + return $route; + }); + + $this->events->dispatch(new Events\RouteMatched($route, $request)); + + return $this->prepareResponse($request, + $this->runRouteWithinStack($route, $request) + ); + } + + /** + * Run the given route within a Stack "onion" instance. + * + * @param \Illuminate\Routing\Route $route + * @param \Illuminate\Http\Request $request + * @return mixed + */ + protected function runRouteWithinStack(Route $route, Request $request) + { + $shouldSkipMiddleware = $this->container->bound('middleware.disable') && + $this->container->make('middleware.disable') === true; + + $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route); + + return (new Pipeline($this->container)) + ->send($request) + ->through($middleware) + ->then(function ($request) use ($route) { + return $this->prepareResponse( + $request, $route->run() + ); + }); + } + + /** + * Gather the middleware for the given route with resolved class names. + * + * @param \Illuminate\Routing\Route $route + * @return array + */ + public function gatherRouteMiddleware(Route $route) + { + $middleware = collect($route->gatherMiddleware())->map(function ($name) { + return (array) MiddlewareNameResolver::resolve($name, $this->middleware, $this->middlewareGroups); + })->flatten(); + + return $this->sortMiddleware($middleware); + } + + /** + * Sort the given middleware by priority. + * + * @param \Illuminate\Support\Collection $middlewares + * @return array + */ + protected function sortMiddleware(Collection $middlewares) + { + return (new SortedMiddleware($this->middlewarePriority, $middlewares))->all(); + } + + /** + * Create a response instance from the given value. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param mixed $response + * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse + */ + public function prepareResponse($request, $response) + { + return static::toResponse($request, $response); + } + + /** + * Static version of prepareResponse. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @param mixed $response + * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse + */ + public static function toResponse($request, $response) + { + if ($response instanceof Responsable) { + $response = $response->toResponse($request); + } + + if ($response instanceof PsrResponseInterface) { + $response = (new HttpFoundationFactory)->createResponse($response); + } elseif ($response instanceof Model && $response->wasRecentlyCreated) { + $response = new JsonResponse($response, 201); + } elseif (! $response instanceof SymfonyResponse && + ($response instanceof Arrayable || + $response instanceof Jsonable || + $response instanceof ArrayObject || + $response instanceof JsonSerializable || + is_array($response))) { + $response = new JsonResponse($response); + } elseif (! $response instanceof SymfonyResponse) { + $response = new Response($response); + } + + if ($response->getStatusCode() === Response::HTTP_NOT_MODIFIED) { + $response->setNotModified(); + } + + return $response->prepare($request); + } + + /** + * Substitute the route bindings onto the route. + * + * @param \Illuminate\Routing\Route $route + * @return \Illuminate\Routing\Route + */ + public function substituteBindings($route) + { + foreach ($route->parameters() as $key => $value) { + if (isset($this->binders[$key])) { + $route->setParameter($key, $this->performBinding($key, $value, $route)); + } + } + + return $route; + } + + /** + * Substitute the implicit Eloquent model bindings for the route. + * + * @param \Illuminate\Routing\Route $route + * @return void + */ + public function substituteImplicitBindings($route) + { + ImplicitRouteBinding::resolveForRoute($this->container, $route); + } + + /** + * Call the binding callback for the given key. + * + * @param string $key + * @param string $value + * @param \Illuminate\Routing\Route $route + * @return mixed + */ + protected function performBinding($key, $value, $route) + { + return call_user_func($this->binders[$key], $value, $route); + } + + /** + * Register a route matched event listener. + * + * @param string|callable $callback + * @return void + */ + public function matched($callback) + { + $this->events->listen(Events\RouteMatched::class, $callback); + } + + /** + * Get all of the defined middleware short-hand names. + * + * @return array + */ + public function getMiddleware() + { + return $this->middleware; + } + + /** + * Register a short-hand name for a middleware. + * + * @param string $name + * @param string $class + * @return $this + */ + public function aliasMiddleware($name, $class) + { + $this->middleware[$name] = $class; + + return $this; + } + + /** + * Check if a middlewareGroup with the given name exists. + * + * @param string $name + * @return bool + */ + public function hasMiddlewareGroup($name) + { + return array_key_exists($name, $this->middlewareGroups); + } + + /** + * Get all of the defined middleware groups. + * + * @return array + */ + public function getMiddlewareGroups() + { + return $this->middlewareGroups; + } + + /** + * Register a group of middleware. + * + * @param string $name + * @param array $middleware + * @return $this + */ + public function middlewareGroup($name, array $middleware) + { + $this->middlewareGroups[$name] = $middleware; + + return $this; + } + + /** + * Add a middleware to the beginning of a middleware group. + * + * If the middleware is already in the group, it will not be added again. + * + * @param string $group + * @param string $middleware + * @return $this + */ + public function prependMiddlewareToGroup($group, $middleware) + { + if (isset($this->middlewareGroups[$group]) && ! in_array($middleware, $this->middlewareGroups[$group])) { + array_unshift($this->middlewareGroups[$group], $middleware); + } + + return $this; + } + + /** + * Add a middleware to the end of a middleware group. + * + * If the middleware is already in the group, it will not be added again. + * + * @param string $group + * @param string $middleware + * @return $this + */ + public function pushMiddlewareToGroup($group, $middleware) + { + if (! array_key_exists($group, $this->middlewareGroups)) { + $this->middlewareGroups[$group] = []; + } + + if (! in_array($middleware, $this->middlewareGroups[$group])) { + $this->middlewareGroups[$group][] = $middleware; + } + + return $this; + } + + /** + * Add a new route parameter binder. + * + * @param string $key + * @param string|callable $binder + * @return void + */ + public function bind($key, $binder) + { + $this->binders[str_replace('-', '_', $key)] = RouteBinding::forCallback( + $this->container, $binder + ); + } + + /** + * Register a model binder for a wildcard. + * + * @param string $key + * @param string $class + * @param \Closure|null $callback + * @return void + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException + */ + public function model($key, $class, Closure $callback = null) + { + $this->bind($key, RouteBinding::forModel($this->container, $class, $callback)); + } + + /** + * Get the binding callback for a given binding. + * + * @param string $key + * @return \Closure|null + */ + public function getBindingCallback($key) + { + if (isset($this->binders[$key = str_replace('-', '_', $key)])) { + return $this->binders[$key]; + } + } + + /** + * Get the global "where" patterns. + * + * @return array + */ + public function getPatterns() + { + return $this->patterns; + } + + /** + * Set a global where pattern on all routes. + * + * @param string $key + * @param string $pattern + * @return void + */ + public function pattern($key, $pattern) + { + $this->patterns[$key] = $pattern; + } + + /** + * Set a group of global where patterns on all routes. + * + * @param array $patterns + * @return void + */ + public function patterns($patterns) + { + foreach ($patterns as $key => $pattern) { + $this->pattern($key, $pattern); + } + } + + /** + * Determine if the router currently has a group stack. + * + * @return bool + */ + public function hasGroupStack() + { + return ! empty($this->groupStack); + } + + /** + * Get the current group stack for the router. + * + * @return array + */ + public function getGroupStack() + { + return $this->groupStack; + } + + /** + * Get a route parameter for the current route. + * + * @param string $key + * @param string $default + * @return mixed + */ + public function input($key, $default = null) + { + return $this->current()->parameter($key, $default); + } + + /** + * Get the request currently being dispatched. + * + * @return \Illuminate\Http\Request + */ + public function getCurrentRequest() + { + return $this->currentRequest; + } + + /** + * Get the currently dispatched route instance. + * + * @return \Illuminate\Routing\Route + */ + public function getCurrentRoute() + { + return $this->current(); + } + + /** + * Get the currently dispatched route instance. + * + * @return \Illuminate\Routing\Route|null + */ + public function current() + { + return $this->current; + } + + /** + * Check if a route with the given name exists. + * + * @param string $name + * @return bool + */ + public function has($name) + { + $names = is_array($name) ? $name : func_get_args(); + + foreach ($names as $value) { + if (! $this->routes->hasNamedRoute($value)) { + return false; + } + } + + return true; + } + + /** + * Get the current route name. + * + * @return string|null + */ + public function currentRouteName() + { + return $this->current() ? $this->current()->getName() : null; + } + + /** + * Alias for the "currentRouteNamed" method. + * + * @param mixed ...$patterns + * @return bool + */ + public function is(...$patterns) + { + return $this->currentRouteNamed(...$patterns); + } + + /** + * Determine if the current route matches a pattern. + * + * @param mixed ...$patterns + * @return bool + */ + public function currentRouteNamed(...$patterns) + { + return $this->current() && $this->current()->named(...$patterns); + } + + /** + * Get the current route action. + * + * @return string|null + */ + public function currentRouteAction() + { + if ($this->current()) { + return $this->current()->getAction()['controller'] ?? null; + } + } + + /** + * Alias for the "currentRouteUses" method. + * + * @param array ...$patterns + * @return bool + */ + public function uses(...$patterns) + { + foreach ($patterns as $pattern) { + if (Str::is($pattern, $this->currentRouteAction())) { + return true; + } + } + + return false; + } + + /** + * Determine if the current route action matches a given action. + * + * @param string $action + * @return bool + */ + public function currentRouteUses($action) + { + return $this->currentRouteAction() == $action; + } + + /** + * Register the typical authentication routes for an application. + * + * @param array $options + * @return void + */ + public function auth(array $options = []) + { + // Authentication Routes... + $this->get('login', 'Auth\LoginController@showLoginForm')->name('login'); + $this->post('login', 'Auth\LoginController@login'); + $this->post('logout', 'Auth\LoginController@logout')->name('logout'); + + // Registration Routes... + if ($options['register'] ?? true) { + $this->get('register', 'Auth\RegisterController@showRegistrationForm')->name('register'); + $this->post('register', 'Auth\RegisterController@register'); + } + + // Password Reset Routes... + if ($options['reset'] ?? true) { + $this->resetPassword(); + } + + // Email Verification Routes... + if ($options['verify'] ?? false) { + $this->emailVerification(); + } + } + + /** + * Register the typical reset password routes for an application. + * + * @return void + */ + public function resetPassword() + { + $this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request'); + $this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email'); + $this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset'); + $this->post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update'); + } + + /** + * Register the typical email verification routes for an application. + * + * @return void + */ + public function emailVerification() + { + $this->get('email/verify', 'Auth\VerificationController@show')->name('verification.notice'); + $this->get('email/verify/{id}', 'Auth\VerificationController@verify')->name('verification.verify'); + $this->get('email/resend', 'Auth\VerificationController@resend')->name('verification.resend'); + } + + /** + * Set the unmapped global resource parameters to singular. + * + * @param bool $singular + * @return void + */ + public function singularResourceParameters($singular = true) + { + ResourceRegistrar::singularParameters($singular); + } + + /** + * Set the global resource parameter mapping. + * + * @param array $parameters + * @return void + */ + public function resourceParameters(array $parameters = []) + { + ResourceRegistrar::setParameters($parameters); + } + + /** + * Get or set the verbs used in the resource URIs. + * + * @param array $verbs + * @return array|null + */ + public function resourceVerbs(array $verbs = []) + { + return ResourceRegistrar::verbs($verbs); + } + + /** + * Get the underlying route collection. + * + * @return \Illuminate\Routing\RouteCollection + */ + public function getRoutes() + { + return $this->routes; + } + + /** + * Set the route collection instance. + * + * @param \Illuminate\Routing\RouteCollection $routes + * @return void + */ + public function setRoutes(RouteCollection $routes) + { + foreach ($routes as $route) { + $route->setRouter($this)->setContainer($this->container); + } + + $this->routes = $routes; + + $this->container->instance('routes', $this->routes); + } + + /** + * Dynamically handle calls into the router instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + if ($method === 'middleware') { + return (new RouteRegistrar($this))->attribute($method, is_array($parameters[0]) ? $parameters[0] : $parameters); + } + + return (new RouteRegistrar($this))->attribute($method, $parameters[0]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php new file mode 100755 index 0000000..8eea5ca --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php @@ -0,0 +1,167 @@ +registerRouter(); + $this->registerUrlGenerator(); + $this->registerRedirector(); + $this->registerPsrRequest(); + $this->registerPsrResponse(); + $this->registerResponseFactory(); + $this->registerControllerDispatcher(); + } + + /** + * Register the router instance. + * + * @return void + */ + protected function registerRouter() + { + $this->app->singleton('router', function ($app) { + return new Router($app['events'], $app); + }); + } + + /** + * Register the URL generator service. + * + * @return void + */ + protected function registerUrlGenerator() + { + $this->app->singleton('url', function ($app) { + $routes = $app['router']->getRoutes(); + + // The URL generator needs the route collection that exists on the router. + // Keep in mind this is an object, so we're passing by references here + // and all the registered routes will be available to the generator. + $app->instance('routes', $routes); + + $url = new UrlGenerator( + $routes, $app->rebinding( + 'request', $this->requestRebinder() + ), $app['config']['app.asset_url'] + ); + + // Next we will set a few service resolvers on the URL generator so it can + // get the information it needs to function. This just provides some of + // the convenience features to this URL generator like "signed" URLs. + $url->setSessionResolver(function () { + return $this->app['session']; + }); + + $url->setKeyResolver(function () { + return $this->app->make('config')->get('app.key'); + }); + + // If the route collection is "rebound", for example, when the routes stay + // cached for the application, we will need to rebind the routes on the + // URL generator instance so it has the latest version of the routes. + $app->rebinding('routes', function ($app, $routes) { + $app['url']->setRoutes($routes); + }); + + return $url; + }); + } + + /** + * Get the URL generator request rebinder. + * + * @return \Closure + */ + protected function requestRebinder() + { + return function ($app, $request) { + $app['url']->setRequest($request); + }; + } + + /** + * Register the Redirector service. + * + * @return void + */ + protected function registerRedirector() + { + $this->app->singleton('redirect', function ($app) { + $redirector = new Redirector($app['url']); + + // If the session is set on the application instance, we'll inject it into + // the redirector instance. This allows the redirect responses to allow + // for the quite convenient "with" methods that flash to the session. + if (isset($app['session.store'])) { + $redirector->setSession($app['session.store']); + } + + return $redirector; + }); + } + + /** + * Register a binding for the PSR-7 request implementation. + * + * @return void + */ + protected function registerPsrRequest() + { + $this->app->bind(ServerRequestInterface::class, function ($app) { + return (new DiactorosFactory)->createRequest($app->make('request')); + }); + } + + /** + * Register a binding for the PSR-7 response implementation. + * + * @return void + */ + protected function registerPsrResponse() + { + $this->app->bind(ResponseInterface::class, function () { + return new PsrResponse; + }); + } + + /** + * Register the response factory implementation. + * + * @return void + */ + protected function registerResponseFactory() + { + $this->app->singleton(ResponseFactoryContract::class, function ($app) { + return new ResponseFactory($app[ViewFactoryContract::class], $app['redirect']); + }); + } + + /** + * Register the controller dispatcher. + * + * @return void + */ + protected function registerControllerDispatcher() + { + $this->app->singleton(ControllerDispatcherContract::class, function ($app) { + return new ControllerDispatcher($app); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/SortedMiddleware.php b/vendor/laravel/framework/src/Illuminate/Routing/SortedMiddleware.php new file mode 100644 index 0000000..6af28d5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/SortedMiddleware.php @@ -0,0 +1,84 @@ +all(); + } + + $this->items = $this->sortMiddleware($priorityMap, $middlewares); + } + + /** + * Sort the middlewares by the given priority map. + * + * Each call to this method makes one discrete middleware movement if necessary. + * + * @param array $priorityMap + * @param array $middlewares + * @return array + */ + protected function sortMiddleware($priorityMap, $middlewares) + { + $lastIndex = 0; + + foreach ($middlewares as $index => $middleware) { + if (! is_string($middleware)) { + continue; + } + + $stripped = head(explode(':', $middleware)); + + if (in_array($stripped, $priorityMap)) { + $priorityIndex = array_search($stripped, $priorityMap); + + // This middleware is in the priority map. If we have encountered another middleware + // that was also in the priority map and was at a lower priority than the current + // middleware, we will move this middleware to be above the previous encounter. + if (isset($lastPriorityIndex) && $priorityIndex < $lastPriorityIndex) { + return $this->sortMiddleware( + $priorityMap, array_values($this->moveMiddleware($middlewares, $index, $lastIndex)) + ); + } + + // This middleware is in the priority map; but, this is the first middleware we have + // encountered from the map thus far. We'll save its current index plus its index + // from the priority map so we can compare against them on the next iterations. + $lastIndex = $index; + $lastPriorityIndex = $priorityIndex; + } + } + + return array_values(array_unique($middlewares, SORT_REGULAR)); + } + + /** + * Splice a middleware into a new position and remove the old entry. + * + * @param array $middlewares + * @param int $from + * @param int $to + * @return array + */ + protected function moveMiddleware($middlewares, $from, $to) + { + array_splice($middlewares, $to, 0, $middlewares[$from]); + + unset($middlewares[$from + 1]); + + return $middlewares; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php b/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php new file mode 100755 index 0000000..9409af1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php @@ -0,0 +1,731 @@ +routes = $routes; + $this->assetRoot = $assetRoot; + + $this->setRequest($request); + } + + /** + * Get the full URL for the current request. + * + * @return string + */ + public function full() + { + return $this->request->fullUrl(); + } + + /** + * Get the current URL for the request. + * + * @return string + */ + public function current() + { + return $this->to($this->request->getPathInfo()); + } + + /** + * Get the URL for the previous request. + * + * @param mixed $fallback + * @return string + */ + public function previous($fallback = false) + { + $referrer = $this->request->headers->get('referer'); + + $url = $referrer ? $this->to($referrer) : $this->getPreviousUrlFromSession(); + + if ($url) { + return $url; + } elseif ($fallback) { + return $this->to($fallback); + } + + return $this->to('/'); + } + + /** + * Get the previous URL from the session if possible. + * + * @return string|null + */ + protected function getPreviousUrlFromSession() + { + $session = $this->getSession(); + + return $session ? $session->previousUrl() : null; + } + + /** + * Generate an absolute URL to the given path. + * + * @param string $path + * @param mixed $extra + * @param bool|null $secure + * @return string + */ + public function to($path, $extra = [], $secure = null) + { + // First we will check if the URL is already a valid URL. If it is we will not + // try to generate a new one but will simply return the URL as is, which is + // convenient since developers do not always have to check if it's valid. + if ($this->isValidUrl($path)) { + return $path; + } + + $tail = implode('/', array_map( + 'rawurlencode', (array) $this->formatParameters($extra)) + ); + + // Once we have the scheme we will compile the "tail" by collapsing the values + // into a single string delimited by slashes. This just makes it convenient + // for passing the array of parameters to this URL as a list of segments. + $root = $this->formatRoot($this->formatScheme($secure)); + + [$path, $query] = $this->extractQueryString($path); + + return $this->format( + $root, '/'.trim($path.'/'.$tail, '/') + ).$query; + } + + /** + * Generate a secure, absolute URL to the given path. + * + * @param string $path + * @param array $parameters + * @return string + */ + public function secure($path, $parameters = []) + { + return $this->to($path, $parameters, true); + } + + /** + * Generate the URL to an application asset. + * + * @param string $path + * @param bool|null $secure + * @return string + */ + public function asset($path, $secure = null) + { + if ($this->isValidUrl($path)) { + return $path; + } + + // Once we get the root URL, we will check to see if it contains an index.php + // file in the paths. If it does, we will remove it since it is not needed + // for asset paths, but only for routes to endpoints in the application. + $root = $this->assetRoot + ? $this->assetRoot + : $this->formatRoot($this->formatScheme($secure)); + + return $this->removeIndex($root).'/'.trim($path, '/'); + } + + /** + * Generate the URL to a secure asset. + * + * @param string $path + * @return string + */ + public function secureAsset($path) + { + return $this->asset($path, true); + } + + /** + * Generate the URL to an asset from a custom root domain such as CDN, etc. + * + * @param string $root + * @param string $path + * @param bool|null $secure + * @return string + */ + public function assetFrom($root, $path, $secure = null) + { + // Once we get the root URL, we will check to see if it contains an index.php + // file in the paths. If it does, we will remove it since it is not needed + // for asset paths, but only for routes to endpoints in the application. + $root = $this->formatRoot($this->formatScheme($secure), $root); + + return $this->removeIndex($root).'/'.trim($path, '/'); + } + + /** + * Remove the index.php file from a path. + * + * @param string $root + * @return string + */ + protected function removeIndex($root) + { + $i = 'index.php'; + + return Str::contains($root, $i) ? str_replace('/'.$i, '', $root) : $root; + } + + /** + * Get the default scheme for a raw URL. + * + * @param bool|null $secure + * @return string + */ + public function formatScheme($secure = null) + { + if (! is_null($secure)) { + return $secure ? 'https://' : 'http://'; + } + + if (is_null($this->cachedSchema)) { + $this->cachedSchema = $this->forceScheme ?: $this->request->getScheme().'://'; + } + + return $this->cachedSchema; + } + + /** + * Create a signed route URL for a named route. + * + * @param string $name + * @param array $parameters + * @param \DateTimeInterface|int $expiration + * @param bool $absolute + * @return string + */ + public function signedRoute($name, $parameters = [], $expiration = null, $absolute = true) + { + $parameters = $this->formatParameters($parameters); + + if ($expiration) { + $parameters = $parameters + ['expires' => $this->availableAt($expiration)]; + } + + ksort($parameters); + + $key = call_user_func($this->keyResolver); + + return $this->route($name, $parameters + [ + 'signature' => hash_hmac('sha256', $this->route($name, $parameters, $absolute), $key), + ], $absolute); + } + + /** + * Create a temporary signed route URL for a named route. + * + * @param string $name + * @param \DateTimeInterface|int $expiration + * @param array $parameters + * @param bool $absolute + * @return string + */ + public function temporarySignedRoute($name, $expiration, $parameters = [], $absolute = true) + { + return $this->signedRoute($name, $parameters, $expiration, $absolute); + } + + /** + * Determine if the given request has a valid signature. + * + * @param \Illuminate\Http\Request $request + * @param bool $absolute + * @return bool + */ + public function hasValidSignature(Request $request, $absolute = true) + { + $url = $absolute ? $request->url() : '/'.$request->path(); + + $original = rtrim($url.'?'.Arr::query( + Arr::except($request->query(), 'signature') + ), '?'); + + $expires = Arr::get($request->query(), 'expires'); + + $signature = hash_hmac('sha256', $original, call_user_func($this->keyResolver)); + + return hash_equals($signature, (string) $request->query('signature', '')) && + ! ($expires && Carbon::now()->getTimestamp() > $expires); + } + + /** + * Get the URL to a named route. + * + * @param string $name + * @param mixed $parameters + * @param bool $absolute + * @return string + * + * @throws \InvalidArgumentException + */ + public function route($name, $parameters = [], $absolute = true) + { + if (! is_null($route = $this->routes->getByName($name))) { + return $this->toRoute($route, $parameters, $absolute); + } + + throw new InvalidArgumentException("Route [{$name}] not defined."); + } + + /** + * Get the URL for a given route instance. + * + * @param \Illuminate\Routing\Route $route + * @param mixed $parameters + * @param bool $absolute + * @return string + * + * @throws \Illuminate\Routing\Exceptions\UrlGenerationException + */ + protected function toRoute($route, $parameters, $absolute) + { + return $this->routeUrl()->to( + $route, $this->formatParameters($parameters), $absolute + ); + } + + /** + * Get the URL to a controller action. + * + * @param string|array $action + * @param mixed $parameters + * @param bool $absolute + * @return string + * + * @throws \InvalidArgumentException + */ + public function action($action, $parameters = [], $absolute = true) + { + if (is_null($route = $this->routes->getByAction($action = $this->formatAction($action)))) { + throw new InvalidArgumentException("Action {$action} not defined."); + } + + return $this->toRoute($route, $parameters, $absolute); + } + + /** + * Format the given controller action. + * + * @param string|array $action + * @return string + */ + protected function formatAction($action) + { + if (is_array($action)) { + $action = '\\'.implode('@', $action); + } + + if ($this->rootNamespace && strpos($action, '\\') !== 0) { + return $this->rootNamespace.'\\'.$action; + } else { + return trim($action, '\\'); + } + } + + /** + * Format the array of URL parameters. + * + * @param mixed|array $parameters + * @return array + */ + public function formatParameters($parameters) + { + $parameters = Arr::wrap($parameters); + + foreach ($parameters as $key => $parameter) { + if ($parameter instanceof UrlRoutable) { + $parameters[$key] = $parameter->getRouteKey(); + } + } + + return $parameters; + } + + /** + * Extract the query string from the given path. + * + * @param string $path + * @return array + */ + protected function extractQueryString($path) + { + if (($queryPosition = strpos($path, '?')) !== false) { + return [ + substr($path, 0, $queryPosition), + substr($path, $queryPosition), + ]; + } + + return [$path, '']; + } + + /** + * Get the base URL for the request. + * + * @param string $scheme + * @param string $root + * @return string + */ + public function formatRoot($scheme, $root = null) + { + if (is_null($root)) { + if (is_null($this->cachedRoot)) { + $this->cachedRoot = $this->forcedRoot ?: $this->request->root(); + } + + $root = $this->cachedRoot; + } + + $start = Str::startsWith($root, 'http://') ? 'http://' : 'https://'; + + return preg_replace('~'.$start.'~', $scheme, $root, 1); + } + + /** + * Format the given URL segments into a single URL. + * + * @param string $root + * @param string $path + * @param \Illuminate\Routing\Route|null $route + * @return string + */ + public function format($root, $path, $route = null) + { + $path = '/'.trim($path, '/'); + + if ($this->formatHostUsing) { + $root = call_user_func($this->formatHostUsing, $root, $route); + } + + if ($this->formatPathUsing) { + $path = call_user_func($this->formatPathUsing, $path, $route); + } + + return trim($root.$path, '/'); + } + + /** + * Determine if the given path is a valid URL. + * + * @param string $path + * @return bool + */ + public function isValidUrl($path) + { + if (! preg_match('~^(#|//|https?://|mailto:|tel:)~', $path)) { + return filter_var($path, FILTER_VALIDATE_URL) !== false; + } + + return true; + } + + /** + * Get the Route URL generator instance. + * + * @return \Illuminate\Routing\RouteUrlGenerator + */ + protected function routeUrl() + { + if (! $this->routeGenerator) { + $this->routeGenerator = new RouteUrlGenerator($this, $this->request); + } + + return $this->routeGenerator; + } + + /** + * Set the default named parameters used by the URL generator. + * + * @param array $defaults + * @return void + */ + public function defaults(array $defaults) + { + $this->routeUrl()->defaults($defaults); + } + + /** + * Get the default named parameters used by the URL generator. + * + * @return array + */ + public function getDefaultParameters() + { + return $this->routeUrl()->defaultParameters; + } + + /** + * Force the scheme for URLs. + * + * @param string $scheme + * @return void + */ + public function forceScheme($scheme) + { + $this->cachedSchema = null; + + $this->forceScheme = $scheme.'://'; + } + + /** + * Set the forced root URL. + * + * @param string $root + * @return void + */ + public function forceRootUrl($root) + { + $this->forcedRoot = rtrim($root, '/'); + + $this->cachedRoot = null; + } + + /** + * Set a callback to be used to format the host of generated URLs. + * + * @param \Closure $callback + * @return $this + */ + public function formatHostUsing(Closure $callback) + { + $this->formatHostUsing = $callback; + + return $this; + } + + /** + * Set a callback to be used to format the path of generated URLs. + * + * @param \Closure $callback + * @return $this + */ + public function formatPathUsing(Closure $callback) + { + $this->formatPathUsing = $callback; + + return $this; + } + + /** + * Get the path formatter being used by the URL generator. + * + * @return \Closure + */ + public function pathFormatter() + { + return $this->formatPathUsing ?: function ($path) { + return $path; + }; + } + + /** + * Get the request instance. + * + * @return \Illuminate\Http\Request + */ + public function getRequest() + { + return $this->request; + } + + /** + * Set the current request instance. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + public function setRequest(Request $request) + { + $this->request = $request; + + $this->cachedRoot = null; + $this->cachedSchema = null; + $this->routeGenerator = null; + } + + /** + * Set the route collection. + * + * @param \Illuminate\Routing\RouteCollection $routes + * @return $this + */ + public function setRoutes(RouteCollection $routes) + { + $this->routes = $routes; + + return $this; + } + + /** + * Get the session implementation from the resolver. + * + * @return \Illuminate\Session\Store|null + */ + protected function getSession() + { + if ($this->sessionResolver) { + return call_user_func($this->sessionResolver); + } + } + + /** + * Set the session resolver for the generator. + * + * @param callable $sessionResolver + * @return $this + */ + public function setSessionResolver(callable $sessionResolver) + { + $this->sessionResolver = $sessionResolver; + + return $this; + } + + /** + * Set the encryption key resolver. + * + * @param callable $keyResolver + * @return $this + */ + public function setKeyResolver(callable $keyResolver) + { + $this->keyResolver = $keyResolver; + + return $this; + } + + /** + * Set the root controller namespace. + * + * @param string $rootNamespace + * @return $this + */ + public function setRootControllerNamespace($rootNamespace) + { + $this->rootNamespace = $rootNamespace; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/ViewController.php b/vendor/laravel/framework/src/Illuminate/Routing/ViewController.php new file mode 100644 index 0000000..232013f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/ViewController.php @@ -0,0 +1,39 @@ +view = $view; + } + + /** + * Invoke the controller method. + * + * @param array $args + * @return \Illuminate\Contracts\View\View + */ + public function __invoke(...$args) + { + [$view, $data] = array_slice($args, -2); + + return $this->view->make($view, $data); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Routing/composer.json b/vendor/laravel/framework/src/Illuminate/Routing/composer.json new file mode 100644 index 0000000..e438d41 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Routing/composer.json @@ -0,0 +1,47 @@ +{ + "name": "illuminate/routing", + "description": "The Illuminate Routing package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/container": "5.7.*", + "illuminate/contracts": "5.7.*", + "illuminate/http": "5.7.*", + "illuminate/pipeline": "5.7.*", + "illuminate/session": "5.7.*", + "illuminate/support": "5.7.*", + "symfony/debug": "^4.1", + "symfony/http-foundation": "^4.1", + "symfony/http-kernel": "^4.1", + "symfony/routing": "^4.1" + }, + "autoload": { + "psr-4": { + "Illuminate\\Routing\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "suggest": { + "illuminate/console": "Required to use the make commands (5.7.*).", + "symfony/psr-http-message-bridge": "Required to psr7 bridging features (^1.0)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php b/vendor/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php new file mode 100755 index 0000000..a2990bd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php @@ -0,0 +1,94 @@ +cache = $cache; + $this->minutes = $minutes; + } + + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + return true; + } + + /** + * {@inheritdoc} + */ + public function close() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + return $this->cache->get($sessionId, ''); + } + + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + return $this->cache->put($sessionId, $data, $this->minutes); + } + + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + return $this->cache->forget($sessionId); + } + + /** + * {@inheritdoc} + */ + public function gc($lifetime) + { + return true; + } + + /** + * Get the underlying cache repository. + * + * @return \Illuminate\Contracts\Cache\Repository + */ + public function getCache() + { + return $this->cache; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/Console/SessionTableCommand.php b/vendor/laravel/framework/src/Illuminate/Session/Console/SessionTableCommand.php new file mode 100644 index 0000000..e99f7d2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/Console/SessionTableCommand.php @@ -0,0 +1,81 @@ +files = $files; + $this->composer = $composer; + } + + /** + * Execute the console command. + * + * @return void + */ + public function handle() + { + $fullPath = $this->createBaseMigration(); + + $this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/database.stub')); + + $this->info('Migration created successfully!'); + + $this->composer->dumpAutoloads(); + } + + /** + * Create a base migration file for the session. + * + * @return string + */ + protected function createBaseMigration() + { + $name = 'create_sessions_table'; + + $path = $this->laravel->databasePath().'/migrations'; + + return $this->laravel['migration.creator']->create($name, $path); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/Console/stubs/database.stub b/vendor/laravel/framework/src/Illuminate/Session/Console/stubs/database.stub new file mode 100755 index 0000000..c213297 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/Console/stubs/database.stub @@ -0,0 +1,35 @@ +string('id')->unique(); + $table->unsignedInteger('user_id')->nullable(); + $table->string('ip_address', 45)->nullable(); + $table->text('user_agent')->nullable(); + $table->text('payload'); + $table->integer('last_activity'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('sessions'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/CookieSessionHandler.php b/vendor/laravel/framework/src/Illuminate/Session/CookieSessionHandler.php new file mode 100755 index 0000000..e91053d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/CookieSessionHandler.php @@ -0,0 +1,121 @@ +cookie = $cookie; + $this->minutes = $minutes; + } + + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + return true; + } + + /** + * {@inheritdoc} + */ + public function close() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + $value = $this->request->cookies->get($sessionId) ?: ''; + + if (! is_null($decoded = json_decode($value, true)) && is_array($decoded)) { + if (isset($decoded['expires']) && $this->currentTime() <= $decoded['expires']) { + return $decoded['data']; + } + } + + return ''; + } + + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + $this->cookie->queue($sessionId, json_encode([ + 'data' => $data, + 'expires' => $this->availableAt($this->minutes * 60), + ]), $this->minutes); + + return true; + } + + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + $this->cookie->queue($this->cookie->forget($sessionId)); + + return true; + } + + /** + * {@inheritdoc} + */ + public function gc($lifetime) + { + return true; + } + + /** + * Set the request instance. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * @return void + */ + public function setRequest(Request $request) + { + $this->request = $request; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/DatabaseSessionHandler.php b/vendor/laravel/framework/src/Illuminate/Session/DatabaseSessionHandler.php new file mode 100644 index 0000000..976c290 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/DatabaseSessionHandler.php @@ -0,0 +1,294 @@ +table = $table; + $this->minutes = $minutes; + $this->container = $container; + $this->connection = $connection; + } + + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + return true; + } + + /** + * {@inheritdoc} + */ + public function close() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + $session = (object) $this->getQuery()->find($sessionId); + + if ($this->expired($session)) { + $this->exists = true; + + return ''; + } + + if (isset($session->payload)) { + $this->exists = true; + + return base64_decode($session->payload); + } + + return ''; + } + + /** + * Determine if the session is expired. + * + * @param \stdClass $session + * @return bool + */ + protected function expired($session) + { + return isset($session->last_activity) && + $session->last_activity < Carbon::now()->subMinutes($this->minutes)->getTimestamp(); + } + + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + $payload = $this->getDefaultPayload($data); + + if (! $this->exists) { + $this->read($sessionId); + } + + if ($this->exists) { + $this->performUpdate($sessionId, $payload); + } else { + $this->performInsert($sessionId, $payload); + } + + return $this->exists = true; + } + + /** + * Perform an insert operation on the session ID. + * + * @param string $sessionId + * @param string $payload + * @return bool|null + */ + protected function performInsert($sessionId, $payload) + { + try { + return $this->getQuery()->insert(Arr::set($payload, 'id', $sessionId)); + } catch (QueryException $e) { + $this->performUpdate($sessionId, $payload); + } + } + + /** + * Perform an update operation on the session ID. + * + * @param string $sessionId + * @param string $payload + * @return int + */ + protected function performUpdate($sessionId, $payload) + { + return $this->getQuery()->where('id', $sessionId)->update($payload); + } + + /** + * Get the default payload for the session. + * + * @param string $data + * @return array + */ + protected function getDefaultPayload($data) + { + $payload = [ + 'payload' => base64_encode($data), + 'last_activity' => $this->currentTime(), + ]; + + if (! $this->container) { + return $payload; + } + + return tap($payload, function (&$payload) { + $this->addUserInformation($payload) + ->addRequestInformation($payload); + }); + } + + /** + * Add the user information to the session payload. + * + * @param array $payload + * @return $this + */ + protected function addUserInformation(&$payload) + { + if ($this->container->bound(Guard::class)) { + $payload['user_id'] = $this->userId(); + } + + return $this; + } + + /** + * Get the currently authenticated user's ID. + * + * @return mixed + */ + protected function userId() + { + return $this->container->make(Guard::class)->id(); + } + + /** + * Add the request information to the session payload. + * + * @param array $payload + * @return $this + */ + protected function addRequestInformation(&$payload) + { + if ($this->container->bound('request')) { + $payload = array_merge($payload, [ + 'ip_address' => $this->ipAddress(), + 'user_agent' => $this->userAgent(), + ]); + } + + return $this; + } + + /** + * Get the IP address for the current request. + * + * @return string + */ + protected function ipAddress() + { + return $this->container->make('request')->ip(); + } + + /** + * Get the user agent for the current request. + * + * @return string + */ + protected function userAgent() + { + return substr((string) $this->container->make('request')->header('User-Agent'), 0, 500); + } + + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + $this->getQuery()->where('id', $sessionId)->delete(); + + return true; + } + + /** + * {@inheritdoc} + */ + public function gc($lifetime) + { + $this->getQuery()->where('last_activity', '<=', $this->currentTime() - $lifetime)->delete(); + } + + /** + * Get a fresh query builder instance for the table. + * + * @return \Illuminate\Database\Query\Builder + */ + protected function getQuery() + { + return $this->connection->table($this->table); + } + + /** + * Set the existence state for the session. + * + * @param bool $value + * @return $this + */ + public function setExists($value) + { + $this->exists = $value; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php b/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php new file mode 100644 index 0000000..078d13f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/EncryptedStore.php @@ -0,0 +1,69 @@ +encrypter = $encrypter; + + parent::__construct($name, $handler, $id); + } + + /** + * Prepare the raw string data from the session for unserialization. + * + * @param string $data + * @return string + */ + protected function prepareForUnserialize($data) + { + try { + return $this->encrypter->decrypt($data); + } catch (DecryptException $e) { + return serialize([]); + } + } + + /** + * Prepare the serialized session data for storage. + * + * @param string $data + * @return string + */ + protected function prepareForStorage($data) + { + return $this->encrypter->encrypt($data); + } + + /** + * Get the encrypter instance. + * + * @return \Illuminate\Contracts\Encryption\Encrypter + */ + public function getEncrypter() + { + return $this->encrypter; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/ExistenceAwareInterface.php b/vendor/laravel/framework/src/Illuminate/Session/ExistenceAwareInterface.php new file mode 100644 index 0000000..4a6bd98 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/ExistenceAwareInterface.php @@ -0,0 +1,14 @@ +path = $path; + $this->files = $files; + $this->minutes = $minutes; + } + + /** + * {@inheritdoc} + */ + public function open($savePath, $sessionName) + { + return true; + } + + /** + * {@inheritdoc} + */ + public function close() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function read($sessionId) + { + if ($this->files->isFile($path = $this->path.'/'.$sessionId)) { + if ($this->files->lastModified($path) >= Carbon::now()->subMinutes($this->minutes)->getTimestamp()) { + return $this->files->sharedGet($path); + } + } + + return ''; + } + + /** + * {@inheritdoc} + */ + public function write($sessionId, $data) + { + $this->files->put($this->path.'/'.$sessionId, $data, true); + + return true; + } + + /** + * {@inheritdoc} + */ + public function destroy($sessionId) + { + $this->files->delete($this->path.'/'.$sessionId); + + return true; + } + + /** + * {@inheritdoc} + */ + public function gc($lifetime) + { + $files = Finder::create() + ->in($this->path) + ->files() + ->ignoreDotFiles(true) + ->date('<= now - '.$lifetime.' seconds'); + + foreach ($files as $file) { + $this->files->delete($file->getRealPath()); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php b/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php new file mode 100644 index 0000000..bdc4eb4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php @@ -0,0 +1,96 @@ +auth = $auth; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + if (! $request->user() || ! $request->session()) { + return $next($request); + } + + if ($this->auth->viaRemember()) { + $passwordHash = explode('|', $request->cookies->get($this->auth->getRecallerName()))[2]; + + if ($passwordHash != $request->user()->getAuthPassword()) { + $this->logout($request); + } + } + + if (! $request->session()->has('password_hash')) { + $this->storePasswordHashInSession($request); + } + + if ($request->session()->get('password_hash') !== $request->user()->getAuthPassword()) { + $this->logout($request); + } + + return tap($next($request), function () use ($request) { + $this->storePasswordHashInSession($request); + }); + } + + /** + * Store the user's current password hash in the session. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + protected function storePasswordHashInSession($request) + { + if (! $request->user()) { + return; + } + + $request->session()->put([ + 'password_hash' => $request->user()->getAuthPassword(), + ]); + } + + /** + * Log the user out of the application. + * + * @param \Illuminate\Http\Request $request + * @return void + * + * @throws \Illuminate\Auth\AuthenticationException + */ + protected function logout($request) + { + $this->auth->logout(); + + $request->session()->flush(); + + throw new AuthenticationException; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php b/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php new file mode 100644 index 0000000..b47fde2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php @@ -0,0 +1,242 @@ +manager = $manager; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + $this->sessionHandled = true; + + // If a session driver has been configured, we will need to start the session here + // so that the data is ready for an application. Note that the Laravel sessions + // do not make use of PHP "native" sessions in any way since they are crappy. + if ($this->sessionConfigured()) { + $request->setLaravelSession( + $session = $this->startSession($request) + ); + + $this->collectGarbage($session); + } + + $response = $next($request); + + // Again, if the session has been configured we will need to close out the session + // so that the attributes may be persisted to some storage medium. We will also + // add the session identifier cookie to the application response headers now. + if ($this->sessionConfigured()) { + $this->storeCurrentUrl($request, $session); + + $this->addCookieToResponse($response, $session); + } + + return $response; + } + + /** + * Perform any final actions for the request lifecycle. + * + * @param \Illuminate\Http\Request $request + * @param \Symfony\Component\HttpFoundation\Response $response + * @return void + */ + public function terminate($request, $response) + { + if ($this->sessionHandled && $this->sessionConfigured() && ! $this->usingCookieSessions()) { + $this->manager->driver()->save(); + } + } + + /** + * Start the session for the given request. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Contracts\Session\Session + */ + protected function startSession(Request $request) + { + return tap($this->getSession($request), function ($session) use ($request) { + $session->setRequestOnHandler($request); + + $session->start(); + }); + } + + /** + * Get the session implementation from the manager. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Contracts\Session\Session + */ + public function getSession(Request $request) + { + return tap($this->manager->driver(), function ($session) use ($request) { + $session->setId($request->cookies->get($session->getName())); + }); + } + + /** + * Remove the garbage from the session if necessary. + * + * @param \Illuminate\Contracts\Session\Session $session + * @return void + */ + protected function collectGarbage(Session $session) + { + $config = $this->manager->getSessionConfig(); + + // Here we will see if this request hits the garbage collection lottery by hitting + // the odds needed to perform garbage collection on any given request. If we do + // hit it, we'll call this handler to let it delete all the expired sessions. + if ($this->configHitsLottery($config)) { + $session->getHandler()->gc($this->getSessionLifetimeInSeconds()); + } + } + + /** + * Determine if the configuration odds hit the lottery. + * + * @param array $config + * @return bool + */ + protected function configHitsLottery(array $config) + { + return random_int(1, $config['lottery'][1]) <= $config['lottery'][0]; + } + + /** + * Store the current URL for the request if necessary. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Contracts\Session\Session $session + * @return void + */ + protected function storeCurrentUrl(Request $request, $session) + { + if ($request->method() === 'GET' && $request->route() && ! $request->ajax()) { + $session->setPreviousUrl($request->fullUrl()); + } + } + + /** + * Add the session cookie to the application response. + * + * @param \Symfony\Component\HttpFoundation\Response $response + * @param \Illuminate\Contracts\Session\Session $session + * @return void + */ + protected function addCookieToResponse(Response $response, Session $session) + { + if ($this->usingCookieSessions()) { + $this->manager->driver()->save(); + } + + if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig())) { + $response->headers->setCookie(new Cookie( + $session->getName(), $session->getId(), $this->getCookieExpirationDate(), + $config['path'], $config['domain'], $config['secure'] ?? false, + $config['http_only'] ?? true, false, $config['same_site'] ?? null + )); + } + } + + /** + * Get the session lifetime in seconds. + * + * @return int + */ + protected function getSessionLifetimeInSeconds() + { + return ($this->manager->getSessionConfig()['lifetime'] ?? null) * 60; + } + + /** + * Get the cookie lifetime in seconds. + * + * @return \DateTimeInterface + */ + protected function getCookieExpirationDate() + { + $config = $this->manager->getSessionConfig(); + + return $config['expire_on_close'] ? 0 : Carbon::now()->addMinutes($config['lifetime']); + } + + /** + * Determine if a session driver has been configured. + * + * @return bool + */ + protected function sessionConfigured() + { + return ! is_null($this->manager->getSessionConfig()['driver'] ?? null); + } + + /** + * Determine if the configured session driver is persistent. + * + * @param array|null $config + * @return bool + */ + protected function sessionIsPersistent(array $config = null) + { + $config = $config ?: $this->manager->getSessionConfig(); + + return ! in_array($config['driver'], [null, 'array']); + } + + /** + * Determine if the session is using cookie sessions. + * + * @return bool + */ + protected function usingCookieSessions() + { + if ($this->sessionConfigured()) { + return $this->manager->driver()->getHandler() instanceof CookieSessionHandler; + } + + return false; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/NullSessionHandler.php b/vendor/laravel/framework/src/Illuminate/Session/NullSessionHandler.php new file mode 100644 index 0000000..56f567e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/NullSessionHandler.php @@ -0,0 +1,56 @@ +buildSession(parent::callCustomCreator($driver)); + } + + /** + * Create an instance of the "array" session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createArrayDriver() + { + return $this->buildSession(new NullSessionHandler); + } + + /** + * Create an instance of the "cookie" session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createCookieDriver() + { + return $this->buildSession(new CookieSessionHandler( + $this->app['cookie'], $this->app['config']['session.lifetime'] + )); + } + + /** + * Create an instance of the file session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createFileDriver() + { + return $this->createNativeDriver(); + } + + /** + * Create an instance of the file session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createNativeDriver() + { + $lifetime = $this->app['config']['session.lifetime']; + + return $this->buildSession(new FileSessionHandler( + $this->app['files'], $this->app['config']['session.files'], $lifetime + )); + } + + /** + * Create an instance of the database session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createDatabaseDriver() + { + $table = $this->app['config']['session.table']; + + $lifetime = $this->app['config']['session.lifetime']; + + return $this->buildSession(new DatabaseSessionHandler( + $this->getDatabaseConnection(), $table, $lifetime, $this->app + )); + } + + /** + * Get the database connection for the database driver. + * + * @return \Illuminate\Database\Connection + */ + protected function getDatabaseConnection() + { + $connection = $this->app['config']['session.connection']; + + return $this->app['db']->connection($connection); + } + + /** + * Create an instance of the APC session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createApcDriver() + { + return $this->createCacheBased('apc'); + } + + /** + * Create an instance of the Memcached session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createMemcachedDriver() + { + return $this->createCacheBased('memcached'); + } + + /** + * Create an instance of the Redis session driver. + * + * @return \Illuminate\Session\Store + */ + protected function createRedisDriver() + { + $handler = $this->createCacheHandler('redis'); + + $handler->getCache()->getStore()->setConnection( + $this->app['config']['session.connection'] + ); + + return $this->buildSession($handler); + } + + /** + * Create an instance of a cache driven driver. + * + * @param string $driver + * @return \Illuminate\Session\Store + */ + protected function createCacheBased($driver) + { + return $this->buildSession($this->createCacheHandler($driver)); + } + + /** + * Create the cache based session handler instance. + * + * @param string $driver + * @return \Illuminate\Session\CacheBasedSessionHandler + */ + protected function createCacheHandler($driver) + { + $store = $this->app['config']->get('session.store') ?: $driver; + + return new CacheBasedSessionHandler( + clone $this->app['cache']->store($store), + $this->app['config']['session.lifetime'] + ); + } + + /** + * Build the session instance. + * + * @param \SessionHandlerInterface $handler + * @return \Illuminate\Session\Store + */ + protected function buildSession($handler) + { + if ($this->app['config']['session.encrypt']) { + return $this->buildEncryptedSession($handler); + } + + return new Store($this->app['config']['session.cookie'], $handler); + } + + /** + * Build the encrypted session instance. + * + * @param \SessionHandlerInterface $handler + * @return \Illuminate\Session\EncryptedStore + */ + protected function buildEncryptedSession($handler) + { + return new EncryptedStore( + $this->app['config']['session.cookie'], $handler, $this->app['encrypter'] + ); + } + + /** + * Get the session configuration. + * + * @return array + */ + public function getSessionConfig() + { + return $this->app['config']['session']; + } + + /** + * Get the default session driver name. + * + * @return string + */ + public function getDefaultDriver() + { + return $this->app['config']['session.driver']; + } + + /** + * Set the default session driver name. + * + * @param string $name + * @return void + */ + public function setDefaultDriver($name) + { + $this->app['config']['session.driver'] = $name; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/SessionServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Session/SessionServiceProvider.php new file mode 100755 index 0000000..c858506 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/SessionServiceProvider.php @@ -0,0 +1,50 @@ +registerSessionManager(); + + $this->registerSessionDriver(); + + $this->app->singleton(StartSession::class); + } + + /** + * Register the session manager instance. + * + * @return void + */ + protected function registerSessionManager() + { + $this->app->singleton('session', function ($app) { + return new SessionManager($app); + }); + } + + /** + * Register the session driver instance. + * + * @return void + */ + protected function registerSessionDriver() + { + $this->app->singleton('session.store', function ($app) { + // First, we will create the session manager which is responsible for the + // creation of the various session drivers when they are needed by the + // application instance, and will resolve them on a lazy load basis. + return $app->make('session')->driver(); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/Store.php b/vendor/laravel/framework/src/Illuminate/Session/Store.php new file mode 100755 index 0000000..787e77d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/Store.php @@ -0,0 +1,661 @@ +setId($id); + $this->name = $name; + $this->handler = $handler; + } + + /** + * Start the session, reading the data from a handler. + * + * @return bool + */ + public function start() + { + $this->loadSession(); + + if (! $this->has('_token')) { + $this->regenerateToken(); + } + + return $this->started = true; + } + + /** + * Load the session data from the handler. + * + * @return void + */ + protected function loadSession() + { + $this->attributes = array_merge($this->attributes, $this->readFromHandler()); + } + + /** + * Read the session data from the handler. + * + * @return array + */ + protected function readFromHandler() + { + if ($data = $this->handler->read($this->getId())) { + $data = @unserialize($this->prepareForUnserialize($data)); + + if ($data !== false && ! is_null($data) && is_array($data)) { + return $data; + } + } + + return []; + } + + /** + * Prepare the raw string data from the session for unserialization. + * + * @param string $data + * @return string + */ + protected function prepareForUnserialize($data) + { + return $data; + } + + /** + * Save the session data to storage. + * + * @return bool + */ + public function save() + { + $this->ageFlashData(); + + $this->handler->write($this->getId(), $this->prepareForStorage( + serialize($this->attributes) + )); + + $this->started = false; + } + + /** + * Prepare the serialized session data for storage. + * + * @param string $data + * @return string + */ + protected function prepareForStorage($data) + { + return $data; + } + + /** + * Age the flash data for the session. + * + * @return void + */ + public function ageFlashData() + { + $this->forget($this->get('_flash.old', [])); + + $this->put('_flash.old', $this->get('_flash.new', [])); + + $this->put('_flash.new', []); + } + + /** + * Get all of the session data. + * + * @return array + */ + public function all() + { + return $this->attributes; + } + + /** + * Checks if a key exists. + * + * @param string|array $key + * @return bool + */ + public function exists($key) + { + $placeholder = new stdClass; + + return ! collect(is_array($key) ? $key : func_get_args())->contains(function ($key) use ($placeholder) { + return $this->get($key, $placeholder) === $placeholder; + }); + } + + /** + * Checks if a key is present and not null. + * + * @param string|array $key + * @return bool + */ + public function has($key) + { + return ! collect(is_array($key) ? $key : func_get_args())->contains(function ($key) { + return is_null($this->get($key)); + }); + } + + /** + * Get an item from the session. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + return Arr::get($this->attributes, $key, $default); + } + + /** + * Get the value of a given key and then forget it. + * + * @param string $key + * @param string $default + * @return mixed + */ + public function pull($key, $default = null) + { + return Arr::pull($this->attributes, $key, $default); + } + + /** + * Determine if the session contains old input. + * + * @param string $key + * @return bool + */ + public function hasOldInput($key = null) + { + $old = $this->getOldInput($key); + + return is_null($key) ? count($old) > 0 : ! is_null($old); + } + + /** + * Get the requested item from the flashed input array. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function getOldInput($key = null, $default = null) + { + return Arr::get($this->get('_old_input', []), $key, $default); + } + + /** + * Replace the given session attributes entirely. + * + * @param array $attributes + * @return void + */ + public function replace(array $attributes) + { + $this->put($attributes); + } + + /** + * Put a key / value pair or array of key / value pairs in the session. + * + * @param string|array $key + * @param mixed $value + * @return void + */ + public function put($key, $value = null) + { + if (! is_array($key)) { + $key = [$key => $value]; + } + + foreach ($key as $arrayKey => $arrayValue) { + Arr::set($this->attributes, $arrayKey, $arrayValue); + } + } + + /** + * Get an item from the session, or store the default value. + * + * @param string $key + * @param \Closure $callback + * @return mixed + */ + public function remember($key, Closure $callback) + { + if (! is_null($value = $this->get($key))) { + return $value; + } + + return tap($callback(), function ($value) use ($key) { + $this->put($key, $value); + }); + } + + /** + * Push a value onto a session array. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function push($key, $value) + { + $array = $this->get($key, []); + + $array[] = $value; + + $this->put($key, $array); + } + + /** + * Increment the value of an item in the session. + * + * @param string $key + * @param int $amount + * @return mixed + */ + public function increment($key, $amount = 1) + { + $this->put($key, $value = $this->get($key, 0) + $amount); + + return $value; + } + + /** + * Decrement the value of an item in the session. + * + * @param string $key + * @param int $amount + * @return int + */ + public function decrement($key, $amount = 1) + { + return $this->increment($key, $amount * -1); + } + + /** + * Flash a key / value pair to the session. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function flash(string $key, $value = true) + { + $this->put($key, $value); + + $this->push('_flash.new', $key); + + $this->removeFromOldFlashData([$key]); + } + + /** + * Flash a key / value pair to the session for immediate use. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function now($key, $value) + { + $this->put($key, $value); + + $this->push('_flash.old', $key); + } + + /** + * Reflash all of the session flash data. + * + * @return void + */ + public function reflash() + { + $this->mergeNewFlashes($this->get('_flash.old', [])); + + $this->put('_flash.old', []); + } + + /** + * Reflash a subset of the current flash data. + * + * @param array|mixed $keys + * @return void + */ + public function keep($keys = null) + { + $this->mergeNewFlashes($keys = is_array($keys) ? $keys : func_get_args()); + + $this->removeFromOldFlashData($keys); + } + + /** + * Merge new flash keys into the new flash array. + * + * @param array $keys + * @return void + */ + protected function mergeNewFlashes(array $keys) + { + $values = array_unique(array_merge($this->get('_flash.new', []), $keys)); + + $this->put('_flash.new', $values); + } + + /** + * Remove the given keys from the old flash data. + * + * @param array $keys + * @return void + */ + protected function removeFromOldFlashData(array $keys) + { + $this->put('_flash.old', array_diff($this->get('_flash.old', []), $keys)); + } + + /** + * Flash an input array to the session. + * + * @param array $value + * @return void + */ + public function flashInput(array $value) + { + $this->flash('_old_input', $value); + } + + /** + * Remove an item from the session, returning its value. + * + * @param string $key + * @return mixed + */ + public function remove($key) + { + return Arr::pull($this->attributes, $key); + } + + /** + * Remove one or many items from the session. + * + * @param string|array $keys + * @return void + */ + public function forget($keys) + { + Arr::forget($this->attributes, $keys); + } + + /** + * Remove all of the items from the session. + * + * @return void + */ + public function flush() + { + $this->attributes = []; + } + + /** + * Flush the session data and regenerate the ID. + * + * @return bool + */ + public function invalidate() + { + $this->flush(); + + return $this->migrate(true); + } + + /** + * Generate a new session identifier. + * + * @param bool $destroy + * @return bool + */ + public function regenerate($destroy = false) + { + return tap($this->migrate($destroy), function () { + $this->regenerateToken(); + }); + } + + /** + * Generate a new session ID for the session. + * + * @param bool $destroy + * @return bool + */ + public function migrate($destroy = false) + { + if ($destroy) { + $this->handler->destroy($this->getId()); + } + + $this->setExists(false); + + $this->setId($this->generateSessionId()); + + return true; + } + + /** + * Determine if the session has been started. + * + * @return bool + */ + public function isStarted() + { + return $this->started; + } + + /** + * Get the name of the session. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set the name of the session. + * + * @param string $name + * @return void + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Get the current session ID. + * + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Set the session ID. + * + * @param string $id + * @return void + */ + public function setId($id) + { + $this->id = $this->isValidId($id) ? $id : $this->generateSessionId(); + } + + /** + * Determine if this is a valid session ID. + * + * @param string $id + * @return bool + */ + public function isValidId($id) + { + return is_string($id) && ctype_alnum($id) && strlen($id) === 40; + } + + /** + * Get a new, random session ID. + * + * @return string + */ + protected function generateSessionId() + { + return Str::random(40); + } + + /** + * Set the existence of the session on the handler if applicable. + * + * @param bool $value + * @return void + */ + public function setExists($value) + { + if ($this->handler instanceof ExistenceAwareInterface) { + $this->handler->setExists($value); + } + } + + /** + * Get the CSRF token value. + * + * @return string + */ + public function token() + { + return $this->get('_token'); + } + + /** + * Regenerate the CSRF token value. + * + * @return void + */ + public function regenerateToken() + { + $this->put('_token', Str::random(40)); + } + + /** + * Get the previous URL from the session. + * + * @return string|null + */ + public function previousUrl() + { + return $this->get('_previous.url'); + } + + /** + * Set the "previous" URL in the session. + * + * @param string $url + * @return void + */ + public function setPreviousUrl($url) + { + $this->put('_previous.url', $url); + } + + /** + * Get the underlying session handler implementation. + * + * @return \SessionHandlerInterface + */ + public function getHandler() + { + return $this->handler; + } + + /** + * Determine if the session handler needs a request. + * + * @return bool + */ + public function handlerNeedsRequest() + { + return $this->handler instanceof CookieSessionHandler; + } + + /** + * Set the request on the handler instance. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + public function setRequestOnHandler($request) + { + if ($this->handlerNeedsRequest()) { + $this->handler->setRequest($request); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Session/TokenMismatchException.php b/vendor/laravel/framework/src/Illuminate/Session/TokenMismatchException.php new file mode 100755 index 0000000..98d99a1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Session/TokenMismatchException.php @@ -0,0 +1,10 @@ +instances = []; + + foreach ($this->providers as $provider) { + $this->instances[] = $this->app->register($provider); + } + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + $provides = []; + + foreach ($this->providers as $provider) { + $instance = $this->app->resolveProvider($provider); + + $provides = array_merge($provides, $instance->provides()); + } + + return $provides; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Arr.php b/vendor/laravel/framework/src/Illuminate/Support/Arr.php new file mode 100755 index 0000000..c7429a5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Arr.php @@ -0,0 +1,634 @@ +all(); + } elseif (! is_array($values)) { + continue; + } + + $results = array_merge($results, $values); + } + + return $results; + } + + /** + * Cross join the given arrays, returning all possible permutations. + * + * @param array ...$arrays + * @return array + */ + public static function crossJoin(...$arrays) + { + $results = [[]]; + + foreach ($arrays as $index => $array) { + $append = []; + + foreach ($results as $product) { + foreach ($array as $item) { + $product[$index] = $item; + + $append[] = $product; + } + } + + $results = $append; + } + + return $results; + } + + /** + * Divide an array into two arrays. One with keys and the other with values. + * + * @param array $array + * @return array + */ + public static function divide($array) + { + return [array_keys($array), array_values($array)]; + } + + /** + * Flatten a multi-dimensional associative array with dots. + * + * @param array $array + * @param string $prepend + * @return array + */ + public static function dot($array, $prepend = '') + { + $results = []; + + foreach ($array as $key => $value) { + if (is_array($value) && ! empty($value)) { + $results = array_merge($results, static::dot($value, $prepend.$key.'.')); + } else { + $results[$prepend.$key] = $value; + } + } + + return $results; + } + + /** + * Get all of the given array except for a specified array of keys. + * + * @param array $array + * @param array|string $keys + * @return array + */ + public static function except($array, $keys) + { + static::forget($array, $keys); + + return $array; + } + + /** + * Determine if the given key exists in the provided array. + * + * @param \ArrayAccess|array $array + * @param string|int $key + * @return bool + */ + public static function exists($array, $key) + { + if ($array instanceof ArrayAccess) { + return $array->offsetExists($key); + } + + return array_key_exists($key, $array); + } + + /** + * Return the first element in an array passing a given truth test. + * + * @param array $array + * @param callable|null $callback + * @param mixed $default + * @return mixed + */ + public static function first($array, callable $callback = null, $default = null) + { + if (is_null($callback)) { + if (empty($array)) { + return value($default); + } + + foreach ($array as $item) { + return $item; + } + } + + foreach ($array as $key => $value) { + if (call_user_func($callback, $value, $key)) { + return $value; + } + } + + return value($default); + } + + /** + * Return the last element in an array passing a given truth test. + * + * @param array $array + * @param callable|null $callback + * @param mixed $default + * @return mixed + */ + public static function last($array, callable $callback = null, $default = null) + { + if (is_null($callback)) { + return empty($array) ? value($default) : end($array); + } + + return static::first(array_reverse($array, true), $callback, $default); + } + + /** + * Flatten a multi-dimensional array into a single level. + * + * @param array $array + * @param int $depth + * @return array + */ + public static function flatten($array, $depth = INF) + { + $result = []; + + foreach ($array as $item) { + $item = $item instanceof Collection ? $item->all() : $item; + + if (! is_array($item)) { + $result[] = $item; + } elseif ($depth === 1) { + $result = array_merge($result, array_values($item)); + } else { + $result = array_merge($result, static::flatten($item, $depth - 1)); + } + } + + return $result; + } + + /** + * Remove one or many array items from a given array using "dot" notation. + * + * @param array $array + * @param array|string $keys + * @return void + */ + public static function forget(&$array, $keys) + { + $original = &$array; + + $keys = (array) $keys; + + if (count($keys) === 0) { + return; + } + + foreach ($keys as $key) { + // if the exact key exists in the top-level, remove it + if (static::exists($array, $key)) { + unset($array[$key]); + + continue; + } + + $parts = explode('.', $key); + + // clean up before each pass + $array = &$original; + + while (count($parts) > 1) { + $part = array_shift($parts); + + if (isset($array[$part]) && is_array($array[$part])) { + $array = &$array[$part]; + } else { + continue 2; + } + } + + unset($array[array_shift($parts)]); + } + } + + /** + * Get an item from an array using "dot" notation. + * + * @param \ArrayAccess|array $array + * @param string $key + * @param mixed $default + * @return mixed + */ + public static function get($array, $key, $default = null) + { + if (! static::accessible($array)) { + return value($default); + } + + if (is_null($key)) { + return $array; + } + + if (static::exists($array, $key)) { + return $array[$key]; + } + + if (strpos($key, '.') === false) { + return $array[$key] ?? value($default); + } + + foreach (explode('.', $key) as $segment) { + if (static::accessible($array) && static::exists($array, $segment)) { + $array = $array[$segment]; + } else { + return value($default); + } + } + + return $array; + } + + /** + * Check if an item or items exist in an array using "dot" notation. + * + * @param \ArrayAccess|array $array + * @param string|array $keys + * @return bool + */ + public static function has($array, $keys) + { + if (is_null($keys)) { + return false; + } + + $keys = (array) $keys; + + if (! $array) { + return false; + } + + if ($keys === []) { + return false; + } + + foreach ($keys as $key) { + $subKeyArray = $array; + + if (static::exists($array, $key)) { + continue; + } + + foreach (explode('.', $key) as $segment) { + if (static::accessible($subKeyArray) && static::exists($subKeyArray, $segment)) { + $subKeyArray = $subKeyArray[$segment]; + } else { + return false; + } + } + } + + return true; + } + + /** + * Determines if an array is associative. + * + * An array is "associative" if it doesn't have sequential numerical keys beginning with zero. + * + * @param array $array + * @return bool + */ + public static function isAssoc(array $array) + { + $keys = array_keys($array); + + return array_keys($keys) !== $keys; + } + + /** + * Get a subset of the items from the given array. + * + * @param array $array + * @param array|string $keys + * @return array + */ + public static function only($array, $keys) + { + return array_intersect_key($array, array_flip((array) $keys)); + } + + /** + * Pluck an array of values from an array. + * + * @param array $array + * @param string|array $value + * @param string|array|null $key + * @return array + */ + public static function pluck($array, $value, $key = null) + { + $results = []; + + [$value, $key] = static::explodePluckParameters($value, $key); + + foreach ($array as $item) { + $itemValue = data_get($item, $value); + + // If the key is "null", we will just append the value to the array and keep + // looping. Otherwise we will key the array using the value of the key we + // received from the developer. Then we'll return the final array form. + if (is_null($key)) { + $results[] = $itemValue; + } else { + $itemKey = data_get($item, $key); + + if (is_object($itemKey) && method_exists($itemKey, '__toString')) { + $itemKey = (string) $itemKey; + } + + $results[$itemKey] = $itemValue; + } + } + + return $results; + } + + /** + * Explode the "value" and "key" arguments passed to "pluck". + * + * @param string|array $value + * @param string|array|null $key + * @return array + */ + protected static function explodePluckParameters($value, $key) + { + $value = is_string($value) ? explode('.', $value) : $value; + + $key = is_null($key) || is_array($key) ? $key : explode('.', $key); + + return [$value, $key]; + } + + /** + * Push an item onto the beginning of an array. + * + * @param array $array + * @param mixed $value + * @param mixed $key + * @return array + */ + public static function prepend($array, $value, $key = null) + { + if (is_null($key)) { + array_unshift($array, $value); + } else { + $array = [$key => $value] + $array; + } + + return $array; + } + + /** + * Get a value from the array, and remove it. + * + * @param array $array + * @param string $key + * @param mixed $default + * @return mixed + */ + public static function pull(&$array, $key, $default = null) + { + $value = static::get($array, $key, $default); + + static::forget($array, $key); + + return $value; + } + + /** + * Get one or a specified number of random values from an array. + * + * @param array $array + * @param int|null $number + * @return mixed + * + * @throws \InvalidArgumentException + */ + public static function random($array, $number = null) + { + $requested = is_null($number) ? 1 : $number; + + $count = count($array); + + if ($requested > $count) { + throw new InvalidArgumentException( + "You requested {$requested} items, but there are only {$count} items available." + ); + } + + if (is_null($number)) { + return $array[array_rand($array)]; + } + + if ((int) $number === 0) { + return []; + } + + $keys = array_rand($array, $number); + + $results = []; + + foreach ((array) $keys as $key) { + $results[] = $array[$key]; + } + + return $results; + } + + /** + * Set an array item to a given value using "dot" notation. + * + * If no key is given to the method, the entire array will be replaced. + * + * @param array $array + * @param string $key + * @param mixed $value + * @return array + */ + public static function set(&$array, $key, $value) + { + if (is_null($key)) { + return $array = $value; + } + + $keys = explode('.', $key); + + while (count($keys) > 1) { + $key = array_shift($keys); + + // If the key doesn't exist at this depth, we will just create an empty array + // to hold the next value, allowing us to create the arrays to hold final + // values at the correct depth. Then we'll keep digging into the array. + if (! isset($array[$key]) || ! is_array($array[$key])) { + $array[$key] = []; + } + + $array = &$array[$key]; + } + + $array[array_shift($keys)] = $value; + + return $array; + } + + /** + * Shuffle the given array and return the result. + * + * @param array $array + * @param int|null $seed + * @return array + */ + public static function shuffle($array, $seed = null) + { + if (is_null($seed)) { + shuffle($array); + } else { + srand($seed); + + usort($array, function () { + return rand(-1, 1); + }); + } + + return $array; + } + + /** + * Sort the array using the given callback or "dot" notation. + * + * @param array $array + * @param callable|string|null $callback + * @return array + */ + public static function sort($array, $callback = null) + { + return Collection::make($array)->sortBy($callback)->all(); + } + + /** + * Recursively sort an array by keys and values. + * + * @param array $array + * @return array + */ + public static function sortRecursive($array) + { + foreach ($array as &$value) { + if (is_array($value)) { + $value = static::sortRecursive($value); + } + } + + if (static::isAssoc($array)) { + ksort($array); + } else { + sort($array); + } + + return $array; + } + + /** + * Convert the array into a query string. + * + * @param array $array + * @return string + */ + public static function query($array) + { + return http_build_query($array, null, '&', PHP_QUERY_RFC3986); + } + + /** + * Filter the array using the given callback. + * + * @param array $array + * @param callable $callback + * @return array + */ + public static function where($array, callable $callback) + { + return array_filter($array, $callback, ARRAY_FILTER_USE_BOTH); + } + + /** + * If the given value is not an array and not null, wrap it in one. + * + * @param mixed $value + * @return array + */ + public static function wrap($value) + { + if (is_null($value)) { + return []; + } + + return is_array($value) ? $value : [$value]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Carbon.php b/vendor/laravel/framework/src/Illuminate/Support/Carbon.php new file mode 100644 index 0000000..9383c3f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Carbon.php @@ -0,0 +1,10 @@ +items = $this->getArrayableItems($items); + } + + /** + * Create a new collection instance if the value isn't one already. + * + * @param mixed $items + * @return static + */ + public static function make($items = []) + { + return new static($items); + } + + /** + * Wrap the given value in a collection if applicable. + * + * @param mixed $value + * @return static + */ + public static function wrap($value) + { + return $value instanceof self + ? new static($value) + : new static(Arr::wrap($value)); + } + + /** + * Get the underlying items from the given collection if applicable. + * + * @param array|static $value + * @return array + */ + public static function unwrap($value) + { + return $value instanceof self ? $value->all() : $value; + } + + /** + * Create a new collection by invoking the callback a given amount of times. + * + * @param int $number + * @param callable $callback + * @return static + */ + public static function times($number, callable $callback = null) + { + if ($number < 1) { + return new static; + } + + if (is_null($callback)) { + return new static(range(1, $number)); + } + + return (new static(range(1, $number)))->map($callback); + } + + /** + * Get all of the items in the collection. + * + * @return array + */ + public function all() + { + return $this->items; + } + + /** + * Get the average value of a given key. + * + * @param callable|string|null $callback + * @return mixed + */ + public function avg($callback = null) + { + $callback = $this->valueRetriever($callback); + + $items = $this->map(function ($value) use ($callback) { + return $callback($value); + })->filter(function ($value) { + return ! is_null($value); + }); + + if ($count = $items->count()) { + return $items->sum() / $count; + } + } + + /** + * Alias for the "avg" method. + * + * @param callable|string|null $callback + * @return mixed + */ + public function average($callback = null) + { + return $this->avg($callback); + } + + /** + * Get the median of a given key. + * + * @param string|array|null $key + * @return mixed + */ + public function median($key = null) + { + $values = (isset($key) ? $this->pluck($key) : $this) + ->filter(function ($item) { + return ! is_null($item); + })->sort()->values(); + + $count = $values->count(); + + if ($count == 0) { + return; + } + + $middle = (int) ($count / 2); + + if ($count % 2) { + return $values->get($middle); + } + + return (new static([ + $values->get($middle - 1), $values->get($middle), + ]))->average(); + } + + /** + * Get the mode of a given key. + * + * @param string|array|null $key + * @return array|null + */ + public function mode($key = null) + { + if ($this->count() === 0) { + return; + } + + $collection = isset($key) ? $this->pluck($key) : $this; + + $counts = new self; + + $collection->each(function ($value) use ($counts) { + $counts[$value] = isset($counts[$value]) ? $counts[$value] + 1 : 1; + }); + + $sorted = $counts->sort(); + + $highestValue = $sorted->last(); + + return $sorted->filter(function ($value) use ($highestValue) { + return $value == $highestValue; + })->sort()->keys()->all(); + } + + /** + * Collapse the collection of items into a single array. + * + * @return static + */ + public function collapse() + { + return new static(Arr::collapse($this->items)); + } + + /** + * Alias for the "contains" method. + * + * @param mixed $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function some($key, $operator = null, $value = null) + { + return $this->contains(...func_get_args()); + } + + /** + * Determine if an item exists in the collection. + * + * @param mixed $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function contains($key, $operator = null, $value = null) + { + if (func_num_args() === 1) { + if ($this->useAsCallable($key)) { + $placeholder = new stdClass; + + return $this->first($key, $placeholder) !== $placeholder; + } + + return in_array($key, $this->items); + } + + return $this->contains($this->operatorForWhere(...func_get_args())); + } + + /** + * Determine if an item exists in the collection using strict comparison. + * + * @param mixed $key + * @param mixed $value + * @return bool + */ + public function containsStrict($key, $value = null) + { + if (func_num_args() === 2) { + return $this->contains(function ($item) use ($key, $value) { + return data_get($item, $key) === $value; + }); + } + + if ($this->useAsCallable($key)) { + return ! is_null($this->first($key)); + } + + return in_array($key, $this->items, true); + } + + /** + * Cross join with the given lists, returning all possible permutations. + * + * @param mixed ...$lists + * @return static + */ + public function crossJoin(...$lists) + { + return new static(Arr::crossJoin( + $this->items, ...array_map([$this, 'getArrayableItems'], $lists) + )); + } + + /** + * Dump the collection and end the script. + * + * @return void + */ + public function dd(...$args) + { + call_user_func_array([$this, 'dump'], $args); + + die(1); + } + + /** + * Dump the collection. + * + * @return $this + */ + public function dump() + { + (new static(func_get_args())) + ->push($this) + ->each(function ($item) { + VarDumper::dump($item); + }); + + return $this; + } + + /** + * Get the items in the collection that are not present in the given items. + * + * @param mixed $items + * @return static + */ + public function diff($items) + { + return new static(array_diff($this->items, $this->getArrayableItems($items))); + } + + /** + * Get the items in the collection that are not present in the given items. + * + * @param mixed $items + * @param callable $callback + * @return static + */ + public function diffUsing($items, callable $callback) + { + return new static(array_udiff($this->items, $this->getArrayableItems($items), $callback)); + } + + /** + * Get the items in the collection whose keys and values are not present in the given items. + * + * @param mixed $items + * @return static + */ + public function diffAssoc($items) + { + return new static(array_diff_assoc($this->items, $this->getArrayableItems($items))); + } + + /** + * Get the items in the collection whose keys and values are not present in the given items. + * + * @param mixed $items + * @param callable $callback + * @return static + */ + public function diffAssocUsing($items, callable $callback) + { + return new static(array_diff_uassoc($this->items, $this->getArrayableItems($items), $callback)); + } + + /** + * Get the items in the collection whose keys are not present in the given items. + * + * @param mixed $items + * @return static + */ + public function diffKeys($items) + { + return new static(array_diff_key($this->items, $this->getArrayableItems($items))); + } + + /** + * Get the items in the collection whose keys are not present in the given items. + * + * @param mixed $items + * @param callable $callback + * @return static + */ + public function diffKeysUsing($items, callable $callback) + { + return new static(array_diff_ukey($this->items, $this->getArrayableItems($items), $callback)); + } + + /** + * Execute a callback over each item. + * + * @param callable $callback + * @return $this + */ + public function each(callable $callback) + { + foreach ($this->items as $key => $item) { + if ($callback($item, $key) === false) { + break; + } + } + + return $this; + } + + /** + * Execute a callback over each nested chunk of items. + * + * @param callable $callback + * @return static + */ + public function eachSpread(callable $callback) + { + return $this->each(function ($chunk, $key) use ($callback) { + $chunk[] = $key; + + return $callback(...$chunk); + }); + } + + /** + * Determine if all items in the collection pass the given test. + * + * @param string|callable $key + * @param mixed $operator + * @param mixed $value + * @return bool + */ + public function every($key, $operator = null, $value = null) + { + if (func_num_args() === 1) { + $callback = $this->valueRetriever($key); + + foreach ($this->items as $k => $v) { + if (! $callback($v, $k)) { + return false; + } + } + + return true; + } + + return $this->every($this->operatorForWhere(...func_get_args())); + } + + /** + * Get all items except for those with the specified keys. + * + * @param \Illuminate\Support\Collection|mixed $keys + * @return static + */ + public function except($keys) + { + if ($keys instanceof self) { + $keys = $keys->all(); + } elseif (! is_array($keys)) { + $keys = func_get_args(); + } + + return new static(Arr::except($this->items, $keys)); + } + + /** + * Run a filter over each of the items. + * + * @param callable|null $callback + * @return static + */ + public function filter(callable $callback = null) + { + if ($callback) { + return new static(Arr::where($this->items, $callback)); + } + + return new static(array_filter($this->items)); + } + + /** + * Apply the callback if the value is truthy. + * + * @param bool $value + * @param callable $callback + * @param callable $default + * @return static|mixed + */ + public function when($value, callable $callback, callable $default = null) + { + if ($value) { + return $callback($this, $value); + } elseif ($default) { + return $default($this, $value); + } + + return $this; + } + + /** + * Apply the callback if the collection is empty. + * + * @param callable $callback + * @param callable $default + * @return static|mixed + */ + public function whenEmpty(callable $callback, callable $default = null) + { + return $this->when($this->isEmpty(), $callback, $default); + } + + /** + * Apply the callback if the collection is not empty. + * + * @param callable $callback + * @param callable $default + * @return static|mixed + */ + public function whenNotEmpty(callable $callback, callable $default = null) + { + return $this->when($this->isNotEmpty(), $callback, $default); + } + + /** + * Apply the callback if the value is falsy. + * + * @param bool $value + * @param callable $callback + * @param callable $default + * @return static|mixed + */ + public function unless($value, callable $callback, callable $default = null) + { + return $this->when(! $value, $callback, $default); + } + + /** + * Apply the callback unless the collection is empty. + * + * @param callable $callback + * @param callable $default + * @return static|mixed + */ + public function unlessEmpty(callable $callback, callable $default = null) + { + return $this->whenNotEmpty($callback, $default); + } + + /** + * Apply the callback unless the collection is not empty. + * + * @param callable $callback + * @param callable $default + * @return static|mixed + */ + public function unlessNotEmpty(callable $callback, callable $default = null) + { + return $this->whenEmpty($callback, $default); + } + + /** + * Filter items by the given key value pair. + * + * @param string $key + * @param mixed $operator + * @param mixed $value + * @return static + */ + public function where($key, $operator = null, $value = null) + { + return $this->filter($this->operatorForWhere(...func_get_args())); + } + + /** + * Get an operator checker callback. + * + * @param string $key + * @param string $operator + * @param mixed $value + * @return \Closure + */ + protected function operatorForWhere($key, $operator = null, $value = null) + { + if (func_num_args() === 1) { + $value = true; + + $operator = '='; + } + + if (func_num_args() === 2) { + $value = $operator; + + $operator = '='; + } + + return function ($item) use ($key, $operator, $value) { + $retrieved = data_get($item, $key); + + $strings = array_filter([$retrieved, $value], function ($value) { + return is_string($value) || (is_object($value) && method_exists($value, '__toString')); + }); + + if (count($strings) < 2 && count(array_filter([$retrieved, $value], 'is_object')) == 1) { + return in_array($operator, ['!=', '<>', '!==']); + } + + switch ($operator) { + default: + case '=': + case '==': return $retrieved == $value; + case '!=': + case '<>': return $retrieved != $value; + case '<': return $retrieved < $value; + case '>': return $retrieved > $value; + case '<=': return $retrieved <= $value; + case '>=': return $retrieved >= $value; + case '===': return $retrieved === $value; + case '!==': return $retrieved !== $value; + } + }; + } + + /** + * Filter items by the given key value pair using strict comparison. + * + * @param string $key + * @param mixed $value + * @return static + */ + public function whereStrict($key, $value) + { + return $this->where($key, '===', $value); + } + + /** + * Filter items by the given key value pair. + * + * @param string $key + * @param mixed $values + * @param bool $strict + * @return static + */ + public function whereIn($key, $values, $strict = false) + { + $values = $this->getArrayableItems($values); + + return $this->filter(function ($item) use ($key, $values, $strict) { + return in_array(data_get($item, $key), $values, $strict); + }); + } + + /** + * Filter items by the given key value pair using strict comparison. + * + * @param string $key + * @param mixed $values + * @return static + */ + public function whereInStrict($key, $values) + { + return $this->whereIn($key, $values, true); + } + + /** + * Filter items where the given key between values. + * + * @param string $key + * @param array $values + * @return static + */ + public function whereBetween($key, $values) + { + return $this->where($key, '>=', reset($values))->where($key, '<=', end($values)); + } + + /** + * Filter items by the given key value pair. + * + * @param string $key + * @param mixed $values + * @param bool $strict + * @return static + */ + public function whereNotIn($key, $values, $strict = false) + { + $values = $this->getArrayableItems($values); + + return $this->reject(function ($item) use ($key, $values, $strict) { + return in_array(data_get($item, $key), $values, $strict); + }); + } + + /** + * Filter items by the given key value pair using strict comparison. + * + * @param string $key + * @param mixed $values + * @return static + */ + public function whereNotInStrict($key, $values) + { + return $this->whereNotIn($key, $values, true); + } + + /** + * Filter the items, removing any items that don't match the given type. + * + * @param string $type + * @return static + */ + public function whereInstanceOf($type) + { + return $this->filter(function ($value) use ($type) { + return $value instanceof $type; + }); + } + + /** + * Get the first item from the collection. + * + * @param callable|null $callback + * @param mixed $default + * @return mixed + */ + public function first(callable $callback = null, $default = null) + { + return Arr::first($this->items, $callback, $default); + } + + /** + * Get the first item by the given key value pair. + * + * @param string $key + * @param mixed $operator + * @param mixed $value + * @return mixed + */ + public function firstWhere($key, $operator, $value = null) + { + return $this->first($this->operatorForWhere(...func_get_args())); + } + + /** + * Get a flattened array of the items in the collection. + * + * @param int $depth + * @return static + */ + public function flatten($depth = INF) + { + return new static(Arr::flatten($this->items, $depth)); + } + + /** + * Flip the items in the collection. + * + * @return static + */ + public function flip() + { + return new static(array_flip($this->items)); + } + + /** + * Remove an item from the collection by key. + * + * @param string|array $keys + * @return $this + */ + public function forget($keys) + { + foreach ((array) $keys as $key) { + $this->offsetUnset($key); + } + + return $this; + } + + /** + * Get an item from the collection by key. + * + * @param mixed $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + if ($this->offsetExists($key)) { + return $this->items[$key]; + } + + return value($default); + } + + /** + * Group an associative array by a field or using a callback. + * + * @param array|callable|string $groupBy + * @param bool $preserveKeys + * @return static + */ + public function groupBy($groupBy, $preserveKeys = false) + { + if (is_array($groupBy)) { + $nextGroups = $groupBy; + + $groupBy = array_shift($nextGroups); + } + + $groupBy = $this->valueRetriever($groupBy); + + $results = []; + + foreach ($this->items as $key => $value) { + $groupKeys = $groupBy($value, $key); + + if (! is_array($groupKeys)) { + $groupKeys = [$groupKeys]; + } + + foreach ($groupKeys as $groupKey) { + $groupKey = is_bool($groupKey) ? (int) $groupKey : $groupKey; + + if (! array_key_exists($groupKey, $results)) { + $results[$groupKey] = new static; + } + + $results[$groupKey]->offsetSet($preserveKeys ? $key : null, $value); + } + } + + $result = new static($results); + + if (! empty($nextGroups)) { + return $result->map->groupBy($nextGroups, $preserveKeys); + } + + return $result; + } + + /** + * Key an associative array by a field or using a callback. + * + * @param callable|string $keyBy + * @return static + */ + public function keyBy($keyBy) + { + $keyBy = $this->valueRetriever($keyBy); + + $results = []; + + foreach ($this->items as $key => $item) { + $resolvedKey = $keyBy($item, $key); + + if (is_object($resolvedKey)) { + $resolvedKey = (string) $resolvedKey; + } + + $results[$resolvedKey] = $item; + } + + return new static($results); + } + + /** + * Determine if an item exists in the collection by key. + * + * @param mixed $key + * @return bool + */ + public function has($key) + { + $keys = is_array($key) ? $key : func_get_args(); + + foreach ($keys as $value) { + if (! $this->offsetExists($value)) { + return false; + } + } + + return true; + } + + /** + * Concatenate values of a given key as a string. + * + * @param string $value + * @param string $glue + * @return string + */ + public function implode($value, $glue = null) + { + $first = $this->first(); + + if (is_array($first) || is_object($first)) { + return implode($glue, $this->pluck($value)->all()); + } + + return implode($value, $this->items); + } + + /** + * Intersect the collection with the given items. + * + * @param mixed $items + * @return static + */ + public function intersect($items) + { + return new static(array_intersect($this->items, $this->getArrayableItems($items))); + } + + /** + * Intersect the collection with the given items by key. + * + * @param mixed $items + * @return static + */ + public function intersectByKeys($items) + { + return new static(array_intersect_key( + $this->items, $this->getArrayableItems($items) + )); + } + + /** + * Determine if the collection is empty or not. + * + * @return bool + */ + public function isEmpty() + { + return empty($this->items); + } + + /** + * Determine if the collection is not empty. + * + * @return bool + */ + public function isNotEmpty() + { + return ! $this->isEmpty(); + } + + /** + * Determine if the given value is callable, but not a string. + * + * @param mixed $value + * @return bool + */ + protected function useAsCallable($value) + { + return ! is_string($value) && is_callable($value); + } + + /** + * Get the keys of the collection items. + * + * @return static + */ + public function keys() + { + return new static(array_keys($this->items)); + } + + /** + * Get the last item from the collection. + * + * @param callable|null $callback + * @param mixed $default + * @return mixed + */ + public function last(callable $callback = null, $default = null) + { + return Arr::last($this->items, $callback, $default); + } + + /** + * Get the values of a given key. + * + * @param string|array $value + * @param string|null $key + * @return static + */ + public function pluck($value, $key = null) + { + return new static(Arr::pluck($this->items, $value, $key)); + } + + /** + * Run a map over each of the items. + * + * @param callable $callback + * @return static + */ + public function map(callable $callback) + { + $keys = array_keys($this->items); + + $items = array_map($callback, $this->items, $keys); + + return new static(array_combine($keys, $items)); + } + + /** + * Run a map over each nested chunk of items. + * + * @param callable $callback + * @return static + */ + public function mapSpread(callable $callback) + { + return $this->map(function ($chunk, $key) use ($callback) { + $chunk[] = $key; + + return $callback(...$chunk); + }); + } + + /** + * Run a dictionary map over the items. + * + * The callback should return an associative array with a single key/value pair. + * + * @param callable $callback + * @return static + */ + public function mapToDictionary(callable $callback) + { + $dictionary = []; + + foreach ($this->items as $key => $item) { + $pair = $callback($item, $key); + + $key = key($pair); + + $value = reset($pair); + + if (! isset($dictionary[$key])) { + $dictionary[$key] = []; + } + + $dictionary[$key][] = $value; + } + + return new static($dictionary); + } + + /** + * Run a grouping map over the items. + * + * The callback should return an associative array with a single key/value pair. + * + * @param callable $callback + * @return static + */ + public function mapToGroups(callable $callback) + { + $groups = $this->mapToDictionary($callback); + + return $groups->map([$this, 'make']); + } + + /** + * Run an associative map over each of the items. + * + * The callback should return an associative array with a single key/value pair. + * + * @param callable $callback + * @return static + */ + public function mapWithKeys(callable $callback) + { + $result = []; + + foreach ($this->items as $key => $value) { + $assoc = $callback($value, $key); + + foreach ($assoc as $mapKey => $mapValue) { + $result[$mapKey] = $mapValue; + } + } + + return new static($result); + } + + /** + * Map a collection and flatten the result by a single level. + * + * @param callable $callback + * @return static + */ + public function flatMap(callable $callback) + { + return $this->map($callback)->collapse(); + } + + /** + * Map the values into a new class. + * + * @param string $class + * @return static + */ + public function mapInto($class) + { + return $this->map(function ($value, $key) use ($class) { + return new $class($value, $key); + }); + } + + /** + * Get the max value of a given key. + * + * @param callable|string|null $callback + * @return mixed + */ + public function max($callback = null) + { + $callback = $this->valueRetriever($callback); + + return $this->filter(function ($value) { + return ! is_null($value); + })->reduce(function ($result, $item) use ($callback) { + $value = $callback($item); + + return is_null($result) || $value > $result ? $value : $result; + }); + } + + /** + * Merge the collection with the given items. + * + * @param mixed $items + * @return static + */ + public function merge($items) + { + return new static(array_merge($this->items, $this->getArrayableItems($items))); + } + + /** + * Create a collection by using this collection for keys and another for its values. + * + * @param mixed $values + * @return static + */ + public function combine($values) + { + return new static(array_combine($this->all(), $this->getArrayableItems($values))); + } + + /** + * Union the collection with the given items. + * + * @param mixed $items + * @return static + */ + public function union($items) + { + return new static($this->items + $this->getArrayableItems($items)); + } + + /** + * Get the min value of a given key. + * + * @param callable|string|null $callback + * @return mixed + */ + public function min($callback = null) + { + $callback = $this->valueRetriever($callback); + + return $this->map(function ($value) use ($callback) { + return $callback($value); + })->filter(function ($value) { + return ! is_null($value); + })->reduce(function ($result, $value) { + return is_null($result) || $value < $result ? $value : $result; + }); + } + + /** + * Create a new collection consisting of every n-th element. + * + * @param int $step + * @param int $offset + * @return static + */ + public function nth($step, $offset = 0) + { + $new = []; + + $position = 0; + + foreach ($this->items as $item) { + if ($position % $step === $offset) { + $new[] = $item; + } + + $position++; + } + + return new static($new); + } + + /** + * Get the items with the specified keys. + * + * @param mixed $keys + * @return static + */ + public function only($keys) + { + if (is_null($keys)) { + return new static($this->items); + } + + if ($keys instanceof self) { + $keys = $keys->all(); + } + + $keys = is_array($keys) ? $keys : func_get_args(); + + return new static(Arr::only($this->items, $keys)); + } + + /** + * "Paginate" the collection by slicing it into a smaller collection. + * + * @param int $page + * @param int $perPage + * @return static + */ + public function forPage($page, $perPage) + { + $offset = max(0, ($page - 1) * $perPage); + + return $this->slice($offset, $perPage); + } + + /** + * Partition the collection into two arrays using the given callback or key. + * + * @param callable|string $key + * @param mixed $operator + * @param mixed $value + * @return static + */ + public function partition($key, $operator = null, $value = null) + { + $partitions = [new static, new static]; + + $callback = func_num_args() === 1 + ? $this->valueRetriever($key) + : $this->operatorForWhere(...func_get_args()); + + foreach ($this->items as $key => $item) { + $partitions[(int) ! $callback($item, $key)][$key] = $item; + } + + return new static($partitions); + } + + /** + * Pass the collection to the given callback and return the result. + * + * @param callable $callback + * @return mixed + */ + public function pipe(callable $callback) + { + return $callback($this); + } + + /** + * Get and remove the last item from the collection. + * + * @return mixed + */ + public function pop() + { + return array_pop($this->items); + } + + /** + * Push an item onto the beginning of the collection. + * + * @param mixed $value + * @param mixed $key + * @return $this + */ + public function prepend($value, $key = null) + { + $this->items = Arr::prepend($this->items, $value, $key); + + return $this; + } + + /** + * Push an item onto the end of the collection. + * + * @param mixed $value + * @return $this + */ + public function push($value) + { + $this->offsetSet(null, $value); + + return $this; + } + + /** + * Push all of the given items onto the collection. + * + * @param \Traversable|array $source + * @return static + */ + public function concat($source) + { + $result = new static($this); + + foreach ($source as $item) { + $result->push($item); + } + + return $result; + } + + /** + * Get and remove an item from the collection. + * + * @param mixed $key + * @param mixed $default + * @return mixed + */ + public function pull($key, $default = null) + { + return Arr::pull($this->items, $key, $default); + } + + /** + * Put an item in the collection by key. + * + * @param mixed $key + * @param mixed $value + * @return $this + */ + public function put($key, $value) + { + $this->offsetSet($key, $value); + + return $this; + } + + /** + * Get one or a specified number of items randomly from the collection. + * + * @param int|null $number + * @return static|mixed + * + * @throws \InvalidArgumentException + */ + public function random($number = null) + { + if (is_null($number)) { + return Arr::random($this->items); + } + + return new static(Arr::random($this->items, $number)); + } + + /** + * Reduce the collection to a single value. + * + * @param callable $callback + * @param mixed $initial + * @return mixed + */ + public function reduce(callable $callback, $initial = null) + { + return array_reduce($this->items, $callback, $initial); + } + + /** + * Create a collection of all elements that do not pass a given truth test. + * + * @param callable|mixed $callback + * @return static + */ + public function reject($callback) + { + if ($this->useAsCallable($callback)) { + return $this->filter(function ($value, $key) use ($callback) { + return ! $callback($value, $key); + }); + } + + return $this->filter(function ($item) use ($callback) { + return $item != $callback; + }); + } + + /** + * Reverse items order. + * + * @return static + */ + public function reverse() + { + return new static(array_reverse($this->items, true)); + } + + /** + * Search the collection for a given value and return the corresponding key if successful. + * + * @param mixed $value + * @param bool $strict + * @return mixed + */ + public function search($value, $strict = false) + { + if (! $this->useAsCallable($value)) { + return array_search($value, $this->items, $strict); + } + + foreach ($this->items as $key => $item) { + if (call_user_func($value, $item, $key)) { + return $key; + } + } + + return false; + } + + /** + * Get and remove the first item from the collection. + * + * @return mixed + */ + public function shift() + { + return array_shift($this->items); + } + + /** + * Shuffle the items in the collection. + * + * @param int $seed + * @return static + */ + public function shuffle($seed = null) + { + return new static(Arr::shuffle($this->items, $seed)); + } + + /** + * Slice the underlying collection array. + * + * @param int $offset + * @param int $length + * @return static + */ + public function slice($offset, $length = null) + { + return new static(array_slice($this->items, $offset, $length, true)); + } + + /** + * Split a collection into a certain number of groups. + * + * @param int $numberOfGroups + * @return static + */ + public function split($numberOfGroups) + { + if ($this->isEmpty()) { + return new static; + } + + $groups = new static; + + $groupSize = floor($this->count() / $numberOfGroups); + + $remain = $this->count() % $numberOfGroups; + + $start = 0; + + for ($i = 0; $i < $numberOfGroups; $i++) { + $size = $groupSize; + + if ($i < $remain) { + $size++; + } + + if ($size) { + $groups->push(new static(array_slice($this->items, $start, $size))); + + $start += $size; + } + } + + return $groups; + } + + /** + * Chunk the underlying collection array. + * + * @param int $size + * @return static + */ + public function chunk($size) + { + if ($size <= 0) { + return new static; + } + + $chunks = []; + + foreach (array_chunk($this->items, $size, true) as $chunk) { + $chunks[] = new static($chunk); + } + + return new static($chunks); + } + + /** + * Sort through each item with a callback. + * + * @param callable|null $callback + * @return static + */ + public function sort(callable $callback = null) + { + $items = $this->items; + + $callback + ? uasort($items, $callback) + : asort($items); + + return new static($items); + } + + /** + * Sort the collection using the given callback. + * + * @param callable|string $callback + * @param int $options + * @param bool $descending + * @return static + */ + public function sortBy($callback, $options = SORT_REGULAR, $descending = false) + { + $results = []; + + $callback = $this->valueRetriever($callback); + + // First we will loop through the items and get the comparator from a callback + // function which we were given. Then, we will sort the returned values and + // and grab the corresponding values for the sorted keys from this array. + foreach ($this->items as $key => $value) { + $results[$key] = $callback($value, $key); + } + + $descending ? arsort($results, $options) + : asort($results, $options); + + // Once we have sorted all of the keys in the array, we will loop through them + // and grab the corresponding model so we can set the underlying items list + // to the sorted version. Then we'll just return the collection instance. + foreach (array_keys($results) as $key) { + $results[$key] = $this->items[$key]; + } + + return new static($results); + } + + /** + * Sort the collection in descending order using the given callback. + * + * @param callable|string $callback + * @param int $options + * @return static + */ + public function sortByDesc($callback, $options = SORT_REGULAR) + { + return $this->sortBy($callback, $options, true); + } + + /** + * Sort the collection keys. + * + * @param int $options + * @param bool $descending + * @return static + */ + public function sortKeys($options = SORT_REGULAR, $descending = false) + { + $items = $this->items; + + $descending ? krsort($items, $options) : ksort($items, $options); + + return new static($items); + } + + /** + * Sort the collection keys in descending order. + * + * @param int $options + * @return static + */ + public function sortKeysDesc($options = SORT_REGULAR) + { + return $this->sortKeys($options, true); + } + + /** + * Splice a portion of the underlying collection array. + * + * @param int $offset + * @param int|null $length + * @param mixed $replacement + * @return static + */ + public function splice($offset, $length = null, $replacement = []) + { + if (func_num_args() === 1) { + return new static(array_splice($this->items, $offset)); + } + + return new static(array_splice($this->items, $offset, $length, $replacement)); + } + + /** + * Get the sum of the given values. + * + * @param callable|string|null $callback + * @return mixed + */ + public function sum($callback = null) + { + if (is_null($callback)) { + return array_sum($this->items); + } + + $callback = $this->valueRetriever($callback); + + return $this->reduce(function ($result, $item) use ($callback) { + return $result + $callback($item); + }, 0); + } + + /** + * Take the first or last {$limit} items. + * + * @param int $limit + * @return static + */ + public function take($limit) + { + if ($limit < 0) { + return $this->slice($limit, abs($limit)); + } + + return $this->slice(0, $limit); + } + + /** + * Pass the collection to the given callback and then return it. + * + * @param callable $callback + * @return $this + */ + public function tap(callable $callback) + { + $callback(new static($this->items)); + + return $this; + } + + /** + * Transform each item in the collection using a callback. + * + * @param callable $callback + * @return $this + */ + public function transform(callable $callback) + { + $this->items = $this->map($callback)->all(); + + return $this; + } + + /** + * Return only unique items from the collection array. + * + * @param string|callable|null $key + * @param bool $strict + * @return static + */ + public function unique($key = null, $strict = false) + { + $callback = $this->valueRetriever($key); + + $exists = []; + + return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) { + if (in_array($id = $callback($item, $key), $exists, $strict)) { + return true; + } + + $exists[] = $id; + }); + } + + /** + * Return only unique items from the collection array using strict comparison. + * + * @param string|callable|null $key + * @return static + */ + public function uniqueStrict($key = null) + { + return $this->unique($key, true); + } + + /** + * Reset the keys on the underlying array. + * + * @return static + */ + public function values() + { + return new static(array_values($this->items)); + } + + /** + * Get a value retrieving callback. + * + * @param string $value + * @return callable + */ + protected function valueRetriever($value) + { + if ($this->useAsCallable($value)) { + return $value; + } + + return function ($item) use ($value) { + return data_get($item, $value); + }; + } + + /** + * Zip the collection together with one or more arrays. + * + * e.g. new Collection([1, 2, 3])->zip([4, 5, 6]); + * => [[1, 4], [2, 5], [3, 6]] + * + * @param mixed ...$items + * @return static + */ + public function zip($items) + { + $arrayableItems = array_map(function ($items) { + return $this->getArrayableItems($items); + }, func_get_args()); + + $params = array_merge([function () { + return new static(func_get_args()); + }, $this->items], $arrayableItems); + + return new static(call_user_func_array('array_map', $params)); + } + + /** + * Pad collection to the specified length with a value. + * + * @param int $size + * @param mixed $value + * @return static + */ + public function pad($size, $value) + { + return new static(array_pad($this->items, $size, $value)); + } + + /** + * Get the collection of items as a plain array. + * + * @return array + */ + public function toArray() + { + return array_map(function ($value) { + return $value instanceof Arrayable ? $value->toArray() : $value; + }, $this->items); + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return array_map(function ($value) { + if ($value instanceof JsonSerializable) { + return $value->jsonSerialize(); + } elseif ($value instanceof Jsonable) { + return json_decode($value->toJson(), true); + } elseif ($value instanceof Arrayable) { + return $value->toArray(); + } + + return $value; + }, $this->items); + } + + /** + * Get the collection of items as JSON. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->jsonSerialize(), $options); + } + + /** + * Get an iterator for the items. + * + * @return \ArrayIterator + */ + public function getIterator() + { + return new ArrayIterator($this->items); + } + + /** + * Get a CachingIterator instance. + * + * @param int $flags + * @return \CachingIterator + */ + public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING) + { + return new CachingIterator($this->getIterator(), $flags); + } + + /** + * Count the number of items in the collection. + * + * @return int + */ + public function count() + { + return count($this->items); + } + + /** + * Get a base Support collection instance from this collection. + * + * @return \Illuminate\Support\Collection + */ + public function toBase() + { + return new self($this); + } + + /** + * Determine if an item exists at an offset. + * + * @param mixed $key + * @return bool + */ + public function offsetExists($key) + { + return array_key_exists($key, $this->items); + } + + /** + * Get an item at a given offset. + * + * @param mixed $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->items[$key]; + } + + /** + * Set the item at a given offset. + * + * @param mixed $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + if (is_null($key)) { + $this->items[] = $value; + } else { + $this->items[$key] = $value; + } + } + + /** + * Unset the item at a given offset. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + unset($this->items[$key]); + } + + /** + * Convert the collection to its string representation. + * + * @return string + */ + public function __toString() + { + return $this->toJson(); + } + + /** + * Results array of items from Collection or Arrayable. + * + * @param mixed $items + * @return array + */ + protected function getArrayableItems($items) + { + if (is_array($items)) { + return $items; + } elseif ($items instanceof self) { + return $items->all(); + } elseif ($items instanceof Arrayable) { + return $items->toArray(); + } elseif ($items instanceof Jsonable) { + return json_decode($items->toJson(), true); + } elseif ($items instanceof JsonSerializable) { + return $items->jsonSerialize(); + } elseif ($items instanceof Traversable) { + return iterator_to_array($items); + } + + return (array) $items; + } + + /** + * Add a method to the list of proxied methods. + * + * @param string $method + * @return void + */ + public static function proxy($method) + { + static::$proxies[] = $method; + } + + /** + * Dynamically access collection proxies. + * + * @param string $key + * @return mixed + * + * @throws \Exception + */ + public function __get($key) + { + if (! in_array($key, static::$proxies)) { + throw new Exception("Property [{$key}] does not exist on this collection instance."); + } + + return new HigherOrderCollectionProxy($this, $key); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Composer.php b/vendor/laravel/framework/src/Illuminate/Support/Composer.php new file mode 100644 index 0000000..bc76aeb --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Composer.php @@ -0,0 +1,99 @@ +files = $files; + $this->workingPath = $workingPath; + } + + /** + * Regenerate the Composer autoloader files. + * + * @param string $extra + * @return void + */ + public function dumpAutoloads($extra = '') + { + $process = $this->getProcess(); + + $process->setCommandLine(trim($this->findComposer().' dump-autoload '.$extra)); + + $process->run(); + } + + /** + * Regenerate the optimized Composer autoloader files. + * + * @return void + */ + public function dumpOptimized() + { + $this->dumpAutoloads('--optimize'); + } + + /** + * Get the composer command for the environment. + * + * @return string + */ + protected function findComposer() + { + if ($this->files->exists($this->workingPath.'/composer.phar')) { + return ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)).' composer.phar'; + } + + return 'composer'; + } + + /** + * Get a new Symfony process instance. + * + * @return \Symfony\Component\Process\Process + */ + protected function getProcess() + { + return (new Process('', $this->workingPath))->setTimeout(null); + } + + /** + * Set the working path used by the class. + * + * @param string $path + * @return $this + */ + public function setWorkingPath($path) + { + $this->workingPath = realpath($path); + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/App.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/App.php new file mode 100755 index 0000000..0e9e637 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/App.php @@ -0,0 +1,31 @@ +make('router')->auth($options); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/Blade.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/Blade.php new file mode 100755 index 0000000..241f6c6 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/Blade.php @@ -0,0 +1,36 @@ +getEngineResolver()->resolve('blade')->getCompiler(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/Broadcast.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/Broadcast.php new file mode 100644 index 0000000..304aba9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/Broadcast.php @@ -0,0 +1,25 @@ +cookie($key, null)); + } + + /** + * Retrieve a cookie from the request. + * + * @param string $key + * @param mixed $default + * @return string|array|null + */ + public static function get($key = null, $default = null) + { + return static::$app['request']->cookie($key, $default); + } + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() + { + return 'cookie'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/Crypt.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/Crypt.php new file mode 100755 index 0000000..84317c3 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/Crypt.php @@ -0,0 +1,22 @@ +afterResolving(static::getFacadeAccessor(), function ($service) use ($callback) { + $callback($service); + }); + } + + /** + * Convert the facade into a Mockery spy. + * + * @return \Mockery\MockInterface + */ + public static function spy() + { + if (! static::isMock()) { + $class = static::getMockableClass(); + + return tap($class ? Mockery::spy($class) : Mockery::spy(), function ($spy) { + static::swap($spy); + }); + } + } + + /** + * Initiate a mock expectation on the facade. + * + * @return \Mockery\Expectation + */ + public static function shouldReceive() + { + $name = static::getFacadeAccessor(); + + $mock = static::isMock() + ? static::$resolvedInstance[$name] + : static::createFreshMockInstance(); + + return $mock->shouldReceive(...func_get_args()); + } + + /** + * Create a fresh mock instance for the given class. + * + * @return \Mockery\Expectation + */ + protected static function createFreshMockInstance() + { + return tap(static::createMock(), function ($mock) { + static::swap($mock); + + $mock->shouldAllowMockingProtectedMethods(); + }); + } + + /** + * Create a fresh mock instance for the given class. + * + * @return \Mockery\MockInterface + */ + protected static function createMock() + { + $class = static::getMockableClass(); + + return $class ? Mockery::mock($class) : Mockery::mock(); + } + + /** + * Determines whether a mock is set as the instance of the facade. + * + * @return bool + */ + protected static function isMock() + { + $name = static::getFacadeAccessor(); + + return isset(static::$resolvedInstance[$name]) && + static::$resolvedInstance[$name] instanceof MockInterface; + } + + /** + * Get the mockable class for the bound instance. + * + * @return string|null + */ + protected static function getMockableClass() + { + if ($root = static::getFacadeRoot()) { + return get_class($root); + } + } + + /** + * Hotswap the underlying instance behind the facade. + * + * @param mixed $instance + * @return void + */ + public static function swap($instance) + { + static::$resolvedInstance[static::getFacadeAccessor()] = $instance; + + if (isset(static::$app)) { + static::$app->instance(static::getFacadeAccessor(), $instance); + } + } + + /** + * Get the root object behind the facade. + * + * @return mixed + */ + public static function getFacadeRoot() + { + return static::resolveFacadeInstance(static::getFacadeAccessor()); + } + + /** + * Get the registered name of the component. + * + * @return string + * + * @throws \RuntimeException + */ + protected static function getFacadeAccessor() + { + throw new RuntimeException('Facade does not implement getFacadeAccessor method.'); + } + + /** + * Resolve the facade root instance from the container. + * + * @param string|object $name + * @return mixed + */ + protected static function resolveFacadeInstance($name) + { + if (is_object($name)) { + return $name; + } + + if (isset(static::$resolvedInstance[$name])) { + return static::$resolvedInstance[$name]; + } + + return static::$resolvedInstance[$name] = static::$app[$name]; + } + + /** + * Clear a resolved facade instance. + * + * @param string $name + * @return void + */ + public static function clearResolvedInstance($name) + { + unset(static::$resolvedInstance[$name]); + } + + /** + * Clear all of the resolved instances. + * + * @return void + */ + public static function clearResolvedInstances() + { + static::$resolvedInstance = []; + } + + /** + * Get the application instance behind the facade. + * + * @return \Illuminate\Contracts\Foundation\Application + */ + public static function getFacadeApplication() + { + return static::$app; + } + + /** + * Set the application instance. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @return void + */ + public static function setFacadeApplication($app) + { + static::$app = $app; + } + + /** + * Handle dynamic, static calls to the object. + * + * @param string $method + * @param array $args + * @return mixed + * + * @throws \RuntimeException + */ + public static function __callStatic($method, $args) + { + $instance = static::getFacadeRoot(); + + if (! $instance) { + throw new RuntimeException('A facade root has not been set.'); + } + + return $instance->$method(...$args); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/File.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/File.php new file mode 100755 index 0000000..ff0290d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/File.php @@ -0,0 +1,55 @@ +input($key, $default); + } + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() + { + return 'request'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/Lang.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/Lang.php new file mode 100755 index 0000000..5d53305 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/Lang.php @@ -0,0 +1,25 @@ +route($channel, $route); + } + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() + { + return ChannelManager::class; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/Password.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/Password.php new file mode 100755 index 0000000..c291b97 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/Password.php @@ -0,0 +1,59 @@ +connection($name)->getSchemaBuilder(); + } + + /** + * Get a schema builder instance for the default connection. + * + * @return \Illuminate\Database\Schema\Builder + */ + protected static function getFacadeAccessor() + { + return static::$app['db']->connection()->getSchemaBuilder(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/Session.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/Session.php new file mode 100755 index 0000000..4df35ce --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/Session.php @@ -0,0 +1,43 @@ +get('filesystems.default'); + + (new Filesystem)->cleanDirectory( + $root = storage_path('framework/testing/disks/'.$disk) + ); + + static::set($disk, self::createLocalDriver(['root' => $root])); + } + + /** + * Replace the given disk with a persistent local testing disk. + * + * @param string|null $disk + * @return void + */ + public static function persistentFake($disk = null) + { + $disk = $disk ?: self::$app['config']->get('filesystems.default'); + + static::set($disk, self::createLocalDriver([ + 'root' => storage_path('framework/testing/disks/'.$disk), + ])); + } + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() + { + return 'filesystem'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Facades/URL.php b/vendor/laravel/framework/src/Illuminate/Support/Facades/URL.php new file mode 100755 index 0000000..6915928 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Facades/URL.php @@ -0,0 +1,33 @@ + $value) { + $this->attributes[$key] = $value; + } + } + + /** + * Get an attribute from the fluent instance. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + if (array_key_exists($key, $this->attributes)) { + return $this->attributes[$key]; + } + + return value($default); + } + + /** + * Get the attributes from the fluent instance. + * + * @return array + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Convert the fluent instance to an array. + * + * @return array + */ + public function toArray() + { + return $this->attributes; + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Convert the fluent instance to JSON. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->jsonSerialize(), $options); + } + + /** + * Determine if the given offset exists. + * + * @param string $offset + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->attributes[$offset]); + } + + /** + * Get the value for a given offset. + * + * @param string $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->get($offset); + } + + /** + * Set the value at the given offset. + * + * @param string $offset + * @param mixed $value + * @return void + */ + public function offsetSet($offset, $value) + { + $this->attributes[$offset] = $value; + } + + /** + * Unset the value at the given offset. + * + * @param string $offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->attributes[$offset]); + } + + /** + * Handle dynamic calls to the fluent instance to set attributes. + * + * @param string $method + * @param array $parameters + * @return $this + */ + public function __call($method, $parameters) + { + $this->attributes[$method] = count($parameters) > 0 ? $parameters[0] : true; + + return $this; + } + + /** + * Dynamically retrieve the value of an attribute. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->get($key); + } + + /** + * Dynamically set the value of an attribute. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this->offsetSet($key, $value); + } + + /** + * Dynamically check if an attribute is set. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return $this->offsetExists($key); + } + + /** + * Dynamically unset an attribute. + * + * @param string $key + * @return void + */ + public function __unset($key) + { + $this->offsetUnset($key); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php b/vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php new file mode 100644 index 0000000..7a781a0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php @@ -0,0 +1,63 @@ +method = $method; + $this->collection = $collection; + } + + /** + * Proxy accessing an attribute onto the collection items. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + return $this->collection->{$this->method}(function ($value) use ($key) { + return is_array($value) ? $value[$key] : $value->{$key}; + }); + } + + /** + * Proxy a method call onto the collection items. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->collection->{$this->method}(function ($value) use ($method, $parameters) { + return $value->{$method}(...$parameters); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/HigherOrderTapProxy.php b/vendor/laravel/framework/src/Illuminate/Support/HigherOrderTapProxy.php new file mode 100644 index 0000000..bbf9b2e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/HigherOrderTapProxy.php @@ -0,0 +1,38 @@ +target = $target; + } + + /** + * Dynamically pass method calls to the target. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + $this->target->{$method}(...$parameters); + + return $this->target; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/HtmlString.php b/vendor/laravel/framework/src/Illuminate/Support/HtmlString.php new file mode 100644 index 0000000..c13adfd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/HtmlString.php @@ -0,0 +1,46 @@ +html = $html; + } + + /** + * Get the HTML string. + * + * @return string + */ + public function toHtml() + { + return $this->html; + } + + /** + * Get the HTML string. + * + * @return string + */ + public function __toString() + { + return $this->toHtml(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/InteractsWithTime.php b/vendor/laravel/framework/src/Illuminate/Support/InteractsWithTime.php new file mode 100644 index 0000000..19ed3f2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/InteractsWithTime.php @@ -0,0 +1,64 @@ +parseDateInterval($delay); + + return $delay instanceof DateTimeInterface + ? max(0, $delay->getTimestamp() - $this->currentTime()) + : (int) $delay; + } + + /** + * Get the "available at" UNIX timestamp. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @return int + */ + protected function availableAt($delay = 0) + { + $delay = $this->parseDateInterval($delay); + + return $delay instanceof DateTimeInterface + ? $delay->getTimestamp() + : Carbon::now()->addSeconds($delay)->getTimestamp(); + } + + /** + * If the given value is an interval, convert it to a DateTime instance. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @return \DateTimeInterface|int + */ + protected function parseDateInterval($delay) + { + if ($delay instanceof DateInterval) { + $delay = Carbon::now()->add($delay); + } + + return $delay; + } + + /** + * Get the current system time as a UNIX timestamp. + * + * @return int + */ + protected function currentTime() + { + return Carbon::now()->getTimestamp(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Manager.php b/vendor/laravel/framework/src/Illuminate/Support/Manager.php new file mode 100755 index 0000000..f759f0a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Manager.php @@ -0,0 +1,148 @@ +app = $app; + } + + /** + * Get the default driver name. + * + * @return string + */ + abstract public function getDefaultDriver(); + + /** + * Get a driver instance. + * + * @param string $driver + * @return mixed + * + * @throws \InvalidArgumentException + */ + public function driver($driver = null) + { + $driver = $driver ?: $this->getDefaultDriver(); + + if (is_null($driver)) { + throw new InvalidArgumentException(sprintf( + 'Unable to resolve NULL driver for [%s].', static::class + )); + } + + // If the given driver has not been created before, we will create the instances + // here and cache it so we can return it next time very quickly. If there is + // already a driver created by this name, we'll just return that instance. + if (! isset($this->drivers[$driver])) { + $this->drivers[$driver] = $this->createDriver($driver); + } + + return $this->drivers[$driver]; + } + + /** + * Create a new driver instance. + * + * @param string $driver + * @return mixed + * + * @throws \InvalidArgumentException + */ + protected function createDriver($driver) + { + // First, we will determine if a custom driver creator exists for the given driver and + // if it does not we will check for a creator method for the driver. Custom creator + // callbacks allow developers to build their own "drivers" easily using Closures. + if (isset($this->customCreators[$driver])) { + return $this->callCustomCreator($driver); + } else { + $method = 'create'.Str::studly($driver).'Driver'; + + if (method_exists($this, $method)) { + return $this->$method(); + } + } + throw new InvalidArgumentException("Driver [$driver] not supported."); + } + + /** + * Call a custom driver creator. + * + * @param string $driver + * @return mixed + */ + protected function callCustomCreator($driver) + { + return $this->customCreators[$driver]($this->app); + } + + /** + * Register a custom driver creator Closure. + * + * @param string $driver + * @param \Closure $callback + * @return $this + */ + public function extend($driver, Closure $callback) + { + $this->customCreators[$driver] = $callback; + + return $this; + } + + /** + * Get all of the created "drivers". + * + * @return array + */ + public function getDrivers() + { + return $this->drivers; + } + + /** + * Dynamically call the default driver instance. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->driver()->$method(...$parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/MessageBag.php b/vendor/laravel/framework/src/Illuminate/Support/MessageBag.php new file mode 100755 index 0000000..72fe683 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/MessageBag.php @@ -0,0 +1,396 @@ + $value) { + $value = $value instanceof Arrayable ? $value->toArray() : (array) $value; + + $this->messages[$key] = array_unique($value); + } + } + + /** + * Get the keys present in the message bag. + * + * @return array + */ + public function keys() + { + return array_keys($this->messages); + } + + /** + * Add a message to the message bag. + * + * @param string $key + * @param string $message + * @return $this + */ + public function add($key, $message) + { + if ($this->isUnique($key, $message)) { + $this->messages[$key][] = $message; + } + + return $this; + } + + /** + * Determine if a key and message combination already exists. + * + * @param string $key + * @param string $message + * @return bool + */ + protected function isUnique($key, $message) + { + $messages = (array) $this->messages; + + return ! isset($messages[$key]) || ! in_array($message, $messages[$key]); + } + + /** + * Merge a new array of messages into the message bag. + * + * @param \Illuminate\Contracts\Support\MessageProvider|array $messages + * @return $this + */ + public function merge($messages) + { + if ($messages instanceof MessageProvider) { + $messages = $messages->getMessageBag()->getMessages(); + } + + $this->messages = array_merge_recursive($this->messages, $messages); + + return $this; + } + + /** + * Determine if messages exist for all of the given keys. + * + * @param array|string $key + * @return bool + */ + public function has($key) + { + if (is_null($key)) { + return $this->any(); + } + + $keys = is_array($key) ? $key : func_get_args(); + + foreach ($keys as $key) { + if ($this->first($key) === '') { + return false; + } + } + + return true; + } + + /** + * Determine if messages exist for any of the given keys. + * + * @param array|string $keys + * @return bool + */ + public function hasAny($keys = []) + { + $keys = is_array($keys) ? $keys : func_get_args(); + + foreach ($keys as $key) { + if ($this->has($key)) { + return true; + } + } + + return false; + } + + /** + * Get the first message from the message bag for a given key. + * + * @param string $key + * @param string $format + * @return string + */ + public function first($key = null, $format = null) + { + $messages = is_null($key) ? $this->all($format) : $this->get($key, $format); + + $firstMessage = Arr::first($messages, null, ''); + + return is_array($firstMessage) ? Arr::first($firstMessage) : $firstMessage; + } + + /** + * Get all of the messages from the message bag for a given key. + * + * @param string $key + * @param string $format + * @return array + */ + public function get($key, $format = null) + { + // If the message exists in the message bag, we will transform it and return + // the message. Otherwise, we will check if the key is implicit & collect + // all the messages that match the given key and output it as an array. + if (array_key_exists($key, $this->messages)) { + return $this->transform( + $this->messages[$key], $this->checkFormat($format), $key + ); + } + + if (Str::contains($key, '*')) { + return $this->getMessagesForWildcardKey($key, $format); + } + + return []; + } + + /** + * Get the messages for a wildcard key. + * + * @param string $key + * @param string|null $format + * @return array + */ + protected function getMessagesForWildcardKey($key, $format) + { + return collect($this->messages) + ->filter(function ($messages, $messageKey) use ($key) { + return Str::is($key, $messageKey); + }) + ->map(function ($messages, $messageKey) use ($format) { + return $this->transform( + $messages, $this->checkFormat($format), $messageKey + ); + })->all(); + } + + /** + * Get all of the messages for every key in the message bag. + * + * @param string $format + * @return array + */ + public function all($format = null) + { + $format = $this->checkFormat($format); + + $all = []; + + foreach ($this->messages as $key => $messages) { + $all = array_merge($all, $this->transform($messages, $format, $key)); + } + + return $all; + } + + /** + * Get all of the unique messages for every key in the message bag. + * + * @param string $format + * @return array + */ + public function unique($format = null) + { + return array_unique($this->all($format)); + } + + /** + * Format an array of messages. + * + * @param array $messages + * @param string $format + * @param string $messageKey + * @return array + */ + protected function transform($messages, $format, $messageKey) + { + return collect((array) $messages) + ->map(function ($message) use ($format, $messageKey) { + // We will simply spin through the given messages and transform each one + // replacing the :message place holder with the real message allowing + // the messages to be easily formatted to each developer's desires. + return str_replace([':message', ':key'], [$message, $messageKey], $format); + })->all(); + } + + /** + * Get the appropriate format based on the given format. + * + * @param string $format + * @return string + */ + protected function checkFormat($format) + { + return $format ?: $this->format; + } + + /** + * Get the raw messages in the message bag. + * + * @return array + */ + public function messages() + { + return $this->messages; + } + + /** + * Get the raw messages in the message bag. + * + * @return array + */ + public function getMessages() + { + return $this->messages(); + } + + /** + * Get the messages for the instance. + * + * @return \Illuminate\Support\MessageBag + */ + public function getMessageBag() + { + return $this; + } + + /** + * Get the default message format. + * + * @return string + */ + public function getFormat() + { + return $this->format; + } + + /** + * Set the default message format. + * + * @param string $format + * @return \Illuminate\Support\MessageBag + */ + public function setFormat($format = ':message') + { + $this->format = $format; + + return $this; + } + + /** + * Determine if the message bag has any messages. + * + * @return bool + */ + public function isEmpty() + { + return ! $this->any(); + } + + /** + * Determine if the message bag has any messages. + * + * @return bool + */ + public function isNotEmpty() + { + return $this->any(); + } + + /** + * Determine if the message bag has any messages. + * + * @return bool + */ + public function any() + { + return $this->count() > 0; + } + + /** + * Get the number of messages in the message bag. + * + * @return int + */ + public function count() + { + return count($this->messages, COUNT_RECURSIVE) - count($this->messages); + } + + /** + * Get the instance as an array. + * + * @return array + */ + public function toArray() + { + return $this->getMessages(); + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Convert the object to its JSON representation. + * + * @param int $options + * @return string + */ + public function toJson($options = 0) + { + return json_encode($this->jsonSerialize(), $options); + } + + /** + * Convert the message bag to its string representation. + * + * @return string + */ + public function __toString() + { + return $this->toJson(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php b/vendor/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php new file mode 100755 index 0000000..cc38957 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php @@ -0,0 +1,102 @@ +parsed[$key])) { + return $this->parsed[$key]; + } + + // If the key does not contain a double colon, it means the key is not in a + // namespace, and is just a regular configuration item. Namespaces are a + // tool for organizing configuration items for things such as modules. + if (strpos($key, '::') === false) { + $segments = explode('.', $key); + + $parsed = $this->parseBasicSegments($segments); + } else { + $parsed = $this->parseNamespacedSegments($key); + } + + // Once we have the parsed array of this key's elements, such as its groups + // and namespace, we will cache each array inside a simple list that has + // the key and the parsed array for quick look-ups for later requests. + return $this->parsed[$key] = $parsed; + } + + /** + * Parse an array of basic segments. + * + * @param array $segments + * @return array + */ + protected function parseBasicSegments(array $segments) + { + // The first segment in a basic array will always be the group, so we can go + // ahead and grab that segment. If there is only one total segment we are + // just pulling an entire group out of the array and not a single item. + $group = $segments[0]; + + // If there is more than one segment in this group, it means we are pulling + // a specific item out of a group and will need to return this item name + // as well as the group so we know which item to pull from the arrays. + $item = count($segments) === 1 + ? null + : implode('.', array_slice($segments, 1)); + + return [null, $group, $item]; + } + + /** + * Parse an array of namespaced segments. + * + * @param string $key + * @return array + */ + protected function parseNamespacedSegments($key) + { + [$namespace, $item] = explode('::', $key); + + // First we'll just explode the first segment to get the namespace and group + // since the item should be in the remaining segments. Once we have these + // two pieces of data we can proceed with parsing out the item's value. + $itemSegments = explode('.', $item); + + $groupAndItem = array_slice( + $this->parseBasicSegments($itemSegments), 1 + ); + + return array_merge([$namespace], $groupAndItem); + } + + /** + * Set the parsed value of a key. + * + * @param string $key + * @param array $parsed + * @return void + */ + public function setParsedKey($key, $parsed) + { + $this->parsed[$key] = $parsed; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Optional.php b/vendor/laravel/framework/src/Illuminate/Support/Optional.php new file mode 100644 index 0000000..5e0b7d9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Optional.php @@ -0,0 +1,130 @@ +value = $value; + } + + /** + * Dynamically access a property on the underlying object. + * + * @param string $key + * @return mixed + */ + public function __get($key) + { + if (is_object($this->value)) { + return $this->value->{$key} ?? null; + } + } + + /** + * Dynamically check a property exists on the underlying object. + * + * @param mixed $name + * @return bool + */ + public function __isset($name) + { + if (is_object($this->value)) { + return isset($this->value->{$name}); + } + + if (is_array($this->value) || $this->value instanceof ArrayObject) { + return isset($this->value[$name]); + } + + return false; + } + + /** + * Determine if an item exists at an offset. + * + * @param mixed $key + * @return bool + */ + public function offsetExists($key) + { + return Arr::accessible($this->value) && Arr::exists($this->value, $key); + } + + /** + * Get an item at a given offset. + * + * @param mixed $key + * @return mixed + */ + public function offsetGet($key) + { + return Arr::get($this->value, $key); + } + + /** + * Set the item at a given offset. + * + * @param mixed $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + if (Arr::accessible($this->value)) { + $this->value[$key] = $value; + } + } + + /** + * Unset the item at a given offset. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + if (Arr::accessible($this->value)) { + unset($this->value[$key]); + } + } + + /** + * Dynamically pass a method to the underlying object. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + if (is_object($this->value)) { + return $this->value->{$method}(...$parameters); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Pluralizer.php b/vendor/laravel/framework/src/Illuminate/Support/Pluralizer.php new file mode 100755 index 0000000..75a2f6a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Pluralizer.php @@ -0,0 +1,119 @@ +app = $app; + } + + /** + * Merge the given configuration with the existing configuration. + * + * @param string $path + * @param string $key + * @return void + */ + protected function mergeConfigFrom($path, $key) + { + $config = $this->app['config']->get($key, []); + + $this->app['config']->set($key, array_merge(require $path, $config)); + } + + /** + * Load the given routes file if routes are not already cached. + * + * @param string $path + * @return void + */ + protected function loadRoutesFrom($path) + { + if (! $this->app->routesAreCached()) { + require $path; + } + } + + /** + * Register a view file namespace. + * + * @param string|array $path + * @param string $namespace + * @return void + */ + protected function loadViewsFrom($path, $namespace) + { + if (is_array($this->app->config['view']['paths'])) { + foreach ($this->app->config['view']['paths'] as $viewPath) { + if (is_dir($appPath = $viewPath.'/vendor/'.$namespace)) { + $this->app['view']->addNamespace($namespace, $appPath); + } + } + } + + $this->app['view']->addNamespace($namespace, $path); + } + + /** + * Register a translation file namespace. + * + * @param string $path + * @param string $namespace + * @return void + */ + protected function loadTranslationsFrom($path, $namespace) + { + $this->app['translator']->addNamespace($namespace, $path); + } + + /** + * Register a JSON translation file path. + * + * @param string $path + * @return void + */ + protected function loadJsonTranslationsFrom($path) + { + $this->app['translator']->addJsonPath($path); + } + + /** + * Register a database migration path. + * + * @param array|string $paths + * @return void + */ + protected function loadMigrationsFrom($paths) + { + $this->app->afterResolving('migrator', function ($migrator) use ($paths) { + foreach ((array) $paths as $path) { + $migrator->path($path); + } + }); + } + + /** + * Register paths to be published by the publish command. + * + * @param array $paths + * @param string $group + * @return void + */ + protected function publishes(array $paths, $group = null) + { + $this->ensurePublishArrayInitialized($class = static::class); + + static::$publishes[$class] = array_merge(static::$publishes[$class], $paths); + + if ($group) { + $this->addPublishGroup($group, $paths); + } + } + + /** + * Ensure the publish array for the service provider is initialized. + * + * @param string $class + * @return void + */ + protected function ensurePublishArrayInitialized($class) + { + if (! array_key_exists($class, static::$publishes)) { + static::$publishes[$class] = []; + } + } + + /** + * Add a publish group / tag to the service provider. + * + * @param string $group + * @param array $paths + * @return void + */ + protected function addPublishGroup($group, $paths) + { + if (! array_key_exists($group, static::$publishGroups)) { + static::$publishGroups[$group] = []; + } + + static::$publishGroups[$group] = array_merge( + static::$publishGroups[$group], $paths + ); + } + + /** + * Get the paths to publish. + * + * @param string $provider + * @param string $group + * @return array + */ + public static function pathsToPublish($provider = null, $group = null) + { + if (! is_null($paths = static::pathsForProviderOrGroup($provider, $group))) { + return $paths; + } + + return collect(static::$publishes)->reduce(function ($paths, $p) { + return array_merge($paths, $p); + }, []); + } + + /** + * Get the paths for the provider or group (or both). + * + * @param string|null $provider + * @param string|null $group + * @return array + */ + protected static function pathsForProviderOrGroup($provider, $group) + { + if ($provider && $group) { + return static::pathsForProviderAndGroup($provider, $group); + } elseif ($group && array_key_exists($group, static::$publishGroups)) { + return static::$publishGroups[$group]; + } elseif ($provider && array_key_exists($provider, static::$publishes)) { + return static::$publishes[$provider]; + } elseif ($group || $provider) { + return []; + } + } + + /** + * Get the paths for the provider and group. + * + * @param string $provider + * @param string $group + * @return array + */ + protected static function pathsForProviderAndGroup($provider, $group) + { + if (! empty(static::$publishes[$provider]) && ! empty(static::$publishGroups[$group])) { + return array_intersect_key(static::$publishes[$provider], static::$publishGroups[$group]); + } + + return []; + } + + /** + * Get the service providers available for publishing. + * + * @return array + */ + public static function publishableProviders() + { + return array_keys(static::$publishes); + } + + /** + * Get the groups available for publishing. + * + * @return array + */ + public static function publishableGroups() + { + return array_keys(static::$publishGroups); + } + + /** + * Register the package's custom Artisan commands. + * + * @param array|mixed $commands + * @return void + */ + public function commands($commands) + { + $commands = is_array($commands) ? $commands : func_get_args(); + + Artisan::starting(function ($artisan) use ($commands) { + $artisan->resolveCommands($commands); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return []; + } + + /** + * Get the events that trigger this service provider to register. + * + * @return array + */ + public function when() + { + return []; + } + + /** + * Determine if the provider is deferred. + * + * @return bool + */ + public function isDeferred() + { + return $this->defer; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Str.php b/vendor/laravel/framework/src/Illuminate/Support/Str.php new file mode 100644 index 0000000..752a82d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Str.php @@ -0,0 +1,718 @@ + $val) { + $value = str_replace($val, $key, $value); + } + + return preg_replace('/[^\x20-\x7E]/u', '', $value); + } + + /** + * Get the portion of a string before a given value. + * + * @param string $subject + * @param string $search + * @return string + */ + public static function before($subject, $search) + { + return $search === '' ? $subject : explode($search, $subject)[0]; + } + + /** + * Convert a value to camel case. + * + * @param string $value + * @return string + */ + public static function camel($value) + { + if (isset(static::$camelCache[$value])) { + return static::$camelCache[$value]; + } + + return static::$camelCache[$value] = lcfirst(static::studly($value)); + } + + /** + * Determine if a given string contains a given substring. + * + * @param string $haystack + * @param string|array $needles + * @return bool + */ + public static function contains($haystack, $needles) + { + foreach ((array) $needles as $needle) { + if ($needle !== '' && mb_strpos($haystack, $needle) !== false) { + return true; + } + } + + return false; + } + + /** + * Determine if a given string ends with a given substring. + * + * @param string $haystack + * @param string|array $needles + * @return bool + */ + public static function endsWith($haystack, $needles) + { + foreach ((array) $needles as $needle) { + if (substr($haystack, -strlen($needle)) === (string) $needle) { + return true; + } + } + + return false; + } + + /** + * Cap a string with a single instance of a given value. + * + * @param string $value + * @param string $cap + * @return string + */ + public static function finish($value, $cap) + { + $quoted = preg_quote($cap, '/'); + + return preg_replace('/(?:'.$quoted.')+$/u', '', $value).$cap; + } + + /** + * Determine if a given string matches a given pattern. + * + * @param string|array $pattern + * @param string $value + * @return bool + */ + public static function is($pattern, $value) + { + $patterns = Arr::wrap($pattern); + + if (empty($patterns)) { + return false; + } + + foreach ($patterns as $pattern) { + // If the given value is an exact match we can of course return true right + // from the beginning. Otherwise, we will translate asterisks and do an + // actual pattern match against the two strings to see if they match. + if ($pattern == $value) { + return true; + } + + $pattern = preg_quote($pattern, '#'); + + // Asterisks are translated into zero-or-more regular expression wildcards + // to make it convenient to check if the strings starts with the given + // pattern such as "library/*", making any string check convenient. + $pattern = str_replace('\*', '.*', $pattern); + + if (preg_match('#^'.$pattern.'\z#u', $value) === 1) { + return true; + } + } + + return false; + } + + /** + * Convert a string to kebab case. + * + * @param string $value + * @return string + */ + public static function kebab($value) + { + return static::snake($value, '-'); + } + + /** + * Return the length of the given string. + * + * @param string $value + * @param string $encoding + * @return int + */ + public static function length($value, $encoding = null) + { + if ($encoding) { + return mb_strlen($value, $encoding); + } + + return mb_strlen($value); + } + + /** + * Limit the number of characters in a string. + * + * @param string $value + * @param int $limit + * @param string $end + * @return string + */ + public static function limit($value, $limit = 100, $end = '...') + { + if (mb_strwidth($value, 'UTF-8') <= $limit) { + return $value; + } + + return rtrim(mb_strimwidth($value, 0, $limit, '', 'UTF-8')).$end; + } + + /** + * Convert the given string to lower-case. + * + * @param string $value + * @return string + */ + public static function lower($value) + { + return mb_strtolower($value, 'UTF-8'); + } + + /** + * Limit the number of words in a string. + * + * @param string $value + * @param int $words + * @param string $end + * @return string + */ + public static function words($value, $words = 100, $end = '...') + { + preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $value, $matches); + + if (! isset($matches[0]) || static::length($value) === static::length($matches[0])) { + return $value; + } + + return rtrim($matches[0]).$end; + } + + /** + * Parse a Class@method style callback into class and method. + * + * @param string $callback + * @param string|null $default + * @return array + */ + public static function parseCallback($callback, $default = null) + { + return static::contains($callback, '@') ? explode('@', $callback, 2) : [$callback, $default]; + } + + /** + * Get the plural form of an English word. + * + * @param string $value + * @param int $count + * @return string + */ + public static function plural($value, $count = 2) + { + return Pluralizer::plural($value, $count); + } + + /** + * Generate a more truly "random" alpha-numeric string. + * + * @param int $length + * @return string + */ + public static function random($length = 16) + { + $string = ''; + + while (($len = strlen($string)) < $length) { + $size = $length - $len; + + $bytes = random_bytes($size); + + $string .= substr(str_replace(['/', '+', '='], '', base64_encode($bytes)), 0, $size); + } + + return $string; + } + + /** + * Replace a given value in the string sequentially with an array. + * + * @param string $search + * @param array $replace + * @param string $subject + * @return string + */ + public static function replaceArray($search, array $replace, $subject) + { + foreach ($replace as $value) { + $subject = static::replaceFirst($search, $value, $subject); + } + + return $subject; + } + + /** + * Replace the first occurrence of a given value in the string. + * + * @param string $search + * @param string $replace + * @param string $subject + * @return string + */ + public static function replaceFirst($search, $replace, $subject) + { + if ($search == '') { + return $subject; + } + + $position = strpos($subject, $search); + + if ($position !== false) { + return substr_replace($subject, $replace, $position, strlen($search)); + } + + return $subject; + } + + /** + * Replace the last occurrence of a given value in the string. + * + * @param string $search + * @param string $replace + * @param string $subject + * @return string + */ + public static function replaceLast($search, $replace, $subject) + { + $position = strrpos($subject, $search); + + if ($position !== false) { + return substr_replace($subject, $replace, $position, strlen($search)); + } + + return $subject; + } + + /** + * Begin a string with a single instance of a given value. + * + * @param string $value + * @param string $prefix + * @return string + */ + public static function start($value, $prefix) + { + $quoted = preg_quote($prefix, '/'); + + return $prefix.preg_replace('/^(?:'.$quoted.')+/u', '', $value); + } + + /** + * Convert the given string to upper-case. + * + * @param string $value + * @return string + */ + public static function upper($value) + { + return mb_strtoupper($value, 'UTF-8'); + } + + /** + * Convert the given string to title case. + * + * @param string $value + * @return string + */ + public static function title($value) + { + return mb_convert_case($value, MB_CASE_TITLE, 'UTF-8'); + } + + /** + * Get the singular form of an English word. + * + * @param string $value + * @return string + */ + public static function singular($value) + { + return Pluralizer::singular($value); + } + + /** + * Generate a URL friendly "slug" from a given string. + * + * @param string $title + * @param string $separator + * @param string|null $language + * @return string + */ + public static function slug($title, $separator = '-', $language = 'en') + { + $title = $language ? static::ascii($title, $language) : $title; + + // Convert all dashes/underscores into separator + $flip = $separator === '-' ? '_' : '-'; + + $title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title); + + // Replace @ with the word 'at' + $title = str_replace('@', $separator.'at'.$separator, $title); + + // Remove all characters that are not the separator, letters, numbers, or whitespace. + $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($title)); + + // Replace all separator characters and whitespace by a single separator + $title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title); + + return trim($title, $separator); + } + + /** + * Convert a string to snake case. + * + * @param string $value + * @param string $delimiter + * @return string + */ + public static function snake($value, $delimiter = '_') + { + $key = $value; + + if (isset(static::$snakeCache[$key][$delimiter])) { + return static::$snakeCache[$key][$delimiter]; + } + + if (! ctype_lower($value)) { + $value = preg_replace('/\s+/u', '', ucwords($value)); + + $value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1'.$delimiter, $value)); + } + + return static::$snakeCache[$key][$delimiter] = $value; + } + + /** + * Determine if a given string starts with a given substring. + * + * @param string $haystack + * @param string|array $needles + * @return bool + */ + public static function startsWith($haystack, $needles) + { + foreach ((array) $needles as $needle) { + if ($needle !== '' && substr($haystack, 0, strlen($needle)) === (string) $needle) { + return true; + } + } + + return false; + } + + /** + * Convert a value to studly caps case. + * + * @param string $value + * @return string + */ + public static function studly($value) + { + $key = $value; + + if (isset(static::$studlyCache[$key])) { + return static::$studlyCache[$key]; + } + + $value = ucwords(str_replace(['-', '_'], ' ', $value)); + + return static::$studlyCache[$key] = str_replace(' ', '', $value); + } + + /** + * Returns the portion of string specified by the start and length parameters. + * + * @param string $string + * @param int $start + * @param int|null $length + * @return string + */ + public static function substr($string, $start, $length = null) + { + return mb_substr($string, $start, $length, 'UTF-8'); + } + + /** + * Make a string's first character uppercase. + * + * @param string $string + * @return string + */ + public static function ucfirst($string) + { + return static::upper(static::substr($string, 0, 1)).static::substr($string, 1); + } + + /** + * Generate a UUID (version 4). + * + * @return \Ramsey\Uuid\UuidInterface + */ + public static function uuid() + { + return Uuid::uuid4(); + } + + /** + * Generate a time-ordered UUID (version 4). + * + * @return \Ramsey\Uuid\UuidInterface + */ + public static function orderedUuid() + { + $factory = new UuidFactory; + + $factory->setRandomGenerator(new CombGenerator( + $factory->getRandomGenerator(), + $factory->getNumberConverter() + )); + + $factory->setCodec(new TimestampFirstCombCodec( + $factory->getUuidBuilder() + )); + + return $factory->uuid4(); + } + + /** + * Returns the replacements for the ascii method. + * + * Note: Adapted from Stringy\Stringy. + * + * @see https://github.com/danielstjules/Stringy/blob/3.1.0/LICENSE.txt + * + * @return array + */ + protected static function charsArray() + { + static $charsArray; + + if (isset($charsArray)) { + return $charsArray; + } + + return $charsArray = [ + '0' => ['°', 'â‚€', 'Û°', 'ï¼'], + '1' => ['¹', 'â‚', 'Û±', '1'], + '2' => ['²', 'â‚‚', 'Û²', 'ï¼’'], + '3' => ['³', '₃', 'Û³', '3'], + '4' => ['â´', 'â‚„', 'Û´', 'Ù¤', 'ï¼”'], + '5' => ['âµ', 'â‚…', 'Ûµ', 'Ù¥', '5'], + '6' => ['â¶', '₆', 'Û¶', 'Ù¦', 'ï¼–'], + '7' => ['â·', '₇', 'Û·', 'ï¼—'], + '8' => ['â¸', '₈', 'Û¸', '8'], + '9' => ['â¹', '₉', 'Û¹', 'ï¼™'], + 'a' => ['à', 'á', 'ả', 'ã', 'ạ', 'ă', 'ắ', 'ằ', 'ẳ', 'ẵ', 'ặ', 'â', 'ấ', 'ầ', 'ẩ', 'ẫ', 'ậ', 'Ä', 'Ä…', 'Ã¥', 'α', 'ά', 'á¼€', 'á¼', 'ἂ', 'ἃ', 'ἄ', 'á¼…', 'ἆ', 'ἇ', 'á¾€', 'á¾', 'ᾂ', 'ᾃ', 'ᾄ', 'á¾…', 'ᾆ', 'ᾇ', 'á½°', 'ά', 'á¾°', 'á¾±', 'á¾²', 'á¾³', 'á¾´', 'ᾶ', 'á¾·', 'а', 'Ø£', 'အ', 'ာ', 'ါ', 'Ç»', 'ÇŽ', 'ª', 'áƒ', 'अ', 'ا', 'ï½', 'ä'], + 'b' => ['б', 'β', 'ب', 'ဗ', 'ბ', 'b'], + 'c' => ['ç', 'ć', 'Ä', 'ĉ', 'Ä‹', 'c'], + 'd' => ['Ä', 'ð', 'Ä‘', 'ÆŒ', 'È¡', 'É–', 'É—', 'áµ­', 'á¶', 'ᶑ', 'д', 'δ', 'د', 'ض', 'á€', 'ဒ', 'დ', 'd'], + 'e' => ['é', 'è', 'ẻ', 'ẽ', 'ẹ', 'ê', 'ế', 'á»', 'ể', 'á»…', 'ệ', 'ë', 'Ä“', 'Ä™', 'Ä›', 'Ä•', 'Ä—', 'ε', 'έ', 'á¼', 'ἑ', 'á¼’', 'ἓ', 'á¼”', 'ἕ', 'á½²', 'έ', 'е', 'Ñ‘', 'Ñ', 'Ñ”', 'É™', 'ဧ', 'ေ', 'ဲ', 'ე', 'à¤', 'Ø¥', 'ئ', 'ï½…'], + 'f' => ['Ñ„', 'φ', 'Ù', 'Æ’', 'ფ', 'f'], + 'g' => ['Ä', 'ÄŸ', 'Ä¡', 'Ä£', 'г', 'Ò‘', 'γ', 'ဂ', 'გ', 'Ú¯', 'g'], + 'h' => ['Ä¥', 'ħ', 'η', 'ή', 'Ø­', 'Ù‡', 'ဟ', 'ှ', 'ჰ', 'h'], + 'i' => ['í', 'ì', 'ỉ', 'Ä©', 'ị', 'î', 'ï', 'Ä«', 'Ä­', 'į', 'ı', 'ι', 'ί', 'ÏŠ', 'Î', 'á¼°', 'á¼±', 'á¼²', 'á¼³', 'á¼´', 'á¼µ', 'ἶ', 'á¼·', 'ὶ', 'ί', 'á¿', 'á¿‘', 'á¿’', 'Î', 'á¿–', 'á¿—', 'Ñ–', 'Ñ—', 'и', 'ဣ', 'ိ', 'ီ', 'ည်', 'Ç', 'ი', 'इ', 'ÛŒ', 'i'], + 'j' => ['ĵ', 'ј', 'Ј', 'ჯ', 'ج', 'j'], + 'k' => ['Ä·', 'ĸ', 'к', 'κ', 'Ķ', 'Ù‚', 'Ùƒ', 'က', 'კ', 'ქ', 'Ú©', 'k'], + 'l' => ['Å‚', 'ľ', 'ĺ', 'ļ', 'Å€', 'л', 'λ', 'Ù„', 'လ', 'ლ', 'l'], + 'm' => ['м', 'μ', 'Ù…', 'မ', 'მ', 'ï½'], + 'n' => ['ñ', 'Å„', 'ň', 'ņ', 'ʼn', 'Å‹', 'ν', 'н', 'Ù†', 'န', 'ნ', 'n'], + 'o' => ['ó', 'ò', 'á»', 'õ', 'á»', 'ô', 'ố', 'ồ', 'ổ', 'á»—', 'á»™', 'Æ¡', 'á»›', 'á»', 'ở', 'ỡ', 'ợ', 'ø', 'Å', 'Å‘', 'Å', 'ο', 'á½€', 'á½', 'ὂ', 'ὃ', 'ὄ', 'á½…', 'ὸ', 'ÏŒ', 'о', 'Ùˆ', 'θ', 'ို', 'Ç’', 'Ç¿', 'º', 'áƒ', 'ओ', 'ï½', 'ö'], + 'p' => ['п', 'Ï€', 'ပ', 'პ', 'Ù¾', 'ï½'], + 'q' => ['ყ', 'q'], + 'r' => ['Å•', 'Å™', 'Å—', 'Ñ€', 'Ï', 'ر', 'რ', 'ï½’'], + 's' => ['Å›', 'Å¡', 'ÅŸ', 'Ñ', 'σ', 'È™', 'Ï‚', 'س', 'ص', 'စ', 'Å¿', 'ს', 's'], + 't' => ['Å¥', 'Å£', 'Ñ‚', 'Ï„', 'È›', 'ت', 'Ø·', 'ဋ', 'á€', 'ŧ', 'თ', 'ტ', 'ï½”'], + 'u' => ['ú', 'ù', 'ủ', 'Å©', 'ụ', 'Æ°', 'ứ', 'ừ', 'á»­', 'ữ', 'á»±', 'û', 'Å«', 'ů', 'ű', 'Å­', 'ų', 'µ', 'у', 'ဉ', 'ု', 'ူ', 'Ç”', 'Ç–', 'ǘ', 'Çš', 'Çœ', 'უ', 'उ', 'u', 'Ñž', 'ü'], + 'v' => ['в', 'ვ', 'Ï', 'ï½–'], + 'w' => ['ŵ', 'ω', 'ÏŽ', 'á€', 'ွ', 'ï½—'], + 'x' => ['χ', 'ξ', 'x'], + 'y' => ['ý', 'ỳ', 'á»·', 'ỹ', 'ỵ', 'ÿ', 'Å·', 'й', 'Ñ‹', 'Ï…', 'Ï‹', 'Ï', 'ΰ', 'ÙŠ', 'ယ', 'ï½™'], + 'z' => ['ź', 'ž', 'ż', 'з', 'ζ', 'ز', 'ဇ', 'ზ', 'z'], + 'aa' => ['ع', 'आ', 'Ø¢'], + 'ae' => ['æ', 'ǽ'], + 'ai' => ['à¤'], + 'ch' => ['ч', 'ჩ', 'ჭ', 'Ú†'], + 'dj' => ['Ñ’', 'Ä‘'], + 'dz' => ['ÑŸ', 'ძ'], + 'ei' => ['à¤'], + 'gh' => ['غ', 'ღ'], + 'ii' => ['ई'], + 'ij' => ['ij'], + 'kh' => ['Ñ…', 'Ø®', 'ხ'], + 'lj' => ['Ñ™'], + 'nj' => ['Ñš'], + 'oe' => ['ö', 'Å“', 'ؤ'], + 'oi' => ['ऑ'], + 'oii' => ['ऒ'], + 'ps' => ['ψ'], + 'sh' => ['ш', 'შ', 'Ø´'], + 'shch' => ['щ'], + 'ss' => ['ß'], + 'sx' => ['Å'], + 'th' => ['þ', 'Ï‘', 'Ø«', 'Ø°', 'ظ'], + 'ts' => ['ц', 'ც', 'წ'], + 'ue' => ['ü'], + 'uu' => ['ऊ'], + 'ya' => ['Ñ'], + 'yu' => ['ÑŽ'], + 'zh' => ['ж', 'ჟ', 'Ú˜'], + '(c)' => ['©'], + 'A' => ['Ã', 'À', 'Ả', 'Ã', 'Ạ', 'Ä‚', 'Ắ', 'Ằ', 'Ẳ', 'Ẵ', 'Ặ', 'Â', 'Ấ', 'Ầ', 'Ẩ', 'Ẫ', 'Ậ', 'Ã…', 'Ä€', 'Ä„', 'Α', 'Ά', 'Ἀ', 'Ἁ', 'Ἂ', 'Ἃ', 'Ἄ', 'á¼', 'Ἆ', 'á¼', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'á¾', 'ᾎ', 'á¾', 'Ᾰ', 'á¾¹', 'Ὰ', 'Ά', 'á¾¼', 'Ð', 'Ǻ', 'Ç', 'A', 'Ä'], + 'B' => ['Б', 'Î’', 'ब', 'ï¼¢'], + 'C' => ['Ç', 'Ć', 'ÄŒ', 'Ĉ', 'ÄŠ', 'ï¼£'], + 'D' => ['ÄŽ', 'Ã', 'Ä', 'Ɖ', 'ÆŠ', 'Æ‹', 'á´…', 'á´†', 'Д', 'Δ', 'D'], + 'E' => ['É', 'È', 'Ẻ', 'Ẽ', 'Ẹ', 'Ê', 'Ế', 'Ề', 'Ể', 'Ễ', 'Ệ', 'Ë', 'Ä’', 'Ę', 'Äš', 'Ä”', 'Ä–', 'Ε', 'Έ', 'Ἐ', 'á¼™', 'Ἒ', 'á¼›', 'Ἔ', 'á¼', 'Έ', 'Ὲ', 'Е', 'Ð', 'Э', 'Є', 'Æ', 'ï¼¥'], + 'F' => ['Ф', 'Φ', 'F'], + 'G' => ['Äž', 'Ä ', 'Ä¢', 'Г', 'Ò', 'Γ', 'G'], + 'H' => ['Η', 'Ή', 'Ħ', 'H'], + 'I' => ['Ã', 'ÃŒ', 'Ỉ', 'Ĩ', 'Ị', 'ÃŽ', 'Ã', 'Ī', 'Ĭ', 'Ä®', 'Ä°', 'Ι', 'Ί', 'Ϊ', 'Ἰ', 'á¼¹', 'á¼»', 'á¼¼', 'á¼½', 'á¼¾', 'Ἷ', 'Ῐ', 'á¿™', 'á¿š', 'Ί', 'И', 'І', 'Ї', 'Ç', 'Ï’', 'I'], + 'J' => ['J'], + 'K' => ['К', 'Κ', 'K'], + 'L' => ['Ĺ', 'Å', 'Л', 'Λ', 'Ä»', 'Ľ', 'Ä¿', 'ल', 'L'], + 'M' => ['Ðœ', 'Îœ', 'ï¼­'], + 'N' => ['Ń', 'Ñ', 'Ň', 'Å…', 'ÅŠ', 'Ð', 'Î', 'ï¼®'], + 'O' => ['Ó', 'Ã’', 'Ỏ', 'Õ', 'Ọ', 'Ô', 'á»', 'á»’', 'á»”', 'á»–', 'Ộ', 'Æ ', 'Ớ', 'Ờ', 'Ở', 'á» ', 'Ợ', 'Ø', 'ÅŒ', 'Å', 'ÅŽ', 'Ο', 'ÎŒ', 'Ὀ', 'Ὁ', 'Ὂ', 'Ὃ', 'Ὄ', 'á½', 'Ὸ', 'ÎŒ', 'О', 'Θ', 'Ó¨', 'Ç‘', 'Ǿ', 'O', 'Ö'], + 'P' => ['П', 'Π', 'ï¼°'], + 'Q' => ['ï¼±'], + 'R' => ['Ř', 'Å”', 'Р', 'Ρ', 'Å–', 'ï¼²'], + 'S' => ['Åž', 'Åœ', 'Ș', 'Å ', 'Åš', 'С', 'Σ', 'ï¼³'], + 'T' => ['Ť', 'Å¢', 'Ŧ', 'Èš', 'Т', 'Τ', 'ï¼´'], + 'U' => ['Ú', 'Ù', 'Ủ', 'Ũ', 'Ụ', 'Ư', 'Ứ', 'Ừ', 'Ử', 'á»®', 'á»°', 'Û', 'Ū', 'Å®', 'Å°', 'Ŭ', 'Ų', 'У', 'Ç“', 'Ç•', 'Ç—', 'Ç™', 'Ç›', 'ï¼µ', 'ÐŽ', 'Ãœ'], + 'V' => ['Ð’', 'V'], + 'W' => ['Ω', 'Î', 'Å´', 'ï¼·'], + 'X' => ['Χ', 'Ξ', 'X'], + 'Y' => ['Ã', 'Ỳ', 'Ỷ', 'Ỹ', 'á»´', 'Ÿ', 'Ῠ', 'á¿©', 'Ὺ', 'ÎŽ', 'Ы', 'Й', 'Î¥', 'Ϋ', 'Ŷ', 'ï¼¹'], + 'Z' => ['Ź', 'Ž', 'Å»', 'З', 'Ζ', 'Z'], + 'AE' => ['Æ', 'Ǽ'], + 'Ch' => ['Ч'], + 'Dj' => ['Ђ'], + 'Dz' => ['Ð'], + 'Gx' => ['Äœ'], + 'Hx' => ['Ĥ'], + 'Ij' => ['IJ'], + 'Jx' => ['Ä´'], + 'Kh' => ['Ð¥'], + 'Lj' => ['Љ'], + 'Nj' => ['Њ'], + 'Oe' => ['Å’'], + 'Ps' => ['Ψ'], + 'Sh' => ['Ш'], + 'Shch' => ['Щ'], + 'Ss' => ['ẞ'], + 'Th' => ['Þ'], + 'Ts' => ['Ц'], + 'Ya' => ['Я'], + 'Yu' => ['Ю'], + 'Zh' => ['Ж'], + ' ' => ["\xC2\xA0", "\xE2\x80\x80", "\xE2\x80\x81", "\xE2\x80\x82", "\xE2\x80\x83", "\xE2\x80\x84", "\xE2\x80\x85", "\xE2\x80\x86", "\xE2\x80\x87", "\xE2\x80\x88", "\xE2\x80\x89", "\xE2\x80\x8A", "\xE2\x80\xAF", "\xE2\x81\x9F", "\xE3\x80\x80", "\xEF\xBE\xA0"], + ]; + } + + /** + * Returns the language specific replacements for the ascii method. + * + * Note: Adapted from Stringy\Stringy. + * + * @see https://github.com/danielstjules/Stringy/blob/3.1.0/LICENSE.txt + * + * @param string $language + * @return array|null + */ + protected static function languageSpecificCharsArray($language) + { + static $languageSpecific; + + if (! isset($languageSpecific)) { + $languageSpecific = [ + 'bg' => [ + ['Ñ…', 'Ð¥', 'щ', 'Щ', 'ÑŠ', 'Ъ', 'ÑŒ', 'Ь'], + ['h', 'H', 'sht', 'SHT', 'a', 'Ð', 'y', 'Y'], + ], + 'de' => [ + ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ãœ'], + ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], + ], + ]; + } + + return $languageSpecific[$language] ?? null; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/BusFake.php b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/BusFake.php new file mode 100644 index 0000000..b42491e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/BusFake.php @@ -0,0 +1,165 @@ +assertDispatchedTimes($command, $callback); + } + + PHPUnit::assertTrue( + $this->dispatched($command, $callback)->count() > 0, + "The expected [{$command}] job was not dispatched." + ); + } + + /** + * Assert if a job was pushed a number of times. + * + * @param string $command + * @param int $times + * @return void + */ + protected function assertDispatchedTimes($command, $times = 1) + { + PHPUnit::assertTrue( + ($count = $this->dispatched($command)->count()) === $times, + "The expected [{$command}] job was pushed {$count} times instead of {$times} times." + ); + } + + /** + * Determine if a job was dispatched based on a truth-test callback. + * + * @param string $command + * @param callable|null $callback + * @return void + */ + public function assertNotDispatched($command, $callback = null) + { + PHPUnit::assertTrue( + $this->dispatched($command, $callback)->count() === 0, + "The unexpected [{$command}] job was dispatched." + ); + } + + /** + * Get all of the jobs matching a truth-test callback. + * + * @param string $command + * @param callable|null $callback + * @return \Illuminate\Support\Collection + */ + public function dispatched($command, $callback = null) + { + if (! $this->hasDispatched($command)) { + return collect(); + } + + $callback = $callback ?: function () { + return true; + }; + + return collect($this->commands[$command])->filter(function ($command) use ($callback) { + return $callback($command); + }); + } + + /** + * Determine if there are any stored commands for a given class. + * + * @param string $command + * @return bool + */ + public function hasDispatched($command) + { + return isset($this->commands[$command]) && ! empty($this->commands[$command]); + } + + /** + * Dispatch a command to its appropriate handler. + * + * @param mixed $command + * @return mixed + */ + public function dispatch($command) + { + return $this->dispatchNow($command); + } + + /** + * Dispatch a command to its appropriate handler in the current process. + * + * @param mixed $command + * @param mixed $handler + * @return mixed + */ + public function dispatchNow($command, $handler = null) + { + $this->commands[get_class($command)][] = $command; + } + + /** + * Set the pipes commands should be piped through before dispatching. + * + * @param array $pipes + * @return $this + */ + public function pipeThrough(array $pipes) + { + // + } + + /** + * Determine if the given command has a handler. + * + * @param mixed $command + * @return bool + */ + public function hasCommandHandler($command) + { + return false; + } + + /** + * Retrieve the handler for a command. + * + * @param mixed $command + * @return mixed + */ + public function getCommandHandler($command) + { + return false; + } + + /** + * Map a command to a handler. + * + * @param array $map + * @return $this + */ + public function map(array $map) + { + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/EventFake.php b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/EventFake.php new file mode 100644 index 0000000..57e47c8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/EventFake.php @@ -0,0 +1,272 @@ +dispatcher = $dispatcher; + + $this->eventsToFake = Arr::wrap($eventsToFake); + } + + /** + * Assert if an event was dispatched based on a truth-test callback. + * + * @param string $event + * @param callable|int|null $callback + * @return void + */ + public function assertDispatched($event, $callback = null) + { + if (is_int($callback)) { + return $this->assertDispatchedTimes($event, $callback); + } + + PHPUnit::assertTrue( + $this->dispatched($event, $callback)->count() > 0, + "The expected [{$event}] event was not dispatched." + ); + } + + /** + * Assert if a event was dispatched a number of times. + * + * @param string $event + * @param int $times + * @return void + */ + public function assertDispatchedTimes($event, $times = 1) + { + PHPUnit::assertTrue( + ($count = $this->dispatched($event)->count()) === $times, + "The expected [{$event}] event was dispatched {$count} times instead of {$times} times." + ); + } + + /** + * Determine if an event was dispatched based on a truth-test callback. + * + * @param string $event + * @param callable|null $callback + * @return void + */ + public function assertNotDispatched($event, $callback = null) + { + PHPUnit::assertTrue( + $this->dispatched($event, $callback)->count() === 0, + "The unexpected [{$event}] event was dispatched." + ); + } + + /** + * Get all of the events matching a truth-test callback. + * + * @param string $event + * @param callable|null $callback + * @return \Illuminate\Support\Collection + */ + public function dispatched($event, $callback = null) + { + if (! $this->hasDispatched($event)) { + return collect(); + } + + $callback = $callback ?: function () { + return true; + }; + + return collect($this->events[$event])->filter(function ($arguments) use ($callback) { + return $callback(...$arguments); + }); + } + + /** + * Determine if the given event has been dispatched. + * + * @param string $event + * @return bool + */ + public function hasDispatched($event) + { + return isset($this->events[$event]) && ! empty($this->events[$event]); + } + + /** + * Register an event listener with the dispatcher. + * + * @param string|array $events + * @param mixed $listener + * @return void + */ + public function listen($events, $listener) + { + $this->dispatcher->listen($events, $listener); + } + + /** + * Determine if a given event has listeners. + * + * @param string $eventName + * @return bool + */ + public function hasListeners($eventName) + { + return $this->dispatcher->hasListeners($eventName); + } + + /** + * Register an event and payload to be dispatched later. + * + * @param string $event + * @param array $payload + * @return void + */ + public function push($event, $payload = []) + { + // + } + + /** + * Register an event subscriber with the dispatcher. + * + * @param object|string $subscriber + * @return void + */ + public function subscribe($subscriber) + { + $this->dispatcher->subscribe($subscriber); + } + + /** + * Flush a set of pushed events. + * + * @param string $event + * @return void + */ + public function flush($event) + { + // + } + + /** + * Fire an event and call the listeners. + * + * @param string|object $event + * @param mixed $payload + * @param bool $halt + * @return array|null + */ + public function fire($event, $payload = [], $halt = false) + { + return $this->dispatch($event, $payload, $halt); + } + + /** + * Fire an event and call the listeners. + * + * @param string|object $event + * @param mixed $payload + * @param bool $halt + * @return array|null + */ + public function dispatch($event, $payload = [], $halt = false) + { + $name = is_object($event) ? get_class($event) : (string) $event; + + if ($this->shouldFakeEvent($name, $payload)) { + $this->events[$name][] = func_get_args(); + } else { + $this->dispatcher->dispatch($event, $payload, $halt); + } + } + + /** + * Determine if an event should be faked or actually dispatched. + * + * @param string $eventName + * @param mixed $payload + * @return bool + */ + protected function shouldFakeEvent($eventName, $payload) + { + if (empty($this->eventsToFake)) { + return true; + } + + return collect($this->eventsToFake) + ->filter(function ($event) use ($eventName, $payload) { + return $event instanceof Closure + ? $event($eventName, $payload) + : $event === $eventName; + }) + ->isNotEmpty(); + } + + /** + * Remove a set of listeners from the dispatcher. + * + * @param string $event + * @return void + */ + public function forget($event) + { + // + } + + /** + * Forget all of the queued listeners. + * + * @return void + */ + public function forgetPushed() + { + // + } + + /** + * Dispatch an event and call the listeners. + * + * @param string|object $event + * @param mixed $payload + * @return void + */ + public function until($event, $payload = []) + { + return $this->dispatch($event, $payload, true); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/MailFake.php b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/MailFake.php new file mode 100644 index 0000000..b6f4b81 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/MailFake.php @@ -0,0 +1,336 @@ +assertSentTimes($mailable, $callback); + } + + $message = "The expected [{$mailable}] mailable was not sent."; + + if (count($this->queuedMailables) > 0) { + $message .= ' Did you mean to use assertQueued() instead?'; + } + + PHPUnit::assertTrue( + $this->sent($mailable, $callback)->count() > 0, + $message + ); + } + + /** + * Assert if a mailable was sent a number of times. + * + * @param string $mailable + * @param int $times + * @return void + */ + protected function assertSentTimes($mailable, $times = 1) + { + PHPUnit::assertTrue( + ($count = $this->sent($mailable)->count()) === $times, + "The expected [{$mailable}] mailable was sent {$count} times instead of {$times} times." + ); + } + + /** + * Determine if a mailable was not sent based on a truth-test callback. + * + * @param string $mailable + * @param callable|null $callback + * @return void + */ + public function assertNotSent($mailable, $callback = null) + { + PHPUnit::assertTrue( + $this->sent($mailable, $callback)->count() === 0, + "The unexpected [{$mailable}] mailable was sent." + ); + } + + /** + * Assert that no mailables were sent. + * + * @return void + */ + public function assertNothingSent() + { + PHPUnit::assertEmpty($this->mailables, 'Mailables were sent unexpectedly.'); + } + + /** + * Assert if a mailable was queued based on a truth-test callback. + * + * @param string $mailable + * @param callable|int|null $callback + * @return void + */ + public function assertQueued($mailable, $callback = null) + { + if (is_numeric($callback)) { + return $this->assertQueuedTimes($mailable, $callback); + } + + PHPUnit::assertTrue( + $this->queued($mailable, $callback)->count() > 0, + "The expected [{$mailable}] mailable was not queued." + ); + } + + /** + * Assert if a mailable was queued a number of times. + * + * @param string $mailable + * @param int $times + * @return void + */ + protected function assertQueuedTimes($mailable, $times = 1) + { + PHPUnit::assertTrue( + ($count = $this->queued($mailable)->count()) === $times, + "The expected [{$mailable}] mailable was queued {$count} times instead of {$times} times." + ); + } + + /** + * Determine if a mailable was not queued based on a truth-test callback. + * + * @param string $mailable + * @param callable|null $callback + * @return void + */ + public function assertNotQueued($mailable, $callback = null) + { + PHPUnit::assertTrue( + $this->queued($mailable, $callback)->count() === 0, + "The unexpected [{$mailable}] mailable was queued." + ); + } + + /** + * Assert that no mailables were queued. + * + * @return void + */ + public function assertNothingQueued() + { + PHPUnit::assertEmpty($this->queuedMailables, 'Mailables were queued unexpectedly.'); + } + + /** + * Get all of the mailables matching a truth-test callback. + * + * @param string $mailable + * @param callable|null $callback + * @return \Illuminate\Support\Collection + */ + public function sent($mailable, $callback = null) + { + if (! $this->hasSent($mailable)) { + return collect(); + } + + $callback = $callback ?: function () { + return true; + }; + + return $this->mailablesOf($mailable)->filter(function ($mailable) use ($callback) { + return $callback($mailable); + }); + } + + /** + * Determine if the given mailable has been sent. + * + * @param string $mailable + * @return bool + */ + public function hasSent($mailable) + { + return $this->mailablesOf($mailable)->count() > 0; + } + + /** + * Get all of the queued mailables matching a truth-test callback. + * + * @param string $mailable + * @param callable|null $callback + * @return \Illuminate\Support\Collection + */ + public function queued($mailable, $callback = null) + { + if (! $this->hasQueued($mailable)) { + return collect(); + } + + $callback = $callback ?: function () { + return true; + }; + + return $this->queuedMailablesOf($mailable)->filter(function ($mailable) use ($callback) { + return $callback($mailable); + }); + } + + /** + * Determine if the given mailable has been queued. + * + * @param string $mailable + * @return bool + */ + public function hasQueued($mailable) + { + return $this->queuedMailablesOf($mailable)->count() > 0; + } + + /** + * Get all of the mailed mailables for a given type. + * + * @param string $type + * @return \Illuminate\Support\Collection + */ + protected function mailablesOf($type) + { + return collect($this->mailables)->filter(function ($mailable) use ($type) { + return $mailable instanceof $type; + }); + } + + /** + * Get all of the mailed mailables for a given type. + * + * @param string $type + * @return \Illuminate\Support\Collection + */ + protected function queuedMailablesOf($type) + { + return collect($this->queuedMailables)->filter(function ($mailable) use ($type) { + return $mailable instanceof $type; + }); + } + + /** + * Begin the process of mailing a mailable class instance. + * + * @param mixed $users + * @return \Illuminate\Mail\PendingMail + */ + public function to($users) + { + return (new PendingMailFake($this))->to($users); + } + + /** + * Begin the process of mailing a mailable class instance. + * + * @param mixed $users + * @return \Illuminate\Mail\PendingMail + */ + public function bcc($users) + { + return (new PendingMailFake($this))->bcc($users); + } + + /** + * Send a new message when only a raw text part. + * + * @param string $text + * @param \Closure|string $callback + * @return int + */ + public function raw($text, $callback) + { + // + } + + /** + * Send a new message using a view. + * + * @param string|array $view + * @param array $data + * @param \Closure|string $callback + * @return void + */ + public function send($view, array $data = [], $callback = null) + { + if (! $view instanceof Mailable) { + return; + } + + if ($view instanceof ShouldQueue) { + return $this->queue($view, $data); + } + + $this->mailables[] = $view; + } + + /** + * Queue a new e-mail message for sending. + * + * @param string|array $view + * @param string|null $queue + * @return mixed + */ + public function queue($view, $queue = null) + { + if (! $view instanceof Mailable) { + return; + } + + $this->queuedMailables[] = $view; + } + + /** + * Queue a new e-mail message for sending after (n) seconds. + * + * @param \DateTimeInterface|\DateInterval|int $delay + * @param string|array|\Illuminate\Contracts\Mail\Mailable $view + * @param string $queue + * @return mixed + */ + public function later($delay, $view, $queue = null) + { + $this->queue($view, $queue); + } + + /** + * Get the array of failed recipients. + * + * @return array + */ + public function failures() + { + // + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/NotificationFake.php b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/NotificationFake.php new file mode 100644 index 0000000..b2fab7a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/NotificationFake.php @@ -0,0 +1,246 @@ +assertSentTo($singleNotifiable, $notification, $callback); + } + + return; + } + + if (is_numeric($callback)) { + return $this->assertSentToTimes($notifiable, $notification, $callback); + } + + PHPUnit::assertTrue( + $this->sent($notifiable, $notification, $callback)->count() > 0, + "The expected [{$notification}] notification was not sent." + ); + } + + /** + * Assert if a notification was sent a number of times. + * + * @param mixed $notifiable + * @param string $notification + * @param int $times + * @return void + */ + public function assertSentToTimes($notifiable, $notification, $times = 1) + { + PHPUnit::assertTrue( + ($count = $this->sent($notifiable, $notification)->count()) === $times, + "Expected [{$notification}] to be sent {$times} times, but was sent {$count} times." + ); + } + + /** + * Determine if a notification was sent based on a truth-test callback. + * + * @param mixed $notifiable + * @param string $notification + * @param callable|null $callback + * @return void + */ + public function assertNotSentTo($notifiable, $notification, $callback = null) + { + if (is_array($notifiable) || $notifiable instanceof Collection) { + foreach ($notifiable as $singleNotifiable) { + $this->assertNotSentTo($singleNotifiable, $notification, $callback); + } + + return; + } + + PHPUnit::assertTrue( + $this->sent($notifiable, $notification, $callback)->count() === 0, + "The unexpected [{$notification}] notification was sent." + ); + } + + /** + * Assert that no notifications were sent. + * + * @return void + */ + public function assertNothingSent() + { + PHPUnit::assertEmpty($this->notifications, 'Notifications were sent unexpectedly.'); + } + + /** + * Assert the total amount of times a notification was sent. + * + * @param int $expectedCount + * @param string $notification + * @return void + */ + public function assertTimesSent($expectedCount, $notification) + { + $actualCount = collect($this->notifications) + ->flatten(1) + ->reduce(function ($count, $sent) use ($notification) { + return $count + count($sent[$notification] ?? []); + }, 0); + + PHPUnit::assertSame( + $expectedCount, $actualCount, + "Expected [{$notification}] to be sent {$expectedCount} times, but was sent {$actualCount} times." + ); + } + + /** + * Get all of the notifications matching a truth-test callback. + * + * @param mixed $notifiable + * @param string $notification + * @param callable|null $callback + * @return \Illuminate\Support\Collection + */ + public function sent($notifiable, $notification, $callback = null) + { + if (! $this->hasSent($notifiable, $notification)) { + return collect(); + } + + $callback = $callback ?: function () { + return true; + }; + + $notifications = collect($this->notificationsFor($notifiable, $notification)); + + return $notifications->filter(function ($arguments) use ($callback) { + return $callback(...array_values($arguments)); + })->pluck('notification'); + } + + /** + * Determine if there are more notifications left to inspect. + * + * @param mixed $notifiable + * @param string $notification + * @return bool + */ + public function hasSent($notifiable, $notification) + { + return ! empty($this->notificationsFor($notifiable, $notification)); + } + + /** + * Get all of the notifications for a notifiable entity by type. + * + * @param mixed $notifiable + * @param string $notification + * @return array + */ + protected function notificationsFor($notifiable, $notification) + { + if (isset($this->notifications[get_class($notifiable)][$notifiable->getKey()][$notification])) { + return $this->notifications[get_class($notifiable)][$notifiable->getKey()][$notification]; + } + + return []; + } + + /** + * Send the given notification to the given notifiable entities. + * + * @param \Illuminate\Support\Collection|array|mixed $notifiables + * @param mixed $notification + * @return void + */ + public function send($notifiables, $notification) + { + return $this->sendNow($notifiables, $notification); + } + + /** + * Send the given notification immediately. + * + * @param \Illuminate\Support\Collection|array|mixed $notifiables + * @param mixed $notification + * @return void + */ + public function sendNow($notifiables, $notification) + { + if (! $notifiables instanceof Collection && ! is_array($notifiables)) { + $notifiables = [$notifiables]; + } + + foreach ($notifiables as $notifiable) { + if (! $notification->id) { + $notification->id = Str::uuid()->toString(); + } + + $this->notifications[get_class($notifiable)][$notifiable->getKey()][get_class($notification)][] = [ + 'notification' => $notification, + 'channels' => $notification->via($notifiable), + 'notifiable' => $notifiable, + 'locale' => $notification->locale ?? $this->locale ?? value(function () use ($notifiable) { + if ($notifiable instanceof HasLocalePreference) { + return $notifiable->preferredLocale(); + } + }), + ]; + } + } + + /** + * Get a channel instance by name. + * + * @param string|null $name + * @return mixed + */ + public function channel($name = null) + { + // + } + + /** + * Set the locale of notifications. + * + * @param string $locale + * @return $this + */ + public function locale($locale) + { + $this->locale = $locale; + + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php new file mode 100644 index 0000000..e344fcf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/PendingMailFake.php @@ -0,0 +1,53 @@ +mailer = $mailer; + } + + /** + * Send a new mailable message instance. + * + * @param \Illuminate\Mail\Mailable $mailable + * @return mixed + */ + public function send(Mailable $mailable) + { + return $this->sendNow($mailable); + } + + /** + * Send a mailable message immediately. + * + * @param \Illuminate\Mail\Mailable $mailable + * @return mixed + */ + public function sendNow(Mailable $mailable) + { + $this->mailer->send($this->fill($mailable)); + } + + /** + * Push the given mailable onto the queue. + * + * @param \Illuminate\Mail\Mailable $mailable + * @return mixed + */ + public function queue(Mailable $mailable) + { + return $this->mailer->queue($this->fill($mailable)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/QueueFake.php b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/QueueFake.php new file mode 100644 index 0000000..a231d6c --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Testing/Fakes/QueueFake.php @@ -0,0 +1,350 @@ +assertPushedTimes($job, $callback); + } + + PHPUnit::assertTrue( + $this->pushed($job, $callback)->count() > 0, + "The expected [{$job}] job was not pushed." + ); + } + + /** + * Assert if a job was pushed a number of times. + * + * @param string $job + * @param int $times + * @return void + */ + protected function assertPushedTimes($job, $times = 1) + { + PHPUnit::assertTrue( + ($count = $this->pushed($job)->count()) === $times, + "The expected [{$job}] job was pushed {$count} times instead of {$times} times." + ); + } + + /** + * Assert if a job was pushed based on a truth-test callback. + * + * @param string $queue + * @param string $job + * @param callable|null $callback + * @return void + */ + public function assertPushedOn($queue, $job, $callback = null) + { + return $this->assertPushed($job, function ($job, $pushedQueue) use ($callback, $queue) { + if ($pushedQueue !== $queue) { + return false; + } + + return $callback ? $callback(...func_get_args()) : true; + }); + } + + /** + * Assert if a job was pushed with chained jobs based on a truth-test callback. + * + * @param string $job + * @param array $expectedChain + * @param callable|null $callback + * @return void + */ + public function assertPushedWithChain($job, $expectedChain = [], $callback = null) + { + PHPUnit::assertTrue( + $this->pushed($job, $callback)->isNotEmpty(), + "The expected [{$job}] job was not pushed." + ); + + PHPUnit::assertTrue( + collect($expectedChain)->isNotEmpty(), + 'The expected chain can not be empty.' + ); + + $this->isChainOfObjects($expectedChain) + ? $this->assertPushedWithChainOfObjects($job, $expectedChain, $callback) + : $this->assertPushedWithChainOfClasses($job, $expectedChain, $callback); + } + + /** + * Assert if a job was pushed with chained jobs based on a truth-test callback. + * + * @param string $job + * @param array $expectedChain + * @param callable|null $callback + * @return void + */ + protected function assertPushedWithChainOfObjects($job, $expectedChain, $callback) + { + $chain = collect($expectedChain)->map(function ($job) { + return serialize($job); + })->all(); + + PHPUnit::assertTrue( + $this->pushed($job, $callback)->filter(function ($job) use ($chain) { + return $job->chained == $chain; + })->isNotEmpty(), + 'The expected chain was not pushed.' + ); + } + + /** + * Assert if a job was pushed with chained jobs based on a truth-test callback. + * + * @param string $job + * @param array $expectedChain + * @param callable|null $callback + * @return void + */ + protected function assertPushedWithChainOfClasses($job, $expectedChain, $callback) + { + $matching = $this->pushed($job, $callback)->map->chained->map(function ($chain) { + return collect($chain)->map(function ($job) { + return get_class(unserialize($job)); + }); + })->filter(function ($chain) use ($expectedChain) { + return $chain->all() === $expectedChain; + }); + + PHPUnit::assertTrue( + $matching->isNotEmpty(), 'The expected chain was not pushed.' + ); + } + + /** + * Determine if the given chain is entirely composed of objects. + * + * @param array $chain + * @return bool + */ + protected function isChainOfObjects($chain) + { + return ! collect($chain)->contains(function ($job) { + return ! is_object($job); + }); + } + + /** + * Determine if a job was pushed based on a truth-test callback. + * + * @param string $job + * @param callable|null $callback + * @return void + */ + public function assertNotPushed($job, $callback = null) + { + PHPUnit::assertTrue( + $this->pushed($job, $callback)->count() === 0, + "The unexpected [{$job}] job was pushed." + ); + } + + /** + * Assert that no jobs were pushed. + * + * @return void + */ + public function assertNothingPushed() + { + PHPUnit::assertEmpty($this->jobs, 'Jobs were pushed unexpectedly.'); + } + + /** + * Get all of the jobs matching a truth-test callback. + * + * @param string $job + * @param callable|null $callback + * @return \Illuminate\Support\Collection + */ + public function pushed($job, $callback = null) + { + if (! $this->hasPushed($job)) { + return collect(); + } + + $callback = $callback ?: function () { + return true; + }; + + return collect($this->jobs[$job])->filter(function ($data) use ($callback) { + return $callback($data['job'], $data['queue']); + })->pluck('job'); + } + + /** + * Determine if there are any stored jobs for a given class. + * + * @param string $job + * @return bool + */ + public function hasPushed($job) + { + return isset($this->jobs[$job]) && ! empty($this->jobs[$job]); + } + + /** + * Resolve a queue connection instance. + * + * @param mixed $value + * @return \Illuminate\Contracts\Queue\Queue + */ + public function connection($value = null) + { + return $this; + } + + /** + * Get the size of the queue. + * + * @param string $queue + * @return int + */ + public function size($queue = null) + { + return count($this->jobs); + } + + /** + * Push a new job onto the queue. + * + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function push($job, $data = '', $queue = null) + { + $this->jobs[is_object($job) ? get_class($job) : $job][] = [ + 'job' => $job, + 'queue' => $queue, + ]; + } + + /** + * Push a raw payload onto the queue. + * + * @param string $payload + * @param string $queue + * @param array $options + * @return mixed + */ + public function pushRaw($payload, $queue = null, array $options = []) + { + // + } + + /** + * Push a new job onto the queue after a delay. + * + * @param \DateTime|int $delay + * @param string $job + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function later($delay, $job, $data = '', $queue = null) + { + return $this->push($job, $data, $queue); + } + + /** + * Push a new job onto the queue. + * + * @param string $queue + * @param string $job + * @param mixed $data + * @return mixed + */ + public function pushOn($queue, $job, $data = '') + { + return $this->push($job, $data, $queue); + } + + /** + * Push a new job onto the queue after a delay. + * + * @param string $queue + * @param \DateTime|int $delay + * @param string $job + * @param mixed $data + * @return mixed + */ + public function laterOn($queue, $delay, $job, $data = '') + { + return $this->push($job, $data, $queue); + } + + /** + * Pop the next job off of the queue. + * + * @param string $queue + * @return \Illuminate\Contracts\Queue\Job|null + */ + public function pop($queue = null) + { + // + } + + /** + * Push an array of jobs onto the queue. + * + * @param array $jobs + * @param mixed $data + * @param string $queue + * @return mixed + */ + public function bulk($jobs, $data = '', $queue = null) + { + foreach ($jobs as $job) { + $this->push($job, $data, $queue); + } + } + + /** + * Get the connection name for the queue. + * + * @return string + */ + public function getConnectionName() + { + // + } + + /** + * Set the connection name for the queue. + * + * @param string $name + * @return $this + */ + public function setConnectionName($name) + { + return $this; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Traits/CapsuleManagerTrait.php b/vendor/laravel/framework/src/Illuminate/Support/Traits/CapsuleManagerTrait.php new file mode 100644 index 0000000..08089ef --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Traits/CapsuleManagerTrait.php @@ -0,0 +1,69 @@ +container = $container; + + if (! $this->container->bound('config')) { + $this->container->instance('config', new Fluent); + } + } + + /** + * Make this capsule instance available globally. + * + * @return void + */ + public function setAsGlobal() + { + static::$instance = $this; + } + + /** + * Get the IoC container instance. + * + * @return \Illuminate\Contracts\Container\Container + */ + public function getContainer() + { + return $this->container; + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function setContainer(Container $container) + { + $this->container = $container; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php b/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php new file mode 100644 index 0000000..3d0f122 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php @@ -0,0 +1,54 @@ +{$method}(...$parameters); + } catch (Error | BadMethodCallException $e) { + $pattern = '~^Call to undefined method (?P[^:]+)::(?P[^\(]+)\(\)$~'; + + if (! preg_match($pattern, $e->getMessage(), $matches)) { + throw $e; + } + + if ($matches['class'] != get_class($object) || + $matches['method'] != $method) { + throw $e; + } + + static::throwBadMethodCallException($method); + } + } + + /** + * Throw a bad method call exception for the given method. + * + * @param string $method + * @return void + * + * @throws \BadMethodCallException + */ + protected static function throwBadMethodCallException($method) + { + throw new BadMethodCallException(sprintf( + 'Call to undefined method %s::%s()', static::class, $method + )); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php b/vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php new file mode 100644 index 0000000..b03276d --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php @@ -0,0 +1,34 @@ +getLocale(); + + try { + $app->setLocale($locale); + + return $callback(); + } finally { + $app->setLocale($original); + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php b/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php new file mode 100644 index 0000000..80793cf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php @@ -0,0 +1,113 @@ +getMethods( + ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED + ); + + foreach ($methods as $method) { + $method->setAccessible(true); + + static::macro($method->name, $method->invoke($mixin)); + } + } + + /** + * Checks if macro is registered. + * + * @param string $name + * @return bool + */ + public static function hasMacro($name) + { + return isset(static::$macros[$name]); + } + + /** + * Dynamically handle calls to the class. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public static function __callStatic($method, $parameters) + { + if (! static::hasMacro($method)) { + throw new BadMethodCallException(sprintf( + 'Method %s::%s does not exist.', static::class, $method + )); + } + + if (static::$macros[$method] instanceof Closure) { + return call_user_func_array(Closure::bind(static::$macros[$method], null, static::class), $parameters); + } + + return call_user_func_array(static::$macros[$method], $parameters); + } + + /** + * Dynamically handle calls to the class. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (! static::hasMacro($method)) { + throw new BadMethodCallException(sprintf( + 'Method %s::%s does not exist.', static::class, $method + )); + } + + $macro = static::$macros[$method]; + + if ($macro instanceof Closure) { + return call_user_func_array($macro->bindTo($this, static::class), $parameters); + } + + return call_user_func_array($macro, $parameters); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/ViewErrorBag.php b/vendor/laravel/framework/src/Illuminate/Support/ViewErrorBag.php new file mode 100644 index 0000000..0f273b5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/ViewErrorBag.php @@ -0,0 +1,130 @@ +bags[$key]); + } + + /** + * Get a MessageBag instance from the bags. + * + * @param string $key + * @return \Illuminate\Contracts\Support\MessageBag + */ + public function getBag($key) + { + return Arr::get($this->bags, $key) ?: new MessageBag; + } + + /** + * Get all the bags. + * + * @return array + */ + public function getBags() + { + return $this->bags; + } + + /** + * Add a new MessageBag instance to the bags. + * + * @param string $key + * @param \Illuminate\Contracts\Support\MessageBag $bag + * @return $this + */ + public function put($key, MessageBagContract $bag) + { + $this->bags[$key] = $bag; + + return $this; + } + + /** + * Determine if the default message bag has any messages. + * + * @return bool + */ + public function any() + { + return $this->count() > 0; + } + + /** + * Get the number of messages in the default bag. + * + * @return int + */ + public function count() + { + return $this->getBag('default')->count(); + } + + /** + * Dynamically call methods on the default bag. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + return $this->getBag('default')->$method(...$parameters); + } + + /** + * Dynamically access a view error bag. + * + * @param string $key + * @return \Illuminate\Contracts\Support\MessageBag + */ + public function __get($key) + { + return $this->getBag($key); + } + + /** + * Dynamically set a view error bag. + * + * @param string $key + * @param \Illuminate\Contracts\Support\MessageBag $value + * @return void + */ + public function __set($key, $value) + { + $this->put($key, $value); + } + + /** + * Convert the default bag to its string representation. + * + * @return string + */ + public function __toString() + { + return (string) $this->getBag('default'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/composer.json b/vendor/laravel/framework/src/Illuminate/Support/composer.json new file mode 100644 index 0000000..d1efbcd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/composer.json @@ -0,0 +1,50 @@ +{ + "name": "illuminate/support", + "description": "The Illuminate Support package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "ext-mbstring": "*", + "doctrine/inflector": "^1.1", + "illuminate/contracts": "5.7.*", + "nesbot/carbon": "^1.26.3" + }, + "conflict": { + "tightenco/collect": "<5.5.33" + }, + "autoload": { + "psr-4": { + "Illuminate\\Support\\": "" + }, + "files": [ + "helpers.php" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "suggest": { + "illuminate/filesystem": "Required to use the composer class (5.7.*).", + "moontoast/math": "Required to use ordered UUIDs (^1.1).", + "ramsey/uuid": "Required to use Str::uuid() (^3.7).", + "symfony/process": "Required to use the composer class (^4.1).", + "symfony/var-dumper": "Required to use the dd function (^4.1)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Support/helpers.php b/vendor/laravel/framework/src/Illuminate/Support/helpers.php new file mode 100755 index 0000000..ed8926f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Support/helpers.php @@ -0,0 +1,1166 @@ + $value) { + if (is_numeric($key)) { + $start++; + + $array[$start] = Arr::pull($array, $key); + } + } + + return $array; + } +} + +if (! function_exists('array_add')) { + /** + * Add an element to an array using "dot" notation if it doesn't exist. + * + * @param array $array + * @param string $key + * @param mixed $value + * @return array + */ + function array_add($array, $key, $value) + { + return Arr::add($array, $key, $value); + } +} + +if (! function_exists('array_collapse')) { + /** + * Collapse an array of arrays into a single array. + * + * @param array $array + * @return array + */ + function array_collapse($array) + { + return Arr::collapse($array); + } +} + +if (! function_exists('array_divide')) { + /** + * Divide an array into two arrays. One with keys and the other with values. + * + * @param array $array + * @return array + */ + function array_divide($array) + { + return Arr::divide($array); + } +} + +if (! function_exists('array_dot')) { + /** + * Flatten a multi-dimensional associative array with dots. + * + * @param array $array + * @param string $prepend + * @return array + */ + function array_dot($array, $prepend = '') + { + return Arr::dot($array, $prepend); + } +} + +if (! function_exists('array_except')) { + /** + * Get all of the given array except for a specified array of keys. + * + * @param array $array + * @param array|string $keys + * @return array + */ + function array_except($array, $keys) + { + return Arr::except($array, $keys); + } +} + +if (! function_exists('array_first')) { + /** + * Return the first element in an array passing a given truth test. + * + * @param array $array + * @param callable|null $callback + * @param mixed $default + * @return mixed + */ + function array_first($array, callable $callback = null, $default = null) + { + return Arr::first($array, $callback, $default); + } +} + +if (! function_exists('array_flatten')) { + /** + * Flatten a multi-dimensional array into a single level. + * + * @param array $array + * @param int $depth + * @return array + */ + function array_flatten($array, $depth = INF) + { + return Arr::flatten($array, $depth); + } +} + +if (! function_exists('array_forget')) { + /** + * Remove one or many array items from a given array using "dot" notation. + * + * @param array $array + * @param array|string $keys + * @return void + */ + function array_forget(&$array, $keys) + { + return Arr::forget($array, $keys); + } +} + +if (! function_exists('array_get')) { + /** + * Get an item from an array using "dot" notation. + * + * @param \ArrayAccess|array $array + * @param string $key + * @param mixed $default + * @return mixed + */ + function array_get($array, $key, $default = null) + { + return Arr::get($array, $key, $default); + } +} + +if (! function_exists('array_has')) { + /** + * Check if an item or items exist in an array using "dot" notation. + * + * @param \ArrayAccess|array $array + * @param string|array $keys + * @return bool + */ + function array_has($array, $keys) + { + return Arr::has($array, $keys); + } +} + +if (! function_exists('array_last')) { + /** + * Return the last element in an array passing a given truth test. + * + * @param array $array + * @param callable|null $callback + * @param mixed $default + * @return mixed + */ + function array_last($array, callable $callback = null, $default = null) + { + return Arr::last($array, $callback, $default); + } +} + +if (! function_exists('array_only')) { + /** + * Get a subset of the items from the given array. + * + * @param array $array + * @param array|string $keys + * @return array + */ + function array_only($array, $keys) + { + return Arr::only($array, $keys); + } +} + +if (! function_exists('array_pluck')) { + /** + * Pluck an array of values from an array. + * + * @param array $array + * @param string|array $value + * @param string|array|null $key + * @return array + */ + function array_pluck($array, $value, $key = null) + { + return Arr::pluck($array, $value, $key); + } +} + +if (! function_exists('array_prepend')) { + /** + * Push an item onto the beginning of an array. + * + * @param array $array + * @param mixed $value + * @param mixed $key + * @return array + */ + function array_prepend($array, $value, $key = null) + { + return Arr::prepend($array, $value, $key); + } +} + +if (! function_exists('array_pull')) { + /** + * Get a value from the array, and remove it. + * + * @param array $array + * @param string $key + * @param mixed $default + * @return mixed + */ + function array_pull(&$array, $key, $default = null) + { + return Arr::pull($array, $key, $default); + } +} + +if (! function_exists('array_random')) { + /** + * Get a random value from an array. + * + * @param array $array + * @param int|null $num + * @return mixed + */ + function array_random($array, $num = null) + { + return Arr::random($array, $num); + } +} + +if (! function_exists('array_set')) { + /** + * Set an array item to a given value using "dot" notation. + * + * If no key is given to the method, the entire array will be replaced. + * + * @param array $array + * @param string $key + * @param mixed $value + * @return array + */ + function array_set(&$array, $key, $value) + { + return Arr::set($array, $key, $value); + } +} + +if (! function_exists('array_sort')) { + /** + * Sort the array by the given callback or attribute name. + * + * @param array $array + * @param callable|string|null $callback + * @return array + */ + function array_sort($array, $callback = null) + { + return Arr::sort($array, $callback); + } +} + +if (! function_exists('array_sort_recursive')) { + /** + * Recursively sort an array by keys and values. + * + * @param array $array + * @return array + */ + function array_sort_recursive($array) + { + return Arr::sortRecursive($array); + } +} + +if (! function_exists('array_where')) { + /** + * Filter the array using the given callback. + * + * @param array $array + * @param callable $callback + * @return array + */ + function array_where($array, callable $callback) + { + return Arr::where($array, $callback); + } +} + +if (! function_exists('array_wrap')) { + /** + * If the given value is not an array, wrap it in one. + * + * @param mixed $value + * @return array + */ + function array_wrap($value) + { + return Arr::wrap($value); + } +} + +if (! function_exists('blank')) { + /** + * Determine if the given value is "blank". + * + * @param mixed $value + * @return bool + */ + function blank($value) + { + if (is_null($value)) { + return true; + } + + if (is_string($value)) { + return trim($value) === ''; + } + + if (is_numeric($value) || is_bool($value)) { + return false; + } + + if ($value instanceof Countable) { + return count($value) === 0; + } + + return empty($value); + } +} + +if (! function_exists('camel_case')) { + /** + * Convert a value to camel case. + * + * @param string $value + * @return string + */ + function camel_case($value) + { + return Str::camel($value); + } +} + +if (! function_exists('class_basename')) { + /** + * Get the class "basename" of the given object / class. + * + * @param string|object $class + * @return string + */ + function class_basename($class) + { + $class = is_object($class) ? get_class($class) : $class; + + return basename(str_replace('\\', '/', $class)); + } +} + +if (! function_exists('class_uses_recursive')) { + /** + * Returns all traits used by a class, its parent classes and trait of their traits. + * + * @param object|string $class + * @return array + */ + function class_uses_recursive($class) + { + if (is_object($class)) { + $class = get_class($class); + } + + $results = []; + + foreach (array_reverse(class_parents($class)) + [$class => $class] as $class) { + $results += trait_uses_recursive($class); + } + + return array_unique($results); + } +} + +if (! function_exists('collect')) { + /** + * Create a collection from the given value. + * + * @param mixed $value + * @return \Illuminate\Support\Collection + */ + function collect($value = null) + { + return new Collection($value); + } +} + +if (! function_exists('data_fill')) { + /** + * Fill in data where it's missing. + * + * @param mixed $target + * @param string|array $key + * @param mixed $value + * @return mixed + */ + function data_fill(&$target, $key, $value) + { + return data_set($target, $key, $value, false); + } +} + +if (! function_exists('data_get')) { + /** + * Get an item from an array or object using "dot" notation. + * + * @param mixed $target + * @param string|array|int $key + * @param mixed $default + * @return mixed + */ + function data_get($target, $key, $default = null) + { + if (is_null($key)) { + return $target; + } + + $key = is_array($key) ? $key : explode('.', $key); + + while (! is_null($segment = array_shift($key))) { + if ($segment === '*') { + if ($target instanceof Collection) { + $target = $target->all(); + } elseif (! is_array($target)) { + return value($default); + } + + $result = []; + + foreach ($target as $item) { + $result[] = data_get($item, $key); + } + + return in_array('*', $key) ? Arr::collapse($result) : $result; + } + + if (Arr::accessible($target) && Arr::exists($target, $segment)) { + $target = $target[$segment]; + } elseif (is_object($target) && isset($target->{$segment})) { + $target = $target->{$segment}; + } else { + return value($default); + } + } + + return $target; + } +} + +if (! function_exists('data_set')) { + /** + * Set an item on an array or object using dot notation. + * + * @param mixed $target + * @param string|array $key + * @param mixed $value + * @param bool $overwrite + * @return mixed + */ + function data_set(&$target, $key, $value, $overwrite = true) + { + $segments = is_array($key) ? $key : explode('.', $key); + + if (($segment = array_shift($segments)) === '*') { + if (! Arr::accessible($target)) { + $target = []; + } + + if ($segments) { + foreach ($target as &$inner) { + data_set($inner, $segments, $value, $overwrite); + } + } elseif ($overwrite) { + foreach ($target as &$inner) { + $inner = $value; + } + } + } elseif (Arr::accessible($target)) { + if ($segments) { + if (! Arr::exists($target, $segment)) { + $target[$segment] = []; + } + + data_set($target[$segment], $segments, $value, $overwrite); + } elseif ($overwrite || ! Arr::exists($target, $segment)) { + $target[$segment] = $value; + } + } elseif (is_object($target)) { + if ($segments) { + if (! isset($target->{$segment})) { + $target->{$segment} = []; + } + + data_set($target->{$segment}, $segments, $value, $overwrite); + } elseif ($overwrite || ! isset($target->{$segment})) { + $target->{$segment} = $value; + } + } else { + $target = []; + + if ($segments) { + data_set($target[$segment], $segments, $value, $overwrite); + } elseif ($overwrite) { + $target[$segment] = $value; + } + } + + return $target; + } +} + +if (! function_exists('e')) { + /** + * Escape HTML special characters in a string. + * + * @param \Illuminate\Contracts\Support\Htmlable|string $value + * @param bool $doubleEncode + * @return string + */ + function e($value, $doubleEncode = true) + { + if ($value instanceof Htmlable) { + return $value->toHtml(); + } + + return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', $doubleEncode); + } +} + +if (! function_exists('ends_with')) { + /** + * Determine if a given string ends with a given substring. + * + * @param string $haystack + * @param string|array $needles + * @return bool + */ + function ends_with($haystack, $needles) + { + return Str::endsWith($haystack, $needles); + } +} + +if (! function_exists('env')) { + /** + * Gets the value of an environment variable. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + function env($key, $default = null) + { + $value = getenv($key); + + if ($value === false) { + return value($default); + } + + switch (strtolower($value)) { + case 'true': + case '(true)': + return true; + case 'false': + case '(false)': + return false; + case 'empty': + case '(empty)': + return ''; + case 'null': + case '(null)': + return; + } + + if (($valueLength = strlen($value)) > 1 && $value[0] === '"' && $value[$valueLength - 1] === '"') { + return substr($value, 1, -1); + } + + return $value; + } +} + +if (! function_exists('filled')) { + /** + * Determine if a value is "filled". + * + * @param mixed $value + * @return bool + */ + function filled($value) + { + return ! blank($value); + } +} + +if (! function_exists('head')) { + /** + * Get the first element of an array. Useful for method chaining. + * + * @param array $array + * @return mixed + */ + function head($array) + { + return reset($array); + } +} + +if (! function_exists('kebab_case')) { + /** + * Convert a string to kebab case. + * + * @param string $value + * @return string + */ + function kebab_case($value) + { + return Str::kebab($value); + } +} + +if (! function_exists('last')) { + /** + * Get the last element from an array. + * + * @param array $array + * @return mixed + */ + function last($array) + { + return end($array); + } +} + +if (! function_exists('object_get')) { + /** + * Get an item from an object using "dot" notation. + * + * @param object $object + * @param string $key + * @param mixed $default + * @return mixed + */ + function object_get($object, $key, $default = null) + { + if (is_null($key) || trim($key) == '') { + return $object; + } + + foreach (explode('.', $key) as $segment) { + if (! is_object($object) || ! isset($object->{$segment})) { + return value($default); + } + + $object = $object->{$segment}; + } + + return $object; + } +} + +if (! function_exists('optional')) { + /** + * Provide access to optional objects. + * + * @param mixed $value + * @param callable|null $callback + * @return mixed + */ + function optional($value = null, callable $callback = null) + { + if (is_null($callback)) { + return new Optional($value); + } elseif (! is_null($value)) { + return $callback($value); + } + } +} + +if (! function_exists('preg_replace_array')) { + /** + * Replace a given pattern with each value in the array in sequentially. + * + * @param string $pattern + * @param array $replacements + * @param string $subject + * @return string + */ + function preg_replace_array($pattern, array $replacements, $subject) + { + return preg_replace_callback($pattern, function () use (&$replacements) { + foreach ($replacements as $key => $value) { + return array_shift($replacements); + } + }, $subject); + } +} + +if (! function_exists('retry')) { + /** + * Retry an operation a given number of times. + * + * @param int $times + * @param callable $callback + * @param int $sleep + * @return mixed + * + * @throws \Exception + */ + function retry($times, callable $callback, $sleep = 0) + { + $times--; + + beginning: + try { + return $callback(); + } catch (Exception $e) { + if (! $times) { + throw $e; + } + + $times--; + + if ($sleep) { + usleep($sleep * 1000); + } + + goto beginning; + } + } +} + +if (! function_exists('snake_case')) { + /** + * Convert a string to snake case. + * + * @param string $value + * @param string $delimiter + * @return string + */ + function snake_case($value, $delimiter = '_') + { + return Str::snake($value, $delimiter); + } +} + +if (! function_exists('starts_with')) { + /** + * Determine if a given string starts with a given substring. + * + * @param string $haystack + * @param string|array $needles + * @return bool + */ + function starts_with($haystack, $needles) + { + return Str::startsWith($haystack, $needles); + } +} + +if (! function_exists('str_after')) { + /** + * Return the remainder of a string after a given value. + * + * @param string $subject + * @param string $search + * @return string + */ + function str_after($subject, $search) + { + return Str::after($subject, $search); + } +} + +if (! function_exists('str_before')) { + /** + * Get the portion of a string before a given value. + * + * @param string $subject + * @param string $search + * @return string + */ + function str_before($subject, $search) + { + return Str::before($subject, $search); + } +} + +if (! function_exists('str_contains')) { + /** + * Determine if a given string contains a given substring. + * + * @param string $haystack + * @param string|array $needles + * @return bool + */ + function str_contains($haystack, $needles) + { + return Str::contains($haystack, $needles); + } +} + +if (! function_exists('str_finish')) { + /** + * Cap a string with a single instance of a given value. + * + * @param string $value + * @param string $cap + * @return string + */ + function str_finish($value, $cap) + { + return Str::finish($value, $cap); + } +} + +if (! function_exists('str_is')) { + /** + * Determine if a given string matches a given pattern. + * + * @param string|array $pattern + * @param string $value + * @return bool + */ + function str_is($pattern, $value) + { + return Str::is($pattern, $value); + } +} + +if (! function_exists('str_limit')) { + /** + * Limit the number of characters in a string. + * + * @param string $value + * @param int $limit + * @param string $end + * @return string + */ + function str_limit($value, $limit = 100, $end = '...') + { + return Str::limit($value, $limit, $end); + } +} + +if (! function_exists('str_plural')) { + /** + * Get the plural form of an English word. + * + * @param string $value + * @param int $count + * @return string + */ + function str_plural($value, $count = 2) + { + return Str::plural($value, $count); + } +} + +if (! function_exists('str_random')) { + /** + * Generate a more truly "random" alpha-numeric string. + * + * @param int $length + * @return string + * + * @throws \RuntimeException + */ + function str_random($length = 16) + { + return Str::random($length); + } +} + +if (! function_exists('str_replace_array')) { + /** + * Replace a given value in the string sequentially with an array. + * + * @param string $search + * @param array $replace + * @param string $subject + * @return string + */ + function str_replace_array($search, array $replace, $subject) + { + return Str::replaceArray($search, $replace, $subject); + } +} + +if (! function_exists('str_replace_first')) { + /** + * Replace the first occurrence of a given value in the string. + * + * @param string $search + * @param string $replace + * @param string $subject + * @return string + */ + function str_replace_first($search, $replace, $subject) + { + return Str::replaceFirst($search, $replace, $subject); + } +} + +if (! function_exists('str_replace_last')) { + /** + * Replace the last occurrence of a given value in the string. + * + * @param string $search + * @param string $replace + * @param string $subject + * @return string + */ + function str_replace_last($search, $replace, $subject) + { + return Str::replaceLast($search, $replace, $subject); + } +} + +if (! function_exists('str_singular')) { + /** + * Get the singular form of an English word. + * + * @param string $value + * @return string + */ + function str_singular($value) + { + return Str::singular($value); + } +} + +if (! function_exists('str_slug')) { + /** + * Generate a URL friendly "slug" from a given string. + * + * @param string $title + * @param string $separator + * @param string $language + * @return string + */ + function str_slug($title, $separator = '-', $language = 'en') + { + return Str::slug($title, $separator, $language); + } +} + +if (! function_exists('str_start')) { + /** + * Begin a string with a single instance of a given value. + * + * @param string $value + * @param string $prefix + * @return string + */ + function str_start($value, $prefix) + { + return Str::start($value, $prefix); + } +} + +if (! function_exists('studly_case')) { + /** + * Convert a value to studly caps case. + * + * @param string $value + * @return string + */ + function studly_case($value) + { + return Str::studly($value); + } +} + +if (! function_exists('tap')) { + /** + * Call the given Closure with the given value then return the value. + * + * @param mixed $value + * @param callable|null $callback + * @return mixed + */ + function tap($value, $callback = null) + { + if (is_null($callback)) { + return new HigherOrderTapProxy($value); + } + + $callback($value); + + return $value; + } +} + +if (! function_exists('throw_if')) { + /** + * Throw the given exception if the given condition is true. + * + * @param mixed $condition + * @param \Throwable|string $exception + * @param array ...$parameters + * @return mixed + * + * @throws \Throwable + */ + function throw_if($condition, $exception, ...$parameters) + { + if ($condition) { + throw (is_string($exception) ? new $exception(...$parameters) : $exception); + } + + return $condition; + } +} + +if (! function_exists('throw_unless')) { + /** + * Throw the given exception unless the given condition is true. + * + * @param mixed $condition + * @param \Throwable|string $exception + * @param array ...$parameters + * @return mixed + * @throws \Throwable + */ + function throw_unless($condition, $exception, ...$parameters) + { + if (! $condition) { + throw (is_string($exception) ? new $exception(...$parameters) : $exception); + } + + return $condition; + } +} + +if (! function_exists('title_case')) { + /** + * Convert a value to title case. + * + * @param string $value + * @return string + */ + function title_case($value) + { + return Str::title($value); + } +} + +if (! function_exists('trait_uses_recursive')) { + /** + * Returns all traits used by a trait and its traits. + * + * @param string $trait + * @return array + */ + function trait_uses_recursive($trait) + { + $traits = class_uses($trait); + + foreach ($traits as $trait) { + $traits += trait_uses_recursive($trait); + } + + return $traits; + } +} + +if (! function_exists('transform')) { + /** + * Transform the given value if it is present. + * + * @param mixed $value + * @param callable $callback + * @param mixed $default + * @return mixed|null + */ + function transform($value, callable $callback, $default = null) + { + if (filled($value)) { + return $callback($value); + } + + if (is_callable($default)) { + return $default($value); + } + + return $default; + } +} + +if (! function_exists('value')) { + /** + * Return the default value of the given value. + * + * @param mixed $value + * @return mixed + */ + function value($value) + { + return $value instanceof Closure ? $value() : $value; + } +} + +if (! function_exists('windows_os')) { + /** + * Determine whether the current environment is Windows based. + * + * @return bool + */ + function windows_os() + { + return strtolower(substr(PHP_OS, 0, 3)) === 'win'; + } +} + +if (! function_exists('with')) { + /** + * Return the given value, optionally passed through the given callback. + * + * @param mixed $value + * @param callable|null $callback + * @return mixed + */ + function with($value, callable $callback = null) + { + return is_null($callback) ? $value : $callback($value); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Translation/ArrayLoader.php b/vendor/laravel/framework/src/Illuminate/Translation/ArrayLoader.php new file mode 100644 index 0000000..47482d4 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Translation/ArrayLoader.php @@ -0,0 +1,85 @@ +messages[$namespace][$locale][$group])) { + return $this->messages[$namespace][$locale][$group]; + } + + return []; + } + + /** + * Add a new namespace to the loader. + * + * @param string $namespace + * @param string $hint + * @return void + */ + public function addNamespace($namespace, $hint) + { + // + } + + /** + * Add a new JSON path to the loader. + * + * @param string $path + * @return void + */ + public function addJsonPath($path) + { + // + } + + /** + * Add messages to the loader. + * + * @param string $locale + * @param string $group + * @param array $messages + * @param string|null $namespace + * @return $this + */ + public function addMessages($locale, $group, array $messages, $namespace = null) + { + $namespace = $namespace ?: '*'; + + $this->messages[$namespace][$locale][$group] = $messages; + + return $this; + } + + /** + * Get an array of all the registered namespaces. + * + * @return array + */ + public function namespaces() + { + return []; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php b/vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php new file mode 100755 index 0000000..d2d21d2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php @@ -0,0 +1,187 @@ +path = $path; + $this->files = $files; + } + + /** + * Load the messages for the given locale. + * + * @param string $locale + * @param string $group + * @param string $namespace + * @return array + */ + public function load($locale, $group, $namespace = null) + { + if ($group === '*' && $namespace === '*') { + return $this->loadJsonPaths($locale); + } + + if (is_null($namespace) || $namespace === '*') { + return $this->loadPath($this->path, $locale, $group); + } + + return $this->loadNamespaced($locale, $group, $namespace); + } + + /** + * Load a namespaced translation group. + * + * @param string $locale + * @param string $group + * @param string $namespace + * @return array + */ + protected function loadNamespaced($locale, $group, $namespace) + { + if (isset($this->hints[$namespace])) { + $lines = $this->loadPath($this->hints[$namespace], $locale, $group); + + return $this->loadNamespaceOverrides($lines, $locale, $group, $namespace); + } + + return []; + } + + /** + * Load a local namespaced translation group for overrides. + * + * @param array $lines + * @param string $locale + * @param string $group + * @param string $namespace + * @return array + */ + protected function loadNamespaceOverrides(array $lines, $locale, $group, $namespace) + { + $file = "{$this->path}/vendor/{$namespace}/{$locale}/{$group}.php"; + + if ($this->files->exists($file)) { + return array_replace_recursive($lines, $this->files->getRequire($file)); + } + + return $lines; + } + + /** + * Load a locale from a given path. + * + * @param string $path + * @param string $locale + * @param string $group + * @return array + */ + protected function loadPath($path, $locale, $group) + { + if ($this->files->exists($full = "{$path}/{$locale}/{$group}.php")) { + return $this->files->getRequire($full); + } + + return []; + } + + /** + * Load a locale from the given JSON file path. + * + * @param string $locale + * @return array + * + * @throws \RuntimeException + */ + protected function loadJsonPaths($locale) + { + return collect(array_merge($this->jsonPaths, [$this->path])) + ->reduce(function ($output, $path) use ($locale) { + if ($this->files->exists($full = "{$path}/{$locale}.json")) { + $decoded = json_decode($this->files->get($full), true); + + if (is_null($decoded) || json_last_error() !== JSON_ERROR_NONE) { + throw new RuntimeException("Translation file [{$full}] contains an invalid JSON structure."); + } + + $output = array_merge($output, $decoded); + } + + return $output; + }, []); + } + + /** + * Add a new namespace to the loader. + * + * @param string $namespace + * @param string $hint + * @return void + */ + public function addNamespace($namespace, $hint) + { + $this->hints[$namespace] = $hint; + } + + /** + * Add a new JSON path to the loader. + * + * @param string $path + * @return void + */ + public function addJsonPath($path) + { + $this->jsonPaths[] = $path; + } + + /** + * Get an array of all the registered namespaces. + * + * @return array + */ + public function namespaces() + { + return $this->hints; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Translation/MessageSelector.php b/vendor/laravel/framework/src/Illuminate/Translation/MessageSelector.php new file mode 100755 index 0000000..3f63a53 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Translation/MessageSelector.php @@ -0,0 +1,412 @@ +extract($segments, $number)) !== null) { + return trim($value); + } + + $segments = $this->stripConditions($segments); + + $pluralIndex = $this->getPluralIndex($locale, $number); + + if (count($segments) === 1 || ! isset($segments[$pluralIndex])) { + return $segments[0]; + } + + return $segments[$pluralIndex]; + } + + /** + * Extract a translation string using inline conditions. + * + * @param array $segments + * @param int $number + * @return mixed + */ + private function extract($segments, $number) + { + foreach ($segments as $part) { + if (! is_null($line = $this->extractFromString($part, $number))) { + return $line; + } + } + } + + /** + * Get the translation string if the condition matches. + * + * @param string $part + * @param int $number + * @return mixed + */ + private function extractFromString($part, $number) + { + preg_match('/^[\{\[]([^\[\]\{\}]*)[\}\]](.*)/s', $part, $matches); + + if (count($matches) !== 3) { + return; + } + + $condition = $matches[1]; + + $value = $matches[2]; + + if (Str::contains($condition, ',')) { + [$from, $to] = explode(',', $condition, 2); + + if ($to === '*' && $number >= $from) { + return $value; + } elseif ($from === '*' && $number <= $to) { + return $value; + } elseif ($number >= $from && $number <= $to) { + return $value; + } + } + + return $condition == $number ? $value : null; + } + + /** + * Strip the inline conditions from each segment, just leaving the text. + * + * @param array $segments + * @return array + */ + private function stripConditions($segments) + { + return collect($segments)->map(function ($part) { + return preg_replace('/^[\{\[]([^\[\]\{\}]*)[\}\]]/', '', $part); + })->all(); + } + + /** + * Get the index to use for pluralization. + * + * The plural rules are derived from code of the Zend Framework (2010-09-25), which + * is subject to the new BSD license (http://framework.zend.com/license/new-bsd) + * Copyright (c) 2005-2010 - Zend Technologies USA Inc. (http://www.zend.com) + * + * @param string $locale + * @param int $number + * @return int + */ + public function getPluralIndex($locale, $number) + { + switch ($locale) { + case 'az': + case 'az_AZ': + case 'bo': + case 'bo_CN': + case 'bo_IN': + case 'dz': + case 'dz_BT': + case 'id': + case 'id_ID': + case 'ja': + case 'ja_JP': + case 'jv': + case 'ka': + case 'ka_GE': + case 'km': + case 'km_KH': + case 'kn': + case 'kn_IN': + case 'ko': + case 'ko_KR': + case 'ms': + case 'ms_MY': + case 'th': + case 'th_TH': + case 'tr': + case 'tr_CY': + case 'tr_TR': + case 'vi': + case 'vi_VN': + case 'zh': + case 'zh_CN': + case 'zh_HK': + case 'zh_SG': + case 'zh_TW': + return 0; + case 'af': + case 'af_ZA': + case 'bn': + case 'bn_BD': + case 'bn_IN': + case 'bg': + case 'bg_BG': + case 'ca': + case 'ca_AD': + case 'ca_ES': + case 'ca_FR': + case 'ca_IT': + case 'da': + case 'da_DK': + case 'de': + case 'de_AT': + case 'de_BE': + case 'de_CH': + case 'de_DE': + case 'de_LI': + case 'de_LU': + case 'el': + case 'el_CY': + case 'el_GR': + case 'en': + case 'en_AG': + case 'en_AU': + case 'en_BW': + case 'en_CA': + case 'en_DK': + case 'en_GB': + case 'en_HK': + case 'en_IE': + case 'en_IN': + case 'en_NG': + case 'en_NZ': + case 'en_PH': + case 'en_SG': + case 'en_US': + case 'en_ZA': + case 'en_ZM': + case 'en_ZW': + case 'eo': + case 'eo_US': + case 'es': + case 'es_AR': + case 'es_BO': + case 'es_CL': + case 'es_CO': + case 'es_CR': + case 'es_CU': + case 'es_DO': + case 'es_EC': + case 'es_ES': + case 'es_GT': + case 'es_HN': + case 'es_MX': + case 'es_NI': + case 'es_PA': + case 'es_PE': + case 'es_PR': + case 'es_PY': + case 'es_SV': + case 'es_US': + case 'es_UY': + case 'es_VE': + case 'et': + case 'et_EE': + case 'eu': + case 'eu_ES': + case 'eu_FR': + case 'fa': + case 'fa_IR': + case 'fi': + case 'fi_FI': + case 'fo': + case 'fo_FO': + case 'fur': + case 'fur_IT': + case 'fy': + case 'fy_DE': + case 'fy_NL': + case 'gl': + case 'gl_ES': + case 'gu': + case 'gu_IN': + case 'ha': + case 'ha_NG': + case 'he': + case 'he_IL': + case 'hu': + case 'hu_HU': + case 'is': + case 'is_IS': + case 'it': + case 'it_CH': + case 'it_IT': + case 'ku': + case 'ku_TR': + case 'lb': + case 'lb_LU': + case 'ml': + case 'ml_IN': + case 'mn': + case 'mn_MN': + case 'mr': + case 'mr_IN': + case 'nah': + case 'nb': + case 'nb_NO': + case 'ne': + case 'ne_NP': + case 'nl': + case 'nl_AW': + case 'nl_BE': + case 'nl_NL': + case 'nn': + case 'nn_NO': + case 'no': + case 'om': + case 'om_ET': + case 'om_KE': + case 'or': + case 'or_IN': + case 'pa': + case 'pa_IN': + case 'pa_PK': + case 'pap': + case 'pap_AN': + case 'pap_AW': + case 'pap_CW': + case 'ps': + case 'ps_AF': + case 'pt': + case 'pt_BR': + case 'pt_PT': + case 'so': + case 'so_DJ': + case 'so_ET': + case 'so_KE': + case 'so_SO': + case 'sq': + case 'sq_AL': + case 'sq_MK': + case 'sv': + case 'sv_FI': + case 'sv_SE': + case 'sw': + case 'sw_KE': + case 'sw_TZ': + case 'ta': + case 'ta_IN': + case 'ta_LK': + case 'te': + case 'te_IN': + case 'tk': + case 'tk_TM': + case 'ur': + case 'ur_IN': + case 'ur_PK': + case 'zu': + case 'zu_ZA': + return ($number == 1) ? 0 : 1; + case 'am': + case 'am_ET': + case 'bh': + case 'fil': + case 'fil_PH': + case 'fr': + case 'fr_BE': + case 'fr_CA': + case 'fr_CH': + case 'fr_FR': + case 'fr_LU': + case 'gun': + case 'hi': + case 'hi_IN': + case 'hy': + case 'hy_AM': + case 'ln': + case 'ln_CD': + case 'mg': + case 'mg_MG': + case 'nso': + case 'nso_ZA': + case 'ti': + case 'ti_ER': + case 'ti_ET': + case 'wa': + case 'wa_BE': + case 'xbr': + return (($number == 0) || ($number == 1)) ? 0 : 1; + case 'be': + case 'be_BY': + case 'bs': + case 'bs_BA': + case 'hr': + case 'hr_HR': + case 'ru': + case 'ru_RU': + case 'ru_UA': + case 'sr': + case 'sr_ME': + case 'sr_RS': + case 'uk': + case 'uk_UA': + return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); + case 'cs': + case 'cs_CZ': + case 'sk': + case 'sk_SK': + return ($number == 1) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2); + case 'ga': + case 'ga_IE': + return ($number == 1) ? 0 : (($number == 2) ? 1 : 2); + case 'lt': + case 'lt_LT': + return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); + case 'sl': + case 'sl_SI': + return ($number % 100 == 1) ? 0 : (($number % 100 == 2) ? 1 : ((($number % 100 == 3) || ($number % 100 == 4)) ? 2 : 3)); + case 'mk': + case 'mk_MK': + return ($number % 10 == 1) ? 0 : 1; + case 'mt': + case 'mt_MT': + return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3)); + case 'lv': + case 'lv_LV': + return ($number == 0) ? 0 : ((($number % 10 == 1) && ($number % 100 != 11)) ? 1 : 2); + case 'pl': + case 'pl_PL': + return ($number == 1) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2); + case 'cy': + case 'cy_GB': + return ($number == 1) ? 0 : (($number == 2) ? 1 : ((($number == 8) || ($number == 11)) ? 2 : 3)); + case 'ro': + case 'ro_RO': + return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2); + case 'ar': + case 'ar_AE': + case 'ar_BH': + case 'ar_DZ': + case 'ar_EG': + case 'ar_IN': + case 'ar_IQ': + case 'ar_JO': + case 'ar_KW': + case 'ar_LB': + case 'ar_LY': + case 'ar_MA': + case 'ar_OM': + case 'ar_QA': + case 'ar_SA': + case 'ar_SD': + case 'ar_SS': + case 'ar_SY': + case 'ar_TN': + case 'ar_YE': + return ($number == 0) ? 0 : (($number == 1) ? 1 : (($number == 2) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5)))); + default: + return 0; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Translation/TranslationServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Translation/TranslationServiceProvider.php new file mode 100755 index 0000000..f0dd3fe --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Translation/TranslationServiceProvider.php @@ -0,0 +1,62 @@ +registerLoader(); + + $this->app->singleton('translator', function ($app) { + $loader = $app['translation.loader']; + + // When registering the translator component, we'll need to set the default + // locale as well as the fallback locale. So, we'll grab the application + // configuration so we can easily get both of these values from there. + $locale = $app['config']['app.locale']; + + $trans = new Translator($loader, $locale); + + $trans->setFallback($app['config']['app.fallback_locale']); + + return $trans; + }); + } + + /** + * Register the translation line loader. + * + * @return void + */ + protected function registerLoader() + { + $this->app->singleton('translation.loader', function ($app) { + return new FileLoader($app['files'], $app['path.lang']); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['translator', 'translation.loader']; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Translation/Translator.php b/vendor/laravel/framework/src/Illuminate/Translation/Translator.php new file mode 100755 index 0000000..49d79d7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Translation/Translator.php @@ -0,0 +1,490 @@ +loader = $loader; + $this->locale = $locale; + } + + /** + * Determine if a translation exists for a given locale. + * + * @param string $key + * @param string|null $locale + * @return bool + */ + public function hasForLocale($key, $locale = null) + { + return $this->has($key, $locale, false); + } + + /** + * Determine if a translation exists. + * + * @param string $key + * @param string|null $locale + * @param bool $fallback + * @return bool + */ + public function has($key, $locale = null, $fallback = true) + { + return $this->get($key, [], $locale, $fallback) !== $key; + } + + /** + * Get the translation for a given key. + * + * @param string $key + * @param array $replace + * @param string $locale + * @return string|array + */ + public function trans($key, array $replace = [], $locale = null) + { + return $this->get($key, $replace, $locale); + } + + /** + * Get the translation for the given key. + * + * @param string $key + * @param array $replace + * @param string|null $locale + * @param bool $fallback + * @return string|array + */ + public function get($key, array $replace = [], $locale = null, $fallback = true) + { + [$namespace, $group, $item] = $this->parseKey($key); + + // Here we will get the locale that should be used for the language line. If one + // was not passed, we will use the default locales which was given to us when + // the translator was instantiated. Then, we can load the lines and return. + $locales = $fallback ? $this->localeArray($locale) + : [$locale ?: $this->locale]; + + foreach ($locales as $locale) { + if (! is_null($line = $this->getLine( + $namespace, $group, $locale, $item, $replace + ))) { + break; + } + } + + // If the line doesn't exist, we will return back the key which was requested as + // that will be quick to spot in the UI if language keys are wrong or missing + // from the application's language files. Otherwise we can return the line. + if (isset($line)) { + return $line; + } + + return $key; + } + + /** + * Get the translation for a given key from the JSON translation files. + * + * @param string $key + * @param array $replace + * @param string $locale + * @return string|array + */ + public function getFromJson($key, array $replace = [], $locale = null) + { + $locale = $locale ?: $this->locale; + + // For JSON translations, there is only one file per locale, so we will simply load + // that file and then we will be ready to check the array for the key. These are + // only one level deep so we do not need to do any fancy searching through it. + $this->load('*', '*', $locale); + + $line = $this->loaded['*']['*'][$locale][$key] ?? null; + + // If we can't find a translation for the JSON key, we will attempt to translate it + // using the typical translation file. This way developers can always just use a + // helper such as __ instead of having to pick between trans or __ with views. + if (! isset($line)) { + $fallback = $this->get($key, $replace, $locale); + + if ($fallback !== $key) { + return $fallback; + } + } + + return $this->makeReplacements($line ?: $key, $replace); + } + + /** + * Get a translation according to an integer value. + * + * @param string $key + * @param int|array|\Countable $number + * @param array $replace + * @param string $locale + * @return string + */ + public function transChoice($key, $number, array $replace = [], $locale = null) + { + return $this->choice($key, $number, $replace, $locale); + } + + /** + * Get a translation according to an integer value. + * + * @param string $key + * @param int|array|\Countable $number + * @param array $replace + * @param string $locale + * @return string + */ + public function choice($key, $number, array $replace = [], $locale = null) + { + $line = $this->get( + $key, $replace, $locale = $this->localeForChoice($locale) + ); + + // If the given "number" is actually an array or countable we will simply count the + // number of elements in an instance. This allows developers to pass an array of + // items without having to count it on their end first which gives bad syntax. + if (is_array($number) || $number instanceof Countable) { + $number = count($number); + } + + $replace['count'] = $number; + + return $this->makeReplacements( + $this->getSelector()->choose($line, $number, $locale), $replace + ); + } + + /** + * Get the proper locale for a choice operation. + * + * @param string|null $locale + * @return string + */ + protected function localeForChoice($locale) + { + return $locale ?: $this->locale ?: $this->fallback; + } + + /** + * Retrieve a language line out the loaded array. + * + * @param string $namespace + * @param string $group + * @param string $locale + * @param string $item + * @param array $replace + * @return string|array|null + */ + protected function getLine($namespace, $group, $locale, $item, array $replace) + { + $this->load($namespace, $group, $locale); + + $line = Arr::get($this->loaded[$namespace][$group][$locale], $item); + + if (is_string($line)) { + return $this->makeReplacements($line, $replace); + } elseif (is_array($line) && count($line) > 0) { + return $line; + } + } + + /** + * Make the place-holder replacements on a line. + * + * @param string $line + * @param array $replace + * @return string + */ + protected function makeReplacements($line, array $replace) + { + if (empty($replace)) { + return $line; + } + + $replace = $this->sortReplacements($replace); + + foreach ($replace as $key => $value) { + $line = str_replace( + [':'.$key, ':'.Str::upper($key), ':'.Str::ucfirst($key)], + [$value, Str::upper($value), Str::ucfirst($value)], + $line + ); + } + + return $line; + } + + /** + * Sort the replacements array. + * + * @param array $replace + * @return array + */ + protected function sortReplacements(array $replace) + { + return (new Collection($replace))->sortBy(function ($value, $key) { + return mb_strlen($key) * -1; + })->all(); + } + + /** + * Add translation lines to the given locale. + * + * @param array $lines + * @param string $locale + * @param string $namespace + * @return void + */ + public function addLines(array $lines, $locale, $namespace = '*') + { + foreach ($lines as $key => $value) { + [$group, $item] = explode('.', $key, 2); + + Arr::set($this->loaded, "$namespace.$group.$locale.$item", $value); + } + } + + /** + * Load the specified language group. + * + * @param string $namespace + * @param string $group + * @param string $locale + * @return void + */ + public function load($namespace, $group, $locale) + { + if ($this->isLoaded($namespace, $group, $locale)) { + return; + } + + // The loader is responsible for returning the array of language lines for the + // given namespace, group, and locale. We'll set the lines in this array of + // lines that have already been loaded so that we can easily access them. + $lines = $this->loader->load($locale, $group, $namespace); + + $this->loaded[$namespace][$group][$locale] = $lines; + } + + /** + * Determine if the given group has been loaded. + * + * @param string $namespace + * @param string $group + * @param string $locale + * @return bool + */ + protected function isLoaded($namespace, $group, $locale) + { + return isset($this->loaded[$namespace][$group][$locale]); + } + + /** + * Add a new namespace to the loader. + * + * @param string $namespace + * @param string $hint + * @return void + */ + public function addNamespace($namespace, $hint) + { + $this->loader->addNamespace($namespace, $hint); + } + + /** + * Add a new JSON path to the loader. + * + * @param string $path + * @return void + */ + public function addJsonPath($path) + { + $this->loader->addJsonPath($path); + } + + /** + * Parse a key into namespace, group, and item. + * + * @param string $key + * @return array + */ + public function parseKey($key) + { + $segments = parent::parseKey($key); + + if (is_null($segments[0])) { + $segments[0] = '*'; + } + + return $segments; + } + + /** + * Get the array of locales to be checked. + * + * @param string|null $locale + * @return array + */ + protected function localeArray($locale) + { + return array_filter([$locale ?: $this->locale, $this->fallback]); + } + + /** + * Get the message selector instance. + * + * @return \Illuminate\Translation\MessageSelector + */ + public function getSelector() + { + if (! isset($this->selector)) { + $this->selector = new MessageSelector; + } + + return $this->selector; + } + + /** + * Set the message selector instance. + * + * @param \Illuminate\Translation\MessageSelector $selector + * @return void + */ + public function setSelector(MessageSelector $selector) + { + $this->selector = $selector; + } + + /** + * Get the language line loader implementation. + * + * @return \Illuminate\Contracts\Translation\Loader + */ + public function getLoader() + { + return $this->loader; + } + + /** + * Get the default locale being used. + * + * @return string + */ + public function locale() + { + return $this->getLocale(); + } + + /** + * Get the default locale being used. + * + * @return string + */ + public function getLocale() + { + return $this->locale; + } + + /** + * Set the default locale. + * + * @param string $locale + * @return void + */ + public function setLocale($locale) + { + $this->locale = $locale; + } + + /** + * Get the fallback locale being used. + * + * @return string + */ + public function getFallback() + { + return $this->fallback; + } + + /** + * Set the fallback locale being used. + * + * @param string $fallback + * @return void + */ + public function setFallback($fallback) + { + $this->fallback = $fallback; + } + + /** + * Set the loaded translation groups. + * + * @param array $loaded + * @return void + */ + public function setLoaded(array $loaded) + { + $this->loaded = $loaded; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Translation/composer.json b/vendor/laravel/framework/src/Illuminate/Translation/composer.json new file mode 100755 index 0000000..d8784d7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Translation/composer.json @@ -0,0 +1,36 @@ +{ + "name": "illuminate/translation", + "description": "The Illuminate Translation package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/contracts": "5.7.*", + "illuminate/filesystem": "5.7.*", + "illuminate/support": "5.7.*" + }, + "autoload": { + "psr-4": { + "Illuminate\\Translation\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/ClosureValidationRule.php b/vendor/laravel/framework/src/Illuminate/Validation/ClosureValidationRule.php new file mode 100644 index 0000000..8f247fc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/ClosureValidationRule.php @@ -0,0 +1,70 @@ +callback = $callback; + } + + /** + * Determine if the validation rule passes. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function passes($attribute, $value) + { + $this->failed = false; + + $this->callback->__invoke($attribute, $value, function ($message) { + $this->failed = true; + + $this->message = $message; + }); + + return ! $this->failed; + } + + /** + * Get the validation error message. + * + * @return string + */ + public function message() + { + return $this->message; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Concerns/FormatsMessages.php b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/FormatsMessages.php new file mode 100644 index 0000000..c3dc576 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/FormatsMessages.php @@ -0,0 +1,384 @@ +getInlineMessage($attribute, $rule); + + // First we will retrieve the custom message for the validation rule if one + // exists. If a custom validation message is being used we'll return the + // custom message, otherwise we'll keep searching for a valid message. + if (! is_null($inlineMessage)) { + return $inlineMessage; + } + + $lowerRule = Str::snake($rule); + + $customMessage = $this->getCustomMessageFromTranslator( + $customKey = "validation.custom.{$attribute}.{$lowerRule}" + ); + + // First we check for a custom defined validation message for the attribute + // and rule. This allows the developer to specify specific messages for + // only some attributes and rules that need to get specially formed. + if ($customMessage !== $customKey) { + return $customMessage; + } + + // If the rule being validated is a "size" rule, we will need to gather the + // specific error message for the type of attribute being validated such + // as a number, file or string which all have different message types. + elseif (in_array($rule, $this->sizeRules)) { + return $this->getSizeMessage($attribute, $rule); + } + + // Finally, if no developer specified messages have been set, and no other + // special messages apply for this rule, we will just pull the default + // messages out of the translator service for this validation rule. + $key = "validation.{$lowerRule}"; + + if ($key != ($value = $this->translator->trans($key))) { + return $value; + } + + return $this->getFromLocalArray( + $attribute, $lowerRule, $this->fallbackMessages + ) ?: $key; + } + + /** + * Get the proper inline error message for standard and size rules. + * + * @param string $attribute + * @param string $rule + * @return string|null + */ + protected function getInlineMessage($attribute, $rule) + { + $inlineEntry = $this->getFromLocalArray($attribute, Str::snake($rule)); + + return is_array($inlineEntry) && in_array($rule, $this->sizeRules) + ? $inlineEntry[$this->getAttributeType($attribute)] + : $inlineEntry; + } + + /** + * Get the inline message for a rule if it exists. + * + * @param string $attribute + * @param string $lowerRule + * @param array|null $source + * @return string|null + */ + protected function getFromLocalArray($attribute, $lowerRule, $source = null) + { + $source = $source ?: $this->customMessages; + + $keys = ["{$attribute}.{$lowerRule}", $lowerRule]; + + // First we will check for a custom message for an attribute specific rule + // message for the fields, then we will check for a general custom line + // that is not attribute specific. If we find either we'll return it. + foreach ($keys as $key) { + foreach (array_keys($source) as $sourceKey) { + if (Str::is($sourceKey, $key)) { + return $source[$sourceKey]; + } + } + } + } + + /** + * Get the custom error message from translator. + * + * @param string $key + * @return string + */ + protected function getCustomMessageFromTranslator($key) + { + if (($message = $this->translator->trans($key)) !== $key) { + return $message; + } + + // If an exact match was not found for the key, we will collapse all of these + // messages and loop through them and try to find a wildcard match for the + // given key. Otherwise, we will simply return the key's value back out. + $shortKey = preg_replace( + '/^validation\.custom\./', '', $key + ); + + return $this->getWildcardCustomMessages(Arr::dot( + (array) $this->translator->trans('validation.custom') + ), $shortKey, $key); + } + + /** + * Check the given messages for a wildcard key. + * + * @param array $messages + * @param string $search + * @param string $default + * @return string + */ + protected function getWildcardCustomMessages($messages, $search, $default) + { + foreach ($messages as $key => $message) { + if ($search === $key || (Str::contains($key, ['*']) && Str::is($key, $search))) { + return $message; + } + } + + return $default; + } + + /** + * Get the proper error message for an attribute and size rule. + * + * @param string $attribute + * @param string $rule + * @return string + */ + protected function getSizeMessage($attribute, $rule) + { + $lowerRule = Str::snake($rule); + + // There are three different types of size validations. The attribute may be + // either a number, file, or string so we will check a few things to know + // which type of value it is and return the correct line for that type. + $type = $this->getAttributeType($attribute); + + $key = "validation.{$lowerRule}.{$type}"; + + return $this->translator->trans($key); + } + + /** + * Get the data type of the given attribute. + * + * @param string $attribute + * @return string + */ + protected function getAttributeType($attribute) + { + // We assume that the attributes present in the file array are files so that + // means that if the attribute does not have a numeric rule and the files + // list doesn't have it we'll just consider it a string by elimination. + if ($this->hasRule($attribute, $this->numericRules)) { + return 'numeric'; + } elseif ($this->hasRule($attribute, ['Array'])) { + return 'array'; + } elseif ($this->getValue($attribute) instanceof UploadedFile) { + return 'file'; + } + + return 'string'; + } + + /** + * Replace all error message place-holders with actual values. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + public function makeReplacements($message, $attribute, $rule, $parameters) + { + $message = $this->replaceAttributePlaceholder( + $message, $this->getDisplayableAttribute($attribute) + ); + + $message = $this->replaceInputPlaceholder($message, $attribute); + + if (isset($this->replacers[Str::snake($rule)])) { + return $this->callReplacer($message, $attribute, Str::snake($rule), $parameters, $this); + } elseif (method_exists($this, $replacer = "replace{$rule}")) { + return $this->$replacer($message, $attribute, $rule, $parameters); + } + + return $message; + } + + /** + * Get the displayable name of the attribute. + * + * @param string $attribute + * @return string + */ + public function getDisplayableAttribute($attribute) + { + $primaryAttribute = $this->getPrimaryAttribute($attribute); + + $expectedAttributes = $attribute != $primaryAttribute + ? [$attribute, $primaryAttribute] : [$attribute]; + + foreach ($expectedAttributes as $name) { + // The developer may dynamically specify the array of custom attributes on this + // validator instance. If the attribute exists in this array it is used over + // the other ways of pulling the attribute name for this given attributes. + if (isset($this->customAttributes[$name])) { + return $this->customAttributes[$name]; + } + + // We allow for a developer to specify language lines for any attribute in this + // application, which allows flexibility for displaying a unique displayable + // version of the attribute name instead of the name used in an HTTP POST. + if ($line = $this->getAttributeFromTranslations($name)) { + return $line; + } + } + + // When no language line has been specified for the attribute and it is also + // an implicit attribute we will display the raw attribute's name and not + // modify it with any of these replacements before we display the name. + if (isset($this->implicitAttributes[$primaryAttribute])) { + return $attribute; + } + + return str_replace('_', ' ', Str::snake($attribute)); + } + + /** + * Get the given attribute from the attribute translations. + * + * @param string $name + * @return string + */ + protected function getAttributeFromTranslations($name) + { + return Arr::get($this->translator->trans('validation.attributes'), $name); + } + + /** + * Replace the :attribute placeholder in the given message. + * + * @param string $message + * @param string $value + * @return string + */ + protected function replaceAttributePlaceholder($message, $value) + { + return str_replace( + [':attribute', ':ATTRIBUTE', ':Attribute'], + [$value, Str::upper($value), Str::ucfirst($value)], + $message + ); + } + + /** + * Replace the :input placeholder in the given message. + * + * @param string $message + * @param string $attribute + * @return string + */ + protected function replaceInputPlaceholder($message, $attribute) + { + $actualValue = $this->getValue($attribute); + + if (is_scalar($actualValue) || is_null($actualValue)) { + $message = str_replace(':input', $actualValue, $message); + } + + return $message; + } + + /** + * Get the displayable name of the value. + * + * @param string $attribute + * @param mixed $value + * @return string + */ + public function getDisplayableValue($attribute, $value) + { + if (isset($this->customValues[$attribute][$value])) { + return $this->customValues[$attribute][$value]; + } + + $key = "validation.values.{$attribute}.{$value}"; + + if (($line = $this->translator->trans($key)) !== $key) { + return $line; + } + + return $value; + } + + /** + * Transform an array of attributes to their displayable form. + * + * @param array $values + * @return array + */ + protected function getAttributeList(array $values) + { + $attributes = []; + + // For each attribute in the list we will simply get its displayable form as + // this is convenient when replacing lists of parameters like some of the + // replacement functions do when formatting out the validation message. + foreach ($values as $key => $value) { + $attributes[$key] = $this->getDisplayableAttribute($value); + } + + return $attributes; + } + + /** + * Call a custom validator message replacer. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @param \Illuminate\Validation\Validator $validator + * @return string|null + */ + protected function callReplacer($message, $attribute, $rule, $parameters, $validator) + { + $callback = $this->replacers[$rule]; + + if ($callback instanceof Closure) { + return call_user_func_array($callback, func_get_args()); + } elseif (is_string($callback)) { + return $this->callClassBasedReplacer($callback, $message, $attribute, $rule, $parameters, $validator); + } + } + + /** + * Call a class based validator message replacer. + * + * @param string $callback + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @param \Illuminate\Validation\Validator $validator + * @return string + */ + protected function callClassBasedReplacer($callback, $message, $attribute, $rule, $parameters, $validator) + { + [$class, $method] = Str::parseCallback($callback, 'replace'); + + return call_user_func_array([$this->container->make($class), $method], array_slice(func_get_args(), 1)); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ReplacesAttributes.php b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ReplacesAttributes.php new file mode 100644 index 0000000..0d97fa5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ReplacesAttributes.php @@ -0,0 +1,490 @@ +replaceSame($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the digits rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceDigits($message, $attribute, $rule, $parameters) + { + return str_replace(':digits', $parameters[0], $message); + } + + /** + * Replace all place-holders for the digits (between) rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceDigitsBetween($message, $attribute, $rule, $parameters) + { + return $this->replaceBetween($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the min rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceMin($message, $attribute, $rule, $parameters) + { + return str_replace(':min', $parameters[0], $message); + } + + /** + * Replace all place-holders for the max rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceMax($message, $attribute, $rule, $parameters) + { + return str_replace(':max', $parameters[0], $message); + } + + /** + * Replace all place-holders for the in rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceIn($message, $attribute, $rule, $parameters) + { + foreach ($parameters as &$parameter) { + $parameter = $this->getDisplayableValue($attribute, $parameter); + } + + return str_replace(':values', implode(', ', $parameters), $message); + } + + /** + * Replace all place-holders for the not_in rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceNotIn($message, $attribute, $rule, $parameters) + { + return $this->replaceIn($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the in_array rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceInArray($message, $attribute, $rule, $parameters) + { + return str_replace(':other', $this->getDisplayableAttribute($parameters[0]), $message); + } + + /** + * Replace all place-holders for the mimetypes rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceMimetypes($message, $attribute, $rule, $parameters) + { + return str_replace(':values', implode(', ', $parameters), $message); + } + + /** + * Replace all place-holders for the mimes rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceMimes($message, $attribute, $rule, $parameters) + { + return str_replace(':values', implode(', ', $parameters), $message); + } + + /** + * Replace all place-holders for the required_with rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredWith($message, $attribute, $rule, $parameters) + { + return str_replace(':values', implode(' / ', $this->getAttributeList($parameters)), $message); + } + + /** + * Replace all place-holders for the required_with_all rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredWithAll($message, $attribute, $rule, $parameters) + { + return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the required_without rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredWithout($message, $attribute, $rule, $parameters) + { + return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the required_without_all rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredWithoutAll($message, $attribute, $rule, $parameters) + { + return $this->replaceRequiredWith($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the size rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceSize($message, $attribute, $rule, $parameters) + { + return str_replace(':size', $parameters[0], $message); + } + + /** + * Replace all place-holders for the gt rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceGt($message, $attribute, $rule, $parameters) + { + if (is_null($value = $this->getValue($parameters[0]))) { + return str_replace(':value', $parameters[0], $message); + } + + return str_replace(':value', $this->getSize($attribute, $value), $message); + } + + /** + * Replace all place-holders for the lt rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceLt($message, $attribute, $rule, $parameters) + { + if (is_null($value = $this->getValue($parameters[0]))) { + return str_replace(':value', $parameters[0], $message); + } + + return str_replace(':value', $this->getSize($attribute, $value), $message); + } + + /** + * Replace all place-holders for the gte rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceGte($message, $attribute, $rule, $parameters) + { + if (is_null($value = $this->getValue($parameters[0]))) { + return str_replace(':value', $parameters[0], $message); + } + + return str_replace(':value', $this->getSize($attribute, $value), $message); + } + + /** + * Replace all place-holders for the lte rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceLte($message, $attribute, $rule, $parameters) + { + if (is_null($value = $this->getValue($parameters[0]))) { + return str_replace(':value', $parameters[0], $message); + } + + return str_replace(':value', $this->getSize($attribute, $value), $message); + } + + /** + * Replace all place-holders for the required_if rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredIf($message, $attribute, $rule, $parameters) + { + $parameters[1] = $this->getDisplayableValue($parameters[0], Arr::get($this->data, $parameters[0])); + + $parameters[0] = $this->getDisplayableAttribute($parameters[0]); + + return str_replace([':other', ':value'], $parameters, $message); + } + + /** + * Replace all place-holders for the required_unless rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceRequiredUnless($message, $attribute, $rule, $parameters) + { + $other = $this->getDisplayableAttribute($parameters[0]); + + $values = []; + + foreach (array_slice($parameters, 1) as $value) { + $values[] = $this->getDisplayableValue($parameters[0], $value); + } + + return str_replace([':other', ':values'], [$other, implode(', ', $values)], $message); + } + + /** + * Replace all place-holders for the same rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceSame($message, $attribute, $rule, $parameters) + { + return str_replace(':other', $this->getDisplayableAttribute($parameters[0]), $message); + } + + /** + * Replace all place-holders for the before rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceBefore($message, $attribute, $rule, $parameters) + { + if (! (strtotime($parameters[0]))) { + return str_replace(':date', $this->getDisplayableAttribute($parameters[0]), $message); + } + + return str_replace(':date', $parameters[0], $message); + } + + /** + * Replace all place-holders for the before_or_equal rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceBeforeOrEqual($message, $attribute, $rule, $parameters) + { + return $this->replaceBefore($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the after rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceAfter($message, $attribute, $rule, $parameters) + { + return $this->replaceBefore($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the after_or_equal rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceAfterOrEqual($message, $attribute, $rule, $parameters) + { + return $this->replaceBefore($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the date_equals rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceDateEquals($message, $attribute, $rule, $parameters) + { + return $this->replaceBefore($message, $attribute, $rule, $parameters); + } + + /** + * Replace all place-holders for the dimensions rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceDimensions($message, $attribute, $rule, $parameters) + { + $parameters = $this->parseNamedParameters($parameters); + + if (is_array($parameters)) { + foreach ($parameters as $key => $value) { + $message = str_replace(':'.$key, $value, $message); + } + } + + return $message; + } + + /** + * Replace all place-holders for the starts_with rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceStartsWith($message, $attribute, $rule, $parameters) + { + foreach ($parameters as &$parameter) { + $parameter = $this->getDisplayableValue($attribute, $parameter); + } + + return str_replace(':values', implode(', ', $parameters), $message); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php new file mode 100644 index 0000000..e10d694 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php @@ -0,0 +1,1738 @@ +validateRequired($attribute, $value) && in_array($value, $acceptable, true); + } + + /** + * Validate that an attribute is an active URL. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateActiveUrl($attribute, $value) + { + if (! is_string($value)) { + return false; + } + + if ($url = parse_url($value, PHP_URL_HOST)) { + try { + return count(dns_get_record($url, DNS_A | DNS_AAAA)) > 0; + } catch (Exception $e) { + return false; + } + } + + return false; + } + + /** + * "Break" on first validation fail. + * + * Always returns true, just lets us put "bail" in rules. + * + * @return bool + */ + public function validateBail() + { + return true; + } + + /** + * Validate the date is before a given date. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateBefore($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'before'); + + return $this->compareDates($attribute, $value, $parameters, '<'); + } + + /** + * Validate the date is before or equal a given date. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateBeforeOrEqual($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'before_or_equal'); + + return $this->compareDates($attribute, $value, $parameters, '<='); + } + + /** + * Validate the date is after a given date. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateAfter($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'after'); + + return $this->compareDates($attribute, $value, $parameters, '>'); + } + + /** + * Validate the date is equal or after a given date. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateAfterOrEqual($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'after_or_equal'); + + return $this->compareDates($attribute, $value, $parameters, '>='); + } + + /** + * Compare a given date against another using an operator. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @param string $operator + * @return bool + */ + protected function compareDates($attribute, $value, $parameters, $operator) + { + if (! is_string($value) && ! is_numeric($value) && ! $value instanceof DateTimeInterface) { + return false; + } + + if ($format = $this->getDateFormat($attribute)) { + return $this->checkDateTimeOrder($format, $value, $parameters[0], $operator); + } + + if (! $date = $this->getDateTimestamp($parameters[0])) { + $date = $this->getDateTimestamp($this->getValue($parameters[0])); + } + + return $this->compare($this->getDateTimestamp($value), $date, $operator); + } + + /** + * Get the date format for an attribute if it has one. + * + * @param string $attribute + * @return string|null + */ + protected function getDateFormat($attribute) + { + if ($result = $this->getRule($attribute, 'DateFormat')) { + return $result[1][0]; + } + } + + /** + * Get the date timestamp. + * + * @param mixed $value + * @return int + */ + protected function getDateTimestamp($value) + { + if ($value instanceof DateTimeInterface) { + return $value->getTimestamp(); + } + + if ($this->isTestingRelativeDateTime($value)) { + $date = $this->getDateTime($value); + + if (! is_null($date)) { + return $date->getTimestamp(); + } + } + + return strtotime($value); + } + + /** + * Given two date/time strings, check that one is after the other. + * + * @param string $format + * @param string $first + * @param string $second + * @param string $operator + * @return bool + */ + protected function checkDateTimeOrder($format, $first, $second, $operator) + { + $firstDate = $this->getDateTimeWithOptionalFormat($format, $first); + + if (! $secondDate = $this->getDateTimeWithOptionalFormat($format, $second)) { + $secondDate = $this->getDateTimeWithOptionalFormat($format, $this->getValue($second)); + } + + return ($firstDate && $secondDate) && ($this->compare($firstDate, $secondDate, $operator)); + } + + /** + * Get a DateTime instance from a string. + * + * @param string $format + * @param string $value + * @return \DateTime|null + */ + protected function getDateTimeWithOptionalFormat($format, $value) + { + if ($date = DateTime::createFromFormat('!'.$format, $value)) { + return $date; + } + + return $this->getDateTime($value); + } + + /** + * Get a DateTime instance from a string with no format. + * + * @param string $value + * @return \DateTime|null + */ + protected function getDateTime($value) + { + try { + if ($this->isTestingRelativeDateTime($value)) { + return new Carbon($value); + } + + return new DateTime($value); + } catch (Exception $e) { + // + } + } + + /** + * Check if the given value should be adjusted to Carbon::getTestNow(). + * + * @param mixed $value + * @return bool + */ + protected function isTestingRelativeDateTime($value) + { + return Carbon::hasTestNow() && is_string($value) && ( + $value === 'now' || Carbon::hasRelativeKeywords($value) + ); + } + + /** + * Validate that an attribute contains only alphabetic characters. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateAlpha($attribute, $value) + { + return is_string($value) && preg_match('/^[\pL\pM]+$/u', $value); + } + + /** + * Validate that an attribute contains only alpha-numeric characters, dashes, and underscores. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateAlphaDash($attribute, $value) + { + if (! is_string($value) && ! is_numeric($value)) { + return false; + } + + return preg_match('/^[\pL\pM\pN_-]+$/u', $value) > 0; + } + + /** + * Validate that an attribute contains only alpha-numeric characters. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateAlphaNum($attribute, $value) + { + if (! is_string($value) && ! is_numeric($value)) { + return false; + } + + return preg_match('/^[\pL\pM\pN]+$/u', $value) > 0; + } + + /** + * Validate that an attribute is an array. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateArray($attribute, $value) + { + return is_array($value); + } + + /** + * Validate the size of an attribute is between a set of values. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateBetween($attribute, $value, $parameters) + { + $this->requireParameterCount(2, $parameters, 'between'); + + $size = $this->getSize($attribute, $value); + + return $size >= $parameters[0] && $size <= $parameters[1]; + } + + /** + * Validate that an attribute is a boolean. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateBoolean($attribute, $value) + { + $acceptable = [true, false, 0, 1, '0', '1']; + + return in_array($value, $acceptable, true); + } + + /** + * Validate that an attribute has a matching confirmation. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateConfirmed($attribute, $value) + { + return $this->validateSame($attribute, $value, [$attribute.'_confirmation']); + } + + /** + * Validate that an attribute is a valid date. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateDate($attribute, $value) + { + if ($value instanceof DateTimeInterface) { + return true; + } + + if ((! is_string($value) && ! is_numeric($value)) || strtotime($value) === false) { + return false; + } + + $date = date_parse($value); + + return checkdate($date['month'], $date['day'], $date['year']); + } + + /** + * Validate that an attribute matches a date format. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateDateFormat($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'date_format'); + + if (! is_string($value) && ! is_numeric($value)) { + return false; + } + + $format = $parameters[0]; + + $date = DateTime::createFromFormat('!'.$format, $value); + + return $date && $date->format($format) == $value; + } + + /** + * Validate that an attribute is equal to another date. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateDateEquals($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'date_equals'); + + return $this->compareDates($attribute, $value, $parameters, '='); + } + + /** + * Validate that an attribute is different from another attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateDifferent($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'different'); + + foreach ($parameters as $parameter) { + $other = Arr::get($this->data, $parameter); + + if (is_null($other) || $value === $other) { + return false; + } + } + + return true; + } + + /** + * Validate that an attribute has a given number of digits. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateDigits($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'digits'); + + return ! preg_match('/[^0-9]/', $value) + && strlen((string) $value) == $parameters[0]; + } + + /** + * Validate that an attribute is between a given number of digits. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateDigitsBetween($attribute, $value, $parameters) + { + $this->requireParameterCount(2, $parameters, 'digits_between'); + + $length = strlen((string) $value); + + return ! preg_match('/[^0-9]/', $value) + && $length >= $parameters[0] && $length <= $parameters[1]; + } + + /** + * Validate the dimensions of an image matches the given values. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateDimensions($attribute, $value, $parameters) + { + if ($this->isValidFileInstance($value) && $value->getClientMimeType() === 'image/svg+xml') { + return true; + } + + if (! $this->isValidFileInstance($value) || ! $sizeDetails = @getimagesize($value->getRealPath())) { + return false; + } + + $this->requireParameterCount(1, $parameters, 'dimensions'); + + [$width, $height] = $sizeDetails; + + $parameters = $this->parseNamedParameters($parameters); + + if ($this->failsBasicDimensionChecks($parameters, $width, $height) || + $this->failsRatioCheck($parameters, $width, $height)) { + return false; + } + + return true; + } + + /** + * Test if the given width and height fail any conditions. + * + * @param array $parameters + * @param int $width + * @param int $height + * @return bool + */ + protected function failsBasicDimensionChecks($parameters, $width, $height) + { + return (isset($parameters['width']) && $parameters['width'] != $width) || + (isset($parameters['min_width']) && $parameters['min_width'] > $width) || + (isset($parameters['max_width']) && $parameters['max_width'] < $width) || + (isset($parameters['height']) && $parameters['height'] != $height) || + (isset($parameters['min_height']) && $parameters['min_height'] > $height) || + (isset($parameters['max_height']) && $parameters['max_height'] < $height); + } + + /** + * Determine if the given parameters fail a dimension ratio check. + * + * @param array $parameters + * @param int $width + * @param int $height + * @return bool + */ + protected function failsRatioCheck($parameters, $width, $height) + { + if (! isset($parameters['ratio'])) { + return false; + } + + [$numerator, $denominator] = array_replace( + [1, 1], array_filter(sscanf($parameters['ratio'], '%f/%d')) + ); + + $precision = 1 / max($width, $height); + + return abs($numerator / $denominator - $width / $height) > $precision; + } + + /** + * Validate an attribute is unique among other values. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateDistinct($attribute, $value, $parameters) + { + $data = Arr::except($this->getDistinctValues($attribute), $attribute); + + if (in_array('ignore_case', $parameters)) { + return empty(preg_grep('/^'.preg_quote($value, '/').'$/iu', $data)); + } + + return ! in_array($value, array_values($data)); + } + + /** + * Get the values to distinct between. + * + * @param string $attribute + * @return array + */ + protected function getDistinctValues($attribute) + { + $attributeName = $this->getPrimaryAttribute($attribute); + + if (! property_exists($this, 'distinctValues')) { + return $this->extractDistinctValues($attributeName); + } + + if (! array_key_exists($attributeName, $this->distinctValues)) { + $this->distinctValues[$attributeName] = $this->extractDistinctValues($attributeName); + } + + return $this->distinctValues[$attributeName]; + } + + /** + * Extract the distinct values from the data. + * + * @param string $attribute + * @return array + */ + protected function extractDistinctValues($attribute) + { + $attributeData = ValidationData::extractDataFromPath( + ValidationData::getLeadingExplicitAttributePath($attribute), $this->data + ); + + $pattern = str_replace('\*', '[^.]+', preg_quote($attribute, '#')); + + return Arr::where(Arr::dot($attributeData), function ($value, $key) use ($pattern) { + return (bool) preg_match('#^'.$pattern.'\z#u', $key); + }); + } + + /** + * Validate that an attribute is a valid e-mail address. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateEmail($attribute, $value) + { + return filter_var($value, FILTER_VALIDATE_EMAIL) !== false; + } + + /** + * Validate the existence of an attribute value in a database table. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateExists($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'exists'); + + [$connection, $table] = $this->parseTable($parameters[0]); + + // The second parameter position holds the name of the column that should be + // verified as existing. If this parameter is not specified we will guess + // that the columns being "verified" shares the given attribute's name. + $column = $this->getQueryColumn($parameters, $attribute); + + $expected = is_array($value) ? count(array_unique($value)) : 1; + + return $this->getExistCount( + $connection, $table, $column, $value, $parameters + ) >= $expected; + } + + /** + * Get the number of records that exist in storage. + * + * @param mixed $connection + * @param string $table + * @param string $column + * @param mixed $value + * @param array $parameters + * @return int + */ + protected function getExistCount($connection, $table, $column, $value, $parameters) + { + $verifier = $this->getPresenceVerifierFor($connection); + + $extra = $this->getExtraConditions( + array_values(array_slice($parameters, 2)) + ); + + if ($this->currentRule instanceof Exists) { + $extra = array_merge($extra, $this->currentRule->queryCallbacks()); + } + + return is_array($value) + ? $verifier->getMultiCount($table, $column, $value, $extra) + : $verifier->getCount($table, $column, $value, null, null, $extra); + } + + /** + * Validate the uniqueness of an attribute value on a given database table. + * + * If a database column is not specified, the attribute will be used. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateUnique($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'unique'); + + [$connection, $table] = $this->parseTable($parameters[0]); + + // The second parameter position holds the name of the column that needs to + // be verified as unique. If this parameter isn't specified we will just + // assume that this column to be verified shares the attribute's name. + $column = $this->getQueryColumn($parameters, $attribute); + + [$idColumn, $id] = [null, null]; + + if (isset($parameters[2])) { + [$idColumn, $id] = $this->getUniqueIds($parameters); + } + + // The presence verifier is responsible for counting rows within this store + // mechanism which might be a relational database or any other permanent + // data store like Redis, etc. We will use it to determine uniqueness. + $verifier = $this->getPresenceVerifierFor($connection); + + $extra = $this->getUniqueExtra($parameters); + + if ($this->currentRule instanceof Unique) { + $extra = array_merge($extra, $this->currentRule->queryCallbacks()); + } + + return $verifier->getCount( + $table, $column, $value, $id, $idColumn, $extra + ) == 0; + } + + /** + * Get the excluded ID column and value for the unique rule. + * + * @param array $parameters + * @return array + */ + protected function getUniqueIds($parameters) + { + $idColumn = $parameters[3] ?? 'id'; + + return [$idColumn, $this->prepareUniqueId($parameters[2])]; + } + + /** + * Prepare the given ID for querying. + * + * @param mixed $id + * @return int + */ + protected function prepareUniqueId($id) + { + if (preg_match('/\[(.*)\]/', $id, $matches)) { + $id = $this->getValue($matches[1]); + } + + if (strtolower($id) === 'null') { + $id = null; + } + + if (filter_var($id, FILTER_VALIDATE_INT) !== false) { + $id = (int) $id; + } + + return $id; + } + + /** + * Get the extra conditions for a unique rule. + * + * @param array $parameters + * @return array + */ + protected function getUniqueExtra($parameters) + { + if (isset($parameters[4])) { + return $this->getExtraConditions(array_slice($parameters, 4)); + } + + return []; + } + + /** + * Parse the connection / table for the unique / exists rules. + * + * @param string $table + * @return array + */ + protected function parseTable($table) + { + return Str::contains($table, '.') ? explode('.', $table, 2) : [null, $table]; + } + + /** + * Get the column name for an exists / unique query. + * + * @param array $parameters + * @param string $attribute + * @return bool + */ + protected function getQueryColumn($parameters, $attribute) + { + return isset($parameters[1]) && $parameters[1] !== 'NULL' + ? $parameters[1] : $this->guessColumnForQuery($attribute); + } + + /** + * Guess the database column from the given attribute name. + * + * @param string $attribute + * @return string + */ + public function guessColumnForQuery($attribute) + { + if (in_array($attribute, Arr::collapse($this->implicitAttributes)) + && ! is_numeric($last = last(explode('.', $attribute)))) { + return $last; + } + + return $attribute; + } + + /** + * Get the extra conditions for a unique / exists rule. + * + * @param array $segments + * @return array + */ + protected function getExtraConditions(array $segments) + { + $extra = []; + + $count = count($segments); + + for ($i = 0; $i < $count; $i += 2) { + $extra[$segments[$i]] = $segments[$i + 1]; + } + + return $extra; + } + + /** + * Validate the given value is a valid file. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateFile($attribute, $value) + { + return $this->isValidFileInstance($value); + } + + /** + * Validate the given attribute is filled if it is present. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateFilled($attribute, $value) + { + if (Arr::has($this->data, $attribute)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Validate that an attribute is greater than another attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateGt($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'gt'); + + $comparedToValue = $this->getValue($parameters[0]); + + $this->shouldBeNumeric($attribute, 'Gt'); + + if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { + return $this->getSize($attribute, $value) > $parameters[0]; + } + + $this->requireSameType($value, $comparedToValue); + + return $this->getSize($attribute, $value) > $this->getSize($attribute, $comparedToValue); + } + + /** + * Validate that an attribute is less than another attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateLt($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'lt'); + + $comparedToValue = $this->getValue($parameters[0]); + + $this->shouldBeNumeric($attribute, 'Lt'); + + if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { + return $this->getSize($attribute, $value) < $parameters[0]; + } + + $this->requireSameType($value, $comparedToValue); + + return $this->getSize($attribute, $value) < $this->getSize($attribute, $comparedToValue); + } + + /** + * Validate that an attribute is greater than or equal another attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateGte($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'gte'); + + $comparedToValue = $this->getValue($parameters[0]); + + $this->shouldBeNumeric($attribute, 'Gte'); + + if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { + return $this->getSize($attribute, $value) >= $parameters[0]; + } + + $this->requireSameType($value, $comparedToValue); + + return $this->getSize($attribute, $value) >= $this->getSize($attribute, $comparedToValue); + } + + /** + * Validate that an attribute is less than or equal another attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateLte($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'lte'); + + $comparedToValue = $this->getValue($parameters[0]); + + $this->shouldBeNumeric($attribute, 'Lte'); + + if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { + return $this->getSize($attribute, $value) <= $parameters[0]; + } + + $this->requireSameType($value, $comparedToValue); + + return $this->getSize($attribute, $value) <= $this->getSize($attribute, $comparedToValue); + } + + /** + * Validate the MIME type of a file is an image MIME type. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateImage($attribute, $value) + { + return $this->validateMimes($attribute, $value, ['jpeg', 'png', 'gif', 'bmp', 'svg']); + } + + /** + * Validate an attribute is contained within a list of values. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateIn($attribute, $value, $parameters) + { + if (is_array($value) && $this->hasRule($attribute, 'Array')) { + foreach ($value as $element) { + if (is_array($element)) { + return false; + } + } + + return count(array_diff($value, $parameters)) === 0; + } + + return ! is_array($value) && in_array((string) $value, $parameters); + } + + /** + * Validate that the values of an attribute is in another attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateInArray($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'in_array'); + + $explicitPath = ValidationData::getLeadingExplicitAttributePath($parameters[0]); + + $attributeData = ValidationData::extractDataFromPath($explicitPath, $this->data); + + $otherValues = Arr::where(Arr::dot($attributeData), function ($value, $key) use ($parameters) { + return Str::is($parameters[0], $key); + }); + + return in_array($value, $otherValues); + } + + /** + * Validate that an attribute is an integer. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateInteger($attribute, $value) + { + return filter_var($value, FILTER_VALIDATE_INT) !== false; + } + + /** + * Validate that an attribute is a valid IP. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateIp($attribute, $value) + { + return filter_var($value, FILTER_VALIDATE_IP) !== false; + } + + /** + * Validate that an attribute is a valid IPv4. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateIpv4($attribute, $value) + { + return filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false; + } + + /** + * Validate that an attribute is a valid IPv6. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateIpv6($attribute, $value) + { + return filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false; + } + + /** + * Validate the attribute is a valid JSON string. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateJson($attribute, $value) + { + if (! is_scalar($value) && ! method_exists($value, '__toString')) { + return false; + } + + json_decode($value); + + return json_last_error() === JSON_ERROR_NONE; + } + + /** + * Validate the size of an attribute is less than a maximum value. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateMax($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'max'); + + if ($value instanceof UploadedFile && ! $value->isValid()) { + return false; + } + + return $this->getSize($attribute, $value) <= $parameters[0]; + } + + /** + * Validate the guessed extension of a file upload is in a set of file extensions. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateMimes($attribute, $value, $parameters) + { + if (! $this->isValidFileInstance($value)) { + return false; + } + + if ($this->shouldBlockPhpUpload($value, $parameters)) { + return false; + } + + return $value->getPath() !== '' && in_array($value->guessExtension(), $parameters); + } + + /** + * Validate the MIME type of a file upload attribute is in a set of MIME types. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateMimetypes($attribute, $value, $parameters) + { + if (! $this->isValidFileInstance($value)) { + return false; + } + + if ($this->shouldBlockPhpUpload($value, $parameters)) { + return false; + } + + return $value->getPath() !== '' && + (in_array($value->getMimeType(), $parameters) || + in_array(explode('/', $value->getMimeType())[0].'/*', $parameters)); + } + + /** + * Check if PHP uploads are explicitly allowed. + * + * @param mixed $value + * @param array $parameters + * @return bool + */ + protected function shouldBlockPhpUpload($value, $parameters) + { + if (in_array('php', $parameters)) { + return false; + } + + $phpExtensions = [ + 'php', 'php3', 'php4', 'php5', 'phtml', + ]; + + return ($value instanceof UploadedFile) + ? in_array(trim(strtolower($value->getClientOriginalExtension())), $phpExtensions) + : in_array(trim(strtolower($value->getExtension())), $phpExtensions); + } + + /** + * Validate the size of an attribute is greater than a minimum value. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateMin($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'min'); + + return $this->getSize($attribute, $value) >= $parameters[0]; + } + + /** + * "Indicate" validation should pass if value is null. + * + * Always returns true, just lets us put "nullable" in rules. + * + * @return bool + */ + public function validateNullable() + { + return true; + } + + /** + * Validate an attribute is not contained within a list of values. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateNotIn($attribute, $value, $parameters) + { + return ! $this->validateIn($attribute, $value, $parameters); + } + + /** + * Validate that an attribute is numeric. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateNumeric($attribute, $value) + { + return is_numeric($value); + } + + /** + * Validate that an attribute exists even if not filled. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validatePresent($attribute, $value) + { + return Arr::has($this->data, $attribute); + } + + /** + * Validate that an attribute passes a regular expression check. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateRegex($attribute, $value, $parameters) + { + if (! is_string($value) && ! is_numeric($value)) { + return false; + } + + $this->requireParameterCount(1, $parameters, 'regex'); + + return preg_match($parameters[0], $value) > 0; + } + + /** + * Validate that an attribute does not pass a regular expression check. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateNotRegex($attribute, $value, $parameters) + { + if (! is_string($value) && ! is_numeric($value)) { + return false; + } + + $this->requireParameterCount(1, $parameters, 'not_regex'); + + return preg_match($parameters[0], $value) < 1; + } + + /** + * Validate that a required attribute exists. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateRequired($attribute, $value) + { + if (is_null($value)) { + return false; + } elseif (is_string($value) && trim($value) === '') { + return false; + } elseif ((is_array($value) || $value instanceof Countable) && count($value) < 1) { + return false; + } elseif ($value instanceof File) { + return (string) $value->getPath() !== ''; + } + + return true; + } + + /** + * Validate that an attribute exists when another attribute has a given value. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + public function validateRequiredIf($attribute, $value, $parameters) + { + $this->requireParameterCount(2, $parameters, 'required_if'); + + $other = Arr::get($this->data, $parameters[0]); + + $values = array_slice($parameters, 1); + + if (is_bool($other)) { + $values = $this->convertValuesToBoolean($values); + } + + if (in_array($other, $values)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Convert the given values to boolean if they are string "true" / "false". + * + * @param array $values + * @return array + */ + protected function convertValuesToBoolean($values) + { + return array_map(function ($value) { + if ($value === 'true') { + return true; + } elseif ($value === 'false') { + return false; + } + + return $value; + }, $values); + } + + /** + * Validate that an attribute exists when another attribute does not have a given value. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + public function validateRequiredUnless($attribute, $value, $parameters) + { + $this->requireParameterCount(2, $parameters, 'required_unless'); + + $data = Arr::get($this->data, $parameters[0]); + + $values = array_slice($parameters, 1); + + if (! in_array($data, $values)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Validate that an attribute exists when any other attribute exists. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + public function validateRequiredWith($attribute, $value, $parameters) + { + if (! $this->allFailingRequired($parameters)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Validate that an attribute exists when all other attributes exists. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + public function validateRequiredWithAll($attribute, $value, $parameters) + { + if (! $this->anyFailingRequired($parameters)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Validate that an attribute exists when another attribute does not. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + public function validateRequiredWithout($attribute, $value, $parameters) + { + if ($this->anyFailingRequired($parameters)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Validate that an attribute exists when all other attributes do not. + * + * @param string $attribute + * @param mixed $value + * @param mixed $parameters + * @return bool + */ + public function validateRequiredWithoutAll($attribute, $value, $parameters) + { + if ($this->allFailingRequired($parameters)) { + return $this->validateRequired($attribute, $value); + } + + return true; + } + + /** + * Determine if any of the given attributes fail the required test. + * + * @param array $attributes + * @return bool + */ + protected function anyFailingRequired(array $attributes) + { + foreach ($attributes as $key) { + if (! $this->validateRequired($key, $this->getValue($key))) { + return true; + } + } + + return false; + } + + /** + * Determine if all of the given attributes fail the required test. + * + * @param array $attributes + * @return bool + */ + protected function allFailingRequired(array $attributes) + { + foreach ($attributes as $key) { + if ($this->validateRequired($key, $this->getValue($key))) { + return false; + } + } + + return true; + } + + /** + * Validate that two attributes match. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateSame($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'same'); + + $other = Arr::get($this->data, $parameters[0]); + + return $value === $other; + } + + /** + * Validate the size of an attribute. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateSize($attribute, $value, $parameters) + { + $this->requireParameterCount(1, $parameters, 'size'); + + return $this->getSize($attribute, $value) == $parameters[0]; + } + + /** + * "Validate" optional attributes. + * + * Always returns true, just lets us put sometimes in rules. + * + * @return bool + */ + public function validateSometimes() + { + return true; + } + + /** + * Validate the attribute starts with a given substring. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateStartsWith($attribute, $value, $parameters) + { + return Str::startsWith($value, $parameters); + } + + /** + * Validate that an attribute is a string. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateString($attribute, $value) + { + return is_string($value); + } + + /** + * Validate that an attribute is a valid timezone. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateTimezone($attribute, $value) + { + try { + new DateTimeZone($value); + } catch (Exception $e) { + return false; + } catch (Throwable $e) { + return false; + } + + return true; + } + + /** + * Validate that an attribute is a valid URL. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateUrl($attribute, $value) + { + if (! is_string($value)) { + return false; + } + + /* + * This pattern is derived from Symfony\Component\Validator\Constraints\UrlValidator (2.7.4). + * + * (c) Fabien Potencier http://symfony.com + */ + $pattern = '~^ + ((aaa|aaas|about|acap|acct|acr|adiumxtra|afp|afs|aim|apt|attachment|aw|barion|beshare|bitcoin|blob|bolo|callto|cap|chrome|chrome-extension|cid|coap|coaps|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-playcontainer|dlna-playsingle|dns|dntp|dtn|dvb|ed2k|example|facetime|fax|feed|feedready|file|filesystem|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|ham|hcp|http|https|iax|icap|icon|im|imap|info|iotdisco|ipn|ipp|ipps|irc|irc6|ircs|iris|iris.beep|iris.lwz|iris.xpc|iris.xpcs|itms|jabber|jar|jms|keyparc|lastfm|ldap|ldaps|magnet|mailserver|mailto|maps|market|message|mid|mms|modem|ms-help|ms-settings|ms-settings-airplanemode|ms-settings-bluetooth|ms-settings-camera|ms-settings-cellular|ms-settings-cloudstorage|ms-settings-emailandaccounts|ms-settings-language|ms-settings-location|ms-settings-lock|ms-settings-nfctransactions|ms-settings-notifications|ms-settings-power|ms-settings-privacy|ms-settings-proximity|ms-settings-screenrotation|ms-settings-wifi|ms-settings-workplace|msnim|msrp|msrps|mtqp|mumble|mupdate|mvn|news|nfs|ni|nih|nntp|notes|oid|opaquelocktoken|pack|palm|paparazzi|pkcs11|platform|pop|pres|prospero|proxy|psyc|query|redis|rediss|reload|res|resource|rmi|rsync|rtmfp|rtmp|rtsp|rtsps|rtspu|secondlife|s3|service|session|sftp|sgn|shttp|sieve|sip|sips|skype|smb|sms|smtp|snews|snmp|soap.beep|soap.beeps|soldat|spotify|ssh|steam|stun|stuns|submit|svn|tag|teamspeak|tel|teliaeid|telnet|tftp|things|thismessage|tip|tn3270|turn|turns|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|videotex|view-source|wais|webcal|ws|wss|wtai|wyciwyg|xcon|xcon-userid|xfire|xmlrpc\.beep|xmlrpc.beeps|xmpp|xri|ymsgr|z39\.50|z39\.50r|z39\.50s)):// # protocol + (([\pL\pN-]+:)?([\pL\pN-]+)@)? # basic auth + ( + ([\pL\pN\pS\-\.])+(\.?([\pL]|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) + (/?|/\S+|\?\S*|\#\S*) # a /, nothing, a / with something, a query or a fragment + $~ixu'; + + return preg_match($pattern, $value) > 0; + } + + /** + * Validate that an attribute is a valid UUID. + * + * @param string $attribute + * @param mixed $value + * @return bool + */ + public function validateUuid($attribute, $value) + { + if (! is_string($value)) { + return false; + } + + return preg_match('/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iD', $value) > 0; + } + + /** + * Get the size of an attribute. + * + * @param string $attribute + * @param mixed $value + * @return mixed + */ + protected function getSize($attribute, $value) + { + $hasNumeric = $this->hasRule($attribute, $this->numericRules); + + // This method will determine if the attribute is a number, string, or file and + // return the proper size accordingly. If it is a number, then number itself + // is the size. If it is a file, we take kilobytes, and for a string the + // entire length of the string will be considered the attribute size. + if (is_numeric($value) && $hasNumeric) { + return $value; + } elseif (is_array($value)) { + return count($value); + } elseif ($value instanceof File) { + return $value->getSize() / 1024; + } + + return mb_strlen($value); + } + + /** + * Check that the given value is a valid file instance. + * + * @param mixed $value + * @return bool + */ + public function isValidFileInstance($value) + { + if ($value instanceof UploadedFile && ! $value->isValid()) { + return false; + } + + return $value instanceof File; + } + + /** + * Determine if a comparison passes between the given values. + * + * @param mixed $first + * @param mixed $second + * @param string $operator + * @return bool + * + * @throws \InvalidArgumentException + */ + protected function compare($first, $second, $operator) + { + switch ($operator) { + case '<': + return $first < $second; + case '>': + return $first > $second; + case '<=': + return $first <= $second; + case '>=': + return $first >= $second; + case '=': + return $first == $second; + default: + throw new InvalidArgumentException; + } + } + + /** + * Parse named parameters to $key => $value items. + * + * @param array $parameters + * @return array + */ + protected function parseNamedParameters($parameters) + { + return array_reduce($parameters, function ($result, $item) { + [$key, $value] = array_pad(explode('=', $item, 2), 2, null); + + $result[$key] = $value; + + return $result; + }); + } + + /** + * Require a certain number of parameters to be present. + * + * @param int $count + * @param array $parameters + * @param string $rule + * @return void + * + * @throws \InvalidArgumentException + */ + protected function requireParameterCount($count, $parameters, $rule) + { + if (count($parameters) < $count) { + throw new InvalidArgumentException("Validation rule $rule requires at least $count parameters."); + } + } + + /** + * Require comparison values to be of the same type. + * + * @param mixed $first + * @param mixed $second + * @return void + * + * @throws \InvalidArgumentException + */ + protected function requireSameType($first, $second) + { + if (gettype($first) != gettype($second)) { + throw new InvalidArgumentException('The values under comparison must be of the same type'); + } + } + + /** + * Adds the existing rule to the numericRules array if the attribute's value is numeric. + * + * @param string $attribute + * @param string $rule + * + * @return void + */ + protected function shouldBeNumeric($attribute, $rule) + { + if (is_numeric($this->getValue($attribute))) { + $this->numericRules[] = $rule; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/DatabasePresenceVerifier.php b/vendor/laravel/framework/src/Illuminate/Validation/DatabasePresenceVerifier.php new file mode 100755 index 0000000..cb0c247 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/DatabasePresenceVerifier.php @@ -0,0 +1,138 @@ +db = $db; + } + + /** + * Count the number of objects in a collection having the given value. + * + * @param string $collection + * @param string $column + * @param string $value + * @param int|null $excludeId + * @param string|null $idColumn + * @param array $extra + * @return int + */ + public function getCount($collection, $column, $value, $excludeId = null, $idColumn = null, array $extra = []) + { + $query = $this->table($collection)->where($column, '=', $value); + + if (! is_null($excludeId) && $excludeId !== 'NULL') { + $query->where($idColumn ?: 'id', '<>', $excludeId); + } + + return $this->addConditions($query, $extra)->count(); + } + + /** + * Count the number of objects in a collection with the given values. + * + * @param string $collection + * @param string $column + * @param array $values + * @param array $extra + * @return int + */ + public function getMultiCount($collection, $column, array $values, array $extra = []) + { + $query = $this->table($collection)->whereIn($column, $values); + + return $this->addConditions($query, $extra)->distinct()->count($column); + } + + /** + * Add the given conditions to the query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param array $conditions + * @return \Illuminate\Database\Query\Builder + */ + protected function addConditions($query, $conditions) + { + foreach ($conditions as $key => $value) { + if ($value instanceof Closure) { + $query->where(function ($query) use ($value) { + $value($query); + }); + } else { + $this->addWhere($query, $key, $value); + } + } + + return $query; + } + + /** + * Add a "where" clause to the given query. + * + * @param \Illuminate\Database\Query\Builder $query + * @param string $key + * @param string $extraValue + * @return void + */ + protected function addWhere($query, $key, $extraValue) + { + if ($extraValue === 'NULL') { + $query->whereNull($key); + } elseif ($extraValue === 'NOT_NULL') { + $query->whereNotNull($key); + } elseif (Str::startsWith($extraValue, '!')) { + $query->where($key, '!=', mb_substr($extraValue, 1)); + } else { + $query->where($key, $extraValue); + } + } + + /** + * Get a query builder for the given table. + * + * @param string $table + * @return \Illuminate\Database\Query\Builder + */ + protected function table($table) + { + return $this->db->connection($this->connection)->table($table)->useWritePdo(); + } + + /** + * Set the connection to be used. + * + * @param string $connection + * @return void + */ + public function setConnection($connection) + { + $this->connection = $connection; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Factory.php b/vendor/laravel/framework/src/Illuminate/Validation/Factory.php new file mode 100755 index 0000000..3660af0 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Factory.php @@ -0,0 +1,283 @@ +container = $container; + $this->translator = $translator; + } + + /** + * Create a new Validator instance. + * + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return \Illuminate\Validation\Validator + */ + public function make(array $data, array $rules, array $messages = [], array $customAttributes = []) + { + // The presence verifier is responsible for checking the unique and exists data + // for the validator. It is behind an interface so that multiple versions of + // it may be written besides database. We'll inject it into the validator. + $validator = $this->resolve( + $data, $rules, $messages, $customAttributes + ); + + if (! is_null($this->verifier)) { + $validator->setPresenceVerifier($this->verifier); + } + + // Next we'll set the IoC container instance of the validator, which is used to + // resolve out class based validator extensions. If it is not set then these + // types of extensions will not be possible on these validation instances. + if (! is_null($this->container)) { + $validator->setContainer($this->container); + } + + $this->addExtensions($validator); + + return $validator; + } + + /** + * Validate the given data against the provided rules. + * + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return array + * + * @throws \Illuminate\Validation\ValidationException + */ + public function validate(array $data, array $rules, array $messages = [], array $customAttributes = []) + { + return $this->make($data, $rules, $messages, $customAttributes)->validate(); + } + + /** + * Resolve a new Validator instance. + * + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes + * @return \Illuminate\Validation\Validator + */ + protected function resolve(array $data, array $rules, array $messages, array $customAttributes) + { + if (is_null($this->resolver)) { + return new Validator($this->translator, $data, $rules, $messages, $customAttributes); + } + + return call_user_func($this->resolver, $this->translator, $data, $rules, $messages, $customAttributes); + } + + /** + * Add the extensions to a validator instance. + * + * @param \Illuminate\Validation\Validator $validator + * @return void + */ + protected function addExtensions(Validator $validator) + { + $validator->addExtensions($this->extensions); + + // Next, we will add the implicit extensions, which are similar to the required + // and accepted rule in that they are run even if the attributes is not in a + // array of data that is given to a validator instances via instantiation. + $validator->addImplicitExtensions($this->implicitExtensions); + + $validator->addDependentExtensions($this->dependentExtensions); + + $validator->addReplacers($this->replacers); + + $validator->setFallbackMessages($this->fallbackMessages); + } + + /** + * Register a custom validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @param string $message + * @return void + */ + public function extend($rule, $extension, $message = null) + { + $this->extensions[$rule] = $extension; + + if ($message) { + $this->fallbackMessages[Str::snake($rule)] = $message; + } + } + + /** + * Register a custom implicit validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @param string $message + * @return void + */ + public function extendImplicit($rule, $extension, $message = null) + { + $this->implicitExtensions[$rule] = $extension; + + if ($message) { + $this->fallbackMessages[Str::snake($rule)] = $message; + } + } + + /** + * Register a custom dependent validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @param string $message + * @return void + */ + public function extendDependent($rule, $extension, $message = null) + { + $this->dependentExtensions[$rule] = $extension; + + if ($message) { + $this->fallbackMessages[Str::snake($rule)] = $message; + } + } + + /** + * Register a custom validator message replacer. + * + * @param string $rule + * @param \Closure|string $replacer + * @return void + */ + public function replacer($rule, $replacer) + { + $this->replacers[$rule] = $replacer; + } + + /** + * Set the Validator instance resolver. + * + * @param \Closure $resolver + * @return void + */ + public function resolver(Closure $resolver) + { + $this->resolver = $resolver; + } + + /** + * Get the Translator implementation. + * + * @return \Illuminate\Contracts\Translation\Translator + */ + public function getTranslator() + { + return $this->translator; + } + + /** + * Get the Presence Verifier implementation. + * + * @return \Illuminate\Validation\PresenceVerifierInterface + */ + public function getPresenceVerifier() + { + return $this->verifier; + } + + /** + * Set the Presence Verifier implementation. + * + * @param \Illuminate\Validation\PresenceVerifierInterface $presenceVerifier + * @return void + */ + public function setPresenceVerifier(PresenceVerifierInterface $presenceVerifier) + { + $this->verifier = $presenceVerifier; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/PresenceVerifierInterface.php b/vendor/laravel/framework/src/Illuminate/Validation/PresenceVerifierInterface.php new file mode 100755 index 0000000..7449629 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/PresenceVerifierInterface.php @@ -0,0 +1,30 @@ +toArray(); + } + + return new Rules\In(is_array($values) ? $values : func_get_args()); + } + + /** + * Get a not_in constraint builder instance. + * + * @param \Illuminate\Contracts\Support\Arrayable|array|string $values + * @return \Illuminate\Validation\Rules\NotIn + */ + public static function notIn($values) + { + if ($values instanceof Arrayable) { + $values = $values->toArray(); + } + + return new Rules\NotIn(is_array($values) ? $values : func_get_args()); + } + + /** + * Get a required_if constraint builder instance. + * + * @param callable $callback + * @return \Illuminate\Validation\Rules\RequiredIf + */ + public static function requiredIf($callback) + { + return new Rules\RequiredIf($callback); + } + + /** + * Get a unique constraint builder instance. + * + * @param string $table + * @param string $column + * @return \Illuminate\Validation\Rules\Unique + */ + public static function unique($table, $column = 'NULL') + { + return new Rules\Unique($table, $column); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/DatabaseRule.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/DatabaseRule.php new file mode 100644 index 0000000..9b7652f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/DatabaseRule.php @@ -0,0 +1,172 @@ +table = $table; + $this->column = $column; + } + + /** + * Set a "where" constraint on the query. + * + * @param string|\Closure $column + * @param array|string|null $value + * @return $this + */ + public function where($column, $value = null) + { + if (is_array($value)) { + return $this->whereIn($column, $value); + } + + if ($column instanceof Closure) { + return $this->using($column); + } + + $this->wheres[] = compact('column', 'value'); + + return $this; + } + + /** + * Set a "where not" constraint on the query. + * + * @param string $column + * @param array|string $value + * @return $this + */ + public function whereNot($column, $value) + { + if (is_array($value)) { + return $this->whereNotIn($column, $value); + } + + return $this->where($column, '!'.$value); + } + + /** + * Set a "where null" constraint on the query. + * + * @param string $column + * @return $this + */ + public function whereNull($column) + { + return $this->where($column, 'NULL'); + } + + /** + * Set a "where not null" constraint on the query. + * + * @param string $column + * @return $this + */ + public function whereNotNull($column) + { + return $this->where($column, 'NOT_NULL'); + } + + /** + * Set a "where in" constraint on the query. + * + * @param string $column + * @param array $values + * @return $this + */ + public function whereIn($column, array $values) + { + return $this->where(function ($query) use ($column, $values) { + $query->whereIn($column, $values); + }); + } + + /** + * Set a "where not in" constraint on the query. + * + * @param string $column + * @param array $values + * @return $this + */ + public function whereNotIn($column, array $values) + { + return $this->where(function ($query) use ($column, $values) { + $query->whereNotIn($column, $values); + }); + } + + /** + * Register a custom query callback. + * + * @param \Closure $callback + * @return $this + */ + public function using(Closure $callback) + { + $this->using[] = $callback; + + return $this; + } + + /** + * Get the custom query callbacks for the rule. + * + * @return array + */ + public function queryCallbacks() + { + return $this->using; + } + + /** + * Format the where clauses. + * + * @return string + */ + protected function formatWheres() + { + return collect($this->wheres)->map(function ($where) { + return $where['column'].','.$where['value']; + })->implode(','); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/Dimensions.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/Dimensions.php new file mode 100644 index 0000000..354d071 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/Dimensions.php @@ -0,0 +1,131 @@ +constraints = $constraints; + } + + /** + * Set the "width" constraint. + * + * @param int $value + * @return $this + */ + public function width($value) + { + $this->constraints['width'] = $value; + + return $this; + } + + /** + * Set the "height" constraint. + * + * @param int $value + * @return $this + */ + public function height($value) + { + $this->constraints['height'] = $value; + + return $this; + } + + /** + * Set the "min width" constraint. + * + * @param int $value + * @return $this + */ + public function minWidth($value) + { + $this->constraints['min_width'] = $value; + + return $this; + } + + /** + * Set the "min height" constraint. + * + * @param int $value + * @return $this + */ + public function minHeight($value) + { + $this->constraints['min_height'] = $value; + + return $this; + } + + /** + * Set the "max width" constraint. + * + * @param int $value + * @return $this + */ + public function maxWidth($value) + { + $this->constraints['max_width'] = $value; + + return $this; + } + + /** + * Set the "max height" constraint. + * + * @param int $value + * @return $this + */ + public function maxHeight($value) + { + $this->constraints['max_height'] = $value; + + return $this; + } + + /** + * Set the "ratio" constraint. + * + * @param float $value + * @return $this + */ + public function ratio($value) + { + $this->constraints['ratio'] = $value; + + return $this; + } + + /** + * Convert the rule to a validation string. + * + * @return string + */ + public function __toString() + { + $result = ''; + + foreach ($this->constraints as $key => $value) { + $result .= "$key=$value,"; + } + + return 'dimensions:'.substr($result, 0, -1); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/Exists.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/Exists.php new file mode 100644 index 0000000..72c3786 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/Exists.php @@ -0,0 +1,22 @@ +table, + $this->column, + $this->formatWheres() + ), ','); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/In.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/In.php new file mode 100644 index 0000000..58086bf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/In.php @@ -0,0 +1,45 @@ +values = $values; + } + + /** + * Convert the rule to a validation string. + * + * @return string + * + * @see \Illuminate\Validation\ValidationRuleParser::parseParameters + */ + public function __toString() + { + $values = array_map(function ($value) { + return '"'.str_replace('"', '""', $value).'"'; + }, $this->values); + + return $this->rule.':'.implode(',', $values); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/NotIn.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/NotIn.php new file mode 100644 index 0000000..edd1013 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/NotIn.php @@ -0,0 +1,43 @@ +values = $values; + } + + /** + * Convert the rule to a validation string. + * + * @return string + */ + public function __toString() + { + $values = array_map(function ($value) { + return '"'.str_replace('"', '""', $value).'"'; + }, $this->values); + + return $this->rule.':'.implode(',', $values); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/RequiredIf.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/RequiredIf.php new file mode 100644 index 0000000..c4a1001 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/RequiredIf.php @@ -0,0 +1,38 @@ +condition = $condition; + } + + /** + * Convert the rule to a validation string. + * + * @return string + */ + public function __toString() + { + if (is_callable($this->condition)) { + return call_user_func($this->condition) ? 'required' : ''; + } + + return $this->condition ? 'required' : ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Rules/Unique.php b/vendor/laravel/framework/src/Illuminate/Validation/Rules/Unique.php new file mode 100644 index 0000000..bce18d8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Rules/Unique.php @@ -0,0 +1,74 @@ +ignoreModel($id, $idColumn); + } + + $this->ignore = $id; + $this->idColumn = $idColumn ?? 'id'; + + return $this; + } + + /** + * Ignore the given model during the unique check. + * + * @param \Illuminate\Database\Eloquent\Model $model + * @param string|null $idColumn + * @return $this + */ + public function ignoreModel($model, $idColumn = null) + { + $this->idColumn = $idColumn ?? $model->getKeyName(); + $this->ignore = $model->{$this->idColumn}; + + return $this; + } + + /** + * Convert the rule to a validation string. + * + * @return string + */ + public function __toString() + { + return rtrim(sprintf('unique:%s,%s,%s,%s,%s', + $this->table, + $this->column, + $this->ignore ? '"'.$this->ignore.'"' : 'NULL', + $this->idColumn, + $this->formatWheres() + ), ','); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/UnauthorizedException.php b/vendor/laravel/framework/src/Illuminate/Validation/UnauthorizedException.php new file mode 100644 index 0000000..ea8a6ec --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/UnauthorizedException.php @@ -0,0 +1,10 @@ +prepareForValidation(); + + if (! $this->passesAuthorization()) { + $this->failedAuthorization(); + } + + $instance = $this->getValidatorInstance(); + + if ($instance->fails()) { + $this->failedValidation($instance); + } + } + + /** + * Prepare the data for validation. + * + * @return void + */ + protected function prepareForValidation() + { + // no default action + } + + /** + * Get the validator instance for the request. + * + * @return \Illuminate\Validation\Validator + */ + protected function getValidatorInstance() + { + return $this->validator(); + } + + /** + * Handle a failed validation attempt. + * + * @param \Illuminate\Validation\Validator $validator + * @return void + * + * @throws \Illuminate\Validation\ValidationException + */ + protected function failedValidation(Validator $validator) + { + throw new ValidationException($validator); + } + + /** + * Determine if the request passes the authorization check. + * + * @return bool + */ + protected function passesAuthorization() + { + if (method_exists($this, 'authorize')) { + return $this->authorize(); + } + + return true; + } + + /** + * Handle a failed authorization attempt. + * + * @return void + * + * @throws \Illuminate\Validation\UnauthorizedException + */ + protected function failedAuthorization() + { + throw new UnauthorizedException; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/ValidationData.php b/vendor/laravel/framework/src/Illuminate/Validation/ValidationData.php new file mode 100644 index 0000000..74f5525 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/ValidationData.php @@ -0,0 +1,113 @@ + $value) { + if ((bool) preg_match('/^'.$pattern.'/', $key, $matches)) { + $keys[] = $matches[0]; + } + } + + $keys = array_unique($keys); + + $data = []; + + foreach ($keys as $key) { + $data[$key] = Arr::get($masterData, $key); + } + + return $data; + } + + /** + * Extract data based on the given dot-notated path. + * + * Used to extract a sub-section of the data for faster iteration. + * + * @param string $attribute + * @param array $masterData + * @return array + */ + public static function extractDataFromPath($attribute, $masterData) + { + $results = []; + + $value = Arr::get($masterData, $attribute, '__missing__'); + + if ($value !== '__missing__') { + Arr::set($results, $attribute, $value); + } + + return $results; + } + + /** + * Get the explicit part of the attribute name. + * + * E.g. 'foo.bar.*.baz' -> 'foo.bar' + * + * Allows us to not spin through all of the flattened data for some operations. + * + * @param string $attribute + * @return string + */ + public static function getLeadingExplicitAttributePath($attribute) + { + return rtrim(explode('*', $attribute)[0], '.') ?: null; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/ValidationException.php b/vendor/laravel/framework/src/Illuminate/Validation/ValidationException.php new file mode 100644 index 0000000..ef71618 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/ValidationException.php @@ -0,0 +1,138 @@ +response = $response; + $this->errorBag = $errorBag; + $this->validator = $validator; + } + + /** + * Create a new validation exception from a plain array of messages. + * + * @param array $messages + * @return static + */ + public static function withMessages(array $messages) + { + return new static(tap(ValidatorFacade::make([], []), function ($validator) use ($messages) { + foreach ($messages as $key => $value) { + foreach (Arr::wrap($value) as $message) { + $validator->errors()->add($key, $message); + } + } + })); + } + + /** + * Get all of the validation error messages. + * + * @return array + */ + public function errors() + { + return $this->validator->errors()->messages(); + } + + /** + * Set the HTTP status code to be used for the response. + * + * @param int $status + * @return $this + */ + public function status($status) + { + $this->status = $status; + + return $this; + } + + /** + * Set the error bag on the exception. + * + * @param string $errorBag + * @return $this + */ + public function errorBag($errorBag) + { + $this->errorBag = $errorBag; + + return $this; + } + + /** + * Set the URL to redirect to on a validation error. + * + * @param string $url + * @return $this + */ + public function redirectTo($url) + { + $this->redirectTo = $url; + + return $this; + } + + /** + * Get the underlying response instance. + * + * @return \Symfony\Component\HttpFoundation\Response|null + */ + public function getResponse() + { + return $this->response; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/ValidationRuleParser.php b/vendor/laravel/framework/src/Illuminate/Validation/ValidationRuleParser.php new file mode 100644 index 0000000..b8e4255 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/ValidationRuleParser.php @@ -0,0 +1,277 @@ +data = $data; + } + + /** + * Parse the human-friendly rules into a full rules array for the validator. + * + * @param array $rules + * @return \stdClass + */ + public function explode($rules) + { + $this->implicitAttributes = []; + + $rules = $this->explodeRules($rules); + + return (object) [ + 'rules' => $rules, + 'implicitAttributes' => $this->implicitAttributes, + ]; + } + + /** + * Explode the rules into an array of explicit rules. + * + * @param array $rules + * @return array + */ + protected function explodeRules($rules) + { + foreach ($rules as $key => $rule) { + if (Str::contains($key, '*')) { + $rules = $this->explodeWildcardRules($rules, $key, [$rule]); + + unset($rules[$key]); + } else { + $rules[$key] = $this->explodeExplicitRule($rule); + } + } + + return $rules; + } + + /** + * Explode the explicit rule into an array if necessary. + * + * @param mixed $rule + * @return array + */ + protected function explodeExplicitRule($rule) + { + if (is_string($rule)) { + return explode('|', $rule); + } elseif (is_object($rule)) { + return [$this->prepareRule($rule)]; + } + + return array_map([$this, 'prepareRule'], $rule); + } + + /** + * Prepare the given rule for the Validator. + * + * @param mixed $rule + * @return mixed + */ + protected function prepareRule($rule) + { + if ($rule instanceof Closure) { + $rule = new ClosureValidationRule($rule); + } + + if (! is_object($rule) || + $rule instanceof RuleContract || + ($rule instanceof Exists && $rule->queryCallbacks()) || + ($rule instanceof Unique && $rule->queryCallbacks())) { + return $rule; + } + + return (string) $rule; + } + + /** + * Define a set of rules that apply to each element in an array attribute. + * + * @param array $results + * @param string $attribute + * @param string|array $rules + * @return array + */ + protected function explodeWildcardRules($results, $attribute, $rules) + { + $pattern = str_replace('\*', '[^\.]*', preg_quote($attribute)); + + $data = ValidationData::initializeAndGatherData($attribute, $this->data); + + foreach ($data as $key => $value) { + if (Str::startsWith($key, $attribute) || (bool) preg_match('/^'.$pattern.'\z/', $key)) { + foreach ((array) $rules as $rule) { + $this->implicitAttributes[$attribute][] = $key; + + $results = $this->mergeRules($results, $key, $rule); + } + } + } + + return $results; + } + + /** + * Merge additional rules into a given attribute(s). + * + * @param array $results + * @param string|array $attribute + * @param string|array $rules + * @return array + */ + public function mergeRules($results, $attribute, $rules = []) + { + if (is_array($attribute)) { + foreach ((array) $attribute as $innerAttribute => $innerRules) { + $results = $this->mergeRulesForAttribute($results, $innerAttribute, $innerRules); + } + + return $results; + } + + return $this->mergeRulesForAttribute( + $results, $attribute, $rules + ); + } + + /** + * Merge additional rules into a given attribute. + * + * @param array $results + * @param string $attribute + * @param string|array $rules + * @return array + */ + protected function mergeRulesForAttribute($results, $attribute, $rules) + { + $merge = head($this->explodeRules([$rules])); + + $results[$attribute] = array_merge( + isset($results[$attribute]) ? $this->explodeExplicitRule($results[$attribute]) : [], $merge + ); + + return $results; + } + + /** + * Extract the rule name and parameters from a rule. + * + * @param array|string $rules + * @return array + */ + public static function parse($rules) + { + if ($rules instanceof RuleContract) { + return [$rules, []]; + } + + if (is_array($rules)) { + $rules = static::parseArrayRule($rules); + } else { + $rules = static::parseStringRule($rules); + } + + $rules[0] = static::normalizeRule($rules[0]); + + return $rules; + } + + /** + * Parse an array based rule. + * + * @param array $rules + * @return array + */ + protected static function parseArrayRule(array $rules) + { + return [Str::studly(trim(Arr::get($rules, 0))), array_slice($rules, 1)]; + } + + /** + * Parse a string based rule. + * + * @param string $rules + * @return array + */ + protected static function parseStringRule($rules) + { + $parameters = []; + + // The format for specifying validation rules and parameters follows an + // easy {rule}:{parameters} formatting convention. For instance the + // rule "Max:3" states that the value may only be three letters. + if (strpos($rules, ':') !== false) { + [$rules, $parameter] = explode(':', $rules, 2); + + $parameters = static::parseParameters($rules, $parameter); + } + + return [Str::studly(trim($rules)), $parameters]; + } + + /** + * Parse a parameter list. + * + * @param string $rule + * @param string $parameter + * @return array + */ + protected static function parseParameters($rule, $parameter) + { + $rule = strtolower($rule); + + if (in_array($rule, ['regex', 'not_regex', 'notregex'], true)) { + return [$parameter]; + } + + return str_getcsv($parameter); + } + + /** + * Normalizes a rule so that we can accept short types. + * + * @param string $rule + * @return string + */ + protected static function normalizeRule($rule) + { + switch ($rule) { + case 'Int': + return 'Integer'; + case 'Bool': + return 'Boolean'; + default: + return $rule; + } + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php new file mode 100755 index 0000000..a3c593f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php @@ -0,0 +1,72 @@ +registerPresenceVerifier(); + + $this->registerValidationFactory(); + } + + /** + * Register the validation factory. + * + * @return void + */ + protected function registerValidationFactory() + { + $this->app->singleton('validator', function ($app) { + $validator = new Factory($app['translator'], $app); + + // The validation presence verifier is responsible for determining the existence of + // values in a given data collection which is typically a relational database or + // other persistent data stores. It is used to check for "uniqueness" as well. + if (isset($app['db'], $app['validation.presence'])) { + $validator->setPresenceVerifier($app['validation.presence']); + } + + return $validator; + }); + } + + /** + * Register the database presence verifier. + * + * @return void + */ + protected function registerPresenceVerifier() + { + $this->app->singleton('validation.presence', function ($app) { + return new DatabasePresenceVerifier($app['db']); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return [ + 'validator', 'validation.presence', + ]; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/Validator.php b/vendor/laravel/framework/src/Illuminate/Validation/Validator.php new file mode 100755 index 0000000..4bde9dd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/Validator.php @@ -0,0 +1,1191 @@ +initialRules = $rules; + $this->translator = $translator; + $this->customMessages = $messages; + $this->data = $this->parseData($data); + $this->customAttributes = $customAttributes; + + $this->setRules($rules); + } + + /** + * Parse the data array, converting dots to ->. + * + * @param array $data + * @return array + */ + public function parseData(array $data) + { + $newData = []; + + foreach ($data as $key => $value) { + if (is_array($value)) { + $value = $this->parseData($value); + } + + // If the data key contains a dot, we will replace it with another character + // sequence so it doesn't interfere with dot processing when working with + // array based validation rules and array_dot later in the validations. + if (Str::contains($key, '.')) { + $newData[str_replace('.', '->', $key)] = $value; + } else { + $newData[$key] = $value; + } + } + + return $newData; + } + + /** + * Add an after validation callback. + * + * @param callable|string $callback + * @return $this + */ + public function after($callback) + { + $this->after[] = function () use ($callback) { + return call_user_func_array($callback, [$this]); + }; + + return $this; + } + + /** + * Determine if the data passes the validation rules. + * + * @return bool + */ + public function passes() + { + $this->messages = new MessageBag; + + $this->distinctValues = []; + + // We'll spin through each rule, validating the attributes attached to that + // rule. Any error messages will be added to the containers with each of + // the other error messages, returning true if we don't have messages. + foreach ($this->rules as $attribute => $rules) { + $attribute = str_replace('\.', '->', $attribute); + + foreach ($rules as $rule) { + $this->validateAttribute($attribute, $rule); + + if ($this->shouldStopValidating($attribute)) { + break; + } + } + } + + // Here we will spin through all of the "after" hooks on this validator and + // fire them off. This gives the callbacks a chance to perform all kinds + // of other validation that needs to get wrapped up in this operation. + foreach ($this->after as $after) { + call_user_func($after); + } + + return $this->messages->isEmpty(); + } + + /** + * Determine if the data fails the validation rules. + * + * @return bool + */ + public function fails() + { + return ! $this->passes(); + } + + /** + * Run the validator's rules against its data. + * + * @return array + * + * @throws \Illuminate\Validation\ValidationException + */ + public function validate() + { + if ($this->fails()) { + throw new ValidationException($this); + } + + return $this->validated(); + } + + /** + * Return validated value. + * + * @return array + * + * @throws \Illuminate\Validation\ValidationException + */ + public function validated() + { + if ($this->invalid()) { + throw new ValidationException($this); + } + + $results = []; + + $missingValue = Str::random(10); + + foreach (array_keys($this->getRules()) as $key) { + $value = data_get($this->getData(), $key, $missingValue); + + if ($value !== $missingValue) { + Arr::set($results, $key, $value); + } + } + + return $results; + } + + /** + * Validate a given attribute against a rule. + * + * @param string $attribute + * @param string $rule + * @return void + */ + protected function validateAttribute($attribute, $rule) + { + $this->currentRule = $rule; + + [$rule, $parameters] = ValidationRuleParser::parse($rule); + + if ($rule == '') { + return; + } + + // First we will get the correct keys for the given attribute in case the field is nested in + // an array. Then we determine if the given rule accepts other field names as parameters. + // If so, we will replace any asterisks found in the parameters with the correct keys. + if (($keys = $this->getExplicitKeys($attribute)) && + $this->dependsOnOtherFields($rule)) { + $parameters = $this->replaceAsterisksInParameters($parameters, $keys); + } + + $value = $this->getValue($attribute); + + // If the attribute is a file, we will verify that the file upload was actually successful + // and if it wasn't we will add a failure for the attribute. Files may not successfully + // upload if they are too large based on PHP's settings so we will bail in this case. + if ($value instanceof UploadedFile && ! $value->isValid() && + $this->hasRule($attribute, array_merge($this->fileRules, $this->implicitRules)) + ) { + return $this->addFailure($attribute, 'uploaded', []); + } + + // If we have made it this far we will make sure the attribute is validatable and if it is + // we will call the validation method with the attribute. If a method returns false the + // attribute is invalid and we will add a failure message for this failing attribute. + $validatable = $this->isValidatable($rule, $attribute, $value); + + if ($rule instanceof RuleContract) { + return $validatable + ? $this->validateUsingCustomRule($attribute, $value, $rule) + : null; + } + + $method = "validate{$rule}"; + + if ($validatable && ! $this->$method($attribute, $value, $parameters, $this)) { + $this->addFailure($attribute, $rule, $parameters); + } + } + + /** + * Determine if the given rule depends on other fields. + * + * @param string $rule + * @return bool + */ + protected function dependsOnOtherFields($rule) + { + return in_array($rule, $this->dependentRules); + } + + /** + * Get the explicit keys from an attribute flattened with dot notation. + * + * E.g. 'foo.1.bar.spark.baz' -> [1, 'spark'] for 'foo.*.bar.*.baz' + * + * @param string $attribute + * @return array + */ + protected function getExplicitKeys($attribute) + { + $pattern = str_replace('\*', '([^\.]+)', preg_quote($this->getPrimaryAttribute($attribute), '/')); + + if (preg_match('/^'.$pattern.'/', $attribute, $keys)) { + array_shift($keys); + + return $keys; + } + + return []; + } + + /** + * Get the primary attribute name. + * + * For example, if "name.0" is given, "name.*" will be returned. + * + * @param string $attribute + * @return string + */ + protected function getPrimaryAttribute($attribute) + { + foreach ($this->implicitAttributes as $unparsed => $parsed) { + if (in_array($attribute, $parsed)) { + return $unparsed; + } + } + + return $attribute; + } + + /** + * Replace each field parameter which has asterisks with the given keys. + * + * @param array $parameters + * @param array $keys + * @return array + */ + protected function replaceAsterisksInParameters(array $parameters, array $keys) + { + return array_map(function ($field) use ($keys) { + return vsprintf(str_replace('*', '%s', $field), $keys); + }, $parameters); + } + + /** + * Determine if the attribute is validatable. + * + * @param object|string $rule + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function isValidatable($rule, $attribute, $value) + { + return $this->presentOrRuleIsImplicit($rule, $attribute, $value) && + $this->passesOptionalCheck($attribute) && + $this->isNotNullIfMarkedAsNullable($rule, $attribute) && + $this->hasNotFailedPreviousRuleIfPresenceRule($rule, $attribute); + } + + /** + * Determine if the field is present, or the rule implies required. + * + * @param object|string $rule + * @param string $attribute + * @param mixed $value + * @return bool + */ + protected function presentOrRuleIsImplicit($rule, $attribute, $value) + { + if (is_string($value) && trim($value) === '') { + return $this->isImplicit($rule); + } + + return $this->validatePresent($attribute, $value) || + $this->isImplicit($rule); + } + + /** + * Determine if a given rule implies the attribute is required. + * + * @param object|string $rule + * @return bool + */ + protected function isImplicit($rule) + { + return $rule instanceof ImplicitRule || + in_array($rule, $this->implicitRules); + } + + /** + * Determine if the attribute passes any optional check. + * + * @param string $attribute + * @return bool + */ + protected function passesOptionalCheck($attribute) + { + if (! $this->hasRule($attribute, ['Sometimes'])) { + return true; + } + + $data = ValidationData::initializeAndGatherData($attribute, $this->data); + + return array_key_exists($attribute, $data) + || array_key_exists($attribute, $this->data); + } + + /** + * Determine if the attribute fails the nullable check. + * + * @param string $rule + * @param string $attribute + * @return bool + */ + protected function isNotNullIfMarkedAsNullable($rule, $attribute) + { + if ($this->isImplicit($rule) || ! $this->hasRule($attribute, ['Nullable'])) { + return true; + } + + return ! is_null(Arr::get($this->data, $attribute, 0)); + } + + /** + * Determine if it's a necessary presence validation. + * + * This is to avoid possible database type comparison errors. + * + * @param string $rule + * @param string $attribute + * @return bool + */ + protected function hasNotFailedPreviousRuleIfPresenceRule($rule, $attribute) + { + return in_array($rule, ['Unique', 'Exists']) ? ! $this->messages->has($attribute) : true; + } + + /** + * Validate an attribute using a custom rule object. + * + * @param string $attribute + * @param mixed $value + * @param \Illuminate\Contracts\Validation\Rule $rule + * @return void + */ + protected function validateUsingCustomRule($attribute, $value, $rule) + { + if (! $rule->passes($attribute, $value)) { + $this->failedRules[$attribute][get_class($rule)] = []; + + $messages = (array) $rule->message(); + + foreach ($messages as $message) { + $this->messages->add($attribute, $this->makeReplacements( + $message, $attribute, get_class($rule), [] + )); + } + } + } + + /** + * Check if we should stop further validations on a given attribute. + * + * @param string $attribute + * @return bool + */ + protected function shouldStopValidating($attribute) + { + if ($this->hasRule($attribute, ['Bail'])) { + return $this->messages->has($attribute); + } + + if (isset($this->failedRules[$attribute]) && + array_key_exists('uploaded', $this->failedRules[$attribute])) { + return true; + } + + // In case the attribute has any rule that indicates that the field is required + // and that rule already failed then we should stop validation at this point + // as now there is no point in calling other rules with this field empty. + return $this->hasRule($attribute, $this->implicitRules) && + isset($this->failedRules[$attribute]) && + array_intersect(array_keys($this->failedRules[$attribute]), $this->implicitRules); + } + + /** + * Add a failed rule and error message to the collection. + * + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return void + */ + public function addFailure($attribute, $rule, $parameters = []) + { + if (! $this->messages) { + $this->passes(); + } + + $this->messages->add($attribute, $this->makeReplacements( + $this->getMessage($attribute, $rule), $attribute, $rule, $parameters + )); + + $this->failedRules[$attribute][$rule] = $parameters; + } + + /** + * Returns the data which was valid. + * + * @return array + */ + public function valid() + { + if (! $this->messages) { + $this->passes(); + } + + return array_diff_key( + $this->data, $this->attributesThatHaveMessages() + ); + } + + /** + * Returns the data which was invalid. + * + * @return array + */ + public function invalid() + { + if (! $this->messages) { + $this->passes(); + } + + return array_intersect_key( + $this->data, $this->attributesThatHaveMessages() + ); + } + + /** + * Generate an array of all attributes that have messages. + * + * @return array + */ + protected function attributesThatHaveMessages() + { + return collect($this->messages()->toArray())->map(function ($message, $key) { + return explode('.', $key)[0]; + })->unique()->flip()->all(); + } + + /** + * Get the failed validation rules. + * + * @return array + */ + public function failed() + { + return $this->failedRules; + } + + /** + * Get the message container for the validator. + * + * @return \Illuminate\Support\MessageBag + */ + public function messages() + { + if (! $this->messages) { + $this->passes(); + } + + return $this->messages; + } + + /** + * An alternative more semantic shortcut to the message container. + * + * @return \Illuminate\Support\MessageBag + */ + public function errors() + { + return $this->messages(); + } + + /** + * Get the messages for the instance. + * + * @return \Illuminate\Support\MessageBag + */ + public function getMessageBag() + { + return $this->messages(); + } + + /** + * Determine if the given attribute has a rule in the given set. + * + * @param string $attribute + * @param string|array $rules + * @return bool + */ + public function hasRule($attribute, $rules) + { + return ! is_null($this->getRule($attribute, $rules)); + } + + /** + * Get a rule and its parameters for a given attribute. + * + * @param string $attribute + * @param string|array $rules + * @return array|null + */ + protected function getRule($attribute, $rules) + { + if (! array_key_exists($attribute, $this->rules)) { + return; + } + + $rules = (array) $rules; + + foreach ($this->rules[$attribute] as $rule) { + [$rule, $parameters] = ValidationRuleParser::parse($rule); + + if (in_array($rule, $rules)) { + return [$rule, $parameters]; + } + } + } + + /** + * Get the data under validation. + * + * @return array + */ + public function attributes() + { + return $this->getData(); + } + + /** + * Get the data under validation. + * + * @return array + */ + public function getData() + { + return $this->data; + } + + /** + * Set the data under validation. + * + * @param array $data + * @return $this + */ + public function setData(array $data) + { + $this->data = $this->parseData($data); + + $this->setRules($this->initialRules); + + return $this; + } + + /** + * Get the value of a given attribute. + * + * @param string $attribute + * @return mixed + */ + protected function getValue($attribute) + { + return Arr::get($this->data, $attribute); + } + + /** + * Get the validation rules. + * + * @return array + */ + public function getRules() + { + return $this->rules; + } + + /** + * Set the validation rules. + * + * @param array $rules + * @return $this + */ + public function setRules(array $rules) + { + $this->initialRules = $rules; + + $this->rules = []; + + $this->addRules($rules); + + return $this; + } + + /** + * Parse the given rules and merge them into current rules. + * + * @param array $rules + * @return void + */ + public function addRules($rules) + { + // The primary purpose of this parser is to expand any "*" rules to the all + // of the explicit rules needed for the given data. For example the rule + // names.* would get expanded to names.0, names.1, etc. for this data. + $response = (new ValidationRuleParser($this->data)) + ->explode($rules); + + $this->rules = array_merge_recursive( + $this->rules, $response->rules + ); + + $this->implicitAttributes = array_merge( + $this->implicitAttributes, $response->implicitAttributes + ); + } + + /** + * Add conditions to a given field based on a Closure. + * + * @param string|array $attribute + * @param string|array $rules + * @param callable $callback + * @return $this + */ + public function sometimes($attribute, $rules, callable $callback) + { + $payload = new Fluent($this->getData()); + + if (call_user_func($callback, $payload)) { + foreach ((array) $attribute as $key) { + $this->addRules([$key => $rules]); + } + } + + return $this; + } + + /** + * Register an array of custom validator extensions. + * + * @param array $extensions + * @return void + */ + public function addExtensions(array $extensions) + { + if ($extensions) { + $keys = array_map('\Illuminate\Support\Str::snake', array_keys($extensions)); + + $extensions = array_combine($keys, array_values($extensions)); + } + + $this->extensions = array_merge($this->extensions, $extensions); + } + + /** + * Register an array of custom implicit validator extensions. + * + * @param array $extensions + * @return void + */ + public function addImplicitExtensions(array $extensions) + { + $this->addExtensions($extensions); + + foreach ($extensions as $rule => $extension) { + $this->implicitRules[] = Str::studly($rule); + } + } + + /** + * Register an array of custom implicit validator extensions. + * + * @param array $extensions + * @return void + */ + public function addDependentExtensions(array $extensions) + { + $this->addExtensions($extensions); + + foreach ($extensions as $rule => $extension) { + $this->dependentRules[] = Str::studly($rule); + } + } + + /** + * Register a custom validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @return void + */ + public function addExtension($rule, $extension) + { + $this->extensions[Str::snake($rule)] = $extension; + } + + /** + * Register a custom implicit validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @return void + */ + public function addImplicitExtension($rule, $extension) + { + $this->addExtension($rule, $extension); + + $this->implicitRules[] = Str::studly($rule); + } + + /** + * Register a custom dependent validator extension. + * + * @param string $rule + * @param \Closure|string $extension + * @return void + */ + public function addDependentExtension($rule, $extension) + { + $this->addExtension($rule, $extension); + + $this->dependentRules[] = Str::studly($rule); + } + + /** + * Register an array of custom validator message replacers. + * + * @param array $replacers + * @return void + */ + public function addReplacers(array $replacers) + { + if ($replacers) { + $keys = array_map('\Illuminate\Support\Str::snake', array_keys($replacers)); + + $replacers = array_combine($keys, array_values($replacers)); + } + + $this->replacers = array_merge($this->replacers, $replacers); + } + + /** + * Register a custom validator message replacer. + * + * @param string $rule + * @param \Closure|string $replacer + * @return void + */ + public function addReplacer($rule, $replacer) + { + $this->replacers[Str::snake($rule)] = $replacer; + } + + /** + * Set the custom messages for the validator. + * + * @param array $messages + * @return $this + */ + public function setCustomMessages(array $messages) + { + $this->customMessages = array_merge($this->customMessages, $messages); + + return $this; + } + + /** + * Set the custom attributes on the validator. + * + * @param array $attributes + * @return $this + */ + public function setAttributeNames(array $attributes) + { + $this->customAttributes = $attributes; + + return $this; + } + + /** + * Add custom attributes to the validator. + * + * @param array $customAttributes + * @return $this + */ + public function addCustomAttributes(array $customAttributes) + { + $this->customAttributes = array_merge($this->customAttributes, $customAttributes); + + return $this; + } + + /** + * Set the custom values on the validator. + * + * @param array $values + * @return $this + */ + public function setValueNames(array $values) + { + $this->customValues = $values; + + return $this; + } + + /** + * Add the custom values for the validator. + * + * @param array $customValues + * @return $this + */ + public function addCustomValues(array $customValues) + { + $this->customValues = array_merge($this->customValues, $customValues); + + return $this; + } + + /** + * Set the fallback messages for the validator. + * + * @param array $messages + * @return void + */ + public function setFallbackMessages(array $messages) + { + $this->fallbackMessages = $messages; + } + + /** + * Get the Presence Verifier implementation. + * + * @return \Illuminate\Validation\PresenceVerifierInterface + * + * @throws \RuntimeException + */ + public function getPresenceVerifier() + { + if (! isset($this->presenceVerifier)) { + throw new RuntimeException('Presence verifier has not been set.'); + } + + return $this->presenceVerifier; + } + + /** + * Get the Presence Verifier implementation. + * + * @param string $connection + * @return \Illuminate\Validation\PresenceVerifierInterface + * + * @throws \RuntimeException + */ + protected function getPresenceVerifierFor($connection) + { + return tap($this->getPresenceVerifier(), function ($verifier) use ($connection) { + $verifier->setConnection($connection); + }); + } + + /** + * Set the Presence Verifier implementation. + * + * @param \Illuminate\Validation\PresenceVerifierInterface $presenceVerifier + * @return void + */ + public function setPresenceVerifier(PresenceVerifierInterface $presenceVerifier) + { + $this->presenceVerifier = $presenceVerifier; + } + + /** + * Get the Translator implementation. + * + * @return \Illuminate\Contracts\Translation\Translator + */ + public function getTranslator() + { + return $this->translator; + } + + /** + * Set the Translator implementation. + * + * @param \Illuminate\Contracts\Translation\Translator $translator + * @return void + */ + public function setTranslator(Translator $translator) + { + $this->translator = $translator; + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function setContainer(Container $container) + { + $this->container = $container; + } + + /** + * Call a custom validator extension. + * + * @param string $rule + * @param array $parameters + * @return bool|null + */ + protected function callExtension($rule, $parameters) + { + $callback = $this->extensions[$rule]; + + if (is_callable($callback)) { + return call_user_func_array($callback, $parameters); + } elseif (is_string($callback)) { + return $this->callClassBasedExtension($callback, $parameters); + } + } + + /** + * Call a class based validator extension. + * + * @param string $callback + * @param array $parameters + * @return bool + */ + protected function callClassBasedExtension($callback, $parameters) + { + [$class, $method] = Str::parseCallback($callback, 'validate'); + + return call_user_func_array([$this->container->make($class), $method], $parameters); + } + + /** + * Handle dynamic calls to class methods. + * + * @param string $method + * @param array $parameters + * @return mixed + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + $rule = Str::snake(substr($method, 8)); + + if (isset($this->extensions[$rule])) { + return $this->callExtension($rule, $parameters); + } + + throw new BadMethodCallException(sprintf( + 'Method %s::%s does not exist.', static::class, $method + )); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/Validation/composer.json b/vendor/laravel/framework/src/Illuminate/Validation/composer.json new file mode 100755 index 0000000..4a9da5f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/Validation/composer.json @@ -0,0 +1,41 @@ +{ + "name": "illuminate/validation", + "description": "The Illuminate Validation package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/container": "5.7.*", + "illuminate/contracts": "5.7.*", + "illuminate/support": "5.7.*", + "illuminate/translation": "5.7.*", + "symfony/http-foundation": "^4.1" + }, + "autoload": { + "psr-4": { + "Illuminate\\Validation\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "suggest": { + "illuminate/database": "Required to use the database presence verifier (5.7.*)." + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php new file mode 100644 index 0000000..119a20a --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php @@ -0,0 +1,519 @@ +setPath($path); + } + + if (! is_null($this->cachePath)) { + $contents = $this->compileString($this->files->get($this->getPath())); + + $this->files->put($this->getCompiledPath($this->getPath()), $contents); + } + } + + /** + * Get the path currently being compiled. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set the path currently being compiled. + * + * @param string $path + * @return void + */ + public function setPath($path) + { + $this->path = $path; + } + + /** + * Compile the given Blade template contents. + * + * @param string $value + * @return string + */ + public function compileString($value) + { + if (strpos($value, '@verbatim') !== false) { + $value = $this->storeVerbatimBlocks($value); + } + + $this->footer = []; + + if (strpos($value, '@php') !== false) { + $value = $this->storePhpBlocks($value); + } + + $result = ''; + + // Here we will loop through all of the tokens returned by the Zend lexer and + // parse each one into the corresponding valid PHP. We will then have this + // template as the correctly rendered PHP that can be rendered natively. + foreach (token_get_all($value) as $token) { + $result .= is_array($token) ? $this->parseToken($token) : $token; + } + + if (! empty($this->rawBlocks)) { + $result = $this->restoreRawContent($result); + } + + // If there are any footer lines that need to get added to a template we will + // add them here at the end of the template. This gets used mainly for the + // template inheritance via the extends keyword that should be appended. + if (count($this->footer) > 0) { + $result = $this->addFooters($result); + } + + return $result; + } + + /** + * Store the verbatim blocks and replace them with a temporary placeholder. + * + * @param string $value + * @return string + */ + protected function storeVerbatimBlocks($value) + { + return preg_replace_callback('/(?storeRawBlock($matches[1]); + }, $value); + } + + /** + * Store the PHP blocks and replace them with a temporary placeholder. + * + * @param string $value + * @return string + */ + protected function storePhpBlocks($value) + { + return preg_replace_callback('/(?storeRawBlock(""); + }, $value); + } + + /** + * Store a raw block and return a unique raw placeholder. + * + * @param string $value + * @return string + */ + protected function storeRawBlock($value) + { + return $this->getRawPlaceholder( + array_push($this->rawBlocks, $value) - 1 + ); + } + + /** + * Replace the raw placeholders with the original code stored in the raw blocks. + * + * @param string $result + * @return string + */ + protected function restoreRawContent($result) + { + $result = preg_replace_callback('/'.$this->getRawPlaceholder('(\d+)').'/', function ($matches) { + return $this->rawBlocks[$matches[1]]; + }, $result); + + $this->rawBlocks = []; + + return $result; + } + + /** + * Get a placeholder to temporary mark the position of raw blocks. + * + * @param int|string $replace + * @return string + */ + protected function getRawPlaceholder($replace) + { + return str_replace('#', $replace, '@__raw_block_#__@'); + } + + /** + * Add the stored footers onto the given content. + * + * @param string $result + * @return string + */ + protected function addFooters($result) + { + return ltrim($result, PHP_EOL) + .PHP_EOL.implode(PHP_EOL, array_reverse($this->footer)); + } + + /** + * Parse the tokens from the template. + * + * @param array $token + * @return string + */ + protected function parseToken($token) + { + [$id, $content] = $token; + + if ($id == T_INLINE_HTML) { + foreach ($this->compilers as $type) { + $content = $this->{"compile{$type}"}($content); + } + } + + return $content; + } + + /** + * Execute the user defined extensions. + * + * @param string $value + * @return string + */ + protected function compileExtensions($value) + { + foreach ($this->extensions as $compiler) { + $value = call_user_func($compiler, $value, $this); + } + + return $value; + } + + /** + * Compile Blade statements that start with "@". + * + * @param string $value + * @return string + */ + protected function compileStatements($value) + { + return preg_replace_callback( + '/\B@(@?\w+(?:::\w+)?)([ \t]*)(\( ( (?>[^()]+) | (?3) )* \))?/x', function ($match) { + return $this->compileStatement($match); + }, $value + ); + } + + /** + * Compile a single Blade @ statement. + * + * @param array $match + * @return string + */ + protected function compileStatement($match) + { + if (Str::contains($match[1], '@')) { + $match[0] = isset($match[3]) ? $match[1].$match[3] : $match[1]; + } elseif (isset($this->customDirectives[$match[1]])) { + $match[0] = $this->callCustomDirective($match[1], Arr::get($match, 3)); + } elseif (method_exists($this, $method = 'compile'.ucfirst($match[1]))) { + $match[0] = $this->$method(Arr::get($match, 3)); + } + + return isset($match[3]) ? $match[0] : $match[0].$match[2]; + } + + /** + * Call the given directive with the given value. + * + * @param string $name + * @param string|null $value + * @return string + */ + protected function callCustomDirective($name, $value) + { + if (Str::startsWith($value, '(') && Str::endsWith($value, ')')) { + $value = Str::substr($value, 1, -1); + } + + return call_user_func($this->customDirectives[$name], trim($value)); + } + + /** + * Strip the parentheses from the given expression. + * + * @param string $expression + * @return string + */ + public function stripParentheses($expression) + { + if (Str::startsWith($expression, '(')) { + $expression = substr($expression, 1, -1); + } + + return $expression; + } + + /** + * Register a custom Blade compiler. + * + * @param callable $compiler + * @return void + */ + public function extend(callable $compiler) + { + $this->extensions[] = $compiler; + } + + /** + * Get the extensions used by the compiler. + * + * @return array + */ + public function getExtensions() + { + return $this->extensions; + } + + /** + * Register an "if" statement directive. + * + * @param string $name + * @param callable $callback + * @return void + */ + public function if($name, callable $callback) + { + $this->conditions[$name] = $callback; + + $this->directive($name, function ($expression) use ($name) { + return $expression !== '' + ? "" + : ""; + }); + + $this->directive('else'.$name, function ($expression) use ($name) { + return $expression !== '' + ? "" + : ""; + }); + + $this->directive('end'.$name, function () { + return ''; + }); + } + + /** + * Check the result of a condition. + * + * @param string $name + * @param array $parameters + * @return bool + */ + public function check($name, ...$parameters) + { + return call_user_func($this->conditions[$name], ...$parameters); + } + + /** + * Register a component alias directive. + * + * @param string $path + * @param string $alias + * @return void + */ + public function component($path, $alias = null) + { + $alias = $alias ?: Arr::last(explode('.', $path)); + + $this->directive($alias, function ($expression) use ($path) { + return $expression + ? "startComponent('{$path}', {$expression}); ?>" + : "startComponent('{$path}'); ?>"; + }); + + $this->directive('end'.$alias, function ($expression) { + return 'renderComponent(); ?>'; + }); + } + + /** + * Register an include alias directive. + * + * @param string $path + * @param string $alias + * @return void + */ + public function include($path, $alias = null) + { + $alias = $alias ?: Arr::last(explode('.', $path)); + + $this->directive($alias, function ($expression) use ($path) { + $expression = $this->stripParentheses($expression) ?: '[]'; + + return "make('{$path}', {$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>"; + }); + } + + /** + * Register a handler for custom directives. + * + * @param string $name + * @param callable $handler + * @return void + */ + public function directive($name, callable $handler) + { + $this->customDirectives[$name] = $handler; + } + + /** + * Get the list of custom directives. + * + * @return array + */ + public function getCustomDirectives() + { + return $this->customDirectives; + } + + /** + * Set the echo format to be used by the compiler. + * + * @param string $format + * @return void + */ + public function setEchoFormat($format) + { + $this->echoFormat = $format; + } + + /** + * Set the "echo" format to double encode entities. + * + * @return void + */ + public function withDoubleEncoding() + { + $this->setEchoFormat('e(%s, true)'); + } + + /** + * Set the "echo" format to not double encode entities. + * + * @return void + */ + public function withoutDoubleEncoding() + { + $this->setEchoFormat('e(%s, false)'); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php new file mode 100755 index 0000000..9407419 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php @@ -0,0 +1,74 @@ +files = $files; + $this->cachePath = $cachePath; + } + + /** + * Get the path to the compiled version of a view. + * + * @param string $path + * @return string + */ + public function getCompiledPath($path) + { + return $this->cachePath.'/'.sha1($path).'.php'; + } + + /** + * Determine if the view at the given path is expired. + * + * @param string $path + * @return bool + */ + public function isExpired($path) + { + $compiled = $this->getCompiledPath($path); + + // If the compiled file doesn't exist we will indicate that the view is expired + // so that it can be re-compiled. Else, we will verify the last modification + // of the views is less than the modification times of the compiled views. + if (! $this->files->exists($compiled)) { + return true; + } + + return $this->files->lastModified($path) >= + $this->files->lastModified($compiled); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/CompilerInterface.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/CompilerInterface.php new file mode 100755 index 0000000..dfcb023 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/CompilerInterface.php @@ -0,0 +1,30 @@ +check{$expression}): ?>"; + } + + /** + * Compile the cannot statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileCannot($expression) + { + return "denies{$expression}): ?>"; + } + + /** + * Compile the canany statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileCanany($expression) + { + return "any{$expression}): ?>"; + } + + /** + * Compile the else-can statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileElsecan($expression) + { + return "check{$expression}): ?>"; + } + + /** + * Compile the else-cannot statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileElsecannot($expression) + { + return "denies{$expression}): ?>"; + } + + /** + * Compile the else-canany statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileElsecanany($expression) + { + return "any{$expression}): ?>"; + } + + /** + * Compile the end-can statements into valid PHP. + * + * @return string + */ + protected function compileEndcan() + { + return ''; + } + + /** + * Compile the end-cannot statements into valid PHP. + * + * @return string + */ + protected function compileEndcannot() + { + return ''; + } + + /** + * Compile the end-canany statements into valid PHP. + * + * @return string + */ + protected function compileEndcanany() + { + return ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesComments.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesComments.php new file mode 100644 index 0000000..104a9c8 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesComments.php @@ -0,0 +1,19 @@ +contentTags[0], $this->contentTags[1]); + + return preg_replace($pattern, '', $value); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php new file mode 100644 index 0000000..af0eee7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php @@ -0,0 +1,48 @@ +startComponent{$expression}; ?>"; + } + + /** + * Compile the end-component statements into valid PHP. + * + * @return string + */ + protected function compileEndComponent() + { + return 'renderComponent(); ?>'; + } + + /** + * Compile the slot statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileSlot($expression) + { + return "slot{$expression}; ?>"; + } + + /** + * Compile the end-slot statements into valid PHP. + * + * @return string + */ + protected function compileEndSlot() + { + return 'endSlot(); ?>'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php new file mode 100644 index 0000000..d592ef1 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php @@ -0,0 +1,230 @@ +guard{$guard}->check()): ?>"; + } + + /** + * Compile the else-auth statements into valid PHP. + * + * @param string|null $guard + * @return string + */ + protected function compileElseAuth($guard = null) + { + $guard = is_null($guard) ? '()' : $guard; + + return "guard{$guard}->check()): ?>"; + } + + /** + * Compile the end-auth statements into valid PHP. + * + * @return string + */ + protected function compileEndAuth() + { + return ''; + } + + /** + * Compile the if-guest statements into valid PHP. + * + * @param string|null $guard + * @return string + */ + protected function compileGuest($guard = null) + { + $guard = is_null($guard) ? '()' : $guard; + + return "guard{$guard}->guest()): ?>"; + } + + /** + * Compile the else-guest statements into valid PHP. + * + * @param string|null $guard + * @return string + */ + protected function compileElseGuest($guard = null) + { + $guard = is_null($guard) ? '()' : $guard; + + return "guard{$guard}->guest()): ?>"; + } + + /** + * Compile the end-guest statements into valid PHP. + * + * @return string + */ + protected function compileEndGuest() + { + return ''; + } + + /** + * Compile the has-section statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileHasSection($expression) + { + return "yieldContent{$expression}))): ?>"; + } + + /** + * Compile the if statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileIf($expression) + { + return ""; + } + + /** + * Compile the unless statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileUnless($expression) + { + return ""; + } + + /** + * Compile the else-if statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileElseif($expression) + { + return ""; + } + + /** + * Compile the else statements into valid PHP. + * + * @return string + */ + protected function compileElse() + { + return ''; + } + + /** + * Compile the end-if statements into valid PHP. + * + * @return string + */ + protected function compileEndif() + { + return ''; + } + + /** + * Compile the end-unless statements into valid PHP. + * + * @return string + */ + protected function compileEndunless() + { + return ''; + } + + /** + * Compile the if-isset statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileIsset($expression) + { + return ""; + } + + /** + * Compile the end-isset statements into valid PHP. + * + * @return string + */ + protected function compileEndIsset() + { + return ''; + } + + /** + * Compile the switch statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileSwitch($expression) + { + $this->firstCaseInSwitch = true; + + return "firstCaseInSwitch) { + $this->firstCaseInSwitch = false; + + return "case {$expression}: ?>"; + } + + return ""; + } + + /** + * Compile the default statements in switch case into valid PHP. + * + * @return string + */ + protected function compileDefault() + { + return ''; + } + + /** + * Compile the end switch statements into valid PHP. + * + * @return string + */ + protected function compileEndSwitch() + { + return ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesEchos.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesEchos.php new file mode 100644 index 0000000..86f352e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesEchos.php @@ -0,0 +1,94 @@ +getEchoMethods() as $method) { + $value = $this->$method($value); + } + + return $value; + } + + /** + * Get the echo methods in the proper order for compilation. + * + * @return array + */ + protected function getEchoMethods() + { + return [ + 'compileRawEchos', + 'compileEscapedEchos', + 'compileRegularEchos', + ]; + } + + /** + * Compile the "raw" echo statements. + * + * @param string $value + * @return string + */ + protected function compileRawEchos($value) + { + $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->rawTags[0], $this->rawTags[1]); + + $callback = function ($matches) { + $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; + + return $matches[1] ? substr($matches[0], 1) : "{$whitespace}"; + }; + + return preg_replace_callback($pattern, $callback, $value); + } + + /** + * Compile the "regular" echo statements. + * + * @param string $value + * @return string + */ + protected function compileRegularEchos($value) + { + $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->contentTags[0], $this->contentTags[1]); + + $callback = function ($matches) { + $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; + + $wrapped = sprintf($this->echoFormat, $matches[2]); + + return $matches[1] ? substr($matches[0], 1) : "{$whitespace}"; + }; + + return preg_replace_callback($pattern, $callback, $value); + } + + /** + * Compile the escaped echo statements. + * + * @param string $value + * @return string + */ + protected function compileEscapedEchos($value) + { + $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->escapedTags[0], $this->escapedTags[1]); + + $callback = function ($matches) { + $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; + + return $matches[1] ? $matches[0] : "{$whitespace}"; + }; + + return preg_replace_callback($pattern, $callback, $value); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesHelpers.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesHelpers.php new file mode 100644 index 0000000..979cadc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesHelpers.php @@ -0,0 +1,49 @@ +'; + } + + /** + * Compile the "dd" statements into valid PHP. + * + * @param string $arguments + * @return string + */ + protected function compileDd($arguments) + { + return ""; + } + + /** + * Compile the "dump" statements into valid PHP. + * + * @param string $arguments + * @return string + */ + protected function compileDump($arguments) + { + return ""; + } + + /** + * Compile the method statements into valid PHP. + * + * @param string $method + * @return string + */ + protected function compileMethod($method) + { + return ""; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesIncludes.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesIncludes.php new file mode 100644 index 0000000..0a310ce --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesIncludes.php @@ -0,0 +1,69 @@ +renderEach{$expression}; ?>"; + } + + /** + * Compile the include statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileInclude($expression) + { + $expression = $this->stripParentheses($expression); + + return "make({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>"; + } + + /** + * Compile the include-if statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileIncludeIf($expression) + { + $expression = $this->stripParentheses($expression); + + return "exists({$expression})) echo \$__env->make({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>"; + } + + /** + * Compile the include-when statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileIncludeWhen($expression) + { + $expression = $this->stripParentheses($expression); + + return "renderWhen($expression, \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path'))); ?>"; + } + + /** + * Compile the include-first statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileIncludeFirst($expression) + { + $expression = $this->stripParentheses($expression); + + return "first({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>"; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesInjections.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesInjections.php new file mode 100644 index 0000000..c295bcd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesInjections.php @@ -0,0 +1,23 @@ +"; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesJson.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesJson.php new file mode 100644 index 0000000..cf343e9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesJson.php @@ -0,0 +1,30 @@ +stripParentheses($expression)); + + $options = isset($parts[1]) ? trim($parts[1]) : $this->encodingOptions; + + $depth = isset($parts[2]) ? trim($parts[2]) : 512; + + return ""; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php new file mode 100644 index 0000000..67429c7 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLayouts.php @@ -0,0 +1,116 @@ +stripParentheses($expression); + + $echo = "make({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>"; + + $this->footer[] = $echo; + + return ''; + } + + /** + * Compile the section statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileSection($expression) + { + $this->lastSection = trim($expression, "()'\" "); + + return "startSection{$expression}; ?>"; + } + + /** + * Replace the @parent directive to a placeholder. + * + * @return string + */ + protected function compileParent() + { + return ViewFactory::parentPlaceholder($this->lastSection ?: ''); + } + + /** + * Compile the yield statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileYield($expression) + { + return "yieldContent{$expression}; ?>"; + } + + /** + * Compile the show statements into valid PHP. + * + * @return string + */ + protected function compileShow() + { + return 'yieldSection(); ?>'; + } + + /** + * Compile the append statements into valid PHP. + * + * @return string + */ + protected function compileAppend() + { + return 'appendSection(); ?>'; + } + + /** + * Compile the overwrite statements into valid PHP. + * + * @return string + */ + protected function compileOverwrite() + { + return 'stopSection(true); ?>'; + } + + /** + * Compile the stop statements into valid PHP. + * + * @return string + */ + protected function compileStop() + { + return 'stopSection(); ?>'; + } + + /** + * Compile the end-section statements into valid PHP. + * + * @return string + */ + protected function compileEndsection() + { + return 'stopSection(); ?>'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLoops.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLoops.php new file mode 100644 index 0000000..9f64c4f --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesLoops.php @@ -0,0 +1,180 @@ +forElseCounter; + + preg_match('/\( *(.*) +as *(.*)\)$/is', $expression, $matches); + + $iteratee = trim($matches[1]); + + $iteration = trim($matches[2]); + + $initLoop = "\$__currentLoopData = {$iteratee}; \$__env->addLoop(\$__currentLoopData);"; + + $iterateLoop = '$__env->incrementLoopIndices(); $loop = $__env->getLastLoop();'; + + return ""; + } + + /** + * Compile the for-else-empty and empty statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileEmpty($expression) + { + if ($expression) { + return ""; + } + + $empty = '$__empty_'.$this->forElseCounter--; + + return "popLoop(); \$loop = \$__env->getLastLoop(); if ({$empty}): ?>"; + } + + /** + * Compile the end-for-else statements into valid PHP. + * + * @return string + */ + protected function compileEndforelse() + { + return ''; + } + + /** + * Compile the end-empty statements into valid PHP. + * + * @return string + */ + protected function compileEndEmpty() + { + return ''; + } + + /** + * Compile the for statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileFor($expression) + { + return ""; + } + + /** + * Compile the for-each statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileForeach($expression) + { + preg_match('/\( *(.*) +as *(.*)\)$/is', $expression, $matches); + + $iteratee = trim($matches[1]); + + $iteration = trim($matches[2]); + + $initLoop = "\$__currentLoopData = {$iteratee}; \$__env->addLoop(\$__currentLoopData);"; + + $iterateLoop = '$__env->incrementLoopIndices(); $loop = $__env->getLastLoop();'; + + return ""; + } + + /** + * Compile the break statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileBreak($expression) + { + if ($expression) { + preg_match('/\(\s*(-?\d+)\s*\)$/', $expression, $matches); + + return $matches ? '' : ""; + } + + return ''; + } + + /** + * Compile the continue statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileContinue($expression) + { + if ($expression) { + preg_match('/\(\s*(-?\d+)\s*\)$/', $expression, $matches); + + return $matches ? '' : ""; + } + + return ''; + } + + /** + * Compile the end-for statements into valid PHP. + * + * @return string + */ + protected function compileEndfor() + { + return ''; + } + + /** + * Compile the end-for-each statements into valid PHP. + * + * @return string + */ + protected function compileEndforeach() + { + return 'popLoop(); $loop = $__env->getLastLoop(); ?>'; + } + + /** + * Compile the while statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileWhile($expression) + { + return ""; + } + + /** + * Compile the end-while statements into valid PHP. + * + * @return string + */ + protected function compileEndwhile() + { + return ''; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesRawPhp.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesRawPhp.php new file mode 100644 index 0000000..41c7edf --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesRawPhp.php @@ -0,0 +1,32 @@ +"; + } + + return '@php'; + } + + /** + * Compile the unset statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileUnset($expression) + { + return ""; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesStacks.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesStacks.php new file mode 100644 index 0000000..79a380e --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesStacks.php @@ -0,0 +1,59 @@ +yieldPushContent{$expression}; ?>"; + } + + /** + * Compile the push statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compilePush($expression) + { + return "startPush{$expression}; ?>"; + } + + /** + * Compile the end-push statements into valid PHP. + * + * @return string + */ + protected function compileEndpush() + { + return 'stopPush(); ?>'; + } + + /** + * Compile the prepend statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compilePrepend($expression) + { + return "startPrepend{$expression}; ?>"; + } + + /** + * Compile the end-prepend statements into valid PHP. + * + * @return string + */ + protected function compileEndprepend() + { + return 'stopPrepend(); ?>'; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesTranslations.php b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesTranslations.php new file mode 100644 index 0000000..feb7e65 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Compilers/Concerns/CompilesTranslations.php @@ -0,0 +1,44 @@ +startTranslation(); ?>'; + } elseif ($expression[1] === '[') { + return "startTranslation{$expression}; ?>"; + } + + return "getFromJson{$expression}; ?>"; + } + + /** + * Compile the end-lang statements into valid PHP. + * + * @return string + */ + protected function compileEndlang() + { + return 'renderTranslation(); ?>'; + } + + /** + * Compile the choice statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileChoice($expression) + { + return "choice{$expression}; ?>"; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesComponents.php b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesComponents.php new file mode 100644 index 0000000..703b9c5 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesComponents.php @@ -0,0 +1,128 @@ +componentStack[] = $name; + + $this->componentData[$this->currentComponent()] = $data; + + $this->slots[$this->currentComponent()] = []; + } + } + + /** + * Render the current component. + * + * @return string + */ + public function renderComponent() + { + $name = array_pop($this->componentStack); + + return $this->make($name, $this->componentData($name))->render(); + } + + /** + * Get the data for the given component. + * + * @param string $name + * @return array + */ + protected function componentData($name) + { + return array_merge( + $this->componentData[count($this->componentStack)], + ['slot' => new HtmlString(trim(ob_get_clean()))], + $this->slots[count($this->componentStack)] + ); + } + + /** + * Start the slot rendering process. + * + * @param string $name + * @param string|null $content + * @return void + */ + public function slot($name, $content = null) + { + if (func_num_args() === 2) { + $this->slots[$this->currentComponent()][$name] = $content; + } else { + if (ob_start()) { + $this->slots[$this->currentComponent()][$name] = ''; + + $this->slotStack[$this->currentComponent()][] = $name; + } + } + } + + /** + * Save the slot content for rendering. + * + * @return void + */ + public function endSlot() + { + last($this->componentStack); + + $currentSlot = array_pop( + $this->slotStack[$this->currentComponent()] + ); + + $this->slots[$this->currentComponent()] + [$currentSlot] = new HtmlString(trim(ob_get_clean())); + } + + /** + * Get the index for the current component. + * + * @return int + */ + protected function currentComponent() + { + return count($this->componentStack) - 1; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesEvents.php b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesEvents.php new file mode 100644 index 0000000..7e844b2 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesEvents.php @@ -0,0 +1,192 @@ +addViewEvent($view, $callback, 'creating: '); + } + + return $creators; + } + + /** + * Register multiple view composers via an array. + * + * @param array $composers + * @return array + */ + public function composers(array $composers) + { + $registered = []; + + foreach ($composers as $callback => $views) { + $registered = array_merge($registered, $this->composer($views, $callback)); + } + + return $registered; + } + + /** + * Register a view composer event. + * + * @param array|string $views + * @param \Closure|string $callback + * @return array + */ + public function composer($views, $callback) + { + $composers = []; + + foreach ((array) $views as $view) { + $composers[] = $this->addViewEvent($view, $callback, 'composing: '); + } + + return $composers; + } + + /** + * Add an event for a given view. + * + * @param string $view + * @param \Closure|string $callback + * @param string $prefix + * @return \Closure|null + */ + protected function addViewEvent($view, $callback, $prefix = 'composing: ') + { + $view = $this->normalizeName($view); + + if ($callback instanceof Closure) { + $this->addEventListener($prefix.$view, $callback); + + return $callback; + } elseif (is_string($callback)) { + return $this->addClassEvent($view, $callback, $prefix); + } + } + + /** + * Register a class based view composer. + * + * @param string $view + * @param string $class + * @param string $prefix + * @return \Closure + */ + protected function addClassEvent($view, $class, $prefix) + { + $name = $prefix.$view; + + // When registering a class based view "composer", we will simply resolve the + // classes from the application IoC container then call the compose method + // on the instance. This allows for convenient, testable view composers. + $callback = $this->buildClassEventCallback( + $class, $prefix + ); + + $this->addEventListener($name, $callback); + + return $callback; + } + + /** + * Build a class based container callback Closure. + * + * @param string $class + * @param string $prefix + * @return \Closure + */ + protected function buildClassEventCallback($class, $prefix) + { + [$class, $method] = $this->parseClassEvent($class, $prefix); + + // Once we have the class and method name, we can build the Closure to resolve + // the instance out of the IoC container and call the method on it with the + // given arguments that are passed to the Closure as the composer's data. + return function () use ($class, $method) { + return call_user_func_array( + [$this->container->make($class), $method], func_get_args() + ); + }; + } + + /** + * Parse a class based composer name. + * + * @param string $class + * @param string $prefix + * @return array + */ + protected function parseClassEvent($class, $prefix) + { + return Str::parseCallback($class, $this->classEventMethodForPrefix($prefix)); + } + + /** + * Determine the class event method based on the given prefix. + * + * @param string $prefix + * @return string + */ + protected function classEventMethodForPrefix($prefix) + { + return Str::contains($prefix, 'composing') ? 'compose' : 'create'; + } + + /** + * Add a listener to the event dispatcher. + * + * @param string $name + * @param \Closure $callback + * @return void + */ + protected function addEventListener($name, $callback) + { + if (Str::contains($name, '*')) { + $callback = function ($name, array $data) use ($callback) { + return $callback($data[0]); + }; + } + + $this->events->listen($name, $callback); + } + + /** + * Call the composer for a given view. + * + * @param \Illuminate\Contracts\View\View $view + * @return void + */ + public function callComposer(ViewContract $view) + { + $this->events->dispatch('composing: '.$view->name(), [$view]); + } + + /** + * Call the creator for a given view. + * + * @param \Illuminate\Contracts\View\View $view + * @return void + */ + public function callCreator(ViewContract $view) + { + $this->events->dispatch('creating: '.$view->name(), [$view]); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLayouts.php b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLayouts.php new file mode 100644 index 0000000..c1ef871 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLayouts.php @@ -0,0 +1,220 @@ +sectionStack[] = $section; + } + } else { + $this->extendSection($section, $content instanceof View ? $content : e($content)); + } + } + + /** + * Inject inline content into a section. + * + * @param string $section + * @param string $content + * @return void + */ + public function inject($section, $content) + { + $this->startSection($section, $content); + } + + /** + * Stop injecting content into a section and return its contents. + * + * @return string + */ + public function yieldSection() + { + if (empty($this->sectionStack)) { + return ''; + } + + return $this->yieldContent($this->stopSection()); + } + + /** + * Stop injecting content into a section. + * + * @param bool $overwrite + * @return string + * + * @throws \InvalidArgumentException + */ + public function stopSection($overwrite = false) + { + if (empty($this->sectionStack)) { + throw new InvalidArgumentException('Cannot end a section without first starting one.'); + } + + $last = array_pop($this->sectionStack); + + if ($overwrite) { + $this->sections[$last] = ob_get_clean(); + } else { + $this->extendSection($last, ob_get_clean()); + } + + return $last; + } + + /** + * Stop injecting content into a section and append it. + * + * @return string + * + * @throws \InvalidArgumentException + */ + public function appendSection() + { + if (empty($this->sectionStack)) { + throw new InvalidArgumentException('Cannot end a section without first starting one.'); + } + + $last = array_pop($this->sectionStack); + + if (isset($this->sections[$last])) { + $this->sections[$last] .= ob_get_clean(); + } else { + $this->sections[$last] = ob_get_clean(); + } + + return $last; + } + + /** + * Append content to a given section. + * + * @param string $section + * @param string $content + * @return void + */ + protected function extendSection($section, $content) + { + if (isset($this->sections[$section])) { + $content = str_replace(static::parentPlaceholder($section), $content, $this->sections[$section]); + } + + $this->sections[$section] = $content; + } + + /** + * Get the string contents of a section. + * + * @param string $section + * @param string $default + * @return string + */ + public function yieldContent($section, $default = '') + { + $sectionContent = $default instanceof View ? $default : e($default); + + if (isset($this->sections[$section])) { + $sectionContent = $this->sections[$section]; + } + + $sectionContent = str_replace('@@parent', '--parent--holder--', $sectionContent); + + return str_replace( + '--parent--holder--', '@parent', str_replace(static::parentPlaceholder($section), '', $sectionContent) + ); + } + + /** + * Get the parent placeholder for the current request. + * + * @param string $section + * @return string + */ + public static function parentPlaceholder($section = '') + { + if (! isset(static::$parentPlaceholder[$section])) { + static::$parentPlaceholder[$section] = '##parent-placeholder-'.sha1($section).'##'; + } + + return static::$parentPlaceholder[$section]; + } + + /** + * Check if section exists. + * + * @param string $name + * @return bool + */ + public function hasSection($name) + { + return array_key_exists($name, $this->sections); + } + + /** + * Get the contents of a section. + * + * @param string $name + * @param string $default + * @return mixed + */ + public function getSection($name, $default = null) + { + return $this->getSections()[$name] ?? $default; + } + + /** + * Get the entire array of sections. + * + * @return array + */ + public function getSections() + { + return $this->sections; + } + + /** + * Flush all of the sections. + * + * @return void + */ + public function flushSections() + { + $this->sections = []; + $this->sectionStack = []; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLoops.php b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLoops.php new file mode 100644 index 0000000..5f50b24 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesLoops.php @@ -0,0 +1,90 @@ +loopsStack); + + $this->loopsStack[] = [ + 'iteration' => 0, + 'index' => 0, + 'remaining' => $length ?? null, + 'count' => $length, + 'first' => true, + 'last' => isset($length) ? $length == 1 : null, + 'depth' => count($this->loopsStack) + 1, + 'parent' => $parent ? (object) $parent : null, + ]; + } + + /** + * Increment the top loop's indices. + * + * @return void + */ + public function incrementLoopIndices() + { + $loop = $this->loopsStack[$index = count($this->loopsStack) - 1]; + + $this->loopsStack[$index] = array_merge($this->loopsStack[$index], [ + 'iteration' => $loop['iteration'] + 1, + 'index' => $loop['iteration'], + 'first' => $loop['iteration'] == 0, + 'remaining' => isset($loop['count']) ? $loop['remaining'] - 1 : null, + 'last' => isset($loop['count']) ? $loop['iteration'] == $loop['count'] - 1 : null, + ]); + } + + /** + * Pop a loop from the top of the loop stack. + * + * @return void + */ + public function popLoop() + { + array_pop($this->loopsStack); + } + + /** + * Get an instance of the last loop in the stack. + * + * @return \stdClass|null + */ + public function getLastLoop() + { + if ($last = Arr::last($this->loopsStack)) { + return (object) $last; + } + } + + /** + * Get the entire loop stack. + * + * @return array + */ + public function getLoopStack() + { + return $this->loopsStack; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesStacks.php b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesStacks.php new file mode 100644 index 0000000..4e063af --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesStacks.php @@ -0,0 +1,179 @@ +pushStack[] = $section; + } + } else { + $this->extendPush($section, $content); + } + } + + /** + * Stop injecting content into a push section. + * + * @return string + * + * @throws \InvalidArgumentException + */ + public function stopPush() + { + if (empty($this->pushStack)) { + throw new InvalidArgumentException('Cannot end a push stack without first starting one.'); + } + + return tap(array_pop($this->pushStack), function ($last) { + $this->extendPush($last, ob_get_clean()); + }); + } + + /** + * Append content to a given push section. + * + * @param string $section + * @param string $content + * @return void + */ + protected function extendPush($section, $content) + { + if (! isset($this->pushes[$section])) { + $this->pushes[$section] = []; + } + + if (! isset($this->pushes[$section][$this->renderCount])) { + $this->pushes[$section][$this->renderCount] = $content; + } else { + $this->pushes[$section][$this->renderCount] .= $content; + } + } + + /** + * Start prepending content into a push section. + * + * @param string $section + * @param string $content + * @return void + */ + public function startPrepend($section, $content = '') + { + if ($content === '') { + if (ob_start()) { + $this->pushStack[] = $section; + } + } else { + $this->extendPrepend($section, $content); + } + } + + /** + * Stop prepending content into a push section. + * + * @return string + * + * @throws \InvalidArgumentException + */ + public function stopPrepend() + { + if (empty($this->pushStack)) { + throw new InvalidArgumentException('Cannot end a prepend operation without first starting one.'); + } + + return tap(array_pop($this->pushStack), function ($last) { + $this->extendPrepend($last, ob_get_clean()); + }); + } + + /** + * Prepend content to a given stack. + * + * @param string $section + * @param string $content + * @return void + */ + protected function extendPrepend($section, $content) + { + if (! isset($this->prepends[$section])) { + $this->prepends[$section] = []; + } + + if (! isset($this->prepends[$section][$this->renderCount])) { + $this->prepends[$section][$this->renderCount] = $content; + } else { + $this->prepends[$section][$this->renderCount] = $content.$this->prepends[$section][$this->renderCount]; + } + } + + /** + * Get the string contents of a push section. + * + * @param string $section + * @param string $default + * @return string + */ + public function yieldPushContent($section, $default = '') + { + if (! isset($this->pushes[$section]) && ! isset($this->prepends[$section])) { + return $default; + } + + $output = ''; + + if (isset($this->prepends[$section])) { + $output .= implode(array_reverse($this->prepends[$section])); + } + + if (isset($this->pushes[$section])) { + $output .= implode($this->pushes[$section]); + } + + return $output; + } + + /** + * Flush all of the stacks. + * + * @return void + */ + public function flushStacks() + { + $this->pushes = []; + $this->prepends = []; + $this->pushStack = []; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesTranslations.php b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesTranslations.php new file mode 100644 index 0000000..841c3fe --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Concerns/ManagesTranslations.php @@ -0,0 +1,38 @@ +translationReplacements = $replacements; + } + + /** + * Render the current translation. + * + * @return string + */ + public function renderTranslation() + { + return $this->container->make('translator')->getFromJson( + trim(ob_get_clean()), $this->translationReplacements + ); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php b/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php new file mode 100755 index 0000000..2f7f84b --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php @@ -0,0 +1,102 @@ +compiler = $compiler; + } + + /** + * Get the evaluated contents of the view. + * + * @param string $path + * @param array $data + * @return string + */ + public function get($path, array $data = []) + { + $this->lastCompiled[] = $path; + + // If this given view has expired, which means it has simply been edited since + // it was last compiled, we will re-compile the views so we can evaluate a + // fresh copy of the view. We'll pass the compiler the path of the view. + if ($this->compiler->isExpired($path)) { + $this->compiler->compile($path); + } + + $compiled = $this->compiler->getCompiledPath($path); + + // Once we have the path to the compiled file, we will evaluate the paths with + // typical PHP just like any other templates. We also keep a stack of views + // which have been rendered for right exception messages to be generated. + $results = $this->evaluatePath($compiled, $data); + + array_pop($this->lastCompiled); + + return $results; + } + + /** + * Handle a view exception. + * + * @param \Exception $e + * @param int $obLevel + * @return void + * + * @throws \Exception + */ + protected function handleViewException(Exception $e, $obLevel) + { + $e = new ErrorException($this->getMessage($e), 0, 1, $e->getFile(), $e->getLine(), $e); + + parent::handleViewException($e, $obLevel); + } + + /** + * Get the exception message for an exception. + * + * @param \Exception $e + * @return string + */ + protected function getMessage(Exception $e) + { + return $e->getMessage().' (View: '.realpath(last($this->lastCompiled)).')'; + } + + /** + * Get the compiler implementation. + * + * @return \Illuminate\View\Compilers\CompilerInterface + */ + public function getCompiler() + { + return $this->compiler; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Engines/Engine.php b/vendor/laravel/framework/src/Illuminate/View/Engines/Engine.php new file mode 100755 index 0000000..bf5c748 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Engines/Engine.php @@ -0,0 +1,23 @@ +lastRendered; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Engines/EngineResolver.php b/vendor/laravel/framework/src/Illuminate/View/Engines/EngineResolver.php new file mode 100755 index 0000000..98d14ed --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Engines/EngineResolver.php @@ -0,0 +1,60 @@ +resolved[$engine]); + + $this->resolvers[$engine] = $resolver; + } + + /** + * Resolve an engine instance by name. + * + * @param string $engine + * @return \Illuminate\Contracts\View\Engine + * + * @throws \InvalidArgumentException + */ + public function resolve($engine) + { + if (isset($this->resolved[$engine])) { + return $this->resolved[$engine]; + } + + if (isset($this->resolvers[$engine])) { + return $this->resolved[$engine] = call_user_func($this->resolvers[$engine]); + } + + throw new InvalidArgumentException("Engine [{$engine}] not found."); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Engines/FileEngine.php b/vendor/laravel/framework/src/Illuminate/View/Engines/FileEngine.php new file mode 100644 index 0000000..360b543 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Engines/FileEngine.php @@ -0,0 +1,20 @@ +evaluatePath($path, $data); + } + + /** + * Get the evaluated contents of the view at the given path. + * + * @param string $__path + * @param array $__data + * @return string + */ + protected function evaluatePath($__path, $__data) + { + $obLevel = ob_get_level(); + + ob_start(); + + extract($__data, EXTR_SKIP); + + // We'll evaluate the contents of the view inside a try/catch block so we can + // flush out any stray output that might get out before an error occurs or + // an exception is thrown. This prevents any partial views from leaking. + try { + include $__path; + } catch (Exception $e) { + $this->handleViewException($e, $obLevel); + } catch (Throwable $e) { + $this->handleViewException(new FatalThrowableError($e), $obLevel); + } + + return ltrim(ob_get_clean()); + } + + /** + * Handle a view exception. + * + * @param \Exception $e + * @param int $obLevel + * @return void + * + * @throws \Exception + */ + protected function handleViewException(Exception $e, $obLevel) + { + while (ob_get_level() > $obLevel) { + ob_end_clean(); + } + + throw $e; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Factory.php b/vendor/laravel/framework/src/Illuminate/View/Factory.php new file mode 100755 index 0000000..2014860 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Factory.php @@ -0,0 +1,567 @@ + 'blade', + 'php' => 'php', + 'css' => 'file', + ]; + + /** + * The view composer events. + * + * @var array + */ + protected $composers = []; + + /** + * The number of active rendering operations. + * + * @var int + */ + protected $renderCount = 0; + + /** + * Create a new view factory instance. + * + * @param \Illuminate\View\Engines\EngineResolver $engines + * @param \Illuminate\View\ViewFinderInterface $finder + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function __construct(EngineResolver $engines, ViewFinderInterface $finder, Dispatcher $events) + { + $this->finder = $finder; + $this->events = $events; + $this->engines = $engines; + + $this->share('__env', $this); + } + + /** + * Get the evaluated view contents for the given view. + * + * @param string $path + * @param \Illuminate\Contracts\Support\Arrayable|array $data + * @param array $mergeData + * @return \Illuminate\Contracts\View\View + */ + public function file($path, $data = [], $mergeData = []) + { + $data = array_merge($mergeData, $this->parseData($data)); + + return tap($this->viewInstance($path, $path, $data), function ($view) { + $this->callCreator($view); + }); + } + + /** + * Get the evaluated view contents for the given view. + * + * @param string $view + * @param \Illuminate\Contracts\Support\Arrayable|array $data + * @param array $mergeData + * @return \Illuminate\Contracts\View\View + */ + public function make($view, $data = [], $mergeData = []) + { + $path = $this->finder->find( + $view = $this->normalizeName($view) + ); + + // Next, we will create the view instance and call the view creator for the view + // which can set any data, etc. Then we will return the view instance back to + // the caller for rendering or performing other view manipulations on this. + $data = array_merge($mergeData, $this->parseData($data)); + + return tap($this->viewInstance($view, $path, $data), function ($view) { + $this->callCreator($view); + }); + } + + /** + * Get the first view that actually exists from the given list. + * + * @param array $views + * @param \Illuminate\Contracts\Support\Arrayable|array $data + * @param array $mergeData + * @return \Illuminate\Contracts\View\View + * + * @throws \InvalidArgumentException + */ + public function first(array $views, $data = [], $mergeData = []) + { + $view = Arr::first($views, function ($view) { + return $this->exists($view); + }); + + if (! $view) { + throw new InvalidArgumentException('None of the views in the given array exist.'); + } + + return $this->make($view, $data, $mergeData); + } + + /** + * Get the rendered content of the view based on a given condition. + * + * @param bool $condition + * @param string $view + * @param \Illuminate\Contracts\Support\Arrayable|array $data + * @param array $mergeData + * @return string + */ + public function renderWhen($condition, $view, $data = [], $mergeData = []) + { + if (! $condition) { + return ''; + } + + return $this->make($view, $this->parseData($data), $mergeData)->render(); + } + + /** + * Get the rendered contents of a partial from a loop. + * + * @param string $view + * @param array $data + * @param string $iterator + * @param string $empty + * @return string + */ + public function renderEach($view, $data, $iterator, $empty = 'raw|') + { + $result = ''; + + // If is actually data in the array, we will loop through the data and append + // an instance of the partial view to the final result HTML passing in the + // iterated value of this data array, allowing the views to access them. + if (count($data) > 0) { + foreach ($data as $key => $value) { + $result .= $this->make( + $view, ['key' => $key, $iterator => $value] + )->render(); + } + } + + // If there is no data in the array, we will render the contents of the empty + // view. Alternatively, the "empty view" could be a raw string that begins + // with "raw|" for convenience and to let this know that it is a string. + else { + $result = Str::startsWith($empty, 'raw|') + ? substr($empty, 4) + : $this->make($empty)->render(); + } + + return $result; + } + + /** + * Normalize a view name. + * + * @param string $name + * @return string + */ + protected function normalizeName($name) + { + return ViewName::normalize($name); + } + + /** + * Parse the given data into a raw array. + * + * @param mixed $data + * @return array + */ + protected function parseData($data) + { + return $data instanceof Arrayable ? $data->toArray() : $data; + } + + /** + * Create a new view instance from the given arguments. + * + * @param string $view + * @param string $path + * @param \Illuminate\Contracts\Support\Arrayable|array $data + * @return \Illuminate\Contracts\View\View + */ + protected function viewInstance($view, $path, $data) + { + return new View($this, $this->getEngineFromPath($path), $view, $path, $data); + } + + /** + * Determine if a given view exists. + * + * @param string $view + * @return bool + */ + public function exists($view) + { + try { + $this->finder->find($view); + } catch (InvalidArgumentException $e) { + return false; + } + + return true; + } + + /** + * Get the appropriate view engine for the given path. + * + * @param string $path + * @return \Illuminate\Contracts\View\Engine + * + * @throws \InvalidArgumentException + */ + public function getEngineFromPath($path) + { + if (! $extension = $this->getExtension($path)) { + throw new InvalidArgumentException("Unrecognized extension in file: {$path}"); + } + + $engine = $this->extensions[$extension]; + + return $this->engines->resolve($engine); + } + + /** + * Get the extension used by the view file. + * + * @param string $path + * @return string + */ + protected function getExtension($path) + { + $extensions = array_keys($this->extensions); + + return Arr::first($extensions, function ($value) use ($path) { + return Str::endsWith($path, '.'.$value); + }); + } + + /** + * Add a piece of shared data to the environment. + * + * @param array|string $key + * @param mixed $value + * @return mixed + */ + public function share($key, $value = null) + { + $keys = is_array($key) ? $key : [$key => $value]; + + foreach ($keys as $key => $value) { + $this->shared[$key] = $value; + } + + return $value; + } + + /** + * Increment the rendering counter. + * + * @return void + */ + public function incrementRender() + { + $this->renderCount++; + } + + /** + * Decrement the rendering counter. + * + * @return void + */ + public function decrementRender() + { + $this->renderCount--; + } + + /** + * Check if there are no active render operations. + * + * @return bool + */ + public function doneRendering() + { + return $this->renderCount == 0; + } + + /** + * Add a location to the array of view locations. + * + * @param string $location + * @return void + */ + public function addLocation($location) + { + $this->finder->addLocation($location); + } + + /** + * Add a new namespace to the loader. + * + * @param string $namespace + * @param string|array $hints + * @return $this + */ + public function addNamespace($namespace, $hints) + { + $this->finder->addNamespace($namespace, $hints); + + return $this; + } + + /** + * Prepend a new namespace to the loader. + * + * @param string $namespace + * @param string|array $hints + * @return $this + */ + public function prependNamespace($namespace, $hints) + { + $this->finder->prependNamespace($namespace, $hints); + + return $this; + } + + /** + * Replace the namespace hints for the given namespace. + * + * @param string $namespace + * @param string|array $hints + * @return $this + */ + public function replaceNamespace($namespace, $hints) + { + $this->finder->replaceNamespace($namespace, $hints); + + return $this; + } + + /** + * Register a valid view extension and its engine. + * + * @param string $extension + * @param string $engine + * @param \Closure $resolver + * @return void + */ + public function addExtension($extension, $engine, $resolver = null) + { + $this->finder->addExtension($extension); + + if (isset($resolver)) { + $this->engines->register($engine, $resolver); + } + + unset($this->extensions[$extension]); + + $this->extensions = array_merge([$extension => $engine], $this->extensions); + } + + /** + * Flush all of the factory state like sections and stacks. + * + * @return void + */ + public function flushState() + { + $this->renderCount = 0; + + $this->flushSections(); + $this->flushStacks(); + } + + /** + * Flush all of the section contents if done rendering. + * + * @return void + */ + public function flushStateIfDoneRendering() + { + if ($this->doneRendering()) { + $this->flushState(); + } + } + + /** + * Get the extension to engine bindings. + * + * @return array + */ + public function getExtensions() + { + return $this->extensions; + } + + /** + * Get the engine resolver instance. + * + * @return \Illuminate\View\Engines\EngineResolver + */ + public function getEngineResolver() + { + return $this->engines; + } + + /** + * Get the view finder instance. + * + * @return \Illuminate\View\ViewFinderInterface + */ + public function getFinder() + { + return $this->finder; + } + + /** + * Set the view finder instance. + * + * @param \Illuminate\View\ViewFinderInterface $finder + * @return void + */ + public function setFinder(ViewFinderInterface $finder) + { + $this->finder = $finder; + } + + /** + * Flush the cache of views located by the finder. + * + * @return void + */ + public function flushFinderCache() + { + $this->getFinder()->flush(); + } + + /** + * Get the event dispatcher instance. + * + * @return \Illuminate\Contracts\Events\Dispatcher + */ + public function getDispatcher() + { + return $this->events; + } + + /** + * Set the event dispatcher instance. + * + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return void + */ + public function setDispatcher(Dispatcher $events) + { + $this->events = $events; + } + + /** + * Get the IoC container instance. + * + * @return \Illuminate\Contracts\Container\Container + */ + public function getContainer() + { + return $this->container; + } + + /** + * Set the IoC container instance. + * + * @param \Illuminate\Contracts\Container\Container $container + * @return void + */ + public function setContainer(Container $container) + { + $this->container = $container; + } + + /** + * Get an item from the shared data. + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function shared($key, $default = null) + { + return Arr::get($this->shared, $key, $default); + } + + /** + * Get all of the shared data for the environment. + * + * @return array + */ + public function getShared() + { + return $this->shared; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php b/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php new file mode 100755 index 0000000..4a380f9 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php @@ -0,0 +1,298 @@ +files = $files; + $this->paths = $paths; + + if (isset($extensions)) { + $this->extensions = $extensions; + } + } + + /** + * Get the fully qualified location of the view. + * + * @param string $name + * @return string + */ + public function find($name) + { + if (isset($this->views[$name])) { + return $this->views[$name]; + } + + if ($this->hasHintInformation($name = trim($name))) { + return $this->views[$name] = $this->findNamespacedView($name); + } + + return $this->views[$name] = $this->findInPaths($name, $this->paths); + } + + /** + * Get the path to a template with a named path. + * + * @param string $name + * @return string + */ + protected function findNamespacedView($name) + { + [$namespace, $view] = $this->parseNamespaceSegments($name); + + return $this->findInPaths($view, $this->hints[$namespace]); + } + + /** + * Get the segments of a template with a named path. + * + * @param string $name + * @return array + * + * @throws \InvalidArgumentException + */ + protected function parseNamespaceSegments($name) + { + $segments = explode(static::HINT_PATH_DELIMITER, $name); + + if (count($segments) !== 2) { + throw new InvalidArgumentException("View [{$name}] has an invalid name."); + } + + if (! isset($this->hints[$segments[0]])) { + throw new InvalidArgumentException("No hint path defined for [{$segments[0]}]."); + } + + return $segments; + } + + /** + * Find the given view in the list of paths. + * + * @param string $name + * @param array $paths + * @return string + * + * @throws \InvalidArgumentException + */ + protected function findInPaths($name, $paths) + { + foreach ((array) $paths as $path) { + foreach ($this->getPossibleViewFiles($name) as $file) { + if ($this->files->exists($viewPath = $path.'/'.$file)) { + return $viewPath; + } + } + } + + throw new InvalidArgumentException("View [{$name}] not found."); + } + + /** + * Get an array of possible view files. + * + * @param string $name + * @return array + */ + protected function getPossibleViewFiles($name) + { + return array_map(function ($extension) use ($name) { + return str_replace('.', '/', $name).'.'.$extension; + }, $this->extensions); + } + + /** + * Add a location to the finder. + * + * @param string $location + * @return void + */ + public function addLocation($location) + { + $this->paths[] = $location; + } + + /** + * Prepend a location to the finder. + * + * @param string $location + * @return void + */ + public function prependLocation($location) + { + array_unshift($this->paths, $location); + } + + /** + * Add a namespace hint to the finder. + * + * @param string $namespace + * @param string|array $hints + * @return void + */ + public function addNamespace($namespace, $hints) + { + $hints = (array) $hints; + + if (isset($this->hints[$namespace])) { + $hints = array_merge($this->hints[$namespace], $hints); + } + + $this->hints[$namespace] = $hints; + } + + /** + * Prepend a namespace hint to the finder. + * + * @param string $namespace + * @param string|array $hints + * @return void + */ + public function prependNamespace($namespace, $hints) + { + $hints = (array) $hints; + + if (isset($this->hints[$namespace])) { + $hints = array_merge($hints, $this->hints[$namespace]); + } + + $this->hints[$namespace] = $hints; + } + + /** + * Replace the namespace hints for the given namespace. + * + * @param string $namespace + * @param string|array $hints + * @return void + */ + public function replaceNamespace($namespace, $hints) + { + $this->hints[$namespace] = (array) $hints; + } + + /** + * Register an extension with the view finder. + * + * @param string $extension + * @return void + */ + public function addExtension($extension) + { + if (($index = array_search($extension, $this->extensions)) !== false) { + unset($this->extensions[$index]); + } + + array_unshift($this->extensions, $extension); + } + + /** + * Returns whether or not the view name has any hint information. + * + * @param string $name + * @return bool + */ + public function hasHintInformation($name) + { + return strpos($name, static::HINT_PATH_DELIMITER) > 0; + } + + /** + * Flush the cache of located views. + * + * @return void + */ + public function flush() + { + $this->views = []; + } + + /** + * Get the filesystem instance. + * + * @return \Illuminate\Filesystem\Filesystem + */ + public function getFilesystem() + { + return $this->files; + } + + /** + * Get the active view paths. + * + * @return array + */ + public function getPaths() + { + return $this->paths; + } + + /** + * Get the namespace to file path hints. + * + * @return array + */ + public function getHints() + { + return $this->hints; + } + + /** + * Get registered extensions. + * + * @return array + */ + public function getExtensions() + { + return $this->extensions; + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php b/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php new file mode 100644 index 0000000..618b7dd --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php @@ -0,0 +1,51 @@ +view = $view; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + // If the current session has an "errors" variable bound to it, we will share + // its value with all view instances so the views can easily access errors + // without having to bind. An empty bag is set when there aren't errors. + $this->view->share( + 'errors', $request->session()->get('errors') ?: new ViewErrorBag + ); + + // Putting the errors in the view for every view allows the developer to just + // assume that some errors are always available, which is convenient since + // they don't have to continually run checks for the presence of errors. + + return $next($request); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/View.php b/vendor/laravel/framework/src/Illuminate/View/View.php new file mode 100755 index 0000000..b888860 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/View.php @@ -0,0 +1,429 @@ +view = $view; + $this->path = $path; + $this->engine = $engine; + $this->factory = $factory; + + $this->data = $data instanceof Arrayable ? $data->toArray() : (array) $data; + } + + /** + * Get the string contents of the view. + * + * @param callable|null $callback + * @return string + * + * @throws \Throwable + */ + public function render(callable $callback = null) + { + try { + $contents = $this->renderContents(); + + $response = isset($callback) ? call_user_func($callback, $this, $contents) : null; + + // Once we have the contents of the view, we will flush the sections if we are + // done rendering all views so that there is nothing left hanging over when + // another view gets rendered in the future by the application developer. + $this->factory->flushStateIfDoneRendering(); + + return ! is_null($response) ? $response : $contents; + } catch (Exception $e) { + $this->factory->flushState(); + + throw $e; + } catch (Throwable $e) { + $this->factory->flushState(); + + throw $e; + } + } + + /** + * Get the contents of the view instance. + * + * @return string + */ + protected function renderContents() + { + // We will keep track of the amount of views being rendered so we can flush + // the section after the complete rendering operation is done. This will + // clear out the sections for any separate views that may be rendered. + $this->factory->incrementRender(); + + $this->factory->callComposer($this); + + $contents = $this->getContents(); + + // Once we've finished rendering the view, we'll decrement the render count + // so that each sections get flushed out next time a view is created and + // no old sections are staying around in the memory of an environment. + $this->factory->decrementRender(); + + return $contents; + } + + /** + * Get the evaluated contents of the view. + * + * @return string + */ + protected function getContents() + { + return $this->engine->get($this->path, $this->gatherData()); + } + + /** + * Get the data bound to the view instance. + * + * @return array + */ + protected function gatherData() + { + $data = array_merge($this->factory->getShared(), $this->data); + + foreach ($data as $key => $value) { + if ($value instanceof Renderable) { + $data[$key] = $value->render(); + } + } + + return $data; + } + + /** + * Get the sections of the rendered view. + * + * @return string + * + * @throws \Throwable + */ + public function renderSections() + { + return $this->render(function () { + return $this->factory->getSections(); + }); + } + + /** + * Add a piece of data to the view. + * + * @param string|array $key + * @param mixed $value + * @return $this + */ + public function with($key, $value = null) + { + if (is_array($key)) { + $this->data = array_merge($this->data, $key); + } else { + $this->data[$key] = $value; + } + + return $this; + } + + /** + * Add a view instance to the view data. + * + * @param string $key + * @param string $view + * @param array $data + * @return $this + */ + public function nest($key, $view, array $data = []) + { + return $this->with($key, $this->factory->make($view, $data)); + } + + /** + * Add validation errors to the view. + * + * @param \Illuminate\Contracts\Support\MessageProvider|array $provider + * @return $this + */ + public function withErrors($provider) + { + $this->with('errors', $this->formatErrors($provider)); + + return $this; + } + + /** + * Format the given message provider into a MessageBag. + * + * @param \Illuminate\Contracts\Support\MessageProvider|array $provider + * @return \Illuminate\Support\MessageBag + */ + protected function formatErrors($provider) + { + return $provider instanceof MessageProvider + ? $provider->getMessageBag() : new MessageBag((array) $provider); + } + + /** + * Get the name of the view. + * + * @return string + */ + public function name() + { + return $this->getName(); + } + + /** + * Get the name of the view. + * + * @return string + */ + public function getName() + { + return $this->view; + } + + /** + * Get the array of view data. + * + * @return array + */ + public function getData() + { + return $this->data; + } + + /** + * Get the path to the view file. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set the path to the view. + * + * @param string $path + * @return void + */ + public function setPath($path) + { + $this->path = $path; + } + + /** + * Get the view factory instance. + * + * @return \Illuminate\View\Factory + */ + public function getFactory() + { + return $this->factory; + } + + /** + * Get the view's rendering engine. + * + * @return \Illuminate\Contracts\View\Engine + */ + public function getEngine() + { + return $this->engine; + } + + /** + * Determine if a piece of data is bound. + * + * @param string $key + * @return bool + */ + public function offsetExists($key) + { + return array_key_exists($key, $this->data); + } + + /** + * Get a piece of bound data to the view. + * + * @param string $key + * @return mixed + */ + public function offsetGet($key) + { + return $this->data[$key]; + } + + /** + * Set a piece of data on the view. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + $this->with($key, $value); + } + + /** + * Unset a piece of data from the view. + * + * @param string $key + * @return void + */ + public function offsetUnset($key) + { + unset($this->data[$key]); + } + + /** + * Get a piece of data from the view. + * + * @param string $key + * @return mixed + */ + public function &__get($key) + { + return $this->data[$key]; + } + + /** + * Set a piece of data on the view. + * + * @param string $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + $this->with($key, $value); + } + + /** + * Check if a piece of data is bound to the view. + * + * @param string $key + * @return bool + */ + public function __isset($key) + { + return isset($this->data[$key]); + } + + /** + * Remove a piece of bound data from the view. + * + * @param string $key + * @return void + */ + public function __unset($key) + { + unset($this->data[$key]); + } + + /** + * Dynamically bind parameters to the view. + * + * @param string $method + * @param array $parameters + * @return \Illuminate\View\View + * + * @throws \BadMethodCallException + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->macroCall($method, $parameters); + } + + if (! Str::startsWith($method, 'with')) { + throw new BadMethodCallException(sprintf( + 'Method %s::%s does not exist.', static::class, $method + )); + } + + return $this->with(Str::camel(substr($method, 4)), $parameters[0]); + } + + /** + * Get the string contents of the view. + * + * @return string + * + * @throws \Throwable + */ + public function __toString() + { + return $this->render(); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/ViewFinderInterface.php b/vendor/laravel/framework/src/Illuminate/View/ViewFinderInterface.php new file mode 100755 index 0000000..7b8a849 --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/ViewFinderInterface.php @@ -0,0 +1,71 @@ +registerFactory(); + + $this->registerViewFinder(); + + $this->registerEngineResolver(); + } + + /** + * Register the view environment. + * + * @return void + */ + public function registerFactory() + { + $this->app->singleton('view', function ($app) { + // Next we need to grab the engine resolver instance that will be used by the + // environment. The resolver will be used by an environment to get each of + // the various engine implementations such as plain PHP or Blade engine. + $resolver = $app['view.engine.resolver']; + + $finder = $app['view.finder']; + + $factory = $this->createFactory($resolver, $finder, $app['events']); + + // We will also set the container instance on this view environment since the + // view composers may be classes registered in the container, which allows + // for great testable, flexible composers for the application developer. + $factory->setContainer($app); + + $factory->share('app', $app); + + return $factory; + }); + } + + /** + * Create a new Factory Instance. + * + * @param \Illuminate\View\Engines\EngineResolver $resolver + * @param \Illuminate\View\ViewFinderInterface $finder + * @param \Illuminate\Contracts\Events\Dispatcher $events + * @return \Illuminate\View\Factory + */ + protected function createFactory($resolver, $finder, $events) + { + return new Factory($resolver, $finder, $events); + } + + /** + * Register the view finder implementation. + * + * @return void + */ + public function registerViewFinder() + { + $this->app->bind('view.finder', function ($app) { + return new FileViewFinder($app['files'], $app['config']['view.paths']); + }); + } + + /** + * Register the engine resolver instance. + * + * @return void + */ + public function registerEngineResolver() + { + $this->app->singleton('view.engine.resolver', function () { + $resolver = new EngineResolver; + + // Next, we will register the various view engines with the resolver so that the + // environment will resolve the engines needed for various views based on the + // extension of view file. We call a method for each of the view's engines. + foreach (['file', 'php', 'blade'] as $engine) { + $this->{'register'.ucfirst($engine).'Engine'}($resolver); + } + + return $resolver; + }); + } + + /** + * Register the file engine implementation. + * + * @param \Illuminate\View\Engines\EngineResolver $resolver + * @return void + */ + public function registerFileEngine($resolver) + { + $resolver->register('file', function () { + return new FileEngine; + }); + } + + /** + * Register the PHP engine implementation. + * + * @param \Illuminate\View\Engines\EngineResolver $resolver + * @return void + */ + public function registerPhpEngine($resolver) + { + $resolver->register('php', function () { + return new PhpEngine; + }); + } + + /** + * Register the Blade engine implementation. + * + * @param \Illuminate\View\Engines\EngineResolver $resolver + * @return void + */ + public function registerBladeEngine($resolver) + { + // The Compiler engine requires an instance of the CompilerInterface, which in + // this case will be the Blade compiler, so we'll first create the compiler + // instance to pass into the engine so it can compile the views properly. + $this->app->singleton('blade.compiler', function () { + return new BladeCompiler( + $this->app['files'], $this->app['config']['view.compiled'] + ); + }); + + $resolver->register('blade', function () { + return new CompilerEngine($this->app['blade.compiler']); + }); + } +} diff --git a/vendor/laravel/framework/src/Illuminate/View/composer.json b/vendor/laravel/framework/src/Illuminate/View/composer.json new file mode 100644 index 0000000..44ecebc --- /dev/null +++ b/vendor/laravel/framework/src/Illuminate/View/composer.json @@ -0,0 +1,39 @@ +{ + "name": "illuminate/view", + "description": "The Illuminate View package.", + "license": "MIT", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "illuminate/container": "5.7.*", + "illuminate/contracts": "5.7.*", + "illuminate/events": "5.7.*", + "illuminate/filesystem": "5.7.*", + "illuminate/support": "5.7.*", + "symfony/debug": "^4.1" + }, + "autoload": { + "psr-4": { + "Illuminate\\View\\": "" + } + }, + "extra": { + "branch-alias": { + "dev-master": "5.7-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/laravel/nexmo-notification-channel/LICENSE.txt b/vendor/laravel/nexmo-notification-channel/LICENSE.txt new file mode 100644 index 0000000..1ce5963 --- /dev/null +++ b/vendor/laravel/nexmo-notification-channel/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) + +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/laravel/nexmo-notification-channel/composer.json b/vendor/laravel/nexmo-notification-channel/composer.json new file mode 100644 index 0000000..699918a --- /dev/null +++ b/vendor/laravel/nexmo-notification-channel/composer.json @@ -0,0 +1,46 @@ +{ + "name": "laravel/nexmo-notification-channel", + "description": "Nexmo Notification Channel for laravel.", + "keywords": ["laravel", "notifications", "nexmo"], + "license": "MIT", + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "nexmo/client": "^1.0" + }, + "require-dev": { + "illuminate/notifications": "~5.7", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^7.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Notifications\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Illuminate\\Tests\\Notifications\\": "tests/" + } + }, + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + }, + "laravel": { + "providers": [ + "Illuminate\\Notifications\\NexmoChannelServiceProvider" + ] + } + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/vendor/laravel/nexmo-notification-channel/readme.md b/vendor/laravel/nexmo-notification-channel/readme.md new file mode 100644 index 0000000..e69de29 diff --git a/vendor/laravel/nexmo-notification-channel/src/Channels/NexmoSmsChannel.php b/vendor/laravel/nexmo-notification-channel/src/Channels/NexmoSmsChannel.php new file mode 100644 index 0000000..fecbedd --- /dev/null +++ b/vendor/laravel/nexmo-notification-channel/src/Channels/NexmoSmsChannel.php @@ -0,0 +1,64 @@ +from = $from; + $this->nexmo = $nexmo; + } + + /** + * Send the given notification. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @return \Nexmo\Message\Message + */ + public function send($notifiable, Notification $notification) + { + if (! $to = $notifiable->routeNotificationFor('nexmo', $notification)) { + return; + } + + $message = $notification->toNexmo($notifiable); + + if (is_string($message)) { + $message = new NexmoMessage($message); + } + + return $this->nexmo->message()->send([ + 'type' => $message->type, + 'from' => $message->from ?: $this->from, + 'to' => $to, + 'text' => trim($message->content), + ]); + } +} diff --git a/vendor/laravel/nexmo-notification-channel/src/Messages/NexmoMessage.php b/vendor/laravel/nexmo-notification-channel/src/Messages/NexmoMessage.php new file mode 100644 index 0000000..293cf03 --- /dev/null +++ b/vendor/laravel/nexmo-notification-channel/src/Messages/NexmoMessage.php @@ -0,0 +1,76 @@ +content = $content; + } + + /** + * Set the message content. + * + * @param string $content + * @return $this + */ + public function content($content) + { + $this->content = $content; + + return $this; + } + + /** + * Set the phone number the message should be sent from. + * + * @param string $from + * @return $this + */ + public function from($from) + { + $this->from = $from; + + return $this; + } + + /** + * Set the message type. + * + * @return $this + */ + public function unicode() + { + $this->type = 'unicode'; + + return $this; + } +} diff --git a/vendor/laravel/nexmo-notification-channel/src/NexmoChannelServiceProvider.php b/vendor/laravel/nexmo-notification-channel/src/NexmoChannelServiceProvider.php new file mode 100644 index 0000000..dc8cb98 --- /dev/null +++ b/vendor/laravel/nexmo-notification-channel/src/NexmoChannelServiceProvider.php @@ -0,0 +1,29 @@ +app['config']['services.nexmo.key'], + $this->app['config']['services.nexmo.secret'] + )), + $this->app['config']['services.nexmo.sms_from'] + ); + }); + } +} diff --git a/vendor/laravel/slack-notification-channel/LICENSE.txt b/vendor/laravel/slack-notification-channel/LICENSE.txt new file mode 100644 index 0000000..1ce5963 --- /dev/null +++ b/vendor/laravel/slack-notification-channel/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) + +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/laravel/slack-notification-channel/composer.json b/vendor/laravel/slack-notification-channel/composer.json new file mode 100644 index 0000000..8bbc02f --- /dev/null +++ b/vendor/laravel/slack-notification-channel/composer.json @@ -0,0 +1,46 @@ +{ + "name": "laravel/slack-notification-channel", + "description": "Slack Notification Channel for laravel.", + "keywords": ["laravel", "notifications", "slack"], + "license": "MIT", + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "require": { + "php": "^7.1.3", + "guzzlehttp/guzzle": "^6.0" + }, + "require-dev": { + "illuminate/notifications": "~5.7", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^7.0" + }, + "autoload": { + "psr-4": { + "Illuminate\\Notifications\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Illuminate\\Tests\\Notifications\\": "tests/" + } + }, + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + }, + "laravel": { + "providers": [ + "Illuminate\\Notifications\\SlackChannelServiceProvider" + ] + } + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/vendor/laravel/slack-notification-channel/readme.md b/vendor/laravel/slack-notification-channel/readme.md new file mode 100644 index 0000000..e69de29 diff --git a/vendor/laravel/slack-notification-channel/src/Channels/SlackWebhookChannel.php b/vendor/laravel/slack-notification-channel/src/Channels/SlackWebhookChannel.php new file mode 100644 index 0000000..b5cce83 --- /dev/null +++ b/vendor/laravel/slack-notification-channel/src/Channels/SlackWebhookChannel.php @@ -0,0 +1,122 @@ +http = $http; + } + + /** + * Send the given notification. + * + * @param mixed $notifiable + * @param \Illuminate\Notifications\Notification $notification + * @return void + */ + public function send($notifiable, Notification $notification) + { + if (! $url = $notifiable->routeNotificationFor('slack', $notification)) { + return; + } + + $this->http->post($url, $this->buildJsonPayload( + $notification->toSlack($notifiable) + )); + } + + /** + * Build up a JSON payload for the Slack webhook. + * + * @param \Illuminate\Notifications\Messages\SlackMessage $message + * @return array + */ + protected function buildJsonPayload(SlackMessage $message) + { + $optionalFields = array_filter([ + 'channel' => data_get($message, 'channel'), + 'icon_emoji' => data_get($message, 'icon'), + 'icon_url' => data_get($message, 'image'), + 'link_names' => data_get($message, 'linkNames'), + 'unfurl_links' => data_get($message, 'unfurlLinks'), + 'unfurl_media' => data_get($message, 'unfurlMedia'), + 'username' => data_get($message, 'username'), + ]); + + return array_merge([ + 'json' => array_merge([ + 'text' => $message->content, + 'attachments' => $this->attachments($message), + ], $optionalFields), + ], $message->http); + } + + /** + * Format the message's attachments. + * + * @param \Illuminate\Notifications\Messages\SlackMessage $message + * @return array + */ + protected function attachments(SlackMessage $message) + { + return collect($message->attachments)->map(function ($attachment) use ($message) { + return array_filter([ + 'actions' => $attachment->actions, + 'author_icon' => $attachment->authorIcon, + 'author_link' => $attachment->authorLink, + 'author_name' => $attachment->authorName, + 'color' => $attachment->color ?: $message->color(), + 'fallback' => $attachment->fallback, + 'fields' => $this->fields($attachment), + 'footer' => $attachment->footer, + 'footer_icon' => $attachment->footerIcon, + 'image_url' => $attachment->imageUrl, + 'mrkdwn_in' => $attachment->markdown, + 'pretext' => $attachment->pretext, + 'text' => $attachment->content, + 'thumb_url' => $attachment->thumbUrl, + 'title' => $attachment->title, + 'title_link' => $attachment->url, + 'ts' => $attachment->timestamp, + ]); + })->all(); + } + + /** + * Format the attachment's fields. + * + * @param \Illuminate\Notifications\Messages\SlackAttachment $attachment + * @return array + */ + protected function fields(SlackAttachment $attachment) + { + return collect($attachment->fields)->map(function ($value, $key) { + if ($value instanceof SlackAttachmentField) { + return $value->toArray(); + } + + return ['title' => $key, 'value' => $value, 'short' => true]; + })->values()->all(); + } +} diff --git a/vendor/laravel/slack-notification-channel/src/Messages/SlackAttachment.php b/vendor/laravel/slack-notification-channel/src/Messages/SlackAttachment.php new file mode 100644 index 0000000..4aebde8 --- /dev/null +++ b/vendor/laravel/slack-notification-channel/src/Messages/SlackAttachment.php @@ -0,0 +1,348 @@ +title = $title; + $this->url = $url; + + return $this; + } + + /** + * Set the pretext of the attachment. + * + * @param string $pretext + * @return $this + */ + public function pretext($pretext) + { + $this->pretext = $pretext; + + return $this; + } + + /** + * Set the content (text) of the attachment. + * + * @param string $content + * @return $this + */ + public function content($content) + { + $this->content = $content; + + return $this; + } + + /** + * A plain-text summary of the attachment. + * + * @param string $fallback + * @return $this + */ + public function fallback($fallback) + { + $this->fallback = $fallback; + + return $this; + } + + /** + * Set the color of the attachment. + * + * @param string $color + * @return $this + */ + public function color($color) + { + $this->color = $color; + + return $this; + } + + /** + * Add a field to the attachment. + * + * @param \Closure|string $title + * @param string $content + * @return $this + */ + public function field($title, $content = '') + { + if (is_callable($title)) { + $callback = $title; + + $callback($attachmentField = new SlackAttachmentField); + + $this->fields[] = $attachmentField; + + return $this; + } + + $this->fields[$title] = $content; + + return $this; + } + + /** + * Set the fields of the attachment. + * + * @param array $fields + * @return $this + */ + public function fields(array $fields) + { + $this->fields = $fields; + + return $this; + } + + /** + * Set the fields containing markdown. + * + * @param array $fields + * @return $this + */ + public function markdown(array $fields) + { + $this->markdown = $fields; + + return $this; + } + + /** + * Set the image URL. + * + * @param string $url + * @return $this + */ + public function image($url) + { + $this->imageUrl = $url; + + return $this; + } + + /** + * Set the URL to the attachment thumbnail. + * + * @param string $url + * @return $this + */ + public function thumb($url) + { + $this->thumbUrl = $url; + + return $this; + } + + /** + * Add an action (button) under the attachment. + * + * @param string $title + * @param string $url + * @param string $style + * @return $this + */ + public function action($title, $url, $style = '') + { + $this->actions[] = [ + 'type' => 'button', + 'text' => $title, + 'url' => $url, + 'style' => $style, + ]; + + return $this; + } + + /** + * Set the author of the attachment. + * + * @param string $name + * @param string|null $link + * @param string|null $icon + * @return $this + */ + public function author($name, $link = null, $icon = null) + { + $this->authorName = $name; + $this->authorLink = $link; + $this->authorIcon = $icon; + + return $this; + } + + /** + * Set the footer content. + * + * @param string $footer + * @return $this + */ + public function footer($footer) + { + $this->footer = $footer; + + return $this; + } + + /** + * Set the footer icon. + * + * @param string $icon + * @return $this + */ + public function footerIcon($icon) + { + $this->footerIcon = $icon; + + return $this; + } + + /** + * Set the timestamp. + * + * @param \DateTimeInterface|\DateInterval|int $timestamp + * @return $this + */ + public function timestamp($timestamp) + { + $this->timestamp = $this->availableAt($timestamp); + + return $this; + } +} diff --git a/vendor/laravel/slack-notification-channel/src/Messages/SlackAttachmentField.php b/vendor/laravel/slack-notification-channel/src/Messages/SlackAttachmentField.php new file mode 100644 index 0000000..f63bb26 --- /dev/null +++ b/vendor/laravel/slack-notification-channel/src/Messages/SlackAttachmentField.php @@ -0,0 +1,79 @@ +title = $title; + + return $this; + } + + /** + * Set the content of the field. + * + * @param string $content + * @return $this + */ + public function content($content) + { + $this->content = $content; + + return $this; + } + + /** + * Indicates that the content should not be displayed side-by-side with other fields. + * + * @return $this + */ + public function long() + { + $this->short = false; + + return $this; + } + + /** + * Get the array representation of the attachment field. + * + * @return array + */ + public function toArray() + { + return [ + 'title' => $this->title, + 'value' => $this->content, + 'short' => $this->short, + ]; + } +} diff --git a/vendor/laravel/slack-notification-channel/src/Messages/SlackMessage.php b/vendor/laravel/slack-notification-channel/src/Messages/SlackMessage.php new file mode 100644 index 0000000..6d6a97c --- /dev/null +++ b/vendor/laravel/slack-notification-channel/src/Messages/SlackMessage.php @@ -0,0 +1,273 @@ +level = 'info'; + + return $this; + } + + /** + * Indicate that the notification gives information about a successful operation. + * + * @return $this + */ + public function success() + { + $this->level = 'success'; + + return $this; + } + + /** + * Indicate that the notification gives information about a warning. + * + * @return $this + */ + public function warning() + { + $this->level = 'warning'; + + return $this; + } + + /** + * Indicate that the notification gives information about an error. + * + * @return $this + */ + public function error() + { + $this->level = 'error'; + + return $this; + } + + /** + * Set a custom username and optional emoji icon for the Slack message. + * + * @param string $username + * @param string|null $icon + * @return $this + */ + public function from($username, $icon = null) + { + $this->username = $username; + + if (! is_null($icon)) { + $this->icon = $icon; + } + + return $this; + } + + /** + * Set a custom image icon the message should use. + * + * @param string $image + * @return $this + */ + public function image($image) + { + $this->image = $image; + + return $this; + } + + /** + * Set the Slack channel the message should be sent to. + * + * @param string $channel + * @return $this + */ + public function to($channel) + { + $this->channel = $channel; + + return $this; + } + + /** + * Set the content of the Slack message. + * + * @param string $content + * @return $this + */ + public function content($content) + { + $this->content = $content; + + return $this; + } + + /** + * Define an attachment for the message. + * + * @param \Closure $callback + * @return $this + */ + public function attachment(Closure $callback) + { + $this->attachments[] = $attachment = new SlackAttachment; + + $callback($attachment); + + return $this; + } + + /** + * Get the color for the message. + * + * @return string|null + */ + public function color() + { + switch ($this->level) { + case 'success': + return 'good'; + case 'error': + return 'danger'; + case 'warning': + return 'warning'; + } + } + + /** + * Find and link channel names and usernames. + * + * @return $this + */ + public function linkNames() + { + $this->linkNames = 1; + + return $this; + } + + /** + * Find and link channel names and usernames. + * + * @param string $unfurl + * @return $this + */ + public function unfurlLinks($unfurl) + { + $this->unfurlLinks = $unfurl; + + return $this; + } + + /** + * Find and link channel names and usernames. + * + * @param string $unfurl + * @return $this + */ + public function unfurlMedia($unfurl) + { + $this->unfurlMedia = $unfurl; + + return $this; + } + + /** + * Set additional request options for the Guzzle HTTP client. + * + * @param array $options + * @return $this + */ + public function http(array $options) + { + $this->http = $options; + + return $this; + } +} diff --git a/vendor/laravel/slack-notification-channel/src/SlackChannelServiceProvider.php b/vendor/laravel/slack-notification-channel/src/SlackChannelServiceProvider.php new file mode 100644 index 0000000..16bcd5e --- /dev/null +++ b/vendor/laravel/slack-notification-channel/src/SlackChannelServiceProvider.php @@ -0,0 +1,22 @@ +setIssuer('http://example.com') // Configures the issuer (iss claim) + ->setAudience('http://example.org') // Configures the audience (aud claim) + ->setId('4f1g23a12aa', true) // Configures the id (jti claim), replicating as a header item + ->setIssuedAt(time()) // Configures the time that the token was issue (iat claim) + ->setNotBefore(time() + 60) // Configures the time that the token can be used (nbf claim) + ->setExpiration(time() + 3600) // Configures the expiration time of the token (exp claim) + ->set('uid', 1) // Configures a new claim, called "uid" + ->getToken(); // Retrieves the generated token + + +$token->getHeaders(); // Retrieves the token headers +$token->getClaims(); // Retrieves the token claims + +echo $token->getHeader('jti'); // will print "4f1g23a12aa" +echo $token->getClaim('iss'); // will print "http://example.com" +echo $token->getClaim('uid'); // will print "1" +echo $token; // The string representation of the object is a JWT string (pretty easy, right?) +``` + +### Parsing from strings + +Use the parser to create a new token from a JWT string (using the previous token as example): + +```php +use Lcobucci\JWT\Parser; + +$token = (new Parser())->parse((string) $token); // Parses from a string +$token->getHeaders(); // Retrieves the token header +$token->getClaims(); // Retrieves the token claims + +echo $token->getHeader('jti'); // will print "4f1g23a12aa" +echo $token->getClaim('iss'); // will print "http://example.com" +echo $token->getClaim('uid'); // will print "1" +``` + +### Validating + +We can easily validate if the token is valid (using the previous token as example): + +```php +use Lcobucci\JWT\ValidationData; + +$data = new ValidationData(); // It will use the current time to validate (iat, nbf and exp) +$data->setIssuer('http://example.com'); +$data->setAudience('http://example.org'); +$data->setId('4f1g23a12aa'); + +var_dump($token->validate($data)); // false, because we created a token that cannot be used before of `time() + 60` + +$data->setCurrentTime(time() + 60); // changing the validation time to future + +var_dump($token->validate($data)); // true, because validation information is equals to data contained on the token + +$data->setCurrentTime(time() + 4000); // changing the validation time to future + +var_dump($token->validate($data)); // false, because token is expired since current time is greater than exp +``` + +## Token signature + +We can use signatures to be able to verify if the token was not modified after its generation. This library implements Hmac, RSA and ECDSA signatures (using 256, 384 and 512). + +### Hmac + +Hmac signatures are really simple to be used: + +```php +use Lcobucci\JWT\Builder; +use Lcobucci\JWT\Signer\Hmac\Sha256; + +$signer = new Sha256(); + +$token = (new Builder())->setIssuer('http://example.com') // Configures the issuer (iss claim) + ->setAudience('http://example.org') // Configures the audience (aud claim) + ->setId('4f1g23a12aa', true) // Configures the id (jti claim), replicating as a header item + ->setIssuedAt(time()) // Configures the time that the token was issue (iat claim) + ->setNotBefore(time() + 60) // Configures the time that the token can be used (nbf claim) + ->setExpiration(time() + 3600) // Configures the expiration time of the token (exp claim) + ->set('uid', 1) // Configures a new claim, called "uid" + ->sign($signer, 'testing') // creates a signature using "testing" as key + ->getToken(); // Retrieves the generated token + + +var_dump($token->verify($signer, 'testing 1')); // false, because the key is different +var_dump($token->verify($signer, 'testing')); // true, because the key is the same +``` + +### RSA and ECDSA + +RSA and ECDSA signatures are based on public and private keys so you have to generate using the private key and verify using the public key: + +```php +use Lcobucci\JWT\Builder; +use Lcobucci\JWT\Signer\Keychain; // just to make our life simpler +use Lcobucci\JWT\Signer\Rsa\Sha256; // you can use Lcobucci\JWT\Signer\Ecdsa\Sha256 if you're using ECDSA keys + +$signer = new Sha256(); + +$keychain = new Keychain(); + +$token = (new Builder())->setIssuer('http://example.com') // Configures the issuer (iss claim) + ->setAudience('http://example.org') // Configures the audience (aud claim) + ->setId('4f1g23a12aa', true) // Configures the id (jti claim), replicating as a header item + ->setIssuedAt(time()) // Configures the time that the token was issue (iat claim) + ->setNotBefore(time() + 60) // Configures the time that the token can be used (nbf claim) + ->setExpiration(time() + 3600) // Configures the expiration time of the token (nbf claim) + ->set('uid', 1) // Configures a new claim, called "uid" + ->sign($signer, $keychain->getPrivateKey('file://{path to your private key}')) // creates a signature using your private key + ->getToken(); // Retrieves the generated token + + +var_dump($token->verify($signer, $keychain->getPublicKey('file://{path to your public key}'))); // true when the public key was generated by the private one =) +``` + +**It's important to say that if you're using RSA keys you shouldn't invoke ECDSA signers (and vice-versa), otherwise ```sign()``` and ```verify()``` will raise an exception!** diff --git a/vendor/lcobucci/jwt/composer.json b/vendor/lcobucci/jwt/composer.json new file mode 100644 index 0000000..93cf7ce --- /dev/null +++ b/vendor/lcobucci/jwt/composer.json @@ -0,0 +1,52 @@ +{ + "name": "lcobucci/jwt", + "description": "A simple library to work with JSON Web Token and JSON Web Signature", + "type": "library", + "authors": [ + { + "name": "Luís Otávio Cobucci Oblonczyk", + "email": "lcobucci@gmail.com", + "role": "Developer" + } + ], + "keywords": [ + "JWT", + "JWS" + ], + "license": [ + "BSD-3-Clause" + ], + "require": { + "php": ">=5.5", + "ext-openssl": "*" + }, + "require-dev": { + "phpunit/phpunit": "~4.5", + "squizlabs/php_codesniffer": "~2.3", + "phpmd/phpmd": "~2.2", + "phpunit/php-invoker": "~1.1", + "mikey179/vfsStream": "~1.5", + "mdanter/ecc": "~0.3.1" + }, + "suggest":{ + "mdanter/ecc": "Required to use Elliptic Curves based algorithms." + }, + "autoload": { + "psr-4": { + "Lcobucci\\JWT\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Lcobucci\\JWT\\": [ + "test/unit", + "test/functional" + ] + } + }, + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + } +} diff --git a/vendor/lcobucci/jwt/composer.lock b/vendor/lcobucci/jwt/composer.lock new file mode 100644 index 0000000..0b7d7cc --- /dev/null +++ b/vendor/lcobucci/jwt/composer.lock @@ -0,0 +1,1898 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "82547d7474ec5fcbf6718c4f2dca46d6", + "content-hash": "1c87e501c8e2df5e27eac6bfefe0c1f9", + "packages": [], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14 21:17:01" + }, + { + "name": "fgrosse/phpasn1", + "version": "1.3.2", + "source": { + "type": "git", + "url": "https://github.com/fgrosse/PHPASN1.git", + "reference": "ee6d1abd18f8bcbaf0b55563ba87e5ed16cd0c98" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fgrosse/PHPASN1/zipball/ee6d1abd18f8bcbaf0b55563ba87e5ed16cd0c98", + "reference": "ee6d1abd18f8bcbaf0b55563ba87e5ed16cd0c98", + "shasum": "" + }, + "require": { + "ext-gmp": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "FG\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Friedrich Große", + "email": "friedrich.grosse@gmail.com", + "homepage": "https://github.com/FGrosse", + "role": "Author" + }, + { + "name": "All contributors", + "homepage": "https://github.com/FGrosse/PHPASN1/contributors" + } + ], + "description": "A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.", + "homepage": "https://github.com/FGrosse/PHPASN1", + "time": "2015-07-15 21:26:40" + }, + { + "name": "mdanter/ecc", + "version": "v0.3.1", + "source": { + "type": "git", + "url": "https://github.com/phpecc/phpecc.git", + "reference": "182d94bc3bbeee6a8591bde36e66a80d8b07ae4b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpecc/phpecc/zipball/182d94bc3bbeee6a8591bde36e66a80d8b07ae4b", + "reference": "182d94bc3bbeee6a8591bde36e66a80d8b07ae4b", + "shasum": "" + }, + "require": { + "ext-gmp": "*", + "ext-mcrypt": "*", + "fgrosse/phpasn1": "~1.3.1", + "php": ">=5.4.0", + "symfony/console": "~2.6" + }, + "require-dev": { + "phpunit/phpunit": "~4.1", + "squizlabs/php_codesniffer": "~2", + "symfony/yaml": "~2.6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Mdanter\\Ecc\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matyas Danter", + "homepage": "http://matejdanter.com/", + "role": "Author" + }, + { + "name": "Thibaud Fabre", + "email": "thibaud@aztech.io", + "homepage": "http://aztech.io", + "role": "Maintainer" + }, + { + "name": "Drak", + "email": "drak@zikula.org", + "homepage": "http://zikula.org", + "role": "Maintainer" + } + ], + "description": "PHP Elliptic Curve Cryptography library", + "homepage": "https://github.com/mdanter/phpecc", + "time": "2014-07-07 12:44:15" + }, + { + "name": "mikey179/vfsStream", + "version": "v1.6.4", + "source": { + "type": "git", + "url": "https://github.com/mikey179/vfsStream.git", + "reference": "0247f57b2245e8ad2e689d7cee754b45fbabd592" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/0247f57b2245e8ad2e689d7cee754b45fbabd592", + "reference": "0247f57b2245e8ad2e689d7cee754b45fbabd592", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "org\\bovigo\\vfs\\": "src/main/php" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Frank Kleine", + "homepage": "http://frankkleine.de/", + "role": "Developer" + } + ], + "description": "Virtual file system to mock the real file system in unit tests.", + "homepage": "http://vfs.bovigo.org/", + "time": "2016-07-18 14:02:57" + }, + { + "name": "pdepend/pdepend", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/pdepend/pdepend.git", + "reference": "b086687f3a01dc6bb92d633aef071d2c5dd0db06" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pdepend/pdepend/zipball/b086687f3a01dc6bb92d633aef071d2c5dd0db06", + "reference": "b086687f3a01dc6bb92d633aef071d2c5dd0db06", + "shasum": "" + }, + "require": { + "php": ">=5.3.7", + "symfony/config": "^2.3.0|^3", + "symfony/dependency-injection": "^2.3.0|^3", + "symfony/filesystem": "^2.3.0|^3" + }, + "require-dev": { + "phpunit/phpunit": "^4.4.0,<4.8", + "squizlabs/php_codesniffer": "^2.0.0" + }, + "bin": [ + "src/bin/pdepend" + ], + "type": "library", + "autoload": { + "psr-4": { + "PDepend\\": "src/main/php/PDepend" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Official version of pdepend to be handled with Composer", + "time": "2016-03-10 15:15:04" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2015-12-27 11:43:31" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.2.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2016-09-30 07:12:33" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.2", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443", + "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2016-06-10 07:14:17" + }, + { + "name": "phpmd/phpmd", + "version": "2.4.3", + "source": { + "type": "git", + "url": "https://github.com/phpmd/phpmd.git", + "reference": "2b9c2417a18696dfb578b38c116cd0ddc19b256e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpmd/phpmd/zipball/2b9c2417a18696dfb578b38c116cd0ddc19b256e", + "reference": "2b9c2417a18696dfb578b38c116cd0ddc19b256e", + "shasum": "" + }, + "require": { + "pdepend/pdepend": "^2.0.4", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0", + "squizlabs/php_codesniffer": "^2.0" + }, + "bin": [ + "src/bin/phpmd" + ], + "type": "project", + "autoload": { + "psr-0": { + "PHPMD\\": "src/main/php" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Manuel Pichler", + "email": "github@manuel-pichler.de", + "homepage": "https://github.com/manuelpichler", + "role": "Project Founder" + }, + { + "name": "Other contributors", + "homepage": "https://github.com/phpmd/phpmd/graphs/contributors", + "role": "Contributors" + }, + { + "name": "Marc Würth", + "email": "ravage@bluewin.ch", + "homepage": "https://github.com/ravage84", + "role": "Project Maintainer" + } + ], + "description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.", + "homepage": "http://phpmd.org/", + "keywords": [ + "mess detection", + "mess detector", + "pdepend", + "phpmd", + "pmd" + ], + "time": "2016-04-04 11:52:04" + }, + { + "name": "phpspec/prophecy", + "version": "v1.6.1", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "58a8137754bc24b25740d4281399a4a3596058e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0", + "reference": "58a8137754bc24b25740d4281399a4a3596058e0", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1", + "sebastian/recursion-context": "^1.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2016-06-07 08:13:47" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2015-10-06 15:47:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2015-06-21 13:08:43" + }, + { + "name": "phpunit/php-invoker", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "86074bf0fc2caf02ec8819a93f65a37cd0b44c8e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/86074bf0fc2caf02ec8819a93f65a37cd0b44c8e", + "reference": "86074bf0fc2caf02ec8819a93f65a37cd0b44c8e", + "shasum": "" + }, + "require": { + "ext-pcntl": "*", + "php": ">=5.3.3", + "phpunit/php-timer": ">=1.0.6" + }, + "require-dev": { + "phpunit/phpunit": "~4" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for invoking callables with a timeout.", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "time": "2015-06-21 13:32:55" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21 13:50:34" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4|~5" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2016-05-12 18:03:57" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2015-09-15 10:49:45" + }, + { + "name": "phpunit/phpunit", + "version": "4.8.27", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "c062dddcb68e44b563f66ee319ddae2b5a322a90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c062dddcb68e44b563f66ee319ddae2b5a322a90", + "reference": "c062dddcb68e44b563f66ee319ddae2b5a322a90", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "~2.1", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.1", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.1|~3.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.8.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2016-07-21 06:48:14" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "2.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": ">=5.3.3", + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2015-10-02 06:51:40" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10 12:19:37" + }, + { + "name": "sebastian/comparator", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2015-07-26 15:48:44" + }, + { + "name": "sebastian/diff", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2015-12-08 07:14:41" + }, + { + "name": "sebastian/environment", + "version": "1.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8 || ^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2016-08-18 05:49:44" + }, + { + "name": "sebastian/exporter", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2016-06-17 09:04:28" + }, + { + "name": "sebastian/global-state", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2015-10-12 03:26:01" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2015-11-11 19:50:13" + }, + { + "name": "sebastian/version", + "version": "1.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2015-06-21 13:59:46" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "2.7.0", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/571e27b6348e5b3a637b2abc82ac0d01e6d7bbed", + "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "scripts/phpcs", + "scripts/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "classmap": [ + "CodeSniffer.php", + "CodeSniffer/CLI.php", + "CodeSniffer/Exception.php", + "CodeSniffer/File.php", + "CodeSniffer/Fixer.php", + "CodeSniffer/Report.php", + "CodeSniffer/Reporting.php", + "CodeSniffer/Sniff.php", + "CodeSniffer/Tokens.php", + "CodeSniffer/Reports/", + "CodeSniffer/Tokenizers/", + "CodeSniffer/DocGenerators/", + "CodeSniffer/Standards/AbstractPatternSniff.php", + "CodeSniffer/Standards/AbstractScopeSniff.php", + "CodeSniffer/Standards/AbstractVariableSniff.php", + "CodeSniffer/Standards/IncorrectPatternException.php", + "CodeSniffer/Standards/Generic/Sniffs/", + "CodeSniffer/Standards/MySource/Sniffs/", + "CodeSniffer/Standards/PEAR/Sniffs/", + "CodeSniffer/Standards/PSR1/Sniffs/", + "CodeSniffer/Standards/PSR2/Sniffs/", + "CodeSniffer/Standards/Squiz/Sniffs/", + "CodeSniffer/Standards/Zend/Sniffs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2016-09-01 23:53:02" + }, + { + "name": "symfony/config", + "version": "v3.1.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "949e7e846743a7f9e46dc50eb639d5fde1f53341" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/949e7e846743a7f9e46dc50eb639d5fde1f53341", + "reference": "949e7e846743a7f9e46dc50eb639d5fde1f53341", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/filesystem": "~2.8|~3.0" + }, + "suggest": { + "symfony/yaml": "To use the yaml reference dumper" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Config Component", + "homepage": "https://symfony.com", + "time": "2016-09-25 08:27:07" + }, + { + "name": "symfony/console", + "version": "v2.8.13", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "7350016c8abcab897046f1aead2b766b84d3eff8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/7350016c8abcab897046f1aead2b766b84d3eff8", + "reference": "7350016c8abcab897046f1aead2b766b84d3eff8", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/debug": "~2.7,>=2.7.2|~3.0.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.1|~3.0.0", + "symfony/process": "~2.1|~3.0.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2016-10-06 01:43:09" + }, + { + "name": "symfony/debug", + "version": "v3.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/697c527acd9ea1b2d3efac34d9806bf255278b0a", + "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/class-loader": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2016-07-30 07:22:48" + }, + { + "name": "symfony/dependency-injection", + "version": "v3.1.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/dependency-injection.git", + "reference": "c578891216090069cd6d2e573402e13e39b3ad5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/c578891216090069cd6d2e573402e13e39b3ad5c", + "reference": "c578891216090069cd6d2e573402e13e39b3ad5c", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "require-dev": { + "symfony/config": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/yaml": "~2.8.7|~3.0.7|~3.1.1|~3.2" + }, + "suggest": { + "symfony/config": "", + "symfony/expression-language": "For using expressions in service container configuration", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\DependencyInjection\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DependencyInjection Component", + "homepage": "https://symfony.com", + "time": "2016-10-24 15:52:44" + }, + { + "name": "symfony/filesystem", + "version": "v3.1.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "0565b61bf098cb4dc09f4f103f033138ae4f42c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/0565b61bf098cb4dc09f4f103f033138ae4f42c6", + "reference": "0565b61bf098cb4dc09f4f103f033138ae4f42c6", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2016-10-18 04:30:12" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "dff51f72b0706335131b00a7f49606168c582594" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", + "reference": "dff51f72b0706335131b00a7f49606168c582594", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2016-05-18 14:26:46" + }, + { + "name": "symfony/yaml", + "version": "v3.1.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "7ff51b06c6c3d5cc6686df69004a42c69df09e27" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/7ff51b06c6c3d5cc6686df69004a42c69df09e27", + "reference": "7ff51b06c6c3d5cc6686df69004a42c69df09e27", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2016-10-24 18:41:13" + }, + { + "name": "webmozart/assert", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "bb2d123231c095735130cc8f6d31385a44c7b308" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/bb2d123231c095735130cc8f6d31385a44c7b308", + "reference": "bb2d123231c095735130cc8f6d31385a44c7b308", + "shasum": "" + }, + "require": { + "php": "^5.3.3|^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-08-09 15:02:57" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.5", + "ext-openssl": "*" + }, + "platform-dev": [] +} diff --git a/vendor/lcobucci/jwt/phpunit.xml.dist b/vendor/lcobucci/jwt/phpunit.xml.dist new file mode 100644 index 0000000..5a722b3 --- /dev/null +++ b/vendor/lcobucci/jwt/phpunit.xml.dist @@ -0,0 +1,33 @@ + + + + + test/unit + + + test/functional + + + + + + src + + + + vendor + + + diff --git a/vendor/lcobucci/jwt/src/Builder.php b/vendor/lcobucci/jwt/src/Builder.php new file mode 100644 index 0000000..af1f643 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Builder.php @@ -0,0 +1,277 @@ + + * @since 0.1.0 + */ +class Builder +{ + /** + * The token header + * + * @var array + */ + private $headers; + + /** + * The token claim set + * + * @var array + */ + private $claims; + + /** + * The token signature + * + * @var Signature + */ + private $signature; + + /** + * The data encoder + * + * @var Encoder + */ + private $encoder; + + /** + * The factory of claims + * + * @var ClaimFactory + */ + private $claimFactory; + + /** + * Initializes a new builder + * + * @param Encoder $encoder + * @param ClaimFactory $claimFactory + */ + public function __construct( + Encoder $encoder = null, + ClaimFactory $claimFactory = null + ) { + $this->encoder = $encoder ?: new Encoder(); + $this->claimFactory = $claimFactory ?: new ClaimFactory(); + $this->headers = ['typ'=> 'JWT', 'alg' => 'none']; + $this->claims = []; + } + + /** + * Configures the audience + * + * @param string $audience + * @param boolean $replicateAsHeader + * + * @return Builder + */ + public function setAudience($audience, $replicateAsHeader = false) + { + return $this->setRegisteredClaim('aud', (string) $audience, $replicateAsHeader); + } + + /** + * Configures the expiration time + * + * @param int $expiration + * @param boolean $replicateAsHeader + * + * @return Builder + */ + public function setExpiration($expiration, $replicateAsHeader = false) + { + return $this->setRegisteredClaim('exp', (int) $expiration, $replicateAsHeader); + } + + /** + * Configures the token id + * + * @param string $id + * @param boolean $replicateAsHeader + * + * @return Builder + */ + public function setId($id, $replicateAsHeader = false) + { + return $this->setRegisteredClaim('jti', (string) $id, $replicateAsHeader); + } + + /** + * Configures the time that the token was issued + * + * @param int $issuedAt + * @param boolean $replicateAsHeader + * + * @return Builder + */ + public function setIssuedAt($issuedAt, $replicateAsHeader = false) + { + return $this->setRegisteredClaim('iat', (int) $issuedAt, $replicateAsHeader); + } + + /** + * Configures the issuer + * + * @param string $issuer + * @param boolean $replicateAsHeader + * + * @return Builder + */ + public function setIssuer($issuer, $replicateAsHeader = false) + { + return $this->setRegisteredClaim('iss', (string) $issuer, $replicateAsHeader); + } + + /** + * Configures the time before which the token cannot be accepted + * + * @param int $notBefore + * @param boolean $replicateAsHeader + * + * @return Builder + */ + public function setNotBefore($notBefore, $replicateAsHeader = false) + { + return $this->setRegisteredClaim('nbf', (int) $notBefore, $replicateAsHeader); + } + + /** + * Configures the subject + * + * @param string $subject + * @param boolean $replicateAsHeader + * + * @return Builder + */ + public function setSubject($subject, $replicateAsHeader = false) + { + return $this->setRegisteredClaim('sub', (string) $subject, $replicateAsHeader); + } + + /** + * Configures a registed claim + * + * @param string $name + * @param mixed $value + * @param boolean $replicate + * + * @return Builder + */ + protected function setRegisteredClaim($name, $value, $replicate) + { + $this->set($name, $value); + + if ($replicate) { + $this->headers[$name] = $this->claims[$name]; + } + + return $this; + } + + /** + * Configures a header item + * + * @param string $name + * @param mixed $value + * + * @return Builder + * + * @throws BadMethodCallException When data has been already signed + */ + public function setHeader($name, $value) + { + if ($this->signature) { + throw new BadMethodCallException('You must unsign before make changes'); + } + + $this->headers[(string) $name] = $this->claimFactory->create($name, $value); + + return $this; + } + + /** + * Configures a claim item + * + * @param string $name + * @param mixed $value + * + * @return Builder + * + * @throws BadMethodCallException When data has been already signed + */ + public function set($name, $value) + { + if ($this->signature) { + throw new BadMethodCallException('You must unsign before making changes'); + } + + $this->claims[(string) $name] = $this->claimFactory->create($name, $value); + + return $this; + } + + /** + * Signs the data + * + * @param Signer $signer + * @param Key|string $key + * + * @return Builder + */ + public function sign(Signer $signer, $key) + { + $signer->modifyHeader($this->headers); + + $this->signature = $signer->sign( + $this->getToken()->getPayload(), + $key + ); + + return $this; + } + + /** + * Removes the signature from the builder + * + * @return Builder + */ + public function unsign() + { + $this->signature = null; + + return $this; + } + + /** + * Returns the resultant token + * + * @return Token + */ + public function getToken() + { + $payload = [ + $this->encoder->base64UrlEncode($this->encoder->jsonEncode($this->headers)), + $this->encoder->base64UrlEncode($this->encoder->jsonEncode($this->claims)) + ]; + + if ($this->signature !== null) { + $payload[] = $this->encoder->base64UrlEncode($this->signature); + } + + return new Token($this->headers, $this->claims, $this->signature, $payload); + } +} diff --git a/vendor/lcobucci/jwt/src/Claim.php b/vendor/lcobucci/jwt/src/Claim.php new file mode 100644 index 0000000..e561740 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Claim.php @@ -0,0 +1,40 @@ + + * @since 2.0.0 + */ +interface Claim extends JsonSerializable +{ + /** + * Returns the claim name + * + * @return string + */ + public function getName(); + + /** + * Returns the claim value + * + * @return string + */ + public function getValue(); + + /** + * Returns the string representation of the claim + * + * @return string + */ + public function __toString(); +} diff --git a/vendor/lcobucci/jwt/src/Claim/Basic.php b/vendor/lcobucci/jwt/src/Claim/Basic.php new file mode 100644 index 0000000..96a8cd3 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Claim/Basic.php @@ -0,0 +1,73 @@ + + * @since 2.0.0 + */ +class Basic implements Claim +{ + /** + * @var string + */ + private $name; + + /** + * @var mixed + */ + private $value; + + /** + * Initializes the claim + * + * @param string $name + * @param mixed $value + */ + public function __construct($name, $value) + { + $this->name = $name; + $this->value = $value; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return $this->name; + } + + /** + * {@inheritdoc} + */ + public function getValue() + { + return $this->value; + } + + /** + * {@inheritdoc} + */ + public function jsonSerialize() + { + return $this->value; + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return (string) $this->value; + } +} diff --git a/vendor/lcobucci/jwt/src/Claim/EqualsTo.php b/vendor/lcobucci/jwt/src/Claim/EqualsTo.php new file mode 100644 index 0000000..071b74a --- /dev/null +++ b/vendor/lcobucci/jwt/src/Claim/EqualsTo.php @@ -0,0 +1,32 @@ + + * @since 2.0.0 + */ +class EqualsTo extends Basic implements Claim, Validatable +{ + /** + * {@inheritdoc} + */ + public function validate(ValidationData $data) + { + if ($data->has($this->getName())) { + return $this->getValue() === $data->get($this->getName()); + } + + return true; + } +} diff --git a/vendor/lcobucci/jwt/src/Claim/Factory.php b/vendor/lcobucci/jwt/src/Claim/Factory.php new file mode 100644 index 0000000..9c1c2b0 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Claim/Factory.php @@ -0,0 +1,116 @@ + + * @since 2.0.0 + */ +class Factory +{ + /** + * The list of claim callbacks + * + * @var array + */ + private $callbacks; + + /** + * Initializes the factory, registering the default callbacks + * + * @param array $callbacks + */ + public function __construct(array $callbacks = []) + { + $this->callbacks = array_merge( + [ + 'iat' => [$this, 'createLesserOrEqualsTo'], + 'nbf' => [$this, 'createLesserOrEqualsTo'], + 'exp' => [$this, 'createGreaterOrEqualsTo'], + 'iss' => [$this, 'createEqualsTo'], + 'aud' => [$this, 'createEqualsTo'], + 'sub' => [$this, 'createEqualsTo'], + 'jti' => [$this, 'createEqualsTo'] + ], + $callbacks + ); + } + + /** + * Create a new claim + * + * @param string $name + * @param mixed $value + * + * @return Claim + */ + public function create($name, $value) + { + if (!empty($this->callbacks[$name])) { + return call_user_func($this->callbacks[$name], $name, $value); + } + + return $this->createBasic($name, $value); + } + + /** + * Creates a claim that can be compared (greator or equals) + * + * @param string $name + * @param mixed $value + * + * @return GreaterOrEqualsTo + */ + private function createGreaterOrEqualsTo($name, $value) + { + return new GreaterOrEqualsTo($name, $value); + } + + /** + * Creates a claim that can be compared (greator or equals) + * + * @param string $name + * @param mixed $value + * + * @return LesserOrEqualsTo + */ + private function createLesserOrEqualsTo($name, $value) + { + return new LesserOrEqualsTo($name, $value); + } + + /** + * Creates a claim that can be compared (equals) + * + * @param string $name + * @param mixed $value + * + * @return EqualsTo + */ + private function createEqualsTo($name, $value) + { + return new EqualsTo($name, $value); + } + + /** + * Creates a basic claim + * + * @param string $name + * @param mixed $value + * + * @return Basic + */ + private function createBasic($name, $value) + { + return new Basic($name, $value); + } +} diff --git a/vendor/lcobucci/jwt/src/Claim/GreaterOrEqualsTo.php b/vendor/lcobucci/jwt/src/Claim/GreaterOrEqualsTo.php new file mode 100644 index 0000000..0a4c246 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Claim/GreaterOrEqualsTo.php @@ -0,0 +1,32 @@ + + * @since 2.0.0 + */ +class GreaterOrEqualsTo extends Basic implements Claim, Validatable +{ + /** + * {@inheritdoc} + */ + public function validate(ValidationData $data) + { + if ($data->has($this->getName())) { + return $this->getValue() >= $data->get($this->getName()); + } + + return true; + } +} diff --git a/vendor/lcobucci/jwt/src/Claim/LesserOrEqualsTo.php b/vendor/lcobucci/jwt/src/Claim/LesserOrEqualsTo.php new file mode 100644 index 0000000..3d89ccf --- /dev/null +++ b/vendor/lcobucci/jwt/src/Claim/LesserOrEqualsTo.php @@ -0,0 +1,32 @@ + + * @since 2.0.0 + */ +class LesserOrEqualsTo extends Basic implements Claim, Validatable +{ + /** + * {@inheritdoc} + */ + public function validate(ValidationData $data) + { + if ($data->has($this->getName())) { + return $this->getValue() <= $data->get($this->getName()); + } + + return true; + } +} diff --git a/vendor/lcobucci/jwt/src/Claim/Validatable.php b/vendor/lcobucci/jwt/src/Claim/Validatable.php new file mode 100644 index 0000000..0e49cf2 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Claim/Validatable.php @@ -0,0 +1,28 @@ + + * @since 2.0.0 + */ +interface Validatable +{ + /** + * Returns if claim is valid according with given data + * + * @param ValidationData $data + * + * @return boolean + */ + public function validate(ValidationData $data); +} diff --git a/vendor/lcobucci/jwt/src/Parser.php b/vendor/lcobucci/jwt/src/Parser.php new file mode 100644 index 0000000..9497395 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Parser.php @@ -0,0 +1,157 @@ + + * @since 0.1.0 + */ +class Parser +{ + /** + * The data decoder + * + * @var Decoder + */ + private $decoder; + + /** + * The claims factory + * + * @var ClaimFactory + */ + private $claimFactory; + + /** + * Initializes the object + * + * @param Decoder $decoder + * @param ClaimFactory $claimFactory + */ + public function __construct( + Decoder $decoder = null, + ClaimFactory $claimFactory = null + ) { + $this->decoder = $decoder ?: new Decoder(); + $this->claimFactory = $claimFactory ?: new ClaimFactory(); + } + + /** + * Parses the JWT and returns a token + * + * @param string $jwt + * + * @return Token + */ + public function parse($jwt) + { + $data = $this->splitJwt($jwt); + $header = $this->parseHeader($data[0]); + $claims = $this->parseClaims($data[1]); + $signature = $this->parseSignature($header, $data[2]); + + foreach ($claims as $name => $value) { + if (isset($header[$name])) { + $header[$name] = $value; + } + } + + if ($signature === null) { + unset($data[2]); + } + + return new Token($header, $claims, $signature, $data); + } + + /** + * Splits the JWT string into an array + * + * @param string $jwt + * + * @return array + * + * @throws InvalidArgumentException When JWT is not a string or is invalid + */ + protected function splitJwt($jwt) + { + if (!is_string($jwt)) { + throw new InvalidArgumentException('The JWT string must have two dots'); + } + + $data = explode('.', $jwt); + + if (count($data) != 3) { + throw new InvalidArgumentException('The JWT string must have two dots'); + } + + return $data; + } + + /** + * Parses the header from a string + * + * @param string $data + * + * @return array + * + * @throws InvalidArgumentException When an invalid header is informed + */ + protected function parseHeader($data) + { + $header = (array) $this->decoder->jsonDecode($this->decoder->base64UrlDecode($data)); + + if (isset($header['enc'])) { + throw new InvalidArgumentException('Encryption is not supported yet'); + } + + return $header; + } + + /** + * Parses the claim set from a string + * + * @param string $data + * + * @return array + */ + protected function parseClaims($data) + { + $claims = (array) $this->decoder->jsonDecode($this->decoder->base64UrlDecode($data)); + + foreach ($claims as $name => &$value) { + $value = $this->claimFactory->create($name, $value); + } + + return $claims; + } + + /** + * Returns the signature from given data + * + * @param array $header + * @param string $data + * + * @return Signature + */ + protected function parseSignature(array $header, $data) + { + if ($data == '' || !isset($header['alg']) || $header['alg'] == 'none') { + return null; + } + + $hash = $this->decoder->base64UrlDecode($data); + + return new Signature($hash); + } +} diff --git a/vendor/lcobucci/jwt/src/Parsing/Decoder.php b/vendor/lcobucci/jwt/src/Parsing/Decoder.php new file mode 100644 index 0000000..86336b0 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Parsing/Decoder.php @@ -0,0 +1,56 @@ + + * @since 0.1.0 + * + * @link http://tools.ietf.org/html/rfc4648#section-5 + */ +class Decoder +{ + /** + * Decodes from JSON, validating the errors (will return an associative array + * instead of objects) + * + * @param string $json + * @return mixed + * + * @throws RuntimeException When something goes wrong while decoding + */ + public function jsonDecode($json) + { + $data = json_decode($json); + + if (json_last_error() != JSON_ERROR_NONE) { + throw new RuntimeException('Error while decoding to JSON: ' . json_last_error_msg()); + } + + return $data; + } + + /** + * Decodes from base64url + * + * @param string $data + * @return string + */ + public function base64UrlDecode($data) + { + if ($remainder = strlen($data) % 4) { + $data .= str_repeat('=', 4 - $remainder); + } + + return base64_decode(strtr($data, '-_', '+/')); + } +} diff --git a/vendor/lcobucci/jwt/src/Parsing/Encoder.php b/vendor/lcobucci/jwt/src/Parsing/Encoder.php new file mode 100644 index 0000000..ece5b28 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Parsing/Encoder.php @@ -0,0 +1,51 @@ + + * @since 0.1.0 + * + * @link http://tools.ietf.org/html/rfc4648#section-5 + */ +class Encoder +{ + /** + * Encodes to JSON, validating the errors + * + * @param mixed $data + * @return string + * + * @throws RuntimeException When something goes wrong while encoding + */ + public function jsonEncode($data) + { + $json = json_encode($data); + + if (json_last_error() != JSON_ERROR_NONE) { + throw new RuntimeException('Error while encoding to JSON: ' . json_last_error_msg()); + } + + return $json; + } + + /** + * Encodes to base64url + * + * @param string $data + * @return string + */ + public function base64UrlEncode($data) + { + return str_replace('=', '', strtr(base64_encode($data), '+/', '-_')); + } +} diff --git a/vendor/lcobucci/jwt/src/Signature.php b/vendor/lcobucci/jwt/src/Signature.php new file mode 100644 index 0000000..42f2b22 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signature.php @@ -0,0 +1,59 @@ + + * @since 0.1.0 + */ +class Signature +{ + /** + * The resultant hash + * + * @var string + */ + protected $hash; + + /** + * Initializes the object + * + * @param string $hash + */ + public function __construct($hash) + { + $this->hash = $hash; + } + + /** + * Verifies if the current hash matches with with the result of the creation of + * a new signature with given data + * + * @param Signer $signer + * @param string $payload + * @param string $key + * + * @return boolean + */ + public function verify(Signer $signer, $payload, $key) + { + return $signer->verify($this->hash, $payload, $key); + } + + /** + * Returns the current hash as a string representation of the signature + * + * @return string + */ + public function __toString() + { + return $this->hash; + } +} diff --git a/vendor/lcobucci/jwt/src/Signer.php b/vendor/lcobucci/jwt/src/Signer.php new file mode 100644 index 0000000..9b2cd47 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer.php @@ -0,0 +1,59 @@ + + * @since 0.1.0 + */ +interface Signer +{ + /** + * Returns the algorithm id + * + * @return string + */ + public function getAlgorithmId(); + + /** + * Apply changes on headers according with algorithm + * + * @param array $headers + */ + public function modifyHeader(array &$headers); + + /** + * Returns a signature for given data + * + * @param string $payload + * @param Key|string $key + * + * @return Signature + * + * @throws InvalidArgumentException When given key is invalid + */ + public function sign($payload, $key); + + /** + * Returns if the expected hash matches with the data and key + * + * @param string $expected + * @param string $payload + * @param Key|string $key + * + * @return boolean + * + * @throws InvalidArgumentException When given key is invalid + */ + public function verify($expected, $payload, $key); +} diff --git a/vendor/lcobucci/jwt/src/Signer/BaseSigner.php b/vendor/lcobucci/jwt/src/Signer/BaseSigner.php new file mode 100644 index 0000000..c65076f --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/BaseSigner.php @@ -0,0 +1,83 @@ + + * @since 0.1.0 + */ +abstract class BaseSigner implements Signer +{ + /** + * {@inheritdoc} + */ + public function modifyHeader(array &$headers) + { + $headers['alg'] = $this->getAlgorithmId(); + } + + /** + * {@inheritdoc} + */ + public function sign($payload, $key) + { + return new Signature($this->createHash($payload, $this->getKey($key))); + } + + /** + * {@inheritdoc} + */ + public function verify($expected, $payload, $key) + { + return $this->doVerify($expected, $payload, $this->getKey($key)); + } + + /** + * @param Key|string $key + * + * @return Key + */ + private function getKey($key) + { + if (is_string($key)) { + $key = new Key($key); + } + + return $key; + } + + /** + * Creates a hash with the given data + * + * @internal + * + * @param string $payload + * @param Key $key + * + * @return string + */ + abstract public function createHash($payload, Key $key); + + /** + * Performs the signature verification + * + * @internal + * + * @param string $expected + * @param string $payload + * @param Key $key + * + * @return boolean + */ + abstract public function doVerify($expected, $payload, Key $key); +} diff --git a/vendor/lcobucci/jwt/src/Signer/Ecdsa.php b/vendor/lcobucci/jwt/src/Signer/Ecdsa.php new file mode 100644 index 0000000..e1d5253 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/Ecdsa.php @@ -0,0 +1,153 @@ + + * @since 2.1.0 + */ +abstract class Ecdsa extends BaseSigner +{ + /** + * @var Adapter + */ + private $adapter; + + /** + * @var Signer + */ + private $signer; + + /** + * @var KeyParser + */ + private $parser; + + /** + * @param Adapter $adapter + * @param EcdsaSigner $signer + * @param KeyParser $parser + */ + public function __construct(Adapter $adapter = null, Signer $signer = null, KeyParser $parser = null) + { + $this->adapter = $adapter ?: EccFactory::getAdapter(); + $this->signer = $signer ?: EccFactory::getSigner($this->adapter); + $this->parser = $parser ?: new KeyParser($this->adapter); + } + + /** + * {@inheritdoc} + */ + public function createHash( + $payload, + Key $key, + RandomNumberGeneratorInterface $generator = null + ) { + $privateKey = $this->parser->getPrivateKey($key); + $generator = $generator ?: RandomGeneratorFactory::getRandomGenerator(); + + return $this->createSignatureHash( + $this->signer->sign( + $privateKey, + $this->createSigningHash($payload), + $generator->generate($privateKey->getPoint()->getOrder()) + ) + ); + } + + /** + * Creates a binary signature with R and S coordinates + * + * @param Signature $signature + * + * @return string + */ + private function createSignatureHash(Signature $signature) + { + $length = $this->getSignatureLength(); + + return pack( + 'H*', + sprintf( + '%s%s', + str_pad($this->adapter->decHex($signature->getR()), $length, '0', STR_PAD_LEFT), + str_pad($this->adapter->decHex($signature->getS()), $length, '0', STR_PAD_LEFT) + ) + ); + } + + /** + * Creates a hash using the signer algorithm with given payload + * + * @param string $payload + * + * @return int|string + */ + private function createSigningHash($payload) + { + return $this->adapter->hexDec(hash($this->getAlgorithm(), $payload)); + } + + /** + * {@inheritdoc} + */ + public function doVerify($expected, $payload, Key $key) + { + return $this->signer->verify( + $this->parser->getPublicKey($key), + $this->extractSignature($expected), + $this->createSigningHash($payload) + ); + } + + /** + * Extracts R and S values from given data + * + * @param string $value + * + * @return \Mdanter\Ecc\Crypto\Signature\Signature + */ + private function extractSignature($value) + { + $length = $this->getSignatureLength(); + $value = unpack('H*', $value)[1]; + + return new Signature( + $this->adapter->hexDec(substr($value, 0, $length)), + $this->adapter->hexDec(substr($value, $length)) + ); + } + + /** + * Returns the length of signature parts + * + * @internal + * + * @return int + */ + abstract public function getSignatureLength(); + + /** + * Returns the name of algorithm to be used to create the signing hash + * + * @internal + * + * @return string + */ + abstract public function getAlgorithm(); +} diff --git a/vendor/lcobucci/jwt/src/Signer/Ecdsa/KeyParser.php b/vendor/lcobucci/jwt/src/Signer/Ecdsa/KeyParser.php new file mode 100644 index 0000000..7d7c197 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/Ecdsa/KeyParser.php @@ -0,0 +1,104 @@ + + * @since 3.0.4 + */ +class KeyParser +{ + /** + * @var PrivateKeySerializerInterface + */ + private $privateKeySerializer; + + /** + * @var PublicKeySerializerInterface + */ + private $publicKeySerializer; + + /** + * @param MathAdapterInterface $adapter + * @param PrivateKeySerializerInterface $privateKeySerializer + * @param PublicKeySerializerInterface $publicKeySerializer + */ + public function __construct( + MathAdapterInterface $adapter, + PrivateKeySerializerInterface $privateKeySerializer = null, + PublicKeySerializerInterface $publicKeySerializer = null + ) { + $this->privateKeySerializer = $privateKeySerializer ?: new PemPrivateKeySerializer(new DerPrivateKeySerializer($adapter)); + $this->publicKeySerializer = $publicKeySerializer ?: new PemPublicKeySerializer(new DerPublicKeySerializer($adapter)); + } + + /** + * Parses a public key from the given PEM content + * + * @param Key $key + * + * @return \Mdanter\Ecc\Crypto\Key\PublicKeyInterface + */ + public function getPublicKey(Key $key) + { + return $this->publicKeySerializer->parse($this->getKeyContent($key, 'PUBLIC KEY')); + } + + /** + * Parses a private key from the given PEM content + * + * @param Key $key + * + * @return \Mdanter\Ecc\Crypto\Key\PrivateKeyInterface + */ + public function getPrivateKey(Key $key) + { + return $this->privateKeySerializer->parse($this->getKeyContent($key, 'EC PRIVATE KEY')); + } + + /** + * Extracts the base 64 value from the PEM certificate + * + * @param Key $key + * @param string $header + * + * @return string + * + * @throws InvalidArgumentException When given key is not a ECDSA key + */ + private function getKeyContent(Key $key, $header) + { + $match = null; + + preg_match( + '/[\-]{5}BEGIN ' . $header . '[\-]{5}(.*)[\-]{5}END ' . $header . '[\-]{5}/', + str_replace([PHP_EOL, "\n", "\r"], '', $key->getContent()), + $match + ); + + if (isset($match[1])) { + return $match[1]; + } + + throw new InvalidArgumentException('This is not a valid ECDSA key.'); + } +} diff --git a/vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha256.php b/vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha256.php new file mode 100644 index 0000000..4e1887c --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha256.php @@ -0,0 +1,43 @@ + + * @since 2.1.0 + */ +class Sha256 extends Ecdsa +{ + /** + * {@inheritdoc} + */ + public function getAlgorithmId() + { + return 'ES256'; + } + + /** + * {@inheritdoc} + */ + public function getAlgorithm() + { + return 'sha256'; + } + + /** + * {@inheritdoc} + */ + public function getSignatureLength() + { + return 64; + } +} diff --git a/vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha384.php b/vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha384.php new file mode 100644 index 0000000..bc235aa --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha384.php @@ -0,0 +1,43 @@ + + * @since 2.1.0 + */ +class Sha384 extends Ecdsa +{ + /** + * {@inheritdoc} + */ + public function getAlgorithmId() + { + return 'ES384'; + } + + /** + * {@inheritdoc} + */ + public function getAlgorithm() + { + return 'sha384'; + } + + /** + * {@inheritdoc} + */ + public function getSignatureLength() + { + return 96; + } +} diff --git a/vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha512.php b/vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha512.php new file mode 100644 index 0000000..20286da --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha512.php @@ -0,0 +1,43 @@ + + * @since 2.1.0 + */ +class Sha512 extends Ecdsa +{ + /** + * {@inheritdoc} + */ + public function getAlgorithmId() + { + return 'ES512'; + } + + /** + * {@inheritdoc} + */ + public function getAlgorithm() + { + return 'sha512'; + } + + /** + * {@inheritdoc} + */ + public function getSignatureLength() + { + return 132; + } +} diff --git a/vendor/lcobucci/jwt/src/Signer/Hmac.php b/vendor/lcobucci/jwt/src/Signer/Hmac.php new file mode 100644 index 0000000..c7f9ac3 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/Hmac.php @@ -0,0 +1,75 @@ + + * @since 0.1.0 + */ +abstract class Hmac extends BaseSigner +{ + /** + * {@inheritdoc} + */ + public function createHash($payload, Key $key) + { + return hash_hmac($this->getAlgorithm(), $payload, $key->getContent(), true); + } + + /** + * {@inheritdoc} + */ + public function doVerify($expected, $payload, Key $key) + { + if (!is_string($expected)) { + return false; + } + + $callback = function_exists('hash_equals') ? 'hash_equals' : [$this, 'hashEquals']; + + return call_user_func($callback, $expected, $this->createHash($payload, $key)); + } + + /** + * PHP < 5.6 timing attack safe hash comparison + * + * @internal + * + * @param string $expected + * @param string $generated + * + * @return boolean + */ + public function hashEquals($expected, $generated) + { + $expectedLength = strlen($expected); + + if ($expectedLength !== strlen($generated)) { + return false; + } + + $res = 0; + + for ($i = 0; $i < $expectedLength; ++$i) { + $res |= ord($expected[$i]) ^ ord($generated[$i]); + } + + return $res === 0; + } + + /** + * Returns the algorithm name + * + * @internal + * + * @return string + */ + abstract public function getAlgorithm(); +} diff --git a/vendor/lcobucci/jwt/src/Signer/Hmac/Sha256.php b/vendor/lcobucci/jwt/src/Signer/Hmac/Sha256.php new file mode 100644 index 0000000..49d10b3 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/Hmac/Sha256.php @@ -0,0 +1,35 @@ + + * @since 0.1.0 + */ +class Sha256 extends Hmac +{ + /** + * {@inheritdoc} + */ + public function getAlgorithmId() + { + return 'HS256'; + } + + /** + * {@inheritdoc} + */ + public function getAlgorithm() + { + return 'sha256'; + } +} diff --git a/vendor/lcobucci/jwt/src/Signer/Hmac/Sha384.php b/vendor/lcobucci/jwt/src/Signer/Hmac/Sha384.php new file mode 100644 index 0000000..8618801 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/Hmac/Sha384.php @@ -0,0 +1,35 @@ + + * @since 0.1.0 + */ +class Sha384 extends Hmac +{ + /** + * {@inheritdoc} + */ + public function getAlgorithmId() + { + return 'HS384'; + } + + /** + * {@inheritdoc} + */ + public function getAlgorithm() + { + return 'sha384'; + } +} diff --git a/vendor/lcobucci/jwt/src/Signer/Hmac/Sha512.php b/vendor/lcobucci/jwt/src/Signer/Hmac/Sha512.php new file mode 100644 index 0000000..8ae19d8 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/Hmac/Sha512.php @@ -0,0 +1,35 @@ + + * @since 0.1.0 + */ +class Sha512 extends Hmac +{ + /** + * {@inheritdoc} + */ + public function getAlgorithmId() + { + return 'HS512'; + } + + /** + * {@inheritdoc} + */ + public function getAlgorithm() + { + return 'sha512'; + } +} diff --git a/vendor/lcobucci/jwt/src/Signer/Key.php b/vendor/lcobucci/jwt/src/Signer/Key.php new file mode 100644 index 0000000..851fd68 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/Key.php @@ -0,0 +1,92 @@ + + * @since 3.0.4 + */ +final class Key +{ + /** + * @var string + */ + private $content; + + /** + * @var string + */ + private $passphrase; + + /** + * @param string $content + * @param string $passphrase + */ + public function __construct($content, $passphrase = null) + { + $this->setContent($content); + $this->passphrase = $passphrase; + } + + /** + * @param string $content + * + * @throws InvalidArgumentException + */ + private function setContent($content) + { + if (strpos($content, 'file://') === 0) { + $content = $this->readFile($content); + } + + $this->content = $content; + } + + /** + * @param string $content + * + * @return string + * + * @throws InvalidArgumentException + */ + private function readFile($content) + { + try { + $file = new SplFileObject(substr($content, 7)); + $content = ''; + + while (! $file->eof()) { + $content .= $file->fgets(); + } + + return $content; + } catch (Exception $exception) { + throw new InvalidArgumentException('You must inform a valid key file', 0, $exception); + } + } + + /** + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * @return string + */ + public function getPassphrase() + { + return $this->passphrase; + } +} diff --git a/vendor/lcobucci/jwt/src/Signer/Keychain.php b/vendor/lcobucci/jwt/src/Signer/Keychain.php new file mode 100644 index 0000000..3b367b6 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/Keychain.php @@ -0,0 +1,44 @@ + + * @since 2.1.0 + * + * @deprecated Since we've removed OpenSSL from ECDSA there's no reason to use this class + */ +class Keychain +{ + /** + * Returns a private key from file path or content + * + * @param string $key + * @param string $passphrase + * + * @return Key + */ + public function getPrivateKey($key, $passphrase = null) + { + return new Key($key, $passphrase); + } + + /** + * Returns a public key from file path or content + * + * @param string $certificate + * + * @return Key + */ + public function getPublicKey($certificate) + { + return new Key($certificate); + } +} diff --git a/vendor/lcobucci/jwt/src/Signer/Rsa.php b/vendor/lcobucci/jwt/src/Signer/Rsa.php new file mode 100644 index 0000000..40257dc --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/Rsa.php @@ -0,0 +1,80 @@ + + * @since 2.1.0 + */ +abstract class Rsa extends BaseSigner +{ + /** + * {@inheritdoc} + */ + public function createHash($payload, Key $key) + { + $key = openssl_get_privatekey($key->getContent(), $key->getPassphrase()); + $this->validateKey($key); + + $signature = ''; + + if (!openssl_sign($payload, $signature, $key, $this->getAlgorithm())) { + throw new InvalidArgumentException( + 'There was an error while creating the signature: ' . openssl_error_string() + ); + } + + return $signature; + } + + /** + * {@inheritdoc} + */ + public function doVerify($expected, $payload, Key $key) + { + $key = openssl_get_publickey($key->getContent()); + $this->validateKey($key); + + return openssl_verify($payload, $expected, $key, $this->getAlgorithm()) === 1; + } + + /** + * Validates if the given key is a valid RSA public/private key + * + * @param resource $key + * + * @throws InvalidArgumentException + */ + private function validateKey($key) + { + if ($key === false) { + throw new InvalidArgumentException( + 'It was not possible to parse your key, reason: ' . openssl_error_string() + ); + } + + $details = openssl_pkey_get_details($key); + + if (!isset($details['key']) || $details['type'] !== OPENSSL_KEYTYPE_RSA) { + throw new InvalidArgumentException('This key is not compatible with RSA signatures'); + } + } + + /** + * Returns the algorithm name + * + * @internal + * + * @return string + */ + abstract public function getAlgorithm(); +} diff --git a/vendor/lcobucci/jwt/src/Signer/Rsa/Sha256.php b/vendor/lcobucci/jwt/src/Signer/Rsa/Sha256.php new file mode 100644 index 0000000..4e873e1 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/Rsa/Sha256.php @@ -0,0 +1,35 @@ + + * @since 2.1.0 + */ +class Sha256 extends Rsa +{ + /** + * {@inheritdoc} + */ + public function getAlgorithmId() + { + return 'RS256'; + } + + /** + * {@inheritdoc} + */ + public function getAlgorithm() + { + return OPENSSL_ALGO_SHA256; + } +} diff --git a/vendor/lcobucci/jwt/src/Signer/Rsa/Sha384.php b/vendor/lcobucci/jwt/src/Signer/Rsa/Sha384.php new file mode 100644 index 0000000..c5d2631 --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/Rsa/Sha384.php @@ -0,0 +1,35 @@ + + * @since 2.1.0 + */ +class Sha384 extends Rsa +{ + /** + * {@inheritdoc} + */ + public function getAlgorithmId() + { + return 'RS384'; + } + + /** + * {@inheritdoc} + */ + public function getAlgorithm() + { + return OPENSSL_ALGO_SHA384; + } +} diff --git a/vendor/lcobucci/jwt/src/Signer/Rsa/Sha512.php b/vendor/lcobucci/jwt/src/Signer/Rsa/Sha512.php new file mode 100644 index 0000000..0d8074b --- /dev/null +++ b/vendor/lcobucci/jwt/src/Signer/Rsa/Sha512.php @@ -0,0 +1,35 @@ + + * @since 2.1.0 + */ +class Sha512 extends Rsa +{ + /** + * {@inheritdoc} + */ + public function getAlgorithmId() + { + return 'RS512'; + } + + /** + * {@inheritdoc} + */ + public function getAlgorithm() + { + return OPENSSL_ALGO_SHA512; + } +} diff --git a/vendor/lcobucci/jwt/src/Token.php b/vendor/lcobucci/jwt/src/Token.php new file mode 100644 index 0000000..2f6299b --- /dev/null +++ b/vendor/lcobucci/jwt/src/Token.php @@ -0,0 +1,284 @@ + + * @since 0.1.0 + */ +class Token +{ + /** + * The token headers + * + * @var array + */ + private $headers; + + /** + * The token claim set + * + * @var array + */ + private $claims; + + /** + * The token signature + * + * @var Signature + */ + private $signature; + + /** + * The encoded data + * + * @var array + */ + private $payload; + + /** + * Initializes the object + * + * @param array $headers + * @param array $claims + * @param array $payload + * @param Signature $signature + */ + public function __construct( + array $headers = ['alg' => 'none'], + array $claims = [], + Signature $signature = null, + array $payload = ['', ''] + ) { + $this->headers = $headers; + $this->claims = $claims; + $this->signature = $signature; + $this->payload = $payload; + } + + /** + * Returns the token headers + * + * @return array + */ + public function getHeaders() + { + return $this->headers; + } + + /** + * Returns if the header is configured + * + * @param string $name + * + * @return boolean + */ + public function hasHeader($name) + { + return array_key_exists($name, $this->headers); + } + + /** + * Returns the value of a token header + * + * @param string $name + * @param mixed $default + * + * @return mixed + * + * @throws OutOfBoundsException + */ + public function getHeader($name, $default = null) + { + if ($this->hasHeader($name)) { + return $this->getHeaderValue($name); + } + + if ($default === null) { + throw new OutOfBoundsException('Requested header is not configured'); + } + + return $default; + } + + /** + * Returns the value stored in header + * + * @param string $name + * + * @return mixed + */ + private function getHeaderValue($name) + { + $header = $this->headers[$name]; + + if ($header instanceof Claim) { + return $header->getValue(); + } + + return $header; + } + + /** + * Returns the token claim set + * + * @return array + */ + public function getClaims() + { + return $this->claims; + } + + /** + * Returns if the claim is configured + * + * @param string $name + * + * @return boolean + */ + public function hasClaim($name) + { + return array_key_exists($name, $this->claims); + } + + /** + * Returns the value of a token claim + * + * @param string $name + * @param mixed $default + * + * @return mixed + * + * @throws OutOfBoundsException + */ + public function getClaim($name, $default = null) + { + if ($this->hasClaim($name)) { + return $this->claims[$name]->getValue(); + } + + if ($default === null) { + throw new OutOfBoundsException('Requested claim is not configured'); + } + + return $default; + } + + /** + * Verify if the key matches with the one that created the signature + * + * @param Signer $signer + * @param string $key + * + * @return boolean + * + * @throws BadMethodCallException When token is not signed + */ + public function verify(Signer $signer, $key) + { + if ($this->signature === null) { + throw new BadMethodCallException('This token is not signed'); + } + + if ($this->headers['alg'] !== $signer->getAlgorithmId()) { + return false; + } + + return $this->signature->verify($signer, $this->getPayload(), $key); + } + + /** + * Validates if the token is valid + * + * @param ValidationData $data + * + * @return boolean + */ + public function validate(ValidationData $data) + { + foreach ($this->getValidatableClaims() as $claim) { + if (!$claim->validate($data)) { + return false; + } + } + + return true; + } + + /** + * Determine if the token is expired. + * + * @param DateTimeInterface $now Defaults to the current time. + * + * @return bool + */ + public function isExpired(DateTimeInterface $now = null) + { + $exp = $this->getClaim('exp', false); + + if ($exp === false) { + return false; + } + + $now = $now ?: new DateTime(); + + $expiresAt = new DateTime(); + $expiresAt->setTimestamp($exp); + + return $now > $expiresAt; + } + + /** + * Yields the validatable claims + * + * @return Generator + */ + private function getValidatableClaims() + { + foreach ($this->claims as $claim) { + if ($claim instanceof Validatable) { + yield $claim; + } + } + } + + /** + * Returns the token payload + * + * @return string + */ + public function getPayload() + { + return $this->payload[0] . '.' . $this->payload[1]; + } + + /** + * Returns an encoded representation of the token + * + * @return string + */ + public function __toString() + { + $data = implode('.', $this->payload); + + if ($this->signature === null) { + $data .= '.'; + } + + return $data; + } +} diff --git a/vendor/lcobucci/jwt/src/ValidationData.php b/vendor/lcobucci/jwt/src/ValidationData.php new file mode 100644 index 0000000..6302d0b --- /dev/null +++ b/vendor/lcobucci/jwt/src/ValidationData.php @@ -0,0 +1,120 @@ + + * @since 2.0.0 + */ +class ValidationData +{ + /** + * The list of things to be validated + * + * @var array + */ + private $items; + + /** + * Initializes the object + * + * @param int $currentTime + */ + public function __construct($currentTime = null) + { + $currentTime = $currentTime ?: time(); + + $this->items = [ + 'jti' => null, + 'iss' => null, + 'aud' => null, + 'sub' => null, + 'iat' => $currentTime, + 'nbf' => $currentTime, + 'exp' => $currentTime + ]; + } + + /** + * Configures the id + * + * @param string $id + */ + public function setId($id) + { + $this->items['jti'] = (string) $id; + } + + /** + * Configures the issuer + * + * @param string $issuer + */ + public function setIssuer($issuer) + { + $this->items['iss'] = (string) $issuer; + } + + /** + * Configures the audience + * + * @param string $audience + */ + public function setAudience($audience) + { + $this->items['aud'] = (string) $audience; + } + + /** + * Configures the subject + * + * @param string $subject + */ + public function setSubject($subject) + { + $this->items['sub'] = (string) $subject; + } + + /** + * Configures the time that "iat", "nbf" and "exp" should be based on + * + * @param int $currentTime + */ + public function setCurrentTime($currentTime) + { + $this->items['iat'] = (int) $currentTime; + $this->items['nbf'] = (int) $currentTime; + $this->items['exp'] = (int) $currentTime; + } + + /** + * Returns the requested item + * + * @param string $name + * + * @return mixed + */ + public function get($name) + { + return isset($this->items[$name]) ? $this->items[$name] : null; + } + + /** + * Returns if the item is present + * + * @param string $name + * + * @return boolean + */ + public function has($name) + { + return !empty($this->items[$name]); + } +} diff --git a/vendor/lcobucci/jwt/test/functional/EcdsaTokenTest.php b/vendor/lcobucci/jwt/test/functional/EcdsaTokenTest.php new file mode 100644 index 0000000..1e20f81 --- /dev/null +++ b/vendor/lcobucci/jwt/test/functional/EcdsaTokenTest.php @@ -0,0 +1,320 @@ + + * @since 2.1.0 + */ +class EcdsaTokenTest extends \PHPUnit_Framework_TestCase +{ + use Keys; + + /** + * @var Sha256 + */ + private $signer; + + /** + * @before + */ + public function createSigner() + { + $this->signer = new Sha256(); + } + + /** + * @test + * + * @expectedException \InvalidArgumentException + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Ecdsa + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256 + */ + public function builderShouldRaiseExceptionWhenKeyIsInvalid() + { + $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com']; + + (new Builder())->setId(1) + ->setAudience('http://client.abc.com') + ->setIssuer('http://api.abc.com') + ->set('user', $user) + ->sign($this->signer, new Key('testing')); + } + + /** + * @test + * + * @expectedException \InvalidArgumentException + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Ecdsa + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256 + */ + public function builderShouldRaiseExceptionWhenKeyIsNotEcdsaCompatible() + { + $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com']; + + (new Builder())->setId(1) + ->setAudience('http://client.abc.com') + ->setIssuer('http://api.abc.com') + ->set('user', $user) + ->sign($this->signer, static::$rsaKeys['private']); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Ecdsa + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256 + */ + public function builderCanGenerateAToken() + { + $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com']; + + $token = (new Builder())->setId(1) + ->setAudience('http://client.abc.com') + ->setIssuer('http://api.abc.com') + ->set('user', $user) + ->setHeader('jki', '1234') + ->sign($this->signer, static::$ecdsaKeys['private']) + ->getToken(); + + $this->assertAttributeInstanceOf(Signature::class, 'signature', $token); + $this->assertEquals('1234', $token->getHeader('jki')); + $this->assertEquals('http://client.abc.com', $token->getClaim('aud')); + $this->assertEquals('http://api.abc.com', $token->getClaim('iss')); + $this->assertEquals($user, $token->getClaim('user')); + + return $token; + } + + /** + * @test + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Parsing\Decoder + * @covers Lcobucci\JWT\Signer\Ecdsa + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser + */ + public function parserCanReadAToken(Token $generated) + { + $read = (new Parser())->parse((string) $generated); + + $this->assertEquals($generated, $read); + $this->assertEquals('testing', $read->getClaim('user')->name); + } + + /** + * @test + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Ecdsa + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256 + */ + public function verifyShouldReturnFalseWhenKeyIsNotRight(Token $token) + { + $this->assertFalse($token->verify($this->signer, static::$ecdsaKeys['public2'])); + } + + /** + * @test + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Ecdsa + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256 + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha512 + */ + public function verifyShouldReturnFalseWhenAlgorithmIsDifferent(Token $token) + { + $this->assertFalse($token->verify(new Sha512(), static::$ecdsaKeys['public1'])); + } + + /** + * @test + * + * @expectedException \RuntimeException + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Ecdsa + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256 + */ + public function verifyShouldRaiseExceptionWhenKeyIsNotEcdsaCompatible(Token $token) + { + $this->assertFalse($token->verify($this->signer, static::$rsaKeys['public'])); + } + + /** + * @test + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Ecdsa + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256 + */ + public function verifyShouldReturnTrueWhenKeyIsRight(Token $token) + { + $this->assertTrue($token->verify($this->signer, static::$ecdsaKeys['public1'])); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Ecdsa + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256 + */ + public function everythingShouldWorkWithAKeyWithParams() + { + $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com']; + + $token = (new Builder())->setId(1) + ->setAudience('http://client.abc.com') + ->setIssuer('http://api.abc.com') + ->set('user', $user) + ->setHeader('jki', '1234') + ->sign($this->signer, static::$ecdsaKeys['private-params']) + ->getToken(); + + $this->assertTrue($token->verify($this->signer, static::$ecdsaKeys['public-params'])); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Ecdsa + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha512 + * @covers Lcobucci\JWT\Signer\Keychain + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Parsing\Decoder + */ + public function everythingShouldWorkWhenUsingATokenGeneratedByOtherLibs() + { + $data = 'eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJoZWxsbyI6IndvcmxkIn0.' + . 'AQx1MqdTni6KuzfOoedg2-7NUiwe-b88SWbdmviz40GTwrM0Mybp1i1tVtm' + . 'TSQ91oEXGXBdtwsN6yalzP9J-sp2YATX_Tv4h-BednbdSvYxZsYnUoZ--ZU' + . 'dL10t7g8Yt3y9hdY_diOjIptcha6ajX8yzkDGYG42iSe3f5LywSuD6FO5c'; + + $key = '-----BEGIN PUBLIC KEY-----' . PHP_EOL + . 'MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAcpkss6wI7PPlxj3t7A1RqMH3nvL4' . PHP_EOL + . 'L5Tzxze/XeeYZnHqxiX+gle70DlGRMqqOq+PJ6RYX7vK0PJFdiAIXlyPQq0B3KaU' . PHP_EOL + . 'e86IvFeQSFrJdCc0K8NfiH2G1loIk3fiR+YLqlXk6FAeKtpXJKxR1pCQCAM+vBCs' . PHP_EOL + . 'mZudf1zCUZ8/4eodlHU=' . PHP_EOL + . '-----END PUBLIC KEY-----'; + + $keychain = new Keychain(); + $token = (new Parser())->parse((string) $data); + + $this->assertEquals('world', $token->getClaim('hello')); + $this->assertTrue($token->verify(new Sha512(), $keychain->getPublicKey($key))); + } +} diff --git a/vendor/lcobucci/jwt/test/functional/HmacTokenTest.php b/vendor/lcobucci/jwt/test/functional/HmacTokenTest.php new file mode 100644 index 0000000..60d8f3b --- /dev/null +++ b/vendor/lcobucci/jwt/test/functional/HmacTokenTest.php @@ -0,0 +1,186 @@ + + * @since 2.1.0 + */ +class HmacTokenTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Sha256 + */ + private $signer; + + /** + * @before + */ + public function createSigner() + { + $this->signer = new Sha256(); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Hmac + * @covers Lcobucci\JWT\Signer\Hmac\Sha256 + */ + public function builderCanGenerateAToken() + { + $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com']; + + $token = (new Builder())->setId(1) + ->setAudience('http://client.abc.com') + ->setIssuer('http://api.abc.com') + ->set('user', $user) + ->setHeader('jki', '1234') + ->sign($this->signer, 'testing') + ->getToken(); + + $this->assertAttributeInstanceOf(Signature::class, 'signature', $token); + $this->assertEquals('1234', $token->getHeader('jki')); + $this->assertEquals('http://client.abc.com', $token->getClaim('aud')); + $this->assertEquals('http://api.abc.com', $token->getClaim('iss')); + $this->assertEquals($user, $token->getClaim('user')); + + return $token; + } + + /** + * @test + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Parsing\Decoder + */ + public function parserCanReadAToken(Token $generated) + { + $read = (new Parser())->parse((string) $generated); + + $this->assertEquals($generated, $read); + $this->assertEquals('testing', $read->getClaim('user')->name); + } + + /** + * @test + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Hmac + * @covers Lcobucci\JWT\Signer\Hmac\Sha256 + */ + public function verifyShouldReturnFalseWhenKeyIsNotRight(Token $token) + { + $this->assertFalse($token->verify($this->signer, 'testing1')); + } + + /** + * @test + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Hmac + * @covers Lcobucci\JWT\Signer\Hmac\Sha256 + * @covers Lcobucci\JWT\Signer\Hmac\Sha512 + */ + public function verifyShouldReturnFalseWhenAlgorithmIsDifferent(Token $token) + { + $this->assertFalse($token->verify(new Sha512(), 'testing')); + } + + /** + * @test + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Hmac + * @covers Lcobucci\JWT\Signer\Hmac\Sha256 + */ + public function verifyShouldReturnTrueWhenKeyIsRight(Token $token) + { + $this->assertTrue($token->verify($this->signer, 'testing')); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Hmac + * @covers Lcobucci\JWT\Signer\Hmac\Sha256 + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Parsing\Decoder + */ + public function everythingShouldWorkWhenUsingATokenGeneratedByOtherLibs() + { + $data = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJoZWxsbyI6IndvcmxkIn0.Rh' + . '7AEgqCB7zae1PkgIlvOpeyw9Ab8NGTbeOH7heHO0o'; + + $token = (new Parser())->parse((string) $data); + + $this->assertEquals('world', $token->getClaim('hello')); + $this->assertTrue($token->verify($this->signer, 'testing')); + } +} diff --git a/vendor/lcobucci/jwt/test/functional/Keys.php b/vendor/lcobucci/jwt/test/functional/Keys.php new file mode 100644 index 0000000..f3a83d2 --- /dev/null +++ b/vendor/lcobucci/jwt/test/functional/Keys.php @@ -0,0 +1,53 @@ + + */ +trait Keys +{ + /** + * @var array + */ + protected static $rsaKeys; + + /** + * @var array + */ + protected static $ecdsaKeys; + + /** + * @beforeClass + */ + public static function createRsaKeys() + { + $keychain = new Keychain(); + $dir = 'file://' . __DIR__; + + static::$rsaKeys = [ + 'private' => $keychain->getPrivateKey($dir . '/rsa/private.key'), + 'public' => $keychain->getPublicKey($dir . '/rsa/public.key'), + 'encrypted-private' => $keychain->getPrivateKey($dir . '/rsa/encrypted-private.key', 'testing'), + 'encrypted-public' => $keychain->getPublicKey($dir . '/rsa/encrypted-public.key') + ]; + } + + /** + * @beforeClass + */ + public static function createEcdsaKeys() + { + $keychain = new Keychain(); + $dir = 'file://' . __DIR__; + + static::$ecdsaKeys = [ + 'private' => $keychain->getPrivateKey($dir . '/ecdsa/private.key'), + 'private-params' => $keychain->getPrivateKey($dir . '/ecdsa/private2.key'), + 'public1' => $keychain->getPublicKey($dir . '/ecdsa/public1.key'), + 'public2' => $keychain->getPublicKey($dir . '/ecdsa/public2.key'), + 'public-params' => $keychain->getPublicKey($dir . '/ecdsa/public3.key'), + ]; + } +} diff --git a/vendor/lcobucci/jwt/test/functional/RsaTokenTest.php b/vendor/lcobucci/jwt/test/functional/RsaTokenTest.php new file mode 100644 index 0000000..c241f78 --- /dev/null +++ b/vendor/lcobucci/jwt/test/functional/RsaTokenTest.php @@ -0,0 +1,272 @@ + + * @since 2.1.0 + */ +class RsaTokenTest extends \PHPUnit_Framework_TestCase +{ + use Keys; + + /** + * @var Sha256 + */ + private $signer; + + /** + * @before + */ + public function createSigner() + { + $this->signer = new Sha256(); + } + + /** + * @test + * + * @expectedException \InvalidArgumentException + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Rsa + * @covers Lcobucci\JWT\Signer\Rsa\Sha256 + */ + public function builderShouldRaiseExceptionWhenKeyIsInvalid() + { + $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com']; + + (new Builder())->setId(1) + ->setAudience('http://client.abc.com') + ->setIssuer('http://api.abc.com') + ->set('user', $user) + ->sign($this->signer, new Key('testing')); + } + + /** + * @test + * + * @expectedException \InvalidArgumentException + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Rsa + * @covers Lcobucci\JWT\Signer\Rsa\Sha256 + */ + public function builderShouldRaiseExceptionWhenKeyIsNotRsaCompatible() + { + $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com']; + + (new Builder())->setId(1) + ->setAudience('http://client.abc.com') + ->setIssuer('http://api.abc.com') + ->set('user', $user) + ->sign($this->signer, static::$ecdsaKeys['private']); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Rsa + * @covers Lcobucci\JWT\Signer\Rsa\Sha256 + */ + public function builderCanGenerateAToken() + { + $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com']; + + $token = (new Builder())->setId(1) + ->setAudience('http://client.abc.com') + ->setIssuer('http://api.abc.com') + ->set('user', $user) + ->setHeader('jki', '1234') + ->sign($this->signer, static::$rsaKeys['private']) + ->getToken(); + + $this->assertAttributeInstanceOf(Signature::class, 'signature', $token); + $this->assertEquals('1234', $token->getHeader('jki')); + $this->assertEquals('http://client.abc.com', $token->getClaim('aud')); + $this->assertEquals('http://api.abc.com', $token->getClaim('iss')); + $this->assertEquals($user, $token->getClaim('user')); + + return $token; + } + + /** + * @test + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Parsing\Decoder + */ + public function parserCanReadAToken(Token $generated) + { + $read = (new Parser())->parse((string) $generated); + + $this->assertEquals($generated, $read); + $this->assertEquals('testing', $read->getClaim('user')->name); + } + + /** + * @test + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Rsa + * @covers Lcobucci\JWT\Signer\Rsa\Sha256 + */ + public function verifyShouldReturnFalseWhenKeyIsNotRight(Token $token) + { + $this->assertFalse($token->verify($this->signer, self::$rsaKeys['encrypted-public'])); + } + + /** + * @test + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Rsa + * @covers Lcobucci\JWT\Signer\Rsa\Sha256 + * @covers Lcobucci\JWT\Signer\Rsa\Sha512 + */ + public function verifyShouldReturnFalseWhenAlgorithmIsDifferent(Token $token) + { + $this->assertFalse($token->verify(new Sha512(), self::$rsaKeys['public'])); + } + + /** + * @test + * + * @expectedException \InvalidArgumentException + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Rsa + * @covers Lcobucci\JWT\Signer\Rsa\Sha256 + */ + public function verifyShouldRaiseExceptionWhenKeyIsNotRsaCompatible(Token $token) + { + $this->assertFalse($token->verify($this->signer, self::$ecdsaKeys['public1'])); + } + + /** + * @test + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Rsa + * @covers Lcobucci\JWT\Signer\Rsa\Sha256 + */ + public function verifyShouldReturnTrueWhenKeyIsRight(Token $token) + { + $this->assertTrue($token->verify($this->signer, self::$rsaKeys['public'])); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Signature + * @covers Lcobucci\JWT\Signer\Key + * @covers Lcobucci\JWT\Signer\BaseSigner + * @covers Lcobucci\JWT\Signer\Rsa + * @covers Lcobucci\JWT\Signer\Rsa\Sha256 + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Parsing\Decoder + */ + public function everythingShouldWorkWhenUsingATokenGeneratedByOtherLibs() + { + $data = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXUyJ9.eyJoZWxsbyI6IndvcmxkIn0.s' + . 'GYbB1KrmnESNfJ4D9hOe1Zad_BMyxdb8G4p4LNP7StYlOyBWck6q7XPpPj_6gB' + . 'Bo1ohD3MA2o0HY42lNIrAStaVhfsFKGdIou8TarwMGZBPcif_3ThUV1pGS3fZc' + . 'lFwF2SP7rqCngQis_xcUVCyqa8E1Wa_v28grnl1QZrnmQFO8B5JGGLqcrfUHJO' + . 'nJCupP-Lqh4TmIhftIimSCgLNmJg80wyrpUEfZYReE7hPuEmY0ClTqAGIMQoNS' + . '98ljwDxwhfbSuL2tAdbV4DekbTpWzspe3dOJ7RSzmPKVZ6NoezaIazKqyqkmHZfcMaHI1lQeGia6LTbHU1bp0gINi74Vw'; + + $token = (new Parser())->parse((string) $data); + + $this->assertEquals('world', $token->getClaim('hello')); + $this->assertTrue($token->verify($this->signer, self::$rsaKeys['public'])); + } +} diff --git a/vendor/lcobucci/jwt/test/functional/UnsignedTokenTest.php b/vendor/lcobucci/jwt/test/functional/UnsignedTokenTest.php new file mode 100644 index 0000000..089cb5d --- /dev/null +++ b/vendor/lcobucci/jwt/test/functional/UnsignedTokenTest.php @@ -0,0 +1,137 @@ + + * @since 2.1.0 + */ +class UnsignedTokenTest extends \PHPUnit_Framework_TestCase +{ + const CURRENT_TIME = 100000; + + /** + * @test + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + */ + public function builderCanGenerateAToken() + { + $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com']; + + $token = (new Builder())->setId(1) + ->setAudience('http://client.abc.com') + ->setIssuer('http://api.abc.com') + ->setExpiration(self::CURRENT_TIME + 3000) + ->set('user', $user) + ->getToken(); + + $this->assertAttributeEquals(null, 'signature', $token); + $this->assertEquals('http://client.abc.com', $token->getClaim('aud')); + $this->assertEquals('http://api.abc.com', $token->getClaim('iss')); + $this->assertEquals(self::CURRENT_TIME + 3000, $token->getClaim('exp')); + $this->assertEquals($user, $token->getClaim('user')); + + return $token; + } + + /** + * @test + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Parsing\Decoder + */ + public function parserCanReadAToken(Token $generated) + { + $read = (new Parser())->parse((string) $generated); + + $this->assertEquals($generated, $read); + $this->assertEquals('testing', $read->getClaim('user')->name); + } + + /** + * @test + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\ValidationData + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Claim\EqualsTo + * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Parsing\Decoder + */ + public function tokenValidationShouldReturnWhenEverythingIsFine(Token $generated) + { + $data = new ValidationData(self::CURRENT_TIME - 10); + $data->setAudience('http://client.abc.com'); + $data->setIssuer('http://api.abc.com'); + + $this->assertTrue($generated->validate($data)); + } + + /** + * @test + * + * @dataProvider invalidValidationData + * + * @depends builderCanGenerateAToken + * + * @covers Lcobucci\JWT\Builder + * @covers Lcobucci\JWT\Parser + * @covers Lcobucci\JWT\Token + * @covers Lcobucci\JWT\ValidationData + * @covers Lcobucci\JWT\Claim\Factory + * @covers Lcobucci\JWT\Claim\Basic + * @covers Lcobucci\JWT\Claim\EqualsTo + * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo + * @covers Lcobucci\JWT\Parsing\Encoder + * @covers Lcobucci\JWT\Parsing\Decoder + */ + public function tokenValidationShouldReturnFalseWhenExpectedDataDontMatch(ValidationData $data, Token $generated) + { + $this->assertFalse($generated->validate($data)); + } + + public function invalidValidationData() + { + $expired = new ValidationData(self::CURRENT_TIME + 3020); + $expired->setAudience('http://client.abc.com'); + $expired->setIssuer('http://api.abc.com'); + + $invalidAudience = new ValidationData(self::CURRENT_TIME - 10); + $invalidAudience->setAudience('http://cclient.abc.com'); + $invalidAudience->setIssuer('http://api.abc.com'); + + $invalidIssuer = new ValidationData(self::CURRENT_TIME - 10); + $invalidIssuer->setAudience('http://client.abc.com'); + $invalidIssuer->setIssuer('http://aapi.abc.com'); + + return [[$expired], [$invalidAudience], [$invalidIssuer]]; + } +} diff --git a/vendor/lcobucci/jwt/test/functional/ecdsa/private.key b/vendor/lcobucci/jwt/test/functional/ecdsa/private.key new file mode 100644 index 0000000..d8ac3a2 --- /dev/null +++ b/vendor/lcobucci/jwt/test/functional/ecdsa/private.key @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIBGpMoZJ64MMSzuo5JbmXpf9V4qSWdLIl/8RmJLcfn/qoAoGCCqGSM49 +AwEHoUQDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpnd0wxa2iFruiI2tsEdGFTLTsy +U+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg== +-----END EC PRIVATE KEY----- \ No newline at end of file diff --git a/vendor/lcobucci/jwt/test/functional/ecdsa/private2.key b/vendor/lcobucci/jwt/test/functional/ecdsa/private2.key new file mode 100644 index 0000000..7c4e131 --- /dev/null +++ b/vendor/lcobucci/jwt/test/functional/ecdsa/private2.key @@ -0,0 +1,8 @@ +-----BEGIN EC PARAMETERS----- +BggqhkjOPQMBBw== +-----END EC PARAMETERS----- +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIM6G7WZ6SqoPwrHwGXhOJkYD+ErT8dfRvrNifgBQvSb7oAoGCCqGSM49 +AwEHoUQDQgAE09Hkp/u0tIGdzlQ99R/sXCOr9DTZAfLex4D4Po0C1L3qUqHrzZ0m +B3bAhe+pwEDQ/jqVqdzxhA9i4PqT7F4Aew== +-----END EC PRIVATE KEY----- diff --git a/vendor/lcobucci/jwt/test/functional/ecdsa/public1.key b/vendor/lcobucci/jwt/test/functional/ecdsa/public1.key new file mode 100644 index 0000000..21ea2e7 --- /dev/null +++ b/vendor/lcobucci/jwt/test/functional/ecdsa/public1.key @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpn +d0wxa2iFruiI2tsEdGFTLTsyU+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg== +-----END PUBLIC KEY----- \ No newline at end of file diff --git a/vendor/lcobucci/jwt/test/functional/ecdsa/public2.key b/vendor/lcobucci/jwt/test/functional/ecdsa/public2.key new file mode 100644 index 0000000..ad11abd --- /dev/null +++ b/vendor/lcobucci/jwt/test/functional/ecdsa/public2.key @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEdgxRxlhzhHGj+v6S2ikp+33LoGp5 +QWbEWv8BORsr2Ayg6C7deDDRM/s/f0R++4zZqXro1gDTVF5VDv7nE+EfEw== +-----END PUBLIC KEY----- \ No newline at end of file diff --git a/vendor/lcobucci/jwt/test/functional/ecdsa/public3.key b/vendor/lcobucci/jwt/test/functional/ecdsa/public3.key new file mode 100644 index 0000000..3bf5cd7 --- /dev/null +++ b/vendor/lcobucci/jwt/test/functional/ecdsa/public3.key @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE09Hkp/u0tIGdzlQ99R/sXCOr9DTZ +AfLex4D4Po0C1L3qUqHrzZ0mB3bAhe+pwEDQ/jqVqdzxhA9i4PqT7F4Aew== +-----END PUBLIC KEY----- diff --git a/vendor/lcobucci/jwt/test/functional/rsa/encrypted-private.key b/vendor/lcobucci/jwt/test/functional/rsa/encrypted-private.key new file mode 100644 index 0000000..121f88f --- /dev/null +++ b/vendor/lcobucci/jwt/test/functional/rsa/encrypted-private.key @@ -0,0 +1,30 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-128-CBC,0D71668CE71033CB9150ED82FC87F4A1 + +uLzPNDdlHnZ77tAGMHyPYERDMBcdV4SsQJYcSjiHhR2o0dLGTdgOpQrXTHPX4GJF +LlEWLhAAV9wx2mM/2kHDWB4uZwThtT9/v+RFoW1WbVO/d3lhI9fg4/73/DWAH/7/ +afMRc7ZOVoAmVCESotPx4khCHoE97RdY/JtkLTzc3+peqmL53AbYXrg9rTN1B+ZV +U3w4ciQS8Uki87zDYIBjYtaOCyMUTvug25CvdssvUMBoc/Jc0xps6/vAyXrnzlGT +pZD0Tst8idswfDi613BhAaxJspeY0AErWA59qJ3eGzbiQq5RDWcbJe/Tz5r/6+NN +DkvNQ7DaEZ6LpeWX0MUq6/QWfrM8yE95XhjyC1d3LYn32lXHUygbgTFWIgLDoOE6 +nBhu34SWtbLAnqYGewaJFxhlYVS9rb/uvYQg70r5X9Sx6alCQPiPyIv39IItezn2 +HF2GRfE91MPZUeDhdqdvvOlSZVM5KnYc1fhamGAwM48gdDDXe8Czu/JEGoANNvC3 +l/Z1p5RtGF4hrel9WpeX9zQq3pvtfVcVIiWuRUwCOSQytXlieRK37sMuYeggvmjV +VvaCods3mS/panWg9T/D/deIXjhzNJLvyiJg8+3sY5H4yNe0XpbaAc/ySwt9Rcxy +FzFQ+5pghLSZgR1uV3AhdcnzXBU2GkYhdGKt2tUsH0UeVQ2BXxTlBFsCOh2dWqcj +y3suIG65bukDAAWidQ4q3S6ZIMpXBhhCj7nwB5jQ7wSlU3U9So0ndr7zxdUILiMm +chHi3q5apVZnMGcwv2B33rt4nD7HgGEmRKkCelrSrBATY1ut+T4rCDzKDqDs3jpv +hYIWrlNPTkJyQz3eWly6Db+FJEfdYGadYJusc7/nOxCh/QmUu8Sh3NhKT6TH0bS7 +1AAqd8H+2hJ9I32Dhd2qwAF7PkNe2LGi+P8tbAtepKGim5w65wnsPePMnrfxumsG +PeDnMrqeCKy+fME7a/MS5kmEBpmD4BMhVC6/OhFVz8gBty1f8yIEZggHNQN2QK7m +NIrG+PwqW2w8HoxOlAi2Ix4LTPifrdfsH02U7aM1pgo1rZzD4AOzqvzCaK43H2VB +BHLeTBGoLEUxXA9C+iGbeQlKXkMC00QKkjK5+nvkvnvePFfsrTQIpuyGufD/MoPb +6fpwsyHZDxhxMN1PJk1b1lPq2Ui4hXpVNOYd4Q6OQz7bwxTMRX9XQromUlKMMgAT +edX8v2NdM7Ssy1IwHuGVbDEpZdjoeaWZ1iNRV17i/EaJAqwYDQLfsuHBlzZL1ov1 +xkKVJdL8Y3q80oRAzTQDVdzL/rI44LLAfv609YByCnw29feYJY2W6gV0O7ZSw413 +XUkc5CaEbR1LuG8NtnOOPJV4Tb/hNsIDtvVm7Hl5npBKBe4iVgQ2LNuC2eT69d/z +uvzgjISlumPiO5ivuYe0QtLPuJSc+/Bl8bPL8gcNQEtqkzj7IftHPPZNs+bJC2uY +bPjq5KoDNAMF6VHuKHwu48MBYpnXDIg3ZenmJwGRULRBhK6324hDS6NJ7ULTBU2M +TZCHmg89ySLBfCAspVeo63o/R7bs9a7BP9x2h5uwCBogSvkEwhhPKnboVN45bp9c +-----END RSA PRIVATE KEY----- \ No newline at end of file diff --git a/vendor/lcobucci/jwt/test/functional/rsa/encrypted-public.key b/vendor/lcobucci/jwt/test/functional/rsa/encrypted-public.key new file mode 100644 index 0000000..ae4a37c --- /dev/null +++ b/vendor/lcobucci/jwt/test/functional/rsa/encrypted-public.key @@ -0,0 +1,9 @@ +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwLpbUP8a9yflt5LKUUS3 +NPuRM7yEouPWg0VKeY5AURu4i8bqQ20K5jwfRJ+w05FvlywG4EuxpnpTFTVS2/do +q3xufzTf/C3KIDOAHEifkdx4140btKxxm4mD9Eu2CQ32adZyScha50KUFlfnAAic +Hb8wYxjFyWo3PAbGYmCQCn2z97Ab0Ar6NR1e+V9f8EL9Orr2f04puKJfQTZdWVDF +UJR4w7QZ/CPY0LEsiFLW3QQCNraka1mtrLJwPqreBtDEkj8IoISNkrguu/97RQZz +miJgBQkVjr6OfqG5WIFr0MzbRZc1/aK9g8ft88nhhQm0E3GqkCxBKTwgA03HtK07 +qQIDAQAB +-----END PUBLIC KEY----- \ No newline at end of file diff --git a/vendor/lcobucci/jwt/test/functional/rsa/private.key b/vendor/lcobucci/jwt/test/functional/rsa/private.key new file mode 100644 index 0000000..962c7f9 --- /dev/null +++ b/vendor/lcobucci/jwt/test/functional/rsa/private.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDTvwE87MtgREYL +TL4aHhQo3ZzogmxxvMUsKnPzyxRs1YrXOSOpwN0npsXarBKKVIUMNLfFODp/vnQn +2Zp06N8XG59WAOKwvC4MfxLDQkA+JXggzHlkbVoTN+dUkdYIFqSKuAPGwiWToRK2 +SxEhij3rE2FON8jQZvDxZkiP9a4vxJO3OTPQwKredXFiObsXD/c3RtLFhKctjCyH +OIrP0bQEsee/m7JNtG4ry6BPusN6wb+vJo5ieBYPa3c19akNq6q/nYWhplhkkJSu +aOrL5xXEFzI5TvcvnXR568GVcxK8YLfFkdxpsXGt5rAbeh0h/U5kILEAqv8P9PGT +ZpicKbrnAgMBAAECggEAd3yTQEQHR91/ASVfKPHMQns77eCbPVtekFusbugsMHYY +EPdHbqVMpvFvOMRc+f5Tzd15ziq6qBdbCJm8lThLm4iU0z1QrpaiDZ8vgUvDYM5Y +CXoZDli+uZWUTp60/n94fmb0ipZIChScsI2PrzOJWTvobvD/uso8MJydWc8zafQm +uqYzygOfjFZvU4lSfgzpefhpquy0JUy5TiKRmGUnwLb3TtcsVavjsn4QmNwLYgOF +2OE+R12ex3pAKTiRE6FcnE1xFIo1GKhBa2Otgw3MDO6Gg+kn8Q4alKz6C6RRlgaH +R7sYzEfJhsk/GGFTYOzXKQz2lSaStKt9wKCor04RcQKBgQDzPOu5jCTfayUo7xY2 +jHtiogHyKLLObt9l3qbwgXnaD6rnxYNvCrA0OMvT+iZXsFZKJkYzJr8ZOxOpPROk +10WdOaefiwUyL5dypueSwlIDwVm+hI4Bs82MajHtzOozh+73wA+aw5rPs84Uix9w +VbbwaVR6qP/BV09yJYS5kQ7fmwKBgQDe2xjywX2d2MC+qzRr+LfU+1+gq0jjhBCX +WHqRN6IECB0xTnXUf9WL/VCoI1/55BhdbbEja+4btYgcXSPmlXBIRKQ4VtFfVmYB +kPXeD8oZ7LyuNdCsbKNe+x1IHXDe6Wfs3L9ulCfXxeIE84wy3fd66mQahyXV9iD9 +CkuifMqUpQKBgQCiydHlY1LGJ/o9tA2Ewm5Na6mrvOs2V2Ox1NqbObwoYbX62eiF +53xX5u8bVl5U75JAm+79it/4bd5RtKux9dUETbLOhwcaOFm+hM+VG/IxyzRZ2nMD +1qcpY2U5BpxzknUvYF3RMTop6edxPk7zKpp9ubCtSu+oINvtxAhY/SkcIwKBgGP1 +upcImyO2GZ5shLL5eNubdSVILwV+M0LveOqyHYXZbd6z5r5OKKcGFKuWUnJwEU22 +6gGNY9wh7M9sJ7JBzX9c6pwqtPcidda2AtJ8GpbOTUOG9/afNBhiYpv6OKqD3w2r +ZmJfKg/qvpqh83zNezgy8nvDqwDxyZI2j/5uIx/RAoGBAMWRmxtv6H2cKhibI/aI +MTJM4QRjyPNxQqvAQsv+oHUbid06VK3JE+9iQyithjcfNOwnCaoO7I7qAj9QEfJS +MZQc/W/4DHJebo2kd11yoXPVTXXOuEwLSKCejBXABBY0MPNuPUmiXeU0O3Tyi37J +TUKzrgcd7NvlA41Y4xKcOqEA +-----END PRIVATE KEY----- \ No newline at end of file diff --git a/vendor/lcobucci/jwt/test/functional/rsa/public.key b/vendor/lcobucci/jwt/test/functional/rsa/public.key new file mode 100644 index 0000000..9992179 --- /dev/null +++ b/vendor/lcobucci/jwt/test/functional/rsa/public.key @@ -0,0 +1,9 @@ +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA078BPOzLYERGC0y+Gh4U +KN2c6IJscbzFLCpz88sUbNWK1zkjqcDdJ6bF2qwSilSFDDS3xTg6f750J9madOjf +FxufVgDisLwuDH8Sw0JAPiV4IMx5ZG1aEzfnVJHWCBakirgDxsIlk6EStksRIYo9 +6xNhTjfI0Gbw8WZIj/WuL8STtzkz0MCq3nVxYjm7Fw/3N0bSxYSnLYwshziKz9G0 +BLHnv5uyTbRuK8ugT7rDesG/ryaOYngWD2t3NfWpDauqv52FoaZYZJCUrmjqy+cV +xBcyOU73L510eevBlXMSvGC3xZHcabFxreawG3odIf1OZCCxAKr/D/Txk2aYnCm6 +5wIDAQAB +-----END PUBLIC KEY----- \ No newline at end of file diff --git a/vendor/lcobucci/jwt/test/unit/BuilderTest.php b/vendor/lcobucci/jwt/test/unit/BuilderTest.php new file mode 100644 index 0000000..de6b61f --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/BuilderTest.php @@ -0,0 +1,699 @@ + + * @since 0.1.0 + */ +class BuilderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Encoder|\PHPUnit_Framework_MockObject_MockObject + */ + protected $encoder; + + /** + * @var ClaimFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $claimFactory; + + /** + * @var Claim|\PHPUnit_Framework_MockObject_MockObject + */ + protected $defaultClaim; + + /** + * {@inheritdoc} + */ + protected function setUp() + { + $this->encoder = $this->getMock(Encoder::class); + $this->claimFactory = $this->getMock(ClaimFactory::class, [], [], '', false); + $this->defaultClaim = $this->getMock(Claim::class); + + $this->claimFactory->expects($this->any()) + ->method('create') + ->willReturn($this->defaultClaim); + } + + /** + * @return Builder + */ + private function createBuilder() + { + return new Builder($this->encoder, $this->claimFactory); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Builder::__construct + */ + public function constructMustInitializeTheAttributes() + { + $builder = $this->createBuilder(); + + $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder); + $this->assertAttributeEquals([], 'claims', $builder); + $this->assertAttributeEquals(null, 'signature', $builder); + $this->assertAttributeSame($this->encoder, 'encoder', $builder); + $this->assertAttributeSame($this->claimFactory, 'claimFactory', $builder); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setAudience + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setAudienceMustChangeTheAudClaim() + { + $builder = $this->createBuilder(); + $builder->setAudience('test'); + + $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder); + $this->assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $builder); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setAudience + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setAudienceCanReplicateItemOnHeader() + { + $builder = $this->createBuilder(); + $builder->setAudience('test', true); + + $this->assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $builder); + + $this->assertAttributeEquals( + ['alg' => 'none', 'typ' => 'JWT', 'aud' => $this->defaultClaim], + 'headers', + $builder + ); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setAudience + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setAudienceMustKeepAFluentInterface() + { + $builder = $this->createBuilder(); + + $this->assertSame($builder, $builder->setAudience('test')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setExpiration + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setExpirationMustChangeTheExpClaim() + { + $builder = $this->createBuilder(); + $builder->setExpiration('2'); + + $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder); + $this->assertAttributeEquals(['exp' => $this->defaultClaim], 'claims', $builder); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setExpiration + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setExpirationCanReplicateItemOnHeader() + { + $builder = $this->createBuilder(); + $builder->setExpiration('2', true); + + $this->assertAttributeEquals(['exp' => $this->defaultClaim], 'claims', $builder); + + $this->assertAttributeEquals( + ['alg' => 'none', 'typ' => 'JWT', 'exp' => $this->defaultClaim], + 'headers', + $builder + ); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setExpiration + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setExpirationMustKeepAFluentInterface() + { + $builder = $this->createBuilder(); + + $this->assertSame($builder, $builder->setExpiration('2')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setId + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setIdMustChangeTheJtiClaim() + { + $builder = $this->createBuilder(); + $builder->setId('2'); + + $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder); + $this->assertAttributeEquals(['jti' => $this->defaultClaim], 'claims', $builder); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setId + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setIdCanReplicateItemOnHeader() + { + $builder = $this->createBuilder(); + $builder->setId('2', true); + + $this->assertAttributeEquals(['jti' => $this->defaultClaim], 'claims', $builder); + + $this->assertAttributeEquals( + ['alg' => 'none', 'typ' => 'JWT', 'jti' => $this->defaultClaim], + 'headers', + $builder + ); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setId + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setIdMustKeepAFluentInterface() + { + $builder = $this->createBuilder(); + + $this->assertSame($builder, $builder->setId('2')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setIssuedAt + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setIssuedAtMustChangeTheIatClaim() + { + $builder = $this->createBuilder(); + $builder->setIssuedAt('2'); + + $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder); + $this->assertAttributeEquals(['iat' => $this->defaultClaim], 'claims', $builder); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setIssuedAt + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setIssuedAtCanReplicateItemOnHeader() + { + $builder = $this->createBuilder(); + $builder->setIssuedAt('2', true); + + $this->assertAttributeEquals(['iat' => $this->defaultClaim], 'claims', $builder); + + $this->assertAttributeEquals( + ['alg' => 'none', 'typ' => 'JWT', 'iat' => $this->defaultClaim], + 'headers', + $builder + ); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setIssuedAt + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setIssuedAtMustKeepAFluentInterface() + { + $builder = $this->createBuilder(); + + $this->assertSame($builder, $builder->setIssuedAt('2')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setIssuer + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setIssuerMustChangeTheIssClaim() + { + $builder = $this->createBuilder(); + $builder->setIssuer('2'); + + $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder); + $this->assertAttributeEquals(['iss' => $this->defaultClaim], 'claims', $builder); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setIssuer + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setIssuerCanReplicateItemOnHeader() + { + $builder = $this->createBuilder(); + $builder->setIssuer('2', true); + + $this->assertAttributeEquals(['iss' => $this->defaultClaim], 'claims', $builder); + + $this->assertAttributeEquals( + ['alg' => 'none', 'typ' => 'JWT', 'iss' => $this->defaultClaim], + 'headers', + $builder + ); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setIssuer + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setIssuerMustKeepAFluentInterface() + { + $builder = $this->createBuilder(); + + $this->assertSame($builder, $builder->setIssuer('2')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setNotBefore + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setNotBeforeMustChangeTheNbfClaim() + { + $builder = $this->createBuilder(); + $builder->setNotBefore('2'); + + $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder); + $this->assertAttributeEquals(['nbf' => $this->defaultClaim], 'claims', $builder); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setNotBefore + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setNotBeforeCanReplicateItemOnHeader() + { + $builder = $this->createBuilder(); + $builder->setNotBefore('2', true); + + $this->assertAttributeEquals(['nbf' => $this->defaultClaim], 'claims', $builder); + + $this->assertAttributeEquals( + ['alg' => 'none', 'typ' => 'JWT', 'nbf' => $this->defaultClaim], + 'headers', + $builder + ); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setNotBefore + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setNotBeforeMustKeepAFluentInterface() + { + $builder = $this->createBuilder(); + + $this->assertSame($builder, $builder->setNotBefore('2')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setSubject + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setSubjectMustChangeTheSubClaim() + { + $builder = $this->createBuilder(); + $builder->setSubject('2'); + + $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder); + $this->assertAttributeEquals(['sub' => $this->defaultClaim], 'claims', $builder); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setSubject + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setSubjectCanReplicateItemOnHeader() + { + $builder = $this->createBuilder(); + $builder->setSubject('2', true); + + $this->assertAttributeEquals(['sub' => $this->defaultClaim], 'claims', $builder); + + $this->assertAttributeEquals( + ['alg' => 'none', 'typ' => 'JWT', 'sub' => $this->defaultClaim], + 'headers', + $builder + ); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * + * @covers Lcobucci\JWT\Builder::setSubject + * @covers Lcobucci\JWT\Builder::setRegisteredClaim + */ + public function setSubjectMustKeepAFluentInterface() + { + $builder = $this->createBuilder(); + + $this->assertSame($builder, $builder->setSubject('2')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * + * @covers Lcobucci\JWT\Builder::set + */ + public function setMustConfigureTheGivenClaim() + { + $builder = $this->createBuilder(); + $builder->set('userId', 2); + + $this->assertAttributeEquals(['userId' => $this->defaultClaim], 'claims', $builder); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * + * @covers Lcobucci\JWT\Builder::set + */ + public function setMustKeepAFluentInterface() + { + $builder = $this->createBuilder(); + + $this->assertSame($builder, $builder->set('userId', 2)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * + * @covers Lcobucci\JWT\Builder::setHeader + */ + public function setHeaderMustConfigureTheGivenClaim() + { + $builder = $this->createBuilder(); + $builder->setHeader('userId', 2); + + $this->assertAttributeEquals( + ['alg' => 'none', 'typ' => 'JWT', 'userId' => $this->defaultClaim], + 'headers', + $builder + ); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * + * @covers Lcobucci\JWT\Builder::setHeader + */ + public function setHeaderMustKeepAFluentInterface() + { + $builder = $this->createBuilder(); + + $this->assertSame($builder, $builder->setHeader('userId', 2)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::getToken + * @uses Lcobucci\JWT\Token + * + * @covers Lcobucci\JWT\Builder::sign + */ + public function signMustChangeTheSignature() + { + $signer = $this->getMock(Signer::class); + $signature = $this->getMock(Signature::class, [], [], '', false); + + $signer->expects($this->any()) + ->method('sign') + ->willReturn($signature); + + $builder = $this->createBuilder(); + $builder->sign($signer, 'test'); + + $this->assertAttributeSame($signature, 'signature', $builder); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::getToken + * @uses Lcobucci\JWT\Token + * + * @covers Lcobucci\JWT\Builder::sign + */ + public function signMustKeepAFluentInterface() + { + $signer = $this->getMock(Signer::class); + $signature = $this->getMock(Signature::class, [], [], '', false); + + $signer->expects($this->any()) + ->method('sign') + ->willReturn($signature); + + $builder = $this->createBuilder(); + + $this->assertSame($builder, $builder->sign($signer, 'test')); + + return $builder; + } + + /** + * @test + * + * @depends signMustKeepAFluentInterface + * + * @covers Lcobucci\JWT\Builder::unsign + */ + public function unsignMustRemoveTheSignature(Builder $builder) + { + $builder->unsign(); + + $this->assertAttributeSame(null, 'signature', $builder); + } + + /** + * @test + * + * @depends signMustKeepAFluentInterface + * + * @covers Lcobucci\JWT\Builder::unsign + */ + public function unsignMustKeepAFluentInterface(Builder $builder) + { + $this->assertSame($builder, $builder->unsign()); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::sign + * @uses Lcobucci\JWT\Builder::getToken + * @uses Lcobucci\JWT\Token + * + * @covers Lcobucci\JWT\Builder::set + * + * @expectedException BadMethodCallException + */ + public function setMustRaiseExceptionWhenTokenHasBeenSigned() + { + $signer = $this->getMock(Signer::class); + $signature = $this->getMock(Signature::class, [], [], '', false); + + $signer->expects($this->any()) + ->method('sign') + ->willReturn($signature); + + $builder = $this->createBuilder(); + $builder->sign($signer, 'test'); + $builder->set('test', 123); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::sign + * @uses Lcobucci\JWT\Builder::getToken + * @uses Lcobucci\JWT\Token + * + * @covers Lcobucci\JWT\Builder::setHeader + * + * @expectedException BadMethodCallException + */ + public function setHeaderMustRaiseExceptionWhenTokenHasBeenSigned() + { + $signer = $this->getMock(Signer::class); + $signature = $this->getMock(Signature::class, [], [], '', false); + + $signer->expects($this->any()) + ->method('sign') + ->willReturn($signature); + + $builder = $this->createBuilder(); + $builder->sign($signer, 'test'); + $builder->setHeader('test', 123); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Builder::__construct + * @uses Lcobucci\JWT\Builder::set + * @uses Lcobucci\JWT\Token + * + * @covers Lcobucci\JWT\Builder::getToken + */ + public function getTokenMustReturnANewTokenWithCurrentConfiguration() + { + $signature = $this->getMock(Signature::class, [], [], '', false); + + $this->encoder->expects($this->exactly(2)) + ->method('jsonEncode') + ->withConsecutive([['typ'=> 'JWT', 'alg' => 'none']], [['test' => $this->defaultClaim]]) + ->willReturnOnConsecutiveCalls('1', '2'); + + $this->encoder->expects($this->exactly(3)) + ->method('base64UrlEncode') + ->withConsecutive(['1'], ['2'], [$signature]) + ->willReturnOnConsecutiveCalls('1', '2', '3'); + + $builder = $this->createBuilder()->set('test', 123); + + $builderSign = new \ReflectionProperty($builder, 'signature'); + $builderSign->setAccessible(true); + $builderSign->setValue($builder, $signature); + + $token = $builder->getToken(); + + $tokenSign = new \ReflectionProperty($token, 'signature'); + $tokenSign->setAccessible(true); + + $this->assertAttributeEquals(['1', '2', '3'], 'payload', $token); + $this->assertAttributeEquals($token->getHeaders(), 'headers', $builder); + $this->assertAttributeEquals($token->getClaims(), 'claims', $builder); + $this->assertAttributeSame($tokenSign->getValue($token), 'signature', $builder); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Claim/BasicTest.php b/vendor/lcobucci/jwt/test/unit/Claim/BasicTest.php new file mode 100644 index 0000000..a7b67fa --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Claim/BasicTest.php @@ -0,0 +1,84 @@ + + * @since 2.0.0 + */ +class BasicTest extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @covers Lcobucci\JWT\Claim\Basic::__construct + */ + public function constructorShouldConfigureTheAttributes() + { + $claim = new Basic('test', 1); + + $this->assertAttributeEquals('test', 'name', $claim); + $this->assertAttributeEquals(1, 'value', $claim); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Basic::__construct + * + * @covers Lcobucci\JWT\Claim\Basic::getName + */ + public function getNameShouldReturnTheClaimName() + { + $claim = new Basic('test', 1); + + $this->assertEquals('test', $claim->getName()); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Basic::__construct + * + * @covers Lcobucci\JWT\Claim\Basic::getValue + */ + public function getValueShouldReturnTheClaimValue() + { + $claim = new Basic('test', 1); + + $this->assertEquals(1, $claim->getValue()); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Basic::__construct + * + * @covers Lcobucci\JWT\Claim\Basic::jsonSerialize + */ + public function jsonSerializeShouldReturnTheClaimValue() + { + $claim = new Basic('test', 1); + + $this->assertEquals(1, $claim->jsonSerialize()); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Basic::__construct + * + * @covers Lcobucci\JWT\Claim\Basic::__toString + */ + public function toStringShouldReturnTheClaimValue() + { + $claim = new Basic('test', 1); + + $this->assertEquals('1', (string) $claim); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Claim/EqualsToTest.php b/vendor/lcobucci/jwt/test/unit/Claim/EqualsToTest.php new file mode 100644 index 0000000..ab06169 --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Claim/EqualsToTest.php @@ -0,0 +1,80 @@ + + * @since 2.0.0 + */ +class EqualsToTest extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Basic::__construct + * @uses Lcobucci\JWT\Claim\Basic::getName + * @uses Lcobucci\JWT\ValidationData::__construct + * @uses Lcobucci\JWT\ValidationData::has + * + * @covers Lcobucci\JWT\Claim\EqualsTo::validate + */ + public function validateShouldReturnTrueWhenValidationDontHaveTheClaim() + { + $claim = new EqualsTo('iss', 'test'); + + $this->assertTrue($claim->validate(new ValidationData())); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Basic::__construct + * @uses Lcobucci\JWT\Claim\Basic::getName + * @uses Lcobucci\JWT\Claim\Basic::getValue + * @uses Lcobucci\JWT\ValidationData::__construct + * @uses Lcobucci\JWT\ValidationData::setIssuer + * @uses Lcobucci\JWT\ValidationData::has + * @uses Lcobucci\JWT\ValidationData::get + * + * @covers Lcobucci\JWT\Claim\EqualsTo::validate + */ + public function validateShouldReturnTrueWhenValueIsEqualsToValidationData() + { + $claim = new EqualsTo('iss', 'test'); + + $data = new ValidationData(); + $data->setIssuer('test'); + + $this->assertTrue($claim->validate($data)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Basic::__construct + * @uses Lcobucci\JWT\Claim\Basic::getName + * @uses Lcobucci\JWT\Claim\Basic::getValue + * @uses Lcobucci\JWT\ValidationData::__construct + * @uses Lcobucci\JWT\ValidationData::setIssuer + * @uses Lcobucci\JWT\ValidationData::has + * @uses Lcobucci\JWT\ValidationData::get + * + * @covers Lcobucci\JWT\Claim\EqualsTo::validate + */ + public function validateShouldReturnFalseWhenValueIsNotEqualsToValidationData() + { + $claim = new EqualsTo('iss', 'test'); + + $data = new ValidationData(); + $data->setIssuer('test1'); + + $this->assertFalse($claim->validate($data)); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Claim/FactoryTest.php b/vendor/lcobucci/jwt/test/unit/Claim/FactoryTest.php new file mode 100644 index 0000000..e7cca2c --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Claim/FactoryTest.php @@ -0,0 +1,168 @@ + + * @since 2.0.0 + */ +class FactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @covers Lcobucci\JWT\Claim\Factory::__construct + */ + public function constructMustConfigureTheCallbacks() + { + $callback = function () { + }; + $factory = new Factory(['test' => $callback]); + + $expected = [ + 'iat' => [$factory, 'createLesserOrEqualsTo'], + 'nbf' => [$factory, 'createLesserOrEqualsTo'], + 'exp' => [$factory, 'createGreaterOrEqualsTo'], + 'iss' => [$factory, 'createEqualsTo'], + 'aud' => [$factory, 'createEqualsTo'], + 'sub' => [$factory, 'createEqualsTo'], + 'jti' => [$factory, 'createEqualsTo'], + 'test' => $callback + ]; + + $this->assertAttributeEquals($expected, 'callbacks', $factory); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Factory::__construct + * @uses Lcobucci\JWT\Claim\Basic::__construct + * + * @covers Lcobucci\JWT\Claim\Factory::create + * @covers Lcobucci\JWT\Claim\Factory::createLesserOrEqualsTo + */ + public function createShouldReturnALesserOrEqualsToClaimForIssuedAt() + { + $claim = new Factory(); + + $this->assertInstanceOf(LesserOrEqualsTo::class, $claim->create('iat', 1)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Factory::__construct + * @uses Lcobucci\JWT\Claim\Basic::__construct + * + * @covers Lcobucci\JWT\Claim\Factory::create + * @covers Lcobucci\JWT\Claim\Factory::createLesserOrEqualsTo + */ + public function createShouldReturnALesserOrEqualsToClaimForNotBefore() + { + $claim = new Factory(); + + $this->assertInstanceOf(LesserOrEqualsTo::class, $claim->create('nbf', 1)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Factory::__construct + * @uses Lcobucci\JWT\Claim\Basic::__construct + * + * @covers Lcobucci\JWT\Claim\Factory::create + * @covers Lcobucci\JWT\Claim\Factory::createGreaterOrEqualsTo + */ + public function createShouldReturnAGreaterOrEqualsToClaimForExpiration() + { + $claim = new Factory(); + + $this->assertInstanceOf(GreaterOrEqualsTo::class, $claim->create('exp', 1)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Factory::__construct + * @uses Lcobucci\JWT\Claim\Basic::__construct + * + * @covers Lcobucci\JWT\Claim\Factory::create + * @covers Lcobucci\JWT\Claim\Factory::createEqualsTo + */ + public function createShouldReturnAnEqualsToClaimForId() + { + $claim = new Factory(); + + $this->assertInstanceOf(EqualsTo::class, $claim->create('jti', 1)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Factory::__construct + * @uses Lcobucci\JWT\Claim\Basic::__construct + * + * @covers Lcobucci\JWT\Claim\Factory::create + * @covers Lcobucci\JWT\Claim\Factory::createEqualsTo + */ + public function createShouldReturnAnEqualsToClaimForIssuer() + { + $claim = new Factory(); + + $this->assertInstanceOf(EqualsTo::class, $claim->create('iss', 1)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Factory::__construct + * @uses Lcobucci\JWT\Claim\Basic::__construct + * + * @covers Lcobucci\JWT\Claim\Factory::create + * @covers Lcobucci\JWT\Claim\Factory::createEqualsTo + */ + public function createShouldReturnAnEqualsToClaimForAudience() + { + $claim = new Factory(); + + $this->assertInstanceOf(EqualsTo::class, $claim->create('aud', 1)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Factory::__construct + * @uses Lcobucci\JWT\Claim\Basic::__construct + * + * @covers Lcobucci\JWT\Claim\Factory::create + * @covers Lcobucci\JWT\Claim\Factory::createEqualsTo + */ + public function createShouldReturnAnEqualsToClaimForSubject() + { + $claim = new Factory(); + + $this->assertInstanceOf(EqualsTo::class, $claim->create('sub', 1)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Factory::__construct + * @uses Lcobucci\JWT\Claim\Basic::__construct + * + * @covers Lcobucci\JWT\Claim\Factory::create + * @covers Lcobucci\JWT\Claim\Factory::createBasic + */ + public function createShouldReturnABasiclaimForOtherClaims() + { + $claim = new Factory(); + + $this->assertInstanceOf(Basic::class, $claim->create('test', 1)); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Claim/GreaterOrEqualsToTest.php b/vendor/lcobucci/jwt/test/unit/Claim/GreaterOrEqualsToTest.php new file mode 100644 index 0000000..83d94bd --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Claim/GreaterOrEqualsToTest.php @@ -0,0 +1,103 @@ + + * @since 2.0.0 + */ +class GreaterOrEqualsToTest extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Basic::__construct + * @uses Lcobucci\JWT\Claim\Basic::getName + * @uses Lcobucci\JWT\ValidationData::__construct + * @uses Lcobucci\JWT\ValidationData::has + * + * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo::validate + */ + public function validateShouldReturnTrueWhenValidationDontHaveTheClaim() + { + $claim = new GreaterOrEqualsTo('iss', 10); + + $this->assertTrue($claim->validate(new ValidationData())); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Basic::__construct + * @uses Lcobucci\JWT\Claim\Basic::getName + * @uses Lcobucci\JWT\Claim\Basic::getValue + * @uses Lcobucci\JWT\ValidationData::__construct + * @uses Lcobucci\JWT\ValidationData::setIssuer + * @uses Lcobucci\JWT\ValidationData::has + * @uses Lcobucci\JWT\ValidationData::get + * + * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo::validate + */ + public function validateShouldReturnTrueWhenValueIsGreaterThanValidationData() + { + $claim = new GreaterOrEqualsTo('iss', 11); + + $data = new ValidationData(); + $data->setIssuer(10); + + $this->assertTrue($claim->validate($data)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Basic::__construct + * @uses Lcobucci\JWT\Claim\Basic::getName + * @uses Lcobucci\JWT\Claim\Basic::getValue + * @uses Lcobucci\JWT\ValidationData::__construct + * @uses Lcobucci\JWT\ValidationData::setIssuer + * @uses Lcobucci\JWT\ValidationData::has + * @uses Lcobucci\JWT\ValidationData::get + * + * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo::validate + */ + public function validateShouldReturnTrueWhenValueIsEqualsToValidationData() + { + $claim = new GreaterOrEqualsTo('iss', 10); + + $data = new ValidationData(); + $data->setIssuer(10); + + $this->assertTrue($claim->validate($data)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Basic::__construct + * @uses Lcobucci\JWT\Claim\Basic::getName + * @uses Lcobucci\JWT\Claim\Basic::getValue + * @uses Lcobucci\JWT\ValidationData::__construct + * @uses Lcobucci\JWT\ValidationData::setIssuer + * @uses Lcobucci\JWT\ValidationData::has + * @uses Lcobucci\JWT\ValidationData::get + * + * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo::validate + */ + public function validateShouldReturnFalseWhenValueIsLesserThanValidationData() + { + $claim = new GreaterOrEqualsTo('iss', 10); + + $data = new ValidationData(); + $data->setIssuer(11); + + $this->assertFalse($claim->validate($data)); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Claim/LesserOrEqualsToTest.php b/vendor/lcobucci/jwt/test/unit/Claim/LesserOrEqualsToTest.php new file mode 100644 index 0000000..fc4e0ed --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Claim/LesserOrEqualsToTest.php @@ -0,0 +1,103 @@ + + * @since 2.0.0 + */ +class LesserOrEqualsToTest extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Basic::__construct + * @uses Lcobucci\JWT\Claim\Basic::getName + * @uses Lcobucci\JWT\ValidationData::__construct + * @uses Lcobucci\JWT\ValidationData::has + * + * @covers Lcobucci\JWT\Claim\LesserOrEqualsTo::validate + */ + public function validateShouldReturnTrueWhenValidationDontHaveTheClaim() + { + $claim = new LesserOrEqualsTo('iss', 10); + + $this->assertTrue($claim->validate(new ValidationData())); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Basic::__construct + * @uses Lcobucci\JWT\Claim\Basic::getName + * @uses Lcobucci\JWT\Claim\Basic::getValue + * @uses Lcobucci\JWT\ValidationData::__construct + * @uses Lcobucci\JWT\ValidationData::setIssuer + * @uses Lcobucci\JWT\ValidationData::has + * @uses Lcobucci\JWT\ValidationData::get + * + * @covers Lcobucci\JWT\Claim\LesserOrEqualsTo::validate + */ + public function validateShouldReturnTrueWhenValueIsLesserThanValidationData() + { + $claim = new LesserOrEqualsTo('iss', 10); + + $data = new ValidationData(); + $data->setIssuer(11); + + $this->assertTrue($claim->validate($data)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Basic::__construct + * @uses Lcobucci\JWT\Claim\Basic::getName + * @uses Lcobucci\JWT\Claim\Basic::getValue + * @uses Lcobucci\JWT\ValidationData::__construct + * @uses Lcobucci\JWT\ValidationData::setIssuer + * @uses Lcobucci\JWT\ValidationData::has + * @uses Lcobucci\JWT\ValidationData::get + * + * @covers Lcobucci\JWT\Claim\LesserOrEqualsTo::validate + */ + public function validateShouldReturnTrueWhenValueIsEqualsToValidationData() + { + $claim = new LesserOrEqualsTo('iss', 10); + + $data = new ValidationData(); + $data->setIssuer(10); + + $this->assertTrue($claim->validate($data)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Claim\Basic::__construct + * @uses Lcobucci\JWT\Claim\Basic::getName + * @uses Lcobucci\JWT\Claim\Basic::getValue + * @uses Lcobucci\JWT\ValidationData::__construct + * @uses Lcobucci\JWT\ValidationData::setIssuer + * @uses Lcobucci\JWT\ValidationData::has + * @uses Lcobucci\JWT\ValidationData::get + * + * @covers Lcobucci\JWT\Claim\LesserOrEqualsTo::validate + */ + public function validateShouldReturnFalseWhenValueIsGreaterThanValidationData() + { + $claim = new LesserOrEqualsTo('iss', 11); + + $data = new ValidationData(); + $data->setIssuer(10); + + $this->assertFalse($claim->validate($data)); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/ParserTest.php b/vendor/lcobucci/jwt/test/unit/ParserTest.php new file mode 100644 index 0000000..6a07f05 --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/ParserTest.php @@ -0,0 +1,244 @@ + + * @since 0.1.0 + */ +class ParserTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Decoder|\PHPUnit_Framework_MockObject_MockObject + */ + protected $decoder; + + /** + * @var ClaimFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $claimFactory; + + /** + * @var Claim|\PHPUnit_Framework_MockObject_MockObject + */ + protected $defaultClaim; + + /** + * {@inheritdoc} + */ + protected function setUp() + { + $this->decoder = $this->getMock(Decoder::class); + $this->claimFactory = $this->getMock(ClaimFactory::class, [], [], '', false); + $this->defaultClaim = $this->getMock(Claim::class); + + $this->claimFactory->expects($this->any()) + ->method('create') + ->willReturn($this->defaultClaim); + } + + /** + * @return Parser + */ + private function createParser() + { + return new Parser($this->decoder, $this->claimFactory); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Parser::__construct + */ + public function constructMustConfigureTheAttributes() + { + $parser = $this->createParser(); + + $this->assertAttributeSame($this->decoder, 'decoder', $parser); + $this->assertAttributeSame($this->claimFactory, 'claimFactory', $parser); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Parser::__construct + * + * @covers Lcobucci\JWT\Parser::parse + * @covers Lcobucci\JWT\Parser::splitJwt + * + * @expectedException InvalidArgumentException + */ + public function parseMustRaiseExceptionWhenJWSIsNotAString() + { + $parser = $this->createParser(); + $parser->parse(['asdasd']); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Parser::__construct + * + * @covers Lcobucci\JWT\Parser::parse + * @covers Lcobucci\JWT\Parser::splitJwt + * + * @expectedException InvalidArgumentException + */ + public function parseMustRaiseExceptionWhenJWSDontHaveThreeParts() + { + $parser = $this->createParser(); + $parser->parse(''); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Parser::__construct + * + * @covers Lcobucci\JWT\Parser::parse + * @covers Lcobucci\JWT\Parser::splitJwt + * @covers Lcobucci\JWT\Parser::parseHeader + * + * @expectedException RuntimeException + */ + public function parseMustRaiseExceptionWhenHeaderCannotBeDecoded() + { + $this->decoder->expects($this->any()) + ->method('jsonDecode') + ->willThrowException(new RuntimeException()); + + $parser = $this->createParser(); + $parser->parse('asdfad.asdfasdf.'); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Parser::__construct + * + * @covers Lcobucci\JWT\Parser::parse + * @covers Lcobucci\JWT\Parser::splitJwt + * @covers Lcobucci\JWT\Parser::parseHeader + * + * @expectedException InvalidArgumentException + */ + public function parseMustRaiseExceptionWhenHeaderIsFromAnEncryptedToken() + { + $this->decoder->expects($this->any()) + ->method('jsonDecode') + ->willReturn(['enc' => 'AAA']); + + $parser = $this->createParser(); + $parser->parse('a.a.'); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Parser::__construct + * @uses Lcobucci\JWT\Token::__construct + * + * @covers Lcobucci\JWT\Parser::parse + * @covers Lcobucci\JWT\Parser::splitJwt + * @covers Lcobucci\JWT\Parser::parseHeader + * @covers Lcobucci\JWT\Parser::parseClaims + * @covers Lcobucci\JWT\Parser::parseSignature + * + */ + public function parseMustReturnANonSignedTokenWhenSignatureIsNotInformed() + { + $this->decoder->expects($this->at(1)) + ->method('jsonDecode') + ->willReturn(['typ' => 'JWT', 'alg' => 'none']); + + $this->decoder->expects($this->at(3)) + ->method('jsonDecode') + ->willReturn(['aud' => 'test']); + + $parser = $this->createParser(); + $token = $parser->parse('a.a.'); + + $this->assertAttributeEquals(['typ' => 'JWT', 'alg' => 'none'], 'headers', $token); + $this->assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $token); + $this->assertAttributeEquals(null, 'signature', $token); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Parser::__construct + * @uses Lcobucci\JWT\Token::__construct + * + * @covers Lcobucci\JWT\Parser::parse + * @covers Lcobucci\JWT\Parser::splitJwt + * @covers Lcobucci\JWT\Parser::parseHeader + * @covers Lcobucci\JWT\Parser::parseClaims + * @covers Lcobucci\JWT\Parser::parseSignature + */ + public function parseShouldReplicateClaimValueOnHeaderWhenNeeded() + { + $this->decoder->expects($this->at(1)) + ->method('jsonDecode') + ->willReturn(['typ' => 'JWT', 'alg' => 'none', 'aud' => 'test']); + + $this->decoder->expects($this->at(3)) + ->method('jsonDecode') + ->willReturn(['aud' => 'test']); + + $parser = $this->createParser(); + $token = $parser->parse('a.a.'); + + $this->assertAttributeEquals( + ['typ' => 'JWT', 'alg' => 'none', 'aud' => $this->defaultClaim], + 'headers', + $token + ); + + $this->assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $token); + $this->assertAttributeEquals(null, 'signature', $token); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Parser::__construct + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\Signature::__construct + * + * @covers Lcobucci\JWT\Parser::parse + * @covers Lcobucci\JWT\Parser::splitJwt + * @covers Lcobucci\JWT\Parser::parseHeader + * @covers Lcobucci\JWT\Parser::parseClaims + * @covers Lcobucci\JWT\Parser::parseSignature + */ + public function parseMustReturnASignedTokenWhenSignatureIsInformed() + { + $this->decoder->expects($this->at(1)) + ->method('jsonDecode') + ->willReturn(['typ' => 'JWT', 'alg' => 'HS256']); + + $this->decoder->expects($this->at(3)) + ->method('jsonDecode') + ->willReturn(['aud' => 'test']); + + $this->decoder->expects($this->at(4)) + ->method('base64UrlDecode') + ->willReturn('aaa'); + + $parser = $this->createParser(); + $token = $parser->parse('a.a.a'); + + $this->assertAttributeEquals(['typ' => 'JWT', 'alg' => 'HS256'], 'headers', $token); + $this->assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $token); + $this->assertAttributeEquals(new Signature('aaa'), 'signature', $token); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Parsing/DecoderTest.php b/vendor/lcobucci/jwt/test/unit/Parsing/DecoderTest.php new file mode 100644 index 0000000..51d727b --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Parsing/DecoderTest.php @@ -0,0 +1,56 @@ + + * @since 0.1.0 + */ +class DecoderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @covers Lcobucci\JWT\Parsing\Decoder::jsonDecode + */ + public function jsonDecodeMustReturnTheDecodedData() + { + $decoder = new Decoder(); + + $this->assertEquals( + (object) ['test' => 'test'], + $decoder->jsonDecode('{"test":"test"}') + ); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Parsing\Decoder::jsonDecode + * + * @expectedException \RuntimeException + */ + public function jsonDecodeMustRaiseExceptionWhenAnErrorHasOccured() + { + $decoder = new Decoder(); + $decoder->jsonDecode('{"test":\'test\'}'); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Parsing\Decoder::base64UrlDecode + */ + public function base64UrlDecodeMustReturnTheRightData() + { + $data = base64_decode('0MB2wKB+L3yvIdzeggmJ+5WOSLaRLTUPXbpzqUe0yuo='); + + $decoder = new Decoder(); + $this->assertEquals($data, $decoder->base64UrlDecode('0MB2wKB-L3yvIdzeggmJ-5WOSLaRLTUPXbpzqUe0yuo')); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Parsing/EncoderTest.php b/vendor/lcobucci/jwt/test/unit/Parsing/EncoderTest.php new file mode 100644 index 0000000..6628b24 --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Parsing/EncoderTest.php @@ -0,0 +1,53 @@ + + * @since 0.1.0 + */ +class EncoderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @covers Lcobucci\JWT\Parsing\Encoder::jsonEncode + */ + public function jsonEncodeMustReturnAJSONString() + { + $encoder = new Encoder(); + + $this->assertEquals('{"test":"test"}', $encoder->jsonEncode(['test' => 'test'])); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Parsing\Encoder::jsonEncode + * + * @expectedException \RuntimeException + */ + public function jsonEncodeMustRaiseExceptionWhenAnErrorHasOccured() + { + $encoder = new Encoder(); + $encoder->jsonEncode("\xB1\x31"); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Parsing\Encoder::base64UrlEncode + */ + public function base64UrlEncodeMustReturnAnUrlSafeBase64() + { + $data = base64_decode('0MB2wKB+L3yvIdzeggmJ+5WOSLaRLTUPXbpzqUe0yuo='); + + $encoder = new Encoder(); + $this->assertEquals('0MB2wKB-L3yvIdzeggmJ-5WOSLaRLTUPXbpzqUe0yuo', $encoder->base64UrlEncode($data)); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/SignatureTest.php b/vendor/lcobucci/jwt/test/unit/SignatureTest.php new file mode 100644 index 0000000..c29787e --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/SignatureTest.php @@ -0,0 +1,73 @@ + + * @since 0.1.0 + */ +class SignatureTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Signer|\PHPUnit_Framework_MockObject_MockObject + */ + protected $signer; + + /** + * {@inheritdoc} + */ + protected function setUp() + { + $this->signer = $this->getMock(Signer::class); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Signature::__construct + */ + public function constructorMustConfigureAttributes() + { + $signature = new Signature('test'); + + $this->assertAttributeEquals('test', 'hash', $signature); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signature::__construct + * + * @covers Lcobucci\JWT\Signature::__toString + */ + public function toStringMustReturnTheHash() + { + $signature = new Signature('test'); + + $this->assertEquals('test', (string) $signature); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signature::__construct + * @uses Lcobucci\JWT\Signature::__toString + * + * @covers Lcobucci\JWT\Signature::verify + */ + public function verifyMustReturnWhatSignerSays() + { + $this->signer->expects($this->any()) + ->method('verify') + ->willReturn(true); + + $signature = new Signature('test'); + + $this->assertTrue($signature->verify($this->signer, 'one', 'key')); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Signer/BaseSignerTest.php b/vendor/lcobucci/jwt/test/unit/Signer/BaseSignerTest.php new file mode 100644 index 0000000..cede77a --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Signer/BaseSignerTest.php @@ -0,0 +1,128 @@ + + * @since 0.1.0 + */ +class BaseSignerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var BaseSigner|\PHPUnit_Framework_MockObject_MockObject + */ + protected $signer; + + /** + * {@inheritdoc} + */ + protected function setUp() + { + $this->signer = $this->getMockForAbstractClass(BaseSigner::class); + + $this->signer->method('getAlgorithmId') + ->willReturn('TEST123'); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Signer\BaseSigner::modifyHeader + */ + public function modifyHeaderShouldChangeAlgorithm() + { + $headers = ['typ' => 'JWT']; + + $this->signer->modifyHeader($headers); + + $this->assertEquals($headers['typ'], 'JWT'); + $this->assertEquals($headers['alg'], 'TEST123'); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signature::__construct + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\BaseSigner::sign + * @covers Lcobucci\JWT\Signer\BaseSigner::getKey + */ + public function signMustReturnANewSignature() + { + $key = new Key('123'); + + $this->signer->expects($this->once()) + ->method('createHash') + ->with('test', $key) + ->willReturn('test'); + + $this->assertEquals(new Signature('test'), $this->signer->sign('test', $key)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signature::__construct + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\BaseSigner::sign + * @covers Lcobucci\JWT\Signer\BaseSigner::getKey + */ + public function signShouldConvertKeyWhenItsNotAnObject() + { + $this->signer->expects($this->once()) + ->method('createHash') + ->with('test', new Key('123')) + ->willReturn('test'); + + $this->assertEquals(new Signature('test'), $this->signer->sign('test', '123')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signature::__construct + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\BaseSigner::verify + * @covers Lcobucci\JWT\Signer\BaseSigner::getKey + */ + public function verifyShouldDelegateTheCallToAbstractMethod() + { + $key = new Key('123'); + + $this->signer->expects($this->once()) + ->method('doVerify') + ->with('test', 'test', $key) + ->willReturn(true); + + $this->assertTrue($this->signer->verify('test', 'test', $key)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signature::__construct + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\BaseSigner::verify + * @covers Lcobucci\JWT\Signer\BaseSigner::getKey + */ + public function verifyShouldConvertKeyWhenItsNotAnObject() + { + $this->signer->expects($this->once()) + ->method('doVerify') + ->with('test', 'test', new Key('123')) + ->willReturn(true); + + $this->assertTrue($this->signer->verify('test', 'test', '123')); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/KeyParserTest.php b/vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/KeyParserTest.php new file mode 100644 index 0000000..2b01c19 --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/KeyParserTest.php @@ -0,0 +1,178 @@ + + * @since 3.0.4 + */ +class KeyParserTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var MathAdapterInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $adapter; + + /** + * @var PrivateKeySerializerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $privateKeySerializer; + + /** + * @var PublicKeySerializerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $publicKeySerializer; + + /** + * @before + */ + public function createDependencies() + { + $this->adapter = $this->getMock(MathAdapterInterface::class); + $this->privateKeySerializer = $this->getMock(PrivateKeySerializerInterface::class); + $this->publicKeySerializer = $this->getMock(PublicKeySerializerInterface::class); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct + */ + public function constructShouldConfigureDependencies() + { + $parser = new KeyParser($this->adapter, $this->privateKeySerializer, $this->publicKeySerializer); + + $this->assertAttributeSame($this->privateKeySerializer, 'privateKeySerializer', $parser); + $this->assertAttributeSame($this->publicKeySerializer, 'publicKeySerializer', $parser); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getPrivateKey + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getKeyContent + */ + public function getPrivateKeyShouldAskSerializerToParseTheKey() + { + $privateKey = $this->getMock(PrivateKeyInterface::class); + + $keyContent = 'MHcCAQEEIBGpMoZJ64MMSzuo5JbmXpf9V4qSWdLIl/8RmJLcfn/qoAoGC' + . 'CqGSM49AwEHoUQDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpnd0wxa2iF' + . 'ruiI2tsEdGFTLTsyU+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg=='; + + $this->privateKeySerializer->expects($this->once()) + ->method('parse') + ->with($keyContent) + ->willReturn($privateKey); + + $parser = new KeyParser($this->adapter, $this->privateKeySerializer, $this->publicKeySerializer); + $this->assertSame($privateKey, $parser->getPrivateKey($this->getPrivateKey())); + } + + /** + * @test + * + * @expectedException \InvalidArgumentException + * + * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getPrivateKey + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getKeyContent + */ + public function getPrivateKeyShouldRaiseExceptionWhenAWrongKeyWasGiven() + { + $this->privateKeySerializer->expects($this->never()) + ->method('parse'); + + $parser = new KeyParser($this->adapter, $this->privateKeySerializer, $this->publicKeySerializer); + $parser->getPrivateKey($this->getPublicKey()); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getPublicKey + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getKeyContent + */ + public function getPublicKeyShouldAskSerializerToParseTheKey() + { + $publicKey = $this->getMock(PublicKeyInterface::class); + + $keyContent = 'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpn' + . 'd0wxa2iFruiI2tsEdGFTLTsyU+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg=='; + + $this->publicKeySerializer->expects($this->once()) + ->method('parse') + ->with($keyContent) + ->willReturn($publicKey); + + $parser = new KeyParser($this->adapter, $this->privateKeySerializer, $this->publicKeySerializer); + $this->assertSame($publicKey, $parser->getPublicKey($this->getPublicKey())); + } + + /** + * @test + * + * @expectedException \InvalidArgumentException + * + * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getPublicKey + * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getKeyContent + */ + public function getPublicKeyShouldRaiseExceptionWhenAWrongKeyWasGiven() + { + $this->publicKeySerializer->expects($this->never()) + ->method('parse'); + + $parser = new KeyParser($this->adapter, $this->privateKeySerializer, $this->publicKeySerializer); + $parser->getPublicKey($this->getPrivateKey()); + } + + /** + * @return Key + */ + private function getPrivateKey() + { + return new Key( + "-----BEGIN EC PRIVATE KEY-----\n" + . "MHcCAQEEIBGpMoZJ64MMSzuo5JbmXpf9V4qSWdLIl/8RmJLcfn/qoAoGCCqGSM49\n" + . "AwEHoUQDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpnd0wxa2iFruiI2tsEdGFTLTsy\n" + . "U+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg==\n" + . "-----END EC PRIVATE KEY-----" + ); + } + + /** + * @return Key + */ + private function getPublicKey() + { + return new Key( + "-----BEGIN PUBLIC KEY-----\n" + . "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpn\n" + . "d0wxa2iFruiI2tsEdGFTLTsyU+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg==\n" + . "-----END PUBLIC KEY-----" + ); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha256Test.php b/vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha256Test.php new file mode 100644 index 0000000..a184920 --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha256Test.php @@ -0,0 +1,60 @@ + + * @since 2.1.0 + */ +class Sha256Test extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Ecdsa + * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser + * + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256::getAlgorithmId + */ + public function getAlgorithmIdMustBeCorrect() + { + $signer = new Sha256(); + + $this->assertEquals('ES256', $signer->getAlgorithmId()); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Ecdsa + * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser + * + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256::getAlgorithm + */ + public function getAlgorithmMustBeCorrect() + { + $signer = new Sha256(); + + $this->assertEquals('sha256', $signer->getAlgorithm()); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Ecdsa + * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser + * + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256::getSignatureLength + */ + public function getSignatureLengthMustBeCorrect() + { + $signer = new Sha256(); + + $this->assertEquals(64, $signer->getSignatureLength()); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha384Test.php b/vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha384Test.php new file mode 100644 index 0000000..b14b057 --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha384Test.php @@ -0,0 +1,60 @@ + + * @since 2.1.0 + */ +class Sha384Test extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Ecdsa + * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser + * + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha384::getAlgorithmId + */ + public function getAlgorithmIdMustBeCorrect() + { + $signer = new Sha384(); + + $this->assertEquals('ES384', $signer->getAlgorithmId()); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Ecdsa + * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser + * + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha384::getAlgorithm + */ + public function getAlgorithmMustBeCorrect() + { + $signer = new Sha384(); + + $this->assertEquals('sha384', $signer->getAlgorithm()); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Ecdsa + * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser + * + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha384::getSignatureLength + */ + public function getSignatureLengthMustBeCorrect() + { + $signer = new Sha384(); + + $this->assertEquals(96, $signer->getSignatureLength()); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha512Test.php b/vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha512Test.php new file mode 100644 index 0000000..88a66ee --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha512Test.php @@ -0,0 +1,60 @@ + + * @since 2.1.0 + */ +class Sha512Test extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Ecdsa + * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser + * + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha512::getAlgorithmId + */ + public function getAlgorithmIdMustBeCorrect() + { + $signer = new Sha512(); + + $this->assertEquals('ES512', $signer->getAlgorithmId()); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Ecdsa + * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser + * + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha512::getAlgorithm + */ + public function getAlgorithmMustBeCorrect() + { + $signer = new Sha512(); + + $this->assertEquals('sha512', $signer->getAlgorithm()); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Ecdsa + * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser + * + * @covers Lcobucci\JWT\Signer\Ecdsa\Sha512::getSignatureLength + */ + public function getSignatureLengthMustBeCorrect() + { + $signer = new Sha512(); + + $this->assertEquals(132, $signer->getSignatureLength()); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Signer/EcdsaTest.php b/vendor/lcobucci/jwt/test/unit/Signer/EcdsaTest.php new file mode 100644 index 0000000..79d8ca6 --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Signer/EcdsaTest.php @@ -0,0 +1,173 @@ + + * @since 2.1.0 + */ +class EcdsaTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Adapter|\PHPUnit_Framework_MockObject_MockObject + */ + private $adapter; + + /** + * @var Signer|\PHPUnit_Framework_MockObject_MockObject + */ + private $signer; + + /** + * @var RandomNumberGeneratorInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $randomGenerator; + + /** + * @var KeyParser|\PHPUnit_Framework_MockObject_MockObject + */ + private $parser; + + /** + * @before + */ + public function createDependencies() + { + $this->adapter = $this->getMock(Adapter::class); + $this->signer = $this->getMock(Signer::class, [], [$this->adapter]); + $this->randomGenerator = $this->getMock(RandomNumberGeneratorInterface::class); + $this->parser = $this->getMock(KeyParser::class, [], [], '', false); + } + + /** + * @return Ecdsa + */ + private function getSigner() + { + $signer = $this->getMockForAbstractClass( + Ecdsa::class, + [$this->adapter, $this->signer, $this->parser] + ); + + $signer->method('getSignatureLength') + ->willReturn(64); + + $signer->method('getAlgorithm') + ->willReturn('sha256'); + + $signer->method('getAlgorithmId') + ->willReturn('ES256'); + + return $signer; + } + + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Ecdsa::__construct + */ + public function constructShouldConfigureDependencies() + { + $signer = $this->getSigner(); + + $this->assertAttributeSame($this->adapter, 'adapter', $signer); + $this->assertAttributeSame($this->signer, 'signer', $signer); + $this->assertAttributeSame($this->parser, 'parser', $signer); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Ecdsa::__construct + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\Ecdsa::createHash + * @covers Lcobucci\JWT\Signer\Ecdsa::createSigningHash + * @covers Lcobucci\JWT\Signer\Ecdsa::createSignatureHash + */ + public function createHashShouldReturnAHashUsingPrivateKey() + { + $signer = $this->getSigner(); + $key = new Key('testing'); + $privateKey = $this->getMock(PrivateKeyInterface::class); + $point = $this->getMock(PointInterface::class); + + $privateKey->method('getPoint') + ->willReturn($point); + + $point->method('getOrder') + ->willReturn('1'); + + $this->parser->expects($this->once()) + ->method('getPrivateKey') + ->with($key) + ->willReturn($privateKey); + + $this->randomGenerator->expects($this->once()) + ->method('generate') + ->with('1') + ->willReturn('123'); + + $this->adapter->expects($this->once()) + ->method('hexDec') + ->willReturn('123'); + + $this->adapter->expects($this->exactly(2)) + ->method('decHex') + ->willReturn('123'); + + $this->signer->expects($this->once()) + ->method('sign') + ->with($privateKey, $this->isType('string'), $this->isType('string')) + ->willReturn(new Signature('1234', '456')); + + $this->assertInternalType('string', $signer->createHash('testing', $key, $this->randomGenerator)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Ecdsa::__construct + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\Ecdsa::doVerify + * @covers Lcobucci\JWT\Signer\Ecdsa::createSigningHash + * @covers Lcobucci\JWT\Signer\Ecdsa::extractSignature + */ + public function doVerifyShouldDelegateToEcdsaSignerUsingPublicKey() + { + $signer = $this->getSigner(); + $key = new Key('testing'); + $publicKey = $this->getMock(PublicKeyInterface::class); + + $this->parser->expects($this->once()) + ->method('getPublicKey') + ->with($key) + ->willReturn($publicKey); + + $this->adapter->expects($this->exactly(3)) + ->method('hexDec') + ->willReturn('123'); + + $this->signer->expects($this->once()) + ->method('verify') + ->with($publicKey, $this->isInstanceOf(Signature::class), $this->isType('string')) + ->willReturn(true); + + $this->assertTrue($signer->doVerify('testing', 'testing2', $key)); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha256Test.php b/vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha256Test.php new file mode 100644 index 0000000..f6db0bd --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha256Test.php @@ -0,0 +1,39 @@ + + * @since 0.1.0 + */ +class Sha256Test extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Hmac\Sha256::getAlgorithmId + */ + public function getAlgorithmIdMustBeCorrect() + { + $signer = new Sha256(); + + $this->assertEquals('HS256', $signer->getAlgorithmId()); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Hmac\Sha256::getAlgorithm + */ + public function getAlgorithmMustBeCorrect() + { + $signer = new Sha256(); + + $this->assertEquals('sha256', $signer->getAlgorithm()); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha384Test.php b/vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha384Test.php new file mode 100644 index 0000000..b4de61b --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha384Test.php @@ -0,0 +1,39 @@ + + * @since 0.1.0 + */ +class Sha384Test extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Hmac\Sha384::getAlgorithmId + */ + public function getAlgorithmIdMustBeCorrect() + { + $signer = new Sha384(); + + $this->assertEquals('HS384', $signer->getAlgorithmId()); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Hmac\Sha384::getAlgorithm + */ + public function getAlgorithmMustBeCorrect() + { + $signer = new Sha384(); + + $this->assertEquals('sha384', $signer->getAlgorithm()); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha512Test.php b/vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha512Test.php new file mode 100644 index 0000000..e6fd315 --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha512Test.php @@ -0,0 +1,39 @@ + + * @since 0.1.0 + */ +class Sha512Test extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Hmac\Sha512::getAlgorithmId + */ + public function getAlgorithmIdMustBeCorrect() + { + $signer = new Sha512(); + + $this->assertEquals('HS512', $signer->getAlgorithmId()); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Hmac\Sha512::getAlgorithm + */ + public function getAlgorithmMustBeCorrect() + { + $signer = new Sha512(); + + $this->assertEquals('sha512', $signer->getAlgorithm()); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Signer/HmacTest.php b/vendor/lcobucci/jwt/test/unit/Signer/HmacTest.php new file mode 100644 index 0000000..913e796 --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Signer/HmacTest.php @@ -0,0 +1,134 @@ + + * @since 0.1.0 + */ +class HmacTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Hmac|\PHPUnit_Framework_MockObject_MockObject + */ + protected $signer; + + /** + * {@inheritdoc} + */ + protected function setUp() + { + $this->signer = $this->getMockForAbstractClass(Hmac::class); + + $this->signer->expects($this->any()) + ->method('getAlgorithmId') + ->willReturn('TEST123'); + + $this->signer->expects($this->any()) + ->method('getAlgorithm') + ->willReturn('sha256'); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\Hmac::createHash + */ + public function createHashMustReturnAHashAccordingWithTheAlgorithm() + { + $hash = hash_hmac('sha256', 'test', '123', true); + + $this->assertEquals($hash, $this->signer->createHash('test', new Key('123'))); + + return $hash; + } + + /** + * @test + * + * @depends createHashMustReturnAHashAccordingWithTheAlgorithm + * + * @uses Lcobucci\JWT\Signer\Hmac::createHash + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\Hmac::doVerify + */ + public function doVerifyShouldReturnTrueWhenExpectedHashWasCreatedWithSameInformation($expected) + { + $this->assertTrue($this->signer->doVerify($expected, 'test', new Key('123'))); + } + + /** + * @test + * + * @depends createHashMustReturnAHashAccordingWithTheAlgorithm + * + * @uses Lcobucci\JWT\Signer\Hmac::createHash + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\Hmac::doVerify + */ + public function doVerifyShouldReturnFalseWhenExpectedHashWasNotCreatedWithSameInformation($expected) + { + $this->assertFalse($this->signer->doVerify($expected, 'test', new Key('1234'))); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\Hmac::doVerify + */ + public function doVerifyShouldReturnFalseWhenExpectedHashIsNotString() + { + $this->assertFalse($this->signer->doVerify(false, 'test', new Key('1234'))); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Hmac::hashEquals + */ + public function hashEqualsShouldReturnFalseWhenExpectedHashHasDifferentLengthThanGenerated() + { + $this->assertFalse($this->signer->hashEquals('123', '1234')); + } + + /** + * @test + * + * @depends createHashMustReturnAHashAccordingWithTheAlgorithm + * + * @uses Lcobucci\JWT\Signer\Hmac::createHash + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\Hmac::hashEquals + */ + public function hashEqualsShouldReturnFalseWhenExpectedHashIsDifferentThanGenerated($expected) + { + $this->assertFalse($this->signer->hashEquals($expected, $this->signer->createHash('test', new Key('1234')))); + } + + /** + * @test + * + * @depends createHashMustReturnAHashAccordingWithTheAlgorithm + * + * @uses Lcobucci\JWT\Signer\Hmac::createHash + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\Hmac::hashEquals + */ + public function hashEqualsShouldReturnTrueWhenExpectedHashIsEqualsThanGenerated($expected) + { + $this->assertTrue($this->signer->hashEquals($expected, $this->signer->createHash('test', new Key('123')))); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Signer/KeyTest.php b/vendor/lcobucci/jwt/test/unit/Signer/KeyTest.php new file mode 100644 index 0000000..58dd8e8 --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Signer/KeyTest.php @@ -0,0 +1,119 @@ + + * @since 3.0.4 + */ +class KeyTest extends \PHPUnit_Framework_TestCase +{ + /** + * @before + */ + public function configureRootDir() + { + vfsStream::setup( + 'root', + null, + [ + 'test.pem' => 'testing', + 'emptyFolder' => [] + ] + ); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Key::__construct + * @covers Lcobucci\JWT\Signer\Key::setContent + */ + public function constructShouldConfigureContentAndPassphrase() + { + $key = new Key('testing', 'test'); + + $this->assertAttributeEquals('testing', 'content', $key); + $this->assertAttributeEquals('test', 'passphrase', $key); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Key::__construct + * @covers Lcobucci\JWT\Signer\Key::setContent + * @covers Lcobucci\JWT\Signer\Key::readFile + */ + public function constructShouldBeAbleToConfigureContentFromFile() + { + $key = new Key('file://' . vfsStream::url('root/test.pem')); + + $this->assertAttributeEquals('testing', 'content', $key); + $this->assertAttributeEquals(null, 'passphrase', $key); + } + + /** + * @test + * + * @expectedException \InvalidArgumentException + * + * @covers Lcobucci\JWT\Signer\Key::__construct + * @covers Lcobucci\JWT\Signer\Key::setContent + * @covers Lcobucci\JWT\Signer\Key::readFile + */ + public function constructShouldRaiseExceptionWhenFileDoesNotExists() + { + new Key('file://' . vfsStream::url('root/test2.pem')); + } + + /** + * @test + * + * @expectedException \InvalidArgumentException + * + * @covers Lcobucci\JWT\Signer\Key::__construct + * @covers Lcobucci\JWT\Signer\Key::setContent + * @covers Lcobucci\JWT\Signer\Key::readFile + */ + public function constructShouldRaiseExceptionWhenFileGetContentsFailed() + { + new Key('file://' . vfsStream::url('root/emptyFolder')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Key::__construct + * @uses Lcobucci\JWT\Signer\Key::setContent + * + * @covers Lcobucci\JWT\Signer\Key::getContent + */ + public function getContentShouldReturnConfiguredData() + { + $key = new Key('testing', 'test'); + + $this->assertEquals('testing', $key->getContent()); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Key::__construct + * @uses Lcobucci\JWT\Signer\Key::setContent + * + * @covers Lcobucci\JWT\Signer\Key::getPassphrase + */ + public function getPassphraseShouldReturnConfiguredData() + { + $key = new Key('testing', 'test'); + + $this->assertEquals('test', $key->getPassphrase()); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Signer/KeychainTest.php b/vendor/lcobucci/jwt/test/unit/Signer/KeychainTest.php new file mode 100644 index 0000000..472e8e8 --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Signer/KeychainTest.php @@ -0,0 +1,49 @@ + + * @since 2.1.0 + */ +class KeychainTest extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\Keychain::getPrivateKey + */ + public function getPrivateKeyShouldReturnAKey() + { + $keychain = new Keychain(); + $key = $keychain->getPrivateKey('testing', 'test'); + + $this->assertInstanceOf(Key::class, $key); + $this->assertAttributeEquals('testing', 'content', $key); + $this->assertAttributeEquals('test', 'passphrase', $key); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Signer\Key + * + * @covers Lcobucci\JWT\Signer\Keychain::getPublicKey + */ + public function getPublicKeyShouldReturnAValidResource() + { + $keychain = new Keychain(); + $key = $keychain->getPublicKey('testing'); + + $this->assertInstanceOf(Key::class, $key); + $this->assertAttributeEquals('testing', 'content', $key); + $this->assertAttributeEquals(null, 'passphrase', $key); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha256Test.php b/vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha256Test.php new file mode 100644 index 0000000..2e4248a --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha256Test.php @@ -0,0 +1,39 @@ + + * @since 2.1.0 + */ +class Sha256Test extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Rsa\Sha256::getAlgorithmId + */ + public function getAlgorithmIdMustBeCorrect() + { + $signer = new Sha256(); + + $this->assertEquals('RS256', $signer->getAlgorithmId()); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Rsa\Sha256::getAlgorithm + */ + public function getAlgorithmMustBeCorrect() + { + $signer = new Sha256(); + + $this->assertEquals(OPENSSL_ALGO_SHA256, $signer->getAlgorithm()); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha384Test.php b/vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha384Test.php new file mode 100644 index 0000000..1863212 --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha384Test.php @@ -0,0 +1,39 @@ + + * @since 2.1.0 + */ +class Sha384Test extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Rsa\Sha384::getAlgorithmId + */ + public function getAlgorithmIdMustBeCorrect() + { + $signer = new Sha384(); + + $this->assertEquals('RS384', $signer->getAlgorithmId()); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Rsa\Sha384::getAlgorithm + */ + public function getAlgorithmMustBeCorrect() + { + $signer = new Sha384(); + + $this->assertEquals(OPENSSL_ALGO_SHA384, $signer->getAlgorithm()); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha512Test.php b/vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha512Test.php new file mode 100644 index 0000000..03e31fd --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha512Test.php @@ -0,0 +1,39 @@ + + * @since 2.1.0 + */ +class Sha512Test extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Rsa\Sha512::getAlgorithmId + */ + public function getAlgorithmIdMustBeCorrect() + { + $signer = new Sha512(); + + $this->assertEquals('RS512', $signer->getAlgorithmId()); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Signer\Rsa\Sha512::getAlgorithm + */ + public function getAlgorithmMustBeCorrect() + { + $signer = new Sha512(); + + $this->assertEquals(OPENSSL_ALGO_SHA512, $signer->getAlgorithm()); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/TokenTest.php b/vendor/lcobucci/jwt/test/unit/TokenTest.php new file mode 100644 index 0000000..d3fa01c --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/TokenTest.php @@ -0,0 +1,502 @@ + + * @since 0.1.0 + */ +class TokenTest extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @covers Lcobucci\JWT\Token::__construct + */ + public function constructMustInitializeAnEmptyPlainTextTokenWhenNoArgumentsArePassed() + { + $token = new Token(); + + $this->assertAttributeEquals(['alg' => 'none'], 'headers', $token); + $this->assertAttributeEquals([], 'claims', $token); + $this->assertAttributeEquals(null, 'signature', $token); + $this->assertAttributeEquals(['', ''], 'payload', $token); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * + * @covers Lcobucci\JWT\Token::hasHeader + */ + public function hasHeaderMustReturnTrueWhenItIsConfigured() + { + $token = new Token(['test' => 'testing']); + + $this->assertTrue($token->hasHeader('test')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * + * @covers Lcobucci\JWT\Token::hasHeader + */ + public function hasHeaderMustReturnFalseWhenItIsNotConfigured() + { + $token = new Token(['test' => 'testing']); + + $this->assertFalse($token->hasHeader('testing')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\Token::hasHeader + * + * @covers Lcobucci\JWT\Token::getHeader + * + * @expectedException \OutOfBoundsException + */ + public function getHeaderMustRaiseExceptionWhenHeaderIsNotConfigured() + { + $token = new Token(['test' => 'testing']); + + $token->getHeader('testing'); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\Token::hasHeader + * + * @covers Lcobucci\JWT\Token::getHeader + */ + public function getHeaderMustReturnTheDefaultValueWhenIsNotConfigured() + { + $token = new Token(['test' => 'testing']); + + $this->assertEquals('blah', $token->getHeader('testing', 'blah')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\Token::hasHeader + * + * @covers Lcobucci\JWT\Token::getHeader + * @covers Lcobucci\JWT\Token::getHeaderValue + */ + public function getHeaderMustReturnTheRequestedHeader() + { + $token = new Token(['test' => 'testing']); + + $this->assertEquals('testing', $token->getHeader('test')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\Token::hasHeader + * @uses Lcobucci\JWT\Claim\Basic + * + * @covers Lcobucci\JWT\Token::getHeader + * @covers Lcobucci\JWT\Token::getHeaderValue + */ + public function getHeaderMustReturnValueWhenItIsAReplicatedClaim() + { + $token = new Token(['jti' => new EqualsTo('jti', 1)]); + + $this->assertEquals(1, $token->getHeader('jti')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * + * @covers Lcobucci\JWT\Token::getHeaders + */ + public function getHeadersMustReturnTheConfiguredHeader() + { + $token = new Token(['test' => 'testing']); + + $this->assertEquals(['test' => 'testing'], $token->getHeaders()); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * + * @covers Lcobucci\JWT\Token::getClaims + */ + public function getClaimsMustReturnTheConfiguredClaims() + { + $token = new Token([], ['test' => 'testing']); + + $this->assertEquals(['test' => 'testing'], $token->getClaims()); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\Claim\Basic + * + * @covers Lcobucci\JWT\Token::hasClaim + */ + public function hasClaimMustReturnTrueWhenItIsConfigured() + { + $token = new Token([], ['test' => new Basic('test', 'testing')]); + + $this->assertTrue($token->hasClaim('test')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\Claim\Basic + * + * @covers Lcobucci\JWT\Token::hasClaim + */ + public function hasClaimMustReturnFalseWhenItIsNotConfigured() + { + $token = new Token([], ['test' => new Basic('test', 'testing')]); + + $this->assertFalse($token->hasClaim('testing')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\Token::hasClaim + * @uses Lcobucci\JWT\Claim\Basic + * + * @covers Lcobucci\JWT\Token::getClaim + */ + public function getClaimMustReturnTheDefaultValueWhenIsNotConfigured() + { + $token = new Token([], ['test' => new Basic('test', 'testing')]); + + $this->assertEquals('blah', $token->getClaim('testing', 'blah')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\Token::hasClaim + * @uses Lcobucci\JWT\Claim\Basic + * + * @covers Lcobucci\JWT\Token::getClaim + * + * @expectedException \OutOfBoundsException + */ + public function getClaimShouldRaiseExceptionWhenClaimIsNotConfigured() + { + $token = new Token(); + $token->getClaim('testing'); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\Token::hasClaim + * @uses Lcobucci\JWT\Claim\Basic + * + * @covers Lcobucci\JWT\Token::getClaim + */ + public function getClaimShouldReturnTheClaimValueWhenItExists() + { + $token = new Token([], ['testing' => new Basic('testing', 'test')]); + + $this->assertEquals('test', $token->getClaim('testing')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * + * @covers Lcobucci\JWT\Token::verify + * + * @expectedException BadMethodCallException + */ + public function verifyMustRaiseExceptionWhenTokenIsUnsigned() + { + $signer = $this->getMock(Signer::class); + + $token = new Token(); + $token->verify($signer, 'test'); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * + * @covers Lcobucci\JWT\Token::verify + * @covers Lcobucci\JWT\Token::getPayload + */ + public function verifyShouldReturnFalseWhenTokenAlgorithmIsDifferent() + { + $signer = $this->getMock(Signer::class); + $signature = $this->getMock(Signature::class, [], [], '', false); + + $signer->expects($this->any()) + ->method('getAlgorithmId') + ->willReturn('HS256'); + + $signature->expects($this->never()) + ->method('verify'); + + $token = new Token(['alg' => 'RS256'], [], $signature); + + $this->assertFalse($token->verify($signer, 'test')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * + * @covers Lcobucci\JWT\Token::verify + * @covers Lcobucci\JWT\Token::getPayload + */ + public function verifyMustDelegateTheValidationToSignature() + { + $signer = $this->getMock(Signer::class); + $signature = $this->getMock(Signature::class, [], [], '', false); + + $signer->expects($this->any()) + ->method('getAlgorithmId') + ->willReturn('HS256'); + + $signature->expects($this->once()) + ->method('verify') + ->with($signer, $this->isType('string'), 'test') + ->willReturn(true); + + $token = new Token(['alg' => 'HS256'], [], $signature); + + $this->assertTrue($token->verify($signer, 'test')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\ValidationData::__construct + * + * @covers Lcobucci\JWT\Token::validate + * @covers Lcobucci\JWT\Token::getValidatableClaims + */ + public function validateShouldReturnTrueWhenClaimsAreEmpty() + { + $token = new Token(); + + $this->assertTrue($token->validate(new ValidationData())); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\ValidationData::__construct + * @uses Lcobucci\JWT\Claim\Basic::__construct + * + * @covers Lcobucci\JWT\Token::validate + * @covers Lcobucci\JWT\Token::getValidatableClaims + */ + public function validateShouldReturnTrueWhenThereAreNoValidatableClaims() + { + $token = new Token([], ['testing' => new Basic('testing', 'test')]); + + $this->assertTrue($token->validate(new ValidationData())); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\ValidationData + * @uses Lcobucci\JWT\Claim\Basic + * @uses Lcobucci\JWT\Claim\EqualsTo + * + * @covers Lcobucci\JWT\Token::validate + * @covers Lcobucci\JWT\Token::getValidatableClaims + */ + public function validateShouldReturnFalseWhenThereIsAtLeastOneFailedValidatableClaim() + { + $token = new Token( + [], + [ + 'iss' => new EqualsTo('iss', 'test'), + 'testing' => new Basic('testing', 'test') + ] + ); + + $data = new ValidationData(); + $data->setIssuer('test1'); + + $this->assertFalse($token->validate($data)); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\ValidationData + * @uses Lcobucci\JWT\Claim\Basic + * @uses Lcobucci\JWT\Claim\EqualsTo + * @uses Lcobucci\JWT\Claim\LesserOrEqualsTo + * @uses Lcobucci\JWT\Claim\GreaterOrEqualsTo + * + * @covers Lcobucci\JWT\Token::validate + * @covers Lcobucci\JWT\Token::getValidatableClaims + */ + public function validateShouldReturnTrueWhenThereAreNoFailedValidatableClaims() + { + $now = time(); + $token = new Token( + [], + [ + 'iss' => new EqualsTo('iss', 'test'), + 'iat' => new LesserOrEqualsTo('iat', $now), + 'exp' => new GreaterOrEqualsTo('exp', $now + 500), + 'testing' => new Basic('testing', 'test') + ] + ); + + $data = new ValidationData($now + 10); + $data->setIssuer('test'); + + $this->assertTrue($token->validate($data)); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Token::isExpired + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\Token::getClaim + * @uses Lcobucci\JWT\Token::hasClaim + */ + public function isExpiredShouldReturnFalseWhenTokenDoesNotExpires() + { + $token = new Token(['alg' => 'none']); + + $this->assertFalse($token->isExpired()); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Token::isExpired + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\Token::getClaim + * @uses Lcobucci\JWT\Token::hasClaim + * @uses Lcobucci\JWT\Claim\Basic + * @uses Lcobucci\JWT\Claim\GreaterOrEqualsTo + */ + public function isExpiredShouldReturnFalseWhenTokenIsNotExpired() + { + $token = new Token( + ['alg' => 'none'], + ['exp' => new GreaterOrEqualsTo('exp', time() + 500)] + ); + + $this->assertFalse($token->isExpired()); + } + + /** + * @test + * + * @covers Lcobucci\JWT\Token::isExpired + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\Token::getClaim + * @uses Lcobucci\JWT\Token::hasClaim + * @uses Lcobucci\JWT\Claim\Basic + * @uses Lcobucci\JWT\Claim\GreaterOrEqualsTo + */ + public function isExpiredShouldReturnTrueAfterTokenExpires() + { + $token = new Token( + ['alg' => 'none'], + ['exp' => new GreaterOrEqualsTo('exp', time())] + ); + + $this->assertTrue($token->isExpired(new DateTime('+10 days'))); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * + * @covers Lcobucci\JWT\Token::getPayload + */ + public function getPayloadShouldReturnAStringWithTheTwoEncodePartsThatGeneratedTheToken() + { + $token = new Token(['alg' => 'none'], [], null, ['test1', 'test2', 'test3']); + + $this->assertEquals('test1.test2', $token->getPayload()); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\Token::getPayload + * + * @covers Lcobucci\JWT\Token::__toString + */ + public function toStringMustReturnEncodedDataWithEmptySignature() + { + $token = new Token(['alg' => 'none'], [], null, ['test', 'test']); + + $this->assertEquals('test.test.', (string) $token); + } + + /** + * @test + * + * @uses Lcobucci\JWT\Token::__construct + * @uses Lcobucci\JWT\Token::getPayload + * + * @covers Lcobucci\JWT\Token::__toString + */ + public function toStringMustReturnEncodedData() + { + $signature = $this->getMock(Signature::class, [], [], '', false); + + $token = new Token(['alg' => 'none'], [], $signature, ['test', 'test', 'test']); + + $this->assertEquals('test.test.test', (string) $token); + } +} diff --git a/vendor/lcobucci/jwt/test/unit/ValidationDataTest.php b/vendor/lcobucci/jwt/test/unit/ValidationDataTest.php new file mode 100644 index 0000000..ac61265 --- /dev/null +++ b/vendor/lcobucci/jwt/test/unit/ValidationDataTest.php @@ -0,0 +1,224 @@ + + * @since 2.0.0 + */ +class ValidationDataTest extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * + * @covers Lcobucci\JWT\ValidationData::__construct + */ + public function constructorShouldConfigureTheItems() + { + $expected = $this->createExpectedData(); + $data = new ValidationData(1); + + $this->assertAttributeSame($expected, 'items', $data); + } + + /** + * @test + * + * @dataProvider claimValues + * + * @uses Lcobucci\JWT\ValidationData::__construct + * + * @covers Lcobucci\JWT\ValidationData::setId + */ + public function setIdShouldChangeTheId($id) + { + $expected = $this->createExpectedData($id); + $data = new ValidationData(1); + $data->setId($id); + + $this->assertAttributeSame($expected, 'items', $data); + } + + /** + * @test + * + * @dataProvider claimValues + * + * @uses Lcobucci\JWT\ValidationData::__construct + * + * @covers Lcobucci\JWT\ValidationData::setIssuer + */ + public function setIssuerShouldChangeTheIssuer($iss) + { + $expected = $this->createExpectedData(null, null, $iss); + $data = new ValidationData(1); + $data->setIssuer($iss); + + $this->assertAttributeSame($expected, 'items', $data); + } + + /** + * @test + * + * @dataProvider claimValues + * + * @uses Lcobucci\JWT\ValidationData::__construct + * + * @covers Lcobucci\JWT\ValidationData::setAudience + */ + public function setAudienceShouldChangeTheAudience($aud) + { + $expected = $this->createExpectedData(null, null, null, $aud); + $data = new ValidationData(1); + $data->setAudience($aud); + + $this->assertAttributeSame($expected, 'items', $data); + } + + /** + * @test + * + * @dataProvider claimValues + * + * @uses Lcobucci\JWT\ValidationData::__construct + * + * @covers Lcobucci\JWT\ValidationData::setSubject + */ + public function setSubjectShouldChangeTheSubject($sub) + { + $expected = $this->createExpectedData(null, $sub); + $data = new ValidationData(1); + $data->setSubject($sub); + + $this->assertAttributeSame($expected, 'items', $data); + } + + /** + * @test + * + * @uses Lcobucci\JWT\ValidationData::__construct + * + * @covers Lcobucci\JWT\ValidationData::setCurrentTime + */ + public function setCurrentTimeShouldChangeTheTimeBasedValues() + { + $expected = $this->createExpectedData(null, null, null, null, 2); + $data = new ValidationData(1); + $data->setCurrentTime(2); + + $this->assertAttributeSame($expected, 'items', $data); + } + + /** + * @test + * + * @uses Lcobucci\JWT\ValidationData::__construct + * + * @covers Lcobucci\JWT\ValidationData::has + */ + public function hasShouldReturnTrueWhenItemIsNotEmpty() + { + $data = new ValidationData(1); + + $this->assertTrue($data->has('iat')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\ValidationData::__construct + * + * @covers Lcobucci\JWT\ValidationData::has + */ + public function hasShouldReturnFalseWhenItemIsEmpty() + { + $data = new ValidationData(1); + + $this->assertFalse($data->has('jti')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\ValidationData::__construct + * + * @covers Lcobucci\JWT\ValidationData::has + */ + public function hasShouldReturnFalseWhenItemIsNotDefined() + { + $data = new ValidationData(1); + + $this->assertFalse($data->has('test')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\ValidationData::__construct + * + * @covers Lcobucci\JWT\ValidationData::get + */ + public function getShouldReturnTheItemValue() + { + $data = new ValidationData(1); + + $this->assertEquals(1, $data->get('iat')); + } + + /** + * @test + * + * @uses Lcobucci\JWT\ValidationData::__construct + * + * @covers Lcobucci\JWT\ValidationData::get + */ + public function getShouldReturnNullWhenItemIsNotDefined() + { + $data = new ValidationData(1); + + $this->assertNull($data->get('test')); + } + + /** + * @return array + */ + public function claimValues() + { + return [ + [1], + ['test'] + ]; + } + + /** + * @param string $id + * @param string $sub + * @param string $iss + * @param string $aud + * @param int $time + * + * @return array + */ + private function createExpectedData( + $id = null, + $sub = null, + $iss = null, + $aud = null, + $time = 1 + ) { + return [ + 'jti' => $id !== null ? (string) $id : null, + 'iss' => $iss !== null ? (string) $iss : null, + 'aud' => $aud !== null ? (string) $aud : null, + 'sub' => $sub !== null ? (string) $sub : null, + 'iat' => $time, + 'nbf' => $time, + 'exp' => $time + ]; + } +} diff --git a/vendor/league/flysystem/LICENSE b/vendor/league/flysystem/LICENSE new file mode 100644 index 0000000..0d16ccc --- /dev/null +++ b/vendor/league/flysystem/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013-2018 Frank de Jonge + +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/league/flysystem/composer.json b/vendor/league/flysystem/composer.json new file mode 100644 index 0000000..696c26f --- /dev/null +++ b/vendor/league/flysystem/composer.json @@ -0,0 +1,64 @@ +{ + "name": "league/flysystem", + "description": "Filesystem abstraction: Many filesystems, one API.", + "keywords": [ + "filesystem", "filesystems", "files", "storage", "dropbox", "aws", + "abstraction", "s3", "ftp", "sftp", "remote", "webdav", + "file systems", "cloud", "cloud files", "rackspace", "copy.com" + ], + "license": "MIT", + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "require": { + "php": ">=5.5.9", + "ext-fileinfo": "*" + }, + "require-dev": { + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7.10" + }, + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "League\\Flysystem\\Stub\\": "stub/" + }, + "files": [ + "tests/PHPUnitHacks.php" + ] + }, + "suggest": { + "ext-fileinfo": "Required for MimeType", + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", + "league/flysystem-webdav": "Allows you to use WebDAV storage", + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications", + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter" + }, + "conflict": { + "league/flysystem-sftp": "<1.0.6" + }, + "config": { + "bin-dir": "bin" + }, + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + } +} diff --git a/vendor/league/flysystem/deprecations.md b/vendor/league/flysystem/deprecations.md new file mode 100644 index 0000000..ef786d1 --- /dev/null +++ b/vendor/league/flysystem/deprecations.md @@ -0,0 +1,19 @@ +# Deprecations + +This document lists all the planned deprecations. + +## Handlers will be removed in 2.0 + +The `Handler` type and associated calls will be removed in version 2.0. + +### Upgrade path + +You should create your own implementation for handling OOP usage, +but it's recommended to move away from using an OOP-style wrapper entirely. + +The reason for this is that it's too easy for implementation details (for +your application this is Flysystem) to leak into the application. The most +important part for Flysystem is that it improves portability and creates a +solid boundary between your application core and the infrastructure you use. +The OOP-style handling breaks this principle, therefore I want to stop +promoting it. \ No newline at end of file diff --git a/vendor/league/flysystem/src/Adapter/AbstractAdapter.php b/vendor/league/flysystem/src/Adapter/AbstractAdapter.php new file mode 100644 index 0000000..01e8cda --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/AbstractAdapter.php @@ -0,0 +1,71 @@ +pathPrefix = null; + return; + } + + $this->pathPrefix = rtrim($prefix, '\\/') . $this->pathSeparator; + } + + /** + * Get the path prefix. + * + * @return string|null path prefix or null if pathPrefix is empty + */ + public function getPathPrefix() + { + return $this->pathPrefix; + } + + /** + * Prefix a path. + * + * @param string $path + * + * @return string prefixed path + */ + public function applyPathPrefix($path) + { + return $this->getPathPrefix() . ltrim($path, '\\/'); + } + + /** + * Remove a path prefix. + * + * @param string $path + * + * @return string path without the prefix + */ + public function removePathPrefix($path) + { + return substr($path, strlen($this->getPathPrefix())); + } +} diff --git a/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php b/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php new file mode 100644 index 0000000..932ffbb --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php @@ -0,0 +1,623 @@ +safeStorage = new SafeStorage(); + $this->setConfig($config); + } + + /** + * Set the config. + * + * @param array $config + * + * @return $this + */ + public function setConfig(array $config) + { + foreach ($this->configurable as $setting) { + if ( ! isset($config[$setting])) { + continue; + } + + $method = 'set' . ucfirst($setting); + + if (method_exists($this, $method)) { + $this->$method($config[$setting]); + } + } + + return $this; + } + + /** + * Returns the host. + * + * @return string + */ + public function getHost() + { + return $this->host; + } + + /** + * Set the host. + * + * @param string $host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + + return $this; + } + + /** + * Set the public permission value. + * + * @param int $permPublic + * + * @return $this + */ + public function setPermPublic($permPublic) + { + $this->permPublic = $permPublic; + + return $this; + } + + /** + * Set the private permission value. + * + * @param int $permPrivate + * + * @return $this + */ + public function setPermPrivate($permPrivate) + { + $this->permPrivate = $permPrivate; + + return $this; + } + + /** + * Returns the ftp port. + * + * @return int + */ + public function getPort() + { + return $this->port; + } + + /** + * Returns the root folder to work from. + * + * @return string + */ + public function getRoot() + { + return $this->root; + } + + /** + * Set the ftp port. + * + * @param int|string $port + * + * @return $this + */ + public function setPort($port) + { + $this->port = (int) $port; + + return $this; + } + + /** + * Set the root folder to work from. + * + * @param string $root + * + * @return $this + */ + public function setRoot($root) + { + $this->root = rtrim($root, '\\/') . $this->separator; + + return $this; + } + + /** + * Returns the ftp username. + * + * @return string username + */ + public function getUsername() + { + $username = $this->safeStorage->retrieveSafely('username'); + + return $username !== null ? $username : 'anonymous'; + } + + /** + * Set ftp username. + * + * @param string $username + * + * @return $this + */ + public function setUsername($username) + { + $this->safeStorage->storeSafely('username', $username); + + return $this; + } + + /** + * Returns the password. + * + * @return string password + */ + public function getPassword() + { + return $this->safeStorage->retrieveSafely('password'); + } + + /** + * Set the ftp password. + * + * @param string $password + * + * @return $this + */ + public function setPassword($password) + { + $this->safeStorage->storeSafely('password', $password); + + return $this; + } + + /** + * Returns the amount of seconds before the connection will timeout. + * + * @return int + */ + public function getTimeout() + { + return $this->timeout; + } + + /** + * Set the amount of seconds before the connection should timeout. + * + * @param int $timeout + * + * @return $this + */ + public function setTimeout($timeout) + { + $this->timeout = (int) $timeout; + + return $this; + } + + /** + * Return the FTP system type. + * + * @return string + */ + public function getSystemType() + { + return $this->systemType; + } + + /** + * Set the FTP system type (windows or unix). + * + * @param string $systemType + * + * @return $this + */ + public function setSystemType($systemType) + { + $this->systemType = strtolower($systemType); + + return $this; + } + + /** + * @inheritdoc + */ + public function listContents($directory = '', $recursive = false) + { + return $this->listDirectoryContents($directory, $recursive); + } + + abstract protected function listDirectoryContents($directory, $recursive = false); + + /** + * Normalize a directory listing. + * + * @param array $listing + * @param string $prefix + * + * @return array directory listing + */ + protected function normalizeListing(array $listing, $prefix = '') + { + $base = $prefix; + $result = []; + $listing = $this->removeDotDirectories($listing); + + while ($item = array_shift($listing)) { + if (preg_match('#^.*:$#', $item)) { + $base = preg_replace('~^\./*|:$~', '', $item); + continue; + } + + $result[] = $this->normalizeObject($item, $base); + } + + return $this->sortListing($result); + } + + /** + * Sort a directory listing. + * + * @param array $result + * + * @return array sorted listing + */ + protected function sortListing(array $result) + { + $compare = function ($one, $two) { + return strnatcmp($one['path'], $two['path']); + }; + + usort($result, $compare); + + return $result; + } + + /** + * Normalize a file entry. + * + * @param string $item + * @param string $base + * + * @return array normalized file array + * + * @throws NotSupportedException + */ + protected function normalizeObject($item, $base) + { + $systemType = $this->systemType ?: $this->detectSystemType($item); + + if ($systemType === 'unix') { + return $this->normalizeUnixObject($item, $base); + } elseif ($systemType === 'windows') { + return $this->normalizeWindowsObject($item, $base); + } + + throw NotSupportedException::forFtpSystemType($systemType); + } + + /** + * Normalize a Unix file entry. + * + * @param string $item + * @param string $base + * + * @return array normalized file array + */ + protected function normalizeUnixObject($item, $base) + { + $item = preg_replace('#\s+#', ' ', trim($item), 7); + + if (count(explode(' ', $item, 9)) !== 9) { + throw new RuntimeException("Metadata can't be parsed from item '$item' , not enough parts."); + } + + list($permissions, /* $number */, /* $owner */, /* $group */, $size, /* $month */, /* $day */, /* $time*/, $name) = explode(' ', $item, 9); + $type = $this->detectType($permissions); + $path = $base === '' ? $name : $base . $this->separator . $name; + + if ($type === 'dir') { + return compact('type', 'path'); + } + + $permissions = $this->normalizePermissions($permissions); + $visibility = $permissions & 0044 ? AdapterInterface::VISIBILITY_PUBLIC : AdapterInterface::VISIBILITY_PRIVATE; + $size = (int) $size; + + return compact('type', 'path', 'visibility', 'size'); + } + + /** + * Normalize a Windows/DOS file entry. + * + * @param string $item + * @param string $base + * + * @return array normalized file array + */ + protected function normalizeWindowsObject($item, $base) + { + $item = preg_replace('#\s+#', ' ', trim($item), 3); + + if (count(explode(' ', $item, 4)) !== 4) { + throw new RuntimeException("Metadata can't be parsed from item '$item' , not enough parts."); + } + + list($date, $time, $size, $name) = explode(' ', $item, 4); + $path = $base === '' ? $name : $base . $this->separator . $name; + + // Check for the correct date/time format + $format = strlen($date) === 8 ? 'm-d-yH:iA' : 'Y-m-dH:i'; + $dt = DateTime::createFromFormat($format, $date . $time); + $timestamp = $dt ? $dt->getTimestamp() : (int) strtotime("$date $time"); + + if ($size === '') { + $type = 'dir'; + + return compact('type', 'path', 'timestamp'); + } + + $type = 'file'; + $visibility = AdapterInterface::VISIBILITY_PUBLIC; + $size = (int) $size; + + return compact('type', 'path', 'visibility', 'size', 'timestamp'); + } + + /** + * Get the system type from a listing item. + * + * @param string $item + * + * @return string the system type + */ + protected function detectSystemType($item) + { + return preg_match('/^[0-9]{2,4}-[0-9]{2}-[0-9]{2}/', $item) ? 'windows' : 'unix'; + } + + /** + * Get the file type from the permissions. + * + * @param string $permissions + * + * @return string file type + */ + protected function detectType($permissions) + { + return substr($permissions, 0, 1) === 'd' ? 'dir' : 'file'; + } + + /** + * Normalize a permissions string. + * + * @param string $permissions + * + * @return int + */ + protected function normalizePermissions($permissions) + { + // remove the type identifier + $permissions = substr($permissions, 1); + + // map the string rights to the numeric counterparts + $map = ['-' => '0', 'r' => '4', 'w' => '2', 'x' => '1']; + $permissions = strtr($permissions, $map); + + // split up the permission groups + $parts = str_split($permissions, 3); + + // convert the groups + $mapper = function ($part) { + return array_sum(str_split($part)); + }; + + // converts to decimal number + return octdec(implode('', array_map($mapper, $parts))); + } + + /** + * Filter out dot-directories. + * + * @param array $list + * + * @return array + */ + public function removeDotDirectories(array $list) + { + $filter = function ($line) { + return $line !== '' && ! preg_match('#.* \.(\.)?$|^total#', $line); + }; + + return array_filter($list, $filter); + } + + /** + * @inheritdoc + */ + public function has($path) + { + return $this->getMetadata($path); + } + + /** + * @inheritdoc + */ + public function getSize($path) + { + return $this->getMetadata($path); + } + + /** + * @inheritdoc + */ + public function getVisibility($path) + { + return $this->getMetadata($path); + } + + /** + * Ensure a directory exists. + * + * @param string $dirname + */ + public function ensureDirectory($dirname) + { + $dirname = (string) $dirname; + + if ($dirname !== '' && ! $this->has($dirname)) { + $this->createDir($dirname, new Config()); + } + } + + /** + * @return mixed + */ + public function getConnection() + { + $tries = 0; + + while ( ! $this->isConnected() && $tries < 3) { + $tries++; + $this->disconnect(); + $this->connect(); + } + + return $this->connection; + } + + /** + * Get the public permission value. + * + * @return int + */ + public function getPermPublic() + { + return $this->permPublic; + } + + /** + * Get the private permission value. + * + * @return int + */ + public function getPermPrivate() + { + return $this->permPrivate; + } + + /** + * Disconnect on destruction. + */ + public function __destruct() + { + $this->disconnect(); + } + + /** + * Establish a connection. + */ + abstract public function connect(); + + /** + * Close the connection. + */ + abstract public function disconnect(); + + /** + * Check if a connection is active. + * + * @return bool + */ + abstract public function isConnected(); +} diff --git a/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php b/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php new file mode 100644 index 0000000..c42719e --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php @@ -0,0 +1,10 @@ +transferMode = $mode; + + return $this; + } + + /** + * Set if Ssl is enabled. + * + * @param bool $ssl + * + * @return $this + */ + public function setSsl($ssl) + { + $this->ssl = (bool) $ssl; + + return $this; + } + + /** + * Set if passive mode should be used. + * + * @param bool $passive + */ + public function setPassive($passive = true) + { + $this->passive = $passive; + } + + /** + * @param bool $ignorePassiveAddress + */ + public function setIgnorePassiveAddress($ignorePassiveAddress) + { + $this->ignorePassiveAddress = $ignorePassiveAddress; + } + + /** + * @param bool $recurseManually + */ + public function setRecurseManually($recurseManually) + { + $this->recurseManually = $recurseManually; + } + + /** + * @param bool $utf8 + */ + public function setUtf8($utf8) + { + $this->utf8 = (bool) $utf8; + } + + /** + * Connect to the FTP server. + */ + public function connect() + { + if ($this->ssl) { + $this->connection = ftp_ssl_connect($this->getHost(), $this->getPort(), $this->getTimeout()); + } else { + $this->connection = ftp_connect($this->getHost(), $this->getPort(), $this->getTimeout()); + } + + if ( ! $this->connection) { + throw new RuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort()); + } + + $this->login(); + $this->setUtf8Mode(); + $this->setConnectionPassiveMode(); + $this->setConnectionRoot(); + $this->isPureFtpd = $this->isPureFtpdServer(); + } + + /** + * Set the connection to UTF-8 mode. + */ + protected function setUtf8Mode() + { + if ($this->utf8) { + $response = ftp_raw($this->connection, "OPTS UTF8 ON"); + if (substr($response[0], 0, 3) !== '200') { + throw new RuntimeException( + 'Could not set UTF-8 mode for connection: ' . $this->getHost() . '::' . $this->getPort() + ); + } + } + } + + /** + * Set the connections to passive mode. + * + * @throws RuntimeException + */ + protected function setConnectionPassiveMode() + { + if (is_bool($this->ignorePassiveAddress) && defined('FTP_USEPASVADDRESS')) { + ftp_set_option($this->connection, FTP_USEPASVADDRESS, ! $this->ignorePassiveAddress); + } + + if ( ! ftp_pasv($this->connection, $this->passive)) { + throw new RuntimeException( + 'Could not set passive mode for connection: ' . $this->getHost() . '::' . $this->getPort() + ); + } + } + + /** + * Set the connection root. + */ + protected function setConnectionRoot() + { + $root = $this->getRoot(); + $connection = $this->connection; + + if ($root && ! ftp_chdir($connection, $root)) { + throw new RuntimeException('Root is invalid or does not exist: ' . $this->getRoot()); + } + + // Store absolute path for further reference. + // This is needed when creating directories and + // initial root was a relative path, else the root + // would be relative to the chdir'd path. + $this->root = ftp_pwd($connection); + } + + /** + * Login. + * + * @throws RuntimeException + */ + protected function login() + { + set_error_handler(function () {}); + $isLoggedIn = ftp_login( + $this->connection, + $this->getUsername(), + $this->getPassword() + ); + restore_error_handler(); + + if ( ! $isLoggedIn) { + $this->disconnect(); + throw new RuntimeException( + 'Could not login with connection: ' . $this->getHost() . '::' . $this->getPort( + ) . ', username: ' . $this->getUsername() + ); + } + } + + /** + * Disconnect from the FTP server. + */ + public function disconnect() + { + if (is_resource($this->connection)) { + ftp_close($this->connection); + } + + $this->connection = null; + } + + /** + * @inheritdoc + */ + public function write($path, $contents, Config $config) + { + $stream = fopen('php://temp', 'w+b'); + fwrite($stream, $contents); + rewind($stream); + $result = $this->writeStream($path, $stream, $config); + fclose($stream); + + if ($result === false) { + return false; + } + + $result['contents'] = $contents; + $result['mimetype'] = Util::guessMimeType($path, $contents); + + return $result; + } + + /** + * @inheritdoc + */ + public function writeStream($path, $resource, Config $config) + { + $this->ensureDirectory(Util::dirname($path)); + + if ( ! ftp_fput($this->getConnection(), $path, $resource, $this->transferMode)) { + return false; + } + + if ($visibility = $config->get('visibility')) { + $this->setVisibility($path, $visibility); + } + + $type = 'file'; + + return compact('type', 'path', 'visibility'); + } + + /** + * @inheritdoc + */ + public function update($path, $contents, Config $config) + { + return $this->write($path, $contents, $config); + } + + /** + * @inheritdoc + */ + public function updateStream($path, $resource, Config $config) + { + return $this->writeStream($path, $resource, $config); + } + + /** + * @inheritdoc + */ + public function rename($path, $newpath) + { + return ftp_rename($this->getConnection(), $path, $newpath); + } + + /** + * @inheritdoc + */ + public function delete($path) + { + return ftp_delete($this->getConnection(), $path); + } + + /** + * @inheritdoc + */ + public function deleteDir($dirname) + { + $connection = $this->getConnection(); + $contents = array_reverse($this->listDirectoryContents($dirname, false)); + + foreach ($contents as $object) { + if ($object['type'] === 'file') { + if ( ! ftp_delete($connection, $object['path'])) { + return false; + } + } elseif ( ! $this->deleteDir($object['path'])) { + return false; + } + } + + return ftp_rmdir($connection, $dirname); + } + + /** + * @inheritdoc + */ + public function createDir($dirname, Config $config) + { + $connection = $this->getConnection(); + $directories = explode('/', $dirname); + + foreach ($directories as $directory) { + if (false === $this->createActualDirectory($directory, $connection)) { + $this->setConnectionRoot(); + + return false; + } + + ftp_chdir($connection, $directory); + } + + $this->setConnectionRoot(); + + return ['type' => 'dir', 'path' => $dirname]; + } + + /** + * Create a directory. + * + * @param string $directory + * @param resource $connection + * + * @return bool + */ + protected function createActualDirectory($directory, $connection) + { + // List the current directory + $listing = ftp_nlist($connection, '.') ?: []; + + foreach ($listing as $key => $item) { + if (preg_match('~^\./.*~', $item)) { + $listing[$key] = substr($item, 2); + } + } + + if (in_array($directory, $listing, true)) { + return true; + } + + return (boolean) ftp_mkdir($connection, $directory); + } + + /** + * @inheritdoc + */ + public function getMetadata($path) + { + $connection = $this->getConnection(); + + if ($path === '') { + return ['type' => 'dir', 'path' => '']; + } + + if (@ftp_chdir($connection, $path) === true) { + $this->setConnectionRoot(); + + return ['type' => 'dir', 'path' => $path]; + } + + $listing = $this->ftpRawlist('-A', str_replace('*', '\\*', $path)); + + if (empty($listing) || in_array('total 0', $listing, true)) { + return false; + } + + if (preg_match('/.* not found/', $listing[0])) { + return false; + } + + if (preg_match('/^total [0-9]*$/', $listing[0])) { + array_shift($listing); + } + + return $this->normalizeObject($listing[0], ''); + } + + /** + * @inheritdoc + */ + public function getMimetype($path) + { + if ( ! $metadata = $this->getMetadata($path)) { + return false; + } + + $metadata['mimetype'] = MimeType::detectByFilename($path); + + return $metadata; + } + + /** + * @inheritdoc + */ + public function getTimestamp($path) + { + $timestamp = ftp_mdtm($this->getConnection(), $path); + + return ($timestamp !== -1) ? ['path' => $path, 'timestamp' => $timestamp] : false; + } + + /** + * @inheritdoc + */ + public function read($path) + { + if ( ! $object = $this->readStream($path)) { + return false; + } + + $object['contents'] = stream_get_contents($object['stream']); + fclose($object['stream']); + unset($object['stream']); + + return $object; + } + + /** + * @inheritdoc + */ + public function readStream($path) + { + $stream = fopen('php://temp', 'w+b'); + $result = ftp_fget($this->getConnection(), $stream, $path, $this->transferMode); + rewind($stream); + + if ( ! $result) { + fclose($stream); + + return false; + } + + return ['type' => 'file', 'path' => $path, 'stream' => $stream]; + } + + /** + * @inheritdoc + */ + public function setVisibility($path, $visibility) + { + $mode = $visibility === AdapterInterface::VISIBILITY_PUBLIC ? $this->getPermPublic() : $this->getPermPrivate(); + + if ( ! ftp_chmod($this->getConnection(), $mode, $path)) { + return false; + } + + return compact('path', 'visibility'); + } + + /** + * @inheritdoc + * + * @param string $directory + */ + protected function listDirectoryContents($directory, $recursive = true) + { + $directory = str_replace('*', '\\*', $directory); + + if ($recursive && $this->recurseManually) { + return $this->listDirectoryContentsRecursive($directory); + } + + $options = $recursive ? '-alnR' : '-aln'; + $listing = $this->ftpRawlist($options, $directory); + + return $listing ? $this->normalizeListing($listing, $directory) : []; + } + + /** + * @inheritdoc + * + * @param string $directory + */ + protected function listDirectoryContentsRecursive($directory) + { + $listing = $this->normalizeListing($this->ftpRawlist('-aln', $directory) ?: [], $directory); + $output = []; + + foreach ($listing as $item) { + $output[] = $item; + if ($item['type'] !== 'dir') continue; + $output = array_merge($output, $this->listDirectoryContentsRecursive($item['path'])); + } + + return $output; + } + + /** + * Check if the connection is open. + * + * @return bool + * @throws ErrorException + */ + public function isConnected() + { + try { + return is_resource($this->connection) && ftp_rawlist($this->connection, $this->getRoot()) !== false; + } catch (ErrorException $e) { + if (strpos($e->getMessage(), 'ftp_rawlist') === false) { + throw $e; + } + + return false; + } + } + + /** + * @return bool + */ + protected function isPureFtpdServer() + { + $response = ftp_raw($this->connection, 'HELP'); + + return stripos(implode(' ', $response), 'Pure-FTPd') !== false; + } + + /** + * The ftp_rawlist function with optional escaping. + * + * @param string $options + * @param string $path + * + * @return array + */ + protected function ftpRawlist($options, $path) + { + $connection = $this->getConnection(); + + if ($this->isPureFtpd) { + $path = str_replace(' ', '\ ', $path); + } + return ftp_rawlist($connection, $options . ' ' . $path); + } +} diff --git a/vendor/league/flysystem/src/Adapter/Ftpd.php b/vendor/league/flysystem/src/Adapter/Ftpd.php new file mode 100644 index 0000000..7fcecd0 --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/Ftpd.php @@ -0,0 +1,40 @@ + 'dir', 'path' => '']; + } + + if ( ! ($object = ftp_raw($this->getConnection(), 'STAT ' . $path)) || count($object) < 3) { + return false; + } + + if (substr($object[1], 0, 5) === "ftpd:") { + return false; + } + + return $this->normalizeObject($object[1], ''); + } + + /** + * @inheritdoc + */ + protected function listDirectoryContents($directory, $recursive = true) + { + $listing = ftp_rawlist($this->getConnection(), $directory, $recursive); + + if ($listing === false || ( ! empty($listing) && substr($listing[0], 0, 5) === "ftpd:")) { + return []; + } + + return $this->normalizeListing($listing, $directory); + } +} diff --git a/vendor/league/flysystem/src/Adapter/Local.php b/vendor/league/flysystem/src/Adapter/Local.php new file mode 100644 index 0000000..1bdf51d --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/Local.php @@ -0,0 +1,517 @@ + [ + 'public' => 0644, + 'private' => 0600, + ], + 'dir' => [ + 'public' => 0755, + 'private' => 0700, + ], + ]; + + /** + * @var string + */ + protected $pathSeparator = DIRECTORY_SEPARATOR; + + /** + * @var array + */ + protected $permissionMap; + + /** + * @var int + */ + protected $writeFlags; + + /** + * @var int + */ + private $linkHandling; + + /** + * Constructor. + * + * @param string $root + * @param int $writeFlags + * @param int $linkHandling + * @param array $permissions + * + * @throws LogicException + */ + public function __construct($root, $writeFlags = LOCK_EX, $linkHandling = self::DISALLOW_LINKS, array $permissions = []) + { + $root = is_link($root) ? realpath($root) : $root; + $this->permissionMap = array_replace_recursive(static::$permissions, $permissions); + $this->ensureDirectory($root); + + if ( ! is_dir($root) || ! is_readable($root)) { + throw new LogicException('The root path ' . $root . ' is not readable.'); + } + + $this->setPathPrefix($root); + $this->writeFlags = $writeFlags; + $this->linkHandling = $linkHandling; + } + + /** + * Ensure the root directory exists. + * + * @param string $root root directory path + * + * @return void + * + * @throws Exception in case the root directory can not be created + */ + protected function ensureDirectory($root) + { + if ( ! is_dir($root)) { + $umask = umask(0); + + if ( ! @mkdir($root, $this->permissionMap['dir']['public'], true)) { + $mkdirError = error_get_last(); + } + + umask($umask); + + if ( ! is_dir($root)) { + $errorMessage = isset($mkdirError['message']) ? $mkdirError['message'] : ''; + throw new Exception(sprintf('Impossible to create the root directory "%s". %s', $root, $errorMessage)); + } + } + } + + /** + * @inheritdoc + */ + public function has($path) + { + $location = $this->applyPathPrefix($path); + + return file_exists($location); + } + + /** + * @inheritdoc + */ + public function write($path, $contents, Config $config) + { + $location = $this->applyPathPrefix($path); + $this->ensureDirectory(dirname($location)); + + if (($size = file_put_contents($location, $contents, $this->writeFlags)) === false) { + return false; + } + + $type = 'file'; + $result = compact('contents', 'type', 'size', 'path'); + + if ($visibility = $config->get('visibility')) { + $result['visibility'] = $visibility; + $this->setVisibility($path, $visibility); + } + + return $result; + } + + /** + * @inheritdoc + */ + public function writeStream($path, $resource, Config $config) + { + $location = $this->applyPathPrefix($path); + $this->ensureDirectory(dirname($location)); + $stream = fopen($location, 'w+b'); + + if ( ! $stream || stream_copy_to_stream($resource, $stream) === false || ! fclose($stream)) { + return false; + } + + $type = 'file'; + $result = compact('type', 'path'); + + if ($visibility = $config->get('visibility')) { + $this->setVisibility($path, $visibility); + $result['visibility'] = $visibility; + } + + return $result; + } + + /** + * @inheritdoc + */ + public function readStream($path) + { + $location = $this->applyPathPrefix($path); + $stream = fopen($location, 'rb'); + + return ['type' => 'file', 'path' => $path, 'stream' => $stream]; + } + + /** + * @inheritdoc + */ + public function updateStream($path, $resource, Config $config) + { + return $this->writeStream($path, $resource, $config); + } + + /** + * @inheritdoc + */ + public function update($path, $contents, Config $config) + { + $location = $this->applyPathPrefix($path); + $size = file_put_contents($location, $contents, $this->writeFlags); + + if ($size === false) { + return false; + } + + $type = 'file'; + + $result = compact('type', 'path', 'size', 'contents'); + + if ($mimetype = Util::guessMimeType($path, $contents)) { + $result['mimetype'] = $mimetype; + } + + return $result; + } + + /** + * @inheritdoc + */ + public function read($path) + { + $location = $this->applyPathPrefix($path); + $contents = file_get_contents($location); + + if ($contents === false) { + return false; + } + + return ['type' => 'file', 'path' => $path, 'contents' => $contents]; + } + + /** + * @inheritdoc + */ + public function rename($path, $newpath) + { + $location = $this->applyPathPrefix($path); + $destination = $this->applyPathPrefix($newpath); + $parentDirectory = $this->applyPathPrefix(Util::dirname($newpath)); + $this->ensureDirectory($parentDirectory); + + return rename($location, $destination); + } + + /** + * @inheritdoc + */ + public function copy($path, $newpath) + { + $location = $this->applyPathPrefix($path); + $destination = $this->applyPathPrefix($newpath); + $this->ensureDirectory(dirname($destination)); + + return copy($location, $destination); + } + + /** + * @inheritdoc + */ + public function delete($path) + { + $location = $this->applyPathPrefix($path); + + return @unlink($location); + } + + /** + * @inheritdoc + */ + public function listContents($directory = '', $recursive = false) + { + $result = []; + $location = $this->applyPathPrefix($directory); + + if ( ! is_dir($location)) { + return []; + } + + $iterator = $recursive ? $this->getRecursiveDirectoryIterator($location) : $this->getDirectoryIterator($location); + + foreach ($iterator as $file) { + $path = $this->getFilePath($file); + + if (preg_match('#(^|/|\\\\)\.{1,2}$#', $path)) { + continue; + } + + $result[] = $this->normalizeFileInfo($file); + } + + return array_filter($result); + } + + /** + * @inheritdoc + */ + public function getMetadata($path) + { + $location = $this->applyPathPrefix($path); + $info = new SplFileInfo($location); + + return $this->normalizeFileInfo($info); + } + + /** + * @inheritdoc + */ + public function getSize($path) + { + return $this->getMetadata($path); + } + + /** + * @inheritdoc + */ + public function getMimetype($path) + { + $location = $this->applyPathPrefix($path); + $finfo = new Finfo(FILEINFO_MIME_TYPE); + $mimetype = $finfo->file($location); + + if (in_array($mimetype, ['application/octet-stream', 'inode/x-empty'])) { + $mimetype = Util\MimeType::detectByFilename($location); + } + + return ['path' => $path, 'type' => 'file', 'mimetype' => $mimetype]; + } + + /** + * @inheritdoc + */ + public function getTimestamp($path) + { + return $this->getMetadata($path); + } + + /** + * @inheritdoc + */ + public function getVisibility($path) + { + $location = $this->applyPathPrefix($path); + clearstatcache(false, $location); + $permissions = octdec(substr(sprintf('%o', fileperms($location)), -4)); + $visibility = $permissions & 0044 ? AdapterInterface::VISIBILITY_PUBLIC : AdapterInterface::VISIBILITY_PRIVATE; + + return compact('path', 'visibility'); + } + + /** + * @inheritdoc + */ + public function setVisibility($path, $visibility) + { + $location = $this->applyPathPrefix($path); + $type = is_dir($location) ? 'dir' : 'file'; + $success = chmod($location, $this->permissionMap[$type][$visibility]); + + if ($success === false) { + return false; + } + + return compact('path', 'visibility'); + } + + /** + * @inheritdoc + */ + public function createDir($dirname, Config $config) + { + $location = $this->applyPathPrefix($dirname); + $umask = umask(0); + $visibility = $config->get('visibility', 'public'); + + if ( ! is_dir($location) && ! mkdir($location, $this->permissionMap['dir'][$visibility], true)) { + $return = false; + } else { + $return = ['path' => $dirname, 'type' => 'dir']; + } + + umask($umask); + + return $return; + } + + /** + * @inheritdoc + */ + public function deleteDir($dirname) + { + $location = $this->applyPathPrefix($dirname); + + if ( ! is_dir($location)) { + return false; + } + + $contents = $this->getRecursiveDirectoryIterator($location, RecursiveIteratorIterator::CHILD_FIRST); + + /** @var SplFileInfo $file */ + foreach ($contents as $file) { + $this->guardAgainstUnreadableFileInfo($file); + $this->deleteFileInfoObject($file); + } + + return rmdir($location); + } + + /** + * @param SplFileInfo $file + */ + protected function deleteFileInfoObject(SplFileInfo $file) + { + switch ($file->getType()) { + case 'dir': + rmdir($file->getRealPath()); + break; + case 'link': + unlink($file->getPathname()); + break; + default: + unlink($file->getRealPath()); + } + } + + /** + * Normalize the file info. + * + * @param SplFileInfo $file + * + * @return array|void + * + * @throws NotSupportedException + */ + protected function normalizeFileInfo(SplFileInfo $file) + { + if ( ! $file->isLink()) { + return $this->mapFileInfo($file); + } + + if ($this->linkHandling & self::DISALLOW_LINKS) { + throw NotSupportedException::forLink($file); + } + } + + /** + * Get the normalized path from a SplFileInfo object. + * + * @param SplFileInfo $file + * + * @return string + */ + protected function getFilePath(SplFileInfo $file) + { + $location = $file->getPathname(); + $path = $this->removePathPrefix($location); + + return trim(str_replace('\\', '/', $path), '/'); + } + + /** + * @param string $path + * @param int $mode + * + * @return RecursiveIteratorIterator + */ + protected function getRecursiveDirectoryIterator($path, $mode = RecursiveIteratorIterator::SELF_FIRST) + { + return new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), + $mode + ); + } + + /** + * @param string $path + * + * @return DirectoryIterator + */ + protected function getDirectoryIterator($path) + { + $iterator = new DirectoryIterator($path); + + return $iterator; + } + + /** + * @param SplFileInfo $file + * + * @return array + */ + protected function mapFileInfo(SplFileInfo $file) + { + $normalized = [ + 'type' => $file->getType(), + 'path' => $this->getFilePath($file), + ]; + + $normalized['timestamp'] = $file->getMTime(); + + if ($normalized['type'] === 'file') { + $normalized['size'] = $file->getSize(); + } + + return $normalized; + } + + /** + * @param SplFileInfo $file + * + * @throws UnreadableFileException + */ + protected function guardAgainstUnreadableFileInfo(SplFileInfo $file) + { + if ( ! $file->isReadable()) { + throw UnreadableFileException::forFileInfo($file); + } + } +} diff --git a/vendor/league/flysystem/src/Adapter/NullAdapter.php b/vendor/league/flysystem/src/Adapter/NullAdapter.php new file mode 100644 index 0000000..2527087 --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/NullAdapter.php @@ -0,0 +1,144 @@ +get('visibility')) { + $result['visibility'] = $visibility; + } + + return $result; + } + + /** + * @inheritdoc + */ + public function update($path, $contents, Config $config) + { + return false; + } + + /** + * @inheritdoc + */ + public function read($path) + { + return false; + } + + /** + * @inheritdoc + */ + public function rename($path, $newpath) + { + return false; + } + + /** + * @inheritdoc + */ + public function delete($path) + { + return false; + } + + /** + * @inheritdoc + */ + public function listContents($directory = '', $recursive = false) + { + return []; + } + + /** + * @inheritdoc + */ + public function getMetadata($path) + { + return false; + } + + /** + * @inheritdoc + */ + public function getSize($path) + { + return false; + } + + /** + * @inheritdoc + */ + public function getMimetype($path) + { + return false; + } + + /** + * @inheritdoc + */ + public function getTimestamp($path) + { + return false; + } + + /** + * @inheritdoc + */ + public function getVisibility($path) + { + return false; + } + + /** + * @inheritdoc + */ + public function setVisibility($path, $visibility) + { + return compact('visibility'); + } + + /** + * @inheritdoc + */ + public function createDir($dirname, Config $config) + { + return ['path' => $dirname, 'type' => 'dir']; + } + + /** + * @inheritdoc + */ + public function deleteDir($dirname) + { + return false; + } +} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php new file mode 100644 index 0000000..fc0a747 --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php @@ -0,0 +1,33 @@ +readStream($path); + + if ($response === false || ! is_resource($response['stream'])) { + return false; + } + + $result = $this->writeStream($newpath, $response['stream'], new Config()); + + if ($result !== false && is_resource($response['stream'])) { + fclose($response['stream']); + } + + return $result !== false; + } + + // Required abstract method + + /** + * @param string $path + * @return resource + */ + abstract public function readStream($path); + + /** + * @param string $path + * @param resource $resource + * @param Config $config + * @return resource + */ + abstract public function writeStream($path, $resource, Config $config); +} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php new file mode 100644 index 0000000..2b31c01 --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php @@ -0,0 +1,44 @@ +read($path)) { + return false; + } + + $stream = fopen('php://temp', 'w+b'); + fwrite($stream, $data['contents']); + rewind($stream); + $data['stream'] = $stream; + unset($data['contents']); + + return $data; + } + + /** + * Reads a file. + * + * @param string $path + * + * @return array|false + * + * @see League\Flysystem\ReadInterface::read() + */ + abstract public function read($path); +} diff --git a/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php new file mode 100644 index 0000000..8042496 --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php @@ -0,0 +1,9 @@ +stream($path, $resource, $config, 'write'); + } + + /** + * Update a file using a stream. + * + * @param string $path + * @param resource $resource + * @param Config $config Config object or visibility setting + * + * @return mixed false of file metadata + */ + public function updateStream($path, $resource, Config $config) + { + return $this->stream($path, $resource, $config, 'update'); + } + + // Required abstract methods + abstract public function write($pash, $contents, Config $config); + abstract public function update($pash, $contents, Config $config); +} diff --git a/vendor/league/flysystem/src/Adapter/SynologyFtp.php b/vendor/league/flysystem/src/Adapter/SynologyFtp.php new file mode 100644 index 0000000..fe0d344 --- /dev/null +++ b/vendor/league/flysystem/src/Adapter/SynologyFtp.php @@ -0,0 +1,8 @@ +settings = $settings; + } + + /** + * Get a setting. + * + * @param string $key + * @param mixed $default + * + * @return mixed config setting or default when not found + */ + public function get($key, $default = null) + { + if ( ! array_key_exists($key, $this->settings)) { + return $this->getDefault($key, $default); + } + + return $this->settings[$key]; + } + + /** + * Check if an item exists by key. + * + * @param string $key + * + * @return bool + */ + public function has($key) + { + if (array_key_exists($key, $this->settings)) { + return true; + } + + return $this->fallback instanceof Config + ? $this->fallback->has($key) + : false; + } + + /** + * Try to retrieve a default setting from a config fallback. + * + * @param string $key + * @param mixed $default + * + * @return mixed config setting or default when not found + */ + protected function getDefault($key, $default) + { + if ( ! $this->fallback) { + return $default; + } + + return $this->fallback->get($key, $default); + } + + /** + * Set a setting. + * + * @param string $key + * @param mixed $value + * + * @return $this + */ + public function set($key, $value) + { + $this->settings[$key] = $value; + + return $this; + } + + /** + * Set the fallback. + * + * @param Config $fallback + * + * @return $this + */ + public function setFallback(Config $fallback) + { + $this->fallback = $fallback; + + return $this; + } +} diff --git a/vendor/league/flysystem/src/ConfigAwareTrait.php b/vendor/league/flysystem/src/ConfigAwareTrait.php new file mode 100644 index 0000000..202d605 --- /dev/null +++ b/vendor/league/flysystem/src/ConfigAwareTrait.php @@ -0,0 +1,49 @@ +config = $config ? Util::ensureConfig($config) : new Config; + } + + /** + * Get the Config. + * + * @return Config config object + */ + public function getConfig() + { + return $this->config; + } + + /** + * Convert a config array to a Config object with the correct fallback. + * + * @param array $config + * + * @return Config + */ + protected function prepareConfig(array $config) + { + $config = new Config($config); + $config->setFallback($this->getConfig()); + + return $config; + } +} diff --git a/vendor/league/flysystem/src/Directory.php b/vendor/league/flysystem/src/Directory.php new file mode 100644 index 0000000..d4f90a8 --- /dev/null +++ b/vendor/league/flysystem/src/Directory.php @@ -0,0 +1,31 @@ +filesystem->deleteDir($this->path); + } + + /** + * List the directory contents. + * + * @param bool $recursive + * + * @return array|bool directory contents or false + */ + public function getContents($recursive = false) + { + return $this->filesystem->listContents($this->path, $recursive); + } +} diff --git a/vendor/league/flysystem/src/Exception.php b/vendor/league/flysystem/src/Exception.php new file mode 100644 index 0000000..d4a9907 --- /dev/null +++ b/vendor/league/flysystem/src/Exception.php @@ -0,0 +1,8 @@ +filesystem->has($this->path); + } + + /** + * Read the file. + * + * @return string|false file contents + */ + public function read() + { + return $this->filesystem->read($this->path); + } + + /** + * Read the file as a stream. + * + * @return resource|false file stream + */ + public function readStream() + { + return $this->filesystem->readStream($this->path); + } + + /** + * Write the new file. + * + * @param string $content + * + * @return bool success boolean + */ + public function write($content) + { + return $this->filesystem->write($this->path, $content); + } + + /** + * Write the new file using a stream. + * + * @param resource $resource + * + * @return bool success boolean + */ + public function writeStream($resource) + { + return $this->filesystem->writeStream($this->path, $resource); + } + + /** + * Update the file contents. + * + * @param string $content + * + * @return bool success boolean + */ + public function update($content) + { + return $this->filesystem->update($this->path, $content); + } + + /** + * Update the file contents with a stream. + * + * @param resource $resource + * + * @return bool success boolean + */ + public function updateStream($resource) + { + return $this->filesystem->updateStream($this->path, $resource); + } + + /** + * Create the file or update if exists. + * + * @param string $content + * + * @return bool success boolean + */ + public function put($content) + { + return $this->filesystem->put($this->path, $content); + } + + /** + * Create the file or update if exists using a stream. + * + * @param resource $resource + * + * @return bool success boolean + */ + public function putStream($resource) + { + return $this->filesystem->putStream($this->path, $resource); + } + + /** + * Rename the file. + * + * @param string $newpath + * + * @return bool success boolean + */ + public function rename($newpath) + { + if ($this->filesystem->rename($this->path, $newpath)) { + $this->path = $newpath; + + return true; + } + + return false; + } + + /** + * Copy the file. + * + * @param string $newpath + * + * @return File|false new file or false + */ + public function copy($newpath) + { + if ($this->filesystem->copy($this->path, $newpath)) { + return new File($this->filesystem, $newpath); + } + + return false; + } + + /** + * Get the file's timestamp. + * + * @return string|false The timestamp or false on failure. + */ + public function getTimestamp() + { + return $this->filesystem->getTimestamp($this->path); + } + + /** + * Get the file's mimetype. + * + * @return string|false The file mime-type or false on failure. + */ + public function getMimetype() + { + return $this->filesystem->getMimetype($this->path); + } + + /** + * Get the file's visibility. + * + * @return string|false The visibility (public|private) or false on failure. + */ + public function getVisibility() + { + return $this->filesystem->getVisibility($this->path); + } + + /** + * Get the file's metadata. + * + * @return array|false The file metadata or false on failure. + */ + public function getMetadata() + { + return $this->filesystem->getMetadata($this->path); + } + + /** + * Get the file size. + * + * @return int|false The file size or false on failure. + */ + public function getSize() + { + return $this->filesystem->getSize($this->path); + } + + /** + * Delete the file. + * + * @return bool success boolean + */ + public function delete() + { + return $this->filesystem->delete($this->path); + } +} diff --git a/vendor/league/flysystem/src/FileExistsException.php b/vendor/league/flysystem/src/FileExistsException.php new file mode 100644 index 0000000..c82e20c --- /dev/null +++ b/vendor/league/flysystem/src/FileExistsException.php @@ -0,0 +1,37 @@ +path = $path; + + parent::__construct('File already exists at path: ' . $this->getPath(), $code, $previous); + } + + /** + * Get the path which was found. + * + * @return string + */ + public function getPath() + { + return $this->path; + } +} diff --git a/vendor/league/flysystem/src/FileNotFoundException.php b/vendor/league/flysystem/src/FileNotFoundException.php new file mode 100644 index 0000000..989df69 --- /dev/null +++ b/vendor/league/flysystem/src/FileNotFoundException.php @@ -0,0 +1,37 @@ +path = $path; + + parent::__construct('File not found at path: ' . $this->getPath(), $code, $previous); + } + + /** + * Get the path which was not found. + * + * @return string + */ + public function getPath() + { + return $this->path; + } +} diff --git a/vendor/league/flysystem/src/Filesystem.php b/vendor/league/flysystem/src/Filesystem.php new file mode 100644 index 0000000..7e9881f --- /dev/null +++ b/vendor/league/flysystem/src/Filesystem.php @@ -0,0 +1,407 @@ +adapter = $adapter; + $this->setConfig($config); + } + + /** + * Get the Adapter. + * + * @return AdapterInterface adapter + */ + public function getAdapter() + { + return $this->adapter; + } + + /** + * @inheritdoc + */ + public function has($path) + { + $path = Util::normalizePath($path); + + return strlen($path) === 0 ? false : (bool) $this->getAdapter()->has($path); + } + + /** + * @inheritdoc + */ + public function write($path, $contents, array $config = []) + { + $path = Util::normalizePath($path); + $this->assertAbsent($path); + $config = $this->prepareConfig($config); + + return (bool) $this->getAdapter()->write($path, $contents, $config); + } + + /** + * @inheritdoc + */ + public function writeStream($path, $resource, array $config = []) + { + if ( ! is_resource($resource)) { + throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); + } + + $path = Util::normalizePath($path); + $this->assertAbsent($path); + $config = $this->prepareConfig($config); + + Util::rewindStream($resource); + + return (bool) $this->getAdapter()->writeStream($path, $resource, $config); + } + + /** + * @inheritdoc + */ + public function put($path, $contents, array $config = []) + { + $path = Util::normalizePath($path); + $config = $this->prepareConfig($config); + + if ( ! $this->getAdapter() instanceof CanOverwriteFiles && $this->has($path)) { + return (bool) $this->getAdapter()->update($path, $contents, $config); + } + + return (bool) $this->getAdapter()->write($path, $contents, $config); + } + + /** + * @inheritdoc + */ + public function putStream($path, $resource, array $config = []) + { + if ( ! is_resource($resource)) { + throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); + } + + $path = Util::normalizePath($path); + $config = $this->prepareConfig($config); + Util::rewindStream($resource); + + if ( ! $this->getAdapter() instanceof CanOverwriteFiles &&$this->has($path)) { + return (bool) $this->getAdapter()->updateStream($path, $resource, $config); + } + + return (bool) $this->getAdapter()->writeStream($path, $resource, $config); + } + + /** + * @inheritdoc + */ + public function readAndDelete($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + $contents = $this->read($path); + + if ($contents === false) { + return false; + } + + $this->delete($path); + + return $contents; + } + + /** + * @inheritdoc + */ + public function update($path, $contents, array $config = []) + { + $path = Util::normalizePath($path); + $config = $this->prepareConfig($config); + + $this->assertPresent($path); + + return (bool) $this->getAdapter()->update($path, $contents, $config); + } + + /** + * @inheritdoc + */ + public function updateStream($path, $resource, array $config = []) + { + if ( ! is_resource($resource)) { + throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); + } + + $path = Util::normalizePath($path); + $config = $this->prepareConfig($config); + $this->assertPresent($path); + Util::rewindStream($resource); + + return (bool) $this->getAdapter()->updateStream($path, $resource, $config); + } + + /** + * @inheritdoc + */ + public function read($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + if ( ! ($object = $this->getAdapter()->read($path))) { + return false; + } + + return $object['contents']; + } + + /** + * @inheritdoc + */ + public function readStream($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + if ( ! $object = $this->getAdapter()->readStream($path)) { + return false; + } + + return $object['stream']; + } + + /** + * @inheritdoc + */ + public function rename($path, $newpath) + { + $path = Util::normalizePath($path); + $newpath = Util::normalizePath($newpath); + $this->assertPresent($path); + $this->assertAbsent($newpath); + + return (bool) $this->getAdapter()->rename($path, $newpath); + } + + /** + * @inheritdoc + */ + public function copy($path, $newpath) + { + $path = Util::normalizePath($path); + $newpath = Util::normalizePath($newpath); + $this->assertPresent($path); + $this->assertAbsent($newpath); + + return $this->getAdapter()->copy($path, $newpath); + } + + /** + * @inheritdoc + */ + public function delete($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + return $this->getAdapter()->delete($path); + } + + /** + * @inheritdoc + */ + public function deleteDir($dirname) + { + $dirname = Util::normalizePath($dirname); + + if ($dirname === '') { + throw new RootViolationException('Root directories can not be deleted.'); + } + + return (bool) $this->getAdapter()->deleteDir($dirname); + } + + /** + * @inheritdoc + */ + public function createDir($dirname, array $config = []) + { + $dirname = Util::normalizePath($dirname); + $config = $this->prepareConfig($config); + + return (bool) $this->getAdapter()->createDir($dirname, $config); + } + + /** + * @inheritdoc + */ + public function listContents($directory = '', $recursive = false) + { + $directory = Util::normalizePath($directory); + $contents = $this->getAdapter()->listContents($directory, $recursive); + + return (new ContentListingFormatter($directory, $recursive))->formatListing($contents); + } + + /** + * @inheritdoc + */ + public function getMimetype($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + if (( ! $object = $this->getAdapter()->getMimetype($path)) || ! array_key_exists('mimetype', $object)) { + return false; + } + + return $object['mimetype']; + } + + /** + * @inheritdoc + */ + public function getTimestamp($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + if (( ! $object = $this->getAdapter()->getTimestamp($path)) || ! array_key_exists('timestamp', $object)) { + return false; + } + + return $object['timestamp']; + } + + /** + * @inheritdoc + */ + public function getVisibility($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + if (( ! $object = $this->getAdapter()->getVisibility($path)) || ! array_key_exists('visibility', $object)) { + return false; + } + + return $object['visibility']; + } + + /** + * @inheritdoc + */ + public function getSize($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + if (( ! $object = $this->getAdapter()->getSize($path)) || ! array_key_exists('size', $object)) { + return false; + } + + return (int) $object['size']; + } + + /** + * @inheritdoc + */ + public function setVisibility($path, $visibility) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + return (bool) $this->getAdapter()->setVisibility($path, $visibility); + } + + /** + * @inheritdoc + */ + public function getMetadata($path) + { + $path = Util::normalizePath($path); + $this->assertPresent($path); + + return $this->getAdapter()->getMetadata($path); + } + + /** + * @inheritdoc + */ + public function get($path, Handler $handler = null) + { + $path = Util::normalizePath($path); + + if ( ! $handler) { + $metadata = $this->getMetadata($path); + $handler = $metadata['type'] === 'file' ? new File($this, $path) : new Directory($this, $path); + } + + $handler->setPath($path); + $handler->setFilesystem($this); + + return $handler; + } + + /** + * Assert a file is present. + * + * @param string $path path to file + * + * @throws FileNotFoundException + * + * @return void + */ + public function assertPresent($path) + { + if ($this->config->get('disable_asserts', false) === false && ! $this->has($path)) { + throw new FileNotFoundException($path); + } + } + + /** + * Assert a file is absent. + * + * @param string $path path to file + * + * @throws FileExistsException + * + * @return void + */ + public function assertAbsent($path) + { + if ($this->config->get('disable_asserts', false) === false && $this->has($path)) { + throw new FileExistsException($path); + } + } +} diff --git a/vendor/league/flysystem/src/FilesystemInterface.php b/vendor/league/flysystem/src/FilesystemInterface.php new file mode 100644 index 0000000..09b811b --- /dev/null +++ b/vendor/league/flysystem/src/FilesystemInterface.php @@ -0,0 +1,284 @@ +path = $path; + $this->filesystem = $filesystem; + } + + /** + * Check whether the entree is a directory. + * + * @return bool + */ + public function isDir() + { + return $this->getType() === 'dir'; + } + + /** + * Check whether the entree is a file. + * + * @return bool + */ + public function isFile() + { + return $this->getType() === 'file'; + } + + /** + * Retrieve the entree type (file|dir). + * + * @return string file or dir + */ + public function getType() + { + $metadata = $this->filesystem->getMetadata($this->path); + + return $metadata['type']; + } + + /** + * Set the Filesystem object. + * + * @param FilesystemInterface $filesystem + * + * @return $this + */ + public function setFilesystem(FilesystemInterface $filesystem) + { + $this->filesystem = $filesystem; + + return $this; + } + + /** + * Retrieve the Filesystem object. + * + * @return FilesystemInterface + */ + public function getFilesystem() + { + return $this->filesystem; + } + + /** + * Set the entree path. + * + * @param string $path + * + * @return $this + */ + public function setPath($path) + { + $this->path = $path; + + return $this; + } + + /** + * Retrieve the entree path. + * + * @return string path + */ + public function getPath() + { + return $this->path; + } + + /** + * Plugins pass-through. + * + * @param string $method + * @param array $arguments + * + * @return mixed + */ + public function __call($method, array $arguments) + { + array_unshift($arguments, $this->path); + $callback = [$this->filesystem, $method]; + + try { + return call_user_func_array($callback, $arguments); + } catch (BadMethodCallException $e) { + throw new BadMethodCallException( + 'Call to undefined method ' + . get_called_class() + . '::' . $method + ); + } + } +} diff --git a/vendor/league/flysystem/src/MountManager.php b/vendor/league/flysystem/src/MountManager.php new file mode 100644 index 0000000..620f540 --- /dev/null +++ b/vendor/league/flysystem/src/MountManager.php @@ -0,0 +1,648 @@ + Filesystem,] + * + * @throws InvalidArgumentException + */ + public function __construct(array $filesystems = []) + { + $this->mountFilesystems($filesystems); + } + + /** + * Mount filesystems. + * + * @param FilesystemInterface[] $filesystems [:prefix => Filesystem,] + * + * @throws InvalidArgumentException + * + * @return $this + */ + public function mountFilesystems(array $filesystems) + { + foreach ($filesystems as $prefix => $filesystem) { + $this->mountFilesystem($prefix, $filesystem); + } + + return $this; + } + + /** + * Mount filesystems. + * + * @param string $prefix + * @param FilesystemInterface $filesystem + * + * @throws InvalidArgumentException + * + * @return $this + */ + public function mountFilesystem($prefix, FilesystemInterface $filesystem) + { + if ( ! is_string($prefix)) { + throw new InvalidArgumentException(__METHOD__ . ' expects argument #1 to be a string.'); + } + + $this->filesystems[$prefix] = $filesystem; + + return $this; + } + + /** + * Get the filesystem with the corresponding prefix. + * + * @param string $prefix + * + * @throws FilesystemNotFoundException + * + * @return FilesystemInterface + */ + public function getFilesystem($prefix) + { + if ( ! isset($this->filesystems[$prefix])) { + throw new FilesystemNotFoundException('No filesystem mounted with prefix ' . $prefix); + } + + return $this->filesystems[$prefix]; + } + + /** + * Retrieve the prefix from an arguments array. + * + * @param array $arguments + * + * @throws InvalidArgumentException + * + * @return array [:prefix, :arguments] + */ + public function filterPrefix(array $arguments) + { + if (empty($arguments)) { + throw new InvalidArgumentException('At least one argument needed'); + } + + $path = array_shift($arguments); + + if ( ! is_string($path)) { + throw new InvalidArgumentException('First argument should be a string'); + } + + list($prefix, $path) = $this->getPrefixAndPath($path); + array_unshift($arguments, $path); + + return [$prefix, $arguments]; + } + + /** + * @param string $directory + * @param bool $recursive + * + * @throws InvalidArgumentException + * @throws FilesystemNotFoundException + * + * @return array + */ + public function listContents($directory = '', $recursive = false) + { + list($prefix, $directory) = $this->getPrefixAndPath($directory); + $filesystem = $this->getFilesystem($prefix); + $result = $filesystem->listContents($directory, $recursive); + + foreach ($result as &$file) { + $file['filesystem'] = $prefix; + } + + return $result; + } + + /** + * Call forwarder. + * + * @param string $method + * @param array $arguments + * + * @throws InvalidArgumentException + * @throws FilesystemNotFoundException + * + * @return mixed + */ + public function __call($method, $arguments) + { + list($prefix, $arguments) = $this->filterPrefix($arguments); + + return $this->invokePluginOnFilesystem($method, $arguments, $prefix); + } + + /** + * @param string $from + * @param string $to + * @param array $config + * + * @throws InvalidArgumentException + * @throws FilesystemNotFoundException + * @throws FileExistsException + * + * @return bool + */ + public function copy($from, $to, array $config = []) + { + list($prefixFrom, $from) = $this->getPrefixAndPath($from); + + $buffer = $this->getFilesystem($prefixFrom)->readStream($from); + + if ($buffer === false) { + return false; + } + + list($prefixTo, $to) = $this->getPrefixAndPath($to); + + $result = $this->getFilesystem($prefixTo)->writeStream($to, $buffer, $config); + + if (is_resource($buffer)) { + fclose($buffer); + } + + return $result; + } + + /** + * List with plugin adapter. + * + * @param array $keys + * @param string $directory + * @param bool $recursive + * + * @throws InvalidArgumentException + * @throws FilesystemNotFoundException + * + * @return array + */ + public function listWith(array $keys = [], $directory = '', $recursive = false) + { + list($prefix, $directory) = $this->getPrefixAndPath($directory); + $arguments = [$keys, $directory, $recursive]; + + return $this->invokePluginOnFilesystem('listWith', $arguments, $prefix); + } + + /** + * Move a file. + * + * @param string $from + * @param string $to + * @param array $config + * + * @throws InvalidArgumentException + * @throws FilesystemNotFoundException + * + * @return bool + */ + public function move($from, $to, array $config = []) + { + list($prefixFrom, $pathFrom) = $this->getPrefixAndPath($from); + list($prefixTo, $pathTo) = $this->getPrefixAndPath($to); + + if ($prefixFrom === $prefixTo) { + $filesystem = $this->getFilesystem($prefixFrom); + $renamed = $filesystem->rename($pathFrom, $pathTo); + + if ($renamed && isset($config['visibility'])) { + return $filesystem->setVisibility($pathTo, $config['visibility']); + } + + return $renamed; + } + + $copied = $this->copy($from, $to, $config); + + if ($copied) { + return $this->delete($from); + } + + return false; + } + + /** + * Invoke a plugin on a filesystem mounted on a given prefix. + * + * @param string $method + * @param array $arguments + * @param string $prefix + * + * @throws FilesystemNotFoundException + * + * @return mixed + */ + public function invokePluginOnFilesystem($method, $arguments, $prefix) + { + $filesystem = $this->getFilesystem($prefix); + + try { + return $this->invokePlugin($method, $arguments, $filesystem); + } catch (PluginNotFoundException $e) { + // Let it pass, it's ok, don't panic. + } + + $callback = [$filesystem, $method]; + + return call_user_func_array($callback, $arguments); + } + + /** + * @param string $path + * + * @throws InvalidArgumentException + * + * @return string[] [:prefix, :path] + */ + protected function getPrefixAndPath($path) + { + if (strpos($path, '://') < 1) { + throw new InvalidArgumentException('No prefix detected in path: ' . $path); + } + + return explode('://', $path, 2); + } + + /** + * Check whether a file exists. + * + * @param string $path + * + * @return bool + */ + public function has($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->has($path); + } + + /** + * Read a file. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The file contents or false on failure. + */ + public function read($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->read($path); + } + + /** + * Retrieves a read-stream for a path. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return resource|false The path resource or false on failure. + */ + public function readStream($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->readStream($path); + } + + /** + * Get a file's metadata. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return array|false The file metadata or false on failure. + */ + public function getMetadata($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getMetadata($path); + } + + /** + * Get a file's size. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return int|false The file size or false on failure. + */ + public function getSize($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getSize($path); + } + + /** + * Get a file's mime-type. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The file mime-type or false on failure. + */ + public function getMimetype($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getMimetype($path); + } + + /** + * Get a file's timestamp. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The timestamp or false on failure. + */ + public function getTimestamp($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getTimestamp($path); + } + + /** + * Get a file's visibility. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The visibility (public|private) or false on failure. + */ + public function getVisibility($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getVisibility($path); + } + + /** + * Write a new file. + * + * @param string $path The path of the new file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @throws FileExistsException + * + * @return bool True on success, false on failure. + */ + public function write($path, $contents, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->write($path, $contents, $config); + } + + /** + * Write a new file using a stream. + * + * @param string $path The path of the new file. + * @param resource $resource The file handle. + * @param array $config An optional configuration array. + * + * @throws InvalidArgumentException If $resource is not a file handle. + * @throws FileExistsException + * + * @return bool True on success, false on failure. + */ + public function writeStream($path, $resource, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->writeStream($path, $resource, $config); + } + + /** + * Update an existing file. + * + * @param string $path The path of the existing file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function update($path, $contents, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->update($path, $contents, $config); + } + + /** + * Update an existing file using a stream. + * + * @param string $path The path of the existing file. + * @param resource $resource The file handle. + * @param array $config An optional configuration array. + * + * @throws InvalidArgumentException If $resource is not a file handle. + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function updateStream($path, $resource, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->updateStream($path, $resource, $config); + } + + /** + * Rename a file. + * + * @param string $path Path to the existing file. + * @param string $newpath The new path of the file. + * + * @throws FileExistsException Thrown if $newpath exists. + * @throws FileNotFoundException Thrown if $path does not exist. + * + * @return bool True on success, false on failure. + */ + public function rename($path, $newpath) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->rename($path, $newpath); + } + + /** + * Delete a file. + * + * @param string $path + * + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function delete($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->delete($path); + } + + /** + * Delete a directory. + * + * @param string $dirname + * + * @throws RootViolationException Thrown if $dirname is empty. + * + * @return bool True on success, false on failure. + */ + public function deleteDir($dirname) + { + list($prefix, $dirname) = $this->getPrefixAndPath($dirname); + + return $this->getFilesystem($prefix)->deleteDir($dirname); + } + + /** + * Create a directory. + * + * @param string $dirname The name of the new directory. + * @param array $config An optional configuration array. + * + * @return bool True on success, false on failure. + */ + public function createDir($dirname, array $config = []) + { + list($prefix, $dirname) = $this->getPrefixAndPath($dirname); + + return $this->getFilesystem($prefix)->createDir($dirname); + } + + /** + * Set the visibility for a file. + * + * @param string $path The path to the file. + * @param string $visibility One of 'public' or 'private'. + * + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function setVisibility($path, $visibility) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->setVisibility($path, $visibility); + } + + /** + * Create a file or update if exists. + * + * @param string $path The path to the file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @return bool True on success, false on failure. + */ + public function put($path, $contents, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->put($path, $contents, $config); + } + + /** + * Create a file or update if exists. + * + * @param string $path The path to the file. + * @param resource $resource The file handle. + * @param array $config An optional configuration array. + * + * @throws InvalidArgumentException Thrown if $resource is not a resource. + * + * @return bool True on success, false on failure. + */ + public function putStream($path, $resource, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->putStream($path, $resource, $config); + } + + /** + * Read and delete a file. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The file contents, or false on failure. + */ + public function readAndDelete($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->readAndDelete($path); + } + + /** + * Get a file/directory handler. + * + * @deprecated + * + * @param string $path The path to the file. + * @param Handler $handler An optional existing handler to populate. + * + * @return Handler Either a file or directory handler. + */ + public function get($path, Handler $handler = null) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->get($path); + } +} diff --git a/vendor/league/flysystem/src/NotSupportedException.php b/vendor/league/flysystem/src/NotSupportedException.php new file mode 100644 index 0000000..08f47f7 --- /dev/null +++ b/vendor/league/flysystem/src/NotSupportedException.php @@ -0,0 +1,37 @@ +getPathname()); + } + + /** + * Create a new exception for a link. + * + * @param string $systemType + * + * @return static + */ + public static function forFtpSystemType($systemType) + { + $message = "The FTP system type '$systemType' is currently not supported."; + + return new static($message); + } +} diff --git a/vendor/league/flysystem/src/Plugin/AbstractPlugin.php b/vendor/league/flysystem/src/Plugin/AbstractPlugin.php new file mode 100644 index 0000000..0d56789 --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/AbstractPlugin.php @@ -0,0 +1,24 @@ +filesystem = $filesystem; + } +} diff --git a/vendor/league/flysystem/src/Plugin/EmptyDir.php b/vendor/league/flysystem/src/Plugin/EmptyDir.php new file mode 100644 index 0000000..b5ae7f5 --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/EmptyDir.php @@ -0,0 +1,34 @@ +filesystem->listContents($dirname, false); + + foreach ($listing as $item) { + if ($item['type'] === 'dir') { + $this->filesystem->deleteDir($item['path']); + } else { + $this->filesystem->delete($item['path']); + } + } + } +} diff --git a/vendor/league/flysystem/src/Plugin/ForcedCopy.php b/vendor/league/flysystem/src/Plugin/ForcedCopy.php new file mode 100644 index 0000000..a41e9f3 --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/ForcedCopy.php @@ -0,0 +1,44 @@ +filesystem->delete($newpath); + } catch (FileNotFoundException $e) { + // The destination path does not exist. That's ok. + $deleted = true; + } + + if ($deleted) { + return $this->filesystem->copy($path, $newpath); + } + + return false; + } +} diff --git a/vendor/league/flysystem/src/Plugin/ForcedRename.php b/vendor/league/flysystem/src/Plugin/ForcedRename.php new file mode 100644 index 0000000..3f51cd6 --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/ForcedRename.php @@ -0,0 +1,44 @@ +filesystem->delete($newpath); + } catch (FileNotFoundException $e) { + // The destination path does not exist. That's ok. + $deleted = true; + } + + if ($deleted) { + return $this->filesystem->rename($path, $newpath); + } + + return false; + } +} diff --git a/vendor/league/flysystem/src/Plugin/GetWithMetadata.php b/vendor/league/flysystem/src/Plugin/GetWithMetadata.php new file mode 100644 index 0000000..6fe4f05 --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/GetWithMetadata.php @@ -0,0 +1,51 @@ +filesystem->getMetadata($path); + + if ( ! $object) { + return false; + } + + $keys = array_diff($metadata, array_keys($object)); + + foreach ($keys as $key) { + if ( ! method_exists($this->filesystem, $method = 'get' . ucfirst($key))) { + throw new InvalidArgumentException('Could not fetch metadata: ' . $key); + } + + $object[$key] = $this->filesystem->{$method}($path); + } + + return $object; + } +} diff --git a/vendor/league/flysystem/src/Plugin/ListFiles.php b/vendor/league/flysystem/src/Plugin/ListFiles.php new file mode 100644 index 0000000..9669fe7 --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/ListFiles.php @@ -0,0 +1,35 @@ +filesystem->listContents($directory, $recursive); + + $filter = function ($object) { + return $object['type'] === 'file'; + }; + + return array_values(array_filter($contents, $filter)); + } +} diff --git a/vendor/league/flysystem/src/Plugin/ListPaths.php b/vendor/league/flysystem/src/Plugin/ListPaths.php new file mode 100644 index 0000000..514bdf0 --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/ListPaths.php @@ -0,0 +1,36 @@ +filesystem->listContents($directory, $recursive); + + foreach ($contents as $object) { + $result[] = $object['path']; + } + + return $result; + } +} diff --git a/vendor/league/flysystem/src/Plugin/ListWith.php b/vendor/league/flysystem/src/Plugin/ListWith.php new file mode 100644 index 0000000..d90464e --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/ListWith.php @@ -0,0 +1,60 @@ +filesystem->listContents($directory, $recursive); + + foreach ($contents as $index => $object) { + if ($object['type'] === 'file') { + $missingKeys = array_diff($keys, array_keys($object)); + $contents[$index] = array_reduce($missingKeys, [$this, 'getMetadataByName'], $object); + } + } + + return $contents; + } + + /** + * Get a meta-data value by key name. + * + * @param array $object + * @param string $key + * + * @return array + */ + protected function getMetadataByName(array $object, $key) + { + $method = 'get' . ucfirst($key); + + if ( ! method_exists($this->filesystem, $method)) { + throw new \InvalidArgumentException('Could not get meta-data for key: ' . $key); + } + + $object[$key] = $this->filesystem->{$method}($object['path']); + + return $object; + } +} diff --git a/vendor/league/flysystem/src/Plugin/PluggableTrait.php b/vendor/league/flysystem/src/Plugin/PluggableTrait.php new file mode 100644 index 0000000..922edfe --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/PluggableTrait.php @@ -0,0 +1,97 @@ +plugins[$plugin->getMethod()] = $plugin; + + return $this; + } + + /** + * Find a specific plugin. + * + * @param string $method + * + * @throws PluginNotFoundException + * + * @return PluginInterface + */ + protected function findPlugin($method) + { + if ( ! isset($this->plugins[$method])) { + throw new PluginNotFoundException('Plugin not found for method: ' . $method); + } + + return $this->plugins[$method]; + } + + /** + * Invoke a plugin by method name. + * + * @param string $method + * @param array $arguments + * @param FilesystemInterface $filesystem + * + * @throws PluginNotFoundException + * + * @return mixed + */ + protected function invokePlugin($method, array $arguments, FilesystemInterface $filesystem) + { + $plugin = $this->findPlugin($method); + $plugin->setFilesystem($filesystem); + $callback = [$plugin, 'handle']; + + return call_user_func_array($callback, $arguments); + } + + /** + * Plugins pass-through. + * + * @param string $method + * @param array $arguments + * + * @throws BadMethodCallException + * + * @return mixed + */ + public function __call($method, array $arguments) + { + try { + return $this->invokePlugin($method, $arguments, $this); + } catch (PluginNotFoundException $e) { + throw new BadMethodCallException( + 'Call to undefined method ' + . get_class($this) + . '::' . $method + ); + } + } +} diff --git a/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php b/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php new file mode 100644 index 0000000..fd1d7e7 --- /dev/null +++ b/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php @@ -0,0 +1,10 @@ +hash = spl_object_hash($this); + static::$safeStorage[$this->hash] = []; + } + + public function storeSafely($key, $value) + { + static::$safeStorage[$this->hash][$key] = $value; + } + + public function retrieveSafely($key) + { + if (array_key_exists($key, static::$safeStorage[$this->hash])) { + return static::$safeStorage[$this->hash][$key]; + } + } + + public function __destruct() + { + unset(static::$safeStorage[$this->hash]); + } +} diff --git a/vendor/league/flysystem/src/UnreadableFileException.php b/vendor/league/flysystem/src/UnreadableFileException.php new file mode 100644 index 0000000..e668033 --- /dev/null +++ b/vendor/league/flysystem/src/UnreadableFileException.php @@ -0,0 +1,18 @@ +getRealPath() + ) + ); + } +} diff --git a/vendor/league/flysystem/src/Util.php b/vendor/league/flysystem/src/Util.php new file mode 100644 index 0000000..46dad86 --- /dev/null +++ b/vendor/league/flysystem/src/Util.php @@ -0,0 +1,348 @@ + '']; + } + + /** + * Normalize a dirname return value. + * + * @param string $dirname + * + * @return string normalized dirname + */ + public static function normalizeDirname($dirname) + { + return $dirname === '.' ? '' : $dirname; + } + + /** + * Get a normalized dirname from a path. + * + * @param string $path + * + * @return string dirname + */ + public static function dirname($path) + { + return static::normalizeDirname(dirname($path)); + } + + /** + * Map result arrays. + * + * @param array $object + * @param array $map + * + * @return array mapped result + */ + public static function map(array $object, array $map) + { + $result = []; + + foreach ($map as $from => $to) { + if ( ! isset($object[$from])) { + continue; + } + + $result[$to] = $object[$from]; + } + + return $result; + } + + /** + * Normalize path. + * + * @param string $path + * + * @throws LogicException + * + * @return string + */ + public static function normalizePath($path) + { + return static::normalizeRelativePath($path); + } + + /** + * Normalize relative directories in a path. + * + * @param string $path + * + * @throws LogicException + * + * @return string + */ + public static function normalizeRelativePath($path) + { + $path = str_replace('\\', '/', $path); + $path = static::removeFunkyWhiteSpace($path); + + $parts = []; + + foreach (explode('/', $path) as $part) { + switch ($part) { + case '': + case '.': + break; + + case '..': + if (empty($parts)) { + throw new LogicException( + 'Path is outside of the defined root, path: [' . $path . ']' + ); + } + array_pop($parts); + break; + + default: + $parts[] = $part; + break; + } + } + + return implode('/', $parts); + } + + /** + * Removes unprintable characters and invalid unicode characters. + * + * @param string $path + * + * @return string $path + */ + protected static function removeFunkyWhiteSpace($path) { + // We do this check in a loop, since removing invalid unicode characters + // can lead to new characters being created. + while (preg_match('#\p{C}+|^\./#u', $path)) { + $path = preg_replace('#\p{C}+|^\./#u', '', $path); + } + + return $path; + } + + /** + * Normalize prefix. + * + * @param string $prefix + * @param string $separator + * + * @return string normalized path + */ + public static function normalizePrefix($prefix, $separator) + { + return rtrim($prefix, $separator) . $separator; + } + + /** + * Get content size. + * + * @param string $contents + * + * @return int content size + */ + public static function contentSize($contents) + { + return defined('MB_OVERLOAD_STRING') ? mb_strlen($contents, '8bit') : strlen($contents); + } + + /** + * Guess MIME Type based on the path of the file and it's content. + * + * @param string $path + * @param string|resource $content + * + * @return string|null MIME Type or NULL if no extension detected + */ + public static function guessMimeType($path, $content) + { + $mimeType = MimeType::detectByContent($content); + + if ( ! (empty($mimeType) || in_array($mimeType, ['application/x-empty', 'text/plain', 'text/x-asm']))) { + return $mimeType; + } + + return MimeType::detectByFilename($path); + } + + /** + * Emulate directories. + * + * @param array $listing + * + * @return array listing with emulated directories + */ + public static function emulateDirectories(array $listing) + { + $directories = []; + $listedDirectories = []; + + foreach ($listing as $object) { + list($directories, $listedDirectories) = static::emulateObjectDirectories($object, $directories, $listedDirectories); + } + + $directories = array_diff(array_unique($directories), array_unique($listedDirectories)); + + foreach ($directories as $directory) { + $listing[] = static::pathinfo($directory) + ['type' => 'dir']; + } + + return $listing; + } + + /** + * Ensure a Config instance. + * + * @param null|array|Config $config + * + * @return Config config instance + * + * @throw LogicException + */ + public static function ensureConfig($config) + { + if ($config === null) { + return new Config(); + } + + if ($config instanceof Config) { + return $config; + } + + if (is_array($config)) { + return new Config($config); + } + + throw new LogicException('A config should either be an array or a Flysystem\Config object.'); + } + + /** + * Rewind a stream. + * + * @param resource $resource + */ + public static function rewindStream($resource) + { + if (ftell($resource) !== 0 && static::isSeekableStream($resource)) { + rewind($resource); + } + } + + public static function isSeekableStream($resource) + { + $metadata = stream_get_meta_data($resource); + + return $metadata['seekable']; + } + + /** + * Get the size of a stream. + * + * @param resource $resource + * + * @return int stream size + */ + public static function getStreamSize($resource) + { + $stat = fstat($resource); + + return $stat['size']; + } + + /** + * Emulate the directories of a single object. + * + * @param array $object + * @param array $directories + * @param array $listedDirectories + * + * @return array + */ + protected static function emulateObjectDirectories(array $object, array $directories, array $listedDirectories) + { + if ($object['type'] === 'dir') { + $listedDirectories[] = $object['path']; + } + + if (empty($object['dirname'])) { + return [$directories, $listedDirectories]; + } + + $parent = $object['dirname']; + + while ( ! empty($parent) && ! in_array($parent, $directories)) { + $directories[] = $parent; + $parent = static::dirname($parent); + } + + if (isset($object['type']) && $object['type'] === 'dir') { + $listedDirectories[] = $object['path']; + + return [$directories, $listedDirectories]; + } + + return [$directories, $listedDirectories]; + } + + /** + * Returns the trailing name component of the path. + * + * @param string $path + * + * @return string + */ + private static function basename($path) + { + $separators = DIRECTORY_SEPARATOR === '/' ? '/' : '\/'; + + $path = rtrim($path, $separators); + + $basename = preg_replace('#.*?([^' . preg_quote($separators, '#') . ']+$)#', '$1', $path); + + if (DIRECTORY_SEPARATOR === '/') { + return $basename; + } + // @codeCoverageIgnoreStart + // Extra Windows path munging. This is tested via AppVeyor, but code + // coverage is not reported. + + // Handle relative paths with drive letters. c:file.txt. + while (preg_match('#^[a-zA-Z]{1}:[^\\\/]#', $basename)) { + $basename = substr($basename, 2); + } + + // Remove colon for standalone drive letter names. + if (preg_match('#^[a-zA-Z]{1}:$#', $basename)) { + $basename = rtrim($basename, ':'); + } + + return $basename; + // @codeCoverageIgnoreEnd + } +} diff --git a/vendor/league/flysystem/src/Util/ContentListingFormatter.php b/vendor/league/flysystem/src/Util/ContentListingFormatter.php new file mode 100644 index 0000000..5a8c95a --- /dev/null +++ b/vendor/league/flysystem/src/Util/ContentListingFormatter.php @@ -0,0 +1,116 @@ +directory = $directory; + $this->recursive = $recursive; + } + + /** + * Format contents listing. + * + * @param array $listing + * + * @return array + */ + public function formatListing(array $listing) + { + $listing = array_values( + array_map( + [$this, 'addPathInfo'], + array_filter($listing, [$this, 'isEntryOutOfScope']) + ) + ); + + return $this->sortListing($listing); + } + + private function addPathInfo(array $entry) + { + return $entry + Util::pathinfo($entry['path']); + } + + /** + * Determine if the entry is out of scope. + * + * @param array $entry + * + * @return bool + */ + private function isEntryOutOfScope(array $entry) + { + if (empty($entry['path']) && $entry['path'] !== '0') { + return false; + } + + if ($this->recursive) { + return $this->residesInDirectory($entry); + } + + return $this->isDirectChild($entry); + } + + /** + * Check if the entry resides within the parent directory. + * + * @param array $entry + * + * @return bool + */ + private function residesInDirectory(array $entry) + { + if ($this->directory === '') { + return true; + } + + return strpos($entry['path'], $this->directory . '/') === 0; + } + + /** + * Check if the entry is a direct child of the directory. + * + * @param array $entry + * + * @return bool + */ + private function isDirectChild(array $entry) + { + return Util::dirname($entry['path']) === $this->directory; + } + + /** + * @param array $listing + * + * @return array + */ + private function sortListing(array $listing) + { + usort($listing, function ($a, $b) { + return strcasecmp($a['path'], $b['path']); + }); + + return $listing; + } +} diff --git a/vendor/league/flysystem/src/Util/MimeType.php b/vendor/league/flysystem/src/Util/MimeType.php new file mode 100644 index 0000000..254bc2a --- /dev/null +++ b/vendor/league/flysystem/src/Util/MimeType.php @@ -0,0 +1,228 @@ + 'application/mac-binhex40', + 'cpt' => 'application/mac-compactpro', + 'csv' => 'text/x-comma-separated-values', + 'bin' => 'application/octet-stream', + 'dms' => 'application/octet-stream', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'exe' => 'application/octet-stream', + 'class' => 'application/octet-stream', + 'psd' => 'application/x-photoshop', + 'so' => 'application/octet-stream', + 'sea' => 'application/octet-stream', + 'dll' => 'application/octet-stream', + 'oda' => 'application/oda', + 'pdf' => 'application/pdf', + 'ai' => 'application/pdf', + 'eps' => 'application/postscript', + 'epub' => 'application/epub+zip', + 'ps' => 'application/postscript', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'mif' => 'application/vnd.mif', + 'xls' => 'application/vnd.ms-excel', + 'ppt' => 'application/powerpoint', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'wbxml' => 'application/wbxml', + 'wmlc' => 'application/wmlc', + 'dcr' => 'application/x-director', + 'dir' => 'application/x-director', + 'dxr' => 'application/x-director', + 'dvi' => 'application/x-dvi', + 'gtar' => 'application/x-gtar', + 'gz' => 'application/x-gzip', + 'gzip' => 'application/x-gzip', + 'php' => 'application/x-httpd-php', + 'php4' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'phtml' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'js' => 'application/javascript', + 'swf' => 'application/x-shockwave-flash', + 'sit' => 'application/x-stuffit', + 'tar' => 'application/x-tar', + 'tgz' => 'application/x-tar', + 'z' => 'application/x-compress', + 'xhtml' => 'application/xhtml+xml', + 'xht' => 'application/xhtml+xml', + 'rdf' => 'application/rdf+xml', + 'zip' => 'application/x-zip', + 'rar' => 'application/x-rar', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mpga' => 'audio/mpeg', + 'mp2' => 'audio/mpeg', + 'mp3' => 'audio/mpeg', + 'aif' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'ram' => 'audio/x-pn-realaudio', + 'rm' => 'audio/x-pn-realaudio', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'ra' => 'audio/x-realaudio', + 'rv' => 'video/vnd.rn-realvideo', + 'wav' => 'audio/x-wav', + 'jpg' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpe' => 'image/jpeg', + 'png' => 'image/png', + 'gif' => 'image/gif', + 'bmp' => 'image/bmp', + 'tiff' => 'image/tiff', + 'tif' => 'image/tiff', + 'svg' => 'image/svg+xml', + 'css' => 'text/css', + 'html' => 'text/html', + 'htm' => 'text/html', + 'shtml' => 'text/html', + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'log' => 'text/plain', + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'xml' => 'application/xml', + 'xsl' => 'application/xml', + 'dmn' => 'application/octet-stream', + 'bpmn' => 'application/octet-stream', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'qt' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'avi' => 'video/x-msvideo', + 'movie' => 'video/x-sgi-movie', + 'doc' => 'application/msword', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'docm' => 'application/vnd.ms-word.template.macroEnabled.12', + 'dot' => 'application/msword', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'word' => 'application/msword', + 'xl' => 'application/excel', + 'eml' => 'message/rfc822', + 'json' => 'application/json', + 'pem' => 'application/x-x509-user-cert', + 'p10' => 'application/x-pkcs10', + 'p12' => 'application/x-pkcs12', + 'p7a' => 'application/x-pkcs7-signature', + 'p7c' => 'application/pkcs7-mime', + 'p7m' => 'application/pkcs7-mime', + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'crt' => 'application/x-x509-ca-cert', + 'crl' => 'application/pkix-crl', + 'der' => 'application/x-x509-ca-cert', + 'kdb' => 'application/octet-stream', + 'pgp' => 'application/pgp', + 'gpg' => 'application/gpg-keys', + 'sst' => 'application/octet-stream', + 'csr' => 'application/octet-stream', + 'rsa' => 'application/x-pkcs7', + 'cer' => 'application/pkix-cert', + '3g2' => 'video/3gpp2', + '3gp' => 'video/3gp', + 'mp4' => 'video/mp4', + 'm4a' => 'audio/x-m4a', + 'f4v' => 'video/mp4', + 'webm' => 'video/webm', + 'aac' => 'audio/x-acc', + 'm4u' => 'application/vnd.mpegurl', + 'm3u' => 'text/plain', + 'xspf' => 'application/xspf+xml', + 'vlc' => 'application/videolan', + 'wmv' => 'video/x-ms-wmv', + 'au' => 'audio/x-au', + 'ac3' => 'audio/ac3', + 'flac' => 'audio/x-flac', + 'ogg' => 'audio/ogg', + 'kmz' => 'application/vnd.google-earth.kmz', + 'kml' => 'application/vnd.google-earth.kml+xml', + 'ics' => 'text/calendar', + 'zsh' => 'text/x-scriptzsh', + '7zip' => 'application/x-7z-compressed', + 'cdr' => 'application/cdr', + 'wma' => 'audio/x-ms-wma', + 'jar' => 'application/java-archive', + 'tex' => 'application/x-tex', + 'latex' => 'application/x-latex', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'odb' => 'application/vnd.oasis.opendocument.database', + 'ott' => 'application/vnd.oasis.opendocument.text-template', + ]; + + /** + * Detects MIME Type based on given content. + * + * @param mixed $content + * + * @return string|null MIME Type or NULL if no mime type detected + */ + public static function detectByContent($content) + { + if ( ! class_exists('finfo') || ! is_string($content)) { + return null; + } + try { + $finfo = new finfo(FILEINFO_MIME_TYPE); + + return $finfo->buffer($content) ?: null; + // @codeCoverageIgnoreStart + } catch( ErrorException $e ) { + // This is caused by an array to string conversion error. + } + } // @codeCoverageIgnoreEnd + + /** + * Detects MIME Type based on file extension. + * + * @param string $extension + * + * @return string|null MIME Type or NULL if no extension detected + */ + public static function detectByFileExtension($extension) + { + return isset(static::$extensionToMimeTypeMap[$extension]) + ? static::$extensionToMimeTypeMap[$extension] + : 'text/plain'; + } + + /** + * @param string $filename + * + * @return string|null MIME Type or NULL if no extension detected + */ + public static function detectByFilename($filename) + { + $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); + + return empty($extension) ? 'text/plain' : static::detectByFileExtension($extension); + } + + /** + * @return array Map of file extension to MIME Type + */ + public static function getExtensionToMimeTypeMap() + { + return static::$extensionToMimeTypeMap; + } +} diff --git a/vendor/league/flysystem/src/Util/StreamHasher.php b/vendor/league/flysystem/src/Util/StreamHasher.php new file mode 100644 index 0000000..938ec5d --- /dev/null +++ b/vendor/league/flysystem/src/Util/StreamHasher.php @@ -0,0 +1,36 @@ +algo = $algo; + } + + /** + * @param resource $resource + * + * @return string + */ + public function hash($resource) + { + rewind($resource); + $context = hash_init($this->algo); + hash_update_stream($context, $resource); + fclose($resource); + + return hash_final($context); + } +} diff --git a/vendor/mockery/mockery/.gitignore b/vendor/mockery/mockery/.gitignore new file mode 100644 index 0000000..062facc --- /dev/null +++ b/vendor/mockery/mockery/.gitignore @@ -0,0 +1,15 @@ +*~ +pearfarm.spec +*.sublime-project +library/Hamcrest/* +composer.lock +vendor/ +composer.phar +test.php +build/ +phpunit.xml +*.DS_store +.idea/* +.php_cs.cache +docs/api +phpDocumentor.phar* diff --git a/vendor/mockery/mockery/.php_cs b/vendor/mockery/mockery/.php_cs new file mode 100644 index 0000000..be098ba --- /dev/null +++ b/vendor/mockery/mockery/.php_cs @@ -0,0 +1,30 @@ +in([ + 'library', + 'tests', + ]); + + return PhpCsFixer\Config::create() + ->setRules(array( + '@PSR2' => true, + )) + ->setUsingCache(true) + ->setFinder($finder) + ; +} + +$finder = DefaultFinder::create()->in( + [ + 'library', + 'tests', + ]); + +return Config::create() + ->level('psr2') + ->setUsingCache(true) + ->finder($finder); diff --git a/vendor/mockery/mockery/.phpstorm.meta.php b/vendor/mockery/mockery/.phpstorm.meta.php new file mode 100644 index 0000000..6c53f80 --- /dev/null +++ b/vendor/mockery/mockery/.phpstorm.meta.php @@ -0,0 +1,11 @@ +> ~/.phpenv/versions/"$(phpenv version-name)"/etc/conf.d/travis.ini + fi + +script: +- | + if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then + ./vendor/bin/phpunit --coverage-text --coverage-clover="build/logs/clover.xml" --testsuite="Mockery Test Suite PHP56"; + else + ./vendor/bin/phpunit --coverage-text --coverage-clover="build/logs/clover.xml" --testsuite="Mockery Test Suite"; + fi + +after_success: + - composer require satooshi/php-coveralls + - vendor/bin/coveralls -v + - wget https://scrutinizer-ci.com/ocular.phar + - php ocular.phar code-coverage:upload --format=php-clover "build/logs/clover.xml" + - make apidocs + +notifications: + email: + - padraic.brady@gmail.com + - dave@atstsolutions.co.uk + + irc: irc.freenode.org#mockery +deploy: + overwrite: true + provider: pages + file_glob: true + file: docs/api/* + local_dir: docs/api + skip_cleanup: true + github_token: $GITHUB_TOKEN + on: + branch: master + php: '7.1' + condition: $DEPS = latest diff --git a/vendor/mockery/mockery/CHANGELOG.md b/vendor/mockery/mockery/CHANGELOG.md new file mode 100644 index 0000000..ba8a3e6 --- /dev/null +++ b/vendor/mockery/mockery/CHANGELOG.md @@ -0,0 +1,106 @@ +# Change Log + +## x.y.z (unreleased) + +## 1.2.0 (2018-10-02) + +* Starts counting default expectations towards count (#910) +* Adds workaround for some HHVM return types (#909) +* Adds PhpStorm metadata support for autocomplete etc (#904) +* Further attempts to support multiple PHPUnit versions (#903) +* Allows setting constructor expectations on instance mocks (#900) +* Adds workaround for HHVM memoization decorator (#893) +* Adds experimental support for callable spys (#712) + +## 1.1.0 (2018-05-08) + +* Allows use of string method names in allows and expects (#794) +* Finalises allows and expects syntax in API (#799) +* Search for handlers in a case instensitive way (#801) +* Deprecate allowMockingMethodsUnnecessarily (#808) +* Fix risky tests (#769) +* Fix namespace in TestListener (#812) +* Fixed conflicting mock names (#813) +* Clean elses (#819) +* Updated protected method mocking exception message (#826) +* Map of constants to mock (#829) +* Simplify foreach with `in_array` function (#830) +* Typehinted return value on Expectation#verify. (#832) +* Fix shouldNotHaveReceived with HigherOrderMessage (#842) +* Deprecates shouldDeferMissing (#839) +* Adds support for return type hints in Demeter chains (#848) +* Adds shouldNotReceive to composite expectation (#847) +* Fix internal error when using --static-backup (#845) +* Adds `andAnyOtherArgs` as an optional argument matcher (#860) +* Fixes namespace qualifying with namespaced named mocks (#872) +* Added possibility to add Constructor-Expections on hard dependencies, read: Mockery::mock('overload:...') (#781) + +## 1.0.0 (2017-09-06) + +* Destructors (`__destruct`) are stubbed out where it makes sense +* Allow passing a closure argument to `withArgs()` to validate multiple arguments at once. +* `Mockery\Adapter\Phpunit\TestListener` has been rewritten because it + incorrectly marked some tests as risky. It will no longer verify mock + expectations but instead check that tests do that themselves. PHPUnit 6 is + required if you want to use this fail safe. +* Removes SPL Class Loader +* Removed object recorder feature +* Bumped minimum PHP version to 5.6 +* `andThrow` will now throw anything `\Throwable` +* Adds `allows` and `expects` syntax +* Adds optional global helpers for `mock`, `namedMock` and `spy` +* Adds ability to create objects using traits +* `Mockery\Matcher\MustBe` was deprecated +* Marked `Mockery\MockInterface` as internal +* Subset matcher matches recursively +* BC BREAK - Spies return `null` by default from ignored (non-mocked) methods with nullable return type +* Removed extracting getter methods of object instances +* BC BREAK - Remove implicit regex matching when trying to match string arguments, introduce `\Mockery::pattern()` when regex matching is needed +* Fix Mockery not getting closed in cases of failing test cases +* Fix Mockery not setting properties on overloaded instance mocks +* BC BREAK - Fix Mockery not trying default expectations if there is any concrete expectation +* BC BREAK - Mockery's PHPUnit integration will mark a test as risky if it + thinks one it's exceptions has been swallowed in PHPUnit > 5.7.6. Use `$e->dismiss()` to dismiss. + +## 0.9.4 (XXXX-XX-XX) + +* `shouldIgnoreMissing` will respect global `allowMockingNonExistentMethods` + config +* Some support for variadic parameters +* Hamcrest is now a required dependency +* Instance mocks now respect `shouldIgnoreMissing` call on control instance +* This will be the *last version to support PHP 5.3* +* Added `Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration` trait +* Added `makePartial` to `Mockery\MockInterface` as it was missing + +## 0.9.3 (2014-12-22) + +* Added a basic spy implementation +* Added `Mockery\Adapter\Phpunit\MockeryTestCase` for more reliable PHPUnit + integration + +## 0.9.2 (2014-09-03) + +* Some workarounds for the serialisation problems created by changes to PHP in 5.5.13, 5.4.29, + 5.6. +* Demeter chains attempt to reuse doubles as they see fit, so for foo->bar and + foo->baz, we'll attempt to use the same foo + +## 0.9.1 (2014-05-02) + +* Allow specifying consecutive exceptions to be thrown with `andThrowExceptions` +* Allow specifying methods which can be mocked when using + `Mockery\Configuration::allowMockingNonExistentMethods(false)` with + `Mockery\MockInterface::shouldAllowMockingMethod($methodName)` +* Added andReturnSelf method: `$mock->shouldReceive("foo")->andReturnSelf()` +* `shouldIgnoreMissing` now takes an optional value that will be return instead + of null, e.g. `$mock->shouldIgnoreMissing($mock)` + +## 0.9.0 (2014-02-05) + +* Allow mocking classes with final __wakeup() method +* Quick definitions are now always `byDefault` +* Allow mocking of protected methods with `shouldAllowMockingProtectedMethods` +* Support official Hamcrest package +* Generator completely rewritten +* Easily create named mocks with namedMock diff --git a/vendor/mockery/mockery/CONTRIBUTING.md b/vendor/mockery/mockery/CONTRIBUTING.md new file mode 100644 index 0000000..b714f3f --- /dev/null +++ b/vendor/mockery/mockery/CONTRIBUTING.md @@ -0,0 +1,88 @@ +# Contributing + + +We'd love you to help out with mockery and no contribution is too small. + + +## Reporting Bugs + +Issues can be reported on the [issue +tracker](https://github.com/padraic/mockery/issues). Please try and report any +bugs with a minimal reproducible example, it will make things easier for other +contributors and your problems will hopefully be resolved quickly. + + +## Requesting Features + +We're always interested to hear about your ideas and you can request features by +creating a ticket in the [issue +tracker](https://github.com/padraic/mockery/issues). We can't always guarantee +someone will jump on it straight away, but putting it out there to see if anyone +else is interested is a good idea. + +Likewise, if a feature you would like is already listed in +the issue tracker, add a :+1: so that other contributors know it's a feature +that would help others. + + +## Contributing code and documentation + +We loosely follow the +[PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) +and +[PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) coding standards, +but we'll probably merge any code that looks close enough. + +* Fork the [repository](https://github.com/padraic/mockery) on GitHub +* Add the code for your feature or bug +* Add some tests for your feature or bug +* Optionally, but preferably, write some documentation +* Optionally, update the CHANGELOG.md file with your feature or + [BC](http://en.wikipedia.org/wiki/Backward_compatibility) break +* Send a [Pull + Request](https://help.github.com/articles/creating-a-pull-request) to the + correct target branch (see below) + +If you have a big change or would like to discuss something, create an issue in +the [issue tracker](https://github.com/padraic/mockery/issues) or jump in to +\#mockery on freenode + + +Any code you contribute must be licensed under the [BSD 3-Clause +License](http://opensource.org/licenses/BSD-3-Clause). + + +## Target Branch + +Mockery may have several active branches at any one time and roughly follows a +[Git Branching Model](https://igor.io/2013/10/21/git-branching-model.html). +Generally, if you're developing a new feature, you want to be targeting the +master branch, if it's a bug fix, you want to be targeting a release branch, +e.g. 0.8. + + +## Testing Mockery + +To run the unit tests for Mockery, clone the git repository, download Composer using +the instructions at [http://getcomposer.org/download/](http://getcomposer.org/download/), +then install the dependencies with `php /path/to/composer.phar install`. + +This will install the required PHPUnit and Hamcrest dev dependencies and create the +autoload files required by the unit tests. You may run the `vendor/bin/phpunit` command +to run the unit tests. If everything goes to plan, there will be no failed tests! + + +## Debugging Mockery + +Mockery and its code generation can be difficult to debug. A good start is to +use the `RequireLoader`, which will dump the code generated by mockery to a file +before requiring it, rather than using eval. This will help with stack traces, +and you will be able to open the mock class in your editor. + +``` php + +// tests/bootstrap.php + +Mockery::setLoader(new Mockery\Loader\RequireLoader(sys_get_temp_dir())); + +``` diff --git a/vendor/mockery/mockery/LICENSE b/vendor/mockery/mockery/LICENSE new file mode 100644 index 0000000..2e127a6 --- /dev/null +++ b/vendor/mockery/mockery/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2010, Pádraic Brady +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * The name of Pádraic Brady may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/mockery/mockery/Makefile b/vendor/mockery/mockery/Makefile new file mode 100644 index 0000000..c312f70 --- /dev/null +++ b/vendor/mockery/mockery/Makefile @@ -0,0 +1,52 @@ +vendor/composer/installed.json: composer.json + composer install + +.PHONY: deps +deps: vendor/composer/installed.json + +.PHONY: test +test: deps + php vendor/bin/phpunit + +.PHONY: apidocs +apidocs: docs/api/index.html + +phpDocumentor.phar: + wget https://github.com/phpDocumentor/phpDocumentor2/releases/download/v3.0.0-alpha.2-nightly-gdff5545/phpDocumentor.phar + wget https://github.com/phpDocumentor/phpDocumentor2/releases/download/v3.0.0-alpha.2-nightly-gdff5545/phpDocumentor.phar.pubkey + +library_files=$(shell find library -name '*.php') +docs/api/index.html: vendor/composer/installed.json $(library_files) phpDocumentor.phar + php phpDocumentor.phar run -d library -t docs/api + +.PHONY: test-all +test-all: test-72 test-71 test-70 test-56 + +.PHONY: test-all-7 +test-all-7: test-72 test-71 test-70 + +.PHONY: test-72 +test-72: deps + docker run -it --rm -v "$$PWD":/opt/mockery -w /opt/mockery php:7.2-cli php vendor/bin/phpunit + +.PHONY: test-71 +test-71: deps + docker run -it --rm -v "$$PWD":/opt/mockery -w /opt/mockery php:7.1-cli php vendor/bin/phpunit + +.PHONY: test-70 +test-70: deps + docker run -it --rm -v "$$PWD":/opt/mockery -w /opt/mockery php:7.0-cli php vendor/bin/phpunit + +.PHONY: test-56 +test-56: build56 + docker run -it --rm \ + -v "$$PWD/library":/opt/mockery/library \ + -v "$$PWD/tests":/opt/mockery/tests \ + -v "$$PWD/phpunit.xml.dist":/opt/mockery/phpunit.xml \ + -w /opt/mockery \ + mockery_php56 \ + php vendor/bin/phpunit + +.PHONY: build56 +build56: + docker build -t mockery_php56 -f "$$PWD/docker/php56/Dockerfile" . diff --git a/vendor/mockery/mockery/README.md b/vendor/mockery/mockery/README.md new file mode 100644 index 0000000..b346f4b --- /dev/null +++ b/vendor/mockery/mockery/README.md @@ -0,0 +1,299 @@ +Mockery +======= + +[![Build Status](https://travis-ci.org/mockery/mockery.svg?branch=master)](https://travis-ci.org/mockery/mockery) +[![Latest Stable Version](https://poser.pugx.org/mockery/mockery/v/stable.svg)](https://packagist.org/packages/mockery/mockery) +[![Coverage Status](https://coveralls.io/repos/github/mockery/mockery/badge.svg)](https://coveralls.io/github/mockery/mockery) +[![Total Downloads](https://poser.pugx.org/mockery/mockery/downloads.svg)](https://packagist.org/packages/mockery/mockery) + +Mockery is a simple yet flexible PHP mock object framework for use in unit testing +with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a +test double framework with a succinct API capable of clearly defining all possible +object operations and interactions using a human readable Domain Specific Language +(DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, +Mockery is easy to integrate with PHPUnit and can operate alongside +phpunit-mock-objects without the World ending. + +Mockery is released under a New BSD License. + +## Installation + +To install Mockery, run the command below and you will get the latest +version + +```sh +composer require --dev mockery/mockery +``` + +## Documentation + +In older versions, this README file was the documentation for Mockery. Over time +we have improved this, and have created an extensive documentation for you. Please +use this README file as a starting point for Mockery, but do read the documentation +to learn how to use Mockery. + +The current version can be seen at [docs.mockery.io](http://docs.mockery.io). + +## Test Doubles + +Test doubles (often called mocks) simulate the behaviour of real objects. They are +commonly utilised to offer test isolation, to stand in for objects which do not +yet exist, or to allow for the exploratory design of class APIs without +requiring actual implementation up front. + +The benefits of a test double framework are to allow for the flexible generation +and configuration of test doubles. They allow the setting of expected method calls +and/or return values using a flexible API which is capable of capturing every +possible real object behaviour in way that is stated as close as possible to a +natural language description. Use the `Mockery::mock` method to create a test +double. + +``` php +$double = Mockery::mock(); +``` + +If you need Mockery to create a test double to satisfy a particular type hint, +you can pass the type to the `mock` method. + +``` php +class Book {} + +interface BookRepository { + function find($id): Book; + function findAll(): array; + function add(Book $book): void; +} + +$double = Mockery::mock(BookRepository::class); +``` + +A detailed explanation of creating and working with test doubles is given in the +documentation, [Creating test doubles](http://docs.mockery.io/en/latest/reference/creating_test_doubles.html) +section. + +## Method Stubs 🎫 + +A method stub is a mechanism for having your test double return canned responses +to certain method calls. With stubs, you don't care how many times, if at all, +the method is called. Stubs are used to provide indirect input to the system +under test. + +``` php +$double->allows()->find(123)->andReturns(new Book()); + +$book = $double->find(123); +``` + +If you have used Mockery before, you might see something new in the example +above — we created a method stub using `allows`, instead of the "old" +`shouldReceive` syntax. This is a new feature of Mockery v1, but fear not, +the trusty ol' `shouldReceive` is still here. + +For new users of Mockery, the above example can also be written as: + +``` php +$double->shouldReceive('find')->with(123)->andReturn(new Book()); +$book = $double->find(123); +``` + +If your stub doesn't require specific arguments, you can also use this shortcut +for setting up multiple calls at once: + +``` php +$double->allows([ + "findAll" => [new Book(), new Book()], +]); +``` + +or + +``` php +$double->shouldReceive('findAll') + ->andReturn([new Book(), new Book()]); +``` + +You can also use this shortcut, which creates a double and sets up some stubs in +one call: + +``` php +$double = Mockery::mock(BookRepository::class, [ + "findAll" => [new Book(), new Book()], +]); +``` + +## Method Call Expectations 📲 + +A Method call expectation is a mechanism to allow you to verify that a +particular method has been called. You can specify the parameters and you can +also specify how many times you expect it to be called. Method call expectations +are used to verify indirect output of the system under test. + +``` php +$book = new Book(); + +$double = Mockery::mock(BookRepository::class); +$double->expects()->add($book); +``` + +During the test, Mockery accept calls to the `add` method as prescribed. +After you have finished exercising the system under test, you need to +tell Mockery to check that the method was called as expected, using the +`Mockery::close` method. One way to do that is to add it to your `tearDown` +method in PHPUnit. + +``` php + +public function tearDown() +{ + Mockery::close(); +} +``` + +The `expects()` method automatically sets up an expectation that the method call +(and matching parameters) is called **once and once only**. You can choose to change +this if you are expecting more calls. + +``` php +$double->expects()->add($book)->twice(); +``` + +If you have used Mockery before, you might see something new in the example +above — we created a method expectation using `expects`, instead of the "old" +`shouldReceive` syntax. This is a new feature of Mockery v1, but same as with +`accepts` in the previous section, it can be written in the "old" style. + +For new users of Mockery, the above example can also be written as: + +``` php +$double->shouldReceive('find') + ->with(123) + ->once() + ->andReturn(new Book()); +$book = $double->find(123); +``` + +A detailed explanation of declaring expectations on method calls, please +read the documentation, the [Expectation declarations](http://docs.mockery.io/en/latest/reference/expectations.html) +section. After that, you can also learn about the new `allows` and `expects` methods +in the [Alternative shouldReceive syntax](http://docs.mockery.io/en/latest/reference/alternative_should_receive_syntax.html) +section. + +It is worth mentioning that one way of setting up expectations is no better or worse +than the other. Under the hood, `allows` and `expects` are doing the same thing as +`shouldReceive`, at times in "less words", and as such it comes to a personal preference +of the programmer which way to use. + +## Test Spies ðŸ•µï¸ + +By default, all test doubles created with the `Mockery::mock` method will only +accept calls that they have been configured to `allow` or `expect` (or in other words, +calls that they `shouldReceive`). Sometimes we don't necessarily care about all of the +calls that are going to be made to an object. To facilitate this, we can tell Mockery +to ignore any calls it has not been told to expect or allow. To do so, we can tell a +test double `shouldIgnoreMissing`, or we can create the double using the `Mocker::spy` +shortcut. + +``` php +// $double = Mockery::mock()->shouldIgnoreMissing(); +$double = Mockery::spy(); + +$double->foo(); // null +$double->bar(); // null +``` + +Further to this, sometimes we want to have the object accept any call during the test execution +and then verify the calls afterwards. For these purposes, we need our test +double to act as a Spy. All mockery test doubles record the calls that are made +to them for verification afterwards by default: + +``` php +$double->baz(123); + +$double->shouldHaveReceived()->baz(123); // null +$double->shouldHaveReceived()->baz(12345); // Uncaught Exception Mockery\Exception\InvalidCountException... +``` + +Please refer to the [Spies](http://docs.mockery.io/en/latest/reference/spies.html) section +of the documentation to learn more about the spies. + +## Utilities 🔌 + +### Global Helpers + +Mockery ships with a handful of global helper methods, you just need to ask +Mockery to declare them. + +``` php +Mockery::globalHelpers(); + +$mock = mock(Some::class); +$spy = spy(Some::class); + +$spy->shouldHaveReceived() + ->foo(anyArgs()); +``` + +All of the global helpers are wrapped in a `!function_exists` call to avoid +conflicts. So if you already have a global function called `spy`, Mockery will +silently skip the declaring its own `spy` function. + +### Testing Traits + +As Mockery ships with code generation capabilities, it was trivial to add +functionality allowing users to create objects on the fly that use particular +traits. Any abstract methods defined by the trait will be created and can have +expectations or stubs configured like normal Test Doubles. + +``` php +trait Foo { + function foo() { + return $this->doFoo(); + } + + abstract function doFoo(); +} + +$double = Mockery::mock(Foo::class); +$double->allows()->doFoo()->andReturns(123); +$double->foo(); // int(123) +``` + +### Testing the constructor arguments of hard Dependencies + +See [Mocking hard dependencies](http://docs.mockery.io/en/latest/cookbook/mocking_hard_dependencies.html) + +``` php +$implementationMock = Mockery::mock('overload:\Some\Implementation'); + +$implementationMock->shouldReceive('__construct') + ->once() + ->with(['host' => 'localhost]); +// add other expectations as usual + +$implementation = new \Some\Implementation(['host' => 'localhost']); +``` + +## Versioning + +The Mockery team attempts to adhere to [Semantic Versioning](http://semver.org), +however, some of Mockery's internals are considered private and will be open to +change at any time. Just because a class isn't final, or a method isn't marked +private, does not mean it constitutes part of the API we guarantee under the +versioning scheme. + +### Alternative Runtimes + +Mockery will attempt to continue support HHVM, but will not make any guarantees. + +## A new home for Mockery + +âš ï¸ï¸ Update your remotes! Mockery has transferred to a new location. While it was once +at `padraic/mockery`, it is now at `mockery/mockery`. While your +existing repositories will redirect transparently for any operations, take some +time to transition to the new URL. +```sh +$ git remote set-url upstream https://github.com/mockery/mockery.git +``` +Replace `upstream` with the name of the remote you use locally; `upstream` is commonly +used but you may be using something else. Run `git remote -v` to see what you're actually +using. diff --git a/vendor/mockery/mockery/composer.json b/vendor/mockery/mockery/composer.json new file mode 100644 index 0000000..4d7c96c --- /dev/null +++ b/vendor/mockery/mockery/composer.json @@ -0,0 +1,56 @@ +{ + "name": "mockery/mockery", + "description": "Mockery is a simple yet flexible PHP mock object framework", + "scripts": { + "docs": "phpdoc -d library -t docs/api" + }, + "keywords": [ + "bdd", + "library", + "mock", + "mock objects", + "mockery", + "stub", + "tdd", + "test", + "test double", + "testing" + ], + "homepage": "https://github.com/mockery/mockery", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + }, + { + "name": "Dave Marshall", + "email": "dave.marshall@atstsolutions.co.uk", + "homepage": "http://davedevelopment.co.uk" + } + ], + "require": { + "php": ">=5.6.0", + "lib-pcre": ">=7.0", + "hamcrest/hamcrest-php": "~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~5.7.10|~6.5|~7.0" + }, + "autoload": { + "psr-0": { + "Mockery": "library/" + } + }, + "autoload-dev": { + "psr-4": { + "test\\": "tests/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/mockery/mockery/docker/php56/Dockerfile b/vendor/mockery/mockery/docker/php56/Dockerfile new file mode 100644 index 0000000..264c5c0 --- /dev/null +++ b/vendor/mockery/mockery/docker/php56/Dockerfile @@ -0,0 +1,14 @@ +FROM php:5.6-cli + +RUN apt-get update && \ + apt-get install -y git zip unzip && \ + apt-get -y autoremove && \ + apt-get clean && \ + curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +WORKDIR /opt/mockery + +COPY composer.json ./ + +RUN composer install diff --git a/vendor/mockery/mockery/docs/.gitignore b/vendor/mockery/mockery/docs/.gitignore new file mode 100644 index 0000000..e35d885 --- /dev/null +++ b/vendor/mockery/mockery/docs/.gitignore @@ -0,0 +1 @@ +_build diff --git a/vendor/mockery/mockery/docs/Makefile b/vendor/mockery/mockery/docs/Makefile new file mode 100644 index 0000000..9a8c940 --- /dev/null +++ b/vendor/mockery/mockery/docs/Makefile @@ -0,0 +1,177 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MockeryDocs.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MockeryDocs.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/MockeryDocs" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MockeryDocs" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/vendor/mockery/mockery/docs/README.md b/vendor/mockery/mockery/docs/README.md new file mode 100644 index 0000000..63ca69d --- /dev/null +++ b/vendor/mockery/mockery/docs/README.md @@ -0,0 +1,4 @@ +mockery-docs +============ + +Document for the PHP Mockery framework on readthedocs.org \ No newline at end of file diff --git a/vendor/mockery/mockery/docs/conf.py b/vendor/mockery/mockery/docs/conf.py new file mode 100644 index 0000000..901f040 --- /dev/null +++ b/vendor/mockery/mockery/docs/conf.py @@ -0,0 +1,267 @@ +# -*- coding: utf-8 -*- +# +# Mockery Docs documentation build configuration file, created by +# sphinx-quickstart on Mon Mar 3 14:04:26 2014. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.todo', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'Mockery Docs' +copyright = u'Pádraic Brady, Dave Marshall and contributors' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '1.0' +# The full version, including alpha/beta/rc tags. +release = '1.0-alpha' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +#html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'MockeryDocsdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ('index', 'MockeryDocs.tex', u'Mockery Docs Documentation', + u'Pádraic Brady, Dave Marshall, Wouter, Graham Campbell', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'mockerydocs', u'Mockery Docs Documentation', + [u'Pádraic Brady, Dave Marshall, Wouter, Graham Campbell'], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ('index', 'MockeryDocs', u'Mockery Docs Documentation', + u'Pádraic Brady, Dave Marshall, Wouter, Graham Campbell', 'MockeryDocs', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False + + +#on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' + +if not on_rtd: # only import and set the theme if we're building docs locally + import sphinx_rtd_theme + html_theme = 'sphinx_rtd_theme' + html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] + print sphinx_rtd_theme.get_html_theme_path() + +# load PhpLexer +from sphinx.highlighting import lexers +from pygments.lexers.web import PhpLexer + +# enable highlighting for PHP code not between by default +lexers['php'] = PhpLexer(startinline=True) +lexers['php-annotations'] = PhpLexer(startinline=True) diff --git a/vendor/mockery/mockery/docs/cookbook/big_parent_class.rst b/vendor/mockery/mockery/docs/cookbook/big_parent_class.rst new file mode 100644 index 0000000..a27d532 --- /dev/null +++ b/vendor/mockery/mockery/docs/cookbook/big_parent_class.rst @@ -0,0 +1,52 @@ +.. index:: + single: Cookbook; Big Parent Class + +Big Parent Class +================ + +In some application code, especially older legacy code, we can come across some +classes that extend a "big parent class" - a parent class that knows and does +too much: + +.. code-block:: php + + class BigParentClass + { + public function doesEverything() + { + // sets up database connections + // writes to log files + } + } + + class ChildClass extends BigParentClass + { + public function doesOneThing() + { + // but calls on BigParentClass methods + $result = $this->doesEverything(); + // does something with $result + return $result; + } + } + +We want to test our ``ChildClass`` and its ``doesOneThing`` method, but the +problem is that it calls on ``BigParentClass::doesEverything()``. One way to +handle this would be to mock out **all** of the dependencies ``BigParentClass`` +has and needs, and then finally actually test our ``doesOneThing`` method. It's +an awful lot of work to do that. + +What we can do, is to do something... unconventional. We can create a runtime +partial test double of the ``ChildClass`` itself and mock only the parent's +``doesEverything()`` method: + +.. code-block:: php + + $childClass = \Mockery::mock('ChildClass')->makePartial(); + $childClass->shouldReceive('doesEverything') + ->andReturn('some result from parent'); + + $childClass->doesOneThing(); // string("some result from parent"); + +With this approach we mock out only the ``doesEverything()`` method, and all the +unmocked methods are called on the actual ``ChildClass`` instance. diff --git a/vendor/mockery/mockery/docs/cookbook/class_constants.rst b/vendor/mockery/mockery/docs/cookbook/class_constants.rst new file mode 100644 index 0000000..0d13dd2 --- /dev/null +++ b/vendor/mockery/mockery/docs/cookbook/class_constants.rst @@ -0,0 +1,183 @@ +.. index:: + single: Cookbook; Class Constants + +Class Constants +=============== + +When creating a test double for a class, Mockery does not create stubs out of +any class constants defined in the class we are mocking. Sometimes though, the +non-existence of these class constants, setup of the test, and the application +code itself, it can lead to undesired behavior, and even a PHP error: +``PHP Fatal error: Uncaught Error: Undefined class constant 'FOO' in ...``` + +While supporting class constants in Mockery would be possible, it does require +an awful lot of work, for a small number of use cases. + +Named Mocks +----------- + +We can, however, deal with these constants in a way supported by Mockery - by +using :ref:`creating-test-doubles-named-mocks`. + +A named mock is a test double that has a name of the class we want to mock, but +under it is a stubbed out class that mimics the real class with canned responses. + +Lets look at the following made up, but not impossible scenario: + +.. code-block:: php + + class Fetcher + { + const SUCCESS = 0; + const FAILURE = 1; + + public static function fetch() + { + // Fetcher gets something for us from somewhere... + return self::SUCCESS; + } + } + + class MyClass + { + public function doFetching() + { + $response = Fetcher::fetch(); + + if ($response == Fetcher::SUCCESS) { + echo "Thanks!" . PHP_EOL; + } else { + echo "Try again!" . PHP_EOL; + } + } + } + +Our ``MyClass`` calls a ``Fetcher`` that fetches some resource from somewhere - +maybe it downloads a file from a remote web service. Our ``MyClass`` prints out +a response message depending on the response from the ``Fetcher::fetch()`` call. + +When testing ``MyClass`` we don't really want ``Fetcher`` to go and download +random stuff from the internet every time we run our test suite. So we mock it +out: + +.. code-block:: php + + // Using alias: because fetch is called statically! + \Mockery::mock('alias:Fetcher') + ->shouldReceive('fetch') + ->andReturn(0); + + $myClass = new MyClass(); + $myClass->doFetching(); + +If we run this, our test will error out with a nasty +``PHP Fatal error: Uncaught Error: Undefined class constant 'SUCCESS' in ..``. + +Here's how a ``namedMock()`` can help us in a situation like this. + +We create a stub for the ``Fetcher`` class, stubbing out the class constants, +and then use ``namedMock()`` to create a mock named ``Fetcher`` based on our +stub: + +.. code-block:: php + + class FetcherStub + { + const SUCCESS = 0; + const FAILURE = 1; + } + + \Mockery::mock('Fetcher', 'FetcherStub') + ->shouldReceive('fetch') + ->andReturn(0); + + $myClass = new MyClass(); + $myClass->doFetching(); + +This works because under the hood, Mockery creates a class called ``Fetcher`` +that extends ``FetcherStub``. + +The same approach will work even if ``Fetcher::fetch()`` is not a static +dependency: + +.. code-block:: php + + class Fetcher + { + const SUCCESS = 0; + const FAILURE = 1; + + public function fetch() + { + // Fetcher gets something for us from somewhere... + return self::SUCCESS; + } + } + + class MyClass + { + public function doFetching($fetcher) + { + $response = $fetcher->fetch(); + + if ($response == Fetcher::SUCCESS) { + echo "Thanks!" . PHP_EOL; + } else { + echo "Try again!" . PHP_EOL; + } + } + } + +And the test will have something like this: + +.. code-block:: php + + class FetcherStub + { + const SUCCESS = 0; + const FAILURE = 1; + } + + $mock = \Mockery::mock('Fetcher', 'FetcherStub') + $mock->shouldReceive('fetch') + ->andReturn(0); + + $myClass = new MyClass(); + $myClass->doFetching($mock); + + +Constants Map +------------- + +Another way of mocking class constants can be with the use of the constants map configuration. + +Given a class with constants: + +.. code-block:: php + + class Fetcher + { + const SUCCESS = 0; + const FAILURE = 1; + + public function fetch() + { + // Fetcher gets something for us from somewhere... + return self::SUCCESS; + } + } + +It can be mocked with: + +.. code-block:: php + + \Mockery::getConfiguration()->setConstantsMap([ + 'Fetcher' => [ + 'SUCCESS' => 'success', + 'FAILURE' => 'fail', + ] + ]); + + $mock = \Mockery::mock('Fetcher'); + var_dump($mock::SUCCESS); // (string) 'success' + var_dump($mock::FAILURE); // (string) 'fail' diff --git a/vendor/mockery/mockery/docs/cookbook/default_expectations.rst b/vendor/mockery/mockery/docs/cookbook/default_expectations.rst new file mode 100644 index 0000000..2c6fcae --- /dev/null +++ b/vendor/mockery/mockery/docs/cookbook/default_expectations.rst @@ -0,0 +1,17 @@ +.. index:: + single: Cookbook; Default Mock Expectations + +Default Mock Expectations +========================= + +Often in unit testing, we end up with sets of tests which use the same object +dependency over and over again. Rather than mocking this class/object within +every single unit test (requiring a mountain of duplicate code), we can +instead define reusable default mocks within the test case's ``setup()`` +method. This even works where unit tests use varying expectations on the same +or similar mock object. + +How this works, is that you can define mocks with default expectations. Then, +in a later unit test, you can add or fine-tune expectations for that specific +test. Any expectation can be set as a default using the ``byDefault()`` +declaration. diff --git a/vendor/mockery/mockery/docs/cookbook/detecting_mock_objects.rst b/vendor/mockery/mockery/docs/cookbook/detecting_mock_objects.rst new file mode 100644 index 0000000..0210c69 --- /dev/null +++ b/vendor/mockery/mockery/docs/cookbook/detecting_mock_objects.rst @@ -0,0 +1,13 @@ +.. index:: + single: Cookbook; Detecting Mock Objects + +Detecting Mock Objects +====================== + +Users may find it useful to check whether a given object is a real object or a +simulated Mock Object. All Mockery mocks implement the +``\Mockery\MockInterface`` interface which can be used in a type check. + +.. code-block:: php + + assert($mightBeMocked instanceof \Mockery\MockInterface); diff --git a/vendor/mockery/mockery/docs/cookbook/index.rst b/vendor/mockery/mockery/docs/cookbook/index.rst new file mode 100644 index 0000000..48acbab --- /dev/null +++ b/vendor/mockery/mockery/docs/cookbook/index.rst @@ -0,0 +1,15 @@ +Cookbook +======== + +.. toctree:: + :hidden: + + default_expectations + detecting_mock_objects + not_calling_the_constructor + mocking_hard_dependencies + class_constants + big_parent_class + mockery_on + +.. include:: map.rst.inc diff --git a/vendor/mockery/mockery/docs/cookbook/map.rst.inc b/vendor/mockery/mockery/docs/cookbook/map.rst.inc new file mode 100644 index 0000000..c9dd99e --- /dev/null +++ b/vendor/mockery/mockery/docs/cookbook/map.rst.inc @@ -0,0 +1,7 @@ +* :doc:`/cookbook/default_expectations` +* :doc:`/cookbook/detecting_mock_objects` +* :doc:`/cookbook/not_calling_the_constructor` +* :doc:`/cookbook/mocking_hard_dependencies` +* :doc:`/cookbook/class_constants` +* :doc:`/cookbook/big_parent_class` +* :doc:`/cookbook/mockery_on` diff --git a/vendor/mockery/mockery/docs/cookbook/mockery_on.rst b/vendor/mockery/mockery/docs/cookbook/mockery_on.rst new file mode 100644 index 0000000..631f124 --- /dev/null +++ b/vendor/mockery/mockery/docs/cookbook/mockery_on.rst @@ -0,0 +1,85 @@ +.. index:: + single: Cookbook; Complex Argument Matching With Mockery::on + +Complex Argument Matching With Mockery::on +========================================== + +When we need to do a more complex argument matching for an expected method call, +the ``\Mockery::on()`` matcher comes in really handy. It accepts a closure as an +argument and that closure in turn receives the argument passed in to the method, +when called. If the closure returns ``true``, Mockery will consider that the +argument has passed the expectation. If the closure returns ``false``, or a +"falsey" value, the expectation will not pass. + +The ``\Mockery::on()`` matcher can be used in various scenarios — validating +an array argument based on multiple keys and values, complex string matching... + +Say, for example, we have the following code. It doesn't do much; publishes a +post by setting the ``published`` flag in the database to ``1`` and sets the +``published_at`` to the current date and time: + +.. code-block:: php + + model = $model; + } + + public function publishPost($id) + { + $saveData = [ + 'post_id' => $id, + 'published' => 1, + 'published_at' => gmdate('Y-m-d H:i:s'), + ]; + $this->model->save($saveData); + } + } + +In a test we would mock the model and set some expectations on the call of the +``save()`` method: + +.. code-block:: php + + shouldReceive('save') + ->once() + ->with(\Mockery::on(function ($argument) use ($postId) { + $postIdIsSet = isset($argument['post_id']) && $argument['post_id'] === $postId; + $publishedFlagIsSet = isset($argument['published']) && $argument['published'] === 1; + $publishedAtIsSet = isset($argument['published_at']); + + return $postIdIsSet && $publishedFlagIsSet && $publishedAtIsSet; + })); + + $service = new \Service\Post($modelMock); + $service->publishPost($postId); + + \Mockery::close(); + +The important part of the example is inside the closure we pass to the +``\Mockery::on()`` matcher. The ``$argument`` is actually the ``$saveData`` argument +the ``save()`` method gets when it is called. We check for a couple of things in +this argument: + +* the post ID is set, and is same as the post ID we passed in to the + ``publishPost()`` method, +* the ``published`` flag is set, and is ``1``, and +* the ``published_at`` key is present. + +If any of these requirements is not satisfied, the closure will return ``false``, +the method call expectation will not be met, and Mockery will throw a +``NoMatchingExpectationException``. + +.. note:: + + This cookbook entry is an adaption of the blog post titled + `"Complex argument matching in Mockery" `_, + published by Robert Basic on his blog. diff --git a/vendor/mockery/mockery/docs/cookbook/mocking_hard_dependencies.rst b/vendor/mockery/mockery/docs/cookbook/mocking_hard_dependencies.rst new file mode 100644 index 0000000..b9381fd --- /dev/null +++ b/vendor/mockery/mockery/docs/cookbook/mocking_hard_dependencies.rst @@ -0,0 +1,99 @@ +.. index:: + single: Cookbook; Mocking Hard Dependencies + +Mocking Hard Dependencies (new Keyword) +======================================= + +One prerequisite to mock hard dependencies is that the code we are trying to test uses autoloading. + +Let's take the following code for an example: + +.. code-block:: php + + sendSomething($param); + return $externalService->getSomething(); + } + } + +The way we can test this without doing any changes to the code itself is by creating :doc:`instance mocks ` by using the ``overload`` prefix. + +.. code-block:: php + + shouldReceive('sendSomething') + ->once() + ->with($param); + $externalMock->shouldReceive('getSomething') + ->once() + ->andReturn('Tested!'); + + $service = new \App\Service(); + + $result = $service->callExternalService($param); + + $this->assertSame('Tested!', $result); + } + } + +If we run this test now, it should pass. Mockery does its job and our ``App\Service`` will use the mocked external service instead of the real one. + +The problem with this is when we want to, for example, test the ``App\Service\External`` itself, or if we use that class somewhere else in our tests. + +When Mockery overloads a class, because of how PHP works with files, that overloaded class file must not be included otherwise Mockery will throw a "class already exists" exception. This is where autoloading kicks in and makes our job a lot easier. + +To make this possible, we'll tell PHPUnit to run the tests that have overloaded classes in separate processes and to not preserve global state. That way we'll avoid having the overloaded class included more than once. Of course this has its downsides as these tests will run slower. + +Our test example from above now becomes: + +.. code-block:: php + + shouldReceive('sendSomething') + ->once() + ->with($param); + $externalMock->shouldReceive('getSomething') + ->once() + ->andReturn('Tested!'); + + $service = new \App\Service(); + + $result = $service->callExternalService($param); + + $this->assertSame('Tested!', $result); + } + } + +.. note:: + + This cookbook entry is an adaption of the blog post titled + `"Mocking hard dependencies with Mockery" `_, + published by Robert Basic on his blog. diff --git a/vendor/mockery/mockery/docs/cookbook/not_calling_the_constructor.rst b/vendor/mockery/mockery/docs/cookbook/not_calling_the_constructor.rst new file mode 100644 index 0000000..b8157ae --- /dev/null +++ b/vendor/mockery/mockery/docs/cookbook/not_calling_the_constructor.rst @@ -0,0 +1,63 @@ +.. index:: + single: Cookbook; Not Calling the Original Constructor + +Not Calling the Original Constructor +==================================== + +When creating generated partial test doubles, Mockery mocks out only the method +which we specifically told it to. This means that the original constructor of +the class we are mocking will be called. + +In some cases this is not a desired behavior, as the constructor might issue +calls to other methods, or other object collaborators, and as such, can create +undesired side-effects in the application's environment when running the tests. + +If this happens, we need to use runtime partial test doubles, as they don't +call the original constructor. + +.. code-block:: php + + class MyClass + { + public function __construct() + { + echo "Original constructor called." . PHP_EOL; + // Other side-effects can happen... + } + } + + // This will print "Original constructor called." + $mock = \Mockery::mock('MyClass[foo]'); + +A better approach is to use runtime partial doubles: + +.. code-block:: php + + class MyClass + { + public function __construct() + { + echo "Original constructor called." . PHP_EOL; + // Other side-effects can happen... + } + } + + // This will not print anything + $mock = \Mockery::mock('MyClass')->makePartial(); + $mock->shouldReceive('foo'); + +This is one of the reason why we don't recommend using generated partial test +doubles, but if possible, always use the runtime partials. + +Read more about :ref:`creating-test-doubles-partial-test-doubles`. + +.. note:: + + The way generated partial test doubles work, is a BC break. If you use a + really old version of Mockery, it might behave in a way that the constructor + is not being called for these generated partials. In the case if you upgrade + to a more recent version of Mockery, you'll probably have to change your + tests to use runtime partials, instead of generated ones. + + This change was introduced in early 2013, so it is highly unlikely that you + are using a Mockery from before that, so this should not be an issue. diff --git a/vendor/mockery/mockery/docs/getting_started/index.rst b/vendor/mockery/mockery/docs/getting_started/index.rst new file mode 100644 index 0000000..434755c --- /dev/null +++ b/vendor/mockery/mockery/docs/getting_started/index.rst @@ -0,0 +1,12 @@ +Getting Started +=============== + +.. toctree:: + :hidden: + + installation + upgrading + simple_example + quick_reference + +.. include:: map.rst.inc diff --git a/vendor/mockery/mockery/docs/getting_started/installation.rst b/vendor/mockery/mockery/docs/getting_started/installation.rst new file mode 100644 index 0000000..8019567 --- /dev/null +++ b/vendor/mockery/mockery/docs/getting_started/installation.rst @@ -0,0 +1,43 @@ +.. index:: + single: Installation + +Installation +============ + +Mockery can be installed using Composer or by cloning it from its GitHub +repository. These two options are outlined below. + +Composer +-------- + +You can read more about Composer on `getcomposer.org `_. +To install Mockery using Composer, first install Composer for your project +using the instructions on the `Composer download page `_. +You can then define your development dependency on Mockery using the suggested +parameters below. While every effort is made to keep the master branch stable, +you may prefer to use the current stable version tag instead (use the +``@stable`` tag). + +.. code-block:: json + + { + "require-dev": { + "mockery/mockery": "dev-master" + } + } + +To install, you then may call: + +.. code-block:: bash + + php composer.phar update + +This will install Mockery as a development dependency, meaning it won't be +installed when using ``php composer.phar update --no-dev`` in production. + +Git +--- + +The Git repository hosts the development version in its master branch. You can +install this using Composer by referencing ``dev-master`` as your preferred +version in your project's ``composer.json`` file as the earlier example shows. diff --git a/vendor/mockery/mockery/docs/getting_started/map.rst.inc b/vendor/mockery/mockery/docs/getting_started/map.rst.inc new file mode 100644 index 0000000..1055945 --- /dev/null +++ b/vendor/mockery/mockery/docs/getting_started/map.rst.inc @@ -0,0 +1,4 @@ +* :doc:`/getting_started/installation` +* :doc:`/getting_started/upgrading` +* :doc:`/getting_started/simple_example` +* :doc:`/getting_started/quick_reference` diff --git a/vendor/mockery/mockery/docs/getting_started/quick_reference.rst b/vendor/mockery/mockery/docs/getting_started/quick_reference.rst new file mode 100644 index 0000000..e729a85 --- /dev/null +++ b/vendor/mockery/mockery/docs/getting_started/quick_reference.rst @@ -0,0 +1,200 @@ +.. index:: + single: Quick Reference + +Quick Reference +=============== + +The purpose of this page is to give a quick and short overview of some of the +most common Mockery features. + +Do read the :doc:`../reference/index` to learn about all the Mockery features. + +Integrate Mockery with PHPUnit, either by extending the ``MockeryTestCase``: + +.. code-block:: php + + use \Mockery\Adapter\Phpunit\MockeryTestCase; + + class MyTest extends MockeryTestCase + { + } + +or by using the ``MockeryPHPUnitIntegration`` trait: + +.. code-block:: php + + use \PHPUnit\Framework\TestCase; + use \Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration; + + class MyTest extends TestCase + { + use MockeryPHPUnitIntegration; + } + +Creating a test double: + +.. code-block:: php + + $testDouble = \Mockery::mock('MyClass'); + +Creating a test double that implements a certain interface: + +.. code-block:: php + + $testDouble = \Mockery::mock('MyClass, MyInterface'); + +Expecting a method to be called on a test double: + +.. code-block:: php + + $testDouble = \Mockery::mock('MyClass'); + $testDouble->shouldReceive('foo'); + +Expecting a method to **not** be called on a test double: + +.. code-block:: php + + $testDouble = \Mockery::mock('MyClass'); + $testDouble->shouldNotReceive('foo'); + +Expecting a method to be called on a test double, once, with a certain argument, +and to return a value: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('foo') + ->once() + ->with($arg) + ->andReturn($returnValue); + +Expecting a method to be called on a test double and to return a different value +for each successive call: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('foo') + ->andReturn(1, 2, 3); + + $mock->foo(); // int(1); + $mock->foo(); // int(2); + $mock->foo(); // int(3); + $mock->foo(); // int(3); + +Creating a runtime partial test double: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass')->makePartial(); + +Creating a spy: + +.. code-block:: php + + $spy = \Mockery::spy('MyClass'); + +Expecting that a spy should have received a method call: + +.. code-block:: php + + $spy = \Mockery::spy('MyClass'); + + $spy->foo(); + + $spy->shouldHaveReceived()->foo(); + +Not so simple examples +^^^^^^^^^^^^^^^^^^^^^^ + +Creating a mock object to return a sequence of values from a set of method +calls: + +.. code-block:: php + + use \Mockery\Adapter\Phpunit\MockeryTestCase; + + class SimpleTest extends MockeryTestCase + { + public function testSimpleMock() + { + $mock = \Mockery::mock(array('pi' => 3.1416, 'e' => 2.71)); + $this->assertEquals(3.1416, $mock->pi()); + $this->assertEquals(2.71, $mock->e()); + } + } + +Creating a mock object which returns a self-chaining Undefined object for a +method call: + +.. code-block:: php + + use \Mockery\Adapter\Phpunit\MockeryTestCase; + + class UndefinedTest extends MockeryTestCase + { + public function testUndefinedValues() + { + $mock = \Mockery::mock('mymock'); + $mock->shouldReceive('divideBy')->with(0)->andReturnUndefined(); + $this->assertTrue($mock->divideBy(0) instanceof \Mockery\Undefined); + } + } + +Creating a mock object with multiple query calls and a single update call: + +.. code-block:: php + + use \Mockery\Adapter\Phpunit\MockeryTestCase; + + class DbTest extends MockeryTestCase + { + public function testDbAdapter() + { + $mock = \Mockery::mock('db'); + $mock->shouldReceive('query')->andReturn(1, 2, 3); + $mock->shouldReceive('update')->with(5)->andReturn(NULL)->once(); + + // ... test code here using the mock + } + } + +Expecting all queries to be executed before any updates: + +.. code-block:: php + + use \Mockery\Adapter\Phpunit\MockeryTestCase; + + class DbTest extends MockeryTestCase + { + public function testQueryAndUpdateOrder() + { + $mock = \Mockery::mock('db'); + $mock->shouldReceive('query')->andReturn(1, 2, 3)->ordered(); + $mock->shouldReceive('update')->andReturn(NULL)->once()->ordered(); + + // ... test code here using the mock + } + } + +Creating a mock object where all queries occur after startup, but before finish, +and where queries are expected with several different params: + +.. code-block:: php + + use \Mockery\Adapter\Phpunit\MockeryTestCase; + + class DbTest extends MockeryTestCase + { + public function testOrderedQueries() + { + $db = \Mockery::mock('db'); + $db->shouldReceive('startup')->once()->ordered(); + $db->shouldReceive('query')->with('CPWR')->andReturn(12.3)->once()->ordered('queries'); + $db->shouldReceive('query')->with('MSFT')->andReturn(10.0)->once()->ordered('queries'); + $db->shouldReceive('query')->with(\Mockery::pattern("/^....$/"))->andReturn(3.3)->atLeast()->once()->ordered('queries'); + $db->shouldReceive('finish')->once()->ordered(); + + // ... test code here using the mock + } + } diff --git a/vendor/mockery/mockery/docs/getting_started/simple_example.rst b/vendor/mockery/mockery/docs/getting_started/simple_example.rst new file mode 100644 index 0000000..1fb252e --- /dev/null +++ b/vendor/mockery/mockery/docs/getting_started/simple_example.rst @@ -0,0 +1,70 @@ +.. index:: + single: Getting Started; Simple Example + +Simple Example +============== + +Imagine we have a ``Temperature`` class which samples the temperature of a +locale before reporting an average temperature. The data could come from a web +service or any other data source, but we do not have such a class at present. +We can, however, assume some basic interactions with such a class based on its +interaction with the ``Temperature`` class: + +.. code-block:: php + + class Temperature + { + private $service; + + public function __construct($service) + { + $this->service = $service; + } + + public function average() + { + $total = 0; + for ($i=0; $i<3; $i++) { + $total += $this->service->readTemp(); + } + return $total/3; + } + } + +Even without an actual service class, we can see how we expect it to operate. +When writing a test for the ``Temperature`` class, we can now substitute a +mock object for the real service which allows us to test the behaviour of the +``Temperature`` class without actually needing a concrete service instance. + +.. code-block:: php + + use \Mockery; + + class TemperatureTest extends PHPUnit_Framework_TestCase + { + public function tearDown() + { + Mockery::close(); + } + + public function testGetsAverageTemperatureFromThreeServiceReadings() + { + $service = Mockery::mock('service'); + $service->shouldReceive('readTemp') + ->times(3) + ->andReturn(10, 12, 14); + + $temperature = new Temperature($service); + + $this->assertEquals(12, $temperature->average()); + } + } + +We create a mock object which our ``Temperature`` class will use and set some +expectations for that mock — that it should receive three calls to the ``readTemp`` +method, and these calls will return 10, 12, and 14 as results. + +.. note:: + + PHPUnit integration can remove the need for a ``tearDown()`` method. See + ":doc:`/reference/phpunit_integration`" for more information. diff --git a/vendor/mockery/mockery/docs/getting_started/upgrading.rst b/vendor/mockery/mockery/docs/getting_started/upgrading.rst new file mode 100644 index 0000000..7201e59 --- /dev/null +++ b/vendor/mockery/mockery/docs/getting_started/upgrading.rst @@ -0,0 +1,82 @@ +.. index:: + single: Upgrading + +Upgrading +========= + +Upgrading to 1.0.0 +------------------ + +Minimum PHP version ++++++++++++++++++++ + +As of Mockery 1.0.0 the minimum PHP version required is 5.6. + +Using Mockery with PHPUnit +++++++++++++++++++++++++++ + +In the "old days", 0.9.x and older, the way Mockery was integrated with PHPUnit was +through a PHPUnit listener. That listener would in turn call the ``\Mockery::close()`` +method for us. + +As of 1.0.0, PHPUnit test cases where we want to use Mockery, should either use the +``\Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration`` trait, or extend the +``\Mockery\Adapter\Phpunit\MockeryTestCase`` test case. This will in turn call the +``\Mockery::close()`` method for us. + +Read the documentation for a detailed overview of ":doc:`/reference/phpunit_integration`". + +``\Mockery\Matcher\MustBe`` is deprecated ++++++++++++++++++++++++++++++++++++++++++ + +As of 1.0.0 the ``\Mockery\Matcher\MustBe`` matcher is deprecated and will be removed in +Mockery 2.0.0. We recommend instead to use the PHPUnit or Hamcrest equivalents of the +MustBe matcher. + +``allows`` and ``expects`` +++++++++++++++++++++++++++ + +As of 1.0.0, Mockery has two new methods to set up expectations: ``allows`` and ``expects``. +This means that these methods names are now "reserved" for Mockery, or in other words +classes you want to mock with Mockery, can't have methods called ``allows`` or ``expects``. + +Read more in the documentation about this ":doc:`/reference/alternative_should_receive_syntax`". + +No more implicit regex matching for string arguments +++++++++++++++++++++++++++++++++++++++++++++++++++++ + +When setting up string arguments in method expectations, Mockery 0.9.x and older, would try +to match arguments using a regular expression in a "last attempt" scenario. + +As of 1.0.0, Mockery will no longer attempt to do this regex matching, but will only try +first the identical operator ``===``, and failing that, the equals operator ``==``. + +If you want to match an argument using regular expressions, please use the new +``\Mockery\Matcher\Pattern`` matcher. Read more in the documentation about this +pattern matcher in the ":doc:`/reference/argument_validation`" section. + +``andThrow`` ``\Throwable`` ++++++++++++++++++++++++++++ + +As of 1.0.0, the ``andThrow`` can now throw any ``\Throwable``. + +Upgrading to 0.9 +---------------- + +The generator was completely rewritten, so any code with a deep integration to +mockery will need evaluating. + +Upgrading to 0.8 +---------------- + +Since the release of 0.8.0 the following behaviours were altered: + +1. The ``shouldIgnoreMissing()`` behaviour optionally applied to mock objects + returned an instance of ``\Mockery\Undefined`` when methods called did not + match a known expectation. Since 0.8.0, this behaviour was switched to + returning ``null`` instead. You can restore the 0.7.2 behaviour by using the + following: + + .. code-block:: php + + $mock = \Mockery::mock('stdClass')->shouldIgnoreMissing()->asUndefined(); diff --git a/vendor/mockery/mockery/docs/index.rst b/vendor/mockery/mockery/docs/index.rst new file mode 100644 index 0000000..f8cbbd3 --- /dev/null +++ b/vendor/mockery/mockery/docs/index.rst @@ -0,0 +1,76 @@ +Mockery +======= + +Mockery is a simple yet flexible PHP mock object framework for use in unit +testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is +to offer a test double framework with a succinct API capable of clearly +defining all possible object operations and interactions using a human +readable Domain Specific Language (DSL). Designed as a drop in alternative to +PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with +PHPUnit and can operate alongside phpunit-mock-objects without the World +ending. + +Mock Objects +------------ + +In unit tests, mock objects simulate the behaviour of real objects. They are +commonly utilised to offer test isolation, to stand in for objects which do +not yet exist, or to allow for the exploratory design of class APIs without +requiring actual implementation up front. + +The benefits of a mock object framework are to allow for the flexible +generation of such mock objects (and stubs). They allow the setting of +expected method calls and return values using a flexible API which is capable +of capturing every possible real object behaviour in way that is stated as +close as possible to a natural language description. + +Getting Started +--------------- + +Ready to dive into the Mockery framework? Then you can get started by reading +the "Getting Started" section! + +.. toctree:: + :hidden: + + getting_started/index + +.. include:: getting_started/map.rst.inc + +Reference +--------- + +The reference contains a complete overview of all features of the Mockery +framework. + +.. toctree:: + :hidden: + + reference/index + +.. include:: reference/map.rst.inc + +Mockery +------- + +Learn about Mockery's configuration, reserved method names, exceptions... + +.. toctree:: + :hidden: + + mockery/index + +.. include:: mockery/map.rst.inc + +Cookbook +-------- + +Want to learn some easy tips and tricks? Take a look at the cookbook articles! + +.. toctree:: + :hidden: + + cookbook/index + +.. include:: cookbook/map.rst.inc + diff --git a/vendor/mockery/mockery/docs/mockery/configuration.rst b/vendor/mockery/mockery/docs/mockery/configuration.rst new file mode 100644 index 0000000..3a89579 --- /dev/null +++ b/vendor/mockery/mockery/docs/mockery/configuration.rst @@ -0,0 +1,77 @@ +.. index:: + single: Mockery; Configuration + +Mockery Global Configuration +============================ + +To allow for a degree of fine-tuning, Mockery utilises a singleton +configuration object to store a small subset of core behaviours. The two +currently present include: + +* Option to allow/disallow the mocking of methods which do not actually exist + fulfilled (i.e. unused) +* Setter/Getter for added a parameter map for internal PHP class methods + (``Reflection`` cannot detect these automatically) + +By default, the first behaviour is enabled. Of course, there are +situations where this can lead to unintended consequences. The mocking of +non-existent methods may allow mocks based on real classes/objects to fall out +of sync with the actual implementations, especially when some degree of +integration testing (testing of object wiring) is not being performed. + +You may allow or disallow this behaviour (whether for whole test suites or +just select tests) by using the following call: + +.. code-block:: php + + \Mockery::getConfiguration()->allowMockingNonExistentMethods(bool); + +Passing a true allows the behaviour, false disallows it. It takes effect +immediately until switched back. If the behaviour is detected when not allowed, +it will result in an Exception being thrown at that point. Note that disallowing +this behaviour should be carefully considered since it necessarily removes at +least some of Mockery's flexibility. + +The other two methods are: + +.. code-block:: php + + \Mockery::getConfiguration()->setInternalClassMethodParamMap($class, $method, array $paramMap) + \Mockery::getConfiguration()->getInternalClassMethodParamMap($class, $method) + +These are used to define parameters (i.e. the signature string of each) for the +methods of internal PHP classes (e.g. SPL, or PECL extension classes like +ext/mongo's MongoCollection. Reflection cannot analyse the parameters of internal +classes. Most of the time, you never need to do this. It's mainly needed where an +internal class method uses pass-by-reference for a parameter - you MUST in such +cases ensure the parameter signature includes the ``&`` symbol correctly as Mockery +won't correctly add it automatically for internal classes. + +Disabling reflection caching +---------------------------- + +Mockery heavily uses `"reflection" `_ +to do it's job. To speed up things, Mockery caches internally the information it +gathers via reflection. In some cases, this caching can cause problems. + +The **only** known situation when this occurs is when PHPUnit's ``--static-backup`` option +is used. If you use ``--static-backup`` and you get an error that looks like the +following: + +.. code-block:: php + + Error: Internal error: Failed to retrieve the reflection object + +We suggest turning off the reflection cache as so: + +.. code-block:: php + + \Mockery::getConfiguration()->disableReflectionCache(); + +Turning it back on can be done like so: + +.. code-block:: php + + \Mockery::getConfiguration()->enableReflectionCache(); + +In no other situation should you be required turn this reflection cache off. diff --git a/vendor/mockery/mockery/docs/mockery/exceptions.rst b/vendor/mockery/mockery/docs/mockery/exceptions.rst new file mode 100644 index 0000000..623b158 --- /dev/null +++ b/vendor/mockery/mockery/docs/mockery/exceptions.rst @@ -0,0 +1,65 @@ +.. index:: + single: Mockery; Exceptions + +Mockery Exceptions +================== + +Mockery throws three types of exceptions when it cannot verify a mock object. + +#. ``\Mockery\Exception\InvalidCountException`` +#. ``\Mockery\Exception\InvalidOrderException`` +#. ``\Mockery\Exception\NoMatchingExpectationException`` + +You can capture any of these exceptions in a try...catch block to query them +for specific information which is also passed along in the exception message +but is provided separately from getters should they be useful when logging or +reformatting output. + +\Mockery\Exception\InvalidCountException +---------------------------------------- + +The exception class is used when a method is called too many (or too few) +times and offers the following methods: + +* ``getMock()`` - return actual mock object +* ``getMockName()`` - return the name of the mock object +* ``getMethodName()`` - return the name of the method the failing expectation + is attached to +* ``getExpectedCount()`` - return expected calls +* ``getExpectedCountComparative()`` - returns a string, e.g. ``<=`` used to + compare to actual count +* ``getActualCount()`` - return actual calls made with given argument + constraints + +\Mockery\Exception\InvalidOrderException +---------------------------------------- + +The exception class is used when a method is called outside the expected order +set using the ``ordered()`` and ``globally()`` expectation modifiers. It +offers the following methods: + +* ``getMock()`` - return actual mock object +* ``getMockName()`` - return the name of the mock object +* ``getMethodName()`` - return the name of the method the failing expectation + is attached to +* ``getExpectedOrder()`` - returns an integer represented the expected index + for which this call was expected +* ``getActualOrder()`` - return the actual index at which this method call + occurred. + +\Mockery\Exception\NoMatchingExpectationException +------------------------------------------------- + +The exception class is used when a method call does not match any known +expectation. All expectations are uniquely identified in a mock object by the +method name and the list of expected arguments. You can disable this exception +and opt for returning NULL from all unexpected method calls by using the +earlier mentioned shouldIgnoreMissing() behaviour modifier. This exception +class offers the following methods: + +* ``getMock()`` - return actual mock object +* ``getMockName()`` - return the name of the mock object +* ``getMethodName()`` - return the name of the method the failing expectation + is attached to +* ``getActualArguments()`` - return actual arguments used to search for a + matching expectation diff --git a/vendor/mockery/mockery/docs/mockery/gotchas.rst b/vendor/mockery/mockery/docs/mockery/gotchas.rst new file mode 100644 index 0000000..ebd690f --- /dev/null +++ b/vendor/mockery/mockery/docs/mockery/gotchas.rst @@ -0,0 +1,48 @@ +.. index:: + single: Mockery; Gotchas + +Gotchas! +======== + +Mocking objects in PHP has its limitations and gotchas. Some functionality +can't be mocked or can't be mocked YET! If you locate such a circumstance, +please please (pretty please with sugar on top) create a new issue on GitHub +so it can be documented and resolved where possible. Here is a list to note: + +1. Classes containing public ``__wakeup()`` methods can be mocked but the + mocked ``__wakeup()`` method will perform no actions and cannot have + expectations set for it. This is necessary since Mockery must serialize and + unserialize objects to avoid some ``__construct()`` insanity and attempting + to mock a ``__wakeup()`` method as normal leads to a + ``BadMethodCallException`` being thrown. + +2. Classes using non-real methods, i.e. where a method call triggers a + ``__call()`` method, will throw an exception that the non-real method does + not exist unless you first define at least one expectation (a simple + ``shouldReceive()`` call would suffice). This is necessary since there is + no other way for Mockery to be aware of the method name. + +3. Mockery has two scenarios where real classes are replaced: Instance mocks + and alias mocks. Both will generate PHP fatal errors if the real class is + loaded, usually via a require or include statement. Only use these two mock + types where autoloading is in place and where classes are not explicitly + loaded on a per-file basis using ``require()``, ``require_once()``, etc. + +4. Internal PHP classes are not entirely capable of being fully analysed using + ``Reflection``. For example, ``Reflection`` cannot reveal details of + expected parameters to the methods of such internal classes. As a result, + there will be problems where a method parameter is defined to accept a + value by reference (Mockery cannot detect this condition and will assume a + pass by value on scalars and arrays). If references as internal class + method parameters are needed, you should use the + ``\Mockery\Configuration::setInternalClassMethodParamMap()`` method. + +5. Creating a mock implementing a certain interface with incorrect case in the + interface name, and then creating a second mock implementing the same + interface, but this time with the correct case, will have undefined behavior + due to PHP's ``class_exists`` and related functions being case insensitive. + Using the ``::class`` keyword in PHP can help you avoid these mistakes. + +The gotchas noted above are largely down to PHP's architecture and are assumed +to be unavoidable. But - if you figure out a solution (or a better one than +what may exist), let us know! diff --git a/vendor/mockery/mockery/docs/mockery/index.rst b/vendor/mockery/mockery/docs/mockery/index.rst new file mode 100644 index 0000000..b698d6c --- /dev/null +++ b/vendor/mockery/mockery/docs/mockery/index.rst @@ -0,0 +1,12 @@ +Mockery +======= + +.. toctree:: + :hidden: + + configuration + exceptions + reserved_method_names + gotchas + +.. include:: map.rst.inc diff --git a/vendor/mockery/mockery/docs/mockery/map.rst.inc b/vendor/mockery/mockery/docs/mockery/map.rst.inc new file mode 100644 index 0000000..46ffa97 --- /dev/null +++ b/vendor/mockery/mockery/docs/mockery/map.rst.inc @@ -0,0 +1,4 @@ +* :doc:`/mockery/configuration` +* :doc:`/mockery/exceptions` +* :doc:`/mockery/reserved_method_names` +* :doc:`/mockery/gotchas` diff --git a/vendor/mockery/mockery/docs/mockery/reserved_method_names.rst b/vendor/mockery/mockery/docs/mockery/reserved_method_names.rst new file mode 100644 index 0000000..112d6f0 --- /dev/null +++ b/vendor/mockery/mockery/docs/mockery/reserved_method_names.rst @@ -0,0 +1,20 @@ +.. index:: + single: Reserved Method Names + +Reserved Method Names +===================== + +As you may have noticed, Mockery uses a number of methods called directly on +all mock objects, for example ``shouldReceive()``. Such methods are necessary +in order to setup expectations on the given mock, and so they cannot be +implemented on the classes or objects being mocked without creating a method +name collision (reported as a PHP fatal error). The methods reserved by +Mockery are: + +* ``shouldReceive()`` +* ``shouldBeStrict()`` + +In addition, all mocks utilise a set of added methods and protected properties +which cannot exist on the class or object being mocked. These are far less +likely to cause collisions. All properties are prefixed with ``_mockery`` and +all method names with ``mockery_``. diff --git a/vendor/mockery/mockery/docs/reference/alternative_should_receive_syntax.rst b/vendor/mockery/mockery/docs/reference/alternative_should_receive_syntax.rst new file mode 100644 index 0000000..78c1e83 --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/alternative_should_receive_syntax.rst @@ -0,0 +1,91 @@ +.. index:: + single: Alternative shouldReceive Syntax + +Alternative shouldReceive Syntax +================================ + +As of Mockery 1.0.0, we support calling methods as we would call any PHP method, +and not as string arguments to Mockery ``should*`` methods. + +The two Mockery methods that enable this are ``allows()`` and ``expects()``. + +Allows +------ + +We use ``allows()`` when we create stubs for methods that return a predefined +return value, but for these method stubs we don't care how many times, or if at +all, were they called. + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->allows([ + 'name_of_method_1' => 'return value', + 'name_of_method_2' => 'return value', + ]); + +This is equivalent with the following ``shouldReceive`` syntax: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive([ + 'name_of_method_1' => 'return value', + 'name_of_method_2' => 'return value', + ]); + +Note that with this format, we also tell Mockery that we don't care about the +arguments to the stubbed methods. + +If we do care about the arguments, we would do it like so: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->allows() + ->name_of_method_1($arg1) + ->andReturn('return value'); + +This is equivalent with the following ``shouldReceive`` syntax: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method_1') + ->with($arg1) + ->andReturn('return value'); + +Expects +------- + +We use ``expects()`` when we want to verify that a particular method was called: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->expects() + ->name_of_method_1($arg1) + ->andReturn('return value'); + +This is equivalent with the following ``shouldReceive`` syntax: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method_1') + ->once() + ->with($arg1) + ->andReturn('return value'); + +By default ``expects()`` sets up an expectation that the method should be called +once and once only. If we expect more than one call to the method, we can change +that expectation: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->expects() + ->name_of_method_1($arg1) + ->twice() + ->andReturn('return value'); + diff --git a/vendor/mockery/mockery/docs/reference/argument_validation.rst b/vendor/mockery/mockery/docs/reference/argument_validation.rst new file mode 100644 index 0000000..735407c --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/argument_validation.rst @@ -0,0 +1,317 @@ +.. index:: + single: Argument Validation + +Argument Validation +=================== + +The arguments passed to the ``with()`` declaration when setting up an +expectation determine the criteria for matching method calls to expectations. +Thus, we can setup up many expectations for a single method, each +differentiated by the expected arguments. Such argument matching is done on a +"best fit" basis. This ensures explicit matches take precedence over +generalised matches. + +An explicit match is merely where the expected argument and the actual +argument are easily equated (i.e. using ``===`` or ``==``). More generalised +matches are possible using regular expressions, class hinting and the +available generic matchers. The purpose of generalised matchers is to allow +arguments be defined in non-explicit terms, e.g. ``Mockery::any()`` passed to +``with()`` will match **any** argument in that position. + +Mockery's generic matchers do not cover all possibilities but offers optional +support for the Hamcrest library of matchers. Hamcrest is a PHP port of the +similarly named Java library (which has been ported also to Python, Erlang, +etc). By using Hamcrest, Mockery does not need to duplicate Hamcrest's already +impressive utility which itself promotes a natural English DSL. + +The examples below show Mockery matchers and their Hamcrest equivalent, if there +is one. Hamcrest uses functions (no namespacing). + +.. note:: + + If you don't wish to use the global Hamcrest functions, they are all exposed + through the ``\Hamcrest\Matchers`` class as well, as static methods. Thus, + ``identicalTo($arg)`` is the same as ``\Hamcrest\Matchers::identicalTo($arg)`` + +The most common matcher is the ``with()`` matcher: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('foo') + ->with(1): + +It tells mockery that it should receive a call to the ``foo`` method with the +integer ``1`` as an argument. In cases like this, Mockery first tries to match +the arguments using ``===`` (identical) comparison operator. If the argument is +a primitive, and if it fails the identical comparison, Mockery does a fallback +to the ``==`` (equals) comparison operator. + +When matching objects as arguments, Mockery only does the strict ``===`` +comparison, which means only the same ``$object`` will match: + +.. code-block:: php + + $object = new stdClass(); + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive("foo") + ->with($object); + + // Hamcrest equivalent + $mock->shouldReceive("foo") + ->with(identicalTo($object)); + +A different instance of ``stdClass`` will **not** match. + +.. note:: + + The ``Mockery\Matcher\MustBe`` matcher has been deprecated. + +If we need a loose comparison of objects, we can do that using Hamcrest's +``equalTo`` matcher: + +.. code-block:: php + + $mock->shouldReceive("foo") + ->with(equalTo(new stdClass)); + +In cases when we don't care about the type, or the value of an argument, just +that any argument is present, we use ``any()``: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive("foo") + ->with(\Mockery::any()); + + // Hamcrest equivalent + $mock->shouldReceive("foo") + ->with(anything()) + +Anything and everything passed in this argument slot is passed unconstrained. + +Validating Types and Resources +------------------------------ + +The ``type()`` matcher accepts any string which can be attached to ``is_`` to +form a valid type check. + +To match any PHP resource, we could do the following: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive("foo") + ->with(\Mockery::type('resource')); + + // Hamcrest equivalents + $mock->shouldReceive("foo") + ->with(resourceValue()); + $mock->shouldReceive("foo") + ->with(typeOf('resource')); + +It will return a ``true`` from an ``is_resource()`` call, if the provided +argument to the method is a PHP resource. For example, ``\Mockery::type('float')`` +or Hamcrest's ``floatValue()`` and ``typeOf('float')`` checks use ``is_float()``, +and ``\Mockery::type('callable')`` or Hamcrest's ``callable()`` uses +``is_callable()``. + +The ``type()`` matcher also accepts a class or interface name to be used in an +``instanceof`` evaluation of the actual argument. Hamcrest uses ``anInstanceOf()``. + +A full list of the type checkers is available at +`php.net `_ or browse Hamcrest's function +list in +`the Hamcrest code `_. + +.. _argument-validation-complex-argument-validation: + +Complex Argument Validation +--------------------------- + +If we want to perform a complex argument validation, the ``on()`` matcher is +invaluable. It accepts a closure (anonymous function) to which the actual +argument will be passed. + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive("foo") + ->with(\Mockery::on(closure)); + +If the closure evaluates to (i.e. returns) boolean ``true`` then the argument is +assumed to have matched the expectation. + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + + $mock->shouldReceive('foo') + ->with(\Mockery::on(function ($argument) { + if ($argument % 2 == 0) { + return true; + } + return false; + })); + + $mock->foo(4); // matches the expectation + $mock->foo(3); // throws a NoMatchingExpectationException + +.. note:: + + There is no Hamcrest version of the ``on()`` matcher. + +We can also perform argument validation by passing a closure to ``withArgs()`` +method. The closure will receive all arguments passed in the call to the expected +method and if it evaluates (i.e. returns) to boolean ``true``, then the list of +arguments is assumed to have matched the expectation: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive("foo") + ->withArgs(closure); + +The closure can also handle optional parameters, so if an optional parameter is +missing in the call to the expected method, it doesn't necessary means that the +list of arguments doesn't match the expectation. + +.. code-block:: php + + $closure = function ($odd, $even, $sum = null) { + $result = ($odd % 2 != 0) && ($even % 2 == 0); + if (!is_null($sum)) { + return $result && ($odd + $even == $sum); + } + return $result; + }; + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('foo')->withArgs($closure); + + $mock->foo(1, 2); // It matches the expectation: the optional argument is not needed + $mock->foo(1, 2, 3); // It also matches the expectation: the optional argument pass the validation + $mock->foo(1, 2, 4); // It doesn't match the expectation: the optional doesn't pass the validation + +.. note:: + + In previous versions, Mockery's ``with()`` would attempt to do a pattern + matching against the arguments, attempting to use the argument as a + regular expression. Over time this proved to be not such a great idea, so + we removed this functionality, and have introduced ``Mockery::pattern()`` + instead. + +If we would like to match an argument against a regular expression, we can use +the ``\Mockery::pattern()``: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('foo') + ->with(\Mockery::pattern('/^foo/')); + + // Hamcrest equivalent + $mock->shouldReceive('foo') + with(matchesPattern('/^foo/')); + +The ``ducktype()`` matcher is an alternative to matching by class type: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('foo') + ->with(\Mockery::ducktype('foo', 'bar')); + +It matches any argument which is an object containing the provided list of +methods to call. + +.. note:: + + There is no Hamcrest version of the ``ducktype()`` matcher. + +Additional Argument Matchers +---------------------------- + +The ``not()`` matcher matches any argument which is not equal or identical to +the matcher's parameter: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('foo') + ->with(\Mockery::not(2)); + + // Hamcrest equivalent + $mock->shouldReceive('foo') + ->with(not(2)); + +``anyOf()`` matches any argument which equals any one of the given parameters: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('foo') + ->with(\Mockery::anyOf(1, 2)); + + // Hamcrest equivalent + $mock->shouldReceive('foo') + ->with(anyOf(1,2)); + +``notAnyOf()`` matches any argument which is not equal or identical to any of +the given parameters: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('foo') + ->with(\Mockery::notAnyOf(1, 2)); + +.. note:: + + There is no Hamcrest version of the ``notAnyOf()`` matcher. + +``subset()`` matches any argument which is any array containing the given array +subset: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('foo') + ->with(\Mockery::subset(array(0 => 'foo'))); + +This enforces both key naming and values, i.e. both the key and value of each +actual element is compared. + +.. note:: + + There is no Hamcrest version of this functionality, though Hamcrest can check + a single entry using ``hasEntry()`` or ``hasKeyValuePair()``. + +``contains()`` matches any argument which is an array containing the listed +values: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('foo') + ->with(\Mockery::contains(value1, value2)); + +The naming of keys is ignored. + +``hasKey()`` matches any argument which is an array containing the given key +name: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('foo') + ->with(\Mockery::hasKey(key)); + +``hasValue()`` matches any argument which is an array containing the given +value: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('foo') + ->with(\Mockery::hasValue(value)); diff --git a/vendor/mockery/mockery/docs/reference/creating_test_doubles.rst b/vendor/mockery/mockery/docs/reference/creating_test_doubles.rst new file mode 100644 index 0000000..377812d --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/creating_test_doubles.rst @@ -0,0 +1,419 @@ +.. index:: + single: Reference; Creating Test Doubles + +Creating Test Doubles +===================== + +Mockery's main goal is to help us create test doubles. It can create stubs, +mocks, and spies. + +Stubs and mocks are created the same. The difference between the two is that a +stub only returns a preset result when called, while a mock needs to have +expectations set on the method calls it expects to receive. + +Spies are a type of test doubles that keep track of the calls they received, and +allow us to inspect these calls after the fact. + +When creating a test double object, we can pass in an identifier as a name for +our test double. If we pass it no identifier, the test double name will be +unknown. Furthermore, the identifier must not be a class name. It is a +good practice, and our recommendation, to always name the test doubles with the +same name as the underlying class we are creating test doubles for. + +If the identifier we use for our test double is a name of an existing class, +the test double will inherit the type of the class (via inheritance), i.e. the +mock object will pass type hints or ``instanceof`` evaluations for the existing +class. This is useful when a test double must be of a specific type, to satisfy +the expectations our code has. + +Stubs and mocks +--------------- + +Stubs and mocks are created by calling the ``\Mockery::mock()`` method. The +following example shows how to create a stub, or a mock, object named "foo": + +.. code-block:: php + + $mock = \Mockery::mock('foo'); + +The mock object created like this is the loosest form of mocks possible, and is +an instance of ``\Mockery\MockInterface``. + +.. note:: + + All test doubles created with Mockery are an instance of + ``\Mockery\MockInterface``, regardless are they a stub, mock or a spy. + +To create a stub or a mock object with no name, we can call the ``mock()`` +method with no parameters: + +.. code-block:: php + + $mock = \Mockery::mock(); + +As we stated earlier, we don't recommend creating stub or mock objects without +a name. + +Classes, abstracts, interfaces +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The recommended way to create a stub or a mock object is by using a name of +an existing class we want to create a test double of: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + +This stub or mock object will have the type of ``MyClass``, through inheritance. + +Stub or mock objects can be based on any concrete class, abstract class or even +an interface. The primary purpose is to ensure the mock object inherits a +specific type for type hinting. + +.. code-block:: php + + $mock = \Mockery::mock('MyInterface'); + +This stub or mock object will implement the ``MyInterface`` interface. + +.. note:: + + Classes marked final, or classes that have methods marked final cannot be + mocked fully. Mockery supports creating partial mocks for these cases. + Partial mocks will be explained later in the documentation. + +Mockery also supports creating stub or mock objects based on a single existing +class, which must implement one or more interfaces. We can do this by providing +a comma-separated list of the class and interfaces as the first argument to the +``\Mockery::mock()`` method: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass, MyInterface, OtherInterface'); + +This stub or mock object will now be of type ``MyClass`` and implement the +``MyInterface`` and ``OtherInterface`` interfaces. + +.. note:: + + The class name doesn't need to be the first member of the list but it's a + friendly convention to use for readability. + +We can tell a mock to implement the desired interfaces by passing the list of +interfaces as the second argument: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass', 'MyInterface, OtherInterface'); + +For all intents and purposes, this is the same as the previous example. + +Spies +----- + +The third type of test doubles Mockery supports are spies. The main difference +between spies and mock objects is that with spies we verify the calls made +against our test double after the calls were made. We would use a spy when we +don't necessarily care about all of the calls that are going to be made to an +object. + +A spy will return ``null`` for all method calls it receives. It is not possible +to tell a spy what will be the return value of a method call. If we do that, then +we would deal with a mock object, and not with a spy. + +We create a spy by calling the ``\Mockery::spy()`` method: + +.. code-block:: php + + $spy = \Mockery::spy('MyClass'); + +Just as with stubs or mocks, we can tell Mockery to base a spy on any concrete +or abstract class, or to implement any number of interfaces: + +.. code-block:: php + + $spy = \Mockery::spy('MyClass, MyInterface, OtherInterface'); + +This spy will now be of type ``MyClass`` and implement the ``MyInterface`` and +``OtherInterface`` interfaces. + +.. note:: + + The ``\Mockery::spy()`` method call is actually a shorthand for calling + ``\Mockery::mock()->shouldIgnoreMissing()``. The ``shouldIgnoreMissing`` + method is a "behaviour modifier". We'll discuss them a bit later. + +Mocks vs. Spies +--------------- + +Let's try and illustrate the difference between mocks and spies with the +following example: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $spy = \Mockery::spy('MyClass'); + + $mock->shouldReceive('foo')->andReturn(42); + + $mockResult = $mock->foo(); + $spyResult = $spy->foo(); + + $spy->shouldHaveReceived()->foo(); + + var_dump($mockResult); // int(42) + var_dump($spyResult); // null + +As we can see from this example, with a mock object we set the call expectations +before the call itself, and we get the return result we expect it to return. +With a spy object on the other hand, we verify the call has happened after the +fact. The return result of a method call against a spy is always ``null``. + +We also have a dedicated chapter to :doc:`spies` only. + +.. _creating-test-doubles-partial-test-doubles: + +Partial Test Doubles +-------------------- + +Partial doubles are useful when we want to stub out, set expectations for, or +spy on *some* methods of a class, but run the actual code for other methods. + +We differentiate between three types of partial test doubles: + + * runtime partial test doubles, + * generated partial test doubles, and + * proxied partial test doubles. + +Runtime partial test doubles +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +What we call a runtime partial, involves creating a test double and then telling +it to make itself partial. Any method calls that the double hasn't been told to +allow or expect, will act as they would on a normal instance of the object. + +.. code-block:: php + + class Foo { + function foo() { return 123; } + function bar() { return $this->foo(); } + } + + $foo = mock(Foo::class)->makePartial(); + $foo->foo(); // int(123); + +We can then tell the test double to allow or expect calls as with any other +Mockery double. + +.. code-block:: php + + $foo->shouldReceive('foo')->andReturn(456); + $foo->bar(); // int(456) + +See the cookbook entry on :doc:`../cookbook/big_parent_class` for an example +usage of runtime partial test doubles. + +Generated partial test doubles +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The second type of partial double we can create is what we call a generated +partial. With generated partials, we specifically tell Mockery which methods +we want to be able to allow or expect calls to. All other methods will run the +actual code *directly*, so stubs and expectations on these methods will not +work. + +.. code-block:: php + + class Foo { + function foo() { return 123; } + function bar() { return $this->foo(); } + } + + $foo = mock("Foo[foo]"); + + $foo->foo(); // error, no expectation set + + $foo->shouldReceive('foo')->andReturn(456); + $foo->foo(); // int(456) + + // setting an expectation for this has no effect + $foo->shouldReceive('bar')->andReturn(999); + $foo->bar(); // int(456) + +.. note:: + + Even though we support generated partial test doubles, we do not recommend + using them. + + One of the reasons why is because a generated partial will call the original + constructor of the mocked class. This can have unwanted side-effects during + testing application code. + + See :doc:`../cookbook/not_calling_the_constructor` for more details. + +Proxied partial test doubles +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +A proxied partial mock is a partial of last resort. We may encounter a class +which is simply not capable of being mocked because it has been marked as +final. Similarly, we may find a class with methods marked as final. In such a +scenario, we cannot simply extend the class and override methods to mock - we +need to get creative. + +.. code-block:: php + + $mock = \Mockery::mock(new MyClass); + +Yes, the new mock is a Proxy. It intercepts calls and reroutes them to the +proxied object (which we construct and pass in) for methods which are not +subject to any expectations. Indirectly, this allows us to mock methods +marked final since the Proxy is not subject to those limitations. The tradeoff +should be obvious - a proxied partial will fail any typehint checks for the +class being mocked since it cannot extend that class. + +.. _creating-test-doubles-aliasing: + +Aliasing +-------- + +Prefixing the valid name of a class (which is NOT currently loaded) with +"alias:" will generate an "alias mock". Alias mocks create a class alias with +the given classname to stdClass and are generally used to enable the mocking +of public static methods. Expectations set on the new mock object which refer +to static methods will be used by all static calls to this class. + +.. code-block:: php + + $mock = \Mockery::mock('alias:MyClass'); + + +.. note:: + + Even though aliasing classes is supported, we do not recommend it. + +Overloading +----------- + +Prefixing the valid name of a class (which is NOT currently loaded) with +"overload:" will generate an alias mock (as with "alias:") except that created +new instances of that class will import any expectations set on the origin +mock (``$mock``). The origin mock is never verified since it's used an +expectation store for new instances. For this purpose we use the term "instance +mock" to differentiate it from the simpler "alias mock". + +In other words, an instance mock will "intercept" when a new instance of the +mocked class is created, then the mock will be used instead. This is useful +especially when mocking hard dependencies which will be discussed later. + +.. code-block:: php + + $mock = \Mockery::mock('overload:MyClass'); + +.. note:: + + Using alias/instance mocks across more than one test will generate a fatal + error since we can't have two classes of the same name. To avoid this, + run each test of this kind in a separate PHP process (which is supported + out of the box by both PHPUnit and PHPT). + + +.. _creating-test-doubles-named-mocks: + +Named Mocks +----------- + +The ``namedMock()`` method will generate a class called by the first argument, +so in this example ``MyClassName``. The rest of the arguments are treated in the +same way as the ``mock`` method: + +.. code-block:: php + + $mock = \Mockery::namedMock('MyClassName', 'DateTime'); + +This example would create a class called ``MyClassName`` that extends +``DateTime``. + +Named mocks are quite an edge case, but they can be useful when code depends +on the ``__CLASS__`` magic constant, or when we need two derivatives of an +abstract type, that are actually different classes. + +See the cookbook entry on :doc:`../cookbook/class_constants` for an example +usage of named mocks. + +.. note:: + + We can only create a named mock once, any subsequent calls to + ``namedMock``, with different arguments are likely to cause exceptions. + +.. _creating-test-doubles-constructor-arguments: + +Constructor Arguments +--------------------- + +Sometimes the mocked class has required constructor arguments. We can pass these +to Mockery as an indexed array, as the 2nd argument: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass', [$constructorArg1, $constructorArg2]); + +or if we need the ``MyClass`` to implement an interface as well, as the 3rd +argument: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass', 'MyInterface', [$constructorArg1, $constructorArg2]); + +Mockery now knows to pass in ``$constructorArg1`` and ``$constructorArg2`` as +arguments to the constructor. + +.. _creating-test-doubles-behavior-modifiers: + +Behavior Modifiers +------------------ + +When creating a mock object, we may wish to use some commonly preferred +behaviours that are not the default in Mockery. + +The use of the ``shouldIgnoreMissing()`` behaviour modifier will label this +mock object as a Passive Mock: + +.. code-block:: php + + \Mockery::mock('MyClass')->shouldIgnoreMissing(); + +In such a mock object, calls to methods which are not covered by expectations +will return ``null`` instead of the usual error about there being no expectation +matching the call. + +On PHP >= 7.0.0, methods with missing expectations that have a return type +will return either a mock of the object (if return type is a class) or a +"falsy" primitive value, e.g. empty string, empty array, zero for ints and +floats, false for bools, or empty closures. + +On PHP >= 7.1.0, methods with missing expectations and nullable return type +will return null. + +We can optionally prefer to return an object of type ``\Mockery\Undefined`` +(i.e. a ``null`` object) (which was the 0.7.2 behaviour) by using an +additional modifier: + +.. code-block:: php + + \Mockery::mock('MyClass')->shouldIgnoreMissing()->asUndefined(); + +The returned object is nothing more than a placeholder so if, by some act of +fate, it's erroneously used somewhere it shouldn't it will likely not pass a +logic check. + +We have encountered the ``makePartial()`` method before, as it is the method we +use to create runtime partial test doubles: + +.. code-block:: php + + \Mockery::mock('MyClass')->makePartial(); + +This form of mock object will defer all methods not subject to an expectation to +the parent class of the mock, i.e. ``MyClass``. Whereas the previous +``shouldIgnoreMissing()`` returned ``null``, this behaviour simply calls the +parent's matching method. diff --git a/vendor/mockery/mockery/docs/reference/demeter_chains.rst b/vendor/mockery/mockery/docs/reference/demeter_chains.rst new file mode 100644 index 0000000..1dad5ef --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/demeter_chains.rst @@ -0,0 +1,38 @@ +.. index:: + single: Mocking; Demeter Chains + +Mocking Demeter Chains And Fluent Interfaces +============================================ + +Both of these terms refer to the growing practice of invoking statements +similar to: + +.. code-block:: php + + $object->foo()->bar()->zebra()->alpha()->selfDestruct(); + +The long chain of method calls isn't necessarily a bad thing, assuming they +each link back to a local object the calling class knows. As a fun example, +Mockery's long chains (after the first ``shouldReceive()`` method) all call to +the same instance of ``\Mockery\Expectation``. However, sometimes this is not +the case and the chain is constantly crossing object boundaries. + +In either case, mocking such a chain can be a horrible task. To make it easier +Mockery supports demeter chain mocking. Essentially, we shortcut through the +chain and return a defined value from the final call. For example, let's +assume ``selfDestruct()`` returns the string "Ten!" to $object (an instance of +``CaptainsConsole``). Here's how we could mock it. + +.. code-block:: php + + $mock = \Mockery::mock('CaptainsConsole'); + $mock->shouldReceive('foo->bar->zebra->alpha->selfDestruct')->andReturn('Ten!'); + +The above expectation can follow any previously seen format or expectation, +except that the method name is simply the string of all expected chain calls +separated by ``->``. Mockery will automatically setup the chain of expected +calls with its final return values, regardless of whatever intermediary object +might be used in the real implementation. + +Arguments to all members of the chain (except the final call) are ignored in +this process. diff --git a/vendor/mockery/mockery/docs/reference/expectations.rst b/vendor/mockery/mockery/docs/reference/expectations.rst new file mode 100644 index 0000000..fb1d736 --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/expectations.rst @@ -0,0 +1,465 @@ +.. index:: + single: Expectations + +Expectation Declarations +======================== + +.. note:: + + In order for our expectations to work we MUST call ``Mockery::close()``, + preferably in a callback method such as ``tearDown`` or ``_before`` + (depending on whether or not we're integrating Mockery with another + framework). This static call cleans up the Mockery container used by the + current test, and run any verification tasks needed for our expectations. + +Once we have created a mock object, we'll often want to start defining how +exactly it should behave (and how it should be called). This is where the +Mockery expectation declarations take over. + +Declaring Method Call Expectations +---------------------------------- + +To tell our test double to expect a call for a method with a given name, we use +the ``shouldReceive`` method: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method'); + +This is the starting expectation upon which all other expectations and +constraints are appended. + +We can declare more than one method call to be expected: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method_1', 'name_of_method_2'); + +All of these will adopt any chained expectations or constraints. + +It is possible to declare the expectations for the method calls, along with +their return values: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive([ + 'name_of_method_1' => 'return value 1', + 'name_of_method_2' => 'return value 2', + ]); + +There's also a shorthand way of setting up method call expectations and their +return values: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass', ['name_of_method_1' => 'return value 1', 'name_of_method_2' => 'return value 2']); + +All of these will adopt any additional chained expectations or constraints. + +We can declare that a test double should not expect a call to the given method +name: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldNotReceive('name_of_method'); + +This method is a convenience method for calling ``shouldReceive()->never()``. + +Declaring Method Argument Expectations +-------------------------------------- + +For every method we declare expectation for, we can add constraints that the +defined expectations apply only to the method calls that match the expected +argument list: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->with($arg1, $arg2, ...); + // or + $mock->shouldReceive('name_of_method') + ->withArgs([$arg1, $arg2, ...]); + +We can add a lot more flexibility to argument matching using the built in +matcher classes (see later). For example, ``\Mockery::any()`` matches any +argument passed to that position in the ``with()`` parameter list. Mockery also +allows Hamcrest library matchers - for example, the Hamcrest function +``anything()`` is equivalent to ``\Mockery::any()``. + +It's important to note that this means all expectations attached only apply to +the given method when it is called with these exact arguments: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + + $mock->shouldReceive('foo')->with('Hello'); + + $mock->foo('Goodbye'); // throws a NoMatchingExpectationException + +This allows for setting up differing expectations based on the arguments +provided to expected calls. + +Argument matching with closures +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Instead of providing a built-in matcher for each argument, we can provide a +closure that matches all passed arguments at once: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->withArgs(closure); + +The given closure receives all the arguments passed in the call to the expected +method. In this way, this expectation only applies to method calls where passed +arguments make the closure evaluate to true: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + + $mock->shouldReceive('foo')->withArgs(function ($arg) { + if ($arg % 2 == 0) { + return true; + } + return false; + }); + + $mock->foo(4); // matches the expectation + $mock->foo(3); // throws a NoMatchingExpectationException + +Any, or no arguments +^^^^^^^^^^^^^^^^^^^^ + +We can declare that the expectation matches a method call regardless of what +arguments are passed: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->withAnyArgs(); + +This is set by default unless otherwise specified. + +We can declare that the expectation matches method calls with zero arguments: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->withNoArgs(); + +Declaring Return Value Expectations +----------------------------------- + +For mock objects, we can tell Mockery what return values to return from the +expected method calls. + +For that we can use the ``andReturn()`` method: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->andReturn($value); + +This sets a value to be returned from the expected method call. + +It is possible to set up expectation for multiple return values. By providing +a sequence of return values, we tell Mockery what value to return on every +subsequent call to the method: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->andReturn($value1, $value2, ...) + +The first call will return ``$value1`` and the second call will return ``$value2``. + +If we call the method more times than the number of return values we declared, +Mockery will return the final value for any subsequent method call: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + + $mock->shouldReceive('foo')->andReturn(1, 2, 3); + + $mock->foo(); // int(1) + $mock->foo(); // int(2) + $mock->foo(); // int(3) + $mock->foo(); // int(3) + +The same can be achieved using the alternative syntax: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->andReturnValues([$value1, $value2, ...]) + +It accepts a simple array instead of a list of parameters. The order of return +is determined by the numerical index of the given array with the last array +member being returned on all calls once previous return values are exhausted. + +The following two options are primarily for communication with test readers: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->andReturnNull(); + // or + $mock->shouldReceive('name_of_method') + ->andReturn([null]); + +They mark the mock object method call as returning ``null`` or nothing. + +Sometimes we want to calculate the return results of the method calls, based on +the arguments passed to the method. We can do that with the ``andReturnUsing()`` +method which accepts one or more closure: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->andReturnUsing(closure, ...); + +Closures can be queued by passing them as extra parameters as for ``andReturn()``. + +.. note:: + + We cannot currently mix ``andReturnUsing()`` with ``andReturn()``. + +If we are mocking fluid interfaces, the following method will be helpful: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->andReturnSelf(); + +It sets the return value to the mocked class name. + +Throwing Exceptions +------------------- + +We can tell the method of mock objects to throw exceptions: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->andThrow(Exception); + +It will throw the given ``Exception`` object when called. + +Rather than an object, we can pass in the ``Exception`` class and message to +use when throwing an ``Exception`` from the mocked method: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->andThrow(exception_name, message); + +.. _expectations-setting-public-properties: + +Setting Public Properties +------------------------- + +Used with an expectation so that when a matching method is called, we can cause +a mock object's public property to be set to a specified value, by using +``andSet()`` or ``set()``: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->andSet($property, $value); + // or + $mock->shouldReceive('name_of_method') + ->set($property, $value); + +In cases where we want to call the real method of the class that was mocked and +return its result, the ``passthru()`` method tells the expectation to bypass +a return queue: + +.. code-block:: php + + passthru() + +It allows expectation matching and call count validation to be applied against +real methods while still calling the real class method with the expected +arguments. + +Declaring Call Count Expectations +--------------------------------- + +Besides setting expectations on the arguments of the method calls, and the +return values of those same calls, we can set expectations on how many times +should any method be called. + +When a call count expectation is not met, a +``\Mockery\Expectation\InvalidCountException`` will be thrown. + +.. note:: + + It is absolutely required to call ``\Mockery::close()`` at the end of our + tests, for example in the ``tearDown()`` method of PHPUnit. Otherwise + Mockery will not verify the calls made against our mock objects. + +We can declare that the expected method may be called zero or more times: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->zeroOrMoreTimes(); + +This is the default for all methods unless otherwise set. + +To tell Mockery to expect an exact number of calls to a method, we can use the +following: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->times($n); + +where ``$n`` is the number of times the method should be called. + +A couple of most common cases got their shorthand methods. + +To declare that the expected method must be called one time only: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->once(); + +To declare that the expected method must be called two times: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->twice(); + +To declare that the expected method must never be called: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->never(); + +Call count modifiers +^^^^^^^^^^^^^^^^^^^^ + +The call count expectations can have modifiers set. + +If we want to tell Mockery the minimum number of times a method should be called, +we use ``atLeast()``: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->atLeast() + ->times(3); + +``atLeast()->times(3)`` means the call must be called at least three times +(given matching method args) but never less than three times. + +Similarly, we can tell Mockery the maximum number of times a method should be +called, using ``atMost()``: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->atMost() + ->times(3); + +``atMost()->times(3)`` means the call must be called no more than three times. +If the method gets no calls at all, the expectation will still be met. + +We can also set a range of call counts, using ``between()``: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass'); + $mock->shouldReceive('name_of_method') + ->between($min, $max); + +This is actually identical to using ``atLeast()->times($min)->atMost()->times($max)`` +but is provided as a shorthand. It may be followed by a ``times()`` call with no +parameter to preserve the APIs natural language readability. + +Expectation Declaration Utilities +--------------------------------- + +Declares that this method is expected to be called in a specific order in +relation to similarly marked methods. + +.. code-block:: php + + ordered() + +The order is dictated by the order in which this modifier is actually used when +setting up mocks. + +Declares the method as belonging to an order group (which can be named or +numbered). Methods within a group can be called in any order, but the ordered +calls from outside the group are ordered in relation to the group: + +.. code-block:: php + + ordered(group) + +We can set up so that method1 is called before group1 which is in turn called +before method2. + +When called prior to ``ordered()`` or ``ordered(group)``, it declares this +ordering to apply across all mock objects (not just the current mock): + +.. code-block:: php + + globally() + +This allows for dictating order expectations across multiple mocks. + +The ``byDefault()`` marks an expectation as a default. Default expectations are +applied unless a non-default expectation is created: + +.. code-block:: php + + byDefault() + +These later expectations immediately replace the previously defined default. +This is useful so we can setup default mocks in our unit test ``setup()`` and +later tweak them in specific tests as needed. + +Returns the current mock object from an expectation chain: + +.. code-block:: php + + getMock() + +Useful where we prefer to keep mock setups as a single statement, e.g.: + +.. code-block:: php + + $mock = \Mockery::mock('foo')->shouldReceive('foo')->andReturn(1)->getMock(); diff --git a/vendor/mockery/mockery/docs/reference/final_methods_classes.rst b/vendor/mockery/mockery/docs/reference/final_methods_classes.rst new file mode 100644 index 0000000..3b2c443 --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/final_methods_classes.rst @@ -0,0 +1,28 @@ +.. index:: + single: Mocking; Final Classes/Methods + +Dealing with Final Classes/Methods +================================== + +One of the primary restrictions of mock objects in PHP, is that mocking +classes or methods marked final is hard. The final keyword prevents methods so +marked from being replaced in subclasses (subclassing is how mock objects can +inherit the type of the class or object being mocked). + +The simplest solution is to not mark classes or methods as final! + +However, in a compromise between mocking functionality and type safety, +Mockery does allow creating "proxy mocks" from classes marked final, or from +classes with methods marked final. This offers all the usual mock object +goodness but the resulting mock will not inherit the class type of the object +being mocked, i.e. it will not pass any instanceof comparison. Methods marked +as final will be proxied to the original method, i.e., final methods can't be +mocked. + +We can create a proxy mock by passing the instantiated object we wish to +mock into ``\Mockery::mock()``, i.e. Mockery will then generate a Proxy to the +real object and selectively intercept method calls for the purposes of setting +and meeting expectations. + +See the :ref:`creating-test-doubles-partial-test-doubles` chapter, the subsection +about proxied partial test doubles. diff --git a/vendor/mockery/mockery/docs/reference/index.rst b/vendor/mockery/mockery/docs/reference/index.rst new file mode 100644 index 0000000..1e5bf04 --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/index.rst @@ -0,0 +1,22 @@ +Reference +========= + +.. toctree:: + :hidden: + + creating_test_doubles + expectations + argument_validation + alternative_should_receive_syntax + spies + partial_mocks + protected_methods + public_properties + public_static_properties + pass_by_reference_behaviours + demeter_chains + final_methods_classes + magic_methods + phpunit_integration + +.. include:: map.rst.inc diff --git a/vendor/mockery/mockery/docs/reference/instance_mocking.rst b/vendor/mockery/mockery/docs/reference/instance_mocking.rst new file mode 100644 index 0000000..9d1aa28 --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/instance_mocking.rst @@ -0,0 +1,22 @@ +.. index:: + single: Mocking; Instance + +Instance Mocking +================ + +Instance mocking means that a statement like: + +.. code-block:: php + + $obj = new \MyNamespace\Foo; + +...will actually generate a mock object. This is done by replacing the real +class with an instance mock (similar to an alias mock), as with mocking public +methods. The alias will import its expectations from the original mock of +that type (note that the original is never verified and should be ignored +after its expectations are setup). This lets you intercept instantiation where +you can't simply inject a replacement object. + +As before, this does not prevent a require statement from including the real +class and triggering a fatal PHP error. It's intended for use where +autoloading is the primary class loading mechanism. diff --git a/vendor/mockery/mockery/docs/reference/magic_methods.rst b/vendor/mockery/mockery/docs/reference/magic_methods.rst new file mode 100644 index 0000000..39591cf --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/magic_methods.rst @@ -0,0 +1,16 @@ +.. index:: + single: Mocking; Magic Methods + +PHP Magic Methods +================= + +PHP magic methods which are prefixed with a double underscore, e.g. +``__set()``, pose a particular problem in mocking and unit testing in general. +It is strongly recommended that unit tests and mock objects do not directly +refer to magic methods. Instead, refer only to the virtual methods and +properties these magic methods simulate. + +Following this piece of advice will ensure we are testing the real API of +classes and also ensures there is no conflict should Mockery override these +magic methods, which it will inevitably do in order to support its role in +intercepting method calls and properties. diff --git a/vendor/mockery/mockery/docs/reference/map.rst.inc b/vendor/mockery/mockery/docs/reference/map.rst.inc new file mode 100644 index 0000000..883bc3c --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/map.rst.inc @@ -0,0 +1,14 @@ +* :doc:`/reference/creating_test_doubles` +* :doc:`/reference/expectations` +* :doc:`/reference/argument_validation` +* :doc:`/reference/alternative_should_receive_syntax` +* :doc:`/reference/spies` +* :doc:`/reference/partial_mocks` +* :doc:`/reference/protected_methods` +* :doc:`/reference/public_properties` +* :doc:`/reference/public_static_properties` +* :doc:`/reference/pass_by_reference_behaviours` +* :doc:`/reference/demeter_chains` +* :doc:`/reference/final_methods_classes` +* :doc:`/reference/magic_methods` +* :doc:`/reference/phpunit_integration` diff --git a/vendor/mockery/mockery/docs/reference/partial_mocks.rst b/vendor/mockery/mockery/docs/reference/partial_mocks.rst new file mode 100644 index 0000000..457eb8d --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/partial_mocks.rst @@ -0,0 +1,108 @@ +.. index:: + single: Mocking; Partial Mocks + +Creating Partial Mocks +====================== + +Partial mocks are useful when we only need to mock several methods of an +object leaving the remainder free to respond to calls normally (i.e. as +implemented). Mockery implements three distinct strategies for creating +partials. Each has specific advantages and disadvantages so which strategy we +use will depend on our own preferences and the source code in need of +mocking. + +We have previously talked a bit about :ref:`creating-test-doubles-partial-test-doubles`, +but we'd like to expand on the subject a bit here. + +#. Runtime partial test doubles +#. Generated partial test doubles +#. Proxied Partial Mock + +Runtime partial test doubles +---------------------------- + +A runtime partial test double, also known as a passive partial mock, is a kind +of a default state of being for a mocked object. + +.. code-block:: php + + $mock = \Mockery::mock('MyClass')->makePartial(); + +With a runtime partial, we assume that all methods will simply defer to the +parent class (``MyClass``) original methods unless a method call matches a +known expectation. If we have no matching expectation for a specific method +call, that call is deferred to the class being mocked. Since the division +between mocked and unmocked calls depends entirely on the expectations we +define, there is no need to define which methods to mock in advance. + +See the cookbook entry on :doc:`../cookbook/big_parent_class` for an example +usage of runtime partial test doubles. + +Generated Partial Test Doubles +------------------------------ + +A generated partial test double, also known as a traditional partial mock, +defines ahead of time which methods of a class are to be mocked and which are +to be left unmocked (i.e. callable as normal). The syntax for creating +traditional mocks is: + +.. code-block:: php + + $mock = \Mockery::mock('MyClass[foo,bar]'); + +In the above example, the ``foo()`` and ``bar()`` methods of MyClass will be +mocked but no other MyClass methods are touched. We will need to define +expectations for the ``foo()`` and ``bar()`` methods to dictate their mocked +behaviour. + +Don't forget that we can pass in constructor arguments since unmocked methods +may rely on those! + +.. code-block:: php + + $mock = \Mockery::mock('MyNamespace\MyClass[foo]', array($arg1, $arg2)); + +See the :ref:`creating-test-doubles-constructor-arguments` section to read up +on them. + +.. note:: + + Even though we support generated partial test doubles, we do not recommend + using them. + +Proxied Partial Mock +-------------------- + +A proxied partial mock is a partial of last resort. We may encounter a class +which is simply not capable of being mocked because it has been marked as +final. Similarly, we may find a class with methods marked as final. In such a +scenario, we cannot simply extend the class and override methods to mock - we +need to get creative. + +.. code-block:: php + + $mock = \Mockery::mock(new MyClass); + +Yes, the new mock is a Proxy. It intercepts calls and reroutes them to the +proxied object (which we construct and pass in) for methods which are not +subject to any expectations. Indirectly, this allows us to mock methods +marked final since the Proxy is not subject to those limitations. The tradeoff +should be obvious - a proxied partial will fail any typehint checks for the +class being mocked since it cannot extend that class. + +Special Internal Cases +---------------------- + +All mock objects, with the exception of Proxied Partials, allows us to make +any expectation call to the underlying real class method using the ``passthru()`` +expectation call. This will return values from the real call and bypass any +mocked return queue (which can simply be omitted obviously). + +There is a fourth kind of partial mock reserved for internal use. This is +automatically generated when we attempt to mock a class containing methods +marked final. Since we cannot override such methods, they are simply left +unmocked. Typically, we don't need to worry about this but if we really +really must mock a final method, the only possible means is through a Proxied +Partial Mock. SplFileInfo, for example, is a common class subject to this form +of automatic internal partial since it contains public final methods used +internally. diff --git a/vendor/mockery/mockery/docs/reference/pass_by_reference_behaviours.rst b/vendor/mockery/mockery/docs/reference/pass_by_reference_behaviours.rst new file mode 100644 index 0000000..5e2e457 --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/pass_by_reference_behaviours.rst @@ -0,0 +1,130 @@ +.. index:: + single: Pass-By-Reference Method Parameter Behaviour + +Preserving Pass-By-Reference Method Parameter Behaviour +======================================================= + +PHP Class method may accept parameters by reference. In this case, changes +made to the parameter (a reference to the original variable passed to the +method) are reflected in the original variable. An example: + +.. code-block:: php + + class Foo + { + + public function bar(&$a) + { + $a++; + } + + } + + $baz = 1; + $foo = new Foo; + $foo->bar($baz); + + echo $baz; // will echo the integer 2 + +In the example above, the variable ``$baz`` is passed by reference to +``Foo::bar()`` (notice the ``&`` symbol in front of the parameter?). Any +change ``bar()`` makes to the parameter reference is reflected in the original +variable, ``$baz``. + +Mockery handles references correctly for all methods where it can analyse +the parameter (using ``Reflection``) to see if it is passed by reference. To +mock how a reference is manipulated by the class method, we can use a closure +argument matcher to manipulate it, i.e. ``\Mockery::on()`` - see the +:ref:`argument-validation-complex-argument-validation` chapter. + +There is an exception for internal PHP classes where Mockery cannot analyse +method parameters using ``Reflection`` (a limitation in PHP). To work around +this, we can explicitly declare method parameters for an internal class using +``\Mockery\Configuration::setInternalClassMethodParamMap()``. + +Here's an example using ``MongoCollection::insert()``. ``MongoCollection`` is +an internal class offered by the mongo extension from PECL. Its ``insert()`` +method accepts an array of data as the first parameter, and an optional +options array as the second parameter. The original data array is updated +(i.e. when a ``insert()`` pass-by-reference parameter) to include a new +``_id`` field. We can mock this behaviour using a configured parameter map (to +tell Mockery to expect a pass by reference parameter) and a ``Closure`` +attached to the expected method parameter to be updated. + +Here's a PHPUnit unit test verifying that this pass-by-reference behaviour is +preserved: + +.. code-block:: php + + public function testCanOverrideExpectedParametersOfInternalPHPClassesToPreserveRefs() + { + \Mockery::getConfiguration()->setInternalClassMethodParamMap( + 'MongoCollection', + 'insert', + array('&$data', '$options = array()') + ); + $m = \Mockery::mock('MongoCollection'); + $m->shouldReceive('insert')->with( + \Mockery::on(function(&$data) { + if (!is_array($data)) return false; + $data['_id'] = 123; + return true; + }), + \Mockery::any() + ); + + $data = array('a'=>1,'b'=>2); + $m->insert($data); + + $this->assertTrue(isset($data['_id'])); + $this->assertEquals(123, $data['_id']); + + \Mockery::resetContainer(); + } + +Protected Methods +----------------- + +When dealing with protected methods, and trying to preserve pass by reference +behavior for them, a different approach is required. + +.. code-block:: php + + class Model + { + public function test(&$data) + { + return $this->doTest($data); + } + + protected function doTest(&$data) + { + $data['something'] = 'wrong'; + return $this; + } + } + + class Test extends \PHPUnit\Framework\TestCase + { + public function testModel() + { + $mock = \Mockery::mock('Model[test]')->shouldAllowMockingProtectedMethods(); + + $mock->shouldReceive('test') + ->with(\Mockery::on(function(&$data) { + $data['something'] = 'wrong'; + return true; + })); + + $data = array('foo' => 'bar'); + + $mock->test($data); + $this->assertTrue(isset($data['something'])); + $this->assertEquals('wrong', $data['something']); + } + } + +This is quite an edge case, so we need to change the original code a little bit, +by creating a public method that will call our protected method, and then mock +that, instead of the protected method. This new public method will act as a +proxy to our protected method. diff --git a/vendor/mockery/mockery/docs/reference/phpunit_integration.rst b/vendor/mockery/mockery/docs/reference/phpunit_integration.rst new file mode 100644 index 0000000..7528b5a --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/phpunit_integration.rst @@ -0,0 +1,151 @@ +.. index:: + single: PHPUnit Integration + +PHPUnit Integration +=================== + +Mockery was designed as a simple-to-use *standalone* mock object framework, so +its need for integration with any testing framework is entirely optional. To +integrate Mockery, we need to define a ``tearDown()`` method for our tests +containing the following (we may use a shorter ``\Mockery`` namespace +alias): + +.. code-block:: php + + public function tearDown() { + \Mockery::close(); + } + +This static call cleans up the Mockery container used by the current test, and +run any verification tasks needed for our expectations. + +For some added brevity when it comes to using Mockery, we can also explicitly +use the Mockery namespace with a shorter alias. For example: + +.. code-block:: php + + use \Mockery as m; + + class SimpleTest extends \PHPUnit\Framework\TestCase + { + public function testSimpleMock() { + $mock = m::mock('simplemock'); + $mock->shouldReceive('foo')->with(5, m::any())->once()->andReturn(10); + + $this->assertEquals(10, $mock->foo(5)); + } + + public function tearDown() { + m::close(); + } + } + +Mockery ships with an autoloader so we don't need to litter our tests with +``require_once()`` calls. To use it, ensure Mockery is on our +``include_path`` and add the following to our test suite's ``Bootstrap.php`` +or ``TestHelper.php`` file: + +.. code-block:: php + + require_once 'Mockery/Loader.php'; + require_once 'Hamcrest/Hamcrest.php'; + + $loader = new \Mockery\Loader; + $loader->register(); + +If we are using Composer, we can simplify this to including the Composer +generated autoloader file: + +.. code-block:: php + + require __DIR__ . '/../vendor/autoload.php'; // assuming vendor is one directory up + +.. caution:: + + Prior to Hamcrest 1.0.0, the ``Hamcrest.php`` file name had a small "h" + (i.e. ``hamcrest.php``). If upgrading Hamcrest to 1.0.0 remember to check + the file name is updated for all your projects.) + +To integrate Mockery into PHPUnit and avoid having to call the close method +and have Mockery remove itself from code coverage reports, have your test case +extends the ``\Mockery\Adapter\Phpunit\MockeryTestCase``: + +.. code-block:: php + + class MyTest extends \Mockery\Adapter\Phpunit\MockeryTestCase + { + + } + +An alternative is to use the supplied trait: + +.. code-block:: php + + class MyTest extends \PHPUnit\Framework\TestCase + { + use \Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration; + } + +Extending ``MockeryTestCase`` or using the ``MockeryPHPUnitIntegration`` +trait is **the recommended way** of integrating Mockery with PHPUnit, +since Mockery 1.0.0. + +PHPUnit listener +---------------- + +Before the 1.0.0 release, Mockery provided a PHPUnit listener that would +call ``Mockery::close()`` for us at the end of a test. This has changed +significantly since the 1.0.0 version. + +Now, Mockery provides a PHPUnit listener that makes tests fail if +``Mockery::close()`` has not been called. It can help identify tests where +we've forgotten to include the trait or extend the ``MockeryTestCase``. + +If we are using PHPUnit's XML configuration approach, we can include the +following to load the ``TestListener``: + +.. code-block:: xml + + + + + +Make sure Composer's or Mockery's autoloader is present in the bootstrap file +or we will need to also define a "file" attribute pointing to the file of the +``TestListener`` class. + +.. caution:: + + The ``TestListener`` will only work for PHPUnit 6+ versions. + + For PHPUnit versions 5 and lower, the test listener does not work. + +If we are creating the test suite programmatically we may add the listener +like this: + +.. code-block:: php + + // Create the suite. + $suite = new PHPUnit\Framework\TestSuite(); + + // Create the listener and add it to the suite. + $result = new PHPUnit\Framework\TestResult(); + $result->addListener(new \Mockery\Adapter\Phpunit\TestListener()); + + // Run the tests. + $suite->run($result); + +.. caution:: + + PHPUnit provides a functionality that allows + `tests to run in a separated process `_, + to ensure better isolation. Mockery verifies the mocks expectations using the + ``Mockery::close()`` method, and provides a PHPUnit listener, that automatically + calls this method for us after every test. + + However, this listener is not called in the right process when using + PHPUnit's process isolation, resulting in expectations that might not be + respected, but without raising any ``Mockery\Exception``. To avoid this, + we cannot rely on the supplied Mockery PHPUnit ``TestListener``, and we need + to explicitly call ``Mockery::close``. The easiest solution to include this + call in the ``tearDown()`` method, as explained previously. diff --git a/vendor/mockery/mockery/docs/reference/protected_methods.rst b/vendor/mockery/mockery/docs/reference/protected_methods.rst new file mode 100644 index 0000000..ec4a5ba --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/protected_methods.rst @@ -0,0 +1,26 @@ +.. index:: + single: Mocking; Protected Methods + +Mocking Protected Methods +========================= + +By default, Mockery does not allow mocking protected methods. We do not recommend +mocking protected methods, but there are cases when there is no other solution. + +For those cases we have the ``shouldAllowMockingProtectedMethods()`` method. It +instructs Mockery to specifically allow mocking of protected methods, for that +one class only: + +.. code-block:: php + + class MyClass + { + protected function foo() + { + } + } + + $mock = \Mockery::mock('MyClass') + ->shouldAllowMockingProtectedMethods(); + $mock->shouldReceive('foo'); + diff --git a/vendor/mockery/mockery/docs/reference/public_properties.rst b/vendor/mockery/mockery/docs/reference/public_properties.rst new file mode 100644 index 0000000..3165668 --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/public_properties.rst @@ -0,0 +1,20 @@ +.. index:: + single: Mocking; Public Properties + +Mocking Public Properties +========================= + +Mockery allows us to mock properties in several ways. One way is that we can set +a public property and its value on any mock object. The second is that we can +use the expectation methods ``set()`` and ``andSet()`` to set property values if +that expectation is ever met. + +You can read more about :ref:`expectations-setting-public-properties`. + +.. note:: + + In general, Mockery does not support mocking any magic methods since these + are generally not considered a public API (and besides it is a bit difficult + to differentiate them when you badly need them for mocking!). So please mock + virtual properties (those relying on ``__get()`` and ``__set()``) as if they + were actually declared on the class. diff --git a/vendor/mockery/mockery/docs/reference/public_static_properties.rst b/vendor/mockery/mockery/docs/reference/public_static_properties.rst new file mode 100644 index 0000000..2396efc --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/public_static_properties.rst @@ -0,0 +1,15 @@ +.. index:: + single: Mocking; Public Static Methods + +Mocking Public Static Methods +============================= + +Static methods are not called on real objects, so normal mock objects can't +mock them. Mockery supports class aliased mocks, mocks representing a class +name which would normally be loaded (via autoloading or a require statement) +in the system under test. These aliases block that loading (unless via a +require statement - so please use autoloading!) and allow Mockery to intercept +static method calls and add expectations for them. + +See the :ref:`creating-test-doubles-aliasing` section for more information on +creating aliased mocks, for the purpose of mocking public static methods. diff --git a/vendor/mockery/mockery/docs/reference/spies.rst b/vendor/mockery/mockery/docs/reference/spies.rst new file mode 100644 index 0000000..77f37f3 --- /dev/null +++ b/vendor/mockery/mockery/docs/reference/spies.rst @@ -0,0 +1,154 @@ +.. index:: + single: Reference; Spies + +Spies +===== + +Spies are a type of test doubles, but they differ from stubs or mocks in that, +that the spies record any interaction between the spy and the System Under Test +(SUT), and allow us to make assertions against those interactions after the fact. + +Creating a spy means we don't have to set up expectations for every method call +the double might receive during the test, some of which may not be relevant to +the current test. A spy allows us to make assertions about the calls we care +about for this test only, reducing the chances of over-specification and making +our tests more clear. + +Spies also allow us to follow the more familiar Arrange-Act-Assert or +Given-When-Then style within our tests. With mocks, we have to follow a less +familiar style, something along the lines of Arrange-Expect-Act-Assert, where +we have to tell our mocks what to expect before we act on the sut, then assert +that those expectations where met: + +.. code-block:: php + + // arrange + $mock = \Mockery::mock('MyDependency'); + $sut = new MyClass($mock); + + // expect + $mock->shouldReceive('foo') + ->once() + ->with('bar'); + + // act + $sut->callFoo(); + + // assert + \Mockery::close(); + +Spies allow us to skip the expect part and move the assertion to after we have +acted on the SUT, usually making our tests more readable: + +.. code-block:: php + + // arrange + $spy = \Mockery::spy('MyDependency'); + $sut = new MyClass($spy); + + // act + $sut->callFoo(); + + // assert + $spy->shouldHaveReceived() + ->foo() + ->with('bar'); + +On the other hand, spies are far less restrictive than mocks, meaning tests are +usually less precise, as they let us get away with more. This is usually a +good thing, they should only be as precise as they need to be, but while spies +make our tests more intent-revealing, they do tend to reveal less about the +design of the SUT. If we're having to setup lots of expectations for a mock, +in lots of different tests, our tests are trying to tell us something - the SUT +is doing too much and probably should be refactored. We don't get this with +spies, they simply ignore the calls that aren't relevant to them. + +Another downside to using spies is debugging. When a mock receives a call that +it wasn't expecting, it immediately throws an exception (failing fast), giving +us a nice stack trace or possibly even invoking our debugger. With spies, we're +simply asserting calls were made after the fact, so if the wrong calls were made, +we don't have quite the same just in time context we have with the mocks. + +Finally, if we need to define a return value for our test double, we can't do +that with a spy, only with a mock object. + +.. note:: + + This documentation page is an adaption of the blog post titled + `"Mockery Spies" `_, + published by Dave Marshall on his blog. Dave is the original author of spies + in Mockery. + +Spies Reference +--------------- + +To verify that a method was called on a spy, we use the ``shouldHaveReceived()`` +method: + +.. code-block:: php + + $spy->shouldHaveReceived('foo'); + +To verify that a method was **not** called on a spy, we use the +``shouldNotHaveReceived()`` method: + +.. code-block:: php + + $spy->shouldNotHaveReceived('foo'); + +We can also do argument matching with spies: + +.. code-block:: php + + $spy->shouldHaveReceived('foo') + ->with('bar'); + +Argument matching is also possible by passing in an array of arguments to +match: + +.. code-block:: php + + $spy->shouldHaveReceived('foo', ['bar']); + +Although when verifying a method was not called, the argument matching can only +be done by supplying the array of arguments as the 2nd argument to the +``shouldNotHaveReceived()`` method: + +.. code-block:: php + + $spy->shouldNotHaveReceived('foo', ['bar']); + +This is due to Mockery's internals. + +Finally, when expecting calls that should have been received, we can also verify +the number of calls: + +.. code-block:: php + + $spy->shouldHaveReceived('foo') + ->with('bar') + ->twice(); + +Alternative shouldReceive syntax +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +As of Mockery 1.0.0, we support calling methods as we would call any PHP method, +and not as string arguments to Mockery ``should*`` methods. + +In cases of spies, this only applies to the ``shouldHaveReceived()`` method: + +.. code-block:: php + + $spy->shouldHaveReceived() + ->foo('bar'); + +We can set expectation on number of calls as well: + +.. code-block:: php + + $spy->shouldHaveReceived() + ->foo('bar') + ->twice(); + +Unfortunately, due to limitations we can't support the same syntax for the +``shouldNotHaveReceived()`` method. diff --git a/vendor/mockery/mockery/library/Mockery.php b/vendor/mockery/mockery/library/Mockery.php new file mode 100644 index 0000000..8725f91 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery.php @@ -0,0 +1,950 @@ += 0) { + $builtInTypes[] = 'object'; + } + + return $builtInTypes; + } + + /** + * @param string $type + * @return bool + */ + public static function isBuiltInType($type) + { + return in_array($type, \Mockery::builtInTypes()); + } + + /** + * Static shortcut to \Mockery\Container::mock(). + * + * @param array ...$args + * + * @return \Mockery\MockInterface + */ + public static function mock(...$args) + { + return call_user_func_array(array(self::getContainer(), 'mock'), $args); + } + + /** + * Static and semantic shortcut for getting a mock from the container + * and applying the spy's expected behavior into it. + * + * @param array ...$args + * + * @return \Mockery\MockInterface + */ + public static function spy(...$args) + { + if (count($args) && $args[0] instanceof \Closure) { + $args[0] = new ClosureWrapper($args[0]); + } + + return call_user_func_array(array(self::getContainer(), 'mock'), $args)->shouldIgnoreMissing(); + } + + /** + * Static and Semantic shortcut to \Mockery\Container::mock(). + * + * @param array ...$args + * + * @return \Mockery\MockInterface + */ + public static function instanceMock(...$args) + { + return call_user_func_array(array(self::getContainer(), 'mock'), $args); + } + + /** + * Static shortcut to \Mockery\Container::mock(), first argument names the mock. + * + * @param array ...$args + * + * @return \Mockery\MockInterface + */ + public static function namedMock(...$args) + { + $name = array_shift($args); + + $builder = new MockConfigurationBuilder(); + $builder->setName($name); + + array_unshift($args, $builder); + + return call_user_func_array(array(self::getContainer(), 'mock'), $args); + } + + /** + * Static shortcut to \Mockery\Container::self(). + * + * @throws LogicException + * + * @return \Mockery\MockInterface + */ + public static function self() + { + if (is_null(self::$_container)) { + throw new \LogicException('You have not declared any mocks yet'); + } + + return self::$_container->self(); + } + + /** + * Static shortcut to closing up and verifying all mocks in the global + * container, and resetting the container static variable to null. + * + * @return void + */ + public static function close() + { + foreach (self::$_filesToCleanUp as $fileName) { + @unlink($fileName); + } + self::$_filesToCleanUp = []; + + if (is_null(self::$_container)) { + return; + } + + $container = self::$_container; + self::$_container = null; + + $container->mockery_teardown(); + $container->mockery_close(); + } + + /** + * Static fetching of a mock associated with a name or explicit class poser. + * + * @param string $name + * + * @return \Mockery\Mock + */ + public static function fetchMock($name) + { + return self::$_container->fetchMock($name); + } + + /** + * Lazy loader and getter for + * the container property. + * + * @return Mockery\Container + */ + public static function getContainer() + { + if (is_null(self::$_container)) { + self::$_container = new Mockery\Container(self::getGenerator(), self::getLoader()); + } + + return self::$_container; + } + + /** + * Setter for the $_generator static propery. + * + * @param \Mockery\Generator\Generator $generator + */ + public static function setGenerator(Generator $generator) + { + self::$_generator = $generator; + } + + /** + * Lazy loader method and getter for + * the generator property. + * + * @return Generator + */ + public static function getGenerator() + { + if (is_null(self::$_generator)) { + self::$_generator = self::getDefaultGenerator(); + } + + return self::$_generator; + } + + /** + * Creates and returns a default generator + * used inside this class. + * + * @return CachingGenerator + */ + public static function getDefaultGenerator() + { + return new CachingGenerator(StringManipulationGenerator::withDefaultPasses()); + } + + /** + * Setter for the $_loader static property. + * + * @param Loader $loader + */ + public static function setLoader(Loader $loader) + { + self::$_loader = $loader; + } + + /** + * Lazy loader method and getter for + * the $_loader property. + * + * @return Loader + */ + public static function getLoader() + { + if (is_null(self::$_loader)) { + self::$_loader = self::getDefaultLoader(); + } + + return self::$_loader; + } + + /** + * Gets an EvalLoader to be used as default. + * + * @return EvalLoader + */ + public static function getDefaultLoader() + { + return new EvalLoader(); + } + + /** + * Set the container. + * + * @param \Mockery\Container $container + * + * @return \Mockery\Container + */ + public static function setContainer(Mockery\Container $container) + { + return self::$_container = $container; + } + + /** + * Reset the container to null. + * + * @return void + */ + public static function resetContainer() + { + self::$_container = null; + } + + /** + * Return instance of ANY matcher. + * + * @return \Mockery\Matcher\Any + */ + public static function any() + { + return new \Mockery\Matcher\Any(); + } + + /** + * Return instance of AndAnyOtherArgs matcher. + * + * An alternative name to `andAnyOtherArgs` so + * the API stays closer to `any` as well. + * + * @return \Mockery\Matcher\AndAnyOtherArgs + */ + public static function andAnyOthers() + { + return new \Mockery\Matcher\AndAnyOtherArgs(); + } + + /** + * Return instance of AndAnyOtherArgs matcher. + * + * @return \Mockery\Matcher\AndAnyOtherArgs + */ + public static function andAnyOtherArgs() + { + return new \Mockery\Matcher\AndAnyOtherArgs(); + } + + /** + * Return instance of TYPE matcher. + * + * @param mixed $expected + * + * @return \Mockery\Matcher\Type + */ + public static function type($expected) + { + return new \Mockery\Matcher\Type($expected); + } + + /** + * Return instance of DUCKTYPE matcher. + * + * @param array ...$args + * + * @return \Mockery\Matcher\Ducktype + */ + public static function ducktype(...$args) + { + return new \Mockery\Matcher\Ducktype($args); + } + + /** + * Return instance of SUBSET matcher. + * + * @param array $part + * @param bool $strict - (Optional) True for strict comparison, false for loose + * + * @return \Mockery\Matcher\Subset + */ + public static function subset(array $part, $strict = true) + { + return new \Mockery\Matcher\Subset($part, $strict); + } + + /** + * Return instance of CONTAINS matcher. + * + * @param array ...$args + * + * @return \Mockery\Matcher\Contains + */ + public static function contains(...$args) + { + return new \Mockery\Matcher\Contains($args); + } + + /** + * Return instance of HASKEY matcher. + * + * @param mixed $key + * + * @return \Mockery\Matcher\HasKey + */ + public static function hasKey($key) + { + return new \Mockery\Matcher\HasKey($key); + } + + /** + * Return instance of HASVALUE matcher. + * + * @param mixed $val + * + * @return \Mockery\Matcher\HasValue + */ + public static function hasValue($val) + { + return new \Mockery\Matcher\HasValue($val); + } + + /** + * Return instance of CLOSURE matcher. + * + * @param mixed $closure + * + * @return \Mockery\Matcher\Closure + */ + public static function on($closure) + { + return new \Mockery\Matcher\Closure($closure); + } + + /** + * Return instance of MUSTBE matcher. + * + * @param mixed $expected + * + * @return \Mockery\Matcher\MustBe + */ + public static function mustBe($expected) + { + return new \Mockery\Matcher\MustBe($expected); + } + + /** + * Return instance of NOT matcher. + * + * @param mixed $expected + * + * @return \Mockery\Matcher\Not + */ + public static function not($expected) + { + return new \Mockery\Matcher\Not($expected); + } + + /** + * Return instance of ANYOF matcher. + * + * @param array ...$args + * + * @return \Mockery\Matcher\AnyOf + */ + public static function anyOf(...$args) + { + return new \Mockery\Matcher\AnyOf($args); + } + + /** + * Return instance of NOTANYOF matcher. + * + * @param array ...$args + * + * @return \Mockery\Matcher\NotAnyOf + */ + public static function notAnyOf(...$args) + { + return new \Mockery\Matcher\NotAnyOf($args); + } + + /** + * Return instance of PATTERN matcher. + * + * @param mixed $expected + * + * @return \Mockery\Matcher\Pattern + */ + public static function pattern($expected) + { + return new \Mockery\Matcher\Pattern($expected); + } + + /** + * Lazy loader and Getter for the global + * configuration container. + * + * @return \Mockery\Configuration + */ + public static function getConfiguration() + { + if (is_null(self::$_config)) { + self::$_config = new \Mockery\Configuration(); + } + + return self::$_config; + } + + /** + * Utility method to format method name and arguments into a string. + * + * @param string $method + * @param array $arguments + * + * @return string + */ + public static function formatArgs($method, array $arguments = null) + { + if (is_null($arguments)) { + return $method . '()'; + } + + $formattedArguments = array(); + foreach ($arguments as $argument) { + $formattedArguments[] = self::formatArgument($argument); + } + + return $method . '(' . implode(', ', $formattedArguments) . ')'; + } + + /** + * Gets the string representation + * of any passed argument. + * + * @param mixed $argument + * @param int $depth + * + * @return mixed + */ + private static function formatArgument($argument, $depth = 0) + { + if ($argument instanceof MatcherAbstract) { + return (string) $argument; + } + + if (is_object($argument)) { + return 'object(' . get_class($argument) . ')'; + } + + if (is_int($argument) || is_float($argument)) { + return $argument; + } + + if (is_array($argument)) { + if ($depth === 1) { + $argument = '[...]'; + } else { + $sample = array(); + foreach ($argument as $key => $value) { + $key = is_int($key) ? $key : "'$key'"; + $value = self::formatArgument($value, $depth + 1); + $sample[] = "$key => $value"; + } + + $argument = "[".implode(", ", $sample)."]"; + } + + return ((strlen($argument) > 1000) ? substr($argument, 0, 1000).'...]' : $argument); + } + + if (is_bool($argument)) { + return $argument ? 'true' : 'false'; + } + + if (is_resource($argument)) { + return 'resource(...)'; + } + + if (is_null($argument)) { + return 'NULL'; + } + + return "'".(string) $argument."'"; + } + + /** + * Utility function to format objects to printable arrays. + * + * @param array $objects + * + * @return string + */ + public static function formatObjects(array $objects = null) + { + static $formatting; + + if ($formatting) { + return '[Recursion]'; + } + + if (is_null($objects)) { + return ''; + } + + $objects = array_filter($objects, 'is_object'); + if (empty($objects)) { + return ''; + } + + $formatting = true; + $parts = array(); + + foreach ($objects as $object) { + $parts[get_class($object)] = self::objectToArray($object); + } + + $formatting = false; + + return 'Objects: ( ' . var_export($parts, true) . ')'; + } + + /** + * Utility function to turn public properties and public get* and is* method values into an array. + * + * @param object $object + * @param int $nesting + * + * @return array + */ + private static function objectToArray($object, $nesting = 3) + { + if ($nesting == 0) { + return array('...'); + } + + return array( + 'class' => get_class($object), + 'properties' => self::extractInstancePublicProperties($object, $nesting) + ); + } + + /** + * Returns all public instance properties. + * + * @param mixed $object + * @param int $nesting + * + * @return array + */ + private static function extractInstancePublicProperties($object, $nesting) + { + $reflection = new \ReflectionClass(get_class($object)); + $properties = $reflection->getProperties(\ReflectionProperty::IS_PUBLIC); + $cleanedProperties = array(); + + foreach ($properties as $publicProperty) { + if (!$publicProperty->isStatic()) { + $name = $publicProperty->getName(); + $cleanedProperties[$name] = self::cleanupNesting($object->$name, $nesting); + } + } + + return $cleanedProperties; + } + + /** + * Utility method used for recursively generating + * an object or array representation. + * + * @param mixed $argument + * @param int $nesting + * + * @return mixed + */ + private static function cleanupNesting($argument, $nesting) + { + if (is_object($argument)) { + $object = self::objectToArray($argument, $nesting - 1); + $object['class'] = get_class($argument); + + return $object; + } + + if (is_array($argument)) { + return self::cleanupArray($argument, $nesting - 1); + } + + return $argument; + } + + /** + * Utility method for recursively + * gerating a representation + * of the given array. + * + * @param array $argument + * @param int $nesting + * + * @return mixed + */ + private static function cleanupArray($argument, $nesting = 3) + { + if ($nesting == 0) { + return '...'; + } + + foreach ($argument as $key => $value) { + if (is_array($value)) { + $argument[$key] = self::cleanupArray($value, $nesting - 1); + } elseif (is_object($value)) { + $argument[$key] = self::objectToArray($value, $nesting - 1); + } + } + + return $argument; + } + + /** + * Utility function to parse shouldReceive() arguments and generate + * expectations from such as needed. + * + * @param Mockery\MockInterface $mock + * @param array ...$args + * @param callable $add + * @return \Mockery\CompositeExpectation + */ + public static function parseShouldReturnArgs(\Mockery\MockInterface $mock, $args, $add) + { + $composite = new \Mockery\CompositeExpectation(); + + foreach ($args as $arg) { + if (is_array($arg)) { + foreach ($arg as $k => $v) { + $expectation = self::buildDemeterChain($mock, $k, $add)->andReturn($v); + $composite->add($expectation); + } + } elseif (is_string($arg)) { + $expectation = self::buildDemeterChain($mock, $arg, $add); + $composite->add($expectation); + } + } + + return $composite; + } + + /** + * Sets up expectations on the members of the CompositeExpectation and + * builds up any demeter chain that was passed to shouldReceive. + * + * @param \Mockery\MockInterface $mock + * @param string $arg + * @param callable $add + * @throws Mockery\Exception + * @return \Mockery\ExpectationInterface + */ + protected static function buildDemeterChain(\Mockery\MockInterface $mock, $arg, $add) + { + /** @var Mockery\Container $container */ + $container = $mock->mockery_getContainer(); + $methodNames = explode('->', $arg); + reset($methodNames); + + if (!\Mockery::getConfiguration()->mockingNonExistentMethodsAllowed() + && !$mock->mockery_isAnonymous() + && !in_array(current($methodNames), $mock->mockery_getMockableMethods()) + ) { + throw new \Mockery\Exception( + 'Mockery\'s configuration currently forbids mocking the method ' + . current($methodNames) . ' as it does not exist on the class or object ' + . 'being mocked' + ); + } + + /** @var ExpectationInterface|null $expectations */ + $expectations = null; + + /** @var Callable $nextExp */ + $nextExp = function ($method) use ($add) { + return $add($method); + }; + + $parent = get_class($mock); + + while (true) { + $method = array_shift($methodNames); + $expectations = $mock->mockery_getExpectationsFor($method); + + if (is_null($expectations) || self::noMoreElementsInChain($methodNames)) { + $expectations = $nextExp($method); + if (self::noMoreElementsInChain($methodNames)) { + break; + } + + $mock = self::getNewDemeterMock($container, $parent, $method, $expectations); + } else { + $demeterMockKey = $container->getKeyOfDemeterMockFor($method, $parent); + if ($demeterMockKey) { + $mock = self::getExistingDemeterMock($container, $demeterMockKey); + } + } + + $parent .= '->' . $method; + + $nextExp = function ($n) use ($mock) { + return $mock->shouldReceive($n); + }; + } + + return $expectations; + } + + /** + * Gets a new demeter configured + * mock from the container. + * + * @param \Mockery\Container $container + * @param string $parent + * @param string $method + * @param Mockery\ExpectationInterface $exp + * + * @return \Mockery\Mock + */ + private static function getNewDemeterMock( + Mockery\Container $container, + $parent, + $method, + Mockery\ExpectationInterface $exp + ) { + $newMockName = 'demeter_' . md5($parent) . '_' . $method; + + if (version_compare(PHP_VERSION, '7.0.0') >= 0) { + $parRef = null; + $parRefMethod = null; + $parRefMethodRetType = null; + + $parentMock = $exp->getMock(); + if ($parentMock !== null) { + $parRef = new ReflectionObject($parentMock); + } + + if ($parRef !== null && $parRef->hasMethod($method)) { + $parRefMethod = $parRef->getMethod($method); + $parRefMethodRetType = $parRefMethod->getReturnType(); + + if ($parRefMethodRetType !== null) { + $mock = self::namedMock($newMockName, (string) $parRefMethodRetType); + $exp->andReturn($mock); + + return $mock; + } + } + } + + $mock = $container->mock($newMockName); + $exp->andReturn($mock); + + return $mock; + } + + /** + * Gets an specific demeter mock from + * the ones kept by the container. + * + * @param \Mockery\Container $container + * @param string $demeterMockKey + * + * @return mixed + */ + private static function getExistingDemeterMock( + Mockery\Container $container, + $demeterMockKey + ) { + $mocks = $container->getMocks(); + $mock = $mocks[$demeterMockKey]; + + return $mock; + } + + /** + * Checks if the passed array representing a demeter + * chain with the method names is empty. + * + * @param array $methodNames + * + * @return bool + */ + private static function noMoreElementsInChain(array $methodNames) + { + return empty($methodNames); + } + + public static function declareClass($fqn) + { + return static::declareType($fqn, "class"); + } + + public static function declareInterface($fqn) + { + return static::declareType($fqn, "interface"); + } + + private static function declareType($fqn, $type) + { + $targetCode = "trait = new TestListenerTrait(); + } + + /** + * {@inheritdoc} + */ + public function endTest(\PHPUnit_Framework_Test $test, $time) + { + $this->trait->endTest($test, $time); + } + + /** + * {@inheritdoc} + */ + public function startTestSuite(\PHPUnit_Framework_TestSuite $suite) + { + $this->trait->startTestSuite(); + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV6.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV6.php new file mode 100644 index 0000000..815b13c --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV6.php @@ -0,0 +1,51 @@ +trait = new TestListenerTrait(); + } + + /** + * {@inheritdoc} + */ + public function endTest(Test $test, $time) + { + $this->trait->endTest($test, $time); + } + + /** + * {@inheritdoc} + */ + public function startTestSuite(TestSuite $suite) + { + $this->trait->startTestSuite(); + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV7.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV7.php new file mode 100644 index 0000000..d590825 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerForV7.php @@ -0,0 +1,55 @@ +trait = new TestListenerTrait(); + } + + + /** + * {@inheritdoc} + */ + public function endTest(Test $test, float $time): void + { + $this->trait->endTest($test, $time); + } + + /** + * {@inheritdoc} + */ + public function startTestSuite(TestSuite $suite): void + { + $this->trait->startTestSuite(); + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerTrait.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerTrait.php new file mode 100644 index 0000000..08848b8 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/Legacy/TestListenerTrait.php @@ -0,0 +1,90 @@ +getStatus() !== BaseTestRunner::STATUS_PASSED) { + // If the test didn't pass there is no guarantee that + // verifyMockObjects and assertPostConditions have been called. + // And even if it did, the point here is to prevent false + // negatives, not to make failing tests fail for more reasons. + return; + } + + try { + // The self() call is used as a sentinel. Anything that throws if + // the container is closed already will do. + \Mockery::self(); + } catch (\LogicException $_) { + return; + } + + $e = new ExpectationFailedException( + \sprintf( + "Mockery's expectations have not been verified. Make sure that \Mockery::close() is called at the end of the test. Consider using %s\MockeryPHPUnitIntegration or extending %s\MockeryTestCase.", + __NAMESPACE__, + __NAMESPACE__ + ) + ); + + /** @var \PHPUnit\Framework\TestResult $result */ + $result = $test->getTestResultObject(); + + if ($result !== null) { + $result->addFailure($test, $e, $time); + } + } + + public function startTestSuite() + { + Blacklist::$blacklistedClassNames[\Mockery::class] = 1; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegration.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegration.php new file mode 100644 index 0000000..9d34293 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegration.php @@ -0,0 +1,88 @@ +addMockeryExpectationsToAssertionCount(); + $this->checkMockeryExceptions(); + $this->closeMockery(); + + parent::assertPostConditions(); + } + + protected function addMockeryExpectationsToAssertionCount() + { + $this->addToAssertionCount(Mockery::getContainer()->mockery_getExpectationCount()); + } + + protected function checkMockeryExceptions() + { + if (!method_exists($this, "markAsRisky")) { + return; + } + + foreach (Mockery::getContainer()->mockery_thrownExceptions() as $e) { + if (!$e->dismissed()) { + $this->markAsRisky(); + } + } + } + + protected function closeMockery() + { + Mockery::close(); + $this->mockeryOpen = false; + } + + /** + * @before + */ + protected function startMockery() + { + $this->mockeryOpen = true; + } + + /** + * @after + */ + protected function purgeMockeryContainer() + { + if ($this->mockeryOpen) { + // post conditions wasn't called, so test probably failed + Mockery::close(); + } + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCase.php b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCase.php new file mode 100644 index 0000000..f4e9a86 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCase.php @@ -0,0 +1,26 @@ +closure = $closure; + } + + public function __invoke() + { + return call_user_func_array($this->closure, func_get_args()); + } +} diff --git a/vendor/mockery/mockery/library/Mockery/CompositeExpectation.php b/vendor/mockery/mockery/library/Mockery/CompositeExpectation.php new file mode 100644 index 0000000..86e3904 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/CompositeExpectation.php @@ -0,0 +1,154 @@ +_expectations[] = $expectation; + } + + /** + * @param mixed ...$args + */ + public function andReturn(...$args) + { + return $this->__call(__FUNCTION__, $args); + } + + /** + * Set a return value, or sequential queue of return values + * + * @param mixed ...$args + * @return self + */ + public function andReturns(...$args) + { + return call_user_func_array([$this, 'andReturn'], $args); + } + + /** + * Intercept any expectation calls and direct against all expectations + * + * @param string $method + * @param array $args + * @return self + */ + public function __call($method, array $args) + { + foreach ($this->_expectations as $expectation) { + call_user_func_array(array($expectation, $method), $args); + } + return $this; + } + + /** + * Return order number of the first expectation + * + * @return int + */ + public function getOrderNumber() + { + reset($this->_expectations); + $first = current($this->_expectations); + return $first->getOrderNumber(); + } + + /** + * Return the parent mock of the first expectation + * + * @return \Mockery\MockInterface + */ + public function getMock() + { + reset($this->_expectations); + $first = current($this->_expectations); + return $first->getMock(); + } + + /** + * Mockery API alias to getMock + * + * @return \Mockery\MockInterface + */ + public function mock() + { + return $this->getMock(); + } + + /** + * Starts a new expectation addition on the first mock which is the primary + * target outside of a demeter chain + * + * @param mixed ...$args + * @return \Mockery\Expectation + */ + public function shouldReceive(...$args) + { + reset($this->_expectations); + $first = current($this->_expectations); + return call_user_func_array(array($first->getMock(), 'shouldReceive'), $args); + } + + /** + * Starts a new expectation addition on the first mock which is the primary + * target outside of a demeter chain + * + * @param mixed ...$args + * @return \Mockery\Expectation + */ + public function shouldNotReceive(...$args) + { + reset($this->_expectations); + $first = current($this->_expectations); + return call_user_func_array(array($first->getMock(), 'shouldNotReceive'), $args); + } + + /** + * Return the string summary of this composite expectation + * + * @return string + */ + public function __toString() + { + $return = '['; + $parts = array(); + foreach ($this->_expectations as $exp) { + $parts[] = (string) $exp; + } + $return .= implode(', ', $parts) . ']'; + return $return; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Configuration.php b/vendor/mockery/mockery/library/Mockery/Configuration.php new file mode 100644 index 0000000..eaf7ffe --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Configuration.php @@ -0,0 +1,190 @@ +_allowMockingNonExistentMethod = (bool) $flag; + } + + /** + * Return flag indicating whether mocking non-existent methods allowed + * + * @return bool + */ + public function mockingNonExistentMethodsAllowed() + { + return $this->_allowMockingNonExistentMethod; + } + + /** + * @deprecated + * + * Set boolean to allow/prevent unnecessary mocking of methods + * + * @param bool $flag + */ + public function allowMockingMethodsUnnecessarily($flag = true) + { + trigger_error(sprintf("The %s method is deprecated and will be removed in a future version of Mockery", __METHOD__), E_USER_DEPRECATED); + + $this->_allowMockingMethodsUnnecessarily = (bool) $flag; + } + + /** + * Return flag indicating whether mocking non-existent methods allowed + * + * @return bool + */ + public function mockingMethodsUnnecessarilyAllowed() + { + trigger_error(sprintf("The %s method is deprecated and will be removed in a future version of Mockery", __METHOD__), E_USER_DEPRECATED); + + return $this->_allowMockingMethodsUnnecessarily; + } + + /** + * Set a parameter map (array of param signature strings) for the method + * of an internal PHP class. + * + * @param string $class + * @param string $method + * @param array $map + */ + public function setInternalClassMethodParamMap($class, $method, array $map) + { + if (!isset($this->_internalClassParamMap[strtolower($class)])) { + $this->_internalClassParamMap[strtolower($class)] = array(); + } + $this->_internalClassParamMap[strtolower($class)][strtolower($method)] = $map; + } + + /** + * Remove all overriden parameter maps from internal PHP classes. + */ + public function resetInternalClassMethodParamMaps() + { + $this->_internalClassParamMap = array(); + } + + /** + * Get the parameter map of an internal PHP class method + * + * @return array + */ + public function getInternalClassMethodParamMap($class, $method) + { + if (isset($this->_internalClassParamMap[strtolower($class)][strtolower($method)])) { + return $this->_internalClassParamMap[strtolower($class)][strtolower($method)]; + } + } + + public function getInternalClassMethodParamMaps() + { + return $this->_internalClassParamMap; + } + + public function setConstantsMap(array $map) + { + $this->_constantsMap = $map; + } + + public function getConstantsMap() + { + return $this->_constantsMap; + } + + /** + * Disable reflection caching + * + * It should be always enabled, except when using + * PHPUnit's --static-backup option. + * + * @see https://github.com/mockery/mockery/issues/268 + */ + public function disableReflectionCache() + { + $this->_reflectionCacheEnabled = false; + } + + /** + * Enable reflection caching + * + * It should be always enabled, except when using + * PHPUnit's --static-backup option. + * + * @see https://github.com/mockery/mockery/issues/268 + */ + public function enableReflectionCache() + { + $this->_reflectionCacheEnabled = true; + } + + /** + * Is reflection cache enabled? + */ + public function reflectionCacheEnabled() + { + return $this->_reflectionCacheEnabled; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Container.php b/vendor/mockery/mockery/library/Mockery/Container.php new file mode 100644 index 0000000..5287ac4 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Container.php @@ -0,0 +1,539 @@ +_generator = $generator ?: \Mockery::getDefaultGenerator(); + $this->_loader = $loader ?: \Mockery::getDefaultLoader(); + } + + /** + * Generates a new mock object for this container + * + * I apologies in advance for this. A God Method just fits the API which + * doesn't require differentiating between classes, interfaces, abstracts, + * names or partials - just so long as it's something that can be mocked. + * I'll refactor it one day so it's easier to follow. + * + * @param array ...$args + * + * @return Mock + * @throws Exception\RuntimeException + */ + public function mock(...$args) + { + $expectationClosure = null; + $quickdefs = array(); + $constructorArgs = null; + $blocks = array(); + $class = null; + + if (count($args) > 1) { + $finalArg = end($args); + reset($args); + if (is_callable($finalArg) && is_object($finalArg)) { + $expectationClosure = array_pop($args); + } + } + + $builder = new MockConfigurationBuilder(); + + foreach ($args as $k => $arg) { + if ($arg instanceof MockConfigurationBuilder) { + $builder = $arg; + unset($args[$k]); + } + } + reset($args); + + $builder->setParameterOverrides(\Mockery::getConfiguration()->getInternalClassMethodParamMaps()); + $builder->setConstantsMap(\Mockery::getConfiguration()->getConstantsMap()); + + while (count($args) > 0) { + $arg = current($args); + // check for multiple interfaces + if (is_string($arg) && strpos($arg, ',') && !strpos($arg, ']')) { + $interfaces = explode(',', str_replace(' ', '', $arg)); + $builder->addTargets($interfaces); + array_shift($args); + + continue; + } elseif (is_string($arg) && substr($arg, 0, 6) == 'alias:') { + $name = array_shift($args); + $name = str_replace('alias:', '', $name); + $builder->addTarget('stdClass'); + $builder->setName($name); + continue; + } elseif (is_string($arg) && substr($arg, 0, 9) == 'overload:') { + $name = array_shift($args); + $name = str_replace('overload:', '', $name); + $builder->setInstanceMock(true); + $builder->addTarget('stdClass'); + $builder->setName($name); + continue; + } elseif (is_string($arg) && substr($arg, strlen($arg)-1, 1) == ']') { + $parts = explode('[', $arg); + if (!class_exists($parts[0], true) && !interface_exists($parts[0], true)) { + throw new \Mockery\Exception('Can only create a partial mock from' + . ' an existing class or interface'); + } + $class = $parts[0]; + $parts[1] = str_replace(' ', '', $parts[1]); + $partialMethods = explode(',', strtolower(rtrim($parts[1], ']'))); + $builder->addTarget($class); + $builder->setWhiteListedMethods($partialMethods); + array_shift($args); + continue; + } elseif (is_string($arg) && (class_exists($arg, true) || interface_exists($arg, true) || trait_exists($arg, true))) { + $class = array_shift($args); + $builder->addTarget($class); + continue; + } elseif (is_string($arg) && !\Mockery::getConfiguration()->mockingNonExistentMethodsAllowed() && (!class_exists($arg, true) && !interface_exists($arg, true))) { + throw new \Mockery\Exception("Mockery can't find '$arg' so can't mock it"); + } elseif (is_string($arg)) { + if (!$this->isValidClassName($arg)) { + throw new \Mockery\Exception('Class name contains invalid characters'); + } + $class = array_shift($args); + $builder->addTarget($class); + continue; + } elseif (is_object($arg)) { + $partial = array_shift($args); + $builder->addTarget($partial); + continue; + } elseif (is_array($arg) && !empty($arg) && array_keys($arg) !== range(0, count($arg) - 1)) { + // if associative array + if (array_key_exists(self::BLOCKS, $arg)) { + $blocks = $arg[self::BLOCKS]; + } + unset($arg[self::BLOCKS]); + $quickdefs = array_shift($args); + continue; + } elseif (is_array($arg)) { + $constructorArgs = array_shift($args); + continue; + } + + throw new \Mockery\Exception( + 'Unable to parse arguments sent to ' + . get_class($this) . '::mock()' + ); + } + + $builder->addBlackListedMethods($blocks); + + if (defined('HHVM_VERSION') + && ($class === 'Exception' || is_subclass_of($class, 'Exception'))) { + $builder->addBlackListedMethod("setTraceOptions"); + $builder->addBlackListedMethod("getTraceOptions"); + } + + if (!is_null($constructorArgs)) { + $builder->addBlackListedMethod("__construct"); // we need to pass through + } else { + $builder->setMockOriginalDestructor(true); + } + + if (!empty($partialMethods) && $constructorArgs === null) { + $constructorArgs = array(); + } + + $config = $builder->getMockConfiguration(); + + $this->checkForNamedMockClashes($config); + + $def = $this->getGenerator()->generate($config); + + if (class_exists($def->getClassName(), $attemptAutoload = false)) { + $rfc = new \ReflectionClass($def->getClassName()); + if (!$rfc->implementsInterface("Mockery\MockInterface")) { + throw new \Mockery\Exception\RuntimeException("Could not load mock {$def->getClassName()}, class already exists"); + } + } + + $this->getLoader()->load($def); + + $mock = $this->_getInstance($def->getClassName(), $constructorArgs); + $mock->mockery_init($this, $config->getTargetObject()); + + if (!empty($quickdefs)) { + $mock->shouldReceive($quickdefs)->byDefault(); + } + if (!empty($expectationClosure)) { + $expectationClosure($mock); + } + $this->rememberMock($mock); + return $mock; + } + + public function instanceMock() + { + } + + public function getLoader() + { + return $this->_loader; + } + + public function getGenerator() + { + return $this->_generator; + } + + /** + * @param string $method + * @param string $parent + * @return string|null + */ + public function getKeyOfDemeterMockFor($method, $parent) + { + $keys = array_keys($this->_mocks); + $match = preg_grep("/__demeter_" . md5($parent) . "_{$method}$/", $keys); + if (count($match) == 1) { + $res = array_values($match); + if (count($res) > 0) { + return $res[0]; + } + } + return null; + } + + /** + * @return array + */ + public function getMocks() + { + return $this->_mocks; + } + + /** + * Tear down tasks for this container + * + * @throws \Exception + * @return void + */ + public function mockery_teardown() + { + try { + $this->mockery_verify(); + } catch (\Exception $e) { + $this->mockery_close(); + throw $e; + } + } + + /** + * Verify the container mocks + * + * @return void + */ + public function mockery_verify() + { + foreach ($this->_mocks as $mock) { + $mock->mockery_verify(); + } + } + + /** + * Retrieves all exceptions thrown by mocks + * + * @return array + */ + public function mockery_thrownExceptions() + { + $e = []; + + foreach ($this->_mocks as $mock) { + $e = array_merge($e, $mock->mockery_thrownExceptions()); + } + + return $e; + } + + /** + * Reset the container to its original state + * + * @return void + */ + public function mockery_close() + { + foreach ($this->_mocks as $mock) { + $mock->mockery_teardown(); + } + $this->_mocks = array(); + } + + /** + * Fetch the next available allocation order number + * + * @return int + */ + public function mockery_allocateOrder() + { + $this->_allocatedOrder += 1; + return $this->_allocatedOrder; + } + + /** + * Set ordering for a group + * + * @param mixed $group + * @param int $order + */ + public function mockery_setGroup($group, $order) + { + $this->_groups[$group] = $order; + } + + /** + * Fetch array of ordered groups + * + * @return array + */ + public function mockery_getGroups() + { + return $this->_groups; + } + + /** + * Set current ordered number + * + * @param int $order + * @return int The current order number that was set + */ + public function mockery_setCurrentOrder($order) + { + $this->_currentOrder = $order; + return $this->_currentOrder; + } + + /** + * Get current ordered number + * + * @return int + */ + public function mockery_getCurrentOrder() + { + return $this->_currentOrder; + } + + /** + * Validate the current mock's ordering + * + * @param string $method + * @param int $order + * @throws \Mockery\Exception + * @return void + */ + public function mockery_validateOrder($method, $order, \Mockery\MockInterface $mock) + { + if ($order < $this->_currentOrder) { + $exception = new \Mockery\Exception\InvalidOrderException( + 'Method ' . $method . ' called out of order: expected order ' + . $order . ', was ' . $this->_currentOrder + ); + $exception->setMock($mock) + ->setMethodName($method) + ->setExpectedOrder($order) + ->setActualOrder($this->_currentOrder); + throw $exception; + } + $this->mockery_setCurrentOrder($order); + } + + /** + * Gets the count of expectations on the mocks + * + * @return int + */ + public function mockery_getExpectationCount() + { + $count = 0; + foreach ($this->_mocks as $mock) { + $count += $mock->mockery_getExpectationCount(); + } + return $count; + } + + /** + * Store a mock and set its container reference + * + * @param \Mockery\Mock $mock + * @return \Mockery\MockInterface + */ + public function rememberMock(\Mockery\MockInterface $mock) + { + if (!isset($this->_mocks[get_class($mock)])) { + $this->_mocks[get_class($mock)] = $mock; + } else { + /** + * This condition triggers for an instance mock where origin mock + * is already remembered + */ + $this->_mocks[] = $mock; + } + return $mock; + } + + /** + * Retrieve the last remembered mock object, which is the same as saying + * retrieve the current mock being programmed where you have yet to call + * mock() to change it - thus why the method name is "self" since it will be + * be used during the programming of the same mock. + * + * @return \Mockery\Mock + */ + public function self() + { + $mocks = array_values($this->_mocks); + $index = count($mocks) - 1; + return $mocks[$index]; + } + + /** + * Return a specific remembered mock according to the array index it + * was stored to in this container instance + * + * @return \Mockery\Mock + */ + public function fetchMock($reference) + { + if (isset($this->_mocks[$reference])) { + return $this->_mocks[$reference]; + } + } + + protected function _getInstance($mockName, $constructorArgs = null) + { + if ($constructorArgs !== null) { + $r = new \ReflectionClass($mockName); + return $r->newInstanceArgs($constructorArgs); + } + + try { + $instantiator = new Instantiator; + $instance = $instantiator->instantiate($mockName); + } catch (\Exception $ex) { + $internalMockName = $mockName . '_Internal'; + + if (!class_exists($internalMockName)) { + eval("class $internalMockName extends $mockName {" . + 'public function __construct() {}' . + '}'); + } + + $instance = new $internalMockName(); + } + + return $instance; + } + + protected function checkForNamedMockClashes($config) + { + $name = $config->getName(); + + if (!$name) { + return; + } + + $hash = $config->getHash(); + + if (isset($this->_namedMocks[$name])) { + if ($hash !== $this->_namedMocks[$name]) { + throw new \Mockery\Exception( + "The mock named '$name' has been already defined with a different mock configuration" + ); + } + } + + $this->_namedMocks[$name] = $hash; + } + + /** + * see http://php.net/manual/en/language.oop5.basic.php + * @param string $className + * @return bool + */ + public function isValidClassName($className) + { + $pos = strpos($className, '\\'); + if ($pos === 0) { + $className = substr($className, 1); // remove the first backslash + } + // all the namespaces and class name should match the regex + $invalidNames = array_filter(explode('\\', $className), function ($name) { + return !preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $name); + }); + return empty($invalidNames); + } +} diff --git a/vendor/mockery/mockery/library/Mockery/CountValidator/AtLeast.php b/vendor/mockery/mockery/library/Mockery/CountValidator/AtLeast.php new file mode 100644 index 0000000..f6ac130 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/CountValidator/AtLeast.php @@ -0,0 +1,62 @@ +_limit > $n) { + $exception = new Mockery\Exception\InvalidCountException( + 'Method ' . (string) $this->_expectation + . ' from ' . $this->_expectation->getMock()->mockery_getName() + . ' should be called' . PHP_EOL + . ' at least ' . $this->_limit . ' times but called ' . $n + . ' times.' + ); + $exception->setMock($this->_expectation->getMock()) + ->setMethodName((string) $this->_expectation) + ->setExpectedCountComparative('>=') + ->setExpectedCount($this->_limit) + ->setActualCount($n); + throw $exception; + } + } +} diff --git a/vendor/mockery/mockery/library/Mockery/CountValidator/AtMost.php b/vendor/mockery/mockery/library/Mockery/CountValidator/AtMost.php new file mode 100644 index 0000000..4d23e28 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/CountValidator/AtMost.php @@ -0,0 +1,51 @@ +_limit < $n) { + $exception = new Mockery\Exception\InvalidCountException( + 'Method ' . (string) $this->_expectation + . ' from ' . $this->_expectation->getMock()->mockery_getName() + . ' should be called' . PHP_EOL + . ' at most ' . $this->_limit . ' times but called ' . $n + . ' times.' + ); + $exception->setMock($this->_expectation->getMock()) + ->setMethodName((string) $this->_expectation) + ->setExpectedCountComparative('<=') + ->setExpectedCount($this->_limit) + ->setActualCount($n); + throw $exception; + } + } +} diff --git a/vendor/mockery/mockery/library/Mockery/CountValidator/CountValidatorAbstract.php b/vendor/mockery/mockery/library/Mockery/CountValidator/CountValidatorAbstract.php new file mode 100644 index 0000000..ae3b0bf --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/CountValidator/CountValidatorAbstract.php @@ -0,0 +1,69 @@ +_expectation = $expectation; + $this->_limit = $limit; + } + + /** + * Checks if the validator can accept an additional nth call + * + * @param int $n + * @return bool + */ + public function isEligible($n) + { + return ($n < $this->_limit); + } + + /** + * Validate the call count against this validator + * + * @param int $n + * @return bool + */ + abstract public function validate($n); +} diff --git a/vendor/mockery/mockery/library/Mockery/CountValidator/Exact.php b/vendor/mockery/mockery/library/Mockery/CountValidator/Exact.php new file mode 100644 index 0000000..504f080 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/CountValidator/Exact.php @@ -0,0 +1,54 @@ +_limit !== $n) { + $because = $this->_expectation->getExceptionMessage(); + + $exception = new Mockery\Exception\InvalidCountException( + 'Method ' . (string) $this->_expectation + . ' from ' . $this->_expectation->getMock()->mockery_getName() + . ' should be called' . PHP_EOL + . ' exactly ' . $this->_limit . ' times but called ' . $n + . ' times.' + . ($because ? ' Because ' . $this->_expectation->getExceptionMessage() : '') + ); + $exception->setMock($this->_expectation->getMock()) + ->setMethodName((string) $this->_expectation) + ->setExpectedCountComparative('=') + ->setExpectedCount($this->_limit) + ->setActualCount($n); + throw $exception; + } + } +} diff --git a/vendor/mockery/mockery/library/Mockery/CountValidator/Exception.php b/vendor/mockery/mockery/library/Mockery/CountValidator/Exception.php new file mode 100644 index 0000000..b43aad3 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/CountValidator/Exception.php @@ -0,0 +1,25 @@ +dismissed = true; + + // we sometimes stack them + if ($this->getPrevious() && $this->getPrevious() instanceof BadMethodCallException) { + $this->getPrevious()->dismiss(); + } + } + + public function dismissed() + { + return $this->dismissed; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Exception/InvalidArgumentException.php b/vendor/mockery/mockery/library/Mockery/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..ccf5c76 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Exception/InvalidArgumentException.php @@ -0,0 +1,25 @@ +mockObject = $mock; + return $this; + } + + public function setMethodName($name) + { + $this->method = $name; + return $this; + } + + public function setActualCount($count) + { + $this->actual = $count; + return $this; + } + + public function setExpectedCount($count) + { + $this->expected = $count; + return $this; + } + + public function setExpectedCountComparative($comp) + { + if (!in_array($comp, array('=', '>', '<', '>=', '<='))) { + throw new RuntimeException( + 'Illegal comparative for expected call counts set: ' . $comp + ); + } + $this->expectedComparative = $comp; + return $this; + } + + public function getMock() + { + return $this->mockObject; + } + + public function getMethodName() + { + return $this->method; + } + + public function getActualCount() + { + return $this->actual; + } + + public function getExpectedCount() + { + return $this->expected; + } + + public function getMockName() + { + return $this->getMock()->mockery_getName(); + } + + public function getExpectedCountComparative() + { + return $this->expectedComparative; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Exception/InvalidOrderException.php b/vendor/mockery/mockery/library/Mockery/Exception/InvalidOrderException.php new file mode 100644 index 0000000..2134e09 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Exception/InvalidOrderException.php @@ -0,0 +1,83 @@ +mockObject = $mock; + return $this; + } + + public function setMethodName($name) + { + $this->method = $name; + return $this; + } + + public function setActualOrder($count) + { + $this->actual = $count; + return $this; + } + + public function setExpectedOrder($count) + { + $this->expected = $count; + return $this; + } + + public function getMock() + { + return $this->mockObject; + } + + public function getMethodName() + { + return $this->method; + } + + public function getActualOrder() + { + return $this->actual; + } + + public function getExpectedOrder() + { + return $this->expected; + } + + public function getMockName() + { + return $this->getMock()->mockery_getName(); + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Exception/NoMatchingExpectationException.php b/vendor/mockery/mockery/library/Mockery/Exception/NoMatchingExpectationException.php new file mode 100644 index 0000000..1657403 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Exception/NoMatchingExpectationException.php @@ -0,0 +1,70 @@ +mockObject = $mock; + return $this; + } + + public function setMethodName($name) + { + $this->method = $name; + return $this; + } + + public function setActualArguments($count) + { + $this->actual = $count; + return $this; + } + + public function getMock() + { + return $this->mockObject; + } + + public function getMethodName() + { + return $this->method; + } + + public function getActualArguments() + { + return $this->actual; + } + + public function getMockName() + { + return $this->getMock()->mockery_getName(); + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Exception/RuntimeException.php b/vendor/mockery/mockery/library/Mockery/Exception/RuntimeException.php new file mode 100644 index 0000000..4b2f53c --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Exception/RuntimeException.php @@ -0,0 +1,25 @@ +_mock = $mock; + $this->_name = $name; + $this->withAnyArgs(); + } + + /** + * Return a string with the method name and arguments formatted + * + * @param string $name Name of the expected method + * @param array $args List of arguments to the method + * @return string + */ + public function __toString() + { + return \Mockery::formatArgs($this->_name, $this->_expectedArgs); + } + + /** + * Verify the current call, i.e. that the given arguments match those + * of this expectation + * + * @param array $args + * @return mixed + */ + public function verifyCall(array $args) + { + $this->validateOrder(); + $this->_actualCount++; + if (true === $this->_passthru) { + return $this->_mock->mockery_callSubjectMethod($this->_name, $args); + } + + $return = $this->_getReturnValue($args); + $this->throwAsNecessary($return); + $this->_setValues(); + + return $return; + } + + /** + * Throws an exception if the expectation has been configured to do so + * + * @throws \Exception|\Throwable + * @return void + */ + private function throwAsNecessary($return) + { + if (!$this->_throw) { + return; + } + + $type = version_compare(PHP_VERSION, '7.0.0') >= 0 + ? "\Throwable" + : "\Exception"; + + if ($return instanceof $type) { + throw $return; + } + + return; + } + + /** + * Sets public properties with queued values to the mock object + * + * @param array $args + * @return mixed + */ + protected function _setValues() + { + $mockClass = get_class($this->_mock); + $container = $this->_mock->mockery_getContainer(); + $mocks = $container->getMocks(); + foreach ($this->_setQueue as $name => &$values) { + if (count($values) > 0) { + $value = array_shift($values); + foreach ($mocks as $mock) { + if (is_a($mock, $mockClass)) { + $mock->{$name} = $value; + } + } + } + } + } + + /** + * Fetch the return value for the matching args + * + * @param array $args + * @return mixed + */ + protected function _getReturnValue(array $args) + { + if (count($this->_closureQueue) > 1) { + return call_user_func_array(array_shift($this->_closureQueue), $args); + } elseif (count($this->_closureQueue) > 0) { + return call_user_func_array(current($this->_closureQueue), $args); + } elseif (count($this->_returnQueue) > 1) { + return array_shift($this->_returnQueue); + } elseif (count($this->_returnQueue) > 0) { + return current($this->_returnQueue); + } + + return $this->_mock->mockery_returnValueForMethod($this->_name); + } + + /** + * Checks if this expectation is eligible for additional calls + * + * @return bool + */ + public function isEligible() + { + foreach ($this->_countValidators as $validator) { + if (!$validator->isEligible($this->_actualCount)) { + return false; + } + } + return true; + } + + /** + * Check if there is a constraint on call count + * + * @return bool + */ + public function isCallCountConstrained() + { + return (count($this->_countValidators) > 0); + } + + /** + * Verify call order + * + * @return void + */ + public function validateOrder() + { + if ($this->_orderNumber) { + $this->_mock->mockery_validateOrder((string) $this, $this->_orderNumber, $this->_mock); + } + if ($this->_globalOrderNumber) { + $this->_mock->mockery_getContainer() + ->mockery_validateOrder((string) $this, $this->_globalOrderNumber, $this->_mock); + } + } + + /** + * Verify this expectation + * + * @return void + */ + public function verify() + { + foreach ($this->_countValidators as $validator) { + $validator->validate($this->_actualCount); + } + } + + /** + * Check if the registered expectation is an ArgumentListMatcher + * @return bool + */ + private function isArgumentListMatcher() + { + return (count($this->_expectedArgs) === 1 && ($this->_expectedArgs[0] instanceof ArgumentListMatcher)); + } + + private function isAndAnyOtherArgumentsMatcher($expectedArg) + { + return $expectedArg instanceof AndAnyOtherArgs; + } + + /** + * Check if passed arguments match an argument expectation + * + * @param array $args + * @return bool + */ + public function matchArgs(array $args) + { + if ($this->isArgumentListMatcher()) { + return $this->_matchArg($this->_expectedArgs[0], $args); + } + $argCount = count($args); + if ($argCount !== count((array) $this->_expectedArgs)) { + $lastExpectedArgument = end($this->_expectedArgs); + reset($this->_expectedArgs); + + if ($this->isAndAnyOtherArgumentsMatcher($lastExpectedArgument)) { + $argCountToSkipMatching = $argCount - count($this->_expectedArgs); + $args = array_slice($args, 0, $argCountToSkipMatching); + return $this->_matchArgs($args); + } + + return false; + } + + return $this->_matchArgs($args); + } + + /** + * Check if the passed arguments match the expectations, one by one. + * + * @param array $args + * @return bool + */ + protected function _matchArgs($args) + { + $argCount = count($args); + for ($i=0; $i<$argCount; $i++) { + $param =& $args[$i]; + if (!$this->_matchArg($this->_expectedArgs[$i], $param)) { + return false; + } + } + return true; + } + + /** + * Check if passed argument matches an argument expectation + * + * @param mixed $expected + * @param mixed $actual + * @return bool + */ + protected function _matchArg($expected, &$actual) + { + if ($expected === $actual) { + return true; + } + if (!is_object($expected) && !is_object($actual) && $expected == $actual) { + return true; + } + if (is_string($expected) && is_object($actual)) { + $result = $actual instanceof $expected; + if ($result) { + return true; + } + } + if ($expected instanceof \Mockery\Matcher\MatcherAbstract) { + return $expected->match($actual); + } + if ($expected instanceof \Hamcrest\Matcher || $expected instanceof \Hamcrest_Matcher) { + return $expected->matches($actual); + } + return false; + } + + /** + * Expected argument setter for the expectation + * + * @param mixed[] ...$args + * @return self + */ + public function with(...$args) + { + return $this->withArgs($args); + } + + /** + * Expected arguments for the expectation passed as an array + * + * @param array $arguments + * @return self + */ + private function withArgsInArray(array $arguments) + { + if (empty($arguments)) { + return $this->withNoArgs(); + } + $this->_expectedArgs = $arguments; + return $this; + } + + /** + * Expected arguments have to be matched by the given closure. + * + * @param Closure $closure + * @return self + */ + private function withArgsMatchedByClosure(Closure $closure) + { + $this->_expectedArgs = [new MultiArgumentClosure($closure)]; + return $this; + } + + /** + * Expected arguments for the expectation passed as an array or a closure that matches each passed argument on + * each function call. + * + * @param array|Closure $argsOrClosure + * @return self + */ + public function withArgs($argsOrClosure) + { + if (is_array($argsOrClosure)) { + $this->withArgsInArray($argsOrClosure); + } elseif ($argsOrClosure instanceof Closure) { + $this->withArgsMatchedByClosure($argsOrClosure); + } else { + throw new \InvalidArgumentException(sprintf('Call to %s with an invalid argument (%s), only array and '. + 'closure are allowed', __METHOD__, $argsOrClosure)); + } + return $this; + } + + /** + * Set with() as no arguments expected + * + * @return self + */ + public function withNoArgs() + { + $this->_expectedArgs = [new NoArgs()]; + return $this; + } + + /** + * Set expectation that any arguments are acceptable + * + * @return self + */ + public function withAnyArgs() + { + $this->_expectedArgs = [new AnyArgs()]; + return $this; + } + + /** + * Set a return value, or sequential queue of return values + * + * @param mixed[] ...$args + * @return self + */ + public function andReturn(...$args) + { + $this->_returnQueue = $args; + return $this; + } + + /** + * Set a return value, or sequential queue of return values + * + * @param mixed[] ...$args + * @return self + */ + public function andReturns(...$args) + { + return call_user_func_array([$this, 'andReturn'], $args); + } + + /** + * Return this mock, like a fluent interface + * + * @return self + */ + public function andReturnSelf() + { + return $this->andReturn($this->_mock); + } + + /** + * Set a sequential queue of return values with an array + * + * @param array $values + * @return self + */ + public function andReturnValues(array $values) + { + call_user_func_array(array($this, 'andReturn'), $values); + return $this; + } + + /** + * Set a closure or sequence of closures with which to generate return + * values. The arguments passed to the expected method are passed to the + * closures as parameters. + * + * @param callable[] ...$args + * @return self + */ + public function andReturnUsing(...$args) + { + $this->_closureQueue = $args; + return $this; + } + + /** + * Return a self-returning black hole object. + * + * @return self + */ + public function andReturnUndefined() + { + $this->andReturn(new \Mockery\Undefined); + return $this; + } + + /** + * Return null. This is merely a language construct for Mock describing. + * + * @return self + */ + public function andReturnNull() + { + return $this->andReturn(null); + } + + public function andReturnFalse() + { + return $this->andReturn(false); + } + + public function andReturnTrue() + { + return $this->andReturn(true); + } + + /** + * Set Exception class and arguments to that class to be thrown + * + * @param string|\Exception $exception + * @param string $message + * @param int $code + * @param \Exception $previous + * @return self + */ + public function andThrow($exception, $message = '', $code = 0, \Exception $previous = null) + { + $this->_throw = true; + if (is_object($exception)) { + $this->andReturn($exception); + } else { + $this->andReturn(new $exception($message, $code, $previous)); + } + return $this; + } + + public function andThrows($exception, $message = '', $code = 0, \Exception $previous = null) + { + return $this->andThrow($exception, $message, $code, $previous); + } + + /** + * Set Exception classes to be thrown + * + * @param array $exceptions + * @return self + */ + public function andThrowExceptions(array $exceptions) + { + $this->_throw = true; + foreach ($exceptions as $exception) { + if (!is_object($exception)) { + throw new Exception('You must pass an array of exception objects to andThrowExceptions'); + } + } + return $this->andReturnValues($exceptions); + } + + /** + * Register values to be set to a public property each time this expectation occurs + * + * @param string $name + * @param array ...$values + * @return self + */ + public function andSet($name, ...$values) + { + $this->_setQueue[$name] = $values; + return $this; + } + + /** + * Alias to andSet(). Allows the natural English construct + * - set('foo', 'bar')->andReturn('bar') + * + * @param string $name + * @param mixed $value + * @return self + */ + public function set($name, $value) + { + return call_user_func_array(array($this, 'andSet'), func_get_args()); + } + + /** + * Indicates this expectation should occur zero or more times + * + * @return self + */ + public function zeroOrMoreTimes() + { + $this->atLeast()->never(); + } + + /** + * Indicates the number of times this expectation should occur + * + * @param int $limit + * @throws \InvalidArgumentException + * @return self + */ + public function times($limit = null) + { + if (is_null($limit)) { + return $this; + } + if (!is_int($limit)) { + throw new \InvalidArgumentException('The passed Times limit should be an integer value'); + } + $this->_countValidators[$this->_countValidatorClass] = new $this->_countValidatorClass($this, $limit); + $this->_countValidatorClass = 'Mockery\CountValidator\Exact'; + return $this; + } + + /** + * Indicates that this expectation is never expected to be called + * + * @return self + */ + public function never() + { + return $this->times(0); + } + + /** + * Indicates that this expectation is expected exactly once + * + * @return self + */ + public function once() + { + return $this->times(1); + } + + /** + * Indicates that this expectation is expected exactly twice + * + * @return self + */ + public function twice() + { + return $this->times(2); + } + + /** + * Sets next count validator to the AtLeast instance + * + * @return self + */ + public function atLeast() + { + $this->_countValidatorClass = 'Mockery\CountValidator\AtLeast'; + return $this; + } + + /** + * Sets next count validator to the AtMost instance + * + * @return self + */ + public function atMost() + { + $this->_countValidatorClass = 'Mockery\CountValidator\AtMost'; + return $this; + } + + /** + * Shorthand for setting minimum and maximum constraints on call counts + * + * @param int $minimum + * @param int $maximum + */ + public function between($minimum, $maximum) + { + return $this->atLeast()->times($minimum)->atMost()->times($maximum); + } + + + /** + * Set the exception message + * + * @param string $message + * @return $this + */ + public function because($message) + { + $this->_because = $message; + return $this; + } + + /** + * Indicates that this expectation must be called in a specific given order + * + * @param string $group Name of the ordered group + * @return self + */ + public function ordered($group = null) + { + if ($this->_globally) { + $this->_globalOrderNumber = $this->_defineOrdered($group, $this->_mock->mockery_getContainer()); + } else { + $this->_orderNumber = $this->_defineOrdered($group, $this->_mock); + } + $this->_globally = false; + return $this; + } + + /** + * Indicates call order should apply globally + * + * @return self + */ + public function globally() + { + $this->_globally = true; + return $this; + } + + /** + * Setup the ordering tracking on the mock or mock container + * + * @param string $group + * @param object $ordering + * @return int + */ + protected function _defineOrdered($group, $ordering) + { + $groups = $ordering->mockery_getGroups(); + if (is_null($group)) { + $result = $ordering->mockery_allocateOrder(); + } elseif (isset($groups[$group])) { + $result = $groups[$group]; + } else { + $result = $ordering->mockery_allocateOrder(); + $ordering->mockery_setGroup($group, $result); + } + return $result; + } + + /** + * Return order number + * + * @return int + */ + public function getOrderNumber() + { + return $this->_orderNumber; + } + + /** + * Mark this expectation as being a default + * + * @return self + */ + public function byDefault() + { + $director = $this->_mock->mockery_getExpectationsFor($this->_name); + if (!empty($director)) { + $director->makeExpectationDefault($this); + } + return $this; + } + + /** + * Return the parent mock of the expectation + * + * @return \Mockery\MockInterface + */ + public function getMock() + { + return $this->_mock; + } + + /** + * Flag this expectation as calling the original class method with the + * any provided arguments instead of using a return value queue. + * + * @return self + */ + public function passthru() + { + if ($this->_mock instanceof Mock) { + throw new Exception( + 'Mock Objects not created from a loaded/existing class are ' + . 'incapable of passing method calls through to a parent class' + ); + } + $this->_passthru = true; + return $this; + } + + /** + * Cloning logic + * + */ + public function __clone() + { + $newValidators = array(); + $countValidators = $this->_countValidators; + foreach ($countValidators as $validator) { + $newValidators[] = clone $validator; + } + $this->_countValidators = $newValidators; + } + + public function getName() + { + return $this->_name; + } + + public function getExceptionMessage() + { + return $this->_because; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/ExpectationDirector.php b/vendor/mockery/mockery/library/Mockery/ExpectationDirector.php new file mode 100644 index 0000000..d9bb6fb --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/ExpectationDirector.php @@ -0,0 +1,218 @@ +_name = $name; + $this->_mock = $mock; + } + + /** + * Add a new expectation to the director + * + * @param \Mockery\Expectation $expectation + */ + public function addExpectation(\Mockery\Expectation $expectation) + { + $this->_expectations[] = $expectation; + } + + /** + * Handle a method call being directed by this instance + * + * @param array $args + * @return mixed + */ + public function call(array $args) + { + $expectation = $this->findExpectation($args); + if (is_null($expectation)) { + $exception = new \Mockery\Exception\NoMatchingExpectationException( + 'No matching handler found for ' + . $this->_mock->mockery_getName() . '::' + . \Mockery::formatArgs($this->_name, $args) + . '. Either the method was unexpected or its arguments matched' + . ' no expected argument list for this method' + . PHP_EOL . PHP_EOL + . \Mockery::formatObjects($args) + ); + $exception->setMock($this->_mock) + ->setMethodName($this->_name) + ->setActualArguments($args); + throw $exception; + } + return $expectation->verifyCall($args); + } + + /** + * Verify all expectations of the director + * + * @throws \Mockery\CountValidator\Exception + * @return void + */ + public function verify() + { + if (!empty($this->_expectations)) { + foreach ($this->_expectations as $exp) { + $exp->verify(); + } + } else { + foreach ($this->_defaults as $exp) { + $exp->verify(); + } + } + } + + /** + * Attempt to locate an expectation matching the provided args + * + * @param array $args + * @return mixed + */ + public function findExpectation(array $args) + { + $expectation = null; + + if (!empty($this->_expectations)) { + $expectation = $this->_findExpectationIn($this->_expectations, $args); + } + + if ($expectation === null && !empty($this->_defaults)) { + $expectation = $this->_findExpectationIn($this->_defaults, $args); + } + + return $expectation; + } + + /** + * Make the given expectation a default for all others assuming it was + * correctly created last + * + * @param \Mockery\Expectation $expectation + */ + public function makeExpectationDefault(\Mockery\Expectation $expectation) + { + $last = end($this->_expectations); + if ($last === $expectation) { + array_pop($this->_expectations); + array_unshift($this->_defaults, $expectation); + } else { + throw new \Mockery\Exception( + 'Cannot turn a previously defined expectation into a default' + ); + } + } + + /** + * Search current array of expectations for a match + * + * @param array $expectations + * @param array $args + * @return mixed + */ + protected function _findExpectationIn(array $expectations, array $args) + { + foreach ($expectations as $exp) { + if ($exp->isEligible() && $exp->matchArgs($args)) { + return $exp; + } + } + foreach ($expectations as $exp) { + if ($exp->matchArgs($args)) { + return $exp; + } + } + } + + /** + * Return all expectations assigned to this director + * + * @return array + */ + public function getExpectations() + { + return $this->_expectations; + } + + /** + * Return all expectations assigned to this director + * + * @return array + */ + public function getDefaultExpectations() + { + return $this->_defaults; + } + + /** + * Return the number of expectations assigned to this director. + * + * @return int + */ + public function getExpectationCount() + { + return count($this->getExpectations()) ?: count($this->getDefaultExpectations()); + } +} diff --git a/vendor/mockery/mockery/library/Mockery/ExpectationInterface.php b/vendor/mockery/mockery/library/Mockery/ExpectationInterface.php new file mode 100644 index 0000000..7d0b536 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/ExpectationInterface.php @@ -0,0 +1,46 @@ +once(); + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/CachingGenerator.php b/vendor/mockery/mockery/library/Mockery/Generator/CachingGenerator.php new file mode 100644 index 0000000..6497e88 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/CachingGenerator.php @@ -0,0 +1,45 @@ +generator = $generator; + } + + public function generate(MockConfiguration $config) + { + $hash = $config->getHash(); + if (isset($this->cache[$hash])) { + return $this->cache[$hash]; + } + + $definition = $this->generator->generate($config); + $this->cache[$hash] = $definition; + + return $definition; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/DefinedTargetClass.php b/vendor/mockery/mockery/library/Mockery/Generator/DefinedTargetClass.php new file mode 100644 index 0000000..663b225 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/DefinedTargetClass.php @@ -0,0 +1,108 @@ +rfc = $rfc; + } + + public static function factory($name) + { + return new self(new \ReflectionClass($name)); + } + + public function getName() + { + return $this->rfc->getName(); + } + + public function isAbstract() + { + return $this->rfc->isAbstract(); + } + + public function isFinal() + { + return $this->rfc->isFinal(); + } + + public function getMethods() + { + return array_map(function ($method) { + return new Method($method); + }, $this->rfc->getMethods()); + } + + public function getInterfaces() + { + $class = __CLASS__; + return array_map(function ($interface) use ($class) { + return new $class($interface); + }, $this->rfc->getInterfaces()); + } + + public function __toString() + { + return $this->getName(); + } + + public function getNamespaceName() + { + return $this->rfc->getNamespaceName(); + } + + public function inNamespace() + { + return $this->rfc->inNamespace(); + } + + public function getShortName() + { + return $this->rfc->getShortName(); + } + + public function implementsInterface($interface) + { + return $this->rfc->implementsInterface($interface); + } + + public function hasInternalAncestor() + { + if ($this->rfc->isInternal()) { + return true; + } + + $child = $this->rfc; + while ($parent = $child->getParentClass()) { + if ($parent->isInternal()) { + return true; + } + $child = $parent; + } + + return false; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/Generator.php b/vendor/mockery/mockery/library/Mockery/Generator/Generator.php new file mode 100644 index 0000000..459a93c --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/Generator.php @@ -0,0 +1,27 @@ +method = $method; + } + + public function __call($method, $args) + { + return call_user_func_array(array($this->method, $method), $args); + } + + public function getParameters() + { + return array_map(function ($parameter) { + return new Parameter($parameter); + }, $this->method->getParameters()); + } + + public function getReturnType() + { + if (defined('HHVM_VERSION') && method_exists($this->method, 'getReturnTypeText') && $this->method->hasReturnType()) { + // Available in HHVM + $returnType = $this->method->getReturnTypeText(); + + // Remove tuple, ImmVector<>, ImmSet<>, ImmMap<>, array<>, anything with <>, void, mixed which cause eval() errors + if (preg_match('/(\w+<.*>)|(\(.+\))|(HH\\\\(void|mixed|this))/', $returnType)) { + return ''; + } + + // return directly without going through php logic. + return $returnType; + } + + if (version_compare(PHP_VERSION, '7.0.0-dev') >= 0 && $this->method->hasReturnType()) { + $returnType = (string) $this->method->getReturnType(); + + if ('self' === $returnType) { + $returnType = "\\".$this->method->getDeclaringClass()->getName(); + } elseif (!\Mockery::isBuiltInType($returnType)) { + $returnType = '\\'.$returnType; + } + + if (version_compare(PHP_VERSION, '7.1.0-dev') >= 0 && $this->method->getReturnType()->allowsNull()) { + $returnType = '?'.$returnType; + } + + return $returnType; + } + return ''; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/MockConfiguration.php b/vendor/mockery/mockery/library/Mockery/Generator/MockConfiguration.php new file mode 100644 index 0000000..5293118 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/MockConfiguration.php @@ -0,0 +1,579 @@ +addTargets($targets); + $this->blackListedMethods = $blackListedMethods; + $this->whiteListedMethods = $whiteListedMethods; + $this->name = $name; + $this->instanceMock = $instanceMock; + $this->parameterOverrides = $parameterOverrides; + $this->mockOriginalDestructor = $mockOriginalDestructor; + $this->constantsMap = $constantsMap; + } + + /** + * Attempt to create a hash of the configuration, in order to allow caching + * + * @TODO workout if this will work + * + * @return string + */ + public function getHash() + { + $vars = array( + 'targetClassName' => $this->targetClassName, + 'targetInterfaceNames' => $this->targetInterfaceNames, + 'targetTraitNames' => $this->targetTraitNames, + 'name' => $this->name, + 'blackListedMethods' => $this->blackListedMethods, + 'whiteListedMethod' => $this->whiteListedMethods, + 'instanceMock' => $this->instanceMock, + 'parameterOverrides' => $this->parameterOverrides, + 'mockOriginalDestructor' => $this->mockOriginalDestructor + ); + + return md5(serialize($vars)); + } + + /** + * Gets a list of methods from the classes, interfaces and objects and + * filters them appropriately. Lot's of filtering going on, perhaps we could + * have filter classes to iterate through + */ + public function getMethodsToMock() + { + $methods = $this->getAllMethods(); + + foreach ($methods as $key => $method) { + if ($method->isFinal()) { + unset($methods[$key]); + } + } + + /** + * Whitelist trumps everything else + */ + if (count($this->getWhiteListedMethods())) { + $whitelist = array_map('strtolower', $this->getWhiteListedMethods()); + $methods = array_filter($methods, function ($method) use ($whitelist) { + return $method->isAbstract() || in_array(strtolower($method->getName()), $whitelist); + }); + + return $methods; + } + + /** + * Remove blacklisted methods + */ + if (count($this->getBlackListedMethods())) { + $blacklist = array_map('strtolower', $this->getBlackListedMethods()); + $methods = array_filter($methods, function ($method) use ($blacklist) { + return !in_array(strtolower($method->getName()), $blacklist); + }); + } + + /** + * Internal objects can not be instantiated with newInstanceArgs and if + * they implement Serializable, unserialize will have to be called. As + * such, we can't mock it and will need a pass to add a dummy + * implementation + */ + if ($this->getTargetClass() + && $this->getTargetClass()->implementsInterface("Serializable") + && $this->getTargetClass()->hasInternalAncestor()) { + $methods = array_filter($methods, function ($method) { + return $method->getName() !== "unserialize"; + }); + } + + return array_values($methods); + } + + /** + * We declare the __call method to handle undefined stuff, if the class + * we're mocking has also defined it, we need to comply with their interface + */ + public function requiresCallTypeHintRemoval() + { + foreach ($this->getAllMethods() as $method) { + if ("__call" === $method->getName()) { + $params = $method->getParameters(); + return !$params[1]->isArray(); + } + } + + return false; + } + + /** + * We declare the __callStatic method to handle undefined stuff, if the class + * we're mocking has also defined it, we need to comply with their interface + */ + public function requiresCallStaticTypeHintRemoval() + { + foreach ($this->getAllMethods() as $method) { + if ("__callStatic" === $method->getName()) { + $params = $method->getParameters(); + return !$params[1]->isArray(); + } + } + + return false; + } + + public function rename($className) + { + $targets = array(); + + if ($this->targetClassName) { + $targets[] = $this->targetClassName; + } + + if ($this->targetInterfaceNames) { + $targets = array_merge($targets, $this->targetInterfaceNames); + } + + if ($this->targetTraitNames) { + $targets = array_merge($targets, $this->targetTraitNames); + } + + if ($this->targetObject) { + $targets[] = $this->targetObject; + } + + return new self( + $targets, + $this->blackListedMethods, + $this->whiteListedMethods, + $className, + $this->instanceMock, + $this->parameterOverrides, + $this->mockOriginalDestructor, + $this->constantsMap + ); + } + + protected function addTarget($target) + { + if (is_object($target)) { + $this->setTargetObject($target); + $this->setTargetClassName(get_class($target)); + return $this; + } + + if ($target[0] !== "\\") { + $target = "\\" . $target; + } + + if (class_exists($target)) { + $this->setTargetClassName($target); + return $this; + } + + if (interface_exists($target)) { + $this->addTargetInterfaceName($target); + return $this; + } + + if (trait_exists($target)) { + $this->addTargetTraitName($target); + return $this; + } + + /** + * Default is to set as class, or interface if class already set + * + * Don't like this condition, can't remember what the default + * targetClass is for + */ + if ($this->getTargetClassName()) { + $this->addTargetInterfaceName($target); + return $this; + } + + $this->setTargetClassName($target); + } + + protected function addTargets($interfaces) + { + foreach ($interfaces as $interface) { + $this->addTarget($interface); + } + } + + public function getTargetClassName() + { + return $this->targetClassName; + } + + public function getTargetClass() + { + if ($this->targetClass) { + return $this->targetClass; + } + + if (!$this->targetClassName) { + return null; + } + + if (class_exists($this->targetClassName)) { + $dtc = DefinedTargetClass::factory($this->targetClassName); + + if ($this->getTargetObject() == false && $dtc->isFinal()) { + throw new \Mockery\Exception( + 'The class ' . $this->targetClassName . ' is marked final and its methods' + . ' cannot be replaced. Classes marked final can be passed in' + . ' to \Mockery::mock() as instantiated objects to create a' + . ' partial mock, but only if the mock is not subject to type' + . ' hinting checks.' + ); + } + + $this->targetClass = $dtc; + } else { + $this->targetClass = UndefinedTargetClass::factory($this->targetClassName); + } + + return $this->targetClass; + } + + public function getTargetTraits() + { + if (!empty($this->targetTraits)) { + return $this->targetTraits; + } + + foreach ($this->targetTraitNames as $targetTrait) { + $this->targetTraits[] = DefinedTargetClass::factory($targetTrait); + } + + $this->targetTraits = array_unique($this->targetTraits); // just in case + return $this->targetTraits; + } + + public function getTargetInterfaces() + { + if (!empty($this->targetInterfaces)) { + return $this->targetInterfaces; + } + + foreach ($this->targetInterfaceNames as $targetInterface) { + if (!interface_exists($targetInterface)) { + $this->targetInterfaces[] = UndefinedTargetClass::factory($targetInterface); + return; + } + + $dtc = DefinedTargetClass::factory($targetInterface); + $extendedInterfaces = array_keys($dtc->getInterfaces()); + $extendedInterfaces[] = $targetInterface; + + $traversableFound = false; + $iteratorShiftedToFront = false; + foreach ($extendedInterfaces as $interface) { + if (!$traversableFound && preg_match("/^\\?Iterator(|Aggregate)$/i", $interface)) { + break; + } + + if (preg_match("/^\\\\?IteratorAggregate$/i", $interface)) { + $this->targetInterfaces[] = DefinedTargetClass::factory("\\IteratorAggregate"); + $iteratorShiftedToFront = true; + } elseif (preg_match("/^\\\\?Iterator$/i", $interface)) { + $this->targetInterfaces[] = DefinedTargetClass::factory("\\Iterator"); + $iteratorShiftedToFront = true; + } elseif (preg_match("/^\\\\?Traversable$/i", $interface)) { + $traversableFound = true; + } + } + + if ($traversableFound && !$iteratorShiftedToFront) { + $this->targetInterfaces[] = DefinedTargetClass::factory("\\IteratorAggregate"); + } + + /** + * We never straight up implement Traversable + */ + if (!preg_match("/^\\\\?Traversable$/i", $targetInterface)) { + $this->targetInterfaces[] = $dtc; + } + } + $this->targetInterfaces = array_unique($this->targetInterfaces); // just in case + return $this->targetInterfaces; + } + + public function getTargetObject() + { + return $this->targetObject; + } + + public function getName() + { + return $this->name; + } + + /** + * Generate a suitable name based on the config + */ + public function generateName() + { + $name = 'Mockery_' . static::$mockCounter++; + + if ($this->getTargetObject()) { + $name .= "_" . str_replace("\\", "_", get_class($this->getTargetObject())); + } + + if ($this->getTargetClass()) { + $name .= "_" . str_replace("\\", "_", $this->getTargetClass()->getName()); + } + + if ($this->getTargetInterfaces()) { + $name .= array_reduce($this->getTargetInterfaces(), function ($tmpname, $i) { + $tmpname .= '_' . str_replace("\\", "_", $i->getName()); + return $tmpname; + }, ''); + } + + return $name; + } + + public function getShortName() + { + $parts = explode("\\", $this->getName()); + return array_pop($parts); + } + + public function getNamespaceName() + { + $parts = explode("\\", $this->getName()); + array_pop($parts); + + if (count($parts)) { + return implode("\\", $parts); + } + + return ""; + } + + public function getBlackListedMethods() + { + return $this->blackListedMethods; + } + + public function getWhiteListedMethods() + { + return $this->whiteListedMethods; + } + + public function isInstanceMock() + { + return $this->instanceMock; + } + + public function getParameterOverrides() + { + return $this->parameterOverrides; + } + + public function isMockOriginalDestructor() + { + return $this->mockOriginalDestructor; + } + + protected function setTargetClassName($targetClassName) + { + $this->targetClassName = $targetClassName; + } + + protected function getAllMethods() + { + if ($this->allMethods) { + return $this->allMethods; + } + + $classes = $this->getTargetInterfaces(); + + if ($this->getTargetClass()) { + $classes[] = $this->getTargetClass(); + } + + $methods = array(); + foreach ($classes as $class) { + $methods = array_merge($methods, $class->getMethods()); + } + + foreach ($this->getTargetTraits() as $trait) { + foreach ($trait->getMethods() as $method) { + if ($method->isAbstract()) { + $methods[] = $method; + } + } + } + + $names = array(); + $methods = array_filter($methods, function ($method) use (&$names) { + if (in_array($method->getName(), $names)) { + return false; + } + + $names[] = $method->getName(); + return true; + }); + + // In HHVM, class methods can be annotated with the built-in + // <<__Memoize>> attribute (similar to a Python decorator), + // which builds an LRU cache of method arguments and their + // return values. + // https://docs.hhvm.com/hack/attributes/special#__memoize + // + // HHVM implements this behavior by inserting a private helper + // method into the class at runtime which is named as the + // method to be memoized, suffixed by `$memoize_impl`. + // https://github.com/facebook/hhvm/blob/6aa46f1e8c2351b97d65e67b73e26f274a7c3f2e/hphp/runtime/vm/func.cpp#L364 + // + // Ordinarily, PHP does not all allow the `$` token in method + // names, but since the memoization helper is inserted at + // runtime (and not in userland), HHVM allows it. + // + // We use code generation and eval() for some types of mocks, + // so to avoid syntax errors from these memoization helpers, + // we must filter them from our list of class methods. + // + // This effectively disables the memoization behavior in HHVM, + // but that's preferable to failing catastrophically when + // attempting to mock a class using the attribute. + if (defined('HHVM_VERSION')) { + $methods = array_filter($methods, function ($method) { + return strpos($method->getName(), '$memoize_impl') === false; + }); + } + + return $this->allMethods = $methods; + } + + /** + * If we attempt to implement Traversable, we must ensure we are also + * implementing either Iterator or IteratorAggregate, and that whichever one + * it is comes before Traversable in the list of implements. + */ + protected function addTargetInterfaceName($targetInterface) + { + $this->targetInterfaceNames[] = $targetInterface; + } + + protected function addTargetTraitName($targetTraitName) + { + $this->targetTraitNames[] = $targetTraitName; + } + + protected function setTargetObject($object) + { + $this->targetObject = $object; + } + + public function getConstantsMap() + { + return $this->constantsMap; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/MockConfigurationBuilder.php b/vendor/mockery/mockery/library/Mockery/Generator/MockConfigurationBuilder.php new file mode 100644 index 0000000..8170492 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/MockConfigurationBuilder.php @@ -0,0 +1,176 @@ += 0) { + $this->blackListedMethods = array_diff($this->blackListedMethods, $this->php7SemiReservedKeywords); + } + } + + public function addTarget($target) + { + $this->targets[] = $target; + + return $this; + } + + public function addTargets($targets) + { + foreach ($targets as $target) { + $this->addTarget($target); + } + + return $this; + } + + public function setName($name) + { + $this->name = $name; + return $this; + } + + public function addBlackListedMethod($blackListedMethod) + { + $this->blackListedMethods[] = $blackListedMethod; + return $this; + } + + public function addBlackListedMethods(array $blackListedMethods) + { + foreach ($blackListedMethods as $method) { + $this->addBlackListedMethod($method); + } + return $this; + } + + public function setBlackListedMethods(array $blackListedMethods) + { + $this->blackListedMethods = $blackListedMethods; + return $this; + } + + public function addWhiteListedMethod($whiteListedMethod) + { + $this->whiteListedMethods[] = $whiteListedMethod; + return $this; + } + + public function addWhiteListedMethods(array $whiteListedMethods) + { + foreach ($whiteListedMethods as $method) { + $this->addWhiteListedMethod($method); + } + return $this; + } + + public function setWhiteListedMethods(array $whiteListedMethods) + { + $this->whiteListedMethods = $whiteListedMethods; + return $this; + } + + public function setInstanceMock($instanceMock) + { + $this->instanceMock = (bool) $instanceMock; + } + + public function setParameterOverrides(array $overrides) + { + $this->parameterOverrides = $overrides; + } + + public function setMockOriginalDestructor($mockDestructor) + { + $this->mockOriginalDestructor = $mockDestructor; + return $this; + } + + public function setConstantsMap(array $map) + { + $this->constantsMap = $map; + } + + public function getMockConfiguration() + { + return new MockConfiguration( + $this->targets, + $this->blackListedMethods, + $this->whiteListedMethods, + $this->name, + $this->instanceMock, + $this->parameterOverrides, + $this->mockOriginalDestructor, + $this->constantsMap + ); + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/MockDefinition.php b/vendor/mockery/mockery/library/Mockery/Generator/MockDefinition.php new file mode 100644 index 0000000..fd6a9fa --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/MockDefinition.php @@ -0,0 +1,51 @@ +getName()) { + throw new \InvalidArgumentException("MockConfiguration must contain a name"); + } + $this->config = $config; + $this->code = $code; + } + + public function getConfig() + { + return $this->config; + } + + public function getClassName() + { + return $this->config->getName(); + } + + public function getCode() + { + return $this->code; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/Parameter.php b/vendor/mockery/mockery/library/Mockery/Generator/Parameter.php new file mode 100644 index 0000000..a5338c0 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/Parameter.php @@ -0,0 +1,110 @@ +rfp = $rfp; + } + + public function __call($method, array $args) + { + return call_user_func_array(array($this->rfp, $method), $args); + } + + public function getClass() + { + return new DefinedTargetClass($this->rfp->getClass()); + } + + public function getTypeHintAsString() + { + if (method_exists($this->rfp, 'getTypehintText')) { + // Available in HHVM + $typehint = $this->rfp->getTypehintText(); + + // not exhaustive, but will do for now + if (in_array($typehint, array('int', 'integer', 'float', 'string', 'bool', 'boolean'))) { + return ''; + } + + return $typehint; + } + + if ($this->rfp->isArray()) { + return 'array'; + } + + /* + * PHP < 5.4.1 has some strange behaviour with a typehint of self and + * subclass signatures, so we risk the regexp instead + */ + if ((version_compare(PHP_VERSION, '5.4.1') >= 0)) { + try { + if ($this->rfp->getClass()) { + return $this->rfp->getClass()->getName(); + } + } catch (\ReflectionException $re) { + // noop + } + } + + if (version_compare(PHP_VERSION, '7.0.0-dev') >= 0 && $this->rfp->hasType()) { + return (string) $this->rfp->getType(); + } + + if (preg_match('/^Parameter #[0-9]+ \[ \<(required|optional)\> (?\S+ )?.*\$' . $this->rfp->getName() . ' .*\]$/', $this->rfp->__toString(), $typehintMatch)) { + if (!empty($typehintMatch['typehint'])) { + return $typehintMatch['typehint']; + } + } + + return ''; + } + + /** + * Some internal classes have funny looking definitions... + */ + public function getName() + { + $name = $this->rfp->getName(); + if (!$name || $name == '...') { + $name = 'arg' . static::$parameterCounter++; + } + + return $name; + } + + + /** + * Variadics only introduced in 5.6 + */ + public function isVariadic() + { + return $this->rfp->isVariadic(); + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/CallTypeHintPass.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/CallTypeHintPass.php new file mode 100644 index 0000000..fd00264 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/CallTypeHintPass.php @@ -0,0 +1,47 @@ +requiresCallTypeHintRemoval()) { + $code = str_replace( + 'public function __call($method, array $args)', + 'public function __call($method, $args)', + $code + ); + } + + if ($config->requiresCallStaticTypeHintRemoval()) { + $code = str_replace( + 'public static function __callStatic($method, array $args)', + 'public static function __callStatic($method, $args)', + $code + ); + } + + return $code; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ClassNamePass.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ClassNamePass.php new file mode 100644 index 0000000..b5a3109 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ClassNamePass.php @@ -0,0 +1,49 @@ +getNamespaceName(); + + $namespace = ltrim($namespace, "\\"); + + $className = $config->getShortName(); + + $code = str_replace( + 'namespace Mockery;', + $namespace ? 'namespace ' . $namespace . ';' : '', + $code + ); + + $code = str_replace( + 'class Mock', + 'class ' . $className, + $code + ); + + return $code; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ClassPass.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ClassPass.php new file mode 100644 index 0000000..91ccfab --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ClassPass.php @@ -0,0 +1,52 @@ +getTargetClass(); + + if (!$target) { + return $code; + } + + if ($target->isFinal()) { + return $code; + } + + $className = ltrim($target->getName(), "\\"); + if (!class_exists($className)) { + \Mockery::declareClass($className); + } + + $code = str_replace( + "implements MockInterface", + "extends \\" . $className . " implements MockInterface", + $code + ); + + return $code; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ConstantsPass.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ConstantsPass.php new file mode 100644 index 0000000..28f5cdf --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/ConstantsPass.php @@ -0,0 +1,33 @@ +getConstantsMap(); + if (empty($cm)) { + return $code; + } + + if (!isset($cm[$config->getName()])) { + return $code; + } + + $cm = $cm[$config->getName()]; + + $constantsCode = ''; + foreach ($cm as $constant => $value) { + $constantsCode .= sprintf("\n const %s = '%s';\n", $constant, $value); + } + + $i = strrpos($code, '}'); + $code = substr_replace($code, $constantsCode, $i); + $code .= "}\n"; + + return $code; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/InstanceMockPass.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/InstanceMockPass.php new file mode 100644 index 0000000..6279147 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/InstanceMockPass.php @@ -0,0 +1,83 @@ +_mockery_ignoreVerification = false; + \$associatedRealObject = \Mockery::fetchMock(__CLASS__); + + foreach (get_object_vars(\$this) as \$attr => \$val) { + if (\$attr !== "_mockery_ignoreVerification" && \$attr !== "_mockery_expectations") { + \$this->\$attr = \$associatedRealObject->\$attr; + } + } + + \$directors = \$associatedRealObject->mockery_getExpectations(); + foreach (\$directors as \$method=>\$director) { + // get the director method needed + \$existingDirector = \$this->mockery_getExpectationsFor(\$method); + if (!\$existingDirector) { + \$existingDirector = new \Mockery\ExpectationDirector(\$method, \$this); + \$this->mockery_setExpectationsFor(\$method, \$existingDirector); + } + \$expectations = \$director->getExpectations(); + foreach (\$expectations as \$expectation) { + \$clonedExpectation = clone \$expectation; + \$existingDirector->addExpectation(\$clonedExpectation); + } + \$defaultExpectations = \$director->getDefaultExpectations(); + foreach (array_reverse(\$defaultExpectations) as \$expectation) { + \$clonedExpectation = clone \$expectation; + \$existingDirector->addExpectation(\$clonedExpectation); + \$existingDirector->makeExpectationDefault(\$clonedExpectation); + } + } + \Mockery::getContainer()->rememberMock(\$this); + + \$this->_mockery_constructorCalled(func_get_args()); + } +MOCK; + + public function apply($code, MockConfiguration $config) + { + if ($config->isInstanceMock()) { + $code = $this->appendToClass($code, static::INSTANCE_MOCK_CODE); + } + + return $code; + } + + protected function appendToClass($class, $code) + { + $lastBrace = strrpos($class, "}"); + $class = substr($class, 0, $lastBrace) . $code . "\n }\n"; + return $class; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/InterfacePass.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/InterfacePass.php new file mode 100644 index 0000000..982956e --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/InterfacePass.php @@ -0,0 +1,48 @@ +getTargetInterfaces() as $i) { + $name = ltrim($i->getName(), "\\"); + if (!interface_exists($name)) { + \Mockery::declareInterface($name); + } + } + + $interfaces = array_reduce((array) $config->getTargetInterfaces(), function ($code, $i) { + return $code . ", \\" . ltrim($i->getName(), "\\"); + }, ""); + + $code = str_replace( + "implements MockInterface", + "implements MockInterface" . $interfaces, + $code + ); + + return $code; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/MagicMethodTypeHintsPass.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/MagicMethodTypeHintsPass.php new file mode 100644 index 0000000..4a457b3 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/MagicMethodTypeHintsPass.php @@ -0,0 +1,208 @@ +getMagicMethods($config->getTargetClass()); + foreach ($config->getTargetInterfaces() as $interface) { + $magicMethods = array_merge($magicMethods, $this->getMagicMethods($interface)); + } + + foreach ($magicMethods as $method) { + $code = $this->applyMagicTypeHints($code, $method); + } + + return $code; + } + + /** + * Returns the magic methods within the + * passed DefinedTargetClass. + * + * @param TargetClassInterface $class + * @return array + */ + public function getMagicMethods( + TargetClassInterface $class = null + ) { + if (is_null($class)) { + return array(); + } + return array_filter($class->getMethods(), function (Method $method) { + return in_array($method->getName(), $this->mockMagicMethods); + }); + } + + /** + * Applies type hints of magic methods from + * class to the passed code. + * + * @param int $code + * @param Method $method + * @return string + */ + private function applyMagicTypeHints($code, Method $method) + { + if ($this->isMethodWithinCode($code, $method)) { + $namedParameters = $this->getOriginalParameters( + $code, + $method + ); + $code = preg_replace( + $this->getDeclarationRegex($method->getName()), + $this->getMethodDeclaration($method, $namedParameters), + $code + ); + } + return $code; + } + + /** + * Checks if the method is declared withing code. + * + * @param int $code + * @param Method $method + * @return boolean + */ + private function isMethodWithinCode($code, Method $method) + { + return preg_match( + $this->getDeclarationRegex($method->getName()), + $code + ) == 1; + } + + /** + * Returns the method original parameters, as they're + * described in the $code string. + * + * @param int $code + * @param Method $method + * @return array + */ + private function getOriginalParameters($code, Method $method) + { + $matches = []; + $parameterMatches = []; + + preg_match( + $this->getDeclarationRegex($method->getName()), + $code, + $matches + ); + + if (count($matches) > 0) { + preg_match_all( + '/(?<=\$)(\w+)+/i', + $matches[0], + $parameterMatches + ); + } + + $groupMatches = end($parameterMatches); + $parameterNames = is_array($groupMatches) ? + $groupMatches : + array($groupMatches); + + return $parameterNames; + } + + /** + * Gets the declaration code, as a string, for the passed method. + * + * @param Method $method + * @param array $namedParameters + * @return string + */ + private function getMethodDeclaration( + Method $method, + array $namedParameters + ) { + $declaration = 'public'; + $declaration .= $method->isStatic() ? ' static' : ''; + $declaration .= ' function '.$method->getName().'('; + + foreach ($method->getParameters() as $index => $parameter) { + $declaration .= $parameter->getTypeHintAsString().' '; + $name = isset($namedParameters[$index]) ? + $namedParameters[$index] : + $parameter->getName(); + $declaration .= '$'.$name; + $declaration .= ','; + } + $declaration = rtrim($declaration, ','); + $declaration .= ') '; + + $returnType = $method->getReturnType(); + if (!empty($returnType)) { + $declaration .= ': '.$returnType; + } + + return $declaration; + } + + /** + * Returns a regex string used to match the + * declaration of some method. + * + * @param string $methodName + * @return string + */ + private function getDeclarationRegex($methodName) + { + return "/public\s+(?:static\s+)?function\s+$methodName\s*\(.*\)\s*(?=\{)/i"; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/MethodDefinitionPass.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/MethodDefinitionPass.php new file mode 100644 index 0000000..c83ecf8 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/MethodDefinitionPass.php @@ -0,0 +1,175 @@ +getMethodsToMock() as $method) { + if ($method->isPublic()) { + $methodDef = 'public'; + } elseif ($method->isProtected()) { + $methodDef = 'protected'; + } else { + $methodDef = 'private'; + } + + if ($method->isStatic()) { + $methodDef .= ' static'; + } + + $methodDef .= ' function '; + $methodDef .= $method->returnsReference() ? ' & ' : ''; + $methodDef .= $method->getName(); + $methodDef .= $this->renderParams($method, $config); + $methodDef .= $this->renderReturnType($method); + $methodDef .= $this->renderMethodBody($method, $config); + + $code = $this->appendToClass($code, $methodDef); + } + + return $code; + } + + protected function renderParams(Method $method, $config) + { + $class = $method->getDeclaringClass(); + if ($class->isInternal()) { + $overrides = $config->getParameterOverrides(); + + if (isset($overrides[strtolower($class->getName())][$method->getName()])) { + return '(' . implode(',', $overrides[strtolower($class->getName())][$method->getName()]) . ')'; + } + } + + $methodParams = array(); + $params = $method->getParameters(); + foreach ($params as $param) { + $paramDef = $this->renderTypeHint($param); + $paramDef .= $param->isPassedByReference() ? '&' : ''; + $paramDef .= $param->isVariadic() ? '...' : ''; + $paramDef .= '$' . $param->getName(); + + if (!$param->isVariadic()) { + if (false !== $param->isDefaultValueAvailable()) { + $paramDef .= ' = ' . var_export($param->getDefaultValue(), true); + } elseif ($param->isOptional()) { + $paramDef .= ' = null'; + } + } + + $methodParams[] = $paramDef; + } + return '(' . implode(', ', $methodParams) . ')'; + } + + protected function renderReturnType(Method $method) + { + $type = $method->getReturnType(); + return $type ? sprintf(': %s', $type) : ''; + } + + protected function appendToClass($class, $code) + { + $lastBrace = strrpos($class, "}"); + $class = substr($class, 0, $lastBrace) . $code . "\n }\n"; + return $class; + } + + protected function renderTypeHint(Parameter $param) + { + $typeHint = trim($param->getTypeHintAsString()); + + if (!empty($typeHint)) { + if (!\Mockery::isBuiltInType($typeHint)) { + $typeHint = '\\'.$typeHint; + } + + if (version_compare(PHP_VERSION, '7.1.0-dev') >= 0 && $param->allowsNull()) { + $typeHint = "?".$typeHint; + } + } + + return $typeHint .= ' '; + } + + private function renderMethodBody($method, $config) + { + $invoke = $method->isStatic() ? 'static::_mockery_handleStaticMethodCall' : '$this->_mockery_handleMethodCall'; + $body = <<getDeclaringClass(); + $class_name = strtolower($class->getName()); + $overrides = $config->getParameterOverrides(); + if (isset($overrides[$class_name][$method->getName()])) { + $params = array_values($overrides[$class_name][$method->getName()]); + $paramCount = count($params); + for ($i = 0; $i < $paramCount; ++$i) { + $param = $params[$i]; + if (strpos($param, '&') !== false) { + $body .= << $i) { + \$argv[$i] = {$param}; +} + +BODY; + } + } + } else { + $params = array_values($method->getParameters()); + $paramCount = count($params); + for ($i = 0; $i < $paramCount; ++$i) { + $param = $params[$i]; + if (!$param->isPassedByReference()) { + continue; + } + $body .= << $i) { + \$argv[$i] =& \${$param->getName()}; +} + +BODY; + } + } + + $body .= "\$ret = {$invoke}(__FUNCTION__, \$argv);\n"; + + if ($method->getReturnType() !== "void") { + $body .= "return \$ret;\n"; + } + + $body .= "}\n"; + return $body; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/Pass.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/Pass.php new file mode 100644 index 0000000..f7b72c9 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/Pass.php @@ -0,0 +1,28 @@ + '/public function __wakeup\(\)\s+\{.*?\}/sm', + ); + + public function apply($code, MockConfiguration $config) + { + $target = $config->getTargetClass(); + + if (!$target) { + return $code; + } + + foreach ($target->getMethods() as $method) { + if ($method->isFinal() && isset($this->methods[$method->getName()])) { + $code = preg_replace($this->methods[$method->getName()], '', $code); + } + } + + return $code; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/RemoveDestructorPass.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/RemoveDestructorPass.php new file mode 100644 index 0000000..ed5a420 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/RemoveDestructorPass.php @@ -0,0 +1,45 @@ + + */ + +namespace Mockery\Generator\StringManipulation\Pass; + +use Mockery\Generator\MockConfiguration; + +/** + * Remove mock's empty destructor if we tend to use original class destructor + */ +class RemoveDestructorPass +{ + public function apply($code, MockConfiguration $config) + { + $target = $config->getTargetClass(); + + if (!$target) { + return $code; + } + + if (!$config->isMockOriginalDestructor()) { + $code = preg_replace('/public function __destruct\(\)\s+\{.*?\}/sm', '', $code); + } + + return $code; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/RemoveUnserializeForInternalSerializableClassesPass.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/RemoveUnserializeForInternalSerializableClassesPass.php new file mode 100644 index 0000000..840fe99 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/RemoveUnserializeForInternalSerializableClassesPass.php @@ -0,0 +1,58 @@ +getTargetClass(); + + if (!$target) { + return $code; + } + + if (!$target->hasInternalAncestor() || !$target->implementsInterface("Serializable")) { + return $code; + } + + $code = $this->appendToClass($code, self::DUMMY_METHOD_DEFINITION); + + return $code; + } + + protected function appendToClass($class, $code) + { + $lastBrace = strrpos($class, "}"); + $class = substr($class, 0, $lastBrace) . $code . "\n }\n"; + return $class; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/TraitPass.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/TraitPass.php new file mode 100644 index 0000000..13343c3 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulation/Pass/TraitPass.php @@ -0,0 +1,47 @@ +getTargetTraits(); + + if (empty($traits)) { + return $code; + } + + $useStatements = array_map(function ($trait) { + return "use \\\\".ltrim($trait->getName(), "\\").";"; + }, $traits); + + $code = preg_replace( + '/^{$/m', + "{\n ".implode("\n ", $useStatements)."\n", + $code + ); + + return $code; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/StringManipulationGenerator.php b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulationGenerator.php new file mode 100644 index 0000000..544bb88 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/StringManipulationGenerator.php @@ -0,0 +1,87 @@ +passes = $passes; + } + + public function generate(MockConfiguration $config) + { + $code = file_get_contents(__DIR__ . '/../Mock.php'); + $className = $config->getName() ?: $config->generateName(); + + $namedConfig = $config->rename($className); + + foreach ($this->passes as $pass) { + $code = $pass->apply($code, $namedConfig); + } + + return new MockDefinition($namedConfig, $code); + } + + public function addPass(Pass $pass) + { + $this->passes[] = $pass; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Generator/TargetClassInterface.php b/vendor/mockery/mockery/library/Mockery/Generator/TargetClassInterface.php new file mode 100644 index 0000000..7724412 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Generator/TargetClassInterface.php @@ -0,0 +1,107 @@ +name = $name; + } + + public static function factory($name) + { + return new self($name); + } + + public function getName() + { + return $this->name; + } + + public function isAbstract() + { + return false; + } + + public function isFinal() + { + return false; + } + + public function getMethods() + { + return array(); + } + + public function getInterfaces() + { + return array(); + } + + public function getNamespaceName() + { + $parts = explode("\\", ltrim($this->getName(), "\\")); + array_pop($parts); + return implode("\\", $parts); + } + + public function inNamespace() + { + return $this->getNamespaceName() !== ''; + } + + public function getShortName() + { + $parts = explode("\\", $this->getName()); + return array_pop($parts); + } + + public function implementsInterface($interface) + { + return false; + } + + public function hasInternalAncestor() + { + return false; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/HigherOrderMessage.php b/vendor/mockery/mockery/library/Mockery/HigherOrderMessage.php new file mode 100644 index 0000000..1c13c89 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/HigherOrderMessage.php @@ -0,0 +1,49 @@ +mock = $mock; + $this->method = $method; + } + + /** + * @return \Mockery\Expectation + */ + public function __call($method, $args) + { + if ($this->method === 'shouldNotHaveReceived') { + return $this->mock->{$this->method}($method, $args); + } + + $expectation = $this->mock->{$this->method}($method); + return $expectation->withArgs($args); + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Instantiator.php b/vendor/mockery/mockery/library/Mockery/Instantiator.php new file mode 100644 index 0000000..0e2c464 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Instantiator.php @@ -0,0 +1,209 @@ +. + */ + +namespace Mockery; + +use Closure; +use ReflectionClass; +use UnexpectedValueException; +use InvalidArgumentException; + +/** + * This is a trimmed down version of https://github.com/doctrine/instantiator, + * basically without the caching + * + * @author Marco Pivetta + */ +final class Instantiator +{ + /** + * Markers used internally by PHP to define whether {@see \unserialize} should invoke + * the method {@see \Serializable::unserialize()} when dealing with classes implementing + * the {@see \Serializable} interface. + */ + const SERIALIZATION_FORMAT_USE_UNSERIALIZER = 'C'; + const SERIALIZATION_FORMAT_AVOID_UNSERIALIZER = 'O'; + + /** + * {@inheritDoc} + */ + public function instantiate($className) + { + $factory = $this->buildFactory($className); + $instance = $factory(); + + return $instance; + } + + /** + * @internal + * @private + * + * Builds a {@see \Closure} capable of instantiating the given $className without + * invoking its constructor. + * This method is only exposed as public because of PHP 5.3 compatibility. Do not + * use this method in your own code + * + * @param string $className + * + * @return Closure + */ + public function buildFactory($className) + { + $reflectionClass = $this->getReflectionClass($className); + + if ($this->isInstantiableViaReflection($reflectionClass)) { + return function () use ($reflectionClass) { + return $reflectionClass->newInstanceWithoutConstructor(); + }; + } + + $serializedString = sprintf( + '%s:%d:"%s":0:{}', + $this->getSerializationFormat($reflectionClass), + strlen($className), + $className + ); + + $this->attemptInstantiationViaUnSerialization($reflectionClass, $serializedString); + + return function () use ($serializedString) { + return unserialize($serializedString); + }; + } + + /** + * @param string $className + * + * @return ReflectionClass + * + * @throws InvalidArgumentException + */ + private function getReflectionClass($className) + { + if (! class_exists($className)) { + throw new InvalidArgumentException("Class:$className does not exist"); + } + + $reflection = new ReflectionClass($className); + + if ($reflection->isAbstract()) { + throw new InvalidArgumentException("Class:$className is an abstract class"); + } + + return $reflection; + } + + /** + * @param ReflectionClass $reflectionClass + * @param string $serializedString + * + * @throws UnexpectedValueException + * + * @return void + */ + private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, $serializedString) + { + set_error_handler(function ($code, $message, $file, $line) use ($reflectionClass, & $error) { + $msg = sprintf( + 'Could not produce an instance of "%s" via un-serialization, since an error was triggered in file "%s" at line "%d"', + $reflectionClass->getName(), + $file, + $line + ); + + $error = new UnexpectedValueException($msg, 0, new \Exception($message, $code)); + }); + + try { + unserialize($serializedString); + } catch (\Exception $exception) { + restore_error_handler(); + + throw new UnexpectedValueException("An exception was raised while trying to instantiate an instance of \"{$reflectionClass->getName()}\" via un-serialization", 0, $exception); + } + + restore_error_handler(); + + if ($error) { + throw $error; + } + } + + /** + * @param ReflectionClass $reflectionClass + * + * @return bool + */ + private function isInstantiableViaReflection(ReflectionClass $reflectionClass) + { + return ! ($reflectionClass->isInternal() && $reflectionClass->isFinal()); + } + + /** + * Verifies whether the given class is to be considered internal + * + * @param ReflectionClass $reflectionClass + * + * @return bool + */ + private function hasInternalAncestors(ReflectionClass $reflectionClass) + { + do { + if ($reflectionClass->isInternal()) { + return true; + } + } while ($reflectionClass = $reflectionClass->getParentClass()); + + return false; + } + + /** + * Verifies if the given PHP version implements the `Serializable` interface serialization + * with an incompatible serialization format. If that's the case, use serialization marker + * "C" instead of "O". + * + * @link http://news.php.net/php.internals/74654 + * + * @param ReflectionClass $reflectionClass + * + * @return string the serialization format marker, either self::SERIALIZATION_FORMAT_USE_UNSERIALIZER + * or self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER + */ + private function getSerializationFormat(ReflectionClass $reflectionClass) + { + if ($this->isPhpVersionWithBrokenSerializationFormat() + && $reflectionClass->implementsInterface('Serializable') + ) { + return self::SERIALIZATION_FORMAT_USE_UNSERIALIZER; + } + + return self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER; + } + + /** + * Checks whether the current PHP runtime uses an incompatible serialization format + * + * @return bool + */ + private function isPhpVersionWithBrokenSerializationFormat() + { + return PHP_VERSION_ID === 50429 || PHP_VERSION_ID === 50513; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Loader/EvalLoader.php b/vendor/mockery/mockery/library/Mockery/Loader/EvalLoader.php new file mode 100644 index 0000000..e5f78a2 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Loader/EvalLoader.php @@ -0,0 +1,36 @@ +getClassName(), false)) { + return; + } + + eval("?>" . $definition->getCode()); + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Loader/Loader.php b/vendor/mockery/mockery/library/Mockery/Loader/Loader.php new file mode 100644 index 0000000..170ffb6 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Loader/Loader.php @@ -0,0 +1,28 @@ +path = realpath($path) ?: sys_get_temp_dir(); + } + + public function load(MockDefinition $definition) + { + if (class_exists($definition->getClassName(), false)) { + return; + } + + $tmpfname = $this->path.DIRECTORY_SEPARATOR."Mockery_".uniqid().".php"; + file_put_contents($tmpfname, $definition->getCode()); + + require $tmpfname; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/AndAnyOtherArgs.php b/vendor/mockery/mockery/library/Mockery/Matcher/AndAnyOtherArgs.php new file mode 100644 index 0000000..e3c3b94 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/AndAnyOtherArgs.php @@ -0,0 +1,45 @@ +'; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/Any.php b/vendor/mockery/mockery/library/Mockery/Matcher/Any.php new file mode 100644 index 0000000..1ff440b --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/Any.php @@ -0,0 +1,45 @@ +'; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/AnyArgs.php b/vendor/mockery/mockery/library/Mockery/Matcher/AnyArgs.php new file mode 100644 index 0000000..9663a76 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/AnyArgs.php @@ -0,0 +1,40 @@ +'; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/AnyOf.php b/vendor/mockery/mockery/library/Mockery/Matcher/AnyOf.php new file mode 100644 index 0000000..bcce4b7 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/AnyOf.php @@ -0,0 +1,46 @@ +_expected, true); + } + + /** + * Return a string representation of this Matcher + * + * @return string + */ + public function __toString() + { + return ''; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/ArgumentListMatcher.php b/vendor/mockery/mockery/library/Mockery/Matcher/ArgumentListMatcher.php new file mode 100644 index 0000000..04408f5 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/ArgumentListMatcher.php @@ -0,0 +1,25 @@ +_expected; + $result = $closure($actual); + return $result === true; + } + + /** + * Return a string representation of this Matcher + * + * @return string + */ + public function __toString() + { + return ''; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/Contains.php b/vendor/mockery/mockery/library/Mockery/Matcher/Contains.php new file mode 100644 index 0000000..79afb73 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/Contains.php @@ -0,0 +1,64 @@ +_expected as $exp) { + $match = false; + foreach ($values as $val) { + if ($exp === $val || $exp == $val) { + $match = true; + break; + } + } + if ($match === false) { + return false; + } + } + return true; + } + + /** + * Return a string representation of this Matcher + * + * @return string + */ + public function __toString() + { + $return = '_expected as $v) { + $elements[] = (string) $v; + } + $return .= implode(', ', $elements) . ']>'; + return $return; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/Ducktype.php b/vendor/mockery/mockery/library/Mockery/Matcher/Ducktype.php new file mode 100644 index 0000000..291f422 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/Ducktype.php @@ -0,0 +1,53 @@ +_expected as $method) { + if (!method_exists($actual, $method)) { + return false; + } + } + return true; + } + + /** + * Return a string representation of this Matcher + * + * @return string + */ + public function __toString() + { + return '_expected) . ']>'; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/HasKey.php b/vendor/mockery/mockery/library/Mockery/Matcher/HasKey.php new file mode 100644 index 0000000..fa983ea --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/HasKey.php @@ -0,0 +1,45 @@ +_expected, $actual); + } + + /** + * Return a string representation of this Matcher + * + * @return string + */ + public function __toString() + { + return "_expected]>"; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/HasValue.php b/vendor/mockery/mockery/library/Mockery/Matcher/HasValue.php new file mode 100644 index 0000000..8ca6afd --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/HasValue.php @@ -0,0 +1,46 @@ +_expected, $actual); + } + + /** + * Return a string representation of this Matcher + * + * @return string + */ + public function __toString() + { + $return = '_expected . ']>'; + return $return; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/MatcherAbstract.php b/vendor/mockery/mockery/library/Mockery/Matcher/MatcherAbstract.php new file mode 100644 index 0000000..3233079 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/MatcherAbstract.php @@ -0,0 +1,58 @@ +_expected = $expected; + } + + /** + * Check if the actual value matches the expected. + * Actual passed by reference to preserve reference trail (where applicable) + * back to the original method parameter. + * + * @param mixed $actual + * @return bool + */ + abstract public function match(&$actual); + + /** + * Return a string representation of this Matcher + * + * @return string + */ + abstract public function __toString(); +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/MultiArgumentClosure.php b/vendor/mockery/mockery/library/Mockery/Matcher/MultiArgumentClosure.php new file mode 100644 index 0000000..8f00a89 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/MultiArgumentClosure.php @@ -0,0 +1,49 @@ +_expected; + return true === call_user_func_array($closure, $actual); + } + + /** + * Return a string representation of this Matcher + * + * @return string + */ + public function __toString() + { + return ''; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/MustBe.php b/vendor/mockery/mockery/library/Mockery/Matcher/MustBe.php new file mode 100644 index 0000000..27b5ec5 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/MustBe.php @@ -0,0 +1,52 @@ +_expected === $actual; + } + + return $this->_expected == $actual; + } + + /** + * Return a string representation of this Matcher + * + * @return string + */ + public function __toString() + { + return ''; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/NoArgs.php b/vendor/mockery/mockery/library/Mockery/Matcher/NoArgs.php new file mode 100644 index 0000000..5e9e418 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/NoArgs.php @@ -0,0 +1,40 @@ +'; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/Not.php b/vendor/mockery/mockery/library/Mockery/Matcher/Not.php new file mode 100644 index 0000000..756ccaa --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/Not.php @@ -0,0 +1,46 @@ +_expected; + } + + /** + * Return a string representation of this Matcher + * + * @return string + */ + public function __toString() + { + return ''; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/NotAnyOf.php b/vendor/mockery/mockery/library/Mockery/Matcher/NotAnyOf.php new file mode 100644 index 0000000..cd82701 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/NotAnyOf.php @@ -0,0 +1,51 @@ +_expected as $exp) { + if ($actual === $exp || $actual == $exp) { + return false; + } + } + return true; + } + + /** + * Return a string representation of this Matcher + * + * @return string + */ + public function __toString() + { + return ''; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/PHPUnitConstraint.php b/vendor/mockery/mockery/library/Mockery/Matcher/PHPUnitConstraint.php new file mode 100644 index 0000000..a9aaf4c --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/PHPUnitConstraint.php @@ -0,0 +1,76 @@ +constraint = $constraint; + $this->rethrow = $rethrow; + } + + /** + * @param mixed $actual + * @return bool + */ + public function match(&$actual) + { + try { + $this->constraint->evaluate($actual); + return true; + } catch (\PHPUnit_Framework_AssertionFailedError $e) { + if ($this->rethrow) { + throw $e; + } + return false; + } catch (\PHPUnit\Framework\AssertionFailedError $e) { + if ($this->rethrow) { + throw $e; + } + return false; + } + } + + /** + * + */ + public function __toString() + { + return ''; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/Pattern.php b/vendor/mockery/mockery/library/Mockery/Matcher/Pattern.php new file mode 100644 index 0000000..362c366 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/Pattern.php @@ -0,0 +1,45 @@ +_expected, (string) $actual) >= 1; + } + + /** + * Return a string representation of this Matcher + * + * @return string + */ + public function __toString() + { + return ''; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/Subset.php b/vendor/mockery/mockery/library/Mockery/Matcher/Subset.php new file mode 100644 index 0000000..5e706c8 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/Subset.php @@ -0,0 +1,92 @@ +expected = $expected; + $this->strict = $strict; + } + + /** + * @param array $expected Expected subset of data + * + * @return Subset + */ + public static function strict(array $expected) + { + return new static($expected, true); + } + + /** + * @param array $expected Expected subset of data + * + * @return Subset + */ + public static function loose(array $expected) + { + return new static($expected, false); + } + + /** + * Check if the actual value matches the expected. + * + * @param mixed $actual + * @return bool + */ + public function match(&$actual) + { + if (!is_array($actual)) { + return false; + } + + if ($this->strict) { + return $actual === array_replace_recursive($actual, $this->expected); + } + + return $actual == array_replace_recursive($actual, $this->expected); + } + + /** + * Return a string representation of this Matcher + * + * @return string + */ + public function __toString() + { + $return = 'expected as $k=>$v) { + $elements[] = $k . '=' . (string) $v; + } + $return .= implode(', ', $elements) . ']>'; + return $return; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Matcher/Type.php b/vendor/mockery/mockery/library/Mockery/Matcher/Type.php new file mode 100644 index 0000000..dc189ab --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Matcher/Type.php @@ -0,0 +1,52 @@ +_expected); + if (function_exists($function)) { + return $function($actual); + } elseif (is_string($this->_expected) + && (class_exists($this->_expected) || interface_exists($this->_expected))) { + return $actual instanceof $this->_expected; + } + return false; + } + + /** + * Return a string representation of this Matcher + * + * @return string + */ + public function __toString() + { + return '<' . ucfirst($this->_expected) . '>'; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/MethodCall.php b/vendor/mockery/mockery/library/Mockery/MethodCall.php new file mode 100644 index 0000000..db68fd8 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/MethodCall.php @@ -0,0 +1,43 @@ +method = $method; + $this->args = $args; + } + + public function getMethod() + { + return $this->method; + } + + public function getArgs() + { + return $this->args; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Mock.php b/vendor/mockery/mockery/library/Mockery/Mock.php new file mode 100644 index 0000000..cf0aa13 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Mock.php @@ -0,0 +1,935 @@ +_mockery_container = $container; + if (!is_null($partialObject)) { + $this->_mockery_partial = $partialObject; + } + + if (!\Mockery::getConfiguration()->mockingNonExistentMethodsAllowed()) { + foreach ($this->mockery_getMethods() as $method) { + if ($method->isPublic() && !$method->isStatic()) { + $this->_mockery_mockableMethods[] = $method->getName(); + } + } + } + } + + /** + * Set expected method calls + * + * @param array ...$methodNames one or many methods that are expected to be called in this mock + * + * @return \Mockery\ExpectationInterface|\Mockery\Expectation|\Mockery\HigherOrderMessage + */ + public function shouldReceive(...$methodNames) + { + if (count($methodNames) === 0) { + return new HigherOrderMessage($this, "shouldReceive"); + } + + foreach ($methodNames as $method) { + if ("" == $method) { + throw new \InvalidArgumentException("Received empty method name"); + } + } + + $self = $this; + $allowMockingProtectedMethods = $this->_mockery_allowMockingProtectedMethods; + + $lastExpectation = \Mockery::parseShouldReturnArgs( + $this, $methodNames, function ($method) use ($self, $allowMockingProtectedMethods) { + $rm = $self->mockery_getMethod($method); + if ($rm) { + if ($rm->isPrivate()) { + throw new \InvalidArgumentException("$method() cannot be mocked as it is a private method"); + } + if (!$allowMockingProtectedMethods && $rm->isProtected()) { + throw new \InvalidArgumentException("$method() cannot be mocked as it is a protected method and mocking protected methods is not enabled for the currently used mock object. Use shouldAllowMockingProtectedMethods() to enable mocking of protected methods."); + } + } + + $director = $self->mockery_getExpectationsFor($method); + if (!$director) { + $director = new \Mockery\ExpectationDirector($method, $self); + $self->mockery_setExpectationsFor($method, $director); + } + $expectation = new \Mockery\Expectation($self, $method); + $director->addExpectation($expectation); + return $expectation; + } + ); + return $lastExpectation; + } + + /** + * @param mixed $something String method name or map of method => return + * @return self|\Mockery\ExpectationInterface|\Mockery\Expectation|\Mockery\HigherOrderMessage + */ + public function allows($something = []) + { + if (is_string($something)) { + return $this->shouldReceive($something); + } + + if (empty($something)) { + return $this->shouldReceive(); + } + + foreach ($something as $method => $returnValue) { + $this->shouldReceive($method)->andReturn($returnValue); + } + + return $this; + } + + /** + * @param mixed $something String method name (optional) + * @return \Mockery\ExpectationInterface|\Mockery\Expectation|ExpectsHigherOrderMessage + */ + public function expects($something = null) + { + if (is_string($something)) { + return $this->shouldReceive($something)->once(); + } + + return new ExpectsHigherOrderMessage($this); + } + + /** + * Shortcut method for setting an expectation that a method should not be called. + * + * @param array ...$methodNames one or many methods that are expected not to be called in this mock + * @return \Mockery\ExpectationInterface|\Mockery\Expectation|\Mockery\HigherOrderMessage + */ + public function shouldNotReceive(...$methodNames) + { + if (count($methodNames) === 0) { + return new HigherOrderMessage($this, "shouldNotReceive"); + } + + $expectation = call_user_func_array(array($this, 'shouldReceive'), $methodNames); + $expectation->never(); + return $expectation; + } + + /** + * Allows additional methods to be mocked that do not explicitly exist on mocked class + * @param String $method name of the method to be mocked + * @return Mock + */ + public function shouldAllowMockingMethod($method) + { + $this->_mockery_mockableMethods[] = $method; + return $this; + } + + /** + * Set mock to ignore unexpected methods and return Undefined class + * @param mixed $returnValue the default return value for calls to missing functions on this mock + * @return Mock + */ + public function shouldIgnoreMissing($returnValue = null) + { + $this->_mockery_ignoreMissing = true; + $this->_mockery_defaultReturnValue = $returnValue; + return $this; + } + + public function asUndefined() + { + $this->_mockery_ignoreMissing = true; + $this->_mockery_defaultReturnValue = new \Mockery\Undefined; + return $this; + } + + /** + * @return Mock + */ + public function shouldAllowMockingProtectedMethods() + { + $this->_mockery_allowMockingProtectedMethods = true; + return $this; + } + + + /** + * Set mock to defer unexpected methods to it's parent + * + * This is particularly useless for this class, as it doesn't have a parent, + * but included for completeness + * + * @deprecated 2.0.0 Please use makePartial() instead + * + * @return Mock + */ + public function shouldDeferMissing() + { + return $this->makePartial(); + } + + /** + * Set mock to defer unexpected methods to it's parent + * + * It was an alias for shouldDeferMissing(), which will be removed + * in 2.0.0. + * + * @return Mock + */ + public function makePartial() + { + $this->_mockery_deferMissing = true; + return $this; + } + + /** + * In the event shouldReceive() accepting one or more methods/returns, + * this method will switch them from normal expectations to default + * expectations + * + * @return self + */ + public function byDefault() + { + foreach ($this->_mockery_expectations as $director) { + $exps = $director->getExpectations(); + foreach ($exps as $exp) { + $exp->byDefault(); + } + } + return $this; + } + + /** + * Capture calls to this mock + */ + public function __call($method, array $args) + { + return $this->_mockery_handleMethodCall($method, $args); + } + + public static function __callStatic($method, array $args) + { + return self::_mockery_handleStaticMethodCall($method, $args); + } + + /** + * Forward calls to this magic method to the __call method + */ + public function __toString() + { + return $this->__call('__toString', array()); + } + + /** + * Iterate across all expectation directors and validate each + * + * @throws \Mockery\CountValidator\Exception + * @return void + */ + public function mockery_verify() + { + if ($this->_mockery_verified) { + return; + } + if (isset($this->_mockery_ignoreVerification) + && $this->_mockery_ignoreVerification == true) { + return; + } + $this->_mockery_verified = true; + foreach ($this->_mockery_expectations as $director) { + $director->verify(); + } + } + + /** + * Gets a list of exceptions thrown by this mock + * + * @return array + */ + public function mockery_thrownExceptions() + { + return $this->_mockery_thrownExceptions; + } + + /** + * Tear down tasks for this mock + * + * @return void + */ + public function mockery_teardown() + { + } + + /** + * Fetch the next available allocation order number + * + * @return int + */ + public function mockery_allocateOrder() + { + $this->_mockery_allocatedOrder += 1; + return $this->_mockery_allocatedOrder; + } + + /** + * Set ordering for a group + * + * @param mixed $group + * @param int $order + */ + public function mockery_setGroup($group, $order) + { + $this->_mockery_groups[$group] = $order; + } + + /** + * Fetch array of ordered groups + * + * @return array + */ + public function mockery_getGroups() + { + return $this->_mockery_groups; + } + + /** + * Set current ordered number + * + * @param int $order + */ + public function mockery_setCurrentOrder($order) + { + $this->_mockery_currentOrder = $order; + return $this->_mockery_currentOrder; + } + + /** + * Get current ordered number + * + * @return int + */ + public function mockery_getCurrentOrder() + { + return $this->_mockery_currentOrder; + } + + /** + * Validate the current mock's ordering + * + * @param string $method + * @param int $order + * @throws \Mockery\Exception + * @return void + */ + public function mockery_validateOrder($method, $order) + { + if ($order < $this->_mockery_currentOrder) { + $exception = new \Mockery\Exception\InvalidOrderException( + 'Method ' . __CLASS__ . '::' . $method . '()' + . ' called out of order: expected order ' + . $order . ', was ' . $this->_mockery_currentOrder + ); + $exception->setMock($this) + ->setMethodName($method) + ->setExpectedOrder($order) + ->setActualOrder($this->_mockery_currentOrder); + throw $exception; + } + $this->mockery_setCurrentOrder($order); + } + + /** + * Gets the count of expectations for this mock + * + * @return int + */ + public function mockery_getExpectationCount() + { + $count = $this->_mockery_expectations_count; + foreach ($this->_mockery_expectations as $director) { + $count += $director->getExpectationCount(); + } + return $count; + } + + /** + * Return the expectations director for the given method + * + * @var string $method + * @return \Mockery\ExpectationDirector|null + */ + public function mockery_setExpectationsFor($method, \Mockery\ExpectationDirector $director) + { + $this->_mockery_expectations[$method] = $director; + } + + /** + * Return the expectations director for the given method + * + * @var string $method + * @return \Mockery\ExpectationDirector|null + */ + public function mockery_getExpectationsFor($method) + { + if (isset($this->_mockery_expectations[$method])) { + return $this->_mockery_expectations[$method]; + } + } + + /** + * Find an expectation matching the given method and arguments + * + * @var string $method + * @var array $args + * @return \Mockery\Expectation|null + */ + public function mockery_findExpectation($method, array $args) + { + if (!isset($this->_mockery_expectations[$method])) { + return null; + } + $director = $this->_mockery_expectations[$method]; + + return $director->findExpectation($args); + } + + /** + * Return the container for this mock + * + * @return \Mockery\Container + */ + public function mockery_getContainer() + { + return $this->_mockery_container; + } + + /** + * Return the name for this mock + * + * @return string + */ + public function mockery_getName() + { + return __CLASS__; + } + + /** + * @return array + */ + public function mockery_getMockableProperties() + { + return $this->_mockery_mockableProperties; + } + + public function __isset($name) + { + if (false === stripos($name, '_mockery_') && method_exists(get_parent_class($this), '__isset')) { + return parent::__isset($name); + } + + return false; + } + + public function mockery_getExpectations() + { + return $this->_mockery_expectations; + } + + /** + * Calls a parent class method and returns the result. Used in a passthru + * expectation where a real return value is required while still taking + * advantage of expectation matching and call count verification. + * + * @param string $name + * @param array $args + * @return mixed + */ + public function mockery_callSubjectMethod($name, array $args) + { + return call_user_func_array('parent::' . $name, $args); + } + + /** + * @return string[] + */ + public function mockery_getMockableMethods() + { + return $this->_mockery_mockableMethods; + } + + /** + * @return bool + */ + public function mockery_isAnonymous() + { + $rfc = new \ReflectionClass($this); + + // HHVM has a Stringish interface + $interfaces = array_filter($rfc->getInterfaces(), function ($i) { + return $i->getName() !== "Stringish"; + }); + $onlyImplementsMock = 1 == count($interfaces); + + return (false === $rfc->getParentClass()) && $onlyImplementsMock; + } + + public function __wakeup() + { + /** + * This does not add __wakeup method support. It's a blind method and any + * expected __wakeup work will NOT be performed. It merely cuts off + * annoying errors where a __wakeup exists but is not essential when + * mocking + */ + } + + public function __destruct() + { + /** + * Overrides real class destructor in case if class was created without original constructor + */ + } + + public function mockery_getMethod($name) + { + foreach ($this->mockery_getMethods() as $method) { + if ($method->getName() == $name) { + return $method; + } + } + + return null; + } + + /** + * @param string $name Method name. + * + * @return mixed Generated return value based on the declared return value of the named method. + */ + public function mockery_returnValueForMethod($name) + { + if (version_compare(PHP_VERSION, '7.0.0-dev') < 0) { + return; + } + + $rm = $this->mockery_getMethod($name); + if (!$rm || !$rm->hasReturnType()) { + return; + } + + $returnType = $rm->getReturnType(); + + // Default return value for methods with nullable type is null + if ($returnType->allowsNull()) { + return null; + } + + $type = (string) $returnType; + switch ($type) { + case '': return; + case 'string': return ''; + case 'int': return 0; + case 'float': return 0.0; + case 'bool': return false; + case 'array': return []; + + case 'callable': + case 'Closure': + return function () { + }; + + case 'Traversable': + case 'Generator': + // Remove eval() when minimum version >=5.5 + $generator = eval('return function () { yield; };'); + return $generator(); + + case 'self': + return \Mockery::mock($rm->getDeclaringClass()->getName()); + + case 'void': + return null; + + case 'object': + if (version_compare(PHP_VERSION, '7.2.0-dev') >= 0) { + return \Mockery::mock(); + } + + default: + return \Mockery::mock($type); + } + } + + public function shouldHaveReceived($method = null, $args = null) + { + if ($method === null) { + return new HigherOrderMessage($this, "shouldHaveReceived"); + } + + $expectation = new \Mockery\VerificationExpectation($this, $method); + if (null !== $args) { + $expectation->withArgs($args); + } + $expectation->atLeast()->once(); + $director = new \Mockery\VerificationDirector($this->_mockery_getReceivedMethodCalls(), $expectation); + $this->_mockery_expectations_count++; + $director->verify(); + return $director; + } + + public function shouldHaveBeenCalled() + { + return $this->shouldHaveReceived("__invoke"); + } + + public function shouldNotHaveReceived($method = null, $args = null) + { + if ($method === null) { + return new HigherOrderMessage($this, "shouldNotHaveReceived"); + } + + $expectation = new \Mockery\VerificationExpectation($this, $method); + if (null !== $args) { + $expectation->withArgs($args); + } + $expectation->never(); + $director = new \Mockery\VerificationDirector($this->_mockery_getReceivedMethodCalls(), $expectation); + $this->_mockery_expectations_count++; + $director->verify(); + return null; + } + + public function shouldNotHaveBeenCalled(array $args = null) + { + return $this->shouldNotHaveReceived("__invoke", $args); + } + + protected static function _mockery_handleStaticMethodCall($method, array $args) + { + $associatedRealObject = \Mockery::fetchMock(__CLASS__); + try { + return $associatedRealObject->__call($method, $args); + } catch (BadMethodCallException $e) { + throw new BadMethodCallException( + 'Static method ' . $associatedRealObject->mockery_getName() . '::' . $method + . '() does not exist on this mock object', + null, + $e + ); + } + } + + protected function _mockery_getReceivedMethodCalls() + { + return $this->_mockery_receivedMethodCalls ?: $this->_mockery_receivedMethodCalls = new \Mockery\ReceivedMethodCalls(); + } + + /** + * Called when an instance Mock was created and its constructor is getting called + * + * @see \Mockery\Generator\StringManipulation\Pass\InstanceMockPass + * @param array $args + */ + protected function _mockery_constructorCalled(array $args) + { + if (!isset($this->_mockery_expectations['__construct']) /* _mockery_handleMethodCall runs the other checks */) { + return; + } + $this->_mockery_handleMethodCall('__construct', $args); + } + + protected function _mockery_findExpectedMethodHandler($method) + { + if (isset($this->_mockery_expectations[$method])) { + return $this->_mockery_expectations[$method]; + } + + $lowerCasedMockeryExpectations = array_change_key_case($this->_mockery_expectations, CASE_LOWER); + $lowerCasedMethod = strtolower($method); + + if (isset($lowerCasedMockeryExpectations[$lowerCasedMethod])) { + return $lowerCasedMockeryExpectations[$lowerCasedMethod]; + } + + return null; + } + + protected function _mockery_handleMethodCall($method, array $args) + { + $this->_mockery_getReceivedMethodCalls()->push(new \Mockery\MethodCall($method, $args)); + + $rm = $this->mockery_getMethod($method); + if ($rm && $rm->isProtected() && !$this->_mockery_allowMockingProtectedMethods) { + if ($rm->isAbstract()) { + return; + } + + try { + $prototype = $rm->getPrototype(); + if ($prototype->isAbstract()) { + return; + } + } catch (\ReflectionException $re) { + // noop - there is no hasPrototype method + } + + return call_user_func_array("parent::$method", $args); + } + + $handler = $this->_mockery_findExpectedMethodHandler($method); + + if ($handler !== null && !$this->_mockery_disableExpectationMatching) { + try { + return $handler->call($args); + } catch (\Mockery\Exception\NoMatchingExpectationException $e) { + if (!$this->_mockery_ignoreMissing && !$this->_mockery_deferMissing) { + throw $e; + } + } + } + + if (!is_null($this->_mockery_partial) && method_exists($this->_mockery_partial, $method)) { + return call_user_func_array(array($this->_mockery_partial, $method), $args); + } elseif ($this->_mockery_deferMissing && is_callable("parent::$method") + && (!$this->hasMethodOverloadingInParentClass() || method_exists(get_parent_class($this), $method))) { + return call_user_func_array("parent::$method", $args); + } elseif ($method == '__toString') { + // __toString is special because we force its addition to the class API regardless of the + // original implementation. Thus, we should always return a string rather than honor + // _mockery_ignoreMissing and break the API with an error. + return sprintf("%s#%s", __CLASS__, spl_object_hash($this)); + } elseif ($this->_mockery_ignoreMissing) { + if (\Mockery::getConfiguration()->mockingNonExistentMethodsAllowed() || (method_exists($this->_mockery_partial, $method) || is_callable("parent::$method"))) { + if ($this->_mockery_defaultReturnValue instanceof \Mockery\Undefined) { + return call_user_func_array(array($this->_mockery_defaultReturnValue, $method), $args); + } elseif (null === $this->_mockery_defaultReturnValue) { + return $this->mockery_returnValueForMethod($method); + } + + return $this->_mockery_defaultReturnValue; + } + } + + $message = 'Method ' . __CLASS__ . '::' . $method . + '() does not exist on this mock object'; + + if (!is_null($rm)) { + $message = 'Received ' . __CLASS__ . + '::' . $method . '(), but no expectations were specified'; + } + + $bmce = new BadMethodCallException($message); + $this->_mockery_thrownExceptions[] = $bmce; + throw $bmce; + } + + /** + * Uses reflection to get the list of all + * methods within the current mock object + * + * @return array + */ + protected function mockery_getMethods() + { + if (static::$_mockery_methods && \Mockery::getConfiguration()->reflectionCacheEnabled()) { + return static::$_mockery_methods; + } + + if (isset($this->_mockery_partial)) { + $reflected = new \ReflectionObject($this->_mockery_partial); + } else { + $reflected = new \ReflectionClass($this); + } + + return static::$_mockery_methods = $reflected->getMethods(); + } + + private function hasMethodOverloadingInParentClass() + { + // if there's __call any name would be callable + return is_callable('parent::aFunctionNameThatNoOneWouldEverUseInRealLife12345'); + } + + /** + * @return array + */ + private function getNonPublicMethods() + { + return array_map( + function ($method) { + return $method->getName(); + }, + array_filter($this->mockery_getMethods(), function ($method) { + return !$method->isPublic(); + }) + ); + } +} diff --git a/vendor/mockery/mockery/library/Mockery/MockInterface.php b/vendor/mockery/mockery/library/Mockery/MockInterface.php new file mode 100644 index 0000000..e7a2685 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/MockInterface.php @@ -0,0 +1,252 @@ + return + * @return self|\Mockery\ExpectationInterface|\Mockery\Expectation|\Mockery\HigherOrderMessage + */ + public function allows($something = []); + + /** + * @param mixed $something String method name (optional) + * @return \Mockery\ExpectationInterface|\Mockery\Expectation|\Mockery\ExpectsHigherOrderMessage + */ + public function expects($something = null); + + /** + * Alternative setup method to constructor + * + * @param \Mockery\Container $container + * @param object $partialObject + * @return void + */ + public function mockery_init(\Mockery\Container $container = null, $partialObject = null); + + /** + * Set expected method calls + * + * @param array ...$methodNames one or many methods that are expected to be called in this mock + * + * @return \Mockery\ExpectationInterface|\Mockery\Expectation|\Mockery\HigherOrderMessage + */ + public function shouldReceive(...$methodNames); + + /** + * Shortcut method for setting an expectation that a method should not be called. + * + * @param array ...$methodNames one or many methods that are expected not to be called in this mock + * @return \Mockery\ExpectationInterface|\Mockery\Expectation|\Mockery\HigherOrderMessage + */ + public function shouldNotReceive(...$methodNames); + + /** + * Allows additional methods to be mocked that do not explicitly exist on mocked class + * @param String $method name of the method to be mocked + */ + public function shouldAllowMockingMethod($method); + + /** + * Set mock to ignore unexpected methods and return Undefined class + * @param mixed $returnValue the default return value for calls to missing functions on this mock + * @return Mock + */ + public function shouldIgnoreMissing($returnValue = null); + + /** + * @return Mock + */ + public function shouldAllowMockingProtectedMethods(); + + /** + * Set mock to defer unexpected methods to its parent if possible + * + * @deprecated 2.0.0 Please use makePartial() instead + * + * @return Mock + */ + public function shouldDeferMissing(); + + /** + * Set mock to defer unexpected methods to its parent if possible + * + * @return Mock + */ + public function makePartial(); + + /** + * @param null|string $method + * @param null $args + * @return mixed + */ + public function shouldHaveReceived($method, $args = null); + + /** + * @return mixed + */ + public function shouldHaveBeenCalled(); + + /** + * @param null|string $method + * @param null $args + * @return mixed + */ + public function shouldNotHaveReceived($method, $args = null); + + /** + * @param array $args (optional) + * @return mixed + */ + public function shouldNotHaveBeenCalled(array $args = null); + + /** + * In the event shouldReceive() accepting an array of methods/returns + * this method will switch them from normal expectations to default + * expectations + * + * @return self + */ + public function byDefault(); + + /** + * Iterate across all expectation directors and validate each + * + * @throws \Mockery\CountValidator\Exception + * @return void + */ + public function mockery_verify(); + + /** + * Tear down tasks for this mock + * + * @return void + */ + public function mockery_teardown(); + + /** + * Fetch the next available allocation order number + * + * @return int + */ + public function mockery_allocateOrder(); + + /** + * Set ordering for a group + * + * @param mixed $group + * @param int $order + */ + public function mockery_setGroup($group, $order); + + /** + * Fetch array of ordered groups + * + * @return array + */ + public function mockery_getGroups(); + + /** + * Set current ordered number + * + * @param int $order + */ + public function mockery_setCurrentOrder($order); + + /** + * Get current ordered number + * + * @return int + */ + public function mockery_getCurrentOrder(); + + /** + * Validate the current mock's ordering + * + * @param string $method + * @param int $order + * @throws \Mockery\Exception + * @return void + */ + public function mockery_validateOrder($method, $order); + + /** + * Gets the count of expectations for this mock + * + * @return int + */ + public function mockery_getExpectationCount(); + + /** + * Return the expectations director for the given method + * + * @var string $method + * @return \Mockery\ExpectationDirector|null + */ + public function mockery_setExpectationsFor($method, \Mockery\ExpectationDirector $director); + + /** + * Return the expectations director for the given method + * + * @var string $method + * @return \Mockery\ExpectationDirector|null + */ + public function mockery_getExpectationsFor($method); + + /** + * Find an expectation matching the given method and arguments + * + * @var string $method + * @var array $args + * @return \Mockery\Expectation|null + */ + public function mockery_findExpectation($method, array $args); + + /** + * Return the container for this mock + * + * @return \Mockery\Container + */ + public function mockery_getContainer(); + + /** + * Return the name for this mock + * + * @return string + */ + public function mockery_getName(); + + /** + * @return array + */ + public function mockery_getMockableProperties(); + + /** + * @return string[] + */ + public function mockery_getMockableMethods(); + + /** + * @return bool + */ + public function mockery_isAnonymous(); +} diff --git a/vendor/mockery/mockery/library/Mockery/ReceivedMethodCalls.php b/vendor/mockery/mockery/library/Mockery/ReceivedMethodCalls.php new file mode 100644 index 0000000..da771c0 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/ReceivedMethodCalls.php @@ -0,0 +1,48 @@ +methodCalls[] = $methodCall; + } + + public function verify(Expectation $expectation) + { + foreach ($this->methodCalls as $methodCall) { + if ($methodCall->getMethod() !== $expectation->getName()) { + continue; + } + + if (!$expectation->matchArgs($methodCall->getArgs())) { + continue; + } + + $expectation->verifyCall($methodCall->getArgs()); + } + + $expectation->verify(); + } +} diff --git a/vendor/mockery/mockery/library/Mockery/Undefined.php b/vendor/mockery/mockery/library/Mockery/Undefined.php new file mode 100644 index 0000000..53b05e9 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/Undefined.php @@ -0,0 +1,46 @@ +receivedMethodCalls = $receivedMethodCalls; + $this->expectation = $expectation; + } + + public function verify() + { + return $this->receivedMethodCalls->verify($this->expectation); + } + + public function with(...$args) + { + return $this->cloneApplyAndVerify("with", $args); + } + + public function withArgs($args) + { + return $this->cloneApplyAndVerify("withArgs", array($args)); + } + + public function withNoArgs() + { + return $this->cloneApplyAndVerify("withNoArgs", array()); + } + + public function withAnyArgs() + { + return $this->cloneApplyAndVerify("withAnyArgs", array()); + } + + public function times($limit = null) + { + return $this->cloneWithoutCountValidatorsApplyAndVerify("times", array($limit)); + } + + public function once() + { + return $this->cloneWithoutCountValidatorsApplyAndVerify("once", array()); + } + + public function twice() + { + return $this->cloneWithoutCountValidatorsApplyAndVerify("twice", array()); + } + + public function atLeast() + { + return $this->cloneWithoutCountValidatorsApplyAndVerify("atLeast", array()); + } + + public function atMost() + { + return $this->cloneWithoutCountValidatorsApplyAndVerify("atMost", array()); + } + + public function between($minimum, $maximum) + { + return $this->cloneWithoutCountValidatorsApplyAndVerify("between", array($minimum, $maximum)); + } + + protected function cloneWithoutCountValidatorsApplyAndVerify($method, $args) + { + $expectation = clone $this->expectation; + $expectation->clearCountValidators(); + call_user_func_array(array($expectation, $method), $args); + $director = new VerificationDirector($this->receivedMethodCalls, $expectation); + $director->verify(); + return $director; + } + + protected function cloneApplyAndVerify($method, $args) + { + $expectation = clone $this->expectation; + call_user_func_array(array($expectation, $method), $args); + $director = new VerificationDirector($this->receivedMethodCalls, $expectation); + $director->verify(); + return $director; + } +} diff --git a/vendor/mockery/mockery/library/Mockery/VerificationExpectation.php b/vendor/mockery/mockery/library/Mockery/VerificationExpectation.php new file mode 100644 index 0000000..3844a09 --- /dev/null +++ b/vendor/mockery/mockery/library/Mockery/VerificationExpectation.php @@ -0,0 +1,35 @@ +_countValidators = array(); + } + + public function __clone() + { + parent::__clone(); + $this->_actualCount = 0; + } +} diff --git a/vendor/mockery/mockery/library/helpers.php b/vendor/mockery/mockery/library/helpers.php new file mode 100644 index 0000000..72b7240 --- /dev/null +++ b/vendor/mockery/mockery/library/helpers.php @@ -0,0 +1,66 @@ + + + + + ./tests + ./tests/PHP70 + ./tests/PHP72 + + ./tests/PHP56 + ./tests/Mockery/MockingVariadicArgumentsTest.php + + + + ./tests + ./tests/PHP56 + + ./tests/PHP70 + ./tests/PHP72 + ./tests/Mockery/MockingVariadicArgumentsTest.php + + + + + + ./library/ + + ./library/Mockery/Adapter/Phpunit/Legacy + ./library/Mockery/Adapter/Phpunit/TestListener.php + + + + + diff --git a/vendor/mockery/mockery/tests/Bootstrap.php b/vendor/mockery/mockery/tests/Bootstrap.php new file mode 100644 index 0000000..5da2f67 --- /dev/null +++ b/vendor/mockery/mockery/tests/Bootstrap.php @@ -0,0 +1,66 @@ +checkMockeryExceptions(); + } + + public function markAsRisky() + { + } +}; + +class MockeryPHPUnitIntegrationTest extends MockeryTestCase +{ + /** + * @test + * @requires PHPUnit 5.7.6 + */ + public function it_marks_a_passing_test_as_risky_if_we_threw_exceptions() + { + $mock = mock(); + try { + $mock->foobar(); + } catch (\Exception $e) { + // exception swallowed... + } + + $test = spy(BaseClassStub::class)->makePartial(); + $test->finish(); + + $test->shouldHaveReceived()->markAsRisky(); + } + + /** + * @test + * @requires PHPUnit 5.7.6 + */ + public function the_user_can_manually_dismiss_an_exception_to_avoid_the_risky_test() + { + $mock = mock(); + try { + $mock->foobar(); + } catch (BadMethodCallException $e) { + $e->dismiss(); + } + + $test = spy(BaseClassStub::class)->makePartial(); + $test->finish(); + + $test->shouldNotHaveReceived()->markAsRisky(); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/Adapter/Phpunit/TestListenerTest.php b/vendor/mockery/mockery/tests/Mockery/Adapter/Phpunit/TestListenerTest.php new file mode 100644 index 0000000..9a73c81 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/Adapter/Phpunit/TestListenerTest.php @@ -0,0 +1,103 @@ +markTestSkipped('The TestListener is only supported with PHPUnit 6+.'); + return; + } + // We intentionally test the static container here. That is what the + // listener will check. + $this->container = \Mockery::getContainer(); + $this->listener = new TestListener(); + $this->testResult = new TestResult(); + $this->test = new EmptyTestCase(); + + $this->test->setTestResultObject($this->testResult); + $this->testResult->addListener($this->listener); + + $this->assertTrue($this->testResult->wasSuccessful(), 'sanity check: empty test results should be considered successful'); + } + + public function testSuccessOnClose() + { + $mock = $this->container->mock(); + $mock->shouldReceive('bar')->once(); + $mock->bar(); + + // This is what MockeryPHPUnitIntegration and MockeryTestCase trait + // will do. We intentionally call the static close method. + $this->test->addToAssertionCount($this->container->mockery_getExpectationCount()); + \Mockery::close(); + + $this->listener->endTest($this->test, 0); + $this->assertTrue($this->testResult->wasSuccessful(), 'expected test result to indicate success'); + } + + public function testFailureOnMissingClose() + { + $mock = $this->container->mock(); + $mock->shouldReceive('bar')->once(); + + $this->listener->endTest($this->test, 0); + $this->assertFalse($this->testResult->wasSuccessful(), 'expected test result to indicate failure'); + + // Satisfy the expectation and close the global container now so we + // don't taint the environment. + $mock->bar(); + \Mockery::close(); + } + + public function testMockeryIsAddedToBlacklist() + { + $suite = \Mockery::mock(\PHPUnit\Framework\TestSuite::class); + + $this->assertArrayNotHasKey(\Mockery::class, \PHPUnit\Util\Blacklist::$blacklistedClassNames); + $this->listener->startTestSuite($suite); + $this->assertSame(1, \PHPUnit\Util\Blacklist::$blacklistedClassNames[\Mockery::class]); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/AdhocTest.php b/vendor/mockery/mockery/tests/Mockery/AdhocTest.php new file mode 100644 index 0000000..b930c0a --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/AdhocTest.php @@ -0,0 +1,119 @@ +container = new \Mockery\Container(\Mockery::getDefaultGenerator(), \Mockery::getDefaultLoader()); + } + + public function teardown() + { + $this->container->mockery_close(); + } + + public function testSimplestMockCreation() + { + $m = $this->container->mock('MockeryTest_NameOfExistingClass'); + $this->assertInstanceOf(MockeryTest_NameOfExistingClass::class, $m); + } + + public function testMockeryInterfaceForClass() + { + $m = $this->container->mock('SplFileInfo'); + $this->assertInstanceOf(\Mockery\MockInterface::class, $m); + } + + public function testMockeryInterfaceForNonExistingClass() + { + $m = $this->container->mock('ABC_IDontExist'); + $this->assertInstanceOf(\Mockery\MockInterface::class, $m); + } + + public function testMockeryInterfaceForInterface() + { + $m = $this->container->mock('MockeryTest_NameOfInterface'); + $this->assertInstanceOf(\Mockery\MockInterface::class, $m); + } + + public function testMockeryInterfaceForAbstract() + { + $m = $this->container->mock('MockeryTest_NameOfAbstract'); + $this->assertInstanceOf(\Mockery\MockInterface::class, $m); + } + + public function testInvalidCountExceptionThrowsRuntimeExceptionOnIllegalComparativeSymbol() + { + $this->expectException('Mockery\Exception\RuntimeException'); + $e = new \Mockery\Exception\InvalidCountException; + $e->setExpectedCountComparative('X'); + } + + public function testMockeryConstructAndDestructIsNotCalled() + { + MockeryTest_NameOfExistingClassWithDestructor::$isDestructorWasCalled = false; + // We pass no arguments in constructor, so it's not being called. Then destructor shouldn't be called too. + $this->container->mock('MockeryTest_NameOfExistingClassWithDestructor'); + // Clear references to trigger destructor + $this->container->mockery_close(); + $this->assertFalse(MockeryTest_NameOfExistingClassWithDestructor::$isDestructorWasCalled); + } + + public function testMockeryConstructAndDestructIsCalled() + { + MockeryTest_NameOfExistingClassWithDestructor::$isDestructorWasCalled = false; + + $this->container->mock('MockeryTest_NameOfExistingClassWithDestructor', array()); + // Clear references to trigger destructor + $this->container->mockery_close(); + $this->assertTrue(MockeryTest_NameOfExistingClassWithDestructor::$isDestructorWasCalled); + } +} + +class MockeryTest_NameOfExistingClass +{ +} + +interface MockeryTest_NameOfInterface +{ + public function foo(); +} + +abstract class MockeryTest_NameOfAbstract +{ + abstract public function foo(); +} + +class MockeryTest_NameOfExistingClassWithDestructor +{ + public static $isDestructorWasCalled = false; + + public function __destruct() + { + self::$isDestructorWasCalled = true; + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/AllowsExpectsSyntaxTest.php b/vendor/mockery/mockery/tests/Mockery/AllowsExpectsSyntaxTest.php new file mode 100644 index 0000000..d7492f3 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/AllowsExpectsSyntaxTest.php @@ -0,0 +1,111 @@ +allows()->foo(123)->andReturns(456); + + $this->assertEquals(456, $stub->foo(123)); + } + + /** @test */ + public function allowsCanTakeAnArrayOfCalls() + { + $stub = m::mock(); + $stub->allows([ + "foo" => "bar", + "bar" => "baz", + ]); + + $this->assertEquals("bar", $stub->foo()); + $this->assertEquals("baz", $stub->bar()); + } + + /** @test */ + public function allowsCanTakeAString() + { + $stub = m::mock(); + $stub->allows("foo")->andReturns("bar"); + $this->assertEquals("bar", $stub->foo()); + } + + /** @test */ + public function expects_can_optionally_match_on_any_arguments() + { + $mock = m::mock(); + $mock->allows()->foo()->withAnyArgs()->andReturns(123); + + $this->assertEquals(123, $mock->foo(456, 789)); + } + + /** @test */ + public function expects_can_take_a_string() + { + $mock = m::mock(); + $mock->expects("foo")->andReturns(123); + + $this->assertEquals(123, $mock->foo(456, 789)); + } + + /** @test */ + public function expectsSetsUpExpectationOfOneCall() + { + $mock = m::mock(); + $mock->expects()->foo(123); + + $this->expectException("Mockery\Exception\InvalidCountException"); + m::close(); + } + + /** @test */ + public function callVerificationCountCanBeOverridenAfterExpectsThrowsExceptionWhenIncorrectNumberOfCalls() + { + $mock = m::mock(); + $mock->expects()->foo(123)->twice(); + + $mock->foo(123); + $this->expectException("Mockery\Exception\InvalidCountException"); + m::close(); + } + + /** @test */ + public function callVerificationCountCanBeOverridenAfterExpects() + { + $mock = m::mock(); + $mock->expects()->foo(123)->twice(); + + $mock->foo(123); + $mock->foo(123); + + m::close(); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/CallableSpyTest.php b/vendor/mockery/mockery/tests/Mockery/CallableSpyTest.php new file mode 100644 index 0000000..013e5b1 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/CallableSpyTest.php @@ -0,0 +1,199 @@ +shouldHaveBeenCalled(); + } + + /** @test */ + public function it_throws_if_the_callable_was_not_called_at_all() + { + $spy = spy(function() {}); + + $this->expectException(InvalidCountException::class); + $spy->shouldHaveBeenCalled(); + } + + /** @test */ + public function it_throws_if_there_were_no_arguments_but_we_expected_some() + { + $spy = spy(function() {}); + + $spy(); + + $this->expectException(InvalidCountException::class); + $spy->shouldHaveBeenCalled()->with(123, 546); + } + + /** @test */ + public function it_throws_if_the_arguments_do_not_match() + { + $spy = spy(function() {}); + + $spy(123); + + $this->expectException(InvalidCountException::class); + $spy->shouldHaveBeenCalled()->with(123, 546); + } + + /** @test */ + public function it_verifies_the_closure_was_not_called() + { + $spy = spy(function () {}); + + $spy->shouldNotHaveBeenCalled(); + } + + /** @test */ + public function it_throws_if_it_was_called_when_we_expected_it_to_not_have_been_called() + { + $spy = spy(function () {}); + + $spy(); + + $this->expectException(InvalidCountException::class); + $spy->shouldNotHaveBeenCalled(); + } + + /** @test */ + public function it_verifies_it_was_not_called_with_some_particular_arguments_when_called_with_no_args() + { + $spy = spy(function () {}); + + $spy(); + + $spy->shouldNotHaveBeenCalled([123]); + } + + /** @test */ + public function it_verifies_it_was_not_called_with_some_particular_arguments_when_called_with_different_args() + { + $spy = spy(function () {}); + + $spy(456); + + $spy->shouldNotHaveBeenCalled([123]); + } + + /** @test */ + public function it_throws_if_it_was_called_with_the_args_we_were_not_expecting() + { + $spy = spy(function () {}); + + $spy(123); + + $this->expectException(InvalidCountException::class); + $spy->shouldNotHaveBeenCalled([123]); + } + + /** @test */ + public function it_can_verify_it_was_called_a_number_of_times() + { + $spy = spy(function () {}); + + $spy(); + $spy(); + + $spy->shouldHaveBeenCalled()->twice(); + } + + /** @test */ + public function it_can_verify_it_was_called_a_number_of_times_with_particular_arguments() + { + $spy = spy(function () {}); + + $spy(123); + $spy(123); + + $spy->shouldHaveBeenCalled()->with(123)->twice(); + } + + /** @test */ + public function it_throws_if_it_was_called_less_than_the_number_of_times_we_expected() + { + $spy = spy(function () {}); + + $spy(); + + $this->expectException(InvalidCountException::class); + $spy->shouldHaveBeenCalled()->twice(); + } + + /** @test */ + public function it_throws_if_it_was_called_less_than_the_number_of_times_we_expected_with_particular_arguments() + { + $spy = spy(function () {}); + + $spy(); + $spy(123); + + $this->expectException(InvalidCountException::class); + $spy->shouldHaveBeenCalled()->with(123)->twice(); + } + + /** @test */ + public function it_throws_if_it_was_called_more_than_the_number_of_times_we_expected() + { + $spy = spy(function () {}); + + $spy(); + $spy(); + $spy(); + + $this->expectException(InvalidCountException::class); + $spy->shouldHaveBeenCalled()->twice(); + } + + /** @test */ + public function it_throws_if_it_was_called_more_than_the_number_of_times_we_expected_with_particular_arguments() + { + $spy = spy(function () {}); + + $spy(123); + $spy(123); + $spy(123); + + $this->expectException(InvalidCountException::class); + $spy->shouldHaveBeenCalled()->with(123)->twice(); + } + + /** @test */ + public function it_acts_as_partial() + { + $spy = spy(function ($number) { return $number + 1;}); + + $this->assertEquals(124, $spy(123)); + $spy->shouldHaveBeenCalled(); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/ContainerTest.php b/vendor/mockery/mockery/tests/Mockery/ContainerTest.php new file mode 100644 index 0000000..446d9e3 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/ContainerTest.php @@ -0,0 +1,1825 @@ +shouldReceive('foo')->andReturn('bar'); + $this->assertEquals('bar', $m->foo()); + } + + public function testGetKeyOfDemeterMockShouldReturnKeyWhenMatchingMock() + { + $m = mock(); + $m->shouldReceive('foo->bar'); + $this->assertRegExp( + '/Mockery_(\d+)__demeter_([0-9a-f]+)_foo/', + Mockery::getContainer()->getKeyOfDemeterMockFor('foo', get_class($m)) + ); + } + public function testGetKeyOfDemeterMockShouldReturnNullWhenNoMatchingMock() + { + $method = 'unknownMethod'; + $this->assertNull(Mockery::getContainer()->getKeyOfDemeterMockFor($method, 'any')); + + $m = mock(); + $m->shouldReceive('method'); + $this->assertNull(Mockery::getContainer()->getKeyOfDemeterMockFor($method, get_class($m))); + + $m->shouldReceive('foo->bar'); + $this->assertNull(Mockery::getContainer()->getKeyOfDemeterMockFor($method, get_class($m))); + } + + + public function testNamedMocksAddNameToExceptions() + { + $m = mock('Foo'); + $m->shouldReceive('foo')->with(1)->andReturn('bar'); + try { + $m->foo(); + } catch (\Mockery\Exception $e) { + $this->assertTrue((bool) preg_match("/Foo/", $e->getMessage())); + } + } + + public function testSimpleMockWithArrayDefs() + { + $m = mock(array('foo'=>1, 'bar'=>2)); + $this->assertEquals(1, $m->foo()); + $this->assertEquals(2, $m->bar()); + } + + public function testSimpleMockWithArrayDefsCanBeOverridden() + { + // eg. In shared test setup + $m = mock(array('foo' => 1, 'bar' => 2)); + + // and then overridden in one test + $m->shouldReceive('foo')->with('baz')->once()->andReturn(2); + $m->shouldReceive('bar')->with('baz')->once()->andReturn(42); + + $this->assertEquals(2, $m->foo('baz')); + $this->assertEquals(42, $m->bar('baz')); + } + + public function testNamedMockWithArrayDefs() + { + $m = mock('Foo', array('foo'=>1, 'bar'=>2)); + $this->assertEquals(1, $m->foo()); + $this->assertEquals(2, $m->bar()); + try { + $m->f(); + } catch (BadMethodCallException $e) { + $this->assertTrue((bool) preg_match("/Foo/", $e->getMessage())); + } + } + + public function testNamedMockWithArrayDefsCanBeOverridden() + { + // eg. In shared test setup + $m = mock('Foo', array('foo' => 1)); + + // and then overridden in one test + $m->shouldReceive('foo')->with('bar')->once()->andReturn(2); + + $this->assertEquals(2, $m->foo('bar')); + + try { + $m->f(); + } catch (BadMethodCallException $e) { + $this->assertTrue((bool) preg_match("/Foo/", $e->getMessage())); + } + } + + public function testNamedMockMultipleInterfaces() + { + $m = mock('stdClass, ArrayAccess, Countable', array('foo'=>1, 'bar'=>2)); + $this->assertEquals(1, $m->foo()); + $this->assertEquals(2, $m->bar()); + try { + $m->f(); + } catch (BadMethodCallException $e) { + $this->assertTrue((bool) preg_match("/stdClass/", $e->getMessage())); + $this->assertTrue((bool) preg_match("/ArrayAccess/", $e->getMessage())); + $this->assertTrue((bool) preg_match("/Countable/", $e->getMessage())); + } + } + + public function testNamedMockWithConstructorArgs() + { + $m = mock("MockeryTest_ClassConstructor2[foo]", array($param1 = new stdClass())); + $m->shouldReceive("foo")->andReturn(123); + $this->assertEquals(123, $m->foo()); + $this->assertEquals($param1, $m->getParam1()); + } + + public function testNamedMockWithConstructorArgsAndArrayDefs() + { + $m = mock( + "MockeryTest_ClassConstructor2[foo]", + array($param1 = new stdClass()), + array("foo" => 123) + ); + $this->assertEquals(123, $m->foo()); + $this->assertEquals($param1, $m->getParam1()); + } + + public function testNamedMockWithConstructorArgsWithInternalCallToMockedMethod() + { + $m = mock("MockeryTest_ClassConstructor2[foo]", array($param1 = new stdClass())); + $m->shouldReceive("foo")->andReturn(123); + $this->assertEquals(123, $m->bar()); + } + + public function testNamedMockWithConstructorArgsButNoQuickDefsShouldLeaveConstructorIntact() + { + $m = mock("MockeryTest_ClassConstructor2", array($param1 = new stdClass())); + $m->makePartial(); + $this->assertEquals($param1, $m->getParam1()); + } + + public function testNamedMockWithMakePartial() + { + $m = mock("MockeryTest_ClassConstructor2", array($param1 = new stdClass())); + $m->makePartial(); + $this->assertEquals('foo', $m->bar()); + $m->shouldReceive("bar")->andReturn(123); + $this->assertEquals(123, $m->bar()); + } + + /** + * @expectedException BadMethodCallException + */ + public function testNamedMockWithMakePartialThrowsIfNotAvailable() + { + $m = mock("MockeryTest_ClassConstructor2", array($param1 = new stdClass())); + $m->makePartial(); + $m->foorbar123(); + $m->mockery_verify(); + } + + public function testMockingAKnownConcreteClassSoMockInheritsClassType() + { + $m = mock('stdClass'); + $m->shouldReceive('foo')->andReturn('bar'); + $this->assertEquals('bar', $m->foo()); + $this->assertInstanceOf(stdClass::class, $m); + } + + public function testMockingAKnownUserClassSoMockInheritsClassType() + { + $m = mock('MockeryTest_TestInheritedType'); + $this->assertInstanceOf(MockeryTest_TestInheritedType::class, $m); + } + + public function testMockingAConcreteObjectCreatesAPartialWithoutError() + { + $m = mock(new stdClass); + $m->shouldReceive('foo')->andReturn('bar'); + $this->assertEquals('bar', $m->foo()); + $this->assertInstanceOf(stdClass::class, $m); + } + + public function testCreatingAPartialAllowsDynamicExpectationsAndPassesThroughUnexpectedMethods() + { + $m = mock(new MockeryTestFoo); + $m->shouldReceive('bar')->andReturn('bar'); + $this->assertEquals('bar', $m->bar()); + $this->assertEquals('foo', $m->foo()); + $this->assertInstanceOf(MockeryTestFoo::class, $m); + } + + public function testCreatingAPartialAllowsExpectationsToInterceptCallsToImplementedMethods() + { + $m = mock(new MockeryTestFoo2); + $m->shouldReceive('bar')->andReturn('baz'); + $this->assertEquals('baz', $m->bar()); + $this->assertEquals('foo', $m->foo()); + $this->assertInstanceOf(MockeryTestFoo2::class, $m); + } + + public function testBlockForwardingToPartialObject() + { + $m = mock(new MockeryTestBar1, array('foo'=>1, Mockery\Container::BLOCKS => array('method1'))); + $this->assertSame($m, $m->method1()); + } + + public function testPartialWithArrayDefs() + { + $m = mock(new MockeryTestBar1, array('foo'=>1, Mockery\Container::BLOCKS => array('method1'))); + $this->assertEquals(1, $m->foo()); + } + + public function testPassingClosureAsFinalParameterUsedToDefineExpectations() + { + $m = mock('foo', function ($m) { + $m->shouldReceive('foo')->once()->andReturn('bar'); + }); + $this->assertEquals('bar', $m->foo()); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testMockingAKnownConcreteFinalClassThrowsErrors_OnlyPartialMocksCanMockFinalElements() + { + $m = mock('MockeryFoo3'); + } + + public function testMockingAKnownConcreteClassWithFinalMethodsThrowsNoException() + { + $this->assertInstanceOf(MockInterface::class, mock('MockeryFoo4')); + } + + /** + * @group finalclass + */ + public function testFinalClassesCanBePartialMocks() + { + $m = mock(new MockeryFoo3); + $m->shouldReceive('foo')->andReturn('baz'); + $this->assertEquals('baz', $m->foo()); + $this->assertNotInstanceOf(MockeryFoo3::class, $m); + } + + public function testSplClassWithFinalMethodsCanBeMocked() + { + $m = mock('SplFileInfo'); + $m->shouldReceive('foo')->andReturn('baz'); + $this->assertEquals('baz', $m->foo()); + $this->assertInstanceOf(SplFileInfo::class, $m); + } + + public function testSplClassWithFinalMethodsCanBeMockedMultipleTimes() + { + mock('SplFileInfo'); + $m = mock('SplFileInfo'); + $m->shouldReceive('foo')->andReturn('baz'); + $this->assertEquals('baz', $m->foo()); + $this->assertInstanceOf(SplFileInfo::class, $m); + } + + public function testClassesWithFinalMethodsCanBeProxyPartialMocks() + { + $m = mock(new MockeryFoo4); + $m->shouldReceive('foo')->andReturn('baz'); + $this->assertEquals('baz', $m->foo()); + $this->assertEquals('bar', $m->bar()); + $this->assertInstanceOf(MockeryFoo4::class, $m); + } + + public function testClassesWithFinalMethodsCanBeProperPartialMocks() + { + $m = mock('MockeryFoo4[bar]'); + $m->shouldReceive('bar')->andReturn('baz'); + $this->assertEquals('baz', $m->foo()); + $this->assertEquals('baz', $m->bar()); + $this->assertInstanceOf(MockeryFoo4::class, $m); + } + + public function testClassesWithFinalMethodsCanBeProperPartialMocksButFinalMethodsNotPartialed() + { + $m = mock('MockeryFoo4[foo]'); + $m->shouldReceive('foo')->andReturn('foo'); + $this->assertEquals('baz', $m->foo()); // partial expectation ignored - will fail callcount assertion + $this->assertInstanceOf(MockeryFoo4::class, $m); + } + + public function testSplfileinfoClassMockPassesUserExpectations() + { + $file = mock('SplFileInfo[getFilename,getPathname,getExtension,getMTime]', array(__FILE__)); + $file->shouldReceive('getFilename')->once()->andReturn('foo'); + $file->shouldReceive('getPathname')->once()->andReturn('path/to/foo'); + $file->shouldReceive('getExtension')->once()->andReturn('css'); + $file->shouldReceive('getMTime')->once()->andReturn(time()); + + // not sure what this test is for, maybe something special about + // SplFileInfo + $this->assertEquals('foo', $file->getFilename()); + $this->assertEquals('path/to/foo', $file->getPathname()); + $this->assertEquals('css', $file->getExtension()); + $this->assertInternalType('int', $file->getMTime()); + } + + public function testCanMockInterface() + { + $m = mock('MockeryTest_Interface'); + $this->assertInstanceOf(MockeryTest_Interface::class, $m); + } + + public function testCanMockSpl() + { + $m = mock('\\SplFixedArray'); + $this->assertInstanceOf(SplFixedArray::class, $m); + } + + public function testCanMockInterfaceWithAbstractMethod() + { + $m = mock('MockeryTest_InterfaceWithAbstractMethod'); + $this->assertInstanceOf(MockeryTest_InterfaceWithAbstractMethod::class, $m); + $m->shouldReceive('foo')->andReturn(1); + $this->assertEquals(1, $m->foo()); + } + + public function testCanMockAbstractWithAbstractProtectedMethod() + { + $m = mock('MockeryTest_AbstractWithAbstractMethod'); + $this->assertInstanceOf(MockeryTest_AbstractWithAbstractMethod::class, $m); + } + + public function testCanMockInterfaceWithPublicStaticMethod() + { + $m = mock('MockeryTest_InterfaceWithPublicStaticMethod'); + $this->assertInstanceOf(MockeryTest_InterfaceWithPublicStaticMethod::class, $m); + } + + public function testCanMockClassWithConstructor() + { + $m = mock('MockeryTest_ClassConstructor'); + $this->assertInstanceOf(MockeryTest_ClassConstructor::class, $m); + } + + public function testCanMockClassWithConstructorNeedingClassArgs() + { + $m = mock('MockeryTest_ClassConstructor2'); + $this->assertInstanceOf(MockeryTest_ClassConstructor2::class, $m); + } + + /** + * @group partial + */ + public function testCanPartiallyMockANormalClass() + { + $m = mock('MockeryTest_PartialNormalClass[foo]'); + $this->assertInstanceOf(MockeryTest_PartialNormalClass::class, $m); + $m->shouldReceive('foo')->andReturn('cba'); + $this->assertEquals('abc', $m->bar()); + $this->assertEquals('cba', $m->foo()); + } + + /** + * @group partial + */ + public function testCanPartiallyMockAnAbstractClass() + { + $m = mock('MockeryTest_PartialAbstractClass[foo]'); + $this->assertInstanceOf(MockeryTest_PartialAbstractClass::class, $m); + $m->shouldReceive('foo')->andReturn('cba'); + $this->assertEquals('abc', $m->bar()); + $this->assertEquals('cba', $m->foo()); + } + + /** + * @group partial + */ + public function testCanPartiallyMockANormalClassWith2Methods() + { + $m = mock('MockeryTest_PartialNormalClass2[foo, baz]'); + $this->assertInstanceOf(MockeryTest_PartialNormalClass2::class, $m); + $m->shouldReceive('foo')->andReturn('cba'); + $m->shouldReceive('baz')->andReturn('cba'); + $this->assertEquals('abc', $m->bar()); + $this->assertEquals('cba', $m->foo()); + $this->assertEquals('cba', $m->baz()); + } + + /** + * @group partial + */ + public function testCanPartiallyMockAnAbstractClassWith2Methods() + { + $m = mock('MockeryTest_PartialAbstractClass2[foo,baz]'); + $this->assertInstanceOf(MockeryTest_PartialAbstractClass2::class, $m); + $m->shouldReceive('foo')->andReturn('cba'); + $m->shouldReceive('baz')->andReturn('cba'); + $this->assertEquals('abc', $m->bar()); + $this->assertEquals('cba', $m->foo()); + $this->assertEquals('cba', $m->baz()); + } + + /** + * @expectedException \Mockery\Exception + * @group partial + */ + public function testThrowsExceptionIfSettingExpectationForNonMockedMethodOfPartialMock() + { + $this->markTestSkipped('For now...'); + $m = mock('MockeryTest_PartialNormalClass[foo]'); + $this->assertInstanceOf(MockeryTest_PartialNormalClass::class, $m); + $m->shouldReceive('bar')->andReturn('cba'); + } + + /** + * @expectedException \Mockery\Exception + * @group partial + */ + public function testThrowsExceptionIfClassOrInterfaceForPartialMockDoesNotExist() + { + $m = mock('MockeryTest_PartialNormalClassXYZ[foo]'); + } + + /** + * @group issue/4 + */ + public function testCanMockClassContainingMagicCallMethod() + { + $m = mock('MockeryTest_Call1'); + $this->assertInstanceOf(MockeryTest_Call1::class, $m); + } + + /** + * @group issue/4 + */ + public function testCanMockClassContainingMagicCallMethodWithoutTypeHinting() + { + $m = mock('MockeryTest_Call2'); + $this->assertInstanceOf(MockeryTest_Call2::class, $m); + } + + /** + * @group issue/14 + */ + public function testCanMockClassContainingAPublicWakeupMethod() + { + $m = mock('MockeryTest_Wakeup1'); + $this->assertInstanceOf(MockeryTest_Wakeup1::class, $m); + } + + /** + * @group issue/18 + */ + public function testCanMockClassUsingMagicCallMethodsInPlaceOfNormalMethods() + { + $m = Mockery::mock('Gateway'); + $m->shouldReceive('iDoSomethingReallyCoolHere'); + $m->iDoSomethingReallyCoolHere(); + } + + /** + * @group issue/18 + */ + public function testCanPartialMockObjectUsingMagicCallMethodsInPlaceOfNormalMethods() + { + $m = Mockery::mock(new Gateway); + $m->shouldReceive('iDoSomethingReallyCoolHere'); + $m->iDoSomethingReallyCoolHere(); + } + + /** + * @group issue/13 + */ + public function testCanMockClassWhereMethodHasReferencedParameter() + { + $this->assertInstanceOf(MockInterface::class, Mockery::mock(new MockeryTest_MethodParamRef)); + } + + /** + * @group issue/13 + */ + public function testCanPartiallyMockObjectWhereMethodHasReferencedParameter() + { + $this->assertInstanceOf(MockInterface::class, Mockery::mock(new MockeryTest_MethodParamRef2)); + } + + /** + * @group issue/11 + */ + public function testMockingAKnownConcreteClassCanBeGrantedAnArbitraryClassType() + { + $m = mock('alias:MyNamespace\MyClass'); + $m->shouldReceive('foo')->andReturn('bar'); + $this->assertEquals('bar', $m->foo()); + $this->assertInstanceOf(MyNamespace\MyClass::class, $m); + } + + /** + * @group issue/15 + */ + public function testCanMockMultipleInterfaces() + { + $m = mock('MockeryTest_Interface1, MockeryTest_Interface2'); + $this->assertInstanceOf(MockeryTest_Interface1::class, $m); + $this->assertInstanceOf(MockeryTest_Interface2::class, $m); + } + + /** + */ + public function testCanMockMultipleInterfacesThatMayNotExist() + { + $m = mock('NonExistingClass, MockeryTest_Interface1, MockeryTest_Interface2, \Some\Thing\That\Doesnt\Exist'); + $this->assertInstanceOf(MockeryTest_Interface1::class, $m); + $this->assertInstanceOf(MockeryTest_Interface2::class, $m); + $this->assertInstanceOf(\Some\Thing\That\Doesnt\Exist::class, $m); + } + + /** + * @group issue/15 + */ + public function testCanMockClassAndApplyMultipleInterfaces() + { + $m = mock('MockeryTestFoo, MockeryTest_Interface1, MockeryTest_Interface2'); + $this->assertInstanceOf(MockeryTestFoo::class, $m); + $this->assertInstanceOf(MockeryTest_Interface1::class, $m); + $this->assertInstanceOf(MockeryTest_Interface2::class, $m); + } + + /** + * @group issue/7 + * + * Noted: We could complicate internally, but a blind class is better built + * with a real class noted up front (stdClass is a perfect choice it is + * behaviourless). Fine, it's a muddle - but we need to draw a line somewhere. + */ + public function testCanMockStaticMethods() + { + $m = mock('alias:MyNamespace\MyClass2'); + $m->shouldReceive('staticFoo')->andReturn('bar'); + $this->assertEquals('bar', \MyNameSpace\MyClass2::staticFoo()); + } + + /** + * @group issue/7 + * @expectedException \Mockery\CountValidator\Exception + */ + public function testMockedStaticMethodsObeyMethodCounting() + { + $m = mock('alias:MyNamespace\MyClass3'); + $m->shouldReceive('staticFoo')->once()->andReturn('bar'); + Mockery::close(); + } + + /** + */ + public function testMockedStaticThrowsExceptionWhenMethodDoesNotExist() + { + $m = mock('alias:MyNamespace\StaticNoMethod'); + try { + MyNameSpace\StaticNoMethod::staticFoo(); + } catch (BadMethodCallException $e) { + // Mockery + PHPUnit has a fail safe for tests swallowing our + // exceptions + $e->dismiss(); + return; + } + + $this->fail('Exception was not thrown'); + } + + /** + * @group issue/17 + */ + public function testMockingAllowsPublicPropertyStubbingOnRealClass() + { + $m = mock('MockeryTestFoo'); + $m->foo = 'bar'; + $this->assertEquals('bar', $m->foo); + //$this->assertArrayHasKey('foo', $m->mockery_getMockableProperties()); + } + + /** + * @group issue/17 + */ + public function testMockingAllowsPublicPropertyStubbingOnNamedMock() + { + $m = mock('Foo'); + $m->foo = 'bar'; + $this->assertEquals('bar', $m->foo); + //$this->assertArrayHasKey('foo', $m->mockery_getMockableProperties()); + } + + /** + * @group issue/17 + */ + public function testMockingAllowsPublicPropertyStubbingOnPartials() + { + $m = mock(new stdClass); + $m->foo = 'bar'; + $this->assertEquals('bar', $m->foo); + //$this->assertArrayHasKey('foo', $m->mockery_getMockableProperties()); + } + + /** + * @group issue/17 + */ + public function testMockingDoesNotStubNonStubbedPropertiesOnPartials() + { + $m = mock(new MockeryTest_ExistingProperty); + $this->assertEquals('bar', $m->foo); + $this->assertArrayNotHasKey('foo', $m->mockery_getMockableProperties()); + } + + public function testCreationOfInstanceMock() + { + $m = mock('overload:MyNamespace\MyClass4'); + $this->assertInstanceOf(MyNamespace\MyClass4::class, $m); + } + + public function testInstantiationOfInstanceMock() + { + $m = mock('overload:MyNamespace\MyClass5'); + $instance = new MyNamespace\MyClass5; + $this->assertInstanceOf(MyNamespace\MyClass5::class, $instance); + } + + public function testInstantiationOfInstanceMockImportsExpectations() + { + $m = mock('overload:MyNamespace\MyClass6'); + $m->shouldReceive('foo')->andReturn('bar'); + $instance = new MyNamespace\MyClass6; + $this->assertEquals('bar', $instance->foo()); + } + + public function testInstantiationOfInstanceMockImportsDefaultExpectations() + { + $m = mock('overload:MyNamespace\MyClass6'); + $m->shouldReceive('foo')->andReturn('bar')->byDefault(); + $instance = new MyNamespace\MyClass6; + + $this->assertEquals('bar', $instance->foo()); + } + + public function testInstantiationOfInstanceMockImportsDefaultExpectationsInTheCorrectOrder() + { + $m = mock('overload:MyNamespace\MyClass6'); + $m->shouldReceive('foo')->andReturn(1)->byDefault(); + $m->shouldReceive('foo')->andReturn(2)->byDefault(); + $m->shouldReceive('foo')->andReturn(3)->byDefault(); + $instance = new MyNamespace\MyClass6; + + $this->assertEquals(3, $instance->foo()); + } + + public function testInstantiationOfInstanceMocksIgnoresVerificationOfOriginMock() + { + $m = mock('overload:MyNamespace\MyClass7'); + $m->shouldReceive('foo')->once()->andReturn('bar'); + } + + /** + * @expectedException \Mockery\CountValidator\Exception + */ + public function testInstantiationOfInstanceMocksAddsThemToContainerForVerification() + { + $m = mock('overload:MyNamespace\MyClass8'); + $m->shouldReceive('foo')->once(); + $instance = new MyNamespace\MyClass8; + Mockery::close(); + } + + public function testInstantiationOfInstanceMocksDoesNotHaveCountValidatorCrossover() + { + $m = mock('overload:MyNamespace\MyClass9'); + $m->shouldReceive('foo')->once(); + $instance1 = new MyNamespace\MyClass9; + $instance2 = new MyNamespace\MyClass9; + $instance1->foo(); + $instance2->foo(); + } + + /** + * @expectedException \Mockery\CountValidator\Exception + */ + public function testInstantiationOfInstanceMocksDoesNotHaveCountValidatorCrossover2() + { + $m = mock('overload:MyNamespace\MyClass10'); + $m->shouldReceive('foo')->once(); + $instance1 = new MyNamespace\MyClass10; + $instance2 = new MyNamespace\MyClass10; + $instance1->foo(); + Mockery::close(); + } + + public function testCreationOfInstanceMockWithFullyQualifiedName() + { + $m = mock('overload:\MyNamespace\MyClass11'); + $this->assertInstanceOf(MyNamespace\MyClass11::class, $m); + } + + public function testInstanceMocksShouldIgnoreMissing() + { + $m = mock('overload:MyNamespace\MyClass12'); + $m->shouldIgnoreMissing(); + + $instance = new MyNamespace\MyClass12(); + $this->assertNull($instance->foo()); + } + + /** + * @group issue/451 + */ + public function testSettingPropertyOnInstanceMockWillSetItOnActualInstance() + { + $m = mock('overload:MyNamespace\MyClass13'); + $m->shouldReceive('foo')->andSet('bar', 'baz'); + $instance = new MyNamespace\MyClass13; + $instance->foo(); + $this->assertEquals('baz', $m->bar); + $this->assertEquals('baz', $instance->bar); + } + + public function testInstantiationOfInstanceMockWithConstructorParameterValidation() + { + $m = mock('overload:MyNamespace\MyClass14'); + $params = [ + 'value1' => uniqid('test_') + ]; + $m->shouldReceive('__construct')->with($params); + + new MyNamespace\MyClass14($params); + } + + /** + * @expectedException \Mockery\Exception\NoMatchingExpectationException + */ + public function testInstantiationOfInstanceMockWithConstructorParameterValidationNegative() + { + $m = mock('overload:MyNamespace\MyClass15'); + $params = [ + 'value1' => uniqid('test_') + ]; + $m->shouldReceive('__construct')->with($params); + + new MyNamespace\MyClass15([]); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessageRegExp /^instanceMock \d{3}$/ + */ + public function testInstantiationOfInstanceMockWithConstructorParameterValidationException() + { + $m = mock('overload:MyNamespace\MyClass16'); + $m->shouldReceive('__construct') + ->andThrow(new \Exception('instanceMock '.rand(100, 999))); + + new MyNamespace\MyClass16(); + } + + public function testMethodParamsPassedByReferenceHaveReferencePreserved() + { + $m = mock('MockeryTestRef1'); + $m->shouldReceive('foo')->with( + Mockery::on(function (&$a) { + $a += 1; + return true; + }), + Mockery::any() + ); + $a = 1; + $b = 1; + $m->foo($a, $b); + $this->assertEquals(2, $a); + $this->assertEquals(1, $b); + } + + public function testMethodParamsPassedByReferenceThroughWithArgsHaveReferencePreserved() + { + $m = mock('MockeryTestRef1'); + $m->shouldReceive('foo')->withArgs(function (&$a, $b) { + $a += 1; + $b += 1; + return true; + }); + $a = 1; + $b = 1; + $m->foo($a, $b); + $this->assertEquals(2, $a); + $this->assertEquals(1, $b); + } + + /** + * Meant to test the same logic as + * testCanOverrideExpectedParametersOfExtensionPHPClassesToPreserveRefs, + * but: + * - doesn't require an extension + * - isn't actually known to be used + */ + public function testCanOverrideExpectedParametersOfInternalPHPClassesToPreserveRefs() + { + Mockery::getConfiguration()->setInternalClassMethodParamMap( + 'DateTime', 'modify', array('&$string') + ); + // @ used to avoid E_STRICT for incompatible signature + @$m = mock('DateTime'); + $this->assertInstanceOf("Mockery\MockInterface", $m, "Mocking failed, remove @ error suppresion to debug"); + $m->shouldReceive('modify')->with( + Mockery::on(function (&$string) { + $string = 'foo'; + return true; + }) + ); + $data ='bar'; + $m->modify($data); + $this->assertEquals('foo', $data); + Mockery::getConfiguration()->resetInternalClassMethodParamMaps(); + } + + /** + * Real world version of + * testCanOverrideExpectedParametersOfInternalPHPClassesToPreserveRefs + */ + public function testCanOverrideExpectedParametersOfExtensionPHPClassesToPreserveRefs() + { + if (!class_exists('MongoCollection', false)) { + $this->markTestSkipped('ext/mongo not installed'); + } + Mockery::getConfiguration()->setInternalClassMethodParamMap( + 'MongoCollection', 'insert', array('&$data', '$options') + ); + // @ used to avoid E_STRICT for incompatible signature + @$m = mock('MongoCollection'); + $this->assertInstanceOf("Mockery\MockInterface", $m, "Mocking failed, remove @ error suppresion to debug"); + $m->shouldReceive('insert')->with( + Mockery::on(function (&$data) { + $data['_id'] = 123; + return true; + }), + Mockery::type('array') + ); + $data = array('a'=>1,'b'=>2); + $m->insert($data, array()); + $this->assertArrayHasKey('_id', $data); + $this->assertEquals(123, $data['_id']); + Mockery::getConfiguration()->resetInternalClassMethodParamMaps(); + } + + public function testCanCreateNonOverridenInstanceOfPreviouslyOverridenInternalClasses() + { + Mockery::getConfiguration()->setInternalClassMethodParamMap( + 'DateTime', 'modify', array('&$string') + ); + // @ used to avoid E_STRICT for incompatible signature + @$m = mock('DateTime'); + $this->assertInstanceOf("Mockery\MockInterface", $m, "Mocking failed, remove @ error suppresion to debug"); + $rc = new ReflectionClass($m); + $rm = $rc->getMethod('modify'); + $params = $rm->getParameters(); + $this->assertTrue($params[0]->isPassedByReference()); + + Mockery::getConfiguration()->resetInternalClassMethodParamMaps(); + + $m = mock('DateTime'); + $this->assertInstanceOf("Mockery\MockInterface", $m, "Mocking failed"); + $rc = new ReflectionClass($m); + $rm = $rc->getMethod('modify'); + $params = $rm->getParameters(); + $this->assertFalse($params[0]->isPassedByReference()); + + Mockery::getConfiguration()->resetInternalClassMethodParamMaps(); + } + + /** + * @group abstract + */ + public function testCanMockAbstractClassWithAbstractPublicMethod() + { + $m = mock('MockeryTest_AbstractWithAbstractPublicMethod'); + $this->assertInstanceOf(MockeryTest_AbstractWithAbstractPublicMethod::class, $m); + } + + /** + * @issue issue/21 + */ + public function testClassDeclaringIssetDoesNotThrowException() + { + $this->assertInstanceOf(MockInterface::class, mock('MockeryTest_IssetMethod')); + } + + /** + * @issue issue/21 + */ + public function testClassDeclaringUnsetDoesNotThrowException() + { + $this->assertInstanceOf(MockInterface::class, mock('MockeryTest_UnsetMethod')); + } + + /** + * @issue issue/35 + */ + public function testCallingSelfOnlyReturnsLastMockCreatedOrCurrentMockBeingProgrammedSinceTheyAreOneAndTheSame() + { + $m = mock('MockeryTestFoo'); + $this->assertNotInstanceOf(MockeryTestFoo2::class, Mockery::self()); + //$m = mock('MockeryTestFoo2'); + //$this->assertInstanceOf(MockeryTestFoo2::class, self()); + //$m = mock('MockeryTestFoo'); + //$this->assertNotInstanceOf(MockeryTestFoo2::class, Mockery::self()); + //$this->assertInstanceOf(MockeryTestFoo::class, Mockery::self()); + } + + /** + * @issue issue/89 + */ + public function testCreatingMockOfClassWithExistingToStringMethodDoesntCreateClassWithTwoToStringMethods() + { + $m = mock('MockeryTest_WithToString'); // this would fatal + $m->shouldReceive("__toString")->andReturn('dave'); + $this->assertEquals("dave", "$m"); + } + + public function testGetExpectationCount_freshContainer() + { + $this->assertEquals(0, Mockery::getContainer()->mockery_getExpectationCount()); + } + + public function testGetExpectationCount_simplestMock() + { + $m = mock(); + $m->shouldReceive('foo')->andReturn('bar'); + $this->assertEquals(1, Mockery::getContainer()->mockery_getExpectationCount()); + } + + public function testMethodsReturningParamsByReferenceDoesNotErrorOut() + { + mock('MockeryTest_ReturnByRef'); + $mock = mock('MockeryTest_ReturnByRef'); + $mock->shouldReceive("get")->andReturn($var = 123); + $this->assertSame($var, $mock->get()); + } + + + public function testMockCallableTypeHint() + { + $this->assertInstanceOf(MockInterface::class, mock('MockeryTest_MockCallableTypeHint')); + } + + public function testCanMockClassWithReservedWordMethod() + { + if (!extension_loaded("redis")) { + $this->markTestSkipped("phpredis not installed"); + } + + mock("Redis"); + } + + public function testUndeclaredClassIsDeclared() + { + $this->assertFalse(class_exists("BlahBlah")); + $mock = mock("BlahBlah"); + $this->assertInstanceOf("BlahBlah", $mock); + } + + public function testUndeclaredClassWithNamespaceIsDeclared() + { + $this->assertFalse(class_exists("MyClasses\Blah\BlahBlah")); + $mock = mock("MyClasses\Blah\BlahBlah"); + $this->assertInstanceOf("MyClasses\Blah\BlahBlah", $mock); + } + + public function testUndeclaredClassWithNamespaceIncludingLeadingOperatorIsDeclared() + { + $this->assertFalse(class_exists("\MyClasses\DaveBlah\BlahBlah")); + $mock = mock("\MyClasses\DaveBlah\BlahBlah"); + $this->assertInstanceOf("\MyClasses\DaveBlah\BlahBlah", $mock); + } + + public function testMockingPhpredisExtensionClassWorks() + { + if (!class_exists('Redis')) { + $this->markTestSkipped('PHPRedis extension required for this test'); + } + $m = mock('Redis'); + } + + public function testIssetMappingUsingProxiedPartials_CheckNoExceptionThrown() + { + $var = mock(new MockeryTestIsset_Bar()); + $mock = mock(new MockeryTestIsset_Foo($var)); + $mock->shouldReceive('bar')->once(); + $mock->bar(); + Mockery::close(); + + $this->assertTrue(true); + } + + /** + * @group traversable1 + */ + public function testCanMockInterfacesExtendingTraversable() + { + $mock = mock('MockeryTest_InterfaceWithTraversable'); + $this->assertInstanceOf('MockeryTest_InterfaceWithTraversable', $mock); + $this->assertInstanceOf('ArrayAccess', $mock); + $this->assertInstanceOf('Countable', $mock); + $this->assertInstanceOf('Traversable', $mock); + } + + /** + * @group traversable2 + */ + public function testCanMockInterfacesAlongsideTraversable() + { + $mock = mock('stdClass, ArrayAccess, Countable, Traversable'); + $this->assertInstanceOf('stdClass', $mock); + $this->assertInstanceOf('ArrayAccess', $mock); + $this->assertInstanceOf('Countable', $mock); + $this->assertInstanceOf('Traversable', $mock); + } + + public function testInterfacesCanHaveAssertions() + { + $m = mock('stdClass, ArrayAccess, Countable, Traversable'); + $m->shouldReceive('foo')->once(); + $m->foo(); + } + + public function testMockingIteratorAggregateDoesNotImplementIterator() + { + $mock = mock('MockeryTest_ImplementsIteratorAggregate'); + $this->assertInstanceOf('IteratorAggregate', $mock); + $this->assertInstanceOf('Traversable', $mock); + $this->assertNotInstanceOf('Iterator', $mock); + } + + public function testMockingInterfaceThatExtendsIteratorDoesNotImplementIterator() + { + $mock = mock('MockeryTest_InterfaceThatExtendsIterator'); + $this->assertInstanceOf('Iterator', $mock); + $this->assertInstanceOf('Traversable', $mock); + } + + public function testMockingInterfaceThatExtendsIteratorAggregateDoesNotImplementIterator() + { + $mock = mock('MockeryTest_InterfaceThatExtendsIteratorAggregate'); + $this->assertInstanceOf('IteratorAggregate', $mock); + $this->assertInstanceOf('Traversable', $mock); + $this->assertNotInstanceOf('Iterator', $mock); + } + + public function testMockingIteratorAggregateDoesNotImplementIteratorAlongside() + { + $mock = mock('IteratorAggregate'); + $this->assertInstanceOf('IteratorAggregate', $mock); + $this->assertInstanceOf('Traversable', $mock); + $this->assertNotInstanceOf('Iterator', $mock); + } + + public function testMockingIteratorDoesNotImplementIteratorAlongside() + { + $mock = mock('Iterator'); + $this->assertInstanceOf('Iterator', $mock); + $this->assertInstanceOf('Traversable', $mock); + } + + public function testMockingIteratorDoesNotImplementIterator() + { + $mock = mock('MockeryTest_ImplementsIterator'); + $this->assertInstanceOf('Iterator', $mock); + $this->assertInstanceOf('Traversable', $mock); + } + + public function testMockeryCloseForIllegalIssetFileInclude() + { + $m = Mockery::mock('StdClass') + ->shouldReceive('get') + ->andReturn(false) + ->getMock(); + $m->get(); + Mockery::close(); + + // no idea what this test does, adding this as an assertion... + $this->assertTrue(true); + } + + public function testMockeryShouldDistinguishBetweenConstructorParamsAndClosures() + { + $obj = new MockeryTestFoo(); + $this->assertInstanceOf(MockInterface::class, mock('MockeryTest_ClassMultipleConstructorParams[dave]', [ + &$obj, 'foo' + ])); + } + + /** @group nette */ + public function testMockeryShouldNotMockCallstaticMagicMethod() + { + $this->assertInstanceOf(MockInterface::class, mock('MockeryTest_CallStatic')); + } + + /** @group issue/144 */ + public function testMockeryShouldInterpretEmptyArrayAsConstructorArgs() + { + $mock = mock("EmptyConstructorTest", array()); + $this->assertSame(0, $mock->numberOfConstructorArgs); + } + + /** @group issue/144 */ + public function testMockeryShouldCallConstructorByDefaultWhenRequestingPartials() + { + $mock = mock("EmptyConstructorTest[foo]"); + $this->assertSame(0, $mock->numberOfConstructorArgs); + } + + /** @group issue/158 */ + public function testMockeryShouldRespectInterfaceWithMethodParamSelf() + { + $this->assertInstanceOf(MockInterface::class, mock('MockeryTest_InterfaceWithMethodParamSelf')); + } + + /** @group issue/162 */ + public function testMockeryDoesntTryAndMockLowercaseToString() + { + $this->assertInstanceOf(MockInterface::class, mock('MockeryTest_Lowercase_ToString')); + } + + /** @group issue/175 */ + public function testExistingStaticMethodMocking() + { + $mock = mock('MockeryTest_PartialStatic[mockMe]'); + + $mock->shouldReceive('mockMe')->with(5)->andReturn(10); + + $this->assertEquals(10, $mock::mockMe(5)); + $this->assertEquals(3, $mock::keepMe(3)); + } + + /** + * @group issue/154 + * @expectedException InvalidArgumentException + * @expectedExceptionMessage protectedMethod() cannot be mocked as it is a protected method and mocking protected methods is not enabled for the currently used mock object. + */ + public function testShouldThrowIfAttemptingToStubProtectedMethod() + { + $mock = mock('MockeryTest_WithProtectedAndPrivate'); + $mock->shouldReceive("protectedMethod"); + } + + /** + * @group issue/154 + * @expectedException InvalidArgumentException + * @expectedExceptionMessage privateMethod() cannot be mocked as it is a private method + */ + public function testShouldThrowIfAttemptingToStubPrivateMethod() + { + $mock = mock('MockeryTest_WithProtectedAndPrivate'); + $mock->shouldReceive("privateMethod"); + } + + public function testWakeupMagicIsNotMockedToAllowSerialisationInstanceHack() + { + $this->assertInstanceOf(\DateTime::class, mock('DateTime')); + } + + /** + * @group issue/154 + */ + public function testCanMockMethodsWithRequiredParamsThatHaveDefaultValues() + { + $mock = mock('MockeryTest_MethodWithRequiredParamWithDefaultValue'); + $mock->shouldIgnoreMissing(); + $this->assertNull($mock->foo(null, 123)); + } + + /** + * @test + * @group issue/294 + * @expectedException Mockery\Exception\RuntimeException + * @expectedExceptionMessage Could not load mock DateTime, class already exists + */ + public function testThrowsWhenNamedMockClassExistsAndIsNotMockery() + { + $builder = new MockConfigurationBuilder(); + $builder->setName("DateTime"); + $mock = mock($builder); + } + + /** + * @expectedException Mockery\Exception\NoMatchingExpectationException + * @expectedExceptionMessage MyTestClass::foo(resource(...)) + */ + public function testHandlesMethodWithArgumentExpectationWhenCalledWithResource() + { + $mock = mock('MyTestClass'); + $mock->shouldReceive('foo')->with(array('yourself' => 21)); + + $mock->foo(fopen('php://memory', 'r')); + } + + /** + * @expectedException Mockery\Exception\NoMatchingExpectationException + * @expectedExceptionMessage MyTestClass::foo(['myself' => [...]]) + */ + public function testHandlesMethodWithArgumentExpectationWhenCalledWithCircularArray() + { + $testArray = array(); + $testArray['myself'] =& $testArray; + + $mock = mock('MyTestClass'); + $mock->shouldReceive('foo')->with(array('yourself' => 21)); + + $mock->foo($testArray); + } + + /** + * @expectedException Mockery\Exception\NoMatchingExpectationException + * @expectedExceptionMessage MyTestClass::foo(['a_scalar' => 2, 'an_array' => [...]]) + */ + public function testHandlesMethodWithArgumentExpectationWhenCalledWithNestedArray() + { + $testArray = array(); + $testArray['a_scalar'] = 2; + $testArray['an_array'] = array(1, 2, 3); + + $mock = mock('MyTestClass'); + $mock->shouldReceive('foo')->with(array('yourself' => 21)); + + $mock->foo($testArray); + } + + /** + * @expectedException Mockery\Exception\NoMatchingExpectationException + * @expectedExceptionMessage MyTestClass::foo(['a_scalar' => 2, 'an_object' => object(stdClass)]) + */ + public function testHandlesMethodWithArgumentExpectationWhenCalledWithNestedObject() + { + $testArray = array(); + $testArray['a_scalar'] = 2; + $testArray['an_object'] = new stdClass(); + + $mock = mock('MyTestClass'); + $mock->shouldReceive('foo')->with(array('yourself' => 21)); + + $mock->foo($testArray); + } + + /** + * @expectedException Mockery\Exception\NoMatchingExpectationException + * @expectedExceptionMessage MyTestClass::foo(['a_scalar' => 2, 'a_closure' => object(Closure + */ + public function testHandlesMethodWithArgumentExpectationWhenCalledWithNestedClosure() + { + $testArray = array(); + $testArray['a_scalar'] = 2; + $testArray['a_closure'] = function () { + }; + + $mock = mock('MyTestClass'); + $mock->shouldReceive('foo')->with(array('yourself' => 21)); + + $mock->foo($testArray); + } + + /** + * @expectedException Mockery\Exception\NoMatchingExpectationException + * @expectedExceptionMessage MyTestClass::foo(['a_scalar' => 2, 'a_resource' => resource(...)]) + */ + public function testHandlesMethodWithArgumentExpectationWhenCalledWithNestedResource() + { + $testArray = array(); + $testArray['a_scalar'] = 2; + $testArray['a_resource'] = fopen('php://memory', 'r'); + + $mock = mock('MyTestClass'); + $mock->shouldReceive('foo')->with(array('yourself' => 21)); + + $mock->foo($testArray); + } + + public function testExceptionOutputMakesBooleansLookLikeBooleans() + { + $mock = mock('MyTestClass'); + $mock->shouldReceive("foo")->with(123); + + $this->expectException( + "Mockery\Exception\NoMatchingExpectationException", + "MyTestClass::foo(true, false, [0 => true, 1 => false])" + ); + + $mock->foo(true, false, [true, false]); + } + + /** + * @test + * @group issue/339 + */ + public function canMockClassesThatDescendFromInternalClasses() + { + $mock = mock("MockeryTest_ClassThatDescendsFromInternalClass"); + $this->assertInstanceOf("DateTime", $mock); + } + + /** + * @test + * @group issue/339 + */ + public function canMockClassesThatImplementSerializable() + { + $mock = mock("MockeryTest_ClassThatImplementsSerializable"); + $this->assertInstanceOf("Serializable", $mock); + } + + /** + * @test + * @group issue/346 + */ + public function canMockInternalClassesThatImplementSerializable() + { + $mock = mock("ArrayObject"); + $this->assertInstanceOf("Serializable", $mock); + } + + /** + * @dataProvider classNameProvider + */ + public function testIsValidClassName($expected, $className) + { + $container = new \Mockery\Container; + $this->assertSame($expected, $container->isValidClassName($className)); + } + + public function classNameProvider() + { + return array( + array(false, ' '), // just a space + array(false, 'ClassName.WithDot'), + array(false, '\\\\TooManyBackSlashes'), + array(true, 'Foo'), + array(true, '\\Foo\\Bar'), + ); + } +} + +class MockeryTest_CallStatic +{ + public static function __callStatic($method, $args) + { + } +} + +class MockeryTest_ClassMultipleConstructorParams +{ + public function __construct($a, $b) + { + } + + public function dave() + { + } +} + +interface MockeryTest_InterfaceWithTraversable extends ArrayAccess, Traversable, Countable +{ + public function self(); +} + +class MockeryTestIsset_Bar +{ + public function doSomething() + { + } +} + +class MockeryTestIsset_Foo +{ + private $var; + + public function __construct($var) + { + $this->var = $var; + } + + public function __get($name) + { + $this->var->doSomething(); + } + + public function __isset($name) + { + return (bool) strlen($this->__get($name)); + } +} + +class MockeryTest_IssetMethod +{ + protected $_properties = array(); + + public function __construct() + { + } + + public function __isset($property) + { + return isset($this->_properties[$property]); + } +} + +class MockeryTest_UnsetMethod +{ + protected $_properties = array(); + + public function __construct() + { + } + + public function __unset($property) + { + unset($this->_properties[$property]); + } +} + +class MockeryTestFoo +{ + public function foo() + { + return 'foo'; + } +} + +class MockeryTestFoo2 +{ + public function foo() + { + return 'foo'; + } + + public function bar() + { + return 'bar'; + } +} + +final class MockeryFoo3 +{ + public function foo() + { + return 'baz'; + } +} + +class MockeryFoo4 +{ + final public function foo() + { + return 'baz'; + } + + public function bar() + { + return 'bar'; + } +} + +interface MockeryTest_Interface +{ +} +interface MockeryTest_Interface1 +{ +} +interface MockeryTest_Interface2 +{ +} + +interface MockeryTest_InterfaceWithAbstractMethod +{ + public function set(); +} + +interface MockeryTest_InterfaceWithPublicStaticMethod +{ + public static function self(); +} + +abstract class MockeryTest_AbstractWithAbstractMethod +{ + abstract protected function set(); +} + +class MockeryTest_WithProtectedAndPrivate +{ + protected function protectedMethod() + { + } + + private function privateMethod() + { + } +} + +class MockeryTest_ClassConstructor +{ + public function __construct($param1) + { + } +} + +class MockeryTest_ClassConstructor2 +{ + protected $param1; + + public function __construct(stdClass $param1) + { + $this->param1 = $param1; + } + + public function getParam1() + { + return $this->param1; + } + + public function foo() + { + return 'foo'; + } + + public function bar() + { + return $this->foo(); + } +} + +class MockeryTest_Call1 +{ + public function __call($method, array $params) + { + } +} + +class MockeryTest_Call2 +{ + public function __call($method, $params) + { + } +} + +class MockeryTest_Wakeup1 +{ + public function __construct() + { + } + + public function __wakeup() + { + } +} + +class MockeryTest_ExistingProperty +{ + public $foo = 'bar'; +} + +abstract class MockeryTest_AbstractWithAbstractPublicMethod +{ + abstract public function foo($a, $b); +} + +// issue/18 +class SoCool +{ + public function iDoSomethingReallyCoolHere() + { + return 3; + } +} + +class Gateway +{ + public function __call($method, $args) + { + $m = new SoCool(); + return call_user_func_array(array($m, $method), $args); + } +} + +class MockeryTestBar1 +{ + public function method1() + { + return $this; + } +} + +class MockeryTest_ReturnByRef +{ + public $i = 0; + + public function &get() + { + return $this->$i; + } +} + +class MockeryTest_MethodParamRef +{ + public function method1(&$foo) + { + return true; + } +} +class MockeryTest_MethodParamRef2 +{ + public function method1(&$foo) + { + return true; + } +} +class MockeryTestRef1 +{ + public function foo(&$a, $b) + { + } +} + +class MockeryTest_PartialNormalClass +{ + public function foo() + { + return 'abc'; + } + + public function bar() + { + return 'abc'; + } +} + +abstract class MockeryTest_PartialAbstractClass +{ + abstract public function foo(); + + public function bar() + { + return 'abc'; + } +} + +class MockeryTest_PartialNormalClass2 +{ + public function foo() + { + return 'abc'; + } + + public function bar() + { + return 'abc'; + } + + public function baz() + { + return 'abc'; + } +} + +abstract class MockeryTest_PartialAbstractClass2 +{ + abstract public function foo(); + + public function bar() + { + return 'abc'; + } + + abstract public function baz(); +} + +class MockeryTest_TestInheritedType +{ +} + +if (PHP_VERSION_ID >= 50400) { + class MockeryTest_MockCallableTypeHint + { + public function foo(callable $baz) + { + $baz(); + } + + public function bar(callable $callback = null) + { + $callback(); + } + } +} + +class MockeryTest_WithToString +{ + public function __toString() + { + } +} + +class MockeryTest_ImplementsIteratorAggregate implements IteratorAggregate +{ + public function getIterator() + { + return new ArrayIterator(array()); + } +} + +class MockeryTest_ImplementsIterator implements Iterator +{ + public function rewind() + { + } + + public function current() + { + } + + public function key() + { + } + + public function next() + { + } + + public function valid() + { + } +} + +class EmptyConstructorTest +{ + public $numberOfConstructorArgs; + + public function __construct(...$args) + { + $this->numberOfConstructorArgs = count($args); + } + + public function foo() + { + } +} + +interface MockeryTest_InterfaceWithMethodParamSelf +{ + public function foo(self $bar); +} + +class MockeryTest_Lowercase_ToString +{ + public function __tostring() + { + } +} + +class MockeryTest_PartialStatic +{ + public static function mockMe($a) + { + return $a; + } + + public static function keepMe($b) + { + return $b; + } +} + +class MockeryTest_MethodWithRequiredParamWithDefaultValue +{ + public function foo(DateTime $bar = null, $baz) + { + } +} + +interface MockeryTest_InterfaceThatExtendsIterator extends Iterator +{ + public function foo(); +} + +interface MockeryTest_InterfaceThatExtendsIteratorAggregate extends IteratorAggregate +{ + public function foo(); +} + +class MockeryTest_ClassThatDescendsFromInternalClass extends DateTime +{ +} + +class MockeryTest_ClassThatImplementsSerializable implements Serializable +{ + public function serialize() + { + } + + public function unserialize($serialized) + { + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/DemeterChainTest.php b/vendor/mockery/mockery/tests/Mockery/DemeterChainTest.php new file mode 100644 index 0000000..9528d16 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/DemeterChainTest.php @@ -0,0 +1,204 @@ += 0) { + require_once __DIR__.'/DummyClasses/DemeterChain.php'; +} + +use Mockery\Adapter\Phpunit\MockeryTestCase; + +class DemeterChainTest extends MockeryTestCase +{ + /** @var Mockery\Mock $this->mock */ + private $mock; + + public function setUp() + { + $this->mock = $this->mock = Mockery::mock()->shouldIgnoreMissing(); + } + + public function tearDown() + { + $this->mock->mockery_getContainer()->mockery_close(); + } + + public function testTwoChains() + { + $this->mock->shouldReceive('getElement->getFirst') + ->once() + ->andReturn('something'); + + $this->mock->shouldReceive('getElement->getSecond') + ->once() + ->andReturn('somethingElse'); + + $this->assertEquals( + 'something', + $this->mock->getElement()->getFirst() + ); + $this->assertEquals( + 'somethingElse', + $this->mock->getElement()->getSecond() + ); + $this->mock->mockery_getContainer()->mockery_close(); + } + + public function testTwoChainsWithExpectedParameters() + { + $this->mock->shouldReceive('getElement->getFirst') + ->once() + ->with('parameter') + ->andReturn('something'); + + $this->mock->shouldReceive('getElement->getSecond') + ->once() + ->with('secondParameter') + ->andReturn('somethingElse'); + + $this->assertEquals( + 'something', + $this->mock->getElement()->getFirst('parameter') + ); + $this->assertEquals( + 'somethingElse', + $this->mock->getElement()->getSecond('secondParameter') + ); + $this->mock->mockery_getContainer()->mockery_close(); + } + + public function testThreeChains() + { + $this->mock->shouldReceive('getElement->getFirst') + ->once() + ->andReturn('something'); + + $this->mock->shouldReceive('getElement->getSecond') + ->once() + ->andReturn('somethingElse'); + + $this->assertEquals( + 'something', + $this->mock->getElement()->getFirst() + ); + $this->assertEquals( + 'somethingElse', + $this->mock->getElement()->getSecond() + ); + $this->mock->shouldReceive('getElement->getFirst') + ->once() + ->andReturn('somethingNew'); + $this->assertEquals( + 'somethingNew', + $this->mock->getElement()->getFirst() + ); + } + + public function testManyChains() + { + $this->mock->shouldReceive('getElements->getFirst') + ->once() + ->andReturn('something'); + + $this->mock->shouldReceive('getElements->getSecond') + ->once() + ->andReturn('somethingElse'); + + $this->mock->getElements()->getFirst(); + $this->mock->getElements()->getSecond(); + } + + public function testTwoNotRelatedChains() + { + $this->mock->shouldReceive('getElement->getFirst') + ->once() + ->andReturn('something'); + + $this->mock->shouldReceive('getOtherElement->getSecond') + ->once() + ->andReturn('somethingElse'); + + $this->assertEquals( + 'somethingElse', + $this->mock->getOtherElement()->getSecond() + ); + $this->assertEquals( + 'something', + $this->mock->getElement()->getFirst() + ); + } + + public function testDemeterChain() + { + $this->mock->shouldReceive('getElement->getFirst') + ->once() + ->andReturn('somethingElse'); + + $this->assertEquals('somethingElse', $this->mock->getElement()->getFirst()); + } + + public function testMultiLevelDemeterChain() + { + $this->mock->shouldReceive('levelOne->levelTwo->getFirst') + ->andReturn('first'); + + $this->mock->shouldReceive('levelOne->levelTwo->getSecond') + ->andReturn('second'); + + $this->assertEquals( + 'second', + $this->mock->levelOne()->levelTwo()->getSecond() + ); + $this->assertEquals( + 'first', + $this->mock->levelOne()->levelTwo()->getFirst() + ); + } + + public function testSimilarDemeterChainsOnDifferentClasses() + { + $mock1 = Mockery::mock('overload:mock1'); + $mock1->shouldReceive('select->some->data')->andReturn(1); + $mock1->shouldReceive('select->some->other->data')->andReturn(2); + + $mock2 = Mockery::mock('overload:mock2'); + $mock2->shouldReceive('select->some->data')->andReturn(3); + $mock2->shouldReceive('select->some->other->data')->andReturn(4); + + $this->assertEquals(1, mock1::select()->some()->data()); + $this->assertEquals(2, mock1::select()->some()->other()->data()); + $this->assertEquals(3, mock2::select()->some()->data()); + $this->assertEquals(4, mock2::select()->some()->other()->data()); + } + + /** + * @requires PHP 7.0.0 + */ + public function testDemeterChainsWithClassReturnTypeHints() + { + $a = \Mockery::mock(\DemeterChain\A::class); + $a->shouldReceive('foo->bar->baz')->andReturn(new stdClass); + + $m = new \DemeterChain\Main(); + $result = $m->callDemeter($a); + + $this->assertInstanceOf(stdClass::class, $result); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/DummyClasses/DemeterChain.php b/vendor/mockery/mockery/tests/Mockery/DummyClasses/DemeterChain.php new file mode 100644 index 0000000..b778cd4 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/DummyClasses/DemeterChain.php @@ -0,0 +1,54 @@ +foo()->bar()->baz(); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/DummyClasses/Namespaced.php b/vendor/mockery/mockery/tests/Mockery/DummyClasses/Namespaced.php new file mode 100644 index 0000000..615eb71 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/DummyClasses/Namespaced.php @@ -0,0 +1,35 @@ +mock = mock(); + } + + public function teardown() + { + parent::tearDown(); + \Mockery::getConfiguration()->allowMockingNonExistentMethods(true); + } + + public function testReturnsNullWhenNoArgs() + { + $this->mock->shouldReceive('foo'); + $this->assertNull($this->mock->foo()); + } + + public function testReturnsNullWhenSingleArg() + { + $this->mock->shouldReceive('foo'); + $this->assertNull($this->mock->foo(1)); + } + + public function testReturnsNullWhenManyArgs() + { + $this->mock->shouldReceive('foo'); + $this->assertNull($this->mock->foo('foo', array(), new stdClass)); + } + + public function testReturnsNullIfNullIsReturnValue() + { + $this->mock->shouldReceive('foo')->andReturn(null); + $this->assertNull($this->mock->foo()); + } + + public function testReturnsNullForMockedExistingClassIfAndreturnnullCalled() + { + $mock = mock('MockeryTest_Foo'); + $mock->shouldReceive('foo')->andReturn(null); + $this->assertNull($mock->foo()); + } + + public function testReturnsNullForMockedExistingClassIfNullIsReturnValue() + { + $mock = mock('MockeryTest_Foo'); + $mock->shouldReceive('foo')->andReturnNull(); + $this->assertNull($mock->foo()); + } + + public function testReturnsSameValueForAllIfNoArgsExpectationAndNoneGiven() + { + $this->mock->shouldReceive('foo')->andReturn(1); + $this->assertEquals(1, $this->mock->foo()); + } + + public function testSetsPublicPropertyWhenRequested() + { + $this->mock->bar = null; + $this->mock->shouldReceive('foo')->andSet('bar', 'baz'); + $this->assertNull($this->mock->bar); + $this->mock->foo(); + $this->assertEquals('baz', $this->mock->bar); + } + + public function testSetsPublicPropertyWhenRequestedUsingAlias() + { + $this->mock->bar = null; + $this->mock->shouldReceive('foo')->set('bar', 'baz'); + $this->assertNull($this->mock->bar); + $this->mock->foo(); + $this->assertEquals('baz', $this->mock->bar); + } + + public function testSetsPublicPropertiesWhenRequested() + { + $this->mock->bar = null; + $this->mock->shouldReceive('foo')->andSet('bar', 'baz', 'bazz', 'bazzz'); + $this->assertNull($this->mock->bar); + $this->mock->foo(); + $this->assertEquals('baz', $this->mock->bar); + $this->mock->foo(); + $this->assertEquals('bazz', $this->mock->bar); + $this->mock->foo(); + $this->assertEquals('bazzz', $this->mock->bar); + } + + public function testSetsPublicPropertiesWhenRequestedUsingAlias() + { + $this->mock->bar = null; + $this->mock->shouldReceive('foo')->set('bar', 'baz', 'bazz', 'bazzz'); + $this->assertAttributeEmpty('bar', $this->mock); + $this->mock->foo(); + $this->assertEquals('baz', $this->mock->bar); + $this->mock->foo(); + $this->assertEquals('bazz', $this->mock->bar); + $this->mock->foo(); + $this->assertEquals('bazzz', $this->mock->bar); + } + + public function testSetsPublicPropertiesWhenRequestedMoreTimesThanSetValues() + { + $this->mock->bar = null; + $this->mock->shouldReceive('foo')->andSet('bar', 'baz', 'bazz'); + $this->assertNull($this->mock->bar); + $this->mock->foo(); + $this->assertEquals('baz', $this->mock->bar); + $this->mock->foo(); + $this->assertEquals('bazz', $this->mock->bar); + $this->mock->foo(); + $this->assertEquals('bazz', $this->mock->bar); + } + + public function testSetsPublicPropertiesWhenRequestedMoreTimesThanSetValuesUsingAlias() + { + $this->mock->bar = null; + $this->mock->shouldReceive('foo')->andSet('bar', 'baz', 'bazz'); + $this->assertNull($this->mock->bar); + $this->mock->foo(); + $this->assertEquals('baz', $this->mock->bar); + $this->mock->foo(); + $this->assertEquals('bazz', $this->mock->bar); + $this->mock->foo(); + $this->assertEquals('bazz', $this->mock->bar); + } + + public function testSetsPublicPropertiesWhenRequestedMoreTimesThanSetValuesWithDirectSet() + { + $this->mock->bar = null; + $this->mock->shouldReceive('foo')->andSet('bar', 'baz', 'bazz'); + $this->assertNull($this->mock->bar); + $this->mock->foo(); + $this->assertEquals('baz', $this->mock->bar); + $this->mock->foo(); + $this->assertEquals('bazz', $this->mock->bar); + $this->mock->bar = null; + $this->mock->foo(); + $this->assertNull($this->mock->bar); + } + + public function testSetsPublicPropertiesWhenRequestedMoreTimesThanSetValuesWithDirectSetUsingAlias() + { + $this->mock->bar = null; + $this->mock->shouldReceive('foo')->set('bar', 'baz', 'bazz'); + $this->assertNull($this->mock->bar); + $this->mock->foo(); + $this->assertEquals('baz', $this->mock->bar); + $this->mock->foo(); + $this->assertEquals('bazz', $this->mock->bar); + $this->mock->bar = null; + $this->mock->foo(); + $this->assertNull($this->mock->bar); + } + + public function testReturnsSameValueForAllIfNoArgsExpectationAndSomeGiven() + { + $this->mock->shouldReceive('foo')->andReturn(1); + $this->assertEquals(1, $this->mock->foo('foo')); + } + + public function testReturnsValueFromSequenceSequentially() + { + $this->mock->shouldReceive('foo')->andReturn(1, 2, 3); + $this->mock->foo('foo'); + $this->assertEquals(2, $this->mock->foo('foo')); + } + + public function testReturnsValueFromSequenceSequentiallyAndRepeatedlyReturnsFinalValueOnExtraCalls() + { + $this->mock->shouldReceive('foo')->andReturn(1, 2, 3); + $this->mock->foo('foo'); + $this->mock->foo('foo'); + $this->assertEquals(3, $this->mock->foo('foo')); + $this->assertEquals(3, $this->mock->foo('foo')); + } + + public function testReturnsValueFromSequenceSequentiallyAndRepeatedlyReturnsFinalValueOnExtraCallsWithManyAndReturnCalls() + { + $this->mock->shouldReceive('foo')->andReturn(1)->andReturn(2, 3); + $this->mock->foo('foo'); + $this->mock->foo('foo'); + $this->assertEquals(3, $this->mock->foo('foo')); + $this->assertEquals(3, $this->mock->foo('foo')); + } + + public function testReturnsValueOfClosure() + { + $this->mock->shouldReceive('foo')->with(5)->andReturnUsing(function ($v) { + return $v+1; + }); + $this->assertEquals(6, $this->mock->foo(5)); + } + + public function testReturnsUndefined() + { + $this->mock->shouldReceive('foo')->andReturnUndefined(); + $this->assertInstanceOf(\Mockery\Undefined::class, $this->mock->foo()); + } + + public function testReturnsValuesSetAsArray() + { + $this->mock->shouldReceive('foo')->andReturnValues(array(1, 2, 3)); + $this->assertEquals(1, $this->mock->foo()); + $this->assertEquals(2, $this->mock->foo()); + $this->assertEquals(3, $this->mock->foo()); + } + + /** + * @expectedException OutOfBoundsException + */ + public function testThrowsException() + { + $this->mock->shouldReceive('foo')->andThrow(new OutOfBoundsException); + $this->mock->foo(); + Mockery::close(); + } + + /** @test */ + public function and_throws_is_an_alias_to_and_throw() + { + $this->mock->shouldReceive('foo')->andThrows(new OutOfBoundsException); + + $this->expectException(OutOfBoundsException::class); + $this->mock->foo(); + } + + /** + * @test + * @requires PHP 7.0.0 + */ + public function it_can_throw_a_throwable() + { + $this->expectException(\Error::class); + $this->mock->shouldReceive('foo')->andThrow(new \Error()); + $this->mock->foo(); + } + + /** + * @expectedException OutOfBoundsException + */ + public function testThrowsExceptionBasedOnArgs() + { + $this->mock->shouldReceive('foo')->andThrow('OutOfBoundsException'); + $this->mock->foo(); + Mockery::close(); + } + + public function testThrowsExceptionBasedOnArgsWithMessage() + { + $this->mock->shouldReceive('foo')->andThrow('OutOfBoundsException', 'foo'); + try { + $this->mock->foo(); + } catch (OutOfBoundsException $e) { + $this->assertEquals('foo', $e->getMessage()); + } + } + + /** + * @expectedException OutOfBoundsException + */ + public function testThrowsExceptionSequentially() + { + $this->mock->shouldReceive('foo')->andThrow(new Exception)->andThrow(new OutOfBoundsException); + try { + $this->mock->foo(); + } catch (Exception $e) { + } + $this->mock->foo(); + Mockery::close(); + } + + public function testAndThrowExceptions() + { + $this->mock->shouldReceive('foo')->andThrowExceptions(array( + new OutOfBoundsException, + new InvalidArgumentException, + )); + + try { + $this->mock->foo(); + throw new Exception("Expected OutOfBoundsException, non thrown"); + } catch (\Exception $e) { + $this->assertInstanceOf("OutOfBoundsException", $e, "Wrong or no exception thrown: {$e->getMessage()}"); + } + + try { + $this->mock->foo(); + throw new Exception("Expected InvalidArgumentException, non thrown"); + } catch (\Exception $e) { + $this->assertInstanceOf("InvalidArgumentException", $e, "Wrong or no exception thrown: {$e->getMessage()}"); + } + } + + /** + * @expectedException Mockery\Exception + * @expectedExceptionMessage You must pass an array of exception objects to andThrowExceptions + */ + public function testAndThrowExceptionsCatchNonExceptionArgument() + { + $this->mock + ->shouldReceive('foo') + ->andThrowExceptions(array('NotAnException')); + Mockery::close(); + } + + public function testMultipleExpectationsWithReturns() + { + $this->mock->shouldReceive('foo')->with(1)->andReturn(10); + $this->mock->shouldReceive('bar')->with(2)->andReturn(20); + $this->assertEquals(10, $this->mock->foo(1)); + $this->assertEquals(20, $this->mock->bar(2)); + } + + public function testExpectsNoArguments() + { + $this->mock->shouldReceive('foo')->withNoArgs(); + $this->mock->foo(); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testExpectsNoArgumentsThrowsExceptionIfAnyPassed() + { + $this->mock->shouldReceive('foo')->withNoArgs(); + $this->mock->foo(1); + Mockery::close(); + } + + public function testExpectsArgumentsArray() + { + $this->mock->shouldReceive('foo')->withArgs(array(1, 2)); + $this->mock->foo(1, 2); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testExpectsArgumentsArrayThrowsExceptionIfPassedEmptyArray() + { + $this->mock->shouldReceive('foo')->withArgs(array()); + $this->mock->foo(1, 2); + Mockery::close(); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testExpectsArgumentsArrayThrowsExceptionIfNoArgumentsPassed() + { + $this->mock->shouldReceive('foo')->with(); + $this->mock->foo(1); + Mockery::close(); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testExpectsArgumentsArrayThrowsExceptionIfPassedWrongArguments() + { + $this->mock->shouldReceive('foo')->withArgs(array(1, 2)); + $this->mock->foo(3, 4); + Mockery::close(); + } + + /** + * @expectedException \Mockery\Exception + * @expectedExceptionMessageRegExp /foo\(NULL\)/ + */ + public function testExpectsStringArgumentExceptionMessageDifferentiatesBetweenNullAndEmptyString() + { + $this->mock->shouldReceive('foo')->withArgs(array('a string')); + $this->mock->foo(null); + Mockery::close(); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessageRegExp /invalid argument (.+), only array and closure are allowed/ + */ + public function testExpectsArgumentsArrayThrowsExceptionIfPassedWrongArgumentType() + { + $this->mock->shouldReceive('foo')->withArgs(5); + Mockery::close(); + } + + public function testExpectsArgumentsArrayAcceptAClosureThatValidatesPassedArguments() + { + $closure = function ($odd, $even) { + return ($odd % 2 != 0) && ($even % 2 == 0); + }; + $this->mock->shouldReceive('foo')->withArgs($closure); + $this->mock->foo(1, 2); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testExpectsArgumentsArrayThrowsExceptionWhenClosureEvaluatesToFalse() + { + $closure = function ($odd, $even) { + return ($odd % 2 != 0) && ($even % 2 == 0); + }; + $this->mock->shouldReceive('foo')->withArgs($closure); + $this->mock->foo(4, 2); + Mockery::close(); + } + + public function testExpectsArgumentsArrayClosureDoesNotThrowExceptionIfOptionalArgumentsAreMissing() + { + $closure = function ($odd, $even, $sum = null) { + $result = ($odd % 2 != 0) && ($even % 2 == 0); + if (!is_null($sum)) { + return $result && ($odd + $even == $sum); + } + return $result; + }; + $this->mock->shouldReceive('foo')->withArgs($closure); + $this->mock->foo(1, 4); + } + + public function testExpectsArgumentsArrayClosureDoesNotThrowExceptionIfOptionalArgumentsMathTheExpectation() + { + $closure = function ($odd, $even, $sum = null) { + $result = ($odd % 2 != 0) && ($even % 2 == 0); + if (!is_null($sum)) { + return $result && ($odd + $even == $sum); + } + return $result; + }; + $this->mock->shouldReceive('foo')->withArgs($closure); + $this->mock->foo(1, 4, 5); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testExpectsArgumentsArrayClosureThrowsExceptionIfOptionalArgumentsDontMatchTheExpectation() + { + $closure = function ($odd, $even, $sum = null) { + $result = ($odd % 2 != 0) && ($even % 2 == 0); + if (!is_null($sum)) { + return $result && ($odd + $even == $sum); + } + return $result; + }; + $this->mock->shouldReceive('foo')->withArgs($closure); + $this->mock->foo(1, 4, 2); + Mockery::close(); + } + + public function testExpectsAnyArguments() + { + $this->mock->shouldReceive('foo')->withAnyArgs(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 'k', new stdClass); + } + + public function testExpectsArgumentMatchingObjectType() + { + $this->mock->shouldReceive('foo')->with('\stdClass'); + $this->mock->foo(new stdClass); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testThrowsExceptionOnNoArgumentMatch() + { + $this->mock->shouldReceive('foo')->with(1); + $this->mock->foo(2); + Mockery::close(); + } + + public function testNeverCalled() + { + $this->mock->shouldReceive('foo')->never(); + } + + public function testShouldNotReceive() + { + $this->mock->shouldNotReceive('foo'); + } + + /** + * @expectedException \Mockery\Exception\InvalidCountException + */ + public function testShouldNotReceiveThrowsExceptionIfMethodCalled() + { + $this->mock->shouldNotReceive('foo'); + $this->mock->foo(); + Mockery::close(); + } + + /** + * @expectedException \Mockery\Exception\InvalidCountException + */ + public function testShouldNotReceiveWithArgumentThrowsExceptionIfMethodCalled() + { + $this->mock->shouldNotReceive('foo')->with(2); + $this->mock->foo(2); + Mockery::close(); + } + + /** + * @expectedException \Mockery\CountValidator\Exception + */ + public function testNeverCalledThrowsExceptionOnCall() + { + $this->mock->shouldReceive('foo')->never(); + $this->mock->foo(); + Mockery::close(); + } + + public function testCalledOnce() + { + $this->mock->shouldReceive('foo')->once(); + $this->mock->foo(); + } + + /** + * @expectedException \Mockery\CountValidator\Exception + */ + public function testCalledOnceThrowsExceptionIfNotCalled() + { + $this->mock->shouldReceive('foo')->once(); + Mockery::close(); + } + + /** + * @expectedException \Mockery\CountValidator\Exception + */ + public function testCalledOnceThrowsExceptionIfCalledTwice() + { + $this->mock->shouldReceive('foo')->once(); + $this->mock->foo(); + $this->mock->foo(); + Mockery::close(); + } + + public function testCalledTwice() + { + $this->mock->shouldReceive('foo')->twice(); + $this->mock->foo(); + $this->mock->foo(); + } + + /** + * @expectedException \Mockery\CountValidator\Exception + */ + public function testCalledTwiceThrowsExceptionIfNotCalled() + { + $this->mock->shouldReceive('foo')->twice(); + Mockery::close(); + } + + /** + * @expectedException \Mockery\CountValidator\Exception + */ + public function testCalledOnceThrowsExceptionIfCalledThreeTimes() + { + $this->mock->shouldReceive('foo')->twice(); + $this->mock->foo(); + $this->mock->foo(); + $this->mock->foo(); + Mockery::close(); + } + + public function testCalledZeroOrMoreTimesAtZeroCalls() + { + $this->mock->shouldReceive('foo')->zeroOrMoreTimes(); + } + + public function testCalledZeroOrMoreTimesAtThreeCalls() + { + $this->mock->shouldReceive('foo')->zeroOrMoreTimes(); + $this->mock->foo(); + $this->mock->foo(); + $this->mock->foo(); + } + + public function testTimesCountCalls() + { + $this->mock->shouldReceive('foo')->times(4); + $this->mock->foo(); + $this->mock->foo(); + $this->mock->foo(); + $this->mock->foo(); + } + + /** + * @expectedException \Mockery\CountValidator\Exception + */ + public function testTimesCountCallThrowsExceptionOnTooFewCalls() + { + $this->mock->shouldReceive('foo')->times(2); + $this->mock->foo(); + Mockery::close(); + } + + /** + * @expectedException \Mockery\CountValidator\Exception + */ + public function testTimesCountCallThrowsExceptionOnTooManyCalls() + { + $this->mock->shouldReceive('foo')->times(2); + $this->mock->foo(); + $this->mock->foo(); + $this->mock->foo(); + Mockery::close(); + } + + public function testCalledAtLeastOnceAtExactlyOneCall() + { + $this->mock->shouldReceive('foo')->atLeast()->once(); + $this->mock->foo(); + } + + public function testCalledAtLeastOnceAtExactlyThreeCalls() + { + $this->mock->shouldReceive('foo')->atLeast()->times(3); + $this->mock->foo(); + $this->mock->foo(); + $this->mock->foo(); + } + + /** + * @expectedException \Mockery\CountValidator\Exception + */ + public function testCalledAtLeastThrowsExceptionOnTooFewCalls() + { + $this->mock->shouldReceive('foo')->atLeast()->twice(); + $this->mock->foo(); + Mockery::close(); + } + + public function testCalledAtMostOnceAtExactlyOneCall() + { + $this->mock->shouldReceive('foo')->atMost()->once(); + $this->mock->foo(); + } + + public function testCalledAtMostAtExactlyThreeCalls() + { + $this->mock->shouldReceive('foo')->atMost()->times(3); + $this->mock->foo(); + $this->mock->foo(); + $this->mock->foo(); + } + + /** + * @expectedException \Mockery\CountValidator\Exception + */ + public function testCalledAtLeastThrowsExceptionOnTooManyCalls() + { + $this->mock->shouldReceive('foo')->atMost()->twice(); + $this->mock->foo(); + $this->mock->foo(); + $this->mock->foo(); + Mockery::close(); + } + + /** + * @expectedException \Mockery\CountValidator\Exception + */ + public function testExactCountersOverrideAnyPriorSetNonExactCounters() + { + $this->mock->shouldReceive('foo')->atLeast()->once()->once(); + $this->mock->foo(); + $this->mock->foo(); + Mockery::close(); + } + + public function testComboOfLeastAndMostCallsWithOneCall() + { + $this->mock->shouldReceive('foo')->atleast()->once()->atMost()->twice(); + $this->mock->foo(); + } + + public function testComboOfLeastAndMostCallsWithTwoCalls() + { + $this->mock->shouldReceive('foo')->atleast()->once()->atMost()->twice(); + $this->mock->foo(); + $this->mock->foo(); + } + + /** + * @expectedException \Mockery\CountValidator\Exception + */ + public function testComboOfLeastAndMostCallsThrowsExceptionAtTooFewCalls() + { + $this->mock->shouldReceive('foo')->atleast()->once()->atMost()->twice(); + Mockery::close(); + } + + /** + * @expectedException \Mockery\CountValidator\Exception + */ + public function testComboOfLeastAndMostCallsThrowsExceptionAtTooManyCalls() + { + $this->mock->shouldReceive('foo')->atleast()->once()->atMost()->twice(); + $this->mock->foo(); + $this->mock->foo(); + $this->mock->foo(); + Mockery::close(); + } + + public function testCallCountingOnlyAppliesToMatchedExpectations() + { + $this->mock->shouldReceive('foo')->with(1)->once(); + $this->mock->shouldReceive('foo')->with(2)->twice(); + $this->mock->shouldReceive('foo')->with(3); + $this->mock->foo(1); + $this->mock->foo(2); + $this->mock->foo(2); + $this->mock->foo(3); + } + + /** + * @expectedException \Mockery\CountValidator\Exception + */ + public function testCallCountingThrowsExceptionOnAnyMismatch() + { + $this->mock->shouldReceive('foo')->with(1)->once(); + $this->mock->shouldReceive('foo')->with(2)->twice(); + $this->mock->shouldReceive('foo')->with(3); + $this->mock->shouldReceive('bar'); + $this->mock->foo(1); + $this->mock->foo(2); + $this->mock->foo(3); + $this->mock->bar(); + Mockery::close(); + } + + /** + * @expectedException \Mockery\Exception\InvalidCountException + */ + public function testCallCountingThrowsExceptionFirst() + { + $number_of_calls = 0; + $this->mock->shouldReceive('foo') + ->times(2) + ->with(\Mockery::on(function ($argument) use (&$number_of_calls) { + $number_of_calls++; + return $number_of_calls <= 3; + })); + + $this->mock->foo(1); + $this->mock->foo(1); + $this->mock->foo(1); + Mockery::close(); + } + + public function testOrderedCallsWithoutError() + { + $this->mock->shouldReceive('foo')->ordered(); + $this->mock->shouldReceive('bar')->ordered(); + $this->mock->foo(); + $this->mock->bar(); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testOrderedCallsWithOutOfOrderError() + { + $this->mock->shouldReceive('foo')->ordered(); + $this->mock->shouldReceive('bar')->ordered(); + $this->mock->bar(); + $this->mock->foo(); + Mockery::close(); + } + + public function testDifferentArgumentsAndOrderingsPassWithoutException() + { + $this->mock->shouldReceive('foo')->with(1)->ordered(); + $this->mock->shouldReceive('foo')->with(2)->ordered(); + $this->mock->foo(1); + $this->mock->foo(2); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testDifferentArgumentsAndOrderingsThrowExceptionWhenInWrongOrder() + { + $this->mock->shouldReceive('foo')->with(1)->ordered(); + $this->mock->shouldReceive('foo')->with(2)->ordered(); + $this->mock->foo(2); + $this->mock->foo(1); + Mockery::close(); + } + + public function testUnorderedCallsIgnoredForOrdering() + { + $this->mock->shouldReceive('foo')->with(1)->ordered(); + $this->mock->shouldReceive('foo')->with(2); + $this->mock->shouldReceive('foo')->with(3)->ordered(); + $this->mock->foo(2); + $this->mock->foo(1); + $this->mock->foo(2); + $this->mock->foo(3); + $this->mock->foo(2); + } + + public function testOrderingOfDefaultGrouping() + { + $this->mock->shouldReceive('foo')->ordered(); + $this->mock->shouldReceive('bar')->ordered(); + $this->mock->foo(); + $this->mock->bar(); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testOrderingOfDefaultGroupingThrowsExceptionOnWrongOrder() + { + $this->mock->shouldReceive('foo')->ordered(); + $this->mock->shouldReceive('bar')->ordered(); + $this->mock->bar(); + $this->mock->foo(); + Mockery::close(); + } + + public function testOrderingUsingNumberedGroups() + { + $this->mock->shouldReceive('start')->ordered(1); + $this->mock->shouldReceive('foo')->ordered(2); + $this->mock->shouldReceive('bar')->ordered(2); + $this->mock->shouldReceive('final')->ordered(); + $this->mock->start(); + $this->mock->bar(); + $this->mock->foo(); + $this->mock->bar(); + $this->mock->final(); + } + + public function testOrderingUsingNamedGroups() + { + $this->mock->shouldReceive('start')->ordered('start'); + $this->mock->shouldReceive('foo')->ordered('foobar'); + $this->mock->shouldReceive('bar')->ordered('foobar'); + $this->mock->shouldReceive('final')->ordered(); + $this->mock->start(); + $this->mock->bar(); + $this->mock->foo(); + $this->mock->bar(); + $this->mock->final(); + } + + /** + * @group 2A + */ + public function testGroupedUngroupedOrderingDoNotOverlap() + { + $s = $this->mock->shouldReceive('start')->ordered(); + $m = $this->mock->shouldReceive('mid')->ordered('foobar'); + $e = $this->mock->shouldReceive('end')->ordered(); + $this->assertLessThan($m->getOrderNumber(), $s->getOrderNumber()); + $this->assertLessThan($e->getOrderNumber(), $m->getOrderNumber()); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testGroupedOrderingThrowsExceptionWhenCallsDisordered() + { + $this->mock->shouldReceive('foo')->ordered('first'); + $this->mock->shouldReceive('bar')->ordered('second'); + $this->mock->bar(); + $this->mock->foo(); + Mockery::close(); + } + + public function testExpectationMatchingWithNoArgsOrderings() + { + $this->mock->shouldReceive('foo')->withNoArgs()->once()->ordered(); + $this->mock->shouldReceive('bar')->withNoArgs()->once()->ordered(); + $this->mock->shouldReceive('foo')->withNoArgs()->once()->ordered(); + $this->mock->foo(); + $this->mock->bar(); + $this->mock->foo(); + } + + public function testExpectationMatchingWithAnyArgsOrderings() + { + $this->mock->shouldReceive('foo')->withAnyArgs()->once()->ordered(); + $this->mock->shouldReceive('bar')->withAnyArgs()->once()->ordered(); + $this->mock->shouldReceive('foo')->withAnyArgs()->once()->ordered(); + $this->mock->foo(); + $this->mock->bar(); + $this->mock->foo(); + } + + public function testEnsuresOrderingIsNotCrossMockByDefault() + { + $this->mock->shouldReceive('foo')->ordered(); + $mock2 = mock('bar'); + $mock2->shouldReceive('bar')->ordered(); + $mock2->bar(); + $this->mock->foo(); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testEnsuresOrderingIsCrossMockWhenGloballyFlagSet() + { + $this->mock->shouldReceive('foo')->globally()->ordered(); + $mock2 = mock('bar'); + $mock2->shouldReceive('bar')->globally()->ordered(); + $mock2->bar(); + $this->mock->foo(); + Mockery::close(); + } + + public function testExpectationCastToStringFormatting() + { + $exp = $this->mock->shouldReceive('foo')->with(1, 'bar', new stdClass, array('Spam' => 'Ham', 'Bar' => 'Baz')); + $this->assertEquals("[foo(1, 'bar', object(stdClass), ['Spam' => 'Ham', 'Bar' => 'Baz'])]", (string) $exp); + } + + public function testLongExpectationCastToStringFormatting() + { + $exp = $this->mock->shouldReceive('foo')->with(array('Spam' => 'Ham', 'Bar' => 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'Bar', 'Baz', 'End')); + $this->assertEquals("[foo(['Spam' => 'Ham', 'Bar' => 'Baz', 0 => 'Bar', 1 => 'Baz', 2 => 'Bar', 3 => 'Baz', 4 => 'Bar', 5 => 'Baz', 6 => 'Bar', 7 => 'Baz', 8 => 'Bar', 9 => 'Baz', 10 => 'Bar', 11 => 'Baz', 12 => 'Bar', 13 => 'Baz', 14 => 'Bar', 15 => 'Baz', 16 => 'Bar', 17 => 'Baz', 18 => 'Bar', 19 => 'Baz', 20 => 'Bar', 21 => 'Baz', 22 => 'Bar', 23 => 'Baz', 24 => 'Bar', 25 => 'Baz', 26 => 'Bar', 27 => 'Baz', 28 => 'Bar', 29 => 'Baz', 30 => 'Bar', 31 => 'Baz', 32 => 'Bar', 33 => 'Baz', 34 => 'Bar', 35 => 'Baz', 36 => 'Bar', 37 => 'Baz', 38 => 'Bar', 39 => 'Baz', 40 => 'Bar', 41 => 'Baz', 42 => 'Bar', 43 => 'Baz', 44 => 'Bar', 45 => 'Baz', 46 => 'Baz', 47 => 'Bar', 48 => 'Baz', 49 => 'Bar', 50 => 'Baz', 51 => 'Bar', 52 => 'Baz', 53 => 'Bar', 54 => 'Baz', 55 => 'Bar', 56 => 'Baz', 57 => 'Baz', 58 => 'Bar', 59 => 'Baz', 60 => 'Bar', 61 => 'Baz', 62 => 'Bar', 63 => 'Baz', 64 => 'Bar', 65 => 'Baz', 66 => 'Bar', 67 => 'Baz', 68 => 'Baz', 69 => 'Bar', 70 => 'Baz', 71 => 'Bar', 72 => 'Baz', 73 => 'Bar', 74 => 'Baz', 7...])]", (string) $exp); + } + + public function testMultipleExpectationCastToStringFormatting() + { + $exp = $this->mock->shouldReceive('foo', 'bar')->with(1); + $this->assertEquals('[foo(1), bar(1)]', (string) $exp); + } + + public function testGroupedOrderingWithLimitsAllowsMultipleReturnValues() + { + $this->mock->shouldReceive('foo')->with(2)->once()->andReturn('first'); + $this->mock->shouldReceive('foo')->with(2)->twice()->andReturn('second/third'); + $this->mock->shouldReceive('foo')->with(2)->andReturn('infinity'); + $this->assertEquals('first', $this->mock->foo(2)); + $this->assertEquals('second/third', $this->mock->foo(2)); + $this->assertEquals('second/third', $this->mock->foo(2)); + $this->assertEquals('infinity', $this->mock->foo(2)); + $this->assertEquals('infinity', $this->mock->foo(2)); + $this->assertEquals('infinity', $this->mock->foo(2)); + } + + public function testExpectationsCanBeMarkedAsDefaults() + { + $this->mock->shouldReceive('foo')->andReturn('bar')->byDefault(); + $this->assertEquals('bar', $this->mock->foo()); + } + + public function testDefaultExpectationsValidatedInCorrectOrder() + { + $this->mock->shouldReceive('foo')->with(1)->once()->andReturn('first')->byDefault(); + $this->mock->shouldReceive('foo')->with(2)->once()->andReturn('second')->byDefault(); + $this->assertEquals('first', $this->mock->foo(1)); + $this->assertEquals('second', $this->mock->foo(2)); + } + + public function testDefaultExpectationsAreReplacedByLaterConcreteExpectations() + { + $this->mock->shouldReceive('foo')->andReturn('bar')->once()->byDefault(); + $this->mock->shouldReceive('foo')->andReturn('baz')->twice(); + $this->assertEquals('baz', $this->mock->foo()); + $this->assertEquals('baz', $this->mock->foo()); + } + + public function testExpectationFallsBackToDefaultExpectationWhenConcreteExpectationsAreUsedUp() + { + $this->mock->shouldReceive('foo')->with(1)->andReturn('bar')->once()->byDefault(); + $this->mock->shouldReceive('foo')->with(2)->andReturn('baz')->once(); + $this->assertEquals('baz', $this->mock->foo(2)); + $this->assertEquals('bar', $this->mock->foo(1)); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testDefaultExpectationsCanBeOrdered() + { + $this->mock->shouldReceive('foo')->ordered()->byDefault(); + $this->mock->shouldReceive('bar')->ordered()->byDefault(); + $this->mock->bar(); + $this->mock->foo(); + Mockery::close(); + } + + public function testDefaultExpectationsCanBeOrderedAndReplaced() + { + $this->mock->shouldReceive('foo')->ordered()->byDefault(); + $this->mock->shouldReceive('bar')->ordered()->byDefault(); + $this->mock->shouldReceive('bar')->ordered(); + $this->mock->shouldReceive('foo')->ordered(); + $this->mock->bar(); + $this->mock->foo(); + } + + public function testByDefaultOperatesFromMockConstruction() + { + $container = new \Mockery\Container(\Mockery::getDefaultGenerator(), \Mockery::getDefaultLoader()); + $mock = $container->mock('f', array('foo'=>'rfoo', 'bar'=>'rbar', 'baz'=>'rbaz'))->byDefault(); + $mock->shouldReceive('foo')->andReturn('foobar'); + $this->assertEquals('foobar', $mock->foo()); + $this->assertEquals('rbar', $mock->bar()); + $this->assertEquals('rbaz', $mock->baz()); + } + + public function testByDefaultOnAMockDoesSquatWithoutExpectations() + { + $this->assertInstanceOf(MockInterface::class, mock('f')->byDefault()); + } + + public function testDefaultExpectationsCanBeOverridden() + { + $this->mock->shouldReceive('foo')->with('test')->andReturn('bar')->byDefault(); + $this->mock->shouldReceive('foo')->with('test')->andReturn('newbar')->byDefault(); + $this->mock->foo('test'); + $this->assertEquals('newbar', $this->mock->foo('test')); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testByDefaultPreventedFromSettingDefaultWhenDefaultingExpectationWasReplaced() + { + $exp = $this->mock->shouldReceive('foo')->andReturn(1); + $this->mock->shouldReceive('foo')->andReturn(2); + $exp->byDefault(); + Mockery::close(); + } + + /** + * Argument Constraint Tests + */ + + public function testAnyConstraintMatchesAnyArg() + { + $this->mock->shouldReceive('foo')->with(1, Mockery::any())->twice(); + $this->mock->foo(1, 2); + $this->mock->foo(1, 'str'); + } + + public function testAnyConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::any())->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + public function testAndAnyOtherConstraintMatchesTheRestOfTheArguments() + { + $this->mock->shouldReceive('foo')->with(1, 2, Mockery::andAnyOthers())->twice(); + $this->mock->foo(1, 2, 3, 4, 5); + $this->mock->foo(1, 'str', 3, 4); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testAndAnyOtherConstraintDoesNotPreventMatchingOfRegularArguments() + { + $this->mock->shouldReceive('foo')->with(1, 2, Mockery::andAnyOthers()); + $this->mock->foo(10, 2, 3, 4, 5); + Mockery::close(); + } + + public function testArrayConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('array'))->once(); + $this->mock->foo(array()); + } + + public function testArrayConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::type('array'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testArrayConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('array')); + $this->mock->foo(1); + Mockery::close(); + } + + public function testBoolConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('bool'))->once(); + $this->mock->foo(true); + } + + public function testBoolConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::type('bool'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testBoolConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('bool')); + $this->mock->foo(1); + Mockery::close(); + } + + public function testCallableConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('callable'))->once(); + $this->mock->foo(function () { + return 'f'; + }); + } + + public function testCallableConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::type('callable'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testCallableConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('callable')); + $this->mock->foo(1); + Mockery::close(); + } + + public function testDoubleConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('double'))->once(); + $this->mock->foo(2.25); + } + + public function testDoubleConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::type('double'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testDoubleConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('double')); + $this->mock->foo(1); + Mockery::close(); + } + + public function testFloatConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('float'))->once(); + $this->mock->foo(2.25); + } + + public function testFloatConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::type('float'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testFloatConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('float')); + $this->mock->foo(1); + Mockery::close(); + } + + public function testIntConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('int'))->once(); + $this->mock->foo(2); + } + + public function testIntConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::type('int'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testIntConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('int')); + $this->mock->foo('f'); + Mockery::close(); + } + + public function testLongConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('long'))->once(); + $this->mock->foo(2); + } + + public function testLongConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::type('long'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testLongConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('long')); + $this->mock->foo('f'); + Mockery::close(); + } + + public function testNullConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('null'))->once(); + $this->mock->foo(null); + } + + public function testNullConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::type('null'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testNullConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('null')); + $this->mock->foo('f'); + Mockery::close(); + } + + public function testNumericConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('numeric'))->once(); + $this->mock->foo('2'); + } + + public function testNumericConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::type('numeric'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testNumericConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('numeric')); + $this->mock->foo('f'); + Mockery::close(); + } + + public function testObjectConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('object'))->once(); + $this->mock->foo(new stdClass); + } + + public function testObjectConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::type('object`'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testObjectConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('object')); + $this->mock->foo('f'); + Mockery::close(); + } + + public function testRealConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('real'))->once(); + $this->mock->foo(2.25); + } + + public function testRealConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::type('real'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testRealConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('real')); + $this->mock->foo('f'); + Mockery::close(); + } + + public function testResourceConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('resource'))->once(); + $r = fopen(dirname(__FILE__) . '/_files/file.txt', 'r'); + $this->mock->foo($r); + } + + public function testResourceConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::type('resource'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testResourceConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('resource')); + $this->mock->foo('f'); + Mockery::close(); + } + + public function testScalarConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('scalar'))->once(); + $this->mock->foo(2); + } + + public function testScalarConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::type('scalar'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testScalarConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('scalar')); + $this->mock->foo(array()); + Mockery::close(); + } + + public function testStringConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('string'))->once(); + $this->mock->foo('2'); + } + + public function testStringConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::type('string'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testStringConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('string')); + $this->mock->foo(1); + Mockery::close(); + } + + public function testClassConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('stdClass'))->once(); + $this->mock->foo(new stdClass); + } + + public function testClassConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::type('stdClass'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testClassConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::type('stdClass')); + $this->mock->foo(new Exception); + Mockery::close(); + } + + public function testDucktypeConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::ducktype('quack', 'swim'))->once(); + $this->mock->foo(new Mockery_Duck); + } + + public function testDucktypeConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::ducktype('quack', 'swim'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testDucktypeConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::ducktype('quack', 'swim')); + $this->mock->foo(new Mockery_Duck_Nonswimmer); + Mockery::close(); + } + + public function testArrayContentConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::subset(array('a'=>1, 'b'=>2)))->once(); + $this->mock->foo(array('a'=>1, 'b'=>2, 'c'=>3)); + } + + public function testArrayContentConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::subset(array('a'=>1, 'b'=>2)))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testArrayContentConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::subset(array('a'=>1, 'b'=>2))); + $this->mock->foo(array('a'=>1, 'c'=>3)); + Mockery::close(); + } + + public function testContainsConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::contains(1, 2))->once(); + $this->mock->foo(array('a'=>1, 'b'=>2, 'c'=>3)); + } + + public function testContainsConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::contains(1, 2))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testContainsConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::contains(1, 2)); + $this->mock->foo(array('a'=>1, 'c'=>3)); + Mockery::close(); + } + + public function testHasKeyConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::hasKey('c'))->once(); + $this->mock->foo(array('a'=>1, 'b'=>2, 'c'=>3)); + } + + public function testHasKeyConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::hasKey('a'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, array('a'=>1), 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testHasKeyConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::hasKey('c')); + $this->mock->foo(array('a'=>1, 'b'=>3)); + Mockery::close(); + } + + public function testHasValueConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::hasValue(1))->once(); + $this->mock->foo(array('a'=>1, 'b'=>2, 'c'=>3)); + } + + public function testHasValueConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::hasValue(1))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, array('a'=>1), 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testHasValueConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::hasValue(2)); + $this->mock->foo(array('a'=>1, 'b'=>3)); + Mockery::close(); + } + + public function testOnConstraintMatchesArgument_ClosureEvaluatesToTrue() + { + $function = function ($arg) { + return $arg % 2 == 0; + }; + $this->mock->shouldReceive('foo')->with(Mockery::on($function))->once(); + $this->mock->foo(4); + } + + public function testOnConstraintMatchesArgumentOfTypeArray_ClosureEvaluatesToTrue() + { + $function = function ($arg) { + return is_array($arg); + }; + $this->mock->shouldReceive('foo')->with(Mockery::on($function))->once(); + $this->mock->foo([4, 5]); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testOnConstraintThrowsExceptionWhenConstraintUnmatched_ClosureEvaluatesToFalse() + { + $function = function ($arg) { + return $arg % 2 == 0; + }; + $this->mock->shouldReceive('foo')->with(Mockery::on($function)); + $this->mock->foo(5); + Mockery::close(); + } + + public function testMustBeConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::mustBe(2))->once(); + $this->mock->foo(2); + } + + public function testMustBeConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::mustBe(2))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testMustBeConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::mustBe(2)); + $this->mock->foo('2'); + Mockery::close(); + } + + public function testMustBeConstraintMatchesObjectArgumentWithEqualsComparisonNotIdentical() + { + $a = new stdClass; + $a->foo = 1; + $b = new stdClass; + $b->foo = 1; + $this->mock->shouldReceive('foo')->with(Mockery::mustBe($a))->once(); + $this->mock->foo($b); + } + + public function testMustBeConstraintNonMatchingCaseWithObject() + { + $a = new stdClass; + $a->foo = 1; + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::mustBe($a))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, $a, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testMustBeConstraintThrowsExceptionWhenConstraintUnmatchedWithObject() + { + $a = new stdClass; + $a->foo = 1; + $b = new stdClass; + $b->foo = 2; + $this->mock->shouldReceive('foo')->with(Mockery::mustBe($a)); + $this->mock->foo($b); + Mockery::close(); + } + + public function testMatchPrecedenceBasedOnExpectedCallsFavouringExplicitMatch() + { + $this->mock->shouldReceive('foo')->with(1)->once(); + $this->mock->shouldReceive('foo')->with(Mockery::any())->never(); + $this->mock->foo(1); + } + + public function testMatchPrecedenceBasedOnExpectedCallsFavouringAnyMatch() + { + $this->mock->shouldReceive('foo')->with(Mockery::any())->once(); + $this->mock->shouldReceive('foo')->with(1)->never(); + $this->mock->foo(1); + } + + public function testReturnNullIfIgnoreMissingMethodsSet() + { + $this->mock->shouldIgnoreMissing(); + $this->assertNull($this->mock->g(1, 2)); + } + + public function testReturnUndefinedIfIgnoreMissingMethodsSet() + { + $this->mock->shouldIgnoreMissing()->asUndefined(); + $this->assertInstanceOf(\Mockery\Undefined::class, $this->mock->g(1, 2)); + } + + public function testReturnAsUndefinedAllowsForInfiniteSelfReturningChain() + { + $this->mock->shouldIgnoreMissing()->asUndefined(); + $this->assertInstanceOf(\Mockery\Undefined::class, $this->mock->g(1, 2)->a()->b()->c()); + } + + public function testShouldIgnoreMissingFluentInterface() + { + $this->assertInstanceOf(\Mockery\MockInterface::class, $this->mock->shouldIgnoreMissing()); + } + + public function testShouldIgnoreMissingAsUndefinedFluentInterface() + { + $this->assertInstanceOf(\Mockery\MockInterface::class, $this->mock->shouldIgnoreMissing()->asUndefined()); + } + + public function testShouldIgnoreMissingAsDefinedProxiesToUndefinedAllowingToString() + { + $this->mock->shouldIgnoreMissing()->asUndefined(); + $this->assertInternalType('string', "{$this->mock->g()}"); + $this->assertInternalType('string', "{$this->mock}"); + } + + public function testShouldIgnoreMissingDefaultReturnValue() + { + $this->mock->shouldIgnoreMissing(1); + $this->assertEquals(1, $this->mock->a()); + } + + /** @issue #253 */ + public function testShouldIgnoreMissingDefaultSelfAndReturnsSelf() + { + $this->mock->shouldIgnoreMissing(\Mockery::self()); + $this->assertSame($this->mock, $this->mock->a()->b()); + } + + public function testToStringMagicMethodCanBeMocked() + { + $this->mock->shouldReceive("__toString")->andReturn('dave'); + $this->assertEquals("{$this->mock}", "dave"); + } + + public function testOptionalMockRetrieval() + { + $m = mock('f')->shouldReceive('foo')->with(1)->andReturn(3)->mock(); + $this->assertInstanceOf(\Mockery\MockInterface::class, $m); + } + + public function testNotConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::not(1))->once(); + $this->mock->foo(2); + } + + public function testNotConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::not(2))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testNotConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::not(2)); + $this->mock->foo(2); + Mockery::close(); + } + + public function testAnyOfConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::anyOf(1, 2))->twice(); + $this->mock->foo(2); + $this->mock->foo(1); + } + + public function testAnyOfConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::anyOf(1, 2))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testAnyOfConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::anyOf(1, 2)); + $this->mock->foo(3); + Mockery::close(); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testAnyOfConstraintThrowsExceptionWhenTrueIsNotAnExpectedArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::anyOf(1, 2)); + $this->mock->foo(true); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testAnyOfConstraintThrowsExceptionWhenFalseIsNotAnExpectedArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::anyOf(0, 1, 2)); + $this->mock->foo(false); + } + + public function testNotAnyOfConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::notAnyOf(1, 2))->once(); + $this->mock->foo(3); + } + + public function testNotAnyOfConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); + $this->mock->shouldReceive('foo')->with(1, Mockery::notAnyOf(1, 2))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 4, 3); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testNotAnyOfConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::notAnyOf(1, 2)); + $this->mock->foo(2); + Mockery::close(); + } + + public function testPatternConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(Mockery::pattern('/foo.*/'))->once(); + $this->mock->foo('foobar'); + } + + public function testPatternConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->once(); + $this->mock->shouldReceive('foo')->with(Mockery::pattern('/foo.*/'))->never(); + $this->mock->foo('bar'); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testPatternConstraintThrowsExceptionWhenConstraintUnmatched() + { + $this->mock->shouldReceive('foo')->with(Mockery::pattern('/foo.*/')); + $this->mock->foo('bar'); + Mockery::close(); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testGlobalConfigMayForbidMockingNonExistentMethodsOnClasses() + { + \Mockery::getConfiguration()->allowMockingNonExistentMethods(false); + $mock = mock('stdClass'); + $mock->shouldReceive('foo'); + Mockery::close(); + } + + /** + * @expectedException \Mockery\Exception + * @expectedExceptionMessage Mockery can't find 'SomeMadeUpClass' so can't mock it + */ + public function testGlobalConfigMayForbidMockingNonExistentMethodsOnAutoDeclaredClasses() + { + \Mockery::getConfiguration()->allowMockingNonExistentMethods(false); + $mock = mock('SomeMadeUpClass'); + $mock->shouldReceive('foo'); + Mockery::close(); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testGlobalConfigMayForbidMockingNonExistentMethodsOnObjects() + { + \Mockery::getConfiguration()->allowMockingNonExistentMethods(false); + $mock = mock(new stdClass); + $mock->shouldReceive('foo'); + Mockery::close(); + } + + public function testAnExampleWithSomeExpectationAmends() + { + $service = mock('MyService'); + $service->shouldReceive('login')->with('user', 'pass')->once()->andReturn(true); + $service->shouldReceive('hasBookmarksTagged')->with('php')->once()->andReturn(false); + $service->shouldReceive('addBookmark')->with(Mockery::pattern('/^http:/'), \Mockery::type('string'))->times(3)->andReturn(true); + $service->shouldReceive('hasBookmarksTagged')->with('php')->once()->andReturn(true); + + $this->assertTrue($service->login('user', 'pass')); + $this->assertFalse($service->hasBookmarksTagged('php')); + $this->assertTrue($service->addBookmark('http://example.com/1', 'some_tag1')); + $this->assertTrue($service->addBookmark('http://example.com/2', 'some_tag2')); + $this->assertTrue($service->addBookmark('http://example.com/3', 'some_tag3')); + $this->assertTrue($service->hasBookmarksTagged('php')); + } + + public function testAnExampleWithSomeExpectationAmendsOnCallCounts() + { + $service = mock('MyService'); + $service->shouldReceive('login')->with('user', 'pass')->once()->andReturn(true); + $service->shouldReceive('hasBookmarksTagged')->with('php')->once()->andReturn(false); + $service->shouldReceive('addBookmark')->with(Mockery::pattern('/^http:/'), \Mockery::type('string'))->times(3)->andReturn(true); + $service->shouldReceive('hasBookmarksTagged')->with('php')->twice()->andReturn(true); + + $this->assertTrue($service->login('user', 'pass')); + $this->assertFalse($service->hasBookmarksTagged('php')); + $this->assertTrue($service->addBookmark('http://example.com/1', 'some_tag1')); + $this->assertTrue($service->addBookmark('http://example.com/2', 'some_tag2')); + $this->assertTrue($service->addBookmark('http://example.com/3', 'some_tag3')); + $this->assertTrue($service->hasBookmarksTagged('php')); + $this->assertTrue($service->hasBookmarksTagged('php')); + } + + public function testAnExampleWithSomeExpectationAmendsOnCallCounts_PHPUnitTest() + { + $service = $this->createMock('MyService2'); + $service->expects($this->once())->method('login')->with('user', 'pass')->will($this->returnValue(true)); + $service->expects($this->exactly(3))->method('hasBookmarksTagged')->with('php') + ->will($this->onConsecutiveCalls(false, true, true)); + $service->expects($this->exactly(3))->method('addBookmark') + ->with($this->matchesRegularExpression('/^http:/'), $this->isType('string')) + ->will($this->returnValue(true)); + + $this->assertTrue($service->login('user', 'pass')); + $this->assertFalse($service->hasBookmarksTagged('php')); + $this->assertTrue($service->addBookmark('http://example.com/1', 'some_tag1')); + $this->assertTrue($service->addBookmark('http://example.com/2', 'some_tag2')); + $this->assertTrue($service->addBookmark('http://example.com/3', 'some_tag3')); + $this->assertTrue($service->hasBookmarksTagged('php')); + $this->assertTrue($service->hasBookmarksTagged('php')); + } + + public function testMockedMethodsCallableFromWithinOriginalClass() + { + $mock = mock('MockeryTest_InterMethod1[doThird]'); + $mock->shouldReceive('doThird')->andReturn(true); + $this->assertTrue($mock->doFirst()); + } + + /** + * @group issue #20 + */ + public function testMockingDemeterChainsPassesMockeryExpectationToCompositeExpectation() + { + $mock = mock('Mockery_Demeterowski'); + $mock->shouldReceive('foo->bar->baz')->andReturn('Spam!'); + $demeter = new Mockery_UseDemeter($mock); + $this->assertSame('Spam!', $demeter->doit()); + } + + /** + * @group issue #20 - with args in demeter chain + */ + public function testMockingDemeterChainsPassesMockeryExpectationToCompositeExpectationWithArgs() + { + $mock = mock('Mockery_Demeterowski'); + $mock->shouldReceive('foo->bar->baz')->andReturn('Spam!'); + $demeter = new Mockery_UseDemeter($mock); + $this->assertSame('Spam!', $demeter->doitWithArgs()); + } + + public function testShouldNotReceiveCanBeAddedToCompositeExpectation() + { + $mock = mock('Foo'); + $mock->shouldReceive('a')->once()->andReturn('Spam!') + ->shouldNotReceive('b'); + $mock->a(); + } + + public function testPassthruEnsuresRealMethodCalledForReturnValues() + { + $mock = mock('MockeryTest_SubjectCall1'); + $mock->shouldReceive('foo')->once()->passthru(); + $this->assertEquals('bar', $mock->foo()); + } + + public function testShouldIgnoreMissingExpectationBasedOnArgs() + { + $mock = mock("MyService2")->shouldIgnoreMissing(); + $mock->shouldReceive("hasBookmarksTagged")->with("dave")->once(); + $mock->hasBookmarksTagged("dave"); + $mock->hasBookmarksTagged("padraic"); + } + + public function testMakePartialExpectationBasedOnArgs() + { + $mock = mock("MockeryTest_SubjectCall1")->makePartial(); + + $this->assertEquals('bar', $mock->foo()); + $this->assertEquals('bar', $mock->foo("baz")); + $this->assertEquals('bar', $mock->foo("qux")); + + $mock->shouldReceive("foo")->with("baz")->twice()->andReturn('123'); + $this->assertEquals('bar', $mock->foo()); + $this->assertEquals('123', $mock->foo("baz")); + $this->assertEquals('bar', $mock->foo("qux")); + + $mock->shouldReceive("foo")->withNoArgs()->once()->andReturn('456'); + $this->assertEquals('456', $mock->foo()); + $this->assertEquals('123', $mock->foo("baz")); + $this->assertEquals('bar', $mock->foo("qux")); + } + + public function testCanReturnSelf() + { + $this->mock->shouldReceive("foo")->andReturnSelf(); + $this->assertSame($this->mock, $this->mock->foo()); + } + + public function testReturnsTrueIfTrueIsReturnValue() + { + $this->mock->shouldReceive("foo")->andReturnTrue(); + $this->assertTrue($this->mock->foo()); + } + + public function testReturnsFalseIfFalseIsReturnValue() + { + $this->mock->shouldReceive("foo")->andReturnFalse(); + $this->assertFalse($this->mock->foo()); + } + + public function testExpectationCanBeOverridden() + { + $this->mock->shouldReceive('foo')->once()->andReturn('green'); + $this->mock->shouldReceive('foo')->andReturn('blue'); + $this->assertEquals($this->mock->foo(), 'green'); + $this->assertEquals($this->mock->foo(), 'blue'); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testTimesExpectationForbidsFloatNumbers() + { + $this->mock->shouldReceive('foo')->times(1.3); + Mockery::close(); + } + + public function testIfExceptionIndicatesAbsenceOfMethodAndExpectationsOnMock() + { + $mock = mock('Mockery_Duck'); + + $this->expectException( + '\BadMethodCallException', + 'Method ' . get_class($mock) . + '::nonExistent() does not exist on this mock object' + ); + + $mock->nonExistent(); + Mockery::close(); + } + + public function testIfCallingMethodWithNoExpectationsHasSpecificExceptionMessage() + { + $mock = mock('Mockery_Duck'); + + $this->expectException( + '\BadMethodCallException', + 'Received ' . get_class($mock) . + '::quack(), ' . 'but no expectations were specified' + ); + + $mock->quack(); + Mockery::close(); + } + + public function testMockShouldNotBeAnonymousWhenImplementingSpecificInterface() + { + $waterMock = mock('IWater'); + $this->assertFalse($waterMock->mockery_isAnonymous()); + } + + /** + * @expectedException \Mockery\Exception + */ + public function testWetherMockWithInterfaceOnlyCanNotImplementNonExistingMethods() + { + \Mockery::getConfiguration()->allowMockingNonExistentMethods(false); + $waterMock = \Mockery::mock('IWater'); + $waterMock + ->shouldReceive('nonExistentMethod') + ->once() + ->andReturnNull(); + \Mockery::close(); + } + + public function testCountWithBecauseExceptionMessage() + { + $this->expectException(InvalidCountException::class); + $this->expectExceptionMessageRegexp( + '/Method foo\(\) from Mockery_[\d]+ should be called' . PHP_EOL . ' ' . + 'exactly 1 times but called 0 times. Because We like foo/' + ); + + $this->mock->shouldReceive('foo')->once()->because('We like foo'); + Mockery::close(); + } + + /** @test */ + public function it_uses_a_matchers_to_string_method_in_the_exception_output() + { + $mock = Mockery::mock(); + + $mock->expects()->foo(Mockery::hasKey('foo')); + + $this->expectException( + InvalidCountException::class, + "Method foo()" + ); + + Mockery::close(); + } +} + +interface IWater +{ + public function dry(); +} + +class MockeryTest_SubjectCall1 +{ + public function foo() + { + return 'bar'; + } +} + +class MockeryTest_InterMethod1 +{ + public function doFirst() + { + return $this->doSecond(); + } + + private function doSecond() + { + return $this->doThird(); + } + + public function doThird() + { + return false; + } +} + +class MyService2 +{ + public function login($user, $pass) + { + } + public function hasBookmarksTagged($tag) + { + } + public function addBookmark($uri, $tag) + { + } +} + +class Mockery_Duck +{ + public function quack() + { + } + public function swim() + { + } +} + +class Mockery_Duck_Nonswimmer +{ + public function quack() + { + } +} + +class Mockery_Demeterowski +{ + public function foo() + { + return $this; + } + public function bar() + { + return $this; + } + public function baz() + { + return 'Ham!'; + } +} + +class Mockery_UseDemeter +{ + public function __construct($demeter) + { + $this->demeter = $demeter; + } + public function doit() + { + return $this->demeter->foo()->bar()->baz(); + } + public function doitWithArgs() + { + return $this->demeter->foo("foo")->bar("bar")->baz("baz"); + } +} + +class MockeryTest_Foo +{ + public function foo() + { + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/Fixtures/ClassWithAllLowerCaseMethod.php b/vendor/mockery/mockery/tests/Mockery/Fixtures/ClassWithAllLowerCaseMethod.php new file mode 100644 index 0000000..2cf2b77 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/Fixtures/ClassWithAllLowerCaseMethod.php @@ -0,0 +1,30 @@ + + { + return array('key' => true); + } + + public function HHVMVoid() : ?void + { + return null; + } + + public function HHVMMixed() : mixed + { + return null; + } + + public function HHVMThis() : this + { + return $this; + } + + public function HHVMString() : string + { + return 'a string'; + } + + public function HHVMImmVector() : ImmVector + { + return new ImmVector([1, 2, 3]); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/Fixtures/MethodWithIterableTypeHints.php b/vendor/mockery/mockery/tests/Mockery/Fixtures/MethodWithIterableTypeHints.php new file mode 100644 index 0000000..49739c6 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/Fixtures/MethodWithIterableTypeHints.php @@ -0,0 +1,29 @@ +assertTrue($target->hasInternalAncestor()); + + $target = new DefinedTargetClass(new \ReflectionClass("Mockery\MockeryTest_ClassThatExtendsArrayObject")); + $this->assertTrue($target->hasInternalAncestor()); + + $target = new DefinedTargetClass(new \ReflectionClass("Mockery\DefinedTargetClassTest")); + $this->assertFalse($target->hasInternalAncestor()); + } +} + +class MockeryTest_ClassThatExtendsArrayObject extends \ArrayObject +{ +} diff --git a/vendor/mockery/mockery/tests/Mockery/Generator/MockConfigurationBuilderTest.php b/vendor/mockery/mockery/tests/Mockery/Generator/MockConfigurationBuilderTest.php new file mode 100644 index 0000000..ac48ac1 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/Generator/MockConfigurationBuilderTest.php @@ -0,0 +1,85 @@ +assertContains('__halt_compiler', $builder->getMockConfiguration()->getBlackListedMethods()); + + // need a builtin for this + $this->markTestSkipped("Need a builtin class with a method that is a reserved word"); + } + + /** + * @test + */ + public function magicMethodsAreBlackListedByDefault() + { + $builder = new MockConfigurationBuilder; + $builder->addTarget(ClassWithMagicCall::class); + $methods = $builder->getMockConfiguration()->getMethodsToMock(); + $this->assertCount(1, $methods); + $this->assertEquals("foo", $methods[0]->getName()); + } + + /** @test */ + public function xdebugs_debug_info_is_black_listed_by_default() + { + $builder = new MockConfigurationBuilder; + $builder->addTarget(ClassWithDebugInfo::class); + $methods = $builder->getMockConfiguration()->getMethodsToMock(); + $this->assertCount(1, $methods); + $this->assertEquals("foo", $methods[0]->getName()); + } +} + +class ClassWithMagicCall +{ + public function foo() + { + } + + public function __call($method, $args) + { + } +} + +class ClassWithDebugInfo +{ + public function foo() + { + } + + public function __debugInfo() + { + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/Generator/MockConfigurationTest.php b/vendor/mockery/mockery/tests/Mockery/Generator/MockConfigurationTest.php new file mode 100644 index 0000000..d32ac58 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/Generator/MockConfigurationTest.php @@ -0,0 +1,218 @@ +getMethodsToMock(); + $this->assertCount(1, $methods); + $this->assertEquals("bar", $methods[0]->getName()); + } + + /** + * @test + */ + public function blackListsAreCaseInsensitive() + { + $config = new MockConfiguration(array("Mockery\Generator\\TestSubject"), array("FOO")); + + $methods = $config->getMethodsToMock(); + $this->assertCount(1, $methods); + $this->assertEquals("bar", $methods[0]->getName()); + } + + + /** + * @test + */ + public function onlyWhiteListedMethodsShouldBeInListToBeMocked() + { + $config = new MockConfiguration(array("Mockery\Generator\\TestSubject"), array(), array('foo')); + + $methods = $config->getMethodsToMock(); + $this->assertCount(1, $methods); + $this->assertEquals("foo", $methods[0]->getName()); + } + + /** + * @test + */ + public function whitelistOverRulesBlackList() + { + $config = new MockConfiguration(array("Mockery\Generator\\TestSubject"), array("foo"), array("foo")); + + $methods = $config->getMethodsToMock(); + $this->assertCount(1, $methods); + $this->assertEquals("foo", $methods[0]->getName()); + } + + /** + * @test + */ + public function whiteListsAreCaseInsensitive() + { + $config = new MockConfiguration(array("Mockery\Generator\\TestSubject"), array(), array("FOO")); + + $methods = $config->getMethodsToMock(); + $this->assertCount(1, $methods); + $this->assertEquals("foo", $methods[0]->getName()); + } + + /** + * @test + */ + public function finalMethodsAreExcluded() + { + $config = new MockConfiguration(array("Mockery\Generator\\ClassWithFinalMethod")); + + $methods = $config->getMethodsToMock(); + $this->assertCount(1, $methods); + $this->assertEquals("bar", $methods[0]->getName()); + } + + /** + * @test + */ + public function shouldIncludeMethodsFromAllTargets() + { + $config = new MockConfiguration(array("Mockery\\Generator\\TestInterface", "Mockery\\Generator\\TestInterface2")); + $methods = $config->getMethodsToMock(); + $this->assertCount(2, $methods); + } + + /** + * @test + * @expectedException Mockery\Exception + */ + public function shouldThrowIfTargetClassIsFinal() + { + $config = new MockConfiguration(array("Mockery\\Generator\\TestFinal")); + $config->getTargetClass(); + } + + /** + * @test + */ + public function shouldTargetIteratorAggregateIfTryingToMockTraversable() + { + $config = new MockConfiguration(array("\\Traversable")); + + $interfaces = $config->getTargetInterfaces(); + $this->assertCount(1, $interfaces); + $first = array_shift($interfaces); + $this->assertEquals("IteratorAggregate", $first->getName()); + } + + /** + * @test + */ + public function shouldTargetIteratorAggregateIfTraversableInTargetsTree() + { + $config = new MockConfiguration(array("Mockery\Generator\TestTraversableInterface")); + + $interfaces = $config->getTargetInterfaces(); + $this->assertCount(2, $interfaces); + $this->assertEquals("IteratorAggregate", $interfaces[0]->getName()); + $this->assertEquals("Mockery\Generator\TestTraversableInterface", $interfaces[1]->getName()); + } + + /** + * @test + */ + public function shouldBringIteratorToHeadOfTargetListIfTraversablePresent() + { + $config = new MockConfiguration(array("Mockery\Generator\TestTraversableInterface2")); + + $interfaces = $config->getTargetInterfaces(); + $this->assertCount(2, $interfaces); + $this->assertEquals("Iterator", $interfaces[0]->getName()); + $this->assertEquals("Mockery\Generator\TestTraversableInterface2", $interfaces[1]->getName()); + } + + /** + * @test + */ + public function shouldBringIteratorAggregateToHeadOfTargetListIfTraversablePresent() + { + $config = new MockConfiguration(array("Mockery\Generator\TestTraversableInterface3")); + + $interfaces = $config->getTargetInterfaces(); + $this->assertCount(2, $interfaces); + $this->assertEquals("IteratorAggregate", $interfaces[0]->getName()); + $this->assertEquals("Mockery\Generator\TestTraversableInterface3", $interfaces[1]->getName()); + } +} + +interface TestTraversableInterface extends \Traversable +{ +} +interface TestTraversableInterface2 extends \Traversable, \Iterator +{ +} +interface TestTraversableInterface3 extends \Traversable, \IteratorAggregate +{ +} + +final class TestFinal +{ +} + +interface TestInterface +{ + public function foo(); +} + +interface TestInterface2 +{ + public function bar(); +} + +class TestSubject +{ + public function foo() + { + } + + public function bar() + { + } +} + +class ClassWithFinalMethod +{ + final public function foo() + { + } + + public function bar() + { + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/CallTypeHintPassTest.php b/vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/CallTypeHintPassTest.php new file mode 100644 index 0000000..6ce54e9 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/CallTypeHintPassTest.php @@ -0,0 +1,59 @@ + true, + ))->makePartial(); + $code = $pass->apply(static::CODE, $config); + $this->assertContains('__call($method, $args)', $code); + } + + /** + * @test + */ + public function shouldRemoveCallStaticTypeHintIfRequired() + { + $pass = new CallTypeHintPass; + $config = m::mock("Mockery\Generator\MockConfiguration", array( + "requiresCallStaticTypeHintRemoval" => true, + ))->makePartial(); + $code = $pass->apply(static::CODE, $config); + $this->assertContains('__callStatic($method, $args)', $code); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/ClassNamePassTest.php b/vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/ClassNamePassTest.php new file mode 100644 index 0000000..d9209b8 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/ClassNamePassTest.php @@ -0,0 +1,78 @@ +pass = new ClassNamePass(); + } + + /** + * @test + */ + public function shouldRemoveNamespaceDefinition() + { + $config = new MockConfiguration(array(), array(), array(), "Dave\Dave"); + $code = $this->pass->apply(static::CODE, $config); + $this->assertNotContains('namespace Mockery;', $code); + } + + /** + * @test + */ + public function shouldReplaceNamespaceIfClassNameIsNamespaced() + { + $config = new MockConfiguration(array(), array(), array(), "Dave\Dave"); + $code = $this->pass->apply(static::CODE, $config); + $this->assertNotContains('namespace Mockery;', $code); + $this->assertContains('namespace Dave;', $code); + } + + /** + * @test + */ + public function shouldReplaceClassNameWithSpecifiedName() + { + $config = new MockConfiguration(array(), array(), array(), "Dave"); + $code = $this->pass->apply(static::CODE, $config); + $this->assertContains('class Dave', $code); + } + + /** + * @test + */ + public function shouldRemoveLeadingBackslashesFromNamespace() + { + $config = new MockConfiguration(array(), array(), array(), "\Dave\Dave"); + $code = $this->pass->apply(static::CODE, $config); + $this->assertContains('namespace Dave;', $code); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/ConstantsPassTest.php b/vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/ConstantsPassTest.php new file mode 100644 index 0000000..ae907bc --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/ConstantsPassTest.php @@ -0,0 +1,52 @@ + ['FOO' => 'test']] + ); + $code = $pass->apply(static::CODE, $config); + $this->assertContains("const FOO = 'test'", $code); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/InstanceMockPassTest.php b/vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/InstanceMockPassTest.php new file mode 100644 index 0000000..94be526 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/InstanceMockPassTest.php @@ -0,0 +1,45 @@ +setInstanceMock(true); + $config = $builder->getMockConfiguration(); + $pass = new InstanceMockPass; + $code = $pass->apply('class Dave { }', $config); + $this->assertContains('public function __construct', $code); + $this->assertContains('protected $_mockery_ignoreVerification', $code); + $this->assertContains('this->_mockery_constructorCalled(func_get_args());', $code); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/InterfacePassTest.php b/vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/InterfacePassTest.php new file mode 100644 index 0000000..9930165 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/Generator/StringManipulation/Pass/InterfacePassTest.php @@ -0,0 +1,66 @@ + array(), + )); + + $code = $pass->apply(static::CODE, $config); + $this->assertEquals(static::CODE, $code); + } + + /** + * @test + */ + public function shouldAddAnyInterfaceNamesToImplementsDefinition() + { + $pass = new InterfacePass; + + $config = m::mock("Mockery\Generator\MockConfiguration", array( + "getTargetInterfaces" => array( + m::mock(array("getName" => "Dave\Dave")), + m::mock(array("getName" => "Paddy\Paddy")), + ), + )); + + $code = $pass->apply(static::CODE, $config); + + $this->assertContains("implements MockInterface, \Dave\Dave, \Paddy\Paddy", $code); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/GlobalHelpersTest.php b/vendor/mockery/mockery/tests/Mockery/GlobalHelpersTest.php new file mode 100644 index 0000000..0f2b7c4 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/GlobalHelpersTest.php @@ -0,0 +1,63 @@ +assertInstanceOf(\Mockery\MockInterface::class, $double); + $this->expectException(\Exception::class); + $double->foo(); + } + + /** @test */ + public function spy_creates_a_spy() + { + $double = spy(); + + $this->assertInstanceOf(\Mockery\MockInterface::class, $double); + $double->foo(); + } + + /** @test */ + public function named_mock_creates_a_named_mock() + { + $className = "Class".uniqid(); + $double = namedMock($className); + + $this->assertInstanceOf(\Mockery\MockInterface::class, $double); + $this->assertInstanceOf($className, $double); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/HamcrestExpectationTest.php b/vendor/mockery/mockery/tests/Mockery/HamcrestExpectationTest.php new file mode 100644 index 0000000..659397c --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/HamcrestExpectationTest.php @@ -0,0 +1,62 @@ +mock = mock('foo'); + } + + + public function tearDown() + { + \Mockery::getConfiguration()->allowMockingNonExistentMethods(true); + parent::tearDown(); + } + + /** Just a quickie roundup of a few Hamcrest matchers to check nothing obvious out of place **/ + + public function testAnythingConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(anything())->once(); + $this->mock->foo(2); + } + + public function testGreaterThanConstraintMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(greaterThan(1))->once(); + $this->mock->foo(2); + } + + /** + * @expectedException Mockery\Exception + */ + public function testGreaterThanConstraintNotMatchesArgument() + { + $this->mock->shouldReceive('foo')->with(greaterThan(1)); + $this->mock->foo(1); + Mockery::close(); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/Loader/EvalLoaderTest.php b/vendor/mockery/mockery/tests/Mockery/Loader/EvalLoaderTest.php new file mode 100644 index 0000000..025a1da --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/Loader/EvalLoaderTest.php @@ -0,0 +1,35 @@ +getLoader()->load($definition); + + $this->assertTrue(class_exists($className)); + } + + abstract public function getLoader(); +} diff --git a/vendor/mockery/mockery/tests/Mockery/Loader/RequireLoaderTest.php b/vendor/mockery/mockery/tests/Mockery/Loader/RequireLoaderTest.php new file mode 100644 index 0000000..9f0664a --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/Loader/RequireLoaderTest.php @@ -0,0 +1,35 @@ +assertionFailedError = '\PHPUnit\Framework\AssertionFailedError'; + $this->frameworkConstraint = '\PHPUnit\Framework\Constraint'; + } else { + $this->assertionFailedError = '\PHPUnit_Framework_AssertionFailedError'; + $this->frameworkConstraint = '\PHPUnit_Framework_Constraint'; + } + + $this->constraint = \Mockery::mock($this->frameworkConstraint); + $this->matcher = new PHPUnitConstraint($this->constraint); + $this->rethrowingMatcher = new PHPUnitConstraint($this->constraint, true); + } + + public function testMatches() + { + $value1 = 'value1'; + $value2 = 'value1'; + $value3 = 'value1'; + $this->constraint + ->shouldReceive('evaluate') + ->once() + ->with($value1) + ->getMock() + ->shouldReceive('evaluate') + ->once() + ->with($value2) + ->andThrow($this->assertionFailedError) + ->getMock() + ->shouldReceive('evaluate') + ->once() + ->with($value3) + ->getMock() + ; + $this->assertTrue($this->matcher->match($value1)); + $this->assertFalse($this->matcher->match($value2)); + $this->assertTrue($this->rethrowingMatcher->match($value3)); + } + + public function testMatchesWhereNotMatchAndRethrowing() + { + $this->expectException($this->assertionFailedError); + $value = 'value'; + $this->constraint + ->shouldReceive('evaluate') + ->once() + ->with($value) + ->andThrow($this->assertionFailedError) + ; + $this->rethrowingMatcher->match($value); + } + + public function test__toString() + { + $this->assertEquals('', $this->matcher); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/Matcher/SubsetTest.php b/vendor/mockery/mockery/tests/Mockery/Matcher/SubsetTest.php new file mode 100644 index 0000000..e45e17c --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/Matcher/SubsetTest.php @@ -0,0 +1,97 @@ + 123]); + + $actual = [ + 'foo' => 'bar', + 'dave' => 123, + 'bar' => 'baz', + ]; + + $this->assertTrue($matcher->match($actual)); + } + + /** @test */ + public function it_recursively_matches() + { + $matcher = Subset::strict(['foo' => ['bar' => ['baz' => 123]]]); + + $actual = [ + 'foo' => [ + 'bar' => [ + 'baz' => 123, + ] + ], + 'dave' => 123, + 'bar' => 'baz', + ]; + + $this->assertTrue($matcher->match($actual)); + } + + /** @test */ + public function it_is_strict_by_default() + { + $matcher = new Subset(['dave' => 123]); + + $actual = [ + 'foo' => 'bar', + 'dave' => 123.0, + 'bar' => 'baz', + ]; + + $this->assertFalse($matcher->match($actual)); + } + + /** @test */ + public function it_can_run_a_loose_comparison() + { + $matcher = Subset::loose(['dave' => 123]); + + $actual = [ + 'foo' => 'bar', + 'dave' => 123.0, + 'bar' => 'baz', + ]; + + $this->assertTrue($matcher->match($actual)); + } + + /** @test */ + public function it_returns_false_if_actual_is_not_an_array() + { + $matcher = new Subset(['dave' => 123]); + + $actual = null; + + $this->assertFalse($matcher->match($actual)); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/MockClassWithFinalWakeupTest.php b/vendor/mockery/mockery/tests/Mockery/MockClassWithFinalWakeupTest.php new file mode 100644 index 0000000..f84b30d --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/MockClassWithFinalWakeupTest.php @@ -0,0 +1,94 @@ + + * @license http://github.com/padraic/mockery/blob/master/LICENSE New BSD License + */ + +namespace test\Mockery; + +use Mockery\Adapter\Phpunit\MockeryTestCase; + +class MockClassWithFinalWakeupTest extends MockeryTestCase +{ + protected function setUp() + { + $this->container = new \Mockery\Container; + } + + protected function tearDown() + { + $this->container->mockery_close(); + } + + /** + * @test + * + * Test that we are able to create partial mocks of classes that have + * a __wakeup method marked as final. As long as __wakeup is not one of the + * mocked methods. + */ + public function testCreateMockForClassWithFinalWakeup() + { + $mock = $this->container->mock("test\Mockery\TestWithFinalWakeup"); + $this->assertInstanceOf("test\Mockery\TestWithFinalWakeup", $mock); + $this->assertEquals('test\Mockery\TestWithFinalWakeup::__wakeup', $mock->__wakeup()); + + $mock = $this->container->mock('test\Mockery\SubclassWithFinalWakeup'); + $this->assertInstanceOf('test\Mockery\SubclassWithFinalWakeup', $mock); + $this->assertEquals('test\Mockery\TestWithFinalWakeup::__wakeup', $mock->__wakeup()); + } + + public function testCreateMockForClassWithNonFinalWakeup() + { + $mock = $this->container->mock('test\Mockery\TestWithNonFinalWakeup'); + $this->assertInstanceOf('test\Mockery\TestWithNonFinalWakeup', $mock); + + // Make sure __wakeup is overridden and doesn't return anything. + $this->assertNull($mock->__wakeup()); + } +} + +class TestWithFinalWakeup +{ + public function foo() + { + return 'foo'; + } + + public function bar() + { + return 'bar'; + } + + final public function __wakeup() + { + return __METHOD__; + } +} + +class SubclassWithFinalWakeup extends TestWithFinalWakeup +{ +} + +class TestWithNonFinalWakeup +{ + public function __wakeup() + { + return __METHOD__; + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/MockClassWithMethodOverloadingTest.php b/vendor/mockery/mockery/tests/Mockery/MockClassWithMethodOverloadingTest.php new file mode 100644 index 0000000..b0284dc --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/MockClassWithMethodOverloadingTest.php @@ -0,0 +1,43 @@ +makePartial(); + $this->assertInstanceOf('test\Mockery\TestWithMethodOverloading', $mock); + + // TestWithMethodOverloading::__call wouldn't be used. See Gotchas!. + $mock->randomMethod(); + } + + public function testCreateMockForClassWithMethodOverloadingWithExistingMethod() + { + $mock = mock('test\Mockery\TestWithMethodOverloading') + ->makePartial(); + $this->assertInstanceOf('test\Mockery\TestWithMethodOverloading', $mock); + + $this->assertSame(1, $mock->thisIsRealMethod()); + } +} + +class TestWithMethodOverloading +{ + public function __call($name, $arguments) + { + return 1; + } + + public function thisIsRealMethod() + { + return 1; + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/MockClassWithUnknownTypeHintTest.php b/vendor/mockery/mockery/tests/Mockery/MockClassWithUnknownTypeHintTest.php new file mode 100644 index 0000000..8706f8d --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/MockClassWithUnknownTypeHintTest.php @@ -0,0 +1,43 @@ +assertInstanceOf(MockInterface::class, $mock); + } +} + +class HasUnknownClassAsTypeHintOnMethod +{ + public function foo(\UnknownTestClass\Bar $bar) + { + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/MockTest.php b/vendor/mockery/mockery/tests/Mockery/MockTest.php new file mode 100644 index 0000000..15b4b7b --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/MockTest.php @@ -0,0 +1,219 @@ +allowMockingNonExistentMethods(false); + $m = mock(); + $m->shouldReceive("test123")->andReturn(true); + assertThat($m->test123(), equalTo(true)); + \Mockery::getConfiguration()->allowMockingNonExistentMethods(true); + } + + public function testMockWithNotAllowingMockingOfNonExistentMethodsCanBeGivenAdditionalMethodsToMockEvenIfTheyDontExistOnClass() + { + \Mockery::getConfiguration()->allowMockingNonExistentMethods(false); + $m = mock('ExampleClassForTestingNonExistentMethod'); + $m->shouldAllowMockingMethod('testSomeNonExistentMethod'); + $m->shouldReceive("testSomeNonExistentMethod")->andReturn(true); + assertThat($m->testSomeNonExistentMethod(), equalTo(true)); + \Mockery::getConfiguration()->allowMockingNonExistentMethods(true); + } + + public function testShouldAllowMockingMethodReturnsMockInstance() + { + $m = Mockery::mock('someClass'); + $this->assertInstanceOf('Mockery\MockInterface', $m->shouldAllowMockingMethod('testFunction')); + } + + public function testShouldAllowMockingProtectedMethodReturnsMockInstance() + { + $m = Mockery::mock('someClass'); + $this->assertInstanceOf('Mockery\MockInterface', $m->shouldAllowMockingProtectedMethods('testFunction')); + } + + public function testMockAddsToString() + { + $mock = mock('ClassWithNoToString'); + $this->assertTrue(method_exists($mock, '__toString')); + } + + public function testMockToStringMayBeDeferred() + { + $mock = mock('ClassWithToString')->makePartial(); + $this->assertEquals("foo", (string)$mock); + } + + public function testMockToStringShouldIgnoreMissingAlwaysReturnsString() + { + $mock = mock('ClassWithNoToString')->shouldIgnoreMissing(); + $this->assertNotEquals('', (string)$mock); + + $mock->asUndefined(); + $this->assertNotEquals('', (string)$mock); + } + + public function testShouldIgnoreMissing() + { + $mock = mock('ClassWithNoToString')->shouldIgnoreMissing(); + $this->assertNull($mock->nonExistingMethod()); + } + + /** + * @expectedException Mockery\Exception + */ + public function testShouldIgnoreMissingDisallowMockingNonExistentMethodsUsingGlobalConfiguration() + { + Mockery::getConfiguration()->allowMockingNonExistentMethods(false); + $mock = mock('ClassWithMethods')->shouldIgnoreMissing(); + $mock->shouldReceive('nonExistentMethod'); + } + + /** + * @expectedException BadMethodCallException + */ + public function testShouldIgnoreMissingCallingNonExistentMethodsUsingGlobalConfiguration() + { + Mockery::getConfiguration()->allowMockingNonExistentMethods(false); + $mock = mock('ClassWithMethods')->shouldIgnoreMissing(); + $mock->nonExistentMethod(); + } + + public function testShouldIgnoreMissingCallingExistentMethods() + { + Mockery::getConfiguration()->allowMockingNonExistentMethods(false); + $mock = mock('ClassWithMethods')->shouldIgnoreMissing(); + assertThat(nullValue($mock->foo())); + $mock->shouldReceive('bar')->passthru(); + assertThat($mock->bar(), equalTo('bar')); + } + + public function testShouldIgnoreMissingCallingNonExistentMethods() + { + Mockery::getConfiguration()->allowMockingNonExistentMethods(true); + $mock = mock('ClassWithMethods')->shouldIgnoreMissing(); + assertThat(nullValue($mock->foo())); + assertThat(nullValue($mock->bar())); + assertThat(nullValue($mock->nonExistentMethod())); + + $mock->shouldReceive(array('foo' => 'new_foo', 'nonExistentMethod' => 'result')); + $mock->shouldReceive('bar')->passthru(); + assertThat($mock->foo(), equalTo('new_foo')); + assertThat($mock->bar(), equalTo('bar')); + assertThat($mock->nonExistentMethod(), equalTo('result')); + } + + public function testCanMockException() + { + $exception = Mockery::mock('Exception'); + $this->assertInstanceOf('Exception', $exception); + } + + public function testCanMockSubclassOfException() + { + $errorException = Mockery::mock('ErrorException'); + $this->assertInstanceOf('ErrorException', $errorException); + $this->assertInstanceOf('Exception', $errorException); + } + + public function testCallingShouldReceiveWithoutAValidMethodName() + { + $mock = Mockery::mock(); + + $this->expectException("InvalidArgumentException", "Received empty method name"); + $mock->shouldReceive(""); + } + + /** + * @expectedException Mockery\Exception + */ + public function testShouldThrowExceptionWithInvalidClassName() + { + mock('ClassName.CannotContainDot'); + } + + + /** @test */ + public function expectation_count_will_count_expectations() + { + $mock = new Mock(); + $mock->shouldReceive("doThis")->once(); + $mock->shouldReceive("doThat")->once(); + + $this->assertEquals(2, $mock->mockery_getExpectationCount()); + } + + /** @test */ + public function expectation_count_will_ignore_defaults_if_overriden() + { + $mock = new Mock(); + $mock->shouldReceive("doThis")->once()->byDefault(); + $mock->shouldReceive("doThis")->twice(); + $mock->shouldReceive("andThis")->twice(); + + $this->assertEquals(2, $mock->mockery_getExpectationCount()); + } + + /** @test */ + public function expectation_count_will_count_defaults_if_not_overriden() + { + $mock = new Mock(); + $mock->shouldReceive("doThis")->once()->byDefault(); + $mock->shouldReceive("doThat")->once()->byDefault(); + + $this->assertEquals(2, $mock->mockery_getExpectationCount()); + } +} + + +class ExampleClassForTestingNonExistentMethod +{ +} + +class ClassWithToString +{ + public function __toString() + { + return 'foo'; + } +} + +class ClassWithNoToString +{ +} + +class ClassWithMethods +{ + public function foo() + { + return 'foo'; + } + + public function bar() + { + return 'bar'; + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/MockeryCanMockClassesWithSemiReservedWordsTest.php b/vendor/mockery/mockery/tests/Mockery/MockeryCanMockClassesWithSemiReservedWordsTest.php new file mode 100644 index 0000000..fe8ed91 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/MockeryCanMockClassesWithSemiReservedWordsTest.php @@ -0,0 +1,28 @@ +shouldReceive("include")->andReturn("foo"); + + $this->assertTrue(method_exists($mock, "include")); + $this->assertEquals("foo", $mock->include()); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/MockeryCanMockMultipleInterfacesWhichOverlapTest.php b/vendor/mockery/mockery/tests/Mockery/MockeryCanMockMultipleInterfacesWhichOverlapTest.php new file mode 100644 index 0000000..6f49428 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/MockeryCanMockMultipleInterfacesWhichOverlapTest.php @@ -0,0 +1,65 @@ +mock('Mockery\Tests\Evenement_EventEmitter', 'Mockery\Tests\Chatroulette_ConnectionInterface'); + } +} + +interface Evenement_EventEmitterInterface +{ + public function on($name, $callback); +} + +class Evenement_EventEmitter implements Evenement_EventEmitterInterface +{ + public function on($name, $callback) + { + } +} + +interface React_StreamInterface extends Evenement_EventEmitterInterface +{ + public function close(); +} + +interface React_ReadableStreamInterface extends React_StreamInterface +{ + public function pause(); +} + +interface React_WritableStreamInterface extends React_StreamInterface +{ + public function write($data); +} + +interface Chatroulette_ConnectionInterface extends React_ReadableStreamInterface, React_WritableStreamInterface +{ +} diff --git a/vendor/mockery/mockery/tests/Mockery/MockingAllLowerCasedMethodsTest.php b/vendor/mockery/mockery/tests/Mockery/MockingAllLowerCasedMethodsTest.php new file mode 100644 index 0000000..295ae6c --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/MockingAllLowerCasedMethodsTest.php @@ -0,0 +1,43 @@ +shouldReceive('userExpectsCamelCaseMethod') + ->andReturn('mocked'); + + $result = $mock->userExpectsCamelCaseMethod(); + + $expected = 'mocked'; + + self::assertSame($expected, $result); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/MockingClassConstantsTest.php b/vendor/mockery/mockery/tests/Mockery/MockingClassConstantsTest.php new file mode 100644 index 0000000..4cb7b83 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/MockingClassConstantsTest.php @@ -0,0 +1,43 @@ +setConstantsMap([ + 'ClassWithConstants' => [ + 'FOO' => 'baz', + 'X' => 2, + ] + ]); + + $mock = \Mockery::mock('overload:ClassWithConstants'); + + self::assertEquals('baz', $mock::FOO); + self::assertEquals(2, $mock::X); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/MockingHHVMMethodsTest.php b/vendor/mockery/mockery/tests/Mockery/MockingHHVMMethodsTest.php new file mode 100644 index 0000000..7377f16 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/MockingHHVMMethodsTest.php @@ -0,0 +1,107 @@ +isHHVM()) { + $this->markTestSkipped('For HHVM test only'); + } + + parent::setUp(); + + require_once __DIR__."/Fixtures/MethodWithHHVMReturnType.php"; + } + + /** @test */ + public function it_strip_hhvm_array_return_types() + { + $mock = mock('test\Mockery\Fixtures\MethodWithHHVMReturnType'); + + $mock->shouldReceive('nullableHHVMArray')->andReturn(array('key' => true)); + $mock->nullableHHVMArray(); + } + + /** @test */ + public function it_strip_hhvm_void_return_types() + { + $mock = mock('test\Mockery\Fixtures\MethodWithHHVMReturnType'); + + $mock->shouldReceive('HHVMVoid')->andReturnNull(); + $mock->HHVMVoid(); + } + + /** @test */ + public function it_strip_hhvm_mixed_return_types() + { + $mock = mock('test\Mockery\Fixtures\MethodWithHHVMReturnType'); + + $mock->shouldReceive('HHVMMixed')->andReturnNull(); + $mock->HHVMMixed(); + } + + /** @test */ + public function it_strip_hhvm_this_return_types() + { + $mock = mock('test\Mockery\Fixtures\MethodWithHHVMReturnType'); + + $mock->shouldReceive('HHVMThis')->andReturn(new MethodWithHHVMReturnType()); + $mock->HHVMThis(); + } + + /** @test */ + public function it_allow_hhvm_string_return_types() + { + $mock = mock('test\Mockery\Fixtures\MethodWithHHVMReturnType'); + + $mock->shouldReceive('HHVMString')->andReturn('a string'); + $mock->HHVMString(); + } + + /** @test */ + public function it_allow_hhvm_imm_vector_return_types() + { + $mock = mock('test\Mockery\Fixtures\MethodWithHHVMReturnType'); + + $mock->shouldReceive('HHVMImmVector')->andReturn(new \HH\ImmVector([1, 2, 3])); + $mock->HHVMImmVector(); + } + + /** + * Returns true when it is HHVM. + */ + private function isHHVM() + { + return \defined('HHVM_VERSION'); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/MockingMethodsWithIterableTypeHintsTest.php b/vendor/mockery/mockery/tests/Mockery/MockingMethodsWithIterableTypeHintsTest.php new file mode 100644 index 0000000..34ef54c --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/MockingMethodsWithIterableTypeHintsTest.php @@ -0,0 +1,39 @@ +assertInstanceOf(\test\Mockery\Fixtures\MethodWithIterableTypeHints::class, $mock); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/MockingMethodsWithNullableParametersTest.php b/vendor/mockery/mockery/tests/Mockery/MockingMethodsWithNullableParametersTest.php new file mode 100644 index 0000000..e3aa767 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/MockingMethodsWithNullableParametersTest.php @@ -0,0 +1,52 @@ +assertInstanceOf(\test\Mockery\Fixtures\MethodWithNullableTypedParameter::class, $mock); + } + + /** + * @test + */ + public function it_can_handle_default_parameters() + { + require __DIR__."/Fixtures/MethodWithParametersWithDefaultValues.php"; + $mock = mock("test\Mockery\Fixtures\MethodWithParametersWithDefaultValues"); + + $this->assertInstanceOf(\test\Mockery\Fixtures\MethodWithParametersWithDefaultValues::class, $mock); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/MockingNullableMethodsTest.php b/vendor/mockery/mockery/tests/Mockery/MockingNullableMethodsTest.php new file mode 100644 index 0000000..9b7bdc2 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/MockingNullableMethodsTest.php @@ -0,0 +1,217 @@ +shouldReceive('nonNullablePrimitive')->andReturn('a string'); + $mock->nonNullablePrimitive(); + } + + /** + * @test + * @expectedException \TypeError + */ + public function itShouldNotAllowNonNullToBeNull() + { + $mock = mock("test\Mockery\Fixtures\MethodWithNullableReturnType"); + + $mock->shouldReceive('nonNullablePrimitive')->andReturn(null); + $mock->nonNullablePrimitive(); + } + + /** + * @test + */ + public function itShouldAllowPrimitiveNullableToBeNull() + { + $mock = mock("test\Mockery\Fixtures\MethodWithNullableReturnType"); + + $mock->shouldReceive('nullablePrimitive')->andReturn(null); + $mock->nullablePrimitive(); + } + + /** + * @test + */ + public function itShouldAllowPrimitiveNullabeToBeSet() + { + $mock = mock("test\Mockery\Fixtures\MethodWithNullableReturnType"); + + $mock->shouldReceive('nullablePrimitive')->andReturn('a string'); + $mock->nullablePrimitive(); + } + + /** + * @test + */ + public function itShouldAllowSelfToBeSet() + { + $mock = mock("test\Mockery\Fixtures\MethodWithNullableReturnType"); + + $mock->shouldReceive('nonNullableSelf')->andReturn(new MethodWithNullableReturnType()); + $mock->nonNullableSelf(); + } + + /** + * @test + * @expectedException \TypeError + */ + public function itShouldNotAllowSelfToBeNull() + { + $mock = mock("test\Mockery\Fixtures\MethodWithNullableReturnType"); + + $mock->shouldReceive('nonNullableSelf')->andReturn(null); + $mock->nonNullableSelf(); + } + + /** + * @test + */ + public function itShouldAllowNullableSelfToBeSet() + { + $mock = mock("test\Mockery\Fixtures\MethodWithNullableReturnType"); + + $mock->shouldReceive('nullableSelf')->andReturn(new MethodWithNullableReturnType()); + $mock->nullableSelf(); + } + + /** + * @test + */ + public function itShouldAllowNullableSelfToBeNull() + { + $mock = mock("test\Mockery\Fixtures\MethodWithNullableReturnType"); + + $mock->shouldReceive('nullableSelf')->andReturn(null); + $mock->nullableSelf(); + } + + /** + * @test + */ + public function itShouldAllowClassToBeSet() + { + $mock = mock("test\Mockery\Fixtures\MethodWithNullableReturnType"); + + $mock->shouldReceive('nonNullableClass')->andReturn(new MethodWithNullableReturnType()); + $mock->nonNullableClass(); + } + + /** + * @test + * @expectedException \TypeError + */ + public function itShouldNotAllowClassToBeNull() + { + $mock = mock("test\Mockery\Fixtures\MethodWithNullableReturnType"); + + $mock->shouldReceive('nonNullableClass')->andReturn(null); + $mock->nonNullableClass(); + } + + /** + * @test + */ + public function itShouldAllowNullalbeClassToBeSet() + { + $mock = mock("test\Mockery\Fixtures\MethodWithNullableReturnType"); + + $mock->shouldReceive('nullableClass')->andReturn(new MethodWithNullableReturnType()); + $mock->nullableClass(); + } + + /** + * @test + */ + public function itShouldAllowNullableClassToBeNull() + { + $mock = mock("test\Mockery\Fixtures\MethodWithNullableReturnType"); + + $mock->shouldReceive('nullableClass')->andReturn(null); + $mock->nullableClass(); + } + + /** @test */ + public function it_allows_returning_null_for_nullable_object_return_types() + { + $double= \Mockery::mock(MethodWithNullableReturnType::class); + + $double->shouldReceive("nullableClass")->andReturnNull(); + + $this->assertNull($double->nullableClass()); + } + + /** @test */ + public function it_allows_returning_null_for_nullable_string_return_types() + { + $double= \Mockery::mock(MethodWithNullableReturnType::class); + + $double->shouldReceive("nullableString")->andReturnNull(); + + $this->assertNull($double->nullableString()); + } + + /** @test */ + public function it_allows_returning_null_for_nullable_int_return_types() + { + $double= \Mockery::mock(MethodWithNullableReturnType::class); + + $double->shouldReceive("nullableInt")->andReturnNull(); + + $this->assertNull($double->nullableInt()); + } + + /** @test */ + public function it_returns_null_on_calls_to_ignored_methods_of_spies_if_return_type_is_nullable() + { + $double = \Mockery::spy(MethodWithNullableReturnType::class); + + $this->assertNull($double->nullableClass()); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/MockingProtectedMethodsTest.php b/vendor/mockery/mockery/tests/Mockery/MockingProtectedMethodsTest.php new file mode 100644 index 0000000..7810d1b --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/MockingProtectedMethodsTest.php @@ -0,0 +1,133 @@ +assertEquals("bar", $mock->bar()); + } + + /** + * @test + * + * This is a regression test, basically we don't want the mock handling + * interfering with calling protected methods partials + */ + public function shouldAutomaticallyDeferCallsToProtectedMethodsForRuntimePartials() + { + $mock = mock("test\Mockery\TestWithProtectedMethods")->makePartial(); + $this->assertEquals("bar", $mock->bar()); + } + + /** @test */ + public function shouldAutomaticallyIgnoreAbstractProtectedMethods() + { + $mock = mock("test\Mockery\TestWithProtectedMethods")->makePartial(); + $this->assertNull($mock->foo()); + } + + /** @test */ + public function shouldAllowMockingProtectedMethods() + { + $mock = mock("test\Mockery\TestWithProtectedMethods") + ->makePartial() + ->shouldAllowMockingProtectedMethods(); + + $mock->shouldReceive("protectedBar")->andReturn("notbar"); + $this->assertEquals("notbar", $mock->bar()); + } + + /** @test */ + public function shouldAllowMockingProtectedMethodOnDefinitionTimePartial() + { + $mock = mock("test\Mockery\TestWithProtectedMethods[protectedBar]") + ->shouldAllowMockingProtectedMethods(); + + $mock->shouldReceive("protectedBar")->andReturn("notbar"); + $this->assertEquals("notbar", $mock->bar()); + } + + /** @test */ + public function shouldAllowMockingAbstractProtectedMethods() + { + $mock = mock("test\Mockery\TestWithProtectedMethods") + ->makePartial() + ->shouldAllowMockingProtectedMethods(); + + $mock->shouldReceive("abstractProtected")->andReturn("abstractProtected"); + $this->assertEquals("abstractProtected", $mock->foo()); + } + + /** @test */ + public function shouldAllowMockingIncreasedVisabilityMethods() + { + $mock = mock("test\Mockery\TestIncreasedVisibilityChild"); + $mock->shouldReceive('foobar')->andReturn("foobar"); + $this->assertEquals('foobar', $mock->foobar()); + } +} + + +abstract class TestWithProtectedMethods +{ + public function foo() + { + return $this->abstractProtected(); + } + + abstract protected function abstractProtected(); + + public function bar() + { + return $this->protectedBar(); + } + + protected function protectedBar() + { + return 'bar'; + } +} + +class TestIncreasedVisibilityParent +{ + protected function foobar() + { + } +} + +class TestIncreasedVisibilityChild extends TestIncreasedVisibilityParent +{ + public function foobar() + { + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/MockingVariadicArgumentsTest.php b/vendor/mockery/mockery/tests/Mockery/MockingVariadicArgumentsTest.php new file mode 100644 index 0000000..a940f63 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/MockingVariadicArgumentsTest.php @@ -0,0 +1,45 @@ +shouldReceive("foo")->andReturn("notbar"); + $this->assertEquals("notbar", $mock->foo()); + } +} + + +abstract class TestWithVariadicArguments +{ + public function foo(...$bar) + { + return $bar; + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/MockingVoidMethodsTest.php b/vendor/mockery/mockery/tests/Mockery/MockingVoidMethodsTest.php new file mode 100644 index 0000000..f1f167a --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/MockingVoidMethodsTest.php @@ -0,0 +1,53 @@ +assertInstanceOf(\test\Mockery\Fixtures\MethodWithVoidReturnType::class, $mock); + } + + /** @test */ + public function it_can_stub_and_mock_void_methods() + { + $mock = mock("test\Mockery\Fixtures\MethodWithVoidReturnType"); + + $mock->shouldReceive("foo"); + $mock->foo(); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/NamedMockTest.php b/vendor/mockery/mockery/tests/Mockery/NamedMockTest.php new file mode 100644 index 0000000..b39355f --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/NamedMockTest.php @@ -0,0 +1,86 @@ +assertInstanceOf("Mockery\Dave123", $mock); + } + + /** @test */ + public function itCreatesPassesFurtherArgumentsJustLikeMock() + { + $mock = Mockery::namedMock("Mockery\Dave456", "DateTime", array( + "getDave" => "dave" + )); + + $this->assertInstanceOf("DateTime", $mock); + $this->assertEquals("dave", $mock->getDave()); + } + + /** + * @test + * @expectedException Mockery\Exception + * @expectedExceptionMessage The mock named 'Mockery\Dave7' has been already defined with a different mock configuration + */ + public function itShouldThrowIfAttemptingToRedefineNamedMock() + { + $mock = Mockery::namedMock("Mockery\Dave7"); + $mock = Mockery::namedMock("Mockery\Dave7", "DateTime"); + } + + /** @test */ + public function itCreatesConcreteMethodImplementationWithReturnType() + { + $cactus = new \Nature\Plant(); + $gardener = Mockery::namedMock( + "NewNamespace\\ClassName", + "Gardener", + array('water' => true) + ); + $this->assertTrue($gardener->water($cactus)); + } + + /** + * @test + * @requires PHP 7.0.0 + */ + public function it_gracefully_handles_namespacing() + { + $animal = Mockery::namedMock( + uniqid(Animal::class, false), + Animal::class + ); + + $animal->shouldReceive("habitat")->andReturn(new Habitat()); + + $this->assertInstanceOf(Habitat::class, $animal->habitat()); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/SpyTest.php b/vendor/mockery/mockery/tests/Mockery/SpyTest.php new file mode 100644 index 0000000..73de84c --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/SpyTest.php @@ -0,0 +1,152 @@ +myMethod(); + $spy->shouldHaveReceived("myMethod"); + + $this->expectException("Mockery\Exception\InvalidCountException"); + $spy->shouldHaveReceived("someMethodThatWasNotCalled"); + } + + /** @test */ + public function itVerifiesAMethodWasNotCalled() + { + $spy = m::spy(); + $spy->shouldNotHaveReceived("myMethod"); + + $this->expectException("Mockery\Exception\InvalidCountException"); + $spy->myMethod(); + $spy->shouldNotHaveReceived("myMethod"); + } + + /** @test */ + public function itVerifiesAMethodWasNotCalledWithParticularArguments() + { + $spy = m::spy(); + $spy->myMethod(123, 456); + + $spy->shouldNotHaveReceived("myMethod", array(789, 10)); + + $this->expectException("Mockery\Exception\InvalidCountException"); + $spy->shouldNotHaveReceived("myMethod", array(123, 456)); + } + + /** @test */ + public function itVerifiesAMethodWasCalledASpecificNumberOfTimes() + { + $spy = m::spy(); + $spy->myMethod(); + $spy->myMethod(); + $spy->shouldHaveReceived("myMethod")->twice(); + + $this->expectException("Mockery\Exception\InvalidCountException"); + $spy->myMethod(); + $spy->shouldHaveReceived("myMethod")->twice(); + } + + /** @test */ + public function itVerifiesAMethodWasCalledWithSpecificArguments() + { + $spy = m::spy(); + $spy->myMethod(123, "a string"); + $spy->shouldHaveReceived("myMethod")->with(123, "a string"); + $spy->shouldHaveReceived("myMethod", array(123, "a string")); + + $this->expectException("Mockery\Exception\InvalidCountException"); + $spy->shouldHaveReceived("myMethod")->with(123); + } + + /** @test */ + public function itIncrementsExpectationCountWhenShouldHaveReceivedIsUsed() + { + $spy = m::spy(); + $spy->myMethod('param1', 'param2'); + $spy->shouldHaveReceived('myMethod')->with('param1', 'param2'); + $this->assertEquals(1, $spy->mockery_getExpectationCount()); + } + + /** @test */ + public function itIncrementsExpectationCountWhenShouldNotHaveReceivedIsUsed() + { + $spy = m::spy(); + $spy->shouldNotHaveReceived('method'); + $this->assertEquals(1, $spy->mockery_getExpectationCount()); + } + + /** @test */ + public function any_args_can_be_used_with_alternative_syntax() + { + $spy = m::spy(); + $spy->foo(123, 456); + + $spy->shouldHaveReceived()->foo(anyArgs()); + } + + /** @test */ + public function should_have_received_higher_order_message_call_a_method_with_correct_arguments() + { + $spy = m::spy(); + $spy->foo(123); + + $spy->shouldHaveReceived()->foo(123); + } + + /** @test */ + public function should_have_received_higher_order_message_call_a_method_with_incorrect_arguments_throws_exception() + { + $spy = m::spy(); + $spy->foo(123); + + $this->expectException("Mockery\Exception\InvalidCountException"); + $spy->shouldHaveReceived()->foo(456); + } + + /** @test */ + public function should_not_have_received_higher_order_message_call_a_method_with_incorrect_arguments() + { + $spy = m::spy(); + $spy->foo(123); + + $spy->shouldNotHaveReceived()->foo(456); + } + + /** @test */ + public function should_not_have_received_higher_order_message_call_a_method_with_correct_arguments_throws_an_exception() + { + $spy = m::spy(); + $spy->foo(123); + + $this->expectException("Mockery\Exception\InvalidCountException"); + $spy->shouldNotHaveReceived()->foo(123); + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/Stubs/Animal.php b/vendor/mockery/mockery/tests/Mockery/Stubs/Animal.php new file mode 100644 index 0000000..50de129 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/Stubs/Animal.php @@ -0,0 +1,29 @@ +assertEquals('bar', $trait->foo()); + } + + /** @test */ + public function it_creates_abstract_methods_as_necessary() + { + $trait = mock(TraitWithAbstractMethod::class, ['doBaz' => 'baz']); + + $this->assertEquals('baz', $trait->baz()); + } + + /** @test */ + public function it_can_create_an_object_using_multiple_traits() + { + $trait = mock(SimpleTrait::class, TraitWithAbstractMethod::class, [ + 'doBaz' => 123, + ]); + + $this->assertEquals('bar', $trait->foo()); + $this->assertEquals(123, $trait->baz()); + } +} + +trait SimpleTrait +{ + public function foo() + { + return 'bar'; + } +} + +trait TraitWithAbstractMethod +{ + public function baz() + { + return $this->doBaz(); + } + + abstract public function doBaz(); +} diff --git a/vendor/mockery/mockery/tests/Mockery/WithFormatterExpectationTest.php b/vendor/mockery/mockery/tests/Mockery/WithFormatterExpectationTest.php new file mode 100644 index 0000000..2e3c4f9 --- /dev/null +++ b/vendor/mockery/mockery/tests/Mockery/WithFormatterExpectationTest.php @@ -0,0 +1,123 @@ +assertEquals( + $expected, + Mockery::formatObjects($args) + ); + } + + /** + * @expectedException Mockery\Exception\NoMatchingExpectationException + * + * Note that without the patch checked in with this test, rather than throwing + * an exception, the program will go into an infinite recursive loop + */ + public function testFormatObjectsWithMockCalledInGetterDoesNotLeadToRecursion() + { + $mock = Mockery::mock('stdClass'); + $mock->shouldReceive('doBar')->with('foo'); + $obj = new ClassWithGetter($mock); + $obj->getFoo(); + } + + public function formatObjectsDataProvider() + { + return array( + array( + array(null), + '' + ), + array( + array('a string', 98768, array('a', 'nother', 'array')), + '' + ), + ); + } + + /** @test */ + public function format_objects_should_not_call_getters_with_params() + { + $obj = new ClassWithGetterWithParam(); + $string = Mockery::formatObjects(array($obj)); + + $this->assertNotContains('Missing argument 1 for', $string); + } + + public function testFormatObjectsExcludesStaticProperties() + { + $obj = new ClassWithPublicStaticProperty(); + $string = Mockery::formatObjects(array($obj)); + + $this->assertNotContains('excludedProperty', $string); + } + + public function testFormatObjectsExcludesStaticGetters() + { + $obj = new ClassWithPublicStaticGetter(); + $string = Mockery::formatObjects(array($obj)); + + $this->assertNotContains('getExcluded', $string); + } +} + +class ClassWithGetter +{ + private $dep; + + public function __construct($dep) + { + $this->dep = $dep; + } + + public function getFoo() + { + return $this->dep->doBar('bar', $this); + } +} + +class ClassWithGetterWithParam +{ + public function getBar($bar) + { + } +} + +class ClassWithPublicStaticProperty +{ + public static $excludedProperty; +} + +class ClassWithPublicStaticGetter +{ + public static function getExcluded() + { + } +} diff --git a/vendor/mockery/mockery/tests/Mockery/_files/file.txt b/vendor/mockery/mockery/tests/Mockery/_files/file.txt new file mode 100644 index 0000000..e69de29 diff --git a/vendor/mockery/mockery/tests/PHP56/MockingOldStyleConstructorTest.php b/vendor/mockery/mockery/tests/PHP56/MockingOldStyleConstructorTest.php new file mode 100644 index 0000000..89e66c0 --- /dev/null +++ b/vendor/mockery/mockery/tests/PHP56/MockingOldStyleConstructorTest.php @@ -0,0 +1,44 @@ +assertInstanceOf(MockInterface::class, mock('MockeryTest_OldStyleConstructor')); + } +} + +class MockeryTest_OldStyleConstructor +{ + public function MockeryTest_OldStyleConstructor($arg) + { + } +} diff --git a/vendor/mockery/mockery/tests/PHP70/Generator/StringManipulation/Pass/MagicMethodTypeHintsPassTest.php b/vendor/mockery/mockery/tests/PHP70/Generator/StringManipulation/Pass/MagicMethodTypeHintsPassTest.php new file mode 100644 index 0000000..a1957ff --- /dev/null +++ b/vendor/mockery/mockery/tests/PHP70/Generator/StringManipulation/Pass/MagicMethodTypeHintsPassTest.php @@ -0,0 +1,392 @@ +pass = new MagicMethodTypeHintsPass; + $this->mockedConfiguration = m::mock( + 'Mockery\Generator\MockConfiguration' + ); + } + + /** + * @test + */ + public function itShouldWork() + { + $this->assertTrue(true); + } + + /** + * @test + */ + public function itShouldGrabClassMagicMethods() + { + $targetClass = DefinedTargetClass::factory( + 'Mockery\Test\Generator\StringManipulation\Pass\MagicDummy' + ); + $magicMethods = $this->pass->getMagicMethods($targetClass); + + $this->assertCount(6, $magicMethods); + $this->assertEquals('__isset', $magicMethods[0]->getName()); + } + + /** + * @test + */ + public function itShouldGrabInterfaceMagicMethods() + { + $targetClass = DefinedTargetClass::factory( + 'Mockery\Test\Generator\StringManipulation\Pass\MagicInterfaceDummy' + ); + $magicMethods = $this->pass->getMagicMethods($targetClass); + + $this->assertCount(6, $magicMethods); + $this->assertEquals('__isset', $magicMethods[0]->getName()); + } + + /** + * @test + */ + public function itShouldAddStringTypeHintOnMagicMethod() + { + $this->configureForClass(); + $code = $this->pass->apply( + 'public function __isset($name) {}', + $this->mockedConfiguration + ); + $this->assertContains('string $name', $code); + + $this->configureForInterface(); + $code = $this->pass->apply( + 'public function __isset($name) {}', + $this->mockedConfiguration + ); + $this->assertContains('string $name', $code); + } + + /** + * @test + */ + public function itShouldAddStringTypeHintOnAllMagicMethods() + { + $this->configureForInterfaces([ + 'Mockery\Test\Generator\StringManipulation\Pass\MagicInterfaceDummy', + 'Mockery\Test\Generator\StringManipulation\Pass\MagicUnsetInterfaceDummy' + ]); + $code = $this->pass->apply( + 'public function __isset($name) {}', + $this->mockedConfiguration + ); + $this->assertContains('string $name', $code); + $code = $this->pass->apply( + 'public function __unset($name) {}', + $this->mockedConfiguration + ); + $this->assertContains('string $name', $code); + } + + /** + * @test + */ + public function itShouldAddBooleanReturnOnMagicMethod() + { + $this->configureForClass(); + $code = $this->pass->apply( + 'public function __isset($name) {}', + $this->mockedConfiguration + ); + $this->assertContains(' : bool', $code); + + $this->configureForInterface(); + $code = $this->pass->apply( + 'public function __isset($name) {}', + $this->mockedConfiguration + ); + $this->assertContains(' : bool', $code); + } + + /** + * @test + */ + public function itShouldAddTypeHintsOnToStringMethod() + { + $this->configureForClass(); + $code = $this->pass->apply( + 'public function __toString() {}', + $this->mockedConfiguration + ); + $this->assertContains(' : string', $code); + + $this->configureForInterface(); + $code = $this->pass->apply( + 'public function __toString() {}', + $this->mockedConfiguration + ); + $this->assertContains(' : string', $code); + } + + /** + * @test + */ + public function itShouldAddTypeHintsOnCallMethod() + { + $this->configureForClass(); + $code = $this->pass->apply( + 'public function __call($method, array $args) {}', + $this->mockedConfiguration + ); + $this->assertContains('string $method', $code); + + $this->configureForInterface(); + $code = $this->pass->apply( + 'public function __call($method, array $args) {}', + $this->mockedConfiguration + ); + $this->assertContains('string $method', $code); + } + + /** + * @test + */ + public function itShouldAddTypeHintsOnCallStaticMethod() + { + $this->configureForClass(); + $code = $this->pass->apply( + 'public static function __callStatic($method, array $args) {}', + $this->mockedConfiguration + ); + $this->assertContains('string $method', $code); + + $this->configureForInterface(); + $code = $this->pass->apply( + 'public static function __callStatic($method, array $args) {}', + $this->mockedConfiguration + ); + $this->assertContains('string $method', $code); + } + + /** + * @test + */ + public function itShouldNotAddReturnTypeHintIfOneIsNotFound() + { + $this->configureForClass('Mockery\Test\Generator\StringManipulation\Pass\MagicReturnDummy'); + $code = $this->pass->apply( + 'public static function __isset($parameter) {}', + $this->mockedConfiguration + ); + $this->assertContains(') {', $code); + + $this->configureForInterface('Mockery\Test\Generator\StringManipulation\Pass\MagicReturnInterfaceDummy'); + $code = $this->pass->apply( + 'public static function __isset($parameter) {}', + $this->mockedConfiguration + ); + $this->assertContains(') {', $code); + } + + /** + * @test + */ + public function itShouldReturnEmptyArrayIfClassDoesNotHaveMagicMethods() + { + $targetClass = DefinedTargetClass::factory( + '\StdClass' + ); + $magicMethods = $this->pass->getMagicMethods($targetClass); + $this->assertInternalType('array', $magicMethods); + $this->assertEmpty($magicMethods); + } + + /** + * @test + */ + public function itShouldReturnEmptyArrayIfClassTypeIsNotExpected() + { + $magicMethods = $this->pass->getMagicMethods(null); + $this->assertInternalType('array', $magicMethods); + $this->assertEmpty($magicMethods); + } + + /** + * Tests if the pass correclty replaces all the magic + * method parameters with those found in the + * Mock class. This is made to avoid variable + * conflicts withing Mock's magic methods + * implementations. + * + * @test + */ + public function itShouldGrabAndReplaceAllParametersWithTheCodeStringMatches() + { + $this->configureForClass(); + $code = $this->pass->apply( + 'public function __call($method, array $args) {}', + $this->mockedConfiguration + ); + $this->assertContains('$method', $code); + $this->assertContains('array $args', $code); + + $this->configureForInterface(); + $code = $this->pass->apply( + 'public function __call($method, array $args) {}', + $this->mockedConfiguration + ); + $this->assertContains('$method', $code); + $this->assertContains('array $args', $code); + } + + protected function configureForClass(string $className = 'Mockery\Test\Generator\StringManipulation\Pass\MagicDummy') + { + $targetClass = DefinedTargetClass::factory($className); + + $this->mockedConfiguration + ->shouldReceive('getTargetClass') + ->andReturn($targetClass) + ->byDefault(); + $this->mockedConfiguration + ->shouldReceive('getTargetInterfaces') + ->andReturn([]) + ->byDefault(); + } + + protected function configureForInterface(string $interfaceName = 'Mockery\Test\Generator\StringManipulation\Pass\MagicDummy') + { + $targetInterface = DefinedTargetClass::factory($interfaceName); + + $this->mockedConfiguration + ->shouldReceive('getTargetClass') + ->andReturn(null) + ->byDefault(); + $this->mockedConfiguration + ->shouldReceive('getTargetInterfaces') + ->andReturn([$targetInterface]) + ->byDefault(); + } + + protected function configureForInterfaces(array $interfaceNames) + { + $targetInterfaces = array_map([DefinedTargetClass::class, 'factory'], $interfaceNames); + + $this->mockedConfiguration + ->shouldReceive('getTargetClass') + ->andReturn(null) + ->byDefault(); + $this->mockedConfiguration + ->shouldReceive('getTargetInterfaces') + ->andReturn($targetInterfaces) + ->byDefault(); + } +} + +class MagicDummy +{ + public function __isset(string $name) : bool + { + return false; + } + + public function __toString() : string + { + return ''; + } + + public function __wakeup() + { + } + + public function __destruct() + { + } + + public function __call(string $name, array $arguments) : string + { + } + + public static function __callStatic(string $name, array $arguments) : int + { + } + + public function nonMagicMethod() + { + } +} + +class MagicReturnDummy +{ + public function __isset(string $name) + { + return false; + } +} + +interface MagicInterfaceDummy +{ + public function __isset(string $name) : bool; + + public function __toString() : string; + + public function __wakeup(); + + public function __destruct(); + + public function __call(string $name, array $arguments) : string; + + public static function __callStatic(string $name, array $arguments) : int; + + public function nonMagicMethod(); +} + +interface MagicReturnInterfaceDummy +{ + public function __isset(string $name); +} + +interface MagicUnsetInterfaceDummy +{ + public function __unset(string $name); +} diff --git a/vendor/mockery/mockery/tests/PHP70/MockingParameterAndReturnTypesTest.php b/vendor/mockery/mockery/tests/PHP70/MockingParameterAndReturnTypesTest.php new file mode 100644 index 0000000..690625f --- /dev/null +++ b/vendor/mockery/mockery/tests/PHP70/MockingParameterAndReturnTypesTest.php @@ -0,0 +1,177 @@ +shouldReceive("returnString"); + $this->assertSame("", $mock->returnString()); + } + + public function testMockingIntegerReturnType() + { + $mock = mock("test\Mockery\TestWithParameterAndReturnType"); + + $mock->shouldReceive("returnInteger"); + $this->assertSame(0, $mock->returnInteger()); + } + + public function testMockingFloatReturnType() + { + $mock = mock("test\Mockery\TestWithParameterAndReturnType"); + + $mock->shouldReceive("returnFloat"); + $this->assertSame(0.0, $mock->returnFloat()); + } + + public function testMockingBooleanReturnType() + { + $mock = mock("test\Mockery\TestWithParameterAndReturnType"); + + $mock->shouldReceive("returnBoolean"); + $this->assertFalse($mock->returnBoolean()); + } + + public function testMockingArrayReturnType() + { + $mock = mock("test\Mockery\TestWithParameterAndReturnType"); + + $mock->shouldReceive("returnArray"); + $this->assertSame([], $mock->returnArray()); + } + + public function testMockingGeneratorReturnTyps() + { + $mock = mock("test\Mockery\TestWithParameterAndReturnType"); + + $mock->shouldReceive("returnGenerator"); + $this->assertInstanceOf("\Generator", $mock->returnGenerator()); + } + + public function testMockingCallableReturnType() + { + $mock = mock("test\Mockery\TestWithParameterAndReturnType"); + + $mock->shouldReceive("returnCallable"); + $this->assertInternalType('callable', $mock->returnCallable()); + } + + public function testMockingClassReturnTypes() + { + $mock = mock("test\Mockery\TestWithParameterAndReturnType"); + + $mock->shouldReceive("withClassReturnType"); + $this->assertInstanceOf("test\Mockery\TestWithParameterAndReturnType", $mock->withClassReturnType()); + } + + public function testMockingParameterTypes() + { + $mock = mock("test\Mockery\TestWithParameterAndReturnType"); + + $mock->shouldReceive("withScalarParameters"); + $mock->withScalarParameters(1, 1.0, true, 'string'); + } + + public function testIgnoringMissingReturnsType() + { + $mock = mock("test\Mockery\TestWithParameterAndReturnType"); + + $mock->shouldIgnoreMissing(); + + $this->assertSame('', $mock->returnString()); + $this->assertSame(0, $mock->returnInteger()); + $this->assertSame(0.0, $mock->returnFloat()); + $this->assertFalse( $mock->returnBoolean()); + $this->assertSame([], $mock->returnArray()); + $this->assertInternalType('callable', $mock->returnCallable()); + $this->assertInstanceOf("\Generator", $mock->returnGenerator()); + $this->assertInstanceOf("test\Mockery\TestWithParameterAndReturnType", $mock->withClassReturnType()); + } + + public function testAutoStubbingSelf() + { + $spy = \Mockery::spy("test\Mockery\TestWithParameterAndReturnType"); + + $this->assertInstanceOf("test\Mockery\TestWithParameterAndReturnType", $spy->returnSelf()); + } + + public function testItShouldMockClassWithHintedParamsInMagicMethod() + { + $this->assertNotNull( + \Mockery::mock('test\Mockery\MagicParams') + ); + } + + public function testItShouldMockClassWithHintedReturnInMagicMethod() + { + $this->assertNotNull( + \Mockery::mock('test\Mockery\MagicReturns') + ); + } +} + +class MagicParams +{ + public function __isset(string $property) + { + return false; + } +} + +class MagicReturns +{ + public function __isset($property) : bool + { + return false; + } +} + +abstract class TestWithParameterAndReturnType +{ + public function returnString(): string {} + + public function returnInteger(): int {} + + public function returnFloat(): float {} + + public function returnBoolean(): bool {} + + public function returnArray(): array {} + + public function returnCallable(): callable {} + + public function returnGenerator(): \Generator {} + + public function withClassReturnType(): TestWithParameterAndReturnType {} + + public function withScalarParameters(int $integer, float $float, bool $boolean, string $string) {} + + public function returnSelf(): self {} +} diff --git a/vendor/mockery/mockery/tests/PHP72/Php72LanguageFeaturesTest.php b/vendor/mockery/mockery/tests/PHP72/Php72LanguageFeaturesTest.php new file mode 100644 index 0000000..f6fb957 --- /dev/null +++ b/vendor/mockery/mockery/tests/PHP72/Php72LanguageFeaturesTest.php @@ -0,0 +1,45 @@ +allows()->foo($object); + + $mock->foo($object); + } + + /** @test */ + public function it_can_mock_a_class_with_an_object_return_type_hint() + { + $mock = spy(ReturnTypeObjectTypeHint::class); + + $object = $mock->foo(); + + $this->assertTrue(is_object($object)); + } +} + +class ArgumentObjectTypeHint +{ + public function foo(object $foo) + { + } +} + +class ReturnTypeObjectTypeHint +{ + public function foo(): object + { + } +} diff --git a/vendor/monolog/monolog/.php_cs b/vendor/monolog/monolog/.php_cs new file mode 100644 index 0000000..366ccd0 --- /dev/null +++ b/vendor/monolog/monolog/.php_cs @@ -0,0 +1,59 @@ + + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +EOF; + +$finder = Symfony\CS\Finder::create() + ->files() + ->name('*.php') + ->exclude('Fixtures') + ->in(__DIR__.'/src') + ->in(__DIR__.'/tests') +; + +return Symfony\CS\Config::create() + ->setUsingCache(true) + //->setUsingLinter(false) + ->setRiskyAllowed(true) + ->setRules(array( + '@PSR2' => true, + 'binary_operator_spaces' => true, + 'blank_line_before_return' => true, + 'header_comment' => array('header' => $header), + 'include' => true, + 'long_array_syntax' => true, + 'method_separation' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_blank_lines_between_uses' => true, + 'no_duplicate_semicolons' => true, + 'no_extra_consecutive_blank_lines' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_unused_imports' => true, + 'object_operator_without_whitespace' => true, + 'phpdoc_align' => true, + 'phpdoc_indent' => true, + 'phpdoc_no_access' => true, + 'phpdoc_no_package' => true, + 'phpdoc_order' => true, + 'phpdoc_scalar' => true, + 'phpdoc_trim' => true, + 'phpdoc_type_to_var' => true, + 'psr0' => true, + 'single_blank_line_before_namespace' => true, + 'spaces_cast' => true, + 'standardize_not_equals' => true, + 'ternary_operator_spaces' => true, + 'trailing_comma_in_multiline_array' => true, + 'whitespacy_lines' => true, + )) + ->finder($finder) +; diff --git a/vendor/monolog/monolog/CHANGELOG.md b/vendor/monolog/monolog/CHANGELOG.md new file mode 100644 index 0000000..bcf679c --- /dev/null +++ b/vendor/monolog/monolog/CHANGELOG.md @@ -0,0 +1,370 @@ +### 1.24.0 (2018-11-05) + + * Added a `ResettableInterface` in order to reset/reset/clear/flush handlers and processors + * Added a `ProcessorInterface` as an optional way to label a class as being a processor (mostly useful for autowiring dependency containers) + * Added a way to log signals being received using Monolog\SignalHandler + * Added ability to customize error handling at the Logger level using Logger::setExceptionHandler + * Added InsightOpsHandler to migrate users of the LogEntriesHandler + * Added protection to NormalizerHandler against circular and very deep structures, it now stops normalizing at a depth of 9 + * Added capture of stack traces to ErrorHandler when logging PHP errors + * Added RavenHandler support for a `contexts` context or extra key to forward that to Sentry's contexts + * Added forwarding of context info to FluentdFormatter + * Added SocketHandler::setChunkSize to override the default chunk size in case you must send large log lines to rsyslog for example + * Added ability to extend/override BrowserConsoleHandler + * Added SlackWebhookHandler::getWebhookUrl and SlackHandler::getToken to enable class extensibility + * Added SwiftMailerHandler::getSubjectFormatter to enable class extensibility + * Dropped official support for HHVM in test builds + * Fixed normalization of exception traces when call_user_func is used to avoid serializing objects and the data they contain + * Fixed naming of fields in Slack handler, all field names are now capitalized in all cases + * Fixed HipChatHandler bug where slack dropped messages randomly + * Fixed normalization of objects in Slack handlers + * Fixed support for PHP7's Throwable in NewRelicHandler + * Fixed race bug when StreamHandler sometimes incorrectly reported it failed to create a directory + * Fixed table row styling issues in HtmlFormatter + * Fixed RavenHandler dropping the message when logging exception + * Fixed WhatFailureGroupHandler skipping processors when using handleBatch + and implement it where possible + * Fixed display of anonymous class names + +### 1.23.0 (2017-06-19) + + * Improved SyslogUdpHandler's support for RFC5424 and added optional `$ident` argument + * Fixed GelfHandler truncation to be per field and not per message + * Fixed compatibility issue with PHP <5.3.6 + * Fixed support for headless Chrome in ChromePHPHandler + * Fixed support for latest Aws SDK in DynamoDbHandler + * Fixed support for SwiftMailer 6.0+ in SwiftMailerHandler + +### 1.22.1 (2017-03-13) + + * Fixed lots of minor issues in the new Slack integrations + * Fixed support for allowInlineLineBreaks in LineFormatter when formatting exception backtraces + +### 1.22.0 (2016-11-26) + + * Added SlackbotHandler and SlackWebhookHandler to set up Slack integration more easily + * Added MercurialProcessor to add mercurial revision and branch names to log records + * Added support for AWS SDK v3 in DynamoDbHandler + * Fixed fatal errors occuring when normalizing generators that have been fully consumed + * Fixed RollbarHandler to include a level (rollbar level), monolog_level (original name), channel and datetime (unix) + * Fixed RollbarHandler not flushing records automatically, calling close() explicitly is not necessary anymore + * Fixed SyslogUdpHandler to avoid sending empty frames + * Fixed a few PHP 7.0 and 7.1 compatibility issues + +### 1.21.0 (2016-07-29) + + * Break: Reverted the addition of $context when the ErrorHandler handles regular php errors from 1.20.0 as it was causing issues + * Added support for more formats in RotatingFileHandler::setFilenameFormat as long as they have Y, m and d in order + * Added ability to format the main line of text the SlackHandler sends by explictly setting a formatter on the handler + * Added information about SoapFault instances in NormalizerFormatter + * Added $handleOnlyReportedErrors option on ErrorHandler::registerErrorHandler (default true) to allow logging of all errors no matter the error_reporting level + +### 1.20.0 (2016-07-02) + + * Added FingersCrossedHandler::activate() to manually trigger the handler regardless of the activation policy + * Added StreamHandler::getUrl to retrieve the stream's URL + * Added ability to override addRow/addTitle in HtmlFormatter + * Added the $context to context information when the ErrorHandler handles a regular php error + * Deprecated RotatingFileHandler::setFilenameFormat to only support 3 formats: Y, Y-m and Y-m-d + * Fixed WhatFailureGroupHandler to work with PHP7 throwables + * Fixed a few minor bugs + +### 1.19.0 (2016-04-12) + + * Break: StreamHandler will not close streams automatically that it does not own. If you pass in a stream (not a path/url), then it will not close it for you. You can retrieve those using getStream() if needed + * Added DeduplicationHandler to remove duplicate records from notifications across multiple requests, useful for email or other notifications on errors + * Added ability to use `%message%` and other LineFormatter replacements in the subject line of emails sent with NativeMailHandler and SwiftMailerHandler + * Fixed HipChatHandler handling of long messages + +### 1.18.2 (2016-04-02) + + * Fixed ElasticaFormatter to use more precise dates + * Fixed GelfMessageFormatter sending too long messages + +### 1.18.1 (2016-03-13) + + * Fixed SlackHandler bug where slack dropped messages randomly + * Fixed RedisHandler issue when using with the PHPRedis extension + * Fixed AmqpHandler content-type being incorrectly set when using with the AMQP extension + * Fixed BrowserConsoleHandler regression + +### 1.18.0 (2016-03-01) + + * Added optional reduction of timestamp precision via `Logger->useMicrosecondTimestamps(false)`, disabling it gets you a bit of performance boost but reduces the precision to the second instead of microsecond + * Added possibility to skip some extra stack frames in IntrospectionProcessor if you have some library wrapping Monolog that is always adding frames + * Added `Logger->withName` to clone a logger (keeping all handlers) with a new name + * Added FluentdFormatter for the Fluentd unix socket protocol + * Added HandlerWrapper base class to ease the creation of handler wrappers, just extend it and override as needed + * Added support for replacing context sub-keys using `%context.*%` in LineFormatter + * Added support for `payload` context value in RollbarHandler + * Added setRelease to RavenHandler to describe the application version, sent with every log + * Added support for `fingerprint` context value in RavenHandler + * Fixed JSON encoding errors that would gobble up the whole log record, we now handle those more gracefully by dropping chars as needed + * Fixed write timeouts in SocketHandler and derivatives, set to 10sec by default, lower it with `setWritingTimeout()` + * Fixed PHP7 compatibility with regard to Exception/Throwable handling in a few places + +### 1.17.2 (2015-10-14) + + * Fixed ErrorHandler compatibility with non-Monolog PSR-3 loggers + * Fixed SlackHandler handling to use slack functionalities better + * Fixed SwiftMailerHandler bug when sending multiple emails they all had the same id + * Fixed 5.3 compatibility regression + +### 1.17.1 (2015-08-31) + + * Fixed RollbarHandler triggering PHP notices + +### 1.17.0 (2015-08-30) + + * Added support for `checksum` and `release` context/extra values in RavenHandler + * Added better support for exceptions in RollbarHandler + * Added UidProcessor::getUid + * Added support for showing the resource type in NormalizedFormatter + * Fixed IntrospectionProcessor triggering PHP notices + +### 1.16.0 (2015-08-09) + + * Added IFTTTHandler to notify ifttt.com triggers + * Added Logger::setHandlers() to allow setting/replacing all handlers + * Added $capSize in RedisHandler to cap the log size + * Fixed StreamHandler creation of directory to only trigger when the first log write happens + * Fixed bug in the handling of curl failures + * Fixed duplicate logging of fatal errors when both error and fatal error handlers are registered in monolog's ErrorHandler + * Fixed missing fatal errors records with handlers that need to be closed to flush log records + * Fixed TagProcessor::addTags support for associative arrays + +### 1.15.0 (2015-07-12) + + * Added addTags and setTags methods to change a TagProcessor + * Added automatic creation of directories if they are missing for a StreamHandler to open a log file + * Added retry functionality to Loggly, Cube and Mandrill handlers so they retry up to 5 times in case of network failure + * Fixed process exit code being incorrectly reset to 0 if ErrorHandler::registerExceptionHandler was used + * Fixed HTML/JS escaping in BrowserConsoleHandler + * Fixed JSON encoding errors being silently suppressed (PHP 5.5+ only) + +### 1.14.0 (2015-06-19) + + * Added PHPConsoleHandler to send record to Chrome's PHP Console extension and library + * Added support for objects implementing __toString in the NormalizerFormatter + * Added support for HipChat's v2 API in HipChatHandler + * Added Logger::setTimezone() to initialize the timezone monolog should use in case date.timezone isn't correct for your app + * Added an option to send formatted message instead of the raw record on PushoverHandler via ->useFormattedMessage(true) + * Fixed curl errors being silently suppressed + +### 1.13.1 (2015-03-09) + + * Fixed regression in HipChat requiring a new token to be created + +### 1.13.0 (2015-03-05) + + * Added Registry::hasLogger to check for the presence of a logger instance + * Added context.user support to RavenHandler + * Added HipChat API v2 support in the HipChatHandler + * Added NativeMailerHandler::addParameter to pass params to the mail() process + * Added context data to SlackHandler when $includeContextAndExtra is true + * Added ability to customize the Swift_Message per-email in SwiftMailerHandler + * Fixed SwiftMailerHandler to lazily create message instances if a callback is provided + * Fixed serialization of INF and NaN values in Normalizer and LineFormatter + +### 1.12.0 (2014-12-29) + + * Break: HandlerInterface::isHandling now receives a partial record containing only a level key. This was always the intent and does not break any Monolog handler but is strictly speaking a BC break and you should check if you relied on any other field in your own handlers. + * Added PsrHandler to forward records to another PSR-3 logger + * Added SamplingHandler to wrap around a handler and include only every Nth record + * Added MongoDBFormatter to support better storage with MongoDBHandler (it must be enabled manually for now) + * Added exception codes in the output of most formatters + * Added LineFormatter::includeStacktraces to enable exception stack traces in logs (uses more than one line) + * Added $useShortAttachment to SlackHandler to minify attachment size and $includeExtra to append extra data + * Added $host to HipChatHandler for users of private instances + * Added $transactionName to NewRelicHandler and support for a transaction_name context value + * Fixed MandrillHandler to avoid outputing API call responses + * Fixed some non-standard behaviors in SyslogUdpHandler + +### 1.11.0 (2014-09-30) + + * Break: The NewRelicHandler extra and context data are now prefixed with extra_ and context_ to avoid clashes. Watch out if you have scripts reading those from the API and rely on names + * Added WhatFailureGroupHandler to suppress any exception coming from the wrapped handlers and avoid chain failures if a logging service fails + * Added MandrillHandler to send emails via the Mandrillapp.com API + * Added SlackHandler to log records to a Slack.com account + * Added FleepHookHandler to log records to a Fleep.io account + * Added LogglyHandler::addTag to allow adding tags to an existing handler + * Added $ignoreEmptyContextAndExtra to LineFormatter to avoid empty [] at the end + * Added $useLocking to StreamHandler and RotatingFileHandler to enable flock() while writing + * Added support for PhpAmqpLib in the AmqpHandler + * Added FingersCrossedHandler::clear and BufferHandler::clear to reset them between batches in long running jobs + * Added support for adding extra fields from $_SERVER in the WebProcessor + * Fixed support for non-string values in PrsLogMessageProcessor + * Fixed SwiftMailer messages being sent with the wrong date in long running scripts + * Fixed minor PHP 5.6 compatibility issues + * Fixed BufferHandler::close being called twice + +### 1.10.0 (2014-06-04) + + * Added Logger::getHandlers() and Logger::getProcessors() methods + * Added $passthruLevel argument to FingersCrossedHandler to let it always pass some records through even if the trigger level is not reached + * Added support for extra data in NewRelicHandler + * Added $expandNewlines flag to the ErrorLogHandler to create multiple log entries when a message has multiple lines + +### 1.9.1 (2014-04-24) + + * Fixed regression in RotatingFileHandler file permissions + * Fixed initialization of the BufferHandler to make sure it gets flushed after receiving records + * Fixed ChromePHPHandler and FirePHPHandler's activation strategies to be more conservative + +### 1.9.0 (2014-04-20) + + * Added LogEntriesHandler to send logs to a LogEntries account + * Added $filePermissions to tweak file mode on StreamHandler and RotatingFileHandler + * Added $useFormatting flag to MemoryProcessor to make it send raw data in bytes + * Added support for table formatting in FirePHPHandler via the table context key + * Added a TagProcessor to add tags to records, and support for tags in RavenHandler + * Added $appendNewline flag to the JsonFormatter to enable using it when logging to files + * Added sound support to the PushoverHandler + * Fixed multi-threading support in StreamHandler + * Fixed empty headers issue when ChromePHPHandler received no records + * Fixed default format of the ErrorLogHandler + +### 1.8.0 (2014-03-23) + + * Break: the LineFormatter now strips newlines by default because this was a bug, set $allowInlineLineBreaks to true if you need them + * Added BrowserConsoleHandler to send logs to any browser's console via console.log() injection in the output + * Added FilterHandler to filter records and only allow those of a given list of levels through to the wrapped handler + * Added FlowdockHandler to send logs to a Flowdock account + * Added RollbarHandler to send logs to a Rollbar account + * Added HtmlFormatter to send prettier log emails with colors for each log level + * Added GitProcessor to add the current branch/commit to extra record data + * Added a Monolog\Registry class to allow easier global access to pre-configured loggers + * Added support for the new official graylog2/gelf-php lib for GelfHandler, upgrade if you can by replacing the mlehner/gelf-php requirement + * Added support for HHVM + * Added support for Loggly batch uploads + * Added support for tweaking the content type and encoding in NativeMailerHandler + * Added $skipClassesPartials to tweak the ignored classes in the IntrospectionProcessor + * Fixed batch request support in GelfHandler + +### 1.7.0 (2013-11-14) + + * Added ElasticSearchHandler to send logs to an Elastic Search server + * Added DynamoDbHandler and ScalarFormatter to send logs to Amazon's Dynamo DB + * Added SyslogUdpHandler to send logs to a remote syslogd server + * Added LogglyHandler to send logs to a Loggly account + * Added $level to IntrospectionProcessor so it only adds backtraces when needed + * Added $version to LogstashFormatter to allow using the new v1 Logstash format + * Added $appName to NewRelicHandler + * Added configuration of Pushover notification retries/expiry + * Added $maxColumnWidth to NativeMailerHandler to change the 70 chars default + * Added chainability to most setters for all handlers + * Fixed RavenHandler batch processing so it takes the message from the record with highest priority + * Fixed HipChatHandler batch processing so it sends all messages at once + * Fixed issues with eAccelerator + * Fixed and improved many small things + +### 1.6.0 (2013-07-29) + + * Added HipChatHandler to send logs to a HipChat chat room + * Added ErrorLogHandler to send logs to PHP's error_log function + * Added NewRelicHandler to send logs to NewRelic's service + * Added Monolog\ErrorHandler helper class to register a Logger as exception/error/fatal handler + * Added ChannelLevelActivationStrategy for the FingersCrossedHandler to customize levels by channel + * Added stack traces output when normalizing exceptions (json output & co) + * Added Monolog\Logger::API constant (currently 1) + * Added support for ChromePHP's v4.0 extension + * Added support for message priorities in PushoverHandler, see $highPriorityLevel and $emergencyLevel + * Added support for sending messages to multiple users at once with the PushoverHandler + * Fixed RavenHandler's support for batch sending of messages (when behind a Buffer or FingersCrossedHandler) + * Fixed normalization of Traversables with very large data sets, only the first 1000 items are shown now + * Fixed issue in RotatingFileHandler when an open_basedir restriction is active + * Fixed minor issues in RavenHandler and bumped the API to Raven 0.5.0 + * Fixed SyslogHandler issue when many were used concurrently with different facilities + +### 1.5.0 (2013-04-23) + + * Added ProcessIdProcessor to inject the PID in log records + * Added UidProcessor to inject a unique identifier to all log records of one request/run + * Added support for previous exceptions in the LineFormatter exception serialization + * Added Monolog\Logger::getLevels() to get all available levels + * Fixed ChromePHPHandler so it avoids sending headers larger than Chrome can handle + +### 1.4.1 (2013-04-01) + + * Fixed exception formatting in the LineFormatter to be more minimalistic + * Fixed RavenHandler's handling of context/extra data, requires Raven client >0.1.0 + * Fixed log rotation in RotatingFileHandler to work with long running scripts spanning multiple days + * Fixed WebProcessor array access so it checks for data presence + * Fixed Buffer, Group and FingersCrossed handlers to make use of their processors + +### 1.4.0 (2013-02-13) + + * Added RedisHandler to log to Redis via the Predis library or the phpredis extension + * Added ZendMonitorHandler to log to the Zend Server monitor + * Added the possibility to pass arrays of handlers and processors directly in the Logger constructor + * Added `$useSSL` option to the PushoverHandler which is enabled by default + * Fixed ChromePHPHandler and FirePHPHandler issue when multiple instances are used simultaneously + * Fixed header injection capability in the NativeMailHandler + +### 1.3.1 (2013-01-11) + + * Fixed LogstashFormatter to be usable with stream handlers + * Fixed GelfMessageFormatter levels on Windows + +### 1.3.0 (2013-01-08) + + * Added PSR-3 compliance, the `Monolog\Logger` class is now an instance of `Psr\Log\LoggerInterface` + * Added PsrLogMessageProcessor that you can selectively enable for full PSR-3 compliance + * Added LogstashFormatter (combine with SocketHandler or StreamHandler to send logs to Logstash) + * Added PushoverHandler to send mobile notifications + * Added CouchDBHandler and DoctrineCouchDBHandler + * Added RavenHandler to send data to Sentry servers + * Added support for the new MongoClient class in MongoDBHandler + * Added microsecond precision to log records' timestamps + * Added `$flushOnOverflow` param to BufferHandler to flush by batches instead of losing + the oldest entries + * Fixed normalization of objects with cyclic references + +### 1.2.1 (2012-08-29) + + * Added new $logopts arg to SyslogHandler to provide custom openlog options + * Fixed fatal error in SyslogHandler + +### 1.2.0 (2012-08-18) + + * Added AmqpHandler (for use with AMQP servers) + * Added CubeHandler + * Added NativeMailerHandler::addHeader() to send custom headers in mails + * Added the possibility to specify more than one recipient in NativeMailerHandler + * Added the possibility to specify float timeouts in SocketHandler + * Added NOTICE and EMERGENCY levels to conform with RFC 5424 + * Fixed the log records to use the php default timezone instead of UTC + * Fixed BufferHandler not being flushed properly on PHP fatal errors + * Fixed normalization of exotic resource types + * Fixed the default format of the SyslogHandler to avoid duplicating datetimes in syslog + +### 1.1.0 (2012-04-23) + + * Added Monolog\Logger::isHandling() to check if a handler will + handle the given log level + * Added ChromePHPHandler + * Added MongoDBHandler + * Added GelfHandler (for use with Graylog2 servers) + * Added SocketHandler (for use with syslog-ng for example) + * Added NormalizerFormatter + * Added the possibility to change the activation strategy of the FingersCrossedHandler + * Added possibility to show microseconds in logs + * Added `server` and `referer` to WebProcessor output + +### 1.0.2 (2011-10-24) + + * Fixed bug in IE with large response headers and FirePHPHandler + +### 1.0.1 (2011-08-25) + + * Added MemoryPeakUsageProcessor and MemoryUsageProcessor + * Added Monolog\Logger::getName() to get a logger's channel name + +### 1.0.0 (2011-07-06) + + * Added IntrospectionProcessor to get info from where the logger was called + * Fixed WebProcessor in CLI + +### 1.0.0-RC1 (2011-07-01) + + * Initial release diff --git a/vendor/monolog/monolog/LICENSE b/vendor/monolog/monolog/LICENSE new file mode 100644 index 0000000..1647321 --- /dev/null +++ b/vendor/monolog/monolog/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2011-2016 Jordi Boggiano + +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/monolog/monolog/README.md b/vendor/monolog/monolog/README.md new file mode 100644 index 0000000..d756944 --- /dev/null +++ b/vendor/monolog/monolog/README.md @@ -0,0 +1,94 @@ +# Monolog - Logging for PHP [![Build Status](https://img.shields.io/travis/Seldaek/monolog.svg)](https://travis-ci.org/Seldaek/monolog) + +[![Total Downloads](https://img.shields.io/packagist/dt/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog) +[![Latest Stable Version](https://img.shields.io/packagist/v/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog) + + +Monolog sends your logs to files, sockets, inboxes, databases and various +web services. See the complete list of handlers below. Special handlers +allow you to build advanced logging strategies. + +This library implements the [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) +interface that you can type-hint against in your own libraries to keep +a maximum of interoperability. You can also use it in your applications to +make sure you can always use another compatible logger at a later time. +As of 1.11.0 Monolog public APIs will also accept PSR-3 log levels. +Internally Monolog still uses its own level scheme since it predates PSR-3. + +## Installation + +Install the latest version with + +```bash +$ composer require monolog/monolog +``` + +## Basic Usage + +```php +pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING)); + +// add records to the log +$log->addWarning('Foo'); +$log->addError('Bar'); +``` + +## Documentation + +- [Usage Instructions](doc/01-usage.md) +- [Handlers, Formatters and Processors](doc/02-handlers-formatters-processors.md) +- [Utility classes](doc/03-utilities.md) +- [Extending Monolog](doc/04-extending.md) + +## Third Party Packages + +Third party handlers, formatters and processors are +[listed in the wiki](https://github.com/Seldaek/monolog/wiki/Third-Party-Packages). You +can also add your own there if you publish one. + +## About + +### Requirements + +- Monolog works with PHP 5.3 or above, and is also tested to work with HHVM. + +### Submitting bugs and feature requests + +Bugs and feature request are tracked on [GitHub](https://github.com/Seldaek/monolog/issues) + +### Framework Integrations + +- Frameworks and libraries using [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) + can be used very easily with Monolog since it implements the interface. +- [Symfony2](http://symfony.com) comes out of the box with Monolog. +- [Silex](http://silex.sensiolabs.org/) comes out of the box with Monolog. +- [Laravel 4 & 5](http://laravel.com/) come out of the box with Monolog. +- [Lumen](http://lumen.laravel.com/) comes out of the box with Monolog. +- [PPI](http://www.ppi.io/) comes out of the box with Monolog. +- [CakePHP](http://cakephp.org/) is usable with Monolog via the [cakephp-monolog](https://github.com/jadb/cakephp-monolog) plugin. +- [Slim](http://www.slimframework.com/) is usable with Monolog via the [Slim-Monolog](https://github.com/Flynsarmy/Slim-Monolog) log writer. +- [XOOPS 2.6](http://xoops.org/) comes out of the box with Monolog. +- [Aura.Web_Project](https://github.com/auraphp/Aura.Web_Project) comes out of the box with Monolog. +- [Nette Framework](http://nette.org/en/) can be used with Monolog via [Kdyby/Monolog](https://github.com/Kdyby/Monolog) extension. +- [Proton Micro Framework](https://github.com/alexbilbie/Proton) comes out of the box with Monolog. + +### Author + +Jordi Boggiano - -
+See also the list of [contributors](https://github.com/Seldaek/monolog/contributors) which participated in this project. + +### License + +Monolog is licensed under the MIT License - see the `LICENSE` file for details + +### Acknowledgements + +This library is heavily inspired by Python's [Logbook](http://packages.python.org/Logbook/) +library, although most concepts have been adjusted to fit to the PHP world. diff --git a/vendor/monolog/monolog/composer.json b/vendor/monolog/monolog/composer.json new file mode 100644 index 0000000..3b0c880 --- /dev/null +++ b/vendor/monolog/monolog/composer.json @@ -0,0 +1,66 @@ +{ + "name": "monolog/monolog", + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "keywords": ["log", "logging", "psr-3"], + "homepage": "http://github.com/Seldaek/monolog", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.5", + "graylog2/gelf-php": "~1.0", + "sentry/sentry": "^0.13", + "ruflin/elastica": ">=0.90 <3.0", + "doctrine/couchdb": "~1.0@dev", + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "php-amqplib/php-amqplib": "~2.4", + "swiftmailer/swiftmailer": "^5.3|^6.0", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit-mock-objects": "2.3.0", + "jakub-onderka/php-parallel-lint": "0.9" + }, + "_": "phpunit/phpunit-mock-objects required in 2.3.0 due to https://github.com/sebastianbergmann/phpunit-mock-objects/issues/223 - needs hhvm 3.8+ on travis", + "suggest": { + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "sentry/sentry": "Allow sending log messages to a Sentry server", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "php-console/php-console": "Allow sending log messages to Google Chrome" + }, + "autoload": { + "psr-4": {"Monolog\\": "src/Monolog"} + }, + "autoload-dev": { + "psr-4": {"Monolog\\": "tests/Monolog"} + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "scripts": { + "test": [ + "parallel-lint . --exclude vendor", + "phpunit" + ] + } +} diff --git a/vendor/monolog/monolog/doc/01-usage.md b/vendor/monolog/monolog/doc/01-usage.md new file mode 100644 index 0000000..8e2551f --- /dev/null +++ b/vendor/monolog/monolog/doc/01-usage.md @@ -0,0 +1,231 @@ +# Using Monolog + +- [Installation](#installation) +- [Core Concepts](#core-concepts) +- [Log Levels](#log-levels) +- [Configuring a logger](#configuring-a-logger) +- [Adding extra data in the records](#adding-extra-data-in-the-records) +- [Leveraging channels](#leveraging-channels) +- [Customizing the log format](#customizing-the-log-format) + +## Installation + +Monolog is available on Packagist ([monolog/monolog](http://packagist.org/packages/monolog/monolog)) +and as such installable via [Composer](http://getcomposer.org/). + +```bash +composer require monolog/monolog +``` + +If you do not use Composer, you can grab the code from GitHub, and use any +PSR-0 compatible autoloader (e.g. the [Symfony2 ClassLoader component](https://github.com/symfony/ClassLoader)) +to load Monolog classes. + +## Core Concepts + +Every `Logger` instance has a channel (name) and a stack of handlers. Whenever +you add a record to the logger, it traverses the handler stack. Each handler +decides whether it fully handled the record, and if so, the propagation of the +record ends there. + +This allows for flexible logging setups, for example having a `StreamHandler` at +the bottom of the stack that will log anything to disk, and on top of that add +a `MailHandler` that will send emails only when an error message is logged. +Handlers also have a `$bubble` property which defines whether they block the +record or not if they handled it. In this example, setting the `MailHandler`'s +`$bubble` argument to false means that records handled by the `MailHandler` will +not propagate to the `StreamHandler` anymore. + +You can create many `Logger`s, each defining a channel (e.g.: db, request, +router, ..) and each of them combining various handlers, which can be shared +or not. The channel is reflected in the logs and allows you to easily see or +filter records. + +Each Handler also has a Formatter, a default one with settings that make sense +will be created if you don't set one. The formatters normalize and format +incoming records so that they can be used by the handlers to output useful +information. + +Custom severity levels are not available. Only the eight +[RFC 5424](http://tools.ietf.org/html/rfc5424) levels (debug, info, notice, +warning, error, critical, alert, emergency) are present for basic filtering +purposes, but for sorting and other use cases that would require +flexibility, you should add Processors to the Logger that can add extra +information (tags, user ip, ..) to the records before they are handled. + +## Log Levels + +Monolog supports the logging levels described by [RFC 5424](http://tools.ietf.org/html/rfc5424). + +- **DEBUG** (100): Detailed debug information. + +- **INFO** (200): Interesting events. Examples: User logs in, SQL logs. + +- **NOTICE** (250): Normal but significant events. + +- **WARNING** (300): Exceptional occurrences that are not errors. Examples: + Use of deprecated APIs, poor use of an API, undesirable things that are not + necessarily wrong. + +- **ERROR** (400): Runtime errors that do not require immediate action but + should typically be logged and monitored. + +- **CRITICAL** (500): Critical conditions. Example: Application component + unavailable, unexpected exception. + +- **ALERT** (550): Action must be taken immediately. Example: Entire website + down, database unavailable, etc. This should trigger the SMS alerts and wake + you up. + +- **EMERGENCY** (600): Emergency: system is unusable. + +## Configuring a logger + +Here is a basic setup to log to a file and to firephp on the DEBUG level: + +```php +pushHandler(new StreamHandler(__DIR__.'/my_app.log', Logger::DEBUG)); +$logger->pushHandler(new FirePHPHandler()); + +// You can now use your logger +$logger->addInfo('My logger is now ready'); +``` + +Let's explain it. The first step is to create the logger instance which will +be used in your code. The argument is a channel name, which is useful when +you use several loggers (see below for more details about it). + +The logger itself does not know how to handle a record. It delegates it to +some handlers. The code above registers two handlers in the stack to allow +handling records in two different ways. + +Note that the FirePHPHandler is called first as it is added on top of the +stack. This allows you to temporarily add a logger with bubbling disabled if +you want to override other configured loggers. + +> If you use Monolog standalone and are looking for an easy way to +> configure many handlers, the [theorchard/monolog-cascade](https://github.com/theorchard/monolog-cascade) +> can help you build complex logging configs via PHP arrays, yaml or json configs. + +## Adding extra data in the records + +Monolog provides two different ways to add extra informations along the simple +textual message. + +### Using the logging context + +The first way is the context, allowing to pass an array of data along the +record: + +```php +addInfo('Adding a new user', array('username' => 'Seldaek')); +``` + +Simple handlers (like the StreamHandler for instance) will simply format +the array to a string but richer handlers can take advantage of the context +(FirePHP is able to display arrays in pretty way for instance). + +### Using processors + +The second way is to add extra data for all records by using a processor. +Processors can be any callable. They will get the record as parameter and +must return it after having eventually changed the `extra` part of it. Let's +write a processor adding some dummy data in the record: + +```php +pushProcessor(function ($record) { + $record['extra']['dummy'] = 'Hello world!'; + + return $record; +}); +``` + +Monolog provides some built-in processors that can be used in your project. +Look at the [dedicated chapter](https://github.com/Seldaek/monolog/blob/master/doc/02-handlers-formatters-processors.md#processors) for the list. + +> Tip: processors can also be registered on a specific handler instead of + the logger to apply only for this handler. + +## Leveraging channels + +Channels are a great way to identify to which part of the application a record +is related. This is useful in big applications (and is leveraged by +MonologBundle in Symfony2). + +Picture two loggers sharing a handler that writes to a single log file. +Channels would allow you to identify the logger that issued every record. +You can easily grep through the log files filtering this or that channel. + +```php +pushHandler($stream); +$logger->pushHandler($firephp); + +// Create a logger for the security-related stuff with a different channel +$securityLogger = new Logger('security'); +$securityLogger->pushHandler($stream); +$securityLogger->pushHandler($firephp); + +// Or clone the first one to only change the channel +$securityLogger = $logger->withName('security'); +``` + +## Customizing the log format + +In Monolog it's easy to customize the format of the logs written into files, +sockets, mails, databases and other handlers. Most of the handlers use the + +```php +$record['formatted'] +``` + +value to be automatically put into the log device. This value depends on the +formatter settings. You can choose between predefined formatter classes or +write your own (e.g. a multiline text file for human-readable output). + +To configure a predefined formatter class, just set it as the handler's field: + +```php +// the default date format is "Y-m-d H:i:s" +$dateFormat = "Y n j, g:i a"; +// the default output format is "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n" +$output = "%datetime% > %level_name% > %message% %context% %extra%\n"; +// finally, create a formatter +$formatter = new LineFormatter($output, $dateFormat); + +// Create a handler +$stream = new StreamHandler(__DIR__.'/my_app.log', Logger::DEBUG); +$stream->setFormatter($formatter); +// bind it to a logger object +$securityLogger = new Logger('security'); +$securityLogger->pushHandler($stream); +``` + +You may also reuse the same formatter between multiple handlers and share those +handlers between multiple loggers. + +[Handlers, Formatters and Processors](02-handlers-formatters-processors.md) → diff --git a/vendor/monolog/monolog/doc/02-handlers-formatters-processors.md b/vendor/monolog/monolog/doc/02-handlers-formatters-processors.md new file mode 100644 index 0000000..af45913 --- /dev/null +++ b/vendor/monolog/monolog/doc/02-handlers-formatters-processors.md @@ -0,0 +1,158 @@ +# Handlers, Formatters and Processors + +- [Handlers](#handlers) + - [Log to files and syslog](#log-to-files-and-syslog) + - [Send alerts and emails](#send-alerts-and-emails) + - [Log specific servers and networked logging](#log-specific-servers-and-networked-logging) + - [Logging in development](#logging-in-development) + - [Log to databases](#log-to-databases) + - [Wrappers / Special Handlers](#wrappers--special-handlers) +- [Formatters](#formatters) +- [Processors](#processors) +- [Third Party Packages](#third-party-packages) + +## Handlers + +### Log to files and syslog + +- _StreamHandler_: Logs records into any PHP stream, use this for log files. +- _RotatingFileHandler_: Logs records to a file and creates one logfile per day. + It will also delete files older than `$maxFiles`. You should use + [logrotate](http://linuxcommand.org/man_pages/logrotate8.html) for high profile + setups though, this is just meant as a quick and dirty solution. +- _SyslogHandler_: Logs records to the syslog. +- _ErrorLogHandler_: Logs records to PHP's + [`error_log()`](http://docs.php.net/manual/en/function.error-log.php) function. + +### Send alerts and emails + +- _NativeMailerHandler_: Sends emails using PHP's + [`mail()`](http://php.net/manual/en/function.mail.php) function. +- _SwiftMailerHandler_: Sends emails using a [`Swift_Mailer`](http://swiftmailer.org/) instance. +- _PushoverHandler_: Sends mobile notifications via the [Pushover](https://www.pushover.net/) API. +- _HipChatHandler_: Logs records to a [HipChat](http://hipchat.com) chat room using its API. +- _FlowdockHandler_: Logs records to a [Flowdock](https://www.flowdock.com/) account. +- _SlackHandler_: Logs records to a [Slack](https://www.slack.com/) account using the Slack API. +- _SlackbotHandler_: Logs records to a [Slack](https://www.slack.com/) account using the Slackbot incoming hook. +- _SlackWebhookHandler_: Logs records to a [Slack](https://www.slack.com/) account using Slack Webhooks. +- _MandrillHandler_: Sends emails via the Mandrill API using a [`Swift_Message`](http://swiftmailer.org/) instance. +- _FleepHookHandler_: Logs records to a [Fleep](https://fleep.io/) conversation using Webhooks. +- _IFTTTHandler_: Notifies an [IFTTT](https://ifttt.com/maker) trigger with the log channel, level name and message. + +### Log specific servers and networked logging + +- _SocketHandler_: Logs records to [sockets](http://php.net/fsockopen), use this + for UNIX and TCP sockets. See an [example](sockets.md). +- _AmqpHandler_: Logs records to an [amqp](http://www.amqp.org/) compatible + server. Requires the [php-amqp](http://pecl.php.net/package/amqp) extension (1.0+). +- _GelfHandler_: Logs records to a [Graylog2](http://www.graylog2.org) server. +- _CubeHandler_: Logs records to a [Cube](http://square.github.com/cube/) server. +- _RavenHandler_: Logs records to a [Sentry](http://getsentry.com/) server using + [raven](https://packagist.org/packages/raven/raven). +- _ZendMonitorHandler_: Logs records to the Zend Monitor present in Zend Server. +- _NewRelicHandler_: Logs records to a [NewRelic](http://newrelic.com/) application. +- _LogglyHandler_: Logs records to a [Loggly](http://www.loggly.com/) account. +- _RollbarHandler_: Logs records to a [Rollbar](https://rollbar.com/) account. +- _SyslogUdpHandler_: Logs records to a remote [Syslogd](http://www.rsyslog.com/) server. +- _LogEntriesHandler_: Logs records to a [LogEntries](http://logentries.com/) account. +- _InsightOpsHandler_: Logs records to a [InsightOps](https://www.rapid7.com/products/insightops/) account. + +### Logging in development + +- _FirePHPHandler_: Handler for [FirePHP](http://www.firephp.org/), providing + inline `console` messages within [FireBug](http://getfirebug.com/). +- _ChromePHPHandler_: Handler for [ChromePHP](http://www.chromephp.com/), providing + inline `console` messages within Chrome. +- _BrowserConsoleHandler_: Handler to send logs to browser's Javascript `console` with + no browser extension required. Most browsers supporting `console` API are supported. +- _PHPConsoleHandler_: Handler for [PHP Console](https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef), providing + inline `console` and notification popup messages within Chrome. + +### Log to databases + +- _RedisHandler_: Logs records to a [redis](http://redis.io) server. +- _MongoDBHandler_: Handler to write records in MongoDB via a + [Mongo](http://pecl.php.net/package/mongo) extension connection. +- _CouchDBHandler_: Logs records to a CouchDB server. +- _DoctrineCouchDBHandler_: Logs records to a CouchDB server via the Doctrine CouchDB ODM. +- _ElasticSearchHandler_: Logs records to an Elastic Search server. +- _DynamoDbHandler_: Logs records to a DynamoDB table with the [AWS SDK](https://github.com/aws/aws-sdk-php). + +### Wrappers / Special Handlers + +- _FingersCrossedHandler_: A very interesting wrapper. It takes a logger as + parameter and will accumulate log records of all levels until a record + exceeds the defined severity level. At which point it delivers all records, + including those of lower severity, to the handler it wraps. This means that + until an error actually happens you will not see anything in your logs, but + when it happens you will have the full information, including debug and info + records. This provides you with all the information you need, but only when + you need it. +- _DeduplicationHandler_: Useful if you are sending notifications or emails + when critical errors occur. It takes a logger as parameter and will + accumulate log records of all levels until the end of the request (or + `flush()` is called). At that point it delivers all records to the handler + it wraps, but only if the records are unique over a given time period + (60seconds by default). If the records are duplicates they are simply + discarded. The main use of this is in case of critical failure like if your + database is unreachable for example all your requests will fail and that + can result in a lot of notifications being sent. Adding this handler reduces + the amount of notifications to a manageable level. +- _WhatFailureGroupHandler_: This handler extends the _GroupHandler_ ignoring + exceptions raised by each child handler. This allows you to ignore issues + where a remote tcp connection may have died but you do not want your entire + application to crash and may wish to continue to log to other handlers. +- _BufferHandler_: This handler will buffer all the log records it receives + until `close()` is called at which point it will call `handleBatch()` on the + handler it wraps with all the log messages at once. This is very useful to + send an email with all records at once for example instead of having one mail + for every log record. +- _GroupHandler_: This handler groups other handlers. Every record received is + sent to all the handlers it is configured with. +- _FilterHandler_: This handler only lets records of the given levels through + to the wrapped handler. +- _SamplingHandler_: Wraps around another handler and lets you sample records + if you only want to store some of them. +- _NullHandler_: Any record it can handle will be thrown away. This can be used + to put on top of an existing handler stack to disable it temporarily. +- _PsrHandler_: Can be used to forward log records to an existing PSR-3 logger +- _TestHandler_: Used for testing, it records everything that is sent to it and + has accessors to read out the information. +- _HandlerWrapper_: A simple handler wrapper you can inherit from to create + your own wrappers easily. + +## Formatters + +- _LineFormatter_: Formats a log record into a one-line string. +- _HtmlFormatter_: Used to format log records into a human readable html table, mainly suitable for emails. +- _NormalizerFormatter_: Normalizes objects/resources down to strings so a record can easily be serialized/encoded. +- _ScalarFormatter_: Used to format log records into an associative array of scalar values. +- _JsonFormatter_: Encodes a log record into json. +- _WildfireFormatter_: Used to format log records into the Wildfire/FirePHP protocol, only useful for the FirePHPHandler. +- _ChromePHPFormatter_: Used to format log records into the ChromePHP format, only useful for the ChromePHPHandler. +- _GelfMessageFormatter_: Used to format log records into Gelf message instances, only useful for the GelfHandler. +- _LogstashFormatter_: Used to format log records into [logstash](http://logstash.net/) event json, useful for any handler listed under inputs [here](http://logstash.net/docs/latest). +- _ElasticaFormatter_: Used to format log records into an Elastica\Document object, only useful for the ElasticSearchHandler. +- _LogglyFormatter_: Used to format log records into Loggly messages, only useful for the LogglyHandler. +- _FlowdockFormatter_: Used to format log records into Flowdock messages, only useful for the FlowdockHandler. +- _MongoDBFormatter_: Converts \DateTime instances to \MongoDate and objects recursively to arrays, only useful with the MongoDBHandler. + +## Processors + +- _PsrLogMessageProcessor_: Processes a log record's message according to PSR-3 rules, replacing `{foo}` with the value from `$context['foo']`. +- _IntrospectionProcessor_: Adds the line/file/class/method from which the log call originated. +- _WebProcessor_: Adds the current request URI, request method and client IP to a log record. +- _MemoryUsageProcessor_: Adds the current memory usage to a log record. +- _MemoryPeakUsageProcessor_: Adds the peak memory usage to a log record. +- _ProcessIdProcessor_: Adds the process id to a log record. +- _UidProcessor_: Adds a unique identifier to a log record. +- _GitProcessor_: Adds the current git branch and commit to a log record. +- _TagProcessor_: Adds an array of predefined tags to a log record. + +## Third Party Packages + +Third party handlers, formatters and processors are +[listed in the wiki](https://github.com/Seldaek/monolog/wiki/Third-Party-Packages). You +can also add your own there if you publish one. + +← [Usage](01-usage.md) | [Utility classes](03-utilities.md) → diff --git a/vendor/monolog/monolog/doc/03-utilities.md b/vendor/monolog/monolog/doc/03-utilities.md new file mode 100644 index 0000000..fd3fd0e --- /dev/null +++ b/vendor/monolog/monolog/doc/03-utilities.md @@ -0,0 +1,15 @@ +# Utilities + +- _Registry_: The `Monolog\Registry` class lets you configure global loggers that you + can then statically access from anywhere. It is not really a best practice but can + help in some older codebases or for ease of use. +- _ErrorHandler_: The `Monolog\ErrorHandler` class allows you to easily register + a Logger instance as an exception handler, error handler or fatal error handler. +- _SignalHandler_: The `Monolog\SignalHandler` class allows you to easily register + a Logger instance as a POSIX signal handler. +- _ErrorLevelActivationStrategy_: Activates a FingersCrossedHandler when a certain log + level is reached. +- _ChannelLevelActivationStrategy_: Activates a FingersCrossedHandler when a certain + log level is reached, depending on which channel received the log record. + +← [Handlers, Formatters and Processors](02-handlers-formatters-processors.md) | [Extending Monolog](04-extending.md) → diff --git a/vendor/monolog/monolog/doc/04-extending.md b/vendor/monolog/monolog/doc/04-extending.md new file mode 100644 index 0000000..ebd9104 --- /dev/null +++ b/vendor/monolog/monolog/doc/04-extending.md @@ -0,0 +1,76 @@ +# Extending Monolog + +Monolog is fully extensible, allowing you to adapt your logger to your needs. + +## Writing your own handler + +Monolog provides many built-in handlers. But if the one you need does not +exist, you can write it and use it in your logger. The only requirement is +to implement `Monolog\Handler\HandlerInterface`. + +Let's write a PDOHandler to log records to a database. We will extend the +abstract class provided by Monolog to keep things DRY. + +```php +pdo = $pdo; + parent::__construct($level, $bubble); + } + + protected function write(array $record) + { + if (!$this->initialized) { + $this->initialize(); + } + + $this->statement->execute(array( + 'channel' => $record['channel'], + 'level' => $record['level'], + 'message' => $record['formatted'], + 'time' => $record['datetime']->format('U'), + )); + } + + private function initialize() + { + $this->pdo->exec( + 'CREATE TABLE IF NOT EXISTS monolog ' + .'(channel VARCHAR(255), level INTEGER, message LONGTEXT, time INTEGER UNSIGNED)' + ); + $this->statement = $this->pdo->prepare( + 'INSERT INTO monolog (channel, level, message, time) VALUES (:channel, :level, :message, :time)' + ); + + $this->initialized = true; + } +} +``` + +You can now use this handler in your logger: + +```php +pushHandler(new PDOHandler(new PDO('sqlite:logs.sqlite'))); + +// You can now use your logger +$logger->addInfo('My logger is now ready'); +``` + +The `Monolog\Handler\AbstractProcessingHandler` class provides most of the +logic needed for the handler, including the use of processors and the formatting +of the record (which is why we use ``$record['formatted']`` instead of ``$record['message']``). + +← [Utility classes](03-utilities.md) diff --git a/vendor/monolog/monolog/doc/sockets.md b/vendor/monolog/monolog/doc/sockets.md new file mode 100644 index 0000000..ea9cf0e --- /dev/null +++ b/vendor/monolog/monolog/doc/sockets.md @@ -0,0 +1,39 @@ +Sockets Handler +=============== + +This handler allows you to write your logs to sockets using [fsockopen](http://php.net/fsockopen) +or [pfsockopen](http://php.net/pfsockopen). + +Persistent sockets are mainly useful in web environments where you gain some performance not closing/opening +the connections between requests. + +You can use a `unix://` prefix to access unix sockets and `udp://` to open UDP sockets instead of the default TCP. + +Basic Example +------------- + +```php +setPersistent(true); + +// Now add the handler +$logger->pushHandler($handler, Logger::DEBUG); + +// You can now use your logger +$logger->addInfo('My logger is now ready'); + +``` + +In this example, using syslog-ng, you should see the log on the log server: + + cweb1 [2012-02-26 00:12:03] my_logger.INFO: My logger is now ready [] [] + diff --git a/vendor/monolog/monolog/phpunit.xml.dist b/vendor/monolog/monolog/phpunit.xml.dist new file mode 100644 index 0000000..20d82b6 --- /dev/null +++ b/vendor/monolog/monolog/phpunit.xml.dist @@ -0,0 +1,19 @@ + + + + + + tests/Monolog/ + + + + + + src/Monolog/ + + + + + + + diff --git a/vendor/monolog/monolog/src/Monolog/ErrorHandler.php b/vendor/monolog/monolog/src/Monolog/ErrorHandler.php new file mode 100644 index 0000000..adc55bd --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/ErrorHandler.php @@ -0,0 +1,239 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use Psr\Log\LoggerInterface; +use Psr\Log\LogLevel; +use Monolog\Handler\AbstractHandler; +use Monolog\Registry; + +/** + * Monolog error handler + * + * A facility to enable logging of runtime errors, exceptions and fatal errors. + * + * Quick setup: ErrorHandler::register($logger); + * + * @author Jordi Boggiano + */ +class ErrorHandler +{ + private $logger; + + private $previousExceptionHandler; + private $uncaughtExceptionLevel; + + private $previousErrorHandler; + private $errorLevelMap; + private $handleOnlyReportedErrors; + + private $hasFatalErrorHandler; + private $fatalLevel; + private $reservedMemory; + private $lastFatalTrace; + private static $fatalErrors = array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR); + + public function __construct(LoggerInterface $logger) + { + $this->logger = $logger; + } + + /** + * Registers a new ErrorHandler for a given Logger + * + * By default it will handle errors, exceptions and fatal errors + * + * @param LoggerInterface $logger + * @param array|false $errorLevelMap an array of E_* constant to LogLevel::* constant mapping, or false to disable error handling + * @param int|false $exceptionLevel a LogLevel::* constant, or false to disable exception handling + * @param int|false $fatalLevel a LogLevel::* constant, or false to disable fatal error handling + * @return ErrorHandler + */ + public static function register(LoggerInterface $logger, $errorLevelMap = array(), $exceptionLevel = null, $fatalLevel = null) + { + //Forces the autoloader to run for LogLevel. Fixes an autoload issue at compile-time on PHP5.3. See https://github.com/Seldaek/monolog/pull/929 + class_exists('\\Psr\\Log\\LogLevel', true); + + $handler = new static($logger); + if ($errorLevelMap !== false) { + $handler->registerErrorHandler($errorLevelMap); + } + if ($exceptionLevel !== false) { + $handler->registerExceptionHandler($exceptionLevel); + } + if ($fatalLevel !== false) { + $handler->registerFatalHandler($fatalLevel); + } + + return $handler; + } + + public function registerExceptionHandler($level = null, $callPrevious = true) + { + $prev = set_exception_handler(array($this, 'handleException')); + $this->uncaughtExceptionLevel = $level; + if ($callPrevious && $prev) { + $this->previousExceptionHandler = $prev; + } + } + + public function registerErrorHandler(array $levelMap = array(), $callPrevious = true, $errorTypes = -1, $handleOnlyReportedErrors = true) + { + $prev = set_error_handler(array($this, 'handleError'), $errorTypes); + $this->errorLevelMap = array_replace($this->defaultErrorLevelMap(), $levelMap); + if ($callPrevious) { + $this->previousErrorHandler = $prev ?: true; + } + + $this->handleOnlyReportedErrors = $handleOnlyReportedErrors; + } + + public function registerFatalHandler($level = null, $reservedMemorySize = 20) + { + register_shutdown_function(array($this, 'handleFatalError')); + + $this->reservedMemory = str_repeat(' ', 1024 * $reservedMemorySize); + $this->fatalLevel = $level; + $this->hasFatalErrorHandler = true; + } + + protected function defaultErrorLevelMap() + { + return array( + E_ERROR => LogLevel::CRITICAL, + E_WARNING => LogLevel::WARNING, + E_PARSE => LogLevel::ALERT, + E_NOTICE => LogLevel::NOTICE, + E_CORE_ERROR => LogLevel::CRITICAL, + E_CORE_WARNING => LogLevel::WARNING, + E_COMPILE_ERROR => LogLevel::ALERT, + E_COMPILE_WARNING => LogLevel::WARNING, + E_USER_ERROR => LogLevel::ERROR, + E_USER_WARNING => LogLevel::WARNING, + E_USER_NOTICE => LogLevel::NOTICE, + E_STRICT => LogLevel::NOTICE, + E_RECOVERABLE_ERROR => LogLevel::ERROR, + E_DEPRECATED => LogLevel::NOTICE, + E_USER_DEPRECATED => LogLevel::NOTICE, + ); + } + + /** + * @private + */ + public function handleException($e) + { + $this->logger->log( + $this->uncaughtExceptionLevel === null ? LogLevel::ERROR : $this->uncaughtExceptionLevel, + sprintf('Uncaught Exception %s: "%s" at %s line %s', Utils::getClass($e), $e->getMessage(), $e->getFile(), $e->getLine()), + array('exception' => $e) + ); + + if ($this->previousExceptionHandler) { + call_user_func($this->previousExceptionHandler, $e); + } + + exit(255); + } + + /** + * @private + */ + public function handleError($code, $message, $file = '', $line = 0, $context = array()) + { + if ($this->handleOnlyReportedErrors && !(error_reporting() & $code)) { + return; + } + + // fatal error codes are ignored if a fatal error handler is present as well to avoid duplicate log entries + if (!$this->hasFatalErrorHandler || !in_array($code, self::$fatalErrors, true)) { + $level = isset($this->errorLevelMap[$code]) ? $this->errorLevelMap[$code] : LogLevel::CRITICAL; + $this->logger->log($level, self::codeToString($code).': '.$message, array('code' => $code, 'message' => $message, 'file' => $file, 'line' => $line)); + } else { + // http://php.net/manual/en/function.debug-backtrace.php + // As of 5.3.6, DEBUG_BACKTRACE_IGNORE_ARGS option was added. + // Any version less than 5.3.6 must use the DEBUG_BACKTRACE_IGNORE_ARGS constant value '2'. + $trace = debug_backtrace((PHP_VERSION_ID < 50306) ? 2 : DEBUG_BACKTRACE_IGNORE_ARGS); + array_shift($trace); // Exclude handleError from trace + $this->lastFatalTrace = $trace; + } + + if ($this->previousErrorHandler === true) { + return false; + } elseif ($this->previousErrorHandler) { + return call_user_func($this->previousErrorHandler, $code, $message, $file, $line, $context); + } + } + + /** + * @private + */ + public function handleFatalError() + { + $this->reservedMemory = null; + + $lastError = error_get_last(); + if ($lastError && in_array($lastError['type'], self::$fatalErrors, true)) { + $this->logger->log( + $this->fatalLevel === null ? LogLevel::ALERT : $this->fatalLevel, + 'Fatal Error ('.self::codeToString($lastError['type']).'): '.$lastError['message'], + array('code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line'], 'trace' => $this->lastFatalTrace) + ); + + if ($this->logger instanceof Logger) { + foreach ($this->logger->getHandlers() as $handler) { + if ($handler instanceof AbstractHandler) { + $handler->close(); + } + } + } + } + } + + private static function codeToString($code) + { + switch ($code) { + case E_ERROR: + return 'E_ERROR'; + case E_WARNING: + return 'E_WARNING'; + case E_PARSE: + return 'E_PARSE'; + case E_NOTICE: + return 'E_NOTICE'; + case E_CORE_ERROR: + return 'E_CORE_ERROR'; + case E_CORE_WARNING: + return 'E_CORE_WARNING'; + case E_COMPILE_ERROR: + return 'E_COMPILE_ERROR'; + case E_COMPILE_WARNING: + return 'E_COMPILE_WARNING'; + case E_USER_ERROR: + return 'E_USER_ERROR'; + case E_USER_WARNING: + return 'E_USER_WARNING'; + case E_USER_NOTICE: + return 'E_USER_NOTICE'; + case E_STRICT: + return 'E_STRICT'; + case E_RECOVERABLE_ERROR: + return 'E_RECOVERABLE_ERROR'; + case E_DEPRECATED: + return 'E_DEPRECATED'; + case E_USER_DEPRECATED: + return 'E_USER_DEPRECATED'; + } + + return 'Unknown PHP error'; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php new file mode 100644 index 0000000..9beda1e --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php @@ -0,0 +1,78 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; + +/** + * Formats a log message according to the ChromePHP array format + * + * @author Christophe Coevoet + */ +class ChromePHPFormatter implements FormatterInterface +{ + /** + * Translates Monolog log levels to Wildfire levels. + */ + private $logLevels = array( + Logger::DEBUG => 'log', + Logger::INFO => 'info', + Logger::NOTICE => 'info', + Logger::WARNING => 'warn', + Logger::ERROR => 'error', + Logger::CRITICAL => 'error', + Logger::ALERT => 'error', + Logger::EMERGENCY => 'error', + ); + + /** + * {@inheritdoc} + */ + public function format(array $record) + { + // Retrieve the line and file if set and remove them from the formatted extra + $backtrace = 'unknown'; + if (isset($record['extra']['file'], $record['extra']['line'])) { + $backtrace = $record['extra']['file'].' : '.$record['extra']['line']; + unset($record['extra']['file'], $record['extra']['line']); + } + + $message = array('message' => $record['message']); + if ($record['context']) { + $message['context'] = $record['context']; + } + if ($record['extra']) { + $message['extra'] = $record['extra']; + } + if (count($message) === 1) { + $message = reset($message); + } + + return array( + $record['channel'], + $message, + $backtrace, + $this->logLevels[$record['level']], + ); + } + + public function formatBatch(array $records) + { + $formatted = array(); + + foreach ($records as $record) { + $formatted[] = $this->format($record); + } + + return $formatted; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php new file mode 100644 index 0000000..4c556cf --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php @@ -0,0 +1,89 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Elastica\Document; + +/** + * Format a log message into an Elastica Document + * + * @author Jelle Vink + */ +class ElasticaFormatter extends NormalizerFormatter +{ + /** + * @var string Elastic search index name + */ + protected $index; + + /** + * @var string Elastic search document type + */ + protected $type; + + /** + * @param string $index Elastic Search index name + * @param string $type Elastic Search document type + */ + public function __construct($index, $type) + { + // elasticsearch requires a ISO 8601 format date with optional millisecond precision. + parent::__construct('Y-m-d\TH:i:s.uP'); + + $this->index = $index; + $this->type = $type; + } + + /** + * {@inheritdoc} + */ + public function format(array $record) + { + $record = parent::format($record); + + return $this->getDocument($record); + } + + /** + * Getter index + * @return string + */ + public function getIndex() + { + return $this->index; + } + + /** + * Getter type + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Convert a log message into an Elastica Document + * + * @param array $record Log message + * @return Document + */ + protected function getDocument($record) + { + $document = new Document(); + $document->setData($record); + $document->setType($this->type); + $document->setIndex($this->index); + + return $document; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php new file mode 100644 index 0000000..5094af3 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php @@ -0,0 +1,116 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * formats the record to be used in the FlowdockHandler + * + * @author Dominik Liebler + */ +class FlowdockFormatter implements FormatterInterface +{ + /** + * @var string + */ + private $source; + + /** + * @var string + */ + private $sourceEmail; + + /** + * @param string $source + * @param string $sourceEmail + */ + public function __construct($source, $sourceEmail) + { + $this->source = $source; + $this->sourceEmail = $sourceEmail; + } + + /** + * {@inheritdoc} + */ + public function format(array $record) + { + $tags = array( + '#logs', + '#' . strtolower($record['level_name']), + '#' . $record['channel'], + ); + + foreach ($record['extra'] as $value) { + $tags[] = '#' . $value; + } + + $subject = sprintf( + 'in %s: %s - %s', + $this->source, + $record['level_name'], + $this->getShortMessage($record['message']) + ); + + $record['flowdock'] = array( + 'source' => $this->source, + 'from_address' => $this->sourceEmail, + 'subject' => $subject, + 'content' => $record['message'], + 'tags' => $tags, + 'project' => $this->source, + ); + + return $record; + } + + /** + * {@inheritdoc} + */ + public function formatBatch(array $records) + { + $formatted = array(); + + foreach ($records as $record) { + $formatted[] = $this->format($record); + } + + return $formatted; + } + + /** + * @param string $message + * + * @return string + */ + public function getShortMessage($message) + { + static $hasMbString; + + if (null === $hasMbString) { + $hasMbString = function_exists('mb_strlen'); + } + + $maxLength = 45; + + if ($hasMbString) { + if (mb_strlen($message, 'UTF-8') > $maxLength) { + $message = mb_substr($message, 0, $maxLength - 4, 'UTF-8') . ' ...'; + } + } else { + if (strlen($message) > $maxLength) { + $message = substr($message, 0, $maxLength - 4) . ' ...'; + } + } + + return $message; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php new file mode 100644 index 0000000..46a91ff --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php @@ -0,0 +1,86 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * Class FluentdFormatter + * + * Serializes a log message to Fluentd unix socket protocol + * + * Fluentd config: + * + * + * type unix + * path /var/run/td-agent/td-agent.sock + * + * + * Monolog setup: + * + * $logger = new Monolog\Logger('fluent.tag'); + * $fluentHandler = new Monolog\Handler\SocketHandler('unix:///var/run/td-agent/td-agent.sock'); + * $fluentHandler->setFormatter(new Monolog\Formatter\FluentdFormatter()); + * $logger->pushHandler($fluentHandler); + * + * @author Andrius Putna + */ +class FluentdFormatter implements FormatterInterface +{ + /** + * @var bool $levelTag should message level be a part of the fluentd tag + */ + protected $levelTag = false; + + public function __construct($levelTag = false) + { + if (!function_exists('json_encode')) { + throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s FluentdUnixFormatter'); + } + + $this->levelTag = (bool) $levelTag; + } + + public function isUsingLevelsInTag() + { + return $this->levelTag; + } + + public function format(array $record) + { + $tag = $record['channel']; + if ($this->levelTag) { + $tag .= '.' . strtolower($record['level_name']); + } + + $message = array( + 'message' => $record['message'], + 'context' => $record['context'], + 'extra' => $record['extra'], + ); + + if (!$this->levelTag) { + $message['level'] = $record['level']; + $message['level_name'] = $record['level_name']; + } + + return json_encode(array($tag, $record['datetime']->getTimestamp(), $message)); + } + + public function formatBatch(array $records) + { + $message = ''; + foreach ($records as $record) { + $message .= $this->format($record); + } + + return $message; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php b/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php new file mode 100644 index 0000000..b5de751 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * Interface for formatters + * + * @author Jordi Boggiano + */ +interface FormatterInterface +{ + /** + * Formats a log record. + * + * @param array $record A record to format + * @return mixed The formatted record + */ + public function format(array $record); + + /** + * Formats a set of log records. + * + * @param array $records A set of records to format + * @return mixed The formatted set of records + */ + public function formatBatch(array $records); +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php new file mode 100644 index 0000000..2c1b0e8 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php @@ -0,0 +1,138 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; +use Gelf\Message; + +/** + * Serializes a log message to GELF + * @see http://www.graylog2.org/about/gelf + * + * @author Matt Lehner + */ +class GelfMessageFormatter extends NormalizerFormatter +{ + const DEFAULT_MAX_LENGTH = 32766; + + /** + * @var string the name of the system for the Gelf log message + */ + protected $systemName; + + /** + * @var string a prefix for 'extra' fields from the Monolog record (optional) + */ + protected $extraPrefix; + + /** + * @var string a prefix for 'context' fields from the Monolog record (optional) + */ + protected $contextPrefix; + + /** + * @var int max length per field + */ + protected $maxLength; + + /** + * Translates Monolog log levels to Graylog2 log priorities. + */ + private $logLevels = array( + Logger::DEBUG => 7, + Logger::INFO => 6, + Logger::NOTICE => 5, + Logger::WARNING => 4, + Logger::ERROR => 3, + Logger::CRITICAL => 2, + Logger::ALERT => 1, + Logger::EMERGENCY => 0, + ); + + public function __construct($systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $maxLength = null) + { + parent::__construct('U.u'); + + $this->systemName = $systemName ?: gethostname(); + + $this->extraPrefix = $extraPrefix; + $this->contextPrefix = $contextPrefix; + $this->maxLength = is_null($maxLength) ? self::DEFAULT_MAX_LENGTH : $maxLength; + } + + /** + * {@inheritdoc} + */ + public function format(array $record) + { + $record = parent::format($record); + + if (!isset($record['datetime'], $record['message'], $record['level'])) { + throw new \InvalidArgumentException('The record should at least contain datetime, message and level keys, '.var_export($record, true).' given'); + } + + $message = new Message(); + $message + ->setTimestamp($record['datetime']) + ->setShortMessage((string) $record['message']) + ->setHost($this->systemName) + ->setLevel($this->logLevels[$record['level']]); + + // message length + system name length + 200 for padding / metadata + $len = 200 + strlen((string) $record['message']) + strlen($this->systemName); + + if ($len > $this->maxLength) { + $message->setShortMessage(substr($record['message'], 0, $this->maxLength)); + } + + if (isset($record['channel'])) { + $message->setFacility($record['channel']); + } + if (isset($record['extra']['line'])) { + $message->setLine($record['extra']['line']); + unset($record['extra']['line']); + } + if (isset($record['extra']['file'])) { + $message->setFile($record['extra']['file']); + unset($record['extra']['file']); + } + + foreach ($record['extra'] as $key => $val) { + $val = is_scalar($val) || null === $val ? $val : $this->toJson($val); + $len = strlen($this->extraPrefix . $key . $val); + if ($len > $this->maxLength) { + $message->setAdditional($this->extraPrefix . $key, substr($val, 0, $this->maxLength)); + break; + } + $message->setAdditional($this->extraPrefix . $key, $val); + } + + foreach ($record['context'] as $key => $val) { + $val = is_scalar($val) || null === $val ? $val : $this->toJson($val); + $len = strlen($this->contextPrefix . $key . $val); + if ($len > $this->maxLength) { + $message->setAdditional($this->contextPrefix . $key, substr($val, 0, $this->maxLength)); + break; + } + $message->setAdditional($this->contextPrefix . $key, $val); + } + + if (null === $message->getFile() && isset($record['context']['exception']['file'])) { + if (preg_match("/^(.+):([0-9]+)$/", $record['context']['exception']['file'], $matches)) { + $message->setFile($matches[1]); + $message->setLine($matches[2]); + } + } + + return $message; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php new file mode 100644 index 0000000..dfc0b4a --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php @@ -0,0 +1,141 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; + +/** + * Formats incoming records into an HTML table + * + * This is especially useful for html email logging + * + * @author Tiago Brito + */ +class HtmlFormatter extends NormalizerFormatter +{ + /** + * Translates Monolog log levels to html color priorities. + */ + protected $logLevels = array( + Logger::DEBUG => '#cccccc', + Logger::INFO => '#468847', + Logger::NOTICE => '#3a87ad', + Logger::WARNING => '#c09853', + Logger::ERROR => '#f0ad4e', + Logger::CRITICAL => '#FF7708', + Logger::ALERT => '#C12A19', + Logger::EMERGENCY => '#000000', + ); + + /** + * @param string $dateFormat The format of the timestamp: one supported by DateTime::format + */ + public function __construct($dateFormat = null) + { + parent::__construct($dateFormat); + } + + /** + * Creates an HTML table row + * + * @param string $th Row header content + * @param string $td Row standard cell content + * @param bool $escapeTd false if td content must not be html escaped + * @return string + */ + protected function addRow($th, $td = ' ', $escapeTd = true) + { + $th = htmlspecialchars($th, ENT_NOQUOTES, 'UTF-8'); + if ($escapeTd) { + $td = '
'.htmlspecialchars($td, ENT_NOQUOTES, 'UTF-8').'
'; + } + + return "\n$th:\n".$td."\n"; + } + + /** + * Create a HTML h1 tag + * + * @param string $title Text to be in the h1 + * @param int $level Error level + * @return string + */ + protected function addTitle($title, $level) + { + $title = htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8'); + + return '

'.$title.'

'; + } + + /** + * Formats a log record. + * + * @param array $record A record to format + * @return mixed The formatted record + */ + public function format(array $record) + { + $output = $this->addTitle($record['level_name'], $record['level']); + $output .= ''; + + $output .= $this->addRow('Message', (string) $record['message']); + $output .= $this->addRow('Time', $record['datetime']->format($this->dateFormat)); + $output .= $this->addRow('Channel', $record['channel']); + if ($record['context']) { + $embeddedTable = '
'; + foreach ($record['context'] as $key => $value) { + $embeddedTable .= $this->addRow($key, $this->convertToString($value)); + } + $embeddedTable .= '
'; + $output .= $this->addRow('Context', $embeddedTable, false); + } + if ($record['extra']) { + $embeddedTable = ''; + foreach ($record['extra'] as $key => $value) { + $embeddedTable .= $this->addRow($key, $this->convertToString($value)); + } + $embeddedTable .= '
'; + $output .= $this->addRow('Extra', $embeddedTable, false); + } + + return $output.''; + } + + /** + * Formats a set of log records. + * + * @param array $records A set of records to format + * @return mixed The formatted set of records + */ + public function formatBatch(array $records) + { + $message = ''; + foreach ($records as $record) { + $message .= $this->format($record); + } + + return $message; + } + + protected function convertToString($data) + { + if (null === $data || is_scalar($data)) { + return (string) $data; + } + + $data = $this->normalize($data); + if (version_compare(PHP_VERSION, '5.4.0', '>=')) { + return json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); + } + + return str_replace('\\/', '/', json_encode($data)); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php new file mode 100644 index 0000000..9bd305f --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php @@ -0,0 +1,214 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Exception; +use Monolog\Utils; +use Throwable; + +/** + * Encodes whatever record data is passed to it as json + * + * This can be useful to log to databases or remote APIs + * + * @author Jordi Boggiano + */ +class JsonFormatter extends NormalizerFormatter +{ + const BATCH_MODE_JSON = 1; + const BATCH_MODE_NEWLINES = 2; + + protected $batchMode; + protected $appendNewline; + + /** + * @var bool + */ + protected $includeStacktraces = false; + + /** + * @param int $batchMode + * @param bool $appendNewline + */ + public function __construct($batchMode = self::BATCH_MODE_JSON, $appendNewline = true) + { + $this->batchMode = $batchMode; + $this->appendNewline = $appendNewline; + } + + /** + * The batch mode option configures the formatting style for + * multiple records. By default, multiple records will be + * formatted as a JSON-encoded array. However, for + * compatibility with some API endpoints, alternative styles + * are available. + * + * @return int + */ + public function getBatchMode() + { + return $this->batchMode; + } + + /** + * True if newlines are appended to every formatted record + * + * @return bool + */ + public function isAppendingNewlines() + { + return $this->appendNewline; + } + + /** + * {@inheritdoc} + */ + public function format(array $record) + { + return $this->toJson($this->normalize($record), true) . ($this->appendNewline ? "\n" : ''); + } + + /** + * {@inheritdoc} + */ + public function formatBatch(array $records) + { + switch ($this->batchMode) { + case static::BATCH_MODE_NEWLINES: + return $this->formatBatchNewlines($records); + + case static::BATCH_MODE_JSON: + default: + return $this->formatBatchJson($records); + } + } + + /** + * @param bool $include + */ + public function includeStacktraces($include = true) + { + $this->includeStacktraces = $include; + } + + /** + * Return a JSON-encoded array of records. + * + * @param array $records + * @return string + */ + protected function formatBatchJson(array $records) + { + return $this->toJson($this->normalize($records), true); + } + + /** + * Use new lines to separate records instead of a + * JSON-encoded array. + * + * @param array $records + * @return string + */ + protected function formatBatchNewlines(array $records) + { + $instance = $this; + + $oldNewline = $this->appendNewline; + $this->appendNewline = false; + array_walk($records, function (&$value, $key) use ($instance) { + $value = $instance->format($value); + }); + $this->appendNewline = $oldNewline; + + return implode("\n", $records); + } + + /** + * Normalizes given $data. + * + * @param mixed $data + * + * @return mixed + */ + protected function normalize($data, $depth = 0) + { + if ($depth > 9) { + return 'Over 9 levels deep, aborting normalization'; + } + + if (is_array($data) || $data instanceof \Traversable) { + $normalized = array(); + + $count = 1; + foreach ($data as $key => $value) { + if ($count++ > 1000) { + $normalized['...'] = 'Over 1000 items ('.count($data).' total), aborting normalization'; + break; + } + + $normalized[$key] = $this->normalize($value, $depth+1); + } + + return $normalized; + } + + if ($data instanceof Exception || $data instanceof Throwable) { + return $this->normalizeException($data); + } + + return $data; + } + + /** + * Normalizes given exception with or without its own stack trace based on + * `includeStacktraces` property. + * + * @param Exception|Throwable $e + * + * @return array + */ + protected function normalizeException($e) + { + // TODO 2.0 only check for Throwable + if (!$e instanceof Exception && !$e instanceof Throwable) { + throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.Utils::getClass($e)); + } + + $data = array( + 'class' => Utils::getClass($e), + 'message' => $e->getMessage(), + 'code' => $e->getCode(), + 'file' => $e->getFile().':'.$e->getLine(), + ); + + if ($this->includeStacktraces) { + $trace = $e->getTrace(); + foreach ($trace as $frame) { + if (isset($frame['file'])) { + $data['trace'][] = $frame['file'].':'.$frame['line']; + } elseif (isset($frame['function']) && $frame['function'] === '{closure}') { + // We should again normalize the frames, because it might contain invalid items + $data['trace'][] = $frame['function']; + } else { + // We should again normalize the frames, because it might contain invalid items + $data['trace'][] = $this->normalize($frame); + } + } + } + + if ($previous = $e->getPrevious()) { + $data['previous'] = $this->normalizeException($previous); + } + + return $data; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php new file mode 100644 index 0000000..f98e1a6 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php @@ -0,0 +1,181 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Utils; + +/** + * Formats incoming records into a one-line string + * + * This is especially useful for logging to files + * + * @author Jordi Boggiano + * @author Christophe Coevoet + */ +class LineFormatter extends NormalizerFormatter +{ + const SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"; + + protected $format; + protected $allowInlineLineBreaks; + protected $ignoreEmptyContextAndExtra; + protected $includeStacktraces; + + /** + * @param string $format The format of the message + * @param string $dateFormat The format of the timestamp: one supported by DateTime::format + * @param bool $allowInlineLineBreaks Whether to allow inline line breaks in log entries + * @param bool $ignoreEmptyContextAndExtra + */ + public function __construct($format = null, $dateFormat = null, $allowInlineLineBreaks = false, $ignoreEmptyContextAndExtra = false) + { + $this->format = $format ?: static::SIMPLE_FORMAT; + $this->allowInlineLineBreaks = $allowInlineLineBreaks; + $this->ignoreEmptyContextAndExtra = $ignoreEmptyContextAndExtra; + parent::__construct($dateFormat); + } + + public function includeStacktraces($include = true) + { + $this->includeStacktraces = $include; + if ($this->includeStacktraces) { + $this->allowInlineLineBreaks = true; + } + } + + public function allowInlineLineBreaks($allow = true) + { + $this->allowInlineLineBreaks = $allow; + } + + public function ignoreEmptyContextAndExtra($ignore = true) + { + $this->ignoreEmptyContextAndExtra = $ignore; + } + + /** + * {@inheritdoc} + */ + public function format(array $record) + { + $vars = parent::format($record); + + $output = $this->format; + + foreach ($vars['extra'] as $var => $val) { + if (false !== strpos($output, '%extra.'.$var.'%')) { + $output = str_replace('%extra.'.$var.'%', $this->stringify($val), $output); + unset($vars['extra'][$var]); + } + } + + + foreach ($vars['context'] as $var => $val) { + if (false !== strpos($output, '%context.'.$var.'%')) { + $output = str_replace('%context.'.$var.'%', $this->stringify($val), $output); + unset($vars['context'][$var]); + } + } + + if ($this->ignoreEmptyContextAndExtra) { + if (empty($vars['context'])) { + unset($vars['context']); + $output = str_replace('%context%', '', $output); + } + + if (empty($vars['extra'])) { + unset($vars['extra']); + $output = str_replace('%extra%', '', $output); + } + } + + foreach ($vars as $var => $val) { + if (false !== strpos($output, '%'.$var.'%')) { + $output = str_replace('%'.$var.'%', $this->stringify($val), $output); + } + } + + // remove leftover %extra.xxx% and %context.xxx% if any + if (false !== strpos($output, '%')) { + $output = preg_replace('/%(?:extra|context)\..+?%/', '', $output); + } + + return $output; + } + + public function formatBatch(array $records) + { + $message = ''; + foreach ($records as $record) { + $message .= $this->format($record); + } + + return $message; + } + + public function stringify($value) + { + return $this->replaceNewlines($this->convertToString($value)); + } + + protected function normalizeException($e) + { + // TODO 2.0 only check for Throwable + if (!$e instanceof \Exception && !$e instanceof \Throwable) { + throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.Utils::getClass($e)); + } + + $previousText = ''; + if ($previous = $e->getPrevious()) { + do { + $previousText .= ', '.Utils::getClass($previous).'(code: '.$previous->getCode().'): '.$previous->getMessage().' at '.$previous->getFile().':'.$previous->getLine(); + } while ($previous = $previous->getPrevious()); + } + + $str = '[object] ('.Utils::getClass($e).'(code: '.$e->getCode().'): '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine().$previousText.')'; + if ($this->includeStacktraces) { + $str .= "\n[stacktrace]\n".$e->getTraceAsString()."\n"; + } + + return $str; + } + + protected function convertToString($data) + { + if (null === $data || is_bool($data)) { + return var_export($data, true); + } + + if (is_scalar($data)) { + return (string) $data; + } + + if (version_compare(PHP_VERSION, '5.4.0', '>=')) { + return $this->toJson($data, true); + } + + return str_replace('\\/', '/', @json_encode($data)); + } + + protected function replaceNewlines($str) + { + if ($this->allowInlineLineBreaks) { + if (0 === strpos($str, '{')) { + return str_replace(array('\r', '\n'), array("\r", "\n"), $str); + } + + return $str; + } + + return str_replace(array("\r\n", "\r", "\n"), ' ', $str); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php new file mode 100644 index 0000000..401859b --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * Encodes message information into JSON in a format compatible with Loggly. + * + * @author Adam Pancutt + */ +class LogglyFormatter extends JsonFormatter +{ + /** + * Overrides the default batch mode to new lines for compatibility with the + * Loggly bulk API. + * + * @param int $batchMode + */ + public function __construct($batchMode = self::BATCH_MODE_NEWLINES, $appendNewline = false) + { + parent::__construct($batchMode, $appendNewline); + } + + /** + * Appends the 'timestamp' parameter for indexing by Loggly. + * + * @see https://www.loggly.com/docs/automated-parsing/#json + * @see \Monolog\Formatter\JsonFormatter::format() + */ + public function format(array $record) + { + if (isset($record["datetime"]) && ($record["datetime"] instanceof \DateTime)) { + $record["timestamp"] = $record["datetime"]->format("Y-m-d\TH:i:s.uO"); + // TODO 2.0 unset the 'datetime' parameter, retained for BC + } + + return parent::format($record); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php new file mode 100644 index 0000000..8f83bec --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php @@ -0,0 +1,166 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * Serializes a log message to Logstash Event Format + * + * @see http://logstash.net/ + * @see https://github.com/logstash/logstash/blob/master/lib/logstash/event.rb + * + * @author Tim Mower + */ +class LogstashFormatter extends NormalizerFormatter +{ + const V0 = 0; + const V1 = 1; + + /** + * @var string the name of the system for the Logstash log message, used to fill the @source field + */ + protected $systemName; + + /** + * @var string an application name for the Logstash log message, used to fill the @type field + */ + protected $applicationName; + + /** + * @var string a prefix for 'extra' fields from the Monolog record (optional) + */ + protected $extraPrefix; + + /** + * @var string a prefix for 'context' fields from the Monolog record (optional) + */ + protected $contextPrefix; + + /** + * @var int logstash format version to use + */ + protected $version; + + /** + * @param string $applicationName the application that sends the data, used as the "type" field of logstash + * @param string $systemName the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine + * @param string $extraPrefix prefix for extra keys inside logstash "fields" + * @param string $contextPrefix prefix for context keys inside logstash "fields", defaults to ctxt_ + * @param int $version the logstash format version to use, defaults to 0 + */ + public function __construct($applicationName, $systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $version = self::V0) + { + // logstash requires a ISO 8601 format date with optional millisecond precision. + parent::__construct('Y-m-d\TH:i:s.uP'); + + $this->systemName = $systemName ?: gethostname(); + $this->applicationName = $applicationName; + $this->extraPrefix = $extraPrefix; + $this->contextPrefix = $contextPrefix; + $this->version = $version; + } + + /** + * {@inheritdoc} + */ + public function format(array $record) + { + $record = parent::format($record); + + if ($this->version === self::V1) { + $message = $this->formatV1($record); + } else { + $message = $this->formatV0($record); + } + + return $this->toJson($message) . "\n"; + } + + protected function formatV0(array $record) + { + if (empty($record['datetime'])) { + $record['datetime'] = gmdate('c'); + } + $message = array( + '@timestamp' => $record['datetime'], + '@source' => $this->systemName, + '@fields' => array(), + ); + if (isset($record['message'])) { + $message['@message'] = $record['message']; + } + if (isset($record['channel'])) { + $message['@tags'] = array($record['channel']); + $message['@fields']['channel'] = $record['channel']; + } + if (isset($record['level'])) { + $message['@fields']['level'] = $record['level']; + } + if ($this->applicationName) { + $message['@type'] = $this->applicationName; + } + if (isset($record['extra']['server'])) { + $message['@source_host'] = $record['extra']['server']; + } + if (isset($record['extra']['url'])) { + $message['@source_path'] = $record['extra']['url']; + } + if (!empty($record['extra'])) { + foreach ($record['extra'] as $key => $val) { + $message['@fields'][$this->extraPrefix . $key] = $val; + } + } + if (!empty($record['context'])) { + foreach ($record['context'] as $key => $val) { + $message['@fields'][$this->contextPrefix . $key] = $val; + } + } + + return $message; + } + + protected function formatV1(array $record) + { + if (empty($record['datetime'])) { + $record['datetime'] = gmdate('c'); + } + $message = array( + '@timestamp' => $record['datetime'], + '@version' => 1, + 'host' => $this->systemName, + ); + if (isset($record['message'])) { + $message['message'] = $record['message']; + } + if (isset($record['channel'])) { + $message['type'] = $record['channel']; + $message['channel'] = $record['channel']; + } + if (isset($record['level_name'])) { + $message['level'] = $record['level_name']; + } + if ($this->applicationName) { + $message['type'] = $this->applicationName; + } + if (!empty($record['extra'])) { + foreach ($record['extra'] as $key => $val) { + $message[$this->extraPrefix . $key] = $val; + } + } + if (!empty($record['context'])) { + foreach ($record['context'] as $key => $val) { + $message[$this->contextPrefix . $key] = $val; + } + } + + return $message; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php new file mode 100644 index 0000000..eb7be84 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php @@ -0,0 +1,107 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Utils; + +/** + * Formats a record for use with the MongoDBHandler. + * + * @author Florian Plattner + */ +class MongoDBFormatter implements FormatterInterface +{ + private $exceptionTraceAsString; + private $maxNestingLevel; + + /** + * @param int $maxNestingLevel 0 means infinite nesting, the $record itself is level 1, $record['context'] is 2 + * @param bool $exceptionTraceAsString set to false to log exception traces as a sub documents instead of strings + */ + public function __construct($maxNestingLevel = 3, $exceptionTraceAsString = true) + { + $this->maxNestingLevel = max($maxNestingLevel, 0); + $this->exceptionTraceAsString = (bool) $exceptionTraceAsString; + } + + /** + * {@inheritDoc} + */ + public function format(array $record) + { + return $this->formatArray($record); + } + + /** + * {@inheritDoc} + */ + public function formatBatch(array $records) + { + foreach ($records as $key => $record) { + $records[$key] = $this->format($record); + } + + return $records; + } + + protected function formatArray(array $record, $nestingLevel = 0) + { + if ($this->maxNestingLevel == 0 || $nestingLevel <= $this->maxNestingLevel) { + foreach ($record as $name => $value) { + if ($value instanceof \DateTime) { + $record[$name] = $this->formatDate($value, $nestingLevel + 1); + } elseif ($value instanceof \Exception) { + $record[$name] = $this->formatException($value, $nestingLevel + 1); + } elseif (is_array($value)) { + $record[$name] = $this->formatArray($value, $nestingLevel + 1); + } elseif (is_object($value)) { + $record[$name] = $this->formatObject($value, $nestingLevel + 1); + } + } + } else { + $record = '[...]'; + } + + return $record; + } + + protected function formatObject($value, $nestingLevel) + { + $objectVars = get_object_vars($value); + $objectVars['class'] = Utils::getClass($value); + + return $this->formatArray($objectVars, $nestingLevel); + } + + protected function formatException(\Exception $exception, $nestingLevel) + { + $formattedException = array( + 'class' => Utils::getClass($exception), + 'message' => $exception->getMessage(), + 'code' => $exception->getCode(), + 'file' => $exception->getFile() . ':' . $exception->getLine(), + ); + + if ($this->exceptionTraceAsString === true) { + $formattedException['trace'] = $exception->getTraceAsString(); + } else { + $formattedException['trace'] = $exception->getTrace(); + } + + return $this->formatArray($formattedException, $nestingLevel); + } + + protected function formatDate(\DateTime $value, $nestingLevel) + { + return new \MongoDate($value->getTimestamp()); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php new file mode 100644 index 0000000..6686657 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php @@ -0,0 +1,314 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Exception; +use Monolog\Utils; + +/** + * Normalizes incoming records to remove objects/resources so it's easier to dump to various targets + * + * @author Jordi Boggiano + */ +class NormalizerFormatter implements FormatterInterface +{ + const SIMPLE_DATE = "Y-m-d H:i:s"; + + protected $dateFormat; + + /** + * @param string $dateFormat The format of the timestamp: one supported by DateTime::format + */ + public function __construct($dateFormat = null) + { + $this->dateFormat = $dateFormat ?: static::SIMPLE_DATE; + if (!function_exists('json_encode')) { + throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s NormalizerFormatter'); + } + } + + /** + * {@inheritdoc} + */ + public function format(array $record) + { + return $this->normalize($record); + } + + /** + * {@inheritdoc} + */ + public function formatBatch(array $records) + { + foreach ($records as $key => $record) { + $records[$key] = $this->format($record); + } + + return $records; + } + + protected function normalize($data, $depth = 0) + { + if ($depth > 9) { + return 'Over 9 levels deep, aborting normalization'; + } + + if (null === $data || is_scalar($data)) { + if (is_float($data)) { + if (is_infinite($data)) { + return ($data > 0 ? '' : '-') . 'INF'; + } + if (is_nan($data)) { + return 'NaN'; + } + } + + return $data; + } + + if (is_array($data)) { + $normalized = array(); + + $count = 1; + foreach ($data as $key => $value) { + if ($count++ > 1000) { + $normalized['...'] = 'Over 1000 items ('.count($data).' total), aborting normalization'; + break; + } + + $normalized[$key] = $this->normalize($value, $depth+1); + } + + return $normalized; + } + + if ($data instanceof \DateTime) { + return $data->format($this->dateFormat); + } + + if (is_object($data)) { + // TODO 2.0 only check for Throwable + if ($data instanceof Exception || (PHP_VERSION_ID > 70000 && $data instanceof \Throwable)) { + return $this->normalizeException($data); + } + + // non-serializable objects that implement __toString stringified + if (method_exists($data, '__toString') && !$data instanceof \JsonSerializable) { + $value = $data->__toString(); + } else { + // the rest is json-serialized in some way + $value = $this->toJson($data, true); + } + + return sprintf("[object] (%s: %s)", Utils::getClass($data), $value); + } + + if (is_resource($data)) { + return sprintf('[resource] (%s)', get_resource_type($data)); + } + + return '[unknown('.gettype($data).')]'; + } + + protected function normalizeException($e) + { + // TODO 2.0 only check for Throwable + if (!$e instanceof Exception && !$e instanceof \Throwable) { + throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.Utils::getClass($e)); + } + + $data = array( + 'class' => Utils::getClass($e), + 'message' => $e->getMessage(), + 'code' => $e->getCode(), + 'file' => $e->getFile().':'.$e->getLine(), + ); + + if ($e instanceof \SoapFault) { + if (isset($e->faultcode)) { + $data['faultcode'] = $e->faultcode; + } + + if (isset($e->faultactor)) { + $data['faultactor'] = $e->faultactor; + } + + if (isset($e->detail)) { + $data['detail'] = $e->detail; + } + } + + $trace = $e->getTrace(); + foreach ($trace as $frame) { + if (isset($frame['file'])) { + $data['trace'][] = $frame['file'].':'.$frame['line']; + } elseif (isset($frame['function']) && $frame['function'] === '{closure}') { + // Simplify closures handling + $data['trace'][] = $frame['function']; + } else { + if (isset($frame['args'])) { + // Make sure that objects present as arguments are not serialized nicely but rather only + // as a class name to avoid any unexpected leak of sensitive information + $frame['args'] = array_map(function ($arg) { + if (is_object($arg) && !($arg instanceof \DateTime || $arg instanceof \DateTimeInterface)) { + return sprintf("[object] (%s)", Utils::getClass($arg)); + } + + return $arg; + }, $frame['args']); + } + // We should again normalize the frames, because it might contain invalid items + $data['trace'][] = $this->toJson($this->normalize($frame), true); + } + } + + if ($previous = $e->getPrevious()) { + $data['previous'] = $this->normalizeException($previous); + } + + return $data; + } + + /** + * Return the JSON representation of a value + * + * @param mixed $data + * @param bool $ignoreErrors + * @throws \RuntimeException if encoding fails and errors are not ignored + * @return string + */ + protected function toJson($data, $ignoreErrors = false) + { + // suppress json_encode errors since it's twitchy with some inputs + if ($ignoreErrors) { + return @$this->jsonEncode($data); + } + + $json = $this->jsonEncode($data); + + if ($json === false) { + $json = $this->handleJsonError(json_last_error(), $data); + } + + return $json; + } + + /** + * @param mixed $data + * @return string JSON encoded data or null on failure + */ + private function jsonEncode($data) + { + if (version_compare(PHP_VERSION, '5.4.0', '>=')) { + return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); + } + + return json_encode($data); + } + + /** + * Handle a json_encode failure. + * + * If the failure is due to invalid string encoding, try to clean the + * input and encode again. If the second encoding attempt fails, the + * inital error is not encoding related or the input can't be cleaned then + * raise a descriptive exception. + * + * @param int $code return code of json_last_error function + * @param mixed $data data that was meant to be encoded + * @throws \RuntimeException if failure can't be corrected + * @return string JSON encoded data after error correction + */ + private function handleJsonError($code, $data) + { + if ($code !== JSON_ERROR_UTF8) { + $this->throwEncodeError($code, $data); + } + + if (is_string($data)) { + $this->detectAndCleanUtf8($data); + } elseif (is_array($data)) { + array_walk_recursive($data, array($this, 'detectAndCleanUtf8')); + } else { + $this->throwEncodeError($code, $data); + } + + $json = $this->jsonEncode($data); + + if ($json === false) { + $this->throwEncodeError(json_last_error(), $data); + } + + return $json; + } + + /** + * Throws an exception according to a given code with a customized message + * + * @param int $code return code of json_last_error function + * @param mixed $data data that was meant to be encoded + * @throws \RuntimeException + */ + private function throwEncodeError($code, $data) + { + switch ($code) { + case JSON_ERROR_DEPTH: + $msg = 'Maximum stack depth exceeded'; + break; + case JSON_ERROR_STATE_MISMATCH: + $msg = 'Underflow or the modes mismatch'; + break; + case JSON_ERROR_CTRL_CHAR: + $msg = 'Unexpected control character found'; + break; + case JSON_ERROR_UTF8: + $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded'; + break; + default: + $msg = 'Unknown error'; + } + + throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true)); + } + + /** + * Detect invalid UTF-8 string characters and convert to valid UTF-8. + * + * Valid UTF-8 input will be left unmodified, but strings containing + * invalid UTF-8 codepoints will be reencoded as UTF-8 with an assumed + * original encoding of ISO-8859-15. This conversion may result in + * incorrect output if the actual encoding was not ISO-8859-15, but it + * will be clean UTF-8 output and will not rely on expensive and fragile + * detection algorithms. + * + * Function converts the input in place in the passed variable so that it + * can be used as a callback for array_walk_recursive. + * + * @param mixed &$data Input to check and convert if needed + * @private + */ + public function detectAndCleanUtf8(&$data) + { + if (is_string($data) && !preg_match('//u', $data)) { + $data = preg_replace_callback( + '/[\x80-\xFF]+/', + function ($m) { return utf8_encode($m[0]); }, + $data + ); + $data = str_replace( + array('¤', '¦', '¨', '´', '¸', '¼', '½', '¾'), + array('€', 'Å ', 'Å¡', 'Ž', 'ž', 'Å’', 'Å“', 'Ÿ'), + $data + ); + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php new file mode 100644 index 0000000..5d345d5 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * Formats data into an associative array of scalar values. + * Objects and arrays will be JSON encoded. + * + * @author Andrew Lawson + */ +class ScalarFormatter extends NormalizerFormatter +{ + /** + * {@inheritdoc} + */ + public function format(array $record) + { + foreach ($record as $key => $value) { + $record[$key] = $this->normalizeValue($value); + } + + return $record; + } + + /** + * @param mixed $value + * @return mixed + */ + protected function normalizeValue($value) + { + $normalized = $this->normalize($value); + + if (is_array($normalized) || is_object($normalized)) { + return $this->toJson($normalized, true); + } + + return $normalized; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php new file mode 100644 index 0000000..65dba99 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php @@ -0,0 +1,113 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; + +/** + * Serializes a log message according to Wildfire's header requirements + * + * @author Eric Clemmons (@ericclemmons) + * @author Christophe Coevoet + * @author Kirill chEbba Chebunin + */ +class WildfireFormatter extends NormalizerFormatter +{ + const TABLE = 'table'; + + /** + * Translates Monolog log levels to Wildfire levels. + */ + private $logLevels = array( + Logger::DEBUG => 'LOG', + Logger::INFO => 'INFO', + Logger::NOTICE => 'INFO', + Logger::WARNING => 'WARN', + Logger::ERROR => 'ERROR', + Logger::CRITICAL => 'ERROR', + Logger::ALERT => 'ERROR', + Logger::EMERGENCY => 'ERROR', + ); + + /** + * {@inheritdoc} + */ + public function format(array $record) + { + // Retrieve the line and file if set and remove them from the formatted extra + $file = $line = ''; + if (isset($record['extra']['file'])) { + $file = $record['extra']['file']; + unset($record['extra']['file']); + } + if (isset($record['extra']['line'])) { + $line = $record['extra']['line']; + unset($record['extra']['line']); + } + + $record = $this->normalize($record); + $message = array('message' => $record['message']); + $handleError = false; + if ($record['context']) { + $message['context'] = $record['context']; + $handleError = true; + } + if ($record['extra']) { + $message['extra'] = $record['extra']; + $handleError = true; + } + if (count($message) === 1) { + $message = reset($message); + } + + if (isset($record['context'][self::TABLE])) { + $type = 'TABLE'; + $label = $record['channel'] .': '. $record['message']; + $message = $record['context'][self::TABLE]; + } else { + $type = $this->logLevels[$record['level']]; + $label = $record['channel']; + } + + // Create JSON object describing the appearance of the message in the console + $json = $this->toJson(array( + array( + 'Type' => $type, + 'File' => $file, + 'Line' => $line, + 'Label' => $label, + ), + $message, + ), $handleError); + + // The message itself is a serialization of the above JSON object + it's length + return sprintf( + '%s|%s|', + strlen($json), + $json + ); + } + + public function formatBatch(array $records) + { + throw new \BadMethodCallException('Batch formatting does not make sense for the WildfireFormatter'); + } + + protected function normalize($data, $depth = 0) + { + if (is_object($data) && !$data instanceof \DateTime) { + return $data; + } + + return parent::normalize($data, $depth); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php new file mode 100644 index 0000000..92b9d45 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php @@ -0,0 +1,196 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\LineFormatter; +use Monolog\Logger; +use Monolog\ResettableInterface; + +/** + * Base Handler class providing the Handler structure + * + * @author Jordi Boggiano + */ +abstract class AbstractHandler implements HandlerInterface, ResettableInterface +{ + protected $level = Logger::DEBUG; + protected $bubble = true; + + /** + * @var FormatterInterface + */ + protected $formatter; + protected $processors = array(); + + /** + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct($level = Logger::DEBUG, $bubble = true) + { + $this->setLevel($level); + $this->bubble = $bubble; + } + + /** + * {@inheritdoc} + */ + public function isHandling(array $record) + { + return $record['level'] >= $this->level; + } + + /** + * {@inheritdoc} + */ + public function handleBatch(array $records) + { + foreach ($records as $record) { + $this->handle($record); + } + } + + /** + * Closes the handler. + * + * This will be called automatically when the object is destroyed + */ + public function close() + { + } + + /** + * {@inheritdoc} + */ + public function pushProcessor($callback) + { + if (!is_callable($callback)) { + throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given'); + } + array_unshift($this->processors, $callback); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function popProcessor() + { + if (!$this->processors) { + throw new \LogicException('You tried to pop from an empty processor stack.'); + } + + return array_shift($this->processors); + } + + /** + * {@inheritdoc} + */ + public function setFormatter(FormatterInterface $formatter) + { + $this->formatter = $formatter; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getFormatter() + { + if (!$this->formatter) { + $this->formatter = $this->getDefaultFormatter(); + } + + return $this->formatter; + } + + /** + * Sets minimum logging level at which this handler will be triggered. + * + * @param int|string $level Level or level name + * @return self + */ + public function setLevel($level) + { + $this->level = Logger::toMonologLevel($level); + + return $this; + } + + /** + * Gets minimum logging level at which this handler will be triggered. + * + * @return int + */ + public function getLevel() + { + return $this->level; + } + + /** + * Sets the bubbling behavior. + * + * @param bool $bubble true means that this handler allows bubbling. + * false means that bubbling is not permitted. + * @return self + */ + public function setBubble($bubble) + { + $this->bubble = $bubble; + + return $this; + } + + /** + * Gets the bubbling behavior. + * + * @return bool true means that this handler allows bubbling. + * false means that bubbling is not permitted. + */ + public function getBubble() + { + return $this->bubble; + } + + public function __destruct() + { + try { + $this->close(); + } catch (\Exception $e) { + // do nothing + } catch (\Throwable $e) { + // do nothing + } + } + + public function reset() + { + foreach ($this->processors as $processor) { + if ($processor instanceof ResettableInterface) { + $processor->reset(); + } + } + } + + /** + * Gets the default formatter. + * + * @return FormatterInterface + */ + protected function getDefaultFormatter() + { + return new LineFormatter(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php new file mode 100644 index 0000000..e1e8953 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\ResettableInterface; + +/** + * Base Handler class providing the Handler structure + * + * Classes extending it should (in most cases) only implement write($record) + * + * @author Jordi Boggiano + * @author Christophe Coevoet + */ +abstract class AbstractProcessingHandler extends AbstractHandler +{ + /** + * {@inheritdoc} + */ + public function handle(array $record) + { + if (!$this->isHandling($record)) { + return false; + } + + $record = $this->processRecord($record); + + $record['formatted'] = $this->getFormatter()->format($record); + + $this->write($record); + + return false === $this->bubble; + } + + /** + * Writes the record down to the log of the implementing handler + * + * @param array $record + * @return void + */ + abstract protected function write(array $record); + + /** + * Processes a record. + * + * @param array $record + * @return array + */ + protected function processRecord(array $record) + { + if ($this->processors) { + foreach ($this->processors as $processor) { + $record = call_user_func($processor, $record); + } + } + + return $record; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php new file mode 100644 index 0000000..8c76aca --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php @@ -0,0 +1,101 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\LineFormatter; + +/** + * Common syslog functionality + */ +abstract class AbstractSyslogHandler extends AbstractProcessingHandler +{ + protected $facility; + + /** + * Translates Monolog log levels to syslog log priorities. + */ + protected $logLevels = array( + Logger::DEBUG => LOG_DEBUG, + Logger::INFO => LOG_INFO, + Logger::NOTICE => LOG_NOTICE, + Logger::WARNING => LOG_WARNING, + Logger::ERROR => LOG_ERR, + Logger::CRITICAL => LOG_CRIT, + Logger::ALERT => LOG_ALERT, + Logger::EMERGENCY => LOG_EMERG, + ); + + /** + * List of valid log facility names. + */ + protected $facilities = array( + 'auth' => LOG_AUTH, + 'authpriv' => LOG_AUTHPRIV, + 'cron' => LOG_CRON, + 'daemon' => LOG_DAEMON, + 'kern' => LOG_KERN, + 'lpr' => LOG_LPR, + 'mail' => LOG_MAIL, + 'news' => LOG_NEWS, + 'syslog' => LOG_SYSLOG, + 'user' => LOG_USER, + 'uucp' => LOG_UUCP, + ); + + /** + * @param mixed $facility + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct($facility = LOG_USER, $level = Logger::DEBUG, $bubble = true) + { + parent::__construct($level, $bubble); + + if (!defined('PHP_WINDOWS_VERSION_BUILD')) { + $this->facilities['local0'] = LOG_LOCAL0; + $this->facilities['local1'] = LOG_LOCAL1; + $this->facilities['local2'] = LOG_LOCAL2; + $this->facilities['local3'] = LOG_LOCAL3; + $this->facilities['local4'] = LOG_LOCAL4; + $this->facilities['local5'] = LOG_LOCAL5; + $this->facilities['local6'] = LOG_LOCAL6; + $this->facilities['local7'] = LOG_LOCAL7; + } else { + $this->facilities['local0'] = 128; // LOG_LOCAL0 + $this->facilities['local1'] = 136; // LOG_LOCAL1 + $this->facilities['local2'] = 144; // LOG_LOCAL2 + $this->facilities['local3'] = 152; // LOG_LOCAL3 + $this->facilities['local4'] = 160; // LOG_LOCAL4 + $this->facilities['local5'] = 168; // LOG_LOCAL5 + $this->facilities['local6'] = 176; // LOG_LOCAL6 + $this->facilities['local7'] = 184; // LOG_LOCAL7 + } + + // convert textual description of facility to syslog constant + if (array_key_exists(strtolower($facility), $this->facilities)) { + $facility = $this->facilities[strtolower($facility)]; + } elseif (!in_array($facility, array_values($this->facilities), true)) { + throw new \UnexpectedValueException('Unknown facility value "'.$facility.'" given'); + } + + $this->facility = $facility; + } + + /** + * {@inheritdoc} + */ + protected function getDefaultFormatter() + { + return new LineFormatter('%channel%.%level_name%: %message% %context% %extra%'); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php new file mode 100644 index 0000000..e5a46bc --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php @@ -0,0 +1,148 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\JsonFormatter; +use PhpAmqpLib\Message\AMQPMessage; +use PhpAmqpLib\Channel\AMQPChannel; +use AMQPExchange; + +class AmqpHandler extends AbstractProcessingHandler +{ + /** + * @var AMQPExchange|AMQPChannel $exchange + */ + protected $exchange; + + /** + * @var string + */ + protected $exchangeName; + + /** + * @param AMQPExchange|AMQPChannel $exchange AMQPExchange (php AMQP ext) or PHP AMQP lib channel, ready for use + * @param string $exchangeName + * @param int $level + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct($exchange, $exchangeName = 'log', $level = Logger::DEBUG, $bubble = true) + { + if ($exchange instanceof AMQPExchange) { + $exchange->setName($exchangeName); + } elseif ($exchange instanceof AMQPChannel) { + $this->exchangeName = $exchangeName; + } else { + throw new \InvalidArgumentException('PhpAmqpLib\Channel\AMQPChannel or AMQPExchange instance required'); + } + $this->exchange = $exchange; + + parent::__construct($level, $bubble); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record) + { + $data = $record["formatted"]; + $routingKey = $this->getRoutingKey($record); + + if ($this->exchange instanceof AMQPExchange) { + $this->exchange->publish( + $data, + $routingKey, + 0, + array( + 'delivery_mode' => 2, + 'content_type' => 'application/json', + ) + ); + } else { + $this->exchange->basic_publish( + $this->createAmqpMessage($data), + $this->exchangeName, + $routingKey + ); + } + } + + /** + * {@inheritDoc} + */ + public function handleBatch(array $records) + { + if ($this->exchange instanceof AMQPExchange) { + parent::handleBatch($records); + + return; + } + + foreach ($records as $record) { + if (!$this->isHandling($record)) { + continue; + } + + $record = $this->processRecord($record); + $data = $this->getFormatter()->format($record); + + $this->exchange->batch_basic_publish( + $this->createAmqpMessage($data), + $this->exchangeName, + $this->getRoutingKey($record) + ); + } + + $this->exchange->publish_batch(); + } + + /** + * Gets the routing key for the AMQP exchange + * + * @param array $record + * @return string + */ + protected function getRoutingKey(array $record) + { + $routingKey = sprintf( + '%s.%s', + // TODO 2.0 remove substr call + substr($record['level_name'], 0, 4), + $record['channel'] + ); + + return strtolower($routingKey); + } + + /** + * @param string $data + * @return AMQPMessage + */ + private function createAmqpMessage($data) + { + return new AMQPMessage( + (string) $data, + array( + 'delivery_mode' => 2, + 'content_type' => 'application/json', + ) + ); + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter() + { + return new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php new file mode 100644 index 0000000..23cf23b --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php @@ -0,0 +1,240 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\LineFormatter; + +/** + * Handler sending logs to browser's javascript console with no browser extension required + * + * @author Olivier Poitrey + */ +class BrowserConsoleHandler extends AbstractProcessingHandler +{ + protected static $initialized = false; + protected static $records = array(); + + /** + * {@inheritDoc} + * + * Formatted output may contain some formatting markers to be transferred to `console.log` using the %c format. + * + * Example of formatted string: + * + * You can do [[blue text]]{color: blue} or [[green background]]{background-color: green; color: white} + */ + protected function getDefaultFormatter() + { + return new LineFormatter('[[%channel%]]{macro: autolabel} [[%level_name%]]{font-weight: bold} %message%'); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record) + { + // Accumulate records + static::$records[] = $record; + + // Register shutdown handler if not already done + if (!static::$initialized) { + static::$initialized = true; + $this->registerShutdownFunction(); + } + } + + /** + * Convert records to javascript console commands and send it to the browser. + * This method is automatically called on PHP shutdown if output is HTML or Javascript. + */ + public static function send() + { + $format = static::getResponseFormat(); + if ($format === 'unknown') { + return; + } + + if (count(static::$records)) { + if ($format === 'html') { + static::writeOutput(''); + } elseif ($format === 'js') { + static::writeOutput(static::generateScript()); + } + static::resetStatic(); + } + } + + public function close() + { + self::resetStatic(); + } + + public function reset() + { + self::resetStatic(); + } + + /** + * Forget all logged records + */ + public static function resetStatic() + { + static::$records = array(); + } + + /** + * Wrapper for register_shutdown_function to allow overriding + */ + protected function registerShutdownFunction() + { + if (PHP_SAPI !== 'cli') { + register_shutdown_function(array('Monolog\Handler\BrowserConsoleHandler', 'send')); + } + } + + /** + * Wrapper for echo to allow overriding + * + * @param string $str + */ + protected static function writeOutput($str) + { + echo $str; + } + + /** + * Checks the format of the response + * + * If Content-Type is set to application/javascript or text/javascript -> js + * If Content-Type is set to text/html, or is unset -> html + * If Content-Type is anything else -> unknown + * + * @return string One of 'js', 'html' or 'unknown' + */ + protected static function getResponseFormat() + { + // Check content type + foreach (headers_list() as $header) { + if (stripos($header, 'content-type:') === 0) { + // This handler only works with HTML and javascript outputs + // text/javascript is obsolete in favour of application/javascript, but still used + if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) { + return 'js'; + } + if (stripos($header, 'text/html') === false) { + return 'unknown'; + } + break; + } + } + + return 'html'; + } + + private static function generateScript() + { + $script = array(); + foreach (static::$records as $record) { + $context = static::dump('Context', $record['context']); + $extra = static::dump('Extra', $record['extra']); + + if (empty($context) && empty($extra)) { + $script[] = static::call_array('log', static::handleStyles($record['formatted'])); + } else { + $script = array_merge($script, + array(static::call_array('groupCollapsed', static::handleStyles($record['formatted']))), + $context, + $extra, + array(static::call('groupEnd')) + ); + } + } + + return "(function (c) {if (c && c.groupCollapsed) {\n" . implode("\n", $script) . "\n}})(console);"; + } + + private static function handleStyles($formatted) + { + $args = array(static::quote('font-weight: normal')); + $format = '%c' . $formatted; + preg_match_all('/\[\[(.*?)\]\]\{([^}]*)\}/s', $format, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); + + foreach (array_reverse($matches) as $match) { + $args[] = static::quote(static::handleCustomStyles($match[2][0], $match[1][0])); + $args[] = '"font-weight: normal"'; + + $pos = $match[0][1]; + $format = substr($format, 0, $pos) . '%c' . $match[1][0] . '%c' . substr($format, $pos + strlen($match[0][0])); + } + + array_unshift($args, static::quote($format)); + + return $args; + } + + private static function handleCustomStyles($style, $string) + { + static $colors = array('blue', 'green', 'red', 'magenta', 'orange', 'black', 'grey'); + static $labels = array(); + + return preg_replace_callback('/macro\s*:(.*?)(?:;|$)/', function ($m) use ($string, &$colors, &$labels) { + if (trim($m[1]) === 'autolabel') { + // Format the string as a label with consistent auto assigned background color + if (!isset($labels[$string])) { + $labels[$string] = $colors[count($labels) % count($colors)]; + } + $color = $labels[$string]; + + return "background-color: $color; color: white; border-radius: 3px; padding: 0 2px 0 2px"; + } + + return $m[1]; + }, $style); + } + + private static function dump($title, array $dict) + { + $script = array(); + $dict = array_filter($dict); + if (empty($dict)) { + return $script; + } + $script[] = static::call('log', static::quote('%c%s'), static::quote('font-weight: bold'), static::quote($title)); + foreach ($dict as $key => $value) { + $value = json_encode($value); + if (empty($value)) { + $value = static::quote(''); + } + $script[] = static::call('log', static::quote('%s: %o'), static::quote($key), $value); + } + + return $script; + } + + private static function quote($arg) + { + return '"' . addcslashes($arg, "\"\n\\") . '"'; + } + + private static function call() + { + $args = func_get_args(); + $method = array_shift($args); + + return static::call_array($method, $args); + } + + private static function call_array($method, array $args) + { + return 'c.' . $method . '(' . implode(', ', $args) . ');'; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php new file mode 100644 index 0000000..61d1b50 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php @@ -0,0 +1,129 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\ResettableInterface; + +/** + * Buffers all records until closing the handler and then pass them as batch. + * + * This is useful for a MailHandler to send only one mail per request instead of + * sending one per log message. + * + * @author Christophe Coevoet + */ +class BufferHandler extends AbstractHandler +{ + protected $handler; + protected $bufferSize = 0; + protected $bufferLimit; + protected $flushOnOverflow; + protected $buffer = array(); + protected $initialized = false; + + /** + * @param HandlerInterface $handler Handler. + * @param int $bufferLimit How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded + */ + public function __construct(HandlerInterface $handler, $bufferLimit = 0, $level = Logger::DEBUG, $bubble = true, $flushOnOverflow = false) + { + parent::__construct($level, $bubble); + $this->handler = $handler; + $this->bufferLimit = (int) $bufferLimit; + $this->flushOnOverflow = $flushOnOverflow; + } + + /** + * {@inheritdoc} + */ + public function handle(array $record) + { + if ($record['level'] < $this->level) { + return false; + } + + if (!$this->initialized) { + // __destructor() doesn't get called on Fatal errors + register_shutdown_function(array($this, 'close')); + $this->initialized = true; + } + + if ($this->bufferLimit > 0 && $this->bufferSize === $this->bufferLimit) { + if ($this->flushOnOverflow) { + $this->flush(); + } else { + array_shift($this->buffer); + $this->bufferSize--; + } + } + + if ($this->processors) { + foreach ($this->processors as $processor) { + $record = call_user_func($processor, $record); + } + } + + $this->buffer[] = $record; + $this->bufferSize++; + + return false === $this->bubble; + } + + public function flush() + { + if ($this->bufferSize === 0) { + return; + } + + $this->handler->handleBatch($this->buffer); + $this->clear(); + } + + public function __destruct() + { + // suppress the parent behavior since we already have register_shutdown_function() + // to call close(), and the reference contained there will prevent this from being + // GC'd until the end of the request + } + + /** + * {@inheritdoc} + */ + public function close() + { + $this->flush(); + } + + /** + * Clears the buffer without flushing any messages down to the wrapped handler. + */ + public function clear() + { + $this->bufferSize = 0; + $this->buffer = array(); + } + + public function reset() + { + $this->flush(); + + parent::reset(); + + if ($this->handler instanceof ResettableInterface) { + $this->handler->reset(); + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php new file mode 100644 index 0000000..37419a0 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php @@ -0,0 +1,211 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\ChromePHPFormatter; +use Monolog\Logger; + +/** + * Handler sending logs to the ChromePHP extension (http://www.chromephp.com/) + * + * This also works out of the box with Firefox 43+ + * + * @author Christophe Coevoet + */ +class ChromePHPHandler extends AbstractProcessingHandler +{ + /** + * Version of the extension + */ + const VERSION = '4.0'; + + /** + * Header name + */ + const HEADER_NAME = 'X-ChromeLogger-Data'; + + /** + * Regular expression to detect supported browsers (matches any Chrome, or Firefox 43+) + */ + const USER_AGENT_REGEX = '{\b(?:Chrome/\d+(?:\.\d+)*|HeadlessChrome|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}'; + + protected static $initialized = false; + + /** + * Tracks whether we sent too much data + * + * Chrome limits the headers to 256KB, so when we sent 240KB we stop sending + * + * @var bool + */ + protected static $overflowed = false; + + protected static $json = array( + 'version' => self::VERSION, + 'columns' => array('label', 'log', 'backtrace', 'type'), + 'rows' => array(), + ); + + protected static $sendHeaders = true; + + /** + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct($level = Logger::DEBUG, $bubble = true) + { + parent::__construct($level, $bubble); + if (!function_exists('json_encode')) { + throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s ChromePHPHandler'); + } + } + + /** + * {@inheritdoc} + */ + public function handleBatch(array $records) + { + $messages = array(); + + foreach ($records as $record) { + if ($record['level'] < $this->level) { + continue; + } + $messages[] = $this->processRecord($record); + } + + if (!empty($messages)) { + $messages = $this->getFormatter()->formatBatch($messages); + self::$json['rows'] = array_merge(self::$json['rows'], $messages); + $this->send(); + } + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter() + { + return new ChromePHPFormatter(); + } + + /** + * Creates & sends header for a record + * + * @see sendHeader() + * @see send() + * @param array $record + */ + protected function write(array $record) + { + self::$json['rows'][] = $record['formatted']; + + $this->send(); + } + + /** + * Sends the log header + * + * @see sendHeader() + */ + protected function send() + { + if (self::$overflowed || !self::$sendHeaders) { + return; + } + + if (!self::$initialized) { + self::$initialized = true; + + self::$sendHeaders = $this->headersAccepted(); + if (!self::$sendHeaders) { + return; + } + + self::$json['request_uri'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; + } + + $json = @json_encode(self::$json); + $data = base64_encode(utf8_encode($json)); + if (strlen($data) > 240 * 1024) { + self::$overflowed = true; + + $record = array( + 'message' => 'Incomplete logs, chrome header size limit reached', + 'context' => array(), + 'level' => Logger::WARNING, + 'level_name' => Logger::getLevelName(Logger::WARNING), + 'channel' => 'monolog', + 'datetime' => new \DateTime(), + 'extra' => array(), + ); + self::$json['rows'][count(self::$json['rows']) - 1] = $this->getFormatter()->format($record); + $json = @json_encode(self::$json); + $data = base64_encode(utf8_encode($json)); + } + + if (trim($data) !== '') { + $this->sendHeader(self::HEADER_NAME, $data); + } + } + + /** + * Send header string to the client + * + * @param string $header + * @param string $content + */ + protected function sendHeader($header, $content) + { + if (!headers_sent() && self::$sendHeaders) { + header(sprintf('%s: %s', $header, $content)); + } + } + + /** + * Verifies if the headers are accepted by the current user agent + * + * @return bool + */ + protected function headersAccepted() + { + if (empty($_SERVER['HTTP_USER_AGENT'])) { + return false; + } + + return preg_match(self::USER_AGENT_REGEX, $_SERVER['HTTP_USER_AGENT']); + } + + /** + * BC getter for the sendHeaders property that has been made static + */ + public function __get($property) + { + if ('sendHeaders' !== $property) { + throw new \InvalidArgumentException('Undefined property '.$property); + } + + return static::$sendHeaders; + } + + /** + * BC setter for the sendHeaders property that has been made static + */ + public function __set($property, $value) + { + if ('sendHeaders' !== $property) { + throw new \InvalidArgumentException('Undefined property '.$property); + } + + static::$sendHeaders = $value; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php new file mode 100644 index 0000000..cc98697 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\JsonFormatter; +use Monolog\Logger; + +/** + * CouchDB handler + * + * @author Markus Bachmann + */ +class CouchDBHandler extends AbstractProcessingHandler +{ + private $options; + + public function __construct(array $options = array(), $level = Logger::DEBUG, $bubble = true) + { + $this->options = array_merge(array( + 'host' => 'localhost', + 'port' => 5984, + 'dbname' => 'logger', + 'username' => null, + 'password' => null, + ), $options); + + parent::__construct($level, $bubble); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record) + { + $basicAuth = null; + if ($this->options['username']) { + $basicAuth = sprintf('%s:%s@', $this->options['username'], $this->options['password']); + } + + $url = 'http://'.$basicAuth.$this->options['host'].':'.$this->options['port'].'/'.$this->options['dbname']; + $context = stream_context_create(array( + 'http' => array( + 'method' => 'POST', + 'content' => $record['formatted'], + 'ignore_errors' => true, + 'max_redirects' => 0, + 'header' => 'Content-type: application/json', + ), + )); + + if (false === @file_get_contents($url, null, $context)) { + throw new \RuntimeException(sprintf('Could not connect to %s', $url)); + } + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter() + { + return new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php new file mode 100644 index 0000000..96b3ca0 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php @@ -0,0 +1,151 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Logs to Cube. + * + * @link http://square.github.com/cube/ + * @author Wan Chen + */ +class CubeHandler extends AbstractProcessingHandler +{ + private $udpConnection; + private $httpConnection; + private $scheme; + private $host; + private $port; + private $acceptedSchemes = array('http', 'udp'); + + /** + * Create a Cube handler + * + * @throws \UnexpectedValueException when given url is not a valid url. + * A valid url must consist of three parts : protocol://host:port + * Only valid protocols used by Cube are http and udp + */ + public function __construct($url, $level = Logger::DEBUG, $bubble = true) + { + $urlInfo = parse_url($url); + + if (!isset($urlInfo['scheme'], $urlInfo['host'], $urlInfo['port'])) { + throw new \UnexpectedValueException('URL "'.$url.'" is not valid'); + } + + if (!in_array($urlInfo['scheme'], $this->acceptedSchemes)) { + throw new \UnexpectedValueException( + 'Invalid protocol (' . $urlInfo['scheme'] . ').' + . ' Valid options are ' . implode(', ', $this->acceptedSchemes)); + } + + $this->scheme = $urlInfo['scheme']; + $this->host = $urlInfo['host']; + $this->port = $urlInfo['port']; + + parent::__construct($level, $bubble); + } + + /** + * Establish a connection to an UDP socket + * + * @throws \LogicException when unable to connect to the socket + * @throws MissingExtensionException when there is no socket extension + */ + protected function connectUdp() + { + if (!extension_loaded('sockets')) { + throw new MissingExtensionException('The sockets extension is required to use udp URLs with the CubeHandler'); + } + + $this->udpConnection = socket_create(AF_INET, SOCK_DGRAM, 0); + if (!$this->udpConnection) { + throw new \LogicException('Unable to create a socket'); + } + + if (!socket_connect($this->udpConnection, $this->host, $this->port)) { + throw new \LogicException('Unable to connect to the socket at ' . $this->host . ':' . $this->port); + } + } + + /** + * Establish a connection to a http server + * @throws \LogicException when no curl extension + */ + protected function connectHttp() + { + if (!extension_loaded('curl')) { + throw new \LogicException('The curl extension is needed to use http URLs with the CubeHandler'); + } + + $this->httpConnection = curl_init('http://'.$this->host.':'.$this->port.'/1.0/event/put'); + + if (!$this->httpConnection) { + throw new \LogicException('Unable to connect to ' . $this->host . ':' . $this->port); + } + + curl_setopt($this->httpConnection, CURLOPT_CUSTOMREQUEST, "POST"); + curl_setopt($this->httpConnection, CURLOPT_RETURNTRANSFER, true); + } + + /** + * {@inheritdoc} + */ + protected function write(array $record) + { + $date = $record['datetime']; + + $data = array('time' => $date->format('Y-m-d\TH:i:s.uO')); + unset($record['datetime']); + + if (isset($record['context']['type'])) { + $data['type'] = $record['context']['type']; + unset($record['context']['type']); + } else { + $data['type'] = $record['channel']; + } + + $data['data'] = $record['context']; + $data['data']['level'] = $record['level']; + + if ($this->scheme === 'http') { + $this->writeHttp(json_encode($data)); + } else { + $this->writeUdp(json_encode($data)); + } + } + + private function writeUdp($data) + { + if (!$this->udpConnection) { + $this->connectUdp(); + } + + socket_send($this->udpConnection, $data, strlen($data), 0); + } + + private function writeHttp($data) + { + if (!$this->httpConnection) { + $this->connectHttp(); + } + + curl_setopt($this->httpConnection, CURLOPT_POSTFIELDS, '['.$data.']'); + curl_setopt($this->httpConnection, CURLOPT_HTTPHEADER, array( + 'Content-Type: application/json', + 'Content-Length: ' . strlen('['.$data.']'), + )); + + Curl\Util::execute($this->httpConnection, 5, false); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php b/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php new file mode 100644 index 0000000..48d30b3 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\Curl; + +class Util +{ + private static $retriableErrorCodes = array( + CURLE_COULDNT_RESOLVE_HOST, + CURLE_COULDNT_CONNECT, + CURLE_HTTP_NOT_FOUND, + CURLE_READ_ERROR, + CURLE_OPERATION_TIMEOUTED, + CURLE_HTTP_POST_ERROR, + CURLE_SSL_CONNECT_ERROR, + ); + + /** + * Executes a CURL request with optional retries and exception on failure + * + * @param resource $ch curl handler + * @throws \RuntimeException + */ + public static function execute($ch, $retries = 5, $closeAfterDone = true) + { + while ($retries--) { + if (curl_exec($ch) === false) { + $curlErrno = curl_errno($ch); + + if (false === in_array($curlErrno, self::$retriableErrorCodes, true) || !$retries) { + $curlError = curl_error($ch); + + if ($closeAfterDone) { + curl_close($ch); + } + + throw new \RuntimeException(sprintf('Curl error (code %s): %s', $curlErrno, $curlError)); + } + + continue; + } + + if ($closeAfterDone) { + curl_close($ch); + } + break; + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php new file mode 100644 index 0000000..35b55cb --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php @@ -0,0 +1,169 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Simple handler wrapper that deduplicates log records across multiple requests + * + * It also includes the BufferHandler functionality and will buffer + * all messages until the end of the request or flush() is called. + * + * This works by storing all log records' messages above $deduplicationLevel + * to the file specified by $deduplicationStore. When further logs come in at the end of the + * request (or when flush() is called), all those above $deduplicationLevel are checked + * against the existing stored logs. If they match and the timestamps in the stored log is + * not older than $time seconds, the new log record is discarded. If no log record is new, the + * whole data set is discarded. + * + * This is mainly useful in combination with Mail handlers or things like Slack or HipChat handlers + * that send messages to people, to avoid spamming with the same message over and over in case of + * a major component failure like a database server being down which makes all requests fail in the + * same way. + * + * @author Jordi Boggiano + */ +class DeduplicationHandler extends BufferHandler +{ + /** + * @var string + */ + protected $deduplicationStore; + + /** + * @var int + */ + protected $deduplicationLevel; + + /** + * @var int + */ + protected $time; + + /** + * @var bool + */ + private $gc = false; + + /** + * @param HandlerInterface $handler Handler. + * @param string $deduplicationStore The file/path where the deduplication log should be kept + * @param int $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes + * @param int $time The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct(HandlerInterface $handler, $deduplicationStore = null, $deduplicationLevel = Logger::ERROR, $time = 60, $bubble = true) + { + parent::__construct($handler, 0, Logger::DEBUG, $bubble, false); + + $this->deduplicationStore = $deduplicationStore === null ? sys_get_temp_dir() . '/monolog-dedup-' . substr(md5(__FILE__), 0, 20) .'.log' : $deduplicationStore; + $this->deduplicationLevel = Logger::toMonologLevel($deduplicationLevel); + $this->time = $time; + } + + public function flush() + { + if ($this->bufferSize === 0) { + return; + } + + $passthru = null; + + foreach ($this->buffer as $record) { + if ($record['level'] >= $this->deduplicationLevel) { + + $passthru = $passthru || !$this->isDuplicate($record); + if ($passthru) { + $this->appendRecord($record); + } + } + } + + // default of null is valid as well as if no record matches duplicationLevel we just pass through + if ($passthru === true || $passthru === null) { + $this->handler->handleBatch($this->buffer); + } + + $this->clear(); + + if ($this->gc) { + $this->collectLogs(); + } + } + + private function isDuplicate(array $record) + { + if (!file_exists($this->deduplicationStore)) { + return false; + } + + $store = file($this->deduplicationStore, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + if (!is_array($store)) { + return false; + } + + $yesterday = time() - 86400; + $timestampValidity = $record['datetime']->getTimestamp() - $this->time; + $expectedMessage = preg_replace('{[\r\n].*}', '', $record['message']); + + for ($i = count($store) - 1; $i >= 0; $i--) { + list($timestamp, $level, $message) = explode(':', $store[$i], 3); + + if ($level === $record['level_name'] && $message === $expectedMessage && $timestamp > $timestampValidity) { + return true; + } + + if ($timestamp < $yesterday) { + $this->gc = true; + } + } + + return false; + } + + private function collectLogs() + { + if (!file_exists($this->deduplicationStore)) { + return false; + } + + $handle = fopen($this->deduplicationStore, 'rw+'); + flock($handle, LOCK_EX); + $validLogs = array(); + + $timestampValidity = time() - $this->time; + + while (!feof($handle)) { + $log = fgets($handle); + if (substr($log, 0, 10) >= $timestampValidity) { + $validLogs[] = $log; + } + } + + ftruncate($handle, 0); + rewind($handle); + foreach ($validLogs as $log) { + fwrite($handle, $log); + } + + flock($handle, LOCK_UN); + fclose($handle); + + $this->gc = false; + } + + private function appendRecord(array $record) + { + file_put_contents($this->deduplicationStore, $record['datetime']->getTimestamp() . ':' . $record['level_name'] . ':' . preg_replace('{[\r\n].*}', '', $record['message']) . "\n", FILE_APPEND); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php new file mode 100644 index 0000000..b91ffec --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\NormalizerFormatter; +use Doctrine\CouchDB\CouchDBClient; + +/** + * CouchDB handler for Doctrine CouchDB ODM + * + * @author Markus Bachmann + */ +class DoctrineCouchDBHandler extends AbstractProcessingHandler +{ + private $client; + + public function __construct(CouchDBClient $client, $level = Logger::DEBUG, $bubble = true) + { + $this->client = $client; + parent::__construct($level, $bubble); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record) + { + $this->client->postDocument($record['formatted']); + } + + protected function getDefaultFormatter() + { + return new NormalizerFormatter; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php new file mode 100644 index 0000000..237b71f --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php @@ -0,0 +1,107 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Aws\Sdk; +use Aws\DynamoDb\DynamoDbClient; +use Aws\DynamoDb\Marshaler; +use Monolog\Formatter\ScalarFormatter; +use Monolog\Logger; + +/** + * Amazon DynamoDB handler (http://aws.amazon.com/dynamodb/) + * + * @link https://github.com/aws/aws-sdk-php/ + * @author Andrew Lawson + */ +class DynamoDbHandler extends AbstractProcessingHandler +{ + const DATE_FORMAT = 'Y-m-d\TH:i:s.uO'; + + /** + * @var DynamoDbClient + */ + protected $client; + + /** + * @var string + */ + protected $table; + + /** + * @var int + */ + protected $version; + + /** + * @var Marshaler + */ + protected $marshaler; + + /** + * @param DynamoDbClient $client + * @param string $table + * @param int $level + * @param bool $bubble + */ + public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true) + { + if (defined('Aws\Sdk::VERSION') && version_compare(Sdk::VERSION, '3.0', '>=')) { + $this->version = 3; + $this->marshaler = new Marshaler; + } else { + $this->version = 2; + } + + $this->client = $client; + $this->table = $table; + + parent::__construct($level, $bubble); + } + + /** + * {@inheritdoc} + */ + protected function write(array $record) + { + $filtered = $this->filterEmptyFields($record['formatted']); + if ($this->version === 3) { + $formatted = $this->marshaler->marshalItem($filtered); + } else { + $formatted = $this->client->formatAttributes($filtered); + } + + $this->client->putItem(array( + 'TableName' => $this->table, + 'Item' => $formatted, + )); + } + + /** + * @param array $record + * @return array + */ + protected function filterEmptyFields(array $record) + { + return array_filter($record, function ($value) { + return !empty($value) || false === $value || 0 === $value; + }); + } + + /** + * {@inheritdoc} + */ + protected function getDefaultFormatter() + { + return new ScalarFormatter(self::DATE_FORMAT); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php new file mode 100644 index 0000000..bb0f83e --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php @@ -0,0 +1,128 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\ElasticaFormatter; +use Monolog\Logger; +use Elastica\Client; +use Elastica\Exception\ExceptionInterface; + +/** + * Elastic Search handler + * + * Usage example: + * + * $client = new \Elastica\Client(); + * $options = array( + * 'index' => 'elastic_index_name', + * 'type' => 'elastic_doc_type', + * ); + * $handler = new ElasticSearchHandler($client, $options); + * $log = new Logger('application'); + * $log->pushHandler($handler); + * + * @author Jelle Vink + */ +class ElasticSearchHandler extends AbstractProcessingHandler +{ + /** + * @var Client + */ + protected $client; + + /** + * @var array Handler config options + */ + protected $options = array(); + + /** + * @param Client $client Elastica Client object + * @param array $options Handler configuration + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct(Client $client, array $options = array(), $level = Logger::DEBUG, $bubble = true) + { + parent::__construct($level, $bubble); + $this->client = $client; + $this->options = array_merge( + array( + 'index' => 'monolog', // Elastic index name + 'type' => 'record', // Elastic document type + 'ignore_error' => false, // Suppress Elastica exceptions + ), + $options + ); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record) + { + $this->bulkSend(array($record['formatted'])); + } + + /** + * {@inheritdoc} + */ + public function setFormatter(FormatterInterface $formatter) + { + if ($formatter instanceof ElasticaFormatter) { + return parent::setFormatter($formatter); + } + throw new \InvalidArgumentException('ElasticSearchHandler is only compatible with ElasticaFormatter'); + } + + /** + * Getter options + * @return array + */ + public function getOptions() + { + return $this->options; + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter() + { + return new ElasticaFormatter($this->options['index'], $this->options['type']); + } + + /** + * {@inheritdoc} + */ + public function handleBatch(array $records) + { + $documents = $this->getFormatter()->formatBatch($records); + $this->bulkSend($documents); + } + + /** + * Use Elasticsearch bulk API to send list of documents + * @param array $documents + * @throws \RuntimeException + */ + protected function bulkSend(array $documents) + { + try { + $this->client->addDocuments($documents); + } catch (ExceptionInterface $e) { + if (!$this->options['ignore_error']) { + throw new \RuntimeException("Error sending messages to Elasticsearch", 0, $e); + } + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php new file mode 100644 index 0000000..b2986b0 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\LineFormatter; +use Monolog\Logger; + +/** + * Stores to PHP error_log() handler. + * + * @author Elan Ruusamäe + */ +class ErrorLogHandler extends AbstractProcessingHandler +{ + const OPERATING_SYSTEM = 0; + const SAPI = 4; + + protected $messageType; + protected $expandNewlines; + + /** + * @param int $messageType Says where the error should go. + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries + */ + public function __construct($messageType = self::OPERATING_SYSTEM, $level = Logger::DEBUG, $bubble = true, $expandNewlines = false) + { + parent::__construct($level, $bubble); + + if (false === in_array($messageType, self::getAvailableTypes())) { + $message = sprintf('The given message type "%s" is not supported', print_r($messageType, true)); + throw new \InvalidArgumentException($message); + } + + $this->messageType = $messageType; + $this->expandNewlines = $expandNewlines; + } + + /** + * @return array With all available types + */ + public static function getAvailableTypes() + { + return array( + self::OPERATING_SYSTEM, + self::SAPI, + ); + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter() + { + return new LineFormatter('[%datetime%] %channel%.%level_name%: %message% %context% %extra%'); + } + + /** + * {@inheritdoc} + */ + protected function write(array $record) + { + if ($this->expandNewlines) { + $lines = preg_split('{[\r\n]+}', (string) $record['formatted']); + foreach ($lines as $line) { + error_log($line, $this->messageType); + } + } else { + error_log((string) $record['formatted'], $this->messageType); + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php new file mode 100644 index 0000000..938c1a7 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php @@ -0,0 +1,140 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Simple handler wrapper that filters records based on a list of levels + * + * It can be configured with an exact list of levels to allow, or a min/max level. + * + * @author Hennadiy Verkh + * @author Jordi Boggiano + */ +class FilterHandler extends AbstractHandler +{ + /** + * Handler or factory callable($record, $this) + * + * @var callable|\Monolog\Handler\HandlerInterface + */ + protected $handler; + + /** + * Minimum level for logs that are passed to handler + * + * @var int[] + */ + protected $acceptedLevels; + + /** + * Whether the messages that are handled can bubble up the stack or not + * + * @var bool + */ + protected $bubble; + + /** + * @param callable|HandlerInterface $handler Handler or factory callable($record, $this). + * @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided + * @param int $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct($handler, $minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY, $bubble = true) + { + $this->handler = $handler; + $this->bubble = $bubble; + $this->setAcceptedLevels($minLevelOrList, $maxLevel); + + if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { + throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); + } + } + + /** + * @return array + */ + public function getAcceptedLevels() + { + return array_flip($this->acceptedLevels); + } + + /** + * @param int|string|array $minLevelOrList A list of levels to accept or a minimum level or level name if maxLevel is provided + * @param int|string $maxLevel Maximum level or level name to accept, only used if $minLevelOrList is not an array + */ + public function setAcceptedLevels($minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY) + { + if (is_array($minLevelOrList)) { + $acceptedLevels = array_map('Monolog\Logger::toMonologLevel', $minLevelOrList); + } else { + $minLevelOrList = Logger::toMonologLevel($minLevelOrList); + $maxLevel = Logger::toMonologLevel($maxLevel); + $acceptedLevels = array_values(array_filter(Logger::getLevels(), function ($level) use ($minLevelOrList, $maxLevel) { + return $level >= $minLevelOrList && $level <= $maxLevel; + })); + } + $this->acceptedLevels = array_flip($acceptedLevels); + } + + /** + * {@inheritdoc} + */ + public function isHandling(array $record) + { + return isset($this->acceptedLevels[$record['level']]); + } + + /** + * {@inheritdoc} + */ + public function handle(array $record) + { + if (!$this->isHandling($record)) { + return false; + } + + // The same logic as in FingersCrossedHandler + if (!$this->handler instanceof HandlerInterface) { + $this->handler = call_user_func($this->handler, $record, $this); + if (!$this->handler instanceof HandlerInterface) { + throw new \RuntimeException("The factory callable should return a HandlerInterface"); + } + } + + if ($this->processors) { + foreach ($this->processors as $processor) { + $record = call_user_func($processor, $record); + } + } + + $this->handler->handle($record); + + return false === $this->bubble; + } + + /** + * {@inheritdoc} + */ + public function handleBatch(array $records) + { + $filtered = array(); + foreach ($records as $record) { + if ($this->isHandling($record)) { + $filtered[] = $record; + } + } + + $this->handler->handleBatch($filtered); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php new file mode 100644 index 0000000..aaca12c --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\FingersCrossed; + +/** + * Interface for activation strategies for the FingersCrossedHandler. + * + * @author Johannes M. Schmitt + */ +interface ActivationStrategyInterface +{ + /** + * Returns whether the given record activates the handler. + * + * @param array $record + * @return bool + */ + public function isHandlerActivated(array $record); +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php new file mode 100644 index 0000000..2a2a64d --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\FingersCrossed; + +use Monolog\Logger; + +/** + * Channel and Error level based monolog activation strategy. Allows to trigger activation + * based on level per channel. e.g. trigger activation on level 'ERROR' by default, except + * for records of the 'sql' channel; those should trigger activation on level 'WARN'. + * + * Example: + * + * + * $activationStrategy = new ChannelLevelActivationStrategy( + * Logger::CRITICAL, + * array( + * 'request' => Logger::ALERT, + * 'sensitive' => Logger::ERROR, + * ) + * ); + * $handler = new FingersCrossedHandler(new StreamHandler('php://stderr'), $activationStrategy); + * + * + * @author Mike Meessen + */ +class ChannelLevelActivationStrategy implements ActivationStrategyInterface +{ + private $defaultActionLevel; + private $channelToActionLevel; + + /** + * @param int $defaultActionLevel The default action level to be used if the record's category doesn't match any + * @param array $channelToActionLevel An array that maps channel names to action levels. + */ + public function __construct($defaultActionLevel, $channelToActionLevel = array()) + { + $this->defaultActionLevel = Logger::toMonologLevel($defaultActionLevel); + $this->channelToActionLevel = array_map('Monolog\Logger::toMonologLevel', $channelToActionLevel); + } + + public function isHandlerActivated(array $record) + { + if (isset($this->channelToActionLevel[$record['channel']])) { + return $record['level'] >= $this->channelToActionLevel[$record['channel']]; + } + + return $record['level'] >= $this->defaultActionLevel; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php new file mode 100644 index 0000000..6e63085 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\FingersCrossed; + +use Monolog\Logger; + +/** + * Error level based activation strategy. + * + * @author Johannes M. Schmitt + */ +class ErrorLevelActivationStrategy implements ActivationStrategyInterface +{ + private $actionLevel; + + public function __construct($actionLevel) + { + $this->actionLevel = Logger::toMonologLevel($actionLevel); + } + + public function isHandlerActivated(array $record) + { + return $record['level'] >= $this->actionLevel; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php new file mode 100644 index 0000000..275fd51 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php @@ -0,0 +1,177 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy; +use Monolog\Handler\FingersCrossed\ActivationStrategyInterface; +use Monolog\Logger; +use Monolog\ResettableInterface; + +/** + * Buffers all records until a certain level is reached + * + * The advantage of this approach is that you don't get any clutter in your log files. + * Only requests which actually trigger an error (or whatever your actionLevel is) will be + * in the logs, but they will contain all records, not only those above the level threshold. + * + * You can find the various activation strategies in the + * Monolog\Handler\FingersCrossed\ namespace. + * + * @author Jordi Boggiano + */ +class FingersCrossedHandler extends AbstractHandler +{ + protected $handler; + protected $activationStrategy; + protected $buffering = true; + protected $bufferSize; + protected $buffer = array(); + protected $stopBuffering; + protected $passthruLevel; + + /** + * @param callable|HandlerInterface $handler Handler or factory callable($record, $fingersCrossedHandler). + * @param int|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action + * @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $stopBuffering Whether the handler should stop buffering after being triggered (default true) + * @param int $passthruLevel Minimum level to always flush to handler on close, even if strategy not triggered + */ + public function __construct($handler, $activationStrategy = null, $bufferSize = 0, $bubble = true, $stopBuffering = true, $passthruLevel = null) + { + if (null === $activationStrategy) { + $activationStrategy = new ErrorLevelActivationStrategy(Logger::WARNING); + } + + // convert simple int activationStrategy to an object + if (!$activationStrategy instanceof ActivationStrategyInterface) { + $activationStrategy = new ErrorLevelActivationStrategy($activationStrategy); + } + + $this->handler = $handler; + $this->activationStrategy = $activationStrategy; + $this->bufferSize = $bufferSize; + $this->bubble = $bubble; + $this->stopBuffering = $stopBuffering; + + if ($passthruLevel !== null) { + $this->passthruLevel = Logger::toMonologLevel($passthruLevel); + } + + if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { + throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); + } + } + + /** + * {@inheritdoc} + */ + public function isHandling(array $record) + { + return true; + } + + /** + * Manually activate this logger regardless of the activation strategy + */ + public function activate() + { + if ($this->stopBuffering) { + $this->buffering = false; + } + if (!$this->handler instanceof HandlerInterface) { + $record = end($this->buffer) ?: null; + + $this->handler = call_user_func($this->handler, $record, $this); + if (!$this->handler instanceof HandlerInterface) { + throw new \RuntimeException("The factory callable should return a HandlerInterface"); + } + } + $this->handler->handleBatch($this->buffer); + $this->buffer = array(); + } + + /** + * {@inheritdoc} + */ + public function handle(array $record) + { + if ($this->processors) { + foreach ($this->processors as $processor) { + $record = call_user_func($processor, $record); + } + } + + if ($this->buffering) { + $this->buffer[] = $record; + if ($this->bufferSize > 0 && count($this->buffer) > $this->bufferSize) { + array_shift($this->buffer); + } + if ($this->activationStrategy->isHandlerActivated($record)) { + $this->activate(); + } + } else { + $this->handler->handle($record); + } + + return false === $this->bubble; + } + + /** + * {@inheritdoc} + */ + public function close() + { + $this->flushBuffer(); + } + + public function reset() + { + $this->flushBuffer(); + + parent::reset(); + + if ($this->handler instanceof ResettableInterface) { + $this->handler->reset(); + } + } + + /** + * Clears the buffer without flushing any messages down to the wrapped handler. + * + * It also resets the handler to its initial buffering state. + */ + public function clear() + { + $this->buffer = array(); + $this->reset(); + } + + /** + * Resets the state of the handler. Stops forwarding records to the wrapped handler. + */ + private function flushBuffer() + { + if (null !== $this->passthruLevel) { + $level = $this->passthruLevel; + $this->buffer = array_filter($this->buffer, function ($record) use ($level) { + return $record['level'] >= $level; + }); + if (count($this->buffer) > 0) { + $this->handler->handleBatch($this->buffer); + } + } + + $this->buffer = array(); + $this->buffering = true; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php new file mode 100644 index 0000000..c30b184 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php @@ -0,0 +1,195 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\WildfireFormatter; + +/** + * Simple FirePHP Handler (http://www.firephp.org/), which uses the Wildfire protocol. + * + * @author Eric Clemmons (@ericclemmons) + */ +class FirePHPHandler extends AbstractProcessingHandler +{ + /** + * WildFire JSON header message format + */ + const PROTOCOL_URI = 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2'; + + /** + * FirePHP structure for parsing messages & their presentation + */ + const STRUCTURE_URI = 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'; + + /** + * Must reference a "known" plugin, otherwise headers won't display in FirePHP + */ + const PLUGIN_URI = 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3'; + + /** + * Header prefix for Wildfire to recognize & parse headers + */ + const HEADER_PREFIX = 'X-Wf'; + + /** + * Whether or not Wildfire vendor-specific headers have been generated & sent yet + */ + protected static $initialized = false; + + /** + * Shared static message index between potentially multiple handlers + * @var int + */ + protected static $messageIndex = 1; + + protected static $sendHeaders = true; + + /** + * Base header creation function used by init headers & record headers + * + * @param array $meta Wildfire Plugin, Protocol & Structure Indexes + * @param string $message Log message + * @return array Complete header string ready for the client as key and message as value + */ + protected function createHeader(array $meta, $message) + { + $header = sprintf('%s-%s', self::HEADER_PREFIX, join('-', $meta)); + + return array($header => $message); + } + + /** + * Creates message header from record + * + * @see createHeader() + * @param array $record + * @return string + */ + protected function createRecordHeader(array $record) + { + // Wildfire is extensible to support multiple protocols & plugins in a single request, + // but we're not taking advantage of that (yet), so we're using "1" for simplicity's sake. + return $this->createHeader( + array(1, 1, 1, self::$messageIndex++), + $record['formatted'] + ); + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter() + { + return new WildfireFormatter(); + } + + /** + * Wildfire initialization headers to enable message parsing + * + * @see createHeader() + * @see sendHeader() + * @return array + */ + protected function getInitHeaders() + { + // Initial payload consists of required headers for Wildfire + return array_merge( + $this->createHeader(array('Protocol', 1), self::PROTOCOL_URI), + $this->createHeader(array(1, 'Structure', 1), self::STRUCTURE_URI), + $this->createHeader(array(1, 'Plugin', 1), self::PLUGIN_URI) + ); + } + + /** + * Send header string to the client + * + * @param string $header + * @param string $content + */ + protected function sendHeader($header, $content) + { + if (!headers_sent() && self::$sendHeaders) { + header(sprintf('%s: %s', $header, $content)); + } + } + + /** + * Creates & sends header for a record, ensuring init headers have been sent prior + * + * @see sendHeader() + * @see sendInitHeaders() + * @param array $record + */ + protected function write(array $record) + { + if (!self::$sendHeaders) { + return; + } + + // WildFire-specific headers must be sent prior to any messages + if (!self::$initialized) { + self::$initialized = true; + + self::$sendHeaders = $this->headersAccepted(); + if (!self::$sendHeaders) { + return; + } + + foreach ($this->getInitHeaders() as $header => $content) { + $this->sendHeader($header, $content); + } + } + + $header = $this->createRecordHeader($record); + if (trim(current($header)) !== '') { + $this->sendHeader(key($header), current($header)); + } + } + + /** + * Verifies if the headers are accepted by the current user agent + * + * @return bool + */ + protected function headersAccepted() + { + if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('{\bFirePHP/\d+\.\d+\b}', $_SERVER['HTTP_USER_AGENT'])) { + return true; + } + + return isset($_SERVER['HTTP_X_FIREPHP_VERSION']); + } + + /** + * BC getter for the sendHeaders property that has been made static + */ + public function __get($property) + { + if ('sendHeaders' !== $property) { + throw new \InvalidArgumentException('Undefined property '.$property); + } + + return static::$sendHeaders; + } + + /** + * BC setter for the sendHeaders property that has been made static + */ + public function __set($property, $value) + { + if ('sendHeaders' !== $property) { + throw new \InvalidArgumentException('Undefined property '.$property); + } + + static::$sendHeaders = $value; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php new file mode 100644 index 0000000..c43c013 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php @@ -0,0 +1,126 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\LineFormatter; +use Monolog\Logger; + +/** + * Sends logs to Fleep.io using Webhook integrations + * + * You'll need a Fleep.io account to use this handler. + * + * @see https://fleep.io/integrations/webhooks/ Fleep Webhooks Documentation + * @author Ando Roots + */ +class FleepHookHandler extends SocketHandler +{ + const FLEEP_HOST = 'fleep.io'; + + const FLEEP_HOOK_URI = '/hook/'; + + /** + * @var string Webhook token (specifies the conversation where logs are sent) + */ + protected $token; + + /** + * Construct a new Fleep.io Handler. + * + * For instructions on how to create a new web hook in your conversations + * see https://fleep.io/integrations/webhooks/ + * + * @param string $token Webhook token + * @param bool|int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @throws MissingExtensionException + */ + public function __construct($token, $level = Logger::DEBUG, $bubble = true) + { + if (!extension_loaded('openssl')) { + throw new MissingExtensionException('The OpenSSL PHP extension is required to use the FleepHookHandler'); + } + + $this->token = $token; + + $connectionString = 'ssl://' . self::FLEEP_HOST . ':443'; + parent::__construct($connectionString, $level, $bubble); + } + + /** + * Returns the default formatter to use with this handler + * + * Overloaded to remove empty context and extra arrays from the end of the log message. + * + * @return LineFormatter + */ + protected function getDefaultFormatter() + { + return new LineFormatter(null, null, true, true); + } + + /** + * Handles a log record + * + * @param array $record + */ + public function write(array $record) + { + parent::write($record); + $this->closeSocket(); + } + + /** + * {@inheritdoc} + * + * @param array $record + * @return string + */ + protected function generateDataStream($record) + { + $content = $this->buildContent($record); + + return $this->buildHeader($content) . $content; + } + + /** + * Builds the header of the API Call + * + * @param string $content + * @return string + */ + private function buildHeader($content) + { + $header = "POST " . self::FLEEP_HOOK_URI . $this->token . " HTTP/1.1\r\n"; + $header .= "Host: " . self::FLEEP_HOST . "\r\n"; + $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; + $header .= "Content-Length: " . strlen($content) . "\r\n"; + $header .= "\r\n"; + + return $header; + } + + /** + * Builds the body of API call + * + * @param array $record + * @return string + */ + private function buildContent($record) + { + $dataArray = array( + 'message' => $record['formatted'], + ); + + return http_build_query($dataArray); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php new file mode 100644 index 0000000..dd9a361 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php @@ -0,0 +1,127 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\FlowdockFormatter; +use Monolog\Formatter\FormatterInterface; + +/** + * Sends notifications through the Flowdock push API + * + * This must be configured with a FlowdockFormatter instance via setFormatter() + * + * Notes: + * API token - Flowdock API token + * + * @author Dominik Liebler + * @see https://www.flowdock.com/api/push + */ +class FlowdockHandler extends SocketHandler +{ + /** + * @var string + */ + protected $apiToken; + + /** + * @param string $apiToken + * @param bool|int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * + * @throws MissingExtensionException if OpenSSL is missing + */ + public function __construct($apiToken, $level = Logger::DEBUG, $bubble = true) + { + if (!extension_loaded('openssl')) { + throw new MissingExtensionException('The OpenSSL PHP extension is required to use the FlowdockHandler'); + } + + parent::__construct('ssl://api.flowdock.com:443', $level, $bubble); + $this->apiToken = $apiToken; + } + + /** + * {@inheritdoc} + */ + public function setFormatter(FormatterInterface $formatter) + { + if (!$formatter instanceof FlowdockFormatter) { + throw new \InvalidArgumentException('The FlowdockHandler requires an instance of Monolog\Formatter\FlowdockFormatter to function correctly'); + } + + return parent::setFormatter($formatter); + } + + /** + * Gets the default formatter. + * + * @return FormatterInterface + */ + protected function getDefaultFormatter() + { + throw new \InvalidArgumentException('The FlowdockHandler must be configured (via setFormatter) with an instance of Monolog\Formatter\FlowdockFormatter to function correctly'); + } + + /** + * {@inheritdoc} + * + * @param array $record + */ + protected function write(array $record) + { + parent::write($record); + + $this->closeSocket(); + } + + /** + * {@inheritdoc} + * + * @param array $record + * @return string + */ + protected function generateDataStream($record) + { + $content = $this->buildContent($record); + + return $this->buildHeader($content) . $content; + } + + /** + * Builds the body of API call + * + * @param array $record + * @return string + */ + private function buildContent($record) + { + return json_encode($record['formatted']['flowdock']); + } + + /** + * Builds the header of the API Call + * + * @param string $content + * @return string + */ + private function buildHeader($content) + { + $header = "POST /v1/messages/team_inbox/" . $this->apiToken . " HTTP/1.1\r\n"; + $header .= "Host: api.flowdock.com\r\n"; + $header .= "Content-Type: application/json\r\n"; + $header .= "Content-Length: " . strlen($content) . "\r\n"; + $header .= "\r\n"; + + return $header; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php new file mode 100644 index 0000000..71e4669 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Gelf\IMessagePublisher; +use Gelf\PublisherInterface; +use Gelf\Publisher; +use InvalidArgumentException; +use Monolog\Logger; +use Monolog\Formatter\GelfMessageFormatter; + +/** + * Handler to send messages to a Graylog2 (http://www.graylog2.org) server + * + * @author Matt Lehner + * @author Benjamin Zikarsky + */ +class GelfHandler extends AbstractProcessingHandler +{ + /** + * @var Publisher the publisher object that sends the message to the server + */ + protected $publisher; + + /** + * @param PublisherInterface|IMessagePublisher|Publisher $publisher a publisher object + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct($publisher, $level = Logger::DEBUG, $bubble = true) + { + parent::__construct($level, $bubble); + + if (!$publisher instanceof Publisher && !$publisher instanceof IMessagePublisher && !$publisher instanceof PublisherInterface) { + throw new InvalidArgumentException('Invalid publisher, expected a Gelf\Publisher, Gelf\IMessagePublisher or Gelf\PublisherInterface instance'); + } + + $this->publisher = $publisher; + } + + /** + * {@inheritdoc} + */ + protected function write(array $record) + { + $this->publisher->publish($record['formatted']); + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter() + { + return new GelfMessageFormatter(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php new file mode 100644 index 0000000..28e5c56 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php @@ -0,0 +1,116 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\ResettableInterface; + +/** + * Forwards records to multiple handlers + * + * @author Lenar Lõhmus + */ +class GroupHandler extends AbstractHandler +{ + protected $handlers; + + /** + * @param array $handlers Array of Handlers. + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct(array $handlers, $bubble = true) + { + foreach ($handlers as $handler) { + if (!$handler instanceof HandlerInterface) { + throw new \InvalidArgumentException('The first argument of the GroupHandler must be an array of HandlerInterface instances.'); + } + } + + $this->handlers = $handlers; + $this->bubble = $bubble; + } + + /** + * {@inheritdoc} + */ + public function isHandling(array $record) + { + foreach ($this->handlers as $handler) { + if ($handler->isHandling($record)) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function handle(array $record) + { + if ($this->processors) { + foreach ($this->processors as $processor) { + $record = call_user_func($processor, $record); + } + } + + foreach ($this->handlers as $handler) { + $handler->handle($record); + } + + return false === $this->bubble; + } + + /** + * {@inheritdoc} + */ + public function handleBatch(array $records) + { + if ($this->processors) { + $processed = array(); + foreach ($records as $record) { + foreach ($this->processors as $processor) { + $processed[] = call_user_func($processor, $record); + } + } + $records = $processed; + } + + foreach ($this->handlers as $handler) { + $handler->handleBatch($records); + } + } + + public function reset() + { + parent::reset(); + + foreach ($this->handlers as $handler) { + if ($handler instanceof ResettableInterface) { + $handler->reset(); + } + } + } + + /** + * {@inheritdoc} + */ + public function setFormatter(FormatterInterface $formatter) + { + foreach ($this->handlers as $handler) { + $handler->setFormatter($formatter); + } + + return $this; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php b/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php new file mode 100644 index 0000000..8d5a4a0 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; + +/** + * Interface that all Monolog Handlers must implement + * + * @author Jordi Boggiano + */ +interface HandlerInterface +{ + /** + * Checks whether the given record will be handled by this handler. + * + * This is mostly done for performance reasons, to avoid calling processors for nothing. + * + * Handlers should still check the record levels within handle(), returning false in isHandling() + * is no guarantee that handle() will not be called, and isHandling() might not be called + * for a given record. + * + * @param array $record Partial log record containing only a level key + * + * @return bool + */ + public function isHandling(array $record); + + /** + * Handles a record. + * + * All records may be passed to this method, and the handler should discard + * those that it does not want to handle. + * + * The return value of this function controls the bubbling process of the handler stack. + * Unless the bubbling is interrupted (by returning true), the Logger class will keep on + * calling further handlers in the stack with a given log record. + * + * @param array $record The record to handle + * @return bool true means that this handler handled the record, and that bubbling is not permitted. + * false means the record was either not processed or that this handler allows bubbling. + */ + public function handle(array $record); + + /** + * Handles a set of records at once. + * + * @param array $records The records to handle (an array of record arrays) + */ + public function handleBatch(array $records); + + /** + * Adds a processor in the stack. + * + * @param callable $callback + * @return self + */ + public function pushProcessor($callback); + + /** + * Removes the processor on top of the stack and returns it. + * + * @return callable + */ + public function popProcessor(); + + /** + * Sets the formatter. + * + * @param FormatterInterface $formatter + * @return self + */ + public function setFormatter(FormatterInterface $formatter); + + /** + * Gets the formatter. + * + * @return FormatterInterface + */ + public function getFormatter(); +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php b/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php new file mode 100644 index 0000000..55e6498 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php @@ -0,0 +1,116 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\ResettableInterface; +use Monolog\Formatter\FormatterInterface; + +/** + * This simple wrapper class can be used to extend handlers functionality. + * + * Example: A custom filtering that can be applied to any handler. + * + * Inherit from this class and override handle() like this: + * + * public function handle(array $record) + * { + * if ($record meets certain conditions) { + * return false; + * } + * return $this->handler->handle($record); + * } + * + * @author Alexey Karapetov + */ +class HandlerWrapper implements HandlerInterface, ResettableInterface +{ + /** + * @var HandlerInterface + */ + protected $handler; + + /** + * HandlerWrapper constructor. + * @param HandlerInterface $handler + */ + public function __construct(HandlerInterface $handler) + { + $this->handler = $handler; + } + + /** + * {@inheritdoc} + */ + public function isHandling(array $record) + { + return $this->handler->isHandling($record); + } + + /** + * {@inheritdoc} + */ + public function handle(array $record) + { + return $this->handler->handle($record); + } + + /** + * {@inheritdoc} + */ + public function handleBatch(array $records) + { + return $this->handler->handleBatch($records); + } + + /** + * {@inheritdoc} + */ + public function pushProcessor($callback) + { + $this->handler->pushProcessor($callback); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function popProcessor() + { + return $this->handler->popProcessor(); + } + + /** + * {@inheritdoc} + */ + public function setFormatter(FormatterInterface $formatter) + { + $this->handler->setFormatter($formatter); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getFormatter() + { + return $this->handler->getFormatter(); + } + + public function reset() + { + if ($this->handler instanceof ResettableInterface) { + return $this->handler->reset(); + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php new file mode 100644 index 0000000..73233c9 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php @@ -0,0 +1,365 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Sends notifications through the hipchat api to a hipchat room + * + * Notes: + * API token - HipChat API token + * Room - HipChat Room Id or name, where messages are sent + * Name - Name used to send the message (from) + * notify - Should the message trigger a notification in the clients + * version - The API version to use (HipChatHandler::API_V1 | HipChatHandler::API_V2) + * + * @author Rafael Dohms + * @see https://www.hipchat.com/docs/api + */ +class HipChatHandler extends SocketHandler +{ + /** + * Use API version 1 + */ + const API_V1 = 'v1'; + + /** + * Use API version v2 + */ + const API_V2 = 'v2'; + + /** + * The maximum allowed length for the name used in the "from" field. + */ + const MAXIMUM_NAME_LENGTH = 15; + + /** + * The maximum allowed length for the message. + */ + const MAXIMUM_MESSAGE_LENGTH = 9500; + + /** + * @var string + */ + private $token; + + /** + * @var string + */ + private $room; + + /** + * @var string + */ + private $name; + + /** + * @var bool + */ + private $notify; + + /** + * @var string + */ + private $format; + + /** + * @var string + */ + private $host; + + /** + * @var string + */ + private $version; + + /** + * @param string $token HipChat API Token + * @param string $room The room that should be alerted of the message (Id or Name) + * @param string $name Name used in the "from" field. + * @param bool $notify Trigger a notification in clients or not + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $useSSL Whether to connect via SSL. + * @param string $format The format of the messages (default to text, can be set to html if you have html in the messages) + * @param string $host The HipChat server hostname. + * @param string $version The HipChat API version (default HipChatHandler::API_V1) + */ + public function __construct($token, $room, $name = 'Monolog', $notify = false, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $format = 'text', $host = 'api.hipchat.com', $version = self::API_V1) + { + if ($version == self::API_V1 && !$this->validateStringLength($name, static::MAXIMUM_NAME_LENGTH)) { + throw new \InvalidArgumentException('The supplied name is too long. HipChat\'s v1 API supports names up to 15 UTF-8 characters.'); + } + + $connectionString = $useSSL ? 'ssl://'.$host.':443' : $host.':80'; + parent::__construct($connectionString, $level, $bubble); + + $this->token = $token; + $this->name = $name; + $this->notify = $notify; + $this->room = $room; + $this->format = $format; + $this->host = $host; + $this->version = $version; + } + + /** + * {@inheritdoc} + * + * @param array $record + * @return string + */ + protected function generateDataStream($record) + { + $content = $this->buildContent($record); + + return $this->buildHeader($content) . $content; + } + + /** + * Builds the body of API call + * + * @param array $record + * @return string + */ + private function buildContent($record) + { + $dataArray = array( + 'notify' => $this->version == self::API_V1 ? + ($this->notify ? 1 : 0) : + ($this->notify ? 'true' : 'false'), + 'message' => $record['formatted'], + 'message_format' => $this->format, + 'color' => $this->getAlertColor($record['level']), + ); + + if (!$this->validateStringLength($dataArray['message'], static::MAXIMUM_MESSAGE_LENGTH)) { + if (function_exists('mb_substr')) { + $dataArray['message'] = mb_substr($dataArray['message'], 0, static::MAXIMUM_MESSAGE_LENGTH).' [truncated]'; + } else { + $dataArray['message'] = substr($dataArray['message'], 0, static::MAXIMUM_MESSAGE_LENGTH).' [truncated]'; + } + } + + // if we are using the legacy API then we need to send some additional information + if ($this->version == self::API_V1) { + $dataArray['room_id'] = $this->room; + } + + // append the sender name if it is set + // always append it if we use the v1 api (it is required in v1) + if ($this->version == self::API_V1 || $this->name !== null) { + $dataArray['from'] = (string) $this->name; + } + + return http_build_query($dataArray); + } + + /** + * Builds the header of the API Call + * + * @param string $content + * @return string + */ + private function buildHeader($content) + { + if ($this->version == self::API_V1) { + $header = "POST /v1/rooms/message?format=json&auth_token={$this->token} HTTP/1.1\r\n"; + } else { + // needed for rooms with special (spaces, etc) characters in the name + $room = rawurlencode($this->room); + $header = "POST /v2/room/{$room}/notification?auth_token={$this->token} HTTP/1.1\r\n"; + } + + $header .= "Host: {$this->host}\r\n"; + $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; + $header .= "Content-Length: " . strlen($content) . "\r\n"; + $header .= "\r\n"; + + return $header; + } + + /** + * Assigns a color to each level of log records. + * + * @param int $level + * @return string + */ + protected function getAlertColor($level) + { + switch (true) { + case $level >= Logger::ERROR: + return 'red'; + case $level >= Logger::WARNING: + return 'yellow'; + case $level >= Logger::INFO: + return 'green'; + case $level == Logger::DEBUG: + return 'gray'; + default: + return 'yellow'; + } + } + + /** + * {@inheritdoc} + * + * @param array $record + */ + protected function write(array $record) + { + parent::write($record); + $this->finalizeWrite(); + } + + /** + * Finalizes the request by reading some bytes and then closing the socket + * + * If we do not read some but close the socket too early, hipchat sometimes + * drops the request entirely. + */ + protected function finalizeWrite() + { + $res = $this->getResource(); + if (is_resource($res)) { + @fread($res, 2048); + } + $this->closeSocket(); + } + + /** + * {@inheritdoc} + */ + public function handleBatch(array $records) + { + if (count($records) == 0) { + return true; + } + + $batchRecords = $this->combineRecords($records); + + $handled = false; + foreach ($batchRecords as $batchRecord) { + if ($this->isHandling($batchRecord)) { + $this->write($batchRecord); + $handled = true; + } + } + + if (!$handled) { + return false; + } + + return false === $this->bubble; + } + + /** + * Combines multiple records into one. Error level of the combined record + * will be the highest level from the given records. Datetime will be taken + * from the first record. + * + * @param $records + * @return array + */ + private function combineRecords($records) + { + $batchRecord = null; + $batchRecords = array(); + $messages = array(); + $formattedMessages = array(); + $level = 0; + $levelName = null; + $datetime = null; + + foreach ($records as $record) { + $record = $this->processRecord($record); + + if ($record['level'] > $level) { + $level = $record['level']; + $levelName = $record['level_name']; + } + + if (null === $datetime) { + $datetime = $record['datetime']; + } + + $messages[] = $record['message']; + $messageStr = implode(PHP_EOL, $messages); + $formattedMessages[] = $this->getFormatter()->format($record); + $formattedMessageStr = implode('', $formattedMessages); + + $batchRecord = array( + 'message' => $messageStr, + 'formatted' => $formattedMessageStr, + 'context' => array(), + 'extra' => array(), + ); + + if (!$this->validateStringLength($batchRecord['formatted'], static::MAXIMUM_MESSAGE_LENGTH)) { + // Pop the last message and implode the remaining messages + $lastMessage = array_pop($messages); + $lastFormattedMessage = array_pop($formattedMessages); + $batchRecord['message'] = implode(PHP_EOL, $messages); + $batchRecord['formatted'] = implode('', $formattedMessages); + + $batchRecords[] = $batchRecord; + $messages = array($lastMessage); + $formattedMessages = array($lastFormattedMessage); + + $batchRecord = null; + } + } + + if (null !== $batchRecord) { + $batchRecords[] = $batchRecord; + } + + // Set the max level and datetime for all records + foreach ($batchRecords as &$batchRecord) { + $batchRecord = array_merge( + $batchRecord, + array( + 'level' => $level, + 'level_name' => $levelName, + 'datetime' => $datetime, + ) + ); + } + + return $batchRecords; + } + + /** + * Validates the length of a string. + * + * If the `mb_strlen()` function is available, it will use that, as HipChat + * allows UTF-8 characters. Otherwise, it will fall back to `strlen()`. + * + * Note that this might cause false failures in the specific case of using + * a valid name with less than 16 characters, but 16 or more bytes, on a + * system where `mb_strlen()` is unavailable. + * + * @param string $str + * @param int $length + * + * @return bool + */ + private function validateStringLength($str, $length) + { + if (function_exists('mb_strlen')) { + return (mb_strlen($str) <= $length); + } + + return (strlen($str) <= $length); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php new file mode 100644 index 0000000..7f22622 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * IFTTTHandler uses cURL to trigger IFTTT Maker actions + * + * Register a secret key and trigger/event name at https://ifttt.com/maker + * + * value1 will be the channel from monolog's Logger constructor, + * value2 will be the level name (ERROR, WARNING, ..) + * value3 will be the log record's message + * + * @author Nehal Patel + */ +class IFTTTHandler extends AbstractProcessingHandler +{ + private $eventName; + private $secretKey; + + /** + * @param string $eventName The name of the IFTTT Maker event that should be triggered + * @param string $secretKey A valid IFTTT secret key + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct($eventName, $secretKey, $level = Logger::ERROR, $bubble = true) + { + $this->eventName = $eventName; + $this->secretKey = $secretKey; + + parent::__construct($level, $bubble); + } + + /** + * {@inheritdoc} + */ + public function write(array $record) + { + $postData = array( + "value1" => $record["channel"], + "value2" => $record["level_name"], + "value3" => $record["message"], + ); + $postString = json_encode($postData); + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, "https://maker.ifttt.com/trigger/" . $this->eventName . "/with/key/" . $this->secretKey); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + "Content-Type: application/json", + )); + + Curl\Util::execute($ch); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php new file mode 100644 index 0000000..a12e3de --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + + namespace Monolog\Handler; + + use Monolog\Logger; + +/** + * Inspired on LogEntriesHandler. + * + * @author Robert Kaufmann III + * @author Gabriel Machado + */ +class InsightOpsHandler extends SocketHandler +{ + /** + * @var string + */ + protected $logToken; + + /** + * @param string $token Log token supplied by InsightOps + * @param string $region Region where InsightOps account is hosted. Could be 'us' or 'eu'. + * @param bool $useSSL Whether or not SSL encryption should be used + * @param int $level The minimum logging level to trigger this handler + * @param bool $bubble Whether or not messages that are handled should bubble up the stack. + * + * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing + */ + public function __construct($token, $region = 'us', $useSSL = true, $level = Logger::DEBUG, $bubble = true) + { + if ($useSSL && !extension_loaded('openssl')) { + throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for LogEntriesHandler'); + } + + $endpoint = $useSSL + ? 'ssl://' . $region . '.data.logs.insight.rapid7.com:443' + : $region . '.data.logs.insight.rapid7.com:80'; + + parent::__construct($endpoint, $level, $bubble); + $this->logToken = $token; + } + + /** + * {@inheritdoc} + * + * @param array $record + * @return string + */ + protected function generateDataStream($record) + { + return $this->logToken . ' ' . $record['formatted']; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php new file mode 100644 index 0000000..ea89fb3 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * @author Robert Kaufmann III + */ +class LogEntriesHandler extends SocketHandler +{ + /** + * @var string + */ + protected $logToken; + + /** + * @param string $token Log token supplied by LogEntries + * @param bool $useSSL Whether or not SSL encryption should be used. + * @param int $level The minimum logging level to trigger this handler + * @param bool $bubble Whether or not messages that are handled should bubble up the stack. + * + * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing + */ + public function __construct($token, $useSSL = true, $level = Logger::DEBUG, $bubble = true, $host = 'data.logentries.com') + { + if ($useSSL && !extension_loaded('openssl')) { + throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for LogEntriesHandler'); + } + + $endpoint = $useSSL ? 'ssl://' . $host . ':443' : $host . ':80'; + parent::__construct($endpoint, $level, $bubble); + $this->logToken = $token; + } + + /** + * {@inheritdoc} + * + * @param array $record + * @return string + */ + protected function generateDataStream($record) + { + return $this->logToken . ' ' . $record['formatted']; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php new file mode 100644 index 0000000..bcd62e1 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php @@ -0,0 +1,102 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\LogglyFormatter; + +/** + * Sends errors to Loggly. + * + * @author Przemek Sobstel + * @author Adam Pancutt + * @author Gregory Barchard + */ +class LogglyHandler extends AbstractProcessingHandler +{ + const HOST = 'logs-01.loggly.com'; + const ENDPOINT_SINGLE = 'inputs'; + const ENDPOINT_BATCH = 'bulk'; + + protected $token; + + protected $tag = array(); + + public function __construct($token, $level = Logger::DEBUG, $bubble = true) + { + if (!extension_loaded('curl')) { + throw new \LogicException('The curl extension is needed to use the LogglyHandler'); + } + + $this->token = $token; + + parent::__construct($level, $bubble); + } + + public function setTag($tag) + { + $tag = !empty($tag) ? $tag : array(); + $this->tag = is_array($tag) ? $tag : array($tag); + } + + public function addTag($tag) + { + if (!empty($tag)) { + $tag = is_array($tag) ? $tag : array($tag); + $this->tag = array_unique(array_merge($this->tag, $tag)); + } + } + + protected function write(array $record) + { + $this->send($record["formatted"], self::ENDPOINT_SINGLE); + } + + public function handleBatch(array $records) + { + $level = $this->level; + + $records = array_filter($records, function ($record) use ($level) { + return ($record['level'] >= $level); + }); + + if ($records) { + $this->send($this->getFormatter()->formatBatch($records), self::ENDPOINT_BATCH); + } + } + + protected function send($data, $endpoint) + { + $url = sprintf("https://%s/%s/%s/", self::HOST, $endpoint, $this->token); + + $headers = array('Content-Type: application/json'); + + if (!empty($this->tag)) { + $headers[] = 'X-LOGGLY-TAG: '.implode(',', $this->tag); + } + + $ch = curl_init(); + + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $data); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + Curl\Util::execute($ch); + } + + protected function getDefaultFormatter() + { + return new LogglyFormatter(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php new file mode 100644 index 0000000..9e23283 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +/** + * Base class for all mail handlers + * + * @author Gyula Sallai + */ +abstract class MailHandler extends AbstractProcessingHandler +{ + /** + * {@inheritdoc} + */ + public function handleBatch(array $records) + { + $messages = array(); + + foreach ($records as $record) { + if ($record['level'] < $this->level) { + continue; + } + $messages[] = $this->processRecord($record); + } + + if (!empty($messages)) { + $this->send((string) $this->getFormatter()->formatBatch($messages), $messages); + } + } + + /** + * Send a mail with the given content + * + * @param string $content formatted email body to be sent + * @param array $records the array of log records that formed this content + */ + abstract protected function send($content, array $records); + + /** + * {@inheritdoc} + */ + protected function write(array $record) + { + $this->send((string) $record['formatted'], array($record)); + } + + protected function getHighestRecord(array $records) + { + $highestRecord = null; + foreach ($records as $record) { + if ($highestRecord === null || $highestRecord['level'] < $record['level']) { + $highestRecord = $record; + } + } + + return $highestRecord; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php new file mode 100644 index 0000000..3f0956a --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * MandrillHandler uses cURL to send the emails to the Mandrill API + * + * @author Adam Nicholson + */ +class MandrillHandler extends MailHandler +{ + protected $message; + protected $apiKey; + + /** + * @param string $apiKey A valid Mandrill API key + * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct($apiKey, $message, $level = Logger::ERROR, $bubble = true) + { + parent::__construct($level, $bubble); + + if (!$message instanceof \Swift_Message && is_callable($message)) { + $message = call_user_func($message); + } + if (!$message instanceof \Swift_Message) { + throw new \InvalidArgumentException('You must provide either a Swift_Message instance or a callable returning it'); + } + $this->message = $message; + $this->apiKey = $apiKey; + } + + /** + * {@inheritdoc} + */ + protected function send($content, array $records) + { + $message = clone $this->message; + $message->setBody($content); + $message->setDate(time()); + + $ch = curl_init(); + + curl_setopt($ch, CURLOPT_URL, 'https://mandrillapp.com/api/1.0/messages/send-raw.json'); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array( + 'key' => $this->apiKey, + 'raw_message' => (string) $message, + 'async' => false, + ))); + + Curl\Util::execute($ch); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php b/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php new file mode 100644 index 0000000..4724a7e --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +/** + * Exception can be thrown if an extension for an handler is missing + * + * @author Christian Bergau + */ +class MissingExtensionException extends \Exception +{ +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php new file mode 100644 index 0000000..56fe755 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\NormalizerFormatter; + +/** + * Logs to a MongoDB database. + * + * usage example: + * + * $log = new Logger('application'); + * $mongodb = new MongoDBHandler(new \Mongo("mongodb://localhost:27017"), "logs", "prod"); + * $log->pushHandler($mongodb); + * + * @author Thomas Tourlourat + */ +class MongoDBHandler extends AbstractProcessingHandler +{ + protected $mongoCollection; + + public function __construct($mongo, $database, $collection, $level = Logger::DEBUG, $bubble = true) + { + if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo || $mongo instanceof \MongoDB\Client)) { + throw new \InvalidArgumentException('MongoClient, Mongo or MongoDB\Client instance required'); + } + + $this->mongoCollection = $mongo->selectCollection($database, $collection); + + parent::__construct($level, $bubble); + } + + protected function write(array $record) + { + if ($this->mongoCollection instanceof \MongoDB\Collection) { + $this->mongoCollection->insertOne($record["formatted"]); + } else { + $this->mongoCollection->save($record["formatted"]); + } + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter() + { + return new NormalizerFormatter(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php new file mode 100644 index 0000000..d7807fd --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php @@ -0,0 +1,185 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\LineFormatter; + +/** + * NativeMailerHandler uses the mail() function to send the emails + * + * @author Christophe Coevoet + * @author Mark Garrett + */ +class NativeMailerHandler extends MailHandler +{ + /** + * The email addresses to which the message will be sent + * @var array + */ + protected $to; + + /** + * The subject of the email + * @var string + */ + protected $subject; + + /** + * Optional headers for the message + * @var array + */ + protected $headers = array(); + + /** + * Optional parameters for the message + * @var array + */ + protected $parameters = array(); + + /** + * The wordwrap length for the message + * @var int + */ + protected $maxColumnWidth; + + /** + * The Content-type for the message + * @var string + */ + protected $contentType = 'text/plain'; + + /** + * The encoding for the message + * @var string + */ + protected $encoding = 'utf-8'; + + /** + * @param string|array $to The receiver of the mail + * @param string $subject The subject of the mail + * @param string $from The sender of the mail + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $maxColumnWidth The maximum column width that the message lines will have + */ + public function __construct($to, $subject, $from, $level = Logger::ERROR, $bubble = true, $maxColumnWidth = 70) + { + parent::__construct($level, $bubble); + $this->to = is_array($to) ? $to : array($to); + $this->subject = $subject; + $this->addHeader(sprintf('From: %s', $from)); + $this->maxColumnWidth = $maxColumnWidth; + } + + /** + * Add headers to the message + * + * @param string|array $headers Custom added headers + * @return self + */ + public function addHeader($headers) + { + foreach ((array) $headers as $header) { + if (strpos($header, "\n") !== false || strpos($header, "\r") !== false) { + throw new \InvalidArgumentException('Headers can not contain newline characters for security reasons'); + } + $this->headers[] = $header; + } + + return $this; + } + + /** + * Add parameters to the message + * + * @param string|array $parameters Custom added parameters + * @return self + */ + public function addParameter($parameters) + { + $this->parameters = array_merge($this->parameters, (array) $parameters); + + return $this; + } + + /** + * {@inheritdoc} + */ + protected function send($content, array $records) + { + $content = wordwrap($content, $this->maxColumnWidth); + $headers = ltrim(implode("\r\n", $this->headers) . "\r\n", "\r\n"); + $headers .= 'Content-type: ' . $this->getContentType() . '; charset=' . $this->getEncoding() . "\r\n"; + if ($this->getContentType() == 'text/html' && false === strpos($headers, 'MIME-Version:')) { + $headers .= 'MIME-Version: 1.0' . "\r\n"; + } + + $subject = $this->subject; + if ($records) { + $subjectFormatter = new LineFormatter($this->subject); + $subject = $subjectFormatter->format($this->getHighestRecord($records)); + } + + $parameters = implode(' ', $this->parameters); + foreach ($this->to as $to) { + mail($to, $subject, $content, $headers, $parameters); + } + } + + /** + * @return string $contentType + */ + public function getContentType() + { + return $this->contentType; + } + + /** + * @return string $encoding + */ + public function getEncoding() + { + return $this->encoding; + } + + /** + * @param string $contentType The content type of the email - Defaults to text/plain. Use text/html for HTML + * messages. + * @return self + */ + public function setContentType($contentType) + { + if (strpos($contentType, "\n") !== false || strpos($contentType, "\r") !== false) { + throw new \InvalidArgumentException('The content type can not contain newline characters to prevent email header injection'); + } + + $this->contentType = $contentType; + + return $this; + } + + /** + * @param string $encoding + * @return self + */ + public function setEncoding($encoding) + { + if (strpos($encoding, "\n") !== false || strpos($encoding, "\r") !== false) { + throw new \InvalidArgumentException('The encoding can not contain newline characters to prevent email header injection'); + } + + $this->encoding = $encoding; + + return $this; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php new file mode 100644 index 0000000..f911997 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php @@ -0,0 +1,204 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\NormalizerFormatter; + +/** + * Class to record a log on a NewRelic application. + * Enabling New Relic High Security mode may prevent capture of useful information. + * + * This handler requires a NormalizerFormatter to function and expects an array in $record['formatted'] + * + * @see https://docs.newrelic.com/docs/agents/php-agent + * @see https://docs.newrelic.com/docs/accounts-partnerships/accounts/security/high-security + */ +class NewRelicHandler extends AbstractProcessingHandler +{ + /** + * Name of the New Relic application that will receive logs from this handler. + * + * @var string + */ + protected $appName; + + /** + * Name of the current transaction + * + * @var string + */ + protected $transactionName; + + /** + * Some context and extra data is passed into the handler as arrays of values. Do we send them as is + * (useful if we are using the API), or explode them for display on the NewRelic RPM website? + * + * @var bool + */ + protected $explodeArrays; + + /** + * {@inheritDoc} + * + * @param string $appName + * @param bool $explodeArrays + * @param string $transactionName + */ + public function __construct( + $level = Logger::ERROR, + $bubble = true, + $appName = null, + $explodeArrays = false, + $transactionName = null + ) { + parent::__construct($level, $bubble); + + $this->appName = $appName; + $this->explodeArrays = $explodeArrays; + $this->transactionName = $transactionName; + } + + /** + * {@inheritDoc} + */ + protected function write(array $record) + { + if (!$this->isNewRelicEnabled()) { + throw new MissingExtensionException('The newrelic PHP extension is required to use the NewRelicHandler'); + } + + if ($appName = $this->getAppName($record['context'])) { + $this->setNewRelicAppName($appName); + } + + if ($transactionName = $this->getTransactionName($record['context'])) { + $this->setNewRelicTransactionName($transactionName); + unset($record['formatted']['context']['transaction_name']); + } + + if (isset($record['context']['exception']) && ($record['context']['exception'] instanceof \Exception || (PHP_VERSION_ID >= 70000 && $record['context']['exception'] instanceof \Throwable))) { + newrelic_notice_error($record['message'], $record['context']['exception']); + unset($record['formatted']['context']['exception']); + } else { + newrelic_notice_error($record['message']); + } + + if (isset($record['formatted']['context']) && is_array($record['formatted']['context'])) { + foreach ($record['formatted']['context'] as $key => $parameter) { + if (is_array($parameter) && $this->explodeArrays) { + foreach ($parameter as $paramKey => $paramValue) { + $this->setNewRelicParameter('context_' . $key . '_' . $paramKey, $paramValue); + } + } else { + $this->setNewRelicParameter('context_' . $key, $parameter); + } + } + } + + if (isset($record['formatted']['extra']) && is_array($record['formatted']['extra'])) { + foreach ($record['formatted']['extra'] as $key => $parameter) { + if (is_array($parameter) && $this->explodeArrays) { + foreach ($parameter as $paramKey => $paramValue) { + $this->setNewRelicParameter('extra_' . $key . '_' . $paramKey, $paramValue); + } + } else { + $this->setNewRelicParameter('extra_' . $key, $parameter); + } + } + } + } + + /** + * Checks whether the NewRelic extension is enabled in the system. + * + * @return bool + */ + protected function isNewRelicEnabled() + { + return extension_loaded('newrelic'); + } + + /** + * Returns the appname where this log should be sent. Each log can override the default appname, set in this + * handler's constructor, by providing the appname in it's context. + * + * @param array $context + * @return null|string + */ + protected function getAppName(array $context) + { + if (isset($context['appname'])) { + return $context['appname']; + } + + return $this->appName; + } + + /** + * Returns the name of the current transaction. Each log can override the default transaction name, set in this + * handler's constructor, by providing the transaction_name in it's context + * + * @param array $context + * + * @return null|string + */ + protected function getTransactionName(array $context) + { + if (isset($context['transaction_name'])) { + return $context['transaction_name']; + } + + return $this->transactionName; + } + + /** + * Sets the NewRelic application that should receive this log. + * + * @param string $appName + */ + protected function setNewRelicAppName($appName) + { + newrelic_set_appname($appName); + } + + /** + * Overwrites the name of the current transaction + * + * @param string $transactionName + */ + protected function setNewRelicTransactionName($transactionName) + { + newrelic_name_transaction($transactionName); + } + + /** + * @param string $key + * @param mixed $value + */ + protected function setNewRelicParameter($key, $value) + { + if (null === $value || is_scalar($value)) { + newrelic_add_custom_parameter($key, $value); + } else { + newrelic_add_custom_parameter($key, @json_encode($value)); + } + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter() + { + return new NormalizerFormatter(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php new file mode 100644 index 0000000..4b84588 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Blackhole + * + * Any record it can handle will be thrown away. This can be used + * to put on top of an existing stack to override it temporarily. + * + * @author Jordi Boggiano + */ +class NullHandler extends AbstractHandler +{ + /** + * @param int $level The minimum logging level at which this handler will be triggered + */ + public function __construct($level = Logger::DEBUG) + { + parent::__construct($level, false); + } + + /** + * {@inheritdoc} + */ + public function handle(array $record) + { + if ($record['level'] < $this->level) { + return false; + } + + return true; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php new file mode 100644 index 0000000..1f2076a --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php @@ -0,0 +1,242 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Exception; +use Monolog\Formatter\LineFormatter; +use Monolog\Logger; +use PhpConsole\Connector; +use PhpConsole\Handler; +use PhpConsole\Helper; + +/** + * Monolog handler for Google Chrome extension "PHP Console" + * + * Display PHP error/debug log messages in Google Chrome console and notification popups, executes PHP code remotely + * + * Usage: + * 1. Install Google Chrome extension https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef + * 2. See overview https://github.com/barbushin/php-console#overview + * 3. Install PHP Console library https://github.com/barbushin/php-console#installation + * 4. Example (result will looks like http://i.hizliresim.com/vg3Pz4.png) + * + * $logger = new \Monolog\Logger('all', array(new \Monolog\Handler\PHPConsoleHandler())); + * \Monolog\ErrorHandler::register($logger); + * echo $undefinedVar; + * $logger->addDebug('SELECT * FROM users', array('db', 'time' => 0.012)); + * PC::debug($_SERVER); // PHP Console debugger for any type of vars + * + * @author Sergey Barbushin https://www.linkedin.com/in/barbushin + */ +class PHPConsoleHandler extends AbstractProcessingHandler +{ + private $options = array( + 'enabled' => true, // bool Is PHP Console server enabled + 'classesPartialsTraceIgnore' => array('Monolog\\'), // array Hide calls of classes started with... + 'debugTagsKeysInContext' => array(0, 'tag'), // bool Is PHP Console server enabled + 'useOwnErrorsHandler' => false, // bool Enable errors handling + 'useOwnExceptionsHandler' => false, // bool Enable exceptions handling + 'sourcesBasePath' => null, // string Base path of all project sources to strip in errors source paths + 'registerHelper' => true, // bool Register PhpConsole\Helper that allows short debug calls like PC::debug($var, 'ta.g.s') + 'serverEncoding' => null, // string|null Server internal encoding + 'headersLimit' => null, // int|null Set headers size limit for your web-server + 'password' => null, // string|null Protect PHP Console connection by password + 'enableSslOnlyMode' => false, // bool Force connection by SSL for clients with PHP Console installed + 'ipMasks' => array(), // array Set IP masks of clients that will be allowed to connect to PHP Console: array('192.168.*.*', '127.0.0.1') + 'enableEvalListener' => false, // bool Enable eval request to be handled by eval dispatcher(if enabled, 'password' option is also required) + 'dumperDetectCallbacks' => false, // bool Convert callback items in dumper vars to (callback SomeClass::someMethod) strings + 'dumperLevelLimit' => 5, // int Maximum dumped vars array or object nested dump level + 'dumperItemsCountLimit' => 100, // int Maximum dumped var same level array items or object properties number + 'dumperItemSizeLimit' => 5000, // int Maximum length of any string or dumped array item + 'dumperDumpSizeLimit' => 500000, // int Maximum approximate size of dumped vars result formatted in JSON + 'detectDumpTraceAndSource' => false, // bool Autodetect and append trace data to debug + 'dataStorage' => null, // PhpConsole\Storage|null Fixes problem with custom $_SESSION handler(see http://goo.gl/Ne8juJ) + ); + + /** @var Connector */ + private $connector; + + /** + * @param array $options See \Monolog\Handler\PHPConsoleHandler::$options for more details + * @param Connector|null $connector Instance of \PhpConsole\Connector class (optional) + * @param int $level + * @param bool $bubble + * @throws Exception + */ + public function __construct(array $options = array(), Connector $connector = null, $level = Logger::DEBUG, $bubble = true) + { + if (!class_exists('PhpConsole\Connector')) { + throw new Exception('PHP Console library not found. See https://github.com/barbushin/php-console#installation'); + } + parent::__construct($level, $bubble); + $this->options = $this->initOptions($options); + $this->connector = $this->initConnector($connector); + } + + private function initOptions(array $options) + { + $wrongOptions = array_diff(array_keys($options), array_keys($this->options)); + if ($wrongOptions) { + throw new Exception('Unknown options: ' . implode(', ', $wrongOptions)); + } + + return array_replace($this->options, $options); + } + + private function initConnector(Connector $connector = null) + { + if (!$connector) { + if ($this->options['dataStorage']) { + Connector::setPostponeStorage($this->options['dataStorage']); + } + $connector = Connector::getInstance(); + } + + if ($this->options['registerHelper'] && !Helper::isRegistered()) { + Helper::register(); + } + + if ($this->options['enabled'] && $connector->isActiveClient()) { + if ($this->options['useOwnErrorsHandler'] || $this->options['useOwnExceptionsHandler']) { + $handler = Handler::getInstance(); + $handler->setHandleErrors($this->options['useOwnErrorsHandler']); + $handler->setHandleExceptions($this->options['useOwnExceptionsHandler']); + $handler->start(); + } + if ($this->options['sourcesBasePath']) { + $connector->setSourcesBasePath($this->options['sourcesBasePath']); + } + if ($this->options['serverEncoding']) { + $connector->setServerEncoding($this->options['serverEncoding']); + } + if ($this->options['password']) { + $connector->setPassword($this->options['password']); + } + if ($this->options['enableSslOnlyMode']) { + $connector->enableSslOnlyMode(); + } + if ($this->options['ipMasks']) { + $connector->setAllowedIpMasks($this->options['ipMasks']); + } + if ($this->options['headersLimit']) { + $connector->setHeadersLimit($this->options['headersLimit']); + } + if ($this->options['detectDumpTraceAndSource']) { + $connector->getDebugDispatcher()->detectTraceAndSource = true; + } + $dumper = $connector->getDumper(); + $dumper->levelLimit = $this->options['dumperLevelLimit']; + $dumper->itemsCountLimit = $this->options['dumperItemsCountLimit']; + $dumper->itemSizeLimit = $this->options['dumperItemSizeLimit']; + $dumper->dumpSizeLimit = $this->options['dumperDumpSizeLimit']; + $dumper->detectCallbacks = $this->options['dumperDetectCallbacks']; + if ($this->options['enableEvalListener']) { + $connector->startEvalRequestsListener(); + } + } + + return $connector; + } + + public function getConnector() + { + return $this->connector; + } + + public function getOptions() + { + return $this->options; + } + + public function handle(array $record) + { + if ($this->options['enabled'] && $this->connector->isActiveClient()) { + return parent::handle($record); + } + + return !$this->bubble; + } + + /** + * Writes the record down to the log of the implementing handler + * + * @param array $record + * @return void + */ + protected function write(array $record) + { + if ($record['level'] < Logger::NOTICE) { + $this->handleDebugRecord($record); + } elseif (isset($record['context']['exception']) && $record['context']['exception'] instanceof Exception) { + $this->handleExceptionRecord($record); + } else { + $this->handleErrorRecord($record); + } + } + + private function handleDebugRecord(array $record) + { + $tags = $this->getRecordTags($record); + $message = $record['message']; + if ($record['context']) { + $message .= ' ' . json_encode($this->connector->getDumper()->dump(array_filter($record['context']))); + } + $this->connector->getDebugDispatcher()->dispatchDebug($message, $tags, $this->options['classesPartialsTraceIgnore']); + } + + private function handleExceptionRecord(array $record) + { + $this->connector->getErrorsDispatcher()->dispatchException($record['context']['exception']); + } + + private function handleErrorRecord(array $record) + { + $context = $record['context']; + + $this->connector->getErrorsDispatcher()->dispatchError( + isset($context['code']) ? $context['code'] : null, + isset($context['message']) ? $context['message'] : $record['message'], + isset($context['file']) ? $context['file'] : null, + isset($context['line']) ? $context['line'] : null, + $this->options['classesPartialsTraceIgnore'] + ); + } + + private function getRecordTags(array &$record) + { + $tags = null; + if (!empty($record['context'])) { + $context = & $record['context']; + foreach ($this->options['debugTagsKeysInContext'] as $key) { + if (!empty($context[$key])) { + $tags = $context[$key]; + if ($key === 0) { + array_shift($context); + } else { + unset($context[$key]); + } + break; + } + } + } + + return $tags ?: strtolower($record['level_name']); + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter() + { + return new LineFormatter('%message%'); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php new file mode 100644 index 0000000..a99e6ab --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Psr\Log\LoggerInterface; + +/** + * Proxies log messages to an existing PSR-3 compliant logger. + * + * @author Michael Moussa + */ +class PsrHandler extends AbstractHandler +{ + /** + * PSR-3 compliant logger + * + * @var LoggerInterface + */ + protected $logger; + + /** + * @param LoggerInterface $logger The underlying PSR-3 compliant logger to which messages will be proxied + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct(LoggerInterface $logger, $level = Logger::DEBUG, $bubble = true) + { + parent::__construct($level, $bubble); + + $this->logger = $logger; + } + + /** + * {@inheritDoc} + */ + public function handle(array $record) + { + if (!$this->isHandling($record)) { + return false; + } + + $this->logger->log(strtolower($record['level_name']), $record['message'], $record['context']); + + return false === $this->bubble; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php new file mode 100644 index 0000000..f27bb3d --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php @@ -0,0 +1,185 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Sends notifications through the pushover api to mobile phones + * + * @author Sebastian Göttschkes + * @see https://www.pushover.net/api + */ +class PushoverHandler extends SocketHandler +{ + private $token; + private $users; + private $title; + private $user; + private $retry; + private $expire; + + private $highPriorityLevel; + private $emergencyLevel; + private $useFormattedMessage = false; + + /** + * All parameters that can be sent to Pushover + * @see https://pushover.net/api + * @var array + */ + private $parameterNames = array( + 'token' => true, + 'user' => true, + 'message' => true, + 'device' => true, + 'title' => true, + 'url' => true, + 'url_title' => true, + 'priority' => true, + 'timestamp' => true, + 'sound' => true, + 'retry' => true, + 'expire' => true, + 'callback' => true, + ); + + /** + * Sounds the api supports by default + * @see https://pushover.net/api#sounds + * @var array + */ + private $sounds = array( + 'pushover', 'bike', 'bugle', 'cashregister', 'classical', 'cosmic', 'falling', 'gamelan', 'incoming', + 'intermission', 'magic', 'mechanical', 'pianobar', 'siren', 'spacealarm', 'tugboat', 'alien', 'climb', + 'persistent', 'echo', 'updown', 'none', + ); + + /** + * @param string $token Pushover api token + * @param string|array $users Pushover user id or array of ids the message will be sent to + * @param string $title Title sent to the Pushover API + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $useSSL Whether to connect via SSL. Required when pushing messages to users that are not + * the pushover.net app owner. OpenSSL is required for this option. + * @param int $highPriorityLevel The minimum logging level at which this handler will start + * sending "high priority" requests to the Pushover API + * @param int $emergencyLevel The minimum logging level at which this handler will start + * sending "emergency" requests to the Pushover API + * @param int $retry The retry parameter specifies how often (in seconds) the Pushover servers will send the same notification to the user. + * @param int $expire The expire parameter specifies how many seconds your notification will continue to be retried for (every retry seconds). + */ + public function __construct($token, $users, $title = null, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $highPriorityLevel = Logger::CRITICAL, $emergencyLevel = Logger::EMERGENCY, $retry = 30, $expire = 25200) + { + $connectionString = $useSSL ? 'ssl://api.pushover.net:443' : 'api.pushover.net:80'; + parent::__construct($connectionString, $level, $bubble); + + $this->token = $token; + $this->users = (array) $users; + $this->title = $title ?: gethostname(); + $this->highPriorityLevel = Logger::toMonologLevel($highPriorityLevel); + $this->emergencyLevel = Logger::toMonologLevel($emergencyLevel); + $this->retry = $retry; + $this->expire = $expire; + } + + protected function generateDataStream($record) + { + $content = $this->buildContent($record); + + return $this->buildHeader($content) . $content; + } + + private function buildContent($record) + { + // Pushover has a limit of 512 characters on title and message combined. + $maxMessageLength = 512 - strlen($this->title); + + $message = ($this->useFormattedMessage) ? $record['formatted'] : $record['message']; + $message = substr($message, 0, $maxMessageLength); + + $timestamp = $record['datetime']->getTimestamp(); + + $dataArray = array( + 'token' => $this->token, + 'user' => $this->user, + 'message' => $message, + 'title' => $this->title, + 'timestamp' => $timestamp, + ); + + if (isset($record['level']) && $record['level'] >= $this->emergencyLevel) { + $dataArray['priority'] = 2; + $dataArray['retry'] = $this->retry; + $dataArray['expire'] = $this->expire; + } elseif (isset($record['level']) && $record['level'] >= $this->highPriorityLevel) { + $dataArray['priority'] = 1; + } + + // First determine the available parameters + $context = array_intersect_key($record['context'], $this->parameterNames); + $extra = array_intersect_key($record['extra'], $this->parameterNames); + + // Least important info should be merged with subsequent info + $dataArray = array_merge($extra, $context, $dataArray); + + // Only pass sounds that are supported by the API + if (isset($dataArray['sound']) && !in_array($dataArray['sound'], $this->sounds)) { + unset($dataArray['sound']); + } + + return http_build_query($dataArray); + } + + private function buildHeader($content) + { + $header = "POST /1/messages.json HTTP/1.1\r\n"; + $header .= "Host: api.pushover.net\r\n"; + $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; + $header .= "Content-Length: " . strlen($content) . "\r\n"; + $header .= "\r\n"; + + return $header; + } + + protected function write(array $record) + { + foreach ($this->users as $user) { + $this->user = $user; + + parent::write($record); + $this->closeSocket(); + } + + $this->user = null; + } + + public function setHighPriorityLevel($value) + { + $this->highPriorityLevel = $value; + } + + public function setEmergencyLevel($value) + { + $this->emergencyLevel = $value; + } + + /** + * Use the formatted message? + * @param bool $value + */ + public function useFormattedMessage($value) + { + $this->useFormattedMessage = (bool) $value; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php new file mode 100644 index 0000000..10d7f43 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php @@ -0,0 +1,232 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\LineFormatter; +use Monolog\Formatter\FormatterInterface; +use Monolog\Logger; +use Raven_Client; + +/** + * Handler to send messages to a Sentry (https://github.com/getsentry/sentry) server + * using sentry-php (https://github.com/getsentry/sentry-php) + * + * @author Marc Abramowitz + */ +class RavenHandler extends AbstractProcessingHandler +{ + /** + * Translates Monolog log levels to Raven log levels. + */ + protected $logLevels = array( + Logger::DEBUG => Raven_Client::DEBUG, + Logger::INFO => Raven_Client::INFO, + Logger::NOTICE => Raven_Client::INFO, + Logger::WARNING => Raven_Client::WARNING, + Logger::ERROR => Raven_Client::ERROR, + Logger::CRITICAL => Raven_Client::FATAL, + Logger::ALERT => Raven_Client::FATAL, + Logger::EMERGENCY => Raven_Client::FATAL, + ); + + /** + * @var string should represent the current version of the calling + * software. Can be any string (git commit, version number) + */ + protected $release; + + /** + * @var Raven_Client the client object that sends the message to the server + */ + protected $ravenClient; + + /** + * @var LineFormatter The formatter to use for the logs generated via handleBatch() + */ + protected $batchFormatter; + + /** + * @param Raven_Client $ravenClient + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct(Raven_Client $ravenClient, $level = Logger::DEBUG, $bubble = true) + { + parent::__construct($level, $bubble); + + $this->ravenClient = $ravenClient; + } + + /** + * {@inheritdoc} + */ + public function handleBatch(array $records) + { + $level = $this->level; + + // filter records based on their level + $records = array_filter($records, function ($record) use ($level) { + return $record['level'] >= $level; + }); + + if (!$records) { + return; + } + + // the record with the highest severity is the "main" one + $record = array_reduce($records, function ($highest, $record) { + if ($record['level'] > $highest['level']) { + return $record; + } + + return $highest; + }); + + // the other ones are added as a context item + $logs = array(); + foreach ($records as $r) { + $logs[] = $this->processRecord($r); + } + + if ($logs) { + $record['context']['logs'] = (string) $this->getBatchFormatter()->formatBatch($logs); + } + + $this->handle($record); + } + + /** + * Sets the formatter for the logs generated by handleBatch(). + * + * @param FormatterInterface $formatter + */ + public function setBatchFormatter(FormatterInterface $formatter) + { + $this->batchFormatter = $formatter; + } + + /** + * Gets the formatter for the logs generated by handleBatch(). + * + * @return FormatterInterface + */ + public function getBatchFormatter() + { + if (!$this->batchFormatter) { + $this->batchFormatter = $this->getDefaultBatchFormatter(); + } + + return $this->batchFormatter; + } + + /** + * {@inheritdoc} + */ + protected function write(array $record) + { + $previousUserContext = false; + $options = array(); + $options['level'] = $this->logLevels[$record['level']]; + $options['tags'] = array(); + if (!empty($record['extra']['tags'])) { + $options['tags'] = array_merge($options['tags'], $record['extra']['tags']); + unset($record['extra']['tags']); + } + if (!empty($record['context']['tags'])) { + $options['tags'] = array_merge($options['tags'], $record['context']['tags']); + unset($record['context']['tags']); + } + if (!empty($record['context']['fingerprint'])) { + $options['fingerprint'] = $record['context']['fingerprint']; + unset($record['context']['fingerprint']); + } + if (!empty($record['context']['logger'])) { + $options['logger'] = $record['context']['logger']; + unset($record['context']['logger']); + } else { + $options['logger'] = $record['channel']; + } + foreach ($this->getExtraParameters() as $key) { + foreach (array('extra', 'context') as $source) { + if (!empty($record[$source][$key])) { + $options[$key] = $record[$source][$key]; + unset($record[$source][$key]); + } + } + } + if (!empty($record['context'])) { + $options['extra']['context'] = $record['context']; + if (!empty($record['context']['user'])) { + $previousUserContext = $this->ravenClient->context->user; + $this->ravenClient->user_context($record['context']['user']); + unset($options['extra']['context']['user']); + } + } + if (!empty($record['extra'])) { + $options['extra']['extra'] = $record['extra']; + } + + if (!empty($this->release) && !isset($options['release'])) { + $options['release'] = $this->release; + } + + if (isset($record['context']['exception']) && ($record['context']['exception'] instanceof \Exception || (PHP_VERSION_ID >= 70000 && $record['context']['exception'] instanceof \Throwable))) { + $options['message'] = $record['formatted']; + $this->ravenClient->captureException($record['context']['exception'], $options); + } else { + $this->ravenClient->captureMessage($record['formatted'], array(), $options); + } + + if ($previousUserContext !== false) { + $this->ravenClient->user_context($previousUserContext); + } + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter() + { + return new LineFormatter('[%channel%] %message%'); + } + + /** + * Gets the default formatter for the logs generated by handleBatch(). + * + * @return FormatterInterface + */ + protected function getDefaultBatchFormatter() + { + return new LineFormatter(); + } + + /** + * Gets extra parameters supported by Raven that can be found in "extra" and "context" + * + * @return array + */ + protected function getExtraParameters() + { + return array('contexts', 'checksum', 'release', 'event_id'); + } + + /** + * @param string $value + * @return self + */ + public function setRelease($value) + { + $this->release = $value; + + return $this; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php new file mode 100644 index 0000000..590f996 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php @@ -0,0 +1,97 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\LineFormatter; +use Monolog\Logger; + +/** + * Logs to a Redis key using rpush + * + * usage example: + * + * $log = new Logger('application'); + * $redis = new RedisHandler(new Predis\Client("tcp://localhost:6379"), "logs", "prod"); + * $log->pushHandler($redis); + * + * @author Thomas Tourlourat + */ +class RedisHandler extends AbstractProcessingHandler +{ + private $redisClient; + private $redisKey; + protected $capSize; + + /** + * @param \Predis\Client|\Redis $redis The redis instance + * @param string $key The key name to push records to + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $capSize Number of entries to limit list size to + */ + public function __construct($redis, $key, $level = Logger::DEBUG, $bubble = true, $capSize = false) + { + if (!(($redis instanceof \Predis\Client) || ($redis instanceof \Redis))) { + throw new \InvalidArgumentException('Predis\Client or Redis instance required'); + } + + $this->redisClient = $redis; + $this->redisKey = $key; + $this->capSize = $capSize; + + parent::__construct($level, $bubble); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record) + { + if ($this->capSize) { + $this->writeCapped($record); + } else { + $this->redisClient->rpush($this->redisKey, $record["formatted"]); + } + } + + /** + * Write and cap the collection + * Writes the record to the redis list and caps its + * + * @param array $record associative record array + * @return void + */ + protected function writeCapped(array $record) + { + if ($this->redisClient instanceof \Redis) { + $this->redisClient->multi() + ->rpush($this->redisKey, $record["formatted"]) + ->ltrim($this->redisKey, -$this->capSize, -1) + ->exec(); + } else { + $redisKey = $this->redisKey; + $capSize = $this->capSize; + $this->redisClient->transaction(function ($tx) use ($record, $redisKey, $capSize) { + $tx->rpush($redisKey, $record["formatted"]); + $tx->ltrim($redisKey, -$capSize, -1); + }); + } + } + + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter() + { + return new LineFormatter(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php new file mode 100644 index 0000000..65073ff --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php @@ -0,0 +1,144 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use RollbarNotifier; +use Exception; +use Monolog\Logger; + +/** + * Sends errors to Rollbar + * + * If the context data contains a `payload` key, that is used as an array + * of payload options to RollbarNotifier's report_message/report_exception methods. + * + * Rollbar's context info will contain the context + extra keys from the log record + * merged, and then on top of that a few keys: + * + * - level (rollbar level name) + * - monolog_level (monolog level name, raw level, as rollbar only has 5 but monolog 8) + * - channel + * - datetime (unix timestamp) + * + * @author Paul Statezny + */ +class RollbarHandler extends AbstractProcessingHandler +{ + /** + * Rollbar notifier + * + * @var RollbarNotifier + */ + protected $rollbarNotifier; + + protected $levelMap = array( + Logger::DEBUG => 'debug', + Logger::INFO => 'info', + Logger::NOTICE => 'info', + Logger::WARNING => 'warning', + Logger::ERROR => 'error', + Logger::CRITICAL => 'critical', + Logger::ALERT => 'critical', + Logger::EMERGENCY => 'critical', + ); + + /** + * Records whether any log records have been added since the last flush of the rollbar notifier + * + * @var bool + */ + private $hasRecords = false; + + protected $initialized = false; + + /** + * @param RollbarNotifier $rollbarNotifier RollbarNotifier object constructed with valid token + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct(RollbarNotifier $rollbarNotifier, $level = Logger::ERROR, $bubble = true) + { + $this->rollbarNotifier = $rollbarNotifier; + + parent::__construct($level, $bubble); + } + + /** + * {@inheritdoc} + */ + protected function write(array $record) + { + if (!$this->initialized) { + // __destructor() doesn't get called on Fatal errors + register_shutdown_function(array($this, 'close')); + $this->initialized = true; + } + + $context = $record['context']; + $payload = array(); + if (isset($context['payload'])) { + $payload = $context['payload']; + unset($context['payload']); + } + $context = array_merge($context, $record['extra'], array( + 'level' => $this->levelMap[$record['level']], + 'monolog_level' => $record['level_name'], + 'channel' => $record['channel'], + 'datetime' => $record['datetime']->format('U'), + )); + + if (isset($context['exception']) && $context['exception'] instanceof Exception) { + $payload['level'] = $context['level']; + $exception = $context['exception']; + unset($context['exception']); + + $this->rollbarNotifier->report_exception($exception, $context, $payload); + } else { + $this->rollbarNotifier->report_message( + $record['message'], + $context['level'], + $context, + $payload + ); + } + + $this->hasRecords = true; + } + + public function flush() + { + if ($this->hasRecords) { + $this->rollbarNotifier->flush(); + $this->hasRecords = false; + } + } + + /** + * {@inheritdoc} + */ + public function close() + { + $this->flush(); + } + + /** + * {@inheritdoc} + */ + public function reset() + { + $this->flush(); + + parent::reset(); + } + + +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php new file mode 100644 index 0000000..ae2309f --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php @@ -0,0 +1,190 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Stores logs to files that are rotated every day and a limited number of files are kept. + * + * This rotation is only intended to be used as a workaround. Using logrotate to + * handle the rotation is strongly encouraged when you can use it. + * + * @author Christophe Coevoet + * @author Jordi Boggiano + */ +class RotatingFileHandler extends StreamHandler +{ + const FILE_PER_DAY = 'Y-m-d'; + const FILE_PER_MONTH = 'Y-m'; + const FILE_PER_YEAR = 'Y'; + + protected $filename; + protected $maxFiles; + protected $mustRotate; + protected $nextRotation; + protected $filenameFormat; + protected $dateFormat; + + /** + * @param string $filename + * @param int $maxFiles The maximal amount of files to keep (0 means unlimited) + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) + * @param bool $useLocking Try to lock log file before doing any writes + */ + public function __construct($filename, $maxFiles = 0, $level = Logger::DEBUG, $bubble = true, $filePermission = null, $useLocking = false) + { + $this->filename = $filename; + $this->maxFiles = (int) $maxFiles; + $this->nextRotation = new \DateTime('tomorrow'); + $this->filenameFormat = '{filename}-{date}'; + $this->dateFormat = 'Y-m-d'; + + parent::__construct($this->getTimedFilename(), $level, $bubble, $filePermission, $useLocking); + } + + /** + * {@inheritdoc} + */ + public function close() + { + parent::close(); + + if (true === $this->mustRotate) { + $this->rotate(); + } + } + + /** + * {@inheritdoc} + */ + public function reset() + { + parent::reset(); + + if (true === $this->mustRotate) { + $this->rotate(); + } + } + + public function setFilenameFormat($filenameFormat, $dateFormat) + { + if (!preg_match('{^Y(([/_.-]?m)([/_.-]?d)?)?$}', $dateFormat)) { + trigger_error( + 'Invalid date format - format must be one of '. + 'RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), RotatingFileHandler::FILE_PER_MONTH ("Y-m") '. + 'or RotatingFileHandler::FILE_PER_YEAR ("Y"), or you can set one of the '. + 'date formats using slashes, underscores and/or dots instead of dashes.', + E_USER_DEPRECATED + ); + } + if (substr_count($filenameFormat, '{date}') === 0) { + trigger_error( + 'Invalid filename format - format should contain at least `{date}`, because otherwise rotating is impossible.', + E_USER_DEPRECATED + ); + } + $this->filenameFormat = $filenameFormat; + $this->dateFormat = $dateFormat; + $this->url = $this->getTimedFilename(); + $this->close(); + } + + /** + * {@inheritdoc} + */ + protected function write(array $record) + { + // on the first record written, if the log is new, we should rotate (once per day) + if (null === $this->mustRotate) { + $this->mustRotate = !file_exists($this->url); + } + + if ($this->nextRotation < $record['datetime']) { + $this->mustRotate = true; + $this->close(); + } + + parent::write($record); + } + + /** + * Rotates the files. + */ + protected function rotate() + { + // update filename + $this->url = $this->getTimedFilename(); + $this->nextRotation = new \DateTime('tomorrow'); + + // skip GC of old logs if files are unlimited + if (0 === $this->maxFiles) { + return; + } + + $logFiles = glob($this->getGlobPattern()); + if ($this->maxFiles >= count($logFiles)) { + // no files to remove + return; + } + + // Sorting the files by name to remove the older ones + usort($logFiles, function ($a, $b) { + return strcmp($b, $a); + }); + + foreach (array_slice($logFiles, $this->maxFiles) as $file) { + if (is_writable($file)) { + // suppress errors here as unlink() might fail if two processes + // are cleaning up/rotating at the same time + set_error_handler(function ($errno, $errstr, $errfile, $errline) {}); + unlink($file); + restore_error_handler(); + } + } + + $this->mustRotate = false; + } + + protected function getTimedFilename() + { + $fileInfo = pathinfo($this->filename); + $timedFilename = str_replace( + array('{filename}', '{date}'), + array($fileInfo['filename'], date($this->dateFormat)), + $fileInfo['dirname'] . '/' . $this->filenameFormat + ); + + if (!empty($fileInfo['extension'])) { + $timedFilename .= '.'.$fileInfo['extension']; + } + + return $timedFilename; + } + + protected function getGlobPattern() + { + $fileInfo = pathinfo($this->filename); + $glob = str_replace( + array('{filename}', '{date}'), + array($fileInfo['filename'], '[0-9][0-9][0-9][0-9]*'), + $fileInfo['dirname'] . '/' . $this->filenameFormat + ); + if (!empty($fileInfo['extension'])) { + $glob .= '.'.$fileInfo['extension']; + } + + return $glob; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php new file mode 100644 index 0000000..9509ae3 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +/** + * Sampling handler + * + * A sampled event stream can be useful for logging high frequency events in + * a production environment where you only need an idea of what is happening + * and are not concerned with capturing every occurrence. Since the decision to + * handle or not handle a particular event is determined randomly, the + * resulting sampled log is not guaranteed to contain 1/N of the events that + * occurred in the application, but based on the Law of large numbers, it will + * tend to be close to this ratio with a large number of attempts. + * + * @author Bryan Davis + * @author Kunal Mehta + */ +class SamplingHandler extends AbstractHandler +{ + /** + * @var callable|HandlerInterface $handler + */ + protected $handler; + + /** + * @var int $factor + */ + protected $factor; + + /** + * @param callable|HandlerInterface $handler Handler or factory callable($record, $fingersCrossedHandler). + * @param int $factor Sample factor + */ + public function __construct($handler, $factor) + { + parent::__construct(); + $this->handler = $handler; + $this->factor = $factor; + + if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { + throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); + } + } + + public function isHandling(array $record) + { + return $this->handler->isHandling($record); + } + + public function handle(array $record) + { + if ($this->isHandling($record) && mt_rand(1, $this->factor) === 1) { + // The same logic as in FingersCrossedHandler + if (!$this->handler instanceof HandlerInterface) { + $this->handler = call_user_func($this->handler, $record, $this); + if (!$this->handler instanceof HandlerInterface) { + throw new \RuntimeException("The factory callable should return a HandlerInterface"); + } + } + + if ($this->processors) { + foreach ($this->processors as $processor) { + $record = call_user_func($processor, $record); + } + } + + $this->handler->handle($record); + } + + return false === $this->bubble; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php b/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php new file mode 100755 index 0000000..e55e0e2 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php @@ -0,0 +1,294 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\Slack; + +use Monolog\Logger; +use Monolog\Formatter\NormalizerFormatter; +use Monolog\Formatter\FormatterInterface; + +/** + * Slack record utility helping to log to Slack webhooks or API. + * + * @author Greg Kedzierski + * @author Haralan Dobrev + * @see https://api.slack.com/incoming-webhooks + * @see https://api.slack.com/docs/message-attachments + */ +class SlackRecord +{ + const COLOR_DANGER = 'danger'; + + const COLOR_WARNING = 'warning'; + + const COLOR_GOOD = 'good'; + + const COLOR_DEFAULT = '#e3e4e6'; + + /** + * Slack channel (encoded ID or name) + * @var string|null + */ + private $channel; + + /** + * Name of a bot + * @var string|null + */ + private $username; + + /** + * User icon e.g. 'ghost', 'http://example.com/user.png' + * @var string + */ + private $userIcon; + + /** + * Whether the message should be added to Slack as attachment (plain text otherwise) + * @var bool + */ + private $useAttachment; + + /** + * Whether the the context/extra messages added to Slack as attachments are in a short style + * @var bool + */ + private $useShortAttachment; + + /** + * Whether the attachment should include context and extra data + * @var bool + */ + private $includeContextAndExtra; + + /** + * Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] + * @var array + */ + private $excludeFields; + + /** + * @var FormatterInterface + */ + private $formatter; + + /** + * @var NormalizerFormatter + */ + private $normalizerFormatter; + + public function __construct($channel = null, $username = null, $useAttachment = true, $userIcon = null, $useShortAttachment = false, $includeContextAndExtra = false, array $excludeFields = array(), FormatterInterface $formatter = null) + { + $this->channel = $channel; + $this->username = $username; + $this->userIcon = trim($userIcon, ':'); + $this->useAttachment = $useAttachment; + $this->useShortAttachment = $useShortAttachment; + $this->includeContextAndExtra = $includeContextAndExtra; + $this->excludeFields = $excludeFields; + $this->formatter = $formatter; + + if ($this->includeContextAndExtra) { + $this->normalizerFormatter = new NormalizerFormatter(); + } + } + + public function getSlackData(array $record) + { + $dataArray = array(); + $record = $this->excludeFields($record); + + if ($this->username) { + $dataArray['username'] = $this->username; + } + + if ($this->channel) { + $dataArray['channel'] = $this->channel; + } + + if ($this->formatter && !$this->useAttachment) { + $message = $this->formatter->format($record); + } else { + $message = $record['message']; + } + + if ($this->useAttachment) { + $attachment = array( + 'fallback' => $message, + 'text' => $message, + 'color' => $this->getAttachmentColor($record['level']), + 'fields' => array(), + 'mrkdwn_in' => array('fields'), + 'ts' => $record['datetime']->getTimestamp() + ); + + if ($this->useShortAttachment) { + $attachment['title'] = $record['level_name']; + } else { + $attachment['title'] = 'Message'; + $attachment['fields'][] = $this->generateAttachmentField('Level', $record['level_name']); + } + + + if ($this->includeContextAndExtra) { + foreach (array('extra', 'context') as $key) { + if (empty($record[$key])) { + continue; + } + + if ($this->useShortAttachment) { + $attachment['fields'][] = $this->generateAttachmentField( + $key, + $record[$key] + ); + } else { + // Add all extra fields as individual fields in attachment + $attachment['fields'] = array_merge( + $attachment['fields'], + $this->generateAttachmentFields($record[$key]) + ); + } + } + } + + $dataArray['attachments'] = array($attachment); + } else { + $dataArray['text'] = $message; + } + + if ($this->userIcon) { + if (filter_var($this->userIcon, FILTER_VALIDATE_URL)) { + $dataArray['icon_url'] = $this->userIcon; + } else { + $dataArray['icon_emoji'] = ":{$this->userIcon}:"; + } + } + + return $dataArray; + } + + /** + * Returned a Slack message attachment color associated with + * provided level. + * + * @param int $level + * @return string + */ + public function getAttachmentColor($level) + { + switch (true) { + case $level >= Logger::ERROR: + return self::COLOR_DANGER; + case $level >= Logger::WARNING: + return self::COLOR_WARNING; + case $level >= Logger::INFO: + return self::COLOR_GOOD; + default: + return self::COLOR_DEFAULT; + } + } + + /** + * Stringifies an array of key/value pairs to be used in attachment fields + * + * @param array $fields + * + * @return string + */ + public function stringify($fields) + { + $normalized = $this->normalizerFormatter->format($fields); + $prettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128; + + $hasSecondDimension = count(array_filter($normalized, 'is_array')); + $hasNonNumericKeys = !count(array_filter(array_keys($normalized), 'is_numeric')); + + return $hasSecondDimension || $hasNonNumericKeys + ? json_encode($normalized, $prettyPrintFlag) + : json_encode($normalized); + } + + /** + * Sets the formatter + * + * @param FormatterInterface $formatter + */ + public function setFormatter(FormatterInterface $formatter) + { + $this->formatter = $formatter; + } + + /** + * Generates attachment field + * + * @param string $title + * @param string|array $value + * + * @return array + */ + private function generateAttachmentField($title, $value) + { + $value = is_array($value) + ? sprintf('```%s```', $this->stringify($value)) + : $value; + + return array( + 'title' => ucfirst($title), + 'value' => $value, + 'short' => false + ); + } + + /** + * Generates a collection of attachment fields from array + * + * @param array $data + * + * @return array + */ + private function generateAttachmentFields(array $data) + { + $fields = array(); + foreach ($this->normalizerFormatter->format($data) as $key => $value) { + $fields[] = $this->generateAttachmentField($key, $value); + } + + return $fields; + } + + /** + * Get a copy of record with fields excluded according to $this->excludeFields + * + * @param array $record + * + * @return array + */ + private function excludeFields(array $record) + { + foreach ($this->excludeFields as $field) { + $keys = explode('.', $field); + $node = &$record; + $lastKey = end($keys); + foreach ($keys as $key) { + if (!isset($node[$key])) { + break; + } + if ($lastKey === $key) { + unset($node[$key]); + break; + } + $node = &$node[$key]; + } + } + + return $record; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php new file mode 100644 index 0000000..45d634f --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php @@ -0,0 +1,220 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\Logger; +use Monolog\Handler\Slack\SlackRecord; + +/** + * Sends notifications through Slack API + * + * @author Greg Kedzierski + * @see https://api.slack.com/ + */ +class SlackHandler extends SocketHandler +{ + /** + * Slack API token + * @var string + */ + private $token; + + /** + * Instance of the SlackRecord util class preparing data for Slack API. + * @var SlackRecord + */ + private $slackRecord; + + /** + * @param string $token Slack API token + * @param string $channel Slack channel (encoded ID or name) + * @param string|null $username Name of a bot + * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise) + * @param string|null $iconEmoji The emoji name to use (or null) + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style + * @param bool $includeContextAndExtra Whether the attachment should include context and extra data + * @param array $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] + * @throws MissingExtensionException If no OpenSSL PHP extension configured + */ + public function __construct($token, $channel, $username = null, $useAttachment = true, $iconEmoji = null, $level = Logger::CRITICAL, $bubble = true, $useShortAttachment = false, $includeContextAndExtra = false, array $excludeFields = array()) + { + if (!extension_loaded('openssl')) { + throw new MissingExtensionException('The OpenSSL PHP extension is required to use the SlackHandler'); + } + + parent::__construct('ssl://slack.com:443', $level, $bubble); + + $this->slackRecord = new SlackRecord( + $channel, + $username, + $useAttachment, + $iconEmoji, + $useShortAttachment, + $includeContextAndExtra, + $excludeFields, + $this->formatter + ); + + $this->token = $token; + } + + public function getSlackRecord() + { + return $this->slackRecord; + } + + public function getToken() + { + return $this->token; + } + + /** + * {@inheritdoc} + * + * @param array $record + * @return string + */ + protected function generateDataStream($record) + { + $content = $this->buildContent($record); + + return $this->buildHeader($content) . $content; + } + + /** + * Builds the body of API call + * + * @param array $record + * @return string + */ + private function buildContent($record) + { + $dataArray = $this->prepareContentData($record); + + return http_build_query($dataArray); + } + + /** + * Prepares content data + * + * @param array $record + * @return array + */ + protected function prepareContentData($record) + { + $dataArray = $this->slackRecord->getSlackData($record); + $dataArray['token'] = $this->token; + + if (!empty($dataArray['attachments'])) { + $dataArray['attachments'] = json_encode($dataArray['attachments']); + } + + return $dataArray; + } + + /** + * Builds the header of the API Call + * + * @param string $content + * @return string + */ + private function buildHeader($content) + { + $header = "POST /api/chat.postMessage HTTP/1.1\r\n"; + $header .= "Host: slack.com\r\n"; + $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; + $header .= "Content-Length: " . strlen($content) . "\r\n"; + $header .= "\r\n"; + + return $header; + } + + /** + * {@inheritdoc} + * + * @param array $record + */ + protected function write(array $record) + { + parent::write($record); + $this->finalizeWrite(); + } + + /** + * Finalizes the request by reading some bytes and then closing the socket + * + * If we do not read some but close the socket too early, slack sometimes + * drops the request entirely. + */ + protected function finalizeWrite() + { + $res = $this->getResource(); + if (is_resource($res)) { + @fread($res, 2048); + } + $this->closeSocket(); + } + + /** + * Returned a Slack message attachment color associated with + * provided level. + * + * @param int $level + * @return string + * @deprecated Use underlying SlackRecord instead + */ + protected function getAttachmentColor($level) + { + trigger_error( + 'SlackHandler::getAttachmentColor() is deprecated. Use underlying SlackRecord instead.', + E_USER_DEPRECATED + ); + + return $this->slackRecord->getAttachmentColor($level); + } + + /** + * Stringifies an array of key/value pairs to be used in attachment fields + * + * @param array $fields + * @return string + * @deprecated Use underlying SlackRecord instead + */ + protected function stringify($fields) + { + trigger_error( + 'SlackHandler::stringify() is deprecated. Use underlying SlackRecord instead.', + E_USER_DEPRECATED + ); + + return $this->slackRecord->stringify($fields); + } + + public function setFormatter(FormatterInterface $formatter) + { + parent::setFormatter($formatter); + $this->slackRecord->setFormatter($formatter); + + return $this; + } + + public function getFormatter() + { + $formatter = parent::getFormatter(); + $this->slackRecord->setFormatter($formatter); + + return $formatter; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php new file mode 100644 index 0000000..1ef85fa --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php @@ -0,0 +1,120 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FormatterInterface; +use Monolog\Logger; +use Monolog\Handler\Slack\SlackRecord; + +/** + * Sends notifications through Slack Webhooks + * + * @author Haralan Dobrev + * @see https://api.slack.com/incoming-webhooks + */ +class SlackWebhookHandler extends AbstractProcessingHandler +{ + /** + * Slack Webhook token + * @var string + */ + private $webhookUrl; + + /** + * Instance of the SlackRecord util class preparing data for Slack API. + * @var SlackRecord + */ + private $slackRecord; + + /** + * @param string $webhookUrl Slack Webhook URL + * @param string|null $channel Slack channel (encoded ID or name) + * @param string|null $username Name of a bot + * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise) + * @param string|null $iconEmoji The emoji name to use (or null) + * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style + * @param bool $includeContextAndExtra Whether the attachment should include context and extra data + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param array $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] + */ + public function __construct($webhookUrl, $channel = null, $username = null, $useAttachment = true, $iconEmoji = null, $useShortAttachment = false, $includeContextAndExtra = false, $level = Logger::CRITICAL, $bubble = true, array $excludeFields = array()) + { + parent::__construct($level, $bubble); + + $this->webhookUrl = $webhookUrl; + + $this->slackRecord = new SlackRecord( + $channel, + $username, + $useAttachment, + $iconEmoji, + $useShortAttachment, + $includeContextAndExtra, + $excludeFields, + $this->formatter + ); + } + + public function getSlackRecord() + { + return $this->slackRecord; + } + + public function getWebhookUrl() + { + return $this->webhookUrl; + } + + /** + * {@inheritdoc} + * + * @param array $record + */ + protected function write(array $record) + { + $postData = $this->slackRecord->getSlackData($record); + $postString = json_encode($postData); + + $ch = curl_init(); + $options = array( + CURLOPT_URL => $this->webhookUrl, + CURLOPT_POST => true, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HTTPHEADER => array('Content-type: application/json'), + CURLOPT_POSTFIELDS => $postString + ); + if (defined('CURLOPT_SAFE_UPLOAD')) { + $options[CURLOPT_SAFE_UPLOAD] = true; + } + + curl_setopt_array($ch, $options); + + Curl\Util::execute($ch); + } + + public function setFormatter(FormatterInterface $formatter) + { + parent::setFormatter($formatter); + $this->slackRecord->setFormatter($formatter); + + return $this; + } + + public function getFormatter() + { + $formatter = parent::getFormatter(); + $this->slackRecord->setFormatter($formatter); + + return $formatter; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php new file mode 100644 index 0000000..baead52 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Sends notifications through Slack's Slackbot + * + * @author Haralan Dobrev + * @see https://slack.com/apps/A0F81R8ET-slackbot + */ +class SlackbotHandler extends AbstractProcessingHandler +{ + /** + * The slug of the Slack team + * @var string + */ + private $slackTeam; + + /** + * Slackbot token + * @var string + */ + private $token; + + /** + * Slack channel name + * @var string + */ + private $channel; + + /** + * @param string $slackTeam Slack team slug + * @param string $token Slackbot token + * @param string $channel Slack channel (encoded ID or name) + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct($slackTeam, $token, $channel, $level = Logger::CRITICAL, $bubble = true) + { + parent::__construct($level, $bubble); + + $this->slackTeam = $slackTeam; + $this->token = $token; + $this->channel = $channel; + } + + /** + * {@inheritdoc} + * + * @param array $record + */ + protected function write(array $record) + { + $slackbotUrl = sprintf( + 'https://%s.slack.com/services/hooks/slackbot?token=%s&channel=%s', + $this->slackTeam, + $this->token, + $this->channel + ); + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $slackbotUrl); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $record['message']); + + Curl\Util::execute($ch); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php new file mode 100644 index 0000000..db50d97 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php @@ -0,0 +1,385 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Stores to any socket - uses fsockopen() or pfsockopen(). + * + * @author Pablo de Leon Belloc + * @see http://php.net/manual/en/function.fsockopen.php + */ +class SocketHandler extends AbstractProcessingHandler +{ + private $connectionString; + private $connectionTimeout; + private $resource; + private $timeout = 0; + private $writingTimeout = 10; + private $lastSentBytes = null; + private $chunkSize = null; + private $persistent = false; + private $errno; + private $errstr; + private $lastWritingAt; + + /** + * @param string $connectionString Socket connection string + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct($connectionString, $level = Logger::DEBUG, $bubble = true) + { + parent::__construct($level, $bubble); + $this->connectionString = $connectionString; + $this->connectionTimeout = (float) ini_get('default_socket_timeout'); + } + + /** + * Connect (if necessary) and write to the socket + * + * @param array $record + * + * @throws \UnexpectedValueException + * @throws \RuntimeException + */ + protected function write(array $record) + { + $this->connectIfNotConnected(); + $data = $this->generateDataStream($record); + $this->writeToSocket($data); + } + + /** + * We will not close a PersistentSocket instance so it can be reused in other requests. + */ + public function close() + { + if (!$this->isPersistent()) { + $this->closeSocket(); + } + } + + /** + * Close socket, if open + */ + public function closeSocket() + { + if (is_resource($this->resource)) { + fclose($this->resource); + $this->resource = null; + } + } + + /** + * Set socket connection to nbe persistent. It only has effect before the connection is initiated. + * + * @param bool $persistent + */ + public function setPersistent($persistent) + { + $this->persistent = (bool) $persistent; + } + + /** + * Set connection timeout. Only has effect before we connect. + * + * @param float $seconds + * + * @see http://php.net/manual/en/function.fsockopen.php + */ + public function setConnectionTimeout($seconds) + { + $this->validateTimeout($seconds); + $this->connectionTimeout = (float) $seconds; + } + + /** + * Set write timeout. Only has effect before we connect. + * + * @param float $seconds + * + * @see http://php.net/manual/en/function.stream-set-timeout.php + */ + public function setTimeout($seconds) + { + $this->validateTimeout($seconds); + $this->timeout = (float) $seconds; + } + + /** + * Set writing timeout. Only has effect during connection in the writing cycle. + * + * @param float $seconds 0 for no timeout + */ + public function setWritingTimeout($seconds) + { + $this->validateTimeout($seconds); + $this->writingTimeout = (float) $seconds; + } + + /** + * Set chunk size. Only has effect during connection in the writing cycle. + * + * @param float $bytes + */ + public function setChunkSize($bytes) + { + $this->chunkSize = $bytes; + } + + /** + * Get current connection string + * + * @return string + */ + public function getConnectionString() + { + return $this->connectionString; + } + + /** + * Get persistent setting + * + * @return bool + */ + public function isPersistent() + { + return $this->persistent; + } + + /** + * Get current connection timeout setting + * + * @return float + */ + public function getConnectionTimeout() + { + return $this->connectionTimeout; + } + + /** + * Get current in-transfer timeout + * + * @return float + */ + public function getTimeout() + { + return $this->timeout; + } + + /** + * Get current local writing timeout + * + * @return float + */ + public function getWritingTimeout() + { + return $this->writingTimeout; + } + + /** + * Get current chunk size + * + * @return float + */ + public function getChunkSize() + { + return $this->chunkSize; + } + + /** + * Check to see if the socket is currently available. + * + * UDP might appear to be connected but might fail when writing. See http://php.net/fsockopen for details. + * + * @return bool + */ + public function isConnected() + { + return is_resource($this->resource) + && !feof($this->resource); // on TCP - other party can close connection. + } + + /** + * Wrapper to allow mocking + */ + protected function pfsockopen() + { + return @pfsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->connectionTimeout); + } + + /** + * Wrapper to allow mocking + */ + protected function fsockopen() + { + return @fsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->connectionTimeout); + } + + /** + * Wrapper to allow mocking + * + * @see http://php.net/manual/en/function.stream-set-timeout.php + */ + protected function streamSetTimeout() + { + $seconds = floor($this->timeout); + $microseconds = round(($this->timeout - $seconds) * 1e6); + + return stream_set_timeout($this->resource, $seconds, $microseconds); + } + + /** + * Wrapper to allow mocking + * + * @see http://php.net/manual/en/function.stream-set-chunk-size.php + */ + protected function streamSetChunkSize() + { + return stream_set_chunk_size($this->resource, $this->chunkSize); + } + + /** + * Wrapper to allow mocking + */ + protected function fwrite($data) + { + return @fwrite($this->resource, $data); + } + + /** + * Wrapper to allow mocking + */ + protected function streamGetMetadata() + { + return stream_get_meta_data($this->resource); + } + + private function validateTimeout($value) + { + $ok = filter_var($value, FILTER_VALIDATE_FLOAT); + if ($ok === false || $value < 0) { + throw new \InvalidArgumentException("Timeout must be 0 or a positive float (got $value)"); + } + } + + private function connectIfNotConnected() + { + if ($this->isConnected()) { + return; + } + $this->connect(); + } + + protected function generateDataStream($record) + { + return (string) $record['formatted']; + } + + /** + * @return resource|null + */ + protected function getResource() + { + return $this->resource; + } + + private function connect() + { + $this->createSocketResource(); + $this->setSocketTimeout(); + $this->setStreamChunkSize(); + } + + private function createSocketResource() + { + if ($this->isPersistent()) { + $resource = $this->pfsockopen(); + } else { + $resource = $this->fsockopen(); + } + if (!$resource) { + throw new \UnexpectedValueException("Failed connecting to $this->connectionString ($this->errno: $this->errstr)"); + } + $this->resource = $resource; + } + + private function setSocketTimeout() + { + if (!$this->streamSetTimeout()) { + throw new \UnexpectedValueException("Failed setting timeout with stream_set_timeout()"); + } + } + + private function setStreamChunkSize() + { + if ($this->chunkSize && !$this->streamSetChunkSize()) { + throw new \UnexpectedValueException("Failed setting chunk size with stream_set_chunk_size()"); + } + } + + private function writeToSocket($data) + { + $length = strlen($data); + $sent = 0; + $this->lastSentBytes = $sent; + while ($this->isConnected() && $sent < $length) { + if (0 == $sent) { + $chunk = $this->fwrite($data); + } else { + $chunk = $this->fwrite(substr($data, $sent)); + } + if ($chunk === false) { + throw new \RuntimeException("Could not write to socket"); + } + $sent += $chunk; + $socketInfo = $this->streamGetMetadata(); + if ($socketInfo['timed_out']) { + throw new \RuntimeException("Write timed-out"); + } + + if ($this->writingIsTimedOut($sent)) { + throw new \RuntimeException("Write timed-out, no data sent for `{$this->writingTimeout}` seconds, probably we got disconnected (sent $sent of $length)"); + } + } + if (!$this->isConnected() && $sent < $length) { + throw new \RuntimeException("End-of-file reached, probably we got disconnected (sent $sent of $length)"); + } + } + + private function writingIsTimedOut($sent) + { + $writingTimeout = (int) floor($this->writingTimeout); + if (0 === $writingTimeout) { + return false; + } + + if ($sent !== $this->lastSentBytes) { + $this->lastWritingAt = time(); + $this->lastSentBytes = $sent; + + return false; + } else { + usleep(100); + } + + if ((time() - $this->lastWritingAt) >= $writingTimeout) { + $this->closeSocket(); + + return true; + } + + return false; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php new file mode 100644 index 0000000..a35b7e4 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php @@ -0,0 +1,176 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Stores to any stream resource + * + * Can be used to store into php://stderr, remote and local files, etc. + * + * @author Jordi Boggiano + */ +class StreamHandler extends AbstractProcessingHandler +{ + protected $stream; + protected $url; + private $errorMessage; + protected $filePermission; + protected $useLocking; + private $dirCreated; + + /** + * @param resource|string $stream + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) + * @param bool $useLocking Try to lock log file before doing any writes + * + * @throws \Exception If a missing directory is not buildable + * @throws \InvalidArgumentException If stream is not a resource or string + */ + public function __construct($stream, $level = Logger::DEBUG, $bubble = true, $filePermission = null, $useLocking = false) + { + parent::__construct($level, $bubble); + if (is_resource($stream)) { + $this->stream = $stream; + } elseif (is_string($stream)) { + $this->url = $stream; + } else { + throw new \InvalidArgumentException('A stream must either be a resource or a string.'); + } + + $this->filePermission = $filePermission; + $this->useLocking = $useLocking; + } + + /** + * {@inheritdoc} + */ + public function close() + { + if ($this->url && is_resource($this->stream)) { + fclose($this->stream); + } + $this->stream = null; + } + + /** + * Return the currently active stream if it is open + * + * @return resource|null + */ + public function getStream() + { + return $this->stream; + } + + /** + * Return the stream URL if it was configured with a URL and not an active resource + * + * @return string|null + */ + public function getUrl() + { + return $this->url; + } + + /** + * {@inheritdoc} + */ + protected function write(array $record) + { + if (!is_resource($this->stream)) { + if (null === $this->url || '' === $this->url) { + throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().'); + } + $this->createDir(); + $this->errorMessage = null; + set_error_handler(array($this, 'customErrorHandler')); + $this->stream = fopen($this->url, 'a'); + if ($this->filePermission !== null) { + @chmod($this->url, $this->filePermission); + } + restore_error_handler(); + if (!is_resource($this->stream)) { + $this->stream = null; + throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened: '.$this->errorMessage, $this->url)); + } + } + + if ($this->useLocking) { + // ignoring errors here, there's not much we can do about them + flock($this->stream, LOCK_EX); + } + + $this->streamWrite($this->stream, $record); + + if ($this->useLocking) { + flock($this->stream, LOCK_UN); + } + } + + /** + * Write to stream + * @param resource $stream + * @param array $record + */ + protected function streamWrite($stream, array $record) + { + fwrite($stream, (string) $record['formatted']); + } + + private function customErrorHandler($code, $msg) + { + $this->errorMessage = preg_replace('{^(fopen|mkdir)\(.*?\): }', '', $msg); + } + + /** + * @param string $stream + * + * @return null|string + */ + private function getDirFromStream($stream) + { + $pos = strpos($stream, '://'); + if ($pos === false) { + return dirname($stream); + } + + if ('file://' === substr($stream, 0, 7)) { + return dirname(substr($stream, 7)); + } + + return; + } + + private function createDir() + { + // Do not try to create dir if it has already been tried. + if ($this->dirCreated) { + return; + } + + $dir = $this->getDirFromStream($this->url); + if (null !== $dir && !is_dir($dir)) { + $this->errorMessage = null; + set_error_handler(array($this, 'customErrorHandler')); + $status = mkdir($dir, 0777, true); + restore_error_handler(); + if (false === $status && !is_dir($dir)) { + throw new \UnexpectedValueException(sprintf('There is no existing directory at "%s" and its not buildable: '.$this->errorMessage, $dir)); + } + } + $this->dirCreated = true; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php new file mode 100644 index 0000000..ac7b16f --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\LineFormatter; +use Swift; + +/** + * SwiftMailerHandler uses Swift_Mailer to send the emails + * + * @author Gyula Sallai + */ +class SwiftMailerHandler extends MailHandler +{ + protected $mailer; + private $messageTemplate; + + /** + * @param \Swift_Mailer $mailer The mailer to use + * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, $bubble = true) + { + parent::__construct($level, $bubble); + + $this->mailer = $mailer; + $this->messageTemplate = $message; + } + + /** + * {@inheritdoc} + */ + protected function send($content, array $records) + { + $this->mailer->send($this->buildMessage($content, $records)); + } + + /** + * Gets the formatter for the Swift_Message subject. + * + * @param string $format The format of the subject + * @return FormatterInterface + */ + protected function getSubjectFormatter($format) + { + return new LineFormatter($format); + } + + /** + * Creates instance of Swift_Message to be sent + * + * @param string $content formatted email body to be sent + * @param array $records Log records that formed the content + * @return \Swift_Message + */ + protected function buildMessage($content, array $records) + { + $message = null; + if ($this->messageTemplate instanceof \Swift_Message) { + $message = clone $this->messageTemplate; + $message->generateId(); + } elseif (is_callable($this->messageTemplate)) { + $message = call_user_func($this->messageTemplate, $content, $records); + } + + if (!$message instanceof \Swift_Message) { + throw new \InvalidArgumentException('Could not resolve message as instance of Swift_Message or a callable returning it'); + } + + if ($records) { + $subjectFormatter = $this->getSubjectFormatter($message->getSubject()); + $message->setSubject($subjectFormatter->format($this->getHighestRecord($records))); + } + + $message->setBody($content); + if (version_compare(Swift::VERSION, '6.0.0', '>=')) { + $message->setDate(new \DateTimeImmutable()); + } else { + $message->setDate(time()); + } + + return $message; + } + + /** + * BC getter, to be removed in 2.0 + */ + public function __get($name) + { + if ($name === 'message') { + trigger_error('SwiftMailerHandler->message is deprecated, use ->buildMessage() instead to retrieve the message', E_USER_DEPRECATED); + + return $this->buildMessage(null, array()); + } + + throw new \InvalidArgumentException('Invalid property '.$name); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php new file mode 100644 index 0000000..f770c80 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +/** + * Logs to syslog service. + * + * usage example: + * + * $log = new Logger('application'); + * $syslog = new SyslogHandler('myfacility', 'local6'); + * $formatter = new LineFormatter("%channel%.%level_name%: %message% %extra%"); + * $syslog->setFormatter($formatter); + * $log->pushHandler($syslog); + * + * @author Sven Paulus + */ +class SyslogHandler extends AbstractSyslogHandler +{ + protected $ident; + protected $logopts; + + /** + * @param string $ident + * @param mixed $facility + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $logopts Option flags for the openlog() call, defaults to LOG_PID + */ + public function __construct($ident, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $logopts = LOG_PID) + { + parent::__construct($facility, $level, $bubble); + + $this->ident = $ident; + $this->logopts = $logopts; + } + + /** + * {@inheritdoc} + */ + public function close() + { + closelog(); + } + + /** + * {@inheritdoc} + */ + protected function write(array $record) + { + if (!openlog($this->ident, $this->logopts, $this->facility)) { + throw new \LogicException('Can\'t open syslog for ident "'.$this->ident.'" and facility "'.$this->facility.'"'); + } + syslog($this->logLevels[$record['level']], (string) $record['formatted']); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php b/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php new file mode 100644 index 0000000..3bff085 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\SyslogUdp; + +class UdpSocket +{ + const DATAGRAM_MAX_LENGTH = 65023; + + protected $ip; + protected $port; + protected $socket; + + public function __construct($ip, $port = 514) + { + $this->ip = $ip; + $this->port = $port; + $this->socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); + } + + public function write($line, $header = "") + { + $this->send($this->assembleMessage($line, $header)); + } + + public function close() + { + if (is_resource($this->socket)) { + socket_close($this->socket); + $this->socket = null; + } + } + + protected function send($chunk) + { + if (!is_resource($this->socket)) { + throw new \LogicException('The UdpSocket to '.$this->ip.':'.$this->port.' has been closed and can not be written to anymore'); + } + socket_sendto($this->socket, $chunk, strlen($chunk), $flags = 0, $this->ip, $this->port); + } + + protected function assembleMessage($line, $header) + { + $chunkSize = self::DATAGRAM_MAX_LENGTH - strlen($header); + + return $header . substr($line, 0, $chunkSize); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php new file mode 100644 index 0000000..e14b378 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php @@ -0,0 +1,103 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Handler\SyslogUdp\UdpSocket; + +/** + * A Handler for logging to a remote syslogd server. + * + * @author Jesper Skovgaard Nielsen + */ +class SyslogUdpHandler extends AbstractSyslogHandler +{ + protected $socket; + protected $ident; + + /** + * @param string $host + * @param int $port + * @param mixed $facility + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param string $ident Program name or tag for each log message. + */ + public function __construct($host, $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $ident = 'php') + { + parent::__construct($facility, $level, $bubble); + + $this->ident = $ident; + + $this->socket = new UdpSocket($host, $port ?: 514); + } + + protected function write(array $record) + { + $lines = $this->splitMessageIntoLines($record['formatted']); + + $header = $this->makeCommonSyslogHeader($this->logLevels[$record['level']]); + + foreach ($lines as $line) { + $this->socket->write($line, $header); + } + } + + public function close() + { + $this->socket->close(); + } + + private function splitMessageIntoLines($message) + { + if (is_array($message)) { + $message = implode("\n", $message); + } + + return preg_split('/$\R?^/m', $message, -1, PREG_SPLIT_NO_EMPTY); + } + + /** + * Make common syslog header (see rfc5424) + */ + protected function makeCommonSyslogHeader($severity) + { + $priority = $severity + $this->facility; + + if (!$pid = getmypid()) { + $pid = '-'; + } + + if (!$hostname = gethostname()) { + $hostname = '-'; + } + + return "<$priority>1 " . + $this->getDateTime() . " " . + $hostname . " " . + $this->ident . " " . + $pid . " - - "; + } + + protected function getDateTime() + { + return date(\DateTime::RFC3339); + } + + /** + * Inject your own socket, mainly used for testing + */ + public function setSocket($socket) + { + $this->socket = $socket; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php new file mode 100644 index 0000000..b6b1343 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php @@ -0,0 +1,164 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +/** + * Used for testing purposes. + * + * It records all records and gives you access to them for verification. + * + * @author Jordi Boggiano + * + * @method bool hasEmergency($record) + * @method bool hasAlert($record) + * @method bool hasCritical($record) + * @method bool hasError($record) + * @method bool hasWarning($record) + * @method bool hasNotice($record) + * @method bool hasInfo($record) + * @method bool hasDebug($record) + * + * @method bool hasEmergencyRecords() + * @method bool hasAlertRecords() + * @method bool hasCriticalRecords() + * @method bool hasErrorRecords() + * @method bool hasWarningRecords() + * @method bool hasNoticeRecords() + * @method bool hasInfoRecords() + * @method bool hasDebugRecords() + * + * @method bool hasEmergencyThatContains($message) + * @method bool hasAlertThatContains($message) + * @method bool hasCriticalThatContains($message) + * @method bool hasErrorThatContains($message) + * @method bool hasWarningThatContains($message) + * @method bool hasNoticeThatContains($message) + * @method bool hasInfoThatContains($message) + * @method bool hasDebugThatContains($message) + * + * @method bool hasEmergencyThatMatches($message) + * @method bool hasAlertThatMatches($message) + * @method bool hasCriticalThatMatches($message) + * @method bool hasErrorThatMatches($message) + * @method bool hasWarningThatMatches($message) + * @method bool hasNoticeThatMatches($message) + * @method bool hasInfoThatMatches($message) + * @method bool hasDebugThatMatches($message) + * + * @method bool hasEmergencyThatPasses($message) + * @method bool hasAlertThatPasses($message) + * @method bool hasCriticalThatPasses($message) + * @method bool hasErrorThatPasses($message) + * @method bool hasWarningThatPasses($message) + * @method bool hasNoticeThatPasses($message) + * @method bool hasInfoThatPasses($message) + * @method bool hasDebugThatPasses($message) + */ +class TestHandler extends AbstractProcessingHandler +{ + protected $records = array(); + protected $recordsByLevel = array(); + + public function getRecords() + { + return $this->records; + } + + public function clear() + { + $this->records = array(); + $this->recordsByLevel = array(); + } + + public function hasRecords($level) + { + return isset($this->recordsByLevel[$level]); + } + + /** + * @param string|array $record Either a message string or an array containing message and optionally context keys that will be checked against all records + * @param int $level Logger::LEVEL constant value + */ + public function hasRecord($record, $level) + { + if (is_string($record)) { + $record = array('message' => $record); + } + + return $this->hasRecordThatPasses(function ($rec) use ($record) { + if ($rec['message'] !== $record['message']) { + return false; + } + if (isset($record['context']) && $rec['context'] !== $record['context']) { + return false; + } + return true; + }, $level); + } + + public function hasRecordThatContains($message, $level) + { + return $this->hasRecordThatPasses(function ($rec) use ($message) { + return strpos($rec['message'], $message) !== false; + }, $level); + } + + public function hasRecordThatMatches($regex, $level) + { + return $this->hasRecordThatPasses(function ($rec) use ($regex) { + return preg_match($regex, $rec['message']) > 0; + }, $level); + } + + public function hasRecordThatPasses($predicate, $level) + { + if (!is_callable($predicate)) { + throw new \InvalidArgumentException("Expected a callable for hasRecordThatSucceeds"); + } + + if (!isset($this->recordsByLevel[$level])) { + return false; + } + + foreach ($this->recordsByLevel[$level] as $i => $rec) { + if (call_user_func($predicate, $rec, $i)) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + protected function write(array $record) + { + $this->recordsByLevel[$record['level']][] = $record; + $this->records[] = $record; + } + + public function __call($method, $args) + { + if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { + $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; + $level = constant('Monolog\Logger::' . strtoupper($matches[2])); + if (method_exists($this, $genericMethod)) { + $args[] = $level; + + return call_user_func_array(array($this, $genericMethod), $args); + } + } + + throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php new file mode 100644 index 0000000..6bc4671 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +/** + * Forwards records to multiple handlers suppressing failures of each handler + * and continuing through to give every handler a chance to succeed. + * + * @author Craig D'Amelio + */ +class WhatFailureGroupHandler extends GroupHandler +{ + /** + * {@inheritdoc} + */ + public function handle(array $record) + { + if ($this->processors) { + foreach ($this->processors as $processor) { + $record = call_user_func($processor, $record); + } + } + + foreach ($this->handlers as $handler) { + try { + $handler->handle($record); + } catch (\Exception $e) { + // What failure? + } catch (\Throwable $e) { + // What failure? + } + } + + return false === $this->bubble; + } + + /** + * {@inheritdoc} + */ + public function handleBatch(array $records) + { + if ($this->processors) { + $processed = array(); + foreach ($records as $record) { + foreach ($this->processors as $processor) { + $processed[] = call_user_func($processor, $record); + } + } + $records = $processed; + } + + foreach ($this->handlers as $handler) { + try { + $handler->handleBatch($records); + } catch (\Exception $e) { + // What failure? + } catch (\Throwable $e) { + // What failure? + } + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php new file mode 100644 index 0000000..f22cf21 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php @@ -0,0 +1,95 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\NormalizerFormatter; +use Monolog\Logger; + +/** + * Handler sending logs to Zend Monitor + * + * @author Christian Bergau + */ +class ZendMonitorHandler extends AbstractProcessingHandler +{ + /** + * Monolog level / ZendMonitor Custom Event priority map + * + * @var array + */ + protected $levelMap = array( + Logger::DEBUG => 1, + Logger::INFO => 2, + Logger::NOTICE => 3, + Logger::WARNING => 4, + Logger::ERROR => 5, + Logger::CRITICAL => 6, + Logger::ALERT => 7, + Logger::EMERGENCY => 0, + ); + + /** + * Construct + * + * @param int $level + * @param bool $bubble + * @throws MissingExtensionException + */ + public function __construct($level = Logger::DEBUG, $bubble = true) + { + if (!function_exists('zend_monitor_custom_event')) { + throw new MissingExtensionException('You must have Zend Server installed in order to use this handler'); + } + parent::__construct($level, $bubble); + } + + /** + * {@inheritdoc} + */ + protected function write(array $record) + { + $this->writeZendMonitorCustomEvent( + $this->levelMap[$record['level']], + $record['message'], + $record['formatted'] + ); + } + + /** + * Write a record to Zend Monitor + * + * @param int $level + * @param string $message + * @param array $formatted + */ + protected function writeZendMonitorCustomEvent($level, $message, $formatted) + { + zend_monitor_custom_event($level, $message, $formatted); + } + + /** + * {@inheritdoc} + */ + public function getDefaultFormatter() + { + return new NormalizerFormatter(); + } + + /** + * Get the level map + * + * @return array + */ + public function getLevelMap() + { + return $this->levelMap; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Logger.php b/vendor/monolog/monolog/src/Monolog/Logger.php new file mode 100644 index 0000000..05dfc81 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Logger.php @@ -0,0 +1,791 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use Monolog\Handler\HandlerInterface; +use Monolog\Handler\StreamHandler; +use Psr\Log\LoggerInterface; +use Psr\Log\InvalidArgumentException; +use Exception; + +/** + * Monolog log channel + * + * It contains a stack of Handlers and a stack of Processors, + * and uses them to store records that are added to it. + * + * @author Jordi Boggiano + */ +class Logger implements LoggerInterface, ResettableInterface +{ + /** + * Detailed debug information + */ + const DEBUG = 100; + + /** + * Interesting events + * + * Examples: User logs in, SQL logs. + */ + const INFO = 200; + + /** + * Uncommon events + */ + const NOTICE = 250; + + /** + * Exceptional occurrences that are not errors + * + * Examples: Use of deprecated APIs, poor use of an API, + * undesirable things that are not necessarily wrong. + */ + const WARNING = 300; + + /** + * Runtime errors + */ + const ERROR = 400; + + /** + * Critical conditions + * + * Example: Application component unavailable, unexpected exception. + */ + const CRITICAL = 500; + + /** + * Action must be taken immediately + * + * Example: Entire website down, database unavailable, etc. + * This should trigger the SMS alerts and wake you up. + */ + const ALERT = 550; + + /** + * Urgent alert. + */ + const EMERGENCY = 600; + + /** + * Monolog API version + * + * This is only bumped when API breaks are done and should + * follow the major version of the library + * + * @var int + */ + const API = 1; + + /** + * Logging levels from syslog protocol defined in RFC 5424 + * + * @var array $levels Logging levels + */ + protected static $levels = array( + self::DEBUG => 'DEBUG', + self::INFO => 'INFO', + self::NOTICE => 'NOTICE', + self::WARNING => 'WARNING', + self::ERROR => 'ERROR', + self::CRITICAL => 'CRITICAL', + self::ALERT => 'ALERT', + self::EMERGENCY => 'EMERGENCY', + ); + + /** + * @var \DateTimeZone + */ + protected static $timezone; + + /** + * @var string + */ + protected $name; + + /** + * The handler stack + * + * @var HandlerInterface[] + */ + protected $handlers; + + /** + * Processors that will process all log records + * + * To process records of a single handler instead, add the processor on that specific handler + * + * @var callable[] + */ + protected $processors; + + /** + * @var bool + */ + protected $microsecondTimestamps = true; + + /** + * @var callable + */ + protected $exceptionHandler; + + /** + * @param string $name The logging channel + * @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc. + * @param callable[] $processors Optional array of processors + */ + public function __construct($name, array $handlers = array(), array $processors = array()) + { + $this->name = $name; + $this->setHandlers($handlers); + $this->processors = $processors; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Return a new cloned instance with the name changed + * + * @return static + */ + public function withName($name) + { + $new = clone $this; + $new->name = $name; + + return $new; + } + + /** + * Pushes a handler on to the stack. + * + * @param HandlerInterface $handler + * @return $this + */ + public function pushHandler(HandlerInterface $handler) + { + array_unshift($this->handlers, $handler); + + return $this; + } + + /** + * Pops a handler from the stack + * + * @return HandlerInterface + */ + public function popHandler() + { + if (!$this->handlers) { + throw new \LogicException('You tried to pop from an empty handler stack.'); + } + + return array_shift($this->handlers); + } + + /** + * Set handlers, replacing all existing ones. + * + * If a map is passed, keys will be ignored. + * + * @param HandlerInterface[] $handlers + * @return $this + */ + public function setHandlers(array $handlers) + { + $this->handlers = array(); + foreach (array_reverse($handlers) as $handler) { + $this->pushHandler($handler); + } + + return $this; + } + + /** + * @return HandlerInterface[] + */ + public function getHandlers() + { + return $this->handlers; + } + + /** + * Adds a processor on to the stack. + * + * @param callable $callback + * @return $this + */ + public function pushProcessor($callback) + { + if (!is_callable($callback)) { + throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given'); + } + array_unshift($this->processors, $callback); + + return $this; + } + + /** + * Removes the processor on top of the stack and returns it. + * + * @return callable + */ + public function popProcessor() + { + if (!$this->processors) { + throw new \LogicException('You tried to pop from an empty processor stack.'); + } + + return array_shift($this->processors); + } + + /** + * @return callable[] + */ + public function getProcessors() + { + return $this->processors; + } + + /** + * Control the use of microsecond resolution timestamps in the 'datetime' + * member of new records. + * + * Generating microsecond resolution timestamps by calling + * microtime(true), formatting the result via sprintf() and then parsing + * the resulting string via \DateTime::createFromFormat() can incur + * a measurable runtime overhead vs simple usage of DateTime to capture + * a second resolution timestamp in systems which generate a large number + * of log events. + * + * @param bool $micro True to use microtime() to create timestamps + */ + public function useMicrosecondTimestamps($micro) + { + $this->microsecondTimestamps = (bool) $micro; + } + + /** + * Adds a log record. + * + * @param int $level The logging level + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function addRecord($level, $message, array $context = array()) + { + if (!$this->handlers) { + $this->pushHandler(new StreamHandler('php://stderr', static::DEBUG)); + } + + $levelName = static::getLevelName($level); + + // check if any handler will handle this message so we can return early and save cycles + $handlerKey = null; + reset($this->handlers); + while ($handler = current($this->handlers)) { + if ($handler->isHandling(array('level' => $level))) { + $handlerKey = key($this->handlers); + break; + } + + next($this->handlers); + } + + if (null === $handlerKey) { + return false; + } + + if (!static::$timezone) { + static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC'); + } + + // php7.1+ always has microseconds enabled, so we do not need this hack + if ($this->microsecondTimestamps && PHP_VERSION_ID < 70100) { + $ts = \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone); + } else { + $ts = new \DateTime(null, static::$timezone); + } + $ts->setTimezone(static::$timezone); + + $record = array( + 'message' => (string) $message, + 'context' => $context, + 'level' => $level, + 'level_name' => $levelName, + 'channel' => $this->name, + 'datetime' => $ts, + 'extra' => array(), + ); + + try { + foreach ($this->processors as $processor) { + $record = call_user_func($processor, $record); + } + + while ($handler = current($this->handlers)) { + if (true === $handler->handle($record)) { + break; + } + + next($this->handlers); + } + } catch (Exception $e) { + $this->handleException($e, $record); + } + + return true; + } + + /** + * Ends a log cycle and frees all resources used by handlers. + * + * Closing a Handler means flushing all buffers and freeing any open resources/handles. + * Handlers that have been closed should be able to accept log records again and re-open + * themselves on demand, but this may not always be possible depending on implementation. + * + * This is useful at the end of a request and will be called automatically on every handler + * when they get destructed. + */ + public function close() + { + foreach ($this->handlers as $handler) { + if (method_exists($handler, 'close')) { + $handler->close(); + } + } + } + + /** + * Ends a log cycle and resets all handlers and processors to their initial state. + * + * Resetting a Handler or a Processor means flushing/cleaning all buffers, resetting internal + * state, and getting it back to a state in which it can receive log records again. + * + * This is useful in case you want to avoid logs leaking between two requests or jobs when you + * have a long running process like a worker or an application server serving multiple requests + * in one process. + */ + public function reset() + { + foreach ($this->handlers as $handler) { + if ($handler instanceof ResettableInterface) { + $handler->reset(); + } + } + + foreach ($this->processors as $processor) { + if ($processor instanceof ResettableInterface) { + $processor->reset(); + } + } + } + + /** + * Adds a log record at the DEBUG level. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function addDebug($message, array $context = array()) + { + return $this->addRecord(static::DEBUG, $message, $context); + } + + /** + * Adds a log record at the INFO level. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function addInfo($message, array $context = array()) + { + return $this->addRecord(static::INFO, $message, $context); + } + + /** + * Adds a log record at the NOTICE level. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function addNotice($message, array $context = array()) + { + return $this->addRecord(static::NOTICE, $message, $context); + } + + /** + * Adds a log record at the WARNING level. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function addWarning($message, array $context = array()) + { + return $this->addRecord(static::WARNING, $message, $context); + } + + /** + * Adds a log record at the ERROR level. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function addError($message, array $context = array()) + { + return $this->addRecord(static::ERROR, $message, $context); + } + + /** + * Adds a log record at the CRITICAL level. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function addCritical($message, array $context = array()) + { + return $this->addRecord(static::CRITICAL, $message, $context); + } + + /** + * Adds a log record at the ALERT level. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function addAlert($message, array $context = array()) + { + return $this->addRecord(static::ALERT, $message, $context); + } + + /** + * Adds a log record at the EMERGENCY level. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function addEmergency($message, array $context = array()) + { + return $this->addRecord(static::EMERGENCY, $message, $context); + } + + /** + * Gets all supported logging levels. + * + * @return array Assoc array with human-readable level names => level codes. + */ + public static function getLevels() + { + return array_flip(static::$levels); + } + + /** + * Gets the name of the logging level. + * + * @param int $level + * @return string + */ + public static function getLevelName($level) + { + if (!isset(static::$levels[$level])) { + throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels))); + } + + return static::$levels[$level]; + } + + /** + * Converts PSR-3 levels to Monolog ones if necessary + * + * @param string|int Level number (monolog) or name (PSR-3) + * @return int + */ + public static function toMonologLevel($level) + { + if (is_string($level) && defined(__CLASS__.'::'.strtoupper($level))) { + return constant(__CLASS__.'::'.strtoupper($level)); + } + + return $level; + } + + /** + * Checks whether the Logger has a handler that listens on the given level + * + * @param int $level + * @return bool + */ + public function isHandling($level) + { + $record = array( + 'level' => $level, + ); + + foreach ($this->handlers as $handler) { + if ($handler->isHandling($record)) { + return true; + } + } + + return false; + } + + /** + * Set a custom exception handler + * + * @param callable $callback + * @return $this + */ + public function setExceptionHandler($callback) + { + if (!is_callable($callback)) { + throw new \InvalidArgumentException('Exception handler must be valid callable (callback or object with an __invoke method), '.var_export($callback, true).' given'); + } + $this->exceptionHandler = $callback; + + return $this; + } + + /** + * @return callable + */ + public function getExceptionHandler() + { + return $this->exceptionHandler; + } + + /** + * Delegates exception management to the custom exception handler, + * or throws the exception if no custom handler is set. + */ + protected function handleException(Exception $e, array $record) + { + if (!$this->exceptionHandler) { + throw $e; + } + + call_user_func($this->exceptionHandler, $e, $record); + } + + /** + * Adds a log record at an arbitrary level. + * + * This method allows for compatibility with common interfaces. + * + * @param mixed $level The log level + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function log($level, $message, array $context = array()) + { + $level = static::toMonologLevel($level); + + return $this->addRecord($level, $message, $context); + } + + /** + * Adds a log record at the DEBUG level. + * + * This method allows for compatibility with common interfaces. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function debug($message, array $context = array()) + { + return $this->addRecord(static::DEBUG, $message, $context); + } + + /** + * Adds a log record at the INFO level. + * + * This method allows for compatibility with common interfaces. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function info($message, array $context = array()) + { + return $this->addRecord(static::INFO, $message, $context); + } + + /** + * Adds a log record at the NOTICE level. + * + * This method allows for compatibility with common interfaces. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function notice($message, array $context = array()) + { + return $this->addRecord(static::NOTICE, $message, $context); + } + + /** + * Adds a log record at the WARNING level. + * + * This method allows for compatibility with common interfaces. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function warn($message, array $context = array()) + { + return $this->addRecord(static::WARNING, $message, $context); + } + + /** + * Adds a log record at the WARNING level. + * + * This method allows for compatibility with common interfaces. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function warning($message, array $context = array()) + { + return $this->addRecord(static::WARNING, $message, $context); + } + + /** + * Adds a log record at the ERROR level. + * + * This method allows for compatibility with common interfaces. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function err($message, array $context = array()) + { + return $this->addRecord(static::ERROR, $message, $context); + } + + /** + * Adds a log record at the ERROR level. + * + * This method allows for compatibility with common interfaces. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function error($message, array $context = array()) + { + return $this->addRecord(static::ERROR, $message, $context); + } + + /** + * Adds a log record at the CRITICAL level. + * + * This method allows for compatibility with common interfaces. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function crit($message, array $context = array()) + { + return $this->addRecord(static::CRITICAL, $message, $context); + } + + /** + * Adds a log record at the CRITICAL level. + * + * This method allows for compatibility with common interfaces. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function critical($message, array $context = array()) + { + return $this->addRecord(static::CRITICAL, $message, $context); + } + + /** + * Adds a log record at the ALERT level. + * + * This method allows for compatibility with common interfaces. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function alert($message, array $context = array()) + { + return $this->addRecord(static::ALERT, $message, $context); + } + + /** + * Adds a log record at the EMERGENCY level. + * + * This method allows for compatibility with common interfaces. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function emerg($message, array $context = array()) + { + return $this->addRecord(static::EMERGENCY, $message, $context); + } + + /** + * Adds a log record at the EMERGENCY level. + * + * This method allows for compatibility with common interfaces. + * + * @param string $message The log message + * @param array $context The log context + * @return bool Whether the record has been processed + */ + public function emergency($message, array $context = array()) + { + return $this->addRecord(static::EMERGENCY, $message, $context); + } + + /** + * Set the timezone to be used for the timestamp of log records. + * + * This is stored globally for all Logger instances + * + * @param \DateTimeZone $tz Timezone object + */ + public static function setTimezone(\DateTimeZone $tz) + { + self::$timezone = $tz; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php new file mode 100644 index 0000000..9fc3f50 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\Logger; + +/** + * Injects Git branch and Git commit SHA in all records + * + * @author Nick Otter + * @author Jordi Boggiano + */ +class GitProcessor implements ProcessorInterface +{ + private $level; + private static $cache; + + public function __construct($level = Logger::DEBUG) + { + $this->level = Logger::toMonologLevel($level); + } + + /** + * @param array $record + * @return array + */ + public function __invoke(array $record) + { + // return if the level is not high enough + if ($record['level'] < $this->level) { + return $record; + } + + $record['extra']['git'] = self::getGitInfo(); + + return $record; + } + + private static function getGitInfo() + { + if (self::$cache) { + return self::$cache; + } + + $branches = `git branch -v --no-abbrev`; + if (preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) { + return self::$cache = array( + 'branch' => $matches[1], + 'commit' => $matches[2], + ); + } + + return self::$cache = array(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php new file mode 100644 index 0000000..6ae192a --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\Logger; + +/** + * Injects line/file:class/function where the log message came from + * + * Warning: This only works if the handler processes the logs directly. + * If you put the processor on a handler that is behind a FingersCrossedHandler + * for example, the processor will only be called once the trigger level is reached, + * and all the log records will have the same file/line/.. data from the call that + * triggered the FingersCrossedHandler. + * + * @author Jordi Boggiano + */ +class IntrospectionProcessor implements ProcessorInterface +{ + private $level; + + private $skipClassesPartials; + + private $skipStackFramesCount; + + private $skipFunctions = array( + 'call_user_func', + 'call_user_func_array', + ); + + public function __construct($level = Logger::DEBUG, array $skipClassesPartials = array(), $skipStackFramesCount = 0) + { + $this->level = Logger::toMonologLevel($level); + $this->skipClassesPartials = array_merge(array('Monolog\\'), $skipClassesPartials); + $this->skipStackFramesCount = $skipStackFramesCount; + } + + /** + * @param array $record + * @return array + */ + public function __invoke(array $record) + { + // return if the level is not high enough + if ($record['level'] < $this->level) { + return $record; + } + + /* + * http://php.net/manual/en/function.debug-backtrace.php + * As of 5.3.6, DEBUG_BACKTRACE_IGNORE_ARGS option was added. + * Any version less than 5.3.6 must use the DEBUG_BACKTRACE_IGNORE_ARGS constant value '2'. + */ + $trace = debug_backtrace((PHP_VERSION_ID < 50306) ? 2 : DEBUG_BACKTRACE_IGNORE_ARGS); + + // skip first since it's always the current method + array_shift($trace); + // the call_user_func call is also skipped + array_shift($trace); + + $i = 0; + + while ($this->isTraceClassOrSkippedFunction($trace, $i)) { + if (isset($trace[$i]['class'])) { + foreach ($this->skipClassesPartials as $part) { + if (strpos($trace[$i]['class'], $part) !== false) { + $i++; + continue 2; + } + } + } elseif (in_array($trace[$i]['function'], $this->skipFunctions)) { + $i++; + continue; + } + + break; + } + + $i += $this->skipStackFramesCount; + + // we should have the call source now + $record['extra'] = array_merge( + $record['extra'], + array( + 'file' => isset($trace[$i - 1]['file']) ? $trace[$i - 1]['file'] : null, + 'line' => isset($trace[$i - 1]['line']) ? $trace[$i - 1]['line'] : null, + 'class' => isset($trace[$i]['class']) ? $trace[$i]['class'] : null, + 'function' => isset($trace[$i]['function']) ? $trace[$i]['function'] : null, + ) + ); + + return $record; + } + + private function isTraceClassOrSkippedFunction(array $trace, $index) + { + if (!isset($trace[$index])) { + return false; + } + + return isset($trace[$index]['class']) || in_array($trace[$index]['function'], $this->skipFunctions); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php new file mode 100644 index 0000000..0543e92 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * Injects memory_get_peak_usage in all records + * + * @see Monolog\Processor\MemoryProcessor::__construct() for options + * @author Rob Jensen + */ +class MemoryPeakUsageProcessor extends MemoryProcessor +{ + /** + * @param array $record + * @return array + */ + public function __invoke(array $record) + { + $bytes = memory_get_peak_usage($this->realUsage); + $formatted = $this->formatBytes($bytes); + + $record['extra']['memory_peak_usage'] = $formatted; + + return $record; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php new file mode 100644 index 0000000..2a379a3 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * Some methods that are common for all memory processors + * + * @author Rob Jensen + */ +abstract class MemoryProcessor implements ProcessorInterface +{ + /** + * @var bool If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported. + */ + protected $realUsage; + + /** + * @var bool If true, then format memory size to human readable string (MB, KB, B depending on size) + */ + protected $useFormatting; + + /** + * @param bool $realUsage Set this to true to get the real size of memory allocated from system. + * @param bool $useFormatting If true, then format memory size to human readable string (MB, KB, B depending on size) + */ + public function __construct($realUsage = true, $useFormatting = true) + { + $this->realUsage = (bool) $realUsage; + $this->useFormatting = (bool) $useFormatting; + } + + /** + * Formats bytes into a human readable string if $this->useFormatting is true, otherwise return $bytes as is + * + * @param int $bytes + * @return string|int Formatted string if $this->useFormatting is true, otherwise return $bytes as is + */ + protected function formatBytes($bytes) + { + $bytes = (int) $bytes; + + if (!$this->useFormatting) { + return $bytes; + } + + if ($bytes > 1024 * 1024) { + return round($bytes / 1024 / 1024, 2).' MB'; + } elseif ($bytes > 1024) { + return round($bytes / 1024, 2).' KB'; + } + + return $bytes . ' B'; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php new file mode 100644 index 0000000..2783d65 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * Injects memory_get_usage in all records + * + * @see Monolog\Processor\MemoryProcessor::__construct() for options + * @author Rob Jensen + */ +class MemoryUsageProcessor extends MemoryProcessor +{ + /** + * @param array $record + * @return array + */ + public function __invoke(array $record) + { + $bytes = memory_get_usage($this->realUsage); + $formatted = $this->formatBytes($bytes); + + $record['extra']['memory_usage'] = $formatted; + + return $record; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php new file mode 100644 index 0000000..2f5b326 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\Logger; + +/** + * Injects Hg branch and Hg revision number in all records + * + * @author Jonathan A. Schweder + */ +class MercurialProcessor implements ProcessorInterface +{ + private $level; + private static $cache; + + public function __construct($level = Logger::DEBUG) + { + $this->level = Logger::toMonologLevel($level); + } + + /** + * @param array $record + * @return array + */ + public function __invoke(array $record) + { + // return if the level is not high enough + if ($record['level'] < $this->level) { + return $record; + } + + $record['extra']['hg'] = self::getMercurialInfo(); + + return $record; + } + + private static function getMercurialInfo() + { + if (self::$cache) { + return self::$cache; + } + + $result = explode(' ', trim(`hg id -nb`)); + if (count($result) >= 3) { + return self::$cache = array( + 'branch' => $result[1], + 'revision' => $result[2], + ); + } + + return self::$cache = array(); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php new file mode 100644 index 0000000..66b80fb --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * Adds value of getmypid into records + * + * @author Andreas Hörnicke + */ +class ProcessIdProcessor implements ProcessorInterface +{ + /** + * @param array $record + * @return array + */ + public function __invoke(array $record) + { + $record['extra']['process_id'] = getmypid(); + + return $record; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php b/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php new file mode 100644 index 0000000..7e64d4d --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * An optional interface to allow labelling Monolog processors. + * + * @author Nicolas Grekas + */ +interface ProcessorInterface +{ + /** + * @return array The processed records + */ + public function __invoke(array $records); +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php new file mode 100644 index 0000000..0088505 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\Utils; + +/** + * Processes a record's message according to PSR-3 rules + * + * It replaces {foo} with the value from $context['foo'] + * + * @author Jordi Boggiano + */ +class PsrLogMessageProcessor implements ProcessorInterface +{ + /** + * @param array $record + * @return array + */ + public function __invoke(array $record) + { + if (false === strpos($record['message'], '{')) { + return $record; + } + + $replacements = array(); + foreach ($record['context'] as $key => $val) { + if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) { + $replacements['{'.$key.'}'] = $val; + } elseif (is_object($val)) { + $replacements['{'.$key.'}'] = '[object '.Utils::getClass($val).']'; + } else { + $replacements['{'.$key.'}'] = '['.gettype($val).']'; + } + } + + $record['message'] = strtr($record['message'], $replacements); + + return $record; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php new file mode 100644 index 0000000..615a4d9 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * Adds a tags array into record + * + * @author Martijn Riemers + */ +class TagProcessor implements ProcessorInterface +{ + private $tags; + + public function __construct(array $tags = array()) + { + $this->setTags($tags); + } + + public function addTags(array $tags = array()) + { + $this->tags = array_merge($this->tags, $tags); + } + + public function setTags(array $tags = array()) + { + $this->tags = $tags; + } + + public function __invoke(array $record) + { + $record['extra']['tags'] = $this->tags; + + return $record; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php new file mode 100644 index 0000000..d1f708c --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\ResettableInterface; + +/** + * Adds a unique identifier into records + * + * @author Simon Mönch + */ +class UidProcessor implements ProcessorInterface, ResettableInterface +{ + private $uid; + + public function __construct($length = 7) + { + if (!is_int($length) || $length > 32 || $length < 1) { + throw new \InvalidArgumentException('The uid length must be an integer between 1 and 32'); + } + + + $this->uid = $this->generateUid($length); + } + + public function __invoke(array $record) + { + $record['extra']['uid'] = $this->uid; + + return $record; + } + + /** + * @return string + */ + public function getUid() + { + return $this->uid; + } + + public function reset() + { + $this->uid = $this->generateUid(strlen($this->uid)); + } + + private function generateUid($length) + { + return substr(hash('md5', uniqid('', true)), 0, $length); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php new file mode 100644 index 0000000..684188f --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php @@ -0,0 +1,113 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +/** + * Injects url/method and remote IP of the current web request in all records + * + * @author Jordi Boggiano + */ +class WebProcessor implements ProcessorInterface +{ + /** + * @var array|\ArrayAccess + */ + protected $serverData; + + /** + * Default fields + * + * Array is structured as [key in record.extra => key in $serverData] + * + * @var array + */ + protected $extraFields = array( + 'url' => 'REQUEST_URI', + 'ip' => 'REMOTE_ADDR', + 'http_method' => 'REQUEST_METHOD', + 'server' => 'SERVER_NAME', + 'referrer' => 'HTTP_REFERER', + ); + + /** + * @param array|\ArrayAccess $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data + * @param array|null $extraFields Field names and the related key inside $serverData to be added. If not provided it defaults to: url, ip, http_method, server, referrer + */ + public function __construct($serverData = null, array $extraFields = null) + { + if (null === $serverData) { + $this->serverData = &$_SERVER; + } elseif (is_array($serverData) || $serverData instanceof \ArrayAccess) { + $this->serverData = $serverData; + } else { + throw new \UnexpectedValueException('$serverData must be an array or object implementing ArrayAccess.'); + } + + if (null !== $extraFields) { + if (isset($extraFields[0])) { + foreach (array_keys($this->extraFields) as $fieldName) { + if (!in_array($fieldName, $extraFields)) { + unset($this->extraFields[$fieldName]); + } + } + } else { + $this->extraFields = $extraFields; + } + } + } + + /** + * @param array $record + * @return array + */ + public function __invoke(array $record) + { + // skip processing if for some reason request data + // is not present (CLI or wonky SAPIs) + if (!isset($this->serverData['REQUEST_URI'])) { + return $record; + } + + $record['extra'] = $this->appendExtraFields($record['extra']); + + return $record; + } + + /** + * @param string $extraName + * @param string $serverName + * @return $this + */ + public function addExtraField($extraName, $serverName) + { + $this->extraFields[$extraName] = $serverName; + + return $this; + } + + /** + * @param array $extra + * @return array + */ + private function appendExtraFields(array $extra) + { + foreach ($this->extraFields as $extraName => $serverName) { + $extra[$extraName] = isset($this->serverData[$serverName]) ? $this->serverData[$serverName] : null; + } + + if (isset($this->serverData['UNIQUE_ID'])) { + $extra['unique_id'] = $this->serverData['UNIQUE_ID']; + } + + return $extra; + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Registry.php b/vendor/monolog/monolog/src/Monolog/Registry.php new file mode 100644 index 0000000..159b751 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Registry.php @@ -0,0 +1,134 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use InvalidArgumentException; + +/** + * Monolog log registry + * + * Allows to get `Logger` instances in the global scope + * via static method calls on this class. + * + * + * $application = new Monolog\Logger('application'); + * $api = new Monolog\Logger('api'); + * + * Monolog\Registry::addLogger($application); + * Monolog\Registry::addLogger($api); + * + * function testLogger() + * { + * Monolog\Registry::api()->addError('Sent to $api Logger instance'); + * Monolog\Registry::application()->addError('Sent to $application Logger instance'); + * } + * + * + * @author Tomas Tatarko + */ +class Registry +{ + /** + * List of all loggers in the registry (by named indexes) + * + * @var Logger[] + */ + private static $loggers = array(); + + /** + * Adds new logging channel to the registry + * + * @param Logger $logger Instance of the logging channel + * @param string|null $name Name of the logging channel ($logger->getName() by default) + * @param bool $overwrite Overwrite instance in the registry if the given name already exists? + * @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists + */ + public static function addLogger(Logger $logger, $name = null, $overwrite = false) + { + $name = $name ?: $logger->getName(); + + if (isset(self::$loggers[$name]) && !$overwrite) { + throw new InvalidArgumentException('Logger with the given name already exists'); + } + + self::$loggers[$name] = $logger; + } + + /** + * Checks if such logging channel exists by name or instance + * + * @param string|Logger $logger Name or logger instance + */ + public static function hasLogger($logger) + { + if ($logger instanceof Logger) { + $index = array_search($logger, self::$loggers, true); + + return false !== $index; + } else { + return isset(self::$loggers[$logger]); + } + } + + /** + * Removes instance from registry by name or instance + * + * @param string|Logger $logger Name or logger instance + */ + public static function removeLogger($logger) + { + if ($logger instanceof Logger) { + if (false !== ($idx = array_search($logger, self::$loggers, true))) { + unset(self::$loggers[$idx]); + } + } else { + unset(self::$loggers[$logger]); + } + } + + /** + * Clears the registry + */ + public static function clear() + { + self::$loggers = array(); + } + + /** + * Gets Logger instance from the registry + * + * @param string $name Name of the requested Logger instance + * @throws \InvalidArgumentException If named Logger instance is not in the registry + * @return Logger Requested instance of Logger + */ + public static function getInstance($name) + { + if (!isset(self::$loggers[$name])) { + throw new InvalidArgumentException(sprintf('Requested "%s" logger instance is not in the registry', $name)); + } + + return self::$loggers[$name]; + } + + /** + * Gets Logger instance from the registry via static method call + * + * @param string $name Name of the requested Logger instance + * @param array $arguments Arguments passed to static method call + * @throws \InvalidArgumentException If named Logger instance is not in the registry + * @return Logger Requested instance of Logger + */ + public static function __callStatic($name, $arguments) + { + return self::getInstance($name); + } +} diff --git a/vendor/monolog/monolog/src/Monolog/ResettableInterface.php b/vendor/monolog/monolog/src/Monolog/ResettableInterface.php new file mode 100644 index 0000000..635bc77 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/ResettableInterface.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +/** + * Handler or Processor implementing this interface will be reset when Logger::reset() is called. + * + * Resetting ends a log cycle gets them back to their initial state. + * + * Resetting a Handler or a Processor means flushing/cleaning all buffers, resetting internal + * state, and getting it back to a state in which it can receive log records again. + * + * This is useful in case you want to avoid logs leaking between two requests or jobs when you + * have a long running process like a worker or an application server serving multiple requests + * in one process. + * + * @author Grégoire Pineau + */ +interface ResettableInterface +{ + public function reset(); +} diff --git a/vendor/monolog/monolog/src/Monolog/SignalHandler.php b/vendor/monolog/monolog/src/Monolog/SignalHandler.php new file mode 100644 index 0000000..d590780 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/SignalHandler.php @@ -0,0 +1,115 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use Psr\Log\LoggerInterface; +use Psr\Log\LogLevel; +use ReflectionExtension; + +/** + * Monolog POSIX signal handler + * + * @author Robert Gust-Bardon + */ +class SignalHandler +{ + private $logger; + + private $previousSignalHandler = array(); + private $signalLevelMap = array(); + private $signalRestartSyscalls = array(); + + public function __construct(LoggerInterface $logger) + { + $this->logger = $logger; + } + + public function registerSignalHandler($signo, $level = LogLevel::CRITICAL, $callPrevious = true, $restartSyscalls = true, $async = true) + { + if (!extension_loaded('pcntl') || !function_exists('pcntl_signal')) { + return $this; + } + + if ($callPrevious) { + if (function_exists('pcntl_signal_get_handler')) { + $handler = pcntl_signal_get_handler($signo); + if ($handler === false) { + return $this; + } + $this->previousSignalHandler[$signo] = $handler; + } else { + $this->previousSignalHandler[$signo] = true; + } + } else { + unset($this->previousSignalHandler[$signo]); + } + $this->signalLevelMap[$signo] = $level; + $this->signalRestartSyscalls[$signo] = $restartSyscalls; + + if (function_exists('pcntl_async_signals') && $async !== null) { + pcntl_async_signals($async); + } + + pcntl_signal($signo, array($this, 'handleSignal'), $restartSyscalls); + + return $this; + } + + public function handleSignal($signo, array $siginfo = null) + { + static $signals = array(); + + if (!$signals && extension_loaded('pcntl')) { + $pcntl = new ReflectionExtension('pcntl'); + $constants = $pcntl->getConstants(); + if (!$constants) { + // HHVM 3.24.2 returns an empty array. + $constants = get_defined_constants(true); + $constants = $constants['Core']; + } + foreach ($constants as $name => $value) { + if (substr($name, 0, 3) === 'SIG' && $name[3] !== '_' && is_int($value)) { + $signals[$value] = $name; + } + } + unset($constants); + } + + $level = isset($this->signalLevelMap[$signo]) ? $this->signalLevelMap[$signo] : LogLevel::CRITICAL; + $signal = isset($signals[$signo]) ? $signals[$signo] : $signo; + $context = isset($siginfo) ? $siginfo : array(); + $this->logger->log($level, sprintf('Program received signal %s', $signal), $context); + + if (!isset($this->previousSignalHandler[$signo])) { + return; + } + + if ($this->previousSignalHandler[$signo] === true || $this->previousSignalHandler[$signo] === SIG_DFL) { + if (extension_loaded('pcntl') && function_exists('pcntl_signal') && function_exists('pcntl_sigprocmask') && function_exists('pcntl_signal_dispatch') + && extension_loaded('posix') && function_exists('posix_getpid') && function_exists('posix_kill')) { + $restartSyscalls = isset($this->restartSyscalls[$signo]) ? $this->restartSyscalls[$signo] : true; + pcntl_signal($signo, SIG_DFL, $restartSyscalls); + pcntl_sigprocmask(SIG_UNBLOCK, array($signo), $oldset); + posix_kill(posix_getpid(), $signo); + pcntl_signal_dispatch(); + pcntl_sigprocmask(SIG_SETMASK, $oldset); + pcntl_signal($signo, array($this, 'handleSignal'), $restartSyscalls); + } + } elseif (is_callable($this->previousSignalHandler[$signo])) { + if (PHP_VERSION_ID >= 70100) { + $this->previousSignalHandler[$signo]($signo, $siginfo); + } else { + $this->previousSignalHandler[$signo]($signo); + } + } + } +} diff --git a/vendor/monolog/monolog/src/Monolog/Utils.php b/vendor/monolog/monolog/src/Monolog/Utils.php new file mode 100644 index 0000000..eb9be86 --- /dev/null +++ b/vendor/monolog/monolog/src/Monolog/Utils.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +class Utils +{ + /** + * @internal + */ + public static function getClass($object) + { + $class = \get_class($object); + + return 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).'@anonymous' : $class; + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/ErrorHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/ErrorHandlerTest.php new file mode 100644 index 0000000..a9a3f30 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/ErrorHandlerTest.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use Monolog\Handler\TestHandler; + +class ErrorHandlerTest extends \PHPUnit_Framework_TestCase +{ + public function testHandleError() + { + $logger = new Logger('test', array($handler = new TestHandler)); + $errHandler = new ErrorHandler($logger); + + $errHandler->registerErrorHandler(array(E_USER_NOTICE => Logger::EMERGENCY), false); + trigger_error('Foo', E_USER_ERROR); + $this->assertCount(1, $handler->getRecords()); + $this->assertTrue($handler->hasErrorRecords()); + trigger_error('Foo', E_USER_NOTICE); + $this->assertCount(2, $handler->getRecords()); + $this->assertTrue($handler->hasEmergencyRecords()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php new file mode 100644 index 0000000..71c4204 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php @@ -0,0 +1,158 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; + +class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Monolog\Formatter\ChromePHPFormatter::format + */ + public function testDefaultFormat() + { + $formatter = new ChromePHPFormatter(); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('from' => 'logger'), + 'datetime' => new \DateTime("@0"), + 'extra' => array('ip' => '127.0.0.1'), + 'message' => 'log', + ); + + $message = $formatter->format($record); + + $this->assertEquals( + array( + 'meh', + array( + 'message' => 'log', + 'context' => array('from' => 'logger'), + 'extra' => array('ip' => '127.0.0.1'), + ), + 'unknown', + 'error', + ), + $message + ); + } + + /** + * @covers Monolog\Formatter\ChromePHPFormatter::format + */ + public function testFormatWithFileAndLine() + { + $formatter = new ChromePHPFormatter(); + $record = array( + 'level' => Logger::CRITICAL, + 'level_name' => 'CRITICAL', + 'channel' => 'meh', + 'context' => array('from' => 'logger'), + 'datetime' => new \DateTime("@0"), + 'extra' => array('ip' => '127.0.0.1', 'file' => 'test', 'line' => 14), + 'message' => 'log', + ); + + $message = $formatter->format($record); + + $this->assertEquals( + array( + 'meh', + array( + 'message' => 'log', + 'context' => array('from' => 'logger'), + 'extra' => array('ip' => '127.0.0.1'), + ), + 'test : 14', + 'error', + ), + $message + ); + } + + /** + * @covers Monolog\Formatter\ChromePHPFormatter::format + */ + public function testFormatWithoutContext() + { + $formatter = new ChromePHPFormatter(); + $record = array( + 'level' => Logger::DEBUG, + 'level_name' => 'DEBUG', + 'channel' => 'meh', + 'context' => array(), + 'datetime' => new \DateTime("@0"), + 'extra' => array(), + 'message' => 'log', + ); + + $message = $formatter->format($record); + + $this->assertEquals( + array( + 'meh', + 'log', + 'unknown', + 'log', + ), + $message + ); + } + + /** + * @covers Monolog\Formatter\ChromePHPFormatter::formatBatch + */ + public function testBatchFormatThrowException() + { + $formatter = new ChromePHPFormatter(); + $records = array( + array( + 'level' => Logger::INFO, + 'level_name' => 'INFO', + 'channel' => 'meh', + 'context' => array(), + 'datetime' => new \DateTime("@0"), + 'extra' => array(), + 'message' => 'log', + ), + array( + 'level' => Logger::WARNING, + 'level_name' => 'WARNING', + 'channel' => 'foo', + 'context' => array(), + 'datetime' => new \DateTime("@0"), + 'extra' => array(), + 'message' => 'log2', + ), + ); + + $this->assertEquals( + array( + array( + 'meh', + 'log', + 'unknown', + 'info', + ), + array( + 'foo', + 'log2', + 'unknown', + 'warn', + ), + ), + $formatter->formatBatch($records) + ); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php new file mode 100644 index 0000000..90cc48d --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; + +class ElasticaFormatterTest extends \PHPUnit_Framework_TestCase +{ + public function setUp() + { + if (!class_exists("Elastica\Document")) { + $this->markTestSkipped("ruflin/elastica not installed"); + } + } + + /** + * @covers Monolog\Formatter\ElasticaFormatter::__construct + * @covers Monolog\Formatter\ElasticaFormatter::format + * @covers Monolog\Formatter\ElasticaFormatter::getDocument + */ + public function testFormat() + { + // test log message + $msg = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('foo' => 7, 'bar', 'class' => new \stdClass), + 'datetime' => new \DateTime("@0"), + 'extra' => array(), + 'message' => 'log', + ); + + // expected values + $expected = $msg; + $expected['datetime'] = '1970-01-01T00:00:00.000000+00:00'; + $expected['context'] = array( + 'class' => '[object] (stdClass: {})', + 'foo' => 7, + 0 => 'bar', + ); + + // format log message + $formatter = new ElasticaFormatter('my_index', 'doc_type'); + $doc = $formatter->format($msg); + $this->assertInstanceOf('Elastica\Document', $doc); + + // Document parameters + $params = $doc->getParams(); + $this->assertEquals('my_index', $params['_index']); + $this->assertEquals('doc_type', $params['_type']); + + // Document data values + $data = $doc->getData(); + foreach (array_keys($expected) as $key) { + $this->assertEquals($expected[$key], $data[$key]); + } + } + + /** + * @covers Monolog\Formatter\ElasticaFormatter::getIndex + * @covers Monolog\Formatter\ElasticaFormatter::getType + */ + public function testGetters() + { + $formatter = new ElasticaFormatter('my_index', 'doc_type'); + $this->assertEquals('my_index', $formatter->getIndex()); + $this->assertEquals('doc_type', $formatter->getType()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/FlowdockFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/FlowdockFormatterTest.php new file mode 100644 index 0000000..1b2fd97 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Formatter/FlowdockFormatterTest.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; +use Monolog\TestCase; + +class FlowdockFormatterTest extends TestCase +{ + /** + * @covers Monolog\Formatter\FlowdockFormatter::format + */ + public function testFormat() + { + $formatter = new FlowdockFormatter('test_source', 'source@test.com'); + $record = $this->getRecord(); + + $expected = array( + 'source' => 'test_source', + 'from_address' => 'source@test.com', + 'subject' => 'in test_source: WARNING - test', + 'content' => 'test', + 'tags' => array('#logs', '#warning', '#test'), + 'project' => 'test_source', + ); + $formatted = $formatter->format($record); + + $this->assertEquals($expected, $formatted['flowdock']); + } + + /** + * @ covers Monolog\Formatter\FlowdockFormatter::formatBatch + */ + public function testFormatBatch() + { + $formatter = new FlowdockFormatter('test_source', 'source@test.com'); + $records = array( + $this->getRecord(Logger::WARNING), + $this->getRecord(Logger::DEBUG), + ); + $formatted = $formatter->formatBatch($records); + + $this->assertArrayHasKey('flowdock', $formatted[0]); + $this->assertArrayHasKey('flowdock', $formatted[1]); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/FluentdFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/FluentdFormatterTest.php new file mode 100644 index 0000000..fd36dbc --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Formatter/FluentdFormatterTest.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; +use Monolog\TestCase; + +class FluentdFormatterTest extends TestCase +{ + /** + * @covers Monolog\Formatter\FluentdFormatter::__construct + * @covers Monolog\Formatter\FluentdFormatter::isUsingLevelsInTag + */ + public function testConstruct() + { + $formatter = new FluentdFormatter(); + $this->assertEquals(false, $formatter->isUsingLevelsInTag()); + $formatter = new FluentdFormatter(false); + $this->assertEquals(false, $formatter->isUsingLevelsInTag()); + $formatter = new FluentdFormatter(true); + $this->assertEquals(true, $formatter->isUsingLevelsInTag()); + } + + /** + * @covers Monolog\Formatter\FluentdFormatter::format + */ + public function testFormat() + { + $record = $this->getRecord(Logger::WARNING); + $record['datetime'] = new \DateTime("@0"); + + $formatter = new FluentdFormatter(); + $this->assertEquals( + '["test",0,{"message":"test","context":[],"extra":[],"level":300,"level_name":"WARNING"}]', + $formatter->format($record) + ); + } + + /** + * @covers Monolog\Formatter\FluentdFormatter::format + */ + public function testFormatWithTag() + { + $record = $this->getRecord(Logger::ERROR); + $record['datetime'] = new \DateTime("@0"); + + $formatter = new FluentdFormatter(true); + $this->assertEquals( + '["test.error",0,{"message":"test","context":[],"extra":[]}]', + $formatter->format($record) + ); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php new file mode 100644 index 0000000..4a24761 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php @@ -0,0 +1,258 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; + +class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase +{ + public function setUp() + { + if (!class_exists('\Gelf\Message')) { + $this->markTestSkipped("graylog2/gelf-php or mlehner/gelf-php is not installed"); + } + } + + /** + * @covers Monolog\Formatter\GelfMessageFormatter::format + */ + public function testDefaultFormatter() + { + $formatter = new GelfMessageFormatter(); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array(), + 'datetime' => new \DateTime("@0"), + 'extra' => array(), + 'message' => 'log', + ); + + $message = $formatter->format($record); + + $this->assertInstanceOf('Gelf\Message', $message); + $this->assertEquals(0, $message->getTimestamp()); + $this->assertEquals('log', $message->getShortMessage()); + $this->assertEquals('meh', $message->getFacility()); + $this->assertEquals(null, $message->getLine()); + $this->assertEquals(null, $message->getFile()); + $this->assertEquals($this->isLegacy() ? 3 : 'error', $message->getLevel()); + $this->assertNotEmpty($message->getHost()); + + $formatter = new GelfMessageFormatter('mysystem'); + + $message = $formatter->format($record); + + $this->assertInstanceOf('Gelf\Message', $message); + $this->assertEquals('mysystem', $message->getHost()); + } + + /** + * @covers Monolog\Formatter\GelfMessageFormatter::format + */ + public function testFormatWithFileAndLine() + { + $formatter = new GelfMessageFormatter(); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('from' => 'logger'), + 'datetime' => new \DateTime("@0"), + 'extra' => array('file' => 'test', 'line' => 14), + 'message' => 'log', + ); + + $message = $formatter->format($record); + + $this->assertInstanceOf('Gelf\Message', $message); + $this->assertEquals('test', $message->getFile()); + $this->assertEquals(14, $message->getLine()); + } + + /** + * @covers Monolog\Formatter\GelfMessageFormatter::format + * @expectedException InvalidArgumentException + */ + public function testFormatInvalidFails() + { + $formatter = new GelfMessageFormatter(); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + ); + + $formatter->format($record); + } + + /** + * @covers Monolog\Formatter\GelfMessageFormatter::format + */ + public function testFormatWithContext() + { + $formatter = new GelfMessageFormatter(); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('from' => 'logger'), + 'datetime' => new \DateTime("@0"), + 'extra' => array('key' => 'pair'), + 'message' => 'log', + ); + + $message = $formatter->format($record); + + $this->assertInstanceOf('Gelf\Message', $message); + + $message_array = $message->toArray(); + + $this->assertArrayHasKey('_ctxt_from', $message_array); + $this->assertEquals('logger', $message_array['_ctxt_from']); + + // Test with extraPrefix + $formatter = new GelfMessageFormatter(null, null, 'CTX'); + $message = $formatter->format($record); + + $this->assertInstanceOf('Gelf\Message', $message); + + $message_array = $message->toArray(); + + $this->assertArrayHasKey('_CTXfrom', $message_array); + $this->assertEquals('logger', $message_array['_CTXfrom']); + } + + /** + * @covers Monolog\Formatter\GelfMessageFormatter::format + */ + public function testFormatWithContextContainingException() + { + $formatter = new GelfMessageFormatter(); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('from' => 'logger', 'exception' => array( + 'class' => '\Exception', + 'file' => '/some/file/in/dir.php:56', + 'trace' => array('/some/file/1.php:23', '/some/file/2.php:3'), + )), + 'datetime' => new \DateTime("@0"), + 'extra' => array(), + 'message' => 'log', + ); + + $message = $formatter->format($record); + + $this->assertInstanceOf('Gelf\Message', $message); + + $this->assertEquals("/some/file/in/dir.php", $message->getFile()); + $this->assertEquals("56", $message->getLine()); + } + + /** + * @covers Monolog\Formatter\GelfMessageFormatter::format + */ + public function testFormatWithExtra() + { + $formatter = new GelfMessageFormatter(); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('from' => 'logger'), + 'datetime' => new \DateTime("@0"), + 'extra' => array('key' => 'pair'), + 'message' => 'log', + ); + + $message = $formatter->format($record); + + $this->assertInstanceOf('Gelf\Message', $message); + + $message_array = $message->toArray(); + + $this->assertArrayHasKey('_key', $message_array); + $this->assertEquals('pair', $message_array['_key']); + + // Test with extraPrefix + $formatter = new GelfMessageFormatter(null, 'EXT'); + $message = $formatter->format($record); + + $this->assertInstanceOf('Gelf\Message', $message); + + $message_array = $message->toArray(); + + $this->assertArrayHasKey('_EXTkey', $message_array); + $this->assertEquals('pair', $message_array['_EXTkey']); + } + + public function testFormatWithLargeData() + { + $formatter = new GelfMessageFormatter(); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('exception' => str_repeat(' ', 32767)), + 'datetime' => new \DateTime("@0"), + 'extra' => array('key' => str_repeat(' ', 32767)), + 'message' => 'log' + ); + $message = $formatter->format($record); + $messageArray = $message->toArray(); + + // 200 for padding + metadata + $length = 200; + + foreach ($messageArray as $key => $value) { + if (!in_array($key, array('level', 'timestamp'))) { + $length += strlen($value); + } + } + + $this->assertLessThanOrEqual(65792, $length, 'The message length is no longer than the maximum allowed length'); + } + + public function testFormatWithUnlimitedLength() + { + $formatter = new GelfMessageFormatter('LONG_SYSTEM_NAME', null, 'ctxt_', PHP_INT_MAX); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('exception' => str_repeat(' ', 32767 * 2)), + 'datetime' => new \DateTime("@0"), + 'extra' => array('key' => str_repeat(' ', 32767 * 2)), + 'message' => 'log' + ); + $message = $formatter->format($record); + $messageArray = $message->toArray(); + + // 200 for padding + metadata + $length = 200; + + foreach ($messageArray as $key => $value) { + if (!in_array($key, array('level', 'timestamp'))) { + $length += strlen($value); + } + } + + $this->assertGreaterThanOrEqual(131289, $length, 'The message should not be truncated'); + } + + private function isLegacy() + { + return interface_exists('\Gelf\IMessagePublisher'); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php new file mode 100644 index 0000000..24b06cc --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php @@ -0,0 +1,219 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; +use Monolog\TestCase; + +class JsonFormatterTest extends TestCase +{ + /** + * @covers Monolog\Formatter\JsonFormatter::__construct + * @covers Monolog\Formatter\JsonFormatter::getBatchMode + * @covers Monolog\Formatter\JsonFormatter::isAppendingNewlines + */ + public function testConstruct() + { + $formatter = new JsonFormatter(); + $this->assertEquals(JsonFormatter::BATCH_MODE_JSON, $formatter->getBatchMode()); + $this->assertEquals(true, $formatter->isAppendingNewlines()); + $formatter = new JsonFormatter(JsonFormatter::BATCH_MODE_NEWLINES, false); + $this->assertEquals(JsonFormatter::BATCH_MODE_NEWLINES, $formatter->getBatchMode()); + $this->assertEquals(false, $formatter->isAppendingNewlines()); + } + + /** + * @covers Monolog\Formatter\JsonFormatter::format + */ + public function testFormat() + { + $formatter = new JsonFormatter(); + $record = $this->getRecord(); + $this->assertEquals(json_encode($record)."\n", $formatter->format($record)); + + $formatter = new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false); + $record = $this->getRecord(); + $this->assertEquals(json_encode($record), $formatter->format($record)); + } + + /** + * @covers Monolog\Formatter\JsonFormatter::formatBatch + * @covers Monolog\Formatter\JsonFormatter::formatBatchJson + */ + public function testFormatBatch() + { + $formatter = new JsonFormatter(); + $records = array( + $this->getRecord(Logger::WARNING), + $this->getRecord(Logger::DEBUG), + ); + $this->assertEquals(json_encode($records), $formatter->formatBatch($records)); + } + + /** + * @covers Monolog\Formatter\JsonFormatter::formatBatch + * @covers Monolog\Formatter\JsonFormatter::formatBatchNewlines + */ + public function testFormatBatchNewlines() + { + $formatter = new JsonFormatter(JsonFormatter::BATCH_MODE_NEWLINES); + $records = $expected = array( + $this->getRecord(Logger::WARNING), + $this->getRecord(Logger::DEBUG), + ); + array_walk($expected, function (&$value, $key) { + $value = json_encode($value); + }); + $this->assertEquals(implode("\n", $expected), $formatter->formatBatch($records)); + } + + public function testDefFormatWithException() + { + $formatter = new JsonFormatter(); + $exception = new \RuntimeException('Foo'); + $formattedException = $this->formatException($exception); + + $message = $this->formatRecordWithExceptionInContext($formatter, $exception); + + $this->assertContextContainsFormattedException($formattedException, $message); + } + + public function testDefFormatWithPreviousException() + { + $formatter = new JsonFormatter(); + $exception = new \RuntimeException('Foo', 0, new \LogicException('Wut?')); + $formattedPrevException = $this->formatException($exception->getPrevious()); + $formattedException = $this->formatException($exception, $formattedPrevException); + + $message = $this->formatRecordWithExceptionInContext($formatter, $exception); + + $this->assertContextContainsFormattedException($formattedException, $message); + } + + public function testDefFormatWithThrowable() + { + if (!class_exists('Error') || !is_subclass_of('Error', 'Throwable')) { + $this->markTestSkipped('Requires PHP >=7'); + } + + $formatter = new JsonFormatter(); + $throwable = new \Error('Foo'); + $formattedThrowable = $this->formatException($throwable); + + $message = $this->formatRecordWithExceptionInContext($formatter, $throwable); + + $this->assertContextContainsFormattedException($formattedThrowable, $message); + } + + /** + * @param string $expected + * @param string $actual + * + * @internal param string $exception + */ + private function assertContextContainsFormattedException($expected, $actual) + { + $this->assertEquals( + '{"level_name":"CRITICAL","channel":"core","context":{"exception":'.$expected.'},"datetime":null,"extra":[],"message":"foobar"}'."\n", + $actual + ); + } + + /** + * @param JsonFormatter $formatter + * @param \Exception|\Throwable $exception + * + * @return string + */ + private function formatRecordWithExceptionInContext(JsonFormatter $formatter, $exception) + { + $message = $formatter->format(array( + 'level_name' => 'CRITICAL', + 'channel' => 'core', + 'context' => array('exception' => $exception), + 'datetime' => null, + 'extra' => array(), + 'message' => 'foobar', + )); + return $message; + } + + /** + * @param \Exception|\Throwable $exception + * + * @return string + */ + private function formatExceptionFilePathWithLine($exception) + { + $options = 0; + if (version_compare(PHP_VERSION, '5.4.0', '>=')) { + $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; + } + $path = substr(json_encode($exception->getFile(), $options), 1, -1); + return $path . ':' . $exception->getLine(); + } + + /** + * @param \Exception|\Throwable $exception + * + * @param null|string $previous + * + * @return string + */ + private function formatException($exception, $previous = null) + { + $formattedException = + '{"class":"' . get_class($exception) . + '","message":"' . $exception->getMessage() . + '","code":' . $exception->getCode() . + ',"file":"' . $this->formatExceptionFilePathWithLine($exception) . + ($previous ? '","previous":' . $previous : '"') . + '}'; + return $formattedException; + } + + public function testNormalizeHandleLargeArraysWithExactly1000Items() + { + $formatter = new NormalizerFormatter(); + $largeArray = range(1, 1000); + + $res = $formatter->format(array( + 'level_name' => 'CRITICAL', + 'channel' => 'test', + 'message' => 'bar', + 'context' => array($largeArray), + 'datetime' => new \DateTime, + 'extra' => array(), + )); + + $this->assertCount(1000, $res['context'][0]); + $this->assertArrayNotHasKey('...', $res['context'][0]); + } + + public function testNormalizeHandleLargeArrays() + { + $formatter = new NormalizerFormatter(); + $largeArray = range(1, 2000); + + $res = $formatter->format(array( + 'level_name' => 'CRITICAL', + 'channel' => 'test', + 'message' => 'bar', + 'context' => array($largeArray), + 'datetime' => new \DateTime, + 'extra' => array(), + )); + + $this->assertCount(1001, $res['context'][0]); + $this->assertEquals('Over 1000 items (2000 total), aborting normalization', $res['context'][0]['...']); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php new file mode 100644 index 0000000..310d93c --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php @@ -0,0 +1,222 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * @covers Monolog\Formatter\LineFormatter + */ +class LineFormatterTest extends \PHPUnit_Framework_TestCase +{ + public function testDefFormatWithString() + { + $formatter = new LineFormatter(null, 'Y-m-d'); + $message = $formatter->format(array( + 'level_name' => 'WARNING', + 'channel' => 'log', + 'context' => array(), + 'message' => 'foo', + 'datetime' => new \DateTime, + 'extra' => array(), + )); + $this->assertEquals('['.date('Y-m-d').'] log.WARNING: foo [] []'."\n", $message); + } + + public function testDefFormatWithArrayContext() + { + $formatter = new LineFormatter(null, 'Y-m-d'); + $message = $formatter->format(array( + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'message' => 'foo', + 'datetime' => new \DateTime, + 'extra' => array(), + 'context' => array( + 'foo' => 'bar', + 'baz' => 'qux', + 'bool' => false, + 'null' => null, + ), + )); + $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foo {"foo":"bar","baz":"qux","bool":false,"null":null} []'."\n", $message); + } + + public function testDefFormatExtras() + { + $formatter = new LineFormatter(null, 'Y-m-d'); + $message = $formatter->format(array( + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array(), + 'datetime' => new \DateTime, + 'extra' => array('ip' => '127.0.0.1'), + 'message' => 'log', + )); + $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log [] {"ip":"127.0.0.1"}'."\n", $message); + } + + public function testFormatExtras() + { + $formatter = new LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context% %extra.file% %extra%\n", 'Y-m-d'); + $message = $formatter->format(array( + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array(), + 'datetime' => new \DateTime, + 'extra' => array('ip' => '127.0.0.1', 'file' => 'test'), + 'message' => 'log', + )); + $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log [] test {"ip":"127.0.0.1"}'."\n", $message); + } + + public function testContextAndExtraOptionallyNotShownIfEmpty() + { + $formatter = new LineFormatter(null, 'Y-m-d', false, true); + $message = $formatter->format(array( + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array(), + 'datetime' => new \DateTime, + 'extra' => array(), + 'message' => 'log', + )); + $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log '."\n", $message); + } + + public function testContextAndExtraReplacement() + { + $formatter = new LineFormatter('%context.foo% => %extra.foo%'); + $message = $formatter->format(array( + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('foo' => 'bar'), + 'datetime' => new \DateTime, + 'extra' => array('foo' => 'xbar'), + 'message' => 'log', + )); + $this->assertEquals('bar => xbar', $message); + } + + public function testDefFormatWithObject() + { + $formatter = new LineFormatter(null, 'Y-m-d'); + $message = $formatter->format(array( + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array(), + 'datetime' => new \DateTime, + 'extra' => array('foo' => new TestFoo, 'bar' => new TestBar, 'baz' => array(), 'res' => fopen('php://memory', 'rb')), + 'message' => 'foobar', + )); + + $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foobar [] {"foo":"[object] (Monolog\\\\Formatter\\\\TestFoo: {\\"foo\\":\\"foo\\"})","bar":"[object] (Monolog\\\\Formatter\\\\TestBar: bar)","baz":[],"res":"[resource] (stream)"}'."\n", $message); + } + + public function testDefFormatWithException() + { + $formatter = new LineFormatter(null, 'Y-m-d'); + $message = $formatter->format(array( + 'level_name' => 'CRITICAL', + 'channel' => 'core', + 'context' => array('exception' => new \RuntimeException('Foo')), + 'datetime' => new \DateTime, + 'extra' => array(), + 'message' => 'foobar', + )); + + $path = str_replace('\\/', '/', json_encode(__FILE__)); + + $this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException(code: 0): Foo at '.substr($path, 1, -1).':'.(__LINE__ - 8).')"} []'."\n", $message); + } + + public function testDefFormatWithPreviousException() + { + $formatter = new LineFormatter(null, 'Y-m-d'); + $previous = new \LogicException('Wut?'); + $message = $formatter->format(array( + 'level_name' => 'CRITICAL', + 'channel' => 'core', + 'context' => array('exception' => new \RuntimeException('Foo', 0, $previous)), + 'datetime' => new \DateTime, + 'extra' => array(), + 'message' => 'foobar', + )); + + $path = str_replace('\\/', '/', json_encode(__FILE__)); + + $this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException(code: 0): Foo at '.substr($path, 1, -1).':'.(__LINE__ - 8).', LogicException(code: 0): Wut? at '.substr($path, 1, -1).':'.(__LINE__ - 12).')"} []'."\n", $message); + } + + public function testBatchFormat() + { + $formatter = new LineFormatter(null, 'Y-m-d'); + $message = $formatter->formatBatch(array( + array( + 'level_name' => 'CRITICAL', + 'channel' => 'test', + 'message' => 'bar', + 'context' => array(), + 'datetime' => new \DateTime, + 'extra' => array(), + ), + array( + 'level_name' => 'WARNING', + 'channel' => 'log', + 'message' => 'foo', + 'context' => array(), + 'datetime' => new \DateTime, + 'extra' => array(), + ), + )); + $this->assertEquals('['.date('Y-m-d').'] test.CRITICAL: bar [] []'."\n".'['.date('Y-m-d').'] log.WARNING: foo [] []'."\n", $message); + } + + public function testFormatShouldStripInlineLineBreaks() + { + $formatter = new LineFormatter(null, 'Y-m-d'); + $message = $formatter->format( + array( + 'message' => "foo\nbar", + 'context' => array(), + 'extra' => array(), + ) + ); + + $this->assertRegExp('/foo bar/', $message); + } + + public function testFormatShouldNotStripInlineLineBreaksWhenFlagIsSet() + { + $formatter = new LineFormatter(null, 'Y-m-d', true); + $message = $formatter->format( + array( + 'message' => "foo\nbar", + 'context' => array(), + 'extra' => array(), + ) + ); + + $this->assertRegExp('/foo\nbar/', $message); + } +} + +class TestFoo +{ + public $foo = 'foo'; +} + +class TestBar +{ + public function __toString() + { + return 'bar'; + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/LogglyFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/LogglyFormatterTest.php new file mode 100644 index 0000000..6d59b3f --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Formatter/LogglyFormatterTest.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\TestCase; + +class LogglyFormatterTest extends TestCase +{ + /** + * @covers Monolog\Formatter\LogglyFormatter::__construct + */ + public function testConstruct() + { + $formatter = new LogglyFormatter(); + $this->assertEquals(LogglyFormatter::BATCH_MODE_NEWLINES, $formatter->getBatchMode()); + $formatter = new LogglyFormatter(LogglyFormatter::BATCH_MODE_JSON); + $this->assertEquals(LogglyFormatter::BATCH_MODE_JSON, $formatter->getBatchMode()); + } + + /** + * @covers Monolog\Formatter\LogglyFormatter::format + */ + public function testFormat() + { + $formatter = new LogglyFormatter(); + $record = $this->getRecord(); + $formatted_decoded = json_decode($formatter->format($record), true); + $this->assertArrayHasKey("timestamp", $formatted_decoded); + $this->assertEquals(new \DateTime($formatted_decoded["timestamp"]), $record["datetime"]); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php new file mode 100644 index 0000000..9f6b1cc --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php @@ -0,0 +1,333 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; + +class LogstashFormatterTest extends \PHPUnit_Framework_TestCase +{ + public function tearDown() + { + \PHPUnit_Framework_Error_Warning::$enabled = true; + + return parent::tearDown(); + } + + /** + * @covers Monolog\Formatter\LogstashFormatter::format + */ + public function testDefaultFormatter() + { + $formatter = new LogstashFormatter('test', 'hostname'); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array(), + 'datetime' => new \DateTime("@0"), + 'extra' => array(), + 'message' => 'log', + ); + + $message = json_decode($formatter->format($record), true); + + $this->assertEquals("1970-01-01T00:00:00.000000+00:00", $message['@timestamp']); + $this->assertEquals('log', $message['@message']); + $this->assertEquals('meh', $message['@fields']['channel']); + $this->assertContains('meh', $message['@tags']); + $this->assertEquals(Logger::ERROR, $message['@fields']['level']); + $this->assertEquals('test', $message['@type']); + $this->assertEquals('hostname', $message['@source']); + + $formatter = new LogstashFormatter('mysystem'); + + $message = json_decode($formatter->format($record), true); + + $this->assertEquals('mysystem', $message['@type']); + } + + /** + * @covers Monolog\Formatter\LogstashFormatter::format + */ + public function testFormatWithFileAndLine() + { + $formatter = new LogstashFormatter('test'); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('from' => 'logger'), + 'datetime' => new \DateTime("@0"), + 'extra' => array('file' => 'test', 'line' => 14), + 'message' => 'log', + ); + + $message = json_decode($formatter->format($record), true); + + $this->assertEquals('test', $message['@fields']['file']); + $this->assertEquals(14, $message['@fields']['line']); + } + + /** + * @covers Monolog\Formatter\LogstashFormatter::format + */ + public function testFormatWithContext() + { + $formatter = new LogstashFormatter('test'); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('from' => 'logger'), + 'datetime' => new \DateTime("@0"), + 'extra' => array('key' => 'pair'), + 'message' => 'log', + ); + + $message = json_decode($formatter->format($record), true); + + $message_array = $message['@fields']; + + $this->assertArrayHasKey('ctxt_from', $message_array); + $this->assertEquals('logger', $message_array['ctxt_from']); + + // Test with extraPrefix + $formatter = new LogstashFormatter('test', null, null, 'CTX'); + $message = json_decode($formatter->format($record), true); + + $message_array = $message['@fields']; + + $this->assertArrayHasKey('CTXfrom', $message_array); + $this->assertEquals('logger', $message_array['CTXfrom']); + } + + /** + * @covers Monolog\Formatter\LogstashFormatter::format + */ + public function testFormatWithExtra() + { + $formatter = new LogstashFormatter('test'); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('from' => 'logger'), + 'datetime' => new \DateTime("@0"), + 'extra' => array('key' => 'pair'), + 'message' => 'log', + ); + + $message = json_decode($formatter->format($record), true); + + $message_array = $message['@fields']; + + $this->assertArrayHasKey('key', $message_array); + $this->assertEquals('pair', $message_array['key']); + + // Test with extraPrefix + $formatter = new LogstashFormatter('test', null, 'EXT'); + $message = json_decode($formatter->format($record), true); + + $message_array = $message['@fields']; + + $this->assertArrayHasKey('EXTkey', $message_array); + $this->assertEquals('pair', $message_array['EXTkey']); + } + + public function testFormatWithApplicationName() + { + $formatter = new LogstashFormatter('app', 'test'); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('from' => 'logger'), + 'datetime' => new \DateTime("@0"), + 'extra' => array('key' => 'pair'), + 'message' => 'log', + ); + + $message = json_decode($formatter->format($record), true); + + $this->assertArrayHasKey('@type', $message); + $this->assertEquals('app', $message['@type']); + } + + /** + * @covers Monolog\Formatter\LogstashFormatter::format + */ + public function testDefaultFormatterV1() + { + $formatter = new LogstashFormatter('test', 'hostname', null, 'ctxt_', LogstashFormatter::V1); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array(), + 'datetime' => new \DateTime("@0"), + 'extra' => array(), + 'message' => 'log', + ); + + $message = json_decode($formatter->format($record), true); + + $this->assertEquals("1970-01-01T00:00:00.000000+00:00", $message['@timestamp']); + $this->assertEquals("1", $message['@version']); + $this->assertEquals('log', $message['message']); + $this->assertEquals('meh', $message['channel']); + $this->assertEquals('ERROR', $message['level']); + $this->assertEquals('test', $message['type']); + $this->assertEquals('hostname', $message['host']); + + $formatter = new LogstashFormatter('mysystem', null, null, 'ctxt_', LogstashFormatter::V1); + + $message = json_decode($formatter->format($record), true); + + $this->assertEquals('mysystem', $message['type']); + } + + /** + * @covers Monolog\Formatter\LogstashFormatter::format + */ + public function testFormatWithFileAndLineV1() + { + $formatter = new LogstashFormatter('test', null, null, 'ctxt_', LogstashFormatter::V1); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('from' => 'logger'), + 'datetime' => new \DateTime("@0"), + 'extra' => array('file' => 'test', 'line' => 14), + 'message' => 'log', + ); + + $message = json_decode($formatter->format($record), true); + + $this->assertEquals('test', $message['file']); + $this->assertEquals(14, $message['line']); + } + + /** + * @covers Monolog\Formatter\LogstashFormatter::format + */ + public function testFormatWithContextV1() + { + $formatter = new LogstashFormatter('test', null, null, 'ctxt_', LogstashFormatter::V1); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('from' => 'logger'), + 'datetime' => new \DateTime("@0"), + 'extra' => array('key' => 'pair'), + 'message' => 'log', + ); + + $message = json_decode($formatter->format($record), true); + + $this->assertArrayHasKey('ctxt_from', $message); + $this->assertEquals('logger', $message['ctxt_from']); + + // Test with extraPrefix + $formatter = new LogstashFormatter('test', null, null, 'CTX', LogstashFormatter::V1); + $message = json_decode($formatter->format($record), true); + + $this->assertArrayHasKey('CTXfrom', $message); + $this->assertEquals('logger', $message['CTXfrom']); + } + + /** + * @covers Monolog\Formatter\LogstashFormatter::format + */ + public function testFormatWithExtraV1() + { + $formatter = new LogstashFormatter('test', null, null, 'ctxt_', LogstashFormatter::V1); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('from' => 'logger'), + 'datetime' => new \DateTime("@0"), + 'extra' => array('key' => 'pair'), + 'message' => 'log', + ); + + $message = json_decode($formatter->format($record), true); + + $this->assertArrayHasKey('key', $message); + $this->assertEquals('pair', $message['key']); + + // Test with extraPrefix + $formatter = new LogstashFormatter('test', null, 'EXT', 'ctxt_', LogstashFormatter::V1); + $message = json_decode($formatter->format($record), true); + + $this->assertArrayHasKey('EXTkey', $message); + $this->assertEquals('pair', $message['EXTkey']); + } + + public function testFormatWithApplicationNameV1() + { + $formatter = new LogstashFormatter('app', 'test', null, 'ctxt_', LogstashFormatter::V1); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('from' => 'logger'), + 'datetime' => new \DateTime("@0"), + 'extra' => array('key' => 'pair'), + 'message' => 'log', + ); + + $message = json_decode($formatter->format($record), true); + + $this->assertArrayHasKey('type', $message); + $this->assertEquals('app', $message['type']); + } + + public function testFormatWithLatin9Data() + { + if (version_compare(PHP_VERSION, '5.5.0', '<')) { + // Ignore the warning that will be emitted by PHP <5.5.0 + \PHPUnit_Framework_Error_Warning::$enabled = false; + } + $formatter = new LogstashFormatter('test', 'hostname'); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => '¯\_(ツ)_/¯', + 'context' => array(), + 'datetime' => new \DateTime("@0"), + 'extra' => array( + 'user_agent' => "\xD6WN; FBCR/OrangeEspa\xF1a; Vers\xE3o/4.0; F\xE4rist", + ), + 'message' => 'log', + ); + + $message = json_decode($formatter->format($record), true); + + $this->assertEquals("1970-01-01T00:00:00.000000+00:00", $message['@timestamp']); + $this->assertEquals('log', $message['@message']); + $this->assertEquals('¯\_(ツ)_/¯', $message['@fields']['channel']); + $this->assertContains('¯\_(ツ)_/¯', $message['@tags']); + $this->assertEquals(Logger::ERROR, $message['@fields']['level']); + $this->assertEquals('test', $message['@type']); + $this->assertEquals('hostname', $message['@source']); + if (version_compare(PHP_VERSION, '5.5.0', '>=')) { + $this->assertEquals('ÖWN; FBCR/OrangeEspaña; Versão/4.0; Färist', $message['@fields']['user_agent']); + } else { + // PHP <5.5 does not return false for an element encoding failure, + // instead it emits a warning (possibly) and nulls the value. + $this->assertEquals(null, $message['@fields']['user_agent']); + } + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php new file mode 100644 index 0000000..52e699e --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php @@ -0,0 +1,262 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; + +/** + * @author Florian Plattner + */ +class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase +{ + public function setUp() + { + if (!class_exists('MongoDate')) { + $this->markTestSkipped('mongo extension not installed'); + } + } + + public function constructArgumentProvider() + { + return array( + array(1, true, 1, true), + array(0, false, 0, false), + ); + } + + /** + * @param $traceDepth + * @param $traceAsString + * @param $expectedTraceDepth + * @param $expectedTraceAsString + * + * @dataProvider constructArgumentProvider + */ + public function testConstruct($traceDepth, $traceAsString, $expectedTraceDepth, $expectedTraceAsString) + { + $formatter = new MongoDBFormatter($traceDepth, $traceAsString); + + $reflTrace = new \ReflectionProperty($formatter, 'exceptionTraceAsString'); + $reflTrace->setAccessible(true); + $this->assertEquals($expectedTraceAsString, $reflTrace->getValue($formatter)); + + $reflDepth = new\ReflectionProperty($formatter, 'maxNestingLevel'); + $reflDepth->setAccessible(true); + $this->assertEquals($expectedTraceDepth, $reflDepth->getValue($formatter)); + } + + public function testSimpleFormat() + { + $record = array( + 'message' => 'some log message', + 'context' => array(), + 'level' => Logger::WARNING, + 'level_name' => Logger::getLevelName(Logger::WARNING), + 'channel' => 'test', + 'datetime' => new \DateTime('2014-02-01 00:00:00'), + 'extra' => array(), + ); + + $formatter = new MongoDBFormatter(); + $formattedRecord = $formatter->format($record); + + $this->assertCount(7, $formattedRecord); + $this->assertEquals('some log message', $formattedRecord['message']); + $this->assertEquals(array(), $formattedRecord['context']); + $this->assertEquals(Logger::WARNING, $formattedRecord['level']); + $this->assertEquals(Logger::getLevelName(Logger::WARNING), $formattedRecord['level_name']); + $this->assertEquals('test', $formattedRecord['channel']); + $this->assertInstanceOf('\MongoDate', $formattedRecord['datetime']); + $this->assertEquals('0.00000000 1391212800', $formattedRecord['datetime']->__toString()); + $this->assertEquals(array(), $formattedRecord['extra']); + } + + public function testRecursiveFormat() + { + $someObject = new \stdClass(); + $someObject->foo = 'something'; + $someObject->bar = 'stuff'; + + $record = array( + 'message' => 'some log message', + 'context' => array( + 'stuff' => new \DateTime('2014-02-01 02:31:33'), + 'some_object' => $someObject, + 'context_string' => 'some string', + 'context_int' => 123456, + 'except' => new \Exception('exception message', 987), + ), + 'level' => Logger::WARNING, + 'level_name' => Logger::getLevelName(Logger::WARNING), + 'channel' => 'test', + 'datetime' => new \DateTime('2014-02-01 00:00:00'), + 'extra' => array(), + ); + + $formatter = new MongoDBFormatter(); + $formattedRecord = $formatter->format($record); + + $this->assertCount(5, $formattedRecord['context']); + $this->assertInstanceOf('\MongoDate', $formattedRecord['context']['stuff']); + $this->assertEquals('0.00000000 1391221893', $formattedRecord['context']['stuff']->__toString()); + $this->assertEquals( + array( + 'foo' => 'something', + 'bar' => 'stuff', + 'class' => 'stdClass', + ), + $formattedRecord['context']['some_object'] + ); + $this->assertEquals('some string', $formattedRecord['context']['context_string']); + $this->assertEquals(123456, $formattedRecord['context']['context_int']); + + $this->assertCount(5, $formattedRecord['context']['except']); + $this->assertEquals('exception message', $formattedRecord['context']['except']['message']); + $this->assertEquals(987, $formattedRecord['context']['except']['code']); + $this->assertInternalType('string', $formattedRecord['context']['except']['file']); + $this->assertInternalType('integer', $formattedRecord['context']['except']['code']); + $this->assertInternalType('string', $formattedRecord['context']['except']['trace']); + $this->assertEquals('Exception', $formattedRecord['context']['except']['class']); + } + + public function testFormatDepthArray() + { + $record = array( + 'message' => 'some log message', + 'context' => array( + 'nest2' => array( + 'property' => 'anything', + 'nest3' => array( + 'nest4' => 'value', + 'property' => 'nothing', + ), + ), + ), + 'level' => Logger::WARNING, + 'level_name' => Logger::getLevelName(Logger::WARNING), + 'channel' => 'test', + 'datetime' => new \DateTime('2014-02-01 00:00:00'), + 'extra' => array(), + ); + + $formatter = new MongoDBFormatter(2); + $formattedResult = $formatter->format($record); + + $this->assertEquals( + array( + 'nest2' => array( + 'property' => 'anything', + 'nest3' => '[...]', + ), + ), + $formattedResult['context'] + ); + } + + public function testFormatDepthArrayInfiniteNesting() + { + $record = array( + 'message' => 'some log message', + 'context' => array( + 'nest2' => array( + 'property' => 'something', + 'nest3' => array( + 'property' => 'anything', + 'nest4' => array( + 'property' => 'nothing', + ), + ), + ), + ), + 'level' => Logger::WARNING, + 'level_name' => Logger::getLevelName(Logger::WARNING), + 'channel' => 'test', + 'datetime' => new \DateTime('2014-02-01 00:00:00'), + 'extra' => array(), + ); + + $formatter = new MongoDBFormatter(0); + $formattedResult = $formatter->format($record); + + $this->assertEquals( + array( + 'nest2' => array( + 'property' => 'something', + 'nest3' => array( + 'property' => 'anything', + 'nest4' => array( + 'property' => 'nothing', + ), + ), + ), + ), + $formattedResult['context'] + ); + } + + public function testFormatDepthObjects() + { + $someObject = new \stdClass(); + $someObject->property = 'anything'; + $someObject->nest3 = new \stdClass(); + $someObject->nest3->property = 'nothing'; + $someObject->nest3->nest4 = 'invisible'; + + $record = array( + 'message' => 'some log message', + 'context' => array( + 'nest2' => $someObject, + ), + 'level' => Logger::WARNING, + 'level_name' => Logger::getLevelName(Logger::WARNING), + 'channel' => 'test', + 'datetime' => new \DateTime('2014-02-01 00:00:00'), + 'extra' => array(), + ); + + $formatter = new MongoDBFormatter(2, true); + $formattedResult = $formatter->format($record); + + $this->assertEquals( + array( + 'nest2' => array( + 'property' => 'anything', + 'nest3' => '[...]', + 'class' => 'stdClass', + ), + ), + $formattedResult['context'] + ); + } + + public function testFormatDepthException() + { + $record = array( + 'message' => 'some log message', + 'context' => array( + 'nest2' => new \Exception('exception message', 987), + ), + 'level' => Logger::WARNING, + 'level_name' => Logger::getLevelName(Logger::WARNING), + 'channel' => 'test', + 'datetime' => new \DateTime('2014-02-01 00:00:00'), + 'extra' => array(), + ); + + $formatter = new MongoDBFormatter(2, false); + $formattedRecord = $formatter->format($record); + + $this->assertEquals('exception message', $formattedRecord['context']['nest2']['message']); + $this->assertEquals(987, $formattedRecord['context']['nest2']['code']); + $this->assertEquals('[...]', $formattedRecord['context']['nest2']['trace']); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php new file mode 100644 index 0000000..bafd1c7 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php @@ -0,0 +1,481 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * @covers Monolog\Formatter\NormalizerFormatter + */ +class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase +{ + public function tearDown() + { + \PHPUnit_Framework_Error_Warning::$enabled = true; + + return parent::tearDown(); + } + + public function testFormat() + { + $formatter = new NormalizerFormatter('Y-m-d'); + $formatted = $formatter->format(array( + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'message' => 'foo', + 'datetime' => new \DateTime, + 'extra' => array('foo' => new TestFooNorm, 'bar' => new TestBarNorm, 'baz' => array(), 'res' => fopen('php://memory', 'rb')), + 'context' => array( + 'foo' => 'bar', + 'baz' => 'qux', + 'inf' => INF, + '-inf' => -INF, + 'nan' => acos(4), + ), + )); + + $this->assertEquals(array( + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'message' => 'foo', + 'datetime' => date('Y-m-d'), + 'extra' => array( + 'foo' => '[object] (Monolog\\Formatter\\TestFooNorm: {"foo":"foo"})', + 'bar' => '[object] (Monolog\\Formatter\\TestBarNorm: bar)', + 'baz' => array(), + 'res' => '[resource] (stream)', + ), + 'context' => array( + 'foo' => 'bar', + 'baz' => 'qux', + 'inf' => 'INF', + '-inf' => '-INF', + 'nan' => 'NaN', + ), + ), $formatted); + } + + public function testFormatExceptions() + { + $formatter = new NormalizerFormatter('Y-m-d'); + $e = new \LogicException('bar'); + $e2 = new \RuntimeException('foo', 0, $e); + $formatted = $formatter->format(array( + 'exception' => $e2, + )); + + $this->assertGreaterThan(5, count($formatted['exception']['trace'])); + $this->assertTrue(isset($formatted['exception']['previous'])); + unset($formatted['exception']['trace'], $formatted['exception']['previous']); + + $this->assertEquals(array( + 'exception' => array( + 'class' => get_class($e2), + 'message' => $e2->getMessage(), + 'code' => $e2->getCode(), + 'file' => $e2->getFile().':'.$e2->getLine(), + ), + ), $formatted); + } + + public function testFormatSoapFaultException() + { + if (!class_exists('SoapFault')) { + $this->markTestSkipped('Requires the soap extension'); + } + + $formatter = new NormalizerFormatter('Y-m-d'); + $e = new \SoapFault('foo', 'bar', 'hello', 'world'); + $formatted = $formatter->format(array( + 'exception' => $e, + )); + + unset($formatted['exception']['trace']); + + $this->assertEquals(array( + 'exception' => array( + 'class' => 'SoapFault', + 'message' => 'bar', + 'code' => 0, + 'file' => $e->getFile().':'.$e->getLine(), + 'faultcode' => 'foo', + 'faultactor' => 'hello', + 'detail' => 'world', + ), + ), $formatted); + } + + public function testFormatToStringExceptionHandle() + { + $formatter = new NormalizerFormatter('Y-m-d'); + $this->setExpectedException('RuntimeException', 'Could not convert to string'); + $formatter->format(array( + 'myObject' => new TestToStringError(), + )); + } + + public function testBatchFormat() + { + $formatter = new NormalizerFormatter('Y-m-d'); + $formatted = $formatter->formatBatch(array( + array( + 'level_name' => 'CRITICAL', + 'channel' => 'test', + 'message' => 'bar', + 'context' => array(), + 'datetime' => new \DateTime, + 'extra' => array(), + ), + array( + 'level_name' => 'WARNING', + 'channel' => 'log', + 'message' => 'foo', + 'context' => array(), + 'datetime' => new \DateTime, + 'extra' => array(), + ), + )); + $this->assertEquals(array( + array( + 'level_name' => 'CRITICAL', + 'channel' => 'test', + 'message' => 'bar', + 'context' => array(), + 'datetime' => date('Y-m-d'), + 'extra' => array(), + ), + array( + 'level_name' => 'WARNING', + 'channel' => 'log', + 'message' => 'foo', + 'context' => array(), + 'datetime' => date('Y-m-d'), + 'extra' => array(), + ), + ), $formatted); + } + + /** + * Test issue #137 + */ + public function testIgnoresRecursiveObjectReferences() + { + // set up the recursion + $foo = new \stdClass(); + $bar = new \stdClass(); + + $foo->bar = $bar; + $bar->foo = $foo; + + // set an error handler to assert that the error is not raised anymore + $that = $this; + set_error_handler(function ($level, $message, $file, $line, $context) use ($that) { + if (error_reporting() & $level) { + restore_error_handler(); + $that->fail("$message should not be raised"); + } + }); + + $formatter = new NormalizerFormatter(); + $reflMethod = new \ReflectionMethod($formatter, 'toJson'); + $reflMethod->setAccessible(true); + $res = $reflMethod->invoke($formatter, array($foo, $bar), true); + + restore_error_handler(); + + $this->assertEquals(@json_encode(array($foo, $bar)), $res); + } + + public function testCanNormalizeReferences() + { + $formatter = new NormalizerFormatter(); + $x = array('foo' => 'bar'); + $y = array('x' => &$x); + $x['y'] = &$y; + $formatter->format($y); + } + + public function testIgnoresInvalidTypes() + { + // set up the recursion + $resource = fopen(__FILE__, 'r'); + + // set an error handler to assert that the error is not raised anymore + $that = $this; + set_error_handler(function ($level, $message, $file, $line, $context) use ($that) { + if (error_reporting() & $level) { + restore_error_handler(); + $that->fail("$message should not be raised"); + } + }); + + $formatter = new NormalizerFormatter(); + $reflMethod = new \ReflectionMethod($formatter, 'toJson'); + $reflMethod->setAccessible(true); + $res = $reflMethod->invoke($formatter, array($resource), true); + + restore_error_handler(); + + $this->assertEquals(@json_encode(array($resource)), $res); + } + + public function testNormalizeHandleLargeArraysWithExactly1000Items() + { + $formatter = new NormalizerFormatter(); + $largeArray = range(1, 1000); + + $res = $formatter->format(array( + 'level_name' => 'CRITICAL', + 'channel' => 'test', + 'message' => 'bar', + 'context' => array($largeArray), + 'datetime' => new \DateTime, + 'extra' => array(), + )); + + $this->assertCount(1000, $res['context'][0]); + $this->assertArrayNotHasKey('...', $res['context'][0]); + } + + public function testNormalizeHandleLargeArrays() + { + $formatter = new NormalizerFormatter(); + $largeArray = range(1, 2000); + + $res = $formatter->format(array( + 'level_name' => 'CRITICAL', + 'channel' => 'test', + 'message' => 'bar', + 'context' => array($largeArray), + 'datetime' => new \DateTime, + 'extra' => array(), + )); + + $this->assertCount(1001, $res['context'][0]); + $this->assertEquals('Over 1000 items (2000 total), aborting normalization', $res['context'][0]['...']); + } + + /** + * @expectedException RuntimeException + */ + public function testThrowsOnInvalidEncoding() + { + if (version_compare(PHP_VERSION, '5.5.0', '<')) { + // Ignore the warning that will be emitted by PHP <5.5.0 + \PHPUnit_Framework_Error_Warning::$enabled = false; + } + $formatter = new NormalizerFormatter(); + $reflMethod = new \ReflectionMethod($formatter, 'toJson'); + $reflMethod->setAccessible(true); + + // send an invalid unicode sequence as a object that can't be cleaned + $record = new \stdClass; + $record->message = "\xB1\x31"; + $res = $reflMethod->invoke($formatter, $record); + if (PHP_VERSION_ID < 50500 && $res === '{"message":null}') { + throw new \RuntimeException('PHP 5.3/5.4 throw a warning and null the value instead of returning false entirely'); + } + } + + public function testConvertsInvalidEncodingAsLatin9() + { + if (version_compare(PHP_VERSION, '5.5.0', '<')) { + // Ignore the warning that will be emitted by PHP <5.5.0 + \PHPUnit_Framework_Error_Warning::$enabled = false; + } + $formatter = new NormalizerFormatter(); + $reflMethod = new \ReflectionMethod($formatter, 'toJson'); + $reflMethod->setAccessible(true); + + $res = $reflMethod->invoke($formatter, array('message' => "\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE")); + + if (version_compare(PHP_VERSION, '5.5.0', '>=')) { + $this->assertSame('{"message":"€ŠšŽžŒœŸ"}', $res); + } else { + // PHP <5.5 does not return false for an element encoding failure, + // instead it emits a warning (possibly) and nulls the value. + $this->assertSame('{"message":null}', $res); + } + } + + /** + * @param mixed $in Input + * @param mixed $expect Expected output + * @covers Monolog\Formatter\NormalizerFormatter::detectAndCleanUtf8 + * @dataProvider providesDetectAndCleanUtf8 + */ + public function testDetectAndCleanUtf8($in, $expect) + { + $formatter = new NormalizerFormatter(); + $formatter->detectAndCleanUtf8($in); + $this->assertSame($expect, $in); + } + + public function providesDetectAndCleanUtf8() + { + $obj = new \stdClass; + + return array( + 'null' => array(null, null), + 'int' => array(123, 123), + 'float' => array(123.45, 123.45), + 'bool false' => array(false, false), + 'bool true' => array(true, true), + 'ascii string' => array('abcdef', 'abcdef'), + 'latin9 string' => array("\xB1\x31\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE\xFF", '±1€ŠšŽžŒœŸÿ'), + 'unicode string' => array('¤¦¨´¸¼½¾€ŠšŽžŒœŸ', '¤¦¨´¸¼½¾€ŠšŽžŒœŸ'), + 'empty array' => array(array(), array()), + 'array' => array(array('abcdef'), array('abcdef')), + 'object' => array($obj, $obj), + ); + } + + /** + * @param int $code + * @param string $msg + * @dataProvider providesHandleJsonErrorFailure + */ + public function testHandleJsonErrorFailure($code, $msg) + { + $formatter = new NormalizerFormatter(); + $reflMethod = new \ReflectionMethod($formatter, 'handleJsonError'); + $reflMethod->setAccessible(true); + + $this->setExpectedException('RuntimeException', $msg); + $reflMethod->invoke($formatter, $code, 'faked'); + } + + public function providesHandleJsonErrorFailure() + { + return array( + 'depth' => array(JSON_ERROR_DEPTH, 'Maximum stack depth exceeded'), + 'state' => array(JSON_ERROR_STATE_MISMATCH, 'Underflow or the modes mismatch'), + 'ctrl' => array(JSON_ERROR_CTRL_CHAR, 'Unexpected control character found'), + 'default' => array(-1, 'Unknown error'), + ); + } + + public function testExceptionTraceWithArgs() + { + if (defined('HHVM_VERSION')) { + $this->markTestSkipped('Not supported in HHVM since it detects errors differently'); + } + + // This happens i.e. in React promises or Guzzle streams where stream wrappers are registered + // and no file or line are included in the trace because it's treated as internal function + set_error_handler(function ($errno, $errstr, $errfile, $errline) { + throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); + }); + + try { + // This will contain $resource and $wrappedResource as arguments in the trace item + $resource = fopen('php://memory', 'rw+'); + fwrite($resource, 'test_resource'); + $wrappedResource = new TestFooNorm; + $wrappedResource->foo = $resource; + // Just do something stupid with a resource/wrapped resource as argument + array_keys($wrappedResource); + } catch (\Exception $e) { + restore_error_handler(); + } + + $formatter = new NormalizerFormatter(); + $record = array('context' => array('exception' => $e)); + $result = $formatter->format($record); + + $this->assertRegExp( + '%"resource":"\[resource\] \(stream\)"%', + $result['context']['exception']['trace'][0] + ); + + if (version_compare(PHP_VERSION, '5.5.0', '>=')) { + $pattern = '%"wrappedResource":"\[object\] \(Monolog\\\\\\\\Formatter\\\\\\\\TestFooNorm: \)"%'; + } else { + $pattern = '%\\\\"foo\\\\":null%'; + } + + // Tests that the wrapped resource is ignored while encoding, only works for PHP <= 5.4 + $this->assertRegExp( + $pattern, + $result['context']['exception']['trace'][0] + ); + } + + public function testExceptionTraceDoesNotLeakCallUserFuncArgs() + { + try { + $arg = new TestInfoLeak; + call_user_func(array($this, 'throwHelper'), $arg, $dt = new \DateTime()); + } catch (\Exception $e) { + } + + $formatter = new NormalizerFormatter(); + $record = array('context' => array('exception' => $e)); + $result = $formatter->format($record); + + $this->assertSame( + '{"function":"throwHelper","class":"Monolog\\\\Formatter\\\\NormalizerFormatterTest","type":"->","args":["[object] (Monolog\\\\Formatter\\\\TestInfoLeak)","'.$dt->format('Y-m-d H:i:s').'"]}', + $result['context']['exception']['trace'][0] + ); + } + + private function throwHelper($arg) + { + throw new \RuntimeException('Thrown'); + } +} + +class TestFooNorm +{ + public $foo = 'foo'; +} + +class TestBarNorm +{ + public function __toString() + { + return 'bar'; + } +} + +class TestStreamFoo +{ + public $foo; + public $resource; + + public function __construct($resource) + { + $this->resource = $resource; + $this->foo = 'BAR'; + } + + public function __toString() + { + fseek($this->resource, 0); + + return $this->foo . ' - ' . (string) stream_get_contents($this->resource); + } +} + +class TestToStringError +{ + public function __toString() + { + throw new \RuntimeException('Could not convert to string'); + } +} + +class TestInfoLeak +{ + public function __toString() + { + return 'Sensitive information'; + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php new file mode 100644 index 0000000..b1c8fd4 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php @@ -0,0 +1,110 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +class ScalarFormatterTest extends \PHPUnit_Framework_TestCase +{ + private $formatter; + + public function setUp() + { + $this->formatter = new ScalarFormatter(); + } + + public function buildTrace(\Exception $e) + { + $data = array(); + $trace = $e->getTrace(); + foreach ($trace as $frame) { + if (isset($frame['file'])) { + $data[] = $frame['file'].':'.$frame['line']; + } else { + $data[] = json_encode($frame); + } + } + + return $data; + } + + public function encodeJson($data) + { + if (version_compare(PHP_VERSION, '5.4.0', '>=')) { + return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); + } + + return json_encode($data); + } + + public function testFormat() + { + $exception = new \Exception('foo'); + $formatted = $this->formatter->format(array( + 'foo' => 'string', + 'bar' => 1, + 'baz' => false, + 'bam' => array(1, 2, 3), + 'bat' => array('foo' => 'bar'), + 'bap' => \DateTime::createFromFormat(\DateTime::ISO8601, '1970-01-01T00:00:00+0000'), + 'ban' => $exception, + )); + + $this->assertSame(array( + 'foo' => 'string', + 'bar' => 1, + 'baz' => false, + 'bam' => $this->encodeJson(array(1, 2, 3)), + 'bat' => $this->encodeJson(array('foo' => 'bar')), + 'bap' => '1970-01-01 00:00:00', + 'ban' => $this->encodeJson(array( + 'class' => get_class($exception), + 'message' => $exception->getMessage(), + 'code' => $exception->getCode(), + 'file' => $exception->getFile() . ':' . $exception->getLine(), + 'trace' => $this->buildTrace($exception), + )), + ), $formatted); + } + + public function testFormatWithErrorContext() + { + $context = array('file' => 'foo', 'line' => 1); + $formatted = $this->formatter->format(array( + 'context' => $context, + )); + + $this->assertSame(array( + 'context' => $this->encodeJson($context), + ), $formatted); + } + + public function testFormatWithExceptionContext() + { + $exception = new \Exception('foo'); + $formatted = $this->formatter->format(array( + 'context' => array( + 'exception' => $exception, + ), + )); + + $this->assertSame(array( + 'context' => $this->encodeJson(array( + 'exception' => array( + 'class' => get_class($exception), + 'message' => $exception->getMessage(), + 'code' => $exception->getCode(), + 'file' => $exception->getFile() . ':' . $exception->getLine(), + 'trace' => $this->buildTrace($exception), + ), + )), + ), $formatted); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/WildfireFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/WildfireFormatterTest.php new file mode 100644 index 0000000..52f15a3 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Formatter/WildfireFormatterTest.php @@ -0,0 +1,142 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; + +class WildfireFormatterTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Monolog\Formatter\WildfireFormatter::format + */ + public function testDefaultFormat() + { + $wildfire = new WildfireFormatter(); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('from' => 'logger'), + 'datetime' => new \DateTime("@0"), + 'extra' => array('ip' => '127.0.0.1'), + 'message' => 'log', + ); + + $message = $wildfire->format($record); + + $this->assertEquals( + '125|[{"Type":"ERROR","File":"","Line":"","Label":"meh"},' + .'{"message":"log","context":{"from":"logger"},"extra":{"ip":"127.0.0.1"}}]|', + $message + ); + } + + /** + * @covers Monolog\Formatter\WildfireFormatter::format + */ + public function testFormatWithFileAndLine() + { + $wildfire = new WildfireFormatter(); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('from' => 'logger'), + 'datetime' => new \DateTime("@0"), + 'extra' => array('ip' => '127.0.0.1', 'file' => 'test', 'line' => 14), + 'message' => 'log', + ); + + $message = $wildfire->format($record); + + $this->assertEquals( + '129|[{"Type":"ERROR","File":"test","Line":14,"Label":"meh"},' + .'{"message":"log","context":{"from":"logger"},"extra":{"ip":"127.0.0.1"}}]|', + $message + ); + } + + /** + * @covers Monolog\Formatter\WildfireFormatter::format + */ + public function testFormatWithoutContext() + { + $wildfire = new WildfireFormatter(); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array(), + 'datetime' => new \DateTime("@0"), + 'extra' => array(), + 'message' => 'log', + ); + + $message = $wildfire->format($record); + + $this->assertEquals( + '58|[{"Type":"ERROR","File":"","Line":"","Label":"meh"},"log"]|', + $message + ); + } + + /** + * @covers Monolog\Formatter\WildfireFormatter::formatBatch + * @expectedException BadMethodCallException + */ + public function testBatchFormatThrowException() + { + $wildfire = new WildfireFormatter(); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array(), + 'datetime' => new \DateTime("@0"), + 'extra' => array(), + 'message' => 'log', + ); + + $wildfire->formatBatch(array($record)); + } + + /** + * @covers Monolog\Formatter\WildfireFormatter::format + */ + public function testTableFormat() + { + $wildfire = new WildfireFormatter(); + $record = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'table-channel', + 'context' => array( + WildfireFormatter::TABLE => array( + array('col1', 'col2', 'col3'), + array('val1', 'val2', 'val3'), + array('foo1', 'foo2', 'foo3'), + array('bar1', 'bar2', 'bar3'), + ), + ), + 'datetime' => new \DateTime("@0"), + 'extra' => array(), + 'message' => 'table-message', + ); + + $message = $wildfire->format($record); + + $this->assertEquals( + '171|[{"Type":"TABLE","File":"","Line":"","Label":"table-channel: table-message"},[["col1","col2","col3"],["val1","val2","val3"],["foo1","foo2","foo3"],["bar1","bar2","bar3"]]]|', + $message + ); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/AbstractHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/AbstractHandlerTest.php new file mode 100644 index 0000000..568eb9d --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/AbstractHandlerTest.php @@ -0,0 +1,115 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; +use Monolog\Formatter\LineFormatter; +use Monolog\Processor\WebProcessor; + +class AbstractHandlerTest extends TestCase +{ + /** + * @covers Monolog\Handler\AbstractHandler::__construct + * @covers Monolog\Handler\AbstractHandler::getLevel + * @covers Monolog\Handler\AbstractHandler::setLevel + * @covers Monolog\Handler\AbstractHandler::getBubble + * @covers Monolog\Handler\AbstractHandler::setBubble + * @covers Monolog\Handler\AbstractHandler::getFormatter + * @covers Monolog\Handler\AbstractHandler::setFormatter + */ + public function testConstructAndGetSet() + { + $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array(Logger::WARNING, false)); + $this->assertEquals(Logger::WARNING, $handler->getLevel()); + $this->assertEquals(false, $handler->getBubble()); + + $handler->setLevel(Logger::ERROR); + $handler->setBubble(true); + $handler->setFormatter($formatter = new LineFormatter); + $this->assertEquals(Logger::ERROR, $handler->getLevel()); + $this->assertEquals(true, $handler->getBubble()); + $this->assertSame($formatter, $handler->getFormatter()); + } + + /** + * @covers Monolog\Handler\AbstractHandler::handleBatch + */ + public function testHandleBatch() + { + $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); + $handler->expects($this->exactly(2)) + ->method('handle'); + $handler->handleBatch(array($this->getRecord(), $this->getRecord())); + } + + /** + * @covers Monolog\Handler\AbstractHandler::isHandling + */ + public function testIsHandling() + { + $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array(Logger::WARNING, false)); + $this->assertTrue($handler->isHandling($this->getRecord())); + $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); + } + + /** + * @covers Monolog\Handler\AbstractHandler::__construct + */ + public function testHandlesPsrStyleLevels() + { + $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array('warning', false)); + $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); + $handler->setLevel('debug'); + $this->assertTrue($handler->isHandling($this->getRecord(Logger::DEBUG))); + } + + /** + * @covers Monolog\Handler\AbstractHandler::getFormatter + * @covers Monolog\Handler\AbstractHandler::getDefaultFormatter + */ + public function testGetFormatterInitializesDefault() + { + $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); + $this->assertInstanceOf('Monolog\Formatter\LineFormatter', $handler->getFormatter()); + } + + /** + * @covers Monolog\Handler\AbstractHandler::pushProcessor + * @covers Monolog\Handler\AbstractHandler::popProcessor + * @expectedException LogicException + */ + public function testPushPopProcessor() + { + $logger = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); + $processor1 = new WebProcessor; + $processor2 = new WebProcessor; + + $logger->pushProcessor($processor1); + $logger->pushProcessor($processor2); + + $this->assertEquals($processor2, $logger->popProcessor()); + $this->assertEquals($processor1, $logger->popProcessor()); + $logger->popProcessor(); + } + + /** + * @covers Monolog\Handler\AbstractHandler::pushProcessor + * @expectedException InvalidArgumentException + */ + public function testPushProcessorWithNonCallable() + { + $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler'); + + $handler->pushProcessor(new \stdClass()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php new file mode 100644 index 0000000..24d4f63 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; +use Monolog\Processor\WebProcessor; + +class AbstractProcessingHandlerTest extends TestCase +{ + /** + * @covers Monolog\Handler\AbstractProcessingHandler::handle + */ + public function testHandleLowerLevelMessage() + { + $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::WARNING, true)); + $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG))); + } + + /** + * @covers Monolog\Handler\AbstractProcessingHandler::handle + */ + public function testHandleBubbling() + { + $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::DEBUG, true)); + $this->assertFalse($handler->handle($this->getRecord())); + } + + /** + * @covers Monolog\Handler\AbstractProcessingHandler::handle + */ + public function testHandleNotBubbling() + { + $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::DEBUG, false)); + $this->assertTrue($handler->handle($this->getRecord())); + } + + /** + * @covers Monolog\Handler\AbstractProcessingHandler::handle + */ + public function testHandleIsFalseWhenNotHandled() + { + $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::WARNING, false)); + $this->assertTrue($handler->handle($this->getRecord())); + $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG))); + } + + /** + * @covers Monolog\Handler\AbstractProcessingHandler::processRecord + */ + public function testProcessRecord() + { + $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler'); + $handler->pushProcessor(new WebProcessor(array( + 'REQUEST_URI' => '', + 'REQUEST_METHOD' => '', + 'REMOTE_ADDR' => '', + 'SERVER_NAME' => '', + 'UNIQUE_ID' => '', + ))); + $handledRecord = null; + $handler->expects($this->once()) + ->method('write') + ->will($this->returnCallback(function ($record) use (&$handledRecord) { + $handledRecord = $record; + })) + ; + $handler->handle($this->getRecord()); + $this->assertEquals(6, count($handledRecord['extra'])); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php new file mode 100644 index 0000000..8e0e723 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php @@ -0,0 +1,136 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; +use PhpAmqpLib\Message\AMQPMessage; +use PhpAmqpLib\Connection\AMQPConnection; + +/** + * @covers Monolog\Handler\RotatingFileHandler + */ +class AmqpHandlerTest extends TestCase +{ + public function testHandleAmqpExt() + { + if (!class_exists('AMQPConnection') || !class_exists('AMQPExchange')) { + $this->markTestSkipped("amqp-php not installed"); + } + + if (!class_exists('AMQPChannel')) { + $this->markTestSkipped("Please update AMQP to version >= 1.0"); + } + + $messages = array(); + + $exchange = $this->getMock('AMQPExchange', array('publish', 'setName'), array(), '', false); + $exchange->expects($this->once()) + ->method('setName') + ->with('log') + ; + $exchange->expects($this->any()) + ->method('publish') + ->will($this->returnCallback(function ($message, $routing_key, $flags = 0, $attributes = array()) use (&$messages) { + $messages[] = array($message, $routing_key, $flags, $attributes); + })) + ; + + $handler = new AmqpHandler($exchange, 'log'); + + $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); + + $expected = array( + array( + 'message' => 'test', + 'context' => array( + 'data' => array(), + 'foo' => 34, + ), + 'level' => 300, + 'level_name' => 'WARNING', + 'channel' => 'test', + 'extra' => array(), + ), + 'warn.test', + 0, + array( + 'delivery_mode' => 2, + 'content_type' => 'application/json', + ), + ); + + $handler->handle($record); + + $this->assertCount(1, $messages); + $messages[0][0] = json_decode($messages[0][0], true); + unset($messages[0][0]['datetime']); + $this->assertEquals($expected, $messages[0]); + } + + public function testHandlePhpAmqpLib() + { + if (!class_exists('PhpAmqpLib\Connection\AMQPConnection')) { + $this->markTestSkipped("php-amqplib not installed"); + } + + $messages = array(); + + $exchange = $this->getMock('PhpAmqpLib\Channel\AMQPChannel', array('basic_publish', '__destruct'), array(), '', false); + + $exchange->expects($this->any()) + ->method('basic_publish') + ->will($this->returnCallback(function (AMQPMessage $msg, $exchange = "", $routing_key = "", $mandatory = false, $immediate = false, $ticket = null) use (&$messages) { + $messages[] = array($msg, $exchange, $routing_key, $mandatory, $immediate, $ticket); + })) + ; + + $handler = new AmqpHandler($exchange, 'log'); + + $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); + + $expected = array( + array( + 'message' => 'test', + 'context' => array( + 'data' => array(), + 'foo' => 34, + ), + 'level' => 300, + 'level_name' => 'WARNING', + 'channel' => 'test', + 'extra' => array(), + ), + 'log', + 'warn.test', + false, + false, + null, + array( + 'delivery_mode' => 2, + 'content_type' => 'application/json', + ), + ); + + $handler->handle($record); + + $this->assertCount(1, $messages); + + /* @var $msg AMQPMessage */ + $msg = $messages[0][0]; + $messages[0][0] = json_decode($msg->body, true); + $messages[0][] = $msg->get_properties(); + unset($messages[0][0]['datetime']); + + $this->assertEquals($expected, $messages[0]); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/BrowserConsoleHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/BrowserConsoleHandlerTest.php new file mode 100644 index 0000000..ffe45da --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/BrowserConsoleHandlerTest.php @@ -0,0 +1,130 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +/** + * @covers Monolog\Handler\BrowserConsoleHandlerTest + */ +class BrowserConsoleHandlerTest extends TestCase +{ + protected function setUp() + { + BrowserConsoleHandler::resetStatic(); + } + + protected function generateScript() + { + $reflMethod = new \ReflectionMethod('Monolog\Handler\BrowserConsoleHandler', 'generateScript'); + $reflMethod->setAccessible(true); + + return $reflMethod->invoke(null); + } + + public function testStyling() + { + $handler = new BrowserConsoleHandler(); + $handler->setFormatter($this->getIdentityFormatter()); + + $handler->handle($this->getRecord(Logger::DEBUG, 'foo[[bar]]{color: red}')); + + $expected = <<assertEquals($expected, $this->generateScript()); + } + + public function testEscaping() + { + $handler = new BrowserConsoleHandler(); + $handler->setFormatter($this->getIdentityFormatter()); + + $handler->handle($this->getRecord(Logger::DEBUG, "[foo] [[\"bar\n[baz]\"]]{color: red}")); + + $expected = <<assertEquals($expected, $this->generateScript()); + } + + public function testAutolabel() + { + $handler = new BrowserConsoleHandler(); + $handler->setFormatter($this->getIdentityFormatter()); + + $handler->handle($this->getRecord(Logger::DEBUG, '[[foo]]{macro: autolabel}')); + $handler->handle($this->getRecord(Logger::DEBUG, '[[bar]]{macro: autolabel}')); + $handler->handle($this->getRecord(Logger::DEBUG, '[[foo]]{macro: autolabel}')); + + $expected = <<assertEquals($expected, $this->generateScript()); + } + + public function testContext() + { + $handler = new BrowserConsoleHandler(); + $handler->setFormatter($this->getIdentityFormatter()); + + $handler->handle($this->getRecord(Logger::DEBUG, 'test', array('foo' => 'bar'))); + + $expected = <<assertEquals($expected, $this->generateScript()); + } + + public function testConcurrentHandlers() + { + $handler1 = new BrowserConsoleHandler(); + $handler1->setFormatter($this->getIdentityFormatter()); + + $handler2 = new BrowserConsoleHandler(); + $handler2->setFormatter($this->getIdentityFormatter()); + + $handler1->handle($this->getRecord(Logger::DEBUG, 'test1')); + $handler2->handle($this->getRecord(Logger::DEBUG, 'test2')); + $handler1->handle($this->getRecord(Logger::DEBUG, 'test3')); + $handler2->handle($this->getRecord(Logger::DEBUG, 'test4')); + + $expected = <<assertEquals($expected, $this->generateScript()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/BufferHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/BufferHandlerTest.php new file mode 100644 index 0000000..da8b3c3 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/BufferHandlerTest.php @@ -0,0 +1,158 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +class BufferHandlerTest extends TestCase +{ + private $shutdownCheckHandler; + + /** + * @covers Monolog\Handler\BufferHandler::__construct + * @covers Monolog\Handler\BufferHandler::handle + * @covers Monolog\Handler\BufferHandler::close + */ + public function testHandleBuffers() + { + $test = new TestHandler(); + $handler = new BufferHandler($test); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::INFO)); + $this->assertFalse($test->hasDebugRecords()); + $this->assertFalse($test->hasInfoRecords()); + $handler->close(); + $this->assertTrue($test->hasInfoRecords()); + $this->assertTrue(count($test->getRecords()) === 2); + } + + /** + * @covers Monolog\Handler\BufferHandler::close + * @covers Monolog\Handler\BufferHandler::flush + */ + public function testPropagatesRecordsAtEndOfRequest() + { + $test = new TestHandler(); + $handler = new BufferHandler($test); + $handler->handle($this->getRecord(Logger::WARNING)); + $handler->handle($this->getRecord(Logger::DEBUG)); + $this->shutdownCheckHandler = $test; + register_shutdown_function(array($this, 'checkPropagation')); + } + + public function checkPropagation() + { + if (!$this->shutdownCheckHandler->hasWarningRecords() || !$this->shutdownCheckHandler->hasDebugRecords()) { + echo '!!! BufferHandlerTest::testPropagatesRecordsAtEndOfRequest failed to verify that the messages have been propagated' . PHP_EOL; + exit(1); + } + } + + /** + * @covers Monolog\Handler\BufferHandler::handle + */ + public function testHandleBufferLimit() + { + $test = new TestHandler(); + $handler = new BufferHandler($test, 2); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::INFO)); + $handler->handle($this->getRecord(Logger::WARNING)); + $handler->close(); + $this->assertTrue($test->hasWarningRecords()); + $this->assertTrue($test->hasInfoRecords()); + $this->assertFalse($test->hasDebugRecords()); + } + + /** + * @covers Monolog\Handler\BufferHandler::handle + */ + public function testHandleBufferLimitWithFlushOnOverflow() + { + $test = new TestHandler(); + $handler = new BufferHandler($test, 3, Logger::DEBUG, true, true); + + // send two records + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::DEBUG)); + $this->assertFalse($test->hasDebugRecords()); + $this->assertCount(0, $test->getRecords()); + + // overflow + $handler->handle($this->getRecord(Logger::INFO)); + $this->assertTrue($test->hasDebugRecords()); + $this->assertCount(3, $test->getRecords()); + + // should buffer again + $handler->handle($this->getRecord(Logger::WARNING)); + $this->assertCount(3, $test->getRecords()); + + $handler->close(); + $this->assertCount(5, $test->getRecords()); + $this->assertTrue($test->hasWarningRecords()); + $this->assertTrue($test->hasInfoRecords()); + } + + /** + * @covers Monolog\Handler\BufferHandler::handle + */ + public function testHandleLevel() + { + $test = new TestHandler(); + $handler = new BufferHandler($test, 0, Logger::INFO); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::INFO)); + $handler->handle($this->getRecord(Logger::WARNING)); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->close(); + $this->assertTrue($test->hasWarningRecords()); + $this->assertTrue($test->hasInfoRecords()); + $this->assertFalse($test->hasDebugRecords()); + } + + /** + * @covers Monolog\Handler\BufferHandler::flush + */ + public function testFlush() + { + $test = new TestHandler(); + $handler = new BufferHandler($test, 0); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::INFO)); + $handler->flush(); + $this->assertTrue($test->hasInfoRecords()); + $this->assertTrue($test->hasDebugRecords()); + $this->assertFalse($test->hasWarningRecords()); + } + + /** + * @covers Monolog\Handler\BufferHandler::handle + */ + public function testHandleUsesProcessors() + { + $test = new TestHandler(); + $handler = new BufferHandler($test); + $handler->pushProcessor(function ($record) { + $record['extra']['foo'] = true; + + return $record; + }); + $handler->handle($this->getRecord(Logger::WARNING)); + $handler->flush(); + $this->assertTrue($test->hasWarningRecords()); + $records = $test->getRecords(); + $this->assertTrue($records[0]['extra']['foo']); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php new file mode 100644 index 0000000..421cc49 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php @@ -0,0 +1,156 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +/** + * @covers Monolog\Handler\ChromePHPHandler + */ +class ChromePHPHandlerTest extends TestCase +{ + protected function setUp() + { + TestChromePHPHandler::resetStatic(); + $_SERVER['HTTP_USER_AGENT'] = 'Monolog Test; Chrome/1.0'; + } + + /** + * @dataProvider agentsProvider + */ + public function testHeaders($agent) + { + $_SERVER['HTTP_USER_AGENT'] = $agent; + + $handler = new TestChromePHPHandler(); + $handler->setFormatter($this->getIdentityFormatter()); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::WARNING)); + + $expected = array( + 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array( + 'version' => ChromePHPHandler::VERSION, + 'columns' => array('label', 'log', 'backtrace', 'type'), + 'rows' => array( + 'test', + 'test', + ), + 'request_uri' => '', + )))), + ); + + $this->assertEquals($expected, $handler->getHeaders()); + } + + public static function agentsProvider() + { + return array( + array('Monolog Test; Chrome/1.0'), + array('Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0'), + array('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/56.0.2924.76 Chrome/56.0.2924.76 Safari/537.36'), + array('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome Safari/537.36'), + ); + } + + public function testHeadersOverflow() + { + $handler = new TestChromePHPHandler(); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 150 * 1024))); + + // overflow chrome headers limit + $handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 100 * 1024))); + + $expected = array( + 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array( + 'version' => ChromePHPHandler::VERSION, + 'columns' => array('label', 'log', 'backtrace', 'type'), + 'rows' => array( + array( + 'test', + 'test', + 'unknown', + 'log', + ), + array( + 'test', + str_repeat('a', 150 * 1024), + 'unknown', + 'warn', + ), + array( + 'monolog', + 'Incomplete logs, chrome header size limit reached', + 'unknown', + 'warn', + ), + ), + 'request_uri' => '', + )))), + ); + + $this->assertEquals($expected, $handler->getHeaders()); + } + + public function testConcurrentHandlers() + { + $handler = new TestChromePHPHandler(); + $handler->setFormatter($this->getIdentityFormatter()); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::WARNING)); + + $handler2 = new TestChromePHPHandler(); + $handler2->setFormatter($this->getIdentityFormatter()); + $handler2->handle($this->getRecord(Logger::DEBUG)); + $handler2->handle($this->getRecord(Logger::WARNING)); + + $expected = array( + 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array( + 'version' => ChromePHPHandler::VERSION, + 'columns' => array('label', 'log', 'backtrace', 'type'), + 'rows' => array( + 'test', + 'test', + 'test', + 'test', + ), + 'request_uri' => '', + )))), + ); + + $this->assertEquals($expected, $handler2->getHeaders()); + } +} + +class TestChromePHPHandler extends ChromePHPHandler +{ + protected $headers = array(); + + public static function resetStatic() + { + self::$initialized = false; + self::$overflowed = false; + self::$sendHeaders = true; + self::$json['rows'] = array(); + } + + protected function sendHeader($header, $content) + { + $this->headers[$header] = $content; + } + + public function getHeaders() + { + return $this->headers; + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/CouchDBHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/CouchDBHandlerTest.php new file mode 100644 index 0000000..9fc4b38 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/CouchDBHandlerTest.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +class CouchDBHandlerTest extends TestCase +{ + public function testHandle() + { + $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); + + $handler = new CouchDBHandler(); + + try { + $handler->handle($record); + } catch (\RuntimeException $e) { + $this->markTestSkipped('Could not connect to couchdb server on http://localhost:5984'); + } + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/DeduplicationHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/DeduplicationHandlerTest.php new file mode 100644 index 0000000..e2aff86 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/DeduplicationHandlerTest.php @@ -0,0 +1,165 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +class DeduplicationHandlerTest extends TestCase +{ + /** + * @covers Monolog\Handler\DeduplicationHandler::flush + */ + public function testFlushPassthruIfAllRecordsUnderTrigger() + { + $test = new TestHandler(); + @unlink(sys_get_temp_dir().'/monolog_dedup.log'); + $handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0); + + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::INFO)); + + $handler->flush(); + + $this->assertTrue($test->hasInfoRecords()); + $this->assertTrue($test->hasDebugRecords()); + $this->assertFalse($test->hasWarningRecords()); + } + + /** + * @covers Monolog\Handler\DeduplicationHandler::flush + * @covers Monolog\Handler\DeduplicationHandler::appendRecord + */ + public function testFlushPassthruIfEmptyLog() + { + $test = new TestHandler(); + @unlink(sys_get_temp_dir().'/monolog_dedup.log'); + $handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0); + + $handler->handle($this->getRecord(Logger::ERROR, 'Foo:bar')); + $handler->handle($this->getRecord(Logger::CRITICAL, "Foo\nbar")); + + $handler->flush(); + + $this->assertTrue($test->hasErrorRecords()); + $this->assertTrue($test->hasCriticalRecords()); + $this->assertFalse($test->hasWarningRecords()); + } + + /** + * @covers Monolog\Handler\DeduplicationHandler::flush + * @covers Monolog\Handler\DeduplicationHandler::appendRecord + * @covers Monolog\Handler\DeduplicationHandler::isDuplicate + * @depends testFlushPassthruIfEmptyLog + */ + public function testFlushSkipsIfLogExists() + { + $test = new TestHandler(); + $handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0); + + $handler->handle($this->getRecord(Logger::ERROR, 'Foo:bar')); + $handler->handle($this->getRecord(Logger::CRITICAL, "Foo\nbar")); + + $handler->flush(); + + $this->assertFalse($test->hasErrorRecords()); + $this->assertFalse($test->hasCriticalRecords()); + $this->assertFalse($test->hasWarningRecords()); + } + + /** + * @covers Monolog\Handler\DeduplicationHandler::flush + * @covers Monolog\Handler\DeduplicationHandler::appendRecord + * @covers Monolog\Handler\DeduplicationHandler::isDuplicate + * @depends testFlushPassthruIfEmptyLog + */ + public function testFlushPassthruIfLogTooOld() + { + $test = new TestHandler(); + $handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0); + + $record = $this->getRecord(Logger::ERROR); + $record['datetime']->modify('+62seconds'); + $handler->handle($record); + $record = $this->getRecord(Logger::CRITICAL); + $record['datetime']->modify('+62seconds'); + $handler->handle($record); + + $handler->flush(); + + $this->assertTrue($test->hasErrorRecords()); + $this->assertTrue($test->hasCriticalRecords()); + $this->assertFalse($test->hasWarningRecords()); + } + + /** + * @covers Monolog\Handler\DeduplicationHandler::flush + * @covers Monolog\Handler\DeduplicationHandler::appendRecord + * @covers Monolog\Handler\DeduplicationHandler::isDuplicate + * @covers Monolog\Handler\DeduplicationHandler::collectLogs + */ + public function testGcOldLogs() + { + $test = new TestHandler(); + @unlink(sys_get_temp_dir().'/monolog_dedup.log'); + $handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0); + + // handle two records from yesterday, and one recent + $record = $this->getRecord(Logger::ERROR); + $record['datetime']->modify('-1day -10seconds'); + $handler->handle($record); + $record2 = $this->getRecord(Logger::CRITICAL); + $record2['datetime']->modify('-1day -10seconds'); + $handler->handle($record2); + $record3 = $this->getRecord(Logger::CRITICAL); + $record3['datetime']->modify('-30seconds'); + $handler->handle($record3); + + // log is written as none of them are duplicate + $handler->flush(); + $this->assertSame( + $record['datetime']->getTimestamp() . ":ERROR:test\n" . + $record2['datetime']->getTimestamp() . ":CRITICAL:test\n" . + $record3['datetime']->getTimestamp() . ":CRITICAL:test\n", + file_get_contents(sys_get_temp_dir() . '/monolog_dedup.log') + ); + $this->assertTrue($test->hasErrorRecords()); + $this->assertTrue($test->hasCriticalRecords()); + $this->assertFalse($test->hasWarningRecords()); + + // clear test handler + $test->clear(); + $this->assertFalse($test->hasErrorRecords()); + $this->assertFalse($test->hasCriticalRecords()); + + // log new records, duplicate log gets GC'd at the end of this flush call + $handler->handle($record = $this->getRecord(Logger::ERROR)); + $handler->handle($record2 = $this->getRecord(Logger::CRITICAL)); + $handler->flush(); + + // log should now contain the new errors and the previous one that was recent enough + $this->assertSame( + $record3['datetime']->getTimestamp() . ":CRITICAL:test\n" . + $record['datetime']->getTimestamp() . ":ERROR:test\n" . + $record2['datetime']->getTimestamp() . ":CRITICAL:test\n", + file_get_contents(sys_get_temp_dir() . '/monolog_dedup.log') + ); + $this->assertTrue($test->hasErrorRecords()); + $this->assertTrue($test->hasCriticalRecords()); + $this->assertFalse($test->hasWarningRecords()); + } + + public static function tearDownAfterClass() + { + @unlink(sys_get_temp_dir().'/monolog_dedup.log'); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/DoctrineCouchDBHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/DoctrineCouchDBHandlerTest.php new file mode 100644 index 0000000..d67da90 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/DoctrineCouchDBHandlerTest.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +class DoctrineCouchDBHandlerTest extends TestCase +{ + protected function setup() + { + if (!class_exists('Doctrine\CouchDB\CouchDBClient')) { + $this->markTestSkipped('The "doctrine/couchdb" package is not installed'); + } + } + + public function testHandle() + { + $client = $this->getMockBuilder('Doctrine\\CouchDB\\CouchDBClient') + ->setMethods(array('postDocument')) + ->disableOriginalConstructor() + ->getMock(); + + $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); + + $expected = array( + 'message' => 'test', + 'context' => array('data' => '[object] (stdClass: {})', 'foo' => 34), + 'level' => Logger::WARNING, + 'level_name' => 'WARNING', + 'channel' => 'test', + 'datetime' => $record['datetime']->format('Y-m-d H:i:s'), + 'extra' => array(), + ); + + $client->expects($this->once()) + ->method('postDocument') + ->with($expected); + + $handler = new DoctrineCouchDBHandler($client); + $handler->handle($record); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php new file mode 100644 index 0000000..2e6c348 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; + +class DynamoDbHandlerTest extends TestCase +{ + private $client; + + public function setUp() + { + if (!class_exists('Aws\DynamoDb\DynamoDbClient')) { + $this->markTestSkipped('aws/aws-sdk-php not installed'); + } + + $this->client = $this->getMockBuilder('Aws\DynamoDb\DynamoDbClient') + ->setMethods(array('formatAttributes', '__call')) + ->disableOriginalConstructor()->getMock(); + } + + public function testConstruct() + { + $this->assertInstanceOf('Monolog\Handler\DynamoDbHandler', new DynamoDbHandler($this->client, 'foo')); + } + + public function testInterface() + { + $this->assertInstanceOf('Monolog\Handler\HandlerInterface', new DynamoDbHandler($this->client, 'foo')); + } + + public function testGetFormatter() + { + $handler = new DynamoDbHandler($this->client, 'foo'); + $this->assertInstanceOf('Monolog\Formatter\ScalarFormatter', $handler->getFormatter()); + } + + public function testHandle() + { + $record = $this->getRecord(); + $formatter = $this->getMock('Monolog\Formatter\FormatterInterface'); + $formatted = array('foo' => 1, 'bar' => 2); + $handler = new DynamoDbHandler($this->client, 'foo'); + $handler->setFormatter($formatter); + + $isV3 = defined('Aws\Sdk::VERSION') && version_compare(\Aws\Sdk::VERSION, '3.0', '>='); + if ($isV3) { + $expFormatted = array('foo' => array('N' => 1), 'bar' => array('N' => 2)); + } else { + $expFormatted = $formatted; + } + + $formatter + ->expects($this->once()) + ->method('format') + ->with($record) + ->will($this->returnValue($formatted)); + $this->client + ->expects($isV3 ? $this->never() : $this->once()) + ->method('formatAttributes') + ->with($this->isType('array')) + ->will($this->returnValue($formatted)); + $this->client + ->expects($this->once()) + ->method('__call') + ->with('putItem', array(array( + 'TableName' => 'foo', + 'Item' => $expFormatted, + ))); + + $handler->handle($record); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php new file mode 100644 index 0000000..1687074 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php @@ -0,0 +1,239 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\ElasticaFormatter; +use Monolog\Formatter\NormalizerFormatter; +use Monolog\TestCase; +use Monolog\Logger; +use Elastica\Client; +use Elastica\Request; +use Elastica\Response; + +class ElasticSearchHandlerTest extends TestCase +{ + /** + * @var Client mock + */ + protected $client; + + /** + * @var array Default handler options + */ + protected $options = array( + 'index' => 'my_index', + 'type' => 'doc_type', + ); + + public function setUp() + { + // Elastica lib required + if (!class_exists("Elastica\Client")) { + $this->markTestSkipped("ruflin/elastica not installed"); + } + + // base mock Elastica Client object + $this->client = $this->getMockBuilder('Elastica\Client') + ->setMethods(array('addDocuments')) + ->disableOriginalConstructor() + ->getMock(); + } + + /** + * @covers Monolog\Handler\ElasticSearchHandler::write + * @covers Monolog\Handler\ElasticSearchHandler::handleBatch + * @covers Monolog\Handler\ElasticSearchHandler::bulkSend + * @covers Monolog\Handler\ElasticSearchHandler::getDefaultFormatter + */ + public function testHandle() + { + // log message + $msg = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('foo' => 7, 'bar', 'class' => new \stdClass), + 'datetime' => new \DateTime("@0"), + 'extra' => array(), + 'message' => 'log', + ); + + // format expected result + $formatter = new ElasticaFormatter($this->options['index'], $this->options['type']); + $expected = array($formatter->format($msg)); + + // setup ES client mock + $this->client->expects($this->any()) + ->method('addDocuments') + ->with($expected); + + // perform tests + $handler = new ElasticSearchHandler($this->client, $this->options); + $handler->handle($msg); + $handler->handleBatch(array($msg)); + } + + /** + * @covers Monolog\Handler\ElasticSearchHandler::setFormatter + */ + public function testSetFormatter() + { + $handler = new ElasticSearchHandler($this->client); + $formatter = new ElasticaFormatter('index_new', 'type_new'); + $handler->setFormatter($formatter); + $this->assertInstanceOf('Monolog\Formatter\ElasticaFormatter', $handler->getFormatter()); + $this->assertEquals('index_new', $handler->getFormatter()->getIndex()); + $this->assertEquals('type_new', $handler->getFormatter()->getType()); + } + + /** + * @covers Monolog\Handler\ElasticSearchHandler::setFormatter + * @expectedException InvalidArgumentException + * @expectedExceptionMessage ElasticSearchHandler is only compatible with ElasticaFormatter + */ + public function testSetFormatterInvalid() + { + $handler = new ElasticSearchHandler($this->client); + $formatter = new NormalizerFormatter(); + $handler->setFormatter($formatter); + } + + /** + * @covers Monolog\Handler\ElasticSearchHandler::__construct + * @covers Monolog\Handler\ElasticSearchHandler::getOptions + */ + public function testOptions() + { + $expected = array( + 'index' => $this->options['index'], + 'type' => $this->options['type'], + 'ignore_error' => false, + ); + $handler = new ElasticSearchHandler($this->client, $this->options); + $this->assertEquals($expected, $handler->getOptions()); + } + + /** + * @covers Monolog\Handler\ElasticSearchHandler::bulkSend + * @dataProvider providerTestConnectionErrors + */ + public function testConnectionErrors($ignore, $expectedError) + { + $clientOpts = array('host' => '127.0.0.1', 'port' => 1); + $client = new Client($clientOpts); + $handlerOpts = array('ignore_error' => $ignore); + $handler = new ElasticSearchHandler($client, $handlerOpts); + + if ($expectedError) { + $this->setExpectedException($expectedError[0], $expectedError[1]); + $handler->handle($this->getRecord()); + } else { + $this->assertFalse($handler->handle($this->getRecord())); + } + } + + /** + * @return array + */ + public function providerTestConnectionErrors() + { + return array( + array(false, array('RuntimeException', 'Error sending messages to Elasticsearch')), + array(true, false), + ); + } + + /** + * Integration test using localhost Elastic Search server + * + * @covers Monolog\Handler\ElasticSearchHandler::__construct + * @covers Monolog\Handler\ElasticSearchHandler::handleBatch + * @covers Monolog\Handler\ElasticSearchHandler::bulkSend + * @covers Monolog\Handler\ElasticSearchHandler::getDefaultFormatter + */ + public function testHandleIntegration() + { + $msg = array( + 'level' => Logger::ERROR, + 'level_name' => 'ERROR', + 'channel' => 'meh', + 'context' => array('foo' => 7, 'bar', 'class' => new \stdClass), + 'datetime' => new \DateTime("@0"), + 'extra' => array(), + 'message' => 'log', + ); + + $expected = $msg; + $expected['datetime'] = $msg['datetime']->format(\DateTime::ISO8601); + $expected['context'] = array( + 'class' => '[object] (stdClass: {})', + 'foo' => 7, + 0 => 'bar', + ); + + $client = new Client(); + $handler = new ElasticSearchHandler($client, $this->options); + try { + $handler->handleBatch(array($msg)); + } catch (\RuntimeException $e) { + $this->markTestSkipped("Cannot connect to Elastic Search server on localhost"); + } + + // check document id from ES server response + $documentId = $this->getCreatedDocId($client->getLastResponse()); + $this->assertNotEmpty($documentId, 'No elastic document id received'); + + // retrieve document source from ES and validate + $document = $this->getDocSourceFromElastic( + $client, + $this->options['index'], + $this->options['type'], + $documentId + ); + $this->assertEquals($expected, $document); + + // remove test index from ES + $client->request("/{$this->options['index']}", Request::DELETE); + } + + /** + * Return last created document id from ES response + * @param Response $response Elastica Response object + * @return string|null + */ + protected function getCreatedDocId(Response $response) + { + $data = $response->getData(); + if (!empty($data['items'][0]['create']['_id'])) { + return $data['items'][0]['create']['_id']; + } + } + + /** + * Retrieve document by id from Elasticsearch + * @param Client $client Elastica client + * @param string $index + * @param string $type + * @param string $documentId + * @return array + */ + protected function getDocSourceFromElastic(Client $client, $index, $type, $documentId) + { + $resp = $client->request("/{$index}/{$type}/{$documentId}", Request::GET); + $data = $resp->getData(); + if (!empty($data['_source'])) { + return $data['_source']; + } + + return array(); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php new file mode 100644 index 0000000..99785cb --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; +use Monolog\Formatter\LineFormatter; + +function error_log() +{ + $GLOBALS['error_log'][] = func_get_args(); +} + +class ErrorLogHandlerTest extends TestCase +{ + protected function setUp() + { + $GLOBALS['error_log'] = array(); + } + + /** + * @covers Monolog\Handler\ErrorLogHandler::__construct + * @expectedException InvalidArgumentException + * @expectedExceptionMessage The given message type "42" is not supported + */ + public function testShouldNotAcceptAnInvalidTypeOnContructor() + { + new ErrorLogHandler(42); + } + + /** + * @covers Monolog\Handler\ErrorLogHandler::write + */ + public function testShouldLogMessagesUsingErrorLogFuncion() + { + $type = ErrorLogHandler::OPERATING_SYSTEM; + $handler = new ErrorLogHandler($type); + $handler->setFormatter(new LineFormatter('%channel%.%level_name%: %message% %context% %extra%', null, true)); + $handler->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz")); + + $this->assertSame("test.ERROR: Foo\nBar\r\n\r\nBaz [] []", $GLOBALS['error_log'][0][0]); + $this->assertSame($GLOBALS['error_log'][0][1], $type); + + $handler = new ErrorLogHandler($type, Logger::DEBUG, true, true); + $handler->setFormatter(new LineFormatter(null, null, true)); + $handler->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz")); + + $this->assertStringMatchesFormat('[%s] test.ERROR: Foo', $GLOBALS['error_log'][1][0]); + $this->assertSame($GLOBALS['error_log'][1][1], $type); + + $this->assertStringMatchesFormat('Bar', $GLOBALS['error_log'][2][0]); + $this->assertSame($GLOBALS['error_log'][2][1], $type); + + $this->assertStringMatchesFormat('Baz [] []', $GLOBALS['error_log'][3][0]); + $this->assertSame($GLOBALS['error_log'][3][1], $type); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php new file mode 100644 index 0000000..31b7686 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php @@ -0,0 +1,170 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\TestCase; + +class FilterHandlerTest extends TestCase +{ + /** + * @covers Monolog\Handler\FilterHandler::isHandling + */ + public function testIsHandling() + { + $test = new TestHandler(); + $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE); + $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); + $this->assertTrue($handler->isHandling($this->getRecord(Logger::INFO))); + $this->assertTrue($handler->isHandling($this->getRecord(Logger::NOTICE))); + $this->assertFalse($handler->isHandling($this->getRecord(Logger::WARNING))); + $this->assertFalse($handler->isHandling($this->getRecord(Logger::ERROR))); + $this->assertFalse($handler->isHandling($this->getRecord(Logger::CRITICAL))); + $this->assertFalse($handler->isHandling($this->getRecord(Logger::ALERT))); + $this->assertFalse($handler->isHandling($this->getRecord(Logger::EMERGENCY))); + } + + /** + * @covers Monolog\Handler\FilterHandler::handle + * @covers Monolog\Handler\FilterHandler::setAcceptedLevels + * @covers Monolog\Handler\FilterHandler::isHandling + */ + public function testHandleProcessOnlyNeededLevels() + { + $test = new TestHandler(); + $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE); + + $handler->handle($this->getRecord(Logger::DEBUG)); + $this->assertFalse($test->hasDebugRecords()); + + $handler->handle($this->getRecord(Logger::INFO)); + $this->assertTrue($test->hasInfoRecords()); + $handler->handle($this->getRecord(Logger::NOTICE)); + $this->assertTrue($test->hasNoticeRecords()); + + $handler->handle($this->getRecord(Logger::WARNING)); + $this->assertFalse($test->hasWarningRecords()); + $handler->handle($this->getRecord(Logger::ERROR)); + $this->assertFalse($test->hasErrorRecords()); + $handler->handle($this->getRecord(Logger::CRITICAL)); + $this->assertFalse($test->hasCriticalRecords()); + $handler->handle($this->getRecord(Logger::ALERT)); + $this->assertFalse($test->hasAlertRecords()); + $handler->handle($this->getRecord(Logger::EMERGENCY)); + $this->assertFalse($test->hasEmergencyRecords()); + + $test = new TestHandler(); + $handler = new FilterHandler($test, array(Logger::INFO, Logger::ERROR)); + + $handler->handle($this->getRecord(Logger::DEBUG)); + $this->assertFalse($test->hasDebugRecords()); + $handler->handle($this->getRecord(Logger::INFO)); + $this->assertTrue($test->hasInfoRecords()); + $handler->handle($this->getRecord(Logger::NOTICE)); + $this->assertFalse($test->hasNoticeRecords()); + $handler->handle($this->getRecord(Logger::ERROR)); + $this->assertTrue($test->hasErrorRecords()); + $handler->handle($this->getRecord(Logger::CRITICAL)); + $this->assertFalse($test->hasCriticalRecords()); + } + + /** + * @covers Monolog\Handler\FilterHandler::setAcceptedLevels + * @covers Monolog\Handler\FilterHandler::getAcceptedLevels + */ + public function testAcceptedLevelApi() + { + $test = new TestHandler(); + $handler = new FilterHandler($test); + + $levels = array(Logger::INFO, Logger::ERROR); + $handler->setAcceptedLevels($levels); + $this->assertSame($levels, $handler->getAcceptedLevels()); + + $handler->setAcceptedLevels(array('info', 'error')); + $this->assertSame($levels, $handler->getAcceptedLevels()); + + $levels = array(Logger::CRITICAL, Logger::ALERT, Logger::EMERGENCY); + $handler->setAcceptedLevels(Logger::CRITICAL, Logger::EMERGENCY); + $this->assertSame($levels, $handler->getAcceptedLevels()); + + $handler->setAcceptedLevels('critical', 'emergency'); + $this->assertSame($levels, $handler->getAcceptedLevels()); + } + + /** + * @covers Monolog\Handler\FilterHandler::handle + */ + public function testHandleUsesProcessors() + { + $test = new TestHandler(); + $handler = new FilterHandler($test, Logger::DEBUG, Logger::EMERGENCY); + $handler->pushProcessor( + function ($record) { + $record['extra']['foo'] = true; + + return $record; + } + ); + $handler->handle($this->getRecord(Logger::WARNING)); + $this->assertTrue($test->hasWarningRecords()); + $records = $test->getRecords(); + $this->assertTrue($records[0]['extra']['foo']); + } + + /** + * @covers Monolog\Handler\FilterHandler::handle + */ + public function testHandleRespectsBubble() + { + $test = new TestHandler(); + + $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE, false); + $this->assertTrue($handler->handle($this->getRecord(Logger::INFO))); + $this->assertFalse($handler->handle($this->getRecord(Logger::WARNING))); + + $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE, true); + $this->assertFalse($handler->handle($this->getRecord(Logger::INFO))); + $this->assertFalse($handler->handle($this->getRecord(Logger::WARNING))); + } + + /** + * @covers Monolog\Handler\FilterHandler::handle + */ + public function testHandleWithCallback() + { + $test = new TestHandler(); + $handler = new FilterHandler( + function ($record, $handler) use ($test) { + return $test; + }, Logger::INFO, Logger::NOTICE, false + ); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::INFO)); + $this->assertFalse($test->hasDebugRecords()); + $this->assertTrue($test->hasInfoRecords()); + } + + /** + * @covers Monolog\Handler\FilterHandler::handle + * @expectedException \RuntimeException + */ + public function testHandleWithBadCallbackThrowsException() + { + $handler = new FilterHandler( + function ($record, $handler) { + return 'foo'; + } + ); + $handler->handle($this->getRecord(Logger::WARNING)); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php new file mode 100644 index 0000000..0ec3653 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php @@ -0,0 +1,279 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; +use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy; +use Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy; +use Psr\Log\LogLevel; + +class FingersCrossedHandlerTest extends TestCase +{ + /** + * @covers Monolog\Handler\FingersCrossedHandler::__construct + * @covers Monolog\Handler\FingersCrossedHandler::handle + * @covers Monolog\Handler\FingersCrossedHandler::activate + */ + public function testHandleBuffers() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::INFO)); + $this->assertFalse($test->hasDebugRecords()); + $this->assertFalse($test->hasInfoRecords()); + $handler->handle($this->getRecord(Logger::WARNING)); + $handler->close(); + $this->assertTrue($test->hasInfoRecords()); + $this->assertTrue(count($test->getRecords()) === 3); + } + + /** + * @covers Monolog\Handler\FingersCrossedHandler::handle + * @covers Monolog\Handler\FingersCrossedHandler::activate + */ + public function testHandleStopsBufferingAfterTrigger() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test); + $handler->handle($this->getRecord(Logger::WARNING)); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->close(); + $this->assertTrue($test->hasWarningRecords()); + $this->assertTrue($test->hasDebugRecords()); + } + + /** + * @covers Monolog\Handler\FingersCrossedHandler::handle + * @covers Monolog\Handler\FingersCrossedHandler::activate + * @covers Monolog\Handler\FingersCrossedHandler::reset + */ + public function testHandleResetBufferingAfterReset() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test); + $handler->handle($this->getRecord(Logger::WARNING)); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->reset(); + $handler->handle($this->getRecord(Logger::INFO)); + $handler->close(); + $this->assertTrue($test->hasWarningRecords()); + $this->assertTrue($test->hasDebugRecords()); + $this->assertFalse($test->hasInfoRecords()); + } + + /** + * @covers Monolog\Handler\FingersCrossedHandler::handle + * @covers Monolog\Handler\FingersCrossedHandler::activate + */ + public function testHandleResetBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test, Logger::WARNING, 0, false, false); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::WARNING)); + $handler->handle($this->getRecord(Logger::INFO)); + $handler->close(); + $this->assertTrue($test->hasWarningRecords()); + $this->assertTrue($test->hasDebugRecords()); + $this->assertFalse($test->hasInfoRecords()); + } + + /** + * @covers Monolog\Handler\FingersCrossedHandler::handle + * @covers Monolog\Handler\FingersCrossedHandler::activate + */ + public function testHandleBufferLimit() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test, Logger::WARNING, 2); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::INFO)); + $handler->handle($this->getRecord(Logger::WARNING)); + $this->assertTrue($test->hasWarningRecords()); + $this->assertTrue($test->hasInfoRecords()); + $this->assertFalse($test->hasDebugRecords()); + } + + /** + * @covers Monolog\Handler\FingersCrossedHandler::handle + * @covers Monolog\Handler\FingersCrossedHandler::activate + */ + public function testHandleWithCallback() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler(function ($record, $handler) use ($test) { + return $test; + }); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::INFO)); + $this->assertFalse($test->hasDebugRecords()); + $this->assertFalse($test->hasInfoRecords()); + $handler->handle($this->getRecord(Logger::WARNING)); + $this->assertTrue($test->hasInfoRecords()); + $this->assertTrue(count($test->getRecords()) === 3); + } + + /** + * @covers Monolog\Handler\FingersCrossedHandler::handle + * @covers Monolog\Handler\FingersCrossedHandler::activate + * @expectedException RuntimeException + */ + public function testHandleWithBadCallbackThrowsException() + { + $handler = new FingersCrossedHandler(function ($record, $handler) { + return 'foo'; + }); + $handler->handle($this->getRecord(Logger::WARNING)); + } + + /** + * @covers Monolog\Handler\FingersCrossedHandler::isHandling + */ + public function testIsHandlingAlways() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test, Logger::ERROR); + $this->assertTrue($handler->isHandling($this->getRecord(Logger::DEBUG))); + } + + /** + * @covers Monolog\Handler\FingersCrossedHandler::__construct + * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::__construct + * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::isHandlerActivated + */ + public function testErrorLevelActivationStrategy() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING)); + $handler->handle($this->getRecord(Logger::DEBUG)); + $this->assertFalse($test->hasDebugRecords()); + $handler->handle($this->getRecord(Logger::WARNING)); + $this->assertTrue($test->hasDebugRecords()); + $this->assertTrue($test->hasWarningRecords()); + } + + /** + * @covers Monolog\Handler\FingersCrossedHandler::__construct + * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::__construct + * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::isHandlerActivated + */ + public function testErrorLevelActivationStrategyWithPsrLevel() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy('warning')); + $handler->handle($this->getRecord(Logger::DEBUG)); + $this->assertFalse($test->hasDebugRecords()); + $handler->handle($this->getRecord(Logger::WARNING)); + $this->assertTrue($test->hasDebugRecords()); + $this->assertTrue($test->hasWarningRecords()); + } + + /** + * @covers Monolog\Handler\FingersCrossedHandler::__construct + * @covers Monolog\Handler\FingersCrossedHandler::activate + */ + public function testOverrideActivationStrategy() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy('warning')); + $handler->handle($this->getRecord(Logger::DEBUG)); + $this->assertFalse($test->hasDebugRecords()); + $handler->activate(); + $this->assertTrue($test->hasDebugRecords()); + $handler->handle($this->getRecord(Logger::INFO)); + $this->assertTrue($test->hasInfoRecords()); + } + + /** + * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct + * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated + */ + public function testChannelLevelActivationStrategy() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test, new ChannelLevelActivationStrategy(Logger::ERROR, array('othertest' => Logger::DEBUG))); + $handler->handle($this->getRecord(Logger::WARNING)); + $this->assertFalse($test->hasWarningRecords()); + $record = $this->getRecord(Logger::DEBUG); + $record['channel'] = 'othertest'; + $handler->handle($record); + $this->assertTrue($test->hasDebugRecords()); + $this->assertTrue($test->hasWarningRecords()); + } + + /** + * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct + * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated + */ + public function testChannelLevelActivationStrategyWithPsrLevels() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test, new ChannelLevelActivationStrategy('error', array('othertest' => 'debug'))); + $handler->handle($this->getRecord(Logger::WARNING)); + $this->assertFalse($test->hasWarningRecords()); + $record = $this->getRecord(Logger::DEBUG); + $record['channel'] = 'othertest'; + $handler->handle($record); + $this->assertTrue($test->hasDebugRecords()); + $this->assertTrue($test->hasWarningRecords()); + } + + /** + * @covers Monolog\Handler\FingersCrossedHandler::handle + * @covers Monolog\Handler\FingersCrossedHandler::activate + */ + public function testHandleUsesProcessors() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test, Logger::INFO); + $handler->pushProcessor(function ($record) { + $record['extra']['foo'] = true; + + return $record; + }); + $handler->handle($this->getRecord(Logger::WARNING)); + $this->assertTrue($test->hasWarningRecords()); + $records = $test->getRecords(); + $this->assertTrue($records[0]['extra']['foo']); + } + + /** + * @covers Monolog\Handler\FingersCrossedHandler::close + */ + public function testPassthruOnClose() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 0, true, true, Logger::INFO); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::INFO)); + $handler->close(); + $this->assertFalse($test->hasDebugRecords()); + $this->assertTrue($test->hasInfoRecords()); + } + + /** + * @covers Monolog\Handler\FingersCrossedHandler::close + */ + public function testPsrLevelPassthruOnClose() + { + $test = new TestHandler(); + $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 0, true, true, LogLevel::INFO); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::INFO)); + $handler->close(); + $this->assertFalse($test->hasDebugRecords()); + $this->assertTrue($test->hasInfoRecords()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php new file mode 100644 index 0000000..7a404e6 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php @@ -0,0 +1,96 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +/** + * @covers Monolog\Handler\FirePHPHandler + */ +class FirePHPHandlerTest extends TestCase +{ + public function setUp() + { + TestFirePHPHandler::resetStatic(); + $_SERVER['HTTP_USER_AGENT'] = 'Monolog Test; FirePHP/1.0'; + } + + public function testHeaders() + { + $handler = new TestFirePHPHandler; + $handler->setFormatter($this->getIdentityFormatter()); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::WARNING)); + + $expected = array( + 'X-Wf-Protocol-1' => 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2', + 'X-Wf-1-Structure-1' => 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1', + 'X-Wf-1-Plugin-1' => 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3', + 'X-Wf-1-1-1-1' => 'test', + 'X-Wf-1-1-1-2' => 'test', + ); + + $this->assertEquals($expected, $handler->getHeaders()); + } + + public function testConcurrentHandlers() + { + $handler = new TestFirePHPHandler; + $handler->setFormatter($this->getIdentityFormatter()); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::WARNING)); + + $handler2 = new TestFirePHPHandler; + $handler2->setFormatter($this->getIdentityFormatter()); + $handler2->handle($this->getRecord(Logger::DEBUG)); + $handler2->handle($this->getRecord(Logger::WARNING)); + + $expected = array( + 'X-Wf-Protocol-1' => 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2', + 'X-Wf-1-Structure-1' => 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1', + 'X-Wf-1-Plugin-1' => 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3', + 'X-Wf-1-1-1-1' => 'test', + 'X-Wf-1-1-1-2' => 'test', + ); + + $expected2 = array( + 'X-Wf-1-1-1-3' => 'test', + 'X-Wf-1-1-1-4' => 'test', + ); + + $this->assertEquals($expected, $handler->getHeaders()); + $this->assertEquals($expected2, $handler2->getHeaders()); + } +} + +class TestFirePHPHandler extends FirePHPHandler +{ + protected $headers = array(); + + public static function resetStatic() + { + self::$initialized = false; + self::$sendHeaders = true; + self::$messageIndex = 1; + } + + protected function sendHeader($header, $content) + { + $this->headers[$header] = $content; + } + + public function getHeaders() + { + return $this->headers; + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/Fixtures/.gitkeep b/vendor/monolog/monolog/tests/Monolog/Handler/Fixtures/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php new file mode 100644 index 0000000..91cdd31 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php @@ -0,0 +1,85 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\LineFormatter; +use Monolog\Logger; +use Monolog\TestCase; + +/** + * @coversDefaultClass \Monolog\Handler\FleepHookHandler + */ +class FleepHookHandlerTest extends TestCase +{ + /** + * Default token to use in tests + */ + const TOKEN = '123abc'; + + /** + * @var FleepHookHandler + */ + private $handler; + + public function setUp() + { + parent::setUp(); + + if (!extension_loaded('openssl')) { + $this->markTestSkipped('This test requires openssl extension to run'); + } + + // Create instances of the handler and logger for convenience + $this->handler = new FleepHookHandler(self::TOKEN); + } + + /** + * @covers ::__construct + */ + public function testConstructorSetsExpectedDefaults() + { + $this->assertEquals(Logger::DEBUG, $this->handler->getLevel()); + $this->assertEquals(true, $this->handler->getBubble()); + } + + /** + * @covers ::getDefaultFormatter + */ + public function testHandlerUsesLineFormatterWhichIgnoresEmptyArrays() + { + $record = array( + 'message' => 'msg', + 'context' => array(), + 'level' => Logger::DEBUG, + 'level_name' => Logger::getLevelName(Logger::DEBUG), + 'channel' => 'channel', + 'datetime' => new \DateTime(), + 'extra' => array(), + ); + + $expectedFormatter = new LineFormatter(null, null, true, true); + $expected = $expectedFormatter->format($record); + + $handlerFormatter = $this->handler->getFormatter(); + $actual = $handlerFormatter->format($record); + + $this->assertEquals($expected, $actual, 'Empty context and extra arrays should not be rendered'); + } + + /** + * @covers ::__construct + */ + public function testConnectionStringisConstructedCorrectly() + { + $this->assertEquals('ssl://' . FleepHookHandler::FLEEP_HOST . ':443', $this->handler->getConnectionString()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php new file mode 100644 index 0000000..4b120d5 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php @@ -0,0 +1,88 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\FlowdockFormatter; +use Monolog\TestCase; +use Monolog\Logger; + +/** + * @author Dominik Liebler + * @see https://www.hipchat.com/docs/api + */ +class FlowdockHandlerTest extends TestCase +{ + /** + * @var resource + */ + private $res; + + /** + * @var FlowdockHandler + */ + private $handler; + + public function setUp() + { + if (!extension_loaded('openssl')) { + $this->markTestSkipped('This test requires openssl to run'); + } + } + + public function testWriteHeader() + { + $this->createHandler(); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/POST \/v1\/messages\/team_inbox\/.* HTTP\/1.1\\r\\nHost: api.flowdock.com\\r\\nContent-Type: application\/json\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); + + return $content; + } + + /** + * @depends testWriteHeader + */ + public function testWriteContent($content) + { + $this->assertRegexp('/"source":"test_source"/', $content); + $this->assertRegexp('/"from_address":"source@test\.com"/', $content); + } + + private function createHandler($token = 'myToken') + { + $constructorArgs = array($token, Logger::DEBUG); + $this->res = fopen('php://memory', 'a'); + $this->handler = $this->getMock( + '\Monolog\Handler\FlowdockHandler', + array('fsockopen', 'streamSetTimeout', 'closeSocket'), + $constructorArgs + ); + + $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($this->handler, 'localhost:1234'); + + $this->handler->expects($this->any()) + ->method('fsockopen') + ->will($this->returnValue($this->res)); + $this->handler->expects($this->any()) + ->method('streamSetTimeout') + ->will($this->returnValue(true)); + $this->handler->expects($this->any()) + ->method('closeSocket') + ->will($this->returnValue(true)); + + $this->handler->setFormatter(new FlowdockFormatter('test_source', 'source@test.com')); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php new file mode 100644 index 0000000..9d007b1 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php @@ -0,0 +1,95 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Gelf\Message; +use Monolog\TestCase; +use Monolog\Logger; +use Monolog\Formatter\GelfMessageFormatter; + +class GelfHandlerLegacyTest extends TestCase +{ + public function setUp() + { + if (!class_exists('Gelf\MessagePublisher') || !class_exists('Gelf\Message')) { + $this->markTestSkipped("mlehner/gelf-php not installed"); + } + + require_once __DIR__ . '/GelfMockMessagePublisher.php'; + } + + /** + * @covers Monolog\Handler\GelfHandler::__construct + */ + public function testConstruct() + { + $handler = new GelfHandler($this->getMessagePublisher()); + $this->assertInstanceOf('Monolog\Handler\GelfHandler', $handler); + } + + protected function getHandler($messagePublisher) + { + $handler = new GelfHandler($messagePublisher); + + return $handler; + } + + protected function getMessagePublisher() + { + return new GelfMockMessagePublisher('localhost'); + } + + public function testDebug() + { + $messagePublisher = $this->getMessagePublisher(); + $handler = $this->getHandler($messagePublisher); + + $record = $this->getRecord(Logger::DEBUG, "A test debug message"); + $handler->handle($record); + + $this->assertEquals(7, $messagePublisher->lastMessage->getLevel()); + $this->assertEquals('test', $messagePublisher->lastMessage->getFacility()); + $this->assertEquals($record['message'], $messagePublisher->lastMessage->getShortMessage()); + $this->assertEquals(null, $messagePublisher->lastMessage->getFullMessage()); + } + + public function testWarning() + { + $messagePublisher = $this->getMessagePublisher(); + $handler = $this->getHandler($messagePublisher); + + $record = $this->getRecord(Logger::WARNING, "A test warning message"); + $handler->handle($record); + + $this->assertEquals(4, $messagePublisher->lastMessage->getLevel()); + $this->assertEquals('test', $messagePublisher->lastMessage->getFacility()); + $this->assertEquals($record['message'], $messagePublisher->lastMessage->getShortMessage()); + $this->assertEquals(null, $messagePublisher->lastMessage->getFullMessage()); + } + + public function testInjectedGelfMessageFormatter() + { + $messagePublisher = $this->getMessagePublisher(); + $handler = $this->getHandler($messagePublisher); + + $handler->setFormatter(new GelfMessageFormatter('mysystem', 'EXT', 'CTX')); + + $record = $this->getRecord(Logger::WARNING, "A test warning message"); + $record['extra']['blarg'] = 'yep'; + $record['context']['from'] = 'logger'; + $handler->handle($record); + + $this->assertEquals('mysystem', $messagePublisher->lastMessage->getHost()); + $this->assertArrayHasKey('_EXTblarg', $messagePublisher->lastMessage->toArray()); + $this->assertArrayHasKey('_CTXfrom', $messagePublisher->lastMessage->toArray()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php new file mode 100644 index 0000000..8cdd64f --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php @@ -0,0 +1,117 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Gelf\Message; +use Monolog\TestCase; +use Monolog\Logger; +use Monolog\Formatter\GelfMessageFormatter; + +class GelfHandlerTest extends TestCase +{ + public function setUp() + { + if (!class_exists('Gelf\Publisher') || !class_exists('Gelf\Message')) { + $this->markTestSkipped("graylog2/gelf-php not installed"); + } + } + + /** + * @covers Monolog\Handler\GelfHandler::__construct + */ + public function testConstruct() + { + $handler = new GelfHandler($this->getMessagePublisher()); + $this->assertInstanceOf('Monolog\Handler\GelfHandler', $handler); + } + + protected function getHandler($messagePublisher) + { + $handler = new GelfHandler($messagePublisher); + + return $handler; + } + + protected function getMessagePublisher() + { + return $this->getMock('Gelf\Publisher', array('publish'), array(), '', false); + } + + public function testDebug() + { + $record = $this->getRecord(Logger::DEBUG, "A test debug message"); + $expectedMessage = new Message(); + $expectedMessage + ->setLevel(7) + ->setFacility("test") + ->setShortMessage($record['message']) + ->setTimestamp($record['datetime']) + ; + + $messagePublisher = $this->getMessagePublisher(); + $messagePublisher->expects($this->once()) + ->method('publish') + ->with($expectedMessage); + + $handler = $this->getHandler($messagePublisher); + + $handler->handle($record); + } + + public function testWarning() + { + $record = $this->getRecord(Logger::WARNING, "A test warning message"); + $expectedMessage = new Message(); + $expectedMessage + ->setLevel(4) + ->setFacility("test") + ->setShortMessage($record['message']) + ->setTimestamp($record['datetime']) + ; + + $messagePublisher = $this->getMessagePublisher(); + $messagePublisher->expects($this->once()) + ->method('publish') + ->with($expectedMessage); + + $handler = $this->getHandler($messagePublisher); + + $handler->handle($record); + } + + public function testInjectedGelfMessageFormatter() + { + $record = $this->getRecord(Logger::WARNING, "A test warning message"); + $record['extra']['blarg'] = 'yep'; + $record['context']['from'] = 'logger'; + + $expectedMessage = new Message(); + $expectedMessage + ->setLevel(4) + ->setFacility("test") + ->setHost("mysystem") + ->setShortMessage($record['message']) + ->setTimestamp($record['datetime']) + ->setAdditional("EXTblarg", 'yep') + ->setAdditional("CTXfrom", 'logger') + ; + + $messagePublisher = $this->getMessagePublisher(); + $messagePublisher->expects($this->once()) + ->method('publish') + ->with($expectedMessage); + + $handler = $this->getHandler($messagePublisher); + $handler->setFormatter(new GelfMessageFormatter('mysystem', 'EXT', 'CTX')); + $handler->handle($record); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php b/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php new file mode 100644 index 0000000..873d92f --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Gelf\MessagePublisher; +use Gelf\Message; + +class GelfMockMessagePublisher extends MessagePublisher +{ + public function publish(Message $message) + { + $this->lastMessage = $message; + } + + public $lastMessage = null; +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php new file mode 100644 index 0000000..a1b8617 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +class GroupHandlerTest extends TestCase +{ + /** + * @covers Monolog\Handler\GroupHandler::__construct + * @expectedException InvalidArgumentException + */ + public function testConstructorOnlyTakesHandler() + { + new GroupHandler(array(new TestHandler(), "foo")); + } + + /** + * @covers Monolog\Handler\GroupHandler::__construct + * @covers Monolog\Handler\GroupHandler::handle + */ + public function testHandle() + { + $testHandlers = array(new TestHandler(), new TestHandler()); + $handler = new GroupHandler($testHandlers); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::INFO)); + foreach ($testHandlers as $test) { + $this->assertTrue($test->hasDebugRecords()); + $this->assertTrue($test->hasInfoRecords()); + $this->assertTrue(count($test->getRecords()) === 2); + } + } + + /** + * @covers Monolog\Handler\GroupHandler::handleBatch + */ + public function testHandleBatch() + { + $testHandlers = array(new TestHandler(), new TestHandler()); + $handler = new GroupHandler($testHandlers); + $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO))); + foreach ($testHandlers as $test) { + $this->assertTrue($test->hasDebugRecords()); + $this->assertTrue($test->hasInfoRecords()); + $this->assertTrue(count($test->getRecords()) === 2); + } + } + + /** + * @covers Monolog\Handler\GroupHandler::isHandling + */ + public function testIsHandling() + { + $testHandlers = array(new TestHandler(Logger::ERROR), new TestHandler(Logger::WARNING)); + $handler = new GroupHandler($testHandlers); + $this->assertTrue($handler->isHandling($this->getRecord(Logger::ERROR))); + $this->assertTrue($handler->isHandling($this->getRecord(Logger::WARNING))); + $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); + } + + /** + * @covers Monolog\Handler\GroupHandler::handle + */ + public function testHandleUsesProcessors() + { + $test = new TestHandler(); + $handler = new GroupHandler(array($test)); + $handler->pushProcessor(function ($record) { + $record['extra']['foo'] = true; + + return $record; + }); + $handler->handle($this->getRecord(Logger::WARNING)); + $this->assertTrue($test->hasWarningRecords()); + $records = $test->getRecords(); + $this->assertTrue($records[0]['extra']['foo']); + } + + /** + * @covers Monolog\Handler\GroupHandler::handle + */ + public function testHandleBatchUsesProcessors() + { + $testHandlers = array(new TestHandler(), new TestHandler()); + $handler = new GroupHandler($testHandlers); + $handler->pushProcessor(function ($record) { + $record['extra']['foo'] = true; + + return $record; + }); + $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO))); + foreach ($testHandlers as $test) { + $this->assertTrue($test->hasDebugRecords()); + $this->assertTrue($test->hasInfoRecords()); + $this->assertTrue(count($test->getRecords()) === 2); + $records = $test->getRecords(); + $this->assertTrue($records[0]['extra']['foo']); + $this->assertTrue($records[1]['extra']['foo']); + } + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/HandlerWrapperTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/HandlerWrapperTest.php new file mode 100644 index 0000000..d8d0452 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/HandlerWrapperTest.php @@ -0,0 +1,130 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; + +/** + * @author Alexey Karapetov + */ +class HandlerWrapperTest extends TestCase +{ + /** + * @var HandlerWrapper + */ + private $wrapper; + + private $handler; + + public function setUp() + { + parent::setUp(); + $this->handler = $this->getMock('Monolog\\Handler\\HandlerInterface'); + $this->wrapper = new HandlerWrapper($this->handler); + } + + /** + * @return array + */ + public function trueFalseDataProvider() + { + return array( + array(true), + array(false), + ); + } + + /** + * @param $result + * @dataProvider trueFalseDataProvider + */ + public function testIsHandling($result) + { + $record = $this->getRecord(); + $this->handler->expects($this->once()) + ->method('isHandling') + ->with($record) + ->willReturn($result); + + $this->assertEquals($result, $this->wrapper->isHandling($record)); + } + + /** + * @param $result + * @dataProvider trueFalseDataProvider + */ + public function testHandle($result) + { + $record = $this->getRecord(); + $this->handler->expects($this->once()) + ->method('handle') + ->with($record) + ->willReturn($result); + + $this->assertEquals($result, $this->wrapper->handle($record)); + } + + /** + * @param $result + * @dataProvider trueFalseDataProvider + */ + public function testHandleBatch($result) + { + $records = $this->getMultipleRecords(); + $this->handler->expects($this->once()) + ->method('handleBatch') + ->with($records) + ->willReturn($result); + + $this->assertEquals($result, $this->wrapper->handleBatch($records)); + } + + public function testPushProcessor() + { + $processor = function () {}; + $this->handler->expects($this->once()) + ->method('pushProcessor') + ->with($processor); + + $this->assertEquals($this->wrapper, $this->wrapper->pushProcessor($processor)); + } + + public function testPopProcessor() + { + $processor = function () {}; + $this->handler->expects($this->once()) + ->method('popProcessor') + ->willReturn($processor); + + $this->assertEquals($processor, $this->wrapper->popProcessor()); + } + + public function testSetFormatter() + { + $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); + $this->handler->expects($this->once()) + ->method('setFormatter') + ->with($formatter); + + $this->assertEquals($this->wrapper, $this->wrapper->setFormatter($formatter)); + } + + public function testGetFormatter() + { + $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); + $this->handler->expects($this->once()) + ->method('getFormatter') + ->willReturn($formatter); + + $this->assertEquals($formatter, $this->wrapper->getFormatter()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php new file mode 100644 index 0000000..52dc9da --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php @@ -0,0 +1,279 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +/** + * @author Rafael Dohms + * @see https://www.hipchat.com/docs/api + */ +class HipChatHandlerTest extends TestCase +{ + private $res; + /** @var HipChatHandler */ + private $handler; + + public function testWriteHeader() + { + $this->createHandler(); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/POST \/v1\/rooms\/message\?format=json&auth_token=.* HTTP\/1.1\\r\\nHost: api.hipchat.com\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); + + return $content; + } + + public function testWriteCustomHostHeader() + { + $this->createHandler('myToken', 'room1', 'Monolog', true, 'hipchat.foo.bar'); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/POST \/v1\/rooms\/message\?format=json&auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); + + return $content; + } + + public function testWriteV2() + { + $this->createHandler('myToken', 'room1', 'Monolog', false, 'hipchat.foo.bar', 'v2'); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/POST \/v2\/room\/room1\/notification\?auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); + + return $content; + } + + public function testWriteV2Notify() + { + $this->createHandler('myToken', 'room1', 'Monolog', true, 'hipchat.foo.bar', 'v2'); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/POST \/v2\/room\/room1\/notification\?auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); + + return $content; + } + + public function testRoomSpaces() + { + $this->createHandler('myToken', 'room name', 'Monolog', false, 'hipchat.foo.bar', 'v2'); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/POST \/v2\/room\/room%20name\/notification\?auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); + + return $content; + } + + /** + * @depends testWriteHeader + */ + public function testWriteContent($content) + { + $this->assertRegexp('/notify=0&message=test1&message_format=text&color=red&room_id=room1&from=Monolog$/', $content); + } + + public function testWriteContentV1WithoutName() + { + $this->createHandler('myToken', 'room1', null, false, 'hipchat.foo.bar', 'v1'); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/notify=0&message=test1&message_format=text&color=red&room_id=room1&from=$/', $content); + + return $content; + } + + /** + * @depends testWriteCustomHostHeader + */ + public function testWriteContentNotify($content) + { + $this->assertRegexp('/notify=1&message=test1&message_format=text&color=red&room_id=room1&from=Monolog$/', $content); + } + + /** + * @depends testWriteV2 + */ + public function testWriteContentV2($content) + { + $this->assertRegexp('/notify=false&message=test1&message_format=text&color=red&from=Monolog$/', $content); + } + + /** + * @depends testWriteV2Notify + */ + public function testWriteContentV2Notify($content) + { + $this->assertRegexp('/notify=true&message=test1&message_format=text&color=red&from=Monolog$/', $content); + } + + public function testWriteContentV2WithoutName() + { + $this->createHandler('myToken', 'room1', null, false, 'hipchat.foo.bar', 'v2'); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/notify=false&message=test1&message_format=text&color=red$/', $content); + + return $content; + } + + public function testWriteWithComplexMessage() + { + $this->createHandler(); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Backup of database "example" finished in 16 minutes.')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/message=Backup\+of\+database\+%22example%22\+finished\+in\+16\+minutes\./', $content); + } + + public function testWriteTruncatesLongMessage() + { + $this->createHandler(); + $this->handler->handle($this->getRecord(Logger::CRITICAL, str_repeat('abcde', 2000))); + fseek($this->res, 0); + $content = fread($this->res, 12000); + + $this->assertRegexp('/message='.str_repeat('abcde', 1900).'\+%5Btruncated%5D/', $content); + } + + /** + * @dataProvider provideLevelColors + */ + public function testWriteWithErrorLevelsAndColors($level, $expectedColor) + { + $this->createHandler(); + $this->handler->handle($this->getRecord($level, 'Backup of database "example" finished in 16 minutes.')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/color='.$expectedColor.'/', $content); + } + + public function provideLevelColors() + { + return array( + array(Logger::DEBUG, 'gray'), + array(Logger::INFO, 'green'), + array(Logger::WARNING, 'yellow'), + array(Logger::ERROR, 'red'), + array(Logger::CRITICAL, 'red'), + array(Logger::ALERT, 'red'), + array(Logger::EMERGENCY,'red'), + array(Logger::NOTICE, 'green'), + ); + } + + /** + * @dataProvider provideBatchRecords + */ + public function testHandleBatch($records, $expectedColor) + { + $this->createHandler(); + + $this->handler->handleBatch($records); + + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/color='.$expectedColor.'/', $content); + } + + public function provideBatchRecords() + { + return array( + array( + array( + array('level' => Logger::WARNING, 'message' => 'Oh bugger!', 'level_name' => 'warning', 'datetime' => new \DateTime()), + array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()), + array('level' => Logger::CRITICAL, 'message' => 'Everything is broken!', 'level_name' => 'critical', 'datetime' => new \DateTime()), + ), + 'red', + ), + array( + array( + array('level' => Logger::WARNING, 'message' => 'Oh bugger!', 'level_name' => 'warning', 'datetime' => new \DateTime()), + array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()), + ), + 'yellow', + ), + array( + array( + array('level' => Logger::DEBUG, 'message' => 'Just debugging.', 'level_name' => 'debug', 'datetime' => new \DateTime()), + array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()), + ), + 'green', + ), + array( + array( + array('level' => Logger::DEBUG, 'message' => 'Just debugging.', 'level_name' => 'debug', 'datetime' => new \DateTime()), + ), + 'gray', + ), + ); + } + + private function createHandler($token = 'myToken', $room = 'room1', $name = 'Monolog', $notify = false, $host = 'api.hipchat.com', $version = 'v1') + { + $constructorArgs = array($token, $room, $name, $notify, Logger::DEBUG, true, true, 'text', $host, $version); + $this->res = fopen('php://memory', 'a'); + $this->handler = $this->getMock( + '\Monolog\Handler\HipChatHandler', + array('fsockopen', 'streamSetTimeout', 'closeSocket'), + $constructorArgs + ); + + $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($this->handler, 'localhost:1234'); + + $this->handler->expects($this->any()) + ->method('fsockopen') + ->will($this->returnValue($this->res)); + $this->handler->expects($this->any()) + ->method('streamSetTimeout') + ->will($this->returnValue(true)); + $this->handler->expects($this->any()) + ->method('closeSocket') + ->will($this->returnValue(true)); + + $this->handler->setFormatter($this->getIdentityFormatter()); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testCreateWithTooLongName() + { + $hipChatHandler = new HipChatHandler('token', 'room', 'SixteenCharsHere'); + } + + public function testCreateWithTooLongNameV2() + { + // creating a handler with too long of a name but using the v2 api doesn't matter. + $hipChatHandler = new HipChatHandler('token', 'room', 'SixteenCharsHere', false, Logger::CRITICAL, true, true, 'test', 'api.hipchat.com', 'v2'); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/InsightOpsHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/InsightOpsHandlerTest.php new file mode 100644 index 0000000..97c18b5 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/InsightOpsHandlerTest.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + + namespace Monolog\Handler; + + use Monolog\TestCase; + use Monolog\Logger; + +/** + * @author Robert Kaufmann III + * @author Gabriel Machado + */ +class InsightOpsHandlerTest extends TestCase +{ + /** + * @var resource + */ + private $resource; + + /** + * @var LogEntriesHandler + */ + private $handler; + + public function testWriteContent() + { + $this->createHandler(); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Critical write test')); + + fseek($this->resource, 0); + $content = fread($this->resource, 1024); + + $this->assertRegexp('/testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] test.CRITICAL: Critical write test/', $content); + } + + public function testWriteBatchContent() + { + $this->createHandler(); + $this->handler->handleBatch($this->getMultipleRecords()); + + fseek($this->resource, 0); + $content = fread($this->resource, 1024); + + $this->assertRegexp('/(testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] .* \[\] \[\]\n){3}/', $content); + } + + private function createHandler() + { + $useSSL = extension_loaded('openssl'); + $args = array('testToken', 'us', $useSSL, Logger::DEBUG, true); + $this->resource = fopen('php://memory', 'a'); + $this->handler = $this->getMock( + '\Monolog\Handler\InsightOpsHandler', + array('fsockopen', 'streamSetTimeout', 'closeSocket'), + $args + ); + + $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($this->handler, 'localhost:1234'); + + $this->handler->expects($this->any()) + ->method('fsockopen') + ->will($this->returnValue($this->resource)); + $this->handler->expects($this->any()) + ->method('streamSetTimeout') + ->will($this->returnValue(true)); + $this->handler->expects($this->any()) + ->method('closeSocket') + ->will($this->returnValue(true)); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php new file mode 100644 index 0000000..b2deb40 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +/** + * @author Robert Kaufmann III + */ +class LogEntriesHandlerTest extends TestCase +{ + /** + * @var resource + */ + private $res; + + /** + * @var LogEntriesHandler + */ + private $handler; + + public function testWriteContent() + { + $this->createHandler(); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Critical write test')); + + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] test.CRITICAL: Critical write test/', $content); + } + + public function testWriteBatchContent() + { + $records = array( + $this->getRecord(), + $this->getRecord(), + $this->getRecord(), + ); + $this->createHandler(); + $this->handler->handleBatch($records); + + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/(testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] .* \[\] \[\]\n){3}/', $content); + } + + private function createHandler() + { + $useSSL = extension_loaded('openssl'); + $args = array('testToken', $useSSL, Logger::DEBUG, true); + $this->res = fopen('php://memory', 'a'); + $this->handler = $this->getMock( + '\Monolog\Handler\LogEntriesHandler', + array('fsockopen', 'streamSetTimeout', 'closeSocket'), + $args + ); + + $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($this->handler, 'localhost:1234'); + + $this->handler->expects($this->any()) + ->method('fsockopen') + ->will($this->returnValue($this->res)); + $this->handler->expects($this->any()) + ->method('streamSetTimeout') + ->will($this->returnValue(true)); + $this->handler->expects($this->any()) + ->method('closeSocket') + ->will($this->returnValue(true)); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php new file mode 100644 index 0000000..6754f3d --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php @@ -0,0 +1,75 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\TestCase; + +class MailHandlerTest extends TestCase +{ + /** + * @covers Monolog\Handler\MailHandler::handleBatch + */ + public function testHandleBatch() + { + $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); + $formatter->expects($this->once()) + ->method('formatBatch'); // Each record is formatted + + $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler'); + $handler->expects($this->once()) + ->method('send'); + $handler->expects($this->never()) + ->method('write'); // write is for individual records + + $handler->setFormatter($formatter); + + $handler->handleBatch($this->getMultipleRecords()); + } + + /** + * @covers Monolog\Handler\MailHandler::handleBatch + */ + public function testHandleBatchNotSendsMailIfMessagesAreBelowLevel() + { + $records = array( + $this->getRecord(Logger::DEBUG, 'debug message 1'), + $this->getRecord(Logger::DEBUG, 'debug message 2'), + $this->getRecord(Logger::INFO, 'information'), + ); + + $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler'); + $handler->expects($this->never()) + ->method('send'); + $handler->setLevel(Logger::ERROR); + + $handler->handleBatch($records); + } + + /** + * @covers Monolog\Handler\MailHandler::write + */ + public function testHandle() + { + $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler'); + + $record = $this->getRecord(); + $records = array($record); + $records[0]['formatted'] = '['.$record['datetime']->format('Y-m-d H:i:s').'] test.WARNING: test [] []'."\n"; + + $handler->expects($this->once()) + ->method('send') + ->with($records[0]['formatted'], $records); + + $handler->handle($record); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php b/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php new file mode 100644 index 0000000..a083322 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Raven_Client; + +class MockRavenClient extends Raven_Client +{ + public function capture($data, $stack, $vars = null) + { + $data = array_merge($this->get_user_data(), $data); + $this->lastData = $data; + $this->lastStack = $stack; + } + + public $lastData; + public $lastStack; +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php new file mode 100644 index 0000000..0fdef63 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +class MongoDBHandlerTest extends TestCase +{ + /** + * @expectedException InvalidArgumentException + */ + public function testConstructorShouldThrowExceptionForInvalidMongo() + { + new MongoDBHandler(new \stdClass(), 'DB', 'Collection'); + } + + public function testHandle() + { + $mongo = $this->getMock('Mongo', array('selectCollection'), array(), '', false); + $collection = $this->getMock('stdClass', array('save')); + + $mongo->expects($this->once()) + ->method('selectCollection') + ->with('DB', 'Collection') + ->will($this->returnValue($collection)); + + $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); + + $expected = array( + 'message' => 'test', + 'context' => array('data' => '[object] (stdClass: {})', 'foo' => 34), + 'level' => Logger::WARNING, + 'level_name' => 'WARNING', + 'channel' => 'test', + 'datetime' => $record['datetime']->format('Y-m-d H:i:s'), + 'extra' => array(), + ); + + $collection->expects($this->once()) + ->method('save') + ->with($expected); + + $handler = new MongoDBHandler($mongo, 'DB', 'Collection'); + $handler->handle($record); + } +} + +if (!class_exists('Mongo')) { + class Mongo + { + public function selectCollection() + { + } + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php new file mode 100644 index 0000000..ddf545d --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; +use InvalidArgumentException; + +function mail($to, $subject, $message, $additional_headers = null, $additional_parameters = null) +{ + $GLOBALS['mail'][] = func_get_args(); +} + +class NativeMailerHandlerTest extends TestCase +{ + protected function setUp() + { + $GLOBALS['mail'] = array(); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testConstructorHeaderInjection() + { + $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', "receiver@example.org\r\nFrom: faked@attacker.org"); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testSetterHeaderInjection() + { + $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org'); + $mailer->addHeader("Content-Type: text/html\r\nFrom: faked@attacker.org"); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testSetterArrayHeaderInjection() + { + $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org'); + $mailer->addHeader(array("Content-Type: text/html\r\nFrom: faked@attacker.org")); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testSetterContentTypeInjection() + { + $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org'); + $mailer->setContentType("text/html\r\nFrom: faked@attacker.org"); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testSetterEncodingInjection() + { + $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org'); + $mailer->setEncoding("utf-8\r\nFrom: faked@attacker.org"); + } + + public function testSend() + { + $to = 'spammer@example.org'; + $subject = 'dear victim'; + $from = 'receiver@example.org'; + + $mailer = new NativeMailerHandler($to, $subject, $from); + $mailer->handleBatch(array()); + + // batch is empty, nothing sent + $this->assertEmpty($GLOBALS['mail']); + + // non-empty batch + $mailer->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz")); + $this->assertNotEmpty($GLOBALS['mail']); + $this->assertInternalType('array', $GLOBALS['mail']); + $this->assertArrayHasKey('0', $GLOBALS['mail']); + $params = $GLOBALS['mail'][0]; + $this->assertCount(5, $params); + $this->assertSame($to, $params[0]); + $this->assertSame($subject, $params[1]); + $this->assertStringEndsWith(" test.ERROR: Foo Bar Baz [] []\n", $params[2]); + $this->assertSame("From: $from\r\nContent-type: text/plain; charset=utf-8\r\n", $params[3]); + $this->assertSame('', $params[4]); + } + + public function testMessageSubjectFormatting() + { + $mailer = new NativeMailerHandler('to@example.org', 'Alert: %level_name% %message%', 'from@example.org'); + $mailer->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz")); + $this->assertNotEmpty($GLOBALS['mail']); + $this->assertInternalType('array', $GLOBALS['mail']); + $this->assertArrayHasKey('0', $GLOBALS['mail']); + $params = $GLOBALS['mail'][0]; + $this->assertCount(5, $params); + $this->assertSame('Alert: ERROR Foo Bar Baz', $params[1]); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php new file mode 100644 index 0000000..4d3a615 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php @@ -0,0 +1,200 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Formatter\LineFormatter; +use Monolog\TestCase; +use Monolog\Logger; + +class NewRelicHandlerTest extends TestCase +{ + public static $appname; + public static $customParameters; + public static $transactionName; + + public function setUp() + { + self::$appname = null; + self::$customParameters = array(); + self::$transactionName = null; + } + + /** + * @expectedException Monolog\Handler\MissingExtensionException + */ + public function testThehandlerThrowsAnExceptionIfTheNRExtensionIsNotLoaded() + { + $handler = new StubNewRelicHandlerWithoutExtension(); + $handler->handle($this->getRecord(Logger::ERROR)); + } + + public function testThehandlerCanHandleTheRecord() + { + $handler = new StubNewRelicHandler(); + $handler->handle($this->getRecord(Logger::ERROR)); + } + + public function testThehandlerCanAddContextParamsToTheNewRelicTrace() + { + $handler = new StubNewRelicHandler(); + $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('a' => 'b'))); + $this->assertEquals(array('context_a' => 'b'), self::$customParameters); + } + + public function testThehandlerCanAddExplodedContextParamsToTheNewRelicTrace() + { + $handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true); + $handler->handle($this->getRecord( + Logger::ERROR, + 'log message', + array('a' => array('key1' => 'value1', 'key2' => 'value2')) + )); + $this->assertEquals( + array('context_a_key1' => 'value1', 'context_a_key2' => 'value2'), + self::$customParameters + ); + } + + public function testThehandlerCanAddExtraParamsToTheNewRelicTrace() + { + $record = $this->getRecord(Logger::ERROR, 'log message'); + $record['extra'] = array('c' => 'd'); + + $handler = new StubNewRelicHandler(); + $handler->handle($record); + + $this->assertEquals(array('extra_c' => 'd'), self::$customParameters); + } + + public function testThehandlerCanAddExplodedExtraParamsToTheNewRelicTrace() + { + $record = $this->getRecord(Logger::ERROR, 'log message'); + $record['extra'] = array('c' => array('key1' => 'value1', 'key2' => 'value2')); + + $handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true); + $handler->handle($record); + + $this->assertEquals( + array('extra_c_key1' => 'value1', 'extra_c_key2' => 'value2'), + self::$customParameters + ); + } + + public function testThehandlerCanAddExtraContextAndParamsToTheNewRelicTrace() + { + $record = $this->getRecord(Logger::ERROR, 'log message', array('a' => 'b')); + $record['extra'] = array('c' => 'd'); + + $handler = new StubNewRelicHandler(); + $handler->handle($record); + + $expected = array( + 'context_a' => 'b', + 'extra_c' => 'd', + ); + + $this->assertEquals($expected, self::$customParameters); + } + + public function testThehandlerCanHandleTheRecordsFormattedUsingTheLineFormatter() + { + $handler = new StubNewRelicHandler(); + $handler->setFormatter(new LineFormatter()); + $handler->handle($this->getRecord(Logger::ERROR)); + } + + public function testTheAppNameIsNullByDefault() + { + $handler = new StubNewRelicHandler(); + $handler->handle($this->getRecord(Logger::ERROR, 'log message')); + + $this->assertEquals(null, self::$appname); + } + + public function testTheAppNameCanBeInjectedFromtheConstructor() + { + $handler = new StubNewRelicHandler(Logger::DEBUG, false, 'myAppName'); + $handler->handle($this->getRecord(Logger::ERROR, 'log message')); + + $this->assertEquals('myAppName', self::$appname); + } + + public function testTheAppNameCanBeOverriddenFromEachLog() + { + $handler = new StubNewRelicHandler(Logger::DEBUG, false, 'myAppName'); + $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('appname' => 'logAppName'))); + + $this->assertEquals('logAppName', self::$appname); + } + + public function testTheTransactionNameIsNullByDefault() + { + $handler = new StubNewRelicHandler(); + $handler->handle($this->getRecord(Logger::ERROR, 'log message')); + + $this->assertEquals(null, self::$transactionName); + } + + public function testTheTransactionNameCanBeInjectedFromTheConstructor() + { + $handler = new StubNewRelicHandler(Logger::DEBUG, false, null, false, 'myTransaction'); + $handler->handle($this->getRecord(Logger::ERROR, 'log message')); + + $this->assertEquals('myTransaction', self::$transactionName); + } + + public function testTheTransactionNameCanBeOverriddenFromEachLog() + { + $handler = new StubNewRelicHandler(Logger::DEBUG, false, null, false, 'myTransaction'); + $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('transaction_name' => 'logTransactName'))); + + $this->assertEquals('logTransactName', self::$transactionName); + } +} + +class StubNewRelicHandlerWithoutExtension extends NewRelicHandler +{ + protected function isNewRelicEnabled() + { + return false; + } +} + +class StubNewRelicHandler extends NewRelicHandler +{ + protected function isNewRelicEnabled() + { + return true; + } +} + +function newrelic_notice_error() +{ + return true; +} + +function newrelic_set_appname($appname) +{ + return NewRelicHandlerTest::$appname = $appname; +} + +function newrelic_name_transaction($transactionName) +{ + return NewRelicHandlerTest::$transactionName = $transactionName; +} + +function newrelic_add_custom_parameter($key, $value) +{ + NewRelicHandlerTest::$customParameters[$key] = $value; + + return true; +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php new file mode 100644 index 0000000..292df78 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +/** + * @covers Monolog\Handler\NullHandler::handle + */ +class NullHandlerTest extends TestCase +{ + public function testHandle() + { + $handler = new NullHandler(); + $this->assertTrue($handler->handle($this->getRecord())); + } + + public function testHandleLowerLevelRecord() + { + $handler = new NullHandler(Logger::WARNING); + $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG))); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php new file mode 100644 index 0000000..152573e --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php @@ -0,0 +1,273 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Exception; +use Monolog\ErrorHandler; +use Monolog\Logger; +use Monolog\TestCase; +use PhpConsole\Connector; +use PhpConsole\Dispatcher\Debug as DebugDispatcher; +use PhpConsole\Dispatcher\Errors as ErrorDispatcher; +use PhpConsole\Handler; +use PHPUnit_Framework_MockObject_MockObject; + +/** + * @covers Monolog\Handler\PHPConsoleHandler + * @author Sergey Barbushin https://www.linkedin.com/in/barbushin + */ +class PHPConsoleHandlerTest extends TestCase +{ + /** @var Connector|PHPUnit_Framework_MockObject_MockObject */ + protected $connector; + /** @var DebugDispatcher|PHPUnit_Framework_MockObject_MockObject */ + protected $debugDispatcher; + /** @var ErrorDispatcher|PHPUnit_Framework_MockObject_MockObject */ + protected $errorDispatcher; + + protected function setUp() + { + if (!class_exists('PhpConsole\Connector')) { + $this->markTestSkipped('PHP Console library not found. See https://github.com/barbushin/php-console#installation'); + } + $this->connector = $this->initConnectorMock(); + + $this->debugDispatcher = $this->initDebugDispatcherMock($this->connector); + $this->connector->setDebugDispatcher($this->debugDispatcher); + + $this->errorDispatcher = $this->initErrorDispatcherMock($this->connector); + $this->connector->setErrorsDispatcher($this->errorDispatcher); + } + + protected function initDebugDispatcherMock(Connector $connector) + { + return $this->getMockBuilder('PhpConsole\Dispatcher\Debug') + ->disableOriginalConstructor() + ->setMethods(array('dispatchDebug')) + ->setConstructorArgs(array($connector, $connector->getDumper())) + ->getMock(); + } + + protected function initErrorDispatcherMock(Connector $connector) + { + return $this->getMockBuilder('PhpConsole\Dispatcher\Errors') + ->disableOriginalConstructor() + ->setMethods(array('dispatchError', 'dispatchException')) + ->setConstructorArgs(array($connector, $connector->getDumper())) + ->getMock(); + } + + protected function initConnectorMock() + { + $connector = $this->getMockBuilder('PhpConsole\Connector') + ->disableOriginalConstructor() + ->setMethods(array( + 'sendMessage', + 'onShutDown', + 'isActiveClient', + 'setSourcesBasePath', + 'setServerEncoding', + 'setPassword', + 'enableSslOnlyMode', + 'setAllowedIpMasks', + 'setHeadersLimit', + 'startEvalRequestsListener', + )) + ->getMock(); + + $connector->expects($this->any()) + ->method('isActiveClient') + ->will($this->returnValue(true)); + + return $connector; + } + + protected function getHandlerDefaultOption($name) + { + $handler = new PHPConsoleHandler(array(), $this->connector); + $options = $handler->getOptions(); + + return $options[$name]; + } + + protected function initLogger($handlerOptions = array(), $level = Logger::DEBUG) + { + return new Logger('test', array( + new PHPConsoleHandler($handlerOptions, $this->connector, $level), + )); + } + + public function testInitWithDefaultConnector() + { + $handler = new PHPConsoleHandler(); + $this->assertEquals(spl_object_hash(Connector::getInstance()), spl_object_hash($handler->getConnector())); + } + + public function testInitWithCustomConnector() + { + $handler = new PHPConsoleHandler(array(), $this->connector); + $this->assertEquals(spl_object_hash($this->connector), spl_object_hash($handler->getConnector())); + } + + public function testDebug() + { + $this->debugDispatcher->expects($this->once())->method('dispatchDebug')->with($this->equalTo('test')); + $this->initLogger()->addDebug('test'); + } + + public function testDebugContextInMessage() + { + $message = 'test'; + $tag = 'tag'; + $context = array($tag, 'custom' => mt_rand()); + $expectedMessage = $message . ' ' . json_encode(array_slice($context, 1)); + $this->debugDispatcher->expects($this->once())->method('dispatchDebug')->with( + $this->equalTo($expectedMessage), + $this->equalTo($tag) + ); + $this->initLogger()->addDebug($message, $context); + } + + public function testDebugTags($tagsContextKeys = null) + { + $expectedTags = mt_rand(); + $logger = $this->initLogger($tagsContextKeys ? array('debugTagsKeysInContext' => $tagsContextKeys) : array()); + if (!$tagsContextKeys) { + $tagsContextKeys = $this->getHandlerDefaultOption('debugTagsKeysInContext'); + } + foreach ($tagsContextKeys as $key) { + $debugDispatcher = $this->initDebugDispatcherMock($this->connector); + $debugDispatcher->expects($this->once())->method('dispatchDebug')->with( + $this->anything(), + $this->equalTo($expectedTags) + ); + $this->connector->setDebugDispatcher($debugDispatcher); + $logger->addDebug('test', array($key => $expectedTags)); + } + } + + public function testError($classesPartialsTraceIgnore = null) + { + $code = E_USER_NOTICE; + $message = 'message'; + $file = __FILE__; + $line = __LINE__; + $this->errorDispatcher->expects($this->once())->method('dispatchError')->with( + $this->equalTo($code), + $this->equalTo($message), + $this->equalTo($file), + $this->equalTo($line), + $classesPartialsTraceIgnore ?: $this->equalTo($this->getHandlerDefaultOption('classesPartialsTraceIgnore')) + ); + $errorHandler = ErrorHandler::register($this->initLogger($classesPartialsTraceIgnore ? array('classesPartialsTraceIgnore' => $classesPartialsTraceIgnore) : array()), false); + $errorHandler->registerErrorHandler(array(), false, E_USER_WARNING); + $errorHandler->handleError($code, $message, $file, $line); + } + + public function testException() + { + $e = new Exception(); + $this->errorDispatcher->expects($this->once())->method('dispatchException')->with( + $this->equalTo($e) + ); + $handler = $this->initLogger(); + $handler->log( + \Psr\Log\LogLevel::ERROR, + sprintf('Uncaught Exception %s: "%s" at %s line %s', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()), + array('exception' => $e) + ); + } + + /** + * @expectedException Exception + */ + public function testWrongOptionsThrowsException() + { + new PHPConsoleHandler(array('xxx' => 1)); + } + + public function testOptionEnabled() + { + $this->debugDispatcher->expects($this->never())->method('dispatchDebug'); + $this->initLogger(array('enabled' => false))->addDebug('test'); + } + + public function testOptionClassesPartialsTraceIgnore() + { + $this->testError(array('Class', 'Namespace\\')); + } + + public function testOptionDebugTagsKeysInContext() + { + $this->testDebugTags(array('key1', 'key2')); + } + + public function testOptionUseOwnErrorsAndExceptionsHandler() + { + $this->initLogger(array('useOwnErrorsHandler' => true, 'useOwnExceptionsHandler' => true)); + $this->assertEquals(array(Handler::getInstance(), 'handleError'), set_error_handler(function () { + })); + $this->assertEquals(array(Handler::getInstance(), 'handleException'), set_exception_handler(function () { + })); + } + + public static function provideConnectorMethodsOptionsSets() + { + return array( + array('sourcesBasePath', 'setSourcesBasePath', __DIR__), + array('serverEncoding', 'setServerEncoding', 'cp1251'), + array('password', 'setPassword', '******'), + array('enableSslOnlyMode', 'enableSslOnlyMode', true, false), + array('ipMasks', 'setAllowedIpMasks', array('127.0.0.*')), + array('headersLimit', 'setHeadersLimit', 2500), + array('enableEvalListener', 'startEvalRequestsListener', true, false), + ); + } + + /** + * @dataProvider provideConnectorMethodsOptionsSets + */ + public function testOptionCallsConnectorMethod($option, $method, $value, $isArgument = true) + { + $expectCall = $this->connector->expects($this->once())->method($method); + if ($isArgument) { + $expectCall->with($value); + } + new PHPConsoleHandler(array($option => $value), $this->connector); + } + + public function testOptionDetectDumpTraceAndSource() + { + new PHPConsoleHandler(array('detectDumpTraceAndSource' => true), $this->connector); + $this->assertTrue($this->connector->getDebugDispatcher()->detectTraceAndSource); + } + + public static function provideDumperOptionsValues() + { + return array( + array('dumperLevelLimit', 'levelLimit', 1001), + array('dumperItemsCountLimit', 'itemsCountLimit', 1002), + array('dumperItemSizeLimit', 'itemSizeLimit', 1003), + array('dumperDumpSizeLimit', 'dumpSizeLimit', 1004), + array('dumperDetectCallbacks', 'detectCallbacks', true), + ); + } + + /** + * @dataProvider provideDumperOptionsValues + */ + public function testDumperOptions($option, $dumperProperty, $value) + { + new PHPConsoleHandler(array($option => $value), $this->connector); + $this->assertEquals($value, $this->connector->getDumper()->$dumperProperty); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php new file mode 100644 index 0000000..64eaab1 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +/** + * @covers Monolog\Handler\PsrHandler::handle + */ +class PsrHandlerTest extends TestCase +{ + public function logLevelProvider() + { + $levels = array(); + $monologLogger = new Logger(''); + + foreach ($monologLogger->getLevels() as $levelName => $level) { + $levels[] = array($levelName, $level); + } + + return $levels; + } + + /** + * @dataProvider logLevelProvider + */ + public function testHandlesAllLevels($levelName, $level) + { + $message = 'Hello, world! ' . $level; + $context = array('foo' => 'bar', 'level' => $level); + + $psrLogger = $this->getMock('Psr\Log\NullLogger'); + $psrLogger->expects($this->once()) + ->method('log') + ->with(strtolower($levelName), $message, $context); + + $handler = new PsrHandler($psrLogger); + $handler->handle(array('level' => $level, 'level_name' => $levelName, 'message' => $message, 'context' => $context)); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php new file mode 100644 index 0000000..56df474 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php @@ -0,0 +1,141 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +/** + * Almost all examples (expected header, titles, messages) taken from + * https://www.pushover.net/api + * @author Sebastian Göttschkes + * @see https://www.pushover.net/api + */ +class PushoverHandlerTest extends TestCase +{ + private $res; + private $handler; + + public function testWriteHeader() + { + $this->createHandler(); + $this->handler->setHighPriorityLevel(Logger::EMERGENCY); // skip priority notifications + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/POST \/1\/messages.json HTTP\/1.1\\r\\nHost: api.pushover.net\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); + + return $content; + } + + /** + * @depends testWriteHeader + */ + public function testWriteContent($content) + { + $this->assertRegexp('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}$/', $content); + } + + public function testWriteWithComplexTitle() + { + $this->createHandler('myToken', 'myUser', 'Backup finished - SQL1'); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/title=Backup\+finished\+-\+SQL1/', $content); + } + + public function testWriteWithComplexMessage() + { + $this->createHandler(); + $this->handler->setHighPriorityLevel(Logger::EMERGENCY); // skip priority notifications + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Backup of database "example" finished in 16 minutes.')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/message=Backup\+of\+database\+%22example%22\+finished\+in\+16\+minutes\./', $content); + } + + public function testWriteWithTooLongMessage() + { + $message = str_pad('test', 520, 'a'); + $this->createHandler(); + $this->handler->setHighPriorityLevel(Logger::EMERGENCY); // skip priority notifications + $this->handler->handle($this->getRecord(Logger::CRITICAL, $message)); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $expectedMessage = substr($message, 0, 505); + + $this->assertRegexp('/message=' . $expectedMessage . '&title/', $content); + } + + public function testWriteWithHighPriority() + { + $this->createHandler(); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}&priority=1$/', $content); + } + + public function testWriteWithEmergencyPriority() + { + $this->createHandler(); + $this->handler->handle($this->getRecord(Logger::EMERGENCY, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200$/', $content); + } + + public function testWriteToMultipleUsers() + { + $this->createHandler('myToken', array('userA', 'userB')); + $this->handler->handle($this->getRecord(Logger::EMERGENCY, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/token=myToken&user=userA&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200POST/', $content); + $this->assertRegexp('/token=myToken&user=userB&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200$/', $content); + } + + private function createHandler($token = 'myToken', $user = 'myUser', $title = 'Monolog') + { + $constructorArgs = array($token, $user, $title); + $this->res = fopen('php://memory', 'a'); + $this->handler = $this->getMock( + '\Monolog\Handler\PushoverHandler', + array('fsockopen', 'streamSetTimeout', 'closeSocket'), + $constructorArgs + ); + + $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($this->handler, 'localhost:1234'); + + $this->handler->expects($this->any()) + ->method('fsockopen') + ->will($this->returnValue($this->res)); + $this->handler->expects($this->any()) + ->method('streamSetTimeout') + ->will($this->returnValue(true)); + $this->handler->expects($this->any()) + ->method('closeSocket') + ->will($this->returnValue(true)); + + $this->handler->setFormatter($this->getIdentityFormatter()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php new file mode 100644 index 0000000..26d212b --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php @@ -0,0 +1,255 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; +use Monolog\Formatter\LineFormatter; + +class RavenHandlerTest extends TestCase +{ + public function setUp() + { + if (!class_exists('Raven_Client')) { + $this->markTestSkipped('raven/raven not installed'); + } + + require_once __DIR__ . '/MockRavenClient.php'; + } + + /** + * @covers Monolog\Handler\RavenHandler::__construct + */ + public function testConstruct() + { + $handler = new RavenHandler($this->getRavenClient()); + $this->assertInstanceOf('Monolog\Handler\RavenHandler', $handler); + } + + protected function getHandler($ravenClient) + { + $handler = new RavenHandler($ravenClient); + + return $handler; + } + + protected function getRavenClient() + { + $dsn = 'http://43f6017361224d098402974103bfc53d:a6a0538fc2934ba2bed32e08741b2cd3@marca.python.live.cheggnet.com:9000/1'; + + return new MockRavenClient($dsn); + } + + public function testDebug() + { + $ravenClient = $this->getRavenClient(); + $handler = $this->getHandler($ravenClient); + + $record = $this->getRecord(Logger::DEBUG, 'A test debug message'); + $handler->handle($record); + + $this->assertEquals($ravenClient::DEBUG, $ravenClient->lastData['level']); + $this->assertContains($record['message'], $ravenClient->lastData['message']); + } + + public function testWarning() + { + $ravenClient = $this->getRavenClient(); + $handler = $this->getHandler($ravenClient); + + $record = $this->getRecord(Logger::WARNING, 'A test warning message'); + $handler->handle($record); + + $this->assertEquals($ravenClient::WARNING, $ravenClient->lastData['level']); + $this->assertContains($record['message'], $ravenClient->lastData['message']); + } + + public function testTag() + { + $ravenClient = $this->getRavenClient(); + $handler = $this->getHandler($ravenClient); + + $tags = array(1, 2, 'foo'); + $record = $this->getRecord(Logger::INFO, 'test', array('tags' => $tags)); + $handler->handle($record); + + $this->assertEquals($tags, $ravenClient->lastData['tags']); + } + + public function testExtraParameters() + { + $ravenClient = $this->getRavenClient(); + $handler = $this->getHandler($ravenClient); + + $checksum = '098f6bcd4621d373cade4e832627b4f6'; + $release = '05a671c66aefea124cc08b76ea6d30bb'; + $eventId = '31423'; + $record = $this->getRecord(Logger::INFO, 'test', array('checksum' => $checksum, 'release' => $release, 'event_id' => $eventId)); + $handler->handle($record); + + $this->assertEquals($checksum, $ravenClient->lastData['checksum']); + $this->assertEquals($release, $ravenClient->lastData['release']); + $this->assertEquals($eventId, $ravenClient->lastData['event_id']); + } + + public function testFingerprint() + { + $ravenClient = $this->getRavenClient(); + $handler = $this->getHandler($ravenClient); + + $fingerprint = array('{{ default }}', 'other value'); + $record = $this->getRecord(Logger::INFO, 'test', array('fingerprint' => $fingerprint)); + $handler->handle($record); + + $this->assertEquals($fingerprint, $ravenClient->lastData['fingerprint']); + } + + public function testUserContext() + { + $ravenClient = $this->getRavenClient(); + $handler = $this->getHandler($ravenClient); + + $recordWithNoContext = $this->getRecord(Logger::INFO, 'test with default user context'); + // set user context 'externally' + + $user = array( + 'id' => '123', + 'email' => 'test@test.com', + ); + + $recordWithContext = $this->getRecord(Logger::INFO, 'test', array('user' => $user)); + + $ravenClient->user_context(array('id' => 'test_user_id')); + // handle context + $handler->handle($recordWithContext); + $this->assertEquals($user, $ravenClient->lastData['user']); + + // check to see if its reset + $handler->handle($recordWithNoContext); + $this->assertInternalType('array', $ravenClient->context->user); + $this->assertSame('test_user_id', $ravenClient->context->user['id']); + + // handle with null context + $ravenClient->user_context(null); + $handler->handle($recordWithContext); + $this->assertEquals($user, $ravenClient->lastData['user']); + + // check to see if its reset + $handler->handle($recordWithNoContext); + $this->assertNull($ravenClient->context->user); + } + + public function testException() + { + $ravenClient = $this->getRavenClient(); + $handler = $this->getHandler($ravenClient); + + try { + $this->methodThatThrowsAnException(); + } catch (\Exception $e) { + $record = $this->getRecord(Logger::ERROR, $e->getMessage(), array('exception' => $e)); + $handler->handle($record); + } + + $this->assertEquals($record['message'], $ravenClient->lastData['message']); + } + + public function testHandleBatch() + { + $records = $this->getMultipleRecords(); + $records[] = $this->getRecord(Logger::WARNING, 'warning'); + $records[] = $this->getRecord(Logger::WARNING, 'warning'); + + $logFormatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); + $logFormatter->expects($this->once())->method('formatBatch'); + + $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); + $formatter->expects($this->once())->method('format')->with($this->callback(function ($record) { + return $record['level'] == 400; + })); + + $handler = $this->getHandler($this->getRavenClient()); + $handler->setBatchFormatter($logFormatter); + $handler->setFormatter($formatter); + $handler->handleBatch($records); + } + + public function testHandleBatchDoNothingIfRecordsAreBelowLevel() + { + $records = array( + $this->getRecord(Logger::DEBUG, 'debug message 1'), + $this->getRecord(Logger::DEBUG, 'debug message 2'), + $this->getRecord(Logger::INFO, 'information'), + ); + + $handler = $this->getMock('Monolog\Handler\RavenHandler', null, array($this->getRavenClient())); + $handler->expects($this->never())->method('handle'); + $handler->setLevel(Logger::ERROR); + $handler->handleBatch($records); + } + + public function testHandleBatchPicksProperMessage() + { + $records = array( + $this->getRecord(Logger::DEBUG, 'debug message 1'), + $this->getRecord(Logger::DEBUG, 'debug message 2'), + $this->getRecord(Logger::INFO, 'information 1'), + $this->getRecord(Logger::ERROR, 'error 1'), + $this->getRecord(Logger::WARNING, 'warning'), + $this->getRecord(Logger::ERROR, 'error 2'), + $this->getRecord(Logger::INFO, 'information 2'), + ); + + $logFormatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); + $logFormatter->expects($this->once())->method('formatBatch'); + + $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); + $formatter->expects($this->once())->method('format')->with($this->callback(function ($record) use ($records) { + return $record['message'] == 'error 1'; + })); + + $handler = $this->getHandler($this->getRavenClient()); + $handler->setBatchFormatter($logFormatter); + $handler->setFormatter($formatter); + $handler->handleBatch($records); + } + + public function testGetSetBatchFormatter() + { + $ravenClient = $this->getRavenClient(); + $handler = $this->getHandler($ravenClient); + + $handler->setBatchFormatter($formatter = new LineFormatter()); + $this->assertSame($formatter, $handler->getBatchFormatter()); + } + + public function testRelease() + { + $ravenClient = $this->getRavenClient(); + $handler = $this->getHandler($ravenClient); + $release = 'v42.42.42'; + $handler->setRelease($release); + $record = $this->getRecord(Logger::INFO, 'test'); + $handler->handle($record); + $this->assertEquals($release, $ravenClient->lastData['release']); + + $localRelease = 'v41.41.41'; + $record = $this->getRecord(Logger::INFO, 'test', array('release' => $localRelease)); + $handler->handle($record); + $this->assertEquals($localRelease, $ravenClient->lastData['release']); + } + + private function methodThatThrowsAnException() + { + throw new \Exception('This is an exception'); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php new file mode 100644 index 0000000..689d527 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php @@ -0,0 +1,127 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; +use Monolog\Formatter\LineFormatter; + +class RedisHandlerTest extends TestCase +{ + /** + * @expectedException InvalidArgumentException + */ + public function testConstructorShouldThrowExceptionForInvalidRedis() + { + new RedisHandler(new \stdClass(), 'key'); + } + + public function testConstructorShouldWorkWithPredis() + { + $redis = $this->getMock('Predis\Client'); + $this->assertInstanceof('Monolog\Handler\RedisHandler', new RedisHandler($redis, 'key')); + } + + public function testConstructorShouldWorkWithRedis() + { + $redis = $this->getMock('Redis'); + $this->assertInstanceof('Monolog\Handler\RedisHandler', new RedisHandler($redis, 'key')); + } + + public function testPredisHandle() + { + $redis = $this->getMock('Predis\Client', array('rpush')); + + // Predis\Client uses rpush + $redis->expects($this->once()) + ->method('rpush') + ->with('key', 'test'); + + $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); + + $handler = new RedisHandler($redis, 'key'); + $handler->setFormatter(new LineFormatter("%message%")); + $handler->handle($record); + } + + public function testRedisHandle() + { + $redis = $this->getMock('Redis', array('rpush')); + + // Redis uses rPush + $redis->expects($this->once()) + ->method('rPush') + ->with('key', 'test'); + + $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); + + $handler = new RedisHandler($redis, 'key'); + $handler->setFormatter(new LineFormatter("%message%")); + $handler->handle($record); + } + + public function testRedisHandleCapped() + { + $redis = $this->getMock('Redis', array('multi', 'rpush', 'ltrim', 'exec')); + + // Redis uses multi + $redis->expects($this->once()) + ->method('multi') + ->will($this->returnSelf()); + + $redis->expects($this->once()) + ->method('rpush') + ->will($this->returnSelf()); + + $redis->expects($this->once()) + ->method('ltrim') + ->will($this->returnSelf()); + + $redis->expects($this->once()) + ->method('exec') + ->will($this->returnSelf()); + + $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); + + $handler = new RedisHandler($redis, 'key', Logger::DEBUG, true, 10); + $handler->setFormatter(new LineFormatter("%message%")); + $handler->handle($record); + } + + public function testPredisHandleCapped() + { + $redis = $this->getMock('Predis\Client', array('transaction')); + + $redisTransaction = $this->getMock('Predis\Client', array('rpush', 'ltrim')); + + $redisTransaction->expects($this->once()) + ->method('rpush') + ->will($this->returnSelf()); + + $redisTransaction->expects($this->once()) + ->method('ltrim') + ->will($this->returnSelf()); + + // Redis uses multi + $redis->expects($this->once()) + ->method('transaction') + ->will($this->returnCallback(function ($cb) use ($redisTransaction) { + $cb($redisTransaction); + })); + + $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34)); + + $handler = new RedisHandler($redis, 'key', Logger::DEBUG, true, 10); + $handler->setFormatter(new LineFormatter("%message%")); + $handler->handle($record); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/RollbarHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/RollbarHandlerTest.php new file mode 100644 index 0000000..f302e91 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/RollbarHandlerTest.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Exception; +use Monolog\TestCase; +use Monolog\Logger; +use PHPUnit_Framework_MockObject_MockObject as MockObject; + +/** + * @author Erik Johansson + * @see https://rollbar.com/docs/notifier/rollbar-php/ + * + * @coversDefaultClass Monolog\Handler\RollbarHandler + */ +class RollbarHandlerTest extends TestCase +{ + /** + * @var MockObject + */ + private $rollbarNotifier; + + /** + * @var array + */ + public $reportedExceptionArguments = null; + + protected function setUp() + { + parent::setUp(); + + $this->setupRollbarNotifierMock(); + } + + /** + * When reporting exceptions to Rollbar the + * level has to be set in the payload data + */ + public function testExceptionLogLevel() + { + $handler = $this->createHandler(); + + $handler->handle($this->createExceptionRecord(Logger::DEBUG)); + + $this->assertEquals('debug', $this->reportedExceptionArguments['payload']['level']); + } + + private function setupRollbarNotifierMock() + { + $this->rollbarNotifier = $this->getMockBuilder('RollbarNotifier') + ->setMethods(array('report_message', 'report_exception', 'flush')) + ->getMock(); + + $that = $this; + + $this->rollbarNotifier + ->expects($this->any()) + ->method('report_exception') + ->willReturnCallback(function ($exception, $context, $payload) use ($that) { + $that->reportedExceptionArguments = compact('exception', 'context', 'payload'); + }); + } + + private function createHandler() + { + return new RollbarHandler($this->rollbarNotifier, Logger::DEBUG); + } + + private function createExceptionRecord($level = Logger::DEBUG, $message = 'test', $exception = null) + { + return $this->getRecord($level, $message, array( + 'exception' => $exception ?: new Exception() + )); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php new file mode 100644 index 0000000..c6f5fac --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php @@ -0,0 +1,245 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use PHPUnit_Framework_Error_Deprecated; + +/** + * @covers Monolog\Handler\RotatingFileHandler + */ +class RotatingFileHandlerTest extends TestCase +{ + /** + * This var should be private but then the anonymous function + * in the `setUp` method won't be able to set it. `$this` cant't + * be used in the anonymous function in `setUp` because PHP 5.3 + * does not support it. + */ + public $lastError; + + public function setUp() + { + $dir = __DIR__.'/Fixtures'; + chmod($dir, 0777); + if (!is_writable($dir)) { + $this->markTestSkipped($dir.' must be writable to test the RotatingFileHandler.'); + } + $this->lastError = null; + $self = $this; + // workaround with &$self used for PHP 5.3 + set_error_handler(function($code, $message) use (&$self) { + $self->lastError = array( + 'code' => $code, + 'message' => $message, + ); + }); + } + + private function assertErrorWasTriggered($code, $message) + { + if (empty($this->lastError)) { + $this->fail( + sprintf( + 'Failed asserting that error with code `%d` and message `%s` was triggered', + $code, + $message + ) + ); + } + $this->assertEquals($code, $this->lastError['code'], sprintf('Expected an error with code %d to be triggered, got `%s` instead', $code, $this->lastError['code'])); + $this->assertEquals($message, $this->lastError['message'], sprintf('Expected an error with message `%d` to be triggered, got `%s` instead', $message, $this->lastError['message'])); + } + + public function testRotationCreatesNewFile() + { + touch(__DIR__.'/Fixtures/foo-'.date('Y-m-d', time() - 86400).'.rot'); + + $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot'); + $handler->setFormatter($this->getIdentityFormatter()); + $handler->handle($this->getRecord()); + + $log = __DIR__.'/Fixtures/foo-'.date('Y-m-d').'.rot'; + $this->assertTrue(file_exists($log)); + $this->assertEquals('test', file_get_contents($log)); + } + + /** + * @dataProvider rotationTests + */ + public function testRotation($createFile, $dateFormat, $timeCallback) + { + touch($old1 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-1)).'.rot'); + touch($old2 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-2)).'.rot'); + touch($old3 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-3)).'.rot'); + touch($old4 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-4)).'.rot'); + + $log = __DIR__.'/Fixtures/foo-'.date($dateFormat).'.rot'; + + if ($createFile) { + touch($log); + } + + $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2); + $handler->setFormatter($this->getIdentityFormatter()); + $handler->setFilenameFormat('{filename}-{date}', $dateFormat); + $handler->handle($this->getRecord()); + + $handler->close(); + + $this->assertTrue(file_exists($log)); + $this->assertTrue(file_exists($old1)); + $this->assertEquals($createFile, file_exists($old2)); + $this->assertEquals($createFile, file_exists($old3)); + $this->assertEquals($createFile, file_exists($old4)); + $this->assertEquals('test', file_get_contents($log)); + } + + public function rotationTests() + { + $now = time(); + $dayCallback = function($ago) use ($now) { + return $now + 86400 * $ago; + }; + $monthCallback = function($ago) { + return gmmktime(0, 0, 0, date('n') + $ago, 1, date('Y')); + }; + $yearCallback = function($ago) { + return gmmktime(0, 0, 0, 1, 1, date('Y') + $ago); + }; + + return array( + 'Rotation is triggered when the file of the current day is not present' + => array(true, RotatingFileHandler::FILE_PER_DAY, $dayCallback), + 'Rotation is not triggered when the file of the current day is already present' + => array(false, RotatingFileHandler::FILE_PER_DAY, $dayCallback), + + 'Rotation is triggered when the file of the current month is not present' + => array(true, RotatingFileHandler::FILE_PER_MONTH, $monthCallback), + 'Rotation is not triggered when the file of the current month is already present' + => array(false, RotatingFileHandler::FILE_PER_MONTH, $monthCallback), + + 'Rotation is triggered when the file of the current year is not present' + => array(true, RotatingFileHandler::FILE_PER_YEAR, $yearCallback), + 'Rotation is not triggered when the file of the current year is already present' + => array(false, RotatingFileHandler::FILE_PER_YEAR, $yearCallback), + ); + } + + /** + * @dataProvider dateFormatProvider + */ + public function testAllowOnlyFixedDefinedDateFormats($dateFormat, $valid) + { + $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2); + $handler->setFilenameFormat('{filename}-{date}', $dateFormat); + if (!$valid) { + $this->assertErrorWasTriggered( + E_USER_DEPRECATED, + 'Invalid date format - format must be one of RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), '. + 'RotatingFileHandler::FILE_PER_MONTH ("Y-m") or RotatingFileHandler::FILE_PER_YEAR ("Y"), '. + 'or you can set one of the date formats using slashes, underscores and/or dots instead of dashes.' + ); + } + } + + public function dateFormatProvider() + { + return array( + array(RotatingFileHandler::FILE_PER_DAY, true), + array(RotatingFileHandler::FILE_PER_MONTH, true), + array(RotatingFileHandler::FILE_PER_YEAR, true), + array('m-d-Y', false), + array('Y-m-d-h-i', false) + ); + } + + /** + * @dataProvider filenameFormatProvider + */ + public function testDisallowFilenameFormatsWithoutDate($filenameFormat, $valid) + { + $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2); + $handler->setFilenameFormat($filenameFormat, RotatingFileHandler::FILE_PER_DAY); + if (!$valid) { + $this->assertErrorWasTriggered( + E_USER_DEPRECATED, + 'Invalid filename format - format should contain at least `{date}`, because otherwise rotating is impossible.' + ); + } + } + + public function filenameFormatProvider() + { + return array( + array('{filename}', false), + array('{filename}-{date}', true), + array('{date}', true), + array('foobar-{date}', true), + array('foo-{date}-bar', true), + array('{date}-foobar', true), + array('foobar', false), + ); + } + + /** + * @dataProvider rotationWhenSimilarFilesExistTests + */ + public function testRotationWhenSimilarFileNamesExist($dateFormat) + { + touch($old1 = __DIR__.'/Fixtures/foo-foo-'.date($dateFormat).'.rot'); + touch($old2 = __DIR__.'/Fixtures/foo-bar-'.date($dateFormat).'.rot'); + + $log = __DIR__.'/Fixtures/foo-'.date($dateFormat).'.rot'; + + $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2); + $handler->setFormatter($this->getIdentityFormatter()); + $handler->setFilenameFormat('{filename}-{date}', $dateFormat); + $handler->handle($this->getRecord()); + $handler->close(); + + $this->assertTrue(file_exists($log)); + } + + public function rotationWhenSimilarFilesExistTests() + { + + return array( + 'Rotation is triggered when the file of the current day is not present but similar exists' + => array(RotatingFileHandler::FILE_PER_DAY), + + 'Rotation is triggered when the file of the current month is not present but similar exists' + => array(RotatingFileHandler::FILE_PER_MONTH), + + 'Rotation is triggered when the file of the current year is not present but similar exists' + => array(RotatingFileHandler::FILE_PER_YEAR), + ); + } + + public function testReuseCurrentFile() + { + $log = __DIR__.'/Fixtures/foo-'.date('Y-m-d').'.rot'; + file_put_contents($log, "foo"); + $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot'); + $handler->setFormatter($this->getIdentityFormatter()); + $handler->handle($this->getRecord()); + $this->assertEquals('footest', file_get_contents($log)); + } + + public function tearDown() + { + foreach (glob(__DIR__.'/Fixtures/*.rot') as $file) { + unlink($file); + } + restore_error_handler(); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SamplingHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SamplingHandlerTest.php new file mode 100644 index 0000000..b354cee --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/SamplingHandlerTest.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; + +/** + * @covers Monolog\Handler\SamplingHandler::handle + */ +class SamplingHandlerTest extends TestCase +{ + public function testHandle() + { + $testHandler = new TestHandler(); + $handler = new SamplingHandler($testHandler, 2); + for ($i = 0; $i < 10000; $i++) { + $handler->handle($this->getRecord()); + } + $count = count($testHandler->getRecords()); + // $count should be half of 10k, so between 4k and 6k + $this->assertLessThan(6000, $count); + $this->assertGreaterThan(4000, $count); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php new file mode 100644 index 0000000..b9de736 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php @@ -0,0 +1,395 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\Slack; + +use Monolog\Logger; +use Monolog\TestCase; + +/** + * @coversDefaultClass Monolog\Handler\Slack\SlackRecord + */ +class SlackRecordTest extends TestCase +{ + private $jsonPrettyPrintFlag; + + protected function setUp() + { + $this->jsonPrettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128; + } + + public function dataGetAttachmentColor() + { + return array( + array(Logger::DEBUG, SlackRecord::COLOR_DEFAULT), + array(Logger::INFO, SlackRecord::COLOR_GOOD), + array(Logger::NOTICE, SlackRecord::COLOR_GOOD), + array(Logger::WARNING, SlackRecord::COLOR_WARNING), + array(Logger::ERROR, SlackRecord::COLOR_DANGER), + array(Logger::CRITICAL, SlackRecord::COLOR_DANGER), + array(Logger::ALERT, SlackRecord::COLOR_DANGER), + array(Logger::EMERGENCY, SlackRecord::COLOR_DANGER), + ); + } + + /** + * @dataProvider dataGetAttachmentColor + * @param int $logLevel + * @param string $expectedColour RGB hex color or name of Slack color + * @covers ::getAttachmentColor + */ + public function testGetAttachmentColor($logLevel, $expectedColour) + { + $slackRecord = new SlackRecord(); + $this->assertSame( + $expectedColour, + $slackRecord->getAttachmentColor($logLevel) + ); + } + + public function testAddsChannel() + { + $channel = '#test'; + $record = new SlackRecord($channel); + $data = $record->getSlackData($this->getRecord()); + + $this->assertArrayHasKey('channel', $data); + $this->assertSame($channel, $data['channel']); + } + + public function testNoUsernameByDefault() + { + $record = new SlackRecord(); + $data = $record->getSlackData($this->getRecord()); + + $this->assertArrayNotHasKey('username', $data); + } + + /** + * @return array + */ + public function dataStringify() + { + $jsonPrettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128; + + $multipleDimensions = array(array(1, 2)); + $numericKeys = array('library' => 'monolog'); + $singleDimension = array(1, 'Hello', 'Jordi'); + + return array( + array(array(), '[]'), + array($multipleDimensions, json_encode($multipleDimensions, $jsonPrettyPrintFlag)), + array($numericKeys, json_encode($numericKeys, $jsonPrettyPrintFlag)), + array($singleDimension, json_encode($singleDimension)) + ); + } + + /** + * @dataProvider dataStringify + */ + public function testStringify($fields, $expectedResult) + { + $slackRecord = new SlackRecord( + '#test', + 'test', + true, + null, + true, + true + ); + + $this->assertSame($expectedResult, $slackRecord->stringify($fields)); + } + + public function testAddsCustomUsername() + { + $username = 'Monolog bot'; + $record = new SlackRecord(null, $username); + $data = $record->getSlackData($this->getRecord()); + + $this->assertArrayHasKey('username', $data); + $this->assertSame($username, $data['username']); + } + + public function testNoIcon() + { + $record = new SlackRecord(); + $data = $record->getSlackData($this->getRecord()); + + $this->assertArrayNotHasKey('icon_emoji', $data); + } + + public function testAddsIcon() + { + $record = $this->getRecord(); + $slackRecord = new SlackRecord(null, null, false, 'ghost'); + $data = $slackRecord->getSlackData($record); + + $slackRecord2 = new SlackRecord(null, null, false, 'http://github.com/Seldaek/monolog'); + $data2 = $slackRecord2->getSlackData($record); + + $this->assertArrayHasKey('icon_emoji', $data); + $this->assertSame(':ghost:', $data['icon_emoji']); + $this->assertArrayHasKey('icon_url', $data2); + $this->assertSame('http://github.com/Seldaek/monolog', $data2['icon_url']); + } + + public function testAttachmentsNotPresentIfNoAttachment() + { + $record = new SlackRecord(null, null, false); + $data = $record->getSlackData($this->getRecord()); + + $this->assertArrayNotHasKey('attachments', $data); + } + + public function testAddsOneAttachment() + { + $record = new SlackRecord(); + $data = $record->getSlackData($this->getRecord()); + + $this->assertArrayHasKey('attachments', $data); + $this->assertArrayHasKey(0, $data['attachments']); + $this->assertInternalType('array', $data['attachments'][0]); + } + + public function testTextEqualsMessageIfNoAttachment() + { + $message = 'Test message'; + $record = new SlackRecord(null, null, false); + $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message)); + + $this->assertArrayHasKey('text', $data); + $this->assertSame($message, $data['text']); + } + + public function testTextEqualsFormatterOutput() + { + $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); + $formatter + ->expects($this->any()) + ->method('format') + ->will($this->returnCallback(function ($record) { return $record['message'] . 'test'; })); + + $formatter2 = $this->getMock('Monolog\\Formatter\\FormatterInterface'); + $formatter2 + ->expects($this->any()) + ->method('format') + ->will($this->returnCallback(function ($record) { return $record['message'] . 'test1'; })); + + $message = 'Test message'; + $record = new SlackRecord(null, null, false, null, false, false, array(), $formatter); + $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message)); + + $this->assertArrayHasKey('text', $data); + $this->assertSame($message . 'test', $data['text']); + + $record->setFormatter($formatter2); + $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message)); + + $this->assertArrayHasKey('text', $data); + $this->assertSame($message . 'test1', $data['text']); + } + + public function testAddsFallbackAndTextToAttachment() + { + $message = 'Test message'; + $record = new SlackRecord(null); + $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message)); + + $this->assertSame($message, $data['attachments'][0]['text']); + $this->assertSame($message, $data['attachments'][0]['fallback']); + } + + public function testMapsLevelToColorAttachmentColor() + { + $record = new SlackRecord(null); + $errorLoggerRecord = $this->getRecord(Logger::ERROR); + $emergencyLoggerRecord = $this->getRecord(Logger::EMERGENCY); + $warningLoggerRecord = $this->getRecord(Logger::WARNING); + $infoLoggerRecord = $this->getRecord(Logger::INFO); + $debugLoggerRecord = $this->getRecord(Logger::DEBUG); + + $data = $record->getSlackData($errorLoggerRecord); + $this->assertSame(SlackRecord::COLOR_DANGER, $data['attachments'][0]['color']); + + $data = $record->getSlackData($emergencyLoggerRecord); + $this->assertSame(SlackRecord::COLOR_DANGER, $data['attachments'][0]['color']); + + $data = $record->getSlackData($warningLoggerRecord); + $this->assertSame(SlackRecord::COLOR_WARNING, $data['attachments'][0]['color']); + + $data = $record->getSlackData($infoLoggerRecord); + $this->assertSame(SlackRecord::COLOR_GOOD, $data['attachments'][0]['color']); + + $data = $record->getSlackData($debugLoggerRecord); + $this->assertSame(SlackRecord::COLOR_DEFAULT, $data['attachments'][0]['color']); + } + + public function testAddsShortAttachmentWithoutContextAndExtra() + { + $level = Logger::ERROR; + $levelName = Logger::getLevelName($level); + $record = new SlackRecord(null, null, true, null, true); + $data = $record->getSlackData($this->getRecord($level, 'test', array('test' => 1))); + + $attachment = $data['attachments'][0]; + $this->assertArrayHasKey('title', $attachment); + $this->assertArrayHasKey('fields', $attachment); + $this->assertSame($levelName, $attachment['title']); + $this->assertSame(array(), $attachment['fields']); + } + + public function testAddsShortAttachmentWithContextAndExtra() + { + $level = Logger::ERROR; + $levelName = Logger::getLevelName($level); + $context = array('test' => 1); + $extra = array('tags' => array('web')); + $record = new SlackRecord(null, null, true, null, true, true); + $loggerRecord = $this->getRecord($level, 'test', $context); + $loggerRecord['extra'] = $extra; + $data = $record->getSlackData($loggerRecord); + + $attachment = $data['attachments'][0]; + $this->assertArrayHasKey('title', $attachment); + $this->assertArrayHasKey('fields', $attachment); + $this->assertCount(2, $attachment['fields']); + $this->assertSame($levelName, $attachment['title']); + $this->assertSame( + array( + array( + 'title' => 'Extra', + 'value' => sprintf('```%s```', json_encode($extra, $this->jsonPrettyPrintFlag)), + 'short' => false + ), + array( + 'title' => 'Context', + 'value' => sprintf('```%s```', json_encode($context, $this->jsonPrettyPrintFlag)), + 'short' => false + ) + ), + $attachment['fields'] + ); + } + + public function testAddsLongAttachmentWithoutContextAndExtra() + { + $level = Logger::ERROR; + $levelName = Logger::getLevelName($level); + $record = new SlackRecord(null, null, true, null); + $data = $record->getSlackData($this->getRecord($level, 'test', array('test' => 1))); + + $attachment = $data['attachments'][0]; + $this->assertArrayHasKey('title', $attachment); + $this->assertArrayHasKey('fields', $attachment); + $this->assertCount(1, $attachment['fields']); + $this->assertSame('Message', $attachment['title']); + $this->assertSame( + array(array( + 'title' => 'Level', + 'value' => $levelName, + 'short' => false + )), + $attachment['fields'] + ); + } + + public function testAddsLongAttachmentWithContextAndExtra() + { + $level = Logger::ERROR; + $levelName = Logger::getLevelName($level); + $context = array('test' => 1); + $extra = array('tags' => array('web')); + $record = new SlackRecord(null, null, true, null, false, true); + $loggerRecord = $this->getRecord($level, 'test', $context); + $loggerRecord['extra'] = $extra; + $data = $record->getSlackData($loggerRecord); + + $expectedFields = array( + array( + 'title' => 'Level', + 'value' => $levelName, + 'short' => false, + ), + array( + 'title' => 'Tags', + 'value' => sprintf('```%s```', json_encode($extra['tags'])), + 'short' => false + ), + array( + 'title' => 'Test', + 'value' => $context['test'], + 'short' => false + ) + ); + + $attachment = $data['attachments'][0]; + $this->assertArrayHasKey('title', $attachment); + $this->assertArrayHasKey('fields', $attachment); + $this->assertCount(3, $attachment['fields']); + $this->assertSame('Message', $attachment['title']); + $this->assertSame( + $expectedFields, + $attachment['fields'] + ); + } + + public function testAddsTimestampToAttachment() + { + $record = $this->getRecord(); + $slackRecord = new SlackRecord(); + $data = $slackRecord->getSlackData($this->getRecord()); + + $attachment = $data['attachments'][0]; + $this->assertArrayHasKey('ts', $attachment); + $this->assertSame($record['datetime']->getTimestamp(), $attachment['ts']); + } + + public function testContextHasException() + { + $record = $this->getRecord(Logger::CRITICAL, 'This is a critical message.', array('exception' => new \Exception())); + $slackRecord = new SlackRecord(null, null, true, null, false, true); + $data = $slackRecord->getSlackData($record); + $this->assertInternalType('string', $data['attachments'][0]['fields'][1]['value']); + } + + public function testExcludeExtraAndContextFields() + { + $record = $this->getRecord( + Logger::WARNING, + 'test', + array('info' => array('library' => 'monolog', 'author' => 'Jordi')) + ); + $record['extra'] = array('tags' => array('web', 'cli')); + + $slackRecord = new SlackRecord(null, null, true, null, false, true, array('context.info.library', 'extra.tags.1')); + $data = $slackRecord->getSlackData($record); + $attachment = $data['attachments'][0]; + + $expected = array( + array( + 'title' => 'Info', + 'value' => sprintf('```%s```', json_encode(array('author' => 'Jordi'), $this->jsonPrettyPrintFlag)), + 'short' => false + ), + array( + 'title' => 'Tags', + 'value' => sprintf('```%s```', json_encode(array('web'))), + 'short' => false + ), + ); + + foreach ($expected as $field) { + $this->assertNotFalse(array_search($field, $attachment['fields'])); + break; + } + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php new file mode 100644 index 0000000..b12b01f --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php @@ -0,0 +1,155 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; +use Monolog\Formatter\LineFormatter; +use Monolog\Handler\Slack\SlackRecord; + +/** + * @author Greg Kedzierski + * @see https://api.slack.com/ + */ +class SlackHandlerTest extends TestCase +{ + /** + * @var resource + */ + private $res; + + /** + * @var SlackHandler + */ + private $handler; + + public function setUp() + { + if (!extension_loaded('openssl')) { + $this->markTestSkipped('This test requires openssl to run'); + } + } + + public function testWriteHeader() + { + $this->createHandler(); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/POST \/api\/chat.postMessage HTTP\/1.1\\r\\nHost: slack.com\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content); + } + + public function testWriteContent() + { + $this->createHandler(); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegExp('/username=Monolog/', $content); + $this->assertRegExp('/channel=channel1/', $content); + $this->assertRegExp('/token=myToken/', $content); + $this->assertRegExp('/attachments/', $content); + } + + public function testWriteContentUsesFormatterIfProvided() + { + $this->createHandler('myToken', 'channel1', 'Monolog', false); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->createHandler('myToken', 'channel1', 'Monolog', false); + $this->handler->setFormatter(new LineFormatter('foo--%message%')); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test2')); + fseek($this->res, 0); + $content2 = fread($this->res, 1024); + + $this->assertRegexp('/text=test1/', $content); + $this->assertRegexp('/text=foo--test2/', $content2); + } + + public function testWriteContentWithEmoji() + { + $this->createHandler('myToken', 'channel1', 'Monolog', true, 'alien'); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/icon_emoji=%3Aalien%3A/', $content); + } + + /** + * @dataProvider provideLevelColors + */ + public function testWriteContentWithColors($level, $expectedColor) + { + $this->createHandler(); + $this->handler->handle($this->getRecord($level, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/%22color%22%3A%22'.$expectedColor.'/', $content); + } + + public function testWriteContentWithPlainTextMessage() + { + $this->createHandler('myToken', 'channel1', 'Monolog', false); + $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1')); + fseek($this->res, 0); + $content = fread($this->res, 1024); + + $this->assertRegexp('/text=test1/', $content); + } + + public function provideLevelColors() + { + return array( + array(Logger::DEBUG, urlencode(SlackRecord::COLOR_DEFAULT)), + array(Logger::INFO, SlackRecord::COLOR_GOOD), + array(Logger::NOTICE, SlackRecord::COLOR_GOOD), + array(Logger::WARNING, SlackRecord::COLOR_WARNING), + array(Logger::ERROR, SlackRecord::COLOR_DANGER), + array(Logger::CRITICAL, SlackRecord::COLOR_DANGER), + array(Logger::ALERT, SlackRecord::COLOR_DANGER), + array(Logger::EMERGENCY,SlackRecord::COLOR_DANGER), + ); + } + + private function createHandler($token = 'myToken', $channel = 'channel1', $username = 'Monolog', $useAttachment = true, $iconEmoji = null, $useShortAttachment = false, $includeExtra = false) + { + $constructorArgs = array($token, $channel, $username, $useAttachment, $iconEmoji, Logger::DEBUG, true, $useShortAttachment, $includeExtra); + $this->res = fopen('php://memory', 'a'); + $this->handler = $this->getMock( + '\Monolog\Handler\SlackHandler', + array('fsockopen', 'streamSetTimeout', 'closeSocket'), + $constructorArgs + ); + + $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString'); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($this->handler, 'localhost:1234'); + + $this->handler->expects($this->any()) + ->method('fsockopen') + ->will($this->returnValue($this->res)); + $this->handler->expects($this->any()) + ->method('streamSetTimeout') + ->will($this->returnValue(true)); + $this->handler->expects($this->any()) + ->method('closeSocket') + ->will($this->returnValue(true)); + + $this->handler->setFormatter($this->getIdentityFormatter()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SlackWebhookHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SlackWebhookHandlerTest.php new file mode 100644 index 0000000..c9229e2 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/SlackWebhookHandlerTest.php @@ -0,0 +1,107 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; +use Monolog\Formatter\LineFormatter; +use Monolog\Handler\Slack\SlackRecord; + +/** + * @author Haralan Dobrev + * @see https://api.slack.com/incoming-webhooks + * @coversDefaultClass Monolog\Handler\SlackWebhookHandler + */ +class SlackWebhookHandlerTest extends TestCase +{ + const WEBHOOK_URL = 'https://hooks.slack.com/services/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E'; + + /** + * @covers ::__construct + * @covers ::getSlackRecord + */ + public function testConstructorMinimal() + { + $handler = new SlackWebhookHandler(self::WEBHOOK_URL); + $record = $this->getRecord(); + $slackRecord = $handler->getSlackRecord(); + $this->assertInstanceOf('Monolog\Handler\Slack\SlackRecord', $slackRecord); + $this->assertEquals(array( + 'attachments' => array( + array( + 'fallback' => 'test', + 'text' => 'test', + 'color' => SlackRecord::COLOR_WARNING, + 'fields' => array( + array( + 'title' => 'Level', + 'value' => 'WARNING', + 'short' => false, + ), + ), + 'title' => 'Message', + 'mrkdwn_in' => array('fields'), + 'ts' => $record['datetime']->getTimestamp(), + ), + ), + ), $slackRecord->getSlackData($record)); + } + + /** + * @covers ::__construct + * @covers ::getSlackRecord + */ + public function testConstructorFull() + { + $handler = new SlackWebhookHandler( + self::WEBHOOK_URL, + 'test-channel', + 'test-username', + false, + ':ghost:', + false, + false, + Logger::DEBUG, + false + ); + + $slackRecord = $handler->getSlackRecord(); + $this->assertInstanceOf('Monolog\Handler\Slack\SlackRecord', $slackRecord); + $this->assertEquals(array( + 'username' => 'test-username', + 'text' => 'test', + 'channel' => 'test-channel', + 'icon_emoji' => ':ghost:', + ), $slackRecord->getSlackData($this->getRecord())); + } + + /** + * @covers ::getFormatter + */ + public function testGetFormatter() + { + $handler = new SlackWebhookHandler(self::WEBHOOK_URL); + $formatter = $handler->getFormatter(); + $this->assertInstanceOf('Monolog\Formatter\FormatterInterface', $formatter); + } + + /** + * @covers ::setFormatter + */ + public function testSetFormatter() + { + $handler = new SlackWebhookHandler(self::WEBHOOK_URL); + $formatter = new LineFormatter(); + $handler->setFormatter($formatter); + $this->assertSame($formatter, $handler->getFormatter()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SlackbotHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SlackbotHandlerTest.php new file mode 100644 index 0000000..b1b02bd --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/SlackbotHandlerTest.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +/** + * @author Haralan Dobrev + * @see https://slack.com/apps/A0F81R8ET-slackbot + * @coversDefaultClass Monolog\Handler\SlackbotHandler + */ +class SlackbotHandlerTest extends TestCase +{ + /** + * @covers ::__construct + */ + public function testConstructorMinimal() + { + $handler = new SlackbotHandler('test-team', 'test-token', 'test-channel'); + $this->assertInstanceOf('Monolog\Handler\AbstractProcessingHandler', $handler); + } + + /** + * @covers ::__construct + */ + public function testConstructorFull() + { + $handler = new SlackbotHandler( + 'test-team', + 'test-token', + 'test-channel', + Logger::DEBUG, + false + ); + $this->assertInstanceOf('Monolog\Handler\AbstractProcessingHandler', $handler); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php new file mode 100644 index 0000000..1da987c --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php @@ -0,0 +1,335 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +/** + * @author Pablo de Leon Belloc + */ +class SocketHandlerTest extends TestCase +{ + /** + * @var Monolog\Handler\SocketHandler + */ + private $handler; + + /** + * @var resource + */ + private $res; + + /** + * @expectedException UnexpectedValueException + */ + public function testInvalidHostname() + { + $this->createHandler('garbage://here'); + $this->writeRecord('data'); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testBadConnectionTimeout() + { + $this->createHandler('localhost:1234'); + $this->handler->setConnectionTimeout(-1); + } + + public function testSetConnectionTimeout() + { + $this->createHandler('localhost:1234'); + $this->handler->setConnectionTimeout(10.1); + $this->assertEquals(10.1, $this->handler->getConnectionTimeout()); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testBadTimeout() + { + $this->createHandler('localhost:1234'); + $this->handler->setTimeout(-1); + } + + public function testSetTimeout() + { + $this->createHandler('localhost:1234'); + $this->handler->setTimeout(10.25); + $this->assertEquals(10.25, $this->handler->getTimeout()); + } + + public function testSetWritingTimeout() + { + $this->createHandler('localhost:1234'); + $this->handler->setWritingTimeout(10.25); + $this->assertEquals(10.25, $this->handler->getWritingTimeout()); + } + + public function testSetChunkSize() + { + $this->createHandler('localhost:1234'); + $this->handler->setChunkSize(1025); + $this->assertEquals(1025, $this->handler->getChunkSize()); + } + + public function testSetConnectionString() + { + $this->createHandler('tcp://localhost:9090'); + $this->assertEquals('tcp://localhost:9090', $this->handler->getConnectionString()); + } + + /** + * @expectedException UnexpectedValueException + */ + public function testExceptionIsThrownOnFsockopenError() + { + $this->setMockHandler(array('fsockopen')); + $this->handler->expects($this->once()) + ->method('fsockopen') + ->will($this->returnValue(false)); + $this->writeRecord('Hello world'); + } + + /** + * @expectedException UnexpectedValueException + */ + public function testExceptionIsThrownOnPfsockopenError() + { + $this->setMockHandler(array('pfsockopen')); + $this->handler->expects($this->once()) + ->method('pfsockopen') + ->will($this->returnValue(false)); + $this->handler->setPersistent(true); + $this->writeRecord('Hello world'); + } + + /** + * @expectedException UnexpectedValueException + */ + public function testExceptionIsThrownIfCannotSetTimeout() + { + $this->setMockHandler(array('streamSetTimeout')); + $this->handler->expects($this->once()) + ->method('streamSetTimeout') + ->will($this->returnValue(false)); + $this->writeRecord('Hello world'); + } + + /** + * @expectedException UnexpectedValueException + */ + public function testExceptionIsThrownIfCannotSetChunkSize() + { + $this->setMockHandler(array('streamSetChunkSize')); + $this->handler->setChunkSize(8192); + $this->handler->expects($this->once()) + ->method('streamSetChunkSize') + ->will($this->returnValue(false)); + $this->writeRecord('Hello world'); + } + + /** + * @expectedException RuntimeException + */ + public function testWriteFailsOnIfFwriteReturnsFalse() + { + $this->setMockHandler(array('fwrite')); + + $callback = function ($arg) { + $map = array( + 'Hello world' => 6, + 'world' => false, + ); + + return $map[$arg]; + }; + + $this->handler->expects($this->exactly(2)) + ->method('fwrite') + ->will($this->returnCallback($callback)); + + $this->writeRecord('Hello world'); + } + + /** + * @expectedException RuntimeException + */ + public function testWriteFailsIfStreamTimesOut() + { + $this->setMockHandler(array('fwrite', 'streamGetMetadata')); + + $callback = function ($arg) { + $map = array( + 'Hello world' => 6, + 'world' => 5, + ); + + return $map[$arg]; + }; + + $this->handler->expects($this->exactly(1)) + ->method('fwrite') + ->will($this->returnCallback($callback)); + $this->handler->expects($this->exactly(1)) + ->method('streamGetMetadata') + ->will($this->returnValue(array('timed_out' => true))); + + $this->writeRecord('Hello world'); + } + + /** + * @expectedException RuntimeException + */ + public function testWriteFailsOnIncompleteWrite() + { + $this->setMockHandler(array('fwrite', 'streamGetMetadata')); + + $res = $this->res; + $callback = function ($string) use ($res) { + fclose($res); + + return strlen('Hello'); + }; + + $this->handler->expects($this->exactly(1)) + ->method('fwrite') + ->will($this->returnCallback($callback)); + $this->handler->expects($this->exactly(1)) + ->method('streamGetMetadata') + ->will($this->returnValue(array('timed_out' => false))); + + $this->writeRecord('Hello world'); + } + + public function testWriteWithMemoryFile() + { + $this->setMockHandler(); + $this->writeRecord('test1'); + $this->writeRecord('test2'); + $this->writeRecord('test3'); + fseek($this->res, 0); + $this->assertEquals('test1test2test3', fread($this->res, 1024)); + } + + public function testWriteWithMock() + { + $this->setMockHandler(array('fwrite')); + + $callback = function ($arg) { + $map = array( + 'Hello world' => 6, + 'world' => 5, + ); + + return $map[$arg]; + }; + + $this->handler->expects($this->exactly(2)) + ->method('fwrite') + ->will($this->returnCallback($callback)); + + $this->writeRecord('Hello world'); + } + + public function testClose() + { + $this->setMockHandler(); + $this->writeRecord('Hello world'); + $this->assertInternalType('resource', $this->res); + $this->handler->close(); + $this->assertFalse(is_resource($this->res), "Expected resource to be closed after closing handler"); + } + + public function testCloseDoesNotClosePersistentSocket() + { + $this->setMockHandler(); + $this->handler->setPersistent(true); + $this->writeRecord('Hello world'); + $this->assertTrue(is_resource($this->res)); + $this->handler->close(); + $this->assertTrue(is_resource($this->res)); + } + + /** + * @expectedException \RuntimeException + */ + public function testAvoidInfiniteLoopWhenNoDataIsWrittenForAWritingTimeoutSeconds() + { + $this->setMockHandler(array('fwrite', 'streamGetMetadata')); + + $this->handler->expects($this->any()) + ->method('fwrite') + ->will($this->returnValue(0)); + + $this->handler->expects($this->any()) + ->method('streamGetMetadata') + ->will($this->returnValue(array('timed_out' => false))); + + $this->handler->setWritingTimeout(1); + + $this->writeRecord('Hello world'); + } + + private function createHandler($connectionString) + { + $this->handler = new SocketHandler($connectionString); + $this->handler->setFormatter($this->getIdentityFormatter()); + } + + private function writeRecord($string) + { + $this->handler->handle($this->getRecord(Logger::WARNING, $string)); + } + + private function setMockHandler(array $methods = array()) + { + $this->res = fopen('php://memory', 'a'); + + $defaultMethods = array('fsockopen', 'pfsockopen', 'streamSetTimeout'); + $newMethods = array_diff($methods, $defaultMethods); + + $finalMethods = array_merge($defaultMethods, $newMethods); + + $this->handler = $this->getMock( + '\Monolog\Handler\SocketHandler', $finalMethods, array('localhost:1234') + ); + + if (!in_array('fsockopen', $methods)) { + $this->handler->expects($this->any()) + ->method('fsockopen') + ->will($this->returnValue($this->res)); + } + + if (!in_array('pfsockopen', $methods)) { + $this->handler->expects($this->any()) + ->method('pfsockopen') + ->will($this->returnValue($this->res)); + } + + if (!in_array('streamSetTimeout', $methods)) { + $this->handler->expects($this->any()) + ->method('streamSetTimeout') + ->will($this->returnValue(true)); + } + + if (!in_array('streamSetChunkSize', $methods)) { + $this->handler->expects($this->any()) + ->method('streamSetChunkSize') + ->will($this->returnValue(8192)); + } + + $this->handler->setFormatter($this->getIdentityFormatter()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php new file mode 100644 index 0000000..487030f --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php @@ -0,0 +1,184 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +class StreamHandlerTest extends TestCase +{ + /** + * @covers Monolog\Handler\StreamHandler::__construct + * @covers Monolog\Handler\StreamHandler::write + */ + public function testWrite() + { + $handle = fopen('php://memory', 'a+'); + $handler = new StreamHandler($handle); + $handler->setFormatter($this->getIdentityFormatter()); + $handler->handle($this->getRecord(Logger::WARNING, 'test')); + $handler->handle($this->getRecord(Logger::WARNING, 'test2')); + $handler->handle($this->getRecord(Logger::WARNING, 'test3')); + fseek($handle, 0); + $this->assertEquals('testtest2test3', fread($handle, 100)); + } + + /** + * @covers Monolog\Handler\StreamHandler::close + */ + public function testCloseKeepsExternalHandlersOpen() + { + $handle = fopen('php://memory', 'a+'); + $handler = new StreamHandler($handle); + $this->assertTrue(is_resource($handle)); + $handler->close(); + $this->assertTrue(is_resource($handle)); + } + + /** + * @covers Monolog\Handler\StreamHandler::close + */ + public function testClose() + { + $handler = new StreamHandler('php://memory'); + $handler->handle($this->getRecord(Logger::WARNING, 'test')); + $streamProp = new \ReflectionProperty('Monolog\Handler\StreamHandler', 'stream'); + $streamProp->setAccessible(true); + $handle = $streamProp->getValue($handler); + + $this->assertTrue(is_resource($handle)); + $handler->close(); + $this->assertFalse(is_resource($handle)); + } + + /** + * @covers Monolog\Handler\StreamHandler::write + */ + public function testWriteCreatesTheStreamResource() + { + $handler = new StreamHandler('php://memory'); + $handler->handle($this->getRecord()); + } + + /** + * @covers Monolog\Handler\StreamHandler::__construct + * @covers Monolog\Handler\StreamHandler::write + */ + public function testWriteLocking() + { + $temp = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'monolog_locked_log'; + $handler = new StreamHandler($temp, Logger::DEBUG, true, null, true); + $handler->handle($this->getRecord()); + } + + /** + * @expectedException LogicException + * @covers Monolog\Handler\StreamHandler::__construct + * @covers Monolog\Handler\StreamHandler::write + */ + public function testWriteMissingResource() + { + $handler = new StreamHandler(null); + $handler->handle($this->getRecord()); + } + + public function invalidArgumentProvider() + { + return array( + array(1), + array(array()), + array(array('bogus://url')), + ); + } + + /** + * @dataProvider invalidArgumentProvider + * @expectedException InvalidArgumentException + * @covers Monolog\Handler\StreamHandler::__construct + */ + public function testWriteInvalidArgument($invalidArgument) + { + $handler = new StreamHandler($invalidArgument); + } + + /** + * @expectedException UnexpectedValueException + * @covers Monolog\Handler\StreamHandler::__construct + * @covers Monolog\Handler\StreamHandler::write + */ + public function testWriteInvalidResource() + { + $handler = new StreamHandler('bogus://url'); + $handler->handle($this->getRecord()); + } + + /** + * @expectedException UnexpectedValueException + * @covers Monolog\Handler\StreamHandler::__construct + * @covers Monolog\Handler\StreamHandler::write + */ + public function testWriteNonExistingResource() + { + $handler = new StreamHandler('ftp://foo/bar/baz/'.rand(0, 10000)); + $handler->handle($this->getRecord()); + } + + /** + * @covers Monolog\Handler\StreamHandler::__construct + * @covers Monolog\Handler\StreamHandler::write + */ + public function testWriteNonExistingPath() + { + $handler = new StreamHandler(sys_get_temp_dir().'/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); + $handler->handle($this->getRecord()); + } + + /** + * @covers Monolog\Handler\StreamHandler::__construct + * @covers Monolog\Handler\StreamHandler::write + */ + public function testWriteNonExistingFileResource() + { + $handler = new StreamHandler('file://'.sys_get_temp_dir().'/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); + $handler->handle($this->getRecord()); + } + + /** + * @expectedException Exception + * @expectedExceptionMessageRegExp /There is no existing directory at/ + * @covers Monolog\Handler\StreamHandler::__construct + * @covers Monolog\Handler\StreamHandler::write + */ + public function testWriteNonExistingAndNotCreatablePath() + { + if (defined('PHP_WINDOWS_VERSION_BUILD')) { + $this->markTestSkipped('Permissions checks can not run on windows'); + } + $handler = new StreamHandler('/foo/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); + $handler->handle($this->getRecord()); + } + + /** + * @expectedException Exception + * @expectedExceptionMessageRegExp /There is no existing directory at/ + * @covers Monolog\Handler\StreamHandler::__construct + * @covers Monolog\Handler\StreamHandler::write + */ + public function testWriteNonExistingAndNotCreatableFileResource() + { + if (defined('PHP_WINDOWS_VERSION_BUILD')) { + $this->markTestSkipped('Permissions checks can not run on windows'); + } + $handler = new StreamHandler('file:///foo/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000)); + $handler->handle($this->getRecord()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php new file mode 100644 index 0000000..1d62940 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php @@ -0,0 +1,113 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\TestCase; + +class SwiftMailerHandlerTest extends TestCase +{ + /** @var \Swift_Mailer|\PHPUnit_Framework_MockObject_MockObject */ + private $mailer; + + public function setUp() + { + $this->mailer = $this + ->getMockBuilder('Swift_Mailer') + ->disableOriginalConstructor() + ->getMock(); + } + + public function testMessageCreationIsLazyWhenUsingCallback() + { + $this->mailer->expects($this->never()) + ->method('send'); + + $callback = function () { + throw new \RuntimeException('Swift_Message creation callback should not have been called in this test'); + }; + $handler = new SwiftMailerHandler($this->mailer, $callback); + + $records = array( + $this->getRecord(Logger::DEBUG), + $this->getRecord(Logger::INFO), + ); + $handler->handleBatch($records); + } + + public function testMessageCanBeCustomizedGivenLoggedData() + { + // Wire Mailer to expect a specific Swift_Message with a customized Subject + $expectedMessage = new \Swift_Message(); + $this->mailer->expects($this->once()) + ->method('send') + ->with($this->callback(function ($value) use ($expectedMessage) { + return $value instanceof \Swift_Message + && $value->getSubject() === 'Emergency' + && $value === $expectedMessage; + })); + + // Callback dynamically changes subject based on number of logged records + $callback = function ($content, array $records) use ($expectedMessage) { + $subject = count($records) > 0 ? 'Emergency' : 'Normal'; + $expectedMessage->setSubject($subject); + + return $expectedMessage; + }; + $handler = new SwiftMailerHandler($this->mailer, $callback); + + // Logging 1 record makes this an Emergency + $records = array( + $this->getRecord(Logger::EMERGENCY), + ); + $handler->handleBatch($records); + } + + public function testMessageSubjectFormatting() + { + // Wire Mailer to expect a specific Swift_Message with a customized Subject + $messageTemplate = new \Swift_Message(); + $messageTemplate->setSubject('Alert: %level_name% %message%'); + $receivedMessage = null; + + $this->mailer->expects($this->once()) + ->method('send') + ->with($this->callback(function ($value) use (&$receivedMessage) { + $receivedMessage = $value; + return true; + })); + + $handler = new SwiftMailerHandler($this->mailer, $messageTemplate); + + $records = array( + $this->getRecord(Logger::EMERGENCY), + ); + $handler->handleBatch($records); + + $this->assertEquals('Alert: EMERGENCY test', $receivedMessage->getSubject()); + } + + public function testMessageHaveUniqueId() + { + $messageTemplate = new \Swift_Message(); + $handler = new SwiftMailerHandler($this->mailer, $messageTemplate); + + $method = new \ReflectionMethod('Monolog\Handler\SwiftMailerHandler', 'buildMessage'); + $method->setAccessible(true); + $method->invokeArgs($handler, array($messageTemplate, array())); + + $builtMessage1 = $method->invoke($handler, $messageTemplate, array()); + $builtMessage2 = $method->invoke($handler, $messageTemplate, array()); + + $this->assertFalse($builtMessage1->getId() === $builtMessage2->getId(), 'Two different messages have the same id'); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SyslogHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SyslogHandlerTest.php new file mode 100644 index 0000000..8f9e46b --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/SyslogHandlerTest.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; + +class SyslogHandlerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Monolog\Handler\SyslogHandler::__construct + */ + public function testConstruct() + { + $handler = new SyslogHandler('test'); + $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler); + + $handler = new SyslogHandler('test', LOG_USER); + $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler); + + $handler = new SyslogHandler('test', 'user'); + $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler); + + $handler = new SyslogHandler('test', LOG_USER, Logger::DEBUG, true, LOG_PERROR); + $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler); + } + + /** + * @covers Monolog\Handler\SyslogHandler::__construct + */ + public function testConstructInvalidFacility() + { + $this->setExpectedException('UnexpectedValueException'); + $handler = new SyslogHandler('test', 'unknown'); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php new file mode 100644 index 0000000..7ee8a98 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; + +/** + * @requires extension sockets + */ +class SyslogUdpHandlerTest extends TestCase +{ + /** + * @expectedException UnexpectedValueException + */ + public function testWeValidateFacilities() + { + $handler = new SyslogUdpHandler("ip", null, "invalidFacility"); + } + + public function testWeSplitIntoLines() + { + $time = '2014-01-07T12:34'; + $pid = getmypid(); + $host = gethostname(); + + $handler = $this->getMockBuilder('\Monolog\Handler\SyslogUdpHandler') + ->setConstructorArgs(array("127.0.0.1", 514, "authpriv")) + ->setMethods(array('getDateTime')) + ->getMock(); + + $handler->method('getDateTime') + ->willReturn($time); + + $handler->setFormatter(new \Monolog\Formatter\ChromePHPFormatter()); + + $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('write'), array('lol', 'lol')); + $socket->expects($this->at(0)) + ->method('write') + ->with("lol", "<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - "); + $socket->expects($this->at(1)) + ->method('write') + ->with("hej", "<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - "); + + $handler->setSocket($socket); + + $handler->handle($this->getRecordWithMessage("hej\nlol")); + } + + public function testSplitWorksOnEmptyMsg() + { + $handler = new SyslogUdpHandler("127.0.0.1", 514, "authpriv"); + $handler->setFormatter($this->getIdentityFormatter()); + + $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('write'), array('lol', 'lol')); + $socket->expects($this->never()) + ->method('write'); + + $handler->setSocket($socket); + + $handler->handle($this->getRecordWithMessage(null)); + } + + protected function getRecordWithMessage($msg) + { + return array('message' => $msg, 'level' => \Monolog\Logger::WARNING, 'context' => null, 'extra' => array(), 'channel' => 'lol'); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php new file mode 100644 index 0000000..a7c4fc9 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php @@ -0,0 +1,116 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +/** + * @covers Monolog\Handler\TestHandler + */ +class TestHandlerTest extends TestCase +{ + /** + * @dataProvider methodProvider + */ + public function testHandler($method, $level) + { + $handler = new TestHandler; + $record = $this->getRecord($level, 'test'.$method); + $this->assertFalse($handler->hasRecords($level)); + $this->assertFalse($handler->hasRecord($record, $level)); + $this->assertFalse($handler->{'has'.$method}($record), 'has'.$method); + $this->assertFalse($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains'); + $this->assertFalse($handler->{'has'.$method.'ThatPasses'}(function ($rec) { + return true; + }), 'has'.$method.'ThatPasses'); + $this->assertFalse($handler->{'has'.$method.'ThatMatches'}('/test\w+/')); + $this->assertFalse($handler->{'has'.$method.'Records'}(), 'has'.$method.'Records'); + $handler->handle($record); + + $this->assertFalse($handler->{'has'.$method}('bar'), 'has'.$method); + $this->assertTrue($handler->hasRecords($level)); + $this->assertTrue($handler->hasRecord($record, $level)); + $this->assertTrue($handler->{'has'.$method}($record), 'has'.$method); + $this->assertTrue($handler->{'has'.$method}('test'.$method), 'has'.$method); + $this->assertTrue($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains'); + $this->assertTrue($handler->{'has'.$method.'ThatPasses'}(function ($rec) { + return true; + }), 'has'.$method.'ThatPasses'); + $this->assertTrue($handler->{'has'.$method.'ThatMatches'}('/test\w+/')); + $this->assertTrue($handler->{'has'.$method.'Records'}(), 'has'.$method.'Records'); + + $records = $handler->getRecords(); + unset($records[0]['formatted']); + $this->assertEquals(array($record), $records); + } + + public function testHandlerAssertEmptyContext() { + $handler = new TestHandler; + $record = $this->getRecord(Logger::WARNING, 'test', array()); + $this->assertFalse($handler->hasWarning(array( + 'message' => 'test', + 'context' => array(), + ))); + + $handler->handle($record); + + $this->assertTrue($handler->hasWarning(array( + 'message' => 'test', + 'context' => array(), + ))); + $this->assertFalse($handler->hasWarning(array( + 'message' => 'test', + 'context' => array( + 'foo' => 'bar' + ), + ))); + } + + public function testHandlerAssertNonEmptyContext() { + $handler = new TestHandler; + $record = $this->getRecord(Logger::WARNING, 'test', array('foo' => 'bar')); + $this->assertFalse($handler->hasWarning(array( + 'message' => 'test', + 'context' => array( + 'foo' => 'bar' + ), + ))); + + $handler->handle($record); + + $this->assertTrue($handler->hasWarning(array( + 'message' => 'test', + 'context' => array( + 'foo' => 'bar' + ), + ))); + $this->assertFalse($handler->hasWarning(array( + 'message' => 'test', + 'context' => array(), + ))); + } + + public function methodProvider() + { + return array( + array('Emergency', Logger::EMERGENCY), + array('Alert' , Logger::ALERT), + array('Critical' , Logger::CRITICAL), + array('Error' , Logger::ERROR), + array('Warning' , Logger::WARNING), + array('Info' , Logger::INFO), + array('Notice' , Logger::NOTICE), + array('Debug' , Logger::DEBUG), + ); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/UdpSocketTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/UdpSocketTest.php new file mode 100644 index 0000000..fa524d0 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/UdpSocketTest.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Handler\SyslogUdp\UdpSocket; + +/** + * @requires extension sockets + */ +class UdpSocketTest extends TestCase +{ + public function testWeDoNotTruncateShortMessages() + { + $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('send'), array('lol', 'lol')); + + $socket->expects($this->at(0)) + ->method('send') + ->with("HEADER: The quick brown fox jumps over the lazy dog"); + + $socket->write("The quick brown fox jumps over the lazy dog", "HEADER: "); + } + + public function testLongMessagesAreTruncated() + { + $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('send'), array('lol', 'lol')); + + $truncatedString = str_repeat("derp", 16254).'d'; + + $socket->expects($this->exactly(1)) + ->method('send') + ->with("HEADER" . $truncatedString); + + $longString = str_repeat("derp", 20000); + + $socket->write($longString, "HEADER"); + } + + public function testDoubleCloseDoesNotError() + { + $socket = new UdpSocket('127.0.0.1', 514); + $socket->close(); + $socket->close(); + } + + /** + * @expectedException LogicException + */ + public function testWriteAfterCloseErrors() + { + $socket = new UdpSocket('127.0.0.1', 514); + $socket->close(); + $socket->write('foo', "HEADER"); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/WhatFailureGroupHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/WhatFailureGroupHandlerTest.php new file mode 100644 index 0000000..0594a23 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/WhatFailureGroupHandlerTest.php @@ -0,0 +1,144 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; +use Monolog\Logger; + +class WhatFailureGroupHandlerTest extends TestCase +{ + /** + * @covers Monolog\Handler\WhatFailureGroupHandler::__construct + * @expectedException InvalidArgumentException + */ + public function testConstructorOnlyTakesHandler() + { + new WhatFailureGroupHandler(array(new TestHandler(), "foo")); + } + + /** + * @covers Monolog\Handler\WhatFailureGroupHandler::__construct + * @covers Monolog\Handler\WhatFailureGroupHandler::handle + */ + public function testHandle() + { + $testHandlers = array(new TestHandler(), new TestHandler()); + $handler = new WhatFailureGroupHandler($testHandlers); + $handler->handle($this->getRecord(Logger::DEBUG)); + $handler->handle($this->getRecord(Logger::INFO)); + foreach ($testHandlers as $test) { + $this->assertTrue($test->hasDebugRecords()); + $this->assertTrue($test->hasInfoRecords()); + $this->assertTrue(count($test->getRecords()) === 2); + } + } + + /** + * @covers Monolog\Handler\WhatFailureGroupHandler::handleBatch + */ + public function testHandleBatch() + { + $testHandlers = array(new TestHandler(), new TestHandler()); + $handler = new WhatFailureGroupHandler($testHandlers); + $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO))); + foreach ($testHandlers as $test) { + $this->assertTrue($test->hasDebugRecords()); + $this->assertTrue($test->hasInfoRecords()); + $this->assertTrue(count($test->getRecords()) === 2); + } + } + + /** + * @covers Monolog\Handler\WhatFailureGroupHandler::isHandling + */ + public function testIsHandling() + { + $testHandlers = array(new TestHandler(Logger::ERROR), new TestHandler(Logger::WARNING)); + $handler = new WhatFailureGroupHandler($testHandlers); + $this->assertTrue($handler->isHandling($this->getRecord(Logger::ERROR))); + $this->assertTrue($handler->isHandling($this->getRecord(Logger::WARNING))); + $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG))); + } + + /** + * @covers Monolog\Handler\WhatFailureGroupHandler::handle + */ + public function testHandleUsesProcessors() + { + $test = new TestHandler(); + $handler = new WhatFailureGroupHandler(array($test)); + $handler->pushProcessor(function ($record) { + $record['extra']['foo'] = true; + + return $record; + }); + $handler->handle($this->getRecord(Logger::WARNING)); + $this->assertTrue($test->hasWarningRecords()); + $records = $test->getRecords(); + $this->assertTrue($records[0]['extra']['foo']); + } + + /** + * @covers Monolog\Handler\WhatFailureGroupHandler::handleBatch + */ + public function testHandleBatchUsesProcessors() + { + $testHandlers = array(new TestHandler(), new TestHandler()); + $handler = new WhatFailureGroupHandler($testHandlers); + $handler->pushProcessor(function ($record) { + $record['extra']['foo'] = true; + + return $record; + }); + $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO))); + foreach ($testHandlers as $test) { + $this->assertTrue($test->hasDebugRecords()); + $this->assertTrue($test->hasInfoRecords()); + $this->assertTrue(count($test->getRecords()) === 2); + $records = $test->getRecords(); + $this->assertTrue($records[0]['extra']['foo']); + $this->assertTrue($records[1]['extra']['foo']); + } + } + + /** + * @covers Monolog\Handler\WhatFailureGroupHandler::handle + */ + public function testHandleException() + { + $test = new TestHandler(); + $exception = new ExceptionTestHandler(); + $handler = new WhatFailureGroupHandler(array($exception, $test, $exception)); + $handler->pushProcessor(function ($record) { + $record['extra']['foo'] = true; + + return $record; + }); + $handler->handle($this->getRecord(Logger::WARNING)); + $this->assertTrue($test->hasWarningRecords()); + $records = $test->getRecords(); + $this->assertTrue($records[0]['extra']['foo']); + } +} + +class ExceptionTestHandler extends TestHandler +{ + /** + * {@inheritdoc} + */ + public function handle(array $record) + { + parent::handle($record); + + throw new \Exception("ExceptionTestHandler::handle"); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php new file mode 100644 index 0000000..69b001e --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\TestCase; + +class ZendMonitorHandlerTest extends TestCase +{ + protected $zendMonitorHandler; + + public function setUp() + { + if (!function_exists('zend_monitor_custom_event')) { + $this->markTestSkipped('ZendServer is not installed'); + } + } + + /** + * @covers Monolog\Handler\ZendMonitorHandler::write + */ + public function testWrite() + { + $record = $this->getRecord(); + $formatterResult = array( + 'message' => $record['message'], + ); + + $zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler') + ->setMethods(array('writeZendMonitorCustomEvent', 'getDefaultFormatter')) + ->getMock(); + + $formatterMock = $this->getMockBuilder('Monolog\Formatter\NormalizerFormatter') + ->disableOriginalConstructor() + ->getMock(); + + $formatterMock->expects($this->once()) + ->method('format') + ->will($this->returnValue($formatterResult)); + + $zendMonitor->expects($this->once()) + ->method('getDefaultFormatter') + ->will($this->returnValue($formatterMock)); + + $levelMap = $zendMonitor->getLevelMap(); + + $zendMonitor->expects($this->once()) + ->method('writeZendMonitorCustomEvent') + ->with($levelMap[$record['level']], $record['message'], $formatterResult); + + $zendMonitor->handle($record); + } + + /** + * @covers Monolog\Handler\ZendMonitorHandler::getDefaultFormatter + */ + public function testGetDefaultFormatterReturnsNormalizerFormatter() + { + $zendMonitor = new ZendMonitorHandler(); + $this->assertInstanceOf('Monolog\Formatter\NormalizerFormatter', $zendMonitor->getDefaultFormatter()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/LoggerTest.php b/vendor/monolog/monolog/tests/Monolog/LoggerTest.php new file mode 100644 index 0000000..442e87d --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/LoggerTest.php @@ -0,0 +1,690 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use Monolog\Processor\WebProcessor; +use Monolog\Handler\TestHandler; + +class LoggerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Monolog\Logger::getName + */ + public function testGetName() + { + $logger = new Logger('foo'); + $this->assertEquals('foo', $logger->getName()); + } + + /** + * @covers Monolog\Logger::getLevelName + */ + public function testGetLevelName() + { + $this->assertEquals('ERROR', Logger::getLevelName(Logger::ERROR)); + } + + /** + * @covers Monolog\Logger::withName + */ + public function testWithName() + { + $first = new Logger('first', array($handler = new TestHandler())); + $second = $first->withName('second'); + + $this->assertSame('first', $first->getName()); + $this->assertSame('second', $second->getName()); + $this->assertSame($handler, $second->popHandler()); + } + + /** + * @covers Monolog\Logger::toMonologLevel + */ + public function testConvertPSR3ToMonologLevel() + { + $this->assertEquals(Logger::toMonologLevel('debug'), 100); + $this->assertEquals(Logger::toMonologLevel('info'), 200); + $this->assertEquals(Logger::toMonologLevel('notice'), 250); + $this->assertEquals(Logger::toMonologLevel('warning'), 300); + $this->assertEquals(Logger::toMonologLevel('error'), 400); + $this->assertEquals(Logger::toMonologLevel('critical'), 500); + $this->assertEquals(Logger::toMonologLevel('alert'), 550); + $this->assertEquals(Logger::toMonologLevel('emergency'), 600); + } + + /** + * @covers Monolog\Logger::getLevelName + * @expectedException InvalidArgumentException + */ + public function testGetLevelNameThrows() + { + Logger::getLevelName(5); + } + + /** + * @covers Monolog\Logger::__construct + */ + public function testChannel() + { + $logger = new Logger('foo'); + $handler = new TestHandler; + $logger->pushHandler($handler); + $logger->addWarning('test'); + list($record) = $handler->getRecords(); + $this->assertEquals('foo', $record['channel']); + } + + /** + * @covers Monolog\Logger::addRecord + */ + public function testLog() + { + $logger = new Logger(__METHOD__); + + $handler = $this->getMock('Monolog\Handler\NullHandler', array('handle')); + $handler->expects($this->once()) + ->method('handle'); + $logger->pushHandler($handler); + + $this->assertTrue($logger->addWarning('test')); + } + + /** + * @covers Monolog\Logger::addRecord + */ + public function testLogNotHandled() + { + $logger = new Logger(__METHOD__); + + $handler = $this->getMock('Monolog\Handler\NullHandler', array('handle'), array(Logger::ERROR)); + $handler->expects($this->never()) + ->method('handle'); + $logger->pushHandler($handler); + + $this->assertFalse($logger->addWarning('test')); + } + + public function testHandlersInCtor() + { + $handler1 = new TestHandler; + $handler2 = new TestHandler; + $logger = new Logger(__METHOD__, array($handler1, $handler2)); + + $this->assertEquals($handler1, $logger->popHandler()); + $this->assertEquals($handler2, $logger->popHandler()); + } + + public function testProcessorsInCtor() + { + $processor1 = new WebProcessor; + $processor2 = new WebProcessor; + $logger = new Logger(__METHOD__, array(), array($processor1, $processor2)); + + $this->assertEquals($processor1, $logger->popProcessor()); + $this->assertEquals($processor2, $logger->popProcessor()); + } + + /** + * @covers Monolog\Logger::pushHandler + * @covers Monolog\Logger::popHandler + * @expectedException LogicException + */ + public function testPushPopHandler() + { + $logger = new Logger(__METHOD__); + $handler1 = new TestHandler; + $handler2 = new TestHandler; + + $logger->pushHandler($handler1); + $logger->pushHandler($handler2); + + $this->assertEquals($handler2, $logger->popHandler()); + $this->assertEquals($handler1, $logger->popHandler()); + $logger->popHandler(); + } + + /** + * @covers Monolog\Logger::setHandlers + */ + public function testSetHandlers() + { + $logger = new Logger(__METHOD__); + $handler1 = new TestHandler; + $handler2 = new TestHandler; + + $logger->pushHandler($handler1); + $logger->setHandlers(array($handler2)); + + // handler1 has been removed + $this->assertEquals(array($handler2), $logger->getHandlers()); + + $logger->setHandlers(array( + "AMapKey" => $handler1, + "Woop" => $handler2, + )); + + // Keys have been scrubbed + $this->assertEquals(array($handler1, $handler2), $logger->getHandlers()); + } + + /** + * @covers Monolog\Logger::pushProcessor + * @covers Monolog\Logger::popProcessor + * @expectedException LogicException + */ + public function testPushPopProcessor() + { + $logger = new Logger(__METHOD__); + $processor1 = new WebProcessor; + $processor2 = new WebProcessor; + + $logger->pushProcessor($processor1); + $logger->pushProcessor($processor2); + + $this->assertEquals($processor2, $logger->popProcessor()); + $this->assertEquals($processor1, $logger->popProcessor()); + $logger->popProcessor(); + } + + /** + * @covers Monolog\Logger::pushProcessor + * @expectedException InvalidArgumentException + */ + public function testPushProcessorWithNonCallable() + { + $logger = new Logger(__METHOD__); + + $logger->pushProcessor(new \stdClass()); + } + + /** + * @covers Monolog\Logger::addRecord + */ + public function testProcessorsAreExecuted() + { + $logger = new Logger(__METHOD__); + $handler = new TestHandler; + $logger->pushHandler($handler); + $logger->pushProcessor(function ($record) { + $record['extra']['win'] = true; + + return $record; + }); + $logger->addError('test'); + list($record) = $handler->getRecords(); + $this->assertTrue($record['extra']['win']); + } + + /** + * @covers Monolog\Logger::addRecord + */ + public function testProcessorsAreCalledOnlyOnce() + { + $logger = new Logger(__METHOD__); + $handler = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler->expects($this->any()) + ->method('isHandling') + ->will($this->returnValue(true)) + ; + $handler->expects($this->any()) + ->method('handle') + ->will($this->returnValue(true)) + ; + $logger->pushHandler($handler); + + $processor = $this->getMockBuilder('Monolog\Processor\WebProcessor') + ->disableOriginalConstructor() + ->setMethods(array('__invoke')) + ->getMock() + ; + $processor->expects($this->once()) + ->method('__invoke') + ->will($this->returnArgument(0)) + ; + $logger->pushProcessor($processor); + + $logger->addError('test'); + } + + /** + * @covers Monolog\Logger::addRecord + */ + public function testProcessorsNotCalledWhenNotHandled() + { + $logger = new Logger(__METHOD__); + $handler = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler->expects($this->once()) + ->method('isHandling') + ->will($this->returnValue(false)) + ; + $logger->pushHandler($handler); + $that = $this; + $logger->pushProcessor(function ($record) use ($that) { + $that->fail('The processor should not be called'); + }); + $logger->addAlert('test'); + } + + /** + * @covers Monolog\Logger::addRecord + */ + public function testHandlersNotCalledBeforeFirstHandling() + { + $logger = new Logger(__METHOD__); + + $handler1 = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler1->expects($this->never()) + ->method('isHandling') + ->will($this->returnValue(false)) + ; + $handler1->expects($this->once()) + ->method('handle') + ->will($this->returnValue(false)) + ; + $logger->pushHandler($handler1); + + $handler2 = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler2->expects($this->once()) + ->method('isHandling') + ->will($this->returnValue(true)) + ; + $handler2->expects($this->once()) + ->method('handle') + ->will($this->returnValue(false)) + ; + $logger->pushHandler($handler2); + + $handler3 = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler3->expects($this->once()) + ->method('isHandling') + ->will($this->returnValue(false)) + ; + $handler3->expects($this->never()) + ->method('handle') + ; + $logger->pushHandler($handler3); + + $logger->debug('test'); + } + + /** + * @covers Monolog\Logger::addRecord + */ + public function testHandlersNotCalledBeforeFirstHandlingWithAssocArray() + { + $handler1 = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler1->expects($this->never()) + ->method('isHandling') + ->will($this->returnValue(false)) + ; + $handler1->expects($this->once()) + ->method('handle') + ->will($this->returnValue(false)) + ; + + $handler2 = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler2->expects($this->once()) + ->method('isHandling') + ->will($this->returnValue(true)) + ; + $handler2->expects($this->once()) + ->method('handle') + ->will($this->returnValue(false)) + ; + + $handler3 = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler3->expects($this->once()) + ->method('isHandling') + ->will($this->returnValue(false)) + ; + $handler3->expects($this->never()) + ->method('handle') + ; + + $logger = new Logger(__METHOD__, array('last' => $handler3, 'second' => $handler2, 'first' => $handler1)); + + $logger->debug('test'); + } + + /** + * @covers Monolog\Logger::addRecord + */ + public function testBubblingWhenTheHandlerReturnsFalse() + { + $logger = new Logger(__METHOD__); + + $handler1 = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler1->expects($this->any()) + ->method('isHandling') + ->will($this->returnValue(true)) + ; + $handler1->expects($this->once()) + ->method('handle') + ->will($this->returnValue(false)) + ; + $logger->pushHandler($handler1); + + $handler2 = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler2->expects($this->any()) + ->method('isHandling') + ->will($this->returnValue(true)) + ; + $handler2->expects($this->once()) + ->method('handle') + ->will($this->returnValue(false)) + ; + $logger->pushHandler($handler2); + + $logger->debug('test'); + } + + /** + * @covers Monolog\Logger::addRecord + */ + public function testNotBubblingWhenTheHandlerReturnsTrue() + { + $logger = new Logger(__METHOD__); + + $handler1 = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler1->expects($this->any()) + ->method('isHandling') + ->will($this->returnValue(true)) + ; + $handler1->expects($this->never()) + ->method('handle') + ; + $logger->pushHandler($handler1); + + $handler2 = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler2->expects($this->any()) + ->method('isHandling') + ->will($this->returnValue(true)) + ; + $handler2->expects($this->once()) + ->method('handle') + ->will($this->returnValue(true)) + ; + $logger->pushHandler($handler2); + + $logger->debug('test'); + } + + /** + * @covers Monolog\Logger::isHandling + */ + public function testIsHandling() + { + $logger = new Logger(__METHOD__); + + $handler1 = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler1->expects($this->any()) + ->method('isHandling') + ->will($this->returnValue(false)) + ; + + $logger->pushHandler($handler1); + $this->assertFalse($logger->isHandling(Logger::DEBUG)); + + $handler2 = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler2->expects($this->any()) + ->method('isHandling') + ->will($this->returnValue(true)) + ; + + $logger->pushHandler($handler2); + $this->assertTrue($logger->isHandling(Logger::DEBUG)); + } + + /** + * @dataProvider logMethodProvider + * @covers Monolog\Logger::addDebug + * @covers Monolog\Logger::addInfo + * @covers Monolog\Logger::addNotice + * @covers Monolog\Logger::addWarning + * @covers Monolog\Logger::addError + * @covers Monolog\Logger::addCritical + * @covers Monolog\Logger::addAlert + * @covers Monolog\Logger::addEmergency + * @covers Monolog\Logger::debug + * @covers Monolog\Logger::info + * @covers Monolog\Logger::notice + * @covers Monolog\Logger::warn + * @covers Monolog\Logger::err + * @covers Monolog\Logger::crit + * @covers Monolog\Logger::alert + * @covers Monolog\Logger::emerg + */ + public function testLogMethods($method, $expectedLevel) + { + $logger = new Logger('foo'); + $handler = new TestHandler; + $logger->pushHandler($handler); + $logger->{$method}('test'); + list($record) = $handler->getRecords(); + $this->assertEquals($expectedLevel, $record['level']); + } + + public function logMethodProvider() + { + return array( + // monolog methods + array('addDebug', Logger::DEBUG), + array('addInfo', Logger::INFO), + array('addNotice', Logger::NOTICE), + array('addWarning', Logger::WARNING), + array('addError', Logger::ERROR), + array('addCritical', Logger::CRITICAL), + array('addAlert', Logger::ALERT), + array('addEmergency', Logger::EMERGENCY), + + // ZF/Sf2 compat methods + array('debug', Logger::DEBUG), + array('info', Logger::INFO), + array('notice', Logger::NOTICE), + array('warn', Logger::WARNING), + array('err', Logger::ERROR), + array('crit', Logger::CRITICAL), + array('alert', Logger::ALERT), + array('emerg', Logger::EMERGENCY), + ); + } + + /** + * @dataProvider setTimezoneProvider + * @covers Monolog\Logger::setTimezone + */ + public function testSetTimezone($tz) + { + Logger::setTimezone($tz); + $logger = new Logger('foo'); + $handler = new TestHandler; + $logger->pushHandler($handler); + $logger->info('test'); + list($record) = $handler->getRecords(); + $this->assertEquals($tz, $record['datetime']->getTimezone()); + } + + public function setTimezoneProvider() + { + return array_map( + function ($tz) { return array(new \DateTimeZone($tz)); }, + \DateTimeZone::listIdentifiers() + ); + } + + /** + * @dataProvider useMicrosecondTimestampsProvider + * @covers Monolog\Logger::useMicrosecondTimestamps + * @covers Monolog\Logger::addRecord + */ + public function testUseMicrosecondTimestamps($micro, $assert) + { + $logger = new Logger('foo'); + $logger->useMicrosecondTimestamps($micro); + $handler = new TestHandler; + $logger->pushHandler($handler); + $logger->info('test'); + list($record) = $handler->getRecords(); + $this->{$assert}('000000', $record['datetime']->format('u')); + } + + public function useMicrosecondTimestampsProvider() + { + return array( + // this has a very small chance of a false negative (1/10^6) + 'with microseconds' => array(true, 'assertNotSame'), + 'without microseconds' => array(false, PHP_VERSION_ID >= 70100 ? 'assertNotSame' : 'assertSame'), + ); + } + + /** + * @covers Monolog\Logger::setExceptionHandler + */ + public function testSetExceptionHandler() + { + $logger = new Logger(__METHOD__); + $this->assertNull($logger->getExceptionHandler()); + $callback = function ($ex) { + }; + $logger->setExceptionHandler($callback); + $this->assertEquals($callback, $logger->getExceptionHandler()); + } + + /** + * @covers Monolog\Logger::setExceptionHandler + * @expectedException InvalidArgumentException + */ + public function testBadExceptionHandlerType() + { + $logger = new Logger(__METHOD__); + $logger->setExceptionHandler(false); + } + + /** + * @covers Monolog\Logger::handleException + * @expectedException Exception + */ + public function testDefaultHandleException() + { + $logger = new Logger(__METHOD__); + $handler = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler->expects($this->any()) + ->method('isHandling') + ->will($this->returnValue(true)) + ; + $handler->expects($this->any()) + ->method('handle') + ->will($this->throwException(new \Exception('Some handler exception'))) + ; + $logger->pushHandler($handler); + $logger->info('test'); + } + + /** + * @covers Monolog\Logger::handleException + * @covers Monolog\Logger::addRecord + */ + public function testCustomHandleException() + { + $logger = new Logger(__METHOD__); + $that = $this; + $logger->setExceptionHandler(function ($e, $record) use ($that) { + $that->assertEquals($e->getMessage(), 'Some handler exception'); + $that->assertTrue(is_array($record)); + $that->assertEquals($record['message'], 'test'); + }); + $handler = $this->getMock('Monolog\Handler\HandlerInterface'); + $handler->expects($this->any()) + ->method('isHandling') + ->will($this->returnValue(true)) + ; + $handler->expects($this->any()) + ->method('handle') + ->will($this->throwException(new \Exception('Some handler exception'))) + ; + $logger->pushHandler($handler); + $logger->info('test'); + } + + public function testReset() + { + $logger = new Logger('app'); + + $testHandler = new Handler\TestHandler(); + $bufferHandler = new Handler\BufferHandler($testHandler); + $groupHandler = new Handler\GroupHandler(array($bufferHandler)); + $fingersCrossedHandler = new Handler\FingersCrossedHandler($groupHandler); + + $logger->pushHandler($fingersCrossedHandler); + + $processorUid1 = new Processor\UidProcessor(10); + $uid1 = $processorUid1->getUid(); + $groupHandler->pushProcessor($processorUid1); + + $processorUid2 = new Processor\UidProcessor(5); + $uid2 = $processorUid2->getUid(); + $logger->pushProcessor($processorUid2); + + $getProperty = function ($object, $property) { + $reflectionProperty = new \ReflectionProperty(get_class($object), $property); + $reflectionProperty->setAccessible(true); + + return $reflectionProperty->getValue($object); + }; + $that = $this; + $assertBufferOfBufferHandlerEmpty = function () use ($getProperty, $bufferHandler, $that) { + $that->assertEmpty($getProperty($bufferHandler, 'buffer')); + }; + $assertBuffersEmpty = function() use ($assertBufferOfBufferHandlerEmpty, $getProperty, $fingersCrossedHandler, $that) { + $assertBufferOfBufferHandlerEmpty(); + $that->assertEmpty($getProperty($fingersCrossedHandler, 'buffer')); + }; + + $logger->debug('debug'); + $logger->reset(); + $assertBuffersEmpty(); + $this->assertFalse($testHandler->hasDebugRecords()); + $this->assertFalse($testHandler->hasErrorRecords()); + $this->assertNotSame($uid1, $uid1 = $processorUid1->getUid()); + $this->assertNotSame($uid2, $uid2 = $processorUid2->getUid()); + + $logger->debug('debug'); + $logger->error('error'); + $logger->reset(); + $assertBuffersEmpty(); + $this->assertTrue($testHandler->hasDebugRecords()); + $this->assertTrue($testHandler->hasErrorRecords()); + $this->assertNotSame($uid1, $uid1 = $processorUid1->getUid()); + $this->assertNotSame($uid2, $uid2 = $processorUid2->getUid()); + + $logger->info('info'); + $this->assertNotEmpty($getProperty($fingersCrossedHandler, 'buffer')); + $assertBufferOfBufferHandlerEmpty(); + $this->assertFalse($testHandler->hasInfoRecords()); + + $logger->reset(); + $assertBuffersEmpty(); + $this->assertFalse($testHandler->hasInfoRecords()); + $this->assertNotSame($uid1, $uid1 = $processorUid1->getUid()); + $this->assertNotSame($uid2, $uid2 = $processorUid2->getUid()); + + $logger->notice('notice'); + $logger->emergency('emergency'); + $logger->reset(); + $assertBuffersEmpty(); + $this->assertFalse($testHandler->hasInfoRecords()); + $this->assertTrue($testHandler->hasNoticeRecords()); + $this->assertTrue($testHandler->hasEmergencyRecords()); + $this->assertNotSame($uid1, $processorUid1->getUid()); + $this->assertNotSame($uid2, $processorUid2->getUid()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php new file mode 100644 index 0000000..5adb505 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\TestCase; + +class GitProcessorTest extends TestCase +{ + /** + * @covers Monolog\Processor\GitProcessor::__invoke + */ + public function testProcessor() + { + $processor = new GitProcessor(); + $record = $processor($this->getRecord()); + + $this->assertArrayHasKey('git', $record['extra']); + $this->assertTrue(!is_array($record['extra']['git']['branch'])); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php new file mode 100644 index 0000000..0dd411d --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php @@ -0,0 +1,123 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Acme; + +class Tester +{ + public function test($handler, $record) + { + $handler->handle($record); + } +} + +function tester($handler, $record) +{ + $handler->handle($record); +} + +namespace Monolog\Processor; + +use Monolog\Logger; +use Monolog\TestCase; +use Monolog\Handler\TestHandler; + +class IntrospectionProcessorTest extends TestCase +{ + public function getHandler() + { + $processor = new IntrospectionProcessor(); + $handler = new TestHandler(); + $handler->pushProcessor($processor); + + return $handler; + } + + public function testProcessorFromClass() + { + $handler = $this->getHandler(); + $tester = new \Acme\Tester; + $tester->test($handler, $this->getRecord()); + list($record) = $handler->getRecords(); + $this->assertEquals(__FILE__, $record['extra']['file']); + $this->assertEquals(18, $record['extra']['line']); + $this->assertEquals('Acme\Tester', $record['extra']['class']); + $this->assertEquals('test', $record['extra']['function']); + } + + public function testProcessorFromFunc() + { + $handler = $this->getHandler(); + \Acme\tester($handler, $this->getRecord()); + list($record) = $handler->getRecords(); + $this->assertEquals(__FILE__, $record['extra']['file']); + $this->assertEquals(24, $record['extra']['line']); + $this->assertEquals(null, $record['extra']['class']); + $this->assertEquals('Acme\tester', $record['extra']['function']); + } + + public function testLevelTooLow() + { + $input = array( + 'level' => Logger::DEBUG, + 'extra' => array(), + ); + + $expected = $input; + + $processor = new IntrospectionProcessor(Logger::CRITICAL); + $actual = $processor($input); + + $this->assertEquals($expected, $actual); + } + + public function testLevelEqual() + { + $input = array( + 'level' => Logger::CRITICAL, + 'extra' => array(), + ); + + $expected = $input; + $expected['extra'] = array( + 'file' => null, + 'line' => null, + 'class' => 'ReflectionMethod', + 'function' => 'invokeArgs', + ); + + $processor = new IntrospectionProcessor(Logger::CRITICAL); + $actual = $processor($input); + + $this->assertEquals($expected, $actual); + } + + public function testLevelHigher() + { + $input = array( + 'level' => Logger::EMERGENCY, + 'extra' => array(), + ); + + $expected = $input; + $expected['extra'] = array( + 'file' => null, + 'line' => null, + 'class' => 'ReflectionMethod', + 'function' => 'invokeArgs', + ); + + $processor = new IntrospectionProcessor(Logger::CRITICAL); + $actual = $processor($input); + + $this->assertEquals($expected, $actual); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php new file mode 100644 index 0000000..eb66614 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\TestCase; + +class MemoryPeakUsageProcessorTest extends TestCase +{ + /** + * @covers Monolog\Processor\MemoryPeakUsageProcessor::__invoke + * @covers Monolog\Processor\MemoryProcessor::formatBytes + */ + public function testProcessor() + { + $processor = new MemoryPeakUsageProcessor(); + $record = $processor($this->getRecord()); + $this->assertArrayHasKey('memory_peak_usage', $record['extra']); + $this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_peak_usage']); + } + + /** + * @covers Monolog\Processor\MemoryPeakUsageProcessor::__invoke + * @covers Monolog\Processor\MemoryProcessor::formatBytes + */ + public function testProcessorWithoutFormatting() + { + $processor = new MemoryPeakUsageProcessor(true, false); + $record = $processor($this->getRecord()); + $this->assertArrayHasKey('memory_peak_usage', $record['extra']); + $this->assertInternalType('int', $record['extra']['memory_peak_usage']); + $this->assertGreaterThan(0, $record['extra']['memory_peak_usage']); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php new file mode 100644 index 0000000..4692dbf --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\TestCase; + +class MemoryUsageProcessorTest extends TestCase +{ + /** + * @covers Monolog\Processor\MemoryUsageProcessor::__invoke + * @covers Monolog\Processor\MemoryProcessor::formatBytes + */ + public function testProcessor() + { + $processor = new MemoryUsageProcessor(); + $record = $processor($this->getRecord()); + $this->assertArrayHasKey('memory_usage', $record['extra']); + $this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_usage']); + } + + /** + * @covers Monolog\Processor\MemoryUsageProcessor::__invoke + * @covers Monolog\Processor\MemoryProcessor::formatBytes + */ + public function testProcessorWithoutFormatting() + { + $processor = new MemoryUsageProcessor(true, false); + $record = $processor($this->getRecord()); + $this->assertArrayHasKey('memory_usage', $record['extra']); + $this->assertInternalType('int', $record['extra']['memory_usage']); + $this->assertGreaterThan(0, $record['extra']['memory_usage']); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php new file mode 100644 index 0000000..11f2b35 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\TestCase; + +class MercurialProcessorTest extends TestCase +{ + /** + * @covers Monolog\Processor\MercurialProcessor::__invoke + */ + public function testProcessor() + { + if (defined('PHP_WINDOWS_VERSION_BUILD')) { + exec("where hg 2>NUL", $output, $result); + } else { + exec("which hg 2>/dev/null >/dev/null", $output, $result); + } + if ($result != 0) { + $this->markTestSkipped('hg is missing'); + return; + } + + `hg init`; + $processor = new MercurialProcessor(); + $record = $processor($this->getRecord()); + + $this->assertArrayHasKey('hg', $record['extra']); + $this->assertTrue(!is_array($record['extra']['hg']['branch'])); + $this->assertTrue(!is_array($record['extra']['hg']['revision'])); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php new file mode 100644 index 0000000..458d2a3 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\TestCase; + +class ProcessIdProcessorTest extends TestCase +{ + /** + * @covers Monolog\Processor\ProcessIdProcessor::__invoke + */ + public function testProcessor() + { + $processor = new ProcessIdProcessor(); + $record = $processor($this->getRecord()); + $this->assertArrayHasKey('process_id', $record['extra']); + $this->assertInternalType('int', $record['extra']['process_id']); + $this->assertGreaterThan(0, $record['extra']['process_id']); + $this->assertEquals(getmypid(), $record['extra']['process_id']); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php new file mode 100644 index 0000000..029a0c0 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +class PsrLogMessageProcessorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @dataProvider getPairs + */ + public function testReplacement($val, $expected) + { + $proc = new PsrLogMessageProcessor; + + $message = $proc(array( + 'message' => '{foo}', + 'context' => array('foo' => $val), + )); + $this->assertEquals($expected, $message['message']); + } + + public function getPairs() + { + return array( + array('foo', 'foo'), + array('3', '3'), + array(3, '3'), + array(null, ''), + array(true, '1'), + array(false, ''), + array(new \stdClass, '[object stdClass]'), + array(array(), '[array]'), + ); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php new file mode 100644 index 0000000..0d860c6 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\TestCase; + +class TagProcessorTest extends TestCase +{ + /** + * @covers Monolog\Processor\TagProcessor::__invoke + */ + public function testProcessor() + { + $tags = array(1, 2, 3); + $processor = new TagProcessor($tags); + $record = $processor($this->getRecord()); + + $this->assertEquals($tags, $record['extra']['tags']); + } + + /** + * @covers Monolog\Processor\TagProcessor::__invoke + */ + public function testProcessorTagModification() + { + $tags = array(1, 2, 3); + $processor = new TagProcessor($tags); + + $record = $processor($this->getRecord()); + $this->assertEquals($tags, $record['extra']['tags']); + + $processor->setTags(array('a', 'b')); + $record = $processor($this->getRecord()); + $this->assertEquals(array('a', 'b'), $record['extra']['tags']); + + $processor->addTags(array('a', 'c', 'foo' => 'bar')); + $record = $processor($this->getRecord()); + $this->assertEquals(array('a', 'b', 'a', 'c', 'foo' => 'bar'), $record['extra']['tags']); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php new file mode 100644 index 0000000..5d13058 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\TestCase; + +class UidProcessorTest extends TestCase +{ + /** + * @covers Monolog\Processor\UidProcessor::__invoke + */ + public function testProcessor() + { + $processor = new UidProcessor(); + $record = $processor($this->getRecord()); + $this->assertArrayHasKey('uid', $record['extra']); + } + + public function testGetUid() + { + $processor = new UidProcessor(10); + $this->assertEquals(10, strlen($processor->getUid())); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php new file mode 100644 index 0000000..4105baf --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php @@ -0,0 +1,113 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\TestCase; + +class WebProcessorTest extends TestCase +{ + public function testProcessor() + { + $server = array( + 'REQUEST_URI' => 'A', + 'REMOTE_ADDR' => 'B', + 'REQUEST_METHOD' => 'C', + 'HTTP_REFERER' => 'D', + 'SERVER_NAME' => 'F', + 'UNIQUE_ID' => 'G', + ); + + $processor = new WebProcessor($server); + $record = $processor($this->getRecord()); + $this->assertEquals($server['REQUEST_URI'], $record['extra']['url']); + $this->assertEquals($server['REMOTE_ADDR'], $record['extra']['ip']); + $this->assertEquals($server['REQUEST_METHOD'], $record['extra']['http_method']); + $this->assertEquals($server['HTTP_REFERER'], $record['extra']['referrer']); + $this->assertEquals($server['SERVER_NAME'], $record['extra']['server']); + $this->assertEquals($server['UNIQUE_ID'], $record['extra']['unique_id']); + } + + public function testProcessorDoNothingIfNoRequestUri() + { + $server = array( + 'REMOTE_ADDR' => 'B', + 'REQUEST_METHOD' => 'C', + ); + $processor = new WebProcessor($server); + $record = $processor($this->getRecord()); + $this->assertEmpty($record['extra']); + } + + public function testProcessorReturnNullIfNoHttpReferer() + { + $server = array( + 'REQUEST_URI' => 'A', + 'REMOTE_ADDR' => 'B', + 'REQUEST_METHOD' => 'C', + 'SERVER_NAME' => 'F', + ); + $processor = new WebProcessor($server); + $record = $processor($this->getRecord()); + $this->assertNull($record['extra']['referrer']); + } + + public function testProcessorDoesNotAddUniqueIdIfNotPresent() + { + $server = array( + 'REQUEST_URI' => 'A', + 'REMOTE_ADDR' => 'B', + 'REQUEST_METHOD' => 'C', + 'SERVER_NAME' => 'F', + ); + $processor = new WebProcessor($server); + $record = $processor($this->getRecord()); + $this->assertFalse(isset($record['extra']['unique_id'])); + } + + public function testProcessorAddsOnlyRequestedExtraFields() + { + $server = array( + 'REQUEST_URI' => 'A', + 'REMOTE_ADDR' => 'B', + 'REQUEST_METHOD' => 'C', + 'SERVER_NAME' => 'F', + ); + + $processor = new WebProcessor($server, array('url', 'http_method')); + $record = $processor($this->getRecord()); + + $this->assertSame(array('url' => 'A', 'http_method' => 'C'), $record['extra']); + } + + public function testProcessorConfiguringOfExtraFields() + { + $server = array( + 'REQUEST_URI' => 'A', + 'REMOTE_ADDR' => 'B', + 'REQUEST_METHOD' => 'C', + 'SERVER_NAME' => 'F', + ); + + $processor = new WebProcessor($server, array('url' => 'REMOTE_ADDR')); + $record = $processor($this->getRecord()); + + $this->assertSame(array('url' => 'B'), $record['extra']); + } + + /** + * @expectedException UnexpectedValueException + */ + public function testInvalidData() + { + new WebProcessor(new \stdClass); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/PsrLogCompatTest.php b/vendor/monolog/monolog/tests/Monolog/PsrLogCompatTest.php new file mode 100644 index 0000000..ab89944 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/PsrLogCompatTest.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use Monolog\Handler\TestHandler; +use Monolog\Formatter\LineFormatter; +use Monolog\Processor\PsrLogMessageProcessor; +use Psr\Log\Test\LoggerInterfaceTest; + +class PsrLogCompatTest extends LoggerInterfaceTest +{ + private $handler; + + public function getLogger() + { + $logger = new Logger('foo'); + $logger->pushHandler($handler = new TestHandler); + $logger->pushProcessor(new PsrLogMessageProcessor); + $handler->setFormatter(new LineFormatter('%level_name% %message%')); + + $this->handler = $handler; + + return $logger; + } + + public function getLogs() + { + $convert = function ($record) { + $lower = function ($match) { + return strtolower($match[0]); + }; + + return preg_replace_callback('{^[A-Z]+}', $lower, $record['formatted']); + }; + + return array_map($convert, $this->handler->getRecords()); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/RegistryTest.php b/vendor/monolog/monolog/tests/Monolog/RegistryTest.php new file mode 100644 index 0000000..15fdfbd --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/RegistryTest.php @@ -0,0 +1,153 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +class RegistryTest extends \PHPUnit_Framework_TestCase +{ + protected function setUp() + { + Registry::clear(); + } + + /** + * @dataProvider hasLoggerProvider + * @covers Monolog\Registry::hasLogger + */ + public function testHasLogger(array $loggersToAdd, array $loggersToCheck, array $expectedResult) + { + foreach ($loggersToAdd as $loggerToAdd) { + Registry::addLogger($loggerToAdd); + } + foreach ($loggersToCheck as $index => $loggerToCheck) { + $this->assertSame($expectedResult[$index], Registry::hasLogger($loggerToCheck)); + } + } + + public function hasLoggerProvider() + { + $logger1 = new Logger('test1'); + $logger2 = new Logger('test2'); + $logger3 = new Logger('test3'); + + return array( + // only instances + array( + array($logger1), + array($logger1, $logger2), + array(true, false), + ), + // only names + array( + array($logger1), + array('test1', 'test2'), + array(true, false), + ), + // mixed case + array( + array($logger1, $logger2), + array('test1', $logger2, 'test3', $logger3), + array(true, true, false, false), + ), + ); + } + + /** + * @covers Monolog\Registry::clear + */ + public function testClearClears() + { + Registry::addLogger(new Logger('test1'), 'log'); + Registry::clear(); + + $this->setExpectedException('\InvalidArgumentException'); + Registry::getInstance('log'); + } + + /** + * @dataProvider removedLoggerProvider + * @covers Monolog\Registry::addLogger + * @covers Monolog\Registry::removeLogger + */ + public function testRemovesLogger($loggerToAdd, $remove) + { + Registry::addLogger($loggerToAdd); + Registry::removeLogger($remove); + + $this->setExpectedException('\InvalidArgumentException'); + Registry::getInstance($loggerToAdd->getName()); + } + + public function removedLoggerProvider() + { + $logger1 = new Logger('test1'); + + return array( + array($logger1, $logger1), + array($logger1, 'test1'), + ); + } + + /** + * @covers Monolog\Registry::addLogger + * @covers Monolog\Registry::getInstance + * @covers Monolog\Registry::__callStatic + */ + public function testGetsSameLogger() + { + $logger1 = new Logger('test1'); + $logger2 = new Logger('test2'); + + Registry::addLogger($logger1, 'test1'); + Registry::addLogger($logger2); + + $this->assertSame($logger1, Registry::getInstance('test1')); + $this->assertSame($logger2, Registry::test2()); + } + + /** + * @expectedException \InvalidArgumentException + * @covers Monolog\Registry::getInstance + */ + public function testFailsOnNonExistantLogger() + { + Registry::getInstance('test1'); + } + + /** + * @covers Monolog\Registry::addLogger + */ + public function testReplacesLogger() + { + $log1 = new Logger('test1'); + $log2 = new Logger('test2'); + + Registry::addLogger($log1, 'log'); + + Registry::addLogger($log2, 'log', true); + + $this->assertSame($log2, Registry::getInstance('log')); + } + + /** + * @expectedException \InvalidArgumentException + * @covers Monolog\Registry::addLogger + */ + public function testFailsOnUnspecifiedReplacement() + { + $log1 = new Logger('test1'); + $log2 = new Logger('test2'); + + Registry::addLogger($log1, 'log'); + + Registry::addLogger($log2, 'log'); + } +} diff --git a/vendor/monolog/monolog/tests/Monolog/SignalHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/SignalHandlerTest.php new file mode 100644 index 0000000..9fa0792 --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/SignalHandlerTest.php @@ -0,0 +1,287 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +use Monolog\Handler\StreamHandler; +use Monolog\Handler\TestHandler; +use Psr\Log\LogLevel; + +/** + * @author Robert Gust-Bardon + * @covers Monolog\SignalHandler + */ +class SignalHandlerTest extends TestCase +{ + + private $asyncSignalHandling; + private $blockedSignals; + private $signalHandlers; + + protected function setUp() + { + $this->signalHandlers = array(); + if (extension_loaded('pcntl')) { + if (function_exists('pcntl_async_signals')) { + $this->asyncSignalHandling = pcntl_async_signals(); + } + if (function_exists('pcntl_sigprocmask')) { + pcntl_sigprocmask(SIG_BLOCK, array(), $this->blockedSignals); + } + } + } + + protected function tearDown() + { + if ($this->asyncSignalHandling !== null) { + pcntl_async_signals($this->asyncSignalHandling); + } + if ($this->blockedSignals !== null) { + pcntl_sigprocmask(SIG_SETMASK, $this->blockedSignals); + } + if ($this->signalHandlers) { + pcntl_signal_dispatch(); + foreach ($this->signalHandlers as $signo => $handler) { + pcntl_signal($signo, $handler); + } + } + } + + private function setSignalHandler($signo, $handler = SIG_DFL) { + if (function_exists('pcntl_signal_get_handler')) { + $this->signalHandlers[$signo] = pcntl_signal_get_handler($signo); + } else { + $this->signalHandlers[$signo] = SIG_DFL; + } + $this->assertTrue(pcntl_signal($signo, $handler)); + } + + public function testHandleSignal() + { + $logger = new Logger('test', array($handler = new TestHandler)); + $errHandler = new SignalHandler($logger); + $signo = 2; // SIGINT. + $siginfo = array('signo' => $signo, 'errno' => 0, 'code' => 0); + $errHandler->handleSignal($signo, $siginfo); + $this->assertCount(1, $handler->getRecords()); + $this->assertTrue($handler->hasCriticalRecords()); + $records = $handler->getRecords(); + $this->assertSame($siginfo, $records[0]['context']); + } + + /** + * @depends testHandleSignal + * @requires extension pcntl + * @requires extension posix + * @requires function pcntl_signal + * @requires function pcntl_signal_dispatch + * @requires function posix_getpid + * @requires function posix_kill + */ + public function testRegisterSignalHandler() + { + // SIGCONT and SIGURG should be ignored by default. + if (!defined('SIGCONT') || !defined('SIGURG')) { + $this->markTestSkipped('This test requires the SIGCONT and SIGURG pcntl constants.'); + } + + $this->setSignalHandler(SIGCONT, SIG_IGN); + $this->setSignalHandler(SIGURG, SIG_IGN); + + $logger = new Logger('test', array($handler = new TestHandler)); + $errHandler = new SignalHandler($logger); + $pid = posix_getpid(); + + $this->assertTrue(posix_kill($pid, SIGURG)); + $this->assertTrue(pcntl_signal_dispatch()); + $this->assertCount(0, $handler->getRecords()); + + $errHandler->registerSignalHandler(SIGURG, LogLevel::INFO, false, false, false); + + $this->assertTrue(posix_kill($pid, SIGCONT)); + $this->assertTrue(pcntl_signal_dispatch()); + $this->assertCount(0, $handler->getRecords()); + + $this->assertTrue(posix_kill($pid, SIGURG)); + $this->assertTrue(pcntl_signal_dispatch()); + $this->assertCount(1, $handler->getRecords()); + $this->assertTrue($handler->hasInfoThatContains('SIGURG')); + } + + /** + * @dataProvider defaultPreviousProvider + * @depends testRegisterSignalHandler + * @requires function pcntl_fork + * @requires function pcntl_sigprocmask + * @requires function pcntl_waitpid + */ + public function testRegisterDefaultPreviousSignalHandler($signo, $callPrevious, $expected) + { + $this->setSignalHandler($signo, SIG_DFL); + + $path = tempnam(sys_get_temp_dir(), 'monolog-'); + $this->assertNotFalse($path); + + $pid = pcntl_fork(); + if ($pid === 0) { // Child. + $streamHandler = new StreamHandler($path); + $streamHandler->setFormatter($this->getIdentityFormatter()); + $logger = new Logger('test', array($streamHandler)); + $errHandler = new SignalHandler($logger); + $errHandler->registerSignalHandler($signo, LogLevel::INFO, $callPrevious, false, false); + pcntl_sigprocmask(SIG_SETMASK, array(SIGCONT)); + posix_kill(posix_getpid(), $signo); + pcntl_signal_dispatch(); + // If $callPrevious is true, SIGINT should terminate by this line. + pcntl_sigprocmask(SIG_BLOCK, array(), $oldset); + file_put_contents($path, implode(' ', $oldset), FILE_APPEND); + posix_kill(posix_getpid(), $signo); + pcntl_signal_dispatch(); + exit(); + } + + $this->assertNotSame(-1, $pid); + $this->assertNotSame(-1, pcntl_waitpid($pid, $status)); + $this->assertNotSame(-1, $status); + $this->assertSame($expected, file_get_contents($path)); + } + + public function defaultPreviousProvider() + { + if (!defined('SIGCONT') || !defined('SIGINT') || !defined('SIGURG')) { + return array(); + } + + return array( + array(SIGINT, false, 'Program received signal SIGINT'.SIGCONT.'Program received signal SIGINT'), + array(SIGINT, true, 'Program received signal SIGINT'), + array(SIGURG, false, 'Program received signal SIGURG'.SIGCONT.'Program received signal SIGURG'), + array(SIGURG, true, 'Program received signal SIGURG'.SIGCONT.'Program received signal SIGURG'), + ); + } + + /** + * @dataProvider callablePreviousProvider + * @depends testRegisterSignalHandler + * @requires function pcntl_signal_get_handler + */ + public function testRegisterCallablePreviousSignalHandler($callPrevious) + { + $this->setSignalHandler(SIGURG, SIG_IGN); + + $logger = new Logger('test', array($handler = new TestHandler)); + $errHandler = new SignalHandler($logger); + $previousCalled = 0; + pcntl_signal(SIGURG, function ($signo, array $siginfo = null) use (&$previousCalled) { + ++$previousCalled; + }); + $errHandler->registerSignalHandler(SIGURG, LogLevel::INFO, $callPrevious, false, false); + $this->assertTrue(posix_kill(posix_getpid(), SIGURG)); + $this->assertTrue(pcntl_signal_dispatch()); + $this->assertCount(1, $handler->getRecords()); + $this->assertTrue($handler->hasInfoThatContains('SIGURG')); + $this->assertSame($callPrevious ? 1 : 0, $previousCalled); + } + + public function callablePreviousProvider() + { + return array( + array(false), + array(true), + ); + } + + /** + * @dataProvider restartSyscallsProvider + * @depends testRegisterDefaultPreviousSignalHandler + * @requires function pcntl_fork + * @requires function pcntl_waitpid + */ + public function testRegisterSyscallRestartingSignalHandler($restartSyscalls) + { + $this->setSignalHandler(SIGURG, SIG_IGN); + + $parentPid = posix_getpid(); + $microtime = microtime(true); + + $pid = pcntl_fork(); + if ($pid === 0) { // Child. + usleep(100000); + posix_kill($parentPid, SIGURG); + usleep(100000); + exit(); + } + + $this->assertNotSame(-1, $pid); + $logger = new Logger('test', array($handler = new TestHandler)); + $errHandler = new SignalHandler($logger); + $errHandler->registerSignalHandler(SIGURG, LogLevel::INFO, false, $restartSyscalls, false); + if ($restartSyscalls) { + // pcntl_wait is expected to be restarted after the signal handler. + $this->assertNotSame(-1, pcntl_waitpid($pid, $status)); + } else { + // pcntl_wait is expected to be interrupted when the signal handler is invoked. + $this->assertSame(-1, pcntl_waitpid($pid, $status)); + } + $this->assertSame($restartSyscalls, microtime(true) - $microtime > 0.15); + $this->assertTrue(pcntl_signal_dispatch()); + $this->assertCount(1, $handler->getRecords()); + if ($restartSyscalls) { + // The child has already exited. + $this->assertSame(-1, pcntl_waitpid($pid, $status)); + } else { + // The child has not exited yet. + $this->assertNotSame(-1, pcntl_waitpid($pid, $status)); + } + } + + public function restartSyscallsProvider() + { + return array( + array(false), + array(true), + array(false), + array(true), + ); + } + + /** + * @dataProvider asyncProvider + * @depends testRegisterDefaultPreviousSignalHandler + * @requires function pcntl_async_signals + */ + public function testRegisterAsyncSignalHandler($initialAsync, $desiredAsync, $expectedBefore, $expectedAfter) + { + $this->setSignalHandler(SIGURG, SIG_IGN); + pcntl_async_signals($initialAsync); + + $logger = new Logger('test', array($handler = new TestHandler)); + $errHandler = new SignalHandler($logger); + $errHandler->registerSignalHandler(SIGURG, LogLevel::INFO, false, false, $desiredAsync); + $this->assertTrue(posix_kill(posix_getpid(), SIGURG)); + $this->assertCount($expectedBefore, $handler->getRecords()); + $this->assertTrue(pcntl_signal_dispatch()); + $this->assertCount($expectedAfter, $handler->getRecords()); + } + + public function asyncProvider() + { + return array( + array(false, false, 0, 1), + array(false, null, 0, 1), + array(false, true, 1, 1), + array(true, false, 0, 1), + array(true, null, 1, 1), + array(true, true, 1, 1), + ); + } + +} diff --git a/vendor/monolog/monolog/tests/Monolog/TestCase.php b/vendor/monolog/monolog/tests/Monolog/TestCase.php new file mode 100644 index 0000000..4eb7b4c --- /dev/null +++ b/vendor/monolog/monolog/tests/Monolog/TestCase.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog; + +class TestCase extends \PHPUnit_Framework_TestCase +{ + /** + * @return array Record + */ + protected function getRecord($level = Logger::WARNING, $message = 'test', $context = array()) + { + return array( + 'message' => $message, + 'context' => $context, + 'level' => $level, + 'level_name' => Logger::getLevelName($level), + 'channel' => 'test', + 'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true))), + 'extra' => array(), + ); + } + + /** + * @return array + */ + protected function getMultipleRecords() + { + return array( + $this->getRecord(Logger::DEBUG, 'debug message 1'), + $this->getRecord(Logger::DEBUG, 'debug message 2'), + $this->getRecord(Logger::INFO, 'information'), + $this->getRecord(Logger::WARNING, 'warning'), + $this->getRecord(Logger::ERROR, 'error'), + ); + } + + /** + * @return Monolog\Formatter\FormatterInterface + */ + protected function getIdentityFormatter() + { + $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); + $formatter->expects($this->any()) + ->method('format') + ->will($this->returnCallback(function ($record) { return $record['message']; })); + + return $formatter; + } +} diff --git a/vendor/myclabs/deep-copy/.gitattributes b/vendor/myclabs/deep-copy/.gitattributes new file mode 100755 index 0000000..8018068 --- /dev/null +++ b/vendor/myclabs/deep-copy/.gitattributes @@ -0,0 +1,7 @@ +# Auto detect text files and perform LF normalization +* text=auto + +*.png binary + +tests/ export-ignore +phpunit.xml.dist export-ignore diff --git a/vendor/myclabs/deep-copy/.gitignore b/vendor/myclabs/deep-copy/.gitignore new file mode 100755 index 0000000..eef72f7 --- /dev/null +++ b/vendor/myclabs/deep-copy/.gitignore @@ -0,0 +1,3 @@ +/composer.phar +/composer.lock +/vendor/* diff --git a/vendor/myclabs/deep-copy/.scrutinizer.yml b/vendor/myclabs/deep-copy/.scrutinizer.yml new file mode 100644 index 0000000..6934299 --- /dev/null +++ b/vendor/myclabs/deep-copy/.scrutinizer.yml @@ -0,0 +1,4 @@ +build: + environment: + variables: + COMPOSER_ROOT_VERSION: '1.8.0' diff --git a/vendor/myclabs/deep-copy/.travis.yml b/vendor/myclabs/deep-copy/.travis.yml new file mode 100755 index 0000000..88f9d2e --- /dev/null +++ b/vendor/myclabs/deep-copy/.travis.yml @@ -0,0 +1,40 @@ +language: php + +sudo: false + +env: + global: + - COMPOSER_ROOT_VERSION=1.8.0 + +php: + - '7.1' + - '7.2' + - nightly + +matrix: + fast_finish: true + include: + - php: '7.1' + env: COMPOSER_FLAGS="--prefer-lowest" + allow_failures: + - php: nightly + +cache: + directories: + - $HOME/.composer/cache/files + +install: + - composer update --no-interaction --no-progress --no-suggest --prefer-dist $COMPOSER_FLAGS + - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.0/coveralls.phar + +before_script: + - mkdir -p build/logs + +script: + - vendor/bin/phpunit --coverage-clover build/logs/clover.xml + +after_script: + - php coveralls.phar -v + +notifications: + email: false diff --git a/vendor/myclabs/deep-copy/LICENSE b/vendor/myclabs/deep-copy/LICENSE new file mode 100644 index 0000000..c3e8350 --- /dev/null +++ b/vendor/myclabs/deep-copy/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 My C-Sense + +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/myclabs/deep-copy/README.md b/vendor/myclabs/deep-copy/README.md new file mode 100644 index 0000000..7abe5dc --- /dev/null +++ b/vendor/myclabs/deep-copy/README.md @@ -0,0 +1,376 @@ +# DeepCopy + +DeepCopy helps you create deep copies (clones) of your objects. It is designed to handle cycles in the association graph. + +[![Build Status](https://travis-ci.org/myclabs/DeepCopy.png?branch=1.x)](https://travis-ci.org/myclabs/DeepCopy) +[![Coverage Status](https://coveralls.io/repos/myclabs/DeepCopy/badge.png?branch=1.x)](https://coveralls.io/r/myclabs/DeepCopy?branch=1.x) +[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/myclabs/DeepCopy/badges/quality-score.png?s=2747100c19b275f93a777e3297c6c12d1b68b934)](https://scrutinizer-ci.com/g/myclabs/DeepCopy/) +[![Total Downloads](https://poser.pugx.org/myclabs/deep-copy/downloads.svg)](https://packagist.org/packages/myclabs/deep-copy) + + +**You are browsing the 1.x version, this version is in maintenance mode only. Please check the new +[2.x](https://github.com/myclabs/DeepCopy/tree/2.x) version.** + + +## Table of Contents + +1. [How](#how) +1. [Why](#why) + 1. [Using simply `clone`](#using-simply-clone) + 1. [Overridding `__clone()`](#overridding-__clone) + 1. [With `DeepCopy`](#with-deepcopy) +1. [How it works](#how-it-works) +1. [Going further](#going-further) + 1. [Matchers](#matchers) + 1. [Property name](#property-name) + 1. [Specific property](#specific-property) + 1. [Type](#type) + 1. [Filters](#filters) + 1. [`SetNullFilter`](#setnullfilter-filter) + 1. [`KeepFilter`](#keepfilter-filter) + 1. [`DoctrineCollectionFilter`](#doctrinecollectionfilter-filter) + 1. [`DoctrineEmptyCollectionFilter`](#doctrineemptycollectionfilter-filter) + 1. [`DoctrineProxyFilter`](#doctrineproxyfilter-filter) + 1. [`ReplaceFilter`](#replacefilter-type-filter) + 1. [`ShallowCopyFilter`](#shallowcopyfilter-type-filter) +1. [Edge cases](#edge-cases) +1. [Contributing](#contributing) + 1. [Tests](#tests) + + +## How? + +Install with Composer: + +```json +composer require myclabs/deep-copy +``` + +Use simply: + +```php +use DeepCopy\DeepCopy; + +$copier = new DeepCopy(); +$myCopy = $copier->copy($myObject); +``` + + +## Why? + +- How do you create copies of your objects? + +```php +$myCopy = clone $myObject; +``` + +- How do you create **deep** copies of your objects (i.e. copying also all the objects referenced in the properties)? + +You use [`__clone()`](http://www.php.net/manual/en/language.oop5.cloning.php#object.clone) and implement the behavior +yourself. + +- But how do you handle **cycles** in the association graph? + +Now you're in for a big mess :( + +![association graph](doc/graph.png) + + +### Using simply `clone` + +![Using clone](doc/clone.png) + + +### Overridding `__clone()` + +![Overridding __clone](doc/deep-clone.png) + + +### With `DeepCopy` + +![With DeepCopy](doc/deep-copy.png) + + +## How it works + +DeepCopy recursively traverses all the object's properties and clones them. To avoid cloning the same object twice it +keeps a hash map of all instances and thus preserves the object graph. + +To use it: + +```php +use function DeepCopy\deep_copy; + +$copy = deep_copy($var); +``` + +Alternatively, you can create your own `DeepCopy` instance to configure it differently for example: + +```php +use DeepCopy\DeepCopy; + +$copier = new DeepCopy(true); + +$copy = $copier->copy($var); +``` + +You may want to roll your own deep copy function: + +```php +namespace Acme; + +use DeepCopy\DeepCopy; + +function deep_copy($var) +{ + static $copier = null; + + if (null === $copier) { + $copier = new DeepCopy(true); + } + + return $copier->copy($var); +} +``` + + +## Going further + +You can add filters to customize the copy process. + +The method to add a filter is `DeepCopy\DeepCopy::addFilter($filter, $matcher)`, +with `$filter` implementing `DeepCopy\Filter\Filter` +and `$matcher` implementing `DeepCopy\Matcher\Matcher`. + +We provide some generic filters and matchers. + + +### Matchers + + - `DeepCopy\Matcher` applies on a object attribute. + - `DeepCopy\TypeMatcher` applies on any element found in graph, including array elements. + + +#### Property name + +The `PropertyNameMatcher` will match a property by its name: + +```php +use DeepCopy\Matcher\PropertyNameMatcher; + +// Will apply a filter to any property of any objects named "id" +$matcher = new PropertyNameMatcher('id'); +``` + + +#### Specific property + +The `PropertyMatcher` will match a specific property of a specific class: + +```php +use DeepCopy\Matcher\PropertyMatcher; + +// Will apply a filter to the property "id" of any objects of the class "MyClass" +$matcher = new PropertyMatcher('MyClass', 'id'); +``` + + +#### Type + +The `TypeMatcher` will match any element by its type (instance of a class or any value that could be parameter of +[gettype()](http://php.net/manual/en/function.gettype.php) function): + +```php +use DeepCopy\TypeMatcher\TypeMatcher; + +// Will apply a filter to any object that is an instance of Doctrine\Common\Collections\Collection +$matcher = new TypeMatcher('Doctrine\Common\Collections\Collection'); +``` + + +### Filters + +- `DeepCopy\Filter` applies a transformation to the object attribute matched by `DeepCopy\Matcher` +- `DeepCopy\TypeFilter` applies a transformation to any element matched by `DeepCopy\TypeMatcher` + + +#### `SetNullFilter` (filter) + +Let's say for example that you are copying a database record (or a Doctrine entity), so you want the copy not to have +any ID: + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\SetNullFilter; +use DeepCopy\Matcher\PropertyNameMatcher; + +$object = MyClass::load(123); +echo $object->id; // 123 + +$copier = new DeepCopy(); +$copier->addFilter(new SetNullFilter(), new PropertyNameMatcher('id')); + +$copy = $copier->copy($object); + +echo $copy->id; // null +``` + + +#### `KeepFilter` (filter) + +If you want a property to remain untouched (for example, an association to an object): + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\KeepFilter; +use DeepCopy\Matcher\PropertyMatcher; + +$copier = new DeepCopy(); +$copier->addFilter(new KeepFilter(), new PropertyMatcher('MyClass', 'category')); + +$copy = $copier->copy($object); +// $copy->category has not been touched +``` + + +#### `DoctrineCollectionFilter` (filter) + +If you use Doctrine and want to copy an entity, you will need to use the `DoctrineCollectionFilter`: + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\Doctrine\DoctrineCollectionFilter; +use DeepCopy\Matcher\PropertyTypeMatcher; + +$copier = new DeepCopy(); +$copier->addFilter(new DoctrineCollectionFilter(), new PropertyTypeMatcher('Doctrine\Common\Collections\Collection')); + +$copy = $copier->copy($object); +``` + + +#### `DoctrineEmptyCollectionFilter` (filter) + +If you use Doctrine and want to copy an entity who contains a `Collection` that you want to be reset, you can use the +`DoctrineEmptyCollectionFilter` + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\Doctrine\DoctrineEmptyCollectionFilter; +use DeepCopy\Matcher\PropertyMatcher; + +$copier = new DeepCopy(); +$copier->addFilter(new DoctrineEmptyCollectionFilter(), new PropertyMatcher('MyClass', 'myProperty')); + +$copy = $copier->copy($object); + +// $copy->myProperty will return an empty collection +``` + + +#### `DoctrineProxyFilter` (filter) + +If you use Doctrine and use cloning on lazy loaded entities, you might encounter errors mentioning missing fields on a +Doctrine proxy class (...\\\_\_CG\_\_\Proxy). +You can use the `DoctrineProxyFilter` to load the actual entity behind the Doctrine proxy class. +**Make sure, though, to put this as one of your very first filters in the filter chain so that the entity is loaded +before other filters are applied!** + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\Doctrine\DoctrineProxyFilter; +use DeepCopy\Matcher\Doctrine\DoctrineProxyMatcher; + +$copier = new DeepCopy(); +$copier->addFilter(new DoctrineProxyFilter(), new DoctrineProxyMatcher()); + +$copy = $copier->copy($object); + +// $copy should now contain a clone of all entities, including those that were not yet fully loaded. +``` + + +#### `ReplaceFilter` (type filter) + +1. If you want to replace the value of a property: + +```php +use DeepCopy\DeepCopy; +use DeepCopy\Filter\ReplaceFilter; +use DeepCopy\Matcher\PropertyMatcher; + +$copier = new DeepCopy(); +$callback = function ($currentValue) { + return $currentValue . ' (copy)' +}; +$copier->addFilter(new ReplaceFilter($callback), new PropertyMatcher('MyClass', 'title')); + +$copy = $copier->copy($object); + +// $copy->title will contain the data returned by the callback, e.g. 'The title (copy)' +``` + +2. If you want to replace whole element: + +```php +use DeepCopy\DeepCopy; +use DeepCopy\TypeFilter\ReplaceFilter; +use DeepCopy\TypeMatcher\TypeMatcher; + +$copier = new DeepCopy(); +$callback = function (MyClass $myClass) { + return get_class($myClass); +}; +$copier->addTypeFilter(new ReplaceFilter($callback), new TypeMatcher('MyClass')); + +$copy = $copier->copy([new MyClass, 'some string', new MyClass]); + +// $copy will contain ['MyClass', 'some string', 'MyClass'] +``` + + +The `$callback` parameter of the `ReplaceFilter` constructor accepts any PHP callable. + + +#### `ShallowCopyFilter` (type filter) + +Stop *DeepCopy* from recursively copying element, using standard `clone` instead: + +```php +use DeepCopy\DeepCopy; +use DeepCopy\TypeFilter\ShallowCopyFilter; +use DeepCopy\TypeMatcher\TypeMatcher; +use Mockery as m; + +$this->deepCopy = new DeepCopy(); +$this->deepCopy->addTypeFilter( + new ShallowCopyFilter, + new TypeMatcher(m\MockInterface::class) +); + +$myServiceWithMocks = new MyService(m::mock(MyDependency1::class), m::mock(MyDependency2::class)); +// All mocks will be just cloned, not deep copied +``` + + +## Edge cases + +The following structures cannot be deep-copied with PHP Reflection. As a result they are shallow cloned and filters are +not applied. There is two ways for you to handle them: + +- Implement your own `__clone()` method +- Use a filter with a type matcher + + +## Contributing + +DeepCopy is distributed under the MIT license. + + +### Tests + +Running the tests is simple: + +```php +vendor/bin/phpunit +``` diff --git a/vendor/myclabs/deep-copy/composer.json b/vendor/myclabs/deep-copy/composer.json new file mode 100644 index 0000000..4108a23 --- /dev/null +++ b/vendor/myclabs/deep-copy/composer.json @@ -0,0 +1,38 @@ +{ + "name": "myclabs/deep-copy", + "type": "library", + "description": "Create deep copies (clones) of your objects", + "keywords": ["clone", "copy", "duplicate", "object", "object graph"], + "license": "MIT", + + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "autoload-dev": { + "psr-4": { + "DeepCopy\\": "fixtures/", + "DeepCopyTest\\": "tests/DeepCopyTest/" + } + }, + + "require": { + "php": "^7.1" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + + "config": { + "sort-packages": true + } +} diff --git a/vendor/myclabs/deep-copy/doc/clone.png b/vendor/myclabs/deep-copy/doc/clone.png new file mode 100644 index 0000000000000000000000000000000000000000..376afd491257d44a8c3772b0b7b0bd7b6c747086 GIT binary patch literal 12380 zcmdsddpy)z_y3H+sH*yKN#S8~ckxM4S7|e)t&gnvlA(!El zawkGAW5_8nLd1-_j>}+%k;{y`-yS;8d7kI{{XOUTe*gRZ{zxy|XYalCTI>B@Ywxvw zHa9)D>APLuK_HM#7ta4+0fE4X5D4_z25~SlvHAB^@E;Usaqbi(w^4o+{341qG%OZc3(!$BZYHNt<;TJLmM2t?!Sg&z#90?^|W+?cY>oXut0Db^h_j9z$A`*Tvs{+ZgKAZ)Bjk7k#vBZ^VbaA9o+cZo76# z^Sk}cFKI-W2~JO8C2XM*)8T^j7{7EmE3^HnOT(*VWkO+A*44{4ZT6fbo_8bis-r)U zsmdoD1%Z&E65uEhm<%8M6yL{%LLidoSuhA>XH-5M0@2*#EDeD;8N5Y+3FQ9=C)7qI zFLSY3QX3(|=3Vd%{=21cRD_j>W@a$7O5S~OPg`XiHNQ5>$a22UEacad2TTxTWISv^ z1!ti17I9j|WT;ku<<(fqQ37PxRca)w0Xn{cD0v~8msLM-bF?Mxa`0rBLeR`75%Rbe zeCF~n882M^X?7+_O2}YPou= z^G%r6H+@UP+BPMQM%Skx4H>mar-Vg8C-Y>k%z`_{rSaPoM8eXGS$+w9`RUo$xT<14PholFT;BZ2mzOzJSgC90ST5(&GJ>WP`W&o+mpK^yfI4He zFDtGPHg}IccklAEN=|NhCbe*V1@E;LB6X)eR2L@CX1B3l^v=A{b}a1K?caUVHDO6V z4^0dFh{wesQ+7K??wxHP)Xr%Np1@@>w9u2ccgS}K3wpB7E>BVD6$?n?HCLZK4!_~C zx>8(1^PDBvO$)qN`QB~g77Ftp&RKW8a8LEg{ZkuXA9x?id|{$%LMX$Xx1_U^iJ4R; zaZMj3NGG{PL0<5y)=G3rF5OpE>|O`5C8T0N&e6f}~0H?wQJY#nYHFZa{0o5)SgjC9Rhb7DO6 z-EmNejM<|?+4VLN6U0lVgBsPpAeFcclBmc+g5d)dG#@>ZR2>ybp(I5jP84G>M_^4`<-V=4}Q?)o3?;5 zdg%f!{Ww_X7XD6)>nf%DLnMx&rua*2{nbhD33d0`yZ|2yVRKsj zHE(qxuT3d2Lr}p+wT%xS_@<9Epbxt@%fIiS2ejSqn|rT~E;Pv<&^RZ4MVmYQWWRJ( zVqhH1exi@L+EK6C?TjzgUVT5w1u|3i5J(YMMBJfu90tcU#&#U zm@bf-{^TRYNZpp;?Ea=xV$H+BAAco1?7X{f{f`TK+h8mTFbs@-#|^-FHo*$+b1-cI^#|Twn-vq@?^sP?ouTJ-8m<5lG;TUNtMV?o_d3%x9RD#v`fo?la z`xWn;kn!F%zEWe8kpdnEyO~HEt6gVc;2*ObT6>RwU+{BeA8B>DZM>b6;~mTyo6e=L zEQFDknWP*qrsbMz4#{gWSAxre$A%NU_1^dn8Toa!1Ct7Is|LV+jP~1rn+DO&FTp;T zUr0symcEzkos1a6qt-=kgyOh;%&=a&6@9fo-BUqz{FUBxe3Sh35nd2mC#$PXg>tvs zm!X!`^zl&zgQ8(mGM=_(On0d`msRw}Ku*_;^*7JVtn;>SJ)2~#J5kQ79K+YP1wPYf zG(JDGCT^R2K4*Dxv2S%nQ2}$R+4!5sWbLP4$WbWOF?)vA_hk_anL<9ghjd~t3Y5?t zmj57`%6QI-&`ZuMu2JI{Ub(F;%O>*Zl02$H&`Zqf;+wA-{4kswxLO%v&C8BSs0>;f zP@oU5BF}x>?jC?^4}qPO^`7`Bsb89MBsV9 zwKM-2-=EhBE(^8r=Lm@SF{(CJ@PFC(X%OZwN76DJDue9)qb%!sNUwUM;*zR_Sx8WOml#9fdYZ9}mM{HY0YnN_oBc5)sD9qp$Q!m<62j zOK6`3`M~ld@y7CUJZxAQIHG-6hhJJK+P}vSZbqoL%v9i|PSJ*l4N@8WuZ|SJK_FpF z@w7T+$xky2Y>Ada2;S80p0H%9c74|KpD^0+Q7|7@tNS8>*Cem0?;J_{+R3csKiyxL zv#{K^x_o)-@*;h8aqKwiGY7M}&?X=-)Jm*M;tL^8>ewXM$|!YZw4dMQt>2B&8<1@} zF?RZ@A{UjZmk9G7&PLjq;uRPr@=JkfmeK4&1E&@a$WlESX7n z{RDFDaS396D)$E?#l|f)pIou=R5eQZn;%5UrTaeb%XaH4t2mOp*^9-t7y24Q`gI%}mHbzD0W)?($lqzB$+XOje`L!TW8xZe z{-+#AyuC>BvRe5*ZuP;IaK@!KOFF)mjZN10^YeDl{)z&#gWBd7@{yiNj>X2C9Tqxr z21L*zH%bSss$A58%70B9H;V4PJFJVkH!76`xslmzF!b6F-;oz9m+neEay$II#g?TNxa#>G%DwMBgIh z6?I;PZUk#G^}vjC;!ViGMU{-< zOEAT|KbvTP@-N$AOX@aR)t@Z?w5n?mQaPn#w~BJ5#zjg59J-Sa-zsrLse2IfWtc=# zc7uH2iIUxn3@+F*LK_P5vV_*-AN>4;Y_muk44!9=?4=x*AZoty_V4X}QkVo`Ja&5Q zL@B(PkX>jTCp#{#^0KaS{0-SAL|Fu3tjw)`mTjhE*Y5fx$q7$}%=T*rc^WD1$omEBdD~gP1{lhlX zFG~eAYC0Vio5=cBm7eoG@;fGd`;UKNRmzV6;UDT4dD-9#h6JO&vQB+Z{P4)1Y;$*J zwB1Tda`G(`tys!+r?*yUC~S@Ta_cREsPrY5d#K=5bfYOa;=XWOmtr}))0gm#^UPi6okm+~Uuc_mxF$K?PFnFl-l46m%LJgny)EiH zmtTDnw{`L>drWW_eS!xY!D>&`(+P+xYqU#Hyv$rBpo1}j)h7W8?#(Ao+w6i zykdoN9~Qo>l6fMRexslFNKL}z!^Fsl$j$CoQiksDWTzq^&x6Zqyp zjNl5kM28?>5UGYD*(>!UN8rMjk%Kz11p`f6&JI(cDcN`G=noTNJ1(_%C|PCaEk3or z?P!NpW{tnU0L{zBZJSJyev7E7Gffwzac8b8hglO2X>Eht_%*wbQC;TSoNnFfhkyId zD~-w)I1qKGDuXV*iC6)9yz6+r;tElP89wBTTvXb#kCmnm)YG`hYFM$qdP;&QsdO%& zaBF?XzH@}dM~1nQ8wheNGbBWt7HWi?rlScYJ1kpVWxBrd2wh-bWy~^_76erJf`t`z zUKX78{am7tbjKhR4CUWb3^Zw>_18Jvf+V^0*N>7D5st+BqPn)n!R`74?zN=suBn|v z>9kO(_ZI8u5xqC#4iD+98@RkNV6=%KDWg?Q@E6 z@!u*AFiBw&N<)89Rqxc9@a~Txv%UMP1Hw_;)tpngueE%d>4~3IBkdYzpur3ed|9K{ zE}0jXy;2^J%W&lzMr(kfA}M6}z*fHPA?(kws#vl5sz=qEM@}z{2#sX0W+diI-3TPd zUOjcDOM-wKg8pr=!aTax3#_3>f(G#PIFNuBCkeG!C@ zymRE4`iEKE58SF)Rm$d}!`oQSf~j4`dp>Y-9sYJHYxJZ}9wS8Q79|Bul$<_XEx(y> zD~}C-Z_y4>nk?P6qge5D$il#NKv^7aw}G3iQB~F*Kd5y27QXEhc{g>PV#&jYFd}GK zhpD_OI5wIoj6{G5aj=-74_4Gx&&wa(3i-a4v`JFx$>x>4> z$as<*2YXsns~t&f?EH>XwI67&x`X=FjjUF4QQWFZL8VW*R;)sP!`4aiv<%-ioI6r) z+O%ctrd!-Wm}zfB@MCBFrbUzXju^Rg0GJ!K%bO~e{Cj!c{m>ms+)p$~JvaEsPqTAc z{ZE{02R^3zHoHgr;fKUk+B+Vcu7VBk<9<4Z4dh!QvmSk^^G+Lt|jk#`;7&EJkw4Eot{aJ??v2#`YQGDjZV1`EmX^|7_-u zDm50e$=z?rrOyR}^LRjXQ!8sY;@1G8YZ8M>kNli}&c-+1QZ~h5;?x&Hb*_oGFh~Hl z>d+X~A#{5*JFA_`^0l}-(Srr`z*cTi)Lw&k9r4T7BE1XKXVzD?ipchry}WYl*3GAq zXt$jVyPbT?Kp|V*tXAh~0F~itPwGr{Bh~wd3=A4Ybjmm0KgD{M;cIsp|K>I#!RUi( zP5iTo#l1EDAmWGo-1B-(Bo~!MimtM+lhZQNQY4wZQS*D}$g5hf-OeSXV3iqmgq8cM zky!C*-S;nh43xU|i3UpLPdq16*bm8YF3dS{e*sKgr>9~Q`_gTLhYdPMDlUSwX1}(1 zd~RXbQ(daeiU(W*Fk3@fMU~zbeq7J3kC(-@PvnVK_+G%=771ny#4t%{0imLuX&h6( zIQ>DQ_31b3}EUj*;(y#3r7b&S*|@mKpxN)IVp*RLg-axC#8bz~oel zbAqSLBm~^|UTy8jpd1mCML2uOsxbD%mk2J{VJTncU(2O~tfRVks5A}+FJe3MH_gW} z$WS~WBIWw{Fv)0%kmggTF3KJ{x9JEWScx@+{b)d|9L})nrAAVm*nV}nAm7soJJb(t z0Fj*ID`6|E?)dn$M=N_^18f*@+z^+L12Q2|!?0uJv1lsW4WwG7PYXH8cOlb2_RP`v zZT@D@;K;Dc;>}Ct&yUyx(|(Q^v6zpOOV=#XWlmLO?Y?yY+9c~rE)GW(U!^k7e=145 zbbz9Lb;I~2adw5*@ilw>n6w+G1H64UhMh)+H}7zc%=rK@j~L}nrfL%&##SG#aW|Hr z0>)(+plG4L?0vd@%E1JKAtlF>*(y@x5DB7#t$4GRsH@K%bkT{$L}u-uV0zW~uw7J_ ze0T%V;k zQr`#jj0ly4i$i0-hj|iu(Swrq$bFaT~%1ih|o+&-U)dSE4H>pV%JP#g4ed{ z$BFFww}6eHbL%!TGy|&|-USJyM>SM}{AvR+(fFY_1-jR}rp0wcjgsXynPfDl3T_W& zp+>#>j@Xh5*TPFg;DJ+kL>A zT<(#okS%I$Gu52g{dTAXnL}B60#Y5D}Gn& zhZC)a-o6*?)$_VRBALtpamHDR3Wql)$$=KS)2q zv-lvC_l6!y5zNa4KyKX2KX(~fpJ>Qzt|mNjqOe;);4m!@HQG3I!vzhO3h>#YEHsv= zE(CAL8rUUU!Pxx!eer}3)B9@N8zb5xIxOaGi|gDxj03!oH6PCmB15`6TjfRTI90gs z$c{4n6L0O6OrxR4n;w85Gyc1{3XaiqMIHIE38s7ynukArr3&Wc^%kKjYf*3h*jdci z&TidM;vL`(LAz5kftsLDVk7$-A~beAsP)X3i!gGz(FHA((($s(xw&}WZtY+ zv2G=yXYit6!6QvnH&ub0EI}kT#{cpaT!>_UFe?wOzm>E*;R56U_SDv;oeU8FBTLBe zs>d6M#2aPe2fYh*WiK*LmbZGPXgOlp_dmaLWoghk@|w;arVDZb1dQG=NSN|}c-xz7 zWN@J7q6maxe!J%acqE7s-bErl_k7?LFI8?8x7`kvCI|1~j_<`P#qN!?6mQf$TNL`* z3S5+Z@$Exy)Aa+E2)H(T1cO#U+FB4%Ll7hM>Bc~qri`<9lWWw$Fw>P|teL&1uZe#I zHd10Kx!PixcXbhj8`;EhOGI=Uvm@ee3GIu;)W}jBvE}za1Y0k)vufgROWR1G$ zWfi!&%mH1~@u69ZjR6Fcn8JR9GK3$RUve%nG!7#!OfZHH$AbjJKGm&mzyZ-Esy|F& zngn()R7cB9I$YgYr655+sj(ws`~bkw#biK@AmQelAr_~CCgtCpfJ#Fe%~*1Aem}5}fQ)k;I8%hp z$b5@r#oHe`V(6hZ;1c3CALo|?@j2=2?KIT#R#eY$FhGfw1VCv8h|~$&Jh+cQi(z6` zW*2lEB?5*7$JK-jpJT~AIkM4j-qH111MlT=tJwP5f(LTxK4|bswvW^{pPZ?{Y}$6* zB*?wU_qOoGpFlGtFCsS<`jq26vbZw7p){F3XnYk(X0q{IRFllf6Rk?rY z80X>v$c?-C+Hs>jkgaI`ncI#bd|_6X(jfE|BfQ#|G~LxHzTQdo{ut&nG8|IAm%GUo z)A+sX0bSsP;E93~_Q@zYYzSGZfsLGgYOG+dKlymIaZxaz34_Gl%h&!%G({$`V8v~p z>_c3v7VP&6YYC=r?4If!fsfhV$uA{zp6TfWHyIIrEOT3CE;a~h711AF6kZ&C+fgs} z%cqk%vES!0rV<MeK<(&0fs|4HELnXeHTGQORF8b0Pwo>(TTn`Z|Z zNysnRjC4=ltNJBl$sef`#W-=LUhueDqwk!j<{@EJk}PQy$>;e-J*zlg&q+;0ddx1I zIM_c_bss2{@jX}V2U*FjvG%!(bt#nmSf27KZ&dR{PC=u3O{!eFfun>!0mUx5+}_tn zAYgC1t&ob2OwO-N1^Oe8K@LTOz1=nw1?7FTlViywe`L7ZTp~#JMH^=87msW!3;iz9 z1g+Z2#G(5LI(Y(!J7QpKv(>Uq`j*ABvOSlEME6#o|46`4sR z@*$;uXjRB&{&uJ3^GgY!#9w3h6&o^)wdOH~Ftv4i?Akk$wsEIkNs`+;s=bD0FQfe> z&;-w6KU6R(`PM=9O~bsz(LAw=AleeCq8RE#+CWTFJ-1|>zxbeU?tvn#+Xa-TYN~S` zOiRI|W7+s?tvMx4dn|mK!8uy(fr^SL3`}#!wlc%eDsbFXU~-68rl>A<2~knaV8-l_z&GEm*pAyDyvz;G(4UXiC){GJ zUcTLXB>C(8Fdbe+;jT#;5#Z%}!fB0dBHbFxEgCuPV{Ptb!q*Zf*{MKBeK{(V^c7B; zgx}>68(a`L*90pO^r>e|9f+n9*Du@QEx`g%xL1mZ%LlhMC05#0S@Md124+46gPd#C zUv3R6pD1H^C_vJ8X>n1D9ZiT|y(+%G4-?k#Xjea|#wac^F{I_{P1@Z)lL_?sgtoj- zmemgKP4u+3R_e-34O1|nusS!!S$#8Bx&s0MSM=@XNFoI~VMCg=k=EeU2huvDD1n`= z$=1ueP}>^P_)AxOV-QjG)k!nAl~JP?;E}}c0VxhUWP)vt+SAouc~)8s(%>5;4%2;|ynmZgqH7y{P{ znvOs}R_D%>+~t0_KB(3iMwX8L-xpr*=lP#4EUb@M{^i0Ug7W{V#KCNxzDs|#@OtCU zzm?d-N?6X7$^}k!q-`s8?zb>A(n4!n9up_DmP}yPh1sXfiWi+Q3s96I*(@g}8w(8; zAw}$4XfG+t0c}^$+6=v-RZ{c#e#ApStyfM-+vYWqR;J$1qt!IOT;TA=YMw z)6V)m%BR>{^dA{HT%t5XzMgbzKks?jmk2qjN>IAGOuuUOht0i1rW1PF&*@D)YOCVk z-cixt|K+Yiu9tRB32oeyDH&*!htBcpvRs$cU`$x#t2RbYJyy))e7=eLf}<{WAH%N3 zHpAD=?qS82AZE-u^T25{LBGKt^B(F<*wSK~S~j*zFI6lJY2#EDlrv=~uO zv#D*w)`VWGo{85_`M0M-9w65M0`y)wZd%`ONf2IsOW$jS~IN?xBP@mimHY znE@PKLC?M2fv6Z#^G42%0!J7jjs^0dt+3-*6szzzA($Sd)}Y(p&De9CHAt#i#XYal zpt~qfPZ{uP(RiS07@{jmF6s$;WozxIGeBw5 zy2tDJIy&<%nbh>!sZxT2r=qFZAw392O6~D|ETw*>5fhBGM)0VybXdPt6KW3!_fp%M zFd)}w`ww#+_i@u=kM7wu!+PQHHr^OXoqF<8o?xOYC~ZQm)i2+eG@%SwtuRpZ1vHW< zF;b*8auMD(ZPm_2&Gm=1<@H$(y-E*WH5&g_M#PfFCucWZktP<6pUrHEzJr2*CwXT2 z3ug@velD73-{WP^IsLnxUWwb#tGJLRqwz9f2a6YxoUhD?~_?#S>qe{71 zIdVqBKDe)>H_*ec{Lwlsu46{WzxP(F343L!6lkcpf)~uwaY(R9Ud(VPm@fkb)(=#d z5gNQ=>~fxc1IJ%(4MlI!&&tlTj7{#o`+G}}UpWGB?(xB4)gdIc9vbO;I@XUSAdhnN z{h7zMYXm^Eanczd2UaySgG!kZn=NR0wDy*{d)=6*`g2!6pzrP6EIl~&%$Jt`~g7qM`J}( zwW%Jk?&~p74U%OZ{}@qioqA8?`pyp@q0Tpqar9@kNz>YGO`Otoa``V&&rR*VI|gj{ z0`$?YpEe_j^6z8dlH+Bk{L37ev~J4D1OH|Y04#7_`dG@pIn%%HBb?LYPyM%ZKu*!K)^zg^0{v?q;sP?J zcN!s={;je=nq-9mo}*sGrn+N*mB16HWuY+gd`>211_M6V%-dUo{^)^O?DP=d)K=_d z8fZWggK%T>Uq1a?!v*P)JP5g`Ga=u9v_+}y67cvdN@PJD&{2=^96E(p3(2 z+V=j*0gZK+V~+0sHRmWIP1k$(jbLF_aZ#VlDO99|z=)UT!K|z5;qC^i8NTTscc-^s z;S4dES{h}KteLg=Iv1%&gQJU@9(4{M4pGV$(qCB*wvR3rzN`ENrtvfykS4tuArC$_ zilMk5Xn8XU@Q5_vwFFbTy9nG6v@!-K3_;ji{D5KTxBtf=&+LL}IjeU-X1c|EhAgBX zuVrMjuwlLwv~6S0rR*?ib%gvgzsnyBN*={PukxU6&Fa#Yg$UQnxcHMbPd*PPIvQbJ zEugs5k}KuOT;)$lMmxoi7y4nO_ypJA9=R%;uEwn5fo7e4{%n8Z%iAdB&Bz+!&8}1i z7gmoT7$H0X*_=Snm_i#6ZVNPnnk2f_T>Az}G{ znmKGGs>7UA`DNwxU$HTTh?CFMv6iAJxkFiz!hf8}mA{4$W8^Q3IK+cABy-(ADT$Ql zFI<~-^jYLT&2$Pkm})N`~=hx$)-ytyLvSL*naf{OOuv-Pg?FZJxJ%t^(t z7h@e+<5rX@o2xLpM|-$tr)P+)DQ{Vg!0A+WYgibg6YosCd+4XuAM;7=PPB3ea?+cv z9!(D^?W3fK@vSGbY`obMM7D=sS@nk}D`ZQE?BD>V z2+XoX%5g=M<4Lm&N>t)ZcKcf)8IGuGINrycN3Q3D>B#Y*v!ns*|s?a zPr9#9-+ZS|XEN{b-oXnhwbVPOz8ct?qN7E!-bB{I+%9}^kZ0~by=yRVGyoo-NfGnG zU-;Ban~7Fhq3u6z5m2kw_)VPVK%5Md9L(Bsj78d zvWOpa?$mmp5#R6AqS)CmUoXWz%b2ek2=<^vQ%3QaFbch5$vY{vYXYXV11QgL}Qs>7MpNmRWD%)_P1_;TIgh4jz`%4EQ* zEZ8W2^G9B1r%xxL?Ebw`%jU-SsWLtrG7J-qnZd7}l+xG9Nhq?z&T=Kv9Kf zIn1I(h@@E-QD4&X*bi^HtrT@N6*&I|>r)g1r3XV7o9~}$EY;a-1Cw~KPH-D_u+!;j zZNQYxg71dlvCPRz)o&5#SnbiGy})K>OGipy9dtkB0SA@r-U)0Bi`7G9&%eJDrIZ}z z9cX>dtIy^efBDora%}&rm)A!a6D95JNmp2M`6KEXr!jb~Sc&;@`LCfC1lC;UzB?oL z8#maJ(Kj||B~!ij(5ZogbIeNbLG8t1WlR!P$$W{%YQb&YgUr6WcITc6$HvNgF-p2&qJ3eQ$B`?;!~6|7e*Z|VjS2^Y2Trxa8yC&+QJC&LZwl++I$nKJ8!uQOUL?GG?YA9muDfd`X?wNdH%}*1qyQX2oreipP)+!7ugE3RF4e#{Nc@H z<*FsNuKSbjFqxB-?(18%nrKNb>DC`Z5+c54r^D9|RSfip%+z&`+>hVyTY1hicW1&< zE>R_OMNQA_rTTT2mU!>xwN%@?lwEh)Yp;=`b)*4-obT0S4?D8A)KY_YG0T*QUq0mo zmJC-GNx}ivs01Mbtfh`HxY!n$>)3a=gT$EYG7#am*pWQhU#-IQh>l@jqqQe9EA;e1sQArJ$i}Y_ z(FUCLjtas2aIt}s`e<6aYRn{=oO{C`;so-1?JUBj0t!)phkW91>pmgB1SbHz9=6hU- zze0uj<7rf_%>28RBQ+DnDa8nf(E08%$IItb2)jh{4Rd5Cb9C`+%3IRj-#ENbUd}|O zn`?z2_QVeGGwqstpvA5**JkVN1os-B@f8E;{ssQm{ z9<@4?Dqk$R9U-5Yo%^0vmGVwo1PUh|KaeuYkvwo3y(Mm1A(I~Eb)&2kDsP>YuWYl4 z%-l&>9iDY@Hj{#Qd8dn6%N|}7PT3n$k(?P%7DN5=ICR}?ym%;`)2T55MNGFQsdUQ! z7BDjqx=?T?0qnIJA>SR;*n3j#lmK!?hZt#km!-?HQCUgCG})>R)wv5He|#VJ12qu{ zD$l@RRny#@!uq#9T`7vn-zs31zWgDI#yJ;=B*k9hifB+&i0YACX#i5S;x2-@N#H{J zu}P5@>obsy&q7J6pW|5uXHsDg{M%)wd`syzNP0Eju@;|{m5Lxl*l|8dnJ!bh%i&P> zb3^X5!PV~r;(ZvVCl@$r3E=YdJn2!5-RfmXPp@C@H70r5oCbF`y;AMOWn5;lwim~J zKVivWm5jh4r2|(Vw@|q9Hr9F6NyPQ9wn*$NbG?d-zwB$NobG2)>tPW>pVnd?hfvq% zo+lU2WIv8)q)z36%ah2F{nwhe?1$op5;7k2n;u@lU#Jkb?qXv?TX6tJM{p~&!@IaN zQjrzvXL@FVe!v1iG>ARibKYkM6xA`aGd%NlDwiy{w64hfTv7kZ8xnbZTytt{@KkE? zjY|gng{}7D=W9-Mufg>V0mEsHEhy}LH*+ly{19K}KV_s(tUWY5wjE08o{>#II4C0Y ze6tKf-nW}*rI+b(GphhPqsQ4UZ#7viXD``PG_2WoaXA3J9&$YV@vGy|p8DgK^+Pk! zAk?*9R`IRx(5bn1l#8%I@Vwv^7u%J9e??=HdDX z!}~(UR)oCm+vWXda}IU0sO}a};mFYAOP!Cm3Ka8Skspg7k)G%7Te0`TKnpL)W_|zq zM_ruS3T)YE7aHx<$uM2Eu(tY*kDo9$)h{Es@rI-^Yop`?=Lh}x!zR3zd!DVqHG%^q z+LDfaw7b0Kx%+E|Rrew@cQ-;_V&qz%S`d(+B;T&aMlpZ)orKbj`EvgC_hh+m8gs_( zg(Pq_wBRN_8cmS=ZppBywJu5K{Dpvmcc?xH%d!4I_It?DFQdv^*Qc zC((_0S|`hgC@;bAnADiAYI{aGFY=7^{8z6G7ZuHYqG+`mL{Iur(xL3K0;-KP)rNN# zh*-=t%t?My2bwz8Liv>`H0z9ZdY-es^-|U+Xv(L8-!?v&XxnmI79nrUpi2kK?68d% zk7cGqy`2~h?C2_ju$$toHbQQwoInu)7;f5XO z%z|KuHK>5M?{|4F1yW#m}v4Bc+Lt}(5-p+(8D5KWckY2Dg?oR#k?a)a#rCl z+%zKR6^GVAL==PwTor#IW4!|GL5}{k7HM=YUkrKJi<+_7TcQW4IxDzKq9=XViq z7`TI|bJ#>l2a(ret>o?-fWHpU_GDd$)PDnwEG8G|s)a=RE_GfNIGs?BwkUd>I_sn{cV1QEmpsrvoJypE*f zLJkn>;qK*r^W+0F5l^|!kn2h6Xz{hLazb}c;pH|wgmz%upbsQH8DpkvmBakFh7W%s zVz}N^-i`+%sJRK;8ZY2eTAdWDQ230bj?CX!{qSPK`48NrFF`{xiZm(G01?BXlw8F5 z-`c&+rVI1oA~20J*9)v%kAm#VB45&_iK6%#Hchz2%OjwXP4gTt#am>am#bwRZabkR zSLz>gOM@Xyh&O81-LmxOBXmBRg!b@~ac9fa4@55vmrLCR@rlH!Hou%nQ0{a=OJe6X zPKO^iUFN*pP7xxUOXnfoQWHDSNa|J7&k)@X5*LcdR#E6W9DWC*Q&~{l&_e2cz(3hjAY#f(2qemO)QDK%^$B?tEN7hd-%zj~h_ifA(C`&h#m z6BFT23n^~|C^E{iGvUX3W>t6x(i`s)e zv%c_BeE;^{g1qFRjw>Y+mRhSs!`fpn;dY+WSoYqZ&nIB=^_#MtX1rt)!zEgCm8j*o zW9X2NG&--Q?_#Rn#rTd}$>H5|V&~=`?+`;>GLqVp$R<@+uU{^@tBU7w^}Ok)2ghB{ z^B3-~p5r6840vQ6;uh3x$m5;j`jh)SGJRE zqJ>r}By1``uCQCh9W^}gp;8PbPaC}Z_9}^>HvJ1i#y3Ye?oAn43E{!h#z0!%DCAx> zUsC?b!WUKOH-E7}toJlpu{CtN*%g3e^FW>8u=SOyW|GbAO&VtUoF;e1-F7K6V~)Q> zarwnkJKF0F2#@`3ACUHL22;s#fu&rkYUg?9gAxwg@)us793)~GkI&+N?RwX=-K-Ow zwiCxq?;W5WmN&anvBOW*9i!!vWbSfW{YS3*X$ipBI z#l1(0J&p5PWrR1j(t7HIw$Jc$jFgSuZwE-!!JE;aqZJW7DS{b{Q zN5STvJe4qh!h7X0PBWFJ?R#=3K`BCI?@Qh&Lv-}|wU_o}&j&LKb01t+2JwV@Zsz*z zL3Bj>a4<U6IUZc zd`eQs29m}mmlKjH^VlBB{yrZoeUwlaywK}hN`O24@#7tS0&=10od-l~a)-@NpjBD( zNSju5u!->mgTibt;v3&d@Y+v*o_s|r?DYX*w6t@I1>?e9j43`4o7zoAAZr=2SskO* zwLVXRGc*wsTm2I`*^<>7Z)4b0C+?SzD2;uAoatGC*6|X)4q;0wQRBS8R7%}Ruv+lz zYCnDRV;$Ei`TKMDD*fp9p(z7=pC8ehu|6>BWgPKy6cNR^+k(YfQ-d=K*0}9Y8NV_Q zl@|~Wrqa@zgr z6>Af@xXKFo&?uh?99&6eRIHuAmGT#+yi5yPyrlE_QVxbq!?S6nX=+pbv{Ia(^~RUs zb3rC1`NXEfw6WCH1RPVlXQHDtugN4`aT9hyinUb4w;t+z4Lr%dSi zP<@Pc5A}dWO?JBu@}w5@4y|RDi1WY1NaS3YupP9iX_FMKoZH8_g86)f<}&DnL}Ii) zOnGDaf}umwp>3S$8FpK62H_-PA}7&7Jpx>``3(bz8GUJS?t3b+Cvq~zm+d~;Z zQkQ&)11B@e`@^=)BXZs^=;Y&@KsFYNi|ONJhy8IrQmD`|bUuEW!3qu8`a8T&BgK)5 z?)wY#c;a$-pBk-D&G<}WEIp`{6MT0mxFZYmxVr9$JdLzLx`B^!GXy|vLZ_b_BH`T9 z&%eD|hOym&`HN-nJ{LY-US>e2M+Y>8p^tW9QAZJZdWsRk71$2&;g-n@a&NLoz>#o0 zfe2w$tWDQN)X^2&Oavn0Mck1ear3k7I*E|miP6)j{~atA=b!y|U~8pNOAj)){$}5Q zf@RGe`{m!j{sXJArrOc}hE-Th?{4ZO{2SPRVwEwr>0hx5i}=fj1OEzE6crN0pxu=P z#i2g4HXY8F=8~}ag30!%R9Ig*m&FN|UUl>2GXe&SuWp9LvC^A>P31T%ZljK3n0gS zpqO5FvK9mm#lBqU7iKHA6*&tSSo`6)~o&x+pFz-9k{6FB}%9o^xz=HmO< zPRXrP54|5PItSF+F*Go}IN!d5M&AT=+dj^#T(EUd{(&okPE}DWK>%9jxmDtE$|_TWiak-$tSMw=#PNW7LPxnP0Yp1WursmJafajLRc zgdej?Td*=c+&?g~bNXKsfJSS)COzv; z^_<6JXUw6i-?T4|>Zu*;Z>6_tz~*!hyaZf`^3S*|Zgv4}vR7UIMSIvn8BOr~aJy` zSw#y_x=x~cMZ?0h6o}{@_2|KgxMOh@i7)n)f^s6qHsEyjp?Zodz~)vD4mYy!t^I2W zF=kyI@7%g93Hzo>(XTAKhCXr(^m_0nd~#3J4G_31+>u?{jM6z|n@-eWrN{YosaDyS15a4(ShF{)kKV2^^RRiKE+lcoX!@FJ-s}+b;_8uP8phaN zw0bIh?bm$_LfLzXi!VxB)_4?2b#WUN97Wt&SX>TE2aTS}8Eo2q_JXNOD+b`VtoEl)iS~PfhH!idl~?URmU4%Nf!D2K ze3_J~Sm5#oNyohl>l&(U{w)%8iY4V4V)jvQlu@!nY;Q>Eq_Y-5=~~GL6BezvS)f$z zs0XsPZA;idy^u~SwbJ4%|1$H7 zuHX3I!W#C|IHInIVa(Ac16ZwL(4J3qsf)bG@p^{vvJsv~gdB zM^7#hvt)5VzAs0!$Uo&vNjsZ0=%@~h_zfuj7}M_sFvE;$zR(x?yd4+rr2umtN%8g? znbo-Y)l0g@X2DxviR?OizgKh2jym^tZRVMPKJl;ioJSem^xd9e?XmgZTwI}ad%Z@0 zLaqI8OGX!*VP4gKH~X0#{Z@|kD-R@RmKc9%SIAm=o5oD5mzBoX7@EVpz@gjD(Br;Y zb&)3G7syCRu0X#6?zU4R6lL<~V9s9%Cx{mt&QY7_A zy|jJK20uZ`s*t0ll@UKbQ?@)K@h#a!P0p58WL>U6!skZ7`EwcO�+9eLb17NhZax z7l#iTNt$fG8TT!_zucmAdt*;4d5tPWwk#7-C~fzicj>t&`8AQ-i*%3L79te8AcTjq zEw#C03(plHsW$Mw{5@@zRnrGT%JB2uK8wSNrb|9;{pt>{nehu7LX);mNYa}_r_fFc z?qn>bwYI$q1uOFzAKCAorn}$<&D+$Vw)pbdT)NzFm~+>6y>`bajaCCil;JsXQeTGn zC^J#(zh##BML)`iz(=!bll0=fZkb=7LD@1{ONRu4&B&`!+oC0MCk#OJYbNAz-3P=( z*{qZY4CQm(2ge1F|8qSWa>C#&A)+d63AB53#YqqXc7u;4Q;W`pt>Gx*q@F;ANCjBI zZFCHA5*&rlXi2xf1B015P}*hsH-~%@Nxfr5(mzy-*F3SjQ>(dry6ergK!$P_!(%OLwsC)6?Z&=$H*M;MjZ!n%g&dK7v5pMpV~QJ+CiJy zin!BSE0v=yBvC@^)ueH&Jx5P}_F-mrMS&Dq&AMOl1?1Ov?>5Ve`$eI^|AQlf8wkfOE^G+-r! zljkmrl4gnM=V|p$3SufDFiRFf0iE~a=X!O;9a%dTmo8%6!<;mG!5wfkb z*uFM_*Bbf+PhAe;5hO80LEGo{kH4nrc(ep@5{wQy!&vqKEO+2eR>D)T2YCE~Acc3rYRI*4kE^uJYZJV1?I;jUFuYA3jL{bs zjafVZE?63+fzdt~;t60NqaDzIR0G>>hNpA^{jdy>u3+XJyqC0Q2?=)&mcdJYcm$(( zxfYB*?tn*|!RQT4@=L%G?#cKmb zI92IZLvW4S9rp|-3)x=nfQy|DG$AG^N%4xb0L+kBK^?cOKsj|sNHNnMR|IoJ+HM)b zbA(>u_sdR#8Y~F4D-^3C__k@xN$*Gt;u(P{hCB>}9F5?{(5-_Ea#ijn_dsQjU`0WK zC=7zqtI@BJFsr>Vn=+XC<&_lcRcT4lg7|v02dorAzMBtY?C=Ki zF(HOJ_3U>Pnd-1C{ysTx-ddMddX7nN!-$2e81+GmER|xlf>nDEoGKW z_V`}u&@UewS4)4Nh{vf~@)sV2P3u3Xex)yE_}5eerop``4*E+r^dwQOk}FX?OAI%=T25?|a?zLNbOf3Edlww{l2=vx0&3E~wfYK-C(^8!!Me>XlGbrlDcSUpy7{KL~kFDv7CiUYf-j9-~;I-*x za`-EdU=*42OVyK=!Jvy$nK@5cD#CbnTK6p#M{H035RMIEVsb}y64yu23*-U7jJ+$f28_N zxC9tR{EkOjdWX3oJ;A~Eg=!1$)Bb>{=aVyo?e>Axcviak52FA%k2dg*1a->hgWS(5=$i~bDrXYf8kZz z^g9n4l+}{^46fAa?CP)A=csGHr*HqkoEW9%G)aEnzV0Sag4JgE`ny>B_9_0fsOvb@ zVQ@`O7Yw%oU90aw7b9iLXmq~E5kJ{m;lXeT8Oyv<`g?#PoWFz1E|+%lK+tF!Ws00a z!MmWHT9+IU=$*!X5wkCpF;}XR+E*yTe=EY>Z+m$>ly)J@ONqjWwRFhh#&8g$9$ z_Ib~>tK9q{MO8j>9DEm5m(I;r$z1A`?K8y?4qJOZnB;u%704(Mv8-x)XJtuks}Add`YS>%81fy^TJ<&l>4~Ch;htCumrsQq@YmRPjW@x9Gh~f& zulFuWKk3*jon!2qwb?#0Or5fm;LaH--qBoMcg#CbGm;Ww}II- z-jquG>p1$S=)ZIs`k}i&(K+@i>%WTWe(#%B{cUEDgfA#RQXt59Kk^Hpv!rez`LDSJ z31>5$LzXh%y?(;xd7#my6GTFhqSB-q zI-*obK$>(I2rZNVLVytRPQbbM&AoT-ygT3fzW4s{!|d#{_A0;iTWg<{@GAz|&;#5D z004mMT+%WE00;&E7%YBd0#_K7-)ez>7~GAte+Ke#ytCkkAK>Tp&jY}_D3)#Oece(HpkOPX+XMVoStN7u$ zqDBX|B7^J+gIDL?T~0=QiMaMd%p*w07l!CFQW;CJ7f&7B$FU{)D1Ro_f)+v{RQJLb z{T*)hIO8b!rR2br$z#oV0WaQE;?0%@hL!F?K|MrekcmNc06@*Lf<^$>;2S>x zK&oL}Xp=||>tPS|UQoG~3F zkoqu<|MYUOFxv3V+@qmd8r4QrPTZUr-&g@U01v;L2YUGh$^FKd#%=a^&~Me(^wD_`MbtC&}ZX0=f_Em4Oo5e{TdkY(wL(8A03XtNnB3zyPV! zHVywVK>w_BdYT3z%)&WcKg!+X>4!X5P`H&mKqnLp8{!$s7qRp}# z1v?R`!lW*AaxXyFZ%&Q`(Wsq-M0kqQn`rYO>RQNPq#!+JcIM2vMYZe!c{Z7>X_}T9 zc6)(&6QK_;-fR%qal1C5xKPs7YvI38TEEb=izI3AxSmk~B&j~51{cnuhBDg&(Cuh{ z5I7g(yhnWD3;v^&5x)#!=&ZK-R%iPCp+L$)2u21?cY3TdU*Vgbzzx!PX)#XOaTzPv zciVgT>fmi(LL5(-$mnWEnx?jMpXhhx%d(35RjJ>)9=F-!RF9 zXs&LI@Ah&Nv$~}JZ&EG<1yL5tkHHNq3uH=et5aoC?PdZdo+vPtzvbHlsOYV({>vkN z#Jo?LvbRqS7-Y0?(nBDfNB2p&Od;LTkC(1WR0pi}++_ayW5!+mPFv9QAdjM;64{j; zf&m@RMp>S9Z?^n{HiqVpV_)K5ANpGo5SVE1CgJLo{`CFSxtq0S$nAE8(IK~w-`+Lx z50ZRscJm{#mm!);t)VR5LM}-o`Bi<~+$smY=bE(K%l1hvXwK++iRy1(ph5C`uD9bm zI6PXMEATzc`OR_uqK!{?qFdbYYTi_}+Q_wOLNg&4!Yse-yS^JN@QMCW+77u^QUWWE zT__u5DtG*@r>Gw2i`I}IYbe7@5=jlEeHQ-R@&wq^#pZh+kbZ+*rxvn>%`df$`rDJ7 zxxRZ)lkN)bGi`!OQLwFmc#O7oZ(R|egaXip8TAW8Cb3!m|aj|*-hhkuv@Np&p5i-&E^u!XFK2b(`OPI2vrh6i&F_CgUwqeN>u|Q|F`dXd ziKuug^>ucNnFIZsLRZha`;YZhvIXTr#&r zUC^u9Y9DE;XA|^$TbtiD~TE1D2zhTah08if&eJgJoqT1lH7n(WX({BL<`rog8Z zNDtZXY9L``e|XfNl|Zmy|GtKSJZ}-OcKy%GNySNT(%AVw-}g@i`%Qi`pQ78J*FUXcb)q03p+j81plK2+-1H-_o^+cUbZd~M39xu)oyD)9NRI~%XC zZwqR+a?;D+ASr{R7LrqfwIB;HmA5>#-2V00W6bIU775OwEIS}IE{TZxVqCdn=C{xx z&t=prJd8K(mCzh4VJ)GHG1H%JQr}rlf0{rO7&v1rO|1et9(mRU+3?lza>4Go&~~U| z__&)ESm7~xJHlMv^1L8$?JZG#l|~(<<3xxk36BhF9}n=iQv~Nd~(aqPqX4%J#H6O=;ySU?row zG{2a3R?X8%qGBfflkynI&?+lepPy+E%DBO8;A>^fn+w9_y98X~K z?uKo5Ya(vZ-dYKwe1mWa?!8{d%dihHa1w<>+v@uBAg#awW4jI8lJ&*mN{d%|S#F7~ z6H)3l8x(W*b~$a>0e}@doAu&oz$(~&sIGJ_BaSC2Ng<_msc7S!AknNXG9&7G(j3E} zw3c^JK>%f)Z&UbkC}@y~HdEyXb6lXo6J~ax?wvlB)tXDW(i8U+Zsupqc+AyVh2(Rv zey`#Rp|Qxd@%_M+26KMggoZ3#8QG~XZjV;HiTpfE^$>t$No9r_`0`!xa7pFwcL69oV(i~B79LxQGiR%i5kMPWw9Ze!_>chLGdUQ^rX?eXHvIB}a@b1E z2S6zi*{zI`;P!8rd6lMG^{zV`r{$IcHZA#8fjZteJ^jl1;-Ns9o9^ld@gAHoowm#~ zJf7qLA4UnleJrKv$&?pftjl)ev>*p1;i%S|e89<9WZb|xZvJSKK(-FC1Y zA{$LJdUB;-?NV|D4r%xjV&Q5^Bjwp1yMhcBF zN?ph&_4CpUBI3qlWVf`Hr?=^%(3~g{)0$VY6GVYRZ}jtbQpjfyPWcQ@)UX3tA6EIx zaB){6o{Y!1W!C#VBCfw*f}lj)_W55d)~B^k;72bJevTl>OBIEPf^o` zwR&MW9-Wgya(wXj=^4K)4cJ`4efCUvq-3c%cm1E4MO^H*3B`_L{VDfu-nr9_kit$eDqeuc+JPSE4E;^y3HJmJ|X&{K2F*bi7>B!kN z-+!&mHqy+4`jJpwRhic0tnhA#@d6WgM|3L_#~@0uj>`VzMKv({ax$u(==OQH9@JHZ zr-g%8w*#NVg%XB=jt7G-D+ro+G%F@ISs@CSm%KI~sLsX;6guPww&rcaDumc6)DH0W z7l*j(%&W?93}v>Z)@T(IBh#gI4p}69px;MP6siHu&*zHTQNt46$l2GET6AN_GkH|i z`n`6axQ8Q`BUltS_+a8Gn=bIm zOs?$l02JfFdx`tGSFtBzXWi_0=x1@jo3ikfKn6Eewrd8Kv$SEeI#cHxEu@zCZx|=y zJ^L;~ju4>PdVYGi(z}2hia3}wi%^%8Qu=c$FRri06=7n1#9;Dmq!#6bD}~poP5J(e5_KDE1x_O5wfb;H zJ=_g0nCbM?{jvto6t!UYi!1Us2&GuHMt%(f8V$waLi6fQ@#F4O z<`VUyie_w57WsFqvvrreDMw#eZzR9lQS(o6YBPvEGXXn+TAo!Wj8G}_TBaIVA2H_H??~!IZmAqF=Lt#tXxDd*+Rk!^YjwTkzMsiFe}68=+Ec5;3oi8a7P( zuwrDo<#@=`S2eM}R5~iB_%T0?$sRH`rorwoXUxhVaS_?koe!w2#|swo&UM>66dkn! zMO{>FkGx@y+xIkP@RWTEmsdO&4E|w_Tyi7n@;!Mw3`mg+55=QRQOnahVwV=1sU*z9DpDi=(s*$!%Z9p~dW184-;T^;SY#g066m^ov* zouqUw3ECeQP%@7Zgvv#6%!?c#Ye8g2+8YBh9QYe!zY8}zq(Z5j6 z|4b-h=ZSbB`aF97-XDLCs9}do-0)_27?Co;m98Om_gtCzzM zi*>;_cu#1fpNrDPRqeT}WQvhi4!ytu||0^AAPJ@S*XO=0r9}qPB8nUob?fZs?nAkc*z{%ABm!=l0q&Tr?6D^O7J>#)@Q*p~Rc{n&DF1VOA zg&_Cq8`S-C$TLP3iV_9EhuvGCQg$xY!H0>M!uu*XA5Pfe`@T@86g?M|2!aUyXYhVw z6Djc*8KpuwyRmso1VqYR<0{nj;%e67Mhz}Fo=>P*oN?oMBRT%PvsC3o3R;V_|AXzczRr`7KAo@#TW?tlmLY@Gk$*SQp2ACBgr-yEIb1ySAVq#yO3j ze1#zq%XnabWY*S1>JKYE*AagzMdKocFyK8%SzuCDfY zWmWo8>XokRE)%L4V|x-{|Q<_!Csv5e=~8{l@hDveyQvw}AH2QnPu{V~KRrTSUO zcyT%i2XQY1*;9j8TQ&HS|N6XXfqEueoJ^_)>yq*zJjqmtHlxe+bFc|F+d=E4k?O|- z69ykzt1A+)hYLjFa2JPCV;0An-keozHkXf`7dCIMFu zRvilEYXZL+j+}2Pdm4j=bl;fMRq*la;F|0XV)VpHzL00dh)qTuhzNOj;z|s}T#C)E z+QQfZwTcg05^vVb%p$-Ue=>M zvnr(x@?!%Jh0aD^FI;t&ZDwjJ;YHFJ0OU%Kp`QJ6-@gLapsnD9o+p zpQ$yi1}z9|yD4qLo(mQrmI^(mic`sggsjOgPOS~P6%-h1S-4;j5p=_s&zq(7nIv+Y zg-G*!4K2*Q#qQyme%3&bTF8%Do-1J9BD)0<#4O+Oo16eO^ho&Xf!*06_F*D>_zsCI zd#G?mAxJs?3-NvT@0}%h4hQ6Z%#^Q_CNeyaPg|?Ie)D$ehDrEZodYLK;kC-C6)Zl$ zg<6ZDZBHxAKef{q&z@?_^siHl?Q^^*Mcrqk<1L@@SkD<{KsylrjNoUj228l;u4$By zEcMcQAu6CpU+GC;Z5wc3GkN!kXsZlQGfZ5!s3jP^AQW@mt^wb|3iNY4uQXyu&;7Cn zM2v>_LhSgh;H;PzCCJmShRCz}v(|pC#0r1ZrG%9&X5n0BEB;*OIVq&e&oqt~1py0= z#J-1+t{WE9qnkMIqXhv80|0fcPN8NQ3R)DrqD<>8ud!1rJb677FB!Di7SqfHPkvYC z*q2`_8Myp7BnVcfA*M+g{c2=ECahUX)N^gEo?|lO8DJNLb+mTu2rY+OZ6sT##-&jW ze}&{h7eYA%?CtDnF&kR;(#RdkC@ubn@S)D^RpJCeAcibcz%wvaaa z;TW93l-Li>tXLsXPSJ(t?^SScpjsfF$5u4#KZ}M$2Rjl z@il@VEwV%0C|rG)zZuU^C7cf@f!)?0#P?6E?5o`o{0ma)sKE#A7;~KdkHbH_aw#}7vrNc*|d5=gs~+VwLE9)_%35+ z+DBU>Dxu3j#d!f75AbX!C4zVrEIL{;vpTrR?|$1y+7QeuOj1DLWzXY9OtM_CQE-S< z;yV`1d{m{*clu@d`qT?oHkUs9QV@*-RWay4!Oo{F``$T=4#zG|2aOi6$thm1UJ7t+ zAXZG8$c@itV_2gSY9Jsmg6=d;mG)Ern3qWh|M{Aqf`YtT7l&{mhuS#|{s6!MZ~6}qjnwTa)~$*uCW7WBBTt$1_qG)3Le z)MIaul?2kN_!}nMh1JeIBg^|^cb21qoD}aI>QpUD0ugqvzZi}ms0pC-?yO>HyqnF1 z^Kz-Rg+p`c9uXkvg7y}zZ3YfwzkShTE`QBein`uX!{0nGok84-Ogu5K_%2o?j!fbj z$j4xIzGXkgi->4zhL*L(gW_j}$odiQnNFf9jN}@lIOhORGu|@`Ebyt$m24x^e5$otf!lucN>GqFdC9 zLX0*cjJXF~bY~q9TE*5Q6#=gHwYe{6V3s4zJ0Dmihe&HK)oZ==&bKnRCAQR~F12gr zF-xy)I(eqPZ8=0_Xn+@p#2Jrcz=Xm`xY)vB`hFJry>3sA9$<)+92Hvhl9xDENXm`3*iwB2# znwtx*L6z3p6@>U(OyzCQ=;-iU#7_4vEzH!iwN?udY^cA=m#AONHjnIbWlAtdw2XNf zgJlkeb z!{%2L=@67cE~bjaee<3J_j)c65-h>-ohHaRSsALTse{vctsipzQ|pRAP}8+WXS;#Nl*3;Dz5R{MX0w&Tm~bTI!n}zjI1dJ=rgY*FCm1EIG=6D|GO`4jBbHLW1((y6;Tl-f@?B{WQs5n~+MIg9 zT>dz6*H0ZqcyjshBH8gbGiFw8_5hA;$SOf9tJ}oP{*BJya%Jwoy|bPgyQyv8Go5fO z8JxN-gD2BT2V}B>z=#KzHO%Mn+ErO7u_@6bnUm`&C+Lgg)wo)B+WrP9XbI$ zNn?sVTN~dN-3cmm-)%4uEs@u+3%$p;S312gmKM+N3aIM+1C@gvYKDlo!2aRZ>5FIR zrM&S9M7Q;@xa9k>2hf7qiR%1>sPy<)vJ|BYv*XcS_Px?|&#$(X+ORqXbAT-xXs%8> zOubS0;BF&F(6=bQyLsu8myuUvs6e0(i3s1NNKiu$5q3dNhs!U*xq+r*yTtu6a3N

R;~K&MHjkBLDN&6l_G;`BjDgLc90xn@Cl+G1OmdYQ+kw zPX4d!gWR39{w4od`ppXJJOzpNU)@r`*Py#d{*Nvw^w#~cWX)gkI=#sT3(=*2cQyM1 zE5Q~G22SUn9sf(WlxJdxz{`zn2~7vt4eZ@A!S0N8A&3JLM!yhRpY#G7b^7%(hoMBi zL_ik_(hAoA?KJF=T#su0c=iE^j&a#Hwqd2qr>?c4Lt{qni8vx*i*G!_L|V< zV_~UBCs|6s3zQy9dng|Kg`Qq|$v|hS3@FVUY(H2RqBxF$lP)*ziZ$Fl`LKgN(FQ-7-;4HZ1v#306})q!2kdN literal 0 HcmV?d00001 diff --git a/vendor/myclabs/deep-copy/doc/graph.png b/vendor/myclabs/deep-copy/doc/graph.png new file mode 100644 index 0000000000000000000000000000000000000000..4d5c9428f719bf6ad68f25a46d6e935c2362c4a5 GIT binary patch literal 6436 zcmd5>XFyX+(>{p=At0cJ5~(UkFc4HM^hAoFq7)U7Uc}(FP?U%SNKinE5)0B4Y3fz! zAk9dX@&Zb;5PB0q3BC7k176GP=l%WuNOI1e-I>{$XP((P2{bsWvktil2|>`hgSuKq z5Ckg%A4?8)FcR99KLmbY7mai@pp+VsFW`oaxc|t02ui1ME!ZN!J*Tto$%_!g^P2U6 zRX9C81wlf22etMecefgB%X2#3C|vH+@I+&mC`#ZczcySeJP0Ei+`WZA*tfw~%ILu^ z<_Ri65{r=BhCs3zM(x1{8xRh~LM_buP1C*jh>qdt8H+Y_$j!l%L-VcUi@LNs5ofE* z`wD8`<#l8*KVW9@pTPWdzM>EhN3_%yUX8J>-N$GwJ z0TT~xmf>yr6_96H-&Z2qi{e0%T%ecBFx~6R( zhx2x#5gZ3mv8e`B11*?_kx*`J3|^W?1E#V5=kX1Qek@7?We7C04`mW-1Fo&k|7HB$ z-}-^SjcdW?kO&U#RlT1oH+D;`%K2q{X4L-oaYJgsH#2NI)jcKx6ggJq{4(x2bL;o< zuZUdR*Zx(ZGRK}r?mchT`~KOn`kv!Igt?CpaD6q=iI?2m91xC81zzL{(|fBMy5kC4 zns}$brEQ;zB_n&sO@f5iX}axq$T^j`H{`drz7r4>mR_^ zl2>DRFdcI0D6ouFARax^)RuQqnl8EN(9Ws6cFonG1R>lf`sv-3Bt^=cihnGHD$z-4Z`Xb_H&f{!3l|A1jTiPS`w8r4+NQ=bvj) z-}l$7w%boc$yE}Y>&GQ%Y(2iOIi{t0E6%#WV!ZDk^@k9S_pQTlmQnnzACt{H6w8O^ z{fGf!Uh`A=E;stVdC>^AG+v9}Bk!i@z2H8Pn{~GFG(w0R*01!Bl|v&VY4Zy+J+wV# zq`~H_eivh*E=6pWeMN{iZCnV+7X+YfBtvLf$T(GbCyBuvBQh1MZwl}G3wJHVEh*=_ zGf9-U7kNaLL;0Jv6ujmps>*@|6RaD}zj^X8)R=T~qg>AD>EZVL`qTlrZ$UDkW(PV< zF`Me`gq@62EYOS1?LYZoZ))Xoj2P4Pb6uUmMD853HBVvwRY*ukl{ICNU#;fYH{o&6 zcsSl9$#lKiwlD=^&GFMU4P!~FUG}f{&$r;JUl-W=l6v^KCs^xf<1JVApXDcmYO#Y z)#wc$KJYIp=%)|Y7c??rvXoI0-)K9z2CxzK*b}{Hmq?@o%dMJBa^`S)Lc-R$zGNN* zhZIWUkbO`2O(*Wo)4g}~)t?Cj_s$O&(!_c;-{0p{Q&0;4u0uORglaK_&;yCck;K%3 zszYT0yOFU}?DsV~j+^zRfK@47B-T-bNH!z*V_p)}--8;0Pn z1A`|BiHX$=&AVN`O!GWm@#@O>^A7qVcdB)v*er%hg|lr*+Hp?$F@M0~v2;S!hys+X z1%t1jx*@Mh&LCcWUK4|lQ46*#@SOdR4h*F1(|7OQ9h2h@<_~xY`0O;k_Q{d^2h@>3 zjw@-nJ^G&CBKc(KWFLIfei(c!v&jm>Nft2OOX7U*y_YU&=1(kr!?VuUh-!_Z^5Y>dBOF? z`Lv0Ni5s4%5gObVMe>|0T{LAKEUryInt1zg(XWG-_h>8??#uSj*3pKD0ibrKiN+}B z>Tm(%TG&_oEk^R!Kp;4B-1o*|3l-iEwZX*3|)% z0ryo=y@(N{Ulu-etC}(53-`s&l677s>MA+Q3tEA7*V?Z2I`Ez=84e52DB?o$;YMWR z7MN{h=JZ)xB1Sb9>VgkT++iOYF4>6W^RurYnt|=fV+g1qBHJ0el^KRYB+n?}(CU4$)cW7*o+ClgT>j$QNr70ogrEykki-8k|$p(=<<%qZ*R$ zd>Id+G!19K1}E6im;{H7=2I_TPVxEuJz5GAqAPc&wP8Xf1zh6v!amljj4Os!bOkdqF~PGgLg z+ce6_3(T#Ihjw0Qz35{y^+x_&(3hbhz#BXEBKdksQdHcDXLqX-2EKejgE3_!pHtaD zO6=7{R0Ic-&%S#J`JRzkXmIshLy0Mda3fGO#^BU6?Db0k`2(6TyW_9Qk0l5)9Yl zP*L|$1ebwuJ*_1}9Jt%pn;J5)0w4!4l{zm{G?S*VTMlIdXMAD5VeOvAXlkmQHF8DS zRE`D+LUCO>xQA*O%L`{5@AY z-A+#ZESY|{0vFuufPywLJ+m6B@c~)BM9O9hb~yorY1%!k$;StLo2UBg9wIV0+3Oto zQZ3n&3#&GcH4$TOiUe*kpdu0}zK+wdD_yb%>Lja{>Zq|kdh{}e2Vok!aC4NVJ{Pcj z6L||#sl_i&ykoZZ?Q(RHQr&3mkCVq)?*At7O`c&)hBvV|OhUivY{jQJ{OyaPuo zU$WQ;AyDfy5P>j0QArURNQBA=WBOrwCrjW1Q*KvPPzS4*ONx80I zXHNw!@Y)XpVxfbte>mee<>G1{T7Opl1@1XBve||2$L>)QXB2-@UL?>v-9bs!i`?a) z@x5J5?Nee+L7gr#ZA!D%yu@x=Fh4}^?{g1X@yA+TvD~*#g^L1~tvv@ZC5*;NA(nik zLah3?##Xy_*0f-zJGj4bROkbm0L#YQM8#@9V>aO)XrClIzwE7C3RC?Iph&F2<5h%1@t3wWJHEeLTjBlFS>Zx{ZDrTOB5s zsFW&~@YWZ+6DSy!HMHen#X3zpQV(YKRiDagjcMbkRnv+xz>$<`@$f&gPboWIc}#xo zcd-JIf5bJ?o=?7T5%jcC+LZCnZ~I-+Kk08WpGmh@)dmp_FX0CBRqB;)$?vC2xsH9R z>~|4kA*M*+@oo4Uc~2yt``u}@GuU_3;TRHn{OgCrdV8Jf!Im8C#m{eUM<7^eJ!gm^ zAo-Geyx8C4=UILCL~f20o@?9up62x{_$FOzIvXOQbVsh0)%sp&&0VjC3v(Oz=nz8( z-FW}bhb-(@&vW+=3{=j)lxaD+M|WmzVCVxxT30W|CqNDAp$f z!nbtk@?{ebG8wyaq}F{fjlMkBD6tt29j*U(EPYR&HEYz&JZ=Ew%Nvu7J&e6)$8BfFdOx_n8CPAy^rm=^SAm{Aq2iv*s!uk_5P};Hf=ueV zYq|8IIyO2wdQV>|Xau&?FAt}P^;`j&sH_0;YjAx+BSRif89Ta-#5>aP_;7vdu*?)a zz-!s}#TMfm0;vi`L(?AwZJ4>cq~4rDrmZWnCNTxOq-NnS$kZw017L&C@GjfN^0dpn z1!spNZyEocknnmC_)exM3`uDsWj38*jsgCKYd)Qw#*0NKXJjFan@usu(r_bsT ztgKDv1?a7LXWl)D3P0c;0|VXeZ6(TmfPilaB1M58iBZpY9qle-p$sexKJUzVw%v{w z{`yI{M>~KuG=6Eu6-QOR)6$k)tw9PYo_+VsbXQ#~s!*eW$AiFVo^B^Fe6{MqV78US*eoibxe7s|gY<2<} zcxzAJglV7KV&;M1{LiDc_+`%?Q~gzt%PUSs%~cED4U}8JFU@S7n^gOj)g0;TcBXF- z(T{*7YqRJ{Al7m_T1Y6s`}{w$zh;8>75#bYW}jWySEH2^>^2()nnV_#YYhms+GN z7@L0~i+?ILrly7 literal 0 HcmV?d00001 diff --git a/vendor/myclabs/deep-copy/fixtures/f001/A.php b/vendor/myclabs/deep-copy/fixtures/f001/A.php new file mode 100644 index 0000000..648d5df --- /dev/null +++ b/vendor/myclabs/deep-copy/fixtures/f001/A.php @@ -0,0 +1,20 @@ +aProp; + } + + public function setAProp($prop) + { + $this->aProp = $prop; + + return $this; + } +} diff --git a/vendor/myclabs/deep-copy/fixtures/f001/B.php b/vendor/myclabs/deep-copy/fixtures/f001/B.php new file mode 100644 index 0000000..462bb44 --- /dev/null +++ b/vendor/myclabs/deep-copy/fixtures/f001/B.php @@ -0,0 +1,20 @@ +bProp; + } + + public function setBProp($prop) + { + $this->bProp = $prop; + + return $this; + } +} diff --git a/vendor/myclabs/deep-copy/fixtures/f002/A.php b/vendor/myclabs/deep-copy/fixtures/f002/A.php new file mode 100644 index 0000000..d9aa5c3 --- /dev/null +++ b/vendor/myclabs/deep-copy/fixtures/f002/A.php @@ -0,0 +1,33 @@ +prop1; + } + + public function setProp1($prop) + { + $this->prop1 = $prop; + + return $this; + } + + public function getProp2() + { + return $this->prop2; + } + + public function setProp2($prop) + { + $this->prop2 = $prop; + + return $this; + } +} diff --git a/vendor/myclabs/deep-copy/fixtures/f003/Foo.php b/vendor/myclabs/deep-copy/fixtures/f003/Foo.php new file mode 100644 index 0000000..9cd7622 --- /dev/null +++ b/vendor/myclabs/deep-copy/fixtures/f003/Foo.php @@ -0,0 +1,26 @@ +name = $name; + } + + public function getProp() + { + return $this->prop; + } + + public function setProp($prop) + { + $this->prop = $prop; + + return $this; + } +} \ No newline at end of file diff --git a/vendor/myclabs/deep-copy/fixtures/f004/UnclonableItem.php b/vendor/myclabs/deep-copy/fixtures/f004/UnclonableItem.php new file mode 100644 index 0000000..82c6c67 --- /dev/null +++ b/vendor/myclabs/deep-copy/fixtures/f004/UnclonableItem.php @@ -0,0 +1,13 @@ +cloned = true; + } +} diff --git a/vendor/myclabs/deep-copy/fixtures/f006/A.php b/vendor/myclabs/deep-copy/fixtures/f006/A.php new file mode 100644 index 0000000..d9efb11 --- /dev/null +++ b/vendor/myclabs/deep-copy/fixtures/f006/A.php @@ -0,0 +1,26 @@ +aProp; + } + + public function setAProp($prop) + { + $this->aProp = $prop; + + return $this; + } + + public function __clone() + { + $this->cloned = true; + } +} diff --git a/vendor/myclabs/deep-copy/fixtures/f006/B.php b/vendor/myclabs/deep-copy/fixtures/f006/B.php new file mode 100644 index 0000000..1f80b3d --- /dev/null +++ b/vendor/myclabs/deep-copy/fixtures/f006/B.php @@ -0,0 +1,26 @@ +bProp; + } + + public function setBProp($prop) + { + $this->bProp = $prop; + + return $this; + } + + public function __clone() + { + $this->cloned = true; + } +} diff --git a/vendor/myclabs/deep-copy/fixtures/f007/FooDateInterval.php b/vendor/myclabs/deep-copy/fixtures/f007/FooDateInterval.php new file mode 100644 index 0000000..e16bc6a --- /dev/null +++ b/vendor/myclabs/deep-copy/fixtures/f007/FooDateInterval.php @@ -0,0 +1,15 @@ +cloned = true; + } +} diff --git a/vendor/myclabs/deep-copy/fixtures/f007/FooDateTimeZone.php b/vendor/myclabs/deep-copy/fixtures/f007/FooDateTimeZone.php new file mode 100644 index 0000000..6f4e61f --- /dev/null +++ b/vendor/myclabs/deep-copy/fixtures/f007/FooDateTimeZone.php @@ -0,0 +1,15 @@ +cloned = true; + } +} diff --git a/vendor/myclabs/deep-copy/fixtures/f008/A.php b/vendor/myclabs/deep-copy/fixtures/f008/A.php new file mode 100644 index 0000000..88471d0 --- /dev/null +++ b/vendor/myclabs/deep-copy/fixtures/f008/A.php @@ -0,0 +1,18 @@ +foo = $foo; + } + + public function getFoo() + { + return $this->foo; + } +} diff --git a/vendor/myclabs/deep-copy/fixtures/f008/B.php b/vendor/myclabs/deep-copy/fixtures/f008/B.php new file mode 100644 index 0000000..6053092 --- /dev/null +++ b/vendor/myclabs/deep-copy/fixtures/f008/B.php @@ -0,0 +1,7 @@ + Filter, 'matcher' => Matcher] pairs. + */ + private $filters = []; + + /** + * Type Filters to apply. + * + * @var array Array of ['filter' => Filter, 'matcher' => Matcher] pairs. + */ + private $typeFilters = []; + + /** + * @var bool + */ + private $skipUncloneable = false; + + /** + * @var bool + */ + private $useCloneMethod; + + /** + * @param bool $useCloneMethod If set to true, when an object implements the __clone() function, it will be used + * instead of the regular deep cloning. + */ + public function __construct($useCloneMethod = false) + { + $this->useCloneMethod = $useCloneMethod; + + $this->addTypeFilter(new DateIntervalFilter(), new TypeMatcher(DateInterval::class)); + $this->addTypeFilter(new SplDoublyLinkedListFilter($this), new TypeMatcher(SplDoublyLinkedList::class)); + } + + /** + * If enabled, will not throw an exception when coming across an uncloneable property. + * + * @param $skipUncloneable + * + * @return $this + */ + public function skipUncloneable($skipUncloneable = true) + { + $this->skipUncloneable = $skipUncloneable; + + return $this; + } + + /** + * Deep copies the given object. + * + * @param mixed $object + * + * @return mixed + */ + public function copy($object) + { + $this->hashMap = []; + + return $this->recursiveCopy($object); + } + + public function addFilter(Filter $filter, Matcher $matcher) + { + $this->filters[] = [ + 'matcher' => $matcher, + 'filter' => $filter, + ]; + } + + public function addTypeFilter(TypeFilter $filter, TypeMatcher $matcher) + { + $this->typeFilters[] = [ + 'matcher' => $matcher, + 'filter' => $filter, + ]; + } + + private function recursiveCopy($var) + { + // Matches Type Filter + if ($filter = $this->getFirstMatchedTypeFilter($this->typeFilters, $var)) { + return $filter->apply($var); + } + + // Resource + if (is_resource($var)) { + return $var; + } + + // Array + if (is_array($var)) { + return $this->copyArray($var); + } + + // Scalar + if (! is_object($var)) { + return $var; + } + + // Object + return $this->copyObject($var); + } + + /** + * Copy an array + * @param array $array + * @return array + */ + private function copyArray(array $array) + { + foreach ($array as $key => $value) { + $array[$key] = $this->recursiveCopy($value); + } + + return $array; + } + + /** + * Copies an object. + * + * @param object $object + * + * @throws CloneException + * + * @return object + */ + private function copyObject($object) + { + $objectHash = spl_object_hash($object); + + if (isset($this->hashMap[$objectHash])) { + return $this->hashMap[$objectHash]; + } + + $reflectedObject = new ReflectionObject($object); + $isCloneable = $reflectedObject->isCloneable(); + + if (false === $isCloneable) { + if ($this->skipUncloneable) { + $this->hashMap[$objectHash] = $object; + + return $object; + } + + throw new CloneException( + sprintf( + 'The class "%s" is not cloneable.', + $reflectedObject->getName() + ) + ); + } + + $newObject = clone $object; + $this->hashMap[$objectHash] = $newObject; + + if ($this->useCloneMethod && $reflectedObject->hasMethod('__clone')) { + return $newObject; + } + + if ($newObject instanceof DateTimeInterface || $newObject instanceof DateTimeZone) { + return $newObject; + } + + foreach (ReflectionHelper::getProperties($reflectedObject) as $property) { + $this->copyObjectProperty($newObject, $property); + } + + return $newObject; + } + + private function copyObjectProperty($object, ReflectionProperty $property) + { + // Ignore static properties + if ($property->isStatic()) { + return; + } + + // Apply the filters + foreach ($this->filters as $item) { + /** @var Matcher $matcher */ + $matcher = $item['matcher']; + /** @var Filter $filter */ + $filter = $item['filter']; + + if ($matcher->matches($object, $property->getName())) { + $filter->apply( + $object, + $property->getName(), + function ($object) { + return $this->recursiveCopy($object); + } + ); + + // If a filter matches, we stop processing this property + return; + } + } + + $property->setAccessible(true); + $propertyValue = $property->getValue($object); + + // Copy the property + $property->setValue($object, $this->recursiveCopy($propertyValue)); + } + + /** + * Returns first filter that matches variable, `null` if no such filter found. + * + * @param array $filterRecords Associative array with 2 members: 'filter' with value of type {@see TypeFilter} and + * 'matcher' with value of type {@see TypeMatcher} + * @param mixed $var + * + * @return TypeFilter|null + */ + private function getFirstMatchedTypeFilter(array $filterRecords, $var) + { + $matched = $this->first( + $filterRecords, + function (array $record) use ($var) { + /* @var TypeMatcher $matcher */ + $matcher = $record['matcher']; + + return $matcher->matches($var); + } + ); + + return isset($matched) ? $matched['filter'] : null; + } + + /** + * Returns first element that matches predicate, `null` if no such element found. + * + * @param array $elements Array of ['filter' => Filter, 'matcher' => Matcher] pairs. + * @param callable $predicate Predicate arguments are: element. + * + * @return array|null Associative array with 2 members: 'filter' with value of type {@see TypeFilter} and 'matcher' + * with value of type {@see TypeMatcher} or `null`. + */ + private function first(array $elements, callable $predicate) + { + foreach ($elements as $element) { + if (call_user_func($predicate, $element)) { + return $element; + } + } + + return null; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Exception/CloneException.php b/vendor/myclabs/deep-copy/src/DeepCopy/Exception/CloneException.php new file mode 100644 index 0000000..c046706 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Exception/CloneException.php @@ -0,0 +1,9 @@ +setAccessible(true); + $oldCollection = $reflectionProperty->getValue($object); + + $newCollection = $oldCollection->map( + function ($item) use ($objectCopier) { + return $objectCopier($item); + } + ); + + $reflectionProperty->setValue($object, $newCollection); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php new file mode 100644 index 0000000..7b33fd5 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineEmptyCollectionFilter.php @@ -0,0 +1,28 @@ +setAccessible(true); + + $reflectionProperty->setValue($object, new ArrayCollection()); + } +} \ No newline at end of file diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php new file mode 100644 index 0000000..8bee8f7 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php @@ -0,0 +1,22 @@ +__load(); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Filter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Filter.php new file mode 100644 index 0000000..85ba18c --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Filter.php @@ -0,0 +1,18 @@ +callback = $callable; + } + + /** + * Replaces the object property by the result of the callback called with the object property. + * + * {@inheritdoc} + */ + public function apply($object, $property, $objectCopier) + { + $reflectionProperty = ReflectionHelper::getProperty($object, $property); + $reflectionProperty->setAccessible(true); + + $value = call_user_func($this->callback, $reflectionProperty->getValue($object)); + + $reflectionProperty->setValue($object, $value); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Filter/SetNullFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/SetNullFilter.php new file mode 100644 index 0000000..bea86b8 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Filter/SetNullFilter.php @@ -0,0 +1,24 @@ +setAccessible(true); + $reflectionProperty->setValue($object, null); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php new file mode 100644 index 0000000..ec8856f --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/Doctrine/DoctrineProxyMatcher.php @@ -0,0 +1,22 @@ +class = $class; + $this->property = $property; + } + + /** + * Matches a specific property of a specific class. + * + * {@inheritdoc} + */ + public function matches($object, $property) + { + return ($object instanceof $this->class) && $property == $this->property; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyNameMatcher.php b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyNameMatcher.php new file mode 100644 index 0000000..c8ec0d2 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyNameMatcher.php @@ -0,0 +1,32 @@ +property = $property; + } + + /** + * Matches a property by its name. + * + * {@inheritdoc} + */ + public function matches($object, $property) + { + return $property == $this->property; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyTypeMatcher.php b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyTypeMatcher.php new file mode 100644 index 0000000..a6b0c0b --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyTypeMatcher.php @@ -0,0 +1,46 @@ +propertyType = $propertyType; + } + + /** + * {@inheritdoc} + */ + public function matches($object, $property) + { + try { + $reflectionProperty = ReflectionHelper::getProperty($object, $property); + } catch (ReflectionException $exception) { + return false; + } + + $reflectionProperty->setAccessible(true); + + return $reflectionProperty->getValue($object) instanceof $this->propertyType; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/Reflection/ReflectionHelper.php b/vendor/myclabs/deep-copy/src/DeepCopy/Reflection/ReflectionHelper.php new file mode 100644 index 0000000..742410c --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/Reflection/ReflectionHelper.php @@ -0,0 +1,78 @@ +getProperties() does not return private properties from ancestor classes. + * + * @author muratyaman@gmail.com + * @see http://php.net/manual/en/reflectionclass.getproperties.php + * + * @param ReflectionClass $ref + * + * @return ReflectionProperty[] + */ + public static function getProperties(ReflectionClass $ref) + { + $props = $ref->getProperties(); + $propsArr = array(); + + foreach ($props as $prop) { + $propertyName = $prop->getName(); + $propsArr[$propertyName] = $prop; + } + + if ($parentClass = $ref->getParentClass()) { + $parentPropsArr = self::getProperties($parentClass); + foreach ($propsArr as $key => $property) { + $parentPropsArr[$key] = $property; + } + + return $parentPropsArr; + } + + return $propsArr; + } + + /** + * Retrieves property by name from object and all its ancestors. + * + * @param object|string $object + * @param string $name + * + * @throws PropertyException + * @throws ReflectionException + * + * @return ReflectionProperty + */ + public static function getProperty($object, $name) + { + $reflection = is_object($object) ? new ReflectionObject($object) : new ReflectionClass($object); + + if ($reflection->hasProperty($name)) { + return $reflection->getProperty($name); + } + + if ($parentClass = $reflection->getParentClass()) { + return self::getProperty($parentClass->getName(), $name); + } + + throw new PropertyException( + sprintf( + 'The class "%s" doesn\'t have a property with the given name: "%s".', + is_object($object) ? get_class($object) : $object, + $name + ) + ); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Date/DateIntervalFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Date/DateIntervalFilter.php new file mode 100644 index 0000000..becd1cf --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/Date/DateIntervalFilter.php @@ -0,0 +1,33 @@ + $propertyValue) { + $copy->{$propertyName} = $propertyValue; + } + + return $copy; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ReplaceFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ReplaceFilter.php new file mode 100644 index 0000000..164f8b8 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ReplaceFilter.php @@ -0,0 +1,30 @@ +callback = $callable; + } + + /** + * {@inheritdoc} + */ + public function apply($element) + { + return call_user_func($this->callback, $element); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ShallowCopyFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ShallowCopyFilter.php new file mode 100644 index 0000000..a5fbd7a --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ShallowCopyFilter.php @@ -0,0 +1,17 @@ +copier = $copier; + } + + /** + * {@inheritdoc} + */ + public function apply($element) + { + $newElement = clone $element; + + $copy = $this->createCopyClosure(); + + return $copy($newElement); + } + + private function createCopyClosure() + { + $copier = $this->copier; + + $copy = function (SplDoublyLinkedList $list) use ($copier) { + // Replace each element in the list with a deep copy of itself + for ($i = 1; $i <= $list->count(); $i++) { + $copy = $copier->recursiveCopy($list->shift()); + + $list->push($copy); + } + + return $list; + }; + + return Closure::bind($copy, null, DeepCopy::class); + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/TypeFilter.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/TypeFilter.php new file mode 100644 index 0000000..5785a7d --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/TypeFilter.php @@ -0,0 +1,13 @@ +type = $type; + } + + /** + * @param mixed $element + * + * @return boolean + */ + public function matches($element) + { + return is_object($element) ? is_a($element, $this->type) : gettype($element) === $this->type; + } +} diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php b/vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php new file mode 100644 index 0000000..55dcc92 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php @@ -0,0 +1,20 @@ +copy($value); + } +} diff --git a/vendor/nesbot/carbon/LICENSE b/vendor/nesbot/carbon/LICENSE new file mode 100644 index 0000000..6de45eb --- /dev/null +++ b/vendor/nesbot/carbon/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) Brian Nesbitt + +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/nesbot/carbon/composer.json b/vendor/nesbot/carbon/composer.json new file mode 100644 index 0000000..709ff4e --- /dev/null +++ b/vendor/nesbot/carbon/composer.json @@ -0,0 +1,63 @@ +{ + "name": "nesbot/carbon", + "type": "library", + "description": "A simple API extension for DateTime.", + "keywords": [ + "date", + "time", + "DateTime" + ], + "homepage": "http://carbon.nesbot.com", + "support": { + "issues": "https://github.com/briannesbitt/Carbon/issues", + "source": "https://github.com/briannesbitt/Carbon" + }, + "license": "MIT", + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "http://nesbot.com" + } + ], + "require": { + "php": ">=5.3.9", + "symfony/translation": "~2.6 || ~3.0 || ~4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7" + }, + "suggest": { + "friendsofphp/php-cs-fixer": "Needed for the `composer phpcs` command. Allow to automatically fix code style.", + "phpstan/phpstan": "Needed for the `composer phpstan` command. Allow to detect potential errors." + }, + "autoload": { + "psr-4": { + "": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + }, + "config": { + "sort-packages": true + }, + "scripts": { + "test": [ + "@phpunit", + "@phpcs" + ], + "phpunit": "phpunit --verbose --coverage-clover=coverage.xml", + "phpcs": "php-cs-fixer fix -v --diff --dry-run", + "phpstan": "phpstan analyse --configuration phpstan.neon --level 3 src tests" + }, + "extra": { + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + } + } +} diff --git a/vendor/nesbot/carbon/readme.md b/vendor/nesbot/carbon/readme.md new file mode 100644 index 0000000..5e9d1cc --- /dev/null +++ b/vendor/nesbot/carbon/readme.md @@ -0,0 +1,94 @@ +# Carbon + +[![Latest Stable Version](https://poser.pugx.org/nesbot/carbon/v/stable.png)](https://packagist.org/packages/nesbot/carbon) +[![Total Downloads](https://poser.pugx.org/nesbot/carbon/downloads.png)](https://packagist.org/packages/nesbot/carbon) +[![Build Status](https://travis-ci.org/briannesbitt/Carbon.svg?branch=master)](https://travis-ci.org/briannesbitt/Carbon) +[![StyleCI](https://styleci.io/repos/5724990/shield?style=flat)](https://styleci.io/repos/5724990) +[![codecov.io](https://codecov.io/github/briannesbitt/Carbon/coverage.svg?branch=master)](https://codecov.io/github/briannesbitt/Carbon?branch=master) +[![PHP-Eye](https://php-eye.com/badge/nesbot/carbon/tested.svg?style=flat)](https://php-eye.com/package/nesbot/carbon) +[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan) + +A simple PHP API extension for DateTime. [http://carbon.nesbot.com](http://carbon.nesbot.com) + +```php +use Carbon\Carbon; + +printf("Right now is %s", Carbon::now()->toDateTimeString()); +printf("Right now in Vancouver is %s", Carbon::now('America/Vancouver')); //implicit __toString() +$tomorrow = Carbon::now()->addDay(); +$lastWeek = Carbon::now()->subWeek(); +$nextSummerOlympics = Carbon::createFromDate(2016)->addYears(4); + +$officialDate = Carbon::now()->toRfc2822String(); + +$howOldAmI = Carbon::createFromDate(1975, 5, 21)->age; + +$noonTodayLondonTime = Carbon::createFromTime(12, 0, 0, 'Europe/London'); + +$internetWillBlowUpOn = Carbon::create(2038, 01, 19, 3, 14, 7, 'GMT'); + +// Don't really want this to happen so mock now +Carbon::setTestNow(Carbon::createFromDate(2000, 1, 1)); + +// comparisons are always done in UTC +if (Carbon::now()->gte($internetWillBlowUpOn)) { + die(); +} + +// Phew! Return to normal behaviour +Carbon::setTestNow(); + +if (Carbon::now()->isWeekend()) { + echo 'Party!'; +} +echo Carbon::now()->subMinutes(2)->diffForHumans(); // '2 minutes ago' + +// ... but also does 'from now', 'after' and 'before' +// rolling up to seconds, minutes, hours, days, months, years + +$daysSinceEpoch = Carbon::createFromTimestamp(0)->diffInDays(); +``` + +## Installation + +### With Composer + +``` +$ composer require nesbot/carbon +``` + +```json +{ + "require": { + "nesbot/carbon": "~1.21" + } +} +``` + +```php + + +### Without Composer + +Why are you not using [composer](http://getcomposer.org/)? Download [Carbon.php](https://github.com/briannesbitt/Carbon/blob/master/src/Carbon/Carbon.php) from the repo and save the file into your project path somewhere. + +```php + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use Carbon\Exceptions\InvalidDateException; +use Closure; +use DateInterval; +use DatePeriod; +use DateTime; +use DateTimeInterface; +use DateTimeZone; +use InvalidArgumentException; +use JsonSerializable; +use Symfony\Component\Translation\TranslatorInterface; + +/** + * A simple API extension for DateTime + * + * @property int $year + * @property int $yearIso + * @property int $month + * @property int $day + * @property int $hour + * @property int $minute + * @property int $second + * @property int $timestamp seconds since the Unix Epoch + * @property \DateTimeZone $timezone the current timezone + * @property \DateTimeZone $tz alias of timezone + * @property-read int $micro + * @property-read int $dayOfWeek 0 (for Sunday) through 6 (for Saturday) + * @property-read int $dayOfWeekIso 1 (for Monday) through 7 (for Sunday) + * @property-read int $dayOfYear 0 through 365 + * @property-read int $weekOfMonth 1 through 5 + * @property-read int $weekNumberInMonth 1 through 5 + * @property-read int $weekOfYear ISO-8601 week number of year, weeks starting on Monday + * @property-read int $daysInMonth number of days in the given month + * @property-read int $age does a diffInYears() with default parameters + * @property-read int $quarter the quarter of this instance, 1 - 4 + * @property-read int $offset the timezone offset in seconds from UTC + * @property-read int $offsetHours the timezone offset in hours from UTC + * @property-read bool $dst daylight savings time indicator, true if DST, false otherwise + * @property-read bool $local checks if the timezone is local, true if local, false otherwise + * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise + * @property-read string $timezoneName + * @property-read string $tzName + * @property-read string $englishDayOfWeek the day of week in English + * @property-read string $shortEnglishDayOfWeek the abbreviated day of week in English + * @property-read string $englishMonth the day of week in English + * @property-read string $shortEnglishMonth the abbreviated day of week in English + * @property-read string $localeDayOfWeek the day of week in current locale LC_TIME + * @property-read string $shortLocaleDayOfWeek the abbreviated day of week in current locale LC_TIME + * @property-read string $localeMonth the month in current locale LC_TIME + * @property-read string $shortLocaleMonth the abbreviated month in current locale LC_TIME + */ +class Carbon extends DateTime implements JsonSerializable +{ + const NO_ZERO_DIFF = 01; + const JUST_NOW = 02; + const ONE_DAY_WORDS = 04; + const TWO_DAY_WORDS = 010; + + /** + * The day constants. + */ + const SUNDAY = 0; + const MONDAY = 1; + const TUESDAY = 2; + const WEDNESDAY = 3; + const THURSDAY = 4; + const FRIDAY = 5; + const SATURDAY = 6; + + /** + * Names of days of the week. + * + * @var array + */ + protected static $days = array( + self::SUNDAY => 'Sunday', + self::MONDAY => 'Monday', + self::TUESDAY => 'Tuesday', + self::WEDNESDAY => 'Wednesday', + self::THURSDAY => 'Thursday', + self::FRIDAY => 'Friday', + self::SATURDAY => 'Saturday', + ); + + /** + * Number of X in Y. + */ + const YEARS_PER_CENTURY = 100; + const YEARS_PER_DECADE = 10; + const MONTHS_PER_YEAR = 12; + const MONTHS_PER_QUARTER = 3; + const WEEKS_PER_YEAR = 52; + const WEEKS_PER_MONTH = 4; + const DAYS_PER_WEEK = 7; + const HOURS_PER_DAY = 24; + const MINUTES_PER_HOUR = 60; + const SECONDS_PER_MINUTE = 60; + + /** + * RFC7231 DateTime format. + * + * @var string + */ + const RFC7231_FORMAT = 'D, d M Y H:i:s \G\M\T'; + + /** + * Default format to use for __toString method when type juggling occurs. + * + * @var string + */ + const DEFAULT_TO_STRING_FORMAT = 'Y-m-d H:i:s'; + + /** + * Format for converting mocked time, includes microseconds. + * + * @var string + */ + const MOCK_DATETIME_FORMAT = 'Y-m-d H:i:s.u'; + + /** + * Customizable PHP_INT_SIZE override. + * + * @var int + */ + public static $PHPIntSize = PHP_INT_SIZE; + + /** + * Format to use for __toString method when type juggling occurs. + * + * @var string + */ + protected static $toStringFormat = self::DEFAULT_TO_STRING_FORMAT; + + /** + * First day of week. + * + * @var int + */ + protected static $weekStartsAt = self::MONDAY; + + /** + * Last day of week. + * + * @var int + */ + protected static $weekEndsAt = self::SUNDAY; + + /** + * Days of weekend. + * + * @var array + */ + protected static $weekendDays = array( + self::SATURDAY, + self::SUNDAY, + ); + + /** + * Midday/noon hour. + * + * @var int + */ + protected static $midDayAt = 12; + + /** + * Format regex patterns. + * + * @var array + */ + protected static $regexFormats = array( + 'd' => '(3[01]|[12][0-9]|0[1-9])', + 'D' => '([a-zA-Z]{3})', + 'j' => '([123][0-9]|[1-9])', + 'l' => '([a-zA-Z]{2,})', + 'N' => '([1-7])', + 'S' => '([a-zA-Z]{2})', + 'w' => '([0-6])', + 'z' => '(36[0-5]|3[0-5][0-9]|[12][0-9]{2}|[1-9]?[0-9])', + 'W' => '(5[012]|[1-4][0-9]|[1-9])', + 'F' => '([a-zA-Z]{2,})', + 'm' => '(1[012]|0[1-9])', + 'M' => '([a-zA-Z]{3})', + 'n' => '(1[012]|[1-9])', + 't' => '(2[89]|3[01])', + 'L' => '(0|1)', + 'o' => '([1-9][0-9]{0,4})', + 'Y' => '([1-9]?[0-9]{4})', + 'y' => '([0-9]{2})', + 'a' => '(am|pm)', + 'A' => '(AM|PM)', + 'B' => '([0-9]{3})', + 'g' => '(1[012]|[1-9])', + 'G' => '(2[0-3]|1?[0-9])', + 'h' => '(1[012]|0[1-9])', + 'H' => '(2[0-3]|[01][0-9])', + 'i' => '([0-5][0-9])', + 's' => '([0-5][0-9])', + 'u' => '([0-9]{1,6})', + 'v' => '([0-9]{1,3})', + 'e' => '([a-zA-Z]{1,5})|([a-zA-Z]*\/[a-zA-Z]*)', + 'I' => '(0|1)', + 'O' => '([\+\-](1[012]|0[0-9])[0134][05])', + 'P' => '([\+\-](1[012]|0[0-9]):[0134][05])', + 'T' => '([a-zA-Z]{1,5})', + 'Z' => '(-?[1-5]?[0-9]{1,4})', + 'U' => '([0-9]*)', + + // The formats below are combinations of the above formats. + 'c' => '(([1-9]?[0-9]{4})\-(1[012]|0[1-9])\-(3[01]|[12][0-9]|0[1-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])[\+\-](1[012]|0[0-9]):([0134][05]))', // Y-m-dTH:i:sP + 'r' => '(([a-zA-Z]{3}), ([123][0-9]|[1-9]) ([a-zA-Z]{3}) ([1-9]?[0-9]{4}) (2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9]) [\+\-](1[012]|0[0-9])([0134][05]))', // D, j M Y H:i:s O + ); + + /** + * A test Carbon instance to be returned when now instances are created. + * + * @var \Carbon\Carbon + */ + protected static $testNow; + + /** + * A translator to ... er ... translate stuff. + * + * @var \Symfony\Component\Translation\TranslatorInterface + */ + protected static $translator; + + /** + * The errors that can occur. + * + * @var array + */ + protected static $lastErrors; + + /** + * The custom Carbon JSON serializer. + * + * @var callable|null + */ + protected static $serializer; + + /** + * The registered string macros. + * + * @var array + */ + protected static $localMacros = array(); + + /** + * Will UTF8 encoding be used to print localized date/time ? + * + * @var bool + */ + protected static $utf8 = false; + + /** + * Add microseconds to now on PHP < 7.1 and 7.1.3. true by default. + * + * @var bool + */ + protected static $microsecondsFallback = true; + + /** + * Indicates if months should be calculated with overflow. + * + * @var bool + */ + protected static $monthsOverflow = true; + + /** + * Indicates if years should be calculated with overflow. + * + * @var bool + */ + protected static $yearsOverflow = true; + + /** + * Indicates if years are compared with month by default so isSameMonth and isSameQuarter have $ofSameYear set + * to true by default. + * + * @var bool + */ + protected static $compareYearWithMonth = false; + + /** + * Options for diffForHumans(). + * + * @var int + */ + protected static $humanDiffOptions = self::NO_ZERO_DIFF; + + /** + * @param int $humanDiffOptions + */ + public static function setHumanDiffOptions($humanDiffOptions) + { + static::$humanDiffOptions = $humanDiffOptions; + } + + /** + * @param int $humanDiffOption + */ + public static function enableHumanDiffOption($humanDiffOption) + { + static::$humanDiffOptions = static::getHumanDiffOptions() | $humanDiffOption; + } + + /** + * @param int $humanDiffOption + */ + public static function disableHumanDiffOption($humanDiffOption) + { + static::$humanDiffOptions = static::getHumanDiffOptions() & ~$humanDiffOption; + } + + /** + * @return int + */ + public static function getHumanDiffOptions() + { + return static::$humanDiffOptions; + } + + /** + * Add microseconds to now on PHP < 7.1 and 7.1.3 if set to true, + * let microseconds to 0 on those PHP versions if false. + * + * @param bool $microsecondsFallback + */ + public static function useMicrosecondsFallback($microsecondsFallback = true) + { + static::$microsecondsFallback = $microsecondsFallback; + } + + /** + * Return true if microseconds fallback on PHP < 7.1 and 7.1.3 is + * enabled. false if disabled. + * + * @return bool + */ + public static function isMicrosecondsFallbackEnabled() + { + return static::$microsecondsFallback; + } + + /** + * Indicates if months should be calculated with overflow. + * + * @param bool $monthsOverflow + * + * @return void + */ + public static function useMonthsOverflow($monthsOverflow = true) + { + static::$monthsOverflow = $monthsOverflow; + } + + /** + * Reset the month overflow behavior. + * + * @return void + */ + public static function resetMonthsOverflow() + { + static::$monthsOverflow = true; + } + + /** + * Get the month overflow behavior. + * + * @return bool + */ + public static function shouldOverflowMonths() + { + return static::$monthsOverflow; + } + + /** + * Indicates if years should be calculated with overflow. + * + * @param bool $yearsOverflow + * + * @return void + */ + public static function useYearsOverflow($yearsOverflow = true) + { + static::$yearsOverflow = $yearsOverflow; + } + + /** + * Reset the month overflow behavior. + * + * @return void + */ + public static function resetYearsOverflow() + { + static::$yearsOverflow = true; + } + + /** + * Get the month overflow behavior. + * + * @return bool + */ + public static function shouldOverflowYears() + { + return static::$yearsOverflow; + } + + /** + * Get the month comparison default behavior. + * + * @return bool + */ + public static function compareYearWithMonth($compareYearWithMonth = true) + { + static::$compareYearWithMonth = $compareYearWithMonth; + } + + /** + * Get the month comparison default behavior. + * + * @return bool + */ + public static function shouldCompareYearWithMonth() + { + return static::$compareYearWithMonth; + } + + /** + * Creates a DateTimeZone from a string, DateTimeZone or integer offset. + * + * @param \DateTimeZone|string|int|null $object + * + * @throws \InvalidArgumentException + * + * @return \DateTimeZone + */ + protected static function safeCreateDateTimeZone($object) + { + if ($object === null) { + // Don't return null... avoid Bug #52063 in PHP <5.3.6 + return new DateTimeZone(date_default_timezone_get()); + } + + if ($object instanceof DateTimeZone) { + return $object; + } + + if (is_numeric($object)) { + $tzName = timezone_name_from_abbr(null, $object * 3600, true); + + if ($tzName === false) { + throw new InvalidArgumentException('Unknown or bad timezone ('.$object.')'); + } + + $object = $tzName; + } + + $tz = @timezone_open($object = (string) $object); + + if ($tz !== false) { + return $tz; + } + + // Work-around for a bug fixed in PHP 5.5.10 https://bugs.php.net/bug.php?id=45528 + // See: https://stackoverflow.com/q/14068594/2646927 + // @codeCoverageIgnoreStart + if (strpos($object, ':') !== false) { + try { + return static::createFromFormat('O', $object)->getTimezone(); + } catch (InvalidArgumentException $e) { + // + } + } + // @codeCoverageIgnoreEnd + + throw new InvalidArgumentException('Unknown or bad timezone ('.$object.')'); + } + + /////////////////////////////////////////////////////////////////// + //////////////////////////// CONSTRUCTORS ///////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Create a new Carbon instance. + * + * Please see the testing aids section (specifically static::setTestNow()) + * for more on the possibility of this constructor returning a test instance. + * + * @param string|null $time + * @param \DateTimeZone|string|null $tz + */ + public function __construct($time = null, $tz = null) + { + // If the class has a test now set and we are trying to create a now() + // instance then override as required + $isNow = empty($time) || $time === 'now'; + if (static::hasTestNow() && ($isNow || static::hasRelativeKeywords($time))) { + $testInstance = clone static::getTestNow(); + + //shift the time according to the given time zone + if ($tz !== null && $tz !== static::getTestNow()->getTimezone()) { + $testInstance->setTimezone($tz); + } else { + $tz = $testInstance->getTimezone(); + } + + if (static::hasRelativeKeywords($time)) { + $testInstance->modify($time); + } + + $time = $testInstance->format(static::MOCK_DATETIME_FORMAT); + } + + $timezone = static::safeCreateDateTimeZone($tz); + // @codeCoverageIgnoreStart + if ($isNow && !isset($testInstance) && static::isMicrosecondsFallbackEnabled() && ( + version_compare(PHP_VERSION, '7.1.0-dev', '<') + || + version_compare(PHP_VERSION, '7.1.3-dev', '>=') && version_compare(PHP_VERSION, '7.1.4-dev', '<') + ) + ) { + // Get microseconds from microtime() if "now" asked and PHP < 7.1 and PHP 7.1.3 if fallback enabled. + list($microTime, $timeStamp) = explode(' ', microtime()); + $dateTime = new DateTime('now', $timezone); + $dateTime->setTimestamp($timeStamp); // Use the timestamp returned by microtime as now can happen in the next second + $time = $dateTime->format(static::DEFAULT_TO_STRING_FORMAT).substr($microTime, 1, 7); + } + // @codeCoverageIgnoreEnd + + // Work-around for PHP bug https://bugs.php.net/bug.php?id=67127 + if (strpos((string) .1, '.') === false) { + $locale = setlocale(LC_NUMERIC, '0'); + setlocale(LC_NUMERIC, 'C'); + } + parent::__construct($time, $timezone); + if (isset($locale)) { + setlocale(LC_NUMERIC, $locale); + } + static::setLastErrors(parent::getLastErrors()); + } + + /** + * Create a Carbon instance from a DateTime one. + * + * @param \DateTime|\DateTimeInterface $date + * + * @return static + */ + public static function instance($date) + { + if ($date instanceof static) { + return clone $date; + } + + static::expectDateTime($date); + + return new static($date->format('Y-m-d H:i:s.u'), $date->getTimezone()); + } + + /** + * Create a carbon instance from a string. + * + * This is an alias for the constructor that allows better fluent syntax + * as it allows you to do Carbon::parse('Monday next week')->fn() rather + * than (new Carbon('Monday next week'))->fn(). + * + * @param string|null $time + * @param \DateTimeZone|string|null $tz + * + * @return static + */ + public static function parse($time = null, $tz = null) + { + return new static($time, $tz); + } + + /** + * Get a Carbon instance for the current date and time. + * + * @param \DateTimeZone|string|null $tz + * + * @return static + */ + public static function now($tz = null) + { + return new static(null, $tz); + } + + /** + * Create a Carbon instance for today. + * + * @param \DateTimeZone|string|null $tz + * + * @return static + */ + public static function today($tz = null) + { + return static::parse('today', $tz); + } + + /** + * Create a Carbon instance for tomorrow. + * + * @param \DateTimeZone|string|null $tz + * + * @return static + */ + public static function tomorrow($tz = null) + { + return static::parse('tomorrow', $tz); + } + + /** + * Create a Carbon instance for yesterday. + * + * @param \DateTimeZone|string|null $tz + * + * @return static + */ + public static function yesterday($tz = null) + { + return static::parse('yesterday', $tz); + } + + /** + * Create a Carbon instance for the greatest supported date. + * + * @return static + */ + public static function maxValue() + { + if (self::$PHPIntSize === 4) { + // 32 bit + return static::createFromTimestamp(PHP_INT_MAX); // @codeCoverageIgnore + } + + // 64 bit + return static::create(9999, 12, 31, 23, 59, 59); + } + + /** + * Create a Carbon instance for the lowest supported date. + * + * @return static + */ + public static function minValue() + { + if (self::$PHPIntSize === 4) { + // 32 bit + return static::createFromTimestamp(~PHP_INT_MAX); // @codeCoverageIgnore + } + + // 64 bit + return static::create(1, 1, 1, 0, 0, 0); + } + + /** + * Create a new Carbon instance from a specific date and time. + * + * If any of $year, $month or $day are set to null their now() values will + * be used. + * + * If $hour is null it will be set to its now() value and the default + * values for $minute and $second will be their now() values. + * + * If $hour is not null then the default values for $minute and $second + * will be 0. + * + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param \DateTimeZone|string|null $tz + * + * @throws \InvalidArgumentException + * + * @return static + */ + public static function create($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null) + { + $now = static::hasTestNow() ? static::getTestNow() : static::now($tz); + + $defaults = array_combine(array( + 'year', + 'month', + 'day', + 'hour', + 'minute', + 'second', + ), explode('-', $now->format('Y-n-j-G-i-s'))); + + $year = $year === null ? $defaults['year'] : $year; + $month = $month === null ? $defaults['month'] : $month; + $day = $day === null ? $defaults['day'] : $day; + + if ($hour === null) { + $hour = $defaults['hour']; + $minute = $minute === null ? $defaults['minute'] : $minute; + $second = $second === null ? $defaults['second'] : $second; + } else { + $minute = $minute === null ? 0 : $minute; + $second = $second === null ? 0 : $second; + } + + $fixYear = null; + + if ($year < 0) { + $fixYear = $year; + $year = 0; + } elseif ($year > 9999) { + $fixYear = $year - 9999; + $year = 9999; + } + + $instance = static::createFromFormat('!Y-n-j G:i:s', sprintf('%s-%s-%s %s:%02s:%02s', $year, $month, $day, $hour, $minute, $second), $tz); + + if ($fixYear !== null) { + $instance->addYears($fixYear); + } + + return $instance; + } + + /** + * Create a new safe Carbon instance from a specific date and time. + * + * If any of $year, $month or $day are set to null their now() values will + * be used. + * + * If $hour is null it will be set to its now() value and the default + * values for $minute and $second will be their now() values. + * + * If $hour is not null then the default values for $minute and $second + * will be 0. + * + * If one of the set values is not valid, an \InvalidArgumentException + * will be thrown. + * + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param \DateTimeZone|string|null $tz + * + * @throws \Carbon\Exceptions\InvalidDateException|\InvalidArgumentException + * + * @return static + */ + public static function createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null) + { + $fields = array( + 'year' => array(0, 9999), + 'month' => array(0, 12), + 'day' => array(0, 31), + 'hour' => array(0, 24), + 'minute' => array(0, 59), + 'second' => array(0, 59), + ); + + foreach ($fields as $field => $range) { + if ($$field !== null && (!is_int($$field) || $$field < $range[0] || $$field > $range[1])) { + throw new InvalidDateException($field, $$field); + } + } + + $instance = static::create($year, $month, $day, $hour, $minute, $second, $tz); + + foreach (array_reverse($fields) as $field => $range) { + if ($$field !== null && (!is_int($$field) || $$field !== $instance->$field)) { + throw new InvalidDateException($field, $$field); + } + } + + return $instance; + } + + /** + * Create a Carbon instance from just a date. The time portion is set to now. + * + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param \DateTimeZone|string|null $tz + * + * @throws \InvalidArgumentException + * + * @return static + */ + public static function createFromDate($year = null, $month = null, $day = null, $tz = null) + { + return static::create($year, $month, $day, null, null, null, $tz); + } + + /** + * Create a Carbon instance from just a date. The time portion is set to midnight. + * + * @param int|null $year + * @param int|null $month + * @param int|null $day + * @param \DateTimeZone|string|null $tz + * + * @return static + */ + public static function createMidnightDate($year = null, $month = null, $day = null, $tz = null) + { + return static::create($year, $month, $day, 0, 0, 0, $tz); + } + + /** + * Create a Carbon instance from just a time. The date portion is set to today. + * + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param \DateTimeZone|string|null $tz + * + * @throws \InvalidArgumentException + * + * @return static + */ + public static function createFromTime($hour = null, $minute = null, $second = null, $tz = null) + { + return static::create(null, null, null, $hour, $minute, $second, $tz); + } + + /** + * Create a Carbon instance from a time string. The date portion is set to today. + * + * @param string $time + * @param \DateTimeZone|string|null $tz + * + * @throws \InvalidArgumentException + * + * @return static + */ + public static function createFromTimeString($time, $tz = null) + { + return static::today($tz)->setTimeFromTimeString($time); + } + + private static function createFromFormatAndTimezone($format, $time, $tz) + { + return $tz !== null + ? parent::createFromFormat($format, $time, static::safeCreateDateTimeZone($tz)) + : parent::createFromFormat($format, $time); + } + + /** + * Create a Carbon instance from a specific format. + * + * @param string $format Datetime format + * @param string $time + * @param \DateTimeZone|string|null $tz + * + * @throws InvalidArgumentException + * + * @return static + */ + public static function createFromFormat($format, $time, $tz = null) + { + // First attempt to create an instance, so that error messages are based on the unmodified format. + $date = self::createFromFormatAndTimezone($format, $time, $tz); + $lastErrors = parent::getLastErrors(); + + if (($mock = static::getTestNow()) && ($date instanceof DateTime || $date instanceof DateTimeInterface)) { + // Set timezone from mock if custom timezone was neither given directly nor as a part of format. + // First let's skip the part that will be ignored by the parser. + $nonEscaped = '(?getTimezone(); + } + + // Prepend mock datetime only if the format does not contain non escaped unix epoch reset flag. + if (!preg_match("/{$nonEscaped}[!|]/", $format)) { + $format = static::MOCK_DATETIME_FORMAT.' '.$format; + $time = $mock->format(static::MOCK_DATETIME_FORMAT).' '.$time; + } + + // Regenerate date from the modified format to base result on the mocked instance instead of now. + $date = self::createFromFormatAndTimezone($format, $time, $tz); + } + + if ($date instanceof DateTime || $date instanceof DateTimeInterface) { + $instance = static::instance($date); + $instance::setLastErrors($lastErrors); + + return $instance; + } + + throw new InvalidArgumentException(implode(PHP_EOL, $lastErrors['errors'])); + } + + /** + * Set last errors. + * + * @param array $lastErrors + * + * @return void + */ + private static function setLastErrors(array $lastErrors) + { + static::$lastErrors = $lastErrors; + } + + /** + * {@inheritdoc} + */ + public static function getLastErrors() + { + return static::$lastErrors; + } + + /** + * Create a Carbon instance from a timestamp. + * + * @param int $timestamp + * @param \DateTimeZone|string|null $tz + * + * @return static + */ + public static function createFromTimestamp($timestamp, $tz = null) + { + return static::today($tz)->setTimestamp($timestamp); + } + + /** + * Create a Carbon instance from a timestamp in milliseconds. + * + * @param int $timestamp + * @param \DateTimeZone|string|null $tz + * + * @return static + */ + public static function createFromTimestampMs($timestamp, $tz = null) + { + return static::createFromFormat('U.u', sprintf('%F', $timestamp / 1000)) + ->setTimezone($tz); + } + + /** + * Create a Carbon instance from an UTC timestamp. + * + * @param int $timestamp + * + * @return static + */ + public static function createFromTimestampUTC($timestamp) + { + return new static('@'.$timestamp); + } + + /** + * Make a Carbon instance from given variable if possible. + * + * Always return a new instance. Parse only strings and only these likely to be dates (skip intervals + * and recurrences). Throw an exception for invalid format, but otherwise return null. + * + * @param mixed $var + * + * @return static|null + */ + public static function make($var) + { + if ($var instanceof DateTime || $var instanceof DateTimeInterface) { + return static::instance($var); + } + + if (is_string($var)) { + $var = trim($var); + $first = substr($var, 0, 1); + + if (is_string($var) && $first !== 'P' && $first !== 'R' && preg_match('/[a-z0-9]/i', $var)) { + return static::parse($var); + } + } + } + + /** + * Get a copy of the instance. + * + * @return static + */ + public function copy() + { + return clone $this; + } + + /** + * Returns a present instance in the same timezone. + * + * @return static + */ + public function nowWithSameTz() + { + return static::now($this->getTimezone()); + } + + /** + * Throws an exception if the given object is not a DateTime and does not implement DateTimeInterface + * and not in $other. + * + * @param mixed $date + * @param string|array $other + * + * @throws \InvalidArgumentException + */ + protected static function expectDateTime($date, $other = array()) + { + $message = 'Expected '; + foreach ((array) $other as $expect) { + $message .= "{$expect}, "; + } + + if (!$date instanceof DateTime && !$date instanceof DateTimeInterface) { + throw new InvalidArgumentException( + $message.'DateTime or DateTimeInterface, '. + (is_object($date) ? get_class($date) : gettype($date)).' given' + ); + } + } + + /** + * Return the Carbon instance passed through, a now instance in the same timezone + * if null given or parse the input if string given. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * + * @return static + */ + protected function resolveCarbon($date = null) + { + if (!$date) { + return $this->nowWithSameTz(); + } + + if (is_string($date)) { + return static::parse($date, $this->getTimezone()); + } + + static::expectDateTime($date, array('null', 'string')); + + return $date instanceof self ? $date : static::instance($date); + } + + /////////////////////////////////////////////////////////////////// + ///////////////////////// GETTERS AND SETTERS ///////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Get a part of the Carbon object + * + * @param string $name + * + * @throws \InvalidArgumentException + * + * @return string|int|bool|\DateTimeZone + */ + public function __get($name) + { + static $formats = array( + 'year' => 'Y', + 'yearIso' => 'o', + 'month' => 'n', + 'day' => 'j', + 'hour' => 'G', + 'minute' => 'i', + 'second' => 's', + 'micro' => 'u', + 'dayOfWeek' => 'w', + 'dayOfWeekIso' => 'N', + 'dayOfYear' => 'z', + 'weekOfYear' => 'W', + 'daysInMonth' => 't', + 'timestamp' => 'U', + 'englishDayOfWeek' => 'l', + 'shortEnglishDayOfWeek' => 'D', + 'englishMonth' => 'F', + 'shortEnglishMonth' => 'M', + 'localeDayOfWeek' => '%A', + 'shortLocaleDayOfWeek' => '%a', + 'localeMonth' => '%B', + 'shortLocaleMonth' => '%b', + ); + + switch (true) { + case isset($formats[$name]): + $format = $formats[$name]; + $method = substr($format, 0, 1) === '%' ? 'formatLocalized' : 'format'; + $value = $this->$method($format); + + return is_numeric($value) ? (int) $value : $value; + + case $name === 'weekOfMonth': + return (int) ceil($this->day / static::DAYS_PER_WEEK); + + case $name === 'weekNumberInMonth': + return (int) ceil(($this->day + $this->copy()->startOfMonth()->dayOfWeek - 1) / static::DAYS_PER_WEEK); + + case $name === 'age': + return $this->diffInYears(); + + case $name === 'quarter': + return (int) ceil($this->month / static::MONTHS_PER_QUARTER); + + case $name === 'offset': + return $this->getOffset(); + + case $name === 'offsetHours': + return $this->getOffset() / static::SECONDS_PER_MINUTE / static::MINUTES_PER_HOUR; + + case $name === 'dst': + return $this->format('I') === '1'; + + case $name === 'local': + return $this->getOffset() === $this->copy()->setTimezone(date_default_timezone_get())->getOffset(); + + case $name === 'utc': + return $this->getOffset() === 0; + + case $name === 'timezone' || $name === 'tz': + return $this->getTimezone(); + + case $name === 'timezoneName' || $name === 'tzName': + return $this->getTimezone()->getName(); + + default: + throw new InvalidArgumentException(sprintf("Unknown getter '%s'", $name)); + } + } + + /** + * Check if an attribute exists on the object + * + * @param string $name + * + * @return bool + */ + public function __isset($name) + { + try { + $this->__get($name); + } catch (InvalidArgumentException $e) { + return false; + } + + return true; + } + + /** + * Set a part of the Carbon object + * + * @param string $name + * @param string|int|\DateTimeZone $value + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function __set($name, $value) + { + switch ($name) { + case 'year': + case 'month': + case 'day': + case 'hour': + case 'minute': + case 'second': + list($year, $month, $day, $hour, $minute, $second) = explode('-', $this->format('Y-n-j-G-i-s')); + $$name = $value; + $this->setDateTime($year, $month, $day, $hour, $minute, $second); + break; + + case 'timestamp': + parent::setTimestamp($value); + break; + + case 'timezone': + case 'tz': + $this->setTimezone($value); + break; + + default: + throw new InvalidArgumentException(sprintf("Unknown setter '%s'", $name)); + } + } + + /** + * Set the instance's year + * + * @param int $value + * + * @return static + */ + public function year($value) + { + $this->year = $value; + + return $this; + } + + /** + * Set the instance's month + * + * @param int $value + * + * @return static + */ + public function month($value) + { + $this->month = $value; + + return $this; + } + + /** + * Set the instance's day + * + * @param int $value + * + * @return static + */ + public function day($value) + { + $this->day = $value; + + return $this; + } + + /** + * Set the instance's hour + * + * @param int $value + * + * @return static + */ + public function hour($value) + { + $this->hour = $value; + + return $this; + } + + /** + * Set the instance's minute + * + * @param int $value + * + * @return static + */ + public function minute($value) + { + $this->minute = $value; + + return $this; + } + + /** + * Set the instance's second + * + * @param int $value + * + * @return static + */ + public function second($value) + { + $this->second = $value; + + return $this; + } + + /** + * Sets the current date of the DateTime object to a different date. + * Calls modify as a workaround for a php bug + * + * @param int $year + * @param int $month + * @param int $day + * + * @return static + * + * @see https://github.com/briannesbitt/Carbon/issues/539 + * @see https://bugs.php.net/bug.php?id=63863 + */ + public function setDate($year, $month, $day) + { + $this->modify('+0 day'); + + return parent::setDate($year, $month, $day); + } + + /** + * Set the date and time all together + * + * @param int $year + * @param int $month + * @param int $day + * @param int $hour + * @param int $minute + * @param int $second + * + * @return static + */ + public function setDateTime($year, $month, $day, $hour, $minute, $second = 0) + { + return $this->setDate($year, $month, $day)->setTime($hour, $minute, $second); + } + + /** + * Set the time by time string + * + * @param string $time + * + * @return static + */ + public function setTimeFromTimeString($time) + { + if (strpos($time, ':') === false) { + $time .= ':0'; + } + + return $this->modify($time); + } + + /** + * Set the instance's timestamp + * + * @param int $value + * + * @return static + */ + public function timestamp($value) + { + return $this->setTimestamp($value); + } + + /** + * Alias for setTimezone() + * + * @param \DateTimeZone|string $value + * + * @return static + */ + public function timezone($value) + { + return $this->setTimezone($value); + } + + /** + * Alias for setTimezone() + * + * @param \DateTimeZone|string $value + * + * @return static + */ + public function tz($value) + { + return $this->setTimezone($value); + } + + /** + * Set the instance's timezone from a string or object + * + * @param \DateTimeZone|string $value + * + * @return static + */ + public function setTimezone($value) + { + parent::setTimezone(static::safeCreateDateTimeZone($value)); + // https://bugs.php.net/bug.php?id=72338 + // just workaround on this bug + $this->getTimestamp(); + + return $this; + } + + /** + * Set the year, month, and date for this instance to that of the passed instance. + * + * @param \Carbon\Carbon|\DateTimeInterface $date + * + * @return static + */ + public function setDateFrom($date) + { + $date = static::instance($date); + + $this->setDate($date->year, $date->month, $date->day); + + return $this; + } + + /** + * Set the hour, day, and time for this instance to that of the passed instance. + * + * @param \Carbon\Carbon|\DateTimeInterface $date + * + * @return static + */ + public function setTimeFrom($date) + { + $date = static::instance($date); + + $this->setTime($date->hour, $date->minute, $date->second); + + return $this; + } + + /** + * Get the days of the week + * + * @return array + */ + public static function getDays() + { + return static::$days; + } + + /////////////////////////////////////////////////////////////////// + /////////////////////// WEEK SPECIAL DAYS ///////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Get the first day of week + * + * @return int + */ + public static function getWeekStartsAt() + { + return static::$weekStartsAt; + } + + /** + * Set the first day of week + * + * @param int $day week start day + * + * @throws InvalidArgumentException + * + * @return void + */ + public static function setWeekStartsAt($day) + { + if ($day > static::SATURDAY || $day < static::SUNDAY) { + throw new InvalidArgumentException('Day of a week should be greater than or equal to 0 and less than or equal to 6.'); + } + + static::$weekStartsAt = $day; + } + + /** + * Get the last day of week + * + * @return int + */ + public static function getWeekEndsAt() + { + return static::$weekEndsAt; + } + + /** + * Set the last day of week + * + * @param int $day + * + * @throws InvalidArgumentException + * + * @return void + */ + public static function setWeekEndsAt($day) + { + if ($day > static::SATURDAY || $day < static::SUNDAY) { + throw new InvalidArgumentException('Day of a week should be greater than or equal to 0 and less than or equal to 6.'); + } + + static::$weekEndsAt = $day; + } + + /** + * Get weekend days + * + * @return array + */ + public static function getWeekendDays() + { + return static::$weekendDays; + } + + /** + * Set weekend days + * + * @param array $days + * + * @return void + */ + public static function setWeekendDays($days) + { + static::$weekendDays = $days; + } + + /** + * get midday/noon hour + * + * @return int + */ + public static function getMidDayAt() + { + return static::$midDayAt; + } + + /** + * Set midday/noon hour + * + * @param int $hour midday hour + * + * @return void + */ + public static function setMidDayAt($hour) + { + static::$midDayAt = $hour; + } + + /////////////////////////////////////////////////////////////////// + ///////////////////////// TESTING AIDS //////////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Set a Carbon instance (real or mock) to be returned when a "now" + * instance is created. The provided instance will be returned + * specifically under the following conditions: + * - A call to the static now() method, ex. Carbon::now() + * - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null) + * - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now') + * - When a string containing the desired time is passed to Carbon::parse(). + * + * Note the timezone parameter was left out of the examples above and + * has no affect as the mock value will be returned regardless of its value. + * + * To clear the test instance call this method using the default + * parameter of null. + * + * @param \Carbon\Carbon|null $testNow real or mock Carbon instance + * @param \Carbon\Carbon|string|null $testNow + */ + public static function setTestNow($testNow = null) + { + static::$testNow = is_string($testNow) ? static::parse($testNow) : $testNow; + } + + /** + * Get the Carbon instance (real or mock) to be returned when a "now" + * instance is created. + * + * @return static the current instance used for testing + */ + public static function getTestNow() + { + return static::$testNow; + } + + /** + * Determine if there is a valid test instance set. A valid test instance + * is anything that is not null. + * + * @return bool true if there is a test instance, otherwise false + */ + public static function hasTestNow() + { + return static::getTestNow() !== null; + } + + /** + * Determine if a time string will produce a relative date. + * + * @param string $time + * + * @return bool true if time match a relative date, false if absolute or invalid time string + */ + public static function hasRelativeKeywords($time) + { + if (strtotime($time) === false) { + return false; + } + + $date1 = new DateTime('2000-01-01T00:00:00Z'); + $date1->modify($time); + $date2 = new DateTime('2001-12-25T00:00:00Z'); + $date2->modify($time); + + return $date1 != $date2; + } + + /////////////////////////////////////////////////////////////////// + /////////////////////// LOCALIZATION ////////////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Initialize the translator instance if necessary. + * + * @return \Symfony\Component\Translation\TranslatorInterface + */ + protected static function translator() + { + if (static::$translator === null) { + static::$translator = Translator::get(); + } + + return static::$translator; + } + + /** + * Get the translator instance in use + * + * @return \Symfony\Component\Translation\TranslatorInterface + */ + public static function getTranslator() + { + return static::translator(); + } + + /** + * Set the translator instance to use + * + * @param \Symfony\Component\Translation\TranslatorInterface $translator + * + * @return void + */ + public static function setTranslator(TranslatorInterface $translator) + { + static::$translator = $translator; + } + + /** + * Get the current translator locale + * + * @return string + */ + public static function getLocale() + { + return static::translator()->getLocale(); + } + + /** + * Set the current translator locale and indicate if the source locale file exists + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function setLocale($locale) + { + return static::translator()->setLocale($locale) !== false; + } + + /** + * Set the current locale to the given, execute the passed function, reset the locale to previous one, + * then return the result of the closure (or null if the closure was void). + * + * @param string $locale locale ex. en + * + * @return mixed + */ + public static function executeWithLocale($locale, $func) + { + $currentLocale = static::getLocale(); + $result = call_user_func($func, static::setLocale($locale) ? static::getLocale() : false, static::translator()); + static::setLocale($currentLocale); + + return $result; + } + + /** + * Returns true if the given locale is internally supported and has short-units support. + * Support is considered enabled if either year, day or hour has a short variant translated. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasShortUnits($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + ( + ($y = $translator->trans('y')) !== 'y' && + $y !== $translator->trans('year') + ) || ( + ($y = $translator->trans('d')) !== 'd' && + $y !== $translator->trans('day') + ) || ( + ($y = $translator->trans('h')) !== 'h' && + $y !== $translator->trans('hour') + ); + }); + } + + /** + * Returns true if the given locale is internally supported and has diff syntax support (ago, from now, before, after). + * Support is considered enabled if the 4 sentences are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasDiffSyntax($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + $translator->trans('ago') !== 'ago' && + $translator->trans('from_now') !== 'from_now' && + $translator->trans('before') !== 'before' && + $translator->trans('after') !== 'after'; + }); + } + + /** + * Returns true if the given locale is internally supported and has words for 1-day diff (just now, yesterday, tomorrow). + * Support is considered enabled if the 3 words are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasDiffOneDayWords($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + $translator->trans('diff_now') !== 'diff_now' && + $translator->trans('diff_yesterday') !== 'diff_yesterday' && + $translator->trans('diff_tomorrow') !== 'diff_tomorrow'; + }); + } + + /** + * Returns true if the given locale is internally supported and has words for 2-days diff (before yesterday, after tomorrow). + * Support is considered enabled if the 2 words are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasDiffTwoDayWords($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + $translator->trans('diff_before_yesterday') !== 'diff_before_yesterday' && + $translator->trans('diff_after_tomorrow') !== 'diff_after_tomorrow'; + }); + } + + /** + * Returns true if the given locale is internally supported and has period syntax support (X times, every X, from X, to X). + * Support is considered enabled if the 4 sentences are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasPeriodSyntax($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + $translator->trans('period_recurrences') !== 'period_recurrences' && + $translator->trans('period_interval') !== 'period_interval' && + $translator->trans('period_start_date') !== 'period_start_date' && + $translator->trans('period_end_date') !== 'period_end_date'; + }); + } + + /** + * Returns the list of internally available locales and already loaded custom locales. + * (It will ignore custom translator dynamic loading.) + * + * @return array + */ + public static function getAvailableLocales() + { + $translator = static::translator(); + $locales = array(); + if ($translator instanceof Translator) { + foreach (glob(__DIR__.'/Lang/*.php') as $file) { + $locales[] = substr($file, strrpos($file, '/') + 1, -4); + } + + $locales = array_unique(array_merge($locales, array_keys($translator->getMessages()))); + } + + return $locales; + } + + /////////////////////////////////////////////////////////////////// + /////////////////////// STRING FORMATTING ///////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Set if UTF8 will be used for localized date/time + * + * @param bool $utf8 + */ + public static function setUtf8($utf8) + { + static::$utf8 = $utf8; + } + + /** + * Format the instance with the current locale. You can set the current + * locale using setlocale() http://php.net/setlocale. + * + * @param string $format + * + * @return string + */ + public function formatLocalized($format) + { + // Check for Windows to find and replace the %e modifier correctly. + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $format = preg_replace('#(?toDateTimeString())); + + return static::$utf8 ? utf8_encode($formatted) : $formatted; + } + + /** + * Reset the format used to the default when type juggling a Carbon instance to a string + * + * @return void + */ + public static function resetToStringFormat() + { + static::setToStringFormat(static::DEFAULT_TO_STRING_FORMAT); + } + + /** + * Set the default format used when type juggling a Carbon instance to a string + * + * @param string|Closure $format + * + * @return void + */ + public static function setToStringFormat($format) + { + static::$toStringFormat = $format; + } + + /** + * Format the instance as a string using the set format + * + * @return string + */ + public function __toString() + { + $format = static::$toStringFormat; + + return $this->format($format instanceof Closure ? $format($this) : $format); + } + + /** + * Format the instance as date + * + * @return string + */ + public function toDateString() + { + return $this->format('Y-m-d'); + } + + /** + * Format the instance as a readable date + * + * @return string + */ + public function toFormattedDateString() + { + return $this->format('M j, Y'); + } + + /** + * Format the instance as time + * + * @return string + */ + public function toTimeString() + { + return $this->format('H:i:s'); + } + + /** + * Format the instance as date and time + * + * @return string + */ + public function toDateTimeString() + { + return $this->format('Y-m-d H:i:s'); + } + + /** + * Format the instance with day, date and time + * + * @return string + */ + public function toDayDateTimeString() + { + return $this->format('D, M j, Y g:i A'); + } + + /** + * Format the instance as ATOM + * + * @return string + */ + public function toAtomString() + { + return $this->format(static::ATOM); + } + + /** + * Format the instance as COOKIE + * + * @return string + */ + public function toCookieString() + { + return $this->format(static::COOKIE); + } + + /** + * Format the instance as ISO8601 + * + * @return string + */ + public function toIso8601String() + { + return $this->toAtomString(); + } + + /** + * Format the instance as RFC822 + * + * @return string + */ + public function toRfc822String() + { + return $this->format(static::RFC822); + } + + /** + * Convert the instance to UTC and return as Zulu ISO8601 + * + * @return string + */ + public function toIso8601ZuluString() + { + return $this->copy()->setTimezone('UTC')->format('Y-m-d\TH:i:s\Z'); + } + + /** + * Format the instance as RFC850 + * + * @return string + */ + public function toRfc850String() + { + return $this->format(static::RFC850); + } + + /** + * Format the instance as RFC1036 + * + * @return string + */ + public function toRfc1036String() + { + return $this->format(static::RFC1036); + } + + /** + * Format the instance as RFC1123 + * + * @return string + */ + public function toRfc1123String() + { + return $this->format(static::RFC1123); + } + + /** + * Format the instance as RFC2822 + * + * @return string + */ + public function toRfc2822String() + { + return $this->format(static::RFC2822); + } + + /** + * Format the instance as RFC3339 + * + * @return string + */ + public function toRfc3339String() + { + return $this->format(static::RFC3339); + } + + /** + * Format the instance as RSS + * + * @return string + */ + public function toRssString() + { + return $this->format(static::RSS); + } + + /** + * Format the instance as W3C + * + * @return string + */ + public function toW3cString() + { + return $this->format(static::W3C); + } + + /** + * Format the instance as RFC7231 + * + * @return string + */ + public function toRfc7231String() + { + return $this->copy() + ->setTimezone('GMT') + ->format(static::RFC7231_FORMAT); + } + + /** + * Get default array representation + * + * @return array + */ + public function toArray() + { + return array( + 'year' => $this->year, + 'month' => $this->month, + 'day' => $this->day, + 'dayOfWeek' => $this->dayOfWeek, + 'dayOfYear' => $this->dayOfYear, + 'hour' => $this->hour, + 'minute' => $this->minute, + 'second' => $this->second, + 'micro' => $this->micro, + 'timestamp' => $this->timestamp, + 'formatted' => $this->format(self::DEFAULT_TO_STRING_FORMAT), + 'timezone' => $this->timezone, + ); + } + + /////////////////////////////////////////////////////////////////// + ////////////////////////// COMPARISONS //////////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Determines if the instance is equal to another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function eq($date) + { + return $this == $date; + } + + /** + * Determines if the instance is equal to another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see eq() + * + * @return bool + */ + public function equalTo($date) + { + return $this->eq($date); + } + + /** + * Determines if the instance is not equal to another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function ne($date) + { + return !$this->eq($date); + } + + /** + * Determines if the instance is not equal to another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see ne() + * + * @return bool + */ + public function notEqualTo($date) + { + return $this->ne($date); + } + + /** + * Determines if the instance is greater (after) than another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function gt($date) + { + return $this > $date; + } + + /** + * Determines if the instance is greater (after) than another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see gt() + * + * @return bool + */ + public function greaterThan($date) + { + return $this->gt($date); + } + + /** + * Determines if the instance is greater (after) than or equal to another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function gte($date) + { + return $this >= $date; + } + + /** + * Determines if the instance is greater (after) than or equal to another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see gte() + * + * @return bool + */ + public function greaterThanOrEqualTo($date) + { + return $this->gte($date); + } + + /** + * Determines if the instance is less (before) than another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function lt($date) + { + return $this < $date; + } + + /** + * Determines if the instance is less (before) than another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see lt() + * + * @return bool + */ + public function lessThan($date) + { + return $this->lt($date); + } + + /** + * Determines if the instance is less (before) or equal to another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @return bool + */ + public function lte($date) + { + return $this <= $date; + } + + /** + * Determines if the instance is less (before) or equal to another + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see lte() + * + * @return bool + */ + public function lessThanOrEqualTo($date) + { + return $this->lte($date); + } + + /** + * Determines if the instance is between two others + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * @param bool $equal Indicates if an equal to comparison should be done + * + * @return bool + */ + public function between($date1, $date2, $equal = true) + { + if ($date1->gt($date2)) { + $temp = $date1; + $date1 = $date2; + $date2 = $temp; + } + + if ($equal) { + return $this->gte($date1) && $this->lte($date2); + } + + return $this->gt($date1) && $this->lt($date2); + } + + protected function floatDiffInSeconds($date) + { + $date = $this->resolveCarbon($date); + + return abs($this->diffInRealSeconds($date, false) + ($date->micro - $this->micro) / 1000000); + } + + /** + * Get the closest date from the instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * + * @return static + */ + public function closest($date1, $date2) + { + return $this->floatDiffInSeconds($date1) < $this->floatDiffInSeconds($date2) ? $date1 : $date2; + } + + /** + * Get the farthest date from the instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 + * + * @return static + */ + public function farthest($date1, $date2) + { + return $this->floatDiffInSeconds($date1) > $this->floatDiffInSeconds($date2) ? $date1 : $date2; + } + + /** + * Get the minimum instance between a given instance (default now) and the current instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * + * @return static + */ + public function min($date = null) + { + $date = $this->resolveCarbon($date); + + return $this->lt($date) ? $this : $date; + } + + /** + * Get the minimum instance between a given instance (default now) and the current instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see min() + * + * @return static + */ + public function minimum($date = null) + { + return $this->min($date); + } + + /** + * Get the maximum instance between a given instance (default now) and the current instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * + * @return static + */ + public function max($date = null) + { + $date = $this->resolveCarbon($date); + + return $this->gt($date) ? $this : $date; + } + + /** + * Get the maximum instance between a given instance (default now) and the current instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * + * @see max() + * + * @return static + */ + public function maximum($date = null) + { + return $this->max($date); + } + + /** + * Determines if the instance is a weekday. + * + * @return bool + */ + public function isWeekday() + { + return !$this->isWeekend(); + } + + /** + * Determines if the instance is a weekend day. + * + * @return bool + */ + public function isWeekend() + { + return in_array($this->dayOfWeek, static::$weekendDays); + } + + /** + * Determines if the instance is yesterday. + * + * @return bool + */ + public function isYesterday() + { + return $this->toDateString() === static::yesterday($this->getTimezone())->toDateString(); + } + + /** + * Determines if the instance is today. + * + * @return bool + */ + public function isToday() + { + return $this->toDateString() === $this->nowWithSameTz()->toDateString(); + } + + /** + * Determines if the instance is tomorrow. + * + * @return bool + */ + public function isTomorrow() + { + return $this->toDateString() === static::tomorrow($this->getTimezone())->toDateString(); + } + + /** + * Determines if the instance is within the next week. + * + * @return bool + */ + public function isNextWeek() + { + return $this->weekOfYear === $this->nowWithSameTz()->addWeek()->weekOfYear; + } + + /** + * Determines if the instance is within the last week. + * + * @return bool + */ + public function isLastWeek() + { + return $this->weekOfYear === $this->nowWithSameTz()->subWeek()->weekOfYear; + } + + /** + * Determines if the instance is within the next quarter. + * + * @return bool + */ + public function isNextQuarter() + { + return $this->quarter === $this->nowWithSameTz()->addQuarter()->quarter; + } + + /** + * Determines if the instance is within the last quarter. + * + * @return bool + */ + public function isLastQuarter() + { + return $this->quarter === $this->nowWithSameTz()->subQuarter()->quarter; + } + + /** + * Determines if the instance is within the next month. + * + * @return bool + */ + public function isNextMonth() + { + return $this->month === $this->nowWithSameTz()->addMonthNoOverflow()->month; + } + + /** + * Determines if the instance is within the last month. + * + * @return bool + */ + public function isLastMonth() + { + return $this->month === $this->nowWithSameTz()->subMonthNoOverflow()->month; + } + + /** + * Determines if the instance is within next year. + * + * @return bool + */ + public function isNextYear() + { + return $this->year === $this->nowWithSameTz()->addYear()->year; + } + + /** + * Determines if the instance is within the previous year. + * + * @return bool + */ + public function isLastYear() + { + return $this->year === $this->nowWithSameTz()->subYear()->year; + } + + /** + * Determines if the instance is in the future, ie. greater (after) than now. + * + * @return bool + */ + public function isFuture() + { + return $this->gt($this->nowWithSameTz()); + } + + /** + * Determines if the instance is in the past, ie. less (before) than now. + * + * @return bool + */ + public function isPast() + { + return $this->lt($this->nowWithSameTz()); + } + + /** + * Determines if the instance is a leap year. + * + * @return bool + */ + public function isLeapYear() + { + return $this->format('L') === '1'; + } + + /** + * Determines if the instance is a long year + * + * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates + * + * @return bool + */ + public function isLongYear() + { + return static::create($this->year, 12, 28, 0, 0, 0, $this->tz)->weekOfYear === 53; + } + + /** + * Compares the formatted values of the two dates. + * + * @param string $format The date formats to compare. + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use current day. + * + * @throws \InvalidArgumentException + * + * @return bool + */ + public function isSameAs($format, $date = null) + { + $date = $date ?: static::now($this->tz); + + static::expectDateTime($date, 'null'); + + return $this->format($format) === $date->format($format); + } + + /** + * Determines if the instance is in the current year. + * + * @return bool + */ + public function isCurrentYear() + { + return $this->isSameYear(); + } + + /** + * Checks if the passed in date is in the same year as the instance year. + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use current day. + * + * @return bool + */ + public function isSameYear($date = null) + { + return $this->isSameAs('Y', $date); + } + + /** + * Determines if the instance is in the current month. + * + * @return bool + */ + public function isCurrentQuarter() + { + return $this->isSameQuarter(); + } + + /** + * Checks if the passed in date is in the same quarter as the instance quarter (and year if needed). + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use current day. + * @param bool $ofSameYear Check if it is the same month in the same year. + * + * @return bool + */ + public function isSameQuarter($date = null, $ofSameYear = null) + { + $date = $date ? static::instance($date) : static::now($this->tz); + + static::expectDateTime($date, 'null'); + + $ofSameYear = is_null($ofSameYear) ? static::shouldCompareYearWithMonth() : $ofSameYear; + + return $this->quarter === $date->quarter && (!$ofSameYear || $this->isSameYear($date)); + } + + /** + * Determines if the instance is in the current month. + * + * @param bool $ofSameYear Check if it is the same month in the same year. + * + * @return bool + */ + public function isCurrentMonth($ofSameYear = null) + { + return $this->isSameMonth($ofSameYear); + } + + /** + * Checks if the passed in date is in the same month as the instance´s month. + * + * Note that this defaults to only comparing the month while ignoring the year. + * To test if it is the same exact month of the same year, pass in true as the second parameter. + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use the current date. + * @param bool $ofSameYear Check if it is the same month in the same year. + * + * @return bool + */ + public function isSameMonth($date = null, $ofSameYear = null) + { + $ofSameYear = is_null($ofSameYear) ? static::shouldCompareYearWithMonth() : $ofSameYear; + + return $this->isSameAs($ofSameYear ? 'Y-m' : 'm', $date); + } + + /** + * Determines if the instance is in the current day. + * + * @return bool + */ + public function isCurrentDay() + { + return $this->isSameDay(); + } + + /** + * Checks if the passed in date is the same exact day as the instance´s day. + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use the current date. + * + * @return bool + */ + public function isSameDay($date = null) + { + return $this->isSameAs('Y-m-d', $date); + } + + /** + * Determines if the instance is in the current hour. + * + * @return bool + */ + public function isCurrentHour() + { + return $this->isSameHour(); + } + + /** + * Checks if the passed in date is the same exact hour as the instance´s hour. + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use the current date. + * + * @return bool + */ + public function isSameHour($date = null) + { + return $this->isSameAs('Y-m-d H', $date); + } + + /** + * Determines if the instance is in the current minute. + * + * @return bool + */ + public function isCurrentMinute() + { + return $this->isSameMinute(); + } + + /** + * Checks if the passed in date is the same exact minute as the instance´s minute. + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use the current date. + * + * @return bool + */ + public function isSameMinute($date = null) + { + return $this->isSameAs('Y-m-d H:i', $date); + } + + /** + * Determines if the instance is in the current second. + * + * @return bool + */ + public function isCurrentSecond() + { + return $this->isSameSecond(); + } + + /** + * Checks if the passed in date is the same exact second as the instance´s second. + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use the current date. + * + * @return bool + */ + public function isSameSecond($date = null) + { + return $this->isSameAs('Y-m-d H:i:s', $date); + } + + /** + * Checks if this day is a specific day of the week. + * + * @param int $dayOfWeek + * + * @return bool + */ + public function isDayOfWeek($dayOfWeek) + { + return $this->dayOfWeek === $dayOfWeek; + } + + /** + * Checks if this day is a Sunday. + * + * @return bool + */ + public function isSunday() + { + return $this->dayOfWeek === static::SUNDAY; + } + + /** + * Checks if this day is a Monday. + * + * @return bool + */ + public function isMonday() + { + return $this->dayOfWeek === static::MONDAY; + } + + /** + * Checks if this day is a Tuesday. + * + * @return bool + */ + public function isTuesday() + { + return $this->dayOfWeek === static::TUESDAY; + } + + /** + * Checks if this day is a Wednesday. + * + * @return bool + */ + public function isWednesday() + { + return $this->dayOfWeek === static::WEDNESDAY; + } + + /** + * Checks if this day is a Thursday. + * + * @return bool + */ + public function isThursday() + { + return $this->dayOfWeek === static::THURSDAY; + } + + /** + * Checks if this day is a Friday. + * + * @return bool + */ + public function isFriday() + { + return $this->dayOfWeek === static::FRIDAY; + } + + /** + * Checks if this day is a Saturday. + * + * @return bool + */ + public function isSaturday() + { + return $this->dayOfWeek === static::SATURDAY; + } + + /** + * Check if its the birthday. Compares the date/month values of the two dates. + * + * @param \Carbon\Carbon|\DateTimeInterface|null $date The instance to compare with or null to use current day. + * + * @return bool + */ + public function isBirthday($date = null) + { + return $this->isSameAs('md', $date); + } + + /** + * Check if today is the last day of the Month + * + * @return bool + */ + public function isLastOfMonth() + { + return $this->day === $this->daysInMonth; + } + + /** + * Check if the instance is start of day / midnight. + * + * @param bool $checkMicroseconds check time at microseconds precision + * /!\ Warning, this is not reliable with PHP < 7.1.4 + * + * @return bool + */ + public function isStartOfDay($checkMicroseconds = false) + { + return $checkMicroseconds + ? $this->format('H:i:s.u') === '00:00:00.000000' + : $this->format('H:i:s') === '00:00:00'; + } + + /** + * Check if the instance is end of day. + * + * @param bool $checkMicroseconds check time at microseconds precision + * /!\ Warning, this is not reliable with PHP < 7.1.4 + * + * @return bool + */ + public function isEndOfDay($checkMicroseconds = false) + { + return $checkMicroseconds + ? $this->format('H:i:s.u') === '23:59:59.999999' + : $this->format('H:i:s') === '23:59:59'; + } + + /** + * Check if the instance is start of day / midnight. + * + * @return bool + */ + public function isMidnight() + { + return $this->isStartOfDay(); + } + + /** + * Check if the instance is midday. + * + * @return bool + */ + public function isMidday() + { + return $this->format('G:i:s') === static::$midDayAt.':00:00'; + } + + /** + * Checks if the (date)time string is in a given format. + * + * @param string $date + * @param string $format + * + * @return bool + */ + public static function hasFormat($date, $format) + { + try { + // Try to create a DateTime object. Throws an InvalidArgumentException if the provided time string + // doesn't match the format in any way. + static::createFromFormat($format, $date); + + // createFromFormat() is known to handle edge cases silently. + // E.g. "1975-5-1" (Y-n-j) will still be parsed correctly when "Y-m-d" is supplied as the format. + // To ensure we're really testing against our desired format, perform an additional regex validation. + $regex = strtr( + preg_quote($format, '/'), + static::$regexFormats + ); + + return (bool) preg_match('/^'.$regex.'$/', $date); + } catch (InvalidArgumentException $e) { + } + + return false; + } + + /////////////////////////////////////////////////////////////////// + /////////////////// ADDITIONS AND SUBTRACTIONS //////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Add centuries to the instance. Positive $value travels forward while + * negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addCenturies($value) + { + return $this->addYears(static::YEARS_PER_CENTURY * $value); + } + + /** + * Add a century to the instance + * + * @param int $value + * + * @return static + */ + public function addCentury($value = 1) + { + return $this->addCenturies($value); + } + + /** + * Remove centuries from the instance + * + * @param int $value + * + * @return static + */ + public function subCenturies($value) + { + return $this->addCenturies(-1 * $value); + } + + /** + * Remove a century from the instance + * + * @param int $value + * + * @return static + */ + public function subCentury($value = 1) + { + return $this->subCenturies($value); + } + + /** + * Add years to the instance. Positive $value travel forward while + * negative $value travel into the past. + * + * @param int $value + * + * @return static + */ + public function addYears($value) + { + if ($this->shouldOverflowYears()) { + return $this->addYearsWithOverflow($value); + } + + return $this->addYearsNoOverflow($value); + } + + /** + * Add a year to the instance + * + * @param int $value + * + * @return static + */ + public function addYear($value = 1) + { + return $this->addYears($value); + } + + /** + * Add years to the instance with no overflow of months + * Positive $value travel forward while + * negative $value travel into the past. + * + * @param int $value + * + * @return static + */ + public function addYearsNoOverflow($value) + { + return $this->addMonthsNoOverflow($value * static::MONTHS_PER_YEAR); + } + + /** + * Add year with overflow months set to false + * + * @param int $value + * + * @return static + */ + public function addYearNoOverflow($value = 1) + { + return $this->addYearsNoOverflow($value); + } + + /** + * Add years to the instance. + * Positive $value travel forward while + * negative $value travel into the past. + * + * @param int $value + * + * @return static + */ + public function addYearsWithOverflow($value) + { + return $this->modify((int) $value.' year'); + } + + /** + * Add year with overflow. + * + * @param int $value + * + * @return static + */ + public function addYearWithOverflow($value = 1) + { + return $this->addYearsWithOverflow($value); + } + + /** + * Remove years from the instance. + * + * @param int $value + * + * @return static + */ + public function subYears($value) + { + return $this->addYears(-1 * $value); + } + + /** + * Remove a year from the instance + * + * @param int $value + * + * @return static + */ + public function subYear($value = 1) + { + return $this->subYears($value); + } + + /** + * Remove years from the instance with no month overflow. + * + * @param int $value + * + * @return static + */ + public function subYearsNoOverflow($value) + { + return $this->subMonthsNoOverflow($value * static::MONTHS_PER_YEAR); + } + + /** + * Remove year from the instance with no month overflow + * + * @param int $value + * + * @return static + */ + public function subYearNoOverflow($value = 1) + { + return $this->subYearsNoOverflow($value); + } + + /** + * Remove years from the instance. + * + * @param int $value + * + * @return static + */ + public function subYearsWithOverflow($value) + { + return $this->subMonthsWithOverflow($value * static::MONTHS_PER_YEAR); + } + + /** + * Remove year from the instance. + * + * @param int $value + * + * @return static + */ + public function subYearWithOverflow($value = 1) + { + return $this->subYearsWithOverflow($value); + } + + /** + * Add quarters to the instance. Positive $value travels forward while + * negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addQuarters($value) + { + return $this->addMonths(static::MONTHS_PER_QUARTER * $value); + } + + /** + * Add a quarter to the instance + * + * @param int $value + * + * @return static + */ + public function addQuarter($value = 1) + { + return $this->addQuarters($value); + } + + /** + * Remove quarters from the instance + * + * @param int $value + * + * @return static + */ + public function subQuarters($value) + { + return $this->addQuarters(-1 * $value); + } + + /** + * Remove a quarter from the instance + * + * @param int $value + * + * @return static + */ + public function subQuarter($value = 1) + { + return $this->subQuarters($value); + } + + /** + * Add months to the instance. Positive $value travels forward while + * negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addMonths($value) + { + if (static::shouldOverflowMonths()) { + return $this->addMonthsWithOverflow($value); + } + + return $this->addMonthsNoOverflow($value); + } + + /** + * Add a month to the instance + * + * @param int $value + * + * @return static + */ + public function addMonth($value = 1) + { + return $this->addMonths($value); + } + + /** + * Remove months from the instance + * + * @param int $value + * + * @return static + */ + public function subMonths($value) + { + return $this->addMonths(-1 * $value); + } + + /** + * Remove a month from the instance + * + * @param int $value + * + * @return static + */ + public function subMonth($value = 1) + { + return $this->subMonths($value); + } + + /** + * Add months to the instance. Positive $value travels forward while + * negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addMonthsWithOverflow($value) + { + return $this->modify((int) $value.' month'); + } + + /** + * Add a month to the instance + * + * @param int $value + * + * @return static + */ + public function addMonthWithOverflow($value = 1) + { + return $this->addMonthsWithOverflow($value); + } + + /** + * Remove months from the instance + * + * @param int $value + * + * @return static + */ + public function subMonthsWithOverflow($value) + { + return $this->addMonthsWithOverflow(-1 * $value); + } + + /** + * Remove a month from the instance + * + * @param int $value + * + * @return static + */ + public function subMonthWithOverflow($value = 1) + { + return $this->subMonthsWithOverflow($value); + } + + /** + * Add months without overflowing to the instance. Positive $value + * travels forward while negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addMonthsNoOverflow($value) + { + $day = $this->day; + + $this->modify((int) $value.' month'); + + if ($day !== $this->day) { + $this->modify('last day of previous month'); + } + + return $this; + } + + /** + * Add a month with no overflow to the instance + * + * @param int $value + * + * @return static + */ + public function addMonthNoOverflow($value = 1) + { + return $this->addMonthsNoOverflow($value); + } + + /** + * Remove months with no overflow from the instance + * + * @param int $value + * + * @return static + */ + public function subMonthsNoOverflow($value) + { + return $this->addMonthsNoOverflow(-1 * $value); + } + + /** + * Remove a month with no overflow from the instance + * + * @param int $value + * + * @return static + */ + public function subMonthNoOverflow($value = 1) + { + return $this->subMonthsNoOverflow($value); + } + + /** + * Add days to the instance. Positive $value travels forward while + * negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addDays($value) + { + return $this->modify((int) $value.' day'); + } + + /** + * Add a day to the instance + * + * @param int $value + * + * @return static + */ + public function addDay($value = 1) + { + return $this->addDays($value); + } + + /** + * Remove days from the instance + * + * @param int $value + * + * @return static + */ + public function subDays($value) + { + return $this->addDays(-1 * $value); + } + + /** + * Remove a day from the instance + * + * @param int $value + * + * @return static + */ + public function subDay($value = 1) + { + return $this->subDays($value); + } + + /** + * Add weekdays to the instance. Positive $value travels forward while + * negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addWeekdays($value) + { + // Fix for weekday bug https://bugs.php.net/bug.php?id=54909 + $t = $this->toTimeString(); + $this->modify((int) $value.' weekday'); + + return $this->setTimeFromTimeString($t); + } + + /** + * Add a weekday to the instance + * + * @param int $value + * + * @return static + */ + public function addWeekday($value = 1) + { + return $this->addWeekdays($value); + } + + /** + * Remove weekdays from the instance + * + * @param int $value + * + * @return static + */ + public function subWeekdays($value) + { + return $this->addWeekdays(-1 * $value); + } + + /** + * Remove a weekday from the instance + * + * @param int $value + * + * @return static + */ + public function subWeekday($value = 1) + { + return $this->subWeekdays($value); + } + + /** + * Add weeks to the instance. Positive $value travels forward while + * negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addWeeks($value) + { + return $this->modify((int) $value.' week'); + } + + /** + * Add a week to the instance + * + * @param int $value + * + * @return static + */ + public function addWeek($value = 1) + { + return $this->addWeeks($value); + } + + /** + * Remove weeks to the instance + * + * @param int $value + * + * @return static + */ + public function subWeeks($value) + { + return $this->addWeeks(-1 * $value); + } + + /** + * Remove a week from the instance + * + * @param int $value + * + * @return static + */ + public function subWeek($value = 1) + { + return $this->subWeeks($value); + } + + /** + * Add hours to the instance. Positive $value travels forward while + * negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addHours($value) + { + return $this->modify((int) $value.' hour'); + } + + /** + * Add hours to the instance using timestamp. Positive $value travels + * forward while negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addRealHours($value) + { + return $this->addRealMinutes($value * static::MINUTES_PER_HOUR); + } + + /** + * Add an hour to the instance. + * + * @param int $value + * + * @return static + */ + public function addHour($value = 1) + { + return $this->addHours($value); + } + + /** + * Add an hour to the instance using timestamp. + * + * @param int $value + * + * @return static + */ + public function addRealHour($value = 1) + { + return $this->addRealHours($value); + } + + /** + * Remove hours from the instance. + * + * @param int $value + * + * @return static + */ + public function subHours($value) + { + return $this->addHours(-1 * $value); + } + + /** + * Remove hours from the instance using timestamp. + * + * @param int $value + * + * @return static + */ + public function subRealHours($value) + { + return $this->addRealHours(-1 * $value); + } + + /** + * Remove an hour from the instance. + * + * @param int $value + * + * @return static + */ + public function subHour($value = 1) + { + return $this->subHours($value); + } + + /** + * Remove an hour from the instance. + * + * @param int $value + * + * @return static + */ + public function subRealHour($value = 1) + { + return $this->subRealHours($value); + } + + /** + * Add minutes to the instance using timestamp. Positive $value + * travels forward while negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addMinutes($value) + { + return $this->modify((int) $value.' minute'); + } + + /** + * Add minutes to the instance using timestamp. Positive $value travels + * forward while negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addRealMinutes($value) + { + return $this->addRealSeconds($value * static::SECONDS_PER_MINUTE); + } + + /** + * Add a minute to the instance. + * + * @param int $value + * + * @return static + */ + public function addMinute($value = 1) + { + return $this->addMinutes($value); + } + + /** + * Add a minute to the instance using timestamp. + * + * @param int $value + * + * @return static + */ + public function addRealMinute($value = 1) + { + return $this->addRealMinutes($value); + } + + /** + * Remove a minute from the instance. + * + * @param int $value + * + * @return static + */ + public function subMinute($value = 1) + { + return $this->subMinutes($value); + } + + /** + * Remove a minute from the instance using timestamp. + * + * @param int $value + * + * @return static + */ + public function subRealMinute($value = 1) + { + return $this->addRealMinutes(-1 * $value); + } + + /** + * Remove minutes from the instance. + * + * @param int $value + * + * @return static + */ + public function subMinutes($value) + { + return $this->addMinutes(-1 * $value); + } + + /** + * Remove a minute from the instance using timestamp. + * + * @param int $value + * + * @return static + */ + public function subRealMinutes($value = 1) + { + return $this->subRealMinute($value); + } + + /** + * Add seconds to the instance. Positive $value travels forward while + * negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addSeconds($value) + { + return $this->modify((int) $value.' second'); + } + + /** + * Add seconds to the instance using timestamp. Positive $value travels + * forward while negative $value travels into the past. + * + * @param int $value + * + * @return static + */ + public function addRealSeconds($value) + { + return $this->setTimestamp($this->getTimestamp() + $value); + } + + /** + * Add a second to the instance. + * + * @param int $value + * + * @return static + */ + public function addSecond($value = 1) + { + return $this->addSeconds($value); + } + + /** + * Add a second to the instance using timestamp. + * + * @param int $value + * + * @return static + */ + public function addRealSecond($value = 1) + { + return $this->addRealSeconds($value); + } + + /** + * Remove seconds from the instance. + * + * @param int $value + * + * @return static + */ + public function subSeconds($value) + { + return $this->addSeconds(-1 * $value); + } + + /** + * Remove seconds from the instance using timestamp. + * + * @param int $value + * + * @return static + */ + public function subRealSeconds($value) + { + return $this->addRealSeconds(-1 * $value); + } + + /** + * Remove a second from the instance + * + * @param int $value + * + * @return static + */ + public function subSecond($value = 1) + { + return $this->subSeconds($value); + } + + /** + * Remove a second from the instance using timestamp. + * + * @param int $value + * + * @return static + */ + public function subRealSecond($value = 1) + { + return $this->subRealSeconds($value); + } + + /////////////////////////////////////////////////////////////////// + /////////////////////////// DIFFERENCES /////////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * @param DateInterval $diff + * @param bool $absolute + * @param bool $trimMicroseconds + * + * @return CarbonInterval + */ + protected static function fixDiffInterval(DateInterval $diff, $absolute, $trimMicroseconds) + { + $diff = CarbonInterval::instance($diff, $trimMicroseconds); + + // @codeCoverageIgnoreStart + if (version_compare(PHP_VERSION, '7.1.0-dev', '<')) { + return $diff; + } + + // Work-around for https://bugs.php.net/bug.php?id=77145 + if ($diff->f > 0 && $diff->y === -1 && $diff->m === 11 && $diff->d >= 27 && $diff->h === 23 && $diff->i === 59 && $diff->s === 59) { + $diff->y = 0; + $diff->m = 0; + $diff->d = 0; + $diff->h = 0; + $diff->i = 0; + $diff->s = 0; + $diff->f = (1000000 - round($diff->f * 1000000)) / 1000000; + $diff->invert(); + } elseif ($diff->f < 0) { + if ($diff->s !== 0 || $diff->i !== 0 || $diff->h !== 0 || $diff->d !== 0 || $diff->m !== 0 || $diff->y !== 0) { + $diff->f = (round($diff->f * 1000000) + 1000000) / 1000000; + $diff->s--; + if ($diff->s < 0) { + $diff->s += 60; + $diff->i--; + if ($diff->i < 0) { + $diff->i += 60; + $diff->h--; + if ($diff->h < 0) { + $diff->i += 24; + $diff->d--; + if ($diff->d < 0) { + $diff->d += 30; + $diff->m--; + if ($diff->m < 0) { + $diff->m += 12; + $diff->y--; + } + } + } + } + } + } else { + $diff->f *= -1; + $diff->invert(); + } + } + // @codeCoverageIgnoreEnd + if ($absolute && $diff->invert) { + $diff->invert(); + } + + return $diff; + } + + /** + * Get the difference as a CarbonInterval instance. + * + * Pass false as second argument to get a microseconds-precise interval. Else + * microseconds in the original interval will not be kept. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * @param bool $trimMicroseconds (true by default) + * + * @return CarbonInterval + */ + public function diffAsCarbonInterval($date = null, $absolute = true, $trimMicroseconds = true) + { + $from = $this; + $to = $this->resolveCarbon($date); + + if ($trimMicroseconds) { + $from = $from->copy()->startOfSecond(); + $to = $to->copy()->startOfSecond(); + } + + return static::fixDiffInterval($from->diff($to, $absolute), $absolute, $trimMicroseconds); + } + + /** + * Get the difference in years + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInYears($date = null, $absolute = true) + { + return (int) $this->diff($this->resolveCarbon($date), $absolute)->format('%r%y'); + } + + /** + * Get the difference in months + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInMonths($date = null, $absolute = true) + { + $date = $this->resolveCarbon($date); + + return $this->diffInYears($date, $absolute) * static::MONTHS_PER_YEAR + (int) $this->diff($date, $absolute)->format('%r%m'); + } + + /** + * Get the difference in weeks + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInWeeks($date = null, $absolute = true) + { + return (int) ($this->diffInDays($date, $absolute) / static::DAYS_PER_WEEK); + } + + /** + * Get the difference in days + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInDays($date = null, $absolute = true) + { + return (int) $this->diff($this->resolveCarbon($date), $absolute)->format('%r%a'); + } + + /** + * Get the difference in days using a filter closure + * + * @param Closure $callback + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInDaysFiltered(Closure $callback, $date = null, $absolute = true) + { + return $this->diffFiltered(CarbonInterval::day(), $callback, $date, $absolute); + } + + /** + * Get the difference in hours using a filter closure + * + * @param Closure $callback + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInHoursFiltered(Closure $callback, $date = null, $absolute = true) + { + return $this->diffFiltered(CarbonInterval::hour(), $callback, $date, $absolute); + } + + /** + * Get the difference by the given interval using a filter closure + * + * @param CarbonInterval $ci An interval to traverse by + * @param Closure $callback + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffFiltered(CarbonInterval $ci, Closure $callback, $date = null, $absolute = true) + { + $start = $this; + $end = $this->resolveCarbon($date); + $inverse = false; + + if ($end < $start) { + $start = $end; + $end = $this; + $inverse = true; + } + + $period = new DatePeriod($start, $ci, $end); + $values = array_filter(iterator_to_array($period), function ($date) use ($callback) { + return call_user_func($callback, Carbon::instance($date)); + }); + + $diff = count($values); + + return $inverse && !$absolute ? -$diff : $diff; + } + + /** + * Get the difference in weekdays + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInWeekdays($date = null, $absolute = true) + { + return $this->diffInDaysFiltered(function (Carbon $date) { + return $date->isWeekday(); + }, $date, $absolute); + } + + /** + * Get the difference in weekend days using a filter + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInWeekendDays($date = null, $absolute = true) + { + return $this->diffInDaysFiltered(function (Carbon $date) { + return $date->isWeekend(); + }, $date, $absolute); + } + + /** + * Get the difference in hours. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInHours($date = null, $absolute = true) + { + return (int) ($this->diffInSeconds($date, $absolute) / static::SECONDS_PER_MINUTE / static::MINUTES_PER_HOUR); + } + + /** + * Get the difference in hours using timestamps. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealHours($date = null, $absolute = true) + { + return (int) ($this->diffInRealSeconds($date, $absolute) / static::SECONDS_PER_MINUTE / static::MINUTES_PER_HOUR); + } + + /** + * Get the difference in minutes. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInMinutes($date = null, $absolute = true) + { + return (int) ($this->diffInSeconds($date, $absolute) / static::SECONDS_PER_MINUTE); + } + + /** + * Get the difference in minutes using timestamps. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealMinutes($date = null, $absolute = true) + { + return (int) ($this->diffInRealSeconds($date, $absolute) / static::SECONDS_PER_MINUTE); + } + + /** + * Get the difference in seconds. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInSeconds($date = null, $absolute = true) + { + $diff = $this->diff($this->resolveCarbon($date)); + if (!$diff->days && version_compare(PHP_VERSION, '5.4.0-dev', '>=')) { + $diff = static::fixDiffInterval($diff, $absolute, false); + } + $value = $diff->days * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE + + $diff->h * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE + + $diff->i * static::SECONDS_PER_MINUTE + + $diff->s; + + return $absolute || !$diff->invert ? $value : -$value; + } + + /** + * Get the difference in seconds using timestamps. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * @param bool $absolute Get the absolute of the difference + * + * @return int + */ + public function diffInRealSeconds($date = null, $absolute = true) + { + $date = $this->resolveCarbon($date); + $value = $date->getTimestamp() - $this->getTimestamp(); + + return $absolute ? abs($value) : $value; + } + + /** + * The number of seconds since midnight. + * + * @return int + */ + public function secondsSinceMidnight() + { + return $this->diffInSeconds($this->copy()->startOfDay()); + } + + /** + * The number of seconds until 23:59:59. + * + * @return int + */ + public function secondsUntilEndOfDay() + { + return $this->diffInSeconds($this->copy()->endOfDay()); + } + + /** + * Get the difference in a human readable format in the current locale. + * + * When comparing a value in the past to default now: + * 1 hour ago + * 5 months ago + * + * When comparing a value in the future to default now: + * 1 hour from now + * 5 months from now + * + * When comparing a value in the past to another value: + * 1 hour before + * 5 months before + * + * When comparing a value in the future to another value: + * 1 hour after + * 5 months after + * + * @param Carbon|null $other + * @param bool $absolute removes time difference modifiers ago, after, etc + * @param bool $short displays short format of time units + * @param int $parts displays number of parts in the interval + * + * @return string + */ + public function diffForHumans($other = null, $absolute = false, $short = false, $parts = 1) + { + $isNow = $other === null; + $interval = array(); + + $parts = min(6, max(1, (int) $parts)); + $count = 1; + $unit = $short ? 's' : 'second'; + + if ($isNow) { + $other = $this->nowWithSameTz(); + } elseif (!$other instanceof DateTime && !$other instanceof DateTimeInterface) { + $other = static::parse($other); + } + + $diffInterval = $this->diff($other); + + $diffIntervalArray = array( + array('value' => $diffInterval->y, 'unit' => 'year', 'unitShort' => 'y'), + array('value' => $diffInterval->m, 'unit' => 'month', 'unitShort' => 'm'), + array('value' => $diffInterval->d, 'unit' => 'day', 'unitShort' => 'd'), + array('value' => $diffInterval->h, 'unit' => 'hour', 'unitShort' => 'h'), + array('value' => $diffInterval->i, 'unit' => 'minute', 'unitShort' => 'min'), + array('value' => $diffInterval->s, 'unit' => 'second', 'unitShort' => 's'), + ); + + foreach ($diffIntervalArray as $diffIntervalData) { + if ($diffIntervalData['value'] > 0) { + $unit = $short ? $diffIntervalData['unitShort'] : $diffIntervalData['unit']; + $count = $diffIntervalData['value']; + + if ($diffIntervalData['unit'] === 'day' && $count >= static::DAYS_PER_WEEK) { + $unit = $short ? 'w' : 'week'; + $count = (int) ($count / static::DAYS_PER_WEEK); + + $interval[] = static::translator()->transChoice($unit, $count, array(':count' => $count)); + + // get the count days excluding weeks (might be zero) + $numOfDaysCount = (int) ($diffIntervalData['value'] - ($count * static::DAYS_PER_WEEK)); + + if ($numOfDaysCount > 0 && count($interval) < $parts) { + $unit = $short ? 'd' : 'day'; + $count = $numOfDaysCount; + $interval[] = static::translator()->transChoice($unit, $count, array(':count' => $count)); + } + } else { + $interval[] = static::translator()->transChoice($unit, $count, array(':count' => $count)); + } + } + + // break the loop after we get the required number of parts in array + if (count($interval) >= $parts) { + break; + } + } + + if (count($interval) === 0) { + if ($isNow && static::getHumanDiffOptions() & self::JUST_NOW) { + $key = 'diff_now'; + $translation = static::translator()->trans($key); + if ($translation !== $key) { + return $translation; + } + } + $count = static::getHumanDiffOptions() & self::NO_ZERO_DIFF ? 1 : 0; + $unit = $short ? 's' : 'second'; + $interval[] = static::translator()->transChoice($unit, $count, array(':count' => $count)); + } + + // join the interval parts by a space + $time = implode(' ', $interval); + + unset($diffIntervalArray, $interval); + + if ($absolute) { + return $time; + } + + $isFuture = $diffInterval->invert === 1; + + $transId = $isNow ? ($isFuture ? 'from_now' : 'ago') : ($isFuture ? 'after' : 'before'); + + if ($parts === 1) { + if ($isNow && $unit === 'day') { + if ($count === 1 && static::getHumanDiffOptions() & self::ONE_DAY_WORDS) { + $key = $isFuture ? 'diff_tomorrow' : 'diff_yesterday'; + $translation = static::translator()->trans($key); + if ($translation !== $key) { + return $translation; + } + } + if ($count === 2 && static::getHumanDiffOptions() & self::TWO_DAY_WORDS) { + $key = $isFuture ? 'diff_after_tomorrow' : 'diff_before_yesterday'; + $translation = static::translator()->trans($key); + if ($translation !== $key) { + return $translation; + } + } + } + // Some languages have special pluralization for past and future tense. + $key = $unit.'_'.$transId; + if ($key !== static::translator()->transChoice($key, $count)) { + $time = static::translator()->transChoice($key, $count, array(':count' => $count)); + } + } + + return static::translator()->trans($transId, array(':time' => $time)); + } + + /////////////////////////////////////////////////////////////////// + //////////////////////////// MODIFIERS //////////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Resets the time to 00:00:00 start of day + * + * @return static + */ + public function startOfDay() + { + return $this->modify('00:00:00.000000'); + } + + /** + * Resets the time to 23:59:59 end of day + * + * @return static + */ + public function endOfDay() + { + return $this->modify('23:59:59.999999'); + } + + /** + * Resets the date to the first day of the month and the time to 00:00:00 + * + * @return static + */ + public function startOfMonth() + { + return $this->setDate($this->year, $this->month, 1)->startOfDay(); + } + + /** + * Resets the date to end of the month and time to 23:59:59 + * + * @return static + */ + public function endOfMonth() + { + return $this->setDate($this->year, $this->month, $this->daysInMonth)->endOfDay(); + } + + /** + * Resets the date to the first day of the quarter and the time to 00:00:00 + * + * @return static + */ + public function startOfQuarter() + { + $month = ($this->quarter - 1) * static::MONTHS_PER_QUARTER + 1; + + return $this->setDate($this->year, $month, 1)->startOfDay(); + } + + /** + * Resets the date to end of the quarter and time to 23:59:59 + * + * @return static + */ + public function endOfQuarter() + { + return $this->startOfQuarter()->addMonths(static::MONTHS_PER_QUARTER - 1)->endOfMonth(); + } + + /** + * Resets the date to the first day of the year and the time to 00:00:00 + * + * @return static + */ + public function startOfYear() + { + return $this->setDate($this->year, 1, 1)->startOfDay(); + } + + /** + * Resets the date to end of the year and time to 23:59:59 + * + * @return static + */ + public function endOfYear() + { + return $this->setDate($this->year, 12, 31)->endOfDay(); + } + + /** + * Resets the date to the first day of the decade and the time to 00:00:00 + * + * @return static + */ + public function startOfDecade() + { + $year = $this->year - $this->year % static::YEARS_PER_DECADE; + + return $this->setDate($year, 1, 1)->startOfDay(); + } + + /** + * Resets the date to end of the decade and time to 23:59:59 + * + * @return static + */ + public function endOfDecade() + { + $year = $this->year - $this->year % static::YEARS_PER_DECADE + static::YEARS_PER_DECADE - 1; + + return $this->setDate($year, 12, 31)->endOfDay(); + } + + /** + * Resets the date to the first day of the century and the time to 00:00:00 + * + * @return static + */ + public function startOfCentury() + { + $year = $this->year - ($this->year - 1) % static::YEARS_PER_CENTURY; + + return $this->setDate($year, 1, 1)->startOfDay(); + } + + /** + * Resets the date to end of the century and time to 23:59:59 + * + * @return static + */ + public function endOfCentury() + { + $year = $this->year - 1 - ($this->year - 1) % static::YEARS_PER_CENTURY + static::YEARS_PER_CENTURY; + + return $this->setDate($year, 12, 31)->endOfDay(); + } + + /** + * Resets the date to the first day of week (defined in $weekStartsAt) and the time to 00:00:00 + * + * @return static + */ + public function startOfWeek() + { + while ($this->dayOfWeek !== static::$weekStartsAt) { + $this->subDay(); + } + + return $this->startOfDay(); + } + + /** + * Resets the date to end of week (defined in $weekEndsAt) and time to 23:59:59 + * + * @return static + */ + public function endOfWeek() + { + while ($this->dayOfWeek !== static::$weekEndsAt) { + $this->addDay(); + } + + return $this->endOfDay(); + } + + /** + * Modify to start of current hour, minutes and seconds become 0 + * + * @return static + */ + public function startOfHour() + { + return $this->setTime($this->hour, 0, 0); + } + + /** + * Modify to end of current hour, minutes and seconds become 59 + * + * @return static + */ + public function endOfHour() + { + return $this->modify("$this->hour:59:59.999999"); + } + + /** + * Modify to start of current minute, seconds become 0 + * + * @return static + */ + public function startOfMinute() + { + return $this->setTime($this->hour, $this->minute, 0); + } + + /** + * Modify to end of current minute, seconds become 59 + * + * @return static + */ + public function endOfMinute() + { + return $this->modify("$this->hour:$this->minute:59.999999"); + } + + /** + * Modify to start of current minute, seconds become 0 + * + * @return static + */ + public function startOfSecond() + { + return $this->modify("$this->hour:$this->minute:$this->second.0"); + } + + /** + * Modify to end of current minute, seconds become 59 + * + * @return static + */ + public function endOfSecond() + { + return $this->modify("$this->hour:$this->minute:$this->second.999999"); + } + + /** + * Modify to midday, default to self::$midDayAt + * + * @return static + */ + public function midDay() + { + return $this->setTime(self::$midDayAt, 0, 0); + } + + /** + * Modify to the next occurrence of a given day of the week. + * If no dayOfWeek is provided, modify to the next occurrence + * of the current day of the week. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek + * + * @return static + */ + public function next($dayOfWeek = null) + { + if ($dayOfWeek === null) { + $dayOfWeek = $this->dayOfWeek; + } + + return $this->startOfDay()->modify('next '.static::$days[$dayOfWeek]); + } + + /** + * Go forward or backward to the next week- or weekend-day. + * + * @param bool $weekday + * @param bool $forward + * + * @return $this + */ + private function nextOrPreviousDay($weekday = true, $forward = true) + { + $step = $forward ? 1 : -1; + + do { + $this->addDay($step); + } while ($weekday ? $this->isWeekend() : $this->isWeekday()); + + return $this; + } + + /** + * Go forward to the next weekday. + * + * @return $this + */ + public function nextWeekday() + { + return $this->nextOrPreviousDay(); + } + + /** + * Go backward to the previous weekday. + * + * @return $this + */ + public function previousWeekday() + { + return $this->nextOrPreviousDay(true, false); + } + + /** + * Go forward to the next weekend day. + * + * @return $this + */ + public function nextWeekendDay() + { + return $this->nextOrPreviousDay(false); + } + + /** + * Go backward to the previous weekend day. + * + * @return $this + */ + public function previousWeekendDay() + { + return $this->nextOrPreviousDay(false, false); + } + + /** + * Modify to the previous occurrence of a given day of the week. + * If no dayOfWeek is provided, modify to the previous occurrence + * of the current day of the week. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek + * + * @return static + */ + public function previous($dayOfWeek = null) + { + if ($dayOfWeek === null) { + $dayOfWeek = $this->dayOfWeek; + } + + return $this->startOfDay()->modify('last '.static::$days[$dayOfWeek]); + } + + /** + * Modify to the first occurrence of a given day of the week + * in the current month. If no dayOfWeek is provided, modify to the + * first day of the current month. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek + * + * @return static + */ + public function firstOfMonth($dayOfWeek = null) + { + $this->startOfDay(); + + if ($dayOfWeek === null) { + return $this->day(1); + } + + return $this->modify('first '.static::$days[$dayOfWeek].' of '.$this->format('F').' '.$this->year); + } + + /** + * Modify to the last occurrence of a given day of the week + * in the current month. If no dayOfWeek is provided, modify to the + * last day of the current month. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek + * + * @return static + */ + public function lastOfMonth($dayOfWeek = null) + { + $this->startOfDay(); + + if ($dayOfWeek === null) { + return $this->day($this->daysInMonth); + } + + return $this->modify('last '.static::$days[$dayOfWeek].' of '.$this->format('F').' '.$this->year); + } + + /** + * Modify to the given occurrence of a given day of the week + * in the current month. If the calculated occurrence is outside the scope + * of the current month, then return false and no modifications are made. + * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int $nth + * @param int $dayOfWeek + * + * @return mixed + */ + public function nthOfMonth($nth, $dayOfWeek) + { + $date = $this->copy()->firstOfMonth(); + $check = $date->format('Y-m'); + $date->modify('+'.$nth.' '.static::$days[$dayOfWeek]); + + return $date->format('Y-m') === $check ? $this->modify($date) : false; + } + + /** + * Modify to the first occurrence of a given day of the week + * in the current quarter. If no dayOfWeek is provided, modify to the + * first day of the current quarter. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek day of the week default null + * + * @return static + */ + public function firstOfQuarter($dayOfWeek = null) + { + return $this->setDate($this->year, $this->quarter * static::MONTHS_PER_QUARTER - 2, 1)->firstOfMonth($dayOfWeek); + } + + /** + * Modify to the last occurrence of a given day of the week + * in the current quarter. If no dayOfWeek is provided, modify to the + * last day of the current quarter. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek day of the week default null + * + * @return static + */ + public function lastOfQuarter($dayOfWeek = null) + { + return $this->setDate($this->year, $this->quarter * static::MONTHS_PER_QUARTER, 1)->lastOfMonth($dayOfWeek); + } + + /** + * Modify to the given occurrence of a given day of the week + * in the current quarter. If the calculated occurrence is outside the scope + * of the current quarter, then return false and no modifications are made. + * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int $nth + * @param int $dayOfWeek + * + * @return mixed + */ + public function nthOfQuarter($nth, $dayOfWeek) + { + $date = $this->copy()->day(1)->month($this->quarter * static::MONTHS_PER_QUARTER); + $lastMonth = $date->month; + $year = $date->year; + $date->firstOfQuarter()->modify('+'.$nth.' '.static::$days[$dayOfWeek]); + + return ($lastMonth < $date->month || $year !== $date->year) ? false : $this->modify($date); + } + + /** + * Modify to the first occurrence of a given day of the week + * in the current year. If no dayOfWeek is provided, modify to the + * first day of the current year. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek day of the week default null + * + * @return static + */ + public function firstOfYear($dayOfWeek = null) + { + return $this->month(1)->firstOfMonth($dayOfWeek); + } + + /** + * Modify to the last occurrence of a given day of the week + * in the current year. If no dayOfWeek is provided, modify to the + * last day of the current year. Use the supplied constants + * to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int|null $dayOfWeek day of the week default null + * + * @return static + */ + public function lastOfYear($dayOfWeek = null) + { + return $this->month(static::MONTHS_PER_YEAR)->lastOfMonth($dayOfWeek); + } + + /** + * Modify to the given occurrence of a given day of the week + * in the current year. If the calculated occurrence is outside the scope + * of the current year, then return false and no modifications are made. + * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY. + * + * @param int $nth + * @param int $dayOfWeek + * + * @return mixed + */ + public function nthOfYear($nth, $dayOfWeek) + { + $date = $this->copy()->firstOfYear()->modify('+'.$nth.' '.static::$days[$dayOfWeek]); + + return $this->year === $date->year ? $this->modify($date) : false; + } + + /** + * Modify the current instance to the average of a given instance (default now) and the current instance. + * + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date + * + * @return static + */ + public function average($date = null) + { + $date = $this->resolveCarbon($date); + $increment = $this->diffInRealSeconds($date, false) / 2; + $intIncrement = floor($increment); + $microIncrement = (int) (($date->micro - $this->micro) / 2 + 1000000 * ($increment - $intIncrement)); + $micro = (int) ($this->micro + $microIncrement); + while ($micro >= 1000000) { + $micro -= 1000000; + $intIncrement++; + } + $this->addSeconds($intIncrement); + + if (version_compare(PHP_VERSION, '7.1.8-dev', '>=')) { + $this->setTime($this->hour, $this->minute, $this->second, $micro); + } + + return $this; + } + + /////////////////////////////////////////////////////////////////// + /////////////////////////// SERIALIZATION ///////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Return a serialized string of the instance. + * + * @return string + */ + public function serialize() + { + return serialize($this); + } + + /** + * Create an instance from a serialized string. + * + * @param string $value + * + * @throws \InvalidArgumentException + * + * @return static + */ + public static function fromSerialized($value) + { + $instance = @unserialize($value); + + if (!$instance instanceof static) { + throw new InvalidArgumentException('Invalid serialized value.'); + } + + return $instance; + } + + /** + * The __set_state handler. + * + * @param array $array + * + * @return static + */ + public static function __set_state($array) + { + return static::instance(parent::__set_state($array)); + } + + /** + * Prepare the object for JSON serialization. + * + * @return array|string + */ + public function jsonSerialize() + { + if (static::$serializer) { + return call_user_func(static::$serializer, $this); + } + + $carbon = $this; + + return call_user_func(function () use ($carbon) { + return get_object_vars($carbon); + }); + } + + /** + * JSON serialize all Carbon instances using the given callback. + * + * @param callable $callback + * + * @return void + */ + public static function serializeUsing($callback) + { + static::$serializer = $callback; + } + + /////////////////////////////////////////////////////////////////// + /////////////////////////////// MACRO ///////////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Register a custom macro. + * + * @param string $name + * @param object|callable $macro + * + * @return void + */ + public static function macro($name, $macro) + { + static::$localMacros[$name] = $macro; + } + + /** + * Mix another object into the class. + * + * @param object $mixin + * + * @return void + */ + public static function mixin($mixin) + { + $reflection = new \ReflectionClass($mixin); + $methods = $reflection->getMethods( + \ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED + ); + + foreach ($methods as $method) { + $method->setAccessible(true); + + static::macro($method->name, $method->invoke($mixin)); + } + } + + /** + * Checks if macro is registered. + * + * @param string $name + * + * @return bool + */ + public static function hasMacro($name) + { + return isset(static::$localMacros[$name]); + } + + /** + * Dynamically handle calls to the class. + * + * @param string $method + * @param array $parameters + * + * @throws \BadMethodCallException + * + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + if (!static::hasMacro($method)) { + throw new \BadMethodCallException("Method $method does not exist."); + } + + if (static::$localMacros[$method] instanceof Closure && method_exists('Closure', 'bind')) { + return call_user_func_array(Closure::bind(static::$localMacros[$method], null, get_called_class()), $parameters); + } + + return call_user_func_array(static::$localMacros[$method], $parameters); + } + + /** + * Dynamically handle calls to the class. + * + * @param string $method + * @param array $parameters + * + * @throws \BadMethodCallException|\ReflectionException + * + * @return mixed + */ + public function __call($method, $parameters) + { + if (!static::hasMacro($method)) { + throw new \BadMethodCallException("Method $method does not exist."); + } + + $macro = static::$localMacros[$method]; + + $reflexion = new \ReflectionFunction($macro); + $reflectionParameters = $reflexion->getParameters(); + $expectedCount = count($reflectionParameters); + $actualCount = count($parameters); + if ($expectedCount > $actualCount && $reflectionParameters[$expectedCount - 1]->name === 'self') { + for ($i = $actualCount; $i < $expectedCount - 1; $i++) { + $parameters[] = $reflectionParameters[$i]->getDefaultValue(); + } + $parameters[] = $this; + } + + if ($macro instanceof Closure && method_exists($macro, 'bindTo')) { + return call_user_func_array($macro->bindTo($this, get_class($this)), $parameters); + } + + return call_user_func_array($macro, $parameters); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php b/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php new file mode 100644 index 0000000..0bd9ab9 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php @@ -0,0 +1,1155 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use Closure; +use DateInterval; +use InvalidArgumentException; +use ReflectionClass; +use ReflectionFunction; +use ReflectionMethod; +use Symfony\Component\Translation\TranslatorInterface; + +/** + * A simple API extension for DateInterval. + * The implementation provides helpers to handle weeks but only days are saved. + * Weeks are calculated based on the total days of the current instance. + * + * @property int $years Total years of the current interval. + * @property int $months Total months of the current interval. + * @property int $weeks Total weeks of the current interval calculated from the days. + * @property int $dayz Total days of the current interval (weeks * 7 + days). + * @property int $hours Total hours of the current interval. + * @property int $minutes Total minutes of the current interval. + * @property int $seconds Total seconds of the current interval. + * @property-read int $dayzExcludeWeeks Total days remaining in the final week of the current instance (days % 7). + * @property-read int $daysExcludeWeeks alias of dayzExcludeWeeks + * @property-read float $totalYears Number of years equivalent to the interval. + * @property-read float $totalMonths Number of months equivalent to the interval. + * @property-read float $totalWeeks Number of weeks equivalent to the interval. + * @property-read float $totalDays Number of days equivalent to the interval. + * @property-read float $totalDayz Alias for totalDays. + * @property-read float $totalHours Number of hours equivalent to the interval. + * @property-read float $totalMinutes Number of minutes equivalent to the interval. + * @property-read float $totalSeconds Number of seconds equivalent to the interval. + * + * @method static CarbonInterval years($years = 1) Create instance specifying a number of years. + * @method static CarbonInterval year($years = 1) Alias for years() + * @method static CarbonInterval months($months = 1) Create instance specifying a number of months. + * @method static CarbonInterval month($months = 1) Alias for months() + * @method static CarbonInterval weeks($weeks = 1) Create instance specifying a number of weeks. + * @method static CarbonInterval week($weeks = 1) Alias for weeks() + * @method static CarbonInterval days($days = 1) Create instance specifying a number of days. + * @method static CarbonInterval dayz($days = 1) Alias for days() + * @method static CarbonInterval day($days = 1) Alias for days() + * @method static CarbonInterval hours($hours = 1) Create instance specifying a number of hours. + * @method static CarbonInterval hour($hours = 1) Alias for hours() + * @method static CarbonInterval minutes($minutes = 1) Create instance specifying a number of minutes. + * @method static CarbonInterval minute($minutes = 1) Alias for minutes() + * @method static CarbonInterval seconds($seconds = 1) Create instance specifying a number of seconds. + * @method static CarbonInterval second($seconds = 1) Alias for seconds() + * @method CarbonInterval years($years = 1) Set the years portion of the current interval. + * @method CarbonInterval year($years = 1) Alias for years(). + * @method CarbonInterval months($months = 1) Set the months portion of the current interval. + * @method CarbonInterval month($months = 1) Alias for months(). + * @method CarbonInterval weeks($weeks = 1) Set the weeks portion of the current interval. Will overwrite dayz value. + * @method CarbonInterval week($weeks = 1) Alias for weeks(). + * @method CarbonInterval days($days = 1) Set the days portion of the current interval. + * @method CarbonInterval dayz($days = 1) Alias for days(). + * @method CarbonInterval day($days = 1) Alias for days(). + * @method CarbonInterval hours($hours = 1) Set the hours portion of the current interval. + * @method CarbonInterval hour($hours = 1) Alias for hours(). + * @method CarbonInterval minutes($minutes = 1) Set the minutes portion of the current interval. + * @method CarbonInterval minute($minutes = 1) Alias for minutes(). + * @method CarbonInterval seconds($seconds = 1) Set the seconds portion of the current interval. + * @method CarbonInterval second($seconds = 1) Alias for seconds(). + */ +class CarbonInterval extends DateInterval +{ + /** + * Interval spec period designators + */ + const PERIOD_PREFIX = 'P'; + const PERIOD_YEARS = 'Y'; + const PERIOD_MONTHS = 'M'; + const PERIOD_DAYS = 'D'; + const PERIOD_TIME_PREFIX = 'T'; + const PERIOD_HOURS = 'H'; + const PERIOD_MINUTES = 'M'; + const PERIOD_SECONDS = 'S'; + + /** + * A translator to ... er ... translate stuff + * + * @var \Symfony\Component\Translation\TranslatorInterface + */ + protected static $translator; + + /** + * @var array|null + */ + protected static $cascadeFactors; + + /** + * @var array|null + */ + private static $flipCascadeFactors; + + /** + * The registered macros. + * + * @var array + */ + protected static $macros = array(); + + /** + * Before PHP 5.4.20/5.5.4 instead of FALSE days will be set to -99999 when the interval instance + * was created by DateTime::diff(). + */ + const PHP_DAYS_FALSE = -99999; + + /** + * Mapping of units and factors for cascading. + * + * Should only be modified by changing the factors or referenced constants. + * + * @return array + */ + public static function getCascadeFactors() + { + return static::$cascadeFactors ?: array( + 'minutes' => array(Carbon::SECONDS_PER_MINUTE, 'seconds'), + 'hours' => array(Carbon::MINUTES_PER_HOUR, 'minutes'), + 'dayz' => array(Carbon::HOURS_PER_DAY, 'hours'), + 'months' => array(Carbon::DAYS_PER_WEEK * Carbon::WEEKS_PER_MONTH, 'dayz'), + 'years' => array(Carbon::MONTHS_PER_YEAR, 'months'), + ); + } + + private static function standardizeUnit($unit) + { + $unit = rtrim($unit, 'sz').'s'; + + return $unit === 'days' ? 'dayz' : $unit; + } + + private static function getFlipCascadeFactors() + { + if (!self::$flipCascadeFactors) { + self::$flipCascadeFactors = array(); + foreach (static::getCascadeFactors() as $to => $tuple) { + list($factor, $from) = $tuple; + + self::$flipCascadeFactors[self::standardizeUnit($from)] = array(self::standardizeUnit($to), $factor); + } + } + + return self::$flipCascadeFactors; + } + + /** + * @param array $cascadeFactors + */ + public static function setCascadeFactors(array $cascadeFactors) + { + self::$flipCascadeFactors = null; + static::$cascadeFactors = $cascadeFactors; + } + + /** + * Determine if the interval was created via DateTime:diff() or not. + * + * @param DateInterval $interval + * + * @return bool + */ + private static function wasCreatedFromDiff(DateInterval $interval) + { + return $interval->days !== false && $interval->days !== static::PHP_DAYS_FALSE; + } + + /////////////////////////////////////////////////////////////////// + //////////////////////////// CONSTRUCTORS ///////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Create a new CarbonInterval instance. + * + * @param int $years + * @param int $months + * @param int $weeks + * @param int $days + * @param int $hours + * @param int $minutes + * @param int $seconds + */ + public function __construct($years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null) + { + $spec = $years; + + if (!is_string($spec) || floatval($years) || preg_match('/^[0-9.]/', $years)) { + $spec = static::PERIOD_PREFIX; + + $spec .= $years > 0 ? $years.static::PERIOD_YEARS : ''; + $spec .= $months > 0 ? $months.static::PERIOD_MONTHS : ''; + + $specDays = 0; + $specDays += $weeks > 0 ? $weeks * static::getDaysPerWeek() : 0; + $specDays += $days > 0 ? $days : 0; + + $spec .= $specDays > 0 ? $specDays.static::PERIOD_DAYS : ''; + + if ($hours > 0 || $minutes > 0 || $seconds > 0) { + $spec .= static::PERIOD_TIME_PREFIX; + $spec .= $hours > 0 ? $hours.static::PERIOD_HOURS : ''; + $spec .= $minutes > 0 ? $minutes.static::PERIOD_MINUTES : ''; + $spec .= $seconds > 0 ? $seconds.static::PERIOD_SECONDS : ''; + } + + if ($spec === static::PERIOD_PREFIX) { + // Allow the zero interval. + $spec .= '0'.static::PERIOD_YEARS; + } + } + + parent::__construct($spec); + } + + /** + * Returns the factor for a given source-to-target couple. + * + * @param string $source + * @param string $target + * + * @return int|null + */ + public static function getFactor($source, $target) + { + $source = self::standardizeUnit($source); + $target = self::standardizeUnit($target); + $factors = static::getFlipCascadeFactors(); + if (isset($factors[$source])) { + list($to, $factor) = $factors[$source]; + if ($to === $target) { + return $factor; + } + } + + return null; + } + + /** + * Returns current config for days per week. + * + * @return int + */ + public static function getDaysPerWeek() + { + return static::getFactor('dayz', 'weeks') ?: Carbon::DAYS_PER_WEEK; + } + + /** + * Returns current config for hours per day. + * + * @return int + */ + public static function getHoursPerDay() + { + return static::getFactor('hours', 'dayz') ?: Carbon::HOURS_PER_DAY; + } + + /** + * Returns current config for minutes per hour. + * + * @return int + */ + public static function getMinutesPerHours() + { + return static::getFactor('minutes', 'hours') ?: Carbon::MINUTES_PER_HOUR; + } + + /** + * Returns current config for seconds per minute. + * + * @return int + */ + public static function getSecondsPerMinutes() + { + return static::getFactor('seconds', 'minutes') ?: Carbon::SECONDS_PER_MINUTE; + } + + /** + * Create a new CarbonInterval instance from specific values. + * This is an alias for the constructor that allows better fluent + * syntax as it allows you to do CarbonInterval::create(1)->fn() rather than + * (new CarbonInterval(1))->fn(). + * + * @param int $years + * @param int $months + * @param int $weeks + * @param int $days + * @param int $hours + * @param int $minutes + * @param int $seconds + * + * @return static + */ + public static function create($years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null) + { + return new static($years, $months, $weeks, $days, $hours, $minutes, $seconds); + } + + /** + * Get a copy of the instance. + * + * @return static + */ + public function copy() + { + $date = new static($this->spec()); + $date->invert = $this->invert; + + return $date; + } + + /** + * Provide static helpers to create instances. Allows CarbonInterval::years(3). + * + * Note: This is done using the magic method to allow static and instance methods to + * have the same names. + * + * @param string $name + * @param array $args + * + * @return static + */ + public static function __callStatic($name, $args) + { + $arg = count($args) === 0 ? 1 : $args[0]; + + switch ($name) { + case 'years': + case 'year': + return new static($arg); + + case 'months': + case 'month': + return new static(null, $arg); + + case 'weeks': + case 'week': + return new static(null, null, $arg); + + case 'days': + case 'dayz': + case 'day': + return new static(null, null, null, $arg); + + case 'hours': + case 'hour': + return new static(null, null, null, null, $arg); + + case 'minutes': + case 'minute': + return new static(null, null, null, null, null, $arg); + + case 'seconds': + case 'second': + return new static(null, null, null, null, null, null, $arg); + } + + if (static::hasMacro($name)) { + return call_user_func_array( + array(new static(0), $name), $args + ); + } + } + + /** + * Creates a CarbonInterval from string. + * + * Format: + * + * Suffix | Unit | Example | DateInterval expression + * -------|---------|---------|------------------------ + * y | years | 1y | P1Y + * mo | months | 3mo | P3M + * w | weeks | 2w | P2W + * d | days | 28d | P28D + * h | hours | 4h | PT4H + * m | minutes | 12m | PT12M + * s | seconds | 59s | PT59S + * + * e. g. `1w 3d 4h 32m 23s` is converted to 10 days 4 hours 32 minutes and 23 seconds. + * + * Special cases: + * - An empty string will return a zero interval + * - Fractions are allowed for weeks, days, hours and minutes and will be converted + * and rounded to the next smaller value (caution: 0.5w = 4d) + * + * @param string $intervalDefinition + * + * @return static + */ + public static function fromString($intervalDefinition) + { + if (empty($intervalDefinition)) { + return new static(0); + } + + $years = 0; + $months = 0; + $weeks = 0; + $days = 0; + $hours = 0; + $minutes = 0; + $seconds = 0; + + $pattern = '/(\d+(?:\.\d+)?)\h*([^\d\h]*)/i'; + preg_match_all($pattern, $intervalDefinition, $parts, PREG_SET_ORDER); + while ($match = array_shift($parts)) { + list($part, $value, $unit) = $match; + $intValue = intval($value); + $fraction = floatval($value) - $intValue; + switch (strtolower($unit)) { + case 'year': + case 'years': + case 'y': + $years += $intValue; + break; + + case 'month': + case 'months': + case 'mo': + $months += $intValue; + break; + + case 'week': + case 'weeks': + case 'w': + $weeks += $intValue; + if ($fraction) { + $parts[] = array(null, $fraction * static::getDaysPerWeek(), 'd'); + } + break; + + case 'day': + case 'days': + case 'd': + $days += $intValue; + if ($fraction) { + $parts[] = array(null, $fraction * static::getHoursPerDay(), 'h'); + } + break; + + case 'hour': + case 'hours': + case 'h': + $hours += $intValue; + if ($fraction) { + $parts[] = array(null, $fraction * static::getMinutesPerHours(), 'm'); + } + break; + + case 'minute': + case 'minutes': + case 'm': + $minutes += $intValue; + if ($fraction) { + $seconds += round($fraction * static::getSecondsPerMinutes()); + } + break; + + case 'second': + case 'seconds': + case 's': + $seconds += $intValue; + break; + + default: + throw new InvalidArgumentException( + sprintf('Invalid part %s in definition %s', $part, $intervalDefinition) + ); + } + } + + return new static($years, $months, $weeks, $days, $hours, $minutes, $seconds); + } + + /** + * Create a CarbonInterval instance from a DateInterval one. Can not instance + * DateInterval objects created from DateTime::diff() as you can't externally + * set the $days field. + * + * Pass false as second argument to get a microseconds-precise interval. Else + * microseconds in the original interval will not be kept. + * + * @param DateInterval $di + * @param bool $trimMicroseconds (true by default) + * + * @return static + */ + public static function instance(DateInterval $di, $trimMicroseconds = true) + { + $microseconds = $trimMicroseconds || version_compare(PHP_VERSION, '7.1.0-dev', '<') ? 0 : $di->f; + $instance = new static(static::getDateIntervalSpec($di)); + if ($microseconds) { + $instance->f = $microseconds; + } + $instance->invert = $di->invert; + foreach (array('y', 'm', 'd', 'h', 'i', 's') as $unit) { + if ($di->$unit < 0) { + $instance->$unit *= -1; + } + } + + return $instance; + } + + /** + * Make a CarbonInterval instance from given variable if possible. + * + * Always return a new instance. Parse only strings and only these likely to be intervals (skip dates + * and recurrences). Throw an exception for invalid format, but otherwise return null. + * + * @param mixed $var + * + * @return static|null + */ + public static function make($var) + { + if ($var instanceof DateInterval) { + return static::instance($var); + } + + if (is_string($var)) { + $var = trim($var); + + if (substr($var, 0, 1) === 'P') { + return new static($var); + } + + if (preg_match('/^(?:\h*\d+(?:\.\d+)?\h*[a-z]+)+$/i', $var)) { + return static::fromString($var); + } + } + } + + /////////////////////////////////////////////////////////////////// + /////////////////////// LOCALIZATION ////////////////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Initialize the translator instance if necessary. + * + * @return \Symfony\Component\Translation\TranslatorInterface + */ + protected static function translator() + { + if (static::$translator === null) { + static::$translator = Translator::get(); + } + + return static::$translator; + } + + /** + * Get the translator instance in use. + * + * @return \Symfony\Component\Translation\TranslatorInterface + */ + public static function getTranslator() + { + return static::translator(); + } + + /** + * Set the translator instance to use. + * + * @param TranslatorInterface $translator + */ + public static function setTranslator(TranslatorInterface $translator) + { + static::$translator = $translator; + } + + /** + * Get the current translator locale. + * + * @return string + */ + public static function getLocale() + { + return static::translator()->getLocale(); + } + + /** + * Set the current translator locale. + * + * @param string $locale + */ + public static function setLocale($locale) + { + return static::translator()->setLocale($locale) !== false; + } + + /////////////////////////////////////////////////////////////////// + ///////////////////////// GETTERS AND SETTERS ///////////////////// + /////////////////////////////////////////////////////////////////// + + /** + * Get a part of the CarbonInterval object. + * + * @param string $name + * + * @throws \InvalidArgumentException + * + * @return int|float + */ + public function __get($name) + { + if (substr($name, 0, 5) === 'total') { + return $this->total(substr($name, 5)); + } + + switch ($name) { + case 'years': + return $this->y; + + case 'months': + return $this->m; + + case 'dayz': + return $this->d; + + case 'hours': + return $this->h; + + case 'minutes': + return $this->i; + + case 'seconds': + return $this->s; + + case 'weeks': + return (int) floor($this->d / static::getDaysPerWeek()); + + case 'daysExcludeWeeks': + case 'dayzExcludeWeeks': + return $this->d % static::getDaysPerWeek(); + + default: + throw new InvalidArgumentException(sprintf("Unknown getter '%s'", $name)); + } + } + + /** + * Set a part of the CarbonInterval object. + * + * @param string $name + * @param int $val + * + * @throws \InvalidArgumentException + */ + public function __set($name, $val) + { + switch ($name) { + case 'years': + $this->y = $val; + break; + + case 'months': + $this->m = $val; + break; + + case 'weeks': + $this->d = $val * static::getDaysPerWeek(); + break; + + case 'dayz': + $this->d = $val; + break; + + case 'hours': + $this->h = $val; + break; + + case 'minutes': + $this->i = $val; + break; + + case 'seconds': + $this->s = $val; + break; + } + } + + /** + * Allow setting of weeks and days to be cumulative. + * + * @param int $weeks Number of weeks to set + * @param int $days Number of days to set + * + * @return static + */ + public function weeksAndDays($weeks, $days) + { + $this->dayz = ($weeks * static::getDaysPerWeek()) + $days; + + return $this; + } + + /** + * Register a custom macro. + * + * @param string $name + * @param object|callable $macro + * + * @return void + */ + public static function macro($name, $macro) + { + static::$macros[$name] = $macro; + } + + /** + * Register macros from a mixin object. + * + * @param object $mixin + * + * @throws \ReflectionException + * + * @return void + */ + public static function mixin($mixin) + { + $reflection = new ReflectionClass($mixin); + + $methods = $reflection->getMethods( + ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED + ); + + foreach ($methods as $method) { + $method->setAccessible(true); + + static::macro($method->name, $method->invoke($mixin)); + } + } + + /** + * Check if macro is registered. + * + * @param string $name + * + * @return bool + */ + public static function hasMacro($name) + { + return isset(static::$macros[$name]); + } + + /** + * Call given macro. + * + * @param string $name + * @param array $parameters + * + * @return mixed + */ + protected function callMacro($name, $parameters) + { + $macro = static::$macros[$name]; + + $reflection = new ReflectionFunction($macro); + + $reflectionParameters = $reflection->getParameters(); + + $expectedCount = count($reflectionParameters); + $actualCount = count($parameters); + + if ($expectedCount > $actualCount && $reflectionParameters[$expectedCount - 1]->name === 'self') { + for ($i = $actualCount; $i < $expectedCount - 1; $i++) { + $parameters[] = $reflectionParameters[$i]->getDefaultValue(); + } + + $parameters[] = $this; + } + + if ($macro instanceof Closure && method_exists($macro, 'bindTo')) { + $macro = $macro->bindTo($this, get_class($this)); + } + + return call_user_func_array($macro, $parameters); + } + + /** + * Allow fluent calls on the setters... CarbonInterval::years(3)->months(5)->day(). + * + * Note: This is done using the magic method to allow static and instance methods to + * have the same names. + * + * @param string $name + * @param array $args + * + * @return static + */ + public function __call($name, $args) + { + if (static::hasMacro($name)) { + return $this->callMacro($name, $args); + } + + $arg = count($args) === 0 ? 1 : $args[0]; + + switch ($name) { + case 'years': + case 'year': + $this->years = $arg; + break; + + case 'months': + case 'month': + $this->months = $arg; + break; + + case 'weeks': + case 'week': + $this->dayz = $arg * static::getDaysPerWeek(); + break; + + case 'days': + case 'dayz': + case 'day': + $this->dayz = $arg; + break; + + case 'hours': + case 'hour': + $this->hours = $arg; + break; + + case 'minutes': + case 'minute': + $this->minutes = $arg; + break; + + case 'seconds': + case 'second': + $this->seconds = $arg; + break; + } + + return $this; + } + + /** + * Get the current interval in a human readable format in the current locale. + * + * @param bool $short (false by default), returns short units if true + * + * @return string + */ + public function forHumans($short = false) + { + $periods = array( + 'year' => array('y', $this->years), + 'month' => array('m', $this->months), + 'week' => array('w', $this->weeks), + 'day' => array('d', $this->daysExcludeWeeks), + 'hour' => array('h', $this->hours), + 'minute' => array('min', $this->minutes), + 'second' => array('s', $this->seconds), + ); + + $parts = array(); + foreach ($periods as $unit => $options) { + list($shortUnit, $count) = $options; + if ($count > 0) { + $parts[] = static::translator()->transChoice($short ? $shortUnit : $unit, $count, array(':count' => $count)); + } + } + + return implode(' ', $parts); + } + + /** + * Format the instance as a string using the forHumans() function. + * + * @return string + */ + public function __toString() + { + return $this->forHumans(); + } + + /** + * Convert the interval to a CarbonPeriod. + * + * @return CarbonPeriod + */ + public function toPeriod() + { + return CarbonPeriod::createFromArray( + array_merge(array($this), func_get_args()) + ); + } + + /** + * Invert the interval. + * + * @return $this + */ + public function invert() + { + $this->invert = $this->invert ? 0 : 1; + + return $this; + } + + /** + * Add the passed interval to the current instance. + * + * @param DateInterval $interval + * + * @return static + */ + public function add(DateInterval $interval) + { + $sign = ($this->invert === 1) !== ($interval->invert === 1) ? -1 : 1; + + if (static::wasCreatedFromDiff($interval)) { + $this->dayz += $interval->days * $sign; + } else { + $this->years += $interval->y * $sign; + $this->months += $interval->m * $sign; + $this->dayz += $interval->d * $sign; + $this->hours += $interval->h * $sign; + $this->minutes += $interval->i * $sign; + $this->seconds += $interval->s * $sign; + } + + if (($this->years || $this->months || $this->dayz || $this->hours || $this->minutes || $this->seconds) && + $this->years <= 0 && $this->months <= 0 && $this->dayz <= 0 && $this->hours <= 0 && $this->minutes <= 0 && $this->seconds <= 0 + ) { + $this->years *= -1; + $this->months *= -1; + $this->dayz *= -1; + $this->hours *= -1; + $this->minutes *= -1; + $this->seconds *= -1; + $this->invert(); + } + + return $this; + } + + /** + * Multiply current instance given number of times + * + * @param float $factor + * + * @return $this + */ + public function times($factor) + { + if ($factor < 0) { + $this->invert = $this->invert ? 0 : 1; + $factor = -$factor; + } + + $this->years = (int) round($this->years * $factor); + $this->months = (int) round($this->months * $factor); + $this->dayz = (int) round($this->dayz * $factor); + $this->hours = (int) round($this->hours * $factor); + $this->minutes = (int) round($this->minutes * $factor); + $this->seconds = (int) round($this->seconds * $factor); + + return $this; + } + + /** + * Get the interval_spec string of a date interval. + * + * @param DateInterval $interval + * + * @return string + */ + public static function getDateIntervalSpec(DateInterval $interval) + { + $date = array_filter(array( + static::PERIOD_YEARS => abs($interval->y), + static::PERIOD_MONTHS => abs($interval->m), + static::PERIOD_DAYS => abs($interval->d), + )); + + $time = array_filter(array( + static::PERIOD_HOURS => abs($interval->h), + static::PERIOD_MINUTES => abs($interval->i), + static::PERIOD_SECONDS => abs($interval->s), + )); + + $specString = static::PERIOD_PREFIX; + + foreach ($date as $key => $value) { + $specString .= $value.$key; + } + + if (count($time) > 0) { + $specString .= static::PERIOD_TIME_PREFIX; + foreach ($time as $key => $value) { + $specString .= $value.$key; + } + } + + return $specString === static::PERIOD_PREFIX ? 'PT0S' : $specString; + } + + /** + * Get the interval_spec string. + * + * @return string + */ + public function spec() + { + return static::getDateIntervalSpec($this); + } + + /** + * Comparing 2 date intervals. + * + * @param DateInterval $a + * @param DateInterval $b + * + * @return int + */ + public static function compareDateIntervals(DateInterval $a, DateInterval $b) + { + $current = Carbon::now(); + $passed = $current->copy()->add($b); + $current->add($a); + + if ($current < $passed) { + return -1; + } + if ($current > $passed) { + return 1; + } + + return 0; + } + + /** + * Comparing with passed interval. + * + * @param DateInterval $interval + * + * @return int + */ + public function compare(DateInterval $interval) + { + return static::compareDateIntervals($this, $interval); + } + + /** + * Convert overflowed values into bigger units. + * + * @return $this + */ + public function cascade() + { + foreach (static::getFlipCascadeFactors() as $source => $cascade) { + list($target, $factor) = $cascade; + + if ($source === 'dayz' && $target === 'weeks') { + continue; + } + + $value = $this->$source; + $this->$source = $modulo = $value % $factor; + $this->$target += ($value - $modulo) / $factor; + } + + return $this; + } + + /** + * Get amount of given unit equivalent to the interval. + * + * @param string $unit + * + * @throws \InvalidArgumentException + * + * @return float + */ + public function total($unit) + { + $realUnit = $unit = strtolower($unit); + + if (in_array($unit, array('days', 'weeks'))) { + $realUnit = 'dayz'; + } elseif (!in_array($unit, array('seconds', 'minutes', 'hours', 'dayz', 'months', 'years'))) { + throw new InvalidArgumentException("Unknown unit '$unit'."); + } + + $result = 0; + $cumulativeFactor = 0; + $unitFound = false; + + foreach (static::getFlipCascadeFactors() as $source => $cascade) { + list($target, $factor) = $cascade; + + if ($source === $realUnit) { + $unitFound = true; + $result += $this->$source; + $cumulativeFactor = 1; + } + + if ($factor === false) { + if ($unitFound) { + break; + } + + $result = 0; + $cumulativeFactor = 0; + + continue; + } + + if ($target === $realUnit) { + $unitFound = true; + } + + if ($cumulativeFactor) { + $cumulativeFactor *= $factor; + $result += $this->$target * $cumulativeFactor; + + continue; + } + + $result = ($result + $this->$source) / $factor; + } + + if (isset($target) && !$cumulativeFactor) { + $result += $this->$target; + } + + if (!$unitFound) { + throw new \InvalidArgumentException("Unit $unit have no configuration to get total from other units."); + } + + if ($unit === 'weeks') { + return $result / static::getDaysPerWeek(); + } + + return $result; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php b/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php new file mode 100644 index 0000000..ae52c0b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php @@ -0,0 +1,1445 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use BadMethodCallException; +use Closure; +use Countable; +use DateInterval; +use DateTime; +use DateTimeInterface; +use InvalidArgumentException; +use Iterator; +use ReflectionClass; +use ReflectionFunction; +use ReflectionMethod; +use RuntimeException; + +/** + * Substitution of DatePeriod with some modifications and many more features. + * Fully compatible with PHP 5.3+! + * + * @method static CarbonPeriod start($date, $inclusive = null) Create instance specifying start date. + * @method static CarbonPeriod since($date, $inclusive = null) Alias for start(). + * @method static CarbonPeriod sinceNow($inclusive = null) Create instance with start date set to now. + * @method static CarbonPeriod end($date = null, $inclusive = null) Create instance specifying end date. + * @method static CarbonPeriod until($date = null, $inclusive = null) Alias for end(). + * @method static CarbonPeriod untilNow($inclusive = null) Create instance with end date set to now. + * @method static CarbonPeriod dates($start, $end = null) Create instance with start and end date. + * @method static CarbonPeriod between($start, $end = null) Create instance with start and end date. + * @method static CarbonPeriod recurrences($recurrences = null) Create instance with maximum number of recurrences. + * @method static CarbonPeriod times($recurrences = null) Alias for recurrences(). + * @method static CarbonPeriod options($options = null) Create instance with options. + * @method static CarbonPeriod toggle($options, $state = null) Create instance with options toggled on or off. + * @method static CarbonPeriod filter($callback, $name = null) Create instance with filter added to the stack. + * @method static CarbonPeriod push($callback, $name = null) Alias for filter(). + * @method static CarbonPeriod prepend($callback, $name = null) Create instance with filter prepened to the stack. + * @method static CarbonPeriod filters(array $filters) Create instance with filters stack. + * @method static CarbonPeriod interval($interval) Create instance with given date interval. + * @method static CarbonPeriod each($interval) Create instance with given date interval. + * @method static CarbonPeriod every($interval) Create instance with given date interval. + * @method static CarbonPeriod step($interval) Create instance with given date interval. + * @method static CarbonPeriod stepBy($interval) Create instance with given date interval. + * @method static CarbonPeriod invert() Create instance with inverted date interval. + * @method static CarbonPeriod years($years = 1) Create instance specifying a number of years for date interval. + * @method static CarbonPeriod year($years = 1) Alias for years(). + * @method static CarbonPeriod months($months = 1) Create instance specifying a number of months for date interval. + * @method static CarbonPeriod month($months = 1) Alias for months(). + * @method static CarbonPeriod weeks($weeks = 1) Create instance specifying a number of weeks for date interval. + * @method static CarbonPeriod week($weeks = 1) Alias for weeks(). + * @method static CarbonPeriod days($days = 1) Create instance specifying a number of days for date interval. + * @method static CarbonPeriod dayz($days = 1) Alias for days(). + * @method static CarbonPeriod day($days = 1) Alias for days(). + * @method static CarbonPeriod hours($hours = 1) Create instance specifying a number of hours for date interval. + * @method static CarbonPeriod hour($hours = 1) Alias for hours(). + * @method static CarbonPeriod minutes($minutes = 1) Create instance specifying a number of minutes for date interval. + * @method static CarbonPeriod minute($minutes = 1) Alias for minutes(). + * @method static CarbonPeriod seconds($seconds = 1) Create instance specifying a number of seconds for date interval. + * @method static CarbonPeriod second($seconds = 1) Alias for seconds(). + * @method CarbonPeriod start($date, $inclusive = null) Change the period start date. + * @method CarbonPeriod since($date, $inclusive = null) Alias for start(). + * @method CarbonPeriod sinceNow($inclusive = null) Change the period start date to now. + * @method CarbonPeriod end($date = null, $inclusive = null) Change the period end date. + * @method CarbonPeriod until($date = null, $inclusive = null) Alias for end(). + * @method CarbonPeriod untilNow($inclusive = null) Change the period end date to now. + * @method CarbonPeriod dates($start, $end = null) Change the period start and end date. + * @method CarbonPeriod recurrences($recurrences = null) Change the maximum number of recurrences. + * @method CarbonPeriod times($recurrences = null) Alias for recurrences(). + * @method CarbonPeriod options($options = null) Change the period options. + * @method CarbonPeriod toggle($options, $state = null) Toggle given options on or off. + * @method CarbonPeriod filter($callback, $name = null) Add a filter to the stack. + * @method CarbonPeriod push($callback, $name = null) Alias for filter(). + * @method CarbonPeriod prepend($callback, $name = null) Prepend a filter to the stack. + * @method CarbonPeriod filters(array $filters = array()) Set filters stack. + * @method CarbonPeriod interval($interval) Change the period date interval. + * @method CarbonPeriod invert() Invert the period date interval. + * @method CarbonPeriod years($years = 1) Set the years portion of the date interval. + * @method CarbonPeriod year($years = 1) Alias for years(). + * @method CarbonPeriod months($months = 1) Set the months portion of the date interval. + * @method CarbonPeriod month($months = 1) Alias for months(). + * @method CarbonPeriod weeks($weeks = 1) Set the weeks portion of the date interval. + * @method CarbonPeriod week($weeks = 1) Alias for weeks(). + * @method CarbonPeriod days($days = 1) Set the days portion of the date interval. + * @method CarbonPeriod dayz($days = 1) Alias for days(). + * @method CarbonPeriod day($days = 1) Alias for days(). + * @method CarbonPeriod hours($hours = 1) Set the hours portion of the date interval. + * @method CarbonPeriod hour($hours = 1) Alias for hours(). + * @method CarbonPeriod minutes($minutes = 1) Set the minutes portion of the date interval. + * @method CarbonPeriod minute($minutes = 1) Alias for minutes(). + * @method CarbonPeriod seconds($seconds = 1) Set the seconds portion of the date interval. + * @method CarbonPeriod second($seconds = 1) Alias for seconds(). + */ +class CarbonPeriod implements Iterator, Countable +{ + /** + * Built-in filters. + * + * @var string + */ + const RECURRENCES_FILTER = 'Carbon\CarbonPeriod::filterRecurrences'; + const END_DATE_FILTER = 'Carbon\CarbonPeriod::filterEndDate'; + + /** + * Special value which can be returned by filters to end iteration. Also a filter. + * + * @var string + */ + const END_ITERATION = 'Carbon\CarbonPeriod::endIteration'; + + /** + * Available options. + * + * @var int + */ + const EXCLUDE_START_DATE = 1; + const EXCLUDE_END_DATE = 2; + + /** + * Number of maximum attempts before giving up on finding next valid date. + * + * @var int + */ + const NEXT_MAX_ATTEMPTS = 1000; + + /** + * The registered macros. + * + * @var array + */ + protected static $macros = array(); + + /** + * Underlying date interval instance. Always present, one day by default. + * + * @var CarbonInterval + */ + protected $dateInterval; + + /** + * Whether current date interval was set by default. + * + * @var bool + */ + protected $isDefaultInterval; + + /** + * The filters stack. + * + * @var array + */ + protected $filters = array(); + + /** + * Period start date. Applied on rewind. Always present, now by default. + * + * @var Carbon + */ + protected $startDate; + + /** + * Period end date. For inverted interval should be before the start date. Applied via a filter. + * + * @var Carbon|null + */ + protected $endDate; + + /** + * Limit for number of recurrences. Applied via a filter. + * + * @var int|null + */ + protected $recurrences; + + /** + * Iteration options. + * + * @var int + */ + protected $options; + + /** + * Index of current date. Always sequential, even if some dates are skipped by filters. + * Equal to null only before the first iteration. + * + * @var int + */ + protected $key; + + /** + * Current date. May temporarily hold unaccepted value when looking for a next valid date. + * Equal to null only before the first iteration. + * + * @var Carbon + */ + protected $current; + + /** + * Timezone of current date. Taken from the start date. + * + * @var \DateTimeZone|null + */ + protected $timezone; + + /** + * The cached validation result for current date. + * + * @var bool|string|null + */ + protected $validationResult; + + /** + * Create a new instance. + * + * @return static + */ + public static function create() + { + return static::createFromArray(func_get_args()); + } + + /** + * Create a new instance from an array of parameters. + * + * @param array $params + * + * @return static + */ + public static function createFromArray(array $params) + { + // PHP 5.3 equivalent of new static(...$params). + $reflection = new ReflectionClass(get_class()); + /** @var static $instance */ + $instance = $reflection->newInstanceArgs($params); + + return $instance; + } + + /** + * Create CarbonPeriod from ISO 8601 string. + * + * @param string $iso + * @param int|null $options + * + * @return static + */ + public static function createFromIso($iso, $options = null) + { + $params = static::parseIso8601($iso); + + $instance = static::createFromArray($params); + + if ($options !== null) { + $instance->setOptions($options); + } + + return $instance; + } + + /** + * Return whether given interval contains non zero value of any time unit. + * + * @param \DateInterval $interval + * + * @return bool + */ + protected static function intervalHasTime(DateInterval $interval) + { + // The array_key_exists and get_object_vars are used as a workaround to check microsecond support. + // Both isset and property_exists will fail on PHP 7.0.14 - 7.0.21 due to the following bug: + // https://bugs.php.net/bug.php?id=74852 + return $interval->h || $interval->i || $interval->s || array_key_exists('f', get_object_vars($interval)) && $interval->f; + } + + /** + * Return whether given callable is a string pointing to one of Carbon's is* methods + * and should be automatically converted to a filter callback. + * + * @param callable $callable + * + * @return bool + */ + protected static function isCarbonPredicateMethod($callable) + { + return is_string($callable) && substr($callable, 0, 2) === 'is' && (method_exists('Carbon\Carbon', $callable) || Carbon::hasMacro($callable)); + } + + /** + * Return whether given variable is an ISO 8601 specification. + * + * Note: Check is very basic, as actual validation will be done later when parsing. + * We just want to ensure that variable is not any other type of a valid parameter. + * + * @param mixed $var + * + * @return bool + */ + protected static function isIso8601($var) + { + if (!is_string($var)) { + return false; + } + + // Match slash but not within a timezone name. + $part = '[a-z]+(?:[_-][a-z]+)*'; + + preg_match("#\b$part/$part\b|(/)#i", $var, $match); + + return isset($match[1]); + } + + /** + * Parse given ISO 8601 string into an array of arguments. + * + * @param string $iso + * + * @return array + */ + protected static function parseIso8601($iso) + { + $result = array(); + + $interval = null; + $start = null; + $end = null; + + foreach (explode('/', $iso) as $key => $part) { + if ($key === 0 && preg_match('/^R([0-9]*)$/', $part, $match)) { + $parsed = strlen($match[1]) ? (int) $match[1] : null; + } elseif ($interval === null && $parsed = CarbonInterval::make($part)) { + $interval = $part; + } elseif ($start === null && $parsed = Carbon::make($part)) { + $start = $part; + } elseif ($end === null && $parsed = Carbon::make(static::addMissingParts($start, $part))) { + $end = $part; + } else { + throw new InvalidArgumentException("Invalid ISO 8601 specification: $iso."); + } + + $result[] = $parsed; + } + + return $result; + } + + /** + * Add missing parts of the target date from the soure date. + * + * @param string $source + * @param string $target + * + * @return string + */ + protected static function addMissingParts($source, $target) + { + $pattern = '/'.preg_replace('/[0-9]+/', '[0-9]+', preg_quote($target, '/')).'$/'; + + $result = preg_replace($pattern, $target, $source, 1, $count); + + return $count ? $result : $target; + } + + /** + * Register a custom macro. + * + * @param string $name + * @param object|callable $macro + * + * @return void + */ + public static function macro($name, $macro) + { + static::$macros[$name] = $macro; + } + + /** + * Register macros from a mixin object. + * + * @param object $mixin + * + * @throws \ReflectionException + * + * @return void + */ + public static function mixin($mixin) + { + $reflection = new ReflectionClass($mixin); + + $methods = $reflection->getMethods( + ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED + ); + + foreach ($methods as $method) { + $method->setAccessible(true); + + static::macro($method->name, $method->invoke($mixin)); + } + } + + /** + * Check if macro is registered. + * + * @param string $name + * + * @return bool + */ + public static function hasMacro($name) + { + return isset(static::$macros[$name]); + } + + /** + * Provide static proxy for instance aliases. + * + * @param string $method + * @param array $parameters + * + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + return call_user_func_array( + array(new static, $method), $parameters + ); + } + + /** + * CarbonPeriod constructor. + * + * @throws InvalidArgumentException + */ + public function __construct() + { + // Parse and assign arguments one by one. First argument may be an ISO 8601 spec, + // which will be first parsed into parts and then processed the same way. + $arguments = func_get_args(); + + if (count($arguments) && static::isIso8601($iso = $arguments[0])) { + array_splice($arguments, 0, 1, static::parseIso8601($iso)); + } + + foreach ($arguments as $argument) { + if ($this->dateInterval === null && $parsed = CarbonInterval::make($argument)) { + $this->setDateInterval($parsed); + } elseif ($this->startDate === null && $parsed = Carbon::make($argument)) { + $this->setStartDate($parsed); + } elseif ($this->endDate === null && $parsed = Carbon::make($argument)) { + $this->setEndDate($parsed); + } elseif ($this->recurrences === null && $this->endDate === null && is_numeric($argument)) { + $this->setRecurrences($argument); + } elseif ($this->options === null && (is_int($argument) || $argument === null)) { + $this->setOptions($argument); + } else { + throw new InvalidArgumentException('Invalid constructor parameters.'); + } + } + + if ($this->startDate === null) { + $this->setStartDate(Carbon::now()); + } + + if ($this->dateInterval === null) { + $this->setDateInterval(CarbonInterval::day()); + + $this->isDefaultInterval = true; + } + + if ($this->options === null) { + $this->setOptions(0); + } + } + + /** + * Change the period date interval. + * + * @param DateInterval|string $interval + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setDateInterval($interval) + { + if (!$interval = CarbonInterval::make($interval)) { + throw new InvalidArgumentException('Invalid interval.'); + } + + if ($interval->spec() === 'PT0S') { + throw new InvalidArgumentException('Empty interval is not accepted.'); + } + + $this->dateInterval = $interval; + + $this->isDefaultInterval = false; + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Invert the period date interval. + * + * @return $this + */ + public function invertDateInterval() + { + $interval = $this->dateInterval->invert(); + + return $this->setDateInterval($interval); + } + + /** + * Set start and end date. + * + * @param DateTime|DateTimeInterface|string $start + * @param DateTime|DateTimeInterface|string|null $end + * + * @return $this + */ + public function setDates($start, $end) + { + $this->setStartDate($start); + $this->setEndDate($end); + + return $this; + } + + /** + * Change the period options. + * + * @param int|null $options + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setOptions($options) + { + if (!is_int($options) && !is_null($options)) { + throw new InvalidArgumentException('Invalid options.'); + } + + $this->options = $options ?: 0; + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Get the period options. + * + * @return int + */ + public function getOptions() + { + return $this->options; + } + + /** + * Toggle given options on or off. + * + * @param int $options + * @param bool|null $state + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function toggleOptions($options, $state = null) + { + if ($state === null) { + $state = ($this->options & $options) !== $options; + } + + return $this->setOptions($state ? + $this->options | $options : + $this->options & ~$options + ); + } + + /** + * Toggle EXCLUDE_START_DATE option. + * + * @param bool $state + * + * @return $this + */ + public function excludeStartDate($state = true) + { + return $this->toggleOptions(static::EXCLUDE_START_DATE, $state); + } + + /** + * Toggle EXCLUDE_END_DATE option. + * + * @param bool $state + * + * @return $this + */ + public function excludeEndDate($state = true) + { + return $this->toggleOptions(static::EXCLUDE_END_DATE, $state); + } + + /** + * Get the underlying date interval. + * + * @return CarbonInterval + */ + public function getDateInterval() + { + return $this->dateInterval->copy(); + } + + /** + * Get start date of the period. + * + * @return Carbon + */ + public function getStartDate() + { + return $this->startDate->copy(); + } + + /** + * Get end date of the period. + * + * @return Carbon|null + */ + public function getEndDate() + { + if ($this->endDate) { + return $this->endDate->copy(); + } + } + + /** + * Get number of recurrences. + * + * @return int|null + */ + public function getRecurrences() + { + return $this->recurrences; + } + + /** + * Returns true if the start date should be excluded. + * + * @return bool + */ + public function isStartExcluded() + { + return ($this->options & static::EXCLUDE_START_DATE) !== 0; + } + + /** + * Returns true if the end date should be excluded. + * + * @return bool + */ + public function isEndExcluded() + { + return ($this->options & static::EXCLUDE_END_DATE) !== 0; + } + + /** + * Add a filter to the stack. + * + * @param callable $callback + * @param string $name + * + * @return $this + */ + public function addFilter($callback, $name = null) + { + $tuple = $this->createFilterTuple(func_get_args()); + + $this->filters[] = $tuple; + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Prepend a filter to the stack. + * + * @param callable $callback + * @param string $name + * + * @return $this + */ + public function prependFilter($callback, $name = null) + { + $tuple = $this->createFilterTuple(func_get_args()); + + array_unshift($this->filters, $tuple); + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Create a filter tuple from raw parameters. + * + * Will create an automatic filter callback for one of Carbon's is* methods. + * + * @param array $parameters + * + * @return array + */ + protected function createFilterTuple(array $parameters) + { + $method = array_shift($parameters); + + if (!$this->isCarbonPredicateMethod($method)) { + return array($method, array_shift($parameters)); + } + + return array(function ($date) use ($method, $parameters) { + return call_user_func_array(array($date, $method), $parameters); + }, $method); + } + + /** + * Remove a filter by instance or name. + * + * @param callable|string $filter + * + * @return $this + */ + public function removeFilter($filter) + { + $key = is_callable($filter) ? 0 : 1; + + $this->filters = array_values(array_filter( + $this->filters, + function ($tuple) use ($key, $filter) { + return $tuple[$key] !== $filter; + } + )); + + $this->updateInternalState(); + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Return whether given instance or name is in the filter stack. + * + * @param callable|string $filter + * + * @return bool + */ + public function hasFilter($filter) + { + $key = is_callable($filter) ? 0 : 1; + + foreach ($this->filters as $tuple) { + if ($tuple[$key] === $filter) { + return true; + } + } + + return false; + } + + /** + * Get filters stack. + * + * @return array + */ + public function getFilters() + { + return $this->filters; + } + + /** + * Set filters stack. + * + * @param array $filters + * + * @return $this + */ + public function setFilters(array $filters) + { + $this->filters = $filters; + + $this->updateInternalState(); + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Reset filters stack. + * + * @return $this + */ + public function resetFilters() + { + $this->filters = array(); + + if ($this->endDate !== null) { + $this->filters[] = array(static::END_DATE_FILTER, null); + } + + if ($this->recurrences !== null) { + $this->filters[] = array(static::RECURRENCES_FILTER, null); + } + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Update properties after removing built-in filters. + * + * @return void + */ + protected function updateInternalState() + { + if (!$this->hasFilter(static::END_DATE_FILTER)) { + $this->endDate = null; + } + + if (!$this->hasFilter(static::RECURRENCES_FILTER)) { + $this->recurrences = null; + } + } + + /** + * Add a recurrences filter (set maximum number of recurrences). + * + * @param int|null $recurrences + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setRecurrences($recurrences) + { + if (!is_numeric($recurrences) && !is_null($recurrences) || $recurrences < 0) { + throw new InvalidArgumentException('Invalid number of recurrences.'); + } + + if ($recurrences === null) { + return $this->removeFilter(static::RECURRENCES_FILTER); + } + + $this->recurrences = (int) $recurrences; + + if (!$this->hasFilter(static::RECURRENCES_FILTER)) { + return $this->addFilter(static::RECURRENCES_FILTER); + } + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Recurrences filter callback (limits number of recurrences). + * + * @param \Carbon\Carbon $current + * @param int $key + * + * @return bool|string + */ + protected function filterRecurrences($current, $key) + { + if ($key < $this->recurrences) { + return true; + } + + return static::END_ITERATION; + } + + /** + * Change the period start date. + * + * @param DateTime|DateTimeInterface|string $date + * @param bool|null $inclusive + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setStartDate($date, $inclusive = null) + { + if (!$date = Carbon::make($date)) { + throw new InvalidArgumentException('Invalid start date.'); + } + + $this->startDate = $date; + + if ($inclusive !== null) { + $this->toggleOptions(static::EXCLUDE_START_DATE, !$inclusive); + } + + return $this; + } + + /** + * Change the period end date. + * + * @param DateTime|DateTimeInterface|string|null $date + * @param bool|null $inclusive + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setEndDate($date, $inclusive = null) + { + if (!is_null($date) && !$date = Carbon::make($date)) { + throw new InvalidArgumentException('Invalid end date.'); + } + + if (!$date) { + return $this->removeFilter(static::END_DATE_FILTER); + } + + $this->endDate = $date; + + if ($inclusive !== null) { + $this->toggleOptions(static::EXCLUDE_END_DATE, !$inclusive); + } + + if (!$this->hasFilter(static::END_DATE_FILTER)) { + return $this->addFilter(static::END_DATE_FILTER); + } + + $this->handleChangedParameters(); + + return $this; + } + + /** + * End date filter callback. + * + * @param \Carbon\Carbon $current + * + * @return bool|string + */ + protected function filterEndDate($current) + { + if (!$this->isEndExcluded() && $current == $this->endDate) { + return true; + } + + if ($this->dateInterval->invert ? $current > $this->endDate : $current < $this->endDate) { + return true; + } + + return static::END_ITERATION; + } + + /** + * End iteration filter callback. + * + * @return string + */ + protected function endIteration() + { + return static::END_ITERATION; + } + + /** + * Handle change of the parameters. + */ + protected function handleChangedParameters() + { + $this->validationResult = null; + } + + /** + * Validate current date and stop iteration when necessary. + * + * Returns true when current date is valid, false if it is not, or static::END_ITERATION + * when iteration should be stopped. + * + * @return bool|static::END_ITERATION + */ + protected function validateCurrentDate() + { + if ($this->current === null) { + $this->rewind(); + } + + // Check after the first rewind to avoid repeating the initial validation. + if ($this->validationResult !== null) { + return $this->validationResult; + } + + return $this->validationResult = $this->checkFilters(); + } + + /** + * Check whether current value and key pass all the filters. + * + * @return bool|string + */ + protected function checkFilters() + { + $current = $this->prepareForReturn($this->current); + + foreach ($this->filters as $tuple) { + $result = call_user_func( + $tuple[0], $current->copy(), $this->key, $this + ); + + if ($result === static::END_ITERATION) { + return static::END_ITERATION; + } + + if (!$result) { + return false; + } + } + + return true; + } + + /** + * Prepare given date to be returned to the external logic. + * + * @param Carbon $date + * + * @return Carbon + */ + protected function prepareForReturn(Carbon $date) + { + $date = $date->copy(); + + if ($this->timezone) { + $date->setTimezone($this->timezone); + } + + return $date; + } + + /** + * Check if the current position is valid. + * + * @return bool + */ + public function valid() + { + return $this->validateCurrentDate() === true; + } + + /** + * Return the current key. + * + * @return int|null + */ + public function key() + { + if ($this->valid()) { + return $this->key; + } + } + + /** + * Return the current date. + * + * @return Carbon|null + */ + public function current() + { + if ($this->valid()) { + return $this->prepareForReturn($this->current); + } + } + + /** + * Move forward to the next date. + * + * @throws \RuntimeException + * + * @return void + */ + public function next() + { + if ($this->current === null) { + $this->rewind(); + } + + if ($this->validationResult !== static::END_ITERATION) { + $this->key++; + + $this->incrementCurrentDateUntilValid(); + } + } + + /** + * Rewind to the start date. + * + * Iterating over a date in the UTC timezone avoids bug during backward DST change. + * + * @see https://bugs.php.net/bug.php?id=72255 + * @see https://bugs.php.net/bug.php?id=74274 + * @see https://wiki.php.net/rfc/datetime_and_daylight_saving_time + * + * @throws \RuntimeException + * + * @return void + */ + public function rewind() + { + $this->key = 0; + $this->current = $this->startDate->copy(); + $this->timezone = static::intervalHasTime($this->dateInterval) ? $this->current->getTimezone() : null; + + if ($this->timezone) { + $this->current->setTimezone('UTC'); + } + + $this->validationResult = null; + + if ($this->isStartExcluded() || $this->validateCurrentDate() === false) { + $this->incrementCurrentDateUntilValid(); + } + } + + /** + * Skip iterations and returns iteration state (false if ended, true if still valid). + * + * @param int $count steps number to skip (1 by default) + * + * @return bool + */ + public function skip($count = 1) + { + for ($i = $count; $this->valid() && $i > 0; $i--) { + $this->next(); + } + + return $this->valid(); + } + + /** + * Keep incrementing the current date until a valid date is found or the iteration is ended. + * + * @throws \RuntimeException + * + * @return void + */ + protected function incrementCurrentDateUntilValid() + { + $attempts = 0; + + do { + $this->current->add($this->dateInterval); + + $this->validationResult = null; + + if (++$attempts > static::NEXT_MAX_ATTEMPTS) { + throw new RuntimeException('Could not find next valid date.'); + } + } while ($this->validateCurrentDate() === false); + } + + /** + * Format the date period as ISO 8601. + * + * @return string + */ + public function toIso8601String() + { + $parts = array(); + + if ($this->recurrences !== null) { + $parts[] = 'R'.$this->recurrences; + } + + $parts[] = $this->startDate->toIso8601String(); + + $parts[] = $this->dateInterval->spec(); + + if ($this->endDate !== null) { + $parts[] = $this->endDate->toIso8601String(); + } + + return implode('/', $parts); + } + + /** + * Convert the date period into a string. + * + * @return string + */ + public function toString() + { + $translator = Carbon::getTranslator(); + + $parts = array(); + + $format = !$this->startDate->isStartOfDay() || $this->endDate && !$this->endDate->isStartOfDay() + ? 'Y-m-d H:i:s' + : 'Y-m-d'; + + if ($this->recurrences !== null) { + $parts[] = $translator->transChoice('period_recurrences', $this->recurrences, array(':count' => $this->recurrences)); + } + + $parts[] = $translator->trans('period_interval', array(':interval' => $this->dateInterval->forHumans())); + + $parts[] = $translator->trans('period_start_date', array(':date' => $this->startDate->format($format))); + + if ($this->endDate !== null) { + $parts[] = $translator->trans('period_end_date', array(':date' => $this->endDate->format($format))); + } + + $result = implode(' ', $parts); + + return mb_strtoupper(mb_substr($result, 0, 1)).mb_substr($result, 1); + } + + /** + * Format the date period as ISO 8601. + * + * @return string + */ + public function spec() + { + return $this->toIso8601String(); + } + + /** + * Convert the date period into an array without changing current iteration state. + * + * @return array + */ + public function toArray() + { + $state = array( + $this->key, + $this->current ? $this->current->copy() : null, + $this->validationResult, + ); + + $result = iterator_to_array($this); + + list( + $this->key, + $this->current, + $this->validationResult + ) = $state; + + return $result; + } + + /** + * Count dates in the date period. + * + * @return int + */ + public function count() + { + return count($this->toArray()); + } + + /** + * Return the first date in the date period. + * + * @return Carbon|null + */ + public function first() + { + if ($array = $this->toArray()) { + return $array[0]; + } + } + + /** + * Return the last date in the date period. + * + * @return Carbon|null + */ + public function last() + { + if ($array = $this->toArray()) { + return $array[count($array) - 1]; + } + } + + /** + * Call given macro. + * + * @param string $name + * @param array $parameters + * + * @return mixed + */ + protected function callMacro($name, $parameters) + { + $macro = static::$macros[$name]; + + $reflection = new ReflectionFunction($macro); + + $reflectionParameters = $reflection->getParameters(); + + $expectedCount = count($reflectionParameters); + $actualCount = count($parameters); + + if ($expectedCount > $actualCount && $reflectionParameters[$expectedCount - 1]->name === 'self') { + for ($i = $actualCount; $i < $expectedCount - 1; $i++) { + $parameters[] = $reflectionParameters[$i]->getDefaultValue(); + } + + $parameters[] = $this; + } + + if ($macro instanceof Closure && method_exists($macro, 'bindTo')) { + $macro = $macro->bindTo($this, get_class($this)); + } + + return call_user_func_array($macro, $parameters); + } + + /** + * Convert the date period into a string. + * + * @return string + */ + public function __toString() + { + return $this->toString(); + } + + /** + * Add aliases for setters. + * + * CarbonPeriod::days(3)->hours(5)->invert() + * ->sinceNow()->until('2010-01-10') + * ->filter(...) + * ->count() + * + * Note: We use magic method to let static and instance aliases with the same names. + * + * @param string $method + * @param array $parameters + * + * @return mixed + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->callMacro($method, $parameters); + } + + $first = count($parameters) >= 1 ? $parameters[0] : null; + $second = count($parameters) >= 2 ? $parameters[1] : null; + + switch ($method) { + case 'start': + case 'since': + return $this->setStartDate($first, $second); + + case 'sinceNow': + return $this->setStartDate(new Carbon, $first); + + case 'end': + case 'until': + return $this->setEndDate($first, $second); + + case 'untilNow': + return $this->setEndDate(new Carbon, $first); + + case 'dates': + case 'between': + return $this->setDates($first, $second); + + case 'recurrences': + case 'times': + return $this->setRecurrences($first); + + case 'options': + return $this->setOptions($first); + + case 'toggle': + return $this->toggleOptions($first, $second); + + case 'filter': + case 'push': + return $this->addFilter($first, $second); + + case 'prepend': + return $this->prependFilter($first, $second); + + case 'filters': + return $this->setFilters($first ?: array()); + + case 'interval': + case 'each': + case 'every': + case 'step': + case 'stepBy': + return $this->setDateInterval($first); + + case 'invert': + return $this->invertDateInterval(); + + case 'years': + case 'year': + case 'months': + case 'month': + case 'weeks': + case 'week': + case 'days': + case 'dayz': + case 'day': + case 'hours': + case 'hour': + case 'minutes': + case 'minute': + case 'seconds': + case 'second': + return $this->setDateInterval(call_user_func( + // Override default P1D when instantiating via fluent setters. + array($this->isDefaultInterval ? new CarbonInterval('PT0S') : $this->dateInterval, $method), + count($parameters) === 0 ? 1 : $first + )); + } + + throw new BadMethodCallException("Method $method does not exist."); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php new file mode 100644 index 0000000..1b0d473 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use Exception; +use InvalidArgumentException; + +class InvalidDateException extends InvalidArgumentException +{ + /** + * The invalid field. + * + * @var string + */ + private $field; + + /** + * The invalid value. + * + * @var mixed + */ + private $value; + + /** + * Constructor. + * + * @param string $field + * @param mixed $value + * @param int $code + * @param \Exception|null $previous + */ + public function __construct($field, $value, $code = 0, Exception $previous = null) + { + $this->field = $field; + $this->value = $value; + parent::__construct($field.' : '.$value.' is not a valid value.', $code, $previous); + } + + /** + * Get the invalid field. + * + * @return string + */ + public function getField() + { + return $this->field; + } + + /** + * Get the invalid value. + * + * @return mixed + */ + public function getValue() + { + return $this->value; + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/af.php b/vendor/nesbot/carbon/src/Carbon/Lang/af.php new file mode 100644 index 0000000..5cf6a8d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/af.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count jaar|:count jare', + 'y' => ':count jaar|:count jare', + 'month' => ':count maand|:count maande', + 'm' => ':count maand|:count maande', + 'week' => ':count week|:count weke', + 'w' => ':count week|:count weke', + 'day' => ':count dag|:count dae', + 'd' => ':count dag|:count dae', + 'hour' => ':count uur|:count ure', + 'h' => ':count uur|:count ure', + 'minute' => ':count minuut|:count minute', + 'min' => ':count minuut|:count minute', + 'second' => ':count sekond|:count sekondes', + 's' => ':count sekond|:count sekondes', + 'ago' => ':time terug', + 'from_now' => ':time van nou af', + 'after' => ':time na', + 'before' => ':time voor', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar.php new file mode 100644 index 0000000..de8f6b8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '{0}سنة|{1}سنة|{2}سنتين|[3,10]:count سنوات|[11,Inf]:count سنة', + 'y' => '{0}سنة|{1}سنة|{2}سنتين|[3,10]:count سنوات|[11,Inf]:count سنة', + 'month' => '{0}شهر|{1} شهر|{2}شهرين|[3,10]:count أشهر|[11,Inf]:count شهر', + 'm' => '{0}شهر|{1} شهر|{2}شهرين|[3,10]:count أشهر|[11,Inf]:count شهر', + 'week' => '{0}أسبوع|{1}أسبوع|{2}أسبوعين|[3,10]:count أسابيع|[11,Inf]:count أسبوع', + 'w' => '{0}أسبوع|{1}أسبوع|{2}أسبوعين|[3,10]:count أسابيع|[11,Inf]:count أسبوع', + 'day' => '{0}يوم|{1}يوم|{2}يومين|[3,10]:count أيام|[11,Inf] يوم', + 'd' => '{0}يوم|{1}يوم|{2}يومين|[3,10]:count أيام|[11,Inf] يوم', + 'hour' => '{0}ساعة|{1}ساعة|{2}ساعتين|[3,10]:count ساعات|[11,Inf]:count ساعة', + 'h' => '{0}ساعة|{1}ساعة|{2}ساعتين|[3,10]:count ساعات|[11,Inf]:count ساعة', + 'minute' => '{0}دقيقة|{1}دقيقة|{2}دقيقتين|[3,10]:count دقائق|[11,Inf]:count دقيقة', + 'min' => '{0}دقيقة|{1}دقيقة|{2}دقيقتين|[3,10]:count دقائق|[11,Inf]:count دقيقة', + 'second' => '{0}ثانية|{1}ثانية|{2}ثانيتين|[3,10]:count ثوان|[11,Inf]:count ثانية', + 's' => '{0}ثانية|{1}ثانية|{2}ثانيتين|[3,10]:count ثوان|[11,Inf]:count ثانية', + 'ago' => 'منذ :time', + 'from_now' => ':time من الآن', + 'after' => 'بعد :time', + 'before' => 'قبل :time', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar_Shakl.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar_Shakl.php new file mode 100644 index 0000000..846ae02 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar_Shakl.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '[0,1] سَنَة|{2} سَنَتَيْن|[3,10]:count سَنَوَات|[11,Inf]:count سَنَة', + 'y' => '[0,1] سَنَة|{2} سَنَتَيْن|[3,10]:count سَنَوَات|[11,Inf]:count سَنَة', + 'month' => '[0,1] شَهْرَ|{2} شَهْرَيْن|[3,10]:count أَشْهÙر|[11,Inf]:count شَهْرَ', + 'm' => '[0,1] شَهْرَ|{2} شَهْرَيْن|[3,10]:count أَشْهÙر|[11,Inf]:count شَهْرَ', + 'week' => '[0,1] Ø£ÙسْبÙوع|{2} Ø£ÙسْبÙوعَيْن|[3,10]:count أَسَابÙيع|[11,Inf]:count Ø£ÙسْبÙوع', + 'w' => '[0,1] Ø£ÙسْبÙوع|{2} Ø£ÙسْبÙوعَيْن|[3,10]:count أَسَابÙيع|[11,Inf]:count Ø£ÙسْبÙوع', + 'day' => '[0,1] يَوْم|{2} يَوْمَيْن|[3,10]:count أَيَّام|[11,Inf] يَوْم', + 'd' => '[0,1] يَوْم|{2} يَوْمَيْن|[3,10]:count أَيَّام|[11,Inf] يَوْم', + 'hour' => '[0,1] سَاعَة|{2} سَاعَتَيْن|[3,10]:count سَاعَات|[11,Inf]:count سَاعَة', + 'h' => '[0,1] سَاعَة|{2} سَاعَتَيْن|[3,10]:count سَاعَات|[11,Inf]:count سَاعَة', + 'minute' => '[0,1] دَقÙيقَة|{2} دَقÙيقَتَيْن|[3,10]:count دَقَائÙÙ‚|[11,Inf]:count دَقÙيقَة', + 'min' => '[0,1] دَقÙيقَة|{2} دَقÙيقَتَيْن|[3,10]:count دَقَائÙÙ‚|[11,Inf]:count دَقÙيقَة', + 'second' => '[0,1] ثَانÙÙŠÙŽØ©|{2} ثَانÙيَتَيْن|[3,10]:count ثَوَان|[11,Inf]:count ثَانÙÙŠÙŽØ©', + 's' => '[0,1] ثَانÙÙŠÙŽØ©|{2} ثَانÙيَتَيْن|[3,10]:count ثَوَان|[11,Inf]:count ثَانÙÙŠÙŽØ©', + 'ago' => 'Ù…Ùنْذ٠:time', + 'from_now' => 'Ù…ÙÙ†ÙŽ الْآن :time', + 'after' => 'بَعْدَ :time', + 'before' => 'قَبْلَ :time', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/az.php b/vendor/nesbot/carbon/src/Carbon/Lang/az.php new file mode 100644 index 0000000..25f5c4a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/az.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count il', + 'y' => ':count il', + 'month' => ':count ay', + 'm' => ':count ay', + 'week' => ':count hÉ™ftÉ™', + 'w' => ':count hÉ™ftÉ™', + 'day' => ':count gün', + 'd' => ':count gün', + 'hour' => ':count saat', + 'h' => ':count saat', + 'minute' => ':count dÉ™qiqÉ™', + 'min' => ':count dÉ™qiqÉ™', + 'second' => ':count saniyÉ™', + 's' => ':count saniyÉ™', + 'ago' => ':time É™vvÉ™l', + 'from_now' => ':time sonra', + 'after' => ':time sonra', + 'before' => ':time É™vvÉ™l', + 'diff_now' => 'indi', + 'diff_yesterday' => 'dünÉ™n', + 'diff_tomorrow' => 'sabah', + 'diff_before_yesterday' => 'sraÄŸagün', + 'diff_after_tomorrow' => 'birisi gün', + 'period_recurrences' => ':count dÉ™fÉ™dÉ™n bir', + 'period_interval' => 'hÉ™r :interval', + 'period_start_date' => ':date tarixindÉ™n baÅŸlayaraq', + 'period_end_date' => ':date tarixinÉ™dÉ™k', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bg.php b/vendor/nesbot/carbon/src/Carbon/Lang/bg.php new file mode 100644 index 0000000..d9e510b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bg.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count година|:count години', + 'y' => ':count година|:count години', + 'month' => ':count меÑец|:count меÑеца', + 'm' => ':count меÑец|:count меÑеца', + 'week' => ':count Ñедмица|:count Ñедмици', + 'w' => ':count Ñедмица|:count Ñедмици', + 'day' => ':count ден|:count дни', + 'd' => ':count ден|:count дни', + 'hour' => ':count чаÑ|:count чаÑа', + 'h' => ':count чаÑ|:count чаÑа', + 'minute' => ':count минута|:count минути', + 'min' => ':count минута|:count минути', + 'second' => ':count Ñекунда|:count Ñекунди', + 's' => ':count Ñекунда|:count Ñекунди', + 'ago' => 'преди :time', + 'from_now' => ':time от Ñега', + 'after' => 'Ñлед :time', + 'before' => 'преди :time', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bn.php b/vendor/nesbot/carbon/src/Carbon/Lang/bn.php new file mode 100644 index 0000000..5817599 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bn.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '১ বছর|:count বছর', + 'y' => '১ বছর|:count বছর', + 'month' => '১ মাস|:count মাস', + 'm' => '১ মাস|:count মাস', + 'week' => '১ সপà§à¦¤à¦¾à¦¹|:count সপà§à¦¤à¦¾à¦¹', + 'w' => '১ সপà§à¦¤à¦¾à¦¹|:count সপà§à¦¤à¦¾à¦¹', + 'day' => '১ দিন|:count দিন', + 'd' => '১ দিন|:count দিন', + 'hour' => '১ ঘনà§à¦Ÿà¦¾|:count ঘনà§à¦Ÿà¦¾', + 'h' => '১ ঘনà§à¦Ÿà¦¾|:count ঘনà§à¦Ÿà¦¾', + 'minute' => '১ মিনিট|:count মিনিট', + 'min' => '১ মিনিট|:count মিনিট', + 'second' => '১ সেকেনà§à¦¡|:count সেকেনà§à¦¡', + 's' => '১ সেকেনà§à¦¡|:count সেকেনà§à¦¡', + 'ago' => ':time পূরà§à¦¬à§‡', + 'from_now' => 'à¦à¦–ন থেকে :time', + 'after' => ':time পরে', + 'before' => ':time আগে', + 'diff_now' => 'à¦à¦–ন', + 'diff_yesterday' => 'গতকাল', + 'diff_tomorrow' => 'আগামীকাল', + 'period_recurrences' => ':count বার|:count বার', + 'period_interval' => 'পà§à¦°à¦¤à¦¿ :interval', + 'period_start_date' => ':date থেকে', + 'period_end_date' => ':date পরà§à¦¯à¦¨à§à¦¤', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php b/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php new file mode 100644 index 0000000..7a9b05a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count godina|:count godine|:count godina', + 'y' => ':count godina|:count godine|:count godina', + 'month' => ':count mjesec|:count mjeseca|:count mjeseci', + 'm' => ':count mjesec|:count mjeseca|:count mjeseci', + 'week' => ':count nedjelja|:count nedjelje|:count nedjelja', + 'w' => ':count nedjelja|:count nedjelje|:count nedjelja', + 'day' => ':count dan|:count dana|:count dana', + 'd' => ':count dan|:count dana|:count dana', + 'hour' => ':count sat|:count sata|:count sati', + 'h' => ':count sat|:count sata|:count sati', + 'minute' => ':count minut|:count minuta|:count minuta', + 'min' => ':count minut|:count minuta|:count minuta', + 'second' => ':count sekund|:count sekunda|:count sekundi', + 's' => ':count sekund|:count sekunda|:count sekundi', + 'ago' => 'prije :time', + 'from_now' => 'za :time', + 'after' => 'nakon :time', + 'before' => ':time ranije', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ca.php b/vendor/nesbot/carbon/src/Carbon/Lang/ca.php new file mode 100644 index 0000000..c854b5a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ca.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count any|:count anys', + 'y' => ':count any|:count anys', + 'month' => ':count mes|:count mesos', + 'm' => ':count mes|:count mesos', + 'week' => ':count setmana|:count setmanes', + 'w' => ':count setmana|:count setmanes', + 'day' => ':count dia|:count dies', + 'd' => ':count dia|:count dies', + 'hour' => ':count hora|:count hores', + 'h' => ':count hora|:count hores', + 'minute' => ':count minut|:count minuts', + 'min' => ':count minut|:count minuts', + 'second' => ':count segon|:count segons', + 's' => ':count segon|:count segons', + 'ago' => 'fa :time', + 'from_now' => 'd\'aquí :time', + 'after' => ':time després', + 'before' => ':time abans', + 'diff_now' => 'ara mateix', + 'diff_yesterday' => 'ahir', + 'diff_tomorrow' => 'demà', + 'diff_before_yesterday' => "abans d'ahir", + 'diff_after_tomorrow' => 'demà passat', + 'period_recurrences' => ':count cop|:count cops', + 'period_interval' => 'cada :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'fins a :date', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/cs.php b/vendor/nesbot/carbon/src/Carbon/Lang/cs.php new file mode 100644 index 0000000..a447ce2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/cs.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count rok|:count roky|:count let', + 'y' => ':count rok|:count roky|:count let', + 'month' => ':count mÄ›síc|:count mÄ›síce|:count mÄ›síců', + 'm' => ':count mÄ›síc|:count mÄ›síce|:count mÄ›síců', + 'week' => ':count týden|:count týdny|:count týdnů', + 'w' => ':count týden|:count týdny|:count týdnů', + 'day' => ':count den|:count dny|:count dní', + 'd' => ':count den|:count dny|:count dní', + 'hour' => ':count hodinu|:count hodiny|:count hodin', + 'h' => ':count hodinu|:count hodiny|:count hodin', + 'minute' => ':count minutu|:count minuty|:count minut', + 'min' => ':count minutu|:count minuty|:count minut', + 'second' => ':count sekundu|:count sekundy|:count sekund', + 's' => ':count sekundu|:count sekundy|:count sekund', + 'ago' => ':time nazpÄ›t', + 'from_now' => 'za :time', + 'after' => ':time pozdÄ›ji', + 'before' => ':time pÅ™edtím', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/cy.php b/vendor/nesbot/carbon/src/Carbon/Lang/cy.php new file mode 100644 index 0000000..c93750e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/cy.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +return array( + 'year' => '1 flwyddyn|:count blynedd', + 'y' => ':countbl', + 'month' => '1 mis|:count fis', + 'm' => ':countmi', + 'week' => ':count wythnos', + 'w' => ':countw', + 'day' => ':count diwrnod', + 'd' => ':countd', + 'hour' => ':count awr', + 'h' => ':counth', + 'minute' => ':count munud', + 'min' => ':countm', + 'second' => ':count eiliad', + 's' => ':counts', + 'ago' => ':time yn ôl', + 'from_now' => ':time o hyn ymlaen', + 'after' => ':time ar ôl', + 'before' => ':time o\'r blaen', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/da.php b/vendor/nesbot/carbon/src/Carbon/Lang/da.php new file mode 100644 index 0000000..86507b0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/da.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count Ã¥r|:count Ã¥r', + 'y' => ':count Ã¥r|:count Ã¥r', + 'month' => ':count mÃ¥ned|:count mÃ¥neder', + 'm' => ':count mÃ¥ned|:count mÃ¥neder', + 'week' => ':count uge|:count uger', + 'w' => ':count uge|:count uger', + 'day' => ':count dag|:count dage', + 'd' => ':count dag|:count dage', + 'hour' => ':count time|:count timer', + 'h' => ':count time|:count timer', + 'minute' => ':count minut|:count minutter', + 'min' => ':count minut|:count minutter', + 'second' => ':count sekund|:count sekunder', + 's' => ':count sekund|:count sekunder', + 'ago' => ':time siden', + 'from_now' => 'om :time', + 'after' => ':time efter', + 'before' => ':time før', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/de.php b/vendor/nesbot/carbon/src/Carbon/Lang/de.php new file mode 100644 index 0000000..5ea2a03 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/de.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count Jahr|:count Jahre', + 'y' => ':countJ|:countJ', + 'month' => ':count Monat|:count Monate', + 'm' => ':countMon|:countMon', + 'week' => ':count Woche|:count Wochen', + 'w' => ':countWo|:countWo', + 'day' => ':count Tag|:count Tage', + 'd' => ':countTg|:countTg', + 'hour' => ':count Stunde|:count Stunden', + 'h' => ':countStd|:countStd', + 'minute' => ':count Minute|:count Minuten', + 'min' => ':countMin|:countMin', + 'second' => ':count Sekunde|:count Sekunden', + 's' => ':countSek|:countSek', + 'ago' => 'vor :time', + 'from_now' => 'in :time', + 'after' => ':time später', + 'before' => ':time zuvor', + + 'year_from_now' => ':count Jahr|:count Jahren', + 'month_from_now' => ':count Monat|:count Monaten', + 'week_from_now' => ':count Woche|:count Wochen', + 'day_from_now' => ':count Tag|:count Tagen', + 'year_ago' => ':count Jahr|:count Jahren', + 'month_ago' => ':count Monat|:count Monaten', + 'week_ago' => ':count Woche|:count Wochen', + 'day_ago' => ':count Tag|:count Tagen', + + 'diff_now' => 'Gerade eben', + 'diff_yesterday' => 'Gestern', + 'diff_tomorrow' => 'Heute', + 'diff_before_yesterday' => 'Vorgestern', + 'diff_after_tomorrow' => 'Ãœbermorgen', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/dv_MV.php b/vendor/nesbot/carbon/src/Carbon/Lang/dv_MV.php new file mode 100644 index 0000000..e3c50b3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/dv_MV.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '{0}Þ‡Þ¦Þ€Þ¦ÞƒÞ¬Þ‡Þ°|[1,Inf]:count Þ‡Þ¦Þ€Þ¦ÞƒÞª', + 'y' => '{0}Þ‡Þ¦Þ€Þ¦ÞƒÞ¬Þ‡Þ°|[1,Inf]:count Þ‡Þ¦Þ€Þ¦ÞƒÞª', + 'month' => '{0}Þ‰Þ¦Þ‡Þ°ÞÞ¦ÞƒÞ¬Þ‡Þ°|[1,Inf]:count Þ‰Þ¦ÞÞ°', + 'm' => '{0}Þ‰Þ¦Þ‡Þ°ÞÞ¦ÞƒÞ¬Þ‡Þ°|[1,Inf]:count Þ‰Þ¦ÞÞ°', + 'week' => '{0}ހަފްތާއެއް|[1,Inf]:count ހަފްތާ', + 'w' => '{0}ހަފްތާއެއް|[1,Inf]:count ހަފްތާ', + 'day' => '{0}Þ‹ÞªÞˆÞ¦ÞÞ°|[1,Inf]:count Þ‹ÞªÞˆÞ¦ÞÞ°', + 'd' => '{0}Þ‹ÞªÞˆÞ¦ÞÞ°|[1,Inf]:count Þ‹ÞªÞˆÞ¦ÞÞ°', + 'hour' => '{0}ÞŽÞ¦Þ‘Þ¨Þ‡Þ¨ÞƒÞ¬Þ‡Þ°|[1,Inf]:count ÞŽÞ¦Þ‘Þ¨', + 'h' => '{0}ÞŽÞ¦Þ‘Þ¨Þ‡Þ¨ÞƒÞ¬Þ‡Þ°|[1,Inf]:count ÞŽÞ¦Þ‘Þ¨', + 'minute' => '{0}Þ‰Þ¨Þ‚Þ¬Þ“Þ¬Þ‡Þ°|[1,Inf]:count Þ‰Þ¨Þ‚Þ¬Þ“Þ°', + 'min' => '{0}Þ‰Þ¨Þ‚Þ¬Þ“Þ¬Þ‡Þ°|[1,Inf]:count Þ‰Þ¨Þ‚Þ¬Þ“Þ°', + 'second' => '{0}Þިކުންތެއް|[1,Inf]:count Þިކުންތު', + 's' => '{0}Þިކުންތެއް|[1,Inf]:count Þިކުންތު', + 'ago' => ':time Þ†ÞªÞƒÞ¨Þ‚Þ°', + 'from_now' => ':time ÞŠÞ¦Þ€ÞªÞ‚Þ°', + 'after' => ':time ÞŠÞ¦Þ€ÞªÞ‚Þ°', + 'before' => ':time Þ†ÞªÞƒÞ¨', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/el.php b/vendor/nesbot/carbon/src/Carbon/Lang/el.php new file mode 100644 index 0000000..16b3f44 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/el.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count χÏόνος|:count χÏόνια', + 'y' => ':count χÏόνος|:count χÏόνια', + 'month' => ':count μήνας|:count μήνες', + 'm' => ':count μήνας|:count μήνες', + 'week' => ':count εβδομάδα|:count εβδομάδες', + 'w' => ':count εβδομάδα|:count εβδομάδες', + 'day' => ':count μέÏα|:count μέÏες', + 'd' => ':count μέÏα|:count μέÏες', + 'hour' => ':count ÏŽÏα|:count ÏŽÏες', + 'h' => ':count ÏŽÏα|:count ÏŽÏες', + 'minute' => ':count λεπτό|:count λεπτά', + 'min' => ':count λεπτό|:count λεπτά', + 'second' => ':count δευτεÏόλεπτο|:count δευτεÏόλεπτα', + 's' => ':count δευτεÏόλεπτο|:count δευτεÏόλεπτα', + 'ago' => 'Ï€Ïιν από :time', + 'from_now' => 'σε :time από Ï„ÏŽÏα', + 'after' => ':time μετά', + 'before' => ':time Ï€Ïιν', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en.php b/vendor/nesbot/carbon/src/Carbon/Lang/en.php new file mode 100644 index 0000000..a15c131 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count year|:count years', + 'y' => ':countyr|:countyrs', + 'month' => ':count month|:count months', + 'm' => ':countmo|:countmos', + 'week' => ':count week|:count weeks', + 'w' => ':countw|:countw', + 'day' => ':count day|:count days', + 'd' => ':countd|:countd', + 'hour' => ':count hour|:count hours', + 'h' => ':counth|:counth', + 'minute' => ':count minute|:count minutes', + 'min' => ':countm|:countm', + 'second' => ':count second|:count seconds', + 's' => ':counts|:counts', + 'ago' => ':time ago', + 'from_now' => ':time from now', + 'after' => ':time after', + 'before' => ':time before', + 'diff_now' => 'just now', + 'diff_yesterday' => 'yesterday', + 'diff_tomorrow' => 'tomorrow', + 'diff_before_yesterday' => 'before yesterday', + 'diff_after_tomorrow' => 'after tomorrow', + 'period_recurrences' => 'once|:count times', + 'period_interval' => 'every :interval', + 'period_start_date' => 'from :date', + 'period_end_date' => 'to :date', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/eo.php b/vendor/nesbot/carbon/src/Carbon/Lang/eo.php new file mode 100644 index 0000000..c5b90b3 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/eo.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count jaro|:count jaroj', + 'y' => ':count jaro|:count jaroj', + 'month' => ':count monato|:count monatoj', + 'm' => ':count monato|:count monatoj', + 'week' => ':count semajno|:count semajnoj', + 'w' => ':count semajno|:count semajnoj', + 'day' => ':count tago|:count tagoj', + 'd' => ':count tago|:count tagoj', + 'hour' => ':count horo|:count horoj', + 'h' => ':count horo|:count horoj', + 'minute' => ':count minuto|:count minutoj', + 'min' => ':count minuto|:count minutoj', + 'second' => ':count sekundo|:count sekundoj', + 's' => ':count sekundo|:count sekundoj', + 'ago' => 'antaÅ­ :time', + 'from_now' => 'je :time', + 'after' => ':time poste', + 'before' => ':time antaÅ­e', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es.php b/vendor/nesbot/carbon/src/Carbon/Lang/es.php new file mode 100644 index 0000000..567a280 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count año|:count años', + 'y' => ':count año|:count años', + 'month' => ':count mes|:count meses', + 'm' => ':count mes|:count meses', + 'week' => ':count semana|:count semanas', + 'w' => ':count semana|:count semanas', + 'day' => ':count día|:count días', + 'd' => ':count día|:count días', + 'hour' => ':count hora|:count horas', + 'h' => ':count hora|:count horas', + 'minute' => ':count minuto|:count minutos', + 'min' => ':count minuto|:count minutos', + 'second' => ':count segundo|:count segundos', + 's' => ':count segundo|:count segundos', + 'ago' => 'hace :time', + 'from_now' => 'dentro de :time', + 'after' => ':time después', + 'before' => ':time antes', + 'diff_now' => 'ahora mismo', + 'diff_yesterday' => 'ayer', + 'diff_tomorrow' => 'mañana', + 'diff_before_yesterday' => 'antier', + 'diff_after_tomorrow' => 'pasado mañana', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/et.php b/vendor/nesbot/carbon/src/Carbon/Lang/et.php new file mode 100644 index 0000000..2d9291e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/et.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count aasta|:count aastat', + 'y' => ':count aasta|:count aastat', + 'month' => ':count kuu|:count kuud', + 'm' => ':count kuu|:count kuud', + 'week' => ':count nädal|:count nädalat', + 'w' => ':count nädal|:count nädalat', + 'day' => ':count päev|:count päeva', + 'd' => ':count päev|:count päeva', + 'hour' => ':count tund|:count tundi', + 'h' => ':count tund|:count tundi', + 'minute' => ':count minut|:count minutit', + 'min' => ':count minut|:count minutit', + 'second' => ':count sekund|:count sekundit', + 's' => ':count sekund|:count sekundit', + 'ago' => ':time tagasi', + 'from_now' => ':time pärast', + 'after' => ':time pärast', + 'before' => ':time enne', + 'year_from_now' => ':count aasta', + 'month_from_now' => ':count kuu', + 'week_from_now' => ':count nädala', + 'day_from_now' => ':count päeva', + 'hour_from_now' => ':count tunni', + 'minute_from_now' => ':count minuti', + 'second_from_now' => ':count sekundi', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/eu.php b/vendor/nesbot/carbon/src/Carbon/Lang/eu.php new file mode 100644 index 0000000..1cb6b7c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/eu.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => 'Urte 1|:count urte', + 'y' => 'Urte 1|:count urte', + 'month' => 'Hile 1|:count hile', + 'm' => 'Hile 1|:count hile', + 'week' => 'Aste 1|:count aste', + 'w' => 'Aste 1|:count aste', + 'day' => 'Egun 1|:count egun', + 'd' => 'Egun 1|:count egun', + 'hour' => 'Ordu 1|:count ordu', + 'h' => 'Ordu 1|:count ordu', + 'minute' => 'Minutu 1|:count minutu', + 'min' => 'Minutu 1|:count minutu', + 'second' => 'Segundu 1|:count segundu', + 's' => 'Segundu 1|:count segundu', + 'ago' => 'Orain dela :time', + 'from_now' => ':time barru', + 'after' => ':time geroago', + 'before' => ':time lehenago', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fa.php b/vendor/nesbot/carbon/src/Carbon/Lang/fa.php new file mode 100644 index 0000000..31bec88 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fa.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count سال', + 'y' => ':count سال', + 'month' => ':count ماه', + 'm' => ':count ماه', + 'week' => ':count Ù‡Ùته', + 'w' => ':count Ù‡Ùته', + 'day' => ':count روز', + 'd' => ':count روز', + 'hour' => ':count ساعت', + 'h' => ':count ساعت', + 'minute' => ':count دقیقه', + 'min' => ':count دقیقه', + 'second' => ':count ثانیه', + 's' => ':count ثانیه', + 'ago' => ':time پیش', + 'from_now' => ':time بعد', + 'after' => ':time پس از', + 'before' => ':time پیش از', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fi.php b/vendor/nesbot/carbon/src/Carbon/Lang/fi.php new file mode 100644 index 0000000..4818804 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fi.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count vuosi|:count vuotta', + 'y' => ':count vuosi|:count vuotta', + 'month' => ':count kuukausi|:count kuukautta', + 'm' => ':count kuukausi|:count kuukautta', + 'week' => ':count viikko|:count viikkoa', + 'w' => ':count viikko|:count viikkoa', + 'day' => ':count päivä|:count päivää', + 'd' => ':count päivä|:count päivää', + 'hour' => ':count tunti|:count tuntia', + 'h' => ':count tunti|:count tuntia', + 'minute' => ':count minuutti|:count minuuttia', + 'min' => ':count minuutti|:count minuuttia', + 'second' => ':count sekunti|:count sekuntia', + 's' => ':count sekunti|:count sekuntia', + 'ago' => ':time sitten', + 'from_now' => ':time tästä hetkestä', + 'after' => ':time sen jälkeen', + 'before' => ':time ennen', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fo.php b/vendor/nesbot/carbon/src/Carbon/Lang/fo.php new file mode 100644 index 0000000..d91104b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fo.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count ár|:count ár', + 'y' => ':count ár|:count ár', + 'month' => ':count mánaður|:count mánaðir', + 'm' => ':count mánaður|:count mánaðir', + 'week' => ':count vika|:count vikur', + 'w' => ':count vika|:count vikur', + 'day' => ':count dag|:count dagar', + 'd' => ':count dag|:count dagar', + 'hour' => ':count tími|:count tímar', + 'h' => ':count tími|:count tímar', + 'minute' => ':count minutt|:count minuttir', + 'min' => ':count minutt|:count minuttir', + 'second' => ':count sekund|:count sekundir', + 's' => ':count sekund|:count sekundir', + 'ago' => ':time síðan', + 'from_now' => 'um :time', + 'after' => ':time aftaná', + 'before' => ':time áðrenn', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr.php new file mode 100644 index 0000000..0b20cdd --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count an|:count ans', + 'y' => ':count an|:count ans', + 'month' => ':count mois', + 'm' => ':count mois', + 'week' => ':count semaine|:count semaines', + 'w' => ':count sem.', + 'day' => ':count jour|:count jours', + 'd' => ':count j.', + 'hour' => ':count heure|:count heures', + 'h' => ':count h.', + 'minute' => ':count minute|:count minutes', + 'min' => ':count min.', + 'second' => ':count seconde|:count secondes', + 's' => ':count sec.', + 'ago' => 'il y a :time', + 'from_now' => 'dans :time', + 'after' => ':time après', + 'before' => ':time avant', + 'diff_now' => "à l'instant", + 'diff_yesterday' => 'hier', + 'diff_tomorrow' => 'demain', + 'diff_before_yesterday' => 'avant-hier', + 'diff_after_tomorrow' => 'après-demain', + 'period_recurrences' => ':count fois', + 'period_interval' => 'tous les :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'à :date', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gl.php b/vendor/nesbot/carbon/src/Carbon/Lang/gl.php new file mode 100644 index 0000000..cd22a31 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gl.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count ano|:count anos', + 'month' => ':count mes|:count meses', + 'week' => ':count semana|:count semanas', + 'day' => ':count día|:count días', + 'hour' => ':count hora|:count horas', + 'minute' => ':count minuto|:count minutos', + 'second' => ':count segundo|:count segundos', + 'ago' => 'fai :time', + 'from_now' => 'dentro de :time', + 'after' => ':time despois', + 'before' => ':time antes', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gu.php b/vendor/nesbot/carbon/src/Carbon/Lang/gu.php new file mode 100644 index 0000000..7759dfc --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/gu.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count વરà«àª·|:count વરà«àª·à«‹', + 'y' => ':countવરà«àª·|:countવરà«àª·à«‹', + 'month' => ':count મહિનો|:count મહિના', + 'm' => ':countમહિનો|:countમહિના', + 'week' => ':count અઠવાડિયà«àª‚|:count અઠવાડિયા', + 'w' => ':countઅઠ.|:countઅઠ.', + 'day' => ':count દિવસ|:count દિવસો', + 'd' => ':countદિ.|:countદિ.', + 'hour' => ':count કલાક|:count કલાકો', + 'h' => ':countક.|:countક.', + 'minute' => ':count મિનિટ|:count મિનિટ', + 'min' => ':countમિ.|:countમિ.', + 'second' => ':count સેકેનà«àª¡|:count સેકેનà«àª¡', + 's' => ':countસે.|:countસે.', + 'ago' => ':time પહેલા', + 'from_now' => ':time અતà«àª¯àª¾àª°àª¥à«€', + 'after' => ':time પછી', + 'before' => ':time પહેલા', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/he.php b/vendor/nesbot/carbon/src/Carbon/Lang/he.php new file mode 100644 index 0000000..2d4f4f8 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/he.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => 'שנה|{2}שנתיי×|:count שני×', + 'y' => 'שנה|{2}שנתיי×|:count שני×', + 'month' => 'חודש|{2}חודשיי×|:count חודשי×', + 'm' => 'חודש|{2}חודשיי×|:count חודשי×', + 'week' => 'שבוע|{2}שבועיי×|:count שבועות', + 'w' => 'שבוע|{2}שבועיי×|:count שבועות', + 'day' => 'יו×|{2}יומיי×|:count ימי×', + 'd' => 'יו×|{2}יומיי×|:count ימי×', + 'hour' => 'שעה|{2}שעתיי×|:count שעות', + 'h' => 'שעה|{2}שעתיי×|:count שעות', + 'minute' => 'דקה|{2}דקותיי×|:count דקות', + 'min' => 'דקה|{2}דקותיי×|:count דקות', + 'second' => 'שניה|:count שניות', + 's' => 'שניה|:count שניות', + 'ago' => 'לפני :time', + 'from_now' => 'בעוד :time', + 'after' => '×חרי :time', + 'before' => 'לפני :time', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hi.php b/vendor/nesbot/carbon/src/Carbon/Lang/hi.php new file mode 100644 index 0000000..6c670ee --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hi.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '1 वरà¥à¤·|:count वरà¥à¤·à¥‹à¤‚', + 'y' => '1 वरà¥à¤·|:count वरà¥à¤·à¥‹à¤‚', + 'month' => '1 माह|:count महीने', + 'm' => '1 माह|:count महीने', + 'week' => '1 सपà¥à¤¤à¤¾à¤¹|:count सपà¥à¤¤à¤¾à¤¹', + 'w' => '1 सपà¥à¤¤à¤¾à¤¹|:count सपà¥à¤¤à¤¾à¤¹', + 'day' => '1 दिन|:count दिनों', + 'd' => '1 दिन|:count दिनों', + 'hour' => '1 घंटा|:count घंटे', + 'h' => '1 घंटा|:count घंटे', + 'minute' => '1 मिनट|:count मिनटों', + 'min' => '1 मिनट|:count मिनटों', + 'second' => '1 सेकंड|:count सेकंड', + 's' => '1 सेकंड|:count सेकंड', + 'ago' => ':time पूरà¥à¤µ', + 'from_now' => ':time से', + 'after' => ':time के बाद', + 'before' => ':time के पहले', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hr.php b/vendor/nesbot/carbon/src/Carbon/Lang/hr.php new file mode 100644 index 0000000..1a339de --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hr.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count godinu|:count godine|:count godina', + 'y' => ':count godinu|:count godine|:count godina', + 'month' => ':count mjesec|:count mjeseca|:count mjeseci', + 'm' => ':count mjesec|:count mjeseca|:count mjeseci', + 'week' => ':count tjedan|:count tjedna|:count tjedana', + 'w' => ':count tjedan|:count tjedna|:count tjedana', + 'day' => ':count dan|:count dana|:count dana', + 'd' => ':count dan|:count dana|:count dana', + 'hour' => ':count sat|:count sata|:count sati', + 'h' => ':count sat|:count sata|:count sati', + 'minute' => ':count minutu|:count minute |:count minuta', + 'min' => ':count minutu|:count minute |:count minuta', + 'second' => ':count sekundu|:count sekunde|:count sekundi', + 's' => ':count sekundu|:count sekunde|:count sekundi', + 'ago' => 'prije :time', + 'from_now' => 'za :time', + 'after' => 'za :time', + 'before' => 'prije :time', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hu.php b/vendor/nesbot/carbon/src/Carbon/Lang/hu.php new file mode 100644 index 0000000..45daf41 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hu.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count év', + 'y' => ':count év', + 'month' => ':count hónap', + 'm' => ':count hónap', + 'week' => ':count hét', + 'w' => ':count hét', + 'day' => ':count nap', + 'd' => ':count nap', + 'hour' => ':count óra', + 'h' => ':count óra', + 'minute' => ':count perc', + 'min' => ':count perc', + 'second' => ':count másodperc', + 's' => ':count másodperc', + 'ago' => ':time', + 'from_now' => ':time múlva', + 'after' => ':time késÅ‘bb', + 'before' => ':time korábban', + 'year_ago' => ':count éve', + 'month_ago' => ':count hónapja', + 'week_ago' => ':count hete', + 'day_ago' => ':count napja', + 'hour_ago' => ':count órája', + 'minute_ago' => ':count perce', + 'second_ago' => ':count másodperce', + 'year_after' => ':count évvel', + 'month_after' => ':count hónappal', + 'week_after' => ':count héttel', + 'day_after' => ':count nappal', + 'hour_after' => ':count órával', + 'minute_after' => ':count perccel', + 'second_after' => ':count másodperccel', + 'year_before' => ':count évvel', + 'month_before' => ':count hónappal', + 'week_before' => ':count héttel', + 'day_before' => ':count nappal', + 'hour_before' => ':count órával', + 'minute_before' => ':count perccel', + 'second_before' => ':count másodperccel', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hy.php b/vendor/nesbot/carbon/src/Carbon/Lang/hy.php new file mode 100644 index 0000000..d2665f2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hy.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count Õ¿Õ¡Ö€Õ«', + 'y' => ':countÕ¿', + 'month' => ':count Õ¡Õ´Õ«Õ½', + 'm' => ':countÕ¡Õ´', + 'week' => ':count Õ·Õ¡Õ¢Õ¡Õ©', + 'w' => ':countÕ·', + 'day' => ':count Ö…Ö€', + 'd' => ':countÖ…Ö€', + 'hour' => ':count ÕªÕ¡Õ´', + 'h' => ':countÕª', + 'minute' => ':count Ö€Õ¸ÕºÕ¥', + 'min' => ':countÖ€', + 'second' => ':count Õ¾Õ¡Ö€Õ¯ÕµÕ¡Õ¶', + 's' => ':countÕ¾Ö€Õ¯', + 'ago' => ':time Õ¡Õ¼Õ¡Õ»', + 'from_now' => ':time Õ¶Õ¥Ö€Õ¯Õ¡ ÕºÕ¡Õ°Õ«Ö', + 'after' => ':time Õ°Õ¥Õ¿Õ¸', + 'before' => ':time Õ¡Õ¼Õ¡Õ»', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/id.php b/vendor/nesbot/carbon/src/Carbon/Lang/id.php new file mode 100644 index 0000000..7f7114f --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/id.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count tahun', + 'y' => ':count tahun', + 'month' => ':count bulan', + 'm' => ':count bulan', + 'week' => ':count minggu', + 'w' => ':count minggu', + 'day' => ':count hari', + 'd' => ':count hari', + 'hour' => ':count jam', + 'h' => ':count jam', + 'minute' => ':count menit', + 'min' => ':count menit', + 'second' => ':count detik', + 's' => ':count detik', + 'ago' => ':time yang lalu', + 'from_now' => ':time dari sekarang', + 'after' => ':time setelah', + 'before' => ':time sebelum', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/is.php b/vendor/nesbot/carbon/src/Carbon/Lang/is.php new file mode 100644 index 0000000..94c76a7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/is.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '1 ár|:count ár', + 'y' => '1 ár|:count ár', + 'month' => '1 mánuður|:count mánuðir', + 'm' => '1 mánuður|:count mánuðir', + 'week' => '1 vika|:count vikur', + 'w' => '1 vika|:count vikur', + 'day' => '1 dagur|:count dagar', + 'd' => '1 dagur|:count dagar', + 'hour' => '1 klukkutími|:count klukkutímar', + 'h' => '1 klukkutími|:count klukkutímar', + 'minute' => '1 mínúta|:count mínútur', + 'min' => '1 mínúta|:count mínútur', + 'second' => '1 sekúnda|:count sekúndur', + 's' => '1 sekúnda|:count sekúndur', + 'ago' => ':time síðan', + 'from_now' => ':time síðan', + 'after' => ':time eftir', + 'before' => ':time fyrir', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/it.php b/vendor/nesbot/carbon/src/Carbon/Lang/it.php new file mode 100644 index 0000000..70bc6d7 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/it.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count anno|:count anni', + 'y' => ':count anno|:count anni', + 'month' => ':count mese|:count mesi', + 'm' => ':count mese|:count mesi', + 'week' => ':count settimana|:count settimane', + 'w' => ':count settimana|:count settimane', + 'day' => ':count giorno|:count giorni', + 'd' => ':count giorno|:count giorni', + 'hour' => ':count ora|:count ore', + 'h' => ':count ora|:count ore', + 'minute' => ':count minuto|:count minuti', + 'min' => ':count minuto|:count minuti', + 'second' => ':count secondo|:count secondi', + 's' => ':count secondo|:count secondi', + 'ago' => ':time fa', + 'from_now' => 'tra :time', + 'after' => ':time dopo', + 'before' => ':time prima', + 'diff_now' => 'proprio ora', + 'diff_yesterday' => 'ieri', + 'diff_tomorrow' => 'domani', + 'diff_before_yesterday' => "l'altro ieri", + 'diff_after_tomorrow' => 'dopodomani', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ja.php b/vendor/nesbot/carbon/src/Carbon/Lang/ja.php new file mode 100644 index 0000000..7119547 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ja.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':countå¹´', + 'y' => ':countå¹´', + 'month' => ':countヶ月', + 'm' => ':countヶ月', + 'week' => ':count週間', + 'w' => ':count週間', + 'day' => ':countæ—¥', + 'd' => ':countæ—¥', + 'hour' => ':count時間', + 'h' => ':count時間', + 'minute' => ':count分', + 'min' => ':count分', + 'second' => ':count秒', + 's' => ':count秒', + 'ago' => ':timeå‰', + 'from_now' => '今ã‹ã‚‰:time', + 'after' => ':time後', + 'before' => ':timeå‰', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ka.php b/vendor/nesbot/carbon/src/Carbon/Lang/ka.php new file mode 100644 index 0000000..a8dde7e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ka.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count წლის', + 'y' => ':count წლის', + 'month' => ':count თვის', + 'm' => ':count თვის', + 'week' => ':count კვირის', + 'w' => ':count კვირის', + 'day' => ':count დღის', + 'd' => ':count დღის', + 'hour' => ':count სáƒáƒáƒ—ის', + 'h' => ':count სáƒáƒáƒ—ის', + 'minute' => ':count წუთის', + 'min' => ':count წუთის', + 'second' => ':count წáƒáƒ›áƒ˜áƒ¡', + 's' => ':count წáƒáƒ›áƒ˜áƒ¡', + 'ago' => ':time უკáƒáƒœ', + 'from_now' => ':time შემდეგ', + 'after' => ':time შემდეგ', + 'before' => ':time უკáƒáƒœ', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/kk.php b/vendor/nesbot/carbon/src/Carbon/Lang/kk.php new file mode 100644 index 0000000..8d113af --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/kk.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +return array( + 'year' => ':count жыл', + 'y' => ':count жыл', + 'month' => ':count ай', + 'm' => ':count ай', + 'week' => ':count апта', + 'w' => ':count апта', + 'day' => ':count күн', + 'd' => ':count күн', + 'hour' => ':count Ñағат', + 'h' => ':count Ñағат', + 'minute' => ':count минут', + 'min' => ':count минут', + 'second' => ':count Ñекунд', + 's' => ':count Ñекунд', + 'ago' => ':time бұрын', + 'from_now' => ':time кейін', + 'after' => ':time кейін', + 'before' => ':time бұрын', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/km.php b/vendor/nesbot/carbon/src/Carbon/Lang/km.php new file mode 100644 index 0000000..a104e06 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/km.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count ឆ្នាំ', + 'y' => ':count ឆ្នាំ', + 'month' => ':count ážáŸ‚', + 'm' => ':count ážáŸ‚', + 'week' => ':count សប្ដាហáŸ', + 'w' => ':count សប្ដាហáŸ', + 'day' => ':count ážáŸ’ងៃ', + 'd' => ':count ážáŸ’ងៃ', + 'hour' => ':count ម៉ោង', + 'h' => ':count ម៉ោង', + 'minute' => ':count នាទី', + 'min' => ':count នាទី', + 'second' => ':count វិនាទី', + 's' => ':count វិនាទី', + 'ago' => ':timeមុន', + 'from_now' => ':timeពី​ឥឡូវ', + 'after' => 'នៅ​ក្រោយ :time', + 'before' => 'នៅ​មុន :time', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ko.php b/vendor/nesbot/carbon/src/Carbon/Lang/ko.php new file mode 100644 index 0000000..0209164 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ko.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count ë…„', + 'y' => ':count ë…„', + 'month' => ':count 개월', + 'm' => ':count 개월', + 'week' => ':count 주ì¼', + 'w' => ':count 주ì¼', + 'day' => ':count ì¼', + 'd' => ':count ì¼', + 'hour' => ':count 시간', + 'h' => ':count 시간', + 'minute' => ':count 분', + 'min' => ':count 분', + 'second' => ':count ì´ˆ', + 's' => ':count ì´ˆ', + 'ago' => ':time ì „', + 'from_now' => ':time 후', + 'after' => ':time ì´í›„', + 'before' => ':time ì´ì „', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lt.php b/vendor/nesbot/carbon/src/Carbon/Lang/lt.php new file mode 100644 index 0000000..3f2fd1e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lt.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count metus|:count metus|:count metų', + 'y' => ':count metus|:count metus|:count metų', + 'month' => ':count mÄ—nesį|:count mÄ—nesius|:count mÄ—nesių', + 'm' => ':count mÄ—nesį|:count mÄ—nesius|:count mÄ—nesių', + 'week' => ':count savaitÄ™|:count savaites|:count savaiÄių', + 'w' => ':count savaitÄ™|:count savaites|:count savaiÄių', + 'day' => ':count dienÄ…|:count dienas|:count dienų', + 'd' => ':count dienÄ…|:count dienas|:count dienų', + 'hour' => ':count valandÄ…|:count valandas|:count valandų', + 'h' => ':count valandÄ…|:count valandas|:count valandų', + 'minute' => ':count minutÄ™|:count minutes|:count minuÄių', + 'min' => ':count minutÄ™|:count minutes|:count minuÄių', + 'second' => ':count sekundÄ™|:count sekundes|:count sekundžių', + 's' => ':count sekundÄ™|:count sekundes|:count sekundžių', + 'second_from_now' => ':count sekundÄ—s|:count sekundžių|:count sekundžių', + 'minute_from_now' => ':count minutÄ—s|:count minuÄių|:count minuÄių', + 'hour_from_now' => ':count valandos|:count valandų|:count valandų', + 'day_from_now' => ':count dienos|:count dienų|:count dienų', + 'week_from_now' => ':count savaitÄ—s|:count savaiÄių|:count savaiÄių', + 'month_from_now' => ':count mÄ—nesio|:count mÄ—nesių|:count mÄ—nesių', + 'year_from_now' => ':count metų', + 'ago' => 'prieÅ¡ :time', + 'from_now' => 'už :time', + 'after' => 'po :time', + 'before' => ':time nuo dabar', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lv.php b/vendor/nesbot/carbon/src/Carbon/Lang/lv.php new file mode 100644 index 0000000..363193d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/lv.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '0 gadiem|:count gada|:count gadiem', + 'y' => '0 gadiem|:count gada|:count gadiem', + 'month' => '0 mÄ“neÅ¡iem|:count mÄ“neÅ¡a|:count mÄ“neÅ¡iem', + 'm' => '0 mÄ“neÅ¡iem|:count mÄ“neÅ¡a|:count mÄ“neÅ¡iem', + 'week' => '0 nedēļÄm|:count nedēļas|:count nedēļÄm', + 'w' => '0 nedēļÄm|:count nedēļas|:count nedēļÄm', + 'day' => '0 dienÄm|:count dienas|:count dienÄm', + 'd' => '0 dienÄm|:count dienas|:count dienÄm', + 'hour' => '0 stundÄm|:count stundas|:count stundÄm', + 'h' => '0 stundÄm|:count stundas|:count stundÄm', + 'minute' => '0 minÅ«tÄ“m|:count minÅ«tes|:count minÅ«tÄ“m', + 'min' => '0 minÅ«tÄ“m|:count minÅ«tes|:count minÅ«tÄ“m', + 'second' => '0 sekundÄ“m|:count sekundes|:count sekundÄ“m', + 's' => '0 sekundÄ“m|:count sekundes|:count sekundÄ“m', + 'ago' => 'pirms :time', + 'from_now' => 'pÄ“c :time', + 'after' => ':time vÄ“lÄk', + 'before' => ':time pirms', + + 'year_after' => '0 gadus|:count gadu|:count gadus', + 'month_after' => '0 mÄ“neÅ¡us|:count mÄ“nesi|:count mÄ“neÅ¡us', + 'week_after' => '0 nedēļas|:count nedēļu|:count nedēļas', + 'day_after' => '0 dienas|:count dienu|:count dienas', + 'hour_after' => '0 stundas|:count stundu|:count stundas', + 'minute_after' => '0 minÅ«tes|:count minÅ«ti|:count minÅ«tes', + 'second_after' => '0 sekundes|:count sekundi|:count sekundes', + + 'year_before' => '0 gadus|:count gadu|:count gadus', + 'month_before' => '0 mÄ“neÅ¡us|:count mÄ“nesi|:count mÄ“neÅ¡us', + 'week_before' => '0 nedēļas|:count nedēļu|:count nedēļas', + 'day_before' => '0 dienas|:count dienu|:count dienas', + 'hour_before' => '0 stundas|:count stundu|:count stundas', + 'minute_before' => '0 minÅ«tes|:count minÅ«ti|:count minÅ«tes', + 'second_before' => '0 sekundes|:count sekundi|:count sekundes', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mk.php b/vendor/nesbot/carbon/src/Carbon/Lang/mk.php new file mode 100644 index 0000000..c5ec12d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mk.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count година|:count години', + 'month' => ':count меÑец|:count меÑеци', + 'week' => ':count Ñедмица|:count Ñедмици', + 'day' => ':count ден|:count дена', + 'hour' => ':count чаÑ|:count чаÑа', + 'minute' => ':count минута|:count минути', + 'second' => ':count Ñекунда|:count Ñекунди', + 'ago' => 'пред :time', + 'from_now' => ':time од Ñега', + 'after' => 'по :time', + 'before' => 'пред :time', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mn.php b/vendor/nesbot/carbon/src/Carbon/Lang/mn.php new file mode 100644 index 0000000..b26dce5 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/mn.php @@ -0,0 +1,62 @@ + + * + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @translator Batmandakh Erdenebileg + */ + +return array( + 'year' => ':count жил', + 'y' => ':count жил', + 'month' => ':count Ñар', + 'm' => ':count Ñар', + 'week' => ':count долоо хоног', + 'w' => ':count долоо хоног', + 'day' => ':count өдөр', + 'd' => ':count өдөр', + 'hour' => ':count цаг', + 'h' => ':countц', + 'minute' => ':count минут', + 'min' => ':countм', + 'second' => ':count Ñекунд', + 's' => ':countÑ', + + 'ago' => ':timeн өмнө', + 'year_ago' => ':count жилий', + 'month_ago' => ':count Ñары', + 'day_ago' => ':count хоногий', + 'hour_ago' => ':count цагий', + 'minute_ago' => ':count минуты', + 'second_ago' => ':count Ñекунды', + + 'from_now' => 'Ð¾Ð´Ð¾Ð¾Ð³Ð¾Ð¾Ñ :time', + 'year_from_now' => ':count жилийн дараа', + 'month_from_now' => ':count Ñарын дараа', + 'day_from_now' => ':count хоногийн дараа', + 'hour_from_now' => ':count цагийн дараа', + 'minute_from_now' => ':count минутын дараа', + 'second_from_now' => ':count Ñекундын дараа', + + // Does it required to make translation for before, after as follows? hmm, I think we've made it with ago and from now keywords already. Anyway, I've included it just in case of undesired action... + 'after' => ':timeн дараа', + 'year_after' => ':count жилий', + 'month_after' => ':count Ñары', + 'day_after' => ':count хоногий', + 'hour_after' => ':count цагий', + 'minute_after' => ':count минуты', + 'second_after' => ':count Ñекунды', + 'before' => ':timeн өмнө', + 'year_before' => ':count жилий', + 'month_before' => ':count Ñары', + 'day_before' => ':count хоногий', + 'hour_before' => ':count цагий', + 'minute_before' => ':count минуты', + 'second_before' => ':count Ñекунды', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ms.php b/vendor/nesbot/carbon/src/Carbon/Lang/ms.php new file mode 100644 index 0000000..ef57422 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ms.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count tahun', + 'y' => ':count tahun', + 'month' => ':count bulan', + 'm' => ':count bulan', + 'week' => ':count minggu', + 'w' => ':count minggu', + 'day' => ':count hari', + 'd' => ':count hari', + 'hour' => ':count jam', + 'h' => ':count jam', + 'minute' => ':count minit', + 'min' => ':count minit', + 'second' => ':count saat', + 's' => ':count saat', + 'ago' => ':time yang lalu', + 'from_now' => ':time dari sekarang', + 'after' => ':time selepas', + 'before' => ':time sebelum', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/my.php b/vendor/nesbot/carbon/src/Carbon/Lang/my.php new file mode 100644 index 0000000..e8e491e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/my.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count နှစ်|:count နှစ်', + 'y' => ':count နှစ်|:count နှစ်', + 'month' => ':count လ|:count လ', + 'm' => ':count လ|:count လ', + 'week' => ':count ပá€á€º|:count ပá€á€º', + 'w' => ':count ပá€á€º|:count ပá€á€º', + 'day' => ':count ရက်|:count ရက်', + 'd' => ':count ရက်|:count ရက်', + 'hour' => ':count နာရီ|:count နာရီ', + 'h' => ':count နာရီ|:count နာရီ', + 'minute' => ':count မိနစ်|:count မိနစ်', + 'min' => ':count မိနစ်|:count မိနစ်', + 'second' => ':count စက္ကန့်|:count စက္ကန့်', + 's' => ':count စက္ကန့်|:count စက္ကန့်', + 'ago' => 'လွန်á€á€²á€·á€žá€±á€¬ :time က', + 'from_now' => 'ယá€á€¯á€™á€¾á€…áနောက် :time အကြာ', + 'after' => ':time ကြာပြီးနောက်', + 'before' => ':time မá€á€­á€¯á€„်á€á€„်', + 'diff_now' => 'အá€á€¯á€œá€±á€¸á€á€„်', + 'diff_yesterday' => 'မနေ့က', + 'diff_tomorrow' => 'မနက်ဖြန်', + 'diff_before_yesterday' => 'á€á€™á€¼á€”်နေ့က', + 'diff_after_tomorrow' => 'á€á€˜á€€á€ºá€á€«', + 'period_recurrences' => ':count ကြိမ်', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ne.php b/vendor/nesbot/carbon/src/Carbon/Lang/ne.php new file mode 100644 index 0000000..0b528df --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ne.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count वरà¥à¤·', + 'y' => ':count वरà¥à¤·', + 'month' => ':count महिना', + 'm' => ':count महिना', + 'week' => ':count हपà¥à¤¤à¤¾', + 'w' => ':count हपà¥à¤¤à¤¾', + 'day' => ':count दिन', + 'd' => ':count दिन', + 'hour' => ':count घणà¥à¤Ÿà¤¾', + 'h' => ':count घणà¥à¤Ÿà¤¾', + 'minute' => ':count मिनेट', + 'min' => ':count मिनेट', + 'second' => ':count सेकेणà¥à¤¡', + 's' => ':count सेकेणà¥à¤¡', + 'ago' => ':time पहिले', + 'from_now' => ':time देखि', + 'after' => ':time पछि', + 'before' => ':time अघि', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nl.php b/vendor/nesbot/carbon/src/Carbon/Lang/nl.php new file mode 100644 index 0000000..ec5a88e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nl.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count jaar', + 'y' => ':count jaar', + 'month' => ':count maand|:count maanden', + 'm' => ':count maand|:count maanden', + 'week' => ':count week|:count weken', + 'w' => ':count week|:count weken', + 'day' => ':count dag|:count dagen', + 'd' => ':count dag|:count dagen', + 'hour' => ':count uur', + 'h' => ':count uur', + 'minute' => ':count minuut|:count minuten', + 'min' => ':count minuut|:count minuten', + 'second' => ':count seconde|:count seconden', + 's' => ':count seconde|:count seconden', + 'ago' => ':time geleden', + 'from_now' => 'over :time', + 'after' => ':time later', + 'before' => ':time eerder', + 'diff_now' => 'nu', + 'diff_yesterday' => 'gisteren', + 'diff_tomorrow' => 'morgen', + 'diff_after_tomorrow' => 'overmorgen', + 'diff_before_yesterday' => 'eergisteren', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/no.php b/vendor/nesbot/carbon/src/Carbon/Lang/no.php new file mode 100644 index 0000000..a6ece06 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/no.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count Ã¥r|:count Ã¥r', + 'y' => ':count Ã¥r|:count Ã¥r', + 'month' => ':count mÃ¥ned|:count mÃ¥neder', + 'm' => ':count mÃ¥ned|:count mÃ¥neder', + 'week' => ':count uke|:count uker', + 'w' => ':count uke|:count uker', + 'day' => ':count dag|:count dager', + 'd' => ':count dag|:count dager', + 'hour' => ':count time|:count timer', + 'h' => ':count time|:count timer', + 'minute' => ':count minutt|:count minutter', + 'min' => ':count minutt|:count minutter', + 'second' => ':count sekund|:count sekunder', + 's' => ':count sekund|:count sekunder', + 'ago' => ':time siden', + 'from_now' => 'om :time', + 'after' => ':time etter', + 'before' => ':time før', + 'diff_now' => 'akkurat nÃ¥', + 'diff_yesterday' => 'i gÃ¥r', + 'diff_tomorrow' => 'i morgen', + 'diff_before_yesterday' => 'i forgÃ¥rs', + 'diff_after_tomorrow' => 'i overmorgen', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/oc.php b/vendor/nesbot/carbon/src/Carbon/Lang/oc.php new file mode 100644 index 0000000..e89e94c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/oc.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +\Symfony\Component\Translation\PluralizationRules::set(function ($number) { + return $number == 1 ? 0 : 1; +}, 'oc'); + +return array( + 'year' => ':count an|:count ans', + 'y' => ':count an|:count ans', + 'month' => ':count mes|:count meses', + 'm' => ':count mes|:count meses', + 'week' => ':count setmana|:count setmanas', + 'w' => ':count setmana|:count setmanas', + 'day' => ':count jorn|:count jorns', + 'd' => ':count jorn|:count jorns', + 'hour' => ':count ora|:count oras', + 'h' => ':count ora|:count oras', + 'minute' => ':count minuta|:count minutas', + 'min' => ':count minuta|:count minutas', + 'second' => ':count segonda|:count segondas', + 's' => ':count segonda|:count segondas', + 'ago' => 'fa :time', + 'from_now' => 'dins :time', + 'after' => ':time aprèp', + 'before' => ':time abans', + 'diff_now' => 'ara meteis', + 'diff_yesterday' => 'ièr', + 'diff_tomorrow' => 'deman', + 'diff_before_yesterday' => 'ièr delà', + 'diff_after_tomorrow' => 'deman passat', + 'period_recurrences' => ':count còp|:count còps', + 'period_interval' => 'cada :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'fins a :date', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pl.php b/vendor/nesbot/carbon/src/Carbon/Lang/pl.php new file mode 100644 index 0000000..2308af2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pl.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count rok|:count lata|:count lat', + 'y' => ':countr|:countl', + 'month' => ':count miesiÄ…c|:count miesiÄ…ce|:count miesiÄ™cy', + 'm' => ':countmies', + 'week' => ':count tydzieÅ„|:count tygodnie|:count tygodni', + 'w' => ':counttyg', + 'day' => ':count dzieÅ„|:count dni|:count dni', + 'd' => ':countd', + 'hour' => ':count godzina|:count godziny|:count godzin', + 'h' => ':countg', + 'minute' => ':count minuta|:count minuty|:count minut', + 'min' => ':countm', + 'second' => ':count sekunda|:count sekundy|:count sekund', + 's' => ':counts', + 'ago' => ':time temu', + 'from_now' => ':time od teraz', + 'after' => ':time po', + 'before' => ':time przed', + 'diff_now' => 'przed chwilÄ…', + 'diff_yesterday' => 'wczoraj', + 'diff_tomorrow' => 'jutro', + 'diff_before_yesterday' => 'przedwczoraj', + 'diff_after_tomorrow' => 'pojutrze', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ps.php b/vendor/nesbot/carbon/src/Carbon/Lang/ps.php new file mode 100644 index 0000000..15c3296 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ps.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count کال|:count کاله', + 'y' => ':countکال|:countکاله', + 'month' => ':count مياشت|:count مياشتي', + 'm' => ':countمياشت|:countمياشتي', + 'week' => ':count اونÛ|:count اونÛ', + 'w' => ':countاونÛ|:countاونÛ', + 'day' => ':count ورÚ|:count ورÚÙŠ', + 'd' => ':countورÚ|:countورÚÙŠ', + 'hour' => ':count ساعت|:count ساعته', + 'h' => ':countساعت|:countساعته', + 'minute' => ':count دقيقه|:count دقيقÛ', + 'min' => ':countدقيقه|:countدقيقÛ', + 'second' => ':count ثانيه|:count ثانيÛ', + 's' => ':countثانيه|:countثانيÛ', + 'ago' => ':time دمخه', + 'from_now' => ':time له اوس څخه', + 'after' => ':time وروسته', + 'before' => ':time دمخه', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt.php new file mode 100644 index 0000000..392b121 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count ano|:count anos', + 'y' => ':count ano|:count anos', + 'month' => ':count mês|:count meses', + 'm' => ':count mês|:count meses', + 'week' => ':count semana|:count semanas', + 'w' => ':count semana|:count semanas', + 'day' => ':count dia|:count dias', + 'd' => ':count dia|:count dias', + 'hour' => ':count hora|:count horas', + 'h' => ':count hora|:count horas', + 'minute' => ':count minuto|:count minutos', + 'min' => ':count minuto|:count minutos', + 'second' => ':count segundo|:count segundos', + 's' => ':count segundo|:count segundos', + 'ago' => ':time atrás', + 'from_now' => 'em :time', + 'after' => ':time depois', + 'before' => ':time antes', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php new file mode 100644 index 0000000..1f84eac --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count ano|:count anos', + 'y' => ':counta|:counta', + 'month' => ':count mês|:count meses', + 'm' => ':countm|:countm', + 'week' => ':count semana|:count semanas', + 'w' => ':countsem|:countsem', + 'day' => ':count dia|:count dias', + 'd' => ':countd|:countd', + 'hour' => ':count hora|:count horas', + 'h' => ':counth|:counth', + 'minute' => ':count minuto|:count minutos', + 'min' => ':countmin|:countmin', + 'second' => ':count segundo|:count segundos', + 's' => ':counts|:counts', + 'ago' => 'há :time', + 'from_now' => 'em :time', + 'after' => 'após :time', + 'before' => ':time atrás', + 'diff_now' => 'agora', + 'diff_yesterday' => 'ontem', + 'diff_tomorrow' => 'amanhã', + 'diff_before_yesterday' => 'anteontem', + 'diff_after_tomorrow' => 'depois de amanhã', + 'period_recurrences' => 'uma|:count vez', + 'period_interval' => 'toda :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'até :date', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ro.php b/vendor/nesbot/carbon/src/Carbon/Lang/ro.php new file mode 100644 index 0000000..cc16724 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ro.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => 'un an|:count ani|:count ani', + 'y' => 'un an|:count ani|:count ani', + 'month' => 'o lună|:count luni|:count luni', + 'm' => 'o lună|:count luni|:count luni', + 'week' => 'o săptămână|:count săptămâni|:count săptămâni', + 'w' => 'o săptămână|:count săptămâni|:count săptămâni', + 'day' => 'o zi|:count zile|:count zile', + 'd' => 'o zi|:count zile|:count zile', + 'hour' => 'o oră|:count ore|:count ore', + 'h' => 'o oră|:count ore|:count ore', + 'minute' => 'un minut|:count minute|:count minute', + 'min' => 'un minut|:count minute|:count minute', + 'second' => 'o secundă|:count secunde|:count secunde', + 's' => 'o secundă|:count secunde|:count secunde', + 'ago' => 'acum :time', + 'from_now' => ':time de acum', + 'after' => 'peste :time', + 'before' => 'acum :time', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ru.php b/vendor/nesbot/carbon/src/Carbon/Lang/ru.php new file mode 100644 index 0000000..6a83fb1 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ru.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count год|:count года|:count лет', + 'y' => ':count г|:count г|:count л', + 'month' => ':count меÑÑц|:count меÑÑца|:count меÑÑцев', + 'm' => ':count м|:count м|:count м', + 'week' => ':count неделю|:count недели|:count недель', + 'w' => ':count н|:count н|:count н', + 'day' => ':count день|:count днÑ|:count дней', + 'd' => ':count д|:count д|:count д', + 'hour' => ':count чаÑ|:count чаÑа|:count чаÑов', + 'h' => ':count ч|:count ч|:count ч', + 'minute' => ':count минуту|:count минуты|:count минут', + 'min' => ':count мин|:count мин|:count мин', + 'second' => ':count Ñекунду|:count Ñекунды|:count Ñекунд', + 's' => ':count Ñ|:count Ñ|:count Ñ', + 'ago' => ':time назад', + 'from_now' => 'через :time', + 'after' => ':time поÑле', + 'before' => ':time до', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sh.php b/vendor/nesbot/carbon/src/Carbon/Lang/sh.php new file mode 100644 index 0000000..57f287a --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sh.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +\Symfony\Component\Translation\PluralizationRules::set(function ($number) { + return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); +}, 'sh'); + +return array( + 'year' => ':count godina|:count godine|:count godina', + 'y' => ':count godina|:count godine|:count godina', + 'month' => ':count mesec|:count meseca|:count meseci', + 'm' => ':count mesec|:count meseca|:count meseci', + 'week' => ':count nedelja|:count nedelje|:count nedelja', + 'w' => ':count nedelja|:count nedelje|:count nedelja', + 'day' => ':count dan|:count dana|:count dana', + 'd' => ':count dan|:count dana|:count dana', + 'hour' => ':count Äas|:count Äasa|:count Äasova', + 'h' => ':count Äas|:count Äasa|:count Äasova', + 'minute' => ':count minut|:count minuta|:count minuta', + 'min' => ':count minut|:count minuta|:count minuta', + 'second' => ':count sekund|:count sekunda|:count sekundi', + 's' => ':count sekund|:count sekunda|:count sekundi', + 'ago' => 'pre :time', + 'from_now' => 'za :time', + 'after' => 'nakon :time', + 'before' => ':time raniјe', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sk.php b/vendor/nesbot/carbon/src/Carbon/Lang/sk.php new file mode 100644 index 0000000..6101344 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sk.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => 'rok|:count roky|:count rokov', + 'y' => 'rok|:count roky|:count rokov', + 'month' => 'mesiac|:count mesiace|:count mesiacov', + 'm' => 'mesiac|:count mesiace|:count mesiacov', + 'week' => 'týždeň|:count týždne|:count týždňov', + 'w' => 'týždeň|:count týždne|:count týždňov', + 'day' => 'deň|:count dni|:count dní', + 'd' => 'deň|:count dni|:count dní', + 'hour' => 'hodinu|:count hodiny|:count hodín', + 'h' => 'hodinu|:count hodiny|:count hodín', + 'minute' => 'minútu|:count minúty|:count minút', + 'min' => 'minútu|:count minúty|:count minút', + 'second' => 'sekundu|:count sekundy|:count sekúnd', + 's' => 'sekundu|:count sekundy|:count sekúnd', + 'ago' => 'pred :time', + 'from_now' => 'za :time', + 'after' => 'o :time neskôr', + 'before' => ':time predtým', + 'year_ago' => 'rokom|:count rokmi|:count rokmi', + 'month_ago' => 'mesiacom|:count mesiacmi|:count mesiacmi', + 'week_ago' => 'týždňom|:count týždňami|:count týždňami', + 'day_ago' => 'dňom|:count dňami|:count dňami', + 'hour_ago' => 'hodinou|:count hodinami|:count hodinami', + 'minute_ago' => 'minútou|:count minútami|:count minútami', + 'second_ago' => 'sekundou|:count sekundami|:count sekundami', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sl.php b/vendor/nesbot/carbon/src/Carbon/Lang/sl.php new file mode 100644 index 0000000..06686d1 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sl.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count leto|:count leti|:count leta|:count let', + 'y' => ':count leto|:count leti|:count leta|:count let', + 'month' => ':count mesec|:count meseca|:count mesece|:count mesecev', + 'm' => ':count mesec|:count meseca|:count mesece|:count mesecev', + 'week' => ':count teden|:count tedna|:count tedne|:count tednov', + 'w' => ':count teden|:count tedna|:count tedne|:count tednov', + 'day' => ':count dan|:count dni|:count dni|:count dni', + 'd' => ':count dan|:count dni|:count dni|:count dni', + 'hour' => ':count uro|:count uri|:count ure|:count ur', + 'h' => ':count uro|:count uri|:count ure|:count ur', + 'minute' => ':count minuto|:count minuti|:count minute|:count minut', + 'min' => ':count minuto|:count minuti|:count minute|:count minut', + 'second' => ':count sekundo|:count sekundi|:count sekunde|:count sekund', + 's' => ':count sekundo|:count sekundi|:count sekunde|:count sekund', + 'year_ago' => ':count letom|:count leti|:count leti|:count leti', + 'month_ago' => ':count mesecem|:count meseci|:count meseci|:count meseci', + 'week_ago' => ':count tednom|:count tednoma|:count tedni|:count tedni', + 'day_ago' => ':count dnem|:count dnevoma|:count dnevi|:count dnevi', + 'hour_ago' => ':count uro|:count urama|:count urami|:count urami', + 'minute_ago' => ':count minuto|:count minutama|:count minutami|:count minutami', + 'second_ago' => ':count sekundo|:count sekundama|:count sekundami|:count sekundami', + 'ago' => 'pred :time', + 'from_now' => 'Äez :time', + 'after' => 'Äez :time', + 'before' => 'pred :time', + 'diff_now' => 'ravnokar', + 'diff_yesterday' => 'vÄeraj', + 'diff_tomorrow' => 'jutri', + 'diff_before_yesterday' => 'predvÄerajÅ¡njim', + 'diff_after_tomorrow' => 'pojutriÅ¡njem', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sq.php b/vendor/nesbot/carbon/src/Carbon/Lang/sq.php new file mode 100644 index 0000000..6e138a0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sq.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count vit|:count vjet', + 'y' => ':count vit|:count vjet', + 'month' => ':count muaj|:count muaj', + 'm' => ':count muaj|:count muaj', + 'week' => ':count javë|:count javë', + 'w' => ':count javë|:count javë', + 'day' => ':count ditë|:count ditë', + 'd' => ':count ditë|:count ditë', + 'hour' => ':count orë|:count orë', + 'h' => ':count orë|:count orë', + 'minute' => ':count minutë|:count minuta', + 'min' => ':count minutë|:count minuta', + 'second' => ':count sekondë|:count sekonda', + 's' => ':count sekondë|:count sekonda', + 'ago' => ':time më parë', + 'from_now' => ':time nga tani', + 'after' => ':time pas', + 'before' => ':time para', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr.php new file mode 100644 index 0000000..5a10642 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count godina|:count godine|:count godina', + 'y' => ':count godina|:count godine|:count godina', + 'month' => ':count mesec|:count meseca|:count meseci', + 'm' => ':count mesec|:count meseca|:count meseci', + 'week' => ':count nedelja|:count nedelje|:count nedelja', + 'w' => ':count nedelja|:count nedelje|:count nedelja', + 'day' => ':count dan|:count dana|:count dana', + 'd' => ':count dan|:count dana|:count dana', + 'hour' => ':count sat|:count sata|:count sati', + 'h' => ':count sat|:count sata|:count sati', + 'minute' => ':count minut|:count minuta |:count minuta', + 'min' => ':count minut|:count minuta |:count minuta', + 'second' => ':count sekund|:count sekunde|:count sekunde', + 's' => ':count sekund|:count sekunde|:count sekunde', + 'ago' => 'pre :time', + 'from_now' => ':time od sada', + 'after' => 'nakon :time', + 'before' => 'pre :time', + + 'year_from_now' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', + 'year_ago' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', + + 'week_from_now' => '{1} :count nedelju|{2,3,4} :count nedelje|[5,Inf[ :count nedelja', + 'week_ago' => '{1} :count nedelju|{2,3,4} :count nedelje|[5,Inf[ :count nedelja', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php new file mode 100644 index 0000000..2db83ed --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[ :count година', + 'y' => ':count г.', + 'month' => '{1} :count меÑец|{2,3,4}:count меÑеца|[5,Inf[ :count меÑеци', + 'm' => ':count м.', + 'week' => '{1} :count недеља|{2,3,4}:count недеље|[5,Inf[ :count недеља', + 'w' => ':count нед.', + 'day' => '{1,21,31} :count дан|[2,Inf[ :count дана', + 'd' => ':count д.', + 'hour' => '{1,21} :count Ñат|{2,3,4,22,23,24}:count Ñата|[5,Inf[ :count Ñати', + 'h' => ':count ч.', + 'minute' => '{1,21,31,41,51} :count минут|[2,Inf[ :count минута', + 'min' => ':count мин.', + 'second' => '{1,21,31,41,51} :count Ñекунд|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count Ñекунде|[5,Inf[:count Ñекунди', + 's' => ':count Ñек.', + 'ago' => 'пре :time', + 'from_now' => 'за :time', + 'after' => ':time након', + 'before' => ':time пре', + + 'year_from_now' => '{1,21,31,41,51} :count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count године|[5,Inf[ :count година', + 'year_ago' => '{1,21,31,41,51} :count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count године|[5,Inf[ :count година', + + 'week_from_now' => '{1} :count недељу|{2,3,4} :count недеље|[5,Inf[ :count недеља', + 'week_ago' => '{1} :count недељу|{2,3,4} :count недеље|[5,Inf[ :count недеља', + + 'diff_now' => 'управо Ñада', + 'diff_yesterday' => 'јуче', + 'diff_tomorrow' => 'Ñутра', + 'diff_before_yesterday' => 'прекјуче', + 'diff_after_tomorrow' => 'прекоÑутра', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php new file mode 100644 index 0000000..18214c4 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[ :count година', + 'y' => ':count г.', + 'month' => '{1} :count мјеÑец|{2,3,4}:count мјеÑеца|[5,Inf[ :count мјеÑеци', + 'm' => ':count мј.', + 'week' => '{1} :count недјеља|{2,3,4}:count недјеље|[5,Inf[ :count недјеља', + 'w' => ':count нед.', + 'day' => '{1,21,31} :count дан|[2,Inf[ :count дана', + 'd' => ':count д.', + 'hour' => '{1,21} :count Ñат|{2,3,4,22,23,24}:count Ñата|[5,Inf[ :count Ñати', + 'h' => ':count ч.', + 'minute' => '{1,21,31,41,51} :count минут|[2,Inf[ :count минута', + 'min' => ':count мин.', + 'second' => '{1,21,31,41,51} :count Ñекунд|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count Ñекунде|[5,Inf[:count Ñекунди', + 's' => ':count Ñек.', + 'ago' => 'прије :time', + 'from_now' => 'за :time', + 'after' => ':time након', + 'before' => ':time прије', + + 'year_from_now' => '{1,21,31,41,51} :count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count године|[5,Inf[ :count година', + 'year_ago' => '{1,21,31,41,51} :count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count године|[5,Inf[ :count година', + + 'week_from_now' => '{1} :count недјељу|{2,3,4} :count недјеље|[5,Inf[ :count недјеља', + 'week_ago' => '{1} :count недјељу|{2,3,4} :count недјеље|[5,Inf[ :count недјеља', + + 'diff_now' => 'управо Ñада', + 'diff_yesterday' => 'јуче', + 'diff_tomorrow' => 'Ñутра', + 'diff_before_yesterday' => 'прекјуче', + 'diff_after_tomorrow' => 'прекоÑјутра', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php new file mode 100644 index 0000000..2d2e288 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count godine|[0,Inf[ :count godina', + 'y' => ':count g.', + 'month' => '{1} :count mjesec|{2,3,4}:count mjeseca|[5,Inf[ :count mjeseci', + 'm' => ':count mj.', + 'week' => '{1} :count nedjelja|{2,3,4}:count nedjelje|[5,Inf[ :count nedjelja', + 'w' => ':count ned.', + 'day' => '{1,21,31} :count dan|[2,Inf[ :count dana', + 'd' => ':count d.', + 'hour' => '{1,21} :count sat|{2,3,4,22,23,24}:count sata|[5,Inf[ :count sati', + 'h' => ':count Ä.', + 'minute' => '{1,21,31,41,51} :count minut|[2,Inf[ :count minuta', + 'min' => ':count min.', + 'second' => '{1,21,31,41,51} :count sekund|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count sekunde|[5,Inf[:count sekundi', + 's' => ':count sek.', + 'ago' => 'prije :time', + 'from_now' => 'za :time', + 'after' => ':time nakon', + 'before' => ':time prije', + + 'year_from_now' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', + 'year_ago' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', + + 'week_from_now' => '{1} :count nedjelju|{2,3,4} :count nedjelje|[5,Inf[ :count nedjelja', + 'week_ago' => '{1} :count nedjelju|{2,3,4} :count nedjelje|[5,Inf[ :count nedjelja', + + 'diff_now' => 'upravo sada', + 'diff_yesterday' => 'juÄe', + 'diff_tomorrow' => 'sutra', + 'diff_before_yesterday' => 'prekjuÄe', + 'diff_after_tomorrow' => 'preksutra', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php new file mode 100644 index 0000000..7ebf6f0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php @@ -0,0 +1,12 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return require __DIR__.'/sr_Latn_ME.php'; diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sv.php b/vendor/nesbot/carbon/src/Carbon/Lang/sv.php new file mode 100644 index 0000000..89a03b4 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sv.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count Ã¥r|:count Ã¥r', + 'y' => ':count Ã¥r|:count Ã¥r', + 'month' => ':count mÃ¥nad|:count mÃ¥nader', + 'm' => ':count mÃ¥nad|:count mÃ¥nader', + 'week' => ':count vecka|:count veckor', + 'w' => ':count vecka|:count veckor', + 'day' => ':count dag|:count dagar', + 'd' => ':count dag|:count dagar', + 'hour' => ':count timme|:count timmar', + 'h' => ':count timme|:count timmar', + 'minute' => ':count minut|:count minuter', + 'min' => ':count minut|:count minuter', + 'second' => ':count sekund|:count sekunder', + 's' => ':count sekund|:count sekunder', + 'ago' => ':time sedan', + 'from_now' => 'om :time', + 'after' => ':time efter', + 'before' => ':time före', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sw.php b/vendor/nesbot/carbon/src/Carbon/Lang/sw.php new file mode 100644 index 0000000..52f0342 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sw.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => 'mwaka 1|miaka :count', + 'y' => 'mwaka 1|miaka :count', + 'month' => 'mwezi 1|miezi :count', + 'm' => 'mwezi 1|miezi :count', + 'week' => 'wiki 1|wiki :count', + 'w' => 'wiki 1|wiki :count', + 'day' => 'siku 1|siku :count', + 'd' => 'siku 1|siku :count', + 'hour' => 'saa 1|masaa :count', + 'h' => 'saa 1|masaa :count', + 'minute' => 'dakika 1|dakika :count', + 'min' => 'dakika 1|dakika :count', + 'second' => 'sekunde 1|sekunde :count', + 's' => 'sekunde 1|sekunde :count', + 'ago' => ':time ziliyopita', + 'from_now' => ':time kwanzia sasa', + 'after' => ':time baada', + 'before' => ':time kabla', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/th.php b/vendor/nesbot/carbon/src/Carbon/Lang/th.php new file mode 100644 index 0000000..88bb4ac --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/th.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count ปี', + 'y' => ':count ปี', + 'month' => ':count เดือน', + 'm' => ':count เดือน', + 'week' => ':count สัปดาห์', + 'w' => ':count สัปดาห์', + 'day' => ':count วัน', + 'd' => ':count วัน', + 'hour' => ':count ชั่วโมง', + 'h' => ':count ชั่วโมง', + 'minute' => ':count นาที', + 'min' => ':count นาที', + 'second' => ':count วินาที', + 's' => ':count วินาที', + 'ago' => ':timeที่à¹à¸¥à¹‰à¸§', + 'from_now' => ':timeต่อจาà¸à¸™à¸µà¹‰', + 'after' => ':timeหลังจาà¸à¸™à¸µà¹‰', + 'before' => ':timeà¸à¹ˆà¸­à¸™', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tr.php b/vendor/nesbot/carbon/src/Carbon/Lang/tr.php new file mode 100644 index 0000000..6a9dfed --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/tr.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count yıl', + 'y' => ':count yıl', + 'month' => ':count ay', + 'm' => ':count ay', + 'week' => ':count hafta', + 'w' => ':count hafta', + 'day' => ':count gün', + 'd' => ':count gün', + 'hour' => ':count saat', + 'h' => ':count saat', + 'minute' => ':count dakika', + 'min' => ':count dakika', + 'second' => ':count saniye', + 's' => ':count saniye', + 'ago' => ':time önce', + 'from_now' => ':time sonra', + 'after' => ':time sonra', + 'before' => ':time önce', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/uk.php b/vendor/nesbot/carbon/src/Carbon/Lang/uk.php new file mode 100644 index 0000000..8d08eaa --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/uk.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count рік|:count роки|:count років', + 'y' => ':count рік|:count роки|:count років', + 'month' => ':count міÑÑць|:count міÑÑці|:count міÑÑців', + 'm' => ':count міÑÑць|:count міÑÑці|:count міÑÑців', + 'week' => ':count тиждень|:count тижні|:count тижнів', + 'w' => ':count тиждень|:count тижні|:count тижнів', + 'day' => ':count день|:count дні|:count днів', + 'd' => ':count день|:count дні|:count днів', + 'hour' => ':count година|:count години|:count годин', + 'h' => ':count година|:count години|:count годин', + 'minute' => ':count хвилину|:count хвилини|:count хвилин', + 'min' => ':count хвилину|:count хвилини|:count хвилин', + 'second' => ':count Ñекунду|:count Ñекунди|:count Ñекунд', + 's' => ':count Ñекунду|:count Ñекунди|:count Ñекунд', + 'ago' => ':time тому', + 'from_now' => 'через :time', + 'after' => ':time піÑлÑ', + 'before' => ':time до', + 'diff_now' => 'щойно', + 'diff_yesterday' => 'вчора', + 'diff_tomorrow' => 'завтра', + 'diff_before_yesterday' => 'позавчора', + 'diff_after_tomorrow' => 'піÑлÑзавтра', + 'period_recurrences' => 'один раз|:count рази|:count разів', + 'period_interval' => 'кожні :interval', + 'period_start_date' => 'з :date', + 'period_end_date' => 'до :date', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ur.php b/vendor/nesbot/carbon/src/Carbon/Lang/ur.php new file mode 100644 index 0000000..3c5f7ed --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ur.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count سال', + 'month' => ':count ماه', + 'week' => ':count ÛÙتے', + 'day' => ':count روز', + 'hour' => ':count گھنٹے', + 'minute' => ':count منٹ', + 'second' => ':count سیکنڈ', + 'ago' => ':time Ù¾ÛÙ„Û’', + 'from_now' => ':time بعد', + 'after' => ':time بعد', + 'before' => ':time Ù¾ÛÙ„Û’', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/uz.php b/vendor/nesbot/carbon/src/Carbon/Lang/uz.php new file mode 100644 index 0000000..1cb6f71 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/uz.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count yil', + 'y' => ':count yil', + 'month' => ':count oy', + 'm' => ':count oy', + 'week' => ':count hafta', + 'w' => ':count hafta', + 'day' => ':count kun', + 'd' => ':count kun', + 'hour' => ':count soat', + 'h' => ':count soat', + 'minute' => ':count daqiqa', + 'min' => ':count daq', + 'second' => ':count soniya', + 's' => ':count s', + 'ago' => ':time avval', + 'from_now' => ':time dan keyin', + 'after' => ':time keyin', + 'before' => ':time oldin', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/vi.php b/vendor/nesbot/carbon/src/Carbon/Lang/vi.php new file mode 100644 index 0000000..3f9838d --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/vi.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count năm', + 'y' => ':count năm', + 'month' => ':count tháng', + 'm' => ':count tháng', + 'week' => ':count tuần', + 'w' => ':count tuần', + 'day' => ':count ngày', + 'd' => ':count ngày', + 'hour' => ':count giá»', + 'h' => ':count giá»', + 'minute' => ':count phút', + 'min' => ':count phút', + 'second' => ':count giây', + 's' => ':count giây', + 'ago' => ':time trÆ°á»›c', + 'from_now' => ':time từ bây giá»', + 'after' => ':time sau', + 'before' => ':time trÆ°á»›c', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh.php new file mode 100644 index 0000000..9e1f6ca --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':countå¹´', + 'y' => ':countå¹´', + 'month' => ':count个月', + 'm' => ':count个月', + 'week' => ':count周', + 'w' => ':count周', + 'day' => ':count天', + 'd' => ':count天', + 'hour' => ':countå°æ—¶', + 'h' => ':countå°æ—¶', + 'minute' => ':count分钟', + 'min' => ':count分钟', + 'second' => ':count秒', + 's' => ':count秒', + 'ago' => ':timeå‰', + 'from_now' => 'è·çŽ°åœ¨:time', + 'after' => ':timeåŽ', + 'before' => ':timeå‰', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php new file mode 100644 index 0000000..c848723 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':countå¹´', + 'y' => ':countå¹´', + 'month' => ':count月', + 'm' => ':count月', + 'week' => ':count週', + 'w' => ':count週', + 'day' => ':count天', + 'd' => ':count天', + 'hour' => ':countå°æ™‚', + 'h' => ':countå°æ™‚', + 'minute' => ':count分é˜', + 'min' => ':count分é˜', + 'second' => ':count秒', + 's' => ':count秒', + 'ago' => ':timeå‰', + 'from_now' => 'è·ç¾åœ¨:time', + 'after' => ':time後', + 'before' => ':timeå‰', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php b/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php new file mode 100644 index 0000000..4d83b0c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php @@ -0,0 +1,37 @@ +app['events']; + if ($events instanceof EventDispatcher || $events instanceof Dispatcher) { + $events->listen(class_exists('Illuminate\Foundation\Events\LocaleUpdated') ? 'Illuminate\Foundation\Events\LocaleUpdated' : 'locale.changed', function () use ($service) { + $service->updateLocale(); + }); + $service->updateLocale(); + } + } + + public function updateLocale() + { + $translator = $this->app['translator']; + if ($translator instanceof Translator || $translator instanceof IlluminateTranslator) { + Carbon::setLocale($translator->getLocale()); + } + } + + public function register() + { + // Needed for Laravel < 5.3 compatibility + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Translator.php b/vendor/nesbot/carbon/src/Carbon/Translator.php new file mode 100644 index 0000000..12115b0 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Translator.php @@ -0,0 +1,143 @@ +addLoader('array', new Translation\Loader\ArrayLoader()); + parent::__construct($locale, $formatter, $cacheDir, $debug); + } + + /** + * Reset messages of a locale (all locale if no locale passed). + * Remove custom messages and reload initial messages from matching + * file in Lang directory. + * + * @param string|null $locale + * + * @return bool + */ + public function resetMessages($locale = null) + { + if ($locale === null) { + static::$messages = array(); + + return true; + } + + if (file_exists($filename = __DIR__.'/Lang/'.$locale.'.php')) { + static::$messages[$locale] = require $filename; + $this->addResource('array', static::$messages[$locale], $locale); + + return true; + } + + return false; + } + + /** + * Init messages language from matching file in Lang directory. + * + * @param string $locale + * + * @return bool + */ + protected function loadMessagesFromFile($locale) + { + if (isset(static::$messages[$locale])) { + return true; + } + + return $this->resetMessages($locale); + } + + /** + * Set messages of a locale and take file first if present. + * + * @param string $locale + * @param array $messages + * + * @return $this + */ + public function setMessages($locale, $messages) + { + $this->loadMessagesFromFile($locale); + $this->addResource('array', $messages, $locale); + static::$messages[$locale] = array_merge( + isset(static::$messages[$locale]) ? static::$messages[$locale] : array(), + $messages + ); + + return $this; + } + + /** + * Get messages of a locale, if none given, return all the + * languages. + * + * @param string|null $locale + * + * @return array + */ + public function getMessages($locale = null) + { + return $locale === null ? static::$messages : static::$messages[$locale]; + } + + /** + * Set the current translator locale and indicate if the source locale file exists + * + * @param string $locale locale ex. en + * + * @return bool + */ + public function setLocale($locale) + { + $locale = preg_replace_callback('/[-_]([a-z]{2,})/', function ($matches) { + // _2-letters is a region, _3+-letters is a variant + return '_'.call_user_func(strlen($matches[1]) > 2 ? 'ucfirst' : 'strtoupper', $matches[1]); + }, strtolower($locale)); + + if ($this->loadMessagesFromFile($locale)) { + parent::setLocale($locale); + + return true; + } + + return false; + } +} diff --git a/vendor/nesbot/carbon/src/JsonSerializable.php b/vendor/nesbot/carbon/src/JsonSerializable.php new file mode 100644 index 0000000..d34060b --- /dev/null +++ b/vendor/nesbot/carbon/src/JsonSerializable.php @@ -0,0 +1,18 @@ +json_encode, + * which is a value of any type other than a resource. + * + * @since 5.4.0 + */ + public function jsonSerialize(); + } +} diff --git a/vendor/nexmo/client/LICENSE.txt b/vendor/nexmo/client/LICENSE.txt new file mode 100644 index 0000000..ac86e75 --- /dev/null +++ b/vendor/nexmo/client/LICENSE.txt @@ -0,0 +1,15 @@ +The MIT License (MIT) +Copyright (c) 2016-2018 Nexmo, Inc + +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/nexmo/client/composer.json b/vendor/nexmo/client/composer.json new file mode 100644 index 0000000..4eb1d1a --- /dev/null +++ b/vendor/nexmo/client/composer.json @@ -0,0 +1,41 @@ +{ + "name": "nexmo/client", + "description": "PHP Client for using Nexmo's API.", + "license": "MIT", + "type": "library", + "authors": [ + { + "name": "Tim Lytle", + "email": "tim@nexmo.com", + "role": "Developer", + "homepage": "http://twitter.com/tjlytle" + } + ], + "support": { + "email": "devrel@nexmo.com" + }, + "require": { + "php": ">=5.6", + "php-http/client-implementation": "^1.0", + "zendframework/zend-diactoros": "^1.3", + "php-http/guzzle6-adapter": "^1.0", + "lcobucci/jwt": "^3.2" + }, + "require-dev": { + "phpunit/phpunit": "^5.7", + "php-http/mock-client": "^0.3.0", + "estahn/phpunit-json-assertions": "^1.0.0", + "squizlabs/php_codesniffer": "^3.1" + }, + "autoload": { + "psr-4": { + "Nexmo\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Nexmo\\": "test/", + "NexmoTest\\": "test/" + } + } +} diff --git a/vendor/nexmo/client/examples/fetch_recording.php b/vendor/nexmo/client/examples/fetch_recording.php new file mode 100644 index 0000000..bddde2c --- /dev/null +++ b/vendor/nexmo/client/examples/fetch_recording.php @@ -0,0 +1,12 @@ +get($recording); + +file_put_contents($recordingId.'.mp3', $data->getBody()); diff --git a/vendor/nexmo/client/examples/send.php b/vendor/nexmo/client/examples/send.php new file mode 100644 index 0000000..90787fa --- /dev/null +++ b/vendor/nexmo/client/examples/send.php @@ -0,0 +1,72 @@ +message()->send([ + 'to' => NEXMO_TO, + 'from' => NEXMO_FROM, + 'text' => 'Test message from the Nexmo PHP Client' +]); + +//array access provides response data +echo "Sent message to " . $message['to'] . ". Balance is now " . $message['remaining-balance'] . PHP_EOL; + +sleep(1); + +//send message using object support +$text = new \Nexmo\Message\Text(NEXMO_TO, NEXMO_FROM, 'Test message using PHP client library'); +$text->setClientRef('test-message') + ->setClass(\Nexmo\Message\Text::CLASS_FLASH); + +$client->message()->send($text); + +//method access +echo "Sent message to " . $text->getTo() . ". Balance is now " . $text->getRemainingBalance() . PHP_EOL; + +sleep(1); + +//sending a message over 160 characters +$longwinded = <<message()->send($text); + +echo "Sent message to " . $text->getTo() . ". Balance is now " . $text->getRemainingBalance() . PHP_EOL; +echo "Message was split into " . count($text) . " messages, those message ids are: " . PHP_EOL; +for($i = 0; $i < count($text); $i++){ + echo $text[$i]['message-id'] . PHP_EOL; +} + +echo "The account balance after each message was: " . PHP_EOL; +for($i = 0; $i < count($text); $i++){ + echo $text->getRemainingBalance($i) . PHP_EOL; +} + +//easier iteration, can use methods or array access +foreach($text as $index => $data){ + echo "Balance was " . $text->getRemainingBalance($index) . " after message " . $data['message-id'] . " was sent." . PHP_EOL; +} + +//an invalid request +try{ + $text = new \Nexmo\Message\Text('not valid', NEXMO_FROM, $longwinded); + $client->message()->send($text); +} catch (Nexmo\Client\Exception\Request $e) { + //can still get the API response + $text = $e->getEntity(); + $request = $text->getRequest(); //PSR-7 Request Object + $response = $text->getResponse(); //PSR-7 Response Object + $data = $text->getResponseData(); //parsed response object + $code = $e->getCode(); //nexmo error code + error_log($e->getMessage()); //nexmo error message +} diff --git a/vendor/nexmo/client/phpcs.xml b/vendor/nexmo/client/phpcs.xml new file mode 100644 index 0000000..4dc7a1b --- /dev/null +++ b/vendor/nexmo/client/phpcs.xml @@ -0,0 +1,5 @@ + + + + ./src + diff --git a/vendor/nexmo/client/src/Account/Balance.php b/vendor/nexmo/client/src/Account/Balance.php new file mode 100644 index 0000000..7894ad6 --- /dev/null +++ b/vendor/nexmo/client/src/Account/Balance.php @@ -0,0 +1,59 @@ +data['balance'] = $balance; + $this->data['auto_reload'] = $autoReload; + } + + public function getBalance() + { + return $this['balance']; + } + + public function getAutoReload() + { + return $this['auto_reload']; + } + + public function jsonUnserialize(array $json) + { + $this->data = [ + 'balance' => $json['value'], + 'auto_reload' => $json['autoReload'] + ]; + } + + function jsonSerialize() + { + return $this->data; + } + + public function offsetExists($offset) + { + return isset($this->data[$offset]); + } + + public function offsetGet($offset) + { + return $this->data[$offset]; + } + + public function offsetSet($offset, $value) + { + throw new Exception('Balance is read only'); + } + + public function offsetUnset($offset) + { + throw new Exception('Balance is read only'); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Account/Client.php b/vendor/nexmo/client/src/Account/Client.php new file mode 100644 index 0000000..d520c28 --- /dev/null +++ b/vendor/nexmo/client/src/Account/Client.php @@ -0,0 +1,228 @@ + $prefix + ]); + + $request = new Request( + $this->getClient()->getRestUrl() . '/account/get-prefix-pricing/outbound?'.$queryString, + 'GET', + 'php://temp' + ); + + $response = $this->client->send($request); + $rawBody = $response->getBody()->getContents(); + + $body = json_decode($rawBody, true); + + $codeCategory = (int) ($response->getStatusCode()/100); + if ($codeCategory != 2) { + if ($codeCategory == 4) { + throw new Exception\Request($body['error-code-label']); + }else if ($codeCategory == 5) { + throw new Exception\Server($body['error-code-label']); + } + } + + if ($body['count'] == 0) { + return []; + } + + // Multiple countries can match each prefix + $prices = []; + + foreach ($body['prices'] as $p) { + $prefixPrice = new PrefixPrice(); + $prefixPrice->jsonUnserialize($p); + $prices[] = $prefixPrice; + } + return $prices; + } + + public function getSmsPrice($country) + { + $body = $this->makePricingRequest($country, 'sms'); + $smsPrice = new SmsPrice(); + $smsPrice->jsonUnserialize($body); + return $smsPrice; + } + + public function getVoicePrice($country) + { + $body = $this->makePricingRequest($country, 'voice'); + $voicePrice = new VoicePrice(); + $voicePrice->jsonUnserialize($body); + return $voicePrice; + } + + protected function makePricingRequest($country, $pricingType) + { + $queryString = http_build_query([ + 'country' => $country + ]); + + $request = new Request( + $this->getClient()->getRestUrl() . '/account/get-pricing/outbound/'.$pricingType.'?'.$queryString, + 'GET', + 'php://temp' + ); + + $response = $this->client->send($request); + $rawBody = $response->getBody()->getContents(); + + if ($rawBody === '') { + throw new Exception\Server('No results found'); + } + + return json_decode($rawBody, true); + } + + public function getBalance() + { + + $request = new Request( + $this->getClient()->getRestUrl() . '/account/get-balance', + 'GET', + 'php://temp' + ); + + $response = $this->client->send($request); + $rawBody = $response->getBody()->getContents(); + + if ($rawBody === '') { + throw new Exception\Server('No results found'); + } + + $body = json_decode($rawBody, true); + + $balance = new Balance($body['value'], $body['autoReload']); + return $balance; + } + + public function topUp($trx) + { + $body = [ + 'trx' => $trx + ]; + + $request = new Request( + $this->getClient()->getRestUrl() . '/account/top-up' + ,'POST' + , 'php://temp' + , ['content-type' => 'application/x-www-form-urlencoded'] + ); + + $request->getBody()->write(http_build_query($body)); + $response = $this->client->send($request); + + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + } + + public function listSecrets($apiKey) + { + $body = $this->get( $this->getClient()->getApiUrl() . '/accounts/'.$apiKey.'/secrets'); + return SecretCollection::fromApi($body); + } + + public function getSecret($apiKey, $secretId) + { + $body = $this->get( $this->getClient()->getApiUrl() . '/accounts/'.$apiKey.'/secrets/'. $secretId); + return Secret::fromApi($body); + } + + public function createSecret($apiKey, $newSecret) + { + $body = [ + 'secret' => $newSecret + ]; + + $request = new Request( + $this->getClient()->getApiUrl() . '/accounts/'.$apiKey.'/secrets' + ,'POST' + , 'php://temp' + , ['content-type' => 'application/json'] + ); + + $request->getBody()->write(json_encode($body)); + $response = $this->client->send($request); + + $rawBody = $response->getBody()->getContents(); + $responseBody = json_decode($rawBody, true); + ApiErrorHandler::check($responseBody, $response->getStatusCode()); + + return Secret::fromApi($responseBody); + } + + public function deleteSecret($apiKey, $secretId) + { + $request = new Request( + $this->getClient()->getApiUrl() . '/accounts/'.$apiKey.'/secrets/'. $secretId + ,'DELETE' + , 'php://temp' + , ['content-type' => 'application/json'] + ); + + $response = $this->client->send($request); + $rawBody = $response->getBody()->getContents(); + $body = json_decode($rawBody, true); + + // This will throw an exception on any error + ApiErrorHandler::check($body, $response->getStatusCode()); + + // This returns a 204, so no response body + } + + protected function get($url) { + $request = new Request( + $url + ,'GET' + , 'php://temp' + , ['content-type' => 'application/json'] + ); + + $response = $this->client->send($request); + $rawBody = $response->getBody()->getContents(); + $body = json_decode($rawBody, true); + + // This will throw an exception on any error + ApiErrorHandler::check($body, $response->getStatusCode()); + + return $body; + } + + protected function getException(ResponseInterface $response, $application = null) + { + $body = json_decode($response->getBody()->getContents(), true); + $status = $response->getStatusCode(); + + if($status >= 400 AND $status < 500) { + $e = new Exception\Request($body['error_title'], $status); + } elseif($status >= 500 AND $status < 600) { + $e = new Exception\Server($body['error_title'], $status); + } else { + $e = new Exception\Exception('Unexpected HTTP Status Code'); + } + + return $e; + } + +} diff --git a/vendor/nexmo/client/src/Account/PrefixPrice.php b/vendor/nexmo/client/src/Account/PrefixPrice.php new file mode 100644 index 0000000..9da71e6 --- /dev/null +++ b/vendor/nexmo/client/src/Account/PrefixPrice.php @@ -0,0 +1,13 @@ +getNetworks(); + if (isset($networks[$networkCode])) + { + return $networks[$networkCode]->{$this->priceMethod}(); + } + + return $this->getDefaultPrice(); + } + + public function jsonUnserialize(array $json) + { + // Convert CamelCase to snake_case as that's how we use array access in every other object + $data = []; + foreach ($json as $k => $v){ + $k = ltrim(strtolower(preg_replace('/[A-Z]([A-Z](?![a-z]))*/', '_$0', $k)), '_'); + + // PrefixPrice fixes + if ($k == 'country') { + $k = 'country_code'; + } + + if ($k == 'name') { + $data['country_display_name'] = $v; + $data['country_name'] = $v; + } + + if ($k == 'prefix') { + $k = 'dialing_prefix'; + } + + $data[$k] = $v; + } + + // Create objects for all the nested networks too + $networks = []; + if (isset($json['networks'])) { + foreach ($json['networks'] as $n){ + if (isset($n['code'])) { + $n['networkCode'] = $n['code']; + unset ($n['code']); + } + + if (isset($n['network'])) { + $n['networkName'] = $n['network']; + unset ($n['network']); + } + + $network = new Network($n['networkCode'], $n['networkName']); + $network->jsonUnserialize($n); + $networks[$network->getCode()] = $network; + } + } + + $data['networks'] = $networks; + $this->data = $data; + } + + function jsonSerialize() + { + return $this->data; + } + + public function offsetExists($offset) + { + return isset($this->data[$offset]); + } + + public function offsetGet($offset) + { + return $this->data[$offset]; + } + + public function offsetSet($offset, $value) + { + throw new Exception('Price is read only'); + } + + public function offsetUnset($offset) + { + throw new Exception('Price is read only'); + } +} diff --git a/vendor/nexmo/client/src/Account/Secret.php b/vendor/nexmo/client/src/Account/Secret.php new file mode 100644 index 0000000..5566c65 --- /dev/null +++ b/vendor/nexmo/client/src/Account/Secret.php @@ -0,0 +1,56 @@ +data = $data; + } + + public function getId() { + return $this['id']; + } + + public function getCreatedAt() { + return $this['created_at']; + } + + public function getLinks() { + return $this['_links']; + } + + public static function fromApi($data) { + if (!isset($data['id'])) { + throw new InvalidResponseException("Missing key: 'id"); + } + if (!isset($data['created_at'])) { + throw new InvalidResponseException("Missing key: 'created_at"); + } + return new self($data); + } + + public function offsetExists($offset) + { + return isset($this->data[$offset]); + } + + public function offsetGet($offset) + { + return $this->data[$offset]; + } + + public function offsetSet($offset, $value) + { + throw new \Exception('Secret::offsetSet is not implemented'); + } + + public function offsetUnset($offset) + { + throw new \Exception('Secret::offsetUnset is not implemented'); + } + +} diff --git a/vendor/nexmo/client/src/Account/SecretCollection.php b/vendor/nexmo/client/src/Account/SecretCollection.php new file mode 100644 index 0000000..51aa11f --- /dev/null +++ b/vendor/nexmo/client/src/Account/SecretCollection.php @@ -0,0 +1,51 @@ +data = [ + 'secrets' => $secrets, + '_links' => $links + ]; + } + + public function getSecrets() { + return $this['secrets']; + } + + public function getLinks() { + return $this['_links']; + } + + public static function fromApi($data) { + $secrets = []; + foreach ($data['_embedded']['secrets'] as $s) { + $secrets[] = Secret::fromApi($s); + } + return new self($secrets, $data['_links']); + } + + public function offsetExists($offset) + { + return isset($this->data[$offset]); + } + + public function offsetGet($offset) + { + return $this->data[$offset]; + } + + public function offsetSet($offset, $value) + { + throw new \Exception('SecretCollection::offsetSet is not implemented'); + } + + public function offsetUnset($offset) + { + throw new \Exception('SecretCollection::offsetUnset is not implemented'); + } + +} diff --git a/vendor/nexmo/client/src/Account/SmsPrice.php b/vendor/nexmo/client/src/Account/SmsPrice.php new file mode 100644 index 0000000..a5532be --- /dev/null +++ b/vendor/nexmo/client/src/Account/SmsPrice.php @@ -0,0 +1,7 @@ +id = $id; + } + + public function getId() + { + return $this->id; + } + + public function setVoiceConfig(VoiceConfig $config) + { + $this->voiceConfig = $config; + return $this; + } + + /** + * @return VoiceConfig + */ + public function getVoiceConfig() + { + if(!isset($this->voiceConfig)){ + $this->setVoiceConfig(new VoiceConfig()); + $data = $this->getResponseData(); + if(isset($data['voice']) AND isset($data['voice']['webhooks'])){ + foreach($data['voice']['webhooks'] as $webhook){ + $this->voiceConfig->setWebhook($webhook['endpoint_type'], $webhook['endpoint'], $webhook['http_method']); + } + } + } + + return $this->voiceConfig; + } + + public function getPublicKey() + { + if(isset($this->keys['public_key'])){ + return $this->keys['public_key']; + } + } + + public function getPrivateKey() + { + if(isset($this->keys['private_key'])){ + return $this->keys['private_key']; + } + } + + public function setName($name) + { + $this->name = $name; + return $this; + } + + public function getName() + { + return $this->name; + } + + public function jsonUnserialize(array $json) + { + $this->name = $json['name']; + $this->id = $json['id']; + $this->keys = $json['keys']; + + //todo: make voice hydrate-able + $this->voiceConfig = new VoiceConfig(); + if(isset($json['voice']) AND isset($json['voice']['webhooks'])){ + foreach($json['voice']['webhooks'] as $webhook){ + $this->voiceConfig->setWebhook($webhook['endpoint_type'], new Webhook($webhook['endpoint'], $webhook['http_method'])); + } + } + } + + public function jsonSerialize() + { + return [ + 'name' => $this->getName(), + //currently, the request data does not match the response data + 'event_url' => (string) $this->getVoiceConfig()->getWebhook(VoiceConfig::EVENT), + 'answer_url' => (string) $this->getVoiceConfig()->getWebhook(VoiceConfig::ANSWER), + 'type' => 'voice' //currently the only type + ]; + } + + public function __toString() + { + return (string) $this->getId(); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Application/ApplicationInterface.php b/vendor/nexmo/client/src/Application/ApplicationInterface.php new file mode 100644 index 0000000..2971609 --- /dev/null +++ b/vendor/nexmo/client/src/Application/ApplicationInterface.php @@ -0,0 +1,16 @@ +jsonUnserialize($data); + return $application; + } + + public function get($application) + { + if(!($application instanceof Application)){ + $application = new Application($application); + } + + $request = new Request( + $this->getClient()->getApiUrl() . $this->getCollectionPath() . '/' . $application->getId() + ,'GET' + ); + + $application->setRequest($request); + $response = $this->client->send($request); + $application->setResponse($response); + + if($response->getStatusCode() != '200'){ + throw $this->getException($response, $application); + } + + return $application; + } + + public function create($application) + { + return $this->post($application); + } + + public function post($application) + { + if(!($application instanceof Application)){ + $application = $this->createFromArray($application); + } + + $body = $application->getRequestData(false); + + $request = new Request( + $this->getClient()->getApiUrl() . $this->getCollectionPath() + ,'POST', + 'php://temp', + ['content-type' => 'application/json'] + ); + + $request->getBody()->write(json_encode($body)); + $application->setRequest($request); + $response = $this->client->send($request); + $application->setResponse($response); + + if($response->getStatusCode() != '201'){ + throw $this->getException($response, $application); + } + + return $application; + } + + public function update($application, $id = null) + { + return $this->put($application, $id); + } + + public function put($application, $id = null) + { + if(!($application instanceof Application)){ + $application = $this->createFromArray($application); + } + + if(is_null($id)){ + $id = $application->getId(); + } + + $body = $application->getRequestData(false); + + $request = new Request( + $this->getClient()->getApiUrl() . $this->getCollectionPath() . '/' . $id, + 'PUT', + 'php://temp', + ['content-type' => 'application/json'] + ); + + $request->getBody()->write(json_encode($body)); + $application->setRequest($request); + $response = $this->client->send($request); + $application->setResponse($response); + + if($response->getStatusCode() != '200'){ + throw $this->getException($response, $application); + } + + return $application; + } + + public function delete($application) + { + if(($application instanceof Application)){ + $id = $application->getId(); + } else { + $id = $application; + } + + $request = new Request( + $this->getClient()->getApiUrl(). $this->getCollectionPath() . '/' . $id + ,'DELETE' + ); + + if($application instanceof Application){ + $application->setRequest($request); + } + + $response = $this->client->send($request); + + if($application instanceof Application){ + $application->setResponse($response); + } + + if($response->getStatusCode() != '204'){ + throw $this->getException($response, $application); + } + + return true; + } + + protected function getException(ResponseInterface $response, $application = null) + { + $body = json_decode($response->getBody()->getContents(), true); + $status = $response->getStatusCode(); + + if($status >= 400 AND $status < 500) { + $e = new Exception\Request($body['error_title'], $status); + } elseif($status >= 500 AND $status < 600) { + $e = new Exception\Server($body['error_title'], $status); + } else { + $e = new Exception\Exception('Unexpected HTTP Status Code'); + throw $e; + } + + //todo use interfaces here + if(($application instanceof Application) AND (($e instanceof Exception\Request) OR ($e instanceof Exception\Server))){ + $e->setEntity($application); + } + + return $e; + } + + protected function createFromArray($array) + { + if(!is_array($array)){ + throw new \RuntimeException('application must implement `' . ApplicationInterface::class . '` or be an array`'); + } + + foreach(['name',] as $param){ + if(!isset($array[$param])){ + throw new \InvalidArgumentException('missing expected key `' . $param . '`'); + } + } + + $application = new Application(); + $application->setName($array['name']); + + foreach(['event', 'answer'] as $type){ + if(isset($array[$type . '_url'])){ + $method = isset($array[$type . '_method']) ? $array[$type . '_method'] : null; + $application->getVoiceConfig()->setWebhook($type . '_url', new Webhook($array[$type . '_url'], $method)); + } + } + + return $application; + } +} diff --git a/vendor/nexmo/client/src/Application/Filter.php b/vendor/nexmo/client/src/Application/Filter.php new file mode 100644 index 0000000..b3e1395 --- /dev/null +++ b/vendor/nexmo/client/src/Application/Filter.php @@ -0,0 +1,39 @@ +start = $start; + $this->end = $end; + } else { + $this->start = $end; + $this->end = $start; + } + } + + public function getQuery() + { + return [ + 'date' => $this->start->format(self::FORMAT) . '-' . $this->end->format(self::FORMAT) + ]; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Application/VoiceConfig.php b/vendor/nexmo/client/src/Application/VoiceConfig.php new file mode 100644 index 0000000..3792618 --- /dev/null +++ b/vendor/nexmo/client/src/Application/VoiceConfig.php @@ -0,0 +1,34 @@ +webhooks[$type] = $url; + return $this; + } + + public function getWebhook($type) + { + if(isset($this->webhooks[$type])){ + return $this->webhooks[$type]; + } + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Application/Webhook.php b/vendor/nexmo/client/src/Application/Webhook.php new file mode 100644 index 0000000..89db994 --- /dev/null +++ b/vendor/nexmo/client/src/Application/Webhook.php @@ -0,0 +1,46 @@ +url = $url; + $this->method = $method; + } + + public function getMethod() + { + return $this->method; + } + + public function getUrl() + { + return $this->url; + } + + public function __toString() + { + return $this->getUrl(); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Call/Call.php b/vendor/nexmo/client/src/Call/Call.php new file mode 100644 index 0000000..49b24bd --- /dev/null +++ b/vendor/nexmo/client/src/Call/Call.php @@ -0,0 +1,301 @@ +id = $id; + } + + public function get() + { + $request = new Request( + $this->getClient()->getApiUrl() . Collection::getCollectionPath() . '/' . $this->getId() + ,'GET' + ); + + $response = $this->getClient()->send($request); + + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + + $data = json_decode($response->getBody()->getContents(), true); + $this->jsonUnserialize($data); + + return $this; + } + + protected function getException(ResponseInterface $response) + { + $body = json_decode($response->getBody()->getContents(), true); + $status = $response->getStatusCode(); + + if($status >= 400 AND $status < 500) { + $e = new Exception\Request($body['error_title'], $status); + } elseif($status >= 500 AND $status < 600) { + $e = new Exception\Server($body['error_title'], $status); + } else { + $e = new Exception\Exception('Unexpected HTTP Status Code'); + } + + return $e; + } + + public function put($payload) + { + $request = new Request( + $this->getClient()->getApiUrl() . Collection::getCollectionPath() . '/' . $this->getId() + ,'PUT', + 'php://temp', + ['content-type' => 'application/json'] + ); + + $request->getBody()->write(json_encode($payload)); + $response = $this->client->send($request); + + $responseCode = $response->getStatusCode(); + if($responseCode != '200' && $responseCode != '204'){ + throw $this->getException($response); + } + + return $this; + } + + public function getId() + { + return $this->id; + } + + public function setTo($endpoint) + { + if(!($endpoint instanceof Endpoint)){ + $endpoint = new Endpoint($endpoint); + } + + $this->to = $endpoint; + return $this; + } + + /** + * @return Endpoint + */ + public function getTo() + { + if($this->lazyLoad()){ + return new Endpoint($this->data['to']['number'], $this->data['to']['type']); + } + + return $this->to; + } + + public function setFrom($endpoint) + { + if(!($endpoint instanceof Endpoint)){ + $endpoint = new Endpoint($endpoint); + } + + $this->from = $endpoint; + return $this; + } + + /** + * @return Endpoint + */ + public function getFrom() + { + if($this->lazyLoad()){ + return new Endpoint($this->data['from']['number'], $this->data['from']['type']); + } + + return $this->from; + } + + public function setWebhook($type, $url = null, $method = null) + { + if($type instanceof Webhook){ + $this->webhooks[$type->getType()] = $type; + return $this; + } + + if(is_null($url)){ + throw new \InvalidArgumentException('must provide `Nexmo\Call\Webhook` object, or a type and url: missing url' ); + } + + $this->webhooks[$type] = new Webhook($type, $url, $method); + return $this; + } + + public function setTimer($type, $length) + { + $this->data[$type . '_timer'] = $length; + } + + public function setTimeout($type, $length) + { + $this->data[$type . '_timeout'] = $length; + } + + public function getStatus() + { + if($this->lazyLoad()){ + return $this->data['status']; + } + } + + public function getDirection() + { + if($this->lazyLoad()){ + return $this->data['direction']; + } + } + + public function getConversation() + { + if($this->lazyLoad()){ + return new Conversation($this->data['conversation_uuid']); + } + } + + /** + * Returns true if the resource data is loaded. + * + * Will attempt to load the data if it's not already. + * + * @return bool + */ + protected function lazyLoad() + { + if(!empty($this->data)){ + return true; + } + + if(isset($this->id)){ + $this->get($this); + return true; + } + + return false; + } + + public function __get($name) + { + switch($name){ + case 'stream': + case 'talk': + case 'dtmf': + return $this->lazySubresource(ucfirst($name)); + default: + throw new \RuntimeException('property does not exist: ' . $name); + } + } + + public function __call($name, $arguments) + { + switch($name){ + case 'stream': + case 'talk': + case 'dtmf': + $entity = $this->lazySubresource(ucfirst($name)); + return call_user_func_array($entity, $arguments); + default: + throw new \RuntimeException('method does not exist: ' . $name); + } + } + + protected function lazySubresource($type) + { + if(!isset($this->subresources[$type])){ + $class = 'Nexmo\Call\\' . $type; + $instance = new $class($this->getId()); + $instance->setClient($this->getClient()); + $this->subresources[$type] = $instance; + } + + return $this->subresources[$type]; + } + + public function jsonSerialize() + { + $data = $this->data; + + if(isset($this->to)){ + $data['to'] = [$this->to->jsonSerialize()]; + } + + if(isset($this->from)){ + $data['from'] = $this->from->jsonSerialize(); + } + + foreach($this->webhooks as $webhook){ + $data = array_merge($data, $webhook->jsonSerialize()); + } + + return $data; + } + + public function jsonUnserialize(array $json) + { + $this->data = $json; + $this->id = $json['uuid']; + } +} diff --git a/vendor/nexmo/client/src/Call/Collection.php b/vendor/nexmo/client/src/Call/Collection.php new file mode 100644 index 0000000..0a710f0 --- /dev/null +++ b/vendor/nexmo/client/src/Call/Collection.php @@ -0,0 +1,203 @@ +setClient($this->getClient()); + $idOrCall->jsonUnserialize($data); + + return $idOrCall; + } + + /** + * @param null $callOrFilter + * @return $this|Call + */ + public function __invoke(Filter $filter = null) + { + if(!is_null($filter)){ + $this->setFilter($filter); + } + + return $this; + } + + public function create($call) + { + return $this->post($call); + } + + public function put($payload, $idOrCall) + { + if(!($idOrCall instanceof Call)){ + $idOrCall = new Call($idOrCall); + } + + $idOrCall->setClient($this->getClient()); + $idOrCall->put($payload); + return $idOrCall; + } + + public function delete($call = null, $type) + { + if(is_object($call) AND is_callable([$call, 'getId'])){ + $call = $call->getId(); + } + + if(!($call instanceof Call)){ + $call = new Call($call); + } + + $request = new Request( + $this->getClient()->getApiUrl() . $this->getCollectionPath() . '/' . $call->getId() . '/' . $type + ,'DELETE' + ); + + $response = $this->client->send($request); + + if($response->getStatusCode() != '204'){ + throw $this->getException($response); + } + + return $call; + } + + public function post($call) + { + if($call instanceof Call){ + $body = $call->getRequestData(); + } else { + $body = $call; + } + + $request = new Request( + $this->getClient()->getApiUrl() . $this->getCollectionPath() + ,'POST', + 'php://temp', + ['content-type' => 'application/json'] + ); + + $request->getBody()->write(json_encode($body)); + $response = $this->client->send($request); + + if($response->getStatusCode() != '201'){ + throw $this->getException($response); + } + + $body = json_decode($response->getBody()->getContents(), true); + $call = new Call($body['uuid']); + $call->jsonUnserialize($body); + $call->setClient($this->getClient()); + + return $call; + } + + public function get($call) + { + if(!($call instanceof Call)){ + $call = new Call($call); + } + + $call->setClient($this->getClient()); + $call->get(); + + return $call; + } + + protected function getException(ResponseInterface $response) + { + $body = json_decode($response->getBody()->getContents(), true); + $status = $response->getStatusCode(); + + // Error responses aren't consistent. Some are generated within the + // proxy and some are generated within voice itself. This handles + // both cases + + // This message isn't very useful, but we shouldn't ever see it + $errorTitle = 'Unexpected error'; + + if (isset($body['title'])) { + $errorTitle = $body['title']; + } + + if (isset($body['error_title'])) { + $errorTitle = $body['error_title']; + } + + if($status >= 400 AND $status < 500) { + $e = new Exception\Request($errorTitle, $status); + } elseif($status >= 500 AND $status < 600) { + $e = new Exception\Server($errorTitle, $status); + } else { + $e = new Exception\Exception('Unexpected HTTP Status Code'); + throw $e; + } + + return $e; + } + + public function offsetExists($offset) + { + //todo: validate form of id + return true; + } + + /** + * @param mixed $call + * @return Call + */ + public function offsetGet($call) + { + if(!($call instanceof Call)){ + $call = new Call($call); + } + + $call->setClient($this->getClient()); + return $call; + } + + public function offsetSet($offset, $value) + { + throw new \RuntimeException('can not set collection properties'); + } + + public function offsetUnset($offset) + { + throw new \RuntimeException('can not unset collection properties'); + } +} diff --git a/vendor/nexmo/client/src/Call/Dtmf.php b/vendor/nexmo/client/src/Call/Dtmf.php new file mode 100644 index 0000000..691c2f3 --- /dev/null +++ b/vendor/nexmo/client/src/Call/Dtmf.php @@ -0,0 +1,139 @@ +id = $id; + } + + public function __invoke(self $entity = null) + { + if(is_null($entity)){ + return $this; + } + + return $this->put($entity); + } + + public function getId() + { + return $this->id; + } + + public function setDigits($digits) + { + $this->data['digits'] = (string) $digits; + } + + public function put($dtmf = null) + { + if(!$dtmf){ + $dtmf = $this; + } + + $request = new Request( + $this->getClient()->getApiUrl() . Collection::getCollectionPath() . '/' . $this->getId() . '/dtmf', + 'PUT', + 'php://temp', + ['content-type' => 'application/json'] + ); + + $request->getBody()->write(json_encode($dtmf)); + $response = $this->client->send($request); + return $this->parseEventResponse($response); + } + + protected function parseEventResponse(ResponseInterface $response) + { + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + + $json = json_decode($response->getBody()->getContents(), true); + + if(!$json){ + throw new Exception\Exception('Unexpected Response Body Format'); + } + + return new Event($json); + } + + protected function getException(ResponseInterface $response) + { + $body = json_decode($response->getBody()->getContents(), true); + $status = $response->getStatusCode(); + + if($status >= 400 AND $status < 500) { + $e = new Exception\Request($body['error_title'], $status); + } elseif($status >= 500 AND $status < 600) { + $e = new Exception\Server($body['error_title'], $status); + } else { + $e = new Exception\Exception('Unexpected HTTP Status Code'); + throw $e; + } + + return $e; + } + + function jsonSerialize() + { + return $this->data; + } + + public function offsetExists($offset) + { + return isset($this->data[$offset]); + } + + public function offsetGet($offset) + { + return $this->data[$offset]; + } + + public function offsetSet($offset, $value) + { + if(!in_array($offset, $this->params)){ + throw new \RuntimeException('invalid parameter: ' . $offset); + } + + $this->data[$offset] = $value; + } + + public function offsetUnset($offset) + { + if(!in_array($offset, $this->params)){ + throw new \RuntimeException('invalid parameter: ' . $offset); + } + + unset($this->data[$offset]); + } +} diff --git a/vendor/nexmo/client/src/Call/Earmuff.php b/vendor/nexmo/client/src/Call/Earmuff.php new file mode 100644 index 0000000..32cc0e1 --- /dev/null +++ b/vendor/nexmo/client/src/Call/Earmuff.php @@ -0,0 +1,20 @@ + 'earmuff' + ]; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Call/Endpoint.php b/vendor/nexmo/client/src/Call/Endpoint.php new file mode 100644 index 0000000..a25db52 --- /dev/null +++ b/vendor/nexmo/client/src/Call/Endpoint.php @@ -0,0 +1,87 @@ +id = $id; + $this->type = $type; + $this->additional = $additional; + } + + public function getType() + { + return $this->type; + } + + public function getId() + { + return $this->id; + } + + public function set($property, $value) + { + $this->additional[$property] = $value; + return $this; + } + + public function get($property) + { + if(isset($this->additional[$property])){ + return $this->additional[$property]; + } + } + + public function getNumber() + { + if(!self::PHONE == $this->type){ + throw new \RuntimeException('number not defined for this type'); + } + + return $this->getId(); + } + + public function __toString() + { + return (string) $this->getId(); + } + + function jsonSerialize() + { + switch($this->type){ + case 'phone': + return array_merge( + $this->additional, + [ + 'type' => $this->type, + 'number' => $this->id + ] + + ); + default: + throw new \RuntimeException('unknown type: ' . $this->type); + } + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Call/Event.php b/vendor/nexmo/client/src/Call/Event.php new file mode 100644 index 0000000..b141be1 --- /dev/null +++ b/vendor/nexmo/client/src/Call/Event.php @@ -0,0 +1,53 @@ +data = $data; + } + + public function getId() + { + return $this->data['uuid']; + } + + public function getMessage() + { + return $this->data['message']; + } + + public function offsetExists($offset) + { + return isset($this->data[$offset]); + } + + public function offsetGet($offset) + { + return $this->data[$offset]; + } + + public function offsetSet($offset, $value) + { + throw new \RuntimeException('can not set properties directly'); + } + + public function offsetUnset($offset) + { + throw new \RuntimeException('can not set properties directly'); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Call/Filter.php b/vendor/nexmo/client/src/Call/Filter.php new file mode 100644 index 0000000..efbf0d9 --- /dev/null +++ b/vendor/nexmo/client/src/Call/Filter.php @@ -0,0 +1,81 @@ +query; + } + + public function sortAscending() + { + return $this->setOrder('asc'); + } + + public function sortDescending() + { + return $this->setOrder('desc'); + } + + public function setStatus($status) + { + $this->query['status'] = (string) $status; + return $this; + } + + public function setStart(\DateTime $start) + { + $start->setTimezone(new \DateTimeZone("UTC")); + $this->query['date_start'] = $start->format('Y-m-d\TH:i:s\Z'); + return $this; + } + + public function setEnd(\DateTime $end) + { + $end->setTimezone(new \DateTimeZone("UTC")); + $this->query['date_end'] = $end->format('Y-m-d\TH:i:s\Z'); + return $this; + } + + public function setSize($size) + { + $this->query['page_size'] = (int) $size; + return $this; + } + + public function setIndex($index) + { + $this->query['record_index'] = (int) $index; + return $this; + } + + public function setOrder($order) + { + $this->query['order'] = (string) $order; + return $this; + } + + public function setConversation($conversation) + { + if($conversation instanceof Conversation){ + $conversation = $conversation->getId(); + } + + $this->query['conversation_uuid'] = $conversation; + + return $this; + } +} diff --git a/vendor/nexmo/client/src/Call/Hangup.php b/vendor/nexmo/client/src/Call/Hangup.php new file mode 100644 index 0000000..48afd81 --- /dev/null +++ b/vendor/nexmo/client/src/Call/Hangup.php @@ -0,0 +1,21 @@ + 'hangup' + ]; + } + +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Call/Mute.php b/vendor/nexmo/client/src/Call/Mute.php new file mode 100644 index 0000000..2702bc8 --- /dev/null +++ b/vendor/nexmo/client/src/Call/Mute.php @@ -0,0 +1,20 @@ + 'mute' + ]; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Call/Stream.php b/vendor/nexmo/client/src/Call/Stream.php new file mode 100644 index 0000000..d0c16de --- /dev/null +++ b/vendor/nexmo/client/src/Call/Stream.php @@ -0,0 +1,127 @@ +id = $id; + } + + public function __invoke(Stream $stream = null) + { + if(is_null($stream)){ + return $this; + } + + return $this->put($stream); + } + + public function getId() + { + return $this->id; + } + + public function setUrl($url) + { + if(!is_array($url)){ + $url = array($url); + } + + $this->data['stream_url'] = $url; + } + + public function setLoop($times) + { + $this->data['loop'] = (int) $times; + } + + public function put($stream = null) + { + if(!$stream){ + $stream = $this; + } + + $request = new Request( + $this->getClient()->getApiUrl() . Collection::getCollectionPath() . '/' . $this->getId() . '/stream', + 'PUT', + 'php://temp', + ['content-type' => 'application/json'] + ); + + $request->getBody()->write(json_encode($stream)); + $response = $this->client->send($request); + return $this->parseEventResponse($response); + } + + public function delete() + { + $request = new Request( + $this->getClient()->getApiUrl() . Collection::getCollectionPath() . '/' . $this->getId() . '/stream', + 'DELETE' + ); + + $response = $this->client->send($request); + return $this->parseEventResponse($response); + } + + protected function parseEventResponse(ResponseInterface $response) + { + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + + $json = json_decode($response->getBody()->getContents(), true); + + if(!$json){ + throw new Exception\Exception('Unexpected Response Body Format'); + } + + return new Event($json); + } + + protected function getException(ResponseInterface $response) + { + $body = json_decode($response->getBody()->getContents(), true); + $status = $response->getStatusCode(); + + if($status >= 400 AND $status < 500) { + $e = new Exception\Request($body['error_title'], $status); + } elseif($status >= 500 AND $status < 600) { + $e = new Exception\Server($body['error_title'], $status); + } else { + $e = new Exception\Exception('Unexpected HTTP Status Code'); + throw $e; + } + + return $e; + } + + function jsonSerialize() + { + return $this->data; + } +} diff --git a/vendor/nexmo/client/src/Call/Talk.php b/vendor/nexmo/client/src/Call/Talk.php new file mode 100644 index 0000000..a16acef --- /dev/null +++ b/vendor/nexmo/client/src/Call/Talk.php @@ -0,0 +1,162 @@ +id = $id; + } + + public function __invoke(self $entity = null) + { + if(is_null($entity)){ + return $this; + } + + return $this->put($entity); + } + + public function getId() + { + return $this->id; + } + + public function setText($text) + { + $this->data['text'] = (string) $text; + } + + public function setVoiceName($name) + { + $this->data['voice_name'] = (string) $name; + } + + public function setLoop($times) + { + $this->data['loop'] = (int) $times; + } + + public function put($talk = null) + { + if(!$talk){ + $talk = $this; + } + + $request = new Request( + $this->getClient()->getApiUrl() . Collection::getCollectionPath() . '/' . $this->getId() . '/talk', + 'PUT', + 'php://temp', + ['content-type' => 'application/json'] + ); + + $request->getBody()->write(json_encode($talk)); + $response = $this->client->send($request); + return $this->parseEventResponse($response); + } + + public function delete() + { + $request = new Request( + $this->getClient()->getApiUrl() . Collection::getCollectionPath() . '/' . $this->getId() . '/talk', + 'DELETE' + ); + + $response = $this->client->send($request); + return $this->parseEventResponse($response); + } + + protected function parseEventResponse(ResponseInterface $response) + { + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + + $json = json_decode($response->getBody()->getContents(), true); + + if(!$json){ + throw new Exception\Exception('Unexpected Response Body Format'); + } + + return new Event($json); + } + + protected function getException(ResponseInterface $response) + { + $body = json_decode($response->getBody()->getContents(), true); + $status = $response->getStatusCode(); + + if($status >= 400 AND $status < 500) { + $e = new Exception\Request($body['error_title'], $status); + } elseif($status >= 500 AND $status < 600) { + $e = new Exception\Server($body['error_title'], $status); + } else { + $e = new Exception\Exception('Unexpected HTTP Status Code'); + throw $e; + } + + return $e; + } + + function jsonSerialize() + { + return $this->data; + } + + public function offsetExists($offset) + { + return isset($this->data[$offset]); + } + + public function offsetGet($offset) + { + return $this->data[$offset]; + } + + public function offsetSet($offset, $value) + { + if(!in_array($offset, $this->params)){ + throw new \RuntimeException('invalid parameter: ' . $offset); + } + + $this->data[$offset] = $value; + } + + public function offsetUnset($offset) + { + if(!in_array($offset, $this->params)){ + throw new \RuntimeException('invalid parameter: ' . $offset); + } + + unset($this->data[$offset]); + } +} diff --git a/vendor/nexmo/client/src/Call/Transfer.php b/vendor/nexmo/client/src/Call/Transfer.php new file mode 100644 index 0000000..6c74897 --- /dev/null +++ b/vendor/nexmo/client/src/Call/Transfer.php @@ -0,0 +1,35 @@ +urls = $urls; + } + + function jsonSerialize() + { + return [ + 'action' => 'transfer', + 'destination' => [ + 'type' => 'ncco', + 'url' => $this->urls + ] + ]; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Call/Unearmuff.php b/vendor/nexmo/client/src/Call/Unearmuff.php new file mode 100644 index 0000000..5b13e3d --- /dev/null +++ b/vendor/nexmo/client/src/Call/Unearmuff.php @@ -0,0 +1,20 @@ + 'unearmuff' + ]; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Call/Unmute.php b/vendor/nexmo/client/src/Call/Unmute.php new file mode 100644 index 0000000..05c0b22 --- /dev/null +++ b/vendor/nexmo/client/src/Call/Unmute.php @@ -0,0 +1,20 @@ + 'unmute' + ]; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Call/Webhook.php b/vendor/nexmo/client/src/Call/Webhook.php new file mode 100644 index 0000000..ebb1c2d --- /dev/null +++ b/vendor/nexmo/client/src/Call/Webhook.php @@ -0,0 +1,55 @@ +urls = $urls; + $this->type = $type; + $this->method = $method; + } + + public function getType() + { + return $this->type; + } + + public function add($url) + { + $this->urls[] = $url; + } + + function jsonSerialize() + { + $data = [ + $this->type . '_url' => $this->urls + ]; + + if(isset($this->method)){ + $data[$this->type . '_method'] = $this->method; + } + + return $data; + } + + +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Client.php b/vendor/nexmo/client/src/Client.php new file mode 100644 index 0000000..899f6c8 --- /dev/null +++ b/vendor/nexmo/client/src/Client.php @@ -0,0 +1,510 @@ +setHttpClient($client); + + //make sure we know how to use the credentials + if(!($credentials instanceof Container) && !($credentials instanceof Basic) && !($credentials instanceof SignatureSecret) && !($credentials instanceof OAuth) && !($credentials instanceof Keypair)){ + throw new \RuntimeException('unknown credentials type: ' . get_class($credentials)); + } + + $this->credentials = $credentials; + + $this->options = $options; + + // If they've provided an app name, validate it + if (isset($options['app'])) { + $this->validateAppOptions($options['app']); + } + + // Set the default URLs. Keep the constants for + // backwards compatibility + $this->apiUrl = static::BASE_API; + $this->restUrl = static::BASE_REST; + + // If they've provided alternative URLs, use that instead + // of the defaults + if (isset($options['base_rest_url'])) { + $this->restUrl = $options['base_rest_url']; + } + + if (isset($options['base_api_url'])) { + $this->apiUrl = $options['base_api_url']; + } + + $this->setFactory(new MapFactory([ + 'account' => 'Nexmo\Account\Client', + 'insights' => 'Nexmo\Insights\Client', + 'message' => 'Nexmo\Message\Client', + 'verify' => 'Nexmo\Verify\Client', + 'applications' => 'Nexmo\Application\Client', + 'numbers' => 'Nexmo\Numbers\Client', + 'calls' => 'Nexmo\Call\Collection', + 'conversion' => 'Nexmo\Conversion\Client', + 'conversation' => 'Nexmo\Conversations\Collection', + 'user' => 'Nexmo\User\Collection', + 'redact' => 'Nexmo\Redact\Client', + ], $this)); + } + + public function getRestUrl() { + return $this->restUrl; + } + + public function getApiUrl() { + return $this->apiUrl; + } + + /** + * Set the Http Client to used to make API requests. + * + * This allows the default http client to be swapped out for a HTTPlug compatible + * replacement. + * + * @param HttpClient $client + * @return $this + */ + public function setHttpClient(HttpClient $client) + { + $this->client = $client; + return $this; + } + + /** + * Get the Http Client used to make API requests. + * + * @return HttpClient + */ + public function getHttpClient() + { + return $this->client; + } + + /** + * Set the factory used to create API specific clients. + * + * @param FactoryInterface $factory + * @return $this + */ + public function setFactory(FactoryInterface $factory) + { + $this->factory = $factory; + return $this; + } + + /** + * @param RequestInterface $request + * @param Signature $signature + * @return RequestInterface + */ + public static function signRequest(RequestInterface $request, SignatureSecret $credentials) + { + switch($request->getHeaderLine('content-type')){ + case 'application/json': + $body = $request->getBody(); + $body->rewind(); + $content = $body->getContents(); + $params = json_decode($content, true); + $params['api_key'] = $credentials['api_key']; + $signature = new Signature($params, $credentials['signature_secret'], $credentials['signature_method']); + $body->rewind(); + $body->write(json_encode($signature->getSignedParams())); + break; + case 'application/x-www-form-urlencoded': + $body = $request->getBody(); + $body->rewind(); + $content = $body->getContents(); + $params = []; + parse_str($content, $params); + $params['api_key'] = $credentials['api_key']; + $signature = new Signature($params, $credentials['signature_secret'], $credentials['signature_method']); + $params = $signature->getSignedParams(); + $body->rewind(); + $body->write(http_build_query($params, null, '&')); + break; + default: + $query = []; + parse_str($request->getUri()->getQuery(), $query); + $query['api_key'] = $credentials['api_key']; + $signature = new Signature($query, $credentials['signature_secret'], $credentials['signature_method']); + $request = $request->withUri($request->getUri()->withQuery(http_build_query($signature->getSignedParams()))); + break; + } + + return $request; + } + + public static function authRequest(RequestInterface $request, Basic $credentials) + { + switch($request->getHeaderLine('content-type')) { + case 'application/json': + if (static::requiresBasicAuth($request)) { + $c = $credentials->asArray(); + $request = $request->withHeader('Authorization', 'Basic ' . base64_encode($c['api_key'] . ':' . $c['api_secret'])); + } else if (static::requiresAuthInUrlNotBody($request)) { + $query = []; + parse_str($request->getUri()->getQuery(), $query); + $query = array_merge($query, $credentials->asArray()); + $request = $request->withUri($request->getUri()->withQuery(http_build_query($query))); + } else { + $body = $request->getBody(); + $body->rewind(); + $content = $body->getContents(); + $params = json_decode($content, true); + $params = array_merge($params, $credentials->asArray()); + $body->rewind(); + $body->write(json_encode($params)); + } + break; + case 'application/x-www-form-urlencoded': + $body = $request->getBody(); + $body->rewind(); + $content = $body->getContents(); + $params = []; + parse_str($content, $params); + $params = array_merge($params, $credentials->asArray()); + $body->rewind(); + $body->write(http_build_query($params, null, '&')); + break; + default: + $query = []; + parse_str($request->getUri()->getQuery(), $query); + $query = array_merge($query, $credentials->asArray()); + $request = $request->withUri($request->getUri()->withQuery(http_build_query($query))); + break; + } + + return $request; + } + + /** + * @param array $claims + * @return \Lcobucci\JWT\Token + */ + public function generateJwt($claims = []) + { + if (method_exists($this->credentials, "generateJwt")) { + return $this->credentials->generateJwt($claims); + } + throw new Exception(get_class($this->credentials).' does not support JWT generation'); + } + + /** + * Takes a URL and a key=>value array to generate a GET PSR-7 request object + * + * @param string $url The URL to make a request to + * @param array $params Key=>Value array of data to use as the query string + * @return \Psr\Http\Message\ResponseInterface + */ + public function get($url, array $params = []) + { + $queryString = '?' . http_build_query($params); + + $url = $url . $queryString; + + $request = new Request( + $url, + 'GET' + ); + + return $this->send($request); + } + + /** + * Takes a URL and a key=>value array to generate a POST PSR-7 request object + * + * @param string $url The URL to make a request to + * @param array $params Key=>Value array of data to send + * @return \Psr\Http\Message\ResponseInterface + */ + public function post($url, array $params) + { + $request = new Request( + $url, + 'POST', + 'php://temp', + ['content-type' => 'application/json'] + ); + + $request->getBody()->write(json_encode($params)); + return $this->send($request); + } + + /** + * Takes a URL and a key=>value array to generate a POST PSR-7 request object + * + * @param string $url The URL to make a request to + * @param array $params Key=>Value array of data to send + * @return \Psr\Http\Message\ResponseInterface + */ + public function postUrlEncoded($url, array $params) + { + $request = new Request( + $url, + 'POST', + 'php://temp', + ['content-type' => 'application/x-www-form-urlencoded'] + ); + + $request->getBody()->write(http_build_query($params)); + return $this->send($request); + } + + /** + * Takes a URL and a key=>value array to generate a PUT PSR-7 request object + * + * @param string $url The URL to make a request to + * @param array $params Key=>Value array of data to send + * @return \Psr\Http\Message\ResponseInterface + */ + public function put($url, array $params) + { + $request = new Request( + $url, + 'PUT', + 'php://temp', + ['content-type' => 'application/json'] + ); + + $request->getBody()->write(json_encode($params)); + return $this->send($request); + } + + /** + * Takes a URL and a key=>value array to generate a DELETE PSR-7 request object + * + * @param string $url The URL to make a request to + * @return \Psr\Http\Message\ResponseInterface + */ + public function delete($url) + { + $request = new Request( + $url, + 'DELETE' + ); + + return $this->send($request); + } + + /** + * Wraps the HTTP Client, creates a new PSR-7 request adding authentication, signatures, etc. + * + * @param \Psr\Http\Message\RequestInterface $request + * @return \Psr\Http\Message\ResponseInterface + */ + public function send(\Psr\Http\Message\RequestInterface $request) + { + if($this->credentials instanceof Container) { + if ($this->needsKeypairAuthentication($request)) { + $request = $request->withHeader('Authorization', 'Bearer ' . $this->credentials->get(Keypair::class)->generateJwt()); + } else { + $request = self::authRequest($request, $this->credentials->get(Basic::class)); + } + } elseif($this->credentials instanceof Keypair){ + $request = $request->withHeader('Authorization', 'Bearer ' . $this->credentials->generateJwt()); + } elseif($this->credentials instanceof SignatureSecret){ + $request = self::signRequest($request, $this->credentials); + } elseif($this->credentials instanceof Basic){ + $request = self::authRequest($request, $this->credentials); + } + + //todo: add oauth support + + //allow any part of the URI to be replaced with a simple search + if(isset($this->options['url'])){ + foreach($this->options['url'] as $search => $replace){ + $uri = (string) $request->getUri(); + + $new = str_replace($search, $replace, $uri); + if($uri !== $new){ + $request = $request->withUri(new Uri($new)); + } + } + } + + // The user agent must be in the following format: + // LIBRARY-NAME/LIBRARY-VERSION LANGUAGE-NAME/LANGUAGE-VERSION [APP-NAME/APP-VERSION] + // See https://github.com/Nexmo/client-library-specification/blob/master/SPECIFICATION.md#reporting + $userAgent = []; + + // Library name + $userAgent[] = 'nexmo-php/'.self::VERSION; + + // Language name + $userAgent[] = 'php/'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION; + + // If we have an app set, add that to the UA + if (isset($this->options['app'])) { + $app = $this->options['app']; + $userAgent[] = $app['name'].'/'.$app['version']; + } + + // Set the header. Build by joining all the parts we have with a space + $request = $request->withHeader('User-Agent', implode(" ", $userAgent)); + + $response = $this->client->sendRequest($request); + return $response; + } + + protected function validateAppOptions($app) { + $disallowedCharacters = ['/', ' ', "\t", "\n"]; + foreach (['name', 'version'] as $key) { + if (!isset($app[$key])) { + throw new \InvalidArgumentException('app.'.$key.' has not been set'); + } + + foreach ($disallowedCharacters as $char) { + if (strpos($app[$key], $char) !== false) { + throw new \InvalidArgumentException('app.'.$key.' cannot contain the '.$char.' character'); + } + } + } + } + + public function serialize(EntityInterface $entity) + { + if($entity instanceof Verification){ + return $this->verify()->serialize($entity); + } + + throw new \RuntimeException('unknown class `' . get_class($entity) . '``'); + } + + public function unserialize($entity) + { + if(is_string($entity)){ + $entity = unserialize($entity); + } + + if($entity instanceof Verification){ + return $this->verify()->unserialize($entity); + } + + throw new \RuntimeException('unknown class `' . get_class($entity) . '``'); + } + + public function __call($name, $args) + { + if(!$this->factory->hasApi($name)){ + throw new \RuntimeException('no api namespace found: ' . $name); + } + + $collection = $this->factory->getApi($name); + + if(empty($args)){ + return $collection; + } + + return call_user_func_array($collection, $args); + } + + public function __get($name) + { + if(!$this->factory->hasApi($name)){ + throw new \RuntimeException('no api namespace found: ' . $name); + } + + return $this->factory->getApi($name); + } + + protected static function requiresBasicAuth(\Psr\Http\Message\RequestInterface $request) + { + $path = $request->getUri()->getPath(); + $isSecretManagementEndpoint = strpos($path, '/accounts') === 0 && strpos($path, '/secrets') !== false; + + return $isSecretManagementEndpoint; + } + + protected static function requiresAuthInUrlNotBody(\Psr\Http\Message\RequestInterface $request) + { + $path = $request->getUri()->getPath(); + $isRedactEndpoint = strpos($path, '/v1/redact') === 0; + + return $isRedactEndpoint; + } + + protected function needsKeypairAuthentication(\Psr\Http\Message\RequestInterface $request) + { + $path = $request->getUri()->getPath(); + $isCallEndpoint = strpos($path, '/v1/calls') === 0; + $isRecordingUrl = strpos($path, '/v1/files') === 0; + $isStitchEndpoint = strpos($path, '/beta/conversation') === 0; + $isUserEndpoint = strpos($path, '/beta/users') === 0; + + return $isCallEndpoint || $isRecordingUrl || $isStitchEndpoint || $isUserEndpoint; + } +} diff --git a/vendor/nexmo/client/src/Client/Callback/Callback.php b/vendor/nexmo/client/src/Client/Callback/Callback.php new file mode 100644 index 0000000..d1b2175 --- /dev/null +++ b/vendor/nexmo/client/src/Client/Callback/Callback.php @@ -0,0 +1,57 @@ +expected, $keys); + + if($missing){ + throw new \RuntimeException('missing expected callback keys: ' . implode(', ', $missing)); + } + + $this->data = $data; + } + + public function getData() + { + return $this->data; + } + + public static function fromEnv($source = self::ENV_ALL) + { + switch(strtolower($source)){ + case 'post': + $data = $_POST; + break; + case 'get': + $data = $_GET; + break; + case 'all': + $data = array_merge($_GET, $_POST); + break; + default: + throw new \InvalidArgumentException('invalid source: ' . $source); + } + + return new static($data); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Client/Callback/CallbackInterface.php b/vendor/nexmo/client/src/Client/Callback/CallbackInterface.php new file mode 100644 index 0000000..3ed342c --- /dev/null +++ b/vendor/nexmo/client/src/Client/Callback/CallbackInterface.php @@ -0,0 +1,14 @@ +client = $client; + } + + protected function getClient() + { + if(isset($this->client)){ + return $this->client; + } + + throw new \RuntimeException('Nexmo\Client not set'); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Client/Credentials/AbstractCredentials.php b/vendor/nexmo/client/src/Client/Credentials/AbstractCredentials.php new file mode 100644 index 0000000..c4ae08c --- /dev/null +++ b/vendor/nexmo/client/src/Client/Credentials/AbstractCredentials.php @@ -0,0 +1,53 @@ +credentials[$offset]); + } + + public function offsetGet($offset) + { + return $this->credentials[$offset]; + } + + public function offsetSet($offset, $value) + { + throw $this->readOnlyException(); + } + + public function offsetUnset($offset) + { + throw $this->readOnlyException(); + } + + public function __get($name) + { + return $this->credentials[$name]; + } + + public function asArray() + { + return $this->credentials; + } + + protected function readOnlyException() + { + return new \RuntimeException(sprintf( + '%s is read only, cannot modify using array access.', + get_class($this) + )); + } + +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Client/Credentials/Basic.php b/vendor/nexmo/client/src/Client/Credentials/Basic.php new file mode 100644 index 0000000..f5991c4 --- /dev/null +++ b/vendor/nexmo/client/src/Client/Credentials/Basic.php @@ -0,0 +1,28 @@ +credentials['api_key'] = $key; + $this->credentials['api_secret'] = $secret; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Client/Credentials/Container.php b/vendor/nexmo/client/src/Client/Credentials/Container.php new file mode 100644 index 0000000..62d739b --- /dev/null +++ b/vendor/nexmo/client/src/Client/Credentials/Container.php @@ -0,0 +1,69 @@ +addCredential($credential); + } + } + + protected function addCredential(CredentialsInterface $credential) + { + $type = $this->getType($credential); + if(isset($this->credentials[$type])){ + throw new \RuntimeException('can not use more than one of a single credential type'); + } + + $this->credentials[$type] = $credential; + } + + protected function getType(CredentialsInterface $credential) + { + foreach ($this->types as $type) { + if($credential instanceof $type){ + return $type; + } + } + } + + public function get($type) + { + if(!isset($this->credentials[$type])){ + throw new \RuntimeException('credental not set'); + } + + return $this->credentials[$type]; + } + + public function has($type) + { + return isset($this->credentials[$type]); + } + + public function generateJwt($claims) { + return $this->credentials[Keypair::class]->generateJwt($claims); + } + +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Client/Credentials/CredentialsInterface.php b/vendor/nexmo/client/src/Client/Credentials/CredentialsInterface.php new file mode 100644 index 0000000..7b92501 --- /dev/null +++ b/vendor/nexmo/client/src/Client/Credentials/CredentialsInterface.php @@ -0,0 +1,14 @@ +credentials['key'] = $privateKey; + if($application){ + if($application instanceof Application){ + $application = $application->getId(); + } + + $this->credentials['application'] = $application; + } + + $this->key = new Key($privateKey); + $this->signer = new Sha256(); + } + + public function generateJwt(array $claims = []) + { + $exp = time() + 60; + $iat = time(); + $jti = base64_encode(mt_rand()); + + if(isset($claims['exp'])){ + $exp = $claims['exp']; + unset($claims['exp']); + } + + if(isset($claims['iat'])){ + $iat = $claims['iat']; + unset($claims['iat']); + } + + if(isset($claims['jti'])){ + $jti = $claims['jti']; + unset($claims['jti']); + } + + $builder = new Builder(); + $builder->setIssuedAt($iat) + ->setExpiration($exp) + ->setId($jti); + + + if(isset($claims['nbf'])){ + $builder->setNotBefore($claims['nbf']); + unset($claims['nbf']); + } + + if(isset($this->credentials['application'])){ + $builder->set('application_id', $this->credentials['application']); + } + + if(!empty($claims)){ + foreach($claims as $claim => $value){ + $builder->set($claim, $value); + } + } + + return $builder->sign($this->signer, $this->key)->getToken(); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Client/Credentials/OAuth.php b/vendor/nexmo/client/src/Client/Credentials/OAuth.php new file mode 100644 index 0000000..b5c8392 --- /dev/null +++ b/vendor/nexmo/client/src/Client/Credentials/OAuth.php @@ -0,0 +1,26 @@ +credentials = array_combine(array('consumer_key', 'consumer_secret', 'token', 'token_secret'), func_get_args()); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Client/Credentials/SignatureSecret.php b/vendor/nexmo/client/src/Client/Credentials/SignatureSecret.php new file mode 100644 index 0000000..f9f2327 --- /dev/null +++ b/vendor/nexmo/client/src/Client/Credentials/SignatureSecret.php @@ -0,0 +1,25 @@ +credentials['api_key'] = $key; + $this->credentials['signature_secret'] = $signature_secret; + $this->credentials['signature_method'] = $method; + } +} diff --git a/vendor/nexmo/client/src/Client/Exception/Exception.php b/vendor/nexmo/client/src/Client/Exception/Exception.php new file mode 100644 index 0000000..1089f29 --- /dev/null +++ b/vendor/nexmo/client/src/Client/Exception/Exception.php @@ -0,0 +1,14 @@ +errors = $errors; + parent::__construct($message, $code, $previous); + } + + public function getValidationErrors() { + return $this->errors; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Client/Factory/FactoryInterface.php b/vendor/nexmo/client/src/Client/Factory/FactoryInterface.php new file mode 100644 index 0000000..55e27e2 --- /dev/null +++ b/vendor/nexmo/client/src/Client/Factory/FactoryInterface.php @@ -0,0 +1,30 @@ +map = $map; + $this->client = $client; + } + + public function hasApi($api) + { + return isset($this->map[$api]); + } + + public function getApi($api) + { + if(isset($this->cache[$api])){ + return $this->cache[$api]; + } + + if(!$this->hasApi($api)){ + throw new \RuntimeException(sprintf( + 'no map defined for `%s`', + $api + )); + } + + $class = $this->map[$api]; + + $instance = new $class(); + if($instance instanceof Client\ClientAwareInterface){ + $instance->setClient($this->client); + } + $this->cache[$api] = $instance; + return $instance; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Client/Request/AbstractRequest.php b/vendor/nexmo/client/src/Client/Request/AbstractRequest.php new file mode 100644 index 0000000..f1b9f15 --- /dev/null +++ b/vendor/nexmo/client/src/Client/Request/AbstractRequest.php @@ -0,0 +1,22 @@ +params, 'is_scalar'); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Client/Request/RequestInterface.php b/vendor/nexmo/client/src/Client/Request/RequestInterface.php new file mode 100644 index 0000000..2aa435b --- /dev/null +++ b/vendor/nexmo/client/src/Client/Request/RequestInterface.php @@ -0,0 +1,21 @@ +data; + } + + public function isSuccess() + { + return isset($this->data['status']) AND $this->data['status'] == 0; + } + + public function isError() + { + return !$this->isSuccess(); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Client/Response/Error.php b/vendor/nexmo/client/src/Client/Response/Error.php new file mode 100644 index 0000000..9a38404 --- /dev/null +++ b/vendor/nexmo/client/src/Client/Response/Error.php @@ -0,0 +1,45 @@ +expected = ['status', 'error-text']; + + return parent::__construct($data); + } + + public function isError() + { + return true; + } + + public function isSuccess() + { + return false; + } + + public function getCode() + { + return $this->data['status']; + } + + public function getMessage() + { + return $this->data['error-text']; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Client/Response/Response.php b/vendor/nexmo/client/src/Client/Response/Response.php new file mode 100644 index 0000000..2207c4c --- /dev/null +++ b/vendor/nexmo/client/src/Client/Response/Response.php @@ -0,0 +1,30 @@ +expected, $keys); + + if($missing){ + throw new \RuntimeException('missing expected response keys: ' . implode(', ', $missing)); + } + + $this->data = $data; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Client/Response/ResponseInterface.php b/vendor/nexmo/client/src/Client/Response/ResponseInterface.php new file mode 100644 index 0000000..fa18f5c --- /dev/null +++ b/vendor/nexmo/client/src/Client/Response/ResponseInterface.php @@ -0,0 +1,17 @@ +params = $params; + $this->signed = $params; + + if(!isset($this->signed['timestamp'])){ + $this->signed['timestamp'] = time(); + } + + //remove signature if present + unset($this->signed['sig']); + + //sort params + ksort($this->signed); + + $signed = []; + foreach ($this->signed as $key => $value) { + $signed[$key] = str_replace(array("&", "="), "_", $value); + } + + //create base string + $base = '&'.urldecode(http_build_query($signed)); + + $this->signed['sig'] = $this->sign($signatureMethod, $base, $secret); + } + + protected function sign($signatureMethod, $data, $secret) { + switch($signatureMethod) { + case 'md5hash': + // md5hash needs the secret appended + $data .= $secret; + return md5($data); + break; + case 'md5': + case 'sha1': + case 'sha256': + case 'sha512': + return hash_hmac($signatureMethod, $data, $secret); + break; + default: + throw new Exception('Unknown signature algorithm: '.$signatureMethod.'. Expected: md5hash, md5, sha1, sha256, or sha512'); + } + } + + /** + * Get the original parameters. + * + * @return array + */ + public function getParams() + { + return $this->params; + } + + /** + * Get the signature for the parameters. + * + * @return string + */ + public function getSignature() + { + return $this->signed['sig']; + } + + /** + * Get a full set of parameters including the signature and timestamp. + * + * @return array + */ + public function getSignedParams() + { + return $this->signed; + } + + /** + * Check that a signature (or set of parameters) is valid. + * + * @param array| string $signature + * @return bool + * @throws \InvalidArgumentException + */ + public function check($signature) + { + if(is_array($signature) AND isset($signature['sig'])){ + $signature = $signature['sig']; + } + + if(!is_string($signature)){ + throw new \InvalidArgumentException('signature must be string, or present in array or parameters'); + } + + return $signature == $this->signed['sig']; + } + + /** + * Allow easy comparison. + * + * @return string + */ + public function __toString() + { + return $this->getSignature(); + } +} diff --git a/vendor/nexmo/client/src/Conversations/Collection.php b/vendor/nexmo/client/src/Conversations/Collection.php new file mode 100644 index 0000000..3ab3615 --- /dev/null +++ b/vendor/nexmo/client/src/Conversations/Collection.php @@ -0,0 +1,178 @@ +setClient($this->getClient()); + $idOrConversation->jsonUnserialize($data); + + return $idOrConversation; + } + + public function hydrateAll($conversations) + { + $hydrated = []; + foreach ($conversations as $conversation) { + $hydrated[] = $this->hydrateEntity($conversation, $conversation['id']); + } + + return $hydrated; + } + + /** + * @param null $conversation + * @return $this|Conversation + */ + public function __invoke(Filter $filter = null) + { + if(!is_null($filter)){ + $this->setFilter($filter); + } + + return $this; + } + + public function create($conversation) + { + return $this->post($conversation); + } + + public function post($conversation) + { + if($conversation instanceof Conversation){ + $body = $conversation->getRequestData(); + } else { + $body = $conversation; + } + + $request = new Request( + $this->getClient()->getApiUrl() . $this->getCollectionPath() + ,'POST', + 'php://temp', + ['content-type' => 'application/json'] + ); + + $request->getBody()->write(json_encode($body)); + $response = $this->getClient()->send($request); + + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + + $body = json_decode($response->getBody()->getContents(), true); + $conversation = new Conversation($body['id']); + $conversation->jsonUnserialize($body); + $conversation->setClient($this->getClient()); + + return $conversation; + } + + public function get($conversation) + { + if(!($conversation instanceof Conversation)){ + $conversation = new Conversation($conversation); + } + + $conversation->setClient($this->getClient()); + $conversation->get(); + + return $conversation; + } + + protected function getException(ResponseInterface $response) + { + $body = json_decode($response->getBody()->getContents(), true); + $status = $response->getStatusCode(); + + // This message isn't very useful, but we shouldn't ever see it + $errorTitle = 'Unexpected error'; + + if (isset($body['description'])) { + $errorTitle = $body['description']; + } + + if (isset($body['error_title'])) { + $errorTitle = $body['error_title']; + } + + if($status >= 400 AND $status < 500) { + $e = new Exception\Request($errorTitle, $status); + } elseif($status >= 500 AND $status < 600) { + $e = new Exception\Server($errorTitle, $status); + } else { + $e = new Exception\Exception('Unexpected HTTP Status Code'); + throw $e; + } + + return $e; + } + + public function offsetExists($offset) + { + return true; + } + + /** + * @param mixed $conversation + * @return Conversation + */ + public function offsetGet($conversation) + { + if(!($conversation instanceof Conversation)){ + $conversation = new Conversation($conversation); + } + + $conversation->setClient($this->getClient()); + return $conversation; + } + + public function offsetSet($offset, $value) + { + throw new \RuntimeException('can not set collection properties'); + } + + public function offsetUnset($offset) + { + throw new \RuntimeException('can not unset collection properties'); + } +} diff --git a/vendor/nexmo/client/src/Conversations/Conversation.php b/vendor/nexmo/client/src/Conversations/Conversation.php new file mode 100644 index 0000000..70d59b5 --- /dev/null +++ b/vendor/nexmo/client/src/Conversations/Conversation.php @@ -0,0 +1,182 @@ +data['id'] = $id; + } + + public function setName($name) + { + $this->data['name'] = $name; + return $this; + } + + public function setDisplayName($name) + { + $this->data['display_name'] = $name; + return $this; + } + + public function getId() + { + if (isset($this->data['uuid'])) { + return $this->data['uuid']; + } + return $this->data['id']; + } + + public function __toString() + { + return (string)$this->getId(); + } + + + public function get() + { + $request = new Request( + $this->getClient()->getApiUrl() . Collection::getCollectionPath() . '/' . $this->getId() + ,'GET' + ); + + $response = $this->getClient()->send($request); + + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + + $data = json_decode($response->getBody()->getContents(), true); + $this->jsonUnserialize($data); + + return $this; + } + + + public function jsonSerialize() + { + return $this->data; + } + + public function jsonUnserialize(array $json) + { + $this->data = $json; + } + + public function members() + { + $response = $this->getClient()->get($this->getClient()->getApiUrl() . Collection::getCollectionPath() . '/' . $this->getId() .'/members'); + + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + + $data = json_decode($response->getBody()->getContents(), true); + $memberCollection = new UserCollection(); + return $memberCollection->hydrateAll($data); + } + + public function addMember(User $user) + { + return $this->sendPostAction($user, 'join'); + } + + public function inviteMember(User $user) + { + return $this->sendPostAction($user, 'invite'); + } + + public function removeMember(User $user) + { + $response = $this->getClient()->delete( + $this->getClient()->getApiUrl() . Collection::getCollectionPath() . '/' . $this->getId() .'/members/'. $user->getId() + ); + + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + } + + public function sendPostAction(User $user, $action, $channel = 'app') { + $body = $user->getRequestDataForConversation(); + $body['action'] = $action; + $body['channel'] = ['type' => $channel]; + + $response = $this->getClient()->post( + $this->getClient()->getApiUrl() . Collection::getCollectionPath() . '/' . $this->getId() .'/members', + $body + ); + + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + + $body = json_decode($response->getBody()->getContents(), true); + + $user = new User($body['user_id']); + $user->jsonUnserialize($body); + $user->setClient($this->getClient()); + + return $user; + } + + protected function getException(ResponseInterface $response) + { + $body = json_decode($response->getBody()->getContents(), true); + $status = $response->getStatusCode(); + + // This message isn't very useful, but we shouldn't ever see it + $errorTitle = 'Unexpected error'; + + if (isset($body['description'])) { + $errorTitle = $body['description']; + } + + if (isset($body['error_title'])) { + $errorTitle = $body['error_title']; + } + + if($status >= 400 AND $status < 500) { + $e = new Exception\Request($errorTitle, $status); + } elseif($status >= 500 AND $status < 600) { + $e = new Exception\Server($errorTitle, $status); + } else { + $e = new Exception\Exception('Unexpected HTTP Status Code'); + throw $e; + } + + return $e; + } + + +} diff --git a/vendor/nexmo/client/src/Conversion/Client.php b/vendor/nexmo/client/src/Conversion/Client.php new file mode 100644 index 0000000..691401f --- /dev/null +++ b/vendor/nexmo/client/src/Conversion/Client.php @@ -0,0 +1,63 @@ +sendConversion('sms', $message_id, $delivered, $timestamp); + } + + public function voice($message_id, $delivered, $timestamp=null) + { + return $this->sendConversion('voice', $message_id, $delivered, $timestamp); + } + + protected function sendConversion($type, $message_id, $delivered, $timestamp=null) + { + $params = [ + 'message-id' => $message_id, + 'delivered' => $delivered + ]; + + if ($timestamp) { + $params['timestamp'] = $timestamp; + } + + $response = $this->client->postUrlEncoded( + $this->getClient()->getApiUrl() . '/conversions/'.$type.'?'.http_build_query($params), + [] + ); + + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + } + + protected function getException(ResponseInterface $response) + { + $body = json_decode($response->getBody()->getContents(), true); + $status = $response->getStatusCode(); + + if($status === 402) { + $e = new Exception\Request("This endpoint may need activating on your account. Please email support@nexmo.com for more information", $status); + } elseif($status >= 400 AND $status < 500) { + $e = new Exception\Request($body['error_title'], $status); + } elseif($status >= 500 AND $status < 600) { + $e = new Exception\Server($body['error_title'], $status); + } else { + $e = new Exception\Exception('Unexpected HTTP Status Code'); + } + + return $e; + } + +} diff --git a/vendor/nexmo/client/src/Entity/ArrayAccessTrait.php b/vendor/nexmo/client/src/Entity/ArrayAccessTrait.php new file mode 100644 index 0000000..d8025da --- /dev/null +++ b/vendor/nexmo/client/src/Entity/ArrayAccessTrait.php @@ -0,0 +1,16 @@ +collection = $collection; + } + + public function getCollection() + { + if(!isset($this->collection)){ + throw new \RuntimeException('missing collection'); + } + + return $this->collection; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Entity/CollectionInterface.php b/vendor/nexmo/client/src/Entity/CollectionInterface.php new file mode 100644 index 0000000..111b71d --- /dev/null +++ b/vendor/nexmo/client/src/Entity/CollectionInterface.php @@ -0,0 +1,30 @@ +hydrateEntity($this->page['_embedded'][$this->getCollectionName()][$this->current], $this->key()); + } + + /** + * No checks here, just advance the index. + */ + public function next() + { + $this->current++; + } + + /** + * Return the ID of the resource, in some cases this is `id`, in others `uuid`. + * @return string + */ + public function key() + { + if(isset($this->page['_embedded'][$this->getCollectionName()][$this->current]['id'])){ + return $this->page['_embedded'][$this->getCollectionName()][$this->current]['id']; + } elseif(isset($this->page['_embedded'][$this->getCollectionName()][$this->current]['uuid'])) { + return $this->page['_embedded'][$this->getCollectionName()][$this->current]['uuid']; + } + + return $this->current; + } + + /** + * Handle pagination automatically (unless configured not to). + * @return bool + */ + public function valid() + { + //can't be valid if there's not a page (rewind sets this) + if(!isset($this->page)){ + return false; + } + + //all hal collections have an `_embedded` object, we expect there to be a property matching the collection name + if(!isset($this->page['_embedded']) OR !isset($this->page['_embedded'][$this->getCollectionName()])){ + return false; + } + + //if we have a page with no items, we've gone beyond the end of the collection + if(!count($this->page['_embedded'][$this->getCollectionName()])){ + return false; + } + + //index the start of a page at 0 + if(is_null($this->current)){ + $this->current = 0; + } + + //if our current index is past the current page, fetch the next page if possible and reset the index + if(!isset($this->page['_embedded'][$this->getCollectionName()][$this->current])){ + if(isset($this->page['_links']) AND isset($this->page['_links']['next'])){ + $this->fetchPage($this->page['_links']['next']['href']); + $this->current = 0; + + return true; + } + + return false; + } + + return true; + } + + /** + * Fetch the initial page + */ + public function rewind() + { + $this->fetchPage($this->getCollectionPath()); + } + + /** + * Count of total items + * @return integer + */ + public function count() + { + if(isset($this->page)){ + return (int) $this->page['count']; + } + } + + public function setPage($index) + { + $this->index = (int) $index; + return $this; + } + + public function getPage() + { + if(isset($this->page)){ + return $this->page['page_index']; + } + + if(isset($this->index)){ + return $this->index; + } + + throw new \RuntimeException('page not set'); + } + + public function getSize() + { + if(isset($this->page)){ + return $this->page['page_size']; + } + + if(isset($this->size)){ + return $this->size; + } + + throw new \RuntimeException('size not set'); + } + + public function setSize($size) + { + $this->size = (int) $size; + return $this; + } + + /** + * Filters reduce to query params and include paging settings. + * + * @param FilterInterface $filter + * @return $this + */ + public function setFilter(FilterInterface $filter) + { + $this->filter = $filter; + return $this; + } + + public function getFilter() + { + if(!isset($this->filter)){ + $this->setFilter(new EmptyFilter()); + } + + return $this->filter; + } + + /** + * Fetch a page using the current filter if no query is provided. + * + * @param $absoluteUri + */ + protected function fetchPage($absoluteUri) + { + //use filter if no query provided + if(false === strpos($absoluteUri, '?')){ + $query = []; + + if(isset($this->size)){ + $query['page_size'] = $this->size; + } + + if(isset($this->index)){ + $query['page_index'] = $this->index; + } + + if(isset($this->filter)){ + $query = array_merge($this->filter->getQuery(), $query); + } + + $absoluteUri .= '?' . http_build_query($query); + } + + // + $request = new Request( + $this->getClient()->getApiUrl() . $absoluteUri, + 'GET' + ); + + $response = $this->client->send($request); + + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + + $this->response = $response; + $this->page = json_decode($this->response->getBody()->getContents(), true); + } +} diff --git a/vendor/nexmo/client/src/Entity/EmptyFilter.php b/vendor/nexmo/client/src/Entity/EmptyFilter.php new file mode 100644 index 0000000..f66b891 --- /dev/null +++ b/vendor/nexmo/client/src/Entity/EmptyFilter.php @@ -0,0 +1,18 @@ +entity = $entity; + } + + public function getEntity() + { + return $this->entity; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Entity/JsonResponseTrait.php b/vendor/nexmo/client/src/Entity/JsonResponseTrait.php new file mode 100644 index 0000000..eca56f1 --- /dev/null +++ b/vendor/nexmo/client/src/Entity/JsonResponseTrait.php @@ -0,0 +1,39 @@ +getResponse()) && ($response instanceof ResponseInterface)){ + if($response->getBody()->isSeekable()){ + $response->getBody()->rewind(); + } + + $body = $response->getBody()->getContents(); + $this->responseJson = json_decode($body, true); + return $this->responseJson; + } + + return []; + } +} diff --git a/vendor/nexmo/client/src/Entity/JsonSerializableInterface.php b/vendor/nexmo/client/src/Entity/JsonSerializableInterface.php new file mode 100644 index 0000000..6914cdd --- /dev/null +++ b/vendor/nexmo/client/src/Entity/JsonSerializableInterface.php @@ -0,0 +1,14 @@ +getRequest())){ + //TODO, figure out what the request data actually was + } + + return $this->jsonSerialize(); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Entity/JsonUnserializableInterface.php b/vendor/nexmo/client/src/Entity/JsonUnserializableInterface.php new file mode 100644 index 0000000..aa64c02 --- /dev/null +++ b/vendor/nexmo/client/src/Entity/JsonUnserializableInterface.php @@ -0,0 +1,22 @@ +response = $response; + + $status = $response->getStatusCode(); + + if($this instanceof JsonUnserializableInterface AND ((200 == $status) OR (201 == $status))){ + $this->jsonUnserialize($this->getResponseData()); + } + } + + public function setRequest(\Psr\Http\Message\RequestInterface $request) + { + $this->request = $request; + } + + public function getRequest() + { + return $this->request; + } + + public function getResponse() + { + return $this->response; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Entity/RequestArrayTrait.php b/vendor/nexmo/client/src/Entity/RequestArrayTrait.php new file mode 100644 index 0000000..8d36c40 --- /dev/null +++ b/vendor/nexmo/client/src/Entity/RequestArrayTrait.php @@ -0,0 +1,74 @@ +getRequest())){ + $query = []; + parse_str($request->getUri()->getQuery(), $query); + return $query; + } + + // Trigger a pre-getRequestData() hook for any last minute + // decision making that needs to be done, but only if + // it hasn't been sent already + if (method_exists($this, 'preGetRequestDataHook')) { + $this->preGetRequestDataHook(); + } + + return $this->requestData; + } + + protected function setRequestData($name, $value) + { + if(!($this instanceof EntityInterface)){ + throw new \Exception(sprintf( + '%s can only be used if the class implements %s', + __TRAIT__, + EntityInterface::class + )); + } + + if($this->getResponse()){ + throw new \RuntimeException(sprintf( + 'can not set request parameter `%s` for `%s` after API request has be made', + $name, + get_class($this) + )); + } + + $this->requestData[$name] = $value; + return $this; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Insights/Advanced.php b/vendor/nexmo/client/src/Insights/Advanced.php new file mode 100644 index 0000000..83e1144 --- /dev/null +++ b/vendor/nexmo/client/src/Insights/Advanced.php @@ -0,0 +1,15 @@ +data['national_format_number'] = $number; + } + + /** + * @return string + */ + public function getRequestId() + { + return $this['request_id']; + } + + /** + * @return string + */ + public function getNationalFormatNumber() + { + return $this['national_format_number']; + } + + /** + * @return string + */ + public function getInternationalFormatNumber() + { + return $this['international_format_number']; + } + + /** + * @return string + */ + public function getCountryCode() + { + return $this['country_code']; + } + + /** + * @return string + */ + public function getCountryCodeISO3() + { + return $this['country_code_iso3']; + } + + /** + * @return string + */ + public function getCountryName() + { + return $this['country_name']; + } + + /** + * @return integer + */ + public function getCountryPrefix() + { + return $this['country_prefix']; + } + + public function jsonSerialize() + { + return $this->data; + } + + public function jsonUnserialize(array $json) + { + $this->data = $json; + } + + public function offsetExists($offset) + { + return isset($this->data[$offset]); + } + + public function offsetGet($offset) + { + return $this->data[$offset]; + } + + public function offsetSet($offset, $value) + { + throw new Exception('Number insights results are read only'); + } + + public function offsetUnset($offset) + { + throw new Exception('Number insights results are read only'); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Insights/Client.php b/vendor/nexmo/client/src/Insights/Client.php new file mode 100644 index 0000000..a352979 --- /dev/null +++ b/vendor/nexmo/client/src/Insights/Client.php @@ -0,0 +1,118 @@ +makeRequest('/ni/basic/json', $number); + + $basic = new Basic($insightsResults['national_format_number']); + $basic->jsonUnserialize($insightsResults); + return $basic; + } + + public function standardCNam($number) + { + $insightsResults = $this->makeRequest('/ni/standard/json', $number, ['cnam' => 'true']); + $standard = new StandardCnam($insightsResults['national_format_number']); + $standard->jsonUnserialize($insightsResults); + return $standard; + } + + public function advancedCnam($number) + { + $insightsResults = $this->makeRequest('/ni/advanced/json', $number, ['cnam' => 'true']); + $standard = new AdvancedCnam($insightsResults['national_format_number']); + $standard->jsonUnserialize($insightsResults); + return $standard; + } + + public function standard($number, $useCnam=false) + { + $insightsResults = $this->makeRequest('/ni/standard/json', $number); + $standard = new Standard($insightsResults['national_format_number']); + $standard->jsonUnserialize($insightsResults); + return $standard; + } + + public function advanced($number) + { + $insightsResults = $this->makeRequest('/ni/advanced/json', $number); + $advanced = new Advanced($insightsResults['national_format_number']); + $advanced->jsonUnserialize($insightsResults); + return $advanced; + } + + public function advancedAsync($number, $webhook) + { + // This method does not have a return value as it's async. If there is no exception thrown + // We can assume that everything is fine + $this->makeRequest('/ni/advanced/async/json', $number, ['callback' => $webhook]); + } + + public function makeRequest($path, $number, $additionalParams = []) + { + if ($number instanceof Number) + { + $number = $number->getMsisdn(); + } + + $queryString = http_build_query([ + 'number' => $number, + ] + $additionalParams); + + $request = new Request( + $this->getClient()->getApiUrl(). $path.'?'.$queryString, + 'GET', + 'php://temp', + [ + 'Accept' => 'application/json' + ] + ); + + $response = $this->client->send($request); + + $insightsResults = json_decode($response->getBody()->getContents(), true); + + if('200' != $response->getStatusCode()){ + throw $this->getException($response); + } + + return $insightsResults; + } + + protected function getException(ResponseInterface $response) + { + $body = json_decode($response->getBody()->getContents(), true); + $status = $response->getStatusCode(); + + if($status >= 400 AND $status < 500) { + $e = new Exception\Request($body['error-code-label'], $status); + } elseif($status >= 500 AND $status < 600) { + $e = new Exception\Server($body['error-code-label'], $status); + } else { + $e = new Exception\Exception('Unexpected HTTP Status Code'); + throw $e; + } + + return $e; + } +} diff --git a/vendor/nexmo/client/src/Insights/CnamTrait.php b/vendor/nexmo/client/src/Insights/CnamTrait.php new file mode 100644 index 0000000..5bd136a --- /dev/null +++ b/vendor/nexmo/client/src/Insights/CnamTrait.php @@ -0,0 +1,25 @@ +enableEncodingDetection(); + $this->requestData['text'] = (string) $text; + } +} diff --git a/vendor/nexmo/client/src/Message/Binary.php b/vendor/nexmo/client/src/Message/Binary.php new file mode 100644 index 0000000..ab5ab19 --- /dev/null +++ b/vendor/nexmo/client/src/Message/Binary.php @@ -0,0 +1,55 @@ +body = (string) $body; + $this->udh = (string) $udh; + } + + /** + * Get an array of params to use in an API request. + */ + public function getRequestData($sent = true) + { + return array_merge(parent::getRequestData($sent), array( + 'body' => $this->body, + 'udh' => $this->udh, + )); + } +} diff --git a/vendor/nexmo/client/src/Message/Callback/Receipt.php b/vendor/nexmo/client/src/Message/Callback/Receipt.php new file mode 100644 index 0000000..b884cc1 --- /dev/null +++ b/vendor/nexmo/client/src/Message/Callback/Receipt.php @@ -0,0 +1,139 @@ + null), $data); + + parent::__construct($data); + } + + /** + * @return int + */ + public function getErrorCode() + { + return (int) $this->data['err-code']; + } + + /** + * @return string + */ + public function getNetwork() + { + return (string) $this->data['network-code']; + } + + /** + * @return string + */ + public function getId() + { + return (string) $this->data['messageId']; + } + + /** + * @return string + */ + public function getReceiptFrom() + { + return (string) $this->data['msisdn']; + } + + /** + * @return string + */ + public function getTo() + { + return $this->getReceiptFrom(); + } + + /** + * @return string + */ + public function getReceiptTo() + { + return (string) $this->data['to']; + } + + /** + * @return string + */ + public function getFrom() + { + return $this->getReceiptTo(); + } + + /** + * @return string + */ + public function getStatus() + { + return (string) $this->data['status']; + } + + /** + * @return string + */ + public function getPrice() + { + return (string) $this->data['price']; + } + + /** + * @return \DateTime + */ + public function getTimestamp() + { + $date = \DateTime::createFromFormat('ymdHi', $this->data['scts']); + if($date){ + return $date; + } + + throw new \UnexpectedValueException('could not parse message timestamp'); + } + + /** + * @return \DateTime + */ + public function getSent() + { + $date = \DateTime::createFromFormat('Y-m-d H:i:s', $this->data['message-timestamp']); + if($date){ + return $date; + } + + throw new \UnexpectedValueException('could not parse message timestamp'); + } + + /** + * @return string|null + */ + public function getClientRef() + { + return $this->data['client-ref']; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Message/Client.php b/vendor/nexmo/client/src/Message/Client.php new file mode 100644 index 0000000..7a137ce --- /dev/null +++ b/vendor/nexmo/client/src/Message/Client.php @@ -0,0 +1,324 @@ +createMessageFromArray($message); + } + + $params = $message->getRequestData(false); + + $request = new Request( + $this->getClient()->getRestUrl() . '/sms/json' + ,'POST', + 'php://temp', + ['content-type' => 'application/json'] + ); + + $request->getBody()->write(json_encode($params)); + $message->setRequest($request); + $response = $this->client->send($request); + $message->setResponse($response); + + //check for valid data, as well as an error response from the API + $data = $message->getResponseData(); + if(!isset($data['messages'])){ + throw new Exception\Exception('unexpected response from API'); + } + + //normalize errors (client vrs server) + foreach($data['messages'] as $part){ + switch($part['status']){ + case '0': + break; //all okay + case '1': + if(preg_match('#\[\s+(\d+)\s+\]#', $part['error-text'], $match)){ + usleep($match[1] + 1); + } else { + sleep(1); + } + + return $this->send($message); + case '5': + $e = new Exception\Server($part['error-text'], $part['status']); + $e->setEntity($message); + throw $e; + default: + $e = new Exception\Request($part['error-text'], $part['status']); + $e->setEntity($message); + throw $e; + } + } + + return $message; + } + + /** + * @param $query + * @return MessageInterface[] + * @throws Exception\Exception + * @throws Exception\Request + */ + public function get($query) + { + if($query instanceof Query){ + $params = $query->getParams(); + } else if($query instanceof MessageInterface){ + $params = ['ids' => [$query->getMessageId()]]; + } else if(is_string($query)) { + $params = ['ids' => [$query]]; + } else if(is_array($query)){ + $params = ['ids' => $query]; + } else { + throw new \InvalidArgumentException('query must be an instance of Query, MessageInterface, string ID, or array of IDs.'); + } + + $request = new Request( + $this->getClient()->getRestUrl() . '/search/messages?' . http_build_query($params), + 'GET', + 'php://temp', + ['Accept' => 'application/json'] + ); + + $response = $this->client->send($request); + $response->getBody()->rewind(); + $data = json_decode($response->getBody()->getContents(), true); + + if($response->getStatusCode() != '200' && isset($data['error-code'])){ + throw new Exception\Request($data['error-code-label'], $data['error-code']); + } elseif($response->getStatusCode() != '200'){ + throw new Exception\Request('error status from API', $response->getStatusCode()); + } + + if(!isset($data['items'])){ + throw new Exception\Exception('unexpected response from API'); + } + + if(count($data['items']) == 0){ + return []; + } + + $collection = []; + + foreach($data['items'] as $index => $item){ + switch($item['type']){ + case 'MT': + $new = new Message($item['message-id']); + break; + case 'MO': + $new = new InboundMessage($item['message-id']); + break; + default: + throw new Exception\Exception('unexpected response from API'); + } + + $new->setResponse($response); + $new->setIndex($index); + $collection[] = $new; + + } + + return $collection; + } + + /** + * @param string|MessageInterface $idOrMessage + */ + public function search($idOrMessage) + { + if($idOrMessage instanceof MessageInterface){ + $id = $idOrMessage->getMessageId(); + $message = $idOrMessage; + } else { + $id = $idOrMessage; + } + + $request = new Request( + $this->getClient()->getRestUrl() . '/search/message?' . http_build_query(['id' => $id]), + 'GET', + 'php://temp', + ['Accept' => 'application/json'] + ); + + $response = $this->client->send($request); + + $response->getBody()->rewind(); + + $data = json_decode($response->getBody()->getContents(), true); + + if($response->getStatusCode() != '200' && isset($data['error-code'])){ + throw new Exception\Request($data['error-code-label'], $data['error-code']); + } elseif($response->getStatusCode() == '429'){ + throw new Exception\Request('too many concurrent requests', $response->getStatusCode()); + } elseif($response->getStatusCode() != '200'){ + throw new Exception\Request('error status from API', $response->getStatusCode()); + } + + if(!$data){ + throw new Exception\Request('no message found for `' . $id . '`'); + } + + switch($data['type']){ + case 'MT': + $new = new Message($data['message-id']); + break; + case 'MO': + $new = new InboundMessage($data['message-id']); + break; + default: + throw new Exception\Exception('unexpected response from API'); + } + + if(isset($message) && !($message instanceof $new)){ + throw new Exception\Exception(sprintf( + 'searched for message with type `%s` but message of type `%s`', + get_class($message), + get_class($new) + )); + } + + if(!isset($message)){ + $message = $new; + } + + $message->setResponse($response); + return $message; + } + + public function searchRejections(Query $query) { + + $params = $query->getParams(); + $request = new Request( + $this->getClient()->getRestUrl() . '/search/rejections?' . http_build_query($params), + 'GET', + 'php://temp', + ['Accept' => 'application/json'] + ); + + $response = $this->client->send($request); + $response->getBody()->rewind(); + $data = json_decode($response->getBody()->getContents(), true); + + if($response->getStatusCode() != '200' && isset($data['error-code'])){ + throw new Exception\Request($data['error-code-label'], $data['error-code']); + } elseif($response->getStatusCode() != '200'){ + throw new Exception\Request('error status from API', $response->getStatusCode()); + } + + if(!isset($data['items'])){ + throw new Exception\Exception('unexpected response from API'); + } + + if(count($data['items']) == 0){ + return []; + } + + $collection = []; + + foreach($data['items'] as $index => $item){ + switch($item['type']){ + case 'MT': + $new = new Message($item['message-id']); + break; + case 'MO': + $new = new InboundMessage($item['message-id']); + break; + default: + throw new Exception\Exception('unexpected response from API'); + } + + $new->setResponse($response); + $new->setIndex($index); + $collection[] = $new; + } + + return $collection; + } + + /** + * @param array $message + * @return Message + */ + protected function createMessageFromArray($message) + { + if(!is_array($message)){ + throw new \RuntimeException('message must implement `' . MessageInterface::class . '` or be an array`'); + } + + foreach(['to', 'from'] as $param){ + if(!isset($message[$param])){ + throw new \InvalidArgumentException('missing expected key `' . $param . '`'); + } + } + + $to = $message['to']; + $from = $message['from']; + + unset($message['to']); + unset($message['from']); + + return new Message($to, $from, $message); + } + + /** + * Convenience feature allowing messages to be sent without creating a message object first. + * + * @param $name + * @param $arguments + * @return MessageInterface + */ + public function __call($name, $arguments) + { + if(!(strstr($name, 'send') !== 0)){ + throw new \RuntimeException(sprintf( + '`%s` is not a valid method on `%s`', + $name, + get_class($this) + )); + } + + $class = substr($name, 4); + $class = 'Nexmo\\Message\\' . ucfirst(strtolower($class)); + + if(!class_exists($class)){ + throw new \RuntimeException(sprintf( + '`%s` is not a valid method on `%s`', + $name, + get_class($this) + )); + } + + $reflection = new \ReflectionClass($class); + $message = $reflection->newInstanceArgs($arguments); + + return $this->send($message); + } +} diff --git a/vendor/nexmo/client/src/Message/CollectionTrait.php b/vendor/nexmo/client/src/Message/CollectionTrait.php new file mode 100644 index 0000000..c3a35ba --- /dev/null +++ b/vendor/nexmo/client/src/Message/CollectionTrait.php @@ -0,0 +1,12 @@ +index = (int) $index; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Message/EncodingDetector.php b/vendor/nexmo/client/src/Message/EncodingDetector.php new file mode 100644 index 0000000..4ee6b09 --- /dev/null +++ b/vendor/nexmo/client/src/Message/EncodingDetector.php @@ -0,0 +1,53 @@ +convertIntoUnicode(), + [ // See: https://en.wikipedia.org/wiki/GSM_03.38#GSM_7-bit_default_alphabet_and_extension_table_of_3GPP_TS_23.038_/_GSM_03.38 + '@', '£', '$', 'Â¥', 'è', 'é', 'ù', 'ì', 'ò', 'ç', "\r", 'Ø', 'ø', "\n", 'Ã…', 'Ã¥', + 'Δ', '_', 'Φ', 'Γ', 'Λ', 'Ω', 'Π', 'Ψ', 'Σ', 'Θ', 'Ξ', 'Æ', 'æ', 'ß', 'É', + ' ', '!', '"', '#', '¤', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', + '¡', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ä', 'Ö', 'Ñ', 'Ãœ', '§', + '¿', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'ä', 'ö', 'ñ', 'ü', 'à', + "\f", '^', '{', '}', '\\', '[', '~', ']', '|', '€', + ] + ); + + // Split $text into an array in a way that respects multibyte characters. + $textChars = preg_split('//u', $content, null, PREG_SPLIT_NO_EMPTY); + + // Array of codepoint values for characters in $text. + $textCodePoints = array_map($this->convertIntoUnicode(), $textChars); + + // Filter the array to contain only codepoints from $text that are not in the set of valid GSM codepoints. + $nonGsmCodePoints = array_diff($textCodePoints, $gsmCodePoints); + + // The text contains unicode if the result is not empty. + return !empty($nonGsmCodePoints); + } + + private function convertIntoUnicode() + { + return function ($char) { + $k = mb_convert_encoding($char, 'UTF-16LE', 'UTF-8'); + $k1 = ord(substr($k, 0, 1)); + $k2 = ord(substr($k, 1, 1)); + + return $k2 * 256 + $k1; + }; + } +} diff --git a/vendor/nexmo/client/src/Message/InboundMessage.php b/vendor/nexmo/client/src/Message/InboundMessage.php new file mode 100644 index 0000000..eae5529 --- /dev/null +++ b/vendor/nexmo/client/src/Message/InboundMessage.php @@ -0,0 +1,237 @@ +setRequest($idOrRequest); + return; + } + + if(is_string($idOrRequest)){ + $this->id = $idOrRequest; + return; + } + + throw new \RuntimeException(sprintf( + '`%s` must be constructed with a server request or a message id', + self::class + )); + } + + public static function createFromGlobals() + { + $serverRequest = \Zend\Diactoros\ServerRequestFactory::fromGlobals(); + return new self($serverRequest); + } + + /** + * Create a matching reply to the inbound message. Currently only supports text replies. + * + * @param string $body + * @return Text + */ + public function createReply($body) + { + return new Text($this->getFrom(), $this->getTo(), $body); + } + + public function getRequestData($sent = true) + { + $request = $this->getRequest(); + + if(is_null($request)){ + return []; + } + + if(!($request instanceof ServerRequestInterface)){ + throw new \RuntimeException('inbound message request should only ever be `' . ServerRequestInterface::class . '`'); + } + + // Check our incoming content type + $isApplicationJson = false; + $contentTypes = $request->getHeader('Content-Type'); + // We only respect application/json if it's the first entry without any preference weighting + // as that's what Nexmo send + if (count($contentTypes) && $contentTypes[0] === 'application/json') { + $isApplicationJson = true; + } + + switch($request->getMethod()){ + case 'POST': + $params = $isApplicationJson ? json_decode((string)$request->getBody(), true) : $request->getParsedBody(); + break; + case 'GET': + $params = $request->getQueryParams(); + break; + default: + $params = []; + break; + } + + return $params; + } + + public function getFrom() + { + if($this->getRequest()){ + return $this['msisdn']; + } else { + return $this['from']; + } + } + + public function getTo() + { + return $this['to']; + } + + public function getMessageId() + { + if(isset($this->id)){ + return $this->id; + } + + return $this['messageId']; + } + + public function isValid() + { + return (bool) $this->getMessageId(); + } + + public function getBody() + { + if($this->getRequest()){ + return $this['text']; + } else { + return $this['body']; + } + } + + public function getType() + { + return $this['type']; + } + + public function getAccountId() + { + return $this['account-id']; + } + + public function getNetwork() + { + return $this['network']; + } + + /** + * Allow the object to access the data from the API response, a sent API request, or the user set data that the + * request will be created from - in that order. + * + * @param mixed $offset + * @return bool + * @throws \Exception + */ + public function offsetExists($offset) + { + $response = $this->getResponseData(); + + if(isset($this->index)){ + $response = $response['items'][$this->index]; + } + + $request = $this->getRequestData(); + $dirty = $this->getRequestData(false); + return isset($response[$offset]) || isset($request[$offset]) || isset($dirty[$offset]); + } + + /** + * Allow the object to access the data from the API response, a sent API request, or the user set data that the + * request will be created from - in that order. + * + * @param mixed $offset + * @return mixed + * @throws \Exception + */ + public function offsetGet($offset) + { + $response = $this->getResponseData(); + + if(isset($this->index)){ + $response = $response['items'][$this->index]; + } + + $request = $this->getRequestData(); + $dirty = $this->getRequestData(false); + + if(isset($response[$offset])){ + return $response[$offset]; + } + + if(isset($request[$offset])){ + return $request[$offset]; + } + + if(isset($dirty[$offset])){ + return $dirty[$offset]; + } + } + + /** + * All properties are read only. + * + * @param mixed $offset + * @param mixed $value + */ + public function offsetSet($offset, $value) + { + throw $this->getReadOnlyException($offset); + } + + /** + * All properties are read only. + * + * @param mixed $offset + */ + public function offsetUnset($offset) + { + throw $this->getReadOnlyException($offset); + } + + /** + * All properties are read only. + * + * @param $offset + * @return \RuntimeException + */ + protected function getReadOnlyException($offset) + { + return new \RuntimeException(sprintf( + 'can not modify `%s` using array access', + $offset + )); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Message/Message.php b/vendor/nexmo/client/src/Message/Message.php new file mode 100644 index 0000000..fac8f61 --- /dev/null +++ b/vendor/nexmo/client/src/Message/Message.php @@ -0,0 +1,375 @@ +id = $idOrTo; + return; + } + + $this->requestData['to'] = (string) $idOrTo; + $this->requestData['from'] = (string) $from; + if(static::TYPE){ + $this->requestData['type'] = static::TYPE; + } + + $this->requestData = array_merge($this->requestData, $additional); + } + + public function requestDLR($dlr = true) + { + return $this->setRequestData('status-report-req', $dlr ? 1 : 0); + } + + public function setCallback($callback) { + return $this->setRequestData('callback', (string) $callback); + } + + public function setClientRef($ref) + { + return $this->setRequestData('client-ref', (string) $ref); + } + + public function setNetwork($network) + { + return $this->setRequestData('network-code', (string) $network); + } + + public function setTTL($ttl) + { + return $this->setRequestData('ttl', (int) $ttl); + } + + public function setClass($class) + { + return $this->setRequestData('message-class', $class); + } + + public function enableEncodingDetection() + { + $this->autodetectEncoding = true; + } + + public function disableEncodingDetection() + { + $this->autodetectEncoding = false; + } + + public function count() + { + $data = $this->getResponseData(); + if(!isset($data['messages'])){ + return 0; + } + + return count($data['messages']); + } + + public function getMessageId($index = null) + { + if(isset($this->id)){ + return $this->id; + } + + return $this->getMessageData('message-id', $index); + } + + public function getStatus($index = null) + { + return $this->getMessageData('status', $index); + } + + public function getFinalStatus($index = null) + { + return $this->getMessageData('final-status', $index); + } + + public function getTo($index = null) + { + $data = $this->getResponseData(); + + //check if this is data from a send request + //(which also has a status, but it's not the same) + if(isset($data['messages'])){ + return $this->getMessageData('to', $index); + } + + return $this['to']; + } + + public function getRemainingBalance($index = null) + { + return $this->getMessageData('remaining-balance', $index); + } + + public function getPrice($index = null) + { + $data = $this->getResponseData(); + + //check if this is data from a send request + //(which also has a status, but it's not the same) + if(isset($data['messages'])){ + return $this->getMessageData('message-price', $index); + } + + return $this['price']; + } + + public function getNetwork($index = null) + { + return $this->getMessageData('network', $index); + } + + public function getDeliveryStatus() + { + $data = $this->getResponseData(); + + //check if this is data from a send request + //(which also has a status, but it's not the same) + if(isset($data['messages'])){ + return; + } + + return $this['status']; + } + + public function getFrom() + { + return $this['from']; + } + + public function getBody() + { + return $this['body']; + } + + public function getDateReceived() + { + return new \DateTime($this['date-received']); + } + + public function getDeliveryError() + { + return $this['error-code']; + } + + public function getDeliveryLabel() + { + return $this['error-code-label']; + } + + public function isEncodingDetectionEnabled() + { + return $this->autodetectEncoding; + } + + protected function getMessageData($name, $index = null) + { + if(!isset($this->response)){ + return null; + } + + $data = $this->getResponseData(); + if(is_null($index)){ + $index = $this->count() -1; + } + + if (isset($data['messages'])) { + return $data['messages'][$index][$name]; + } + + return isset($data[$name]) ? $data[$name] : null; + } + + protected function preGetRequestDataHook() + { + // If $autodetectEncoding is true, we want to set the `type` + // field in our payload + if ($this->isEncodingDetectionEnabled()) { + $this->requestData['type'] = $this->detectEncoding(); + } + } + + protected function detectEncoding() + { + if (!isset($this->requestData['text'])) { + return static::TYPE; + } + + // Auto detect unicode messages + $detector = new EncodingDetector; + if ($detector->requiresUnicodeEncoding($this->requestData['text'])){ + return Unicode::TYPE; + } + + return static::TYPE; + } + + public function offsetExists($offset) + { + $response = $this->getResponseData(); + + if(isset($this->index)){ + $response = $response['items'][$this->index]; + } + + $request = $this->getRequestData(); + $dirty = $this->getRequestData(false); + if(isset($response[$offset]) || isset($request[$offset]) || isset($dirty[$offset])){ + return true; + } + + //provide access to split messages by virtual index + if(is_int($offset) && $offset < $this->count()){ + return true; + } + + return false; + } + + public function offsetGet($offset) + { + $response = $this->getResponseData(); + + if(isset($this->index)){ + $response = $response['items'][$this->index]; + } + + $request = $this->getRequestData(); + $dirty = $this->getRequestData(false); + + if(isset($response[$offset])){ + return $response[$offset]; + } + + //provide access to split messages by virtual index, if there is data + if(isset($response['messages'])){ + if(is_int($offset) && isset($response['messages'][$offset])){ + return $response['messages'][$offset]; + } + + $index = $this->count() -1; + + if(isset($response['messages'][$index]) && isset($response['messages'][$index][$offset])){ + return $response['messages'][$index][$offset]; + } + + } + + if(isset($request[$offset])){ + return $request[$offset]; + } + + if(isset($dirty[$offset])){ + return $dirty[$offset]; + } + } + + public function offsetSet($offset, $value) + { + throw $this->getReadOnlyException($offset); + } + + public function offsetUnset($offset) + { + throw $this->getReadOnlyException($offset); + } + + protected function getReadOnlyException($offset) + { + return new \RuntimeException(sprintf( + 'can not modify `%s` using array access', + $offset + )); + } + + public function current() + { + if(!isset($this->response)){ + return null; + } + + $data = $this->getResponseData(); + return $data['messages'][$this->current]; + } + + public function next() + { + $this->current++; + } + + public function key() + { + if(!isset($this->response)){ + return null; + } + + return $this->current; + } + + public function valid() + { + if(!isset($this->response)){ + return null; + } + + $data = $this->getResponseData(); + return isset($data['messages'][$this->current]); + } + + public function rewind() + { + $this->current = 0; + } + + + +} diff --git a/vendor/nexmo/client/src/Message/MessageInterface.php b/vendor/nexmo/client/src/Message/MessageInterface.php new file mode 100644 index 0000000..f458e05 --- /dev/null +++ b/vendor/nexmo/client/src/Message/MessageInterface.php @@ -0,0 +1,14 @@ +params['date'] = $date->format('Y-m-d'); + $this->params['to'] = $to; + } + + public function getParams() + { + return $this->params; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Message/Response/Collection.php b/vendor/nexmo/client/src/Message/Response/Collection.php new file mode 100644 index 0000000..831c5dc --- /dev/null +++ b/vendor/nexmo/client/src/Message/Response/Collection.php @@ -0,0 +1,125 @@ +expected = array('message-count', 'messages'); + $return = parent::__construct($data); + + $this->count = $data['message-count']; + + if(count($data['messages']) != $data['message-count']){ + throw new \RuntimeException('invalid message count'); + } + + foreach($data['messages'] as $message){ + if(0 != $message['status']){ + $this->messages[] = new Error($message); + } else { + $this->messages[] = new Message($message); + } + } + + $this->data = $data; + + return $return; + } + + public function getMessages() + { + return $this->messages; + } + + public function isSuccess() + { + foreach($this->messages as $message){ + if($message instanceof Error){ + return false; + } + } + + return true; + } + + public function count() + { + return $this->count; + } + + /** + * @link http://php.net/manual/en/iterator.current.php + * @return Message + */ + public function current() + { + return $this->messages[$this->position]; + } + + /** + * @link http://php.net/manual/en/iterator.next.php + * @return void + */ + public function next() + { + $this->position++; + } + + /** + * @link http://php.net/manual/en/iterator.key.php + * @return int + */ + public function key() + { + return $this->position; + } + + /** + * @link http://php.net/manual/en/iterator.valid.php + * @return boolean + */ + public function valid() + { + return $this->position < $this->count; + } + + /** + * @link http://php.net/manual/en/iterator.rewind.php + * @return void + */ + public function rewind() + { + $this->position = 0; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Message/Response/Message.php b/vendor/nexmo/client/src/Message/Response/Message.php new file mode 100644 index 0000000..7069dd4 --- /dev/null +++ b/vendor/nexmo/client/src/Message/Response/Message.php @@ -0,0 +1,121 @@ +expected = array( + 'status', + 'message-id', + 'to', + 'message-price', + 'network' + ); + + //default value + $data = array_merge(array('client-ref' => null, 'remaining-balance' => null), $data); + + $return = parent::__construct($data); + + //validate receipt + if(!$receipt){ + return $return; + } + + if($receipt->getId() != $this->getId()){ + throw new \UnexpectedValueException('receipt id must match message id'); + } + + $this->receipt = $receipt; + + return $receipt; + } + + /** + * @return int + */ + public function getStatus() + { + return (int) $this->data['status']; + } + + /** + * @return string + */ + public function getId() + { + return (string) $this->data['message-id']; + } + + /** + * @return string + */ + public function getTo() + { + return (string) $this->data['to']; + } + + /** + * @return string + */ + public function getBalance() + { + return (string) $this->data['remaining-balance']; + } + + /** + * @return string + */ + public function getPrice() + { + return (string) $this->data['message-price']; + } + + /** + * @return string + */ + public function getNetwork() + { + return (string) $this->data['network']; + } + + /** + * @return string + */ + public function getClientRef() + { + return (string) $this->data['client-ref']; + } + + /** + * @return Receipt|null + */ + public function getReceipt() + { + return $this->receipt; + } + + /** + * @return bool + */ + public function hasReceipt() + { + return $this->receipt instanceof Receipt; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Message/Text.php b/vendor/nexmo/client/src/Message/Text.php new file mode 100644 index 0000000..fc58a26 --- /dev/null +++ b/vendor/nexmo/client/src/Message/Text.php @@ -0,0 +1,37 @@ +requestData['text'] = (string) $text; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Message/Unicode.php b/vendor/nexmo/client/src/Message/Unicode.php new file mode 100644 index 0000000..23e1e87 --- /dev/null +++ b/vendor/nexmo/client/src/Message/Unicode.php @@ -0,0 +1,46 @@ +text = (string) $text; + } + + /** + * Get an array of params to use in an API request. + */ + public function getRequestData($sent = true) + { + return array_merge(parent::getRequestData($sent), array( + 'text' => $this->text + )); + } +} diff --git a/vendor/nexmo/client/src/Message/Vcal.php b/vendor/nexmo/client/src/Message/Vcal.php new file mode 100644 index 0000000..ac55bf1 --- /dev/null +++ b/vendor/nexmo/client/src/Message/Vcal.php @@ -0,0 +1,46 @@ +text = (string) $vcal; + } + + /** + * Get an array of params to use in an API request. + */ + public function getRequestData($sent = true) + { + return array_merge(parent::getRequestData($sent), array( + 'vcal' => $this->vcal + )); + } +} diff --git a/vendor/nexmo/client/src/Message/Vcard.php b/vendor/nexmo/client/src/Message/Vcard.php new file mode 100644 index 0000000..b6fdafd --- /dev/null +++ b/vendor/nexmo/client/src/Message/Vcard.php @@ -0,0 +1,46 @@ +vcard = (string) $vcard; + } + + /** + * Get an array of params to use in an API request. + */ + public function getRequestData($sent = true) + { + return array_merge(parent::getRequestData($sent), array( + 'vcard' => $this->vcard + )); + } +} diff --git a/vendor/nexmo/client/src/Message/Wap.php b/vendor/nexmo/client/src/Message/Wap.php new file mode 100644 index 0000000..1c908b2 --- /dev/null +++ b/vendor/nexmo/client/src/Message/Wap.php @@ -0,0 +1,64 @@ +title = (string) $title; + $this->url = (string) $url; + $this->validity = (int) $validity; + } + + /** + * Get an array of params to use in an API request. + */ + public function getRequestData($sent = true) + { + return array_merge(parent::getRequestData($sent), array( + 'title' => $this->title, + 'url' => $this->url, + 'validity' => $this->validity, + )); + } +} diff --git a/vendor/nexmo/client/src/Network.php b/vendor/nexmo/client/src/Network.php new file mode 100644 index 0000000..37aaf51 --- /dev/null +++ b/vendor/nexmo/client/src/Network.php @@ -0,0 +1,97 @@ +data['network_code'] = $networkCode; + $this->data['network_name'] = $networkName; + } + + public function getCode() + { + return $this['network_code']; + } + + public function getName() + { + return $this['network_name']; + } + + public function getOutboundSmsPrice() + { + if (isset($this['sms_price'])) { + return $this['sms_price']; + } + return $this['price']; + } + + public function getOutboundVoicePrice() + { + if (isset($this['voice_price'])) { + return $this['voice_price']; + } + return $this['price']; + } + + public function getPrefixPrice() { + return $this['mt_price']; + } + + public function getCurrency() + { + return $this['currency']; + } + + public function jsonUnserialize(array $json) + { + // Convert CamelCase to snake_case as that's how we use array access in every other object + $data = []; + foreach ($json as $k => $v){ + $k = ltrim(strtolower(preg_replace('/[A-Z]([A-Z](?![a-z]))*/', '_$0', $k)), '_'); + $data[$k] = $v; + } + $this->data = $data; + } + + function jsonSerialize() + { + return $this->data; + } + + public function offsetExists($offset) + { + return isset($this->data[$offset]); + } + + public function offsetGet($offset) + { + return $this->data[$offset]; + } + + public function offsetSet($offset, $value) + { + throw new Exception('Network is read only'); + } + + public function offsetUnset($offset) + { + throw new Exception('Network is read only'); + } +} diff --git a/vendor/nexmo/client/src/Network/Number/Callback.php b/vendor/nexmo/client/src/Network/Number/Callback.php new file mode 100644 index 0000000..b54fc55 --- /dev/null +++ b/vendor/nexmo/client/src/Network/Number/Callback.php @@ -0,0 +1,94 @@ + 'number_type', + 'Network' => 'carrier_network_code', + 'NetworkName' => 'carrier_network_name', + 'Valid' => 'valid', + 'Ported' => 'ported', + 'Reachable' => 'reachable', + 'Roaming' => 'roaming', + 'RoamingCountry' => 'roaming_country_code', + 'RoamingNetwork' => 'roaming_network_code', + ); + + public function getId() + { + return $this->data['request_id']; + } + + public function getCallbackTotal() + { + return $this->data['callback_total_parts']; + } + + public function getCallbackIndex() + { + return $this->data['callback_part']; + } + + public function getNumber() + { + return $this->data['number']; + } + + public function __call($name, $args) + { + $type = substr($name, 0, 3); + $property = substr($name, 3); + + if(!isset($this->optional[$property])){ + throw new \BadMethodCallException('property does not exist: ' . $property); + } + + $property = $this->optional[$property]; + + switch($type){ + case 'get': + if(isset($this->data[$property])){ + return $this->data[$property]; + } else { + return null; + } + break; + case 'has': + return isset($this->data[$property]); + break; + } + + throw new \BadMethodCallException('method does not exist: ' . $name); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Network/Number/Request.php b/vendor/nexmo/client/src/Network/Number/Request.php new file mode 100644 index 0000000..dacfe7d --- /dev/null +++ b/vendor/nexmo/client/src/Network/Number/Request.php @@ -0,0 +1,61 @@ +params['number'] = $number; + $this->params['callback'] = $callback; + $this->params['callback_timeout'] = $timeout; + $this->params['callback_method'] = $method; + $this->params['client_ref'] = $ref; + + if(!empty($features)){ + $this->params['features'] = implode(',', $features); + } + } + + public function getURI() + { + return '/ni/json'; + } + + /** + * @param ResponseInterface $response + * @return ResponseInterface + */ + public function wrapResponse(ResponseInterface $response) + { + if($response->isError()){ + return new Error($response->getData()); + } + + return new Response($response->getData()); + } + + +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Network/Number/Response.php b/vendor/nexmo/client/src/Network/Number/Response.php new file mode 100644 index 0000000..3595556 --- /dev/null +++ b/vendor/nexmo/client/src/Network/Number/Response.php @@ -0,0 +1,100 @@ +expected = array_merge($this->expected, array( + 'request_id', 'number', 'request_price', 'remaining_balance', 'callback_total_parts' + )); + + parent::__construct($data); + + foreach($callbacks as $callback){ + if(!($callback instanceof Callback)){ + throw new \InvalidArgumentException('callback must be of type: Nexmo\Network\Number\Callback'); + } + + if($callback->getId() !== $this->getId()){ + throw new \InvalidArgumentException('callback id must match request id'); + } + } + + $this->callbacks = $callbacks; + } + + public function getCallbackTotal() + { + return $this->data['callback_total_parts']; + } + + public function isComplete() + { + return count($this->callbacks) == $this->getCallbackTotal(); + } + + public function getPrice() + { + return $this->data['request_price']; + } + + public function getBalance() + { + return $this->data['remaining_balance']; + } + + public function getNumber() + { + return $this->data['number']; + } + + public function getId() + { + return $this->data['request_id']; + } + + public function getStatus() + { + return $this->data['status']; + } + + public function __call($name, $args) + { + if(empty($this->callbacks)){ + throw new \BadMethodCallException('can not check for response data without callback data'); + } + + foreach($this->callbacks as $callback){ + if($last = $callback->$name()){ + return $last; + } + } + return $last; + } + + public function getCallbacks() + { + return $this->callbacks; + } + + public static function addCallback(Response $response, Callback $callback) + { + $callbacks = $response->getCallbacks(); + $callbacks[] = $callback; + + return new static($response->getData(), $callbacks); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Numbers/Client.php b/vendor/nexmo/client/src/Numbers/Client.php new file mode 100644 index 0000000..98cc9dc --- /dev/null +++ b/vendor/nexmo/client/src/Numbers/Client.php @@ -0,0 +1,290 @@ +get($id); + } + + if($number instanceof Number){ + $body = $number->getRequestData(); + if(!isset($update) AND !isset($body['country'])){ + $data = $this->get($number->getId()); + $body['msisdn'] = $data->getId(); + $body['country'] = $data->getCountry(); + } + } else { + $body = $number; + } + + if(isset($update)){ + $body['msisdn'] = $update->getId(); + $body['country'] = $update->getCountry(); + } + + $request = new Request( + $this->client->getRestUrl() . '/number/update', + 'POST', + 'php://temp', + [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/x-www-form-urlencoded' + ] + ); + + $request->getBody()->write(http_build_query($body)); + $response = $this->client->send($request); + + if('200' != $response->getStatusCode()){ + throw $this->getException($response); + } + + if(isset($update) AND ($number instanceof Number)){ + return $this->get($number); + } + + if($number instanceof Number){ + return $this->get($number); + } + + return $this->get($body['msisdn']); + } + + public function get($number = null) + { + $items = $this->search($number); + + // This is legacy behaviour, so we need to keep it even though + // it isn't technically the correct message + if (count($items) != 1) { + throw new Exception\Request('number not found', 404); + } + + return $items[0]; + } + + /** + * @param null|string $number + * @return array []Number + * @deprecated Use `searchOwned` instead + */ + public function search($number = null) + { + return $this->searchOwned($number); + } + + public function searchAvailable($country, $options = []) + { + $query = [ + 'country' => $country + ]; + + // These are all optional parameters + $possibleParameters = [ + 'pattern', + 'search_pattern', + 'features', + 'size', + 'type', + 'index' + ]; + + foreach ($possibleParameters as $param) { + if (isset($options[$param])) { + $query[$param] = $options[$param]; + } + } + + $request = new Request( + $this->client->getRestUrl() . '/number/search?' . http_build_query($query), + 'GET', + 'php://temp' + ); + + $response = $this->client->send($request); + + return $this->handleNumberSearchResult($response, null); + } + + public function searchOwned($number = null, $options = []) + { + $query = []; + if ($number !== null) { + if($number instanceof Number){ + $query = ['pattern' => $number->getId()]; + } else { + $query = ['pattern' => $number]; + } + + } + + // These are all optional parameters + $possibleParameters = [ + 'search_pattern', + 'size', + 'index' + ]; + + foreach ($options as $param => $value) { + if (!in_array($param, $possibleParameters)) { + throw new Exception\Request("Unknown option: '".$param."'"); + } + $query[$param] = $value; + } + + $queryString = http_build_query($query); + + $request = new Request( + $this->client->getRestUrl() . '/account/numbers?' . $queryString, + 'GET', + 'php://temp' + ); + + $response = $this->client->send($request); + return $this->handleNumberSearchResult($response, $number); + } + + private function handleNumberSearchResult($response, $number) + { + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + + $searchResults = json_decode($response->getBody()->getContents(), true); + if(empty($searchResults)){ + throw new Exception\Request('number not found', 404); + } + + if(!isset($searchResults['count']) OR !isset($searchResults['numbers'])){ + throw new Exception\Exception('unexpected response format'); + } + + // We're going to return a list of numbers + $numbers = []; + + // If they provided a number initially, we'll only get one response + // so let's reuse the object + if($number instanceof Number){ + $number->jsonUnserialize($searchResults['numbers'][0]); + $numbers[] = $number; + } else { + // Otherwise, we return everything that matches + foreach ($searchResults['numbers'] as $returnedNumber) { + $number = new Number(); + $number->jsonUnserialize($returnedNumber); + $numbers[] = $number; + } + } + + return $numbers; + } + + public function purchase($number, $country = null) { + // We cheat here and fetch a number using the API so that we have the country code which is required + // to make a cancel request + if (!$number instanceof Number) { + if (!$country) { + throw new Exception\Exception("You must supply a country in addition to a number to purchase a number"); + } + $number = new Number($number, $country); + } + + $body = [ + 'msisdn' => $number->getMsisdn(), + 'country' => $number->getCountry() + ]; + + $request = new Request( + $this->client->getRestUrl() . '/number/buy', + 'POST', + 'php://temp', + [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/x-www-form-urlencoded' + ] + ); + + $request->getBody()->write(http_build_query($body)); + $response = $this->client->send($request); + + // Sadly we can't distinguish *why* purchasing fails, just that it + // has failed. Here are a few of the tests I attempted and their associated + // error codes + body + // + // Mismatch number/country :: 420 :: method failed + // Already own number :: 420 :: method failed + // Someone else owns the number :: 420 :: method failed + if('200' != $response->getStatusCode()){ + throw $this->getException($response); + } + } + + public function cancel($number) { + // We cheat here and fetch a number using the API so that we have the country code which is required + // to make a cancel request + if (!$number instanceof Number) { + $number = $this->get($number); + } + + $body = [ + 'msisdn' => $number->getMsisdn(), + 'country' => $number->getCountry() + ]; + + $request = new Request( + $this->client->getRestUrl() . '/number/cancel', + 'POST', + 'php://temp', + [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/x-www-form-urlencoded' + ] + ); + + $request->getBody()->write(http_build_query($body)); + $response = $this->client->send($request); + + // Sadly we can't distinguish *why* purchasing fails, just that it + // has failed. + if('200' != $response->getStatusCode()){ + throw $this->getException($response); + } + } + + protected function getException(ResponseInterface $response) + { + $body = json_decode($response->getBody()->getContents(), true); + $status = $response->getStatusCode(); + + if($status >= 400 AND $status < 500) { + $e = new Exception\Request($body['error-code-label'], $status); + } elseif($status >= 500 AND $status < 600) { + $e = new Exception\Server($body['error-code-label'], $status); + } else { + $e = new Exception\Exception('Unexpected HTTP Status Code'); + throw $e; + } + + return $e; + } + +} diff --git a/vendor/nexmo/client/src/Numbers/Number.php b/vendor/nexmo/client/src/Numbers/Number.php new file mode 100644 index 0000000..c408d66 --- /dev/null +++ b/vendor/nexmo/client/src/Numbers/Number.php @@ -0,0 +1,191 @@ +data['msisdn'] = $number; + $this->data['country'] = $country; + } + + public function getId() + { + return $this->fromData('msisdn'); + } + + public function getMsisdn() + { + return $this->getId(); + } + + public function getNumber() + { + return $this->getId(); + } + + public function getCountry() + { + return $this->fromData('country'); + } + + public function getType() + { + return $this->fromData('type'); + } + + public function getCost() + { + return $this->fromData('cost'); + } + + public function hasFeature($feature) + { + if(!isset($this->data['features'])){ + return false; + } + + return in_array($feature, $this->data['features']); + } + + public function getFeatures() + { + return $this->fromData('features'); + } + + public function setWebhook($type, $url) + { + if(!in_array($type, [self::WEBHOOK_MESSAGE, self::WEBHOOK_VOICE_STATUS])){ + throw new \InvalidArgumentException("invalid webhook type `$type`"); + } + + $this->data[$type] = $url; + return $this; + } + + public function getWebhook($type) + { + return $this->fromData($type); + } + + public function hasWebhook($type) + { + return isset($this->data[$type]); + } + + public function setVoiceDestination($endpoint, $type = null) + { + if(is_null($type)){ + $type = $this->autoType($endpoint); + } + + if(self::ENDPOINT_APP == $type AND !($endpoint instanceof Application)){ + $endpoint = new Application($endpoint); + } + + $this->data['voiceCallbackValue'] = $endpoint; + $this->data['voiceCallbackType'] = $type; + + return $this; + } + + protected function autoType($endpoint) + { + if($endpoint instanceof Application){ + return self::ENDPOINT_APP; + } + + if(false !== strpos($endpoint, '@')){ + return self::ENDPOINT_SIP; + } + + if(0 === strpos(strtolower($endpoint), 'http')){ + return self::ENDPOINT_VXML; + } + + if(preg_match('#[a-z]+#', $endpoint)){ + return self::ENDPOINT_APP; + } + + return self::ENDPOINT_TEL; + } + + public function getVoiceDestination() + { + return $this->fromData('voiceCallbackValue'); + } + + public function getVoiceType() + { + if(!isset($this->data['voiceCallbackType'])){ + return null; + } + + return $this->data['voiceCallbackType']; + } + + protected function fromData($name) + { + if(!isset($this->data[$name])){ + throw new \RuntimeException("`{$name}` has not been set"); + } + + return $this->data[$name]; + } + + public function jsonUnserialize(array $json) + { + $this->data = $json; + } + + function jsonSerialize() + { + $json = $this->data; + if(isset($json['voiceCallbackValue']) AND ($json['voiceCallbackValue'] instanceof Application)){ + $json['voiceCallbackValue'] = $json['voiceCallbackValue']->getId(); + } + + return $json; + } + + public function __toString() + { + return (string) $this->getId(); + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Redact/Client.php b/vendor/nexmo/client/src/Redact/Client.php new file mode 100644 index 0000000..9e30029 --- /dev/null +++ b/vendor/nexmo/client/src/Redact/Client.php @@ -0,0 +1,78 @@ +getClient()->getApiUrl() . '/v1/redact/transaction', + 'POST', + 'php://temp', + [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json' + ] + ); + + $body = ['id' => $id, 'product' => $product] + $options; + + $request->getBody()->write(json_encode($body)); + $response = $this->client->send($request); + + $rawBody = $response->getBody()->getContents(); + + if('204' != $response->getStatusCode()){ + throw $this->getException($response); + } + + return null; + } + + protected function getException(ResponseInterface $response) + { + $response->getBody()->rewind(); + $body = json_decode($response->getBody()->getContents(), true); + $status = $response->getStatusCode(); + + $msg = 'Unexpected error'; + + // This is an error at the load balancer, likely auth related + if (isset($body['error_title'])) { + $msg = $body['error_title']; + } + + if (isset($body['title'])) { + $msg = $body['title']; + if (isset($body['detail'])) { + $msg .= ' - '.$body['detail']; + } + + $msg .= '. See '.$body['type']; + } + + if($status >= 400 AND $status < 500) { + $e = new Exception\Request($msg, $status); + } elseif($status >= 500 AND $status < 600) { + $e = new Exception\Server($msg, $status); + } else { + $e = new Exception\Exception('Unexpected HTTP Status Code'); + throw $e; + } + + return $e; + } + + +} diff --git a/vendor/nexmo/client/src/Response.php b/vendor/nexmo/client/src/Response.php new file mode 100644 index 0000000..ff5acee --- /dev/null +++ b/vendor/nexmo/client/src/Response.php @@ -0,0 +1,121 @@ +data = json_decode($data, true); + } + + public function getMessages() + { + if(!isset($this->data['messages'])){ + return array(); + } + + return $this->data['messages']; + } + + /** + * (PHP 5 >= 5.1.0)
+ * Count elements of an object + * @link http://php.net/manual/en/countable.count.php + * @return int The custom count as an integer. + *

+ *

+ * The return value is cast to an integer. + */ + public function count() + { + return $this->data['message-count']; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Return the current element + * @link http://php.net/manual/en/iterator.current.php + * @return \Nexmo\Response\Message + */ + public function current() + { + if(!isset($this->messages[$this->position])){ + $this->messages[$this->position] = new Message($this->data['messages'][$this->position]); + } + + return $this->messages[$this->position]; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Move forward to next element + * @link http://php.net/manual/en/iterator.next.php + * @return void Any returned value is ignored. + */ + public function next() + { + $this->position++; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Return the key of the current element + * @link http://php.net/manual/en/iterator.key.php + * @return int + */ + public function key() + { + return $this->position; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Checks if current position is valid + * @link http://php.net/manual/en/iterator.valid.php + * @return boolean The return value will be casted to boolean and then evaluated. + * Returns true on success or false on failure. + */ + public function valid() + { + return isset($this->data['messages'][$this->position]); + } + + /** + * (PHP 5 >= 5.0.0)
+ * Rewind the Iterator to the first element + * @link http://php.net/manual/en/iterator.rewind.php + * @return void Any returned value is ignored. + */ + public function rewind() + { + $this->position = 0; + } + + public function toArray() + { + return $this->data; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Response/Message.php b/vendor/nexmo/client/src/Response/Message.php new file mode 100644 index 0000000..f3088a2 --- /dev/null +++ b/vendor/nexmo/client/src/Response/Message.php @@ -0,0 +1,72 @@ +data = $data; + } + + public function getStatus() + { + return $this->checkData('status'); + } + + public function getId() + { + return $this->checkData('message-id'); + } + + public function getTo() + { + return $this->checkData('to'); + } + + public function getBalance() + { + return $this->checkData('remaining-balance'); + } + + public function getPrice() + { + return $this->checkData('message-price'); + } + + public function getNetwork() + { + return $this->checkData('network'); + } + + public function getErrorMessage() + { + if(!isset($this->data['error-text'])){ + return ''; + } + + return $this->checkData('error-text'); + } + + protected function checkData($param) + { + if(!isset($this->data[$param])){ + throw new \RuntimeException('tried to access ' . $param . ' but data is missing'); + } + + return $this->data[$param]; + } + + public function toArray() + { + return $this->data; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/User/Collection.php b/vendor/nexmo/client/src/User/Collection.php new file mode 100644 index 0000000..00dba8d --- /dev/null +++ b/vendor/nexmo/client/src/User/Collection.php @@ -0,0 +1,194 @@ +setClient($this->getClient()); + $idOrUser->jsonUnserialize($data); + + return $idOrUser; + } + + public function hydrateAll($users) + { + $hydrated = []; + foreach ($users as $u) { + $key = isset($u['user_id']) ? 'user_id' : 'id'; + $user = new User($u[$key]); + + // Setting the client makes us run out of memory and I'm not sure why yet + // $idOrUser->setClient($this->getClient()); + + $user->jsonUnserialize($u); + $hydrated[] = $user; + } + + return $hydrated; + } + + /** + * @param null $user + * @return $this|User + */ + public function __invoke(Filter $filter = null) + { + if(!is_null($filter)){ + $this->setFilter($filter); + } + + return $this; + } + + public function fetch() { + $this->fetchPage(self::getCollectionPath()); + return $this->hydrateAll($this->page); + } + + public function create($user) + { + return $this->post($user); + } + + public function post($user) + { + if($user instanceof User){ + $body = $user->getRequestData(); + } else { + $body = $user; + } + + $request = new Request( + $this->getClient()->getApiUrl() . $this->getCollectionPath() + ,'POST', + 'php://temp', + ['content-type' => 'application/json'] + ); + + $request->getBody()->write(json_encode($body)); + $response = $this->client->send($request); + + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + + $body = json_decode($response->getBody()->getContents(), true); + $user = new User($body['id']); + $user->jsonUnserialize($body); + $user->setClient($this->getClient()); + + return $user; + } + + public function get($user) + { + if(!($user instanceof User)){ + $user = new User($user); + } + + $user->setClient($this->getClient()); + $user->get(); + + return $user; + } + + protected function getException(ResponseInterface $response) + { + $body = json_decode($response->getBody()->getContents(), true); + $status = $response->getStatusCode(); + + // This message isn't very useful, but we shouldn't ever see it + $errorTitle = 'Unexpected error'; + + if (isset($body['code'])) { + $errorTitle = $body['code']; + } + + if (isset($body['description']) && $body['description']) { + $errorTitle = $body['description']; + } + + if (isset($body['error_title'])) { + $errorTitle = $body['error_title']; + } + + if($status >= 400 AND $status < 500) { + $e = new Exception\Request($errorTitle, $status); + } elseif($status >= 500 AND $status < 600) { + $e = new Exception\Server($errorTitle, $status); + } else { + $e = new Exception\Exception('Unexpected HTTP Status Code'); + throw $e; + } + + return $e; + } + + public function offsetExists($offset) + { + return true; + } + + /** + * @param mixed $user + * @return User + */ + public function offsetGet($user) + { + if(!($user instanceof User)){ + $user = new User($user); + } + + $user->setClient($this->getClient()); + return $user; + } + + public function offsetSet($offset, $value) + { + throw new \RuntimeException('can not set collection properties'); + } + + public function offsetUnset($offset) + { + throw new \RuntimeException('can not unset collection properties'); + } +} diff --git a/vendor/nexmo/client/src/User/User.php b/vendor/nexmo/client/src/User/User.php new file mode 100644 index 0000000..928bd92 --- /dev/null +++ b/vendor/nexmo/client/src/User/User.php @@ -0,0 +1,138 @@ +data['id'] = $id; + } + + public function setName($name) + { + $this->data['name'] = $name; + return $this; + } + + public function getId() + { + return $this->data['id']; + } + + public function __toString() + { + return (string)$this->getId(); + } + + + public function get() + { + $request = new Request( + $this->getClient()->getApiUrl() . Collection::getCollectionPath() . '/' . $this->getId() + ,'GET' + ); + + $response = $this->getClient()->send($request); + + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + + $data = json_decode($response->getBody()->getContents(), true); + $this->jsonUnserialize($data); + + return $this; + } + + public function getConversations() { + $response = $this->getClient()->get( + $this->getClient()->getApiUrl() . Collection::getCollectionPath().'/'.$this->getId().'/conversations' + ); + + if($response->getStatusCode() != '200'){ + throw $this->getException($response); + } + + $data = json_decode($response->getBody()->getContents(), true); + $conversationCollection = $this->getClient()->conversation(); + + return $conversationCollection->hydrateAll($data); + } + + public function jsonSerialize() + { + return $this->data; + } + + public function jsonUnserialize(array $json) + { + $this->data = $json; + } + + public function getRequestDataForConversation() + { + return [ + 'user_id' => $this->getId() + ]; + } + + protected function getException(ResponseInterface $response) + { + $body = json_decode($response->getBody()->getContents(), true); + $status = $response->getStatusCode(); + + // This message isn't very useful, but we shouldn't ever see it + $errorTitle = 'Unexpected error'; + + if (isset($body['code'])) { + $errorTitle = $body['code']; + } + + if (isset($body['description']) && $body['description']) { + $errorTitle = $body['description']; + } + + if (isset($body['error_title'])) { + $errorTitle = $body['error_title']; + } + + if($status >= 400 AND $status < 500) { + $e = new Exception\Request($errorTitle, $status); + } elseif($status >= 500 AND $status < 600) { + $e = new Exception\Server($errorTitle, $status); + } else { + $e = new Exception\Exception('Unexpected HTTP Status Code'); + throw $e; + } + + return $e; + } + + +} diff --git a/vendor/nexmo/client/src/Verify/Check.php b/vendor/nexmo/client/src/Verify/Check.php new file mode 100644 index 0000000..1857b09 --- /dev/null +++ b/vendor/nexmo/client/src/Verify/Check.php @@ -0,0 +1,48 @@ +data = $data; + } + + public function getCode() + { + return $this->data['code']; + } + + public function getDate() + { + return new \DateTime($this->data['date_received']); + } + + public function getStatus() + { + return $this->data['status']; + } + + public function getIpAddress() + { + return $this->data['ip_address']; + } +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Verify/Client.php b/vendor/nexmo/client/src/Verify/Client.php new file mode 100644 index 0000000..5bf68eb --- /dev/null +++ b/vendor/nexmo/client/src/Verify/Client.php @@ -0,0 +1,231 @@ +createVerificationFromArray($verification); + } + + $params = $verification->getRequestData(false); + + $request = $this->getRequest($params); + $response = $this->client->send($request); + + $data = $this->processReqRes($verification, $request, $response, true); + return $this->checkError($verification, $data); + } + + public function search($verification) + { + if(!($verification instanceof Verification)){ + $verification = new Verification($verification); + } + + $params = [ + 'request_id' => $verification->getRequestId() + ]; + + $request = $this->getRequest($params, 'search'); + $response = $this->client->send($request); + + $data = $this->processReqRes($verification, $request, $response, true); + + if(!isset($data['status'])){ + throw new Exception\Exception('unexpected response from API'); + } + + //verify API returns text status on success + if(!is_numeric($data['status'])){ + return $verification; + } + + //normalize errors (client vrs server) + switch($data['status']){ + case '5': + $e = new Exception\Server($data['error_text'], $data['status']); + break; + default: + $e = new Exception\Request($data['error_text'], $data['status']); + break; + } + + $e->setEntity($verification); + throw $e; + } + + public function cancel($verification) + { + return $this->control($verification, 'cancel'); + } + + public function trigger($verification) + { + return $this->control($verification, 'trigger_next_event'); + } + + public function check($verification, $code, $ip = null) + { + if(!($verification instanceof Verification)){ + $verification = new Verification($verification); + } + + $params = [ + 'request_id' => $verification->getRequestId(), + 'code' => $code + ]; + + if(!is_null($ip)){ + $params['ip'] = $ip; + } + + $request = $this->getRequest($params, 'check'); + $response = $this->client->send($request); + + $data = $this->processReqRes($verification, $request, $response, false); + return $this->checkError($verification, $data); + } + + public function serialize(Verification $verification) + { + return serialize($verification); + } + + public function unserialize($verification) + { + if(is_string($verification)){ + $verification = unserialize($verification); + } + + if(!($verification instanceof Verification)){ + throw new \InvalidArgumentException('expected verification object or serialize verification object'); + } + + $verification->setClient($this); + return $verification; + } + + protected function control($verification, $cmd) + { + if(!($verification instanceof Verification)){ + $verification = new Verification($verification); + } + + $params = [ + 'request_id' => $verification->getRequestId(), + 'cmd' => $cmd + ]; + + $request = $this->getRequest($params, 'control'); + $response = $this->client->send($request); + + $data = $this->processReqRes($verification, $request, $response, false); + return $this->checkError($verification, $data); + } + + protected function checkError(Verification $verification, $data) + { + if(!isset($data['status'])){ + throw new Exception\Exception('unexpected response from API'); + } + + //normalize errors (client vrs server) + switch($data['status']){ + case '0': + return $verification; + case '5': + $e = new Exception\Server($data['error_text'], $data['status']); + break; + default: + $e = new Exception\Request($data['error_text'], $data['status']); + break; + } + + $e->setEntity($verification); + throw $e; + } + + protected function processReqRes(Verification $verification, RequestInterface $req, ResponseInterface $res, $replace = true) + { + $verification->setClient($this); + + if($replace || !$verification->getRequest()){ + $verification->setRequest($req); + } + + if($replace || !$verification->getResponse()) { + $verification->setResponse($res); + return $verification->getResponseData(); + } + + if($res->getBody()->isSeekable()){ + $res->getBody()->rewind(); + } + + return json_decode($res->getBody()->getContents(), true); + } + + protected function getRequest($params, $path = null) + { + if(!is_null($path)){ + $path = '/verify/' . $path . '/json'; + } else { + $path = '/verify/json'; + } + + $request = new Request( + $this->getClient()->getApiUrl() . $path, + 'POST', + 'php://temp', + [ + 'content-type' => 'application/json' + ] + ); + + $request->getBody()->write(json_encode($params)); + return $request; + } + + /** + * @param $array + * @return Verification + */ + protected function createVerificationFromArray($array) + { + if(!is_array($array)){ + throw new \RuntimeException('verification must implement `' . VerificationInterface::class . '` or be an array`'); + } + + foreach(['number', 'brand'] as $param){ + if(!isset($array[$param])){ + throw new \InvalidArgumentException('missing expected key `' . $param . '`'); + } + } + + $number = $array['number']; + $brand = $array['brand']; + + unset($array['number']); + unset($array['brand']); + + return new Verification($number, $brand, $array); + } +} diff --git a/vendor/nexmo/client/src/Verify/Verification.php b/vendor/nexmo/client/src/Verify/Verification.php new file mode 100644 index 0000000..9fee6ab --- /dev/null +++ b/vendor/nexmo/client/src/Verify/Verification.php @@ -0,0 +1,596 @@ +dirty = false; + $this->requestData['request_id'] = $idOrNumber; + } else { + $this->dirty = true; + $this->requestData['number'] = $idOrNumber; + $this->requestData['brand'] = $brand; + $this->requestData = array_merge($this->requestData, $additional); + } + } + + /** + * Allow Verification to have actions. + * + * @param Client $client Verify Client + * @return $this + */ + public function setClient(Client $client) + { + $this->client = $client; + return $this; + } + + /** + * @return Client + */ + protected function useClient() + { + if(isset($this->client)){ + return $this->client; + } + + throw new \RuntimeException('can not act on the verification directly unless a verify client has been set'); + } + + /** + * Check if the code is correct. Unlike the method it proxies, an invalid code does not throw an exception. + * + * @uses \Nexmo\Verify\Client::check() + * @param string $code Numeric code provided by the user. + * @param null|string $ip IP address to be used for the verification. + * @return bool Code is valid. + * @throws RequestException + */ + public function check($code, $ip = null) + { + try { + $this->useClient()->check($this, $code, $ip); + return true; + } catch(RequestException $e) { + if($e->getCode() == 16 || $e->getCode() == 17){ + return false; + } + + throw $e; + } + } + + /** + * Cancel the verification. + * + * @uses \Nexmo\Verify\Client::cancel() + */ + public function cancel() + { + $this->useClient()->cancel($this); + } + + /** + * Trigger the next verification. + * + * @uses \Nexmo\Verify\Client::trigger() + */ + public function trigger() + { + $this->useClient()->trigger($this); + } + + /** + * Update Verification from the API. + * + * @uses \Nexmo\Verify\Client::search() + */ + public function sync() + { + $this->useClient()->search($this); + } + + /** + * Check if the user provided data has sent to the API yet. + * + * @return bool + */ + public function isDirty() + { + return $this->dirty; + } + + /** + * If do not set number in international format or you are not sure if number is correctly formatted, set country + * with the two-character country code. For example, GB, US. Verify works out the international phone number for + * you. + * @link https://docs.nexmo.com/verify/api-reference/api-reference#vrequest + * + * Can only be set before the verification is created. + * @uses \Nexmo\Entity\RequestArrayTrait::setRequestData + * + * @param $country + * @return $this + * @throws \Exception + */ + public function setCountry($country) + { + return $this->setRequestData('country', $country); + } + + /** + * An 11 character alphanumeric string to specify the SenderID for SMS sent by Verify. Depending on the destination + * of the phone number you are applying, restrictions may apply. By default, sender_id is VERIFY. + * @link https://docs.nexmo.com/verify/api-reference/api-reference#vrequest + * + * Can only be set before the verification is created. + * @uses \Nexmo\Entity\RequestArrayTrait::setRequestData + * + * @param $id + * @return $this + * @throws \Exception + */ + public function setSenderId($id) + { + return $this->setRequestData('sender_id', $id); + } + + /** + * The length of the PIN. Possible values are 6 or 4 characters. The default value is 4. + * @link https://docs.nexmo.com/verify/api-reference/api-reference#vrequest + * + * Can only be set before the verification is created. + * @uses \Nexmo\Entity\RequestArrayTrait::setRequestData + * + * @param $length + * @return $this + * @throws \Exception + */ + public function setCodeLength($length) + { + return $this->setRequestData('code_length', $length); + } + + /** + * By default, TTS are generated in the locale that matches number. For example, the TTS for a 33* number is sent in + * French. Use this parameter to explicitly control the language, accent and gender used for the Verify request. The + * default language is en-us. + * @link https://docs.nexmo.com/verify/api-reference/api-reference#vrequest + * + * Can only be set before the verification is created. + * @uses \Nexmo\Entity\RequestArrayTrait::setRequestData + * + * @param $language + * @return $this + * @throws \Exception + */ + public function setLanguage($language) + { + return $this->setRequestData('lg', $language); + } + + /** + * Restrict verification to a certain network type. Possible values are: + * - All (Default) + * - Mobile + * - Landline + * + * Note: contact support@nexmo.com to enable this feature. + * @link https://docs.nexmo.com/verify/api-reference/api-reference#vrequest + * + * Can only be set before the verification is created. + * @uses \Nexmo\Entity\RequestArrayTrait::setRequestData + * + * @param $type + * @return $this + * @throws \Exception + */ + public function setRequireType($type) + { + return $this->setRequestData('require_type', $type); + } + + /** + * The PIN validity time from generation. This is an integer value between 30 and 3600 seconds. The default is 300 + * seconds. When specified together, pin_expiry must be an integer multiple of next_event_wait. Otherwise, + * pin_expiry is set to next_event_wait. + * @link https://docs.nexmo.com/verify/api-reference/api-reference#vrequest + * + * Can only be set before the verification is created. + * @uses \Nexmo\Entity\RequestArrayTrait::setRequestData + * + * @param $time + * @return $this + * @throws \Exception + */ + public function setPinExpiry($time) + { + return $this->setRequestData('pin_expiry', $time); + } + + /** + * An integer value between 60 and 900 seconds inclusive that specifies the wait time between attempts to deliver + * the PIN. Verify calculates the default value based on the average time taken by users to complete verification. + * @link https://docs.nexmo.com/verify/api-reference/api-reference#vrequest + * + * Can only be set before the verification is created. + * @uses \Nexmo\Entity\RequestArrayTrait::setRequestData + * + * @param $time + * @return $this + * @throws \Exception + */ + public function setWaitTime($time) + { + return $this->setRequestData('next_event_wait', $time); + } + + /** + * Get the verification request id, if available. + * + * @uses \Nexmo\Verify\Verification::proxyArrayAccess() + * + * @return string|null + */ + public function getRequestId() + { + return $this->proxyArrayAccess('request_id'); + } + + /** + * Get the number verified / to be verified. + * + * @see \Nexmo\Verify\Verification::__construct() + * @uses \Nexmo\Verify\Verification::proxyArrayAccess() + * + * @return string|null + */ + public function getNumber() + { + return $this->proxyArrayAccess('number'); + } + + /** + * Get the account id, if available. + * + * Only available after a searching for a verification. + * @see \Nexmo\Verify\Client::search(); + * + * However still @uses \Nexmo\Verify\Verification::proxyArrayAccess() + * + * @return string|null + */ + public function getAccountId() + { + return $this->proxyArrayAccess('account_id'); + } + + /** + * Get the sender id, if available. + * + * @see \Nexmo\Verify\Verification::setSenderId(); + * @see \Nexmo\Verify\Client::search(); + * + * @uses \Nexmo\Verify\Verification::proxyArrayAccess() + * + * @return string|null + */ + public function getSenderId() + { + return $this->proxyArrayAccess('sender_id'); + } + + /** + * Get the price of the verification, if available. + * + * Only available after a searching for a verification. + * @see \Nexmo\Verify\Client::search(); + * + * However still @uses \Nexmo\Verify\Verification::proxyArrayAccess() + * + * @return string|null + */ + public function getPrice() + { + return $this->proxyArrayAccess('price'); + } + + /** + * Get the currency used to price the verification, if available. + * + * Only available after a searching for a verification. + * @see \Nexmo\Verify\Client::search(); + * + * However still @uses \Nexmo\Verify\Verification::proxyArrayAccess() + * + * @return string|null + */ + public function getCurrency() + { + return $this->proxyArrayAccess('currency'); + } + + /** + * Get the status of the verification, if available. + * + * Only available after a searching for a verification. + * @see \Nexmo\Verify\Client::search(); + * + * However still @uses \Nexmo\Verify\Verification::proxyArrayAccess() + * + * @return string|null + */ + public function getStatus() + { + return $this->proxyArrayAccess('status'); + } + + /** + * Get an array of verification checks, if available. Will return an empty array if no check have been made, or if + * the data is not available. + * + * Only available after a searching for a verification. + * @see \Nexmo\Verify\Client::search(); + * + * However still @uses \Nexmo\Verify\Verification::proxyArrayAccess() + * + * @return \Nexmo\Verify\Check[]|\Nexmo\Verify\Check + */ + public function getChecks() + { + $checks = $this->proxyArrayAccess('checks'); + if(!$checks){ + return []; + } + + foreach($checks as $i => $check) { + $checks[$i] = new Check($check); + } + + return $checks; + } + + /** + * Get the date the verification started. + * + * Only available after a searching for a verification. + * @see \Nexmo\Verify\Client::search(); + * + * However still @uses \Nexmo\Verify\Verification::proxyArrayAccessDate() + * + * @return \DateTime|null + */ + public function getSubmitted() + { + return $this->proxyArrayAccessDate('date_submitted'); + } + + /** + * Get the date the verification stopped. + * + * Only available after a searching for a verification. + * @see \Nexmo\Verify\Client::search(); + * + * However still @uses \Nexmo\Verify\Verification::proxyArrayAccessDate() + * + * @return \DateTime|null + */ + public function getFinalized() + { + return $this->proxyArrayAccessDate('date_finalized'); + } + + /** + * Get the date of the first verification event. + * + * Only available after a searching for a verification. + * @see \Nexmo\Verify\Client::search(); + * + * However still @uses \Nexmo\Verify\Verification::proxyArrayAccessDate() + * + * @return \DateTime|null + */ + public function getFirstEvent() + { + return $this->proxyArrayAccessDate('first_event_date'); + } + + /** + * Get the date of the last verification event. + * + * Only available after a searching for a verification. + * @see \Nexmo\Verify\Client::search(); + * + * However still @uses \Nexmo\Verify\Verification::proxyArrayAccessDate() + * + * @return \DateTime|null + */ + public function getLastEvent() + { + return $this->proxyArrayAccessDate('last_event_date'); + } + + /** + * Proxies `proxyArrayAccess()` and returns a DateTime if the parameter is found. + * @uses \Nexmo\Verify\Verification::proxyArrayAccess() + * + * @param string $param Parameter to look for. + * @return \DateTime + */ + protected function proxyArrayAccessDate($param) + { + $date = $this->proxyArrayAccess($param); + if($date) { + return new \DateTime($date); + } + } + + /** + * Simply proxies array access to check for a parameter in the response, request, or user provided data. + * + * @uses \Nexmo\Verify\Verification::offsetGet(); + * @uses \Nexmo\Verify\Verification::offsetExists(); + * + * @param string $param Parameter to look for. + * @return mixed + */ + protected function proxyArrayAccess($param) + { + if(isset($this[$param])){ + return $this[$param]; + } + } + + /** + * Allow the object to access the data from the API response, a sent API request, or the user set data that the + * request will be created from - in that order. + * + * @param mixed $offset + * @return bool + * @throws \Exception + */ + public function offsetExists($offset) + { + $response = $this->getResponseData(); + $request = $this->getRequestData(); + $dirty = $this->requestData; + return isset($response[$offset]) || isset($request[$offset]) || isset($dirty[$offset]); + } + + /** + * Allow the object to access the data from the API response, a sent API request, or the user set data that the + * request will be created from - in that order. + * + * @param mixed $offset + * @return mixed + * @throws \Exception + */ + public function offsetGet($offset) + { + $response = $this->getResponseData(); + $request = $this->getRequestData(); + $dirty = $this->requestData; + + if(isset($response[$offset])){ + return $response[$offset]; + } + + if(isset($request[$offset])){ + return $request[$offset]; + } + + if(isset($dirty[$offset])){ + return $dirty[$offset]; + } + } + + /** + * All properties are read only. + * + * @param mixed $offset + * @param mixed $value + */ + public function offsetSet($offset, $value) + { + throw $this->getReadOnlyException($offset); + } + + /** + * All properties are read only. + * + * @param mixed $offset + */ + public function offsetUnset($offset) + { + throw $this->getReadOnlyException($offset); + } + + /** + * All properties are read only. + * + * @param $offset + * @return \RuntimeException + */ + protected function getReadOnlyException($offset) + { + return new \RuntimeException(sprintf( + 'can not modify `%s` using array access', + $offset + )); + } + + public function serialize() + { + $data = [ + 'requestData' => $this->requestData + ]; + + if($request = $this->getRequest()){ + $data['request'] = \Zend\Diactoros\Request\Serializer::toString($request); + } + + if($response = $this->getResponse()){ + $data['response'] = \Zend\Diactoros\Response\Serializer::toString($response); + } + + return serialize($data); + } + + public function unserialize($serialized) + { + $data = unserialize($serialized); + + $this->requestData = $data['requestData']; + + if(isset($data['request'])){ + $this->request = \Zend\Diactoros\Request\Serializer::fromString($data['request']); + } + + if(isset($data['response'])){ + $this->response = \Zend\Diactoros\Response\Serializer::fromString($data['response']); + } + } + + +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Verify/VerificationInterface.php b/vendor/nexmo/client/src/Verify/VerificationInterface.php new file mode 100644 index 0000000..cad2e8f --- /dev/null +++ b/vendor/nexmo/client/src/Verify/VerificationInterface.php @@ -0,0 +1,22 @@ +params['answer_url'] = $url; + $this->params['to'] = $to; + + if(!is_null($from)){ + $this->params['from'] = $from; + } + } + + public function setAnswer($url, $method = null) + { + $this->params['answer_url'] = $url; + if(!is_null($method)){ + $this->params['answer_method'] = $method; + } else { + unset($this->params['answer_method']); + } + + return $this; + } + + public function setError($url, $method = null) + { + $this->params['error_url'] = $url; + if(!is_null($method)){ + $this->params['error_method'] = $method; + } else { + unset($this->params['error_method']); + } + + return $this; + } + + public function setStatus($url, $method = null) + { + $this->params['status_url'] = $url; + if(!is_null($method)){ + $this->params['status_method'] = $method; + } else { + unset($this->params['status_method']); + } + + return $this; + } + + + public function setMachineDetection($hangup = true, $timeout = null) + { + $this->params['machine_detection'] = ($hangup ? 'hangup' : 'true'); + if(!is_null($timeout)){ + $this->params['machine_timeout'] = (int) $timeout; + } else { + unset($this->params['machine_timeout']); + } + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + return '/call/json'; + } + +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Voice/Call/Inbound.php b/vendor/nexmo/client/src/Voice/Call/Inbound.php new file mode 100644 index 0000000..2166d00 --- /dev/null +++ b/vendor/nexmo/client/src/Voice/Call/Inbound.php @@ -0,0 +1,15 @@ +data['call-id']; + } + + public function getTo() + { + return $this->data['to']; + } + + public function getStatus() + { + return $this->data['status']; + } + + public function getPrice() + { + return $this->data['call-price']; + } + + public function getRate() + { + return $this->data['call-rate']; + } + + public function getDuration() + { + return $this->data['call-duration']; + } + + public function getCreated() + { + return \DateTime::createFromFormat(self::TIME_FORMAT, $this->data['call-request']); + } + + public function getStart() + { + if(!isset($this->data['call-start'])){ + return null; + } + + return \DateTime::createFromFormat(self::TIME_FORMAT, $this->data['call-start']); + } + + public function getEnd() + { + if(!isset($this->data['call-end'])){ + return null; + } + + return \DateTime::createFromFormat(self::TIME_FORMAT, $this->data['call-end']); + } + + public function getNetwork() + { + return $this->data['network-code']; + } + +} \ No newline at end of file diff --git a/vendor/nexmo/client/src/Voice/Message/Message.php b/vendor/nexmo/client/src/Voice/Message/Message.php new file mode 100644 index 0000000..3986944 --- /dev/null +++ b/vendor/nexmo/client/src/Voice/Message/Message.php @@ -0,0 +1,73 @@ +params['text'] = $text; + $this->params['to'] = $to; + $this->params['from'] = $from; + } + + public function setLanguage($lang) + { + $this->params['lg'] = $lang; + return $this; + } + + public function setVoice($voice) + { + $this->params['voice'] = $voice; + return $this; + } + + public function setRepeat($count) + { + $this->params['repeat'] = (int) $count; + return $this; + } + public function setCallback($url, $method = null) + { + $this->params['callback'] = $url; + if(!is_null($method)){ + $this->params['callback_method'] = $method; + } else { + unset($this->params['callback_method']); + } + + return $this; + } + + public function setMachineDetection($hangup = true, $timeout = null) + { + $this->params['machine_detection'] = ($hangup ? 'hangup' : 'true'); + if(!is_null($timeout)){ + $this->params['machine_timeout'] = (int) $timeout; + } else { + unset($this->params['machine_timeout']); + } + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + return '/tts/json'; + } + +} \ No newline at end of file diff --git a/vendor/opis/closure/CHANGELOG.md b/vendor/opis/closure/CHANGELOG.md new file mode 100644 index 0000000..bc1e3d6 --- /dev/null +++ b/vendor/opis/closure/CHANGELOG.md @@ -0,0 +1,157 @@ +CHANGELOG +--------- + +### v3.1.2, 2018.12.16 + +* Fixed a bug regarding comma trail in group-use statements. See [issue 23](https://github.com/opis/closure/issues/23) + +### v3.1.1, 2018.10.02 + +* Fixed a bug where `parent` keyword was treated like a class-name and scope was not added to the +serialized closure +* Fixed a bug where return type was not properly handled for nested closures +* Support for anonymous classes was improved + +### v3.1.0, 2018.09.20 + +* Added `transformUseVariables` and `resolveUseVariables` to +`Opis\Closure\SerializableClosure` class. +* Added `removeSecurityProvider` static method to +`Opis\Closure\SerializableClosure` class. +* Fixed some security related issues where a user was able to unserialize an unsigned +closure, even when a security provider was in use. + +### v3.0.12, 2018.02.23 + +* Bugfix. See [issue 20](https://github.com/opis/closure/issues/20) + +### v3.0.11, 2018.01.22 + +* Bugfix. See [issue 18](https://github.com/opis/closure/issues/18) + +### v3.0.10, 2018.01.04 + +* Improved support for PHP 7.1 & 7.2 + +### v3.0.9, 2018.01.04 + +* Fixed a bug where the return type was not properly resolved. +See [issue 17](https://github.com/opis/closure/issues/17) +* Added more tests + +### v3.0.8, 2017.12.18 + +* Fixed a bug. See [issue 16](https://github.com/opis/closure/issues/16) + +### v3.0.7, 2017.10.31 + +* Bugfix: static properties are ignored now, since they are not serializable + +### v3.0.6, 2017.10.06 + +* Fixed a bug introduced by accident in 3.0.5 + +### v3.0.5, 2017.09.18 + +* Fixed a bug related to nested references + +### v3.0.4, 2017.09.18 + +* \[*internal*\] Refactored `SerializableClosure::mapPointers` method +* \[*internal*\] Added a new optional argument to `SerializableClosure::unwrapClosures` +* \[*internal*\] Removed `SerializableClosure::getClosurePointer` method +* Fixed various bugs + +### v3.0.3, 2017.09.06 + +* Fixed a bug related to nested object references +* \[*internal*\] `Opis\Closure\ClosureScope` now extends `SplObjectStorage` +* \[*internal*\] The `storage` property was removed from `Opis\Closure\ClosureScope` +* \[*internal*\] The `instances` and `objects` properties were removed from `Opis\Closure\ClosureContext` + +### v3.0.2, 2017.08.28 + +* Fixed a bug where `$this` object was not handled properly inside the +`SerializableClosre::serialize` method. + +### v3.0.1, 2017.04.13 + +* Fixed a bug in 'ignore_next' state + +### v3.0.0, 2017.04.07 + +* Dropped PHP 5.3 support +* Moved source files from `lib` to `src` folder +* Removed second parameter from `Opis\Closure\SerializableClosure::from` method and from constructor +* Removed `Opis\Closure\{SecurityProviderInterface, DefaultSecurityProvider, SecureClosure}` classes +* Refactored how signed closures were handled +* Added `wrapClosures` and `unwrapClosures` static methods to `Opis\Closure\SerializableClosure` class +* Added `Opis\Colosure\serialize` and `Opis\Closure\unserialize` functions +* Improved serialization. You can now serialize arbitrary objects and the library will automatically wrap all closures + +### v2.4.0, 2016.12.16 + +* The parser was refactored and improved +* Refactored `Opis\Closure\SerializableClosure::__invoke` method +* `Opis\Closure\{ISecurityProvider, SecurityProvider}` were added +* `Opis\Closure\{SecurityProviderInterface, DefaultSecurityProvider, SecureClosure}` were deprecated +and they will be removed in the next major version +* `setSecretKey` and `addSecurityProvider` static methods were added to `Opis\Closure\SerializableClosure` + +### v2.3.2, 2016.12.15 + +* Fixed a bug that prevented namespace resolution to be done properly + +### v2.3.1, 2016.12.13 + +* Hotfix. See [PR](https://github.com/opis/closure/pull/7) + +### v2.3.0, 2016.11.17 + +* Added `isBindingRequired` and `isScopeRequired` to the `Opis\Closure\ReflectionClosure` class +* Automatically detects when the scope and/or the bound object of a closure needs to be serialized. + +### v2.2.1, 2016.08.20 + +* Fixed a bug in `Opis\Closure\ReflectionClosure::fetchItems` + +### v2.2.0, 2016.07.26 + +* Fixed CS +* `Opis\Closure\ClosureContext`, `Opis\Closure\ClosureScope`, `Opis\Closure\SelfReference` + and `Opis\Closure\SecurityException` classes were moved into separate files +* Added support for PHP7 syntax +* Fixed some bugs in `Opis\Closure\ReflectionClosure` class +* Improved closure parser +* Added an analyzer for SuperClosure library + +### v2.1.0, 2015.09.30 + +* Added support for the missing `__METHOD__`, `__FUNCTION__` and `__TRAIT__` magic constants +* Added some security related classes and interfaces: `Opis\Closure\SecurityProviderInterface`, +`Opis\Closure\DefaultSecurityProvider`, `Opis\Closure\SecureClosure`, `Opis\Closure\SecurityException`. +* Fiexed a bug in `Opis\Closure\ReflectionClosure::getClasses` method +* Other minor bugfixes +* Added support for static closures +* Added public `isStatic` method to `Opis\Closure\ReflectionClosure` class + + +### v2.0.1, 2015.09.23 + +* Removed `branch-alias` property from `composer.json` +* Bugfix. See [issue #6](https://github.com/opis/closure/issues/6) + +### v2.0.0, 2015.07.31 + +* The closure parser was improved +* Class names are now automatically resolved +* Added support for the `#trackme` directive which allows tracking closure's residing source + +### v1.3.0, 2014.10.18 + +* Added autoload file +* Changed README file + +### Opis Closure 1.2.2 + +* Started changelog diff --git a/vendor/opis/closure/LICENSE b/vendor/opis/closure/LICENSE new file mode 100644 index 0000000..b2382f9 --- /dev/null +++ b/vendor/opis/closure/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017 The Opis Project + +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/opis/closure/NOTICE b/vendor/opis/closure/NOTICE new file mode 100644 index 0000000..7b83183 --- /dev/null +++ b/vendor/opis/closure/NOTICE @@ -0,0 +1,9 @@ +Opis Closure +Copyright 2018 Zindex Software + +This product includes software developed at +Zindex Software (http://zindex.software). + +This software was originally developed by Marius Sarca and Sorin Sarca +(Copyright 2014-2018). The copyright info was changed with the permission +of the original authors. \ No newline at end of file diff --git a/vendor/opis/closure/README.md b/vendor/opis/closure/README.md new file mode 100644 index 0000000..47d0434 --- /dev/null +++ b/vendor/opis/closure/README.md @@ -0,0 +1,98 @@ +Opis Closure +==================== +[![Build Status](https://travis-ci.org/opis/closure.png)](https://travis-ci.org/opis/closure) +[![Latest Stable Version](https://poser.pugx.org/opis/closure/v/stable.png)](https://packagist.org/packages/opis/closure) +[![Latest Unstable Version](https://poser.pugx.org/opis/closure/v/unstable.png)](https://packagist.org/packages/opis/closure) +[![License](https://poser.pugx.org/opis/closure/license.png)](https://packagist.org/packages/opis/closure) + +Serializable closures +--------------------- +**Opis Closure** is a library that aims to overcome PHP's limitations regarding closure +serialization by providing a wrapper that will make all closures serializable. + +**The library's key features:** + +- Serialize any closure +- Serialize arbitrary objects +- Doesn't use `eval` for closure serialization or unserialization +- Works with any PHP version that has support for closures +- Supports PHP 7 syntax +- Handles all variables referenced/imported in `use()` and automatically wraps all referenced/imported closures for +proper serialization +- Handles recursive closures +- Handles magic constants like `__FILE__`, `__DIR__`, `__LINE__`, `__NAMESPACE__`, `__CLASS__`, +`__TRAIT__`, `__METHOD__` and `__FUNCTION__`. +- Automatically resolves all class names, function names and constant names used inside the closure +- Track closure's residing source by using the `#trackme` directive +- Simple and very fast parser +- Any error or exception, that might occur when executing an unserialized closure, can be caught and treated properly +- You can serialize/unserialize any closure unlimited times, even those previously unserialized +(this is possible because `eval()` is not used for unserialization) +- Handles static closures +- Supports cryptographically signed closures +- Provides a reflector that can give you information about the serialized closure +- Provides an analyzer for *SuperClosure* library +- Automatically detects when the scope and/or the bound object of a closure needs to be serialized +in order for the closure to work after deserialization + +### Documentation + +The full documentation for this library can be found [here][documentation]. + +### License + +**Opis Closure** is licensed under the [MIT License (MIT)][license]. + +### Requirements + +* PHP ^5.4 || ^7.0 + +## Installation + +**Opis Closure** is available on [Packagist] and it can be installed from a +command line interface by using [Composer]. + +```bash +composer require opis/closure +``` + +Or you could directly reference it into your `composer.json` file as a dependency + +```json +{ + "require": { + "opis/closure": "^3.1" + } +} +``` + +### Migrating from 2.x + +If your project needs to support PHP 5.3 you can continue using the `2.x` version +of **Opis Closure**. Otherwise, assuming you are not using one of the removed/refactored classes or features(see +[CHANGELOG]), migrating to version `3.x` is simply a matter of updating your `composer.json` file. + +### Semantic versioning + +**Opis Closure** follows [semantic versioning][SemVer] specifications. + +### Arbitrary object serialization + +This feature was primarily introduced in order to support serializing an object bound +to a closure and available via `$this`. The implementation is far from being perfect +and it's really hard to make it work flawless. I will try to improve this, but I can +not guarantee anything. So my advice regarding the `Opis\Closure\serialize|unserialize` +functions is to use them with caution. + +### SuperClosure support + +**Opis Closure** is shipped with an analyzer(`Opis\Closure\Analyzer`) which +aims to provide *Opis Closure*'s parsing precision and speed to [SuperClosure]. + +[documentation]: https://www.opis.io/closure "Opis Closure" +[license]: http://opensource.org/licenses/MIT "MIT License" +[Packagist]: https://packagist.org/packages/opis/closure "Packagist" +[Composer]: https://getcomposer.org "Composer" +[SuperClosure]: https://github.com/jeremeamia/super_closure "SuperClosure" +[SemVer]: http://semver.org/ "Semantic versioning" +[CHANGELOG]: https://github.com/opis/closure/blob/master/CHANGELOG.md "Changelog" \ No newline at end of file diff --git a/vendor/opis/closure/autoload.php b/vendor/opis/closure/autoload.php new file mode 100644 index 0000000..5c214b3 --- /dev/null +++ b/vendor/opis/closure/autoload.php @@ -0,0 +1,39 @@ +getClosureScopeClass(); + + $data = [ + 'reflection' => $reflection, + 'code' => $reflection->getCode(), + 'hasThis' => $reflection->isBindingRequired(), + 'context' => $reflection->getUseVariables(), + 'hasRefs' => false, + 'binding' => $reflection->getClosureThis(), + 'scope' => $scope ? $scope->getName() : null, + 'isStatic' => $reflection->isStatic(), + ]; + + return $data; + } + + /** + * @param array $data + * @return mixed + */ + protected function determineCode(array &$data) + { + return null; + } + + /** + * @param array $data + * @return mixed + */ + protected function determineContext(array &$data) + { + return null; + } + +} diff --git a/vendor/opis/closure/src/ClosureContext.php b/vendor/opis/closure/src/ClosureContext.php new file mode 100644 index 0000000..7599a9d --- /dev/null +++ b/vendor/opis/closure/src/ClosureContext.php @@ -0,0 +1,33 @@ +scope = new ClosureScope(); + $this->locks = 0; + } +} \ No newline at end of file diff --git a/vendor/opis/closure/src/ClosureScope.php b/vendor/opis/closure/src/ClosureScope.php new file mode 100644 index 0000000..b0ede62 --- /dev/null +++ b/vendor/opis/closure/src/ClosureScope.php @@ -0,0 +1,25 @@ +content = "length = strlen($this->content); + return true; + } + + public function stream_read($count) + { + $value = substr($this->content, $this->pointer, $count); + $this->pointer += $count; + return $value; + } + + public function stream_eof() + { + return $this->pointer >= $this->length; + } + + public function stream_stat() + { + $stat = stat(__FILE__); + $stat[7] = $stat['size'] = $this->length; + return $stat; + } + + public function url_stat($path, $flags) + { + $stat = stat(__FILE__); + $stat[7] = $stat['size'] = $this->length; + return $stat; + } + + public function stream_seek($offset, $whence = SEEK_SET) + { + $crt = $this->pointer; + + switch ($whence) { + case SEEK_SET: + $this->pointer = $offset; + break; + case SEEK_CUR: + $this->pointer += $offset; + break; + case SEEK_END: + $this->pointer = $this->length + $offset; + break; + } + + if ($this->pointer < 0 || $this->pointer >= $this->length) { + $this->pointer = $crt; + return false; + } + + return true; + } + + public function stream_tell() + { + return $this->pointer; + } + + public static function register() + { + if (!static::$isRegistered) { + static::$isRegistered = stream_wrapper_register(static::STREAM_PROTO, __CLASS__); + } + } + +} diff --git a/vendor/opis/closure/src/ISecurityProvider.php b/vendor/opis/closure/src/ISecurityProvider.php new file mode 100644 index 0000000..4e50761 --- /dev/null +++ b/vendor/opis/closure/src/ISecurityProvider.php @@ -0,0 +1,25 @@ +code = $code; + parent::__construct($closure); + } + + /** + * @return bool + */ + public function isStatic() + { + if ($this->isStaticClosure === null) { + $this->isStaticClosure = strtolower(substr($this->getCode(), 0, 6)) === 'static'; + } + + return $this->isStaticClosure; + } + + /** + * @return string + */ + public function getCode() + { + if($this->code !== null){ + return $this->code; + } + + $fileName = $this->getFileName(); + $line = $this->getStartLine() - 1; + + $match = ClosureStream::STREAM_PROTO . '://'; + + if ($line === 1 && substr($fileName, 0, strlen($match)) === $match) { + return $this->code = substr($fileName, strlen($match)); + } + + $className = null; + + + if (null !== $className = $this->getClosureScopeClass()) { + $className = '\\' . trim($className->getName(), '\\'); + } + + + if($php7 = PHP_MAJOR_VERSION === 7){ + switch (PHP_MINOR_VERSION){ + case 0: + $php7_types = array('string', 'int', 'bool', 'float'); + break; + case 1: + $php7_types = array('string', 'int', 'bool', 'float', 'void'); + break; + case 2: + default: + $php7_types = array('string', 'int', 'bool', 'float', 'void', 'object'); + } + } + + $ns = $this->getNamespaceName(); + $nsf = $ns == '' ? '' : ($ns[0] == '\\' ? $ns : '\\' . $ns); + + $_file = var_export($fileName, true); + $_dir = var_export(dirname($fileName), true); + $_namespace = var_export($ns, true); + $_class = var_export(trim($className, '\\'), true); + $_function = $ns . ($ns == '' ? '' : '\\') . '{closure}'; + $_method = ($className == '' ? '' : trim($className, '\\') . '::') . $_function; + $_function = var_export($_function, true); + $_method = var_export($_method, true); + $_trait = null; + + $hasTraitSupport = defined('T_TRAIT_C'); + $tokens = $this->getTokens(); + $state = $lastState = 'start'; + $open = 0; + $code = ''; + $id_start = $id_start_ci = $id_name = $context = ''; + $classes = $functions = $constants = null; + $use = array(); + $lineAdd = 0; + $isUsingScope = false; + $isUsingThisObject = false; + + for($i = 0, $l = count($tokens); $i < $l; $i++) { + $token = $tokens[$i]; + switch ($state) { + case 'start': + if ($token[0] === T_FUNCTION || $token[0] === T_STATIC) { + $code .= $token[1]; + $state = $token[0] === T_FUNCTION ? 'function' : 'static'; + } + break; + case 'static': + if ($token[0] === T_WHITESPACE || $token[0] === T_COMMENT || $token[0] === T_FUNCTION) { + $code .= $token[1]; + if ($token[0] === T_FUNCTION) { + $state = 'function'; + } + } else { + $code = ''; + $state = 'start'; + } + break; + case 'function': + switch ($token[0]){ + case T_STRING: + $code = ''; + $state = 'named_function'; + break; + case '(': + $code .= '('; + $state = 'closure_args'; + break; + default: + $code .= is_array($token) ? $token[1] : $token; + } + break; + case 'named_function': + if($token[0] === T_FUNCTION || $token[0] === T_STATIC){ + $code = $token[1]; + $state = $token[0] === T_FUNCTION ? 'function' : 'static'; + } + break; + case 'closure_args': + switch ($token[0]){ + case T_NS_SEPARATOR: + case T_STRING: + $id_start = $token[1]; + $id_start_ci = strtolower($id_start); + $id_name = ''; + $context = 'args'; + $state = 'id_name'; + $lastState = 'closure_args'; + break; + case T_USE: + $code .= $token[1]; + $state = 'use'; + break; + case '=': + $code .= $token; + $lastState = 'closure_args'; + $state = 'ignore_next'; + break; + case ':': + $code .= ':'; + $state = 'return'; + break; + case '{': + $code .= '{'; + $state = 'closure'; + $open++; + break; + default: + $code .= is_array($token) ? $token[1] : $token; + } + break; + case 'use': + switch ($token[0]){ + case T_VARIABLE: + $use[] = substr($token[1], 1); + $code .= $token[1]; + break; + case '{': + $code .= '{'; + $state = 'closure'; + $open++; + break; + case ':': + $code .= ':'; + $state = 'return'; + break; + default: + $code .= is_array($token) ? $token[1] : $token; + break; + } + break; + case 'return': + switch ($token[0]){ + case T_WHITESPACE: + case T_COMMENT: + case T_DOC_COMMENT: + $code .= $token[1]; + break; + case T_NS_SEPARATOR: + case T_STRING: + $id_start = $token[1]; + $id_start_ci = strtolower($id_start); + $id_name = ''; + $context = 'return_type'; + $state = 'id_name'; + $lastState = 'return'; + break 2; + case '{': + $code .= '{'; + $state = 'closure'; + $open++; + break; + default: + $code .= is_array($token) ? $token[1] : $token; + break; + } + break; + case 'closure': + switch ($token[0]){ + case T_CURLY_OPEN: + case T_DOLLAR_OPEN_CURLY_BRACES: + case T_STRING_VARNAME: + case '{': + $code .= '{'; + $open++; + break; + case '}': + $code .= '}'; + if(--$open === 0){ + break 3; + } + break; + case T_LINE: + $code .= $token[2] - $line + $lineAdd; + break; + case T_FILE: + $code .= $_file; + break; + case T_DIR: + $code .= $_dir; + break; + case T_NS_C: + $code .= $_namespace; + break; + case T_CLASS_C: + $code .= $_class; + break; + case T_FUNC_C: + $code .= $_function; + break; + case T_METHOD_C: + $code .= $_method; + break; + case T_COMMENT: + if (substr($token[1], 0, 8) === '#trackme') { + $timestamp = time(); + $code .= '/**' . PHP_EOL; + $code .= '* Date : ' . date(DATE_W3C, $timestamp) . PHP_EOL; + $code .= '* Timestamp : ' . $timestamp . PHP_EOL; + $code .= '* Line : ' . ($line + 1) . PHP_EOL; + $code .= '* File : ' . $_file . PHP_EOL . '*/' . PHP_EOL; + $lineAdd += 5; + } else { + $code .= $token[1]; + } + break; + case T_VARIABLE: + if($token[1] == '$this'){ + $isUsingThisObject = true; + } + $code .= $token[1]; + break; + case T_STATIC: + $isUsingScope = true; + $code .= $token[1]; + break; + case T_NS_SEPARATOR: + case T_STRING: + $id_start = $token[1]; + $id_start_ci = strtolower($id_start); + $id_name = ''; + $context = 'root'; + $state = 'id_name'; + $lastState = 'closure'; + break 2; + case T_NEW: + $code .= $token[1]; + $context = 'new'; + $state = 'id_start'; + $lastState = 'closure'; + break 2; + case T_INSTANCEOF: + $code .= $token[1]; + $context = 'instanceof'; + $state = 'id_start'; + $lastState = 'closure'; + break; + case T_OBJECT_OPERATOR: + case T_DOUBLE_COLON: + $code .= $token[1]; + $lastState = 'closure'; + $state = 'ignore_next'; + break; + case T_FUNCTION: + $code .= $token[1]; + $state = 'closure_args'; + break; + default: + if ($hasTraitSupport && $token[0] == T_TRAIT_C) { + if ($_trait === null) { + $startLine = $this->getStartLine(); + $endLine = $this->getEndLine(); + $structures = $this->getStructures(); + + $_trait = ''; + + foreach ($structures as &$struct) { + if ($struct['type'] === 'trait' && + $struct['start'] <= $startLine && + $struct['end'] >= $endLine + ) { + $_trait = ($ns == '' ? '' : $ns . '\\') . $struct['name']; + break; + } + } + + $_trait = var_export($_trait, true); + } + + $token[1] = $_trait; + } else { + $code .= is_array($token) ? $token[1] : $token; + } + } + break; + case 'ignore_next': + switch ($token[0]){ + case T_WHITESPACE: + $code .= $token[1]; + break; + case T_CLASS: + case T_STATIC: + case T_VARIABLE: + case T_STRING: + $code .= $token[1]; + $state = $lastState; + break; + default: + $state = $lastState; + $i--; + } + break; + case 'id_start': + switch ($token[0]){ + case T_WHITESPACE: + $code .= $token[1]; + break; + case T_NS_SEPARATOR: + case T_STRING: + case T_STATIC: + $id_start = $token[1]; + $id_start_ci = strtolower($id_start); + $id_name = ''; + $state = 'id_name'; + break 2; + case T_VARIABLE: + $code .= $token[1]; + $state = $lastState; + break; + case T_CLASS: + $code .= $token[1]; + $state = 'anonymous'; + break; + default: + $i--;//reprocess last + $state = 'id_name'; + } + break; + case 'id_name': + switch ($token[0]){ + case T_NS_SEPARATOR: + case T_STRING: + $id_name .= $token[1]; + break; + case T_WHITESPACE: + $id_name .= $token[1]; + break; + case '(': + if($context === 'new' || false !== strpos($id_name, '\\')){ + if($id_start !== '\\'){ + if ($classes === null) { + $classes = $this->getClasses(); + } + if (isset($classes[$id_start_ci])) { + $id_start = $classes[$id_start_ci]; + } + if($id_start[0] !== '\\'){ + $id_start = $nsf . '\\' . $id_start; + } + } + } else { + if($id_start !== '\\'){ + if($functions === null){ + $functions = $this->getFunctions(); + } + if(isset($functions[$id_start_ci])){ + $id_start = $functions[$id_start_ci]; + } + } + } + $code .= $id_start . $id_name . '('; + $state = $lastState; + break; + case T_VARIABLE: + case T_DOUBLE_COLON: + if($id_start !== '\\') { + if($id_start_ci === 'self' || $id_start_ci === 'static' || $id_start_ci === 'parent'){ + $isUsingScope = true; + } elseif (!($php7 && in_array($id_start_ci, $php7_types))){ + if ($classes === null) { + $classes = $this->getClasses(); + } + if (isset($classes[$id_start_ci])) { + $id_start = $classes[$id_start_ci]; + } + if($id_start[0] !== '\\'){ + $id_start = $nsf . '\\' . $id_start; + } + } + } + $code .= $id_start . $id_name . $token[1]; + $state = $token[0] === T_DOUBLE_COLON ? 'ignore_next' : $lastState; + break; + default: + if($id_start !== '\\'){ + if($context === 'instanceof' || $context === 'args' || $context === 'return_type' || $context === 'extends'){ + if($id_start_ci === 'self' || $id_start_ci === 'static' || $id_start_ci === 'parent'){ + $isUsingScope = true; + } elseif (!($php7 && in_array($id_start_ci, $php7_types))){ + if($classes === null){ + $classes = $this->getClasses(); + } + if(isset($classes[$id_start_ci])){ + $id_start = $classes[$id_start_ci]; + } + if($id_start[0] !== '\\'){ + $id_start = $nsf . '\\' . $id_start; + } + } + } else { + if($constants === null){ + $constants = $this->getConstants(); + } + if(isset($constants[$id_start])){ + $id_start = $constants[$id_start]; + } + } + } + $code .= $id_start . $id_name; + $state = $lastState; + $i--;//reprocess last token + } + break; + case 'anonymous': + switch ($token[0]) { + case T_NS_SEPARATOR: + case T_STRING: + $id_start = $token[1]; + $id_start_ci = strtolower($id_start); + $id_name = ''; + $state = 'id_name'; + $context = 'extends'; + $lastState = 'anonymous'; + break; + case '{': + $state = 'closure'; + $i--; + break; + default: + $code .= is_array($token) ? $token[1] : $token; + } + break; + } + } + + $this->isBindingRequired = $isUsingThisObject; + $this->isScopeRequired = $isUsingScope; + $this->code = $code; + $this->useVariables = empty($use) ? $use : array_intersect_key($this->getStaticVariables(), array_flip($use)); + + return $this->code; + } + + /** + * @return array + */ + public function getUseVariables() + { + if($this->useVariables !== null){ + return $this->useVariables; + } + + $tokens = $this->getTokens(); + $use = array(); + $state = 'start'; + + foreach ($tokens as &$token) { + $is_array = is_array($token); + + switch ($state) { + case 'start': + if ($is_array && $token[0] === T_USE) { + $state = 'use'; + } + break; + case 'use': + if ($is_array) { + if ($token[0] === T_VARIABLE) { + $use[] = substr($token[1], 1); + } + } elseif ($token == ')') { + break 2; + } + break; + } + } + + $this->useVariables = empty($use) ? $use : array_intersect_key($this->getStaticVariables(), array_flip($use)); + + return $this->useVariables; + } + + /** + * return bool + */ + public function isBindingRequired() + { + if($this->isBindingRequired === null){ + $this->getCode(); + } + + return $this->isBindingRequired; + } + + /** + * return bool + */ + public function isScopeRequired() + { + if($this->isScopeRequired === null){ + $this->getCode(); + } + + return $this->isScopeRequired; + } + + /** + * @return string + */ + protected function getHashedFileName() + { + if ($this->hashedName === null) { + $this->hashedName = md5($this->getFileName()); + } + + return $this->hashedName; + } + + /** + * @return array + */ + protected function getFileTokens() + { + $key = $this->getHashedFileName(); + + if (!isset(static::$files[$key])) { + static::$files[$key] = token_get_all(file_get_contents($this->getFileName())); + } + + return static::$files[$key]; + } + + /** + * @return array + */ + protected function getTokens() + { + if ($this->tokens === null) { + $tokens = $this->getFileTokens(); + $startLine = $this->getStartLine(); + $endLine = $this->getEndLine(); + $results = array(); + $start = false; + + foreach ($tokens as &$token) { + if (!is_array($token)) { + if ($start) { + $results[] = $token; + } + + continue; + } + + $line = $token[2]; + + if ($line <= $endLine) { + if ($line >= $startLine) { + $start = true; + $results[] = $token; + } + + continue; + } + + break; + } + + $this->tokens = $results; + } + + return $this->tokens; + } + + /** + * @return array + */ + protected function getClasses() + { + $key = $this->getHashedFileName(); + + if (!isset(static::$classes[$key])) { + $this->fetchItems(); + } + + return static::$classes[$key]; + } + + /** + * @return array + */ + protected function getFunctions() + { + $key = $this->getHashedFileName(); + + if (!isset(static::$functions[$key])) { + $this->fetchItems(); + } + + return static::$functions[$key]; + } + + /** + * @return array + */ + protected function getConstants() + { + $key = $this->getHashedFileName(); + + if (!isset(static::$constants[$key])) { + $this->fetchItems(); + } + + return static::$constants[$key]; + } + + /** + * @return array + */ + protected function getStructures() + { + $key = $this->getHashedFileName(); + + if (!isset(static::$structures[$key])) { + $this->fetchItems(); + } + + return static::$structures[$key]; + } + + protected function fetchItems() + { + $key = $this->getHashedFileName(); + + $classes = array(); + $functions = array(); + $constants = array(); + $structures = array(); + $tokens = $this->getFileTokens(); + + $open = 0; + $state = 'start'; + $prefix = ''; + $name = ''; + $alias = ''; + $isFunc = $isConst = false; + + $startLine = $endLine = 0; + $structType = $structName = ''; + $structIgnore = false; + + $hasTraitSupport = defined('T_TRAIT'); + + foreach ($tokens as $token) { + $is_array = is_array($token); + + switch ($state) { + case 'start': + if ($is_array) { + switch ($token[0]) { + case T_CLASS: + case T_INTERFACE: + $state = 'before_structure'; + $startLine = $token[2]; + $structType = $token[0] == T_CLASS ? 'class' : 'interface'; + break; + case T_USE: + $state = 'use'; + $prefix = $name = $alias = ''; + $isFunc = $isConst = false; + break; + case T_FUNCTION: + $state = 'structure'; + $structIgnore = true; + break; + default: + if ($hasTraitSupport && $token[0] == T_TRAIT) { + $state = 'before_structure'; + $startLine = $token[2]; + $structType = 'trait'; + } + break; + } + } + break; + case 'use': + if ($is_array) { + switch ($token[0]) { + case T_FUNCTION: + $isFunc = true; + break; + case T_CONST: + $isConst = true; + break; + case T_NS_SEPARATOR: + $name .= $token[1]; + break; + case T_STRING: + $name .= $token[1]; + $alias = $token[1]; + break; + case T_AS: + if ($name[0] !== '\\' && $prefix === '') { + $name = '\\' . $name; + } + $state = 'alias'; + break; + } + } elseif ($name === '') { + $state = 'start'; + } else { + if ($name[0] !== '\\' && $prefix === '') { + $name = '\\' . $name; + } + + if($token == '{') { + $prefix = $name; + $name = ''; + } else { + if($isFunc){ + $functions[strtolower($alias)] = $prefix . $name; + } elseif ($isConst){ + $constants[$alias] = $prefix . $name; + } else { + $classes[strtolower($alias)] = $prefix . $name; + } + $name = ''; + $state = 'use'; + } + } + break; + case 'alias': + if ($is_array) { + if($token[0] == T_STRING){ + $alias = $token[1]; + } + } else { + if($isFunc){ + $functions[strtolower($alias)] = $prefix . $name; + } elseif ($isConst){ + $constants[$alias] = $prefix . $name; + } else { + $classes[strtolower($alias)] = $prefix . $name; + } + $name = ''; + $state = $token == ',' ? 'use' : 'start'; + } + break; + case 'before_structure': + if ($is_array && $token[0] == T_STRING) { + $structName = $token[1]; + $state = 'structure'; + } + break; + case 'structure': + if (!$is_array) { + if ($token === '{') { + $open++; + } elseif ($token === '}') { + if (--$open == 0) { + if(!$structIgnore){ + $structures[] = array( + 'type' => $structType, + 'name' => $structName, + 'start' => $startLine, + 'end' => $endLine, + ); + } + $structIgnore = false; + $state = 'start'; + } + } + } else { + if($token[0] === T_CURLY_OPEN || + $token[0] === T_DOLLAR_OPEN_CURLY_BRACES || + $token[0] === T_STRING_VARNAME){ + $open++; + } + $endLine = $token[2]; + } + break; + } + } + + static::$classes[$key] = $classes; + static::$functions[$key] = $functions; + static::$constants[$key] = $constants; + static::$structures[$key] = $structures; + } + +} diff --git a/vendor/opis/closure/src/SecurityException.php b/vendor/opis/closure/src/SecurityException.php new file mode 100644 index 0000000..7767a25 --- /dev/null +++ b/vendor/opis/closure/src/SecurityException.php @@ -0,0 +1,18 @@ +secret = $secret; + } + + /** + * @inheritdoc + */ + public function sign($closure) + { + return array( + 'closure' => $closure, + 'hash' => base64_encode(hash_hmac('sha256', $closure, $this->secret, true)), + ); + } + + /** + * @inheritdoc + */ + public function verify(array $data) + { + return base64_encode(hash_hmac('sha256', $data['closure'], $this->secret, true)) === $data['hash']; + } +} \ No newline at end of file diff --git a/vendor/opis/closure/src/SelfReference.php b/vendor/opis/closure/src/SelfReference.php new file mode 100644 index 0000000..16b683d --- /dev/null +++ b/vendor/opis/closure/src/SelfReference.php @@ -0,0 +1,30 @@ +hash = $hash; + } +} \ No newline at end of file diff --git a/vendor/opis/closure/src/SerializableClosure.php b/vendor/opis/closure/src/SerializableClosure.php new file mode 100644 index 0000000..72872cb --- /dev/null +++ b/vendor/opis/closure/src/SerializableClosure.php @@ -0,0 +1,622 @@ +closure = $closure; + if (static::$context !== null) { + $this->scope = static::$context->scope; + $this->scope->toserialize++; + } + } + + /** + * Get the Closure object + * + * @return Closure The wrapped closure + */ + public function getClosure() + { + return $this->closure; + } + + /** + * Get the reflector for closure + * + * @return ReflectionClosure + */ + public function getReflector() + { + if ($this->reflector === null) { + $this->reflector = new ReflectionClosure($this->closure, $this->code); + $this->code = null; + } + + return $this->reflector; + } + + /** + * Implementation of magic method __invoke() + */ + public function __invoke() + { + return call_user_func_array($this->closure, func_get_args()); + } + + /** + * Implementation of Serializable::serialize() + * + * @return string The serialized closure + */ + public function serialize() + { + if ($this->scope === null) { + $this->scope = new ClosureScope(); + $this->scope->toserialize++; + } + + $this->scope->serializations++; + + $scope = $object = null; + $reflector = $this->getReflector(); + + if($reflector->isBindingRequired()){ + $object = $reflector->getClosureThis(); + static::wrapClosures($object, $this->scope); + if($scope = $reflector->getClosureScopeClass()){ + $scope = $scope->name; + } + } elseif($reflector->isScopeRequired()) { + if($scope = $reflector->getClosureScopeClass()){ + $scope = $scope->name; + } + } + + $this->reference = spl_object_hash($this->closure); + + $this->scope[$this->closure] = $this; + + $use = $this->transformUseVariables($reflector->getUseVariables()); + $code = $reflector->getCode(); + + $this->mapByReference($use); + + $ret = \serialize(array( + 'use' => $use, + 'function' => $code, + 'scope' => $scope, + 'this' => $object, + 'self' => $this->reference, + )); + + if(static::$securityProvider !== null){ + $ret = '@' . json_encode(static::$securityProvider->sign($ret)); + } + + if (!--$this->scope->serializations && !--$this->scope->toserialize) { + $this->scope = null; + } + + return $ret; + } + + /** + * Transform the use variables before serialization. + * + * @param array $data The Closure's use variables + * @return array + */ + protected function transformUseVariables($data) + { + return $data; + } + + /** + * Implementation of Serializable::unserialize() + * + * @param string $data Serialized data + * @throws SecurityException + */ + public function unserialize($data) + { + ClosureStream::register(); + + if (static::$securityProvider !== null) { + if ($data[0] !== '@') { + throw new SecurityException("The serialized closure is not signed. ". + "Make sure you use a security provider for both serialization and unserialization."); + } + + $data = json_decode(substr($data, 1), true); + + if (!is_array($data) || !static::$securityProvider->verify($data)) { + throw new SecurityException("Your serialized closure might have been modified and it's unsafe to be unserialized. " . + "Make sure you use the same security provider, with the same settings, " . + "both for serialization and unserialization."); + } + + $data = $data['closure']; + } elseif ($data[0] === '@') { + throw new SecurityException("The serialized closure is signed. ". + "Make sure you use a security provider for both serialization and unserialization."); + } + + $this->code = \unserialize($data); + + // unset data + unset($data); + + $this->code['objects'] = array(); + + if ($this->code['use']) { + $this->scope = new ClosureScope(); + $this->code['use'] = $this->resolveUseVariables($this->code['use']); + $this->mapPointers($this->code['use']); + extract($this->code['use'], EXTR_OVERWRITE | EXTR_REFS); + $this->scope = null; + } + + $this->closure = include(ClosureStream::STREAM_PROTO . '://' . $this->code['function']); + + if($this->code['this'] === $this){ + $this->code['this'] = null; + } + + if ($this->code['scope'] !== null || $this->code['this'] !== null) { + $this->closure = $this->closure->bindTo($this->code['this'], $this->code['scope']); + } + + if(!empty($this->code['objects'])){ + foreach ($this->code['objects'] as $item){ + $item['property']->setValue($item['instance'], $item['object']->getClosure()); + } + } + + $this->code = $this->code['function']; + } + + /** + * Resolve the use variables after unserialization. + * + * @param array $data The Closure's transformed use variables + * @return array + */ + protected function resolveUseVariables($data) + { + return $data; + } + + /** + * Wraps a closure and sets the serialization context (if any) + * + * @param Closure $closure Closure to be wrapped + * + * @return self The wrapped closure + */ + public static function from(Closure $closure) + { + if (static::$context === null) { + $instance = new static($closure); + } elseif (isset(static::$context->scope[$closure])) { + $instance = static::$context->scope[$closure]; + } else { + $instance = new static($closure); + static::$context->scope[$closure] = $instance; + } + + return $instance; + } + + /** + * Increments the context lock counter or creates a new context if none exist + */ + public static function enterContext() + { + if (static::$context === null) { + static::$context = new ClosureContext(); + } + + static::$context->locks++; + } + + /** + * Decrements the context lock counter and destroy the context when it reaches to 0 + */ + public static function exitContext() + { + if (static::$context !== null && !--static::$context->locks) { + static::$context = null; + } + } + + /** + * @param string $secret + */ + public static function setSecretKey($secret) + { + if(static::$securityProvider === null){ + static::$securityProvider = new SecurityProvider($secret); + } + } + + /** + * @param ISecurityProvider $securityProvider + */ + public static function addSecurityProvider(ISecurityProvider $securityProvider) + { + static::$securityProvider = $securityProvider; + } + + /** + * Remove security provider + */ + public static function removeSecurityProvider() + { + static::$securityProvider = null; + } + + /** + * @return null|ISecurityProvider + */ + public static function getSecurityProvider() + { + return static::$securityProvider; + } + + /** + * Wrap closures + * + * @param $data + * @param ClosureScope|SplObjectStorage|null $storage + */ + public static function wrapClosures(&$data, SplObjectStorage $storage = null) + { + static::enterContext(); + + if($storage === null){ + $storage = static::$context->scope; + } + + if($data instanceof Closure){ + $data = static::from($data); + } elseif (is_array($data)){ + if(isset($data[self::ARRAY_RECURSIVE_KEY])){ + return; + } + $data[self::ARRAY_RECURSIVE_KEY] = true; + foreach ($data as $key => &$value){ + if($key === self::ARRAY_RECURSIVE_KEY){ + continue; + } + static::wrapClosures($value, $storage); + } + unset($value); + unset($data[self::ARRAY_RECURSIVE_KEY]); + } elseif($data instanceof \stdClass){ + if(isset($storage[$data])){ + $data = $storage[$data]; + return; + } + $data = $storage[$data] = clone($data); + foreach ($data as &$value){ + static::wrapClosures($value, $storage); + } + unset($value); + } elseif (is_object($data) && ! $data instanceof static){ + if(isset($storage[$data])){ + $data = $storage[$data]; + return; + } + $instance = $data; + $reflection = new ReflectionObject($instance); + if(!$reflection->isUserDefined()){ + $storage[$instance] = $data; + return; + } + $storage[$instance] = $data = $reflection->newInstanceWithoutConstructor(); + + do{ + if(!$reflection->isUserDefined()){ + break; + } + foreach ($reflection->getProperties() as $property){ + if($property->isStatic()){ + continue; + } + $property->setAccessible(true); + $value = $property->getValue($instance); + if(is_array($value) || is_object($value)){ + static::wrapClosures($value, $storage); + } + $property->setValue($data, $value); + }; + } while($reflection = $reflection->getParentClass()); + } + + static::exitContext(); + } + + /** + * Unwrap closures + * + * @param $data + * @param SplObjectStorage|null $storage + */ + public static function unwrapClosures(&$data, SplObjectStorage $storage = null) + { + if($storage === null){ + $storage = static::$context->scope; + } + + if($data instanceof static){ + $data = $data->getClosure(); + } elseif (is_array($data)){ + if(isset($data[self::ARRAY_RECURSIVE_KEY])){ + return; + } + $data[self::ARRAY_RECURSIVE_KEY] = true; + foreach ($data as $key => &$value){ + if($key === self::ARRAY_RECURSIVE_KEY){ + continue; + } + static::unwrapClosures($value, $storage); + } + unset($data[self::ARRAY_RECURSIVE_KEY]); + }elseif ($data instanceof \stdClass){ + if(isset($storage[$data])){ + return; + } + $storage[$data] = true; + foreach ($data as &$property){ + static::unwrapClosures($property, $storage); + } + } elseif (is_object($data) && !($data instanceof Closure)){ + if(isset($storage[$data])){ + return; + } + $storage[$data] = true; + $reflection = new ReflectionObject($data); + + do{ + if(!$reflection->isUserDefined()){ + break; + } + foreach ($reflection->getProperties() as $property){ + if($property->isStatic()){ + continue; + } + $property->setAccessible(true); + $value = $property->getValue($data); + if(is_array($value) || is_object($value)){ + static::unwrapClosures($value, $storage); + $property->setValue($data, $value); + } + }; + } while($reflection = $reflection->getParentClass()); + } + } + + /** + * Internal method used to map closure pointers + * @param $data + */ + protected function mapPointers(&$data) + { + $scope = $this->scope; + + if ($data instanceof static) { + $data = &$data->closure; + } elseif (is_array($data)) { + if(isset($data[self::ARRAY_RECURSIVE_KEY])){ + return; + } + $data[self::ARRAY_RECURSIVE_KEY] = true; + foreach ($data as $key => &$value){ + if($key === self::ARRAY_RECURSIVE_KEY){ + continue; + } elseif ($value instanceof static) { + $data[$key] = &$value->closure; + } elseif ($value instanceof SelfReference && $value->hash === $this->code['self']){ + $data[$key] = &$this->closure; + } else { + $this->mapPointers($value); + } + } + unset($value); + unset($data[self::ARRAY_RECURSIVE_KEY]); + } elseif ($data instanceof \stdClass) { + if(isset($scope[$data])){ + return; + } + $scope[$data] = true; + foreach ($data as $key => &$value){ + if ($value instanceof SelfReference && $value->hash === $this->code['self']){ + $data->{$key} = &$this->closure; + } elseif(is_array($value) || is_object($value)) { + $this->mapPointers($value); + } + } + unset($value); + } elseif (is_object($data) && !($data instanceof Closure)){ + if(isset($scope[$data])){ + return; + } + $scope[$data] = true; + $reflection = new ReflectionObject($data); + do{ + if(!$reflection->isUserDefined()){ + break; + } + foreach ($reflection->getProperties() as $property){ + if($property->isStatic()){ + continue; + } + $property->setAccessible(true); + $item = $property->getValue($data); + if ($item instanceof SerializableClosure || ($item instanceof SelfReference && $item->hash === $this->code['self'])) { + $this->code['objects'][] = array( + 'instance' => $data, + 'property' => $property, + 'object' => $item instanceof SelfReference ? $this : $item, + ); + } elseif (is_array($item) || is_object($item)) { + $this->mapPointers($item); + $property->setValue($data, $item); + } + } + } while($reflection = $reflection->getParentClass()); + } + } + + /** + * Internal method used to map closures by reference + * + * @param mixed &$data + */ + protected function mapByReference(&$data) + { + if ($data instanceof Closure) { + if($data === $this->closure){ + $data = new SelfReference($this->reference); + return; + } + + if (isset($this->scope[$data])) { + $data = $this->scope[$data]; + return; + } + + $instance = new static($data); + + if (static::$context !== null) { + static::$context->scope->toserialize--; + } else { + $instance->scope = $this->scope; + } + + $data = $this->scope[$data] = $instance; + } elseif (is_array($data)) { + if(isset($data[self::ARRAY_RECURSIVE_KEY])){ + return; + } + $data[self::ARRAY_RECURSIVE_KEY] = true; + foreach ($data as $key => &$value){ + if($key === self::ARRAY_RECURSIVE_KEY){ + continue; + } + $this->mapByReference($value); + } + unset($value); + unset($data[self::ARRAY_RECURSIVE_KEY]); + } elseif ($data instanceof \stdClass) { + if(isset($this->scope[$data])){ + $data = $this->scope[$data]; + return; + } + $instance = $data; + $this->scope[$instance] = $data = clone($data); + + foreach ($data as &$value){ + $this->mapByReference($value); + } + unset($value); + } elseif (is_object($data) && !$data instanceof SerializableClosure){ + if(isset($this->scope[$data])){ + $data = $this->scope[$data]; + return; + } + + $instance = $data; + $reflection = new ReflectionObject($data); + if(!$reflection->isUserDefined()){ + $this->scope[$instance] = $data; + return; + } + $this->scope[$instance] = $data = $reflection->newInstanceWithoutConstructor(); + + do{ + if(!$reflection->isUserDefined()){ + break; + } + foreach ($reflection->getProperties() as $property){ + if($property->isStatic()){ + continue; + } + $property->setAccessible(true); + $value = $property->getValue($instance); + if(is_array($value) || is_object($value)){ + $this->mapByReference($value); + } + $property->setValue($data, $value); + } + } while($reflection = $reflection->getParentClass()); + } + } + +} diff --git a/vendor/orchestra/testbench-core/composer.json b/vendor/orchestra/testbench-core/composer.json new file mode 100644 index 0000000..36e380c --- /dev/null +++ b/vendor/orchestra/testbench-core/composer.json @@ -0,0 +1,53 @@ +{ + "name": "orchestra/testbench-core", + "description": "Testing Helper for Laravel Development", + "homepage": "http://orchestraplatform.com/docs/latest/components/testbench/", + "keywords": ["laravel", "orchestral", "orchestra-platform", "testing", "tdd", "bdd"], + "license": "MIT", + "support": { + "issues": "https://github.com/orchestral/testbench/issues", + "source": "https://github.com/orchestral/testbench-core" + }, + "authors": [ + { + "name": "Mior Muhammad Zaki", + "email": "crynobone@gmail.com", + "homepage": "https://github.com/crynobone" + } + ], + "autoload": { + "psr-4": { + "Orchestra\\Testbench\\" : "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Orchestra\\Testbench\\Tests\\": "tests/" + } + }, + "require": { + "php": ">=7.1", + "fzaninotto/faker": "^1.4" + }, + "require-dev": { + "laravel/framework": "~5.7.14", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "laravel/framework": "Required for testing (~5.7.14).", + "mockery/mockery": "Allow to use Mockery for testing (^1.0).", + "orchestra/testbench-browser-kit": "Allow to use legacy Laravel BrowserKit for testing (~3.7).", + "orchestra/testbench-dusk": "Allow to use Laravel Dusk for testing (~3.7).", + "phpunit/phpunit": "Allow to use PHPUnit for testing (^7.0)." + }, + "extra": { + "branch-alias": { + "dev-master": "3.7-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/orchestra/testbench-core/create-sqlite-db b/vendor/orchestra/testbench-core/create-sqlite-db new file mode 100755 index 0000000..3f8a781 --- /dev/null +++ b/vendor/orchestra/testbench-core/create-sqlite-db @@ -0,0 +1,8 @@ +#!/usr/bin/env php + env('APP_NAME', 'Laravel'), + + /* + |-------------------------------------------------------------------------- + | Application Environment + |-------------------------------------------------------------------------- + | + | This value determines the "environment" your application is currently + | running in. This may determine how you prefer to configure various + | services the application utilizes. Set this in your ".env" file. + | + */ + + 'env' => env('APP_ENV', 'testing'), + + /* + |-------------------------------------------------------------------------- + | Application Debug Mode + |-------------------------------------------------------------------------- + | + | When your application is in debug mode, detailed error messages with + | stack traces will be shown on every error that occurs within your + | application. If disabled, a simple generic error page is shown. + | + */ + + 'debug' => env('APP_DEBUG', false), + + /* + |-------------------------------------------------------------------------- + | Application URL + |-------------------------------------------------------------------------- + | + | This URL is used by the console to properly generate URLs when using + | the Artisan command line tool. You should set this to the root of + | your application so that it is used when running Artisan tasks. + | + */ + + 'url' => env('APP_URL', 'http://localhost'), + + 'asset_url' => env('ASSET_URL', null), + + /* + |-------------------------------------------------------------------------- + | Application Timezone + |-------------------------------------------------------------------------- + | + | Here you may specify the default timezone for your application, which + | will be used by the PHP date and date-time functions. We have gone + | ahead and set this to a sensible default for you out of the box. + | + */ + + 'timezone' => 'UTC', + + /* + |-------------------------------------------------------------------------- + | Application Locale Configuration + |-------------------------------------------------------------------------- + | + | The application locale determines the default locale that will be used + | by the translation service provider. You are free to set this value + | to any of the locales which will be supported by the application. + | + */ + + 'locale' => 'en', + + /* + |-------------------------------------------------------------------------- + | Application Fallback Locale + |-------------------------------------------------------------------------- + | + | The fallback locale determines the locale to use when the current one + | is not available. You may change the value to correspond to any of + | the language folders that are provided through your application. + | + */ + + 'fallback_locale' => 'en', + + /* + |-------------------------------------------------------------------------- + | Faker Locale + |-------------------------------------------------------------------------- + | + | This locale will be used by the Faker PHP library when generating fake + | data for your database seeds. For example, this will be used to get + | localized telephone numbers, street address information and more. + | + */ + + 'faker_locale' => 'en_US', + + /* + |-------------------------------------------------------------------------- + | Encryption Key + |-------------------------------------------------------------------------- + | + | This key is used by the Illuminate encrypter service and should be set + | to a random, 32 character string, otherwise these encrypted strings + | will not be safe. Please do this before deploying an application! + | + */ + + 'key' => env('APP_KEY'), + + 'cipher' => 'AES-256-CBC', + + /* + |-------------------------------------------------------------------------- + | Autoloaded Service Providers + |-------------------------------------------------------------------------- + | + | The service providers listed here will be automatically loaded on the + | request to your application. Feel free to add your own services to + | this array to grant expanded functionality to your applications. + | + */ + + 'providers' => [ + + /* + * Laravel Framework Service Providers... + */ + Illuminate\Auth\AuthServiceProvider::class, + Illuminate\Broadcasting\BroadcastServiceProvider::class, + Illuminate\Bus\BusServiceProvider::class, + Illuminate\Cache\CacheServiceProvider::class, + Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, + Illuminate\Cookie\CookieServiceProvider::class, + Illuminate\Database\DatabaseServiceProvider::class, + Illuminate\Encryption\EncryptionServiceProvider::class, + Illuminate\Filesystem\FilesystemServiceProvider::class, + Illuminate\Foundation\Providers\FoundationServiceProvider::class, + Illuminate\Hashing\HashServiceProvider::class, + Illuminate\Mail\MailServiceProvider::class, + Illuminate\Notifications\NotificationServiceProvider::class, + Illuminate\Pagination\PaginationServiceProvider::class, + Illuminate\Pipeline\PipelineServiceProvider::class, + Illuminate\Queue\QueueServiceProvider::class, + Illuminate\Redis\RedisServiceProvider::class, + Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, + Illuminate\Session\SessionServiceProvider::class, + Illuminate\Translation\TranslationServiceProvider::class, + Illuminate\Validation\ValidationServiceProvider::class, + Illuminate\View\ViewServiceProvider::class, + + ], + + /* + |-------------------------------------------------------------------------- + | Class Aliases + |-------------------------------------------------------------------------- + | + | This array of class aliases will be registered when this application + | is started. However, feel free to register as many as you wish as + | the aliases are "lazy" loaded so they don't hinder performance. + | + */ + + 'aliases' => [ + + 'App' => Illuminate\Support\Facades\App::class, + 'Artisan' => Illuminate\Support\Facades\Artisan::class, + 'Auth' => Illuminate\Support\Facades\Auth::class, + 'Blade' => Illuminate\Support\Facades\Blade::class, + 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, + 'Bus' => Illuminate\Support\Facades\Bus::class, + 'Cache' => Illuminate\Support\Facades\Cache::class, + 'Config' => Illuminate\Support\Facades\Config::class, + 'Cookie' => Illuminate\Support\Facades\Cookie::class, + 'Crypt' => Illuminate\Support\Facades\Crypt::class, + 'DB' => Illuminate\Support\Facades\DB::class, + 'Eloquent' => Illuminate\Database\Eloquent\Model::class, + 'Event' => Illuminate\Support\Facades\Event::class, + 'File' => Illuminate\Support\Facades\File::class, + 'Gate' => Illuminate\Support\Facades\Gate::class, + 'Hash' => Illuminate\Support\Facades\Hash::class, + 'Lang' => Illuminate\Support\Facades\Lang::class, + 'Log' => Illuminate\Support\Facades\Log::class, + 'Mail' => Illuminate\Support\Facades\Mail::class, + 'Notification' => Illuminate\Support\Facades\Notification::class, + 'Password' => Illuminate\Support\Facades\Password::class, + 'Queue' => Illuminate\Support\Facades\Queue::class, + 'Redirect' => Illuminate\Support\Facades\Redirect::class, + 'Redis' => Illuminate\Support\Facades\Redis::class, + 'Request' => Illuminate\Support\Facades\Request::class, + 'Response' => Illuminate\Support\Facades\Response::class, + 'Route' => Illuminate\Support\Facades\Route::class, + 'Schema' => Illuminate\Support\Facades\Schema::class, + 'Session' => Illuminate\Support\Facades\Session::class, + 'Storage' => Illuminate\Support\Facades\Storage::class, + 'URL' => Illuminate\Support\Facades\URL::class, + 'Validator' => Illuminate\Support\Facades\Validator::class, + 'View' => Illuminate\Support\Facades\View::class, + + ], + +]; diff --git a/vendor/orchestra/testbench-core/laravel/config/auth.php b/vendor/orchestra/testbench-core/laravel/config/auth.php new file mode 100644 index 0000000..ac88fa4 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/config/auth.php @@ -0,0 +1,106 @@ + [ + 'guard' => 'web', + 'passwords' => 'users', + ], + + /* + |-------------------------------------------------------------------------- + | Authentication Guards + |-------------------------------------------------------------------------- + | + | Next, you may define every authentication guard for your application. + | Of course, a great default configuration has been defined for you + | here which uses session storage and the Eloquent user provider. + | + | All authentication drivers have a user provider. This defines how the + | users are actually retrieved out of your database or other storage + | mechanisms used by this application to persist your user's data. + | + | Supported: "session", "token" + | + */ + + 'guards' => [ + 'web' => [ + 'driver' => 'session', + 'provider' => 'users', + ], + + 'api' => [ + 'driver' => 'token', + 'provider' => 'users', + ], + ], + + /* + |-------------------------------------------------------------------------- + | User Providers + |-------------------------------------------------------------------------- + | + | All authentication drivers have a user provider. This defines how the + | users are actually retrieved out of your database or other storage + | mechanisms used by this application to persist your user's data. + | + | If you have multiple user tables or models you may configure multiple + | sources which represent each model / table. These sources may then + | be assigned to any extra authentication guards you have defined. + | + | Supported: "database", "eloquent" + | + */ + + 'providers' => [ + 'users' => [ + 'driver' => 'eloquent', + 'model' => App\User::class, + ], + + // 'users' => [ + // 'driver' => 'database', + // 'table' => 'users', + // ], + ], + + /* + |-------------------------------------------------------------------------- + | Resetting Passwords + |-------------------------------------------------------------------------- + | + | Here you may set the options for resetting passwords including the view + | that is your password reset e-mail. You may also set the name of the + | table that maintains all of the reset tokens for your application. + | + | You may specify multiple password reset configurations if you have more + | than one user table or model in the application and you want to have + | seperate password reset settings based on the specific user types. + | + | The expire time is the number of minutes that the reset token should be + | considered valid. This security feature keeps tokens short-lived so + | they have less time to be guessed. You may change this as needed. + | + */ + + 'passwords' => [ + 'users' => [ + 'provider' => 'users', + 'table' => 'password_resets', + 'expire' => 60, + ], + ], + +]; diff --git a/vendor/orchestra/testbench-core/laravel/config/broadcasting.php b/vendor/orchestra/testbench-core/laravel/config/broadcasting.php new file mode 100644 index 0000000..3bb217a --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/config/broadcasting.php @@ -0,0 +1,58 @@ + env('BROADCAST_DRIVER', 'null'), + + /* + |-------------------------------------------------------------------------- + | Broadcast Connections + |-------------------------------------------------------------------------- + | + | Here you may define all of the broadcast connections that will be used + | to broadcast events to other systems or over websockets. Samples of + | each available type of connection are provided inside this array. + | + */ + + 'connections' => [ + + 'pusher' => [ + 'driver' => 'pusher', + 'key' => env('PUSHER_APP_KEY'), + 'secret' => env('PUSHER_APP_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), + 'options' => [ + 'cluster' => env('PUSHER_APP_CLUSTER'), + 'encrypted' => true, + ], + ], + + 'redis' => [ + 'driver' => 'redis', + 'connection' => 'default', + ], + + 'log' => [ + 'driver' => 'log', + ], + + 'null' => [ + 'driver' => 'null', + ], + ], + +]; diff --git a/vendor/orchestra/testbench-core/laravel/config/cache.php b/vendor/orchestra/testbench-core/laravel/config/cache.php new file mode 100644 index 0000000..ef3093f --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/config/cache.php @@ -0,0 +1,96 @@ + env('CACHE_DRIVER', 'array'), + + /* + |-------------------------------------------------------------------------- + | Cache Stores + |-------------------------------------------------------------------------- + | + | Here you may define all of the cache "stores" for your application as + | well as their drivers. You may even define multiple stores for the + | same cache driver to group types of items stored in your caches. + | + */ + + 'stores' => [ + + 'apc' => [ + 'driver' => 'apc', + ], + + 'array' => [ + 'driver' => 'array', + ], + + 'database' => [ + 'driver' => 'database', + 'table' => 'cache', + 'connection' => null, + ], + + 'file' => [ + 'driver' => 'file', + 'path' => storage_path('framework/cache/data'), + ], + + 'memcached' => [ + 'driver' => 'memcached', + 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), + 'sasl' => [ + env('MEMCACHED_USERNAME'), + env('MEMCACHED_PASSWORD'), + ], + 'options' => [ + // Memcached::OPT_CONNECT_TIMEOUT => 2000, + ], + 'servers' => [ + [ + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), + 'weight' => 100, + ], + ], + ], + + 'redis' => [ + 'driver' => 'redis', + 'connection' => 'cache', + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Cache Key Prefix + |-------------------------------------------------------------------------- + | + | When utilizing a RAM based store such as APC or Memcached, there might + | be other applications utilizing the same cache. So, we'll specify a + | value to get prefixed to all our keys so we can avoid collisions. + | + */ + + 'prefix' => env( + 'CACHE_PREFIX', + Str::slug(env('APP_NAME', 'laravel'), '_').'_cache' + ), + +]; diff --git a/vendor/orchestra/testbench-core/laravel/config/database.php b/vendor/orchestra/testbench-core/laravel/config/database.php new file mode 100644 index 0000000..4288662 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/config/database.php @@ -0,0 +1,137 @@ + env('DB_CONNECTION', 'mysql'), + + /* + |-------------------------------------------------------------------------- + | Database Connections + |-------------------------------------------------------------------------- + | + | Here are each of the database connections setup for your application. + | Of course, examples of configuring each database platform that is + | supported by Laravel is shown below to make development simple. + | + | + | All database work in Laravel is done through the PHP PDO facilities + | so make sure you have the driver for your particular database of + | choice installed on your machine before you begin development. + | + */ + + 'connections' => [ + + 'testing' => [ + 'driver' => 'sqlite', + 'database' => ':memory:', + 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', false), + ], + + 'sqlite' => [ + 'driver' => 'sqlite', + 'database' => env('DB_DATABASE', database_path('database.sqlite')), + 'prefix' => '', + 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', false), + ], + + 'mysql' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + ], + + 'pgsql' => [ + 'driver' => 'pgsql', + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '5432'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', + 'prefix_indexes' => true, + 'schema' => 'public', + 'sslmode' => 'prefer', + ], + + 'sqlsrv' => [ + 'driver' => 'sqlsrv', + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', '1433'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', + 'prefix_indexes' => true, + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Migration Repository Table + |-------------------------------------------------------------------------- + | + | This table keeps track of all the migrations that have already run for + | your application. Using this information, we can determine which of + | the migrations on disk haven't actually been run in the database. + | + */ + + 'migrations' => 'migrations', + + /* + |-------------------------------------------------------------------------- + | Redis Databases + |-------------------------------------------------------------------------- + | + | Redis is an open source, fast, and advanced key-value store that also + | provides a richer body of commands than a typical key-value system + | such as APC or Memcached. Laravel makes it easy to dig right in. + | + */ + + 'redis' => [ + + 'client' => 'predis', + + 'default' => [ + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'password' => env('REDIS_PASSWORD', null), + 'port' => env('REDIS_PORT', 6379), + 'database' => env('REDIS_DB', 0), + ], + + 'cache' => [ + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'password' => env('REDIS_PASSWORD', null), + 'port' => env('REDIS_PORT', 6379), + 'database' => env('REDIS_CACHE_DB', 1), + ], + + ], + +]; diff --git a/vendor/orchestra/testbench-core/laravel/config/filesystems.php b/vendor/orchestra/testbench-core/laravel/config/filesystems.php new file mode 100644 index 0000000..1431465 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/config/filesystems.php @@ -0,0 +1,69 @@ + env('FILESYSTEM_DRIVER', 'local'), + + /* + |-------------------------------------------------------------------------- + | Default Cloud Filesystem Disk + |-------------------------------------------------------------------------- + | + | Many applications store files both locally and in the cloud. For this + | reason, you may specify a default "cloud" driver here. This driver + | will be bound as the Cloud disk implementation in the container. + | + */ + + 'cloud' => env('FILESYSTEM_CLOUD', 's3'), + + /* + |-------------------------------------------------------------------------- + | Filesystem Disks + |-------------------------------------------------------------------------- + | + | Here you may configure as many filesystem "disks" as you wish, and you + | may even configure multiple disks of the same driver. Defaults have + | been setup for each driver as an example of the required options. + | + */ + + 'disks' => [ + + 'local' => [ + 'driver' => 'local', + 'root' => storage_path('app'), + ], + + 'public' => [ + 'driver' => 'local', + 'root' => storage_path('app/public'), + 'url' => env('APP_URL').'/storage', + 'visibility' => 'public', + ], + + 's3' => [ + 'driver' => 's3', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION'), + 'bucket' => env('AWS_BUCKET'), + 'url' => env('AWS_URL'), + ], + + ], + +]; diff --git a/vendor/orchestra/testbench-core/laravel/config/hashing.php b/vendor/orchestra/testbench-core/laravel/config/hashing.php new file mode 100644 index 0000000..b1d5f1c --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/config/hashing.php @@ -0,0 +1,52 @@ + 'bcrypt', + + /* + |-------------------------------------------------------------------------- + | Bcrypt Options + |-------------------------------------------------------------------------- + | + | Here you may specify the configuration options that should be used when + | passwords are hashed using the Bcrypt algorithm. This will allow you + | to control the amount of time it takes to hash the given password. + | + */ + + 'bcrypt' => [ + 'rounds' => env('BCRYPT_ROUNDS', 4), + ], + + /* + |-------------------------------------------------------------------------- + | Argon Options + |-------------------------------------------------------------------------- + | + | Here you may specify the configuration options that should be used when + | passwords are hashed using the Argon algorithm. These will allow you + | to control the amount of time it takes to hash the given password. + | + */ + + 'argon' => [ + 'memory' => 1024, + 'threads' => 2, + 'time' => 2, + ], + +]; diff --git a/vendor/orchestra/testbench-core/laravel/config/logging.php b/vendor/orchestra/testbench-core/laravel/config/logging.php new file mode 100644 index 0000000..506f2f3 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/config/logging.php @@ -0,0 +1,92 @@ + env('LOG_CHANNEL', 'stack'), + + /* + |-------------------------------------------------------------------------- + | Log Channels + |-------------------------------------------------------------------------- + | + | Here you may configure the log channels for your application. Out of + | the box, Laravel uses the Monolog PHP logging library. This gives + | you a variety of powerful log handlers / formatters to utilize. + | + | Available Drivers: "single", "daily", "slack", "syslog", + | "errorlog", "monolog", + | "custom", "stack" + | + */ + + 'channels' => [ + 'stack' => [ + 'driver' => 'stack', + 'channels' => ['daily'], + ], + + 'single' => [ + 'driver' => 'single', + 'path' => storage_path('logs/laravel.log'), + 'level' => 'debug', + ], + + 'daily' => [ + 'driver' => 'daily', + 'path' => storage_path('logs/laravel.log'), + 'level' => 'debug', + 'days' => 14, + ], + + 'slack' => [ + 'driver' => 'slack', + 'url' => env('LOG_SLACK_WEBHOOK_URL'), + 'username' => 'Laravel Log', + 'emoji' => ':boom:', + 'level' => 'critical', + ], + + 'papertrail' => [ + 'driver' => 'monolog', + 'level' => 'debug', + 'handler' => SyslogUdpHandler::class, + 'handler_with' => [ + 'host' => env('PAPERTRAIL_URL'), + 'port' => env('PAPERTRAIL_PORT'), + ], + ], + + 'stderr' => [ + 'driver' => 'monolog', + 'handler' => StreamHandler::class, + 'with' => [ + 'stream' => 'php://stderr', + ], + ], + + 'syslog' => [ + 'driver' => 'syslog', + 'level' => 'debug', + ], + + 'errorlog' => [ + 'driver' => 'errorlog', + 'level' => 'debug', + ], + ], + +]; diff --git a/vendor/orchestra/testbench-core/laravel/config/mail.php b/vendor/orchestra/testbench-core/laravel/config/mail.php new file mode 100644 index 0000000..f400645 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/config/mail.php @@ -0,0 +1,136 @@ + env('MAIL_DRIVER', 'smtp'), + + /* + |-------------------------------------------------------------------------- + | SMTP Host Address + |-------------------------------------------------------------------------- + | + | Here you may provide the host address of the SMTP server used by your + | applications. A default option is provided that is compatible with + | the Mailgun mail service which will provide reliable deliveries. + | + */ + + 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), + + /* + |-------------------------------------------------------------------------- + | SMTP Host Port + |-------------------------------------------------------------------------- + | + | This is the SMTP port used by your application to deliver e-mails to + | users of the application. Like the host we have set this value to + | stay compatible with the Mailgun e-mail application by default. + | + */ + + 'port' => env('MAIL_PORT', 587), + + /* + |-------------------------------------------------------------------------- + | Global "From" Address + |-------------------------------------------------------------------------- + | + | You may wish for all e-mails sent by your application to be sent from + | the same address. Here, you may specify a name and address that is + | used globally for all e-mails that are sent by your application. + | + */ + + 'from' => [ + 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), + 'name' => env('MAIL_FROM_NAME', 'Example'), + ], + + /* + |-------------------------------------------------------------------------- + | E-Mail Encryption Protocol + |-------------------------------------------------------------------------- + | + | Here you may specify the encryption protocol that should be used when + | the application send e-mail messages. A sensible default using the + | transport layer security protocol should provide great security. + | + */ + + 'encryption' => env('MAIL_ENCRYPTION', 'tls'), + + /* + |-------------------------------------------------------------------------- + | SMTP Server Username + |-------------------------------------------------------------------------- + | + | If your SMTP server requires a username for authentication, you should + | set it here. This will get used to authenticate with your server on + | connection. You may also set the "password" value below this one. + | + */ + + 'username' => env('MAIL_USERNAME'), + + 'password' => env('MAIL_PASSWORD'), + + /* + |-------------------------------------------------------------------------- + | Sendmail System Path + |-------------------------------------------------------------------------- + | + | When using the "sendmail" driver to send e-mails, we will need to know + | the path to where Sendmail lives on this server. A default path has + | been provided here, which will work well on most of your systems. + | + */ + + 'sendmail' => '/usr/sbin/sendmail -bs', + + /* + |-------------------------------------------------------------------------- + | Markdown Mail Settings + |-------------------------------------------------------------------------- + | + | If you are using Markdown based email rendering, you may configure your + | theme and component paths here, allowing you to customize the design + | of the emails. Or, you may simply stick with the Laravel defaults! + | + */ + + 'markdown' => [ + 'theme' => 'default', + + 'paths' => [ + resource_path('views/vendor/mail'), + ], + ], + + /* + |-------------------------------------------------------------------------- + | Log Channel + |-------------------------------------------------------------------------- + | + | If you are using the "log" driver, you may specify the logging channel + | if you prefer to keep mail messages separate from other log entries + | for simpler reading. Otherwise, the default channel will be used. + | + */ + + 'log_channel' => env('MAIL_LOG_CHANNEL'), + +]; diff --git a/vendor/orchestra/testbench-core/laravel/config/queue.php b/vendor/orchestra/testbench-core/laravel/config/queue.php new file mode 100644 index 0000000..c1430b4 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/config/queue.php @@ -0,0 +1,86 @@ + env('QUEUE_CONNECTION', 'sync'), + + /* + |-------------------------------------------------------------------------- + | Queue Connections + |-------------------------------------------------------------------------- + | + | Here you may configure the connection information for each server that + | is used by your application. A default configuration has been added + | for each back-end shipped with Laravel. You are free to add more. + | + | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" + | + */ + + 'connections' => [ + + 'sync' => [ + 'driver' => 'sync', + ], + + 'database' => [ + 'driver' => 'database', + 'table' => 'jobs', + 'queue' => 'default', + 'retry_after' => 90, + ], + + 'beanstalkd' => [ + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', + 'retry_after' => 90, + ], + + 'sqs' => [ + 'driver' => 'sqs', + 'key' => env('SQS_KEY', 'your-public-key'), + 'secret' => env('SQS_SECRET', 'your-secret-key'), + 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), + 'queue' => env('SQS_QUEUE', 'your-queue-name'), + 'region' => env('SQS_REGION', 'us-east-1'), + ], + + 'redis' => [ + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => env('REDIS_QUEUE', 'default'), + 'retry_after' => 90, + 'block_for' => null, + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Failed Queue Jobs + |-------------------------------------------------------------------------- + | + | These options configure the behavior of failed queue job logging so you + | can control which database and table are used to store the jobs that + | have failed. You may change them to any database / table you wish. + | + */ + + 'failed' => [ + 'database' => env('DB_CONNECTION', 'mysql'), + 'table' => 'failed_jobs', + ], + +]; diff --git a/vendor/orchestra/testbench-core/laravel/config/services.php b/vendor/orchestra/testbench-core/laravel/config/services.php new file mode 100644 index 0000000..4ca5e92 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/config/services.php @@ -0,0 +1,43 @@ + [ + 'domain' => env('MAILGUN_DOMAIN'), + 'secret' => env('MAILGUN_SECRET'), + 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), + ], + + 'ses' => [ + 'key' => env('SES_KEY'), + 'secret' => env('SES_SECRET'), + 'region' => env('SES_REGION', 'us-east-1'), + ], + + 'sparkpost' => [ + 'secret' => env('SPARKPOST_SECRET'), + ], + + 'stripe' => [ + 'model' => 'App\User', + 'key' => env('STRIPE_KEY'), + 'secret' => env('STRIPE_SECRET'), + 'webhook' => [ + 'secret' => env('STRIPE_WEBHOOK_SECRET'), + 'tolerance' => env('STRIPE_WEBHOOK_TOLERANCE', 300), + ], + ], + +]; diff --git a/vendor/orchestra/testbench-core/laravel/config/session.php b/vendor/orchestra/testbench-core/laravel/config/session.php new file mode 100644 index 0000000..f317a19 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/config/session.php @@ -0,0 +1,199 @@ + env('SESSION_DRIVER', 'array'), + + /* + |-------------------------------------------------------------------------- + | Session Lifetime + |-------------------------------------------------------------------------- + | + | Here you may specify the number of minutes that you wish the session + | to be allowed to remain idle before it expires. If you want them + | to immediately expire on the browser closing, set that option. + | + */ + + 'lifetime' => env('SESSION_LIFETIME', 120), + + // 'expire_on_close' => false, + + /* + |-------------------------------------------------------------------------- + | Session Encryption + |-------------------------------------------------------------------------- + | + | This option allows you to easily specify that all of your session data + | should be encrypted before it is stored. All encryption will be run + | automatically by Laravel and you can use the Session like normal. + | + */ + + 'encrypt' => false, + + /* + |-------------------------------------------------------------------------- + | Session File Location + |-------------------------------------------------------------------------- + | + | When using the native session driver, we need a location where session + | files may be stored. A default has been set for you but a different + | location may be specified. This is only needed for file sessions. + | + */ + + 'files' => storage_path('framework/sessions'), + + /* + |-------------------------------------------------------------------------- + | Session Database Connection + |-------------------------------------------------------------------------- + | + | When using the "database" or "redis" session drivers, you may specify a + | connection that should be used to manage these sessions. This should + | correspond to a connection in your database configuration options. + | + */ + + 'connection' => env('SESSION_CONNECTION', null), + + /* + |-------------------------------------------------------------------------- + | Session Database Table + |-------------------------------------------------------------------------- + | + | When using the "database" session driver, you may specify the table we + | should use to manage the sessions. Of course, a sensible default is + | provided for you; however, you are free to change this as needed. + | + */ + + 'table' => 'sessions', + + /* + |-------------------------------------------------------------------------- + | Session Cache Store + |-------------------------------------------------------------------------- + | + | When using the "apc" or "memcached" session drivers, you may specify a + | cache store that should be used for these sessions. This value must + | correspond with one of the application's configured cache stores. + | + */ + + 'store' => env('SESSION_STORE', null), + + /* + |-------------------------------------------------------------------------- + | Session Sweeping Lottery + |-------------------------------------------------------------------------- + | + | Some session drivers must manually sweep their storage location to get + | rid of old sessions from storage. Here are the chances that it will + | happen on a given request. By default, the odds are 2 out of 100. + | + */ + + 'lottery' => [2, 100], + + /* + |-------------------------------------------------------------------------- + | Session Cookie Name + |-------------------------------------------------------------------------- + | + | Here you may change the name of the cookie used to identify a session + | instance by ID. The name specified here will get used every time a + | new session cookie is created by the framework for every driver. + | + */ + + 'cookie' => env( + 'SESSION_COOKIE', + Str::slug(env('APP_NAME', 'laravel'), '_').'_session' + ), + + /* + |-------------------------------------------------------------------------- + | Session Cookie Path + |-------------------------------------------------------------------------- + | + | The session cookie path determines the path for which the cookie will + | be regarded as available. Typically, this will be the root path of + | your application but you are free to change this when necessary. + | + */ + + 'path' => '/', + + /* + |-------------------------------------------------------------------------- + | Session Cookie Domain + |-------------------------------------------------------------------------- + | + | Here you may change the domain of the cookie used to identify a session + | in your application. This will determine which domains the cookie is + | available to in your application. A sensible default has been set. + | + */ + + 'domain' => env('SESSION_DOMAIN', null), + + /* + |-------------------------------------------------------------------------- + | HTTPS Only Cookies + |-------------------------------------------------------------------------- + | + | By setting this option to true, session cookies will only be sent back + | to the server if the browser has a HTTPS connection. This will keep + | the cookie from being sent to you if it can not be done securely. + | + */ + + 'secure' => env('SESSION_SECURE_COOKIE', false), + + /* + |-------------------------------------------------------------------------- + | HTTP Access Only + |-------------------------------------------------------------------------- + | + | Setting this value to true will prevent JavaScript from accessing the + | value of the cookie and the cookie will only be accessible through + | the HTTP protocol. You are free to modify this option if needed. + | + */ + + 'http_only' => true, + + /* + |-------------------------------------------------------------------------- + | Same-Site Cookies + |-------------------------------------------------------------------------- + | + | This option determines how your cookies behave when cross-site requests + | take place, and can be used to mitigate CSRF attacks. By default, we + | do not enable this as other CSRF protection services are in place. + | + | Supported: "lax", "strict" + | + */ + + 'same_site' => null, + +]; diff --git a/vendor/orchestra/testbench-core/laravel/config/view.php b/vendor/orchestra/testbench-core/laravel/config/view.php new file mode 100644 index 0000000..22b8a18 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/config/view.php @@ -0,0 +1,36 @@ + [ + resource_path('views'), + ], + + /* + |-------------------------------------------------------------------------- + | Compiled View Path + |-------------------------------------------------------------------------- + | + | This option determines where all the compiled Blade templates will be + | stored for your application. Typically, this is within the storage + | directory. However, as usual, you are free to change this value. + | + */ + + 'compiled' => env( + 'VIEW_COMPILED_PATH', + realpath(storage_path('framework/views')) + ), + +]; diff --git a/vendor/orchestra/testbench-core/laravel/database/.gitignore b/vendor/orchestra/testbench-core/laravel/database/.gitignore new file mode 100644 index 0000000..9b1dffd --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/database/.gitignore @@ -0,0 +1 @@ +*.sqlite diff --git a/vendor/orchestra/testbench-core/laravel/database/database.sqlite.example b/vendor/orchestra/testbench-core/laravel/database/database.sqlite.example new file mode 100644 index 0000000..e69de29 diff --git a/vendor/orchestra/testbench-core/laravel/database/factories/.gitkeep b/vendor/orchestra/testbench-core/laravel/database/factories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/orchestra/testbench-core/laravel/database/migrations/.gitkeep b/vendor/orchestra/testbench-core/laravel/database/migrations/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/orchestra/testbench-core/laravel/migrations/2014_10_12_000000_create_users_table.php b/vendor/orchestra/testbench-core/laravel/migrations/2014_10_12_000000_create_users_table.php new file mode 100644 index 0000000..670b008 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/migrations/2014_10_12_000000_create_users_table.php @@ -0,0 +1,36 @@ +increments('id'); + $table->string('name'); + $table->string('email')->unique(); + $table->timestamp('email_verified_at')->nullable(); + $table->string('password'); + $table->rememberToken(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('users'); + } +} diff --git a/vendor/orchestra/testbench-core/laravel/migrations/2014_10_12_100000_create_password_resets_table.php b/vendor/orchestra/testbench-core/laravel/migrations/2014_10_12_100000_create_password_resets_table.php new file mode 100644 index 0000000..76842cb --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/migrations/2014_10_12_100000_create_password_resets_table.php @@ -0,0 +1,32 @@ +string('email')->index(); + $table->string('token'); + $table->timestamp('created_at')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('password_resets'); + } +} diff --git a/vendor/orchestra/testbench-core/laravel/public/.gitignore b/vendor/orchestra/testbench-core/laravel/public/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/vendor/orchestra/testbench-core/laravel/resources/lang/en/auth.php b/vendor/orchestra/testbench-core/laravel/resources/lang/en/auth.php new file mode 100644 index 0000000..e5506df --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/resources/lang/en/auth.php @@ -0,0 +1,19 @@ + 'These credentials do not match our records.', + 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', + +]; diff --git a/vendor/orchestra/testbench-core/laravel/resources/lang/en/pagination.php b/vendor/orchestra/testbench-core/laravel/resources/lang/en/pagination.php new file mode 100644 index 0000000..d481411 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/resources/lang/en/pagination.php @@ -0,0 +1,19 @@ + '« Previous', + 'next' => 'Next »', + +]; diff --git a/vendor/orchestra/testbench-core/laravel/resources/lang/en/passwords.php b/vendor/orchestra/testbench-core/laravel/resources/lang/en/passwords.php new file mode 100644 index 0000000..e5544d2 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/resources/lang/en/passwords.php @@ -0,0 +1,22 @@ + 'Passwords must be at least six characters and match the confirmation.', + 'reset' => 'Your password has been reset!', + 'sent' => 'We have e-mailed your password reset link!', + 'token' => 'This password reset token is invalid.', + 'user' => "We can't find a user with that e-mail address.", + +]; diff --git a/vendor/orchestra/testbench-core/laravel/resources/lang/en/validation.php b/vendor/orchestra/testbench-core/laravel/resources/lang/en/validation.php new file mode 100644 index 0000000..8ab929c --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/resources/lang/en/validation.php @@ -0,0 +1,149 @@ + 'The :attribute must be accepted.', + 'active_url' => 'The :attribute is not a valid URL.', + 'after' => 'The :attribute must be a date after :date.', + 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', + 'alpha' => 'The :attribute may only contain letters.', + 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.', + 'alpha_num' => 'The :attribute may only contain letters and numbers.', + 'array' => 'The :attribute must be an array.', + 'before' => 'The :attribute must be a date before :date.', + 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', + 'between' => [ + 'numeric' => 'The :attribute must be between :min and :max.', + 'file' => 'The :attribute must be between :min and :max kilobytes.', + 'string' => 'The :attribute must be between :min and :max characters.', + 'array' => 'The :attribute must have between :min and :max items.', + ], + 'boolean' => 'The :attribute field must be true or false.', + 'confirmed' => 'The :attribute confirmation does not match.', + 'date' => 'The :attribute is not a valid date.', + 'date_equals' => 'The :attribute must be a date equal to :date.', + 'date_format' => 'The :attribute does not match the format :format.', + 'different' => 'The :attribute and :other must be different.', + 'digits' => 'The :attribute must be :digits digits.', + 'digits_between' => 'The :attribute must be between :min and :max digits.', + 'dimensions' => 'The :attribute has invalid image dimensions.', + 'distinct' => 'The :attribute field has a duplicate value.', + 'email' => 'The :attribute must be a valid email address.', + 'exists' => 'The selected :attribute is invalid.', + 'file' => 'The :attribute must be a file.', + 'filled' => 'The :attribute field must have a value.', + 'gt' => [ + 'numeric' => 'The :attribute must be greater than :value.', + 'file' => 'The :attribute must be greater than :value kilobytes.', + 'string' => 'The :attribute must be greater than :value characters.', + 'array' => 'The :attribute must have more than :value items.', + ], + 'gte' => [ + 'numeric' => 'The :attribute must be greater than or equal :value.', + 'file' => 'The :attribute must be greater than or equal :value kilobytes.', + 'string' => 'The :attribute must be greater than or equal :value characters.', + 'array' => 'The :attribute must have :value items or more.', + ], + 'image' => 'The :attribute must be an image.', + 'in' => 'The selected :attribute is invalid.', + 'in_array' => 'The :attribute field does not exist in :other.', + 'integer' => 'The :attribute must be an integer.', + 'ip' => 'The :attribute must be a valid IP address.', + 'ipv4' => 'The :attribute must be a valid IPv4 address.', + 'ipv6' => 'The :attribute must be a valid IPv6 address.', + 'json' => 'The :attribute must be a valid JSON string.', + 'lt' => [ + 'numeric' => 'The :attribute must be less than :value.', + 'file' => 'The :attribute must be less than :value kilobytes.', + 'string' => 'The :attribute must be less than :value characters.', + 'array' => 'The :attribute must have less than :value items.', + ], + 'lte' => [ + 'numeric' => 'The :attribute must be less than or equal :value.', + 'file' => 'The :attribute must be less than or equal :value kilobytes.', + 'string' => 'The :attribute must be less than or equal :value characters.', + 'array' => 'The :attribute must not have more than :value items.', + ], + 'max' => [ + 'numeric' => 'The :attribute may not be greater than :max.', + 'file' => 'The :attribute may not be greater than :max kilobytes.', + 'string' => 'The :attribute may not be greater than :max characters.', + 'array' => 'The :attribute may not have more than :max items.', + ], + 'mimes' => 'The :attribute must be a file of type: :values.', + 'mimetypes' => 'The :attribute must be a file of type: :values.', + 'min' => [ + 'numeric' => 'The :attribute must be at least :min.', + 'file' => 'The :attribute must be at least :min kilobytes.', + 'string' => 'The :attribute must be at least :min characters.', + 'array' => 'The :attribute must have at least :min items.', + ], + 'not_in' => 'The selected :attribute is invalid.', + 'not_regex' => 'The :attribute format is invalid.', + 'numeric' => 'The :attribute must be a number.', + 'present' => 'The :attribute field must be present.', + 'regex' => 'The :attribute format is invalid.', + 'required' => 'The :attribute field is required.', + 'required_if' => 'The :attribute field is required when :other is :value.', + 'required_unless' => 'The :attribute field is required unless :other is in :values.', + 'required_with' => 'The :attribute field is required when :values is present.', + 'required_with_all' => 'The :attribute field is required when :values are present.', + 'required_without' => 'The :attribute field is required when :values is not present.', + 'required_without_all' => 'The :attribute field is required when none of :values are present.', + 'same' => 'The :attribute and :other must match.', + 'size' => [ + 'numeric' => 'The :attribute must be :size.', + 'file' => 'The :attribute must be :size kilobytes.', + 'string' => 'The :attribute must be :size characters.', + 'array' => 'The :attribute must contain :size items.', + ], + 'starts_with' => 'The :attribute must start with one of the following: :values', + 'string' => 'The :attribute must be a string.', + 'timezone' => 'The :attribute must be a valid zone.', + 'unique' => 'The :attribute has already been taken.', + 'uploaded' => 'The :attribute failed to upload.', + 'url' => 'The :attribute format is invalid.', + 'uuid' => 'The :attribute must be a valid UUID.', + + /* + |-------------------------------------------------------------------------- + | Custom Validation Language Lines + |-------------------------------------------------------------------------- + | + | Here you may specify custom validation messages for attributes using the + | convention "attribute.rule" to name the lines. This makes it quick to + | specify a specific custom language line for a given attribute rule. + | + */ + + 'custom' => [ + 'attribute-name' => [ + 'rule-name' => 'custom-message', + ], + ], + + /* + |-------------------------------------------------------------------------- + | Custom Validation Attributes + |-------------------------------------------------------------------------- + | + | The following language lines are used to swap our attribute placeholder + | with something more reader friendly such as "E-Mail Address" instead + | of "email". This simply helps us make our message more expressive. + | + */ + + 'attributes' => [], + +]; diff --git a/vendor/orchestra/testbench-core/laravel/resources/views/errors/503.blade.php b/vendor/orchestra/testbench-core/laravel/resources/views/errors/503.blade.php new file mode 100644 index 0000000..336936b --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/resources/views/errors/503.blade.php @@ -0,0 +1,43 @@ + + + Be right back. + + + + + + +

+
+
Be right back.
+
+
+ + diff --git a/vendor/orchestra/testbench-core/laravel/resources/views/welcome.blade.php b/vendor/orchestra/testbench-core/laravel/resources/views/welcome.blade.php new file mode 100644 index 0000000..284db8e --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/resources/views/welcome.blade.php @@ -0,0 +1,39 @@ + + + + + + + +
+
+
Laravel 5
+
+
+ + diff --git a/vendor/orchestra/testbench-core/laravel/storage/app/.gitignore b/vendor/orchestra/testbench-core/laravel/storage/app/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/vendor/orchestra/testbench-core/laravel/storage/framework/.gitignore b/vendor/orchestra/testbench-core/laravel/storage/framework/.gitignore new file mode 100644 index 0000000..cd61cda --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/storage/framework/.gitignore @@ -0,0 +1,2 @@ +down +schedule-* diff --git a/vendor/orchestra/testbench-core/laravel/storage/framework/cache/.gitignore b/vendor/orchestra/testbench-core/laravel/storage/framework/cache/.gitignore new file mode 100644 index 0000000..01e4a6c --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/storage/framework/cache/.gitignore @@ -0,0 +1,3 @@ +* +!data/ +!.gitignore diff --git a/vendor/orchestra/testbench-core/laravel/storage/framework/data/.gitignore b/vendor/orchestra/testbench-core/laravel/storage/framework/data/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/storage/framework/data/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/vendor/orchestra/testbench-core/laravel/storage/framework/sessions/.gitignore b/vendor/orchestra/testbench-core/laravel/storage/framework/sessions/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/storage/framework/sessions/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/vendor/orchestra/testbench-core/laravel/storage/framework/testing/.gitignore b/vendor/orchestra/testbench-core/laravel/storage/framework/testing/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/storage/framework/testing/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/vendor/orchestra/testbench-core/laravel/storage/framework/views/.gitignore b/vendor/orchestra/testbench-core/laravel/storage/framework/views/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/storage/framework/views/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/vendor/orchestra/testbench-core/laravel/storage/logs/.gitignore b/vendor/orchestra/testbench-core/laravel/storage/logs/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/storage/logs/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/vendor/orchestra/testbench-core/laravel/vendor/.gitignore b/vendor/orchestra/testbench-core/laravel/vendor/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/vendor/orchestra/testbench-core/laravel/vendor/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/vendor/orchestra/testbench-core/src/Bootstrap/LoadConfiguration.php b/vendor/orchestra/testbench-core/src/Bootstrap/LoadConfiguration.php new file mode 100644 index 0000000..06f4b35 --- /dev/null +++ b/vendor/orchestra/testbench-core/src/Bootstrap/LoadConfiguration.php @@ -0,0 +1,64 @@ +instance('config', $config = new Repository($items)); + + $this->loadConfigurationFiles($app, $config); + + mb_internal_encoding('UTF-8'); + } + + /** + * Load the configuration items from all of the files. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param \Illuminate\Contracts\Config\Repository $config + * + * @return void + */ + protected function loadConfigurationFiles(Application $app, RepositoryContract $config): void + { + foreach ($this->getConfigurationFiles($app) as $key => $path) { + $config->set($key, require $path); + } + } + + /** + * Get all of the configuration files for the application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * + * @return array + */ + protected function getConfigurationFiles(Application $app): array + { + $files = []; + + $path = realpath(__DIR__.'/../../laravel/config'); + + foreach (Finder::create()->files()->name('*.php')->in($path) as $file) { + $files[basename($file->getRealPath(), '.php')] = $file->getRealPath(); + } + + return $files; + } +} diff --git a/vendor/orchestra/testbench-core/src/Concerns/CreatesApplication.php b/vendor/orchestra/testbench-core/src/Concerns/CreatesApplication.php new file mode 100644 index 0000000..5e4af5b --- /dev/null +++ b/vendor/orchestra/testbench-core/src/Concerns/CreatesApplication.php @@ -0,0 +1,333 @@ +overrideApplicationBindings($app) as $original => $replacement) { + $app->bind($original, $replacement); + } + } + + /** + * Get application aliases. + * + * @param \Illuminate\Foundation\Application $app + * + * @return array + */ + protected function getApplicationAliases($app) + { + return $app['config']['app.aliases']; + } + + /** + * Override application aliases. + * + * @param \Illuminate\Foundation\Application $app + * + * @return array + */ + protected function overrideApplicationAliases($app) + { + return []; + } + + /** + * Resolve application aliases. + * + * @param \Illuminate\Foundation\Application $app + * + * @return array + */ + final protected function resolveApplicationAliases($app): array + { + $aliases = new Collection($this->getApplicationAliases($app)); + $overrides = $this->overrideApplicationAliases($app); + + if (! empty($overrides)) { + $aliases->transform(function ($alias, $name) use ($overrides) { + return $overrides[$name] ?? $alias; + }); + } + + return $aliases->merge($this->getPackageAliases($app))->all(); + } + + /** + * Get package aliases. + * + * @param \Illuminate\Foundation\Application $app + * + * @return array + */ + protected function getPackageAliases($app) + { + return []; + } + + /** + * Get package bootstrapper. + * + * @param \Illuminate\Foundation\Application $app + * + * @return array + */ + protected function getPackageBootstrappers($app) + { + return []; + } + + /** + * Get application providers. + * + * @param \Illuminate\Foundation\Application $app + * + * @return array + */ + protected function getApplicationProviders($app) + { + return $app['config']['app.providers']; + } + + /** + * Override application aliases. + * + * @param \Illuminate\Foundation\Application $app + * + * @return array + */ + protected function overrideApplicationProviders($app) + { + return []; + } + + /** + * Resolve application aliases. + * + * @param \Illuminate\Foundation\Application $app + * + * @return array + */ + final protected function resolveApplicationProviders($app): array + { + $providers = new Collection($this->getApplicationProviders($app)); + $overrides = $this->overrideApplicationProviders($app); + + if (! empty($overrides)) { + $providers->transform(function ($provider) use ($overrides) { + return $overrides[$provider] ?? $provider; + }); + } + + return $providers->merge($this->getPackageProviders($app))->all(); + } + + /** + * Get package providers. + * + * @param \Illuminate\Foundation\Application $app + * + * @return array + */ + protected function getPackageProviders($app) + { + return []; + } + + /** + * Get base path. + * + * @return string + */ + protected function getBasePath() + { + return __DIR__.'/../../laravel'; + } + + /** + * Creates the application. + * + * Needs to be implemented by subclasses. + * + * @return \Illuminate\Foundation\Application + */ + public function createApplication() + { + $app = $this->resolveApplication(); + + $this->resolveApplicationBindings($app); + $this->resolveApplicationExceptionHandler($app); + $this->resolveApplicationCore($app); + $this->resolveApplicationConfiguration($app); + $this->resolveApplicationHttpKernel($app); + $this->resolveApplicationConsoleKernel($app); + $this->resolveApplicationBootstrappers($app); + + return $app; + } + + /** + * Resolve application implementation. + * + * @return \Illuminate\Foundation\Application + */ + protected function resolveApplication() + { + return tap(new Application($this->getBasePath()), function ($app) { + $app->bind( + 'Illuminate\Foundation\Bootstrap\LoadConfiguration', + 'Orchestra\Testbench\Bootstrap\LoadConfiguration' + ); + }); + } + + /** + * Resolve application core configuration implementation. + * + * @param \Illuminate\Foundation\Application $app + * + * @return void + */ + protected function resolveApplicationConfiguration($app) + { + $app->make('Illuminate\Foundation\Bootstrap\LoadConfiguration')->bootstrap($app); + + tap($this->getApplicationTimezone($app), function ($timezone) { + ! is_null($timezone) && date_default_timezone_set($timezone); + }); + + $app['config']['app.aliases'] = $this->resolveApplicationAliases($app); + $app['config']['app.providers'] = $this->resolveApplicationProviders($app); + } + + /** + * Resolve application core implementation. + * + * @param \Illuminate\Foundation\Application $app + * + * @return void + */ + protected function resolveApplicationCore($app) + { + Facade::clearResolvedInstances(); + Facade::setFacadeApplication($app); + + $app->detectEnvironment(function () { + return 'testing'; + }); + } + + /** + * Resolve application Console Kernel implementation. + * + * @param \Illuminate\Foundation\Application $app + * + * @return void + */ + protected function resolveApplicationConsoleKernel($app) + { + $app->singleton('Illuminate\Contracts\Console\Kernel', 'Orchestra\Testbench\Console\Kernel'); + } + + /** + * Resolve application HTTP Kernel implementation. + * + * @param \Illuminate\Foundation\Application $app + * + * @return void + */ + protected function resolveApplicationHttpKernel($app) + { + $app->singleton('Illuminate\Contracts\Http\Kernel', 'Orchestra\Testbench\Http\Kernel'); + } + + /** + * Resolve application HTTP exception handler. + * + * @param \Illuminate\Foundation\Application $app + * + * @return void + */ + protected function resolveApplicationExceptionHandler($app) + { + $app->singleton('Illuminate\Contracts\Debug\ExceptionHandler', 'Orchestra\Testbench\Exceptions\Handler'); + } + + /** + * Resolve application bootstrapper. + * + * @param \Illuminate\Foundation\Application $app + * + * @return void + */ + protected function resolveApplicationBootstrappers($app) + { + $app->make('Illuminate\Foundation\Bootstrap\HandleExceptions')->bootstrap($app); + $app->make('Illuminate\Foundation\Bootstrap\RegisterFacades')->bootstrap($app); + $app->make('Illuminate\Foundation\Bootstrap\SetRequestForConsole')->bootstrap($app); + $app->make('Illuminate\Foundation\Bootstrap\RegisterProviders')->bootstrap($app); + + $this->getEnvironmentSetUp($app); + + $app->make('Illuminate\Foundation\Bootstrap\BootProviders')->bootstrap($app); + + foreach ($this->getPackageBootstrappers($app) as $bootstrap) { + $app->make($bootstrap)->bootstrap($app); + } + + $app->make('Illuminate\Contracts\Console\Kernel')->bootstrap(); + + $app['router']->getRoutes()->refreshNameLookups(); + + $app->resolving('url', function ($url, $app) { + $app['router']->getRoutes()->refreshNameLookups(); + }); + } + + /** + * Define environment setup. + * + * @param \Illuminate\Foundation\Application $app + * + * @return void + */ + abstract protected function getEnvironmentSetUp($app); +} diff --git a/vendor/orchestra/testbench-core/src/Concerns/Testing.php b/vendor/orchestra/testbench-core/src/Concerns/Testing.php new file mode 100644 index 0000000..a6ff726 --- /dev/null +++ b/vendor/orchestra/testbench-core/src/Concerns/Testing.php @@ -0,0 +1,193 @@ +app) { + $this->refreshApplication(); + } + + $this->setUpTraits(); + + foreach ($this->afterApplicationCreatedCallbacks as $callback) { + call_user_func($callback); + } + + Model::setEventDispatcher($this->app['events']); + + $this->setUpHasRun = true; + } + + /** + * Clean up the testing environment before the next test. + * + * @return void + */ + final protected function tearDownTheTestEnvironment(): void + { + if ($this->app) { + foreach ($this->beforeApplicationDestroyedCallbacks as $callback) { + call_user_func($callback); + } + + $this->app->flush(); + + $this->app = null; + } + + $this->setUpHasRun = false; + + if (property_exists($this, 'serverVariables')) { + $this->serverVariables = []; + } + + if (property_exists($this, 'defaultHeaders')) { + $this->defaultHeaders = []; + } + + if (class_exists('Mockery')) { + if ($container = Mockery::getContainer()) { + $this->addToAssertionCount($container->mockery_getExpectationCount()); + } + + Mockery::close(); + } + + Carbon::setTestNow(); + + $this->afterApplicationCreatedCallbacks = []; + $this->beforeApplicationDestroyedCallbacks = []; + + Artisan::forgetBootstrappers(); + } + + /** + * Boot the testing helper traits. + * + * @param array $uses + * + * @return array + */ + final protected function setUpTheTestEnvironmentTraits(array $uses): array + { + if (isset($uses[RefreshDatabase::class])) { + $this->refreshDatabase(); + } + + if (isset($uses[DatabaseMigrations::class])) { + $this->runDatabaseMigrations(); + } + + if (isset($uses[DatabaseTransactions::class])) { + $this->beginDatabaseTransaction(); + } + + if (isset($uses[WithoutMiddleware::class])) { + $this->disableMiddlewareForAllTests(); + } + + if (isset($uses[WithoutEvents::class])) { + $this->disableEventsForAllTests(); + } + + if (isset($uses[WithFaker::class])) { + $this->setUpFaker(); + } + + return $uses; + } + + /** + * Register a callback to be run after the application is created. + * + * @param callable $callback + * + * @return void + */ + protected function afterApplicationCreated(callable $callback): void + { + $this->afterApplicationCreatedCallbacks[] = $callback; + + if ($this->setUpHasRun) { + call_user_func($callback); + } + } + + /** + * Register a callback to be run before the application is destroyed. + * + * @param callable $callback + * + * @return void + */ + protected function beforeApplicationDestroyed(callable $callback): void + { + array_unshift($this->beforeApplicationDestroyedCallbacks, $callback); + } + + /** + * Boot the testing helper traits. + * + * @return array + */ + abstract protected function setUpTraits(); + + /** + * Refresh the application instance. + * + * @return void + */ + abstract protected function refreshApplication(); +} diff --git a/vendor/orchestra/testbench-core/src/Concerns/WithFactories.php b/vendor/orchestra/testbench-core/src/Concerns/WithFactories.php new file mode 100644 index 0000000..c6b785a --- /dev/null +++ b/vendor/orchestra/testbench-core/src/Concerns/WithFactories.php @@ -0,0 +1,35 @@ +loadFactoriesUsing($this->app, $path); + } + + /** + * Load model factories from path using Application. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param string $path + * + * @return $this + */ + protected function loadFactoriesUsing($app, string $path) + { + $app->make(ModelFactory::class)->load($path); + + return $this; + } +} diff --git a/vendor/orchestra/testbench-core/src/Concerns/WithLaravelMigrations.php b/vendor/orchestra/testbench-core/src/Concerns/WithLaravelMigrations.php new file mode 100644 index 0000000..186a524 --- /dev/null +++ b/vendor/orchestra/testbench-core/src/Concerns/WithLaravelMigrations.php @@ -0,0 +1,33 @@ + $database]; + + $options['--path'] = 'migrations'; + + $migrator = new MigrateProcessor($this, $options); + + $migrator->up(); + + $this->app[ConsoleKernel::class]->setArtisan(null); + + $this->beforeApplicationDestroyed(function () use ($migrator) { + $migrator->rollback(); + }); + } +} diff --git a/vendor/orchestra/testbench-core/src/Concerns/WithLoadMigrationsFrom.php b/vendor/orchestra/testbench-core/src/Concerns/WithLoadMigrationsFrom.php new file mode 100644 index 0000000..2b94889 --- /dev/null +++ b/vendor/orchestra/testbench-core/src/Concerns/WithLoadMigrationsFrom.php @@ -0,0 +1,33 @@ + $paths]; + + if (isset($options['--realpath']) && is_string($options['--realpath'])) { + $options['--path'] = [$options['--realpath']]; + } + + $options['--realpath'] = true; + + $migrator = new MigrateProcessor($this, $options); + $migrator->up(); + + $this->beforeApplicationDestroyed(function () use ($migrator) { + $migrator->rollback(); + }); + } +} diff --git a/vendor/orchestra/testbench-core/src/Console/Kernel.php b/vendor/orchestra/testbench-core/src/Console/Kernel.php new file mode 100644 index 0000000..522f7ae --- /dev/null +++ b/vendor/orchestra/testbench-core/src/Console/Kernel.php @@ -0,0 +1,36 @@ +testbench = $testbench; + $this->options = $options; + } + + /** + * Run migration. + * + * @return $this + */ + public function up() + { + $this->dispatch('migrate'); + + return $this; + } + + /** + * Rollback migration. + * + * @return $this + */ + public function rollback() + { + $this->dispatch('migrate:rollback'); + + return $this; + } + + /** + * Dispatch artisan command. + * + * @param string $command + * + * @return void + */ + protected function dispatch(string $command): void + { + $console = $this->testbench->artisan($command, $this->options); + + if ($console instanceof PendingCommand) { + $console->run(); + } + } +} diff --git a/vendor/orchestra/testbench-core/src/Exceptions/Handler.php b/vendor/orchestra/testbench-core/src/Exceptions/Handler.php new file mode 100644 index 0000000..7f2260f --- /dev/null +++ b/vendor/orchestra/testbench-core/src/Exceptions/Handler.php @@ -0,0 +1,55 @@ + [ + \Illuminate\Cookie\Middleware\EncryptCookies::class, + \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, + \Illuminate\Session\Middleware\StartSession::class, + // \Illuminate\Session\Middleware\AuthenticateSession::class, + \Illuminate\View\Middleware\ShareErrorsFromSession::class, + Middleware\VerifyCsrfToken::class, + \Illuminate\Routing\Middleware\SubstituteBindings::class, + ], + + 'api' => [ + 'throttle:60,1', + 'bindings', + ], + ]; + + /** + * The application's route middleware. + * + * These middleware may be assigned to groups or used individually. + * + * @var array + */ + protected $routeMiddleware = [ + 'auth' => Middleware\Authenticate::class, + 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, + 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, + 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, + 'can' => \Illuminate\Auth\Middleware\Authorize::class, + 'guest' => Middleware\RedirectIfAuthenticated::class, + 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, + 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, + 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, + ]; + + + /** + * The priority-sorted list of middleware. + * + * This forces the listed middleware to always be in the given order. + * + * @var array + */ + protected $middlewarePriority = [ + \Illuminate\Session\Middleware\StartSession::class, + \Illuminate\View\Middleware\ShareErrorsFromSession::class, + Middleware\Authenticate::class, + \Illuminate\Session\Middleware\AuthenticateSession::class, + \Illuminate\Routing\Middleware\SubstituteBindings::class, + \Illuminate\Auth\Middleware\Authorize::class, + ]; +} diff --git a/vendor/orchestra/testbench-core/src/Http/Middleware/Authenticate.php b/vendor/orchestra/testbench-core/src/Http/Middleware/Authenticate.php new file mode 100644 index 0000000..8ec9ab5 --- /dev/null +++ b/vendor/orchestra/testbench-core/src/Http/Middleware/Authenticate.php @@ -0,0 +1,22 @@ +expectsJson()) { + return route('login'); + } + } +} diff --git a/vendor/orchestra/testbench-core/src/Http/Middleware/RedirectIfAuthenticated.php b/vendor/orchestra/testbench-core/src/Http/Middleware/RedirectIfAuthenticated.php new file mode 100644 index 0000000..027f933 --- /dev/null +++ b/vendor/orchestra/testbench-core/src/Http/Middleware/RedirectIfAuthenticated.php @@ -0,0 +1,27 @@ +check()) { + return redirect('/home'); + } + + return $next($request); + } +} diff --git a/vendor/orchestra/testbench-core/src/Http/Middleware/TrimStrings.php b/vendor/orchestra/testbench-core/src/Http/Middleware/TrimStrings.php new file mode 100644 index 0000000..f588085 --- /dev/null +++ b/vendor/orchestra/testbench-core/src/Http/Middleware/TrimStrings.php @@ -0,0 +1,18 @@ +setUpTheTestEnvironment(); + } + + /** + * Clean up the testing environment before the next test. + * + * @return void + */ + protected function tearDown() + { + $this->tearDownTheTestEnvironment(); + } + + /** + * Boot the testing helper traits. + * + * @return array + */ + protected function setUpTraits() + { + $uses = array_flip(class_uses_recursive(static::class)); + + return $this->setUpTheTestEnvironmentTraits($uses); + } + + /** + * Refresh the application instance. + * + * @return void + */ + protected function refreshApplication() + { + $this->app = $this->createApplication(); + } + + /** + * Define environment setup. + * + * @param \Illuminate\Foundation\Application $app + * + * @return void + */ + protected function getEnvironmentSetUp($app) + { + // Define your environment setup. + } +} diff --git a/vendor/orchestra/testbench-core/src/Traits/CreatesApplication.php b/vendor/orchestra/testbench-core/src/Traits/CreatesApplication.php new file mode 100644 index 0000000..e64488b --- /dev/null +++ b/vendor/orchestra/testbench-core/src/Traits/CreatesApplication.php @@ -0,0 +1,14 @@ +=7.1", + "laravel/framework": "~5.7.14", + "mockery/mockery": "^1.0", + "orchestra/testbench-core": "~3.7.7", + "phpunit/phpunit": "^7.0" + }, + "extra": { + "branch-alias": { + "dev-master": "3.7-dev" + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev" +} diff --git a/vendor/paragonie/random_compat/LICENSE b/vendor/paragonie/random_compat/LICENSE new file mode 100644 index 0000000..45c7017 --- /dev/null +++ b/vendor/paragonie/random_compat/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Paragon Initiative Enterprises + +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/paragonie/random_compat/build-phar.sh b/vendor/paragonie/random_compat/build-phar.sh new file mode 100755 index 0000000..b4a5ba3 --- /dev/null +++ b/vendor/paragonie/random_compat/build-phar.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +basedir=$( dirname $( readlink -f ${BASH_SOURCE[0]} ) ) + +php -dphar.readonly=0 "$basedir/other/build_phar.php" $* \ No newline at end of file diff --git a/vendor/paragonie/random_compat/composer.json b/vendor/paragonie/random_compat/composer.json new file mode 100644 index 0000000..1fa8de9 --- /dev/null +++ b/vendor/paragonie/random_compat/composer.json @@ -0,0 +1,34 @@ +{ + "name": "paragonie/random_compat", + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "random", + "polyfill", + "pseudorandom" + ], + "license": "MIT", + "type": "library", + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "support": { + "issues": "https://github.com/paragonie/random_compat/issues", + "email": "info@paragonie.com", + "source": "https://github.com/paragonie/random_compat" + }, + "require": { + "php": "^7" + }, + "require-dev": { + "vimeo/psalm": "^1", + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + } +} diff --git a/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey b/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey new file mode 100644 index 0000000..eb50ebf --- /dev/null +++ b/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey @@ -0,0 +1,5 @@ +-----BEGIN PUBLIC KEY----- +MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEEd+wCqJDrx5B4OldM0dQE0ZMX+lx1ZWm +pui0SUqD4G29L3NGsz9UhJ/0HjBdbnkhIK5xviT0X5vtjacF6ajgcCArbTB+ds+p ++h7Q084NuSuIpNb6YPfoUFgC/CL9kAoc +-----END PUBLIC KEY----- diff --git a/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc b/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc new file mode 100644 index 0000000..6a1d7f3 --- /dev/null +++ b/vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc @@ -0,0 +1,11 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.22 (MingW32) + +iQEcBAABAgAGBQJWtW1hAAoJEGuXocKCZATaJf0H+wbZGgskK1dcRTsuVJl9IWip +QwGw/qIKI280SD6/ckoUMxKDCJiFuPR14zmqnS36k7N5UNPnpdTJTS8T11jttSpg +1LCmgpbEIpgaTah+cELDqFCav99fS+bEiAL5lWDAHBTE/XPjGVCqeehyPYref4IW +NDBIEsvnHPHPLsn6X5jq4+Yj5oUixgxaMPiR+bcO4Sh+RzOVB6i2D0upWfRXBFXA +NNnsg9/zjvoC7ZW73y9uSH+dPJTt/Vgfeiv52/v41XliyzbUyLalf02GNPY+9goV +JHG1ulEEBJOCiUD9cE1PUIJwHA/HqyhHIvV350YoEFiHl8iSwm7SiZu5kPjaq74= +=B6+8 +-----END PGP SIGNATURE----- diff --git a/vendor/paragonie/random_compat/lib/random.php b/vendor/paragonie/random_compat/lib/random.php new file mode 100644 index 0000000..c7731a5 --- /dev/null +++ b/vendor/paragonie/random_compat/lib/random.php @@ -0,0 +1,32 @@ +buildFromDirectory(dirname(__DIR__).'/lib'); +rename( + dirname(__DIR__).'/lib/index.php', + dirname(__DIR__).'/lib/random.php' +); + +/** + * If we pass an (optional) path to a private key as a second argument, we will + * sign the Phar with OpenSSL. + * + * If you leave this out, it will produce an unsigned .phar! + */ +if ($argc > 1) { + if (!@is_readable($argv[1])) { + echo 'Could not read the private key file:', $argv[1], "\n"; + exit(255); + } + $pkeyFile = file_get_contents($argv[1]); + + $private = openssl_get_privatekey($pkeyFile); + if ($private !== false) { + $pkey = ''; + openssl_pkey_export($private, $pkey); + $phar->setSignatureAlgorithm(Phar::OPENSSL, $pkey); + + /** + * Save the corresponding public key to the file + */ + if (!@is_readable($dist.'/random_compat.phar.pubkey')) { + $details = openssl_pkey_get_details($private); + file_put_contents( + $dist.'/random_compat.phar.pubkey', + $details['key'] + ); + } + } else { + echo 'An error occurred reading the private key from OpenSSL.', "\n"; + exit(255); + } +} diff --git a/vendor/paragonie/random_compat/psalm-autoload.php b/vendor/paragonie/random_compat/psalm-autoload.php new file mode 100644 index 0000000..d71d1b8 --- /dev/null +++ b/vendor/paragonie/random_compat/psalm-autoload.php @@ -0,0 +1,9 @@ + + + + + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/.gitignore b/vendor/phar-io/manifest/.gitignore new file mode 100644 index 0000000..374459d --- /dev/null +++ b/vendor/phar-io/manifest/.gitignore @@ -0,0 +1,7 @@ +/.idea +/.php_cs.cache +/src/autoload.php +/tools +/vendor + +/build diff --git a/vendor/phar-io/manifest/.php_cs b/vendor/phar-io/manifest/.php_cs new file mode 100644 index 0000000..159d6a3 --- /dev/null +++ b/vendor/phar-io/manifest/.php_cs @@ -0,0 +1,67 @@ +files() + ->in('src') + ->in('tests') + ->name('*.php'); + +return Symfony\CS\Config\Config::create() + ->setUsingCache(true) + ->level(\Symfony\CS\FixerInterface::NONE_LEVEL) + ->fixers( + array( + 'align_double_arrow', + 'align_equals', + 'concat_with_spaces', + 'duplicate_semicolon', + 'elseif', + 'empty_return', + 'encoding', + 'eof_ending', + 'extra_empty_lines', + 'function_call_space', + 'function_declaration', + 'indentation', + 'join_function', + 'line_after_namespace', + 'linefeed', + 'list_commas', + 'lowercase_constants', + 'lowercase_keywords', + 'method_argument_space', + 'multiple_use', + 'namespace_no_leading_whitespace', + 'no_blank_lines_after_class_opening', + 'no_empty_lines_after_phpdocs', + 'parenthesis', + 'php_closing_tag', + 'phpdoc_indent', + 'phpdoc_no_access', + 'phpdoc_no_empty_return', + 'phpdoc_no_package', + 'phpdoc_params', + 'phpdoc_scalar', + 'phpdoc_separation', + 'phpdoc_to_comment', + 'phpdoc_trim', + 'phpdoc_types', + 'phpdoc_var_without_name', + 'remove_lines_between_uses', + 'return', + 'self_accessor', + 'short_array_syntax', + 'short_tag', + 'single_line_after_imports', + 'single_quote', + 'spaces_before_semicolon', + 'spaces_cast', + 'ternary_spaces', + 'trailing_spaces', + 'trim_array_spaces', + 'unused_use', + 'visibility', + 'whitespacy_lines' + ) + ) + ->finder($finder); + diff --git a/vendor/phar-io/manifest/.travis.yml b/vendor/phar-io/manifest/.travis.yml new file mode 100644 index 0000000..b4be10f --- /dev/null +++ b/vendor/phar-io/manifest/.travis.yml @@ -0,0 +1,33 @@ +os: +- linux + +language: php + +before_install: + - wget https://phar.io/releases/phive.phar + - wget https://phar.io/releases/phive.phar.asc + - gpg --keyserver hkps.pool.sks-keyservers.net --recv-keys 0x9B2D5D79 + - gpg --verify phive.phar.asc phive.phar + - chmod +x phive.phar + - sudo mv phive.phar /usr/bin/phive + +install: + - ant setup + +script: ./tools/phpunit + +php: + - 5.6 + - 7.0 + - 7.1 + - 7.0snapshot + - 7.1snapshot + - master + +matrix: + allow_failures: + - php: master + fast_finish: true + +notifications: + email: false diff --git a/vendor/phar-io/manifest/LICENSE b/vendor/phar-io/manifest/LICENSE new file mode 100644 index 0000000..96051b1 --- /dev/null +++ b/vendor/phar-io/manifest/LICENSE @@ -0,0 +1,31 @@ +manifest + +Copyright (c) 2016 Arne Blankerts , Sebastian Heuer , Sebastian Bergmann , and contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Arne Blankerts nor the names of contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + diff --git a/vendor/phar-io/manifest/README.md b/vendor/phar-io/manifest/README.md new file mode 100644 index 0000000..e6d0b05 --- /dev/null +++ b/vendor/phar-io/manifest/README.md @@ -0,0 +1,30 @@ +# Manifest + +Component for reading [phar.io](https://phar.io/) manifest information from a [PHP Archive (PHAR)](http://php.net/phar). + +[![Build Status](https://travis-ci.org/phar-io/manifest.svg?branch=master)](https://travis-ci.org/phar-io/manifest) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/phar-io/manifest/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/phar-io/manifest/?branch=master) +[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d8cc6035-69ad-477d-bd1a-ccc605480fd7/mini.png)](https://insight.sensiolabs.com/projects/d8cc6035-69ad-477d-bd1a-ccc605480fd7) + +## Installation + +You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): + + composer require phar-io/manifest + +If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: + + composer require --dev phar-io/manifest + +## Usage + +```php +use PharIo\Manifest\ManifestLoader; +use PharIo\Manifest\ManifestSerializer; + +$manifest = ManifestLoader::fromFile('manifest.xml'); + +var_dump($manifest); + +echo (new ManifestSerializer)->serializeToString($manifest); +``` diff --git a/vendor/phar-io/manifest/build.xml b/vendor/phar-io/manifest/build.xml new file mode 100644 index 0000000..fc6eb1a --- /dev/null +++ b/vendor/phar-io/manifest/build.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/composer.json b/vendor/phar-io/manifest/composer.json new file mode 100644 index 0000000..cfaa7fa --- /dev/null +++ b/vendor/phar-io/manifest/composer.json @@ -0,0 +1,42 @@ +{ + "name": "phar-io/manifest", + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "support": { + "issues": "https://github.com/phar-io/manifest/issues" + }, + "require": { + "php": "^5.6 || ^7.0", + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0" + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} + diff --git a/vendor/phar-io/manifest/composer.lock b/vendor/phar-io/manifest/composer.lock new file mode 100644 index 0000000..d876819 --- /dev/null +++ b/vendor/phar-io/manifest/composer.lock @@ -0,0 +1,69 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "f00846dde236d314a19d00d268d737dd", + "packages": [ + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^5.6 || ^7.0", + "ext-dom": "*", + "ext-phar": "*" + }, + "platform-dev": [] +} diff --git a/vendor/phar-io/manifest/examples/example-01.php b/vendor/phar-io/manifest/examples/example-01.php new file mode 100644 index 0000000..345c407 --- /dev/null +++ b/vendor/phar-io/manifest/examples/example-01.php @@ -0,0 +1,23 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PharIo\Manifest\ManifestLoader; +use PharIo\Manifest\ManifestSerializer; + +require __DIR__ . '/../vendor/autoload.php'; + +$manifest = ManifestLoader::fromFile(__DIR__ . '/../tests/_fixture/phpunit-5.6.5.xml'); + +echo sprintf( + "Manifest for %s (%s):\n\n", + $manifest->getName(), + $manifest->getVersion()->getVersionString() +); +echo (new ManifestSerializer)->serializeToString($manifest); diff --git a/vendor/phar-io/manifest/phive.xml b/vendor/phar-io/manifest/phive.xml new file mode 100644 index 0000000..69f2f91 --- /dev/null +++ b/vendor/phar-io/manifest/phive.xml @@ -0,0 +1,4 @@ + + + + diff --git a/vendor/phar-io/manifest/phpunit.xml b/vendor/phar-io/manifest/phpunit.xml new file mode 100644 index 0000000..2d7708e --- /dev/null +++ b/vendor/phar-io/manifest/phpunit.xml @@ -0,0 +1,20 @@ + + + + tests + + + + + src + + + diff --git a/vendor/phar-io/manifest/src/ManifestDocumentMapper.php b/vendor/phar-io/manifest/src/ManifestDocumentMapper.php new file mode 100644 index 0000000..d41e4f9 --- /dev/null +++ b/vendor/phar-io/manifest/src/ManifestDocumentMapper.php @@ -0,0 +1,193 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\Version; +use PharIo\Version\Exception as VersionException; +use PharIo\Version\VersionConstraintParser; + +class ManifestDocumentMapper { + /** + * @param ManifestDocument $document + * + * @returns Manifest + * + * @throws ManifestDocumentMapperException + */ + public function map(ManifestDocument $document) { + try { + $contains = $document->getContainsElement(); + $type = $this->mapType($contains); + $copyright = $this->mapCopyright($document->getCopyrightElement()); + $requirements = $this->mapRequirements($document->getRequiresElement()); + $bundledComponents = $this->mapBundledComponents($document); + + return new Manifest( + new ApplicationName($contains->getName()), + new Version($contains->getVersion()), + $type, + $copyright, + $requirements, + $bundledComponents + ); + } catch (VersionException $e) { + throw new ManifestDocumentMapperException($e->getMessage(), $e->getCode(), $e); + } catch (Exception $e) { + throw new ManifestDocumentMapperException($e->getMessage(), $e->getCode(), $e); + } + } + + /** + * @param ContainsElement $contains + * + * @return Type + * + * @throws ManifestDocumentMapperException + */ + private function mapType(ContainsElement $contains) { + switch ($contains->getType()) { + case 'application': + return Type::application(); + case 'library': + return Type::library(); + case 'extension': + return $this->mapExtension($contains->getExtensionElement()); + } + + throw new ManifestDocumentMapperException( + sprintf('Unsupported type %s', $contains->getType()) + ); + } + + /** + * @param CopyrightElement $copyright + * + * @return CopyrightInformation + * + * @throws InvalidUrlException + * @throws InvalidEmailException + */ + private function mapCopyright(CopyrightElement $copyright) { + $authors = new AuthorCollection(); + + foreach($copyright->getAuthorElements() as $authorElement) { + $authors->add( + new Author( + $authorElement->getName(), + new Email($authorElement->getEmail()) + ) + ); + } + + $licenseElement = $copyright->getLicenseElement(); + $license = new License( + $licenseElement->getType(), + new Url($licenseElement->getUrl()) + ); + + return new CopyrightInformation( + $authors, + $license + ); + } + + /** + * @param RequiresElement $requires + * + * @return RequirementCollection + * + * @throws ManifestDocumentMapperException + */ + private function mapRequirements(RequiresElement $requires) { + $collection = new RequirementCollection(); + $phpElement = $requires->getPHPElement(); + $parser = new VersionConstraintParser; + + try { + $versionConstraint = $parser->parse($phpElement->getVersion()); + } catch (VersionException $e) { + throw new ManifestDocumentMapperException( + sprintf('Unsupported version constraint - %s', $e->getMessage()), + $e->getCode(), + $e + ); + } + + $collection->add( + new PhpVersionRequirement( + $versionConstraint + ) + ); + + if (!$phpElement->hasExtElements()) { + return $collection; + } + + foreach($phpElement->getExtElements() as $extElement) { + $collection->add( + new PhpExtensionRequirement($extElement->getName()) + ); + } + + return $collection; + } + + /** + * @param ManifestDocument $document + * + * @return BundledComponentCollection + */ + private function mapBundledComponents(ManifestDocument $document) { + $collection = new BundledComponentCollection(); + + if (!$document->hasBundlesElement()) { + return $collection; + } + + foreach($document->getBundlesElement()->getComponentElements() as $componentElement) { + $collection->add( + new BundledComponent( + $componentElement->getName(), + new Version( + $componentElement->getVersion() + ) + ) + ); + } + + return $collection; + } + + /** + * @param ExtensionElement $extension + * + * @return Extension + * + * @throws ManifestDocumentMapperException + */ + private function mapExtension(ExtensionElement $extension) { + try { + $parser = new VersionConstraintParser; + $versionConstraint = $parser->parse($extension->getCompatible()); + + return Type::extension( + new ApplicationName($extension->getFor()), + $versionConstraint + ); + } catch (VersionException $e) { + throw new ManifestDocumentMapperException( + sprintf('Unsupported version constraint - %s', $e->getMessage()), + $e->getCode(), + $e + ); + } + } +} diff --git a/vendor/phar-io/manifest/src/ManifestLoader.php b/vendor/phar-io/manifest/src/ManifestLoader.php new file mode 100644 index 0000000..81c5c90 --- /dev/null +++ b/vendor/phar-io/manifest/src/ManifestLoader.php @@ -0,0 +1,66 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ManifestLoader { + /** + * @param string $filename + * + * @return Manifest + * + * @throws ManifestLoaderException + */ + public static function fromFile($filename) { + try { + return (new ManifestDocumentMapper())->map( + ManifestDocument::fromFile($filename) + ); + } catch (Exception $e) { + throw new ManifestLoaderException( + sprintf('Loading %s failed.', $filename), + $e->getCode(), + $e + ); + } + } + + /** + * @param string $filename + * + * @return Manifest + * + * @throws ManifestLoaderException + */ + public static function fromPhar($filename) { + return self::fromFile('phar://' . $filename . '/manifest.xml'); + } + + /** + * @param string $manifest + * + * @return Manifest + * + * @throws ManifestLoaderException + */ + public static function fromString($manifest) { + try { + return (new ManifestDocumentMapper())->map( + ManifestDocument::fromString($manifest) + ); + } catch (Exception $e) { + throw new ManifestLoaderException( + 'Processing string failed', + $e->getCode(), + $e + ); + } + } +} diff --git a/vendor/phar-io/manifest/src/ManifestSerializer.php b/vendor/phar-io/manifest/src/ManifestSerializer.php new file mode 100644 index 0000000..4c18ddd --- /dev/null +++ b/vendor/phar-io/manifest/src/ManifestSerializer.php @@ -0,0 +1,163 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\AnyVersionConstraint; +use PharIo\Version\Version; +use PharIo\Version\VersionConstraint; +use XMLWriter; + +class ManifestSerializer { + /** + * @var XMLWriter + */ + private $xmlWriter; + + public function serializeToFile(Manifest $manifest, $filename) { + file_put_contents( + $filename, + $this->serializeToString($manifest) + ); + } + + public function serializeToString(Manifest $manifest) { + $this->startDocument(); + + $this->addContains($manifest->getName(), $manifest->getVersion(), $manifest->getType()); + $this->addCopyright($manifest->getCopyrightInformation()); + $this->addRequirements($manifest->getRequirements()); + $this->addBundles($manifest->getBundledComponents()); + + return $this->finishDocument(); + } + + private function startDocument() { + $xmlWriter = new XMLWriter(); + $xmlWriter->openMemory(); + $xmlWriter->setIndent(true); + $xmlWriter->setIndentString(str_repeat(' ', 4)); + $xmlWriter->startDocument('1.0', 'UTF-8'); + $xmlWriter->startElement('phar'); + $xmlWriter->writeAttribute('xmlns', 'https://phar.io/xml/manifest/1.0'); + + $this->xmlWriter = $xmlWriter; + } + + private function finishDocument() { + $this->xmlWriter->endElement(); + $this->xmlWriter->endDocument(); + + return $this->xmlWriter->outputMemory(); + } + + private function addContains($name, Version $version, Type $type) { + $this->xmlWriter->startElement('contains'); + $this->xmlWriter->writeAttribute('name', $name); + $this->xmlWriter->writeAttribute('version', $version->getVersionString()); + + switch (true) { + case $type->isApplication(): { + $this->xmlWriter->writeAttribute('type', 'application'); + break; + } + + case $type->isLibrary(): { + $this->xmlWriter->writeAttribute('type', 'library'); + break; + } + + case $type->isExtension(): { + /* @var $type Extension */ + $this->xmlWriter->writeAttribute('type', 'extension'); + $this->addExtension($type->getApplicationName(), $type->getVersionConstraint()); + break; + } + + default: { + $this->xmlWriter->writeAttribute('type', 'custom'); + } + } + + $this->xmlWriter->endElement(); + } + + private function addCopyright(CopyrightInformation $copyrightInformation) { + $this->xmlWriter->startElement('copyright'); + + foreach($copyrightInformation->getAuthors() as $author) { + $this->xmlWriter->startElement('author'); + $this->xmlWriter->writeAttribute('name', $author->getName()); + $this->xmlWriter->writeAttribute('email', (string) $author->getEmail()); + $this->xmlWriter->endElement(); + } + + $license = $copyrightInformation->getLicense(); + + $this->xmlWriter->startElement('license'); + $this->xmlWriter->writeAttribute('type', $license->getName()); + $this->xmlWriter->writeAttribute('url', $license->getUrl()); + $this->xmlWriter->endElement(); + + $this->xmlWriter->endElement(); + } + + private function addRequirements(RequirementCollection $requirementCollection) { + $phpRequirement = new AnyVersionConstraint(); + $extensions = []; + + foreach($requirementCollection as $requirement) { + if ($requirement instanceof PhpVersionRequirement) { + $phpRequirement = $requirement->getVersionConstraint(); + continue; + } + + if ($requirement instanceof PhpExtensionRequirement) { + $extensions[] = (string) $requirement; + } + } + + $this->xmlWriter->startElement('requires'); + $this->xmlWriter->startElement('php'); + $this->xmlWriter->writeAttribute('version', $phpRequirement->asString()); + + foreach($extensions as $extension) { + $this->xmlWriter->startElement('ext'); + $this->xmlWriter->writeAttribute('name', $extension); + $this->xmlWriter->endElement(); + } + + $this->xmlWriter->endElement(); + $this->xmlWriter->endElement(); + } + + private function addBundles(BundledComponentCollection $bundledComponentCollection) { + if (count($bundledComponentCollection) === 0) { + return; + } + $this->xmlWriter->startElement('bundles'); + + foreach($bundledComponentCollection as $bundledComponent) { + $this->xmlWriter->startElement('component'); + $this->xmlWriter->writeAttribute('name', $bundledComponent->getName()); + $this->xmlWriter->writeAttribute('version', $bundledComponent->getVersion()->getVersionString()); + $this->xmlWriter->endElement(); + } + + $this->xmlWriter->endElement(); + } + + private function addExtension($application, VersionConstraint $versionConstraint) { + $this->xmlWriter->startElement('extension'); + $this->xmlWriter->writeAttribute('for', $application); + $this->xmlWriter->writeAttribute('compatible', $versionConstraint->asString()); + $this->xmlWriter->endElement(); + } +} diff --git a/vendor/phar-io/manifest/src/exceptions/Exception.php b/vendor/phar-io/manifest/src/exceptions/Exception.php new file mode 100644 index 0000000..3ce46f2 --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/Exception.php @@ -0,0 +1,14 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +interface Exception { +} diff --git a/vendor/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php b/vendor/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php new file mode 100644 index 0000000..a53735a --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/InvalidApplicationNameException.php @@ -0,0 +1,16 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class InvalidApplicationNameException extends \InvalidArgumentException implements Exception { + const NotAString = 1; + const InvalidFormat = 2; +} diff --git a/vendor/phar-io/manifest/src/exceptions/InvalidEmailException.php b/vendor/phar-io/manifest/src/exceptions/InvalidEmailException.php new file mode 100644 index 0000000..854399b --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/InvalidEmailException.php @@ -0,0 +1,14 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class InvalidEmailException extends \InvalidArgumentException implements Exception { +} diff --git a/vendor/phar-io/manifest/src/exceptions/InvalidUrlException.php b/vendor/phar-io/manifest/src/exceptions/InvalidUrlException.php new file mode 100644 index 0000000..cdd8323 --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/InvalidUrlException.php @@ -0,0 +1,14 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class InvalidUrlException extends \InvalidArgumentException implements Exception { +} diff --git a/vendor/phar-io/manifest/src/exceptions/ManifestDocumentException.php b/vendor/phar-io/manifest/src/exceptions/ManifestDocumentException.php new file mode 100644 index 0000000..8b40195 --- /dev/null +++ b/vendor/phar-io/manifest/src/exceptions/ManifestDocumentException.php @@ -0,0 +1,6 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class Application extends Type { + /** + * @return bool + */ + public function isApplication() { + return true; + } +} diff --git a/vendor/phar-io/manifest/src/values/ApplicationName.php b/vendor/phar-io/manifest/src/values/ApplicationName.php new file mode 100644 index 0000000..1e71af4 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/ApplicationName.php @@ -0,0 +1,65 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ApplicationName { + /** + * @var string + */ + private $name; + + /** + * ApplicationName constructor. + * + * @param string $name + * + * @throws InvalidApplicationNameException + */ + public function __construct($name) { + $this->ensureIsString($name); + $this->ensureValidFormat($name); + $this->name = $name; + } + + /** + * @return string + */ + public function __toString() { + return $this->name; + } + + public function isEqual(ApplicationName $name) { + return $this->name === $name->name; + } + + /** + * @param string $name + * + * @throws InvalidApplicationNameException + */ + private function ensureValidFormat($name) { + if (!preg_match('#\w/\w#', $name)) { + throw new InvalidApplicationNameException( + sprintf('Format of name "%s" is not valid - expected: vendor/packagename', $name), + InvalidApplicationNameException::InvalidFormat + ); + } + } + + private function ensureIsString($name) { + if (!is_string($name)) { + throw new InvalidApplicationNameException( + 'Name must be a string', + InvalidApplicationNameException::NotAString + ); + } + } +} diff --git a/vendor/phar-io/manifest/src/values/Author.php b/vendor/phar-io/manifest/src/values/Author.php new file mode 100644 index 0000000..8295f51 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Author.php @@ -0,0 +1,57 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class Author { + /** + * @var string + */ + private $name; + + /** + * @var Email + */ + private $email; + + /** + * @param string $name + * @param Email $email + */ + public function __construct($name, Email $email) { + $this->name = $name; + $this->email = $email; + } + + /** + * @return string + */ + public function getName() { + return $this->name; + } + + /** + * @return Email + */ + public function getEmail() { + return $this->email; + } + + /** + * @return string + */ + public function __toString() { + return sprintf( + '%s <%s>', + $this->name, + $this->email + ); + } +} diff --git a/vendor/phar-io/manifest/src/values/AuthorCollection.php b/vendor/phar-io/manifest/src/values/AuthorCollection.php new file mode 100644 index 0000000..d915879 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/AuthorCollection.php @@ -0,0 +1,43 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class AuthorCollection implements \Countable, \IteratorAggregate { + /** + * @var Author[] + */ + private $authors = []; + + public function add(Author $author) { + $this->authors[] = $author; + } + + /** + * @return Author[] + */ + public function getAuthors() { + return $this->authors; + } + + /** + * @return int + */ + public function count() { + return count($this->authors); + } + + /** + * @return AuthorCollectionIterator + */ + public function getIterator() { + return new AuthorCollectionIterator($this); + } +} diff --git a/vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php b/vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php new file mode 100644 index 0000000..792a050 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/AuthorCollectionIterator.php @@ -0,0 +1,56 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class AuthorCollectionIterator implements \Iterator { + /** + * @var Author[] + */ + private $authors = []; + + /** + * @var int + */ + private $position; + + public function __construct(AuthorCollection $authors) { + $this->authors = $authors->getAuthors(); + } + + public function rewind() { + $this->position = 0; + } + + /** + * @return bool + */ + public function valid() { + return $this->position < count($this->authors); + } + + /** + * @return int + */ + public function key() { + return $this->position; + } + + /** + * @return Author + */ + public function current() { + return $this->authors[$this->position]; + } + + public function next() { + $this->position++; + } +} diff --git a/vendor/phar-io/manifest/src/values/BundledComponent.php b/vendor/phar-io/manifest/src/values/BundledComponent.php new file mode 100644 index 0000000..846d15a --- /dev/null +++ b/vendor/phar-io/manifest/src/values/BundledComponent.php @@ -0,0 +1,48 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\Version; + +class BundledComponent { + /** + * @var string + */ + private $name; + + /** + * @var Version + */ + private $version; + + /** + * @param string $name + * @param Version $version + */ + public function __construct($name, Version $version) { + $this->name = $name; + $this->version = $version; + } + + /** + * @return string + */ + public function getName() { + return $this->name; + } + + /** + * @return Version + */ + public function getVersion() { + return $this->version; + } +} diff --git a/vendor/phar-io/manifest/src/values/BundledComponentCollection.php b/vendor/phar-io/manifest/src/values/BundledComponentCollection.php new file mode 100644 index 0000000..2dbb918 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/BundledComponentCollection.php @@ -0,0 +1,43 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class BundledComponentCollection implements \Countable, \IteratorAggregate { + /** + * @var BundledComponent[] + */ + private $bundledComponents = []; + + public function add(BundledComponent $bundledComponent) { + $this->bundledComponents[] = $bundledComponent; + } + + /** + * @return BundledComponent[] + */ + public function getBundledComponents() { + return $this->bundledComponents; + } + + /** + * @return int + */ + public function count() { + return count($this->bundledComponents); + } + + /** + * @return BundledComponentCollectionIterator + */ + public function getIterator() { + return new BundledComponentCollectionIterator($this); + } +} diff --git a/vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php b/vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php new file mode 100644 index 0000000..13b8f05 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/BundledComponentCollectionIterator.php @@ -0,0 +1,56 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class BundledComponentCollectionIterator implements \Iterator { + /** + * @var BundledComponent[] + */ + private $bundledComponents = []; + + /** + * @var int + */ + private $position; + + public function __construct(BundledComponentCollection $bundledComponents) { + $this->bundledComponents = $bundledComponents->getBundledComponents(); + } + + public function rewind() { + $this->position = 0; + } + + /** + * @return bool + */ + public function valid() { + return $this->position < count($this->bundledComponents); + } + + /** + * @return int + */ + public function key() { + return $this->position; + } + + /** + * @return BundledComponent + */ + public function current() { + return $this->bundledComponents[$this->position]; + } + + public function next() { + $this->position++; + } +} diff --git a/vendor/phar-io/manifest/src/values/CopyrightInformation.php b/vendor/phar-io/manifest/src/values/CopyrightInformation.php new file mode 100644 index 0000000..ece60b1 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/CopyrightInformation.php @@ -0,0 +1,42 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class CopyrightInformation { + /** + * @var AuthorCollection + */ + private $authors; + + /** + * @var License + */ + private $license; + + public function __construct(AuthorCollection $authors, License $license) { + $this->authors = $authors; + $this->license = $license; + } + + /** + * @return AuthorCollection + */ + public function getAuthors() { + return $this->authors; + } + + /** + * @return License + */ + public function getLicense() { + return $this->license; + } +} diff --git a/vendor/phar-io/manifest/src/values/Email.php b/vendor/phar-io/manifest/src/values/Email.php new file mode 100644 index 0000000..57cce04 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Email.php @@ -0,0 +1,47 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class Email { + /** + * @var string + */ + private $email; + + /** + * @param string $email + * + * @throws InvalidEmailException + */ + public function __construct($email) { + $this->ensureEmailIsValid($email); + + $this->email = $email; + } + + /** + * @return string + */ + public function __toString() { + return $this->email; + } + + /** + * @param string $url + * + * @throws InvalidEmailException + */ + private function ensureEmailIsValid($url) { + if (filter_var($url, \FILTER_VALIDATE_EMAIL) === false) { + throw new InvalidEmailException; + } + } +} diff --git a/vendor/phar-io/manifest/src/values/Extension.php b/vendor/phar-io/manifest/src/values/Extension.php new file mode 100644 index 0000000..90d6a6f --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Extension.php @@ -0,0 +1,75 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\Version; +use PharIo\Version\VersionConstraint; + +class Extension extends Type { + /** + * @var ApplicationName + */ + private $application; + + /** + * @var VersionConstraint + */ + private $versionConstraint; + + /** + * @param ApplicationName $application + * @param VersionConstraint $versionConstraint + */ + public function __construct(ApplicationName $application, VersionConstraint $versionConstraint) { + $this->application = $application; + $this->versionConstraint = $versionConstraint; + } + + /** + * @return ApplicationName + */ + public function getApplicationName() { + return $this->application; + } + + /** + * @return VersionConstraint + */ + public function getVersionConstraint() { + return $this->versionConstraint; + } + + /** + * @return bool + */ + public function isExtension() { + return true; + } + + /** + * @param ApplicationName $name + * + * @return bool + */ + public function isExtensionFor(ApplicationName $name) { + return $this->application->isEqual($name); + } + + /** + * @param ApplicationName $name + * @param Version $version + * + * @return bool + */ + public function isCompatibleWith(ApplicationName $name, Version $version) { + return $this->isExtensionFor($name) && $this->versionConstraint->complies($version); + } +} diff --git a/vendor/phar-io/manifest/src/values/Library.php b/vendor/phar-io/manifest/src/values/Library.php new file mode 100644 index 0000000..a6ff944 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Library.php @@ -0,0 +1,20 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class Library extends Type { + /** + * @return bool + */ + public function isLibrary() { + return true; + } +} diff --git a/vendor/phar-io/manifest/src/values/License.php b/vendor/phar-io/manifest/src/values/License.php new file mode 100644 index 0000000..e278670 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/License.php @@ -0,0 +1,42 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class License { + /** + * @var string + */ + private $name; + + /** + * @var Url + */ + private $url; + + public function __construct($name, Url $url) { + $this->name = $name; + $this->url = $url; + } + + /** + * @return string + */ + public function getName() { + return $this->name; + } + + /** + * @return Url + */ + public function getUrl() { + return $this->url; + } +} diff --git a/vendor/phar-io/manifest/src/values/Manifest.php b/vendor/phar-io/manifest/src/values/Manifest.php new file mode 100644 index 0000000..217acef --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Manifest.php @@ -0,0 +1,138 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\Version; + +class Manifest { + /** + * @var ApplicationName + */ + private $name; + + /** + * @var Version + */ + private $version; + + /** + * @var Type + */ + private $type; + + /** + * @var CopyrightInformation + */ + private $copyrightInformation; + + /** + * @var RequirementCollection + */ + private $requirements; + + /** + * @var BundledComponentCollection + */ + private $bundledComponents; + + public function __construct(ApplicationName $name, Version $version, Type $type, CopyrightInformation $copyrightInformation, RequirementCollection $requirements, BundledComponentCollection $bundledComponents) { + $this->name = $name; + $this->version = $version; + $this->type = $type; + $this->copyrightInformation = $copyrightInformation; + $this->requirements = $requirements; + $this->bundledComponents = $bundledComponents; + } + + /** + * @return ApplicationName + */ + public function getName() { + return $this->name; + } + + /** + * @return Version + */ + public function getVersion() { + return $this->version; + } + + /** + * @return Type + */ + public function getType() { + return $this->type; + } + + /** + * @return CopyrightInformation + */ + public function getCopyrightInformation() { + return $this->copyrightInformation; + } + + /** + * @return RequirementCollection + */ + public function getRequirements() { + return $this->requirements; + } + + /** + * @return BundledComponentCollection + */ + public function getBundledComponents() { + return $this->bundledComponents; + } + + /** + * @return bool + */ + public function isApplication() { + return $this->type->isApplication(); + } + + /** + * @return bool + */ + public function isLibrary() { + return $this->type->isLibrary(); + } + + /** + * @return bool + */ + public function isExtension() { + return $this->type->isExtension(); + } + + /** + * @param ApplicationName $application + * @param Version|null $version + * + * @return bool + */ + public function isExtensionFor(ApplicationName $application, Version $version = null) { + if (!$this->isExtension()) { + return false; + } + + /** @var Extension $type */ + $type = $this->type; + + if ($version !== null) { + return $type->isCompatibleWith($application, $version); + } + + return $type->isExtensionFor($application); + } +} diff --git a/vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php b/vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php new file mode 100644 index 0000000..6dd9296 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/PhpExtensionRequirement.php @@ -0,0 +1,32 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class PhpExtensionRequirement implements Requirement { + /** + * @var string + */ + private $extension; + + /** + * @param string $extension + */ + public function __construct($extension) { + $this->extension = $extension; + } + + /** + * @return string + */ + public function __toString() { + return $this->extension; + } +} diff --git a/vendor/phar-io/manifest/src/values/PhpVersionRequirement.php b/vendor/phar-io/manifest/src/values/PhpVersionRequirement.php new file mode 100644 index 0000000..8ad3e76 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/PhpVersionRequirement.php @@ -0,0 +1,31 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\VersionConstraint; + +class PhpVersionRequirement implements Requirement { + /** + * @var VersionConstraint + */ + private $versionConstraint; + + public function __construct(VersionConstraint $versionConstraint) { + $this->versionConstraint = $versionConstraint; + } + + /** + * @return VersionConstraint + */ + public function getVersionConstraint() { + return $this->versionConstraint; + } +} diff --git a/vendor/phar-io/manifest/src/values/Requirement.php b/vendor/phar-io/manifest/src/values/Requirement.php new file mode 100644 index 0000000..03bb56d --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Requirement.php @@ -0,0 +1,14 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +interface Requirement { +} diff --git a/vendor/phar-io/manifest/src/values/RequirementCollection.php b/vendor/phar-io/manifest/src/values/RequirementCollection.php new file mode 100644 index 0000000..af0e09b --- /dev/null +++ b/vendor/phar-io/manifest/src/values/RequirementCollection.php @@ -0,0 +1,43 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class RequirementCollection implements \Countable, \IteratorAggregate { + /** + * @var Requirement[] + */ + private $requirements = []; + + public function add(Requirement $requirement) { + $this->requirements[] = $requirement; + } + + /** + * @return Requirement[] + */ + public function getRequirements() { + return $this->requirements; + } + + /** + * @return int + */ + public function count() { + return count($this->requirements); + } + + /** + * @return RequirementCollectionIterator + */ + public function getIterator() { + return new RequirementCollectionIterator($this); + } +} diff --git a/vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php b/vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php new file mode 100644 index 0000000..9bb7003 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/RequirementCollectionIterator.php @@ -0,0 +1,56 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class RequirementCollectionIterator implements \Iterator { + /** + * @var Requirement[] + */ + private $requirements = []; + + /** + * @var int + */ + private $position; + + public function __construct(RequirementCollection $requirements) { + $this->requirements = $requirements->getRequirements(); + } + + public function rewind() { + $this->position = 0; + } + + /** + * @return bool + */ + public function valid() { + return $this->position < count($this->requirements); + } + + /** + * @return int + */ + public function key() { + return $this->position; + } + + /** + * @return Requirement + */ + public function current() { + return $this->requirements[$this->position]; + } + + public function next() { + $this->position++; + } +} diff --git a/vendor/phar-io/manifest/src/values/Type.php b/vendor/phar-io/manifest/src/values/Type.php new file mode 100644 index 0000000..31fbd44 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Type.php @@ -0,0 +1,60 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\VersionConstraint; + +abstract class Type { + /** + * @return Application + */ + public static function application() { + return new Application; + } + + /** + * @return Library + */ + public static function library() { + return new Library; + } + + /** + * @param ApplicationName $application + * @param VersionConstraint $versionConstraint + * + * @return Extension + */ + public static function extension(ApplicationName $application, VersionConstraint $versionConstraint) { + return new Extension($application, $versionConstraint); + } + + /** + * @return bool + */ + public function isApplication() { + return false; + } + + /** + * @return bool + */ + public function isLibrary() { + return false; + } + + /** + * @return bool + */ + public function isExtension() { + return false; + } +} diff --git a/vendor/phar-io/manifest/src/values/Url.php b/vendor/phar-io/manifest/src/values/Url.php new file mode 100644 index 0000000..37917c8 --- /dev/null +++ b/vendor/phar-io/manifest/src/values/Url.php @@ -0,0 +1,47 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class Url { + /** + * @var string + */ + private $url; + + /** + * @param string $url + * + * @throws InvalidUrlException + */ + public function __construct($url) { + $this->ensureUrlIsValid($url); + + $this->url = $url; + } + + /** + * @return string + */ + public function __toString() { + return $this->url; + } + + /** + * @param string $url + * + * @throws InvalidUrlException + */ + private function ensureUrlIsValid($url) { + if (filter_var($url, \FILTER_VALIDATE_URL) === false) { + throw new InvalidUrlException; + } + } +} diff --git a/vendor/phar-io/manifest/src/xml/AuthorElement.php b/vendor/phar-io/manifest/src/xml/AuthorElement.php new file mode 100644 index 0000000..a32f397 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/AuthorElement.php @@ -0,0 +1,21 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class AuthorElement extends ManifestElement { + public function getName() { + return $this->getAttributeValue('name'); + } + + public function getEmail() { + return $this->getAttributeValue('email'); + } +} diff --git a/vendor/phar-io/manifest/src/xml/AuthorElementCollection.php b/vendor/phar-io/manifest/src/xml/AuthorElementCollection.php new file mode 100644 index 0000000..1240d8c --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/AuthorElementCollection.php @@ -0,0 +1,19 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class AuthorElementCollection extends ElementCollection { + public function current() { + return new AuthorElement( + $this->getCurrentElement() + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/BundlesElement.php b/vendor/phar-io/manifest/src/xml/BundlesElement.php new file mode 100644 index 0000000..b90023e --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/BundlesElement.php @@ -0,0 +1,19 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class BundlesElement extends ManifestElement { + public function getComponentElements() { + return new ComponentElementCollection( + $this->getChildrenByName('component') + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ComponentElement.php b/vendor/phar-io/manifest/src/xml/ComponentElement.php new file mode 100644 index 0000000..64ed6b0 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ComponentElement.php @@ -0,0 +1,21 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ComponentElement extends ManifestElement { + public function getName() { + return $this->getAttributeValue('name'); + } + + public function getVersion() { + return $this->getAttributeValue('version'); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ComponentElementCollection.php b/vendor/phar-io/manifest/src/xml/ComponentElementCollection.php new file mode 100644 index 0000000..9d375f9 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ComponentElementCollection.php @@ -0,0 +1,19 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ComponentElementCollection extends ElementCollection { + public function current() { + return new ComponentElement( + $this->getCurrentElement() + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ContainsElement.php b/vendor/phar-io/manifest/src/xml/ContainsElement.php new file mode 100644 index 0000000..8172f33 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ContainsElement.php @@ -0,0 +1,31 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ContainsElement extends ManifestElement { + public function getName() { + return $this->getAttributeValue('name'); + } + + public function getVersion() { + return $this->getAttributeValue('version'); + } + + public function getType() { + return $this->getAttributeValue('type'); + } + + public function getExtensionElement() { + return new ExtensionElement( + $this->getChildByName('extension') + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/CopyrightElement.php b/vendor/phar-io/manifest/src/xml/CopyrightElement.php new file mode 100644 index 0000000..bf7848e --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/CopyrightElement.php @@ -0,0 +1,25 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class CopyrightElement extends ManifestElement { + public function getAuthorElements() { + return new AuthorElementCollection( + $this->getChildrenByName('author') + ); + } + + public function getLicenseElement() { + return new LicenseElement( + $this->getChildByName('license') + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ElementCollection.php b/vendor/phar-io/manifest/src/xml/ElementCollection.php new file mode 100644 index 0000000..284e77b --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ElementCollection.php @@ -0,0 +1,58 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use DOMElement; +use DOMNodeList; + +abstract class ElementCollection implements \Iterator { + /** + * @var DOMNodeList + */ + private $nodeList; + + private $position; + + /** + * ElementCollection constructor. + * + * @param DOMNodeList $nodeList + */ + public function __construct(DOMNodeList $nodeList) { + $this->nodeList = $nodeList; + $this->position = 0; + } + + abstract public function current(); + + /** + * @return DOMElement + */ + protected function getCurrentElement() { + return $this->nodeList->item($this->position); + } + + public function next() { + $this->position++; + } + + public function key() { + return $this->position; + } + + public function valid() { + return $this->position < $this->nodeList->length; + } + + public function rewind() { + $this->position = 0; + } +} diff --git a/vendor/phar-io/manifest/src/xml/ExtElement.php b/vendor/phar-io/manifest/src/xml/ExtElement.php new file mode 100644 index 0000000..7a824ab --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ExtElement.php @@ -0,0 +1,17 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ExtElement extends ManifestElement { + public function getName() { + return $this->getAttributeValue('name'); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ExtElementCollection.php b/vendor/phar-io/manifest/src/xml/ExtElementCollection.php new file mode 100644 index 0000000..17acc62 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ExtElementCollection.php @@ -0,0 +1,20 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ExtElementCollection extends ElementCollection { + public function current() { + return new ExtElement( + $this->getCurrentElement() + ); + } + +} diff --git a/vendor/phar-io/manifest/src/xml/ExtensionElement.php b/vendor/phar-io/manifest/src/xml/ExtensionElement.php new file mode 100644 index 0000000..536c085 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ExtensionElement.php @@ -0,0 +1,21 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class ExtensionElement extends ManifestElement { + public function getFor() { + return $this->getAttributeValue('for'); + } + + public function getCompatible() { + return $this->getAttributeValue('compatible'); + } +} diff --git a/vendor/phar-io/manifest/src/xml/LicenseElement.php b/vendor/phar-io/manifest/src/xml/LicenseElement.php new file mode 100644 index 0000000..ee001df --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/LicenseElement.php @@ -0,0 +1,21 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class LicenseElement extends ManifestElement { + public function getType() { + return $this->getAttributeValue('type'); + } + + public function getUrl() { + return $this->getAttributeValue('url'); + } +} diff --git a/vendor/phar-io/manifest/src/xml/ManifestDocument.php b/vendor/phar-io/manifest/src/xml/ManifestDocument.php new file mode 100644 index 0000000..9b0bd9d --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ManifestDocument.php @@ -0,0 +1,118 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use DOMDocument; +use DOMElement; + +class ManifestDocument { + const XMLNS = 'https://phar.io/xml/manifest/1.0'; + + /** + * @var DOMDocument + */ + private $dom; + + /** + * ManifestDocument constructor. + * + * @param DOMDocument $dom + */ + private function __construct(DOMDocument $dom) { + $this->ensureCorrectDocumentType($dom); + + $this->dom = $dom; + } + + public static function fromFile($filename) { + if (!file_exists($filename)) { + throw new ManifestDocumentException( + sprintf('File "%s" not found', $filename) + ); + } + + return self::fromString( + file_get_contents($filename) + ); + } + + public static function fromString($xmlString) { + $prev = libxml_use_internal_errors(true); + libxml_clear_errors(); + + $dom = new DOMDocument(); + $dom->loadXML($xmlString); + + $errors = libxml_get_errors(); + libxml_use_internal_errors($prev); + + if (count($errors) !== 0) { + throw new ManifestDocumentLoadingException($errors); + } + + return new self($dom); + } + + public function getContainsElement() { + return new ContainsElement( + $this->fetchElementByName('contains') + ); + } + + public function getCopyrightElement() { + return new CopyrightElement( + $this->fetchElementByName('copyright') + ); + } + + public function getRequiresElement() { + return new RequiresElement( + $this->fetchElementByName('requires') + ); + } + + public function hasBundlesElement() { + return $this->dom->getElementsByTagNameNS(self::XMLNS, 'bundles')->length === 1; + } + + public function getBundlesElement() { + return new BundlesElement( + $this->fetchElementByName('bundles') + ); + } + + private function ensureCorrectDocumentType(DOMDocument $dom) { + $root = $dom->documentElement; + + if ($root->localName !== 'phar' || $root->namespaceURI !== self::XMLNS) { + throw new ManifestDocumentException('Not a phar.io manifest document'); + } + } + + /** + * @param $elementName + * + * @return DOMElement + * + * @throws ManifestDocumentException + */ + private function fetchElementByName($elementName) { + $element = $this->dom->getElementsByTagNameNS(self::XMLNS, $elementName)->item(0); + + if (!$element instanceof DOMElement) { + throw new ManifestDocumentException( + sprintf('Element %s missing', $elementName) + ); + } + + return $element; + } +} diff --git a/vendor/phar-io/manifest/src/xml/ManifestDocumentLoadingException.php b/vendor/phar-io/manifest/src/xml/ManifestDocumentLoadingException.php new file mode 100644 index 0000000..59ac5c6 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ManifestDocumentLoadingException.php @@ -0,0 +1,48 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use LibXMLError; + +class ManifestDocumentLoadingException extends \Exception implements Exception { + /** + * @var LibXMLError[] + */ + private $libxmlErrors; + + /** + * ManifestDocumentLoadingException constructor. + * + * @param LibXMLError[] $libxmlErrors + */ + public function __construct(array $libxmlErrors) { + $this->libxmlErrors = $libxmlErrors; + $first = $this->libxmlErrors[0]; + + parent::__construct( + sprintf( + '%s (Line: %d / Column: %d / File: %s)', + $first->message, + $first->line, + $first->column, + $first->file + ), + $first->code + ); + } + + /** + * @return LibXMLError[] + */ + public function getLibxmlErrors() { + return $this->libxmlErrors; + } +} diff --git a/vendor/phar-io/manifest/src/xml/ManifestElement.php b/vendor/phar-io/manifest/src/xml/ManifestElement.php new file mode 100644 index 0000000..09d07cc --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/ManifestElement.php @@ -0,0 +1,100 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use DOMElement; +use DOMNodeList; + +class ManifestElement { + const XMLNS = 'https://phar.io/xml/manifest/1.0'; + + /** + * @var DOMElement + */ + private $element; + + /** + * ContainsElement constructor. + * + * @param DOMElement $element + */ + public function __construct(DOMElement $element) { + $this->element = $element; + } + + /** + * @param string $name + * + * @return string + * + * @throws ManifestElementException + */ + protected function getAttributeValue($name) { + if (!$this->element->hasAttribute($name)) { + throw new ManifestElementException( + sprintf( + 'Attribute %s not set on element %s', + $name, + $this->element->localName + ) + ); + } + + return $this->element->getAttribute($name); + } + + /** + * @param $elementName + * + * @return DOMElement + * + * @throws ManifestElementException + */ + protected function getChildByName($elementName) { + $element = $this->element->getElementsByTagNameNS(self::XMLNS, $elementName)->item(0); + + if (!$element instanceof DOMElement) { + throw new ManifestElementException( + sprintf('Element %s missing', $elementName) + ); + } + + return $element; + } + + /** + * @param $elementName + * + * @return DOMNodeList + * + * @throws ManifestElementException + */ + protected function getChildrenByName($elementName) { + $elementList = $this->element->getElementsByTagNameNS(self::XMLNS, $elementName); + + if ($elementList->length === 0) { + throw new ManifestElementException( + sprintf('Element(s) %s missing', $elementName) + ); + } + + return $elementList; + } + + /** + * @param string $elementName + * + * @return bool + */ + protected function hasChild($elementName) { + return $this->element->getElementsByTagNameNS(self::XMLNS, $elementName)->length !== 0; + } +} diff --git a/vendor/phar-io/manifest/src/xml/PhpElement.php b/vendor/phar-io/manifest/src/xml/PhpElement.php new file mode 100644 index 0000000..e7340c0 --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/PhpElement.php @@ -0,0 +1,27 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class PhpElement extends ManifestElement { + public function getVersion() { + return $this->getAttributeValue('version'); + } + + public function hasExtElements() { + return $this->hasChild('ext'); + } + + public function getExtElements() { + return new ExtElementCollection( + $this->getChildrenByName('ext') + ); + } +} diff --git a/vendor/phar-io/manifest/src/xml/RequiresElement.php b/vendor/phar-io/manifest/src/xml/RequiresElement.php new file mode 100644 index 0000000..5f41b2e --- /dev/null +++ b/vendor/phar-io/manifest/src/xml/RequiresElement.php @@ -0,0 +1,19 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +class RequiresElement extends ManifestElement { + public function getPHPElement() { + return new PhpElement( + $this->getChildByName('php') + ); + } +} diff --git a/vendor/phar-io/manifest/tests/ManifestDocumentMapperTest.php b/vendor/phar-io/manifest/tests/ManifestDocumentMapperTest.php new file mode 100644 index 0000000..c69d761 --- /dev/null +++ b/vendor/phar-io/manifest/tests/ManifestDocumentMapperTest.php @@ -0,0 +1,110 @@ +assertInstanceOf( + Manifest::class, + $mapper->map($manifestDocument) + ); + } + + public function dataProvider() { + return [ + 'application' => [__DIR__ . '/_fixture/phpunit-5.6.5.xml'], + 'library' => [__DIR__ . '/_fixture/library.xml'], + 'extension' => [__DIR__ . '/_fixture/extension.xml'] + ]; + } + + public function testThrowsExceptionOnUnsupportedType() { + $manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/custom.xml'); + $mapper = new ManifestDocumentMapper(); + + $this->expectException(ManifestDocumentMapperException::class); + $mapper->map($manifestDocument); + } + + public function testInvalidVersionInformationThrowsException() { + $manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/invalidversion.xml'); + $mapper = new ManifestDocumentMapper(); + + $this->expectException(ManifestDocumentMapperException::class); + $mapper->map($manifestDocument); + } + + public function testInvalidVersionConstraintThrowsException() { + $manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/invalidversionconstraint.xml'); + $mapper = new ManifestDocumentMapper(); + + $this->expectException(ManifestDocumentMapperException::class); + $mapper->map($manifestDocument); + } + + /** + * @uses \PharIo\Manifest\ExtensionElement + */ + public function testInvalidCompatibleConstraintThrowsException() { + $manifestDocument = ManifestDocument::fromFile(__DIR__ . '/_fixture/extension-invalidcompatible.xml'); + $mapper = new ManifestDocumentMapper(); + + $this->expectException(ManifestDocumentMapperException::class); + $mapper->map($manifestDocument); + } + +} diff --git a/vendor/phar-io/manifest/tests/ManifestLoaderTest.php b/vendor/phar-io/manifest/tests/ManifestLoaderTest.php new file mode 100644 index 0000000..919143a --- /dev/null +++ b/vendor/phar-io/manifest/tests/ManifestLoaderTest.php @@ -0,0 +1,83 @@ +assertInstanceOf( + Manifest::class, + ManifestLoader::fromFile(__DIR__ . '/_fixture/library.xml') + ); + } + + public function testCanBeLoadedFromString() { + $this->assertInstanceOf( + Manifest::class, + ManifestLoader::fromString( + file_get_contents(__DIR__ . '/_fixture/library.xml') + ) + ); + } + + public function testCanBeLoadedFromPhar() { + $this->assertInstanceOf( + Manifest::class, + ManifestLoader::fromPhar(__DIR__ . '/_fixture/test.phar') + ); + + } + + public function testLoadingNonExistingFileThrowsException() { + $this->expectException(ManifestLoaderException::class); + ManifestLoader::fromFile('/not/existing'); + } + + /** + * @uses \PharIo\Manifest\ManifestDocumentLoadingException + */ + public function testLoadingInvalidXmlThrowsException() { + $this->expectException(ManifestLoaderException::class); + ManifestLoader::fromString(''); + } + +} diff --git a/vendor/phar-io/manifest/tests/ManifestSerializerTest.php b/vendor/phar-io/manifest/tests/ManifestSerializerTest.php new file mode 100644 index 0000000..5fdf799 --- /dev/null +++ b/vendor/phar-io/manifest/tests/ManifestSerializerTest.php @@ -0,0 +1,114 @@ +assertXmlStringEqualsXmlString( + $expected, + $serializer->serializeToString($manifest) + ); + } + + public function dataProvider() { + return [ + 'application' => [file_get_contents(__DIR__ . '/_fixture/phpunit-5.6.5.xml')], + 'library' => [file_get_contents(__DIR__ . '/_fixture/library.xml')], + 'extension' => [file_get_contents(__DIR__ . '/_fixture/extension.xml')] + ]; + } + + /** + * @uses \PharIo\Manifest\Library + * @uses \PharIo\Manifest\ApplicationName + */ + public function testCanSerializeToFile() { + $src = __DIR__ . '/_fixture/library.xml'; + $dest = '/tmp/' . uniqid('serializer', true); + $manifest = ManifestLoader::fromFile($src); + $serializer = new ManifestSerializer(); + $serializer->serializeToFile($manifest, $dest); + $this->assertXmlFileEqualsXmlFile($src, $dest); + unlink($dest); + } + + /** + * @uses \PharIo\Manifest\ApplicationName + */ + public function testCanHandleUnknownType() { + $type = $this->getMockForAbstractClass(Type::class); + $manifest = new Manifest( + new ApplicationName('testvendor/testname'), + new Version('1.0.0'), + $type, + new CopyrightInformation( + new AuthorCollection(), + new License('bsd-3', new Url('https://some/uri')) + ), + new RequirementCollection(), + new BundledComponentCollection() + ); + + $serializer = new ManifestSerializer(); + $this->assertXmlStringEqualsXmlFile( + __DIR__ . '/_fixture/custom.xml', + $serializer->serializeToString($manifest) + ); + } +} diff --git a/vendor/phar-io/manifest/tests/_fixture/custom.xml b/vendor/phar-io/manifest/tests/_fixture/custom.xml new file mode 100644 index 0000000..4f43828 --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/custom.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/extension-invalidcompatible.xml b/vendor/phar-io/manifest/tests/_fixture/extension-invalidcompatible.xml new file mode 100644 index 0000000..a78111c --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/extension-invalidcompatible.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/extension.xml b/vendor/phar-io/manifest/tests/_fixture/extension.xml new file mode 100644 index 0000000..a870aee --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/extension.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/invalidversion.xml b/vendor/phar-io/manifest/tests/_fixture/invalidversion.xml new file mode 100644 index 0000000..788dd4c --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/invalidversion.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/invalidversionconstraint.xml b/vendor/phar-io/manifest/tests/_fixture/invalidversionconstraint.xml new file mode 100644 index 0000000..f881f8b --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/invalidversionconstraint.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/library.xml b/vendor/phar-io/manifest/tests/_fixture/library.xml new file mode 100644 index 0000000..a5e2523 --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/library.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/manifest.xml b/vendor/phar-io/manifest/tests/_fixture/manifest.xml new file mode 100644 index 0000000..a5e2523 --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/manifest.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/phpunit-5.6.5.xml b/vendor/phar-io/manifest/tests/_fixture/phpunit-5.6.5.xml new file mode 100644 index 0000000..aadbea2 --- /dev/null +++ b/vendor/phar-io/manifest/tests/_fixture/phpunit-5.6.5.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phar-io/manifest/tests/_fixture/test.phar b/vendor/phar-io/manifest/tests/_fixture/test.phar new file mode 100644 index 0000000000000000000000000000000000000000..d2a3e393ea403e5989aafa4b77d6ae6f07aafe75 GIT binary patch literal 7165 zcmb_hOLN=E5%%WD$|a{*%AK%3;(7lrb&`aqnYFsgowah8NyX?lagQ!eX*iR5UevY4qFPB2}|brn?hjcK2IGt z?@K-xy@PIVyOQ#Jl1AH=@1;-nEkA?SmH~CTm!0mF+3o!LW9OpR|JXe?uZ1&~VVrh) z@6X;Uqy-%GKHEVw-gSB=`}~>B3z|VYKfCCetHRN<>W^Y8PbVC<8=)Wa3=x*WtiT6J zX0n}Kwy|C@UGdG#`F(CDf#XLe0T)A)WFhj}+9I%*dyBy1MZh2)Edr;}LU4YcFT%dh z77C<YXkuEZxddIV>yyw$-FyO9B5{HP-*s|7 zj_mu|x6ZATxv8Jz#4_|fhDg(u*uw)jVcq#;CQwRuFiB2AAJS_pu?iNsF_K;?o|ftCbCN(dGrLuj>L!7;6jx#RKFsvbJ-nAZ;D zC{N>{#iF?85@el)lPs^L{MHG4&&hceM4IM2bw;5xMW(%qF>o>-IU&c{*IzANRe?Y? zeg!o>iL(XONYpbFP)#Xnj63%H)S9g{M$W^8*vUdJN^ZGs8c7ZXvdI9Vmdp9^dayNW zL;;Vil5WZxl0`+6M52h=CUqdG0Cj@GVdnc@@7!+In{2buWT){h_t-g4Lnq=<9z2*+ z*P17>JR&VdO=-Ry3qN5;_7KPdEgE4?EyHkNIeKOwn%e@mf$r^bw{wWD_RUO#lYB&k zzyu~Kli_}fsAV{aM_WS|a2DZG>7lJ{uosON>_eQhqj(Z|WF>dUF{`$z@a+CBVr`i-M)_EVbO;kO z|55ss64&tvBxUPJig`$Oe$h^^j9E>jDugB5?c6@{afdZY-{PD&Q>(v3xFHPnN8wDn28KI z&jDxX1Q}n2y2db}Wt^a*=<2x6%ydBKW0-M%V*v%zFAs*T76brnoPcB!C60SznU@%i z#YwjYe&nPNt3%2mN%VpSQzHbn-ZW{v_F^Ogba6cFyl(z-LuR>ga@D-X`O)<)q%%(2 zqKql@c_dM4(7CA2YB41pgdC|xeTNx@2nu#Lrn7BnSp*j2s|E<+LKtX8vskbLGd!PL zW~bXd>$VsQs6XUT1mzhAjB209?wpKOk&1|iEZg8*H>(V7cM^DPz~!#A3x%{wjz@AC zR03dd;F3KQ(L(htz*3j5tBanz{8>F^iVlhGp>2k4*}oD2QaG)`OW zG4KbhC@{>=(0+4qhC7v$X3{8i zjVNh~tY5C`;L+on)4aBWM?cy4qPk@sOEexlZv244;vg4s$iswY0G$&nau*$H#m{gp z^mFo+C5Hl$wi&#D(?>O3FcGVMhH*>Y`M`q|F zet09SBE)sp*xK4!XZn&T6etZVGJxt}&3a4fx@2$(y_d2*=~5~$r|Jx+99IF}3zH*i zx-v`F3k`o*#eEU7WRmw$>Z#K!`eOE)7mYGbeyZS9a?H@k6DlcJW@uhB6eUCE5vYAS|a_J9YJ@K>~a8v^{MKRSE=Sb*sr7I*Uwu(l8ZZMr= z%i$}G7Iabs)cKxqbTt&UFZoK5$*`z&qnKD~LwE#jZI}ov-EkPBqs{vOl3%@gMUut8 zio77qCXed5qROc|f|RSCScr74SL-r^20g6~*7^JM{@De>`kUhqnC+*90VazX>efkR z%Jb;fGJB`zz}lk(E3I48b%zj0F*Oz#peI|1m#P7#O;&>q>ViB!8d9P|ddV4I?-3Kl zQ&cX^lmyHwi1~k^3W~bSnbaUgbIvODMjB{T-z?83`uY_jVCzgwC71-D$r7Zd#uBqj ziMsg$_b(&BoB~x0dRAJ(ptY(CDZX?f zNch4$UQ~!s=+g&Ti72=6@KDNLw7N^JUsGb1S^jt0_J|Pn`Ihmm6IjKd-WI2Fpb*CevfIy~{C2H0jtr`h6@yq~M(9e$K zWE<5(?T-eYqUC5_J&weS5fe}FkrT*ylu?Jk)P;*L<23x@o?b659+F)hFtEgiNQ?Xm zNd(v`y)Mlfj${R*&erPJ6I}k?)ZN^$^nFC?jf^Oz>W@lD2NA^`3uy18WM&&n?z4lzi|L6z-mqe&K}!OLor@q z(PI0PDDWe?I>K2L<|owjtBIa6C9fqT(r{)zQf*d?qSgfd^D~7qO&hCHwKMYz2d=}Q z?f2gwob>vKXQ$`*xupvb+uLnDd-m)r{QsHy#0UOxRClQcvo_6s_>}?|GdzRsRI@nbHZE;6eOG5hlF%GaK|9rA+b(z{ z4|t6j=W;FhI+J{iLm;_!xgYVAeVU+m2hcrq{9vb=3h4f$fYv=;Rr~}!UefU@g}Zxm6e}wU7zj#=PT#mfBgMF{`<|}|Mky@zy1XAdH3e@&Hn(7352Qu literal 0 HcmV?d00001 diff --git a/vendor/phar-io/manifest/tests/exceptions/ManifestDocumentLoadingExceptionTest.php b/vendor/phar-io/manifest/tests/exceptions/ManifestDocumentLoadingExceptionTest.php new file mode 100644 index 0000000..70f7553 --- /dev/null +++ b/vendor/phar-io/manifest/tests/exceptions/ManifestDocumentLoadingExceptionTest.php @@ -0,0 +1,19 @@ +loadXML(''); + $exception = new ManifestDocumentLoadingException(libxml_get_errors()); + libxml_use_internal_errors($prev); + + $this->assertContainsOnlyInstancesOf(LibXMLError::class, $exception->getLibxmlErrors()); + } + +} diff --git a/vendor/phar-io/manifest/tests/values/ApplicationNameTest.php b/vendor/phar-io/manifest/tests/values/ApplicationNameTest.php new file mode 100644 index 0000000..8ed3f3a --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/ApplicationNameTest.php @@ -0,0 +1,57 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +class ApplicationNameTest extends TestCase { + + public function testCanBeCreatedWithValidName() { + $this->assertInstanceOf( + ApplicationName::class, + new ApplicationName('foo/bar') + ); + } + + public function testUsingInvalidFormatForNameThrowsException() { + $this->expectException(InvalidApplicationNameException::class); + $this->expectExceptionCode(InvalidApplicationNameException::InvalidFormat); + new ApplicationName('foo'); + } + + public function testUsingWrongTypeForNameThrowsException() { + $this->expectException(InvalidApplicationNameException::class); + $this->expectExceptionCode(InvalidApplicationNameException::NotAString); + new ApplicationName(123); + } + + public function testReturnsTrueForEqualNamesWhenCompared() { + $app = new ApplicationName('foo/bar'); + $this->assertTrue( + $app->isEqual($app) + ); + } + + public function testReturnsFalseForNonEqualNamesWhenCompared() { + $app1 = new ApplicationName('foo/bar'); + $app2 = new ApplicationName('foo/foo'); + $this->assertFalse( + $app1->isEqual($app2) + ); + } + + public function testCanBeConvertedToString() { + $this->assertEquals( + 'foo/bar', + new ApplicationName('foo/bar') + ); + } +} diff --git a/vendor/phar-io/manifest/tests/values/ApplicationTest.php b/vendor/phar-io/manifest/tests/values/ApplicationTest.php new file mode 100644 index 0000000..86b5da6 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/ApplicationTest.php @@ -0,0 +1,44 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\Application + * @covers PharIo\Manifest\Type + */ +class ApplicationTest extends TestCase { + /** + * @var Application + */ + private $type; + + protected function setUp() { + $this->type = Type::application(); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(Application::class, $this->type); + } + + public function testIsApplication() { + $this->assertTrue($this->type->isApplication()); + } + + public function testIsNotLibrary() { + $this->assertFalse($this->type->isLibrary()); + } + + public function testIsNotExtension() { + $this->assertFalse($this->type->isExtension()); + } +} diff --git a/vendor/phar-io/manifest/tests/values/AuthorCollectionTest.php b/vendor/phar-io/manifest/tests/values/AuthorCollectionTest.php new file mode 100644 index 0000000..0fa1b95 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/AuthorCollectionTest.php @@ -0,0 +1,62 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Manifest\AuthorCollection + * @covers \PharIo\Manifest\AuthorCollectionIterator + * + * @uses \PharIo\Manifest\Author + * @uses \PharIo\Manifest\Email + */ +class AuthorCollectionTest extends TestCase { + /** + * @var AuthorCollection + */ + private $collection; + + /** + * @var Author + */ + private $item; + + protected function setUp() { + $this->collection = new AuthorCollection; + $this->item = new Author('Joe Developer', new Email('user@example.com')); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(AuthorCollection::class, $this->collection); + } + + public function testCanBeCounted() { + $this->collection->add($this->item); + + $this->assertCount(1, $this->collection); + } + + public function testCanBeIterated() { + $this->collection->add( + new Author('Dummy First', new Email('dummy@example.com')) + ); + $this->collection->add($this->item); + $this->assertContains($this->item, $this->collection); + } + + public function testKeyPositionCanBeRetreived() { + $this->collection->add($this->item); + foreach($this->collection as $key => $item) { + $this->assertEquals(0, $key); + } + } +} diff --git a/vendor/phar-io/manifest/tests/values/AuthorTest.php b/vendor/phar-io/manifest/tests/values/AuthorTest.php new file mode 100644 index 0000000..b7317fa --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/AuthorTest.php @@ -0,0 +1,45 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\Author + * + * @uses PharIo\Manifest\Email + */ +class AuthorTest extends TestCase { + /** + * @var Author + */ + private $author; + + protected function setUp() { + $this->author = new Author('Joe Developer', new Email('user@example.com')); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(Author::class, $this->author); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals('Joe Developer', $this->author->getName()); + } + + public function testEmailCanBeRetrieved() { + $this->assertEquals('user@example.com', $this->author->getEmail()); + } + + public function testCanBeUsedAsString() { + $this->assertEquals('Joe Developer ', $this->author); + } +} diff --git a/vendor/phar-io/manifest/tests/values/BundledComponentCollectionTest.php b/vendor/phar-io/manifest/tests/values/BundledComponentCollectionTest.php new file mode 100644 index 0000000..66cd0c4 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/BundledComponentCollectionTest.php @@ -0,0 +1,63 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\Version; +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Manifest\BundledComponentCollection + * @covers \PharIo\Manifest\BundledComponentCollectionIterator + * + * @uses \PharIo\Manifest\BundledComponent + * @uses \PharIo\Version\Version + */ +class BundledComponentCollectionTest extends TestCase { + /** + * @var BundledComponentCollection + */ + private $collection; + + /** + * @var BundledComponent + */ + private $item; + + protected function setUp() { + $this->collection = new BundledComponentCollection; + $this->item = new BundledComponent('phpunit/php-code-coverage', new Version('4.0.2')); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(BundledComponentCollection::class, $this->collection); + } + + public function testCanBeCounted() { + $this->collection->add($this->item); + + $this->assertCount(1, $this->collection); + } + + public function testCanBeIterated() { + $this->collection->add($this->createMock(BundledComponent::class)); + $this->collection->add($this->item); + + $this->assertContains($this->item, $this->collection); + } + + public function testKeyPositionCanBeRetreived() { + $this->collection->add($this->item); + foreach($this->collection as $key => $item) { + $this->assertEquals(0, $key); + } + } + +} diff --git a/vendor/phar-io/manifest/tests/values/BundledComponentTest.php b/vendor/phar-io/manifest/tests/values/BundledComponentTest.php new file mode 100644 index 0000000..01b8e13 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/BundledComponentTest.php @@ -0,0 +1,42 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\Version; +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\BundledComponent + * + * @uses \PharIo\Version\Version + */ +class BundledComponentTest extends TestCase { + /** + * @var BundledComponent + */ + private $bundledComponent; + + protected function setUp() { + $this->bundledComponent = new BundledComponent('phpunit/php-code-coverage', new Version('4.0.2')); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(BundledComponent::class, $this->bundledComponent); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals('phpunit/php-code-coverage', $this->bundledComponent->getName()); + } + + public function testVersionCanBeRetrieved() { + $this->assertEquals('4.0.2', $this->bundledComponent->getVersion()->getVersionString()); + } +} diff --git a/vendor/phar-io/manifest/tests/values/CopyrightInformationTest.php b/vendor/phar-io/manifest/tests/values/CopyrightInformationTest.php new file mode 100644 index 0000000..de738f4 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/CopyrightInformationTest.php @@ -0,0 +1,62 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\CopyrightInformation + * + * @uses PharIo\Manifest\AuthorCollection + * @uses PharIo\Manifest\AuthorCollectionIterator + * @uses PharIo\Manifest\Author + * @uses PharIo\Manifest\Email + * @uses PharIo\Manifest\License + * @uses PharIo\Manifest\Url + */ +class CopyrightInformationTest extends TestCase { + /** + * @var CopyrightInformation + */ + private $copyrightInformation; + + /** + * @var Author + */ + private $author; + + /** + * @var License + */ + private $license; + + protected function setUp() { + $this->author = new Author('Joe Developer', new Email('user@example.com')); + $this->license = new License('BSD-3-Clause', new Url('https://github.com/sebastianbergmann/phpunit/blob/master/LICENSE')); + + $authors = new AuthorCollection; + $authors->add($this->author); + + $this->copyrightInformation = new CopyrightInformation($authors, $this->license); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(CopyrightInformation::class, $this->copyrightInformation); + } + + public function testAuthorsCanBeRetrieved() { + $this->assertContains($this->author, $this->copyrightInformation->getAuthors()); + } + + public function testLicenseCanBeRetrieved() { + $this->assertEquals($this->license, $this->copyrightInformation->getLicense()); + } +} diff --git a/vendor/phar-io/manifest/tests/values/EmailTest.php b/vendor/phar-io/manifest/tests/values/EmailTest.php new file mode 100644 index 0000000..ee38531 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/EmailTest.php @@ -0,0 +1,35 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\Email + */ +class EmailTest extends TestCase { + public function testCanBeCreatedForValidEmail() { + $this->assertInstanceOf(Email::class, new Email('user@example.com')); + } + + public function testCanBeUsedAsString() { + $this->assertEquals('user@example.com', new Email('user@example.com')); + } + + /** + * @covers PharIo\Manifest\InvalidEmailException + */ + public function testCannotBeCreatedForInvalidEmail() { + $this->expectException(InvalidEmailException::class); + + new Email('invalid'); + } +} diff --git a/vendor/phar-io/manifest/tests/values/ExtensionTest.php b/vendor/phar-io/manifest/tests/values/ExtensionTest.php new file mode 100644 index 0000000..1c9d676 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/ExtensionTest.php @@ -0,0 +1,109 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\AnyVersionConstraint; +use PharIo\Version\Version; +use PharIo\Version\VersionConstraint; +use PharIo\Version\VersionConstraintParser; +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Manifest\Extension + * @covers \PharIo\Manifest\Type + * + * @uses \PharIo\Version\VersionConstraint + * @uses \PharIo\Manifest\ApplicationName + */ +class ExtensionTest extends TestCase { + /** + * @var Extension + */ + private $type; + + /** + * @var ApplicationName|\PHPUnit_Framework_MockObject_MockObject + */ + private $name; + + protected function setUp() { + $this->name = $this->createMock(ApplicationName::class); + $this->type = Type::extension($this->name, new AnyVersionConstraint); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(Extension::class, $this->type); + } + + public function testIsNotApplication() { + $this->assertFalse($this->type->isApplication()); + } + + public function testIsNotLibrary() { + $this->assertFalse($this->type->isLibrary()); + } + + public function testIsExtension() { + $this->assertTrue($this->type->isExtension()); + } + + public function testApplicationCanBeRetrieved() + { + $this->assertInstanceOf(ApplicationName::class, $this->type->getApplicationName()); + } + + public function testVersionConstraintCanBeRetrieved() { + $this->assertInstanceOf( + VersionConstraint::class, + $this->type->getVersionConstraint() + ); + } + + public function testApplicationCanBeQueried() + { + $this->name->method('isEqual')->willReturn(true); + $this->assertTrue( + $this->type->isExtensionFor($this->createMock(ApplicationName::class)) + ); + } + + public function testCompatibleWithReturnsTrueForMatchingVersionConstraintAndApplicaiton() { + $app = new ApplicationName('foo/bar'); + $extension = Type::extension($app, (new VersionConstraintParser)->parse('^1.0')); + $version = new Version('1.0.0'); + + $this->assertTrue( + $extension->isCompatibleWith($app, $version) + ); + } + + public function testCompatibleWithReturnsFalseForNotMatchingVersionConstraint() { + $app = new ApplicationName('foo/bar'); + $extension = Type::extension($app, (new VersionConstraintParser)->parse('^1.0')); + $version = new Version('2.0.0'); + + $this->assertFalse( + $extension->isCompatibleWith($app, $version) + ); + } + + public function testCompatibleWithReturnsFalseForNotMatchingApplication() { + $app1 = new ApplicationName('foo/bar'); + $app2 = new ApplicationName('foo/foo'); + $extension = Type::extension($app1, (new VersionConstraintParser)->parse('^1.0')); + $version = new Version('1.0.0'); + + $this->assertFalse( + $extension->isCompatibleWith($app2, $version) + ); + } + +} diff --git a/vendor/phar-io/manifest/tests/values/LibraryTest.php b/vendor/phar-io/manifest/tests/values/LibraryTest.php new file mode 100644 index 0000000..f8d1c64 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/LibraryTest.php @@ -0,0 +1,44 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\Library + * @covers PharIo\Manifest\Type + */ +class LibraryTest extends TestCase { + /** + * @var Library + */ + private $type; + + protected function setUp() { + $this->type = Type::library(); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(Library::class, $this->type); + } + + public function testIsNotApplication() { + $this->assertFalse($this->type->isApplication()); + } + + public function testIsLibrary() { + $this->assertTrue($this->type->isLibrary()); + } + + public function testIsNotExtension() { + $this->assertFalse($this->type->isExtension()); + } +} diff --git a/vendor/phar-io/manifest/tests/values/LicenseTest.php b/vendor/phar-io/manifest/tests/values/LicenseTest.php new file mode 100644 index 0000000..c9c5c3c --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/LicenseTest.php @@ -0,0 +1,41 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\License + * + * @uses PharIo\Manifest\Url + */ +class LicenseTest extends TestCase { + /** + * @var License + */ + private $license; + + protected function setUp() { + $this->license = new License('BSD-3-Clause', new Url('https://github.com/sebastianbergmann/phpunit/blob/master/LICENSE')); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(License::class, $this->license); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals('BSD-3-Clause', $this->license->getName()); + } + + public function testUrlCanBeRetrieved() { + $this->assertEquals('https://github.com/sebastianbergmann/phpunit/blob/master/LICENSE', $this->license->getUrl()); + } +} diff --git a/vendor/phar-io/manifest/tests/values/ManifestTest.php b/vendor/phar-io/manifest/tests/values/ManifestTest.php new file mode 100644 index 0000000..cff0a68 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/ManifestTest.php @@ -0,0 +1,187 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\Version; +use PharIo\Version\AnyVersionConstraint; +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Manifest\Manifest + * + * @uses \PharIo\Manifest\ApplicationName + * @uses \PharIo\Manifest\Author + * @uses \PharIo\Manifest\AuthorCollection + * @uses \PharIo\Manifest\BundledComponent + * @uses \PharIo\Manifest\BundledComponentCollection + * @uses \PharIo\Manifest\CopyrightInformation + * @uses \PharIo\Manifest\Email + * @uses \PharIo\Manifest\License + * @uses \PharIo\Manifest\RequirementCollection + * @uses \PharIo\Manifest\PhpVersionRequirement + * @uses \PharIo\Manifest\Type + * @uses \PharIo\Manifest\Application + * @uses \PharIo\Manifest\Url + * @uses \PharIo\Version\Version + * @uses \PharIo\Version\VersionConstraint + */ +class ManifestTest extends TestCase { + /** + * @var ApplicationName + */ + private $name; + + /** + * @var Version + */ + private $version; + + /** + * @var Type + */ + private $type; + + /** + * @var CopyrightInformation + */ + private $copyrightInformation; + + /** + * @var RequirementCollection + */ + private $requirements; + + /** + * @var BundledComponentCollection + */ + private $bundledComponents; + + /** + * @var Manifest + */ + private $manifest; + + protected function setUp() { + $this->version = new Version('5.6.5'); + + $this->type = Type::application(); + + $author = new Author('Joe Developer', new Email('user@example.com')); + $license = new License('BSD-3-Clause', new Url('https://github.com/sebastianbergmann/phpunit/blob/master/LICENSE')); + + $authors = new AuthorCollection; + $authors->add($author); + + $this->copyrightInformation = new CopyrightInformation($authors, $license); + + $this->requirements = new RequirementCollection; + $this->requirements->add(new PhpVersionRequirement(new AnyVersionConstraint)); + + $this->bundledComponents = new BundledComponentCollection; + $this->bundledComponents->add(new BundledComponent('phpunit/php-code-coverage', new Version('4.0.2'))); + + $this->name = new ApplicationName('phpunit/phpunit'); + + $this->manifest = new Manifest( + $this->name, + $this->version, + $this->type, + $this->copyrightInformation, + $this->requirements, + $this->bundledComponents + ); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(Manifest::class, $this->manifest); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals($this->name, $this->manifest->getName()); + } + + public function testVersionCanBeRetrieved() { + $this->assertEquals($this->version, $this->manifest->getVersion()); + } + + public function testTypeCanBeRetrieved() { + $this->assertEquals($this->type, $this->manifest->getType()); + } + + public function testTypeCanBeQueried() { + $this->assertTrue($this->manifest->isApplication()); + $this->assertFalse($this->manifest->isLibrary()); + $this->assertFalse($this->manifest->isExtension()); + } + + public function testCopyrightInformationCanBeRetrieved() { + $this->assertEquals($this->copyrightInformation, $this->manifest->getCopyrightInformation()); + } + + public function testRequirementsCanBeRetrieved() { + $this->assertEquals($this->requirements, $this->manifest->getRequirements()); + } + + public function testBundledComponentsCanBeRetrieved() { + $this->assertEquals($this->bundledComponents, $this->manifest->getBundledComponents()); + } + + /** + * @uses \PharIo\Manifest\Extension + */ + public function testExtendedApplicationCanBeQueriedForExtension() + { + $appName = new ApplicationName('foo/bar'); + $manifest = new Manifest( + new ApplicationName('foo/foo'), + new Version('1.0.0'), + Type::extension($appName, new AnyVersionConstraint), + $this->copyrightInformation, + new RequirementCollection, + new BundledComponentCollection + ); + + $this->assertTrue($manifest->isExtensionFor($appName)); + } + + public function testNonExtensionReturnsFalseWhenQueriesForExtension() { + $appName = new ApplicationName('foo/bar'); + $manifest = new Manifest( + new ApplicationName('foo/foo'), + new Version('1.0.0'), + Type::library(), + $this->copyrightInformation, + new RequirementCollection, + new BundledComponentCollection + ); + + $this->assertFalse($manifest->isExtensionFor($appName)); + } + + /** + * @uses \PharIo\Manifest\Extension + */ + public function testExtendedApplicationCanBeQueriedForExtensionWithVersion() + { + $appName = new ApplicationName('foo/bar'); + $manifest = new Manifest( + new ApplicationName('foo/foo'), + new Version('1.0.0'), + Type::extension($appName, new AnyVersionConstraint), + $this->copyrightInformation, + new RequirementCollection, + new BundledComponentCollection + ); + + $this->assertTrue($manifest->isExtensionFor($appName, new Version('1.2.3'))); + } + +} diff --git a/vendor/phar-io/manifest/tests/values/PhpExtensionRequirementTest.php b/vendor/phar-io/manifest/tests/values/PhpExtensionRequirementTest.php new file mode 100644 index 0000000..ae1c058 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/PhpExtensionRequirementTest.php @@ -0,0 +1,26 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\PhpExtensionRequirement + */ +class PhpExtensionRequirementTest extends TestCase { + public function testCanBeCreated() { + $this->assertInstanceOf(PhpExtensionRequirement::class, new PhpExtensionRequirement('dom')); + } + + public function testCanBeUsedAsString() { + $this->assertEquals('dom', new PhpExtensionRequirement('dom')); + } +} diff --git a/vendor/phar-io/manifest/tests/values/PhpVersionRequirementTest.php b/vendor/phar-io/manifest/tests/values/PhpVersionRequirementTest.php new file mode 100644 index 0000000..67ac41a --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/PhpVersionRequirementTest.php @@ -0,0 +1,38 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\ExactVersionConstraint; +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\PhpVersionRequirement + * + * @uses \PharIo\Version\VersionConstraint + */ +class PhpVersionRequirementTest extends TestCase { + /** + * @var PhpVersionRequirement + */ + private $requirement; + + protected function setUp() { + $this->requirement = new PhpVersionRequirement(new ExactVersionConstraint('7.1.0')); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(PhpVersionRequirement::class, $this->requirement); + } + + public function testVersionConstraintCanBeRetrieved() { + $this->assertEquals('7.1.0', $this->requirement->getVersionConstraint()->asString()); + } +} diff --git a/vendor/phar-io/manifest/tests/values/RequirementCollectionTest.php b/vendor/phar-io/manifest/tests/values/RequirementCollectionTest.php new file mode 100644 index 0000000..2afeb1a --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/RequirementCollectionTest.php @@ -0,0 +1,63 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PharIo\Version\ExactVersionConstraint; +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Manifest\RequirementCollection + * @covers \PharIo\Manifest\RequirementCollectionIterator + * + * @uses \PharIo\Manifest\PhpVersionRequirement + * @uses \PharIo\Version\VersionConstraint + */ +class RequirementCollectionTest extends TestCase { + /** + * @var RequirementCollection + */ + private $collection; + + /** + * @var Requirement + */ + private $item; + + protected function setUp() { + $this->collection = new RequirementCollection; + $this->item = new PhpVersionRequirement(new ExactVersionConstraint('7.1.0')); + } + + public function testCanBeCreated() { + $this->assertInstanceOf(RequirementCollection::class, $this->collection); + } + + public function testCanBeCounted() { + $this->collection->add($this->item); + + $this->assertCount(1, $this->collection); + } + + public function testCanBeIterated() { + $this->collection->add(new PhpVersionRequirement(new ExactVersionConstraint('5.6.0'))); + $this->collection->add($this->item); + + $this->assertContains($this->item, $this->collection); + } + + public function testKeyPositionCanBeRetreived() { + $this->collection->add($this->item); + foreach($this->collection as $key => $item) { + $this->assertEquals(0, $key); + } + } + +} diff --git a/vendor/phar-io/manifest/tests/values/UrlTest.php b/vendor/phar-io/manifest/tests/values/UrlTest.php new file mode 100644 index 0000000..20f09c1 --- /dev/null +++ b/vendor/phar-io/manifest/tests/values/UrlTest.php @@ -0,0 +1,35 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Manifest; + +use PHPUnit\Framework\TestCase; + +/** + * @covers PharIo\Manifest\Url + */ +class UrlTest extends TestCase { + public function testCanBeCreatedForValidUrl() { + $this->assertInstanceOf(Url::class, new Url('https://phar.io/')); + } + + public function testCanBeUsedAsString() { + $this->assertEquals('https://phar.io/', new Url('https://phar.io/')); + } + + /** + * @covers PharIo\Manifest\InvalidUrlException + */ + public function testCannotBeCreatedForInvalidUrl() { + $this->expectException(InvalidUrlException::class); + + new Url('invalid'); + } +} diff --git a/vendor/phar-io/manifest/tests/xml/AuthorElementCollectionTest.php b/vendor/phar-io/manifest/tests/xml/AuthorElementCollectionTest.php new file mode 100644 index 0000000..588558e --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/AuthorElementCollectionTest.php @@ -0,0 +1,18 @@ +loadXML(''); + $collection = new AuthorElementCollection($dom->childNodes); + + foreach($collection as $authorElement) { + $this->assertInstanceOf(AuthorElement::class, $authorElement); + } + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/AuthorElementTest.php b/vendor/phar-io/manifest/tests/xml/AuthorElementTest.php new file mode 100644 index 0000000..6fce1d4 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/AuthorElementTest.php @@ -0,0 +1,25 @@ +loadXML(''); + $this->author = new AuthorElement($dom->documentElement); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals('Reiner Zufall', $this->author->getName()); + } + + public function testEmailCanBeRetrieved() { + $this->assertEquals('reiner@zufall.de', $this->author->getEmail()); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/BundlesElementTest.php b/vendor/phar-io/manifest/tests/xml/BundlesElementTest.php new file mode 100644 index 0000000..7872795 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/BundlesElementTest.php @@ -0,0 +1,41 @@ +dom = new DOMDocument(); + $this->dom->loadXML(''); + $this->bundles = new BundlesElement($this->dom->documentElement); + } + + public function testThrowsExceptionWhenGetComponentElementsIsCalledButNodesAreMissing() { + $this->expectException(ManifestElementException::class); + $this->bundles->getComponentElements(); + } + + public function testGetComponentElementsReturnsComponentElementCollection() { + $this->addComponent(); + $this->assertInstanceOf( + ComponentElementCollection::class, $this->bundles->getComponentElements() + ); + } + + private function addComponent() { + $this->dom->documentElement->appendChild( + $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'component') + ); + } +} diff --git a/vendor/phar-io/manifest/tests/xml/ComponentElementCollectionTest.php b/vendor/phar-io/manifest/tests/xml/ComponentElementCollectionTest.php new file mode 100644 index 0000000..9fe2378 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/ComponentElementCollectionTest.php @@ -0,0 +1,18 @@ +loadXML(''); + $collection = new ComponentElementCollection($dom->childNodes); + + foreach($collection as $componentElement) { + $this->assertInstanceOf(ComponentElement::class, $componentElement); + } + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/ComponentElementTest.php b/vendor/phar-io/manifest/tests/xml/ComponentElementTest.php new file mode 100644 index 0000000..1996585 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/ComponentElementTest.php @@ -0,0 +1,25 @@ +loadXML(''); + $this->component = new ComponentElement($dom->documentElement); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals('phar-io/phive', $this->component->getName()); + } + + public function testEmailCanBeRetrieved() { + $this->assertEquals('0.6.0', $this->component->getVersion()); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/ContainsElementTest.php b/vendor/phar-io/manifest/tests/xml/ContainsElementTest.php new file mode 100644 index 0000000..ed08600 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/ContainsElementTest.php @@ -0,0 +1,63 @@ +loadXML(''); + $this->domElement = $dom->documentElement; + $this->contains = new ContainsElement($this->domElement); + } + + public function testVersionCanBeRetrieved() { + $this->assertEquals('5.6.5', $this->contains->getVersion()); + } + + public function testThrowsExceptionWhenVersionAttributeIsMissing() { + $this->domElement->removeAttribute('version'); + $this->expectException(ManifestElementException::class); + $this->contains->getVersion(); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals('phpunit/phpunit', $this->contains->getName()); + } + + public function testThrowsExceptionWhenNameAttributeIsMissing() { + $this->domElement->removeAttribute('name'); + $this->expectException(ManifestElementException::class); + $this->contains->getName(); + } + + public function testTypeCanBeRetrieved() { + $this->assertEquals('application', $this->contains->getType()); + } + + public function testThrowsExceptionWhenTypeAttributeIsMissing() { + $this->domElement->removeAttribute('type'); + $this->expectException(ManifestElementException::class); + $this->contains->getType(); + } + + public function testGetExtensionElementReturnsExtensionElement() { + $this->domElement->appendChild( + $this->domElement->ownerDocument->createElementNS('https://phar.io/xml/manifest/1.0', 'extension') + ); + $this->assertInstanceOf(ExtensionElement::class, $this->contains->getExtensionElement()); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/CopyrightElementTest.php b/vendor/phar-io/manifest/tests/xml/CopyrightElementTest.php new file mode 100644 index 0000000..c74a2ce --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/CopyrightElementTest.php @@ -0,0 +1,52 @@ +dom = new DOMDocument(); + $this->dom->loadXML(''); + $this->copyright = new CopyrightElement($this->dom->documentElement); + } + + public function testThrowsExceptionWhenGetAuthroElementsIsCalledButNodesAreMissing() { + $this->expectException(ManifestElementException::class); + $this->copyright->getAuthorElements(); + } + + public function testThrowsExceptionWhenGetLicenseElementIsCalledButNodeIsMissing() { + $this->expectException(ManifestElementException::class); + $this->copyright->getLicenseElement(); + } + + public function testGetAuthorElementsReturnsAuthorElementCollection() { + $this->dom->documentElement->appendChild( + $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'author') + ); + $this->assertInstanceOf( + AuthorElementCollection::class, $this->copyright->getAuthorElements() + ); + } + + public function testGetLicenseElementReturnsLicenseElement() { + $this->dom->documentElement->appendChild( + $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'license') + ); + $this->assertInstanceOf( + LicenseElement::class, $this->copyright->getLicenseElement() + ); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/ExtElementCollectionTest.php b/vendor/phar-io/manifest/tests/xml/ExtElementCollectionTest.php new file mode 100644 index 0000000..7a456d2 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/ExtElementCollectionTest.php @@ -0,0 +1,19 @@ +loadXML(''); + $collection = new ExtElementCollection($dom->childNodes); + + foreach($collection as $position => $extElement) { + $this->assertInstanceOf(ExtElement::class, $extElement); + $this->assertEquals(0, $position); + } + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/ExtElementTest.php b/vendor/phar-io/manifest/tests/xml/ExtElementTest.php new file mode 100644 index 0000000..db6ecbc --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/ExtElementTest.php @@ -0,0 +1,21 @@ +loadXML(''); + $this->ext = new ExtElement($dom->documentElement); + } + + public function testNameCanBeRetrieved() { + $this->assertEquals('dom', $this->ext->getName()); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/ExtensionElementTest.php b/vendor/phar-io/manifest/tests/xml/ExtensionElementTest.php new file mode 100644 index 0000000..58965d8 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/ExtensionElementTest.php @@ -0,0 +1,25 @@ +loadXML(''); + $this->extension = new ExtensionElement($dom->documentElement); + } + + public function testNForCanBeRetrieved() { + $this->assertEquals('phar-io/phive', $this->extension->getFor()); + } + + public function testCompatibleVersionConstraintCanBeRetrieved() { + $this->assertEquals('~0.6', $this->extension->getCompatible()); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/LicenseElementTest.php b/vendor/phar-io/manifest/tests/xml/LicenseElementTest.php new file mode 100644 index 0000000..5b1ffcb --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/LicenseElementTest.php @@ -0,0 +1,25 @@ +loadXML(''); + $this->license = new LicenseElement($dom->documentElement); + } + + public function testTypeCanBeRetrieved() { + $this->assertEquals('BSD-3', $this->license->getType()); + } + + public function testUrlCanBeRetrieved() { + $this->assertEquals('https://some.tld/LICENSE', $this->license->getUrl()); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/ManifestDocumentTest.php b/vendor/phar-io/manifest/tests/xml/ManifestDocumentTest.php new file mode 100644 index 0000000..3dd59bf --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/ManifestDocumentTest.php @@ -0,0 +1,110 @@ +expectException(ManifestDocumentException::class); + ManifestDocument::fromFile('/does/not/exist'); + } + + public function testCanBeCreatedFromFile() { + $this->assertInstanceOf( + ManifestDocument::class, + ManifestDocument::fromFile(__DIR__ . '/../_fixture/phpunit-5.6.5.xml') + ); + } + + public function testCaneBeConstructedFromString() { + $content = file_get_contents(__DIR__ . '/../_fixture/phpunit-5.6.5.xml'); + $this->assertInstanceOf( + ManifestDocument::class, + ManifestDocument::fromString($content) + ); + } + + public function testThrowsExceptionOnInvalidXML() { + $this->expectException(ManifestDocumentLoadingException::class); + ManifestDocument::fromString(''); + } + + public function testLoadingDocumentWithWrongRootNameThrowsException() { + $this->expectException(ManifestDocumentException::class); + ManifestDocument::fromString(''); + } + + public function testLoadingDocumentWithWrongNamespaceThrowsException() { + $this->expectException(ManifestDocumentException::class); + ManifestDocument::fromString(''); + } + + public function testContainsElementCanBeRetrieved() { + $this->assertInstanceOf( + ContainsElement::class, + $this->loadFixture()->getContainsElement() + ); + } + + public function testRequiresElementCanBeRetrieved() { + $this->assertInstanceOf( + RequiresElement::class, + $this->loadFixture()->getRequiresElement() + ); + } + + public function testCopyrightElementCanBeRetrieved() { + $this->assertInstanceOf( + CopyrightElement::class, + $this->loadFixture()->getCopyrightElement() + ); + } + + public function testBundlesElementCanBeRetrieved() { + $this->assertInstanceOf( + BundlesElement::class, + $this->loadFixture()->getBundlesElement() + ); + } + + public function testThrowsExceptionWhenContainsIsMissing() { + $this->expectException(ManifestDocumentException::class); + $this->loadEmptyFixture()->getContainsElement(); + } + + public function testThrowsExceptionWhenCopyirhgtIsMissing() { + $this->expectException(ManifestDocumentException::class); + $this->loadEmptyFixture()->getCopyrightElement(); + } + + public function testThrowsExceptionWhenRequiresIsMissing() { + $this->expectException(ManifestDocumentException::class); + $this->loadEmptyFixture()->getRequiresElement(); + } + + public function testThrowsExceptionWhenBundlesIsMissing() { + $this->expectException(ManifestDocumentException::class); + $this->loadEmptyFixture()->getBundlesElement(); + } + + public function testHasBundlesReturnsTrueWhenBundlesNodeIsPresent() { + $this->assertTrue( + $this->loadFixture()->hasBundlesElement() + ); + } + + public function testHasBundlesReturnsFalseWhenBundlesNoNodeIsPresent() { + $this->assertFalse( + $this->loadEmptyFixture()->hasBundlesElement() + ); + } + + private function loadFixture() { + return ManifestDocument::fromFile(__DIR__ . '/../_fixture/phpunit-5.6.5.xml'); + } + + private function loadEmptyFixture() { + return ManifestDocument::fromString( + '' + ); + } +} diff --git a/vendor/phar-io/manifest/tests/xml/PhpElementTest.php b/vendor/phar-io/manifest/tests/xml/PhpElementTest.php new file mode 100644 index 0000000..62dd359 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/PhpElementTest.php @@ -0,0 +1,48 @@ +dom = new DOMDocument(); + $this->dom->loadXML(''); + $this->php = new PhpElement($this->dom->documentElement); + } + + public function testVersionConstraintCanBeRetrieved() { + $this->assertEquals('^5.6 || ^7.0', $this->php->getVersion()); + } + + public function testHasExtElementsReturnsFalseWhenNoExtensionsAreRequired() { + $this->assertFalse($this->php->hasExtElements()); + } + + public function testHasExtElementsReturnsTrueWhenExtensionsAreRequired() { + $this->addExtElement(); + $this->assertTrue($this->php->hasExtElements()); + } + + public function testGetExtElementsReturnsExtElementCollection() { + $this->addExtElement(); + $this->assertInstanceOf(ExtElementCollection::class, $this->php->getExtElements()); + } + + private function addExtElement() { + $this->dom->documentElement->appendChild( + $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'ext') + ); + } + +} diff --git a/vendor/phar-io/manifest/tests/xml/RequiresElementTest.php b/vendor/phar-io/manifest/tests/xml/RequiresElementTest.php new file mode 100644 index 0000000..35ddc82 --- /dev/null +++ b/vendor/phar-io/manifest/tests/xml/RequiresElementTest.php @@ -0,0 +1,37 @@ +dom = new DOMDocument(); + $this->dom->loadXML(''); + $this->requires = new RequiresElement($this->dom->documentElement); + } + + public function testThrowsExceptionWhenGetPhpElementIsCalledButElementIsMissing() { + $this->expectException(ManifestElementException::class); + $this->requires->getPHPElement(); + } + + public function testHasExtElementsReturnsTrueWhenExtensionsAreRequired() { + $this->dom->documentElement->appendChild( + $this->dom->createElementNS('https://phar.io/xml/manifest/1.0', 'php') + ); + + $this->assertInstanceOf(PhpElement::class, $this->requires->getPHPElement()); + } + +} diff --git a/vendor/phar-io/version/.gitignore b/vendor/phar-io/version/.gitignore new file mode 100644 index 0000000..1c8f2e6 --- /dev/null +++ b/vendor/phar-io/version/.gitignore @@ -0,0 +1,7 @@ +/.idea +/.php_cs.cache +/composer.lock +/src/autoload.php +/tools +/vendor + diff --git a/vendor/phar-io/version/.php_cs b/vendor/phar-io/version/.php_cs new file mode 100644 index 0000000..159d6a3 --- /dev/null +++ b/vendor/phar-io/version/.php_cs @@ -0,0 +1,67 @@ +files() + ->in('src') + ->in('tests') + ->name('*.php'); + +return Symfony\CS\Config\Config::create() + ->setUsingCache(true) + ->level(\Symfony\CS\FixerInterface::NONE_LEVEL) + ->fixers( + array( + 'align_double_arrow', + 'align_equals', + 'concat_with_spaces', + 'duplicate_semicolon', + 'elseif', + 'empty_return', + 'encoding', + 'eof_ending', + 'extra_empty_lines', + 'function_call_space', + 'function_declaration', + 'indentation', + 'join_function', + 'line_after_namespace', + 'linefeed', + 'list_commas', + 'lowercase_constants', + 'lowercase_keywords', + 'method_argument_space', + 'multiple_use', + 'namespace_no_leading_whitespace', + 'no_blank_lines_after_class_opening', + 'no_empty_lines_after_phpdocs', + 'parenthesis', + 'php_closing_tag', + 'phpdoc_indent', + 'phpdoc_no_access', + 'phpdoc_no_empty_return', + 'phpdoc_no_package', + 'phpdoc_params', + 'phpdoc_scalar', + 'phpdoc_separation', + 'phpdoc_to_comment', + 'phpdoc_trim', + 'phpdoc_types', + 'phpdoc_var_without_name', + 'remove_lines_between_uses', + 'return', + 'self_accessor', + 'short_array_syntax', + 'short_tag', + 'single_line_after_imports', + 'single_quote', + 'spaces_before_semicolon', + 'spaces_cast', + 'ternary_spaces', + 'trailing_spaces', + 'trim_array_spaces', + 'unused_use', + 'visibility', + 'whitespacy_lines' + ) + ) + ->finder($finder); + diff --git a/vendor/phar-io/version/.travis.yml b/vendor/phar-io/version/.travis.yml new file mode 100644 index 0000000..b4be10f --- /dev/null +++ b/vendor/phar-io/version/.travis.yml @@ -0,0 +1,33 @@ +os: +- linux + +language: php + +before_install: + - wget https://phar.io/releases/phive.phar + - wget https://phar.io/releases/phive.phar.asc + - gpg --keyserver hkps.pool.sks-keyservers.net --recv-keys 0x9B2D5D79 + - gpg --verify phive.phar.asc phive.phar + - chmod +x phive.phar + - sudo mv phive.phar /usr/bin/phive + +install: + - ant setup + +script: ./tools/phpunit + +php: + - 5.6 + - 7.0 + - 7.1 + - 7.0snapshot + - 7.1snapshot + - master + +matrix: + allow_failures: + - php: master + fast_finish: true + +notifications: + email: false diff --git a/vendor/phar-io/version/CHANGELOG.md b/vendor/phar-io/version/CHANGELOG.md new file mode 100644 index 0000000..ab9df36 --- /dev/null +++ b/vendor/phar-io/version/CHANGELOG.md @@ -0,0 +1,44 @@ +# Changelog + +All notable changes to phar-io/version are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [2.0.1] - 08.07.2018 + +### Fixed + +- Versions without a pre-release suffix are now always considered greater +than versions without a pre-release suffix. Example: `3.0.0 > 3.0.0-alpha.1` + +## [2.0.0] - 23.06.2018 + +Changes to public API: + +- `PreReleaseSuffix::construct()`: optional parameter `$number` removed +- `PreReleaseSuffix::isGreaterThan()`: introduced +- `Version::hasPreReleaseSuffix()`: introduced + +### Added + +- [#11](https://github.com/phar-io/version/issues/11): Added support for pre-release version suffixes. Supported values are: + - `dev` + - `beta` (also abbreviated form `b`) + - `rc` + - `alpha` (also abbreviated form `a`) + - `patch` (also abbreviated form `p`) + + All values can be followed by a number, e.g. `beta3`. + + When comparing versions, the pre-release suffix is taken into account. Example: +`1.5.0 > 1.5.0-beta1 > 1.5.0-alpha3 > 1.5.0-alpha2 > 1.5.0-dev11` + +### Changed + +- reorganized the source directories + +### Fixed + +- [#10](https://github.com/phar-io/version/issues/10): Version numbers containing +a numeric suffix as seen in Debian packages are now supported. + +[2.0.1]: https://github.com/phar-io/version/compare/2.0.0...2.0.1 +[2.0.0]: https://github.com/phar-io/version/compare/1.0.1...2.0.0 diff --git a/vendor/phar-io/version/LICENSE b/vendor/phar-io/version/LICENSE new file mode 100644 index 0000000..359dbc5 --- /dev/null +++ b/vendor/phar-io/version/LICENSE @@ -0,0 +1,31 @@ +phar-io/version + +Copyright (c) 2016-2017 Arne Blankerts , Sebastian Heuer and contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Arne Blankerts nor the names of contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + diff --git a/vendor/phar-io/version/README.md b/vendor/phar-io/version/README.md new file mode 100644 index 0000000..76e6e98 --- /dev/null +++ b/vendor/phar-io/version/README.md @@ -0,0 +1,61 @@ +# Version + +Library for handling version information and constraints + +[![Build Status](https://travis-ci.org/phar-io/version.svg?branch=master)](https://travis-ci.org/phar-io/version) + +## Installation + +You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): + + composer require phar-io/version + +If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: + + composer require --dev phar-io/version + +## Version constraints + +A Version constraint describes a range of versions or a discrete version number. The format of version numbers follows the schema of [semantic versioning](http://semver.org): `..`. A constraint might contain an operator that describes the range. + +Beside the typical mathematical operators like `<=`, `>=`, there are two special operators: + +*Caret operator*: `^1.0` +can be written as `>=1.0.0 <2.0.0` and read as »every Version within major version `1`«. + +*Tilde operator*: `~1.0.0` +can be written as `>=1.0.0 <1.1.0` and read as »every version within minor version `1.1`. The behavior of tilde operator depends on whether a patch level version is provided or not. If no patch level is provided, tilde operator behaves like the caret operator: `~1.0` is identical to `^1.0`. + +## Usage examples + +Parsing version constraints and check discrete versions for compliance: + +```php + +use PharIo\Version\Version; +use PharIo\Version\VersionConstraintParser; + +$parser = new VersionConstraintParser(); +$caret_constraint = $parser->parse( '^7.0' ); + +$caret_constraint->complies( new Version( '7.0.17' ) ); // true +$caret_constraint->complies( new Version( '7.1.0' ) ); // true +$caret_constraint->complies( new Version( '6.4.34' ) ); // false + +$tilde_constraint = $parser->parse( '~1.1.0' ); + +$tilde_constraint->complies( new Version( '1.1.4' ) ); // true +$tilde_constraint->complies( new Version( '1.2.0' ) ); // false +``` + +As of version 2.0.0, pre-release labels are supported and taken into account when comparing versions: + +```php + +$leftVersion = new PharIo\Version\Version('3.0.0-alpha.1'); +$rightVersion = new PharIo\Version\Version('3.0.0-alpha.2'); + +$leftVersion->isGreaterThan($rightVersion); // false +$rightVersion->isGreaterThan($leftVersion); // true + +``` diff --git a/vendor/phar-io/version/build.xml b/vendor/phar-io/version/build.xml new file mode 100644 index 0000000..943c957 --- /dev/null +++ b/vendor/phar-io/version/build.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phar-io/version/composer.json b/vendor/phar-io/version/composer.json new file mode 100644 index 0000000..891e8b1 --- /dev/null +++ b/vendor/phar-io/version/composer.json @@ -0,0 +1,34 @@ +{ + "name": "phar-io/version", + "description": "Library for handling version information and constraints", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "support": { + "issues": "https://github.com/phar-io/version/issues" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "autoload": { + "classmap": [ + "src/" + ] + } +} + diff --git a/vendor/phar-io/version/phive.xml b/vendor/phar-io/version/phive.xml new file mode 100644 index 0000000..0c3bc6f --- /dev/null +++ b/vendor/phar-io/version/phive.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/vendor/phar-io/version/phpunit.xml b/vendor/phar-io/version/phpunit.xml new file mode 100644 index 0000000..c21ffbc --- /dev/null +++ b/vendor/phar-io/version/phpunit.xml @@ -0,0 +1,19 @@ + + + + tests + + + + + src + + + diff --git a/vendor/phar-io/version/src/PreReleaseSuffix.php b/vendor/phar-io/version/src/PreReleaseSuffix.php new file mode 100644 index 0000000..e936c0e --- /dev/null +++ b/vendor/phar-io/version/src/PreReleaseSuffix.php @@ -0,0 +1,95 @@ + 0, + 'a' => 1, + 'alpha' => 1, + 'b' => 2, + 'beta' => 2, + 'rc' => 3, + 'p' => 4, + 'patch' => 4, + ]; + + /** + * @var string + */ + private $value; + + /** + * @var int + */ + private $valueScore; + + /** + * @var int + */ + private $number = 0; + + /** + * @param string $value + */ + public function __construct($value) { + $this->parseValue($value); + } + + /** + * @return string + */ + public function getValue() { + return $this->value; + } + + /** + * @return int|null + */ + public function getNumber() { + return $this->number; + } + + /** + * @param PreReleaseSuffix $suffix + * + * @return bool + */ + public function isGreaterThan(PreReleaseSuffix $suffix) { + if ($this->valueScore > $suffix->valueScore) { + return true; + } + + if ($this->valueScore < $suffix->valueScore) { + return false; + } + + return $this->getNumber() > $suffix->getNumber(); + } + + /** + * @param $value + * + * @return int + */ + private function mapValueToScore($value) { + if (array_key_exists($value, $this->valueScoreMap)) { + return $this->valueScoreMap[$value]; + } + + return 0; + } + + private function parseValue($value) { + $regex = '/-?(dev|beta|b|rc|alpha|a|patch|p)\.?(\d*).*$/i'; + if (preg_match($regex, $value, $matches) !== 1) { + throw new InvalidPreReleaseSuffixException(sprintf('Invalid label %s', $value)); + } + + $this->value = $matches[1]; + if (isset($matches[2])) { + $this->number = (int)$matches[2]; + } + $this->valueScore = $this->mapValueToScore($this->value); + } +} diff --git a/vendor/phar-io/version/src/Version.php b/vendor/phar-io/version/src/Version.php new file mode 100644 index 0000000..73e1b98 --- /dev/null +++ b/vendor/phar-io/version/src/Version.php @@ -0,0 +1,175 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class Version { + /** + * @var VersionNumber + */ + private $major; + + /** + * @var VersionNumber + */ + private $minor; + + /** + * @var VersionNumber + */ + private $patch; + + /** + * @var PreReleaseSuffix + */ + private $preReleaseSuffix; + + /** + * @var string + */ + private $versionString = ''; + + /** + * @param string $versionString + */ + public function __construct($versionString) { + $this->ensureVersionStringIsValid($versionString); + + $this->versionString = $versionString; + } + + /** + * @return PreReleaseSuffix + */ + public function getPreReleaseSuffix() { + return $this->preReleaseSuffix; + } + + /** + * @return string + */ + public function getVersionString() { + return $this->versionString; + } + + /** + * @return bool + */ + public function hasPreReleaseSuffix() { + return $this->preReleaseSuffix !== null; + } + + /** + * @param Version $version + * + * @return bool + */ + public function isGreaterThan(Version $version) { + if ($version->getMajor()->getValue() > $this->getMajor()->getValue()) { + return false; + } + + if ($version->getMajor()->getValue() < $this->getMajor()->getValue()) { + return true; + } + + if ($version->getMinor()->getValue() > $this->getMinor()->getValue()) { + return false; + } + + if ($version->getMinor()->getValue() < $this->getMinor()->getValue()) { + return true; + } + + if ($version->getPatch()->getValue() > $this->getPatch()->getValue()) { + return false; + } + + if ($version->getPatch()->getValue() < $this->getPatch()->getValue()) { + return true; + } + + if (!$version->hasPreReleaseSuffix() && !$this->hasPreReleaseSuffix()) { + return false; + } + + if ($version->hasPreReleaseSuffix() && !$this->hasPreReleaseSuffix()) { + return true; + } + + if (!$version->hasPreReleaseSuffix() && $this->hasPreReleaseSuffix()) { + return false; + } + + return $this->getPreReleaseSuffix()->isGreaterThan($version->getPreReleaseSuffix()); + } + + /** + * @return VersionNumber + */ + public function getMajor() { + return $this->major; + } + + /** + * @return VersionNumber + */ + public function getMinor() { + return $this->minor; + } + + /** + * @return VersionNumber + */ + public function getPatch() { + return $this->patch; + } + + /** + * @param array $matches + */ + private function parseVersion(array $matches) { + $this->major = new VersionNumber($matches['Major']); + $this->minor = new VersionNumber($matches['Minor']); + $this->patch = isset($matches['Patch']) ? new VersionNumber($matches['Patch']) : new VersionNumber(null); + + if (isset($matches['PreReleaseSuffix'])) { + $this->preReleaseSuffix = new PreReleaseSuffix($matches['PreReleaseSuffix']); + } + } + + /** + * @param string $version + * + * @throws InvalidVersionException + */ + private function ensureVersionStringIsValid($version) { + $regex = '/^v? + (?(0|(?:[1-9][0-9]*))) + \\. + (?(0|(?:[1-9][0-9]*))) + (\\. + (?(0|(?:[1-9][0-9]*))) + )? + (?: + - + (?(?:(dev|beta|b|RC|alpha|a|patch|p)\.?\d*)) + )? + $/x'; + + if (preg_match($regex, $version, $matches) !== 1) { + throw new InvalidVersionException( + sprintf("Version string '%s' does not follow SemVer semantics", $version) + ); + } + + $this->parseVersion($matches); + } +} diff --git a/vendor/phar-io/version/src/VersionConstraintParser.php b/vendor/phar-io/version/src/VersionConstraintParser.php new file mode 100644 index 0000000..ed46843 --- /dev/null +++ b/vendor/phar-io/version/src/VersionConstraintParser.php @@ -0,0 +1,122 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class VersionConstraintParser { + /** + * @param string $value + * + * @return VersionConstraint + * + * @throws UnsupportedVersionConstraintException + */ + public function parse($value) { + + if (strpos($value, '||') !== false) { + return $this->handleOrGroup($value); + } + + if (!preg_match('/^[\^~\*]?[\d.\*]+(?:-.*)?$/', $value)) { + throw new UnsupportedVersionConstraintException( + sprintf('Version constraint %s is not supported.', $value) + ); + } + + switch ($value[0]) { + case '~': + return $this->handleTildeOperator($value); + case '^': + return $this->handleCaretOperator($value); + } + + $version = new VersionConstraintValue($value); + + if ($version->getMajor()->isAny()) { + return new AnyVersionConstraint(); + } + + if ($version->getMinor()->isAny()) { + return new SpecificMajorVersionConstraint( + $version->getVersionString(), + $version->getMajor()->getValue() + ); + } + + if ($version->getPatch()->isAny()) { + return new SpecificMajorAndMinorVersionConstraint( + $version->getVersionString(), + $version->getMajor()->getValue(), + $version->getMinor()->getValue() + ); + } + + return new ExactVersionConstraint($version->getVersionString()); + } + + /** + * @param $value + * + * @return OrVersionConstraintGroup + */ + private function handleOrGroup($value) { + $constraints = []; + + foreach (explode('||', $value) as $groupSegment) { + $constraints[] = $this->parse(trim($groupSegment)); + } + + return new OrVersionConstraintGroup($value, $constraints); + } + + /** + * @param string $value + * + * @return AndVersionConstraintGroup + */ + private function handleTildeOperator($value) { + $version = new Version(substr($value, 1)); + $constraints = [ + new GreaterThanOrEqualToVersionConstraint($value, $version) + ]; + + if ($version->getPatch()->isAny()) { + $constraints[] = new SpecificMajorVersionConstraint( + $value, + $version->getMajor()->getValue() + ); + } else { + $constraints[] = new SpecificMajorAndMinorVersionConstraint( + $value, + $version->getMajor()->getValue(), + $version->getMinor()->getValue() + ); + } + + return new AndVersionConstraintGroup($value, $constraints); + } + + /** + * @param string $value + * + * @return AndVersionConstraintGroup + */ + private function handleCaretOperator($value) { + $version = new Version(substr($value, 1)); + + return new AndVersionConstraintGroup( + $value, + [ + new GreaterThanOrEqualToVersionConstraint($value, $version), + new SpecificMajorVersionConstraint($value, $version->getMajor()->getValue()) + ] + ); + } +} diff --git a/vendor/phar-io/version/src/VersionConstraintValue.php b/vendor/phar-io/version/src/VersionConstraintValue.php new file mode 100644 index 0000000..8c975b8 --- /dev/null +++ b/vendor/phar-io/version/src/VersionConstraintValue.php @@ -0,0 +1,123 @@ +versionString = $versionString; + + $this->parseVersion($versionString); + } + + /** + * @return string + */ + public function getLabel() { + return $this->label; + } + + /** + * @return string + */ + public function getBuildMetaData() { + return $this->buildMetaData; + } + + /** + * @return string + */ + public function getVersionString() { + return $this->versionString; + } + + /** + * @return VersionNumber + */ + public function getMajor() { + return $this->major; + } + + /** + * @return VersionNumber + */ + public function getMinor() { + return $this->minor; + } + + /** + * @return VersionNumber + */ + public function getPatch() { + return $this->patch; + } + + /** + * @param $versionString + */ + private function parseVersion($versionString) { + $this->extractBuildMetaData($versionString); + $this->extractLabel($versionString); + + $versionSegments = explode('.', $versionString); + $this->major = new VersionNumber($versionSegments[0]); + + $minorValue = isset($versionSegments[1]) ? $versionSegments[1] : null; + $patchValue = isset($versionSegments[2]) ? $versionSegments[2] : null; + + $this->minor = new VersionNumber($minorValue); + $this->patch = new VersionNumber($patchValue); + } + + /** + * @param string $versionString + */ + private function extractBuildMetaData(&$versionString) { + if (preg_match('/\+(.*)/', $versionString, $matches) == 1) { + $this->buildMetaData = $matches[1]; + $versionString = str_replace($matches[0], '', $versionString); + } + } + + /** + * @param string $versionString + */ + private function extractLabel(&$versionString) { + if (preg_match('/\-(.*)/', $versionString, $matches) == 1) { + $this->label = $matches[1]; + $versionString = str_replace($matches[0], '', $versionString); + } + } +} diff --git a/vendor/phar-io/version/src/VersionNumber.php b/vendor/phar-io/version/src/VersionNumber.php new file mode 100644 index 0000000..ab512ed --- /dev/null +++ b/vendor/phar-io/version/src/VersionNumber.php @@ -0,0 +1,41 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class VersionNumber { + /** + * @var int + */ + private $value; + + /** + * @param mixed $value + */ + public function __construct($value) { + if (is_numeric($value)) { + $this->value = $value; + } + } + + /** + * @return bool + */ + public function isAny() { + return $this->value === null; + } + + /** + * @return int + */ + public function getValue() { + return $this->value; + } +} diff --git a/vendor/phar-io/version/src/constraints/AbstractVersionConstraint.php b/vendor/phar-io/version/src/constraints/AbstractVersionConstraint.php new file mode 100644 index 0000000..b732dbc --- /dev/null +++ b/vendor/phar-io/version/src/constraints/AbstractVersionConstraint.php @@ -0,0 +1,32 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +abstract class AbstractVersionConstraint implements VersionConstraint { + /** + * @var string + */ + private $originalValue = ''; + + /** + * @param string $originalValue + */ + public function __construct($originalValue) { + $this->originalValue = $originalValue; + } + + /** + * @return string + */ + public function asString() { + return $this->originalValue; + } +} diff --git a/vendor/phar-io/version/src/constraints/AndVersionConstraintGroup.php b/vendor/phar-io/version/src/constraints/AndVersionConstraintGroup.php new file mode 100644 index 0000000..d9efeef --- /dev/null +++ b/vendor/phar-io/version/src/constraints/AndVersionConstraintGroup.php @@ -0,0 +1,43 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class AndVersionConstraintGroup extends AbstractVersionConstraint { + /** + * @var VersionConstraint[] + */ + private $constraints = []; + + /** + * @param string $originalValue + * @param VersionConstraint[] $constraints + */ + public function __construct($originalValue, array $constraints) { + parent::__construct($originalValue); + + $this->constraints = $constraints; + } + + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version) { + foreach ($this->constraints as $constraint) { + if (!$constraint->complies($version)) { + return false; + } + } + + return true; + } +} diff --git a/vendor/phar-io/version/src/constraints/AnyVersionConstraint.php b/vendor/phar-io/version/src/constraints/AnyVersionConstraint.php new file mode 100644 index 0000000..13ca2ef --- /dev/null +++ b/vendor/phar-io/version/src/constraints/AnyVersionConstraint.php @@ -0,0 +1,29 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class AnyVersionConstraint implements VersionConstraint { + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version) { + return true; + } + + /** + * @return string + */ + public function asString() { + return '*'; + } +} diff --git a/vendor/phar-io/version/src/constraints/ExactVersionConstraint.php b/vendor/phar-io/version/src/constraints/ExactVersionConstraint.php new file mode 100644 index 0000000..b214117 --- /dev/null +++ b/vendor/phar-io/version/src/constraints/ExactVersionConstraint.php @@ -0,0 +1,22 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class ExactVersionConstraint extends AbstractVersionConstraint { + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version) { + return $this->asString() == $version->getVersionString(); + } +} diff --git a/vendor/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php b/vendor/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php new file mode 100644 index 0000000..47039a8 --- /dev/null +++ b/vendor/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php @@ -0,0 +1,38 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class GreaterThanOrEqualToVersionConstraint extends AbstractVersionConstraint { + /** + * @var Version + */ + private $minimalVersion; + + /** + * @param string $originalValue + * @param Version $minimalVersion + */ + public function __construct($originalValue, Version $minimalVersion) { + parent::__construct($originalValue); + + $this->minimalVersion = $minimalVersion; + } + + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version) { + return $version->getVersionString() == $this->minimalVersion->getVersionString() + || $version->isGreaterThan($this->minimalVersion); + } +} diff --git a/vendor/phar-io/version/src/constraints/OrVersionConstraintGroup.php b/vendor/phar-io/version/src/constraints/OrVersionConstraintGroup.php new file mode 100644 index 0000000..274407f --- /dev/null +++ b/vendor/phar-io/version/src/constraints/OrVersionConstraintGroup.php @@ -0,0 +1,43 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class OrVersionConstraintGroup extends AbstractVersionConstraint { + /** + * @var VersionConstraint[] + */ + private $constraints = []; + + /** + * @param string $originalValue + * @param VersionConstraint[] $constraints + */ + public function __construct($originalValue, array $constraints) { + parent::__construct($originalValue); + + $this->constraints = $constraints; + } + + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version) { + foreach ($this->constraints as $constraint) { + if ($constraint->complies($version)) { + return true; + } + } + + return false; + } +} diff --git a/vendor/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php b/vendor/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php new file mode 100644 index 0000000..3d58905 --- /dev/null +++ b/vendor/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php @@ -0,0 +1,48 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class SpecificMajorAndMinorVersionConstraint extends AbstractVersionConstraint { + /** + * @var int + */ + private $major = 0; + + /** + * @var int + */ + private $minor = 0; + + /** + * @param string $originalValue + * @param int $major + * @param int $minor + */ + public function __construct($originalValue, $major, $minor) { + parent::__construct($originalValue); + + $this->major = $major; + $this->minor = $minor; + } + + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version) { + if ($version->getMajor()->getValue() != $this->major) { + return false; + } + + return $version->getMinor()->getValue() == $this->minor; + } +} diff --git a/vendor/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php b/vendor/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php new file mode 100644 index 0000000..bbac47b --- /dev/null +++ b/vendor/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php @@ -0,0 +1,37 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +class SpecificMajorVersionConstraint extends AbstractVersionConstraint { + /** + * @var int + */ + private $major = 0; + + /** + * @param string $originalValue + * @param int $major + */ + public function __construct($originalValue, $major) { + parent::__construct($originalValue); + + $this->major = $major; + } + + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version) { + return $version->getMajor()->getValue() == $this->major; + } +} diff --git a/vendor/phar-io/version/src/constraints/VersionConstraint.php b/vendor/phar-io/version/src/constraints/VersionConstraint.php new file mode 100644 index 0000000..9558163 --- /dev/null +++ b/vendor/phar-io/version/src/constraints/VersionConstraint.php @@ -0,0 +1,26 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +interface VersionConstraint { + /** + * @param Version $version + * + * @return bool + */ + public function complies(Version $version); + + /** + * @return string + */ + public function asString(); + +} diff --git a/vendor/phar-io/version/src/exceptions/Exception.php b/vendor/phar-io/version/src/exceptions/Exception.php new file mode 100644 index 0000000..b99e4dd --- /dev/null +++ b/vendor/phar-io/version/src/exceptions/Exception.php @@ -0,0 +1,14 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +interface Exception { +} diff --git a/vendor/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php b/vendor/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php new file mode 100644 index 0000000..225fe71 --- /dev/null +++ b/vendor/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php @@ -0,0 +1,7 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +final class UnsupportedVersionConstraintException extends \RuntimeException implements Exception { +} diff --git a/vendor/phar-io/version/tests/Integration/VersionConstraintParserTest.php b/vendor/phar-io/version/tests/Integration/VersionConstraintParserTest.php new file mode 100644 index 0000000..f3e1ba8 --- /dev/null +++ b/vendor/phar-io/version/tests/Integration/VersionConstraintParserTest.php @@ -0,0 +1,146 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Version\VersionConstraintParser + */ +class VersionConstraintParserTest extends TestCase { + /** + * @dataProvider versionStringProvider + * + * @param string $versionString + * @param VersionConstraint $expectedConstraint + */ + public function testReturnsExpectedConstraint($versionString, VersionConstraint $expectedConstraint) { + $parser = new VersionConstraintParser; + + $this->assertEquals($expectedConstraint, $parser->parse($versionString)); + } + + /** + * @dataProvider unsupportedVersionStringProvider + * + * @param string $versionString + */ + public function testThrowsExceptionIfVersionStringIsNotSupported($versionString) { + $parser = new VersionConstraintParser; + + $this->expectException(UnsupportedVersionConstraintException::class); + + $parser->parse($versionString); + } + + /** + * @return array + */ + public function versionStringProvider() { + return [ + ['1.0.2', new ExactVersionConstraint('1.0.2')], + [ + '~4.6', + new AndVersionConstraintGroup( + '~4.6', + [ + new GreaterThanOrEqualToVersionConstraint('~4.6', new Version('4.6')), + new SpecificMajorVersionConstraint('~4.6', 4) + ] + ) + ], + [ + '~4.6.2', + new AndVersionConstraintGroup( + '~4.6.2', + [ + new GreaterThanOrEqualToVersionConstraint('~4.6.2', new Version('4.6.2')), + new SpecificMajorAndMinorVersionConstraint('~4.6.2', 4, 6) + ] + ) + ], + [ + '^2.6.1', + new AndVersionConstraintGroup( + '^2.6.1', + [ + new GreaterThanOrEqualToVersionConstraint('^2.6.1', new Version('2.6.1')), + new SpecificMajorVersionConstraint('^2.6.1', 2) + ] + ) + ], + ['5.1.*', new SpecificMajorAndMinorVersionConstraint('5.1.*', 5, 1)], + ['5.*', new SpecificMajorVersionConstraint('5.*', 5)], + ['*', new AnyVersionConstraint()], + [ + '1.0.2 || 1.0.5', + new OrVersionConstraintGroup( + '1.0.2 || 1.0.5', + [ + new ExactVersionConstraint('1.0.2'), + new ExactVersionConstraint('1.0.5') + ] + ) + ], + [ + '^5.6 || ^7.0', + new OrVersionConstraintGroup( + '^5.6 || ^7.0', + [ + new AndVersionConstraintGroup( + '^5.6', [ + new GreaterThanOrEqualToVersionConstraint('^5.6', new Version('5.6')), + new SpecificMajorVersionConstraint('^5.6', 5) + ] + ), + new AndVersionConstraintGroup( + '^7.0', [ + new GreaterThanOrEqualToVersionConstraint('^7.0', new Version('7.0')), + new SpecificMajorVersionConstraint('^7.0', 7) + ] + ) + ] + ) + ], + ['7.0.28-1', new ExactVersionConstraint('7.0.28-1')], + [ + '^3.0.0-alpha1', + new AndVersionConstraintGroup( + '^3.0.0-alpha1', + [ + new GreaterThanOrEqualToVersionConstraint('^3.0.0-alpha1', new Version('3.0.0-alpha1')), + new SpecificMajorVersionConstraint('^3.0.0-alpha1', 3) + ] + ) + ], + [ + '^3.0.0-alpha.1', + new AndVersionConstraintGroup( + '^3.0.0-alpha.1', + [ + new GreaterThanOrEqualToVersionConstraint('^3.0.0-alpha.1', new Version('3.0.0-alpha.1')), + new SpecificMajorVersionConstraint('^3.0.0-alpha.1', 3) + ] + ) + ] + ]; + } + + public function unsupportedVersionStringProvider() { + return [ + ['foo'], + ['+1.0.2'], + ['>=2.0'], + ['^5.6 || >= 7.0'], + ['2.0 || foo'] + ]; + } +} diff --git a/vendor/phar-io/version/tests/Unit/AbstractVersionConstraintTest.php b/vendor/phar-io/version/tests/Unit/AbstractVersionConstraintTest.php new file mode 100644 index 0000000..c618566 --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/AbstractVersionConstraintTest.php @@ -0,0 +1,25 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Version\AbstractVersionConstraint + */ +class AbstractVersionConstraintTest extends TestCase { + public function testAsString() { + /** @var AbstractVersionConstraint|\PHPUnit_Framework_MockObject_MockObject $constraint */ + $constraint = $this->getMockForAbstractClass(AbstractVersionConstraint::class, ['foo']); + + $this->assertSame('foo', $constraint->asString()); + } +} diff --git a/vendor/phar-io/version/tests/Unit/AndVersionConstraintGroupTest.php b/vendor/phar-io/version/tests/Unit/AndVersionConstraintGroupTest.php new file mode 100644 index 0000000..c2c5ec0 --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/AndVersionConstraintGroupTest.php @@ -0,0 +1,52 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Version\AndVersionConstraintGroup + */ +class AndVersionConstraintGroupTest extends TestCase { + public function testReturnsFalseIfOneConstraintReturnsFalse() { + $firstConstraint = $this->createMock(VersionConstraint::class); + $secondConstraint = $this->createMock(VersionConstraint::class); + + $firstConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(true)); + + $secondConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(false)); + + $group = new AndVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]); + + $this->assertFalse($group->complies(new Version('1.0.0'))); + } + + public function testReturnsTrueIfAllConstraintsReturnsTrue() { + $firstConstraint = $this->createMock(VersionConstraint::class); + $secondConstraint = $this->createMock(VersionConstraint::class); + + $firstConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(true)); + + $secondConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(true)); + + $group = new AndVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]); + + $this->assertTrue($group->complies(new Version('1.0.0'))); + } +} diff --git a/vendor/phar-io/version/tests/Unit/AnyVersionConstraintTest.php b/vendor/phar-io/version/tests/Unit/AnyVersionConstraintTest.php new file mode 100644 index 0000000..6883099 --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/AnyVersionConstraintTest.php @@ -0,0 +1,41 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Version\AnyVersionConstraint + */ +class AnyVersionConstraintTest extends TestCase { + public function versionProvider() { + return [ + [new Version('1.0.2')], + [new Version('4.8')], + [new Version('0.1.1-dev')] + ]; + } + + /** + * @dataProvider versionProvider + * + * @param Version $version + */ + public function testReturnsTrue(Version $version) { + $constraint = new AnyVersionConstraint; + + $this->assertTrue($constraint->complies($version)); + } + + public function testAsString() { + $this->assertSame('*', (new AnyVersionConstraint())->asString()); + } +} diff --git a/vendor/phar-io/version/tests/Unit/ExactVersionConstraintTest.php b/vendor/phar-io/version/tests/Unit/ExactVersionConstraintTest.php new file mode 100644 index 0000000..ebba024 --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/ExactVersionConstraintTest.php @@ -0,0 +1,58 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Version\ExactVersionConstraint + */ +class ExactVersionConstraintTest extends TestCase { + public function compliantVersionProvider() { + return [ + ['1.0.2', new Version('1.0.2')], + ['4.8.9', new Version('4.8.9')], + ['4.8', new Version('4.8')], + ]; + } + + public function nonCompliantVersionProvider() { + return [ + ['1.0.2', new Version('1.0.3')], + ['4.8.9', new Version('4.7.9')], + ['4.8', new Version('4.8.5')], + ]; + } + + /** + * @dataProvider compliantVersionProvider + * + * @param string $constraintValue + * @param Version $version + */ + public function testReturnsTrueForCompliantVersion($constraintValue, Version $version) { + $constraint = new ExactVersionConstraint($constraintValue); + + $this->assertTrue($constraint->complies($version)); + } + + /** + * @dataProvider nonCompliantVersionProvider + * + * @param string $constraintValue + * @param Version $version + */ + public function testReturnsFalseForNonCompliantVersion($constraintValue, Version $version) { + $constraint = new ExactVersionConstraint($constraintValue); + + $this->assertFalse($constraint->complies($version)); + } +} diff --git a/vendor/phar-io/version/tests/Unit/GreaterThanOrEqualToVersionConstraintTest.php b/vendor/phar-io/version/tests/Unit/GreaterThanOrEqualToVersionConstraintTest.php new file mode 100644 index 0000000..3cbb11d --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/GreaterThanOrEqualToVersionConstraintTest.php @@ -0,0 +1,47 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Version\GreaterThanOrEqualToVersionConstraint + */ +class GreaterThanOrEqualToVersionConstraintTest extends TestCase { + public function versionProvider() { + return [ + // compliant versions + [new Version('1.0.2'), new Version('1.0.2'), true], + [new Version('1.0.2'), new Version('1.0.3'), true], + [new Version('1.0.2'), new Version('1.1.1'), true], + [new Version('1.0.2'), new Version('2.0.0'), true], + [new Version('1.0.2'), new Version('1.0.3'), true], + // non-compliant versions + [new Version('1.0.2'), new Version('1.0.1'), false], + [new Version('1.9.8'), new Version('0.9.9'), false], + [new Version('2.3.1'), new Version('2.2.3'), false], + [new Version('3.0.2'), new Version('2.9.9'), false], + ]; + } + + /** + * @dataProvider versionProvider + * + * @param Version $constraintVersion + * @param Version $version + * @param bool $expectedResult + */ + public function testReturnsTrueForCompliantVersions(Version $constraintVersion, Version $version, $expectedResult) { + $constraint = new GreaterThanOrEqualToVersionConstraint('foo', $constraintVersion); + + $this->assertSame($expectedResult, $constraint->complies($version)); + } +} diff --git a/vendor/phar-io/version/tests/Unit/OrVersionConstraintGroupTest.php b/vendor/phar-io/version/tests/Unit/OrVersionConstraintGroupTest.php new file mode 100644 index 0000000..088d557 --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/OrVersionConstraintGroupTest.php @@ -0,0 +1,65 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Version\OrVersionConstraintGroup + */ +class OrVersionConstraintGroupTest extends TestCase { + public function testReturnsTrueIfOneConstraintReturnsFalse() { + $firstConstraint = $this->createMock(VersionConstraint::class); + $secondConstraint = $this->createMock(VersionConstraint::class); + + $firstConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(false)); + + $secondConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(true)); + + $group = new OrVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]); + + $this->assertTrue($group->complies(new Version('1.0.0'))); + } + + public function testReturnsTrueIfAllConstraintsReturnsTrue() { + $firstConstraint = $this->createMock(VersionConstraint::class); + $secondConstraint = $this->createMock(VersionConstraint::class); + + $firstConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(true)); + + $group = new OrVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]); + + $this->assertTrue($group->complies(new Version('1.0.0'))); + } + + public function testReturnsFalseIfAllConstraintsReturnsFalse() { + $firstConstraint = $this->createMock(VersionConstraint::class); + $secondConstraint = $this->createMock(VersionConstraint::class); + + $firstConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(false)); + + $secondConstraint->expects($this->once()) + ->method('complies') + ->will($this->returnValue(false)); + + $group = new OrVersionConstraintGroup('foo', [$firstConstraint, $secondConstraint]); + + $this->assertFalse($group->complies(new Version('1.0.0'))); + } +} diff --git a/vendor/phar-io/version/tests/Unit/PreReleaseSuffixTest.php b/vendor/phar-io/version/tests/Unit/PreReleaseSuffixTest.php new file mode 100644 index 0000000..e09a66d --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/PreReleaseSuffixTest.php @@ -0,0 +1,46 @@ +assertSame($expectedResult, $leftSuffix->isGreaterThan($rightSuffix)); + } + + public function greaterThanProvider() { + return [ + ['alpha1', 'alpha2', false], + ['alpha2', 'alpha1', true], + ['beta1', 'alpha3', true], + ['b1', 'alpha3', true], + ['b1', 'a3', true], + ['dev1', 'alpha2', false], + ['dev1', 'alpha2', false], + ['alpha2', 'dev5', true], + ['rc1', 'beta2', true], + ['patch5', 'rc7', true], + ['alpha1', 'alpha.2', false], + ['alpha.3', 'alpha2', true], + ['alpha.3', 'alpha.2', true], + ]; + } +} diff --git a/vendor/phar-io/version/tests/Unit/SpecificMajorAndMinorVersionConstraintTest.php b/vendor/phar-io/version/tests/Unit/SpecificMajorAndMinorVersionConstraintTest.php new file mode 100644 index 0000000..6025889 --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/SpecificMajorAndMinorVersionConstraintTest.php @@ -0,0 +1,45 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Version\SpecificMajorAndMinorVersionConstraint + */ +class SpecificMajorAndMinorVersionConstraintTest extends TestCase { + public function versionProvider() { + return [ + // compliant versions + [1, 0, new Version('1.0.2'), true], + [1, 0, new Version('1.0.3'), true], + [1, 1, new Version('1.1.1'), true], + // non-compliant versions + [2, 9, new Version('0.9.9'), false], + [3, 2, new Version('2.2.3'), false], + [2, 8, new Version('2.9.9'), false], + ]; + } + + /** + * @dataProvider versionProvider + * + * @param int $major + * @param int $minor + * @param Version $version + * @param bool $expectedResult + */ + public function testReturnsTrueForCompliantVersions($major, $minor, Version $version, $expectedResult) { + $constraint = new SpecificMajorAndMinorVersionConstraint('foo', $major, $minor); + + $this->assertSame($expectedResult, $constraint->complies($version)); + } +} diff --git a/vendor/phar-io/version/tests/Unit/SpecificMajorVersionConstraintTest.php b/vendor/phar-io/version/tests/Unit/SpecificMajorVersionConstraintTest.php new file mode 100644 index 0000000..6dc3b71 --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/SpecificMajorVersionConstraintTest.php @@ -0,0 +1,44 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Version\SpecificMajorVersionConstraint + */ +class SpecificMajorVersionConstraintTest extends TestCase { + public function versionProvider() { + return [ + // compliant versions + [1, new Version('1.0.2'), true], + [1, new Version('1.0.3'), true], + [1, new Version('1.1.1'), true], + // non-compliant versions + [2, new Version('0.9.9'), false], + [3, new Version('2.2.3'), false], + [3, new Version('2.9.9'), false], + ]; + } + + /** + * @dataProvider versionProvider + * + * @param int $major + * @param Version $version + * @param bool $expectedResult + */ + public function testReturnsTrueForCompliantVersions($major, Version $version, $expectedResult) { + $constraint = new SpecificMajorVersionConstraint('foo', $major); + + $this->assertSame($expectedResult, $constraint->complies($version)); + } +} diff --git a/vendor/phar-io/version/tests/Unit/VersionTest.php b/vendor/phar-io/version/tests/Unit/VersionTest.php new file mode 100644 index 0000000..6b4897a --- /dev/null +++ b/vendor/phar-io/version/tests/Unit/VersionTest.php @@ -0,0 +1,113 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace PharIo\Version; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \PharIo\Version\Version + */ +class VersionTest extends TestCase { + /** + * @dataProvider versionProvider + * + * @param string $versionString + * @param string $expectedMajor + * @param string $expectedMinor + * @param string $expectedPatch + * @param string $expectedPreReleaseValue + * @param int $expectedReleaseCount + */ + public function testParsesVersionNumbers( + $versionString, + $expectedMajor, + $expectedMinor, + $expectedPatch, + $expectedPreReleaseValue = '', + $expectedReleaseCount = 0 + ) { + $version = new Version($versionString); + + $this->assertSame($expectedMajor, $version->getMajor()->getValue()); + $this->assertSame($expectedMinor, $version->getMinor()->getValue()); + $this->assertSame($expectedPatch, $version->getPatch()->getValue()); + if ($expectedPreReleaseValue !== '') { + $this->assertSame($expectedPreReleaseValue, $version->getPreReleaseSuffix()->getValue()); + } + if ($expectedReleaseCount !== 0) { + $this->assertSame($expectedReleaseCount, $version->getPreReleaseSuffix()->getNumber()); + } + + $this->assertSame($versionString, $version->getVersionString()); + } + + public function versionProvider() { + return [ + ['0.0.1', '0', '0', '1'], + ['0.1.2', '0', '1', '2'], + ['1.0.0-alpha', '1', '0', '0', 'alpha'], + ['3.4.12-dev3', '3', '4', '12', 'dev', 3], + ]; + } + + /** + * @dataProvider versionGreaterThanProvider + * + * @param Version $versionA + * @param Version $versionB + * @param bool $expectedResult + */ + public function testIsGreaterThan(Version $versionA, Version $versionB, $expectedResult) { + $this->assertSame($expectedResult, $versionA->isGreaterThan($versionB)); + } + + /** + * @return array + */ + public function versionGreaterThanProvider() { + return [ + [new Version('1.0.0'), new Version('1.0.1'), false], + [new Version('1.0.1'), new Version('1.0.0'), true], + [new Version('1.1.0'), new Version('1.0.1'), true], + [new Version('1.1.0'), new Version('2.0.1'), false], + [new Version('1.1.0'), new Version('1.1.0'), false], + [new Version('2.5.8'), new Version('1.6.8'), true], + [new Version('2.5.8'), new Version('2.6.8'), false], + [new Version('2.5.8'), new Version('3.1.2'), false], + [new Version('3.0.0-alpha1'), new Version('3.0.0-alpha2'), false], + [new Version('3.0.0-alpha2'), new Version('3.0.0-alpha1'), true], + [new Version('3.0.0-alpha.1'), new Version('3.0.0'), false], + [new Version('3.0.0'), new Version('3.0.0-alpha.1'), true], + ]; + } + + /** + * @dataProvider invalidVersionStringProvider + * + * @param string $versionString + */ + public function testThrowsExceptionIfVersionStringDoesNotFollowSemVer($versionString) { + $this->expectException(InvalidVersionException::class); + new Version($versionString); + } + + /** + * @return array + */ + public function invalidVersionStringProvider() { + return [ + ['foo'], + ['0.0.1-dev+ABC', '0', '0', '1', 'dev', 'ABC'], + ['1.0.0-x.7.z.92', '1', '0', '0', 'x.7.z.92'] + ]; + } + +} diff --git a/vendor/php-http/guzzle6-adapter/CHANGELOG.md b/vendor/php-http/guzzle6-adapter/CHANGELOG.md new file mode 100644 index 0000000..0fdb506 --- /dev/null +++ b/vendor/php-http/guzzle6-adapter/CHANGELOG.md @@ -0,0 +1,66 @@ +# Change Log + + +## 1.1.1 - 2016-05-10 + +### Fixed + +- Adapter can again be instantiated without a guzzle client. + +## 1.1.0 - 2016-05-09 + +### Added + +- Factory method Client::createWithConfig to create an adapter with custom + configuration for the underlying guzzle client. + + +## 1.0.0 - 2016-01-26 + + +## 0.4.1 - 2016-01-13 + +### Changed + +- Updated integration tests + +### Removed + +- Client common dependency + + +## 0.4.0 - 2016-01-12 + +### Changed + +- Updated package files +- Updated HTTPlug to RC1 + + +## 0.2.1 - 2015-12-17 + +### Added + +- Puli configuration and bindings + +### Changed + +- Guzzle setup conforms to HTTPlug requirement now: Minimal functionality in client + + +## 0.2.0 - 2015-12-15 + +### Added + +- Async client capabalities + +### Changed + +- HTTPlug instead of HTTP Adapter + + +## 0.1.0 - 2015-06-12 + +### Added + +- Initial release diff --git a/vendor/php-http/guzzle6-adapter/LICENSE b/vendor/php-http/guzzle6-adapter/LICENSE new file mode 100644 index 0000000..48741e4 --- /dev/null +++ b/vendor/php-http/guzzle6-adapter/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2014-2015 Eric GELOEN +Copyright (c) 2015-2016 PHP HTTP Team + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/php-http/guzzle6-adapter/README.md b/vendor/php-http/guzzle6-adapter/README.md new file mode 100644 index 0000000..623eb2f --- /dev/null +++ b/vendor/php-http/guzzle6-adapter/README.md @@ -0,0 +1,59 @@ +# Guzzle 6 HTTP Adapter + +[![Latest Version](https://img.shields.io/github/release/php-http/guzzle6-adapter.svg?style=flat-square)](https://github.com/php-http/guzzle6-adapter/releases) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) +[![Build Status](https://img.shields.io/travis/php-http/guzzle6-adapter.svg?style=flat-square)](https://travis-ci.org/php-http/guzzle6-adapter) +[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/guzzle6-adapter.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/guzzle6-adapter) +[![Quality Score](https://img.shields.io/scrutinizer/g/php-http/guzzle6-adapter.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/guzzle6-adapter) +[![Total Downloads](https://img.shields.io/packagist/dt/php-http/guzzle6-adapter.svg?style=flat-square)](https://packagist.org/packages/php-http/guzzle6-adapter) + +**Guzzle 6 HTTP Adapter.** + + +## Install + +Via Composer + +``` bash +$ composer require php-http/guzzle6-adapter +``` + + +## Documentation + +Please see the [official documentation](http://docs.php-http.org/en/latest/clients/guzzle6-adapter.html). + + +## Testing + +First launch the http server: + +```bash +$ ./vendor/bin/http_test_server > /dev/null 2>&1 & +``` + +Then the test suite: + +``` bash +$ composer test +``` + + +## Contributing + +Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html). + + +## Security + +If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org). + + +## Credits + +Thanks to [David de Boer](https://github.com/ddeboer) for implementing this adapter. + + +## License + +The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/vendor/php-http/guzzle6-adapter/composer.json b/vendor/php-http/guzzle6-adapter/composer.json new file mode 100644 index 0000000..2f01d1a --- /dev/null +++ b/vendor/php-http/guzzle6-adapter/composer.json @@ -0,0 +1,49 @@ +{ + "name": "php-http/guzzle6-adapter", + "description": "Guzzle 6 HTTP Adapter", + "license": "MIT", + "keywords": ["guzzle", "http"], + "homepage": "http://httplug.io", + "authors": [ + { + "name": "David de Boer", + "email": "david@ddeboer.nl" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "require": { + "php": ">=5.5.0", + "php-http/httplug": "^1.0", + "guzzlehttp/guzzle": "^6.0" + }, + "require-dev": { + "ext-curl": "*", + "php-http/adapter-integration-tests": "^0.4" + }, + "provide": { + "php-http/client-implementation": "1.0", + "php-http/async-client-implementation": "1.0" + }, + "autoload": { + "psr-4": { + "Http\\Adapter\\Guzzle6\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Http\\Adapter\\Guzzle6\\Tests\\": "tests/" + } + }, + "scripts": { + "test": "vendor/bin/phpunit", + "test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml" + }, + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + } +} diff --git a/vendor/php-http/guzzle6-adapter/puli.json b/vendor/php-http/guzzle6-adapter/puli.json new file mode 100644 index 0000000..bd29614 --- /dev/null +++ b/vendor/php-http/guzzle6-adapter/puli.json @@ -0,0 +1,16 @@ +{ + "version": "1.0", + "name": "php-http/guzzle6-adapter", + "bindings": { + "04b5a002-71a8-473d-a8df-75671551b84a": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Adapter\\Guzzle6\\Client", + "type": "Http\\Client\\HttpClient" + }, + "9c856476-7f6b-43df-a740-15420a5f839c": { + "_class": "Puli\\Discovery\\Binding\\ClassBinding", + "class": "Http\\Adapter\\Guzzle6\\Client", + "type": "Http\\Client\\HttpAsyncClient" + } + } +} diff --git a/vendor/php-http/guzzle6-adapter/src/Client.php b/vendor/php-http/guzzle6-adapter/src/Client.php new file mode 100644 index 0000000..ded7494 --- /dev/null +++ b/vendor/php-http/guzzle6-adapter/src/Client.php @@ -0,0 +1,84 @@ + + */ +class Client implements HttpClient, HttpAsyncClient +{ + /** + * @var ClientInterface + */ + private $client; + + /** + * @param ClientInterface|null $client + */ + public function __construct(ClientInterface $client = null) + { + if (!$client) { + $client = static::buildClient(); + } + + $this->client = $client; + } + + /** + * Factory method to create the guzzle 6 adapter with custom configuration for guzzle. + * + * @param array $config Configuration to create guzzle with. + * + * @return Client + */ + public static function createWithConfig(array $config) + { + return new self(static::buildClient($config)); + } + + /** + * {@inheritdoc} + */ + public function sendRequest(RequestInterface $request) + { + $promise = $this->sendAsyncRequest($request); + + return $promise->wait(); + } + + /** + * {@inheritdoc} + */ + public function sendAsyncRequest(RequestInterface $request) + { + $promise = $this->client->sendAsync($request); + + return new Promise($promise, $request); + } + + /** + * Build the guzzle client instance. + * + * @param array $config Additional configuration + * + * @return GuzzleClient + */ + private static function buildClient(array $config = []) + { + $handlerStack = new HandlerStack(\GuzzleHttp\choose_handler()); + $handlerStack->push(Middleware::prepareBody(), 'prepare_body'); + $config = array_merge(['handler' => $handlerStack], $config); + + return new GuzzleClient($config); + } +} diff --git a/vendor/php-http/guzzle6-adapter/src/Promise.php b/vendor/php-http/guzzle6-adapter/src/Promise.php new file mode 100644 index 0000000..4d5eb8d --- /dev/null +++ b/vendor/php-http/guzzle6-adapter/src/Promise.php @@ -0,0 +1,140 @@ + + */ +class Promise implements HttpPromise +{ + /** + * @var PromiseInterface + */ + private $promise; + + /** + * @var string State of the promise + */ + private $state; + + /** + * @var ResponseInterface + */ + private $response; + + /** + * @var HttplugException + */ + private $exception; + + /** + * @var RequestInterface + */ + private $request; + + /** + * @param PromiseInterface $promise + * @param RequestInterface $request + */ + public function __construct(PromiseInterface $promise, RequestInterface $request) + { + $this->request = $request; + $this->state = self::PENDING; + $this->promise = $promise->then(function ($response) { + $this->response = $response; + $this->state = self::FULFILLED; + + return $response; + }, function ($reason) use ($request) { + $this->state = self::REJECTED; + + if ($reason instanceof HttplugException) { + $this->exception = $reason; + } elseif ($reason instanceof GuzzleExceptions\GuzzleException) { + $this->exception = $this->handleException($reason, $request); + } elseif ($reason instanceof \Exception) { + $this->exception = new \RuntimeException('Invalid exception returned from Guzzle6', 0, $reason); + } else { + $this->exception = new \UnexpectedValueException('Reason returned from Guzzle6 must be an Exception', 0, $reason); + } + + throw $this->exception; + }); + } + + /** + * {@inheritdoc} + */ + public function then(callable $onFulfilled = null, callable $onRejected = null) + { + return new static($this->promise->then($onFulfilled, $onRejected), $this->request); + } + + /** + * {@inheritdoc} + */ + public function getState() + { + return $this->state; + } + + /** + * {@inheritdoc} + */ + public function wait($unwrap = true) + { + $this->promise->wait(false); + + if ($unwrap) { + if ($this->getState() == self::REJECTED) { + throw $this->exception; + } + + return $this->response; + } + } + + /** + * Converts a Guzzle exception into an Httplug exception. + * + * @param GuzzleExceptions\GuzzleException $exception + * @param RequestInterface $request + * + * @return HttplugException + */ + private function handleException(GuzzleExceptions\GuzzleException $exception, RequestInterface $request) + { + if ($exception instanceof GuzzleExceptions\SeekException) { + return new HttplugException\RequestException($exception->getMessage(), $request, $exception); + } + + if ($exception instanceof GuzzleExceptions\ConnectException) { + return new HttplugException\NetworkException($exception->getMessage(), $exception->getRequest(), $exception); + } + + if ($exception instanceof GuzzleExceptions\RequestException) { + // Make sure we have a response for the HttpException + if ($exception->hasResponse()) { + return new HttplugException\HttpException( + $exception->getMessage(), + $exception->getRequest(), + $exception->getResponse(), + $exception + ); + } + + return new HttplugException\RequestException($exception->getMessage(), $exception->getRequest(), $exception); + } + + return new HttplugException\TransferException($exception->getMessage(), 0, $exception); + } +} diff --git a/vendor/php-http/httplug/CHANGELOG.md b/vendor/php-http/httplug/CHANGELOG.md new file mode 100644 index 0000000..8478966 --- /dev/null +++ b/vendor/php-http/httplug/CHANGELOG.md @@ -0,0 +1,72 @@ +# Change Log + +## 1.1.0 - 2016-08-31 + +- Added HttpFulfilledPromise and HttpRejectedPromise which respect the HttpAsyncClient interface + +## 1.0.0 - 2016-01-26 + +### Removed + +- Stability configuration from composer + + +## 1.0.0-RC1 - 2016-01-12 + +### Changed + +- Updated package files +- Updated promise dependency to RC1 + + +## 1.0.0-beta - 2015-12-17 + +### Added + +- Puli configuration and binding types + +### Changed + +- Exception concept + + +## 1.0.0-alpha3 - 2015-12-13 + +### Changed + +- Async client does not throw exceptions + +### Removed + +- Promise interface moved to its own repository: [php-http/promise](https://github.com/php-http/promise) + + +## 1.0.0-alpha2 - 2015-11-16 + +### Added + +- Async client and Promise interface + + +## 1.0.0-alpha - 2015-10-26 + +### Added + +- Better domain exceptions. + +### Changed + +- Purpose of the library: general HTTP CLient abstraction. + +### Removed + +- Request options: they should be configured at construction time. +- Multiple request sending: should be done asynchronously using Async Client. +- `getName` method + + +## 0.1.0 - 2015-06-03 + +### Added + +- Initial release diff --git a/vendor/php-http/httplug/LICENSE b/vendor/php-http/httplug/LICENSE new file mode 100644 index 0000000..48741e4 --- /dev/null +++ b/vendor/php-http/httplug/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2014-2015 Eric GELOEN +Copyright (c) 2015-2016 PHP HTTP Team + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/php-http/httplug/README.md b/vendor/php-http/httplug/README.md new file mode 100644 index 0000000..f46212b --- /dev/null +++ b/vendor/php-http/httplug/README.md @@ -0,0 +1,57 @@ +# HTTPlug + +[![Latest Version](https://img.shields.io/github/release/php-http/httplug.svg?style=flat-square)](https://github.com/php-http/httplug/releases) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) +[![Build Status](https://img.shields.io/travis/php-http/httplug.svg?style=flat-square)](https://travis-ci.org/php-http/httplug) +[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/httplug.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/httplug) +[![Quality Score](https://img.shields.io/scrutinizer/g/php-http/httplug.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/httplug) +[![Total Downloads](https://img.shields.io/packagist/dt/php-http/httplug.svg?style=flat-square)](https://packagist.org/packages/php-http/httplug) + +[![Slack Status](http://slack.httplug.io/badge.svg)](http://slack.httplug.io) +[![Email](https://img.shields.io/badge/email-team@httplug.io-blue.svg?style=flat-square)](mailto:team@httplug.io) + +**HTTPlug, the HTTP client abstraction for PHP.** + + +## Install + +Via Composer + +``` bash +$ composer require php-http/httplug +``` + + +## Intro + +This is the contract package for HTTP Client. +Use it to create HTTP Clients which are interoperable and compatible with [PSR-7](http://www.php-fig.org/psr/psr-7/). + +This library is the official successor of the [ivory http adapter](https://github.com/egeloen/ivory-http-adapter). + + +## Documentation + +Please see the [official documentation](http://docs.php-http.org). + + +## Testing + +``` bash +$ composer test +``` + + +## Contributing + +Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html). + + +## Security + +If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org). + + +## License + +The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/vendor/php-http/httplug/composer.json b/vendor/php-http/httplug/composer.json new file mode 100644 index 0000000..f74c4d3 --- /dev/null +++ b/vendor/php-http/httplug/composer.json @@ -0,0 +1,40 @@ +{ + "name": "php-http/httplug", + "description": "HTTPlug, the HTTP client abstraction for PHP", + "license": "MIT", + "keywords": ["http", "client"], + "homepage": "http://httplug.io", + "authors": [ + { + "name": "Eric GELOEN", + "email": "geloen.eric@gmail.com" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "require": { + "php": ">=5.4", + "psr/http-message": "^1.0", + "php-http/promise": "^1.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.4", + "henrikbjorn/phpspec-code-coverage" : "^1.0" + }, + "autoload": { + "psr-4": { + "Http\\Client\\": "src/" + } + }, + "scripts": { + "test": "vendor/bin/phpspec run", + "test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml" + }, + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + } +} diff --git a/vendor/php-http/httplug/puli.json b/vendor/php-http/httplug/puli.json new file mode 100644 index 0000000..4168331 --- /dev/null +++ b/vendor/php-http/httplug/puli.json @@ -0,0 +1,12 @@ +{ + "version": "1.0", + "name": "php-http/httplug", + "binding-types": { + "Http\\Client\\HttpAsyncClient": { + "description": "Async HTTP Client" + }, + "Http\\Client\\HttpClient": { + "description": "HTTP Client" + } + } +} diff --git a/vendor/php-http/httplug/src/Exception.php b/vendor/php-http/httplug/src/Exception.php new file mode 100644 index 0000000..e7382c3 --- /dev/null +++ b/vendor/php-http/httplug/src/Exception.php @@ -0,0 +1,12 @@ + + */ +interface Exception +{ +} diff --git a/vendor/php-http/httplug/src/Exception/HttpException.php b/vendor/php-http/httplug/src/Exception/HttpException.php new file mode 100644 index 0000000..f4f32a4 --- /dev/null +++ b/vendor/php-http/httplug/src/Exception/HttpException.php @@ -0,0 +1,74 @@ + + */ +class HttpException extends RequestException +{ + /** + * @var ResponseInterface + */ + protected $response; + + /** + * @param string $message + * @param RequestInterface $request + * @param ResponseInterface $response + * @param \Exception|null $previous + */ + public function __construct( + $message, + RequestInterface $request, + ResponseInterface $response, + \Exception $previous = null + ) { + parent::__construct($message, $request, $previous); + + $this->response = $response; + $this->code = $response->getStatusCode(); + } + + /** + * Returns the response. + * + * @return ResponseInterface + */ + public function getResponse() + { + return $this->response; + } + + /** + * Factory method to create a new exception with a normalized error message. + * + * @param RequestInterface $request + * @param ResponseInterface $response + * @param \Exception|null $previous + * + * @return HttpException + */ + public static function create( + RequestInterface $request, + ResponseInterface $response, + \Exception $previous = null + ) { + $message = sprintf( + '[url] %s [http method] %s [status code] %s [reason phrase] %s', + $request->getRequestTarget(), + $request->getMethod(), + $response->getStatusCode(), + $response->getReasonPhrase() + ); + + return new self($message, $request, $response, $previous); + } +} diff --git a/vendor/php-http/httplug/src/Exception/NetworkException.php b/vendor/php-http/httplug/src/Exception/NetworkException.php new file mode 100644 index 0000000..f2198e5 --- /dev/null +++ b/vendor/php-http/httplug/src/Exception/NetworkException.php @@ -0,0 +1,14 @@ + + */ +class NetworkException extends RequestException +{ +} diff --git a/vendor/php-http/httplug/src/Exception/RequestException.php b/vendor/php-http/httplug/src/Exception/RequestException.php new file mode 100644 index 0000000..cdce14b --- /dev/null +++ b/vendor/php-http/httplug/src/Exception/RequestException.php @@ -0,0 +1,43 @@ + + */ +class RequestException extends TransferException +{ + /** + * @var RequestInterface + */ + private $request; + + /** + * @param string $message + * @param RequestInterface $request + * @param \Exception|null $previous + */ + public function __construct($message, RequestInterface $request, \Exception $previous = null) + { + $this->request = $request; + + parent::__construct($message, 0, $previous); + } + + /** + * Returns the request. + * + * @return RequestInterface + */ + public function getRequest() + { + return $this->request; + } +} diff --git a/vendor/php-http/httplug/src/Exception/TransferException.php b/vendor/php-http/httplug/src/Exception/TransferException.php new file mode 100644 index 0000000..a858cf5 --- /dev/null +++ b/vendor/php-http/httplug/src/Exception/TransferException.php @@ -0,0 +1,14 @@ + + */ +class TransferException extends \RuntimeException implements Exception +{ +} diff --git a/vendor/php-http/httplug/src/HttpAsyncClient.php b/vendor/php-http/httplug/src/HttpAsyncClient.php new file mode 100644 index 0000000..492e511 --- /dev/null +++ b/vendor/php-http/httplug/src/HttpAsyncClient.php @@ -0,0 +1,27 @@ + + */ +interface HttpAsyncClient +{ + /** + * Sends a PSR-7 request in an asynchronous way. + * + * Exceptions related to processing the request are available from the returned Promise. + * + * @param RequestInterface $request + * + * @return Promise Resolves a PSR-7 Response or fails with an Http\Client\Exception. + * + * @throws \Exception If processing the request is impossible (eg. bad configuration). + */ + public function sendAsyncRequest(RequestInterface $request); +} diff --git a/vendor/php-http/httplug/src/HttpClient.php b/vendor/php-http/httplug/src/HttpClient.php new file mode 100644 index 0000000..0e51749 --- /dev/null +++ b/vendor/php-http/httplug/src/HttpClient.php @@ -0,0 +1,28 @@ + + * @author Márk Sági-Kazár + * @author David Buchmann + */ +interface HttpClient +{ + /** + * Sends a PSR-7 request. + * + * @param RequestInterface $request + * + * @return ResponseInterface + * + * @throws \Http\Client\Exception If an error happens during processing the request. + * @throws \Exception If processing the request is impossible (eg. bad configuration). + */ + public function sendRequest(RequestInterface $request); +} diff --git a/vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php b/vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php new file mode 100644 index 0000000..6779e44 --- /dev/null +++ b/vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php @@ -0,0 +1,57 @@ +response = $response; + } + + /** + * {@inheritdoc} + */ + public function then(callable $onFulfilled = null, callable $onRejected = null) + { + if (null === $onFulfilled) { + return $this; + } + + try { + return new self($onFulfilled($this->response)); + } catch (Exception $e) { + return new HttpRejectedPromise($e); + } + } + + /** + * {@inheritdoc} + */ + public function getState() + { + return Promise::FULFILLED; + } + + /** + * {@inheritdoc} + */ + public function wait($unwrap = true) + { + if ($unwrap) { + return $this->response; + } + } +} diff --git a/vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php b/vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php new file mode 100644 index 0000000..bfb0738 --- /dev/null +++ b/vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php @@ -0,0 +1,56 @@ +exception = $exception; + } + + /** + * {@inheritdoc} + */ + public function then(callable $onFulfilled = null, callable $onRejected = null) + { + if (null === $onRejected) { + return $this; + } + + try { + return new HttpFulfilledPromise($onRejected($this->exception)); + } catch (Exception $e) { + return new self($e); + } + } + + /** + * {@inheritdoc} + */ + public function getState() + { + return Promise::REJECTED; + } + + /** + * {@inheritdoc} + */ + public function wait($unwrap = true) + { + if ($unwrap) { + throw $this->exception; + } + } +} diff --git a/vendor/php-http/promise/CHANGELOG.md b/vendor/php-http/promise/CHANGELOG.md new file mode 100644 index 0000000..336e140 --- /dev/null +++ b/vendor/php-http/promise/CHANGELOG.md @@ -0,0 +1,35 @@ +# Change Log + + +## 1.0.0 - 2016-01-26 + +### Removed + +- PSR-7 dependency + + +## 1.0.0-RC1 - 2016-01-12 + +### Added + +- Tests for full coverage + +## Changed + +- Updated package files +- Clarified wait method behavior +- Contributing guide moved to the documentation + + +## 0.1.1 - 2015-12-24 + +## Added + +- Fulfilled and Rejected promise implementations + + +## 0.1.0 - 2015-12-13 + +## Added + +- Promise interface diff --git a/vendor/php-http/promise/LICENSE b/vendor/php-http/promise/LICENSE new file mode 100644 index 0000000..4558d6f --- /dev/null +++ b/vendor/php-http/promise/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015-2016 PHP HTTP Team + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/php-http/promise/README.md b/vendor/php-http/promise/README.md new file mode 100644 index 0000000..adda2ae --- /dev/null +++ b/vendor/php-http/promise/README.md @@ -0,0 +1,49 @@ +# Promise + +[![Latest Version](https://img.shields.io/github/release/php-http/promise.svg?style=flat-square)](https://github.com/php-http/promise/releases) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) +[![Build Status](https://img.shields.io/travis/php-http/promise.svg?style=flat-square)](https://travis-ci.org/php-http/promise) +[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-http/promise.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/promise) +[![Quality Score](https://img.shields.io/scrutinizer/g/php-http/promise.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-http/promise) +[![Total Downloads](https://img.shields.io/packagist/dt/php-http/promise.svg?style=flat-square)](https://packagist.org/packages/php-http/promise) + +**Promise used for asynchronous HTTP requests.** + +**Note:** This will eventually be removed/deprecated and replaced with the upcoming Promise PSR. + + +## Install + +Via Composer + +``` bash +$ composer require php-http/promise +``` + + +## Documentation + +Please see the [official documentation](http://docs.php-http.org). + + +## Testing + +``` bash +$ composer test +``` + + +## Contributing + +Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html). + + +## Security + +If you discover any security related issues, please contact us at [security@httplug.io](mailto:security@httplug.io) +or [security@php-http.org](mailto:security@php-http.org). + + +## License + +The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/vendor/php-http/promise/composer.json b/vendor/php-http/promise/composer.json new file mode 100644 index 0000000..ff1d2ce --- /dev/null +++ b/vendor/php-http/promise/composer.json @@ -0,0 +1,35 @@ +{ + "name": "php-http/promise", + "description": "Promise used for asynchronous HTTP requests", + "license": "MIT", + "keywords": ["promise"], + "homepage": "http://httplug.io", + "authors": [ + { + "name": "Joel Wurtz", + "email": "joel.wurtz@gmail.com" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "require-dev": { + "phpspec/phpspec": "^2.4", + "henrikbjorn/phpspec-code-coverage" : "^1.0" + }, + "autoload": { + "psr-4": { + "Http\\Promise\\": "src/" + } + }, + "scripts": { + "test": "vendor/bin/phpspec run", + "test-ci": "vendor/bin/phpspec run -c phpspec.yml.ci" + }, + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + } +} diff --git a/vendor/php-http/promise/src/FulfilledPromise.php b/vendor/php-http/promise/src/FulfilledPromise.php new file mode 100644 index 0000000..f60f686 --- /dev/null +++ b/vendor/php-http/promise/src/FulfilledPromise.php @@ -0,0 +1,58 @@ + + */ +final class FulfilledPromise implements Promise +{ + /** + * @var mixed + */ + private $result; + + /** + * @param $result + */ + public function __construct($result) + { + $this->result = $result; + } + + /** + * {@inheritdoc} + */ + public function then(callable $onFulfilled = null, callable $onRejected = null) + { + if (null === $onFulfilled) { + return $this; + } + + try { + return new self($onFulfilled($this->result)); + } catch (\Exception $e) { + return new RejectedPromise($e); + } + } + + /** + * {@inheritdoc} + */ + public function getState() + { + return Promise::FULFILLED; + } + + /** + * {@inheritdoc} + */ + public function wait($unwrap = true) + { + if ($unwrap) { + return $this->result; + } + } +} diff --git a/vendor/php-http/promise/src/Promise.php b/vendor/php-http/promise/src/Promise.php new file mode 100644 index 0000000..e2cf5f8 --- /dev/null +++ b/vendor/php-http/promise/src/Promise.php @@ -0,0 +1,69 @@ + + * @author Márk Sági-Kazár + */ +interface Promise +{ + /** + * Promise has not been fulfilled or rejected. + */ + const PENDING = 'pending'; + + /** + * Promise has been fulfilled. + */ + const FULFILLED = 'fulfilled'; + + /** + * Promise has been rejected. + */ + const REJECTED = 'rejected'; + + /** + * Adds behavior for when the promise is resolved or rejected (response will be available, or error happens). + * + * If you do not care about one of the cases, you can set the corresponding callable to null + * The callback will be called when the value arrived and never more than once. + * + * @param callable $onFulfilled Called when a response will be available. + * @param callable $onRejected Called when an exception occurs. + * + * @return Promise A new resolved promise with value of the executed callback (onFulfilled / onRejected). + */ + public function then(callable $onFulfilled = null, callable $onRejected = null); + + /** + * Returns the state of the promise, one of PENDING, FULFILLED or REJECTED. + * + * @return string + */ + public function getState(); + + /** + * Wait for the promise to be fulfilled or rejected. + * + * When this method returns, the request has been resolved and if callables have been + * specified, the appropriate one has terminated. + * + * When $unwrap is true (the default), the response is returned, or the exception thrown + * on failure. Otherwise, nothing is returned or thrown. + * + * @param bool $unwrap Whether to return resolved value / throw reason or not + * + * @return mixed Resolved value, null if $unwrap is set to false + * + * @throws \Exception The rejection reason if $unwrap is set to true and the request failed. + */ + public function wait($unwrap = true); +} diff --git a/vendor/php-http/promise/src/RejectedPromise.php b/vendor/php-http/promise/src/RejectedPromise.php new file mode 100644 index 0000000..e396a40 --- /dev/null +++ b/vendor/php-http/promise/src/RejectedPromise.php @@ -0,0 +1,58 @@ + + */ +final class RejectedPromise implements Promise +{ + /** + * @var \Exception + */ + private $exception; + + /** + * @param \Exception $exception + */ + public function __construct(\Exception $exception) + { + $this->exception = $exception; + } + + /** + * {@inheritdoc} + */ + public function then(callable $onFulfilled = null, callable $onRejected = null) + { + if (null === $onRejected) { + return $this; + } + + try { + return new FulfilledPromise($onRejected($this->exception)); + } catch (\Exception $e) { + return new self($e); + } + } + + /** + * {@inheritdoc} + */ + public function getState() + { + return Promise::REJECTED; + } + + /** + * {@inheritdoc} + */ + public function wait($unwrap = true) + { + if ($unwrap) { + throw $this->exception; + } + } +} diff --git a/vendor/phpdocumentor/reflection-common/.travis.yml b/vendor/phpdocumentor/reflection-common/.travis.yml new file mode 100644 index 0000000..958ecf8 --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/.travis.yml @@ -0,0 +1,35 @@ +language: php +php: + - 5.5 + - 5.6 + - 7.0 + - 7.1 + - hhvm + - nightly + +matrix: + allow_failures: + - php: + - hhvm + - nightly + +cache: + directories: + - $HOME/.composer/cache + +script: + - vendor/bin/phpunit --coverage-clover=coverage.clover -v + - composer update --no-interaction --prefer-source + - vendor/bin/phpunit -v + +before_script: + - composer install --no-interaction + +after_script: + - if [ $TRAVIS_PHP_VERSION = '5.6' ]; then wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi + +notifications: + irc: "irc.freenode.org#phpdocumentor" + email: + - me@mikevanriel.com + - ashnazg@php.net diff --git a/vendor/phpdocumentor/reflection-common/LICENSE b/vendor/phpdocumentor/reflection-common/LICENSE new file mode 100644 index 0000000..ed6926c --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 phpDocumentor + +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/phpdocumentor/reflection-common/README.md b/vendor/phpdocumentor/reflection-common/README.md new file mode 100644 index 0000000..68a80c8 --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/README.md @@ -0,0 +1,2 @@ +# ReflectionCommon +[![Build Status](https://travis-ci.org/phpDocumentor/ReflectionCommon.svg?branch=master)](https://travis-ci.org/phpDocumentor/ReflectionCommon) diff --git a/vendor/phpdocumentor/reflection-common/composer.json b/vendor/phpdocumentor/reflection-common/composer.json new file mode 100644 index 0000000..90eee0f --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/composer.json @@ -0,0 +1,29 @@ +{ + "name": "phpdocumentor/reflection-common", + "keywords": ["phpdoc", "phpDocumentor", "reflection", "static analysis", "FQSEN"], + "homepage": "http://www.phpdoc.org", + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "license": "MIT", + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "require": { + "php": ">=5.5" + }, + "autoload" : { + "psr-4" : { + "phpDocumentor\\Reflection\\": ["src"] + } + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/phpdocumentor/reflection-common/src/Element.php b/vendor/phpdocumentor/reflection-common/src/Element.php new file mode 100644 index 0000000..712e30e --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/src/Element.php @@ -0,0 +1,32 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +/** + * Interface for files processed by the ProjectFactory + */ +interface File +{ + /** + * Returns the content of the file as a string. + * + * @return string + */ + public function getContents(); + + /** + * Returns md5 hash of the file. + * + * @return string + */ + public function md5(); + + /** + * Returns an relative path to the file. + * + * @return string + */ + public function path(); +} diff --git a/vendor/phpdocumentor/reflection-common/src/Fqsen.php b/vendor/phpdocumentor/reflection-common/src/Fqsen.php new file mode 100644 index 0000000..ce88d03 --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/src/Fqsen.php @@ -0,0 +1,82 @@ +fqsen = $fqsen; + + if (isset($matches[2])) { + $this->name = $matches[2]; + } else { + $matches = explode('\\', $fqsen); + $this->name = trim(end($matches), '()'); + } + } + + /** + * converts this class to string. + * + * @return string + */ + public function __toString() + { + return $this->fqsen; + } + + /** + * Returns the name of the element without path. + * + * @return string + */ + public function getName() + { + return $this->name; + } +} diff --git a/vendor/phpdocumentor/reflection-common/src/Location.php b/vendor/phpdocumentor/reflection-common/src/Location.php new file mode 100644 index 0000000..5760321 --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/src/Location.php @@ -0,0 +1,57 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +/** + * The location where an element occurs within a file. + */ +final class Location +{ + /** @var int */ + private $lineNumber = 0; + + /** @var int */ + private $columnNumber = 0; + + /** + * Initializes the location for an element using its line number in the file and optionally the column number. + * + * @param int $lineNumber + * @param int $columnNumber + */ + public function __construct($lineNumber, $columnNumber = 0) + { + $this->lineNumber = $lineNumber; + $this->columnNumber = $columnNumber; + } + + /** + * Returns the line number that is covered by this location. + * + * @return integer + */ + public function getLineNumber() + { + return $this->lineNumber; + } + + /** + * Returns the column number (character position on a line) for this location object. + * + * @return integer + */ + public function getColumnNumber() + { + return $this->columnNumber; + } +} diff --git a/vendor/phpdocumentor/reflection-common/src/Project.php b/vendor/phpdocumentor/reflection-common/src/Project.php new file mode 100644 index 0000000..3ed1e39 --- /dev/null +++ b/vendor/phpdocumentor/reflection-common/src/Project.php @@ -0,0 +1,25 @@ +create($docComment); +``` + +The `create` method will yield an object of type `\phpDocumentor\Reflection\DocBlock` +whose methods can be queried: + +```php +// Contains the summary for this DocBlock +$summary = $docblock->getSummary(); + +// Contains \phpDocumentor\Reflection\DocBlock\Description object +$description = $docblock->getDescription(); + +// You can either cast it to string +$description = (string) $docblock->getDescription(); + +// Or use the render method to get a string representation of the Description. +$description = $docblock->getDescription()->render(); +``` + +> For more examples it would be best to review the scripts in the [`/examples` folder](/examples). diff --git a/vendor/phpdocumentor/reflection-docblock/composer.json b/vendor/phpdocumentor/reflection-docblock/composer.json new file mode 100644 index 0000000..e3dc38a --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/composer.json @@ -0,0 +1,34 @@ +{ + "name": "phpdocumentor/reflection-docblock", + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" + }, + "autoload": { + "psr-4": {"phpDocumentor\\Reflection\\": ["src/"]} + }, + "autoload-dev": { + "psr-4": {"phpDocumentor\\Reflection\\": ["tests/unit"]} + }, + "require-dev": { + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4", + "doctrine/instantiator": "~1.0.5" + }, + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/easy-coding-standard.neon b/vendor/phpdocumentor/reflection-docblock/easy-coding-standard.neon new file mode 100644 index 0000000..7c2ba6e --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/easy-coding-standard.neon @@ -0,0 +1,31 @@ +includes: + - temp/ecs/config/clean-code.neon + - temp/ecs/config/psr2-checkers.neon + - temp/ecs/config/spaces.neon + - temp/ecs/config/common.neon + +checkers: + PhpCsFixer\Fixer\Operator\ConcatSpaceFixer: + spacing: one + +parameters: + exclude_checkers: + # from temp/ecs/config/common.neon + - PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer + - PhpCsFixer\Fixer\PhpUnit\PhpUnitStrictFixer + - PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer + # from temp/ecs/config/spaces.neon + - PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer + + skip: + SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff: + # WIP code + - src/DocBlock/StandardTagFactory.php + PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\EmptyStatementSniff: + # WIP code + - src/DocBlock/StandardTagFactory.php + PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff: + - src/DocBlock/Tags/Return_.php + - src/DocBlock/Tags/Var_.php + PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff: + - */tests/** diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock.php new file mode 100644 index 0000000..46605b7 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock.php @@ -0,0 +1,236 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +use phpDocumentor\Reflection\DocBlock\Tag; +use Webmozart\Assert\Assert; + +final class DocBlock +{ + /** @var string The opening line for this docblock. */ + private $summary = ''; + + /** @var DocBlock\Description The actual description for this docblock. */ + private $description = null; + + /** @var Tag[] An array containing all the tags in this docblock; except inline. */ + private $tags = []; + + /** @var Types\Context Information about the context of this DocBlock. */ + private $context = null; + + /** @var Location Information about the location of this DocBlock. */ + private $location = null; + + /** @var bool Is this DocBlock (the start of) a template? */ + private $isTemplateStart = false; + + /** @var bool Does this DocBlock signify the end of a DocBlock template? */ + private $isTemplateEnd = false; + + /** + * @param string $summary + * @param DocBlock\Description $description + * @param DocBlock\Tag[] $tags + * @param Types\Context $context The context in which the DocBlock occurs. + * @param Location $location The location within the file that this DocBlock occurs in. + * @param bool $isTemplateStart + * @param bool $isTemplateEnd + */ + public function __construct( + $summary = '', + DocBlock\Description $description = null, + array $tags = [], + Types\Context $context = null, + Location $location = null, + $isTemplateStart = false, + $isTemplateEnd = false + ) { + Assert::string($summary); + Assert::boolean($isTemplateStart); + Assert::boolean($isTemplateEnd); + Assert::allIsInstanceOf($tags, Tag::class); + + $this->summary = $summary; + $this->description = $description ?: new DocBlock\Description(''); + foreach ($tags as $tag) { + $this->addTag($tag); + } + + $this->context = $context; + $this->location = $location; + + $this->isTemplateEnd = $isTemplateEnd; + $this->isTemplateStart = $isTemplateStart; + } + + /** + * @return string + */ + public function getSummary() + { + return $this->summary; + } + + /** + * @return DocBlock\Description + */ + public function getDescription() + { + return $this->description; + } + + /** + * Returns the current context. + * + * @return Types\Context + */ + public function getContext() + { + return $this->context; + } + + /** + * Returns the current location. + * + * @return Location + */ + public function getLocation() + { + return $this->location; + } + + /** + * Returns whether this DocBlock is the start of a Template section. + * + * A Docblock may serve as template for a series of subsequent DocBlocks. This is indicated by a special marker + * (`#@+`) that is appended directly after the opening `/**` of a DocBlock. + * + * An example of such an opening is: + * + * ``` + * /**#@+ + * * My DocBlock + * * / + * ``` + * + * The description and tags (not the summary!) are copied onto all subsequent DocBlocks and also applied to all + * elements that follow until another DocBlock is found that contains the closing marker (`#@-`). + * + * @see self::isTemplateEnd() for the check whether a closing marker was provided. + * + * @return boolean + */ + public function isTemplateStart() + { + return $this->isTemplateStart; + } + + /** + * Returns whether this DocBlock is the end of a Template section. + * + * @see self::isTemplateStart() for a more complete description of the Docblock Template functionality. + * + * @return boolean + */ + public function isTemplateEnd() + { + return $this->isTemplateEnd; + } + + /** + * Returns the tags for this DocBlock. + * + * @return Tag[] + */ + public function getTags() + { + return $this->tags; + } + + /** + * Returns an array of tags matching the given name. If no tags are found + * an empty array is returned. + * + * @param string $name String to search by. + * + * @return Tag[] + */ + public function getTagsByName($name) + { + Assert::string($name); + + $result = []; + + /** @var Tag $tag */ + foreach ($this->getTags() as $tag) { + if ($tag->getName() !== $name) { + continue; + } + + $result[] = $tag; + } + + return $result; + } + + /** + * Checks if a tag of a certain type is present in this DocBlock. + * + * @param string $name Tag name to check for. + * + * @return bool + */ + public function hasTag($name) + { + Assert::string($name); + + /** @var Tag $tag */ + foreach ($this->getTags() as $tag) { + if ($tag->getName() === $name) { + return true; + } + } + + return false; + } + + /** + * Remove a tag from this DocBlock. + * + * @param Tag $tag The tag to remove. + * + * @return void + */ + public function removeTag(Tag $tagToRemove) + { + foreach ($this->tags as $key => $tag) { + if ($tag === $tagToRemove) { + unset($this->tags[$key]); + break; + } + } + } + + /** + * Adds a tag to this DocBlock. + * + * @param Tag $tag The tag to add. + * + * @return void + */ + private function addTag(Tag $tag) + { + $this->tags[] = $tag; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Description.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Description.php new file mode 100644 index 0000000..25a79e0 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Description.php @@ -0,0 +1,114 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock; + +use phpDocumentor\Reflection\DocBlock\Tags\Formatter; +use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; +use Webmozart\Assert\Assert; + +/** + * Object representing to description for a DocBlock. + * + * A Description object can consist of plain text but can also include tags. A Description Formatter can then combine + * a body template with sprintf-style placeholders together with formatted tags in order to reconstitute a complete + * description text using the format that you would prefer. + * + * Because parsing a Description text can be a verbose process this is handled by the {@see DescriptionFactory}. It is + * thus recommended to use that to create a Description object, like this: + * + * $description = $descriptionFactory->create('This is a {@see Description}', $context); + * + * The description factory will interpret the given body and create a body template and list of tags from them, and pass + * that onto the constructor if this class. + * + * > The $context variable is a class of type {@see \phpDocumentor\Reflection\Types\Context} and contains the namespace + * > and the namespace aliases that apply to this DocBlock. These are used by the Factory to resolve and expand partial + * > type names and FQSENs. + * + * If you do not want to use the DescriptionFactory you can pass a body template and tag listing like this: + * + * $description = new Description( + * 'This is a %1$s', + * [ new See(new Fqsen('\phpDocumentor\Reflection\DocBlock\Description')) ] + * ); + * + * It is generally recommended to use the Factory as that will also apply escaping rules, while the Description object + * is mainly responsible for rendering. + * + * @see DescriptionFactory to create a new Description. + * @see Description\Formatter for the formatting of the body and tags. + */ +class Description +{ + /** @var string */ + private $bodyTemplate; + + /** @var Tag[] */ + private $tags; + + /** + * Initializes a Description with its body (template) and a listing of the tags used in the body template. + * + * @param string $bodyTemplate + * @param Tag[] $tags + */ + public function __construct($bodyTemplate, array $tags = []) + { + Assert::string($bodyTemplate); + + $this->bodyTemplate = $bodyTemplate; + $this->tags = $tags; + } + + /** + * Returns the tags for this DocBlock. + * + * @return Tag[] + */ + public function getTags() + { + return $this->tags; + } + + /** + * Renders this description as a string where the provided formatter will format the tags in the expected string + * format. + * + * @param Formatter|null $formatter + * + * @return string + */ + public function render(Formatter $formatter = null) + { + if ($formatter === null) { + $formatter = new PassthroughFormatter(); + } + + $tags = []; + foreach ($this->tags as $tag) { + $tags[] = '{' . $formatter->format($tag) . '}'; + } + + return vsprintf($this->bodyTemplate, $tags); + } + + /** + * Returns a plain string representation of this description. + * + * @return string + */ + public function __toString() + { + return $this->render(); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/DescriptionFactory.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/DescriptionFactory.php new file mode 100644 index 0000000..48f9c21 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/DescriptionFactory.php @@ -0,0 +1,191 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock; + +use phpDocumentor\Reflection\Types\Context as TypeContext; + +/** + * Creates a new Description object given a body of text. + * + * Descriptions in phpDocumentor are somewhat complex entities as they can contain one or more tags inside their + * body that can be replaced with a readable output. The replacing is done by passing a Formatter object to the + * Description object's `render` method. + * + * In addition to the above does a Description support two types of escape sequences: + * + * 1. `{@}` to escape the `@` character to prevent it from being interpreted as part of a tag, i.e. `{{@}link}` + * 2. `{}` to escape the `}` character, this can be used if you want to use the `}` character in the description + * of an inline tag. + * + * If a body consists of multiple lines then this factory will also remove any superfluous whitespace at the beginning + * of each line while maintaining any indentation that is used. This will prevent formatting parsers from tripping + * over unexpected spaces as can be observed with tag descriptions. + */ +class DescriptionFactory +{ + /** @var TagFactory */ + private $tagFactory; + + /** + * Initializes this factory with the means to construct (inline) tags. + * + * @param TagFactory $tagFactory + */ + public function __construct(TagFactory $tagFactory) + { + $this->tagFactory = $tagFactory; + } + + /** + * Returns the parsed text of this description. + * + * @param string $contents + * @param TypeContext $context + * + * @return Description + */ + public function create($contents, TypeContext $context = null) + { + list($text, $tags) = $this->parse($this->lex($contents), $context); + + return new Description($text, $tags); + } + + /** + * Strips the contents from superfluous whitespace and splits the description into a series of tokens. + * + * @param string $contents + * + * @return string[] A series of tokens of which the description text is composed. + */ + private function lex($contents) + { + $contents = $this->removeSuperfluousStartingWhitespace($contents); + + // performance optimalization; if there is no inline tag, don't bother splitting it up. + if (strpos($contents, '{@') === false) { + return [$contents]; + } + + return preg_split( + '/\{ + # "{@}" is not a valid inline tag. This ensures that we do not treat it as one, but treat it literally. + (?!@\}) + # We want to capture the whole tag line, but without the inline tag delimiters. + (\@ + # Match everything up to the next delimiter. + [^{}]* + # Nested inline tag content should not be captured, or it will appear in the result separately. + (?: + # Match nested inline tags. + (?: + # Because we did not catch the tag delimiters earlier, we must be explicit with them here. + # Notice that this also matches "{}", as a way to later introduce it as an escape sequence. + \{(?1)?\} + | + # Make sure we match hanging "{". + \{ + ) + # Match content after the nested inline tag. + [^{}]* + )* # If there are more inline tags, match them as well. We use "*" since there may not be any + # nested inline tags. + ) + \}/Sux', + $contents, + null, + PREG_SPLIT_DELIM_CAPTURE + ); + } + + /** + * Parses the stream of tokens in to a new set of tokens containing Tags. + * + * @param string[] $tokens + * @param TypeContext $context + * + * @return string[]|Tag[] + */ + private function parse($tokens, TypeContext $context) + { + $count = count($tokens); + $tagCount = 0; + $tags = []; + + for ($i = 1; $i < $count; $i += 2) { + $tags[] = $this->tagFactory->create($tokens[$i], $context); + $tokens[$i] = '%' . ++$tagCount . '$s'; + } + + //In order to allow "literal" inline tags, the otherwise invalid + //sequence "{@}" is changed to "@", and "{}" is changed to "}". + //"%" is escaped to "%%" because of vsprintf. + //See unit tests for examples. + for ($i = 0; $i < $count; $i += 2) { + $tokens[$i] = str_replace(['{@}', '{}', '%'], ['@', '}', '%%'], $tokens[$i]); + } + + return [implode('', $tokens), $tags]; + } + + /** + * Removes the superfluous from a multi-line description. + * + * When a description has more than one line then it can happen that the second and subsequent lines have an + * additional indentation. This is commonly in use with tags like this: + * + * {@}since 1.1.0 This is an example + * description where we have an + * indentation in the second and + * subsequent lines. + * + * If we do not normalize the indentation then we have superfluous whitespace on the second and subsequent + * lines and this may cause rendering issues when, for example, using a Markdown converter. + * + * @param string $contents + * + * @return string + */ + private function removeSuperfluousStartingWhitespace($contents) + { + $lines = explode("\n", $contents); + + // if there is only one line then we don't have lines with superfluous whitespace and + // can use the contents as-is + if (count($lines) <= 1) { + return $contents; + } + + // determine how many whitespace characters need to be stripped + $startingSpaceCount = 9999999; + for ($i = 1; $i < count($lines); $i++) { + // lines with a no length do not count as they are not indented at all + if (strlen(trim($lines[$i])) === 0) { + continue; + } + + // determine the number of prefixing spaces by checking the difference in line length before and after + // an ltrim + $startingSpaceCount = min($startingSpaceCount, strlen($lines[$i]) - strlen(ltrim($lines[$i]))); + } + + // strip the number of spaces from each line + if ($startingSpaceCount > 0) { + for ($i = 1; $i < count($lines); $i++) { + $lines[$i] = substr($lines[$i], $startingSpaceCount); + } + } + + return implode("\n", $lines); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/ExampleFinder.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/ExampleFinder.php new file mode 100644 index 0000000..571ed74 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/ExampleFinder.php @@ -0,0 +1,170 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock; + +use phpDocumentor\Reflection\DocBlock\Tags\Example; + +/** + * Class used to find an example file's location based on a given ExampleDescriptor. + */ +class ExampleFinder +{ + /** @var string */ + private $sourceDirectory = ''; + + /** @var string[] */ + private $exampleDirectories = []; + + /** + * Attempts to find the example contents for the given descriptor. + * + * @param Example $example + * + * @return string + */ + public function find(Example $example) + { + $filename = $example->getFilePath(); + + $file = $this->getExampleFileContents($filename); + if (!$file) { + return "** File not found : {$filename} **"; + } + + return implode('', array_slice($file, $example->getStartingLine() - 1, $example->getLineCount())); + } + + /** + * Registers the project's root directory where an 'examples' folder can be expected. + * + * @param string $directory + * + * @return void + */ + public function setSourceDirectory($directory = '') + { + $this->sourceDirectory = $directory; + } + + /** + * Returns the project's root directory where an 'examples' folder can be expected. + * + * @return string + */ + public function getSourceDirectory() + { + return $this->sourceDirectory; + } + + /** + * Registers a series of directories that may contain examples. + * + * @param string[] $directories + */ + public function setExampleDirectories(array $directories) + { + $this->exampleDirectories = $directories; + } + + /** + * Returns a series of directories that may contain examples. + * + * @return string[] + */ + public function getExampleDirectories() + { + return $this->exampleDirectories; + } + + /** + * Attempts to find the requested example file and returns its contents or null if no file was found. + * + * This method will try several methods in search of the given example file, the first one it encounters is + * returned: + * + * 1. Iterates through all examples folders for the given filename + * 2. Checks the source folder for the given filename + * 3. Checks the 'examples' folder in the current working directory for examples + * 4. Checks the path relative to the current working directory for the given filename + * + * @param string $filename + * + * @return string|null + */ + private function getExampleFileContents($filename) + { + $normalizedPath = null; + + foreach ($this->exampleDirectories as $directory) { + $exampleFileFromConfig = $this->constructExamplePath($directory, $filename); + if (is_readable($exampleFileFromConfig)) { + $normalizedPath = $exampleFileFromConfig; + break; + } + } + + if (!$normalizedPath) { + if (is_readable($this->getExamplePathFromSource($filename))) { + $normalizedPath = $this->getExamplePathFromSource($filename); + } elseif (is_readable($this->getExamplePathFromExampleDirectory($filename))) { + $normalizedPath = $this->getExamplePathFromExampleDirectory($filename); + } elseif (is_readable($filename)) { + $normalizedPath = $filename; + } + } + + return $normalizedPath && is_readable($normalizedPath) ? file($normalizedPath) : null; + } + + /** + * Get example filepath based on the example directory inside your project. + * + * @param string $file + * + * @return string + */ + private function getExamplePathFromExampleDirectory($file) + { + return getcwd() . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $file; + } + + /** + * Returns a path to the example file in the given directory.. + * + * @param string $directory + * @param string $file + * + * @return string + */ + private function constructExamplePath($directory, $file) + { + return rtrim($directory, '\\/') . DIRECTORY_SEPARATOR . $file; + } + + /** + * Get example filepath based on sourcecode. + * + * @param string $file + * + * @return string + */ + private function getExamplePathFromSource($file) + { + return sprintf( + '%s%s%s', + trim($this->getSourceDirectory(), '\\/'), + DIRECTORY_SEPARATOR, + trim($file, '"') + ); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Serializer.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Serializer.php new file mode 100644 index 0000000..0f355f5 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Serializer.php @@ -0,0 +1,155 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock; + +use phpDocumentor\Reflection\DocBlock; +use Webmozart\Assert\Assert; + +/** + * Converts a DocBlock back from an object to a complete DocComment including Asterisks. + */ +class Serializer +{ + /** @var string The string to indent the comment with. */ + protected $indentString = ' '; + + /** @var int The number of times the indent string is repeated. */ + protected $indent = 0; + + /** @var bool Whether to indent the first line with the given indent amount and string. */ + protected $isFirstLineIndented = true; + + /** @var int|null The max length of a line. */ + protected $lineLength = null; + + /** @var DocBlock\Tags\Formatter A custom tag formatter. */ + protected $tagFormatter = null; + + /** + * Create a Serializer instance. + * + * @param int $indent The number of times the indent string is repeated. + * @param string $indentString The string to indent the comment with. + * @param bool $indentFirstLine Whether to indent the first line. + * @param int|null $lineLength The max length of a line or NULL to disable line wrapping. + * @param DocBlock\Tags\Formatter $tagFormatter A custom tag formatter, defaults to PassthroughFormatter. + */ + public function __construct($indent = 0, $indentString = ' ', $indentFirstLine = true, $lineLength = null, $tagFormatter = null) + { + Assert::integer($indent); + Assert::string($indentString); + Assert::boolean($indentFirstLine); + Assert::nullOrInteger($lineLength); + Assert::nullOrIsInstanceOf($tagFormatter, 'phpDocumentor\Reflection\DocBlock\Tags\Formatter'); + + $this->indent = $indent; + $this->indentString = $indentString; + $this->isFirstLineIndented = $indentFirstLine; + $this->lineLength = $lineLength; + $this->tagFormatter = $tagFormatter ?: new DocBlock\Tags\Formatter\PassthroughFormatter(); + } + + /** + * Generate a DocBlock comment. + * + * @param DocBlock $docblock The DocBlock to serialize. + * + * @return string The serialized doc block. + */ + public function getDocComment(DocBlock $docblock) + { + $indent = str_repeat($this->indentString, $this->indent); + $firstIndent = $this->isFirstLineIndented ? $indent : ''; + // 3 === strlen(' * ') + $wrapLength = $this->lineLength ? $this->lineLength - strlen($indent) - 3 : null; + + $text = $this->removeTrailingSpaces( + $indent, + $this->addAsterisksForEachLine( + $indent, + $this->getSummaryAndDescriptionTextBlock($docblock, $wrapLength) + ) + ); + + $comment = "{$firstIndent}/**\n"; + if ($text) { + $comment .= "{$indent} * {$text}\n"; + $comment .= "{$indent} *\n"; + } + + $comment = $this->addTagBlock($docblock, $wrapLength, $indent, $comment); + $comment .= $indent . ' */'; + + return $comment; + } + + /** + * @param $indent + * @param $text + * @return mixed + */ + private function removeTrailingSpaces($indent, $text) + { + return str_replace("\n{$indent} * \n", "\n{$indent} *\n", $text); + } + + /** + * @param $indent + * @param $text + * @return mixed + */ + private function addAsterisksForEachLine($indent, $text) + { + return str_replace("\n", "\n{$indent} * ", $text); + } + + /** + * @param DocBlock $docblock + * @param $wrapLength + * @return string + */ + private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, $wrapLength) + { + $text = $docblock->getSummary() . ((string)$docblock->getDescription() ? "\n\n" . $docblock->getDescription() + : ''); + if ($wrapLength !== null) { + $text = wordwrap($text, $wrapLength); + return $text; + } + + return $text; + } + + /** + * @param DocBlock $docblock + * @param $wrapLength + * @param $indent + * @param $comment + * @return string + */ + private function addTagBlock(DocBlock $docblock, $wrapLength, $indent, $comment) + { + foreach ($docblock->getTags() as $tag) { + $tagText = $this->tagFormatter->format($tag); + if ($wrapLength !== null) { + $tagText = wordwrap($tagText, $wrapLength); + } + + $tagText = str_replace("\n", "\n{$indent} * ", $tagText); + + $comment .= "{$indent} * {$tagText}\n"; + } + + return $comment; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/StandardTagFactory.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/StandardTagFactory.php new file mode 100644 index 0000000..5a8143c --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/StandardTagFactory.php @@ -0,0 +1,319 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock; + +use phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod; +use phpDocumentor\Reflection\DocBlock\Tags\Generic; +use phpDocumentor\Reflection\FqsenResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Creates a Tag object given the contents of a tag. + * + * This Factory is capable of determining the appropriate class for a tag and instantiate it using its `create` + * factory method. The `create` factory method of a Tag can have a variable number of arguments; this way you can + * pass the dependencies that you need to construct a tag object. + * + * > Important: each parameter in addition to the body variable for the `create` method must default to null, otherwise + * > it violates the constraint with the interface; it is recommended to use the {@see Assert::notNull()} method to + * > verify that a dependency is actually passed. + * + * This Factory also features a Service Locator component that is used to pass the right dependencies to the + * `create` method of a tag; each dependency should be registered as a service or as a parameter. + * + * When you want to use a Tag of your own with custom handling you need to call the `registerTagHandler` method, pass + * the name of the tag and a Fully Qualified Class Name pointing to a class that implements the Tag interface. + */ +final class StandardTagFactory implements TagFactory +{ + /** PCRE regular expression matching a tag name. */ + const REGEX_TAGNAME = '[\w\-\_\\\\]+'; + + /** + * @var string[] An array with a tag as a key, and an FQCN to a class that handles it as an array value. + */ + private $tagHandlerMappings = [ + 'author' => '\phpDocumentor\Reflection\DocBlock\Tags\Author', + 'covers' => '\phpDocumentor\Reflection\DocBlock\Tags\Covers', + 'deprecated' => '\phpDocumentor\Reflection\DocBlock\Tags\Deprecated', + // 'example' => '\phpDocumentor\Reflection\DocBlock\Tags\Example', + 'link' => '\phpDocumentor\Reflection\DocBlock\Tags\Link', + 'method' => '\phpDocumentor\Reflection\DocBlock\Tags\Method', + 'param' => '\phpDocumentor\Reflection\DocBlock\Tags\Param', + 'property-read' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyRead', + 'property' => '\phpDocumentor\Reflection\DocBlock\Tags\Property', + 'property-write' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite', + 'return' => '\phpDocumentor\Reflection\DocBlock\Tags\Return_', + 'see' => '\phpDocumentor\Reflection\DocBlock\Tags\See', + 'since' => '\phpDocumentor\Reflection\DocBlock\Tags\Since', + 'source' => '\phpDocumentor\Reflection\DocBlock\Tags\Source', + 'throw' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws', + 'throws' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws', + 'uses' => '\phpDocumentor\Reflection\DocBlock\Tags\Uses', + 'var' => '\phpDocumentor\Reflection\DocBlock\Tags\Var_', + 'version' => '\phpDocumentor\Reflection\DocBlock\Tags\Version' + ]; + + /** + * @var \ReflectionParameter[][] a lazy-loading cache containing parameters for each tagHandler that has been used. + */ + private $tagHandlerParameterCache = []; + + /** + * @var FqsenResolver + */ + private $fqsenResolver; + + /** + * @var mixed[] an array representing a simple Service Locator where we can store parameters and + * services that can be inserted into the Factory Methods of Tag Handlers. + */ + private $serviceLocator = []; + + /** + * Initialize this tag factory with the means to resolve an FQSEN and optionally a list of tag handlers. + * + * If no tag handlers are provided than the default list in the {@see self::$tagHandlerMappings} property + * is used. + * + * @param FqsenResolver $fqsenResolver + * @param string[] $tagHandlers + * + * @see self::registerTagHandler() to add a new tag handler to the existing default list. + */ + public function __construct(FqsenResolver $fqsenResolver, array $tagHandlers = null) + { + $this->fqsenResolver = $fqsenResolver; + if ($tagHandlers !== null) { + $this->tagHandlerMappings = $tagHandlers; + } + + $this->addService($fqsenResolver, FqsenResolver::class); + } + + /** + * {@inheritDoc} + */ + public function create($tagLine, TypeContext $context = null) + { + if (! $context) { + $context = new TypeContext(''); + } + + list($tagName, $tagBody) = $this->extractTagParts($tagLine); + + if ($tagBody !== '' && $tagBody[0] === '[') { + throw new \InvalidArgumentException( + 'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors' + ); + } + + return $this->createTag($tagBody, $tagName, $context); + } + + /** + * {@inheritDoc} + */ + public function addParameter($name, $value) + { + $this->serviceLocator[$name] = $value; + } + + /** + * {@inheritDoc} + */ + public function addService($service, $alias = null) + { + $this->serviceLocator[$alias ?: get_class($service)] = $service; + } + + /** + * {@inheritDoc} + */ + public function registerTagHandler($tagName, $handler) + { + Assert::stringNotEmpty($tagName); + Assert::stringNotEmpty($handler); + Assert::classExists($handler); + Assert::implementsInterface($handler, StaticMethod::class); + + if (strpos($tagName, '\\') && $tagName[0] !== '\\') { + throw new \InvalidArgumentException( + 'A namespaced tag must have a leading backslash as it must be fully qualified' + ); + } + + $this->tagHandlerMappings[$tagName] = $handler; + } + + /** + * Extracts all components for a tag. + * + * @param string $tagLine + * + * @return string[] + */ + private function extractTagParts($tagLine) + { + $matches = []; + if (! preg_match('/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)/us', $tagLine, $matches)) { + throw new \InvalidArgumentException( + 'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors' + ); + } + + if (count($matches) < 3) { + $matches[] = ''; + } + + return array_slice($matches, 1); + } + + /** + * Creates a new tag object with the given name and body or returns null if the tag name was recognized but the + * body was invalid. + * + * @param string $body + * @param string $name + * @param TypeContext $context + * + * @return Tag|null + */ + private function createTag($body, $name, TypeContext $context) + { + $handlerClassName = $this->findHandlerClassName($name, $context); + $arguments = $this->getArgumentsForParametersFromWiring( + $this->fetchParametersForHandlerFactoryMethod($handlerClassName), + $this->getServiceLocatorWithDynamicParameters($context, $name, $body) + ); + + return call_user_func_array([$handlerClassName, 'create'], $arguments); + } + + /** + * Determines the Fully Qualified Class Name of the Factory or Tag (containing a Factory Method `create`). + * + * @param string $tagName + * @param TypeContext $context + * + * @return string + */ + private function findHandlerClassName($tagName, TypeContext $context) + { + $handlerClassName = Generic::class; + if (isset($this->tagHandlerMappings[$tagName])) { + $handlerClassName = $this->tagHandlerMappings[$tagName]; + } elseif ($this->isAnnotation($tagName)) { + // TODO: Annotation support is planned for a later stage and as such is disabled for now + // $tagName = (string)$this->fqsenResolver->resolve($tagName, $context); + // if (isset($this->annotationMappings[$tagName])) { + // $handlerClassName = $this->annotationMappings[$tagName]; + // } + } + + return $handlerClassName; + } + + /** + * Retrieves the arguments that need to be passed to the Factory Method with the given Parameters. + * + * @param \ReflectionParameter[] $parameters + * @param mixed[] $locator + * + * @return mixed[] A series of values that can be passed to the Factory Method of the tag whose parameters + * is provided with this method. + */ + private function getArgumentsForParametersFromWiring($parameters, $locator) + { + $arguments = []; + foreach ($parameters as $index => $parameter) { + $typeHint = $parameter->getClass() ? $parameter->getClass()->getName() : null; + if (isset($locator[$typeHint])) { + $arguments[] = $locator[$typeHint]; + continue; + } + + $parameterName = $parameter->getName(); + if (isset($locator[$parameterName])) { + $arguments[] = $locator[$parameterName]; + continue; + } + + $arguments[] = null; + } + + return $arguments; + } + + /** + * Retrieves a series of ReflectionParameter objects for the static 'create' method of the given + * tag handler class name. + * + * @param string $handlerClassName + * + * @return \ReflectionParameter[] + */ + private function fetchParametersForHandlerFactoryMethod($handlerClassName) + { + if (! isset($this->tagHandlerParameterCache[$handlerClassName])) { + $methodReflection = new \ReflectionMethod($handlerClassName, 'create'); + $this->tagHandlerParameterCache[$handlerClassName] = $methodReflection->getParameters(); + } + + return $this->tagHandlerParameterCache[$handlerClassName]; + } + + /** + * Returns a copy of this class' Service Locator with added dynamic parameters, such as the tag's name, body and + * Context. + * + * @param TypeContext $context The Context (namespace and aliasses) that may be passed and is used to resolve FQSENs. + * @param string $tagName The name of the tag that may be passed onto the factory method of the Tag class. + * @param string $tagBody The body of the tag that may be passed onto the factory method of the Tag class. + * + * @return mixed[] + */ + private function getServiceLocatorWithDynamicParameters(TypeContext $context, $tagName, $tagBody) + { + $locator = array_merge( + $this->serviceLocator, + [ + 'name' => $tagName, + 'body' => $tagBody, + TypeContext::class => $context + ] + ); + + return $locator; + } + + /** + * Returns whether the given tag belongs to an annotation. + * + * @param string $tagContent + * + * @todo this method should be populated once we implement Annotation notation support. + * + * @return bool + */ + private function isAnnotation($tagContent) + { + // 1. Contains a namespace separator + // 2. Contains parenthesis + // 3. Is present in a list of known annotations (make the algorithm smart by first checking is the last part + // of the annotation class name matches the found tag name + + return false; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tag.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tag.php new file mode 100644 index 0000000..e765367 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tag.php @@ -0,0 +1,26 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock; + +use phpDocumentor\Reflection\DocBlock\Tags\Formatter; + +interface Tag +{ + public function getName(); + + public static function create($body); + + public function render(Formatter $formatter = null); + + public function __toString(); +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/TagFactory.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/TagFactory.php new file mode 100644 index 0000000..3c1d113 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/TagFactory.php @@ -0,0 +1,93 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock; + +use phpDocumentor\Reflection\Types\Context as TypeContext; + +interface TagFactory +{ + /** + * Adds a parameter to the service locator that can be injected in a tag's factory method. + * + * When calling a tag's "create" method we always check the signature for dependencies to inject. One way is to + * typehint a parameter in the signature so that we can use that interface or class name to inject a dependency + * (see {@see addService()} for more information on that). + * + * Another way is to check the name of the argument against the names in the Service Locator. With this method + * you can add a variable that will be inserted when a tag's create method is not typehinted and has a matching + * name. + * + * Be aware that there are two reserved names: + * + * - name, representing the name of the tag. + * - body, representing the complete body of the tag. + * + * These parameters are injected at the last moment and will override any existing parameter with those names. + * + * @param string $name + * @param mixed $value + * + * @return void + */ + public function addParameter($name, $value); + + /** + * Registers a service with the Service Locator using the FQCN of the class or the alias, if provided. + * + * When calling a tag's "create" method we always check the signature for dependencies to inject. If a parameter + * has a typehint then the ServiceLocator is queried to see if a Service is registered for that typehint. + * + * Because interfaces are regularly used as type-hints this method provides an alias parameter; if the FQCN of the + * interface is passed as alias then every time that interface is requested the provided service will be returned. + * + * @param object $service + * @param string $alias + * + * @return void + */ + public function addService($service); + + /** + * Factory method responsible for instantiating the correct sub type. + * + * @param string $tagLine The text for this tag, including description. + * @param TypeContext $context + * + * @throws \InvalidArgumentException if an invalid tag line was presented. + * + * @return Tag A new tag object. + */ + public function create($tagLine, TypeContext $context = null); + + /** + * Registers a handler for tags. + * + * If you want to use your own tags then you can use this method to instruct the TagFactory to register the name + * of a tag with the FQCN of a 'Tag Handler'. The Tag handler should implement the {@see Tag} interface (and thus + * the create method). + * + * @param string $tagName Name of tag to register a handler for. When registering a namespaced tag, the full + * name, along with a prefixing slash MUST be provided. + * @param string $handler FQCN of handler. + * + * @throws \InvalidArgumentException if the tag name is not a string + * @throws \InvalidArgumentException if the tag name is namespaced (contains backslashes) but does not start with + * a backslash + * @throws \InvalidArgumentException if the handler is not a string + * @throws \InvalidArgumentException if the handler is not an existing class + * @throws \InvalidArgumentException if the handler does not implement the {@see Tag} interface + * + * @return void + */ + public function registerTagHandler($tagName, $handler); +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Author.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Author.php new file mode 100644 index 0000000..29d7f1d --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Author.php @@ -0,0 +1,100 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use Webmozart\Assert\Assert; + +/** + * Reflection class for an {@}author tag in a Docblock. + */ +final class Author extends BaseTag implements Factory\StaticMethod +{ + /** @var string register that this is the author tag. */ + protected $name = 'author'; + + /** @var string The name of the author */ + private $authorName = ''; + + /** @var string The email of the author */ + private $authorEmail = ''; + + /** + * Initializes this tag with the author name and e-mail. + * + * @param string $authorName + * @param string $authorEmail + */ + public function __construct($authorName, $authorEmail) + { + Assert::string($authorName); + Assert::string($authorEmail); + if ($authorEmail && !filter_var($authorEmail, FILTER_VALIDATE_EMAIL)) { + throw new \InvalidArgumentException('The author tag does not have a valid e-mail address'); + } + + $this->authorName = $authorName; + $this->authorEmail = $authorEmail; + } + + /** + * Gets the author's name. + * + * @return string The author's name. + */ + public function getAuthorName() + { + return $this->authorName; + } + + /** + * Returns the author's email. + * + * @return string The author's email. + */ + public function getEmail() + { + return $this->authorEmail; + } + + /** + * Returns this tag in string form. + * + * @return string + */ + public function __toString() + { + return $this->authorName . (strlen($this->authorEmail) ? ' <' . $this->authorEmail . '>' : ''); + } + + /** + * Attempts to create a new Author object based on †he tag body. + * + * @param string $body + * + * @return static + */ + public static function create($body) + { + Assert::string($body); + + $splitTagContent = preg_match('/^([^\<]*)(?:\<([^\>]*)\>)?$/u', $body, $matches); + if (!$splitTagContent) { + return null; + } + + $authorName = trim($matches[1]); + $email = isset($matches[2]) ? trim($matches[2]) : ''; + + return new static($authorName, $email); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/BaseTag.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/BaseTag.php new file mode 100644 index 0000000..14bb717 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/BaseTag.php @@ -0,0 +1,52 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlock\Description; + +/** + * Parses a tag definition for a DocBlock. + */ +abstract class BaseTag implements DocBlock\Tag +{ + /** @var string Name of the tag */ + protected $name = ''; + + /** @var Description|null Description of the tag. */ + protected $description; + + /** + * Gets the name of this tag. + * + * @return string The name of this tag. + */ + public function getName() + { + return $this->name; + } + + public function getDescription() + { + return $this->description; + } + + public function render(Formatter $formatter = null) + { + if ($formatter === null) { + $formatter = new Formatter\PassthroughFormatter(); + } + + return $formatter->format($this); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Covers.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Covers.php new file mode 100644 index 0000000..8d65403 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Covers.php @@ -0,0 +1,83 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\FqsenResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a @covers tag in a Docblock. + */ +final class Covers extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'covers'; + + /** @var Fqsen */ + private $refers = null; + + /** + * Initializes this tag. + * + * @param Fqsen $refers + * @param Description $description + */ + public function __construct(Fqsen $refers, Description $description = null) + { + $this->refers = $refers; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + DescriptionFactory $descriptionFactory = null, + FqsenResolver $resolver = null, + TypeContext $context = null + ) { + Assert::string($body); + Assert::notEmpty($body); + + $parts = preg_split('/\s+/Su', $body, 2); + + return new static( + $resolver->resolve($parts[0], $context), + $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context) + ); + } + + /** + * Returns the structural element this tag refers to. + * + * @return Fqsen + */ + public function getReference() + { + return $this->refers; + } + + /** + * Returns a string representation of this tag. + * + * @return string + */ + public function __toString() + { + return $this->refers . ($this->description ? ' ' . $this->description->render() : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Deprecated.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Deprecated.php new file mode 100644 index 0000000..822c305 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Deprecated.php @@ -0,0 +1,97 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}deprecated tag in a Docblock. + */ +final class Deprecated extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'deprecated'; + + /** + * PCRE regular expression matching a version vector. + * Assumes the "x" modifier. + */ + const REGEX_VECTOR = '(?: + # Normal release vectors. + \d\S* + | + # VCS version vectors. Per PHPCS, they are expected to + # follow the form of the VCS name, followed by ":", followed + # by the version vector itself. + # By convention, popular VCSes like CVS, SVN and GIT use "$" + # around the actual version vector. + [^\s\:]+\:\s*\$[^\$]+\$ + )'; + + /** @var string The version vector. */ + private $version = ''; + + public function __construct($version = null, Description $description = null) + { + Assert::nullOrStringNotEmpty($version); + + $this->version = $version; + $this->description = $description; + } + + /** + * @return static + */ + public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null) + { + Assert::nullOrString($body); + if (empty($body)) { + return new static(); + } + + $matches = []; + if (!preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { + return new static( + null, + null !== $descriptionFactory ? $descriptionFactory->create($body, $context) : null + ); + } + + return new static( + $matches[1], + $descriptionFactory->create(isset($matches[2]) ? $matches[2] : '', $context) + ); + } + + /** + * Gets the version section of the tag. + * + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return $this->version . ($this->description ? ' ' . $this->description->render() : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Example.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Example.php new file mode 100644 index 0000000..ecb199b --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Example.php @@ -0,0 +1,176 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\Tag; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}example tag in a Docblock. + */ +final class Example extends BaseTag +{ + /** + * @var string Path to a file to use as an example. May also be an absolute URI. + */ + private $filePath; + + /** + * @var bool Whether the file path component represents an URI. This determines how the file portion + * appears at {@link getContent()}. + */ + private $isURI = false; + + /** + * @var int + */ + private $startingLine; + + /** + * @var int + */ + private $lineCount; + + public function __construct($filePath, $isURI, $startingLine, $lineCount, $description) + { + Assert::notEmpty($filePath); + Assert::integer($startingLine); + Assert::greaterThanEq($startingLine, 0); + + $this->filePath = $filePath; + $this->startingLine = $startingLine; + $this->lineCount = $lineCount; + $this->name = 'example'; + if ($description !== null) { + $this->description = trim($description); + } + + $this->isURI = $isURI; + } + + /** + * {@inheritdoc} + */ + public function getContent() + { + if (null === $this->description) { + $filePath = '"' . $this->filePath . '"'; + if ($this->isURI) { + $filePath = $this->isUriRelative($this->filePath) + ? str_replace('%2F', '/', rawurlencode($this->filePath)) + :$this->filePath; + } + + return trim($filePath . ' ' . parent::getDescription()); + } + + return $this->description; + } + + /** + * {@inheritdoc} + */ + public static function create($body) + { + // File component: File path in quotes or File URI / Source information + if (! preg_match('/^(?:\"([^\"]+)\"|(\S+))(?:\s+(.*))?$/sux', $body, $matches)) { + return null; + } + + $filePath = null; + $fileUri = null; + if ('' !== $matches[1]) { + $filePath = $matches[1]; + } else { + $fileUri = $matches[2]; + } + + $startingLine = 1; + $lineCount = null; + $description = null; + + if (array_key_exists(3, $matches)) { + $description = $matches[3]; + + // Starting line / Number of lines / Description + if (preg_match('/^([1-9]\d*)(?:\s+((?1))\s*)?(.*)$/sux', $matches[3], $contentMatches)) { + $startingLine = (int)$contentMatches[1]; + if (isset($contentMatches[2]) && $contentMatches[2] !== '') { + $lineCount = (int)$contentMatches[2]; + } + + if (array_key_exists(3, $contentMatches)) { + $description = $contentMatches[3]; + } + } + } + + return new static( + $filePath !== null?$filePath:$fileUri, + $fileUri !== null, + $startingLine, + $lineCount, + $description + ); + } + + /** + * Returns the file path. + * + * @return string Path to a file to use as an example. + * May also be an absolute URI. + */ + public function getFilePath() + { + return $this->filePath; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return $this->filePath . ($this->description ? ' ' . $this->description : ''); + } + + /** + * Returns true if the provided URI is relative or contains a complete scheme (and thus is absolute). + * + * @param string $uri + * + * @return bool + */ + private function isUriRelative($uri) + { + return false === strpos($uri, ':'); + } + + /** + * @return int + */ + public function getStartingLine() + { + return $this->startingLine; + } + + /** + * @return int + */ + public function getLineCount() + { + return $this->lineCount; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/StaticMethod.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/StaticMethod.php new file mode 100644 index 0000000..98aea45 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/StaticMethod.php @@ -0,0 +1,18 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; + +interface StaticMethod +{ + public static function create($body); +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/Strategy.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/Strategy.php new file mode 100644 index 0000000..b9ca0b8 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Factory/Strategy.php @@ -0,0 +1,18 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; + +interface Strategy +{ + public function create($body); +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter.php new file mode 100644 index 0000000..64b2c60 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter.php @@ -0,0 +1,27 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Tag; + +interface Formatter +{ + /** + * Formats a tag into a string representation according to a specific format, such as Markdown. + * + * @param Tag $tag + * + * @return string + */ + public function format(Tag $tag); +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/AlignFormatter.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/AlignFormatter.php new file mode 100644 index 0000000..ceb40cc --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/AlignFormatter.php @@ -0,0 +1,47 @@ + + * @copyright 2017 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags\Formatter; + +use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock\Tags\Formatter; + +class AlignFormatter implements Formatter +{ + /** @var int The maximum tag name length. */ + protected $maxLen = 0; + + /** + * Constructor. + * + * @param Tag[] $tags All tags that should later be aligned with the formatter. + */ + public function __construct(array $tags) + { + foreach ($tags as $tag) { + $this->maxLen = max($this->maxLen, strlen($tag->getName())); + } + } + + /** + * Formats the given tag to return a simple plain text version. + * + * @param Tag $tag + * + * @return string + */ + public function format(Tag $tag) + { + return '@' . $tag->getName() . str_repeat(' ', $this->maxLen - strlen($tag->getName()) + 1) . (string)$tag; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/PassthroughFormatter.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/PassthroughFormatter.php new file mode 100644 index 0000000..4e2c576 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Formatter/PassthroughFormatter.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags\Formatter; + +use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock\Tags\Formatter; + +class PassthroughFormatter implements Formatter +{ + /** + * Formats the given tag to return a simple plain text version. + * + * @param Tag $tag + * + * @return string + */ + public function format(Tag $tag) + { + return trim('@' . $tag->getName() . ' ' . (string)$tag); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Generic.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Generic.php new file mode 100644 index 0000000..e4c53e0 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Generic.php @@ -0,0 +1,91 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\DocBlock\StandardTagFactory; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Parses a tag definition for a DocBlock. + */ +class Generic extends BaseTag implements Factory\StaticMethod +{ + /** + * Parses a tag and populates the member variables. + * + * @param string $name Name of the tag. + * @param Description $description The contents of the given tag. + */ + public function __construct($name, Description $description = null) + { + $this->validateTagName($name); + + $this->name = $name; + $this->description = $description; + } + + /** + * Creates a new tag that represents any unknown tag type. + * + * @param string $body + * @param string $name + * @param DescriptionFactory $descriptionFactory + * @param TypeContext $context + * + * @return static + */ + public static function create( + $body, + $name = '', + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::string($body); + Assert::stringNotEmpty($name); + Assert::notNull($descriptionFactory); + + $description = $descriptionFactory && $body ? $descriptionFactory->create($body, $context) : null; + + return new static($name, $description); + } + + /** + * Returns the tag as a serialized string + * + * @return string + */ + public function __toString() + { + return ($this->description ? $this->description->render() : ''); + } + + /** + * Validates if the tag name matches the expected format, otherwise throws an exception. + * + * @param string $name + * + * @return void + */ + private function validateTagName($name) + { + if (! preg_match('/^' . StandardTagFactory::REGEX_TAGNAME . '$/u', $name)) { + throw new \InvalidArgumentException( + 'The tag name "' . $name . '" is not wellformed. Tags may only consist of letters, underscores, ' + . 'hyphens and backslashes.' + ); + } + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Link.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Link.php new file mode 100644 index 0000000..9c0e367 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Link.php @@ -0,0 +1,77 @@ + + * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a @link tag in a Docblock. + */ +final class Link extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'link'; + + /** @var string */ + private $link = ''; + + /** + * Initializes a link to a URL. + * + * @param string $link + * @param Description $description + */ + public function __construct($link, Description $description = null) + { + Assert::string($link); + + $this->link = $link; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null) + { + Assert::string($body); + Assert::notNull($descriptionFactory); + + $parts = preg_split('/\s+/Su', $body, 2); + $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null; + + return new static($parts[0], $description); + } + + /** + * Gets the link + * + * @return string + */ + public function getLink() + { + return $this->link; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return $this->link . ($this->description ? ' ' . $this->description->render() : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Method.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Method.php new file mode 100644 index 0000000..7522529 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Method.php @@ -0,0 +1,242 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use phpDocumentor\Reflection\Types\Void_; +use Webmozart\Assert\Assert; + +/** + * Reflection class for an {@}method in a Docblock. + */ +final class Method extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'method'; + + /** @var string */ + private $methodName = ''; + + /** @var string[] */ + private $arguments = []; + + /** @var bool */ + private $isStatic = false; + + /** @var Type */ + private $returnType; + + public function __construct( + $methodName, + array $arguments = [], + Type $returnType = null, + $static = false, + Description $description = null + ) { + Assert::stringNotEmpty($methodName); + Assert::boolean($static); + + if ($returnType === null) { + $returnType = new Void_(); + } + + $this->methodName = $methodName; + $this->arguments = $this->filterArguments($arguments); + $this->returnType = $returnType; + $this->isStatic = $static; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::stringNotEmpty($body); + Assert::allNotNull([ $typeResolver, $descriptionFactory ]); + + // 1. none or more whitespace + // 2. optionally the keyword "static" followed by whitespace + // 3. optionally a word with underscores followed by whitespace : as + // type for the return value + // 4. then optionally a word with underscores followed by () and + // whitespace : as method name as used by phpDocumentor + // 5. then a word with underscores, followed by ( and any character + // until a ) and whitespace : as method name with signature + // 6. any remaining text : as description + if (!preg_match( + '/^ + # Static keyword + # Declares a static method ONLY if type is also present + (?: + (static) + \s+ + )? + # Return type + (?: + ( + (?:[\w\|_\\\\]*\$this[\w\|_\\\\]*) + | + (?: + (?:[\w\|_\\\\]+) + # array notation + (?:\[\])* + )* + ) + \s+ + )? + # Legacy method name (not captured) + (?: + [\w_]+\(\)\s+ + )? + # Method name + ([\w\|_\\\\]+) + # Arguments + (?: + \(([^\)]*)\) + )? + \s* + # Description + (.*) + $/sux', + $body, + $matches + )) { + return null; + } + + list(, $static, $returnType, $methodName, $arguments, $description) = $matches; + + $static = $static === 'static'; + + if ($returnType === '') { + $returnType = 'void'; + } + + $returnType = $typeResolver->resolve($returnType, $context); + $description = $descriptionFactory->create($description, $context); + + if (is_string($arguments) && strlen($arguments) > 0) { + $arguments = explode(',', $arguments); + foreach ($arguments as &$argument) { + $argument = explode(' ', self::stripRestArg(trim($argument)), 2); + if ($argument[0][0] === '$') { + $argumentName = substr($argument[0], 1); + $argumentType = new Void_(); + } else { + $argumentType = $typeResolver->resolve($argument[0], $context); + $argumentName = ''; + if (isset($argument[1])) { + $argument[1] = self::stripRestArg($argument[1]); + $argumentName = substr($argument[1], 1); + } + } + + $argument = [ 'name' => $argumentName, 'type' => $argumentType]; + } + } else { + $arguments = []; + } + + return new static($methodName, $arguments, $returnType, $static, $description); + } + + /** + * Retrieves the method name. + * + * @return string + */ + public function getMethodName() + { + return $this->methodName; + } + + /** + * @return string[] + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * Checks whether the method tag describes a static method or not. + * + * @return bool TRUE if the method declaration is for a static method, FALSE otherwise. + */ + public function isStatic() + { + return $this->isStatic; + } + + /** + * @return Type + */ + public function getReturnType() + { + return $this->returnType; + } + + public function __toString() + { + $arguments = []; + foreach ($this->arguments as $argument) { + $arguments[] = $argument['type'] . ' $' . $argument['name']; + } + + return trim(($this->isStatic() ? 'static ' : '') + . (string)$this->returnType . ' ' + . $this->methodName + . '(' . implode(', ', $arguments) . ')' + . ($this->description ? ' ' . $this->description->render() : '')); + } + + private function filterArguments($arguments) + { + foreach ($arguments as &$argument) { + if (is_string($argument)) { + $argument = [ 'name' => $argument ]; + } + + if (! isset($argument['type'])) { + $argument['type'] = new Void_(); + } + + $keys = array_keys($argument); + sort($keys); + if ($keys !== [ 'name', 'type' ]) { + throw new \InvalidArgumentException( + 'Arguments can only have the "name" and "type" fields, found: ' . var_export($keys, true) + ); + } + } + + return $arguments; + } + + private static function stripRestArg($argument) + { + if (strpos($argument, '...') === 0) { + $argument = trim(substr($argument, 3)); + } + + return $argument; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Param.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Param.php new file mode 100644 index 0000000..7d699d8 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Param.php @@ -0,0 +1,141 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for the {@}param tag in a Docblock. + */ +final class Param extends BaseTag implements Factory\StaticMethod +{ + /** @var string */ + protected $name = 'param'; + + /** @var Type */ + private $type; + + /** @var string */ + private $variableName = ''; + + /** @var bool determines whether this is a variadic argument */ + private $isVariadic = false; + + /** + * @param string $variableName + * @param Type $type + * @param bool $isVariadic + * @param Description $description + */ + public function __construct($variableName, Type $type = null, $isVariadic = false, Description $description = null) + { + Assert::string($variableName); + Assert::boolean($isVariadic); + + $this->variableName = $variableName; + $this->type = $type; + $this->isVariadic = $isVariadic; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::stringNotEmpty($body); + Assert::allNotNull([$typeResolver, $descriptionFactory]); + + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; + $variableName = ''; + $isVariadic = false; + + // if the first item that is encountered is not a variable; it is a type + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { + $type = $typeResolver->resolve(array_shift($parts), $context); + array_shift($parts); + } + + // if the next item starts with a $ or ...$ it must be the variable name + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$' || substr($parts[0], 0, 4) === '...$')) { + $variableName = array_shift($parts); + array_shift($parts); + + if (substr($variableName, 0, 3) === '...') { + $isVariadic = true; + $variableName = substr($variableName, 3); + } + + if (substr($variableName, 0, 1) === '$') { + $variableName = substr($variableName, 1); + } + } + + $description = $descriptionFactory->create(implode('', $parts), $context); + + return new static($variableName, $type, $isVariadic, $description); + } + + /** + * Returns the variable's name. + * + * @return string + */ + public function getVariableName() + { + return $this->variableName; + } + + /** + * Returns the variable's type or null if unknown. + * + * @return Type|null + */ + public function getType() + { + return $this->type; + } + + /** + * Returns whether this tag is variadic. + * + * @return boolean + */ + public function isVariadic() + { + return $this->isVariadic; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return ($this->type ? $this->type . ' ' : '') + . ($this->isVariadic() ? '...' : '') + . '$' . $this->variableName + . ($this->description ? ' ' . $this->description : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Property.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Property.php new file mode 100644 index 0000000..f0ef7c0 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Property.php @@ -0,0 +1,118 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}property tag in a Docblock. + */ +class Property extends BaseTag implements Factory\StaticMethod +{ + /** @var string */ + protected $name = 'property'; + + /** @var Type */ + private $type; + + /** @var string */ + protected $variableName = ''; + + /** + * @param string $variableName + * @param Type $type + * @param Description $description + */ + public function __construct($variableName, Type $type = null, Description $description = null) + { + Assert::string($variableName); + + $this->variableName = $variableName; + $this->type = $type; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::stringNotEmpty($body); + Assert::allNotNull([$typeResolver, $descriptionFactory]); + + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; + $variableName = ''; + + // if the first item that is encountered is not a variable; it is a type + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { + $type = $typeResolver->resolve(array_shift($parts), $context); + array_shift($parts); + } + + // if the next item starts with a $ or ...$ it must be the variable name + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$')) { + $variableName = array_shift($parts); + array_shift($parts); + + if (substr($variableName, 0, 1) === '$') { + $variableName = substr($variableName, 1); + } + } + + $description = $descriptionFactory->create(implode('', $parts), $context); + + return new static($variableName, $type, $description); + } + + /** + * Returns the variable's name. + * + * @return string + */ + public function getVariableName() + { + return $this->variableName; + } + + /** + * Returns the variable's type or null if unknown. + * + * @return Type|null + */ + public function getType() + { + return $this->type; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return ($this->type ? $this->type . ' ' : '') + . '$' . $this->variableName + . ($this->description ? ' ' . $this->description : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyRead.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyRead.php new file mode 100644 index 0000000..e41c0c1 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyRead.php @@ -0,0 +1,118 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}property-read tag in a Docblock. + */ +class PropertyRead extends BaseTag implements Factory\StaticMethod +{ + /** @var string */ + protected $name = 'property-read'; + + /** @var Type */ + private $type; + + /** @var string */ + protected $variableName = ''; + + /** + * @param string $variableName + * @param Type $type + * @param Description $description + */ + public function __construct($variableName, Type $type = null, Description $description = null) + { + Assert::string($variableName); + + $this->variableName = $variableName; + $this->type = $type; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::stringNotEmpty($body); + Assert::allNotNull([$typeResolver, $descriptionFactory]); + + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; + $variableName = ''; + + // if the first item that is encountered is not a variable; it is a type + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { + $type = $typeResolver->resolve(array_shift($parts), $context); + array_shift($parts); + } + + // if the next item starts with a $ or ...$ it must be the variable name + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$')) { + $variableName = array_shift($parts); + array_shift($parts); + + if (substr($variableName, 0, 1) === '$') { + $variableName = substr($variableName, 1); + } + } + + $description = $descriptionFactory->create(implode('', $parts), $context); + + return new static($variableName, $type, $description); + } + + /** + * Returns the variable's name. + * + * @return string + */ + public function getVariableName() + { + return $this->variableName; + } + + /** + * Returns the variable's type or null if unknown. + * + * @return Type|null + */ + public function getType() + { + return $this->type; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return ($this->type ? $this->type . ' ' : '') + . '$' . $this->variableName + . ($this->description ? ' ' . $this->description : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyWrite.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyWrite.php new file mode 100644 index 0000000..cfdb0ed --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyWrite.php @@ -0,0 +1,118 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}property-write tag in a Docblock. + */ +class PropertyWrite extends BaseTag implements Factory\StaticMethod +{ + /** @var string */ + protected $name = 'property-write'; + + /** @var Type */ + private $type; + + /** @var string */ + protected $variableName = ''; + + /** + * @param string $variableName + * @param Type $type + * @param Description $description + */ + public function __construct($variableName, Type $type = null, Description $description = null) + { + Assert::string($variableName); + + $this->variableName = $variableName; + $this->type = $type; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::stringNotEmpty($body); + Assert::allNotNull([$typeResolver, $descriptionFactory]); + + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; + $variableName = ''; + + // if the first item that is encountered is not a variable; it is a type + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { + $type = $typeResolver->resolve(array_shift($parts), $context); + array_shift($parts); + } + + // if the next item starts with a $ or ...$ it must be the variable name + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$')) { + $variableName = array_shift($parts); + array_shift($parts); + + if (substr($variableName, 0, 1) === '$') { + $variableName = substr($variableName, 1); + } + } + + $description = $descriptionFactory->create(implode('', $parts), $context); + + return new static($variableName, $type, $description); + } + + /** + * Returns the variable's name. + * + * @return string + */ + public function getVariableName() + { + return $this->variableName; + } + + /** + * Returns the variable's type or null if unknown. + * + * @return Type|null + */ + public function getType() + { + return $this->type; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return ($this->type ? $this->type . ' ' : '') + . '$' . $this->variableName + . ($this->description ? ' ' . $this->description : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Fqsen.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Fqsen.php new file mode 100644 index 0000000..dc7b8b6 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Fqsen.php @@ -0,0 +1,42 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags\Reference; + +use phpDocumentor\Reflection\Fqsen as RealFqsen; + +/** + * Fqsen reference used by {@see phpDocumentor\Reflection\DocBlock\Tags\See} + */ +final class Fqsen implements Reference +{ + /** + * @var RealFqsen + */ + private $fqsen; + + /** + * Fqsen constructor. + */ + public function __construct(RealFqsen $fqsen) + { + $this->fqsen = $fqsen; + } + + /** + * @return string string representation of the referenced fqsen + */ + public function __toString() + { + return (string)$this->fqsen; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Reference.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Reference.php new file mode 100644 index 0000000..a3ffd24 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Reference.php @@ -0,0 +1,21 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags\Reference; + +/** + * Interface for references in {@see phpDocumentor\Reflection\DocBlock\Tags\See} + */ +interface Reference +{ + public function __toString(); +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Url.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Url.php new file mode 100644 index 0000000..2671d5e --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Url.php @@ -0,0 +1,40 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags\Reference; + +use Webmozart\Assert\Assert; + +/** + * Url reference used by {@see phpDocumentor\Reflection\DocBlock\Tags\See} + */ +final class Url implements Reference +{ + /** + * @var string + */ + private $uri; + + /** + * Url constructor. + */ + public function __construct($uri) + { + Assert::stringNotEmpty($uri); + $this->uri = $uri; + } + + public function __toString() + { + return $this->uri; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Return_.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Return_.php new file mode 100644 index 0000000..ca5bda7 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Return_.php @@ -0,0 +1,72 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}return tag in a Docblock. + */ +final class Return_ extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'return'; + + /** @var Type */ + private $type; + + public function __construct(Type $type, Description $description = null) + { + $this->type = $type; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::string($body); + Assert::allNotNull([$typeResolver, $descriptionFactory]); + + $parts = preg_split('/\s+/Su', $body, 2); + + $type = $typeResolver->resolve(isset($parts[0]) ? $parts[0] : '', $context); + $description = $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context); + + return new static($type, $description); + } + + /** + * Returns the type section of the variable. + * + * @return Type + */ + public function getType() + { + return $this->type; + } + + public function __toString() + { + return $this->type . ' ' . $this->description; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/See.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/See.php new file mode 100644 index 0000000..9e9e723 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/See.php @@ -0,0 +1,88 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen as FqsenRef; +use phpDocumentor\Reflection\DocBlock\Tags\Reference\Reference; +use phpDocumentor\Reflection\DocBlock\Tags\Reference\Url; +use phpDocumentor\Reflection\FqsenResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for an {@}see tag in a Docblock. + */ +class See extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'see'; + + /** @var Reference */ + protected $refers = null; + + /** + * Initializes this tag. + * + * @param Reference $refers + * @param Description $description + */ + public function __construct(Reference $refers, Description $description = null) + { + $this->refers = $refers; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + FqsenResolver $resolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::string($body); + Assert::allNotNull([$resolver, $descriptionFactory]); + + $parts = preg_split('/\s+/Su', $body, 2); + $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null; + + // https://tools.ietf.org/html/rfc2396#section-3 + if (preg_match('/\w:\/\/\w/i', $parts[0])) { + return new static(new Url($parts[0]), $description); + } + + return new static(new FqsenRef($resolver->resolve($parts[0], $context)), $description); + } + + /** + * Returns the ref of this tag. + * + * @return Reference + */ + public function getReference() + { + return $this->refers; + } + + /** + * Returns a string representation of this tag. + * + * @return string + */ + public function __toString() + { + return $this->refers . ($this->description ? ' ' . $this->description->render() : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Since.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Since.php new file mode 100644 index 0000000..835fb0d --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Since.php @@ -0,0 +1,94 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}since tag in a Docblock. + */ +final class Since extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'since'; + + /** + * PCRE regular expression matching a version vector. + * Assumes the "x" modifier. + */ + const REGEX_VECTOR = '(?: + # Normal release vectors. + \d\S* + | + # VCS version vectors. Per PHPCS, they are expected to + # follow the form of the VCS name, followed by ":", followed + # by the version vector itself. + # By convention, popular VCSes like CVS, SVN and GIT use "$" + # around the actual version vector. + [^\s\:]+\:\s*\$[^\$]+\$ + )'; + + /** @var string The version vector. */ + private $version = ''; + + public function __construct($version = null, Description $description = null) + { + Assert::nullOrStringNotEmpty($version); + + $this->version = $version; + $this->description = $description; + } + + /** + * @return static + */ + public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null) + { + Assert::nullOrString($body); + if (empty($body)) { + return new static(); + } + + $matches = []; + if (! preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { + return null; + } + + return new static( + $matches[1], + $descriptionFactory->create(isset($matches[2]) ? $matches[2] : '', $context) + ); + } + + /** + * Gets the version section of the tag. + * + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return $this->version . ($this->description ? ' ' . $this->description->render() : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Source.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Source.php new file mode 100644 index 0000000..247b1b3 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Source.php @@ -0,0 +1,97 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}source tag in a Docblock. + */ +final class Source extends BaseTag implements Factory\StaticMethod +{ + /** @var string */ + protected $name = 'source'; + + /** @var int The starting line, relative to the structural element's location. */ + private $startingLine = 1; + + /** @var int|null The number of lines, relative to the starting line. NULL means "to the end". */ + private $lineCount = null; + + public function __construct($startingLine, $lineCount = null, Description $description = null) + { + Assert::integerish($startingLine); + Assert::nullOrIntegerish($lineCount); + + $this->startingLine = (int)$startingLine; + $this->lineCount = $lineCount !== null ? (int)$lineCount : null; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null) + { + Assert::stringNotEmpty($body); + Assert::notNull($descriptionFactory); + + $startingLine = 1; + $lineCount = null; + $description = null; + + // Starting line / Number of lines / Description + if (preg_match('/^([1-9]\d*)\s*(?:((?1))\s+)?(.*)$/sux', $body, $matches)) { + $startingLine = (int)$matches[1]; + if (isset($matches[2]) && $matches[2] !== '') { + $lineCount = (int)$matches[2]; + } + + $description = $matches[3]; + } + + return new static($startingLine, $lineCount, $descriptionFactory->create($description, $context)); + } + + /** + * Gets the starting line. + * + * @return int The starting line, relative to the structural element's + * location. + */ + public function getStartingLine() + { + return $this->startingLine; + } + + /** + * Returns the number of lines. + * + * @return int|null The number of lines, relative to the starting line. NULL + * means "to the end". + */ + public function getLineCount() + { + return $this->lineCount; + } + + public function __toString() + { + return $this->startingLine + . ($this->lineCount !== null ? ' ' . $this->lineCount : '') + . ($this->description ? ' ' . $this->description->render() : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Throws.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Throws.php new file mode 100644 index 0000000..349e773 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Throws.php @@ -0,0 +1,72 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}throws tag in a Docblock. + */ +final class Throws extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'throws'; + + /** @var Type */ + private $type; + + public function __construct(Type $type, Description $description = null) + { + $this->type = $type; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::string($body); + Assert::allNotNull([$typeResolver, $descriptionFactory]); + + $parts = preg_split('/\s+/Su', $body, 2); + + $type = $typeResolver->resolve(isset($parts[0]) ? $parts[0] : '', $context); + $description = $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context); + + return new static($type, $description); + } + + /** + * Returns the type section of the variable. + * + * @return Type + */ + public function getType() + { + return $this->type; + } + + public function __toString() + { + return $this->type . ' ' . $this->description; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Uses.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Uses.php new file mode 100644 index 0000000..00dc3e3 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Uses.php @@ -0,0 +1,83 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\FqsenResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}uses tag in a Docblock. + */ +final class Uses extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'uses'; + + /** @var Fqsen */ + protected $refers = null; + + /** + * Initializes this tag. + * + * @param Fqsen $refers + * @param Description $description + */ + public function __construct(Fqsen $refers, Description $description = null) + { + $this->refers = $refers; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + FqsenResolver $resolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::string($body); + Assert::allNotNull([$resolver, $descriptionFactory]); + + $parts = preg_split('/\s+/Su', $body, 2); + + return new static( + $resolver->resolve($parts[0], $context), + $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context) + ); + } + + /** + * Returns the structural element this tag refers to. + * + * @return Fqsen + */ + public function getReference() + { + return $this->refers; + } + + /** + * Returns a string representation of this tag. + * + * @return string + */ + public function __toString() + { + return $this->refers . ' ' . $this->description->render(); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Var_.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Var_.php new file mode 100644 index 0000000..8907c95 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Var_.php @@ -0,0 +1,118 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}var tag in a Docblock. + */ +class Var_ extends BaseTag implements Factory\StaticMethod +{ + /** @var string */ + protected $name = 'var'; + + /** @var Type */ + private $type; + + /** @var string */ + protected $variableName = ''; + + /** + * @param string $variableName + * @param Type $type + * @param Description $description + */ + public function __construct($variableName, Type $type = null, Description $description = null) + { + Assert::string($variableName); + + $this->variableName = $variableName; + $this->type = $type; + $this->description = $description; + } + + /** + * {@inheritdoc} + */ + public static function create( + $body, + TypeResolver $typeResolver = null, + DescriptionFactory $descriptionFactory = null, + TypeContext $context = null + ) { + Assert::stringNotEmpty($body); + Assert::allNotNull([$typeResolver, $descriptionFactory]); + + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; + $variableName = ''; + + // if the first item that is encountered is not a variable; it is a type + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { + $type = $typeResolver->resolve(array_shift($parts), $context); + array_shift($parts); + } + + // if the next item starts with a $ or ...$ it must be the variable name + if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$')) { + $variableName = array_shift($parts); + array_shift($parts); + + if (substr($variableName, 0, 1) === '$') { + $variableName = substr($variableName, 1); + } + } + + $description = $descriptionFactory->create(implode('', $parts), $context); + + return new static($variableName, $type, $description); + } + + /** + * Returns the variable's name. + * + * @return string + */ + public function getVariableName() + { + return $this->variableName; + } + + /** + * Returns the variable's type or null if unknown. + * + * @return Type|null + */ + public function getType() + { + return $this->type; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return ($this->type ? $this->type . ' ' : '') + . (empty($this->variableName) ? null : ('$' . $this->variableName)) + . ($this->description ? ' ' . $this->description : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Version.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Version.php new file mode 100644 index 0000000..7bb0420 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Version.php @@ -0,0 +1,94 @@ + + * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; + +/** + * Reflection class for a {@}version tag in a Docblock. + */ +final class Version extends BaseTag implements Factory\StaticMethod +{ + protected $name = 'version'; + + /** + * PCRE regular expression matching a version vector. + * Assumes the "x" modifier. + */ + const REGEX_VECTOR = '(?: + # Normal release vectors. + \d\S* + | + # VCS version vectors. Per PHPCS, they are expected to + # follow the form of the VCS name, followed by ":", followed + # by the version vector itself. + # By convention, popular VCSes like CVS, SVN and GIT use "$" + # around the actual version vector. + [^\s\:]+\:\s*\$[^\$]+\$ + )'; + + /** @var string The version vector. */ + private $version = ''; + + public function __construct($version = null, Description $description = null) + { + Assert::nullOrStringNotEmpty($version); + + $this->version = $version; + $this->description = $description; + } + + /** + * @return static + */ + public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null) + { + Assert::nullOrString($body); + if (empty($body)) { + return new static(); + } + + $matches = []; + if (!preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { + return null; + } + + return new static( + $matches[1], + $descriptionFactory->create(isset($matches[2]) ? $matches[2] : '', $context) + ); + } + + /** + * Gets the version section of the tag. + * + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Returns a string representation for this tag. + * + * @return string + */ + public function __toString() + { + return $this->version . ($this->description ? ' ' . $this->description->render() : ''); + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactory.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactory.php new file mode 100644 index 0000000..1bdb8f4 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactory.php @@ -0,0 +1,277 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\DocBlock\StandardTagFactory; +use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock\TagFactory; +use Webmozart\Assert\Assert; + +final class DocBlockFactory implements DocBlockFactoryInterface +{ + /** @var DocBlock\DescriptionFactory */ + private $descriptionFactory; + + /** @var DocBlock\TagFactory */ + private $tagFactory; + + /** + * Initializes this factory with the required subcontractors. + * + * @param DescriptionFactory $descriptionFactory + * @param TagFactory $tagFactory + */ + public function __construct(DescriptionFactory $descriptionFactory, TagFactory $tagFactory) + { + $this->descriptionFactory = $descriptionFactory; + $this->tagFactory = $tagFactory; + } + + /** + * Factory method for easy instantiation. + * + * @param string[] $additionalTags + * + * @return DocBlockFactory + */ + public static function createInstance(array $additionalTags = []) + { + $fqsenResolver = new FqsenResolver(); + $tagFactory = new StandardTagFactory($fqsenResolver); + $descriptionFactory = new DescriptionFactory($tagFactory); + + $tagFactory->addService($descriptionFactory); + $tagFactory->addService(new TypeResolver($fqsenResolver)); + + $docBlockFactory = new self($descriptionFactory, $tagFactory); + foreach ($additionalTags as $tagName => $tagHandler) { + $docBlockFactory->registerTagHandler($tagName, $tagHandler); + } + + return $docBlockFactory; + } + + /** + * @param object|string $docblock A string containing the DocBlock to parse or an object supporting the + * getDocComment method (such as a ReflectionClass object). + * @param Types\Context $context + * @param Location $location + * + * @return DocBlock + */ + public function create($docblock, Types\Context $context = null, Location $location = null) + { + if (is_object($docblock)) { + if (!method_exists($docblock, 'getDocComment')) { + $exceptionMessage = 'Invalid object passed; the given object must support the getDocComment method'; + throw new \InvalidArgumentException($exceptionMessage); + } + + $docblock = $docblock->getDocComment(); + } + + Assert::stringNotEmpty($docblock); + + if ($context === null) { + $context = new Types\Context(''); + } + + $parts = $this->splitDocBlock($this->stripDocComment($docblock)); + list($templateMarker, $summary, $description, $tags) = $parts; + + return new DocBlock( + $summary, + $description ? $this->descriptionFactory->create($description, $context) : null, + array_filter($this->parseTagBlock($tags, $context), function ($tag) { + return $tag instanceof Tag; + }), + $context, + $location, + $templateMarker === '#@+', + $templateMarker === '#@-' + ); + } + + public function registerTagHandler($tagName, $handler) + { + $this->tagFactory->registerTagHandler($tagName, $handler); + } + + /** + * Strips the asterisks from the DocBlock comment. + * + * @param string $comment String containing the comment text. + * + * @return string + */ + private function stripDocComment($comment) + { + $comment = trim(preg_replace('#[ \t]*(?:\/\*\*|\*\/|\*)?[ \t]{0,1}(.*)?#u', '$1', $comment)); + + // reg ex above is not able to remove */ from a single line docblock + if (substr($comment, -2) === '*/') { + $comment = trim(substr($comment, 0, -2)); + } + + return str_replace(["\r\n", "\r"], "\n", $comment); + } + + /** + * Splits the DocBlock into a template marker, summary, description and block of tags. + * + * @param string $comment Comment to split into the sub-parts. + * + * @author Richard van Velzen (@_richardJ) Special thanks to Richard for the regex responsible for the split. + * @author Mike van Riel for extending the regex with template marker support. + * + * @return string[] containing the template marker (if any), summary, description and a string containing the tags. + */ + private function splitDocBlock($comment) + { + // Performance improvement cheat: if the first character is an @ then only tags are in this DocBlock. This + // method does not split tags so we return this verbatim as the fourth result (tags). This saves us the + // performance impact of running a regular expression + if (strpos($comment, '@') === 0) { + return ['', '', '', $comment]; + } + + // clears all extra horizontal whitespace from the line endings to prevent parsing issues + $comment = preg_replace('/\h*$/Sum', '', $comment); + + /* + * Splits the docblock into a template marker, summary, description and tags section. + * + * - The template marker is empty, #@+ or #@- if the DocBlock starts with either of those (a newline may + * occur after it and will be stripped). + * - The short description is started from the first character until a dot is encountered followed by a + * newline OR two consecutive newlines (horizontal whitespace is taken into account to consider spacing + * errors). This is optional. + * - The long description, any character until a new line is encountered followed by an @ and word + * characters (a tag). This is optional. + * - Tags; the remaining characters + * + * Big thanks to RichardJ for contributing this Regular Expression + */ + preg_match( + '/ + \A + # 1. Extract the template marker + (?:(\#\@\+|\#\@\-)\n?)? + + # 2. Extract the summary + (?: + (?! @\pL ) # The summary may not start with an @ + ( + [^\n.]+ + (?: + (?! \. \n | \n{2} ) # End summary upon a dot followed by newline or two newlines + [\n.] (?! [ \t]* @\pL ) # End summary when an @ is found as first character on a new line + [^\n.]+ # Include anything else + )* + \.? + )? + ) + + # 3. Extract the description + (?: + \s* # Some form of whitespace _must_ precede a description because a summary must be there + (?! @\pL ) # The description may not start with an @ + ( + [^\n]+ + (?: \n+ + (?! [ \t]* @\pL ) # End description when an @ is found as first character on a new line + [^\n]+ # Include anything else + )* + ) + )? + + # 4. Extract the tags (anything that follows) + (\s+ [\s\S]*)? # everything that follows + /ux', + $comment, + $matches + ); + array_shift($matches); + + while (count($matches) < 4) { + $matches[] = ''; + } + + return $matches; + } + + /** + * Creates the tag objects. + * + * @param string $tags Tag block to parse. + * @param Types\Context $context Context of the parsed Tag + * + * @return DocBlock\Tag[] + */ + private function parseTagBlock($tags, Types\Context $context) + { + $tags = $this->filterTagBlock($tags); + if (!$tags) { + return []; + } + + $result = $this->splitTagBlockIntoTagLines($tags); + foreach ($result as $key => $tagLine) { + $result[$key] = $this->tagFactory->create(trim($tagLine), $context); + } + + return $result; + } + + /** + * @param string $tags + * + * @return string[] + */ + private function splitTagBlockIntoTagLines($tags) + { + $result = []; + foreach (explode("\n", $tags) as $tag_line) { + if (isset($tag_line[0]) && ($tag_line[0] === '@')) { + $result[] = $tag_line; + } else { + $result[count($result) - 1] .= "\n" . $tag_line; + } + } + + return $result; + } + + /** + * @param $tags + * @return string + */ + private function filterTagBlock($tags) + { + $tags = trim($tags); + if (!$tags) { + return null; + } + + if ('@' !== $tags[0]) { + // @codeCoverageIgnoreStart + // Can't simulate this; this only happens if there is an error with the parsing of the DocBlock that + // we didn't foresee. + throw new \LogicException('A tag block started with text instead of an at-sign(@): ' . $tags); + // @codeCoverageIgnoreEnd + } + + return $tags; + } +} diff --git a/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactoryInterface.php b/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactoryInterface.php new file mode 100644 index 0000000..b353342 --- /dev/null +++ b/vendor/phpdocumentor/reflection-docblock/src/DocBlockFactoryInterface.php @@ -0,0 +1,23 @@ + please note that if you want to pass partial class names that additional steps are necessary, see the + > chapter `Resolving partial classes and FQSENs` for more information. + +Where the FqsenResolver can resolve: + +- Constant expressions (i.e. `@see \MyNamespace\MY_CONSTANT`) +- Function expressions (i.e. `@see \MyNamespace\myFunction()`) +- Class expressions (i.e. `@see \MyNamespace\MyClass`) +- Interface expressions (i.e. `@see \MyNamespace\MyInterface`) +- Trait expressions (i.e. `@see \MyNamespace\MyTrait`) +- Class constant expressions (i.e. `@see \MyNamespace\MyClass::MY_CONSTANT`) +- Property expressions (i.e. `@see \MyNamespace\MyClass::$myProperty`) +- Method expressions (i.e. `@see \MyNamespace\MyClass::myMethod()`) + +## Resolving a type + +In order to resolve a type you will have to instantiate the class `\phpDocumentor\Reflection\TypeResolver` +and call its `resolve` method like this: + +```php +$typeResolver = new \phpDocumentor\Reflection\TypeResolver(); +$type = $typeResolver->resolve('string|integer'); +``` + +In this example you will receive a Value Object of class `\phpDocumentor\Reflection\Types\Compound` that has two +elements, one of type `\phpDocumentor\Reflection\Types\String_` and one of type +`\phpDocumentor\Reflection\Types\Integer`. + +The real power of this resolver is in its capability to expand partial class names into fully qualified class names; but +in order to do that we need an additional `\phpDocumentor\Reflection\Types\Context` class that will inform the resolver +in which namespace the given expression occurs and which namespace aliases (or imports) apply. + +## Resolving an FQSEN + +A Fully Qualified Structural Element Name is a reference to another element in your code bases and can be resolved using +the `\phpDocumentor\Reflection\FqsenResolver` class' `resolve` method, like this: + +```php +$fqsenResolver = new \phpDocumentor\Reflection\FqsenResolver(); +$fqsen = $fqsenResolver->resolve('\phpDocumentor\Reflection\FqsenResolver::resolve()'); +``` + +In this example we resolve a Fully Qualified Structural Element Name (meaning that it includes the full namespace, class +name and element name) and receive a Value Object of type `\phpDocumentor\Reflection\Fqsen`. + +The real power of this resolver is in its capability to expand partial element names into Fully Qualified Structural +Element Names; but in order to do that we need an additional `\phpDocumentor\Reflection\Types\Context` class that will +inform the resolver in which namespace the given expression occurs and which namespace aliases (or imports) apply. + +## Resolving partial Classes and Structural Element Names + +Perhaps the best feature of this library is that it knows how to resolve partial class names into fully qualified class +names. + +For example, you have this file: + +```php +namespace My\Example; + +use phpDocumentor\Reflection\Types; + +class Classy +{ + /** + * @var Types\Context + * @see Classy::otherFunction() + */ + public function __construct($context) {} + + public function otherFunction(){} +} +``` + +Suppose that you would want to resolve (and expand) the type in the `@var` tag and the element name in the `@see` tag. +For the resolvers to know how to expand partial names you have to provide a bit of _Context_ for them by instantiating +a new class named `\phpDocumentor\Reflection\Types\Context` with the name of the namespace and the aliases that are in +play. + +### Creating a Context + +You can do this by manually creating a Context like this: + +```php +$context = new \phpDocumentor\Reflection\Types\Context( + '\My\Example', + [ 'Types' => '\phpDocumentor\Reflection\Types'] +); +``` + +Or by using the `\phpDocumentor\Reflection\Types\ContextFactory` to instantiate a new context based on a Reflector +object or by providing the namespace that you'd like to extract and the source code of the file in which the given +type expression occurs. + +```php +$contextFactory = new \phpDocumentor\Reflection\Types\ContextFactory(); +$context = $contextFactory->createFromReflector(new ReflectionMethod('\My\Example\Classy', '__construct')); +``` + +or + +```php +$contextFactory = new \phpDocumentor\Reflection\Types\ContextFactory(); +$context = $contextFactory->createForNamespace('\My\Example', file_get_contents('My/Example/Classy.php')); +``` + +### Using the Context + +After you have obtained a Context it is just a matter of passing it along with the `resolve` method of either Resolver +class as second argument and the Resolvers will take this into account when resolving partial names. + +To obtain the resolved class name for the `@var` tag in the example above you can do: + +```php +$typeResolver = new \phpDocumentor\Reflection\TypeResolver(); +$type = $typeResolver->resolve('Types\Context', $context); +``` + +When you do this you will receive an object of class `\phpDocumentor\Reflection\Types\Object_` for which you can call +the `getFqsen` method to receive a Value Object that represents the complete FQSEN. So that would be +`phpDocumentor\Reflection\Types\Context`. + +> Why is the FQSEN wrapped in another object `Object_`? +> +> The resolve method of the TypeResolver only returns object with the interface `Type` and the FQSEN is a common +> type that does not represent a Type. Also: in some cases a type can represent an "Untyped Object", meaning that it +> is an object (signified by the `object` keyword) but does not refer to a specific element using an FQSEN. + +Another example is on how to resolve the FQSEN of a method as can be seen with the `@see` tag in the example above. To +resolve that you can do the following: + +```php +$fqsenResolver = new \phpDocumentor\Reflection\FqsenResolver(); +$type = $fqsenResolver->resolve('Classy::otherFunction()', $context); +``` + +Because Classy is a Class in the current namespace its FQSEN will have the `My\Example` namespace and by calling the +`resolve` method of the FQSEN Resolver you will receive an `Fqsen` object that refers to +`\My\Example\Classy::otherFunction()`. diff --git a/vendor/phpdocumentor/type-resolver/composer.json b/vendor/phpdocumentor/type-resolver/composer.json new file mode 100644 index 0000000..82ead15 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/composer.json @@ -0,0 +1,27 @@ +{ + "name": "phpdocumentor/type-resolver", + "type": "library", + "license": "MIT", + "authors": [ + {"name": "Mike van Riel", "email": "me@mikevanriel.com"} + ], + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "autoload": { + "psr-4": {"phpDocumentor\\Reflection\\": ["src/"]} + }, + "autoload-dev": { + "psr-4": {"phpDocumentor\\Reflection\\": ["tests/unit"]} + }, + "require-dev": { + "phpunit/phpunit": "^5.2||^4.8.24", + "mockery/mockery": "^0.9.4" + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/FqsenResolver.php b/vendor/phpdocumentor/type-resolver/src/FqsenResolver.php new file mode 100644 index 0000000..9aa6ba3 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/FqsenResolver.php @@ -0,0 +1,77 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +use phpDocumentor\Reflection\Types\Context; + +class FqsenResolver +{ + /** @var string Definition of the NAMESPACE operator in PHP */ + const OPERATOR_NAMESPACE = '\\'; + + public function resolve($fqsen, Context $context = null) + { + if ($context === null) { + $context = new Context(''); + } + + if ($this->isFqsen($fqsen)) { + return new Fqsen($fqsen); + } + + return $this->resolvePartialStructuralElementName($fqsen, $context); + } + + /** + * Tests whether the given type is a Fully Qualified Structural Element Name. + * + * @param string $type + * + * @return bool + */ + private function isFqsen($type) + { + return strpos($type, self::OPERATOR_NAMESPACE) === 0; + } + + /** + * Resolves a partial Structural Element Name (i.e. `Reflection\DocBlock`) to its FQSEN representation + * (i.e. `\phpDocumentor\Reflection\DocBlock`) based on the Namespace and aliases mentioned in the Context. + * + * @param string $type + * @param Context $context + * + * @return Fqsen + * @throws \InvalidArgumentException when type is not a valid FQSEN. + */ + private function resolvePartialStructuralElementName($type, Context $context) + { + $typeParts = explode(self::OPERATOR_NAMESPACE, $type, 2); + + $namespaceAliases = $context->getNamespaceAliases(); + + // if the first segment is not an alias; prepend namespace name and return + if (!isset($namespaceAliases[$typeParts[0]])) { + $namespace = $context->getNamespace(); + if ('' !== $namespace) { + $namespace .= self::OPERATOR_NAMESPACE; + } + + return new Fqsen(self::OPERATOR_NAMESPACE . $namespace . $type); + } + + $typeParts[0] = $namespaceAliases[$typeParts[0]]; + + return new Fqsen(self::OPERATOR_NAMESPACE . implode(self::OPERATOR_NAMESPACE, $typeParts)); + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Type.php b/vendor/phpdocumentor/type-resolver/src/Type.php new file mode 100644 index 0000000..33ca559 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Type.php @@ -0,0 +1,18 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +interface Type +{ + public function __toString(); +} diff --git a/vendor/phpdocumentor/type-resolver/src/TypeResolver.php b/vendor/phpdocumentor/type-resolver/src/TypeResolver.php new file mode 100644 index 0000000..08b2a5f --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/TypeResolver.php @@ -0,0 +1,298 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +use phpDocumentor\Reflection\Types\Array_; +use phpDocumentor\Reflection\Types\Compound; +use phpDocumentor\Reflection\Types\Context; +use phpDocumentor\Reflection\Types\Iterable_; +use phpDocumentor\Reflection\Types\Nullable; +use phpDocumentor\Reflection\Types\Object_; + +final class TypeResolver +{ + /** @var string Definition of the ARRAY operator for types */ + const OPERATOR_ARRAY = '[]'; + + /** @var string Definition of the NAMESPACE operator in PHP */ + const OPERATOR_NAMESPACE = '\\'; + + /** @var string[] List of recognized keywords and unto which Value Object they map */ + private $keywords = array( + 'string' => Types\String_::class, + 'int' => Types\Integer::class, + 'integer' => Types\Integer::class, + 'bool' => Types\Boolean::class, + 'boolean' => Types\Boolean::class, + 'float' => Types\Float_::class, + 'double' => Types\Float_::class, + 'object' => Object_::class, + 'mixed' => Types\Mixed_::class, + 'array' => Array_::class, + 'resource' => Types\Resource_::class, + 'void' => Types\Void_::class, + 'null' => Types\Null_::class, + 'scalar' => Types\Scalar::class, + 'callback' => Types\Callable_::class, + 'callable' => Types\Callable_::class, + 'false' => Types\Boolean::class, + 'true' => Types\Boolean::class, + 'self' => Types\Self_::class, + '$this' => Types\This::class, + 'static' => Types\Static_::class, + 'parent' => Types\Parent_::class, + 'iterable' => Iterable_::class, + ); + + /** @var FqsenResolver */ + private $fqsenResolver; + + /** + * Initializes this TypeResolver with the means to create and resolve Fqsen objects. + * + * @param FqsenResolver $fqsenResolver + */ + public function __construct(FqsenResolver $fqsenResolver = null) + { + $this->fqsenResolver = $fqsenResolver ?: new FqsenResolver(); + } + + /** + * Analyzes the given type and returns the FQCN variant. + * + * When a type is provided this method checks whether it is not a keyword or + * Fully Qualified Class Name. If so it will use the given namespace and + * aliases to expand the type to a FQCN representation. + * + * This method only works as expected if the namespace and aliases are set; + * no dynamic reflection is being performed here. + * + * @param string $type The relative or absolute type. + * @param Context $context + * + * @uses Context::getNamespace() to determine with what to prefix the type name. + * @uses Context::getNamespaceAliases() to check whether the first part of the relative type name should not be + * replaced with another namespace. + * + * @return Type|null + */ + public function resolve($type, Context $context = null) + { + if (!is_string($type)) { + throw new \InvalidArgumentException( + 'Attempted to resolve type but it appeared not to be a string, received: ' . var_export($type, true) + ); + } + + $type = trim($type); + if (!$type) { + throw new \InvalidArgumentException('Attempted to resolve "' . $type . '" but it appears to be empty'); + } + + if ($context === null) { + $context = new Context(''); + } + + switch (true) { + case $this->isNullableType($type): + return $this->resolveNullableType($type, $context); + case $this->isKeyword($type): + return $this->resolveKeyword($type); + case ($this->isCompoundType($type)): + return $this->resolveCompoundType($type, $context); + case $this->isTypedArray($type): + return $this->resolveTypedArray($type, $context); + case $this->isFqsen($type): + return $this->resolveTypedObject($type); + case $this->isPartialStructuralElementName($type): + return $this->resolveTypedObject($type, $context); + // @codeCoverageIgnoreStart + default: + // I haven't got the foggiest how the logic would come here but added this as a defense. + throw new \RuntimeException( + 'Unable to resolve type "' . $type . '", there is no known method to resolve it' + ); + } + // @codeCoverageIgnoreEnd + } + + /** + * Adds a keyword to the list of Keywords and associates it with a specific Value Object. + * + * @param string $keyword + * @param string $typeClassName + * + * @return void + */ + public function addKeyword($keyword, $typeClassName) + { + if (!class_exists($typeClassName)) { + throw new \InvalidArgumentException( + 'The Value Object that needs to be created with a keyword "' . $keyword . '" must be an existing class' + . ' but we could not find the class ' . $typeClassName + ); + } + + if (!in_array(Type::class, class_implements($typeClassName))) { + throw new \InvalidArgumentException( + 'The class "' . $typeClassName . '" must implement the interface "phpDocumentor\Reflection\Type"' + ); + } + + $this->keywords[$keyword] = $typeClassName; + } + + /** + * Detects whether the given type represents an array. + * + * @param string $type A relative or absolute type as defined in the phpDocumentor documentation. + * + * @return bool + */ + private function isTypedArray($type) + { + return substr($type, -2) === self::OPERATOR_ARRAY; + } + + /** + * Detects whether the given type represents a PHPDoc keyword. + * + * @param string $type A relative or absolute type as defined in the phpDocumentor documentation. + * + * @return bool + */ + private function isKeyword($type) + { + return in_array(strtolower($type), array_keys($this->keywords), true); + } + + /** + * Detects whether the given type represents a relative structural element name. + * + * @param string $type A relative or absolute type as defined in the phpDocumentor documentation. + * + * @return bool + */ + private function isPartialStructuralElementName($type) + { + return ($type[0] !== self::OPERATOR_NAMESPACE) && !$this->isKeyword($type); + } + + /** + * Tests whether the given type is a Fully Qualified Structural Element Name. + * + * @param string $type + * + * @return bool + */ + private function isFqsen($type) + { + return strpos($type, self::OPERATOR_NAMESPACE) === 0; + } + + /** + * Tests whether the given type is a compound type (i.e. `string|int`). + * + * @param string $type + * + * @return bool + */ + private function isCompoundType($type) + { + return strpos($type, '|') !== false; + } + + /** + * Test whether the given type is a nullable type (i.e. `?string`) + * + * @param string $type + * + * @return bool + */ + private function isNullableType($type) + { + return $type[0] === '?'; + } + + /** + * Resolves the given typed array string (i.e. `string[]`) into an Array object with the right types set. + * + * @param string $type + * @param Context $context + * + * @return Array_ + */ + private function resolveTypedArray($type, Context $context) + { + return new Array_($this->resolve(substr($type, 0, -2), $context)); + } + + /** + * Resolves the given keyword (such as `string`) into a Type object representing that keyword. + * + * @param string $type + * + * @return Type + */ + private function resolveKeyword($type) + { + $className = $this->keywords[strtolower($type)]; + + return new $className(); + } + + /** + * Resolves the given FQSEN string into an FQSEN object. + * + * @param string $type + * @param Context|null $context + * + * @return Object_ + */ + private function resolveTypedObject($type, Context $context = null) + { + return new Object_($this->fqsenResolver->resolve($type, $context)); + } + + /** + * Resolves a compound type (i.e. `string|int`) into the appropriate Type objects or FQSEN. + * + * @param string $type + * @param Context $context + * + * @return Compound + */ + private function resolveCompoundType($type, Context $context) + { + $types = []; + + foreach (explode('|', $type) as $part) { + $types[] = $this->resolve($part, $context); + } + + return new Compound($types); + } + + /** + * Resolve nullable types (i.e. `?string`) into a Nullable type wrapper + * + * @param string $type + * @param Context $context + * + * @return Nullable + */ + private function resolveNullableType($type, Context $context) + { + return new Nullable($this->resolve(ltrim($type, '?'), $context)); + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Array_.php b/vendor/phpdocumentor/type-resolver/src/Types/Array_.php new file mode 100644 index 0000000..49b7c6e --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Array_.php @@ -0,0 +1,86 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Represents an array type as described in the PSR-5, the PHPDoc Standard. + * + * An array can be represented in two forms: + * + * 1. Untyped (`array`), where the key and value type is unknown and hence classified as 'Mixed_'. + * 2. Types (`string[]`), where the value type is provided by preceding an opening and closing square bracket with a + * type name. + */ +final class Array_ implements Type +{ + /** @var Type */ + private $valueType; + + /** @var Type */ + private $keyType; + + /** + * Initializes this representation of an array with the given Type or Fqsen. + * + * @param Type $valueType + * @param Type $keyType + */ + public function __construct(Type $valueType = null, Type $keyType = null) + { + if ($keyType === null) { + $keyType = new Compound([ new String_(), new Integer() ]); + } + if ($valueType === null) { + $valueType = new Mixed_(); + } + + $this->valueType = $valueType; + $this->keyType = $keyType; + } + + /** + * Returns the type for the keys of this array. + * + * @return Type + */ + public function getKeyType() + { + return $this->keyType; + } + + /** + * Returns the value for the keys of this array. + * + * @return Type + */ + public function getValueType() + { + return $this->valueType; + } + + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + if ($this->valueType instanceof Mixed_) { + return 'array'; + } + + return $this->valueType . '[]'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Boolean.php b/vendor/phpdocumentor/type-resolver/src/Types/Boolean.php new file mode 100644 index 0000000..f82b19e --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Boolean.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing a Boolean type. + */ +final class Boolean implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'bool'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Callable_.php b/vendor/phpdocumentor/type-resolver/src/Types/Callable_.php new file mode 100644 index 0000000..68ebfbd --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Callable_.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing a Callable type. + */ +final class Callable_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'callable'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Compound.php b/vendor/phpdocumentor/type-resolver/src/Types/Compound.php new file mode 100644 index 0000000..be986c3 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Compound.php @@ -0,0 +1,93 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use ArrayIterator; +use IteratorAggregate; +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing a Compound Type. + * + * A Compound Type is not so much a special keyword or object reference but is a series of Types that are separated + * using an OR operator (`|`). This combination of types signifies that whatever is associated with this compound type + * may contain a value with any of the given types. + */ +final class Compound implements Type, IteratorAggregate +{ + /** @var Type[] */ + private $types; + + /** + * Initializes a compound type (i.e. `string|int`) and tests if the provided types all implement the Type interface. + * + * @param Type[] $types + * @throws \InvalidArgumentException when types are not all instance of Type + */ + public function __construct(array $types) + { + foreach ($types as $type) { + if (!$type instanceof Type) { + throw new \InvalidArgumentException('A compound type can only have other types as elements'); + } + } + + $this->types = $types; + } + + /** + * Returns the type at the given index. + * + * @param integer $index + * + * @return Type|null + */ + public function get($index) + { + if (!$this->has($index)) { + return null; + } + + return $this->types[$index]; + } + + /** + * Tests if this compound type has a type with the given index. + * + * @param integer $index + * + * @return bool + */ + public function has($index) + { + return isset($this->types[$index]); + } + + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return implode('|', $this->types); + } + + /** + * {@inheritdoc} + */ + public function getIterator() + { + return new ArrayIterator($this->types); + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Context.php b/vendor/phpdocumentor/type-resolver/src/Types/Context.php new file mode 100644 index 0000000..4e9ce5a --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Context.php @@ -0,0 +1,84 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +/** + * Provides information about the Context in which the DocBlock occurs that receives this context. + * + * A DocBlock does not know of its own accord in which namespace it occurs and which namespace aliases are applicable + * for the block of code in which it is in. This information is however necessary to resolve Class names in tags since + * you can provide a short form or make use of namespace aliases. + * + * The phpDocumentor Reflection component knows how to create this class but if you use the DocBlock parser from your + * own application it is possible to generate a Context class using the ContextFactory; this will analyze the file in + * which an associated class resides for its namespace and imports. + * + * @see ContextFactory::createFromClassReflector() + * @see ContextFactory::createForNamespace() + */ +final class Context +{ + /** @var string The current namespace. */ + private $namespace; + + /** @var array List of namespace aliases => Fully Qualified Namespace. */ + private $namespaceAliases; + + /** + * Initializes the new context and normalizes all passed namespaces to be in Qualified Namespace Name (QNN) + * format (without a preceding `\`). + * + * @param string $namespace The namespace where this DocBlock resides in. + * @param array $namespaceAliases List of namespace aliases => Fully Qualified Namespace. + */ + public function __construct($namespace, array $namespaceAliases = []) + { + $this->namespace = ('global' !== $namespace && 'default' !== $namespace) + ? trim((string)$namespace, '\\') + : ''; + + foreach ($namespaceAliases as $alias => $fqnn) { + if ($fqnn[0] === '\\') { + $fqnn = substr($fqnn, 1); + } + if ($fqnn[strlen($fqnn) - 1] === '\\') { + $fqnn = substr($fqnn, 0, -1); + } + + $namespaceAliases[$alias] = $fqnn; + } + + $this->namespaceAliases = $namespaceAliases; + } + + /** + * Returns the Qualified Namespace Name (thus without `\` in front) where the associated element is in. + * + * @return string + */ + public function getNamespace() + { + return $this->namespace; + } + + /** + * Returns a list of Qualified Namespace Names (thus without `\` in front) that are imported, the keys represent + * the alias for the imported Namespace. + * + * @return string[] + */ + public function getNamespaceAliases() + { + return $this->namespaceAliases; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/ContextFactory.php b/vendor/phpdocumentor/type-resolver/src/Types/ContextFactory.php new file mode 100644 index 0000000..30936a3 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/ContextFactory.php @@ -0,0 +1,210 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +/** + * Convenience class to create a Context for DocBlocks when not using the Reflection Component of phpDocumentor. + * + * For a DocBlock to be able to resolve types that use partial namespace names or rely on namespace imports we need to + * provide a bit of context so that the DocBlock can read that and based on it decide how to resolve the types to + * Fully Qualified names. + * + * @see Context for more information. + */ +final class ContextFactory +{ + /** The literal used at the end of a use statement. */ + const T_LITERAL_END_OF_USE = ';'; + + /** The literal used between sets of use statements */ + const T_LITERAL_USE_SEPARATOR = ','; + + /** + * Build a Context given a Class Reflection. + * + * @param \Reflector $reflector + * + * @see Context for more information on Contexts. + * + * @return Context + */ + public function createFromReflector(\Reflector $reflector) + { + if (method_exists($reflector, 'getDeclaringClass')) { + $reflector = $reflector->getDeclaringClass(); + } + + $fileName = $reflector->getFileName(); + $namespace = $reflector->getNamespaceName(); + + if (file_exists($fileName)) { + return $this->createForNamespace($namespace, file_get_contents($fileName)); + } + + return new Context($namespace, []); + } + + /** + * Build a Context for a namespace in the provided file contents. + * + * @param string $namespace It does not matter if a `\` precedes the namespace name, this method first normalizes. + * @param string $fileContents the file's contents to retrieve the aliases from with the given namespace. + * + * @see Context for more information on Contexts. + * + * @return Context + */ + public function createForNamespace($namespace, $fileContents) + { + $namespace = trim($namespace, '\\'); + $useStatements = []; + $currentNamespace = ''; + $tokens = new \ArrayIterator(token_get_all($fileContents)); + + while ($tokens->valid()) { + switch ($tokens->current()[0]) { + case T_NAMESPACE: + $currentNamespace = $this->parseNamespace($tokens); + break; + case T_CLASS: + // Fast-forward the iterator through the class so that any + // T_USE tokens found within are skipped - these are not + // valid namespace use statements so should be ignored. + $braceLevel = 0; + $firstBraceFound = false; + while ($tokens->valid() && ($braceLevel > 0 || !$firstBraceFound)) { + if ($tokens->current() === '{' + || $tokens->current()[0] === T_CURLY_OPEN + || $tokens->current()[0] === T_DOLLAR_OPEN_CURLY_BRACES) { + if (!$firstBraceFound) { + $firstBraceFound = true; + } + $braceLevel++; + } + + if ($tokens->current() === '}') { + $braceLevel--; + } + $tokens->next(); + } + break; + case T_USE: + if ($currentNamespace === $namespace) { + $useStatements = array_merge($useStatements, $this->parseUseStatement($tokens)); + } + break; + } + $tokens->next(); + } + + return new Context($namespace, $useStatements); + } + + /** + * Deduce the name from tokens when we are at the T_NAMESPACE token. + * + * @param \ArrayIterator $tokens + * + * @return string + */ + private function parseNamespace(\ArrayIterator $tokens) + { + // skip to the first string or namespace separator + $this->skipToNextStringOrNamespaceSeparator($tokens); + + $name = ''; + while ($tokens->valid() && ($tokens->current()[0] === T_STRING || $tokens->current()[0] === T_NS_SEPARATOR) + ) { + $name .= $tokens->current()[1]; + $tokens->next(); + } + + return $name; + } + + /** + * Deduce the names of all imports when we are at the T_USE token. + * + * @param \ArrayIterator $tokens + * + * @return string[] + */ + private function parseUseStatement(\ArrayIterator $tokens) + { + $uses = []; + $continue = true; + + while ($continue) { + $this->skipToNextStringOrNamespaceSeparator($tokens); + + list($alias, $fqnn) = $this->extractUseStatement($tokens); + $uses[$alias] = $fqnn; + if ($tokens->current()[0] === self::T_LITERAL_END_OF_USE) { + $continue = false; + } + } + + return $uses; + } + + /** + * Fast-forwards the iterator as longs as we don't encounter a T_STRING or T_NS_SEPARATOR token. + * + * @param \ArrayIterator $tokens + * + * @return void + */ + private function skipToNextStringOrNamespaceSeparator(\ArrayIterator $tokens) + { + while ($tokens->valid() && ($tokens->current()[0] !== T_STRING) && ($tokens->current()[0] !== T_NS_SEPARATOR)) { + $tokens->next(); + } + } + + /** + * Deduce the namespace name and alias of an import when we are at the T_USE token or have not reached the end of + * a USE statement yet. + * + * @param \ArrayIterator $tokens + * + * @return string + */ + private function extractUseStatement(\ArrayIterator $tokens) + { + $result = ['']; + while ($tokens->valid() + && ($tokens->current()[0] !== self::T_LITERAL_USE_SEPARATOR) + && ($tokens->current()[0] !== self::T_LITERAL_END_OF_USE) + ) { + if ($tokens->current()[0] === T_AS) { + $result[] = ''; + } + if ($tokens->current()[0] === T_STRING || $tokens->current()[0] === T_NS_SEPARATOR) { + $result[count($result) - 1] .= $tokens->current()[1]; + } + $tokens->next(); + } + + if (count($result) == 1) { + $backslashPos = strrpos($result[0], '\\'); + + if (false !== $backslashPos) { + $result[] = substr($result[0], $backslashPos + 1); + } else { + $result[] = $result[0]; + } + } + + return array_reverse($result); + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Float_.php b/vendor/phpdocumentor/type-resolver/src/Types/Float_.php new file mode 100644 index 0000000..e58d896 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Float_.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing a Float. + */ +final class Float_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'float'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Integer.php b/vendor/phpdocumentor/type-resolver/src/Types/Integer.php new file mode 100644 index 0000000..be4555e --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Integer.php @@ -0,0 +1,28 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +final class Integer implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'int'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Iterable_.php b/vendor/phpdocumentor/type-resolver/src/Types/Iterable_.php new file mode 100644 index 0000000..0cbf48f --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Iterable_.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing iterable type + */ +final class Iterable_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'iterable'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Mixed_.php b/vendor/phpdocumentor/type-resolver/src/Types/Mixed_.php new file mode 100644 index 0000000..c1c165f --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Mixed_.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing an unknown, or mixed, type. + */ +final class Mixed_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'mixed'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Null_.php b/vendor/phpdocumentor/type-resolver/src/Types/Null_.php new file mode 100644 index 0000000..203b422 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Null_.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing a null value or type. + */ +final class Null_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'null'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Nullable.php b/vendor/phpdocumentor/type-resolver/src/Types/Nullable.php new file mode 100644 index 0000000..3c6d1b1 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Nullable.php @@ -0,0 +1,56 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing a nullable type. The real type is wrapped. + */ +final class Nullable implements Type +{ + /** + * @var Type + */ + private $realType; + + /** + * Initialises this nullable type using the real type embedded + * + * @param Type $realType + */ + public function __construct(Type $realType) + { + $this->realType = $realType; + } + + /** + * Provide access to the actual type directly, if needed. + * + * @return Type + */ + public function getActualType() + { + return $this->realType; + } + + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return '?' . $this->realType->__toString(); + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Object_.php b/vendor/phpdocumentor/type-resolver/src/Types/Object_.php new file mode 100644 index 0000000..389f7c7 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Object_.php @@ -0,0 +1,71 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing an object. + * + * An object can be either typed or untyped. When an object is typed it means that it has an identifier, the FQSEN, + * pointing to an element in PHP. Object types that are untyped do not refer to a specific class but represent objects + * in general. + */ +final class Object_ implements Type +{ + /** @var Fqsen|null */ + private $fqsen; + + /** + * Initializes this object with an optional FQSEN, if not provided this object is considered 'untyped'. + * + * @param Fqsen $fqsen + * @throws \InvalidArgumentException when provided $fqsen is not a valid type. + */ + public function __construct(Fqsen $fqsen = null) + { + if (strpos((string)$fqsen, '::') !== false || strpos((string)$fqsen, '()') !== false) { + throw new \InvalidArgumentException( + 'Object types can only refer to a class, interface or trait but a method, function, constant or ' + . 'property was received: ' . (string)$fqsen + ); + } + + $this->fqsen = $fqsen; + } + + /** + * Returns the FQSEN associated with this object. + * + * @return Fqsen|null + */ + public function getFqsen() + { + return $this->fqsen; + } + + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + if ($this->fqsen) { + return (string)$this->fqsen; + } + + return 'object'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Parent_.php b/vendor/phpdocumentor/type-resolver/src/Types/Parent_.php new file mode 100644 index 0000000..aabdbfb --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Parent_.php @@ -0,0 +1,33 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the 'parent' type. + * + * Parent, as a Type, represents the parent class of class in which the associated element was defined. + */ +final class Parent_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'parent'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Resource_.php b/vendor/phpdocumentor/type-resolver/src/Types/Resource_.php new file mode 100644 index 0000000..a1b613d --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Resource_.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the 'resource' Type. + */ +final class Resource_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'resource'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Scalar.php b/vendor/phpdocumentor/type-resolver/src/Types/Scalar.php new file mode 100644 index 0000000..1e2a660 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Scalar.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the 'scalar' pseudo-type, which is either a string, integer, float or boolean. + */ +final class Scalar implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'scalar'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Self_.php b/vendor/phpdocumentor/type-resolver/src/Types/Self_.php new file mode 100644 index 0000000..1ba3fc5 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Self_.php @@ -0,0 +1,33 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the 'self' type. + * + * Self, as a Type, represents the class in which the associated element was defined. + */ +final class Self_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'self'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Static_.php b/vendor/phpdocumentor/type-resolver/src/Types/Static_.php new file mode 100644 index 0000000..9eb6729 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Static_.php @@ -0,0 +1,38 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the 'static' type. + * + * Self, as a Type, represents the class in which the associated element was called. This differs from self as self does + * not take inheritance into account but static means that the return type is always that of the class of the called + * element. + * + * See the documentation on late static binding in the PHP Documentation for more information on the difference between + * static and self. + */ +final class Static_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'static'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/String_.php b/vendor/phpdocumentor/type-resolver/src/Types/String_.php new file mode 100644 index 0000000..8db5968 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/String_.php @@ -0,0 +1,31 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the type 'string'. + */ +final class String_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'string'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/This.php b/vendor/phpdocumentor/type-resolver/src/Types/This.php new file mode 100644 index 0000000..c098a93 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/This.php @@ -0,0 +1,34 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the '$this' pseudo-type. + * + * $this, as a Type, represents the instance of the class associated with the element as it was called. $this is + * commonly used when documenting fluent interfaces since it represents that the same object is returned. + */ +final class This implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return '$this'; + } +} diff --git a/vendor/phpdocumentor/type-resolver/src/Types/Void_.php b/vendor/phpdocumentor/type-resolver/src/Types/Void_.php new file mode 100644 index 0000000..3d1be27 --- /dev/null +++ b/vendor/phpdocumentor/type-resolver/src/Types/Void_.php @@ -0,0 +1,34 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Types; + +use phpDocumentor\Reflection\Type; + +/** + * Value Object representing the pseudo-type 'void'. + * + * Void is generally only used when working with return types as it signifies that the method intentionally does not + * return any value. + */ +final class Void_ implements Type +{ + /** + * Returns a rendered output of the Type as it would be used in a DocBlock. + * + * @return string + */ + public function __toString() + { + return 'void'; + } +} diff --git a/vendor/phpspec/prophecy/CHANGES.md b/vendor/phpspec/prophecy/CHANGES.md new file mode 100644 index 0000000..fddfc41 --- /dev/null +++ b/vendor/phpspec/prophecy/CHANGES.md @@ -0,0 +1,213 @@ +1.8.0 / 2018/08/05 +================== + +* Support for void return types without explicit will (@crellbar) +* Clearer error message for unexpected method calls (@meridius) +* Clearer error message for aggregate exceptions (@meridius) +* More verbose `shouldBeCalledOnce` expectation (@olvlvl) +* Ability to double Throwable, or methods that extend it (@ciaranmcnulty) +* [fixed] Doubling methods where class has additional arguments to interface (@webimpress) +* [fixed] Doubling methods where arguments are nullable but default is not null (@webimpress) +* [fixed] Doubling magic methods on parent class (@dsnopek) +* [fixed] Check method predictions only once (@dontub) +* [fixed] Argument::containingString throwing error when called with non-string (@dcabrejas) + +1.7.6 / 2018/04/18 +================== + +* Allow sebastian/comparator ^3.0 (@sebastianbergmann) + +1.7.5 / 2018/02/11 +================== + +* Support for object return type hints (thanks @greg0ire) + +1.7.4 / 2018/02/11 +================== + +* Fix issues with PHP 7.2 (thanks @greg0ire) +* Support object type hints in PHP 7.2 (thanks @@jansvoboda11) + +1.7.3 / 2017/11/24 +================== + +* Fix SplInfo ClassPatch to work with Symfony 4 (Thanks @gnugat) + +1.7.2 / 2017-10-04 +================== + +* Reverted "check method predictions only once" due to it breaking Spies + +1.7.1 / 2017-10-03 +================== + +* Allow PHP5 keywords methods generation on PHP7 (thanks @bycosta) +* Allow reflection-docblock v4 (thanks @GrahamCampbell) +* Check method predictions only once (thanks @dontub) +* Escape file path sent to \SplFileObjectConstructor when running on Windows (thanks @danmartin-epiphany) + +1.7.0 / 2017-03-02 +================== + +* Add full PHP 7.1 Support (thanks @prolic) +* Allow `sebastian/comparator ^2.0` (thanks @sebastianbergmann) +* Allow `sebastian/recursion-context ^3.0` (thanks @sebastianbergmann) +* Allow `\Error` instances in `ThrowPromise` (thanks @jameshalsall) +* Support `phpspec/phpspect ^3.2` (thanks @Sam-Burns) +* Fix failing builds (thanks @Sam-Burns) + +1.6.2 / 2016-11-21 +================== + +* Added support for detecting @method on interfaces that the class itself implements, or when the stubbed class is an interface itself (thanks @Seldaek) +* Added support for sebastian/recursion-context 2 (thanks @sebastianbergmann) +* Added testing on PHP 7.1 on Travis (thanks @danizord) +* Fixed the usage of the phpunit comparator (thanks @Anyqax) + +1.6.1 / 2016-06-07 +================== + + * Ignored empty method names in invalid `@method` phpdoc + * Fixed the mocking of SplFileObject + * Added compatibility with phpdocumentor/reflection-docblock 3 + +1.6.0 / 2016-02-15 +================== + + * Add Variadics support (thanks @pamil) + * Add ProphecyComparator for comparing objects that need revealing (thanks @jon-acker) + * Add ApproximateValueToken (thanks @dantleech) + * Add support for 'self' and 'parent' return type (thanks @bendavies) + * Add __invoke to allowed reflectable methods list (thanks @ftrrtf) + * Updated ExportUtil to reflect the latest changes by Sebastian (thanks @jakari) + * Specify the required php version for composer (thanks @jakzal) + * Exclude 'args' in the generated backtrace (thanks @oradwell) + * Fix code generation for scalar parameters (thanks @trowski) + * Fix missing sprintf in InvalidArgumentException __construct call (thanks @emmanuelballery) + * Fix phpdoc for magic methods (thanks @Tobion) + * Fix PhpDoc for interfaces usage (thanks @ImmRanneft) + * Prevent final methods from being manually extended (thanks @kamioftea) + * Enhance exception for invalid argument to ThrowPromise (thanks @Tobion) + +1.5.0 / 2015-04-27 +================== + + * Add support for PHP7 scalar type hints (thanks @trowski) + * Add support for PHP7 return types (thanks @trowski) + * Update internal test suite to support PHP7 + +1.4.1 / 2015-04-27 +================== + + * Fixed bug in closure-based argument tokens (#181) + +1.4.0 / 2015-03-27 +================== + + * Fixed errors in return type phpdocs (thanks @sobit) + * Fixed stringifying of hash containing one value (thanks @avant1) + * Improved clarity of method call expectation exception (thanks @dantleech) + * Add ability to specify which argument is returned in willReturnArgument (thanks @coderbyheart) + * Add more information to MethodNotFound exceptions (thanks @ciaranmcnulty) + * Support for mocking classes with methods that return references (thanks @edsonmedina) + * Improved object comparison (thanks @whatthejeff) + * Adopted '^' in composer dependencies (thanks @GrahamCampbell) + * Fixed non-typehinted arguments being treated as optional (thanks @whatthejeff) + * Magic methods are now filtered for keywords (thanks @seagoj) + * More readable errors for failure when expecting single calls (thanks @dantleech) + +1.3.1 / 2014-11-17 +================== + + * Fix the edge case when failed predictions weren't recorded for `getCheckedPredictions()` + +1.3.0 / 2014-11-14 +================== + + * Add a way to get checked predictions with `MethodProphecy::getCheckedPredictions()` + * Fix HHVM compatibility + * Remove dead code (thanks @stof) + * Add support for DirectoryIterators (thanks @shanethehat) + +1.2.0 / 2014-07-18 +================== + + * Added support for doubling magic methods documented in the class phpdoc (thanks @armetiz) + * Fixed a segfault appearing in some cases (thanks @dmoreaulf) + * Fixed the doubling of methods with typehints on non-existent classes (thanks @gquemener) + * Added support for internal classes using keywords as method names (thanks @milan) + * Added IdenticalValueToken and Argument::is (thanks @florianv) + * Removed the usage of scalar typehints in HHVM as HHVM 3 does not support them anymore in PHP code (thanks @whatthejeff) + +1.1.2 / 2014-01-24 +================== + + * Spy automatically promotes spied method call to an expected one + +1.1.1 / 2014-01-15 +================== + + * Added support for HHVM + +1.1.0 / 2014-01-01 +================== + + * Changed the generated class names to use a static counter instead of a random number + * Added a clss patch for ReflectionClass::newInstance to make its argument optional consistently (thanks @docteurklein) + * Fixed mirroring of classes with typehints on non-existent classes (thanks @docteurklein) + * Fixed the support of array callables in CallbackPromise and CallbackPrediction (thanks @ciaranmcnulty) + * Added support for properties in ObjectStateToken (thanks @adrienbrault) + * Added support for mocking classes with a final constructor (thanks @ciaranmcnulty) + * Added ArrayEveryEntryToken and Argument::withEveryEntry() (thanks @adrienbrault) + * Added an exception when trying to prophesize on a final method instead of ignoring silently (thanks @docteurklein) + * Added StringContainToken and Argument::containingString() (thanks @peterjmit) + * Added ``shouldNotHaveBeenCalled`` on the MethodProphecy (thanks @ciaranmcnulty) + * Fixed the comparison of objects in ExactValuetoken (thanks @sstok) + * Deprecated ``shouldNotBeenCalled`` in favor of ``shouldNotHaveBeenCalled`` + +1.0.4 / 2013-08-10 +================== + + * Better randomness for generated class names (thanks @sstok) + * Add support for interfaces into TypeToken and Argument::type() (thanks @sstok) + * Add support for old-style (method name === class name) constructors (thanks @l310 for report) + +1.0.3 / 2013-07-04 +================== + + * Support callable typehints (thanks @stof) + * Do not attempt to autoload arrays when generating code (thanks @MarcoDeBortoli) + * New ArrayEntryToken (thanks @kagux) + +1.0.2 / 2013-05-19 +================== + + * Logical `AND` token added (thanks @kagux) + * Logical `NOT` token added (thanks @kagux) + * Add support for setting custom constructor arguments + * Properly stringify hashes + * Record calls that throw exceptions + * Migrate spec suite to PhpSpec 2.0 + +1.0.1 / 2013-04-30 +================== + + * Fix broken UnexpectedCallException message + * Trim AggregateException message + +1.0.0 / 2013-04-29 +================== + + * Improve exception messages + +1.0.0-BETA2 / 2013-04-03 +======================== + + * Add more debug information to CallTimes and Call prediction exception messages + * Fix MethodNotFoundException wrong namespace (thanks @gunnarlium) + * Fix some typos in the exception messages (thanks @pborreli) + +1.0.0-BETA1 / 2013-03-25 +======================== + + * Initial release diff --git a/vendor/phpspec/prophecy/LICENSE b/vendor/phpspec/prophecy/LICENSE new file mode 100644 index 0000000..c8b3647 --- /dev/null +++ b/vendor/phpspec/prophecy/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2013 Konstantin Kudryashov + Marcello Duarte + +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/phpspec/prophecy/README.md b/vendor/phpspec/prophecy/README.md new file mode 100644 index 0000000..b190d43 --- /dev/null +++ b/vendor/phpspec/prophecy/README.md @@ -0,0 +1,391 @@ +# Prophecy + +[![Stable release](https://poser.pugx.org/phpspec/prophecy/version.svg)](https://packagist.org/packages/phpspec/prophecy) +[![Build Status](https://travis-ci.org/phpspec/prophecy.svg?branch=master)](https://travis-ci.org/phpspec/prophecy) + +Prophecy is a highly opinionated yet very powerful and flexible PHP object mocking +framework. Though initially it was created to fulfil phpspec2 needs, it is flexible +enough to be used inside any testing framework out there with minimal effort. + +## A simple example + +```php +prophet->prophesize('App\Security\Hasher'); + $user = new App\Entity\User($hasher->reveal()); + + $hasher->generateHash($user, 'qwerty')->willReturn('hashed_pass'); + + $user->setPassword('qwerty'); + + $this->assertEquals('hashed_pass', $user->getPassword()); + } + + protected function setup() + { + $this->prophet = new \Prophecy\Prophet; + } + + protected function tearDown() + { + $this->prophet->checkPredictions(); + } +} +``` + +## Installation + +### Prerequisites + +Prophecy requires PHP 5.3.3 or greater. + +### Setup through composer + +First, add Prophecy to the list of dependencies inside your `composer.json`: + +```json +{ + "require-dev": { + "phpspec/prophecy": "~1.0" + } +} +``` + +Then simply install it with composer: + +```bash +$> composer install --prefer-dist +``` + +You can read more about Composer on its [official webpage](http://getcomposer.org). + +## How to use it + +First of all, in Prophecy every word has a logical meaning, even the name of the library +itself (Prophecy). When you start feeling that, you'll become very fluid with this +tool. + +For example, Prophecy has been named that way because it concentrates on describing the future +behavior of objects with very limited knowledge about them. But as with any other prophecy, +those object prophecies can't create themselves - there should be a Prophet: + +```php +$prophet = new Prophecy\Prophet; +``` + +The Prophet creates prophecies by *prophesizing* them: + +```php +$prophecy = $prophet->prophesize(); +``` + +The result of the `prophesize()` method call is a new object of class `ObjectProphecy`. Yes, +that's your specific object prophecy, which describes how your object would behave +in the near future. But first, you need to specify which object you're talking about, +right? + +```php +$prophecy->willExtend('stdClass'); +$prophecy->willImplement('SessionHandlerInterface'); +``` + +There are 2 interesting calls - `willExtend` and `willImplement`. The first one tells +object prophecy that our object should extend specific class, the second one says that +it should implement some interface. Obviously, objects in PHP can implement multiple +interfaces, but extend only one parent class. + +### Dummies + +Ok, now we have our object prophecy. What can we do with it? First of all, we can get +our object *dummy* by revealing its prophecy: + +```php +$dummy = $prophecy->reveal(); +``` + +The `$dummy` variable now holds a special dummy object. Dummy objects are objects that extend +and/or implement preset classes/interfaces by overriding all their public methods. The key +point about dummies is that they do not hold any logic - they just do nothing. Any method +of the dummy will always return `null` and the dummy will never throw any exceptions. +Dummy is your friend if you don't care about the actual behavior of this double and just need +a token object to satisfy a method typehint. + +You need to understand one thing - a dummy is not a prophecy. Your object prophecy is still +assigned to `$prophecy` variable and in order to manipulate with your expectations, you +should work with it. `$dummy` is a dummy - a simple php object that tries to fulfil your +prophecy. + +### Stubs + +Ok, now we know how to create basic prophecies and reveal dummies from them. That's +awesome if we don't care about our _doubles_ (objects that reflect originals) +interactions. If we do, we need to use *stubs* or *mocks*. + +A stub is an object double, which doesn't have any expectations about the object behavior, +but when put in specific environment, behaves in specific way. Ok, I know, it's cryptic, +but bear with me for a minute. Simply put, a stub is a dummy, which depending on the called +method signature does different things (has logic). To create stubs in Prophecy: + +```php +$prophecy->read('123')->willReturn('value'); +``` + +Oh wow. We've just made an arbitrary call on the object prophecy? Yes, we did. And this +call returned us a new object instance of class `MethodProphecy`. Yep, that's a specific +method with arguments prophecy. Method prophecies give you the ability to create method +promises or predictions. We'll talk about method predictions later in the _Mocks_ section. + +#### Promises + +Promises are logical blocks, that represent your fictional methods in prophecy terms +and they are handled by the `MethodProphecy::will(PromiseInterface $promise)` method. +As a matter of fact, the call that we made earlier (`willReturn('value')`) is a simple +shortcut to: + +```php +$prophecy->read('123')->will(new Prophecy\Promise\ReturnPromise(array('value'))); +``` + +This promise will cause any call to our double's `read()` method with exactly one +argument - `'123'` to always return `'value'`. But that's only for this +promise, there's plenty others you can use: + +- `ReturnPromise` or `->willReturn(1)` - returns a value from a method call +- `ReturnArgumentPromise` or `->willReturnArgument($index)` - returns the nth method argument from call +- `ThrowPromise` or `->willThrow($exception)` - causes the method to throw specific exception +- `CallbackPromise` or `->will($callback)` - gives you a quick way to define your own custom logic + +Keep in mind, that you can always add even more promises by implementing +`Prophecy\Promise\PromiseInterface`. + +#### Method prophecies idempotency + +Prophecy enforces same method prophecies and, as a consequence, same promises and +predictions for the same method calls with the same arguments. This means: + +```php +$methodProphecy1 = $prophecy->read('123'); +$methodProphecy2 = $prophecy->read('123'); +$methodProphecy3 = $prophecy->read('321'); + +$methodProphecy1 === $methodProphecy2; +$methodProphecy1 !== $methodProphecy3; +``` + +That's interesting, right? Now you might ask me how would you define more complex +behaviors where some method call changes behavior of others. In PHPUnit or Mockery +you do that by predicting how many times your method will be called. In Prophecy, +you'll use promises for that: + +```php +$user->getName()->willReturn(null); + +// For PHP 5.4 +$user->setName('everzet')->will(function () { + $this->getName()->willReturn('everzet'); +}); + +// For PHP 5.3 +$user->setName('everzet')->will(function ($args, $user) { + $user->getName()->willReturn('everzet'); +}); + +// Or +$user->setName('everzet')->will(function ($args) use ($user) { + $user->getName()->willReturn('everzet'); +}); +``` + +And now it doesn't matter how many times or in which order your methods are called. +What matters is their behaviors and how well you faked it. + +#### Arguments wildcarding + +The previous example is awesome (at least I hope it is for you), but that's not +optimal enough. We hardcoded `'everzet'` in our expectation. Isn't there a better +way? In fact there is, but it involves understanding what this `'everzet'` +actually is. + +You see, even if method arguments used during method prophecy creation look +like simple method arguments, in reality they are not. They are argument token +wildcards. As a matter of fact, `->setName('everzet')` looks like a simple call just +because Prophecy automatically transforms it under the hood into: + +```php +$user->setName(new Prophecy\Argument\Token\ExactValueToken('everzet')); +``` + +Those argument tokens are simple PHP classes, that implement +`Prophecy\Argument\Token\TokenInterface` and tell Prophecy how to compare real arguments +with your expectations. And yes, those classnames are damn big. That's why there's a +shortcut class `Prophecy\Argument`, which you can use to create tokens like that: + +```php +use Prophecy\Argument; + +$user->setName(Argument::exact('everzet')); +``` + +`ExactValueToken` is not very useful in our case as it forced us to hardcode the username. +That's why Prophecy comes bundled with a bunch of other tokens: + +- `IdenticalValueToken` or `Argument::is($value)` - checks that the argument is identical to a specific value +- `ExactValueToken` or `Argument::exact($value)` - checks that the argument matches a specific value +- `TypeToken` or `Argument::type($typeOrClass)` - checks that the argument matches a specific type or + classname +- `ObjectStateToken` or `Argument::which($method, $value)` - checks that the argument method returns + a specific value +- `CallbackToken` or `Argument::that(callback)` - checks that the argument matches a custom callback +- `AnyValueToken` or `Argument::any()` - matches any argument +- `AnyValuesToken` or `Argument::cetera()` - matches any arguments to the rest of the signature +- `StringContainsToken` or `Argument::containingString($value)` - checks that the argument contains a specific string value + +And you can add even more by implementing `TokenInterface` with your own custom classes. + +So, let's refactor our initial `{set,get}Name()` logic with argument tokens: + +```php +use Prophecy\Argument; + +$user->getName()->willReturn(null); + +// For PHP 5.4 +$user->setName(Argument::type('string'))->will(function ($args) { + $this->getName()->willReturn($args[0]); +}); + +// For PHP 5.3 +$user->setName(Argument::type('string'))->will(function ($args, $user) { + $user->getName()->willReturn($args[0]); +}); + +// Or +$user->setName(Argument::type('string'))->will(function ($args) use ($user) { + $user->getName()->willReturn($args[0]); +}); +``` + +That's it. Now our `{set,get}Name()` prophecy will work with any string argument provided to it. +We've just described how our stub object should behave, even though the original object could have +no behavior whatsoever. + +One last bit about arguments now. You might ask, what happens in case of: + +```php +use Prophecy\Argument; + +$user->getName()->willReturn(null); + +// For PHP 5.4 +$user->setName(Argument::type('string'))->will(function ($args) { + $this->getName()->willReturn($args[0]); +}); + +// For PHP 5.3 +$user->setName(Argument::type('string'))->will(function ($args, $user) { + $user->getName()->willReturn($args[0]); +}); + +// Or +$user->setName(Argument::type('string'))->will(function ($args) use ($user) { + $user->getName()->willReturn($args[0]); +}); + +$user->setName(Argument::any())->will(function () { +}); +``` + +Nothing. Your stub will continue behaving the way it did before. That's because of how +arguments wildcarding works. Every argument token type has a different score level, which +wildcard then uses to calculate the final arguments match score and use the method prophecy +promise that has the highest score. In this case, `Argument::type()` in case of success +scores `5` and `Argument::any()` scores `3`. So the type token wins, as does the first +`setName()` method prophecy and its promise. The simple rule of thumb - more precise token +always wins. + +#### Getting stub objects + +Ok, now we know how to define our prophecy method promises, let's get our stub from +it: + +```php +$stub = $prophecy->reveal(); +``` + +As you might see, the only difference between how we get dummies and stubs is that with +stubs we describe every object conversation instead of just agreeing with `null` returns +(object being *dummy*). As a matter of fact, after you define your first promise +(method call), Prophecy will force you to define all the communications - it throws +the `UnexpectedCallException` for any call you didn't describe with object prophecy before +calling it on a stub. + +### Mocks + +Now we know how to define doubles without behavior (dummies) and doubles with behavior, but +no expectations (stubs). What's left is doubles for which we have some expectations. These +are called mocks and in Prophecy they look almost exactly the same as stubs, except that +they define *predictions* instead of *promises* on method prophecies: + +```php +$entityManager->flush()->shouldBeCalled(); +``` + +#### Predictions + +The `shouldBeCalled()` method here assigns `CallPrediction` to our method prophecy. +Predictions are a delayed behavior check for your prophecies. You see, during the entire lifetime +of your doubles, Prophecy records every single call you're making against it inside your +code. After that, Prophecy can use this collected information to check if it matches defined +predictions. You can assign predictions to method prophecies using the +`MethodProphecy::should(PredictionInterface $prediction)` method. As a matter of fact, +the `shouldBeCalled()` method we used earlier is just a shortcut to: + +```php +$entityManager->flush()->should(new Prophecy\Prediction\CallPrediction()); +``` + +It checks if your method of interest (that matches both the method name and the arguments wildcard) +was called 1 or more times. If the prediction failed then it throws an exception. When does this +check happen? Whenever you call `checkPredictions()` on the main Prophet object: + +```php +$prophet->checkPredictions(); +``` + +In PHPUnit, you would want to put this call into the `tearDown()` method. If no predictions +are defined, it would do nothing. So it won't harm to call it after every test. + +There are plenty more predictions you can play with: + +- `CallPrediction` or `shouldBeCalled()` - checks that the method has been called 1 or more times +- `NoCallsPrediction` or `shouldNotBeCalled()` - checks that the method has not been called +- `CallTimesPrediction` or `shouldBeCalledTimes($count)` - checks that the method has been called + `$count` times +- `CallbackPrediction` or `should($callback)` - checks the method against your own custom callback + +Of course, you can always create your own custom prediction any time by implementing +`PredictionInterface`. + +### Spies + +The last bit of awesomeness in Prophecy is out-of-the-box spies support. As I said in the previous +section, Prophecy records every call made during the double's entire lifetime. This means +you don't need to record predictions in order to check them. You can also do it +manually by using the `MethodProphecy::shouldHave(PredictionInterface $prediction)` method: + +```php +$em = $prophet->prophesize('Doctrine\ORM\EntityManager'); + +$controller->createUser($em->reveal()); + +$em->flush()->shouldHaveBeenCalled(); +``` + +Such manipulation with doubles is called spying. And with Prophecy it just works. diff --git a/vendor/phpspec/prophecy/composer.json b/vendor/phpspec/prophecy/composer.json new file mode 100644 index 0000000..816f147 --- /dev/null +++ b/vendor/phpspec/prophecy/composer.json @@ -0,0 +1,50 @@ +{ + "name": "phpspec/prophecy", + "description": "Highly opinionated mocking framework for PHP 5.3+", + "keywords": ["Mock", "Stub", "Dummy", "Double", "Fake", "Spy"], + "homepage": "https://github.com/phpspec/prophecy", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + + "require": { + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "doctrine/instantiator": "^1.0.2", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + + "autoload-dev": { + "psr-4": { + "Fixtures\\Prophecy\\": "fixtures" + } + }, + + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument.php b/vendor/phpspec/prophecy/src/Prophecy/Argument.php new file mode 100644 index 0000000..fde6aa9 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument.php @@ -0,0 +1,212 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy; + +use Prophecy\Argument\Token; + +/** + * Argument tokens shortcuts. + * + * @author Konstantin Kudryashov + */ +class Argument +{ + /** + * Checks that argument is exact value or object. + * + * @param mixed $value + * + * @return Token\ExactValueToken + */ + public static function exact($value) + { + return new Token\ExactValueToken($value); + } + + /** + * Checks that argument is of specific type or instance of specific class. + * + * @param string $type Type name (`integer`, `string`) or full class name + * + * @return Token\TypeToken + */ + public static function type($type) + { + return new Token\TypeToken($type); + } + + /** + * Checks that argument object has specific state. + * + * @param string $methodName + * @param mixed $value + * + * @return Token\ObjectStateToken + */ + public static function which($methodName, $value) + { + return new Token\ObjectStateToken($methodName, $value); + } + + /** + * Checks that argument matches provided callback. + * + * @param callable $callback + * + * @return Token\CallbackToken + */ + public static function that($callback) + { + return new Token\CallbackToken($callback); + } + + /** + * Matches any single value. + * + * @return Token\AnyValueToken + */ + public static function any() + { + return new Token\AnyValueToken; + } + + /** + * Matches all values to the rest of the signature. + * + * @return Token\AnyValuesToken + */ + public static function cetera() + { + return new Token\AnyValuesToken; + } + + /** + * Checks that argument matches all tokens + * + * @param mixed ... a list of tokens + * + * @return Token\LogicalAndToken + */ + public static function allOf() + { + return new Token\LogicalAndToken(func_get_args()); + } + + /** + * Checks that argument array or countable object has exact number of elements. + * + * @param integer $value array elements count + * + * @return Token\ArrayCountToken + */ + public static function size($value) + { + return new Token\ArrayCountToken($value); + } + + /** + * Checks that argument array contains (key, value) pair + * + * @param mixed $key exact value or token + * @param mixed $value exact value or token + * + * @return Token\ArrayEntryToken + */ + public static function withEntry($key, $value) + { + return new Token\ArrayEntryToken($key, $value); + } + + /** + * Checks that arguments array entries all match value + * + * @param mixed $value + * + * @return Token\ArrayEveryEntryToken + */ + public static function withEveryEntry($value) + { + return new Token\ArrayEveryEntryToken($value); + } + + /** + * Checks that argument array contains value + * + * @param mixed $value + * + * @return Token\ArrayEntryToken + */ + public static function containing($value) + { + return new Token\ArrayEntryToken(self::any(), $value); + } + + /** + * Checks that argument array has key + * + * @param mixed $key exact value or token + * + * @return Token\ArrayEntryToken + */ + public static function withKey($key) + { + return new Token\ArrayEntryToken($key, self::any()); + } + + /** + * Checks that argument does not match the value|token. + * + * @param mixed $value either exact value or argument token + * + * @return Token\LogicalNotToken + */ + public static function not($value) + { + return new Token\LogicalNotToken($value); + } + + /** + * @param string $value + * + * @return Token\StringContainsToken + */ + public static function containingString($value) + { + return new Token\StringContainsToken($value); + } + + /** + * Checks that argument is identical value. + * + * @param mixed $value + * + * @return Token\IdenticalValueToken + */ + public static function is($value) + { + return new Token\IdenticalValueToken($value); + } + + /** + * Check that argument is same value when rounding to the + * given precision. + * + * @param float $value + * @param float $precision + * + * @return Token\ApproximateValueToken + */ + public static function approximate($value, $precision = 0) + { + return new Token\ApproximateValueToken($value, $precision); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/ArgumentsWildcard.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/ArgumentsWildcard.php new file mode 100644 index 0000000..a088f21 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/ArgumentsWildcard.php @@ -0,0 +1,101 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument; + +/** + * Arguments wildcarding. + * + * @author Konstantin Kudryashov + */ +class ArgumentsWildcard +{ + /** + * @var Token\TokenInterface[] + */ + private $tokens = array(); + private $string; + + /** + * Initializes wildcard. + * + * @param array $arguments Array of argument tokens or values + */ + public function __construct(array $arguments) + { + foreach ($arguments as $argument) { + if (!$argument instanceof Token\TokenInterface) { + $argument = new Token\ExactValueToken($argument); + } + + $this->tokens[] = $argument; + } + } + + /** + * Calculates wildcard match score for provided arguments. + * + * @param array $arguments + * + * @return false|int False OR integer score (higher - better) + */ + public function scoreArguments(array $arguments) + { + if (0 == count($arguments) && 0 == count($this->tokens)) { + return 1; + } + + $arguments = array_values($arguments); + $totalScore = 0; + foreach ($this->tokens as $i => $token) { + $argument = isset($arguments[$i]) ? $arguments[$i] : null; + if (1 >= $score = $token->scoreArgument($argument)) { + return false; + } + + $totalScore += $score; + + if (true === $token->isLast()) { + return $totalScore; + } + } + + if (count($arguments) > count($this->tokens)) { + return false; + } + + return $totalScore; + } + + /** + * Returns string representation for wildcard. + * + * @return string + */ + public function __toString() + { + if (null === $this->string) { + $this->string = implode(', ', array_map(function ($token) { + return (string) $token; + }, $this->tokens)); + } + + return $this->string; + } + + /** + * @return array + */ + public function getTokens() + { + return $this->tokens; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValueToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValueToken.php new file mode 100644 index 0000000..5098811 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValueToken.php @@ -0,0 +1,52 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Any single value token. + * + * @author Konstantin Kudryashov + */ +class AnyValueToken implements TokenInterface +{ + /** + * Always scores 3 for any argument. + * + * @param $argument + * + * @return int + */ + public function scoreArgument($argument) + { + return 3; + } + + /** + * Returns false. + * + * @return bool + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return '*'; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValuesToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValuesToken.php new file mode 100644 index 0000000..f76b17b --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValuesToken.php @@ -0,0 +1,52 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Any values token. + * + * @author Konstantin Kudryashov + */ +class AnyValuesToken implements TokenInterface +{ + /** + * Always scores 2 for any argument. + * + * @param $argument + * + * @return int + */ + public function scoreArgument($argument) + { + return 2; + } + + /** + * Returns true to stop wildcard from processing other tokens. + * + * @return bool + */ + public function isLast() + { + return true; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return '* [, ...]'; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ApproximateValueToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ApproximateValueToken.php new file mode 100644 index 0000000..d4918b1 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ApproximateValueToken.php @@ -0,0 +1,55 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Approximate value token + * + * @author Daniel Leech + */ +class ApproximateValueToken implements TokenInterface +{ + private $value; + private $precision; + + public function __construct($value, $precision = 0) + { + $this->value = $value; + $this->precision = $precision; + } + + /** + * {@inheritdoc} + */ + public function scoreArgument($argument) + { + return round($argument, $this->precision) === round($this->value, $this->precision) ? 10 : false; + } + + /** + * {@inheritdoc} + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('≅%s', round($this->value, $this->precision)); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayCountToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayCountToken.php new file mode 100644 index 0000000..96b4bef --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayCountToken.php @@ -0,0 +1,86 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Array elements count token. + * + * @author Boris Mikhaylov + */ + +class ArrayCountToken implements TokenInterface +{ + private $count; + + /** + * @param integer $value + */ + public function __construct($value) + { + $this->count = $value; + } + + /** + * Scores 6 when argument has preset number of elements. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + return $this->isCountable($argument) && $this->hasProperCount($argument) ? 6 : false; + } + + /** + * Returns false. + * + * @return boolean + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('count(%s)', $this->count); + } + + /** + * Returns true if object is either array or instance of \Countable + * + * @param $argument + * @return bool + */ + private function isCountable($argument) + { + return (is_array($argument) || $argument instanceof \Countable); + } + + /** + * Returns true if $argument has expected number of elements + * + * @param array|\Countable $argument + * + * @return bool + */ + private function hasProperCount($argument) + { + return $this->count === count($argument); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEntryToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEntryToken.php new file mode 100644 index 0000000..0305fc7 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEntryToken.php @@ -0,0 +1,143 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +use Prophecy\Exception\InvalidArgumentException; + +/** + * Array entry token. + * + * @author Boris Mikhaylov + */ +class ArrayEntryToken implements TokenInterface +{ + /** @var \Prophecy\Argument\Token\TokenInterface */ + private $key; + /** @var \Prophecy\Argument\Token\TokenInterface */ + private $value; + + /** + * @param mixed $key exact value or token + * @param mixed $value exact value or token + */ + public function __construct($key, $value) + { + $this->key = $this->wrapIntoExactValueToken($key); + $this->value = $this->wrapIntoExactValueToken($value); + } + + /** + * Scores half of combined scores from key and value tokens for same entry. Capped at 8. + * If argument implements \ArrayAccess without \Traversable, then key token is restricted to ExactValueToken. + * + * @param array|\ArrayAccess|\Traversable $argument + * + * @throws \Prophecy\Exception\InvalidArgumentException + * @return bool|int + */ + public function scoreArgument($argument) + { + if ($argument instanceof \Traversable) { + $argument = iterator_to_array($argument); + } + + if ($argument instanceof \ArrayAccess) { + $argument = $this->convertArrayAccessToEntry($argument); + } + + if (!is_array($argument) || empty($argument)) { + return false; + } + + $keyScores = array_map(array($this->key,'scoreArgument'), array_keys($argument)); + $valueScores = array_map(array($this->value,'scoreArgument'), $argument); + $scoreEntry = function ($value, $key) { + return $value && $key ? min(8, ($key + $value) / 2) : false; + }; + + return max(array_map($scoreEntry, $valueScores, $keyScores)); + } + + /** + * Returns false. + * + * @return boolean + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('[..., %s => %s, ...]', $this->key, $this->value); + } + + /** + * Returns key + * + * @return TokenInterface + */ + public function getKey() + { + return $this->key; + } + + /** + * Returns value + * + * @return TokenInterface + */ + public function getValue() + { + return $this->value; + } + + /** + * Wraps non token $value into ExactValueToken + * + * @param $value + * @return TokenInterface + */ + private function wrapIntoExactValueToken($value) + { + return $value instanceof TokenInterface ? $value : new ExactValueToken($value); + } + + /** + * Converts instance of \ArrayAccess to key => value array entry + * + * @param \ArrayAccess $object + * + * @return array|null + * @throws \Prophecy\Exception\InvalidArgumentException + */ + private function convertArrayAccessToEntry(\ArrayAccess $object) + { + if (!$this->key instanceof ExactValueToken) { + throw new InvalidArgumentException(sprintf( + 'You can only use exact value tokens to match key of ArrayAccess object'.PHP_EOL. + 'But you used `%s`.', + $this->key + )); + } + + $key = $this->key->getValue(); + + return $object->offsetExists($key) ? array($key => $object[$key]) : array(); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEveryEntryToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEveryEntryToken.php new file mode 100644 index 0000000..5d41fa4 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEveryEntryToken.php @@ -0,0 +1,82 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Array every entry token. + * + * @author Adrien Brault + */ +class ArrayEveryEntryToken implements TokenInterface +{ + /** + * @var TokenInterface + */ + private $value; + + /** + * @param mixed $value exact value or token + */ + public function __construct($value) + { + if (!$value instanceof TokenInterface) { + $value = new ExactValueToken($value); + } + + $this->value = $value; + } + + /** + * {@inheritdoc} + */ + public function scoreArgument($argument) + { + if (!$argument instanceof \Traversable && !is_array($argument)) { + return false; + } + + $scores = array(); + foreach ($argument as $key => $argumentEntry) { + $scores[] = $this->value->scoreArgument($argumentEntry); + } + + if (empty($scores) || in_array(false, $scores, true)) { + return false; + } + + return array_sum($scores) / count($scores); + } + + /** + * {@inheritdoc} + */ + public function isLast() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return sprintf('[%s, ..., %s]', $this->value, $this->value); + } + + /** + * @return TokenInterface + */ + public function getValue() + { + return $this->value; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/CallbackToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/CallbackToken.php new file mode 100644 index 0000000..f45ba20 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/CallbackToken.php @@ -0,0 +1,75 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +use Prophecy\Exception\InvalidArgumentException; + +/** + * Callback-verified token. + * + * @author Konstantin Kudryashov + */ +class CallbackToken implements TokenInterface +{ + private $callback; + + /** + * Initializes token. + * + * @param callable $callback + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function __construct($callback) + { + if (!is_callable($callback)) { + throw new InvalidArgumentException(sprintf( + 'Callable expected as an argument to CallbackToken, but got %s.', + gettype($callback) + )); + } + + $this->callback = $callback; + } + + /** + * Scores 7 if callback returns true, false otherwise. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + return call_user_func($this->callback, $argument) ? 7 : false; + } + + /** + * Returns false. + * + * @return bool + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return 'callback()'; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ExactValueToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ExactValueToken.php new file mode 100644 index 0000000..aa960f3 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ExactValueToken.php @@ -0,0 +1,116 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +use SebastianBergmann\Comparator\ComparisonFailure; +use Prophecy\Comparator\Factory as ComparatorFactory; +use Prophecy\Util\StringUtil; + +/** + * Exact value token. + * + * @author Konstantin Kudryashov + */ +class ExactValueToken implements TokenInterface +{ + private $value; + private $string; + private $util; + private $comparatorFactory; + + /** + * Initializes token. + * + * @param mixed $value + * @param StringUtil $util + * @param ComparatorFactory $comparatorFactory + */ + public function __construct($value, StringUtil $util = null, ComparatorFactory $comparatorFactory = null) + { + $this->value = $value; + $this->util = $util ?: new StringUtil(); + + $this->comparatorFactory = $comparatorFactory ?: ComparatorFactory::getInstance(); + } + + /** + * Scores 10 if argument matches preset value. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + if (is_object($argument) && is_object($this->value)) { + $comparator = $this->comparatorFactory->getComparatorFor( + $argument, $this->value + ); + + try { + $comparator->assertEquals($argument, $this->value); + return 10; + } catch (ComparisonFailure $failure) {} + } + + // If either one is an object it should be castable to a string + if (is_object($argument) xor is_object($this->value)) { + if (is_object($argument) && !method_exists($argument, '__toString')) { + return false; + } + + if (is_object($this->value) && !method_exists($this->value, '__toString')) { + return false; + } + } elseif (is_numeric($argument) && is_numeric($this->value)) { + // noop + } elseif (gettype($argument) !== gettype($this->value)) { + return false; + } + + return $argument == $this->value ? 10 : false; + } + + /** + * Returns preset value against which token checks arguments. + * + * @return mixed + */ + public function getValue() + { + return $this->value; + } + + /** + * Returns false. + * + * @return bool + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + if (null === $this->string) { + $this->string = sprintf('exact(%s)', $this->util->stringify($this->value)); + } + + return $this->string; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/IdenticalValueToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/IdenticalValueToken.php new file mode 100644 index 0000000..0b6d23a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/IdenticalValueToken.php @@ -0,0 +1,74 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +use Prophecy\Util\StringUtil; + +/** + * Identical value token. + * + * @author Florian Voutzinos + */ +class IdenticalValueToken implements TokenInterface +{ + private $value; + private $string; + private $util; + + /** + * Initializes token. + * + * @param mixed $value + * @param StringUtil $util + */ + public function __construct($value, StringUtil $util = null) + { + $this->value = $value; + $this->util = $util ?: new StringUtil(); + } + + /** + * Scores 11 if argument matches preset value. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + return $argument === $this->value ? 11 : false; + } + + /** + * Returns false. + * + * @return bool + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + if (null === $this->string) { + $this->string = sprintf('identical(%s)', $this->util->stringify($this->value)); + } + + return $this->string; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalAndToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalAndToken.php new file mode 100644 index 0000000..4ee1b25 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalAndToken.php @@ -0,0 +1,80 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Logical AND token. + * + * @author Boris Mikhaylov + */ +class LogicalAndToken implements TokenInterface +{ + private $tokens = array(); + + /** + * @param array $arguments exact values or tokens + */ + public function __construct(array $arguments) + { + foreach ($arguments as $argument) { + if (!$argument instanceof TokenInterface) { + $argument = new ExactValueToken($argument); + } + $this->tokens[] = $argument; + } + } + + /** + * Scores maximum score from scores returned by tokens for this argument if all of them score. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + if (0 === count($this->tokens)) { + return false; + } + + $maxScore = 0; + foreach ($this->tokens as $token) { + $score = $token->scoreArgument($argument); + if (false === $score) { + return false; + } + $maxScore = max($score, $maxScore); + } + + return $maxScore; + } + + /** + * Returns false. + * + * @return boolean + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('bool(%s)', implode(' AND ', $this->tokens)); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalNotToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalNotToken.php new file mode 100644 index 0000000..623efa5 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalNotToken.php @@ -0,0 +1,73 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Logical NOT token. + * + * @author Boris Mikhaylov + */ +class LogicalNotToken implements TokenInterface +{ + /** @var \Prophecy\Argument\Token\TokenInterface */ + private $token; + + /** + * @param mixed $value exact value or token + */ + public function __construct($value) + { + $this->token = $value instanceof TokenInterface? $value : new ExactValueToken($value); + } + + /** + * Scores 4 when preset token does not match the argument. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + return false === $this->token->scoreArgument($argument) ? 4 : false; + } + + /** + * Returns true if preset token is last. + * + * @return bool|int + */ + public function isLast() + { + return $this->token->isLast(); + } + + /** + * Returns originating token. + * + * @return TokenInterface + */ + public function getOriginatingToken() + { + return $this->token; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('not(%s)', $this->token); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ObjectStateToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ObjectStateToken.php new file mode 100644 index 0000000..d771077 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ObjectStateToken.php @@ -0,0 +1,104 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +use SebastianBergmann\Comparator\ComparisonFailure; +use Prophecy\Comparator\Factory as ComparatorFactory; +use Prophecy\Util\StringUtil; + +/** + * Object state-checker token. + * + * @author Konstantin Kudryashov + */ +class ObjectStateToken implements TokenInterface +{ + private $name; + private $value; + private $util; + private $comparatorFactory; + + /** + * Initializes token. + * + * @param string $methodName + * @param mixed $value Expected return value + * @param null|StringUtil $util + * @param ComparatorFactory $comparatorFactory + */ + public function __construct( + $methodName, + $value, + StringUtil $util = null, + ComparatorFactory $comparatorFactory = null + ) { + $this->name = $methodName; + $this->value = $value; + $this->util = $util ?: new StringUtil; + + $this->comparatorFactory = $comparatorFactory ?: ComparatorFactory::getInstance(); + } + + /** + * Scores 8 if argument is an object, which method returns expected value. + * + * @param mixed $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + if (is_object($argument) && method_exists($argument, $this->name)) { + $actual = call_user_func(array($argument, $this->name)); + + $comparator = $this->comparatorFactory->getComparatorFor( + $this->value, $actual + ); + + try { + $comparator->assertEquals($this->value, $actual); + return 8; + } catch (ComparisonFailure $failure) { + return false; + } + } + + if (is_object($argument) && property_exists($argument, $this->name)) { + return $argument->{$this->name} === $this->value ? 8 : false; + } + + return false; + } + + /** + * Returns false. + * + * @return bool + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('state(%s(), %s)', + $this->name, + $this->util->stringify($this->value) + ); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/StringContainsToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/StringContainsToken.php new file mode 100644 index 0000000..bd8d423 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/StringContainsToken.php @@ -0,0 +1,67 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * String contains token. + * + * @author Peter Mitchell + */ +class StringContainsToken implements TokenInterface +{ + private $value; + + /** + * Initializes token. + * + * @param string $value + */ + public function __construct($value) + { + $this->value = $value; + } + + public function scoreArgument($argument) + { + return is_string($argument) && strpos($argument, $this->value) !== false ? 6 : false; + } + + /** + * Returns preset value against which token checks arguments. + * + * @return mixed + */ + public function getValue() + { + return $this->value; + } + + /** + * Returns false. + * + * @return bool + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('contains("%s")', $this->value); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/TokenInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/TokenInterface.php new file mode 100644 index 0000000..625d3ba --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/TokenInterface.php @@ -0,0 +1,43 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Argument token interface. + * + * @author Konstantin Kudryashov + */ +interface TokenInterface +{ + /** + * Calculates token match score for provided argument. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument); + + /** + * Returns true if this token prevents check of other tokens (is last one). + * + * @return bool|int + */ + public function isLast(); + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString(); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/TypeToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/TypeToken.php new file mode 100644 index 0000000..cb65132 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/TypeToken.php @@ -0,0 +1,76 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +use Prophecy\Exception\InvalidArgumentException; + +/** + * Value type token. + * + * @author Konstantin Kudryashov + */ +class TypeToken implements TokenInterface +{ + private $type; + + /** + * @param string $type + */ + public function __construct($type) + { + $checker = "is_{$type}"; + if (!function_exists($checker) && !interface_exists($type) && !class_exists($type)) { + throw new InvalidArgumentException(sprintf( + 'Type or class name expected as an argument to TypeToken, but got %s.', $type + )); + } + + $this->type = $type; + } + + /** + * Scores 5 if argument has the same type this token was constructed with. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + $checker = "is_{$this->type}"; + if (function_exists($checker)) { + return call_user_func($checker, $argument) ? 5 : false; + } + + return $argument instanceof $this->type ? 5 : false; + } + + /** + * Returns false. + * + * @return bool + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + return sprintf('type(%s)', $this->type); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Call/Call.php b/vendor/phpspec/prophecy/src/Prophecy/Call/Call.php new file mode 100644 index 0000000..2652235 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Call/Call.php @@ -0,0 +1,162 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Call; + +use Exception; +use Prophecy\Argument\ArgumentsWildcard; + +/** + * Call object. + * + * @author Konstantin Kudryashov + */ +class Call +{ + private $methodName; + private $arguments; + private $returnValue; + private $exception; + private $file; + private $line; + private $scores; + + /** + * Initializes call. + * + * @param string $methodName + * @param array $arguments + * @param mixed $returnValue + * @param Exception $exception + * @param null|string $file + * @param null|int $line + */ + public function __construct($methodName, array $arguments, $returnValue, + Exception $exception = null, $file, $line) + { + $this->methodName = $methodName; + $this->arguments = $arguments; + $this->returnValue = $returnValue; + $this->exception = $exception; + $this->scores = new \SplObjectStorage(); + + if ($file) { + $this->file = $file; + $this->line = intval($line); + } + } + + /** + * Returns called method name. + * + * @return string + */ + public function getMethodName() + { + return $this->methodName; + } + + /** + * Returns called method arguments. + * + * @return array + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * Returns called method return value. + * + * @return null|mixed + */ + public function getReturnValue() + { + return $this->returnValue; + } + + /** + * Returns exception that call thrown. + * + * @return null|Exception + */ + public function getException() + { + return $this->exception; + } + + /** + * Returns callee filename. + * + * @return string + */ + public function getFile() + { + return $this->file; + } + + /** + * Returns callee line number. + * + * @return int + */ + public function getLine() + { + return $this->line; + } + + /** + * Returns short notation for callee place. + * + * @return string + */ + public function getCallPlace() + { + if (null === $this->file) { + return 'unknown'; + } + + return sprintf('%s:%d', $this->file, $this->line); + } + + /** + * Adds the wildcard match score for the provided wildcard. + * + * @param ArgumentsWildcard $wildcard + * @param false|int $score + * + * @return $this + */ + public function addScore(ArgumentsWildcard $wildcard, $score) + { + $this->scores[$wildcard] = $score; + + return $this; + } + + /** + * Returns wildcard match score for the provided wildcard. The score is + * calculated if not already done. + * + * @param ArgumentsWildcard $wildcard + * + * @return false|int False OR integer score (higher - better) + */ + public function getScore(ArgumentsWildcard $wildcard) + { + if (isset($this->scores[$wildcard])) { + return $this->scores[$wildcard]; + } + + return $this->scores[$wildcard] = $wildcard->scoreArguments($this->getArguments()); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Call/CallCenter.php b/vendor/phpspec/prophecy/src/Prophecy/Call/CallCenter.php new file mode 100644 index 0000000..bc936c8 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Call/CallCenter.php @@ -0,0 +1,229 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Call; + +use Prophecy\Exception\Prophecy\MethodProphecyException; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Argument\ArgumentsWildcard; +use Prophecy\Util\StringUtil; +use Prophecy\Exception\Call\UnexpectedCallException; + +/** + * Calls receiver & manager. + * + * @author Konstantin Kudryashov + */ +class CallCenter +{ + private $util; + + /** + * @var Call[] + */ + private $recordedCalls = array(); + + /** + * Initializes call center. + * + * @param StringUtil $util + */ + public function __construct(StringUtil $util = null) + { + $this->util = $util ?: new StringUtil; + } + + /** + * Makes and records specific method call for object prophecy. + * + * @param ObjectProphecy $prophecy + * @param string $methodName + * @param array $arguments + * + * @return mixed Returns null if no promise for prophecy found or promise return value. + * + * @throws \Prophecy\Exception\Call\UnexpectedCallException If no appropriate method prophecy found + */ + public function makeCall(ObjectProphecy $prophecy, $methodName, array $arguments) + { + // For efficiency exclude 'args' from the generated backtrace + if (PHP_VERSION_ID >= 50400) { + // Limit backtrace to last 3 calls as we don't use the rest + // Limit argument was introduced in PHP 5.4.0 + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); + } elseif (defined('DEBUG_BACKTRACE_IGNORE_ARGS')) { + // DEBUG_BACKTRACE_IGNORE_ARGS was introduced in PHP 5.3.6 + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + } else { + $backtrace = debug_backtrace(); + } + + $file = $line = null; + if (isset($backtrace[2]) && isset($backtrace[2]['file'])) { + $file = $backtrace[2]['file']; + $line = $backtrace[2]['line']; + } + + // If no method prophecies defined, then it's a dummy, so we'll just return null + if ('__destruct' === $methodName || 0 == count($prophecy->getMethodProphecies())) { + $this->recordedCalls[] = new Call($methodName, $arguments, null, null, $file, $line); + + return null; + } + + // There are method prophecies, so it's a fake/stub. Searching prophecy for this call + $matches = array(); + foreach ($prophecy->getMethodProphecies($methodName) as $methodProphecy) { + if (0 < $score = $methodProphecy->getArgumentsWildcard()->scoreArguments($arguments)) { + $matches[] = array($score, $methodProphecy); + } + } + + // If fake/stub doesn't have method prophecy for this call - throw exception + if (!count($matches)) { + throw $this->createUnexpectedCallException($prophecy, $methodName, $arguments); + } + + // Sort matches by their score value + @usort($matches, function ($match1, $match2) { return $match2[0] - $match1[0]; }); + + $score = $matches[0][0]; + // If Highest rated method prophecy has a promise - execute it or return null instead + $methodProphecy = $matches[0][1]; + $returnValue = null; + $exception = null; + if ($promise = $methodProphecy->getPromise()) { + try { + $returnValue = $promise->execute($arguments, $prophecy, $methodProphecy); + } catch (\Exception $e) { + $exception = $e; + } + } + + if ($methodProphecy->hasReturnVoid() && $returnValue !== null) { + throw new MethodProphecyException( + "The method \"$methodName\" has a void return type, but the promise returned a value", + $methodProphecy + ); + } + + $this->recordedCalls[] = $call = new Call( + $methodName, $arguments, $returnValue, $exception, $file, $line + ); + $call->addScore($methodProphecy->getArgumentsWildcard(), $score); + + if (null !== $exception) { + throw $exception; + } + + return $returnValue; + } + + /** + * Searches for calls by method name & arguments wildcard. + * + * @param string $methodName + * @param ArgumentsWildcard $wildcard + * + * @return Call[] + */ + public function findCalls($methodName, ArgumentsWildcard $wildcard) + { + return array_values( + array_filter($this->recordedCalls, function (Call $call) use ($methodName, $wildcard) { + return $methodName === $call->getMethodName() + && 0 < $call->getScore($wildcard) + ; + }) + ); + } + + private function createUnexpectedCallException(ObjectProphecy $prophecy, $methodName, + array $arguments) + { + $classname = get_class($prophecy->reveal()); + $indentationLength = 8; // looks good + $argstring = implode( + ",\n", + $this->indentArguments( + array_map(array($this->util, 'stringify'), $arguments), + $indentationLength + ) + ); + + $expected = array(); + + foreach (call_user_func_array('array_merge', $prophecy->getMethodProphecies()) as $methodProphecy) { + $expected[] = sprintf( + " - %s(\n" . + "%s\n" . + " )", + $methodProphecy->getMethodName(), + implode( + ",\n", + $this->indentArguments( + array_map('strval', $methodProphecy->getArgumentsWildcard()->getTokens()), + $indentationLength + ) + ) + ); + } + + return new UnexpectedCallException( + sprintf( + "Unexpected method call on %s:\n". + " - %s(\n". + "%s\n". + " )\n". + "expected calls were:\n". + "%s", + + $classname, $methodName, $argstring, implode("\n", $expected) + ), + $prophecy, $methodName, $arguments + + ); + } + + private function formatExceptionMessage(MethodProphecy $methodProphecy) + { + return sprintf( + " - %s(\n". + "%s\n". + " )", + $methodProphecy->getMethodName(), + implode( + ",\n", + $this->indentArguments( + array_map( + function ($token) { + return (string) $token; + }, + $methodProphecy->getArgumentsWildcard()->getTokens() + ), + $indentationLength + ) + ) + ); + } + + private function indentArguments(array $arguments, $indentationLength) + { + return preg_replace_callback( + '/^/m', + function () use ($indentationLength) { + return str_repeat(' ', $indentationLength); + }, + $arguments + ); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Comparator/ClosureComparator.php b/vendor/phpspec/prophecy/src/Prophecy/Comparator/ClosureComparator.php new file mode 100644 index 0000000..874e474 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Comparator/ClosureComparator.php @@ -0,0 +1,42 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Comparator; + +use SebastianBergmann\Comparator\Comparator; +use SebastianBergmann\Comparator\ComparisonFailure; + +/** + * Closure comparator. + * + * @author Konstantin Kudryashov + */ +final class ClosureComparator extends Comparator +{ + public function accepts($expected, $actual) + { + return is_object($expected) && $expected instanceof \Closure + && is_object($actual) && $actual instanceof \Closure; + } + + public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = false, $ignoreCase = false) + { + throw new ComparisonFailure( + $expected, + $actual, + // we don't need a diff + '', + '', + false, + 'all closures are born different' + ); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Comparator/Factory.php b/vendor/phpspec/prophecy/src/Prophecy/Comparator/Factory.php new file mode 100644 index 0000000..2070db1 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Comparator/Factory.php @@ -0,0 +1,47 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Comparator; + +use SebastianBergmann\Comparator\Factory as BaseFactory; + +/** + * Prophecy comparator factory. + * + * @author Konstantin Kudryashov + */ +final class Factory extends BaseFactory +{ + /** + * @var Factory + */ + private static $instance; + + public function __construct() + { + parent::__construct(); + + $this->register(new ClosureComparator()); + $this->register(new ProphecyComparator()); + } + + /** + * @return Factory + */ + public static function getInstance() + { + if (self::$instance === null) { + self::$instance = new Factory; + } + + return self::$instance; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Comparator/ProphecyComparator.php b/vendor/phpspec/prophecy/src/Prophecy/Comparator/ProphecyComparator.php new file mode 100644 index 0000000..298a8e3 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Comparator/ProphecyComparator.php @@ -0,0 +1,28 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Comparator; + +use Prophecy\Prophecy\ProphecyInterface; +use SebastianBergmann\Comparator\ObjectComparator; + +class ProphecyComparator extends ObjectComparator +{ + public function accepts($expected, $actual) + { + return is_object($expected) && is_object($actual) && $actual instanceof ProphecyInterface; + } + + public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = false, $ignoreCase = false, array &$processed = array()) + { + parent::assertEquals($expected, $actual->reveal(), $delta, $canonicalize, $ignoreCase, $processed); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/CachedDoubler.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/CachedDoubler.php new file mode 100644 index 0000000..d6b6b1a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/CachedDoubler.php @@ -0,0 +1,68 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler; + +use ReflectionClass; + +/** + * Cached class doubler. + * Prevents mirroring/creation of the same structure twice. + * + * @author Konstantin Kudryashov + */ +class CachedDoubler extends Doubler +{ + private $classes = array(); + + /** + * {@inheritdoc} + */ + public function registerClassPatch(ClassPatch\ClassPatchInterface $patch) + { + $this->classes[] = array(); + + parent::registerClassPatch($patch); + } + + /** + * {@inheritdoc} + */ + protected function createDoubleClass(ReflectionClass $class = null, array $interfaces) + { + $classId = $this->generateClassId($class, $interfaces); + if (isset($this->classes[$classId])) { + return $this->classes[$classId]; + } + + return $this->classes[$classId] = parent::createDoubleClass($class, $interfaces); + } + + /** + * @param ReflectionClass $class + * @param ReflectionClass[] $interfaces + * + * @return string + */ + private function generateClassId(ReflectionClass $class = null, array $interfaces) + { + $parts = array(); + if (null !== $class) { + $parts[] = $class->getName(); + } + foreach ($interfaces as $interface) { + $parts[] = $interface->getName(); + } + sort($parts); + + return md5(implode('', $parts)); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ClassPatchInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ClassPatchInterface.php new file mode 100644 index 0000000..d6d1968 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ClassPatchInterface.php @@ -0,0 +1,48 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; + +/** + * Class patch interface. + * Class patches extend doubles functionality or help + * Prophecy to avoid some internal PHP bugs. + * + * @author Konstantin Kudryashov + */ +interface ClassPatchInterface +{ + /** + * Checks if patch supports specific class node. + * + * @param ClassNode $node + * + * @return bool + */ + public function supports(ClassNode $node); + + /** + * Applies patch to the specific class node. + * + * @param ClassNode $node + * @return void + */ + public function apply(ClassNode $node); + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return int Priority number (higher - earlier) + */ + public function getPriority(); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/DisableConstructorPatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/DisableConstructorPatch.php new file mode 100644 index 0000000..61998fc --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/DisableConstructorPatch.php @@ -0,0 +1,72 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; +use Prophecy\Doubler\Generator\Node\MethodNode; + +/** + * Disable constructor. + * Makes all constructor arguments optional. + * + * @author Konstantin Kudryashov + */ +class DisableConstructorPatch implements ClassPatchInterface +{ + /** + * Checks if class has `__construct` method. + * + * @param ClassNode $node + * + * @return bool + */ + public function supports(ClassNode $node) + { + return true; + } + + /** + * Makes all class constructor arguments optional. + * + * @param ClassNode $node + */ + public function apply(ClassNode $node) + { + if (!$node->hasMethod('__construct')) { + $node->addMethod(new MethodNode('__construct', '')); + + return; + } + + $constructor = $node->getMethod('__construct'); + foreach ($constructor->getArguments() as $argument) { + $argument->setDefault(null); + } + + $constructor->setCode(<< + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; + +/** + * Exception patch for HHVM to remove the stubs from special methods + * + * @author Christophe Coevoet + */ +class HhvmExceptionPatch implements ClassPatchInterface +{ + /** + * Supports exceptions on HHVM. + * + * @param ClassNode $node + * + * @return bool + */ + public function supports(ClassNode $node) + { + if (!defined('HHVM_VERSION')) { + return false; + } + + return 'Exception' === $node->getParentClass() || is_subclass_of($node->getParentClass(), 'Exception'); + } + + /** + * Removes special exception static methods from the doubled methods. + * + * @param ClassNode $node + * + * @return void + */ + public function apply(ClassNode $node) + { + if ($node->hasMethod('setTraceOptions')) { + $node->getMethod('setTraceOptions')->useParentCode(); + } + if ($node->hasMethod('getTraceOptions')) { + $node->getMethod('getTraceOptions')->useParentCode(); + } + } + + /** + * {@inheritdoc} + */ + public function getPriority() + { + return -50; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/KeywordPatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/KeywordPatch.php new file mode 100644 index 0000000..41ea2fc --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/KeywordPatch.php @@ -0,0 +1,140 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; + +/** + * Remove method functionality from the double which will clash with php keywords. + * + * @author Milan Magudia + */ +class KeywordPatch implements ClassPatchInterface +{ + /** + * Support any class + * + * @param ClassNode $node + * + * @return boolean + */ + public function supports(ClassNode $node) + { + return true; + } + + /** + * Remove methods that clash with php keywords + * + * @param ClassNode $node + */ + public function apply(ClassNode $node) + { + $methodNames = array_keys($node->getMethods()); + $methodsToRemove = array_intersect($methodNames, $this->getKeywords()); + foreach ($methodsToRemove as $methodName) { + $node->removeMethod($methodName); + } + } + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return int Priority number (higher - earlier) + */ + public function getPriority() + { + return 49; + } + + /** + * Returns array of php keywords. + * + * @return array + */ + private function getKeywords() + { + if (\PHP_VERSION_ID >= 70000) { + return array('__halt_compiler'); + } + + return array( + '__halt_compiler', + 'abstract', + 'and', + 'array', + 'as', + 'break', + 'callable', + 'case', + 'catch', + 'class', + 'clone', + 'const', + 'continue', + 'declare', + 'default', + 'die', + 'do', + 'echo', + 'else', + 'elseif', + 'empty', + 'enddeclare', + 'endfor', + 'endforeach', + 'endif', + 'endswitch', + 'endwhile', + 'eval', + 'exit', + 'extends', + 'final', + 'finally', + 'for', + 'foreach', + 'function', + 'global', + 'goto', + 'if', + 'implements', + 'include', + 'include_once', + 'instanceof', + 'insteadof', + 'interface', + 'isset', + 'list', + 'namespace', + 'new', + 'or', + 'print', + 'private', + 'protected', + 'public', + 'require', + 'require_once', + 'return', + 'static', + 'switch', + 'throw', + 'trait', + 'try', + 'unset', + 'use', + 'var', + 'while', + 'xor', + 'yield', + ); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php new file mode 100644 index 0000000..9ff49cd --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/MagicCallPatch.php @@ -0,0 +1,94 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; +use Prophecy\Doubler\Generator\Node\MethodNode; +use Prophecy\PhpDocumentor\ClassAndInterfaceTagRetriever; +use Prophecy\PhpDocumentor\MethodTagRetrieverInterface; + +/** + * Discover Magical API using "@method" PHPDoc format. + * + * @author Thomas Tourlourat + * @author Kévin Dunglas + * @author Théo FIDRY + */ +class MagicCallPatch implements ClassPatchInterface +{ + private $tagRetriever; + + public function __construct(MethodTagRetrieverInterface $tagRetriever = null) + { + $this->tagRetriever = null === $tagRetriever ? new ClassAndInterfaceTagRetriever() : $tagRetriever; + } + + /** + * Support any class + * + * @param ClassNode $node + * + * @return boolean + */ + public function supports(ClassNode $node) + { + return true; + } + + /** + * Discover Magical API + * + * @param ClassNode $node + */ + public function apply(ClassNode $node) + { + $types = array_filter($node->getInterfaces(), function ($interface) { + return 0 !== strpos($interface, 'Prophecy\\'); + }); + $types[] = $node->getParentClass(); + + foreach ($types as $type) { + $reflectionClass = new \ReflectionClass($type); + + while ($reflectionClass) { + $tagList = $this->tagRetriever->getTagList($reflectionClass); + + foreach ($tagList as $tag) { + $methodName = $tag->getMethodName(); + + if (empty($methodName)) { + continue; + } + + if (!$reflectionClass->hasMethod($methodName)) { + $methodNode = new MethodNode($methodName); + $methodNode->setStatic($tag->isStatic()); + $node->addMethod($methodNode); + } + } + + $reflectionClass = $reflectionClass->getParentClass(); + } + } + } + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return integer Priority number (higher - earlier) + */ + public function getPriority() + { + return 50; + } +} + diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ProphecySubjectPatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ProphecySubjectPatch.php new file mode 100644 index 0000000..081dea8 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ProphecySubjectPatch.php @@ -0,0 +1,104 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; +use Prophecy\Doubler\Generator\Node\MethodNode; +use Prophecy\Doubler\Generator\Node\ArgumentNode; + +/** + * Add Prophecy functionality to the double. + * This is a core class patch for Prophecy. + * + * @author Konstantin Kudryashov + */ +class ProphecySubjectPatch implements ClassPatchInterface +{ + /** + * Always returns true. + * + * @param ClassNode $node + * + * @return bool + */ + public function supports(ClassNode $node) + { + return true; + } + + /** + * Apply Prophecy functionality to class node. + * + * @param ClassNode $node + */ + public function apply(ClassNode $node) + { + $node->addInterface('Prophecy\Prophecy\ProphecySubjectInterface'); + $node->addProperty('objectProphecy', 'private'); + + foreach ($node->getMethods() as $name => $method) { + if ('__construct' === strtolower($name)) { + continue; + } + + if ($method->getReturnType() === 'void') { + $method->setCode( + '$this->getProphecy()->makeProphecyMethodCall(__FUNCTION__, func_get_args());' + ); + } else { + $method->setCode( + 'return $this->getProphecy()->makeProphecyMethodCall(__FUNCTION__, func_get_args());' + ); + } + } + + $prophecySetter = new MethodNode('setProphecy'); + $prophecyArgument = new ArgumentNode('prophecy'); + $prophecyArgument->setTypeHint('Prophecy\Prophecy\ProphecyInterface'); + $prophecySetter->addArgument($prophecyArgument); + $prophecySetter->setCode('$this->objectProphecy = $prophecy;'); + + $prophecyGetter = new MethodNode('getProphecy'); + $prophecyGetter->setCode('return $this->objectProphecy;'); + + if ($node->hasMethod('__call')) { + $__call = $node->getMethod('__call'); + } else { + $__call = new MethodNode('__call'); + $__call->addArgument(new ArgumentNode('name')); + $__call->addArgument(new ArgumentNode('arguments')); + + $node->addMethod($__call, true); + } + + $__call->setCode(<<getProphecy(), func_get_arg(0) +); +PHP + ); + + $node->addMethod($prophecySetter, true); + $node->addMethod($prophecyGetter, true); + } + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return int Priority number (higher - earlier) + */ + public function getPriority() + { + return 0; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatch.php new file mode 100644 index 0000000..9166aee --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ReflectionClassNewInstancePatch.php @@ -0,0 +1,57 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; + +/** + * ReflectionClass::newInstance patch. + * Makes first argument of newInstance optional, since it works but signature is misleading + * + * @author Florian Klein + */ +class ReflectionClassNewInstancePatch implements ClassPatchInterface +{ + /** + * Supports ReflectionClass + * + * @param ClassNode $node + * + * @return bool + */ + public function supports(ClassNode $node) + { + return 'ReflectionClass' === $node->getParentClass(); + } + + /** + * Updates newInstance's first argument to make it optional + * + * @param ClassNode $node + */ + public function apply(ClassNode $node) + { + foreach ($node->getMethod('newInstance')->getArguments() as $argument) { + $argument->setDefault(null); + } + } + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return int Priority number (higher = earlier) + */ + public function getPriority() + { + return 50; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/SplFileInfoPatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/SplFileInfoPatch.php new file mode 100644 index 0000000..ceee94a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/SplFileInfoPatch.php @@ -0,0 +1,123 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; +use Prophecy\Doubler\Generator\Node\MethodNode; + +/** + * SplFileInfo patch. + * Makes SplFileInfo and derivative classes usable with Prophecy. + * + * @author Konstantin Kudryashov + */ +class SplFileInfoPatch implements ClassPatchInterface +{ + /** + * Supports everything that extends SplFileInfo. + * + * @param ClassNode $node + * + * @return bool + */ + public function supports(ClassNode $node) + { + if (null === $node->getParentClass()) { + return false; + } + return 'SplFileInfo' === $node->getParentClass() + || is_subclass_of($node->getParentClass(), 'SplFileInfo') + ; + } + + /** + * Updated constructor code to call parent one with dummy file argument. + * + * @param ClassNode $node + */ + public function apply(ClassNode $node) + { + if ($node->hasMethod('__construct')) { + $constructor = $node->getMethod('__construct'); + } else { + $constructor = new MethodNode('__construct'); + $node->addMethod($constructor); + } + + if ($this->nodeIsDirectoryIterator($node)) { + $constructor->setCode('return parent::__construct("' . __DIR__ . '");'); + + return; + } + + if ($this->nodeIsSplFileObject($node)) { + $filePath = str_replace('\\','\\\\',__FILE__); + $constructor->setCode('return parent::__construct("' . $filePath .'");'); + + return; + } + + if ($this->nodeIsSymfonySplFileInfo($node)) { + $filePath = str_replace('\\','\\\\',__FILE__); + $constructor->setCode('return parent::__construct("' . $filePath .'", "", "");'); + + return; + } + + $constructor->useParentCode(); + } + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return int Priority number (higher - earlier) + */ + public function getPriority() + { + return 50; + } + + /** + * @param ClassNode $node + * @return boolean + */ + private function nodeIsDirectoryIterator(ClassNode $node) + { + $parent = $node->getParentClass(); + + return 'DirectoryIterator' === $parent + || is_subclass_of($parent, 'DirectoryIterator'); + } + + /** + * @param ClassNode $node + * @return boolean + */ + private function nodeIsSplFileObject(ClassNode $node) + { + $parent = $node->getParentClass(); + + return 'SplFileObject' === $parent + || is_subclass_of($parent, 'SplFileObject'); + } + + /** + * @param ClassNode $node + * @return boolean + */ + private function nodeIsSymfonySplFileInfo(ClassNode $node) + { + $parent = $node->getParentClass(); + + return 'Symfony\\Component\\Finder\\SplFileInfo' === $parent; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ThrowablePatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ThrowablePatch.php new file mode 100644 index 0000000..b98e943 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/ThrowablePatch.php @@ -0,0 +1,95 @@ +implementsAThrowableInterface($node) && $this->doesNotExtendAThrowableClass($node); + } + + /** + * @param ClassNode $node + * @return bool + */ + private function implementsAThrowableInterface(ClassNode $node) + { + foreach ($node->getInterfaces() as $type) { + if (is_a($type, 'Throwable', true)) { + return true; + } + } + + return false; + } + + /** + * @param ClassNode $node + * @return bool + */ + private function doesNotExtendAThrowableClass(ClassNode $node) + { + return !is_a($node->getParentClass(), 'Throwable', true); + } + + /** + * Applies patch to the specific class node. + * + * @param ClassNode $node + * + * @return void + */ + public function apply(ClassNode $node) + { + $this->checkItCanBeDoubled($node); + $this->setParentClassToException($node); + } + + private function checkItCanBeDoubled(ClassNode $node) + { + $className = $node->getParentClass(); + if ($className !== 'stdClass') { + throw new ClassCreatorException( + sprintf( + 'Cannot double concrete class %s as well as implement Traversable', + $className + ), + $node + ); + } + } + + private function setParentClassToException(ClassNode $node) + { + $node->setParentClass('Exception'); + + $node->removeMethod('getMessage'); + $node->removeMethod('getCode'); + $node->removeMethod('getFile'); + $node->removeMethod('getLine'); + $node->removeMethod('getTrace'); + $node->removeMethod('getPrevious'); + $node->removeMethod('getNext'); + $node->removeMethod('getTraceAsString'); + } + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return int Priority number (higher - earlier) + */ + public function getPriority() + { + return 100; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/TraversablePatch.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/TraversablePatch.php new file mode 100644 index 0000000..eea0202 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/ClassPatch/TraversablePatch.php @@ -0,0 +1,83 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\ClassPatch; + +use Prophecy\Doubler\Generator\Node\ClassNode; +use Prophecy\Doubler\Generator\Node\MethodNode; + +/** + * Traversable interface patch. + * Forces classes that implement interfaces, that extend Traversable to also implement Iterator. + * + * @author Konstantin Kudryashov + */ +class TraversablePatch implements ClassPatchInterface +{ + /** + * Supports nodetree, that implement Traversable, but not Iterator or IteratorAggregate. + * + * @param ClassNode $node + * + * @return bool + */ + public function supports(ClassNode $node) + { + if (in_array('Iterator', $node->getInterfaces())) { + return false; + } + if (in_array('IteratorAggregate', $node->getInterfaces())) { + return false; + } + + foreach ($node->getInterfaces() as $interface) { + if ('Traversable' !== $interface && !is_subclass_of($interface, 'Traversable')) { + continue; + } + if ('Iterator' === $interface || is_subclass_of($interface, 'Iterator')) { + continue; + } + if ('IteratorAggregate' === $interface || is_subclass_of($interface, 'IteratorAggregate')) { + continue; + } + + return true; + } + + return false; + } + + /** + * Forces class to implement Iterator interface. + * + * @param ClassNode $node + */ + public function apply(ClassNode $node) + { + $node->addInterface('Iterator'); + + $node->addMethod(new MethodNode('current')); + $node->addMethod(new MethodNode('key')); + $node->addMethod(new MethodNode('next')); + $node->addMethod(new MethodNode('rewind')); + $node->addMethod(new MethodNode('valid')); + } + + /** + * Returns patch priority, which determines when patch will be applied. + * + * @return int Priority number (higher - earlier) + */ + public function getPriority() + { + return 100; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/DoubleInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/DoubleInterface.php new file mode 100644 index 0000000..699be3a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/DoubleInterface.php @@ -0,0 +1,22 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler; + +/** + * Core double interface. + * All doubled classes will implement this one. + * + * @author Konstantin Kudryashov + */ +interface DoubleInterface +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Doubler.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Doubler.php new file mode 100644 index 0000000..a378ae2 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Doubler.php @@ -0,0 +1,146 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler; + +use Doctrine\Instantiator\Instantiator; +use Prophecy\Doubler\ClassPatch\ClassPatchInterface; +use Prophecy\Doubler\Generator\ClassMirror; +use Prophecy\Doubler\Generator\ClassCreator; +use Prophecy\Exception\InvalidArgumentException; +use ReflectionClass; + +/** + * Cached class doubler. + * Prevents mirroring/creation of the same structure twice. + * + * @author Konstantin Kudryashov + */ +class Doubler +{ + private $mirror; + private $creator; + private $namer; + + /** + * @var ClassPatchInterface[] + */ + private $patches = array(); + + /** + * @var \Doctrine\Instantiator\Instantiator + */ + private $instantiator; + + /** + * Initializes doubler. + * + * @param ClassMirror $mirror + * @param ClassCreator $creator + * @param NameGenerator $namer + */ + public function __construct(ClassMirror $mirror = null, ClassCreator $creator = null, + NameGenerator $namer = null) + { + $this->mirror = $mirror ?: new ClassMirror; + $this->creator = $creator ?: new ClassCreator; + $this->namer = $namer ?: new NameGenerator; + } + + /** + * Returns list of registered class patches. + * + * @return ClassPatchInterface[] + */ + public function getClassPatches() + { + return $this->patches; + } + + /** + * Registers new class patch. + * + * @param ClassPatchInterface $patch + */ + public function registerClassPatch(ClassPatchInterface $patch) + { + $this->patches[] = $patch; + + @usort($this->patches, function (ClassPatchInterface $patch1, ClassPatchInterface $patch2) { + return $patch2->getPriority() - $patch1->getPriority(); + }); + } + + /** + * Creates double from specific class or/and list of interfaces. + * + * @param ReflectionClass $class + * @param ReflectionClass[] $interfaces Array of ReflectionClass instances + * @param array $args Constructor arguments + * + * @return DoubleInterface + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function double(ReflectionClass $class = null, array $interfaces, array $args = null) + { + foreach ($interfaces as $interface) { + if (!$interface instanceof ReflectionClass) { + throw new InvalidArgumentException(sprintf( + "[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n". + "a second argument to `Doubler::double(...)`, but got %s.", + is_object($interface) ? get_class($interface).' class' : gettype($interface) + )); + } + } + + $classname = $this->createDoubleClass($class, $interfaces); + $reflection = new ReflectionClass($classname); + + if (null !== $args) { + return $reflection->newInstanceArgs($args); + } + if ((null === $constructor = $reflection->getConstructor()) + || ($constructor->isPublic() && !$constructor->isFinal())) { + return $reflection->newInstance(); + } + + if (!$this->instantiator) { + $this->instantiator = new Instantiator(); + } + + return $this->instantiator->instantiate($classname); + } + + /** + * Creates double class and returns its FQN. + * + * @param ReflectionClass $class + * @param ReflectionClass[] $interfaces + * + * @return string + */ + protected function createDoubleClass(ReflectionClass $class = null, array $interfaces) + { + $name = $this->namer->name($class, $interfaces); + $node = $this->mirror->reflect($class, $interfaces); + + foreach ($this->patches as $patch) { + if ($patch->supports($node)) { + $patch->apply($node); + } + } + + $this->creator->create($name, $node); + + return $name; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCodeGenerator.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCodeGenerator.php new file mode 100644 index 0000000..891faa8 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCodeGenerator.php @@ -0,0 +1,129 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\Generator; + +/** + * Class code creator. + * Generates PHP code for specific class node tree. + * + * @author Konstantin Kudryashov + */ +class ClassCodeGenerator +{ + /** + * @var TypeHintReference + */ + private $typeHintReference; + + public function __construct(TypeHintReference $typeHintReference = null) + { + $this->typeHintReference = $typeHintReference ?: new TypeHintReference(); + } + + /** + * Generates PHP code for class node. + * + * @param string $classname + * @param Node\ClassNode $class + * + * @return string + */ + public function generate($classname, Node\ClassNode $class) + { + $parts = explode('\\', $classname); + $classname = array_pop($parts); + $namespace = implode('\\', $parts); + + $code = sprintf("class %s extends \%s implements %s {\n", + $classname, $class->getParentClass(), implode(', ', + array_map(function ($interface) {return '\\'.$interface;}, $class->getInterfaces()) + ) + ); + + foreach ($class->getProperties() as $name => $visibility) { + $code .= sprintf("%s \$%s;\n", $visibility, $name); + } + $code .= "\n"; + + foreach ($class->getMethods() as $method) { + $code .= $this->generateMethod($method)."\n"; + } + $code .= "\n}"; + + return sprintf("namespace %s {\n%s\n}", $namespace, $code); + } + + private function generateMethod(Node\MethodNode $method) + { + $php = sprintf("%s %s function %s%s(%s)%s {\n", + $method->getVisibility(), + $method->isStatic() ? 'static' : '', + $method->returnsReference() ? '&':'', + $method->getName(), + implode(', ', $this->generateArguments($method->getArguments())), + $this->getReturnType($method) + ); + $php .= $method->getCode()."\n"; + + return $php.'}'; + } + + /** + * @return string + */ + private function getReturnType(Node\MethodNode $method) + { + if (version_compare(PHP_VERSION, '7.1', '>=')) { + if ($method->hasReturnType()) { + return $method->hasNullableReturnType() + ? sprintf(': ?%s', $method->getReturnType()) + : sprintf(': %s', $method->getReturnType()); + } + } + + if (version_compare(PHP_VERSION, '7.0', '>=')) { + return $method->hasReturnType() && $method->getReturnType() !== 'void' + ? sprintf(': %s', $method->getReturnType()) + : ''; + } + + return ''; + } + + private function generateArguments(array $arguments) + { + $typeHintReference = $this->typeHintReference; + return array_map(function (Node\ArgumentNode $argument) use ($typeHintReference) { + $php = ''; + + if (version_compare(PHP_VERSION, '7.1', '>=')) { + $php .= $argument->isNullable() ? '?' : ''; + } + + if ($hint = $argument->getTypeHint()) { + $php .= $typeHintReference->isBuiltInParamTypeHint($hint) ? $hint : '\\'.$hint; + } + + $php .= ' '.($argument->isPassedByReference() ? '&' : ''); + + $php .= $argument->isVariadic() ? '...' : ''; + + $php .= '$'.$argument->getName(); + + if ($argument->isOptional() && !$argument->isVariadic()) { + $php .= ' = '.var_export($argument->getDefault(), true); + } + + return $php; + }, $arguments); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php new file mode 100644 index 0000000..882a4a4 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php @@ -0,0 +1,67 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\Generator; + +use Prophecy\Exception\Doubler\ClassCreatorException; + +/** + * Class creator. + * Creates specific class in current environment. + * + * @author Konstantin Kudryashov + */ +class ClassCreator +{ + private $generator; + + /** + * Initializes creator. + * + * @param ClassCodeGenerator $generator + */ + public function __construct(ClassCodeGenerator $generator = null) + { + $this->generator = $generator ?: new ClassCodeGenerator; + } + + /** + * Creates class. + * + * @param string $classname + * @param Node\ClassNode $class + * + * @return mixed + * + * @throws \Prophecy\Exception\Doubler\ClassCreatorException + */ + public function create($classname, Node\ClassNode $class) + { + $code = $this->generator->generate($classname, $class); + $return = eval($code); + + if (!class_exists($classname, false)) { + if (count($class->getInterfaces())) { + throw new ClassCreatorException(sprintf( + 'Could not double `%s` and implement interfaces: [%s].', + $class->getParentClass(), implode(', ', $class->getInterfaces()) + ), $class); + } + + throw new ClassCreatorException( + sprintf('Could not double `%s`.', $class->getParentClass()), + $class + ); + } + + return $return; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassMirror.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassMirror.php new file mode 100644 index 0000000..c5f9a5c --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassMirror.php @@ -0,0 +1,260 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\Generator; + +use Prophecy\Exception\InvalidArgumentException; +use Prophecy\Exception\Doubler\ClassMirrorException; +use ReflectionClass; +use ReflectionMethod; +use ReflectionParameter; + +/** + * Class mirror. + * Core doubler class. Mirrors specific class and/or interfaces into class node tree. + * + * @author Konstantin Kudryashov + */ +class ClassMirror +{ + private static $reflectableMethods = array( + '__construct', + '__destruct', + '__sleep', + '__wakeup', + '__toString', + '__call', + '__invoke' + ); + + /** + * Reflects provided arguments into class node. + * + * @param ReflectionClass $class + * @param ReflectionClass[] $interfaces + * + * @return Node\ClassNode + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function reflect(ReflectionClass $class = null, array $interfaces) + { + $node = new Node\ClassNode; + + if (null !== $class) { + if (true === $class->isInterface()) { + throw new InvalidArgumentException(sprintf( + "Could not reflect %s as a class, because it\n". + "is interface - use the second argument instead.", + $class->getName() + )); + } + + $this->reflectClassToNode($class, $node); + } + + foreach ($interfaces as $interface) { + if (!$interface instanceof ReflectionClass) { + throw new InvalidArgumentException(sprintf( + "[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n". + "a second argument to `ClassMirror::reflect(...)`, but got %s.", + is_object($interface) ? get_class($interface).' class' : gettype($interface) + )); + } + if (false === $interface->isInterface()) { + throw new InvalidArgumentException(sprintf( + "Could not reflect %s as an interface, because it\n". + "is class - use the first argument instead.", + $interface->getName() + )); + } + + $this->reflectInterfaceToNode($interface, $node); + } + + $node->addInterface('Prophecy\Doubler\Generator\ReflectionInterface'); + + return $node; + } + + private function reflectClassToNode(ReflectionClass $class, Node\ClassNode $node) + { + if (true === $class->isFinal()) { + throw new ClassMirrorException(sprintf( + 'Could not reflect class %s as it is marked final.', $class->getName() + ), $class); + } + + $node->setParentClass($class->getName()); + + foreach ($class->getMethods(ReflectionMethod::IS_ABSTRACT) as $method) { + if (false === $method->isProtected()) { + continue; + } + + $this->reflectMethodToNode($method, $node); + } + + foreach ($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { + if (0 === strpos($method->getName(), '_') + && !in_array($method->getName(), self::$reflectableMethods)) { + continue; + } + + if (true === $method->isFinal()) { + $node->addUnextendableMethod($method->getName()); + continue; + } + + $this->reflectMethodToNode($method, $node); + } + } + + private function reflectInterfaceToNode(ReflectionClass $interface, Node\ClassNode $node) + { + $node->addInterface($interface->getName()); + + foreach ($interface->getMethods() as $method) { + $this->reflectMethodToNode($method, $node); + } + } + + private function reflectMethodToNode(ReflectionMethod $method, Node\ClassNode $classNode) + { + $node = new Node\MethodNode($method->getName()); + + if (true === $method->isProtected()) { + $node->setVisibility('protected'); + } + + if (true === $method->isStatic()) { + $node->setStatic(); + } + + if (true === $method->returnsReference()) { + $node->setReturnsReference(); + } + + if (version_compare(PHP_VERSION, '7.0', '>=') && $method->hasReturnType()) { + $returnType = (string) $method->getReturnType(); + $returnTypeLower = strtolower($returnType); + + if ('self' === $returnTypeLower) { + $returnType = $method->getDeclaringClass()->getName(); + } + if ('parent' === $returnTypeLower) { + $returnType = $method->getDeclaringClass()->getParentClass()->getName(); + } + + $node->setReturnType($returnType); + + if (version_compare(PHP_VERSION, '7.1', '>=') && $method->getReturnType()->allowsNull()) { + $node->setNullableReturnType(true); + } + } + + if (is_array($params = $method->getParameters()) && count($params)) { + foreach ($params as $param) { + $this->reflectArgumentToNode($param, $node); + } + } + + $classNode->addMethod($node); + } + + private function reflectArgumentToNode(ReflectionParameter $parameter, Node\MethodNode $methodNode) + { + $name = $parameter->getName() == '...' ? '__dot_dot_dot__' : $parameter->getName(); + $node = new Node\ArgumentNode($name); + + $node->setTypeHint($this->getTypeHint($parameter)); + + if ($this->isVariadic($parameter)) { + $node->setAsVariadic(); + } + + if ($this->hasDefaultValue($parameter)) { + $node->setDefault($this->getDefaultValue($parameter)); + } + + if ($parameter->isPassedByReference()) { + $node->setAsPassedByReference(); + } + + $node->setAsNullable($this->isNullable($parameter)); + + $methodNode->addArgument($node); + } + + private function hasDefaultValue(ReflectionParameter $parameter) + { + if ($this->isVariadic($parameter)) { + return false; + } + + if ($parameter->isDefaultValueAvailable()) { + return true; + } + + return $parameter->isOptional() || $this->isNullable($parameter); + } + + private function getDefaultValue(ReflectionParameter $parameter) + { + if (!$parameter->isDefaultValueAvailable()) { + return null; + } + + return $parameter->getDefaultValue(); + } + + private function getTypeHint(ReflectionParameter $parameter) + { + if (null !== $className = $this->getParameterClassName($parameter)) { + return $className; + } + + if (true === $parameter->isArray()) { + return 'array'; + } + + if (version_compare(PHP_VERSION, '5.4', '>=') && true === $parameter->isCallable()) { + return 'callable'; + } + + if (version_compare(PHP_VERSION, '7.0', '>=') && true === $parameter->hasType()) { + return (string) $parameter->getType(); + } + + return null; + } + + private function isVariadic(ReflectionParameter $parameter) + { + return PHP_VERSION_ID >= 50600 && $parameter->isVariadic(); + } + + private function isNullable(ReflectionParameter $parameter) + { + return $parameter->allowsNull() && null !== $this->getTypeHint($parameter); + } + + private function getParameterClassName(ReflectionParameter $parameter) + { + try { + return $parameter->getClass() ? $parameter->getClass()->getName() : null; + } catch (\ReflectionException $e) { + preg_match('/\[\s\<\w+?>\s([\w,\\\]+)/s', $parameter, $matches); + + return isset($matches[1]) ? $matches[1] : null; + } + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ArgumentNode.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ArgumentNode.php new file mode 100644 index 0000000..dd29b68 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ArgumentNode.php @@ -0,0 +1,102 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\Generator\Node; + +/** + * Argument node. + * + * @author Konstantin Kudryashov + */ +class ArgumentNode +{ + private $name; + private $typeHint; + private $default; + private $optional = false; + private $byReference = false; + private $isVariadic = false; + private $isNullable = false; + + /** + * @param string $name + */ + public function __construct($name) + { + $this->name = $name; + } + + public function getName() + { + return $this->name; + } + + public function getTypeHint() + { + return $this->typeHint; + } + + public function setTypeHint($typeHint = null) + { + $this->typeHint = $typeHint; + } + + public function hasDefault() + { + return $this->isOptional() && !$this->isVariadic(); + } + + public function getDefault() + { + return $this->default; + } + + public function setDefault($default = null) + { + $this->optional = true; + $this->default = $default; + } + + public function isOptional() + { + return $this->optional; + } + + public function setAsPassedByReference($byReference = true) + { + $this->byReference = $byReference; + } + + public function isPassedByReference() + { + return $this->byReference; + } + + public function setAsVariadic($isVariadic = true) + { + $this->isVariadic = $isVariadic; + } + + public function isVariadic() + { + return $this->isVariadic; + } + + public function isNullable() + { + return $this->isNullable; + } + + public function setAsNullable($isNullable = true) + { + $this->isNullable = $isNullable; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ClassNode.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ClassNode.php new file mode 100644 index 0000000..f7bd285 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/ClassNode.php @@ -0,0 +1,169 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\Generator\Node; + +use Prophecy\Exception\Doubler\MethodNotExtendableException; +use Prophecy\Exception\InvalidArgumentException; + +/** + * Class node. + * + * @author Konstantin Kudryashov + */ +class ClassNode +{ + private $parentClass = 'stdClass'; + private $interfaces = array(); + private $properties = array(); + private $unextendableMethods = array(); + + /** + * @var MethodNode[] + */ + private $methods = array(); + + public function getParentClass() + { + return $this->parentClass; + } + + /** + * @param string $class + */ + public function setParentClass($class) + { + $this->parentClass = $class ?: 'stdClass'; + } + + /** + * @return string[] + */ + public function getInterfaces() + { + return $this->interfaces; + } + + /** + * @param string $interface + */ + public function addInterface($interface) + { + if ($this->hasInterface($interface)) { + return; + } + + array_unshift($this->interfaces, $interface); + } + + /** + * @param string $interface + * + * @return bool + */ + public function hasInterface($interface) + { + return in_array($interface, $this->interfaces); + } + + public function getProperties() + { + return $this->properties; + } + + public function addProperty($name, $visibility = 'public') + { + $visibility = strtolower($visibility); + + if (!in_array($visibility, array('public', 'private', 'protected'))) { + throw new InvalidArgumentException(sprintf( + '`%s` property visibility is not supported.', $visibility + )); + } + + $this->properties[$name] = $visibility; + } + + /** + * @return MethodNode[] + */ + public function getMethods() + { + return $this->methods; + } + + public function addMethod(MethodNode $method, $force = false) + { + if (!$this->isExtendable($method->getName())){ + $message = sprintf( + 'Method `%s` is not extendable, so can not be added.', $method->getName() + ); + throw new MethodNotExtendableException($message, $this->getParentClass(), $method->getName()); + } + + if ($force || !isset($this->methods[$method->getName()])) { + $this->methods[$method->getName()] = $method; + } + } + + public function removeMethod($name) + { + unset($this->methods[$name]); + } + + /** + * @param string $name + * + * @return MethodNode|null + */ + public function getMethod($name) + { + return $this->hasMethod($name) ? $this->methods[$name] : null; + } + + /** + * @param string $name + * + * @return bool + */ + public function hasMethod($name) + { + return isset($this->methods[$name]); + } + + /** + * @return string[] + */ + public function getUnextendableMethods() + { + return $this->unextendableMethods; + } + + /** + * @param string $unextendableMethod + */ + public function addUnextendableMethod($unextendableMethod) + { + if (!$this->isExtendable($unextendableMethod)){ + return; + } + $this->unextendableMethods[] = $unextendableMethod; + } + + /** + * @param string $method + * @return bool + */ + public function isExtendable($method) + { + return !in_array($method, $this->unextendableMethods); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/MethodNode.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/MethodNode.php new file mode 100644 index 0000000..c74b483 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/MethodNode.php @@ -0,0 +1,198 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\Generator\Node; + +use Prophecy\Doubler\Generator\TypeHintReference; +use Prophecy\Exception\InvalidArgumentException; + +/** + * Method node. + * + * @author Konstantin Kudryashov + */ +class MethodNode +{ + private $name; + private $code; + private $visibility = 'public'; + private $static = false; + private $returnsReference = false; + private $returnType; + private $nullableReturnType = false; + + /** + * @var ArgumentNode[] + */ + private $arguments = array(); + + /** + * @var TypeHintReference + */ + private $typeHintReference; + + /** + * @param string $name + * @param string $code + */ + public function __construct($name, $code = null, TypeHintReference $typeHintReference = null) + { + $this->name = $name; + $this->code = $code; + $this->typeHintReference = $typeHintReference ?: new TypeHintReference(); + } + + public function getVisibility() + { + return $this->visibility; + } + + /** + * @param string $visibility + */ + public function setVisibility($visibility) + { + $visibility = strtolower($visibility); + + if (!in_array($visibility, array('public', 'private', 'protected'))) { + throw new InvalidArgumentException(sprintf( + '`%s` method visibility is not supported.', $visibility + )); + } + + $this->visibility = $visibility; + } + + public function isStatic() + { + return $this->static; + } + + public function setStatic($static = true) + { + $this->static = (bool) $static; + } + + public function returnsReference() + { + return $this->returnsReference; + } + + public function setReturnsReference() + { + $this->returnsReference = true; + } + + public function getName() + { + return $this->name; + } + + public function addArgument(ArgumentNode $argument) + { + $this->arguments[] = $argument; + } + + /** + * @return ArgumentNode[] + */ + public function getArguments() + { + return $this->arguments; + } + + public function hasReturnType() + { + return null !== $this->returnType; + } + + /** + * @param string $type + */ + public function setReturnType($type = null) + { + if ($type === '' || $type === null) { + $this->returnType = null; + return; + } + $typeMap = array( + 'double' => 'float', + 'real' => 'float', + 'boolean' => 'bool', + 'integer' => 'int', + ); + if (isset($typeMap[$type])) { + $type = $typeMap[$type]; + } + $this->returnType = $this->typeHintReference->isBuiltInReturnTypeHint($type) ? + $type : + '\\' . ltrim($type, '\\'); + } + + public function getReturnType() + { + return $this->returnType; + } + + /** + * @param bool $bool + */ + public function setNullableReturnType($bool = true) + { + $this->nullableReturnType = (bool) $bool; + } + + /** + * @return bool + */ + public function hasNullableReturnType() + { + return $this->nullableReturnType; + } + + /** + * @param string $code + */ + public function setCode($code) + { + $this->code = $code; + } + + public function getCode() + { + if ($this->returnsReference) + { + return "throw new \Prophecy\Exception\Doubler\ReturnByReferenceException('Returning by reference not supported', get_class(\$this), '{$this->name}');"; + } + + return (string) $this->code; + } + + public function useParentCode() + { + $this->code = sprintf( + 'return parent::%s(%s);', $this->getName(), implode(', ', + array_map(array($this, 'generateArgument'), $this->arguments) + ) + ); + } + + private function generateArgument(ArgumentNode $arg) + { + $argument = '$'.$arg->getName(); + + if ($arg->isVariadic()) { + $argument = '...'.$argument; + } + + return $argument; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ReflectionInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ReflectionInterface.php new file mode 100644 index 0000000..d720b15 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ReflectionInterface.php @@ -0,0 +1,22 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler\Generator; + +/** + * Reflection interface. + * All reflected classes implement this interface. + * + * @author Konstantin Kudryashov + */ +interface ReflectionInterface +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/TypeHintReference.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/TypeHintReference.php new file mode 100644 index 0000000..ce95202 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/TypeHintReference.php @@ -0,0 +1,46 @@ += 50400; + + case 'bool': + case 'float': + case 'int': + case 'string': + return PHP_VERSION_ID >= 70000; + + case 'iterable': + return PHP_VERSION_ID >= 70100; + + case 'object': + return PHP_VERSION_ID >= 70200; + + default: + return false; + } + } + + public function isBuiltInReturnTypeHint($type) + { + if ($type === 'void') { + return PHP_VERSION_ID >= 70100; + } + + return $this->isBuiltInParamTypeHint($type); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/LazyDouble.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/LazyDouble.php new file mode 100644 index 0000000..8a99c4c --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/LazyDouble.php @@ -0,0 +1,127 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler; + +use Prophecy\Exception\Doubler\DoubleException; +use Prophecy\Exception\Doubler\ClassNotFoundException; +use Prophecy\Exception\Doubler\InterfaceNotFoundException; +use ReflectionClass; + +/** + * Lazy double. + * Gives simple interface to describe double before creating it. + * + * @author Konstantin Kudryashov + */ +class LazyDouble +{ + private $doubler; + private $class; + private $interfaces = array(); + private $arguments = null; + private $double; + + /** + * Initializes lazy double. + * + * @param Doubler $doubler + */ + public function __construct(Doubler $doubler) + { + $this->doubler = $doubler; + } + + /** + * Tells doubler to use specific class as parent one for double. + * + * @param string|ReflectionClass $class + * + * @throws \Prophecy\Exception\Doubler\ClassNotFoundException + * @throws \Prophecy\Exception\Doubler\DoubleException + */ + public function setParentClass($class) + { + if (null !== $this->double) { + throw new DoubleException('Can not extend class with already instantiated double.'); + } + + if (!$class instanceof ReflectionClass) { + if (!class_exists($class)) { + throw new ClassNotFoundException(sprintf('Class %s not found.', $class), $class); + } + + $class = new ReflectionClass($class); + } + + $this->class = $class; + } + + /** + * Tells doubler to implement specific interface with double. + * + * @param string|ReflectionClass $interface + * + * @throws \Prophecy\Exception\Doubler\InterfaceNotFoundException + * @throws \Prophecy\Exception\Doubler\DoubleException + */ + public function addInterface($interface) + { + if (null !== $this->double) { + throw new DoubleException( + 'Can not implement interface with already instantiated double.' + ); + } + + if (!$interface instanceof ReflectionClass) { + if (!interface_exists($interface)) { + throw new InterfaceNotFoundException( + sprintf('Interface %s not found.', $interface), + $interface + ); + } + + $interface = new ReflectionClass($interface); + } + + $this->interfaces[] = $interface; + } + + /** + * Sets constructor arguments. + * + * @param array $arguments + */ + public function setArguments(array $arguments = null) + { + $this->arguments = $arguments; + } + + /** + * Creates double instance or returns already created one. + * + * @return DoubleInterface + */ + public function getInstance() + { + if (null === $this->double) { + if (null !== $this->arguments) { + return $this->double = $this->doubler->double( + $this->class, $this->interfaces, $this->arguments + ); + } + + $this->double = $this->doubler->double($this->class, $this->interfaces); + } + + return $this->double; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/NameGenerator.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/NameGenerator.php new file mode 100644 index 0000000..d67ec6a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/NameGenerator.php @@ -0,0 +1,52 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Doubler; + +use ReflectionClass; + +/** + * Name generator. + * Generates classname for double. + * + * @author Konstantin Kudryashov + */ +class NameGenerator +{ + private static $counter = 1; + + /** + * Generates name. + * + * @param ReflectionClass $class + * @param ReflectionClass[] $interfaces + * + * @return string + */ + public function name(ReflectionClass $class = null, array $interfaces) + { + $parts = array(); + + if (null !== $class) { + $parts[] = $class->getName(); + } else { + foreach ($interfaces as $interface) { + $parts[] = $interface->getShortName(); + } + } + + if (!count($parts)) { + $parts[] = 'stdClass'; + } + + return sprintf('Double\%s\P%d', implode('\\', $parts), self::$counter++); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Call/UnexpectedCallException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Call/UnexpectedCallException.php new file mode 100644 index 0000000..48ed225 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Call/UnexpectedCallException.php @@ -0,0 +1,40 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Call; + +use Prophecy\Exception\Prophecy\ObjectProphecyException; +use Prophecy\Prophecy\ObjectProphecy; + +class UnexpectedCallException extends ObjectProphecyException +{ + private $methodName; + private $arguments; + + public function __construct($message, ObjectProphecy $objectProphecy, + $methodName, array $arguments) + { + parent::__construct($message, $objectProphecy); + + $this->methodName = $methodName; + $this->arguments = $arguments; + } + + public function getMethodName() + { + return $this->methodName; + } + + public function getArguments() + { + return $this->arguments; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassCreatorException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassCreatorException.php new file mode 100644 index 0000000..822918a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassCreatorException.php @@ -0,0 +1,31 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +use Prophecy\Doubler\Generator\Node\ClassNode; + +class ClassCreatorException extends \RuntimeException implements DoublerException +{ + private $node; + + public function __construct($message, ClassNode $node) + { + parent::__construct($message); + + $this->node = $node; + } + + public function getClassNode() + { + return $this->node; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassMirrorException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassMirrorException.php new file mode 100644 index 0000000..8fc53b8 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassMirrorException.php @@ -0,0 +1,31 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +use ReflectionClass; + +class ClassMirrorException extends \RuntimeException implements DoublerException +{ + private $class; + + public function __construct($message, ReflectionClass $class) + { + parent::__construct($message); + + $this->class = $class; + } + + public function getReflectedClass() + { + return $this->class; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassNotFoundException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassNotFoundException.php new file mode 100644 index 0000000..5bc826d --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ClassNotFoundException.php @@ -0,0 +1,33 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +class ClassNotFoundException extends DoubleException +{ + private $classname; + + /** + * @param string $message + * @param string $classname + */ + public function __construct($message, $classname) + { + parent::__construct($message); + + $this->classname = $classname; + } + + public function getClassname() + { + return $this->classname; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/DoubleException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/DoubleException.php new file mode 100644 index 0000000..6642a58 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/DoubleException.php @@ -0,0 +1,18 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +use RuntimeException; + +class DoubleException extends RuntimeException implements DoublerException +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/DoublerException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/DoublerException.php new file mode 100644 index 0000000..9d6be17 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/DoublerException.php @@ -0,0 +1,18 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +use Prophecy\Exception\Exception; + +interface DoublerException extends Exception +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/InterfaceNotFoundException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/InterfaceNotFoundException.php new file mode 100644 index 0000000..e344dea --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/InterfaceNotFoundException.php @@ -0,0 +1,20 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +class InterfaceNotFoundException extends ClassNotFoundException +{ + public function getInterfaceName() + { + return $this->getClassname(); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotExtendableException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotExtendableException.php new file mode 100644 index 0000000..56f47b1 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotExtendableException.php @@ -0,0 +1,41 @@ +methodName = $methodName; + $this->className = $className; + } + + + /** + * @return string + */ + public function getMethodName() + { + return $this->methodName; + } + + /** + * @return string + */ + public function getClassName() + { + return $this->className; + } + + } diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotFoundException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotFoundException.php new file mode 100644 index 0000000..a538349 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotFoundException.php @@ -0,0 +1,60 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +class MethodNotFoundException extends DoubleException +{ + /** + * @var string|object + */ + private $classname; + + /** + * @var string + */ + private $methodName; + + /** + * @var array + */ + private $arguments; + + /** + * @param string $message + * @param string|object $classname + * @param string $methodName + * @param null|Argument\ArgumentsWildcard|array $arguments + */ + public function __construct($message, $classname, $methodName, $arguments = null) + { + parent::__construct($message); + + $this->classname = $classname; + $this->methodName = $methodName; + $this->arguments = $arguments; + } + + public function getClassname() + { + return $this->classname; + } + + public function getMethodName() + { + return $this->methodName; + } + + public function getArguments() + { + return $this->arguments; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ReturnByReferenceException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ReturnByReferenceException.php new file mode 100644 index 0000000..6303049 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ReturnByReferenceException.php @@ -0,0 +1,41 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Doubler; + +class ReturnByReferenceException extends DoubleException +{ + private $classname; + private $methodName; + + /** + * @param string $message + * @param string $classname + * @param string $methodName + */ + public function __construct($message, $classname, $methodName) + { + parent::__construct($message); + + $this->classname = $classname; + $this->methodName = $methodName; + } + + public function getClassname() + { + return $this->classname; + } + + public function getMethodName() + { + return $this->methodName; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Exception.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Exception.php new file mode 100644 index 0000000..ac9fe4d --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Exception.php @@ -0,0 +1,26 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception; + +/** + * Core Prophecy exception interface. + * All Prophecy exceptions implement it. + * + * @author Konstantin Kudryashov + */ +interface Exception +{ + /** + * @return string + */ + public function getMessage(); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/InvalidArgumentException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..bc91c69 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/InvalidArgumentException.php @@ -0,0 +1,16 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception; + +class InvalidArgumentException extends \InvalidArgumentException implements Exception +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/AggregateException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/AggregateException.php new file mode 100644 index 0000000..a00dfb0 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/AggregateException.php @@ -0,0 +1,51 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prediction; + +use Prophecy\Prophecy\ObjectProphecy; + +class AggregateException extends \RuntimeException implements PredictionException +{ + private $exceptions = array(); + private $objectProphecy; + + public function append(PredictionException $exception) + { + $message = $exception->getMessage(); + $message = strtr($message, array("\n" => "\n "))."\n"; + $message = empty($this->exceptions) ? $message : "\n" . $message; + + $this->message = rtrim($this->message.$message); + $this->exceptions[] = $exception; + } + + /** + * @return PredictionException[] + */ + public function getExceptions() + { + return $this->exceptions; + } + + public function setObjectProphecy(ObjectProphecy $objectProphecy) + { + $this->objectProphecy = $objectProphecy; + } + + /** + * @return ObjectProphecy + */ + public function getObjectProphecy() + { + return $this->objectProphecy; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/FailedPredictionException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/FailedPredictionException.php new file mode 100644 index 0000000..bbbbc3d --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/FailedPredictionException.php @@ -0,0 +1,24 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prediction; + +use RuntimeException; + +/** + * Basic failed prediction exception. + * Use it for custom prediction failures. + * + * @author Konstantin Kudryashov + */ +class FailedPredictionException extends RuntimeException implements PredictionException +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/NoCallsException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/NoCallsException.php new file mode 100644 index 0000000..05ea4aa --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/NoCallsException.php @@ -0,0 +1,18 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prediction; + +use Prophecy\Exception\Prophecy\MethodProphecyException; + +class NoCallsException extends MethodProphecyException implements PredictionException +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/PredictionException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/PredictionException.php new file mode 100644 index 0000000..2596b1e --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/PredictionException.php @@ -0,0 +1,18 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prediction; + +use Prophecy\Exception\Exception; + +interface PredictionException extends Exception +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/UnexpectedCallsCountException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/UnexpectedCallsCountException.php new file mode 100644 index 0000000..9d90543 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/UnexpectedCallsCountException.php @@ -0,0 +1,31 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prediction; + +use Prophecy\Prophecy\MethodProphecy; + +class UnexpectedCallsCountException extends UnexpectedCallsException +{ + private $expectedCount; + + public function __construct($message, MethodProphecy $methodProphecy, $count, array $calls) + { + parent::__construct($message, $methodProphecy, $calls); + + $this->expectedCount = intval($count); + } + + public function getExpectedCount() + { + return $this->expectedCount; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/UnexpectedCallsException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/UnexpectedCallsException.php new file mode 100644 index 0000000..7a99c2d --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prediction/UnexpectedCallsException.php @@ -0,0 +1,32 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prediction; + +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Exception\Prophecy\MethodProphecyException; + +class UnexpectedCallsException extends MethodProphecyException implements PredictionException +{ + private $calls = array(); + + public function __construct($message, MethodProphecy $methodProphecy, array $calls) + { + parent::__construct($message, $methodProphecy); + + $this->calls = $calls; + } + + public function getCalls() + { + return $this->calls; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/MethodProphecyException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/MethodProphecyException.php new file mode 100644 index 0000000..1b03eaf --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/MethodProphecyException.php @@ -0,0 +1,34 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prophecy; + +use Prophecy\Prophecy\MethodProphecy; + +class MethodProphecyException extends ObjectProphecyException +{ + private $methodProphecy; + + public function __construct($message, MethodProphecy $methodProphecy) + { + parent::__construct($message, $methodProphecy->getObjectProphecy()); + + $this->methodProphecy = $methodProphecy; + } + + /** + * @return MethodProphecy + */ + public function getMethodProphecy() + { + return $this->methodProphecy; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ObjectProphecyException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ObjectProphecyException.php new file mode 100644 index 0000000..e345402 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ObjectProphecyException.php @@ -0,0 +1,34 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prophecy; + +use Prophecy\Prophecy\ObjectProphecy; + +class ObjectProphecyException extends \RuntimeException implements ProphecyException +{ + private $objectProphecy; + + public function __construct($message, ObjectProphecy $objectProphecy) + { + parent::__construct($message); + + $this->objectProphecy = $objectProphecy; + } + + /** + * @return ObjectProphecy + */ + public function getObjectProphecy() + { + return $this->objectProphecy; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ProphecyException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ProphecyException.php new file mode 100644 index 0000000..9157332 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Prophecy/ProphecyException.php @@ -0,0 +1,18 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Exception\Prophecy; + +use Prophecy\Exception\Exception; + +interface ProphecyException extends Exception +{ +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php new file mode 100644 index 0000000..209821c --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php @@ -0,0 +1,69 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\PhpDocumentor; + +use phpDocumentor\Reflection\DocBlock\Tag\MethodTag as LegacyMethodTag; +use phpDocumentor\Reflection\DocBlock\Tags\Method; + +/** + * @author Théo FIDRY + * + * @internal + */ +final class ClassAndInterfaceTagRetriever implements MethodTagRetrieverInterface +{ + private $classRetriever; + + public function __construct(MethodTagRetrieverInterface $classRetriever = null) + { + if (null !== $classRetriever) { + $this->classRetriever = $classRetriever; + + return; + } + + $this->classRetriever = class_exists('phpDocumentor\Reflection\DocBlockFactory') && class_exists('phpDocumentor\Reflection\Types\ContextFactory') + ? new ClassTagRetriever() + : new LegacyClassTagRetriever() + ; + } + + /** + * @param \ReflectionClass $reflectionClass + * + * @return LegacyMethodTag[]|Method[] + */ + public function getTagList(\ReflectionClass $reflectionClass) + { + return array_merge( + $this->classRetriever->getTagList($reflectionClass), + $this->getInterfacesTagList($reflectionClass) + ); + } + + /** + * @param \ReflectionClass $reflectionClass + * + * @return LegacyMethodTag[]|Method[] + */ + private function getInterfacesTagList(\ReflectionClass $reflectionClass) + { + $interfaces = $reflectionClass->getInterfaces(); + $tagList = array(); + + foreach($interfaces as $interface) { + $tagList = array_merge($tagList, $this->classRetriever->getTagList($interface)); + } + + return $tagList; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/ClassTagRetriever.php b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/ClassTagRetriever.php new file mode 100644 index 0000000..1d2da8f --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/ClassTagRetriever.php @@ -0,0 +1,52 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\PhpDocumentor; + +use phpDocumentor\Reflection\DocBlock\Tags\Method; +use phpDocumentor\Reflection\DocBlockFactory; +use phpDocumentor\Reflection\Types\ContextFactory; + +/** + * @author Théo FIDRY + * + * @internal + */ +final class ClassTagRetriever implements MethodTagRetrieverInterface +{ + private $docBlockFactory; + private $contextFactory; + + public function __construct() + { + $this->docBlockFactory = DocBlockFactory::createInstance(); + $this->contextFactory = new ContextFactory(); + } + + /** + * @param \ReflectionClass $reflectionClass + * + * @return Method[] + */ + public function getTagList(\ReflectionClass $reflectionClass) + { + try { + $phpdoc = $this->docBlockFactory->create( + $reflectionClass, + $this->contextFactory->createFromReflector($reflectionClass) + ); + + return $phpdoc->getTagsByName('method'); + } catch (\InvalidArgumentException $e) { + return array(); + } + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php new file mode 100644 index 0000000..c0dec3d --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/LegacyClassTagRetriever.php @@ -0,0 +1,35 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\PhpDocumentor; + +use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlock\Tag\MethodTag as LegacyMethodTag; + +/** + * @author Théo FIDRY + * + * @internal + */ +final class LegacyClassTagRetriever implements MethodTagRetrieverInterface +{ + /** + * @param \ReflectionClass $reflectionClass + * + * @return LegacyMethodTag[] + */ + public function getTagList(\ReflectionClass $reflectionClass) + { + $phpdoc = new DocBlock($reflectionClass->getDocComment()); + + return $phpdoc->getTagsByName('method'); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php new file mode 100644 index 0000000..d3989da --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/MethodTagRetrieverInterface.php @@ -0,0 +1,30 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\PhpDocumentor; + +use phpDocumentor\Reflection\DocBlock\Tag\MethodTag as LegacyMethodTag; +use phpDocumentor\Reflection\DocBlock\Tags\Method; + +/** + * @author Théo FIDRY + * + * @internal + */ +interface MethodTagRetrieverInterface +{ + /** + * @param \ReflectionClass $reflectionClass + * + * @return LegacyMethodTag[]|Method[] + */ + public function getTagList(\ReflectionClass $reflectionClass); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallPrediction.php b/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallPrediction.php new file mode 100644 index 0000000..b478736 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallPrediction.php @@ -0,0 +1,86 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prediction; + +use Prophecy\Call\Call; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Argument\ArgumentsWildcard; +use Prophecy\Argument\Token\AnyValuesToken; +use Prophecy\Util\StringUtil; +use Prophecy\Exception\Prediction\NoCallsException; + +/** + * Call prediction. + * + * @author Konstantin Kudryashov + */ +class CallPrediction implements PredictionInterface +{ + private $util; + + /** + * Initializes prediction. + * + * @param StringUtil $util + */ + public function __construct(StringUtil $util = null) + { + $this->util = $util ?: new StringUtil; + } + + /** + * Tests that there was at least one call. + * + * @param Call[] $calls + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @throws \Prophecy\Exception\Prediction\NoCallsException + */ + public function check(array $calls, ObjectProphecy $object, MethodProphecy $method) + { + if (count($calls)) { + return; + } + + $methodCalls = $object->findProphecyMethodCalls( + $method->getMethodName(), + new ArgumentsWildcard(array(new AnyValuesToken)) + ); + + if (count($methodCalls)) { + throw new NoCallsException(sprintf( + "No calls have been made that match:\n". + " %s->%s(%s)\n". + "but expected at least one.\n". + "Recorded `%s(...)` calls:\n%s", + + get_class($object->reveal()), + $method->getMethodName(), + $method->getArgumentsWildcard(), + $method->getMethodName(), + $this->util->stringifyCalls($methodCalls) + ), $method); + } + + throw new NoCallsException(sprintf( + "No calls have been made that match:\n". + " %s->%s(%s)\n". + "but expected at least one.", + + get_class($object->reveal()), + $method->getMethodName(), + $method->getArgumentsWildcard() + ), $method); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallTimesPrediction.php b/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallTimesPrediction.php new file mode 100644 index 0000000..31c6c57 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallTimesPrediction.php @@ -0,0 +1,107 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prediction; + +use Prophecy\Call\Call; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Argument\ArgumentsWildcard; +use Prophecy\Argument\Token\AnyValuesToken; +use Prophecy\Util\StringUtil; +use Prophecy\Exception\Prediction\UnexpectedCallsCountException; + +/** + * Prediction interface. + * Predictions are logical test blocks, tied to `should...` keyword. + * + * @author Konstantin Kudryashov + */ +class CallTimesPrediction implements PredictionInterface +{ + private $times; + private $util; + + /** + * Initializes prediction. + * + * @param int $times + * @param StringUtil $util + */ + public function __construct($times, StringUtil $util = null) + { + $this->times = intval($times); + $this->util = $util ?: new StringUtil; + } + + /** + * Tests that there was exact amount of calls made. + * + * @param Call[] $calls + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @throws \Prophecy\Exception\Prediction\UnexpectedCallsCountException + */ + public function check(array $calls, ObjectProphecy $object, MethodProphecy $method) + { + if ($this->times == count($calls)) { + return; + } + + $methodCalls = $object->findProphecyMethodCalls( + $method->getMethodName(), + new ArgumentsWildcard(array(new AnyValuesToken)) + ); + + if (count($calls)) { + $message = sprintf( + "Expected exactly %d calls that match:\n". + " %s->%s(%s)\n". + "but %d were made:\n%s", + + $this->times, + get_class($object->reveal()), + $method->getMethodName(), + $method->getArgumentsWildcard(), + count($calls), + $this->util->stringifyCalls($calls) + ); + } elseif (count($methodCalls)) { + $message = sprintf( + "Expected exactly %d calls that match:\n". + " %s->%s(%s)\n". + "but none were made.\n". + "Recorded `%s(...)` calls:\n%s", + + $this->times, + get_class($object->reveal()), + $method->getMethodName(), + $method->getArgumentsWildcard(), + $method->getMethodName(), + $this->util->stringifyCalls($methodCalls) + ); + } else { + $message = sprintf( + "Expected exactly %d calls that match:\n". + " %s->%s(%s)\n". + "but none were made.", + + $this->times, + get_class($object->reveal()), + $method->getMethodName(), + $method->getArgumentsWildcard() + ); + } + + throw new UnexpectedCallsCountException($message, $method, $this->times, $calls); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallbackPrediction.php b/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallbackPrediction.php new file mode 100644 index 0000000..44bc782 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prediction/CallbackPrediction.php @@ -0,0 +1,65 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prediction; + +use Prophecy\Call\Call; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Exception\InvalidArgumentException; +use Closure; + +/** + * Callback prediction. + * + * @author Konstantin Kudryashov + */ +class CallbackPrediction implements PredictionInterface +{ + private $callback; + + /** + * Initializes callback prediction. + * + * @param callable $callback Custom callback + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function __construct($callback) + { + if (!is_callable($callback)) { + throw new InvalidArgumentException(sprintf( + 'Callable expected as an argument to CallbackPrediction, but got %s.', + gettype($callback) + )); + } + + $this->callback = $callback; + } + + /** + * Executes preset callback. + * + * @param Call[] $calls + * @param ObjectProphecy $object + * @param MethodProphecy $method + */ + public function check(array $calls, ObjectProphecy $object, MethodProphecy $method) + { + $callback = $this->callback; + + if ($callback instanceof Closure && method_exists('Closure', 'bind')) { + $callback = Closure::bind($callback, $object); + } + + call_user_func($callback, $calls, $object, $method); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prediction/NoCallsPrediction.php b/vendor/phpspec/prophecy/src/Prophecy/Prediction/NoCallsPrediction.php new file mode 100644 index 0000000..46ac5bf --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prediction/NoCallsPrediction.php @@ -0,0 +1,68 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prediction; + +use Prophecy\Call\Call; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Util\StringUtil; +use Prophecy\Exception\Prediction\UnexpectedCallsException; + +/** + * No calls prediction. + * + * @author Konstantin Kudryashov + */ +class NoCallsPrediction implements PredictionInterface +{ + private $util; + + /** + * Initializes prediction. + * + * @param null|StringUtil $util + */ + public function __construct(StringUtil $util = null) + { + $this->util = $util ?: new StringUtil; + } + + /** + * Tests that there were no calls made. + * + * @param Call[] $calls + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @throws \Prophecy\Exception\Prediction\UnexpectedCallsException + */ + public function check(array $calls, ObjectProphecy $object, MethodProphecy $method) + { + if (!count($calls)) { + return; + } + + $verb = count($calls) === 1 ? 'was' : 'were'; + + throw new UnexpectedCallsException(sprintf( + "No calls expected that match:\n". + " %s->%s(%s)\n". + "but %d %s made:\n%s", + get_class($object->reveal()), + $method->getMethodName(), + $method->getArgumentsWildcard(), + count($calls), + $verb, + $this->util->stringifyCalls($calls) + ), $method, $calls); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prediction/PredictionInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Prediction/PredictionInterface.php new file mode 100644 index 0000000..f7fb06a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prediction/PredictionInterface.php @@ -0,0 +1,37 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prediction; + +use Prophecy\Call\Call; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; + +/** + * Prediction interface. + * Predictions are logical test blocks, tied to `should...` keyword. + * + * @author Konstantin Kudryashov + */ +interface PredictionInterface +{ + /** + * Tests that double fulfilled prediction. + * + * @param Call[] $calls + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @throws object + * @return void + */ + public function check(array $calls, ObjectProphecy $object, MethodProphecy $method); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Promise/CallbackPromise.php b/vendor/phpspec/prophecy/src/Prophecy/Promise/CallbackPromise.php new file mode 100644 index 0000000..5f406bf --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Promise/CallbackPromise.php @@ -0,0 +1,66 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Promise; + +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Exception\InvalidArgumentException; +use Closure; + +/** + * Callback promise. + * + * @author Konstantin Kudryashov + */ +class CallbackPromise implements PromiseInterface +{ + private $callback; + + /** + * Initializes callback promise. + * + * @param callable $callback Custom callback + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function __construct($callback) + { + if (!is_callable($callback)) { + throw new InvalidArgumentException(sprintf( + 'Callable expected as an argument to CallbackPromise, but got %s.', + gettype($callback) + )); + } + + $this->callback = $callback; + } + + /** + * Evaluates promise callback. + * + * @param array $args + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @return mixed + */ + public function execute(array $args, ObjectProphecy $object, MethodProphecy $method) + { + $callback = $this->callback; + + if ($callback instanceof Closure && method_exists('Closure', 'bind')) { + $callback = Closure::bind($callback, $object); + } + + return call_user_func($callback, $args, $object, $method); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Promise/PromiseInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Promise/PromiseInterface.php new file mode 100644 index 0000000..382537b --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Promise/PromiseInterface.php @@ -0,0 +1,35 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Promise; + +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; + +/** + * Promise interface. + * Promises are logical blocks, tied to `will...` keyword. + * + * @author Konstantin Kudryashov + */ +interface PromiseInterface +{ + /** + * Evaluates promise. + * + * @param array $args + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @return mixed + */ + public function execute(array $args, ObjectProphecy $object, MethodProphecy $method); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Promise/ReturnArgumentPromise.php b/vendor/phpspec/prophecy/src/Prophecy/Promise/ReturnArgumentPromise.php new file mode 100644 index 0000000..39bfeea --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Promise/ReturnArgumentPromise.php @@ -0,0 +1,61 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Promise; + +use Prophecy\Exception\InvalidArgumentException; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; + +/** + * Return argument promise. + * + * @author Konstantin Kudryashov + */ +class ReturnArgumentPromise implements PromiseInterface +{ + /** + * @var int + */ + private $index; + + /** + * Initializes callback promise. + * + * @param int $index The zero-indexed number of the argument to return + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function __construct($index = 0) + { + if (!is_int($index) || $index < 0) { + throw new InvalidArgumentException(sprintf( + 'Zero-based index expected as argument to ReturnArgumentPromise, but got %s.', + $index + )); + } + $this->index = $index; + } + + /** + * Returns nth argument if has one, null otherwise. + * + * @param array $args + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @return null|mixed + */ + public function execute(array $args, ObjectProphecy $object, MethodProphecy $method) + { + return count($args) > $this->index ? $args[$this->index] : null; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Promise/ReturnPromise.php b/vendor/phpspec/prophecy/src/Prophecy/Promise/ReturnPromise.php new file mode 100644 index 0000000..c7d5ac5 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Promise/ReturnPromise.php @@ -0,0 +1,55 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Promise; + +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; + +/** + * Return promise. + * + * @author Konstantin Kudryashov + */ +class ReturnPromise implements PromiseInterface +{ + private $returnValues = array(); + + /** + * Initializes promise. + * + * @param array $returnValues Array of values + */ + public function __construct(array $returnValues) + { + $this->returnValues = $returnValues; + } + + /** + * Returns saved values one by one until last one, then continuously returns last value. + * + * @param array $args + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @return mixed + */ + public function execute(array $args, ObjectProphecy $object, MethodProphecy $method) + { + $value = array_shift($this->returnValues); + + if (!count($this->returnValues)) { + $this->returnValues[] = $value; + } + + return $value; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Promise/ThrowPromise.php b/vendor/phpspec/prophecy/src/Prophecy/Promise/ThrowPromise.php new file mode 100644 index 0000000..7250fa3 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Promise/ThrowPromise.php @@ -0,0 +1,99 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Promise; + +use Doctrine\Instantiator\Instantiator; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Exception\InvalidArgumentException; +use ReflectionClass; + +/** + * Throw promise. + * + * @author Konstantin Kudryashov + */ +class ThrowPromise implements PromiseInterface +{ + private $exception; + + /** + * @var \Doctrine\Instantiator\Instantiator + */ + private $instantiator; + + /** + * Initializes promise. + * + * @param string|\Exception|\Throwable $exception Exception class name or instance + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function __construct($exception) + { + if (is_string($exception)) { + if (!class_exists($exception) || !$this->isAValidThrowable($exception)) { + throw new InvalidArgumentException(sprintf( + 'Exception / Throwable class or instance expected as argument to ThrowPromise, but got %s.', + $exception + )); + } + } elseif (!$exception instanceof \Exception && !$exception instanceof \Throwable) { + throw new InvalidArgumentException(sprintf( + 'Exception / Throwable class or instance expected as argument to ThrowPromise, but got %s.', + is_object($exception) ? get_class($exception) : gettype($exception) + )); + } + + $this->exception = $exception; + } + + /** + * Throws predefined exception. + * + * @param array $args + * @param ObjectProphecy $object + * @param MethodProphecy $method + * + * @throws object + */ + public function execute(array $args, ObjectProphecy $object, MethodProphecy $method) + { + if (is_string($this->exception)) { + $classname = $this->exception; + $reflection = new ReflectionClass($classname); + $constructor = $reflection->getConstructor(); + + if ($constructor->isPublic() && 0 == $constructor->getNumberOfRequiredParameters()) { + throw $reflection->newInstance(); + } + + if (!$this->instantiator) { + $this->instantiator = new Instantiator(); + } + + throw $this->instantiator->instantiate($classname); + } + + throw $this->exception; + } + + /** + * @param string $exception + * + * @return bool + */ + private function isAValidThrowable($exception) + { + return is_a($exception, 'Exception', true) || is_subclass_of($exception, 'Throwable', true); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php new file mode 100644 index 0000000..7084ed6 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/MethodProphecy.php @@ -0,0 +1,488 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prophecy; + +use Prophecy\Argument; +use Prophecy\Prophet; +use Prophecy\Promise; +use Prophecy\Prediction; +use Prophecy\Exception\Doubler\MethodNotFoundException; +use Prophecy\Exception\InvalidArgumentException; +use Prophecy\Exception\Prophecy\MethodProphecyException; + +/** + * Method prophecy. + * + * @author Konstantin Kudryashov + */ +class MethodProphecy +{ + private $objectProphecy; + private $methodName; + private $argumentsWildcard; + private $promise; + private $prediction; + private $checkedPredictions = array(); + private $bound = false; + private $voidReturnType = false; + + /** + * Initializes method prophecy. + * + * @param ObjectProphecy $objectProphecy + * @param string $methodName + * @param null|Argument\ArgumentsWildcard|array $arguments + * + * @throws \Prophecy\Exception\Doubler\MethodNotFoundException If method not found + */ + public function __construct(ObjectProphecy $objectProphecy, $methodName, $arguments = null) + { + $double = $objectProphecy->reveal(); + if (!method_exists($double, $methodName)) { + throw new MethodNotFoundException(sprintf( + 'Method `%s::%s()` is not defined.', get_class($double), $methodName + ), get_class($double), $methodName, $arguments); + } + + $this->objectProphecy = $objectProphecy; + $this->methodName = $methodName; + + $reflectedMethod = new \ReflectionMethod($double, $methodName); + if ($reflectedMethod->isFinal()) { + throw new MethodProphecyException(sprintf( + "Can not add prophecy for a method `%s::%s()`\n". + "as it is a final method.", + get_class($double), + $methodName + ), $this); + } + + if (null !== $arguments) { + $this->withArguments($arguments); + } + + if (version_compare(PHP_VERSION, '7.0', '>=') && true === $reflectedMethod->hasReturnType()) { + $type = (string) $reflectedMethod->getReturnType(); + + if ('void' === $type) { + $this->voidReturnType = true; + } + + $this->will(function () use ($type) { + switch ($type) { + case 'void': return; + case 'string': return ''; + case 'float': return 0.0; + case 'int': return 0; + case 'bool': return false; + case 'array': return array(); + + case 'callable': + case 'Closure': + return function () {}; + + case 'Traversable': + case 'Generator': + // Remove eval() when minimum version >=5.5 + /** @var callable $generator */ + $generator = eval('return function () { yield; };'); + return $generator(); + + default: + $prophet = new Prophet; + return $prophet->prophesize($type)->reveal(); + } + }); + } + } + + /** + * Sets argument wildcard. + * + * @param array|Argument\ArgumentsWildcard $arguments + * + * @return $this + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function withArguments($arguments) + { + if (is_array($arguments)) { + $arguments = new Argument\ArgumentsWildcard($arguments); + } + + if (!$arguments instanceof Argument\ArgumentsWildcard) { + throw new InvalidArgumentException(sprintf( + "Either an array or an instance of ArgumentsWildcard expected as\n". + 'a `MethodProphecy::withArguments()` argument, but got %s.', + gettype($arguments) + )); + } + + $this->argumentsWildcard = $arguments; + + return $this; + } + + /** + * Sets custom promise to the prophecy. + * + * @param callable|Promise\PromiseInterface $promise + * + * @return $this + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function will($promise) + { + if (is_callable($promise)) { + $promise = new Promise\CallbackPromise($promise); + } + + if (!$promise instanceof Promise\PromiseInterface) { + throw new InvalidArgumentException(sprintf( + 'Expected callable or instance of PromiseInterface, but got %s.', + gettype($promise) + )); + } + + $this->bindToObjectProphecy(); + $this->promise = $promise; + + return $this; + } + + /** + * Sets return promise to the prophecy. + * + * @see \Prophecy\Promise\ReturnPromise + * + * @return $this + */ + public function willReturn() + { + if ($this->voidReturnType) { + throw new MethodProphecyException( + "The method \"$this->methodName\" has a void return type, and so cannot return anything", + $this + ); + } + + return $this->will(new Promise\ReturnPromise(func_get_args())); + } + + /** + * Sets return argument promise to the prophecy. + * + * @param int $index The zero-indexed number of the argument to return + * + * @see \Prophecy\Promise\ReturnArgumentPromise + * + * @return $this + */ + public function willReturnArgument($index = 0) + { + if ($this->voidReturnType) { + throw new MethodProphecyException("The method \"$this->methodName\" has a void return type", $this); + } + + return $this->will(new Promise\ReturnArgumentPromise($index)); + } + + /** + * Sets throw promise to the prophecy. + * + * @see \Prophecy\Promise\ThrowPromise + * + * @param string|\Exception $exception Exception class or instance + * + * @return $this + */ + public function willThrow($exception) + { + return $this->will(new Promise\ThrowPromise($exception)); + } + + /** + * Sets custom prediction to the prophecy. + * + * @param callable|Prediction\PredictionInterface $prediction + * + * @return $this + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function should($prediction) + { + if (is_callable($prediction)) { + $prediction = new Prediction\CallbackPrediction($prediction); + } + + if (!$prediction instanceof Prediction\PredictionInterface) { + throw new InvalidArgumentException(sprintf( + 'Expected callable or instance of PredictionInterface, but got %s.', + gettype($prediction) + )); + } + + $this->bindToObjectProphecy(); + $this->prediction = $prediction; + + return $this; + } + + /** + * Sets call prediction to the prophecy. + * + * @see \Prophecy\Prediction\CallPrediction + * + * @return $this + */ + public function shouldBeCalled() + { + return $this->should(new Prediction\CallPrediction); + } + + /** + * Sets no calls prediction to the prophecy. + * + * @see \Prophecy\Prediction\NoCallsPrediction + * + * @return $this + */ + public function shouldNotBeCalled() + { + return $this->should(new Prediction\NoCallsPrediction); + } + + /** + * Sets call times prediction to the prophecy. + * + * @see \Prophecy\Prediction\CallTimesPrediction + * + * @param $count + * + * @return $this + */ + public function shouldBeCalledTimes($count) + { + return $this->should(new Prediction\CallTimesPrediction($count)); + } + + /** + * Sets call times prediction to the prophecy. + * + * @see \Prophecy\Prediction\CallTimesPrediction + * + * @return $this + */ + public function shouldBeCalledOnce() + { + return $this->shouldBeCalledTimes(1); + } + + /** + * Checks provided prediction immediately. + * + * @param callable|Prediction\PredictionInterface $prediction + * + * @return $this + * + * @throws \Prophecy\Exception\InvalidArgumentException + */ + public function shouldHave($prediction) + { + if (is_callable($prediction)) { + $prediction = new Prediction\CallbackPrediction($prediction); + } + + if (!$prediction instanceof Prediction\PredictionInterface) { + throw new InvalidArgumentException(sprintf( + 'Expected callable or instance of PredictionInterface, but got %s.', + gettype($prediction) + )); + } + + if (null === $this->promise && !$this->voidReturnType) { + $this->willReturn(); + } + + $calls = $this->getObjectProphecy()->findProphecyMethodCalls( + $this->getMethodName(), + $this->getArgumentsWildcard() + ); + + try { + $prediction->check($calls, $this->getObjectProphecy(), $this); + $this->checkedPredictions[] = $prediction; + } catch (\Exception $e) { + $this->checkedPredictions[] = $prediction; + + throw $e; + } + + return $this; + } + + /** + * Checks call prediction. + * + * @see \Prophecy\Prediction\CallPrediction + * + * @return $this + */ + public function shouldHaveBeenCalled() + { + return $this->shouldHave(new Prediction\CallPrediction); + } + + /** + * Checks no calls prediction. + * + * @see \Prophecy\Prediction\NoCallsPrediction + * + * @return $this + */ + public function shouldNotHaveBeenCalled() + { + return $this->shouldHave(new Prediction\NoCallsPrediction); + } + + /** + * Checks no calls prediction. + * + * @see \Prophecy\Prediction\NoCallsPrediction + * @deprecated + * + * @return $this + */ + public function shouldNotBeenCalled() + { + return $this->shouldNotHaveBeenCalled(); + } + + /** + * Checks call times prediction. + * + * @see \Prophecy\Prediction\CallTimesPrediction + * + * @param int $count + * + * @return $this + */ + public function shouldHaveBeenCalledTimes($count) + { + return $this->shouldHave(new Prediction\CallTimesPrediction($count)); + } + + /** + * Checks call times prediction. + * + * @see \Prophecy\Prediction\CallTimesPrediction + * + * @return $this + */ + public function shouldHaveBeenCalledOnce() + { + return $this->shouldHaveBeenCalledTimes(1); + } + + /** + * Checks currently registered [with should(...)] prediction. + */ + public function checkPrediction() + { + if (null === $this->prediction) { + return; + } + + $this->shouldHave($this->prediction); + } + + /** + * Returns currently registered promise. + * + * @return null|Promise\PromiseInterface + */ + public function getPromise() + { + return $this->promise; + } + + /** + * Returns currently registered prediction. + * + * @return null|Prediction\PredictionInterface + */ + public function getPrediction() + { + return $this->prediction; + } + + /** + * Returns predictions that were checked on this object. + * + * @return Prediction\PredictionInterface[] + */ + public function getCheckedPredictions() + { + return $this->checkedPredictions; + } + + /** + * Returns object prophecy this method prophecy is tied to. + * + * @return ObjectProphecy + */ + public function getObjectProphecy() + { + return $this->objectProphecy; + } + + /** + * Returns method name. + * + * @return string + */ + public function getMethodName() + { + return $this->methodName; + } + + /** + * Returns arguments wildcard. + * + * @return Argument\ArgumentsWildcard + */ + public function getArgumentsWildcard() + { + return $this->argumentsWildcard; + } + + /** + * @return bool + */ + public function hasReturnVoid() + { + return $this->voidReturnType; + } + + private function bindToObjectProphecy() + { + if ($this->bound) { + return; + } + + $this->getObjectProphecy()->addMethodProphecy($this); + $this->bound = true; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ObjectProphecy.php b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ObjectProphecy.php new file mode 100644 index 0000000..8d8f8a1 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ObjectProphecy.php @@ -0,0 +1,281 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prophecy; + +use SebastianBergmann\Comparator\ComparisonFailure; +use Prophecy\Comparator\Factory as ComparatorFactory; +use Prophecy\Call\Call; +use Prophecy\Doubler\LazyDouble; +use Prophecy\Argument\ArgumentsWildcard; +use Prophecy\Call\CallCenter; +use Prophecy\Exception\Prophecy\ObjectProphecyException; +use Prophecy\Exception\Prophecy\MethodProphecyException; +use Prophecy\Exception\Prediction\AggregateException; +use Prophecy\Exception\Prediction\PredictionException; + +/** + * Object prophecy. + * + * @author Konstantin Kudryashov + */ +class ObjectProphecy implements ProphecyInterface +{ + private $lazyDouble; + private $callCenter; + private $revealer; + private $comparatorFactory; + + /** + * @var MethodProphecy[][] + */ + private $methodProphecies = array(); + + /** + * Initializes object prophecy. + * + * @param LazyDouble $lazyDouble + * @param CallCenter $callCenter + * @param RevealerInterface $revealer + * @param ComparatorFactory $comparatorFactory + */ + public function __construct( + LazyDouble $lazyDouble, + CallCenter $callCenter = null, + RevealerInterface $revealer = null, + ComparatorFactory $comparatorFactory = null + ) { + $this->lazyDouble = $lazyDouble; + $this->callCenter = $callCenter ?: new CallCenter; + $this->revealer = $revealer ?: new Revealer; + + $this->comparatorFactory = $comparatorFactory ?: ComparatorFactory::getInstance(); + } + + /** + * Forces double to extend specific class. + * + * @param string $class + * + * @return $this + */ + public function willExtend($class) + { + $this->lazyDouble->setParentClass($class); + + return $this; + } + + /** + * Forces double to implement specific interface. + * + * @param string $interface + * + * @return $this + */ + public function willImplement($interface) + { + $this->lazyDouble->addInterface($interface); + + return $this; + } + + /** + * Sets constructor arguments. + * + * @param array $arguments + * + * @return $this + */ + public function willBeConstructedWith(array $arguments = null) + { + $this->lazyDouble->setArguments($arguments); + + return $this; + } + + /** + * Reveals double. + * + * @return object + * + * @throws \Prophecy\Exception\Prophecy\ObjectProphecyException If double doesn't implement needed interface + */ + public function reveal() + { + $double = $this->lazyDouble->getInstance(); + + if (null === $double || !$double instanceof ProphecySubjectInterface) { + throw new ObjectProphecyException( + "Generated double must implement ProphecySubjectInterface, but it does not.\n". + 'It seems you have wrongly configured doubler without required ClassPatch.', + $this + ); + } + + $double->setProphecy($this); + + return $double; + } + + /** + * Adds method prophecy to object prophecy. + * + * @param MethodProphecy $methodProphecy + * + * @throws \Prophecy\Exception\Prophecy\MethodProphecyException If method prophecy doesn't + * have arguments wildcard + */ + public function addMethodProphecy(MethodProphecy $methodProphecy) + { + $argumentsWildcard = $methodProphecy->getArgumentsWildcard(); + if (null === $argumentsWildcard) { + throw new MethodProphecyException(sprintf( + "Can not add prophecy for a method `%s::%s()`\n". + "as you did not specify arguments wildcard for it.", + get_class($this->reveal()), + $methodProphecy->getMethodName() + ), $methodProphecy); + } + + $methodName = $methodProphecy->getMethodName(); + + if (!isset($this->methodProphecies[$methodName])) { + $this->methodProphecies[$methodName] = array(); + } + + $this->methodProphecies[$methodName][] = $methodProphecy; + } + + /** + * Returns either all or related to single method prophecies. + * + * @param null|string $methodName + * + * @return MethodProphecy[] + */ + public function getMethodProphecies($methodName = null) + { + if (null === $methodName) { + return $this->methodProphecies; + } + + if (!isset($this->methodProphecies[$methodName])) { + return array(); + } + + return $this->methodProphecies[$methodName]; + } + + /** + * Makes specific method call. + * + * @param string $methodName + * @param array $arguments + * + * @return mixed + */ + public function makeProphecyMethodCall($methodName, array $arguments) + { + $arguments = $this->revealer->reveal($arguments); + $return = $this->callCenter->makeCall($this, $methodName, $arguments); + + return $this->revealer->reveal($return); + } + + /** + * Finds calls by method name & arguments wildcard. + * + * @param string $methodName + * @param ArgumentsWildcard $wildcard + * + * @return Call[] + */ + public function findProphecyMethodCalls($methodName, ArgumentsWildcard $wildcard) + { + return $this->callCenter->findCalls($methodName, $wildcard); + } + + /** + * Checks that registered method predictions do not fail. + * + * @throws \Prophecy\Exception\Prediction\AggregateException If any of registered predictions fail + */ + public function checkProphecyMethodsPredictions() + { + $exception = new AggregateException(sprintf("%s:\n", get_class($this->reveal()))); + $exception->setObjectProphecy($this); + + foreach ($this->methodProphecies as $prophecies) { + foreach ($prophecies as $prophecy) { + try { + $prophecy->checkPrediction(); + } catch (PredictionException $e) { + $exception->append($e); + } + } + } + + if (count($exception->getExceptions())) { + throw $exception; + } + } + + /** + * Creates new method prophecy using specified method name and arguments. + * + * @param string $methodName + * @param array $arguments + * + * @return MethodProphecy + */ + public function __call($methodName, array $arguments) + { + $arguments = new ArgumentsWildcard($this->revealer->reveal($arguments)); + + foreach ($this->getMethodProphecies($methodName) as $prophecy) { + $argumentsWildcard = $prophecy->getArgumentsWildcard(); + $comparator = $this->comparatorFactory->getComparatorFor( + $argumentsWildcard, $arguments + ); + + try { + $comparator->assertEquals($argumentsWildcard, $arguments); + return $prophecy; + } catch (ComparisonFailure $failure) {} + } + + return new MethodProphecy($this, $methodName, $arguments); + } + + /** + * Tries to get property value from double. + * + * @param string $name + * + * @return mixed + */ + public function __get($name) + { + return $this->reveal()->$name; + } + + /** + * Tries to set property value to double. + * + * @param string $name + * @param mixed $value + */ + public function __set($name, $value) + { + $this->reveal()->$name = $this->revealer->reveal($value); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ProphecyInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ProphecyInterface.php new file mode 100644 index 0000000..462f15a --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ProphecyInterface.php @@ -0,0 +1,27 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prophecy; + +/** + * Core Prophecy interface. + * + * @author Konstantin Kudryashov + */ +interface ProphecyInterface +{ + /** + * Reveals prophecy object (double) . + * + * @return object + */ + public function reveal(); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ProphecySubjectInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ProphecySubjectInterface.php new file mode 100644 index 0000000..2d83958 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ProphecySubjectInterface.php @@ -0,0 +1,34 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prophecy; + +/** + * Controllable doubles interface. + * + * @author Konstantin Kudryashov + */ +interface ProphecySubjectInterface +{ + /** + * Sets subject prophecy. + * + * @param ProphecyInterface $prophecy + */ + public function setProphecy(ProphecyInterface $prophecy); + + /** + * Returns subject prophecy. + * + * @return ProphecyInterface + */ + public function getProphecy(); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prophecy/Revealer.php b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/Revealer.php new file mode 100644 index 0000000..60ecdac --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/Revealer.php @@ -0,0 +1,44 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prophecy; + +/** + * Basic prophecies revealer. + * + * @author Konstantin Kudryashov + */ +class Revealer implements RevealerInterface +{ + /** + * Unwraps value(s). + * + * @param mixed $value + * + * @return mixed + */ + public function reveal($value) + { + if (is_array($value)) { + return array_map(array($this, __FUNCTION__), $value); + } + + if (!is_object($value)) { + return $value; + } + + if ($value instanceof ProphecyInterface) { + $value = $value->reveal(); + } + + return $value; + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prophecy/RevealerInterface.php b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/RevealerInterface.php new file mode 100644 index 0000000..ffc82bb --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prophecy/RevealerInterface.php @@ -0,0 +1,29 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Prophecy; + +/** + * Prophecies revealer interface. + * + * @author Konstantin Kudryashov + */ +interface RevealerInterface +{ + /** + * Unwraps value(s). + * + * @param mixed $value + * + * @return mixed + */ + public function reveal($value); +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Prophet.php b/vendor/phpspec/prophecy/src/Prophecy/Prophet.php new file mode 100644 index 0000000..a4fe4b0 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Prophet.php @@ -0,0 +1,135 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy; + +use Prophecy\Doubler\Doubler; +use Prophecy\Doubler\LazyDouble; +use Prophecy\Doubler\ClassPatch; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophecy\RevealerInterface; +use Prophecy\Prophecy\Revealer; +use Prophecy\Call\CallCenter; +use Prophecy\Util\StringUtil; +use Prophecy\Exception\Prediction\PredictionException; +use Prophecy\Exception\Prediction\AggregateException; + +/** + * Prophet creates prophecies. + * + * @author Konstantin Kudryashov + */ +class Prophet +{ + private $doubler; + private $revealer; + private $util; + + /** + * @var ObjectProphecy[] + */ + private $prophecies = array(); + + /** + * Initializes Prophet. + * + * @param null|Doubler $doubler + * @param null|RevealerInterface $revealer + * @param null|StringUtil $util + */ + public function __construct(Doubler $doubler = null, RevealerInterface $revealer = null, + StringUtil $util = null) + { + if (null === $doubler) { + $doubler = new Doubler; + $doubler->registerClassPatch(new ClassPatch\SplFileInfoPatch); + $doubler->registerClassPatch(new ClassPatch\TraversablePatch); + $doubler->registerClassPatch(new ClassPatch\ThrowablePatch); + $doubler->registerClassPatch(new ClassPatch\DisableConstructorPatch); + $doubler->registerClassPatch(new ClassPatch\ProphecySubjectPatch); + $doubler->registerClassPatch(new ClassPatch\ReflectionClassNewInstancePatch); + $doubler->registerClassPatch(new ClassPatch\HhvmExceptionPatch()); + $doubler->registerClassPatch(new ClassPatch\MagicCallPatch); + $doubler->registerClassPatch(new ClassPatch\KeywordPatch); + } + + $this->doubler = $doubler; + $this->revealer = $revealer ?: new Revealer; + $this->util = $util ?: new StringUtil; + } + + /** + * Creates new object prophecy. + * + * @param null|string $classOrInterface Class or interface name + * + * @return ObjectProphecy + */ + public function prophesize($classOrInterface = null) + { + $this->prophecies[] = $prophecy = new ObjectProphecy( + new LazyDouble($this->doubler), + new CallCenter($this->util), + $this->revealer + ); + + if ($classOrInterface && class_exists($classOrInterface)) { + return $prophecy->willExtend($classOrInterface); + } + + if ($classOrInterface && interface_exists($classOrInterface)) { + return $prophecy->willImplement($classOrInterface); + } + + return $prophecy; + } + + /** + * Returns all created object prophecies. + * + * @return ObjectProphecy[] + */ + public function getProphecies() + { + return $this->prophecies; + } + + /** + * Returns Doubler instance assigned to this Prophet. + * + * @return Doubler + */ + public function getDoubler() + { + return $this->doubler; + } + + /** + * Checks all predictions defined by prophecies of this Prophet. + * + * @throws Exception\Prediction\AggregateException If any prediction fails + */ + public function checkPredictions() + { + $exception = new AggregateException("Some predictions failed:\n"); + foreach ($this->prophecies as $prophecy) { + try { + $prophecy->checkProphecyMethodsPredictions(); + } catch (PredictionException $e) { + $exception->append($e); + } + } + + if (count($exception->getExceptions())) { + throw $exception; + } + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Util/ExportUtil.php b/vendor/phpspec/prophecy/src/Prophecy/Util/ExportUtil.php new file mode 100644 index 0000000..50dd3f3 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Util/ExportUtil.php @@ -0,0 +1,212 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * This class is a modification from sebastianbergmann/exporter + * @see https://github.com/sebastianbergmann/exporter + */ +class ExportUtil +{ + /** + * Exports a value as a string + * + * The output of this method is similar to the output of print_r(), but + * improved in various aspects: + * + * - NULL is rendered as "null" (instead of "") + * - TRUE is rendered as "true" (instead of "1") + * - FALSE is rendered as "false" (instead of "") + * - Strings are always quoted with single quotes + * - Carriage returns and newlines are normalized to \n + * - Recursion and repeated rendering is treated properly + * + * @param mixed $value + * @param int $indentation The indentation level of the 2nd+ line + * @return string + */ + public static function export($value, $indentation = 0) + { + return self::recursiveExport($value, $indentation); + } + + /** + * Converts an object to an array containing all of its private, protected + * and public properties. + * + * @param mixed $value + * @return array + */ + public static function toArray($value) + { + if (!is_object($value)) { + return (array) $value; + } + + $array = array(); + + foreach ((array) $value as $key => $val) { + // properties are transformed to keys in the following way: + // private $property => "\0Classname\0property" + // protected $property => "\0*\0property" + // public $property => "property" + if (preg_match('/^\0.+\0(.+)$/', $key, $matches)) { + $key = $matches[1]; + } + + // See https://github.com/php/php-src/commit/5721132 + if ($key === "\0gcdata") { + continue; + } + + $array[$key] = $val; + } + + // Some internal classes like SplObjectStorage don't work with the + // above (fast) mechanism nor with reflection in Zend. + // Format the output similarly to print_r() in this case + if ($value instanceof \SplObjectStorage) { + // However, the fast method does work in HHVM, and exposes the + // internal implementation. Hide it again. + if (property_exists('\SplObjectStorage', '__storage')) { + unset($array['__storage']); + } elseif (property_exists('\SplObjectStorage', 'storage')) { + unset($array['storage']); + } + + if (property_exists('\SplObjectStorage', '__key')) { + unset($array['__key']); + } + + foreach ($value as $key => $val) { + $array[spl_object_hash($val)] = array( + 'obj' => $val, + 'inf' => $value->getInfo(), + ); + } + } + + return $array; + } + + /** + * Recursive implementation of export + * + * @param mixed $value The value to export + * @param int $indentation The indentation level of the 2nd+ line + * @param \SebastianBergmann\RecursionContext\Context $processed Previously processed objects + * @return string + * @see SebastianBergmann\Exporter\Exporter::export + */ + protected static function recursiveExport(&$value, $indentation, $processed = null) + { + if ($value === null) { + return 'null'; + } + + if ($value === true) { + return 'true'; + } + + if ($value === false) { + return 'false'; + } + + if (is_float($value) && floatval(intval($value)) === $value) { + return "$value.0"; + } + + if (is_resource($value)) { + return sprintf( + 'resource(%d) of type (%s)', + $value, + get_resource_type($value) + ); + } + + if (is_string($value)) { + // Match for most non printable chars somewhat taking multibyte chars into account + if (preg_match('/[^\x09-\x0d\x20-\xff]/', $value)) { + return 'Binary String: 0x' . bin2hex($value); + } + + return "'" . + str_replace(array("\r\n", "\n\r", "\r"), array("\n", "\n", "\n"), $value) . + "'"; + } + + $whitespace = str_repeat(' ', 4 * $indentation); + + if (!$processed) { + $processed = new Context; + } + + if (is_array($value)) { + if (($key = $processed->contains($value)) !== false) { + return 'Array &' . $key; + } + + $array = $value; + $key = $processed->add($value); + $values = ''; + + if (count($array) > 0) { + foreach ($array as $k => $v) { + $values .= sprintf( + '%s %s => %s' . "\n", + $whitespace, + self::recursiveExport($k, $indentation), + self::recursiveExport($value[$k], $indentation + 1, $processed) + ); + } + + $values = "\n" . $values . $whitespace; + } + + return sprintf('Array &%s (%s)', $key, $values); + } + + if (is_object($value)) { + $class = get_class($value); + + if ($value instanceof ProphecyInterface) { + return sprintf('%s Object (*Prophecy*)', $class); + } elseif ($hash = $processed->contains($value)) { + return sprintf('%s:%s Object', $class, $hash); + } + + $hash = $processed->add($value); + $values = ''; + $array = self::toArray($value); + + if (count($array) > 0) { + foreach ($array as $k => $v) { + $values .= sprintf( + '%s %s => %s' . "\n", + $whitespace, + self::recursiveExport($k, $indentation), + self::recursiveExport($v, $indentation + 1, $processed) + ); + } + + $values = "\n" . $values . $whitespace; + } + + return sprintf('%s:%s Object (%s)', $class, $hash, $values); + } + + return var_export($value, true); + } +} diff --git a/vendor/phpspec/prophecy/src/Prophecy/Util/StringUtil.php b/vendor/phpspec/prophecy/src/Prophecy/Util/StringUtil.php new file mode 100644 index 0000000..ba4faff --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Util/StringUtil.php @@ -0,0 +1,99 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Util; + +use Prophecy\Call\Call; + +/** + * String utility. + * + * @author Konstantin Kudryashov + */ +class StringUtil +{ + private $verbose; + + /** + * @param bool $verbose + */ + public function __construct($verbose = true) + { + $this->verbose = $verbose; + } + + /** + * Stringifies any provided value. + * + * @param mixed $value + * @param boolean $exportObject + * + * @return string + */ + public function stringify($value, $exportObject = true) + { + if (is_array($value)) { + if (range(0, count($value) - 1) === array_keys($value)) { + return '['.implode(', ', array_map(array($this, __FUNCTION__), $value)).']'; + } + + $stringify = array($this, __FUNCTION__); + + return '['.implode(', ', array_map(function ($item, $key) use ($stringify) { + return (is_integer($key) ? $key : '"'.$key.'"'). + ' => '.call_user_func($stringify, $item); + }, $value, array_keys($value))).']'; + } + if (is_resource($value)) { + return get_resource_type($value).':'.$value; + } + if (is_object($value)) { + return $exportObject ? ExportUtil::export($value) : sprintf('%s:%s', get_class($value), spl_object_hash($value)); + } + if (true === $value || false === $value) { + return $value ? 'true' : 'false'; + } + if (is_string($value)) { + $str = sprintf('"%s"', str_replace("\n", '\\n', $value)); + + if (!$this->verbose && 50 <= strlen($str)) { + return substr($str, 0, 50).'"...'; + } + + return $str; + } + if (null === $value) { + return 'null'; + } + + return (string) $value; + } + + /** + * Stringifies provided array of calls. + * + * @param Call[] $calls Array of Call instances + * + * @return string + */ + public function stringifyCalls(array $calls) + { + $self = $this; + + return implode(PHP_EOL, array_map(function (Call $call) use ($self) { + return sprintf(' - %s(%s) @ %s', + $call->getMethodName(), + implode(', ', array_map(array($self, 'stringify'), $call->getArguments())), + str_replace(GETCWD().DIRECTORY_SEPARATOR, '', $call->getCallPlace()) + ); + }, $calls)); + } +} diff --git a/vendor/phpunit/php-code-coverage/.gitattributes b/vendor/phpunit/php-code-coverage/.gitattributes new file mode 100644 index 0000000..461090b --- /dev/null +++ b/vendor/phpunit/php-code-coverage/.gitattributes @@ -0,0 +1 @@ +*.php diff=php diff --git a/vendor/phpunit/php-code-coverage/.github/CONTRIBUTING.md b/vendor/phpunit/php-code-coverage/.github/CONTRIBUTING.md new file mode 100644 index 0000000..3339250 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/.github/CONTRIBUTING.md @@ -0,0 +1 @@ +Please refer to [https://github.com/sebastianbergmann/phpunit/blob/master/CONTRIBUTING.md](https://github.com/sebastianbergmann/phpunit/blob/master/.github/CONTRIBUTING.md) for details on how to contribute to this project. diff --git a/vendor/phpunit/php-code-coverage/.github/ISSUE_TEMPLATE.md b/vendor/phpunit/php-code-coverage/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..dc8e3b0 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,18 @@ +| Q | A +| --------------------------| --------------- +| php-code-coverage version | x.y.z +| PHP version | x.y.z +| Driver | Xdebug / PHPDBG +| Xdebug version (if used) | x.y.z +| Installation Method | Composer / PHPUnit PHAR +| Usage Method | PHPUnit / other +| PHPUnit version (if used) | x.y.z + + + diff --git a/vendor/phpunit/php-code-coverage/.github/stale.yml b/vendor/phpunit/php-code-coverage/.github/stale.yml new file mode 100644 index 0000000..51adfac --- /dev/null +++ b/vendor/phpunit/php-code-coverage/.github/stale.yml @@ -0,0 +1,44 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +# Number of days of inactivity before an Issue or Pull Request becomes stale +daysUntilStale: 60 + +# Number of days of inactivity before a stale Issue or Pull Request is closed. +# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. +daysUntilClose: 7 + +# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable +exemptLabels: + - breaking-change + - enhancement + - discussion + - cleanup + - refactoring + +# Set to true to ignore issues in a project (defaults to false) +exemptProjects: false + +# Set to true to ignore issues in a milestone (defaults to false) +exemptMilestones: false + +# Label to use when marking as stale +staleLabel: stale + +# Comment to post when marking as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had activity within the last 60 days. It will be closed after 7 days if no further activity occurs. Thank you for your contributions. + +# Comment to post when removing the stale label. +# unmarkComment: > +# Your comment here. + +# Comment to post when closing a stale Issue or Pull Request. +closeComment: > + This issue has been automatically closed because it has not had activity since it was marked as stale. Thank you for your contributions. + +# Limit the number of actions per hour, from 1-30. Default is 30 +limitPerRun: 30 + +# Limit to only `issues` or `pulls` +only: issues + diff --git a/vendor/phpunit/php-code-coverage/.gitignore b/vendor/phpunit/php-code-coverage/.gitignore new file mode 100644 index 0000000..f25d115 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/.gitignore @@ -0,0 +1,7 @@ +/tests/_files/tmp +/vendor +/composer.lock +/.idea +/.php_cs +/.php_cs.cache + diff --git a/vendor/phpunit/php-code-coverage/.php_cs.dist b/vendor/phpunit/php-code-coverage/.php_cs.dist new file mode 100644 index 0000000..59495cf --- /dev/null +++ b/vendor/phpunit/php-code-coverage/.php_cs.dist @@ -0,0 +1,189 @@ + + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +EOF; + +return PhpCsFixer\Config::create() + ->setRiskyAllowed(true) + ->setRules( + [ + 'align_multiline_comment' => true, + 'array_indentation' => true, + 'array_syntax' => ['syntax' => 'short'], + 'binary_operator_spaces' => [ + 'operators' => [ + '=' => 'align', + '=>' => 'align', + ], + ], + 'blank_line_after_namespace' => true, + 'blank_line_before_statement' => [ + 'statements' => [ + 'break', + 'continue', + 'declare', + 'do', + 'for', + 'foreach', + 'if', + 'include', + 'include_once', + 'require', + 'require_once', + 'return', + 'switch', + 'throw', + 'try', + 'while', + 'yield', + ], + ], + 'braces' => true, + 'cast_spaces' => true, + 'class_attributes_separation' => ['elements' => ['const', 'method', 'property']], + 'combine_consecutive_issets' => true, + 'combine_consecutive_unsets' => true, + 'compact_nullable_typehint' => true, + 'concat_space' => ['spacing' => 'one'], + 'declare_equal_normalize' => ['space' => 'none'], + 'dir_constant' => true, + 'elseif' => true, + 'encoding' => true, + 'full_opening_tag' => true, + 'function_declaration' => true, + 'header_comment' => ['header' => $header, 'separate' => 'none'], + 'indentation_type' => true, + 'is_null' => true, + 'line_ending' => true, + 'list_syntax' => ['syntax' => 'short'], + 'logical_operators' => true, + 'lowercase_cast' => true, + 'lowercase_constants' => true, + 'lowercase_keywords' => true, + 'lowercase_static_reference' => true, + 'magic_constant_casing' => true, + 'method_argument_space' => ['ensure_fully_multiline' => true], + 'modernize_types_casting' => true, + 'multiline_comment_opening_closing' => true, + 'multiline_whitespace_before_semicolons' => true, + 'native_constant_invocation' => true, + 'native_function_casing' => true, + 'native_function_invocation' => true, + 'new_with_braces' => false, + 'no_alias_functions' => true, + 'no_alternative_syntax' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_blank_lines_before_namespace' => true, + 'no_closing_tag' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => true, + 'no_homoglyph_names' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => ['use' => 'print'], + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_null_property_initialization' => true, + 'no_php4_constructor' => true, + 'no_short_bool_cast' => true, + 'no_short_echo_tag' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_inside_parenthesis' => true, + 'no_superfluous_elseif' => true, + 'no_superfluous_phpdoc_tags' => true, + 'no_trailing_comma_in_list_call' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unneeded_curly_braces' => true, + 'no_unneeded_final_method' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unset_on_property' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'no_whitespace_before_comma_in_array' => true, + 'no_whitespace_in_blank_line' => true, + 'non_printable_character' => true, + 'normalize_index_brace' => true, + 'object_operator_without_whitespace' => true, + 'ordered_class_elements' => [ + 'order' => [ + 'use_trait', + 'constant_public', + 'constant_protected', + 'constant_private', + 'property_public_static', + 'property_protected_static', + 'property_private_static', + 'property_public', + 'property_protected', + 'property_private', + 'method_public_static', + 'construct', + 'destruct', + 'magic', + 'phpunit', + 'method_public', + 'method_protected', + 'method_private', + 'method_protected_static', + 'method_private_static', + ], + ], + 'ordered_imports' => true, + 'phpdoc_add_missing_param_annotation' => true, + 'phpdoc_align' => true, + 'phpdoc_annotation_without_dot' => true, + 'phpdoc_indent' => true, + 'phpdoc_no_access' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_package' => true, + 'phpdoc_order' => true, + 'phpdoc_return_self_reference' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_to_comment' => true, + 'phpdoc_trim' => true, + 'phpdoc_trim_consecutive_blank_line_separation' => true, + 'phpdoc_types' => true, + 'phpdoc_types_order' => true, + 'phpdoc_var_without_name' => true, + 'pow_to_exponentiation' => true, + 'protected_to_private' => true, + 'return_assignment' => true, + 'return_type_declaration' => ['space_before' => 'none'], + 'self_accessor' => true, + 'semicolon_after_instruction' => true, + 'set_type_to_cast' => true, + 'short_scalar_cast' => true, + 'simplified_null_return' => true, + 'single_blank_line_at_eof' => true, + 'single_import_per_statement' => true, + 'single_line_after_imports' => true, + 'single_quote' => true, + 'standardize_not_equals' => true, + 'ternary_to_null_coalescing' => true, + 'trailing_comma_in_multiline_array' => true, + 'trim_array_spaces' => true, + 'unary_operator_spaces' => true, + 'visibility_required' => true, + 'void_return' => true, + 'whitespace_after_comma_in_array' => true, + ] + ) + ->setFinder( + PhpCsFixer\Finder::create() + ->files() + ->in(__DIR__ . '/src') + ); diff --git a/vendor/phpunit/php-code-coverage/.travis.yml b/vendor/phpunit/php-code-coverage/.travis.yml new file mode 100644 index 0000000..e881f45 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/.travis.yml @@ -0,0 +1,40 @@ +language: php + +sudo: false + +php: + - 7.1 + - 7.2 + - 7.3 + - master + +matrix: + allow_failures: + - php: master + fast_finish: true + +env: + matrix: + - DEPENDENCIES="high" + - DEPENDENCIES="low" + global: + - DEFAULT_COMPOSER_FLAGS="--no-interaction --no-ansi --no-progress --no-suggest" + +before_install: + - composer self-update + - composer clear-cache + +install: + - if [[ "$DEPENDENCIES" = 'high' ]]; then travis_retry composer update $DEFAULT_COMPOSER_FLAGS; fi + - if [[ "$DEPENDENCIES" = 'low' ]]; then travis_retry composer update $DEFAULT_COMPOSER_FLAGS --prefer-lowest; fi + +script: + - if [[ "$DRIVER" = 'phpdbg' ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi + - if [[ "$DRIVER" = 'xdebug' ]]; then vendor/bin/phpunit --coverage-clover=coverage.xml; fi + +after_success: + - bash <(curl -s https://codecov.io/bash) + +notifications: + email: false + diff --git a/vendor/phpunit/php-code-coverage/ChangeLog-6.1.md b/vendor/phpunit/php-code-coverage/ChangeLog-6.1.md new file mode 100644 index 0000000..716a124 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/ChangeLog-6.1.md @@ -0,0 +1,41 @@ +# Changes in php-code-coverage 6.1 + +All notable changes of the php-code-coverage 6.1 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [6.1.4] - 2018-10-31 + +### Fixed + +* Fixed [#650](https://github.com/sebastianbergmann/php-code-coverage/issues/650): Wasted screen space in HTML code coverage report + +## [6.1.3] - 2018-10-23 + +### Changed + +* Use `^3.1` of `sebastian/environment` again due to [regression](https://github.com/sebastianbergmann/environment/issues/31) + +## [6.1.2] - 2018-10-23 + +### Fixed + +* Fixed [#645](https://github.com/sebastianbergmann/php-code-coverage/pull/645): Crash that can occur when php-token-stream parses invalid files + +## [6.1.1] - 2018-10-18 + +### Changed + +* This component now allows `^4` of `sebastian/environment` + +## [6.1.0] - 2018-10-16 + +### Changed + +* Class names are now abbreviated (unqualified name shown, fully qualified name shown on hover) in the file view of the HTML report +* Update HTML report to Bootstrap 4 + +[6.1.4]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.1.3...6.1.4 +[6.1.3]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.1.2...6.1.3 +[6.1.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.1.1...6.1.2 +[6.1.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.1.0...6.1.1 +[6.1.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.0...6.1.0 + diff --git a/vendor/phpunit/php-code-coverage/LICENSE b/vendor/phpunit/php-code-coverage/LICENSE new file mode 100644 index 0000000..f198e20 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/LICENSE @@ -0,0 +1,33 @@ +php-code-coverage + +Copyright (c) 2009-2018, Sebastian Bergmann . +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Sebastian Bergmann nor the names of his + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/phpunit/php-code-coverage/README.md b/vendor/phpunit/php-code-coverage/README.md new file mode 100644 index 0000000..bd4a169 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/README.md @@ -0,0 +1,40 @@ +[![Latest Stable Version](https://poser.pugx.org/phpunit/php-code-coverage/v/stable.png)](https://packagist.org/packages/phpunit/php-code-coverage) +[![Build Status](https://travis-ci.org/sebastianbergmann/php-code-coverage.svg?branch=master)](https://travis-ci.org/sebastianbergmann/php-code-coverage) + +# SebastianBergmann\CodeCoverage + +**SebastianBergmann\CodeCoverage** is a library that provides collection, processing, and rendering functionality for PHP code coverage information. + +## Installation + +You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): + + composer require phpunit/php-code-coverage + +If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: + + composer require --dev phpunit/php-code-coverage + +## Using the SebastianBergmann\CodeCoverage API + +```php +filter()->addDirectoryToWhitelist('/path/to/src'); + +$coverage->start(''); + +// ... + +$coverage->stop(); + +$writer = new \SebastianBergmann\CodeCoverage\Report\Clover; +$writer->process($coverage, '/tmp/clover.xml'); + +$writer = new \SebastianBergmann\CodeCoverage\Report\Html\Facade; +$writer->process($coverage, '/tmp/code-coverage-report'); +``` + diff --git a/vendor/phpunit/php-code-coverage/build.xml b/vendor/phpunit/php-code-coverage/build.xml new file mode 100644 index 0000000..40eeeec --- /dev/null +++ b/vendor/phpunit/php-code-coverage/build.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phpunit/php-code-coverage/composer.json b/vendor/phpunit/php-code-coverage/composer.json new file mode 100644 index 0000000..bb27256 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/composer.json @@ -0,0 +1,55 @@ +{ + "name": "phpunit/php-code-coverage", + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "type": "library", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues" + }, + "config": { + "optimize-autoloader": true, + "sort-packages": true + }, + "prefer-stable": true, + "require": { + "php": "^7.1", + "ext-dom": "*", + "ext-xmlwriter": "*", + "phpunit/php-file-iterator": "^2.0", + "phpunit/php-token-stream": "^3.0", + "phpunit/php-text-template": "^1.2.1", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1 || ^4.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-xdebug": "^2.6.0" + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + } +} diff --git a/vendor/phpunit/php-code-coverage/phpunit.xml b/vendor/phpunit/php-code-coverage/phpunit.xml new file mode 100644 index 0000000..37e2219 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/phpunit.xml @@ -0,0 +1,21 @@ + + + + tests/tests + + + + + src + + + + + + + + diff --git a/vendor/phpunit/php-code-coverage/src/CodeCoverage.php b/vendor/phpunit/php-code-coverage/src/CodeCoverage.php new file mode 100644 index 0000000..67ba403 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/CodeCoverage.php @@ -0,0 +1,1008 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage; + +use PHPUnit\Framework\TestCase; +use PHPUnit\Runner\PhptTestCase; +use PHPUnit\Util\Test; +use SebastianBergmann\CodeCoverage\Driver\Driver; +use SebastianBergmann\CodeCoverage\Driver\PHPDBG; +use SebastianBergmann\CodeCoverage\Driver\Xdebug; +use SebastianBergmann\CodeCoverage\Node\Builder; +use SebastianBergmann\CodeCoverage\Node\Directory; +use SebastianBergmann\CodeUnitReverseLookup\Wizard; +use SebastianBergmann\Environment\Runtime; + +/** + * Provides collection functionality for PHP code coverage information. + */ +final class CodeCoverage +{ + /** + * @var Driver + */ + private $driver; + + /** + * @var Filter + */ + private $filter; + + /** + * @var Wizard + */ + private $wizard; + + /** + * @var bool + */ + private $cacheTokens = false; + + /** + * @var bool + */ + private $checkForUnintentionallyCoveredCode = false; + + /** + * @var bool + */ + private $forceCoversAnnotation = false; + + /** + * @var bool + */ + private $checkForUnexecutedCoveredCode = false; + + /** + * @var bool + */ + private $checkForMissingCoversAnnotation = false; + + /** + * @var bool + */ + private $addUncoveredFilesFromWhitelist = true; + + /** + * @var bool + */ + private $processUncoveredFilesFromWhitelist = false; + + /** + * @var bool + */ + private $ignoreDeprecatedCode = false; + + /** + * @var PhptTestCase|string|TestCase + */ + private $currentId; + + /** + * Code coverage data. + * + * @var array + */ + private $data = []; + + /** + * @var array + */ + private $ignoredLines = []; + + /** + * @var bool + */ + private $disableIgnoredLines = false; + + /** + * Test data. + * + * @var array + */ + private $tests = []; + + /** + * @var string[] + */ + private $unintentionallyCoveredSubclassesWhitelist = []; + + /** + * Determine if the data has been initialized or not + * + * @var bool + */ + private $isInitialized = false; + + /** + * Determine whether we need to check for dead and unused code on each test + * + * @var bool + */ + private $shouldCheckForDeadAndUnused = true; + + /** + * @var Directory + */ + private $report; + + /** + * @throws RuntimeException + */ + public function __construct(Driver $driver = null, Filter $filter = null) + { + if ($filter === null) { + $filter = new Filter; + } + + if ($driver === null) { + $driver = $this->selectDriver($filter); + } + + $this->driver = $driver; + $this->filter = $filter; + + $this->wizard = new Wizard; + } + + /** + * Returns the code coverage information as a graph of node objects. + */ + public function getReport(): Directory + { + if ($this->report === null) { + $builder = new Builder; + + $this->report = $builder->build($this); + } + + return $this->report; + } + + /** + * Clears collected code coverage data. + */ + public function clear(): void + { + $this->isInitialized = false; + $this->currentId = null; + $this->data = []; + $this->tests = []; + $this->report = null; + } + + /** + * Returns the filter object used. + */ + public function filter(): Filter + { + return $this->filter; + } + + /** + * Returns the collected code coverage data. + */ + public function getData(bool $raw = false): array + { + if (!$raw && $this->addUncoveredFilesFromWhitelist) { + $this->addUncoveredFilesFromWhitelist(); + } + + return $this->data; + } + + /** + * Sets the coverage data. + */ + public function setData(array $data): void + { + $this->data = $data; + $this->report = null; + } + + /** + * Returns the test data. + */ + public function getTests(): array + { + return $this->tests; + } + + /** + * Sets the test data. + */ + public function setTests(array $tests): void + { + $this->tests = $tests; + } + + /** + * Start collection of code coverage information. + * + * @param PhptTestCase|string|TestCase $id + * + * @throws RuntimeException + */ + public function start($id, bool $clear = false): void + { + if ($clear) { + $this->clear(); + } + + if ($this->isInitialized === false) { + $this->initializeData(); + } + + $this->currentId = $id; + + $this->driver->start($this->shouldCheckForDeadAndUnused); + } + + /** + * Stop collection of code coverage information. + * + * @param array|false $linesToBeCovered + * + * @throws MissingCoversAnnotationException + * @throws CoveredCodeNotExecutedException + * @throws RuntimeException + * @throws InvalidArgumentException + * @throws \ReflectionException + */ + public function stop(bool $append = true, $linesToBeCovered = [], array $linesToBeUsed = [], bool $ignoreForceCoversAnnotation = false): array + { + if (!\is_array($linesToBeCovered) && $linesToBeCovered !== false) { + throw InvalidArgumentException::create( + 2, + 'array or false' + ); + } + + $data = $this->driver->stop(); + $this->append($data, null, $append, $linesToBeCovered, $linesToBeUsed, $ignoreForceCoversAnnotation); + + $this->currentId = null; + + return $data; + } + + /** + * Appends code coverage data. + * + * @param PhptTestCase|string|TestCase $id + * @param array|false $linesToBeCovered + * + * @throws \SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException + * @throws \SebastianBergmann\CodeCoverage\MissingCoversAnnotationException + * @throws \SebastianBergmann\CodeCoverage\CoveredCodeNotExecutedException + * @throws \ReflectionException + * @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException + * @throws RuntimeException + */ + public function append(array $data, $id = null, bool $append = true, $linesToBeCovered = [], array $linesToBeUsed = [], bool $ignoreForceCoversAnnotation = false): void + { + if ($id === null) { + $id = $this->currentId; + } + + if ($id === null) { + throw new RuntimeException; + } + + $this->applyWhitelistFilter($data); + $this->applyIgnoredLinesFilter($data); + $this->initializeFilesThatAreSeenTheFirstTime($data); + + if (!$append) { + return; + } + + if ($id !== 'UNCOVERED_FILES_FROM_WHITELIST') { + $this->applyCoversAnnotationFilter( + $data, + $linesToBeCovered, + $linesToBeUsed, + $ignoreForceCoversAnnotation + ); + } + + if (empty($data)) { + return; + } + + $size = 'unknown'; + $status = -1; + + if ($id instanceof TestCase) { + $_size = $id->getSize(); + + if ($_size === Test::SMALL) { + $size = 'small'; + } elseif ($_size === Test::MEDIUM) { + $size = 'medium'; + } elseif ($_size === Test::LARGE) { + $size = 'large'; + } + + $status = $id->getStatus(); + $id = \get_class($id) . '::' . $id->getName(); + } elseif ($id instanceof PhptTestCase) { + $size = 'large'; + $id = $id->getName(); + } + + $this->tests[$id] = ['size' => $size, 'status' => $status]; + + foreach ($data as $file => $lines) { + if (!$this->filter->isFile($file)) { + continue; + } + + foreach ($lines as $k => $v) { + if ($v === Driver::LINE_EXECUTED) { + if (empty($this->data[$file][$k]) || !\in_array($id, $this->data[$file][$k])) { + $this->data[$file][$k][] = $id; + } + } + } + } + + $this->report = null; + } + + /** + * Merges the data from another instance. + * + * @param CodeCoverage $that + */ + public function merge(self $that): void + { + $this->filter->setWhitelistedFiles( + \array_merge($this->filter->getWhitelistedFiles(), $that->filter()->getWhitelistedFiles()) + ); + + foreach ($that->data as $file => $lines) { + if (!isset($this->data[$file])) { + if (!$this->filter->isFiltered($file)) { + $this->data[$file] = $lines; + } + + continue; + } + + // we should compare the lines if any of two contains data + $compareLineNumbers = \array_unique( + \array_merge( + \array_keys($this->data[$file]), + \array_keys($that->data[$file]) + ) + ); + + foreach ($compareLineNumbers as $line) { + $thatPriority = $this->getLinePriority($that->data[$file], $line); + $thisPriority = $this->getLinePriority($this->data[$file], $line); + + if ($thatPriority > $thisPriority) { + $this->data[$file][$line] = $that->data[$file][$line]; + } elseif ($thatPriority === $thisPriority && \is_array($this->data[$file][$line])) { + $this->data[$file][$line] = \array_unique( + \array_merge($this->data[$file][$line], $that->data[$file][$line]) + ); + } + } + } + + $this->tests = \array_merge($this->tests, $that->getTests()); + $this->report = null; + } + + public function setCacheTokens(bool $flag): void + { + $this->cacheTokens = $flag; + } + + public function getCacheTokens(): bool + { + return $this->cacheTokens; + } + + public function setCheckForUnintentionallyCoveredCode(bool $flag): void + { + $this->checkForUnintentionallyCoveredCode = $flag; + } + + public function setForceCoversAnnotation(bool $flag): void + { + $this->forceCoversAnnotation = $flag; + } + + public function setCheckForMissingCoversAnnotation(bool $flag): void + { + $this->checkForMissingCoversAnnotation = $flag; + } + + public function setCheckForUnexecutedCoveredCode(bool $flag): void + { + $this->checkForUnexecutedCoveredCode = $flag; + } + + public function setAddUncoveredFilesFromWhitelist(bool $flag): void + { + $this->addUncoveredFilesFromWhitelist = $flag; + } + + public function setProcessUncoveredFilesFromWhitelist(bool $flag): void + { + $this->processUncoveredFilesFromWhitelist = $flag; + } + + public function setDisableIgnoredLines(bool $flag): void + { + $this->disableIgnoredLines = $flag; + } + + public function setIgnoreDeprecatedCode(bool $flag): void + { + $this->ignoreDeprecatedCode = $flag; + } + + public function setUnintentionallyCoveredSubclassesWhitelist(array $whitelist): void + { + $this->unintentionallyCoveredSubclassesWhitelist = $whitelist; + } + + /** + * Determine the priority for a line + * + * 1 = the line is not set + * 2 = the line has not been tested + * 3 = the line is dead code + * 4 = the line has been tested + * + * During a merge, a higher number is better. + * + * @param array $data + * @param int $line + * + * @return int + */ + private function getLinePriority($data, $line) + { + if (!\array_key_exists($line, $data)) { + return 1; + } + + if (\is_array($data[$line]) && \count($data[$line]) === 0) { + return 2; + } + + if ($data[$line] === null) { + return 3; + } + + return 4; + } + + /** + * Applies the @covers annotation filtering. + * + * @param array|false $linesToBeCovered + * + * @throws \SebastianBergmann\CodeCoverage\CoveredCodeNotExecutedException + * @throws \ReflectionException + * @throws MissingCoversAnnotationException + * @throws UnintentionallyCoveredCodeException + */ + private function applyCoversAnnotationFilter(array &$data, $linesToBeCovered, array $linesToBeUsed, bool $ignoreForceCoversAnnotation): void + { + if ($linesToBeCovered === false || + ($this->forceCoversAnnotation && empty($linesToBeCovered) && !$ignoreForceCoversAnnotation)) { + if ($this->checkForMissingCoversAnnotation) { + throw new MissingCoversAnnotationException; + } + + $data = []; + + return; + } + + if (empty($linesToBeCovered)) { + return; + } + + if ($this->checkForUnintentionallyCoveredCode && + (!$this->currentId instanceof TestCase || + (!$this->currentId->isMedium() && !$this->currentId->isLarge()))) { + $this->performUnintentionallyCoveredCodeCheck($data, $linesToBeCovered, $linesToBeUsed); + } + + if ($this->checkForUnexecutedCoveredCode) { + $this->performUnexecutedCoveredCodeCheck($data, $linesToBeCovered, $linesToBeUsed); + } + + $data = \array_intersect_key($data, $linesToBeCovered); + + foreach (\array_keys($data) as $filename) { + $_linesToBeCovered = \array_flip($linesToBeCovered[$filename]); + $data[$filename] = \array_intersect_key($data[$filename], $_linesToBeCovered); + } + } + + private function applyWhitelistFilter(array &$data): void + { + foreach (\array_keys($data) as $filename) { + if ($this->filter->isFiltered($filename)) { + unset($data[$filename]); + } + } + } + + /** + * @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException + */ + private function applyIgnoredLinesFilter(array &$data): void + { + foreach (\array_keys($data) as $filename) { + if (!$this->filter->isFile($filename)) { + continue; + } + + foreach ($this->getLinesToBeIgnored($filename) as $line) { + unset($data[$filename][$line]); + } + } + } + + private function initializeFilesThatAreSeenTheFirstTime(array $data): void + { + foreach ($data as $file => $lines) { + if (!isset($this->data[$file]) && $this->filter->isFile($file)) { + $this->data[$file] = []; + + foreach ($lines as $k => $v) { + $this->data[$file][$k] = $v === -2 ? null : []; + } + } + } + } + + /** + * @throws CoveredCodeNotExecutedException + * @throws InvalidArgumentException + * @throws MissingCoversAnnotationException + * @throws RuntimeException + * @throws UnintentionallyCoveredCodeException + * @throws \ReflectionException + */ + private function addUncoveredFilesFromWhitelist(): void + { + $data = []; + $uncoveredFiles = \array_diff( + $this->filter->getWhitelist(), + \array_keys($this->data) + ); + + foreach ($uncoveredFiles as $uncoveredFile) { + if (!\file_exists($uncoveredFile)) { + continue; + } + + $data[$uncoveredFile] = []; + + $lines = \count(\file($uncoveredFile)); + + for ($i = 1; $i <= $lines; $i++) { + $data[$uncoveredFile][$i] = Driver::LINE_NOT_EXECUTED; + } + } + + $this->append($data, 'UNCOVERED_FILES_FROM_WHITELIST'); + } + + private function getLinesToBeIgnored(string $fileName): array + { + if (isset($this->ignoredLines[$fileName])) { + return $this->ignoredLines[$fileName]; + } + + try { + return $this->getLinesToBeIgnoredInner($fileName); + } catch (\OutOfBoundsException $e) { + // This can happen with PHP_Token_Stream if the file is syntactically invalid, + // and probably affects a file that wasn't executed. + return []; + } + } + + private function getLinesToBeIgnoredInner(string $fileName): array + { + $this->ignoredLines[$fileName] = []; + + $lines = \file($fileName); + + foreach ($lines as $index => $line) { + if (!\trim($line)) { + $this->ignoredLines[$fileName][] = $index + 1; + } + } + + if ($this->cacheTokens) { + $tokens = \PHP_Token_Stream_CachingFactory::get($fileName); + } else { + $tokens = new \PHP_Token_Stream($fileName); + } + + foreach ($tokens->getInterfaces() as $interface) { + $interfaceStartLine = $interface['startLine']; + $interfaceEndLine = $interface['endLine']; + + foreach (\range($interfaceStartLine, $interfaceEndLine) as $line) { + $this->ignoredLines[$fileName][] = $line; + } + } + + foreach (\array_merge($tokens->getClasses(), $tokens->getTraits()) as $classOrTrait) { + $classOrTraitStartLine = $classOrTrait['startLine']; + $classOrTraitEndLine = $classOrTrait['endLine']; + + if (empty($classOrTrait['methods'])) { + foreach (\range($classOrTraitStartLine, $classOrTraitEndLine) as $line) { + $this->ignoredLines[$fileName][] = $line; + } + + continue; + } + + $firstMethod = \array_shift($classOrTrait['methods']); + $firstMethodStartLine = $firstMethod['startLine']; + $firstMethodEndLine = $firstMethod['endLine']; + $lastMethodEndLine = $firstMethodEndLine; + + do { + $lastMethod = \array_pop($classOrTrait['methods']); + } while ($lastMethod !== null && 0 === \strpos($lastMethod['signature'], 'anonymousFunction')); + + if ($lastMethod !== null) { + $lastMethodEndLine = $lastMethod['endLine']; + } + + foreach (\range($classOrTraitStartLine, $firstMethodStartLine) as $line) { + $this->ignoredLines[$fileName][] = $line; + } + + foreach (\range($lastMethodEndLine + 1, $classOrTraitEndLine) as $line) { + $this->ignoredLines[$fileName][] = $line; + } + } + + if ($this->disableIgnoredLines) { + $this->ignoredLines[$fileName] = \array_unique($this->ignoredLines[$fileName]); + \sort($this->ignoredLines[$fileName]); + + return $this->ignoredLines[$fileName]; + } + + $ignore = false; + $stop = false; + + foreach ($tokens->tokens() as $token) { + switch (\get_class($token)) { + case \PHP_Token_COMMENT::class: + case \PHP_Token_DOC_COMMENT::class: + $_token = \trim($token); + $_line = \trim($lines[$token->getLine() - 1]); + + if ($_token === '// @codeCoverageIgnore' || + $_token === '//@codeCoverageIgnore') { + $ignore = true; + $stop = true; + } elseif ($_token === '// @codeCoverageIgnoreStart' || + $_token === '//@codeCoverageIgnoreStart') { + $ignore = true; + } elseif ($_token === '// @codeCoverageIgnoreEnd' || + $_token === '//@codeCoverageIgnoreEnd') { + $stop = true; + } + + if (!$ignore) { + $start = $token->getLine(); + $end = $start + \substr_count($token, "\n"); + + // Do not ignore the first line when there is a token + // before the comment + if (0 !== \strpos($_token, $_line)) { + $start++; + } + + for ($i = $start; $i < $end; $i++) { + $this->ignoredLines[$fileName][] = $i; + } + + // A DOC_COMMENT token or a COMMENT token starting with "/*" + // does not contain the final \n character in its text + if (isset($lines[$i - 1]) && 0 === \strpos($_token, '/*') && '*/' === \substr(\trim($lines[$i - 1]), -2)) { + $this->ignoredLines[$fileName][] = $i; + } + } + + break; + + case \PHP_Token_INTERFACE::class: + case \PHP_Token_TRAIT::class: + case \PHP_Token_CLASS::class: + case \PHP_Token_FUNCTION::class: + /* @var \PHP_Token_Interface $token */ + + $docblock = $token->getDocblock(); + + $this->ignoredLines[$fileName][] = $token->getLine(); + + if (\strpos($docblock, '@codeCoverageIgnore') || ($this->ignoreDeprecatedCode && \strpos($docblock, '@deprecated'))) { + $endLine = $token->getEndLine(); + + for ($i = $token->getLine(); $i <= $endLine; $i++) { + $this->ignoredLines[$fileName][] = $i; + } + } + + break; + + /* @noinspection PhpMissingBreakStatementInspection */ + case \PHP_Token_NAMESPACE::class: + $this->ignoredLines[$fileName][] = $token->getEndLine(); + + // Intentional fallthrough + case \PHP_Token_DECLARE::class: + case \PHP_Token_OPEN_TAG::class: + case \PHP_Token_CLOSE_TAG::class: + case \PHP_Token_USE::class: + $this->ignoredLines[$fileName][] = $token->getLine(); + + break; + } + + if ($ignore) { + $this->ignoredLines[$fileName][] = $token->getLine(); + + if ($stop) { + $ignore = false; + $stop = false; + } + } + } + + $this->ignoredLines[$fileName][] = \count($lines) + 1; + + $this->ignoredLines[$fileName] = \array_unique( + $this->ignoredLines[$fileName] + ); + + $this->ignoredLines[$fileName] = \array_unique($this->ignoredLines[$fileName]); + \sort($this->ignoredLines[$fileName]); + + return $this->ignoredLines[$fileName]; + } + + /** + * @throws \ReflectionException + * @throws UnintentionallyCoveredCodeException + */ + private function performUnintentionallyCoveredCodeCheck(array &$data, array $linesToBeCovered, array $linesToBeUsed): void + { + $allowedLines = $this->getAllowedLines( + $linesToBeCovered, + $linesToBeUsed + ); + + $unintentionallyCoveredUnits = []; + + foreach ($data as $file => $_data) { + foreach ($_data as $line => $flag) { + if ($flag === 1 && !isset($allowedLines[$file][$line])) { + $unintentionallyCoveredUnits[] = $this->wizard->lookup($file, $line); + } + } + } + + $unintentionallyCoveredUnits = $this->processUnintentionallyCoveredUnits($unintentionallyCoveredUnits); + + if (!empty($unintentionallyCoveredUnits)) { + throw new UnintentionallyCoveredCodeException( + $unintentionallyCoveredUnits + ); + } + } + + /** + * @throws CoveredCodeNotExecutedException + */ + private function performUnexecutedCoveredCodeCheck(array &$data, array $linesToBeCovered, array $linesToBeUsed): void + { + $executedCodeUnits = $this->coverageToCodeUnits($data); + $message = ''; + + foreach ($this->linesToCodeUnits($linesToBeCovered) as $codeUnit) { + if (!\in_array($codeUnit, $executedCodeUnits)) { + $message .= \sprintf( + '- %s is expected to be executed (@covers) but was not executed' . "\n", + $codeUnit + ); + } + } + + foreach ($this->linesToCodeUnits($linesToBeUsed) as $codeUnit) { + if (!\in_array($codeUnit, $executedCodeUnits)) { + $message .= \sprintf( + '- %s is expected to be executed (@uses) but was not executed' . "\n", + $codeUnit + ); + } + } + + if (!empty($message)) { + throw new CoveredCodeNotExecutedException($message); + } + } + + private function getAllowedLines(array $linesToBeCovered, array $linesToBeUsed): array + { + $allowedLines = []; + + foreach (\array_keys($linesToBeCovered) as $file) { + if (!isset($allowedLines[$file])) { + $allowedLines[$file] = []; + } + + $allowedLines[$file] = \array_merge( + $allowedLines[$file], + $linesToBeCovered[$file] + ); + } + + foreach (\array_keys($linesToBeUsed) as $file) { + if (!isset($allowedLines[$file])) { + $allowedLines[$file] = []; + } + + $allowedLines[$file] = \array_merge( + $allowedLines[$file], + $linesToBeUsed[$file] + ); + } + + foreach (\array_keys($allowedLines) as $file) { + $allowedLines[$file] = \array_flip( + \array_unique($allowedLines[$file]) + ); + } + + return $allowedLines; + } + + /** + * @throws RuntimeException + */ + private function selectDriver(Filter $filter): Driver + { + $runtime = new Runtime; + + if (!$runtime->canCollectCodeCoverage()) { + throw new RuntimeException('No code coverage driver available'); + } + + if ($runtime->isPHPDBG()) { + return new PHPDBG; + } + + if ($runtime->hasXdebug()) { + return new Xdebug($filter); + } + + throw new RuntimeException('No code coverage driver available'); + } + + private function processUnintentionallyCoveredUnits(array $unintentionallyCoveredUnits): array + { + $unintentionallyCoveredUnits = \array_unique($unintentionallyCoveredUnits); + \sort($unintentionallyCoveredUnits); + + foreach (\array_keys($unintentionallyCoveredUnits) as $k => $v) { + $unit = \explode('::', $unintentionallyCoveredUnits[$k]); + + if (\count($unit) !== 2) { + continue; + } + + $class = new \ReflectionClass($unit[0]); + + foreach ($this->unintentionallyCoveredSubclassesWhitelist as $whitelisted) { + if ($class->isSubclassOf($whitelisted)) { + unset($unintentionallyCoveredUnits[$k]); + + break; + } + } + } + + return \array_values($unintentionallyCoveredUnits); + } + + /** + * @throws CoveredCodeNotExecutedException + * @throws InvalidArgumentException + * @throws MissingCoversAnnotationException + * @throws RuntimeException + * @throws UnintentionallyCoveredCodeException + * @throws \ReflectionException + */ + private function initializeData(): void + { + $this->isInitialized = true; + + if ($this->processUncoveredFilesFromWhitelist) { + $this->shouldCheckForDeadAndUnused = false; + + $this->driver->start(); + + foreach ($this->filter->getWhitelist() as $file) { + if ($this->filter->isFile($file)) { + include_once $file; + } + } + + $data = []; + $coverage = $this->driver->stop(); + + foreach ($coverage as $file => $fileCoverage) { + if ($this->filter->isFiltered($file)) { + continue; + } + + foreach (\array_keys($fileCoverage) as $key) { + if ($fileCoverage[$key] === Driver::LINE_EXECUTED) { + $fileCoverage[$key] = Driver::LINE_NOT_EXECUTED; + } + } + + $data[$file] = $fileCoverage; + } + + $this->append($data, 'UNCOVERED_FILES_FROM_WHITELIST'); + } + } + + private function coverageToCodeUnits(array $data): array + { + $codeUnits = []; + + foreach ($data as $filename => $lines) { + foreach ($lines as $line => $flag) { + if ($flag === 1) { + $codeUnits[] = $this->wizard->lookup($filename, $line); + } + } + } + + return \array_unique($codeUnits); + } + + private function linesToCodeUnits(array $data): array + { + $codeUnits = []; + + foreach ($data as $filename => $lines) { + foreach ($lines as $line) { + $codeUnits[] = $this->wizard->lookup($filename, $line); + } + } + + return \array_unique($codeUnits); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Driver/Driver.php b/vendor/phpunit/php-code-coverage/src/Driver/Driver.php new file mode 100644 index 0000000..3841996 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Driver/Driver.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage\Driver; + +/** + * Interface for code coverage drivers. + */ +interface Driver +{ + /** + * @var int + * + * @see http://xdebug.org/docs/code_coverage + */ + public const LINE_EXECUTED = 1; + + /** + * @var int + * + * @see http://xdebug.org/docs/code_coverage + */ + public const LINE_NOT_EXECUTED = -1; + + /** + * @var int + * + * @see http://xdebug.org/docs/code_coverage + */ + public const LINE_NOT_EXECUTABLE = -2; + + /** + * Start collection of code coverage information. + */ + public function start(bool $determineUnusedAndDead = true): void; + + /** + * Stop collection of code coverage information. + */ + public function stop(): array; +} diff --git a/vendor/phpunit/php-code-coverage/src/Driver/PHPDBG.php b/vendor/phpunit/php-code-coverage/src/Driver/PHPDBG.php new file mode 100644 index 0000000..a26267b --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Driver/PHPDBG.php @@ -0,0 +1,96 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage\Driver; + +use SebastianBergmann\CodeCoverage\RuntimeException; + +/** + * Driver for PHPDBG's code coverage functionality. + * + * @codeCoverageIgnore + */ +final class PHPDBG implements Driver +{ + /** + * @throws RuntimeException + */ + public function __construct() + { + if (\PHP_SAPI !== 'phpdbg') { + throw new RuntimeException( + 'This driver requires the PHPDBG SAPI' + ); + } + + if (!\function_exists('phpdbg_start_oplog')) { + throw new RuntimeException( + 'This build of PHPDBG does not support code coverage' + ); + } + } + + /** + * Start collection of code coverage information. + */ + public function start(bool $determineUnusedAndDead = true): void + { + \phpdbg_start_oplog(); + } + + /** + * Stop collection of code coverage information. + */ + public function stop(): array + { + static $fetchedLines = []; + + $dbgData = \phpdbg_end_oplog(); + + if ($fetchedLines == []) { + $sourceLines = \phpdbg_get_executable(); + } else { + $newFiles = \array_diff(\get_included_files(), \array_keys($fetchedLines)); + + $sourceLines = []; + + if ($newFiles) { + $sourceLines = phpdbg_get_executable(['files' => $newFiles]); + } + } + + foreach ($sourceLines as $file => $lines) { + foreach ($lines as $lineNo => $numExecuted) { + $sourceLines[$file][$lineNo] = self::LINE_NOT_EXECUTED; + } + } + + $fetchedLines = \array_merge($fetchedLines, $sourceLines); + + return $this->detectExecutedLines($fetchedLines, $dbgData); + } + + /** + * Convert phpdbg based data into the format CodeCoverage expects + */ + private function detectExecutedLines(array $sourceLines, array $dbgData): array + { + foreach ($dbgData as $file => $coveredLines) { + foreach ($coveredLines as $lineNo => $numExecuted) { + // phpdbg also reports $lineNo=0 when e.g. exceptions get thrown. + // make sure we only mark lines executed which are actually executable. + if (isset($sourceLines[$file][$lineNo])) { + $sourceLines[$file][$lineNo] = self::LINE_EXECUTED; + } + } + } + + return $sourceLines; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Driver/Xdebug.php b/vendor/phpunit/php-code-coverage/src/Driver/Xdebug.php new file mode 100644 index 0000000..8c11f88 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Driver/Xdebug.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage\Driver; + +use SebastianBergmann\CodeCoverage\Filter; +use SebastianBergmann\CodeCoverage\RuntimeException; + +/** + * Driver for Xdebug's code coverage functionality. + * + * @codeCoverageIgnore + */ +final class Xdebug implements Driver +{ + /** + * @var array + */ + private $cacheNumLines = []; + + /** + * @var Filter + */ + private $filter; + + /** + * @throws RuntimeException + */ + public function __construct(Filter $filter = null) + { + if (!\extension_loaded('xdebug')) { + throw new RuntimeException('This driver requires Xdebug'); + } + + if (!\ini_get('xdebug.coverage_enable')) { + throw new RuntimeException('xdebug.coverage_enable=On has to be set in php.ini'); + } + + if ($filter === null) { + $filter = new Filter; + } + + $this->filter = $filter; + } + + /** + * Start collection of code coverage information. + */ + public function start(bool $determineUnusedAndDead = true): void + { + if ($determineUnusedAndDead) { + \xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); + } else { + \xdebug_start_code_coverage(); + } + } + + /** + * Stop collection of code coverage information. + */ + public function stop(): array + { + $data = \xdebug_get_code_coverage(); + + \xdebug_stop_code_coverage(); + + return $this->cleanup($data); + } + + private function cleanup(array $data): array + { + foreach (\array_keys($data) as $file) { + unset($data[$file][0]); + + if (!$this->filter->isFile($file)) { + continue; + } + + $numLines = $this->getNumberOfLinesInFile($file); + + foreach (\array_keys($data[$file]) as $line) { + if ($line > $numLines) { + unset($data[$file][$line]); + } + } + } + + return $data; + } + + private function getNumberOfLinesInFile(string $fileName): int + { + if (!isset($this->cacheNumLines[$fileName])) { + $buffer = \file_get_contents($fileName); + $lines = \substr_count($buffer, "\n"); + + if (\substr($buffer, -1) !== "\n") { + $lines++; + } + + $this->cacheNumLines[$fileName] = $lines; + } + + return $this->cacheNumLines[$fileName]; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Exception/CoveredCodeNotExecutedException.php b/vendor/phpunit/php-code-coverage/src/Exception/CoveredCodeNotExecutedException.php new file mode 100644 index 0000000..7cd14ae --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Exception/CoveredCodeNotExecutedException.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage; + +/** + * Exception that is raised when covered code is not executed. + */ +final class CoveredCodeNotExecutedException extends RuntimeException +{ +} diff --git a/vendor/phpunit/php-code-coverage/src/Exception/Exception.php b/vendor/phpunit/php-code-coverage/src/Exception/Exception.php new file mode 100644 index 0000000..155e7db --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Exception/Exception.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage; + +/** + * Exception interface for php-code-coverage component. + */ +interface Exception +{ +} diff --git a/vendor/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php b/vendor/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..cc4defe --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage; + +final class InvalidArgumentException extends \InvalidArgumentException implements Exception +{ + /** + * @param int $argument + * @param string $type + * @param null|mixed $value + * + * @return InvalidArgumentException + */ + public static function create($argument, $type, $value = null): self + { + $stack = \debug_backtrace(0); + + return new self( + \sprintf( + 'Argument #%d%sof %s::%s() must be a %s', + $argument, + $value !== null ? ' (' . \gettype($value) . '#' . $value . ')' : ' (No Value) ', + $stack[1]['class'], + $stack[1]['function'], + $type + ) + ); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Exception/MissingCoversAnnotationException.php b/vendor/phpunit/php-code-coverage/src/Exception/MissingCoversAnnotationException.php new file mode 100644 index 0000000..1f8edbb --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Exception/MissingCoversAnnotationException.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage; + +/** + * Exception that is raised when @covers must be used but is not. + */ +final class MissingCoversAnnotationException extends RuntimeException +{ +} diff --git a/vendor/phpunit/php-code-coverage/src/Exception/RuntimeException.php b/vendor/phpunit/php-code-coverage/src/Exception/RuntimeException.php new file mode 100644 index 0000000..fe0e434 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Exception/RuntimeException.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage; + +class RuntimeException extends \RuntimeException implements Exception +{ +} diff --git a/vendor/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php b/vendor/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php new file mode 100644 index 0000000..ae593bd --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage; + +/** + * Exception that is raised when code is unintentionally covered. + */ +final class UnintentionallyCoveredCodeException extends RuntimeException +{ + /** + * @var array + */ + private $unintentionallyCoveredUnits = []; + + public function __construct(array $unintentionallyCoveredUnits) + { + $this->unintentionallyCoveredUnits = $unintentionallyCoveredUnits; + + parent::__construct($this->toString()); + } + + public function getUnintentionallyCoveredUnits(): array + { + return $this->unintentionallyCoveredUnits; + } + + private function toString(): string + { + $message = ''; + + foreach ($this->unintentionallyCoveredUnits as $unit) { + $message .= '- ' . $unit . "\n"; + } + + return $message; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Filter.php b/vendor/phpunit/php-code-coverage/src/Filter.php new file mode 100644 index 0000000..631e22c --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Filter.php @@ -0,0 +1,164 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage; + +use SebastianBergmann\FileIterator\Facade as FileIteratorFacade; + +/** + * Filter for whitelisting of code coverage information. + */ +final class Filter +{ + /** + * Source files that are whitelisted. + * + * @var array + */ + private $whitelistedFiles = []; + + /** + * Remembers the result of the `is_file()` calls. + * + * @var bool[] + */ + private $isFileCallsCache = []; + + /** + * Adds a directory to the whitelist (recursively). + */ + public function addDirectoryToWhitelist(string $directory, string $suffix = '.php', string $prefix = ''): void + { + $facade = new FileIteratorFacade; + $files = $facade->getFilesAsArray($directory, $suffix, $prefix); + + foreach ($files as $file) { + $this->addFileToWhitelist($file); + } + } + + /** + * Adds a file to the whitelist. + */ + public function addFileToWhitelist(string $filename): void + { + $this->whitelistedFiles[\realpath($filename)] = true; + } + + /** + * Adds files to the whitelist. + * + * @param string[] $files + */ + public function addFilesToWhitelist(array $files): void + { + foreach ($files as $file) { + $this->addFileToWhitelist($file); + } + } + + /** + * Removes a directory from the whitelist (recursively). + */ + public function removeDirectoryFromWhitelist(string $directory, string $suffix = '.php', string $prefix = ''): void + { + $facade = new FileIteratorFacade; + $files = $facade->getFilesAsArray($directory, $suffix, $prefix); + + foreach ($files as $file) { + $this->removeFileFromWhitelist($file); + } + } + + /** + * Removes a file from the whitelist. + */ + public function removeFileFromWhitelist(string $filename): void + { + $filename = \realpath($filename); + + unset($this->whitelistedFiles[$filename]); + } + + /** + * Checks whether a filename is a real filename. + */ + public function isFile(string $filename): bool + { + if (isset($this->isFileCallsCache[$filename])) { + return $this->isFileCallsCache[$filename]; + } + + if ($filename === '-' || + \strpos($filename, 'vfs://') === 0 || + \strpos($filename, 'xdebug://debug-eval') !== false || + \strpos($filename, 'eval()\'d code') !== false || + \strpos($filename, 'runtime-created function') !== false || + \strpos($filename, 'runkit created function') !== false || + \strpos($filename, 'assert code') !== false || + \strpos($filename, 'regexp code') !== false || + \strpos($filename, 'Standard input code') !== false) { + $isFile = false; + } else { + $isFile = \file_exists($filename); + } + + $this->isFileCallsCache[$filename] = $isFile; + + return $isFile; + } + + /** + * Checks whether or not a file is filtered. + */ + public function isFiltered(string $filename): bool + { + if (!$this->isFile($filename)) { + return true; + } + + return !isset($this->whitelistedFiles[$filename]); + } + + /** + * Returns the list of whitelisted files. + * + * @return string[] + */ + public function getWhitelist(): array + { + return \array_keys($this->whitelistedFiles); + } + + /** + * Returns whether this filter has a whitelist. + */ + public function hasWhitelist(): bool + { + return !empty($this->whitelistedFiles); + } + + /** + * Returns the whitelisted files. + * + * @return string[] + */ + public function getWhitelistedFiles(): array + { + return $this->whitelistedFiles; + } + + /** + * Sets the whitelisted files. + */ + public function setWhitelistedFiles(array $whitelistedFiles): void + { + $this->whitelistedFiles = $whitelistedFiles; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Node/AbstractNode.php b/vendor/phpunit/php-code-coverage/src/Node/AbstractNode.php new file mode 100644 index 0000000..5c89261 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Node/AbstractNode.php @@ -0,0 +1,328 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage\Node; + +use SebastianBergmann\CodeCoverage\Util; + +/** + * Base class for nodes in the code coverage information tree. + */ +abstract class AbstractNode implements \Countable +{ + /** + * @var string + */ + private $name; + + /** + * @var string + */ + private $path; + + /** + * @var array + */ + private $pathArray; + + /** + * @var AbstractNode + */ + private $parent; + + /** + * @var string + */ + private $id; + + public function __construct(string $name, self $parent = null) + { + if (\substr($name, -1) == \DIRECTORY_SEPARATOR) { + $name = \substr($name, 0, -1); + } + + $this->name = $name; + $this->parent = $parent; + } + + public function getName(): string + { + return $this->name; + } + + public function getId(): string + { + if ($this->id === null) { + $parent = $this->getParent(); + + if ($parent === null) { + $this->id = 'index'; + } else { + $parentId = $parent->getId(); + + if ($parentId === 'index') { + $this->id = \str_replace(':', '_', $this->name); + } else { + $this->id = $parentId . '/' . $this->name; + } + } + } + + return $this->id; + } + + public function getPath(): string + { + if ($this->path === null) { + if ($this->parent === null || $this->parent->getPath() === null || $this->parent->getPath() === false) { + $this->path = $this->name; + } else { + $this->path = $this->parent->getPath() . \DIRECTORY_SEPARATOR . $this->name; + } + } + + return $this->path; + } + + public function getPathAsArray(): array + { + if ($this->pathArray === null) { + if ($this->parent === null) { + $this->pathArray = []; + } else { + $this->pathArray = $this->parent->getPathAsArray(); + } + + $this->pathArray[] = $this; + } + + return $this->pathArray; + } + + public function getParent(): ?self + { + return $this->parent; + } + + /** + * Returns the percentage of classes that has been tested. + * + * @return int|string + */ + public function getTestedClassesPercent(bool $asString = true) + { + return Util::percent( + $this->getNumTestedClasses(), + $this->getNumClasses(), + $asString + ); + } + + /** + * Returns the percentage of traits that has been tested. + * + * @return int|string + */ + public function getTestedTraitsPercent(bool $asString = true) + { + return Util::percent( + $this->getNumTestedTraits(), + $this->getNumTraits(), + $asString + ); + } + + /** + * Returns the percentage of classes and traits that has been tested. + * + * @return int|string + */ + public function getTestedClassesAndTraitsPercent(bool $asString = true) + { + return Util::percent( + $this->getNumTestedClassesAndTraits(), + $this->getNumClassesAndTraits(), + $asString + ); + } + + /** + * Returns the percentage of functions that has been tested. + * + * @return int|string + */ + public function getTestedFunctionsPercent(bool $asString = true) + { + return Util::percent( + $this->getNumTestedFunctions(), + $this->getNumFunctions(), + $asString + ); + } + + /** + * Returns the percentage of methods that has been tested. + * + * @return int|string + */ + public function getTestedMethodsPercent(bool $asString = true) + { + return Util::percent( + $this->getNumTestedMethods(), + $this->getNumMethods(), + $asString + ); + } + + /** + * Returns the percentage of functions and methods that has been tested. + * + * @return int|string + */ + public function getTestedFunctionsAndMethodsPercent(bool $asString = true) + { + return Util::percent( + $this->getNumTestedFunctionsAndMethods(), + $this->getNumFunctionsAndMethods(), + $asString + ); + } + + /** + * Returns the percentage of executed lines. + * + * @return int|string + */ + public function getLineExecutedPercent(bool $asString = true) + { + return Util::percent( + $this->getNumExecutedLines(), + $this->getNumExecutableLines(), + $asString + ); + } + + /** + * Returns the number of classes and traits. + */ + public function getNumClassesAndTraits(): int + { + return $this->getNumClasses() + $this->getNumTraits(); + } + + /** + * Returns the number of tested classes and traits. + */ + public function getNumTestedClassesAndTraits(): int + { + return $this->getNumTestedClasses() + $this->getNumTestedTraits(); + } + + /** + * Returns the classes and traits of this node. + */ + public function getClassesAndTraits(): array + { + return \array_merge($this->getClasses(), $this->getTraits()); + } + + /** + * Returns the number of functions and methods. + */ + public function getNumFunctionsAndMethods(): int + { + return $this->getNumFunctions() + $this->getNumMethods(); + } + + /** + * Returns the number of tested functions and methods. + */ + public function getNumTestedFunctionsAndMethods(): int + { + return $this->getNumTestedFunctions() + $this->getNumTestedMethods(); + } + + /** + * Returns the functions and methods of this node. + */ + public function getFunctionsAndMethods(): array + { + return \array_merge($this->getFunctions(), $this->getMethods()); + } + + /** + * Returns the classes of this node. + */ + abstract public function getClasses(): array; + + /** + * Returns the traits of this node. + */ + abstract public function getTraits(): array; + + /** + * Returns the functions of this node. + */ + abstract public function getFunctions(): array; + + /** + * Returns the LOC/CLOC/NCLOC of this node. + */ + abstract public function getLinesOfCode(): array; + + /** + * Returns the number of executable lines. + */ + abstract public function getNumExecutableLines(): int; + + /** + * Returns the number of executed lines. + */ + abstract public function getNumExecutedLines(): int; + + /** + * Returns the number of classes. + */ + abstract public function getNumClasses(): int; + + /** + * Returns the number of tested classes. + */ + abstract public function getNumTestedClasses(): int; + + /** + * Returns the number of traits. + */ + abstract public function getNumTraits(): int; + + /** + * Returns the number of tested traits. + */ + abstract public function getNumTestedTraits(): int; + + /** + * Returns the number of methods. + */ + abstract public function getNumMethods(): int; + + /** + * Returns the number of tested methods. + */ + abstract public function getNumTestedMethods(): int; + + /** + * Returns the number of functions. + */ + abstract public function getNumFunctions(): int; + + /** + * Returns the number of tested functions. + */ + abstract public function getNumTestedFunctions(): int; +} diff --git a/vendor/phpunit/php-code-coverage/src/Node/Builder.php b/vendor/phpunit/php-code-coverage/src/Node/Builder.php new file mode 100644 index 0000000..9e4ac24 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Node/Builder.php @@ -0,0 +1,225 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage\Node; + +use SebastianBergmann\CodeCoverage\CodeCoverage; + +final class Builder +{ + public function build(CodeCoverage $coverage): Directory + { + $files = $coverage->getData(); + $commonPath = $this->reducePaths($files); + $root = new Directory( + $commonPath, + null + ); + + $this->addItems( + $root, + $this->buildDirectoryStructure($files), + $coverage->getTests(), + $coverage->getCacheTokens() + ); + + return $root; + } + + private function addItems(Directory $root, array $items, array $tests, bool $cacheTokens): void + { + foreach ($items as $key => $value) { + if (\substr($key, -2) == '/f') { + $key = \substr($key, 0, -2); + + if (\file_exists($root->getPath() . \DIRECTORY_SEPARATOR . $key)) { + $root->addFile($key, $value, $tests, $cacheTokens); + } + } else { + $child = $root->addDirectory($key); + $this->addItems($child, $value, $tests, $cacheTokens); + } + } + } + + /** + * Builds an array representation of the directory structure. + * + * For instance, + * + * + * Array + * ( + * [Money.php] => Array + * ( + * ... + * ) + * + * [MoneyBag.php] => Array + * ( + * ... + * ) + * ) + * + * + * is transformed into + * + * + * Array + * ( + * [.] => Array + * ( + * [Money.php] => Array + * ( + * ... + * ) + * + * [MoneyBag.php] => Array + * ( + * ... + * ) + * ) + * ) + * + */ + private function buildDirectoryStructure(array $files): array + { + $result = []; + + foreach ($files as $path => $file) { + $path = \explode(\DIRECTORY_SEPARATOR, $path); + $pointer = &$result; + $max = \count($path); + + for ($i = 0; $i < $max; $i++) { + $type = ''; + + if ($i == ($max - 1)) { + $type = '/f'; + } + + $pointer = &$pointer[$path[$i] . $type]; + } + + $pointer = $file; + } + + return $result; + } + + /** + * Reduces the paths by cutting the longest common start path. + * + * For instance, + * + * + * Array + * ( + * [/home/sb/Money/Money.php] => Array + * ( + * ... + * ) + * + * [/home/sb/Money/MoneyBag.php] => Array + * ( + * ... + * ) + * ) + * + * + * is reduced to + * + * + * Array + * ( + * [Money.php] => Array + * ( + * ... + * ) + * + * [MoneyBag.php] => Array + * ( + * ... + * ) + * ) + * + */ + private function reducePaths(array &$files): string + { + if (empty($files)) { + return '.'; + } + + $commonPath = ''; + $paths = \array_keys($files); + + if (\count($files) === 1) { + $commonPath = \dirname($paths[0]) . \DIRECTORY_SEPARATOR; + $files[\basename($paths[0])] = $files[$paths[0]]; + + unset($files[$paths[0]]); + + return $commonPath; + } + + $max = \count($paths); + + for ($i = 0; $i < $max; $i++) { + // strip phar:// prefixes + if (\strpos($paths[$i], 'phar://') === 0) { + $paths[$i] = \substr($paths[$i], 7); + $paths[$i] = \str_replace('/', \DIRECTORY_SEPARATOR, $paths[$i]); + } + $paths[$i] = \explode(\DIRECTORY_SEPARATOR, $paths[$i]); + + if (empty($paths[$i][0])) { + $paths[$i][0] = \DIRECTORY_SEPARATOR; + } + } + + $done = false; + $max = \count($paths); + + while (!$done) { + for ($i = 0; $i < $max - 1; $i++) { + if (!isset($paths[$i][0]) || + !isset($paths[$i + 1][0]) || + $paths[$i][0] != $paths[$i + 1][0]) { + $done = true; + + break; + } + } + + if (!$done) { + $commonPath .= $paths[0][0]; + + if ($paths[0][0] != \DIRECTORY_SEPARATOR) { + $commonPath .= \DIRECTORY_SEPARATOR; + } + + for ($i = 0; $i < $max; $i++) { + \array_shift($paths[$i]); + } + } + } + + $original = \array_keys($files); + $max = \count($original); + + for ($i = 0; $i < $max; $i++) { + $files[\implode(\DIRECTORY_SEPARATOR, $paths[$i])] = $files[$original[$i]]; + unset($files[$original[$i]]); + } + + \ksort($files); + + return \substr($commonPath, 0, -1); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Node/Directory.php b/vendor/phpunit/php-code-coverage/src/Node/Directory.php new file mode 100644 index 0000000..a82b8ea --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Node/Directory.php @@ -0,0 +1,427 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage\Node; + +use SebastianBergmann\CodeCoverage\InvalidArgumentException; + +/** + * Represents a directory in the code coverage information tree. + */ +final class Directory extends AbstractNode implements \IteratorAggregate +{ + /** + * @var AbstractNode[] + */ + private $children = []; + + /** + * @var Directory[] + */ + private $directories = []; + + /** + * @var File[] + */ + private $files = []; + + /** + * @var array + */ + private $classes; + + /** + * @var array + */ + private $traits; + + /** + * @var array + */ + private $functions; + + /** + * @var array + */ + private $linesOfCode; + + /** + * @var int + */ + private $numFiles = -1; + + /** + * @var int + */ + private $numExecutableLines = -1; + + /** + * @var int + */ + private $numExecutedLines = -1; + + /** + * @var int + */ + private $numClasses = -1; + + /** + * @var int + */ + private $numTestedClasses = -1; + + /** + * @var int + */ + private $numTraits = -1; + + /** + * @var int + */ + private $numTestedTraits = -1; + + /** + * @var int + */ + private $numMethods = -1; + + /** + * @var int + */ + private $numTestedMethods = -1; + + /** + * @var int + */ + private $numFunctions = -1; + + /** + * @var int + */ + private $numTestedFunctions = -1; + + /** + * Returns the number of files in/under this node. + */ + public function count(): int + { + if ($this->numFiles === -1) { + $this->numFiles = 0; + + foreach ($this->children as $child) { + $this->numFiles += \count($child); + } + } + + return $this->numFiles; + } + + /** + * Returns an iterator for this node. + */ + public function getIterator(): \RecursiveIteratorIterator + { + return new \RecursiveIteratorIterator( + new Iterator($this), + \RecursiveIteratorIterator::SELF_FIRST + ); + } + + /** + * Adds a new directory. + */ + public function addDirectory(string $name): self + { + $directory = new self($name, $this); + + $this->children[] = $directory; + $this->directories[] = &$this->children[\count($this->children) - 1]; + + return $directory; + } + + /** + * Adds a new file. + * + * @throws InvalidArgumentException + */ + public function addFile(string $name, array $coverageData, array $testData, bool $cacheTokens): File + { + $file = new File($name, $this, $coverageData, $testData, $cacheTokens); + + $this->children[] = $file; + $this->files[] = &$this->children[\count($this->children) - 1]; + + $this->numExecutableLines = -1; + $this->numExecutedLines = -1; + + return $file; + } + + /** + * Returns the directories in this directory. + */ + public function getDirectories(): array + { + return $this->directories; + } + + /** + * Returns the files in this directory. + */ + public function getFiles(): array + { + return $this->files; + } + + /** + * Returns the child nodes of this node. + */ + public function getChildNodes(): array + { + return $this->children; + } + + /** + * Returns the classes of this node. + */ + public function getClasses(): array + { + if ($this->classes === null) { + $this->classes = []; + + foreach ($this->children as $child) { + $this->classes = \array_merge( + $this->classes, + $child->getClasses() + ); + } + } + + return $this->classes; + } + + /** + * Returns the traits of this node. + */ + public function getTraits(): array + { + if ($this->traits === null) { + $this->traits = []; + + foreach ($this->children as $child) { + $this->traits = \array_merge( + $this->traits, + $child->getTraits() + ); + } + } + + return $this->traits; + } + + /** + * Returns the functions of this node. + */ + public function getFunctions(): array + { + if ($this->functions === null) { + $this->functions = []; + + foreach ($this->children as $child) { + $this->functions = \array_merge( + $this->functions, + $child->getFunctions() + ); + } + } + + return $this->functions; + } + + /** + * Returns the LOC/CLOC/NCLOC of this node. + */ + public function getLinesOfCode(): array + { + if ($this->linesOfCode === null) { + $this->linesOfCode = ['loc' => 0, 'cloc' => 0, 'ncloc' => 0]; + + foreach ($this->children as $child) { + $linesOfCode = $child->getLinesOfCode(); + + $this->linesOfCode['loc'] += $linesOfCode['loc']; + $this->linesOfCode['cloc'] += $linesOfCode['cloc']; + $this->linesOfCode['ncloc'] += $linesOfCode['ncloc']; + } + } + + return $this->linesOfCode; + } + + /** + * Returns the number of executable lines. + */ + public function getNumExecutableLines(): int + { + if ($this->numExecutableLines === -1) { + $this->numExecutableLines = 0; + + foreach ($this->children as $child) { + $this->numExecutableLines += $child->getNumExecutableLines(); + } + } + + return $this->numExecutableLines; + } + + /** + * Returns the number of executed lines. + */ + public function getNumExecutedLines(): int + { + if ($this->numExecutedLines === -1) { + $this->numExecutedLines = 0; + + foreach ($this->children as $child) { + $this->numExecutedLines += $child->getNumExecutedLines(); + } + } + + return $this->numExecutedLines; + } + + /** + * Returns the number of classes. + */ + public function getNumClasses(): int + { + if ($this->numClasses === -1) { + $this->numClasses = 0; + + foreach ($this->children as $child) { + $this->numClasses += $child->getNumClasses(); + } + } + + return $this->numClasses; + } + + /** + * Returns the number of tested classes. + */ + public function getNumTestedClasses(): int + { + if ($this->numTestedClasses === -1) { + $this->numTestedClasses = 0; + + foreach ($this->children as $child) { + $this->numTestedClasses += $child->getNumTestedClasses(); + } + } + + return $this->numTestedClasses; + } + + /** + * Returns the number of traits. + */ + public function getNumTraits(): int + { + if ($this->numTraits === -1) { + $this->numTraits = 0; + + foreach ($this->children as $child) { + $this->numTraits += $child->getNumTraits(); + } + } + + return $this->numTraits; + } + + /** + * Returns the number of tested traits. + */ + public function getNumTestedTraits(): int + { + if ($this->numTestedTraits === -1) { + $this->numTestedTraits = 0; + + foreach ($this->children as $child) { + $this->numTestedTraits += $child->getNumTestedTraits(); + } + } + + return $this->numTestedTraits; + } + + /** + * Returns the number of methods. + */ + public function getNumMethods(): int + { + if ($this->numMethods === -1) { + $this->numMethods = 0; + + foreach ($this->children as $child) { + $this->numMethods += $child->getNumMethods(); + } + } + + return $this->numMethods; + } + + /** + * Returns the number of tested methods. + */ + public function getNumTestedMethods(): int + { + if ($this->numTestedMethods === -1) { + $this->numTestedMethods = 0; + + foreach ($this->children as $child) { + $this->numTestedMethods += $child->getNumTestedMethods(); + } + } + + return $this->numTestedMethods; + } + + /** + * Returns the number of functions. + */ + public function getNumFunctions(): int + { + if ($this->numFunctions === -1) { + $this->numFunctions = 0; + + foreach ($this->children as $child) { + $this->numFunctions += $child->getNumFunctions(); + } + } + + return $this->numFunctions; + } + + /** + * Returns the number of tested functions. + */ + public function getNumTestedFunctions(): int + { + if ($this->numTestedFunctions === -1) { + $this->numTestedFunctions = 0; + + foreach ($this->children as $child) { + $this->numTestedFunctions += $child->getNumTestedFunctions(); + } + } + + return $this->numTestedFunctions; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Node/File.php b/vendor/phpunit/php-code-coverage/src/Node/File.php new file mode 100644 index 0000000..8355cda --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Node/File.php @@ -0,0 +1,611 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage\Node; + +/** + * Represents a file in the code coverage information tree. + */ +final class File extends AbstractNode +{ + /** + * @var array + */ + private $coverageData; + + /** + * @var array + */ + private $testData; + + /** + * @var int + */ + private $numExecutableLines = 0; + + /** + * @var int + */ + private $numExecutedLines = 0; + + /** + * @var array + */ + private $classes = []; + + /** + * @var array + */ + private $traits = []; + + /** + * @var array + */ + private $functions = []; + + /** + * @var array + */ + private $linesOfCode = []; + + /** + * @var int + */ + private $numClasses; + + /** + * @var int + */ + private $numTestedClasses = 0; + + /** + * @var int + */ + private $numTraits; + + /** + * @var int + */ + private $numTestedTraits = 0; + + /** + * @var int + */ + private $numMethods; + + /** + * @var int + */ + private $numTestedMethods; + + /** + * @var int + */ + private $numTestedFunctions; + + /** + * @var bool + */ + private $cacheTokens; + + /** + * @var array + */ + private $codeUnitsByLine = []; + + public function __construct(string $name, AbstractNode $parent, array $coverageData, array $testData, bool $cacheTokens) + { + parent::__construct($name, $parent); + + $this->coverageData = $coverageData; + $this->testData = $testData; + $this->cacheTokens = $cacheTokens; + + $this->calculateStatistics(); + } + + /** + * Returns the number of files in/under this node. + */ + public function count(): int + { + return 1; + } + + /** + * Returns the code coverage data of this node. + */ + public function getCoverageData(): array + { + return $this->coverageData; + } + + /** + * Returns the test data of this node. + */ + public function getTestData(): array + { + return $this->testData; + } + + /** + * Returns the classes of this node. + */ + public function getClasses(): array + { + return $this->classes; + } + + /** + * Returns the traits of this node. + */ + public function getTraits(): array + { + return $this->traits; + } + + /** + * Returns the functions of this node. + */ + public function getFunctions(): array + { + return $this->functions; + } + + /** + * Returns the LOC/CLOC/NCLOC of this node. + */ + public function getLinesOfCode(): array + { + return $this->linesOfCode; + } + + /** + * Returns the number of executable lines. + */ + public function getNumExecutableLines(): int + { + return $this->numExecutableLines; + } + + /** + * Returns the number of executed lines. + */ + public function getNumExecutedLines(): int + { + return $this->numExecutedLines; + } + + /** + * Returns the number of classes. + */ + public function getNumClasses(): int + { + if ($this->numClasses === null) { + $this->numClasses = 0; + + foreach ($this->classes as $class) { + foreach ($class['methods'] as $method) { + if ($method['executableLines'] > 0) { + $this->numClasses++; + + continue 2; + } + } + } + } + + return $this->numClasses; + } + + /** + * Returns the number of tested classes. + */ + public function getNumTestedClasses(): int + { + return $this->numTestedClasses; + } + + /** + * Returns the number of traits. + */ + public function getNumTraits(): int + { + if ($this->numTraits === null) { + $this->numTraits = 0; + + foreach ($this->traits as $trait) { + foreach ($trait['methods'] as $method) { + if ($method['executableLines'] > 0) { + $this->numTraits++; + + continue 2; + } + } + } + } + + return $this->numTraits; + } + + /** + * Returns the number of tested traits. + */ + public function getNumTestedTraits(): int + { + return $this->numTestedTraits; + } + + /** + * Returns the number of methods. + */ + public function getNumMethods(): int + { + if ($this->numMethods === null) { + $this->numMethods = 0; + + foreach ($this->classes as $class) { + foreach ($class['methods'] as $method) { + if ($method['executableLines'] > 0) { + $this->numMethods++; + } + } + } + + foreach ($this->traits as $trait) { + foreach ($trait['methods'] as $method) { + if ($method['executableLines'] > 0) { + $this->numMethods++; + } + } + } + } + + return $this->numMethods; + } + + /** + * Returns the number of tested methods. + */ + public function getNumTestedMethods(): int + { + if ($this->numTestedMethods === null) { + $this->numTestedMethods = 0; + + foreach ($this->classes as $class) { + foreach ($class['methods'] as $method) { + if ($method['executableLines'] > 0 && + $method['coverage'] === 100) { + $this->numTestedMethods++; + } + } + } + + foreach ($this->traits as $trait) { + foreach ($trait['methods'] as $method) { + if ($method['executableLines'] > 0 && + $method['coverage'] === 100) { + $this->numTestedMethods++; + } + } + } + } + + return $this->numTestedMethods; + } + + /** + * Returns the number of functions. + */ + public function getNumFunctions(): int + { + return \count($this->functions); + } + + /** + * Returns the number of tested functions. + */ + public function getNumTestedFunctions(): int + { + if ($this->numTestedFunctions === null) { + $this->numTestedFunctions = 0; + + foreach ($this->functions as $function) { + if ($function['executableLines'] > 0 && + $function['coverage'] === 100) { + $this->numTestedFunctions++; + } + } + } + + return $this->numTestedFunctions; + } + + private function calculateStatistics(): void + { + if ($this->cacheTokens) { + $tokens = \PHP_Token_Stream_CachingFactory::get($this->getPath()); + } else { + $tokens = new \PHP_Token_Stream($this->getPath()); + } + + $this->linesOfCode = $tokens->getLinesOfCode(); + + foreach (\range(1, $this->linesOfCode['loc']) as $lineNumber) { + $this->codeUnitsByLine[$lineNumber] = []; + } + + try { + $this->processClasses($tokens); + $this->processTraits($tokens); + $this->processFunctions($tokens); + } catch (\OutOfBoundsException $e) { + // This can happen with PHP_Token_Stream if the file is syntactically invalid, + // and probably affects a file that wasn't executed. + } + unset($tokens); + + foreach (\range(1, $this->linesOfCode['loc']) as $lineNumber) { + if (isset($this->coverageData[$lineNumber])) { + foreach ($this->codeUnitsByLine[$lineNumber] as &$codeUnit) { + $codeUnit['executableLines']++; + } + + unset($codeUnit); + + $this->numExecutableLines++; + + if (\count($this->coverageData[$lineNumber]) > 0) { + foreach ($this->codeUnitsByLine[$lineNumber] as &$codeUnit) { + $codeUnit['executedLines']++; + } + + unset($codeUnit); + + $this->numExecutedLines++; + } + } + } + + foreach ($this->traits as &$trait) { + foreach ($trait['methods'] as &$method) { + if ($method['executableLines'] > 0) { + $method['coverage'] = ($method['executedLines'] / + $method['executableLines']) * 100; + } else { + $method['coverage'] = 100; + } + + $method['crap'] = $this->crap( + $method['ccn'], + $method['coverage'] + ); + + $trait['ccn'] += $method['ccn']; + } + + unset($method); + + if ($trait['executableLines'] > 0) { + $trait['coverage'] = ($trait['executedLines'] / + $trait['executableLines']) * 100; + + if ($trait['coverage'] === 100) { + $this->numTestedClasses++; + } + } else { + $trait['coverage'] = 100; + } + + $trait['crap'] = $this->crap( + $trait['ccn'], + $trait['coverage'] + ); + } + + unset($trait); + + foreach ($this->classes as &$class) { + foreach ($class['methods'] as &$method) { + if ($method['executableLines'] > 0) { + $method['coverage'] = ($method['executedLines'] / + $method['executableLines']) * 100; + } else { + $method['coverage'] = 100; + } + + $method['crap'] = $this->crap( + $method['ccn'], + $method['coverage'] + ); + + $class['ccn'] += $method['ccn']; + } + + unset($method); + + if ($class['executableLines'] > 0) { + $class['coverage'] = ($class['executedLines'] / + $class['executableLines']) * 100; + + if ($class['coverage'] === 100) { + $this->numTestedClasses++; + } + } else { + $class['coverage'] = 100; + } + + $class['crap'] = $this->crap( + $class['ccn'], + $class['coverage'] + ); + } + + unset($class); + + foreach ($this->functions as &$function) { + if ($function['executableLines'] > 0) { + $function['coverage'] = ($function['executedLines'] / + $function['executableLines']) * 100; + } else { + $function['coverage'] = 100; + } + + if ($function['coverage'] === 100) { + $this->numTestedFunctions++; + } + + $function['crap'] = $this->crap( + $function['ccn'], + $function['coverage'] + ); + } + } + + private function processClasses(\PHP_Token_Stream $tokens): void + { + $classes = $tokens->getClasses(); + $link = $this->getId() . '.html#'; + + foreach ($classes as $className => $class) { + if (\strpos($className, 'anonymous') === 0) { + continue; + } + + if (!empty($class['package']['namespace'])) { + $className = $class['package']['namespace'] . '\\' . $className; + } + + $this->classes[$className] = [ + 'className' => $className, + 'methods' => [], + 'startLine' => $class['startLine'], + 'executableLines' => 0, + 'executedLines' => 0, + 'ccn' => 0, + 'coverage' => 0, + 'crap' => 0, + 'package' => $class['package'], + 'link' => $link . $class['startLine'], + ]; + + foreach ($class['methods'] as $methodName => $method) { + if (\strpos($methodName, 'anonymous') === 0) { + continue; + } + + $this->classes[$className]['methods'][$methodName] = $this->newMethod($methodName, $method, $link); + + foreach (\range($method['startLine'], $method['endLine']) as $lineNumber) { + $this->codeUnitsByLine[$lineNumber] = [ + &$this->classes[$className], + &$this->classes[$className]['methods'][$methodName], + ]; + } + } + } + } + + private function processTraits(\PHP_Token_Stream $tokens): void + { + $traits = $tokens->getTraits(); + $link = $this->getId() . '.html#'; + + foreach ($traits as $traitName => $trait) { + $this->traits[$traitName] = [ + 'traitName' => $traitName, + 'methods' => [], + 'startLine' => $trait['startLine'], + 'executableLines' => 0, + 'executedLines' => 0, + 'ccn' => 0, + 'coverage' => 0, + 'crap' => 0, + 'package' => $trait['package'], + 'link' => $link . $trait['startLine'], + ]; + + foreach ($trait['methods'] as $methodName => $method) { + if (\strpos($methodName, 'anonymous') === 0) { + continue; + } + + $this->traits[$traitName]['methods'][$methodName] = $this->newMethod($methodName, $method, $link); + + foreach (\range($method['startLine'], $method['endLine']) as $lineNumber) { + $this->codeUnitsByLine[$lineNumber] = [ + &$this->traits[$traitName], + &$this->traits[$traitName]['methods'][$methodName], + ]; + } + } + } + } + + private function processFunctions(\PHP_Token_Stream $tokens): void + { + $functions = $tokens->getFunctions(); + $link = $this->getId() . '.html#'; + + foreach ($functions as $functionName => $function) { + if (\strpos($functionName, 'anonymous') === 0) { + continue; + } + + $this->functions[$functionName] = [ + 'functionName' => $functionName, + 'signature' => $function['signature'], + 'startLine' => $function['startLine'], + 'executableLines' => 0, + 'executedLines' => 0, + 'ccn' => $function['ccn'], + 'coverage' => 0, + 'crap' => 0, + 'link' => $link . $function['startLine'], + ]; + + foreach (\range($function['startLine'], $function['endLine']) as $lineNumber) { + $this->codeUnitsByLine[$lineNumber] = [&$this->functions[$functionName]]; + } + } + } + + private function crap(int $ccn, float $coverage): string + { + if ($coverage === 0) { + return (string) ($ccn ** 2 + $ccn); + } + + if ($coverage >= 95) { + return (string) $ccn; + } + + return \sprintf( + '%01.2F', + $ccn ** 2 * (1 - $coverage / 100) ** 3 + $ccn + ); + } + + private function newMethod(string $methodName, array $method, string $link): array + { + return [ + 'methodName' => $methodName, + 'visibility' => $method['visibility'], + 'signature' => $method['signature'], + 'startLine' => $method['startLine'], + 'endLine' => $method['endLine'], + 'executableLines' => 0, + 'executedLines' => 0, + 'ccn' => $method['ccn'], + 'coverage' => 0, + 'crap' => 0, + 'link' => $link . $method['startLine'], + ]; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Node/Iterator.php b/vendor/phpunit/php-code-coverage/src/Node/Iterator.php new file mode 100644 index 0000000..81af4f0 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Node/Iterator.php @@ -0,0 +1,89 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage\Node; + +/** + * Recursive iterator for node object graphs. + */ +final class Iterator implements \RecursiveIterator +{ + /** + * @var int + */ + private $position; + + /** + * @var AbstractNode[] + */ + private $nodes; + + public function __construct(Directory $node) + { + $this->nodes = $node->getChildNodes(); + } + + /** + * Rewinds the Iterator to the first element. + */ + public function rewind(): void + { + $this->position = 0; + } + + /** + * Checks if there is a current element after calls to rewind() or next(). + */ + public function valid(): bool + { + return $this->position < \count($this->nodes); + } + + /** + * Returns the key of the current element. + */ + public function key(): int + { + return $this->position; + } + + /** + * Returns the current element. + */ + public function current(): AbstractNode + { + return $this->valid() ? $this->nodes[$this->position] : null; + } + + /** + * Moves forward to next element. + */ + public function next(): void + { + $this->position++; + } + + /** + * Returns the sub iterator for the current element. + * + * @return Iterator + */ + public function getChildren(): self + { + return new self($this->nodes[$this->position]); + } + + /** + * Checks whether the current element has children. + */ + public function hasChildren(): bool + { + return $this->nodes[$this->position] instanceof Directory; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Clover.php b/vendor/phpunit/php-code-coverage/src/Report/Clover.php new file mode 100644 index 0000000..2b28e60 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Clover.php @@ -0,0 +1,258 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage\Report; + +use SebastianBergmann\CodeCoverage\CodeCoverage; +use SebastianBergmann\CodeCoverage\Node\File; +use SebastianBergmann\CodeCoverage\RuntimeException; + +/** + * Generates a Clover XML logfile from a code coverage object. + */ +final class Clover +{ + /** + * @throws \RuntimeException + */ + public function process(CodeCoverage $coverage, ?string $target = null, ?string $name = null): string + { + $xmlDocument = new \DOMDocument('1.0', 'UTF-8'); + $xmlDocument->formatOutput = true; + + $xmlCoverage = $xmlDocument->createElement('coverage'); + $xmlCoverage->setAttribute('generated', (int) $_SERVER['REQUEST_TIME']); + $xmlDocument->appendChild($xmlCoverage); + + $xmlProject = $xmlDocument->createElement('project'); + $xmlProject->setAttribute('timestamp', (int) $_SERVER['REQUEST_TIME']); + + if (\is_string($name)) { + $xmlProject->setAttribute('name', $name); + } + + $xmlCoverage->appendChild($xmlProject); + + $packages = []; + $report = $coverage->getReport(); + + foreach ($report as $item) { + if (!$item instanceof File) { + continue; + } + + /* @var File $item */ + + $xmlFile = $xmlDocument->createElement('file'); + $xmlFile->setAttribute('name', $item->getPath()); + + $classes = $item->getClassesAndTraits(); + $coverageData = $item->getCoverageData(); + $lines = []; + $namespace = 'global'; + + foreach ($classes as $className => $class) { + $classStatements = 0; + $coveredClassStatements = 0; + $coveredMethods = 0; + $classMethods = 0; + + foreach ($class['methods'] as $methodName => $method) { + if ($method['executableLines'] == 0) { + continue; + } + + $classMethods++; + $classStatements += $method['executableLines']; + $coveredClassStatements += $method['executedLines']; + + if ($method['coverage'] == 100) { + $coveredMethods++; + } + + $methodCount = 0; + + foreach (\range($method['startLine'], $method['endLine']) as $line) { + if (isset($coverageData[$line]) && ($coverageData[$line] !== null)) { + $methodCount = \max($methodCount, \count($coverageData[$line])); + } + } + + $lines[$method['startLine']] = [ + 'ccn' => $method['ccn'], + 'count' => $methodCount, + 'crap' => $method['crap'], + 'type' => 'method', + 'visibility' => $method['visibility'], + 'name' => $methodName, + ]; + } + + if (!empty($class['package']['namespace'])) { + $namespace = $class['package']['namespace']; + } + + $xmlClass = $xmlDocument->createElement('class'); + $xmlClass->setAttribute('name', $className); + $xmlClass->setAttribute('namespace', $namespace); + + if (!empty($class['package']['fullPackage'])) { + $xmlClass->setAttribute( + 'fullPackage', + $class['package']['fullPackage'] + ); + } + + if (!empty($class['package']['category'])) { + $xmlClass->setAttribute( + 'category', + $class['package']['category'] + ); + } + + if (!empty($class['package']['package'])) { + $xmlClass->setAttribute( + 'package', + $class['package']['package'] + ); + } + + if (!empty($class['package']['subpackage'])) { + $xmlClass->setAttribute( + 'subpackage', + $class['package']['subpackage'] + ); + } + + $xmlFile->appendChild($xmlClass); + + $xmlMetrics = $xmlDocument->createElement('metrics'); + $xmlMetrics->setAttribute('complexity', $class['ccn']); + $xmlMetrics->setAttribute('methods', $classMethods); + $xmlMetrics->setAttribute('coveredmethods', $coveredMethods); + $xmlMetrics->setAttribute('conditionals', 0); + $xmlMetrics->setAttribute('coveredconditionals', 0); + $xmlMetrics->setAttribute('statements', $classStatements); + $xmlMetrics->setAttribute('coveredstatements', $coveredClassStatements); + $xmlMetrics->setAttribute('elements', $classMethods + $classStatements /* + conditionals */); + $xmlMetrics->setAttribute('coveredelements', $coveredMethods + $coveredClassStatements /* + coveredconditionals */); + $xmlClass->appendChild($xmlMetrics); + } + + foreach ($coverageData as $line => $data) { + if ($data === null || isset($lines[$line])) { + continue; + } + + $lines[$line] = [ + 'count' => \count($data), 'type' => 'stmt', + ]; + } + + \ksort($lines); + + foreach ($lines as $line => $data) { + $xmlLine = $xmlDocument->createElement('line'); + $xmlLine->setAttribute('num', $line); + $xmlLine->setAttribute('type', $data['type']); + + if (isset($data['name'])) { + $xmlLine->setAttribute('name', $data['name']); + } + + if (isset($data['visibility'])) { + $xmlLine->setAttribute('visibility', $data['visibility']); + } + + if (isset($data['ccn'])) { + $xmlLine->setAttribute('complexity', $data['ccn']); + } + + if (isset($data['crap'])) { + $xmlLine->setAttribute('crap', $data['crap']); + } + + $xmlLine->setAttribute('count', $data['count']); + $xmlFile->appendChild($xmlLine); + } + + $linesOfCode = $item->getLinesOfCode(); + + $xmlMetrics = $xmlDocument->createElement('metrics'); + $xmlMetrics->setAttribute('loc', $linesOfCode['loc']); + $xmlMetrics->setAttribute('ncloc', $linesOfCode['ncloc']); + $xmlMetrics->setAttribute('classes', $item->getNumClassesAndTraits()); + $xmlMetrics->setAttribute('methods', $item->getNumMethods()); + $xmlMetrics->setAttribute('coveredmethods', $item->getNumTestedMethods()); + $xmlMetrics->setAttribute('conditionals', 0); + $xmlMetrics->setAttribute('coveredconditionals', 0); + $xmlMetrics->setAttribute('statements', $item->getNumExecutableLines()); + $xmlMetrics->setAttribute('coveredstatements', $item->getNumExecutedLines()); + $xmlMetrics->setAttribute('elements', $item->getNumMethods() + $item->getNumExecutableLines() /* + conditionals */); + $xmlMetrics->setAttribute('coveredelements', $item->getNumTestedMethods() + $item->getNumExecutedLines() /* + coveredconditionals */); + $xmlFile->appendChild($xmlMetrics); + + if ($namespace === 'global') { + $xmlProject->appendChild($xmlFile); + } else { + if (!isset($packages[$namespace])) { + $packages[$namespace] = $xmlDocument->createElement( + 'package' + ); + + $packages[$namespace]->setAttribute('name', $namespace); + $xmlProject->appendChild($packages[$namespace]); + } + + $packages[$namespace]->appendChild($xmlFile); + } + } + + $linesOfCode = $report->getLinesOfCode(); + + $xmlMetrics = $xmlDocument->createElement('metrics'); + $xmlMetrics->setAttribute('files', \count($report)); + $xmlMetrics->setAttribute('loc', $linesOfCode['loc']); + $xmlMetrics->setAttribute('ncloc', $linesOfCode['ncloc']); + $xmlMetrics->setAttribute('classes', $report->getNumClassesAndTraits()); + $xmlMetrics->setAttribute('methods', $report->getNumMethods()); + $xmlMetrics->setAttribute('coveredmethods', $report->getNumTestedMethods()); + $xmlMetrics->setAttribute('conditionals', 0); + $xmlMetrics->setAttribute('coveredconditionals', 0); + $xmlMetrics->setAttribute('statements', $report->getNumExecutableLines()); + $xmlMetrics->setAttribute('coveredstatements', $report->getNumExecutedLines()); + $xmlMetrics->setAttribute('elements', $report->getNumMethods() + $report->getNumExecutableLines() /* + conditionals */); + $xmlMetrics->setAttribute('coveredelements', $report->getNumTestedMethods() + $report->getNumExecutedLines() /* + coveredconditionals */); + $xmlProject->appendChild($xmlMetrics); + + $buffer = $xmlDocument->saveXML(); + + if ($target !== null) { + if (!$this->createDirectory(\dirname($target))) { + throw new \RuntimeException(\sprintf('Directory "%s" was not created', \dirname($target))); + } + + if (@\file_put_contents($target, $buffer) === false) { + throw new RuntimeException( + \sprintf( + 'Could not write to "%s', + $target + ) + ); + } + } + + return $buffer; + } + + private function createDirectory(string $directory): bool + { + return !(!\is_dir($directory) && !@\mkdir($directory, 0777, true) && !\is_dir($directory)); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Crap4j.php b/vendor/phpunit/php-code-coverage/src/Report/Crap4j.php new file mode 100644 index 0000000..bd3c397 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Crap4j.php @@ -0,0 +1,165 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage\Report; + +use SebastianBergmann\CodeCoverage\CodeCoverage; +use SebastianBergmann\CodeCoverage\Node\File; +use SebastianBergmann\CodeCoverage\RuntimeException; + +final class Crap4j +{ + /** + * @var int + */ + private $threshold; + + public function __construct(int $threshold = 30) + { + $this->threshold = $threshold; + } + + /** + * @throws \RuntimeException + */ + public function process(CodeCoverage $coverage, ?string $target = null, ?string $name = null): string + { + $document = new \DOMDocument('1.0', 'UTF-8'); + $document->formatOutput = true; + + $root = $document->createElement('crap_result'); + $document->appendChild($root); + + $project = $document->createElement('project', \is_string($name) ? $name : ''); + $root->appendChild($project); + $root->appendChild($document->createElement('timestamp', \date('Y-m-d H:i:s', (int) $_SERVER['REQUEST_TIME']))); + + $stats = $document->createElement('stats'); + $methodsNode = $document->createElement('methods'); + + $report = $coverage->getReport(); + unset($coverage); + + $fullMethodCount = 0; + $fullCrapMethodCount = 0; + $fullCrapLoad = 0; + $fullCrap = 0; + + foreach ($report as $item) { + $namespace = 'global'; + + if (!$item instanceof File) { + continue; + } + + $file = $document->createElement('file'); + $file->setAttribute('name', $item->getPath()); + + $classes = $item->getClassesAndTraits(); + + foreach ($classes as $className => $class) { + foreach ($class['methods'] as $methodName => $method) { + $crapLoad = $this->getCrapLoad($method['crap'], $method['ccn'], $method['coverage']); + + $fullCrap += $method['crap']; + $fullCrapLoad += $crapLoad; + $fullMethodCount++; + + if ($method['crap'] >= $this->threshold) { + $fullCrapMethodCount++; + } + + $methodNode = $document->createElement('method'); + + if (!empty($class['package']['namespace'])) { + $namespace = $class['package']['namespace']; + } + + $methodNode->appendChild($document->createElement('package', $namespace)); + $methodNode->appendChild($document->createElement('className', $className)); + $methodNode->appendChild($document->createElement('methodName', $methodName)); + $methodNode->appendChild($document->createElement('methodSignature', \htmlspecialchars($method['signature']))); + $methodNode->appendChild($document->createElement('fullMethod', \htmlspecialchars($method['signature']))); + $methodNode->appendChild($document->createElement('crap', $this->roundValue($method['crap']))); + $methodNode->appendChild($document->createElement('complexity', $method['ccn'])); + $methodNode->appendChild($document->createElement('coverage', $this->roundValue($method['coverage']))); + $methodNode->appendChild($document->createElement('crapLoad', \round($crapLoad))); + + $methodsNode->appendChild($methodNode); + } + } + } + + $stats->appendChild($document->createElement('name', 'Method Crap Stats')); + $stats->appendChild($document->createElement('methodCount', $fullMethodCount)); + $stats->appendChild($document->createElement('crapMethodCount', $fullCrapMethodCount)); + $stats->appendChild($document->createElement('crapLoad', \round($fullCrapLoad))); + $stats->appendChild($document->createElement('totalCrap', $fullCrap)); + + $crapMethodPercent = 0; + + if ($fullMethodCount > 0) { + $crapMethodPercent = $this->roundValue((100 * $fullCrapMethodCount) / $fullMethodCount); + } + + $stats->appendChild($document->createElement('crapMethodPercent', $crapMethodPercent)); + + $root->appendChild($stats); + $root->appendChild($methodsNode); + + $buffer = $document->saveXML(); + + if ($target !== null) { + if (!$this->createDirectory(\dirname($target))) { + throw new \RuntimeException(\sprintf('Directory "%s" was not created', \dirname($target))); + } + + if (@\file_put_contents($target, $buffer) === false) { + throw new RuntimeException( + \sprintf( + 'Could not write to "%s', + $target + ) + ); + } + } + + return $buffer; + } + + /** + * @param float $crapValue + * @param int $cyclomaticComplexity + * @param float $coveragePercent + */ + private function getCrapLoad($crapValue, $cyclomaticComplexity, $coveragePercent): float + { + $crapLoad = 0; + + if ($crapValue >= $this->threshold) { + $crapLoad += $cyclomaticComplexity * (1.0 - $coveragePercent / 100); + $crapLoad += $cyclomaticComplexity / $this->threshold; + } + + return $crapLoad; + } + + /** + * @param float $value + */ + private function roundValue($value): float + { + return \round($value, 2); + } + + private function createDirectory(string $directory): bool + { + return !(!\is_dir($directory) && !@\mkdir($directory, 0777, true) && !\is_dir($directory)); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Facade.php b/vendor/phpunit/php-code-coverage/src/Report/Html/Facade.php new file mode 100644 index 0000000..60441bc --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Facade.php @@ -0,0 +1,167 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage\Report\Html; + +use SebastianBergmann\CodeCoverage\CodeCoverage; +use SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; +use SebastianBergmann\CodeCoverage\RuntimeException; + +/** + * Generates an HTML report from a code coverage object. + */ +final class Facade +{ + /** + * @var string + */ + private $templatePath; + + /** + * @var string + */ + private $generator; + + /** + * @var int + */ + private $lowUpperBound; + + /** + * @var int + */ + private $highLowerBound; + + public function __construct(int $lowUpperBound = 50, int $highLowerBound = 90, string $generator = '') + { + $this->generator = $generator; + $this->highLowerBound = $highLowerBound; + $this->lowUpperBound = $lowUpperBound; + $this->templatePath = __DIR__ . '/Renderer/Template/'; + } + + /** + * @throws RuntimeException + * @throws \InvalidArgumentException + * @throws \RuntimeException + */ + public function process(CodeCoverage $coverage, string $target): void + { + $target = $this->getDirectory($target); + $report = $coverage->getReport(); + + if (!isset($_SERVER['REQUEST_TIME'])) { + $_SERVER['REQUEST_TIME'] = \time(); + } + + $date = \date('D M j G:i:s T Y', $_SERVER['REQUEST_TIME']); + + $dashboard = new Dashboard( + $this->templatePath, + $this->generator, + $date, + $this->lowUpperBound, + $this->highLowerBound + ); + + $directory = new Directory( + $this->templatePath, + $this->generator, + $date, + $this->lowUpperBound, + $this->highLowerBound + ); + + $file = new File( + $this->templatePath, + $this->generator, + $date, + $this->lowUpperBound, + $this->highLowerBound + ); + + $directory->render($report, $target . 'index.html'); + $dashboard->render($report, $target . 'dashboard.html'); + + foreach ($report as $node) { + $id = $node->getId(); + + if ($node instanceof DirectoryNode) { + if (!$this->createDirectory($target . $id)) { + throw new \RuntimeException(\sprintf('Directory "%s" was not created', $target . $id)); + } + + $directory->render($node, $target . $id . '/index.html'); + $dashboard->render($node, $target . $id . '/dashboard.html'); + } else { + $dir = \dirname($target . $id); + + if (!$this->createDirectory($dir)) { + throw new \RuntimeException(\sprintf('Directory "%s" was not created', $dir)); + } + + $file->render($node, $target . $id . '.html'); + } + } + + $this->copyFiles($target); + } + + /** + * @throws RuntimeException + */ + private function copyFiles(string $target): void + { + $dir = $this->getDirectory($target . '.css'); + + \copy($this->templatePath . 'css/bootstrap.min.css', $dir . 'bootstrap.min.css'); + \copy($this->templatePath . 'css/nv.d3.min.css', $dir . 'nv.d3.min.css'); + \copy($this->templatePath . 'css/style.css', $dir . 'style.css'); + \copy($this->templatePath . 'css/custom.css', $dir . 'custom.css'); + \copy($this->templatePath . 'css/octicons.css', $dir . 'octicons.css'); + + $dir = $this->getDirectory($target . '.icons'); + \copy($this->templatePath . 'icons/file-code.svg', $dir . 'file-code.svg'); + \copy($this->templatePath . 'icons/file-directory.svg', $dir . 'file-directory.svg'); + + $dir = $this->getDirectory($target . '.js'); + \copy($this->templatePath . 'js/bootstrap.min.js', $dir . 'bootstrap.min.js'); + \copy($this->templatePath . 'js/popper.min.js', $dir . 'popper.min.js'); + \copy($this->templatePath . 'js/d3.min.js', $dir . 'd3.min.js'); + \copy($this->templatePath . 'js/jquery.min.js', $dir . 'jquery.min.js'); + \copy($this->templatePath . 'js/nv.d3.min.js', $dir . 'nv.d3.min.js'); + \copy($this->templatePath . 'js/file.js', $dir . 'file.js'); + } + + /** + * @throws RuntimeException + */ + private function getDirectory(string $directory): string + { + if (\substr($directory, -1, 1) != \DIRECTORY_SEPARATOR) { + $directory .= \DIRECTORY_SEPARATOR; + } + + if (!$this->createDirectory($directory)) { + throw new RuntimeException( + \sprintf( + 'Directory "%s" does not exist.', + $directory + ) + ); + } + + return $directory; + } + + private function createDirectory(string $directory): bool + { + return !(!\is_dir($directory) && !@\mkdir($directory, 0777, true) && !\is_dir($directory)); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer.php b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer.php new file mode 100644 index 0000000..b39ff4c --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer.php @@ -0,0 +1,270 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage\Report\Html; + +use SebastianBergmann\CodeCoverage\Node\AbstractNode; +use SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; +use SebastianBergmann\CodeCoverage\Node\File as FileNode; +use SebastianBergmann\CodeCoverage\Version; +use SebastianBergmann\Environment\Runtime; + +/** + * Base class for node renderers. + */ +abstract class Renderer +{ + /** + * @var string + */ + protected $templatePath; + + /** + * @var string + */ + protected $generator; + + /** + * @var string + */ + protected $date; + + /** + * @var int + */ + protected $lowUpperBound; + + /** + * @var int + */ + protected $highLowerBound; + + /** + * @var string + */ + protected $version; + + public function __construct(string $templatePath, string $generator, string $date, int $lowUpperBound, int $highLowerBound) + { + $this->templatePath = $templatePath; + $this->generator = $generator; + $this->date = $date; + $this->lowUpperBound = $lowUpperBound; + $this->highLowerBound = $highLowerBound; + $this->version = Version::id(); + } + + protected function renderItemTemplate(\Text_Template $template, array $data): string + { + $numSeparator = ' / '; + + if (isset($data['numClasses']) && $data['numClasses'] > 0) { + $classesLevel = $this->getColorLevel($data['testedClassesPercent']); + + $classesNumber = $data['numTestedClasses'] . $numSeparator . + $data['numClasses']; + + $classesBar = $this->getCoverageBar( + $data['testedClassesPercent'] + ); + } else { + $classesLevel = ''; + $classesNumber = '0' . $numSeparator . '0'; + $classesBar = ''; + $data['testedClassesPercentAsString'] = 'n/a'; + } + + if ($data['numMethods'] > 0) { + $methodsLevel = $this->getColorLevel($data['testedMethodsPercent']); + + $methodsNumber = $data['numTestedMethods'] . $numSeparator . + $data['numMethods']; + + $methodsBar = $this->getCoverageBar( + $data['testedMethodsPercent'] + ); + } else { + $methodsLevel = ''; + $methodsNumber = '0' . $numSeparator . '0'; + $methodsBar = ''; + $data['testedMethodsPercentAsString'] = 'n/a'; + } + + if ($data['numExecutableLines'] > 0) { + $linesLevel = $this->getColorLevel($data['linesExecutedPercent']); + + $linesNumber = $data['numExecutedLines'] . $numSeparator . + $data['numExecutableLines']; + + $linesBar = $this->getCoverageBar( + $data['linesExecutedPercent'] + ); + } else { + $linesLevel = ''; + $linesNumber = '0' . $numSeparator . '0'; + $linesBar = ''; + $data['linesExecutedPercentAsString'] = 'n/a'; + } + + $template->setVar( + [ + 'icon' => $data['icon'] ?? '', + 'crap' => $data['crap'] ?? '', + 'name' => $data['name'], + 'lines_bar' => $linesBar, + 'lines_executed_percent' => $data['linesExecutedPercentAsString'], + 'lines_level' => $linesLevel, + 'lines_number' => $linesNumber, + 'methods_bar' => $methodsBar, + 'methods_tested_percent' => $data['testedMethodsPercentAsString'], + 'methods_level' => $methodsLevel, + 'methods_number' => $methodsNumber, + 'classes_bar' => $classesBar, + 'classes_tested_percent' => $data['testedClassesPercentAsString'] ?? '', + 'classes_level' => $classesLevel, + 'classes_number' => $classesNumber, + ] + ); + + return $template->render(); + } + + protected function setCommonTemplateVariables(\Text_Template $template, AbstractNode $node): void + { + $template->setVar( + [ + 'id' => $node->getId(), + 'full_path' => $node->getPath(), + 'path_to_root' => $this->getPathToRoot($node), + 'breadcrumbs' => $this->getBreadcrumbs($node), + 'date' => $this->date, + 'version' => $this->version, + 'runtime' => $this->getRuntimeString(), + 'generator' => $this->generator, + 'low_upper_bound' => $this->lowUpperBound, + 'high_lower_bound' => $this->highLowerBound, + ] + ); + } + + protected function getBreadcrumbs(AbstractNode $node): string + { + $breadcrumbs = ''; + $path = $node->getPathAsArray(); + $pathToRoot = []; + $max = \count($path); + + if ($node instanceof FileNode) { + $max--; + } + + for ($i = 0; $i < $max; $i++) { + $pathToRoot[] = \str_repeat('../', $i); + } + + foreach ($path as $step) { + if ($step !== $node) { + $breadcrumbs .= $this->getInactiveBreadcrumb( + $step, + \array_pop($pathToRoot) + ); + } else { + $breadcrumbs .= $this->getActiveBreadcrumb($step); + } + } + + return $breadcrumbs; + } + + protected function getActiveBreadcrumb(AbstractNode $node): string + { + $buffer = \sprintf( + ' ' . "\n", + $node->getName() + ); + + if ($node instanceof DirectoryNode) { + $buffer .= '
' . "\n"; + } + + return $buffer; + } + + protected function getInactiveBreadcrumb(AbstractNode $node, string $pathToRoot): string + { + return \sprintf( + ' ' . "\n", + $pathToRoot, + $node->getName() + ); + } + + protected function getPathToRoot(AbstractNode $node): string + { + $id = $node->getId(); + $depth = \substr_count($id, '/'); + + if ($id !== 'index' && + $node instanceof DirectoryNode) { + $depth++; + } + + return \str_repeat('../', $depth); + } + + protected function getCoverageBar(float $percent): string + { + $level = $this->getColorLevel($percent); + + $template = new \Text_Template( + $this->templatePath . 'coverage_bar.html', + '{{', + '}}' + ); + + $template->setVar(['level' => $level, 'percent' => \sprintf('%.2F', $percent)]); + + return $template->render(); + } + + protected function getColorLevel(float $percent): string + { + if ($percent <= $this->lowUpperBound) { + return 'danger'; + } + + if ($percent > $this->lowUpperBound && + $percent < $this->highLowerBound) { + return 'warning'; + } + + return 'success'; + } + + private function getRuntimeString(): string + { + $runtime = new Runtime; + + $buffer = \sprintf( + '%s %s', + $runtime->getVendorUrl(), + $runtime->getName(), + $runtime->getVersion() + ); + + if ($runtime->hasXdebug() && !$runtime->hasPHPDBGCodeCoverage()) { + $buffer .= \sprintf( + ' with Xdebug %s', + \phpversion('xdebug') + ); + } + + return $buffer; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php new file mode 100644 index 0000000..68dfd40 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php @@ -0,0 +1,281 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage\Report\Html; + +use SebastianBergmann\CodeCoverage\Node\AbstractNode; +use SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; + +/** + * Renders the dashboard for a directory node. + */ +final class Dashboard extends Renderer +{ + /** + * @throws \InvalidArgumentException + * @throws \RuntimeException + */ + public function render(DirectoryNode $node, string $file): void + { + $classes = $node->getClassesAndTraits(); + $template = new \Text_Template( + $this->templatePath . 'dashboard.html', + '{{', + '}}' + ); + + $this->setCommonTemplateVariables($template, $node); + + $baseLink = $node->getId() . '/'; + $complexity = $this->complexity($classes, $baseLink); + $coverageDistribution = $this->coverageDistribution($classes); + $insufficientCoverage = $this->insufficientCoverage($classes, $baseLink); + $projectRisks = $this->projectRisks($classes, $baseLink); + + $template->setVar( + [ + 'insufficient_coverage_classes' => $insufficientCoverage['class'], + 'insufficient_coverage_methods' => $insufficientCoverage['method'], + 'project_risks_classes' => $projectRisks['class'], + 'project_risks_methods' => $projectRisks['method'], + 'complexity_class' => $complexity['class'], + 'complexity_method' => $complexity['method'], + 'class_coverage_distribution' => $coverageDistribution['class'], + 'method_coverage_distribution' => $coverageDistribution['method'], + ] + ); + + $template->renderTo($file); + } + + /** + * Returns the data for the Class/Method Complexity charts. + */ + protected function complexity(array $classes, string $baseLink): array + { + $result = ['class' => [], 'method' => []]; + + foreach ($classes as $className => $class) { + foreach ($class['methods'] as $methodName => $method) { + if ($className !== '*') { + $methodName = $className . '::' . $methodName; + } + + $result['method'][] = [ + $method['coverage'], + $method['ccn'], + \sprintf( + '%s', + \str_replace($baseLink, '', $method['link']), + $methodName + ), + ]; + } + + $result['class'][] = [ + $class['coverage'], + $class['ccn'], + \sprintf( + '%s', + \str_replace($baseLink, '', $class['link']), + $className + ), + ]; + } + + return [ + 'class' => \json_encode($result['class']), + 'method' => \json_encode($result['method']), + ]; + } + + /** + * Returns the data for the Class / Method Coverage Distribution chart. + */ + protected function coverageDistribution(array $classes): array + { + $result = [ + 'class' => [ + '0%' => 0, + '0-10%' => 0, + '10-20%' => 0, + '20-30%' => 0, + '30-40%' => 0, + '40-50%' => 0, + '50-60%' => 0, + '60-70%' => 0, + '70-80%' => 0, + '80-90%' => 0, + '90-100%' => 0, + '100%' => 0, + ], + 'method' => [ + '0%' => 0, + '0-10%' => 0, + '10-20%' => 0, + '20-30%' => 0, + '30-40%' => 0, + '40-50%' => 0, + '50-60%' => 0, + '60-70%' => 0, + '70-80%' => 0, + '80-90%' => 0, + '90-100%' => 0, + '100%' => 0, + ], + ]; + + foreach ($classes as $class) { + foreach ($class['methods'] as $methodName => $method) { + if ($method['coverage'] === 0) { + $result['method']['0%']++; + } elseif ($method['coverage'] === 100) { + $result['method']['100%']++; + } else { + $key = \floor($method['coverage'] / 10) * 10; + $key = $key . '-' . ($key + 10) . '%'; + $result['method'][$key]++; + } + } + + if ($class['coverage'] === 0) { + $result['class']['0%']++; + } elseif ($class['coverage'] === 100) { + $result['class']['100%']++; + } else { + $key = \floor($class['coverage'] / 10) * 10; + $key = $key . '-' . ($key + 10) . '%'; + $result['class'][$key]++; + } + } + + return [ + 'class' => \json_encode(\array_values($result['class'])), + 'method' => \json_encode(\array_values($result['method'])), + ]; + } + + /** + * Returns the classes / methods with insufficient coverage. + */ + protected function insufficientCoverage(array $classes, string $baseLink): array + { + $leastTestedClasses = []; + $leastTestedMethods = []; + $result = ['class' => '', 'method' => '']; + + foreach ($classes as $className => $class) { + foreach ($class['methods'] as $methodName => $method) { + if ($method['coverage'] < $this->highLowerBound) { + $key = $methodName; + + if ($className !== '*') { + $key = $className . '::' . $methodName; + } + + $leastTestedMethods[$key] = $method['coverage']; + } + } + + if ($class['coverage'] < $this->highLowerBound) { + $leastTestedClasses[$className] = $class['coverage']; + } + } + + \asort($leastTestedClasses); + \asort($leastTestedMethods); + + foreach ($leastTestedClasses as $className => $coverage) { + $result['class'] .= \sprintf( + ' %s%d%%' . "\n", + \str_replace($baseLink, '', $classes[$className]['link']), + $className, + $coverage + ); + } + + foreach ($leastTestedMethods as $methodName => $coverage) { + [$class, $method] = \explode('::', $methodName); + + $result['method'] .= \sprintf( + ' %s%d%%' . "\n", + \str_replace($baseLink, '', $classes[$class]['methods'][$method]['link']), + $methodName, + $method, + $coverage + ); + } + + return $result; + } + + /** + * Returns the project risks according to the CRAP index. + */ + protected function projectRisks(array $classes, string $baseLink): array + { + $classRisks = []; + $methodRisks = []; + $result = ['class' => '', 'method' => '']; + + foreach ($classes as $className => $class) { + foreach ($class['methods'] as $methodName => $method) { + if ($method['coverage'] < $this->highLowerBound && $method['ccn'] > 1) { + $key = $methodName; + + if ($className !== '*') { + $key = $className . '::' . $methodName; + } + + $methodRisks[$key] = $method['crap']; + } + } + + if ($class['coverage'] < $this->highLowerBound && + $class['ccn'] > \count($class['methods'])) { + $classRisks[$className] = $class['crap']; + } + } + + \arsort($classRisks); + \arsort($methodRisks); + + foreach ($classRisks as $className => $crap) { + $result['class'] .= \sprintf( + ' %s%d' . "\n", + \str_replace($baseLink, '', $classes[$className]['link']), + $className, + $crap + ); + } + + foreach ($methodRisks as $methodName => $crap) { + [$class, $method] = \explode('::', $methodName); + + $result['method'] .= \sprintf( + ' %s%d' . "\n", + \str_replace($baseLink, '', $classes[$class]['methods'][$method]['link']), + $methodName, + $method, + $crap + ); + } + + return $result; + } + + protected function getActiveBreadcrumb(AbstractNode $node): string + { + return \sprintf( + ' ' . "\n" . + ' ' . "\n", + $node->getName() + ); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php new file mode 100644 index 0000000..711d153 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php @@ -0,0 +1,98 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage\Report\Html; + +use SebastianBergmann\CodeCoverage\Node\AbstractNode as Node; +use SebastianBergmann\CodeCoverage\Node\Directory as DirectoryNode; + +/** + * Renders a directory node. + */ +final class Directory extends Renderer +{ + /** + * @throws \InvalidArgumentException + * @throws \RuntimeException + */ + public function render(DirectoryNode $node, string $file): void + { + $template = new \Text_Template($this->templatePath . 'directory.html', '{{', '}}'); + + $this->setCommonTemplateVariables($template, $node); + + $items = $this->renderItem($node, true); + + foreach ($node->getDirectories() as $item) { + $items .= $this->renderItem($item); + } + + foreach ($node->getFiles() as $item) { + $items .= $this->renderItem($item); + } + + $template->setVar( + [ + 'id' => $node->getId(), + 'items' => $items, + ] + ); + + $template->renderTo($file); + } + + protected function renderItem(Node $node, bool $total = false): string + { + $data = [ + 'numClasses' => $node->getNumClassesAndTraits(), + 'numTestedClasses' => $node->getNumTestedClassesAndTraits(), + 'numMethods' => $node->getNumFunctionsAndMethods(), + 'numTestedMethods' => $node->getNumTestedFunctionsAndMethods(), + 'linesExecutedPercent' => $node->getLineExecutedPercent(false), + 'linesExecutedPercentAsString' => $node->getLineExecutedPercent(), + 'numExecutedLines' => $node->getNumExecutedLines(), + 'numExecutableLines' => $node->getNumExecutableLines(), + 'testedMethodsPercent' => $node->getTestedFunctionsAndMethodsPercent(false), + 'testedMethodsPercentAsString' => $node->getTestedFunctionsAndMethodsPercent(), + 'testedClassesPercent' => $node->getTestedClassesAndTraitsPercent(false), + 'testedClassesPercentAsString' => $node->getTestedClassesAndTraitsPercent(), + ]; + + if ($total) { + $data['name'] = 'Total'; + } else { + if ($node instanceof DirectoryNode) { + $data['name'] = \sprintf( + '%s', + $node->getName(), + $node->getName() + ); + + $up = \str_repeat('../', \count($node->getPathAsArray()) - 2); + + $data['icon'] = \sprintf('', $up); + } else { + $data['name'] = \sprintf( + '%s', + $node->getName(), + $node->getName() + ); + + $up = \str_repeat('../', \count($node->getPathAsArray()) - 2); + + $data['icon'] = \sprintf('', $up); + } + } + + return $this->renderItemTemplate( + new \Text_Template($this->templatePath . 'directory_item.html', '{{', '}}'), + $data + ); + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php new file mode 100644 index 0000000..2e88d19 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php @@ -0,0 +1,529 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\CodeCoverage\Report\Html; + +use SebastianBergmann\CodeCoverage\Node\File as FileNode; +use SebastianBergmann\CodeCoverage\Util; + +/** + * Renders a file node. + */ +final class File extends Renderer +{ + /** + * @var int + */ + private $htmlSpecialCharsFlags = \ENT_COMPAT | \ENT_HTML401 | \ENT_SUBSTITUTE; + + /** + * @throws \RuntimeException + */ + public function render(FileNode $node, string $file): void + { + $template = new \Text_Template($this->templatePath . 'file.html', '{{', '}}'); + + $template->setVar( + [ + 'items' => $this->renderItems($node), + 'lines' => $this->renderSource($node), + ] + ); + + $this->setCommonTemplateVariables($template, $node); + + $template->renderTo($file); + } + + protected function renderItems(FileNode $node): string + { + $template = new \Text_Template($this->templatePath . 'file_item.html', '{{', '}}'); + + $methodItemTemplate = new \Text_Template( + $this->templatePath . 'method_item.html', + '{{', + '}}' + ); + + $items = $this->renderItemTemplate( + $template, + [ + 'name' => 'Total', + 'numClasses' => $node->getNumClassesAndTraits(), + 'numTestedClasses' => $node->getNumTestedClassesAndTraits(), + 'numMethods' => $node->getNumFunctionsAndMethods(), + 'numTestedMethods' => $node->getNumTestedFunctionsAndMethods(), + 'linesExecutedPercent' => $node->getLineExecutedPercent(false), + 'linesExecutedPercentAsString' => $node->getLineExecutedPercent(), + 'numExecutedLines' => $node->getNumExecutedLines(), + 'numExecutableLines' => $node->getNumExecutableLines(), + 'testedMethodsPercent' => $node->getTestedFunctionsAndMethodsPercent(false), + 'testedMethodsPercentAsString' => $node->getTestedFunctionsAndMethodsPercent(), + 'testedClassesPercent' => $node->getTestedClassesAndTraitsPercent(false), + 'testedClassesPercentAsString' => $node->getTestedClassesAndTraitsPercent(), + 'crap' => 'CRAP', + ] + ); + + $items .= $this->renderFunctionItems( + $node->getFunctions(), + $methodItemTemplate + ); + + $items .= $this->renderTraitOrClassItems( + $node->getTraits(), + $template, + $methodItemTemplate + ); + + $items .= $this->renderTraitOrClassItems( + $node->getClasses(), + $template, + $methodItemTemplate + ); + + return $items; + } + + protected function renderTraitOrClassItems(array $items, \Text_Template $template, \Text_Template $methodItemTemplate): string + { + $buffer = ''; + + if (empty($items)) { + return $buffer; + } + + foreach ($items as $name => $item) { + $numMethods = 0; + $numTestedMethods = 0; + + foreach ($item['methods'] as $method) { + if ($method['executableLines'] > 0) { + $numMethods++; + + if ($method['executedLines'] === $method['executableLines']) { + $numTestedMethods++; + } + } + } + + if ($item['executableLines'] > 0) { + $numClasses = 1; + $numTestedClasses = $numTestedMethods == $numMethods ? 1 : 0; + $linesExecutedPercentAsString = Util::percent( + $item['executedLines'], + $item['executableLines'], + true + ); + } else { + $numClasses = 'n/a'; + $numTestedClasses = 'n/a'; + $linesExecutedPercentAsString = 'n/a'; + } + + $buffer .= $this->renderItemTemplate( + $template, + [ + 'name' => $this->abbreviateClassName($name), + 'numClasses' => $numClasses, + 'numTestedClasses' => $numTestedClasses, + 'numMethods' => $numMethods, + 'numTestedMethods' => $numTestedMethods, + 'linesExecutedPercent' => Util::percent( + $item['executedLines'], + $item['executableLines'], + false + ), + 'linesExecutedPercentAsString' => $linesExecutedPercentAsString, + 'numExecutedLines' => $item['executedLines'], + 'numExecutableLines' => $item['executableLines'], + 'testedMethodsPercent' => Util::percent( + $numTestedMethods, + $numMethods + ), + 'testedMethodsPercentAsString' => Util::percent( + $numTestedMethods, + $numMethods, + true + ), + 'testedClassesPercent' => Util::percent( + $numTestedMethods == $numMethods ? 1 : 0, + 1 + ), + 'testedClassesPercentAsString' => Util::percent( + $numTestedMethods == $numMethods ? 1 : 0, + 1, + true + ), + 'crap' => $item['crap'], + ] + ); + + foreach ($item['methods'] as $method) { + $buffer .= $this->renderFunctionOrMethodItem( + $methodItemTemplate, + $method, + ' ' + ); + } + } + + return $buffer; + } + + protected function renderFunctionItems(array $functions, \Text_Template $template): string + { + if (empty($functions)) { + return ''; + } + + $buffer = ''; + + foreach ($functions as $function) { + $buffer .= $this->renderFunctionOrMethodItem( + $template, + $function + ); + } + + return $buffer; + } + + protected function renderFunctionOrMethodItem(\Text_Template $template, array $item, string $indent = ''): string + { + $numMethods = 0; + $numTestedMethods = 0; + + if ($item['executableLines'] > 0) { + $numMethods = 1; + + if ($item['executedLines'] === $item['executableLines']) { + $numTestedMethods = 1; + } + } + + return $this->renderItemTemplate( + $template, + [ + 'name' => \sprintf( + '%s%s', + $indent, + $item['startLine'], + \htmlspecialchars($item['signature'], $this->htmlSpecialCharsFlags), + $item['functionName'] ?? $item['methodName'] + ), + 'numMethods' => $numMethods, + 'numTestedMethods' => $numTestedMethods, + 'linesExecutedPercent' => Util::percent( + $item['executedLines'], + $item['executableLines'] + ), + 'linesExecutedPercentAsString' => Util::percent( + $item['executedLines'], + $item['executableLines'], + true + ), + 'numExecutedLines' => $item['executedLines'], + 'numExecutableLines' => $item['executableLines'], + 'testedMethodsPercent' => Util::percent( + $numTestedMethods, + 1 + ), + 'testedMethodsPercentAsString' => Util::percent( + $numTestedMethods, + 1, + true + ), + 'crap' => $item['crap'], + ] + ); + } + + protected function renderSource(FileNode $node): string + { + $coverageData = $node->getCoverageData(); + $testData = $node->getTestData(); + $codeLines = $this->loadFile($node->getPath()); + $lines = ''; + $i = 1; + + foreach ($codeLines as $line) { + $trClass = ''; + $popoverContent = ''; + $popoverTitle = ''; + + if (\array_key_exists($i, $coverageData)) { + $numTests = ($coverageData[$i] ? \count($coverageData[$i]) : 0); + + if ($coverageData[$i] === null) { + $trClass = ' class="warning"'; + } elseif ($numTests == 0) { + $trClass = ' class="danger"'; + } else { + $lineCss = 'covered-by-large-tests'; + $popoverContent = '
    '; + + if ($numTests > 1) { + $popoverTitle = $numTests . ' tests cover line ' . $i; + } else { + $popoverTitle = '1 test covers line ' . $i; + } + + foreach ($coverageData[$i] as $test) { + if ($lineCss == 'covered-by-large-tests' && $testData[$test]['size'] == 'medium') { + $lineCss = 'covered-by-medium-tests'; + } elseif ($testData[$test]['size'] == 'small') { + $lineCss = 'covered-by-small-tests'; + } + + switch ($testData[$test]['status']) { + case 0: + switch ($testData[$test]['size']) { + case 'small': + $testCSS = ' class="covered-by-small-tests"'; + + break; + + case 'medium': + $testCSS = ' class="covered-by-medium-tests"'; + + break; + + default: + $testCSS = ' class="covered-by-large-tests"'; + + break; + } + + break; + + case 1: + case 2: + $testCSS = ' class="warning"'; + + break; + + case 3: + $testCSS = ' class="danger"'; + + break; + + case 4: + $testCSS = ' class="danger"'; + + break; + + default: + $testCSS = ''; + } + + $popoverContent .= \sprintf( + '%s', + $testCSS, + \htmlspecialchars($test, $this->htmlSpecialCharsFlags) + ); + } + + $popoverContent .= '
'; + $trClass = ' class="' . $lineCss . ' popin"'; + } + } + + $popover = ''; + + if (!empty($popoverTitle)) { + $popover = \sprintf( + ' data-title="%s" data-content="%s" data-placement="bottom" data-html="true"', + $popoverTitle, + \htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags) + ); + } + + $lines .= \sprintf( + ' %s' . "\n", + $trClass, + $popover, + $i, + $i, + $i, + $line + ); + + $i++; + } + + return $lines; + } + + /** + * @param string $file + */ + protected function loadFile($file): array + { + $buffer = \file_get_contents($file); + $tokens = \token_get_all($buffer); + $result = ['']; + $i = 0; + $stringFlag = false; + $fileEndsWithNewLine = \substr($buffer, -1) == "\n"; + + unset($buffer); + + foreach ($tokens as $j => $token) { + if (\is_string($token)) { + if ($token === '"' && $tokens[$j - 1] !== '\\') { + $result[$i] .= \sprintf( + '%s', + \htmlspecialchars($token, $this->htmlSpecialCharsFlags) + ); + + $stringFlag = !$stringFlag; + } else { + $result[$i] .= \sprintf( + '%s', + \htmlspecialchars($token, $this->htmlSpecialCharsFlags) + ); + } + + continue; + } + + [$token, $value] = $token; + + $value = \str_replace( + ["\t", ' '], + ['    ', ' '], + \htmlspecialchars($value, $this->htmlSpecialCharsFlags) + ); + + if ($value === "\n") { + $result[++$i] = ''; + } else { + $lines = \explode("\n", $value); + + foreach ($lines as $jj => $line) { + $line = \trim($line); + + if ($line !== '') { + if ($stringFlag) { + $colour = 'string'; + } else { + switch ($token) { + case \T_INLINE_HTML: + $colour = 'html'; + + break; + + case \T_COMMENT: + case \T_DOC_COMMENT: + $colour = 'comment'; + + break; + + case \T_ABSTRACT: + case \T_ARRAY: + case \T_AS: + case \T_BREAK: + case \T_CALLABLE: + case \T_CASE: + case \T_CATCH: + case \T_CLASS: + case \T_CLONE: + case \T_CONTINUE: + case \T_DEFAULT: + case \T_ECHO: + case \T_ELSE: + case \T_ELSEIF: + case \T_EMPTY: + case \T_ENDDECLARE: + case \T_ENDFOR: + case \T_ENDFOREACH: + case \T_ENDIF: + case \T_ENDSWITCH: + case \T_ENDWHILE: + case \T_EXIT: + case \T_EXTENDS: + case \T_FINAL: + case \T_FINALLY: + case \T_FOREACH: + case \T_FUNCTION: + case \T_GLOBAL: + case \T_IF: + case \T_IMPLEMENTS: + case \T_INCLUDE: + case \T_INCLUDE_ONCE: + case \T_INSTANCEOF: + case \T_INSTEADOF: + case \T_INTERFACE: + case \T_ISSET: + case \T_LOGICAL_AND: + case \T_LOGICAL_OR: + case \T_LOGICAL_XOR: + case \T_NAMESPACE: + case \T_NEW: + case \T_PRIVATE: + case \T_PROTECTED: + case \T_PUBLIC: + case \T_REQUIRE: + case \T_REQUIRE_ONCE: + case \T_RETURN: + case \T_STATIC: + case \T_THROW: + case \T_TRAIT: + case \T_TRY: + case \T_UNSET: + case \T_USE: + case \T_VAR: + case \T_WHILE: + case \T_YIELD: + $colour = 'keyword'; + + break; + + default: + $colour = 'default'; + } + } + + $result[$i] .= \sprintf( + '%s', + $colour, + $line + ); + } + + if (isset($lines[$jj + 1])) { + $result[++$i] = ''; + } + } + } + } + + if ($fileEndsWithNewLine) { + unset($result[\count($result) - 1]); + } + + return $result; + } + + private function abbreviateClassName(string $className): string + { + $tmp = \explode('\\', $className); + + if (\count($tmp) > 1) { + $className = \sprintf( + '%s', + $className, + \array_pop($tmp) + ); + } + + return $className; + } +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/coverage_bar.html.dist b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/coverage_bar.html.dist new file mode 100644 index 0000000..7fcf6f4 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/coverage_bar.html.dist @@ -0,0 +1,5 @@ +
+
+ {{percent}}% covered ({{level}}) +
+
diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/bootstrap.min.css b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/bootstrap.min.css new file mode 100644 index 0000000..74a3ca1 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/bootstrap.min.css @@ -0,0 +1,7 @@ +/*! + * Bootstrap v4.1.3 (https://getbootstrap.com/) + * Copyright 2011-2018 The Bootstrap Authors + * Copyright 2011-2018 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */:root{--blue:#007bff;--indigo:#6610f2;--purple:#6f42c1;--pink:#e83e8c;--red:#dc3545;--orange:#fd7e14;--yellow:#ffc107;--green:#28a745;--teal:#20c997;--cyan:#17a2b8;--white:#fff;--gray:#6c757d;--gray-dark:#343a40;--primary:#007bff;--secondary:#6c757d;--success:#28a745;--info:#17a2b8;--warning:#ffc107;--danger:#dc3545;--light:#f8f9fa;--dark:#343a40;--breakpoint-xs:0;--breakpoint-sm:576px;--breakpoint-md:768px;--breakpoint-lg:992px;--breakpoint-xl:1200px;--font-family-sans-serif:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-family-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}@-ms-viewport{width:device-width}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent;-webkit-text-decoration-skip:objects}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{margin-bottom:.5rem;font-family:inherit;font-weight:500;line-height:1.2;color:inherit}.h1,h1{font-size:2.5rem}.h2,h2{font-size:2rem}.h3,h3{font-size:1.75rem}.h4,h4{font-size:1.5rem}.h5,h5{font-size:1.25rem}.h6,h6{font-size:1rem}.lead{font-size:1.25rem;font-weight:300}.display-1{font-size:6rem;font-weight:300;line-height:1.2}.display-2{font-size:5.5rem;font-weight:300;line-height:1.2}.display-3{font-size:4.5rem;font-weight:300;line-height:1.2}.display-4{font-size:3.5rem;font-weight:300;line-height:1.2}hr{margin-top:1rem;margin-bottom:1rem;border:0;border-top:1px solid rgba(0,0,0,.1)}.small,small{font-size:80%;font-weight:400}.mark,mark{padding:.2em;background-color:#fcf8e3}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;list-style:none}.list-inline-item{display:inline-block}.list-inline-item:not(:last-child){margin-right:.5rem}.initialism{font-size:90%;text-transform:uppercase}.blockquote{margin-bottom:1rem;font-size:1.25rem}.blockquote-footer{display:block;font-size:80%;color:#6c757d}.blockquote-footer::before{content:"\2014 \00A0"}.img-fluid{max-width:100%;height:auto}.img-thumbnail{padding:.25rem;background-color:#fff;border:1px solid #dee2e6;border-radius:.25rem;max-width:100%;height:auto}.figure{display:inline-block}.figure-img{margin-bottom:.5rem;line-height:1}.figure-caption{font-size:90%;color:#6c757d}code{font-size:87.5%;color:#e83e8c;word-break:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:87.5%;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:100%;font-weight:700}pre{display:block;font-size:87.5%;color:#212529}pre code{font-size:inherit;color:inherit;word-break:normal}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{width:100%;padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:576px){.container{max-width:540px}}@media (min-width:768px){.container{max-width:720px}}@media (min-width:992px){.container{max-width:960px}}@media (min-width:1200px){.container{max-width:1140px}}.container-fluid{width:100%;padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:-15px;margin-left:-15px}.no-gutters{margin-right:0;margin-left:0}.no-gutters>.col,.no-gutters>[class*=col-]{padding-right:0;padding-left:0}.col,.col-1,.col-10,.col-11,.col-12,.col-2,.col-3,.col-4,.col-5,.col-6,.col-7,.col-8,.col-9,.col-auto,.col-lg,.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-auto,.col-md,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-auto,.col-sm,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-auto,.col-xl,.col-xl-1,.col-xl-10,.col-xl-11,.col-xl-12,.col-xl-2,.col-xl-3,.col-xl-4,.col-xl-5,.col-xl-6,.col-xl-7,.col-xl-8,.col-xl-9,.col-xl-auto{position:relative;width:100%;min-height:1px;padding-right:15px;padding-left:15px}.col{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-auto{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-1{-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.col-2{-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.col-3{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.col-5{-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.col-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-7{-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.col-8{-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.col-9{-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-10{-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.col-11{-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.col-12{-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-first{-ms-flex-order:-1;order:-1}.order-last{-ms-flex-order:13;order:13}.order-0{-ms-flex-order:0;order:0}.order-1{-ms-flex-order:1;order:1}.order-2{-ms-flex-order:2;order:2}.order-3{-ms-flex-order:3;order:3}.order-4{-ms-flex-order:4;order:4}.order-5{-ms-flex-order:5;order:5}.order-6{-ms-flex-order:6;order:6}.order-7{-ms-flex-order:7;order:7}.order-8{-ms-flex-order:8;order:8}.order-9{-ms-flex-order:9;order:9}.order-10{-ms-flex-order:10;order:10}.order-11{-ms-flex-order:11;order:11}.order-12{-ms-flex-order:12;order:12}.offset-1{margin-left:8.333333%}.offset-2{margin-left:16.666667%}.offset-3{margin-left:25%}.offset-4{margin-left:33.333333%}.offset-5{margin-left:41.666667%}.offset-6{margin-left:50%}.offset-7{margin-left:58.333333%}.offset-8{margin-left:66.666667%}.offset-9{margin-left:75%}.offset-10{margin-left:83.333333%}.offset-11{margin-left:91.666667%}@media (min-width:576px){.col-sm{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-sm-auto{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-sm-1{-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.col-sm-2{-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.col-sm-3{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-sm-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.col-sm-5{-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.col-sm-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-sm-7{-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.col-sm-8{-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.col-sm-9{-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-sm-10{-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.col-sm-11{-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.col-sm-12{-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-sm-first{-ms-flex-order:-1;order:-1}.order-sm-last{-ms-flex-order:13;order:13}.order-sm-0{-ms-flex-order:0;order:0}.order-sm-1{-ms-flex-order:1;order:1}.order-sm-2{-ms-flex-order:2;order:2}.order-sm-3{-ms-flex-order:3;order:3}.order-sm-4{-ms-flex-order:4;order:4}.order-sm-5{-ms-flex-order:5;order:5}.order-sm-6{-ms-flex-order:6;order:6}.order-sm-7{-ms-flex-order:7;order:7}.order-sm-8{-ms-flex-order:8;order:8}.order-sm-9{-ms-flex-order:9;order:9}.order-sm-10{-ms-flex-order:10;order:10}.order-sm-11{-ms-flex-order:11;order:11}.order-sm-12{-ms-flex-order:12;order:12}.offset-sm-0{margin-left:0}.offset-sm-1{margin-left:8.333333%}.offset-sm-2{margin-left:16.666667%}.offset-sm-3{margin-left:25%}.offset-sm-4{margin-left:33.333333%}.offset-sm-5{margin-left:41.666667%}.offset-sm-6{margin-left:50%}.offset-sm-7{margin-left:58.333333%}.offset-sm-8{margin-left:66.666667%}.offset-sm-9{margin-left:75%}.offset-sm-10{margin-left:83.333333%}.offset-sm-11{margin-left:91.666667%}}@media (min-width:768px){.col-md{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-md-auto{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-md-1{-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.col-md-2{-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.col-md-3{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-md-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.col-md-5{-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.col-md-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-md-7{-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.col-md-8{-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.col-md-9{-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-md-10{-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.col-md-11{-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.col-md-12{-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-md-first{-ms-flex-order:-1;order:-1}.order-md-last{-ms-flex-order:13;order:13}.order-md-0{-ms-flex-order:0;order:0}.order-md-1{-ms-flex-order:1;order:1}.order-md-2{-ms-flex-order:2;order:2}.order-md-3{-ms-flex-order:3;order:3}.order-md-4{-ms-flex-order:4;order:4}.order-md-5{-ms-flex-order:5;order:5}.order-md-6{-ms-flex-order:6;order:6}.order-md-7{-ms-flex-order:7;order:7}.order-md-8{-ms-flex-order:8;order:8}.order-md-9{-ms-flex-order:9;order:9}.order-md-10{-ms-flex-order:10;order:10}.order-md-11{-ms-flex-order:11;order:11}.order-md-12{-ms-flex-order:12;order:12}.offset-md-0{margin-left:0}.offset-md-1{margin-left:8.333333%}.offset-md-2{margin-left:16.666667%}.offset-md-3{margin-left:25%}.offset-md-4{margin-left:33.333333%}.offset-md-5{margin-left:41.666667%}.offset-md-6{margin-left:50%}.offset-md-7{margin-left:58.333333%}.offset-md-8{margin-left:66.666667%}.offset-md-9{margin-left:75%}.offset-md-10{margin-left:83.333333%}.offset-md-11{margin-left:91.666667%}}@media (min-width:992px){.col-lg{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-lg-auto{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-lg-1{-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.col-lg-2{-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.col-lg-3{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-lg-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.col-lg-5{-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.col-lg-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-lg-7{-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.col-lg-8{-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.col-lg-9{-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-lg-10{-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.col-lg-11{-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.col-lg-12{-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-lg-first{-ms-flex-order:-1;order:-1}.order-lg-last{-ms-flex-order:13;order:13}.order-lg-0{-ms-flex-order:0;order:0}.order-lg-1{-ms-flex-order:1;order:1}.order-lg-2{-ms-flex-order:2;order:2}.order-lg-3{-ms-flex-order:3;order:3}.order-lg-4{-ms-flex-order:4;order:4}.order-lg-5{-ms-flex-order:5;order:5}.order-lg-6{-ms-flex-order:6;order:6}.order-lg-7{-ms-flex-order:7;order:7}.order-lg-8{-ms-flex-order:8;order:8}.order-lg-9{-ms-flex-order:9;order:9}.order-lg-10{-ms-flex-order:10;order:10}.order-lg-11{-ms-flex-order:11;order:11}.order-lg-12{-ms-flex-order:12;order:12}.offset-lg-0{margin-left:0}.offset-lg-1{margin-left:8.333333%}.offset-lg-2{margin-left:16.666667%}.offset-lg-3{margin-left:25%}.offset-lg-4{margin-left:33.333333%}.offset-lg-5{margin-left:41.666667%}.offset-lg-6{margin-left:50%}.offset-lg-7{margin-left:58.333333%}.offset-lg-8{margin-left:66.666667%}.offset-lg-9{margin-left:75%}.offset-lg-10{margin-left:83.333333%}.offset-lg-11{margin-left:91.666667%}}@media (min-width:1200px){.col-xl{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-xl-auto{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-xl-1{-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.col-xl-2{-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.col-xl-3{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-xl-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.col-xl-5{-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.col-xl-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-xl-7{-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.col-xl-8{-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.col-xl-9{-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-xl-10{-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.col-xl-11{-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.col-xl-12{-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-xl-first{-ms-flex-order:-1;order:-1}.order-xl-last{-ms-flex-order:13;order:13}.order-xl-0{-ms-flex-order:0;order:0}.order-xl-1{-ms-flex-order:1;order:1}.order-xl-2{-ms-flex-order:2;order:2}.order-xl-3{-ms-flex-order:3;order:3}.order-xl-4{-ms-flex-order:4;order:4}.order-xl-5{-ms-flex-order:5;order:5}.order-xl-6{-ms-flex-order:6;order:6}.order-xl-7{-ms-flex-order:7;order:7}.order-xl-8{-ms-flex-order:8;order:8}.order-xl-9{-ms-flex-order:9;order:9}.order-xl-10{-ms-flex-order:10;order:10}.order-xl-11{-ms-flex-order:11;order:11}.order-xl-12{-ms-flex-order:12;order:12}.offset-xl-0{margin-left:0}.offset-xl-1{margin-left:8.333333%}.offset-xl-2{margin-left:16.666667%}.offset-xl-3{margin-left:25%}.offset-xl-4{margin-left:33.333333%}.offset-xl-5{margin-left:41.666667%}.offset-xl-6{margin-left:50%}.offset-xl-7{margin-left:58.333333%}.offset-xl-8{margin-left:66.666667%}.offset-xl-9{margin-left:75%}.offset-xl-10{margin-left:83.333333%}.offset-xl-11{margin-left:91.666667%}}.table{width:100%;margin-bottom:1rem;background-color:transparent}.table td,.table th{padding:.75rem;vertical-align:top;border-top:1px solid #dee2e6}.table thead th{vertical-align:bottom;border-bottom:2px solid #dee2e6}.table tbody+tbody{border-top:2px solid #dee2e6}.table .table{background-color:#fff}.table-sm td,.table-sm th{padding:.3rem}.table-bordered{border:1px solid #dee2e6}.table-bordered td,.table-bordered th{border:1px solid #dee2e6}.table-bordered thead td,.table-bordered thead th{border-bottom-width:2px}.table-borderless tbody+tbody,.table-borderless td,.table-borderless th,.table-borderless thead th{border:0}.table-striped tbody tr:nth-of-type(odd){background-color:rgba(0,0,0,.05)}.table-hover tbody tr:hover{background-color:rgba(0,0,0,.075)}.table-primary,.table-primary>td,.table-primary>th{background-color:#b8daff}.table-hover .table-primary:hover{background-color:#9fcdff}.table-hover .table-primary:hover>td,.table-hover .table-primary:hover>th{background-color:#9fcdff}.table-secondary,.table-secondary>td,.table-secondary>th{background-color:#d6d8db}.table-hover .table-secondary:hover{background-color:#c8cbcf}.table-hover .table-secondary:hover>td,.table-hover .table-secondary:hover>th{background-color:#c8cbcf}.table-success,.table-success>td,.table-success>th{background-color:#c3e6cb}.table-hover .table-success:hover{background-color:#b1dfbb}.table-hover .table-success:hover>td,.table-hover .table-success:hover>th{background-color:#b1dfbb}.table-info,.table-info>td,.table-info>th{background-color:#bee5eb}.table-hover .table-info:hover{background-color:#abdde5}.table-hover .table-info:hover>td,.table-hover .table-info:hover>th{background-color:#abdde5}.table-warning,.table-warning>td,.table-warning>th{background-color:#ffeeba}.table-hover .table-warning:hover{background-color:#ffe8a1}.table-hover .table-warning:hover>td,.table-hover .table-warning:hover>th{background-color:#ffe8a1}.table-danger,.table-danger>td,.table-danger>th{background-color:#f5c6cb}.table-hover .table-danger:hover{background-color:#f1b0b7}.table-hover .table-danger:hover>td,.table-hover .table-danger:hover>th{background-color:#f1b0b7}.table-light,.table-light>td,.table-light>th{background-color:#fdfdfe}.table-hover .table-light:hover{background-color:#ececf6}.table-hover .table-light:hover>td,.table-hover .table-light:hover>th{background-color:#ececf6}.table-dark,.table-dark>td,.table-dark>th{background-color:#c6c8ca}.table-hover .table-dark:hover{background-color:#b9bbbe}.table-hover .table-dark:hover>td,.table-hover .table-dark:hover>th{background-color:#b9bbbe}.table-active,.table-active>td,.table-active>th{background-color:rgba(0,0,0,.075)}.table-hover .table-active:hover{background-color:rgba(0,0,0,.075)}.table-hover .table-active:hover>td,.table-hover .table-active:hover>th{background-color:rgba(0,0,0,.075)}.table .thead-dark th{color:#fff;background-color:#212529;border-color:#32383e}.table .thead-light th{color:#495057;background-color:#e9ecef;border-color:#dee2e6}.table-dark{color:#fff;background-color:#212529}.table-dark td,.table-dark th,.table-dark thead th{border-color:#32383e}.table-dark.table-bordered{border:0}.table-dark.table-striped tbody tr:nth-of-type(odd){background-color:rgba(255,255,255,.05)}.table-dark.table-hover tbody tr:hover{background-color:rgba(255,255,255,.075)}@media (max-width:575.98px){.table-responsive-sm{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar}.table-responsive-sm>.table-bordered{border:0}}@media (max-width:767.98px){.table-responsive-md{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar}.table-responsive-md>.table-bordered{border:0}}@media (max-width:991.98px){.table-responsive-lg{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar}.table-responsive-lg>.table-bordered{border:0}}@media (max-width:1199.98px){.table-responsive-xl{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar}.table-responsive-xl>.table-bordered{border:0}}.table-responsive{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar}.table-responsive>.table-bordered{border:0}.form-control{display:block;width:100%;height:calc(2.25rem + 2px);padding:.375rem .75rem;font-size:1rem;line-height:1.5;color:#495057;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media screen and (prefers-reduced-motion:reduce){.form-control{transition:none}}.form-control::-ms-expand{background-color:transparent;border:0}.form-control:focus{color:#495057;background-color:#fff;border-color:#80bdff;outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.form-control::-webkit-input-placeholder{color:#6c757d;opacity:1}.form-control::-moz-placeholder{color:#6c757d;opacity:1}.form-control:-ms-input-placeholder{color:#6c757d;opacity:1}.form-control::-ms-input-placeholder{color:#6c757d;opacity:1}.form-control::placeholder{color:#6c757d;opacity:1}.form-control:disabled,.form-control[readonly]{background-color:#e9ecef;opacity:1}select.form-control:focus::-ms-value{color:#495057;background-color:#fff}.form-control-file,.form-control-range{display:block;width:100%}.col-form-label{padding-top:calc(.375rem + 1px);padding-bottom:calc(.375rem + 1px);margin-bottom:0;font-size:inherit;line-height:1.5}.col-form-label-lg{padding-top:calc(.5rem + 1px);padding-bottom:calc(.5rem + 1px);font-size:1.25rem;line-height:1.5}.col-form-label-sm{padding-top:calc(.25rem + 1px);padding-bottom:calc(.25rem + 1px);font-size:.875rem;line-height:1.5}.form-control-plaintext{display:block;width:100%;padding-top:.375rem;padding-bottom:.375rem;margin-bottom:0;line-height:1.5;color:#212529;background-color:transparent;border:solid transparent;border-width:1px 0}.form-control-plaintext.form-control-lg,.form-control-plaintext.form-control-sm{padding-right:0;padding-left:0}.form-control-sm{height:calc(1.8125rem + 2px);padding:.25rem .5rem;font-size:.875rem;line-height:1.5;border-radius:.2rem}.form-control-lg{height:calc(2.875rem + 2px);padding:.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:.3rem}select.form-control[multiple],select.form-control[size]{height:auto}textarea.form-control{height:auto}.form-group{margin-bottom:1rem}.form-text{display:block;margin-top:.25rem}.form-row{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:-5px;margin-left:-5px}.form-row>.col,.form-row>[class*=col-]{padding-right:5px;padding-left:5px}.form-check{position:relative;display:block;padding-left:1.25rem}.form-check-input{position:absolute;margin-top:.3rem;margin-left:-1.25rem}.form-check-input:disabled~.form-check-label{color:#6c757d}.form-check-label{margin-bottom:0}.form-check-inline{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;padding-left:0;margin-right:.75rem}.form-check-inline .form-check-input{position:static;margin-top:0;margin-right:.3125rem;margin-left:0}.valid-feedback{display:none;width:100%;margin-top:.25rem;font-size:80%;color:#28a745}.valid-tooltip{position:absolute;top:100%;z-index:5;display:none;max-width:100%;padding:.25rem .5rem;margin-top:.1rem;font-size:.875rem;line-height:1.5;color:#fff;background-color:rgba(40,167,69,.9);border-radius:.25rem}.custom-select.is-valid,.form-control.is-valid,.was-validated .custom-select:valid,.was-validated .form-control:valid{border-color:#28a745}.custom-select.is-valid:focus,.form-control.is-valid:focus,.was-validated .custom-select:valid:focus,.was-validated .form-control:valid:focus{border-color:#28a745;box-shadow:0 0 0 .2rem rgba(40,167,69,.25)}.custom-select.is-valid~.valid-feedback,.custom-select.is-valid~.valid-tooltip,.form-control.is-valid~.valid-feedback,.form-control.is-valid~.valid-tooltip,.was-validated .custom-select:valid~.valid-feedback,.was-validated .custom-select:valid~.valid-tooltip,.was-validated .form-control:valid~.valid-feedback,.was-validated .form-control:valid~.valid-tooltip{display:block}.form-control-file.is-valid~.valid-feedback,.form-control-file.is-valid~.valid-tooltip,.was-validated .form-control-file:valid~.valid-feedback,.was-validated .form-control-file:valid~.valid-tooltip{display:block}.form-check-input.is-valid~.form-check-label,.was-validated .form-check-input:valid~.form-check-label{color:#28a745}.form-check-input.is-valid~.valid-feedback,.form-check-input.is-valid~.valid-tooltip,.was-validated .form-check-input:valid~.valid-feedback,.was-validated .form-check-input:valid~.valid-tooltip{display:block}.custom-control-input.is-valid~.custom-control-label,.was-validated .custom-control-input:valid~.custom-control-label{color:#28a745}.custom-control-input.is-valid~.custom-control-label::before,.was-validated .custom-control-input:valid~.custom-control-label::before{background-color:#71dd8a}.custom-control-input.is-valid~.valid-feedback,.custom-control-input.is-valid~.valid-tooltip,.was-validated .custom-control-input:valid~.valid-feedback,.was-validated .custom-control-input:valid~.valid-tooltip{display:block}.custom-control-input.is-valid:checked~.custom-control-label::before,.was-validated .custom-control-input:valid:checked~.custom-control-label::before{background-color:#34ce57}.custom-control-input.is-valid:focus~.custom-control-label::before,.was-validated .custom-control-input:valid:focus~.custom-control-label::before{box-shadow:0 0 0 1px #fff,0 0 0 .2rem rgba(40,167,69,.25)}.custom-file-input.is-valid~.custom-file-label,.was-validated .custom-file-input:valid~.custom-file-label{border-color:#28a745}.custom-file-input.is-valid~.custom-file-label::after,.was-validated .custom-file-input:valid~.custom-file-label::after{border-color:inherit}.custom-file-input.is-valid~.valid-feedback,.custom-file-input.is-valid~.valid-tooltip,.was-validated .custom-file-input:valid~.valid-feedback,.was-validated .custom-file-input:valid~.valid-tooltip{display:block}.custom-file-input.is-valid:focus~.custom-file-label,.was-validated .custom-file-input:valid:focus~.custom-file-label{box-shadow:0 0 0 .2rem rgba(40,167,69,.25)}.invalid-feedback{display:none;width:100%;margin-top:.25rem;font-size:80%;color:#dc3545}.invalid-tooltip{position:absolute;top:100%;z-index:5;display:none;max-width:100%;padding:.25rem .5rem;margin-top:.1rem;font-size:.875rem;line-height:1.5;color:#fff;background-color:rgba(220,53,69,.9);border-radius:.25rem}.custom-select.is-invalid,.form-control.is-invalid,.was-validated .custom-select:invalid,.was-validated .form-control:invalid{border-color:#dc3545}.custom-select.is-invalid:focus,.form-control.is-invalid:focus,.was-validated .custom-select:invalid:focus,.was-validated .form-control:invalid:focus{border-color:#dc3545;box-shadow:0 0 0 .2rem rgba(220,53,69,.25)}.custom-select.is-invalid~.invalid-feedback,.custom-select.is-invalid~.invalid-tooltip,.form-control.is-invalid~.invalid-feedback,.form-control.is-invalid~.invalid-tooltip,.was-validated .custom-select:invalid~.invalid-feedback,.was-validated .custom-select:invalid~.invalid-tooltip,.was-validated .form-control:invalid~.invalid-feedback,.was-validated .form-control:invalid~.invalid-tooltip{display:block}.form-control-file.is-invalid~.invalid-feedback,.form-control-file.is-invalid~.invalid-tooltip,.was-validated .form-control-file:invalid~.invalid-feedback,.was-validated .form-control-file:invalid~.invalid-tooltip{display:block}.form-check-input.is-invalid~.form-check-label,.was-validated .form-check-input:invalid~.form-check-label{color:#dc3545}.form-check-input.is-invalid~.invalid-feedback,.form-check-input.is-invalid~.invalid-tooltip,.was-validated .form-check-input:invalid~.invalid-feedback,.was-validated .form-check-input:invalid~.invalid-tooltip{display:block}.custom-control-input.is-invalid~.custom-control-label,.was-validated .custom-control-input:invalid~.custom-control-label{color:#dc3545}.custom-control-input.is-invalid~.custom-control-label::before,.was-validated .custom-control-input:invalid~.custom-control-label::before{background-color:#efa2a9}.custom-control-input.is-invalid~.invalid-feedback,.custom-control-input.is-invalid~.invalid-tooltip,.was-validated .custom-control-input:invalid~.invalid-feedback,.was-validated .custom-control-input:invalid~.invalid-tooltip{display:block}.custom-control-input.is-invalid:checked~.custom-control-label::before,.was-validated .custom-control-input:invalid:checked~.custom-control-label::before{background-color:#e4606d}.custom-control-input.is-invalid:focus~.custom-control-label::before,.was-validated .custom-control-input:invalid:focus~.custom-control-label::before{box-shadow:0 0 0 1px #fff,0 0 0 .2rem rgba(220,53,69,.25)}.custom-file-input.is-invalid~.custom-file-label,.was-validated .custom-file-input:invalid~.custom-file-label{border-color:#dc3545}.custom-file-input.is-invalid~.custom-file-label::after,.was-validated .custom-file-input:invalid~.custom-file-label::after{border-color:inherit}.custom-file-input.is-invalid~.invalid-feedback,.custom-file-input.is-invalid~.invalid-tooltip,.was-validated .custom-file-input:invalid~.invalid-feedback,.was-validated .custom-file-input:invalid~.invalid-tooltip{display:block}.custom-file-input.is-invalid:focus~.custom-file-label,.was-validated .custom-file-input:invalid:focus~.custom-file-label{box-shadow:0 0 0 .2rem rgba(220,53,69,.25)}.form-inline{display:-ms-flexbox;display:flex;-ms-flex-flow:row wrap;flex-flow:row wrap;-ms-flex-align:center;align-items:center}.form-inline .form-check{width:100%}@media (min-width:576px){.form-inline label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;margin-bottom:0}.form-inline .form-group{display:-ms-flexbox;display:flex;-ms-flex:0 0 auto;flex:0 0 auto;-ms-flex-flow:row wrap;flex-flow:row wrap;-ms-flex-align:center;align-items:center;margin-bottom:0}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-plaintext{display:inline-block}.form-inline .custom-select,.form-inline .input-group{width:auto}.form-inline .form-check{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:auto;padding-left:0}.form-inline .form-check-input{position:relative;margin-top:0;margin-right:.25rem;margin-left:0}.form-inline .custom-control{-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.form-inline .custom-control-label{margin-bottom:0}}.btn{display:inline-block;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:1px solid transparent;padding:.375rem .75rem;font-size:1rem;line-height:1.5;border-radius:.25rem;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media screen and (prefers-reduced-motion:reduce){.btn{transition:none}}.btn:focus,.btn:hover{text-decoration:none}.btn.focus,.btn:focus{outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.btn.disabled,.btn:disabled{opacity:.65}.btn:not(:disabled):not(.disabled){cursor:pointer}a.btn.disabled,fieldset:disabled a.btn{pointer-events:none}.btn-primary{color:#fff;background-color:#007bff;border-color:#007bff}.btn-primary:hover{color:#fff;background-color:#0069d9;border-color:#0062cc}.btn-primary.focus,.btn-primary:focus{box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}.btn-primary.disabled,.btn-primary:disabled{color:#fff;background-color:#007bff;border-color:#007bff}.btn-primary:not(:disabled):not(.disabled).active,.btn-primary:not(:disabled):not(.disabled):active,.show>.btn-primary.dropdown-toggle{color:#fff;background-color:#0062cc;border-color:#005cbf}.btn-primary:not(:disabled):not(.disabled).active:focus,.btn-primary:not(:disabled):not(.disabled):active:focus,.show>.btn-primary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}.btn-secondary{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-secondary:hover{color:#fff;background-color:#5a6268;border-color:#545b62}.btn-secondary.focus,.btn-secondary:focus{box-shadow:0 0 0 .2rem rgba(108,117,125,.5)}.btn-secondary.disabled,.btn-secondary:disabled{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-secondary:not(:disabled):not(.disabled).active,.btn-secondary:not(:disabled):not(.disabled):active,.show>.btn-secondary.dropdown-toggle{color:#fff;background-color:#545b62;border-color:#4e555b}.btn-secondary:not(:disabled):not(.disabled).active:focus,.btn-secondary:not(:disabled):not(.disabled):active:focus,.show>.btn-secondary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(108,117,125,.5)}.btn-success{color:#fff;background-color:#28a745;border-color:#28a745}.btn-success:hover{color:#fff;background-color:#218838;border-color:#1e7e34}.btn-success.focus,.btn-success:focus{box-shadow:0 0 0 .2rem rgba(40,167,69,.5)}.btn-success.disabled,.btn-success:disabled{color:#fff;background-color:#28a745;border-color:#28a745}.btn-success:not(:disabled):not(.disabled).active,.btn-success:not(:disabled):not(.disabled):active,.show>.btn-success.dropdown-toggle{color:#fff;background-color:#1e7e34;border-color:#1c7430}.btn-success:not(:disabled):not(.disabled).active:focus,.btn-success:not(:disabled):not(.disabled):active:focus,.show>.btn-success.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(40,167,69,.5)}.btn-info{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-info:hover{color:#fff;background-color:#138496;border-color:#117a8b}.btn-info.focus,.btn-info:focus{box-shadow:0 0 0 .2rem rgba(23,162,184,.5)}.btn-info.disabled,.btn-info:disabled{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-info:not(:disabled):not(.disabled).active,.btn-info:not(:disabled):not(.disabled):active,.show>.btn-info.dropdown-toggle{color:#fff;background-color:#117a8b;border-color:#10707f}.btn-info:not(:disabled):not(.disabled).active:focus,.btn-info:not(:disabled):not(.disabled):active:focus,.show>.btn-info.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(23,162,184,.5)}.btn-warning{color:#212529;background-color:#ffc107;border-color:#ffc107}.btn-warning:hover{color:#212529;background-color:#e0a800;border-color:#d39e00}.btn-warning.focus,.btn-warning:focus{box-shadow:0 0 0 .2rem rgba(255,193,7,.5)}.btn-warning.disabled,.btn-warning:disabled{color:#212529;background-color:#ffc107;border-color:#ffc107}.btn-warning:not(:disabled):not(.disabled).active,.btn-warning:not(:disabled):not(.disabled):active,.show>.btn-warning.dropdown-toggle{color:#212529;background-color:#d39e00;border-color:#c69500}.btn-warning:not(:disabled):not(.disabled).active:focus,.btn-warning:not(:disabled):not(.disabled):active:focus,.show>.btn-warning.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(255,193,7,.5)}.btn-danger{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-danger:hover{color:#fff;background-color:#c82333;border-color:#bd2130}.btn-danger.focus,.btn-danger:focus{box-shadow:0 0 0 .2rem rgba(220,53,69,.5)}.btn-danger.disabled,.btn-danger:disabled{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-danger:not(:disabled):not(.disabled).active,.btn-danger:not(:disabled):not(.disabled):active,.show>.btn-danger.dropdown-toggle{color:#fff;background-color:#bd2130;border-color:#b21f2d}.btn-danger:not(:disabled):not(.disabled).active:focus,.btn-danger:not(:disabled):not(.disabled):active:focus,.show>.btn-danger.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(220,53,69,.5)}.btn-light{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-light:hover{color:#212529;background-color:#e2e6ea;border-color:#dae0e5}.btn-light.focus,.btn-light:focus{box-shadow:0 0 0 .2rem rgba(248,249,250,.5)}.btn-light.disabled,.btn-light:disabled{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-light:not(:disabled):not(.disabled).active,.btn-light:not(:disabled):not(.disabled):active,.show>.btn-light.dropdown-toggle{color:#212529;background-color:#dae0e5;border-color:#d3d9df}.btn-light:not(:disabled):not(.disabled).active:focus,.btn-light:not(:disabled):not(.disabled):active:focus,.show>.btn-light.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(248,249,250,.5)}.btn-dark{color:#fff;background-color:#343a40;border-color:#343a40}.btn-dark:hover{color:#fff;background-color:#23272b;border-color:#1d2124}.btn-dark.focus,.btn-dark:focus{box-shadow:0 0 0 .2rem rgba(52,58,64,.5)}.btn-dark.disabled,.btn-dark:disabled{color:#fff;background-color:#343a40;border-color:#343a40}.btn-dark:not(:disabled):not(.disabled).active,.btn-dark:not(:disabled):not(.disabled):active,.show>.btn-dark.dropdown-toggle{color:#fff;background-color:#1d2124;border-color:#171a1d}.btn-dark:not(:disabled):not(.disabled).active:focus,.btn-dark:not(:disabled):not(.disabled):active:focus,.show>.btn-dark.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(52,58,64,.5)}.btn-outline-primary{color:#007bff;background-color:transparent;background-image:none;border-color:#007bff}.btn-outline-primary:hover{color:#fff;background-color:#007bff;border-color:#007bff}.btn-outline-primary.focus,.btn-outline-primary:focus{box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}.btn-outline-primary.disabled,.btn-outline-primary:disabled{color:#007bff;background-color:transparent}.btn-outline-primary:not(:disabled):not(.disabled).active,.btn-outline-primary:not(:disabled):not(.disabled):active,.show>.btn-outline-primary.dropdown-toggle{color:#fff;background-color:#007bff;border-color:#007bff}.btn-outline-primary:not(:disabled):not(.disabled).active:focus,.btn-outline-primary:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-primary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}.btn-outline-secondary{color:#6c757d;background-color:transparent;background-image:none;border-color:#6c757d}.btn-outline-secondary:hover{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-outline-secondary.focus,.btn-outline-secondary:focus{box-shadow:0 0 0 .2rem rgba(108,117,125,.5)}.btn-outline-secondary.disabled,.btn-outline-secondary:disabled{color:#6c757d;background-color:transparent}.btn-outline-secondary:not(:disabled):not(.disabled).active,.btn-outline-secondary:not(:disabled):not(.disabled):active,.show>.btn-outline-secondary.dropdown-toggle{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-outline-secondary:not(:disabled):not(.disabled).active:focus,.btn-outline-secondary:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-secondary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(108,117,125,.5)}.btn-outline-success{color:#28a745;background-color:transparent;background-image:none;border-color:#28a745}.btn-outline-success:hover{color:#fff;background-color:#28a745;border-color:#28a745}.btn-outline-success.focus,.btn-outline-success:focus{box-shadow:0 0 0 .2rem rgba(40,167,69,.5)}.btn-outline-success.disabled,.btn-outline-success:disabled{color:#28a745;background-color:transparent}.btn-outline-success:not(:disabled):not(.disabled).active,.btn-outline-success:not(:disabled):not(.disabled):active,.show>.btn-outline-success.dropdown-toggle{color:#fff;background-color:#28a745;border-color:#28a745}.btn-outline-success:not(:disabled):not(.disabled).active:focus,.btn-outline-success:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-success.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(40,167,69,.5)}.btn-outline-info{color:#17a2b8;background-color:transparent;background-image:none;border-color:#17a2b8}.btn-outline-info:hover{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-outline-info.focus,.btn-outline-info:focus{box-shadow:0 0 0 .2rem rgba(23,162,184,.5)}.btn-outline-info.disabled,.btn-outline-info:disabled{color:#17a2b8;background-color:transparent}.btn-outline-info:not(:disabled):not(.disabled).active,.btn-outline-info:not(:disabled):not(.disabled):active,.show>.btn-outline-info.dropdown-toggle{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-outline-info:not(:disabled):not(.disabled).active:focus,.btn-outline-info:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-info.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(23,162,184,.5)}.btn-outline-warning{color:#ffc107;background-color:transparent;background-image:none;border-color:#ffc107}.btn-outline-warning:hover{color:#212529;background-color:#ffc107;border-color:#ffc107}.btn-outline-warning.focus,.btn-outline-warning:focus{box-shadow:0 0 0 .2rem rgba(255,193,7,.5)}.btn-outline-warning.disabled,.btn-outline-warning:disabled{color:#ffc107;background-color:transparent}.btn-outline-warning:not(:disabled):not(.disabled).active,.btn-outline-warning:not(:disabled):not(.disabled):active,.show>.btn-outline-warning.dropdown-toggle{color:#212529;background-color:#ffc107;border-color:#ffc107}.btn-outline-warning:not(:disabled):not(.disabled).active:focus,.btn-outline-warning:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-warning.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(255,193,7,.5)}.btn-outline-danger{color:#dc3545;background-color:transparent;background-image:none;border-color:#dc3545}.btn-outline-danger:hover{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-outline-danger.focus,.btn-outline-danger:focus{box-shadow:0 0 0 .2rem rgba(220,53,69,.5)}.btn-outline-danger.disabled,.btn-outline-danger:disabled{color:#dc3545;background-color:transparent}.btn-outline-danger:not(:disabled):not(.disabled).active,.btn-outline-danger:not(:disabled):not(.disabled):active,.show>.btn-outline-danger.dropdown-toggle{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-outline-danger:not(:disabled):not(.disabled).active:focus,.btn-outline-danger:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-danger.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(220,53,69,.5)}.btn-outline-light{color:#f8f9fa;background-color:transparent;background-image:none;border-color:#f8f9fa}.btn-outline-light:hover{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-outline-light.focus,.btn-outline-light:focus{box-shadow:0 0 0 .2rem rgba(248,249,250,.5)}.btn-outline-light.disabled,.btn-outline-light:disabled{color:#f8f9fa;background-color:transparent}.btn-outline-light:not(:disabled):not(.disabled).active,.btn-outline-light:not(:disabled):not(.disabled):active,.show>.btn-outline-light.dropdown-toggle{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-outline-light:not(:disabled):not(.disabled).active:focus,.btn-outline-light:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-light.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(248,249,250,.5)}.btn-outline-dark{color:#343a40;background-color:transparent;background-image:none;border-color:#343a40}.btn-outline-dark:hover{color:#fff;background-color:#343a40;border-color:#343a40}.btn-outline-dark.focus,.btn-outline-dark:focus{box-shadow:0 0 0 .2rem rgba(52,58,64,.5)}.btn-outline-dark.disabled,.btn-outline-dark:disabled{color:#343a40;background-color:transparent}.btn-outline-dark:not(:disabled):not(.disabled).active,.btn-outline-dark:not(:disabled):not(.disabled):active,.show>.btn-outline-dark.dropdown-toggle{color:#fff;background-color:#343a40;border-color:#343a40}.btn-outline-dark:not(:disabled):not(.disabled).active:focus,.btn-outline-dark:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-dark.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(52,58,64,.5)}.btn-link{font-weight:400;color:#007bff;background-color:transparent}.btn-link:hover{color:#0056b3;text-decoration:underline;background-color:transparent;border-color:transparent}.btn-link.focus,.btn-link:focus{text-decoration:underline;border-color:transparent;box-shadow:none}.btn-link.disabled,.btn-link:disabled{color:#6c757d;pointer-events:none}.btn-group-lg>.btn,.btn-lg{padding:.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:.3rem}.btn-group-sm>.btn,.btn-sm{padding:.25rem .5rem;font-size:.875rem;line-height:1.5;border-radius:.2rem}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:.5rem}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{transition:opacity .15s linear}@media screen and (prefers-reduced-motion:reduce){.fade{transition:none}}.fade:not(.show){opacity:0}.collapse:not(.show){display:none}.collapsing{position:relative;height:0;overflow:hidden;transition:height .35s ease}@media screen and (prefers-reduced-motion:reduce){.collapsing{transition:none}}.dropdown,.dropleft,.dropright,.dropup{position:relative}.dropdown-toggle::after{display:inline-block;width:0;height:0;margin-left:.255em;vertical-align:.255em;content:"";border-top:.3em solid;border-right:.3em solid transparent;border-bottom:0;border-left:.3em solid transparent}.dropdown-toggle:empty::after{margin-left:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:10rem;padding:.5rem 0;margin:.125rem 0 0;font-size:1rem;color:#212529;text-align:left;list-style:none;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.15);border-radius:.25rem}.dropdown-menu-right{right:0;left:auto}.dropup .dropdown-menu{top:auto;bottom:100%;margin-top:0;margin-bottom:.125rem}.dropup .dropdown-toggle::after{display:inline-block;width:0;height:0;margin-left:.255em;vertical-align:.255em;content:"";border-top:0;border-right:.3em solid transparent;border-bottom:.3em solid;border-left:.3em solid transparent}.dropup .dropdown-toggle:empty::after{margin-left:0}.dropright .dropdown-menu{top:0;right:auto;left:100%;margin-top:0;margin-left:.125rem}.dropright .dropdown-toggle::after{display:inline-block;width:0;height:0;margin-left:.255em;vertical-align:.255em;content:"";border-top:.3em solid transparent;border-right:0;border-bottom:.3em solid transparent;border-left:.3em solid}.dropright .dropdown-toggle:empty::after{margin-left:0}.dropright .dropdown-toggle::after{vertical-align:0}.dropleft .dropdown-menu{top:0;right:100%;left:auto;margin-top:0;margin-right:.125rem}.dropleft .dropdown-toggle::after{display:inline-block;width:0;height:0;margin-left:.255em;vertical-align:.255em;content:""}.dropleft .dropdown-toggle::after{display:none}.dropleft .dropdown-toggle::before{display:inline-block;width:0;height:0;margin-right:.255em;vertical-align:.255em;content:"";border-top:.3em solid transparent;border-right:.3em solid;border-bottom:.3em solid transparent}.dropleft .dropdown-toggle:empty::after{margin-left:0}.dropleft .dropdown-toggle::before{vertical-align:0}.dropdown-menu[x-placement^=bottom],.dropdown-menu[x-placement^=left],.dropdown-menu[x-placement^=right],.dropdown-menu[x-placement^=top]{right:auto;bottom:auto}.dropdown-divider{height:0;margin:.5rem 0;overflow:hidden;border-top:1px solid #e9ecef}.dropdown-item{display:block;width:100%;padding:.25rem 1.5rem;clear:both;font-weight:400;color:#212529;text-align:inherit;white-space:nowrap;background-color:transparent;border:0}.dropdown-item:focus,.dropdown-item:hover{color:#16181b;text-decoration:none;background-color:#f8f9fa}.dropdown-item.active,.dropdown-item:active{color:#fff;text-decoration:none;background-color:#007bff}.dropdown-item.disabled,.dropdown-item:disabled{color:#6c757d;background-color:transparent}.dropdown-menu.show{display:block}.dropdown-header{display:block;padding:.5rem 1.5rem;margin-bottom:0;font-size:.875rem;color:#6c757d;white-space:nowrap}.dropdown-item-text{display:block;padding:.25rem 1.5rem;color:#212529}.btn-group,.btn-group-vertical{position:relative;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;-ms-flex:0 1 auto;flex:0 1 auto}.btn-group-vertical>.btn:hover,.btn-group>.btn:hover{z-index:1}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus{z-index:1}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group,.btn-group-vertical .btn+.btn,.btn-group-vertical .btn+.btn-group,.btn-group-vertical .btn-group+.btn,.btn-group-vertical .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:start;justify-content:flex-start}.btn-toolbar .input-group{width:auto}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn-group:not(:last-child)>.btn,.btn-group>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:not(:first-child)>.btn,.btn-group>.btn:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.dropdown-toggle-split{padding-right:.5625rem;padding-left:.5625rem}.dropdown-toggle-split::after,.dropright .dropdown-toggle-split::after,.dropup .dropdown-toggle-split::after{margin-left:0}.dropleft .dropdown-toggle-split::before{margin-right:0}.btn-group-sm>.btn+.dropdown-toggle-split,.btn-sm+.dropdown-toggle-split{padding-right:.375rem;padding-left:.375rem}.btn-group-lg>.btn+.dropdown-toggle-split,.btn-lg+.dropdown-toggle-split{padding-right:.75rem;padding-left:.75rem}.btn-group-vertical{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:center;justify-content:center}.btn-group-vertical .btn,.btn-group-vertical .btn-group{width:100%}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn-group:not(:last-child)>.btn,.btn-group-vertical>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:not(:first-child)>.btn,.btn-group-vertical>.btn:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}.btn-group-toggle>.btn,.btn-group-toggle>.btn-group>.btn{margin-bottom:0}.btn-group-toggle>.btn input[type=checkbox],.btn-group-toggle>.btn input[type=radio],.btn-group-toggle>.btn-group>.btn input[type=checkbox],.btn-group-toggle>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:stretch;align-items:stretch;width:100%}.input-group>.custom-file,.input-group>.custom-select,.input-group>.form-control{position:relative;-ms-flex:1 1 auto;flex:1 1 auto;width:1%;margin-bottom:0}.input-group>.custom-file+.custom-file,.input-group>.custom-file+.custom-select,.input-group>.custom-file+.form-control,.input-group>.custom-select+.custom-file,.input-group>.custom-select+.custom-select,.input-group>.custom-select+.form-control,.input-group>.form-control+.custom-file,.input-group>.form-control+.custom-select,.input-group>.form-control+.form-control{margin-left:-1px}.input-group>.custom-file .custom-file-input:focus~.custom-file-label,.input-group>.custom-select:focus,.input-group>.form-control:focus{z-index:3}.input-group>.custom-file .custom-file-input:focus{z-index:4}.input-group>.custom-select:not(:last-child),.input-group>.form-control:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.custom-select:not(:first-child),.input-group>.form-control:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.input-group>.custom-file{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.input-group>.custom-file:not(:last-child) .custom-file-label,.input-group>.custom-file:not(:last-child) .custom-file-label::after{border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.custom-file:not(:first-child) .custom-file-label{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-append,.input-group-prepend{display:-ms-flexbox;display:flex}.input-group-append .btn,.input-group-prepend .btn{position:relative;z-index:2}.input-group-append .btn+.btn,.input-group-append .btn+.input-group-text,.input-group-append .input-group-text+.btn,.input-group-append .input-group-text+.input-group-text,.input-group-prepend .btn+.btn,.input-group-prepend .btn+.input-group-text,.input-group-prepend .input-group-text+.btn,.input-group-prepend .input-group-text+.input-group-text{margin-left:-1px}.input-group-prepend{margin-right:-1px}.input-group-append{margin-left:-1px}.input-group-text{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:.375rem .75rem;margin-bottom:0;font-size:1rem;font-weight:400;line-height:1.5;color:#495057;text-align:center;white-space:nowrap;background-color:#e9ecef;border:1px solid #ced4da;border-radius:.25rem}.input-group-text input[type=checkbox],.input-group-text input[type=radio]{margin-top:0}.input-group-lg>.form-control,.input-group-lg>.input-group-append>.btn,.input-group-lg>.input-group-append>.input-group-text,.input-group-lg>.input-group-prepend>.btn,.input-group-lg>.input-group-prepend>.input-group-text{height:calc(2.875rem + 2px);padding:.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:.3rem}.input-group-sm>.form-control,.input-group-sm>.input-group-append>.btn,.input-group-sm>.input-group-append>.input-group-text,.input-group-sm>.input-group-prepend>.btn,.input-group-sm>.input-group-prepend>.input-group-text{height:calc(1.8125rem + 2px);padding:.25rem .5rem;font-size:.875rem;line-height:1.5;border-radius:.2rem}.input-group>.input-group-append:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group>.input-group-append:last-child>.input-group-text:not(:last-child),.input-group>.input-group-append:not(:last-child)>.btn,.input-group>.input-group-append:not(:last-child)>.input-group-text,.input-group>.input-group-prepend>.btn,.input-group>.input-group-prepend>.input-group-text{border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.input-group-append>.btn,.input-group>.input-group-append>.input-group-text,.input-group>.input-group-prepend:first-child>.btn:not(:first-child),.input-group>.input-group-prepend:first-child>.input-group-text:not(:first-child),.input-group>.input-group-prepend:not(:first-child)>.btn,.input-group>.input-group-prepend:not(:first-child)>.input-group-text{border-top-left-radius:0;border-bottom-left-radius:0}.custom-control{position:relative;display:block;min-height:1.5rem;padding-left:1.5rem}.custom-control-inline{display:-ms-inline-flexbox;display:inline-flex;margin-right:1rem}.custom-control-input{position:absolute;z-index:-1;opacity:0}.custom-control-input:checked~.custom-control-label::before{color:#fff;background-color:#007bff}.custom-control-input:focus~.custom-control-label::before{box-shadow:0 0 0 1px #fff,0 0 0 .2rem rgba(0,123,255,.25)}.custom-control-input:active~.custom-control-label::before{color:#fff;background-color:#b3d7ff}.custom-control-input:disabled~.custom-control-label{color:#6c757d}.custom-control-input:disabled~.custom-control-label::before{background-color:#e9ecef}.custom-control-label{position:relative;margin-bottom:0}.custom-control-label::before{position:absolute;top:.25rem;left:-1.5rem;display:block;width:1rem;height:1rem;pointer-events:none;content:"";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#dee2e6}.custom-control-label::after{position:absolute;top:.25rem;left:-1.5rem;display:block;width:1rem;height:1rem;content:"";background-repeat:no-repeat;background-position:center center;background-size:50% 50%}.custom-checkbox .custom-control-label::before{border-radius:.25rem}.custom-checkbox .custom-control-input:checked~.custom-control-label::before{background-color:#007bff}.custom-checkbox .custom-control-input:checked~.custom-control-label::after{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3E%3C/svg%3E")}.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before{background-color:#007bff}.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::after{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4'%3E%3Cpath stroke='%23fff' d='M0 2h4'/%3E%3C/svg%3E")}.custom-checkbox .custom-control-input:disabled:checked~.custom-control-label::before{background-color:rgba(0,123,255,.5)}.custom-checkbox .custom-control-input:disabled:indeterminate~.custom-control-label::before{background-color:rgba(0,123,255,.5)}.custom-radio .custom-control-label::before{border-radius:50%}.custom-radio .custom-control-input:checked~.custom-control-label::before{background-color:#007bff}.custom-radio .custom-control-input:checked~.custom-control-label::after{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23fff'/%3E%3C/svg%3E")}.custom-radio .custom-control-input:disabled:checked~.custom-control-label::before{background-color:rgba(0,123,255,.5)}.custom-select{display:inline-block;width:100%;height:calc(2.25rem + 2px);padding:.375rem 1.75rem .375rem .75rem;line-height:1.5;color:#495057;vertical-align:middle;background:#fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right .75rem center;background-size:8px 10px;border:1px solid #ced4da;border-radius:.25rem;-webkit-appearance:none;-moz-appearance:none;appearance:none}.custom-select:focus{border-color:#80bdff;outline:0;box-shadow:0 0 0 .2rem rgba(128,189,255,.5)}.custom-select:focus::-ms-value{color:#495057;background-color:#fff}.custom-select[multiple],.custom-select[size]:not([size="1"]){height:auto;padding-right:.75rem;background-image:none}.custom-select:disabled{color:#6c757d;background-color:#e9ecef}.custom-select::-ms-expand{opacity:0}.custom-select-sm{height:calc(1.8125rem + 2px);padding-top:.375rem;padding-bottom:.375rem;font-size:75%}.custom-select-lg{height:calc(2.875rem + 2px);padding-top:.375rem;padding-bottom:.375rem;font-size:125%}.custom-file{position:relative;display:inline-block;width:100%;height:calc(2.25rem + 2px);margin-bottom:0}.custom-file-input{position:relative;z-index:2;width:100%;height:calc(2.25rem + 2px);margin:0;opacity:0}.custom-file-input:focus~.custom-file-label{border-color:#80bdff;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.custom-file-input:focus~.custom-file-label::after{border-color:#80bdff}.custom-file-input:disabled~.custom-file-label{background-color:#e9ecef}.custom-file-input:lang(en)~.custom-file-label::after{content:"Browse"}.custom-file-label{position:absolute;top:0;right:0;left:0;z-index:1;height:calc(2.25rem + 2px);padding:.375rem .75rem;line-height:1.5;color:#495057;background-color:#fff;border:1px solid #ced4da;border-radius:.25rem}.custom-file-label::after{position:absolute;top:0;right:0;bottom:0;z-index:3;display:block;height:2.25rem;padding:.375rem .75rem;line-height:1.5;color:#495057;content:"Browse";background-color:#e9ecef;border-left:1px solid #ced4da;border-radius:0 .25rem .25rem 0}.custom-range{width:100%;padding-left:0;background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none}.custom-range:focus{outline:0}.custom-range:focus::-webkit-slider-thumb{box-shadow:0 0 0 1px #fff,0 0 0 .2rem rgba(0,123,255,.25)}.custom-range:focus::-moz-range-thumb{box-shadow:0 0 0 1px #fff,0 0 0 .2rem rgba(0,123,255,.25)}.custom-range:focus::-ms-thumb{box-shadow:0 0 0 1px #fff,0 0 0 .2rem rgba(0,123,255,.25)}.custom-range::-moz-focus-outer{border:0}.custom-range::-webkit-slider-thumb{width:1rem;height:1rem;margin-top:-.25rem;background-color:#007bff;border:0;border-radius:1rem;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;-webkit-appearance:none;appearance:none}@media screen and (prefers-reduced-motion:reduce){.custom-range::-webkit-slider-thumb{transition:none}}.custom-range::-webkit-slider-thumb:active{background-color:#b3d7ff}.custom-range::-webkit-slider-runnable-track{width:100%;height:.5rem;color:transparent;cursor:pointer;background-color:#dee2e6;border-color:transparent;border-radius:1rem}.custom-range::-moz-range-thumb{width:1rem;height:1rem;background-color:#007bff;border:0;border-radius:1rem;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;-moz-appearance:none;appearance:none}@media screen and (prefers-reduced-motion:reduce){.custom-range::-moz-range-thumb{transition:none}}.custom-range::-moz-range-thumb:active{background-color:#b3d7ff}.custom-range::-moz-range-track{width:100%;height:.5rem;color:transparent;cursor:pointer;background-color:#dee2e6;border-color:transparent;border-radius:1rem}.custom-range::-ms-thumb{width:1rem;height:1rem;margin-top:0;margin-right:.2rem;margin-left:.2rem;background-color:#007bff;border:0;border-radius:1rem;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;appearance:none}@media screen and (prefers-reduced-motion:reduce){.custom-range::-ms-thumb{transition:none}}.custom-range::-ms-thumb:active{background-color:#b3d7ff}.custom-range::-ms-track{width:100%;height:.5rem;color:transparent;cursor:pointer;background-color:transparent;border-color:transparent;border-width:.5rem}.custom-range::-ms-fill-lower{background-color:#dee2e6;border-radius:1rem}.custom-range::-ms-fill-upper{margin-right:15px;background-color:#dee2e6;border-radius:1rem}.custom-control-label::before,.custom-file-label,.custom-select{transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media screen and (prefers-reduced-motion:reduce){.custom-control-label::before,.custom-file-label,.custom-select{transition:none}}.nav{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;padding-left:0;margin-bottom:0;list-style:none}.nav-link{display:block;padding:.5rem 1rem}.nav-link:focus,.nav-link:hover{text-decoration:none}.nav-link.disabled{color:#6c757d}.nav-tabs{border-bottom:1px solid #dee2e6}.nav-tabs .nav-item{margin-bottom:-1px}.nav-tabs .nav-link{border:1px solid transparent;border-top-left-radius:.25rem;border-top-right-radius:.25rem}.nav-tabs .nav-link:focus,.nav-tabs .nav-link:hover{border-color:#e9ecef #e9ecef #dee2e6}.nav-tabs .nav-link.disabled{color:#6c757d;background-color:transparent;border-color:transparent}.nav-tabs .nav-item.show .nav-link,.nav-tabs .nav-link.active{color:#495057;background-color:#fff;border-color:#dee2e6 #dee2e6 #fff}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.nav-pills .nav-link{border-radius:.25rem}.nav-pills .nav-link.active,.nav-pills .show>.nav-link{color:#fff;background-color:#007bff}.nav-fill .nav-item{-ms-flex:1 1 auto;flex:1 1 auto;text-align:center}.nav-justified .nav-item{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;text-align:center}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.navbar{position:relative;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:.5rem 1rem}.navbar>.container,.navbar>.container-fluid{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between}.navbar-brand{display:inline-block;padding-top:.3125rem;padding-bottom:.3125rem;margin-right:1rem;font-size:1.25rem;line-height:inherit;white-space:nowrap}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-nav{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding-left:0;margin-bottom:0;list-style:none}.navbar-nav .nav-link{padding-right:0;padding-left:0}.navbar-nav .dropdown-menu{position:static;float:none}.navbar-text{display:inline-block;padding-top:.5rem;padding-bottom:.5rem}.navbar-collapse{-ms-flex-preferred-size:100%;flex-basis:100%;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center}.navbar-toggler{padding:.25rem .75rem;font-size:1.25rem;line-height:1;background-color:transparent;border:1px solid transparent;border-radius:.25rem}.navbar-toggler:focus,.navbar-toggler:hover{text-decoration:none}.navbar-toggler:not(:disabled):not(.disabled){cursor:pointer}.navbar-toggler-icon{display:inline-block;width:1.5em;height:1.5em;vertical-align:middle;content:"";background:no-repeat center center;background-size:100% 100%}@media (max-width:575.98px){.navbar-expand-sm>.container,.navbar-expand-sm>.container-fluid{padding-right:0;padding-left:0}}@media (min-width:576px){.navbar-expand-sm{-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-pack:start;justify-content:flex-start}.navbar-expand-sm .navbar-nav{-ms-flex-direction:row;flex-direction:row}.navbar-expand-sm .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-sm .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-sm>.container,.navbar-expand-sm>.container-fluid{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.navbar-expand-sm .navbar-collapse{display:-ms-flexbox!important;display:flex!important;-ms-flex-preferred-size:auto;flex-basis:auto}.navbar-expand-sm .navbar-toggler{display:none}}@media (max-width:767.98px){.navbar-expand-md>.container,.navbar-expand-md>.container-fluid{padding-right:0;padding-left:0}}@media (min-width:768px){.navbar-expand-md{-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-pack:start;justify-content:flex-start}.navbar-expand-md .navbar-nav{-ms-flex-direction:row;flex-direction:row}.navbar-expand-md .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-md .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-md>.container,.navbar-expand-md>.container-fluid{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.navbar-expand-md .navbar-collapse{display:-ms-flexbox!important;display:flex!important;-ms-flex-preferred-size:auto;flex-basis:auto}.navbar-expand-md .navbar-toggler{display:none}}@media (max-width:991.98px){.navbar-expand-lg>.container,.navbar-expand-lg>.container-fluid{padding-right:0;padding-left:0}}@media (min-width:992px){.navbar-expand-lg{-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-pack:start;justify-content:flex-start}.navbar-expand-lg .navbar-nav{-ms-flex-direction:row;flex-direction:row}.navbar-expand-lg .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-lg .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-lg>.container,.navbar-expand-lg>.container-fluid{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.navbar-expand-lg .navbar-collapse{display:-ms-flexbox!important;display:flex!important;-ms-flex-preferred-size:auto;flex-basis:auto}.navbar-expand-lg .navbar-toggler{display:none}}@media (max-width:1199.98px){.navbar-expand-xl>.container,.navbar-expand-xl>.container-fluid{padding-right:0;padding-left:0}}@media (min-width:1200px){.navbar-expand-xl{-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-pack:start;justify-content:flex-start}.navbar-expand-xl .navbar-nav{-ms-flex-direction:row;flex-direction:row}.navbar-expand-xl .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-xl .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-xl>.container,.navbar-expand-xl>.container-fluid{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.navbar-expand-xl .navbar-collapse{display:-ms-flexbox!important;display:flex!important;-ms-flex-preferred-size:auto;flex-basis:auto}.navbar-expand-xl .navbar-toggler{display:none}}.navbar-expand{-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-pack:start;justify-content:flex-start}.navbar-expand>.container,.navbar-expand>.container-fluid{padding-right:0;padding-left:0}.navbar-expand .navbar-nav{-ms-flex-direction:row;flex-direction:row}.navbar-expand .navbar-nav .dropdown-menu{position:absolute}.navbar-expand .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand>.container,.navbar-expand>.container-fluid{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.navbar-expand .navbar-collapse{display:-ms-flexbox!important;display:flex!important;-ms-flex-preferred-size:auto;flex-basis:auto}.navbar-expand .navbar-toggler{display:none}.navbar-light .navbar-brand{color:rgba(0,0,0,.9)}.navbar-light .navbar-brand:focus,.navbar-light .navbar-brand:hover{color:rgba(0,0,0,.9)}.navbar-light .navbar-nav .nav-link{color:rgba(0,0,0,.5)}.navbar-light .navbar-nav .nav-link:focus,.navbar-light .navbar-nav .nav-link:hover{color:rgba(0,0,0,.7)}.navbar-light .navbar-nav .nav-link.disabled{color:rgba(0,0,0,.3)}.navbar-light .navbar-nav .active>.nav-link,.navbar-light .navbar-nav .nav-link.active,.navbar-light .navbar-nav .nav-link.show,.navbar-light .navbar-nav .show>.nav-link{color:rgba(0,0,0,.9)}.navbar-light .navbar-toggler{color:rgba(0,0,0,.5);border-color:rgba(0,0,0,.1)}.navbar-light .navbar-toggler-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(0, 0, 0, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E")}.navbar-light .navbar-text{color:rgba(0,0,0,.5)}.navbar-light .navbar-text a{color:rgba(0,0,0,.9)}.navbar-light .navbar-text a:focus,.navbar-light .navbar-text a:hover{color:rgba(0,0,0,.9)}.navbar-dark .navbar-brand{color:#fff}.navbar-dark .navbar-brand:focus,.navbar-dark .navbar-brand:hover{color:#fff}.navbar-dark .navbar-nav .nav-link{color:rgba(255,255,255,.5)}.navbar-dark .navbar-nav .nav-link:focus,.navbar-dark .navbar-nav .nav-link:hover{color:rgba(255,255,255,.75)}.navbar-dark .navbar-nav .nav-link.disabled{color:rgba(255,255,255,.25)}.navbar-dark .navbar-nav .active>.nav-link,.navbar-dark .navbar-nav .nav-link.active,.navbar-dark .navbar-nav .nav-link.show,.navbar-dark .navbar-nav .show>.nav-link{color:#fff}.navbar-dark .navbar-toggler{color:rgba(255,255,255,.5);border-color:rgba(255,255,255,.1)}.navbar-dark .navbar-toggler-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255, 255, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E")}.navbar-dark .navbar-text{color:rgba(255,255,255,.5)}.navbar-dark .navbar-text a{color:#fff}.navbar-dark .navbar-text a:focus,.navbar-dark .navbar-text a:hover{color:#fff}.card{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-width:0;word-wrap:break-word;background-color:#fff;background-clip:border-box;border:1px solid rgba(0,0,0,.125);border-radius:.25rem}.card>hr{margin-right:0;margin-left:0}.card>.list-group:first-child .list-group-item:first-child{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.card>.list-group:last-child .list-group-item:last-child{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.card-body{-ms-flex:1 1 auto;flex:1 1 auto;padding:1.25rem}.card-title{margin-bottom:.75rem}.card-subtitle{margin-top:-.375rem;margin-bottom:0}.card-text:last-child{margin-bottom:0}.card-link:hover{text-decoration:none}.card-link+.card-link{margin-left:1.25rem}.card-header{padding:.75rem 1.25rem;margin-bottom:0;background-color:rgba(0,0,0,.03);border-bottom:1px solid rgba(0,0,0,.125)}.card-header:first-child{border-radius:calc(.25rem - 1px) calc(.25rem - 1px) 0 0}.card-header+.list-group .list-group-item:first-child{border-top:0}.card-footer{padding:.75rem 1.25rem;background-color:rgba(0,0,0,.03);border-top:1px solid rgba(0,0,0,.125)}.card-footer:last-child{border-radius:0 0 calc(.25rem - 1px) calc(.25rem - 1px)}.card-header-tabs{margin-right:-.625rem;margin-bottom:-.75rem;margin-left:-.625rem;border-bottom:0}.card-header-pills{margin-right:-.625rem;margin-left:-.625rem}.card-img-overlay{position:absolute;top:0;right:0;bottom:0;left:0;padding:1.25rem}.card-img{width:100%;border-radius:calc(.25rem - 1px)}.card-img-top{width:100%;border-top-left-radius:calc(.25rem - 1px);border-top-right-radius:calc(.25rem - 1px)}.card-img-bottom{width:100%;border-bottom-right-radius:calc(.25rem - 1px);border-bottom-left-radius:calc(.25rem - 1px)}.card-deck{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.card-deck .card{margin-bottom:15px}@media (min-width:576px){.card-deck{-ms-flex-flow:row wrap;flex-flow:row wrap;margin-right:-15px;margin-left:-15px}.card-deck .card{display:-ms-flexbox;display:flex;-ms-flex:1 0 0%;flex:1 0 0%;-ms-flex-direction:column;flex-direction:column;margin-right:15px;margin-bottom:0;margin-left:15px}}.card-group{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.card-group>.card{margin-bottom:15px}@media (min-width:576px){.card-group{-ms-flex-flow:row wrap;flex-flow:row wrap}.card-group>.card{-ms-flex:1 0 0%;flex:1 0 0%;margin-bottom:0}.card-group>.card+.card{margin-left:0;border-left:0}.card-group>.card:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.card-group>.card:first-child .card-header,.card-group>.card:first-child .card-img-top{border-top-right-radius:0}.card-group>.card:first-child .card-footer,.card-group>.card:first-child .card-img-bottom{border-bottom-right-radius:0}.card-group>.card:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.card-group>.card:last-child .card-header,.card-group>.card:last-child .card-img-top{border-top-left-radius:0}.card-group>.card:last-child .card-footer,.card-group>.card:last-child .card-img-bottom{border-bottom-left-radius:0}.card-group>.card:only-child{border-radius:.25rem}.card-group>.card:only-child .card-header,.card-group>.card:only-child .card-img-top{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.card-group>.card:only-child .card-footer,.card-group>.card:only-child .card-img-bottom{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.card-group>.card:not(:first-child):not(:last-child):not(:only-child){border-radius:0}.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-footer,.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-header,.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-img-bottom,.card-group>.card:not(:first-child):not(:last-child):not(:only-child) .card-img-top{border-radius:0}}.card-columns .card{margin-bottom:.75rem}@media (min-width:576px){.card-columns{-webkit-column-count:3;-moz-column-count:3;column-count:3;-webkit-column-gap:1.25rem;-moz-column-gap:1.25rem;column-gap:1.25rem;orphans:1;widows:1}.card-columns .card{display:inline-block;width:100%}}.accordion .card:not(:first-of-type):not(:last-of-type){border-bottom:0;border-radius:0}.accordion .card:not(:first-of-type) .card-header:first-child{border-radius:0}.accordion .card:first-of-type{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.accordion .card:last-of-type{border-top-left-radius:0;border-top-right-radius:0}.breadcrumb{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;padding:.75rem 1rem;margin-bottom:1rem;list-style:none;background-color:#e9ecef;border-radius:.25rem}.breadcrumb-item+.breadcrumb-item{padding-left:.5rem}.breadcrumb-item+.breadcrumb-item::before{display:inline-block;padding-right:.5rem;color:#6c757d;content:"/"}.breadcrumb-item+.breadcrumb-item:hover::before{text-decoration:underline}.breadcrumb-item+.breadcrumb-item:hover::before{text-decoration:none}.breadcrumb-item.active{color:#6c757d}.pagination{display:-ms-flexbox;display:flex;padding-left:0;list-style:none;border-radius:.25rem}.page-link{position:relative;display:block;padding:.5rem .75rem;margin-left:-1px;line-height:1.25;color:#007bff;background-color:#fff;border:1px solid #dee2e6}.page-link:hover{z-index:2;color:#0056b3;text-decoration:none;background-color:#e9ecef;border-color:#dee2e6}.page-link:focus{z-index:2;outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.page-link:not(:disabled):not(.disabled){cursor:pointer}.page-item:first-child .page-link{margin-left:0;border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.page-item:last-child .page-link{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.page-item.active .page-link{z-index:1;color:#fff;background-color:#007bff;border-color:#007bff}.page-item.disabled .page-link{color:#6c757d;pointer-events:none;cursor:auto;background-color:#fff;border-color:#dee2e6}.pagination-lg .page-link{padding:.75rem 1.5rem;font-size:1.25rem;line-height:1.5}.pagination-lg .page-item:first-child .page-link{border-top-left-radius:.3rem;border-bottom-left-radius:.3rem}.pagination-lg .page-item:last-child .page-link{border-top-right-radius:.3rem;border-bottom-right-radius:.3rem}.pagination-sm .page-link{padding:.25rem .5rem;font-size:.875rem;line-height:1.5}.pagination-sm .page-item:first-child .page-link{border-top-left-radius:.2rem;border-bottom-left-radius:.2rem}.pagination-sm .page-item:last-child .page-link{border-top-right-radius:.2rem;border-bottom-right-radius:.2rem}.badge{display:inline-block;padding:.25em .4em;font-size:75%;font-weight:700;line-height:1;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25rem}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.badge-pill{padding-right:.6em;padding-left:.6em;border-radius:10rem}.badge-primary{color:#fff;background-color:#007bff}.badge-primary[href]:focus,.badge-primary[href]:hover{color:#fff;text-decoration:none;background-color:#0062cc}.badge-secondary{color:#fff;background-color:#6c757d}.badge-secondary[href]:focus,.badge-secondary[href]:hover{color:#fff;text-decoration:none;background-color:#545b62}.badge-success{color:#fff;background-color:#28a745}.badge-success[href]:focus,.badge-success[href]:hover{color:#fff;text-decoration:none;background-color:#1e7e34}.badge-info{color:#fff;background-color:#17a2b8}.badge-info[href]:focus,.badge-info[href]:hover{color:#fff;text-decoration:none;background-color:#117a8b}.badge-warning{color:#212529;background-color:#ffc107}.badge-warning[href]:focus,.badge-warning[href]:hover{color:#212529;text-decoration:none;background-color:#d39e00}.badge-danger{color:#fff;background-color:#dc3545}.badge-danger[href]:focus,.badge-danger[href]:hover{color:#fff;text-decoration:none;background-color:#bd2130}.badge-light{color:#212529;background-color:#f8f9fa}.badge-light[href]:focus,.badge-light[href]:hover{color:#212529;text-decoration:none;background-color:#dae0e5}.badge-dark{color:#fff;background-color:#343a40}.badge-dark[href]:focus,.badge-dark[href]:hover{color:#fff;text-decoration:none;background-color:#1d2124}.jumbotron{padding:2rem 1rem;margin-bottom:2rem;background-color:#e9ecef;border-radius:.3rem}@media (min-width:576px){.jumbotron{padding:4rem 2rem}}.jumbotron-fluid{padding-right:0;padding-left:0;border-radius:0}.alert{position:relative;padding:.75rem 1.25rem;margin-bottom:1rem;border:1px solid transparent;border-radius:.25rem}.alert-heading{color:inherit}.alert-link{font-weight:700}.alert-dismissible{padding-right:4rem}.alert-dismissible .close{position:absolute;top:0;right:0;padding:.75rem 1.25rem;color:inherit}.alert-primary{color:#004085;background-color:#cce5ff;border-color:#b8daff}.alert-primary hr{border-top-color:#9fcdff}.alert-primary .alert-link{color:#002752}.alert-secondary{color:#383d41;background-color:#e2e3e5;border-color:#d6d8db}.alert-secondary hr{border-top-color:#c8cbcf}.alert-secondary .alert-link{color:#202326}.alert-success{color:#155724;background-color:#d4edda;border-color:#c3e6cb}.alert-success hr{border-top-color:#b1dfbb}.alert-success .alert-link{color:#0b2e13}.alert-info{color:#0c5460;background-color:#d1ecf1;border-color:#bee5eb}.alert-info hr{border-top-color:#abdde5}.alert-info .alert-link{color:#062c33}.alert-warning{color:#856404;background-color:#fff3cd;border-color:#ffeeba}.alert-warning hr{border-top-color:#ffe8a1}.alert-warning .alert-link{color:#533f03}.alert-danger{color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}.alert-danger hr{border-top-color:#f1b0b7}.alert-danger .alert-link{color:#491217}.alert-light{color:#818182;background-color:#fefefe;border-color:#fdfdfe}.alert-light hr{border-top-color:#ececf6}.alert-light .alert-link{color:#686868}.alert-dark{color:#1b1e21;background-color:#d6d8d9;border-color:#c6c8ca}.alert-dark hr{border-top-color:#b9bbbe}.alert-dark .alert-link{color:#040505}@-webkit-keyframes progress-bar-stripes{from{background-position:1rem 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:1rem 0}to{background-position:0 0}}.progress{display:-ms-flexbox;display:flex;height:1rem;overflow:hidden;font-size:.75rem;background-color:#e9ecef;border-radius:.25rem}.progress-bar{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;color:#fff;text-align:center;white-space:nowrap;background-color:#007bff;transition:width .6s ease}@media screen and (prefers-reduced-motion:reduce){.progress-bar{transition:none}}.progress-bar-striped{background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:1rem 1rem}.progress-bar-animated{-webkit-animation:progress-bar-stripes 1s linear infinite;animation:progress-bar-stripes 1s linear infinite}.media{display:-ms-flexbox;display:flex;-ms-flex-align:start;align-items:flex-start}.media-body{-ms-flex:1;flex:1}.list-group{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding-left:0;margin-bottom:0}.list-group-item-action{width:100%;color:#495057;text-align:inherit}.list-group-item-action:focus,.list-group-item-action:hover{color:#495057;text-decoration:none;background-color:#f8f9fa}.list-group-item-action:active{color:#212529;background-color:#e9ecef}.list-group-item{position:relative;display:block;padding:.75rem 1.25rem;margin-bottom:-1px;background-color:#fff;border:1px solid rgba(0,0,0,.125)}.list-group-item:first-child{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.list-group-item:focus,.list-group-item:hover{z-index:1;text-decoration:none}.list-group-item.disabled,.list-group-item:disabled{color:#6c757d;background-color:#fff}.list-group-item.active{z-index:2;color:#fff;background-color:#007bff;border-color:#007bff}.list-group-flush .list-group-item{border-right:0;border-left:0;border-radius:0}.list-group-flush:first-child .list-group-item:first-child{border-top:0}.list-group-flush:last-child .list-group-item:last-child{border-bottom:0}.list-group-item-primary{color:#004085;background-color:#b8daff}.list-group-item-primary.list-group-item-action:focus,.list-group-item-primary.list-group-item-action:hover{color:#004085;background-color:#9fcdff}.list-group-item-primary.list-group-item-action.active{color:#fff;background-color:#004085;border-color:#004085}.list-group-item-secondary{color:#383d41;background-color:#d6d8db}.list-group-item-secondary.list-group-item-action:focus,.list-group-item-secondary.list-group-item-action:hover{color:#383d41;background-color:#c8cbcf}.list-group-item-secondary.list-group-item-action.active{color:#fff;background-color:#383d41;border-color:#383d41}.list-group-item-success{color:#155724;background-color:#c3e6cb}.list-group-item-success.list-group-item-action:focus,.list-group-item-success.list-group-item-action:hover{color:#155724;background-color:#b1dfbb}.list-group-item-success.list-group-item-action.active{color:#fff;background-color:#155724;border-color:#155724}.list-group-item-info{color:#0c5460;background-color:#bee5eb}.list-group-item-info.list-group-item-action:focus,.list-group-item-info.list-group-item-action:hover{color:#0c5460;background-color:#abdde5}.list-group-item-info.list-group-item-action.active{color:#fff;background-color:#0c5460;border-color:#0c5460}.list-group-item-warning{color:#856404;background-color:#ffeeba}.list-group-item-warning.list-group-item-action:focus,.list-group-item-warning.list-group-item-action:hover{color:#856404;background-color:#ffe8a1}.list-group-item-warning.list-group-item-action.active{color:#fff;background-color:#856404;border-color:#856404}.list-group-item-danger{color:#721c24;background-color:#f5c6cb}.list-group-item-danger.list-group-item-action:focus,.list-group-item-danger.list-group-item-action:hover{color:#721c24;background-color:#f1b0b7}.list-group-item-danger.list-group-item-action.active{color:#fff;background-color:#721c24;border-color:#721c24}.list-group-item-light{color:#818182;background-color:#fdfdfe}.list-group-item-light.list-group-item-action:focus,.list-group-item-light.list-group-item-action:hover{color:#818182;background-color:#ececf6}.list-group-item-light.list-group-item-action.active{color:#fff;background-color:#818182;border-color:#818182}.list-group-item-dark{color:#1b1e21;background-color:#c6c8ca}.list-group-item-dark.list-group-item-action:focus,.list-group-item-dark.list-group-item-action:hover{color:#1b1e21;background-color:#b9bbbe}.list-group-item-dark.list-group-item-action.active{color:#fff;background-color:#1b1e21;border-color:#1b1e21}.close{float:right;font-size:1.5rem;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.5}.close:not(:disabled):not(.disabled){cursor:pointer}.close:not(:disabled):not(.disabled):focus,.close:not(:disabled):not(.disabled):hover{color:#000;text-decoration:none;opacity:.75}button.close{padding:0;background-color:transparent;border:0;-webkit-appearance:none}.modal-open{overflow:hidden}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;outline:0}.modal-dialog{position:relative;width:auto;margin:.5rem;pointer-events:none}.modal.fade .modal-dialog{transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out;-webkit-transform:translate(0,-25%);transform:translate(0,-25%)}@media screen and (prefers-reduced-motion:reduce){.modal.fade .modal-dialog{transition:none}}.modal.show .modal-dialog{-webkit-transform:translate(0,0);transform:translate(0,0)}.modal-dialog-centered{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:calc(100% - (.5rem * 2))}.modal-dialog-centered::before{display:block;height:calc(100vh - (.5rem * 2));content:""}.modal-content{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:100%;pointer-events:auto;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:.3rem;outline:0}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{opacity:0}.modal-backdrop.show{opacity:.5}.modal-header{display:-ms-flexbox;display:flex;-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:justify;justify-content:space-between;padding:1rem;border-bottom:1px solid #e9ecef;border-top-left-radius:.3rem;border-top-right-radius:.3rem}.modal-header .close{padding:1rem;margin:-1rem -1rem -1rem auto}.modal-title{margin-bottom:0;line-height:1.5}.modal-body{position:relative;-ms-flex:1 1 auto;flex:1 1 auto;padding:1rem}.modal-footer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end;padding:1rem;border-top:1px solid #e9ecef}.modal-footer>:not(:first-child){margin-left:.25rem}.modal-footer>:not(:last-child){margin-right:.25rem}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:576px){.modal-dialog{max-width:500px;margin:1.75rem auto}.modal-dialog-centered{min-height:calc(100% - (1.75rem * 2))}.modal-dialog-centered::before{height:calc(100vh - (1.75rem * 2))}.modal-sm{max-width:300px}}@media (min-width:992px){.modal-lg{max-width:800px}}.tooltip{position:absolute;z-index:1070;display:block;margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-style:normal;font-weight:400;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;white-space:normal;line-break:auto;font-size:.875rem;word-wrap:break-word;opacity:0}.tooltip.show{opacity:.9}.tooltip .arrow{position:absolute;display:block;width:.8rem;height:.4rem}.tooltip .arrow::before{position:absolute;content:"";border-color:transparent;border-style:solid}.bs-tooltip-auto[x-placement^=top],.bs-tooltip-top{padding:.4rem 0}.bs-tooltip-auto[x-placement^=top] .arrow,.bs-tooltip-top .arrow{bottom:0}.bs-tooltip-auto[x-placement^=top] .arrow::before,.bs-tooltip-top .arrow::before{top:0;border-width:.4rem .4rem 0;border-top-color:#000}.bs-tooltip-auto[x-placement^=right],.bs-tooltip-right{padding:0 .4rem}.bs-tooltip-auto[x-placement^=right] .arrow,.bs-tooltip-right .arrow{left:0;width:.4rem;height:.8rem}.bs-tooltip-auto[x-placement^=right] .arrow::before,.bs-tooltip-right .arrow::before{right:0;border-width:.4rem .4rem .4rem 0;border-right-color:#000}.bs-tooltip-auto[x-placement^=bottom],.bs-tooltip-bottom{padding:.4rem 0}.bs-tooltip-auto[x-placement^=bottom] .arrow,.bs-tooltip-bottom .arrow{top:0}.bs-tooltip-auto[x-placement^=bottom] .arrow::before,.bs-tooltip-bottom .arrow::before{bottom:0;border-width:0 .4rem .4rem;border-bottom-color:#000}.bs-tooltip-auto[x-placement^=left],.bs-tooltip-left{padding:0 .4rem}.bs-tooltip-auto[x-placement^=left] .arrow,.bs-tooltip-left .arrow{right:0;width:.4rem;height:.8rem}.bs-tooltip-auto[x-placement^=left] .arrow::before,.bs-tooltip-left .arrow::before{left:0;border-width:.4rem 0 .4rem .4rem;border-left-color:#000}.tooltip-inner{max-width:200px;padding:.25rem .5rem;color:#fff;text-align:center;background-color:#000;border-radius:.25rem}.popover{position:absolute;top:0;left:0;z-index:1060;display:block;max-width:276px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-style:normal;font-weight:400;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;white-space:normal;line-break:auto;font-size:.875rem;word-wrap:break-word;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:.3rem}.popover .arrow{position:absolute;display:block;width:1rem;height:.5rem;margin:0 .3rem}.popover .arrow::after,.popover .arrow::before{position:absolute;display:block;content:"";border-color:transparent;border-style:solid}.bs-popover-auto[x-placement^=top],.bs-popover-top{margin-bottom:.5rem}.bs-popover-auto[x-placement^=top] .arrow,.bs-popover-top .arrow{bottom:calc((.5rem + 1px) * -1)}.bs-popover-auto[x-placement^=top] .arrow::after,.bs-popover-auto[x-placement^=top] .arrow::before,.bs-popover-top .arrow::after,.bs-popover-top .arrow::before{border-width:.5rem .5rem 0}.bs-popover-auto[x-placement^=top] .arrow::before,.bs-popover-top .arrow::before{bottom:0;border-top-color:rgba(0,0,0,.25)}.bs-popover-auto[x-placement^=top] .arrow::after,.bs-popover-top .arrow::after{bottom:1px;border-top-color:#fff}.bs-popover-auto[x-placement^=right],.bs-popover-right{margin-left:.5rem}.bs-popover-auto[x-placement^=right] .arrow,.bs-popover-right .arrow{left:calc((.5rem + 1px) * -1);width:.5rem;height:1rem;margin:.3rem 0}.bs-popover-auto[x-placement^=right] .arrow::after,.bs-popover-auto[x-placement^=right] .arrow::before,.bs-popover-right .arrow::after,.bs-popover-right .arrow::before{border-width:.5rem .5rem .5rem 0}.bs-popover-auto[x-placement^=right] .arrow::before,.bs-popover-right .arrow::before{left:0;border-right-color:rgba(0,0,0,.25)}.bs-popover-auto[x-placement^=right] .arrow::after,.bs-popover-right .arrow::after{left:1px;border-right-color:#fff}.bs-popover-auto[x-placement^=bottom],.bs-popover-bottom{margin-top:.5rem}.bs-popover-auto[x-placement^=bottom] .arrow,.bs-popover-bottom .arrow{top:calc((.5rem + 1px) * -1)}.bs-popover-auto[x-placement^=bottom] .arrow::after,.bs-popover-auto[x-placement^=bottom] .arrow::before,.bs-popover-bottom .arrow::after,.bs-popover-bottom .arrow::before{border-width:0 .5rem .5rem .5rem}.bs-popover-auto[x-placement^=bottom] .arrow::before,.bs-popover-bottom .arrow::before{top:0;border-bottom-color:rgba(0,0,0,.25)}.bs-popover-auto[x-placement^=bottom] .arrow::after,.bs-popover-bottom .arrow::after{top:1px;border-bottom-color:#fff}.bs-popover-auto[x-placement^=bottom] .popover-header::before,.bs-popover-bottom .popover-header::before{position:absolute;top:0;left:50%;display:block;width:1rem;margin-left:-.5rem;content:"";border-bottom:1px solid #f7f7f7}.bs-popover-auto[x-placement^=left],.bs-popover-left{margin-right:.5rem}.bs-popover-auto[x-placement^=left] .arrow,.bs-popover-left .arrow{right:calc((.5rem + 1px) * -1);width:.5rem;height:1rem;margin:.3rem 0}.bs-popover-auto[x-placement^=left] .arrow::after,.bs-popover-auto[x-placement^=left] .arrow::before,.bs-popover-left .arrow::after,.bs-popover-left .arrow::before{border-width:.5rem 0 .5rem .5rem}.bs-popover-auto[x-placement^=left] .arrow::before,.bs-popover-left .arrow::before{right:0;border-left-color:rgba(0,0,0,.25)}.bs-popover-auto[x-placement^=left] .arrow::after,.bs-popover-left .arrow::after{right:1px;border-left-color:#fff}.popover-header{padding:.5rem .75rem;margin-bottom:0;font-size:1rem;color:inherit;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-top-left-radius:calc(.3rem - 1px);border-top-right-radius:calc(.3rem - 1px)}.popover-header:empty{display:none}.popover-body{padding:.5rem .75rem;color:#212529}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-item{position:relative;display:none;-ms-flex-align:center;align-items:center;width:100%;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000px;perspective:1000px}.carousel-item-next,.carousel-item-prev,.carousel-item.active{display:block;transition:-webkit-transform .6s ease;transition:transform .6s ease;transition:transform .6s ease,-webkit-transform .6s ease}@media screen and (prefers-reduced-motion:reduce){.carousel-item-next,.carousel-item-prev,.carousel-item.active{transition:none}}.carousel-item-next,.carousel-item-prev{position:absolute;top:0}.carousel-item-next.carousel-item-left,.carousel-item-prev.carousel-item-right{-webkit-transform:translateX(0);transform:translateX(0)}@supports ((-webkit-transform-style:preserve-3d) or (transform-style:preserve-3d)){.carousel-item-next.carousel-item-left,.carousel-item-prev.carousel-item-right{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.active.carousel-item-right,.carousel-item-next{-webkit-transform:translateX(100%);transform:translateX(100%)}@supports ((-webkit-transform-style:preserve-3d) or (transform-style:preserve-3d)){.active.carousel-item-right,.carousel-item-next{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}}.active.carousel-item-left,.carousel-item-prev{-webkit-transform:translateX(-100%);transform:translateX(-100%)}@supports ((-webkit-transform-style:preserve-3d) or (transform-style:preserve-3d)){.active.carousel-item-left,.carousel-item-prev{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}}.carousel-fade .carousel-item{opacity:0;transition-duration:.6s;transition-property:opacity}.carousel-fade .carousel-item-next.carousel-item-left,.carousel-fade .carousel-item-prev.carousel-item-right,.carousel-fade .carousel-item.active{opacity:1}.carousel-fade .active.carousel-item-left,.carousel-fade .active.carousel-item-right{opacity:0}.carousel-fade .active.carousel-item-left,.carousel-fade .active.carousel-item-prev,.carousel-fade .carousel-item-next,.carousel-fade .carousel-item-prev,.carousel-fade .carousel-item.active{-webkit-transform:translateX(0);transform:translateX(0)}@supports ((-webkit-transform-style:preserve-3d) or (transform-style:preserve-3d)){.carousel-fade .active.carousel-item-left,.carousel-fade .active.carousel-item-prev,.carousel-fade .carousel-item-next,.carousel-fade .carousel-item-prev,.carousel-fade .carousel-item.active{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.carousel-control-next,.carousel-control-prev{position:absolute;top:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:15%;color:#fff;text-align:center;opacity:.5}.carousel-control-next:focus,.carousel-control-next:hover,.carousel-control-prev:focus,.carousel-control-prev:hover{color:#fff;text-decoration:none;outline:0;opacity:.9}.carousel-control-prev{left:0}.carousel-control-next{right:0}.carousel-control-next-icon,.carousel-control-prev-icon{display:inline-block;width:20px;height:20px;background:transparent no-repeat center center;background-size:100% 100%}.carousel-control-prev-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3E%3Cpath d='M5.25 0l-4 4 4 4 1.5-1.5-2.5-2.5 2.5-2.5-1.5-1.5z'/%3E%3C/svg%3E")}.carousel-control-next-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3E%3Cpath d='M2.75 0l-1.5 1.5 2.5 2.5-2.5 2.5 1.5 1.5 4-4-4-4z'/%3E%3C/svg%3E")}.carousel-indicators{position:absolute;right:0;bottom:10px;left:0;z-index:15;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;padding-left:0;margin-right:15%;margin-left:15%;list-style:none}.carousel-indicators li{position:relative;-ms-flex:0 1 auto;flex:0 1 auto;width:30px;height:3px;margin-right:3px;margin-left:3px;text-indent:-999px;cursor:pointer;background-color:rgba(255,255,255,.5)}.carousel-indicators li::before{position:absolute;top:-10px;left:0;display:inline-block;width:100%;height:10px;content:""}.carousel-indicators li::after{position:absolute;bottom:-10px;left:0;display:inline-block;width:100%;height:10px;content:""}.carousel-indicators .active{background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center}.align-baseline{vertical-align:baseline!important}.align-top{vertical-align:top!important}.align-middle{vertical-align:middle!important}.align-bottom{vertical-align:bottom!important}.align-text-bottom{vertical-align:text-bottom!important}.align-text-top{vertical-align:text-top!important}.bg-primary{background-color:#007bff!important}a.bg-primary:focus,a.bg-primary:hover,button.bg-primary:focus,button.bg-primary:hover{background-color:#0062cc!important}.bg-secondary{background-color:#6c757d!important}a.bg-secondary:focus,a.bg-secondary:hover,button.bg-secondary:focus,button.bg-secondary:hover{background-color:#545b62!important}.bg-success{background-color:#28a745!important}a.bg-success:focus,a.bg-success:hover,button.bg-success:focus,button.bg-success:hover{background-color:#1e7e34!important}.bg-info{background-color:#17a2b8!important}a.bg-info:focus,a.bg-info:hover,button.bg-info:focus,button.bg-info:hover{background-color:#117a8b!important}.bg-warning{background-color:#ffc107!important}a.bg-warning:focus,a.bg-warning:hover,button.bg-warning:focus,button.bg-warning:hover{background-color:#d39e00!important}.bg-danger{background-color:#dc3545!important}a.bg-danger:focus,a.bg-danger:hover,button.bg-danger:focus,button.bg-danger:hover{background-color:#bd2130!important}.bg-light{background-color:#f8f9fa!important}a.bg-light:focus,a.bg-light:hover,button.bg-light:focus,button.bg-light:hover{background-color:#dae0e5!important}.bg-dark{background-color:#343a40!important}a.bg-dark:focus,a.bg-dark:hover,button.bg-dark:focus,button.bg-dark:hover{background-color:#1d2124!important}.bg-white{background-color:#fff!important}.bg-transparent{background-color:transparent!important}.border{border:1px solid #dee2e6!important}.border-top{border-top:1px solid #dee2e6!important}.border-right{border-right:1px solid #dee2e6!important}.border-bottom{border-bottom:1px solid #dee2e6!important}.border-left{border-left:1px solid #dee2e6!important}.border-0{border:0!important}.border-top-0{border-top:0!important}.border-right-0{border-right:0!important}.border-bottom-0{border-bottom:0!important}.border-left-0{border-left:0!important}.border-primary{border-color:#007bff!important}.border-secondary{border-color:#6c757d!important}.border-success{border-color:#28a745!important}.border-info{border-color:#17a2b8!important}.border-warning{border-color:#ffc107!important}.border-danger{border-color:#dc3545!important}.border-light{border-color:#f8f9fa!important}.border-dark{border-color:#343a40!important}.border-white{border-color:#fff!important}.rounded{border-radius:.25rem!important}.rounded-top{border-top-left-radius:.25rem!important;border-top-right-radius:.25rem!important}.rounded-right{border-top-right-radius:.25rem!important;border-bottom-right-radius:.25rem!important}.rounded-bottom{border-bottom-right-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.rounded-left{border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.rounded-circle{border-radius:50%!important}.rounded-0{border-radius:0!important}.clearfix::after{display:block;clear:both;content:""}.d-none{display:none!important}.d-inline{display:inline!important}.d-inline-block{display:inline-block!important}.d-block{display:block!important}.d-table{display:table!important}.d-table-row{display:table-row!important}.d-table-cell{display:table-cell!important}.d-flex{display:-ms-flexbox!important;display:flex!important}.d-inline-flex{display:-ms-inline-flexbox!important;display:inline-flex!important}@media (min-width:576px){.d-sm-none{display:none!important}.d-sm-inline{display:inline!important}.d-sm-inline-block{display:inline-block!important}.d-sm-block{display:block!important}.d-sm-table{display:table!important}.d-sm-table-row{display:table-row!important}.d-sm-table-cell{display:table-cell!important}.d-sm-flex{display:-ms-flexbox!important;display:flex!important}.d-sm-inline-flex{display:-ms-inline-flexbox!important;display:inline-flex!important}}@media (min-width:768px){.d-md-none{display:none!important}.d-md-inline{display:inline!important}.d-md-inline-block{display:inline-block!important}.d-md-block{display:block!important}.d-md-table{display:table!important}.d-md-table-row{display:table-row!important}.d-md-table-cell{display:table-cell!important}.d-md-flex{display:-ms-flexbox!important;display:flex!important}.d-md-inline-flex{display:-ms-inline-flexbox!important;display:inline-flex!important}}@media (min-width:992px){.d-lg-none{display:none!important}.d-lg-inline{display:inline!important}.d-lg-inline-block{display:inline-block!important}.d-lg-block{display:block!important}.d-lg-table{display:table!important}.d-lg-table-row{display:table-row!important}.d-lg-table-cell{display:table-cell!important}.d-lg-flex{display:-ms-flexbox!important;display:flex!important}.d-lg-inline-flex{display:-ms-inline-flexbox!important;display:inline-flex!important}}@media (min-width:1200px){.d-xl-none{display:none!important}.d-xl-inline{display:inline!important}.d-xl-inline-block{display:inline-block!important}.d-xl-block{display:block!important}.d-xl-table{display:table!important}.d-xl-table-row{display:table-row!important}.d-xl-table-cell{display:table-cell!important}.d-xl-flex{display:-ms-flexbox!important;display:flex!important}.d-xl-inline-flex{display:-ms-inline-flexbox!important;display:inline-flex!important}}@media print{.d-print-none{display:none!important}.d-print-inline{display:inline!important}.d-print-inline-block{display:inline-block!important}.d-print-block{display:block!important}.d-print-table{display:table!important}.d-print-table-row{display:table-row!important}.d-print-table-cell{display:table-cell!important}.d-print-flex{display:-ms-flexbox!important;display:flex!important}.d-print-inline-flex{display:-ms-inline-flexbox!important;display:inline-flex!important}}.embed-responsive{position:relative;display:block;width:100%;padding:0;overflow:hidden}.embed-responsive::before{display:block;content:""}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-21by9::before{padding-top:42.857143%}.embed-responsive-16by9::before{padding-top:56.25%}.embed-responsive-4by3::before{padding-top:75%}.embed-responsive-1by1::before{padding-top:100%}.flex-row{-ms-flex-direction:row!important;flex-direction:row!important}.flex-column{-ms-flex-direction:column!important;flex-direction:column!important}.flex-row-reverse{-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.flex-column-reverse{-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.flex-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.flex-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.flex-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.flex-fill{-ms-flex:1 1 auto!important;flex:1 1 auto!important}.flex-grow-0{-ms-flex-positive:0!important;flex-grow:0!important}.flex-grow-1{-ms-flex-positive:1!important;flex-grow:1!important}.flex-shrink-0{-ms-flex-negative:0!important;flex-shrink:0!important}.flex-shrink-1{-ms-flex-negative:1!important;flex-shrink:1!important}.justify-content-start{-ms-flex-pack:start!important;justify-content:flex-start!important}.justify-content-end{-ms-flex-pack:end!important;justify-content:flex-end!important}.justify-content-center{-ms-flex-pack:center!important;justify-content:center!important}.justify-content-between{-ms-flex-pack:justify!important;justify-content:space-between!important}.justify-content-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.align-items-start{-ms-flex-align:start!important;align-items:flex-start!important}.align-items-end{-ms-flex-align:end!important;align-items:flex-end!important}.align-items-center{-ms-flex-align:center!important;align-items:center!important}.align-items-baseline{-ms-flex-align:baseline!important;align-items:baseline!important}.align-items-stretch{-ms-flex-align:stretch!important;align-items:stretch!important}.align-content-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.align-content-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.align-content-center{-ms-flex-line-pack:center!important;align-content:center!important}.align-content-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.align-content-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.align-content-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.align-self-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.align-self-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.align-self-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.align-self-center{-ms-flex-item-align:center!important;align-self:center!important}.align-self-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.align-self-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}@media (min-width:576px){.flex-sm-row{-ms-flex-direction:row!important;flex-direction:row!important}.flex-sm-column{-ms-flex-direction:column!important;flex-direction:column!important}.flex-sm-row-reverse{-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.flex-sm-column-reverse{-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.flex-sm-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.flex-sm-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.flex-sm-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.flex-sm-fill{-ms-flex:1 1 auto!important;flex:1 1 auto!important}.flex-sm-grow-0{-ms-flex-positive:0!important;flex-grow:0!important}.flex-sm-grow-1{-ms-flex-positive:1!important;flex-grow:1!important}.flex-sm-shrink-0{-ms-flex-negative:0!important;flex-shrink:0!important}.flex-sm-shrink-1{-ms-flex-negative:1!important;flex-shrink:1!important}.justify-content-sm-start{-ms-flex-pack:start!important;justify-content:flex-start!important}.justify-content-sm-end{-ms-flex-pack:end!important;justify-content:flex-end!important}.justify-content-sm-center{-ms-flex-pack:center!important;justify-content:center!important}.justify-content-sm-between{-ms-flex-pack:justify!important;justify-content:space-between!important}.justify-content-sm-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.align-items-sm-start{-ms-flex-align:start!important;align-items:flex-start!important}.align-items-sm-end{-ms-flex-align:end!important;align-items:flex-end!important}.align-items-sm-center{-ms-flex-align:center!important;align-items:center!important}.align-items-sm-baseline{-ms-flex-align:baseline!important;align-items:baseline!important}.align-items-sm-stretch{-ms-flex-align:stretch!important;align-items:stretch!important}.align-content-sm-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.align-content-sm-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.align-content-sm-center{-ms-flex-line-pack:center!important;align-content:center!important}.align-content-sm-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.align-content-sm-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.align-content-sm-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.align-self-sm-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.align-self-sm-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.align-self-sm-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.align-self-sm-center{-ms-flex-item-align:center!important;align-self:center!important}.align-self-sm-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.align-self-sm-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}@media (min-width:768px){.flex-md-row{-ms-flex-direction:row!important;flex-direction:row!important}.flex-md-column{-ms-flex-direction:column!important;flex-direction:column!important}.flex-md-row-reverse{-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.flex-md-column-reverse{-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.flex-md-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.flex-md-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.flex-md-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.flex-md-fill{-ms-flex:1 1 auto!important;flex:1 1 auto!important}.flex-md-grow-0{-ms-flex-positive:0!important;flex-grow:0!important}.flex-md-grow-1{-ms-flex-positive:1!important;flex-grow:1!important}.flex-md-shrink-0{-ms-flex-negative:0!important;flex-shrink:0!important}.flex-md-shrink-1{-ms-flex-negative:1!important;flex-shrink:1!important}.justify-content-md-start{-ms-flex-pack:start!important;justify-content:flex-start!important}.justify-content-md-end{-ms-flex-pack:end!important;justify-content:flex-end!important}.justify-content-md-center{-ms-flex-pack:center!important;justify-content:center!important}.justify-content-md-between{-ms-flex-pack:justify!important;justify-content:space-between!important}.justify-content-md-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.align-items-md-start{-ms-flex-align:start!important;align-items:flex-start!important}.align-items-md-end{-ms-flex-align:end!important;align-items:flex-end!important}.align-items-md-center{-ms-flex-align:center!important;align-items:center!important}.align-items-md-baseline{-ms-flex-align:baseline!important;align-items:baseline!important}.align-items-md-stretch{-ms-flex-align:stretch!important;align-items:stretch!important}.align-content-md-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.align-content-md-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.align-content-md-center{-ms-flex-line-pack:center!important;align-content:center!important}.align-content-md-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.align-content-md-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.align-content-md-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.align-self-md-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.align-self-md-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.align-self-md-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.align-self-md-center{-ms-flex-item-align:center!important;align-self:center!important}.align-self-md-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.align-self-md-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}@media (min-width:992px){.flex-lg-row{-ms-flex-direction:row!important;flex-direction:row!important}.flex-lg-column{-ms-flex-direction:column!important;flex-direction:column!important}.flex-lg-row-reverse{-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.flex-lg-column-reverse{-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.flex-lg-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.flex-lg-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.flex-lg-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.flex-lg-fill{-ms-flex:1 1 auto!important;flex:1 1 auto!important}.flex-lg-grow-0{-ms-flex-positive:0!important;flex-grow:0!important}.flex-lg-grow-1{-ms-flex-positive:1!important;flex-grow:1!important}.flex-lg-shrink-0{-ms-flex-negative:0!important;flex-shrink:0!important}.flex-lg-shrink-1{-ms-flex-negative:1!important;flex-shrink:1!important}.justify-content-lg-start{-ms-flex-pack:start!important;justify-content:flex-start!important}.justify-content-lg-end{-ms-flex-pack:end!important;justify-content:flex-end!important}.justify-content-lg-center{-ms-flex-pack:center!important;justify-content:center!important}.justify-content-lg-between{-ms-flex-pack:justify!important;justify-content:space-between!important}.justify-content-lg-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.align-items-lg-start{-ms-flex-align:start!important;align-items:flex-start!important}.align-items-lg-end{-ms-flex-align:end!important;align-items:flex-end!important}.align-items-lg-center{-ms-flex-align:center!important;align-items:center!important}.align-items-lg-baseline{-ms-flex-align:baseline!important;align-items:baseline!important}.align-items-lg-stretch{-ms-flex-align:stretch!important;align-items:stretch!important}.align-content-lg-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.align-content-lg-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.align-content-lg-center{-ms-flex-line-pack:center!important;align-content:center!important}.align-content-lg-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.align-content-lg-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.align-content-lg-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.align-self-lg-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.align-self-lg-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.align-self-lg-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.align-self-lg-center{-ms-flex-item-align:center!important;align-self:center!important}.align-self-lg-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.align-self-lg-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}@media (min-width:1200px){.flex-xl-row{-ms-flex-direction:row!important;flex-direction:row!important}.flex-xl-column{-ms-flex-direction:column!important;flex-direction:column!important}.flex-xl-row-reverse{-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.flex-xl-column-reverse{-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.flex-xl-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.flex-xl-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.flex-xl-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.flex-xl-fill{-ms-flex:1 1 auto!important;flex:1 1 auto!important}.flex-xl-grow-0{-ms-flex-positive:0!important;flex-grow:0!important}.flex-xl-grow-1{-ms-flex-positive:1!important;flex-grow:1!important}.flex-xl-shrink-0{-ms-flex-negative:0!important;flex-shrink:0!important}.flex-xl-shrink-1{-ms-flex-negative:1!important;flex-shrink:1!important}.justify-content-xl-start{-ms-flex-pack:start!important;justify-content:flex-start!important}.justify-content-xl-end{-ms-flex-pack:end!important;justify-content:flex-end!important}.justify-content-xl-center{-ms-flex-pack:center!important;justify-content:center!important}.justify-content-xl-between{-ms-flex-pack:justify!important;justify-content:space-between!important}.justify-content-xl-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.align-items-xl-start{-ms-flex-align:start!important;align-items:flex-start!important}.align-items-xl-end{-ms-flex-align:end!important;align-items:flex-end!important}.align-items-xl-center{-ms-flex-align:center!important;align-items:center!important}.align-items-xl-baseline{-ms-flex-align:baseline!important;align-items:baseline!important}.align-items-xl-stretch{-ms-flex-align:stretch!important;align-items:stretch!important}.align-content-xl-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.align-content-xl-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.align-content-xl-center{-ms-flex-line-pack:center!important;align-content:center!important}.align-content-xl-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.align-content-xl-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.align-content-xl-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.align-self-xl-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.align-self-xl-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.align-self-xl-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.align-self-xl-center{-ms-flex-item-align:center!important;align-self:center!important}.align-self-xl-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.align-self-xl-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}.float-left{float:left!important}.float-right{float:right!important}.float-none{float:none!important}@media (min-width:576px){.float-sm-left{float:left!important}.float-sm-right{float:right!important}.float-sm-none{float:none!important}}@media (min-width:768px){.float-md-left{float:left!important}.float-md-right{float:right!important}.float-md-none{float:none!important}}@media (min-width:992px){.float-lg-left{float:left!important}.float-lg-right{float:right!important}.float-lg-none{float:none!important}}@media (min-width:1200px){.float-xl-left{float:left!important}.float-xl-right{float:right!important}.float-xl-none{float:none!important}}.position-static{position:static!important}.position-relative{position:relative!important}.position-absolute{position:absolute!important}.position-fixed{position:fixed!important}.position-sticky{position:-webkit-sticky!important;position:sticky!important}.fixed-top{position:fixed;top:0;right:0;left:0;z-index:1030}.fixed-bottom{position:fixed;right:0;bottom:0;left:0;z-index:1030}@supports ((position:-webkit-sticky) or (position:sticky)){.sticky-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}}.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;overflow:visible;clip:auto;white-space:normal}.shadow-sm{box-shadow:0 .125rem .25rem rgba(0,0,0,.075)!important}.shadow{box-shadow:0 .5rem 1rem rgba(0,0,0,.15)!important}.shadow-lg{box-shadow:0 1rem 3rem rgba(0,0,0,.175)!important}.shadow-none{box-shadow:none!important}.w-25{width:25%!important}.w-50{width:50%!important}.w-75{width:75%!important}.w-100{width:100%!important}.w-auto{width:auto!important}.h-25{height:25%!important}.h-50{height:50%!important}.h-75{height:75%!important}.h-100{height:100%!important}.h-auto{height:auto!important}.mw-100{max-width:100%!important}.mh-100{max-height:100%!important}.m-0{margin:0!important}.mt-0,.my-0{margin-top:0!important}.mr-0,.mx-0{margin-right:0!important}.mb-0,.my-0{margin-bottom:0!important}.ml-0,.mx-0{margin-left:0!important}.m-1{margin:.25rem!important}.mt-1,.my-1{margin-top:.25rem!important}.mr-1,.mx-1{margin-right:.25rem!important}.mb-1,.my-1{margin-bottom:.25rem!important}.ml-1,.mx-1{margin-left:.25rem!important}.m-2{margin:.5rem!important}.mt-2,.my-2{margin-top:.5rem!important}.mr-2,.mx-2{margin-right:.5rem!important}.mb-2,.my-2{margin-bottom:.5rem!important}.ml-2,.mx-2{margin-left:.5rem!important}.m-3{margin:1rem!important}.mt-3,.my-3{margin-top:1rem!important}.mr-3,.mx-3{margin-right:1rem!important}.mb-3,.my-3{margin-bottom:1rem!important}.ml-3,.mx-3{margin-left:1rem!important}.m-4{margin:1.5rem!important}.mt-4,.my-4{margin-top:1.5rem!important}.mr-4,.mx-4{margin-right:1.5rem!important}.mb-4,.my-4{margin-bottom:1.5rem!important}.ml-4,.mx-4{margin-left:1.5rem!important}.m-5{margin:3rem!important}.mt-5,.my-5{margin-top:3rem!important}.mr-5,.mx-5{margin-right:3rem!important}.mb-5,.my-5{margin-bottom:3rem!important}.ml-5,.mx-5{margin-left:3rem!important}.p-0{padding:0!important}.pt-0,.py-0{padding-top:0!important}.pr-0,.px-0{padding-right:0!important}.pb-0,.py-0{padding-bottom:0!important}.pl-0,.px-0{padding-left:0!important}.p-1{padding:.25rem!important}.pt-1,.py-1{padding-top:.25rem!important}.pr-1,.px-1{padding-right:.25rem!important}.pb-1,.py-1{padding-bottom:.25rem!important}.pl-1,.px-1{padding-left:.25rem!important}.p-2{padding:.5rem!important}.pt-2,.py-2{padding-top:.5rem!important}.pr-2,.px-2{padding-right:.5rem!important}.pb-2,.py-2{padding-bottom:.5rem!important}.pl-2,.px-2{padding-left:.5rem!important}.p-3{padding:1rem!important}.pt-3,.py-3{padding-top:1rem!important}.pr-3,.px-3{padding-right:1rem!important}.pb-3,.py-3{padding-bottom:1rem!important}.pl-3,.px-3{padding-left:1rem!important}.p-4{padding:1.5rem!important}.pt-4,.py-4{padding-top:1.5rem!important}.pr-4,.px-4{padding-right:1.5rem!important}.pb-4,.py-4{padding-bottom:1.5rem!important}.pl-4,.px-4{padding-left:1.5rem!important}.p-5{padding:3rem!important}.pt-5,.py-5{padding-top:3rem!important}.pr-5,.px-5{padding-right:3rem!important}.pb-5,.py-5{padding-bottom:3rem!important}.pl-5,.px-5{padding-left:3rem!important}.m-auto{margin:auto!important}.mt-auto,.my-auto{margin-top:auto!important}.mr-auto,.mx-auto{margin-right:auto!important}.mb-auto,.my-auto{margin-bottom:auto!important}.ml-auto,.mx-auto{margin-left:auto!important}@media (min-width:576px){.m-sm-0{margin:0!important}.mt-sm-0,.my-sm-0{margin-top:0!important}.mr-sm-0,.mx-sm-0{margin-right:0!important}.mb-sm-0,.my-sm-0{margin-bottom:0!important}.ml-sm-0,.mx-sm-0{margin-left:0!important}.m-sm-1{margin:.25rem!important}.mt-sm-1,.my-sm-1{margin-top:.25rem!important}.mr-sm-1,.mx-sm-1{margin-right:.25rem!important}.mb-sm-1,.my-sm-1{margin-bottom:.25rem!important}.ml-sm-1,.mx-sm-1{margin-left:.25rem!important}.m-sm-2{margin:.5rem!important}.mt-sm-2,.my-sm-2{margin-top:.5rem!important}.mr-sm-2,.mx-sm-2{margin-right:.5rem!important}.mb-sm-2,.my-sm-2{margin-bottom:.5rem!important}.ml-sm-2,.mx-sm-2{margin-left:.5rem!important}.m-sm-3{margin:1rem!important}.mt-sm-3,.my-sm-3{margin-top:1rem!important}.mr-sm-3,.mx-sm-3{margin-right:1rem!important}.mb-sm-3,.my-sm-3{margin-bottom:1rem!important}.ml-sm-3,.mx-sm-3{margin-left:1rem!important}.m-sm-4{margin:1.5rem!important}.mt-sm-4,.my-sm-4{margin-top:1.5rem!important}.mr-sm-4,.mx-sm-4{margin-right:1.5rem!important}.mb-sm-4,.my-sm-4{margin-bottom:1.5rem!important}.ml-sm-4,.mx-sm-4{margin-left:1.5rem!important}.m-sm-5{margin:3rem!important}.mt-sm-5,.my-sm-5{margin-top:3rem!important}.mr-sm-5,.mx-sm-5{margin-right:3rem!important}.mb-sm-5,.my-sm-5{margin-bottom:3rem!important}.ml-sm-5,.mx-sm-5{margin-left:3rem!important}.p-sm-0{padding:0!important}.pt-sm-0,.py-sm-0{padding-top:0!important}.pr-sm-0,.px-sm-0{padding-right:0!important}.pb-sm-0,.py-sm-0{padding-bottom:0!important}.pl-sm-0,.px-sm-0{padding-left:0!important}.p-sm-1{padding:.25rem!important}.pt-sm-1,.py-sm-1{padding-top:.25rem!important}.pr-sm-1,.px-sm-1{padding-right:.25rem!important}.pb-sm-1,.py-sm-1{padding-bottom:.25rem!important}.pl-sm-1,.px-sm-1{padding-left:.25rem!important}.p-sm-2{padding:.5rem!important}.pt-sm-2,.py-sm-2{padding-top:.5rem!important}.pr-sm-2,.px-sm-2{padding-right:.5rem!important}.pb-sm-2,.py-sm-2{padding-bottom:.5rem!important}.pl-sm-2,.px-sm-2{padding-left:.5rem!important}.p-sm-3{padding:1rem!important}.pt-sm-3,.py-sm-3{padding-top:1rem!important}.pr-sm-3,.px-sm-3{padding-right:1rem!important}.pb-sm-3,.py-sm-3{padding-bottom:1rem!important}.pl-sm-3,.px-sm-3{padding-left:1rem!important}.p-sm-4{padding:1.5rem!important}.pt-sm-4,.py-sm-4{padding-top:1.5rem!important}.pr-sm-4,.px-sm-4{padding-right:1.5rem!important}.pb-sm-4,.py-sm-4{padding-bottom:1.5rem!important}.pl-sm-4,.px-sm-4{padding-left:1.5rem!important}.p-sm-5{padding:3rem!important}.pt-sm-5,.py-sm-5{padding-top:3rem!important}.pr-sm-5,.px-sm-5{padding-right:3rem!important}.pb-sm-5,.py-sm-5{padding-bottom:3rem!important}.pl-sm-5,.px-sm-5{padding-left:3rem!important}.m-sm-auto{margin:auto!important}.mt-sm-auto,.my-sm-auto{margin-top:auto!important}.mr-sm-auto,.mx-sm-auto{margin-right:auto!important}.mb-sm-auto,.my-sm-auto{margin-bottom:auto!important}.ml-sm-auto,.mx-sm-auto{margin-left:auto!important}}@media (min-width:768px){.m-md-0{margin:0!important}.mt-md-0,.my-md-0{margin-top:0!important}.mr-md-0,.mx-md-0{margin-right:0!important}.mb-md-0,.my-md-0{margin-bottom:0!important}.ml-md-0,.mx-md-0{margin-left:0!important}.m-md-1{margin:.25rem!important}.mt-md-1,.my-md-1{margin-top:.25rem!important}.mr-md-1,.mx-md-1{margin-right:.25rem!important}.mb-md-1,.my-md-1{margin-bottom:.25rem!important}.ml-md-1,.mx-md-1{margin-left:.25rem!important}.m-md-2{margin:.5rem!important}.mt-md-2,.my-md-2{margin-top:.5rem!important}.mr-md-2,.mx-md-2{margin-right:.5rem!important}.mb-md-2,.my-md-2{margin-bottom:.5rem!important}.ml-md-2,.mx-md-2{margin-left:.5rem!important}.m-md-3{margin:1rem!important}.mt-md-3,.my-md-3{margin-top:1rem!important}.mr-md-3,.mx-md-3{margin-right:1rem!important}.mb-md-3,.my-md-3{margin-bottom:1rem!important}.ml-md-3,.mx-md-3{margin-left:1rem!important}.m-md-4{margin:1.5rem!important}.mt-md-4,.my-md-4{margin-top:1.5rem!important}.mr-md-4,.mx-md-4{margin-right:1.5rem!important}.mb-md-4,.my-md-4{margin-bottom:1.5rem!important}.ml-md-4,.mx-md-4{margin-left:1.5rem!important}.m-md-5{margin:3rem!important}.mt-md-5,.my-md-5{margin-top:3rem!important}.mr-md-5,.mx-md-5{margin-right:3rem!important}.mb-md-5,.my-md-5{margin-bottom:3rem!important}.ml-md-5,.mx-md-5{margin-left:3rem!important}.p-md-0{padding:0!important}.pt-md-0,.py-md-0{padding-top:0!important}.pr-md-0,.px-md-0{padding-right:0!important}.pb-md-0,.py-md-0{padding-bottom:0!important}.pl-md-0,.px-md-0{padding-left:0!important}.p-md-1{padding:.25rem!important}.pt-md-1,.py-md-1{padding-top:.25rem!important}.pr-md-1,.px-md-1{padding-right:.25rem!important}.pb-md-1,.py-md-1{padding-bottom:.25rem!important}.pl-md-1,.px-md-1{padding-left:.25rem!important}.p-md-2{padding:.5rem!important}.pt-md-2,.py-md-2{padding-top:.5rem!important}.pr-md-2,.px-md-2{padding-right:.5rem!important}.pb-md-2,.py-md-2{padding-bottom:.5rem!important}.pl-md-2,.px-md-2{padding-left:.5rem!important}.p-md-3{padding:1rem!important}.pt-md-3,.py-md-3{padding-top:1rem!important}.pr-md-3,.px-md-3{padding-right:1rem!important}.pb-md-3,.py-md-3{padding-bottom:1rem!important}.pl-md-3,.px-md-3{padding-left:1rem!important}.p-md-4{padding:1.5rem!important}.pt-md-4,.py-md-4{padding-top:1.5rem!important}.pr-md-4,.px-md-4{padding-right:1.5rem!important}.pb-md-4,.py-md-4{padding-bottom:1.5rem!important}.pl-md-4,.px-md-4{padding-left:1.5rem!important}.p-md-5{padding:3rem!important}.pt-md-5,.py-md-5{padding-top:3rem!important}.pr-md-5,.px-md-5{padding-right:3rem!important}.pb-md-5,.py-md-5{padding-bottom:3rem!important}.pl-md-5,.px-md-5{padding-left:3rem!important}.m-md-auto{margin:auto!important}.mt-md-auto,.my-md-auto{margin-top:auto!important}.mr-md-auto,.mx-md-auto{margin-right:auto!important}.mb-md-auto,.my-md-auto{margin-bottom:auto!important}.ml-md-auto,.mx-md-auto{margin-left:auto!important}}@media (min-width:992px){.m-lg-0{margin:0!important}.mt-lg-0,.my-lg-0{margin-top:0!important}.mr-lg-0,.mx-lg-0{margin-right:0!important}.mb-lg-0,.my-lg-0{margin-bottom:0!important}.ml-lg-0,.mx-lg-0{margin-left:0!important}.m-lg-1{margin:.25rem!important}.mt-lg-1,.my-lg-1{margin-top:.25rem!important}.mr-lg-1,.mx-lg-1{margin-right:.25rem!important}.mb-lg-1,.my-lg-1{margin-bottom:.25rem!important}.ml-lg-1,.mx-lg-1{margin-left:.25rem!important}.m-lg-2{margin:.5rem!important}.mt-lg-2,.my-lg-2{margin-top:.5rem!important}.mr-lg-2,.mx-lg-2{margin-right:.5rem!important}.mb-lg-2,.my-lg-2{margin-bottom:.5rem!important}.ml-lg-2,.mx-lg-2{margin-left:.5rem!important}.m-lg-3{margin:1rem!important}.mt-lg-3,.my-lg-3{margin-top:1rem!important}.mr-lg-3,.mx-lg-3{margin-right:1rem!important}.mb-lg-3,.my-lg-3{margin-bottom:1rem!important}.ml-lg-3,.mx-lg-3{margin-left:1rem!important}.m-lg-4{margin:1.5rem!important}.mt-lg-4,.my-lg-4{margin-top:1.5rem!important}.mr-lg-4,.mx-lg-4{margin-right:1.5rem!important}.mb-lg-4,.my-lg-4{margin-bottom:1.5rem!important}.ml-lg-4,.mx-lg-4{margin-left:1.5rem!important}.m-lg-5{margin:3rem!important}.mt-lg-5,.my-lg-5{margin-top:3rem!important}.mr-lg-5,.mx-lg-5{margin-right:3rem!important}.mb-lg-5,.my-lg-5{margin-bottom:3rem!important}.ml-lg-5,.mx-lg-5{margin-left:3rem!important}.p-lg-0{padding:0!important}.pt-lg-0,.py-lg-0{padding-top:0!important}.pr-lg-0,.px-lg-0{padding-right:0!important}.pb-lg-0,.py-lg-0{padding-bottom:0!important}.pl-lg-0,.px-lg-0{padding-left:0!important}.p-lg-1{padding:.25rem!important}.pt-lg-1,.py-lg-1{padding-top:.25rem!important}.pr-lg-1,.px-lg-1{padding-right:.25rem!important}.pb-lg-1,.py-lg-1{padding-bottom:.25rem!important}.pl-lg-1,.px-lg-1{padding-left:.25rem!important}.p-lg-2{padding:.5rem!important}.pt-lg-2,.py-lg-2{padding-top:.5rem!important}.pr-lg-2,.px-lg-2{padding-right:.5rem!important}.pb-lg-2,.py-lg-2{padding-bottom:.5rem!important}.pl-lg-2,.px-lg-2{padding-left:.5rem!important}.p-lg-3{padding:1rem!important}.pt-lg-3,.py-lg-3{padding-top:1rem!important}.pr-lg-3,.px-lg-3{padding-right:1rem!important}.pb-lg-3,.py-lg-3{padding-bottom:1rem!important}.pl-lg-3,.px-lg-3{padding-left:1rem!important}.p-lg-4{padding:1.5rem!important}.pt-lg-4,.py-lg-4{padding-top:1.5rem!important}.pr-lg-4,.px-lg-4{padding-right:1.5rem!important}.pb-lg-4,.py-lg-4{padding-bottom:1.5rem!important}.pl-lg-4,.px-lg-4{padding-left:1.5rem!important}.p-lg-5{padding:3rem!important}.pt-lg-5,.py-lg-5{padding-top:3rem!important}.pr-lg-5,.px-lg-5{padding-right:3rem!important}.pb-lg-5,.py-lg-5{padding-bottom:3rem!important}.pl-lg-5,.px-lg-5{padding-left:3rem!important}.m-lg-auto{margin:auto!important}.mt-lg-auto,.my-lg-auto{margin-top:auto!important}.mr-lg-auto,.mx-lg-auto{margin-right:auto!important}.mb-lg-auto,.my-lg-auto{margin-bottom:auto!important}.ml-lg-auto,.mx-lg-auto{margin-left:auto!important}}@media (min-width:1200px){.m-xl-0{margin:0!important}.mt-xl-0,.my-xl-0{margin-top:0!important}.mr-xl-0,.mx-xl-0{margin-right:0!important}.mb-xl-0,.my-xl-0{margin-bottom:0!important}.ml-xl-0,.mx-xl-0{margin-left:0!important}.m-xl-1{margin:.25rem!important}.mt-xl-1,.my-xl-1{margin-top:.25rem!important}.mr-xl-1,.mx-xl-1{margin-right:.25rem!important}.mb-xl-1,.my-xl-1{margin-bottom:.25rem!important}.ml-xl-1,.mx-xl-1{margin-left:.25rem!important}.m-xl-2{margin:.5rem!important}.mt-xl-2,.my-xl-2{margin-top:.5rem!important}.mr-xl-2,.mx-xl-2{margin-right:.5rem!important}.mb-xl-2,.my-xl-2{margin-bottom:.5rem!important}.ml-xl-2,.mx-xl-2{margin-left:.5rem!important}.m-xl-3{margin:1rem!important}.mt-xl-3,.my-xl-3{margin-top:1rem!important}.mr-xl-3,.mx-xl-3{margin-right:1rem!important}.mb-xl-3,.my-xl-3{margin-bottom:1rem!important}.ml-xl-3,.mx-xl-3{margin-left:1rem!important}.m-xl-4{margin:1.5rem!important}.mt-xl-4,.my-xl-4{margin-top:1.5rem!important}.mr-xl-4,.mx-xl-4{margin-right:1.5rem!important}.mb-xl-4,.my-xl-4{margin-bottom:1.5rem!important}.ml-xl-4,.mx-xl-4{margin-left:1.5rem!important}.m-xl-5{margin:3rem!important}.mt-xl-5,.my-xl-5{margin-top:3rem!important}.mr-xl-5,.mx-xl-5{margin-right:3rem!important}.mb-xl-5,.my-xl-5{margin-bottom:3rem!important}.ml-xl-5,.mx-xl-5{margin-left:3rem!important}.p-xl-0{padding:0!important}.pt-xl-0,.py-xl-0{padding-top:0!important}.pr-xl-0,.px-xl-0{padding-right:0!important}.pb-xl-0,.py-xl-0{padding-bottom:0!important}.pl-xl-0,.px-xl-0{padding-left:0!important}.p-xl-1{padding:.25rem!important}.pt-xl-1,.py-xl-1{padding-top:.25rem!important}.pr-xl-1,.px-xl-1{padding-right:.25rem!important}.pb-xl-1,.py-xl-1{padding-bottom:.25rem!important}.pl-xl-1,.px-xl-1{padding-left:.25rem!important}.p-xl-2{padding:.5rem!important}.pt-xl-2,.py-xl-2{padding-top:.5rem!important}.pr-xl-2,.px-xl-2{padding-right:.5rem!important}.pb-xl-2,.py-xl-2{padding-bottom:.5rem!important}.pl-xl-2,.px-xl-2{padding-left:.5rem!important}.p-xl-3{padding:1rem!important}.pt-xl-3,.py-xl-3{padding-top:1rem!important}.pr-xl-3,.px-xl-3{padding-right:1rem!important}.pb-xl-3,.py-xl-3{padding-bottom:1rem!important}.pl-xl-3,.px-xl-3{padding-left:1rem!important}.p-xl-4{padding:1.5rem!important}.pt-xl-4,.py-xl-4{padding-top:1.5rem!important}.pr-xl-4,.px-xl-4{padding-right:1.5rem!important}.pb-xl-4,.py-xl-4{padding-bottom:1.5rem!important}.pl-xl-4,.px-xl-4{padding-left:1.5rem!important}.p-xl-5{padding:3rem!important}.pt-xl-5,.py-xl-5{padding-top:3rem!important}.pr-xl-5,.px-xl-5{padding-right:3rem!important}.pb-xl-5,.py-xl-5{padding-bottom:3rem!important}.pl-xl-5,.px-xl-5{padding-left:3rem!important}.m-xl-auto{margin:auto!important}.mt-xl-auto,.my-xl-auto{margin-top:auto!important}.mr-xl-auto,.mx-xl-auto{margin-right:auto!important}.mb-xl-auto,.my-xl-auto{margin-bottom:auto!important}.ml-xl-auto,.mx-xl-auto{margin-left:auto!important}}.text-monospace{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}.text-justify{text-align:justify!important}.text-nowrap{white-space:nowrap!important}.text-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-left{text-align:left!important}.text-right{text-align:right!important}.text-center{text-align:center!important}@media (min-width:576px){.text-sm-left{text-align:left!important}.text-sm-right{text-align:right!important}.text-sm-center{text-align:center!important}}@media (min-width:768px){.text-md-left{text-align:left!important}.text-md-right{text-align:right!important}.text-md-center{text-align:center!important}}@media (min-width:992px){.text-lg-left{text-align:left!important}.text-lg-right{text-align:right!important}.text-lg-center{text-align:center!important}}@media (min-width:1200px){.text-xl-left{text-align:left!important}.text-xl-right{text-align:right!important}.text-xl-center{text-align:center!important}}.text-lowercase{text-transform:lowercase!important}.text-uppercase{text-transform:uppercase!important}.text-capitalize{text-transform:capitalize!important}.font-weight-light{font-weight:300!important}.font-weight-normal{font-weight:400!important}.font-weight-bold{font-weight:700!important}.font-italic{font-style:italic!important}.text-white{color:#fff!important}.text-primary{color:#007bff!important}a.text-primary:focus,a.text-primary:hover{color:#0062cc!important}.text-secondary{color:#6c757d!important}a.text-secondary:focus,a.text-secondary:hover{color:#545b62!important}.text-success{color:#28a745!important}a.text-success:focus,a.text-success:hover{color:#1e7e34!important}.text-info{color:#17a2b8!important}a.text-info:focus,a.text-info:hover{color:#117a8b!important}.text-warning{color:#ffc107!important}a.text-warning:focus,a.text-warning:hover{color:#d39e00!important}.text-danger{color:#dc3545!important}a.text-danger:focus,a.text-danger:hover{color:#bd2130!important}.text-light{color:#f8f9fa!important}a.text-light:focus,a.text-light:hover{color:#dae0e5!important}.text-dark{color:#343a40!important}a.text-dark:focus,a.text-dark:hover{color:#1d2124!important}.text-body{color:#212529!important}.text-muted{color:#6c757d!important}.text-black-50{color:rgba(0,0,0,.5)!important}.text-white-50{color:rgba(255,255,255,.5)!important}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.visible{visibility:visible!important}.invisible{visibility:hidden!important}@media print{*,::after,::before{text-shadow:none!important;box-shadow:none!important}a:not(.btn){text-decoration:underline}abbr[title]::after{content:" (" attr(title) ")"}pre{white-space:pre-wrap!important}blockquote,pre{border:1px solid #adb5bd;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}@page{size:a3}body{min-width:992px!important}.container{min-width:992px!important}.navbar{display:none}.badge{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #dee2e6!important}.table-dark{color:inherit}.table-dark tbody+tbody,.table-dark td,.table-dark th,.table-dark thead th{border-color:#dee2e6}.table .thead-dark th{color:inherit;border-color:#dee2e6}} +/*# sourceMappingURL=bootstrap.min.css.map */ diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/custom.css b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/custom.css new file mode 100644 index 0000000..e69de29 diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/nv.d3.min.css b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/nv.d3.min.css new file mode 100644 index 0000000..7a6f7fe --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/nv.d3.min.css @@ -0,0 +1 @@ +.nvd3 .nv-axis{pointer-events:none;opacity:1}.nvd3 .nv-axis path{fill:none;stroke:#000;stroke-opacity:.75;shape-rendering:crispEdges}.nvd3 .nv-axis path.domain{stroke-opacity:.75}.nvd3 .nv-axis.nv-x path.domain{stroke-opacity:0}.nvd3 .nv-axis line{fill:none;stroke:#e5e5e5;shape-rendering:crispEdges}.nvd3 .nv-axis .zero line,.nvd3 .nv-axis line.zero{stroke-opacity:.75}.nvd3 .nv-axis .nv-axisMaxMin text{font-weight:700}.nvd3 .x .nv-axis .nv-axisMaxMin text,.nvd3 .x2 .nv-axis .nv-axisMaxMin text,.nvd3 .x3 .nv-axis .nv-axisMaxMin text{text-anchor:middle}.nvd3 .nv-axis.nv-disabled{opacity:0}.nvd3 .nv-bars rect{fill-opacity:.75;transition:fill-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear}.nvd3 .nv-bars rect.hover{fill-opacity:1}.nvd3 .nv-bars .hover rect{fill:#add8e6}.nvd3 .nv-bars text{fill:rgba(0,0,0,0)}.nvd3 .nv-bars .hover text{fill:rgba(0,0,0,1)}.nvd3 .nv-multibar .nv-groups rect,.nvd3 .nv-multibarHorizontal .nv-groups rect,.nvd3 .nv-discretebar .nv-groups rect{stroke-opacity:0;transition:fill-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear}.nvd3 .nv-multibar .nv-groups rect:hover,.nvd3 .nv-multibarHorizontal .nv-groups rect:hover,.nvd3 .nv-candlestickBar .nv-ticks rect:hover,.nvd3 .nv-discretebar .nv-groups rect:hover{fill-opacity:1}.nvd3 .nv-discretebar .nv-groups text,.nvd3 .nv-multibarHorizontal .nv-groups text{font-weight:700;fill:rgba(0,0,0,1);stroke:rgba(0,0,0,0)}.nvd3 .nv-boxplot circle{fill-opacity:.5}.nvd3 .nv-boxplot circle:hover{fill-opacity:1}.nvd3 .nv-boxplot rect:hover{fill-opacity:1}.nvd3 line.nv-boxplot-median{stroke:#000}.nv-boxplot-tick:hover{stroke-width:2.5px}.nvd3.nv-bullet{font:10px sans-serif}.nvd3.nv-bullet .nv-measure{fill-opacity:.8}.nvd3.nv-bullet .nv-measure:hover{fill-opacity:1}.nvd3.nv-bullet .nv-marker{stroke:#000;stroke-width:2px}.nvd3.nv-bullet .nv-markerTriangle{stroke:#000;fill:#fff;stroke-width:1.5px}.nvd3.nv-bullet .nv-tick line{stroke:#666;stroke-width:.5px}.nvd3.nv-bullet .nv-range.nv-s0{fill:#eee}.nvd3.nv-bullet .nv-range.nv-s1{fill:#ddd}.nvd3.nv-bullet .nv-range.nv-s2{fill:#ccc}.nvd3.nv-bullet .nv-title{font-size:14px;font-weight:700}.nvd3.nv-bullet .nv-subtitle{fill:#999}.nvd3.nv-bullet .nv-range{fill:#bababa;fill-opacity:.4}.nvd3.nv-bullet .nv-range:hover{fill-opacity:.7}.nvd3.nv-candlestickBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.positive rect{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-candlestickBar .nv-ticks .nv-tick.negative rect{stroke:#d62728;fill:#d62728}.with-transitions .nv-candlestickBar .nv-ticks .nv-tick{transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-moz-transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-webkit-transition:stroke-width 250ms linear,stroke-opacity 250ms linear}.nvd3.nv-candlestickBar .nv-ticks line{stroke:#333}.nvd3 .nv-legend .nv-disabled rect{}.nvd3 .nv-check-box .nv-box{fill-opacity:0;stroke-width:2}.nvd3 .nv-check-box .nv-check{fill-opacity:0;stroke-width:4}.nvd3 .nv-series.nv-disabled .nv-check-box .nv-check{fill-opacity:0;stroke-opacity:0}.nvd3 .nv-controlsWrap .nv-legend .nv-check-box .nv-check{opacity:0}.nvd3.nv-linePlusBar .nv-bar rect{fill-opacity:.75}.nvd3.nv-linePlusBar .nv-bar rect:hover{fill-opacity:1}.nvd3 .nv-groups path.nv-line{fill:none}.nvd3 .nv-groups path.nv-area{stroke:none}.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point{fill-opacity:0;stroke-opacity:0}.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point{fill-opacity:.5!important;stroke-opacity:.5!important}.with-transitions .nvd3 .nv-groups .nv-point{transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-moz-transition:stroke-width 250ms linear,stroke-opacity 250ms linear;-webkit-transition:stroke-width 250ms linear,stroke-opacity 250ms linear}.nvd3.nv-scatter .nv-groups .nv-point.hover,.nvd3 .nv-groups .nv-point.hover{stroke-width:7px;fill-opacity:.95!important;stroke-opacity:.95!important}.nvd3 .nv-point-paths path{stroke:#aaa;stroke-opacity:0;fill:#eee;fill-opacity:0}.nvd3 .nv-indexLine{cursor:ew-resize}svg.nvd3-svg{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-ms-user-select:none;-moz-user-select:none;user-select:none;display:block;width:100%;height:100%}.nvtooltip.with-3d-shadow,.with-3d-shadow .nvtooltip{-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.nvd3 text{font:400 12px Arial}.nvd3 .title{font:700 14px Arial}.nvd3 .nv-background{fill:#fff;fill-opacity:0}.nvd3.nv-noData{font-size:18px;font-weight:700}.nv-brush .extent{fill-opacity:.125;shape-rendering:crispEdges}.nv-brush .resize path{fill:#eee;stroke:#666}.nvd3 .nv-legend .nv-series{cursor:pointer}.nvd3 .nv-legend .nv-disabled circle{fill-opacity:0}.nvd3 .nv-brush .extent{fill-opacity:0!important}.nvd3 .nv-brushBackground rect{stroke:#000;stroke-width:.4;fill:#fff;fill-opacity:.7}.nvd3.nv-ohlcBar .nv-ticks .nv-tick{stroke-width:1px}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover{stroke-width:2px}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive{stroke:#2ca02c}.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative{stroke:#d62728}.nvd3 .background path{fill:none;stroke:#EEE;stroke-opacity:.4;shape-rendering:crispEdges}.nvd3 .foreground path{fill:none;stroke-opacity:.7}.nvd3 .nv-parallelCoordinates-brush .extent{fill:#fff;fill-opacity:.6;stroke:gray;shape-rendering:crispEdges}.nvd3 .nv-parallelCoordinates .hover{fill-opacity:1;stroke-width:3px}.nvd3 .missingValuesline line{fill:none;stroke:#000;stroke-width:1;stroke-opacity:1;stroke-dasharray:5,5}.nvd3.nv-pie path{stroke-opacity:0;transition:fill-opacity 250ms linear,stroke-width 250ms linear,stroke-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear,stroke-width 250ms linear,stroke-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear,stroke-width 250ms linear,stroke-opacity 250ms linear}.nvd3.nv-pie .nv-pie-title{font-size:24px;fill:rgba(19,196,249,.59)}.nvd3.nv-pie .nv-slice text{stroke:#000;stroke-width:0}.nvd3.nv-pie path{stroke:#fff;stroke-width:1px;stroke-opacity:1}.nvd3.nv-pie .hover path{fill-opacity:.7}.nvd3.nv-pie .nv-label{pointer-events:none}.nvd3.nv-pie .nv-label rect{fill-opacity:0;stroke-opacity:0}.nvd3 .nv-groups .nv-point.hover{stroke-width:20px;stroke-opacity:.5}.nvd3 .nv-scatter .nv-point.hover{fill-opacity:1}.nv-noninteractive{pointer-events:none}.nv-distx,.nv-disty{pointer-events:none}.nvd3.nv-sparkline path{fill:none}.nvd3.nv-sparklineplus g.nv-hoverValue{pointer-events:none}.nvd3.nv-sparklineplus .nv-hoverValue line{stroke:#333;stroke-width:1.5px}.nvd3.nv-sparklineplus,.nvd3.nv-sparklineplus g{pointer-events:all}.nvd3 .nv-hoverArea{fill-opacity:0;stroke-opacity:0}.nvd3.nv-sparklineplus .nv-xValue,.nvd3.nv-sparklineplus .nv-yValue{stroke-width:0;font-size:.9em;font-weight:400}.nvd3.nv-sparklineplus .nv-yValue{stroke:#f66}.nvd3.nv-sparklineplus .nv-maxValue{stroke:#2ca02c;fill:#2ca02c}.nvd3.nv-sparklineplus .nv-minValue{stroke:#d62728;fill:#d62728}.nvd3.nv-sparklineplus .nv-currentValue{font-weight:700;font-size:1.1em}.nvd3.nv-stackedarea path.nv-area{fill-opacity:.7;stroke-opacity:0;transition:fill-opacity 250ms linear,stroke-opacity 250ms linear;-moz-transition:fill-opacity 250ms linear,stroke-opacity 250ms linear;-webkit-transition:fill-opacity 250ms linear,stroke-opacity 250ms linear}.nvd3.nv-stackedarea path.nv-area.hover{fill-opacity:.9}.nvd3.nv-stackedarea .nv-groups .nv-point{stroke-opacity:0;fill-opacity:0}.nvtooltip{position:absolute;background-color:rgba(255,255,255,1);color:rgba(0,0,0,1);padding:1px;border:1px solid rgba(0,0,0,.2);z-index:10000;display:block;font-family:Arial;font-size:13px;text-align:left;pointer-events:none;white-space:nowrap;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.nvtooltip{background:rgba(255,255,255,.8);border:1px solid rgba(0,0,0,.5);border-radius:4px}.nvtooltip.with-transitions,.with-transitions .nvtooltip{transition:opacity 50ms linear;-moz-transition:opacity 50ms linear;-webkit-transition:opacity 50ms linear;transition-delay:200ms;-moz-transition-delay:200ms;-webkit-transition-delay:200ms}.nvtooltip.x-nvtooltip,.nvtooltip.y-nvtooltip{padding:8px}.nvtooltip h3{margin:0;padding:4px 14px;line-height:18px;font-weight:400;background-color:rgba(247,247,247,.75);color:rgba(0,0,0,1);text-align:center;border-bottom:1px solid #ebebeb;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.nvtooltip p{margin:0;padding:5px 14px;text-align:center}.nvtooltip span{display:inline-block;margin:2px 0}.nvtooltip table{margin:6px;border-spacing:0}.nvtooltip table td{padding:2px 9px 2px 0;vertical-align:middle}.nvtooltip table td.key{font-weight:400}.nvtooltip table td.value{text-align:right;font-weight:700}.nvtooltip table tr.highlight td{padding:1px 9px 1px 0;border-bottom-style:solid;border-bottom-width:1px;border-top-style:solid;border-top-width:1px}.nvtooltip table td.legend-color-guide div{width:8px;height:8px;vertical-align:middle}.nvtooltip table td.legend-color-guide div{width:12px;height:12px;border:1px solid #999}.nvtooltip .footer{padding:3px;text-align:center}.nvtooltip-pending-removal{pointer-events:none;display:none}.nvd3 .nv-interactiveGuideLine{pointer-events:none}.nvd3 line.nv-guideline{stroke:#ccc} \ No newline at end of file diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/octicons.css b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/octicons.css new file mode 100644 index 0000000..31d9786 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/octicons.css @@ -0,0 +1,5 @@ +.octicon { + display: inline-block; + vertical-align: text-top; + fill: currentColor; +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/style.css b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/style.css new file mode 100644 index 0000000..6d9c21e --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/css/style.css @@ -0,0 +1,122 @@ +body { + padding-top: 10px; +} + +.popover { + max-width: none; +} + +.octicon { + margin-right:.25em; +} + +.table-bordered>thead>tr>td { + border-bottom-width: 1px; +} + +.table tbody>tr>td, .table thead>tr>td { + padding-top: 3px; + padding-bottom: 3px; +} + +.table-condensed tbody>tr>td { + padding-top: 0; + padding-bottom: 0; +} + +.table .progress { + margin-bottom: inherit; +} + +.table-borderless th, .table-borderless td { + border: 0 !important; +} + +.table tbody tr.covered-by-large-tests, li.covered-by-large-tests, tr.success, td.success, li.success, span.success { + background-color: #dff0d8; +} + +.table tbody tr.covered-by-medium-tests, li.covered-by-medium-tests { + background-color: #c3e3b5; +} + +.table tbody tr.covered-by-small-tests, li.covered-by-small-tests { + background-color: #99cb84; +} + +.table tbody tr.danger, .table tbody td.danger, li.danger, span.danger { + background-color: #f2dede; +} + +.table tbody td.warning, li.warning, span.warning { + background-color: #fcf8e3; +} + +.table tbody td.info { + background-color: #d9edf7; +} + +td.big { + width: 117px; +} + +td.small { +} + +td.codeLine { + font-family: "Source Code Pro", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; + white-space: pre; +} + +td span.comment { + color: #888a85; +} + +td span.default { + color: #2e3436; +} + +td span.html { + color: #888a85; +} + +td span.keyword { + color: #2e3436; + font-weight: bold; +} + +pre span.string { + color: #2e3436; +} + +span.success, span.warning, span.danger { + margin-right: 2px; + padding-left: 10px; + padding-right: 10px; + text-align: center; +} + +#classCoverageDistribution, #classComplexity { + height: 200px; + width: 475px; +} + +#toplink { + position: fixed; + left: 5px; + bottom: 5px; + outline: 0; +} + +svg text { + font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + color: #666; + fill: #666; +} + +.scrollbox { + height:245px; + overflow-x:hidden; + overflow-y:scroll; +} diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/dashboard.html.dist b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/dashboard.html.dist new file mode 100644 index 0000000..cfa5768 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/dashboard.html.dist @@ -0,0 +1,281 @@ + + + + + Dashboard for {{full_path}} + + + + + + + +
+
+
+
+ +
+
+
+
+
+
+
+

Classes

+
+
+
+
+

Coverage Distribution

+
+ +
+
+
+

Complexity

+
+ +
+
+
+
+
+

Insufficient Coverage

+
+ + + + + + + + +{{insufficient_coverage_classes}} + +
ClassCoverage
+
+
+
+

Project Risks

+
+ + + + + + + + +{{project_risks_classes}} + +
ClassCRAP
+
+
+
+
+
+

Methods

+
+
+
+
+

Coverage Distribution

+
+ +
+
+
+

Complexity

+
+ +
+
+
+
+
+

Insufficient Coverage

+
+ + + + + + + + +{{insufficient_coverage_methods}} + +
MethodCoverage
+
+
+
+

Project Risks

+
+ + + + + + + + +{{project_risks_methods}} + +
MethodCRAP
+
+
+
+ +
+ + + + + + diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/directory.html.dist b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/directory.html.dist new file mode 100644 index 0000000..2fbf691 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/directory.html.dist @@ -0,0 +1,60 @@ + + + + + Code Coverage for {{full_path}} + + + + + + + +
+
+
+
+ +
+
+
+
+
+
+ + + + + + + + + + + + + + +{{items}} + +
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
+
+
+
+

Legend

+

+ Low: 0% to {{low_upper_bound}}% + Medium: {{low_upper_bound}}% to {{high_lower_bound}}% + High: {{high_lower_bound}}% to 100% +

+

+ Generated by php-code-coverage {{version}} using {{runtime}}{{generator}} at {{date}}. +

+
+
+ + diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/directory_item.html.dist b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/directory_item.html.dist new file mode 100644 index 0000000..f6941a4 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/directory_item.html.dist @@ -0,0 +1,13 @@ + + {{icon}}{{name}} + {{lines_bar}} +
{{lines_executed_percent}}
+
{{lines_number}}
+ {{methods_bar}} +
{{methods_tested_percent}}
+
{{methods_number}}
+ {{classes_bar}} +
{{classes_tested_percent}}
+
{{classes_number}}
+ + diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/file.html.dist b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/file.html.dist new file mode 100644 index 0000000..1c33503 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/file.html.dist @@ -0,0 +1,72 @@ + + + + + Code Coverage for {{full_path}} + + + + + + + +
+
+
+
+ +
+
+
+
+
+
+ + + + + + + + + + + + + + +{{items}} + +
 
Code Coverage
 
Classes and Traits
Functions and Methods
Lines
+
+ + +{{lines}} + +
+ +
+ + + + + + diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/file_item.html.dist b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/file_item.html.dist new file mode 100644 index 0000000..dc754b3 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/file_item.html.dist @@ -0,0 +1,14 @@ + + {{name}} + {{classes_bar}} +
{{classes_tested_percent}}
+
{{classes_number}}
+ {{methods_bar}} +
{{methods_tested_percent}}
+
{{methods_number}}
+ {{crap}} + {{lines_bar}} +
{{lines_executed_percent}}
+
{{lines_number}}
+ + diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/icons/file-code.svg b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/icons/file-code.svg new file mode 100644 index 0000000..5b4b199 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/icons/file-code.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/icons/file-directory.svg b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/icons/file-directory.svg new file mode 100644 index 0000000..4bf1f1c --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/icons/file-directory.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/bootstrap.min.js b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/bootstrap.min.js new file mode 100644 index 0000000..1a47712 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/bootstrap.min.js @@ -0,0 +1,7 @@ +/*! + * Bootstrap v4.1.3 (https://getbootstrap.com/) + * Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jquery"),require("popper.js")):"function"==typeof define&&define.amd?define(["exports","jquery","popper.js"],e):e(t.bootstrap={},t.jQuery,t.Popper)}(this,function(t,e,h){"use strict";function i(t,e){for(var n=0;nthis._items.length-1||t<0))if(this._isSliding)P(this._element).one(Q.SLID,function(){return e.to(t)});else{if(n===t)return this.pause(),void this.cycle();var i=ndocument.documentElement.clientHeight;!this._isBodyOverflowing&&t&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!t&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},t._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},t._checkScrollbar=function(){var t=document.body.getBoundingClientRect();this._isBodyOverflowing=t.left+t.right
',trigger:"hover focus",title:"",delay:0,html:!(Ie={AUTO:"auto",TOP:"top",RIGHT:"right",BOTTOM:"bottom",LEFT:"left"}),selector:!(Se={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(number|string)",container:"(string|element|boolean)",fallbackPlacement:"(string|array)",boundary:"(string|element)"}),placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent"},we="out",Ne={HIDE:"hide"+Ee,HIDDEN:"hidden"+Ee,SHOW:(De="show")+Ee,SHOWN:"shown"+Ee,INSERTED:"inserted"+Ee,CLICK:"click"+Ee,FOCUSIN:"focusin"+Ee,FOCUSOUT:"focusout"+Ee,MOUSEENTER:"mouseenter"+Ee,MOUSELEAVE:"mouseleave"+Ee},Oe="fade",ke="show",Pe=".tooltip-inner",je=".arrow",He="hover",Le="focus",Re="click",xe="manual",We=function(){function i(t,e){if("undefined"==typeof h)throw new TypeError("Bootstrap tooltips require Popper.js (https://popper.js.org)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=t,this.config=this._getConfig(e),this.tip=null,this._setListeners()}var t=i.prototype;return t.enable=function(){this._isEnabled=!0},t.disable=function(){this._isEnabled=!1},t.toggleEnabled=function(){this._isEnabled=!this._isEnabled},t.toggle=function(t){if(this._isEnabled)if(t){var e=this.constructor.DATA_KEY,n=pe(t.currentTarget).data(e);n||(n=new this.constructor(t.currentTarget,this._getDelegateConfig()),pe(t.currentTarget).data(e,n)),n._activeTrigger.click=!n._activeTrigger.click,n._isWithActiveTrigger()?n._enter(null,n):n._leave(null,n)}else{if(pe(this.getTipElement()).hasClass(ke))return void this._leave(null,this);this._enter(null,this)}},t.dispose=function(){clearTimeout(this._timeout),pe.removeData(this.element,this.constructor.DATA_KEY),pe(this.element).off(this.constructor.EVENT_KEY),pe(this.element).closest(".modal").off("hide.bs.modal"),this.tip&&pe(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,(this._activeTrigger=null)!==this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},t.show=function(){var e=this;if("none"===pe(this.element).css("display"))throw new Error("Please use show on visible elements");var t=pe.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){pe(this.element).trigger(t);var n=pe.contains(this.element.ownerDocument.documentElement,this.element);if(t.isDefaultPrevented()||!n)return;var i=this.getTipElement(),r=Fn.getUID(this.constructor.NAME);i.setAttribute("id",r),this.element.setAttribute("aria-describedby",r),this.setContent(),this.config.animation&&pe(i).addClass(Oe);var o="function"==typeof this.config.placement?this.config.placement.call(this,i,this.element):this.config.placement,s=this._getAttachment(o);this.addAttachmentClass(s);var a=!1===this.config.container?document.body:pe(document).find(this.config.container);pe(i).data(this.constructor.DATA_KEY,this),pe.contains(this.element.ownerDocument.documentElement,this.tip)||pe(i).appendTo(a),pe(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new h(this.element,i,{placement:s,modifiers:{offset:{offset:this.config.offset},flip:{behavior:this.config.fallbackPlacement},arrow:{element:je},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(t){t.originalPlacement!==t.placement&&e._handlePopperPlacementChange(t)},onUpdate:function(t){e._handlePopperPlacementChange(t)}}),pe(i).addClass(ke),"ontouchstart"in document.documentElement&&pe(document.body).children().on("mouseover",null,pe.noop);var l=function(){e.config.animation&&e._fixTransition();var t=e._hoverState;e._hoverState=null,pe(e.element).trigger(e.constructor.Event.SHOWN),t===we&&e._leave(null,e)};if(pe(this.tip).hasClass(Oe)){var c=Fn.getTransitionDurationFromElement(this.tip);pe(this.tip).one(Fn.TRANSITION_END,l).emulateTransitionEnd(c)}else l()}},t.hide=function(t){var e=this,n=this.getTipElement(),i=pe.Event(this.constructor.Event.HIDE),r=function(){e._hoverState!==De&&n.parentNode&&n.parentNode.removeChild(n),e._cleanTipClass(),e.element.removeAttribute("aria-describedby"),pe(e.element).trigger(e.constructor.Event.HIDDEN),null!==e._popper&&e._popper.destroy(),t&&t()};if(pe(this.element).trigger(i),!i.isDefaultPrevented()){if(pe(n).removeClass(ke),"ontouchstart"in document.documentElement&&pe(document.body).children().off("mouseover",null,pe.noop),this._activeTrigger[Re]=!1,this._activeTrigger[Le]=!1,this._activeTrigger[He]=!1,pe(this.tip).hasClass(Oe)){var o=Fn.getTransitionDurationFromElement(n);pe(n).one(Fn.TRANSITION_END,r).emulateTransitionEnd(o)}else r();this._hoverState=""}},t.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},t.isWithContent=function(){return Boolean(this.getTitle())},t.addAttachmentClass=function(t){pe(this.getTipElement()).addClass(Te+"-"+t)},t.getTipElement=function(){return this.tip=this.tip||pe(this.config.template)[0],this.tip},t.setContent=function(){var t=this.getTipElement();this.setElementContent(pe(t.querySelectorAll(Pe)),this.getTitle()),pe(t).removeClass(Oe+" "+ke)},t.setElementContent=function(t,e){var n=this.config.html;"object"==typeof e&&(e.nodeType||e.jquery)?n?pe(e).parent().is(t)||t.empty().append(e):t.text(pe(e).text()):t[n?"html":"text"](e)},t.getTitle=function(){var t=this.element.getAttribute("data-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),t},t._getAttachment=function(t){return Ie[t.toUpperCase()]},t._setListeners=function(){var i=this;this.config.trigger.split(" ").forEach(function(t){if("click"===t)pe(i.element).on(i.constructor.Event.CLICK,i.config.selector,function(t){return i.toggle(t)});else if(t!==xe){var e=t===He?i.constructor.Event.MOUSEENTER:i.constructor.Event.FOCUSIN,n=t===He?i.constructor.Event.MOUSELEAVE:i.constructor.Event.FOCUSOUT;pe(i.element).on(e,i.config.selector,function(t){return i._enter(t)}).on(n,i.config.selector,function(t){return i._leave(t)})}pe(i.element).closest(".modal").on("hide.bs.modal",function(){return i.hide()})}),this.config.selector?this.config=l({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},t._fixTitle=function(){var t=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==t)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},t._enter=function(t,e){var n=this.constructor.DATA_KEY;(e=e||pe(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),pe(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusin"===t.type?Le:He]=!0),pe(e.getTipElement()).hasClass(ke)||e._hoverState===De?e._hoverState=De:(clearTimeout(e._timeout),e._hoverState=De,e.config.delay&&e.config.delay.show?e._timeout=setTimeout(function(){e._hoverState===De&&e.show()},e.config.delay.show):e.show())},t._leave=function(t,e){var n=this.constructor.DATA_KEY;(e=e||pe(t.currentTarget).data(n))||(e=new this.constructor(t.currentTarget,this._getDelegateConfig()),pe(t.currentTarget).data(n,e)),t&&(e._activeTrigger["focusout"===t.type?Le:He]=!1),e._isWithActiveTrigger()||(clearTimeout(e._timeout),e._hoverState=we,e.config.delay&&e.config.delay.hide?e._timeout=setTimeout(function(){e._hoverState===we&&e.hide()},e.config.delay.hide):e.hide())},t._isWithActiveTrigger=function(){for(var t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1},t._getConfig=function(t){return"number"==typeof(t=l({},this.constructor.Default,pe(this.element).data(),"object"==typeof t&&t?t:{})).delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),Fn.typeCheckConfig(ve,t,this.constructor.DefaultType),t},t._getDelegateConfig=function(){var t={};if(this.config)for(var e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t},t._cleanTipClass=function(){var t=pe(this.getTipElement()),e=t.attr("class").match(be);null!==e&&e.length&&t.removeClass(e.join(""))},t._handlePopperPlacementChange=function(t){var e=t.instance;this.tip=e.popper,this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(t.placement))},t._fixTransition=function(){var t=this.getTipElement(),e=this.config.animation;null===t.getAttribute("x-placement")&&(pe(t).removeClass(Oe),this.config.animation=!1,this.hide(),this.show(),this.config.animation=e)},i._jQueryInterface=function(n){return this.each(function(){var t=pe(this).data(ye),e="object"==typeof n&&n;if((t||!/dispose|hide/.test(n))&&(t||(t=new i(this,e),pe(this).data(ye,t)),"string"==typeof n)){if("undefined"==typeof t[n])throw new TypeError('No method named "'+n+'"');t[n]()}})},s(i,null,[{key:"VERSION",get:function(){return"4.1.3"}},{key:"Default",get:function(){return Ae}},{key:"NAME",get:function(){return ve}},{key:"DATA_KEY",get:function(){return ye}},{key:"Event",get:function(){return Ne}},{key:"EVENT_KEY",get:function(){return Ee}},{key:"DefaultType",get:function(){return Se}}]),i}(),pe.fn[ve]=We._jQueryInterface,pe.fn[ve].Constructor=We,pe.fn[ve].noConflict=function(){return pe.fn[ve]=Ce,We._jQueryInterface},We),Jn=(qe="popover",Ke="."+(Fe="bs.popover"),Me=(Ue=e).fn[qe],Qe="bs-popover",Be=new RegExp("(^|\\s)"+Qe+"\\S+","g"),Ve=l({},zn.Default,{placement:"right",trigger:"click",content:"",template:''}),Ye=l({},zn.DefaultType,{content:"(string|element|function)"}),ze="fade",Ze=".popover-header",Ge=".popover-body",$e={HIDE:"hide"+Ke,HIDDEN:"hidden"+Ke,SHOW:(Je="show")+Ke,SHOWN:"shown"+Ke,INSERTED:"inserted"+Ke,CLICK:"click"+Ke,FOCUSIN:"focusin"+Ke,FOCUSOUT:"focusout"+Ke,MOUSEENTER:"mouseenter"+Ke,MOUSELEAVE:"mouseleave"+Ke},Xe=function(t){var e,n;function i(){return t.apply(this,arguments)||this}n=t,(e=i).prototype=Object.create(n.prototype),(e.prototype.constructor=e).__proto__=n;var r=i.prototype;return r.isWithContent=function(){return this.getTitle()||this._getContent()},r.addAttachmentClass=function(t){Ue(this.getTipElement()).addClass(Qe+"-"+t)},r.getTipElement=function(){return this.tip=this.tip||Ue(this.config.template)[0],this.tip},r.setContent=function(){var t=Ue(this.getTipElement());this.setElementContent(t.find(Ze),this.getTitle());var e=this._getContent();"function"==typeof e&&(e=e.call(this.element)),this.setElementContent(t.find(Ge),e),t.removeClass(ze+" "+Je)},r._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},r._cleanTipClass=function(){var t=Ue(this.getTipElement()),e=t.attr("class").match(Be);null!==e&&0=this._offsets[r]&&("undefined"==typeof this._offsets[r+1]||tn?-1:n>t?1:n>=t?0:NaN}function r(n){return null===n?NaN:+n}function i(n){return!isNaN(n)}function u(n){return{left:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var u=r+i>>>1;n(t[u],e)<0?r=u+1:i=u}return r},right:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var u=r+i>>>1;n(t[u],e)>0?i=u:r=u+1}return r}}}function o(n){return n.length}function a(n){for(var t=1;n*t%1;)t*=10;return t}function l(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function c(){this._=Object.create(null)}function f(n){return(n+="")===bo||n[0]===_o?_o+n:n}function s(n){return(n+="")[0]===_o?n.slice(1):n}function h(n){return f(n)in this._}function p(n){return(n=f(n))in this._&&delete this._[n]}function g(){var n=[];for(var t in this._)n.push(s(t));return n}function v(){var n=0;for(var t in this._)++n;return n}function d(){for(var n in this._)return!1;return!0}function y(){this._=Object.create(null)}function m(n){return n}function M(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function x(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e=0,r=wo.length;r>e;++e){var i=wo[e]+t;if(i in n)return i}}function b(){}function _(){}function w(n){function t(){for(var t,r=e,i=-1,u=r.length;++ie;e++)for(var i,u=n[e],o=0,a=u.length;a>o;o++)(i=u[o])&&t(i,o,e);return n}function Z(n){return ko(n,qo),n}function V(n){var t,e;return function(r,i,u){var o,a=n[u].update,l=a.length;for(u!=e&&(e=u,t=0),i>=t&&(t=i+1);!(o=a[t])&&++t0&&(n=n.slice(0,a));var c=To.get(n);return c&&(n=c,l=B),a?t?i:r:t?b:u}function $(n,t){return function(e){var r=ao.event;ao.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{ao.event=r}}}function B(n,t){var e=$(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function W(e){var r=".dragsuppress-"+ ++Do,i="click"+r,u=ao.select(t(e)).on("touchmove"+r,S).on("dragstart"+r,S).on("selectstart"+r,S);if(null==Ro&&(Ro="onselectstart"in e?!1:x(e.style,"userSelect")),Ro){var o=n(e).style,a=o[Ro];o[Ro]="none"}return function(n){if(u.on(r,null),Ro&&(o[Ro]=a),n){var t=function(){u.on(i,null)};u.on(i,function(){S(),t()},!0),setTimeout(t,0)}}}function J(n,e){e.changedTouches&&(e=e.changedTouches[0]);var r=n.ownerSVGElement||n;if(r.createSVGPoint){var i=r.createSVGPoint();if(0>Po){var u=t(n);if(u.scrollX||u.scrollY){r=ao.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();Po=!(o.f||o.e),r.remove()}}return Po?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}function G(){return ao.event.changedTouches[0].identifier}function K(n){return n>0?1:0>n?-1:0}function Q(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function nn(n){return n>1?0:-1>n?Fo:Math.acos(n)}function tn(n){return n>1?Io:-1>n?-Io:Math.asin(n)}function en(n){return((n=Math.exp(n))-1/n)/2}function rn(n){return((n=Math.exp(n))+1/n)/2}function un(n){return((n=Math.exp(2*n))-1)/(n+1)}function on(n){return(n=Math.sin(n/2))*n}function an(){}function ln(n,t,e){return this instanceof ln?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof ln?new ln(n.h,n.s,n.l):_n(""+n,wn,ln):new ln(n,t,e)}function cn(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?u+(o-u)*n/60:180>n?o:240>n?u+(o-u)*(240-n)/60:u}function i(n){return Math.round(255*r(n))}var u,o;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,o=.5>=e?e*(1+t):e+t-e*t,u=2*e-o,new mn(i(n+120),i(n),i(n-120))}function fn(n,t,e){return this instanceof fn?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof fn?new fn(n.h,n.c,n.l):n instanceof hn?gn(n.l,n.a,n.b):gn((n=Sn((n=ao.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new fn(n,t,e)}function sn(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new hn(e,Math.cos(n*=Yo)*t,Math.sin(n)*t)}function hn(n,t,e){return this instanceof hn?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof hn?new hn(n.l,n.a,n.b):n instanceof fn?sn(n.h,n.c,n.l):Sn((n=mn(n)).r,n.g,n.b):new hn(n,t,e)}function pn(n,t,e){var r=(n+16)/116,i=r+t/500,u=r-e/200;return i=vn(i)*na,r=vn(r)*ta,u=vn(u)*ea,new mn(yn(3.2404542*i-1.5371385*r-.4985314*u),yn(-.969266*i+1.8760108*r+.041556*u),yn(.0556434*i-.2040259*r+1.0572252*u))}function gn(n,t,e){return n>0?new fn(Math.atan2(e,t)*Zo,Math.sqrt(t*t+e*e),n):new fn(NaN,NaN,n)}function vn(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function dn(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function yn(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function mn(n,t,e){return this instanceof mn?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof mn?new mn(n.r,n.g,n.b):_n(""+n,mn,cn):new mn(n,t,e)}function Mn(n){return new mn(n>>16,n>>8&255,255&n)}function xn(n){return Mn(n)+""}function bn(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function _n(n,t,e){var r,i,u,o=0,a=0,l=0;if(r=/([a-z]+)\((.*)\)/.exec(n=n.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return t(Nn(i[0]),Nn(i[1]),Nn(i[2]))}return(u=ua.get(n))?t(u.r,u.g,u.b):(null==n||"#"!==n.charAt(0)||isNaN(u=parseInt(n.slice(1),16))||(4===n.length?(o=(3840&u)>>4,o=o>>4|o,a=240&u,a=a>>4|a,l=15&u,l=l<<4|l):7===n.length&&(o=(16711680&u)>>16,a=(65280&u)>>8,l=255&u)),t(o,a,l))}function wn(n,t,e){var r,i,u=Math.min(n/=255,t/=255,e/=255),o=Math.max(n,t,e),a=o-u,l=(o+u)/2;return a?(i=.5>l?a/(o+u):a/(2-o-u),r=n==o?(t-e)/a+(e>t?6:0):t==o?(e-n)/a+2:(n-t)/a+4,r*=60):(r=NaN,i=l>0&&1>l?0:r),new ln(r,i,l)}function Sn(n,t,e){n=kn(n),t=kn(t),e=kn(e);var r=dn((.4124564*n+.3575761*t+.1804375*e)/na),i=dn((.2126729*n+.7151522*t+.072175*e)/ta),u=dn((.0193339*n+.119192*t+.9503041*e)/ea);return hn(116*i-16,500*(r-i),200*(i-u))}function kn(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Nn(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function En(n){return"function"==typeof n?n:function(){return n}}function An(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Cn(t,e,n,r)}}function Cn(n,t,e,r){function i(){var n,t=l.status;if(!t&&Ln(l)||t>=200&&300>t||304===t){try{n=e.call(u,l)}catch(r){return void o.error.call(u,r)}o.load.call(u,n)}else o.error.call(u,l)}var u={},o=ao.dispatch("beforesend","progress","load","error"),a={},l=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(n)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(n){var t=ao.event;ao.event=n;try{o.progress.call(u,l)}finally{ao.event=t}},u.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",u)},u.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",u):t},u.responseType=function(n){return arguments.length?(c=n,u):c},u.response=function(n){return e=n,u},["get","post"].forEach(function(n){u[n]=function(){return u.send.apply(u,[n].concat(co(arguments)))}}),u.send=function(e,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),l.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),l.setRequestHeader)for(var f in a)l.setRequestHeader(f,a[f]);return null!=t&&l.overrideMimeType&&l.overrideMimeType(t),null!=c&&(l.responseType=c),null!=i&&u.on("error",i).on("load",function(n){i(null,n)}),o.beforesend.call(u,l),l.send(null==r?null:r),u},u.abort=function(){return l.abort(),u},ao.rebind(u,o,"on"),null==r?u:u.get(zn(r))}function zn(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function Ln(n){var t=n.responseType;return t&&"text"!==t?n.response:n.responseText}function qn(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var i=e+t,u={c:n,t:i,n:null};return aa?aa.n=u:oa=u,aa=u,la||(ca=clearTimeout(ca),la=1,fa(Tn)),u}function Tn(){var n=Rn(),t=Dn()-n;t>24?(isFinite(t)&&(clearTimeout(ca),ca=setTimeout(Tn,t)),la=0):(la=1,fa(Tn))}function Rn(){for(var n=Date.now(),t=oa;t;)n>=t.t&&t.c(n-t.t)&&(t.c=null),t=t.n;return n}function Dn(){for(var n,t=oa,e=1/0;t;)t.c?(t.t8?function(n){return n/e}:function(n){return n*e},symbol:n}}function jn(n){var t=n.decimal,e=n.thousands,r=n.grouping,i=n.currency,u=r&&e?function(n,t){for(var i=n.length,u=[],o=0,a=r[0],l=0;i>0&&a>0&&(l+a+1>t&&(a=Math.max(1,t-l)),u.push(n.substring(i-=a,i+a)),!((l+=a+1)>t));)a=r[o=(o+1)%r.length];return u.reverse().join(e)}:m;return function(n){var e=ha.exec(n),r=e[1]||" ",o=e[2]||">",a=e[3]||"-",l=e[4]||"",c=e[5],f=+e[6],s=e[7],h=e[8],p=e[9],g=1,v="",d="",y=!1,m=!0;switch(h&&(h=+h.substring(1)),(c||"0"===r&&"="===o)&&(c=r="0",o="="),p){case"n":s=!0,p="g";break;case"%":g=100,d="%",p="f";break;case"p":g=100,d="%",p="r";break;case"b":case"o":case"x":case"X":"#"===l&&(v="0"+p.toLowerCase());case"c":m=!1;case"d":y=!0,h=0;break;case"s":g=-1,p="r"}"$"===l&&(v=i[0],d=i[1]),"r"!=p||h||(p="g"),null!=h&&("g"==p?h=Math.max(1,Math.min(21,h)):"e"!=p&&"f"!=p||(h=Math.max(0,Math.min(20,h)))),p=pa.get(p)||Fn;var M=c&&s;return function(n){var e=d;if(y&&n%1)return"";var i=0>n||0===n&&0>1/n?(n=-n,"-"):"-"===a?"":a;if(0>g){var l=ao.formatPrefix(n,h);n=l.scale(n),e=l.symbol+d}else n*=g;n=p(n,h);var x,b,_=n.lastIndexOf(".");if(0>_){var w=m?n.lastIndexOf("e"):-1;0>w?(x=n,b=""):(x=n.substring(0,w),b=n.substring(w))}else x=n.substring(0,_),b=t+n.substring(_+1);!c&&s&&(x=u(x,1/0));var S=v.length+x.length+b.length+(M?0:i.length),k=f>S?new Array(S=f-S+1).join(r):"";return M&&(x=u(k+x,k.length?f-b.length:1/0)),i+=v,n=x+b,("<"===o?i+n+k:">"===o?k+i+n:"^"===o?k.substring(0,S>>=1)+i+n+k.substring(S):i+(M?n:k+n))+e}}}function Fn(n){return n+""}function Hn(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function On(n,t,e){function r(t){var e=n(t),r=u(e,1);return r-t>t-e?e:r}function i(e){return t(e=n(new va(e-1)),1),e}function u(n,e){return t(n=new va(+n),e),n}function o(n,r,u){var o=i(n),a=[];if(u>1)for(;r>o;)e(o)%u||a.push(new Date(+o)),t(o,1);else for(;r>o;)a.push(new Date(+o)),t(o,1);return a}function a(n,t,e){try{va=Hn;var r=new Hn;return r._=n,o(r,t,e)}finally{va=Date}}n.floor=n,n.round=r,n.ceil=i,n.offset=u,n.range=o;var l=n.utc=In(n);return l.floor=l,l.round=In(r),l.ceil=In(i),l.offset=In(u),l.range=a,n}function In(n){return function(t,e){try{va=Hn;var r=new Hn;return r._=t,n(r,e)._}finally{va=Date}}}function Yn(n){function t(n){function t(t){for(var e,i,u,o=[],a=-1,l=0;++aa;){if(r>=c)return-1;if(i=t.charCodeAt(a++),37===i){if(o=t.charAt(a++),u=C[o in ya?t.charAt(a++):o],!u||(r=u(n,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){_.lastIndex=0;var r=_.exec(t.slice(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){x.lastIndex=0;var r=x.exec(t.slice(e));return r?(n.w=b.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){N.lastIndex=0;var r=N.exec(t.slice(e));return r?(n.m=E.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){S.lastIndex=0;var r=S.exec(t.slice(e));return r?(n.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,A.c.toString(),t,r)}function l(n,t,r){return e(n,A.x.toString(),t,r)}function c(n,t,r){return e(n,A.X.toString(),t,r)}function f(n,t,e){var r=M.get(t.slice(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var s=n.dateTime,h=n.date,p=n.time,g=n.periods,v=n.days,d=n.shortDays,y=n.months,m=n.shortMonths;t.utc=function(n){function e(n){try{va=Hn;var t=new va;return t._=n,r(t)}finally{va=Date}}var r=t(n);return e.parse=function(n){try{va=Hn;var t=r.parse(n);return t&&t._}finally{va=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ct;var M=ao.map(),x=Vn(v),b=Xn(v),_=Vn(d),w=Xn(d),S=Vn(y),k=Xn(y),N=Vn(m),E=Xn(m);g.forEach(function(n,t){M.set(n.toLowerCase(),t)});var A={a:function(n){return d[n.getDay()]},A:function(n){return v[n.getDay()]},b:function(n){return m[n.getMonth()]},B:function(n){return y[n.getMonth()]},c:t(s),d:function(n,t){return Zn(n.getDate(),t,2)},e:function(n,t){return Zn(n.getDate(),t,2)},H:function(n,t){return Zn(n.getHours(),t,2)},I:function(n,t){return Zn(n.getHours()%12||12,t,2)},j:function(n,t){return Zn(1+ga.dayOfYear(n),t,3)},L:function(n,t){return Zn(n.getMilliseconds(),t,3)},m:function(n,t){return Zn(n.getMonth()+1,t,2)},M:function(n,t){return Zn(n.getMinutes(),t,2)},p:function(n){return g[+(n.getHours()>=12)]},S:function(n,t){return Zn(n.getSeconds(),t,2)},U:function(n,t){return Zn(ga.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Zn(ga.mondayOfYear(n),t,2)},x:t(h),X:t(p),y:function(n,t){return Zn(n.getFullYear()%100,t,2)},Y:function(n,t){return Zn(n.getFullYear()%1e4,t,4)},Z:at,"%":function(){return"%"}},C={a:r,A:i,b:u,B:o,c:a,d:tt,e:tt,H:rt,I:rt,j:et,L:ot,m:nt,M:it,p:f,S:ut,U:Bn,w:$n,W:Wn,x:l,X:c,y:Gn,Y:Jn,Z:Kn,"%":lt};return t}function Zn(n,t,e){var r=0>n?"-":"",i=(r?-n:n)+"",u=i.length;return r+(e>u?new Array(e-u+1).join(t)+i:i)}function Vn(n){return new RegExp("^(?:"+n.map(ao.requote).join("|")+")","i")}function Xn(n){for(var t=new c,e=-1,r=n.length;++e68?1900:2e3)}function nt(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function tt(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function et(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function rt(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function it(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function ut(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ot(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function at(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=xo(t)/60|0,i=xo(t)%60;return e+Zn(r,"0",2)+Zn(i,"0",2)}function lt(n,t,e){Ma.lastIndex=0;var r=Ma.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function ct(n){for(var t=n.length,e=-1;++e=0?1:-1,a=o*e,l=Math.cos(t),c=Math.sin(t),f=u*c,s=i*l+f*Math.cos(a),h=f*o*Math.sin(a);ka.add(Math.atan2(h,s)),r=n,i=l,u=c}var t,e,r,i,u;Na.point=function(o,a){Na.point=n,r=(t=o)*Yo,i=Math.cos(a=(e=a)*Yo/2+Fo/4),u=Math.sin(a)},Na.lineEnd=function(){n(t,e)}}function dt(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function yt(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function mt(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function Mt(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function xt(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function bt(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function _t(n){return[Math.atan2(n[1],n[0]),tn(n[2])]}function wt(n,t){return xo(n[0]-t[0])a;++a)i.point((e=n[a])[0],e[1]);return void i.lineEnd()}var l=new Tt(e,n,null,!0),c=new Tt(e,null,l,!1);l.o=c,u.push(l),o.push(c),l=new Tt(r,n,null,!1),c=new Tt(r,null,l,!0),l.o=c,u.push(l),o.push(c)}}),o.sort(t),qt(u),qt(o),u.length){for(var a=0,l=e,c=o.length;c>a;++a)o[a].e=l=!l;for(var f,s,h=u[0];;){for(var p=h,g=!0;p.v;)if((p=p.n)===h)return;f=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(g)for(var a=0,c=f.length;c>a;++a)i.point((s=f[a])[0],s[1]);else r(p.x,p.n.x,1,i);p=p.n}else{if(g){f=p.p.z;for(var a=f.length-1;a>=0;--a)i.point((s=f[a])[0],s[1])}else r(p.x,p.p.x,-1,i);p=p.p}p=p.o,f=p.z,g=!g}while(!p.v);i.lineEnd()}}}function qt(n){if(t=n.length){for(var t,e,r=0,i=n[0];++r0){for(b||(u.polygonStart(),b=!0),u.lineStart();++o1&&2&t&&e.push(e.pop().concat(e.shift())),p.push(e.filter(Dt))}var p,g,v,d=t(u),y=i.invert(r[0],r[1]),m={point:o,lineStart:l,lineEnd:c,polygonStart:function(){m.point=f,m.lineStart=s,m.lineEnd=h,p=[],g=[]},polygonEnd:function(){m.point=o,m.lineStart=l,m.lineEnd=c,p=ao.merge(p);var n=Ot(y,g);p.length?(b||(u.polygonStart(),b=!0),Lt(p,Ut,n,e,u)):n&&(b||(u.polygonStart(),b=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),b&&(u.polygonEnd(),b=!1),p=g=null},sphere:function(){u.polygonStart(),u.lineStart(),e(null,null,1,u),u.lineEnd(),u.polygonEnd()}},M=Pt(),x=t(M),b=!1;return m}}function Dt(n){return n.length>1}function Pt(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:b,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Ut(n,t){return((n=n.x)[0]<0?n[1]-Io-Uo:Io-n[1])-((t=t.x)[0]<0?t[1]-Io-Uo:Io-t[1])}function jt(n){var t,e=NaN,r=NaN,i=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(u,o){var a=u>0?Fo:-Fo,l=xo(u-e);xo(l-Fo)0?Io:-Io),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(u,r),t=0):i!==a&&l>=Fo&&(xo(e-i)Uo?Math.atan((Math.sin(t)*(u=Math.cos(r))*Math.sin(e)-Math.sin(r)*(i=Math.cos(t))*Math.sin(n))/(i*u*o)):(t+r)/2}function Ht(n,t,e,r){var i;if(null==n)i=e*Io,r.point(-Fo,i),r.point(0,i),r.point(Fo,i),r.point(Fo,0),r.point(Fo,-i),r.point(0,-i),r.point(-Fo,-i),r.point(-Fo,0),r.point(-Fo,i);else if(xo(n[0]-t[0])>Uo){var u=n[0]a;++a){var c=t[a],f=c.length;if(f)for(var s=c[0],h=s[0],p=s[1]/2+Fo/4,g=Math.sin(p),v=Math.cos(p),d=1;;){d===f&&(d=0),n=c[d];var y=n[0],m=n[1]/2+Fo/4,M=Math.sin(m),x=Math.cos(m),b=y-h,_=b>=0?1:-1,w=_*b,S=w>Fo,k=g*M;if(ka.add(Math.atan2(k*_*Math.sin(w),v*x+k*Math.cos(w))),u+=S?b+_*Ho:b,S^h>=e^y>=e){var N=mt(dt(s),dt(n));bt(N);var E=mt(i,N);bt(E);var A=(S^b>=0?-1:1)*tn(E[2]);(r>A||r===A&&(N[0]||N[1]))&&(o+=S^b>=0?1:-1)}if(!d++)break;h=y,g=M,v=x,s=n}}return(-Uo>u||Uo>u&&-Uo>ka)^1&o}function It(n){function t(n,t){return Math.cos(n)*Math.cos(t)>u}function e(n){var e,u,l,c,f;return{lineStart:function(){c=l=!1,f=1},point:function(s,h){var p,g=[s,h],v=t(s,h),d=o?v?0:i(s,h):v?i(s+(0>s?Fo:-Fo),h):0;if(!e&&(c=l=v)&&n.lineStart(),v!==l&&(p=r(e,g),(wt(e,p)||wt(g,p))&&(g[0]+=Uo,g[1]+=Uo,v=t(g[0],g[1]))),v!==l)f=0,v?(n.lineStart(),p=r(g,e),n.point(p[0],p[1])):(p=r(e,g),n.point(p[0],p[1]),n.lineEnd()),e=p;else if(a&&e&&o^v){var y;d&u||!(y=r(g,e,!0))||(f=0,o?(n.lineStart(),n.point(y[0][0],y[0][1]),n.point(y[1][0],y[1][1]),n.lineEnd()):(n.point(y[1][0],y[1][1]),n.lineEnd(),n.lineStart(),n.point(y[0][0],y[0][1])))}!v||e&&wt(e,g)||n.point(g[0],g[1]),e=g,l=v,u=d},lineEnd:function(){l&&n.lineEnd(),e=null},clean:function(){return f|(c&&l)<<1}}}function r(n,t,e){var r=dt(n),i=dt(t),o=[1,0,0],a=mt(r,i),l=yt(a,a),c=a[0],f=l-c*c;if(!f)return!e&&n;var s=u*l/f,h=-u*c/f,p=mt(o,a),g=xt(o,s),v=xt(a,h);Mt(g,v);var d=p,y=yt(g,d),m=yt(d,d),M=y*y-m*(yt(g,g)-1);if(!(0>M)){var x=Math.sqrt(M),b=xt(d,(-y-x)/m);if(Mt(b,g),b=_t(b),!e)return b;var _,w=n[0],S=t[0],k=n[1],N=t[1];w>S&&(_=w,w=S,S=_);var E=S-w,A=xo(E-Fo)E;if(!A&&k>N&&(_=k,k=N,N=_),C?A?k+N>0^b[1]<(xo(b[0]-w)Fo^(w<=b[0]&&b[0]<=S)){var z=xt(d,(-y+x)/m);return Mt(z,g),[b,_t(z)]}}}function i(t,e){var r=o?n:Fo-n,i=0;return-r>t?i|=1:t>r&&(i|=2),-r>e?i|=4:e>r&&(i|=8),i}var u=Math.cos(n),o=u>0,a=xo(u)>Uo,l=ve(n,6*Yo);return Rt(t,e,l,o?[0,-n]:[-Fo,n-Fo])}function Yt(n,t,e,r){return function(i){var u,o=i.a,a=i.b,l=o.x,c=o.y,f=a.x,s=a.y,h=0,p=1,g=f-l,v=s-c;if(u=n-l,g||!(u>0)){if(u/=g,0>g){if(h>u)return;p>u&&(p=u)}else if(g>0){if(u>p)return;u>h&&(h=u)}if(u=e-l,g||!(0>u)){if(u/=g,0>g){if(u>p)return;u>h&&(h=u)}else if(g>0){if(h>u)return;p>u&&(p=u)}if(u=t-c,v||!(u>0)){if(u/=v,0>v){if(h>u)return;p>u&&(p=u)}else if(v>0){if(u>p)return;u>h&&(h=u)}if(u=r-c,v||!(0>u)){if(u/=v,0>v){if(u>p)return;u>h&&(h=u)}else if(v>0){if(h>u)return;p>u&&(p=u)}return h>0&&(i.a={x:l+h*g,y:c+h*v}),1>p&&(i.b={x:l+p*g,y:c+p*v}),i}}}}}}function Zt(n,t,e,r){function i(r,i){return xo(r[0]-n)0?0:3:xo(r[0]-e)0?2:1:xo(r[1]-t)0?1:0:i>0?3:2}function u(n,t){return o(n.x,t.x)}function o(n,t){var e=i(n,1),r=i(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function l(n){for(var t=0,e=d.length,r=n[1],i=0;e>i;++i)for(var u,o=1,a=d[i],l=a.length,c=a[0];l>o;++o)u=a[o],c[1]<=r?u[1]>r&&Q(c,u,n)>0&&++t:u[1]<=r&&Q(c,u,n)<0&&--t,c=u;return 0!==t}function c(u,a,l,c){var f=0,s=0;if(null==u||(f=i(u,l))!==(s=i(a,l))||o(u,a)<0^l>0){do c.point(0===f||3===f?n:e,f>1?r:t);while((f=(f+l+4)%4)!==s)}else c.point(a[0],a[1])}function f(i,u){return i>=n&&e>=i&&u>=t&&r>=u}function s(n,t){f(n,t)&&a.point(n,t)}function h(){C.point=g,d&&d.push(y=[]),S=!0,w=!1,b=_=NaN}function p(){v&&(g(m,M),x&&w&&E.rejoin(),v.push(E.buffer())),C.point=s,w&&a.lineEnd()}function g(n,t){n=Math.max(-Ha,Math.min(Ha,n)),t=Math.max(-Ha,Math.min(Ha,t));var e=f(n,t);if(d&&y.push([n,t]),S)m=n,M=t,x=e,S=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&w)a.point(n,t);else{var r={a:{x:b,y:_},b:{x:n,y:t}};A(r)?(w||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),k=!1):e&&(a.lineStart(),a.point(n,t),k=!1)}b=n,_=t,w=e}var v,d,y,m,M,x,b,_,w,S,k,N=a,E=Pt(),A=Yt(n,t,e,r),C={point:s,lineStart:h,lineEnd:p,polygonStart:function(){a=E,v=[],d=[],k=!0},polygonEnd:function(){a=N,v=ao.merge(v);var t=l([n,r]),e=k&&t,i=v.length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),c(null,null,1,a),a.lineEnd()),i&&Lt(v,u,t,c,a),a.polygonEnd()),v=d=y=null}};return C}}function Vt(n){var t=0,e=Fo/3,r=ae(n),i=r(t,e);return i.parallels=function(n){return arguments.length?r(t=n[0]*Fo/180,e=n[1]*Fo/180):[t/Fo*180,e/Fo*180]},i}function Xt(n,t){function e(n,t){var e=Math.sqrt(u-2*i*Math.sin(t))/i;return[e*Math.sin(n*=i),o-e*Math.cos(n)]}var r=Math.sin(n),i=(r+Math.sin(t))/2,u=1+r*(2*i-r),o=Math.sqrt(u)/i;return e.invert=function(n,t){var e=o-t;return[Math.atan2(n,e)/i,tn((u-(n*n+e*e)*i*i)/(2*i))]},e}function $t(){function n(n,t){Ia+=i*n-r*t,r=n,i=t}var t,e,r,i;$a.point=function(u,o){$a.point=n,t=r=u,e=i=o},$a.lineEnd=function(){n(t,e)}}function Bt(n,t){Ya>n&&(Ya=n),n>Va&&(Va=n),Za>t&&(Za=t),t>Xa&&(Xa=t)}function Wt(){function n(n,t){o.push("M",n,",",t,u)}function t(n,t){o.push("M",n,",",t),a.point=e}function e(n,t){o.push("L",n,",",t)}function r(){a.point=n}function i(){o.push("Z")}var u=Jt(4.5),o=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return u=Jt(n),a},result:function(){if(o.length){var n=o.join("");return o=[],n}}};return a}function Jt(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Gt(n,t){Ca+=n,za+=t,++La}function Kt(){function n(n,r){var i=n-t,u=r-e,o=Math.sqrt(i*i+u*u);qa+=o*(t+n)/2,Ta+=o*(e+r)/2,Ra+=o,Gt(t=n,e=r)}var t,e;Wa.point=function(r,i){Wa.point=n,Gt(t=r,e=i)}}function Qt(){Wa.point=Gt}function ne(){function n(n,t){var e=n-r,u=t-i,o=Math.sqrt(e*e+u*u);qa+=o*(r+n)/2,Ta+=o*(i+t)/2,Ra+=o,o=i*n-r*t,Da+=o*(r+n),Pa+=o*(i+t),Ua+=3*o,Gt(r=n,i=t)}var t,e,r,i;Wa.point=function(u,o){Wa.point=n,Gt(t=r=u,e=i=o)},Wa.lineEnd=function(){n(t,e)}}function te(n){function t(t,e){n.moveTo(t+o,e),n.arc(t,e,o,0,Ho)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function i(){a.point=t}function u(){n.closePath()}var o=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:i,polygonStart:function(){a.lineEnd=u},polygonEnd:function(){a.lineEnd=i,a.point=t},pointRadius:function(n){return o=n,a},result:b};return a}function ee(n){function t(n){return(a?r:e)(n)}function e(t){return ue(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){M=NaN,S.point=u,t.lineStart()}function u(e,r){var u=dt([e,r]),o=n(e,r);i(M,x,m,b,_,w,M=o[0],x=o[1],m=e,b=u[0],_=u[1],w=u[2],a,t),t.point(M,x)}function o(){S.point=e,t.lineEnd()}function l(){ +r(),S.point=c,S.lineEnd=f}function c(n,t){u(s=n,h=t),p=M,g=x,v=b,d=_,y=w,S.point=u}function f(){i(M,x,m,b,_,w,p,g,s,v,d,y,a,t),S.lineEnd=o,o()}var s,h,p,g,v,d,y,m,M,x,b,_,w,S={point:e,lineStart:r,lineEnd:o,polygonStart:function(){t.polygonStart(),S.lineStart=l},polygonEnd:function(){t.polygonEnd(),S.lineStart=r}};return S}function i(t,e,r,a,l,c,f,s,h,p,g,v,d,y){var m=f-t,M=s-e,x=m*m+M*M;if(x>4*u&&d--){var b=a+p,_=l+g,w=c+v,S=Math.sqrt(b*b+_*_+w*w),k=Math.asin(w/=S),N=xo(xo(w)-1)u||xo((m*z+M*L)/x-.5)>.3||o>a*p+l*g+c*v)&&(i(t,e,r,a,l,c,A,C,N,b/=S,_/=S,w,d,y),y.point(A,C),i(A,C,N,b,_,w,f,s,h,p,g,v,d,y))}}var u=.5,o=Math.cos(30*Yo),a=16;return t.precision=function(n){return arguments.length?(a=(u=n*n)>0&&16,t):Math.sqrt(u)},t}function re(n){var t=ee(function(t,e){return n([t*Zo,e*Zo])});return function(n){return le(t(n))}}function ie(n){this.stream=n}function ue(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function oe(n){return ae(function(){return n})()}function ae(n){function t(n){return n=a(n[0]*Yo,n[1]*Yo),[n[0]*h+l,c-n[1]*h]}function e(n){return n=a.invert((n[0]-l)/h,(c-n[1])/h),n&&[n[0]*Zo,n[1]*Zo]}function r(){a=Ct(o=se(y,M,x),u);var n=u(v,d);return l=p-n[0]*h,c=g+n[1]*h,i()}function i(){return f&&(f.valid=!1,f=null),t}var u,o,a,l,c,f,s=ee(function(n,t){return n=u(n,t),[n[0]*h+l,c-n[1]*h]}),h=150,p=480,g=250,v=0,d=0,y=0,M=0,x=0,b=Fa,_=m,w=null,S=null;return t.stream=function(n){return f&&(f.valid=!1),f=le(b(o,s(_(n)))),f.valid=!0,f},t.clipAngle=function(n){return arguments.length?(b=null==n?(w=n,Fa):It((w=+n)*Yo),i()):w},t.clipExtent=function(n){return arguments.length?(S=n,_=n?Zt(n[0][0],n[0][1],n[1][0],n[1][1]):m,i()):S},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(p=+n[0],g=+n[1],r()):[p,g]},t.center=function(n){return arguments.length?(v=n[0]%360*Yo,d=n[1]%360*Yo,r()):[v*Zo,d*Zo]},t.rotate=function(n){return arguments.length?(y=n[0]%360*Yo,M=n[1]%360*Yo,x=n.length>2?n[2]%360*Yo:0,r()):[y*Zo,M*Zo,x*Zo]},ao.rebind(t,s,"precision"),function(){return u=n.apply(this,arguments),t.invert=u.invert&&e,r()}}function le(n){return ue(n,function(t,e){n.point(t*Yo,e*Yo)})}function ce(n,t){return[n,t]}function fe(n,t){return[n>Fo?n-Ho:-Fo>n?n+Ho:n,t]}function se(n,t,e){return n?t||e?Ct(pe(n),ge(t,e)):pe(n):t||e?ge(t,e):fe}function he(n){return function(t,e){return t+=n,[t>Fo?t-Ho:-Fo>t?t+Ho:t,e]}}function pe(n){var t=he(n);return t.invert=he(-n),t}function ge(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,l=Math.sin(n)*e,c=Math.sin(t),f=c*r+a*i;return[Math.atan2(l*u-f*o,a*r-c*i),tn(f*u+l*o)]}var r=Math.cos(n),i=Math.sin(n),u=Math.cos(t),o=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,l=Math.sin(n)*e,c=Math.sin(t),f=c*u-l*o;return[Math.atan2(l*u+c*o,a*r+f*i),tn(f*r-a*i)]},e}function ve(n,t){var e=Math.cos(n),r=Math.sin(n);return function(i,u,o,a){var l=o*t;null!=i?(i=de(e,i),u=de(e,u),(o>0?u>i:i>u)&&(i+=o*Ho)):(i=n+o*Ho,u=n-.5*l);for(var c,f=i;o>0?f>u:u>f;f-=l)a.point((c=_t([e,-r*Math.cos(f),-r*Math.sin(f)]))[0],c[1])}}function de(n,t){var e=dt(t);e[0]-=n,bt(e);var r=nn(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Uo)%(2*Math.PI)}function ye(n,t,e){var r=ao.range(n,t-Uo,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function me(n,t,e){var r=ao.range(n,t-Uo,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function Me(n){return n.source}function xe(n){return n.target}function be(n,t,e,r){var i=Math.cos(t),u=Math.sin(t),o=Math.cos(r),a=Math.sin(r),l=i*Math.cos(n),c=i*Math.sin(n),f=o*Math.cos(e),s=o*Math.sin(e),h=2*Math.asin(Math.sqrt(on(r-t)+i*o*on(e-n))),p=1/Math.sin(h),g=h?function(n){var t=Math.sin(n*=h)*p,e=Math.sin(h-n)*p,r=e*l+t*f,i=e*c+t*s,o=e*u+t*a;return[Math.atan2(i,r)*Zo,Math.atan2(o,Math.sqrt(r*r+i*i))*Zo]}:function(){return[n*Zo,t*Zo]};return g.distance=h,g}function _e(){function n(n,i){var u=Math.sin(i*=Yo),o=Math.cos(i),a=xo((n*=Yo)-t),l=Math.cos(a);Ja+=Math.atan2(Math.sqrt((a=o*Math.sin(a))*a+(a=r*u-e*o*l)*a),e*u+r*o*l),t=n,e=u,r=o}var t,e,r;Ga.point=function(i,u){t=i*Yo,e=Math.sin(u*=Yo),r=Math.cos(u),Ga.point=n},Ga.lineEnd=function(){Ga.point=Ga.lineEnd=b}}function we(n,t){function e(t,e){var r=Math.cos(t),i=Math.cos(e),u=n(r*i);return[u*i*Math.sin(t),u*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),i=t(r),u=Math.sin(i),o=Math.cos(i);return[Math.atan2(n*u,r*o),Math.asin(r&&e*u/r)]},e}function Se(n,t){function e(n,t){o>0?-Io+Uo>t&&(t=-Io+Uo):t>Io-Uo&&(t=Io-Uo);var e=o/Math.pow(i(t),u);return[e*Math.sin(u*n),o-e*Math.cos(u*n)]}var r=Math.cos(n),i=function(n){return Math.tan(Fo/4+n/2)},u=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(i(t)/i(n)),o=r*Math.pow(i(n),u)/u;return u?(e.invert=function(n,t){var e=o-t,r=K(u)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/u,2*Math.atan(Math.pow(o/r,1/u))-Io]},e):Ne}function ke(n,t){function e(n,t){var e=u-t;return[e*Math.sin(i*n),u-e*Math.cos(i*n)]}var r=Math.cos(n),i=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),u=r/i+n;return xo(i)i;i++){for(;r>1&&Q(n[e[r-2]],n[e[r-1]],n[i])<=0;)--r;e[r++]=i}return e.slice(0,r)}function qe(n,t){return n[0]-t[0]||n[1]-t[1]}function Te(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Re(n,t,e,r){var i=n[0],u=e[0],o=t[0]-i,a=r[0]-u,l=n[1],c=e[1],f=t[1]-l,s=r[1]-c,h=(a*(l-c)-s*(i-u))/(s*o-a*f);return[i+h*o,l+h*f]}function De(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function Pe(){rr(this),this.edge=this.site=this.circle=null}function Ue(n){var t=cl.pop()||new Pe;return t.site=n,t}function je(n){Be(n),ol.remove(n),cl.push(n),rr(n)}function Fe(n){var t=n.circle,e=t.x,r=t.cy,i={x:e,y:r},u=n.P,o=n.N,a=[n];je(n);for(var l=u;l.circle&&xo(e-l.circle.x)f;++f)c=a[f],l=a[f-1],nr(c.edge,l.site,c.site,i);l=a[0],c=a[s-1],c.edge=Ke(l.site,c.site,null,i),$e(l),$e(c)}function He(n){for(var t,e,r,i,u=n.x,o=n.y,a=ol._;a;)if(r=Oe(a,o)-u,r>Uo)a=a.L;else{if(i=u-Ie(a,o),!(i>Uo)){r>-Uo?(t=a.P,e=a):i>-Uo?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var l=Ue(n);if(ol.insert(t,l),t||e){if(t===e)return Be(t),e=Ue(t.site),ol.insert(l,e),l.edge=e.edge=Ke(t.site,l.site),$e(t),void $e(e);if(!e)return void(l.edge=Ke(t.site,l.site));Be(t),Be(e);var c=t.site,f=c.x,s=c.y,h=n.x-f,p=n.y-s,g=e.site,v=g.x-f,d=g.y-s,y=2*(h*d-p*v),m=h*h+p*p,M=v*v+d*d,x={x:(d*m-p*M)/y+f,y:(h*M-v*m)/y+s};nr(e.edge,c,g,x),l.edge=Ke(c,n,null,x),e.edge=Ke(n,g,null,x),$e(t),$e(e)}}function Oe(n,t){var e=n.site,r=e.x,i=e.y,u=i-t;if(!u)return r;var o=n.P;if(!o)return-(1/0);e=o.site;var a=e.x,l=e.y,c=l-t;if(!c)return a;var f=a-r,s=1/u-1/c,h=f/c;return s?(-h+Math.sqrt(h*h-2*s*(f*f/(-2*c)-l+c/2+i-u/2)))/s+r:(r+a)/2}function Ie(n,t){var e=n.N;if(e)return Oe(e,t);var r=n.site;return r.y===t?r.x:1/0}function Ye(n){this.site=n,this.edges=[]}function Ze(n){for(var t,e,r,i,u,o,a,l,c,f,s=n[0][0],h=n[1][0],p=n[0][1],g=n[1][1],v=ul,d=v.length;d--;)if(u=v[d],u&&u.prepare())for(a=u.edges,l=a.length,o=0;l>o;)f=a[o].end(),r=f.x,i=f.y,c=a[++o%l].start(),t=c.x,e=c.y,(xo(r-t)>Uo||xo(i-e)>Uo)&&(a.splice(o,0,new tr(Qe(u.site,f,xo(r-s)Uo?{x:s,y:xo(t-s)Uo?{x:xo(e-g)Uo?{x:h,y:xo(t-h)Uo?{x:xo(e-p)=-jo)){var p=l*l+c*c,g=f*f+s*s,v=(s*p-c*g)/h,d=(l*g-f*p)/h,s=d+a,y=fl.pop()||new Xe;y.arc=n,y.site=i,y.x=v+o,y.y=s+Math.sqrt(v*v+d*d),y.cy=s,n.circle=y;for(var m=null,M=ll._;M;)if(y.yd||d>=a)return;if(h>g){if(u){if(u.y>=c)return}else u={x:d,y:l};e={x:d,y:c}}else{if(u){if(u.yr||r>1)if(h>g){if(u){if(u.y>=c)return}else u={x:(l-i)/r,y:l};e={x:(c-i)/r,y:c}}else{if(u){if(u.yp){if(u){if(u.x>=a)return}else u={x:o,y:r*o+i};e={x:a,y:r*a+i}}else{if(u){if(u.xu||s>o||r>h||i>p)){if(g=n.point){var g,v=t-n.x,d=e-n.y,y=v*v+d*d;if(l>y){var m=Math.sqrt(l=y);r=t-m,i=e-m,u=t+m,o=e+m,a=g}}for(var M=n.nodes,x=.5*(f+h),b=.5*(s+p),_=t>=x,w=e>=b,S=w<<1|_,k=S+4;k>S;++S)if(n=M[3&S])switch(3&S){case 0:c(n,f,s,x,b);break;case 1:c(n,x,s,h,b);break;case 2:c(n,f,b,x,p);break;case 3:c(n,x,b,h,p)}}}(n,r,i,u,o),a}function vr(n,t){n=ao.rgb(n),t=ao.rgb(t);var e=n.r,r=n.g,i=n.b,u=t.r-e,o=t.g-r,a=t.b-i;return function(n){return"#"+bn(Math.round(e+u*n))+bn(Math.round(r+o*n))+bn(Math.round(i+a*n))}}function dr(n,t){var e,r={},i={};for(e in n)e in t?r[e]=Mr(n[e],t[e]):i[e]=n[e];for(e in t)e in n||(i[e]=t[e]);return function(n){for(e in r)i[e]=r[e](n);return i}}function yr(n,t){return n=+n,t=+t,function(e){return n*(1-e)+t*e}}function mr(n,t){var e,r,i,u=hl.lastIndex=pl.lastIndex=0,o=-1,a=[],l=[];for(n+="",t+="";(e=hl.exec(n))&&(r=pl.exec(t));)(i=r.index)>u&&(i=t.slice(u,i),a[o]?a[o]+=i:a[++o]=i),(e=e[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,l.push({i:o,x:yr(e,r)})),u=pl.lastIndex;return ur;++r)a[(e=l[r]).i]=e.x(n);return a.join("")})}function Mr(n,t){for(var e,r=ao.interpolators.length;--r>=0&&!(e=ao.interpolators[r](n,t)););return e}function xr(n,t){var e,r=[],i=[],u=n.length,o=t.length,a=Math.min(n.length,t.length);for(e=0;a>e;++e)r.push(Mr(n[e],t[e]));for(;u>e;++e)i[e]=n[e];for(;o>e;++e)i[e]=t[e];return function(n){for(e=0;a>e;++e)i[e]=r[e](n);return i}}function br(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function _r(n){return function(t){return 1-n(1-t)}}function wr(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function Sr(n){return n*n}function kr(n){return n*n*n}function Nr(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function Er(n){return function(t){return Math.pow(t,n)}}function Ar(n){return 1-Math.cos(n*Io)}function Cr(n){return Math.pow(2,10*(n-1))}function zr(n){return 1-Math.sqrt(1-n*n)}function Lr(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/Ho*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*Ho/t)}}function qr(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Tr(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Rr(n,t){n=ao.hcl(n),t=ao.hcl(t);var e=n.h,r=n.c,i=n.l,u=t.h-e,o=t.c-r,a=t.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?t.c:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return sn(e+u*n,r+o*n,i+a*n)+""}}function Dr(n,t){n=ao.hsl(n),t=ao.hsl(t);var e=n.h,r=n.s,i=n.l,u=t.h-e,o=t.s-r,a=t.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?t.s:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return cn(e+u*n,r+o*n,i+a*n)+""}}function Pr(n,t){n=ao.lab(n),t=ao.lab(t);var e=n.l,r=n.a,i=n.b,u=t.l-e,o=t.a-r,a=t.b-i;return function(n){return pn(e+u*n,r+o*n,i+a*n)+""}}function Ur(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function jr(n){var t=[n.a,n.b],e=[n.c,n.d],r=Hr(t),i=Fr(t,e),u=Hr(Or(e,t,-i))||0;t[0]*e[1]180?t+=360:t-n>180&&(n+=360),r.push({i:e.push(Ir(e)+"rotate(",null,")")-2,x:yr(n,t)})):t&&e.push(Ir(e)+"rotate("+t+")")}function Vr(n,t,e,r){n!==t?r.push({i:e.push(Ir(e)+"skewX(",null,")")-2,x:yr(n,t)}):t&&e.push(Ir(e)+"skewX("+t+")")}function Xr(n,t,e,r){if(n[0]!==t[0]||n[1]!==t[1]){var i=e.push(Ir(e)+"scale(",null,",",null,")");r.push({i:i-4,x:yr(n[0],t[0])},{i:i-2,x:yr(n[1],t[1])})}else 1===t[0]&&1===t[1]||e.push(Ir(e)+"scale("+t+")")}function $r(n,t){var e=[],r=[];return n=ao.transform(n),t=ao.transform(t),Yr(n.translate,t.translate,e,r),Zr(n.rotate,t.rotate,e,r),Vr(n.skew,t.skew,e,r),Xr(n.scale,t.scale,e,r),n=t=null,function(n){for(var t,i=-1,u=r.length;++i=0;)e.push(i[r])}function oi(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(u=n.children)&&(i=u.length))for(var i,u,o=-1;++oe;++e)(t=n[e][1])>i&&(r=e,i=t);return r}function yi(n){return n.reduce(mi,0)}function mi(n,t){return n+t[1]}function Mi(n,t){return xi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function xi(n,t){for(var e=-1,r=+n[0],i=(n[1]-r)/t,u=[];++e<=t;)u[e]=i*e+r;return u}function bi(n){return[ao.min(n),ao.max(n)]}function _i(n,t){return n.value-t.value}function wi(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function Si(n,t){n._pack_next=t,t._pack_prev=n}function ki(n,t){var e=t.x-n.x,r=t.y-n.y,i=n.r+t.r;return.999*i*i>e*e+r*r}function Ni(n){function t(n){f=Math.min(n.x-n.r,f),s=Math.max(n.x+n.r,s),h=Math.min(n.y-n.r,h),p=Math.max(n.y+n.r,p)}if((e=n.children)&&(c=e.length)){var e,r,i,u,o,a,l,c,f=1/0,s=-(1/0),h=1/0,p=-(1/0);if(e.forEach(Ei),r=e[0],r.x=-r.r,r.y=0,t(r),c>1&&(i=e[1],i.x=i.r,i.y=0,t(i),c>2))for(u=e[2],zi(r,i,u),t(u),wi(r,u),r._pack_prev=u,wi(u,i),i=r._pack_next,o=3;c>o;o++){zi(r,i,u=e[o]);var g=0,v=1,d=1;for(a=i._pack_next;a!==i;a=a._pack_next,v++)if(ki(a,u)){g=1;break}if(1==g)for(l=r._pack_prev;l!==a._pack_prev&&!ki(l,u);l=l._pack_prev,d++);g?(d>v||v==d&&i.ro;o++)u=e[o],u.x-=y,u.y-=m,M=Math.max(M,u.r+Math.sqrt(u.x*u.x+u.y*u.y));n.r=M,e.forEach(Ai)}}function Ei(n){n._pack_next=n._pack_prev=n}function Ai(n){delete n._pack_next,delete n._pack_prev}function Ci(n,t,e,r){var i=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,i)for(var u=-1,o=i.length;++u=0;)t=i[u],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function Pi(n,t,e){return n.a.parent===t.parent?n.a:e}function Ui(n){return 1+ao.max(n,function(n){return n.y})}function ji(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Fi(n){var t=n.children;return t&&t.length?Fi(t[0]):n}function Hi(n){var t,e=n.children;return e&&(t=e.length)?Hi(e[t-1]):n}function Oi(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Ii(n,t){var e=n.x+t[3],r=n.y+t[0],i=n.dx-t[1]-t[3],u=n.dy-t[0]-t[2];return 0>i&&(e+=i/2,i=0),0>u&&(r+=u/2,u=0),{x:e,y:r,dx:i,dy:u}}function Yi(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function Zi(n){return n.rangeExtent?n.rangeExtent():Yi(n.range())}function Vi(n,t,e,r){var i=e(n[0],n[1]),u=r(t[0],t[1]);return function(n){return u(i(n))}}function Xi(n,t){var e,r=0,i=n.length-1,u=n[r],o=n[i];return u>o&&(e=r,r=i,i=e,e=u,u=o,o=e),n[r]=t.floor(u),n[i]=t.ceil(o),n}function $i(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:Sl}function Bi(n,t,e,r){var i=[],u=[],o=0,a=Math.min(n.length,t.length)-1;for(n[a]2?Bi:Vi,l=r?Wr:Br;return o=i(n,t,l,e),a=i(t,n,l,Mr),u}function u(n){return o(n)}var o,a;return u.invert=function(n){return a(n)},u.domain=function(t){return arguments.length?(n=t.map(Number),i()):n},u.range=function(n){return arguments.length?(t=n,i()):t},u.rangeRound=function(n){return u.range(n).interpolate(Ur)},u.clamp=function(n){return arguments.length?(r=n,i()):r},u.interpolate=function(n){return arguments.length?(e=n,i()):e},u.ticks=function(t){return Qi(n,t)},u.tickFormat=function(t,e){return nu(n,t,e)},u.nice=function(t){return Gi(n,t),i()},u.copy=function(){return Wi(n,t,e,r)},i()}function Ji(n,t){return ao.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Gi(n,t){return Xi(n,$i(Ki(n,t)[2])),Xi(n,$i(Ki(n,t)[2])),n}function Ki(n,t){null==t&&(t=10);var e=Yi(n),r=e[1]-e[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),u=t/r*i;return.15>=u?i*=10:.35>=u?i*=5:.75>=u&&(i*=2),e[0]=Math.ceil(e[0]/i)*i,e[1]=Math.floor(e[1]/i)*i+.5*i,e[2]=i,e}function Qi(n,t){return ao.range.apply(ao,Ki(n,t))}function nu(n,t,e){var r=Ki(n,t);if(e){var i=ha.exec(e);if(i.shift(),"s"===i[8]){var u=ao.formatPrefix(Math.max(xo(r[0]),xo(r[1])));return i[7]||(i[7]="."+tu(u.scale(r[2]))),i[8]="f",e=ao.format(i.join("")),function(n){return e(u.scale(n))+u.symbol}}i[7]||(i[7]="."+eu(i[8],r)),e=i.join("")}else e=",."+tu(r[2])+"f";return ao.format(e)}function tu(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function eu(n,t){var e=tu(t[2]);return n in kl?Math.abs(e-tu(Math.max(xo(t[0]),xo(t[1]))))+ +("e"!==n):e-2*("%"===n)}function ru(n,t,e,r){function i(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function u(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function o(t){return n(i(t))}return o.invert=function(t){return u(n.invert(t))},o.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(i)),o):r},o.base=function(e){return arguments.length?(t=+e,n.domain(r.map(i)),o):t},o.nice=function(){var t=Xi(r.map(i),e?Math:El);return n.domain(t),r=t.map(u),o},o.ticks=function(){var n=Yi(r),o=[],a=n[0],l=n[1],c=Math.floor(i(a)),f=Math.ceil(i(l)),s=t%1?2:t;if(isFinite(f-c)){if(e){for(;f>c;c++)for(var h=1;s>h;h++)o.push(u(c)*h);o.push(u(c))}else for(o.push(u(c));c++0;h--)o.push(u(c)*h);for(c=0;o[c]l;f--);o=o.slice(c,f)}return o},o.tickFormat=function(n,e){if(!arguments.length)return Nl;arguments.length<2?e=Nl:"function"!=typeof e&&(e=ao.format(e));var r=Math.max(1,t*n/o.ticks().length);return function(n){var o=n/u(Math.round(i(n)));return t-.5>o*t&&(o*=t),r>=o?e(n):""}},o.copy=function(){return ru(n.copy(),t,e,r)},Ji(o,n)}function iu(n,t,e){function r(t){return n(i(t))}var i=uu(t),u=uu(1/t);return r.invert=function(t){return u(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(i)),r):e},r.ticks=function(n){return Qi(e,n)},r.tickFormat=function(n,t){return nu(e,n,t)},r.nice=function(n){return r.domain(Gi(e,n))},r.exponent=function(o){return arguments.length?(i=uu(t=o),u=uu(1/t),n.domain(e.map(i)),r):t},r.copy=function(){return iu(n.copy(),t,e)},Ji(r,n)}function uu(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function ou(n,t){function e(e){return u[((i.get(e)||("range"===t.t?i.set(e,n.push(e)):NaN))-1)%u.length]}function r(t,e){return ao.range(n.length).map(function(n){return t+e*n})}var i,u,o;return e.domain=function(r){if(!arguments.length)return n;n=[],i=new c;for(var u,o=-1,a=r.length;++oe?[NaN,NaN]:[e>0?a[e-1]:n[0],et?NaN:t/u+n,[t,t+1/u]},r.copy=function(){return lu(n,t,e)},i()}function cu(n,t){function e(e){return e>=e?t[ao.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return cu(n,t)},e}function fu(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return Qi(n,t)},t.tickFormat=function(t,e){return nu(n,t,e)},t.copy=function(){return fu(n)},t}function su(){return 0}function hu(n){return n.innerRadius}function pu(n){return n.outerRadius}function gu(n){return n.startAngle}function vu(n){return n.endAngle}function du(n){return n&&n.padAngle}function yu(n,t,e,r){return(n-e)*t-(t-r)*n>0?0:1}function mu(n,t,e,r,i){var u=n[0]-t[0],o=n[1]-t[1],a=(i?r:-r)/Math.sqrt(u*u+o*o),l=a*o,c=-a*u,f=n[0]+l,s=n[1]+c,h=t[0]+l,p=t[1]+c,g=(f+h)/2,v=(s+p)/2,d=h-f,y=p-s,m=d*d+y*y,M=e-r,x=f*p-h*s,b=(0>y?-1:1)*Math.sqrt(Math.max(0,M*M*m-x*x)),_=(x*y-d*b)/m,w=(-x*d-y*b)/m,S=(x*y+d*b)/m,k=(-x*d+y*b)/m,N=_-g,E=w-v,A=S-g,C=k-v;return N*N+E*E>A*A+C*C&&(_=S,w=k),[[_-l,w-c],[_*e/M,w*e/M]]}function Mu(n){function t(t){function o(){c.push("M",u(n(f),a))}for(var l,c=[],f=[],s=-1,h=t.length,p=En(e),g=En(r);++s1?n.join("L"):n+"Z"}function bu(n){return n.join("L")+"Z"}function _u(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t1&&i.push("H",r[0]),i.join("")}function wu(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t1){a=t[1],u=n[l],l++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(u[0]-a[0])+","+(u[1]-a[1])+","+u[0]+","+u[1];for(var c=2;c9&&(i=3*t/Math.sqrt(i),o[a]=i*e,o[a+1]=i*r));for(a=-1;++a<=l;)i=(n[Math.min(l,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),u.push([i||0,o[a]*i||0]);return u}function Fu(n){return n.length<3?xu(n):n[0]+Au(n,ju(n))}function Hu(n){for(var t,e,r,i=-1,u=n.length;++i=t?o(n-t):void(f.c=o)}function o(e){var i=g.active,u=g[i];u&&(u.timer.c=null,u.timer.t=NaN,--g.count,delete g[i],u.event&&u.event.interrupt.call(n,n.__data__,u.index));for(var o in g)if(r>+o){var c=g[o];c.timer.c=null,c.timer.t=NaN,--g.count,delete g[o]}f.c=a,qn(function(){return f.c&&a(e||1)&&(f.c=null,f.t=NaN),1},0,l),g.active=r,v.event&&v.event.start.call(n,n.__data__,t),p=[],v.tween.forEach(function(e,r){(r=r.call(n,n.__data__,t))&&p.push(r)}),h=v.ease,s=v.duration}function a(i){for(var u=i/s,o=h(u),a=p.length;a>0;)p[--a].call(n,o);return u>=1?(v.event&&v.event.end.call(n,n.__data__,t),--g.count?delete g[r]:delete n[e],1):void 0}var l,f,s,h,p,g=n[e]||(n[e]={active:0,count:0}),v=g[r];v||(l=i.time,f=qn(u,0,l),v=g[r]={tween:new c,time:l,timer:f,delay:i.delay,duration:i.duration,ease:i.ease,index:t},i=null,++g.count)}function no(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate("+(isFinite(r)?r:e(n))+",0)"})}function to(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate(0,"+(isFinite(r)?r:e(n))+")"})}function eo(n){return n.toISOString()}function ro(n,t,e){function r(t){return n(t)}function i(n,e){var r=n[1]-n[0],i=r/e,u=ao.bisect(Kl,i);return u==Kl.length?[t.year,Ki(n.map(function(n){return n/31536e6}),e)[2]]:u?t[i/Kl[u-1]1?{floor:function(t){for(;e(t=n.floor(t));)t=io(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=io(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Yi(r.domain()),u=null==n?i(e,10):"number"==typeof n?i(e,n):!n.range&&[{range:n},t];return u&&(n=u[0],t=u[1]),n.range(e[0],io(+e[1]+1),1>t?1:t)},r.tickFormat=function(){return e},r.copy=function(){return ro(n.copy(),t,e)},Ji(r,n)}function io(n){return new Date(n)}function uo(n){return JSON.parse(n.responseText)}function oo(n){var t=fo.createRange();return t.selectNode(fo.body),t.createContextualFragment(n.responseText)}var ao={version:"3.5.17"},lo=[].slice,co=function(n){return lo.call(n)},fo=this.document;if(fo)try{co(fo.documentElement.childNodes)[0].nodeType}catch(so){co=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}if(Date.now||(Date.now=function(){return+new Date}),fo)try{fo.createElement("DIV").style.setProperty("opacity",0,"")}catch(ho){var po=this.Element.prototype,go=po.setAttribute,vo=po.setAttributeNS,yo=this.CSSStyleDeclaration.prototype,mo=yo.setProperty;po.setAttribute=function(n,t){go.call(this,n,t+"")},po.setAttributeNS=function(n,t,e){vo.call(this,n,t,e+"")},yo.setProperty=function(n,t,e){mo.call(this,n,t+"",e)}}ao.ascending=e,ao.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:NaN},ao.min=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ir&&(e=r)}else{for(;++i=r){e=r;break}for(;++ir&&(e=r)}return e},ao.max=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ie&&(e=r)}else{for(;++i=r){e=r;break}for(;++ie&&(e=r)}return e},ao.extent=function(n,t){var e,r,i,u=-1,o=n.length;if(1===arguments.length){for(;++u=r){e=i=r;break}for(;++ur&&(e=r),r>i&&(i=r))}else{for(;++u=r){e=i=r;break}for(;++ur&&(e=r),r>i&&(i=r))}return[e,i]},ao.sum=function(n,t){var e,r=0,u=n.length,o=-1;if(1===arguments.length)for(;++o1?l/(f-1):void 0},ao.deviation=function(){var n=ao.variance.apply(this,arguments);return n?Math.sqrt(n):n};var Mo=u(e);ao.bisectLeft=Mo.left,ao.bisect=ao.bisectRight=Mo.right,ao.bisector=function(n){return u(1===n.length?function(t,r){return e(n(t),r)}:n)},ao.shuffle=function(n,t,e){(u=arguments.length)<3&&(e=n.length,2>u&&(t=0));for(var r,i,u=e-t;u;)i=Math.random()*u--|0,r=n[u+t],n[u+t]=n[i+t],n[i+t]=r;return n},ao.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},ao.pairs=function(n){for(var t,e=0,r=n.length-1,i=n[0],u=new Array(0>r?0:r);r>e;)u[e]=[t=i,i=n[++e]];return u},ao.transpose=function(n){if(!(i=n.length))return[];for(var t=-1,e=ao.min(n,o),r=new Array(e);++t=0;)for(r=n[i],t=r.length;--t>=0;)e[--o]=r[t];return e};var xo=Math.abs;ao.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),(t-n)/e===1/0)throw new Error("infinite range");var r,i=[],u=a(xo(e)),o=-1;if(n*=u,t*=u,e*=u,0>e)for(;(r=n+e*++o)>t;)i.push(r/u);else for(;(r=n+e*++o)=u.length)return r?r.call(i,o):e?o.sort(e):o;for(var l,f,s,h,p=-1,g=o.length,v=u[a++],d=new c;++p=u.length)return n;var r=[],i=o[e++];return n.forEach(function(n,i){r.push({key:n,values:t(i,e)})}),i?r.sort(function(n,t){return i(n.key,t.key)}):r}var e,r,i={},u=[],o=[];return i.map=function(t,e){return n(e,t,0)},i.entries=function(e){return t(n(ao.map,e,0),0)},i.key=function(n){return u.push(n),i},i.sortKeys=function(n){return o[u.length-1]=n,i},i.sortValues=function(n){return e=n,i},i.rollup=function(n){return r=n,i},i},ao.set=function(n){var t=new y;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},l(y,{has:h,add:function(n){return this._[f(n+="")]=!0,n},remove:p,values:g,size:v,empty:d,forEach:function(n){for(var t in this._)n.call(this,s(t))}}),ao.behavior={},ao.rebind=function(n,t){for(var e,r=1,i=arguments.length;++r=0&&(r=n.slice(e+1),n=n.slice(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},ao.event=null,ao.requote=function(n){return n.replace(So,"\\$&")};var So=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,ko={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},No=function(n,t){return t.querySelector(n)},Eo=function(n,t){return t.querySelectorAll(n)},Ao=function(n,t){var e=n.matches||n[x(n,"matchesSelector")];return(Ao=function(n,t){return e.call(n,t)})(n,t)};"function"==typeof Sizzle&&(No=function(n,t){return Sizzle(n,t)[0]||null},Eo=Sizzle,Ao=Sizzle.matchesSelector),ao.selection=function(){return ao.select(fo.documentElement)};var Co=ao.selection.prototype=[];Co.select=function(n){var t,e,r,i,u=[];n=A(n);for(var o=-1,a=this.length;++o=0&&"xmlns"!==(e=n.slice(0,t))&&(n=n.slice(t+1)),Lo.hasOwnProperty(e)?{space:Lo[e],local:n}:n}},Co.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=ao.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(z(t,n[t]));return this}return this.each(z(n,t))},Co.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=T(n)).length,i=-1;if(t=e.classList){for(;++ii){if("string"!=typeof n){2>i&&(e="");for(r in n)this.each(P(r,n[r],e));return this}if(2>i){var u=this.node();return t(u).getComputedStyle(u,null).getPropertyValue(n)}r=""}return this.each(P(n,e,r))},Co.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(U(t,n[t]));return this}return this.each(U(n,t))},Co.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},Co.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},Co.append=function(n){return n=j(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},Co.insert=function(n,t){return n=j(n),t=A(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments)||null)})},Co.remove=function(){return this.each(F)},Co.data=function(n,t){function e(n,e){var r,i,u,o=n.length,s=e.length,h=Math.min(o,s),p=new Array(s),g=new Array(s),v=new Array(o);if(t){var d,y=new c,m=new Array(o);for(r=-1;++rr;++r)g[r]=H(e[r]);for(;o>r;++r)v[r]=n[r]}g.update=p,g.parentNode=p.parentNode=v.parentNode=n.parentNode,a.push(g),l.push(p),f.push(v)}var r,i,u=-1,o=this.length;if(!arguments.length){for(n=new Array(o=(r=this[0]).length);++uu;u++){i.push(t=[]),t.parentNode=(e=this[u]).parentNode;for(var a=0,l=e.length;l>a;a++)(r=e[a])&&n.call(r,r.__data__,a,u)&&t.push(r)}return E(i)},Co.order=function(){for(var n=-1,t=this.length;++n=0;)(e=r[i])&&(u&&u!==e.nextSibling&&u.parentNode.insertBefore(e,u),u=e);return this},Co.sort=function(n){n=I.apply(this,arguments);for(var t=-1,e=this.length;++tn;n++)for(var e=this[n],r=0,i=e.length;i>r;r++){var u=e[r];if(u)return u}return null},Co.size=function(){var n=0;return Y(this,function(){++n}),n};var qo=[];ao.selection.enter=Z,ao.selection.enter.prototype=qo,qo.append=Co.append,qo.empty=Co.empty,qo.node=Co.node,qo.call=Co.call,qo.size=Co.size,qo.select=function(n){for(var t,e,r,i,u,o=[],a=-1,l=this.length;++ar){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(X(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(X(n,t,e))};var To=ao.map({mouseenter:"mouseover",mouseleave:"mouseout"});fo&&To.forEach(function(n){"on"+n in fo&&To.remove(n)});var Ro,Do=0;ao.mouse=function(n){return J(n,k())};var Po=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;ao.touch=function(n,t,e){if(arguments.length<3&&(e=t,t=k().changedTouches),t)for(var r,i=0,u=t.length;u>i;++i)if((r=t[i]).identifier===e)return J(n,r)},ao.behavior.drag=function(){function n(){this.on("mousedown.drag",u).on("touchstart.drag",o)}function e(n,t,e,u,o){return function(){function a(){var n,e,r=t(h,v);r&&(n=r[0]-M[0],e=r[1]-M[1],g|=n|e,M=r,p({type:"drag",x:r[0]+c[0],y:r[1]+c[1],dx:n,dy:e}))}function l(){t(h,v)&&(y.on(u+d,null).on(o+d,null),m(g),p({type:"dragend"}))}var c,f=this,s=ao.event.target.correspondingElement||ao.event.target,h=f.parentNode,p=r.of(f,arguments),g=0,v=n(),d=".drag"+(null==v?"":"-"+v),y=ao.select(e(s)).on(u+d,a).on(o+d,l),m=W(s),M=t(h,v);i?(c=i.apply(f,arguments),c=[c.x-M[0],c.y-M[1]]):c=[0,0],p({type:"dragstart"})}}var r=N(n,"drag","dragstart","dragend"),i=null,u=e(b,ao.mouse,t,"mousemove","mouseup"),o=e(G,ao.touch,m,"touchmove","touchend");return n.origin=function(t){return arguments.length?(i=t,n):i},ao.rebind(n,r,"on")},ao.touches=function(n,t){return arguments.length<2&&(t=k().touches),t?co(t).map(function(t){var e=J(n,t);return e.identifier=t.identifier,e}):[]};var Uo=1e-6,jo=Uo*Uo,Fo=Math.PI,Ho=2*Fo,Oo=Ho-Uo,Io=Fo/2,Yo=Fo/180,Zo=180/Fo,Vo=Math.SQRT2,Xo=2,$o=4;ao.interpolateZoom=function(n,t){var e,r,i=n[0],u=n[1],o=n[2],a=t[0],l=t[1],c=t[2],f=a-i,s=l-u,h=f*f+s*s;if(jo>h)r=Math.log(c/o)/Vo,e=function(n){return[i+n*f,u+n*s,o*Math.exp(Vo*n*r)]};else{var p=Math.sqrt(h),g=(c*c-o*o+$o*h)/(2*o*Xo*p),v=(c*c-o*o-$o*h)/(2*c*Xo*p),d=Math.log(Math.sqrt(g*g+1)-g),y=Math.log(Math.sqrt(v*v+1)-v);r=(y-d)/Vo,e=function(n){var t=n*r,e=rn(d),a=o/(Xo*p)*(e*un(Vo*t+d)-en(d));return[i+a*f,u+a*s,o*e/rn(Vo*t+d)]}}return e.duration=1e3*r,e},ao.behavior.zoom=function(){function n(n){n.on(L,s).on(Wo+".zoom",p).on("dblclick.zoom",g).on(R,h)}function e(n){return[(n[0]-k.x)/k.k,(n[1]-k.y)/k.k]}function r(n){return[n[0]*k.k+k.x,n[1]*k.k+k.y]}function i(n){k.k=Math.max(A[0],Math.min(A[1],n))}function u(n,t){t=r(t),k.x+=n[0]-t[0],k.y+=n[1]-t[1]}function o(t,e,r,o){t.__chart__={x:k.x,y:k.y,k:k.k},i(Math.pow(2,o)),u(d=e,r),t=ao.select(t),C>0&&(t=t.transition().duration(C)),t.call(n.event)}function a(){b&&b.domain(x.range().map(function(n){return(n-k.x)/k.k}).map(x.invert)),w&&w.domain(_.range().map(function(n){return(n-k.y)/k.k}).map(_.invert))}function l(n){z++||n({type:"zoomstart"})}function c(n){a(),n({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function f(n){--z||(n({type:"zoomend"}),d=null)}function s(){function n(){a=1,u(ao.mouse(i),h),c(o)}function r(){s.on(q,null).on(T,null),p(a),f(o)}var i=this,o=D.of(i,arguments),a=0,s=ao.select(t(i)).on(q,n).on(T,r),h=e(ao.mouse(i)),p=W(i);Il.call(i),l(o)}function h(){function n(){var n=ao.touches(g);return p=k.k,n.forEach(function(n){n.identifier in d&&(d[n.identifier]=e(n))}),n}function t(){var t=ao.event.target;ao.select(t).on(x,r).on(b,a),_.push(t);for(var e=ao.event.changedTouches,i=0,u=e.length;u>i;++i)d[e[i].identifier]=null;var l=n(),c=Date.now();if(1===l.length){if(500>c-M){var f=l[0];o(g,f,d[f.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),S()}M=c}else if(l.length>1){var f=l[0],s=l[1],h=f[0]-s[0],p=f[1]-s[1];y=h*h+p*p}}function r(){var n,t,e,r,o=ao.touches(g);Il.call(g);for(var a=0,l=o.length;l>a;++a,r=null)if(e=o[a],r=d[e.identifier]){if(t)break;n=e,t=r}if(r){var f=(f=e[0]-n[0])*f+(f=e[1]-n[1])*f,s=y&&Math.sqrt(f/y);n=[(n[0]+e[0])/2,(n[1]+e[1])/2],t=[(t[0]+r[0])/2,(t[1]+r[1])/2],i(s*p)}M=null,u(n,t),c(v)}function a(){if(ao.event.touches.length){for(var t=ao.event.changedTouches,e=0,r=t.length;r>e;++e)delete d[t[e].identifier];for(var i in d)return void n()}ao.selectAll(_).on(m,null),w.on(L,s).on(R,h),N(),f(v)}var p,g=this,v=D.of(g,arguments),d={},y=0,m=".zoom-"+ao.event.changedTouches[0].identifier,x="touchmove"+m,b="touchend"+m,_=[],w=ao.select(g),N=W(g);t(),l(v),w.on(L,null).on(R,t)}function p(){var n=D.of(this,arguments);m?clearTimeout(m):(Il.call(this),v=e(d=y||ao.mouse(this)),l(n)),m=setTimeout(function(){m=null,f(n)},50),S(),i(Math.pow(2,.002*Bo())*k.k),u(d,v),c(n)}function g(){var n=ao.mouse(this),t=Math.log(k.k)/Math.LN2;o(this,n,e(n),ao.event.shiftKey?Math.ceil(t)-1:Math.floor(t)+1)}var v,d,y,m,M,x,b,_,w,k={x:0,y:0,k:1},E=[960,500],A=Jo,C=250,z=0,L="mousedown.zoom",q="mousemove.zoom",T="mouseup.zoom",R="touchstart.zoom",D=N(n,"zoomstart","zoom","zoomend");return Wo||(Wo="onwheel"in fo?(Bo=function(){return-ao.event.deltaY*(ao.event.deltaMode?120:1)},"wheel"):"onmousewheel"in fo?(Bo=function(){return ao.event.wheelDelta},"mousewheel"):(Bo=function(){return-ao.event.detail},"MozMousePixelScroll")),n.event=function(n){n.each(function(){var n=D.of(this,arguments),t=k;Hl?ao.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},l(n)}).tween("zoom:zoom",function(){var e=E[0],r=E[1],i=d?d[0]:e/2,u=d?d[1]:r/2,o=ao.interpolateZoom([(i-k.x)/k.k,(u-k.y)/k.k,e/k.k],[(i-t.x)/t.k,(u-t.y)/t.k,e/t.k]);return function(t){var r=o(t),a=e/r[2];this.__chart__=k={x:i-r[0]*a,y:u-r[1]*a,k:a},c(n)}}).each("interrupt.zoom",function(){f(n)}).each("end.zoom",function(){f(n)}):(this.__chart__=k,l(n),c(n),f(n))})},n.translate=function(t){return arguments.length?(k={x:+t[0],y:+t[1],k:k.k},a(),n):[k.x,k.y]},n.scale=function(t){return arguments.length?(k={x:k.x,y:k.y,k:null},i(+t),a(),n):k.k},n.scaleExtent=function(t){return arguments.length?(A=null==t?Jo:[+t[0],+t[1]],n):A},n.center=function(t){return arguments.length?(y=t&&[+t[0],+t[1]],n):y},n.size=function(t){return arguments.length?(E=t&&[+t[0],+t[1]],n):E},n.duration=function(t){return arguments.length?(C=+t,n):C},n.x=function(t){return arguments.length?(b=t,x=t.copy(),k={x:0,y:0,k:1},n):b},n.y=function(t){return arguments.length?(w=t,_=t.copy(),k={x:0,y:0,k:1},n):w},ao.rebind(n,D,"on")};var Bo,Wo,Jo=[0,1/0];ao.color=an,an.prototype.toString=function(){return this.rgb()+""},ao.hsl=ln;var Go=ln.prototype=new an;Go.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),new ln(this.h,this.s,this.l/n)},Go.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new ln(this.h,this.s,n*this.l)},Go.rgb=function(){return cn(this.h,this.s,this.l)},ao.hcl=fn;var Ko=fn.prototype=new an;Ko.brighter=function(n){return new fn(this.h,this.c,Math.min(100,this.l+Qo*(arguments.length?n:1)))},Ko.darker=function(n){return new fn(this.h,this.c,Math.max(0,this.l-Qo*(arguments.length?n:1)))},Ko.rgb=function(){return sn(this.h,this.c,this.l).rgb()},ao.lab=hn;var Qo=18,na=.95047,ta=1,ea=1.08883,ra=hn.prototype=new an;ra.brighter=function(n){return new hn(Math.min(100,this.l+Qo*(arguments.length?n:1)),this.a,this.b)},ra.darker=function(n){return new hn(Math.max(0,this.l-Qo*(arguments.length?n:1)),this.a,this.b)},ra.rgb=function(){return pn(this.l,this.a,this.b)},ao.rgb=mn;var ia=mn.prototype=new an;ia.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,i=30;return t||e||r?(t&&i>t&&(t=i),e&&i>e&&(e=i),r&&i>r&&(r=i),new mn(Math.min(255,t/n),Math.min(255,e/n),Math.min(255,r/n))):new mn(i,i,i)},ia.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new mn(n*this.r,n*this.g,n*this.b)},ia.hsl=function(){return wn(this.r,this.g,this.b)},ia.toString=function(){return"#"+bn(this.r)+bn(this.g)+bn(this.b)};var ua=ao.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});ua.forEach(function(n,t){ua.set(n,Mn(t))}),ao.functor=En,ao.xhr=An(m),ao.dsv=function(n,t){function e(n,e,u){arguments.length<3&&(u=e,e=null);var o=Cn(n,t,null==e?r:i(e),u);return o.row=function(n){return arguments.length?o.response(null==(e=n)?r:i(n)):e},o}function r(n){return e.parse(n.responseText)}function i(n){return function(t){return e.parse(t.responseText,n)}}function u(t){return t.map(o).join(n)}function o(n){return a.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var a=new RegExp('["'+n+"\n]"),l=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var i=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(i(n),e)}:i})},e.parseRows=function(n,t){function e(){if(f>=c)return o;if(i)return i=!1,u;var t=f;if(34===n.charCodeAt(t)){for(var e=t;e++f;){var r=n.charCodeAt(f++),a=1;if(10===r)i=!0;else if(13===r)i=!0,10===n.charCodeAt(f)&&(++f,++a);else if(r!==l)continue;return n.slice(t,f-a)}return n.slice(t)}for(var r,i,u={},o={},a=[],c=n.length,f=0,s=0;(r=e())!==o;){for(var h=[];r!==u&&r!==o;)h.push(r),r=e();t&&null==(h=t(h,s++))||a.push(h)}return a},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new y,i=[];return t.forEach(function(n){for(var t in n)r.has(t)||i.push(r.add(t))}),[i.map(o).join(n)].concat(t.map(function(t){return i.map(function(n){return o(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(u).join("\n")},e},ao.csv=ao.dsv(",","text/csv"),ao.tsv=ao.dsv(" ","text/tab-separated-values");var oa,aa,la,ca,fa=this[x(this,"requestAnimationFrame")]||function(n){setTimeout(n,17)};ao.timer=function(){qn.apply(this,arguments)},ao.timer.flush=function(){Rn(),Dn()},ao.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)};var sa=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Un);ao.formatPrefix=function(n,t){var e=0;return(n=+n)&&(0>n&&(n*=-1),t&&(n=ao.round(n,Pn(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),sa[8+e/3]};var ha=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,pa=ao.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=ao.round(n,Pn(n,t))).toFixed(Math.max(0,Math.min(20,Pn(n*(1+1e-15),t))))}}),ga=ao.time={},va=Date;Hn.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){da.setUTCDate.apply(this._,arguments)},setDay:function(){da.setUTCDay.apply(this._,arguments)},setFullYear:function(){da.setUTCFullYear.apply(this._,arguments)},setHours:function(){da.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){da.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){da.setUTCMinutes.apply(this._,arguments)},setMonth:function(){da.setUTCMonth.apply(this._,arguments)},setSeconds:function(){da.setUTCSeconds.apply(this._,arguments)},setTime:function(){da.setTime.apply(this._,arguments)}};var da=Date.prototype;ga.year=On(function(n){return n=ga.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),ga.years=ga.year.range,ga.years.utc=ga.year.utc.range,ga.day=On(function(n){var t=new va(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),ga.days=ga.day.range,ga.days.utc=ga.day.utc.range,ga.dayOfYear=function(n){var t=ga.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t;var e=ga[n]=On(function(n){return(n=ga.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=ga.year(n).getDay();return Math.floor((ga.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});ga[n+"s"]=e.range,ga[n+"s"].utc=e.utc.range,ga[n+"OfYear"]=function(n){var e=ga.year(n).getDay();return Math.floor((ga.dayOfYear(n)+(e+t)%7)/7)}}),ga.week=ga.sunday,ga.weeks=ga.sunday.range,ga.weeks.utc=ga.sunday.utc.range,ga.weekOfYear=ga.sundayOfYear;var ya={"-":"",_:" ",0:"0"},ma=/^\s*\d+/,Ma=/^%/;ao.locale=function(n){return{numberFormat:jn(n),timeFormat:Yn(n)}};var xa=ao.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"], +shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});ao.format=xa.numberFormat,ao.geo={},ft.prototype={s:0,t:0,add:function(n){st(n,this.t,ba),st(ba.s,this.s,this),this.s?this.t+=ba.t:this.s=ba.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var ba=new ft;ao.geo.stream=function(n,t){n&&_a.hasOwnProperty(n.type)?_a[n.type](n,t):ht(n,t)};var _a={Feature:function(n,t){ht(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,i=e.length;++rn?4*Fo+n:n,Na.lineStart=Na.lineEnd=Na.point=b}};ao.geo.bounds=function(){function n(n,t){M.push(x=[f=n,h=n]),s>t&&(s=t),t>p&&(p=t)}function t(t,e){var r=dt([t*Yo,e*Yo]);if(y){var i=mt(y,r),u=[i[1],-i[0],0],o=mt(u,i);bt(o),o=_t(o);var l=t-g,c=l>0?1:-1,v=o[0]*Zo*c,d=xo(l)>180;if(d^(v>c*g&&c*t>v)){var m=o[1]*Zo;m>p&&(p=m)}else if(v=(v+360)%360-180,d^(v>c*g&&c*t>v)){var m=-o[1]*Zo;s>m&&(s=m)}else s>e&&(s=e),e>p&&(p=e);d?g>t?a(f,t)>a(f,h)&&(h=t):a(t,h)>a(f,h)&&(f=t):h>=f?(f>t&&(f=t),t>h&&(h=t)):t>g?a(f,t)>a(f,h)&&(h=t):a(t,h)>a(f,h)&&(f=t)}else n(t,e);y=r,g=t}function e(){b.point=t}function r(){x[0]=f,x[1]=h,b.point=n,y=null}function i(n,e){if(y){var r=n-g;m+=xo(r)>180?r+(r>0?360:-360):r}else v=n,d=e;Na.point(n,e),t(n,e)}function u(){Na.lineStart()}function o(){i(v,d),Na.lineEnd(),xo(m)>Uo&&(f=-(h=180)),x[0]=f,x[1]=h,y=null}function a(n,t){return(t-=n)<0?t+360:t}function l(n,t){return n[0]-t[0]}function c(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nka?(f=-(h=180),s=-(p=90)):m>Uo?p=90:-Uo>m&&(s=-90),x[0]=f,x[1]=h}};return function(n){p=h=-(f=s=1/0),M=[],ao.geo.stream(n,b);var t=M.length;if(t){M.sort(l);for(var e,r=1,i=M[0],u=[i];t>r;++r)e=M[r],c(e[0],i)||c(e[1],i)?(a(i[0],e[1])>a(i[0],i[1])&&(i[1]=e[1]),a(e[0],i[1])>a(i[0],i[1])&&(i[0]=e[0])):u.push(i=e);for(var o,e,g=-(1/0),t=u.length-1,r=0,i=u[t];t>=r;i=e,++r)e=u[r],(o=a(i[1],e[0]))>g&&(g=o,f=e[0],h=i[1])}return M=x=null,f===1/0||s===1/0?[[NaN,NaN],[NaN,NaN]]:[[f,s],[h,p]]}}(),ao.geo.centroid=function(n){Ea=Aa=Ca=za=La=qa=Ta=Ra=Da=Pa=Ua=0,ao.geo.stream(n,ja);var t=Da,e=Pa,r=Ua,i=t*t+e*e+r*r;return jo>i&&(t=qa,e=Ta,r=Ra,Uo>Aa&&(t=Ca,e=za,r=La),i=t*t+e*e+r*r,jo>i)?[NaN,NaN]:[Math.atan2(e,t)*Zo,tn(r/Math.sqrt(i))*Zo]};var Ea,Aa,Ca,za,La,qa,Ta,Ra,Da,Pa,Ua,ja={sphere:b,point:St,lineStart:Nt,lineEnd:Et,polygonStart:function(){ja.lineStart=At},polygonEnd:function(){ja.lineStart=Nt}},Fa=Rt(zt,jt,Ht,[-Fo,-Fo/2]),Ha=1e9;ao.geo.clipExtent=function(){var n,t,e,r,i,u,o={stream:function(n){return i&&(i.valid=!1),i=u(n),i.valid=!0,i},extent:function(a){return arguments.length?(u=Zt(n=+a[0][0],t=+a[0][1],e=+a[1][0],r=+a[1][1]),i&&(i.valid=!1,i=null),o):[[n,t],[e,r]]}};return o.extent([[0,0],[960,500]])},(ao.geo.conicEqualArea=function(){return Vt(Xt)}).raw=Xt,ao.geo.albers=function(){return ao.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ao.geo.albersUsa=function(){function n(n){var u=n[0],o=n[1];return t=null,e(u,o),t||(r(u,o),t)||i(u,o),t}var t,e,r,i,u=ao.geo.albers(),o=ao.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=ao.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=u.scale(),e=u.translate(),r=(n[0]-e[0])/t,i=(n[1]-e[1])/t;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?o:i>=.166&&.234>i&&r>=-.214&&-.115>r?a:u).invert(n)},n.stream=function(n){var t=u.stream(n),e=o.stream(n),r=a.stream(n);return{point:function(n,i){t.point(n,i),e.point(n,i),r.point(n,i)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(u.precision(t),o.precision(t),a.precision(t),n):u.precision()},n.scale=function(t){return arguments.length?(u.scale(t),o.scale(.35*t),a.scale(t),n.translate(u.translate())):u.scale()},n.translate=function(t){if(!arguments.length)return u.translate();var c=u.scale(),f=+t[0],s=+t[1];return e=u.translate(t).clipExtent([[f-.455*c,s-.238*c],[f+.455*c,s+.238*c]]).stream(l).point,r=o.translate([f-.307*c,s+.201*c]).clipExtent([[f-.425*c+Uo,s+.12*c+Uo],[f-.214*c-Uo,s+.234*c-Uo]]).stream(l).point,i=a.translate([f-.205*c,s+.212*c]).clipExtent([[f-.214*c+Uo,s+.166*c+Uo],[f-.115*c-Uo,s+.234*c-Uo]]).stream(l).point,n},n.scale(1070)};var Oa,Ia,Ya,Za,Va,Xa,$a={point:b,lineStart:b,lineEnd:b,polygonStart:function(){Ia=0,$a.lineStart=$t},polygonEnd:function(){$a.lineStart=$a.lineEnd=$a.point=b,Oa+=xo(Ia/2)}},Ba={point:Bt,lineStart:b,lineEnd:b,polygonStart:b,polygonEnd:b},Wa={point:Gt,lineStart:Kt,lineEnd:Qt,polygonStart:function(){Wa.lineStart=ne},polygonEnd:function(){Wa.point=Gt,Wa.lineStart=Kt,Wa.lineEnd=Qt}};ao.geo.path=function(){function n(n){return n&&("function"==typeof a&&u.pointRadius(+a.apply(this,arguments)),o&&o.valid||(o=i(u)),ao.geo.stream(n,o)),u.result()}function t(){return o=null,n}var e,r,i,u,o,a=4.5;return n.area=function(n){return Oa=0,ao.geo.stream(n,i($a)),Oa},n.centroid=function(n){return Ca=za=La=qa=Ta=Ra=Da=Pa=Ua=0,ao.geo.stream(n,i(Wa)),Ua?[Da/Ua,Pa/Ua]:Ra?[qa/Ra,Ta/Ra]:La?[Ca/La,za/La]:[NaN,NaN]},n.bounds=function(n){return Va=Xa=-(Ya=Za=1/0),ao.geo.stream(n,i(Ba)),[[Ya,Za],[Va,Xa]]},n.projection=function(n){return arguments.length?(i=(e=n)?n.stream||re(n):m,t()):e},n.context=function(n){return arguments.length?(u=null==(r=n)?new Wt:new te(n),"function"!=typeof a&&u.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(u.pointRadius(+t),+t),n):a},n.projection(ao.geo.albersUsa()).context(null)},ao.geo.transform=function(n){return{stream:function(t){var e=new ie(t);for(var r in n)e[r]=n[r];return e}}},ie.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},ao.geo.projection=oe,ao.geo.projectionMutator=ae,(ao.geo.equirectangular=function(){return oe(ce)}).raw=ce.invert=ce,ao.geo.rotation=function(n){function t(t){return t=n(t[0]*Yo,t[1]*Yo),t[0]*=Zo,t[1]*=Zo,t}return n=se(n[0]%360*Yo,n[1]*Yo,n.length>2?n[2]*Yo:0),t.invert=function(t){return t=n.invert(t[0]*Yo,t[1]*Yo),t[0]*=Zo,t[1]*=Zo,t},t},fe.invert=ce,ao.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=se(-n[0]*Yo,-n[1]*Yo,0).invert,i=[];return e(null,null,1,{point:function(n,e){i.push(n=t(n,e)),n[0]*=Zo,n[1]*=Zo}}),{type:"Polygon",coordinates:[i]}}var t,e,r=[0,0],i=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=ve((t=+r)*Yo,i*Yo),n):t},n.precision=function(r){return arguments.length?(e=ve(t*Yo,(i=+r)*Yo),n):i},n.angle(90)},ao.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Yo,i=n[1]*Yo,u=t[1]*Yo,o=Math.sin(r),a=Math.cos(r),l=Math.sin(i),c=Math.cos(i),f=Math.sin(u),s=Math.cos(u);return Math.atan2(Math.sqrt((e=s*o)*e+(e=c*f-l*s*a)*e),l*f+c*s*a)},ao.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return ao.range(Math.ceil(u/d)*d,i,d).map(h).concat(ao.range(Math.ceil(c/y)*y,l,y).map(p)).concat(ao.range(Math.ceil(r/g)*g,e,g).filter(function(n){return xo(n%d)>Uo}).map(f)).concat(ao.range(Math.ceil(a/v)*v,o,v).filter(function(n){return xo(n%y)>Uo}).map(s))}var e,r,i,u,o,a,l,c,f,s,h,p,g=10,v=g,d=90,y=360,m=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(u).concat(p(l).slice(1),h(i).reverse().slice(1),p(c).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(u=+t[0][0],i=+t[1][0],c=+t[0][1],l=+t[1][1],u>i&&(t=u,u=i,i=t),c>l&&(t=c,c=l,l=t),n.precision(m)):[[u,c],[i,l]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],o=+t[1][1],r>e&&(t=r,r=e,e=t),a>o&&(t=a,a=o,o=t),n.precision(m)):[[r,a],[e,o]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],y=+t[1],n):[d,y]},n.minorStep=function(t){return arguments.length?(g=+t[0],v=+t[1],n):[g,v]},n.precision=function(t){return arguments.length?(m=+t,f=ye(a,o,90),s=me(r,e,m),h=ye(c,l,90),p=me(u,i,m),n):m},n.majorExtent([[-180,-90+Uo],[180,90-Uo]]).minorExtent([[-180,-80-Uo],[180,80+Uo]])},ao.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||i.apply(this,arguments)]}}var t,e,r=Me,i=xe;return n.distance=function(){return ao.geo.distance(t||r.apply(this,arguments),e||i.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(i=t,e="function"==typeof t?null:t,n):i},n.precision=function(){return arguments.length?n:0},n},ao.geo.interpolate=function(n,t){return be(n[0]*Yo,n[1]*Yo,t[0]*Yo,t[1]*Yo)},ao.geo.length=function(n){return Ja=0,ao.geo.stream(n,Ga),Ja};var Ja,Ga={sphere:b,point:b,lineStart:_e,lineEnd:b,polygonStart:b,polygonEnd:b},Ka=we(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(ao.geo.azimuthalEqualArea=function(){return oe(Ka)}).raw=Ka;var Qa=we(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},m);(ao.geo.azimuthalEquidistant=function(){return oe(Qa)}).raw=Qa,(ao.geo.conicConformal=function(){return Vt(Se)}).raw=Se,(ao.geo.conicEquidistant=function(){return Vt(ke)}).raw=ke;var nl=we(function(n){return 1/n},Math.atan);(ao.geo.gnomonic=function(){return oe(nl)}).raw=nl,Ne.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Io]},(ao.geo.mercator=function(){return Ee(Ne)}).raw=Ne;var tl=we(function(){return 1},Math.asin);(ao.geo.orthographic=function(){return oe(tl)}).raw=tl;var el=we(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(ao.geo.stereographic=function(){return oe(el)}).raw=el,Ae.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-Io]},(ao.geo.transverseMercator=function(){var n=Ee(Ae),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},e([0,0,90])}).raw=Ae,ao.geom={},ao.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,i=En(e),u=En(r),o=n.length,a=[],l=[];for(t=0;o>t;t++)a.push([+i.call(this,n[t],t),+u.call(this,n[t],t),t]);for(a.sort(qe),t=0;o>t;t++)l.push([a[t][0],-a[t][1]]);var c=Le(a),f=Le(l),s=f[0]===c[0],h=f[f.length-1]===c[c.length-1],p=[];for(t=c.length-1;t>=0;--t)p.push(n[a[c[t]][2]]);for(t=+s;t=r&&c.x<=u&&c.y>=i&&c.y<=o?[[r,o],[u,o],[u,i],[r,i]]:[];f.point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(u(n,t)/Uo)*Uo,y:Math.round(o(n,t)/Uo)*Uo,i:t}})}var r=Ce,i=ze,u=r,o=i,a=sl;return n?t(n):(t.links=function(n){return ar(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return ar(e(n)).cells.forEach(function(e,r){for(var i,u,o=e.site,a=e.edges.sort(Ve),l=-1,c=a.length,f=a[c-1].edge,s=f.l===o?f.r:f.l;++l=c,h=r>=f,p=h<<1|s;n.leaf=!1,n=n.nodes[p]||(n.nodes[p]=hr()),s?i=c:a=c,h?o=f:l=f,u(n,t,e,r,i,o,a,l)}var f,s,h,p,g,v,d,y,m,M=En(a),x=En(l);if(null!=t)v=t,d=e,y=r,m=i;else if(y=m=-(v=d=1/0),s=[],h=[],g=n.length,o)for(p=0;g>p;++p)f=n[p],f.xy&&(y=f.x),f.y>m&&(m=f.y),s.push(f.x),h.push(f.y);else for(p=0;g>p;++p){var b=+M(f=n[p],p),_=+x(f,p);v>b&&(v=b),d>_&&(d=_),b>y&&(y=b),_>m&&(m=_),s.push(b),h.push(_)}var w=y-v,S=m-d;w>S?m=d+w:y=v+S;var k=hr();if(k.add=function(n){u(k,n,+M(n,++p),+x(n,p),v,d,y,m)},k.visit=function(n){pr(n,k,v,d,y,m)},k.find=function(n){return gr(k,n[0],n[1],v,d,y,m)},p=-1,null==t){for(;++p=0?n.slice(0,t):n,r=t>=0?n.slice(t+1):"in";return e=vl.get(e)||gl,r=dl.get(r)||m,br(r(e.apply(null,lo.call(arguments,1))))},ao.interpolateHcl=Rr,ao.interpolateHsl=Dr,ao.interpolateLab=Pr,ao.interpolateRound=Ur,ao.transform=function(n){var t=fo.createElementNS(ao.ns.prefix.svg,"g");return(ao.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new jr(e?e.matrix:yl)})(n)},jr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yl={a:1,b:0,c:0,d:1,e:0,f:0};ao.interpolateTransform=$r,ao.layout={},ao.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++ea*a/y){if(v>l){var c=t.charge/l;n.px-=u*c,n.py-=o*c}return!0}if(t.point&&l&&v>l){var c=t.pointCharge/l;n.px-=u*c,n.py-=o*c}}return!t.charge}}function t(n){n.px=ao.event.x,n.py=ao.event.y,l.resume()}var e,r,i,u,o,a,l={},c=ao.dispatch("start","tick","end"),f=[1,1],s=.9,h=ml,p=Ml,g=-30,v=xl,d=.1,y=.64,M=[],x=[];return l.tick=function(){if((i*=.99)<.005)return e=null,c.end({type:"end",alpha:i=0}),!0;var t,r,l,h,p,v,y,m,b,_=M.length,w=x.length;for(r=0;w>r;++r)l=x[r],h=l.source,p=l.target,m=p.x-h.x,b=p.y-h.y,(v=m*m+b*b)&&(v=i*o[r]*((v=Math.sqrt(v))-u[r])/v,m*=v,b*=v,p.x-=m*(y=h.weight+p.weight?h.weight/(h.weight+p.weight):.5),p.y-=b*y,h.x+=m*(y=1-y),h.y+=b*y);if((y=i*d)&&(m=f[0]/2,b=f[1]/2,r=-1,y))for(;++r<_;)l=M[r],l.x+=(m-l.x)*y,l.y+=(b-l.y)*y;if(g)for(ri(t=ao.geom.quadtree(M),i,a),r=-1;++r<_;)(l=M[r]).fixed||t.visit(n(l));for(r=-1;++r<_;)l=M[r],l.fixed?(l.x=l.px,l.y=l.py):(l.x-=(l.px-(l.px=l.x))*s,l.y-=(l.py-(l.py=l.y))*s);c.tick({type:"tick",alpha:i})},l.nodes=function(n){return arguments.length?(M=n,l):M},l.links=function(n){return arguments.length?(x=n,l):x},l.size=function(n){return arguments.length?(f=n,l):f},l.linkDistance=function(n){return arguments.length?(h="function"==typeof n?n:+n,l):h},l.distance=l.linkDistance,l.linkStrength=function(n){return arguments.length?(p="function"==typeof n?n:+n,l):p},l.friction=function(n){return arguments.length?(s=+n,l):s},l.charge=function(n){return arguments.length?(g="function"==typeof n?n:+n,l):g},l.chargeDistance=function(n){return arguments.length?(v=n*n,l):Math.sqrt(v)},l.gravity=function(n){return arguments.length?(d=+n,l):d},l.theta=function(n){return arguments.length?(y=n*n,l):Math.sqrt(y)},l.alpha=function(n){return arguments.length?(n=+n,i?n>0?i=n:(e.c=null,e.t=NaN,e=null,c.end({type:"end",alpha:i=0})):n>0&&(c.start({type:"start",alpha:i=n}),e=qn(l.tick)),l):i},l.start=function(){function n(n,r){if(!e){for(e=new Array(i),l=0;i>l;++l)e[l]=[];for(l=0;c>l;++l){var u=x[l];e[u.source.index].push(u.target),e[u.target.index].push(u.source)}}for(var o,a=e[t],l=-1,f=a.length;++lt;++t)(r=M[t]).index=t,r.weight=0;for(t=0;c>t;++t)r=x[t],"number"==typeof r.source&&(r.source=M[r.source]),"number"==typeof r.target&&(r.target=M[r.target]),++r.source.weight,++r.target.weight;for(t=0;i>t;++t)r=M[t],isNaN(r.x)&&(r.x=n("x",s)),isNaN(r.y)&&(r.y=n("y",v)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(u=[],"function"==typeof h)for(t=0;c>t;++t)u[t]=+h.call(this,x[t],t);else for(t=0;c>t;++t)u[t]=h;if(o=[],"function"==typeof p)for(t=0;c>t;++t)o[t]=+p.call(this,x[t],t);else for(t=0;c>t;++t)o[t]=p;if(a=[],"function"==typeof g)for(t=0;i>t;++t)a[t]=+g.call(this,M[t],t);else for(t=0;i>t;++t)a[t]=g;return l.resume()},l.resume=function(){return l.alpha(.1)},l.stop=function(){return l.alpha(0)},l.drag=function(){return r||(r=ao.behavior.drag().origin(m).on("dragstart.force",Qr).on("drag.force",t).on("dragend.force",ni)),arguments.length?void this.on("mouseover.force",ti).on("mouseout.force",ei).call(r):r},ao.rebind(l,c,"on")};var ml=20,Ml=1,xl=1/0;ao.layout.hierarchy=function(){function n(i){var u,o=[i],a=[];for(i.depth=0;null!=(u=o.pop());)if(a.push(u),(c=e.call(n,u,u.depth))&&(l=c.length)){for(var l,c,f;--l>=0;)o.push(f=c[l]),f.parent=u,f.depth=u.depth+1;r&&(u.value=0),u.children=c}else r&&(u.value=+r.call(n,u,u.depth)||0),delete u.children;return oi(i,function(n){var e,i;t&&(e=n.children)&&e.sort(t),r&&(i=n.parent)&&(i.value+=n.value)}),a}var t=ci,e=ai,r=li;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(ui(t,function(n){n.children&&(n.value=0)}),oi(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},ao.layout.partition=function(){function n(t,e,r,i){var u=t.children;if(t.x=e,t.y=t.depth*i,t.dx=r,t.dy=i,u&&(o=u.length)){var o,a,l,c=-1;for(r=t.value?r/t.value:0;++cs?-1:1),g=ao.sum(c),v=g?(s-l*p)/g:0,d=ao.range(l),y=[];return null!=e&&d.sort(e===bl?function(n,t){return c[t]-c[n]}:function(n,t){return e(o[n],o[t])}),d.forEach(function(n){y[n]={data:o[n],value:a=c[n],startAngle:f,endAngle:f+=a*v+p,padAngle:h}}),y}var t=Number,e=bl,r=0,i=Ho,u=0;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(i=t,n):i},n.padAngle=function(t){return arguments.length?(u=t,n):u},n};var bl={};ao.layout.stack=function(){function n(a,l){if(!(h=a.length))return a;var c=a.map(function(e,r){return t.call(n,e,r)}),f=c.map(function(t){return t.map(function(t,e){return[u.call(n,t,e),o.call(n,t,e)]})}),s=e.call(n,f,l);c=ao.permute(c,s),f=ao.permute(f,s);var h,p,g,v,d=r.call(n,f,l),y=c[0].length;for(g=0;y>g;++g)for(i.call(n,c[0][g],v=d[g],f[0][g][1]),p=1;h>p;++p)i.call(n,c[p][g],v+=f[p-1][g][1],f[p][g][1]);return a}var t=m,e=gi,r=vi,i=pi,u=si,o=hi;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:_l.get(t)||gi,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:wl.get(t)||vi,n):r},n.x=function(t){return arguments.length?(u=t,n):u},n.y=function(t){return arguments.length?(o=t,n):o},n.out=function(t){return arguments.length?(i=t,n):i},n};var _l=ao.map({"inside-out":function(n){var t,e,r=n.length,i=n.map(di),u=n.map(yi),o=ao.range(r).sort(function(n,t){return i[n]-i[t]}),a=0,l=0,c=[],f=[];for(t=0;r>t;++t)e=o[t],l>a?(a+=u[e],c.push(e)):(l+=u[e],f.push(e));return f.reverse().concat(c)},reverse:function(n){return ao.range(n.length).reverse()},"default":gi}),wl=ao.map({silhouette:function(n){var t,e,r,i=n.length,u=n[0].length,o=[],a=0,l=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];r>a&&(a=r),o.push(r)}for(e=0;u>e;++e)l[e]=(a-o[e])/2;return l},wiggle:function(n){var t,e,r,i,u,o,a,l,c,f=n.length,s=n[0],h=s.length,p=[];for(p[0]=l=c=0,e=1;h>e;++e){for(t=0,i=0;f>t;++t)i+=n[t][e][1];for(t=0,u=0,a=s[e][0]-s[e-1][0];f>t;++t){for(r=0,o=(n[t][e][1]-n[t][e-1][1])/(2*a);t>r;++r)o+=(n[r][e][1]-n[r][e-1][1])/a;u+=o*n[t][e][1]}p[e]=l-=i?u/i*a:0,c>l&&(c=l)}for(e=0;h>e;++e)p[e]-=c;return p},expand:function(n){var t,e,r,i=n.length,u=n[0].length,o=1/i,a=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];if(r)for(t=0;i>t;t++)n[t][e][1]/=r;else for(t=0;i>t;t++)n[t][e][1]=o}for(e=0;u>e;++e)a[e]=0;return a},zero:vi});ao.layout.histogram=function(){function n(n,u){for(var o,a,l=[],c=n.map(e,this),f=r.call(this,c,u),s=i.call(this,f,c,u),u=-1,h=c.length,p=s.length-1,g=t?1:1/h;++u0)for(u=-1;++u=f[0]&&a<=f[1]&&(o=l[ao.bisect(s,a,1,p)-1],o.y+=g,o.push(n[u]));return l}var t=!0,e=Number,r=bi,i=Mi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=En(t),n):r},n.bins=function(t){return arguments.length?(i="number"==typeof t?function(n){return xi(n,t)}:En(t),n):i},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},ao.layout.pack=function(){function n(n,u){var o=e.call(this,n,u),a=o[0],l=i[0],c=i[1],f=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,oi(a,function(n){n.r=+f(n.value)}),oi(a,Ni),r){var s=r*(t?1:Math.max(2*a.r/l,2*a.r/c))/2;oi(a,function(n){n.r+=s}),oi(a,Ni),oi(a,function(n){n.r-=s})}return Ci(a,l/2,c/2,t?1:1/Math.max(2*a.r/l,2*a.r/c)),o}var t,e=ao.layout.hierarchy().sort(_i),r=0,i=[1,1];return n.size=function(t){return arguments.length?(i=t,n):i},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},ii(n,e)},ao.layout.tree=function(){function n(n,i){var f=o.call(this,n,i),s=f[0],h=t(s);if(oi(h,e),h.parent.m=-h.z,ui(h,r),c)ui(s,u);else{var p=s,g=s,v=s;ui(s,function(n){n.xg.x&&(g=n),n.depth>v.depth&&(v=n)});var d=a(p,g)/2-p.x,y=l[0]/(g.x+a(g,p)/2+d),m=l[1]/(v.depth||1);ui(s,function(n){n.x=(n.x+d)*y,n.y=n.depth*m})}return f}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var i,u=t.children,o=0,a=u.length;a>o;++o)r.push((u[o]=i={_:u[o],parent:t,children:(i=u[o].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=i);return e.children[0]}function e(n){var t=n.children,e=n.parent.children,r=n.i?e[n.i-1]:null;if(t.length){Di(n);var u=(t[0].z+t[t.length-1].z)/2;r?(n.z=r.z+a(n._,r._),n.m=n.z-u):n.z=u}else r&&(n.z=r.z+a(n._,r._));n.parent.A=i(n,r,n.parent.A||e[0])}function r(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function i(n,t,e){if(t){for(var r,i=n,u=n,o=t,l=i.parent.children[0],c=i.m,f=u.m,s=o.m,h=l.m;o=Ti(o),i=qi(i),o&&i;)l=qi(l),u=Ti(u),u.a=n,r=o.z+s-i.z-c+a(o._,i._),r>0&&(Ri(Pi(o,n,e),n,r),c+=r,f+=r),s+=o.m,c+=i.m,h+=l.m,f+=u.m;o&&!Ti(u)&&(u.t=o,u.m+=s-f),i&&!qi(l)&&(l.t=i,l.m+=c-h,e=n)}return e}function u(n){n.x*=l[0],n.y=n.depth*l[1]}var o=ao.layout.hierarchy().sort(null).value(null),a=Li,l=[1,1],c=null;return n.separation=function(t){return arguments.length?(a=t,n):a},n.size=function(t){return arguments.length?(c=null==(l=t)?u:null,n):c?null:l},n.nodeSize=function(t){return arguments.length?(c=null==(l=t)?null:u,n):c?l:null},ii(n,o)},ao.layout.cluster=function(){function n(n,u){var o,a=t.call(this,n,u),l=a[0],c=0;oi(l,function(n){var t=n.children;t&&t.length?(n.x=ji(t),n.y=Ui(t)):(n.x=o?c+=e(n,o):0,n.y=0,o=n)});var f=Fi(l),s=Hi(l),h=f.x-e(f,s)/2,p=s.x+e(s,f)/2;return oi(l,i?function(n){n.x=(n.x-l.x)*r[0],n.y=(l.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(p-h)*r[0],n.y=(1-(l.y?n.y/l.y:1))*r[1]}),a}var t=ao.layout.hierarchy().sort(null).value(null),e=Li,r=[1,1],i=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(i=null==(r=t),n):i?null:r},n.nodeSize=function(t){return arguments.length?(i=null!=(r=t),n):i?r:null},ii(n,t)},ao.layout.treemap=function(){function n(n,t){for(var e,r,i=-1,u=n.length;++it?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var u=e.children;if(u&&u.length){var o,a,l,c=s(e),f=[],h=u.slice(),g=1/0,v="slice"===p?c.dx:"dice"===p?c.dy:"slice-dice"===p?1&e.depth?c.dy:c.dx:Math.min(c.dx,c.dy);for(n(h,c.dx*c.dy/e.value),f.area=0;(l=h.length)>0;)f.push(o=h[l-1]),f.area+=o.area,"squarify"!==p||(a=r(f,v))<=g?(h.pop(),g=a):(f.area-=f.pop().area,i(f,v,c,!1),v=Math.min(c.dx,c.dy),f.length=f.area=0,g=1/0);f.length&&(i(f,v,c,!0),f.length=f.area=0),u.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var u,o=s(t),a=r.slice(),l=[];for(n(a,o.dx*o.dy/t.value),l.area=0;u=a.pop();)l.push(u),l.area+=u.area,null!=u.z&&(i(l,u.z?o.dx:o.dy,o,!a.length),l.length=l.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,i=0,u=1/0,o=-1,a=n.length;++oe&&(u=e),e>i&&(i=e));return r*=r,t*=t,r?Math.max(t*i*g/r,r/(t*u*g)):1/0}function i(n,t,e,r){var i,u=-1,o=n.length,a=e.x,c=e.y,f=t?l(n.area/t):0; +if(t==e.dx){for((r||f>e.dy)&&(f=e.dy);++ue.dx)&&(f=e.dx);++ue&&(t=1),1>e&&(n=0),function(){var e,r,i;do e=2*Math.random()-1,r=2*Math.random()-1,i=e*e+r*r;while(!i||i>1);return n+t*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var n=ao.random.normal.apply(ao,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=ao.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t}}},ao.scale={};var Sl={floor:m,ceil:m};ao.scale.linear=function(){return Wi([0,1],[0,1],Mr,!1)};var kl={s:1,g:1,p:1,r:1,e:1};ao.scale.log=function(){return ru(ao.scale.linear().domain([0,1]),10,!0,[1,10])};var Nl=ao.format(".0e"),El={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};ao.scale.pow=function(){return iu(ao.scale.linear(),1,[0,1])},ao.scale.sqrt=function(){return ao.scale.pow().exponent(.5)},ao.scale.ordinal=function(){return ou([],{t:"range",a:[[]]})},ao.scale.category10=function(){return ao.scale.ordinal().range(Al)},ao.scale.category20=function(){return ao.scale.ordinal().range(Cl)},ao.scale.category20b=function(){return ao.scale.ordinal().range(zl)},ao.scale.category20c=function(){return ao.scale.ordinal().range(Ll)};var Al=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(xn),Cl=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(xn),zl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(xn),Ll=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(xn);ao.scale.quantile=function(){return au([],[])},ao.scale.quantize=function(){return lu(0,1,[0,1])},ao.scale.threshold=function(){return cu([.5],[0,1])},ao.scale.identity=function(){return fu([0,1])},ao.svg={},ao.svg.arc=function(){function n(){var n=Math.max(0,+e.apply(this,arguments)),c=Math.max(0,+r.apply(this,arguments)),f=o.apply(this,arguments)-Io,s=a.apply(this,arguments)-Io,h=Math.abs(s-f),p=f>s?0:1;if(n>c&&(g=c,c=n,n=g),h>=Oo)return t(c,p)+(n?t(n,1-p):"")+"Z";var g,v,d,y,m,M,x,b,_,w,S,k,N=0,E=0,A=[];if((y=(+l.apply(this,arguments)||0)/2)&&(d=u===ql?Math.sqrt(n*n+c*c):+u.apply(this,arguments),p||(E*=-1),c&&(E=tn(d/c*Math.sin(y))),n&&(N=tn(d/n*Math.sin(y)))),c){m=c*Math.cos(f+E),M=c*Math.sin(f+E),x=c*Math.cos(s-E),b=c*Math.sin(s-E);var C=Math.abs(s-f-2*E)<=Fo?0:1;if(E&&yu(m,M,x,b)===p^C){var z=(f+s)/2;m=c*Math.cos(z),M=c*Math.sin(z),x=b=null}}else m=M=0;if(n){_=n*Math.cos(s-N),w=n*Math.sin(s-N),S=n*Math.cos(f+N),k=n*Math.sin(f+N);var L=Math.abs(f-s+2*N)<=Fo?0:1;if(N&&yu(_,w,S,k)===1-p^L){var q=(f+s)/2;_=n*Math.cos(q),w=n*Math.sin(q),S=k=null}}else _=w=0;if(h>Uo&&(g=Math.min(Math.abs(c-n)/2,+i.apply(this,arguments)))>.001){v=c>n^p?0:1;var T=g,R=g;if(Fo>h){var D=null==S?[_,w]:null==x?[m,M]:Re([m,M],[S,k],[x,b],[_,w]),P=m-D[0],U=M-D[1],j=x-D[0],F=b-D[1],H=1/Math.sin(Math.acos((P*j+U*F)/(Math.sqrt(P*P+U*U)*Math.sqrt(j*j+F*F)))/2),O=Math.sqrt(D[0]*D[0]+D[1]*D[1]);R=Math.min(g,(n-O)/(H-1)),T=Math.min(g,(c-O)/(H+1))}if(null!=x){var I=mu(null==S?[_,w]:[S,k],[m,M],c,T,p),Y=mu([x,b],[_,w],c,T,p);g===T?A.push("M",I[0],"A",T,",",T," 0 0,",v," ",I[1],"A",c,",",c," 0 ",1-p^yu(I[1][0],I[1][1],Y[1][0],Y[1][1]),",",p," ",Y[1],"A",T,",",T," 0 0,",v," ",Y[0]):A.push("M",I[0],"A",T,",",T," 0 1,",v," ",Y[0])}else A.push("M",m,",",M);if(null!=S){var Z=mu([m,M],[S,k],n,-R,p),V=mu([_,w],null==x?[m,M]:[x,b],n,-R,p);g===R?A.push("L",V[0],"A",R,",",R," 0 0,",v," ",V[1],"A",n,",",n," 0 ",p^yu(V[1][0],V[1][1],Z[1][0],Z[1][1]),",",1-p," ",Z[1],"A",R,",",R," 0 0,",v," ",Z[0]):A.push("L",V[0],"A",R,",",R," 0 0,",v," ",Z[0])}else A.push("L",_,",",w)}else A.push("M",m,",",M),null!=x&&A.push("A",c,",",c," 0 ",C,",",p," ",x,",",b),A.push("L",_,",",w),null!=S&&A.push("A",n,",",n," 0 ",L,",",1-p," ",S,",",k);return A.push("Z"),A.join("")}function t(n,t){return"M0,"+n+"A"+n+","+n+" 0 1,"+t+" 0,"+-n+"A"+n+","+n+" 0 1,"+t+" 0,"+n}var e=hu,r=pu,i=su,u=ql,o=gu,a=vu,l=du;return n.innerRadius=function(t){return arguments.length?(e=En(t),n):e},n.outerRadius=function(t){return arguments.length?(r=En(t),n):r},n.cornerRadius=function(t){return arguments.length?(i=En(t),n):i},n.padRadius=function(t){return arguments.length?(u=t==ql?ql:En(t),n):u},n.startAngle=function(t){return arguments.length?(o=En(t),n):o},n.endAngle=function(t){return arguments.length?(a=En(t),n):a},n.padAngle=function(t){return arguments.length?(l=En(t),n):l},n.centroid=function(){var n=(+e.apply(this,arguments)+ +r.apply(this,arguments))/2,t=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-Io;return[Math.cos(t)*n,Math.sin(t)*n]},n};var ql="auto";ao.svg.line=function(){return Mu(m)};var Tl=ao.map({linear:xu,"linear-closed":bu,step:_u,"step-before":wu,"step-after":Su,basis:zu,"basis-open":Lu,"basis-closed":qu,bundle:Tu,cardinal:Eu,"cardinal-open":ku,"cardinal-closed":Nu,monotone:Fu});Tl.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var Rl=[0,2/3,1/3,0],Dl=[0,1/3,2/3,0],Pl=[0,1/6,2/3,1/6];ao.svg.line.radial=function(){var n=Mu(Hu);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},wu.reverse=Su,Su.reverse=wu,ao.svg.area=function(){return Ou(m)},ao.svg.area.radial=function(){var n=Ou(Hu);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},ao.svg.chord=function(){function n(n,a){var l=t(this,u,n,a),c=t(this,o,n,a);return"M"+l.p0+r(l.r,l.p1,l.a1-l.a0)+(e(l,c)?i(l.r,l.p1,l.r,l.p0):i(l.r,l.p1,c.r,c.p0)+r(c.r,c.p1,c.a1-c.a0)+i(c.r,c.p1,l.r,l.p0))+"Z"}function t(n,t,e,r){var i=t.call(n,e,r),u=a.call(n,i,r),o=l.call(n,i,r)-Io,f=c.call(n,i,r)-Io;return{r:u,a0:o,a1:f,p0:[u*Math.cos(o),u*Math.sin(o)],p1:[u*Math.cos(f),u*Math.sin(f)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>Fo)+",1 "+t}function i(n,t,e,r){return"Q 0,0 "+r}var u=Me,o=xe,a=Iu,l=gu,c=vu;return n.radius=function(t){return arguments.length?(a=En(t),n):a},n.source=function(t){return arguments.length?(u=En(t),n):u},n.target=function(t){return arguments.length?(o=En(t),n):o},n.startAngle=function(t){return arguments.length?(l=En(t),n):l},n.endAngle=function(t){return arguments.length?(c=En(t),n):c},n},ao.svg.diagonal=function(){function n(n,i){var u=t.call(this,n,i),o=e.call(this,n,i),a=(u.y+o.y)/2,l=[u,{x:u.x,y:a},{x:o.x,y:a},o];return l=l.map(r),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var t=Me,e=xe,r=Yu;return n.source=function(e){return arguments.length?(t=En(e),n):t},n.target=function(t){return arguments.length?(e=En(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},ao.svg.diagonal.radial=function(){var n=ao.svg.diagonal(),t=Yu,e=n.projection;return n.projection=function(n){return arguments.length?e(Zu(t=n)):t},n},ao.svg.symbol=function(){function n(n,r){return(Ul.get(t.call(this,n,r))||$u)(e.call(this,n,r))}var t=Xu,e=Vu;return n.type=function(e){return arguments.length?(t=En(e),n):t},n.size=function(t){return arguments.length?(e=En(t),n):e},n};var Ul=ao.map({circle:$u,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*Fl)),e=t*Fl;return"M0,"+-t+"L"+e+",0 0,"+t+" "+-e+",0Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/jl),e=t*jl/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/jl),e=t*jl/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});ao.svg.symbolTypes=Ul.keys();var jl=Math.sqrt(3),Fl=Math.tan(30*Yo);Co.transition=function(n){for(var t,e,r=Hl||++Zl,i=Ku(n),u=[],o=Ol||{time:Date.now(),ease:Nr,delay:0,duration:250},a=-1,l=this.length;++au;u++){i.push(t=[]);for(var e=this[u],a=0,l=e.length;l>a;a++)(r=e[a])&&n.call(r,r.__data__,a,u)&&t.push(r)}return Wu(i,this.namespace,this.id)},Yl.tween=function(n,t){var e=this.id,r=this.namespace;return arguments.length<2?this.node()[r][e].tween.get(n):Y(this,null==t?function(t){t[r][e].tween.remove(n)}:function(i){i[r][e].tween.set(n,t)})},Yl.attr=function(n,t){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function i(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(a);return e!==n&&(t=o(e,n),function(n){this.setAttribute(a,t(n))})})}function u(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(a.space,a.local);return e!==n&&(t=o(e,n),function(n){this.setAttributeNS(a.space,a.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var o="transform"==n?$r:Mr,a=ao.ns.qualify(n);return Ju(this,"attr."+n,t,a.local?u:i)},Yl.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(i));return r&&function(n){this.setAttribute(i,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(i.space,i.local));return r&&function(n){this.setAttributeNS(i.space,i.local,r(n))}}var i=ao.ns.qualify(n);return this.tween("attr."+n,i.local?r:e)},Yl.style=function(n,e,r){function i(){this.style.removeProperty(n)}function u(e){return null==e?i:(e+="",function(){var i,u=t(this).getComputedStyle(this,null).getPropertyValue(n);return u!==e&&(i=Mr(u,e),function(t){this.style.setProperty(n,i(t),r)})})}var o=arguments.length;if(3>o){if("string"!=typeof n){2>o&&(e="");for(r in n)this.style(r,n[r],e);return this}r=""}return Ju(this,"style."+n,e,u)},Yl.styleTween=function(n,e,r){function i(i,u){var o=e.call(this,i,u,t(this).getComputedStyle(this,null).getPropertyValue(n));return o&&function(t){this.style.setProperty(n,o(t),r)}}return arguments.length<3&&(r=""),this.tween("style."+n,i)},Yl.text=function(n){return Ju(this,"text",n,Gu)},Yl.remove=function(){var n=this.namespace;return this.each("end.transition",function(){var t;this[n].count<2&&(t=this.parentNode)&&t.removeChild(this)})},Yl.ease=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].ease:("function"!=typeof n&&(n=ao.ease.apply(ao,arguments)),Y(this,function(r){r[e][t].ease=n}))},Yl.delay=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].delay:Y(this,"function"==typeof n?function(r,i,u){r[e][t].delay=+n.call(r,r.__data__,i,u)}:(n=+n,function(r){r[e][t].delay=n}))},Yl.duration=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].duration:Y(this,"function"==typeof n?function(r,i,u){r[e][t].duration=Math.max(1,n.call(r,r.__data__,i,u))}:(n=Math.max(1,n),function(r){r[e][t].duration=n}))},Yl.each=function(n,t){var e=this.id,r=this.namespace;if(arguments.length<2){var i=Ol,u=Hl;try{Hl=e,Y(this,function(t,i,u){Ol=t[r][e],n.call(t,t.__data__,i,u)})}finally{Ol=i,Hl=u}}else Y(this,function(i){var u=i[r][e];(u.event||(u.event=ao.dispatch("start","end","interrupt"))).on(n,t)});return this},Yl.transition=function(){for(var n,t,e,r,i=this.id,u=++Zl,o=this.namespace,a=[],l=0,c=this.length;c>l;l++){a.push(n=[]);for(var t=this[l],f=0,s=t.length;s>f;f++)(e=t[f])&&(r=e[o][i],Qu(e,f,o,u,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),n.push(e)}return Wu(a,o,u)},ao.svg.axis=function(){function n(n){n.each(function(){var n,c=ao.select(this),f=this.__chart__||e,s=this.__chart__=e.copy(),h=null==l?s.ticks?s.ticks.apply(s,a):s.domain():l,p=null==t?s.tickFormat?s.tickFormat.apply(s,a):m:t,g=c.selectAll(".tick").data(h,s),v=g.enter().insert("g",".domain").attr("class","tick").style("opacity",Uo),d=ao.transition(g.exit()).style("opacity",Uo).remove(),y=ao.transition(g.order()).style("opacity",1),M=Math.max(i,0)+o,x=Zi(s),b=c.selectAll(".domain").data([0]),_=(b.enter().append("path").attr("class","domain"),ao.transition(b));v.append("line"),v.append("text");var w,S,k,N,E=v.select("line"),A=y.select("line"),C=g.select("text").text(p),z=v.select("text"),L=y.select("text"),q="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(n=no,w="x",k="y",S="x2",N="y2",C.attr("dy",0>q?"0em":".71em").style("text-anchor","middle"),_.attr("d","M"+x[0]+","+q*u+"V0H"+x[1]+"V"+q*u)):(n=to,w="y",k="x",S="y2",N="x2",C.attr("dy",".32em").style("text-anchor",0>q?"end":"start"),_.attr("d","M"+q*u+","+x[0]+"H0V"+x[1]+"H"+q*u)),E.attr(N,q*i),z.attr(k,q*M),A.attr(S,0).attr(N,q*i),L.attr(w,0).attr(k,q*M),s.rangeBand){var T=s,R=T.rangeBand()/2;f=s=function(n){return T(n)+R}}else f.rangeBand?f=s:d.call(n,s,f);v.call(n,f,s),y.call(n,s,s)})}var t,e=ao.scale.linear(),r=Vl,i=6,u=6,o=3,a=[10],l=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Xl?t+"":Vl,n):r},n.ticks=function(){return arguments.length?(a=co(arguments),n):a},n.tickValues=function(t){return arguments.length?(l=t,n):l},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(i=+t,u=+arguments[e-1],n):i},n.innerTickSize=function(t){return arguments.length?(i=+t,n):i},n.outerTickSize=function(t){return arguments.length?(u=+t,n):u},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(){return arguments.length&&n},n};var Vl="bottom",Xl={top:1,right:1,bottom:1,left:1};ao.svg.brush=function(){function n(t){t.each(function(){var t=ao.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",u).on("touchstart.brush",u),o=t.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),t.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=t.selectAll(".resize").data(v,m);a.exit().remove(),a.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return $l[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",n.empty()?"none":null);var l,s=ao.transition(t),h=ao.transition(o);c&&(l=Zi(c),h.attr("x",l[0]).attr("width",l[1]-l[0]),r(s)),f&&(l=Zi(f),h.attr("y",l[0]).attr("height",l[1]-l[0]),i(s)),e(s)})}function e(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+s[+/e$/.test(n)]+","+h[+/^s/.test(n)]+")"})}function r(n){n.select(".extent").attr("x",s[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",s[1]-s[0])}function i(n){n.select(".extent").attr("y",h[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function u(){function u(){32==ao.event.keyCode&&(C||(M=null,L[0]-=s[1],L[1]-=h[1],C=2),S())}function v(){32==ao.event.keyCode&&2==C&&(L[0]+=s[1],L[1]+=h[1],C=0,S())}function d(){var n=ao.mouse(b),t=!1;x&&(n[0]+=x[0],n[1]+=x[1]),C||(ao.event.altKey?(M||(M=[(s[0]+s[1])/2,(h[0]+h[1])/2]),L[0]=s[+(n[0]f?(i=r,r=f):i=f),v[0]!=r||v[1]!=i?(e?a=null:o=null,v[0]=r,v[1]=i,!0):void 0}function m(){d(),k.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),ao.select("body").style("cursor",null),q.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),z(),w({type:"brushend"})}var M,x,b=this,_=ao.select(ao.event.target),w=l.of(b,arguments),k=ao.select(b),N=_.datum(),E=!/^(n|s)$/.test(N)&&c,A=!/^(e|w)$/.test(N)&&f,C=_.classed("extent"),z=W(b),L=ao.mouse(b),q=ao.select(t(b)).on("keydown.brush",u).on("keyup.brush",v);if(ao.event.changedTouches?q.on("touchmove.brush",d).on("touchend.brush",m):q.on("mousemove.brush",d).on("mouseup.brush",m),k.interrupt().selectAll("*").interrupt(),C)L[0]=s[0]-L[0],L[1]=h[0]-L[1];else if(N){var T=+/w$/.test(N),R=+/^n/.test(N);x=[s[1-T]-L[0],h[1-R]-L[1]],L[0]=s[T],L[1]=h[R]}else ao.event.altKey&&(M=L.slice());k.style("pointer-events","none").selectAll(".resize").style("display",null),ao.select("body").style("cursor",_.style("cursor")),w({type:"brushstart"}),d()}var o,a,l=N(n,"brushstart","brush","brushend"),c=null,f=null,s=[0,0],h=[0,0],p=!0,g=!0,v=Bl[0];return n.event=function(n){n.each(function(){var n=l.of(this,arguments),t={x:s,y:h,i:o,j:a},e=this.__chart__||t;this.__chart__=t,Hl?ao.select(this).transition().each("start.brush",function(){o=e.i,a=e.j,s=e.x,h=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=xr(s,t.x),r=xr(h,t.y);return o=a=null,function(i){s=t.x=e(i),h=t.y=r(i),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){o=t.i,a=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(c=t,v=Bl[!c<<1|!f],n):c},n.y=function(t){return arguments.length?(f=t,v=Bl[!c<<1|!f],n):f},n.clamp=function(t){return arguments.length?(c&&f?(p=!!t[0],g=!!t[1]):c?p=!!t:f&&(g=!!t),n):c&&f?[p,g]:c?p:f?g:null},n.extent=function(t){var e,r,i,u,l;return arguments.length?(c&&(e=t[0],r=t[1],f&&(e=e[0],r=r[0]),o=[e,r],c.invert&&(e=c(e),r=c(r)),e>r&&(l=e,e=r,r=l),e==s[0]&&r==s[1]||(s=[e,r])),f&&(i=t[0],u=t[1],c&&(i=i[1],u=u[1]),a=[i,u],f.invert&&(i=f(i),u=f(u)),i>u&&(l=i,i=u,u=l),i==h[0]&&u==h[1]||(h=[i,u])),n):(c&&(o?(e=o[0],r=o[1]):(e=s[0],r=s[1],c.invert&&(e=c.invert(e),r=c.invert(r)),e>r&&(l=e,e=r,r=l))),f&&(a?(i=a[0],u=a[1]):(i=h[0],u=h[1],f.invert&&(i=f.invert(i),u=f.invert(u)),i>u&&(l=i,i=u,u=l))),c&&f?[[e,i],[r,u]]:c?[e,r]:f&&[i,u])},n.clear=function(){return n.empty()||(s=[0,0],h=[0,0],o=a=null),n},n.empty=function(){return!!c&&s[0]==s[1]||!!f&&h[0]==h[1]},ao.rebind(n,l,"on")};var $l={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Bl=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Wl=ga.format=xa.timeFormat,Jl=Wl.utc,Gl=Jl("%Y-%m-%dT%H:%M:%S.%LZ");Wl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?eo:Gl,eo.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},eo.toString=Gl.toString,ga.second=On(function(n){return new va(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),ga.seconds=ga.second.range,ga.seconds.utc=ga.second.utc.range,ga.minute=On(function(n){return new va(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),ga.minutes=ga.minute.range,ga.minutes.utc=ga.minute.utc.range,ga.hour=On(function(n){var t=n.getTimezoneOffset()/60;return new va(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),ga.hours=ga.hour.range,ga.hours.utc=ga.hour.utc.range,ga.month=On(function(n){return n=ga.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),ga.months=ga.month.range,ga.months.utc=ga.month.utc.range;var Kl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Ql=[[ga.second,1],[ga.second,5],[ga.second,15],[ga.second,30],[ga.minute,1],[ga.minute,5],[ga.minute,15],[ga.minute,30],[ga.hour,1],[ga.hour,3],[ga.hour,6],[ga.hour,12],[ga.day,1],[ga.day,2],[ga.week,1],[ga.month,1],[ga.month,3],[ga.year,1]],nc=Wl.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",zt]]),tc={range:function(n,t,e){return ao.range(Math.ceil(n/e)*e,+t,e).map(io)},floor:m,ceil:m};Ql.year=ga.year,ga.scale=function(){return ro(ao.scale.linear(),Ql,nc)};var ec=Ql.map(function(n){return[n[0].utc,n[1]]}),rc=Jl.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",zt]]);ec.year=ga.year.utc,ga.scale.utc=function(){return ro(ao.scale.linear(),ec,rc)},ao.text=An(function(n){return n.responseText}),ao.json=function(n,t){return Cn(n,"application/json",uo,t)},ao.html=function(n,t){return Cn(n,"text/html",oo,t)},ao.xml=An(function(n){return n.responseXML}),"function"==typeof define&&define.amd?(this.d3=ao,define(ao)):"object"==typeof module&&module.exports?module.exports=ao:this.d3=ao}(); \ No newline at end of file diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/file.js b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/file.js new file mode 100644 index 0000000..756cc08 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/file.js @@ -0,0 +1,61 @@ + $(function() { + var $window = $(window) + , $top_link = $('#toplink') + , $body = $('body, html') + , offset = $('#code').offset().top + , hidePopover = function ($target) { + $target.data('popover-hover', false); + + setTimeout(function () { + if (!$target.data('popover-hover')) { + $target.popover('hide'); + } + }, 300); + }; + + $top_link.hide().click(function(event) { + event.preventDefault(); + $body.animate({scrollTop:0}, 800); + }); + + $window.scroll(function() { + if($window.scrollTop() > offset) { + $top_link.fadeIn(); + } else { + $top_link.fadeOut(); + } + }).scroll(); + + $('.popin') + .popover({trigger: 'manual'}) + .on({ + 'mouseenter.popover': function () { + var $target = $(this); + + $target.data('popover-hover', true); + + // popover already displayed + if ($target.next('.popover').length) { + return; + } + + // show the popover + $target.popover('show'); + + // register mouse events on the popover + $target.next('.popover:not(.popover-initialized)') + .on({ + 'mouseenter': function () { + $target.data('popover-hover', true); + }, + 'mouseleave': function () { + hidePopover($target); + } + }) + .addClass('popover-initialized'); + }, + 'mouseleave.popover': function () { + hidePopover($(this)); + } + }); + }); diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/jquery.min.js b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/jquery.min.js new file mode 100644 index 0000000..4d9b3a2 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js/jquery.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w(" + + + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForBankAccount/dashboard.html b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForBankAccount/dashboard.html new file mode 100644 index 0000000..6605ff9 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForBankAccount/dashboard.html @@ -0,0 +1,287 @@ + + + + + Dashboard for %s + + + + + + + +
+
+
+
+ +
+
+
+
+
+
+
+

Classes

+
+
+
+
+

Coverage Distribution

+
+ +
+
+
+

Complexity

+
+ +
+
+
+
+
+

Insufficient Coverage

+
+ + + + + + + + + + + +
ClassCoverage
BankAccount50%
+
+
+
+

Project Risks

+
+ + + + + + + + + + + +
ClassCRAP
BankAccount8
+
+
+
+
+
+

Methods

+
+
+
+
+

Coverage Distribution

+
+ +
+
+
+

Complexity

+
+ +
+
+
+
+
+

Insufficient Coverage

+
+ + + + + + + + + + + +
MethodCoverage
setBalance0%
+
+
+
+

Project Risks

+
+ + + + + + + + + + + +
MethodCRAP
setBalance6
+
+
+
+ +
+ + + + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForBankAccount/index.html b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForBankAccount/index.html new file mode 100644 index 0000000..bd0e78a --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForBankAccount/index.html @@ -0,0 +1,118 @@ + + + + + Code Coverage for %s + + + + + + + +
+
+
+
+ +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
+
+ 50.00% covered (danger) +
+
+
50.00%
5 / 10
+
+ 75.00% covered (warning) +
+
+
75.00%
3 / 4
+
+ 0.00% covered (danger) +
+
+
0.00%
0 / 1
BankAccount.php
+
+ 50.00% covered (danger) +
+
+
50.00%
5 / 10
+
+ 75.00% covered (warning) +
+
+
75.00%
3 / 4
+
+ 0.00% covered (danger) +
+
+
0.00%
0 / 1
+
+
+
+

Legend

+

+ Low: 0% to 50% + Medium: 50% to 90% + High: 90% to 100% +

+

+ Generated by php-code-coverage %s using %s at %s. +

+
+
+ + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/dashboard.html b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/dashboard.html new file mode 100644 index 0000000..07f7eae --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/dashboard.html @@ -0,0 +1,285 @@ + + + + + Dashboard for %s + + + + + + + +
+
+
+
+ +
+
+
+
+
+
+
+

Classes

+
+
+
+
+

Coverage Distribution

+
+ +
+
+
+

Complexity

+
+ +
+
+
+
+
+

Insufficient Coverage

+
+ + + + + + + + + + + +
ClassCoverage
CoveredClassWithAnonymousFunctionInStaticMethod87%
+
+
+
+

Project Risks

+
+ + + + + + + + + + +
ClassCRAP
+
+
+
+
+
+

Methods

+
+
+
+
+

Coverage Distribution

+
+ +
+
+
+

Complexity

+
+ +
+
+
+
+
+

Insufficient Coverage

+
+ + + + + + + + + + + +
MethodCoverage
runAnonymous87%
+
+
+
+

Project Risks

+
+ + + + + + + + + + +
MethodCRAP
+
+
+
+ +
+ + + + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/index.html b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/index.html new file mode 100644 index 0000000..90a15c2 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/index.html @@ -0,0 +1,118 @@ + + + + + Code Coverage for %s + + + + + + + +
+
+
+
+ +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
+
+ 87.50% covered (warning) +
+
+
87.50%
7 / 8
+
+ 0.00% covered (danger) +
+
+
0.00%
0 / 1
+
+ 0.00% covered (danger) +
+
+
0.00%
0 / 1
source_with_class_and_anonymous_function.php
+
+ 87.50% covered (warning) +
+
+
87.50%
7 / 8
+
+ 0.00% covered (danger) +
+
+
0.00%
0 / 1
+
+ 0.00% covered (danger) +
+
+
0.00%
0 / 1
+
+
+
+

Legend

+

+ Low: 0% to 50% + Medium: 50% to 90% + High: 90% to 100% +

+

+ Generated by php-code-coverage %s using %s at %s. +

+
+
+ + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.html b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.html new file mode 100644 index 0000000..85c4316 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.html @@ -0,0 +1,172 @@ + + + + + Code Coverage for %s%esource_with_class_and_anonymous_function.php + + + + + + + +
+
+
+
+ +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
+
+ 0.00% covered (danger) +
+
+
0.00%
0 / 1
+
+ 0.00% covered (danger) +
+
+
0.00%
0 / 1
CRAP
+
+ 87.50% covered (warning) +
+
+
87.50%
7 / 8
CoveredClassWithAnonymousFunctionInStaticMethod
+
+ 0.00% covered (danger) +
+
+
0.00%
0 / 1
+
+ 0.00% covered (danger) +
+
+
0.00%
0 / 1
1.00
+
+ 87.50% covered (warning) +
+
+
87.50%
7 / 8
 runAnonymous
+
+ 0.00% covered (danger) +
+
+
0.00%
0 / 1
1.00
+
+ 87.50% covered (warning) +
+
+
87.50%
7 / 8
+
+ + + + + + + + + + + + + + + + + + + + + + + +
<?php
class CoveredClassWithAnonymousFunctionInStaticMethod
{
    public static function runAnonymous()
    {
        $filter = ['abc124', 'abc123', '123'];
        array_walk(
            $filter,
            function (&$val, $key) {
                $val = preg_replace('|[^0-9]|', '', $val);
            }
        );
        // Should be covered
        $extravar = true;
    }
}
+ +
+ + + + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/dashboard.html b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/dashboard.html new file mode 100644 index 0000000..360409a --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/dashboard.html @@ -0,0 +1,283 @@ + + + + + Dashboard for %s + + + + + + + +
+
+
+
+ +
+
+
+
+
+
+
+

Classes

+
+
+
+
+

Coverage Distribution

+
+ +
+
+
+

Complexity

+
+ +
+
+
+
+
+

Insufficient Coverage

+
+ + + + + + + + + + +
ClassCoverage
+
+
+
+

Project Risks

+
+ + + + + + + + + + +
ClassCRAP
+
+
+
+
+
+

Methods

+
+
+
+
+

Coverage Distribution

+
+ +
+
+
+

Complexity

+
+ +
+
+
+
+
+

Insufficient Coverage

+
+ + + + + + + + + + +
MethodCoverage
+
+
+
+

Project Risks

+
+ + + + + + + + + + +
MethodCRAP
+
+
+
+ +
+ + + + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/index.html b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/index.html new file mode 100644 index 0000000..8f55038 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/index.html @@ -0,0 +1,108 @@ + + + + + Code Coverage for %s + + + + + + + +
+
+
+
+ +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
+
+ 50.00% covered (danger) +
+
+
50.00%
1 / 2
+
+ 100.00% covered (success) +
+
+
100.00%
1 / 1
n/a
0 / 0
source_with_ignore.php
+
+ 50.00% covered (danger) +
+
+
50.00%
1 / 2
+
+ 100.00% covered (success) +
+
+
100.00%
1 / 1
n/a
0 / 0
+
+
+
+

Legend

+

+ Low: 0% to 50% + Medium: 50% to 90% + High: 90% to 100% +

+

+ Generated by php-code-coverage %s using %s at %s. +

+
+
+ + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html new file mode 100644 index 0000000..0949eda --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html @@ -0,0 +1,196 @@ + + + + + Code Coverage for %s/source_with_ignore.php + + + + + + + +
+
+
+
+ +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
n/a
0 / 0
+
+ 100.00% covered (success) +
+
+
100.00%
1 / 1
CRAP
+
+ 50.00% covered (danger) +
+
+
50.00%
1 / 2
baz
n/a
0 / 0
1
n/a
0 / 0
Foo
n/a
0 / 0
n/a
0 / 0
1
n/a
0 / 0
 bar
n/a
0 / 0
1
n/a
0 / 0
Bar
n/a
0 / 0
n/a
0 / 0
1
n/a
0 / 0
 foo
n/a
0 / 0
1
n/a
0 / 0
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
<?php
if ($neverHappens) {
    // @codeCoverageIgnoreStart
    print '*';
    // @codeCoverageIgnoreEnd
}
/**
 * @codeCoverageIgnore
 */
class Foo
{
    public function bar()
    {
    }
}
class Bar
{
    /**
     * @codeCoverageIgnore
     */
    public function foo()
    {
    }
}
function baz()
{
    print '*'; // @codeCoverageIgnore
}
interface Bor
{
    public function foo();
}
+ +
+ + + + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForBankAccount/BankAccount.php.xml b/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForBankAccount/BankAccount.php.xml new file mode 100644 index 0000000..359f6a3 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForBankAccount/BankAccount.php.xml @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <?php + + + class + + BankAccount + + + { + + + + protected + + $balance + + = + + 0 + ; + + + + + public + + function + + getBalance + ( + ) + + + + { + + + + return + + $this + -> + balance + ; + + + + } + + + + + protected + + function + + setBalance + ( + $balance + ) + + + + { + + + + if + + ( + $balance + + >= + + 0 + ) + + { + + + + $this + -> + balance + + = + + $balance + ; + + + + } + + else + + { + + + + throw + + new + + RuntimeException + ; + + + + } + + + + } + + + + + public + + function + + depositMoney + ( + $balance + ) + + + + { + + + + $this + -> + setBalance + ( + $this + -> + getBalance + ( + ) + + + + + $balance + ) + ; + + + + + return + + $this + -> + getBalance + ( + ) + ; + + + + } + + + + + public + + function + + withdrawMoney + ( + $balance + ) + + + + { + + + + $this + -> + setBalance + ( + $this + -> + getBalance + ( + ) + + - + + $balance + ) + ; + + + + + return + + $this + -> + getBalance + ( + ) + ; + + + + } + + + } + + + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForBankAccount/index.xml b/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForBankAccount/index.xml new file mode 100644 index 0000000..3d73a56 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForBankAccount/index.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/index.xml b/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/index.xml new file mode 100644 index 0000000..a2e6ad4 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/index.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.xml b/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.xml new file mode 100644 index 0000000..a413174 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.xml @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <?php + + + + class + + CoveredClassWithAnonymousFunctionInStaticMethod + + + { + + + + public + + static + + function + + runAnonymous + ( + ) + + + + { + + + + $filter + + = + + [ + 'abc124' + , + + 'abc123' + , + + '123' + ] + ; + + + + + array_walk + ( + + + + $filter + , + + + + function + + ( + & + $val + , + + $key + ) + + { + + + + $val + + = + + preg_replace + ( + '|[^0-9]|' + , + + '' + , + + $val + ) + ; + + + + } + + + + ) + ; + + + + + // Should be covered + + + + $extravar + + = + + true + ; + + + + } + + + } + + + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/index.xml b/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/index.xml new file mode 100644 index 0000000..1fe281e --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/index.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/source_with_ignore.php.xml b/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/source_with_ignore.php.xml new file mode 100644 index 0000000..5ff1d6b --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/source_with_ignore.php.xml @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <?php + + + if + + ( + $neverHappens + ) + + { + + + + // @codeCoverageIgnoreStart + + + + print + + '*' + ; + + + + // @codeCoverageIgnoreEnd + + + } + + + + /** + + + * @codeCoverageIgnore + + + */ + + + class + + Foo + + + { + + + + public + + function + + bar + ( + ) + + + + { + + + + } + + + } + + + + class + + Bar + + + { + + + + /** + + + * @codeCoverageIgnore + + + */ + + + + public + + function + + foo + ( + ) + + + + { + + + + } + + + } + + + + function + + baz + ( + ) + + + { + + + + print + + '*' + ; + + // @codeCoverageIgnore + + + } + + + + interface + + Bor + + + { + + + + public + + function + + foo + ( + ) + ; + + + + } + + + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/class-with-anonymous-function-clover.xml b/vendor/phpunit/php-code-coverage/tests/_files/class-with-anonymous-function-clover.xml new file mode 100644 index 0000000..008db55 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/class-with-anonymous-function-clover.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/class-with-anonymous-function-crap4j.xml b/vendor/phpunit/php-code-coverage/tests/_files/class-with-anonymous-function-crap4j.xml new file mode 100644 index 0000000..5bd2535 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/class-with-anonymous-function-crap4j.xml @@ -0,0 +1,26 @@ + + + CoverageForClassWithAnonymousFunction + %s + + Method Crap Stats + 1 + 0 + 0 + 1 + 0 + + + + global + CoveredClassWithAnonymousFunctionInStaticMethod + runAnonymous + runAnonymous() + runAnonymous() + 1 + 1 + 87.5 + 0 + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/class-with-anonymous-function-text.txt b/vendor/phpunit/php-code-coverage/tests/_files/class-with-anonymous-function-text.txt new file mode 100644 index 0000000..e4204cc --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/class-with-anonymous-function-text.txt @@ -0,0 +1,12 @@ + + +Code Coverage Report: + %s + + Summary: + Classes: 0.00% (0/1) + Methods: 0.00% (0/1) + Lines: 87.50% (7/8) + +CoveredClassWithAnonymousFunctionInStaticMethod + Methods: 0.00% ( 0/ 1) Lines: 87.50% ( 7/ 8) diff --git a/vendor/phpunit/php-code-coverage/tests/_files/ignored-lines-clover.xml b/vendor/phpunit/php-code-coverage/tests/_files/ignored-lines-clover.xml new file mode 100644 index 0000000..efd3801 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/ignored-lines-clover.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/ignored-lines-crap4j.xml b/vendor/phpunit/php-code-coverage/tests/_files/ignored-lines-crap4j.xml new file mode 100644 index 0000000..2607b59 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/ignored-lines-crap4j.xml @@ -0,0 +1,37 @@ + + + CoverageForFileWithIgnoredLines + %s + + Method Crap Stats + 2 + 0 + 0 + 2 + 0 + + + + global + Foo + bar + bar() + bar() + 1 + 1 + 100 + 0 + + + global + Bar + foo + foo() + foo() + 1 + 1 + 100 + 0 + + + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/ignored-lines-text.txt b/vendor/phpunit/php-code-coverage/tests/_files/ignored-lines-text.txt new file mode 100644 index 0000000..6e8e149 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/ignored-lines-text.txt @@ -0,0 +1,10 @@ + + +Code Coverage Report:%w + %s +%w + Summary:%w + Classes: (0/0) + Methods: (0/0) + Lines: 50.00% (1/2) + diff --git a/vendor/phpunit/php-code-coverage/tests/_files/source_with_class_and_anonymous_function.php b/vendor/phpunit/php-code-coverage/tests/_files/source_with_class_and_anonymous_function.php new file mode 100644 index 0000000..72aa938 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/_files/source_with_class_and_anonymous_function.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Report; + +use SebastianBergmann\CodeCoverage\Driver\Driver; +use SebastianBergmann\CodeCoverage\CodeCoverage; +use SebastianBergmann\CodeCoverage\Filter; +use SebastianBergmann\CodeCoverage\TestCase; +use SebastianBergmann\CodeCoverage\Node\Builder; + +class BuilderTest extends TestCase +{ + protected $factory; + + protected function setUp() + { + $this->factory = new Builder; + } + + public function testSomething() + { + $root = $this->getCoverageForBankAccount()->getReport(); + + $expectedPath = rtrim(TEST_FILES_PATH, DIRECTORY_SEPARATOR); + $this->assertEquals($expectedPath, $root->getName()); + $this->assertEquals($expectedPath, $root->getPath()); + $this->assertEquals(10, $root->getNumExecutableLines()); + $this->assertEquals(5, $root->getNumExecutedLines()); + $this->assertEquals(1, $root->getNumClasses()); + $this->assertEquals(0, $root->getNumTestedClasses()); + $this->assertEquals(4, $root->getNumMethods()); + $this->assertEquals(3, $root->getNumTestedMethods()); + $this->assertEquals('0.00%', $root->getTestedClassesPercent()); + $this->assertEquals('75.00%', $root->getTestedMethodsPercent()); + $this->assertEquals('50.00%', $root->getLineExecutedPercent()); + $this->assertEquals(0, $root->getNumFunctions()); + $this->assertEquals(0, $root->getNumTestedFunctions()); + $this->assertNull($root->getParent()); + $this->assertEquals([], $root->getDirectories()); + #$this->assertEquals(array(), $root->getFiles()); + #$this->assertEquals(array(), $root->getChildNodes()); + + $this->assertEquals( + [ + 'BankAccount' => [ + 'methods' => [ + 'getBalance' => [ + 'signature' => 'getBalance()', + 'startLine' => 6, + 'endLine' => 9, + 'executableLines' => 1, + 'executedLines' => 1, + 'ccn' => 1, + 'coverage' => 100, + 'crap' => '1', + 'link' => 'BankAccount.php.html#6', + 'methodName' => 'getBalance', + 'visibility' => 'public', + ], + 'setBalance' => [ + 'signature' => 'setBalance($balance)', + 'startLine' => 11, + 'endLine' => 18, + 'executableLines' => 5, + 'executedLines' => 0, + 'ccn' => 2, + 'coverage' => 0, + 'crap' => 6, + 'link' => 'BankAccount.php.html#11', + 'methodName' => 'setBalance', + 'visibility' => 'protected', + ], + 'depositMoney' => [ + 'signature' => 'depositMoney($balance)', + 'startLine' => 20, + 'endLine' => 25, + 'executableLines' => 2, + 'executedLines' => 2, + 'ccn' => 1, + 'coverage' => 100, + 'crap' => '1', + 'link' => 'BankAccount.php.html#20', + 'methodName' => 'depositMoney', + 'visibility' => 'public', + ], + 'withdrawMoney' => [ + 'signature' => 'withdrawMoney($balance)', + 'startLine' => 27, + 'endLine' => 32, + 'executableLines' => 2, + 'executedLines' => 2, + 'ccn' => 1, + 'coverage' => 100, + 'crap' => '1', + 'link' => 'BankAccount.php.html#27', + 'methodName' => 'withdrawMoney', + 'visibility' => 'public', + ], + ], + 'startLine' => 2, + 'executableLines' => 10, + 'executedLines' => 5, + 'ccn' => 5, + 'coverage' => 50, + 'crap' => '8.12', + 'package' => [ + 'namespace' => '', + 'fullPackage' => '', + 'category' => '', + 'package' => '', + 'subpackage' => '' + ], + 'link' => 'BankAccount.php.html#2', + 'className' => 'BankAccount' + ] + ], + $root->getClasses() + ); + + $this->assertEquals([], $root->getFunctions()); + } + + public function testNotCrashParsing() + { + $coverage = $this->getCoverageForCrashParsing(); + $root = $coverage->getReport(); + + $expectedPath = rtrim(TEST_FILES_PATH, DIRECTORY_SEPARATOR); + $this->assertEquals($expectedPath, $root->getName()); + $this->assertEquals($expectedPath, $root->getPath()); + $this->assertEquals(2, $root->getNumExecutableLines()); + $this->assertEquals(0, $root->getNumExecutedLines()); + $data = $coverage->getData(); + $expectedFile = $expectedPath . DIRECTORY_SEPARATOR . 'Crash.php'; + $this->assertSame([$expectedFile => [1 => [], 2 => []]], $data); + } + + public function testBuildDirectoryStructure() + { + $s = \DIRECTORY_SEPARATOR; + + $method = new \ReflectionMethod( + Builder::class, + 'buildDirectoryStructure' + ); + + $method->setAccessible(true); + + $this->assertEquals( + [ + 'src' => [ + 'Money.php/f' => [], + 'MoneyBag.php/f' => [], + 'Foo' => [ + 'Bar' => [ + 'Baz' => [ + 'Foo.php/f' => [], + ], + ], + ], + ] + ], + $method->invoke( + $this->factory, + [ + "src{$s}Money.php" => [], + "src{$s}MoneyBag.php" => [], + "src{$s}Foo{$s}Bar{$s}Baz{$s}Foo.php" => [], + ] + ) + ); + } + + /** + * @dataProvider reducePathsProvider + */ + public function testReducePaths($reducedPaths, $commonPath, $paths) + { + $method = new \ReflectionMethod( + Builder::class, + 'reducePaths' + ); + + $method->setAccessible(true); + + $_commonPath = $method->invokeArgs($this->factory, [&$paths]); + + $this->assertEquals($reducedPaths, $paths); + $this->assertEquals($commonPath, $_commonPath); + } + + public function reducePathsProvider() + { + $s = \DIRECTORY_SEPARATOR; + + yield [ + [], + ".", + [] + ]; + + $prefixes = ["C:$s", "$s"]; + + foreach($prefixes as $p){ + yield [ + [ + "Money.php" => [] + ], + "{$p}home{$s}sb{$s}Money{$s}", + [ + "{$p}home{$s}sb{$s}Money{$s}Money.php" => [] + ] + ]; + + yield [ + [ + "Money.php" => [], + "MoneyBag.php" => [] + ], + "{$p}home{$s}sb{$s}Money", + [ + "{$p}home{$s}sb{$s}Money{$s}Money.php" => [], + "{$p}home{$s}sb{$s}Money{$s}MoneyBag.php" => [] + ] + ]; + + yield [ + [ + "Money.php" => [], + "MoneyBag.php" => [], + "Cash.phar{$s}Cash.php" => [], + ], + "{$p}home{$s}sb{$s}Money", + [ + "{$p}home{$s}sb{$s}Money{$s}Money.php" => [], + "{$p}home{$s}sb{$s}Money{$s}MoneyBag.php" => [], + "phar://{$p}home{$s}sb{$s}Money{$s}Cash.phar{$s}Cash.php" => [], + ], + ]; + } + } +} diff --git a/vendor/phpunit/php-code-coverage/tests/tests/CloverTest.php b/vendor/phpunit/php-code-coverage/tests/tests/CloverTest.php new file mode 100644 index 0000000..85743ab --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/tests/CloverTest.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Report; + +use SebastianBergmann\CodeCoverage\TestCase; + +/** + * @covers SebastianBergmann\CodeCoverage\Report\Clover + */ +class CloverTest extends TestCase +{ + public function testCloverForBankAccountTest() + { + $clover = new Clover; + + $this->assertStringMatchesFormatFile( + TEST_FILES_PATH . 'BankAccount-clover.xml', + $clover->process($this->getCoverageForBankAccount(), null, 'BankAccount') + ); + } + + public function testCloverForFileWithIgnoredLines() + { + $clover = new Clover; + + $this->assertStringMatchesFormatFile( + TEST_FILES_PATH . 'ignored-lines-clover.xml', + $clover->process($this->getCoverageForFileWithIgnoredLines()) + ); + } + + public function testCloverForClassWithAnonymousFunction() + { + $clover = new Clover; + + $this->assertStringMatchesFormatFile( + TEST_FILES_PATH . 'class-with-anonymous-function-clover.xml', + $clover->process($this->getCoverageForClassWithAnonymousFunction()) + ); + } +} diff --git a/vendor/phpunit/php-code-coverage/tests/tests/CodeCoverageTest.php b/vendor/phpunit/php-code-coverage/tests/tests/CodeCoverageTest.php new file mode 100644 index 0000000..f217f8d --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/tests/CodeCoverageTest.php @@ -0,0 +1,499 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage; + +require __DIR__ . '/../_files/BankAccount.php'; +require __DIR__ . '/../_files/BankAccountTest.php'; + +use SebastianBergmann\CodeCoverage\Driver\Driver; +use SebastianBergmann\CodeCoverage\Driver\PHPDBG; +use SebastianBergmann\CodeCoverage\Driver\Xdebug; + +/** + * @covers SebastianBergmann\CodeCoverage\CodeCoverage + */ +class CodeCoverageTest extends TestCase +{ + /** + * @var CodeCoverage + */ + private $coverage; + + protected function setUp() + { + $this->coverage = new CodeCoverage; + } + + public function testCanBeConstructedForXdebugWithoutGivenFilterObject() + { + if (PHP_SAPI == 'phpdbg') { + $this->markTestSkipped('Requires PHP CLI and Xdebug'); + } + + $this->assertAttributeInstanceOf( + Xdebug::class, + 'driver', + $this->coverage + ); + + $this->assertAttributeInstanceOf( + Filter::class, + 'filter', + $this->coverage + ); + } + + public function testCanBeConstructedForXdebugWithGivenFilterObject() + { + if (PHP_SAPI == 'phpdbg') { + $this->markTestSkipped('Requires PHP CLI and Xdebug'); + } + + $filter = new Filter; + $coverage = new CodeCoverage(null, $filter); + + $this->assertAttributeInstanceOf( + Xdebug::class, + 'driver', + $coverage + ); + + $this->assertSame($filter, $coverage->filter()); + } + + public function testCanBeConstructedForPhpdbgWithoutGivenFilterObject() + { + if (PHP_SAPI != 'phpdbg') { + $this->markTestSkipped('Requires PHPDBG'); + } + + $this->assertAttributeInstanceOf( + PHPDBG::class, + 'driver', + $this->coverage + ); + + $this->assertAttributeInstanceOf( + Filter::class, + 'filter', + $this->coverage + ); + } + + public function testCanBeConstructedForPhpdbgWithGivenFilterObject() + { + if (PHP_SAPI != 'phpdbg') { + $this->markTestSkipped('Requires PHPDBG'); + } + + $filter = new Filter; + $coverage = new CodeCoverage(null, $filter); + + $this->assertAttributeInstanceOf( + PHPDBG::class, + 'driver', + $coverage + ); + + $this->assertSame($filter, $coverage->filter()); + } + + public function testCannotStopWithInvalidSecondArgument() + { + $this->expectException(Exception::class); + + $this->coverage->stop(true, null); + } + + public function testCannotAppendWithInvalidArgument() + { + $this->expectException(Exception::class); + + $this->coverage->append([], null); + } + + public function testSetCacheTokens() + { + $this->coverage->setCacheTokens(true); + + $this->assertAttributeEquals(true, 'cacheTokens', $this->coverage); + } + + public function testSetCheckForUnintentionallyCoveredCode() + { + $this->coverage->setCheckForUnintentionallyCoveredCode(true); + + $this->assertAttributeEquals( + true, + 'checkForUnintentionallyCoveredCode', + $this->coverage + ); + } + + public function testSetCheckForMissingCoversAnnotation() + { + $this->coverage->setCheckForMissingCoversAnnotation(true); + + $this->assertAttributeEquals( + true, + 'checkForMissingCoversAnnotation', + $this->coverage + ); + } + + public function testSetForceCoversAnnotation() + { + $this->coverage->setForceCoversAnnotation(true); + + $this->assertAttributeEquals( + true, + 'forceCoversAnnotation', + $this->coverage + ); + } + + public function testSetCheckForUnexecutedCoveredCode() + { + $this->coverage->setCheckForUnexecutedCoveredCode(true); + + $this->assertAttributeEquals( + true, + 'checkForUnexecutedCoveredCode', + $this->coverage + ); + } + + public function testSetAddUncoveredFilesFromWhitelist() + { + $this->coverage->setAddUncoveredFilesFromWhitelist(true); + + $this->assertAttributeEquals( + true, + 'addUncoveredFilesFromWhitelist', + $this->coverage + ); + } + + public function testSetProcessUncoveredFilesFromWhitelist() + { + $this->coverage->setProcessUncoveredFilesFromWhitelist(true); + + $this->assertAttributeEquals( + true, + 'processUncoveredFilesFromWhitelist', + $this->coverage + ); + } + + public function testSetIgnoreDeprecatedCode() + { + $this->coverage->setIgnoreDeprecatedCode(true); + + $this->assertAttributeEquals( + true, + 'ignoreDeprecatedCode', + $this->coverage + ); + } + + public function testClear() + { + $this->coverage->clear(); + + $this->assertAttributeEquals(null, 'currentId', $this->coverage); + $this->assertAttributeEquals([], 'data', $this->coverage); + $this->assertAttributeEquals([], 'tests', $this->coverage); + } + + public function testCollect() + { + $coverage = $this->getCoverageForBankAccount(); + + $this->assertEquals( + $this->getExpectedDataArrayForBankAccount(), + $coverage->getData() + ); + + $this->assertEquals( + [ + 'BankAccountTest::testBalanceIsInitiallyZero' => ['size' => 'unknown', 'status' => -1], + 'BankAccountTest::testBalanceCannotBecomeNegative' => ['size' => 'unknown', 'status' => -1], + 'BankAccountTest::testBalanceCannotBecomeNegative2' => ['size' => 'unknown', 'status' => -1], + 'BankAccountTest::testDepositWithdrawMoney' => ['size' => 'unknown', 'status' => -1] + ], + $coverage->getTests() + ); + } + + public function testMerge() + { + $coverage = $this->getCoverageForBankAccountForFirstTwoTests(); + $coverage->merge($this->getCoverageForBankAccountForLastTwoTests()); + + $this->assertEquals( + $this->getExpectedDataArrayForBankAccount(), + $coverage->getData() + ); + } + + public function testMergeReverseOrder() + { + $coverage = $this->getCoverageForBankAccountForLastTwoTests(); + $coverage->merge($this->getCoverageForBankAccountForFirstTwoTests()); + + $this->assertEquals( + $this->getExpectedDataArrayForBankAccountInReverseOrder(), + $coverage->getData() + ); + } + + public function testMerge2() + { + $coverage = new CodeCoverage( + $this->createMock(Driver::class), + new Filter + ); + + $coverage->merge($this->getCoverageForBankAccount()); + + $this->assertEquals( + $this->getExpectedDataArrayForBankAccount(), + $coverage->getData() + ); + } + + public function testGetLinesToBeIgnored() + { + $this->assertEquals( + [ + 1, + 3, + 4, + 5, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 30, + 32, + 33, + 34, + 35, + 36, + 37, + 38 + ], + $this->getLinesToBeIgnored()->invoke( + $this->coverage, + TEST_FILES_PATH . 'source_with_ignore.php' + ) + ); + } + + public function testGetLinesToBeIgnored2() + { + $this->assertEquals( + [1, 5], + $this->getLinesToBeIgnored()->invoke( + $this->coverage, + TEST_FILES_PATH . 'source_without_ignore.php' + ) + ); + } + + public function testGetLinesToBeIgnored3() + { + $this->assertEquals( + [ + 1, + 2, + 3, + 4, + 5, + 8, + 11, + 15, + 16, + 19, + 20 + ], + $this->getLinesToBeIgnored()->invoke( + $this->coverage, + TEST_FILES_PATH . 'source_with_class_and_anonymous_function.php' + ) + ); + } + + public function testGetLinesToBeIgnoredOneLineAnnotations() + { + $this->assertEquals( + [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 14, + 15, + 16, + 18, + 20, + 21, + 23, + 24, + 25, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 37 + ], + $this->getLinesToBeIgnored()->invoke( + $this->coverage, + TEST_FILES_PATH . 'source_with_oneline_annotations.php' + ) + ); + } + + /** + * @return \ReflectionMethod + */ + private function getLinesToBeIgnored() + { + $getLinesToBeIgnored = new \ReflectionMethod( + 'SebastianBergmann\CodeCoverage\CodeCoverage', + 'getLinesToBeIgnored' + ); + + $getLinesToBeIgnored->setAccessible(true); + + return $getLinesToBeIgnored; + } + + public function testGetLinesToBeIgnoredWhenIgnoreIsDisabled() + { + $this->coverage->setDisableIgnoredLines(true); + + $this->assertEquals( + [ + 7, + 11, + 12, + 13, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 26, + 27, + 32, + 33, + 34, + 35, + 36, + 37 + ], + $this->getLinesToBeIgnored()->invoke( + $this->coverage, + TEST_FILES_PATH . 'source_with_ignore.php' + ) + ); + } + + public function testAppendThrowsExceptionIfCoveredCodeWasNotExecuted() + { + $this->coverage->filter()->addDirectoryToWhitelist(TEST_FILES_PATH); + $this->coverage->setCheckForUnexecutedCoveredCode(true); + + $data = [ + TEST_FILES_PATH . 'BankAccount.php' => [ + 29 => -1, + 31 => -1 + ] + ]; + + $linesToBeCovered = [ + TEST_FILES_PATH . 'BankAccount.php' => [ + 22, + 24 + ] + ]; + + $linesToBeUsed = []; + + $this->expectException(CoveredCodeNotExecutedException::class); + + $this->coverage->append($data, 'File1.php', true, $linesToBeCovered, $linesToBeUsed); + } + + public function testAppendThrowsExceptionIfUsedCodeWasNotExecuted() + { + $this->coverage->filter()->addDirectoryToWhitelist(TEST_FILES_PATH); + $this->coverage->setCheckForUnexecutedCoveredCode(true); + + $data = [ + TEST_FILES_PATH . 'BankAccount.php' => [ + 29 => -1, + 31 => -1 + ] + ]; + + $linesToBeCovered = [ + TEST_FILES_PATH . 'BankAccount.php' => [ + 29, + 31 + ] + ]; + + $linesToBeUsed = [ + TEST_FILES_PATH . 'BankAccount.php' => [ + 22, + 24 + ] + ]; + + $this->expectException(CoveredCodeNotExecutedException::class); + + $this->coverage->append($data, 'File1.php', true, $linesToBeCovered, $linesToBeUsed); + } +} diff --git a/vendor/phpunit/php-code-coverage/tests/tests/Crap4jTest.php b/vendor/phpunit/php-code-coverage/tests/tests/Crap4jTest.php new file mode 100644 index 0000000..faa1ac5 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/tests/Crap4jTest.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Report; + +use SebastianBergmann\CodeCoverage\TestCase; + +/** + * @covers SebastianBergmann\CodeCoverage\Report\Crap4j + */ +class Crap4jTest extends TestCase +{ + public function testForBankAccountTest() + { + $crap4j = new Crap4j; + + $this->assertStringMatchesFormatFile( + TEST_FILES_PATH . 'BankAccount-crap4j.xml', + $crap4j->process($this->getCoverageForBankAccount(), null, 'BankAccount') + ); + } + + public function testForFileWithIgnoredLines() + { + $crap4j = new Crap4j; + + $this->assertStringMatchesFormatFile( + TEST_FILES_PATH . 'ignored-lines-crap4j.xml', + $crap4j->process($this->getCoverageForFileWithIgnoredLines(), null, 'CoverageForFileWithIgnoredLines') + ); + } + + public function testForClassWithAnonymousFunction() + { + $crap4j = new Crap4j; + + $this->assertStringMatchesFormatFile( + TEST_FILES_PATH . 'class-with-anonymous-function-crap4j.xml', + $crap4j->process($this->getCoverageForClassWithAnonymousFunction(), null, 'CoverageForClassWithAnonymousFunction') + ); + } +} diff --git a/vendor/phpunit/php-code-coverage/tests/tests/FilterTest.php b/vendor/phpunit/php-code-coverage/tests/tests/FilterTest.php new file mode 100644 index 0000000..4c90fca --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/tests/FilterTest.php @@ -0,0 +1,198 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage; + +use PHPUnit\Framework\TestCase; +use SebastianBergmann\FileIterator\Facade as FileIteratorFacade; + +class FilterTest extends TestCase +{ + /** + * @var Filter + */ + private $filter; + + /** + * @var array + */ + private $files = []; + + protected function setUp() + { + $this->filter = unserialize('O:37:"SebastianBergmann\CodeCoverage\Filter":0:{}'); + + $this->files = [ + TEST_FILES_PATH . 'BankAccount.php', + TEST_FILES_PATH . 'BankAccountTest.php', + TEST_FILES_PATH . 'CoverageClassExtendedTest.php', + TEST_FILES_PATH . 'CoverageClassTest.php', + TEST_FILES_PATH . 'CoverageFunctionParenthesesTest.php', + TEST_FILES_PATH . 'CoverageFunctionParenthesesWhitespaceTest.php', + TEST_FILES_PATH . 'CoverageFunctionTest.php', + TEST_FILES_PATH . 'CoverageMethodOneLineAnnotationTest.php', + TEST_FILES_PATH . 'CoverageMethodParenthesesTest.php', + TEST_FILES_PATH . 'CoverageMethodParenthesesWhitespaceTest.php', + TEST_FILES_PATH . 'CoverageMethodTest.php', + TEST_FILES_PATH . 'CoverageNoneTest.php', + TEST_FILES_PATH . 'CoverageNotPrivateTest.php', + TEST_FILES_PATH . 'CoverageNotProtectedTest.php', + TEST_FILES_PATH . 'CoverageNotPublicTest.php', + TEST_FILES_PATH . 'CoverageNothingTest.php', + TEST_FILES_PATH . 'CoveragePrivateTest.php', + TEST_FILES_PATH . 'CoverageProtectedTest.php', + TEST_FILES_PATH . 'CoveragePublicTest.php', + TEST_FILES_PATH . 'CoverageTwoDefaultClassAnnotations.php', + TEST_FILES_PATH . 'CoveredClass.php', + TEST_FILES_PATH . 'CoveredFunction.php', + TEST_FILES_PATH . 'Crash.php', + TEST_FILES_PATH . 'NamespaceCoverageClassExtendedTest.php', + TEST_FILES_PATH . 'NamespaceCoverageClassTest.php', + TEST_FILES_PATH . 'NamespaceCoverageCoversClassPublicTest.php', + TEST_FILES_PATH . 'NamespaceCoverageCoversClassTest.php', + TEST_FILES_PATH . 'NamespaceCoverageMethodTest.php', + TEST_FILES_PATH . 'NamespaceCoverageNotPrivateTest.php', + TEST_FILES_PATH . 'NamespaceCoverageNotProtectedTest.php', + TEST_FILES_PATH . 'NamespaceCoverageNotPublicTest.php', + TEST_FILES_PATH . 'NamespaceCoveragePrivateTest.php', + TEST_FILES_PATH . 'NamespaceCoverageProtectedTest.php', + TEST_FILES_PATH . 'NamespaceCoveragePublicTest.php', + TEST_FILES_PATH . 'NamespaceCoveredClass.php', + TEST_FILES_PATH . 'NotExistingCoveredElementTest.php', + TEST_FILES_PATH . 'source_with_class_and_anonymous_function.php', + TEST_FILES_PATH . 'source_with_ignore.php', + TEST_FILES_PATH . 'source_with_namespace.php', + TEST_FILES_PATH . 'source_with_oneline_annotations.php', + TEST_FILES_PATH . 'source_without_ignore.php', + TEST_FILES_PATH . 'source_without_namespace.php' + ]; + } + + /** + * @covers SebastianBergmann\CodeCoverage\Filter::addFileToWhitelist + * @covers SebastianBergmann\CodeCoverage\Filter::getWhitelist + */ + public function testAddingAFileToTheWhitelistWorks() + { + $this->filter->addFileToWhitelist($this->files[0]); + + $this->assertEquals( + [$this->files[0]], + $this->filter->getWhitelist() + ); + } + + /** + * @covers SebastianBergmann\CodeCoverage\Filter::removeFileFromWhitelist + * @covers SebastianBergmann\CodeCoverage\Filter::getWhitelist + */ + public function testRemovingAFileFromTheWhitelistWorks() + { + $this->filter->addFileToWhitelist($this->files[0]); + $this->filter->removeFileFromWhitelist($this->files[0]); + + $this->assertEquals([], $this->filter->getWhitelist()); + } + + /** + * @covers SebastianBergmann\CodeCoverage\Filter::addDirectoryToWhitelist + * @covers SebastianBergmann\CodeCoverage\Filter::getWhitelist + * @depends testAddingAFileToTheWhitelistWorks + */ + public function testAddingADirectoryToTheWhitelistWorks() + { + $this->filter->addDirectoryToWhitelist(TEST_FILES_PATH); + + $whitelist = $this->filter->getWhitelist(); + sort($whitelist); + + $this->assertEquals($this->files, $whitelist); + } + + /** + * @covers SebastianBergmann\CodeCoverage\Filter::addFilesToWhitelist + * @covers SebastianBergmann\CodeCoverage\Filter::getWhitelist + */ + public function testAddingFilesToTheWhitelistWorks() + { + $facade = new FileIteratorFacade; + + $files = $facade->getFilesAsArray( + TEST_FILES_PATH, + $suffixes = '.php' + ); + + $this->filter->addFilesToWhitelist($files); + + $whitelist = $this->filter->getWhitelist(); + sort($whitelist); + + $this->assertEquals($this->files, $whitelist); + } + + /** + * @covers SebastianBergmann\CodeCoverage\Filter::removeDirectoryFromWhitelist + * @covers SebastianBergmann\CodeCoverage\Filter::getWhitelist + * @depends testAddingADirectoryToTheWhitelistWorks + */ + public function testRemovingADirectoryFromTheWhitelistWorks() + { + $this->filter->addDirectoryToWhitelist(TEST_FILES_PATH); + $this->filter->removeDirectoryFromWhitelist(TEST_FILES_PATH); + + $this->assertEquals([], $this->filter->getWhitelist()); + } + + /** + * @covers SebastianBergmann\CodeCoverage\Filter::isFile + */ + public function testIsFile() + { + $this->assertFalse($this->filter->isFile('vfs://root/a/path')); + $this->assertFalse($this->filter->isFile('xdebug://debug-eval')); + $this->assertFalse($this->filter->isFile('eval()\'d code')); + $this->assertFalse($this->filter->isFile('runtime-created function')); + $this->assertFalse($this->filter->isFile('assert code')); + $this->assertFalse($this->filter->isFile('regexp code')); + $this->assertTrue($this->filter->isFile(__FILE__)); + } + + /** + * @covers SebastianBergmann\CodeCoverage\Filter::isFiltered + */ + public function testWhitelistedFileIsNotFiltered() + { + $this->filter->addFileToWhitelist($this->files[0]); + $this->assertFalse($this->filter->isFiltered($this->files[0])); + } + + /** + * @covers SebastianBergmann\CodeCoverage\Filter::isFiltered + */ + public function testNotWhitelistedFileIsFiltered() + { + $this->filter->addFileToWhitelist($this->files[0]); + $this->assertTrue($this->filter->isFiltered($this->files[1])); + } + + /** + * @covers SebastianBergmann\CodeCoverage\Filter::isFiltered + * @covers SebastianBergmann\CodeCoverage\Filter::isFile + */ + public function testNonFilesAreFiltered() + { + $this->assertTrue($this->filter->isFiltered('vfs://root/a/path')); + $this->assertTrue($this->filter->isFiltered('xdebug://debug-eval')); + $this->assertTrue($this->filter->isFiltered('eval()\'d code')); + $this->assertTrue($this->filter->isFiltered('runtime-created function')); + $this->assertTrue($this->filter->isFiltered('assert code')); + $this->assertTrue($this->filter->isFiltered('regexp code')); + } +} diff --git a/vendor/phpunit/php-code-coverage/tests/tests/HTMLTest.php b/vendor/phpunit/php-code-coverage/tests/tests/HTMLTest.php new file mode 100644 index 0000000..48353f0 --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/tests/HTMLTest.php @@ -0,0 +1,103 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Report\Html; + +use SebastianBergmann\CodeCoverage\TestCase; + +class HTMLTest extends TestCase +{ + private static $TEST_REPORT_PATH_SOURCE; + + public static function setUpBeforeClass() + { + parent::setUpBeforeClass(); + + self::$TEST_REPORT_PATH_SOURCE = TEST_FILES_PATH . 'Report' . DIRECTORY_SEPARATOR . 'HTML'; + } + + protected function tearDown() + { + parent::tearDown(); + + $tmpFilesIterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator(self::$TEST_TMP_PATH, \RecursiveDirectoryIterator::SKIP_DOTS), + \RecursiveIteratorIterator::CHILD_FIRST + ); + + foreach ($tmpFilesIterator as $path => $fileInfo) { + /* @var \SplFileInfo $fileInfo */ + $pathname = $fileInfo->getPathname(); + $fileInfo->isDir() ? rmdir($pathname) : unlink($pathname); + } + } + + public function testForBankAccountTest() + { + $expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForBankAccount'; + + $report = new Facade; + $report->process($this->getCoverageForBankAccount(), self::$TEST_TMP_PATH); + + $this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH); + } + + public function testForFileWithIgnoredLines() + { + $expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForFileWithIgnoredLines'; + + $report = new Facade; + $report->process($this->getCoverageForFileWithIgnoredLines(), self::$TEST_TMP_PATH); + + $this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH); + } + + public function testForClassWithAnonymousFunction() + { + $expectedFilesPath = + self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForClassWithAnonymousFunction'; + + $report = new Facade; + $report->process($this->getCoverageForClassWithAnonymousFunction(), self::$TEST_TMP_PATH); + + $this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH); + } + + /** + * @param string $expectedFilesPath + * @param string $actualFilesPath + */ + private function assertFilesEquals($expectedFilesPath, $actualFilesPath) + { + $expectedFilesIterator = new \FilesystemIterator($expectedFilesPath); + $actualFilesIterator = new \RegexIterator(new \FilesystemIterator($actualFilesPath), '/.html/'); + + $this->assertEquals( + iterator_count($expectedFilesIterator), + iterator_count($actualFilesIterator), + 'Generated files and expected files not match' + ); + + foreach ($expectedFilesIterator as $path => $fileInfo) { + /* @var \SplFileInfo $fileInfo */ + $filename = $fileInfo->getFilename(); + + $actualFile = $actualFilesPath . DIRECTORY_SEPARATOR . $filename; + + $this->assertFileExists($actualFile); + + $this->assertStringMatchesFormatFile( + $fileInfo->getPathname(), + str_replace(PHP_EOL, "\n", file_get_contents($actualFile)), + "${filename} not match" + ); + } + } +} diff --git a/vendor/phpunit/php-code-coverage/tests/tests/TextTest.php b/vendor/phpunit/php-code-coverage/tests/tests/TextTest.php new file mode 100644 index 0000000..04da00a --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/tests/TextTest.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Report; + +use SebastianBergmann\CodeCoverage\TestCase; + +/** + * @covers SebastianBergmann\CodeCoverage\Report\Text + */ +class TextTest extends TestCase +{ + public function testTextForBankAccountTest() + { + $text = new Text(50, 90, false, false); + + $this->assertStringMatchesFormatFile( + TEST_FILES_PATH . 'BankAccount-text.txt', + str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForBankAccount())) + ); + } + + public function testTextForFileWithIgnoredLines() + { + $text = new Text(50, 90, false, false); + + $this->assertStringMatchesFormatFile( + TEST_FILES_PATH . 'ignored-lines-text.txt', + str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForFileWithIgnoredLines())) + ); + } + + public function testTextForClassWithAnonymousFunction() + { + $text = new Text(50, 90, false, false); + + $this->assertStringMatchesFormatFile( + TEST_FILES_PATH . 'class-with-anonymous-function-text.txt', + str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForClassWithAnonymousFunction())) + ); + } +} diff --git a/vendor/phpunit/php-code-coverage/tests/tests/UtilTest.php b/vendor/phpunit/php-code-coverage/tests/tests/UtilTest.php new file mode 100644 index 0000000..a6f19ea --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/tests/UtilTest.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage; + +use PHPUnit\Framework\TestCase; + +/** + * @covers SebastianBergmann\CodeCoverage\Util + */ +class UtilTest extends TestCase +{ + public function testPercent() + { + $this->assertEquals(100, Util::percent(100, 0)); + $this->assertEquals(100, Util::percent(100, 100)); + $this->assertEquals( + '100.00%', + Util::percent(100, 100, true) + ); + } +} diff --git a/vendor/phpunit/php-code-coverage/tests/tests/XmlTest.php b/vendor/phpunit/php-code-coverage/tests/tests/XmlTest.php new file mode 100644 index 0000000..624bb2a --- /dev/null +++ b/vendor/phpunit/php-code-coverage/tests/tests/XmlTest.php @@ -0,0 +1,98 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\CodeCoverage\Report\Xml; + +use SebastianBergmann\CodeCoverage\TestCase; + +class XmlTest extends TestCase +{ + private static $TEST_REPORT_PATH_SOURCE; + + public static function setUpBeforeClass() + { + parent::setUpBeforeClass(); + + self::$TEST_REPORT_PATH_SOURCE = TEST_FILES_PATH . 'Report' . DIRECTORY_SEPARATOR . 'XML'; + } + + protected function tearDown() + { + parent::tearDown(); + + $tmpFilesIterator = new \FilesystemIterator(self::$TEST_TMP_PATH); + + foreach ($tmpFilesIterator as $path => $fileInfo) { + /* @var \SplFileInfo $fileInfo */ + unlink($fileInfo->getPathname()); + } + } + + public function testForBankAccountTest() + { + $expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForBankAccount'; + + $xml = new Facade('1.0.0'); + $xml->process($this->getCoverageForBankAccount(), self::$TEST_TMP_PATH); + + $this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH); + } + + public function testForFileWithIgnoredLines() + { + $expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForFileWithIgnoredLines'; + + $xml = new Facade('1.0.0'); + $xml->process($this->getCoverageForFileWithIgnoredLines(), self::$TEST_TMP_PATH); + + $this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH); + } + + public function testForClassWithAnonymousFunction() + { + $expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForClassWithAnonymousFunction'; + + $xml = new Facade('1.0.0'); + $xml->process($this->getCoverageForClassWithAnonymousFunction(), self::$TEST_TMP_PATH); + + $this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH); + } + + /** + * @param string $expectedFilesPath + * @param string $actualFilesPath + */ + private function assertFilesEquals($expectedFilesPath, $actualFilesPath) + { + $expectedFilesIterator = new \FilesystemIterator($expectedFilesPath); + $actualFilesIterator = new \FilesystemIterator($actualFilesPath); + + $this->assertEquals( + iterator_count($expectedFilesIterator), + iterator_count($actualFilesIterator), + 'Generated files and expected files not match' + ); + + foreach ($expectedFilesIterator as $path => $fileInfo) { + /* @var \SplFileInfo $fileInfo */ + $filename = $fileInfo->getFilename(); + + $actualFile = $actualFilesPath . DIRECTORY_SEPARATOR . $filename; + + $this->assertFileExists($actualFile); + + $this->assertStringMatchesFormatFile( + $fileInfo->getPathname(), + file_get_contents($actualFile), + "${filename} not match" + ); + } + } +} diff --git a/vendor/phpunit/php-file-iterator/.gitattributes b/vendor/phpunit/php-file-iterator/.gitattributes new file mode 100644 index 0000000..461090b --- /dev/null +++ b/vendor/phpunit/php-file-iterator/.gitattributes @@ -0,0 +1 @@ +*.php diff=php diff --git a/vendor/phpunit/php-file-iterator/.github/stale.yml b/vendor/phpunit/php-file-iterator/.github/stale.yml new file mode 100644 index 0000000..4eadca3 --- /dev/null +++ b/vendor/phpunit/php-file-iterator/.github/stale.yml @@ -0,0 +1,40 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +# Number of days of inactivity before an Issue or Pull Request becomes stale +daysUntilStale: 60 + +# Number of days of inactivity before a stale Issue or Pull Request is closed. +# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. +daysUntilClose: 7 + +# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable +exemptLabels: + - enhancement + +# Set to true to ignore issues in a project (defaults to false) +exemptProjects: false + +# Set to true to ignore issues in a milestone (defaults to false) +exemptMilestones: false + +# Label to use when marking as stale +staleLabel: stale + +# Comment to post when marking as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had activity within the last 60 days. It will be closed after 7 days if no further activity occurs. Thank you for your contributions. + +# Comment to post when removing the stale label. +# unmarkComment: > +# Your comment here. + +# Comment to post when closing a stale Issue or Pull Request. +closeComment: > + This issue has been automatically closed because it has not had activity since it was marked as stale. Thank you for your contributions. + +# Limit the number of actions per hour, from 1-30. Default is 30 +limitPerRun: 30 + +# Limit to only `issues` or `pulls` +only: issues + diff --git a/vendor/phpunit/php-file-iterator/.gitignore b/vendor/phpunit/php-file-iterator/.gitignore new file mode 100644 index 0000000..5ad7a64 --- /dev/null +++ b/vendor/phpunit/php-file-iterator/.gitignore @@ -0,0 +1,5 @@ +/.idea +/vendor/ +/.php_cs +/.php_cs.cache +/composer.lock diff --git a/vendor/phpunit/php-file-iterator/.php_cs.dist b/vendor/phpunit/php-file-iterator/.php_cs.dist new file mode 100644 index 0000000..efc649f --- /dev/null +++ b/vendor/phpunit/php-file-iterator/.php_cs.dist @@ -0,0 +1,168 @@ + + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +EOF; + +return PhpCsFixer\Config::create() + ->setRiskyAllowed(true) + ->setRules( + [ + 'array_syntax' => ['syntax' => 'short'], + 'binary_operator_spaces' => [ + 'operators' => [ + '=' => 'align', + '=>' => 'align', + ], + ], + 'blank_line_after_namespace' => true, + 'blank_line_before_statement' => [ + 'statements' => [ + 'break', + 'continue', + 'declare', + 'do', + 'for', + 'foreach', + 'if', + 'include', + 'include_once', + 'require', + 'require_once', + 'return', + 'switch', + 'throw', + 'try', + 'while', + 'yield', + ], + ], + 'braces' => true, + 'cast_spaces' => true, + 'class_attributes_separation' => ['elements' => ['method']], + 'compact_nullable_typehint' => true, + 'concat_space' => ['spacing' => 'one'], + 'declare_equal_normalize' => ['space' => 'none'], + 'dir_constant' => true, + 'elseif' => true, + 'encoding' => true, + 'full_opening_tag' => true, + 'function_declaration' => true, + 'header_comment' => ['header' => $header, 'separate' => 'none'], + 'indentation_type' => true, + 'line_ending' => true, + 'list_syntax' => ['syntax' => 'short'], + 'lowercase_cast' => true, + 'lowercase_constants' => true, + 'lowercase_keywords' => true, + 'magic_constant_casing' => true, + 'method_argument_space' => ['ensure_fully_multiline' => true], + 'modernize_types_casting' => true, + 'native_function_casing' => true, + 'native_function_invocation' => true, + 'no_alias_functions' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_closing_tag' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => true, + 'no_homoglyph_names' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => ['use' => 'print'], + 'no_null_property_initialization' => true, + 'no_short_bool_cast' => true, + 'no_short_echo_tag' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_inside_parenthesis' => true, + 'no_superfluous_elseif' => true, + 'no_trailing_comma_in_list_call' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unneeded_curly_braces' => true, + 'no_unneeded_final_method' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_whitespace_before_comma_in_array' => true, + 'no_whitespace_in_blank_line' => true, + 'non_printable_character' => true, + 'normalize_index_brace' => true, + 'object_operator_without_whitespace' => true, + 'ordered_class_elements' => [ + 'order' => [ + 'use_trait', + 'constant_public', + 'constant_protected', + 'constant_private', + 'property_public_static', + 'property_protected_static', + 'property_private_static', + 'property_public', + 'property_protected', + 'property_private', + 'method_public_static', + 'construct', + 'destruct', + 'magic', + 'phpunit', + 'method_public', + 'method_protected', + 'method_private', + 'method_protected_static', + 'method_private_static', + ], + ], + 'ordered_imports' => true, + 'phpdoc_add_missing_param_annotation' => true, + 'phpdoc_align' => true, + 'phpdoc_annotation_without_dot' => true, + 'phpdoc_indent' => true, + 'phpdoc_no_access' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_package' => true, + 'phpdoc_order' => true, + 'phpdoc_return_self_reference' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_to_comment' => true, + 'phpdoc_trim' => true, + 'phpdoc_types' => true, + 'phpdoc_types_order' => true, + 'phpdoc_var_without_name' => true, + 'pow_to_exponentiation' => true, + 'protected_to_private' => true, + 'return_type_declaration' => ['space_before' => 'none'], + 'self_accessor' => true, + 'short_scalar_cast' => true, + 'simplified_null_return' => true, + 'single_blank_line_at_eof' => true, + 'single_import_per_statement' => true, + 'single_line_after_imports' => true, + 'single_quote' => true, + 'standardize_not_equals' => true, + 'ternary_to_null_coalescing' => true, + 'trim_array_spaces' => true, + 'unary_operator_spaces' => true, + 'visibility_required' => true, + 'void_return' => true, + 'whitespace_after_comma_in_array' => true, + ] + ) + ->setFinder( + PhpCsFixer\Finder::create() + ->files() + ->in(__DIR__ . '/src') + ->in(__DIR__ . '/tests') + ->notName('*.phpt') + ); diff --git a/vendor/phpunit/php-file-iterator/.travis.yml b/vendor/phpunit/php-file-iterator/.travis.yml new file mode 100644 index 0000000..16b399c --- /dev/null +++ b/vendor/phpunit/php-file-iterator/.travis.yml @@ -0,0 +1,32 @@ +language: php + +sudo: false + +php: + - 7.1 + - 7.2 + - master + +env: + matrix: + - DEPENDENCIES="high" + - DEPENDENCIES="low" + global: + - DEFAULT_COMPOSER_FLAGS="--no-interaction --no-ansi --no-progress --no-suggest" + +before_install: + - composer self-update + - composer clear-cache + +install: + - if [[ "$DEPENDENCIES" = 'high' ]]; then travis_retry composer update $DEFAULT_COMPOSER_FLAGS; fi + - if [[ "$DEPENDENCIES" = 'low' ]]; then travis_retry composer update $DEFAULT_COMPOSER_FLAGS --prefer-lowest; fi + +script: + - ./vendor/bin/phpunit --coverage-clover=coverage.xml + +after_success: + - bash <(curl -s https://codecov.io/bash) + +notifications: + email: false diff --git a/vendor/phpunit/php-file-iterator/ChangeLog.md b/vendor/phpunit/php-file-iterator/ChangeLog.md new file mode 100644 index 0000000..f4a0801 --- /dev/null +++ b/vendor/phpunit/php-file-iterator/ChangeLog.md @@ -0,0 +1,70 @@ +# Change Log + +All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). + +## [2.0.2] - 2018-09-13 + +### Fixed + +* Fixed [#48](https://github.com/sebastianbergmann/php-file-iterator/issues/48): Excluding an array that contains false ends up excluding the current working directory + +## [2.0.1] - 2018-06-11 + +### Fixed + +* Fixed [#46](https://github.com/sebastianbergmann/php-file-iterator/issues/46): Regression with hidden parent directory + +## [2.0.0] - 2018-05-28 + +### Fixed + +* Fixed [#30](https://github.com/sebastianbergmann/php-file-iterator/issues/30): Exclude is not considered if it is a parent of the base path + +### Changed + +* This component now uses namespaces + +### Removed + +* This component is no longer supported on PHP 5.3, PHP 5.4, PHP 5.5, PHP 5.6, and PHP 7.0 + +## [1.4.5] - 2017-11-27 + +### Fixed + +* Fixed [#37](https://github.com/sebastianbergmann/php-file-iterator/issues/37): Regression caused by fix for [#30](https://github.com/sebastianbergmann/php-file-iterator/issues/30) + +## [1.4.4] - 2017-11-27 + +### Fixed + +* Fixed [#30](https://github.com/sebastianbergmann/php-file-iterator/issues/30): Exclude is not considered if it is a parent of the base path + +## [1.4.3] - 2017-11-25 + +### Fixed + +* Fixed [#34](https://github.com/sebastianbergmann/php-file-iterator/issues/34): Factory should use canonical directory names + +## [1.4.2] - 2016-11-26 + +No changes + +## [1.4.1] - 2015-07-26 + +No changes + +## 1.4.0 - 2015-04-02 + +### Added + +* [Added support for wildcards (glob) in exclude](https://github.com/sebastianbergmann/php-file-iterator/pull/23) + +[2.0.2]: https://github.com/sebastianbergmann/php-file-iterator/compare/2.0.1...2.0.2 +[2.0.1]: https://github.com/sebastianbergmann/php-file-iterator/compare/2.0.0...2.0.1 +[2.0.0]: https://github.com/sebastianbergmann/php-file-iterator/compare/1.4...master +[1.4.5]: https://github.com/sebastianbergmann/php-file-iterator/compare/1.4.4...1.4.5 +[1.4.4]: https://github.com/sebastianbergmann/php-file-iterator/compare/1.4.3...1.4.4 +[1.4.3]: https://github.com/sebastianbergmann/php-file-iterator/compare/1.4.2...1.4.3 +[1.4.2]: https://github.com/sebastianbergmann/php-file-iterator/compare/1.4.1...1.4.2 +[1.4.1]: https://github.com/sebastianbergmann/php-file-iterator/compare/1.4.0...1.4.1 diff --git a/vendor/phpunit/php-file-iterator/LICENSE b/vendor/phpunit/php-file-iterator/LICENSE new file mode 100644 index 0000000..87c3b51 --- /dev/null +++ b/vendor/phpunit/php-file-iterator/LICENSE @@ -0,0 +1,33 @@ +php-file-iterator + +Copyright (c) 2009-2018, Sebastian Bergmann . +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Sebastian Bergmann nor the names of his + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/phpunit/php-file-iterator/README.md b/vendor/phpunit/php-file-iterator/README.md new file mode 100644 index 0000000..3cbfdaa --- /dev/null +++ b/vendor/phpunit/php-file-iterator/README.md @@ -0,0 +1,14 @@ +[![Build Status](https://travis-ci.org/sebastianbergmann/php-file-iterator.svg?branch=master)](https://travis-ci.org/sebastianbergmann/php-file-iterator) + +# php-file-iterator + +## Installation + +You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): + + composer require phpunit/php-file-iterator + +If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: + + composer require --dev phpunit/php-file-iterator + diff --git a/vendor/phpunit/php-file-iterator/composer.json b/vendor/phpunit/php-file-iterator/composer.json new file mode 100644 index 0000000..002e511 --- /dev/null +++ b/vendor/phpunit/php-file-iterator/composer.json @@ -0,0 +1,37 @@ +{ + "name": "phpunit/php-file-iterator", + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "type": "library", + "keywords": [ + "iterator", + "filesystem" + ], + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + } +} diff --git a/vendor/phpunit/php-file-iterator/phpunit.xml b/vendor/phpunit/php-file-iterator/phpunit.xml new file mode 100644 index 0000000..3e12be4 --- /dev/null +++ b/vendor/phpunit/php-file-iterator/phpunit.xml @@ -0,0 +1,21 @@ + + + + + tests + + + + + + src + + + diff --git a/vendor/phpunit/php-file-iterator/src/Facade.php b/vendor/phpunit/php-file-iterator/src/Facade.php new file mode 100644 index 0000000..2456e16 --- /dev/null +++ b/vendor/phpunit/php-file-iterator/src/Facade.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\FileIterator; + +class Facade +{ + /** + * @param array|string $paths + * @param array|string $suffixes + * @param array|string $prefixes + * @param array $exclude + * @param bool $commonPath + * + * @return array + */ + public function getFilesAsArray($paths, $suffixes = '', $prefixes = '', array $exclude = [], bool $commonPath = false): array + { + if (\is_string($paths)) { + $paths = [$paths]; + } + + $factory = new Factory; + + $iterator = $factory->getFileIterator($paths, $suffixes, $prefixes, $exclude); + + $files = []; + + foreach ($iterator as $file) { + $file = $file->getRealPath(); + + if ($file) { + $files[] = $file; + } + } + + foreach ($paths as $path) { + if (\is_file($path)) { + $files[] = \realpath($path); + } + } + + $files = \array_unique($files); + \sort($files); + + if ($commonPath) { + return [ + 'commonPath' => $this->getCommonPath($files), + 'files' => $files + ]; + } + + return $files; + } + + protected function getCommonPath(array $files): string + { + $count = \count($files); + + if ($count === 0) { + return ''; + } + + if ($count === 1) { + return \dirname($files[0]) . DIRECTORY_SEPARATOR; + } + + $_files = []; + + foreach ($files as $file) { + $_files[] = $_fileParts = \explode(DIRECTORY_SEPARATOR, $file); + + if (empty($_fileParts[0])) { + $_fileParts[0] = DIRECTORY_SEPARATOR; + } + } + + $common = ''; + $done = false; + $j = 0; + $count--; + + while (!$done) { + for ($i = 0; $i < $count; $i++) { + if ($_files[$i][$j] != $_files[$i + 1][$j]) { + $done = true; + + break; + } + } + + if (!$done) { + $common .= $_files[0][$j]; + + if ($j > 0) { + $common .= DIRECTORY_SEPARATOR; + } + } + + $j++; + } + + return DIRECTORY_SEPARATOR . $common; + } +} diff --git a/vendor/phpunit/php-file-iterator/src/Factory.php b/vendor/phpunit/php-file-iterator/src/Factory.php new file mode 100644 index 0000000..02e2f38 --- /dev/null +++ b/vendor/phpunit/php-file-iterator/src/Factory.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\FileIterator; + +class Factory +{ + /** + * @param array|string $paths + * @param array|string $suffixes + * @param array|string $prefixes + * @param array $exclude + * + * @return \AppendIterator + */ + public function getFileIterator($paths, $suffixes = '', $prefixes = '', array $exclude = []): \AppendIterator + { + if (\is_string($paths)) { + $paths = [$paths]; + } + + $paths = $this->getPathsAfterResolvingWildcards($paths); + $exclude = $this->getPathsAfterResolvingWildcards($exclude); + + if (\is_string($prefixes)) { + if ($prefixes !== '') { + $prefixes = [$prefixes]; + } else { + $prefixes = []; + } + } + + if (\is_string($suffixes)) { + if ($suffixes !== '') { + $suffixes = [$suffixes]; + } else { + $suffixes = []; + } + } + + $iterator = new \AppendIterator; + + foreach ($paths as $path) { + if (\is_dir($path)) { + $iterator->append( + new Iterator( + $path, + new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS | \RecursiveDirectoryIterator::SKIP_DOTS) + ), + $suffixes, + $prefixes, + $exclude + ) + ); + } + } + + return $iterator; + } + + protected function getPathsAfterResolvingWildcards(array $paths): array + { + $_paths = []; + + foreach ($paths as $path) { + if ($locals = \glob($path, GLOB_ONLYDIR)) { + $_paths = \array_merge($_paths, \array_map('\realpath', $locals)); + } else { + $_paths[] = \realpath($path); + } + } + + return \array_filter($_paths); + } +} diff --git a/vendor/phpunit/php-file-iterator/src/Iterator.php b/vendor/phpunit/php-file-iterator/src/Iterator.php new file mode 100644 index 0000000..84882d4 --- /dev/null +++ b/vendor/phpunit/php-file-iterator/src/Iterator.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\FileIterator; + +class Iterator extends \FilterIterator +{ + const PREFIX = 0; + const SUFFIX = 1; + + /** + * @var string + */ + private $basePath; + + /** + * @var array + */ + private $suffixes = []; + + /** + * @var array + */ + private $prefixes = []; + + /** + * @var array + */ + private $exclude = []; + + /** + * @param string $basePath + * @param \Iterator $iterator + * @param array $suffixes + * @param array $prefixes + * @param array $exclude + */ + public function __construct(string $basePath, \Iterator $iterator, array $suffixes = [], array $prefixes = [], array $exclude = []) + { + $this->basePath = \realpath($basePath); + $this->prefixes = $prefixes; + $this->suffixes = $suffixes; + $this->exclude = \array_filter(\array_map('realpath', $exclude)); + + parent::__construct($iterator); + } + + public function accept() + { + $current = $this->getInnerIterator()->current(); + $filename = $current->getFilename(); + $realPath = $current->getRealPath(); + + return $this->acceptPath($realPath) && + $this->acceptPrefix($filename) && + $this->acceptSuffix($filename); + } + + private function acceptPath(string $path): bool + { + // Filter files in hidden directories by checking path that is relative to the base path. + if (\preg_match('=/\.[^/]*/=', \str_replace($this->basePath, '', $path))) { + return false; + } + + foreach ($this->exclude as $exclude) { + if (\strpos($path, $exclude) === 0) { + return false; + } + } + + return true; + } + + private function acceptPrefix(string $filename): bool + { + return $this->acceptSubString($filename, $this->prefixes, self::PREFIX); + } + + private function acceptSuffix(string $filename): bool + { + return $this->acceptSubString($filename, $this->suffixes, self::SUFFIX); + } + + private function acceptSubString(string $filename, array $subStrings, int $type): bool + { + if (empty($subStrings)) { + return true; + } + + $matched = false; + + foreach ($subStrings as $string) { + if (($type === self::PREFIX && \strpos($filename, $string) === 0) || + ($type === self::SUFFIX && + \substr($filename, -1 * \strlen($string)) === $string)) { + $matched = true; + + break; + } + } + + return $matched; + } +} diff --git a/vendor/phpunit/php-file-iterator/tests/FactoryTest.php b/vendor/phpunit/php-file-iterator/tests/FactoryTest.php new file mode 100644 index 0000000..ba4bdbf --- /dev/null +++ b/vendor/phpunit/php-file-iterator/tests/FactoryTest.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\FileIterator; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \SebastianBergmann\FileIterator\Factory + */ +class FactoryTest extends TestCase +{ + /** + * @var string + */ + private $root; + + /** + * @var Factory + */ + private $factory; + + protected function setUp(): void + { + $this->root = __DIR__; + $this->factory = new Factory; + } + + public function testFindFilesInTestDirectory(): void + { + $iterator = $this->factory->getFileIterator($this->root, 'Test.php'); + $files = \iterator_to_array($iterator); + + $this->assertGreaterThanOrEqual(1, \count($files)); + } + + public function testFindFilesWithExcludedNonExistingSubdirectory(): void + { + $iterator = $this->factory->getFileIterator($this->root, 'Test.php', '', [$this->root . '/nonExistingDir']); + $files = \iterator_to_array($iterator); + + $this->assertGreaterThanOrEqual(1, \count($files)); + } +} diff --git a/vendor/phpunit/php-text-template/.gitattributes b/vendor/phpunit/php-text-template/.gitattributes new file mode 100644 index 0000000..461090b --- /dev/null +++ b/vendor/phpunit/php-text-template/.gitattributes @@ -0,0 +1 @@ +*.php diff=php diff --git a/vendor/phpunit/php-text-template/.gitignore b/vendor/phpunit/php-text-template/.gitignore new file mode 100644 index 0000000..c599212 --- /dev/null +++ b/vendor/phpunit/php-text-template/.gitignore @@ -0,0 +1,5 @@ +/composer.lock +/composer.phar +/.idea +/vendor + diff --git a/vendor/phpunit/php-text-template/LICENSE b/vendor/phpunit/php-text-template/LICENSE new file mode 100644 index 0000000..9f9a32d --- /dev/null +++ b/vendor/phpunit/php-text-template/LICENSE @@ -0,0 +1,33 @@ +Text_Template + +Copyright (c) 2009-2015, Sebastian Bergmann . +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Sebastian Bergmann nor the names of his + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/phpunit/php-text-template/README.md b/vendor/phpunit/php-text-template/README.md new file mode 100644 index 0000000..ec8f593 --- /dev/null +++ b/vendor/phpunit/php-text-template/README.md @@ -0,0 +1,14 @@ +# Text_Template + +## Installation + +## Installation + +To add this package as a local, per-project dependency to your project, simply add a dependency on `phpunit/php-text-template` to your project's `composer.json` file. Here is a minimal example of a `composer.json` file that just defines a dependency on Text_Template: + + { + "require": { + "phpunit/php-text-template": "~1.2" + } + } + diff --git a/vendor/phpunit/php-text-template/composer.json b/vendor/phpunit/php-text-template/composer.json new file mode 100644 index 0000000..a5779c8 --- /dev/null +++ b/vendor/phpunit/php-text-template/composer.json @@ -0,0 +1,29 @@ +{ + "name": "phpunit/php-text-template", + "description": "Simple template engine.", + "type": "library", + "keywords": [ + "template" + ], + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues" + }, + "require": { + "php": ">=5.3.3" + }, + "autoload": { + "classmap": [ + "src/" + ] + } +} + diff --git a/vendor/phpunit/php-text-template/src/Template.php b/vendor/phpunit/php-text-template/src/Template.php new file mode 100644 index 0000000..9eb39ad --- /dev/null +++ b/vendor/phpunit/php-text-template/src/Template.php @@ -0,0 +1,135 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * A simple template engine. + * + * @since Class available since Release 1.0.0 + */ +class Text_Template +{ + /** + * @var string + */ + protected $template = ''; + + /** + * @var string + */ + protected $openDelimiter = '{'; + + /** + * @var string + */ + protected $closeDelimiter = '}'; + + /** + * @var array + */ + protected $values = array(); + + /** + * Constructor. + * + * @param string $file + * @throws InvalidArgumentException + */ + public function __construct($file = '', $openDelimiter = '{', $closeDelimiter = '}') + { + $this->setFile($file); + $this->openDelimiter = $openDelimiter; + $this->closeDelimiter = $closeDelimiter; + } + + /** + * Sets the template file. + * + * @param string $file + * @throws InvalidArgumentException + */ + public function setFile($file) + { + $distFile = $file . '.dist'; + + if (file_exists($file)) { + $this->template = file_get_contents($file); + } + + else if (file_exists($distFile)) { + $this->template = file_get_contents($distFile); + } + + else { + throw new InvalidArgumentException( + 'Template file could not be loaded.' + ); + } + } + + /** + * Sets one or more template variables. + * + * @param array $values + * @param bool $merge + */ + public function setVar(array $values, $merge = TRUE) + { + if (!$merge || empty($this->values)) { + $this->values = $values; + } else { + $this->values = array_merge($this->values, $values); + } + } + + /** + * Renders the template and returns the result. + * + * @return string + */ + public function render() + { + $keys = array(); + + foreach ($this->values as $key => $value) { + $keys[] = $this->openDelimiter . $key . $this->closeDelimiter; + } + + return str_replace($keys, $this->values, $this->template); + } + + /** + * Renders the template and writes the result to a file. + * + * @param string $target + */ + public function renderTo($target) + { + $fp = @fopen($target, 'wt'); + + if ($fp) { + fwrite($fp, $this->render()); + fclose($fp); + } else { + $error = error_get_last(); + + throw new RuntimeException( + sprintf( + 'Could not write to %s: %s', + $target, + substr( + $error['message'], + strpos($error['message'], ':') + 2 + ) + ) + ); + } + } +} + diff --git a/vendor/phpunit/php-timer/.gitattributes b/vendor/phpunit/php-timer/.gitattributes new file mode 100644 index 0000000..461090b --- /dev/null +++ b/vendor/phpunit/php-timer/.gitattributes @@ -0,0 +1 @@ +*.php diff=php diff --git a/vendor/phpunit/php-timer/.gitignore b/vendor/phpunit/php-timer/.gitignore new file mode 100644 index 0000000..953d2a2 --- /dev/null +++ b/vendor/phpunit/php-timer/.gitignore @@ -0,0 +1,5 @@ +/.idea +/.php_cs.cache +/vendor +/composer.lock + diff --git a/vendor/phpunit/php-timer/.php_cs.dist b/vendor/phpunit/php-timer/.php_cs.dist new file mode 100644 index 0000000..c10c0bd --- /dev/null +++ b/vendor/phpunit/php-timer/.php_cs.dist @@ -0,0 +1,148 @@ + + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +EOF; + +return PhpCsFixer\Config::create() + ->setRiskyAllowed(true) + ->setRules( + [ + 'array_syntax' => ['syntax' => 'short'], + 'binary_operator_spaces' => [ + 'align_double_arrow' => true, + 'align_equals' => true + ], + 'blank_line_after_namespace' => true, + 'blank_line_before_statement' => [ + 'statements' => [ + 'break', + 'continue', + 'return', + 'throw', + 'try', + ], + ], + 'braces' => true, + 'cast_spaces' => true, + 'class_attributes_separation' => ['elements' => ['method']], + 'compact_nullable_typehint' => true, + 'concat_space' => ['spacing' => 'one'], + 'declare_equal_normalize' => ['space' => 'none'], + 'dir_constant' => true, + 'elseif' => true, + 'encoding' => true, + 'full_opening_tag' => true, + 'function_declaration' => true, + 'header_comment' => ['header' => $header, 'separate' => 'none'], + 'indentation_type' => true, + 'line_ending' => true, + 'list_syntax' => ['syntax' => 'short'], + 'lowercase_cast' => true, + 'lowercase_constants' => true, + 'lowercase_keywords' => true, + 'magic_constant_casing' => true, + 'method_argument_space' => ['ensure_fully_multiline' => true], + 'modernize_types_casting' => true, + 'native_function_casing' => true, + 'native_function_invocation' => true, + 'no_alias_functions' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_closing_tag' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_consecutive_blank_lines' => true, + 'no_homoglyph_names' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => ['use' => 'print'], + 'no_null_property_initialization' => true, + 'no_short_bool_cast' => true, + 'no_short_echo_tag' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_inside_parenthesis' => true, + 'no_superfluous_elseif' => true, + 'no_trailing_comma_in_list_call' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unneeded_curly_braces' => true, + 'no_unneeded_final_method' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_whitespace_before_comma_in_array' => true, + 'no_whitespace_in_blank_line' => true, + 'non_printable_character' => true, + 'normalize_index_brace' => true, + 'object_operator_without_whitespace' => true, + 'ordered_class_elements' => [ + 'order' => [ + 'use_trait', + 'constant_public', + 'constant_protected', + 'constant_private', + 'property_public', + 'property_protected', + 'property_private', + 'construct', + 'destruct', + 'magic', + 'phpunit', + 'method_public', + 'method_protected', + 'method_private', + ], + ], + 'ordered_imports' => true, + 'phpdoc_add_missing_param_annotation' => true, + 'phpdoc_align' => true, + 'phpdoc_annotation_without_dot' => true, + 'phpdoc_indent' => true, + 'phpdoc_no_access' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_package' => true, + 'phpdoc_order' => true, + 'phpdoc_return_self_reference' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_to_comment' => true, + 'phpdoc_trim' => true, + 'phpdoc_types' => true, + 'phpdoc_types_order' => true, + 'phpdoc_var_without_name' => true, + 'pow_to_exponentiation' => true, + 'protected_to_private' => true, + 'return_type_declaration' => ['space_before' => 'none'], + 'self_accessor' => true, + 'short_scalar_cast' => true, + 'simplified_null_return' => true, + 'single_blank_line_at_eof' => true, + 'single_import_per_statement' => true, + 'single_line_after_imports' => true, + 'single_quote' => true, + 'standardize_not_equals' => true, + 'ternary_to_null_coalescing' => true, + 'trim_array_spaces' => true, + 'unary_operator_spaces' => true, + 'visibility_required' => true, + 'void_return' => true, + 'whitespace_after_comma_in_array' => true, + ] + ) + ->setFinder( + PhpCsFixer\Finder::create() + ->files() + ->in(__DIR__ . '/src') + ->in(__DIR__ . '/tests') + ->name('*.php') + ); diff --git a/vendor/phpunit/php-timer/.travis.yml b/vendor/phpunit/php-timer/.travis.yml new file mode 100644 index 0000000..98cefb2 --- /dev/null +++ b/vendor/phpunit/php-timer/.travis.yml @@ -0,0 +1,24 @@ +language: php + +php: + - 7.1 + - 7.2 + - master + +sudo: false + +before_install: + - composer self-update + - composer clear-cache + +install: + - travis_retry composer update --no-interaction --no-ansi --no-progress --no-suggest + +script: + - ./vendor/bin/phpunit --coverage-clover=coverage.xml + +after_success: + - bash <(curl -s https://codecov.io/bash) + +notifications: + email: false diff --git a/vendor/phpunit/php-timer/ChangeLog.md b/vendor/phpunit/php-timer/ChangeLog.md new file mode 100644 index 0000000..5b92517 --- /dev/null +++ b/vendor/phpunit/php-timer/ChangeLog.md @@ -0,0 +1,15 @@ +# ChangeLog + +All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [2.0.0] - 2018-02-01 + +### Changed + +* This component now uses namespaces + +### Removed + +* This component is no longer supported on PHP 5.3, PHP 5.4, PHP 5.5, PHP 5.6, and PHP 7.0 + +[2.0.0]: https://github.com/sebastianbergmann/diff/compare/1.0.9...2.0.0 diff --git a/vendor/phpunit/php-timer/LICENSE b/vendor/phpunit/php-timer/LICENSE new file mode 100644 index 0000000..e7f0517 --- /dev/null +++ b/vendor/phpunit/php-timer/LICENSE @@ -0,0 +1,33 @@ +phpunit/php-timer + +Copyright (c) 2010-2018, Sebastian Bergmann . +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Sebastian Bergmann nor the names of his + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/phpunit/php-timer/README.md b/vendor/phpunit/php-timer/README.md new file mode 100644 index 0000000..61725c2 --- /dev/null +++ b/vendor/phpunit/php-timer/README.md @@ -0,0 +1,49 @@ +[![Build Status](https://travis-ci.org/sebastianbergmann/php-timer.svg?branch=master)](https://travis-ci.org/sebastianbergmann/php-timer) + +# phpunit/php-timer + +Utility class for timing things, factored out of PHPUnit into a stand-alone component. + +## Installation + +You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): + + composer require phpunit/php-timer + +If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: + + composer require --dev phpunit/php-timer + +## Usage + +### Basic Timing + +```php +use SebastianBergmann\Timer\Timer; + +Timer::start(); + +// ... + +$time = Timer::stop(); +var_dump($time); + +print Timer::secondsToTimeString($time); +``` + +The code above yields the output below: + + double(1.0967254638672E-5) + 0 ms + +### Resource Consumption Since PHP Startup + +```php +use SebastianBergmann\Timer\Timer; + +print Timer::resourceUsage(); +``` + +The code above yields the output below: + + Time: 0 ms, Memory: 0.50MB diff --git a/vendor/phpunit/php-timer/build.xml b/vendor/phpunit/php-timer/build.xml new file mode 100644 index 0000000..b8d3256 --- /dev/null +++ b/vendor/phpunit/php-timer/build.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phpunit/php-timer/composer.json b/vendor/phpunit/php-timer/composer.json new file mode 100644 index 0000000..f2ed136 --- /dev/null +++ b/vendor/phpunit/php-timer/composer.json @@ -0,0 +1,42 @@ +{ + "name": "phpunit/php-timer", + "description": "Utility class for timing", + "type": "library", + "keywords": [ + "timer" + ], + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues" + }, + "prefer-stable": true, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "config": { + "optimize-autoloader": true, + "sort-packages": true + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + } +} + diff --git a/vendor/phpunit/php-timer/phpunit.xml b/vendor/phpunit/php-timer/phpunit.xml new file mode 100644 index 0000000..28a95de --- /dev/null +++ b/vendor/phpunit/php-timer/phpunit.xml @@ -0,0 +1,19 @@ + + + + tests + + + + + src + + + diff --git a/vendor/phpunit/php-timer/src/Exception.php b/vendor/phpunit/php-timer/src/Exception.php new file mode 100644 index 0000000..c04f60a --- /dev/null +++ b/vendor/phpunit/php-timer/src/Exception.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\Timer; + +interface Exception +{ +} diff --git a/vendor/phpunit/php-timer/src/RuntimeException.php b/vendor/phpunit/php-timer/src/RuntimeException.php new file mode 100644 index 0000000..1aa33f2 --- /dev/null +++ b/vendor/phpunit/php-timer/src/RuntimeException.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\Timer; + +final class RuntimeException extends \RuntimeException implements Exception +{ +} diff --git a/vendor/phpunit/php-timer/src/Timer.php b/vendor/phpunit/php-timer/src/Timer.php new file mode 100644 index 0000000..0b069fa --- /dev/null +++ b/vendor/phpunit/php-timer/src/Timer.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\Timer; + +final class Timer +{ + /** + * @var array + */ + private static $times = [ + 'hour' => 3600000, + 'minute' => 60000, + 'second' => 1000 + ]; + + /** + * @var array + */ + private static $startTimes = []; + + public static function start(): void + { + self::$startTimes[] = \microtime(true); + } + + public static function stop(): float + { + return \microtime(true) - \array_pop(self::$startTimes); + } + + public static function secondsToTimeString(float $time): string + { + $ms = \round($time * 1000); + + foreach (self::$times as $unit => $value) { + if ($ms >= $value) { + $time = \floor($ms / $value * 100.0) / 100.0; + + return $time . ' ' . ($time == 1 ? $unit : $unit . 's'); + } + } + + return $ms . ' ms'; + } + + /** + * @throws RuntimeException + */ + public static function timeSinceStartOfRequest(): string + { + if (isset($_SERVER['REQUEST_TIME_FLOAT'])) { + $startOfRequest = $_SERVER['REQUEST_TIME_FLOAT']; + } elseif (isset($_SERVER['REQUEST_TIME'])) { + $startOfRequest = $_SERVER['REQUEST_TIME']; + } else { + throw new RuntimeException('Cannot determine time at which the request started'); + } + + return self::secondsToTimeString(\microtime(true) - $startOfRequest); + } + + /** + * @throws RuntimeException + */ + public static function resourceUsage(): string + { + return \sprintf( + 'Time: %s, Memory: %4.2fMB', + self::timeSinceStartOfRequest(), + \memory_get_peak_usage(true) / 1048576 + ); + } +} diff --git a/vendor/phpunit/php-timer/tests/TimerTest.php b/vendor/phpunit/php-timer/tests/TimerTest.php new file mode 100644 index 0000000..6477323 --- /dev/null +++ b/vendor/phpunit/php-timer/tests/TimerTest.php @@ -0,0 +1,121 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace SebastianBergmann\Timer; + +use PHPUnit\Framework\TestCase; + +/** + * @covers \SebastianBergmann\Timer\Timer + */ +class TimerTest extends TestCase +{ + public function testStartStop(): void + { + $this->assertInternalType('float', Timer::stop()); + } + + /** + * @dataProvider secondsProvider + */ + public function testSecondsToTimeString(string $string, string $seconds): void + { + $this->assertEquals( + $string, + Timer::secondsToTimeString($seconds) + ); + } + + public function testTimeSinceStartOfRequest(): void + { + $this->assertStringMatchesFormat( + '%f %s', + Timer::timeSinceStartOfRequest() + ); + } + + public function testTimeSinceStartOfRequest2(): void + { + if (isset($_SERVER['REQUEST_TIME_FLOAT'])) { + unset($_SERVER['REQUEST_TIME_FLOAT']); + } + + $this->assertStringMatchesFormat( + '%f %s', + Timer::timeSinceStartOfRequest() + ); + } + + /** + * @backupGlobals enabled + */ + public function testTimeSinceStartOfRequest3(): void + { + if (isset($_SERVER['REQUEST_TIME_FLOAT'])) { + unset($_SERVER['REQUEST_TIME_FLOAT']); + } + + if (isset($_SERVER['REQUEST_TIME'])) { + unset($_SERVER['REQUEST_TIME']); + } + + $this->expectException(RuntimeException::class); + + Timer::timeSinceStartOfRequest(); + } + + public function testResourceUsage(): void + { + $this->assertStringMatchesFormat( + 'Time: %s, Memory: %fMB', + Timer::resourceUsage() + ); + } + + public function secondsProvider() + { + return [ + ['0 ms', 0], + ['1 ms', .001], + ['10 ms', .01], + ['100 ms', .1], + ['999 ms', .999], + ['1 second', .9999], + ['1 second', 1], + ['2 seconds', 2], + ['59.9 seconds', 59.9], + ['59.99 seconds', 59.99], + ['59.99 seconds', 59.999], + ['1 minute', 59.9999], + ['59 seconds', 59.001], + ['59.01 seconds', 59.01], + ['1 minute', 60], + ['1.01 minutes', 61], + ['2 minutes', 120], + ['2.01 minutes', 121], + ['59.99 minutes', 3599.9], + ['59.99 minutes', 3599.99], + ['59.99 minutes', 3599.999], + ['1 hour', 3599.9999], + ['59.98 minutes', 3599.001], + ['59.98 minutes', 3599.01], + ['1 hour', 3600], + ['1 hour', 3601], + ['1 hour', 3601.9], + ['1 hour', 3601.99], + ['1 hour', 3601.999], + ['1 hour', 3601.9999], + ['1.01 hours', 3659.9999], + ['1.01 hours', 3659.001], + ['1.01 hours', 3659.01], + ['2 hours', 7199.9999], + ]; + } +} diff --git a/vendor/phpunit/php-token-stream/.gitattributes b/vendor/phpunit/php-token-stream/.gitattributes new file mode 100644 index 0000000..461090b --- /dev/null +++ b/vendor/phpunit/php-token-stream/.gitattributes @@ -0,0 +1 @@ +*.php diff=php diff --git a/vendor/phpunit/php-token-stream/.github/stale.yml b/vendor/phpunit/php-token-stream/.github/stale.yml new file mode 100644 index 0000000..4eadca3 --- /dev/null +++ b/vendor/phpunit/php-token-stream/.github/stale.yml @@ -0,0 +1,40 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +# Number of days of inactivity before an Issue or Pull Request becomes stale +daysUntilStale: 60 + +# Number of days of inactivity before a stale Issue or Pull Request is closed. +# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. +daysUntilClose: 7 + +# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable +exemptLabels: + - enhancement + +# Set to true to ignore issues in a project (defaults to false) +exemptProjects: false + +# Set to true to ignore issues in a milestone (defaults to false) +exemptMilestones: false + +# Label to use when marking as stale +staleLabel: stale + +# Comment to post when marking as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had activity within the last 60 days. It will be closed after 7 days if no further activity occurs. Thank you for your contributions. + +# Comment to post when removing the stale label. +# unmarkComment: > +# Your comment here. + +# Comment to post when closing a stale Issue or Pull Request. +closeComment: > + This issue has been automatically closed because it has not had activity since it was marked as stale. Thank you for your contributions. + +# Limit the number of actions per hour, from 1-30. Default is 30 +limitPerRun: 30 + +# Limit to only `issues` or `pulls` +only: issues + diff --git a/vendor/phpunit/php-token-stream/.gitignore b/vendor/phpunit/php-token-stream/.gitignore new file mode 100644 index 0000000..77aae3d --- /dev/null +++ b/vendor/phpunit/php-token-stream/.gitignore @@ -0,0 +1,3 @@ +/.idea +/composer.lock +/vendor diff --git a/vendor/phpunit/php-token-stream/.travis.yml b/vendor/phpunit/php-token-stream/.travis.yml new file mode 100644 index 0000000..3f92d4a --- /dev/null +++ b/vendor/phpunit/php-token-stream/.travis.yml @@ -0,0 +1,26 @@ +language: php + +php: + - 7.1 + - 7.2 + - 7.3 + - master + +sudo: false + +before_install: + - composer self-update + - composer clear-cache + +install: + - travis_retry composer update --no-interaction --no-ansi --no-progress --no-suggest + +script: + - ./vendor/bin/phpunit --coverage-clover=coverage.xml + +after_success: + - bash <(curl -s https://codecov.io/bash) + +notifications: + email: false + diff --git a/vendor/phpunit/php-token-stream/ChangeLog.md b/vendor/phpunit/php-token-stream/ChangeLog.md new file mode 100644 index 0000000..3a8967d --- /dev/null +++ b/vendor/phpunit/php-token-stream/ChangeLog.md @@ -0,0 +1,36 @@ +# Change Log + +All notable changes to `sebastianbergmann/php-token-stream` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [3.0.1] - 2018-10-30 + +### Fixed + +* Fixed [#78](https://github.com/sebastianbergmann/php-token-stream/pull/78): `getEndTokenId()` does not handle string-dollar (`"${var}"`) interpolation + +## [3.0.0] - 2018-02-01 + +### Removed + +* Implemented [#71](https://github.com/sebastianbergmann/php-token-stream/issues/71): Remove code specific to Hack language constructs +* Implemented [#72](https://github.com/sebastianbergmann/php-token-stream/issues/72): Drop support for PHP 7.0 + +## [2.0.2] - 2017-11-27 + +### Fixed + +* Fixed [#69](https://github.com/sebastianbergmann/php-token-stream/issues/69): `PHP_Token_USE_FUNCTION` does not serialize correctly + +## [2.0.1] - 2017-08-20 + +### Fixed + +* Fixed [#68](https://github.com/sebastianbergmann/php-token-stream/issues/68): Method with name `empty` wrongly recognized as anonymous function + +## [2.0.0] - 2017-08-03 + +[3.0.1]: https://github.com/sebastianbergmann/php-token-stream/compare/3.0.0...3.0.1 +[3.0.0]: https://github.com/sebastianbergmann/php-token-stream/compare/2.0...3.0.0 +[2.0.2]: https://github.com/sebastianbergmann/php-token-stream/compare/2.0.1...2.0.2 +[2.0.1]: https://github.com/sebastianbergmann/php-token-stream/compare/2.0.0...2.0.1 +[2.0.0]: https://github.com/sebastianbergmann/php-token-stream/compare/1.4.11...2.0.0 diff --git a/vendor/phpunit/php-token-stream/LICENSE b/vendor/phpunit/php-token-stream/LICENSE new file mode 100644 index 0000000..a54c54c --- /dev/null +++ b/vendor/phpunit/php-token-stream/LICENSE @@ -0,0 +1,33 @@ +php-token-stream + +Copyright (c) 2009-2018, Sebastian Bergmann . +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Sebastian Bergmann nor the names of his + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/phpunit/php-token-stream/README.md b/vendor/phpunit/php-token-stream/README.md new file mode 100644 index 0000000..149b7e2 --- /dev/null +++ b/vendor/phpunit/php-token-stream/README.md @@ -0,0 +1,14 @@ +[![Build Status](https://travis-ci.org/sebastianbergmann/php-token-stream.svg?branch=master)](https://travis-ci.org/sebastianbergmann/php-token-stream) + +# php-token-stream + +## Installation + +You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): + + composer require phpunit/php-token-stream + +If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: + + composer require --dev phpunit/php-token-stream + diff --git a/vendor/phpunit/php-token-stream/build.xml b/vendor/phpunit/php-token-stream/build.xml new file mode 100644 index 0000000..0da8056 --- /dev/null +++ b/vendor/phpunit/php-token-stream/build.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phpunit/php-token-stream/composer.json b/vendor/phpunit/php-token-stream/composer.json new file mode 100644 index 0000000..66cd03c --- /dev/null +++ b/vendor/phpunit/php-token-stream/composer.json @@ -0,0 +1,39 @@ +{ + "name": "phpunit/php-token-stream", + "description": "Wrapper around PHP's tokenizer extension.", + "type": "library", + "keywords": ["tokenizer"], + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-token-stream/issues" + }, + "prefer-stable": true, + "require": { + "php": "^7.1", + "ext-tokenizer": "*" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "config": { + "optimize-autoloader": true, + "sort-packages": true + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + } +} diff --git a/vendor/phpunit/php-token-stream/phpunit.xml b/vendor/phpunit/php-token-stream/phpunit.xml new file mode 100644 index 0000000..1f789ba --- /dev/null +++ b/vendor/phpunit/php-token-stream/phpunit.xml @@ -0,0 +1,17 @@ + + + + tests + + + + + src + + + diff --git a/vendor/phpunit/php-token-stream/src/Token.php b/vendor/phpunit/php-token-stream/src/Token.php new file mode 100644 index 0000000..c63a1b9 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Token.php @@ -0,0 +1,1352 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * A PHP token. + */ +abstract class PHP_Token +{ + /** + * @var string + */ + protected $text; + + /** + * @var int + */ + protected $line; + + /** + * @var PHP_Token_Stream + */ + protected $tokenStream; + + /** + * @var int + */ + protected $id; + + /** + * @param string $text + * @param int $line + * @param PHP_Token_Stream $tokenStream + * @param int $id + */ + public function __construct($text, $line, PHP_Token_Stream $tokenStream, $id) + { + $this->text = $text; + $this->line = $line; + $this->tokenStream = $tokenStream; + $this->id = $id; + } + + /** + * @return string + */ + public function __toString() + { + return $this->text; + } + + /** + * @return int + */ + public function getLine() + { + return $this->line; + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } +} + +abstract class PHP_TokenWithScope extends PHP_Token +{ + /** + * @var int + */ + protected $endTokenId; + + /** + * Get the docblock for this token + * + * This method will fetch the docblock belonging to the current token. The + * docblock must be placed on the line directly above the token to be + * recognized. + * + * @return string|null Returns the docblock as a string if found + */ + public function getDocblock() + { + $tokens = $this->tokenStream->tokens(); + $currentLineNumber = $tokens[$this->id]->getLine(); + $prevLineNumber = $currentLineNumber - 1; + + for ($i = $this->id - 1; $i; $i--) { + if (!isset($tokens[$i])) { + return; + } + + if ($tokens[$i] instanceof PHP_Token_FUNCTION || + $tokens[$i] instanceof PHP_Token_CLASS || + $tokens[$i] instanceof PHP_Token_TRAIT) { + // Some other trait, class or function, no docblock can be + // used for the current token + break; + } + + $line = $tokens[$i]->getLine(); + + if ($line == $currentLineNumber || + ($line == $prevLineNumber && + $tokens[$i] instanceof PHP_Token_WHITESPACE)) { + continue; + } + + if ($line < $currentLineNumber && + !$tokens[$i] instanceof PHP_Token_DOC_COMMENT) { + break; + } + + return (string) $tokens[$i]; + } + } + + /** + * @return int + */ + public function getEndTokenId() + { + $block = 0; + $i = $this->id; + $tokens = $this->tokenStream->tokens(); + + while ($this->endTokenId === null && isset($tokens[$i])) { + if ($tokens[$i] instanceof PHP_Token_OPEN_CURLY || + $tokens[$i] instanceof PHP_Token_DOLLAR_OPEN_CURLY_BRACES || + $tokens[$i] instanceof PHP_Token_CURLY_OPEN) { + $block++; + } elseif ($tokens[$i] instanceof PHP_Token_CLOSE_CURLY) { + $block--; + + if ($block === 0) { + $this->endTokenId = $i; + } + } elseif (($this instanceof PHP_Token_FUNCTION || + $this instanceof PHP_Token_NAMESPACE) && + $tokens[$i] instanceof PHP_Token_SEMICOLON) { + if ($block === 0) { + $this->endTokenId = $i; + } + } + + $i++; + } + + if ($this->endTokenId === null) { + $this->endTokenId = $this->id; + } + + return $this->endTokenId; + } + + /** + * @return int + */ + public function getEndLine() + { + return $this->tokenStream[$this->getEndTokenId()]->getLine(); + } +} + +abstract class PHP_TokenWithScopeAndVisibility extends PHP_TokenWithScope +{ + /** + * @return string + */ + public function getVisibility() + { + $tokens = $this->tokenStream->tokens(); + + for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) { + if (isset($tokens[$i]) && + ($tokens[$i] instanceof PHP_Token_PRIVATE || + $tokens[$i] instanceof PHP_Token_PROTECTED || + $tokens[$i] instanceof PHP_Token_PUBLIC)) { + return strtolower( + str_replace('PHP_Token_', '', get_class($tokens[$i])) + ); + } + if (isset($tokens[$i]) && + !($tokens[$i] instanceof PHP_Token_STATIC || + $tokens[$i] instanceof PHP_Token_FINAL || + $tokens[$i] instanceof PHP_Token_ABSTRACT)) { + // no keywords; stop visibility search + break; + } + } + } + + /** + * @return string + */ + public function getKeywords() + { + $keywords = []; + $tokens = $this->tokenStream->tokens(); + + for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) { + if (isset($tokens[$i]) && + ($tokens[$i] instanceof PHP_Token_PRIVATE || + $tokens[$i] instanceof PHP_Token_PROTECTED || + $tokens[$i] instanceof PHP_Token_PUBLIC)) { + continue; + } + + if (isset($tokens[$i]) && + ($tokens[$i] instanceof PHP_Token_STATIC || + $tokens[$i] instanceof PHP_Token_FINAL || + $tokens[$i] instanceof PHP_Token_ABSTRACT)) { + $keywords[] = strtolower( + str_replace('PHP_Token_', '', get_class($tokens[$i])) + ); + } + } + + return implode(',', $keywords); + } +} + +abstract class PHP_Token_Includes extends PHP_Token +{ + /** + * @var string + */ + protected $name; + + /** + * @var string + */ + protected $type; + + /** + * @return string + */ + public function getName() + { + if ($this->name === null) { + $this->process(); + } + + return $this->name; + } + + /** + * @return string + */ + public function getType() + { + if ($this->type === null) { + $this->process(); + } + + return $this->type; + } + + private function process() + { + $tokens = $this->tokenStream->tokens(); + + if ($tokens[$this->id + 2] instanceof PHP_Token_CONSTANT_ENCAPSED_STRING) { + $this->name = trim($tokens[$this->id + 2], "'\""); + $this->type = strtolower( + str_replace('PHP_Token_', '', get_class($tokens[$this->id])) + ); + } + } +} + +class PHP_Token_FUNCTION extends PHP_TokenWithScopeAndVisibility +{ + /** + * @var array + */ + protected $arguments; + + /** + * @var int + */ + protected $ccn; + + /** + * @var string + */ + protected $name; + + /** + * @var string + */ + protected $signature; + + /** + * @var bool + */ + private $anonymous = false; + + /** + * @return array + */ + public function getArguments() + { + if ($this->arguments !== null) { + return $this->arguments; + } + + $this->arguments = []; + $tokens = $this->tokenStream->tokens(); + $typeDeclaration = null; + + // Search for first token inside brackets + $i = $this->id + 2; + + while (!$tokens[$i - 1] instanceof PHP_Token_OPEN_BRACKET) { + $i++; + } + + while (!$tokens[$i] instanceof PHP_Token_CLOSE_BRACKET) { + if ($tokens[$i] instanceof PHP_Token_STRING) { + $typeDeclaration = (string) $tokens[$i]; + } elseif ($tokens[$i] instanceof PHP_Token_VARIABLE) { + $this->arguments[(string) $tokens[$i]] = $typeDeclaration; + $typeDeclaration = null; + } + + $i++; + } + + return $this->arguments; + } + + /** + * @return string + */ + public function getName() + { + if ($this->name !== null) { + return $this->name; + } + + $tokens = $this->tokenStream->tokens(); + + $i = $this->id + 1; + + if ($tokens[$i] instanceof PHP_Token_WHITESPACE) { + $i++; + } + + if ($tokens[$i] instanceof PHP_Token_AMPERSAND) { + $i++; + } + + if ($tokens[$i + 1] instanceof PHP_Token_OPEN_BRACKET) { + $this->name = (string) $tokens[$i]; + } elseif ($tokens[$i + 1] instanceof PHP_Token_WHITESPACE && $tokens[$i + 2] instanceof PHP_Token_OPEN_BRACKET) { + $this->name = (string) $tokens[$i]; + } else { + $this->anonymous = true; + + $this->name = sprintf( + 'anonymousFunction:%s#%s', + $this->getLine(), + $this->getId() + ); + } + + if (!$this->isAnonymous()) { + for ($i = $this->id; $i; --$i) { + if ($tokens[$i] instanceof PHP_Token_NAMESPACE) { + $this->name = $tokens[$i]->getName() . '\\' . $this->name; + + break; + } + + if ($tokens[$i] instanceof PHP_Token_INTERFACE) { + break; + } + } + } + + return $this->name; + } + + /** + * @return int + */ + public function getCCN() + { + if ($this->ccn !== null) { + return $this->ccn; + } + + $this->ccn = 1; + $end = $this->getEndTokenId(); + $tokens = $this->tokenStream->tokens(); + + for ($i = $this->id; $i <= $end; $i++) { + switch (get_class($tokens[$i])) { + case 'PHP_Token_IF': + case 'PHP_Token_ELSEIF': + case 'PHP_Token_FOR': + case 'PHP_Token_FOREACH': + case 'PHP_Token_WHILE': + case 'PHP_Token_CASE': + case 'PHP_Token_CATCH': + case 'PHP_Token_BOOLEAN_AND': + case 'PHP_Token_LOGICAL_AND': + case 'PHP_Token_BOOLEAN_OR': + case 'PHP_Token_LOGICAL_OR': + case 'PHP_Token_QUESTION_MARK': + $this->ccn++; + break; + } + } + + return $this->ccn; + } + + /** + * @return string + */ + public function getSignature() + { + if ($this->signature !== null) { + return $this->signature; + } + + if ($this->isAnonymous()) { + $this->signature = 'anonymousFunction'; + $i = $this->id + 1; + } else { + $this->signature = ''; + $i = $this->id + 2; + } + + $tokens = $this->tokenStream->tokens(); + + while (isset($tokens[$i]) && + !$tokens[$i] instanceof PHP_Token_OPEN_CURLY && + !$tokens[$i] instanceof PHP_Token_SEMICOLON) { + $this->signature .= $tokens[$i++]; + } + + $this->signature = trim($this->signature); + + return $this->signature; + } + + /** + * @return bool + */ + public function isAnonymous() + { + return $this->anonymous; + } +} + +class PHP_Token_INTERFACE extends PHP_TokenWithScopeAndVisibility +{ + /** + * @var array + */ + protected $interfaces; + + /** + * @return string + */ + public function getName() + { + return (string) $this->tokenStream[$this->id + 2]; + } + + /** + * @return bool + */ + public function hasParent() + { + return $this->tokenStream[$this->id + 4] instanceof PHP_Token_EXTENDS; + } + + /** + * @return array + */ + public function getPackage() + { + $className = $this->getName(); + $docComment = $this->getDocblock(); + + $result = [ + 'namespace' => '', + 'fullPackage' => '', + 'category' => '', + 'package' => '', + 'subpackage' => '' + ]; + + for ($i = $this->id; $i; --$i) { + if ($this->tokenStream[$i] instanceof PHP_Token_NAMESPACE) { + $result['namespace'] = $this->tokenStream[$i]->getName(); + break; + } + } + + if (preg_match('/@category[\s]+([\.\w]+)/', $docComment, $matches)) { + $result['category'] = $matches[1]; + } + + if (preg_match('/@package[\s]+([\.\w]+)/', $docComment, $matches)) { + $result['package'] = $matches[1]; + $result['fullPackage'] = $matches[1]; + } + + if (preg_match('/@subpackage[\s]+([\.\w]+)/', $docComment, $matches)) { + $result['subpackage'] = $matches[1]; + $result['fullPackage'] .= '.' . $matches[1]; + } + + if (empty($result['fullPackage'])) { + $result['fullPackage'] = $this->arrayToName( + explode('_', str_replace('\\', '_', $className)), + '.' + ); + } + + return $result; + } + + /** + * @param array $parts + * @param string $join + * + * @return string + */ + protected function arrayToName(array $parts, $join = '\\') + { + $result = ''; + + if (count($parts) > 1) { + array_pop($parts); + + $result = implode($join, $parts); + } + + return $result; + } + + /** + * @return bool|string + */ + public function getParent() + { + if (!$this->hasParent()) { + return false; + } + + $i = $this->id + 6; + $tokens = $this->tokenStream->tokens(); + $className = (string) $tokens[$i]; + + while (isset($tokens[$i + 1]) && + !$tokens[$i + 1] instanceof PHP_Token_WHITESPACE) { + $className .= (string) $tokens[++$i]; + } + + return $className; + } + + /** + * @return bool + */ + public function hasInterfaces() + { + return (isset($this->tokenStream[$this->id + 4]) && + $this->tokenStream[$this->id + 4] instanceof PHP_Token_IMPLEMENTS) || + (isset($this->tokenStream[$this->id + 8]) && + $this->tokenStream[$this->id + 8] instanceof PHP_Token_IMPLEMENTS); + } + + /** + * @return array|bool + */ + public function getInterfaces() + { + if ($this->interfaces !== null) { + return $this->interfaces; + } + + if (!$this->hasInterfaces()) { + return ($this->interfaces = false); + } + + if ($this->tokenStream[$this->id + 4] instanceof PHP_Token_IMPLEMENTS) { + $i = $this->id + 3; + } else { + $i = $this->id + 7; + } + + $tokens = $this->tokenStream->tokens(); + + while (!$tokens[$i + 1] instanceof PHP_Token_OPEN_CURLY) { + $i++; + + if ($tokens[$i] instanceof PHP_Token_STRING) { + $this->interfaces[] = (string) $tokens[$i]; + } + } + + return $this->interfaces; + } +} + +class PHP_Token_ABSTRACT extends PHP_Token +{ +} + +class PHP_Token_AMPERSAND extends PHP_Token +{ +} + +class PHP_Token_AND_EQUAL extends PHP_Token +{ +} + +class PHP_Token_ARRAY extends PHP_Token +{ +} + +class PHP_Token_ARRAY_CAST extends PHP_Token +{ +} + +class PHP_Token_AS extends PHP_Token +{ +} + +class PHP_Token_AT extends PHP_Token +{ +} + +class PHP_Token_BACKTICK extends PHP_Token +{ +} + +class PHP_Token_BAD_CHARACTER extends PHP_Token +{ +} + +class PHP_Token_BOOLEAN_AND extends PHP_Token +{ +} + +class PHP_Token_BOOLEAN_OR extends PHP_Token +{ +} + +class PHP_Token_BOOL_CAST extends PHP_Token +{ +} + +class PHP_Token_BREAK extends PHP_Token +{ +} + +class PHP_Token_CARET extends PHP_Token +{ +} + +class PHP_Token_CASE extends PHP_Token +{ +} + +class PHP_Token_CATCH extends PHP_Token +{ +} + +class PHP_Token_CHARACTER extends PHP_Token +{ +} + +class PHP_Token_CLASS extends PHP_Token_INTERFACE +{ + /** + * @var bool + */ + private $anonymous = false; + + /** + * @var string + */ + private $name; + + /** + * @return string + */ + public function getName() + { + if ($this->name !== null) { + return $this->name; + } + + $next = $this->tokenStream[$this->id + 1]; + + if ($next instanceof PHP_Token_WHITESPACE) { + $next = $this->tokenStream[$this->id + 2]; + } + + if ($next instanceof PHP_Token_STRING) { + $this->name =(string) $next; + + return $this->name; + } + + if ($next instanceof PHP_Token_OPEN_CURLY || + $next instanceof PHP_Token_EXTENDS || + $next instanceof PHP_Token_IMPLEMENTS) { + + $this->name = sprintf( + 'AnonymousClass:%s#%s', + $this->getLine(), + $this->getId() + ); + + $this->anonymous = true; + + return $this->name; + } + } + + public function isAnonymous() + { + return $this->anonymous; + } +} + +class PHP_Token_CLASS_C extends PHP_Token +{ +} + +class PHP_Token_CLASS_NAME_CONSTANT extends PHP_Token +{ +} + +class PHP_Token_CLONE extends PHP_Token +{ +} + +class PHP_Token_CLOSE_BRACKET extends PHP_Token +{ +} + +class PHP_Token_CLOSE_CURLY extends PHP_Token +{ +} + +class PHP_Token_CLOSE_SQUARE extends PHP_Token +{ +} + +class PHP_Token_CLOSE_TAG extends PHP_Token +{ +} + +class PHP_Token_COLON extends PHP_Token +{ +} + +class PHP_Token_COMMA extends PHP_Token +{ +} + +class PHP_Token_COMMENT extends PHP_Token +{ +} + +class PHP_Token_CONCAT_EQUAL extends PHP_Token +{ +} + +class PHP_Token_CONST extends PHP_Token +{ +} + +class PHP_Token_CONSTANT_ENCAPSED_STRING extends PHP_Token +{ +} + +class PHP_Token_CONTINUE extends PHP_Token +{ +} + +class PHP_Token_CURLY_OPEN extends PHP_Token +{ +} + +class PHP_Token_DEC extends PHP_Token +{ +} + +class PHP_Token_DECLARE extends PHP_Token +{ +} + +class PHP_Token_DEFAULT extends PHP_Token +{ +} + +class PHP_Token_DIV extends PHP_Token +{ +} + +class PHP_Token_DIV_EQUAL extends PHP_Token +{ +} + +class PHP_Token_DNUMBER extends PHP_Token +{ +} + +class PHP_Token_DO extends PHP_Token +{ +} + +class PHP_Token_DOC_COMMENT extends PHP_Token +{ +} + +class PHP_Token_DOLLAR extends PHP_Token +{ +} + +class PHP_Token_DOLLAR_OPEN_CURLY_BRACES extends PHP_Token +{ +} + +class PHP_Token_DOT extends PHP_Token +{ +} + +class PHP_Token_DOUBLE_ARROW extends PHP_Token +{ +} + +class PHP_Token_DOUBLE_CAST extends PHP_Token +{ +} + +class PHP_Token_DOUBLE_COLON extends PHP_Token +{ +} + +class PHP_Token_DOUBLE_QUOTES extends PHP_Token +{ +} + +class PHP_Token_ECHO extends PHP_Token +{ +} + +class PHP_Token_ELSE extends PHP_Token +{ +} + +class PHP_Token_ELSEIF extends PHP_Token +{ +} + +class PHP_Token_EMPTY extends PHP_Token +{ +} + +class PHP_Token_ENCAPSED_AND_WHITESPACE extends PHP_Token +{ +} + +class PHP_Token_ENDDECLARE extends PHP_Token +{ +} + +class PHP_Token_ENDFOR extends PHP_Token +{ +} + +class PHP_Token_ENDFOREACH extends PHP_Token +{ +} + +class PHP_Token_ENDIF extends PHP_Token +{ +} + +class PHP_Token_ENDSWITCH extends PHP_Token +{ +} + +class PHP_Token_ENDWHILE extends PHP_Token +{ +} + +class PHP_Token_END_HEREDOC extends PHP_Token +{ +} + +class PHP_Token_EQUAL extends PHP_Token +{ +} + +class PHP_Token_EVAL extends PHP_Token +{ +} + +class PHP_Token_EXCLAMATION_MARK extends PHP_Token +{ +} + +class PHP_Token_EXIT extends PHP_Token +{ +} + +class PHP_Token_EXTENDS extends PHP_Token +{ +} + +class PHP_Token_FILE extends PHP_Token +{ +} + +class PHP_Token_FINAL extends PHP_Token +{ +} + +class PHP_Token_FOR extends PHP_Token +{ +} + +class PHP_Token_FOREACH extends PHP_Token +{ +} + +class PHP_Token_FUNC_C extends PHP_Token +{ +} + +class PHP_Token_GLOBAL extends PHP_Token +{ +} + +class PHP_Token_GT extends PHP_Token +{ +} + +class PHP_Token_IF extends PHP_Token +{ +} + +class PHP_Token_IMPLEMENTS extends PHP_Token +{ +} + +class PHP_Token_INC extends PHP_Token +{ +} + +class PHP_Token_INCLUDE extends PHP_Token_Includes +{ +} + +class PHP_Token_INCLUDE_ONCE extends PHP_Token_Includes +{ +} + +class PHP_Token_INLINE_HTML extends PHP_Token +{ +} + +class PHP_Token_INSTANCEOF extends PHP_Token +{ +} + +class PHP_Token_INT_CAST extends PHP_Token +{ +} + +class PHP_Token_ISSET extends PHP_Token +{ +} + +class PHP_Token_IS_EQUAL extends PHP_Token +{ +} + +class PHP_Token_IS_GREATER_OR_EQUAL extends PHP_Token +{ +} + +class PHP_Token_IS_IDENTICAL extends PHP_Token +{ +} + +class PHP_Token_IS_NOT_EQUAL extends PHP_Token +{ +} + +class PHP_Token_IS_NOT_IDENTICAL extends PHP_Token +{ +} + +class PHP_Token_IS_SMALLER_OR_EQUAL extends PHP_Token +{ +} + +class PHP_Token_LINE extends PHP_Token +{ +} + +class PHP_Token_LIST extends PHP_Token +{ +} + +class PHP_Token_LNUMBER extends PHP_Token +{ +} + +class PHP_Token_LOGICAL_AND extends PHP_Token +{ +} + +class PHP_Token_LOGICAL_OR extends PHP_Token +{ +} + +class PHP_Token_LOGICAL_XOR extends PHP_Token +{ +} + +class PHP_Token_LT extends PHP_Token +{ +} + +class PHP_Token_METHOD_C extends PHP_Token +{ +} + +class PHP_Token_MINUS extends PHP_Token +{ +} + +class PHP_Token_MINUS_EQUAL extends PHP_Token +{ +} + +class PHP_Token_MOD_EQUAL extends PHP_Token +{ +} + +class PHP_Token_MULT extends PHP_Token +{ +} + +class PHP_Token_MUL_EQUAL extends PHP_Token +{ +} + +class PHP_Token_NEW extends PHP_Token +{ +} + +class PHP_Token_NUM_STRING extends PHP_Token +{ +} + +class PHP_Token_OBJECT_CAST extends PHP_Token +{ +} + +class PHP_Token_OBJECT_OPERATOR extends PHP_Token +{ +} + +class PHP_Token_OPEN_BRACKET extends PHP_Token +{ +} + +class PHP_Token_OPEN_CURLY extends PHP_Token +{ +} + +class PHP_Token_OPEN_SQUARE extends PHP_Token +{ +} + +class PHP_Token_OPEN_TAG extends PHP_Token +{ +} + +class PHP_Token_OPEN_TAG_WITH_ECHO extends PHP_Token +{ +} + +class PHP_Token_OR_EQUAL extends PHP_Token +{ +} + +class PHP_Token_PAAMAYIM_NEKUDOTAYIM extends PHP_Token +{ +} + +class PHP_Token_PERCENT extends PHP_Token +{ +} + +class PHP_Token_PIPE extends PHP_Token +{ +} + +class PHP_Token_PLUS extends PHP_Token +{ +} + +class PHP_Token_PLUS_EQUAL extends PHP_Token +{ +} + +class PHP_Token_PRINT extends PHP_Token +{ +} + +class PHP_Token_PRIVATE extends PHP_Token +{ +} + +class PHP_Token_PROTECTED extends PHP_Token +{ +} + +class PHP_Token_PUBLIC extends PHP_Token +{ +} + +class PHP_Token_QUESTION_MARK extends PHP_Token +{ +} + +class PHP_Token_REQUIRE extends PHP_Token_Includes +{ +} + +class PHP_Token_REQUIRE_ONCE extends PHP_Token_Includes +{ +} + +class PHP_Token_RETURN extends PHP_Token +{ +} + +class PHP_Token_SEMICOLON extends PHP_Token +{ +} + +class PHP_Token_SL extends PHP_Token +{ +} + +class PHP_Token_SL_EQUAL extends PHP_Token +{ +} + +class PHP_Token_SR extends PHP_Token +{ +} + +class PHP_Token_SR_EQUAL extends PHP_Token +{ +} + +class PHP_Token_START_HEREDOC extends PHP_Token +{ +} + +class PHP_Token_STATIC extends PHP_Token +{ +} + +class PHP_Token_STRING extends PHP_Token +{ +} + +class PHP_Token_STRING_CAST extends PHP_Token +{ +} + +class PHP_Token_STRING_VARNAME extends PHP_Token +{ +} + +class PHP_Token_SWITCH extends PHP_Token +{ +} + +class PHP_Token_THROW extends PHP_Token +{ +} + +class PHP_Token_TILDE extends PHP_Token +{ +} + +class PHP_Token_TRY extends PHP_Token +{ +} + +class PHP_Token_UNSET extends PHP_Token +{ +} + +class PHP_Token_UNSET_CAST extends PHP_Token +{ +} + +class PHP_Token_USE extends PHP_Token +{ +} + +class PHP_Token_USE_FUNCTION extends PHP_Token +{ +} + +class PHP_Token_VAR extends PHP_Token +{ +} + +class PHP_Token_VARIABLE extends PHP_Token +{ +} + +class PHP_Token_WHILE extends PHP_Token +{ +} + +class PHP_Token_WHITESPACE extends PHP_Token +{ +} + +class PHP_Token_XOR_EQUAL extends PHP_Token +{ +} + +// Tokens introduced in PHP 5.1 +class PHP_Token_HALT_COMPILER extends PHP_Token +{ +} + +// Tokens introduced in PHP 5.3 +class PHP_Token_DIR extends PHP_Token +{ +} + +class PHP_Token_GOTO extends PHP_Token +{ +} + +class PHP_Token_NAMESPACE extends PHP_TokenWithScope +{ + /** + * @return string + */ + public function getName() + { + $tokens = $this->tokenStream->tokens(); + $namespace = (string) $tokens[$this->id + 2]; + + for ($i = $this->id + 3;; $i += 2) { + if (isset($tokens[$i]) && + $tokens[$i] instanceof PHP_Token_NS_SEPARATOR) { + $namespace .= '\\' . $tokens[$i + 1]; + } else { + break; + } + } + + return $namespace; + } +} + +class PHP_Token_NS_C extends PHP_Token +{ +} + +class PHP_Token_NS_SEPARATOR extends PHP_Token +{ +} + +// Tokens introduced in PHP 5.4 +class PHP_Token_CALLABLE extends PHP_Token +{ +} + +class PHP_Token_INSTEADOF extends PHP_Token +{ +} + +class PHP_Token_TRAIT extends PHP_Token_INTERFACE +{ +} + +class PHP_Token_TRAIT_C extends PHP_Token +{ +} + +// Tokens introduced in PHP 5.5 +class PHP_Token_FINALLY extends PHP_Token +{ +} + +class PHP_Token_YIELD extends PHP_Token +{ +} + +// Tokens introduced in PHP 5.6 +class PHP_Token_ELLIPSIS extends PHP_Token +{ +} + +class PHP_Token_POW extends PHP_Token +{ +} + +class PHP_Token_POW_EQUAL extends PHP_Token +{ +} + +// Tokens introduced in PHP 7.0 +class PHP_Token_COALESCE extends PHP_Token +{ +} + +class PHP_Token_SPACESHIP extends PHP_Token +{ +} + +class PHP_Token_YIELD_FROM extends PHP_Token +{ +} diff --git a/vendor/phpunit/php-token-stream/src/Token/Stream.php b/vendor/phpunit/php-token-stream/src/Token/Stream.php new file mode 100644 index 0000000..fc3e3c3 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Token/Stream.php @@ -0,0 +1,607 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * A stream of PHP tokens. + */ +class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator +{ + /** + * @var array + */ + protected static $customTokens = [ + '(' => 'PHP_Token_OPEN_BRACKET', + ')' => 'PHP_Token_CLOSE_BRACKET', + '[' => 'PHP_Token_OPEN_SQUARE', + ']' => 'PHP_Token_CLOSE_SQUARE', + '{' => 'PHP_Token_OPEN_CURLY', + '}' => 'PHP_Token_CLOSE_CURLY', + ';' => 'PHP_Token_SEMICOLON', + '.' => 'PHP_Token_DOT', + ',' => 'PHP_Token_COMMA', + '=' => 'PHP_Token_EQUAL', + '<' => 'PHP_Token_LT', + '>' => 'PHP_Token_GT', + '+' => 'PHP_Token_PLUS', + '-' => 'PHP_Token_MINUS', + '*' => 'PHP_Token_MULT', + '/' => 'PHP_Token_DIV', + '?' => 'PHP_Token_QUESTION_MARK', + '!' => 'PHP_Token_EXCLAMATION_MARK', + ':' => 'PHP_Token_COLON', + '"' => 'PHP_Token_DOUBLE_QUOTES', + '@' => 'PHP_Token_AT', + '&' => 'PHP_Token_AMPERSAND', + '%' => 'PHP_Token_PERCENT', + '|' => 'PHP_Token_PIPE', + '$' => 'PHP_Token_DOLLAR', + '^' => 'PHP_Token_CARET', + '~' => 'PHP_Token_TILDE', + '`' => 'PHP_Token_BACKTICK' + ]; + + /** + * @var string + */ + protected $filename; + + /** + * @var array + */ + protected $tokens = []; + + /** + * @var int + */ + protected $position = 0; + + /** + * @var array + */ + protected $linesOfCode = ['loc' => 0, 'cloc' => 0, 'ncloc' => 0]; + + /** + * @var array + */ + protected $classes; + + /** + * @var array + */ + protected $functions; + + /** + * @var array + */ + protected $includes; + + /** + * @var array + */ + protected $interfaces; + + /** + * @var array + */ + protected $traits; + + /** + * @var array + */ + protected $lineToFunctionMap = []; + + /** + * Constructor. + * + * @param string $sourceCode + */ + public function __construct($sourceCode) + { + if (is_file($sourceCode)) { + $this->filename = $sourceCode; + $sourceCode = file_get_contents($sourceCode); + } + + $this->scan($sourceCode); + } + + /** + * Destructor. + */ + public function __destruct() + { + $this->tokens = []; + } + + /** + * @return string + */ + public function __toString() + { + $buffer = ''; + + foreach ($this as $token) { + $buffer .= $token; + } + + return $buffer; + } + + /** + * @return string + */ + public function getFilename() + { + return $this->filename; + } + + /** + * Scans the source for sequences of characters and converts them into a + * stream of tokens. + * + * @param string $sourceCode + */ + protected function scan($sourceCode) + { + $id = 0; + $line = 1; + $tokens = token_get_all($sourceCode); + $numTokens = count($tokens); + + $lastNonWhitespaceTokenWasDoubleColon = false; + + for ($i = 0; $i < $numTokens; ++$i) { + $token = $tokens[$i]; + $skip = 0; + + if (is_array($token)) { + $name = substr(token_name($token[0]), 2); + $text = $token[1]; + + if ($lastNonWhitespaceTokenWasDoubleColon && $name == 'CLASS') { + $name = 'CLASS_NAME_CONSTANT'; + } elseif ($name == 'USE' && isset($tokens[$i + 2][0]) && $tokens[$i + 2][0] == T_FUNCTION) { + $name = 'USE_FUNCTION'; + $text .= $tokens[$i + 1][1] . $tokens[$i + 2][1]; + $skip = 2; + } + + $tokenClass = 'PHP_Token_' . $name; + } else { + $text = $token; + $tokenClass = self::$customTokens[$token]; + } + + $this->tokens[] = new $tokenClass($text, $line, $this, $id++); + $lines = substr_count($text, "\n"); + $line += $lines; + + if ($tokenClass == 'PHP_Token_HALT_COMPILER') { + break; + } elseif ($tokenClass == 'PHP_Token_COMMENT' || + $tokenClass == 'PHP_Token_DOC_COMMENT') { + $this->linesOfCode['cloc'] += $lines + 1; + } + + if ($name == 'DOUBLE_COLON') { + $lastNonWhitespaceTokenWasDoubleColon = true; + } elseif ($name != 'WHITESPACE') { + $lastNonWhitespaceTokenWasDoubleColon = false; + } + + $i += $skip; + } + + $this->linesOfCode['loc'] = substr_count($sourceCode, "\n"); + $this->linesOfCode['ncloc'] = $this->linesOfCode['loc'] - + $this->linesOfCode['cloc']; + } + + /** + * @return int + */ + public function count() + { + return count($this->tokens); + } + + /** + * @return PHP_Token[] + */ + public function tokens() + { + return $this->tokens; + } + + /** + * @return array + */ + public function getClasses() + { + if ($this->classes !== null) { + return $this->classes; + } + + $this->parse(); + + return $this->classes; + } + + /** + * @return array + */ + public function getFunctions() + { + if ($this->functions !== null) { + return $this->functions; + } + + $this->parse(); + + return $this->functions; + } + + /** + * @return array + */ + public function getInterfaces() + { + if ($this->interfaces !== null) { + return $this->interfaces; + } + + $this->parse(); + + return $this->interfaces; + } + + /** + * @return array + */ + public function getTraits() + { + if ($this->traits !== null) { + return $this->traits; + } + + $this->parse(); + + return $this->traits; + } + + /** + * Gets the names of all files that have been included + * using include(), include_once(), require() or require_once(). + * + * Parameter $categorize set to TRUE causing this function to return a + * multi-dimensional array with categories in the keys of the first dimension + * and constants and their values in the second dimension. + * + * Parameter $category allow to filter following specific inclusion type + * + * @param bool $categorize OPTIONAL + * @param string $category OPTIONAL Either 'require_once', 'require', + * 'include_once', 'include'. + * + * @return array + */ + public function getIncludes($categorize = false, $category = null) + { + if ($this->includes === null) { + $this->includes = [ + 'require_once' => [], + 'require' => [], + 'include_once' => [], + 'include' => [] + ]; + + foreach ($this->tokens as $token) { + switch (get_class($token)) { + case 'PHP_Token_REQUIRE_ONCE': + case 'PHP_Token_REQUIRE': + case 'PHP_Token_INCLUDE_ONCE': + case 'PHP_Token_INCLUDE': + $this->includes[$token->getType()][] = $token->getName(); + break; + } + } + } + + if (isset($this->includes[$category])) { + $includes = $this->includes[$category]; + } elseif ($categorize === false) { + $includes = array_merge( + $this->includes['require_once'], + $this->includes['require'], + $this->includes['include_once'], + $this->includes['include'] + ); + } else { + $includes = $this->includes; + } + + return $includes; + } + + /** + * Returns the name of the function or method a line belongs to. + * + * @return string or null if the line is not in a function or method + */ + public function getFunctionForLine($line) + { + $this->parse(); + + if (isset($this->lineToFunctionMap[$line])) { + return $this->lineToFunctionMap[$line]; + } + } + + protected function parse() + { + $this->interfaces = []; + $this->classes = []; + $this->traits = []; + $this->functions = []; + $class = []; + $classEndLine = []; + $trait = false; + $traitEndLine = false; + $interface = false; + $interfaceEndLine = false; + + foreach ($this->tokens as $token) { + switch (get_class($token)) { + case 'PHP_Token_HALT_COMPILER': + return; + + case 'PHP_Token_INTERFACE': + $interface = $token->getName(); + $interfaceEndLine = $token->getEndLine(); + + $this->interfaces[$interface] = [ + 'methods' => [], + 'parent' => $token->getParent(), + 'keywords' => $token->getKeywords(), + 'docblock' => $token->getDocblock(), + 'startLine' => $token->getLine(), + 'endLine' => $interfaceEndLine, + 'package' => $token->getPackage(), + 'file' => $this->filename + ]; + break; + + case 'PHP_Token_CLASS': + case 'PHP_Token_TRAIT': + $tmp = [ + 'methods' => [], + 'parent' => $token->getParent(), + 'interfaces'=> $token->getInterfaces(), + 'keywords' => $token->getKeywords(), + 'docblock' => $token->getDocblock(), + 'startLine' => $token->getLine(), + 'endLine' => $token->getEndLine(), + 'package' => $token->getPackage(), + 'file' => $this->filename + ]; + + if ($token instanceof PHP_Token_CLASS) { + $class[] = $token->getName(); + $classEndLine[] = $token->getEndLine(); + + $this->classes[$class[count($class) - 1]] = $tmp; + } else { + $trait = $token->getName(); + $traitEndLine = $token->getEndLine(); + $this->traits[$trait] = $tmp; + } + break; + + case 'PHP_Token_FUNCTION': + $name = $token->getName(); + $tmp = [ + 'docblock' => $token->getDocblock(), + 'keywords' => $token->getKeywords(), + 'visibility'=> $token->getVisibility(), + 'signature' => $token->getSignature(), + 'startLine' => $token->getLine(), + 'endLine' => $token->getEndLine(), + 'ccn' => $token->getCCN(), + 'file' => $this->filename + ]; + + if (empty($class) && + $trait === false && + $interface === false) { + $this->functions[$name] = $tmp; + + $this->addFunctionToMap( + $name, + $tmp['startLine'], + $tmp['endLine'] + ); + } elseif (!empty($class)) { + $this->classes[$class[count($class) - 1]]['methods'][$name] = $tmp; + + $this->addFunctionToMap( + $class[count($class) - 1] . '::' . $name, + $tmp['startLine'], + $tmp['endLine'] + ); + } elseif ($trait !== false) { + $this->traits[$trait]['methods'][$name] = $tmp; + + $this->addFunctionToMap( + $trait . '::' . $name, + $tmp['startLine'], + $tmp['endLine'] + ); + } else { + $this->interfaces[$interface]['methods'][$name] = $tmp; + } + break; + + case 'PHP_Token_CLOSE_CURLY': + if (!empty($classEndLine) && + $classEndLine[count($classEndLine) - 1] == $token->getLine()) { + array_pop($classEndLine); + array_pop($class); + } elseif ($traitEndLine !== false && + $traitEndLine == $token->getLine()) { + $trait = false; + $traitEndLine = false; + } elseif ($interfaceEndLine !== false && + $interfaceEndLine == $token->getLine()) { + $interface = false; + $interfaceEndLine = false; + } + break; + } + } + } + + /** + * @return array + */ + public function getLinesOfCode() + { + return $this->linesOfCode; + } + + /** + */ + public function rewind() + { + $this->position = 0; + } + + /** + * @return bool + */ + public function valid() + { + return isset($this->tokens[$this->position]); + } + + /** + * @return int + */ + public function key() + { + return $this->position; + } + + /** + * @return PHP_Token + */ + public function current() + { + return $this->tokens[$this->position]; + } + + /** + */ + public function next() + { + $this->position++; + } + + /** + * @param int $offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->tokens[$offset]); + } + + /** + * @param int $offset + * + * @return mixed + * + * @throws OutOfBoundsException + */ + public function offsetGet($offset) + { + if (!$this->offsetExists($offset)) { + throw new OutOfBoundsException( + sprintf( + 'No token at position "%s"', + $offset + ) + ); + } + + return $this->tokens[$offset]; + } + + /** + * @param int $offset + * @param mixed $value + */ + public function offsetSet($offset, $value) + { + $this->tokens[$offset] = $value; + } + + /** + * @param int $offset + * + * @throws OutOfBoundsException + */ + public function offsetUnset($offset) + { + if (!$this->offsetExists($offset)) { + throw new OutOfBoundsException( + sprintf( + 'No token at position "%s"', + $offset + ) + ); + } + + unset($this->tokens[$offset]); + } + + /** + * Seek to an absolute position. + * + * @param int $position + * + * @throws OutOfBoundsException + */ + public function seek($position) + { + $this->position = $position; + + if (!$this->valid()) { + throw new OutOfBoundsException( + sprintf( + 'No token at position "%s"', + $this->position + ) + ); + } + } + + /** + * @param string $name + * @param int $startLine + * @param int $endLine + */ + private function addFunctionToMap($name, $startLine, $endLine) + { + for ($line = $startLine; $line <= $endLine; $line++) { + $this->lineToFunctionMap[$line] = $name; + } + } +} diff --git a/vendor/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php b/vendor/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php new file mode 100644 index 0000000..9d69393 --- /dev/null +++ b/vendor/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * A caching factory for token stream objects. + */ +class PHP_Token_Stream_CachingFactory +{ + /** + * @var array + */ + protected static $cache = []; + + /** + * @param string $filename + * + * @return PHP_Token_Stream + */ + public static function get($filename) + { + if (!isset(self::$cache[$filename])) { + self::$cache[$filename] = new PHP_Token_Stream($filename); + } + + return self::$cache[$filename]; + } + + /** + * @param string $filename + */ + public static function clear($filename = null) + { + if (is_string($filename)) { + unset(self::$cache[$filename]); + } else { + self::$cache = []; + } + } +} diff --git a/vendor/phpunit/php-token-stream/tests/Token/ClassTest.php b/vendor/phpunit/php-token-stream/tests/Token/ClassTest.php new file mode 100644 index 0000000..92eee67 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/Token/ClassTest.php @@ -0,0 +1,169 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PHPUnit\Framework\TestCase; + +class PHP_Token_ClassTest extends TestCase +{ + /** + * @var PHP_Token_CLASS + */ + private $class; + + /** + * @var PHP_Token_FUNCTION + */ + private $function; + + protected function setUp() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source2.php'); + + foreach ($ts as $token) { + if ($token instanceof PHP_Token_CLASS) { + $this->class = $token; + } + + if ($token instanceof PHP_Token_FUNCTION) { + $this->function = $token; + break; + } + } + } + + /** + * @covers PHP_Token_CLASS::getKeywords + */ + public function testGetClassKeywords() + { + $this->assertEquals('abstract', $this->class->getKeywords()); + } + + /** + * @covers PHP_Token_FUNCTION::getKeywords + */ + public function testGetFunctionKeywords() + { + $this->assertEquals('abstract,static', $this->function->getKeywords()); + } + + /** + * @covers PHP_Token_FUNCTION::getVisibility + */ + public function testGetFunctionVisibility() + { + $this->assertEquals('public', $this->function->getVisibility()); + } + + public function testIssue19() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'issue19.php'); + + foreach ($ts as $token) { + if ($token instanceof PHP_Token_CLASS) { + $this->assertFalse($token->hasInterfaces()); + } + } + } + + public function testIssue30() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'issue30.php'); + $this->assertCount(1, $ts->getClasses()); + } + + public function testAnonymousClassesAreHandledCorrectly() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_method_that_declares_anonymous_class.php'); + + $classes = $ts->getClasses(); + + $this->assertEquals( + [ + 'class_with_method_that_declares_anonymous_class', + 'AnonymousClass:9#31', + 'AnonymousClass:10#55', + 'AnonymousClass:11#75', + 'AnonymousClass:12#91', + 'AnonymousClass:13#107' + ], + array_keys($classes) + ); + } + + /** + * @ticket https://github.com/sebastianbergmann/php-token-stream/issues/52 + */ + public function testAnonymousClassesAreHandledCorrectly2() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_method_that_declares_anonymous_class2.php'); + + $classes = $ts->getClasses(); + + $this->assertEquals(['Test', 'AnonymousClass:4#23'], array_keys($classes)); + $this->assertEquals(['methodOne', 'methodTwo'], array_keys($classes['Test']['methods'])); + + $this->assertEmpty($ts->getFunctions()); + } + + public function testImportedFunctionsAreHandledCorrectly() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'classUsesNamespacedFunction.php'); + + $this->assertEmpty($ts->getFunctions()); + $this->assertCount(1, $ts->getClasses()); + } + + /** + * @ticket https://github.com/sebastianbergmann/php-code-coverage/issues/543 + */ + public function testClassWithMultipleAnonymousClassesAndFunctionsIsHandledCorrectly() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_multiple_anonymous_classes_and_functions.php'); + + $classes = $ts->getClasses(); + + $this->assertArrayHasKey('class_with_multiple_anonymous_classes_and_functions', $classes); + $this->assertArrayHasKey('AnonymousClass:6#23', $classes); + $this->assertArrayHasKey('AnonymousClass:12#53', $classes); + $this->assertArrayHasKey('m', $classes['class_with_multiple_anonymous_classes_and_functions']['methods']); + $this->assertArrayHasKey('anonymousFunction:18#81', $classes['class_with_multiple_anonymous_classes_and_functions']['methods']); + $this->assertArrayHasKey('anonymousFunction:22#108', $classes['class_with_multiple_anonymous_classes_and_functions']['methods']); + } + + /** + * @ticket https://github.com/sebastianbergmann/php-token-stream/issues/68 + */ + public function testClassWithMethodNamedEmptyIsHandledCorrectly() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_method_named_empty.php'); + + $classes = $ts->getClasses(); + + $this->assertArrayHasKey('class_with_method_named_empty', $classes); + $this->assertArrayHasKey('empty', $classes['class_with_method_named_empty']['methods']); + } + + /** + * @ticket https://github.com/sebastianbergmann/php-code-coverage/issues/424 + */ + public function testAnonymousFunctionDoesNotAffectStartAndEndLineOfMethod() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'php-code-coverage-issue-424.php'); + + $classes = $ts->getClasses(); + + $this->assertSame(5, $classes['Example']['methods']['even']['startLine']); + $this->assertSame(12, $classes['Example']['methods']['even']['endLine']); + + $this->assertSame(7, $classes['Example']['methods']['anonymousFunction:7#28']['startLine']); + $this->assertSame(9, $classes['Example']['methods']['anonymousFunction:7#28']['endLine']); + } +} diff --git a/vendor/phpunit/php-token-stream/tests/Token/ClosureTest.php b/vendor/phpunit/php-token-stream/tests/Token/ClosureTest.php new file mode 100644 index 0000000..b4a6735 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/Token/ClosureTest.php @@ -0,0 +1,78 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PHPUnit\Framework\TestCase; + +class PHP_Token_ClosureTest extends TestCase +{ + /** + * @var PHP_Token_FUNCTION[] + */ + private $functions; + + protected function setUp() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'closure.php'); + + foreach ($ts as $token) { + if ($token instanceof PHP_Token_FUNCTION) { + $this->functions[] = $token; + } + } + } + + /** + * @covers PHP_Token_FUNCTION::getArguments + */ + public function testGetArguments() + { + $this->assertEquals(['$foo' => null, '$bar' => null], $this->functions[0]->getArguments()); + $this->assertEquals(['$foo' => 'Foo', '$bar' => null], $this->functions[1]->getArguments()); + $this->assertEquals(['$foo' => null, '$bar' => null, '$baz' => null], $this->functions[2]->getArguments()); + $this->assertEquals(['$foo' => 'Foo', '$bar' => null, '$baz' => null], $this->functions[3]->getArguments()); + $this->assertEquals([], $this->functions[4]->getArguments()); + $this->assertEquals([], $this->functions[5]->getArguments()); + } + + /** + * @covers PHP_Token_FUNCTION::getName + */ + public function testGetName() + { + $this->assertEquals('anonymousFunction:2#5', $this->functions[0]->getName()); + $this->assertEquals('anonymousFunction:3#27', $this->functions[1]->getName()); + $this->assertEquals('anonymousFunction:4#51', $this->functions[2]->getName()); + $this->assertEquals('anonymousFunction:5#71', $this->functions[3]->getName()); + $this->assertEquals('anonymousFunction:6#93', $this->functions[4]->getName()); + $this->assertEquals('anonymousFunction:7#106', $this->functions[5]->getName()); + } + + /** + * @covers PHP_Token::getLine + */ + public function testGetLine() + { + $this->assertEquals(2, $this->functions[0]->getLine()); + $this->assertEquals(3, $this->functions[1]->getLine()); + $this->assertEquals(4, $this->functions[2]->getLine()); + $this->assertEquals(5, $this->functions[3]->getLine()); + } + + /** + * @covers PHP_TokenWithScope::getEndLine + */ + public function testGetEndLine() + { + $this->assertEquals(2, $this->functions[0]->getLine()); + $this->assertEquals(3, $this->functions[1]->getLine()); + $this->assertEquals(4, $this->functions[2]->getLine()); + $this->assertEquals(5, $this->functions[3]->getLine()); + } +} diff --git a/vendor/phpunit/php-token-stream/tests/Token/FunctionTest.php b/vendor/phpunit/php-token-stream/tests/Token/FunctionTest.php new file mode 100644 index 0000000..5d09e4f --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/Token/FunctionTest.php @@ -0,0 +1,141 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PHPUnit\Framework\TestCase; + +class PHP_Token_FunctionTest extends TestCase +{ + /** + * @var PHP_Token_FUNCTION[] + */ + private $functions; + + protected function setUp() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source.php'); + + foreach ($ts as $token) { + if ($token instanceof PHP_Token_FUNCTION) { + $this->functions[] = $token; + } + } + } + + /** + * @covers PHP_Token_FUNCTION::getArguments + */ + public function testGetArguments() + { + $this->assertEquals([], $this->functions[0]->getArguments()); + + $this->assertEquals( + ['$baz' => 'Baz'], $this->functions[1]->getArguments() + ); + + $this->assertEquals( + ['$foobar' => 'Foobar'], $this->functions[2]->getArguments() + ); + + $this->assertEquals( + ['$barfoo' => 'Barfoo'], $this->functions[3]->getArguments() + ); + + $this->assertEquals([], $this->functions[4]->getArguments()); + + $this->assertEquals(['$x' => null, '$y' => null], $this->functions[5]->getArguments()); + } + + /** + * @covers PHP_Token_FUNCTION::getName + */ + public function testGetName() + { + $this->assertEquals('foo', $this->functions[0]->getName()); + $this->assertEquals('bar', $this->functions[1]->getName()); + $this->assertEquals('foobar', $this->functions[2]->getName()); + $this->assertEquals('barfoo', $this->functions[3]->getName()); + $this->assertEquals('baz', $this->functions[4]->getName()); + } + + /** + * @covers PHP_Token::getLine + */ + public function testGetLine() + { + $this->assertEquals(5, $this->functions[0]->getLine()); + $this->assertEquals(10, $this->functions[1]->getLine()); + $this->assertEquals(17, $this->functions[2]->getLine()); + $this->assertEquals(21, $this->functions[3]->getLine()); + $this->assertEquals(29, $this->functions[4]->getLine()); + $this->assertEquals(37, $this->functions[6]->getLine()); + } + + /** + * @covers PHP_TokenWithScope::getEndLine + */ + public function testGetEndLine() + { + $this->assertEquals(5, $this->functions[0]->getEndLine()); + $this->assertEquals(12, $this->functions[1]->getEndLine()); + $this->assertEquals(19, $this->functions[2]->getEndLine()); + $this->assertEquals(23, $this->functions[3]->getEndLine()); + $this->assertEquals(31, $this->functions[4]->getEndLine()); + $this->assertEquals(41, $this->functions[6]->getEndLine()); + } + + /** + * @covers PHP_Token_FUNCTION::getDocblock + */ + public function testGetDocblock() + { + $this->assertNull($this->functions[0]->getDocblock()); + + $this->assertEquals( + "/**\n * @param Baz \$baz\n */", + $this->functions[1]->getDocblock() + ); + + $this->assertEquals( + "/**\n * @param Foobar \$foobar\n */", + $this->functions[2]->getDocblock() + ); + + $this->assertNull($this->functions[3]->getDocblock()); + $this->assertNull($this->functions[4]->getDocblock()); + } + + public function testSignature() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source5.php'); + $f = $ts->getFunctions(); + $c = $ts->getClasses(); + $i = $ts->getInterfaces(); + + $this->assertEquals( + 'foo($a, array $b, array $c = array())', + $f['foo']['signature'] + ); + + $this->assertEquals( + 'm($a, array $b, array $c = array())', + $c['c']['methods']['m']['signature'] + ); + + $this->assertEquals( + 'm($a, array $b, array $c = array())', + $c['a']['methods']['m']['signature'] + ); + + $this->assertEquals( + 'm($a, array $b, array $c = array())', + $i['i']['methods']['m']['signature'] + ); + } +} diff --git a/vendor/phpunit/php-token-stream/tests/Token/IncludeTest.php b/vendor/phpunit/php-token-stream/tests/Token/IncludeTest.php new file mode 100644 index 0000000..2056d12 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/Token/IncludeTest.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PHPUnit\Framework\TestCase; + +class PHP_Token_IncludeTest extends TestCase +{ + /** + * @var PHP_Token_Stream + */ + private $ts; + + protected function setUp() + { + $this->ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source3.php'); + } + + /** + * @covers PHP_Token_Includes::getName + * @covers PHP_Token_Includes::getType + */ + public function testGetIncludes() + { + $this->assertSame( + ['test4.php', 'test3.php', 'test2.php', 'test1.php'], + $this->ts->getIncludes() + ); + } + + /** + * @covers PHP_Token_Includes::getName + * @covers PHP_Token_Includes::getType + */ + public function testGetIncludesCategorized() + { + $this->assertSame( + [ + 'require_once' => ['test4.php'], + 'require' => ['test3.php'], + 'include_once' => ['test2.php'], + 'include' => ['test1.php'] + ], + $this->ts->getIncludes(true) + ); + } + + /** + * @covers PHP_Token_Includes::getName + * @covers PHP_Token_Includes::getType + */ + public function testGetIncludesCategory() + { + $this->assertSame( + ['test4.php'], + $this->ts->getIncludes(true, 'require_once') + ); + } +} diff --git a/vendor/phpunit/php-token-stream/tests/Token/InterfaceTest.php b/vendor/phpunit/php-token-stream/tests/Token/InterfaceTest.php new file mode 100644 index 0000000..6beb2ef --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/Token/InterfaceTest.php @@ -0,0 +1,195 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PHPUnit\Framework\TestCase; + +class PHP_Token_InterfaceTest extends TestCase +{ + /** + * @var PHP_Token_CLASS + */ + private $class; + + /** + * @var PHP_Token_INTERFACE[] + */ + private $interfaces; + + protected function setUp() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source4.php'); + $i = 0; + + foreach ($ts as $token) { + if ($token instanceof PHP_Token_CLASS) { + $this->class = $token; + } elseif ($token instanceof PHP_Token_INTERFACE) { + $this->interfaces[$i] = $token; + $i++; + } + } + } + + /** + * @covers PHP_Token_INTERFACE::getName + */ + public function testGetName() + { + $this->assertEquals( + 'iTemplate', $this->interfaces[0]->getName() + ); + } + + /** + * @covers PHP_Token_INTERFACE::getParent + */ + public function testGetParentNotExists() + { + $this->assertFalse( + $this->interfaces[0]->getParent() + ); + } + + /** + * @covers PHP_Token_INTERFACE::hasParent + */ + public function testHasParentNotExists() + { + $this->assertFalse( + $this->interfaces[0]->hasParent() + ); + } + + /** + * @covers PHP_Token_INTERFACE::getParent + */ + public function testGetParentExists() + { + $this->assertEquals( + 'a', $this->interfaces[2]->getParent() + ); + } + + /** + * @covers PHP_Token_INTERFACE::hasParent + */ + public function testHasParentExists() + { + $this->assertTrue( + $this->interfaces[2]->hasParent() + ); + } + + /** + * @covers PHP_Token_INTERFACE::getInterfaces + */ + public function testGetInterfacesExists() + { + $this->assertEquals( + ['b'], + $this->class->getInterfaces() + ); + } + + /** + * @covers PHP_Token_INTERFACE::hasInterfaces + */ + public function testHasInterfacesExists() + { + $this->assertTrue( + $this->class->hasInterfaces() + ); + } + + /** + * @covers PHP_Token_INTERFACE::getPackage + */ + public function testGetPackageNamespace() + { + $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php'); + foreach ($tokenStream as $token) { + if ($token instanceof PHP_Token_INTERFACE) { + $package = $token->getPackage(); + $this->assertSame('Foo\\Bar', $package['namespace']); + } + } + } + + + public function provideFilesWithClassesWithinMultipleNamespaces() + { + return [ + [TEST_FILES_PATH . 'multipleNamespacesWithOneClassUsingBraces.php'], + [TEST_FILES_PATH . 'multipleNamespacesWithOneClassUsingNonBraceSyntax.php'], + ]; + } + + /** + * @dataProvider provideFilesWithClassesWithinMultipleNamespaces + * @covers PHP_Token_INTERFACE::getPackage + */ + public function testGetPackageNamespaceForFileWithMultipleNamespaces($filepath) + { + $tokenStream = new PHP_Token_Stream($filepath); + $firstClassFound = false; + foreach ($tokenStream as $token) { + if ($firstClassFound === false && $token instanceof PHP_Token_INTERFACE) { + $package = $token->getPackage(); + $this->assertSame('TestClassInBar', $token->getName()); + $this->assertSame('Foo\\Bar', $package['namespace']); + $firstClassFound = true; + continue; + } + // Secound class + if ($token instanceof PHP_Token_INTERFACE) { + $package = $token->getPackage(); + $this->assertSame('TestClassInBaz', $token->getName()); + $this->assertSame('Foo\\Baz', $package['namespace']); + + return; + } + } + $this->fail('Searching for 2 classes failed'); + } + + public function testGetPackageNamespaceIsEmptyForInterfacesThatAreNotWithinNamespaces() + { + foreach ($this->interfaces as $token) { + $package = $token->getPackage(); + $this->assertSame('', $package['namespace']); + } + } + + /** + * @covers PHP_Token_INTERFACE::getPackage + */ + public function testGetPackageNamespaceWhenExtentingFromNamespaceClass() + { + $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classExtendsNamespacedClass.php'); + $firstClassFound = false; + foreach ($tokenStream as $token) { + if ($firstClassFound === false && $token instanceof PHP_Token_INTERFACE) { + $package = $token->getPackage(); + $this->assertSame('Baz', $token->getName()); + $this->assertSame('Foo\\Bar', $package['namespace']); + $firstClassFound = true; + continue; + } + if ($token instanceof PHP_Token_INTERFACE) { + $package = $token->getPackage(); + $this->assertSame('Extender', $token->getName()); + $this->assertSame('Other\\Space', $package['namespace']); + + return; + } + } + $this->fail('Searching for 2 classes failed'); + } +} diff --git a/vendor/phpunit/php-token-stream/tests/Token/NamespaceTest.php b/vendor/phpunit/php-token-stream/tests/Token/NamespaceTest.php new file mode 100644 index 0000000..98360cf --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/Token/NamespaceTest.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PHPUnit\Framework\TestCase; + +class PHP_Token_NamespaceTest extends TestCase +{ + /** + * @covers PHP_Token_NAMESPACE::getName + */ + public function testGetName() + { + $tokenStream = new PHP_Token_Stream( + TEST_FILES_PATH . 'classInNamespace.php' + ); + + foreach ($tokenStream as $token) { + if ($token instanceof PHP_Token_NAMESPACE) { + $this->assertSame('Foo\\Bar', $token->getName()); + } + } + } + + public function testGetStartLineWithUnscopedNamespace() + { + $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php'); + foreach ($tokenStream as $token) { + if ($token instanceof PHP_Token_NAMESPACE) { + $this->assertSame(2, $token->getLine()); + } + } + } + + public function testGetEndLineWithUnscopedNamespace() + { + $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php'); + foreach ($tokenStream as $token) { + if ($token instanceof PHP_Token_NAMESPACE) { + $this->assertSame(2, $token->getEndLine()); + } + } + } + public function testGetStartLineWithScopedNamespace() + { + $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInScopedNamespace.php'); + foreach ($tokenStream as $token) { + if ($token instanceof PHP_Token_NAMESPACE) { + $this->assertSame(2, $token->getLine()); + } + } + } + + public function testGetEndLineWithScopedNamespace() + { + $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInScopedNamespace.php'); + foreach ($tokenStream as $token) { + if ($token instanceof PHP_Token_NAMESPACE) { + $this->assertSame(8, $token->getEndLine()); + } + } + } +} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/classExtendsNamespacedClass.php b/vendor/phpunit/php-token-stream/tests/_fixture/classExtendsNamespacedClass.php new file mode 100644 index 0000000..560eec9 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/classExtendsNamespacedClass.php @@ -0,0 +1,10 @@ +method_in_anonymous_class(); + } + + public function methodTwo() { + return false; + } +} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/class_with_multiple_anonymous_classes_and_functions.php b/vendor/phpunit/php-token-stream/tests/_fixture/class_with_multiple_anonymous_classes_and_functions.php new file mode 100644 index 0000000..3267ba5 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/class_with_multiple_anonymous_classes_and_functions.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +require __DIR__ . '/../vendor/autoload.php'; + +define( + 'TEST_FILES_PATH', + __DIR__ . DIRECTORY_SEPARATOR . '_fixture' . DIRECTORY_SEPARATOR +); diff --git a/vendor/phpunit/phpunit/.editorconfig b/vendor/phpunit/phpunit/.editorconfig new file mode 100644 index 0000000..421bd83 --- /dev/null +++ b/vendor/phpunit/phpunit/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +charset = utf-8 + +[tests/_files/*_result_cache.txt] +insert_final_newline = false diff --git a/vendor/phpunit/phpunit/.gitattributes b/vendor/phpunit/phpunit/.gitattributes new file mode 100644 index 0000000..278ace4 --- /dev/null +++ b/vendor/phpunit/phpunit/.gitattributes @@ -0,0 +1,4 @@ +/build export-ignore + +*.php diff=php + diff --git a/vendor/phpunit/phpunit/.github/CODE_OF_CONDUCT.md b/vendor/phpunit/phpunit/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..ee242a8 --- /dev/null +++ b/vendor/phpunit/phpunit/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,28 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. + +We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, such as physical or electronic + addresses, without explicit permission +* Other unethical or unprofessional conduct + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainer at sebastian@phpunit.de. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter of an incident. + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.3.0, available at [https://contributor-covenant.org/version/1/3/0/][version] + +[homepage]: https://contributor-covenant.org +[version]: https://contributor-covenant.org/version/1/3/0/ diff --git a/vendor/phpunit/phpunit/.github/CONTRIBUTING.md b/vendor/phpunit/phpunit/.github/CONTRIBUTING.md new file mode 100644 index 0000000..d46074c --- /dev/null +++ b/vendor/phpunit/phpunit/.github/CONTRIBUTING.md @@ -0,0 +1,68 @@ +# Contributing to PHPUnit + +## Contributor Code of Conduct + +Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms. + +## Workflow + +* Fork the project. +* Make your bug fix or feature addition. +* Add tests for it. This is important so we don't break it in a future version unintentionally. +* Send a pull request. Bonus points for topic branches. + +Please make sure that you have [set up your user name and email address](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) for use with Git. Strings such as `silly nick name ` look really stupid in the commit history of a project. + +Pull requests for bug fixes must be based on the current stable branch whereas pull requests for new features must be based on the `master` branch. + +We are trying to keep backwards compatibility breaks in PHPUnit to an absolute minimum. Please take this into account when proposing changes. + +Due to time constraints, we are not always able to respond as quickly as we would like. Please do not take delays personal and feel free to remind us if you feel that we forgot to respond. + +## Coding Guidelines + +This project comes with a configuration file and an executable for [php-cs-fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) (`.php_cs`) that you can use to (re)format your source code for compliance with this project's coding guidelines: + +```bash +$ ./build/tools/php-cs-fixer fix +``` + +## Using PHPUnit from a Git checkout + +The following commands can be used to perform the initial checkout of PHPUnit: + +```bash +$ git clone git://github.com/sebastianbergmann/phpunit.git + +$ cd phpunit +``` + +Retrieve PHPUnit's dependencies using [Composer](https://getcomposer.org/): + +```bash +$ composer install +``` + +The `phpunit` script can be used to invoke the PHPUnit test runner: + +```bash +$ ./phpunit --version +``` + +## Running PHPUnit's own test suite + +After following the steps shown above, PHPUnit's own test suite is run like this: + +```bash +$ ./phpunit +``` + +## Reporting issues + +Please use the most specific issue tracker to search for existing tickets and to open new tickets: + +* [General problems](https://github.com/sebastianbergmann/phpunit/issues) +* [Code Coverage](https://github.com/sebastianbergmann/php-code-coverage/issues) +* [Documentation](https://github.com/sebastianbergmann/phpunit-documentation-english/issues) +* [Website](https://github.com/sebastianbergmann/phpunit-website/issues) + diff --git a/vendor/phpunit/phpunit/.github/ISSUE_TEMPLATE.md b/vendor/phpunit/phpunit/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..ad1dc39 --- /dev/null +++ b/vendor/phpunit/phpunit/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,15 @@ +| Q | A +| --------------------| --------------- +| PHPUnit version | x.y.z +| PHP version | x.y.z +| Installation Method | Composer / PHAR + + + diff --git a/vendor/phpunit/phpunit/.github/stale.yml b/vendor/phpunit/phpunit/.github/stale.yml new file mode 100644 index 0000000..ad14f6c --- /dev/null +++ b/vendor/phpunit/phpunit/.github/stale.yml @@ -0,0 +1,47 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +# Number of days of inactivity before an Issue or Pull Request becomes stale +daysUntilStale: 60 + +# Number of days of inactivity before a stale Issue or Pull Request is closed. +# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. +daysUntilClose: 7 + +# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable +exemptLabels: + - blocked + - enhancement + - backward-compatibility-break + - feature-removal + - php-support-removal + - process + - rfc + - refactoring + +# Set to true to ignore issues in a project (defaults to false) +exemptProjects: false + +# Set to true to ignore issues in a milestone (defaults to false) +exemptMilestones: false + +# Label to use when marking as stale +staleLabel: stale + +# Comment to post when marking as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had activity within the last 60 days. It will be closed after 7 days if no further activity occurs. Thank you for your contributions. + +# Comment to post when removing the stale label. +# unmarkComment: > +# Your comment here. + +# Comment to post when closing a stale Issue or Pull Request. +closeComment: > + This issue has been automatically closed because it has not had activity since it was marked as stale. Thank you for your contributions. + +# Limit the number of actions per hour, from 1-30. Default is 30 +limitPerRun: 30 + +# Limit to only `issues` or `pulls` +only: issues + diff --git a/vendor/phpunit/phpunit/.gitignore b/vendor/phpunit/phpunit/.gitignore new file mode 100644 index 0000000..c313090 --- /dev/null +++ b/vendor/phpunit/phpunit/.gitignore @@ -0,0 +1,20 @@ +/.ant_targets +/.idea +/.php_cs +/.php_cs.cache +/.phpunit.result.cache +/build/documentation +/build/logfiles +/build/phar +/build/phpdox +/build/*.phar +/build/*.phar.asc +/build/binary-phar-autoload.php +/cache.properties +/composer.lock +/tests/end-to-end/*.diff +/tests/end-to-end/*.exp +/tests/end-to-end/*.log +/tests/end-to-end/*.out +/tests/end-to-end/*.php +/vendor diff --git a/vendor/phpunit/phpunit/.phan/config.php b/vendor/phpunit/phpunit/.phan/config.php new file mode 100644 index 0000000..5eb2b87 --- /dev/null +++ b/vendor/phpunit/phpunit/.phan/config.php @@ -0,0 +1,7 @@ + [ 'src/', 'vendor/' ], + 'exclude_analysis_directory_list' => [ 'vendor/', 'src/Framework/Assert/' ], + + 'target_php_version' => '7.1', +]; diff --git a/vendor/phpunit/phpunit/.php_cs.dist b/vendor/phpunit/phpunit/.php_cs.dist new file mode 100644 index 0000000..283cbfb --- /dev/null +++ b/vendor/phpunit/phpunit/.php_cs.dist @@ -0,0 +1,198 @@ + + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +EOF; + +return PhpCsFixer\Config::create() + ->setRiskyAllowed(true) + ->setRules( + [ + 'align_multiline_comment' => true, + 'array_indentation' => true, + 'array_syntax' => ['syntax' => 'short'], + 'binary_operator_spaces' => [ + 'operators' => [ + '=' => 'align', + '=>' => 'align', + ], + ], + 'blank_line_after_namespace' => true, + 'blank_line_before_statement' => [ + 'statements' => [ + 'break', + 'continue', + 'declare', + 'do', + 'for', + 'foreach', + 'if', + 'include', + 'include_once', + 'require', + 'require_once', + 'return', + 'switch', + 'throw', + 'try', + 'while', + 'yield', + ], + ], + 'braces' => true, + 'cast_spaces' => true, + 'class_attributes_separation' => ['elements' => ['const', 'method', 'property']], + 'combine_consecutive_issets' => true, + 'combine_consecutive_unsets' => true, + 'compact_nullable_typehint' => true, + 'concat_space' => ['spacing' => 'one'], + 'declare_equal_normalize' => ['space' => 'none'], + 'dir_constant' => true, + 'elseif' => true, + 'encoding' => true, + 'full_opening_tag' => true, + 'function_declaration' => true, + 'header_comment' => ['header' => $header, 'separate' => 'none'], + 'indentation_type' => true, + 'is_null' => true, + 'line_ending' => true, + 'list_syntax' => ['syntax' => 'short'], + 'logical_operators' => true, + 'lowercase_cast' => true, + 'lowercase_constants' => true, + 'lowercase_keywords' => true, + 'lowercase_static_reference' => true, + 'magic_constant_casing' => true, + 'method_argument_space' => ['ensure_fully_multiline' => true], + 'modernize_types_casting' => true, + 'multiline_comment_opening_closing' => true, + 'multiline_whitespace_before_semicolons' => true, + 'native_constant_invocation' => true, + 'native_function_casing' => true, + 'native_function_invocation' => true, + 'new_with_braces' => false, + 'no_alias_functions' => true, + 'no_alternative_syntax' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_blank_lines_before_namespace' => true, + 'no_closing_tag' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => true, + 'no_homoglyph_names' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => ['use' => 'print'], + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_null_property_initialization' => true, + 'no_php4_constructor' => true, + 'no_short_bool_cast' => true, + 'no_short_echo_tag' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_inside_parenthesis' => true, + 'no_superfluous_elseif' => true, + 'no_superfluous_phpdoc_tags' => true, + 'no_trailing_comma_in_list_call' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unneeded_curly_braces' => true, + 'no_unneeded_final_method' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unset_on_property' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'no_whitespace_before_comma_in_array' => true, + 'no_whitespace_in_blank_line' => true, + 'non_printable_character' => true, + 'normalize_index_brace' => true, + 'object_operator_without_whitespace' => true, + 'ordered_class_elements' => [ + 'order' => [ + 'use_trait', + 'constant_public', + 'constant_protected', + 'constant_private', + 'property_public_static', + 'property_protected_static', + 'property_private_static', + 'property_public', + 'property_protected', + 'property_private', + 'method_public_static', + 'construct', + 'destruct', + 'magic', + 'phpunit', + 'method_public', + 'method_protected', + 'method_private', + 'method_protected_static', + 'method_private_static', + ], + ], + 'ordered_imports' => true, + 'phpdoc_add_missing_param_annotation' => true, + 'phpdoc_align' => true, + 'phpdoc_annotation_without_dot' => true, + 'phpdoc_indent' => true, + 'phpdoc_no_access' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_package' => true, + 'phpdoc_order' => true, + 'phpdoc_return_self_reference' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_to_comment' => true, + 'phpdoc_trim' => true, + 'phpdoc_trim_consecutive_blank_line_separation' => true, + 'phpdoc_types' => ['groups' => ['simple', 'meta']], + 'phpdoc_types_order' => true, + 'phpdoc_var_without_name' => true, + 'pow_to_exponentiation' => true, + 'protected_to_private' => true, + 'return_assignment' => true, + 'return_type_declaration' => ['space_before' => 'none'], + 'self_accessor' => true, + 'semicolon_after_instruction' => true, + 'set_type_to_cast' => true, + 'short_scalar_cast' => true, + 'simplified_null_return' => true, + 'single_blank_line_at_eof' => true, + 'single_import_per_statement' => true, + 'single_line_after_imports' => true, + 'single_quote' => true, + 'standardize_not_equals' => true, + 'ternary_to_null_coalescing' => true, + 'trailing_comma_in_multiline_array' => true, + 'trim_array_spaces' => true, + 'unary_operator_spaces' => true, + 'visibility_required' => [ + 'elements' => [ + 'const', + 'method', + 'property', + ], + ], + //'void_return' => true, + 'whitespace_after_comma_in_array' => true, + ] + ) + ->setFinder( + PhpCsFixer\Finder::create() + ->files() + ->in(__DIR__ . '/build') + ->in(__DIR__ . '/src') + ->in(__DIR__ . '/tests') + ->notName('*.phpt') + ); diff --git a/vendor/phpunit/phpunit/.travis.yml b/vendor/phpunit/phpunit/.travis.yml new file mode 100644 index 0000000..f4bc5d1 --- /dev/null +++ b/vendor/phpunit/phpunit/.travis.yml @@ -0,0 +1,61 @@ +language: php + +sudo: false + +addons: + apt: + packages: + - libxml2-utils + +php: + - 7.1 + - 7.2 + - 7.3 + - master + +matrix: + allow_failures: + - php: master + fast_finish: true + +env: + matrix: + - DEPENDENCIES="high" + - DEPENDENCIES="low" + global: + - DEFAULT_COMPOSER_FLAGS="--no-interaction --no-ansi --no-progress --no-suggest" + +before_install: + - ./build/tools/composer clear-cache + +install: + - if [[ "$DEPENDENCIES" = 'high' ]]; then travis_retry ./build/tools/composer update $DEFAULT_COMPOSER_FLAGS; fi + - if [[ "$DEPENDENCIES" = 'low' ]]; then travis_retry ./build/tools/composer update $DEFAULT_COMPOSER_FLAGS --prefer-lowest; fi + +before_script: + - echo 'zend.assertions=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + - echo 'assert.exception=On' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + +script: + - ./phpunit --coverage-clover=coverage.xml + - ./phpunit --configuration ./build/travis-ci-fail.xml > /dev/null; if [ $? -eq 0 ]; then echo "SHOULD FAIL"; false; else echo "fail checked"; fi; + - xmllint --noout --schema phpunit.xsd phpunit.xml + - xmllint --noout --schema phpunit.xsd tests/_files/configuration.xml + - xmllint --noout --schema phpunit.xsd tests/_files/configuration_empty.xml + - xmllint --noout --schema phpunit.xsd tests/_files/configuration_xinclude.xml -xinclude + +after_success: + - bash <(curl -s https://codecov.io/bash) + +notifications: + email: false + +jobs: + include: + - stage: Static Code Analysis + php: 7.2 + env: php-cs-fixer + install: + - phpenv config-rm xdebug.ini + script: + - ./build/tools/php-cs-fixer fix --dry-run -v --show-progress=dots --diff-format=udiff diff --git a/vendor/phpunit/phpunit/ChangeLog-6.5.md b/vendor/phpunit/phpunit/ChangeLog-6.5.md new file mode 100644 index 0000000..0875178 --- /dev/null +++ b/vendor/phpunit/phpunit/ChangeLog-6.5.md @@ -0,0 +1,108 @@ +# Changes in PHPUnit 6.5 + +All notable changes of the PHPUnit 6.5 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [6.5.13] - 2018-09-08 + +* Fixed [#3181](https://github.com/sebastianbergmann/phpunit/issues/3181): `--filter` should be case-insensitive +* Fixed [#3234](https://github.com/sebastianbergmann/phpunit/issues/3234): `assertArraySubset()` with `$strict=true` does not display differences properly +* Fixed [#3254](https://github.com/sebastianbergmann/phpunit/issues/3254): TextUI test runner cannot run a `Test` instance that is not a `TestSuite` + +## [6.5.12] - 2018-08-22 + +* Fixed [#3248](https://github.com/sebastianbergmann/phpunit/issues/3248) and [#3233](https://github.com/sebastianbergmann/phpunit/issues/3233): `phpunit.xsd` dictates element order where it should not +* Fixed [#3251](https://github.com/sebastianbergmann/phpunit/issues/3251): TeamCity result logger is missing test duration information + +## [6.5.11] - 2018-08-07 + +* Fixed [#3219](https://github.com/sebastianbergmann/phpunit/issues/3219): `getMockFromWsdl()` generates invalid PHP code when WSDL filename contains special characters + +## [6.5.10] - 2018-08-03 + +### Fixed + +* Fixed [#3209](https://github.com/sebastianbergmann/phpunit/issues/3209): `Test::run()` and `TestCase::run()` interface contradiction +* Fixed [#3218](https://github.com/sebastianbergmann/phpunit/issues/3218): `prefix` attribute for `directory` node missing from `phpunit.xml` XSD +* Fixed [#3225](https://github.com/sebastianbergmann/phpunit/issues/3225): `coverage-php` missing from `phpunit.xsd` + +## [6.5.9] - 2018-07-03 + +### Fixed + +* Fixed [#3142](https://github.com/sebastianbergmann/phpunit/issues/3142): Method-level annotations (`@backupGlobals`, `@backupStaticAttributes`, `@errorHandler`, `@preserveGlobalState`) do not override class-level annotations + +## [6.5.8] - 2018-04-10 + +### Fixed + +* Fixed [#2830](https://github.com/sebastianbergmann/phpunit/issues/2830): `@runClassInSeparateProcess` does not work for tests that use `@dataProvider` + +## [6.5.7] - 2018-02-26 + +### Fixed + +* Fixed [#2974](https://github.com/sebastianbergmann/phpunit/issues/2974): JUnit XML logfile contains invalid characters when test output contains binary data + +## [6.5.6] - 2018-02-01 + +### Fixed + +* Fixed [#2236](https://github.com/sebastianbergmann/phpunit/issues/2236): Exceptions in `tearDown()` do not affect `getStatus()` +* Fixed [#2950](https://github.com/sebastianbergmann/phpunit/issues/2950): Class extending `PHPUnit\Framework\TestSuite` does not extend `PHPUnit\FrameworkTestCase` +* Fixed [#2972](https://github.com/sebastianbergmann/phpunit/issues/2972): PHPUnit crashes when test suite contains both `.phpt` files and unconventionally named tests + +## [6.5.5] - 2017-12-17 + +### Fixed + +* Fixed [#2922](https://github.com/sebastianbergmann/phpunit/issues/2922): Test class is not discovered when there is a test class with `@group` and provider throwing exception in it, tests are run with `--exclude-group` for that group, there is another class called later (after the class from above), and the name of that another class does not match its filename + +## [6.5.4] - 2017-12-10 + +### Changed + +* Require version 5.0.5 of `phpunit/phpunit-mock-objects` for [phpunit-mock-objects#394](https://github.com/sebastianbergmann/phpunit-mock-objects/issues/394) + +## [6.5.3] - 2017-12-06 + +### Fixed + +* Fixed an issue with PHPT tests when `forceCoversAnnotation="true"` is configured + +## [6.5.2] - 2017-12-02 + +### Changed + +* Require version 5.0.4 of `phpunit/phpunit-mock-objects` for [phpunit-mock-objects#388](https://github.com/sebastianbergmann/phpunit-mock-objects/issues/388) + +## [6.5.1] - 2017-12-01 + +* Fixed [#2886](https://github.com/sebastianbergmann/phpunit/pull/2886): Forced environment variables do not affect `getenv()` + +## [6.5.0] - 2017-12-01 + +### Added + +* Implemented [#2286](https://github.com/sebastianbergmann/phpunit/issues/2286): Optional `$exit` parameter for `PHPUnit\TextUI\TestRunner::run()` +* Implemented [#2496](https://github.com/sebastianbergmann/phpunit/issues/2496): Allow shallow copy of dependencies + +### Fixed + +* Fixed [#2654](https://github.com/sebastianbergmann/phpunit/issues/2654): Problems with `assertJsonStringEqualsJsonString()` +* Fixed [#2810](https://github.com/sebastianbergmann/phpunit/pull/2810): Code Coverage for PHPT tests does not work + +[6.5.13]: https://github.com/sebastianbergmann/phpunit/compare/6.5.12...6.5.13 +[6.5.12]: https://github.com/sebastianbergmann/phpunit/compare/6.5.11...6.5.12 +[6.5.11]: https://github.com/sebastianbergmann/phpunit/compare/6.5.10...6.5.11 +[6.5.10]: https://github.com/sebastianbergmann/phpunit/compare/6.5.9...6.5.10 +[6.5.9]: https://github.com/sebastianbergmann/phpunit/compare/6.5.8...6.5.9 +[6.5.8]: https://github.com/sebastianbergmann/phpunit/compare/6.5.7...6.5.8 +[6.5.7]: https://github.com/sebastianbergmann/phpunit/compare/6.5.6...6.5.7 +[6.5.6]: https://github.com/sebastianbergmann/phpunit/compare/6.5.5...6.5.6 +[6.5.5]: https://github.com/sebastianbergmann/phpunit/compare/6.5.4...6.5.5 +[6.5.4]: https://github.com/sebastianbergmann/phpunit/compare/6.5.3...6.5.4 +[6.5.3]: https://github.com/sebastianbergmann/phpunit/compare/6.5.2...6.5.3 +[6.5.2]: https://github.com/sebastianbergmann/phpunit/compare/6.5.1...6.5.2 +[6.5.1]: https://github.com/sebastianbergmann/phpunit/compare/6.5.0...6.5.1 +[6.5.0]: https://github.com/sebastianbergmann/phpunit/compare/6.4...6.5.0 + diff --git a/vendor/phpunit/phpunit/ChangeLog-7.5.md b/vendor/phpunit/phpunit/ChangeLog-7.5.md new file mode 100644 index 0000000..e761cae --- /dev/null +++ b/vendor/phpunit/phpunit/ChangeLog-7.5.md @@ -0,0 +1,38 @@ +# Changes in PHPUnit 7.5 + +All notable changes of the PHPUnit 7.5 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [7.5.1] - 2018-12-12 + +### Fixed + +* Fixed [#3441](https://github.com/sebastianbergmann/phpunit/issues/3441): Call to undefined method `DataProviderTestSuite::usesDataProvider()` + +## [7.5.0] - 2018-12-07 + +### Added + +* Implemented [#3340](https://github.com/sebastianbergmann/phpunit/issues/3340): Added `assertEqualsCanonicalizing()`, `assertEqualsIgnoringCase()`, `assertEqualsWithDelta()`, `assertNotEqualsCanonicalizing()`, `assertNotEqualsIgnoringCase()`, and `assertNotEqualsWithDelta()` as alternatives to using `assertEquals()` and `assertNotEquals()` with the `$delta`, `$canonicalize`, or `$ignoreCase` parameters +* Implemented [#3368](https://github.com/sebastianbergmann/phpunit/issues/3368): Added `assertIsArray()`, `assertIsBool()`, `assertIsFloat()`, `assertIsInt()`, `assertIsNumeric()`, `assertIsObject()`, `assertIsResource()`, `assertIsString()`, `assertIsScalar()`, `assertIsCallable()`, `assertIsIterable()`, `assertIsNotArray()`, `assertIsNotBool()`, `assertIsNotFloat()`, `assertIsNotInt()`, `assertIsNotNumeric()`, `assertIsNotObject()`, `assertIsNotResource()`, `assertIsNotString()`, `assertIsNotScalar()`, `assertIsNotCallable()`, `assertIsNotIterable()` as alternatives to `assertInternalType()` and `assertNotInternalType()` +* Implemented [#3391](https://github.com/sebastianbergmann/phpunit/issues/3391): Added a `TestHook` that fires after each test, regardless of result +* Implemented [#3417](https://github.com/sebastianbergmann/phpunit/pull/3417): Refinements related to test suite sorting and TestDox result printer +* Implemented [#3422](https://github.com/sebastianbergmann/phpunit/issues/3422): Added `assertStringContainsString()`, `assertStringContainsStringIgnoringCase()`, `assertStringNotContainsString()`, and `assertStringNotContainsStringIgnoringCase()` + +### Deprecated + +* The methods `assertInternalType()` and `assertNotInternalType()` are now deprecated. There is no behavioral change in this version of PHPUnit. Using these methods will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 these methods will be removed. +* The methods `assertAttributeContains()`, `assertAttributeNotContains()`, `assertAttributeContainsOnly()`, `assertAttributeNotContainsOnly()`, `assertAttributeCount()`, `assertAttributeNotCount()`, `assertAttributeEquals()`, `assertAttributeNotEquals()`, `assertAttributeEmpty()`, `assertAttributeNotEmpty()`, `assertAttributeGreaterThan()`, `assertAttributeGreaterThanOrEqual()`, `assertAttributeLessThan()`, `assertAttributeLessThanOrEqual()`, `assertAttributeSame()`, `assertAttributeNotSame()`, `assertAttributeInstanceOf()`, `assertAttributeNotInstanceOf()`, `assertAttributeInternalType()`, `assertAttributeNotInternalType()`, `attributeEqualTo()`, `readAttribute()`, `getStaticAttribute()`, and `getObjectAttribute()` are now deprecated. There is no behavioral change in this version of PHPUnit. Using these methods will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 these methods will be removed. +* The optional parameters `$delta`, `$maxDepth`, `$canonicalize`, and `$ignoreCase` of `assertEquals()` and `assertNotEquals()` are now deprecated. There is no behavioral change in this version of PHPUnit. Using these parameters will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 these parameters will be removed. +* The annotations `@expectedException`, `@expectedExceptionCode`, `@expectedExceptionMessage`, and `@expectedExceptionMessageRegExp` are now deprecated. There is no behavioral change in this version of PHPUnit. Using these annotations will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 these annotations will be removed. +* Using the methods `assertContains()` and `assertNotContains()` on `string` haystacks is now deprecated. There is no behavioral change in this version of PHPUnit. Using these methods on `string` haystacks will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 these methods cannot be used on on `string` haystacks anymore. +* The optional parameters `$ignoreCase`, `$checkForObjectIdentity`, and `$checkForNonObjectIdentity` of `assertContains()` and `assertNotContains()` are now deprecated. There is no behavioral change in this version of PHPUnit. Using these parameters will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 these parameters will be removed. + +### Fixed + +* Fixed [#3428](https://github.com/sebastianbergmann/phpunit/pull/3428): `TestSuite` setup failures are not logged correctly +* Fixed [#3429](https://github.com/sebastianbergmann/phpunit/pull/3429): Inefficient loop in `getHookMethods()` +* Fixed [#3437](https://github.com/sebastianbergmann/phpunit/pull/3437): JUnit logger skips PHPT tests + +[7.5.1]: https://github.com/sebastianbergmann/phpunit/compare/7.5.0...7.5.1 +[7.5.0]: https://github.com/sebastianbergmann/phpunit/compare/7.4.5...7.5.0 + diff --git a/vendor/phpunit/phpunit/LICENSE b/vendor/phpunit/phpunit/LICENSE new file mode 100644 index 0000000..faba266 --- /dev/null +++ b/vendor/phpunit/phpunit/LICENSE @@ -0,0 +1,33 @@ +PHPUnit + +Copyright (c) 2001-2018, Sebastian Bergmann . +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Sebastian Bergmann nor the names of his + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/phpunit/phpunit/README.md b/vendor/phpunit/phpunit/README.md new file mode 100644 index 0000000..ac52cee --- /dev/null +++ b/vendor/phpunit/phpunit/README.md @@ -0,0 +1,40 @@ +# PHPUnit + +PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks. + +[![Latest Stable Version](https://img.shields.io/packagist/v/phpunit/phpunit.svg?style=flat-square)](https://packagist.org/packages/phpunit/phpunit) +[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg?style=flat-square)](https://php.net/) +[![Build Status](https://img.shields.io/travis/sebastianbergmann/phpunit/7.5.svg?style=flat-square)](https://phpunit.de/build-status.html) + +## Installation + +We distribute a [PHP Archive (PHAR)](https://php.net/phar) that has all required (as well as some optional) dependencies of PHPUnit 7.5 bundled in a single file: + +```bash +$ wget https://phar.phpunit.de/phpunit-7.5.phar + +$ php phpunit-7.5.phar --version +``` + +Alternatively, you may use [Composer](https://getcomposer.org/) to download and install PHPUnit as well as its dependencies. Please refer to the "[Getting Started](https://phpunit.de/getting-started-with-phpunit.html)" guide for details on how to install PHPUnit. + +## Contribute + +Please refer to [CONTRIBUTING.md](https://github.com/sebastianbergmann/phpunit/blob/master/.github/CONTRIBUTING.md) for information on how to contribute to PHPUnit and its related projects. + +## List of Contributors + +Thanks to everyone who has contributed to PHPUnit! You can find a detailed list of contributors on every PHPUnit related package on GitHub. This list shows only the major components: + +* [PHPUnit](https://github.com/sebastianbergmann/phpunit/graphs/contributors) +* [php-code-coverage](https://github.com/sebastianbergmann/php-code-coverage/graphs/contributors) + +A very special thanks to everyone who has contributed to the documentation and helps maintain the translations: + +* [English](https://github.com/sebastianbergmann/phpunit-documentation-english/graphs/contributors) +* [Spanish](https://github.com/sebastianbergmann/phpunit-documentation-spanish/graphs/contributors) +* [French](https://github.com/sebastianbergmann/phpunit-documentation-french/graphs/contributors) +* [Japanese](https://github.com/sebastianbergmann/phpunit-documentation-japanese/graphs/contributors) +* [Brazilian Portuguese](https://github.com/sebastianbergmann/phpunit-documentation-brazilian-portuguese/graphs/contributors) +* [Simplified Chinese](https://github.com/sebastianbergmann/phpunit-documentation-chinese/graphs/contributors) + diff --git a/vendor/phpunit/phpunit/appveyor.yml b/vendor/phpunit/phpunit/appveyor.yml new file mode 100644 index 0000000..71eccba --- /dev/null +++ b/vendor/phpunit/phpunit/appveyor.yml @@ -0,0 +1,59 @@ +build: false +clone_folder: c:\phpunit +max_jobs: 3 +platform: x86 +pull_requests: + do_not_increment_build_number: true +version: '{build}.{branch}' + +environment: + COMPOSER_ROOT_VERSION: '7.0-dev' + + matrix: + - PHP_VERSION: '7.1.11' + XDEBUG_VERSION: '2.5.5-7.1' + DEPENDENCIES: '--prefer-lowest' + - PHP_VERSION: '7.1.11' + XDEBUG_VERSION: '2.5.5-7.1' + DEPENDENCIES: '' + +matrix: + fast_finish: true + +cache: + - c:\php -> appveyor.yml + - '%LOCALAPPDATA%\Composer\files' + +init: + - SET PATH=c:\php\%PHP_VERSION%;%PATH% + +install: + - IF NOT EXIST c:\php mkdir c:\php + - IF NOT EXIST c:\php\%PHP_VERSION% mkdir c:\php\%PHP_VERSION% + - cd c:\php\%PHP_VERSION% + - IF NOT EXIST php-installed.txt curl -fsS -o php-%PHP_VERSION%-Win32-VC14-x86.zip https://windows.php.net/downloads/releases/archives/php-%PHP_VERSION%-Win32-VC14-x86.zip + - IF NOT EXIST php-installed.txt 7z x php-%PHP_VERSION%-Win32-VC14-x86.zip -y >nul + - IF NOT EXIST php-installed.txt del /Q *.zip + - IF NOT EXIST php-installed.txt copy /Y php.ini-development php.ini + - IF NOT EXIST php-installed.txt echo max_execution_time=1200 >> php.ini + - IF NOT EXIST php-installed.txt echo date.timezone="UTC" >> php.ini + - IF NOT EXIST php-installed.txt echo extension_dir=ext >> php.ini + - IF NOT EXIST php-installed.txt echo extension=php_curl.dll >> php.ini + - IF NOT EXIST php-installed.txt echo extension=php_openssl.dll >> php.ini + - IF NOT EXIST php-installed.txt echo extension=php_mbstring.dll >> php.ini + - IF NOT EXIST php-installed.txt echo extension=php_fileinfo.dll >> php.ini + - IF NOT EXIST php-installed.txt echo extension=php_mysqli.dll >> php.ini + - IF NOT EXIST php-installed.txt echo extension=php_pdo_sqlite.dll >> php.ini + - IF NOT EXIST php-installed.txt echo zend.assertions=1 >> php.ini + - IF NOT EXIST php-installed.txt echo assert.exception=On >> php.ini + - IF NOT EXIST php-installed.txt curl -fsS -o composer.phar https://getcomposer.org/composer.phar + - IF NOT EXIST php-installed.txt echo @php %%~dp0composer.phar %%* > composer.bat + - IF NOT EXIST php-installed.txt curl -fsS -o c:\php\%PHP_VERSION%\ext\php_xdebug-%XDEBUG_VERSION%-vc14.dll https://xdebug.org/files/php_xdebug-%XDEBUG_VERSION%-vc14.dll + - IF NOT EXIST php-installed.txt echo zend_extension=php_xdebug-%XDEBUG_VERSION%-vc14.dll >> php.ini + - IF NOT EXIST php-installed.txt type nul >> php-installed.txt + - cd c:\phpunit + - composer update --no-interaction --no-ansi --no-progress --no-suggest --optimize-autoloader --prefer-stable %DEPENDENCIES% + +test_script: + - cd c:\phpunit + - php phpunit diff --git a/vendor/phpunit/phpunit/build.xml b/vendor/phpunit/phpunit/build.xml new file mode 100644 index 0000000..4e9635b --- /dev/null +++ b/vendor/phpunit/phpunit/build.xml @@ -0,0 +1,428 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phpunit/phpunit/composer.json b/vendor/phpunit/phpunit/composer.json new file mode 100644 index 0000000..4104e42 --- /dev/null +++ b/vendor/phpunit/phpunit/composer.json @@ -0,0 +1,90 @@ +{ + "name": "phpunit/phpunit", + "description": "The PHP Unit Testing framework.", + "type": "library", + "keywords": [ + "phpunit", + "xunit", + "testing" + ], + "homepage": "https://phpunit.de/", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues" + }, + "prefer-stable": true, + "require": { + "php": "^7.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "doctrine/instantiator": "^1.1", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.0", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0", + "sebastian/version": "^2.0.1" + }, + "require-dev": { + "ext-PDO": "*" + }, + "conflict": { + "phpunit/phpunit-mock-objects": "*" + }, + "config": { + "platform": { + "php": "7.1.0" + }, + "optimize-autoloader": true, + "sort-packages": true + }, + "suggest": { + "phpunit/php-invoker": "^2.0", + "ext-soap": "*", + "ext-xdebug": "*" + }, + "bin": [ + "phpunit" + ], + "autoload": { + "classmap": [ + "src/" + ] + }, + "autoload-dev": { + "classmap": [ + "tests/" + ], + "files": [ + "src/Framework/Assert/Functions.php", + "tests/_files/CoverageNamespacedFunctionTest.php", + "tests/_files/CoveredFunction.php", + "tests/_files/NamespaceCoveredFunction.php" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "7.5-dev" + } + } +} diff --git a/vendor/phpunit/phpunit/phive.xml b/vendor/phpunit/phpunit/phive.xml new file mode 100644 index 0000000..10a6223 --- /dev/null +++ b/vendor/phpunit/phpunit/phive.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/vendor/phpunit/phpunit/phpunit b/vendor/phpunit/phpunit/phpunit new file mode 100755 index 0000000..ebea1ff --- /dev/null +++ b/vendor/phpunit/phpunit/phpunit @@ -0,0 +1,61 @@ +#!/usr/bin/env php + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (version_compare('7.1.0', PHP_VERSION, '>')) { + fwrite( + STDERR, + sprintf( + 'This version of PHPUnit is supported on PHP 7.1 and PHP 7.2.' . PHP_EOL . + 'You are using PHP %s (%s).' . PHP_EOL, + PHP_VERSION, + PHP_BINARY + ) + ); + + die(1); +} + +if (!ini_get('date.timezone')) { + ini_set('date.timezone', 'UTC'); +} + +foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) { + if (file_exists($file)) { + define('PHPUNIT_COMPOSER_INSTALL', $file); + + break; + } +} + +unset($file); + +if (!defined('PHPUNIT_COMPOSER_INSTALL')) { + fwrite( + STDERR, + 'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL . + ' composer install' . PHP_EOL . PHP_EOL . + 'You can learn all about Composer on https://getcomposer.org/.' . PHP_EOL + ); + + die(1); +} + +$options = getopt('', array('prepend:')); + +if (isset($options['prepend'])) { + require $options['prepend']; +} + +unset($options); + +require PHPUNIT_COMPOSER_INSTALL; + +PHPUnit\TextUI\Command::main(); diff --git a/vendor/phpunit/phpunit/phpunit.xml b/vendor/phpunit/phpunit/phpunit.xml new file mode 100644 index 0000000..710a7dd --- /dev/null +++ b/vendor/phpunit/phpunit/phpunit.xml @@ -0,0 +1,30 @@ + + + + + tests/unit + + + + tests/end-to-end + + + + + + src + + src/Framework/Assert/Functions.php + src/Util/PHP/eval-stdin.php + + + + + + + + diff --git a/vendor/phpunit/phpunit/phpunit.xsd b/vendor/phpunit/phpunit/phpunit.xsd new file mode 100644 index 0000000..07bd13a --- /dev/null +++ b/vendor/phpunit/phpunit/phpunit.xsd @@ -0,0 +1,307 @@ + + + + + This Schema file defines the rules by which the XML configuration file of PHPUnit 7.5 may be structured. + + + + + + Root Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The main type specifying the document structure + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phpunit/phpunit/src/Exception.php b/vendor/phpunit/phpunit/src/Exception.php new file mode 100644 index 0000000..055c5b5 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Exception.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit; + +/** + * Marker interface for PHPUnit exceptions. + */ +interface Exception +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/Assert.php b/vendor/phpunit/phpunit/src/Framework/Assert.php new file mode 100644 index 0000000..a74c802 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Assert.php @@ -0,0 +1,2889 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use ArrayAccess; +use Countable; +use DOMDocument; +use DOMElement; +use PHPUnit\Framework\Constraint\ArrayHasKey; +use PHPUnit\Framework\Constraint\ArraySubset; +use PHPUnit\Framework\Constraint\Attribute; +use PHPUnit\Framework\Constraint\Callback; +use PHPUnit\Framework\Constraint\ClassHasAttribute; +use PHPUnit\Framework\Constraint\ClassHasStaticAttribute; +use PHPUnit\Framework\Constraint\Constraint; +use PHPUnit\Framework\Constraint\Count; +use PHPUnit\Framework\Constraint\DirectoryExists; +use PHPUnit\Framework\Constraint\FileExists; +use PHPUnit\Framework\Constraint\GreaterThan; +use PHPUnit\Framework\Constraint\IsAnything; +use PHPUnit\Framework\Constraint\IsEmpty; +use PHPUnit\Framework\Constraint\IsEqual; +use PHPUnit\Framework\Constraint\IsFalse; +use PHPUnit\Framework\Constraint\IsFinite; +use PHPUnit\Framework\Constraint\IsIdentical; +use PHPUnit\Framework\Constraint\IsInfinite; +use PHPUnit\Framework\Constraint\IsInstanceOf; +use PHPUnit\Framework\Constraint\IsJson; +use PHPUnit\Framework\Constraint\IsNan; +use PHPUnit\Framework\Constraint\IsNull; +use PHPUnit\Framework\Constraint\IsReadable; +use PHPUnit\Framework\Constraint\IsTrue; +use PHPUnit\Framework\Constraint\IsType; +use PHPUnit\Framework\Constraint\IsWritable; +use PHPUnit\Framework\Constraint\JsonMatches; +use PHPUnit\Framework\Constraint\LessThan; +use PHPUnit\Framework\Constraint\LogicalAnd; +use PHPUnit\Framework\Constraint\LogicalNot; +use PHPUnit\Framework\Constraint\LogicalOr; +use PHPUnit\Framework\Constraint\LogicalXor; +use PHPUnit\Framework\Constraint\ObjectHasAttribute; +use PHPUnit\Framework\Constraint\RegularExpression; +use PHPUnit\Framework\Constraint\SameSize; +use PHPUnit\Framework\Constraint\StringContains; +use PHPUnit\Framework\Constraint\StringEndsWith; +use PHPUnit\Framework\Constraint\StringMatchesFormatDescription; +use PHPUnit\Framework\Constraint\StringStartsWith; +use PHPUnit\Framework\Constraint\TraversableContains; +use PHPUnit\Framework\Constraint\TraversableContainsOnly; +use PHPUnit\Util\InvalidArgumentHelper; +use PHPUnit\Util\Type; +use PHPUnit\Util\Xml; +use ReflectionClass; +use ReflectionException; +use ReflectionObject; +use Traversable; + +/** + * A set of assertion methods. + */ +abstract class Assert +{ + /** + * @var int + */ + private static $count = 0; + + /** + * Asserts that an array has a specified key. + * + * @param int|string $key + * @param array|ArrayAccess $array + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertArrayHasKey($key, $array, string $message = ''): void + { + if (!(\is_int($key) || \is_string($key))) { + throw InvalidArgumentHelper::factory( + 1, + 'integer or string' + ); + } + + if (!(\is_array($array) || $array instanceof ArrayAccess)) { + throw InvalidArgumentHelper::factory( + 2, + 'array or ArrayAccess' + ); + } + + $constraint = new ArrayHasKey($key); + + static::assertThat($array, $constraint, $message); + } + + /** + * Asserts that an array has a specified subset. + * + * @param array|ArrayAccess $subset + * @param array|ArrayAccess $array + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertArraySubset($subset, $array, bool $checkForObjectIdentity = false, string $message = ''): void + { + if (!(\is_array($subset) || $subset instanceof ArrayAccess)) { + throw InvalidArgumentHelper::factory( + 1, + 'array or ArrayAccess' + ); + } + + if (!(\is_array($array) || $array instanceof ArrayAccess)) { + throw InvalidArgumentHelper::factory( + 2, + 'array or ArrayAccess' + ); + } + + $constraint = new ArraySubset($subset, $checkForObjectIdentity); + + static::assertThat($array, $constraint, $message); + } + + /** + * Asserts that an array does not have a specified key. + * + * @param int|string $key + * @param array|ArrayAccess $array + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertArrayNotHasKey($key, $array, string $message = ''): void + { + if (!(\is_int($key) || \is_string($key))) { + throw InvalidArgumentHelper::factory( + 1, + 'integer or string' + ); + } + + if (!(\is_array($array) || $array instanceof ArrayAccess)) { + throw InvalidArgumentHelper::factory( + 2, + 'array or ArrayAccess' + ); + } + + $constraint = new LogicalNot( + new ArrayHasKey($key) + ); + + static::assertThat($array, $constraint, $message); + } + + /** + * Asserts that a haystack contains a needle. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertContains($needle, $haystack, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void + { + if (\is_array($haystack) || + (\is_object($haystack) && $haystack instanceof Traversable)) { + $constraint = new TraversableContains( + $needle, + $checkForObjectIdentity, + $checkForNonObjectIdentity + ); + } elseif (\is_string($haystack)) { + if (!\is_string($needle)) { + throw InvalidArgumentHelper::factory( + 1, + 'string' + ); + } + + $constraint = new StringContains( + $needle, + $ignoreCase + ); + } else { + throw InvalidArgumentHelper::factory( + 2, + 'array, traversable or string' + ); + } + + static::assertThat($haystack, $constraint, $message); + } + + /** + * Asserts that a haystack that is stored in a static attribute of a class + * or an attribute of an object contains a needle. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeContains($needle, string $haystackAttributeName, $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void + { + static::assertContains( + $needle, + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $message, + $ignoreCase, + $checkForObjectIdentity, + $checkForNonObjectIdentity + ); + } + + /** + * Asserts that a haystack does not contain a needle. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotContains($needle, $haystack, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void + { + if (\is_array($haystack) || + (\is_object($haystack) && $haystack instanceof Traversable)) { + $constraint = new LogicalNot( + new TraversableContains( + $needle, + $checkForObjectIdentity, + $checkForNonObjectIdentity + ) + ); + } elseif (\is_string($haystack)) { + if (!\is_string($needle)) { + throw InvalidArgumentHelper::factory( + 1, + 'string' + ); + } + + $constraint = new LogicalNot( + new StringContains( + $needle, + $ignoreCase + ) + ); + } else { + throw InvalidArgumentHelper::factory( + 2, + 'array, traversable or string' + ); + } + + static::assertThat($haystack, $constraint, $message); + } + + /** + * Asserts that a haystack that is stored in a static attribute of a class + * or an attribute of an object does not contain a needle. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeNotContains($needle, string $haystackAttributeName, $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void + { + static::assertNotContains( + $needle, + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $message, + $ignoreCase, + $checkForObjectIdentity, + $checkForNonObjectIdentity + ); + } + + /** + * Asserts that a haystack contains only values of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = ''): void + { + if ($isNativeType === null) { + $isNativeType = Type::isType($type); + } + + static::assertThat( + $haystack, + new TraversableContainsOnly( + $type, + $isNativeType + ), + $message + ); + } + + /** + * Asserts that a haystack contains only instances of a given class name. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertContainsOnlyInstancesOf(string $className, iterable $haystack, string $message = ''): void + { + static::assertThat( + $haystack, + new TraversableContainsOnly( + $className, + false + ), + $message + ); + } + + /** + * Asserts that a haystack that is stored in a static attribute of a class + * or an attribute of an object contains only values of a given type. + * + * @param object|string $haystackClassOrObject + * @param bool $isNativeType + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeContainsOnly(string $type, string $haystackAttributeName, $haystackClassOrObject, ?bool $isNativeType = null, string $message = ''): void + { + static::assertContainsOnly( + $type, + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $isNativeType, + $message + ); + } + + /** + * Asserts that a haystack does not contain only values of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = ''): void + { + if ($isNativeType === null) { + $isNativeType = Type::isType($type); + } + + static::assertThat( + $haystack, + new LogicalNot( + new TraversableContainsOnly( + $type, + $isNativeType + ) + ), + $message + ); + } + + /** + * Asserts that a haystack that is stored in a static attribute of a class + * or an attribute of an object does not contain only values of a given + * type. + * + * @param object|string $haystackClassOrObject + * @param bool $isNativeType + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeNotContainsOnly(string $type, string $haystackAttributeName, $haystackClassOrObject, ?bool $isNativeType = null, string $message = ''): void + { + static::assertNotContainsOnly( + $type, + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $isNativeType, + $message + ); + } + + /** + * Asserts the number of elements of an array, Countable or Traversable. + * + * @param Countable|iterable $haystack + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertCount(int $expectedCount, $haystack, string $message = ''): void + { + if (!$haystack instanceof Countable && !\is_iterable($haystack)) { + throw InvalidArgumentHelper::factory(2, 'countable or iterable'); + } + + static::assertThat( + $haystack, + new Count($expectedCount), + $message + ); + } + + /** + * Asserts the number of elements of an array, Countable or Traversable + * that is stored in an attribute. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeCount(int $expectedCount, string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void + { + static::assertCount( + $expectedCount, + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $message + ); + } + + /** + * Asserts the number of elements of an array, Countable or Traversable. + * + * @param Countable|iterable $haystack + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotCount(int $expectedCount, $haystack, string $message = ''): void + { + if (!$haystack instanceof Countable && !\is_iterable($haystack)) { + throw InvalidArgumentHelper::factory(2, 'countable or iterable'); + } + + $constraint = new LogicalNot( + new Count($expectedCount) + ); + + static::assertThat($haystack, $constraint, $message); + } + + /** + * Asserts the number of elements of an array, Countable or Traversable + * that is stored in an attribute. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeNotCount(int $expectedCount, string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void + { + static::assertNotCount( + $expectedCount, + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $message + ); + } + + /** + * Asserts that two variables are equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertEquals($expected, $actual, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void + { + $constraint = new IsEqual( + $expected, + $delta, + $maxDepth, + $canonicalize, + $ignoreCase + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that two variables are equal (canonicalizing). + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertEqualsCanonicalizing($expected, $actual, string $message = ''): void + { + $constraint = new IsEqual( + $expected, + 0.0, + 10, + true, + false + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that two variables are equal (ignoring case). + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertEqualsIgnoringCase($expected, $actual, string $message = ''): void + { + $constraint = new IsEqual( + $expected, + 0.0, + 10, + false, + true + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that two variables are equal (with delta). + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertEqualsWithDelta($expected, $actual, float $delta, string $message = ''): void + { + $constraint = new IsEqual( + $expected, + $delta + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that a variable is equal to an attribute of an object. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeEquals($expected, string $actualAttributeName, $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void + { + static::assertEquals( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message, + $delta, + $maxDepth, + $canonicalize, + $ignoreCase + ); + } + + /** + * Asserts that two variables are not equal. + * + * @param float $delta + * @param int $maxDepth + * @param bool $canonicalize + * @param bool $ignoreCase + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotEquals($expected, $actual, string $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false): void + { + $constraint = new LogicalNot( + new IsEqual( + $expected, + $delta, + $maxDepth, + $canonicalize, + $ignoreCase + ) + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that two variables are not equal (canonicalizing). + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotEqualsCanonicalizing($expected, $actual, string $message = ''): void + { + $constraint = new LogicalNot( + new IsEqual( + $expected, + 0.0, + 10, + true, + false + ) + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that two variables are not equal (ignoring case). + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotEqualsIgnoringCase($expected, $actual, string $message = ''): void + { + $constraint = new LogicalNot( + new IsEqual( + $expected, + 0.0, + 10, + false, + true + ) + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that two variables are not equal (with delta). + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotEqualsWithDelta($expected, $actual, float $delta, string $message = ''): void + { + $constraint = new LogicalNot( + new IsEqual( + $expected, + $delta + ) + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that a variable is not equal to an attribute of an object. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeNotEquals($expected, string $actualAttributeName, $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void + { + static::assertNotEquals( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message, + $delta, + $maxDepth, + $canonicalize, + $ignoreCase + ); + } + + /** + * Asserts that a variable is empty. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertEmpty($actual, string $message = ''): void + { + static::assertThat($actual, static::isEmpty(), $message); + } + + /** + * Asserts that a static attribute of a class or an attribute of an object + * is empty. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeEmpty(string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void + { + static::assertEmpty( + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $message + ); + } + + /** + * Asserts that a variable is not empty. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotEmpty($actual, string $message = ''): void + { + static::assertThat($actual, static::logicalNot(static::isEmpty()), $message); + } + + /** + * Asserts that a static attribute of a class or an attribute of an object + * is not empty. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeNotEmpty(string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void + { + static::assertNotEmpty( + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $message + ); + } + + /** + * Asserts that a value is greater than another value. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertGreaterThan($expected, $actual, string $message = ''): void + { + static::assertThat($actual, static::greaterThan($expected), $message); + } + + /** + * Asserts that an attribute is greater than another value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeGreaterThan($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void + { + static::assertGreaterThan( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message + ); + } + + /** + * Asserts that a value is greater than or equal to another value. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertGreaterThanOrEqual($expected, $actual, string $message = ''): void + { + static::assertThat( + $actual, + static::greaterThanOrEqual($expected), + $message + ); + } + + /** + * Asserts that an attribute is greater than or equal to another value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeGreaterThanOrEqual($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void + { + static::assertGreaterThanOrEqual( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message + ); + } + + /** + * Asserts that a value is smaller than another value. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertLessThan($expected, $actual, string $message = ''): void + { + static::assertThat($actual, static::lessThan($expected), $message); + } + + /** + * Asserts that an attribute is smaller than another value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeLessThan($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void + { + static::assertLessThan( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message + ); + } + + /** + * Asserts that a value is smaller than or equal to another value. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertLessThanOrEqual($expected, $actual, string $message = ''): void + { + static::assertThat($actual, static::lessThanOrEqual($expected), $message); + } + + /** + * Asserts that an attribute is smaller than or equal to another value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeLessThanOrEqual($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void + { + static::assertLessThanOrEqual( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message + ); + } + + /** + * Asserts that the contents of one file is equal to the contents of another + * file. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void + { + static::assertFileExists($expected, $message); + static::assertFileExists($actual, $message); + + static::assertEquals( + \file_get_contents($expected), + \file_get_contents($actual), + $message, + 0, + 10, + $canonicalize, + $ignoreCase + ); + } + + /** + * Asserts that the contents of one file is not equal to the contents of + * another file. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileNotEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void + { + static::assertFileExists($expected, $message); + static::assertFileExists($actual, $message); + + static::assertNotEquals( + \file_get_contents($expected), + \file_get_contents($actual), + $message, + 0, + 10, + $canonicalize, + $ignoreCase + ); + } + + /** + * Asserts that the contents of a string is equal + * to the contents of a file. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void + { + static::assertFileExists($expectedFile, $message); + + /** @noinspection PhpUnitTestsInspection */ + static::assertEquals( + \file_get_contents($expectedFile), + $actualString, + $message, + 0, + 10, + $canonicalize, + $ignoreCase + ); + } + + /** + * Asserts that the contents of a string is not equal + * to the contents of a file. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void + { + static::assertFileExists($expectedFile, $message); + + static::assertNotEquals( + \file_get_contents($expectedFile), + $actualString, + $message, + 0, + 10, + $canonicalize, + $ignoreCase + ); + } + + /** + * Asserts that a file/dir is readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsReadable(string $filename, string $message = ''): void + { + static::assertThat($filename, new IsReadable, $message); + } + + /** + * Asserts that a file/dir exists and is not readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotIsReadable(string $filename, string $message = ''): void + { + static::assertThat($filename, new LogicalNot(new IsReadable), $message); + } + + /** + * Asserts that a file/dir exists and is writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsWritable(string $filename, string $message = ''): void + { + static::assertThat($filename, new IsWritable, $message); + } + + /** + * Asserts that a file/dir exists and is not writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotIsWritable(string $filename, string $message = ''): void + { + static::assertThat($filename, new LogicalNot(new IsWritable), $message); + } + + /** + * Asserts that a directory exists. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertDirectoryExists(string $directory, string $message = ''): void + { + static::assertThat($directory, new DirectoryExists, $message); + } + + /** + * Asserts that a directory does not exist. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertDirectoryNotExists(string $directory, string $message = ''): void + { + static::assertThat($directory, new LogicalNot(new DirectoryExists), $message); + } + + /** + * Asserts that a directory exists and is readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertDirectoryIsReadable(string $directory, string $message = ''): void + { + self::assertDirectoryExists($directory, $message); + self::assertIsReadable($directory, $message); + } + + /** + * Asserts that a directory exists and is not readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertDirectoryNotIsReadable(string $directory, string $message = ''): void + { + self::assertDirectoryExists($directory, $message); + self::assertNotIsReadable($directory, $message); + } + + /** + * Asserts that a directory exists and is writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertDirectoryIsWritable(string $directory, string $message = ''): void + { + self::assertDirectoryExists($directory, $message); + self::assertIsWritable($directory, $message); + } + + /** + * Asserts that a directory exists and is not writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertDirectoryNotIsWritable(string $directory, string $message = ''): void + { + self::assertDirectoryExists($directory, $message); + self::assertNotIsWritable($directory, $message); + } + + /** + * Asserts that a file exists. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileExists(string $filename, string $message = ''): void + { + static::assertThat($filename, new FileExists, $message); + } + + /** + * Asserts that a file does not exist. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileNotExists(string $filename, string $message = ''): void + { + static::assertThat($filename, new LogicalNot(new FileExists), $message); + } + + /** + * Asserts that a file exists and is readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileIsReadable(string $file, string $message = ''): void + { + self::assertFileExists($file, $message); + self::assertIsReadable($file, $message); + } + + /** + * Asserts that a file exists and is not readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileNotIsReadable(string $file, string $message = ''): void + { + self::assertFileExists($file, $message); + self::assertNotIsReadable($file, $message); + } + + /** + * Asserts that a file exists and is writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileIsWritable(string $file, string $message = ''): void + { + self::assertFileExists($file, $message); + self::assertIsWritable($file, $message); + } + + /** + * Asserts that a file exists and is not writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileNotIsWritable(string $file, string $message = ''): void + { + self::assertFileExists($file, $message); + self::assertNotIsWritable($file, $message); + } + + /** + * Asserts that a condition is true. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertTrue($condition, string $message = ''): void + { + static::assertThat($condition, static::isTrue(), $message); + } + + /** + * Asserts that a condition is not true. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotTrue($condition, string $message = ''): void + { + static::assertThat($condition, static::logicalNot(static::isTrue()), $message); + } + + /** + * Asserts that a condition is false. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFalse($condition, string $message = ''): void + { + static::assertThat($condition, static::isFalse(), $message); + } + + /** + * Asserts that a condition is not false. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotFalse($condition, string $message = ''): void + { + static::assertThat($condition, static::logicalNot(static::isFalse()), $message); + } + + /** + * Asserts that a variable is null. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNull($actual, string $message = ''): void + { + static::assertThat($actual, static::isNull(), $message); + } + + /** + * Asserts that a variable is not null. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotNull($actual, string $message = ''): void + { + static::assertThat($actual, static::logicalNot(static::isNull()), $message); + } + + /** + * Asserts that a variable is finite. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFinite($actual, string $message = ''): void + { + static::assertThat($actual, static::isFinite(), $message); + } + + /** + * Asserts that a variable is infinite. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertInfinite($actual, string $message = ''): void + { + static::assertThat($actual, static::isInfinite(), $message); + } + + /** + * Asserts that a variable is nan. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNan($actual, string $message = ''): void + { + static::assertThat($actual, static::isNan(), $message); + } + + /** + * Asserts that a class has a specified attribute. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertClassHasAttribute(string $attributeName, string $className, string $message = ''): void + { + if (!self::isValidAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(1, 'valid attribute name'); + } + + if (!\class_exists($className)) { + throw InvalidArgumentHelper::factory(2, 'class name', $className); + } + + static::assertThat($className, new ClassHasAttribute($attributeName), $message); + } + + /** + * Asserts that a class does not have a specified attribute. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertClassNotHasAttribute(string $attributeName, string $className, string $message = ''): void + { + if (!self::isValidAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(1, 'valid attribute name'); + } + + if (!\class_exists($className)) { + throw InvalidArgumentHelper::factory(2, 'class name', $className); + } + + static::assertThat( + $className, + new LogicalNot( + new ClassHasAttribute($attributeName) + ), + $message + ); + } + + /** + * Asserts that a class has a specified static attribute. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertClassHasStaticAttribute(string $attributeName, string $className, string $message = ''): void + { + if (!self::isValidAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(1, 'valid attribute name'); + } + + if (!\class_exists($className)) { + throw InvalidArgumentHelper::factory(2, 'class name', $className); + } + + static::assertThat( + $className, + new ClassHasStaticAttribute($attributeName), + $message + ); + } + + /** + * Asserts that a class does not have a specified static attribute. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = ''): void + { + if (!self::isValidAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(1, 'valid attribute name'); + } + + if (!\class_exists($className)) { + throw InvalidArgumentHelper::factory(2, 'class name', $className); + } + + static::assertThat( + $className, + new LogicalNot( + new ClassHasStaticAttribute($attributeName) + ), + $message + ); + } + + /** + * Asserts that an object has a specified attribute. + * + * @param object $object + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertObjectHasAttribute(string $attributeName, $object, string $message = ''): void + { + if (!self::isValidAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(1, 'valid attribute name'); + } + + if (!\is_object($object)) { + throw InvalidArgumentHelper::factory(2, 'object'); + } + + static::assertThat( + $object, + new ObjectHasAttribute($attributeName), + $message + ); + } + + /** + * Asserts that an object does not have a specified attribute. + * + * @param object $object + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertObjectNotHasAttribute(string $attributeName, $object, string $message = ''): void + { + if (!self::isValidAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(1, 'valid attribute name'); + } + + if (!\is_object($object)) { + throw InvalidArgumentHelper::factory(2, 'object'); + } + + static::assertThat( + $object, + new LogicalNot( + new ObjectHasAttribute($attributeName) + ), + $message + ); + } + + /** + * Asserts that two variables have the same type and value. + * Used on objects, it asserts that two variables reference + * the same object. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertSame($expected, $actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsIdentical($expected), + $message + ); + } + + /** + * Asserts that a variable and an attribute of an object have the same type + * and value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeSame($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void + { + static::assertSame( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message + ); + } + + /** + * Asserts that two variables do not have the same type and value. + * Used on objects, it asserts that two variables do not reference + * the same object. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotSame($expected, $actual, string $message = ''): void + { + if (\is_bool($expected) && \is_bool($actual)) { + static::assertNotEquals($expected, $actual, $message); + } + + static::assertThat( + $actual, + new LogicalNot( + new IsIdentical($expected) + ), + $message + ); + } + + /** + * Asserts that a variable and an attribute of an object do not have the + * same type and value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeNotSame($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void + { + static::assertNotSame( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message + ); + } + + /** + * Asserts that a variable is of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertInstanceOf(string $expected, $actual, string $message = ''): void + { + if (!\class_exists($expected) && !\interface_exists($expected)) { + throw InvalidArgumentHelper::factory(1, 'class or interface name'); + } + + static::assertThat( + $actual, + new IsInstanceOf($expected), + $message + ); + } + + /** + * Asserts that an attribute is of a given type. + * + * @param object|string $classOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeInstanceOf(string $expected, string $attributeName, $classOrObject, string $message = ''): void + { + static::assertInstanceOf( + $expected, + static::readAttribute($classOrObject, $attributeName), + $message + ); + } + + /** + * Asserts that a variable is not of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotInstanceOf(string $expected, $actual, string $message = ''): void + { + if (!\class_exists($expected) && !\interface_exists($expected)) { + throw InvalidArgumentHelper::factory(1, 'class or interface name'); + } + + static::assertThat( + $actual, + new LogicalNot( + new IsInstanceOf($expected) + ), + $message + ); + } + + /** + * Asserts that an attribute is of a given type. + * + * @param object|string $classOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeNotInstanceOf(string $expected, string $attributeName, $classOrObject, string $message = ''): void + { + static::assertNotInstanceOf( + $expected, + static::readAttribute($classOrObject, $attributeName), + $message + ); + } + + /** + * Asserts that a variable is of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3369 + */ + public static function assertInternalType(string $expected, $actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType($expected), + $message + ); + } + + /** + * Asserts that an attribute is of a given type. + * + * @param object|string $classOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeInternalType(string $expected, string $attributeName, $classOrObject, string $message = ''): void + { + static::assertInternalType( + $expected, + static::readAttribute($classOrObject, $attributeName), + $message + ); + } + + /** + * Asserts that a variable is of type array. + */ + public static function assertIsArray($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_ARRAY), + $message + ); + } + + /** + * Asserts that a variable is of type bool. + */ + public static function assertIsBool($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_BOOL), + $message + ); + } + + /** + * Asserts that a variable is of type float. + */ + public static function assertIsFloat($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_FLOAT), + $message + ); + } + + /** + * Asserts that a variable is of type int. + */ + public static function assertIsInt($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_INT), + $message + ); + } + + /** + * Asserts that a variable is of type numeric. + */ + public static function assertIsNumeric($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_NUMERIC), + $message + ); + } + + /** + * Asserts that a variable is of type object. + */ + public static function assertIsObject($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_OBJECT), + $message + ); + } + + /** + * Asserts that a variable is of type resource. + */ + public static function assertIsResource($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_RESOURCE), + $message + ); + } + + /** + * Asserts that a variable is of type string. + */ + public static function assertIsString($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_STRING), + $message + ); + } + + /** + * Asserts that a variable is of type scalar. + */ + public static function assertIsScalar($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_SCALAR), + $message + ); + } + + /** + * Asserts that a variable is of type callable. + */ + public static function assertIsCallable($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_CALLABLE), + $message + ); + } + + /** + * Asserts that a variable is of type iterable. + */ + public static function assertIsIterable($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_ITERABLE), + $message + ); + } + + /** + * Asserts that a variable is not of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3369 + */ + public static function assertNotInternalType(string $expected, $actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot( + new IsType($expected) + ), + $message + ); + } + + /** + * Asserts that a variable is not of type array. + */ + public static function assertIsNotArray($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_ARRAY)), + $message + ); + } + + /** + * Asserts that a variable is not of type bool. + */ + public static function assertIsNotBool($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_BOOL)), + $message + ); + } + + /** + * Asserts that a variable is not of type float. + */ + public static function assertIsNotFloat($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_FLOAT)), + $message + ); + } + + /** + * Asserts that a variable is not of type int. + */ + public static function assertIsNotInt($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_INT)), + $message + ); + } + + /** + * Asserts that a variable is not of type numeric. + */ + public static function assertIsNotNumeric($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_NUMERIC)), + $message + ); + } + + /** + * Asserts that a variable is not of type object. + */ + public static function assertIsNotObject($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_OBJECT)), + $message + ); + } + + /** + * Asserts that a variable is not of type resource. + */ + public static function assertIsNotResource($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_RESOURCE)), + $message + ); + } + + /** + * Asserts that a variable is not of type string. + */ + public static function assertIsNotString($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_STRING)), + $message + ); + } + + /** + * Asserts that a variable is not of type scalar. + */ + public static function assertIsNotScalar($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_SCALAR)), + $message + ); + } + + /** + * Asserts that a variable is not of type callable. + */ + public static function assertIsNotCallable($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_CALLABLE)), + $message + ); + } + + /** + * Asserts that a variable is not of type iterable. + */ + public static function assertIsNotIterable($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_ITERABLE)), + $message + ); + } + + /** + * Asserts that an attribute is of a given type. + * + * @param object|string $classOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function assertAttributeNotInternalType(string $expected, string $attributeName, $classOrObject, string $message = ''): void + { + static::assertNotInternalType( + $expected, + static::readAttribute($classOrObject, $attributeName), + $message + ); + } + + /** + * Asserts that a string matches a given regular expression. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertRegExp(string $pattern, string $string, string $message = ''): void + { + static::assertThat($string, new RegularExpression($pattern), $message); + } + + /** + * Asserts that a string does not match a given regular expression. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotRegExp(string $pattern, string $string, string $message = ''): void + { + static::assertThat( + $string, + new LogicalNot( + new RegularExpression($pattern) + ), + $message + ); + } + + /** + * Assert that the size of two arrays (or `Countable` or `Traversable` objects) + * is the same. + * + * @param Countable|iterable $expected + * @param Countable|iterable $actual + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertSameSize($expected, $actual, string $message = ''): void + { + if (!$expected instanceof Countable && !\is_iterable($expected)) { + throw InvalidArgumentHelper::factory(1, 'countable or iterable'); + } + + if (!$actual instanceof Countable && !\is_iterable($actual)) { + throw InvalidArgumentHelper::factory(2, 'countable or iterable'); + } + + static::assertThat( + $actual, + new SameSize($expected), + $message + ); + } + + /** + * Assert that the size of two arrays (or `Countable` or `Traversable` objects) + * is not the same. + * + * @param Countable|iterable $expected + * @param Countable|iterable $actual + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotSameSize($expected, $actual, string $message = ''): void + { + if (!$expected instanceof Countable && !\is_iterable($expected)) { + throw InvalidArgumentHelper::factory(1, 'countable or iterable'); + } + + if (!$actual instanceof Countable && !\is_iterable($actual)) { + throw InvalidArgumentHelper::factory(2, 'countable or iterable'); + } + + static::assertThat( + $actual, + new LogicalNot( + new SameSize($expected) + ), + $message + ); + } + + /** + * Asserts that a string matches a given format string. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringMatchesFormat(string $format, string $string, string $message = ''): void + { + static::assertThat($string, new StringMatchesFormatDescription($format), $message); + } + + /** + * Asserts that a string does not match a given format string. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringNotMatchesFormat(string $format, string $string, string $message = ''): void + { + static::assertThat( + $string, + new LogicalNot( + new StringMatchesFormatDescription($format) + ), + $message + ); + } + + /** + * Asserts that a string matches a given format file. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringMatchesFormatFile(string $formatFile, string $string, string $message = ''): void + { + static::assertFileExists($formatFile, $message); + + static::assertThat( + $string, + new StringMatchesFormatDescription( + \file_get_contents($formatFile) + ), + $message + ); + } + + /** + * Asserts that a string does not match a given format string. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = ''): void + { + static::assertFileExists($formatFile, $message); + + static::assertThat( + $string, + new LogicalNot( + new StringMatchesFormatDescription( + \file_get_contents($formatFile) + ) + ), + $message + ); + } + + /** + * Asserts that a string starts with a given prefix. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringStartsWith(string $prefix, string $string, string $message = ''): void + { + static::assertThat($string, new StringStartsWith($prefix), $message); + } + + /** + * Asserts that a string starts not with a given prefix. + * + * @param string $prefix + * @param string $string + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringStartsNotWith($prefix, $string, string $message = ''): void + { + static::assertThat( + $string, + new LogicalNot( + new StringStartsWith($prefix) + ), + $message + ); + } + + public static function assertStringContainsString(string $needle, string $haystack, string $message = ''): void + { + $constraint = new StringContains($needle, false); + + static::assertThat($haystack, $constraint, $message); + } + + public static function assertStringContainsStringIgnoringCase(string $needle, string $haystack, string $message = ''): void + { + $constraint = new StringContains($needle, true); + + static::assertThat($haystack, $constraint, $message); + } + + public static function assertStringNotContainsString(string $needle, string $haystack, string $message = ''): void + { + $constraint = new LogicalNot(new StringContains($needle)); + + static::assertThat($haystack, $constraint, $message); + } + + public static function assertStringNotContainsStringIgnoringCase(string $needle, string $haystack, string $message = ''): void + { + $constraint = new LogicalNot(new StringContains($needle, true)); + + static::assertThat($haystack, $constraint, $message); + } + + /** + * Asserts that a string ends with a given suffix. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringEndsWith(string $suffix, string $string, string $message = ''): void + { + static::assertThat($string, new StringEndsWith($suffix), $message); + } + + /** + * Asserts that a string ends not with a given suffix. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringEndsNotWith(string $suffix, string $string, string $message = ''): void + { + static::assertThat( + $string, + new LogicalNot( + new StringEndsWith($suffix) + ), + $message + ); + } + + /** + * Asserts that two XML files are equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile, string $message = ''): void + { + $expected = Xml::loadFile($expectedFile); + $actual = Xml::loadFile($actualFile); + + static::assertEquals($expected, $actual, $message); + } + + /** + * Asserts that two XML files are not equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile, string $message = ''): void + { + $expected = Xml::loadFile($expectedFile); + $actual = Xml::loadFile($actualFile); + + static::assertNotEquals($expected, $actual, $message); + } + + /** + * Asserts that two XML documents are equal. + * + * @param DOMDocument|string $actualXml + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertXmlStringEqualsXmlFile(string $expectedFile, $actualXml, string $message = ''): void + { + $expected = Xml::loadFile($expectedFile); + $actual = Xml::load($actualXml); + + static::assertEquals($expected, $actual, $message); + } + + /** + * Asserts that two XML documents are not equal. + * + * @param DOMDocument|string $actualXml + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertXmlStringNotEqualsXmlFile(string $expectedFile, $actualXml, string $message = ''): void + { + $expected = Xml::loadFile($expectedFile); + $actual = Xml::load($actualXml); + + static::assertNotEquals($expected, $actual, $message); + } + + /** + * Asserts that two XML documents are equal. + * + * @param DOMDocument|string $expectedXml + * @param DOMDocument|string $actualXml + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertXmlStringEqualsXmlString($expectedXml, $actualXml, string $message = ''): void + { + $expected = Xml::load($expectedXml); + $actual = Xml::load($actualXml); + + static::assertEquals($expected, $actual, $message); + } + + /** + * Asserts that two XML documents are not equal. + * + * @param DOMDocument|string $expectedXml + * @param DOMDocument|string $actualXml + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, string $message = ''): void + { + $expected = Xml::load($expectedXml); + $actual = Xml::load($actualXml); + + static::assertNotEquals($expected, $actual, $message); + } + + /** + * Asserts that a hierarchy of DOMElements matches. + * + * @throws AssertionFailedError + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, bool $checkAttributes = false, string $message = ''): void + { + $expectedElement = Xml::import($expectedElement); + $actualElement = Xml::import($actualElement); + + static::assertSame( + $expectedElement->tagName, + $actualElement->tagName, + $message + ); + + if ($checkAttributes) { + static::assertSame( + $expectedElement->attributes->length, + $actualElement->attributes->length, + \sprintf( + '%s%sNumber of attributes on node "%s" does not match', + $message, + !empty($message) ? "\n" : '', + $expectedElement->tagName + ) + ); + + for ($i = 0; $i < $expectedElement->attributes->length; $i++) { + /** @var \DOMAttr $expectedAttribute */ + $expectedAttribute = $expectedElement->attributes->item($i); + + /** @var \DOMAttr $actualAttribute */ + $actualAttribute = $actualElement->attributes->getNamedItem( + $expectedAttribute->name + ); + + if (!$actualAttribute) { + static::fail( + \sprintf( + '%s%sCould not find attribute "%s" on node "%s"', + $message, + !empty($message) ? "\n" : '', + $expectedAttribute->name, + $expectedElement->tagName + ) + ); + } + } + } + + Xml::removeCharacterDataNodes($expectedElement); + Xml::removeCharacterDataNodes($actualElement); + + static::assertSame( + $expectedElement->childNodes->length, + $actualElement->childNodes->length, + \sprintf( + '%s%sNumber of child nodes of "%s" differs', + $message, + !empty($message) ? "\n" : '', + $expectedElement->tagName + ) + ); + + for ($i = 0; $i < $expectedElement->childNodes->length; $i++) { + static::assertEqualXMLStructure( + $expectedElement->childNodes->item($i), + $actualElement->childNodes->item($i), + $checkAttributes, + $message + ); + } + } + + /** + * Evaluates a PHPUnit\Framework\Constraint matcher object. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertThat($value, Constraint $constraint, string $message = ''): void + { + self::$count += \count($constraint); + + $constraint->evaluate($value, $message); + } + + /** + * Asserts that a string is a valid JSON string. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertJson(string $actualJson, string $message = ''): void + { + static::assertThat($actualJson, static::isJson(), $message); + } + + /** + * Asserts that two given JSON encoded objects or arrays are equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson, string $message = ''): void + { + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + + static::assertThat($actualJson, new JsonMatches($expectedJson), $message); + } + + /** + * Asserts that two given JSON encoded objects or arrays are not equal. + * + * @param string $expectedJson + * @param string $actualJson + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertJsonStringNotEqualsJsonString($expectedJson, $actualJson, string $message = ''): void + { + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + + static::assertThat( + $actualJson, + new LogicalNot( + new JsonMatches($expectedJson) + ), + $message + ); + } + + /** + * Asserts that the generated JSON encoded object and the content of the given file are equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson, string $message = ''): void + { + static::assertFileExists($expectedFile, $message); + $expectedJson = \file_get_contents($expectedFile); + + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + + static::assertThat($actualJson, new JsonMatches($expectedJson), $message); + } + + /** + * Asserts that the generated JSON encoded object and the content of the given file are not equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson, string $message = ''): void + { + static::assertFileExists($expectedFile, $message); + $expectedJson = \file_get_contents($expectedFile); + + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + + static::assertThat( + $actualJson, + new LogicalNot( + new JsonMatches($expectedJson) + ), + $message + ); + } + + /** + * Asserts that two JSON files are equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile, string $message = ''): void + { + static::assertFileExists($expectedFile, $message); + static::assertFileExists($actualFile, $message); + + $actualJson = \file_get_contents($actualFile); + $expectedJson = \file_get_contents($expectedFile); + + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + + $constraintExpected = new JsonMatches( + $expectedJson + ); + + $constraintActual = new JsonMatches($actualJson); + + static::assertThat($expectedJson, $constraintActual, $message); + static::assertThat($actualJson, $constraintExpected, $message); + } + + /** + * Asserts that two JSON files are not equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile, string $message = ''): void + { + static::assertFileExists($expectedFile, $message); + static::assertFileExists($actualFile, $message); + + $actualJson = \file_get_contents($actualFile); + $expectedJson = \file_get_contents($expectedFile); + + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + + $constraintExpected = new JsonMatches( + $expectedJson + ); + + $constraintActual = new JsonMatches($actualJson); + + static::assertThat($expectedJson, new LogicalNot($constraintActual), $message); + static::assertThat($actualJson, new LogicalNot($constraintExpected), $message); + } + + public static function logicalAnd(): LogicalAnd + { + $constraints = \func_get_args(); + + $constraint = new LogicalAnd; + $constraint->setConstraints($constraints); + + return $constraint; + } + + public static function logicalOr(): LogicalOr + { + $constraints = \func_get_args(); + + $constraint = new LogicalOr; + $constraint->setConstraints($constraints); + + return $constraint; + } + + public static function logicalNot(Constraint $constraint): LogicalNot + { + return new LogicalNot($constraint); + } + + public static function logicalXor(): LogicalXor + { + $constraints = \func_get_args(); + + $constraint = new LogicalXor; + $constraint->setConstraints($constraints); + + return $constraint; + } + + public static function anything(): IsAnything + { + return new IsAnything; + } + + public static function isTrue(): IsTrue + { + return new IsTrue; + } + + public static function callback(callable $callback): Callback + { + return new Callback($callback); + } + + public static function isFalse(): IsFalse + { + return new IsFalse; + } + + public static function isJson(): IsJson + { + return new IsJson; + } + + public static function isNull(): IsNull + { + return new IsNull; + } + + public static function isFinite(): IsFinite + { + return new IsFinite; + } + + public static function isInfinite(): IsInfinite + { + return new IsInfinite; + } + + public static function isNan(): IsNan + { + return new IsNan; + } + + /** + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function attribute(Constraint $constraint, string $attributeName): Attribute + { + return new Attribute($constraint, $attributeName); + } + + public static function contains($value, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): TraversableContains + { + return new TraversableContains($value, $checkForObjectIdentity, $checkForNonObjectIdentity); + } + + public static function containsOnly(string $type): TraversableContainsOnly + { + return new TraversableContainsOnly($type); + } + + public static function containsOnlyInstancesOf(string $className): TraversableContainsOnly + { + return new TraversableContainsOnly($className, false); + } + + /** + * @param int|string $key + */ + public static function arrayHasKey($key): ArrayHasKey + { + return new ArrayHasKey($key); + } + + public static function equalTo($value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): IsEqual + { + return new IsEqual($value, $delta, $maxDepth, $canonicalize, $ignoreCase); + } + + /** + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function attributeEqualTo(string $attributeName, $value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): Attribute + { + return static::attribute( + static::equalTo( + $value, + $delta, + $maxDepth, + $canonicalize, + $ignoreCase + ), + $attributeName + ); + } + + public static function isEmpty(): IsEmpty + { + return new IsEmpty; + } + + public static function isWritable(): IsWritable + { + return new IsWritable; + } + + public static function isReadable(): IsReadable + { + return new IsReadable; + } + + public static function directoryExists(): DirectoryExists + { + return new DirectoryExists; + } + + public static function fileExists(): FileExists + { + return new FileExists; + } + + public static function greaterThan($value): GreaterThan + { + return new GreaterThan($value); + } + + public static function greaterThanOrEqual($value): LogicalOr + { + return static::logicalOr( + new IsEqual($value), + new GreaterThan($value) + ); + } + + public static function classHasAttribute(string $attributeName): ClassHasAttribute + { + return new ClassHasAttribute($attributeName); + } + + public static function classHasStaticAttribute(string $attributeName): ClassHasStaticAttribute + { + return new ClassHasStaticAttribute($attributeName); + } + + public static function objectHasAttribute($attributeName): ObjectHasAttribute + { + return new ObjectHasAttribute($attributeName); + } + + public static function identicalTo($value): IsIdentical + { + return new IsIdentical($value); + } + + public static function isInstanceOf(string $className): IsInstanceOf + { + return new IsInstanceOf($className); + } + + public static function isType(string $type): IsType + { + return new IsType($type); + } + + public static function lessThan($value): LessThan + { + return new LessThan($value); + } + + public static function lessThanOrEqual($value): LogicalOr + { + return static::logicalOr( + new IsEqual($value), + new LessThan($value) + ); + } + + public static function matchesRegularExpression(string $pattern): RegularExpression + { + return new RegularExpression($pattern); + } + + public static function matches(string $string): StringMatchesFormatDescription + { + return new StringMatchesFormatDescription($string); + } + + public static function stringStartsWith($prefix): StringStartsWith + { + return new StringStartsWith($prefix); + } + + public static function stringContains(string $string, bool $case = true): StringContains + { + return new StringContains($string, $case); + } + + public static function stringEndsWith(string $suffix): StringEndsWith + { + return new StringEndsWith($suffix); + } + + public static function countOf(int $count): Count + { + return new Count($count); + } + + /** + * Fails a test with the given message. + * + * @throws AssertionFailedError + */ + public static function fail(string $message = ''): void + { + self::$count++; + + throw new AssertionFailedError($message); + } + + /** + * Returns the value of an attribute of a class or an object. + * This also works for attributes that are declared protected or private. + * + * @param object|string $classOrObject + * + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function readAttribute($classOrObject, string $attributeName) + { + if (!self::isValidAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(2, 'valid attribute name'); + } + + if (\is_string($classOrObject)) { + if (!\class_exists($classOrObject)) { + throw InvalidArgumentHelper::factory( + 1, + 'class name' + ); + } + + return static::getStaticAttribute( + $classOrObject, + $attributeName + ); + } + + if (\is_object($classOrObject)) { + return static::getObjectAttribute( + $classOrObject, + $attributeName + ); + } + + throw InvalidArgumentHelper::factory( + 1, + 'class name or object' + ); + } + + /** + * Returns the value of a static attribute. + * This also works for attributes that are declared protected or private. + * + * @throws Exception + * @throws ReflectionException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function getStaticAttribute(string $className, string $attributeName) + { + if (!\class_exists($className)) { + throw InvalidArgumentHelper::factory(1, 'class name'); + } + + if (!self::isValidAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(2, 'valid attribute name'); + } + + $class = new ReflectionClass($className); + + while ($class) { + $attributes = $class->getStaticProperties(); + + if (\array_key_exists($attributeName, $attributes)) { + return $attributes[$attributeName]; + } + + $class = $class->getParentClass(); + } + + throw new Exception( + \sprintf( + 'Attribute "%s" not found in class.', + $attributeName + ) + ); + } + + /** + * Returns the value of an object's attribute. + * This also works for attributes that are declared protected or private. + * + * @param object $object + * + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + */ + public static function getObjectAttribute($object, string $attributeName) + { + if (!\is_object($object)) { + throw InvalidArgumentHelper::factory(1, 'object'); + } + + if (!self::isValidAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(2, 'valid attribute name'); + } + + try { + $reflector = new ReflectionObject($object); + + do { + try { + $attribute = $reflector->getProperty($attributeName); + + if (!$attribute || $attribute->isPublic()) { + return $object->$attributeName; + } + + $attribute->setAccessible(true); + $value = $attribute->getValue($object); + $attribute->setAccessible(false); + + return $value; + } catch (ReflectionException $e) { + } + } while ($reflector = $reflector->getParentClass()); + } catch (ReflectionException $e) { + } + + throw new Exception( + \sprintf( + 'Attribute "%s" not found in object.', + $attributeName + ) + ); + } + + /** + * Mark the test as incomplete. + * + * @throws IncompleteTestError + */ + public static function markTestIncomplete(string $message = ''): void + { + throw new IncompleteTestError($message); + } + + /** + * Mark the test as skipped. + * + * @throws SkippedTestError + */ + public static function markTestSkipped(string $message = ''): void + { + throw new SkippedTestError($message); + } + + /** + * Return the current assertion count. + */ + public static function getCount(): int + { + return self::$count; + } + + /** + * Reset the assertion counter. + */ + public static function resetCount(): void + { + self::$count = 0; + } + + private static function isValidAttributeName(string $attributeName): bool + { + return \preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/', $attributeName); + } + + private static function createWarning(string $warning): void + { + foreach (\debug_backtrace() as $step) { + if (isset($step['object']) && $step['object'] instanceof TestCase) { + $step['object']->addWarning($warning); + + break; + } + } + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Assert/Functions.php b/vendor/phpunit/phpunit/src/Framework/Assert/Functions.php new file mode 100644 index 0000000..aa595ff --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Assert/Functions.php @@ -0,0 +1,1666 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PHPUnit\Framework\Assert; +use PHPUnit\Framework\Constraint\ArrayHasKey; +use PHPUnit\Framework\Constraint\Attribute; +use PHPUnit\Framework\Constraint\Callback; +use PHPUnit\Framework\Constraint\ClassHasAttribute; +use PHPUnit\Framework\Constraint\ClassHasStaticAttribute; +use PHPUnit\Framework\Constraint\Constraint; +use PHPUnit\Framework\Constraint\Count; +use PHPUnit\Framework\Constraint\DirectoryExists; +use PHPUnit\Framework\Constraint\FileExists; +use PHPUnit\Framework\Constraint\GreaterThan; +use PHPUnit\Framework\Constraint\IsAnything; +use PHPUnit\Framework\Constraint\IsEmpty; +use PHPUnit\Framework\Constraint\IsEqual; +use PHPUnit\Framework\Constraint\IsFalse; +use PHPUnit\Framework\Constraint\IsFinite; +use PHPUnit\Framework\Constraint\IsIdentical; +use PHPUnit\Framework\Constraint\IsInfinite; +use PHPUnit\Framework\Constraint\IsInstanceOf; +use PHPUnit\Framework\Constraint\IsJson; +use PHPUnit\Framework\Constraint\IsNan; +use PHPUnit\Framework\Constraint\IsNull; +use PHPUnit\Framework\Constraint\IsReadable; +use PHPUnit\Framework\Constraint\IsTrue; +use PHPUnit\Framework\Constraint\IsType; +use PHPUnit\Framework\Constraint\IsWritable; +use PHPUnit\Framework\Constraint\LessThan; +use PHPUnit\Framework\Constraint\LogicalAnd; +use PHPUnit\Framework\Constraint\LogicalNot; +use PHPUnit\Framework\Constraint\LogicalOr; +use PHPUnit\Framework\Constraint\LogicalXor; +use PHPUnit\Framework\Constraint\ObjectHasAttribute; +use PHPUnit\Framework\Constraint\RegularExpression; +use PHPUnit\Framework\Constraint\StringContains; +use PHPUnit\Framework\Constraint\StringEndsWith; +use PHPUnit\Framework\Constraint\StringMatchesFormatDescription; +use PHPUnit\Framework\Constraint\StringStartsWith; +use PHPUnit\Framework\Constraint\TraversableContains; +use PHPUnit\Framework\Constraint\TraversableContainsOnly; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount as AnyInvokedCountMatcher; +use PHPUnit\Framework\MockObject\Matcher\InvokedAtIndex as InvokedAtIndexMatcher; +use PHPUnit\Framework\MockObject\Matcher\InvokedAtLeastCount as InvokedAtLeastCountMatcher; +use PHPUnit\Framework\MockObject\Matcher\InvokedAtLeastOnce as InvokedAtLeastOnceMatcher; +use PHPUnit\Framework\MockObject\Matcher\InvokedAtMostCount as InvokedAtMostCountMatcher; +use PHPUnit\Framework\MockObject\Matcher\InvokedCount as InvokedCountMatcher; +use PHPUnit\Framework\MockObject\Stub\ConsecutiveCalls as ConsecutiveCallsStub; +use PHPUnit\Framework\MockObject\Stub\Exception as ExceptionStub; +use PHPUnit\Framework\MockObject\Stub\ReturnArgument as ReturnArgumentStub; +use PHPUnit\Framework\MockObject\Stub\ReturnCallback as ReturnCallbackStub; +use PHPUnit\Framework\MockObject\Stub\ReturnSelf as ReturnSelfStub; +use PHPUnit\Framework\MockObject\Stub\ReturnStub; +use PHPUnit\Framework\MockObject\Stub\ReturnValueMap as ReturnValueMapStub; + +/** + * Asserts that an array has a specified key. + * + * @param int|string $key + * @param array|ArrayAccess $array + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertArrayHasKey($key, $array, string $message = ''): void +{ + Assert::assertArrayHasKey(...\func_get_args()); +} + +/** + * Asserts that an array has a specified subset. + * + * @param array|ArrayAccess $subset + * @param array|ArrayAccess $array + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertArraySubset($subset, $array, bool $checkForObjectIdentity = false, string $message = ''): void +{ + Assert::assertArraySubset(...\func_get_args()); +} + +/** + * Asserts that an array does not have a specified key. + * + * @param int|string $key + * @param array|ArrayAccess $array + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertArrayNotHasKey($key, $array, string $message = ''): void +{ + Assert::assertArrayNotHasKey(...\func_get_args()); +} + +/** + * Asserts that a haystack contains a needle. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertContains($needle, $haystack, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void +{ + Assert::assertContains(...\func_get_args()); +} + +/** + * Asserts that a haystack that is stored in a static attribute of a class + * or an attribute of an object contains a needle. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeContains($needle, string $haystackAttributeName, $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void +{ + Assert::assertAttributeContains(...\func_get_args()); +} + +/** + * Asserts that a haystack does not contain a needle. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNotContains($needle, $haystack, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void +{ + Assert::assertNotContains(...\func_get_args()); +} + +/** + * Asserts that a haystack that is stored in a static attribute of a class + * or an attribute of an object does not contain a needle. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeNotContains($needle, string $haystackAttributeName, $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void +{ + Assert::assertAttributeNotContains(...\func_get_args()); +} + +/** + * Asserts that a haystack contains only values of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = ''): void +{ + Assert::assertContainsOnly(...\func_get_args()); +} + +/** + * Asserts that a haystack contains only instances of a given class name. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertContainsOnlyInstancesOf(string $className, iterable $haystack, string $message = ''): void +{ + Assert::assertContainsOnlyInstancesOf(...\func_get_args()); +} + +/** + * Asserts that a haystack that is stored in a static attribute of a class + * or an attribute of an object contains only values of a given type. + * + * @param object|string $haystackClassOrObject + * @param bool $isNativeType + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeContainsOnly(string $type, string $haystackAttributeName, $haystackClassOrObject, ?bool $isNativeType = null, string $message = ''): void +{ + Assert::assertAttributeContainsOnly(...\func_get_args()); +} + +/** + * Asserts that a haystack does not contain only values of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNotContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = ''): void +{ + Assert::assertNotContainsOnly(...\func_get_args()); +} + +/** + * Asserts that a haystack that is stored in a static attribute of a class + * or an attribute of an object does not contain only values of a given + * type. + * + * @param object|string $haystackClassOrObject + * @param bool $isNativeType + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeNotContainsOnly(string $type, string $haystackAttributeName, $haystackClassOrObject, ?bool $isNativeType = null, string $message = ''): void +{ + Assert::assertAttributeNotContainsOnly(...\func_get_args()); +} + +/** + * Asserts the number of elements of an array, Countable or Traversable. + * + * @param Countable|iterable $haystack + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertCount(int $expectedCount, $haystack, string $message = ''): void +{ + Assert::assertCount(...\func_get_args()); +} + +/** + * Asserts the number of elements of an array, Countable or Traversable + * that is stored in an attribute. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeCount(int $expectedCount, string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void +{ + Assert::assertAttributeCount(...\func_get_args()); +} + +/** + * Asserts the number of elements of an array, Countable or Traversable. + * + * @param Countable|iterable $haystack + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNotCount(int $expectedCount, $haystack, string $message = ''): void +{ + Assert::assertNotCount(...\func_get_args()); +} + +/** + * Asserts the number of elements of an array, Countable or Traversable + * that is stored in an attribute. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeNotCount(int $expectedCount, string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void +{ + Assert::assertAttributeNotCount(...\func_get_args()); +} + +/** + * Asserts that two variables are equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertEquals($expected, $actual, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void +{ + Assert::assertEquals(...\func_get_args()); +} + +/** + * Asserts that a variable is equal to an attribute of an object. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeEquals($expected, string $actualAttributeName, $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void +{ + Assert::assertAttributeEquals(...\func_get_args()); +} + +/** + * Asserts that two variables are not equal. + * + * @param float $delta + * @param int $maxDepth + * @param bool $canonicalize + * @param bool $ignoreCase + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNotEquals($expected, $actual, string $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false): void +{ + Assert::assertNotEquals(...\func_get_args()); +} + +/** + * Asserts that a variable is not equal to an attribute of an object. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeNotEquals($expected, string $actualAttributeName, $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void +{ + Assert::assertAttributeNotEquals(...\func_get_args()); +} + +/** + * Asserts that a variable is empty. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertEmpty($actual, string $message = ''): void +{ + Assert::assertEmpty(...\func_get_args()); +} + +/** + * Asserts that a static attribute of a class or an attribute of an object + * is empty. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeEmpty(string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void +{ + Assert::assertAttributeEmpty(...\func_get_args()); +} + +/** + * Asserts that a variable is not empty. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNotEmpty($actual, string $message = ''): void +{ + Assert::assertNotEmpty(...\func_get_args()); +} + +/** + * Asserts that a static attribute of a class or an attribute of an object + * is not empty. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeNotEmpty(string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void +{ + Assert::assertAttributeNotEmpty(...\func_get_args()); +} + +/** + * Asserts that a value is greater than another value. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertGreaterThan($expected, $actual, string $message = ''): void +{ + Assert::assertGreaterThan(...\func_get_args()); +} + +/** + * Asserts that an attribute is greater than another value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeGreaterThan($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void +{ + Assert::assertAttributeGreaterThan(...\func_get_args()); +} + +/** + * Asserts that a value is greater than or equal to another value. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertGreaterThanOrEqual($expected, $actual, string $message = ''): void +{ + Assert::assertGreaterThanOrEqual(...\func_get_args()); +} + +/** + * Asserts that an attribute is greater than or equal to another value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeGreaterThanOrEqual($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void +{ + Assert::assertAttributeGreaterThanOrEqual(...\func_get_args()); +} + +/** + * Asserts that a value is smaller than another value. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertLessThan($expected, $actual, string $message = ''): void +{ + Assert::assertLessThan(...\func_get_args()); +} + +/** + * Asserts that an attribute is smaller than another value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeLessThan($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void +{ + Assert::assertAttributeLessThan(...\func_get_args()); +} + +/** + * Asserts that a value is smaller than or equal to another value. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertLessThanOrEqual($expected, $actual, string $message = ''): void +{ + Assert::assertLessThanOrEqual(...\func_get_args()); +} + +/** + * Asserts that an attribute is smaller than or equal to another value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeLessThanOrEqual($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void +{ + Assert::assertAttributeLessThanOrEqual(...\func_get_args()); +} + +/** + * Asserts that the contents of one file is equal to the contents of another + * file. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertFileEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void +{ + Assert::assertFileEquals(...\func_get_args()); +} + +/** + * Asserts that the contents of one file is not equal to the contents of + * another file. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertFileNotEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void +{ + Assert::assertFileNotEquals(...\func_get_args()); +} + +/** + * Asserts that the contents of a string is equal + * to the contents of a file. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertStringEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void +{ + Assert::assertStringEqualsFile(...\func_get_args()); +} + +/** + * Asserts that the contents of a string is not equal + * to the contents of a file. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void +{ + Assert::assertStringNotEqualsFile(...\func_get_args()); +} + +/** + * Asserts that a file/dir is readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertIsReadable(string $filename, string $message = ''): void +{ + Assert::assertIsReadable(...\func_get_args()); +} + +/** + * Asserts that a file/dir exists and is not readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNotIsReadable(string $filename, string $message = ''): void +{ + Assert::assertNotIsReadable(...\func_get_args()); +} + +/** + * Asserts that a file/dir exists and is writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertIsWritable(string $filename, string $message = ''): void +{ + Assert::assertIsWritable(...\func_get_args()); +} + +/** + * Asserts that a file/dir exists and is not writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNotIsWritable(string $filename, string $message = ''): void +{ + Assert::assertNotIsWritable(...\func_get_args()); +} + +/** + * Asserts that a directory exists. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertDirectoryExists(string $directory, string $message = ''): void +{ + Assert::assertDirectoryExists(...\func_get_args()); +} + +/** + * Asserts that a directory does not exist. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertDirectoryNotExists(string $directory, string $message = ''): void +{ + Assert::assertDirectoryNotExists(...\func_get_args()); +} + +/** + * Asserts that a directory exists and is readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertDirectoryIsReadable(string $directory, string $message = ''): void +{ + Assert::assertDirectoryIsReadable(...\func_get_args()); +} + +/** + * Asserts that a directory exists and is not readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertDirectoryNotIsReadable(string $directory, string $message = ''): void +{ + Assert::assertDirectoryNotIsReadable(...\func_get_args()); +} + +/** + * Asserts that a directory exists and is writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertDirectoryIsWritable(string $directory, string $message = ''): void +{ + Assert::assertDirectoryIsWritable(...\func_get_args()); +} + +/** + * Asserts that a directory exists and is not writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertDirectoryNotIsWritable(string $directory, string $message = ''): void +{ + Assert::assertDirectoryNotIsWritable(...\func_get_args()); +} + +/** + * Asserts that a file exists. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertFileExists(string $filename, string $message = ''): void +{ + Assert::assertFileExists(...\func_get_args()); +} + +/** + * Asserts that a file does not exist. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertFileNotExists(string $filename, string $message = ''): void +{ + Assert::assertFileNotExists(...\func_get_args()); +} + +/** + * Asserts that a file exists and is readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertFileIsReadable(string $file, string $message = ''): void +{ + Assert::assertFileIsReadable(...\func_get_args()); +} + +/** + * Asserts that a file exists and is not readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertFileNotIsReadable(string $file, string $message = ''): void +{ + Assert::assertFileNotIsReadable(...\func_get_args()); +} + +/** + * Asserts that a file exists and is writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertFileIsWritable(string $file, string $message = ''): void +{ + Assert::assertFileIsWritable(...\func_get_args()); +} + +/** + * Asserts that a file exists and is not writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertFileNotIsWritable(string $file, string $message = ''): void +{ + Assert::assertFileNotIsWritable(...\func_get_args()); +} + +/** + * Asserts that a condition is true. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertTrue($condition, string $message = ''): void +{ + Assert::assertTrue(...\func_get_args()); +} + +/** + * Asserts that a condition is not true. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNotTrue($condition, string $message = ''): void +{ + Assert::assertNotTrue(...\func_get_args()); +} + +/** + * Asserts that a condition is false. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertFalse($condition, string $message = ''): void +{ + Assert::assertFalse(...\func_get_args()); +} + +/** + * Asserts that a condition is not false. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNotFalse($condition, string $message = ''): void +{ + Assert::assertNotFalse(...\func_get_args()); +} + +/** + * Asserts that a variable is null. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNull($actual, string $message = ''): void +{ + Assert::assertNull(...\func_get_args()); +} + +/** + * Asserts that a variable is not null. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNotNull($actual, string $message = ''): void +{ + Assert::assertNotNull(...\func_get_args()); +} + +/** + * Asserts that a variable is finite. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertFinite($actual, string $message = ''): void +{ + Assert::assertFinite(...\func_get_args()); +} + +/** + * Asserts that a variable is infinite. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertInfinite($actual, string $message = ''): void +{ + Assert::assertInfinite(...\func_get_args()); +} + +/** + * Asserts that a variable is nan. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNan($actual, string $message = ''): void +{ + Assert::assertNan(...\func_get_args()); +} + +/** + * Asserts that a class has a specified attribute. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertClassHasAttribute(string $attributeName, string $className, string $message = ''): void +{ + Assert::assertClassHasAttribute(...\func_get_args()); +} + +/** + * Asserts that a class does not have a specified attribute. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertClassNotHasAttribute(string $attributeName, string $className, string $message = ''): void +{ + Assert::assertClassNotHasAttribute(...\func_get_args()); +} + +/** + * Asserts that a class has a specified static attribute. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertClassHasStaticAttribute(string $attributeName, string $className, string $message = ''): void +{ + Assert::assertClassHasStaticAttribute(...\func_get_args()); +} + +/** + * Asserts that a class does not have a specified static attribute. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = ''): void +{ + Assert::assertClassNotHasStaticAttribute(...\func_get_args()); +} + +/** + * Asserts that an object has a specified attribute. + * + * @param object $object + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertObjectHasAttribute(string $attributeName, $object, string $message = ''): void +{ + Assert::assertObjectHasAttribute(...\func_get_args()); +} + +/** + * Asserts that an object does not have a specified attribute. + * + * @param object $object + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertObjectNotHasAttribute(string $attributeName, $object, string $message = ''): void +{ + Assert::assertObjectNotHasAttribute(...\func_get_args()); +} + +/** + * Asserts that two variables have the same type and value. + * Used on objects, it asserts that two variables reference + * the same object. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertSame($expected, $actual, string $message = ''): void +{ + Assert::assertSame(...\func_get_args()); +} + +/** + * Asserts that a variable and an attribute of an object have the same type + * and value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeSame($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void +{ + Assert::assertAttributeSame(...\func_get_args()); +} + +/** + * Asserts that two variables do not have the same type and value. + * Used on objects, it asserts that two variables do not reference + * the same object. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNotSame($expected, $actual, string $message = ''): void +{ + Assert::assertNotSame(...\func_get_args()); +} + +/** + * Asserts that a variable and an attribute of an object do not have the + * same type and value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeNotSame($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void +{ + Assert::assertAttributeNotSame(...\func_get_args()); +} + +/** + * Asserts that a variable is of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertInstanceOf(string $expected, $actual, string $message = ''): void +{ + Assert::assertInstanceOf(...\func_get_args()); +} + +/** + * Asserts that an attribute is of a given type. + * + * @param object|string $classOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeInstanceOf(string $expected, string $attributeName, $classOrObject, string $message = ''): void +{ + Assert::assertAttributeInstanceOf(...\func_get_args()); +} + +/** + * Asserts that a variable is not of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNotInstanceOf(string $expected, $actual, string $message = ''): void +{ + Assert::assertNotInstanceOf(...\func_get_args()); +} + +/** + * Asserts that an attribute is of a given type. + * + * @param object|string $classOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeNotInstanceOf(string $expected, string $attributeName, $classOrObject, string $message = ''): void +{ + Assert::assertAttributeNotInstanceOf(...\func_get_args()); +} + +/** + * Asserts that a variable is of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertInternalType(string $expected, $actual, string $message = ''): void +{ + Assert::assertInternalType(...\func_get_args()); +} + +/** + * Asserts that an attribute is of a given type. + * + * @param object|string $classOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeInternalType(string $expected, string $attributeName, $classOrObject, string $message = ''): void +{ + Assert::assertAttributeInternalType(...\func_get_args()); +} + +/** + * Asserts that a variable is not of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNotInternalType(string $expected, $actual, string $message = ''): void +{ + Assert::assertNotInternalType(...\func_get_args()); +} + +/** + * Asserts that an attribute is of a given type. + * + * @param object|string $classOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertAttributeNotInternalType(string $expected, string $attributeName, $classOrObject, string $message = ''): void +{ + Assert::assertAttributeNotInternalType(...\func_get_args()); +} + +/** + * Asserts that a string matches a given regular expression. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertRegExp(string $pattern, string $string, string $message = ''): void +{ + Assert::assertRegExp(...\func_get_args()); +} + +/** + * Asserts that a string does not match a given regular expression. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNotRegExp(string $pattern, string $string, string $message = ''): void +{ + Assert::assertNotRegExp(...\func_get_args()); +} + +/** + * Assert that the size of two arrays (or `Countable` or `Traversable` objects) + * is the same. + * + * @param Countable|iterable $expected + * @param Countable|iterable $actual + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertSameSize($expected, $actual, string $message = ''): void +{ + Assert::assertSameSize(...\func_get_args()); +} + +/** + * Assert that the size of two arrays (or `Countable` or `Traversable` objects) + * is not the same. + * + * @param Countable|iterable $expected + * @param Countable|iterable $actual + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertNotSameSize($expected, $actual, string $message = ''): void +{ + Assert::assertNotSameSize(...\func_get_args()); +} + +/** + * Asserts that a string matches a given format string. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertStringMatchesFormat(string $format, string $string, string $message = ''): void +{ + Assert::assertStringMatchesFormat(...\func_get_args()); +} + +/** + * Asserts that a string does not match a given format string. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertStringNotMatchesFormat(string $format, string $string, string $message = ''): void +{ + Assert::assertStringNotMatchesFormat(...\func_get_args()); +} + +/** + * Asserts that a string matches a given format file. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertStringMatchesFormatFile(string $formatFile, string $string, string $message = ''): void +{ + Assert::assertStringMatchesFormatFile(...\func_get_args()); +} + +/** + * Asserts that a string does not match a given format string. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = ''): void +{ + Assert::assertStringNotMatchesFormatFile(...\func_get_args()); +} + +/** + * Asserts that a string starts with a given prefix. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertStringStartsWith(string $prefix, string $string, string $message = ''): void +{ + Assert::assertStringStartsWith(...\func_get_args()); +} + +/** + * Asserts that a string starts not with a given prefix. + * + * @param string $prefix + * @param string $string + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertStringStartsNotWith($prefix, $string, string $message = ''): void +{ + Assert::assertStringStartsNotWith(...\func_get_args()); +} + +/** + * Asserts that a string ends with a given suffix. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertStringEndsWith(string $suffix, string $string, string $message = ''): void +{ + Assert::assertStringEndsWith(...\func_get_args()); +} + +/** + * Asserts that a string ends not with a given suffix. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertStringEndsNotWith(string $suffix, string $string, string $message = ''): void +{ + Assert::assertStringEndsNotWith(...\func_get_args()); +} + +/** + * Asserts that two XML files are equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile, string $message = ''): void +{ + Assert::assertXmlFileEqualsXmlFile(...\func_get_args()); +} + +/** + * Asserts that two XML files are not equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile, string $message = ''): void +{ + Assert::assertXmlFileNotEqualsXmlFile(...\func_get_args()); +} + +/** + * Asserts that two XML documents are equal. + * + * @param DOMDocument|string $actualXml + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertXmlStringEqualsXmlFile(string $expectedFile, $actualXml, string $message = ''): void +{ + Assert::assertXmlStringEqualsXmlFile(...\func_get_args()); +} + +/** + * Asserts that two XML documents are not equal. + * + * @param DOMDocument|string $actualXml + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertXmlStringNotEqualsXmlFile(string $expectedFile, $actualXml, string $message = ''): void +{ + Assert::assertXmlStringNotEqualsXmlFile(...\func_get_args()); +} + +/** + * Asserts that two XML documents are equal. + * + * @param DOMDocument|string $expectedXml + * @param DOMDocument|string $actualXml + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertXmlStringEqualsXmlString($expectedXml, $actualXml, string $message = ''): void +{ + Assert::assertXmlStringEqualsXmlString(...\func_get_args()); +} + +/** + * Asserts that two XML documents are not equal. + * + * @param DOMDocument|string $expectedXml + * @param DOMDocument|string $actualXml + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, string $message = ''): void +{ + Assert::assertXmlStringNotEqualsXmlString(...\func_get_args()); +} + +/** + * Asserts that a hierarchy of DOMElements matches. + * + * @throws AssertionFailedError + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, bool $checkAttributes = false, string $message = ''): void +{ + Assert::assertEqualXMLStructure(...\func_get_args()); +} + +/** + * Evaluates a PHPUnit\Framework\Constraint matcher object. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertThat($value, Constraint $constraint, string $message = ''): void +{ + Assert::assertThat(...\func_get_args()); +} + +/** + * Asserts that a string is a valid JSON string. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertJson(string $actualJson, string $message = ''): void +{ + Assert::assertJson(...\func_get_args()); +} + +/** + * Asserts that two given JSON encoded objects or arrays are equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson, string $message = ''): void +{ + Assert::assertJsonStringEqualsJsonString(...\func_get_args()); +} + +/** + * Asserts that two given JSON encoded objects or arrays are not equal. + * + * @param string $expectedJson + * @param string $actualJson + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertJsonStringNotEqualsJsonString($expectedJson, $actualJson, string $message = ''): void +{ + Assert::assertJsonStringNotEqualsJsonString(...\func_get_args()); +} + +/** + * Asserts that the generated JSON encoded object and the content of the given file are equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson, string $message = ''): void +{ + Assert::assertJsonStringEqualsJsonFile(...\func_get_args()); +} + +/** + * Asserts that the generated JSON encoded object and the content of the given file are not equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson, string $message = ''): void +{ + Assert::assertJsonStringNotEqualsJsonFile(...\func_get_args()); +} + +/** + * Asserts that two JSON files are equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile, string $message = ''): void +{ + Assert::assertJsonFileEqualsJsonFile(...\func_get_args()); +} + +/** + * Asserts that two JSON files are not equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ +function assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile, string $message = ''): void +{ + Assert::assertJsonFileNotEqualsJsonFile(...\func_get_args()); +} + +function logicalAnd(): LogicalAnd +{ + return Assert::logicalAnd(...\func_get_args()); +} + +function logicalOr(): LogicalOr +{ + return Assert::logicalOr(...\func_get_args()); +} + +function logicalNot(Constraint $constraint): LogicalNot +{ + return Assert::logicalNot(...\func_get_args()); +} + +function logicalXor(): LogicalXor +{ + return Assert::logicalXor(...\func_get_args()); +} + +function anything(): IsAnything +{ + return Assert::anything(); +} + +function isTrue(): IsTrue +{ + return Assert::isTrue(); +} + +function callback(callable $callback): Callback +{ + return Assert::callback(...\func_get_args()); +} + +function isFalse(): IsFalse +{ + return Assert::isFalse(); +} + +function isJson(): IsJson +{ + return Assert::isJson(); +} + +function isNull(): IsNull +{ + return Assert::isNull(); +} + +function isFinite(): IsFinite +{ + return Assert::isFinite(); +} + +function isInfinite(): IsInfinite +{ + return Assert::isInfinite(); +} + +function isNan(): IsNan +{ + return Assert::isNan(); +} + +function attribute(Constraint $constraint, string $attributeName): Attribute +{ + return Assert::attribute(...\func_get_args()); +} + +function contains($value, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): TraversableContains +{ + return Assert::contains(...\func_get_args()); +} + +function containsOnly(string $type): TraversableContainsOnly +{ + return Assert::containsOnly(...\func_get_args()); +} + +function containsOnlyInstancesOf(string $className): TraversableContainsOnly +{ + return Assert::containsOnlyInstancesOf(...\func_get_args()); +} + +function arrayHasKey($key): ArrayHasKey +{ + return Assert::arrayHasKey(...\func_get_args()); +} + +function equalTo($value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): IsEqual +{ + return Assert::equalTo(...\func_get_args()); +} + +function attributeEqualTo(string $attributeName, $value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): Attribute +{ + return Assert::attributeEqualTo(...\func_get_args()); +} + +function isEmpty(): IsEmpty +{ + return Assert::isEmpty(); +} + +function isWritable(): IsWritable +{ + return Assert::isWritable(); +} + +function isReadable(): IsReadable +{ + return Assert::isReadable(); +} + +function directoryExists(): DirectoryExists +{ + return Assert::directoryExists(); +} + +function fileExists(): FileExists +{ + return Assert::fileExists(); +} + +function greaterThan($value): GreaterThan +{ + return Assert::greaterThan(...\func_get_args()); +} + +function greaterThanOrEqual($value): LogicalOr +{ + return Assert::greaterThanOrEqual(...\func_get_args()); +} + +function classHasAttribute(string $attributeName): ClassHasAttribute +{ + return Assert::classHasAttribute(...\func_get_args()); +} + +function classHasStaticAttribute(string $attributeName): ClassHasStaticAttribute +{ + return Assert::classHasStaticAttribute(...\func_get_args()); +} + +function objectHasAttribute($attributeName): ObjectHasAttribute +{ + return Assert::objectHasAttribute(...\func_get_args()); +} + +function identicalTo($value): IsIdentical +{ + return Assert::identicalTo(...\func_get_args()); +} + +function isInstanceOf(string $className): IsInstanceOf +{ + return Assert::isInstanceOf(...\func_get_args()); +} + +function isType(string $type): IsType +{ + return Assert::isType(...\func_get_args()); +} + +function lessThan($value): LessThan +{ + return Assert::lessThan(...\func_get_args()); +} + +function lessThanOrEqual($value): LogicalOr +{ + return Assert::lessThanOrEqual(...\func_get_args()); +} + +function matchesRegularExpression(string $pattern): RegularExpression +{ + return Assert::matchesRegularExpression(...\func_get_args()); +} + +function matches(string $string): StringMatchesFormatDescription +{ + return Assert::matches(...\func_get_args()); +} + +function stringStartsWith($prefix): StringStartsWith +{ + return Assert::stringStartsWith(...\func_get_args()); +} + +function stringContains(string $string, bool $case = true): StringContains +{ + return Assert::stringContains(...\func_get_args()); +} + +function stringEndsWith(string $suffix): StringEndsWith +{ + return Assert::stringEndsWith(...\func_get_args()); +} + +function countOf(int $count): Count +{ + return Assert::countOf(...\func_get_args()); +} + +/** + * Returns a matcher that matches when the method is executed + * zero or more times. + */ +function any(): AnyInvokedCountMatcher +{ + return new AnyInvokedCountMatcher; +} + +/** + * Returns a matcher that matches when the method is never executed. + */ +function never(): InvokedCountMatcher +{ + return new InvokedCountMatcher(0); +} + +/** + * Returns a matcher that matches when the method is executed + * at least N times. + * + * @param int $requiredInvocations + */ +function atLeast($requiredInvocations): InvokedAtLeastCountMatcher +{ + return new InvokedAtLeastCountMatcher( + $requiredInvocations + ); +} + +/** + * Returns a matcher that matches when the method is executed at least once. + */ +function atLeastOnce(): InvokedAtLeastOnceMatcher +{ + return new InvokedAtLeastOnceMatcher; +} + +/** + * Returns a matcher that matches when the method is executed exactly once. + */ +function once(): InvokedCountMatcher +{ + return new InvokedCountMatcher(1); +} + +/** + * Returns a matcher that matches when the method is executed + * exactly $count times. + * + * @param int $count + */ +function exactly($count): InvokedCountMatcher +{ + return new InvokedCountMatcher($count); +} + +/** + * Returns a matcher that matches when the method is executed + * at most N times. + * + * @param int $allowedInvocations + */ +function atMost($allowedInvocations): InvokedAtMostCountMatcher +{ + return new InvokedAtMostCountMatcher($allowedInvocations); +} + +/** + * Returns a matcher that matches when the method is executed + * at the given index. + * + * @param int $index + */ +function at($index): InvokedAtIndexMatcher +{ + return new InvokedAtIndexMatcher($index); +} + +function returnValue($value): ReturnStub +{ + return new ReturnStub($value); +} + +function returnValueMap(array $valueMap): ReturnValueMapStub +{ + return new ReturnValueMapStub($valueMap); +} + +/** + * @param int $argumentIndex + */ +function returnArgument($argumentIndex): ReturnArgumentStub +{ + return new ReturnArgumentStub($argumentIndex); +} + +function returnCallback($callback): ReturnCallbackStub +{ + return new ReturnCallbackStub($callback); +} + +/** + * Returns the current object. + * + * This method is useful when mocking a fluent interface. + */ +function returnSelf(): ReturnSelfStub +{ + return new ReturnSelfStub; +} + +function throwException(Throwable $exception): ExceptionStub +{ + return new ExceptionStub($exception); +} + +function onConsecutiveCalls(): ConsecutiveCallsStub +{ + $args = \func_get_args(); + + return new ConsecutiveCallsStub($args); +} diff --git a/vendor/phpunit/phpunit/src/Framework/AssertionFailedError.php b/vendor/phpunit/phpunit/src/Framework/AssertionFailedError.php new file mode 100644 index 0000000..a402e57 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/AssertionFailedError.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * Thrown when an assertion failed. + */ +class AssertionFailedError extends Exception implements SelfDescribing +{ + /** + * Wrapper for getMessage() which is declared as final. + */ + public function toString(): string + { + return $this->getMessage(); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/CodeCoverageException.php b/vendor/phpunit/phpunit/src/Framework/CodeCoverageException.php new file mode 100644 index 0000000..298f5c4 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/CodeCoverageException.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +class CodeCoverageException extends Exception +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/ArrayHasKey.php b/vendor/phpunit/phpunit/src/Framework/Constraint/ArrayHasKey.php new file mode 100644 index 0000000..c60dd18 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/ArrayHasKey.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use ArrayAccess; + +/** + * Constraint that asserts that the array it is evaluated for has a given key. + * + * Uses array_key_exists() to check if the key is found in the input array, if + * not found the evaluation fails. + * + * The array key is passed in the constructor. + */ +class ArrayHasKey extends Constraint +{ + /** + * @var int|string + */ + private $key; + + /** + * @param int|string $key + */ + public function __construct($key) + { + parent::__construct(); + $this->key = $key; + } + + /** + * Returns a string representation of the constraint. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function toString(): string + { + return 'has the key ' . $this->exporter->export($this->key); + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + if (\is_array($other)) { + return \array_key_exists($this->key, $other); + } + + if ($other instanceof ArrayAccess) { + return $other->offsetExists($this->key); + } + + return false; + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + protected function failureDescription($other): string + { + return 'an array ' . $this->toString(); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/ArraySubset.php b/vendor/phpunit/phpunit/src/Framework/Constraint/ArraySubset.php new file mode 100644 index 0000000..cd2de06 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/ArraySubset.php @@ -0,0 +1,131 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; +use SebastianBergmann\Comparator\ComparisonFailure; + +/** + * Constraint that asserts that the array it is evaluated for has a specified subset. + * + * Uses array_replace_recursive() to check if a key value subset is part of the + * subject array. + */ +class ArraySubset extends Constraint +{ + /** + * @var iterable + */ + private $subset; + + /** + * @var bool + */ + private $strict; + + public function __construct(iterable $subset, bool $strict = false) + { + parent::__construct(); + + $this->strict = $strict; + $this->subset = $subset; + } + + /** + * Evaluates the constraint for parameter $other + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @param mixed $other value or object to evaluate + * @param string $description Additional information about the test + * @param bool $returnResult Whether to return a result or throw an exception + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function evaluate($other, $description = '', $returnResult = false) + { + //type cast $other & $this->subset as an array to allow + //support in standard array functions. + $other = $this->toArray($other); + $this->subset = $this->toArray($this->subset); + + $patched = \array_replace_recursive($other, $this->subset); + + if ($this->strict) { + $result = $other === $patched; + } else { + $result = $other == $patched; + } + + if ($returnResult) { + return $result; + } + + if (!$result) { + $f = new ComparisonFailure( + $patched, + $other, + \var_export($patched, true), + \var_export($other, true) + ); + + $this->fail($other, $description, $f); + } + } + + /** + * Returns a string representation of the constraint. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function toString(): string + { + return 'has the subset ' . $this->exporter->export($this->subset); + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + protected function failureDescription($other): string + { + return 'an array ' . $this->toString(); + } + + private function toArray(iterable $other): array + { + if (\is_array($other)) { + return $other; + } + + if ($other instanceof \ArrayObject) { + return $other->getArrayCopy(); + } + + if ($other instanceof \Traversable) { + return \iterator_to_array($other); + } + + // Keep BC even if we know that array would not be the expected one + return (array) $other; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/Attribute.php b/vendor/phpunit/phpunit/src/Framework/Constraint/Attribute.php new file mode 100644 index 0000000..36321f3 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/Attribute.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use PHPUnit\Framework\Assert; +use PHPUnit\Framework\ExpectationFailedException; + +class Attribute extends Composite +{ + /** + * @var string + */ + private $attributeName; + + public function __construct(Constraint $constraint, string $attributeName) + { + parent::__construct($constraint); + + $this->attributeName = $attributeName; + } + + /** + * Evaluates the constraint for parameter $other + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @param mixed $other value or object to evaluate + * @param string $description Additional information about the test + * @param bool $returnResult Whether to return a result or throw an exception + * + * @throws ExpectationFailedException + * @throws \PHPUnit\Framework\Exception + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function evaluate($other, $description = '', $returnResult = false) + { + return parent::evaluate( + Assert::readAttribute( + $other, + $this->attributeName + ), + $description, + $returnResult + ); + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'attribute "' . $this->attributeName . '" ' . $this->innerConstraint()->toString(); + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + return $this->toString(); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/Callback.php b/vendor/phpunit/phpunit/src/Framework/Constraint/Callback.php new file mode 100644 index 0000000..489d804 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/Callback.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that evaluates against a specified closure. + */ +class Callback extends Constraint +{ + /** + * @var callable + */ + private $callback; + + public function __construct(callable $callback) + { + parent::__construct(); + + $this->callback = $callback; + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'is accepted by specified callback'; + } + + /** + * Evaluates the constraint for parameter $value. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return \call_user_func($this->callback, $other); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasAttribute.php b/vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasAttribute.php new file mode 100644 index 0000000..fb70d5b --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasAttribute.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use ReflectionClass; + +/** + * Constraint that asserts that the class it is evaluated for has a given + * attribute. + * + * The attribute name is passed in the constructor. + */ +class ClassHasAttribute extends Constraint +{ + /** + * @var string + */ + private $attributeName; + + public function __construct(string $attributeName) + { + parent::__construct(); + + $this->attributeName = $attributeName; + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return \sprintf( + 'has attribute "%s"', + $this->attributeName + ); + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + $class = new ReflectionClass($other); + + return $class->hasProperty($this->attributeName); + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + return \sprintf( + '%sclass "%s" %s', + \is_object($other) ? 'object of ' : '', + \is_object($other) ? \get_class($other) : $other, + $this->toString() + ); + } + + protected function attributeName(): string + { + return $this->attributeName; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasStaticAttribute.php b/vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasStaticAttribute.php new file mode 100644 index 0000000..b68d070 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/ClassHasStaticAttribute.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use ReflectionClass; + +/** + * Constraint that asserts that the class it is evaluated for has a given + * static attribute. + * + * The attribute name is passed in the constructor. + */ +class ClassHasStaticAttribute extends ClassHasAttribute +{ + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return \sprintf( + 'has static attribute "%s"', + $this->attributeName() + ); + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + $class = new ReflectionClass($other); + + if ($class->hasProperty($this->attributeName())) { + $attribute = $class->getProperty($this->attributeName()); + + return $attribute->isStatic(); + } + + return false; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/Composite.php b/vendor/phpunit/phpunit/src/Framework/Constraint/Composite.php new file mode 100644 index 0000000..3b19df3 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/Composite.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; + +abstract class Composite extends Constraint +{ + /** + * @var Constraint + */ + private $innerConstraint; + + public function __construct(Constraint $innerConstraint) + { + parent::__construct(); + + $this->innerConstraint = $innerConstraint; + } + + /** + * Evaluates the constraint for parameter $other + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @param mixed $other value or object to evaluate + * @param string $description Additional information about the test + * @param bool $returnResult Whether to return a result or throw an exception + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function evaluate($other, $description = '', $returnResult = false) + { + try { + return $this->innerConstraint->evaluate( + $other, + $description, + $returnResult + ); + } catch (ExpectationFailedException $e) { + $this->fail($other, $description, $e->getComparisonFailure()); + } + } + + /** + * Counts the number of constraint elements. + */ + public function count(): int + { + return \count($this->innerConstraint); + } + + protected function innerConstraint(): Constraint + { + return $this->innerConstraint; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php b/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php new file mode 100644 index 0000000..175557d --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php @@ -0,0 +1,148 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use Countable; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\SelfDescribing; +use SebastianBergmann\Comparator\ComparisonFailure; +use SebastianBergmann\Exporter\Exporter; + +/** + * Abstract base class for constraints which can be applied to any value. + */ +abstract class Constraint implements Countable, SelfDescribing +{ + protected $exporter; + + public function __construct() + { + $this->exporter = new Exporter; + } + + /** + * Evaluates the constraint for parameter $other + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @param mixed $other value or object to evaluate + * @param string $description Additional information about the test + * @param bool $returnResult Whether to return a result or throw an exception + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function evaluate($other, $description = '', $returnResult = false) + { + $success = false; + + if ($this->matches($other)) { + $success = true; + } + + if ($returnResult) { + return $success; + } + + if (!$success) { + $this->fail($other, $description); + } + } + + /** + * Counts the number of constraint elements. + */ + public function count(): int + { + return 1; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * This method can be overridden to implement the evaluation algorithm. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return false; + } + + /** + * Throws an exception for the given compared value and test description + * + * @param mixed $other evaluated value or object + * @param string $description Additional information about the test + * @param ComparisonFailure $comparisonFailure + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + protected function fail($other, $description, ComparisonFailure $comparisonFailure = null): void + { + $failureDescription = \sprintf( + 'Failed asserting that %s.', + $this->failureDescription($other) + ); + + $additionalFailureDescription = $this->additionalFailureDescription($other); + + if ($additionalFailureDescription) { + $failureDescription .= "\n" . $additionalFailureDescription; + } + + if (!empty($description)) { + $failureDescription = $description . "\n" . $failureDescription; + } + + throw new ExpectationFailedException( + $failureDescription, + $comparisonFailure + ); + } + + /** + * Return additional failure description where needed + * + * The function can be overridden to provide additional failure + * information like a diff + * + * @param mixed $other evaluated value or object + */ + protected function additionalFailureDescription($other): string + { + return ''; + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * To provide additional failure information additionalFailureDescription + * can be used. + * + * @param mixed $other evaluated value or object + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + protected function failureDescription($other): string + { + return $this->exporter->export($other) . ' ' . $this->toString(); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/Count.php b/vendor/phpunit/phpunit/src/Framework/Constraint/Count.php new file mode 100644 index 0000000..7aeb2d7 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/Count.php @@ -0,0 +1,119 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use Countable; +use Generator; +use Iterator; +use IteratorAggregate; +use Traversable; + +class Count extends Constraint +{ + /** + * @var int + */ + private $expectedCount; + + public function __construct(int $expected) + { + parent::__construct(); + + $this->expectedCount = $expected; + } + + public function toString(): string + { + return \sprintf( + 'count matches %d', + $this->expectedCount + ); + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + */ + protected function matches($other): bool + { + return $this->expectedCount === $this->getCountOf($other); + } + + /** + * @param iterable $other + */ + protected function getCountOf($other): ?int + { + if ($other instanceof Countable || \is_array($other)) { + return \count($other); + } + + if ($other instanceof Traversable) { + while ($other instanceof IteratorAggregate) { + $other = $other->getIterator(); + } + + $iterator = $other; + + if ($iterator instanceof Generator) { + return $this->getCountOfGenerator($iterator); + } + + if (!$iterator instanceof Iterator) { + return \iterator_count($iterator); + } + + $key = $iterator->key(); + $count = \iterator_count($iterator); + + // Manually rewind $iterator to previous key, since iterator_count + // moves pointer. + if ($key !== null) { + $iterator->rewind(); + + while ($iterator->valid() && $key !== $iterator->key()) { + $iterator->next(); + } + } + + return $count; + } + } + + /** + * Returns the total number of iterations from a generator. + * This will fully exhaust the generator. + */ + protected function getCountOfGenerator(Generator $generator): int + { + for ($count = 0; $generator->valid(); $generator->next()) { + ++$count; + } + + return $count; + } + + /** + * Returns the description of the failure. + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + return \sprintf( + 'actual size %d matches expected size %d', + $this->getCountOf($other), + $this->expectedCount + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/DirectoryExists.php b/vendor/phpunit/phpunit/src/Framework/Constraint/DirectoryExists.php new file mode 100644 index 0000000..09f1f4a --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/DirectoryExists.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that checks if the directory(name) that it is evaluated for exists. + * + * The file path to check is passed as $other in evaluate(). + */ +class DirectoryExists extends Constraint +{ + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'directory exists'; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return \is_dir($other); + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + return \sprintf( + 'directory "%s" exists', + $other + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/Exception.php b/vendor/phpunit/phpunit/src/Framework/Constraint/Exception.php new file mode 100644 index 0000000..7e0c021 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/Exception.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use PHPUnit\Util\Filter; +use Throwable; + +class Exception extends Constraint +{ + /** + * @var string + */ + private $className; + + public function __construct(string $className) + { + parent::__construct(); + + $this->className = $className; + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return \sprintf( + 'exception of type "%s"', + $this->className + ); + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return $other instanceof $this->className; + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + if ($other !== null) { + $message = ''; + + if ($other instanceof Throwable) { + $message = '. Message was: "' . $other->getMessage() . '" at' + . "\n" . Filter::getFilteredStacktrace($other); + } + + return \sprintf( + 'exception of type "%s" matches expected exception "%s"%s', + \get_class($other), + $this->className, + $message + ); + } + + return \sprintf( + 'exception of type "%s" is thrown', + $this->className + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/ExceptionCode.php b/vendor/phpunit/phpunit/src/Framework/Constraint/ExceptionCode.php new file mode 100644 index 0000000..6cb2ac0 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/ExceptionCode.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +class ExceptionCode extends Constraint +{ + /** + * @var int|string + */ + private $expectedCode; + + /** + * @param int|string $expected + */ + public function __construct($expected) + { + parent::__construct(); + + $this->expectedCode = $expected; + } + + public function toString(): string + { + return 'exception code is '; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param \Throwable $other + */ + protected function matches($other): bool + { + return (string) $other->getCode() === (string) $this->expectedCode; + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + protected function failureDescription($other): string + { + return \sprintf( + '%s is equal to expected exception code %s', + $this->exporter->export($other->getCode()), + $this->exporter->export($this->expectedCode) + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/ExceptionMessage.php b/vendor/phpunit/phpunit/src/Framework/Constraint/ExceptionMessage.php new file mode 100644 index 0000000..299d512 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/ExceptionMessage.php @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +class ExceptionMessage extends Constraint +{ + /** + * @var string + */ + private $expectedMessage; + + public function __construct(string $expected) + { + parent::__construct(); + + $this->expectedMessage = $expected; + } + + public function toString(): string + { + if ($this->expectedMessage === '') { + return 'exception message is empty'; + } + + return 'exception message contains '; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param \Throwable $other + */ + protected function matches($other): bool + { + if ($this->expectedMessage === '') { + return $other->getMessage() === ''; + } + + return \strpos($other->getMessage(), $this->expectedMessage) !== false; + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + if ($this->expectedMessage === '') { + return \sprintf( + "exception message is empty but is '%s'", + $other->getMessage() + ); + } + + return \sprintf( + "exception message '%s' contains '%s'", + $other->getMessage(), + $this->expectedMessage + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/ExceptionMessageRegularExpression.php b/vendor/phpunit/phpunit/src/Framework/Constraint/ExceptionMessageRegularExpression.php new file mode 100644 index 0000000..63f323a --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/ExceptionMessageRegularExpression.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use PHPUnit\Util\RegularExpression as RegularExpressionUtil; + +class ExceptionMessageRegularExpression extends Constraint +{ + /** + * @var string + */ + private $expectedMessageRegExp; + + public function __construct(string $expected) + { + parent::__construct(); + + $this->expectedMessageRegExp = $expected; + } + + public function toString(): string + { + return 'exception message matches '; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param \PHPUnit\Framework\Exception $other + * + * @throws \Exception + * @throws \PHPUnit\Framework\Exception + */ + protected function matches($other): bool + { + $match = RegularExpressionUtil::safeMatch($this->expectedMessageRegExp, $other->getMessage()); + + if ($match === false) { + throw new \PHPUnit\Framework\Exception( + "Invalid expected exception message regex given: '{$this->expectedMessageRegExp}'" + ); + } + + return $match === 1; + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + return \sprintf( + "exception message '%s' matches '%s'", + $other->getMessage(), + $this->expectedMessageRegExp + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/FileExists.php b/vendor/phpunit/phpunit/src/Framework/Constraint/FileExists.php new file mode 100644 index 0000000..35e2962 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/FileExists.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that checks if the file(name) that it is evaluated for exists. + * + * The file path to check is passed as $other in evaluate(). + */ +class FileExists extends Constraint +{ + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'file exists'; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return \file_exists($other); + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + return \sprintf( + 'file "%s" exists', + $other + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/GreaterThan.php b/vendor/phpunit/phpunit/src/Framework/Constraint/GreaterThan.php new file mode 100644 index 0000000..890e13d --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/GreaterThan.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that asserts that the value it is evaluated for is greater + * than a given value. + */ +class GreaterThan extends Constraint +{ + /** + * @var float|int + */ + private $value; + + /** + * @param float|int $value + */ + public function __construct($value) + { + parent::__construct(); + + $this->value = $value; + } + + /** + * Returns a string representation of the constraint. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function toString(): string + { + return 'is greater than ' . $this->exporter->export($this->value); + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return $this->value < $other; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/IsAnything.php b/vendor/phpunit/phpunit/src/Framework/Constraint/IsAnything.php new file mode 100644 index 0000000..526cc37 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/IsAnything.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; + +/** + * Constraint that accepts any input value. + */ +class IsAnything extends Constraint +{ + /** + * Evaluates the constraint for parameter $other + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @param mixed $other value or object to evaluate + * @param string $description Additional information about the test + * @param bool $returnResult Whether to return a result or throw an exception + * + * @throws ExpectationFailedException + */ + public function evaluate($other, $description = '', $returnResult = false) + { + return $returnResult ? true : null; + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'is anything'; + } + + /** + * Counts the number of constraint elements. + */ + public function count(): int + { + return 0; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/IsEmpty.php b/vendor/phpunit/phpunit/src/Framework/Constraint/IsEmpty.php new file mode 100644 index 0000000..0eb89ce --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/IsEmpty.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use Countable; + +/** + * Constraint that checks whether a variable is empty(). + */ +class IsEmpty extends Constraint +{ + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'is empty'; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + if ($other instanceof Countable) { + return \count($other) === 0; + } + + return empty($other); + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + $type = \gettype($other); + + return \sprintf( + '%s %s %s', + $type[0] == 'a' || $type[0] == 'o' ? 'an' : 'a', + $type, + $this->toString() + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/IsEqual.php b/vendor/phpunit/phpunit/src/Framework/Constraint/IsEqual.php new file mode 100644 index 0000000..0cc999e --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/IsEqual.php @@ -0,0 +1,150 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; +use SebastianBergmann\Comparator\ComparisonFailure; +use SebastianBergmann\Comparator\Factory as ComparatorFactory; + +/** + * Constraint that checks if one value is equal to another. + * + * Equality is checked with PHP's == operator, the operator is explained in + * detail at {@url https://php.net/manual/en/types.comparisons.php}. + * Two values are equal if they have the same value disregarding type. + * + * The expected value is passed in the constructor. + */ +class IsEqual extends Constraint +{ + /** + * @var mixed + */ + private $value; + + /** + * @var float + */ + private $delta; + + /** + * @var int + */ + private $maxDepth; + + /** + * @var bool + */ + private $canonicalize; + + /** + * @var bool + */ + private $ignoreCase; + + public function __construct($value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false) + { + parent::__construct(); + + $this->value = $value; + $this->delta = $delta; + $this->maxDepth = $maxDepth; + $this->canonicalize = $canonicalize; + $this->ignoreCase = $ignoreCase; + } + + /** + * Evaluates the constraint for parameter $other + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @param mixed $other value or object to evaluate + * @param string $description Additional information about the test + * @param bool $returnResult Whether to return a result or throw an exception + * + * @throws ExpectationFailedException + */ + public function evaluate($other, $description = '', $returnResult = false) + { + // If $this->value and $other are identical, they are also equal. + // This is the most common path and will allow us to skip + // initialization of all the comparators. + if ($this->value === $other) { + return true; + } + + $comparatorFactory = ComparatorFactory::getInstance(); + + try { + $comparator = $comparatorFactory->getComparatorFor( + $this->value, + $other + ); + + $comparator->assertEquals( + $this->value, + $other, + $this->delta, + $this->canonicalize, + $this->ignoreCase + ); + } catch (ComparisonFailure $f) { + if ($returnResult) { + return false; + } + + throw new ExpectationFailedException( + \trim($description . "\n" . $f->getMessage()), + $f + ); + } + + return true; + } + + /** + * Returns a string representation of the constraint. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function toString(): string + { + $delta = ''; + + if (\is_string($this->value)) { + if (\strpos($this->value, "\n") !== false) { + return 'is equal to '; + } + + return \sprintf( + "is equal to '%s'", + $this->value + ); + } + + if ($this->delta != 0) { + $delta = \sprintf( + ' with delta <%F>', + $this->delta + ); + } + + return \sprintf( + 'is equal to %s%s', + $this->exporter->export($this->value), + $delta + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/IsFalse.php b/vendor/phpunit/phpunit/src/Framework/Constraint/IsFalse.php new file mode 100644 index 0000000..82858a7 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/IsFalse.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that accepts false. + */ +class IsFalse extends Constraint +{ + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'is false'; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return $other === false; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/IsFinite.php b/vendor/phpunit/phpunit/src/Framework/Constraint/IsFinite.php new file mode 100644 index 0000000..3d36900 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/IsFinite.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that accepts finite. + */ +class IsFinite extends Constraint +{ + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'is finite'; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return \is_finite($other); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/IsIdentical.php b/vendor/phpunit/phpunit/src/Framework/Constraint/IsIdentical.php new file mode 100644 index 0000000..c4362f0 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/IsIdentical.php @@ -0,0 +1,144 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; +use SebastianBergmann\Comparator\ComparisonFailure; + +/** + * Constraint that asserts that one value is identical to another. + * + * Identical check is performed with PHP's === operator, the operator is + * explained in detail at + * {@url https://php.net/manual/en/types.comparisons.php}. + * Two values are identical if they have the same value and are of the same + * type. + * + * The expected value is passed in the constructor. + */ +class IsIdentical extends Constraint +{ + /** + * @var float + */ + private const EPSILON = 0.0000000001; + + /** + * @var mixed + */ + private $value; + + public function __construct($value) + { + parent::__construct(); + + $this->value = $value; + } + + /** + * Evaluates the constraint for parameter $other + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @param mixed $other value or object to evaluate + * @param string $description Additional information about the test + * @param bool $returnResult Whether to return a result or throw an exception + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function evaluate($other, $description = '', $returnResult = false) + { + if (\is_float($this->value) && \is_float($other) && + !\is_infinite($this->value) && !\is_infinite($other) && + !\is_nan($this->value) && !\is_nan($other)) { + $success = \abs($this->value - $other) < self::EPSILON; + } else { + $success = $this->value === $other; + } + + if ($returnResult) { + return $success; + } + + if (!$success) { + $f = null; + + // if both values are strings, make sure a diff is generated + if (\is_string($this->value) && \is_string($other)) { + $f = new ComparisonFailure( + $this->value, + $other, + \sprintf("'%s'", $this->value), + \sprintf("'%s'", $other) + ); + } + + // if both values are array, make sure a diff is generated + if (\is_array($this->value) && \is_array($other)) { + $f = new ComparisonFailure( + $this->value, + $other, + $this->exporter->export($this->value), + $this->exporter->export($other) + ); + } + + $this->fail($other, $description, $f); + } + } + + /** + * Returns a string representation of the constraint. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function toString(): string + { + if (\is_object($this->value)) { + return 'is identical to an object of class "' . + \get_class($this->value) . '"'; + } + + return 'is identical to ' . $this->exporter->export($this->value); + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + protected function failureDescription($other): string + { + if (\is_object($this->value) && \is_object($other)) { + return 'two variables reference the same object'; + } + + if (\is_string($this->value) && \is_string($other)) { + return 'two strings are identical'; + } + + if (\is_array($this->value) && \is_array($other)) { + return 'two arrays are identical'; + } + + return parent::failureDescription($other); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/IsInfinite.php b/vendor/phpunit/phpunit/src/Framework/Constraint/IsInfinite.php new file mode 100644 index 0000000..8ac16d2 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/IsInfinite.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that accepts infinite. + */ +class IsInfinite extends Constraint +{ + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'is infinite'; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return \is_infinite($other); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/IsInstanceOf.php b/vendor/phpunit/phpunit/src/Framework/Constraint/IsInstanceOf.php new file mode 100644 index 0000000..b7c70ff --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/IsInstanceOf.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use ReflectionClass; +use ReflectionException; + +/** + * Constraint that asserts that the object it is evaluated for is an instance + * of a given class. + * + * The expected class name is passed in the constructor. + */ +class IsInstanceOf extends Constraint +{ + /** + * @var string + */ + private $className; + + public function __construct(string $className) + { + parent::__construct(); + + $this->className = $className; + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return \sprintf( + 'is instance of %s "%s"', + $this->getType(), + $this->className + ); + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return $other instanceof $this->className; + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + protected function failureDescription($other): string + { + return \sprintf( + '%s is an instance of %s "%s"', + $this->exporter->shortenedExport($other), + $this->getType(), + $this->className + ); + } + + private function getType(): string + { + try { + $reflection = new ReflectionClass($this->className); + + if ($reflection->isInterface()) { + return 'interface'; + } + } catch (ReflectionException $e) { + } + + return 'class'; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/IsJson.php b/vendor/phpunit/phpunit/src/Framework/Constraint/IsJson.php new file mode 100644 index 0000000..ad06ec1 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/IsJson.php @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that asserts that a string is valid JSON. + */ +class IsJson extends Constraint +{ + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'is valid JSON'; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + if ($other === '') { + return false; + } + + \json_decode($other); + + if (\json_last_error()) { + return false; + } + + return true; + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + protected function failureDescription($other): string + { + if ($other === '') { + return 'an empty string is valid JSON'; + } + + \json_decode($other); + $error = JsonMatchesErrorMessageProvider::determineJsonError( + \json_last_error() + ); + + return \sprintf( + '%s is valid JSON (%s)', + $this->exporter->shortenedExport($other), + $error + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/IsNan.php b/vendor/phpunit/phpunit/src/Framework/Constraint/IsNan.php new file mode 100644 index 0000000..2a62b61 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/IsNan.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that accepts nan. + */ +class IsNan extends Constraint +{ + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'is nan'; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return \is_nan($other); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/IsNull.php b/vendor/phpunit/phpunit/src/Framework/Constraint/IsNull.php new file mode 100644 index 0000000..620eae2 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/IsNull.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that accepts null. + */ +class IsNull extends Constraint +{ + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'is null'; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return $other === null; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/IsReadable.php b/vendor/phpunit/phpunit/src/Framework/Constraint/IsReadable.php new file mode 100644 index 0000000..bdc8ca3 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/IsReadable.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that checks if the file/dir(name) that it is evaluated for is readable. + * + * The file path to check is passed as $other in evaluate(). + */ +class IsReadable extends Constraint +{ + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'is readable'; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return \is_readable($other); + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + return \sprintf( + '"%s" is readable', + $other + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/IsTrue.php b/vendor/phpunit/phpunit/src/Framework/Constraint/IsTrue.php new file mode 100644 index 0000000..c0a4756 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/IsTrue.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that accepts true. + */ +class IsTrue extends Constraint +{ + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'is true'; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return $other === true; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/IsType.php b/vendor/phpunit/phpunit/src/Framework/Constraint/IsType.php new file mode 100644 index 0000000..4f68477 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/IsType.php @@ -0,0 +1,152 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that asserts that the value it is evaluated for is of a + * specified type. + * + * The expected value is passed in the constructor. + */ +class IsType extends Constraint +{ + public const TYPE_ARRAY = 'array'; + + public const TYPE_BOOL = 'bool'; + + public const TYPE_FLOAT = 'float'; + + public const TYPE_INT = 'int'; + + public const TYPE_NULL = 'null'; + + public const TYPE_NUMERIC = 'numeric'; + + public const TYPE_OBJECT = 'object'; + + public const TYPE_RESOURCE = 'resource'; + + public const TYPE_STRING = 'string'; + + public const TYPE_SCALAR = 'scalar'; + + public const TYPE_CALLABLE = 'callable'; + + public const TYPE_ITERABLE = 'iterable'; + + /** + * @var array + */ + private const KNOWN_TYPES = [ + 'array' => true, + 'boolean' => true, + 'bool' => true, + 'double' => true, + 'float' => true, + 'integer' => true, + 'int' => true, + 'null' => true, + 'numeric' => true, + 'object' => true, + 'real' => true, + 'resource' => true, + 'string' => true, + 'scalar' => true, + 'callable' => true, + 'iterable' => true, + ]; + + /** + * @var string + */ + private $type; + + /** + * @throws \PHPUnit\Framework\Exception + */ + public function __construct(string $type) + { + parent::__construct(); + + if (!isset(self::KNOWN_TYPES[$type])) { + throw new \PHPUnit\Framework\Exception( + \sprintf( + 'Type specified for PHPUnit\Framework\Constraint\IsType <%s> ' . + 'is not a valid type.', + $type + ) + ); + } + + $this->type = $type; + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return \sprintf( + 'is of type "%s"', + $this->type + ); + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + switch ($this->type) { + case 'numeric': + return \is_numeric($other); + + case 'integer': + case 'int': + return \is_int($other); + + case 'double': + case 'float': + case 'real': + return \is_float($other); + + case 'string': + return \is_string($other); + + case 'boolean': + case 'bool': + return \is_bool($other); + + case 'null': + return null === $other; + + case 'array': + return \is_array($other); + + case 'object': + return \is_object($other); + + case 'resource': + return \is_resource($other) || \is_string(@\get_resource_type($other)); + + case 'scalar': + return \is_scalar($other); + + case 'callable': + return \is_callable($other); + + case 'iterable': + return \is_iterable($other); + } + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/IsWritable.php b/vendor/phpunit/phpunit/src/Framework/Constraint/IsWritable.php new file mode 100644 index 0000000..f19cea9 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/IsWritable.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that checks if the file/dir(name) that it is evaluated for is writable. + * + * The file path to check is passed as $other in evaluate(). + */ +class IsWritable extends Constraint +{ + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'is writable'; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return \is_writable($other); + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + */ + protected function failureDescription($other): string + { + return \sprintf( + '"%s" is writable', + $other + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/JsonMatches.php b/vendor/phpunit/phpunit/src/Framework/Constraint/JsonMatches.php new file mode 100644 index 0000000..2246199 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/JsonMatches.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Util\Json; +use SebastianBergmann\Comparator\ComparisonFailure; + +/** + * Asserts whether or not two JSON objects are equal. + */ +class JsonMatches extends Constraint +{ + /** + * @var string + */ + private $value; + + public function __construct(string $value) + { + parent::__construct(); + + $this->value = $value; + } + + /** + * Returns a string representation of the object. + */ + public function toString(): string + { + return \sprintf( + 'matches JSON string "%s"', + $this->value + ); + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * This method can be overridden to implement the evaluation algorithm. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + [$error, $recodedOther] = Json::canonicalize($other); + + if ($error) { + return false; + } + + [$error, $recodedValue] = Json::canonicalize($this->value); + + if ($error) { + return false; + } + + return $recodedOther == $recodedValue; + } + + /** + * Throws an exception for the given compared value and test description + * + * @param mixed $other evaluated value or object + * @param string $description Additional information about the test + * @param ComparisonFailure $comparisonFailure + * + * @throws ExpectationFailedException + * @throws \PHPUnit\Framework\Exception + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + protected function fail($other, $description, ComparisonFailure $comparisonFailure = null): void + { + if ($comparisonFailure === null) { + [$error] = Json::canonicalize($other); + + if ($error) { + parent::fail($other, $description); + + return; + } + + [$error] = Json::canonicalize($this->value); + + if ($error) { + parent::fail($other, $description); + + return; + } + + $comparisonFailure = new ComparisonFailure( + \json_decode($this->value), + \json_decode($other), + Json::prettify($this->value), + Json::prettify($other), + false, + 'Failed asserting that two json values are equal.' + ); + } + + parent::fail($other, $description, $comparisonFailure); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/JsonMatchesErrorMessageProvider.php b/vendor/phpunit/phpunit/src/Framework/Constraint/JsonMatchesErrorMessageProvider.php new file mode 100644 index 0000000..9b3659a --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/JsonMatchesErrorMessageProvider.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Provides human readable messages for each JSON error. + */ +class JsonMatchesErrorMessageProvider +{ + /** + * Translates JSON error to a human readable string. + */ + public static function determineJsonError(string $error, string $prefix = ''): ?string + { + switch ($error) { + case \JSON_ERROR_NONE: + return null; + case \JSON_ERROR_DEPTH: + return $prefix . 'Maximum stack depth exceeded'; + case \JSON_ERROR_STATE_MISMATCH: + return $prefix . 'Underflow or the modes mismatch'; + case \JSON_ERROR_CTRL_CHAR: + return $prefix . 'Unexpected control character found'; + case \JSON_ERROR_SYNTAX: + return $prefix . 'Syntax error, malformed JSON'; + case \JSON_ERROR_UTF8: + return $prefix . 'Malformed UTF-8 characters, possibly incorrectly encoded'; + default: + return $prefix . 'Unknown error'; + } + } + + /** + * Translates a given type to a human readable message prefix. + */ + public static function translateTypeToPrefix(string $type): string + { + switch (\strtolower($type)) { + case 'expected': + $prefix = 'Expected value JSON decode error - '; + + break; + case 'actual': + $prefix = 'Actual value JSON decode error - '; + + break; + default: + $prefix = ''; + + break; + } + + return $prefix; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/LessThan.php b/vendor/phpunit/phpunit/src/Framework/Constraint/LessThan.php new file mode 100644 index 0000000..8e8d9e5 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/LessThan.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that asserts that the value it is evaluated for is less than + * a given value. + */ +class LessThan extends Constraint +{ + /** + * @var float|int + */ + private $value; + + /** + * @param float|int $value + */ + public function __construct($value) + { + parent::__construct(); + + $this->value = $value; + } + + /** + * Returns a string representation of the constraint. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function toString(): string + { + return 'is less than ' . $this->exporter->export($this->value); + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return $this->value > $other; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/LogicalAnd.php b/vendor/phpunit/phpunit/src/Framework/Constraint/LogicalAnd.php new file mode 100644 index 0000000..fd7fa29 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/LogicalAnd.php @@ -0,0 +1,123 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; + +/** + * Logical AND. + */ +class LogicalAnd extends Constraint +{ + /** + * @var Constraint[] + */ + private $constraints = []; + + public static function fromConstraints(Constraint ...$constraints): self + { + $constraint = new self; + + $constraint->constraints = \array_values($constraints); + + return $constraint; + } + + /** + * @param Constraint[] $constraints + * + * @throws \PHPUnit\Framework\Exception + */ + public function setConstraints(array $constraints): void + { + $this->constraints = []; + + foreach ($constraints as $constraint) { + if (!($constraint instanceof Constraint)) { + throw new \PHPUnit\Framework\Exception( + 'All parameters to ' . __CLASS__ . + ' must be a constraint object.' + ); + } + + $this->constraints[] = $constraint; + } + } + + /** + * Evaluates the constraint for parameter $other + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @param mixed $other value or object to evaluate + * @param string $description Additional information about the test + * @param bool $returnResult Whether to return a result or throw an exception + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function evaluate($other, $description = '', $returnResult = false) + { + $success = true; + + foreach ($this->constraints as $constraint) { + if (!$constraint->evaluate($other, $description, true)) { + $success = false; + + break; + } + } + + if ($returnResult) { + return $success; + } + + if (!$success) { + $this->fail($other, $description); + } + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + $text = ''; + + foreach ($this->constraints as $key => $constraint) { + if ($key > 0) { + $text .= ' and '; + } + + $text .= $constraint->toString(); + } + + return $text; + } + + /** + * Counts the number of constraint elements. + */ + public function count(): int + { + $count = 0; + + foreach ($this->constraints as $constraint) { + $count += \count($constraint); + } + + return $count; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/LogicalNot.php b/vendor/phpunit/phpunit/src/Framework/Constraint/LogicalNot.php new file mode 100644 index 0000000..0d3b001 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/LogicalNot.php @@ -0,0 +1,171 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; + +/** + * Logical NOT. + */ +class LogicalNot extends Constraint +{ + /** + * @var Constraint + */ + private $constraint; + + public static function negate(string $string): string + { + $positives = [ + 'contains ', + 'exists', + 'has ', + 'is ', + 'are ', + 'matches ', + 'starts with ', + 'ends with ', + 'reference ', + 'not not ', + ]; + + $negatives = [ + 'does not contain ', + 'does not exist', + 'does not have ', + 'is not ', + 'are not ', + 'does not match ', + 'starts not with ', + 'ends not with ', + 'don\'t reference ', + 'not ', + ]; + + \preg_match('/(\'[\w\W]*\')([\w\W]*)("[\w\W]*")/i', $string, $matches); + + if (\count($matches) > 0) { + $nonInput = $matches[2]; + + $negatedString = \str_replace( + $nonInput, + \str_replace( + $positives, + $negatives, + $nonInput + ), + $string + ); + } else { + $negatedString = \str_replace( + $positives, + $negatives, + $string + ); + } + + return $negatedString; + } + + /** + * @param Constraint|mixed $constraint + */ + public function __construct($constraint) + { + parent::__construct(); + + if (!($constraint instanceof Constraint)) { + $constraint = new IsEqual($constraint); + } + + $this->constraint = $constraint; + } + + /** + * Evaluates the constraint for parameter $other + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @param mixed $other value or object to evaluate + * @param string $description Additional information about the test + * @param bool $returnResult Whether to return a result or throw an exception + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function evaluate($other, $description = '', $returnResult = false) + { + $success = !$this->constraint->evaluate($other, $description, true); + + if ($returnResult) { + return $success; + } + + if (!$success) { + $this->fail($other, $description); + } + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + switch (\get_class($this->constraint)) { + case LogicalAnd::class: + case self::class: + case LogicalOr::class: + return 'not( ' . $this->constraint->toString() . ' )'; + + default: + return self::negate( + $this->constraint->toString() + ); + } + } + + /** + * Counts the number of constraint elements. + */ + public function count(): int + { + return \count($this->constraint); + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + protected function failureDescription($other): string + { + switch (\get_class($this->constraint)) { + case LogicalAnd::class: + case self::class: + case LogicalOr::class: + return 'not( ' . $this->constraint->failureDescription($other) . ' )'; + + default: + return self::negate( + $this->constraint->failureDescription($other) + ); + } + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/LogicalOr.php b/vendor/phpunit/phpunit/src/Framework/Constraint/LogicalOr.php new file mode 100644 index 0000000..dd1fda8 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/LogicalOr.php @@ -0,0 +1,120 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; + +/** + * Logical OR. + */ +class LogicalOr extends Constraint +{ + /** + * @var Constraint[] + */ + private $constraints = []; + + public static function fromConstraints(Constraint ...$constraints): self + { + $constraint = new self; + + $constraint->constraints = \array_values($constraints); + + return $constraint; + } + + /** + * @param Constraint[] $constraints + */ + public function setConstraints(array $constraints): void + { + $this->constraints = []; + + foreach ($constraints as $constraint) { + if (!($constraint instanceof Constraint)) { + $constraint = new IsEqual( + $constraint + ); + } + + $this->constraints[] = $constraint; + } + } + + /** + * Evaluates the constraint for parameter $other + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @param mixed $other value or object to evaluate + * @param string $description Additional information about the test + * @param bool $returnResult Whether to return a result or throw an exception + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function evaluate($other, $description = '', $returnResult = false) + { + $success = false; + + foreach ($this->constraints as $constraint) { + if ($constraint->evaluate($other, $description, true)) { + $success = true; + + break; + } + } + + if ($returnResult) { + return $success; + } + + if (!$success) { + $this->fail($other, $description); + } + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + $text = ''; + + foreach ($this->constraints as $key => $constraint) { + if ($key > 0) { + $text .= ' or '; + } + + $text .= $constraint->toString(); + } + + return $text; + } + + /** + * Counts the number of constraint elements. + */ + public function count(): int + { + $count = 0; + + foreach ($this->constraints as $constraint) { + $count += \count($constraint); + } + + return $count; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/LogicalXor.php b/vendor/phpunit/phpunit/src/Framework/Constraint/LogicalXor.php new file mode 100644 index 0000000..b8a2802 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/LogicalXor.php @@ -0,0 +1,125 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; + +/** + * Logical XOR. + */ +class LogicalXor extends Constraint +{ + /** + * @var Constraint[] + */ + private $constraints = []; + + public static function fromConstraints(Constraint ...$constraints): self + { + $constraint = new self; + + $constraint->constraints = \array_values($constraints); + + return $constraint; + } + + /** + * @param Constraint[] $constraints + */ + public function setConstraints(array $constraints): void + { + $this->constraints = []; + + foreach ($constraints as $constraint) { + if (!($constraint instanceof Constraint)) { + $constraint = new IsEqual( + $constraint + ); + } + + $this->constraints[] = $constraint; + } + } + + /** + * Evaluates the constraint for parameter $other + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @param mixed $other value or object to evaluate + * @param string $description Additional information about the test + * @param bool $returnResult Whether to return a result or throw an exception + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function evaluate($other, $description = '', $returnResult = false) + { + $success = true; + $lastResult = null; + + foreach ($this->constraints as $constraint) { + $result = $constraint->evaluate($other, $description, true); + + if ($result === $lastResult) { + $success = false; + + break; + } + + $lastResult = $result; + } + + if ($returnResult) { + return $success; + } + + if (!$success) { + $this->fail($other, $description); + } + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + $text = ''; + + foreach ($this->constraints as $key => $constraint) { + if ($key > 0) { + $text .= ' xor '; + } + + $text .= $constraint->toString(); + } + + return $text; + } + + /** + * Counts the number of constraint elements. + */ + public function count(): int + { + $count = 0; + + foreach ($this->constraints as $constraint) { + $count += \count($constraint); + } + + return $count; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/ObjectHasAttribute.php b/vendor/phpunit/phpunit/src/Framework/Constraint/ObjectHasAttribute.php new file mode 100644 index 0000000..15127c0 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/ObjectHasAttribute.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use ReflectionObject; + +/** + * Constraint that asserts that the object it is evaluated for has a given + * attribute. + * + * The attribute name is passed in the constructor. + */ +class ObjectHasAttribute extends ClassHasAttribute +{ + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + $object = new ReflectionObject($other); + + return $object->hasProperty($this->attributeName()); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/RegularExpression.php b/vendor/phpunit/phpunit/src/Framework/Constraint/RegularExpression.php new file mode 100644 index 0000000..cb1f665 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/RegularExpression.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that asserts that the string it is evaluated for matches + * a regular expression. + * + * Checks a given value using the Perl Compatible Regular Expression extension + * in PHP. The pattern is matched by executing preg_match(). + * + * The pattern string passed in the constructor. + */ +class RegularExpression extends Constraint +{ + /** + * @var string + */ + private $pattern; + + public function __construct(string $pattern) + { + parent::__construct(); + + $this->pattern = $pattern; + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return \sprintf( + 'matches PCRE pattern "%s"', + $this->pattern + ); + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return \preg_match($this->pattern, $other) > 0; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/SameSize.php b/vendor/phpunit/phpunit/src/Framework/Constraint/SameSize.php new file mode 100644 index 0000000..dc9b003 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/SameSize.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +class SameSize extends Count +{ + public function __construct(iterable $expected) + { + parent::__construct($this->getCountOf($expected)); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/StringContains.php b/vendor/phpunit/phpunit/src/Framework/Constraint/StringContains.php new file mode 100644 index 0000000..cc72c32 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/StringContains.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that asserts that the string it is evaluated for contains + * a given string. + * + * Uses mb_strpos() to find the position of the string in the input, if not + * found the evaluation fails. + * + * The sub-string is passed in the constructor. + */ +class StringContains extends Constraint +{ + /** + * @var string + */ + private $string; + + /** + * @var bool + */ + private $ignoreCase; + + public function __construct(string $string, bool $ignoreCase = false) + { + parent::__construct(); + + $this->string = $string; + $this->ignoreCase = $ignoreCase; + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + if ($this->ignoreCase) { + $string = \mb_strtolower($this->string); + } else { + $string = $this->string; + } + + return \sprintf( + 'contains "%s"', + $string + ); + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + if ('' === $this->string) { + return true; + } + + if ($this->ignoreCase) { + return \mb_stripos($other, $this->string) !== false; + } + + return \mb_strpos($other, $this->string) !== false; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/StringEndsWith.php b/vendor/phpunit/phpunit/src/Framework/Constraint/StringEndsWith.php new file mode 100644 index 0000000..d6118f6 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/StringEndsWith.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that asserts that the string it is evaluated for ends with a given + * suffix. + */ +class StringEndsWith extends Constraint +{ + /** + * @var string + */ + private $suffix; + + public function __construct(string $suffix) + { + parent::__construct(); + + $this->suffix = $suffix; + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'ends with "' . $this->suffix . '"'; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return \substr($other, 0 - \strlen($this->suffix)) == $this->suffix; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/StringMatchesFormatDescription.php b/vendor/phpunit/phpunit/src/Framework/Constraint/StringMatchesFormatDescription.php new file mode 100644 index 0000000..5b27e53 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/StringMatchesFormatDescription.php @@ -0,0 +1,103 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use SebastianBergmann\Diff\Differ; + +/** + * ... + */ +class StringMatchesFormatDescription extends RegularExpression +{ + /** + * @var string + */ + private $string; + + public function __construct(string $string) + { + parent::__construct( + $this->createPatternFromFormat( + $this->convertNewlines($string) + ) + ); + + $this->string = $string; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return parent::matches( + $this->convertNewlines($other) + ); + } + + protected function failureDescription($other): string + { + return 'string matches format description'; + } + + protected function additionalFailureDescription($other): string + { + $from = \explode("\n", $this->string); + $to = \explode("\n", $this->convertNewlines($other)); + + foreach ($from as $index => $line) { + if (isset($to[$index]) && $line !== $to[$index]) { + $line = $this->createPatternFromFormat($line); + + if (\preg_match($line, $to[$index]) > 0) { + $from[$index] = $to[$index]; + } + } + } + + $this->string = \implode("\n", $from); + $other = \implode("\n", $to); + + $differ = new Differ("--- Expected\n+++ Actual\n"); + + return $differ->diff($this->string, $other); + } + + private function createPatternFromFormat(string $string): string + { + $string = \strtr( + \preg_quote($string, '/'), + [ + '%%' => '%', + '%e' => '\\' . \DIRECTORY_SEPARATOR, + '%s' => '[^\r\n]+', + '%S' => '[^\r\n]*', + '%a' => '.+', + '%A' => '.*', + '%w' => '\s*', + '%i' => '[+-]?\d+', + '%d' => '\d+', + '%x' => '[0-9a-fA-F]+', + '%f' => '[+-]?\.?\d+\.?\d*(?:[Ee][+-]?\d+)?', + '%c' => '.', + ] + ); + + return '/^' . $string . '$/s'; + } + + private function convertNewlines($text): string + { + return \preg_replace('/\r\n/', "\n", $text); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/StringStartsWith.php b/vendor/phpunit/phpunit/src/Framework/Constraint/StringStartsWith.php new file mode 100644 index 0000000..96365ef --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/StringStartsWith.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +/** + * Constraint that asserts that the string it is evaluated for begins with a + * given prefix. + */ +class StringStartsWith extends Constraint +{ + /** + * @var string + */ + private $prefix; + + public function __construct(string $prefix) + { + parent::__construct(); + + $this->prefix = $prefix; + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'starts with "' . $this->prefix . '"'; + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + return \strpos($other, $this->prefix) === 0; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/TraversableContains.php b/vendor/phpunit/phpunit/src/Framework/Constraint/TraversableContains.php new file mode 100644 index 0000000..ace1c78 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/TraversableContains.php @@ -0,0 +1,116 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use SplObjectStorage; + +/** + * Constraint that asserts that the Traversable it is applied to contains + * a given value. + */ +class TraversableContains extends Constraint +{ + /** + * @var bool + */ + private $checkForObjectIdentity; + + /** + * @var bool + */ + private $checkForNonObjectIdentity; + + /** + * @var mixed + */ + private $value; + + /** + * @throws \PHPUnit\Framework\Exception + */ + public function __construct($value, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false) + { + parent::__construct(); + + $this->checkForObjectIdentity = $checkForObjectIdentity; + $this->checkForNonObjectIdentity = $checkForNonObjectIdentity; + $this->value = $value; + } + + /** + * Returns a string representation of the constraint. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function toString(): string + { + if (\is_string($this->value) && \strpos($this->value, "\n") !== false) { + return 'contains "' . $this->value . '"'; + } + + return 'contains ' . $this->exporter->export($this->value); + } + + /** + * Evaluates the constraint for parameter $other. Returns true if the + * constraint is met, false otherwise. + * + * @param mixed $other value or object to evaluate + */ + protected function matches($other): bool + { + if ($other instanceof SplObjectStorage) { + return $other->contains($this->value); + } + + if (\is_object($this->value)) { + foreach ($other as $element) { + if ($this->checkForObjectIdentity && $element === $this->value) { + return true; + } + + if (!$this->checkForObjectIdentity && $element == $this->value) { + return true; + } + } + } else { + foreach ($other as $element) { + if ($this->checkForNonObjectIdentity && $element === $this->value) { + return true; + } + + if (!$this->checkForNonObjectIdentity && $element == $this->value) { + return true; + } + } + } + + return false; + } + + /** + * Returns the description of the failure + * + * The beginning of failure messages is "Failed asserting that" in most + * cases. This method should return the second part of that sentence. + * + * @param mixed $other evaluated value or object + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + protected function failureDescription($other): string + { + return \sprintf( + '%s %s', + \is_array($other) ? 'an array' : 'a traversable', + $this->toString() + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Constraint/TraversableContainsOnly.php b/vendor/phpunit/phpunit/src/Framework/Constraint/TraversableContainsOnly.php new file mode 100644 index 0000000..20c5134 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Constraint/TraversableContainsOnly.php @@ -0,0 +1,93 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Constraint; + +use PHPUnit\Framework\ExpectationFailedException; + +/** + * Constraint that asserts that the Traversable it is applied to contains + * only values of a given type. + */ +class TraversableContainsOnly extends Constraint +{ + /** + * @var Constraint + */ + private $constraint; + + /** + * @var string + */ + private $type; + + /** + * @throws \PHPUnit\Framework\Exception + */ + public function __construct(string $type, bool $isNativeType = true) + { + parent::__construct(); + + if ($isNativeType) { + $this->constraint = new IsType($type); + } else { + $this->constraint = new IsInstanceOf( + $type + ); + } + + $this->type = $type; + } + + /** + * Evaluates the constraint for parameter $other + * + * If $returnResult is set to false (the default), an exception is thrown + * in case of a failure. null is returned otherwise. + * + * If $returnResult is true, the result of the evaluation is returned as + * a boolean value instead: true in case of success, false in case of a + * failure. + * + * @param mixed $other value or object to evaluate + * @param string $description Additional information about the test + * @param bool $returnResult Whether to return a result or throw an exception + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function evaluate($other, $description = '', $returnResult = false) + { + $success = true; + + foreach ($other as $item) { + if (!$this->constraint->evaluate($item, '', true)) { + $success = false; + + break; + } + } + + if ($returnResult) { + return $success; + } + + if (!$success) { + $this->fail($other, $description); + } + } + + /** + * Returns a string representation of the constraint. + */ + public function toString(): string + { + return 'contains only values of type "' . $this->type . '"'; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/CoveredCodeNotExecutedException.php b/vendor/phpunit/phpunit/src/Framework/CoveredCodeNotExecutedException.php new file mode 100644 index 0000000..45deaaa --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/CoveredCodeNotExecutedException.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +class CoveredCodeNotExecutedException extends RiskyTestError +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/DataProviderTestSuite.php b/vendor/phpunit/phpunit/src/Framework/DataProviderTestSuite.php new file mode 100644 index 0000000..af119d2 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/DataProviderTestSuite.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +class DataProviderTestSuite extends TestSuite +{ + /** + * @var string[] + */ + private $dependencies = []; + + /** + * @param string[] $dependencies + */ + public function setDependencies(array $dependencies): void + { + $this->dependencies = $dependencies; + + foreach ($this->tests as $test) { + $test->setDependencies($dependencies); + } + } + + public function getDependencies(): array + { + return $this->dependencies; + } + + public function hasDependencies(): bool + { + return \count($this->dependencies) > 0; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Error/Deprecated.php b/vendor/phpunit/phpunit/src/Framework/Error/Deprecated.php new file mode 100644 index 0000000..f43b8f9 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Error/Deprecated.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Error; + +class Deprecated extends Error +{ + public static $enabled = true; +} diff --git a/vendor/phpunit/phpunit/src/Framework/Error/Error.php b/vendor/phpunit/phpunit/src/Framework/Error/Error.php new file mode 100644 index 0000000..3478703 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Error/Error.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Error; + +use PHPUnit\Framework\Exception; + +/** + * Wrapper for PHP errors. + */ +class Error extends Exception +{ + public function __construct(string $message, int $code, string $file, int $line, \Exception $previous = null) + { + parent::__construct($message, $code, $previous); + + $this->file = $file; + $this->line = $line; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Error/Notice.php b/vendor/phpunit/phpunit/src/Framework/Error/Notice.php new file mode 100644 index 0000000..0275c09 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Error/Notice.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Error; + +class Notice extends Error +{ + public static $enabled = true; +} diff --git a/vendor/phpunit/phpunit/src/Framework/Error/Warning.php b/vendor/phpunit/phpunit/src/Framework/Error/Warning.php new file mode 100644 index 0000000..decb33e --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Error/Warning.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\Error; + +class Warning extends Error +{ + public static $enabled = true; +} diff --git a/vendor/phpunit/phpunit/src/Framework/Exception.php b/vendor/phpunit/phpunit/src/Framework/Exception.php new file mode 100644 index 0000000..2ea2a1b --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Exception.php @@ -0,0 +1,78 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use PHPUnit\Util\Filter; + +/** + * Base class for all PHPUnit Framework exceptions. + * + * Ensures that exceptions thrown during a test run do not leave stray + * references behind. + * + * Every Exception contains a stack trace. Each stack frame contains the 'args' + * of the called function. The function arguments can contain references to + * instantiated objects. The references prevent the objects from being + * destructed (until test results are eventually printed), so memory cannot be + * freed up. + * + * With enabled process isolation, test results are serialized in the child + * process and unserialized in the parent process. The stack trace of Exceptions + * may contain objects that cannot be serialized or unserialized (e.g., PDO + * connections). Unserializing user-space objects from the child process into + * the parent would break the intended encapsulation of process isolation. + * + * @see http://fabien.potencier.org/article/9/php-serialization-stack-traces-and-exceptions + */ +class Exception extends \RuntimeException implements \PHPUnit\Exception +{ + /** + * @var array + */ + protected $serializableTrace; + + public function __construct($message = '', $code = 0, \Exception $previous = null) + { + parent::__construct($message, $code, $previous); + + $this->serializableTrace = $this->getTrace(); + + foreach ($this->serializableTrace as $i => $call) { + unset($this->serializableTrace[$i]['args']); + } + } + + /** + * @throws \InvalidArgumentException + */ + public function __toString(): string + { + $string = TestFailure::exceptionToString($this); + + if ($trace = Filter::getFilteredStacktrace($this)) { + $string .= "\n" . $trace; + } + + return $string; + } + + public function __sleep(): array + { + return \array_keys(\get_object_vars($this)); + } + + /** + * Returns the serializable trace (without 'args'). + */ + public function getSerializableTrace(): array + { + return $this->serializableTrace; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/ExceptionWrapper.php b/vendor/phpunit/phpunit/src/Framework/ExceptionWrapper.php new file mode 100644 index 0000000..702712a --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/ExceptionWrapper.php @@ -0,0 +1,118 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use PHPUnit\Util\Filter; +use Throwable; + +/** + * Wraps Exceptions thrown by code under test. + * + * Re-instantiates Exceptions thrown by user-space code to retain their original + * class names, properties, and stack traces (but without arguments). + * + * Unlike PHPUnit\Framework_\Exception, the complete stack of previous Exceptions + * is processed. + */ +class ExceptionWrapper extends Exception +{ + /** + * @var string + */ + protected $className; + + /** + * @var null|ExceptionWrapper + */ + protected $previous; + + public function __construct(Throwable $t) + { + // PDOException::getCode() is a string. + // @see https://php.net/manual/en/class.pdoexception.php#95812 + parent::__construct($t->getMessage(), (int) $t->getCode()); + $this->setOriginalException($t); + } + + /** + * @throws \InvalidArgumentException + */ + public function __toString(): string + { + $string = TestFailure::exceptionToString($this); + + if ($trace = Filter::getFilteredStacktrace($this)) { + $string .= "\n" . $trace; + } + + if ($this->previous) { + $string .= "\nCaused by\n" . $this->previous; + } + + return $string; + } + + public function getClassName(): string + { + return $this->className; + } + + public function getPreviousWrapped(): ?self + { + return $this->previous; + } + + public function setClassName(string $className): void + { + $this->className = $className; + } + + public function setOriginalException(\Throwable $t): void + { + $this->originalException($t); + + $this->className = \get_class($t); + $this->file = $t->getFile(); + $this->line = $t->getLine(); + + $this->serializableTrace = $t->getTrace(); + + foreach ($this->serializableTrace as $i => $call) { + unset($this->serializableTrace[$i]['args']); + } + + if ($t->getPrevious()) { + $this->previous = new self($t->getPrevious()); + } + } + + public function getOriginalException(): ?Throwable + { + return $this->originalException(); + } + + /** + * Method to contain static originalException to exclude it from stacktrace to prevent the stacktrace contents, + * which can be quite big, from being garbage-collected, thus blocking memory until shutdown. + * Approach works both for var_dump() and var_export() and print_r() + */ + private function originalException(Throwable $exceptionToStore = null): ?Throwable + { + static $originalExceptions; + + $instanceId = \spl_object_hash($this); + + if ($exceptionToStore) { + $originalExceptions[$instanceId] = $exceptionToStore; + } + + return $originalExceptions[$instanceId] ?? null; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/ExpectationFailedException.php b/vendor/phpunit/phpunit/src/Framework/ExpectationFailedException.php new file mode 100644 index 0000000..2771d9b --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/ExpectationFailedException.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use SebastianBergmann\Comparator\ComparisonFailure; + +/** + * Exception for expectations which failed their check. + * + * The exception contains the error message and optionally a + * SebastianBergmann\Comparator\ComparisonFailure which is used to + * generate diff output of the failed expectations. + */ +class ExpectationFailedException extends AssertionFailedError +{ + /** + * @var ComparisonFailure + */ + protected $comparisonFailure; + + public function __construct(string $message, ComparisonFailure $comparisonFailure = null, \Exception $previous = null) + { + $this->comparisonFailure = $comparisonFailure; + + parent::__construct($message, 0, $previous); + } + + public function getComparisonFailure(): ?ComparisonFailure + { + return $this->comparisonFailure; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/IncompleteTest.php b/vendor/phpunit/phpunit/src/Framework/IncompleteTest.php new file mode 100644 index 0000000..53654f9 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/IncompleteTest.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * A marker interface for marking any exception/error as result of an unit + * test as incomplete implementation or currently not implemented. + */ +interface IncompleteTest +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/IncompleteTestCase.php b/vendor/phpunit/phpunit/src/Framework/IncompleteTestCase.php new file mode 100644 index 0000000..0092532 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/IncompleteTestCase.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * An incomplete test case + */ +class IncompleteTestCase extends TestCase +{ + /** + * @var string + */ + protected $message = ''; + + /** + * @var bool + */ + protected $backupGlobals = false; + + /** + * @var bool + */ + protected $backupStaticAttributes = false; + + /** + * @var bool + */ + protected $runTestInSeparateProcess = false; + + /** + * @var bool + */ + protected $useErrorHandler = false; + + /** + * @var bool + */ + protected $useOutputBuffering = false; + + public function __construct(string $className, string $methodName, string $message = '') + { + parent::__construct($className . '::' . $methodName); + + $this->message = $message; + } + + public function getMessage(): string + { + return $this->message; + } + + /** + * Returns a string representation of the test case. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function toString(): string + { + return $this->getName(); + } + + /** + * @throws Exception + */ + protected function runTest(): void + { + $this->markTestIncomplete($this->message); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/IncompleteTestError.php b/vendor/phpunit/phpunit/src/Framework/IncompleteTestError.php new file mode 100644 index 0000000..0921f07 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/IncompleteTestError.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +class IncompleteTestError extends AssertionFailedError implements IncompleteTest +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/InvalidCoversTargetException.php b/vendor/phpunit/phpunit/src/Framework/InvalidCoversTargetException.php new file mode 100644 index 0000000..40e9c33 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/InvalidCoversTargetException.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +class InvalidCoversTargetException extends CodeCoverageException +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/MissingCoversAnnotationException.php b/vendor/phpunit/phpunit/src/Framework/MissingCoversAnnotationException.php new file mode 100644 index 0000000..ed3bcb6 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MissingCoversAnnotationException.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +class MissingCoversAnnotationException extends RiskyTestError +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Identity.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Identity.php new file mode 100644 index 0000000..9db235f --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Identity.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Builder; + +/** + * Builder interface for unique identifiers. + * + * Defines the interface for recording unique identifiers. The identifiers + * can be used to define the invocation order of expectations. The expectation + * is recorded using id() and then defined in order using + * PHPUnit\Framework\MockObject\Builder\Match::after(). + */ +interface Identity +{ + /** + * Sets the identification of the expectation to $id. + * + * @note The identifier is unique per mock object. + * + * @param string $id unique identification of expectation + */ + public function id($id); +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationMocker.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationMocker.php new file mode 100644 index 0000000..2801319 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationMocker.php @@ -0,0 +1,277 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Builder; + +use PHPUnit\Framework\Constraint\Constraint; +use PHPUnit\Framework\MockObject\Matcher; +use PHPUnit\Framework\MockObject\Matcher\Invocation; +use PHPUnit\Framework\MockObject\RuntimeException; +use PHPUnit\Framework\MockObject\Stub; +use PHPUnit\Framework\MockObject\Stub\MatcherCollection; + +/** + * Builder for mocked or stubbed invocations. + * + * Provides methods for building expectations without having to resort to + * instantiating the various matchers manually. These methods also form a + * more natural way of reading the expectation. This class should be together + * with the test case PHPUnit\Framework\MockObject\TestCase. + */ +class InvocationMocker implements MethodNameMatch +{ + /** + * @var MatcherCollection + */ + private $collection; + + /** + * @var Matcher + */ + private $matcher; + + /** + * @var string[] + */ + private $configurableMethods; + + public function __construct(MatcherCollection $collection, Invocation $invocationMatcher, array $configurableMethods) + { + $this->collection = $collection; + $this->matcher = new Matcher($invocationMatcher); + + $this->collection->addMatcher($this->matcher); + + $this->configurableMethods = $configurableMethods; + } + + /** + * @return Matcher + */ + public function getMatcher() + { + return $this->matcher; + } + + /** + * @return InvocationMocker + */ + public function id($id) + { + $this->collection->registerId($id, $this); + + return $this; + } + + /** + * @return InvocationMocker + */ + public function will(Stub $stub) + { + $this->matcher->setStub($stub); + + return $this; + } + + /** + * @return InvocationMocker + */ + public function willReturn($value, ...$nextValues) + { + if (\count($nextValues) === 0) { + $stub = new Stub\ReturnStub($value); + } else { + $stub = new Stub\ConsecutiveCalls( + \array_merge([$value], $nextValues) + ); + } + + return $this->will($stub); + } + + /** + * @param mixed $reference + * + * @return InvocationMocker + */ + public function willReturnReference(&$reference) + { + $stub = new Stub\ReturnReference($reference); + + return $this->will($stub); + } + + /** + * @return InvocationMocker + */ + public function willReturnMap(array $valueMap) + { + $stub = new Stub\ReturnValueMap($valueMap); + + return $this->will($stub); + } + + /** + * @return InvocationMocker + */ + public function willReturnArgument($argumentIndex) + { + $stub = new Stub\ReturnArgument($argumentIndex); + + return $this->will($stub); + } + + /** + * @param callable $callback + * + * @return InvocationMocker + */ + public function willReturnCallback($callback) + { + $stub = new Stub\ReturnCallback($callback); + + return $this->will($stub); + } + + /** + * @return InvocationMocker + */ + public function willReturnSelf() + { + $stub = new Stub\ReturnSelf; + + return $this->will($stub); + } + + /** + * @return InvocationMocker + */ + public function willReturnOnConsecutiveCalls(...$values) + { + $stub = new Stub\ConsecutiveCalls($values); + + return $this->will($stub); + } + + /** + * @return InvocationMocker + */ + public function willThrowException(\Exception $exception) + { + $stub = new Stub\Exception($exception); + + return $this->will($stub); + } + + /** + * @return InvocationMocker + */ + public function after($id) + { + $this->matcher->setAfterMatchBuilderId($id); + + return $this; + } + + /** + * @param array ...$arguments + * + * @throws RuntimeException + * + * @return InvocationMocker + */ + public function with(...$arguments) + { + $this->canDefineParameters(); + + $this->matcher->setParametersMatcher(new Matcher\Parameters($arguments)); + + return $this; + } + + /** + * @param array ...$arguments + * + * @throws RuntimeException + * + * @return InvocationMocker + */ + public function withConsecutive(...$arguments) + { + $this->canDefineParameters(); + + $this->matcher->setParametersMatcher(new Matcher\ConsecutiveParameters($arguments)); + + return $this; + } + + /** + * @throws RuntimeException + * + * @return InvocationMocker + */ + public function withAnyParameters() + { + $this->canDefineParameters(); + + $this->matcher->setParametersMatcher(new Matcher\AnyParameters); + + return $this; + } + + /** + * @param Constraint|string $constraint + * + * @throws RuntimeException + * + * @return InvocationMocker + */ + public function method($constraint) + { + if ($this->matcher->hasMethodNameMatcher()) { + throw new RuntimeException( + 'Method name matcher is already defined, cannot redefine' + ); + } + + if (\is_string($constraint) && !\in_array(\strtolower($constraint), $this->configurableMethods, true)) { + throw new RuntimeException( + \sprintf( + 'Trying to configure method "%s" which cannot be configured because it does not exist, has not been specified, is final, or is static', + $constraint + ) + ); + } + + $this->matcher->setMethodNameMatcher(new Matcher\MethodName($constraint)); + + return $this; + } + + /** + * Validate that a parameters matcher can be defined, throw exceptions otherwise. + * + * @throws RuntimeException + */ + private function canDefineParameters(): void + { + if (!$this->matcher->hasMethodNameMatcher()) { + throw new RuntimeException( + 'Method name matcher is not defined, cannot define parameter ' . + 'matcher without one' + ); + } + + if ($this->matcher->hasParametersMatcher()) { + throw new RuntimeException( + 'Parameter matcher is already defined, cannot redefine' + ); + } + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Match.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Match.php new file mode 100644 index 0000000..eeace16 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Match.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Builder; + +/** + * Builder interface for invocation order matches. + */ +interface Match extends Stub +{ + /** + * Defines the expectation which must occur before the current is valid. + * + * @param string $id the identification of the expectation that should + * occur before this one + * + * @return Stub + */ + public function after($id); +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/MethodNameMatch.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/MethodNameMatch.php new file mode 100644 index 0000000..55816a3 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/MethodNameMatch.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Builder; + +/** + * Builder interface for matcher of method names. + */ +interface MethodNameMatch extends ParametersMatch +{ + /** + * Adds a new method name match and returns the parameter match object for + * further matching possibilities. + * + * @param \PHPUnit\Framework\Constraint\Constraint $name Constraint for matching method, if a string is passed it will use the PHPUnit_Framework_Constraint_IsEqual + * + * @return ParametersMatch + */ + public function method($name); +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/NamespaceMatch.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/NamespaceMatch.php new file mode 100644 index 0000000..9e1b063 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/NamespaceMatch.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Builder; + +/** + * Interface for builders which can register builders with a given identification. + * + * This interface relates to Identity. + */ +interface NamespaceMatch +{ + /** + * Looks up the match builder with identification $id and returns it. + * + * @param string $id The identification of the match builder + * + * @return Match + */ + public function lookupId($id); + + /** + * Registers the match builder $builder with the identification $id. The + * builder can later be looked up using lookupId() to figure out if it + * has been invoked. + * + * @param string $id The identification of the match builder + * @param Match $builder The builder which is being registered + */ + public function registerId($id, Match $builder); +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php new file mode 100644 index 0000000..957ded1 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Builder; + +use PHPUnit\Framework\MockObject\Matcher\AnyParameters; + +/** + * Builder interface for parameter matchers. + */ +interface ParametersMatch extends Match +{ + /** + * Sets the parameters to match for, each parameter to this function will + * be part of match. To perform specific matches or constraints create a + * new PHPUnit\Framework\Constraint\Constraint and use it for the parameter. + * If the parameter value is not a constraint it will use the + * PHPUnit\Framework\Constraint\IsEqual for the value. + * + * Some examples: + * + * // match first parameter with value 2 + * $b->with(2); + * // match first parameter with value 'smock' and second identical to 42 + * $b->with('smock', new PHPUnit\Framework\Constraint\IsEqual(42)); + * + * + * @return ParametersMatch + */ + public function with(...$arguments); + + /** + * Sets a matcher which allows any kind of parameters. + * + * Some examples: + * + * // match any number of parameters + * $b->withAnyParameters(); + * + * + * @return AnyParameters + */ + public function withAnyParameters(); +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Stub.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Stub.php new file mode 100644 index 0000000..ad9e6c1 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Stub.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Builder; + +use PHPUnit\Framework\MockObject\Stub as BaseStub; + +/** + * Builder interface for stubs which are actions replacing an invocation. + */ +interface Stub extends Identity +{ + /** + * Stubs the matching method with the stub object $stub. Any invocations of + * the matched method will now be handled by the stub instead. + * + * @return Identity + */ + public function will(BaseStub $stub); +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/BadMethodCallException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/BadMethodCallException.php new file mode 100644 index 0000000..c0a0128 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/BadMethodCallException.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +class BadMethodCallException extends \BadMethodCallException implements Exception +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/Exception.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/Exception.php new file mode 100644 index 0000000..bc94225 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/Exception.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +/** + * Interface for exceptions used by PHPUnit_MockObject. + */ +interface Exception +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/RuntimeException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/RuntimeException.php new file mode 100644 index 0000000..b286736 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/RuntimeException.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +class RuntimeException extends \RuntimeException implements Exception +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/ForwardCompatibility/MockObject.php b/vendor/phpunit/phpunit/src/Framework/MockObject/ForwardCompatibility/MockObject.php new file mode 100644 index 0000000..f020e8c --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/ForwardCompatibility/MockObject.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use PHPUnit_Framework_MockObject_MockObject; + +interface MockObject extends PHPUnit_Framework_MockObject_MockObject +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php new file mode 100644 index 0000000..351ed91 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php @@ -0,0 +1,973 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use Doctrine\Instantiator\Exception\ExceptionInterface as InstantiatorException; +use Doctrine\Instantiator\Instantiator; +use Iterator; +use IteratorAggregate; +use PHPUnit\Framework\Exception; +use PHPUnit\Util\InvalidArgumentHelper; +use ReflectionClass; +use ReflectionMethod; +use SoapClient; +use Text_Template; +use Traversable; + +/** + * Mock Object Code Generator + */ +class Generator +{ + /** + * @var array + */ + private const BLACKLISTED_METHOD_NAMES = [ + '__CLASS__' => true, + '__DIR__' => true, + '__FILE__' => true, + '__FUNCTION__' => true, + '__LINE__' => true, + '__METHOD__' => true, + '__NAMESPACE__' => true, + '__TRAIT__' => true, + '__clone' => true, + '__halt_compiler' => true, + ]; + + /** + * @var array + */ + private static $cache = []; + + /** + * @var Text_Template[] + */ + private static $templates = []; + + /** + * Returns a mock object for the specified class. + * + * @param string|string[] $type + * @param array $methods + * @param string $mockClassName + * @param bool $callOriginalConstructor + * @param bool $callOriginalClone + * @param bool $callAutoload + * @param bool $cloneArguments + * @param bool $callOriginalMethods + * @param object $proxyTarget + * @param bool $allowMockingUnknownTypes + * @param bool $returnValueGeneration + * + * @throws Exception + * @throws RuntimeException + * @throws \PHPUnit\Framework\Exception + * @throws \ReflectionException + * + * @return MockObject + */ + public function getMock($type, $methods = [], array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $cloneArguments = true, $callOriginalMethods = false, $proxyTarget = null, $allowMockingUnknownTypes = true, $returnValueGeneration = true) + { + if (!\is_array($type) && !\is_string($type)) { + throw InvalidArgumentHelper::factory(1, 'array or string'); + } + + if (!\is_string($mockClassName)) { + throw InvalidArgumentHelper::factory(4, 'string'); + } + + if (!\is_array($methods) && null !== $methods) { + throw InvalidArgumentHelper::factory(2, 'array', $methods); + } + + if ($type === 'Traversable' || $type === '\\Traversable') { + $type = 'Iterator'; + } + + if (\is_array($type)) { + $type = \array_unique( + \array_map( + function ($type) { + if ($type === 'Traversable' || + $type === '\\Traversable' || + $type === '\\Iterator') { + return 'Iterator'; + } + + return $type; + }, + $type + ) + ); + } + + if (!$allowMockingUnknownTypes) { + if (\is_array($type)) { + foreach ($type as $_type) { + if (!\class_exists($_type, $callAutoload) && + !\interface_exists($_type, $callAutoload)) { + throw new RuntimeException( + \sprintf( + 'Cannot stub or mock class or interface "%s" which does not exist', + $_type + ) + ); + } + } + } else { + if (!\class_exists($type, $callAutoload) && + !\interface_exists($type, $callAutoload) + ) { + throw new RuntimeException( + \sprintf( + 'Cannot stub or mock class or interface "%s" which does not exist', + $type + ) + ); + } + } + } + + if (null !== $methods) { + foreach ($methods as $method) { + if (!\preg_match('~[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*~', $method)) { + throw new RuntimeException( + \sprintf( + 'Cannot stub or mock method with invalid name "%s"', + $method + ) + ); + } + } + + if ($methods !== \array_unique($methods)) { + throw new RuntimeException( + \sprintf( + 'Cannot stub or mock using a method list that contains duplicates: "%s" (duplicate: "%s")', + \implode(', ', $methods), + \implode(', ', \array_unique(\array_diff_assoc($methods, \array_unique($methods)))) + ) + ); + } + } + + if ($mockClassName !== '' && \class_exists($mockClassName, false)) { + $reflect = new ReflectionClass($mockClassName); + + if (!$reflect->implementsInterface(MockObject::class)) { + throw new RuntimeException( + \sprintf( + 'Class "%s" already exists.', + $mockClassName + ) + ); + } + } + + if ($callOriginalConstructor === false && $callOriginalMethods === true) { + throw new RuntimeException( + 'Proxying to original methods requires invoking the original constructor' + ); + } + + $mock = $this->generate( + $type, + $methods, + $mockClassName, + $callOriginalClone, + $callAutoload, + $cloneArguments, + $callOriginalMethods + ); + + return $this->getObject( + $mock['code'], + $mock['mockClassName'], + $type, + $callOriginalConstructor, + $callAutoload, + $arguments, + $callOriginalMethods, + $proxyTarget, + $returnValueGeneration + ); + } + + /** + * Returns a mock object for the specified abstract class with all abstract + * methods of the class mocked. Concrete methods to mock can be specified with + * the last parameter + * + * @param string $originalClassName + * @param string $mockClassName + * @param bool $callOriginalConstructor + * @param bool $callOriginalClone + * @param bool $callAutoload + * @param array $mockedMethods + * @param bool $cloneArguments + * + * @throws \ReflectionException + * @throws RuntimeException + * @throws Exception + * + * @return MockObject + */ + public function getMockForAbstractClass($originalClassName, array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = [], $cloneArguments = true) + { + if (!\is_string($originalClassName)) { + throw InvalidArgumentHelper::factory(1, 'string'); + } + + if (!\is_string($mockClassName)) { + throw InvalidArgumentHelper::factory(3, 'string'); + } + + if (\class_exists($originalClassName, $callAutoload) || + \interface_exists($originalClassName, $callAutoload)) { + $reflector = new ReflectionClass($originalClassName); + $methods = $mockedMethods; + + foreach ($reflector->getMethods() as $method) { + if ($method->isAbstract() && !\in_array($method->getName(), $methods, true)) { + $methods[] = $method->getName(); + } + } + + if (empty($methods)) { + $methods = null; + } + + return $this->getMock( + $originalClassName, + $methods, + $arguments, + $mockClassName, + $callOriginalConstructor, + $callOriginalClone, + $callAutoload, + $cloneArguments + ); + } + + throw new RuntimeException( + \sprintf('Class "%s" does not exist.', $originalClassName) + ); + } + + /** + * Returns a mock object for the specified trait with all abstract methods + * of the trait mocked. Concrete methods to mock can be specified with the + * `$mockedMethods` parameter. + * + * @param string $traitName + * @param string $mockClassName + * @param bool $callOriginalConstructor + * @param bool $callOriginalClone + * @param bool $callAutoload + * @param array $mockedMethods + * @param bool $cloneArguments + * + * @throws \ReflectionException + * @throws RuntimeException + * @throws Exception + * + * @return MockObject + */ + public function getMockForTrait($traitName, array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = [], $cloneArguments = true) + { + if (!\is_string($traitName)) { + throw InvalidArgumentHelper::factory(1, 'string'); + } + + if (!\is_string($mockClassName)) { + throw InvalidArgumentHelper::factory(3, 'string'); + } + + if (!\trait_exists($traitName, $callAutoload)) { + throw new RuntimeException( + \sprintf( + 'Trait "%s" does not exist.', + $traitName + ) + ); + } + + $className = $this->generateClassName( + $traitName, + '', + 'Trait_' + ); + + $classTemplate = $this->getTemplate('trait_class.tpl'); + + $classTemplate->setVar( + [ + 'prologue' => 'abstract ', + 'class_name' => $className['className'], + 'trait_name' => $traitName, + ] + ); + + $this->evalClass( + $classTemplate->render(), + $className['className'] + ); + + return $this->getMockForAbstractClass($className['className'], $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $mockedMethods, $cloneArguments); + } + + /** + * Returns an object for the specified trait. + * + * @param string $traitName + * @param string $traitClassName + * @param bool $callOriginalConstructor + * @param bool $callOriginalClone + * @param bool $callAutoload + * + * @throws \ReflectionException + * @throws RuntimeException + * @throws Exception + * + * @return object + */ + public function getObjectForTrait($traitName, array $arguments = [], $traitClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true) + { + if (!\is_string($traitName)) { + throw InvalidArgumentHelper::factory(1, 'string'); + } + + if (!\is_string($traitClassName)) { + throw InvalidArgumentHelper::factory(3, 'string'); + } + + if (!\trait_exists($traitName, $callAutoload)) { + throw new RuntimeException( + \sprintf( + 'Trait "%s" does not exist.', + $traitName + ) + ); + } + + $className = $this->generateClassName( + $traitName, + $traitClassName, + 'Trait_' + ); + + $classTemplate = $this->getTemplate('trait_class.tpl'); + + $classTemplate->setVar( + [ + 'prologue' => '', + 'class_name' => $className['className'], + 'trait_name' => $traitName, + ] + ); + + return $this->getObject($classTemplate->render(), $className['className']); + } + + /** + * @param array|string $type + * @param array $methods + * @param string $mockClassName + * @param bool $callOriginalClone + * @param bool $callAutoload + * @param bool $cloneArguments + * @param bool $callOriginalMethods + * + * @throws \ReflectionException + * @throws \PHPUnit\Framework\MockObject\RuntimeException + * + * @return array + */ + public function generate($type, array $methods = null, $mockClassName = '', $callOriginalClone = true, $callAutoload = true, $cloneArguments = true, $callOriginalMethods = false) + { + if (\is_array($type)) { + \sort($type); + } + + if ($mockClassName !== '') { + return $this->generateMock( + $type, + $methods, + $mockClassName, + $callOriginalClone, + $callAutoload, + $cloneArguments, + $callOriginalMethods + ); + } + $key = \md5( + \is_array($type) ? \implode('_', $type) : $type . + \serialize($methods) . + \serialize($callOriginalClone) . + \serialize($cloneArguments) . + \serialize($callOriginalMethods) + ); + + if (!isset(self::$cache[$key])) { + self::$cache[$key] = $this->generateMock( + $type, + $methods, + $mockClassName, + $callOriginalClone, + $callAutoload, + $cloneArguments, + $callOriginalMethods + ); + } + + return self::$cache[$key]; + } + + /** + * @param string $wsdlFile + * @param string $className + * + * @throws RuntimeException + * + * @return string + */ + public function generateClassFromWsdl($wsdlFile, $className, array $methods = [], array $options = []) + { + if (!\extension_loaded('soap')) { + throw new RuntimeException( + 'The SOAP extension is required to generate a mock object from WSDL.' + ); + } + + $options = \array_merge($options, ['cache_wsdl' => \WSDL_CACHE_NONE]); + $client = new SoapClient($wsdlFile, $options); + $_methods = \array_unique($client->__getFunctions()); + unset($client); + + \sort($_methods); + + $methodTemplate = $this->getTemplate('wsdl_method.tpl'); + $methodsBuffer = ''; + + foreach ($_methods as $method) { + $nameStart = \strpos($method, ' ') + 1; + $nameEnd = \strpos($method, '('); + $name = \substr($method, $nameStart, $nameEnd - $nameStart); + + if (empty($methods) || \in_array($name, $methods, true)) { + $args = \explode( + ',', + \substr( + $method, + $nameEnd + 1, + \strpos($method, ')') - $nameEnd - 1 + ) + ); + + foreach (\range(0, \count($args) - 1) as $i) { + $args[$i] = \substr($args[$i], \strpos($args[$i], '$')); + } + + $methodTemplate->setVar( + [ + 'method_name' => $name, + 'arguments' => \implode(', ', $args), + ] + ); + + $methodsBuffer .= $methodTemplate->render(); + } + } + + $optionsBuffer = '['; + + foreach ($options as $key => $value) { + $optionsBuffer .= $key . ' => ' . $value; + } + + $optionsBuffer .= ']'; + + $classTemplate = $this->getTemplate('wsdl_class.tpl'); + $namespace = ''; + + if (\strpos($className, '\\') !== false) { + $parts = \explode('\\', $className); + $className = \array_pop($parts); + $namespace = 'namespace ' . \implode('\\', $parts) . ';' . "\n\n"; + } + + $classTemplate->setVar( + [ + 'namespace' => $namespace, + 'class_name' => $className, + 'wsdl' => $wsdlFile, + 'options' => $optionsBuffer, + 'methods' => $methodsBuffer, + ] + ); + + return $classTemplate->render(); + } + + /** + * @param string $className + * + * @throws \ReflectionException + * + * @return string[] + */ + public function getClassMethods($className): array + { + $class = new ReflectionClass($className); + $methods = []; + + foreach ($class->getMethods() as $method) { + if ($method->isPublic() || $method->isAbstract()) { + $methods[] = $method->getName(); + } + } + + return $methods; + } + + /** + * @throws \ReflectionException + * + * @return MockMethod[] + */ + public function mockClassMethods(string $className, bool $callOriginalMethods, bool $cloneArguments): array + { + $class = new ReflectionClass($className); + $methods = []; + + foreach ($class->getMethods() as $method) { + if (($method->isPublic() || $method->isAbstract()) && $this->canMockMethod($method)) { + $methods[] = MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments); + } + } + + return $methods; + } + + /** + * @param string $code + * @param string $className + * @param array|string $type + * @param bool $callOriginalConstructor + * @param bool $callAutoload + * @param bool $callOriginalMethods + * @param object $proxyTarget + * @param bool $returnValueGeneration + * + * @throws \ReflectionException + * @throws RuntimeException + * + * @return MockObject + */ + private function getObject($code, $className, $type = '', $callOriginalConstructor = false, $callAutoload = false, array $arguments = [], $callOriginalMethods = false, $proxyTarget = null, $returnValueGeneration = true) + { + $this->evalClass($code, $className); + + if ($callOriginalConstructor && + \is_string($type) && + !\interface_exists($type, $callAutoload)) { + if (\count($arguments) === 0) { + $object = new $className; + } else { + $class = new ReflectionClass($className); + $object = $class->newInstanceArgs($arguments); + } + } else { + try { + $instantiator = new Instantiator; + $object = $instantiator->instantiate($className); + } catch (InstantiatorException $exception) { + throw new RuntimeException($exception->getMessage()); + } + } + + if ($callOriginalMethods) { + if (!\is_object($proxyTarget)) { + if (\count($arguments) === 0) { + $proxyTarget = new $type; + } else { + $class = new ReflectionClass($type); + $proxyTarget = $class->newInstanceArgs($arguments); + } + } + + $object->__phpunit_setOriginalObject($proxyTarget); + } + + if ($object instanceof MockObject) { + $object->__phpunit_setReturnValueGeneration($returnValueGeneration); + } + + return $object; + } + + /** + * @param string $code + * @param string $className + */ + private function evalClass($code, $className): void + { + if (!\class_exists($className, false)) { + eval($code); + } + } + + /** + * @param array|string $type + * @param null|array $explicitMethods + * @param string $mockClassName + * @param bool $callOriginalClone + * @param bool $callAutoload + * @param bool $cloneArguments + * @param bool $callOriginalMethods + * + * @throws \InvalidArgumentException + * @throws \ReflectionException + * @throws RuntimeException + * + * @return array + */ + private function generateMock($type, $explicitMethods, $mockClassName, $callOriginalClone, $callAutoload, $cloneArguments, $callOriginalMethods) + { + $classTemplate = $this->getTemplate('mocked_class.tpl'); + + $additionalInterfaces = []; + $cloneTemplate = ''; + $isClass = false; + $isInterface = false; + $class = null; + $mockMethods = new MockMethodSet; + + if (\is_array($type)) { + $interfaceMethods = []; + + foreach ($type as $_type) { + if (!\interface_exists($_type, $callAutoload)) { + throw new RuntimeException( + \sprintf( + 'Interface "%s" does not exist.', + $_type + ) + ); + } + + $additionalInterfaces[] = $_type; + $typeClass = new ReflectionClass($_type); + + foreach ($this->getClassMethods($_type) as $method) { + if (\in_array($method, $interfaceMethods, true)) { + throw new RuntimeException( + \sprintf( + 'Duplicate method "%s" not allowed.', + $method + ) + ); + } + + $methodReflection = $typeClass->getMethod($method); + + if ($this->canMockMethod($methodReflection)) { + $mockMethods->addMethods( + MockMethod::fromReflection($methodReflection, $callOriginalMethods, $cloneArguments) + ); + + $interfaceMethods[] = $method; + } + } + } + + unset($interfaceMethods); + } + + $mockClassName = $this->generateClassName( + $type, + $mockClassName, + 'Mock_' + ); + + if (\class_exists($mockClassName['fullClassName'], $callAutoload)) { + $isClass = true; + } elseif (\interface_exists($mockClassName['fullClassName'], $callAutoload)) { + $isInterface = true; + } + + if (!$isClass && !$isInterface) { + $prologue = 'class ' . $mockClassName['originalClassName'] . "\n{\n}\n\n"; + + if (!empty($mockClassName['namespaceName'])) { + $prologue = 'namespace ' . $mockClassName['namespaceName'] . + " {\n\n" . $prologue . "}\n\n" . + "namespace {\n\n"; + + $epilogue = "\n\n}"; + } + + $cloneTemplate = $this->getTemplate('mocked_clone.tpl'); + } else { + $class = new ReflectionClass($mockClassName['fullClassName']); + + if ($class->isFinal()) { + throw new RuntimeException( + \sprintf( + 'Class "%s" is declared "final" and cannot be mocked.', + $mockClassName['fullClassName'] + ) + ); + } + + // @see https://github.com/sebastianbergmann/phpunit/issues/2995 + if ($isInterface && $class->implementsInterface(\Throwable::class)) { + $additionalInterfaces[] = $class->getName(); + $isInterface = false; + + $mockClassName = $this->generateClassName( + \Exception::class, + '', + 'Mock_' + ); + + $class = new ReflectionClass($mockClassName['fullClassName']); + } + + // https://github.com/sebastianbergmann/phpunit-mock-objects/issues/103 + if ($isInterface && $class->implementsInterface(Traversable::class) && + !$class->implementsInterface(Iterator::class) && + !$class->implementsInterface(IteratorAggregate::class)) { + $additionalInterfaces[] = Iterator::class; + + $mockMethods->addMethods( + ...$this->mockClassMethods(Iterator::class, $callOriginalMethods, $cloneArguments) + ); + } + + if ($class->hasMethod('__clone')) { + $cloneMethod = $class->getMethod('__clone'); + + if (!$cloneMethod->isFinal()) { + if ($callOriginalClone && !$isInterface) { + $cloneTemplate = $this->getTemplate('unmocked_clone.tpl'); + } else { + $cloneTemplate = $this->getTemplate('mocked_clone.tpl'); + } + } + } else { + $cloneTemplate = $this->getTemplate('mocked_clone.tpl'); + } + } + + if (\is_object($cloneTemplate)) { + $cloneTemplate = $cloneTemplate->render(); + } + + if ($explicitMethods === [] && + ($isClass || $isInterface)) { + $mockMethods->addMethods( + ...$this->mockClassMethods($mockClassName['fullClassName'], $callOriginalMethods, $cloneArguments) + ); + } + + if (\is_array($explicitMethods)) { + foreach ($explicitMethods as $methodName) { + if ($class !== null && $class->hasMethod($methodName)) { + $method = $class->getMethod($methodName); + + if ($this->canMockMethod($method)) { + $mockMethods->addMethods( + MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments) + ); + } + } else { + $mockMethods->addMethods( + MockMethod::fromName( + $mockClassName['fullClassName'], + $methodName, + $cloneArguments + ) + ); + } + } + } + + $mockedMethods = ''; + $configurable = []; + + /** @var MockMethod $mockMethod */ + foreach ($mockMethods->asArray() as $mockMethod) { + $mockedMethods .= $mockMethod->generateCode(); + $configurable[] = \strtolower($mockMethod->getName()); + } + + $method = ''; + + if (!$mockMethods->hasMethod('method') && (!isset($class) || !$class->hasMethod('method'))) { + $methodTemplate = $this->getTemplate('mocked_class_method.tpl'); + + $method = $methodTemplate->render(); + } + + $classTemplate->setVar( + [ + 'prologue' => $prologue ?? '', + 'epilogue' => $epilogue ?? '', + 'class_declaration' => $this->generateMockClassDeclaration( + $mockClassName, + $isInterface, + $additionalInterfaces + ), + 'clone' => $cloneTemplate, + 'mock_class_name' => $mockClassName['className'], + 'mocked_methods' => $mockedMethods, + 'method' => $method, + 'configurable' => '[' . \implode( + ', ', + \array_map( + function ($m) { + return '\'' . $m . '\''; + }, + $configurable + ) + ) . ']', + ] + ); + + return [ + 'code' => $classTemplate->render(), + 'mockClassName' => $mockClassName['className'], + ]; + } + + /** + * @param array|string $type + * @param string $className + * @param string $prefix + * + * @return array + */ + private function generateClassName($type, $className, $prefix) + { + if (\is_array($type)) { + $type = \implode('_', $type); + } + + if ($type[0] === '\\') { + $type = \substr($type, 1); + } + + $classNameParts = \explode('\\', $type); + + if (\count($classNameParts) > 1) { + $type = \array_pop($classNameParts); + $namespaceName = \implode('\\', $classNameParts); + $fullClassName = $namespaceName . '\\' . $type; + } else { + $namespaceName = ''; + $fullClassName = $type; + } + + if ($className === '') { + do { + $className = $prefix . $type . '_' . + \substr(\md5(\mt_rand()), 0, 8); + } while (\class_exists($className, false)); + } + + return [ + 'className' => $className, + 'originalClassName' => $type, + 'fullClassName' => $fullClassName, + 'namespaceName' => $namespaceName, + ]; + } + + /** + * @param bool $isInterface + * + * @return string + */ + private function generateMockClassDeclaration(array $mockClassName, $isInterface, array $additionalInterfaces = []) + { + $buffer = 'class '; + + $additionalInterfaces[] = MockObject::class; + $interfaces = \implode(', ', $additionalInterfaces); + + if ($isInterface) { + $buffer .= \sprintf( + '%s implements %s', + $mockClassName['className'], + $interfaces + ); + + if (!\in_array($mockClassName['originalClassName'], $additionalInterfaces)) { + $buffer .= ', '; + + if (!empty($mockClassName['namespaceName'])) { + $buffer .= $mockClassName['namespaceName'] . '\\'; + } + + $buffer .= $mockClassName['originalClassName']; + } + } else { + $buffer .= \sprintf( + '%s extends %s%s implements %s', + $mockClassName['className'], + !empty($mockClassName['namespaceName']) ? $mockClassName['namespaceName'] . '\\' : '', + $mockClassName['originalClassName'], + $interfaces + ); + } + + return $buffer; + } + + /** + * @return bool + */ + private function canMockMethod(ReflectionMethod $method) + { + return !($method->isConstructor() || $method->isFinal() || $method->isPrivate() || $this->isMethodNameBlacklisted($method->getName())); + } + + /** + * Returns whether a method name is blacklisted + * + * @param string $name + * + * @return bool + */ + private function isMethodNameBlacklisted($name) + { + return isset(self::BLACKLISTED_METHOD_NAMES[$name]); + } + + /** + * @param string $template + * + * @throws \InvalidArgumentException + * + * @return Text_Template + */ + private function getTemplate($template) + { + $filename = __DIR__ . \DIRECTORY_SEPARATOR . 'Generator' . \DIRECTORY_SEPARATOR . $template; + + if (!isset(self::$templates[$filename])) { + self::$templates[$filename] = new Text_Template($filename); + } + + return self::$templates[$filename]; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/deprecation.tpl.dist b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/deprecation.tpl.dist new file mode 100644 index 0000000..5bf06f5 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/deprecation.tpl.dist @@ -0,0 +1,2 @@ + + @trigger_error({deprecation}, E_USER_DEPRECATED); diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_class.tpl.dist b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_class.tpl.dist new file mode 100644 index 0000000..4b68a2b --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_class.tpl.dist @@ -0,0 +1,46 @@ +{prologue}{class_declaration} +{ + private $__phpunit_invocationMocker; + private $__phpunit_originalObject; + private $__phpunit_configurable = {configurable}; + private $__phpunit_returnValueGeneration = true; + +{clone}{mocked_methods} + public function expects(\PHPUnit\Framework\MockObject\Matcher\Invocation $matcher) + { + return $this->__phpunit_getInvocationMocker()->expects($matcher); + } +{method} + public function __phpunit_setOriginalObject($originalObject) + { + $this->__phpunit_originalObject = $originalObject; + } + + public function __phpunit_setReturnValueGeneration(bool $returnValueGeneration) + { + $this->__phpunit_returnValueGeneration = $returnValueGeneration; + } + + public function __phpunit_getInvocationMocker() + { + if ($this->__phpunit_invocationMocker === null) { + $this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable, $this->__phpunit_returnValueGeneration); + } + + return $this->__phpunit_invocationMocker; + } + + public function __phpunit_hasMatchers() + { + return $this->__phpunit_getInvocationMocker()->hasMatchers(); + } + + public function __phpunit_verify(bool $unsetInvocationMocker = true) + { + $this->__phpunit_getInvocationMocker()->verify(); + + if ($unsetInvocationMocker) { + $this->__phpunit_invocationMocker = null; + } + } +}{epilogue} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_class_method.tpl.dist b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_class_method.tpl.dist new file mode 100644 index 0000000..d6a036f --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_class_method.tpl.dist @@ -0,0 +1,8 @@ + + public function method() + { + $any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount; + $expects = $this->expects($any); + + return call_user_func_array([$expects, 'method'], func_get_args()); + } diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_clone.tpl.dist b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_clone.tpl.dist new file mode 100644 index 0000000..bd846de --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_clone.tpl.dist @@ -0,0 +1,4 @@ + public function __clone() + { + $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker(); + } diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method.tpl.dist b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method.tpl.dist new file mode 100644 index 0000000..3adf2f0 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method.tpl.dist @@ -0,0 +1,22 @@ + + {modifier} function {reference}{method_name}({arguments_decl}){return_delim}{return_type} + {{deprecation} + $__phpunit_arguments = [{arguments_call}]; + $__phpunit_count = func_num_args(); + + if ($__phpunit_count > {arguments_count}) { + $__phpunit_arguments_tmp = func_get_args(); + + for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { + $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i]; + } + } + + $__phpunit_result = $this->__phpunit_getInvocationMocker()->invoke( + new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation( + '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments} + ) + ); + + return $__phpunit_result; + } diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method_void.tpl.dist b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method_void.tpl.dist new file mode 100644 index 0000000..3813fe4 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method_void.tpl.dist @@ -0,0 +1,20 @@ + + {modifier} function {reference}{method_name}({arguments_decl}){return_delim}{return_type} + {{deprecation} + $__phpunit_arguments = [{arguments_call}]; + $__phpunit_count = func_num_args(); + + if ($__phpunit_count > {arguments_count}) { + $__phpunit_arguments_tmp = func_get_args(); + + for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { + $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i]; + } + } + + $this->__phpunit_getInvocationMocker()->invoke( + new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation( + '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments} + ) + ); + } diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_static_method.tpl.dist b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_static_method.tpl.dist new file mode 100644 index 0000000..56b561b --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_static_method.tpl.dist @@ -0,0 +1,5 @@ + + {modifier} function {reference}{method_name}({arguments_decl}){return_delim}{return_type} + { + throw new \PHPUnit\Framework\MockObject\BadMethodCallException('Static method "{method_name}" cannot be invoked on mock object'); + } diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method.tpl.dist b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method.tpl.dist new file mode 100644 index 0000000..fd9e71b --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method.tpl.dist @@ -0,0 +1,22 @@ + + {modifier} function {reference}{method_name}({arguments_decl}){return_delim}{return_type} + { + $__phpunit_arguments = [{arguments_call}]; + $__phpunit_count = func_num_args(); + + if ($__phpunit_count > {arguments_count}) { + $__phpunit_arguments_tmp = func_get_args(); + + for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { + $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i]; + } + } + + $this->__phpunit_getInvocationMocker()->invoke( + new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation( + '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments} + ) + ); + + return call_user_func_array(array($this->__phpunit_originalObject, "{method_name}"), $__phpunit_arguments); + } diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method_void.tpl.dist b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method_void.tpl.dist new file mode 100644 index 0000000..63c337b --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method_void.tpl.dist @@ -0,0 +1,22 @@ + + {modifier} function {reference}{method_name}({arguments_decl}){return_delim}{return_type} + { + $__phpunit_arguments = [{arguments_call}]; + $__phpunit_count = func_num_args(); + + if ($__phpunit_count > {arguments_count}) { + $__phpunit_arguments_tmp = func_get_args(); + + for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { + $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i]; + } + } + + $this->__phpunit_getInvocationMocker()->invoke( + new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation( + '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments} + ) + ); + + call_user_func_array(array($this->__phpunit_originalObject, "{method_name}"), $__phpunit_arguments); + } diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/trait_class.tpl.dist b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/trait_class.tpl.dist new file mode 100644 index 0000000..4143b0f --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/trait_class.tpl.dist @@ -0,0 +1,4 @@ +{prologue}class {class_name} +{ + use {trait_name}; +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/unmocked_clone.tpl.dist b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/unmocked_clone.tpl.dist new file mode 100644 index 0000000..fa0e70a --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/unmocked_clone.tpl.dist @@ -0,0 +1,5 @@ + public function __clone() + { + $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker(); + parent::__clone(); + } diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_class.tpl.dist b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_class.tpl.dist new file mode 100644 index 0000000..cc69fd3 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_class.tpl.dist @@ -0,0 +1,7 @@ +{namespace}class {class_name} extends \SoapClient +{ + public function __construct($wsdl, array $options) + { + parent::__construct('{wsdl}', $options); + } +{methods}} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_method.tpl.dist b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_method.tpl.dist new file mode 100644 index 0000000..bb16e76 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_method.tpl.dist @@ -0,0 +1,4 @@ + + public function {method_name}({arguments}) + { + } diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation/Invocation.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation/Invocation.php new file mode 100644 index 0000000..7373867 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation/Invocation.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +/** + * Interface for invocations. + */ +interface Invocation +{ + /** + * @return mixed mocked return value + */ + public function generateReturnValue(); + + public function getClassName(): string; + + public function getMethodName(): string; + + public function getParameters(): array; + + public function getReturnType(): string; + + public function isReturnTypeNullable(): bool; +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation/ObjectInvocation.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation/ObjectInvocation.php new file mode 100644 index 0000000..eb4475f --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation/ObjectInvocation.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Invocation; + +/** + * Represents a non-static invocation. + */ +class ObjectInvocation extends StaticInvocation +{ + /** + * @var object + */ + private $object; + + /** + * @param string $className + * @param string $methodName + * @param string $returnType + * @param object $object + * @param bool $cloneObjects + */ + public function __construct($className, $methodName, array $parameters, $returnType, $object, $cloneObjects = false) + { + parent::__construct($className, $methodName, $parameters, $returnType, $cloneObjects); + + $this->object = $object; + } + + public function getObject() + { + return $this->object; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation/StaticInvocation.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation/StaticInvocation.php new file mode 100644 index 0000000..61be600 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation/StaticInvocation.php @@ -0,0 +1,258 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Invocation; + +use PHPUnit\Framework\MockObject\Generator; +use PHPUnit\Framework\MockObject\Invocation; +use PHPUnit\Framework\SelfDescribing; +use ReflectionObject; +use SebastianBergmann\Exporter\Exporter; + +/** + * Represents a static invocation. + */ +class StaticInvocation implements Invocation, SelfDescribing +{ + /** + * @var array + */ + private static $uncloneableExtensions = [ + 'mysqli' => true, + 'SQLite' => true, + 'sqlite3' => true, + 'tidy' => true, + 'xmlwriter' => true, + 'xsl' => true, + ]; + + /** + * @var array + */ + private static $uncloneableClasses = [ + 'Closure', + 'COMPersistHelper', + 'IteratorIterator', + 'RecursiveIteratorIterator', + 'SplFileObject', + 'PDORow', + 'ZipArchive', + ]; + + /** + * @var string + */ + private $className; + + /** + * @var string + */ + private $methodName; + + /** + * @var array + */ + private $parameters; + + /** + * @var string + */ + private $returnType; + + /** + * @var bool + */ + private $isReturnTypeNullable = false; + + /** + * @param string $className + * @param string $methodName + * @param string $returnType + * @param bool $cloneObjects + */ + public function __construct($className, $methodName, array $parameters, $returnType, $cloneObjects = false) + { + $this->className = $className; + $this->methodName = $methodName; + $this->parameters = $parameters; + + if (\strtolower($methodName) === '__tostring') { + $returnType = 'string'; + } + + if (\strpos($returnType, '?') === 0) { + $returnType = \substr($returnType, 1); + $this->isReturnTypeNullable = true; + } + + $this->returnType = $returnType; + + if (!$cloneObjects) { + return; + } + + foreach ($this->parameters as $key => $value) { + if (\is_object($value)) { + $this->parameters[$key] = $this->cloneObject($value); + } + } + } + + public function getClassName(): string + { + return $this->className; + } + + public function getMethodName(): string + { + return $this->methodName; + } + + public function getParameters(): array + { + return $this->parameters; + } + + public function getReturnType(): string + { + return $this->returnType; + } + + public function isReturnTypeNullable(): bool + { + return $this->isReturnTypeNullable; + } + + /** + * @throws \ReflectionException + * @throws \PHPUnit\Framework\MockObject\RuntimeException + * @throws \PHPUnit\Framework\Exception + * + * @return mixed Mocked return value + */ + public function generateReturnValue() + { + if ($this->isReturnTypeNullable) { + return; + } + + switch (\strtolower($this->returnType)) { + case '': + case 'void': + return; + + case 'string': + return ''; + + case 'float': + return 0.0; + + case 'int': + return 0; + + case 'bool': + return false; + + case 'array': + return []; + + case 'object': + return new \stdClass; + + case 'callable': + case 'closure': + return function (): void { + }; + + case 'traversable': + case 'generator': + case 'iterable': + $generator = function () { + yield; + }; + + return $generator(); + + default: + $generator = new Generator; + + return $generator->getMock($this->returnType, [], [], '', false); + } + } + + public function toString(): string + { + $exporter = new Exporter; + + return \sprintf( + '%s::%s(%s)%s', + $this->className, + $this->methodName, + \implode( + ', ', + \array_map( + [$exporter, 'shortenedExport'], + $this->parameters + ) + ), + $this->returnType ? \sprintf(': %s', $this->returnType) : '' + ); + } + + /** + * @param object $original + * + * @return object + */ + private function cloneObject($original) + { + $cloneable = null; + $object = new ReflectionObject($original); + + // Check the blacklist before asking PHP reflection to work around + // https://bugs.php.net/bug.php?id=53967 + if ($object->isInternal() && + isset(self::$uncloneableExtensions[$object->getExtensionName()])) { + $cloneable = false; + } + + if ($cloneable === null) { + foreach (self::$uncloneableClasses as $class) { + if ($original instanceof $class) { + $cloneable = false; + + break; + } + } + } + + if ($cloneable === null) { + $cloneable = $object->isCloneable(); + } + + if ($cloneable === null && $object->hasMethod('__clone')) { + $method = $object->getMethod('__clone'); + $cloneable = $method->isPublic(); + } + + if ($cloneable === null) { + $cloneable = true; + } + + if ($cloneable) { + try { + return clone $original; + } catch (\Exception $e) { + return $original; + } + } else { + return $original; + } + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/InvocationMocker.php b/vendor/phpunit/phpunit/src/Framework/MockObject/InvocationMocker.php new file mode 100644 index 0000000..d93faaa --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/InvocationMocker.php @@ -0,0 +1,186 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use Exception; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Builder\InvocationMocker as BuilderInvocationMocker; +use PHPUnit\Framework\MockObject\Builder\Match; +use PHPUnit\Framework\MockObject\Builder\NamespaceMatch; +use PHPUnit\Framework\MockObject\Matcher\DeferredError; +use PHPUnit\Framework\MockObject\Matcher\Invocation as MatcherInvocation; +use PHPUnit\Framework\MockObject\Stub\MatcherCollection; + +/** + * Mocker for invocations which are sent from + * MockObject objects. + * + * Keeps track of all expectations and stubs as well as registering + * identifications for builders. + */ +class InvocationMocker implements MatcherCollection, Invokable, NamespaceMatch +{ + /** + * @var MatcherInvocation[] + */ + private $matchers = []; + + /** + * @var Match[] + */ + private $builderMap = []; + + /** + * @var string[] + */ + private $configurableMethods; + + /** + * @var bool + */ + private $returnValueGeneration; + + public function __construct(array $configurableMethods, bool $returnValueGeneration) + { + $this->configurableMethods = $configurableMethods; + $this->returnValueGeneration = $returnValueGeneration; + } + + public function addMatcher(MatcherInvocation $matcher): void + { + $this->matchers[] = $matcher; + } + + public function hasMatchers() + { + foreach ($this->matchers as $matcher) { + if ($matcher->hasMatchers()) { + return true; + } + } + + return false; + } + + /** + * @return null|bool + */ + public function lookupId($id) + { + if (isset($this->builderMap[$id])) { + return $this->builderMap[$id]; + } + } + + /** + * @throws RuntimeException + */ + public function registerId($id, Match $builder): void + { + if (isset($this->builderMap[$id])) { + throw new RuntimeException( + 'Match builder with id <' . $id . '> is already registered.' + ); + } + + $this->builderMap[$id] = $builder; + } + + /** + * @return BuilderInvocationMocker + */ + public function expects(MatcherInvocation $matcher) + { + return new BuilderInvocationMocker( + $this, + $matcher, + $this->configurableMethods + ); + } + + /** + * @throws Exception + */ + public function invoke(Invocation $invocation) + { + $exception = null; + $hasReturnValue = false; + $returnValue = null; + + foreach ($this->matchers as $match) { + try { + if ($match->matches($invocation)) { + $value = $match->invoked($invocation); + + if (!$hasReturnValue) { + $returnValue = $value; + $hasReturnValue = true; + } + } + } catch (Exception $e) { + $exception = $e; + } + } + + if ($exception !== null) { + throw $exception; + } + + if ($hasReturnValue) { + return $returnValue; + } + + if ($this->returnValueGeneration === false) { + $exception = new ExpectationFailedException( + \sprintf( + 'Return value inference disabled and no expectation set up for %s::%s()', + $invocation->getClassName(), + $invocation->getMethodName() + ) + ); + + if (\strtolower($invocation->getMethodName()) === '__tostring') { + $this->addMatcher(new DeferredError($exception)); + + return ''; + } + + throw $exception; + } + + return $invocation->generateReturnValue(); + } + + /** + * @return bool + */ + public function matches(Invocation $invocation) + { + foreach ($this->matchers as $matcher) { + if (!$matcher->matches($invocation)) { + return false; + } + } + + return true; + } + + /** + * @throws \PHPUnit\Framework\ExpectationFailedException + * + * @return bool + */ + public function verify() + { + foreach ($this->matchers as $matcher) { + $matcher->verify(); + } + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Invokable.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Invokable.php new file mode 100644 index 0000000..3411895 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Invokable.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +/** + * Interface for classes which can be invoked. + * + * The invocation will be taken from a mock object and passed to an object + * of this class. + */ +interface Invokable extends Verifiable +{ + /** + * Invokes the invocation object $invocation so that it can be checked for + * expectations or matched against stubs. + * + * @param Invocation $invocation The invocation object passed from mock object + * + * @return object + */ + public function invoke(Invocation $invocation); + + /** + * Checks if the invocation matches. + * + * @param Invocation $invocation The invocation object passed from mock object + * + * @return bool + */ + public function matches(Invocation $invocation); +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher.php new file mode 100644 index 0000000..e0552a6 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher.php @@ -0,0 +1,309 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount; +use PHPUnit\Framework\MockObject\Matcher\AnyParameters; +use PHPUnit\Framework\MockObject\Matcher\Invocation as MatcherInvocation; +use PHPUnit\Framework\MockObject\Matcher\InvokedCount; +use PHPUnit\Framework\MockObject\Matcher\MethodName; +use PHPUnit\Framework\MockObject\Matcher\Parameters; +use PHPUnit\Framework\TestFailure; + +/** + * Main matcher which defines a full expectation using method, parameter and + * invocation matchers. + * This matcher encapsulates all the other matchers and allows the builder to + * set the specific matchers when the appropriate methods are called (once(), + * where() etc.). + * + * All properties are public so that they can easily be accessed by the builder. + */ +class Matcher implements MatcherInvocation +{ + /** + * @var MatcherInvocation + */ + private $invocationMatcher; + + /** + * @var mixed + */ + private $afterMatchBuilderId; + + /** + * @var bool + */ + private $afterMatchBuilderIsInvoked = false; + + /** + * @var MethodName + */ + private $methodNameMatcher; + + /** + * @var Parameters + */ + private $parametersMatcher; + + /** + * @var Stub + */ + private $stub; + + public function __construct(MatcherInvocation $invocationMatcher) + { + $this->invocationMatcher = $invocationMatcher; + } + + public function hasMatchers(): bool + { + return $this->invocationMatcher !== null && !$this->invocationMatcher instanceof AnyInvokedCount; + } + + public function hasMethodNameMatcher(): bool + { + return $this->methodNameMatcher !== null; + } + + public function getMethodNameMatcher(): MethodName + { + return $this->methodNameMatcher; + } + + public function setMethodNameMatcher(MethodName $matcher): void + { + $this->methodNameMatcher = $matcher; + } + + public function hasParametersMatcher(): bool + { + return $this->parametersMatcher !== null; + } + + public function getParametersMatcher(): Parameters + { + return $this->parametersMatcher; + } + + public function setParametersMatcher($matcher): void + { + $this->parametersMatcher = $matcher; + } + + public function setStub($stub): void + { + $this->stub = $stub; + } + + public function setAfterMatchBuilderId($id): void + { + $this->afterMatchBuilderId = $id; + } + + /** + * @throws \Exception + * @throws RuntimeException + * @throws ExpectationFailedException + */ + public function invoked(Invocation $invocation) + { + if ($this->invocationMatcher === null) { + throw new RuntimeException( + 'No invocation matcher is set' + ); + } + + if ($this->methodNameMatcher === null) { + throw new RuntimeException('No method matcher is set'); + } + + if ($this->afterMatchBuilderId !== null) { + $builder = $invocation->getObject() + ->__phpunit_getInvocationMocker() + ->lookupId($this->afterMatchBuilderId); + + if (!$builder) { + throw new RuntimeException( + \sprintf( + 'No builder found for match builder identification <%s>', + $this->afterMatchBuilderId + ) + ); + } + + $matcher = $builder->getMatcher(); + + if ($matcher && $matcher->invocationMatcher->hasBeenInvoked()) { + $this->afterMatchBuilderIsInvoked = true; + } + } + + $this->invocationMatcher->invoked($invocation); + + try { + if ($this->parametersMatcher !== null && + !$this->parametersMatcher->matches($invocation)) { + $this->parametersMatcher->verify(); + } + } catch (ExpectationFailedException $e) { + throw new ExpectationFailedException( + \sprintf( + "Expectation failed for %s when %s\n%s", + $this->methodNameMatcher->toString(), + $this->invocationMatcher->toString(), + $e->getMessage() + ), + $e->getComparisonFailure() + ); + } + + if ($this->stub) { + return $this->stub->invoke($invocation); + } + + return $invocation->generateReturnValue(); + } + + /** + * @throws RuntimeException + * @throws ExpectationFailedException + * + * @return bool + */ + public function matches(Invocation $invocation) + { + if ($this->afterMatchBuilderId !== null) { + $builder = $invocation->getObject() + ->__phpunit_getInvocationMocker() + ->lookupId($this->afterMatchBuilderId); + + if (!$builder) { + throw new RuntimeException( + \sprintf( + 'No builder found for match builder identification <%s>', + $this->afterMatchBuilderId + ) + ); + } + + $matcher = $builder->getMatcher(); + + if (!$matcher) { + return false; + } + + if (!$matcher->invocationMatcher->hasBeenInvoked()) { + return false; + } + } + + if ($this->invocationMatcher === null) { + throw new RuntimeException( + 'No invocation matcher is set' + ); + } + + if ($this->methodNameMatcher === null) { + throw new RuntimeException('No method matcher is set'); + } + + if (!$this->invocationMatcher->matches($invocation)) { + return false; + } + + try { + if (!$this->methodNameMatcher->matches($invocation)) { + return false; + } + } catch (ExpectationFailedException $e) { + throw new ExpectationFailedException( + \sprintf( + "Expectation failed for %s when %s\n%s", + $this->methodNameMatcher->toString(), + $this->invocationMatcher->toString(), + $e->getMessage() + ), + $e->getComparisonFailure() + ); + } + + return true; + } + + /** + * @throws RuntimeException + * @throws ExpectationFailedException + */ + public function verify(): void + { + if ($this->invocationMatcher === null) { + throw new RuntimeException( + 'No invocation matcher is set' + ); + } + + if ($this->methodNameMatcher === null) { + throw new RuntimeException('No method matcher is set'); + } + + try { + $this->invocationMatcher->verify(); + + if ($this->parametersMatcher === null) { + $this->parametersMatcher = new AnyParameters; + } + + $invocationIsAny = $this->invocationMatcher instanceof AnyInvokedCount; + $invocationIsNever = $this->invocationMatcher instanceof InvokedCount && $this->invocationMatcher->isNever(); + + if (!$invocationIsAny && !$invocationIsNever) { + $this->parametersMatcher->verify(); + } + } catch (ExpectationFailedException $e) { + throw new ExpectationFailedException( + \sprintf( + "Expectation failed for %s when %s.\n%s", + $this->methodNameMatcher->toString(), + $this->invocationMatcher->toString(), + TestFailure::exceptionToString($e) + ) + ); + } + } + + public function toString(): string + { + $list = []; + + if ($this->invocationMatcher !== null) { + $list[] = $this->invocationMatcher->toString(); + } + + if ($this->methodNameMatcher !== null) { + $list[] = 'where ' . $this->methodNameMatcher->toString(); + } + + if ($this->parametersMatcher !== null) { + $list[] = 'and ' . $this->parametersMatcher->toString(); + } + + if ($this->afterMatchBuilderId !== null) { + $list[] = 'after ' . $this->afterMatchBuilderId; + } + + if ($this->stub !== null) { + $list[] = 'will ' . $this->stub->toString(); + } + + return \implode(' ', $list); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/AnyInvokedCount.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/AnyInvokedCount.php new file mode 100644 index 0000000..ddabf92 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/AnyInvokedCount.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Matcher; + +/** + * Invocation matcher which checks if a method has been invoked zero or more + * times. This matcher will always match. + */ +class AnyInvokedCount extends InvokedRecorder +{ + public function toString(): string + { + return 'invoked zero or more times'; + } + + public function verify(): void + { + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/AnyParameters.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/AnyParameters.php new file mode 100644 index 0000000..48eb561 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/AnyParameters.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Matcher; + +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; + +/** + * Invocation matcher which allows any parameters to a method. + */ +class AnyParameters extends StatelessInvocation +{ + public function toString(): string + { + return 'with any parameters'; + } + + /** + * @return bool + */ + public function matches(BaseInvocation $invocation) + { + return true; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/ConsecutiveParameters.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/ConsecutiveParameters.php new file mode 100644 index 0000000..344849d --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/ConsecutiveParameters.php @@ -0,0 +1,126 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Matcher; + +use PHPUnit\Framework\Constraint\Constraint; +use PHPUnit\Framework\Constraint\IsEqual; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; + +/** + * Invocation matcher which looks for sets of specific parameters in the invocations. + * + * Checks the parameters of the incoming invocations, the parameter list is + * checked against the defined constraints in $parameters. If the constraint + * is met it will return true in matches(). + * + * It takes a list of match groups and and increases a call index after each invocation. + * So the first invocation uses the first group of constraints, the second the next and so on. + */ +class ConsecutiveParameters extends StatelessInvocation +{ + /** + * @var array + */ + private $parameterGroups = []; + + /** + * @var array + */ + private $invocations = []; + + /** + * @throws \PHPUnit\Framework\Exception + */ + public function __construct(array $parameterGroups) + { + foreach ($parameterGroups as $index => $parameters) { + foreach ($parameters as $parameter) { + if (!$parameter instanceof Constraint) { + $parameter = new IsEqual($parameter); + } + + $this->parameterGroups[$index][] = $parameter; + } + } + } + + public function toString(): string + { + return 'with consecutive parameters'; + } + + /** + * @throws \PHPUnit\Framework\ExpectationFailedException + * + * @return bool + */ + public function matches(BaseInvocation $invocation) + { + $this->invocations[] = $invocation; + $callIndex = \count($this->invocations) - 1; + + $this->verifyInvocation($invocation, $callIndex); + + return false; + } + + public function verify(): void + { + foreach ($this->invocations as $callIndex => $invocation) { + $this->verifyInvocation($invocation, $callIndex); + } + } + + /** + * Verify a single invocation + * + * @param int $callIndex + * + * @throws ExpectationFailedException + */ + private function verifyInvocation(BaseInvocation $invocation, $callIndex): void + { + if (!isset($this->parameterGroups[$callIndex])) { + // no parameter assertion for this call index + return; + } + + if ($invocation === null) { + throw new ExpectationFailedException( + 'Mocked method does not exist.' + ); + } + + $parameters = $this->parameterGroups[$callIndex]; + + if (\count($invocation->getParameters()) < \count($parameters)) { + throw new ExpectationFailedException( + \sprintf( + 'Parameter count for invocation %s is too low.', + $invocation->toString() + ) + ); + } + + foreach ($parameters as $i => $parameter) { + $parameter->evaluate( + $invocation->getParameters()[$i], + \sprintf( + 'Parameter %s for invocation #%d %s does not match expected ' . + 'value.', + $i, + $callIndex, + $invocation->toString() + ) + ); + } + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/DeferredError.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/DeferredError.php new file mode 100644 index 0000000..fae95e4 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/DeferredError.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Matcher; + +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; + +class DeferredError extends StatelessInvocation +{ + /** + * @var \Throwable + */ + private $exception; + + public function __construct(\Throwable $exception) + { + $this->exception = $exception; + } + + public function verify(): void + { + throw $this->exception; + } + + public function toString(): string + { + return ''; + } + + public function matches(BaseInvocation $invocation): bool + { + return true; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/Invocation.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/Invocation.php new file mode 100644 index 0000000..d3f93b2 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/Invocation.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Matcher; + +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; +use PHPUnit\Framework\MockObject\Verifiable; +use PHPUnit\Framework\SelfDescribing; + +/** + * Interface for classes which matches an invocation based on its + * method name, argument, order or call count. + */ +interface Invocation extends SelfDescribing, Verifiable +{ + /** + * Registers the invocation $invocation in the object as being invoked. + * This will only occur after matches() returns true which means the + * current invocation is the correct one. + * + * The matcher can store information from the invocation which can later + * be checked in verify(), or it can check the values directly and throw + * and exception if an expectation is not met. + * + * If the matcher is a stub it will also have a return value. + * + * @param BaseInvocation $invocation Object containing information on a mocked or stubbed method which was invoked + */ + public function invoked(BaseInvocation $invocation); + + /** + * Checks if the invocation $invocation matches the current rules. If it does + * the matcher will get the invoked() method called which should check if an + * expectation is met. + * + * @param BaseInvocation $invocation Object containing information on a mocked or stubbed method which was invoked + * + * @return bool + */ + public function matches(BaseInvocation $invocation); +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtIndex.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtIndex.php new file mode 100644 index 0000000..2584ef3 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtIndex.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Matcher; + +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; + +/** + * Invocation matcher which checks if a method was invoked at a certain index. + * + * If the expected index number does not match the current invocation index it + * will not match which means it skips all method and parameter matching. Only + * once the index is reached will the method and parameter start matching and + * verifying. + * + * If the index is never reached it will throw an exception in index. + */ +class InvokedAtIndex implements Invocation +{ + /** + * @var int + */ + private $sequenceIndex; + + /** + * @var int + */ + private $currentIndex = -1; + + /** + * @param int $sequenceIndex + */ + public function __construct($sequenceIndex) + { + $this->sequenceIndex = $sequenceIndex; + } + + public function toString(): string + { + return 'invoked at sequence index ' . $this->sequenceIndex; + } + + /** + * @return bool + */ + public function matches(BaseInvocation $invocation) + { + $this->currentIndex++; + + return $this->currentIndex == $this->sequenceIndex; + } + + public function invoked(BaseInvocation $invocation): void + { + } + + /** + * Verifies that the current expectation is valid. If everything is OK the + * code should just return, if not it must throw an exception. + * + * @throws ExpectationFailedException + */ + public function verify(): void + { + if ($this->currentIndex < $this->sequenceIndex) { + throw new ExpectationFailedException( + \sprintf( + 'The expected invocation at index %s was never reached.', + $this->sequenceIndex + ) + ); + } + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtLeastCount.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtLeastCount.php new file mode 100644 index 0000000..ada506f --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtLeastCount.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Matcher; + +use PHPUnit\Framework\ExpectationFailedException; + +/** + * Invocation matcher which checks if a method has been invoked at least + * N times. + */ +class InvokedAtLeastCount extends InvokedRecorder +{ + /** + * @var int + */ + private $requiredInvocations; + + /** + * @param int $requiredInvocations + */ + public function __construct($requiredInvocations) + { + $this->requiredInvocations = $requiredInvocations; + } + + public function toString(): string + { + return 'invoked at least ' . $this->requiredInvocations . ' times'; + } + + /** + * Verifies that the current expectation is valid. If everything is OK the + * code should just return, if not it must throw an exception. + * + * @throws ExpectationFailedException + */ + public function verify(): void + { + $count = $this->getInvocationCount(); + + if ($count < $this->requiredInvocations) { + throw new ExpectationFailedException( + 'Expected invocation at least ' . $this->requiredInvocations . + ' times but it occurred ' . $count . ' time(s).' + ); + } + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtLeastOnce.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtLeastOnce.php new file mode 100644 index 0000000..33b6b8f --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtLeastOnce.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Matcher; + +use PHPUnit\Framework\ExpectationFailedException; + +/** + * Invocation matcher which checks if a method has been invoked at least one + * time. + * + * If the number of invocations is 0 it will throw an exception in verify. + */ +class InvokedAtLeastOnce extends InvokedRecorder +{ + public function toString(): string + { + return 'invoked at least once'; + } + + /** + * Verifies that the current expectation is valid. If everything is OK the + * code should just return, if not it must throw an exception. + * + * @throws ExpectationFailedException + */ + public function verify(): void + { + $count = $this->getInvocationCount(); + + if ($count < 1) { + throw new ExpectationFailedException( + 'Expected invocation at least once but it never occurred.' + ); + } + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtMostCount.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtMostCount.php new file mode 100644 index 0000000..981ef36 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedAtMostCount.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Matcher; + +use PHPUnit\Framework\ExpectationFailedException; + +/** + * Invocation matcher which checks if a method has been invoked at least + * N times. + */ +class InvokedAtMostCount extends InvokedRecorder +{ + /** + * @var int + */ + private $allowedInvocations; + + /** + * @param int $allowedInvocations + */ + public function __construct($allowedInvocations) + { + $this->allowedInvocations = $allowedInvocations; + } + + public function toString(): string + { + return 'invoked at most ' . $this->allowedInvocations . ' times'; + } + + /** + * Verifies that the current expectation is valid. If everything is OK the + * code should just return, if not it must throw an exception. + * + * @throws ExpectationFailedException + */ + public function verify(): void + { + $count = $this->getInvocationCount(); + + if ($count > $this->allowedInvocations) { + throw new ExpectationFailedException( + 'Expected invocation at most ' . $this->allowedInvocations . + ' times but it occurred ' . $count . ' time(s).' + ); + } + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedCount.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedCount.php new file mode 100644 index 0000000..f4cb1ab --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedCount.php @@ -0,0 +1,106 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Matcher; + +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; + +/** + * Invocation matcher which checks if a method has been invoked a certain amount + * of times. + * If the number of invocations exceeds the value it will immediately throw an + * exception, + * If the number is less it will later be checked in verify() and also throw an + * exception. + */ +class InvokedCount extends InvokedRecorder +{ + /** + * @var int + */ + private $expectedCount; + + /** + * @param int $expectedCount + */ + public function __construct($expectedCount) + { + $this->expectedCount = $expectedCount; + } + + /** + * @return bool + */ + public function isNever() + { + return $this->expectedCount === 0; + } + + public function toString(): string + { + return 'invoked ' . $this->expectedCount . ' time(s)'; + } + + /** + * @throws ExpectationFailedException + */ + public function invoked(BaseInvocation $invocation): void + { + parent::invoked($invocation); + + $count = $this->getInvocationCount(); + + if ($count > $this->expectedCount) { + $message = $invocation->toString() . ' '; + + switch ($this->expectedCount) { + case 0: + $message .= 'was not expected to be called.'; + + break; + + case 1: + $message .= 'was not expected to be called more than once.'; + + break; + + default: + $message .= \sprintf( + 'was not expected to be called more than %d times.', + $this->expectedCount + ); + } + + throw new ExpectationFailedException($message); + } + } + + /** + * Verifies that the current expectation is valid. If everything is OK the + * code should just return, if not it must throw an exception. + * + * @throws ExpectationFailedException + */ + public function verify(): void + { + $count = $this->getInvocationCount(); + + if ($count !== $this->expectedCount) { + throw new ExpectationFailedException( + \sprintf( + 'Method was expected to be called %d times, ' . + 'actually called %d times.', + $this->expectedCount, + $count + ) + ); + } + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedRecorder.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedRecorder.php new file mode 100644 index 0000000..216aae7 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/InvokedRecorder.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Matcher; + +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; + +/** + * Records invocations and provides convenience methods for checking them later + * on. + * This abstract class can be implemented by matchers which needs to check the + * number of times an invocation has occurred. + */ +abstract class InvokedRecorder implements Invocation +{ + /** + * @var BaseInvocation[] + */ + private $invocations = []; + + /** + * @return int + */ + public function getInvocationCount() + { + return \count($this->invocations); + } + + /** + * @return BaseInvocation[] + */ + public function getInvocations() + { + return $this->invocations; + } + + /** + * @return bool + */ + public function hasBeenInvoked() + { + return \count($this->invocations) > 0; + } + + public function invoked(BaseInvocation $invocation): void + { + $this->invocations[] = $invocation; + } + + /** + * @return bool + */ + public function matches(BaseInvocation $invocation) + { + return true; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/MethodName.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/MethodName.php new file mode 100644 index 0000000..7aea38a --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/MethodName.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Matcher; + +use PHPUnit\Framework\Constraint\Constraint; +use PHPUnit\Framework\Constraint\IsEqual; +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; +use PHPUnit\Util\InvalidArgumentHelper; + +/** + * Invocation matcher which looks for a specific method name in the invocations. + * + * Checks the method name all incoming invocations, the name is checked against + * the defined constraint $constraint. If the constraint is met it will return + * true in matches(). + */ +class MethodName extends StatelessInvocation +{ + /** + * @var Constraint + */ + private $constraint; + + /** + * @param Constraint|string + * + * @throws Constraint + * @throws \PHPUnit\Framework\Exception + */ + public function __construct($constraint) + { + if (!$constraint instanceof Constraint) { + if (!\is_string($constraint)) { + throw InvalidArgumentHelper::factory(1, 'string'); + } + + $constraint = new IsEqual( + $constraint, + 0, + 10, + false, + true + ); + } + + $this->constraint = $constraint; + } + + public function toString(): string + { + return 'method name ' . $this->constraint->toString(); + } + + /** + * @return bool + */ + public function matches(BaseInvocation $invocation) + { + return $this->constraint->evaluate($invocation->getMethodName(), '', true); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/Parameters.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/Parameters.php new file mode 100644 index 0000000..a74e3a3 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/Parameters.php @@ -0,0 +1,158 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Matcher; + +use PHPUnit\Framework\Constraint\Constraint; +use PHPUnit\Framework\Constraint\IsAnything; +use PHPUnit\Framework\Constraint\IsEqual; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; + +/** + * Invocation matcher which looks for specific parameters in the invocations. + * + * Checks the parameters of all incoming invocations, the parameter list is + * checked against the defined constraints in $parameters. If the constraint + * is met it will return true in matches(). + */ +class Parameters extends StatelessInvocation +{ + /** + * @var Constraint[] + */ + private $parameters = []; + + /** + * @var BaseInvocation + */ + private $invocation; + + /** + * @var ExpectationFailedException + */ + private $parameterVerificationResult; + + /** + * @throws \PHPUnit\Framework\Exception + */ + public function __construct(array $parameters) + { + foreach ($parameters as $parameter) { + if (!($parameter instanceof Constraint)) { + $parameter = new IsEqual( + $parameter + ); + } + + $this->parameters[] = $parameter; + } + } + + public function toString(): string + { + $text = 'with parameter'; + + foreach ($this->parameters as $index => $parameter) { + if ($index > 0) { + $text .= ' and'; + } + + $text .= ' ' . $index . ' ' . $parameter->toString(); + } + + return $text; + } + + /** + * @throws \Exception + * + * @return bool + */ + public function matches(BaseInvocation $invocation) + { + $this->invocation = $invocation; + $this->parameterVerificationResult = null; + + try { + $this->parameterVerificationResult = $this->verify(); + + return $this->parameterVerificationResult; + } catch (ExpectationFailedException $e) { + $this->parameterVerificationResult = $e; + + throw $this->parameterVerificationResult; + } + } + + /** + * Checks if the invocation $invocation matches the current rules. If it + * does the matcher will get the invoked() method called which should check + * if an expectation is met. + * + * @throws ExpectationFailedException + * + * @return bool + */ + public function verify() + { + if (isset($this->parameterVerificationResult)) { + return $this->guardAgainstDuplicateEvaluationOfParameterConstraints(); + } + + if ($this->invocation === null) { + throw new ExpectationFailedException('Mocked method does not exist.'); + } + + if (\count($this->invocation->getParameters()) < \count($this->parameters)) { + $message = 'Parameter count for invocation %s is too low.'; + + // The user called `->with($this->anything())`, but may have meant + // `->withAnyParameters()`. + // + // @see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/199 + if (\count($this->parameters) === 1 && + \get_class($this->parameters[0]) === IsAnything::class) { + $message .= "\nTo allow 0 or more parameters with any value, omit ->with() or use ->withAnyParameters() instead."; + } + + throw new ExpectationFailedException( + \sprintf($message, $this->invocation->toString()) + ); + } + + foreach ($this->parameters as $i => $parameter) { + $parameter->evaluate( + $this->invocation->getParameters()[$i], + \sprintf( + 'Parameter %s for invocation %s does not match expected ' . + 'value.', + $i, + $this->invocation->toString() + ) + ); + } + + return true; + } + + /** + * @throws ExpectationFailedException + * + * @return bool + */ + private function guardAgainstDuplicateEvaluationOfParameterConstraints() + { + if ($this->parameterVerificationResult instanceof \Exception) { + throw $this->parameterVerificationResult; + } + + return (bool) $this->parameterVerificationResult; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/StatelessInvocation.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/StatelessInvocation.php new file mode 100644 index 0000000..f4e50a6 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher/StatelessInvocation.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Matcher; + +use PHPUnit\Framework\MockObject\Invocation as BaseInvocation; + +/** + * Invocation matcher which does not care about previous state from earlier + * invocations. + * + * This abstract class can be implemented by matchers which does not care about + * state but only the current run-time value of the invocation itself. + */ +abstract class StatelessInvocation implements Invocation +{ + /** + * Registers the invocation $invocation in the object as being invoked. + * This will only occur after matches() returns true which means the + * current invocation is the correct one. + * + * The matcher can store information from the invocation which can later + * be checked in verify(), or it can check the values directly and throw + * and exception if an expectation is not met. + * + * If the matcher is a stub it will also have a return value. + * + * @param BaseInvocation $invocation Object containing information on a mocked or stubbed method which was invoked + */ + public function invoked(BaseInvocation $invocation) + { + } + + /** + * Checks if the invocation $invocation matches the current rules. If it does + * the matcher will get the invoked() method called which should check if an + * expectation is met. + * + * @return bool + */ + public function verify() + { + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php b/vendor/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php new file mode 100644 index 0000000..3199afd --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php @@ -0,0 +1,408 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use PHPUnit\Framework\TestCase; + +/** + * Implementation of the Builder pattern for Mock objects. + */ +class MockBuilder +{ + /** + * @var TestCase + */ + private $testCase; + + /** + * @var string + */ + private $type; + + /** + * @var array + */ + private $methods = []; + + /** + * @var array + */ + private $methodsExcept = []; + + /** + * @var string + */ + private $mockClassName = ''; + + /** + * @var array + */ + private $constructorArgs = []; + + /** + * @var bool + */ + private $originalConstructor = true; + + /** + * @var bool + */ + private $originalClone = true; + + /** + * @var bool + */ + private $autoload = true; + + /** + * @var bool + */ + private $cloneArguments = false; + + /** + * @var bool + */ + private $callOriginalMethods = false; + + /** + * @var object + */ + private $proxyTarget; + + /** + * @var bool + */ + private $allowMockingUnknownTypes = true; + + /** + * @var bool + */ + private $returnValueGeneration = true; + + /** + * @var Generator + */ + private $generator; + + /** + * @param array|string $type + */ + public function __construct(TestCase $testCase, $type) + { + $this->testCase = $testCase; + $this->type = $type; + $this->generator = new Generator; + } + + /** + * Creates a mock object using a fluent interface. + * + * @return MockObject + */ + public function getMock() + { + $object = $this->generator->getMock( + $this->type, + $this->methods, + $this->constructorArgs, + $this->mockClassName, + $this->originalConstructor, + $this->originalClone, + $this->autoload, + $this->cloneArguments, + $this->callOriginalMethods, + $this->proxyTarget, + $this->allowMockingUnknownTypes, + $this->returnValueGeneration + ); + + $this->testCase->registerMockObject($object); + + return $object; + } + + /** + * Creates a mock object for an abstract class using a fluent interface. + * + * @return MockObject + */ + public function getMockForAbstractClass() + { + $object = $this->generator->getMockForAbstractClass( + $this->type, + $this->constructorArgs, + $this->mockClassName, + $this->originalConstructor, + $this->originalClone, + $this->autoload, + $this->methods, + $this->cloneArguments + ); + + $this->testCase->registerMockObject($object); + + return $object; + } + + /** + * Creates a mock object for a trait using a fluent interface. + * + * @return MockObject + */ + public function getMockForTrait() + { + $object = $this->generator->getMockForTrait( + $this->type, + $this->constructorArgs, + $this->mockClassName, + $this->originalConstructor, + $this->originalClone, + $this->autoload, + $this->methods, + $this->cloneArguments + ); + + $this->testCase->registerMockObject($object); + + return $object; + } + + /** + * Specifies the subset of methods to mock. Default is to mock none of them. + * + * @return MockBuilder + */ + public function setMethods(array $methods = null) + { + $this->methods = $methods; + + return $this; + } + + /** + * Specifies the subset of methods to not mock. Default is to mock all of them. + * + * @return MockBuilder + */ + public function setMethodsExcept(array $methods = []) + { + $this->methodsExcept = $methods; + + $this->setMethods( + \array_diff( + $this->generator->getClassMethods($this->type), + $this->methodsExcept + ) + ); + + return $this; + } + + /** + * Specifies the arguments for the constructor. + * + * @return MockBuilder + */ + public function setConstructorArgs(array $args) + { + $this->constructorArgs = $args; + + return $this; + } + + /** + * Specifies the name for the mock class. + * + * @param string $name + * + * @return MockBuilder + */ + public function setMockClassName($name) + { + $this->mockClassName = $name; + + return $this; + } + + /** + * Disables the invocation of the original constructor. + * + * @return MockBuilder + */ + public function disableOriginalConstructor() + { + $this->originalConstructor = false; + + return $this; + } + + /** + * Enables the invocation of the original constructor. + * + * @return MockBuilder + */ + public function enableOriginalConstructor() + { + $this->originalConstructor = true; + + return $this; + } + + /** + * Disables the invocation of the original clone constructor. + * + * @return MockBuilder + */ + public function disableOriginalClone() + { + $this->originalClone = false; + + return $this; + } + + /** + * Enables the invocation of the original clone constructor. + * + * @return MockBuilder + */ + public function enableOriginalClone() + { + $this->originalClone = true; + + return $this; + } + + /** + * Disables the use of class autoloading while creating the mock object. + * + * @return MockBuilder + */ + public function disableAutoload() + { + $this->autoload = false; + + return $this; + } + + /** + * Enables the use of class autoloading while creating the mock object. + * + * @return MockBuilder + */ + public function enableAutoload() + { + $this->autoload = true; + + return $this; + } + + /** + * Disables the cloning of arguments passed to mocked methods. + * + * @return MockBuilder + */ + public function disableArgumentCloning() + { + $this->cloneArguments = false; + + return $this; + } + + /** + * Enables the cloning of arguments passed to mocked methods. + * + * @return MockBuilder + */ + public function enableArgumentCloning() + { + $this->cloneArguments = true; + + return $this; + } + + /** + * Enables the invocation of the original methods. + * + * @return MockBuilder + */ + public function enableProxyingToOriginalMethods() + { + $this->callOriginalMethods = true; + + return $this; + } + + /** + * Disables the invocation of the original methods. + * + * @return MockBuilder + */ + public function disableProxyingToOriginalMethods() + { + $this->callOriginalMethods = false; + $this->proxyTarget = null; + + return $this; + } + + /** + * Sets the proxy target. + * + * @param object $object + * + * @return MockBuilder + */ + public function setProxyTarget($object) + { + $this->proxyTarget = $object; + + return $this; + } + + /** + * @return MockBuilder + */ + public function allowMockingUnknownTypes() + { + $this->allowMockingUnknownTypes = true; + + return $this; + } + + /** + * @return MockBuilder + */ + public function disallowMockingUnknownTypes() + { + $this->allowMockingUnknownTypes = false; + + return $this; + } + + /** + * @return MockBuilder + */ + public function enableAutoReturnValueGeneration() + { + $this->returnValueGeneration = true; + + return $this; + } + + /** + * @return MockBuilder + */ + public function disableAutoReturnValueGeneration() + { + $this->returnValueGeneration = false; + + return $this; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php b/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php new file mode 100644 index 0000000..39e7ac2 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php @@ -0,0 +1,354 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use ReflectionClass; +use ReflectionException; +use ReflectionMethod; +use Text_Template; + +final class MockMethod +{ + /** + * @var Text_Template[] + */ + private static $templates = []; + + /** + * @var string + */ + private $className; + + /** + * @var string + */ + private $methodName; + + /** + * @var bool + */ + private $cloneArguments; + + /** + * @var string string + */ + private $modifier; + + /** + * @var string + */ + private $argumentsForDeclaration; + + /** + * @var string + */ + private $argumentsForCall; + + /** + * @var string + */ + private $returnType; + + /** + * @var string + */ + private $reference; + + /** + * @var bool + */ + private $callOriginalMethod; + + /** + * @var bool + */ + private $static; + + /** + * @var ?string + */ + private $deprecation; + + /** + * @var bool + */ + private $allowsReturnNull; + + public static function fromReflection(ReflectionMethod $method, bool $callOriginalMethod, bool $cloneArguments): self + { + if ($method->isPrivate()) { + $modifier = 'private'; + } elseif ($method->isProtected()) { + $modifier = 'protected'; + } else { + $modifier = 'public'; + } + + if ($method->isStatic()) { + $modifier .= ' static'; + } + + if ($method->returnsReference()) { + $reference = '&'; + } else { + $reference = ''; + } + + if ($method->hasReturnType()) { + $returnType = (string) $method->getReturnType(); + } else { + $returnType = ''; + } + + $docComment = $method->getDocComment(); + + if (\is_string($docComment) + && \preg_match('#\*[ \t]*+@deprecated[ \t]*+(.*?)\r?+\n[ \t]*+\*(?:[ \t]*+@|/$)#s', $docComment, $deprecation) + ) { + $deprecation = \trim(\preg_replace('#[ \t]*\r?\n[ \t]*+\*[ \t]*+#', ' ', $deprecation[1])); + } else { + $deprecation = null; + } + + return new self( + $method->getDeclaringClass()->getName(), + $method->getName(), + $cloneArguments, + $modifier, + self::getMethodParameters($method), + self::getMethodParameters($method, true), + $returnType, + $reference, + $callOriginalMethod, + $method->isStatic(), + $deprecation, + $method->hasReturnType() && $method->getReturnType()->allowsNull() + ); + } + + public static function fromName(string $fullClassName, string $methodName, bool $cloneArguments): self + { + return new self( + $fullClassName, + $methodName, + $cloneArguments, + 'public', + '', + '', + '', + '', + false, + false, + null, + false + ); + } + + public function __construct(string $className, string $methodName, bool $cloneArguments, string $modifier, string $argumentsForDeclaration, string $argumentsForCall, string $returnType, string $reference, bool $callOriginalMethod, bool $static, ?string $deprecation, bool $allowsReturnNull) + { + $this->className = $className; + $this->methodName = $methodName; + $this->cloneArguments = $cloneArguments; + $this->modifier = $modifier; + $this->argumentsForDeclaration = $argumentsForDeclaration; + $this->argumentsForCall = $argumentsForCall; + $this->returnType = $returnType; + $this->reference = $reference; + $this->callOriginalMethod = $callOriginalMethod; + $this->static = $static; + $this->deprecation = $deprecation; + $this->allowsReturnNull = $allowsReturnNull; + } + + public function getName(): string + { + return $this->methodName; + } + + /** + * @throws \ReflectionException + * @throws \PHPUnit\Framework\MockObject\RuntimeException + * @throws \InvalidArgumentException + */ + public function generateCode(): string + { + if ($this->static) { + $templateFile = 'mocked_static_method.tpl'; + } elseif ($this->returnType === 'void') { + $templateFile = \sprintf( + '%s_method_void.tpl', + $this->callOriginalMethod ? 'proxied' : 'mocked' + ); + } else { + $templateFile = \sprintf( + '%s_method.tpl', + $this->callOriginalMethod ? 'proxied' : 'mocked' + ); + } + + $returnType = $this->returnType; + // @see https://bugs.php.net/bug.php?id=70722 + if ($returnType === 'self') { + $returnType = $this->className; + } + + // @see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/406 + if ($returnType === 'parent') { + $reflector = new ReflectionClass($this->className); + + $parentClass = $reflector->getParentClass(); + + if ($parentClass === false) { + throw new RuntimeException( + \sprintf( + 'Cannot mock %s::%s because "parent" return type declaration is used but %s does not have a parent class', + $this->className, + $this->methodName, + $this->className + ) + ); + } + + $returnType = $parentClass->getName(); + } + + $deprecation = $this->deprecation; + + if (null !== $this->deprecation) { + $deprecation = "The $this->className::$this->methodName method is deprecated ($this->deprecation)."; + $deprecationTemplate = $this->getTemplate('deprecation.tpl'); + + $deprecationTemplate->setVar([ + 'deprecation' => \var_export($deprecation, true), + ]); + + $deprecation = $deprecationTemplate->render(); + } + + $template = $this->getTemplate($templateFile); + + $template->setVar( + [ + 'arguments_decl' => $this->argumentsForDeclaration, + 'arguments_call' => $this->argumentsForCall, + 'return_delim' => $returnType ? ': ' : '', + 'return_type' => $this->allowsReturnNull ? '?' . $returnType : $returnType, + 'arguments_count' => !empty($this->argumentsForCall) ? \substr_count($this->argumentsForCall, ',') + 1 : 0, + 'class_name' => $this->className, + 'method_name' => $this->methodName, + 'modifier' => $this->modifier, + 'reference' => $this->reference, + 'clone_arguments' => $this->cloneArguments ? 'true' : 'false', + 'deprecation' => $deprecation, + ] + ); + + return $template->render(); + } + + private function getTemplate(string $template): Text_Template + { + $filename = __DIR__ . \DIRECTORY_SEPARATOR . 'Generator' . \DIRECTORY_SEPARATOR . $template; + + if (!isset(self::$templates[$filename])) { + self::$templates[$filename] = new Text_Template($filename); + } + + return self::$templates[$filename]; + } + + /** + * Returns the parameters of a function or method. + * + * @throws RuntimeException + */ + private static function getMethodParameters(ReflectionMethod $method, bool $forCall = false): string + { + $parameters = []; + + foreach ($method->getParameters() as $i => $parameter) { + $name = '$' . $parameter->getName(); + + /* Note: PHP extensions may use empty names for reference arguments + * or "..." for methods taking a variable number of arguments. + */ + if ($name === '$' || $name === '$...') { + $name = '$arg' . $i; + } + + if ($parameter->isVariadic()) { + if ($forCall) { + continue; + } + + $name = '...' . $name; + } + + $nullable = ''; + $default = ''; + $reference = ''; + $typeDeclaration = ''; + + if (!$forCall) { + if ($parameter->hasType() && $parameter->allowsNull()) { + $nullable = '?'; + } + + if ($parameter->hasType() && (string) $parameter->getType() !== 'self') { + $typeDeclaration = $parameter->getType() . ' '; + } else { + try { + $class = $parameter->getClass(); + } catch (ReflectionException $e) { + throw new RuntimeException( + \sprintf( + 'Cannot mock %s::%s() because a class or ' . + 'interface used in the signature is not loaded', + $method->getDeclaringClass()->getName(), + $method->getName() + ), + 0, + $e + ); + } + + if ($class !== null) { + $typeDeclaration = $class->getName() . ' '; + } + } + + if (!$parameter->isVariadic()) { + if ($parameter->isDefaultValueAvailable()) { + $value = $parameter->getDefaultValueConstantName(); + + if ($value === null) { + $value = \var_export($parameter->getDefaultValue(), true); + } elseif (!\defined($value)) { + $rootValue = \preg_replace('/^.*\\\\/', '', $value); + $value = \defined($rootValue) ? $rootValue : $value; + } + + $default = ' = ' . $value; + } elseif ($parameter->isOptional()) { + $default = ' = null'; + } + } + } + + if ($parameter->isPassedByReference()) { + $reference = '&'; + } + + $parameters[] = $nullable . $typeDeclaration . $reference . $name . $default; + } + + return \implode(', ', $parameters); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethodSet.php b/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethodSet.php new file mode 100644 index 0000000..b81536a --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethodSet.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +final class MockMethodSet +{ + /** + * @var MockMethod[] + */ + private $methods = []; + + public function addMethods(MockMethod ...$methods): void + { + foreach ($methods as $method) { + $this->methods[\strtolower($method->getName())] = $method; + } + } + + public function asArray(): array + { + return \array_values($this->methods); + } + + public function hasMethod(string $methodName): bool + { + return \array_key_exists(\strtolower($methodName), $this->methods); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/MockObject.php b/vendor/phpunit/phpunit/src/Framework/MockObject/MockObject.php new file mode 100644 index 0000000..cb5e51e --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/MockObject.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\MockObject\Builder\InvocationMocker; +use PHPUnit\Framework\MockObject\Matcher\Invocation; + +/** + * Interface for all mock objects which are generated by + * MockBuilder. + * + * @method InvocationMocker method($constraint) + * + * @deprecated Use PHPUnit\Framework\MockObject\MockObject instead + */ +interface PHPUnit_Framework_MockObject_MockObject /*extends Verifiable*/ +{ + /** + * @return InvocationMocker + */ + public function __phpunit_setOriginalObject($originalObject); + + /** + * @return InvocationMocker + */ + public function __phpunit_getInvocationMocker(); + + /** + * Verifies that the current expectation is valid. If everything is OK the + * code should just return, if not it must throw an exception. + * + * @throws ExpectationFailedException + */ + public function __phpunit_verify(bool $unsetInvocationMocker = true); + + /** + * @return bool + */ + public function __phpunit_hasMatchers(); + + public function __phpunit_setReturnValueGeneration(bool $returnValueGeneration); + + /** + * Registers a new expectation in the mock object and returns the match + * object which can be infused with further details. + * + * @return InvocationMocker + */ + public function expects(Invocation $matcher); +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub.php new file mode 100644 index 0000000..b0f04f5 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use PHPUnit\Framework\SelfDescribing; + +/** + * An object that stubs the process of a normal method for a mock object. + * + * The stub object will replace the code for the stubbed method and return a + * specific value instead of the original value. + */ +interface Stub extends SelfDescribing +{ + /** + * Fakes the processing of the invocation $invocation by returning a + * specific value. + * + * @param Invocation $invocation The invocation which was mocked and matched by the current method and argument matchers + */ + public function invoke(Invocation $invocation); +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ConsecutiveCalls.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ConsecutiveCalls.php new file mode 100644 index 0000000..ee60927 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ConsecutiveCalls.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use PHPUnit\Framework\MockObject\Invocation; +use PHPUnit\Framework\MockObject\Stub; +use SebastianBergmann\Exporter\Exporter; + +/** + * Stubs a method by returning a user-defined stack of values. + */ +class ConsecutiveCalls implements Stub +{ + /** + * @var array + */ + private $stack; + + /** + * @var mixed + */ + private $value; + + public function __construct(array $stack) + { + $this->stack = $stack; + } + + public function invoke(Invocation $invocation) + { + $this->value = \array_shift($this->stack); + + if ($this->value instanceof Stub) { + $this->value = $this->value->invoke($invocation); + } + + return $this->value; + } + + public function toString(): string + { + $exporter = new Exporter; + + return \sprintf( + 'return user-specified value %s', + $exporter->export($this->value) + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/Exception.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/Exception.php new file mode 100644 index 0000000..3080a6e --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/Exception.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use PHPUnit\Framework\MockObject\Invocation; +use PHPUnit\Framework\MockObject\Stub; +use SebastianBergmann\Exporter\Exporter; + +/** + * Stubs a method by raising a user-defined exception. + */ +class Exception implements Stub +{ + private $exception; + + public function __construct(\Throwable $exception) + { + $this->exception = $exception; + } + + public function invoke(Invocation $invocation): void + { + throw $this->exception; + } + + public function toString(): string + { + $exporter = new Exporter; + + return \sprintf( + 'raise user-specified exception %s', + $exporter->export($this->exception) + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/MatcherCollection.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/MatcherCollection.php new file mode 100644 index 0000000..f53834a --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/MatcherCollection.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use PHPUnit\Framework\MockObject\Matcher\Invocation; + +/** + * Stubs a method by returning a user-defined value. + */ +interface MatcherCollection +{ + /** + * Adds a new matcher to the collection which can be used as an expectation + * or a stub. + * + * @param Invocation $matcher Matcher for invocations to mock objects + */ + public function addMatcher(Invocation $matcher); +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnArgument.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnArgument.php new file mode 100644 index 0000000..3e63d78 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnArgument.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use PHPUnit\Framework\MockObject\Invocation; +use PHPUnit\Framework\MockObject\Stub; + +/** + * Stubs a method by returning an argument that was passed to the mocked method. + */ +class ReturnArgument implements Stub +{ + /** + * @var int + */ + private $argumentIndex; + + public function __construct($argumentIndex) + { + $this->argumentIndex = $argumentIndex; + } + + public function invoke(Invocation $invocation) + { + if (isset($invocation->getParameters()[$this->argumentIndex])) { + return $invocation->getParameters()[$this->argumentIndex]; + } + } + + public function toString(): string + { + return \sprintf('return argument #%d', $this->argumentIndex); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnCallback.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnCallback.php new file mode 100644 index 0000000..933e9ca --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnCallback.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use PHPUnit\Framework\MockObject\Invocation; +use PHPUnit\Framework\MockObject\Stub; + +class ReturnCallback implements Stub +{ + private $callback; + + public function __construct($callback) + { + $this->callback = $callback; + } + + public function invoke(Invocation $invocation) + { + return \call_user_func_array($this->callback, $invocation->getParameters()); + } + + public function toString(): string + { + if (\is_array($this->callback)) { + if (\is_object($this->callback[0])) { + $class = \get_class($this->callback[0]); + $type = '->'; + } else { + $class = $this->callback[0]; + $type = '::'; + } + + return \sprintf( + 'return result of user defined callback %s%s%s() with the ' . + 'passed arguments', + $class, + $type, + $this->callback[1] + ); + } + + return 'return result of user defined callback ' . $this->callback . + ' with the passed arguments'; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnReference.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnReference.php new file mode 100644 index 0000000..2d78442 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnReference.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use PHPUnit\Framework\MockObject\Invocation; +use PHPUnit\Framework\MockObject\Stub; +use SebastianBergmann\Exporter\Exporter; + +/** + * Stubs a method by returning a user-defined reference to a value. + */ +class ReturnReference implements Stub +{ + /** + * @var mixed + */ + private $reference; + + public function __construct(&$reference) + { + $this->reference = &$reference; + } + + public function invoke(Invocation $invocation) + { + return $this->reference; + } + + public function toString(): string + { + $exporter = new Exporter; + + return \sprintf( + 'return user-specified reference %s', + $exporter->export($this->reference) + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnSelf.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnSelf.php new file mode 100644 index 0000000..4261a6a --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnSelf.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use PHPUnit\Framework\MockObject\Invocation; +use PHPUnit\Framework\MockObject\Invocation\ObjectInvocation; +use PHPUnit\Framework\MockObject\RuntimeException; +use PHPUnit\Framework\MockObject\Stub; + +/** + * Stubs a method by returning the current object. + */ +class ReturnSelf implements Stub +{ + public function invoke(Invocation $invocation) + { + if (!$invocation instanceof ObjectInvocation) { + throw new RuntimeException( + 'The current object can only be returned when mocking an ' . + 'object, not a static class.' + ); + } + + return $invocation->getObject(); + } + + public function toString(): string + { + return 'return the current object'; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnStub.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnStub.php new file mode 100644 index 0000000..76dc7b6 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnStub.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use PHPUnit\Framework\MockObject\Invocation; +use PHPUnit\Framework\MockObject\Stub; +use SebastianBergmann\Exporter\Exporter; + +/** + * Stubs a method by returning a user-defined value. + */ +class ReturnStub implements Stub +{ + /** + * @var mixed + */ + private $value; + + public function __construct($value) + { + $this->value = $value; + } + + public function invoke(Invocation $invocation) + { + return $this->value; + } + + public function toString(): string + { + $exporter = new Exporter; + + return \sprintf( + 'return user-specified value %s', + $exporter->export($this->value) + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnValueMap.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnValueMap.php new file mode 100644 index 0000000..195cc16 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnValueMap.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject\Stub; + +use PHPUnit\Framework\MockObject\Invocation; +use PHPUnit\Framework\MockObject\Stub; + +/** + * Stubs a method by returning a value from a map. + */ +class ReturnValueMap implements Stub +{ + /** + * @var array + */ + private $valueMap; + + public function __construct(array $valueMap) + { + $this->valueMap = $valueMap; + } + + public function invoke(Invocation $invocation) + { + $parameterCount = \count($invocation->getParameters()); + + foreach ($this->valueMap as $map) { + if (!\is_array($map) || $parameterCount !== (\count($map) - 1)) { + continue; + } + + $return = \array_pop($map); + + if ($invocation->getParameters() === $map) { + return $return; + } + } + } + + public function toString(): string + { + return 'return value from a map'; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Verifiable.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Verifiable.php new file mode 100644 index 0000000..1e18846 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Verifiable.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework\MockObject; + +use PHPUnit\Framework\ExpectationFailedException; + +/** + * Interface for classes which must verify a given expectation. + */ +interface Verifiable +{ + /** + * Verifies that the current expectation is valid. If everything is OK the + * code should just return, if not it must throw an exception. + * + * @throws ExpectationFailedException + */ + public function verify(); +} diff --git a/vendor/phpunit/phpunit/src/Framework/OutputError.php b/vendor/phpunit/phpunit/src/Framework/OutputError.php new file mode 100644 index 0000000..5b1517b --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/OutputError.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +class OutputError extends AssertionFailedError +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/RiskyTest.php b/vendor/phpunit/phpunit/src/Framework/RiskyTest.php new file mode 100644 index 0000000..e013217 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/RiskyTest.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +interface RiskyTest +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/RiskyTestError.php b/vendor/phpunit/phpunit/src/Framework/RiskyTestError.php new file mode 100644 index 0000000..fe1e3a4 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/RiskyTestError.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +class RiskyTestError extends AssertionFailedError implements RiskyTest +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/SelfDescribing.php b/vendor/phpunit/phpunit/src/Framework/SelfDescribing.php new file mode 100644 index 0000000..faf9290 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/SelfDescribing.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * Interface for classes that can return a description of itself. + */ +interface SelfDescribing +{ + /** + * Returns a string representation of the object. + */ + public function toString(): string; +} diff --git a/vendor/phpunit/phpunit/src/Framework/SkippedTest.php b/vendor/phpunit/phpunit/src/Framework/SkippedTest.php new file mode 100644 index 0000000..8151f2d --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/SkippedTest.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +interface SkippedTest +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/SkippedTestCase.php b/vendor/phpunit/phpunit/src/Framework/SkippedTestCase.php new file mode 100644 index 0000000..cf88d7b --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/SkippedTestCase.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * A skipped test case + */ +class SkippedTestCase extends TestCase +{ + /** + * @var string + */ + protected $message = ''; + + /** + * @var bool + */ + protected $backupGlobals = false; + + /** + * @var bool + */ + protected $backupStaticAttributes = false; + + /** + * @var bool + */ + protected $runTestInSeparateProcess = false; + + /** + * @var bool + */ + protected $useErrorHandler = false; + + /** + * @var bool + */ + protected $useOutputBuffering = false; + + public function __construct(string $className, string $methodName, string $message = '') + { + parent::__construct($className . '::' . $methodName); + + $this->message = $message; + } + + public function getMessage(): string + { + return $this->message; + } + + /** + * Returns a string representation of the test case. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function toString(): string + { + return $this->getName(); + } + + /** + * @throws Exception + */ + protected function runTest(): void + { + $this->markTestSkipped($this->message); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/SkippedTestError.php b/vendor/phpunit/phpunit/src/Framework/SkippedTestError.php new file mode 100644 index 0000000..0893a5d --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/SkippedTestError.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +class SkippedTestError extends AssertionFailedError implements SkippedTest +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/SkippedTestSuiteError.php b/vendor/phpunit/phpunit/src/Framework/SkippedTestSuiteError.php new file mode 100644 index 0000000..c74015b --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/SkippedTestSuiteError.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +class SkippedTestSuiteError extends AssertionFailedError implements SkippedTest +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/SyntheticError.php b/vendor/phpunit/phpunit/src/Framework/SyntheticError.php new file mode 100644 index 0000000..db2280f --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/SyntheticError.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * Creates a synthetic failed assertion. + */ +class SyntheticError extends AssertionFailedError +{ + /** + * The synthetic file. + * + * @var string + */ + protected $syntheticFile = ''; + + /** + * The synthetic line number. + * + * @var int + */ + protected $syntheticLine = 0; + + /** + * The synthetic trace. + * + * @var array + */ + protected $syntheticTrace = []; + + public function __construct(string $message, int $code, string $file, int $line, array $trace) + { + parent::__construct($message, $code); + + $this->syntheticFile = $file; + $this->syntheticLine = $line; + $this->syntheticTrace = $trace; + } + + public function getSyntheticFile(): string + { + return $this->syntheticFile; + } + + public function getSyntheticLine(): int + { + return $this->syntheticLine; + } + + public function getSyntheticTrace(): array + { + return $this->syntheticTrace; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/Test.php b/vendor/phpunit/phpunit/src/Framework/Test.php new file mode 100644 index 0000000..347a63f --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Test.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use Countable; + +/** + * A Test can be run and collect its results. + */ +interface Test extends Countable +{ + /** + * Runs a test and collects its result in a TestResult instance. + */ + public function run(TestResult $result = null): TestResult; +} diff --git a/vendor/phpunit/phpunit/src/Framework/TestCase.php b/vendor/phpunit/phpunit/src/Framework/TestCase.php new file mode 100644 index 0000000..0d30afc --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/TestCase.php @@ -0,0 +1,2120 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use DeepCopy\DeepCopy; +use PHPUnit\Framework\Constraint\Exception as ExceptionConstraint; +use PHPUnit\Framework\Constraint\ExceptionCode; +use PHPUnit\Framework\Constraint\ExceptionMessage; +use PHPUnit\Framework\Constraint\ExceptionMessageRegularExpression; +use PHPUnit\Framework\MockObject\Generator as MockGenerator; +use PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount as AnyInvokedCountMatcher; +use PHPUnit\Framework\MockObject\Matcher\InvokedAtIndex as InvokedAtIndexMatcher; +use PHPUnit\Framework\MockObject\Matcher\InvokedAtLeastCount as InvokedAtLeastCountMatcher; +use PHPUnit\Framework\MockObject\Matcher\InvokedAtLeastOnce as InvokedAtLeastOnceMatcher; +use PHPUnit\Framework\MockObject\Matcher\InvokedAtMostCount as InvokedAtMostCountMatcher; +use PHPUnit\Framework\MockObject\Matcher\InvokedCount as InvokedCountMatcher; +use PHPUnit\Framework\MockObject\MockBuilder; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\MockObject\Stub\ConsecutiveCalls as ConsecutiveCallsStub; +use PHPUnit\Framework\MockObject\Stub\Exception as ExceptionStub; +use PHPUnit\Framework\MockObject\Stub\ReturnArgument as ReturnArgumentStub; +use PHPUnit\Framework\MockObject\Stub\ReturnCallback as ReturnCallbackStub; +use PHPUnit\Framework\MockObject\Stub\ReturnSelf as ReturnSelfStub; +use PHPUnit\Framework\MockObject\Stub\ReturnStub; +use PHPUnit\Framework\MockObject\Stub\ReturnValueMap as ReturnValueMapStub; +use PHPUnit\Runner\BaseTestRunner; +use PHPUnit\Runner\PhptTestCase; +use PHPUnit\Util\GlobalState; +use PHPUnit\Util\PHP\AbstractPhpProcess; +use Prophecy; +use Prophecy\Exception\Prediction\PredictionException; +use Prophecy\Prophecy\MethodProphecy; +use Prophecy\Prophecy\ObjectProphecy; +use Prophecy\Prophet; +use ReflectionClass; +use ReflectionException; +use ReflectionObject; +use SebastianBergmann\Comparator\Comparator; +use SebastianBergmann\Comparator\Factory as ComparatorFactory; +use SebastianBergmann\Diff\Differ; +use SebastianBergmann\Exporter\Exporter; +use SebastianBergmann\GlobalState\Blacklist; +use SebastianBergmann\GlobalState\Restorer; +use SebastianBergmann\GlobalState\Snapshot; +use SebastianBergmann\ObjectEnumerator\Enumerator; +use Text_Template; +use Throwable; + +abstract class TestCase extends Assert implements Test, SelfDescribing +{ + private const LOCALE_CATEGORIES = [\LC_ALL, \LC_COLLATE, \LC_CTYPE, \LC_MONETARY, \LC_NUMERIC, \LC_TIME]; + + /** + * @var bool + */ + protected $backupGlobals; + + /** + * @var array + */ + protected $backupGlobalsBlacklist = []; + + /** + * @var bool + */ + protected $backupStaticAttributes; + + /** + * @var array + */ + protected $backupStaticAttributesBlacklist = []; + + /** + * @var bool + */ + protected $runTestInSeparateProcess; + + /** + * @var bool + */ + protected $preserveGlobalState = true; + + /** + * @var bool + */ + private $runClassInSeparateProcess; + + /** + * @var bool + */ + private $inIsolation = false; + + /** + * @var array + */ + private $data; + + /** + * @var string + */ + private $dataName; + + /** + * @var bool + */ + private $useErrorHandler; + + /** + * @var null|string + */ + private $expectedException; + + /** + * @var string + */ + private $expectedExceptionMessage; + + /** + * @var string + */ + private $expectedExceptionMessageRegExp; + + /** + * @var null|int|string + */ + private $expectedExceptionCode; + + /** + * @var string + */ + private $name; + + /** + * @var string[] + */ + private $dependencies = []; + + /** + * @var array + */ + private $dependencyInput = []; + + /** + * @var array + */ + private $iniSettings = []; + + /** + * @var array + */ + private $locale = []; + + /** + * @var array + */ + private $mockObjects = []; + + /** + * @var MockGenerator + */ + private $mockObjectGenerator; + + /** + * @var int + */ + private $status = BaseTestRunner::STATUS_UNKNOWN; + + /** + * @var string + */ + private $statusMessage = ''; + + /** + * @var int + */ + private $numAssertions = 0; + + /** + * @var TestResult + */ + private $result; + + /** + * @var mixed + */ + private $testResult; + + /** + * @var string + */ + private $output = ''; + + /** + * @var string + */ + private $outputExpectedRegex; + + /** + * @var string + */ + private $outputExpectedString; + + /** + * @var mixed + */ + private $outputCallback = false; + + /** + * @var bool + */ + private $outputBufferingActive = false; + + /** + * @var int + */ + private $outputBufferingLevel; + + /** + * @var Snapshot + */ + private $snapshot; + + /** + * @var Prophecy\Prophet + */ + private $prophet; + + /** + * @var bool + */ + private $beStrictAboutChangesToGlobalState = false; + + /** + * @var bool + */ + private $registerMockObjectsFromTestArgumentsRecursively = false; + + /** + * @var string[] + */ + private $warnings = []; + + /** + * @var array + */ + private $groups = []; + + /** + * @var bool + */ + private $doesNotPerformAssertions = false; + + /** + * @var Comparator[] + */ + private $customComparators = []; + + /** + * Returns a matcher that matches when the method is executed + * zero or more times. + */ + public static function any(): AnyInvokedCountMatcher + { + return new AnyInvokedCountMatcher; + } + + /** + * Returns a matcher that matches when the method is never executed. + */ + public static function never(): InvokedCountMatcher + { + return new InvokedCountMatcher(0); + } + + /** + * Returns a matcher that matches when the method is executed + * at least N times. + */ + public static function atLeast(int $requiredInvocations): InvokedAtLeastCountMatcher + { + return new InvokedAtLeastCountMatcher( + $requiredInvocations + ); + } + + /** + * Returns a matcher that matches when the method is executed at least once. + */ + public static function atLeastOnce(): InvokedAtLeastOnceMatcher + { + return new InvokedAtLeastOnceMatcher; + } + + /** + * Returns a matcher that matches when the method is executed exactly once. + */ + public static function once(): InvokedCountMatcher + { + return new InvokedCountMatcher(1); + } + + /** + * Returns a matcher that matches when the method is executed + * exactly $count times. + */ + public static function exactly(int $count): InvokedCountMatcher + { + return new InvokedCountMatcher($count); + } + + /** + * Returns a matcher that matches when the method is executed + * at most N times. + */ + public static function atMost(int $allowedInvocations): InvokedAtMostCountMatcher + { + return new InvokedAtMostCountMatcher($allowedInvocations); + } + + /** + * Returns a matcher that matches when the method is executed + * at the given index. + */ + public static function at(int $index): InvokedAtIndexMatcher + { + return new InvokedAtIndexMatcher($index); + } + + public static function returnValue($value): ReturnStub + { + return new ReturnStub($value); + } + + public static function returnValueMap(array $valueMap): ReturnValueMapStub + { + return new ReturnValueMapStub($valueMap); + } + + public static function returnArgument(int $argumentIndex): ReturnArgumentStub + { + return new ReturnArgumentStub($argumentIndex); + } + + public static function returnCallback($callback): ReturnCallbackStub + { + return new ReturnCallbackStub($callback); + } + + /** + * Returns the current object. + * + * This method is useful when mocking a fluent interface. + */ + public static function returnSelf(): ReturnSelfStub + { + return new ReturnSelfStub; + } + + public static function throwException(Throwable $exception): ExceptionStub + { + return new ExceptionStub($exception); + } + + public static function onConsecutiveCalls(...$args): ConsecutiveCallsStub + { + return new ConsecutiveCallsStub($args); + } + + /** + * @param string $name + * @param string $dataName + */ + public function __construct($name = null, array $data = [], $dataName = '') + { + if ($name !== null) { + $this->setName($name); + } + + $this->data = $data; + $this->dataName = $dataName; + } + + /** + * This method is called before the first test of this test class is run. + */ + public static function setUpBeforeClass()/* The :void return type declaration that should be here would cause a BC issue */ + { + } + + /** + * This method is called after the last test of this test class is run. + */ + public static function tearDownAfterClass()/* The :void return type declaration that should be here would cause a BC issue */ + { + } + + /** + * This method is called before each test. + */ + protected function setUp()/* The :void return type declaration that should be here would cause a BC issue */ + { + } + + /** + * This method is called after each test. + */ + protected function tearDown()/* The :void return type declaration that should be here would cause a BC issue */ + { + } + + /** + * Returns a string representation of the test case. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws \ReflectionException + */ + public function toString(): string + { + $class = new ReflectionClass($this); + + $buffer = \sprintf( + '%s::%s', + $class->name, + $this->getName(false) + ); + + return $buffer . $this->getDataSetAsString(); + } + + public function count(): int + { + return 1; + } + + public function getGroups(): array + { + return $this->groups; + } + + public function setGroups(array $groups): void + { + $this->groups = $groups; + } + + public function getAnnotations(): array + { + return \PHPUnit\Util\Test::parseTestMethodAnnotations( + \get_class($this), + $this->name + ); + } + + /** + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function getName(bool $withDataSet = true): ?string + { + if ($withDataSet) { + return $this->name . $this->getDataSetAsString(false); + } + + return $this->name; + } + + /** + * Returns the size of the test. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function getSize(): int + { + return \PHPUnit\Util\Test::getSize( + \get_class($this), + $this->getName(false) + ); + } + + /** + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function hasSize(): bool + { + return $this->getSize() !== \PHPUnit\Util\Test::UNKNOWN; + } + + /** + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function isSmall(): bool + { + return $this->getSize() === \PHPUnit\Util\Test::SMALL; + } + + /** + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function isMedium(): bool + { + return $this->getSize() === \PHPUnit\Util\Test::MEDIUM; + } + + /** + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function isLarge(): bool + { + return $this->getSize() === \PHPUnit\Util\Test::LARGE; + } + + public function getActualOutput(): string + { + if (!$this->outputBufferingActive) { + return $this->output; + } + + return \ob_get_contents(); + } + + public function hasOutput(): bool + { + if ($this->output === '') { + return false; + } + + if ($this->hasExpectationOnOutput()) { + return false; + } + + return true; + } + + public function doesNotPerformAssertions(): bool + { + return $this->doesNotPerformAssertions; + } + + public function expectOutputRegex(string $expectedRegex): void + { + $this->outputExpectedRegex = $expectedRegex; + } + + public function expectOutputString(string $expectedString): void + { + $this->outputExpectedString = $expectedString; + } + + public function hasExpectationOnOutput(): bool + { + return \is_string($this->outputExpectedString) || \is_string($this->outputExpectedRegex); + } + + public function getExpectedException(): ?string + { + return $this->expectedException; + } + + /** + * @return null|int|string + */ + public function getExpectedExceptionCode() + { + return $this->expectedExceptionCode; + } + + public function getExpectedExceptionMessage(): string + { + return $this->expectedExceptionMessage; + } + + public function getExpectedExceptionMessageRegExp(): string + { + return $this->expectedExceptionMessageRegExp; + } + + public function expectException(string $exception): void + { + $this->expectedException = $exception; + } + + /** + * @param int|string $code + */ + public function expectExceptionCode($code): void + { + $this->expectedExceptionCode = $code; + } + + public function expectExceptionMessage(string $message): void + { + $this->expectedExceptionMessage = $message; + } + + public function expectExceptionMessageRegExp(string $messageRegExp): void + { + $this->expectedExceptionMessageRegExp = $messageRegExp; + } + + /** + * Sets up an expectation for an exception to be raised by the code under test. + * Information for expected exception class, expected exception message, and + * expected exception code are retrieved from a given Exception object. + */ + public function expectExceptionObject(\Exception $exception): void + { + $this->expectException(\get_class($exception)); + $this->expectExceptionMessage($exception->getMessage()); + $this->expectExceptionCode($exception->getCode()); + } + + public function expectNotToPerformAssertions() + { + $this->doesNotPerformAssertions = true; + } + + public function setRegisterMockObjectsFromTestArgumentsRecursively(bool $flag): void + { + $this->registerMockObjectsFromTestArgumentsRecursively = $flag; + } + + public function setUseErrorHandler(bool $useErrorHandler): void + { + $this->useErrorHandler = $useErrorHandler; + } + + public function getStatus(): int + { + return $this->status; + } + + public function markAsRisky(): void + { + $this->status = BaseTestRunner::STATUS_RISKY; + } + + public function getStatusMessage(): string + { + return $this->statusMessage; + } + + public function hasFailed(): bool + { + $status = $this->getStatus(); + + return $status === BaseTestRunner::STATUS_FAILURE || $status === BaseTestRunner::STATUS_ERROR; + } + + /** + * Runs the test case and collects the results in a TestResult object. + * If no TestResult object is passed a new one will be created. + * + * @throws CodeCoverageException + * @throws ReflectionException + * @throws \SebastianBergmann\CodeCoverage\CoveredCodeNotExecutedException + * @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException + * @throws \SebastianBergmann\CodeCoverage\MissingCoversAnnotationException + * @throws \SebastianBergmann\CodeCoverage\RuntimeException + * @throws \SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function run(TestResult $result = null): TestResult + { + if ($result === null) { + $result = $this->createResult(); + } + + if (!$this instanceof WarningTestCase) { + $this->setTestResultObject($result); + $this->setUseErrorHandlerFromAnnotation(); + } + + if ($this->useErrorHandler !== null) { + $oldErrorHandlerSetting = $result->getConvertErrorsToExceptions(); + $result->convertErrorsToExceptions($this->useErrorHandler); + } + + if (!$this instanceof WarningTestCase && + !$this instanceof SkippedTestCase && + !$this->handleDependencies()) { + return $result; + } + + if ($this->runInSeparateProcess()) { + $runEntireClass = $this->runClassInSeparateProcess && !$this->runTestInSeparateProcess; + + $class = new ReflectionClass($this); + + if ($runEntireClass) { + $template = new Text_Template( + __DIR__ . '/../Util/PHP/Template/TestCaseClass.tpl' + ); + } else { + $template = new Text_Template( + __DIR__ . '/../Util/PHP/Template/TestCaseMethod.tpl' + ); + } + + if ($this->preserveGlobalState) { + $constants = GlobalState::getConstantsAsString(); + $globals = GlobalState::getGlobalsAsString(); + $includedFiles = GlobalState::getIncludedFilesAsString(); + $iniSettings = GlobalState::getIniSettingsAsString(); + } else { + $constants = ''; + + if (!empty($GLOBALS['__PHPUNIT_BOOTSTRAP'])) { + $globals = '$GLOBALS[\'__PHPUNIT_BOOTSTRAP\'] = ' . \var_export($GLOBALS['__PHPUNIT_BOOTSTRAP'], true) . ";\n"; + } else { + $globals = ''; + } + $includedFiles = ''; + $iniSettings = ''; + } + + $coverage = $result->getCollectCodeCoverageInformation() ? 'true' : 'false'; + $isStrictAboutTestsThatDoNotTestAnything = $result->isStrictAboutTestsThatDoNotTestAnything() ? 'true' : 'false'; + $isStrictAboutOutputDuringTests = $result->isStrictAboutOutputDuringTests() ? 'true' : 'false'; + $enforcesTimeLimit = $result->enforcesTimeLimit() ? 'true' : 'false'; + $isStrictAboutTodoAnnotatedTests = $result->isStrictAboutTodoAnnotatedTests() ? 'true' : 'false'; + $isStrictAboutResourceUsageDuringSmallTests = $result->isStrictAboutResourceUsageDuringSmallTests() ? 'true' : 'false'; + + if (\defined('PHPUNIT_COMPOSER_INSTALL')) { + $composerAutoload = \var_export(PHPUNIT_COMPOSER_INSTALL, true); + } else { + $composerAutoload = '\'\''; + } + + if (\defined('__PHPUNIT_PHAR__')) { + $phar = \var_export(__PHPUNIT_PHAR__, true); + } else { + $phar = '\'\''; + } + + if ($result->getCodeCoverage()) { + $codeCoverageFilter = $result->getCodeCoverage()->filter(); + } else { + $codeCoverageFilter = null; + } + + $data = \var_export(\serialize($this->data), true); + $dataName = \var_export($this->dataName, true); + $dependencyInput = \var_export(\serialize($this->dependencyInput), true); + $includePath = \var_export(\get_include_path(), true); + $codeCoverageFilter = \var_export(\serialize($codeCoverageFilter), true); + // must do these fixes because TestCaseMethod.tpl has unserialize('{data}') in it, and we can't break BC + // the lines above used to use addcslashes() rather than var_export(), which breaks null byte escape sequences + $data = "'." . $data . ".'"; + $dataName = "'.(" . $dataName . ").'"; + $dependencyInput = "'." . $dependencyInput . ".'"; + $includePath = "'." . $includePath . ".'"; + $codeCoverageFilter = "'." . $codeCoverageFilter . ".'"; + + $configurationFilePath = $GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] ?? ''; + + $var = [ + 'composerAutoload' => $composerAutoload, + 'phar' => $phar, + 'filename' => $class->getFileName(), + 'className' => $class->getName(), + 'collectCodeCoverageInformation' => $coverage, + 'data' => $data, + 'dataName' => $dataName, + 'dependencyInput' => $dependencyInput, + 'constants' => $constants, + 'globals' => $globals, + 'include_path' => $includePath, + 'included_files' => $includedFiles, + 'iniSettings' => $iniSettings, + 'isStrictAboutTestsThatDoNotTestAnything' => $isStrictAboutTestsThatDoNotTestAnything, + 'isStrictAboutOutputDuringTests' => $isStrictAboutOutputDuringTests, + 'enforcesTimeLimit' => $enforcesTimeLimit, + 'isStrictAboutTodoAnnotatedTests' => $isStrictAboutTodoAnnotatedTests, + 'isStrictAboutResourceUsageDuringSmallTests' => $isStrictAboutResourceUsageDuringSmallTests, + 'codeCoverageFilter' => $codeCoverageFilter, + 'configurationFilePath' => $configurationFilePath, + 'name' => $this->getName(false), + ]; + + if (!$runEntireClass) { + $var['methodName'] = $this->name; + } + + $template->setVar( + $var + ); + + $php = AbstractPhpProcess::factory(); + $php->runTestJob($template->render(), $this, $result); + } else { + $result->run($this); + } + + if (isset($oldErrorHandlerSetting)) { + $result->convertErrorsToExceptions($oldErrorHandlerSetting); + } + + $this->result = null; + + return $result; + } + + /** + * @throws \Throwable + */ + public function runBare(): void + { + $this->numAssertions = 0; + + $this->snapshotGlobalState(); + $this->startOutputBuffering(); + \clearstatcache(); + $currentWorkingDirectory = \getcwd(); + + $hookMethods = \PHPUnit\Util\Test::getHookMethods(\get_class($this)); + + $hasMetRequirements = false; + + try { + $this->checkRequirements(); + $hasMetRequirements = true; + + if ($this->inIsolation) { + foreach ($hookMethods['beforeClass'] as $method) { + $this->$method(); + } + } + + $this->setExpectedExceptionFromAnnotation(); + $this->setDoesNotPerformAssertionsFromAnnotation(); + + foreach ($hookMethods['before'] as $method) { + $this->$method(); + } + + $this->assertPreConditions(); + $this->testResult = $this->runTest(); + $this->verifyMockObjects(); + $this->assertPostConditions(); + + if (!empty($this->warnings)) { + throw new Warning( + \implode( + "\n", + \array_unique($this->warnings) + ) + ); + } + + $this->status = BaseTestRunner::STATUS_PASSED; + } catch (IncompleteTest $e) { + $this->status = BaseTestRunner::STATUS_INCOMPLETE; + $this->statusMessage = $e->getMessage(); + } catch (SkippedTest $e) { + $this->status = BaseTestRunner::STATUS_SKIPPED; + $this->statusMessage = $e->getMessage(); + } catch (Warning $e) { + $this->status = BaseTestRunner::STATUS_WARNING; + $this->statusMessage = $e->getMessage(); + } catch (AssertionFailedError $e) { + $this->status = BaseTestRunner::STATUS_FAILURE; + $this->statusMessage = $e->getMessage(); + } catch (PredictionException $e) { + $this->status = BaseTestRunner::STATUS_FAILURE; + $this->statusMessage = $e->getMessage(); + } catch (Throwable $_e) { + $e = $_e; + $this->status = BaseTestRunner::STATUS_ERROR; + $this->statusMessage = $_e->getMessage(); + } + + $this->mockObjects = []; + $this->prophet = null; + + // Tear down the fixture. An exception raised in tearDown() will be + // caught and passed on when no exception was raised before. + try { + if ($hasMetRequirements) { + foreach ($hookMethods['after'] as $method) { + $this->$method(); + } + + if ($this->inIsolation) { + foreach ($hookMethods['afterClass'] as $method) { + $this->$method(); + } + } + } + } catch (Throwable $_e) { + $e = $e ?? $_e; + } + + try { + $this->stopOutputBuffering(); + } catch (RiskyTestError $_e) { + $e = $e ?? $_e; + } + + if (isset($_e)) { + $this->status = BaseTestRunner::STATUS_ERROR; + $this->statusMessage = $_e->getMessage(); + } + + \clearstatcache(); + + if ($currentWorkingDirectory != \getcwd()) { + \chdir($currentWorkingDirectory); + } + + $this->restoreGlobalState(); + $this->unregisterCustomComparators(); + $this->cleanupIniSettings(); + $this->cleanupLocaleSettings(); + + // Perform assertion on output. + if (!isset($e)) { + try { + if ($this->outputExpectedRegex !== null) { + $this->assertRegExp($this->outputExpectedRegex, $this->output); + } elseif ($this->outputExpectedString !== null) { + $this->assertEquals($this->outputExpectedString, $this->output); + } + } catch (Throwable $_e) { + $e = $_e; + } + } + + // Workaround for missing "finally". + if (isset($e)) { + if ($e instanceof PredictionException) { + $e = new AssertionFailedError($e->getMessage()); + } + + $this->onNotSuccessfulTest($e); + } + } + + public function setName(string $name): void + { + $this->name = $name; + } + + /** + * @param string[] $dependencies + */ + public function setDependencies(array $dependencies): void + { + $this->dependencies = $dependencies; + } + + public function getDependencies(): array + { + return $this->dependencies; + } + + public function hasDependencies(): bool + { + return \count($this->dependencies) > 0; + } + + public function setDependencyInput(array $dependencyInput): void + { + $this->dependencyInput = $dependencyInput; + } + + public function setBeStrictAboutChangesToGlobalState(?bool $beStrictAboutChangesToGlobalState): void + { + $this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState; + } + + public function setBackupGlobals(?bool $backupGlobals): void + { + if ($this->backupGlobals === null && $backupGlobals !== null) { + $this->backupGlobals = $backupGlobals; + } + } + + public function setBackupStaticAttributes(?bool $backupStaticAttributes): void + { + if ($this->backupStaticAttributes === null && $backupStaticAttributes !== null) { + $this->backupStaticAttributes = $backupStaticAttributes; + } + } + + public function setRunTestInSeparateProcess(bool $runTestInSeparateProcess): void + { + if ($this->runTestInSeparateProcess === null) { + $this->runTestInSeparateProcess = $runTestInSeparateProcess; + } + } + + public function setRunClassInSeparateProcess(bool $runClassInSeparateProcess): void + { + if ($this->runClassInSeparateProcess === null) { + $this->runClassInSeparateProcess = $runClassInSeparateProcess; + } + } + + public function setPreserveGlobalState(bool $preserveGlobalState): void + { + $this->preserveGlobalState = $preserveGlobalState; + } + + public function setInIsolation(bool $inIsolation): void + { + $this->inIsolation = $inIsolation; + } + + public function isInIsolation(): bool + { + return $this->inIsolation; + } + + public function getResult() + { + return $this->testResult; + } + + public function setResult($result): void + { + $this->testResult = $result; + } + + public function setOutputCallback(callable $callback): void + { + $this->outputCallback = $callback; + } + + public function getTestResultObject(): ?TestResult + { + return $this->result; + } + + public function setTestResultObject(TestResult $result): void + { + $this->result = $result; + } + + public function registerMockObject(MockObject $mockObject): void + { + $this->mockObjects[] = $mockObject; + } + + /** + * Returns a builder object to create mock objects using a fluent interface. + * + * @param string|string[] $className + */ + public function getMockBuilder($className): MockBuilder + { + return new MockBuilder($this, $className); + } + + public function addToAssertionCount(int $count): void + { + $this->numAssertions += $count; + } + + /** + * Returns the number of assertions performed by this test. + */ + public function getNumAssertions(): int + { + return $this->numAssertions; + } + + public function usesDataProvider(): bool + { + return !empty($this->data); + } + + public function dataDescription(): string + { + return \is_string($this->dataName) ? $this->dataName : ''; + } + + /** + * @return int|string + */ + public function dataName() + { + return $this->dataName; + } + + public function registerComparator(Comparator $comparator): void + { + ComparatorFactory::getInstance()->register($comparator); + + $this->customComparators[] = $comparator; + } + + public function getDataSetAsString(bool $includeData = true): string + { + $buffer = ''; + + if (!empty($this->data)) { + if (\is_int($this->dataName)) { + $buffer .= \sprintf(' with data set #%d', $this->dataName); + } else { + $buffer .= \sprintf(' with data set "%s"', $this->dataName); + } + + $exporter = new Exporter; + + if ($includeData) { + $buffer .= \sprintf(' (%s)', $exporter->shortenedRecursiveExport($this->data)); + } + } + + return $buffer; + } + + /** + * Gets the data set of a TestCase. + */ + public function getProvidedData(): array + { + return $this->data; + } + + public function addWarning(string $warning): void + { + $this->warnings[] = $warning; + } + + /** + * Override to run the test and assert its state. + * + * @throws AssertionFailedError + * @throws Exception + * @throws ExpectationFailedException + * @throws \SebastianBergmann\ObjectEnumerator\InvalidArgumentException + * @throws Throwable + */ + protected function runTest() + { + if ($this->name === null) { + throw new Exception( + 'PHPUnit\Framework\TestCase::$name must not be null.' + ); + } + + $testArguments = \array_merge($this->data, $this->dependencyInput); + + $this->registerMockObjectsFromTestArguments($testArguments); + + try { + $testResult = $this->{$this->name}(...\array_values($testArguments)); + } catch (Throwable $exception) { + if (!$this->checkExceptionExpectations($exception)) { + throw $exception; + } + + if ($this->expectedException !== null) { + $this->assertThat( + $exception, + new ExceptionConstraint( + $this->expectedException + ) + ); + } + + if ($this->expectedExceptionMessage !== null) { + $this->assertThat( + $exception, + new ExceptionMessage( + $this->expectedExceptionMessage + ) + ); + } + + if ($this->expectedExceptionMessageRegExp !== null) { + $this->assertThat( + $exception, + new ExceptionMessageRegularExpression( + $this->expectedExceptionMessageRegExp + ) + ); + } + + if ($this->expectedExceptionCode !== null) { + $this->assertThat( + $exception, + new ExceptionCode( + $this->expectedExceptionCode + ) + ); + } + + return; + } + + if ($this->expectedException !== null) { + $this->assertThat( + null, + new ExceptionConstraint( + $this->expectedException + ) + ); + } elseif ($this->expectedExceptionMessage !== null) { + $this->numAssertions++; + + throw new AssertionFailedError( + \sprintf( + 'Failed asserting that exception with message "%s" is thrown', + $this->expectedExceptionMessage + ) + ); + } elseif ($this->expectedExceptionMessageRegExp !== null) { + $this->numAssertions++; + + throw new AssertionFailedError( + \sprintf( + 'Failed asserting that exception with message matching "%s" is thrown', + $this->expectedExceptionMessageRegExp + ) + ); + } elseif ($this->expectedExceptionCode !== null) { + $this->numAssertions++; + + throw new AssertionFailedError( + \sprintf( + 'Failed asserting that exception with code "%s" is thrown', + $this->expectedExceptionCode + ) + ); + } + + return $testResult; + } + + /** + * This method is a wrapper for the ini_set() function that automatically + * resets the modified php.ini setting to its original value after the + * test is run. + * + * @throws Exception + */ + protected function iniSet(string $varName, $newValue): void + { + $currentValue = \ini_set($varName, $newValue); + + if ($currentValue !== false) { + $this->iniSettings[$varName] = $currentValue; + } else { + throw new Exception( + \sprintf( + 'INI setting "%s" could not be set to "%s".', + $varName, + $newValue + ) + ); + } + } + + /** + * This method is a wrapper for the setlocale() function that automatically + * resets the locale to its original value after the test is run. + * + * @throws Exception + */ + protected function setLocale(...$args): void + { + if (\count($args) < 2) { + throw new Exception; + } + + [$category, $locale] = $args; + + if (\defined('LC_MESSAGES')) { + $categories[] = \LC_MESSAGES; + } + + if (!\in_array($category, self::LOCALE_CATEGORIES, true)) { + throw new Exception; + } + + if (!\is_array($locale) && !\is_string($locale)) { + throw new Exception; + } + + $this->locale[$category] = \setlocale($category, 0); + + $result = \setlocale(...$args); + + if ($result === false) { + throw new Exception( + 'The locale functionality is not implemented on your platform, ' . + 'the specified locale does not exist or the category name is ' . + 'invalid.' + ); + } + } + + /** + * Returns a test double for the specified class. + * + * @param string|string[] $originalClassName + * + * @throws Exception + * @throws \InvalidArgumentException + */ + protected function createMock($originalClassName): MockObject + { + return $this->getMockBuilder($originalClassName) + ->disableOriginalConstructor() + ->disableOriginalClone() + ->disableArgumentCloning() + ->disallowMockingUnknownTypes() + ->getMock(); + } + + /** + * Returns a configured test double for the specified class. + * + * @param string|string[] $originalClassName + * + * @throws Exception + * @throws \InvalidArgumentException + */ + protected function createConfiguredMock($originalClassName, array $configuration): MockObject + { + $o = $this->createMock($originalClassName); + + foreach ($configuration as $method => $return) { + $o->method($method)->willReturn($return); + } + + return $o; + } + + /** + * Returns a partial test double for the specified class. + * + * @param string|string[] $originalClassName + * @param string[] $methods + * + * @throws Exception + * @throws \InvalidArgumentException + */ + protected function createPartialMock($originalClassName, array $methods): MockObject + { + return $this->getMockBuilder($originalClassName) + ->disableOriginalConstructor() + ->disableOriginalClone() + ->disableArgumentCloning() + ->disallowMockingUnknownTypes() + ->setMethods(empty($methods) ? null : $methods) + ->getMock(); + } + + /** + * Returns a test proxy for the specified class. + * + * @throws Exception + * @throws \InvalidArgumentException + */ + protected function createTestProxy(string $originalClassName, array $constructorArguments = []): MockObject + { + return $this->getMockBuilder($originalClassName) + ->setConstructorArgs($constructorArguments) + ->enableProxyingToOriginalMethods() + ->getMock(); + } + + /** + * Mocks the specified class and returns the name of the mocked class. + * + * @param string $originalClassName + * @param array $methods + * @param string $mockClassName + * @param bool $callOriginalConstructor + * @param bool $callOriginalClone + * @param bool $callAutoload + * @param bool $cloneArguments + * + * @throws Exception + * @throws ReflectionException + * @throws \InvalidArgumentException + */ + protected function getMockClass($originalClassName, $methods = [], array $arguments = [], $mockClassName = '', $callOriginalConstructor = false, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false): string + { + $mock = $this->getMockObjectGenerator()->getMock( + $originalClassName, + $methods, + $arguments, + $mockClassName, + $callOriginalConstructor, + $callOriginalClone, + $callAutoload, + $cloneArguments + ); + + return \get_class($mock); + } + + /** + * Returns a mock object for the specified abstract class with all abstract + * methods of the class mocked. Concrete methods are not mocked by default. + * To mock concrete methods, use the 7th parameter ($mockedMethods). + * + * @param string $originalClassName + * @param string $mockClassName + * @param bool $callOriginalConstructor + * @param bool $callOriginalClone + * @param bool $callAutoload + * @param array $mockedMethods + * @param bool $cloneArguments + * + * @throws Exception + * @throws ReflectionException + * @throws \InvalidArgumentException + */ + protected function getMockForAbstractClass($originalClassName, array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = [], $cloneArguments = false): MockObject + { + $mockObject = $this->getMockObjectGenerator()->getMockForAbstractClass( + $originalClassName, + $arguments, + $mockClassName, + $callOriginalConstructor, + $callOriginalClone, + $callAutoload, + $mockedMethods, + $cloneArguments + ); + + $this->registerMockObject($mockObject); + + return $mockObject; + } + + /** + * Returns a mock object based on the given WSDL file. + * + * @param string $wsdlFile + * @param string $originalClassName + * @param string $mockClassName + * @param bool $callOriginalConstructor + * @param array $options An array of options passed to SOAPClient::_construct + * + * @throws Exception + * @throws ReflectionException + * @throws \InvalidArgumentException + */ + protected function getMockFromWsdl($wsdlFile, $originalClassName = '', $mockClassName = '', array $methods = [], $callOriginalConstructor = true, array $options = []): MockObject + { + if ($originalClassName === '') { + $fileName = \pathinfo(\basename(\parse_url($wsdlFile)['path']), \PATHINFO_FILENAME); + $originalClassName = \preg_replace('/[^a-zA-Z0-9_]/', '', $fileName); + } + + if (!\class_exists($originalClassName)) { + eval( + $this->getMockObjectGenerator()->generateClassFromWsdl( + $wsdlFile, + $originalClassName, + $methods, + $options + ) + ); + } + + $mockObject = $this->getMockObjectGenerator()->getMock( + $originalClassName, + $methods, + ['', $options], + $mockClassName, + $callOriginalConstructor, + false, + false + ); + + $this->registerMockObject($mockObject); + + return $mockObject; + } + + /** + * Returns a mock object for the specified trait with all abstract methods + * of the trait mocked. Concrete methods to mock can be specified with the + * `$mockedMethods` parameter. + * + * @param string $traitName + * @param string $mockClassName + * @param bool $callOriginalConstructor + * @param bool $callOriginalClone + * @param bool $callAutoload + * @param array $mockedMethods + * @param bool $cloneArguments + * + * @throws Exception + * @throws ReflectionException + * @throws \InvalidArgumentException + */ + protected function getMockForTrait($traitName, array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = [], $cloneArguments = false): MockObject + { + $mockObject = $this->getMockObjectGenerator()->getMockForTrait( + $traitName, + $arguments, + $mockClassName, + $callOriginalConstructor, + $callOriginalClone, + $callAutoload, + $mockedMethods, + $cloneArguments + ); + + $this->registerMockObject($mockObject); + + return $mockObject; + } + + /** + * Returns an object for the specified trait. + * + * @param string $traitName + * @param string $traitClassName + * @param bool $callOriginalConstructor + * @param bool $callOriginalClone + * @param bool $callAutoload + * + * @throws Exception + * @throws ReflectionException + * @throws \InvalidArgumentException + * + * @return object + */ + protected function getObjectForTrait($traitName, array $arguments = [], $traitClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true)/*: object*/ + { + return $this->getMockObjectGenerator()->getObjectForTrait( + $traitName, + $arguments, + $traitClassName, + $callOriginalConstructor, + $callOriginalClone, + $callAutoload + ); + } + + /** + * @param null|string $classOrInterface + * + * @throws Prophecy\Exception\Doubler\ClassNotFoundException + * @throws Prophecy\Exception\Doubler\DoubleException + * @throws Prophecy\Exception\Doubler\InterfaceNotFoundException + */ + protected function prophesize($classOrInterface = null): ObjectProphecy + { + return $this->getProphet()->prophesize($classOrInterface); + } + + /** + * Creates a default TestResult object. + */ + protected function createResult(): TestResult + { + return new TestResult; + } + + /** + * Performs assertions shared by all tests of a test case. + * + * This method is called between setUp() and test. + */ + protected function assertPreConditions()/* The :void return type declaration that should be here would cause a BC issue */ + { + } + + /** + * Performs assertions shared by all tests of a test case. + * + * This method is called between test and tearDown(). + */ + protected function assertPostConditions()/* The :void return type declaration that should be here would cause a BC issue */ + { + } + + /** + * This method is called when a test method did not execute successfully. + * + * @throws Throwable + */ + protected function onNotSuccessfulTest(Throwable $t)/* The :void return type declaration that should be here would cause a BC issue */ + { + throw $t; + } + + private function setExpectedExceptionFromAnnotation(): void + { + try { + $expectedException = \PHPUnit\Util\Test::getExpectedException( + \get_class($this), + $this->name + ); + + if ($expectedException !== false) { + $this->expectException($expectedException['class']); + + if ($expectedException['code'] !== null) { + $this->expectExceptionCode($expectedException['code']); + } + + if ($expectedException['message'] !== '') { + $this->expectExceptionMessage($expectedException['message']); + } elseif ($expectedException['message_regex'] !== '') { + $this->expectExceptionMessageRegExp($expectedException['message_regex']); + } + } + } catch (ReflectionException $e) { + } + } + + private function setUseErrorHandlerFromAnnotation(): void + { + try { + $useErrorHandler = \PHPUnit\Util\Test::getErrorHandlerSettings( + \get_class($this), + $this->name + ); + + if ($useErrorHandler !== null) { + $this->setUseErrorHandler($useErrorHandler); + } + } catch (ReflectionException $e) { + } + } + + private function checkRequirements(): void + { + if (!$this->name || !\method_exists($this, $this->name)) { + return; + } + + $missingRequirements = \PHPUnit\Util\Test::getMissingRequirements( + \get_class($this), + $this->name + ); + + if (!empty($missingRequirements)) { + $this->markTestSkipped(\implode(\PHP_EOL, $missingRequirements)); + } + } + + private function verifyMockObjects(): void + { + foreach ($this->mockObjects as $mockObject) { + if ($mockObject->__phpunit_hasMatchers()) { + $this->numAssertions++; + } + + $mockObject->__phpunit_verify( + $this->shouldInvocationMockerBeReset($mockObject) + ); + } + + if ($this->prophet !== null) { + try { + $this->prophet->checkPredictions(); + } catch (Throwable $t) { + /* Intentionally left empty */ + } + + foreach ($this->prophet->getProphecies() as $objectProphecy) { + foreach ($objectProphecy->getMethodProphecies() as $methodProphecies) { + /** @var MethodProphecy[] $methodProphecies */ + foreach ($methodProphecies as $methodProphecy) { + $this->numAssertions += \count($methodProphecy->getCheckedPredictions()); + } + } + } + + if (isset($t)) { + throw $t; + } + } + } + + private function handleDependencies(): bool + { + if (!empty($this->dependencies) && !$this->inIsolation) { + $className = \get_class($this); + $passed = $this->result->passed(); + $passedKeys = \array_keys($passed); + $numKeys = \count($passedKeys); + + for ($i = 0; $i < $numKeys; $i++) { + $pos = \strpos($passedKeys[$i], ' with data set'); + + if ($pos !== false) { + $passedKeys[$i] = \substr($passedKeys[$i], 0, $pos); + } + } + + $passedKeys = \array_flip(\array_unique($passedKeys)); + + foreach ($this->dependencies as $dependency) { + $deepClone = false; + $shallowClone = false; + + if (\strpos($dependency, 'clone ') === 0) { + $deepClone = true; + $dependency = \substr($dependency, \strlen('clone ')); + } elseif (\strpos($dependency, '!clone ') === 0) { + $deepClone = false; + $dependency = \substr($dependency, \strlen('!clone ')); + } + + if (\strpos($dependency, 'shallowClone ') === 0) { + $shallowClone = true; + $dependency = \substr($dependency, \strlen('shallowClone ')); + } elseif (\strpos($dependency, '!shallowClone ') === 0) { + $shallowClone = false; + $dependency = \substr($dependency, \strlen('!shallowClone ')); + } + + if (\strpos($dependency, '::') === false) { + $dependency = $className . '::' . $dependency; + } + + if (!isset($passedKeys[$dependency])) { + $this->status = BaseTestRunner::STATUS_SKIPPED; + + $this->result->startTest($this); + + $this->result->addError( + $this, + new SkippedTestError( + \sprintf( + 'This test depends on "%s" to pass.', + $dependency + ) + ), + 0 + ); + + $this->result->endTest($this, 0); + + return false; + } + + if (isset($passed[$dependency])) { + if ($passed[$dependency]['size'] != \PHPUnit\Util\Test::UNKNOWN && + $this->getSize() != \PHPUnit\Util\Test::UNKNOWN && + $passed[$dependency]['size'] > $this->getSize()) { + $this->result->addError( + $this, + new SkippedTestError( + 'This test depends on a test that is larger than itself.' + ), + 0 + ); + + return false; + } + + if ($deepClone) { + $deepCopy = new DeepCopy; + $deepCopy->skipUncloneable(false); + + $this->dependencyInput[$dependency] = $deepCopy->copy($passed[$dependency]['result']); + } elseif ($shallowClone) { + $this->dependencyInput[$dependency] = clone $passed[$dependency]['result']; + } else { + $this->dependencyInput[$dependency] = $passed[$dependency]['result']; + } + } else { + $this->dependencyInput[$dependency] = null; + } + } + } + + return true; + } + + /** + * Get the mock object generator, creating it if it doesn't exist. + */ + private function getMockObjectGenerator(): MockGenerator + { + if ($this->mockObjectGenerator === null) { + $this->mockObjectGenerator = new MockGenerator; + } + + return $this->mockObjectGenerator; + } + + private function startOutputBuffering(): void + { + \ob_start(); + + $this->outputBufferingActive = true; + $this->outputBufferingLevel = \ob_get_level(); + } + + /** + * @throws RiskyTestError + */ + private function stopOutputBuffering(): void + { + if (\ob_get_level() !== $this->outputBufferingLevel) { + while (\ob_get_level() >= $this->outputBufferingLevel) { + \ob_end_clean(); + } + + throw new RiskyTestError( + 'Test code or tested code did not (only) close its own output buffers' + ); + } + + $this->output = \ob_get_contents(); + + if ($this->outputCallback !== false) { + $this->output = (string) \call_user_func($this->outputCallback, $this->output); + } + + \ob_end_clean(); + + $this->outputBufferingActive = false; + $this->outputBufferingLevel = \ob_get_level(); + } + + private function snapshotGlobalState(): void + { + if ($this->runTestInSeparateProcess || $this->inIsolation || + (!$this->backupGlobals === true && !$this->backupStaticAttributes)) { + return; + } + + $this->snapshot = $this->createGlobalStateSnapshot($this->backupGlobals === true); + } + + /** + * @throws RiskyTestError + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws \InvalidArgumentException + */ + private function restoreGlobalState(): void + { + if (!$this->snapshot instanceof Snapshot) { + return; + } + + if ($this->beStrictAboutChangesToGlobalState) { + try { + $this->compareGlobalStateSnapshots( + $this->snapshot, + $this->createGlobalStateSnapshot($this->backupGlobals === true) + ); + } catch (RiskyTestError $rte) { + // Intentionally left empty + } + } + + $restorer = new Restorer; + + if ($this->backupGlobals === true) { + $restorer->restoreGlobalVariables($this->snapshot); + } + + if ($this->backupStaticAttributes) { + $restorer->restoreStaticAttributes($this->snapshot); + } + + $this->snapshot = null; + + if (isset($rte)) { + throw $rte; + } + } + + private function createGlobalStateSnapshot(bool $backupGlobals): Snapshot + { + $blacklist = new Blacklist; + + foreach ($this->backupGlobalsBlacklist as $globalVariable) { + $blacklist->addGlobalVariable($globalVariable); + } + + if (!\defined('PHPUNIT_TESTSUITE')) { + $blacklist->addClassNamePrefix('PHPUnit'); + $blacklist->addClassNamePrefix('SebastianBergmann\CodeCoverage'); + $blacklist->addClassNamePrefix('SebastianBergmann\FileIterator'); + $blacklist->addClassNamePrefix('SebastianBergmann\Invoker'); + $blacklist->addClassNamePrefix('SebastianBergmann\Timer'); + $blacklist->addClassNamePrefix('PHP_Token'); + $blacklist->addClassNamePrefix('Symfony'); + $blacklist->addClassNamePrefix('Text_Template'); + $blacklist->addClassNamePrefix('Doctrine\Instantiator'); + $blacklist->addClassNamePrefix('Prophecy'); + + foreach ($this->backupStaticAttributesBlacklist as $class => $attributes) { + foreach ($attributes as $attribute) { + $blacklist->addStaticAttribute($class, $attribute); + } + } + } + + return new Snapshot( + $blacklist, + $backupGlobals, + (bool) $this->backupStaticAttributes, + false, + false, + false, + false, + false, + false, + false + ); + } + + /** + * @throws RiskyTestError + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws \InvalidArgumentException + */ + private function compareGlobalStateSnapshots(Snapshot $before, Snapshot $after): void + { + $backupGlobals = $this->backupGlobals === null || $this->backupGlobals === true; + + if ($backupGlobals) { + $this->compareGlobalStateSnapshotPart( + $before->globalVariables(), + $after->globalVariables(), + "--- Global variables before the test\n+++ Global variables after the test\n" + ); + + $this->compareGlobalStateSnapshotPart( + $before->superGlobalVariables(), + $after->superGlobalVariables(), + "--- Super-global variables before the test\n+++ Super-global variables after the test\n" + ); + } + + if ($this->backupStaticAttributes) { + $this->compareGlobalStateSnapshotPart( + $before->staticAttributes(), + $after->staticAttributes(), + "--- Static attributes before the test\n+++ Static attributes after the test\n" + ); + } + } + + /** + * @throws RiskyTestError + */ + private function compareGlobalStateSnapshotPart(array $before, array $after, string $header): void + { + if ($before != $after) { + $differ = new Differ($header); + $exporter = new Exporter; + + $diff = $differ->diff( + $exporter->export($before), + $exporter->export($after) + ); + + throw new RiskyTestError( + $diff + ); + } + } + + private function getProphet(): Prophet + { + if ($this->prophet === null) { + $this->prophet = new Prophet; + } + + return $this->prophet; + } + + /** + * @throws \SebastianBergmann\ObjectEnumerator\InvalidArgumentException + */ + private function shouldInvocationMockerBeReset(MockObject $mock): bool + { + $enumerator = new Enumerator; + + foreach ($enumerator->enumerate($this->dependencyInput) as $object) { + if ($mock === $object) { + return false; + } + } + + if (!\is_array($this->testResult) && !\is_object($this->testResult)) { + return true; + } + + return !\in_array($mock, $enumerator->enumerate($this->testResult), true); + } + + /** + * @throws \SebastianBergmann\ObjectEnumerator\InvalidArgumentException + * @throws \SebastianBergmann\ObjectReflector\InvalidArgumentException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + private function registerMockObjectsFromTestArguments(array $testArguments, array &$visited = []): void + { + if ($this->registerMockObjectsFromTestArgumentsRecursively) { + $enumerator = new Enumerator; + + foreach ($enumerator->enumerate($testArguments) as $object) { + if ($object instanceof MockObject) { + $this->registerMockObject($object); + } + } + } else { + foreach ($testArguments as $testArgument) { + if ($testArgument instanceof MockObject) { + if ($this->isCloneable($testArgument)) { + $testArgument = clone $testArgument; + } + + $this->registerMockObject($testArgument); + } elseif (\is_array($testArgument) && !\in_array($testArgument, $visited, true)) { + $visited[] = $testArgument; + + $this->registerMockObjectsFromTestArguments( + $testArgument, + $visited + ); + } + } + } + } + + private function setDoesNotPerformAssertionsFromAnnotation(): void + { + $annotations = $this->getAnnotations(); + + if (isset($annotations['method']['doesNotPerformAssertions'])) { + $this->doesNotPerformAssertions = true; + } + } + + private function isCloneable(MockObject $testArgument): bool + { + $reflector = new ReflectionObject($testArgument); + + if (!$reflector->isCloneable()) { + return false; + } + + if ($reflector->hasMethod('__clone') && + $reflector->getMethod('__clone')->isPublic()) { + return true; + } + + return false; + } + + private function unregisterCustomComparators(): void + { + $factory = ComparatorFactory::getInstance(); + + foreach ($this->customComparators as $comparator) { + $factory->unregister($comparator); + } + + $this->customComparators = []; + } + + private function cleanupIniSettings(): void + { + foreach ($this->iniSettings as $varName => $oldValue) { + \ini_set($varName, $oldValue); + } + + $this->iniSettings = []; + } + + private function cleanupLocaleSettings(): void + { + foreach ($this->locale as $category => $locale) { + \setlocale($category, $locale); + } + + $this->locale = []; + } + + /** + * @throws ReflectionException + */ + private function checkExceptionExpectations(Throwable $throwable): bool + { + $result = false; + + if ($this->expectedException !== null || $this->expectedExceptionCode !== null || $this->expectedExceptionMessage !== null || $this->expectedExceptionMessageRegExp !== null) { + $result = true; + } + + if ($throwable instanceof Exception) { + $result = false; + } + + if (\is_string($this->expectedException)) { + $reflector = new ReflectionClass($this->expectedException); + + if ($this->expectedException === 'PHPUnit\Framework\Exception' || + $this->expectedException === '\PHPUnit\Framework\Exception' || + $reflector->isSubclassOf(Exception::class)) { + $result = true; + } + } + + return $result; + } + + private function runInSeparateProcess(): bool + { + return ($this->runTestInSeparateProcess === true || $this->runClassInSeparateProcess === true) && + $this->inIsolation !== true && !$this instanceof PhptTestCase; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/TestFailure.php b/vendor/phpunit/phpunit/src/Framework/TestFailure.php new file mode 100644 index 0000000..fce6af7 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/TestFailure.php @@ -0,0 +1,154 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use PHPUnit\Framework\Error\Error; +use Throwable; + +/** + * A TestFailure collects a failed test together with the caught exception. + */ +class TestFailure +{ + /** + * @var null|Test + */ + protected $failedTest; + + /** + * @var Throwable + */ + protected $thrownException; + + /** + * @var string + */ + private $testName; + + /** + * Returns a description for an exception. + * + * @throws \InvalidArgumentException + */ + public static function exceptionToString(Throwable $e): string + { + if ($e instanceof SelfDescribing) { + $buffer = $e->toString(); + + if ($e instanceof ExpectationFailedException && $e->getComparisonFailure()) { + $buffer .= $e->getComparisonFailure()->getDiff(); + } + + if (!empty($buffer)) { + $buffer = \trim($buffer) . "\n"; + } + + return $buffer; + } + + if ($e instanceof Error) { + return $e->getMessage() . "\n"; + } + + if ($e instanceof ExceptionWrapper) { + return $e->getClassName() . ': ' . $e->getMessage() . "\n"; + } + + return \get_class($e) . ': ' . $e->getMessage() . "\n"; + } + + /** + * Constructs a TestFailure with the given test and exception. + * + * @param Throwable $t + */ + public function __construct(Test $failedTest, $t) + { + if ($failedTest instanceof SelfDescribing) { + $this->testName = $failedTest->toString(); + } else { + $this->testName = \get_class($failedTest); + } + + if (!$failedTest instanceof TestCase || !$failedTest->isInIsolation()) { + $this->failedTest = $failedTest; + } + + $this->thrownException = $t; + } + + /** + * Returns a short description of the failure. + */ + public function toString(): string + { + return \sprintf( + '%s: %s', + $this->testName, + $this->thrownException->getMessage() + ); + } + + /** + * Returns a description for the thrown exception. + * + * @throws \InvalidArgumentException + */ + public function getExceptionAsString(): string + { + return self::exceptionToString($this->thrownException); + } + + /** + * Returns the name of the failing test (including data set, if any). + */ + public function getTestName(): string + { + return $this->testName; + } + + /** + * Returns the failing test. + * + * Note: The test object is not set when the test is executed in process + * isolation. + * + * @see Exception + */ + public function failedTest(): ?Test + { + return $this->failedTest; + } + + /** + * Gets the thrown exception. + */ + public function thrownException(): Throwable + { + return $this->thrownException; + } + + /** + * Returns the exception's message. + */ + public function exceptionMessage(): string + { + return $this->thrownException()->getMessage(); + } + + /** + * Returns true if the thrown exception + * is of type AssertionFailedError. + */ + public function isFailure(): bool + { + return $this->thrownException() instanceof AssertionFailedError; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/TestListener.php b/vendor/phpunit/phpunit/src/Framework/TestListener.php new file mode 100644 index 0000000..e1c670c --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/TestListener.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * A Listener for test progress. + */ +interface TestListener +{ + /** + * An error occurred. + */ + public function addError(Test $test, \Throwable $t, float $time): void; + + /** + * A warning occurred. + */ + public function addWarning(Test $test, Warning $e, float $time): void; + + /** + * A failure occurred. + */ + public function addFailure(Test $test, AssertionFailedError $e, float $time): void; + + /** + * Incomplete test. + */ + public function addIncompleteTest(Test $test, \Throwable $t, float $time): void; + + /** + * Risky test. + */ + public function addRiskyTest(Test $test, \Throwable $t, float $time): void; + + /** + * Skipped test. + */ + public function addSkippedTest(Test $test, \Throwable $t, float $time): void; + + /** + * A test suite started. + */ + public function startTestSuite(TestSuite $suite): void; + + /** + * A test suite ended. + */ + public function endTestSuite(TestSuite $suite): void; + + /** + * A test started. + */ + public function startTest(Test $test): void; + + /** + * A test ended. + */ + public function endTest(Test $test, float $time): void; +} diff --git a/vendor/phpunit/phpunit/src/Framework/TestListenerDefaultImplementation.php b/vendor/phpunit/phpunit/src/Framework/TestListenerDefaultImplementation.php new file mode 100644 index 0000000..df6416f --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/TestListenerDefaultImplementation.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +trait TestListenerDefaultImplementation +{ + public function addError(Test $test, \Throwable $t, float $time): void + { + } + + public function addWarning(Test $test, Warning $e, float $time): void + { + } + + public function addFailure(Test $test, AssertionFailedError $e, float $time): void + { + } + + public function addIncompleteTest(Test $test, \Throwable $t, float $time): void + { + } + + public function addRiskyTest(Test $test, \Throwable $t, float $time): void + { + } + + public function addSkippedTest(Test $test, \Throwable $t, float $time): void + { + } + + public function startTestSuite(TestSuite $suite): void + { + } + + public function endTestSuite(TestSuite $suite): void + { + } + + public function startTest(Test $test): void + { + } + + public function endTest(Test $test, float $time): void + { + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/TestResult.php b/vendor/phpunit/phpunit/src/Framework/TestResult.php new file mode 100644 index 0000000..ee6a872 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/TestResult.php @@ -0,0 +1,1118 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use AssertionError; +use Countable; +use Error; +use PHPUnit\Framework\MockObject\Exception as MockObjectException; +use PHPUnit\Util\Blacklist; +use PHPUnit\Util\ErrorHandler; +use PHPUnit\Util\Printer; +use SebastianBergmann\CodeCoverage\CodeCoverage; +use SebastianBergmann\CodeCoverage\CoveredCodeNotExecutedException as OriginalCoveredCodeNotExecutedException; +use SebastianBergmann\CodeCoverage\Exception as OriginalCodeCoverageException; +use SebastianBergmann\CodeCoverage\MissingCoversAnnotationException as OriginalMissingCoversAnnotationException; +use SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException; +use SebastianBergmann\Invoker\Invoker; +use SebastianBergmann\Invoker\TimeoutException; +use SebastianBergmann\ResourceOperations\ResourceOperations; +use SebastianBergmann\Timer\Timer; +use Throwable; + +/** + * A TestResult collects the results of executing a test case. + */ +class TestResult implements Countable +{ + /** + * @var array + */ + protected $passed = []; + + /** + * @var array + */ + protected $errors = []; + + /** + * @var array + */ + protected $failures = []; + + /** + * @var array + */ + protected $warnings = []; + + /** + * @var array + */ + protected $notImplemented = []; + + /** + * @var array + */ + protected $risky = []; + + /** + * @var array + */ + protected $skipped = []; + + /** + * @var array + */ + protected $listeners = []; + + /** + * @var int + */ + protected $runTests = 0; + + /** + * @var float + */ + protected $time = 0; + + /** + * @var TestSuite + */ + protected $topTestSuite; + + /** + * Code Coverage information. + * + * @var CodeCoverage + */ + protected $codeCoverage; + + /** + * @var bool + */ + protected $convertErrorsToExceptions = true; + + /** + * @var bool + */ + protected $stop = false; + + /** + * @var bool + */ + protected $stopOnError = false; + + /** + * @var bool + */ + protected $stopOnFailure = false; + + /** + * @var bool + */ + protected $stopOnWarning = false; + + /** + * @var bool + */ + protected $beStrictAboutTestsThatDoNotTestAnything = true; + + /** + * @var bool + */ + protected $beStrictAboutOutputDuringTests = false; + + /** + * @var bool + */ + protected $beStrictAboutTodoAnnotatedTests = false; + + /** + * @var bool + */ + protected $beStrictAboutResourceUsageDuringSmallTests = false; + + /** + * @var bool + */ + protected $enforceTimeLimit = false; + + /** + * @var int + */ + protected $timeoutForSmallTests = 1; + + /** + * @var int + */ + protected $timeoutForMediumTests = 10; + + /** + * @var int + */ + protected $timeoutForLargeTests = 60; + + /** + * @var bool + */ + protected $stopOnRisky = false; + + /** + * @var bool + */ + protected $stopOnIncomplete = false; + + /** + * @var bool + */ + protected $stopOnSkipped = false; + + /** + * @var bool + */ + protected $lastTestFailed = false; + + /** + * @var int + */ + private $defaultTimeLimit = 0; + + /** + * @var bool + */ + private $stopOnDefect = false; + + /** + * @var bool + */ + private $registerMockObjectsFromTestArgumentsRecursively = false; + + public static function isAnyCoverageRequired(TestCase $test) + { + $annotations = $test->getAnnotations(); + + // If any methods have covers, coverage must me generated + if (isset($annotations['method']['covers'])) { + return true; + } + + // If there are no explicit covers, and the test class is + // marked as covers nothing, all coverage can be skipped + if (isset($annotations['class']['coversNothing'])) { + return false; + } + + // Otherwise each test method can generate coverage + return true; + } + + /** + * Registers a TestListener. + */ + public function addListener(TestListener $listener): void + { + $this->listeners[] = $listener; + } + + /** + * Unregisters a TestListener. + */ + public function removeListener(TestListener $listener): void + { + foreach ($this->listeners as $key => $_listener) { + if ($listener === $_listener) { + unset($this->listeners[$key]); + } + } + } + + /** + * Flushes all flushable TestListeners. + */ + public function flushListeners(): void + { + foreach ($this->listeners as $listener) { + if ($listener instanceof Printer) { + $listener->flush(); + } + } + } + + /** + * Adds an error to the list of errors. + */ + public function addError(Test $test, Throwable $t, float $time): void + { + if ($t instanceof RiskyTest) { + $this->risky[] = new TestFailure($test, $t); + $notifyMethod = 'addRiskyTest'; + + if ($test instanceof TestCase) { + $test->markAsRisky(); + } + + if ($this->stopOnRisky || $this->stopOnDefect) { + $this->stop(); + } + } elseif ($t instanceof IncompleteTest) { + $this->notImplemented[] = new TestFailure($test, $t); + $notifyMethod = 'addIncompleteTest'; + + if ($this->stopOnIncomplete) { + $this->stop(); + } + } elseif ($t instanceof SkippedTest) { + $this->skipped[] = new TestFailure($test, $t); + $notifyMethod = 'addSkippedTest'; + + if ($this->stopOnSkipped) { + $this->stop(); + } + } else { + $this->errors[] = new TestFailure($test, $t); + $notifyMethod = 'addError'; + + if ($this->stopOnError || $this->stopOnFailure) { + $this->stop(); + } + } + + // @see https://github.com/sebastianbergmann/phpunit/issues/1953 + if ($t instanceof Error) { + $t = new ExceptionWrapper($t); + } + + foreach ($this->listeners as $listener) { + $listener->$notifyMethod($test, $t, $time); + } + + $this->lastTestFailed = true; + $this->time += $time; + } + + /** + * Adds a warning to the list of warnings. + * The passed in exception caused the warning. + */ + public function addWarning(Test $test, Warning $e, float $time): void + { + if ($this->stopOnWarning || $this->stopOnDefect) { + $this->stop(); + } + + $this->warnings[] = new TestFailure($test, $e); + + foreach ($this->listeners as $listener) { + $listener->addWarning($test, $e, $time); + } + + $this->time += $time; + } + + /** + * Adds a failure to the list of failures. + * The passed in exception caused the failure. + */ + public function addFailure(Test $test, AssertionFailedError $e, float $time): void + { + if ($e instanceof RiskyTest || $e instanceof OutputError) { + $this->risky[] = new TestFailure($test, $e); + $notifyMethod = 'addRiskyTest'; + + if ($test instanceof TestCase) { + $test->markAsRisky(); + } + + if ($this->stopOnRisky || $this->stopOnDefect) { + $this->stop(); + } + } elseif ($e instanceof IncompleteTest) { + $this->notImplemented[] = new TestFailure($test, $e); + $notifyMethod = 'addIncompleteTest'; + + if ($this->stopOnIncomplete) { + $this->stop(); + } + } elseif ($e instanceof SkippedTest) { + $this->skipped[] = new TestFailure($test, $e); + $notifyMethod = 'addSkippedTest'; + + if ($this->stopOnSkipped) { + $this->stop(); + } + } else { + $this->failures[] = new TestFailure($test, $e); + $notifyMethod = 'addFailure'; + + if ($this->stopOnFailure || $this->stopOnDefect) { + $this->stop(); + } + } + + foreach ($this->listeners as $listener) { + $listener->$notifyMethod($test, $e, $time); + } + + $this->lastTestFailed = true; + $this->time += $time; + } + + /** + * Informs the result that a test suite will be started. + */ + public function startTestSuite(TestSuite $suite): void + { + if ($this->topTestSuite === null) { + $this->topTestSuite = $suite; + } + + foreach ($this->listeners as $listener) { + $listener->startTestSuite($suite); + } + } + + /** + * Informs the result that a test suite was completed. + */ + public function endTestSuite(TestSuite $suite): void + { + foreach ($this->listeners as $listener) { + $listener->endTestSuite($suite); + } + } + + /** + * Informs the result that a test will be started. + */ + public function startTest(Test $test): void + { + $this->lastTestFailed = false; + $this->runTests += \count($test); + + foreach ($this->listeners as $listener) { + $listener->startTest($test); + } + } + + /** + * Informs the result that a test was completed. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function endTest(Test $test, float $time): void + { + foreach ($this->listeners as $listener) { + $listener->endTest($test, $time); + } + + if (!$this->lastTestFailed && $test instanceof TestCase) { + $class = \get_class($test); + $key = $class . '::' . $test->getName(); + + $this->passed[$key] = [ + 'result' => $test->getResult(), + 'size' => \PHPUnit\Util\Test::getSize( + $class, + $test->getName(false) + ), + ]; + + $this->time += $time; + } + } + + /** + * Returns true if no risky test occurred. + */ + public function allHarmless(): bool + { + return $this->riskyCount() == 0; + } + + /** + * Gets the number of risky tests. + */ + public function riskyCount(): int + { + return \count($this->risky); + } + + /** + * Returns true if no incomplete test occurred. + */ + public function allCompletelyImplemented(): bool + { + return $this->notImplementedCount() == 0; + } + + /** + * Gets the number of incomplete tests. + */ + public function notImplementedCount(): int + { + return \count($this->notImplemented); + } + + /** + * Returns an Enumeration for the risky tests. + */ + public function risky(): array + { + return $this->risky; + } + + /** + * Returns an Enumeration for the incomplete tests. + */ + public function notImplemented(): array + { + return $this->notImplemented; + } + + /** + * Returns true if no test has been skipped. + */ + public function noneSkipped(): bool + { + return $this->skippedCount() == 0; + } + + /** + * Gets the number of skipped tests. + */ + public function skippedCount(): int + { + return \count($this->skipped); + } + + /** + * Returns an Enumeration for the skipped tests. + */ + public function skipped(): array + { + return $this->skipped; + } + + /** + * Gets the number of detected errors. + */ + public function errorCount(): int + { + return \count($this->errors); + } + + /** + * Returns an Enumeration for the errors. + */ + public function errors(): array + { + return $this->errors; + } + + /** + * Gets the number of detected failures. + */ + public function failureCount(): int + { + return \count($this->failures); + } + + /** + * Returns an Enumeration for the failures. + */ + public function failures(): array + { + return $this->failures; + } + + /** + * Gets the number of detected warnings. + */ + public function warningCount(): int + { + return \count($this->warnings); + } + + /** + * Returns an Enumeration for the warnings. + */ + public function warnings(): array + { + return $this->warnings; + } + + /** + * Returns the names of the tests that have passed. + */ + public function passed(): array + { + return $this->passed; + } + + /** + * Returns the (top) test suite. + */ + public function topTestSuite(): TestSuite + { + return $this->topTestSuite; + } + + /** + * Returns whether code coverage information should be collected. + */ + public function getCollectCodeCoverageInformation(): bool + { + return $this->codeCoverage !== null; + } + + /** + * Runs a TestCase. + * + * @throws CodeCoverageException + * @throws OriginalCoveredCodeNotExecutedException + * @throws OriginalMissingCoversAnnotationException + * @throws UnintentionallyCoveredCodeException + * @throws \ReflectionException + * @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException + * @throws \SebastianBergmann\CodeCoverage\RuntimeException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function run(Test $test): void + { + Assert::resetCount(); + + $coversNothing = false; + + if ($test instanceof TestCase) { + $test->setRegisterMockObjectsFromTestArgumentsRecursively( + $this->registerMockObjectsFromTestArgumentsRecursively + ); + + $isAnyCoverageRequired = self::isAnyCoverageRequired($test); + } + + $error = false; + $failure = false; + $warning = false; + $incomplete = false; + $risky = false; + $skipped = false; + + $this->startTest($test); + + $errorHandlerSet = false; + + if ($this->convertErrorsToExceptions) { + $oldErrorHandler = \set_error_handler( + [ErrorHandler::class, 'handleError'], + \E_ALL | \E_STRICT + ); + + if ($oldErrorHandler === null) { + $errorHandlerSet = true; + } else { + \restore_error_handler(); + } + } + + $collectCodeCoverage = $this->codeCoverage !== null && + !$test instanceof WarningTestCase && + $isAnyCoverageRequired; + + if ($collectCodeCoverage) { + $this->codeCoverage->start($test); + } + + $monitorFunctions = $this->beStrictAboutResourceUsageDuringSmallTests && + !$test instanceof WarningTestCase && + $test->getSize() == \PHPUnit\Util\Test::SMALL && + \function_exists('xdebug_start_function_monitor'); + + if ($monitorFunctions) { + /* @noinspection ForgottenDebugOutputInspection */ + \xdebug_start_function_monitor(ResourceOperations::getFunctions()); + } + + Timer::start(); + + try { + if (!$test instanceof WarningTestCase && + $this->enforceTimeLimit && + ($this->defaultTimeLimit || $test->getSize() != \PHPUnit\Util\Test::UNKNOWN) && + \extension_loaded('pcntl') && \class_exists(Invoker::class)) { + switch ($test->getSize()) { + case \PHPUnit\Util\Test::SMALL: + $_timeout = $this->timeoutForSmallTests; + + break; + + case \PHPUnit\Util\Test::MEDIUM: + $_timeout = $this->timeoutForMediumTests; + + break; + + case \PHPUnit\Util\Test::LARGE: + $_timeout = $this->timeoutForLargeTests; + + break; + + case \PHPUnit\Util\Test::UNKNOWN: + $_timeout = $this->defaultTimeLimit; + + break; + } + + $invoker = new Invoker; + $invoker->invoke([$test, 'runBare'], [], $_timeout); + } else { + $test->runBare(); + } + } catch (TimeoutException $e) { + $this->addFailure( + $test, + new RiskyTestError( + $e->getMessage() + ), + $_timeout + ); + + $risky = true; + } catch (MockObjectException $e) { + $e = new Warning( + $e->getMessage() + ); + + $warning = true; + } catch (AssertionFailedError $e) { + $failure = true; + + if ($e instanceof RiskyTestError) { + $risky = true; + } elseif ($e instanceof IncompleteTestError) { + $incomplete = true; + } elseif ($e instanceof SkippedTestError) { + $skipped = true; + } + } catch (AssertionError $e) { + $test->addToAssertionCount(1); + + $failure = true; + $frame = $e->getTrace()[0]; + + $e = new AssertionFailedError( + \sprintf( + '%s in %s:%s', + $e->getMessage(), + $frame['file'], + $frame['line'] + ) + ); + } catch (Warning $e) { + $warning = true; + } catch (Exception $e) { + $error = true; + } catch (Throwable $e) { + $e = new ExceptionWrapper($e); + $error = true; + } + + $time = Timer::stop(); + $test->addToAssertionCount(Assert::getCount()); + + if ($monitorFunctions) { + $blacklist = new Blacklist; + + /** @noinspection ForgottenDebugOutputInspection */ + $functions = \xdebug_get_monitored_functions(); + + /* @noinspection ForgottenDebugOutputInspection */ + \xdebug_stop_function_monitor(); + + foreach ($functions as $function) { + if (!$blacklist->isBlacklisted($function['filename'])) { + $this->addFailure( + $test, + new RiskyTestError( + \sprintf( + '%s() used in %s:%s', + $function['function'], + $function['filename'], + $function['lineno'] + ) + ), + $time + ); + } + } + } + + if ($this->beStrictAboutTestsThatDoNotTestAnything && + $test->getNumAssertions() == 0) { + $risky = true; + } + + if ($collectCodeCoverage) { + $append = !$risky && !$incomplete && !$skipped; + $linesToBeCovered = []; + $linesToBeUsed = []; + + if ($append && $test instanceof TestCase) { + try { + $linesToBeCovered = \PHPUnit\Util\Test::getLinesToBeCovered( + \get_class($test), + $test->getName(false) + ); + + $linesToBeUsed = \PHPUnit\Util\Test::getLinesToBeUsed( + \get_class($test), + $test->getName(false) + ); + } catch (InvalidCoversTargetException $cce) { + $this->addWarning( + $test, + new Warning( + $cce->getMessage() + ), + $time + ); + } + } + + try { + $this->codeCoverage->stop( + $append, + $linesToBeCovered, + $linesToBeUsed + ); + } catch (UnintentionallyCoveredCodeException $cce) { + $this->addFailure( + $test, + new UnintentionallyCoveredCodeError( + 'This test executed code that is not listed as code to be covered or used:' . + \PHP_EOL . $cce->getMessage() + ), + $time + ); + } catch (OriginalCoveredCodeNotExecutedException $cce) { + $this->addFailure( + $test, + new CoveredCodeNotExecutedException( + 'This test did not execute all the code that is listed as code to be covered:' . + \PHP_EOL . $cce->getMessage() + ), + $time + ); + } catch (OriginalMissingCoversAnnotationException $cce) { + if ($linesToBeCovered !== false) { + $this->addFailure( + $test, + new MissingCoversAnnotationException( + 'This test does not have a @covers annotation but is expected to have one' + ), + $time + ); + } + } catch (OriginalCodeCoverageException $cce) { + $error = true; + + $e = $e ?? $cce; + } + } + + if ($errorHandlerSet === true) { + \restore_error_handler(); + } + + if ($error === true) { + $this->addError($test, $e, $time); + } elseif ($failure === true) { + $this->addFailure($test, $e, $time); + } elseif ($warning === true) { + $this->addWarning($test, $e, $time); + } elseif ($this->beStrictAboutTestsThatDoNotTestAnything && + !$test->doesNotPerformAssertions() && + $test->getNumAssertions() == 0) { + $reflected = new \ReflectionClass($test); + $name = $test->getName(false); + + if ($name && $reflected->hasMethod($name)) { + $reflected = $reflected->getMethod($name); + } + $this->addFailure( + $test, + new RiskyTestError(\sprintf( + "This test did not perform any assertions\n\n%s:%d", + $reflected->getFileName(), + $reflected->getStartLine() + )), + $time + ); + } elseif ($this->beStrictAboutTestsThatDoNotTestAnything && + $test->doesNotPerformAssertions() && + $test->getNumAssertions() > 0) { + $this->addFailure( + $test, + new RiskyTestError(\sprintf( + 'This test is annotated with "@doesNotPerformAssertions" but performed %d assertions', + $test->getNumAssertions() + )), + $time + ); + } elseif ($this->beStrictAboutOutputDuringTests && $test->hasOutput()) { + $this->addFailure( + $test, + new OutputError( + \sprintf( + 'This test printed output: %s', + $test->getActualOutput() + ) + ), + $time + ); + } elseif ($this->beStrictAboutTodoAnnotatedTests && $test instanceof TestCase) { + $annotations = $test->getAnnotations(); + + if (isset($annotations['method']['todo'])) { + $this->addFailure( + $test, + new RiskyTestError( + 'Test method is annotated with @todo' + ), + $time + ); + } + } + + $this->endTest($test, $time); + } + + /** + * Gets the number of run tests. + */ + public function count(): int + { + return $this->runTests; + } + + /** + * Checks whether the test run should stop. + */ + public function shouldStop(): bool + { + return $this->stop; + } + + /** + * Marks that the test run should stop. + */ + public function stop(): void + { + $this->stop = true; + } + + /** + * Returns the code coverage object. + */ + public function getCodeCoverage(): ?CodeCoverage + { + return $this->codeCoverage; + } + + /** + * Sets the code coverage object. + */ + public function setCodeCoverage(CodeCoverage $codeCoverage): void + { + $this->codeCoverage = $codeCoverage; + } + + /** + * Enables or disables the error-to-exception conversion. + */ + public function convertErrorsToExceptions(bool $flag): void + { + $this->convertErrorsToExceptions = $flag; + } + + /** + * Returns the error-to-exception conversion setting. + */ + public function getConvertErrorsToExceptions(): bool + { + return $this->convertErrorsToExceptions; + } + + /** + * Enables or disables the stopping when an error occurs. + */ + public function stopOnError(bool $flag): void + { + $this->stopOnError = $flag; + } + + /** + * Enables or disables the stopping when a failure occurs. + */ + public function stopOnFailure(bool $flag): void + { + $this->stopOnFailure = $flag; + } + + /** + * Enables or disables the stopping when a warning occurs. + */ + public function stopOnWarning(bool $flag): void + { + $this->stopOnWarning = $flag; + } + + public function beStrictAboutTestsThatDoNotTestAnything(bool $flag): void + { + $this->beStrictAboutTestsThatDoNotTestAnything = $flag; + } + + public function isStrictAboutTestsThatDoNotTestAnything(): bool + { + return $this->beStrictAboutTestsThatDoNotTestAnything; + } + + public function beStrictAboutOutputDuringTests(bool $flag): void + { + $this->beStrictAboutOutputDuringTests = $flag; + } + + public function isStrictAboutOutputDuringTests(): bool + { + return $this->beStrictAboutOutputDuringTests; + } + + public function beStrictAboutResourceUsageDuringSmallTests(bool $flag): void + { + $this->beStrictAboutResourceUsageDuringSmallTests = $flag; + } + + public function isStrictAboutResourceUsageDuringSmallTests(): bool + { + return $this->beStrictAboutResourceUsageDuringSmallTests; + } + + public function enforceTimeLimit(bool $flag): void + { + $this->enforceTimeLimit = $flag; + } + + public function enforcesTimeLimit(): bool + { + return $this->enforceTimeLimit; + } + + public function beStrictAboutTodoAnnotatedTests(bool $flag): void + { + $this->beStrictAboutTodoAnnotatedTests = $flag; + } + + public function isStrictAboutTodoAnnotatedTests(): bool + { + return $this->beStrictAboutTodoAnnotatedTests; + } + + /** + * Enables or disables the stopping for risky tests. + */ + public function stopOnRisky(bool $flag): void + { + $this->stopOnRisky = $flag; + } + + /** + * Enables or disables the stopping for incomplete tests. + */ + public function stopOnIncomplete(bool $flag): void + { + $this->stopOnIncomplete = $flag; + } + + /** + * Enables or disables the stopping for skipped tests. + */ + public function stopOnSkipped(bool $flag): void + { + $this->stopOnSkipped = $flag; + } + + /** + * Enables or disables the stopping for defects: error, failure, warning + */ + public function stopOnDefect(bool $flag): void + { + $this->stopOnDefect = $flag; + } + + /** + * Returns the time spent running the tests. + */ + public function time(): float + { + return $this->time; + } + + /** + * Returns whether the entire test was successful or not. + */ + public function wasSuccessful(): bool + { + return empty($this->errors) && empty($this->failures) && empty($this->warnings); + } + + /** + * Sets the default timeout for tests + */ + public function setDefaultTimeLimit(int $timeout): void + { + $this->defaultTimeLimit = $timeout; + } + + /** + * Sets the timeout for small tests. + */ + public function setTimeoutForSmallTests(int $timeout): void + { + $this->timeoutForSmallTests = $timeout; + } + + /** + * Sets the timeout for medium tests. + */ + public function setTimeoutForMediumTests(int $timeout): void + { + $this->timeoutForMediumTests = $timeout; + } + + /** + * Sets the timeout for large tests. + */ + public function setTimeoutForLargeTests(int $timeout): void + { + $this->timeoutForLargeTests = $timeout; + } + + /** + * Returns the set timeout for large tests. + */ + public function getTimeoutForLargeTests(): int + { + return $this->timeoutForLargeTests; + } + + public function setRegisterMockObjectsFromTestArgumentsRecursively(bool $flag): void + { + $this->registerMockObjectsFromTestArgumentsRecursively = $flag; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/TestSuite.php b/vendor/phpunit/phpunit/src/Framework/TestSuite.php new file mode 100644 index 0000000..74d3ddb --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/TestSuite.php @@ -0,0 +1,943 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use Iterator; +use IteratorAggregate; +use PHPUnit\Runner\BaseTestRunner; +use PHPUnit\Runner\Filter\Factory; +use PHPUnit\Runner\PhptTestCase; +use PHPUnit\Util\FileLoader; +use PHPUnit\Util\InvalidArgumentHelper; +use ReflectionClass; +use ReflectionMethod; +use Throwable; + +/** + * A TestSuite is a composite of Tests. It runs a collection of test cases. + */ +class TestSuite implements Test, SelfDescribing, IteratorAggregate +{ + /** + * Enable or disable the backup and restoration of the $GLOBALS array. + * + * @var bool + */ + protected $backupGlobals; + + /** + * Enable or disable the backup and restoration of static attributes. + * + * @var bool + */ + protected $backupStaticAttributes; + + /** + * @var bool + */ + protected $runTestInSeparateProcess = false; + + /** + * The name of the test suite. + * + * @var string + */ + protected $name = ''; + + /** + * The test groups of the test suite. + * + * @var array + */ + protected $groups = []; + + /** + * The tests in the test suite. + * + * @var TestCase[] + */ + protected $tests = []; + + /** + * The number of tests in the test suite. + * + * @var int + */ + protected $numTests = -1; + + /** + * @var bool + */ + protected $testCase = false; + + /** + * @var array + */ + protected $foundClasses = []; + + /** + * Last count of tests in this suite. + * + * @var null|int + */ + private $cachedNumTests; + + /** + * @var bool + */ + private $beStrictAboutChangesToGlobalState; + + /** + * @var Factory + */ + private $iteratorFilter; + + /** + * @var string[] + */ + private $declaredClasses; + + /** + * @param string $name + * + * @throws Exception + */ + public static function createTest(ReflectionClass $theClass, $name): Test + { + $className = $theClass->getName(); + + if (!$theClass->isInstantiable()) { + return self::warning( + \sprintf('Cannot instantiate class "%s".', $className) + ); + } + + $backupSettings = \PHPUnit\Util\Test::getBackupSettings( + $className, + $name + ); + + $preserveGlobalState = \PHPUnit\Util\Test::getPreserveGlobalStateSettings( + $className, + $name + ); + + $runTestInSeparateProcess = \PHPUnit\Util\Test::getProcessIsolationSettings( + $className, + $name + ); + + $runClassInSeparateProcess = \PHPUnit\Util\Test::getClassProcessIsolationSettings( + $className, + $name + ); + + $constructor = $theClass->getConstructor(); + + if ($constructor === null) { + throw new Exception('No valid test provided.'); + } + $parameters = $constructor->getParameters(); + + // TestCase() or TestCase($name) + if (\count($parameters) < 2) { + $test = new $className; + } // TestCase($name, $data) + else { + try { + $data = \PHPUnit\Util\Test::getProvidedData( + $className, + $name + ); + } catch (IncompleteTestError $e) { + $message = \sprintf( + 'Test for %s::%s marked incomplete by data provider', + $className, + $name + ); + + $_message = $e->getMessage(); + + if (!empty($_message)) { + $message .= "\n" . $_message; + } + + $data = self::incompleteTest($className, $name, $message); + } catch (SkippedTestError $e) { + $message = \sprintf( + 'Test for %s::%s skipped by data provider', + $className, + $name + ); + + $_message = $e->getMessage(); + + if (!empty($_message)) { + $message .= "\n" . $_message; + } + + $data = self::skipTest($className, $name, $message); + } catch (Throwable $t) { + $message = \sprintf( + 'The data provider specified for %s::%s is invalid.', + $className, + $name + ); + + $_message = $t->getMessage(); + + if (!empty($_message)) { + $message .= "\n" . $_message; + } + + $data = self::warning($message); + } + + // Test method with @dataProvider. + if (isset($data)) { + $test = new DataProviderTestSuite( + $className . '::' . $name + ); + + if (empty($data)) { + $data = self::warning( + \sprintf( + 'No tests found in suite "%s".', + $test->getName() + ) + ); + } + + $groups = \PHPUnit\Util\Test::getGroups($className, $name); + + if ($data instanceof WarningTestCase || + $data instanceof SkippedTestCase || + $data instanceof IncompleteTestCase) { + $test->addTest($data, $groups); + } else { + foreach ($data as $_dataName => $_data) { + $_test = new $className($name, $_data, $_dataName); + + /* @var TestCase $_test */ + + if ($runTestInSeparateProcess) { + $_test->setRunTestInSeparateProcess(true); + + if ($preserveGlobalState !== null) { + $_test->setPreserveGlobalState($preserveGlobalState); + } + } + + if ($runClassInSeparateProcess) { + $_test->setRunClassInSeparateProcess(true); + + if ($preserveGlobalState !== null) { + $_test->setPreserveGlobalState($preserveGlobalState); + } + } + + if ($backupSettings['backupGlobals'] !== null) { + $_test->setBackupGlobals( + $backupSettings['backupGlobals'] + ); + } + + if ($backupSettings['backupStaticAttributes'] !== null) { + $_test->setBackupStaticAttributes( + $backupSettings['backupStaticAttributes'] + ); + } + + $test->addTest($_test, $groups); + } + } + } else { + $test = new $className; + } + } + + if ($test instanceof TestCase) { + $test->setName($name); + + if ($runTestInSeparateProcess) { + $test->setRunTestInSeparateProcess(true); + + if ($preserveGlobalState !== null) { + $test->setPreserveGlobalState($preserveGlobalState); + } + } + + if ($runClassInSeparateProcess) { + $test->setRunClassInSeparateProcess(true); + + if ($preserveGlobalState !== null) { + $test->setPreserveGlobalState($preserveGlobalState); + } + } + + if ($backupSettings['backupGlobals'] !== null) { + $test->setBackupGlobals($backupSettings['backupGlobals']); + } + + if ($backupSettings['backupStaticAttributes'] !== null) { + $test->setBackupStaticAttributes( + $backupSettings['backupStaticAttributes'] + ); + } + } + + return $test; + } + + public static function isTestMethod(ReflectionMethod $method): bool + { + if (\strpos($method->name, 'test') === 0) { + return true; + } + + $annotations = \PHPUnit\Util\Test::parseAnnotations($method->getDocComment()); + + return isset($annotations['test']); + } + + /** + * Constructs a new TestSuite: + * + * - PHPUnit\Framework\TestSuite() constructs an empty TestSuite. + * + * - PHPUnit\Framework\TestSuite(ReflectionClass) constructs a + * TestSuite from the given class. + * + * - PHPUnit\Framework\TestSuite(ReflectionClass, String) + * constructs a TestSuite from the given class with the given + * name. + * + * - PHPUnit\Framework\TestSuite(String) either constructs a + * TestSuite from the given class (if the passed string is the + * name of an existing class) or constructs an empty TestSuite + * with the given name. + * + * @param string $name + * + * @throws Exception + */ + public function __construct($theClass = '', $name = '') + { + $this->declaredClasses = \get_declared_classes(); + + $argumentsValid = false; + + if (\is_object($theClass) && + $theClass instanceof ReflectionClass) { + $argumentsValid = true; + } elseif (\is_string($theClass) && + $theClass !== '' && + \class_exists($theClass, false)) { + $argumentsValid = true; + + if ($name == '') { + $name = $theClass; + } + + $theClass = new ReflectionClass($theClass); + } elseif (\is_string($theClass)) { + $this->setName($theClass); + + return; + } + + if (!$argumentsValid) { + throw new Exception; + } + + if (!$theClass->isSubclassOf(TestCase::class)) { + throw new Exception( + 'Class "' . $theClass->name . '" does not extend PHPUnit\Framework\TestCase.' + ); + } + + if ($name != '') { + $this->setName($name); + } else { + $this->setName($theClass->getName()); + } + + $constructor = $theClass->getConstructor(); + + if ($constructor !== null && + !$constructor->isPublic()) { + $this->addTest( + self::warning( + \sprintf( + 'Class "%s" has no public constructor.', + $theClass->getName() + ) + ) + ); + + return; + } + + foreach ($theClass->getMethods() as $method) { + if ($method->getDeclaringClass()->getName() === Assert::class) { + continue; + } + + if ($method->getDeclaringClass()->getName() === TestCase::class) { + continue; + } + + $this->addTestMethod($theClass, $method); + } + + if (empty($this->tests)) { + $this->addTest( + self::warning( + \sprintf( + 'No tests found in class "%s".', + $theClass->getName() + ) + ) + ); + } + + $this->testCase = true; + } + + /** + * Template Method that is called before the tests + * of this test suite are run. + */ + protected function setUp(): void + { + } + + /** + * Template Method that is called after the tests + * of this test suite have finished running. + */ + protected function tearDown(): void + { + } + + /** + * Returns a string representation of the test suite. + */ + public function toString(): string + { + return $this->getName(); + } + + /** + * Adds a test to the suite. + * + * @param array $groups + */ + public function addTest(Test $test, $groups = []): void + { + $class = new ReflectionClass($test); + + if (!$class->isAbstract()) { + $this->tests[] = $test; + $this->numTests = -1; + + if ($test instanceof self && empty($groups)) { + $groups = $test->getGroups(); + } + + if (empty($groups)) { + $groups = ['default']; + } + + foreach ($groups as $group) { + if (!isset($this->groups[$group])) { + $this->groups[$group] = [$test]; + } else { + $this->groups[$group][] = $test; + } + } + + if ($test instanceof TestCase) { + $test->setGroups($groups); + } + } + } + + /** + * Adds the tests from the given class to the suite. + * + * @throws Exception + */ + public function addTestSuite($testClass): void + { + if (\is_string($testClass) && \class_exists($testClass)) { + $testClass = new ReflectionClass($testClass); + } + + if (!\is_object($testClass)) { + throw InvalidArgumentHelper::factory( + 1, + 'class name or object' + ); + } + + if ($testClass instanceof self) { + $this->addTest($testClass); + } elseif ($testClass instanceof ReflectionClass) { + $suiteMethod = false; + + if (!$testClass->isAbstract() && $testClass->hasMethod(BaseTestRunner::SUITE_METHODNAME)) { + $method = $testClass->getMethod( + BaseTestRunner::SUITE_METHODNAME + ); + + if ($method->isStatic()) { + $this->addTest( + $method->invoke(null, $testClass->getName()) + ); + + $suiteMethod = true; + } + } + + if (!$suiteMethod && !$testClass->isAbstract() && $testClass->isSubclassOf(TestCase::class)) { + $this->addTest(new self($testClass)); + } + } else { + throw new Exception; + } + } + + /** + * Wraps both addTest() and addTestSuite + * as well as the separate import statements for the user's convenience. + * + * If the named file cannot be read or there are no new tests that can be + * added, a PHPUnit\Framework\WarningTestCase will be created instead, + * leaving the current test run untouched. + * + * @throws Exception + */ + public function addTestFile(string $filename): void + { + if (\file_exists($filename) && \substr($filename, -5) == '.phpt') { + $this->addTest( + new PhptTestCase($filename) + ); + + return; + } + + // The given file may contain further stub classes in addition to the + // test class itself. Figure out the actual test class. + $filename = FileLoader::checkAndLoad($filename); + $newClasses = \array_diff(\get_declared_classes(), $this->declaredClasses); + + // The diff is empty in case a parent class (with test methods) is added + // AFTER a child class that inherited from it. To account for that case, + // accumulate all discovered classes, so the parent class may be found in + // a later invocation. + if (!empty($newClasses)) { + // On the assumption that test classes are defined first in files, + // process discovered classes in approximate LIFO order, so as to + // avoid unnecessary reflection. + $this->foundClasses = \array_merge($newClasses, $this->foundClasses); + $this->declaredClasses = \get_declared_classes(); + } + + // The test class's name must match the filename, either in full, or as + // a PEAR/PSR-0 prefixed short name ('NameSpace_ShortName'), or as a + // PSR-1 local short name ('NameSpace\ShortName'). The comparison must be + // anchored to prevent false-positive matches (e.g., 'OtherShortName'). + $shortName = \basename($filename, '.php'); + $shortNameRegEx = '/(?:^|_|\\\\)' . \preg_quote($shortName, '/') . '$/'; + + foreach ($this->foundClasses as $i => $className) { + if (\preg_match($shortNameRegEx, $className)) { + $class = new ReflectionClass($className); + + if ($class->getFileName() == $filename) { + $newClasses = [$className]; + unset($this->foundClasses[$i]); + + break; + } + } + } + + foreach ($newClasses as $className) { + $class = new ReflectionClass($className); + + if (\dirname($class->getFileName()) === __DIR__) { + continue; + } + + if (!$class->isAbstract()) { + if ($class->hasMethod(BaseTestRunner::SUITE_METHODNAME)) { + $method = $class->getMethod( + BaseTestRunner::SUITE_METHODNAME + ); + + if ($method->isStatic()) { + $this->addTest($method->invoke(null, $className)); + } + } elseif ($class->implementsInterface(Test::class)) { + $this->addTestSuite($class); + } + } + } + + $this->numTests = -1; + } + + /** + * Wrapper for addTestFile() that adds multiple test files. + * + * @param array|Iterator $fileNames + * + * @throws Exception + */ + public function addTestFiles($fileNames): void + { + if (!(\is_array($fileNames) || + (\is_object($fileNames) && $fileNames instanceof Iterator))) { + throw InvalidArgumentHelper::factory( + 1, + 'array or iterator' + ); + } + + foreach ($fileNames as $filename) { + $this->addTestFile((string) $filename); + } + } + + /** + * Counts the number of test cases that will be run by this test. + * + * @param bool $preferCache indicates if cache is preferred + */ + public function count($preferCache = false): int + { + if ($preferCache && $this->cachedNumTests !== null) { + return $this->cachedNumTests; + } + + $numTests = 0; + + foreach ($this as $test) { + $numTests += \count($test); + } + + $this->cachedNumTests = $numTests; + + return $numTests; + } + + /** + * Returns the name of the suite. + */ + public function getName(): string + { + return $this->name; + } + + /** + * Returns the test groups of the suite. + */ + public function getGroups(): array + { + return \array_keys($this->groups); + } + + public function getGroupDetails() + { + return $this->groups; + } + + /** + * Set tests groups of the test case + */ + public function setGroupDetails(array $groups): void + { + $this->groups = $groups; + } + + /** + * Runs the tests and collects their result in a TestResult. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function run(TestResult $result = null): TestResult + { + if ($result === null) { + $result = $this->createResult(); + } + + if (\count($this) == 0) { + return $result; + } + + $hookMethods = \PHPUnit\Util\Test::getHookMethods($this->name); + + $result->startTestSuite($this); + + try { + $this->setUp(); + + foreach ($hookMethods['beforeClass'] as $beforeClassMethod) { + if ($this->testCase === true && + \class_exists($this->name, false) && + \method_exists($this->name, $beforeClassMethod)) { + if ($missingRequirements = \PHPUnit\Util\Test::getMissingRequirements($this->name, $beforeClassMethod)) { + $this->markTestSuiteSkipped(\implode(\PHP_EOL, $missingRequirements)); + } + + \call_user_func([$this->name, $beforeClassMethod]); + } + } + } catch (SkippedTestSuiteError $e) { + foreach ($this->tests() as $test) { + $result->startTest($test); + $result->addFailure($test, $e, 0); + $result->endTest($test, 0); + } + + $this->tearDown(); + $result->endTestSuite($this); + + return $result; + } catch (Throwable $t) { + foreach ($this->tests() as $test) { + if ($result->shouldStop()) { + break; + } + + $result->startTest($test); + $result->addError($test, $t, 0); + $result->endTest($test, 0); + } + + $this->tearDown(); + $result->endTestSuite($this); + + return $result; + } + + foreach ($this as $test) { + if ($result->shouldStop()) { + break; + } + + if ($test instanceof TestCase || $test instanceof self) { + $test->setBeStrictAboutChangesToGlobalState($this->beStrictAboutChangesToGlobalState); + $test->setBackupGlobals($this->backupGlobals); + $test->setBackupStaticAttributes($this->backupStaticAttributes); + $test->setRunTestInSeparateProcess($this->runTestInSeparateProcess); + } + + $test->run($result); + } + + foreach ($hookMethods['afterClass'] as $afterClassMethod) { + if ($this->testCase === true && \class_exists($this->name, false) && \method_exists($this->name, $afterClassMethod)) { + \call_user_func([$this->name, $afterClassMethod]); + } + } + + $this->tearDown(); + + $result->endTestSuite($this); + + return $result; + } + + public function setRunTestInSeparateProcess(bool $runTestInSeparateProcess): void + { + $this->runTestInSeparateProcess = $runTestInSeparateProcess; + } + + public function setName(string $name): void + { + $this->name = $name; + } + + /** + * Returns the test at the given index. + * + * @return false|Test + */ + public function testAt(int $index) + { + if (isset($this->tests[$index])) { + return $this->tests[$index]; + } + + return false; + } + + /** + * Returns the tests as an enumeration. + */ + public function tests(): array + { + return $this->tests; + } + + /** + * Set tests of the test suite + */ + public function setTests(array $tests): void + { + $this->tests = $tests; + } + + /** + * Mark the test suite as skipped. + * + * @param string $message + * + * @throws SkippedTestSuiteError + */ + public function markTestSuiteSkipped($message = ''): void + { + throw new SkippedTestSuiteError($message); + } + + /** + * @param bool $beStrictAboutChangesToGlobalState + */ + public function setBeStrictAboutChangesToGlobalState($beStrictAboutChangesToGlobalState): void + { + if (null === $this->beStrictAboutChangesToGlobalState && \is_bool($beStrictAboutChangesToGlobalState)) { + $this->beStrictAboutChangesToGlobalState = $beStrictAboutChangesToGlobalState; + } + } + + /** + * @param bool $backupGlobals + */ + public function setBackupGlobals($backupGlobals): void + { + if (null === $this->backupGlobals && \is_bool($backupGlobals)) { + $this->backupGlobals = $backupGlobals; + } + } + + /** + * @param bool $backupStaticAttributes + */ + public function setBackupStaticAttributes($backupStaticAttributes): void + { + if (null === $this->backupStaticAttributes && \is_bool($backupStaticAttributes)) { + $this->backupStaticAttributes = $backupStaticAttributes; + } + } + + /** + * Returns an iterator for this test suite. + */ + public function getIterator(): Iterator + { + $iterator = new TestSuiteIterator($this); + + if ($this->iteratorFilter !== null) { + $iterator = $this->iteratorFilter->factory($iterator, $this); + } + + return $iterator; + } + + public function injectFilter(Factory $filter): void + { + $this->iteratorFilter = $filter; + + foreach ($this as $test) { + if ($test instanceof self) { + $test->injectFilter($filter); + } + } + } + + /** + * Creates a default TestResult object. + */ + protected function createResult(): TestResult + { + return new TestResult; + } + + /** + * @throws Exception + */ + protected function addTestMethod(ReflectionClass $class, ReflectionMethod $method): void + { + if (!$this->isTestMethod($method)) { + return; + } + + $name = $method->getName(); + + if (!$method->isPublic()) { + $this->addTest( + self::warning( + \sprintf( + 'Test method "%s" in test class "%s" is not public.', + $name, + $class->getName() + ) + ) + ); + + return; + } + + $test = self::createTest($class, $name); + + if ($test instanceof TestCase || $test instanceof DataProviderTestSuite) { + $test->setDependencies( + \PHPUnit\Util\Test::getDependencies($class->getName(), $name) + ); + } + + $this->addTest( + $test, + \PHPUnit\Util\Test::getGroups($class->getName(), $name) + ); + } + + /** + * @param string $message + */ + protected static function warning($message): WarningTestCase + { + return new WarningTestCase($message); + } + + /** + * @param string $class + * @param string $methodName + * @param string $message + */ + protected static function skipTest($class, $methodName, $message): SkippedTestCase + { + return new SkippedTestCase($class, $methodName, $message); + } + + /** + * @param string $class + * @param string $methodName + * @param string $message + */ + protected static function incompleteTest($class, $methodName, $message): IncompleteTestCase + { + return new IncompleteTestCase($class, $methodName, $message); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/TestSuiteIterator.php b/vendor/phpunit/phpunit/src/Framework/TestSuiteIterator.php new file mode 100644 index 0000000..e1f34f1 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/TestSuiteIterator.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +use RecursiveIterator; + +/** + * Iterator for test suites. + */ +final class TestSuiteIterator implements RecursiveIterator +{ + /** + * @var int + */ + private $position; + + /** + * @var Test[] + */ + private $tests; + + public function __construct(TestSuite $testSuite) + { + $this->tests = $testSuite->tests(); + } + + /** + * Rewinds the Iterator to the first element. + */ + public function rewind(): void + { + $this->position = 0; + } + + /** + * Checks if there is a current element after calls to rewind() or next(). + */ + public function valid(): bool + { + return $this->position < \count($this->tests); + } + + /** + * Returns the key of the current element. + */ + public function key(): int + { + return $this->position; + } + + /** + * Returns the current element. + */ + public function current(): Test + { + return $this->valid() ? $this->tests[$this->position] : null; + } + + /** + * Moves forward to next element. + */ + public function next(): void + { + $this->position++; + } + + /** + * Returns the sub iterator for the current element. + */ + public function getChildren(): self + { + return new self( + $this->tests[$this->position] + ); + } + + /** + * Checks whether the current element has children. + */ + public function hasChildren(): bool + { + return $this->tests[$this->position] instanceof TestSuite; + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/UnintentionallyCoveredCodeError.php b/vendor/phpunit/phpunit/src/Framework/UnintentionallyCoveredCodeError.php new file mode 100644 index 0000000..af2623d --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/UnintentionallyCoveredCodeError.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * Extension to PHPUnit\Framework\AssertionFailedError to mark the special + * case of a test that unintentionally covers code. + */ +class UnintentionallyCoveredCodeError extends RiskyTestError +{ +} diff --git a/vendor/phpunit/phpunit/src/Framework/Warning.php b/vendor/phpunit/phpunit/src/Framework/Warning.php new file mode 100644 index 0000000..726eb07 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/Warning.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * Thrown when there is a warning. + */ +class Warning extends Exception implements SelfDescribing +{ + /** + * Wrapper for getMessage() which is declared as final. + */ + public function toString(): string + { + return $this->getMessage(); + } +} diff --git a/vendor/phpunit/phpunit/src/Framework/WarningTestCase.php b/vendor/phpunit/phpunit/src/Framework/WarningTestCase.php new file mode 100644 index 0000000..53f6bff --- /dev/null +++ b/vendor/phpunit/phpunit/src/Framework/WarningTestCase.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Framework; + +/** + * A warning. + */ +class WarningTestCase extends TestCase +{ + /** + * @var string + */ + protected $message = ''; + + /** + * @var bool + */ + protected $backupGlobals = false; + + /** + * @var bool + */ + protected $backupStaticAttributes = false; + + /** + * @var bool + */ + protected $runTestInSeparateProcess = false; + + /** + * @var bool + */ + protected $useErrorHandler = false; + + /** + * @param string $message + */ + public function __construct($message = '') + { + $this->message = $message; + parent::__construct('Warning'); + } + + public function getMessage(): string + { + return $this->message; + } + + /** + * Returns a string representation of the test case. + */ + public function toString(): string + { + return 'Warning'; + } + + /** + * @throws Exception + */ + protected function runTest(): void + { + throw new Warning($this->message); + } +} diff --git a/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php b/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php new file mode 100644 index 0000000..899c737 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php @@ -0,0 +1,145 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestSuite; +use ReflectionClass; +use ReflectionException; +use SebastianBergmann\FileIterator\Facade as FileIteratorFacade; + +/** + * Base class for all test runners. + */ +abstract class BaseTestRunner +{ + public const STATUS_UNKNOWN = -1; + + public const STATUS_PASSED = 0; + + public const STATUS_SKIPPED = 1; + + public const STATUS_INCOMPLETE = 2; + + public const STATUS_FAILURE = 3; + + public const STATUS_ERROR = 4; + + public const STATUS_RISKY = 5; + + public const STATUS_WARNING = 6; + + public const SUITE_METHODNAME = 'suite'; + + /** + * Returns the loader to be used. + */ + public function getLoader(): TestSuiteLoader + { + return new StandardTestSuiteLoader; + } + + /** + * Returns the Test corresponding to the given suite. + * This is a template method, subclasses override + * the runFailed() and clearStatus() methods. + * + * @param array|string $suffixes + * + * @throws Exception + */ + public function getTest(string $suiteClassName, string $suiteClassFile = '', $suffixes = ''): ?Test + { + if (\is_dir($suiteClassName) && + !\is_file($suiteClassName . '.php') && empty($suiteClassFile)) { + $facade = new FileIteratorFacade; + $files = $facade->getFilesAsArray( + $suiteClassName, + $suffixes + ); + + $suite = new TestSuite($suiteClassName); + $suite->addTestFiles($files); + + return $suite; + } + + try { + $testClass = $this->loadSuiteClass( + $suiteClassName, + $suiteClassFile + ); + } catch (Exception $e) { + $this->runFailed($e->getMessage()); + + return null; + } + + try { + $suiteMethod = $testClass->getMethod(self::SUITE_METHODNAME); + + if (!$suiteMethod->isStatic()) { + $this->runFailed( + 'suite() method must be static.' + ); + + return null; + } + + try { + $test = $suiteMethod->invoke(null, $testClass->getName()); + } catch (ReflectionException $e) { + $this->runFailed( + \sprintf( + "Failed to invoke suite() method.\n%s", + $e->getMessage() + ) + ); + + return null; + } + } catch (ReflectionException $e) { + try { + $test = new TestSuite($testClass); + } catch (Exception $e) { + $test = new TestSuite; + $test->setName($suiteClassName); + } + } + + $this->clearStatus(); + + return $test; + } + + /** + * Returns the loaded ReflectionClass for a suite name. + */ + protected function loadSuiteClass(string $suiteClassName, string $suiteClassFile = ''): ReflectionClass + { + $loader = $this->getLoader(); + + return $loader->load($suiteClassName, $suiteClassFile); + } + + /** + * Clears the status message. + */ + protected function clearStatus(): void + { + } + + /** + * Override to define how to handle a failed loading of + * a test suite. + */ + abstract protected function runFailed(string $message); +} diff --git a/vendor/phpunit/phpunit/src/Runner/Exception.php b/vendor/phpunit/phpunit/src/Runner/Exception.php new file mode 100644 index 0000000..18cdfa7 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Exception.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +class Exception extends \RuntimeException implements \PHPUnit\Exception +{ +} diff --git a/vendor/phpunit/phpunit/src/Runner/Filter/ExcludeGroupFilterIterator.php b/vendor/phpunit/phpunit/src/Runner/Filter/ExcludeGroupFilterIterator.php new file mode 100644 index 0000000..17af7dc --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Filter/ExcludeGroupFilterIterator.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner\Filter; + +class ExcludeGroupFilterIterator extends GroupFilterIterator +{ + protected function doAccept(string $hash): bool + { + return !\in_array($hash, $this->groupTests, true); + } +} diff --git a/vendor/phpunit/phpunit/src/Runner/Filter/Factory.php b/vendor/phpunit/phpunit/src/Runner/Filter/Factory.php new file mode 100644 index 0000000..139e097 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Filter/Factory.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner\Filter; + +use FilterIterator; +use InvalidArgumentException; +use Iterator; +use PHPUnit\Framework\TestSuite; +use ReflectionClass; + +class Factory +{ + /** + * @var array + */ + private $filters = []; + + /** + * @throws InvalidArgumentException + */ + public function addFilter(ReflectionClass $filter, $args): void + { + if (!$filter->isSubclassOf(\RecursiveFilterIterator::class)) { + throw new InvalidArgumentException( + \sprintf( + 'Class "%s" does not extend RecursiveFilterIterator', + $filter->name + ) + ); + } + + $this->filters[] = [$filter, $args]; + } + + public function factory(Iterator $iterator, TestSuite $suite): FilterIterator + { + foreach ($this->filters as $filter) { + [$class, $args] = $filter; + $iterator = $class->newInstance($iterator, $args, $suite); + } + + return $iterator; + } +} diff --git a/vendor/phpunit/phpunit/src/Runner/Filter/GroupFilterIterator.php b/vendor/phpunit/phpunit/src/Runner/Filter/GroupFilterIterator.php new file mode 100644 index 0000000..e0c29c1 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Filter/GroupFilterIterator.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner\Filter; + +use PHPUnit\Framework\TestSuite; +use RecursiveFilterIterator; +use RecursiveIterator; + +abstract class GroupFilterIterator extends RecursiveFilterIterator +{ + /** + * @var string[] + */ + protected $groupTests = []; + + public function __construct(RecursiveIterator $iterator, array $groups, TestSuite $suite) + { + parent::__construct($iterator); + + foreach ($suite->getGroupDetails() as $group => $tests) { + if (\in_array($group, $groups, true)) { + $testHashes = \array_map( + 'spl_object_hash', + $tests + ); + + $this->groupTests = \array_merge($this->groupTests, $testHashes); + } + } + } + + public function accept(): bool + { + $test = $this->getInnerIterator()->current(); + + if ($test instanceof TestSuite) { + return true; + } + + return $this->doAccept(\spl_object_hash($test)); + } + + abstract protected function doAccept(string $hash); +} diff --git a/vendor/phpunit/phpunit/src/Runner/Filter/IncludeGroupFilterIterator.php b/vendor/phpunit/phpunit/src/Runner/Filter/IncludeGroupFilterIterator.php new file mode 100644 index 0000000..c9dc1f8 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Filter/IncludeGroupFilterIterator.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner\Filter; + +class IncludeGroupFilterIterator extends GroupFilterIterator +{ + protected function doAccept(string $hash): bool + { + return \in_array($hash, $this->groupTests, true); + } +} diff --git a/vendor/phpunit/phpunit/src/Runner/Filter/NameFilterIterator.php b/vendor/phpunit/phpunit/src/Runner/Filter/NameFilterIterator.php new file mode 100644 index 0000000..18734a0 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Filter/NameFilterIterator.php @@ -0,0 +1,122 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner\Filter; + +use PHPUnit\Framework\TestSuite; +use PHPUnit\Framework\WarningTestCase; +use PHPUnit\Util\RegularExpression; +use RecursiveFilterIterator; +use RecursiveIterator; + +class NameFilterIterator extends RecursiveFilterIterator +{ + /** + * @var string + */ + protected $filter; + + /** + * @var int + */ + protected $filterMin; + + /** + * @var int + */ + protected $filterMax; + + /** + * @throws \Exception + */ + public function __construct(RecursiveIterator $iterator, string $filter) + { + parent::__construct($iterator); + + $this->setFilter($filter); + } + + public function accept(): bool + { + $test = $this->getInnerIterator()->current(); + + if ($test instanceof TestSuite) { + return true; + } + + $tmp = \PHPUnit\Util\Test::describe($test); + + if ($test instanceof WarningTestCase) { + $name = $test->getMessage(); + } else { + if ($tmp[0] !== '') { + $name = \implode('::', $tmp); + } else { + $name = $tmp[1]; + } + } + + $accepted = @\preg_match($this->filter, $name, $matches); + + if ($accepted && isset($this->filterMax)) { + $set = \end($matches); + $accepted = $set >= $this->filterMin && $set <= $this->filterMax; + } + + return (bool) $accepted; + } + + /** + * @throws \Exception + */ + protected function setFilter(string $filter): void + { + if (RegularExpression::safeMatch($filter, '') === false) { + // Handles: + // * testAssertEqualsSucceeds#4 + // * testAssertEqualsSucceeds#4-8 + if (\preg_match('/^(.*?)#(\d+)(?:-(\d+))?$/', $filter, $matches)) { + if (isset($matches[3]) && $matches[2] < $matches[3]) { + $filter = \sprintf( + '%s.*with data set #(\d+)$', + $matches[1] + ); + + $this->filterMin = $matches[2]; + $this->filterMax = $matches[3]; + } else { + $filter = \sprintf( + '%s.*with data set #%s$', + $matches[1], + $matches[2] + ); + } + } // Handles: + // * testDetermineJsonError@JSON_ERROR_NONE + // * testDetermineJsonError@JSON.* + elseif (\preg_match('/^(.*?)@(.+)$/', $filter, $matches)) { + $filter = \sprintf( + '%s.*with data set "%s"$', + $matches[1], + $matches[2] + ); + } + + // Escape delimiters in regular expression. Do NOT use preg_quote, + // to keep magic characters. + $filter = \sprintf('/%s/i', \str_replace( + '/', + '\\/', + $filter + )); + } + + $this->filter = $filter; + } +} diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterIncompleteTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterIncompleteTestHook.php new file mode 100644 index 0000000..35ded5d --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterIncompleteTestHook.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +interface AfterIncompleteTestHook extends TestHook +{ + public function executeAfterIncompleteTest(string $test, string $message, float $time): void; +} diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterLastTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterLastTestHook.php new file mode 100644 index 0000000..7dee9f9 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterLastTestHook.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +interface AfterLastTestHook extends Hook +{ + public function executeAfterLastTest(): void; +} diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterRiskyTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterRiskyTestHook.php new file mode 100644 index 0000000..7fe9ee7 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterRiskyTestHook.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +interface AfterRiskyTestHook extends TestHook +{ + public function executeAfterRiskyTest(string $test, string $message, float $time): void; +} diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterSkippedTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterSkippedTestHook.php new file mode 100644 index 0000000..f9253b5 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterSkippedTestHook.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +interface AfterSkippedTestHook extends TestHook +{ + public function executeAfterSkippedTest(string $test, string $message, float $time): void; +} diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterSuccessfulTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterSuccessfulTestHook.php new file mode 100644 index 0000000..6b55cc8 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterSuccessfulTestHook.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +interface AfterSuccessfulTestHook extends TestHook +{ + public function executeAfterSuccessfulTest(string $test, float $time): void; +} diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestErrorHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestErrorHook.php new file mode 100644 index 0000000..f5c23fb --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestErrorHook.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +interface AfterTestErrorHook extends TestHook +{ + public function executeAfterTestError(string $test, string $message, float $time): void; +} diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestFailureHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestFailureHook.php new file mode 100644 index 0000000..9ed2939 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestFailureHook.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +interface AfterTestFailureHook extends TestHook +{ + public function executeAfterTestFailure(string $test, string $message, float $time): void; +} diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestHook.php new file mode 100644 index 0000000..f463732 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestHook.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +interface AfterTestHook extends Hook +{ + /** + * This hook will fire after any test, regardless of the result. + * + * For more fine grained control, have a look at the other hooks + * that extend PHPUnit\Runner\Hook. + */ + public function executeAfterTest(string $test, float $time): void; +} diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestWarningHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestWarningHook.php new file mode 100644 index 0000000..12de80f --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Hook/AfterTestWarningHook.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +interface AfterTestWarningHook extends TestHook +{ + public function executeAfterTestWarning(string $test, string $message, float $time): void; +} diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/BeforeFirstTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/BeforeFirstTestHook.php new file mode 100644 index 0000000..59b6666 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Hook/BeforeFirstTestHook.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +interface BeforeFirstTestHook extends Hook +{ + public function executeBeforeFirstTest(): void; +} diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/BeforeTestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/BeforeTestHook.php new file mode 100644 index 0000000..8bbf8a9 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Hook/BeforeTestHook.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +interface BeforeTestHook extends TestHook +{ + public function executeBeforeTest(string $test): void; +} diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/Hook.php b/vendor/phpunit/phpunit/src/Runner/Hook/Hook.php new file mode 100644 index 0000000..546f1a3 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Hook/Hook.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +interface Hook +{ +} diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/TestHook.php b/vendor/phpunit/phpunit/src/Runner/Hook/TestHook.php new file mode 100644 index 0000000..47c41f9 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Hook/TestHook.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +interface TestHook extends Hook +{ +} diff --git a/vendor/phpunit/phpunit/src/Runner/Hook/TestListenerAdapter.php b/vendor/phpunit/phpunit/src/Runner/Hook/TestListenerAdapter.php new file mode 100644 index 0000000..02ed700 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Hook/TestListenerAdapter.php @@ -0,0 +1,137 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestListener; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Framework\Warning; +use PHPUnit\Util\Test as TestUtil; + +final class TestListenerAdapter implements TestListener +{ + /** + * @var TestHook[] + */ + private $hooks = []; + + /** + * @var bool + */ + private $lastTestWasNotSuccessful; + + public function add(TestHook $hook): void + { + $this->hooks[] = $hook; + } + + public function startTest(Test $test): void + { + foreach ($this->hooks as $hook) { + if ($hook instanceof BeforeTestHook) { + $hook->executeBeforeTest(TestUtil::describeAsString($test)); + } + } + + $this->lastTestWasNotSuccessful = false; + } + + public function addError(Test $test, \Throwable $t, float $time): void + { + foreach ($this->hooks as $hook) { + if ($hook instanceof AfterTestErrorHook) { + $hook->executeAfterTestError(TestUtil::describeAsString($test), $t->getMessage(), $time); + } + } + + $this->lastTestWasNotSuccessful = true; + } + + public function addWarning(Test $test, Warning $e, float $time): void + { + foreach ($this->hooks as $hook) { + if ($hook instanceof AfterTestWarningHook) { + $hook->executeAfterTestWarning(TestUtil::describeAsString($test), $e->getMessage(), $time); + } + } + + $this->lastTestWasNotSuccessful = true; + } + + public function addFailure(Test $test, AssertionFailedError $e, float $time): void + { + foreach ($this->hooks as $hook) { + if ($hook instanceof AfterTestFailureHook) { + $hook->executeAfterTestFailure(TestUtil::describeAsString($test), $e->getMessage(), $time); + } + } + + $this->lastTestWasNotSuccessful = true; + } + + public function addIncompleteTest(Test $test, \Throwable $t, float $time): void + { + foreach ($this->hooks as $hook) { + if ($hook instanceof AfterIncompleteTestHook) { + $hook->executeAfterIncompleteTest(TestUtil::describeAsString($test), $t->getMessage(), $time); + } + } + + $this->lastTestWasNotSuccessful = true; + } + + public function addRiskyTest(Test $test, \Throwable $t, float $time): void + { + foreach ($this->hooks as $hook) { + if ($hook instanceof AfterRiskyTestHook) { + $hook->executeAfterRiskyTest(TestUtil::describeAsString($test), $t->getMessage(), $time); + } + } + + $this->lastTestWasNotSuccessful = true; + } + + public function addSkippedTest(Test $test, \Throwable $t, float $time): void + { + foreach ($this->hooks as $hook) { + if ($hook instanceof AfterSkippedTestHook) { + $hook->executeAfterSkippedTest(TestUtil::describeAsString($test), $t->getMessage(), $time); + } + } + + $this->lastTestWasNotSuccessful = true; + } + + public function endTest(Test $test, float $time): void + { + if ($this->lastTestWasNotSuccessful !== true) { + foreach ($this->hooks as $hook) { + if ($hook instanceof AfterSuccessfulTestHook) { + $hook->executeAfterSuccessfulTest(TestUtil::describeAsString($test), $time); + } + } + } + + foreach ($this->hooks as $hook) { + if ($hook instanceof AfterTestHook) { + $hook->executeAfterTest(TestUtil::describeAsString($test), $time); + } + } + } + + public function startTestSuite(TestSuite $suite): void + { + } + + public function endTestSuite(TestSuite $suite): void + { + } +} diff --git a/vendor/phpunit/phpunit/src/Runner/PhptTestCase.php b/vendor/phpunit/phpunit/src/Runner/PhptTestCase.php new file mode 100644 index 0000000..bbc1a23 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/PhptTestCase.php @@ -0,0 +1,590 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +use PHPUnit\Framework\Assert; +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\IncompleteTestError; +use PHPUnit\Framework\SelfDescribing; +use PHPUnit\Framework\SkippedTestError; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestResult; +use PHPUnit\Util\PHP\AbstractPhpProcess; +use SebastianBergmann\Timer\Timer; +use Text_Template; +use Throwable; + +/** + * Runner for PHPT test cases. + */ +class PhptTestCase implements Test, SelfDescribing +{ + /** + * @var string[] + */ + private const SETTINGS = [ + 'allow_url_fopen=1', + 'auto_append_file=', + 'auto_prepend_file=', + 'disable_functions=', + 'display_errors=1', + 'docref_root=', + 'docref_ext=.html', + 'error_append_string=', + 'error_prepend_string=', + 'error_reporting=-1', + 'html_errors=0', + 'log_errors=0', + 'magic_quotes_runtime=0', + 'output_handler=', + 'open_basedir=', + 'output_buffering=Off', + 'report_memleaks=0', + 'report_zend_debug=0', + 'safe_mode=0', + 'xdebug.default_enable=0', + ]; + + /** + * @var string + */ + private $filename; + + /** + * @var AbstractPhpProcess + */ + private $phpUtil; + + /** + * @var string + */ + private $output = ''; + + /** + * Constructs a test case with the given filename. + * + * @throws Exception + */ + public function __construct(string $filename, AbstractPhpProcess $phpUtil = null) + { + if (!\is_file($filename)) { + throw new Exception( + \sprintf( + 'File "%s" does not exist.', + $filename + ) + ); + } + + $this->filename = $filename; + $this->phpUtil = $phpUtil ?: AbstractPhpProcess::factory(); + } + + /** + * Counts the number of test cases executed by run(TestResult result). + */ + public function count(): int + { + return 1; + } + + /** + * Runs a test and collects its result in a TestResult instance. + * + * @throws Exception + * @throws \ReflectionException + * @throws \SebastianBergmann\CodeCoverage\CoveredCodeNotExecutedException + * @throws \SebastianBergmann\CodeCoverage\InvalidArgumentException + * @throws \SebastianBergmann\CodeCoverage\MissingCoversAnnotationException + * @throws \SebastianBergmann\CodeCoverage\RuntimeException + * @throws \SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function run(TestResult $result = null): TestResult + { + $sections = $this->parse(); + $code = $this->render($sections['FILE']); + + if ($result === null) { + $result = new TestResult; + } + + $xfail = false; + $settings = $this->parseIniSection(self::SETTINGS); + + $result->startTest($this); + + if (isset($sections['INI'])) { + $settings = $this->parseIniSection($sections['INI'], $settings); + } + + if (isset($sections['ENV'])) { + $env = $this->parseEnvSection($sections['ENV']); + $this->phpUtil->setEnv($env); + } + + $this->phpUtil->setUseStderrRedirection(true); + + if ($result->enforcesTimeLimit()) { + $this->phpUtil->setTimeout($result->getTimeoutForLargeTests()); + } + + $skip = $this->runSkip($sections, $result, $settings); + + if ($skip) { + return $result; + } + + if (isset($sections['XFAIL'])) { + $xfail = \trim($sections['XFAIL']); + } + + if (isset($sections['STDIN'])) { + $this->phpUtil->setStdin($sections['STDIN']); + } + + if (isset($sections['ARGS'])) { + $this->phpUtil->setArgs($sections['ARGS']); + } + + if ($result->getCollectCodeCoverageInformation()) { + $this->renderForCoverage($code); + } + + Timer::start(); + + $jobResult = $this->phpUtil->runJob($code, $this->stringifyIni($settings)); + $time = Timer::stop(); + $this->output = $jobResult['stdout'] ?? ''; + + if ($result->getCollectCodeCoverageInformation() && ($coverage = $this->cleanupForCoverage())) { + $result->getCodeCoverage()->append($coverage, $this, true, [], [], true); + } + + try { + $this->assertPhptExpectation($sections, $jobResult['stdout']); + } catch (AssertionFailedError $e) { + $failure = $e; + + if ($xfail !== false) { + $failure = new IncompleteTestError($xfail, 0, $e); + } + $result->addFailure($this, $failure, $time); + } catch (Throwable $t) { + $result->addError($this, $t, $time); + } + + if ($result->allCompletelyImplemented() && $xfail !== false) { + $result->addFailure($this, new IncompleteTestError('XFAIL section but test passes'), $time); + } + + $this->runClean($sections); + + $result->endTest($this, $time); + + return $result; + } + + /** + * Returns the name of the test case. + */ + public function getName(): string + { + return $this->toString(); + } + + /** + * Returns a string representation of the test case. + */ + public function toString(): string + { + return $this->filename; + } + + public function usesDataProvider(): bool + { + return false; + } + + public function getNumAssertions(): int + { + return 1; + } + + public function getActualOutput(): string + { + return $this->output; + } + + public function hasOutput(): bool + { + return !empty($this->output); + } + + /** + * Parse --INI-- section key value pairs and return as array. + * + * @param array|string + */ + private function parseIniSection($content, $ini = []): array + { + if (\is_string($content)) { + $content = \explode("\n", \trim($content)); + } + + foreach ($content as $setting) { + if (\strpos($setting, '=') === false) { + continue; + } + + $setting = \explode('=', $setting, 2); + $name = \trim($setting[0]); + $value = \trim($setting[1]); + + if ($name === 'extension' || $name === 'zend_extension') { + if (!isset($ini[$name])) { + $ini[$name] = []; + } + + $ini[$name][] = $value; + + continue; + } + + $ini[$name] = $value; + } + + return $ini; + } + + private function parseEnvSection(string $content): array + { + $env = []; + + foreach (\explode("\n", \trim($content)) as $e) { + $e = \explode('=', \trim($e), 2); + + if (!empty($e[0]) && isset($e[1])) { + $env[$e[0]] = $e[1]; + } + } + + return $env; + } + + /** + * @throws Exception + */ + private function assertPhptExpectation(array $sections, string $output): void + { + $assertions = [ + 'EXPECT' => 'assertEquals', + 'EXPECTF' => 'assertStringMatchesFormat', + 'EXPECTREGEX' => 'assertRegExp', + ]; + + $actual = \preg_replace('/\r\n/', "\n", \trim($output)); + + foreach ($assertions as $sectionName => $sectionAssertion) { + if (isset($sections[$sectionName])) { + $sectionContent = \preg_replace('/\r\n/', "\n", \trim($sections[$sectionName])); + $expected = $sectionName === 'EXPECTREGEX' ? "/{$sectionContent}/" : $sectionContent; + + if ($expected === null) { + throw new Exception('No PHPT expectation found'); + } + Assert::$sectionAssertion($expected, $actual); + + return; + } + } + + throw new Exception('No PHPT assertion found'); + } + + /** + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + private function runSkip(array &$sections, TestResult $result, array $settings): bool + { + if (!isset($sections['SKIPIF'])) { + return false; + } + + $skipif = $this->render($sections['SKIPIF']); + $jobResult = $this->phpUtil->runJob($skipif, $this->stringifyIni($settings)); + + if (!\strncasecmp('skip', \ltrim($jobResult['stdout']), 4)) { + $message = ''; + + if (\preg_match('/^\s*skip\s*(.+)\s*/i', $jobResult['stdout'], $skipMatch)) { + $message = \substr($skipMatch[1], 2); + } + + $result->addFailure($this, new SkippedTestError($message), 0); + $result->endTest($this, 0); + + return true; + } + + return false; + } + + private function runClean(array &$sections): void + { + $this->phpUtil->setStdin(''); + $this->phpUtil->setArgs(''); + + if (isset($sections['CLEAN'])) { + $cleanCode = $this->render($sections['CLEAN']); + + $this->phpUtil->runJob($cleanCode, self::SETTINGS); + } + } + + /** + * @throws Exception + */ + private function parse(): array + { + $sections = []; + $section = ''; + + $unsupportedSections = [ + 'REDIRECTTEST', + 'REQUEST', + 'POST', + 'PUT', + 'POST_RAW', + 'GZIP_POST', + 'DEFLATE_POST', + 'GET', + 'COOKIE', + 'HEADERS', + 'CGI', + 'EXPECTHEADERS', + 'EXTENSIONS', + 'PHPDBG', + ]; + + foreach (\file($this->filename) as $line) { + if (\preg_match('/^--([_A-Z]+)--/', $line, $result)) { + $section = $result[1]; + $sections[$section] = ''; + + continue; + } + + if (empty($section)) { + throw new Exception('Invalid PHPT file'); + } + + $sections[$section] .= $line; + } + + if (isset($sections['FILEEOF'])) { + $sections['FILE'] = \rtrim($sections['FILEEOF'], "\r\n"); + unset($sections['FILEEOF']); + } + + $this->parseExternal($sections); + + if (!$this->validate($sections)) { + throw new Exception('Invalid PHPT file'); + } + + foreach ($unsupportedSections as $section) { + if (isset($sections[$section])) { + throw new Exception( + 'PHPUnit does not support this PHPT file' + ); + } + } + + return $sections; + } + + /** + * @throws Exception + */ + private function parseExternal(array &$sections): void + { + $allowSections = [ + 'FILE', + 'EXPECT', + 'EXPECTF', + 'EXPECTREGEX', + ]; + $testDirectory = \dirname($this->filename) . \DIRECTORY_SEPARATOR; + + foreach ($allowSections as $section) { + if (isset($sections[$section . '_EXTERNAL'])) { + $externalFilename = \trim($sections[$section . '_EXTERNAL']); + + if (!\is_file($testDirectory . $externalFilename) || + !\is_readable($testDirectory . $externalFilename)) { + throw new Exception( + \sprintf( + 'Could not load --%s-- %s for PHPT file', + $section . '_EXTERNAL', + $testDirectory . $externalFilename + ) + ); + } + + $sections[$section] = \file_get_contents($testDirectory . $externalFilename); + + unset($sections[$section . '_EXTERNAL']); + } + } + } + + private function validate(array &$sections): bool + { + $requiredSections = [ + 'FILE', + [ + 'EXPECT', + 'EXPECTF', + 'EXPECTREGEX', + ], + ]; + + foreach ($requiredSections as $section) { + if (\is_array($section)) { + $foundSection = false; + + foreach ($section as $anySection) { + if (isset($sections[$anySection])) { + $foundSection = true; + + break; + } + } + + if (!$foundSection) { + return false; + } + + continue; + } + + if (!isset($sections[$section])) { + return false; + } + } + + return true; + } + + private function render(string $code): string + { + return \str_replace( + [ + '__DIR__', + '__FILE__', + ], + [ + "'" . \dirname($this->filename) . "'", + "'" . $this->filename . "'", + ], + $code + ); + } + + private function getCoverageFiles(): array + { + $baseDir = \dirname(\realpath($this->filename)) . \DIRECTORY_SEPARATOR; + $basename = \basename($this->filename, 'phpt'); + + return [ + 'coverage' => $baseDir . $basename . 'coverage', + 'job' => $baseDir . $basename . 'php', + ]; + } + + private function renderForCoverage(string &$job): void + { + $files = $this->getCoverageFiles(); + + $template = new Text_Template( + __DIR__ . '/../Util/PHP/Template/PhptTestCase.tpl' + ); + + $composerAutoload = '\'\''; + + if (\defined('PHPUNIT_COMPOSER_INSTALL') && !\defined('PHPUNIT_TESTSUITE')) { + $composerAutoload = \var_export(PHPUNIT_COMPOSER_INSTALL, true); + } + + $phar = '\'\''; + + if (\defined('__PHPUNIT_PHAR__')) { + $phar = \var_export(__PHPUNIT_PHAR__, true); + } + + $globals = ''; + + if (!empty($GLOBALS['__PHPUNIT_BOOTSTRAP'])) { + $globals = '$GLOBALS[\'__PHPUNIT_BOOTSTRAP\'] = ' . \var_export( + $GLOBALS['__PHPUNIT_BOOTSTRAP'], + true + ) . ";\n"; + } + + $template->setVar( + [ + 'composerAutoload' => $composerAutoload, + 'phar' => $phar, + 'globals' => $globals, + 'job' => $files['job'], + 'coverageFile' => $files['coverage'], + ] + ); + + \file_put_contents($files['job'], $job); + $job = $template->render(); + } + + private function cleanupForCoverage(): array + { + $files = $this->getCoverageFiles(); + $coverage = @\unserialize(\file_get_contents($files['coverage'])); + + if ($coverage === false) { + $coverage = []; + } + + foreach ($files as $file) { + @\unlink($file); + } + + return $coverage; + } + + private function stringifyIni(array $ini): array + { + $settings = []; + + foreach ($ini as $key => $value) { + if (\is_array($value)) { + foreach ($value as $val) { + $settings[] = $key . '=' . $val; + } + + continue; + } + + $settings[] = $key . '=' . $value; + } + + return $settings; + } +} diff --git a/vendor/phpunit/phpunit/src/Runner/ResultCacheExtension.php b/vendor/phpunit/phpunit/src/Runner/ResultCacheExtension.php new file mode 100644 index 0000000..962bbc0 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/ResultCacheExtension.php @@ -0,0 +1,104 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +final class ResultCacheExtension implements AfterSuccessfulTestHook, AfterSkippedTestHook, AfterRiskyTestHook, AfterIncompleteTestHook, AfterTestErrorHook, AfterTestWarningHook, AfterTestFailureHook, AfterLastTestHook +{ + /** + * @var TestResultCacheInterface + */ + private $cache; + + public function __construct(TestResultCache $cache) + { + $this->cache = $cache; + } + + public function flush(): void + { + $this->cache->persist(); + } + + public function executeAfterSuccessfulTest(string $test, float $time): void + { + $testName = $this->getTestName($test); + + $this->cache->setTime($testName, \round($time, 3)); + } + + public function executeAfterIncompleteTest(string $test, string $message, float $time): void + { + $testName = $this->getTestName($test); + + $this->cache->setTime($testName, \round($time, 3)); + $this->cache->setState($testName, BaseTestRunner::STATUS_INCOMPLETE); + } + + public function executeAfterRiskyTest(string $test, string $message, float $time): void + { + $testName = $this->getTestName($test); + + $this->cache->setTime($testName, \round($time, 3)); + $this->cache->setState($testName, BaseTestRunner::STATUS_RISKY); + } + + public function executeAfterSkippedTest(string $test, string $message, float $time): void + { + $testName = $this->getTestName($test); + + $this->cache->setTime($testName, \round($time, 3)); + $this->cache->setState($testName, BaseTestRunner::STATUS_SKIPPED); + } + + public function executeAfterTestError(string $test, string $message, float $time): void + { + $testName = $this->getTestName($test); + + $this->cache->setTime($testName, \round($time, 3)); + $this->cache->setState($testName, BaseTestRunner::STATUS_ERROR); + } + + public function executeAfterTestFailure(string $test, string $message, float $time): void + { + $testName = $this->getTestName($test); + + $this->cache->setTime($testName, \round($time, 3)); + $this->cache->setState($testName, BaseTestRunner::STATUS_FAILURE); + } + + public function executeAfterTestWarning(string $test, string $message, float $time): void + { + $testName = $this->getTestName($test); + + $this->cache->setTime($testName, \round($time, 3)); + $this->cache->setState($testName, BaseTestRunner::STATUS_WARNING); + } + + public function executeAfterLastTest(): void + { + $this->flush(); + } + + /** + * @param string $test A long description format of the current test + * + * @return string The test name without TestSuiteClassName:: and @dataprovider details + */ + private function getTestName(string $test): string + { + $matches = []; + + if (\preg_match('/^(?\S+::\S+)(?:(? with data set (?:#\d+|"[^"]+"))\s\()?/', $test, $matches)) { + $test = $matches['name'] . ($matches['dataname'] ?? ''); + } + + return $test; + } +} diff --git a/vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php b/vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php new file mode 100644 index 0000000..633a7c2 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/StandardTestSuiteLoader.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +use PHPUnit\Framework\TestCase; +use PHPUnit\Util\FileLoader; +use PHPUnit\Util\Filesystem; +use ReflectionClass; + +/** + * The standard test suite loader. + */ +class StandardTestSuiteLoader implements TestSuiteLoader +{ + /** + * @throws Exception + * @throws \PHPUnit\Framework\Exception + */ + public function load(string $suiteClassName, string $suiteClassFile = ''): ReflectionClass + { + $suiteClassName = \str_replace('.php', '', $suiteClassName); + + if (empty($suiteClassFile)) { + $suiteClassFile = Filesystem::classNameToFilename( + $suiteClassName + ); + } + + if (!\class_exists($suiteClassName, false)) { + $loadedClasses = \get_declared_classes(); + + $filename = FileLoader::checkAndLoad($suiteClassFile); + + $loadedClasses = \array_values( + \array_diff(\get_declared_classes(), $loadedClasses) + ); + } + + if (!\class_exists($suiteClassName, false) && !empty($loadedClasses)) { + $offset = 0 - \strlen($suiteClassName); + + foreach ($loadedClasses as $loadedClass) { + $class = new ReflectionClass($loadedClass); + + if (\substr($loadedClass, $offset) === $suiteClassName && + $class->getFileName() == $filename) { + $suiteClassName = $loadedClass; + + break; + } + } + } + + if (!\class_exists($suiteClassName, false) && !empty($loadedClasses)) { + $testCaseClass = TestCase::class; + + foreach ($loadedClasses as $loadedClass) { + $class = new ReflectionClass($loadedClass); + $classFile = $class->getFileName(); + + if ($class->isSubclassOf($testCaseClass) && !$class->isAbstract()) { + $suiteClassName = $loadedClass; + $testCaseClass = $loadedClass; + + if ($classFile == \realpath($suiteClassFile)) { + break; + } + } + + if ($class->hasMethod('suite')) { + $method = $class->getMethod('suite'); + + if (!$method->isAbstract() && $method->isPublic() && $method->isStatic()) { + $suiteClassName = $loadedClass; + + if ($classFile == \realpath($suiteClassFile)) { + break; + } + } + } + } + } + + if (\class_exists($suiteClassName, false)) { + $class = new ReflectionClass($suiteClassName); + + if ($class->getFileName() == \realpath($suiteClassFile)) { + return $class; + } + } + + throw new Exception( + \sprintf( + "Class '%s' could not be found in '%s'.", + $suiteClassName, + $suiteClassFile + ) + ); + } + + public function reload(ReflectionClass $aClass): ReflectionClass + { + return $aClass; + } +} diff --git a/vendor/phpunit/phpunit/src/Runner/TestSuiteLoader.php b/vendor/phpunit/phpunit/src/Runner/TestSuiteLoader.php new file mode 100644 index 0000000..74cf753 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/TestSuiteLoader.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +use ReflectionClass; + +/** + * An interface to define how a test suite should be loaded. + */ +interface TestSuiteLoader +{ + public function load(string $suiteClassName, string $suiteClassFile = ''): ReflectionClass; + + public function reload(ReflectionClass $aClass): ReflectionClass; +} diff --git a/vendor/phpunit/phpunit/src/Runner/TestSuiteSorter.php b/vendor/phpunit/phpunit/src/Runner/TestSuiteSorter.php new file mode 100644 index 0000000..9607d1d --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/TestSuiteSorter.php @@ -0,0 +1,357 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +use PHPUnit\Framework\DataProviderTestSuite; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestSuite; + +final class TestSuiteSorter +{ + /** + * @var int + */ + public const ORDER_DEFAULT = 0; + + /** + * @var int + */ + public const ORDER_RANDOMIZED = 1; + + /** + * @var int + */ + public const ORDER_REVERSED = 2; + + /** + * @var int + */ + public const ORDER_DEFECTS_FIRST = 3; + + /** + * @var int + */ + public const ORDER_DURATION = 4; + + /** + * List of sorting weights for all test result codes. A higher number gives higher priority. + */ + private const DEFECT_SORT_WEIGHT = [ + BaseTestRunner::STATUS_ERROR => 6, + BaseTestRunner::STATUS_FAILURE => 5, + BaseTestRunner::STATUS_WARNING => 4, + BaseTestRunner::STATUS_INCOMPLETE => 3, + BaseTestRunner::STATUS_RISKY => 2, + BaseTestRunner::STATUS_SKIPPED => 1, + BaseTestRunner::STATUS_UNKNOWN => 0, + ]; + + /** + * @var array Associative array of (string => DEFECT_SORT_WEIGHT) elements + */ + private $defectSortOrder = []; + + /** + * @var TestResultCacheInterface + */ + private $cache; + + /** + * @var array array A list of normalized names of tests before reordering + */ + private $originalExecutionOrder = []; + + /** + * @var array array A list of normalized names of tests affected by reordering + */ + private $executionOrder = []; + + public static function getTestSorterUID(Test $test): string + { + if ($test instanceof PhptTestCase) { + return $test->getName(); + } + + if ($test instanceof TestCase) { + $testName = $test->getName(true); + + if (\strpos($testName, '::') === false) { + $testName = \get_class($test) . '::' . $testName; + } + + return $testName; + } + + return $test->getName(); + } + + public function __construct(?TestResultCacheInterface $cache = null) + { + $this->cache = $cache ?? new NullTestResultCache; + } + + /** + * @throws Exception + */ + public function reorderTestsInSuite(Test $suite, int $order, bool $resolveDependencies, int $orderDefects, bool $isRootTestSuite = true): void + { + $allowedOrders = [ + self::ORDER_DEFAULT, + self::ORDER_REVERSED, + self::ORDER_RANDOMIZED, + self::ORDER_DURATION, + ]; + + if (!\in_array($order, $allowedOrders, true)) { + throw new Exception( + '$order must be one of TestSuiteSorter::ORDER_DEFAULT, TestSuiteSorter::ORDER_REVERSED, or TestSuiteSorter::ORDER_RANDOMIZED, or TestSuiteSorter::ORDER_DURATION' + ); + } + + $allowedOrderDefects = [ + self::ORDER_DEFAULT, + self::ORDER_DEFECTS_FIRST, + ]; + + if (!\in_array($orderDefects, $allowedOrderDefects, true)) { + throw new Exception( + '$orderDefects must be one of TestSuiteSorter::ORDER_DEFAULT, TestSuiteSorter::ORDER_DEFECTS_FIRST' + ); + } + + if ($isRootTestSuite) { + $this->originalExecutionOrder = $this->calculateTestExecutionOrder($suite); + } + + if ($suite instanceof TestSuite) { + foreach ($suite as $_suite) { + $this->reorderTestsInSuite($_suite, $order, $resolveDependencies, $orderDefects, false); + } + + if ($orderDefects === self::ORDER_DEFECTS_FIRST) { + $this->addSuiteToDefectSortOrder($suite); + } + + $this->sort($suite, $order, $resolveDependencies, $orderDefects); + } + + if ($isRootTestSuite) { + $this->executionOrder = $this->calculateTestExecutionOrder($suite); + } + } + + public function getOriginalExecutionOrder(): array + { + return $this->originalExecutionOrder; + } + + public function getExecutionOrder(): array + { + return $this->executionOrder; + } + + private function sort(TestSuite $suite, int $order, bool $resolveDependencies, int $orderDefects): void + { + if (empty($suite->tests())) { + return; + } + + if ($order === self::ORDER_REVERSED) { + $suite->setTests($this->reverse($suite->tests())); + } elseif ($order === self::ORDER_RANDOMIZED) { + $suite->setTests($this->randomize($suite->tests())); + } elseif ($order === self::ORDER_DURATION && $this->cache !== null) { + $suite->setTests($this->sortByDuration($suite->tests())); + } + + if ($orderDefects === self::ORDER_DEFECTS_FIRST && $this->cache !== null) { + $suite->setTests($this->sortDefectsFirst($suite->tests())); + } + + if ($resolveDependencies && !($suite instanceof DataProviderTestSuite) && $this->suiteOnlyContainsTests($suite)) { + $suite->setTests($this->resolveDependencies($suite->tests())); + } + } + + private function addSuiteToDefectSortOrder(TestSuite $suite): void + { + $max = 0; + + foreach ($suite->tests() as $test) { + $testname = self::getTestSorterUID($test); + + if (!isset($this->defectSortOrder[$testname])) { + $this->defectSortOrder[$testname] = self::DEFECT_SORT_WEIGHT[$this->cache->getState($testname)]; + $max = \max($max, $this->defectSortOrder[$testname]); + } + } + + $this->defectSortOrder[$suite->getName()] = $max; + } + + private function suiteOnlyContainsTests(TestSuite $suite): bool + { + return \array_reduce( + $suite->tests(), + function ($carry, $test) { + return $carry && ($test instanceof TestCase || $test instanceof DataProviderTestSuite); + }, + true + ); + } + + private function reverse(array $tests): array + { + return \array_reverse($tests); + } + + private function randomize(array $tests): array + { + \shuffle($tests); + + return $tests; + } + + private function sortDefectsFirst(array $tests): array + { + \usort( + $tests, + function ($left, $right) { + return $this->cmpDefectPriorityAndTime($left, $right); + } + ); + + return $tests; + } + + private function sortByDuration(array $tests): array + { + \usort( + $tests, + function ($left, $right) { + return $this->cmpDuration($left, $right); + } + ); + + return $tests; + } + + /** + * Comparator callback function to sort tests for "reach failure as fast as possible": + * 1. sort tests by defect weight defined in self::DEFECT_SORT_WEIGHT + * 2. when tests are equally defective, sort the fastest to the front + * 3. do not reorder successful tests + */ + private function cmpDefectPriorityAndTime(Test $a, Test $b): int + { + $priorityA = $this->defectSortOrder[self::getTestSorterUID($a)] ?? 0; + $priorityB = $this->defectSortOrder[self::getTestSorterUID($b)] ?? 0; + + if ($priorityB <=> $priorityA) { + // Sort defect weight descending + return $priorityB <=> $priorityA; + } + + if ($priorityA || $priorityB) { + return $this->cmpDuration($a, $b); + } + + // do not change execution order + return 0; + } + + /** + * Compares test duration for sorting tests by duration ascending. + */ + private function cmpDuration(Test $a, Test $b): int + { + return $this->cache->getTime(self::getTestSorterUID($a)) <=> $this->cache->getTime(self::getTestSorterUID($b)); + } + + /** + * Reorder Tests within a TestCase in such a way as to resolve as many dependencies as possible. + * The algorithm will leave the tests in original running order when it can. + * For more details see the documentation for test dependencies. + * + * Short description of algorithm: + * 1. Pick the next Test from remaining tests to be checked for dependencies. + * 2. If the test has no dependencies: mark done, start again from the top + * 3. If the test has dependencies but none left to do: mark done, start again from the top + * 4. When we reach the end add any leftover tests to the end. These will be marked 'skipped' during execution. + * + * @param array $tests + * + * @return array + */ + private function resolveDependencies(array $tests): array + { + $newTestOrder = []; + $i = 0; + + do { + $todoNames = \array_map( + function ($test) { + return self::getTestSorterUID($test); + }, + $tests + ); + + if (!$tests[$i]->hasDependencies() || empty(\array_intersect($this->getNormalizedDependencyNames($tests[$i]), $todoNames))) { + $newTestOrder = \array_merge($newTestOrder, \array_splice($tests, $i, 1)); + $i = 0; + } else { + $i++; + } + } while (!empty($tests) && ($i < \count($tests))); + + return \array_merge($newTestOrder, $tests); + } + + /** + * @param DataProviderTestSuite|TestCase $test + * + * @return array A list of full test names as "TestSuiteClassName::testMethodName" + */ + private function getNormalizedDependencyNames($test): array + { + if ($test instanceof DataProviderTestSuite) { + $testClass = \substr($test->getName(), 0, \strpos($test->getName(), '::')); + } else { + $testClass = \get_class($test); + } + + $names = \array_map( + function ($name) use ($testClass) { + return \strpos($name, '::') === false ? $testClass . '::' . $name : $name; + }, + $test->getDependencies() + ); + + return $names; + } + + private function calculateTestExecutionOrder(Test $suite): array + { + $tests = []; + + if ($suite instanceof TestSuite) { + foreach ($suite->tests() as $test) { + if (!($test instanceof TestSuite)) { + $tests[] = self::getTestSorterUID($test); + } else { + $tests = \array_merge($tests, $this->calculateTestExecutionOrder($test)); + } + } + } + + return $tests; + } +} diff --git a/vendor/phpunit/phpunit/src/Runner/Version.php b/vendor/phpunit/phpunit/src/Runner/Version.php new file mode 100644 index 0000000..5cd94c0 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Runner/Version.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +use SebastianBergmann\Version as VersionId; + +/** + * This class defines the current version of PHPUnit. + */ +class Version +{ + private static $pharVersion; + + private static $version; + + /** + * Returns the current version of PHPUnit. + */ + public static function id(): string + { + if (self::$pharVersion !== null) { + return self::$pharVersion; + } + + if (self::$version === null) { + $version = new VersionId('7.5.1', \dirname(__DIR__, 2)); + self::$version = $version->getVersion(); + } + + return self::$version; + } + + public static function series(): string + { + if (\strpos(self::id(), '-')) { + $version = \explode('-', self::id())[0]; + } else { + $version = self::id(); + } + + return \implode('.', \array_slice(\explode('.', $version), 0, 2)); + } + + public static function getVersionString(): string + { + return 'PHPUnit ' . self::id() . ' by Sebastian Bergmann and contributors.'; + } + + public static function getReleaseChannel(): string + { + if (\strpos(self::$pharVersion, '-') !== false) { + return '-nightly'; + } + + return ''; + } +} diff --git a/vendor/phpunit/phpunit/src/TextUI/Command.php b/vendor/phpunit/phpunit/src/TextUI/Command.php new file mode 100644 index 0000000..9b66bc1 --- /dev/null +++ b/vendor/phpunit/phpunit/src/TextUI/Command.php @@ -0,0 +1,1374 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI; + +use PharIo\Manifest\ApplicationName; +use PharIo\Manifest\Exception as ManifestException; +use PharIo\Manifest\ManifestLoader; +use PharIo\Version\Version as PharIoVersion; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestListener; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Runner\PhptTestCase; +use PHPUnit\Runner\StandardTestSuiteLoader; +use PHPUnit\Runner\TestSuiteLoader; +use PHPUnit\Runner\TestSuiteSorter; +use PHPUnit\Runner\Version; +use PHPUnit\Util\Configuration; +use PHPUnit\Util\ConfigurationGenerator; +use PHPUnit\Util\FileLoader; +use PHPUnit\Util\Filesystem; +use PHPUnit\Util\Getopt; +use PHPUnit\Util\Log\TeamCity; +use PHPUnit\Util\Printer; +use PHPUnit\Util\TestDox\CliTestDoxPrinter; +use PHPUnit\Util\TextTestListRenderer; +use PHPUnit\Util\XmlTestListRenderer; +use ReflectionClass; +use SebastianBergmann\FileIterator\Facade as FileIteratorFacade; + +use Throwable; + +/** + * A TestRunner for the Command Line Interface (CLI) + * PHP SAPI Module. + */ +class Command +{ + /** + * @var array + */ + protected $arguments = [ + 'listGroups' => false, + 'listSuites' => false, + 'listTests' => false, + 'listTestsXml' => false, + 'loader' => null, + 'useDefaultConfiguration' => true, + 'loadedExtensions' => [], + 'notLoadedExtensions' => [], + ]; + + /** + * @var array + */ + protected $options = []; + + /** + * @var array + */ + protected $longOptions = [ + 'atleast-version=' => null, + 'prepend=' => null, + 'bootstrap=' => null, + 'cache-result' => null, + 'cache-result-file=' => null, + 'check-version' => null, + 'colors==' => null, + 'columns=' => null, + 'configuration=' => null, + 'coverage-clover=' => null, + 'coverage-crap4j=' => null, + 'coverage-html=' => null, + 'coverage-php=' => null, + 'coverage-text==' => null, + 'coverage-xml=' => null, + 'debug' => null, + 'disallow-test-output' => null, + 'disallow-resource-usage' => null, + 'disallow-todo-tests' => null, + 'default-time-limit=' => null, + 'enforce-time-limit' => null, + 'exclude-group=' => null, + 'filter=' => null, + 'generate-configuration' => null, + 'globals-backup' => null, + 'group=' => null, + 'help' => null, + 'resolve-dependencies' => null, + 'ignore-dependencies' => null, + 'include-path=' => null, + 'list-groups' => null, + 'list-suites' => null, + 'list-tests' => null, + 'list-tests-xml=' => null, + 'loader=' => null, + 'log-junit=' => null, + 'log-teamcity=' => null, + 'no-configuration' => null, + 'no-coverage' => null, + 'no-logging' => null, + 'no-extensions' => null, + 'order-by=' => null, + 'printer=' => null, + 'process-isolation' => null, + 'repeat=' => null, + 'dont-report-useless-tests' => null, + 'random-order' => null, + 'random-order-seed=' => null, + 'reverse-order' => null, + 'reverse-list' => null, + 'static-backup' => null, + 'stderr' => null, + 'stop-on-defect' => null, + 'stop-on-error' => null, + 'stop-on-failure' => null, + 'stop-on-warning' => null, + 'stop-on-incomplete' => null, + 'stop-on-risky' => null, + 'stop-on-skipped' => null, + 'fail-on-warning' => null, + 'fail-on-risky' => null, + 'strict-coverage' => null, + 'disable-coverage-ignore' => null, + 'strict-global-state' => null, + 'teamcity' => null, + 'testdox' => null, + 'testdox-group=' => null, + 'testdox-exclude-group=' => null, + 'testdox-html=' => null, + 'testdox-text=' => null, + 'testdox-xml=' => null, + 'test-suffix=' => null, + 'testsuite=' => null, + 'verbose' => null, + 'version' => null, + 'whitelist=' => null, + 'dump-xdebug-filter=' => null, + ]; + + /** + * @var bool + */ + private $versionStringPrinted = false; + + /** + * @throws \RuntimeException + * @throws \PHPUnit\Framework\Exception + * @throws \InvalidArgumentException + */ + public static function main(bool $exit = true): int + { + $command = new static; + + return $command->run($_SERVER['argv'], $exit); + } + + /** + * @throws \RuntimeException + * @throws \ReflectionException + * @throws \InvalidArgumentException + * @throws Exception + */ + public function run(array $argv, bool $exit = true): int + { + $this->handleArguments($argv); + + $runner = $this->createRunner(); + + if ($this->arguments['test'] instanceof Test) { + $suite = $this->arguments['test']; + } else { + $suite = $runner->getTest( + $this->arguments['test'], + $this->arguments['testFile'], + $this->arguments['testSuffixes'] + ); + } + + if ($this->arguments['listGroups']) { + return $this->handleListGroups($suite, $exit); + } + + if ($this->arguments['listSuites']) { + return $this->handleListSuites($exit); + } + + if ($this->arguments['listTests']) { + return $this->handleListTests($suite, $exit); + } + + if ($this->arguments['listTestsXml']) { + return $this->handleListTestsXml($suite, $this->arguments['listTestsXml'], $exit); + } + + unset($this->arguments['test'], $this->arguments['testFile']); + + try { + $result = $runner->doRun($suite, $this->arguments, $exit); + } catch (Exception $e) { + print $e->getMessage() . \PHP_EOL; + } + + $return = TestRunner::FAILURE_EXIT; + + if (isset($result) && $result->wasSuccessful()) { + $return = TestRunner::SUCCESS_EXIT; + } elseif (!isset($result) || $result->errorCount() > 0) { + $return = TestRunner::EXCEPTION_EXIT; + } + + if ($exit) { + exit($return); + } + + return $return; + } + + /** + * Create a TestRunner, override in subclasses. + */ + protected function createRunner(): TestRunner + { + return new TestRunner($this->arguments['loader']); + } + + /** + * Handles the command-line arguments. + * + * A child class of PHPUnit\TextUI\Command can hook into the argument + * parsing by adding the switch(es) to the $longOptions array and point to a + * callback method that handles the switch(es) in the child class like this + * + * + * longOptions['my-switch'] = 'myHandler'; + * // my-secondswitch will accept a value - note the equals sign + * $this->longOptions['my-secondswitch='] = 'myOtherHandler'; + * } + * + * // --my-switch -> myHandler() + * protected function myHandler() + * { + * } + * + * // --my-secondswitch foo -> myOtherHandler('foo') + * protected function myOtherHandler ($value) + * { + * } + * + * // You will also need this - the static keyword in the + * // PHPUnit\TextUI\Command will mean that it'll be + * // PHPUnit\TextUI\Command that gets instantiated, + * // not MyCommand + * public static function main($exit = true) + * { + * $command = new static; + * + * return $command->run($_SERVER['argv'], $exit); + * } + * + * } + * + * + * @throws Exception + */ + protected function handleArguments(array $argv): void + { + try { + $this->options = Getopt::getopt( + $argv, + 'd:c:hv', + \array_keys($this->longOptions) + ); + } catch (Exception $t) { + $this->exitWithErrorMessage($t->getMessage()); + } + + foreach ($this->options[0] as $option) { + switch ($option[0]) { + case '--colors': + $this->arguments['colors'] = $option[1] ?: ResultPrinter::COLOR_AUTO; + + break; + + case '--bootstrap': + $this->arguments['bootstrap'] = $option[1]; + + break; + + case '--cache-result': + $this->arguments['cacheResult'] = true; + + break; + + case '--cache-result-file': + $this->arguments['cacheResultFile'] = $option[1]; + + break; + + case '--columns': + if (\is_numeric($option[1])) { + $this->arguments['columns'] = (int) $option[1]; + } elseif ($option[1] === 'max') { + $this->arguments['columns'] = 'max'; + } + + break; + + case 'c': + case '--configuration': + $this->arguments['configuration'] = $option[1]; + + break; + + case '--coverage-clover': + $this->arguments['coverageClover'] = $option[1]; + + break; + + case '--coverage-crap4j': + $this->arguments['coverageCrap4J'] = $option[1]; + + break; + + case '--coverage-html': + $this->arguments['coverageHtml'] = $option[1]; + + break; + + case '--coverage-php': + $this->arguments['coveragePHP'] = $option[1]; + + break; + + case '--coverage-text': + if ($option[1] === null) { + $option[1] = 'php://stdout'; + } + + $this->arguments['coverageText'] = $option[1]; + $this->arguments['coverageTextShowUncoveredFiles'] = false; + $this->arguments['coverageTextShowOnlySummary'] = false; + + break; + + case '--coverage-xml': + $this->arguments['coverageXml'] = $option[1]; + + break; + + case 'd': + $ini = \explode('=', $option[1]); + + if (isset($ini[0])) { + if (isset($ini[1])) { + \ini_set($ini[0], $ini[1]); + } else { + \ini_set($ini[0], true); + } + } + + break; + + case '--debug': + $this->arguments['debug'] = true; + + break; + + case 'h': + case '--help': + $this->showHelp(); + exit(TestRunner::SUCCESS_EXIT); + + break; + + case '--filter': + $this->arguments['filter'] = $option[1]; + + break; + + case '--testsuite': + $this->arguments['testsuite'] = $option[1]; + + break; + + case '--generate-configuration': + $this->printVersionString(); + + print 'Generating phpunit.xml in ' . \getcwd() . \PHP_EOL . \PHP_EOL; + + print 'Bootstrap script (relative to path shown above; default: vendor/autoload.php): '; + $bootstrapScript = \trim(\fgets(\STDIN)); + + print 'Tests directory (relative to path shown above; default: tests): '; + $testsDirectory = \trim(\fgets(\STDIN)); + + print 'Source directory (relative to path shown above; default: src): '; + $src = \trim(\fgets(\STDIN)); + + if ($bootstrapScript === '') { + $bootstrapScript = 'vendor/autoload.php'; + } + + if ($testsDirectory === '') { + $testsDirectory = 'tests'; + } + + if ($src === '') { + $src = 'src'; + } + + $generator = new ConfigurationGenerator; + + \file_put_contents( + 'phpunit.xml', + $generator->generateDefaultConfiguration( + Version::series(), + $bootstrapScript, + $testsDirectory, + $src + ) + ); + + print \PHP_EOL . 'Generated phpunit.xml in ' . \getcwd() . \PHP_EOL; + + exit(TestRunner::SUCCESS_EXIT); + + break; + + case '--group': + $this->arguments['groups'] = \explode(',', $option[1]); + + break; + + case '--exclude-group': + $this->arguments['excludeGroups'] = \explode( + ',', + $option[1] + ); + + break; + + case '--test-suffix': + $this->arguments['testSuffixes'] = \explode( + ',', + $option[1] + ); + + break; + + case '--include-path': + $includePath = $option[1]; + + break; + + case '--list-groups': + $this->arguments['listGroups'] = true; + + break; + + case '--list-suites': + $this->arguments['listSuites'] = true; + + break; + + case '--list-tests': + $this->arguments['listTests'] = true; + + break; + + case '--list-tests-xml': + $this->arguments['listTestsXml'] = $option[1]; + + break; + + case '--printer': + $this->arguments['printer'] = $option[1]; + + break; + + case '--loader': + $this->arguments['loader'] = $option[1]; + + break; + + case '--log-junit': + $this->arguments['junitLogfile'] = $option[1]; + + break; + + case '--log-teamcity': + $this->arguments['teamcityLogfile'] = $option[1]; + + break; + + case '--order-by': + $this->handleOrderByOption($option[1]); + + break; + + case '--process-isolation': + $this->arguments['processIsolation'] = true; + + break; + + case '--repeat': + $this->arguments['repeat'] = (int) $option[1]; + + break; + + case '--stderr': + $this->arguments['stderr'] = true; + + break; + + case '--stop-on-defect': + $this->arguments['stopOnDefect'] = true; + + break; + + case '--stop-on-error': + $this->arguments['stopOnError'] = true; + + break; + + case '--stop-on-failure': + $this->arguments['stopOnFailure'] = true; + + break; + + case '--stop-on-warning': + $this->arguments['stopOnWarning'] = true; + + break; + + case '--stop-on-incomplete': + $this->arguments['stopOnIncomplete'] = true; + + break; + + case '--stop-on-risky': + $this->arguments['stopOnRisky'] = true; + + break; + + case '--stop-on-skipped': + $this->arguments['stopOnSkipped'] = true; + + break; + + case '--fail-on-warning': + $this->arguments['failOnWarning'] = true; + + break; + + case '--fail-on-risky': + $this->arguments['failOnRisky'] = true; + + break; + + case '--teamcity': + $this->arguments['printer'] = TeamCity::class; + + break; + + case '--testdox': + $this->arguments['printer'] = CliTestDoxPrinter::class; + + break; + + case '--testdox-group': + $this->arguments['testdoxGroups'] = \explode( + ',', + $option[1] + ); + + break; + + case '--testdox-exclude-group': + $this->arguments['testdoxExcludeGroups'] = \explode( + ',', + $option[1] + ); + + break; + + case '--testdox-html': + $this->arguments['testdoxHTMLFile'] = $option[1]; + + break; + + case '--testdox-text': + $this->arguments['testdoxTextFile'] = $option[1]; + + break; + + case '--testdox-xml': + $this->arguments['testdoxXMLFile'] = $option[1]; + + break; + + case '--no-configuration': + $this->arguments['useDefaultConfiguration'] = false; + + break; + + case '--no-extensions': + $this->arguments['noExtensions'] = true; + + break; + + case '--no-coverage': + $this->arguments['noCoverage'] = true; + + break; + + case '--no-logging': + $this->arguments['noLogging'] = true; + + break; + + case '--globals-backup': + $this->arguments['backupGlobals'] = true; + + break; + + case '--static-backup': + $this->arguments['backupStaticAttributes'] = true; + + break; + + case 'v': + case '--verbose': + $this->arguments['verbose'] = true; + + break; + + case '--atleast-version': + if (\version_compare(Version::id(), $option[1], '>=')) { + exit(TestRunner::SUCCESS_EXIT); + } + + exit(TestRunner::FAILURE_EXIT); + + break; + + case '--version': + $this->printVersionString(); + exit(TestRunner::SUCCESS_EXIT); + + break; + + case '--dont-report-useless-tests': + $this->arguments['reportUselessTests'] = false; + + break; + + case '--strict-coverage': + $this->arguments['strictCoverage'] = true; + + break; + + case '--disable-coverage-ignore': + $this->arguments['disableCodeCoverageIgnore'] = true; + + break; + + case '--strict-global-state': + $this->arguments['beStrictAboutChangesToGlobalState'] = true; + + break; + + case '--disallow-test-output': + $this->arguments['disallowTestOutput'] = true; + + break; + + case '--disallow-resource-usage': + $this->arguments['beStrictAboutResourceUsageDuringSmallTests'] = true; + + break; + + case '--default-time-limit': + $this->arguments['defaultTimeLimit'] = (int) $option[1]; + + break; + + case '--enforce-time-limit': + $this->arguments['enforceTimeLimit'] = true; + + break; + + case '--disallow-todo-tests': + $this->arguments['disallowTodoAnnotatedTests'] = true; + + break; + + case '--reverse-list': + $this->arguments['reverseList'] = true; + + break; + + case '--check-version': + $this->handleVersionCheck(); + + break; + + case '--whitelist': + $this->arguments['whitelist'] = $option[1]; + + break; + + case '--random-order': + $this->handleOrderByOption('random'); + + break; + + case '--random-order-seed': + $this->arguments['randomOrderSeed'] = (int) $option[1]; + + break; + + case '--resolve-dependencies': + $this->handleOrderByOption('depends'); + + break; + + case '--ignore-dependencies': + $this->arguments['resolveDependencies'] = false; + + break; + + case '--reverse-order': + $this->handleOrderByOption('reverse'); + + break; + + case '--dump-xdebug-filter': + $this->arguments['xdebugFilterFile'] = $option[1]; + + break; + + default: + $optionName = \str_replace('--', '', $option[0]); + + $handler = null; + + if (isset($this->longOptions[$optionName])) { + $handler = $this->longOptions[$optionName]; + } elseif (isset($this->longOptions[$optionName . '='])) { + $handler = $this->longOptions[$optionName . '=']; + } + + if (isset($handler) && \is_callable([$this, $handler])) { + $this->$handler($option[1]); + } + } + } + + $this->handleCustomTestSuite(); + + if (!isset($this->arguments['test'])) { + if (isset($this->options[1][0])) { + $this->arguments['test'] = $this->options[1][0]; + } + + if (isset($this->options[1][1])) { + $this->arguments['testFile'] = \realpath($this->options[1][1]); + } else { + $this->arguments['testFile'] = ''; + } + + if (isset($this->arguments['test']) && + \is_file($this->arguments['test']) && + \substr($this->arguments['test'], -5, 5) != '.phpt') { + $this->arguments['testFile'] = \realpath($this->arguments['test']); + $this->arguments['test'] = \substr($this->arguments['test'], 0, \strrpos($this->arguments['test'], '.')); + } + } + + if (!isset($this->arguments['testSuffixes'])) { + $this->arguments['testSuffixes'] = ['Test.php', '.phpt']; + } + + if (isset($includePath)) { + \ini_set( + 'include_path', + $includePath . \PATH_SEPARATOR . \ini_get('include_path') + ); + } + + if ($this->arguments['loader'] !== null) { + $this->arguments['loader'] = $this->handleLoader($this->arguments['loader']); + } + + if (isset($this->arguments['configuration']) && + \is_dir($this->arguments['configuration'])) { + $configurationFile = $this->arguments['configuration'] . '/phpunit.xml'; + + if (\file_exists($configurationFile)) { + $this->arguments['configuration'] = \realpath( + $configurationFile + ); + } elseif (\file_exists($configurationFile . '.dist')) { + $this->arguments['configuration'] = \realpath( + $configurationFile . '.dist' + ); + } + } elseif (!isset($this->arguments['configuration']) && + $this->arguments['useDefaultConfiguration']) { + if (\file_exists('phpunit.xml')) { + $this->arguments['configuration'] = \realpath('phpunit.xml'); + } elseif (\file_exists('phpunit.xml.dist')) { + $this->arguments['configuration'] = \realpath( + 'phpunit.xml.dist' + ); + } + } + + if (isset($this->arguments['configuration'])) { + try { + $configuration = Configuration::getInstance( + $this->arguments['configuration'] + ); + } catch (Throwable $t) { + print $t->getMessage() . \PHP_EOL; + exit(TestRunner::FAILURE_EXIT); + } + + $phpunitConfiguration = $configuration->getPHPUnitConfiguration(); + + $configuration->handlePHPConfiguration(); + + /* + * Issue #1216 + */ + if (isset($this->arguments['bootstrap'])) { + $this->handleBootstrap($this->arguments['bootstrap']); + } elseif (isset($phpunitConfiguration['bootstrap'])) { + $this->handleBootstrap($phpunitConfiguration['bootstrap']); + } + + /* + * Issue #657 + */ + if (isset($phpunitConfiguration['stderr']) && !isset($this->arguments['stderr'])) { + $this->arguments['stderr'] = $phpunitConfiguration['stderr']; + } + + if (isset($phpunitConfiguration['extensionsDirectory']) && !isset($this->arguments['noExtensions']) && \extension_loaded('phar')) { + $this->handleExtensions($phpunitConfiguration['extensionsDirectory']); + } + + if (isset($phpunitConfiguration['columns']) && !isset($this->arguments['columns'])) { + $this->arguments['columns'] = $phpunitConfiguration['columns']; + } + + if (!isset($this->arguments['printer']) && isset($phpunitConfiguration['printerClass'])) { + if (isset($phpunitConfiguration['printerFile'])) { + $file = $phpunitConfiguration['printerFile']; + } else { + $file = ''; + } + + $this->arguments['printer'] = $this->handlePrinter( + $phpunitConfiguration['printerClass'], + $file + ); + } + + if (isset($phpunitConfiguration['testSuiteLoaderClass'])) { + if (isset($phpunitConfiguration['testSuiteLoaderFile'])) { + $file = $phpunitConfiguration['testSuiteLoaderFile']; + } else { + $file = ''; + } + + $this->arguments['loader'] = $this->handleLoader( + $phpunitConfiguration['testSuiteLoaderClass'], + $file + ); + } + + if (!isset($this->arguments['testsuite']) && isset($phpunitConfiguration['defaultTestSuite'])) { + $this->arguments['testsuite'] = $phpunitConfiguration['defaultTestSuite']; + } + + if (!isset($this->arguments['test'])) { + $testSuite = $configuration->getTestSuiteConfiguration($this->arguments['testsuite'] ?? ''); + + if ($testSuite !== null) { + $this->arguments['test'] = $testSuite; + } + } + } elseif (isset($this->arguments['bootstrap'])) { + $this->handleBootstrap($this->arguments['bootstrap']); + } + + if (isset($this->arguments['printer']) && + \is_string($this->arguments['printer'])) { + $this->arguments['printer'] = $this->handlePrinter($this->arguments['printer']); + } + + if (isset($this->arguments['test']) && \is_string($this->arguments['test']) && \substr($this->arguments['test'], -5, 5) == '.phpt') { + $test = new PhptTestCase($this->arguments['test']); + + $this->arguments['test'] = new TestSuite; + $this->arguments['test']->addTest($test); + } + + if (!isset($this->arguments['test'])) { + $this->showHelp(); + exit(TestRunner::EXCEPTION_EXIT); + } + } + + /** + * Handles the loading of the PHPUnit\Runner\TestSuiteLoader implementation. + */ + protected function handleLoader(string $loaderClass, string $loaderFile = ''): ?TestSuiteLoader + { + if (!\class_exists($loaderClass, false)) { + if ($loaderFile == '') { + $loaderFile = Filesystem::classNameToFilename( + $loaderClass + ); + } + + $loaderFile = \stream_resolve_include_path($loaderFile); + + if ($loaderFile) { + require $loaderFile; + } + } + + if (\class_exists($loaderClass, false)) { + $class = new ReflectionClass($loaderClass); + + if ($class->implementsInterface(TestSuiteLoader::class) && + $class->isInstantiable()) { + return $class->newInstance(); + } + } + + if ($loaderClass == StandardTestSuiteLoader::class) { + return null; + } + + $this->exitWithErrorMessage( + \sprintf( + 'Could not use "%s" as loader.', + $loaderClass + ) + ); + + return null; + } + + /** + * Handles the loading of the PHPUnit\Util\Printer implementation. + * + * @return null|Printer|string + */ + protected function handlePrinter(string $printerClass, string $printerFile = '') + { + if (!\class_exists($printerClass, false)) { + if ($printerFile == '') { + $printerFile = Filesystem::classNameToFilename( + $printerClass + ); + } + + $printerFile = \stream_resolve_include_path($printerFile); + + if ($printerFile) { + require $printerFile; + } + } + + if (!\class_exists($printerClass)) { + $this->exitWithErrorMessage( + \sprintf( + 'Could not use "%s" as printer: class does not exist', + $printerClass + ) + ); + } + + $class = new ReflectionClass($printerClass); + + if (!$class->implementsInterface(TestListener::class)) { + $this->exitWithErrorMessage( + \sprintf( + 'Could not use "%s" as printer: class does not implement %s', + $printerClass, + TestListener::class + ) + ); + } + + if (!$class->isSubclassOf(Printer::class)) { + $this->exitWithErrorMessage( + \sprintf( + 'Could not use "%s" as printer: class does not extend %s', + $printerClass, + Printer::class + ) + ); + } + + if (!$class->isInstantiable()) { + $this->exitWithErrorMessage( + \sprintf( + 'Could not use "%s" as printer: class cannot be instantiated', + $printerClass + ) + ); + } + + if ($class->isSubclassOf(ResultPrinter::class)) { + return $printerClass; + } + + $outputStream = isset($this->arguments['stderr']) ? 'php://stderr' : null; + + return $class->newInstance($outputStream); + } + + /** + * Loads a bootstrap file. + */ + protected function handleBootstrap(string $filename): void + { + try { + FileLoader::checkAndLoad($filename); + } catch (Exception $e) { + $this->exitWithErrorMessage($e->getMessage()); + } + } + + protected function handleVersionCheck(): void + { + $this->printVersionString(); + + $latestVersion = \file_get_contents('https://phar.phpunit.de/latest-version-of/phpunit'); + $isOutdated = \version_compare($latestVersion, Version::id(), '>'); + + if ($isOutdated) { + \printf( + 'You are not using the latest version of PHPUnit.' . \PHP_EOL . + 'The latest version is PHPUnit %s.' . \PHP_EOL, + $latestVersion + ); + } else { + print 'You are using the latest version of PHPUnit.' . \PHP_EOL; + } + + exit(TestRunner::SUCCESS_EXIT); + } + + /** + * Show the help message. + */ + protected function showHelp(): void + { + $this->printVersionString(); + + print << + +Code Coverage Options: + + --coverage-clover Generate code coverage report in Clover XML format + --coverage-crap4j Generate code coverage report in Crap4J XML format + --coverage-html Generate code coverage report in HTML format + --coverage-php Export PHP_CodeCoverage object to file + --coverage-text= Generate code coverage report in text format + Default: Standard output + --coverage-xml Generate code coverage report in PHPUnit XML format + --whitelist Whitelist for code coverage analysis + --disable-coverage-ignore Disable annotations for ignoring code coverage + --no-coverage Ignore code coverage configuration + --dump-xdebug-filter Generate script to set Xdebug code coverage filter + +Logging Options: + + --log-junit Log test execution in JUnit XML format to file + --log-teamcity Log test execution in TeamCity format to file + --testdox-html Write agile documentation in HTML format to file + --testdox-text Write agile documentation in Text format to file + --testdox-xml Write agile documentation in XML format to file + --reverse-list Print defects in reverse order + +Test Selection Options: + + --filter Filter which tests to run + --testsuite Filter which testsuite to run + --group ... Only runs tests from the specified group(s) + --exclude-group ... Exclude tests from the specified group(s) + --list-groups List available test groups + --list-suites List available test suites + --list-tests List available tests + --list-tests-xml List available tests in XML format + --test-suffix ... Only search for test in files with specified + suffix(es). Default: Test.php,.phpt + +Test Execution Options: + + --dont-report-useless-tests Do not report tests that do not test anything + --strict-coverage Be strict about @covers annotation usage + --strict-global-state Be strict about changes to global state + --disallow-test-output Be strict about output during tests + --disallow-resource-usage Be strict about resource usage during small tests + --enforce-time-limit Enforce time limit based on test size + --default-time-limit= Timeout in seconds for tests without @small, @medium or @large + --disallow-todo-tests Disallow @todo-annotated tests + + --process-isolation Run each test in a separate PHP process + --globals-backup Backup and restore \$GLOBALS for each test + --static-backup Backup and restore static attributes for each test + + --colors= Use colors in output ("never", "auto" or "always") + --columns Number of columns to use for progress output + --columns max Use maximum number of columns for progress output + --stderr Write to STDERR instead of STDOUT + --stop-on-defect Stop execution upon first not-passed test + --stop-on-error Stop execution upon first error + --stop-on-failure Stop execution upon first error or failure + --stop-on-warning Stop execution upon first warning + --stop-on-risky Stop execution upon first risky test + --stop-on-skipped Stop execution upon first skipped test + --stop-on-incomplete Stop execution upon first incomplete test + --fail-on-warning Treat tests with warnings as failures + --fail-on-risky Treat risky tests as failures + -v|--verbose Output more verbose information + --debug Display debugging information + + --loader TestSuiteLoader implementation to use + --repeat Runs the test(s) repeatedly + --teamcity Report test execution progress in TeamCity format + --testdox Report test execution progress in TestDox format + --testdox-group Only include tests from the specified group(s) + --testdox-exclude-group Exclude tests from the specified group(s) + --printer TestListener implementation to use + + --resolve-dependencies Resolve dependencies between tests + --order-by= Run tests in order: default|reverse|random|defects|depends + --random-order-seed= Use a specific random seed for random order + --cache-result Write run result to cache to enable ordering tests defects-first + +Configuration Options: + + --prepend A PHP script that is included as early as possible + --bootstrap A PHP script that is included before the tests run + -c|--configuration Read configuration from XML file + --no-configuration Ignore default configuration file (phpunit.xml) + --no-logging Ignore logging configuration + --no-extensions Do not load PHPUnit extensions + --include-path Prepend PHP's include_path with given path(s) + -d key[=value] Sets a php.ini value + --generate-configuration Generate configuration file with suggested settings + --cache-result-file= Specify result cache path and filename + +Miscellaneous Options: + + -h|--help Prints this usage information + --version Prints the version and exits + --atleast-version Checks that version is greater than min and exits + --check-version Check whether PHPUnit is the latest version + +EOT; + } + + /** + * Custom callback for test suite discovery. + */ + protected function handleCustomTestSuite(): void + { + } + + private function printVersionString(): void + { + if ($this->versionStringPrinted) { + return; + } + + print Version::getVersionString() . \PHP_EOL . \PHP_EOL; + + $this->versionStringPrinted = true; + } + + private function exitWithErrorMessage(string $message): void + { + $this->printVersionString(); + + print $message . \PHP_EOL; + + exit(TestRunner::FAILURE_EXIT); + } + + private function handleExtensions(string $directory): void + { + $facade = new FileIteratorFacade; + + foreach ($facade->getFilesAsArray($directory, '.phar') as $file) { + if (!\file_exists('phar://' . $file . '/manifest.xml')) { + $this->arguments['notLoadedExtensions'][] = $file . ' is not an extension for PHPUnit'; + + continue; + } + + try { + $applicationName = new ApplicationName('phpunit/phpunit'); + $version = new PharIoVersion(Version::series()); + $manifest = ManifestLoader::fromFile('phar://' . $file . '/manifest.xml'); + + if (!$manifest->isExtensionFor($applicationName)) { + $this->arguments['notLoadedExtensions'][] = $file . ' is not an extension for PHPUnit'; + + continue; + } + + if (!$manifest->isExtensionFor($applicationName, $version)) { + $this->arguments['notLoadedExtensions'][] = $file . ' is not compatible with this version of PHPUnit'; + + continue; + } + } catch (ManifestException $e) { + $this->arguments['notLoadedExtensions'][] = $file . ': ' . $e->getMessage(); + + continue; + } + + require $file; + + $this->arguments['loadedExtensions'][] = $manifest->getName() . ' ' . $manifest->getVersion()->getVersionString(); + } + } + + private function handleListGroups(TestSuite $suite, bool $exit): int + { + $this->printVersionString(); + + print 'Available test group(s):' . \PHP_EOL; + + $groups = $suite->getGroups(); + \sort($groups); + + foreach ($groups as $group) { + \printf( + ' - %s' . \PHP_EOL, + $group + ); + } + + if ($exit) { + exit(TestRunner::SUCCESS_EXIT); + } + + return TestRunner::SUCCESS_EXIT; + } + + private function handleListSuites(bool $exit): int + { + $this->printVersionString(); + + print 'Available test suite(s):' . \PHP_EOL; + + $configuration = Configuration::getInstance( + $this->arguments['configuration'] + ); + + $suiteNames = $configuration->getTestSuiteNames(); + + foreach ($suiteNames as $suiteName) { + \printf( + ' - %s' . \PHP_EOL, + $suiteName + ); + } + + if ($exit) { + exit(TestRunner::SUCCESS_EXIT); + } + + return TestRunner::SUCCESS_EXIT; + } + + private function handleListTests(TestSuite $suite, bool $exit): int + { + $this->printVersionString(); + + $renderer = new TextTestListRenderer; + + print $renderer->render($suite); + + if ($exit) { + exit(TestRunner::SUCCESS_EXIT); + } + + return TestRunner::SUCCESS_EXIT; + } + + private function handleListTestsXml(TestSuite $suite, string $target, bool $exit): int + { + $this->printVersionString(); + + $renderer = new XmlTestListRenderer; + + \file_put_contents($target, $renderer->render($suite)); + + \printf( + 'Wrote list of tests that would have been run to %s' . \PHP_EOL, + $target + ); + + if ($exit) { + exit(TestRunner::SUCCESS_EXIT); + } + + return TestRunner::SUCCESS_EXIT; + } + + private function handleOrderByOption(string $value): void + { + foreach (\explode(',', $value) as $order) { + switch ($order) { + case 'default': + $this->arguments['executionOrder'] = TestSuiteSorter::ORDER_DEFAULT; + $this->arguments['executionOrderDefects'] = TestSuiteSorter::ORDER_DEFAULT; + $this->arguments['resolveDependencies'] = false; + + break; + + case 'reverse': + $this->arguments['executionOrder'] = TestSuiteSorter::ORDER_REVERSED; + + break; + + case 'random': + $this->arguments['executionOrder'] = TestSuiteSorter::ORDER_RANDOMIZED; + + break; + + case 'defects': + $this->arguments['executionOrderDefects'] = TestSuiteSorter::ORDER_DEFECTS_FIRST; + + break; + + case 'depends': + $this->arguments['resolveDependencies'] = true; + + break; + + default: + $this->exitWithErrorMessage("unrecognized --order-by option: $order"); + } + } + } +} diff --git a/vendor/phpunit/phpunit/src/TextUI/ResultPrinter.php b/vendor/phpunit/phpunit/src/TextUI/ResultPrinter.php new file mode 100644 index 0000000..2782f07 --- /dev/null +++ b/vendor/phpunit/phpunit/src/TextUI/ResultPrinter.php @@ -0,0 +1,596 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI; + +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestFailure; +use PHPUnit\Framework\TestListener; +use PHPUnit\Framework\TestResult; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Framework\Warning; +use PHPUnit\Runner\PhptTestCase; +use PHPUnit\Util\InvalidArgumentHelper; +use PHPUnit\Util\Printer; +use SebastianBergmann\Environment\Console; +use SebastianBergmann\Timer\Timer; + +/** + * Prints the result of a TextUI TestRunner run. + */ +class ResultPrinter extends Printer implements TestListener +{ + public const EVENT_TEST_START = 0; + + public const EVENT_TEST_END = 1; + + public const EVENT_TESTSUITE_START = 2; + + public const EVENT_TESTSUITE_END = 3; + + public const COLOR_NEVER = 'never'; + + public const COLOR_AUTO = 'auto'; + + public const COLOR_ALWAYS = 'always'; + + public const COLOR_DEFAULT = self::COLOR_NEVER; + + private const AVAILABLE_COLORS = [self::COLOR_NEVER, self::COLOR_AUTO, self::COLOR_ALWAYS]; + + /** + * @var array + */ + private static $ansiCodes = [ + 'bold' => 1, + 'fg-black' => 30, + 'fg-red' => 31, + 'fg-green' => 32, + 'fg-yellow' => 33, + 'fg-blue' => 34, + 'fg-magenta' => 35, + 'fg-cyan' => 36, + 'fg-white' => 37, + 'bg-black' => 40, + 'bg-red' => 41, + 'bg-green' => 42, + 'bg-yellow' => 43, + 'bg-blue' => 44, + 'bg-magenta' => 45, + 'bg-cyan' => 46, + 'bg-white' => 47, + ]; + + /** + * @var int + */ + protected $column = 0; + + /** + * @var int + */ + protected $maxColumn; + + /** + * @var bool + */ + protected $lastTestFailed = false; + + /** + * @var int + */ + protected $numAssertions = 0; + + /** + * @var int + */ + protected $numTests = -1; + + /** + * @var int + */ + protected $numTestsRun = 0; + + /** + * @var int + */ + protected $numTestsWidth; + + /** + * @var bool + */ + protected $colors = false; + + /** + * @var bool + */ + protected $debug = false; + + /** + * @var bool + */ + protected $verbose = false; + + /** + * @var int + */ + private $numberOfColumns; + + /** + * @var bool + */ + private $reverse; + + /** + * @var bool + */ + private $defectListPrinted = false; + + /** + * Constructor. + * + * @param string $colors + * @param int|string $numberOfColumns + * @param null|mixed $out + * + * @throws Exception + */ + public function __construct($out = null, bool $verbose = false, $colors = self::COLOR_DEFAULT, bool $debug = false, $numberOfColumns = 80, bool $reverse = false) + { + parent::__construct($out); + + if (!\in_array($colors, self::AVAILABLE_COLORS, true)) { + throw InvalidArgumentHelper::factory( + 3, + \vsprintf('value from "%s", "%s" or "%s"', self::AVAILABLE_COLORS) + ); + } + + if (!\is_int($numberOfColumns) && $numberOfColumns !== 'max') { + throw InvalidArgumentHelper::factory(5, 'integer or "max"'); + } + + $console = new Console; + $maxNumberOfColumns = $console->getNumberOfColumns(); + + if ($numberOfColumns === 'max' || ($numberOfColumns !== 80 && $numberOfColumns > $maxNumberOfColumns)) { + $numberOfColumns = $maxNumberOfColumns; + } + + $this->numberOfColumns = $numberOfColumns; + $this->verbose = $verbose; + $this->debug = $debug; + $this->reverse = $reverse; + + if ($colors === self::COLOR_AUTO && $console->hasColorSupport()) { + $this->colors = true; + } else { + $this->colors = (self::COLOR_ALWAYS === $colors); + } + } + + public function printResult(TestResult $result): void + { + $this->printHeader(); + $this->printErrors($result); + $this->printWarnings($result); + $this->printFailures($result); + $this->printRisky($result); + + if ($this->verbose) { + $this->printIncompletes($result); + $this->printSkipped($result); + } + + $this->printFooter($result); + } + + /** + * An error occurred. + */ + public function addError(Test $test, \Throwable $t, float $time): void + { + $this->writeProgressWithColor('fg-red, bold', 'E'); + $this->lastTestFailed = true; + } + + /** + * A failure occurred. + */ + public function addFailure(Test $test, AssertionFailedError $e, float $time): void + { + $this->writeProgressWithColor('bg-red, fg-white', 'F'); + $this->lastTestFailed = true; + } + + /** + * A warning occurred. + */ + public function addWarning(Test $test, Warning $e, float $time): void + { + $this->writeProgressWithColor('fg-yellow, bold', 'W'); + $this->lastTestFailed = true; + } + + /** + * Incomplete test. + */ + public function addIncompleteTest(Test $test, \Throwable $t, float $time): void + { + $this->writeProgressWithColor('fg-yellow, bold', 'I'); + $this->lastTestFailed = true; + } + + /** + * Risky test. + */ + public function addRiskyTest(Test $test, \Throwable $t, float $time): void + { + $this->writeProgressWithColor('fg-yellow, bold', 'R'); + $this->lastTestFailed = true; + } + + /** + * Skipped test. + */ + public function addSkippedTest(Test $test, \Throwable $t, float $time): void + { + $this->writeProgressWithColor('fg-cyan, bold', 'S'); + $this->lastTestFailed = true; + } + + /** + * A testsuite started. + */ + public function startTestSuite(TestSuite $suite): void + { + if ($this->numTests == -1) { + $this->numTests = \count($suite); + $this->numTestsWidth = \strlen((string) $this->numTests); + $this->maxColumn = $this->numberOfColumns - \strlen(' / (XXX%)') - (2 * $this->numTestsWidth); + } + } + + /** + * A testsuite ended. + */ + public function endTestSuite(TestSuite $suite): void + { + } + + /** + * A test started. + */ + public function startTest(Test $test): void + { + if ($this->debug) { + $this->write( + \sprintf( + "Test '%s' started\n", + \PHPUnit\Util\Test::describeAsString($test) + ) + ); + } + } + + /** + * A test ended. + */ + public function endTest(Test $test, float $time): void + { + if ($this->debug) { + $this->write( + \sprintf( + "Test '%s' ended\n", + \PHPUnit\Util\Test::describeAsString($test) + ) + ); + } + + if (!$this->lastTestFailed) { + $this->writeProgress('.'); + } + + if ($test instanceof TestCase) { + $this->numAssertions += $test->getNumAssertions(); + } elseif ($test instanceof PhptTestCase) { + $this->numAssertions++; + } + + $this->lastTestFailed = false; + + if ($test instanceof TestCase && !$test->hasExpectationOnOutput()) { + $this->write($test->getActualOutput()); + } + } + + protected function printDefects(array $defects, string $type): void + { + $count = \count($defects); + + if ($count == 0) { + return; + } + + if ($this->defectListPrinted) { + $this->write("\n--\n\n"); + } + + $this->write( + \sprintf( + "There %s %d %s%s:\n", + ($count == 1) ? 'was' : 'were', + $count, + $type, + ($count == 1) ? '' : 's' + ) + ); + + $i = 1; + + if ($this->reverse) { + $defects = \array_reverse($defects); + } + + foreach ($defects as $defect) { + $this->printDefect($defect, $i++); + } + + $this->defectListPrinted = true; + } + + protected function printDefect(TestFailure $defect, int $count): void + { + $this->printDefectHeader($defect, $count); + $this->printDefectTrace($defect); + } + + protected function printDefectHeader(TestFailure $defect, int $count): void + { + $this->write( + \sprintf( + "\n%d) %s\n", + $count, + $defect->getTestName() + ) + ); + } + + protected function printDefectTrace(TestFailure $defect): void + { + $e = $defect->thrownException(); + $this->write((string) $e); + + while ($e = $e->getPrevious()) { + $this->write("\nCaused by\n" . $e); + } + } + + protected function printErrors(TestResult $result): void + { + $this->printDefects($result->errors(), 'error'); + } + + protected function printFailures(TestResult $result): void + { + $this->printDefects($result->failures(), 'failure'); + } + + protected function printWarnings(TestResult $result): void + { + $this->printDefects($result->warnings(), 'warning'); + } + + protected function printIncompletes(TestResult $result): void + { + $this->printDefects($result->notImplemented(), 'incomplete test'); + } + + protected function printRisky(TestResult $result): void + { + $this->printDefects($result->risky(), 'risky test'); + } + + protected function printSkipped(TestResult $result): void + { + $this->printDefects($result->skipped(), 'skipped test'); + } + + protected function printHeader(): void + { + $this->write("\n\n" . Timer::resourceUsage() . "\n\n"); + } + + protected function printFooter(TestResult $result): void + { + if (\count($result) === 0) { + $this->writeWithColor( + 'fg-black, bg-yellow', + 'No tests executed!' + ); + + return; + } + + if ($result->wasSuccessful() && + $result->allHarmless() && + $result->allCompletelyImplemented() && + $result->noneSkipped()) { + $this->writeWithColor( + 'fg-black, bg-green', + \sprintf( + 'OK (%d test%s, %d assertion%s)', + \count($result), + (\count($result) == 1) ? '' : 's', + $this->numAssertions, + ($this->numAssertions == 1) ? '' : 's' + ) + ); + } else { + if ($result->wasSuccessful()) { + $color = 'fg-black, bg-yellow'; + + if ($this->verbose || !$result->allHarmless()) { + $this->write("\n"); + } + + $this->writeWithColor( + $color, + 'OK, but incomplete, skipped, or risky tests!' + ); + } else { + $this->write("\n"); + + if ($result->errorCount()) { + $color = 'fg-white, bg-red'; + + $this->writeWithColor( + $color, + 'ERRORS!' + ); + } elseif ($result->failureCount()) { + $color = 'fg-white, bg-red'; + + $this->writeWithColor( + $color, + 'FAILURES!' + ); + } elseif ($result->warningCount()) { + $color = 'fg-black, bg-yellow'; + + $this->writeWithColor( + $color, + 'WARNINGS!' + ); + } + } + + $this->writeCountString(\count($result), 'Tests', $color, true); + $this->writeCountString($this->numAssertions, 'Assertions', $color, true); + $this->writeCountString($result->errorCount(), 'Errors', $color); + $this->writeCountString($result->failureCount(), 'Failures', $color); + $this->writeCountString($result->warningCount(), 'Warnings', $color); + $this->writeCountString($result->skippedCount(), 'Skipped', $color); + $this->writeCountString($result->notImplementedCount(), 'Incomplete', $color); + $this->writeCountString($result->riskyCount(), 'Risky', $color); + $this->writeWithColor($color, '.'); + } + } + + protected function writeProgress(string $progress): void + { + if ($this->debug) { + return; + } + + $this->write($progress); + $this->column++; + $this->numTestsRun++; + + if ($this->column == $this->maxColumn || $this->numTestsRun == $this->numTests) { + if ($this->numTestsRun == $this->numTests) { + $this->write(\str_repeat(' ', $this->maxColumn - $this->column)); + } + + $this->write( + \sprintf( + ' %' . $this->numTestsWidth . 'd / %' . + $this->numTestsWidth . 'd (%3s%%)', + $this->numTestsRun, + $this->numTests, + \floor(($this->numTestsRun / $this->numTests) * 100) + ) + ); + + if ($this->column == $this->maxColumn) { + $this->writeNewLine(); + } + } + } + + protected function writeNewLine(): void + { + $this->column = 0; + $this->write("\n"); + } + + /** + * Formats a buffer with a specified ANSI color sequence if colors are + * enabled. + */ + protected function formatWithColor(string $color, string $buffer): string + { + if (!$this->colors) { + return $buffer; + } + + $codes = \array_map('\trim', \explode(',', $color)); + $lines = \explode("\n", $buffer); + $padding = \max(\array_map('\strlen', $lines)); + $styles = []; + + foreach ($codes as $code) { + $styles[] = self::$ansiCodes[$code]; + } + + $style = \sprintf("\x1b[%sm", \implode(';', $styles)); + + $styledLines = []; + + foreach ($lines as $line) { + $styledLines[] = $style . \str_pad($line, $padding) . "\x1b[0m"; + } + + return \implode("\n", $styledLines); + } + + /** + * Writes a buffer out with a color sequence if colors are enabled. + */ + protected function writeWithColor(string $color, string $buffer, bool $lf = true): void + { + $this->write($this->formatWithColor($color, $buffer)); + + if ($lf) { + $this->write("\n"); + } + } + + /** + * Writes progress with a color sequence if colors are enabled. + */ + protected function writeProgressWithColor(string $color, string $buffer): void + { + $buffer = $this->formatWithColor($color, $buffer); + $this->writeProgress($buffer); + } + + private function writeCountString(int $count, string $name, string $color, bool $always = false): void + { + static $first = true; + + if ($always || $count > 0) { + $this->writeWithColor( + $color, + \sprintf( + '%s%s: %d', + !$first ? ', ' : '', + $name, + $count + ), + false + ); + + $first = false; + } + } +} diff --git a/vendor/phpunit/phpunit/src/TextUI/TestRunner.php b/vendor/phpunit/phpunit/src/TextUI/TestRunner.php new file mode 100644 index 0000000..69cfa96 --- /dev/null +++ b/vendor/phpunit/phpunit/src/TextUI/TestRunner.php @@ -0,0 +1,1305 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TextUI; + +use PHPUnit\Framework\Error\Deprecated; +use PHPUnit\Framework\Error\Notice; +use PHPUnit\Framework\Error\Warning; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestListener; +use PHPUnit\Framework\TestResult; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Runner\AfterLastTestHook; +use PHPUnit\Runner\BaseTestRunner; +use PHPUnit\Runner\BeforeFirstTestHook; +use PHPUnit\Runner\Filter\ExcludeGroupFilterIterator; +use PHPUnit\Runner\Filter\Factory; +use PHPUnit\Runner\Filter\IncludeGroupFilterIterator; +use PHPUnit\Runner\Filter\NameFilterIterator; +use PHPUnit\Runner\Hook; +use PHPUnit\Runner\NullTestResultCache; +use PHPUnit\Runner\ResultCacheExtension; +use PHPUnit\Runner\StandardTestSuiteLoader; +use PHPUnit\Runner\TestHook; +use PHPUnit\Runner\TestListenerAdapter; +use PHPUnit\Runner\TestResultCache; +use PHPUnit\Runner\TestSuiteLoader; +use PHPUnit\Runner\TestSuiteSorter; +use PHPUnit\Runner\Version; +use PHPUnit\Util\Configuration; +use PHPUnit\Util\Log\JUnit; +use PHPUnit\Util\Log\TeamCity; +use PHPUnit\Util\Printer; +use PHPUnit\Util\TestDox\CliTestDoxPrinter; +use PHPUnit\Util\TestDox\HtmlResultPrinter; +use PHPUnit\Util\TestDox\TextResultPrinter; +use PHPUnit\Util\TestDox\XmlResultPrinter; +use PHPUnit\Util\XdebugFilterScriptGenerator; +use ReflectionClass; +use SebastianBergmann\CodeCoverage\CodeCoverage; +use SebastianBergmann\CodeCoverage\Exception as CodeCoverageException; +use SebastianBergmann\CodeCoverage\Filter as CodeCoverageFilter; +use SebastianBergmann\CodeCoverage\Report\Clover as CloverReport; +use SebastianBergmann\CodeCoverage\Report\Crap4j as Crap4jReport; +use SebastianBergmann\CodeCoverage\Report\Html\Facade as HtmlReport; +use SebastianBergmann\CodeCoverage\Report\PHP as PhpReport; +use SebastianBergmann\CodeCoverage\Report\Text as TextReport; +use SebastianBergmann\CodeCoverage\Report\Xml\Facade as XmlReport; +use SebastianBergmann\Comparator\Comparator; +use SebastianBergmann\Environment\Runtime; +use SebastianBergmann\Invoker\Invoker; + +/** + * A TestRunner for the Command Line Interface (CLI) + * PHP SAPI Module. + */ +class TestRunner extends BaseTestRunner +{ + public const SUCCESS_EXIT = 0; + + public const FAILURE_EXIT = 1; + + public const EXCEPTION_EXIT = 2; + + /** + * @var bool + */ + protected static $versionStringPrinted = false; + + /** + * @var CodeCoverageFilter + */ + protected $codeCoverageFilter; + + /** + * @var TestSuiteLoader + */ + protected $loader; + + /** + * @var ResultPrinter + */ + protected $printer; + + /** + * @var Runtime + */ + private $runtime; + + /** + * @var bool + */ + private $messagePrinted = false; + + /** + * @var Hook[] + */ + private $extensions = []; + + /** + * @param ReflectionClass|Test $test + * @param bool $exit + * + * @throws \RuntimeException + * @throws \InvalidArgumentException + * @throws Exception + * @throws \ReflectionException + */ + public static function run($test, array $arguments = [], $exit = true): TestResult + { + if ($test instanceof ReflectionClass) { + $test = new TestSuite($test); + } + + if ($test instanceof Test) { + $aTestRunner = new self; + + return $aTestRunner->doRun( + $test, + $arguments, + $exit + ); + } + + throw new Exception('No test case or test suite found.'); + } + + public function __construct(TestSuiteLoader $loader = null, CodeCoverageFilter $filter = null) + { + if ($filter === null) { + $filter = new CodeCoverageFilter; + } + + $this->codeCoverageFilter = $filter; + $this->loader = $loader; + $this->runtime = new Runtime; + } + + /** + * @throws \PHPUnit\Runner\Exception + * @throws Exception + * @throws \InvalidArgumentException + * @throws \RuntimeException + * @throws \ReflectionException + */ + public function doRun(Test $suite, array $arguments = [], bool $exit = true): TestResult + { + if (isset($arguments['configuration'])) { + $GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] = $arguments['configuration']; + } + + $this->handleConfiguration($arguments); + + if (\is_int($arguments['columns']) && $arguments['columns'] < 16) { + $arguments['columns'] = 16; + $tooFewColumnsRequested = true; + } + + if (isset($arguments['bootstrap'])) { + $GLOBALS['__PHPUNIT_BOOTSTRAP'] = $arguments['bootstrap']; + } + + if ($suite instanceof TestCase || $suite instanceof TestSuite) { + if ($arguments['backupGlobals'] === true) { + $suite->setBackupGlobals(true); + } + + if ($arguments['backupStaticAttributes'] === true) { + $suite->setBackupStaticAttributes(true); + } + + if ($arguments['beStrictAboutChangesToGlobalState'] === true) { + $suite->setBeStrictAboutChangesToGlobalState(true); + } + } + + if ($arguments['executionOrder'] === TestSuiteSorter::ORDER_RANDOMIZED) { + \mt_srand($arguments['randomOrderSeed']); + } + + if ($arguments['cacheResult']) { + if (isset($arguments['cacheResultFile'])) { + $cache = new TestResultCache($arguments['cacheResultFile']); + } else { + $cache = new TestResultCache; + } + + $this->extensions[] = new ResultCacheExtension($cache); + } + + if ($arguments['executionOrder'] !== TestSuiteSorter::ORDER_DEFAULT || $arguments['executionOrderDefects'] !== TestSuiteSorter::ORDER_DEFAULT || $arguments['resolveDependencies']) { + $cache = $cache ?? new NullTestResultCache; + + $cache->load(); + + $sorter = new TestSuiteSorter($cache); + + $sorter->reorderTestsInSuite($suite, $arguments['executionOrder'], $arguments['resolveDependencies'], $arguments['executionOrderDefects']); + $originalExecutionOrder = $sorter->getOriginalExecutionOrder(); + + unset($sorter); + } + + if (\is_int($arguments['repeat']) && $arguments['repeat'] > 0) { + $_suite = new TestSuite; + + foreach (\range(1, $arguments['repeat']) as $step) { + $_suite->addTest($suite); + } + + $suite = $_suite; + + unset($_suite); + } + + $result = $this->createTestResult(); + + $listener = new TestListenerAdapter; + $listenerNeeded = false; + + foreach ($this->extensions as $extension) { + if ($extension instanceof TestHook) { + $listener->add($extension); + + $listenerNeeded = true; + } + } + + if ($listenerNeeded) { + $result->addListener($listener); + } + + unset($listener, $listenerNeeded); + + if (!$arguments['convertErrorsToExceptions']) { + $result->convertErrorsToExceptions(false); + } + + if (!$arguments['convertDeprecationsToExceptions']) { + Deprecated::$enabled = false; + } + + if (!$arguments['convertNoticesToExceptions']) { + Notice::$enabled = false; + } + + if (!$arguments['convertWarningsToExceptions']) { + Warning::$enabled = false; + } + + if ($arguments['stopOnError']) { + $result->stopOnError(true); + } + + if ($arguments['stopOnFailure']) { + $result->stopOnFailure(true); + } + + if ($arguments['stopOnWarning']) { + $result->stopOnWarning(true); + } + + if ($arguments['stopOnIncomplete']) { + $result->stopOnIncomplete(true); + } + + if ($arguments['stopOnRisky']) { + $result->stopOnRisky(true); + } + + if ($arguments['stopOnSkipped']) { + $result->stopOnSkipped(true); + } + + if ($arguments['stopOnDefect']) { + $result->stopOnDefect(true); + } + + if ($arguments['registerMockObjectsFromTestArgumentsRecursively']) { + $result->setRegisterMockObjectsFromTestArgumentsRecursively(true); + } + + if ($this->printer === null) { + if (isset($arguments['printer']) && + $arguments['printer'] instanceof Printer) { + $this->printer = $arguments['printer']; + } else { + $printerClass = ResultPrinter::class; + + if (isset($arguments['printer']) && \is_string($arguments['printer']) && \class_exists($arguments['printer'], false)) { + $class = new ReflectionClass($arguments['printer']); + + if ($class->isSubclassOf(ResultPrinter::class)) { + $printerClass = $arguments['printer']; + } + } + + $this->printer = new $printerClass( + (isset($arguments['stderr']) && $arguments['stderr'] === true) ? 'php://stderr' : null, + $arguments['verbose'], + $arguments['colors'], + $arguments['debug'], + $arguments['columns'], + $arguments['reverseList'] + ); + + if (isset($originalExecutionOrder) && ($this->printer instanceof CliTestDoxPrinter)) { + /* @var CliTestDoxPrinter */ + $this->printer->setOriginalExecutionOrder($originalExecutionOrder); + } + } + } + + $this->printer->write( + Version::getVersionString() . "\n" + ); + + self::$versionStringPrinted = true; + + if ($arguments['verbose']) { + $runtime = $this->runtime->getNameWithVersion(); + + if ($this->runtime->hasXdebug()) { + $runtime .= \sprintf( + ' with Xdebug %s', + \phpversion('xdebug') + ); + } + + $this->writeMessage('Runtime', $runtime); + + if ($arguments['executionOrder'] === TestSuiteSorter::ORDER_RANDOMIZED) { + $this->writeMessage( + 'Random seed', + $arguments['randomOrderSeed'] + ); + } + + if (isset($arguments['configuration'])) { + $this->writeMessage( + 'Configuration', + $arguments['configuration']->getFilename() + ); + } + + foreach ($arguments['loadedExtensions'] as $extension) { + $this->writeMessage( + 'Extension', + $extension + ); + } + + foreach ($arguments['notLoadedExtensions'] as $extension) { + $this->writeMessage( + 'Extension', + $extension + ); + } + } + + if (isset($tooFewColumnsRequested)) { + $this->writeMessage('Error', 'Less than 16 columns requested, number of columns set to 16'); + } + + if ($this->runtime->discardsComments()) { + $this->writeMessage('Warning', 'opcache.save_comments=0 set; annotations will not work'); + } + + if (isset($arguments['configuration']) && $arguments['configuration']->hasValidationErrors()) { + $this->write( + "\n Warning - The configuration file did not pass validation!\n The following problems have been detected:\n" + ); + + foreach ($arguments['configuration']->getValidationErrors() as $line => $errors) { + $this->write(\sprintf("\n Line %d:\n", $line)); + + foreach ($errors as $msg) { + $this->write(\sprintf(" - %s\n", $msg)); + } + } + $this->write("\n Test results may not be as expected.\n\n"); + } + + foreach ($arguments['listeners'] as $listener) { + $result->addListener($listener); + } + + $result->addListener($this->printer); + + $codeCoverageReports = 0; + + if (!isset($arguments['noLogging'])) { + if (isset($arguments['testdoxHTMLFile'])) { + $result->addListener( + new HtmlResultPrinter( + $arguments['testdoxHTMLFile'], + $arguments['testdoxGroups'], + $arguments['testdoxExcludeGroups'] + ) + ); + } + + if (isset($arguments['testdoxTextFile'])) { + $result->addListener( + new TextResultPrinter( + $arguments['testdoxTextFile'], + $arguments['testdoxGroups'], + $arguments['testdoxExcludeGroups'] + ) + ); + } + + if (isset($arguments['testdoxXMLFile'])) { + $result->addListener( + new XmlResultPrinter( + $arguments['testdoxXMLFile'] + ) + ); + } + + if (isset($arguments['teamcityLogfile'])) { + $result->addListener( + new TeamCity($arguments['teamcityLogfile']) + ); + } + + if (isset($arguments['junitLogfile'])) { + $result->addListener( + new JUnit( + $arguments['junitLogfile'], + $arguments['reportUselessTests'] + ) + ); + } + + if (isset($arguments['coverageClover'])) { + $codeCoverageReports++; + } + + if (isset($arguments['coverageCrap4J'])) { + $codeCoverageReports++; + } + + if (isset($arguments['coverageHtml'])) { + $codeCoverageReports++; + } + + if (isset($arguments['coveragePHP'])) { + $codeCoverageReports++; + } + + if (isset($arguments['coverageText'])) { + $codeCoverageReports++; + } + + if (isset($arguments['coverageXml'])) { + $codeCoverageReports++; + } + } + + if (isset($arguments['noCoverage'])) { + $codeCoverageReports = 0; + } + + if ($codeCoverageReports > 0 && !$this->runtime->canCollectCodeCoverage()) { + $this->writeMessage('Error', 'No code coverage driver is available'); + + $codeCoverageReports = 0; + } + + if ($codeCoverageReports > 0 || isset($arguments['xdebugFilterFile'])) { + $codeCoverage = new CodeCoverage( + null, + $this->codeCoverageFilter + ); + + $codeCoverage->setUnintentionallyCoveredSubclassesWhitelist( + [Comparator::class] + ); + + $codeCoverage->setCheckForUnintentionallyCoveredCode( + $arguments['strictCoverage'] + ); + + $codeCoverage->setCheckForMissingCoversAnnotation( + $arguments['strictCoverage'] + ); + + if (isset($arguments['forceCoversAnnotation'])) { + $codeCoverage->setForceCoversAnnotation( + $arguments['forceCoversAnnotation'] + ); + } + + if (isset($arguments['ignoreDeprecatedCodeUnitsFromCodeCoverage'])) { + $codeCoverage->setIgnoreDeprecatedCode( + $arguments['ignoreDeprecatedCodeUnitsFromCodeCoverage'] + ); + } + + if (isset($arguments['disableCodeCoverageIgnore'])) { + $codeCoverage->setDisableIgnoredLines(true); + } + + $whitelistFromConfigurationFile = false; + $whitelistFromOption = false; + + if (isset($arguments['whitelist'])) { + $this->codeCoverageFilter->addDirectoryToWhitelist($arguments['whitelist']); + + $whitelistFromOption = true; + } + + if (isset($arguments['configuration'])) { + $filterConfiguration = $arguments['configuration']->getFilterConfiguration(); + + if (!empty($filterConfiguration['whitelist'])) { + $whitelistFromConfigurationFile = true; + } + + if (!empty($filterConfiguration['whitelist'])) { + $codeCoverage->setAddUncoveredFilesFromWhitelist( + $filterConfiguration['whitelist']['addUncoveredFilesFromWhitelist'] + ); + + $codeCoverage->setProcessUncoveredFilesFromWhitelist( + $filterConfiguration['whitelist']['processUncoveredFilesFromWhitelist'] + ); + + foreach ($filterConfiguration['whitelist']['include']['directory'] as $dir) { + $this->codeCoverageFilter->addDirectoryToWhitelist( + $dir['path'], + $dir['suffix'], + $dir['prefix'] + ); + } + + foreach ($filterConfiguration['whitelist']['include']['file'] as $file) { + $this->codeCoverageFilter->addFileToWhitelist($file); + } + + foreach ($filterConfiguration['whitelist']['exclude']['directory'] as $dir) { + $this->codeCoverageFilter->removeDirectoryFromWhitelist( + $dir['path'], + $dir['suffix'], + $dir['prefix'] + ); + } + + foreach ($filterConfiguration['whitelist']['exclude']['file'] as $file) { + $this->codeCoverageFilter->removeFileFromWhitelist($file); + } + } + } + + if (isset($arguments['xdebugFilterFile'], $filterConfiguration)) { + $filterScriptGenerator = new XdebugFilterScriptGenerator; + $script = $filterScriptGenerator->generate($filterConfiguration['whitelist']); + \file_put_contents($arguments['xdebugFilterFile'], $script); + + $this->write("\n"); + $this->write(\sprintf('Wrote Xdebug filter script to %s ' . \PHP_EOL, $arguments['xdebugFilterFile'])); + + exit(self::SUCCESS_EXIT); + } + + if (!$this->codeCoverageFilter->hasWhitelist()) { + if (!$whitelistFromConfigurationFile && !$whitelistFromOption) { + $this->writeMessage('Error', 'No whitelist is configured, no code coverage will be generated.'); + } else { + $this->writeMessage('Error', 'Incorrect whitelist config, no code coverage will be generated.'); + } + + $codeCoverageReports = 0; + + unset($codeCoverage); + } + } + + $this->printer->write("\n"); + + if (isset($codeCoverage)) { + $result->setCodeCoverage($codeCoverage); + + if ($codeCoverageReports > 1 && isset($arguments['cacheTokens'])) { + $codeCoverage->setCacheTokens($arguments['cacheTokens']); + } + } + + $result->beStrictAboutTestsThatDoNotTestAnything($arguments['reportUselessTests']); + $result->beStrictAboutOutputDuringTests($arguments['disallowTestOutput']); + $result->beStrictAboutTodoAnnotatedTests($arguments['disallowTodoAnnotatedTests']); + $result->beStrictAboutResourceUsageDuringSmallTests($arguments['beStrictAboutResourceUsageDuringSmallTests']); + + if ($arguments['enforceTimeLimit'] === true) { + if (!\class_exists(Invoker::class)) { + $this->writeMessage('Error', 'Package phpunit/php-invoker is required for enforcing time limits'); + } + + if (!\extension_loaded('pcntl') || \strpos(\ini_get('disable_functions'), 'pcntl') !== false) { + $this->writeMessage('Error', 'PHP extension pcntl is required for enforcing time limits'); + } + } + $result->enforceTimeLimit($arguments['enforceTimeLimit']); + $result->setDefaultTimeLimit($arguments['defaultTimeLimit']); + $result->setTimeoutForSmallTests($arguments['timeoutForSmallTests']); + $result->setTimeoutForMediumTests($arguments['timeoutForMediumTests']); + $result->setTimeoutForLargeTests($arguments['timeoutForLargeTests']); + + if ($suite instanceof TestSuite) { + $this->processSuiteFilters($suite, $arguments); + $suite->setRunTestInSeparateProcess($arguments['processIsolation']); + } + + foreach ($this->extensions as $extension) { + if ($extension instanceof BeforeFirstTestHook) { + $extension->executeBeforeFirstTest(); + } + } + + $suite->run($result); + + foreach ($this->extensions as $extension) { + if ($extension instanceof AfterLastTestHook) { + $extension->executeAfterLastTest(); + } + } + + $result->flushListeners(); + + if ($this->printer instanceof ResultPrinter) { + $this->printer->printResult($result); + } + + if (isset($codeCoverage)) { + if (isset($arguments['coverageClover'])) { + $this->printer->write( + "\nGenerating code coverage report in Clover XML format ..." + ); + + try { + $writer = new CloverReport; + $writer->process($codeCoverage, $arguments['coverageClover']); + + $this->printer->write(" done\n"); + unset($writer); + } catch (CodeCoverageException $e) { + $this->printer->write( + " failed\n" . $e->getMessage() . "\n" + ); + } + } + + if (isset($arguments['coverageCrap4J'])) { + $this->printer->write( + "\nGenerating Crap4J report XML file ..." + ); + + try { + $writer = new Crap4jReport($arguments['crap4jThreshold']); + $writer->process($codeCoverage, $arguments['coverageCrap4J']); + + $this->printer->write(" done\n"); + unset($writer); + } catch (CodeCoverageException $e) { + $this->printer->write( + " failed\n" . $e->getMessage() . "\n" + ); + } + } + + if (isset($arguments['coverageHtml'])) { + $this->printer->write( + "\nGenerating code coverage report in HTML format ..." + ); + + try { + $writer = new HtmlReport( + $arguments['reportLowUpperBound'], + $arguments['reportHighLowerBound'], + \sprintf( + ' and PHPUnit %s', + Version::id() + ) + ); + + $writer->process($codeCoverage, $arguments['coverageHtml']); + + $this->printer->write(" done\n"); + unset($writer); + } catch (CodeCoverageException $e) { + $this->printer->write( + " failed\n" . $e->getMessage() . "\n" + ); + } + } + + if (isset($arguments['coveragePHP'])) { + $this->printer->write( + "\nGenerating code coverage report in PHP format ..." + ); + + try { + $writer = new PhpReport; + $writer->process($codeCoverage, $arguments['coveragePHP']); + + $this->printer->write(" done\n"); + unset($writer); + } catch (CodeCoverageException $e) { + $this->printer->write( + " failed\n" . $e->getMessage() . "\n" + ); + } + } + + if (isset($arguments['coverageText'])) { + if ($arguments['coverageText'] == 'php://stdout') { + $outputStream = $this->printer; + $colors = $arguments['colors'] && $arguments['colors'] != ResultPrinter::COLOR_NEVER; + } else { + $outputStream = new Printer($arguments['coverageText']); + $colors = false; + } + + $processor = new TextReport( + $arguments['reportLowUpperBound'], + $arguments['reportHighLowerBound'], + $arguments['coverageTextShowUncoveredFiles'], + $arguments['coverageTextShowOnlySummary'] + ); + + $outputStream->write( + $processor->process($codeCoverage, $colors) + ); + } + + if (isset($arguments['coverageXml'])) { + $this->printer->write( + "\nGenerating code coverage report in PHPUnit XML format ..." + ); + + try { + $writer = new XmlReport(Version::id()); + $writer->process($codeCoverage, $arguments['coverageXml']); + + $this->printer->write(" done\n"); + unset($writer); + } catch (CodeCoverageException $e) { + $this->printer->write( + " failed\n" . $e->getMessage() . "\n" + ); + } + } + } + + if ($exit) { + if ($result->wasSuccessful()) { + if ($arguments['failOnRisky'] && !$result->allHarmless()) { + exit(self::FAILURE_EXIT); + } + + if ($arguments['failOnWarning'] && $result->warningCount() > 0) { + exit(self::FAILURE_EXIT); + } + + exit(self::SUCCESS_EXIT); + } + + if ($result->errorCount() > 0) { + exit(self::EXCEPTION_EXIT); + } + + if ($result->failureCount() > 0) { + exit(self::FAILURE_EXIT); + } + } + + return $result; + } + + public function setPrinter(ResultPrinter $resultPrinter): void + { + $this->printer = $resultPrinter; + } + + /** + * Returns the loader to be used. + */ + public function getLoader(): TestSuiteLoader + { + if ($this->loader === null) { + $this->loader = new StandardTestSuiteLoader; + } + + return $this->loader; + } + + protected function createTestResult(): TestResult + { + return new TestResult; + } + + /** + * Override to define how to handle a failed loading of + * a test suite. + */ + protected function runFailed(string $message): void + { + $this->write($message . \PHP_EOL); + + exit(self::FAILURE_EXIT); + } + + protected function write(string $buffer): void + { + if (\PHP_SAPI != 'cli' && \PHP_SAPI != 'phpdbg') { + $buffer = \htmlspecialchars($buffer); + } + + if ($this->printer !== null) { + $this->printer->write($buffer); + } else { + print $buffer; + } + } + + /** + * @throws Exception + */ + protected function handleConfiguration(array &$arguments): void + { + if (isset($arguments['configuration']) && + !$arguments['configuration'] instanceof Configuration) { + $arguments['configuration'] = Configuration::getInstance( + $arguments['configuration'] + ); + } + + $arguments['debug'] = $arguments['debug'] ?? false; + $arguments['filter'] = $arguments['filter'] ?? false; + $arguments['listeners'] = $arguments['listeners'] ?? []; + + if (isset($arguments['configuration'])) { + $arguments['configuration']->handlePHPConfiguration(); + + $phpunitConfiguration = $arguments['configuration']->getPHPUnitConfiguration(); + + if (isset($phpunitConfiguration['backupGlobals']) && !isset($arguments['backupGlobals'])) { + $arguments['backupGlobals'] = $phpunitConfiguration['backupGlobals']; + } + + if (isset($phpunitConfiguration['backupStaticAttributes']) && !isset($arguments['backupStaticAttributes'])) { + $arguments['backupStaticAttributes'] = $phpunitConfiguration['backupStaticAttributes']; + } + + if (isset($phpunitConfiguration['beStrictAboutChangesToGlobalState']) && !isset($arguments['beStrictAboutChangesToGlobalState'])) { + $arguments['beStrictAboutChangesToGlobalState'] = $phpunitConfiguration['beStrictAboutChangesToGlobalState']; + } + + if (isset($phpunitConfiguration['bootstrap']) && !isset($arguments['bootstrap'])) { + $arguments['bootstrap'] = $phpunitConfiguration['bootstrap']; + } + + if (isset($phpunitConfiguration['cacheResult']) && !isset($arguments['cacheResult'])) { + $arguments['cacheResult'] = $phpunitConfiguration['cacheResult']; + } + + if (isset($phpunitConfiguration['cacheResultFile']) && !isset($arguments['cacheResultFile'])) { + $arguments['cacheResultFile'] = $phpunitConfiguration['cacheResultFile']; + } + + if (isset($phpunitConfiguration['cacheTokens']) && !isset($arguments['cacheTokens'])) { + $arguments['cacheTokens'] = $phpunitConfiguration['cacheTokens']; + } + + if (isset($phpunitConfiguration['cacheTokens']) && !isset($arguments['cacheTokens'])) { + $arguments['cacheTokens'] = $phpunitConfiguration['cacheTokens']; + } + + if (isset($phpunitConfiguration['colors']) && !isset($arguments['colors'])) { + $arguments['colors'] = $phpunitConfiguration['colors']; + } + + if (isset($phpunitConfiguration['convertDeprecationsToExceptions']) && !isset($arguments['convertDeprecationsToExceptions'])) { + $arguments['convertDeprecationsToExceptions'] = $phpunitConfiguration['convertDeprecationsToExceptions']; + } + + if (isset($phpunitConfiguration['convertErrorsToExceptions']) && !isset($arguments['convertErrorsToExceptions'])) { + $arguments['convertErrorsToExceptions'] = $phpunitConfiguration['convertErrorsToExceptions']; + } + + if (isset($phpunitConfiguration['convertNoticesToExceptions']) && !isset($arguments['convertNoticesToExceptions'])) { + $arguments['convertNoticesToExceptions'] = $phpunitConfiguration['convertNoticesToExceptions']; + } + + if (isset($phpunitConfiguration['convertWarningsToExceptions']) && !isset($arguments['convertWarningsToExceptions'])) { + $arguments['convertWarningsToExceptions'] = $phpunitConfiguration['convertWarningsToExceptions']; + } + + if (isset($phpunitConfiguration['processIsolation']) && !isset($arguments['processIsolation'])) { + $arguments['processIsolation'] = $phpunitConfiguration['processIsolation']; + } + + if (isset($phpunitConfiguration['stopOnDefect']) && !isset($arguments['stopOnDefect'])) { + $arguments['stopOnDefect'] = $phpunitConfiguration['stopOnDefect']; + } + + if (isset($phpunitConfiguration['stopOnError']) && !isset($arguments['stopOnError'])) { + $arguments['stopOnError'] = $phpunitConfiguration['stopOnError']; + } + + if (isset($phpunitConfiguration['stopOnFailure']) && !isset($arguments['stopOnFailure'])) { + $arguments['stopOnFailure'] = $phpunitConfiguration['stopOnFailure']; + } + + if (isset($phpunitConfiguration['stopOnWarning']) && !isset($arguments['stopOnWarning'])) { + $arguments['stopOnWarning'] = $phpunitConfiguration['stopOnWarning']; + } + + if (isset($phpunitConfiguration['stopOnIncomplete']) && !isset($arguments['stopOnIncomplete'])) { + $arguments['stopOnIncomplete'] = $phpunitConfiguration['stopOnIncomplete']; + } + + if (isset($phpunitConfiguration['stopOnRisky']) && !isset($arguments['stopOnRisky'])) { + $arguments['stopOnRisky'] = $phpunitConfiguration['stopOnRisky']; + } + + if (isset($phpunitConfiguration['stopOnSkipped']) && !isset($arguments['stopOnSkipped'])) { + $arguments['stopOnSkipped'] = $phpunitConfiguration['stopOnSkipped']; + } + + if (isset($phpunitConfiguration['failOnWarning']) && !isset($arguments['failOnWarning'])) { + $arguments['failOnWarning'] = $phpunitConfiguration['failOnWarning']; + } + + if (isset($phpunitConfiguration['failOnRisky']) && !isset($arguments['failOnRisky'])) { + $arguments['failOnRisky'] = $phpunitConfiguration['failOnRisky']; + } + + if (isset($phpunitConfiguration['timeoutForSmallTests']) && !isset($arguments['timeoutForSmallTests'])) { + $arguments['timeoutForSmallTests'] = $phpunitConfiguration['timeoutForSmallTests']; + } + + if (isset($phpunitConfiguration['timeoutForMediumTests']) && !isset($arguments['timeoutForMediumTests'])) { + $arguments['timeoutForMediumTests'] = $phpunitConfiguration['timeoutForMediumTests']; + } + + if (isset($phpunitConfiguration['timeoutForLargeTests']) && !isset($arguments['timeoutForLargeTests'])) { + $arguments['timeoutForLargeTests'] = $phpunitConfiguration['timeoutForLargeTests']; + } + + if (isset($phpunitConfiguration['reportUselessTests']) && !isset($arguments['reportUselessTests'])) { + $arguments['reportUselessTests'] = $phpunitConfiguration['reportUselessTests']; + } + + if (isset($phpunitConfiguration['strictCoverage']) && !isset($arguments['strictCoverage'])) { + $arguments['strictCoverage'] = $phpunitConfiguration['strictCoverage']; + } + + if (isset($phpunitConfiguration['ignoreDeprecatedCodeUnitsFromCodeCoverage']) && !isset($arguments['ignoreDeprecatedCodeUnitsFromCodeCoverage'])) { + $arguments['ignoreDeprecatedCodeUnitsFromCodeCoverage'] = $phpunitConfiguration['ignoreDeprecatedCodeUnitsFromCodeCoverage']; + } + + if (isset($phpunitConfiguration['disallowTestOutput']) && !isset($arguments['disallowTestOutput'])) { + $arguments['disallowTestOutput'] = $phpunitConfiguration['disallowTestOutput']; + } + + if (isset($phpunitConfiguration['defaultTimeLimit']) && !isset($arguments['defaultTimeLimit'])) { + $arguments['defaultTimeLimit'] = $phpunitConfiguration['defaultTimeLimit']; + } + + if (isset($phpunitConfiguration['enforceTimeLimit']) && !isset($arguments['enforceTimeLimit'])) { + $arguments['enforceTimeLimit'] = $phpunitConfiguration['enforceTimeLimit']; + } + + if (isset($phpunitConfiguration['disallowTodoAnnotatedTests']) && !isset($arguments['disallowTodoAnnotatedTests'])) { + $arguments['disallowTodoAnnotatedTests'] = $phpunitConfiguration['disallowTodoAnnotatedTests']; + } + + if (isset($phpunitConfiguration['beStrictAboutResourceUsageDuringSmallTests']) && !isset($arguments['beStrictAboutResourceUsageDuringSmallTests'])) { + $arguments['beStrictAboutResourceUsageDuringSmallTests'] = $phpunitConfiguration['beStrictAboutResourceUsageDuringSmallTests']; + } + + if (isset($phpunitConfiguration['verbose']) && !isset($arguments['verbose'])) { + $arguments['verbose'] = $phpunitConfiguration['verbose']; + } + + if (isset($phpunitConfiguration['reverseDefectList']) && !isset($arguments['reverseList'])) { + $arguments['reverseList'] = $phpunitConfiguration['reverseDefectList']; + } + + if (isset($phpunitConfiguration['forceCoversAnnotation']) && !isset($arguments['forceCoversAnnotation'])) { + $arguments['forceCoversAnnotation'] = $phpunitConfiguration['forceCoversAnnotation']; + } + + if (isset($phpunitConfiguration['disableCodeCoverageIgnore']) && !isset($arguments['disableCodeCoverageIgnore'])) { + $arguments['disableCodeCoverageIgnore'] = $phpunitConfiguration['disableCodeCoverageIgnore']; + } + + if (isset($phpunitConfiguration['registerMockObjectsFromTestArgumentsRecursively']) && !isset($arguments['registerMockObjectsFromTestArgumentsRecursively'])) { + $arguments['registerMockObjectsFromTestArgumentsRecursively'] = $phpunitConfiguration['registerMockObjectsFromTestArgumentsRecursively']; + } + + if (isset($phpunitConfiguration['executionOrder']) && !isset($arguments['executionOrder'])) { + $arguments['executionOrder'] = $phpunitConfiguration['executionOrder']; + } + + if (isset($phpunitConfiguration['executionOrderDefects']) && !isset($arguments['executionOrderDefects'])) { + $arguments['executionOrderDefects'] = $phpunitConfiguration['executionOrderDefects']; + } + + if (isset($phpunitConfiguration['resolveDependencies']) && !isset($arguments['resolveDependencies'])) { + $arguments['resolveDependencies'] = $phpunitConfiguration['resolveDependencies']; + } + + $groupCliArgs = []; + + if (!empty($arguments['groups'])) { + $groupCliArgs = $arguments['groups']; + } + + $groupConfiguration = $arguments['configuration']->getGroupConfiguration(); + + if (!empty($groupConfiguration['include']) && !isset($arguments['groups'])) { + $arguments['groups'] = $groupConfiguration['include']; + } + + if (!empty($groupConfiguration['exclude']) && !isset($arguments['excludeGroups'])) { + $arguments['excludeGroups'] = \array_diff($groupConfiguration['exclude'], $groupCliArgs); + } + + foreach ($arguments['configuration']->getExtensionConfiguration() as $extension) { + if (!\class_exists($extension['class'], false) && $extension['file'] !== '') { + require_once $extension['file']; + } + + if (!\class_exists($extension['class'])) { + throw new Exception( + \sprintf( + 'Class "%s" does not exist', + $extension['class'] + ) + ); + } + + $extensionClass = new ReflectionClass($extension['class']); + + if (!$extensionClass->implementsInterface(Hook::class)) { + throw new Exception( + \sprintf( + 'Class "%s" does not implement a PHPUnit\Runner\Hook interface', + $extension['class'] + ) + ); + } + + if (\count($extension['arguments']) == 0) { + $this->extensions[] = $extensionClass->newInstance(); + } else { + $this->extensions[] = $extensionClass->newInstanceArgs( + $extension['arguments'] + ); + } + } + + foreach ($arguments['configuration']->getListenerConfiguration() as $listener) { + if (!\class_exists($listener['class'], false) && + $listener['file'] !== '') { + require_once $listener['file']; + } + + if (!\class_exists($listener['class'])) { + throw new Exception( + \sprintf( + 'Class "%s" does not exist', + $listener['class'] + ) + ); + } + + $listenerClass = new ReflectionClass($listener['class']); + + if (!$listenerClass->implementsInterface(TestListener::class)) { + throw new Exception( + \sprintf( + 'Class "%s" does not implement the PHPUnit\Framework\TestListener interface', + $listener['class'] + ) + ); + } + + if (\count($listener['arguments']) == 0) { + $listener = new $listener['class']; + } else { + $listener = $listenerClass->newInstanceArgs( + $listener['arguments'] + ); + } + + $arguments['listeners'][] = $listener; + } + + $loggingConfiguration = $arguments['configuration']->getLoggingConfiguration(); + + if (isset($loggingConfiguration['coverage-clover']) && !isset($arguments['coverageClover'])) { + $arguments['coverageClover'] = $loggingConfiguration['coverage-clover']; + } + + if (isset($loggingConfiguration['coverage-crap4j']) && !isset($arguments['coverageCrap4J'])) { + $arguments['coverageCrap4J'] = $loggingConfiguration['coverage-crap4j']; + + if (isset($loggingConfiguration['crap4jThreshold']) && !isset($arguments['crap4jThreshold'])) { + $arguments['crap4jThreshold'] = $loggingConfiguration['crap4jThreshold']; + } + } + + if (isset($loggingConfiguration['coverage-html']) && !isset($arguments['coverageHtml'])) { + if (isset($loggingConfiguration['lowUpperBound']) && !isset($arguments['reportLowUpperBound'])) { + $arguments['reportLowUpperBound'] = $loggingConfiguration['lowUpperBound']; + } + + if (isset($loggingConfiguration['highLowerBound']) && !isset($arguments['reportHighLowerBound'])) { + $arguments['reportHighLowerBound'] = $loggingConfiguration['highLowerBound']; + } + + $arguments['coverageHtml'] = $loggingConfiguration['coverage-html']; + } + + if (isset($loggingConfiguration['coverage-php']) && !isset($arguments['coveragePHP'])) { + $arguments['coveragePHP'] = $loggingConfiguration['coverage-php']; + } + + if (isset($loggingConfiguration['coverage-text']) && !isset($arguments['coverageText'])) { + $arguments['coverageText'] = $loggingConfiguration['coverage-text']; + + if (isset($loggingConfiguration['coverageTextShowUncoveredFiles'])) { + $arguments['coverageTextShowUncoveredFiles'] = $loggingConfiguration['coverageTextShowUncoveredFiles']; + } else { + $arguments['coverageTextShowUncoveredFiles'] = false; + } + + if (isset($loggingConfiguration['coverageTextShowOnlySummary'])) { + $arguments['coverageTextShowOnlySummary'] = $loggingConfiguration['coverageTextShowOnlySummary']; + } else { + $arguments['coverageTextShowOnlySummary'] = false; + } + } + + if (isset($loggingConfiguration['coverage-xml']) && !isset($arguments['coverageXml'])) { + $arguments['coverageXml'] = $loggingConfiguration['coverage-xml']; + } + + if (isset($loggingConfiguration['plain'])) { + $arguments['listeners'][] = new ResultPrinter( + $loggingConfiguration['plain'], + true + ); + } + + if (isset($loggingConfiguration['teamcity']) && !isset($arguments['teamcityLogfile'])) { + $arguments['teamcityLogfile'] = $loggingConfiguration['teamcity']; + } + + if (isset($loggingConfiguration['junit']) && !isset($arguments['junitLogfile'])) { + $arguments['junitLogfile'] = $loggingConfiguration['junit']; + } + + if (isset($loggingConfiguration['testdox-html']) && !isset($arguments['testdoxHTMLFile'])) { + $arguments['testdoxHTMLFile'] = $loggingConfiguration['testdox-html']; + } + + if (isset($loggingConfiguration['testdox-text']) && !isset($arguments['testdoxTextFile'])) { + $arguments['testdoxTextFile'] = $loggingConfiguration['testdox-text']; + } + + if (isset($loggingConfiguration['testdox-xml']) && !isset($arguments['testdoxXMLFile'])) { + $arguments['testdoxXMLFile'] = $loggingConfiguration['testdox-xml']; + } + + $testdoxGroupConfiguration = $arguments['configuration']->getTestdoxGroupConfiguration(); + + if (isset($testdoxGroupConfiguration['include']) && + !isset($arguments['testdoxGroups'])) { + $arguments['testdoxGroups'] = $testdoxGroupConfiguration['include']; + } + + if (isset($testdoxGroupConfiguration['exclude']) && + !isset($arguments['testdoxExcludeGroups'])) { + $arguments['testdoxExcludeGroups'] = $testdoxGroupConfiguration['exclude']; + } + } + + $arguments['addUncoveredFilesFromWhitelist'] = $arguments['addUncoveredFilesFromWhitelist'] ?? true; + $arguments['backupGlobals'] = $arguments['backupGlobals'] ?? null; + $arguments['backupStaticAttributes'] = $arguments['backupStaticAttributes'] ?? null; + $arguments['beStrictAboutChangesToGlobalState'] = $arguments['beStrictAboutChangesToGlobalState'] ?? null; + $arguments['beStrictAboutResourceUsageDuringSmallTests'] = $arguments['beStrictAboutResourceUsageDuringSmallTests'] ?? false; + $arguments['cacheResult'] = $arguments['cacheResult'] ?? false; + $arguments['cacheTokens'] = $arguments['cacheTokens'] ?? false; + $arguments['colors'] = $arguments['colors'] ?? ResultPrinter::COLOR_DEFAULT; + $arguments['columns'] = $arguments['columns'] ?? 80; + $arguments['convertDeprecationsToExceptions'] = $arguments['convertDeprecationsToExceptions'] ?? true; + $arguments['convertErrorsToExceptions'] = $arguments['convertErrorsToExceptions'] ?? true; + $arguments['convertNoticesToExceptions'] = $arguments['convertNoticesToExceptions'] ?? true; + $arguments['convertWarningsToExceptions'] = $arguments['convertWarningsToExceptions'] ?? true; + $arguments['crap4jThreshold'] = $arguments['crap4jThreshold'] ?? 30; + $arguments['disallowTestOutput'] = $arguments['disallowTestOutput'] ?? false; + $arguments['disallowTodoAnnotatedTests'] = $arguments['disallowTodoAnnotatedTests'] ?? false; + $arguments['defaultTimeLimit'] = $arguments['defaultTimeLimit'] ?? 0; + $arguments['enforceTimeLimit'] = $arguments['enforceTimeLimit'] ?? false; + $arguments['excludeGroups'] = $arguments['excludeGroups'] ?? []; + $arguments['failOnRisky'] = $arguments['failOnRisky'] ?? false; + $arguments['failOnWarning'] = $arguments['failOnWarning'] ?? false; + $arguments['executionOrderDefects'] = $arguments['executionOrderDefects'] ?? TestSuiteSorter::ORDER_DEFAULT; + $arguments['groups'] = $arguments['groups'] ?? []; + $arguments['processIsolation'] = $arguments['processIsolation'] ?? false; + $arguments['processUncoveredFilesFromWhitelist'] = $arguments['processUncoveredFilesFromWhitelist'] ?? false; + $arguments['randomOrderSeed'] = $arguments['randomOrderSeed'] ?? \time(); + $arguments['registerMockObjectsFromTestArgumentsRecursively'] = $arguments['registerMockObjectsFromTestArgumentsRecursively'] ?? false; + $arguments['repeat'] = $arguments['repeat'] ?? false; + $arguments['reportHighLowerBound'] = $arguments['reportHighLowerBound'] ?? 90; + $arguments['reportLowUpperBound'] = $arguments['reportLowUpperBound'] ?? 50; + $arguments['reportUselessTests'] = $arguments['reportUselessTests'] ?? true; + $arguments['reverseList'] = $arguments['reverseList'] ?? false; + $arguments['executionOrder'] = $arguments['executionOrder'] ?? TestSuiteSorter::ORDER_DEFAULT; + $arguments['resolveDependencies'] = $arguments['resolveDependencies'] ?? false; + $arguments['stopOnError'] = $arguments['stopOnError'] ?? false; + $arguments['stopOnFailure'] = $arguments['stopOnFailure'] ?? false; + $arguments['stopOnIncomplete'] = $arguments['stopOnIncomplete'] ?? false; + $arguments['stopOnRisky'] = $arguments['stopOnRisky'] ?? false; + $arguments['stopOnSkipped'] = $arguments['stopOnSkipped'] ?? false; + $arguments['stopOnWarning'] = $arguments['stopOnWarning'] ?? false; + $arguments['stopOnDefect'] = $arguments['stopOnDefect'] ?? false; + $arguments['strictCoverage'] = $arguments['strictCoverage'] ?? false; + $arguments['testdoxExcludeGroups'] = $arguments['testdoxExcludeGroups'] ?? []; + $arguments['testdoxGroups'] = $arguments['testdoxGroups'] ?? []; + $arguments['timeoutForLargeTests'] = $arguments['timeoutForLargeTests'] ?? 60; + $arguments['timeoutForMediumTests'] = $arguments['timeoutForMediumTests'] ?? 10; + $arguments['timeoutForSmallTests'] = $arguments['timeoutForSmallTests'] ?? 1; + $arguments['verbose'] = $arguments['verbose'] ?? false; + } + + /** + * @throws \ReflectionException + * @throws \InvalidArgumentException + */ + private function processSuiteFilters(TestSuite $suite, array $arguments): void + { + if (!$arguments['filter'] && + empty($arguments['groups']) && + empty($arguments['excludeGroups'])) { + return; + } + + $filterFactory = new Factory; + + if (!empty($arguments['excludeGroups'])) { + $filterFactory->addFilter( + new ReflectionClass(ExcludeGroupFilterIterator::class), + $arguments['excludeGroups'] + ); + } + + if (!empty($arguments['groups'])) { + $filterFactory->addFilter( + new ReflectionClass(IncludeGroupFilterIterator::class), + $arguments['groups'] + ); + } + + if ($arguments['filter']) { + $filterFactory->addFilter( + new ReflectionClass(NameFilterIterator::class), + $arguments['filter'] + ); + } + + $suite->injectFilter($filterFactory); + } + + private function writeMessage(string $type, string $message): void + { + if (!$this->messagePrinted) { + $this->write("\n"); + } + + $this->write( + \sprintf( + "%-15s%s\n", + $type . ':', + $message + ) + ); + + $this->messagePrinted = true; + } +} diff --git a/vendor/phpunit/phpunit/src/Util/Blacklist.php b/vendor/phpunit/phpunit/src/Util/Blacklist.php new file mode 100644 index 0000000..9af4bb5 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/Blacklist.php @@ -0,0 +1,127 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use Composer\Autoload\ClassLoader; +use DeepCopy\DeepCopy; +use Doctrine\Instantiator\Instantiator; +use PHP_Token; +use phpDocumentor\Reflection\DocBlock; +use PHPUnit\Framework\MockObject\Generator; +use PHPUnit\Framework\TestCase; +use Prophecy\Prophet; +use ReflectionClass; +use SebastianBergmann\CodeCoverage\CodeCoverage; +use SebastianBergmann\Comparator\Comparator; +use SebastianBergmann\Diff\Diff; +use SebastianBergmann\Environment\Runtime; +use SebastianBergmann\Exporter\Exporter; +use SebastianBergmann\FileIterator\Facade as FileIteratorFacade; +use SebastianBergmann\GlobalState\Snapshot; +use SebastianBergmann\Invoker\Invoker; +use SebastianBergmann\RecursionContext\Context; +use SebastianBergmann\Timer\Timer; +use SebastianBergmann\Version; +use Text_Template; + +/** + * Utility class for blacklisting PHPUnit's own source code files. + */ +final class Blacklist +{ + /** + * @var array + */ + public static $blacklistedClassNames = [ + FileIteratorFacade::class => 1, + Timer::class => 1, + PHP_Token::class => 1, + TestCase::class => 2, + 'PHPUnit\DbUnit\TestCase' => 2, + Generator::class => 1, + Text_Template::class => 1, + 'Symfony\Component\Yaml\Yaml' => 1, + CodeCoverage::class => 1, + Diff::class => 1, + Runtime::class => 1, + Comparator::class => 1, + Exporter::class => 1, + Snapshot::class => 1, + Invoker::class => 1, + Context::class => 1, + Version::class => 1, + ClassLoader::class => 1, + Instantiator::class => 1, + DocBlock::class => 1, + Prophet::class => 1, + DeepCopy::class => 1, + ]; + + /** + * @var string[] + */ + private static $directories; + + /** + * @return string[] + */ + public function getBlacklistedDirectories(): array + { + $this->initialize(); + + return self::$directories; + } + + public function isBlacklisted(string $file): bool + { + if (\defined('PHPUNIT_TESTSUITE')) { + return false; + } + + $this->initialize(); + + foreach (self::$directories as $directory) { + if (\strpos($file, $directory) === 0) { + return true; + } + } + + return false; + } + + private function initialize(): void + { + if (self::$directories === null) { + self::$directories = []; + + foreach (self::$blacklistedClassNames as $className => $parent) { + if (!\class_exists($className)) { + continue; + } + + $reflector = new ReflectionClass($className); + $directory = $reflector->getFileName(); + + for ($i = 0; $i < $parent; $i++) { + $directory = \dirname($directory); + } + + self::$directories[] = $directory; + } + + // Hide process isolation workaround on Windows. + if (\DIRECTORY_SEPARATOR === '\\') { + // tempnam() prefix is limited to first 3 chars. + // @see https://php.net/manual/en/function.tempnam.php + self::$directories[] = \sys_get_temp_dir() . '\\PHP'; + } + } + } +} diff --git a/vendor/phpunit/phpunit/src/Util/Configuration.php b/vendor/phpunit/phpunit/src/Util/Configuration.php new file mode 100644 index 0000000..0a18430 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/Configuration.php @@ -0,0 +1,1331 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use DOMElement; +use DOMXPath; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Runner\TestSuiteSorter; +use PHPUnit\TextUI\ResultPrinter; +use SebastianBergmann\FileIterator\Facade as FileIteratorFacade; + +/** + * Wrapper for the PHPUnit XML configuration file. + * + * Example XML configuration file: + * + * + * + * + * + * + * /path/to/files + * /path/to/MyTest.php + * /path/to/files/exclude + * + * + * + * + * + * name + * + * + * name + * + * + * + * + * + * name + * + * + * name + * + * + * + * + * + * /path/to/files + * /path/to/file + * + * /path/to/files + * /path/to/file + * + * + * + * + * + * + * + * + * + * Sebastian + * + * + * 22 + * April + * 19.78 + * + * + * MyRelativeFile.php + * MyRelativeDir + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * . + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +final class Configuration +{ + /** + * @var self[] + */ + private static $instances = []; + + /** + * @var \DOMDocument + */ + private $document; + + /** + * @var DOMXPath + */ + private $xpath; + + /** + * @var string + */ + private $filename; + + /** + * @var \LibXMLError[] + */ + private $errors = []; + + /** + * Returns a PHPUnit configuration object. + * + * @throws Exception + */ + public static function getInstance(string $filename): self + { + $realPath = \realpath($filename); + + if ($realPath === false) { + throw new Exception( + \sprintf( + 'Could not read "%s".', + $filename + ) + ); + } + + /** @var string $realPath */ + if (!isset(self::$instances[$realPath])) { + self::$instances[$realPath] = new self($realPath); + } + + return self::$instances[$realPath]; + } + + /** + * Loads a PHPUnit configuration file. + * + * @throws Exception + */ + private function __construct(string $filename) + { + $this->filename = $filename; + $this->document = Xml::loadFile($filename, false, true, true); + $this->xpath = new DOMXPath($this->document); + + $this->validateConfigurationAgainstSchema(); + } + + /** + * @codeCoverageIgnore + */ + private function __clone() + { + } + + public function hasValidationErrors(): bool + { + return \count($this->errors) > 0; + } + + public function getValidationErrors(): array + { + $result = []; + + foreach ($this->errors as $error) { + if (!isset($result[$error->line])) { + $result[$error->line] = []; + } + $result[$error->line][] = \trim($error->message); + } + + return $result; + } + + /** + * Returns the real path to the configuration file. + */ + public function getFilename(): string + { + return $this->filename; + } + + public function getExtensionConfiguration(): array + { + $result = []; + + foreach ($this->xpath->query('extensions/extension') as $extension) { + /** @var DOMElement $extension */ + $class = (string) $extension->getAttribute('class'); + $file = ''; + $arguments = $this->getConfigurationArguments($extension->childNodes); + + if ($extension->getAttribute('file')) { + $file = $this->toAbsolutePath( + (string) $extension->getAttribute('file'), + true + ); + } + $result[] = [ + 'class' => $class, + 'file' => $file, + 'arguments' => $arguments, + ]; + } + + return $result; + } + + /** + * Returns the configuration for SUT filtering. + */ + public function getFilterConfiguration(): array + { + $addUncoveredFilesFromWhitelist = true; + $processUncoveredFilesFromWhitelist = false; + $includeDirectory = []; + $includeFile = []; + $excludeDirectory = []; + $excludeFile = []; + + $tmp = $this->xpath->query('filter/whitelist'); + + if ($tmp->length === 1) { + if ($tmp->item(0)->hasAttribute('addUncoveredFilesFromWhitelist')) { + $addUncoveredFilesFromWhitelist = $this->getBoolean( + (string) $tmp->item(0)->getAttribute( + 'addUncoveredFilesFromWhitelist' + ), + true + ); + } + + if ($tmp->item(0)->hasAttribute('processUncoveredFilesFromWhitelist')) { + $processUncoveredFilesFromWhitelist = $this->getBoolean( + (string) $tmp->item(0)->getAttribute( + 'processUncoveredFilesFromWhitelist' + ), + false + ); + } + + $includeDirectory = $this->readFilterDirectories( + 'filter/whitelist/directory' + ); + + $includeFile = $this->readFilterFiles( + 'filter/whitelist/file' + ); + + $excludeDirectory = $this->readFilterDirectories( + 'filter/whitelist/exclude/directory' + ); + + $excludeFile = $this->readFilterFiles( + 'filter/whitelist/exclude/file' + ); + } + + return [ + 'whitelist' => [ + 'addUncoveredFilesFromWhitelist' => $addUncoveredFilesFromWhitelist, + 'processUncoveredFilesFromWhitelist' => $processUncoveredFilesFromWhitelist, + 'include' => [ + 'directory' => $includeDirectory, + 'file' => $includeFile, + ], + 'exclude' => [ + 'directory' => $excludeDirectory, + 'file' => $excludeFile, + ], + ], + ]; + } + + /** + * Returns the configuration for groups. + */ + public function getGroupConfiguration(): array + { + return $this->parseGroupConfiguration('groups'); + } + + /** + * Returns the configuration for testdox groups. + */ + public function getTestdoxGroupConfiguration(): array + { + return $this->parseGroupConfiguration('testdoxGroups'); + } + + /** + * Returns the configuration for listeners. + */ + public function getListenerConfiguration(): array + { + $result = []; + + foreach ($this->xpath->query('listeners/listener') as $listener) { + /** @var DOMElement $listener */ + $class = (string) $listener->getAttribute('class'); + $file = ''; + $arguments = $this->getConfigurationArguments($listener->childNodes); + + if ($listener->getAttribute('file')) { + $file = $this->toAbsolutePath( + (string) $listener->getAttribute('file'), + true + ); + } + + $result[] = [ + 'class' => $class, + 'file' => $file, + 'arguments' => $arguments, + ]; + } + + return $result; + } + + /** + * Returns the logging configuration. + */ + public function getLoggingConfiguration(): array + { + $result = []; + + foreach ($this->xpath->query('logging/log') as $log) { + /** @var DOMElement $log */ + $type = (string) $log->getAttribute('type'); + $target = (string) $log->getAttribute('target'); + + if (!$target) { + continue; + } + + $target = $this->toAbsolutePath($target); + + if ($type === 'coverage-html') { + if ($log->hasAttribute('lowUpperBound')) { + $result['lowUpperBound'] = $this->getInteger( + (string) $log->getAttribute('lowUpperBound'), + 50 + ); + } + + if ($log->hasAttribute('highLowerBound')) { + $result['highLowerBound'] = $this->getInteger( + (string) $log->getAttribute('highLowerBound'), + 90 + ); + } + } elseif ($type === 'coverage-crap4j') { + if ($log->hasAttribute('threshold')) { + $result['crap4jThreshold'] = $this->getInteger( + (string) $log->getAttribute('threshold'), + 30 + ); + } + } elseif ($type === 'coverage-text') { + if ($log->hasAttribute('showUncoveredFiles')) { + $result['coverageTextShowUncoveredFiles'] = $this->getBoolean( + (string) $log->getAttribute('showUncoveredFiles'), + false + ); + } + + if ($log->hasAttribute('showOnlySummary')) { + $result['coverageTextShowOnlySummary'] = $this->getBoolean( + (string) $log->getAttribute('showOnlySummary'), + false + ); + } + } + + $result[$type] = $target; + } + + return $result; + } + + /** + * Returns the PHP configuration. + */ + public function getPHPConfiguration(): array + { + $result = [ + 'include_path' => [], + 'ini' => [], + 'const' => [], + 'var' => [], + 'env' => [], + 'post' => [], + 'get' => [], + 'cookie' => [], + 'server' => [], + 'files' => [], + 'request' => [], + ]; + + foreach ($this->xpath->query('php/includePath') as $includePath) { + $path = (string) $includePath->textContent; + + if ($path) { + $result['include_path'][] = $this->toAbsolutePath($path); + } + } + + foreach ($this->xpath->query('php/ini') as $ini) { + /** @var DOMElement $ini */ + $name = (string) $ini->getAttribute('name'); + $value = (string) $ini->getAttribute('value'); + + $result['ini'][$name]['value'] = $value; + } + + foreach ($this->xpath->query('php/const') as $const) { + /** @var DOMElement $const */ + $name = (string) $const->getAttribute('name'); + $value = (string) $const->getAttribute('value'); + + $result['const'][$name]['value'] = $this->getBoolean($value, $value); + } + + foreach (['var', 'env', 'post', 'get', 'cookie', 'server', 'files', 'request'] as $array) { + foreach ($this->xpath->query('php/' . $array) as $var) { + /** @var DOMElement $var */ + $name = (string) $var->getAttribute('name'); + $value = (string) $var->getAttribute('value'); + $verbatim = false; + + if ($var->hasAttribute('verbatim')) { + $verbatim = $this->getBoolean($var->getAttribute('verbatim'), false); + $result[$array][$name]['verbatim'] = $verbatim; + } + + if ($var->hasAttribute('force')) { + $force = $this->getBoolean($var->getAttribute('force'), false); + $result[$array][$name]['force'] = $force; + } + + if (!$verbatim) { + $value = $this->getBoolean($value, $value); + } + + $result[$array][$name]['value'] = $value; + } + } + + return $result; + } + + /** + * Handles the PHP configuration. + */ + public function handlePHPConfiguration(): void + { + $configuration = $this->getPHPConfiguration(); + + if (!empty($configuration['include_path'])) { + \ini_set( + 'include_path', + \implode(\PATH_SEPARATOR, $configuration['include_path']) . + \PATH_SEPARATOR . + \ini_get('include_path') + ); + } + + foreach ($configuration['ini'] as $name => $data) { + $value = $data['value']; + + if (\defined($value)) { + $value = (string) \constant($value); + } + + \ini_set($name, $value); + } + + foreach ($configuration['const'] as $name => $data) { + $value = $data['value']; + + if (!\defined($name)) { + \define($name, $value); + } + } + + foreach (['var', 'post', 'get', 'cookie', 'server', 'files', 'request'] as $array) { + /* + * @see https://github.com/sebastianbergmann/phpunit/issues/277 + */ + switch ($array) { + case 'var': + $target = &$GLOBALS; + + break; + + case 'server': + $target = &$_SERVER; + + break; + + default: + $target = &$GLOBALS['_' . \strtoupper($array)]; + + break; + } + + foreach ($configuration[$array] as $name => $data) { + $target[$name] = $data['value']; + } + } + + foreach ($configuration['env'] as $name => $data) { + $value = $data['value']; + $force = $data['force'] ?? false; + + if ($force || \getenv($name) === false) { + \putenv("{$name}={$value}"); + } + + $value = \getenv($name); + + if (!isset($_ENV[$name])) { + $_ENV[$name] = $value; + } + + if ($force === true) { + $_ENV[$name] = $value; + } + } + } + + /** + * Returns the PHPUnit configuration. + */ + public function getPHPUnitConfiguration(): array + { + $result = []; + $root = $this->document->documentElement; + + if ($root->hasAttribute('cacheTokens')) { + $result['cacheTokens'] = $this->getBoolean( + (string) $root->getAttribute('cacheTokens'), + false + ); + } + + if ($root->hasAttribute('columns')) { + $columns = (string) $root->getAttribute('columns'); + + if ($columns === 'max') { + $result['columns'] = 'max'; + } else { + $result['columns'] = $this->getInteger($columns, 80); + } + } + + if ($root->hasAttribute('colors')) { + /* only allow boolean for compatibility with previous versions + 'always' only allowed from command line */ + if ($this->getBoolean($root->getAttribute('colors'), false)) { + $result['colors'] = ResultPrinter::COLOR_AUTO; + } else { + $result['colors'] = ResultPrinter::COLOR_NEVER; + } + } + + /* + * @see https://github.com/sebastianbergmann/phpunit/issues/657 + */ + if ($root->hasAttribute('stderr')) { + $result['stderr'] = $this->getBoolean( + (string) $root->getAttribute('stderr'), + false + ); + } + + if ($root->hasAttribute('backupGlobals')) { + $result['backupGlobals'] = $this->getBoolean( + (string) $root->getAttribute('backupGlobals'), + false + ); + } + + if ($root->hasAttribute('backupStaticAttributes')) { + $result['backupStaticAttributes'] = $this->getBoolean( + (string) $root->getAttribute('backupStaticAttributes'), + false + ); + } + + if ($root->getAttribute('bootstrap')) { + $result['bootstrap'] = $this->toAbsolutePath( + (string) $root->getAttribute('bootstrap') + ); + } + + if ($root->hasAttribute('convertDeprecationsToExceptions')) { + $result['convertDeprecationsToExceptions'] = $this->getBoolean( + (string) $root->getAttribute('convertDeprecationsToExceptions'), + true + ); + } + + if ($root->hasAttribute('convertErrorsToExceptions')) { + $result['convertErrorsToExceptions'] = $this->getBoolean( + (string) $root->getAttribute('convertErrorsToExceptions'), + true + ); + } + + if ($root->hasAttribute('convertNoticesToExceptions')) { + $result['convertNoticesToExceptions'] = $this->getBoolean( + (string) $root->getAttribute('convertNoticesToExceptions'), + true + ); + } + + if ($root->hasAttribute('convertWarningsToExceptions')) { + $result['convertWarningsToExceptions'] = $this->getBoolean( + (string) $root->getAttribute('convertWarningsToExceptions'), + true + ); + } + + if ($root->hasAttribute('forceCoversAnnotation')) { + $result['forceCoversAnnotation'] = $this->getBoolean( + (string) $root->getAttribute('forceCoversAnnotation'), + false + ); + } + + if ($root->hasAttribute('disableCodeCoverageIgnore')) { + $result['disableCodeCoverageIgnore'] = $this->getBoolean( + (string) $root->getAttribute('disableCodeCoverageIgnore'), + false + ); + } + + if ($root->hasAttribute('processIsolation')) { + $result['processIsolation'] = $this->getBoolean( + (string) $root->getAttribute('processIsolation'), + false + ); + } + + if ($root->hasAttribute('stopOnDefect')) { + $result['stopOnDefect'] = $this->getBoolean( + (string) $root->getAttribute('stopOnDefect'), + false + ); + } + + if ($root->hasAttribute('stopOnError')) { + $result['stopOnError'] = $this->getBoolean( + (string) $root->getAttribute('stopOnError'), + false + ); + } + + if ($root->hasAttribute('stopOnFailure')) { + $result['stopOnFailure'] = $this->getBoolean( + (string) $root->getAttribute('stopOnFailure'), + false + ); + } + + if ($root->hasAttribute('stopOnWarning')) { + $result['stopOnWarning'] = $this->getBoolean( + (string) $root->getAttribute('stopOnWarning'), + false + ); + } + + if ($root->hasAttribute('stopOnIncomplete')) { + $result['stopOnIncomplete'] = $this->getBoolean( + (string) $root->getAttribute('stopOnIncomplete'), + false + ); + } + + if ($root->hasAttribute('stopOnRisky')) { + $result['stopOnRisky'] = $this->getBoolean( + (string) $root->getAttribute('stopOnRisky'), + false + ); + } + + if ($root->hasAttribute('stopOnSkipped')) { + $result['stopOnSkipped'] = $this->getBoolean( + (string) $root->getAttribute('stopOnSkipped'), + false + ); + } + + if ($root->hasAttribute('failOnWarning')) { + $result['failOnWarning'] = $this->getBoolean( + (string) $root->getAttribute('failOnWarning'), + false + ); + } + + if ($root->hasAttribute('failOnRisky')) { + $result['failOnRisky'] = $this->getBoolean( + (string) $root->getAttribute('failOnRisky'), + false + ); + } + + if ($root->hasAttribute('testSuiteLoaderClass')) { + $result['testSuiteLoaderClass'] = (string) $root->getAttribute( + 'testSuiteLoaderClass' + ); + } + + if ($root->hasAttribute('defaultTestSuite')) { + $result['defaultTestSuite'] = (string) $root->getAttribute( + 'defaultTestSuite' + ); + } + + if ($root->getAttribute('testSuiteLoaderFile')) { + $result['testSuiteLoaderFile'] = $this->toAbsolutePath( + (string) $root->getAttribute('testSuiteLoaderFile') + ); + } + + if ($root->hasAttribute('printerClass')) { + $result['printerClass'] = (string) $root->getAttribute( + 'printerClass' + ); + } + + if ($root->getAttribute('printerFile')) { + $result['printerFile'] = $this->toAbsolutePath( + (string) $root->getAttribute('printerFile') + ); + } + + if ($root->hasAttribute('beStrictAboutChangesToGlobalState')) { + $result['beStrictAboutChangesToGlobalState'] = $this->getBoolean( + (string) $root->getAttribute('beStrictAboutChangesToGlobalState'), + false + ); + } + + if ($root->hasAttribute('beStrictAboutOutputDuringTests')) { + $result['disallowTestOutput'] = $this->getBoolean( + (string) $root->getAttribute('beStrictAboutOutputDuringTests'), + false + ); + } + + if ($root->hasAttribute('beStrictAboutResourceUsageDuringSmallTests')) { + $result['beStrictAboutResourceUsageDuringSmallTests'] = $this->getBoolean( + (string) $root->getAttribute('beStrictAboutResourceUsageDuringSmallTests'), + false + ); + } + + if ($root->hasAttribute('beStrictAboutTestsThatDoNotTestAnything')) { + $result['reportUselessTests'] = $this->getBoolean( + (string) $root->getAttribute('beStrictAboutTestsThatDoNotTestAnything'), + true + ); + } + + if ($root->hasAttribute('beStrictAboutTodoAnnotatedTests')) { + $result['disallowTodoAnnotatedTests'] = $this->getBoolean( + (string) $root->getAttribute('beStrictAboutTodoAnnotatedTests'), + false + ); + } + + if ($root->hasAttribute('beStrictAboutCoversAnnotation')) { + $result['strictCoverage'] = $this->getBoolean( + (string) $root->getAttribute('beStrictAboutCoversAnnotation'), + false + ); + } + + if ($root->hasAttribute('defaultTimeLimit')) { + $result['defaultTimeLimit'] = $this->getInteger( + (string) $root->getAttribute('defaultTimeLimit'), + 1 + ); + } + + if ($root->hasAttribute('enforceTimeLimit')) { + $result['enforceTimeLimit'] = $this->getBoolean( + (string) $root->getAttribute('enforceTimeLimit'), + false + ); + } + + if ($root->hasAttribute('ignoreDeprecatedCodeUnitsFromCodeCoverage')) { + $result['ignoreDeprecatedCodeUnitsFromCodeCoverage'] = $this->getBoolean( + (string) $root->getAttribute('ignoreDeprecatedCodeUnitsFromCodeCoverage'), + false + ); + } + + if ($root->hasAttribute('timeoutForSmallTests')) { + $result['timeoutForSmallTests'] = $this->getInteger( + (string) $root->getAttribute('timeoutForSmallTests'), + 1 + ); + } + + if ($root->hasAttribute('timeoutForMediumTests')) { + $result['timeoutForMediumTests'] = $this->getInteger( + (string) $root->getAttribute('timeoutForMediumTests'), + 10 + ); + } + + if ($root->hasAttribute('timeoutForLargeTests')) { + $result['timeoutForLargeTests'] = $this->getInteger( + (string) $root->getAttribute('timeoutForLargeTests'), + 60 + ); + } + + if ($root->hasAttribute('reverseDefectList')) { + $result['reverseDefectList'] = $this->getBoolean( + (string) $root->getAttribute('reverseDefectList'), + false + ); + } + + if ($root->hasAttribute('verbose')) { + $result['verbose'] = $this->getBoolean( + (string) $root->getAttribute('verbose'), + false + ); + } + + if ($root->hasAttribute('registerMockObjectsFromTestArgumentsRecursively')) { + $result['registerMockObjectsFromTestArgumentsRecursively'] = $this->getBoolean( + (string) $root->getAttribute('registerMockObjectsFromTestArgumentsRecursively'), + false + ); + } + + if ($root->hasAttribute('extensionsDirectory')) { + $result['extensionsDirectory'] = $this->toAbsolutePath( + (string) $root->getAttribute( + 'extensionsDirectory' + ) + ); + } + + if ($root->hasAttribute('cacheResult')) { + $result['cacheResult'] = $this->getBoolean( + (string) $root->getAttribute('cacheResult'), + false + ); + } + + if ($root->hasAttribute('cacheResultFile')) { + $result['cacheResultFile'] = $this->toAbsolutePath( + (string) $root->getAttribute('cacheResultFile') + ); + } + + if ($root->hasAttribute('executionOrder')) { + foreach (\explode(',', $root->getAttribute('executionOrder')) as $order) { + switch ($order) { + case 'default': + $result['executionOrder'] = TestSuiteSorter::ORDER_DEFAULT; + $result['executionOrderDefects'] = TestSuiteSorter::ORDER_DEFAULT; + $result['resolveDependencies'] = false; + + break; + case 'reverse': + $result['executionOrder'] = TestSuiteSorter::ORDER_REVERSED; + + break; + case 'random': + $result['executionOrder'] = TestSuiteSorter::ORDER_RANDOMIZED; + + break; + case 'defects': + $result['executionOrderDefects'] = TestSuiteSorter::ORDER_DEFECTS_FIRST; + + break; + case 'depends': + $result['resolveDependencies'] = true; + + break; + } + } + } + + if ($root->hasAttribute('resolveDependencies')) { + $result['resolveDependencies'] = $this->getBoolean( + (string) $root->getAttribute('resolveDependencies'), + false + ); + } + + return $result; + } + + /** + * Returns the test suite configuration. + * + * @throws Exception + */ + public function getTestSuiteConfiguration(string $testSuiteFilter = ''): TestSuite + { + $testSuiteNodes = $this->xpath->query('testsuites/testsuite'); + + if ($testSuiteNodes->length === 0) { + $testSuiteNodes = $this->xpath->query('testsuite'); + } + + if ($testSuiteNodes->length === 1) { + return $this->getTestSuite($testSuiteNodes->item(0), $testSuiteFilter); + } + + $suite = new TestSuite; + + foreach ($testSuiteNodes as $testSuiteNode) { + $suite->addTestSuite( + $this->getTestSuite($testSuiteNode, $testSuiteFilter) + ); + } + + return $suite; + } + + /** + * Returns the test suite names from the configuration. + */ + public function getTestSuiteNames(): array + { + $names = []; + + foreach ($this->xpath->query('*/testsuite') as $node) { + /* @var DOMElement $node */ + $names[] = $node->getAttribute('name'); + } + + return $names; + } + + private function validateConfigurationAgainstSchema(): void + { + $original = \libxml_use_internal_errors(true); + $xsdFilename = __DIR__ . '/../../phpunit.xsd'; + + if (\defined('__PHPUNIT_PHAR_ROOT__')) { + $xsdFilename = __PHPUNIT_PHAR_ROOT__ . '/phpunit.xsd'; + } + + $this->document->schemaValidate($xsdFilename); + $this->errors = \libxml_get_errors(); + \libxml_clear_errors(); + \libxml_use_internal_errors($original); + } + + /** + * Collects and returns the configuration arguments from the PHPUnit + * XML configuration + */ + private function getConfigurationArguments(\DOMNodeList $nodes): array + { + $arguments = []; + + if ($nodes->length === 0) { + return $arguments; + } + + foreach ($nodes as $node) { + if (!$node instanceof DOMElement) { + continue; + } + + if ($node->tagName !== 'arguments') { + continue; + } + + foreach ($node->childNodes as $argument) { + if (!$argument instanceof DOMElement) { + continue; + } + + if ($argument->tagName === 'file' || $argument->tagName === 'directory') { + $arguments[] = $this->toAbsolutePath((string) $argument->textContent); + } else { + $arguments[] = Xml::xmlToVariable($argument); + } + } + } + + return $arguments; + } + + /** + * @throws \PHPUnit\Framework\Exception + */ + private function getTestSuite(DOMElement $testSuiteNode, string $testSuiteFilter = ''): TestSuite + { + if ($testSuiteNode->hasAttribute('name')) { + $suite = new TestSuite( + (string) $testSuiteNode->getAttribute('name') + ); + } else { + $suite = new TestSuite; + } + + $exclude = []; + + foreach ($testSuiteNode->getElementsByTagName('exclude') as $excludeNode) { + $excludeFile = (string) $excludeNode->textContent; + + if ($excludeFile) { + $exclude[] = $this->toAbsolutePath($excludeFile); + } + } + + $fileIteratorFacade = new FileIteratorFacade; + $testSuiteFilter = $testSuiteFilter ? \explode(',', $testSuiteFilter) : []; + + foreach ($testSuiteNode->getElementsByTagName('directory') as $directoryNode) { + /** @var DOMElement $directoryNode */ + if (!empty($testSuiteFilter) && !\in_array($directoryNode->parentNode->getAttribute('name'), $testSuiteFilter)) { + continue; + } + + $directory = (string) $directoryNode->textContent; + + if (empty($directory)) { + continue; + } + + $prefix = ''; + $suffix = 'Test.php'; + + if (!$this->satisfiesPhpVersion($directoryNode)) { + continue; + } + + if ($directoryNode->hasAttribute('prefix')) { + $prefix = (string) $directoryNode->getAttribute('prefix'); + } + + if ($directoryNode->hasAttribute('suffix')) { + $suffix = (string) $directoryNode->getAttribute('suffix'); + } + + $files = $fileIteratorFacade->getFilesAsArray( + $this->toAbsolutePath($directory), + $suffix, + $prefix, + $exclude + ); + + $suite->addTestFiles($files); + } + + foreach ($testSuiteNode->getElementsByTagName('file') as $fileNode) { + /** @var DOMElement $fileNode */ + if (!empty($testSuiteFilter) && !\in_array($fileNode->parentNode->getAttribute('name'), $testSuiteFilter)) { + continue; + } + + $file = (string) $fileNode->textContent; + + if (empty($file)) { + continue; + } + + $file = $fileIteratorFacade->getFilesAsArray( + $this->toAbsolutePath($file) + ); + + if (!isset($file[0])) { + continue; + } + + $file = $file[0]; + + if (!$this->satisfiesPhpVersion($fileNode)) { + continue; + } + + $suite->addTestFile($file); + } + + return $suite; + } + + private function satisfiesPhpVersion(DOMElement $node): bool + { + $phpVersion = \PHP_VERSION; + $phpVersionOperator = '>='; + + if ($node->hasAttribute('phpVersion')) { + $phpVersion = (string) $node->getAttribute('phpVersion'); + } + + if ($node->hasAttribute('phpVersionOperator')) { + $phpVersionOperator = (string) $node->getAttribute('phpVersionOperator'); + } + + return \version_compare(\PHP_VERSION, $phpVersion, $phpVersionOperator); + } + + /** + * if $value is 'false' or 'true', this returns the value that $value represents. + * Otherwise, returns $default, which may be a string in rare cases. + * See PHPUnit\Util\ConfigurationTest::testPHPConfigurationIsReadCorrectly + * + * @param bool|string $default + * + * @return bool|string + */ + private function getBoolean(string $value, $default) + { + if (\strtolower($value) === 'false') { + return false; + } + + if (\strtolower($value) === 'true') { + return true; + } + + return $default; + } + + private function getInteger(string $value, int $default): int + { + if (\is_numeric($value)) { + return (int) $value; + } + + return $default; + } + + private function readFilterDirectories(string $query): array + { + $directories = []; + + foreach ($this->xpath->query($query) as $directoryNode) { + /** @var DOMElement $directoryNode */ + $directoryPath = (string) $directoryNode->textContent; + + if (!$directoryPath) { + continue; + } + + $prefix = ''; + $suffix = '.php'; + $group = 'DEFAULT'; + + if ($directoryNode->hasAttribute('prefix')) { + $prefix = (string) $directoryNode->getAttribute('prefix'); + } + + if ($directoryNode->hasAttribute('suffix')) { + $suffix = (string) $directoryNode->getAttribute('suffix'); + } + + if ($directoryNode->hasAttribute('group')) { + $group = (string) $directoryNode->getAttribute('group'); + } + + $directories[] = [ + 'path' => $this->toAbsolutePath($directoryPath), + 'prefix' => $prefix, + 'suffix' => $suffix, + 'group' => $group, + ]; + } + + return $directories; + } + + /** + * @return string[] + */ + private function readFilterFiles(string $query): array + { + $files = []; + + foreach ($this->xpath->query($query) as $file) { + $filePath = (string) $file->textContent; + + if ($filePath) { + $files[] = $this->toAbsolutePath($filePath); + } + } + + return $files; + } + + private function toAbsolutePath(string $path, bool $useIncludePath = false): string + { + $path = \trim($path); + + if ($path[0] === '/') { + return $path; + } + + // Matches the following on Windows: + // - \\NetworkComputer\Path + // - \\.\D: + // - \\.\c: + // - C:\Windows + // - C:\windows + // - C:/windows + // - c:/windows + if (\defined('PHP_WINDOWS_VERSION_BUILD') && + ($path[0] === '\\' || (\strlen($path) >= 3 && \preg_match('#^[A-Z]\:[/\\\]#i', \substr($path, 0, 3))))) { + return $path; + } + + if (\strpos($path, '://') !== false) { + return $path; + } + + $file = \dirname($this->filename) . \DIRECTORY_SEPARATOR . $path; + + if ($useIncludePath && !\file_exists($file)) { + $includePathFile = \stream_resolve_include_path($path); + + if ($includePathFile) { + $file = $includePathFile; + } + } + + return $file; + } + + private function parseGroupConfiguration(string $root): array + { + $groups = [ + 'include' => [], + 'exclude' => [], + ]; + + foreach ($this->xpath->query($root . '/include/group') as $group) { + $groups['include'][] = (string) $group->textContent; + } + + foreach ($this->xpath->query($root . '/exclude/group') as $group) { + $groups['exclude'][] = (string) $group->textContent; + } + + return $groups; + } +} diff --git a/vendor/phpunit/phpunit/src/Util/ConfigurationGenerator.php b/vendor/phpunit/phpunit/src/Util/ConfigurationGenerator.php new file mode 100644 index 0000000..30bb128 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/ConfigurationGenerator.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +final class ConfigurationGenerator +{ + /** + * @var string + */ + private const TEMPLATE = << + + + + {tests_directory} + + + + + + {src_directory} + + + + +EOT; + + public function generateDefaultConfiguration(string $phpunitVersion, string $bootstrapScript, string $testsDirectory, string $srcDirectory): string + { + return \str_replace( + [ + '{phpunit_version}', + '{bootstrap_script}', + '{tests_directory}', + '{src_directory}', + ], + [ + $phpunitVersion, + $bootstrapScript, + $testsDirectory, + $srcDirectory, + ], + self::TEMPLATE + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Util/ErrorHandler.php b/vendor/phpunit/phpunit/src/Util/ErrorHandler.php new file mode 100644 index 0000000..e71cedb --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/ErrorHandler.php @@ -0,0 +1,106 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use PHPUnit\Framework\Error\Deprecated; +use PHPUnit\Framework\Error\Error; +use PHPUnit\Framework\Error\Notice; +use PHPUnit\Framework\Error\Warning; + +/** + * Error handler that converts PHP errors and warnings to exceptions. + */ +final class ErrorHandler +{ + private static $errorStack = []; + + /** + * Returns the error stack. + */ + public static function getErrorStack(): array + { + return self::$errorStack; + } + + public static function handleError(int $errorNumber, string $errorString, string $errorFile, int $errorLine): bool + { + if (!($errorNumber & \error_reporting())) { + return false; + } + + self::$errorStack[] = [$errorNumber, $errorString, $errorFile, $errorLine]; + + $trace = \debug_backtrace(); + \array_shift($trace); + + foreach ($trace as $frame) { + if ($frame['function'] === '__toString') { + return false; + } + } + + if ($errorNumber === \E_NOTICE || $errorNumber === \E_USER_NOTICE || $errorNumber === \E_STRICT) { + if (Notice::$enabled !== true) { + return false; + } + + $exception = Notice::class; + } elseif ($errorNumber === \E_WARNING || $errorNumber === \E_USER_WARNING) { + if (Warning::$enabled !== true) { + return false; + } + + $exception = Warning::class; + } elseif ($errorNumber === \E_DEPRECATED || $errorNumber === \E_USER_DEPRECATED) { + if (Deprecated::$enabled !== true) { + return false; + } + + $exception = Deprecated::class; + } else { + $exception = Error::class; + } + + throw new $exception($errorString, $errorNumber, $errorFile, $errorLine); + } + + /** + * Registers an error handler and returns a function that will restore + * the previous handler when invoked + * + * @param int $severity PHP predefined error constant + * + * @throws \Exception if event of specified severity is emitted + */ + public static function handleErrorOnce($severity = \E_WARNING): callable + { + $terminator = function () { + static $expired = false; + + if (!$expired) { + $expired = true; + + return \restore_error_handler(); + } + }; + + \set_error_handler( + function ($errorNumber, $errorString) use ($severity) { + if ($errorNumber === $severity) { + return; + } + + return false; + } + ); + + return $terminator; + } +} diff --git a/vendor/phpunit/phpunit/src/Util/FileLoader.php b/vendor/phpunit/phpunit/src/Util/FileLoader.php new file mode 100644 index 0000000..cad4bdc --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/FileLoader.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use PHPUnit\Framework\Exception; + +/** + * Utility methods to load PHP sourcefiles. + */ +final class FileLoader +{ + /** + * Checks if a PHP sourcecode file is readable. The sourcecode file is loaded through the load() method. + * + * As a fallback, PHP looks in the directory of the file executing the stream_resolve_include_path function. + * We do not want to load the Test.php file here, so skip it if it found that. + * PHP prioritizes the include_path setting, so if the current directory is in there, it will first look in the + * current working directory. + * + * @throws Exception + */ + public static function checkAndLoad(string $filename): string + { + $includePathFilename = \stream_resolve_include_path($filename); + $localFile = __DIR__ . \DIRECTORY_SEPARATOR . $filename; + + /** + * @see https://github.com/sebastianbergmann/phpunit/pull/2751 + */ + $isReadable = @\fopen($includePathFilename, 'r') !== false; + + if (!$includePathFilename || !$isReadable || $includePathFilename === $localFile) { + throw new Exception( + \sprintf('Cannot open file "%s".' . "\n", $filename) + ); + } + + self::load($includePathFilename); + + return $includePathFilename; + } + + /** + * Loads a PHP sourcefile. + */ + public static function load(string $filename): void + { + $oldVariableNames = \array_keys(\get_defined_vars()); + + include_once $filename; + + $newVariables = \get_defined_vars(); + $newVariableNames = \array_diff(\array_keys($newVariables), $oldVariableNames); + + foreach ($newVariableNames as $variableName) { + if ($variableName !== 'oldVariableNames') { + $GLOBALS[$variableName] = $newVariables[$variableName]; + } + } + } +} diff --git a/vendor/phpunit/phpunit/src/Util/Filesystem.php b/vendor/phpunit/phpunit/src/Util/Filesystem.php new file mode 100644 index 0000000..a2ea804 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/Filesystem.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +/** + * Filesystem helpers. + */ +final class Filesystem +{ + /** + * Maps class names to source file names: + * - PEAR CS: Foo_Bar_Baz -> Foo/Bar/Baz.php + * - Namespace: Foo\Bar\Baz -> Foo/Bar/Baz.php + */ + public static function classNameToFilename(string $className): string + { + return \str_replace( + ['_', '\\'], + \DIRECTORY_SEPARATOR, + $className + ) . '.php'; + } +} diff --git a/vendor/phpunit/phpunit/src/Util/Filter.php b/vendor/phpunit/phpunit/src/Util/Filter.php new file mode 100644 index 0000000..e57055b --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/Filter.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\SyntheticError; + +final class Filter +{ + public static function getFilteredStacktrace(\Throwable $t): string + { + $prefix = false; + $script = \realpath($GLOBALS['_SERVER']['SCRIPT_NAME']); + + if (\defined('__PHPUNIT_PHAR_ROOT__')) { + $prefix = __PHPUNIT_PHAR_ROOT__; + } + + $filteredStacktrace = ''; + + if ($t instanceof SyntheticError) { + $eTrace = $t->getSyntheticTrace(); + $eFile = $t->getSyntheticFile(); + $eLine = $t->getSyntheticLine(); + } elseif ($t instanceof Exception) { + $eTrace = $t->getSerializableTrace(); + $eFile = $t->getFile(); + $eLine = $t->getLine(); + } else { + if ($t->getPrevious()) { + $t = $t->getPrevious(); + } + + $eTrace = $t->getTrace(); + $eFile = $t->getFile(); + $eLine = $t->getLine(); + } + + if (!self::frameExists($eTrace, $eFile, $eLine)) { + \array_unshift( + $eTrace, + ['file' => $eFile, 'line' => $eLine] + ); + } + + $blacklist = new Blacklist; + + foreach ($eTrace as $frame) { + if (isset($frame['file']) && \is_file($frame['file']) && + (empty($GLOBALS['__PHPUNIT_ISOLATION_BLACKLIST']) || !\in_array($frame['file'], $GLOBALS['__PHPUNIT_ISOLATION_BLACKLIST'])) && + !$blacklist->isBlacklisted($frame['file']) && + ($prefix === false || \strpos($frame['file'], $prefix) !== 0) && + $frame['file'] !== $script) { + $filteredStacktrace .= \sprintf( + "%s:%s\n", + $frame['file'], + $frame['line'] ?? '?' + ); + } + } + + return $filteredStacktrace; + } + + private static function frameExists(array $trace, string $file, int $line): bool + { + foreach ($trace as $frame) { + if (isset($frame['file']) && $frame['file'] === $file && + isset($frame['line']) && $frame['line'] === $line) { + return true; + } + } + + return false; + } +} diff --git a/vendor/phpunit/phpunit/src/Util/Getopt.php b/vendor/phpunit/phpunit/src/Util/Getopt.php new file mode 100644 index 0000000..71c9fd5 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/Getopt.php @@ -0,0 +1,183 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use PHPUnit\Framework\Exception; + +/** + * Command-line options parsing class. + */ +final class Getopt +{ + /** + * @throws Exception + */ + public static function getopt(array $args, string $short_options, array $long_options = null): array + { + if (empty($args)) { + return [[], []]; + } + + $opts = []; + $non_opts = []; + + if ($long_options) { + \sort($long_options); + } + + if (isset($args[0][0]) && $args[0][0] !== '-') { + \array_shift($args); + } + + \reset($args); + + $args = \array_map('trim', $args); + + /* @noinspection ComparisonOperandsOrderInspection */ + while (false !== $arg = \current($args)) { + $i = \key($args); + \next($args); + + if ($arg === '') { + continue; + } + + if ($arg === '--') { + $non_opts = \array_merge($non_opts, \array_slice($args, $i + 1)); + + break; + } + + if ($arg[0] !== '-' || (\strlen($arg) > 1 && $arg[1] === '-' && !$long_options)) { + $non_opts[] = $args[$i]; + + continue; + } + + if (\strlen($arg) > 1 && $arg[1] === '-') { + self::parseLongOption( + \substr($arg, 2), + $long_options, + $opts, + $args + ); + } else { + self::parseShortOption( + \substr($arg, 1), + $short_options, + $opts, + $args + ); + } + } + + return [$opts, $non_opts]; + } + + /** + * @throws Exception + */ + private static function parseShortOption(string $arg, string $short_options, array &$opts, array &$args): void + { + $argLen = \strlen($arg); + + for ($i = 0; $i < $argLen; $i++) { + $opt = $arg[$i]; + $opt_arg = null; + + if ($arg[$i] === ':' || ($spec = \strstr($short_options, $opt)) === false) { + throw new Exception( + "unrecognized option -- $opt" + ); + } + + if (\strlen($spec) > 1 && $spec[1] === ':') { + if ($i + 1 < $argLen) { + $opts[] = [$opt, \substr($arg, $i + 1)]; + + break; + } + + if (!(\strlen($spec) > 2 && $spec[2] === ':')) { + /* @noinspection ComparisonOperandsOrderInspection */ + if (false === $opt_arg = \current($args)) { + throw new Exception( + "option requires an argument -- $opt" + ); + } + + \next($args); + } + } + + $opts[] = [$opt, $opt_arg]; + } + } + + /** + * @throws Exception + */ + private static function parseLongOption(string $arg, array $long_options, array &$opts, array &$args): void + { + $count = \count($long_options); + $list = \explode('=', $arg); + $opt = $list[0]; + $opt_arg = null; + + if (\count($list) > 1) { + $opt_arg = $list[1]; + } + + $opt_len = \strlen($opt); + + for ($i = 0; $i < $count; $i++) { + $long_opt = $long_options[$i]; + $opt_start = \substr($long_opt, 0, $opt_len); + + if ($opt_start !== $opt) { + continue; + } + + $opt_rest = \substr($long_opt, $opt_len); + + if ($opt_rest !== '' && $i + 1 < $count && $opt[0] !== '=' && + \strpos($long_options[$i + 1], $opt) === 0) { + throw new Exception( + "option --$opt is ambiguous" + ); + } + + if (\substr($long_opt, -1) === '=') { + /* @noinspection StrlenInEmptyStringCheckContextInspection */ + if (\substr($long_opt, -2) !== '==' && !\strlen($opt_arg)) { + /* @noinspection ComparisonOperandsOrderInspection */ + if (false === $opt_arg = \current($args)) { + throw new Exception( + "option --$opt requires an argument" + ); + } + + \next($args); + } + } elseif ($opt_arg) { + throw new Exception( + "option --$opt doesn't allow an argument" + ); + } + + $full_option = '--' . \preg_replace('/={1,2}$/', '', $long_opt); + $opts[] = [$full_option, $opt_arg]; + + return; + } + + throw new Exception("unrecognized option --$opt"); + } +} diff --git a/vendor/phpunit/phpunit/src/Util/GlobalState.php b/vendor/phpunit/phpunit/src/Util/GlobalState.php new file mode 100644 index 0000000..69c151a --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/GlobalState.php @@ -0,0 +1,172 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use Closure; + +final class GlobalState +{ + /** + * @var string[] + */ + private const SUPER_GLOBAL_ARRAYS = [ + '_ENV', + '_POST', + '_GET', + '_COOKIE', + '_SERVER', + '_FILES', + '_REQUEST', + ]; + + public static function getIncludedFilesAsString(): string + { + return static::processIncludedFilesAsString(\get_included_files()); + } + + /** + * @param string[] $files + */ + public static function processIncludedFilesAsString(array $files): string + { + $blacklist = new Blacklist; + $prefix = false; + $result = ''; + + if (\defined('__PHPUNIT_PHAR__')) { + $prefix = 'phar://' . __PHPUNIT_PHAR__ . '/'; + } + + for ($i = \count($files) - 1; $i > 0; $i--) { + $file = $files[$i]; + + if (!empty($GLOBALS['__PHPUNIT_ISOLATION_BLACKLIST']) && + \in_array($file, $GLOBALS['__PHPUNIT_ISOLATION_BLACKLIST'])) { + continue; + } + + if ($prefix !== false && \strpos($file, $prefix) === 0) { + continue; + } + + // Skip virtual file system protocols + if (\preg_match('/^(vfs|phpvfs[a-z0-9]+):/', $file)) { + continue; + } + + if (!$blacklist->isBlacklisted($file) && \is_file($file)) { + $result = 'require_once \'' . $file . "';\n" . $result; + } + } + + return $result; + } + + public static function getIniSettingsAsString(): string + { + $result = ''; + $iniSettings = \ini_get_all(null, false); + + foreach ($iniSettings as $key => $value) { + $result .= \sprintf( + '@ini_set(%s, %s);' . "\n", + self::exportVariable($key), + self::exportVariable($value) + ); + } + + return $result; + } + + public static function getConstantsAsString(): string + { + $constants = \get_defined_constants(true); + $result = ''; + + if (isset($constants['user'])) { + foreach ($constants['user'] as $name => $value) { + $result .= \sprintf( + 'if (!defined(\'%s\')) define(\'%s\', %s);' . "\n", + $name, + $name, + self::exportVariable($value) + ); + } + } + + return $result; + } + + public static function getGlobalsAsString(): string + { + $result = ''; + + foreach (self::SUPER_GLOBAL_ARRAYS as $superGlobalArray) { + if (isset($GLOBALS[$superGlobalArray]) && \is_array($GLOBALS[$superGlobalArray])) { + foreach (\array_keys($GLOBALS[$superGlobalArray]) as $key) { + if ($GLOBALS[$superGlobalArray][$key] instanceof Closure) { + continue; + } + + $result .= \sprintf( + '$GLOBALS[\'%s\'][\'%s\'] = %s;' . "\n", + $superGlobalArray, + $key, + self::exportVariable($GLOBALS[$superGlobalArray][$key]) + ); + } + } + } + + $blacklist = self::SUPER_GLOBAL_ARRAYS; + $blacklist[] = 'GLOBALS'; + + foreach (\array_keys($GLOBALS) as $key) { + if (!$GLOBALS[$key] instanceof Closure && !\in_array($key, $blacklist, true)) { + $result .= \sprintf( + '$GLOBALS[\'%s\'] = %s;' . "\n", + $key, + self::exportVariable($GLOBALS[$key]) + ); + } + } + + return $result; + } + + private static function exportVariable($variable): string + { + if (\is_scalar($variable) || $variable === null || + (\is_array($variable) && self::arrayOnlyContainsScalars($variable))) { + return \var_export($variable, true); + } + + return 'unserialize(' . \var_export(\serialize($variable), true) . ')'; + } + + private static function arrayOnlyContainsScalars(array $array): bool + { + $result = true; + + foreach ($array as $element) { + if (\is_array($element)) { + $result = self::arrayOnlyContainsScalars($element); + } elseif (!\is_scalar($element) && $element !== null) { + $result = false; + } + + if ($result === false) { + break; + } + } + + return $result; + } +} diff --git a/vendor/phpunit/phpunit/src/Util/InvalidArgumentHelper.php b/vendor/phpunit/phpunit/src/Util/InvalidArgumentHelper.php new file mode 100644 index 0000000..1c4ef50 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/InvalidArgumentHelper.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use PHPUnit\Framework\Exception; + +/** + * Factory for PHPUnit\Framework\Exception objects that are used to describe + * invalid arguments passed to a function or method. + */ +final class InvalidArgumentHelper +{ + public static function factory(int $argument, string $type, $value = null): Exception + { + $stack = \debug_backtrace(); + + return new Exception( + \sprintf( + 'Argument #%d%sof %s::%s() must be a %s', + $argument, + $value !== null ? ' (' . \gettype($value) . '#' . $value . ')' : ' (No Value) ', + $stack[1]['class'], + $stack[1]['function'], + $type + ) + ); + } +} diff --git a/vendor/phpunit/phpunit/src/Util/Json.php b/vendor/phpunit/phpunit/src/Util/Json.php new file mode 100644 index 0000000..c881191 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/Json.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use PHPUnit\Framework\Exception; + +final class Json +{ + /** + * Prettify json string + * + * @throws \PHPUnit\Framework\Exception + */ + public static function prettify(string $json): string + { + $decodedJson = \json_decode($json, true); + + if (\json_last_error()) { + throw new Exception( + 'Cannot prettify invalid json' + ); + } + + return \json_encode($decodedJson, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES); + } + + /* + * To allow comparison of JSON strings, first process them into a consistent + * format so that they can be compared as strings. + * @return array ($error, $canonicalized_json) The $error parameter is used + * to indicate an error decoding the json. This is used to avoid ambiguity + * with JSON strings consisting entirely of 'null' or 'false'. + */ + public static function canonicalize(string $json): array + { + $decodedJson = \json_decode($json); + + if (\json_last_error()) { + return [true, null]; + } + + self::recursiveSort($decodedJson); + + $reencodedJson = \json_encode($decodedJson); + + return [false, $reencodedJson]; + } + + /* + * JSON object keys are unordered while PHP array keys are ordered. + * Sort all array keys to ensure both the expected and actual values have + * their keys in the same order. + */ + private static function recursiveSort(&$json): void + { + if (\is_array($json) === false) { + // If the object is not empty, change it to an associative array + // so we can sort the keys (and we will still re-encode it + // correctly, since PHP encodes associative arrays as JSON objects.) + // But EMPTY objects MUST remain empty objects. (Otherwise we will + // re-encode it as a JSON array rather than a JSON object.) + // See #2919. + if (\is_object($json) && \count((array) $json) > 0) { + $json = (array) $json; + } else { + return; + } + } + + \ksort($json); + + foreach ($json as $key => &$value) { + self::recursiveSort($value); + } + } +} diff --git a/vendor/phpunit/phpunit/src/Util/Log/JUnit.php b/vendor/phpunit/phpunit/src/Util/Log/JUnit.php new file mode 100644 index 0000000..13b9509 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/Log/JUnit.php @@ -0,0 +1,432 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\Log; + +use DOMDocument; +use DOMElement; +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\ExceptionWrapper; +use PHPUnit\Framework\SelfDescribing; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestFailure; +use PHPUnit\Framework\TestListener; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Framework\Warning; +use PHPUnit\Util\Filter; +use PHPUnit\Util\Printer; +use PHPUnit\Util\Xml; +use ReflectionClass; +use ReflectionException; + +/** + * A TestListener that generates a logfile of the test execution in XML markup. + * + * The XML markup used is the same as the one that is used by the JUnit Ant task. + */ +class JUnit extends Printer implements TestListener +{ + /** + * @var DOMDocument + */ + protected $document; + + /** + * @var DOMElement + */ + protected $root; + + /** + * @var bool + */ + protected $reportUselessTests = false; + + /** + * @var bool + */ + protected $writeDocument = true; + + /** + * @var DOMElement[] + */ + protected $testSuites = []; + + /** + * @var int[] + */ + protected $testSuiteTests = [0]; + + /** + * @var int[] + */ + protected $testSuiteAssertions = [0]; + + /** + * @var int[] + */ + protected $testSuiteErrors = [0]; + + /** + * @var int[] + */ + protected $testSuiteFailures = [0]; + + /** + * @var int[] + */ + protected $testSuiteSkipped = [0]; + + /** + * @var int[] + */ + protected $testSuiteTimes = [0]; + + /** + * @var int + */ + protected $testSuiteLevel = 0; + + /** + * @var DOMElement + */ + protected $currentTestCase; + + /** + * Constructor. + * + * @param null|mixed $out + * + * @throws \PHPUnit\Framework\Exception + */ + public function __construct($out = null, bool $reportUselessTests = false) + { + $this->document = new DOMDocument('1.0', 'UTF-8'); + $this->document->formatOutput = true; + + $this->root = $this->document->createElement('testsuites'); + $this->document->appendChild($this->root); + + parent::__construct($out); + + $this->reportUselessTests = $reportUselessTests; + } + + /** + * Flush buffer and close output. + */ + public function flush(): void + { + if ($this->writeDocument === true) { + $this->write($this->getXML()); + } + + parent::flush(); + } + + /** + * An error occurred. + * + * @throws \InvalidArgumentException + */ + public function addError(Test $test, \Throwable $t, float $time): void + { + $this->doAddFault($test, $t, $time, 'error'); + $this->testSuiteErrors[$this->testSuiteLevel]++; + } + + /** + * A warning occurred. + * + * @throws \InvalidArgumentException + */ + public function addWarning(Test $test, Warning $e, float $time): void + { + $this->doAddFault($test, $e, $time, 'warning'); + $this->testSuiteFailures[$this->testSuiteLevel]++; + } + + /** + * A failure occurred. + * + * @throws \InvalidArgumentException + */ + public function addFailure(Test $test, AssertionFailedError $e, float $time): void + { + $this->doAddFault($test, $e, $time, 'failure'); + $this->testSuiteFailures[$this->testSuiteLevel]++; + } + + /** + * Incomplete test. + */ + public function addIncompleteTest(Test $test, \Throwable $t, float $time): void + { + $this->doAddSkipped($test); + } + + /** + * Risky test. + */ + public function addRiskyTest(Test $test, \Throwable $t, float $time): void + { + if (!$this->reportUselessTests || $this->currentTestCase === null) { + return; + } + + $error = $this->document->createElement( + 'error', + Xml::prepareString( + "Risky Test\n" . + Filter::getFilteredStacktrace($t) + ) + ); + + $error->setAttribute('type', \get_class($t)); + + $this->currentTestCase->appendChild($error); + + $this->testSuiteErrors[$this->testSuiteLevel]++; + } + + /** + * Skipped test. + */ + public function addSkippedTest(Test $test, \Throwable $t, float $time): void + { + $this->doAddSkipped($test); + } + + /** + * A testsuite started. + */ + public function startTestSuite(TestSuite $suite): void + { + $testSuite = $this->document->createElement('testsuite'); + $testSuite->setAttribute('name', $suite->getName()); + + if (\class_exists($suite->getName(), false)) { + try { + $class = new ReflectionClass($suite->getName()); + + $testSuite->setAttribute('file', $class->getFileName()); + } catch (ReflectionException $e) { + } + } + + if ($this->testSuiteLevel > 0) { + $this->testSuites[$this->testSuiteLevel]->appendChild($testSuite); + } else { + $this->root->appendChild($testSuite); + } + + $this->testSuiteLevel++; + $this->testSuites[$this->testSuiteLevel] = $testSuite; + $this->testSuiteTests[$this->testSuiteLevel] = 0; + $this->testSuiteAssertions[$this->testSuiteLevel] = 0; + $this->testSuiteErrors[$this->testSuiteLevel] = 0; + $this->testSuiteFailures[$this->testSuiteLevel] = 0; + $this->testSuiteSkipped[$this->testSuiteLevel] = 0; + $this->testSuiteTimes[$this->testSuiteLevel] = 0; + } + + /** + * A testsuite ended. + */ + public function endTestSuite(TestSuite $suite): void + { + $this->testSuites[$this->testSuiteLevel]->setAttribute( + 'tests', + $this->testSuiteTests[$this->testSuiteLevel] + ); + + $this->testSuites[$this->testSuiteLevel]->setAttribute( + 'assertions', + $this->testSuiteAssertions[$this->testSuiteLevel] + ); + + $this->testSuites[$this->testSuiteLevel]->setAttribute( + 'errors', + $this->testSuiteErrors[$this->testSuiteLevel] + ); + + $this->testSuites[$this->testSuiteLevel]->setAttribute( + 'failures', + $this->testSuiteFailures[$this->testSuiteLevel] + ); + + $this->testSuites[$this->testSuiteLevel]->setAttribute( + 'skipped', + $this->testSuiteSkipped[$this->testSuiteLevel] + ); + + $this->testSuites[$this->testSuiteLevel]->setAttribute( + 'time', + \sprintf('%F', $this->testSuiteTimes[$this->testSuiteLevel]) + ); + + if ($this->testSuiteLevel > 1) { + $this->testSuiteTests[$this->testSuiteLevel - 1] += $this->testSuiteTests[$this->testSuiteLevel]; + $this->testSuiteAssertions[$this->testSuiteLevel - 1] += $this->testSuiteAssertions[$this->testSuiteLevel]; + $this->testSuiteErrors[$this->testSuiteLevel - 1] += $this->testSuiteErrors[$this->testSuiteLevel]; + $this->testSuiteFailures[$this->testSuiteLevel - 1] += $this->testSuiteFailures[$this->testSuiteLevel]; + $this->testSuiteSkipped[$this->testSuiteLevel - 1] += $this->testSuiteSkipped[$this->testSuiteLevel]; + $this->testSuiteTimes[$this->testSuiteLevel - 1] += $this->testSuiteTimes[$this->testSuiteLevel]; + } + + $this->testSuiteLevel--; + } + + /** + * A test started. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + */ + public function startTest(Test $test): void + { + $usesDataprovider = false; + + if (\method_exists($test, 'usesDataProvider')) { + $usesDataprovider = $test->usesDataProvider(); + } + + $testCase = $this->document->createElement('testcase'); + $testCase->setAttribute('name', $test->getName()); + + $class = new ReflectionClass($test); + $methodName = $test->getName(!$usesDataprovider); + + if ($class->hasMethod($methodName)) { + $method = $class->getMethod($methodName); + + $testCase->setAttribute('class', $class->getName()); + $testCase->setAttribute('classname', \str_replace('\\', '.', $class->getName())); + $testCase->setAttribute('file', $class->getFileName()); + $testCase->setAttribute('line', $method->getStartLine()); + } + + $this->currentTestCase = $testCase; + } + + /** + * A test ended. + */ + public function endTest(Test $test, float $time): void + { + $numAssertions = 0; + + if (\method_exists($test, 'getNumAssertions')) { + $numAssertions = $test->getNumAssertions(); + } + + $this->testSuiteAssertions[$this->testSuiteLevel] += $numAssertions; + + $this->currentTestCase->setAttribute( + 'assertions', + $numAssertions + ); + + $this->currentTestCase->setAttribute( + 'time', + \sprintf('%F', $time) + ); + + $this->testSuites[$this->testSuiteLevel]->appendChild( + $this->currentTestCase + ); + + $this->testSuiteTests[$this->testSuiteLevel]++; + $this->testSuiteTimes[$this->testSuiteLevel] += $time; + + $testOutput = ''; + + if (\method_exists($test, 'hasOutput') && \method_exists($test, 'getActualOutput')) { + $testOutput = $test->hasOutput() ? $test->getActualOutput() : ''; + } + + if (!empty($testOutput)) { + $systemOut = $this->document->createElement( + 'system-out', + Xml::prepareString($testOutput) + ); + + $this->currentTestCase->appendChild($systemOut); + } + + $this->currentTestCase = null; + } + + /** + * Returns the XML as a string. + */ + public function getXML(): string + { + return $this->document->saveXML(); + } + + /** + * Enables or disables the writing of the document + * in flush(). + * + * This is a "hack" needed for the integration of + * PHPUnit with Phing. + */ + public function setWriteDocument(/*bool*/ $flag): void + { + if (\is_bool($flag)) { + $this->writeDocument = $flag; + } + } + + /** + * Method which generalizes addError() and addFailure() + * + * @throws \InvalidArgumentException + */ + private function doAddFault(Test $test, \Throwable $t, float $time, $type): void + { + if ($this->currentTestCase === null) { + return; + } + + if ($test instanceof SelfDescribing) { + $buffer = $test->toString() . "\n"; + } else { + $buffer = ''; + } + + $buffer .= TestFailure::exceptionToString($t) . "\n" . + Filter::getFilteredStacktrace($t); + + $fault = $this->document->createElement( + $type, + Xml::prepareString($buffer) + ); + + if ($t instanceof ExceptionWrapper) { + $fault->setAttribute('type', $t->getClassName()); + } else { + $fault->setAttribute('type', \get_class($t)); + } + + $this->currentTestCase->appendChild($fault); + } + + private function doAddSkipped(Test $test): void + { + if ($this->currentTestCase === null) { + return; + } + + $skipped = $this->document->createElement('skipped'); + $this->currentTestCase->appendChild($skipped); + + $this->testSuiteSkipped[$this->testSuiteLevel]++; + } +} diff --git a/vendor/phpunit/phpunit/src/Util/Log/TeamCity.php b/vendor/phpunit/phpunit/src/Util/Log/TeamCity.php new file mode 100644 index 0000000..4e8f446 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/Log/TeamCity.php @@ -0,0 +1,391 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\Log; + +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\ExceptionWrapper; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestFailure; +use PHPUnit\Framework\TestResult; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Framework\Warning; +use PHPUnit\TextUI\ResultPrinter; +use PHPUnit\Util\Filter; +use ReflectionClass; +use SebastianBergmann\Comparator\ComparisonFailure; + +/** + * A TestListener that generates a logfile of the test execution using the + * TeamCity format (for use with PhpStorm, for instance). + */ +class TeamCity extends ResultPrinter +{ + /** + * @var bool + */ + private $isSummaryTestCountPrinted = false; + + /** + * @var string + */ + private $startedTestName; + + /** + * @var false|int + */ + private $flowId; + + public function printResult(TestResult $result): void + { + $this->printHeader(); + $this->printFooter($result); + } + + /** + * An error occurred. + * + * @throws \InvalidArgumentException + */ + public function addError(Test $test, \Throwable $t, float $time): void + { + $this->printEvent( + 'testFailed', + [ + 'name' => $test->getName(), + 'message' => self::getMessage($t), + 'details' => self::getDetails($t), + 'duration' => self::toMilliseconds($time), + ] + ); + } + + /** + * A warning occurred. + * + * @throws \InvalidArgumentException + */ + public function addWarning(Test $test, Warning $e, float $time): void + { + $this->printEvent( + 'testFailed', + [ + 'name' => $test->getName(), + 'message' => self::getMessage($e), + 'details' => self::getDetails($e), + 'duration' => self::toMilliseconds($time), + ] + ); + } + + /** + * A failure occurred. + * + * @throws \InvalidArgumentException + */ + public function addFailure(Test $test, AssertionFailedError $e, float $time): void + { + $parameters = [ + 'name' => $test->getName(), + 'message' => self::getMessage($e), + 'details' => self::getDetails($e), + 'duration' => self::toMilliseconds($time), + ]; + + if ($e instanceof ExpectationFailedException) { + $comparisonFailure = $e->getComparisonFailure(); + + if ($comparisonFailure instanceof ComparisonFailure) { + $expectedString = $comparisonFailure->getExpectedAsString(); + + if ($expectedString === null || empty($expectedString)) { + $expectedString = self::getPrimitiveValueAsString($comparisonFailure->getExpected()); + } + + $actualString = $comparisonFailure->getActualAsString(); + + if ($actualString === null || empty($actualString)) { + $actualString = self::getPrimitiveValueAsString($comparisonFailure->getActual()); + } + + if ($actualString !== null && $expectedString !== null) { + $parameters['type'] = 'comparisonFailure'; + $parameters['actual'] = $actualString; + $parameters['expected'] = $expectedString; + } + } + } + + $this->printEvent('testFailed', $parameters); + } + + /** + * Incomplete test. + */ + public function addIncompleteTest(Test $test, \Throwable $t, float $time): void + { + $this->printIgnoredTest($test->getName(), $t, $time); + } + + /** + * Risky test. + * + * @throws \InvalidArgumentException + */ + public function addRiskyTest(Test $test, \Throwable $t, float $time): void + { + $this->addError($test, $t, $time); + } + + /** + * Skipped test. + * + * @throws \ReflectionException + */ + public function addSkippedTest(Test $test, \Throwable $t, float $time): void + { + $testName = $test->getName(); + + if ($this->startedTestName !== $testName) { + $this->startTest($test); + $this->printIgnoredTest($testName, $t, $time); + $this->endTest($test, $time); + } else { + $this->printIgnoredTest($testName, $t, $time); + } + } + + public function printIgnoredTest($testName, \Throwable $t, float $time): void + { + $this->printEvent( + 'testIgnored', + [ + 'name' => $testName, + 'message' => self::getMessage($t), + 'details' => self::getDetails($t), + 'duration' => self::toMilliseconds($time), + ] + ); + } + + /** + * A testsuite started. + * + * @throws \ReflectionException + */ + public function startTestSuite(TestSuite $suite): void + { + if (\stripos(\ini_get('disable_functions'), 'getmypid') === false) { + $this->flowId = \getmypid(); + } else { + $this->flowId = false; + } + + if (!$this->isSummaryTestCountPrinted) { + $this->isSummaryTestCountPrinted = true; + + $this->printEvent( + 'testCount', + ['count' => \count($suite)] + ); + } + + $suiteName = $suite->getName(); + + if (empty($suiteName)) { + return; + } + + $parameters = ['name' => $suiteName]; + + if (\class_exists($suiteName, false)) { + $fileName = self::getFileName($suiteName); + $parameters['locationHint'] = "php_qn://$fileName::\\$suiteName"; + } else { + $split = \explode('::', $suiteName); + + if (\count($split) === 2 && \method_exists($split[0], $split[1])) { + $fileName = self::getFileName($split[0]); + $parameters['locationHint'] = "php_qn://$fileName::\\$suiteName"; + $parameters['name'] = $split[1]; + } + } + + $this->printEvent('testSuiteStarted', $parameters); + } + + /** + * A testsuite ended. + */ + public function endTestSuite(TestSuite $suite): void + { + $suiteName = $suite->getName(); + + if (empty($suiteName)) { + return; + } + + $parameters = ['name' => $suiteName]; + + if (!\class_exists($suiteName, false)) { + $split = \explode('::', $suiteName); + + if (\count($split) === 2 && \method_exists($split[0], $split[1])) { + $parameters['name'] = $split[1]; + } + } + + $this->printEvent('testSuiteFinished', $parameters); + } + + /** + * A test started. + * + * @throws \ReflectionException + */ + public function startTest(Test $test): void + { + $testName = $test->getName(); + $this->startedTestName = $testName; + $params = ['name' => $testName]; + + if ($test instanceof TestCase) { + $className = \get_class($test); + $fileName = self::getFileName($className); + $params['locationHint'] = "php_qn://$fileName::\\$className::$testName"; + } + + $this->printEvent('testStarted', $params); + } + + /** + * A test ended. + */ + public function endTest(Test $test, float $time): void + { + parent::endTest($test, $time); + + $this->printEvent( + 'testFinished', + [ + 'name' => $test->getName(), + 'duration' => self::toMilliseconds($time), + ] + ); + } + + protected function writeProgress(string $progress): void + { + } + + /** + * @param string $eventName + * @param array $params + */ + private function printEvent($eventName, $params = []): void + { + $this->write("\n##teamcity[$eventName"); + + if ($this->flowId) { + $params['flowId'] = $this->flowId; + } + + foreach ($params as $key => $value) { + $escapedValue = self::escapeValue($value); + $this->write(" $key='$escapedValue'"); + } + + $this->write("]\n"); + } + + private static function getMessage(\Throwable $t): string + { + $message = ''; + + if ($t instanceof ExceptionWrapper) { + if ($t->getClassName() !== '') { + $message .= $t->getClassName(); + } + + if ($message !== '' && $t->getMessage() !== '') { + $message .= ' : '; + } + } + + return $message . $t->getMessage(); + } + + /** + * @throws \InvalidArgumentException + */ + private static function getDetails(\Throwable $t): string + { + $stackTrace = Filter::getFilteredStacktrace($t); + $previous = $t instanceof ExceptionWrapper ? $t->getPreviousWrapped() : $t->getPrevious(); + + while ($previous) { + $stackTrace .= "\nCaused by\n" . + TestFailure::exceptionToString($previous) . "\n" . + Filter::getFilteredStacktrace($previous); + + $previous = $previous instanceof ExceptionWrapper ? + $previous->getPreviousWrapped() : $previous->getPrevious(); + } + + return ' ' . \str_replace("\n", "\n ", $stackTrace); + } + + private static function getPrimitiveValueAsString($value): ?string + { + if ($value === null) { + return 'null'; + } + + if (\is_bool($value)) { + return $value === true ? 'true' : 'false'; + } + + if (\is_scalar($value)) { + return \print_r($value, true); + } + + return null; + } + + private static function escapeValue(string $text): string + { + return \str_replace( + ['|', "'", "\n", "\r", ']', '['], + ['||', "|'", '|n', '|r', '|]', '|['], + $text + ); + } + + /** + * @param string $className + * + * @throws \ReflectionException + */ + private static function getFileName($className): string + { + $reflectionClass = new ReflectionClass($className); + + return $reflectionClass->getFileName(); + } + + /** + * @param float $time microseconds + */ + private static function toMilliseconds(float $time): int + { + return \round($time * 1000); + } +} diff --git a/vendor/phpunit/phpunit/src/Util/NullTestResultCache.php b/vendor/phpunit/phpunit/src/Util/NullTestResultCache.php new file mode 100644 index 0000000..fd63a6d --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/NullTestResultCache.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Runner; + +class NullTestResultCache implements TestResultCacheInterface +{ + public function getState($testName): int + { + return BaseTestRunner::STATUS_UNKNOWN; + } + + public function getTime($testName): float + { + return 0; + } + + public function load(): void + { + } + + public function persist(): void + { + } +} diff --git a/vendor/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php b/vendor/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php new file mode 100644 index 0000000..fba0b96 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php @@ -0,0 +1,368 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\PHP; + +use __PHP_Incomplete_Class; +use ErrorException; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\SyntheticError; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestFailure; +use PHPUnit\Framework\TestResult; +use SebastianBergmann\Environment\Runtime; + +/** + * Utility methods for PHP sub-processes. + */ +abstract class AbstractPhpProcess +{ + /** + * @var Runtime + */ + protected $runtime; + + /** + * @var bool + */ + protected $stderrRedirection = false; + + /** + * @var string + */ + protected $stdin = ''; + + /** + * @var string + */ + protected $args = ''; + + /** + * @var array + */ + protected $env = []; + + /** + * @var int + */ + protected $timeout = 0; + + public static function factory(): self + { + if (\DIRECTORY_SEPARATOR === '\\') { + return new WindowsPhpProcess; + } + + return new DefaultPhpProcess; + } + + public function __construct() + { + $this->runtime = new Runtime; + } + + /** + * Defines if should use STDERR redirection or not. + * + * Then $stderrRedirection is TRUE, STDERR is redirected to STDOUT. + */ + public function setUseStderrRedirection(bool $stderrRedirection): void + { + $this->stderrRedirection = $stderrRedirection; + } + + /** + * Returns TRUE if uses STDERR redirection or FALSE if not. + */ + public function useStderrRedirection(): bool + { + return $this->stderrRedirection; + } + + /** + * Sets the input string to be sent via STDIN + */ + public function setStdin(string $stdin): void + { + $this->stdin = $stdin; + } + + /** + * Returns the input string to be sent via STDIN + */ + public function getStdin(): string + { + return $this->stdin; + } + + /** + * Sets the string of arguments to pass to the php job + */ + public function setArgs(string $args): void + { + $this->args = $args; + } + + /** + * Returns the string of arguments to pass to the php job + */ + public function getArgs(): string + { + return $this->args; + } + + /** + * Sets the array of environment variables to start the child process with + * + * @param array $env + */ + public function setEnv(array $env): void + { + $this->env = $env; + } + + /** + * Returns the array of environment variables to start the child process with + */ + public function getEnv(): array + { + return $this->env; + } + + /** + * Sets the amount of seconds to wait before timing out + */ + public function setTimeout(int $timeout): void + { + $this->timeout = $timeout; + } + + /** + * Returns the amount of seconds to wait before timing out + */ + public function getTimeout(): int + { + return $this->timeout; + } + + /** + * Runs a single test in a separate PHP process. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public function runTestJob(string $job, Test $test, TestResult $result): void + { + $result->startTest($test); + + $_result = $this->runJob($job); + + $this->processChildResult( + $test, + $result, + $_result['stdout'], + $_result['stderr'] + ); + } + + /** + * Returns the command based into the configurations. + */ + public function getCommand(array $settings, string $file = null): string + { + $command = $this->runtime->getBinary(); + $command .= $this->settingsToParameters($settings); + + if (\PHP_SAPI === 'phpdbg') { + $command .= ' -qrr'; + + if (!$file) { + $command .= 's='; + } + } + + if ($file) { + $command .= ' ' . \escapeshellarg($file); + } + + if ($this->args) { + if (!$file) { + $command .= ' --'; + } + $command .= ' ' . $this->args; + } + + if ($this->stderrRedirection === true) { + $command .= ' 2>&1'; + } + + return $command; + } + + /** + * Runs a single job (PHP code) using a separate PHP process. + */ + abstract public function runJob(string $job, array $settings = []): array; + + protected function settingsToParameters(array $settings): string + { + $buffer = ''; + + foreach ($settings as $setting) { + $buffer .= ' -d ' . \escapeshellarg($setting); + } + + return $buffer; + } + + /** + * Processes the TestResult object from an isolated process. + * + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + private function processChildResult(Test $test, TestResult $result, string $stdout, string $stderr): void + { + $time = 0; + + if (!empty($stderr)) { + $result->addError( + $test, + new Exception(\trim($stderr)), + $time + ); + } else { + \set_error_handler(function ($errno, $errstr, $errfile, $errline): void { + throw new ErrorException($errstr, $errno, $errno, $errfile, $errline); + }); + + try { + if (\strpos($stdout, "#!/usr/bin/env php\n") === 0) { + $stdout = \substr($stdout, 19); + } + + $childResult = \unserialize(\str_replace("#!/usr/bin/env php\n", '', $stdout)); + \restore_error_handler(); + } catch (ErrorException $e) { + \restore_error_handler(); + $childResult = false; + + $result->addError( + $test, + new Exception(\trim($stdout), 0, $e), + $time + ); + } + + if ($childResult !== false) { + if (!empty($childResult['output'])) { + $output = $childResult['output']; + } + + /* @var TestCase $test */ + + $test->setResult($childResult['testResult']); + $test->addToAssertionCount($childResult['numAssertions']); + + /** @var TestResult $childResult */ + $childResult = $childResult['result']; + + if ($result->getCollectCodeCoverageInformation()) { + $result->getCodeCoverage()->merge( + $childResult->getCodeCoverage() + ); + } + + $time = $childResult->time(); + $notImplemented = $childResult->notImplemented(); + $risky = $childResult->risky(); + $skipped = $childResult->skipped(); + $errors = $childResult->errors(); + $warnings = $childResult->warnings(); + $failures = $childResult->failures(); + + if (!empty($notImplemented)) { + $result->addError( + $test, + $this->getException($notImplemented[0]), + $time + ); + } elseif (!empty($risky)) { + $result->addError( + $test, + $this->getException($risky[0]), + $time + ); + } elseif (!empty($skipped)) { + $result->addError( + $test, + $this->getException($skipped[0]), + $time + ); + } elseif (!empty($errors)) { + $result->addError( + $test, + $this->getException($errors[0]), + $time + ); + } elseif (!empty($warnings)) { + $result->addWarning( + $test, + $this->getException($warnings[0]), + $time + ); + } elseif (!empty($failures)) { + $result->addFailure( + $test, + $this->getException($failures[0]), + $time + ); + } + } + } + + $result->endTest($test, $time); + + if (!empty($output)) { + print $output; + } + } + + /** + * Gets the thrown exception from a PHPUnit\Framework\TestFailure. + * + * @see https://github.com/sebastianbergmann/phpunit/issues/74 + */ + private function getException(TestFailure $error): Exception + { + $exception = $error->thrownException(); + + if ($exception instanceof __PHP_Incomplete_Class) { + $exceptionArray = []; + + foreach ((array) $exception as $key => $value) { + $key = \substr($key, \strrpos($key, "\0") + 1); + $exceptionArray[$key] = $value; + } + + $exception = new SyntheticError( + \sprintf( + '%s: %s', + $exceptionArray['_PHP_Incomplete_Class_Name'], + $exceptionArray['message'] + ), + $exceptionArray['code'], + $exceptionArray['file'], + $exceptionArray['line'], + $exceptionArray['trace'] + ); + } + + return $exception; + } +} diff --git a/vendor/phpunit/phpunit/src/Util/PHP/DefaultPhpProcess.php b/vendor/phpunit/phpunit/src/Util/PHP/DefaultPhpProcess.php new file mode 100644 index 0000000..396d7d7 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/PHP/DefaultPhpProcess.php @@ -0,0 +1,218 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\PHP; + +use PHPUnit\Framework\Exception; + +/** + * Default utility for PHP sub-processes. + */ +class DefaultPhpProcess extends AbstractPhpProcess +{ + /** + * @var string + */ + protected $tempFile; + + /** + * Runs a single job (PHP code) using a separate PHP process. + * + * @throws Exception + */ + public function runJob(string $job, array $settings = []): array + { + if ($this->useTemporaryFile() || $this->stdin) { + if (!($this->tempFile = \tempnam(\sys_get_temp_dir(), 'PHPUnit')) || + \file_put_contents($this->tempFile, $job) === false) { + throw new Exception( + 'Unable to write temporary file' + ); + } + + $job = $this->stdin; + } + + return $this->runProcess($job, $settings); + } + + /** + * Returns an array of file handles to be used in place of pipes + */ + protected function getHandles(): array + { + return []; + } + + /** + * Handles creating the child process and returning the STDOUT and STDERR + * + * @throws Exception + */ + protected function runProcess(string $job, array $settings): array + { + $handles = $this->getHandles(); + + $env = null; + + if ($this->env) { + $env = $_SERVER ?? []; + unset($env['argv'], $env['argc']); + $env = \array_merge($env, $this->env); + + foreach ($env as $envKey => $envVar) { + if (\is_array($envVar)) { + unset($env[$envKey]); + } + } + } + + $pipeSpec = [ + 0 => $handles[0] ?? ['pipe', 'r'], + 1 => $handles[1] ?? ['pipe', 'w'], + 2 => $handles[2] ?? ['pipe', 'w'], + ]; + + $process = \proc_open( + $this->getCommand($settings, $this->tempFile), + $pipeSpec, + $pipes, + null, + $env + ); + + if (!\is_resource($process)) { + throw new Exception( + 'Unable to spawn worker process' + ); + } + + if ($job) { + $this->process($pipes[0], $job); + } + + \fclose($pipes[0]); + + $stderr = $stdout = ''; + + if ($this->timeout) { + unset($pipes[0]); + + while (true) { + $r = $pipes; + $w = null; + $e = null; + + $n = @\stream_select($r, $w, $e, $this->timeout); + + if ($n === false) { + break; + } + + if ($n === 0) { + \proc_terminate($process, 9); + + throw new Exception( + \sprintf( + 'Job execution aborted after %d seconds', + $this->timeout + ) + ); + } + + if ($n > 0) { + foreach ($r as $pipe) { + $pipeOffset = 0; + + foreach ($pipes as $i => $origPipe) { + if ($pipe === $origPipe) { + $pipeOffset = $i; + + break; + } + } + + if (!$pipeOffset) { + break; + } + + $line = \fread($pipe, 8192); + + if ($line === '') { + \fclose($pipes[$pipeOffset]); + + unset($pipes[$pipeOffset]); + } else { + if ($pipeOffset === 1) { + $stdout .= $line; + } else { + $stderr .= $line; + } + } + } + + if (empty($pipes)) { + break; + } + } + } + } else { + if (isset($pipes[1])) { + $stdout = \stream_get_contents($pipes[1]); + + \fclose($pipes[1]); + } + + if (isset($pipes[2])) { + $stderr = \stream_get_contents($pipes[2]); + + \fclose($pipes[2]); + } + } + + if (isset($handles[1])) { + \rewind($handles[1]); + + $stdout = \stream_get_contents($handles[1]); + + \fclose($handles[1]); + } + + if (isset($handles[2])) { + \rewind($handles[2]); + + $stderr = \stream_get_contents($handles[2]); + + \fclose($handles[2]); + } + + \proc_close($process); + + $this->cleanup(); + + return ['stdout' => $stdout, 'stderr' => $stderr]; + } + + protected function process($pipe, string $job): void + { + \fwrite($pipe, $job); + } + + protected function cleanup(): void + { + if ($this->tempFile) { + \unlink($this->tempFile); + } + } + + protected function useTemporaryFile(): bool + { + return false; + } +} diff --git a/vendor/phpunit/phpunit/src/Util/PHP/Template/PhptTestCase.tpl.dist b/vendor/phpunit/phpunit/src/Util/PHP/Template/PhptTestCase.tpl.dist new file mode 100644 index 0000000..14c3e7e --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/PHP/Template/PhptTestCase.tpl.dist @@ -0,0 +1,40 @@ +start(__FILE__); +} + +register_shutdown_function(function() use ($coverage) { + $output = null; + if ($coverage) { + $output = $coverage->stop(); + } + file_put_contents('{coverageFile}', serialize($output)); +}); + +ob_end_clean(); + +require '{job}'; diff --git a/vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseClass.tpl.dist b/vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseClass.tpl.dist new file mode 100644 index 0000000..75ceda3 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseClass.tpl.dist @@ -0,0 +1,108 @@ +setCodeCoverage( + new CodeCoverage( + null, + unserialize('{codeCoverageFilter}') + ) + ); + } + + $result->beStrictAboutTestsThatDoNotTestAnything({isStrictAboutTestsThatDoNotTestAnything}); + $result->beStrictAboutOutputDuringTests({isStrictAboutOutputDuringTests}); + $result->enforceTimeLimit({enforcesTimeLimit}); + $result->beStrictAboutTodoAnnotatedTests({isStrictAboutTodoAnnotatedTests}); + $result->beStrictAboutResourceUsageDuringSmallTests({isStrictAboutResourceUsageDuringSmallTests}); + + $test = new {className}('{name}', unserialize('{data}'), '{dataName}'); + $test->setDependencyInput(unserialize('{dependencyInput}')); + $test->setInIsolation(TRUE); + + ob_end_clean(); + $test->run($result); + $output = ''; + if (!$test->hasExpectationOnOutput()) { + $output = $test->getActualOutput(); + } + + ini_set('xdebug.scream', 0); + @rewind(STDOUT); /* @ as not every STDOUT target stream is rewindable */ + if ($stdout = stream_get_contents(STDOUT)) { + $output = $stdout . $output; + $streamMetaData = stream_get_meta_data(STDOUT); + if (!empty($streamMetaData['stream_type']) && 'STDIO' === $streamMetaData['stream_type']) { + @ftruncate(STDOUT, 0); + @rewind(STDOUT); + } + } + + print serialize( + [ + 'testResult' => $test->getResult(), + 'numAssertions' => $test->getNumAssertions(), + 'result' => $result, + 'output' => $output + ] + ); +} + +$configurationFilePath = '{configurationFilePath}'; + +if ('' !== $configurationFilePath) { + $configuration = PHPUnit\Util\Configuration::getInstance($configurationFilePath); + $configuration->handlePHPConfiguration(); + unset($configuration); +} + +function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext) +{ + return true; +} + +set_error_handler('__phpunit_error_handler'); + +{constants} +{included_files} +{globals} + +restore_error_handler(); + +if (isset($GLOBALS['__PHPUNIT_BOOTSTRAP'])) { + require_once $GLOBALS['__PHPUNIT_BOOTSTRAP']; + unset($GLOBALS['__PHPUNIT_BOOTSTRAP']); +} + +__phpunit_run_isolated_test(); diff --git a/vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseMethod.tpl.dist b/vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseMethod.tpl.dist new file mode 100644 index 0000000..b39938d --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseMethod.tpl.dist @@ -0,0 +1,110 @@ +setCodeCoverage( + new CodeCoverage( + null, + unserialize('{codeCoverageFilter}') + ) + ); + } + + $result->beStrictAboutTestsThatDoNotTestAnything({isStrictAboutTestsThatDoNotTestAnything}); + $result->beStrictAboutOutputDuringTests({isStrictAboutOutputDuringTests}); + $result->enforceTimeLimit({enforcesTimeLimit}); + $result->beStrictAboutTodoAnnotatedTests({isStrictAboutTodoAnnotatedTests}); + $result->beStrictAboutResourceUsageDuringSmallTests({isStrictAboutResourceUsageDuringSmallTests}); + + /** @var TestCase $test */ + $test = new {className}('{methodName}', unserialize('{data}'), '{dataName}'); + $test->setDependencyInput(unserialize('{dependencyInput}')); + $test->setInIsolation(TRUE); + + ob_end_clean(); + $test->run($result); + $output = ''; + if (!$test->hasExpectationOnOutput()) { + $output = $test->getActualOutput(); + } + + ini_set('xdebug.scream', '0'); + @rewind(STDOUT); /* @ as not every STDOUT target stream is rewindable */ + if ($stdout = stream_get_contents(STDOUT)) { + $output = $stdout . $output; + $streamMetaData = stream_get_meta_data(STDOUT); + if (!empty($streamMetaData['stream_type']) && 'STDIO' === $streamMetaData['stream_type']) { + @ftruncate(STDOUT, 0); + @rewind(STDOUT); + } + } + + print serialize( + [ + 'testResult' => $test->getResult(), + 'numAssertions' => $test->getNumAssertions(), + 'result' => $result, + 'output' => $output + ] + ); +} + +$configurationFilePath = '{configurationFilePath}'; + +if ('' !== $configurationFilePath) { + $configuration = PHPUnit\Util\Configuration::getInstance($configurationFilePath); + $configuration->handlePHPConfiguration(); + unset($configuration); +} + +function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext) +{ + return true; +} + +set_error_handler('__phpunit_error_handler'); + +{constants} +{included_files} +{globals} + +restore_error_handler(); + +if (isset($GLOBALS['__PHPUNIT_BOOTSTRAP'])) { + require_once $GLOBALS['__PHPUNIT_BOOTSTRAP']; + unset($GLOBALS['__PHPUNIT_BOOTSTRAP']); +} + +__phpunit_run_isolated_test(); diff --git a/vendor/phpunit/phpunit/src/Util/PHP/WindowsPhpProcess.php b/vendor/phpunit/phpunit/src/Util/PHP/WindowsPhpProcess.php new file mode 100644 index 0000000..46fffa3 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/PHP/WindowsPhpProcess.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\PHP; + +use PHPUnit\Framework\Exception; + +/** + * Windows utility for PHP sub-processes. + * + * Reading from STDOUT or STDERR hangs forever on Windows if the output is + * too large. + * + * @see https://bugs.php.net/bug.php?id=51800 + */ +class WindowsPhpProcess extends DefaultPhpProcess +{ + public function getCommand(array $settings, string $file = null): string + { + return '"' . parent::getCommand($settings, $file) . '"'; + } + + protected function getHandles(): array + { + if (false === $stdout_handle = \tmpfile()) { + throw new Exception( + 'A temporary file could not be created; verify that your TEMP environment variable is writable' + ); + } + + return [ + 1 => $stdout_handle, + ]; + } + + protected function useTemporaryFile(): bool + { + return true; + } +} diff --git a/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php b/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php new file mode 100644 index 0000000..37de8ed --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php @@ -0,0 +1,10 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +eval('?>' . \file_get_contents('php://stdin')); diff --git a/vendor/phpunit/phpunit/src/Util/Printer.php b/vendor/phpunit/phpunit/src/Util/Printer.php new file mode 100644 index 0000000..505bce6 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/Printer.php @@ -0,0 +1,140 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use PHPUnit\Framework\Exception; + +/** + * Utility class that can print to STDOUT or write to a file. + */ +class Printer +{ + /** + * If true, flush output after every write. + * + * @var bool + */ + protected $autoFlush = false; + + /** + * @var resource + */ + protected $out; + + /** + * @var string + */ + protected $outTarget; + + /** + * Constructor. + * + * @param null|mixed $out + * + * @throws Exception + */ + public function __construct($out = null) + { + if ($out !== null) { + if (\is_string($out)) { + if (\strpos($out, 'socket://') === 0) { + $out = \explode(':', \str_replace('socket://', '', $out)); + + if (\count($out) !== 2) { + throw new Exception; + } + + $this->out = \fsockopen($out[0], $out[1]); + } else { + if (\strpos($out, 'php://') === false && !$this->createDirectory(\dirname($out))) { + throw new Exception(\sprintf('Directory "%s" was not created', \dirname($out))); + } + + $this->out = \fopen($out, 'wt'); + } + + $this->outTarget = $out; + } else { + $this->out = $out; + } + } + } + + /** + * Flush buffer and close output if it's not to a PHP stream + */ + public function flush(): void + { + if ($this->out && \strncmp($this->outTarget, 'php://', 6) !== 0) { + \fclose($this->out); + } + } + + /** + * Performs a safe, incremental flush. + * + * Do not confuse this function with the flush() function of this class, + * since the flush() function may close the file being written to, rendering + * the current object no longer usable. + */ + public function incrementalFlush(): void + { + if ($this->out) { + \fflush($this->out); + } else { + \flush(); + } + } + + public function write(string $buffer): void + { + if ($this->out) { + \fwrite($this->out, $buffer); + + if ($this->autoFlush) { + $this->incrementalFlush(); + } + } else { + if (\PHP_SAPI !== 'cli' && \PHP_SAPI !== 'phpdbg') { + $buffer = \htmlspecialchars($buffer, \ENT_SUBSTITUTE); + } + + print $buffer; + + if ($this->autoFlush) { + $this->incrementalFlush(); + } + } + } + + /** + * Check auto-flush mode. + */ + public function getAutoFlush(): bool + { + return $this->autoFlush; + } + + /** + * Set auto-flushing mode. + * + * If set, *incremental* flushes will be done after each write. This should + * not be confused with the different effects of this class' flush() method. + */ + public function setAutoFlush(bool $autoFlush): void + { + $this->autoFlush = $autoFlush; + } + + private function createDirectory(string $directory): bool + { + return !(!\is_dir($directory) && !@\mkdir($directory, 0777, true) && !\is_dir($directory)); + } +} diff --git a/vendor/phpunit/phpunit/src/Util/RegularExpression.php b/vendor/phpunit/phpunit/src/Util/RegularExpression.php new file mode 100644 index 0000000..2f7baa7 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/RegularExpression.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +final class RegularExpression +{ + /** + * @throws \Exception + * + * @return false|int + */ + public static function safeMatch(string $pattern, string $subject, ?array $matches = null, int $flags = 0, int $offset = 0) + { + $handler_terminator = ErrorHandler::handleErrorOnce(); + $match = \preg_match($pattern, $subject, $matches, $flags, $offset); + $handler_terminator(); + + return $match; + } +} diff --git a/vendor/phpunit/phpunit/src/Util/Test.php b/vendor/phpunit/phpunit/src/Util/Test.php new file mode 100644 index 0000000..9b853f9 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/Test.php @@ -0,0 +1,1121 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util; + +use PharIo\Version\VersionConstraintParser; +use PHPUnit\Framework\Assert; +use PHPUnit\Framework\CodeCoverageException; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\InvalidCoversTargetException; +use PHPUnit\Framework\SelfDescribing; +use PHPUnit\Framework\SkippedTestError; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Warning; +use PHPUnit\Runner\Version; +use ReflectionClass; +use ReflectionException; +use ReflectionFunction; +use ReflectionMethod; +use SebastianBergmann\Environment\OperatingSystem; +use Traversable; + +final class Test +{ + /** + * @var int + */ + public const UNKNOWN = -1; + + /** + * @var int + */ + public const SMALL = 0; + + /** + * @var int + */ + public const MEDIUM = 1; + + /** + * @var int + */ + public const LARGE = 2; + + /** + * @var string + * + * @todo This constant should be private (it's public because of TestTest::testGetProvidedDataRegEx) + */ + public const REGEX_DATA_PROVIDER = '/@dataProvider\s+([a-zA-Z0-9._:-\\\\x7f-\xff]+)/'; + + /** + * @var string + */ + private const REGEX_TEST_WITH = '/@testWith\s+/'; + + /** + * @var string + */ + private const REGEX_EXPECTED_EXCEPTION = '(@expectedException\s+([:.\w\\\\x7f-\xff]+)(?:[\t ]+(\S*))?(?:[\t ]+(\S*))?\s*$)m'; + + /** + * @var string + */ + private const REGEX_REQUIRES_VERSION = '/@requires\s+(?PPHP(?:Unit)?)\s+(?P[<>=!]{0,2})\s*(?P[\d\.-]+(dev|(RC|alpha|beta)[\d\.])?)[ \t]*\r?$/m'; + + /** + * @var string + */ + private const REGEX_REQUIRES_VERSION_CONSTRAINT = '/@requires\s+(?PPHP(?:Unit)?)\s+(?P[\d\t -.|~^]+)[ \t]*\r?$/m'; + + /** + * @var string + */ + private const REGEX_REQUIRES_OS = '/@requires\s+(?POS(?:FAMILY)?)\s+(?P.+?)[ \t]*\r?$/m'; + + /** + * @var string + */ + private const REGEX_REQUIRES_SETTING = '/@requires\s+(?Psetting)\s+(?P([^ ]+?))\s*(?P[\w\.-]+[\w\.]?)?[ \t]*\r?$/m'; + + /** + * @var string + */ + private const REGEX_REQUIRES = '/@requires\s+(?Pfunction|extension)\s+(?P([^ ]+?))\s*(?P[<>=!]{0,2})\s*(?P[\d\.-]+[\d\.]?)?[ \t]*\r?$/m'; + + /** + * @var array + */ + private static $annotationCache = []; + + /** + * @var array + */ + private static $hookMethods = []; + + public static function describe(\PHPUnit\Framework\Test $test): array + { + if ($test instanceof TestCase) { + return [\get_class($test), $test->getName()]; + } + + if ($test instanceof SelfDescribing) { + return ['', $test->toString()]; + } + + return ['', \get_class($test)]; + } + + public static function describeAsString(\PHPUnit\Framework\Test $test): string + { + if ($test instanceof SelfDescribing) { + return $test->toString(); + } + + return \get_class($test); + } + + /** + * @throws CodeCoverageException + * + * @return array|bool + */ + public static function getLinesToBeCovered(string $className, string $methodName) + { + $annotations = self::parseTestMethodAnnotations( + $className, + $methodName + ); + + if (self::shouldCoversAnnotationBeUsed($annotations) === false) { + return false; + } + + return self::getLinesToBeCoveredOrUsed($className, $methodName, 'covers'); + } + + /** + * Returns lines of code specified with the @uses annotation. + * + * @throws CodeCoverageException + */ + public static function getLinesToBeUsed(string $className, string $methodName): array + { + return self::getLinesToBeCoveredOrUsed($className, $methodName, 'uses'); + } + + /** + * Returns the requirements for a test. + * + * @throws Warning + */ + public static function getRequirements(string $className, string $methodName): array + { + $reflector = new ReflectionClass($className); + $docComment = $reflector->getDocComment(); + $reflector = new ReflectionMethod($className, $methodName); + $docComment .= "\n" . $reflector->getDocComment(); + $requires = []; + + if ($count = \preg_match_all(self::REGEX_REQUIRES_OS, $docComment, $matches)) { + foreach (\range(0, $count - 1) as $i) { + $requires[$matches['name'][$i]] = $matches['value'][$i]; + } + } + + if ($count = \preg_match_all(self::REGEX_REQUIRES_VERSION, $docComment, $matches)) { + foreach (\range(0, $count - 1) as $i) { + $requires[$matches['name'][$i]] = [ + 'version' => $matches['version'][$i], + 'operator' => $matches['operator'][$i], + ]; + } + } + + if ($count = \preg_match_all(self::REGEX_REQUIRES_VERSION_CONSTRAINT, $docComment, $matches)) { + foreach (\range(0, $count - 1) as $i) { + if (!empty($requires[$matches['name'][$i]])) { + continue; + } + + try { + $versionConstraintParser = new VersionConstraintParser; + + $requires[$matches['name'][$i] . '_constraint'] = [ + 'constraint' => $versionConstraintParser->parse(\trim($matches['constraint'][$i])), + ]; + } catch (\PharIo\Version\Exception $e) { + throw new Warning($e->getMessage(), $e->getCode(), $e); + } + } + } + + if ($count = \preg_match_all(self::REGEX_REQUIRES_SETTING, $docComment, $matches)) { + $requires['setting'] = []; + + foreach (\range(0, $count - 1) as $i) { + $requires['setting'][$matches['setting'][$i]] = $matches['value'][$i]; + } + } + + if ($count = \preg_match_all(self::REGEX_REQUIRES, $docComment, $matches)) { + foreach (\range(0, $count - 1) as $i) { + $name = $matches['name'][$i] . 's'; + + if (!isset($requires[$name])) { + $requires[$name] = []; + } + + $requires[$name][] = $matches['value'][$i]; + + if ($name !== 'extensions' || empty($matches['version'][$i])) { + continue; + } + + $requires['extension_versions'][$matches['value'][$i]] = [ + 'version' => $matches['version'][$i], + 'operator' => $matches['operator'][$i], + ]; + } + } + + return $requires; + } + + /** + * Returns the missing requirements for a test. + * + * @throws Warning + * + * @return string[] + */ + public static function getMissingRequirements(string $className, string $methodName): array + { + $required = static::getRequirements($className, $methodName); + $missing = []; + + if (!empty($required['PHP'])) { + $operator = empty($required['PHP']['operator']) ? '>=' : $required['PHP']['operator']; + + if (!\version_compare(\PHP_VERSION, $required['PHP']['version'], $operator)) { + $missing[] = \sprintf('PHP %s %s is required.', $operator, $required['PHP']['version']); + } + } elseif (!empty($required['PHP_constraint'])) { + $version = new \PharIo\Version\Version(self::sanitizeVersionNumber(\PHP_VERSION)); + + if (!$required['PHP_constraint']['constraint']->complies($version)) { + $missing[] = \sprintf( + 'PHP version does not match the required constraint %s.', + $required['PHP_constraint']['constraint']->asString() + ); + } + } + + if (!empty($required['PHPUnit'])) { + $phpunitVersion = Version::id(); + + $operator = empty($required['PHPUnit']['operator']) ? '>=' : $required['PHPUnit']['operator']; + + if (!\version_compare($phpunitVersion, $required['PHPUnit']['version'], $operator)) { + $missing[] = \sprintf('PHPUnit %s %s is required.', $operator, $required['PHPUnit']['version']); + } + } elseif (!empty($required['PHPUnit_constraint'])) { + $phpunitVersion = new \PharIo\Version\Version(self::sanitizeVersionNumber(Version::id())); + + if (!$required['PHPUnit_constraint']['constraint']->complies($phpunitVersion)) { + $missing[] = \sprintf( + 'PHPUnit version does not match the required constraint %s.', + $required['PHPUnit_constraint']['constraint']->asString() + ); + } + } + + if (!empty($required['OSFAMILY']) && $required['OSFAMILY'] !== (new OperatingSystem)->getFamily()) { + $missing[] = \sprintf('Operating system %s is required.', $required['OSFAMILY']); + } + + if (!empty($required['OS'])) { + $requiredOsPattern = \sprintf('/%s/i', \addcslashes($required['OS'], '/')); + + if (!\preg_match($requiredOsPattern, \PHP_OS)) { + $missing[] = \sprintf('Operating system matching %s is required.', $requiredOsPattern); + } + } + + if (!empty($required['functions'])) { + foreach ($required['functions'] as $function) { + $pieces = \explode('::', $function); + + if (\count($pieces) === 2 && \method_exists($pieces[0], $pieces[1])) { + continue; + } + + if (\function_exists($function)) { + continue; + } + + $missing[] = \sprintf('Function %s is required.', $function); + } + } + + if (!empty($required['setting'])) { + foreach ($required['setting'] as $setting => $value) { + if (\ini_get($setting) != $value) { + $missing[] = \sprintf('Setting "%s" must be "%s".', $setting, $value); + } + } + } + + if (!empty($required['extensions'])) { + foreach ($required['extensions'] as $extension) { + if (isset($required['extension_versions'][$extension])) { + continue; + } + + if (!\extension_loaded($extension)) { + $missing[] = \sprintf('Extension %s is required.', $extension); + } + } + } + + if (!empty($required['extension_versions'])) { + foreach ($required['extension_versions'] as $extension => $required) { + $actualVersion = \phpversion($extension); + + $operator = empty($required['operator']) ? '>=' : $required['operator']; + + if ($actualVersion === false || !\version_compare($actualVersion, $required['version'], $operator)) { + $missing[] = \sprintf('Extension %s %s %s is required.', $extension, $operator, $required['version']); + } + } + } + + return $missing; + } + + /** + * Returns the expected exception for a test. + * + * @return array|false + */ + public static function getExpectedException(string $className, ?string $methodName) + { + $reflector = new ReflectionMethod($className, $methodName); + $docComment = $reflector->getDocComment(); + $docComment = \substr($docComment, 3, -2); + + if (\preg_match(self::REGEX_EXPECTED_EXCEPTION, $docComment, $matches)) { + $annotations = self::parseTestMethodAnnotations( + $className, + $methodName + ); + + $class = $matches[1]; + $code = null; + $message = ''; + $messageRegExp = ''; + + if (isset($matches[2])) { + $message = \trim($matches[2]); + } elseif (isset($annotations['method']['expectedExceptionMessage'])) { + $message = self::parseAnnotationContent( + $annotations['method']['expectedExceptionMessage'][0] + ); + } + + if (isset($annotations['method']['expectedExceptionMessageRegExp'])) { + $messageRegExp = self::parseAnnotationContent( + $annotations['method']['expectedExceptionMessageRegExp'][0] + ); + } + + if (isset($matches[3])) { + $code = $matches[3]; + } elseif (isset($annotations['method']['expectedExceptionCode'])) { + $code = self::parseAnnotationContent( + $annotations['method']['expectedExceptionCode'][0] + ); + } + + if (\is_numeric($code)) { + $code = (int) $code; + } elseif (\is_string($code) && \defined($code)) { + $code = (int) \constant($code); + } + + return [ + 'class' => $class, 'code' => $code, 'message' => $message, 'message_regex' => $messageRegExp, + ]; + } + + return false; + } + + /** + * Returns the provided data for a method. + * + * @throws Exception + */ + public static function getProvidedData(string $className, string $methodName): ?array + { + $reflector = new ReflectionMethod($className, $methodName); + $docComment = $reflector->getDocComment(); + + $data = self::getDataFromDataProviderAnnotation($docComment, $className, $methodName); + + if ($data === null) { + $data = self::getDataFromTestWithAnnotation($docComment); + } + + if ($data === []) { + throw new SkippedTestError; + } + + if ($data !== null) { + foreach ($data as $key => $value) { + if (!\is_array($value)) { + throw new Exception( + \sprintf( + 'Data set %s is invalid.', + \is_int($key) ? '#' . $key : '"' . $key . '"' + ) + ); + } + } + } + + return $data; + } + + /** + * @throws Exception + */ + public static function getDataFromTestWithAnnotation(string $docComment): ?array + { + $docComment = self::cleanUpMultiLineAnnotation($docComment); + + if (\preg_match(self::REGEX_TEST_WITH, $docComment, $matches, \PREG_OFFSET_CAPTURE)) { + $offset = \strlen($matches[0][0]) + $matches[0][1]; + $annotationContent = \substr($docComment, $offset); + $data = []; + + foreach (\explode("\n", $annotationContent) as $candidateRow) { + $candidateRow = \trim($candidateRow); + + if ($candidateRow[0] !== '[') { + break; + } + + $dataSet = \json_decode($candidateRow, true); + + if (\json_last_error() !== \JSON_ERROR_NONE) { + throw new Exception( + 'The data set for the @testWith annotation cannot be parsed: ' . \json_last_error_msg() + ); + } + + $data[] = $dataSet; + } + + if (!$data) { + throw new Exception('The data set for the @testWith annotation cannot be parsed.'); + } + + return $data; + } + + return null; + } + + public static function parseTestMethodAnnotations(string $className, ?string $methodName = ''): array + { + if (!isset(self::$annotationCache[$className])) { + $class = new ReflectionClass($className); + $traits = $class->getTraits(); + $annotations = []; + + foreach ($traits as $trait) { + $annotations = \array_merge( + $annotations, + self::parseAnnotations($trait->getDocComment()) + ); + } + + self::$annotationCache[$className] = \array_merge( + $annotations, + self::parseAnnotations($class->getDocComment()) + ); + } + + $cacheKey = $className . '::' . $methodName; + + if ($methodName !== null && !isset(self::$annotationCache[$cacheKey])) { + try { + $method = new ReflectionMethod($className, $methodName); + $annotations = self::parseAnnotations($method->getDocComment()); + } catch (ReflectionException $e) { + $annotations = []; + } + + self::$annotationCache[$cacheKey] = $annotations; + } + + return [ + 'class' => self::$annotationCache[$className], + 'method' => $methodName !== null ? self::$annotationCache[$cacheKey] : [], + ]; + } + + public static function getInlineAnnotations(string $className, string $methodName): array + { + $method = new ReflectionMethod($className, $methodName); + $code = \file($method->getFileName()); + $lineNumber = $method->getStartLine(); + $startLine = $method->getStartLine() - 1; + $endLine = $method->getEndLine() - 1; + $methodLines = \array_slice($code, $startLine, $endLine - $startLine + 1); + $annotations = []; + + foreach ($methodLines as $line) { + if (\preg_match('#/\*\*?\s*@(?P[A-Za-z_-]+)(?:[ \t]+(?P.*?))?[ \t]*\r?\*/$#m', $line, $matches)) { + $annotations[\strtolower($matches['name'])] = [ + 'line' => $lineNumber, + 'value' => $matches['value'], + ]; + } + + $lineNumber++; + } + + return $annotations; + } + + public static function parseAnnotations(string $docBlock): array + { + $annotations = []; + // Strip away the docblock header and footer to ease parsing of one line annotations + $docBlock = \substr($docBlock, 3, -2); + + if (\preg_match_all('/@(?P[A-Za-z_-]+)(?:[ \t]+(?P.*?))?[ \t]*\r?$/m', $docBlock, $matches)) { + $numMatches = \count($matches[0]); + + for ($i = 0; $i < $numMatches; ++$i) { + $annotations[$matches['name'][$i]][] = (string) $matches['value'][$i]; + } + } + + return $annotations; + } + + public static function getBackupSettings(string $className, string $methodName): array + { + return [ + 'backupGlobals' => self::getBooleanAnnotationSetting( + $className, + $methodName, + 'backupGlobals' + ), + 'backupStaticAttributes' => self::getBooleanAnnotationSetting( + $className, + $methodName, + 'backupStaticAttributes' + ), + ]; + } + + public static function getDependencies(string $className, string $methodName): array + { + $annotations = self::parseTestMethodAnnotations( + $className, + $methodName + ); + + $dependencies = []; + + if (isset($annotations['class']['depends'])) { + $dependencies = $annotations['class']['depends']; + } + + if (isset($annotations['method']['depends'])) { + $dependencies = \array_merge( + $dependencies, + $annotations['method']['depends'] + ); + } + + return \array_unique($dependencies); + } + + public static function getErrorHandlerSettings(string $className, ?string $methodName): ?bool + { + return self::getBooleanAnnotationSetting( + $className, + $methodName, + 'errorHandler' + ); + } + + public static function getGroups(string $className, ?string $methodName = ''): array + { + $annotations = self::parseTestMethodAnnotations( + $className, + $methodName + ); + + $groups = []; + + if (isset($annotations['method']['author'])) { + $groups = $annotations['method']['author']; + } elseif (isset($annotations['class']['author'])) { + $groups = $annotations['class']['author']; + } + + if (isset($annotations['class']['group'])) { + $groups = \array_merge($groups, $annotations['class']['group']); + } + + if (isset($annotations['method']['group'])) { + $groups = \array_merge($groups, $annotations['method']['group']); + } + + if (isset($annotations['class']['ticket'])) { + $groups = \array_merge($groups, $annotations['class']['ticket']); + } + + if (isset($annotations['method']['ticket'])) { + $groups = \array_merge($groups, $annotations['method']['ticket']); + } + + foreach (['method', 'class'] as $element) { + foreach (['small', 'medium', 'large'] as $size) { + if (isset($annotations[$element][$size])) { + $groups[] = $size; + + break 2; + } + } + } + + return \array_unique($groups); + } + + public static function getSize(string $className, ?string $methodName): int + { + $groups = \array_flip(self::getGroups($className, $methodName)); + + if (isset($groups['large'])) { + return self::LARGE; + } + + if (isset($groups['medium'])) { + return self::MEDIUM; + } + + if (isset($groups['small'])) { + return self::SMALL; + } + + return self::UNKNOWN; + } + + public static function getProcessIsolationSettings(string $className, string $methodName): bool + { + $annotations = self::parseTestMethodAnnotations( + $className, + $methodName + ); + + return isset($annotations['class']['runTestsInSeparateProcesses']) || isset($annotations['method']['runInSeparateProcess']); + } + + public static function getClassProcessIsolationSettings(string $className, string $methodName): bool + { + $annotations = self::parseTestMethodAnnotations( + $className, + $methodName + ); + + return isset($annotations['class']['runClassInSeparateProcess']); + } + + public static function getPreserveGlobalStateSettings(string $className, string $methodName): ?bool + { + return self::getBooleanAnnotationSetting( + $className, + $methodName, + 'preserveGlobalState' + ); + } + + public static function getHookMethods(string $className): array + { + if (!\class_exists($className, false)) { + return self::emptyHookMethodsArray(); + } + + if (!isset(self::$hookMethods[$className])) { + self::$hookMethods[$className] = self::emptyHookMethodsArray(); + + try { + $class = new ReflectionClass($className); + + foreach ($class->getMethods() as $method) { + if ($method->getDeclaringClass()->getName() === Assert::class) { + continue; + } + + if ($method->getDeclaringClass()->getName() === TestCase::class) { + continue; + } + + if ($methodComment = $method->getDocComment()) { + if ($method->isStatic()) { + if (\strpos($methodComment, '@beforeClass') !== false) { + \array_unshift( + self::$hookMethods[$className]['beforeClass'], + $method->getName() + ); + } + + if (\strpos($methodComment, '@afterClass') !== false) { + self::$hookMethods[$className]['afterClass'][] = $method->getName(); + } + } + + if (\preg_match('/@before\b/', $methodComment) > 0) { + \array_unshift( + self::$hookMethods[$className]['before'], + $method->getName() + ); + } + + if (\preg_match('/@after\b/', $methodComment) > 0) { + self::$hookMethods[$className]['after'][] = $method->getName(); + } + } + } + } catch (ReflectionException $e) { + } + } + + return self::$hookMethods[$className]; + } + + /** + * @throws CodeCoverageException + */ + private static function getLinesToBeCoveredOrUsed(string $className, string $methodName, string $mode): array + { + $annotations = self::parseTestMethodAnnotations( + $className, + $methodName + ); + + $classShortcut = null; + + if (!empty($annotations['class'][$mode . 'DefaultClass'])) { + if (\count($annotations['class'][$mode . 'DefaultClass']) > 1) { + throw new CodeCoverageException( + \sprintf( + 'More than one @%sClass annotation in class or interface "%s".', + $mode, + $className + ) + ); + } + + $classShortcut = $annotations['class'][$mode . 'DefaultClass'][0]; + } + + $list = []; + + if (isset($annotations['class'][$mode])) { + $list = $annotations['class'][$mode]; + } + + if (isset($annotations['method'][$mode])) { + $list = \array_merge($list, $annotations['method'][$mode]); + } + + $codeList = []; + + foreach (\array_unique($list) as $element) { + if ($classShortcut && \strncmp($element, '::', 2) === 0) { + $element = $classShortcut . $element; + } + + $element = \preg_replace('/[\s()]+$/', '', $element); + $element = \explode(' ', $element); + $element = $element[0]; + + if ($mode === 'covers' && \interface_exists($element)) { + throw new InvalidCoversTargetException( + \sprintf( + 'Trying to @cover interface "%s".', + $element + ) + ); + } + + $codeList = \array_merge( + $codeList, + self::resolveElementToReflectionObjects($element) + ); + } + + return self::resolveReflectionObjectsToLines($codeList); + } + + /** + * Parse annotation content to use constant/class constant values + * + * Constants are specified using a starting '@'. For example: @ClassName::CONST_NAME + * + * If the constant is not found the string is used as is to ensure maximum BC. + */ + private static function parseAnnotationContent(string $message): string + { + if (\defined($message) && (\strpos($message, '::') !== false && \substr_count($message, '::') + 1 === 2)) { + $message = \constant($message); + } + + return $message; + } + + /** + * Returns the provided data for a method. + */ + private static function getDataFromDataProviderAnnotation(string $docComment, string $className, string $methodName): ?iterable + { + if (\preg_match_all(self::REGEX_DATA_PROVIDER, $docComment, $matches)) { + $result = []; + + foreach ($matches[1] as $match) { + $dataProviderMethodNameNamespace = \explode('\\', $match); + $leaf = \explode('::', \array_pop($dataProviderMethodNameNamespace)); + $dataProviderMethodName = \array_pop($leaf); + + if (empty($dataProviderMethodNameNamespace)) { + $dataProviderMethodNameNamespace = ''; + } else { + $dataProviderMethodNameNamespace = \implode('\\', $dataProviderMethodNameNamespace) . '\\'; + } + + if (empty($leaf)) { + $dataProviderClassName = $className; + } else { + $dataProviderClassName = $dataProviderMethodNameNamespace . \array_pop($leaf); + } + + $dataProviderClass = new ReflectionClass($dataProviderClassName); + $dataProviderMethod = $dataProviderClass->getMethod( + $dataProviderMethodName + ); + + if ($dataProviderMethod->isStatic()) { + $object = null; + } else { + $object = $dataProviderClass->newInstance(); + } + + if ($dataProviderMethod->getNumberOfParameters() === 0) { + $data = $dataProviderMethod->invoke($object); + } else { + $data = $dataProviderMethod->invoke($object, $methodName); + } + + if ($data instanceof Traversable) { + $origData = $data; + $data = []; + + foreach ($origData as $key => $value) { + if (\is_int($key)) { + $data[] = $value; + } else { + $data[$key] = $value; + } + } + } + + if (\is_array($data)) { + $result = \array_merge($result, $data); + } + } + + return $result; + } + + return null; + } + + private static function cleanUpMultiLineAnnotation(string $docComment): string + { + //removing initial ' * ' for docComment + $docComment = \str_replace("\r\n", "\n", $docComment); + $docComment = \preg_replace('/' . '\n' . '\s*' . '\*' . '\s?' . '/', "\n", $docComment); + $docComment = \substr($docComment, 0, -1); + + return \rtrim($docComment, "\n"); + } + + private static function emptyHookMethodsArray(): array + { + return [ + 'beforeClass' => ['setUpBeforeClass'], + 'before' => ['setUp'], + 'after' => ['tearDown'], + 'afterClass' => ['tearDownAfterClass'], + ]; + } + + private static function getBooleanAnnotationSetting(string $className, ?string $methodName, string $settingName): ?bool + { + $annotations = self::parseTestMethodAnnotations( + $className, + $methodName + ); + + if (isset($annotations['method'][$settingName])) { + if ($annotations['method'][$settingName][0] === 'enabled') { + return true; + } + + if ($annotations['method'][$settingName][0] === 'disabled') { + return false; + } + } + + if (isset($annotations['class'][$settingName])) { + if ($annotations['class'][$settingName][0] === 'enabled') { + return true; + } + + if ($annotations['class'][$settingName][0] === 'disabled') { + return false; + } + } + + return null; + } + + /** + * @throws InvalidCoversTargetException + */ + private static function resolveElementToReflectionObjects(string $element): array + { + $codeToCoverList = []; + + if (\strpos($element, '\\') !== false && \function_exists($element)) { + $codeToCoverList[] = new ReflectionFunction($element); + } elseif (\strpos($element, '::') !== false) { + [$className, $methodName] = \explode('::', $element); + + if (isset($methodName[0]) && $methodName[0] === '<') { + $classes = [$className]; + + foreach ($classes as $className) { + if (!\class_exists($className) && + !\interface_exists($className) && + !\trait_exists($className)) { + throw new InvalidCoversTargetException( + \sprintf( + 'Trying to @cover or @use not existing class or ' . + 'interface "%s".', + $className + ) + ); + } + + $class = new ReflectionClass($className); + $methods = $class->getMethods(); + $inverse = isset($methodName[1]) && $methodName[1] === '!'; + $visibility = 'isPublic'; + + if (\strpos($methodName, 'protected')) { + $visibility = 'isProtected'; + } elseif (\strpos($methodName, 'private')) { + $visibility = 'isPrivate'; + } + + foreach ($methods as $method) { + if ($inverse && !$method->$visibility()) { + $codeToCoverList[] = $method; + } elseif (!$inverse && $method->$visibility()) { + $codeToCoverList[] = $method; + } + } + } + } else { + $classes = [$className]; + + foreach ($classes as $className) { + if ($className === '' && \function_exists($methodName)) { + $codeToCoverList[] = new ReflectionFunction( + $methodName + ); + } else { + if (!((\class_exists($className) || \interface_exists($className) || \trait_exists($className)) && + \method_exists($className, $methodName))) { + throw new InvalidCoversTargetException( + \sprintf( + 'Trying to @cover or @use not existing method "%s::%s".', + $className, + $methodName + ) + ); + } + + $codeToCoverList[] = new ReflectionMethod( + $className, + $methodName + ); + } + } + } + } else { + $extended = false; + + if (\strpos($element, '') !== false) { + $element = \str_replace('', '', $element); + $extended = true; + } + + $classes = [$element]; + + if ($extended) { + $classes = \array_merge( + $classes, + \class_implements($element), + \class_parents($element) + ); + } + + foreach ($classes as $className) { + if (!\class_exists($className) && + !\interface_exists($className) && + !\trait_exists($className)) { + throw new InvalidCoversTargetException( + \sprintf( + 'Trying to @cover or @use not existing class or ' . + 'interface "%s".', + $className + ) + ); + } + + $codeToCoverList[] = new ReflectionClass($className); + } + } + + return $codeToCoverList; + } + + private static function resolveReflectionObjectsToLines(array $reflectors): array + { + $result = []; + + foreach ($reflectors as $reflector) { + if ($reflector instanceof ReflectionClass) { + foreach ($reflector->getTraits() as $trait) { + $reflectors[] = $trait; + } + } + } + + foreach ($reflectors as $reflector) { + $filename = $reflector->getFileName(); + + if (!isset($result[$filename])) { + $result[$filename] = []; + } + + $result[$filename] = \array_merge( + $result[$filename], + \range($reflector->getStartLine(), $reflector->getEndLine()) + ); + } + + foreach ($result as $filename => $lineNumbers) { + $result[$filename] = \array_keys(\array_flip($lineNumbers)); + } + + return $result; + } + + /** + * Trims any extensions from version string that follows after + * the .[.] format + */ + private static function sanitizeVersionNumber(string $version) + { + return \preg_replace( + '/^(\d+\.\d+(?:.\d+)?).*$/', + '$1', + $version + ); + } + + private static function shouldCoversAnnotationBeUsed(array $annotations): bool + { + if (isset($annotations['method']['coversNothing'])) { + return false; + } + + if (isset($annotations['method']['covers'])) { + return true; + } + + if (isset($annotations['class']['coversNothing'])) { + return false; + } + + return true; + } +} diff --git a/vendor/phpunit/phpunit/src/Util/TestDox/CliTestDoxPrinter.php b/vendor/phpunit/phpunit/src/Util/TestDox/CliTestDoxPrinter.php new file mode 100644 index 0000000..217377e --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/TestDox/CliTestDoxPrinter.php @@ -0,0 +1,429 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\TestDox; + +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Test; +use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestResult; +use PHPUnit\Framework\TestSuite; +use PHPUnit\Framework\Warning; +use PHPUnit\Runner\PhptTestCase; +use PHPUnit\Runner\TestSuiteSorter; +use PHPUnit\TextUI\ResultPrinter; +use SebastianBergmann\Timer\Timer; + +/** + * This printer is for CLI output only. For the classes that output to file, html and xml, + * please refer to the PHPUnit\Util\TestDox namespace + */ +class CliTestDoxPrinter extends ResultPrinter +{ + /** + * @var int[] + */ + private $nonSuccessfulTestResults = []; + + /** + * @var NamePrettifier + */ + private $prettifier; + + /** + * @var int The number of test results received from the TestRunner + */ + private $testIndex = 0; + + /** + * @var int The number of test results already sent to the output + */ + private $testFlushIndex = 0; + + /** + * @var array Buffer for write() + */ + private $outputBuffer = []; + + /** + * @var bool + */ + private $bufferExecutionOrder = false; + + /** + * @var array array + */ + private $originalExecutionOrder = []; + + /** + * @var string Classname of the current test + */ + private $className = ''; + + /** + * @var string Classname of the previous test; empty for first test + */ + private $lastClassName = ''; + + /** + * @var string Prettified test name of current test + */ + private $testMethod; + + /** + * @var string Test result message of current test + */ + private $testResultMessage; + + /** + * @var bool Test result message of current test contains a verbose dump + */ + private $lastFlushedTestWasVerbose = false; + + public function __construct( + $out = null, + bool $verbose = false, + $colors = self::COLOR_DEFAULT, + bool $debug = false, + $numberOfColumns = 80, + bool $reverse = false + ) { + parent::__construct($out, $verbose, $colors, $debug, $numberOfColumns, $reverse); + + $this->prettifier = new NamePrettifier; + } + + public function setOriginalExecutionOrder(array $order): void + { + $this->originalExecutionOrder = $order; + $this->bufferExecutionOrder = !empty($order); + } + + public function startTest(Test $test): void + { + if (!$test instanceof TestCase && !$test instanceof PhptTestCase && !$test instanceof TestSuite) { + return; + } + + $this->lastTestFailed = false; + $this->lastClassName = $this->className; + $this->testResultMessage = ''; + + if ($test instanceof TestCase) { + $className = $this->prettifier->prettifyTestClass(\get_class($test)); + $testMethod = $this->prettifier->prettifyTestCase($test); + } elseif ($test instanceof PhptTestCase) { + $className = \get_class($test); + $testMethod = $test->getName(); + } + + $this->className = $className; + $this->testMethod = $testMethod; + + parent::startTest($test); + } + + public function endTest(Test $test, float $time): void + { + if (!$test instanceof TestCase && !$test instanceof PhptTestCase && !$test instanceof TestSuite) { + return; + } + + if ($test instanceof TestCase || $test instanceof PhptTestCase) { + $this->testIndex++; + } + + if ($this->lastTestFailed) { + $resultMessage = $this->testResultMessage; + $this->nonSuccessfulTestResults[] = $this->testIndex; + } else { + $resultMessage = $this->formatTestResultMessage( + $this->formatWithColor('fg-green', '✔'), + '', + $time, + $this->verbose + ); + } + + if ($this->bufferExecutionOrder) { + $this->bufferTestResult($test, $resultMessage); + $this->flushOutputBuffer(); + } else { + $this->writeTestResult($resultMessage); + + if ($this->lastTestFailed) { + $this->bufferTestResult($test, $resultMessage); + } + } + + parent::endTest($test, $time); + } + + public function addError(Test $test, \Throwable $t, float $time): void + { + $this->lastTestFailed = true; + $this->testResultMessage = $this->formatTestResultMessage( + $this->formatWithColor('fg-yellow', '✘'), + (string) $t, + $time, + true + ); + } + + public function addWarning(Test $test, Warning $e, float $time): void + { + $this->lastTestFailed = true; + $this->testResultMessage = $this->formatTestResultMessage( + $this->formatWithColor('fg-yellow', '✘'), + (string) $e, + $time, + true + ); + } + + public function addFailure(Test $test, AssertionFailedError $e, float $time): void + { + $this->lastTestFailed = true; + $this->testResultMessage = $this->formatTestResultMessage( + $this->formatWithColor('fg-red', '✘'), + (string) $e, + $time, + true + ); + } + + public function addIncompleteTest(Test $test, \Throwable $t, float $time): void + { + $this->lastTestFailed = true; + $this->testResultMessage = $this->formatTestResultMessage( + $this->formatWithColor('fg-yellow', '∅'), + (string) $t, + $time, + false + ); + } + + public function addRiskyTest(Test $test, \Throwable $t, float $time): void + { + $this->lastTestFailed = true; + $this->testResultMessage = $this->formatTestResultMessage( + $this->formatWithColor('fg-yellow', '☢'), + (string) $t, + $time, + false + ); + } + + public function addSkippedTest(Test $test, \Throwable $t, float $time): void + { + $this->lastTestFailed = true; + $this->testResultMessage = $this->formatTestResultMessage( + $this->formatWithColor('fg-yellow', '→'), + (string) $t, + $time, + false + ); + } + + public function bufferTestResult(Test $test, string $msg): void + { + $this->outputBuffer[$this->testIndex] = [ + 'className' => $this->className, + 'testName' => TestSuiteSorter::getTestSorterUID($test), + 'testMethod' => $this->testMethod, + 'message' => $msg, + 'failed' => $this->lastTestFailed, + 'verbose' => $this->lastFlushedTestWasVerbose, + ]; + } + + public function writeTestResult(string $msg): void + { + $msg = $this->formatTestSuiteHeader($this->lastClassName, $this->className, $msg); + $this->write($msg); + } + + public function writeProgress(string $progress): void + { + } + + public function flush(): void + { + } + + public function printResult(TestResult $result): void + { + $this->printHeader(); + + $this->printNonSuccessfulTestsSummary($result->count()); + + $this->printFooter($result); + } + + protected function printHeader(): void + { + $this->write("\n" . Timer::resourceUsage() . "\n\n"); + } + + private function flushOutputBuffer(): void + { + if ($this->testFlushIndex === $this->testIndex) { + return; + } + + if ($this->testFlushIndex > 0) { + $prevResult = $this->getTestResultByName($this->originalExecutionOrder[$this->testFlushIndex - 1]); + } else { + $prevResult = $this->getEmptyTestResult(); + } + + do { + $flushed = false; + $result = $this->getTestResultByName($this->originalExecutionOrder[$this->testFlushIndex]); + + if (!empty($result)) { + $this->writeBufferTestResult($prevResult, $result); + $this->testFlushIndex++; + $prevResult = $result; + $flushed = true; + } + } while ($flushed && $this->testFlushIndex < $this->testIndex); + } + + private function writeBufferTestResult(array $prevResult, array $result): void + { + // Write spacer line for new suite headers and after verbose messages + if ($prevResult['testName'] !== '' && + ($prevResult['verbose'] === true || $prevResult['className'] !== $result['className'])) { + $this->write("\n"); + } + + // Write suite header + if ($prevResult['className'] !== $result['className']) { + $this->write($result['className'] . "\n"); + } + + // Write the test result itself + $this->write($result['message']); + } + + private function getTestResultByName(string $testName): array + { + foreach ($this->outputBuffer as $result) { + if ($result['testName'] === $testName) { + return $result; + } + } + + return []; + } + + private function formatTestSuiteHeader(?string $lastClassName, string $className, string $msg): string + { + if ($lastClassName === null || $className !== $lastClassName) { + return \sprintf( + "%s%s\n%s", + ($this->lastClassName !== '') ? "\n" : '', + $className, + $msg + ); + } + + return $msg; + } + + private function formatTestResultMessage( + string $symbol, + string $resultMessage, + float $time, + bool $alwaysVerbose = false + ): string { + $additionalInformation = $this->getFormattedAdditionalInformation($resultMessage, $alwaysVerbose); + $msg = \sprintf( + " %s %s%s\n%s", + $symbol, + $this->testMethod, + $this->verbose ? ' ' . $this->getFormattedRuntime($time) : '', + $additionalInformation + ); + + $this->lastFlushedTestWasVerbose = !empty($additionalInformation); + + return $msg; + } + + private function getFormattedRuntime(float $time): string + { + if ($time > 5) { + return $this->formatWithColor('fg-red', \sprintf('[%.2f ms]', $time * 1000)); + } + + if ($time > 1) { + return $this->formatWithColor('fg-yellow', \sprintf('[%.2f ms]', $time * 1000)); + } + + return \sprintf('[%.2f ms]', $time * 1000); + } + + private function getFormattedAdditionalInformation(string $resultMessage, bool $verbose): string + { + if ($resultMessage === '') { + return ''; + } + + if (!($this->verbose || $verbose)) { + return ''; + } + + return \sprintf( + " │\n%s\n", + \implode( + "\n", + \array_map( + function (string $text) { + return \sprintf(' │ %s', $text); + }, + \explode("\n", $resultMessage) + ) + ) + ); + } + + private function printNonSuccessfulTestsSummary(int $numberOfExecutedTests): void + { + if (empty($this->nonSuccessfulTestResults)) { + return; + } + + if ((\count($this->nonSuccessfulTestResults) / $numberOfExecutedTests) >= 0.7) { + return; + } + + $this->write("Summary of non-successful tests:\n\n"); + + $prevResult = $this->getEmptyTestResult(); + + foreach ($this->nonSuccessfulTestResults as $testIndex) { + $result = $this->outputBuffer[$testIndex]; + $this->writeBufferTestResult($prevResult, $result); + $prevResult = $result; + } + } + + private function getEmptyTestResult(): array + { + return [ + 'className' => '', + 'testName' => '', + 'message' => '', + 'failed' => '', + 'verbose' => '', + ]; + } +} diff --git a/vendor/phpunit/phpunit/src/Util/TestDox/HtmlResultPrinter.php b/vendor/phpunit/phpunit/src/Util/TestDox/HtmlResultPrinter.php new file mode 100644 index 0000000..7167543 --- /dev/null +++ b/vendor/phpunit/phpunit/src/Util/TestDox/HtmlResultPrinter.php @@ -0,0 +1,131 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\Util\TestDox; + +/** + * Prints TestDox documentation in HTML format. + */ +final class HtmlResultPrinter extends ResultPrinter +{ + /** + * @var string + */ + private const PAGE_HEADER = << + + + + Test Documentation + + + +EOT; + + /** + * @var string + */ + private const CLASS_HEADER = <<%s +